mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Remove xtreme assets struct
This commit is contained in:
@@ -28,7 +28,7 @@ void bad_kb_scene_error_on_enter(void* context) {
|
||||
app->widget, GuiButtonTypeLeft, "Back", bad_kb_scene_error_event_callback, app);
|
||||
} else if(app->error == BadKbAppErrorCloseRpc) {
|
||||
widget_add_icon_element(app->widget, 78, 0, &I_ActiveConnection_50x64);
|
||||
if(XTREME_ASSETS()->is_nsfw) {
|
||||
if(XTREME_SETTINGS()->is_nsfw) {
|
||||
widget_add_string_multiline_element(
|
||||
app->widget, 3, 2, AlignLeft, AlignTop, FontPrimary, "I am not\na whore!");
|
||||
widget_add_string_multiline_element(
|
||||
|
||||
@@ -47,7 +47,7 @@ static void bad_kb_draw_callback(Canvas* canvas, void* _model) {
|
||||
|
||||
if((model->state.state == BadKbStateIdle) || (model->state.state == BadKbStateDone) ||
|
||||
(model->state.state == BadKbStateNotConnected)) {
|
||||
if(XTREME_ASSETS()->is_nsfw) {
|
||||
if(XTREME_SETTINGS()->is_nsfw) {
|
||||
elements_button_center(canvas, "Cum");
|
||||
} else {
|
||||
elements_button_center(canvas, "Run");
|
||||
@@ -64,7 +64,7 @@ static void bad_kb_draw_callback(Canvas* canvas, void* _model) {
|
||||
if(model->state.state == BadKbStateNotConnected) {
|
||||
canvas_draw_icon(canvas, 4, 26, &I_Clock_18x18);
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
if(XTREME_ASSETS()->is_nsfw) {
|
||||
if(XTREME_SETTINGS()->is_nsfw) {
|
||||
canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Plug me");
|
||||
canvas_draw_str_aligned(canvas, 127, 43, AlignRight, AlignBottom, "in, Daddy");
|
||||
} else {
|
||||
@@ -74,7 +74,7 @@ static void bad_kb_draw_callback(Canvas* canvas, void* _model) {
|
||||
} else if(model->state.state == BadKbStateWillRun) {
|
||||
canvas_draw_icon(canvas, 4, 26, &I_Clock_18x18);
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
if(XTREME_ASSETS()->is_nsfw) {
|
||||
if(XTREME_SETTINGS()->is_nsfw) {
|
||||
canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Will cum");
|
||||
} else {
|
||||
canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Will run");
|
||||
|
||||
@@ -27,7 +27,7 @@ void u2f_scene_error_on_enter(void* context) {
|
||||
app->widget, GuiButtonTypeLeft, "Back", u2f_scene_error_event_callback, app);
|
||||
} else if(app->error == U2fAppErrorCloseRpc) {
|
||||
widget_add_icon_element(app->widget, 78, 0, &I_ActiveConnection_50x64);
|
||||
if(XTREME_ASSETS()->is_nsfw) {
|
||||
if(XTREME_SETTINGS()->is_nsfw) {
|
||||
widget_add_string_multiline_element(
|
||||
app->widget, 3, 2, AlignLeft, AlignTop, FontPrimary, "I am not\na whore!");
|
||||
widget_add_string_multiline_element(
|
||||
|
||||
@@ -21,7 +21,7 @@ static void u2f_view_draw_callback(Canvas* canvas, void* _model) {
|
||||
|
||||
if(model->display_msg == U2fMsgNotConnected) {
|
||||
canvas_draw_icon(canvas, 22, 15, &I_Connect_me_62x31);
|
||||
if(XTREME_ASSETS()->is_nsfw) {
|
||||
if(XTREME_SETTINGS()->is_nsfw) {
|
||||
canvas_draw_str_aligned(
|
||||
canvas, 128 / 2, 3, AlignCenter, AlignTop, "Plug me in d-daddy");
|
||||
} else {
|
||||
@@ -32,7 +32,7 @@ static void u2f_view_draw_callback(Canvas* canvas, void* _model) {
|
||||
canvas_draw_icon(canvas, 22, 15, &I_Connected_62x31);
|
||||
canvas_draw_str_aligned(canvas, 128 / 2, 3, AlignCenter, AlignTop, "Connected!");
|
||||
} else if(model->display_msg == U2fMsgRegister) {
|
||||
if(XTREME_ASSETS()->is_nsfw) {
|
||||
if(XTREME_SETTINGS()->is_nsfw) {
|
||||
elements_button_center(canvas, "CUM");
|
||||
canvas_draw_icon(canvas, 22, 15, &I_Auth_62x31);
|
||||
canvas_draw_str_aligned(
|
||||
@@ -44,7 +44,7 @@ static void u2f_view_draw_callback(Canvas* canvas, void* _model) {
|
||||
canvas, 128 / 2, 3, AlignCenter, AlignTop, "Press OK to register");
|
||||
}
|
||||
} else if(model->display_msg == U2fMsgAuth) {
|
||||
if(XTREME_ASSETS()->is_nsfw) {
|
||||
if(XTREME_SETTINGS()->is_nsfw) {
|
||||
elements_button_center(canvas, "CUM");
|
||||
canvas_draw_icon(canvas, 22, 15, &I_Auth_62x31);
|
||||
canvas_draw_str_aligned(
|
||||
@@ -57,7 +57,7 @@ static void u2f_view_draw_callback(Canvas* canvas, void* _model) {
|
||||
}
|
||||
} else if(model->display_msg == U2fMsgSuccess) {
|
||||
canvas_draw_icon(canvas, 22, 15, &I_Connected_62x31);
|
||||
if(XTREME_ASSETS()->is_nsfw) {
|
||||
if(XTREME_SETTINGS()->is_nsfw) {
|
||||
canvas_draw_str_aligned(canvas, 128 / 2, 3, AlignCenter, AlignTop, "Cum released~");
|
||||
} else {
|
||||
canvas_draw_str_aligned(
|
||||
@@ -65,7 +65,7 @@ static void u2f_view_draw_callback(Canvas* canvas, void* _model) {
|
||||
}
|
||||
} else if(model->display_msg == U2fMsgError) {
|
||||
canvas_draw_icon(canvas, 22, 15, &I_Error_62x31);
|
||||
if(XTREME_ASSETS()->is_nsfw) {
|
||||
if(XTREME_SETTINGS()->is_nsfw) {
|
||||
canvas_draw_str_aligned(canvas, 128 / 2, 3, AlignCenter, AlignTop, "Unable to cum");
|
||||
} else {
|
||||
canvas_draw_str_aligned(
|
||||
|
||||
@@ -15,7 +15,7 @@ void desktop_scene_fault_on_enter(void* context) {
|
||||
|
||||
Popup* popup = desktop->hw_mismatch_popup;
|
||||
popup_set_context(popup, desktop);
|
||||
if(XTREME_ASSETS()->is_nsfw) {
|
||||
if(XTREME_SETTINGS()->is_nsfw) {
|
||||
popup_set_header(
|
||||
popup,
|
||||
"Slut passed out\n but is now back",
|
||||
|
||||
@@ -38,7 +38,7 @@ static void render_callback(Canvas* canvas, void* _ctx) {
|
||||
const char* mood_str = NULL;
|
||||
const Icon* portrait = NULL;
|
||||
|
||||
if(XTREME_ASSETS()->is_nsfw) {
|
||||
if(XTREME_SETTINGS()->is_nsfw) {
|
||||
if(stats->butthurt <= 4) {
|
||||
portrait = &I_passport_happy_46x49;
|
||||
mood_str = "Status: Wet";
|
||||
|
||||
@@ -12,7 +12,7 @@ void power_settings_scene_power_off_on_enter(void* context) {
|
||||
DialogEx* dialog = app->dialog;
|
||||
|
||||
dialog_ex_set_header(dialog, "Turn Off Device?", 64, 2, AlignCenter, AlignTop);
|
||||
if(XTREME_ASSETS()->is_nsfw) {
|
||||
if(XTREME_SETTINGS()->is_nsfw) {
|
||||
dialog_ex_set_text(
|
||||
dialog, " I will be\nwaiting for\n you master", 78, 16, AlignLeft, AlignTop);
|
||||
} else {
|
||||
|
||||
@@ -322,7 +322,6 @@ Function,-,SK6805_set_led_color,void,"uint8_t, uint8_t, uint8_t, uint8_t"
|
||||
Function,-,SK6805_update,void,
|
||||
Function,-,SystemCoreClockUpdate,void,
|
||||
Function,-,SystemInit,void,
|
||||
Function,+,XTREME_ASSETS,XtremeAssets*,
|
||||
Function,+,XTREME_SETTINGS,XtremeSettings*,
|
||||
Function,+,XTREME_SETTINGS_SAVE,void,
|
||||
Function,-,_Exit,void,int
|
||||
|
||||
|
@@ -8,9 +8,7 @@
|
||||
|
||||
#define ICONS_FMT XTREME_ASSETS_PATH "/%s/Icons/%s"
|
||||
|
||||
XtremeAssets xtreme_assets = {};
|
||||
|
||||
void anim(const Icon* replace, const char* name, FuriString* path, File* file) {
|
||||
void ani(const Icon* replace, const char* name, FuriString* path, File* file) {
|
||||
const char* pack = XTREME_SETTINGS()->asset_pack;
|
||||
furi_string_printf(path, ICONS_FMT "/meta", pack, name);
|
||||
if(storage_file_open(file, furi_string_get_cstr(path), FSAM_READ, FSOM_OPEN_EXISTING)) {
|
||||
@@ -56,12 +54,13 @@ void anim(const Icon* replace, const char* name, FuriString* path, File* file) {
|
||||
}
|
||||
}
|
||||
|
||||
void icon(const Icon* replace, const char* name, FuriString* path, File* file) {
|
||||
void ico(const Icon* replace, const char* name, FuriString* path, File* file) {
|
||||
furi_string_printf(path, ICONS_FMT ".bmx", XTREME_SETTINGS()->asset_pack, name);
|
||||
if(storage_file_open(file, furi_string_get_cstr(path), FSAM_READ, FSOM_OPEN_EXISTING)) {
|
||||
uint64_t size = storage_file_size(file) - 8;
|
||||
uint8_t* frame = malloc(size);
|
||||
int32_t icon_width, icon_height;
|
||||
|
||||
if(storage_file_read(file, &icon_width, 4) == 4 &&
|
||||
storage_file_read(file, &icon_height, 4) == 4 &&
|
||||
storage_file_read(file, frame, size) == size) {
|
||||
@@ -79,54 +78,47 @@ void icon(const Icon* replace, const char* name, FuriString* path, File* file) {
|
||||
}
|
||||
}
|
||||
|
||||
void swap(FuriString* p, File* f) {
|
||||
anim(&A_Levelup_128x64, "Animations/Levelup_128x64", p, f);
|
||||
icon(&I_BLE_Pairing_128x64, "BLE/BLE_Pairing_128x64", p, f);
|
||||
icon(&I_DolphinCommon_56x48, "Dolphin/DolphinCommon_56x48", p, f);
|
||||
icon(&I_DolphinMafia_115x62, "iButton/DolphinMafia_115x62", p, f);
|
||||
icon(&I_DolphinNice_96x59, "iButton/DolphinNice_96x59", p, f);
|
||||
icon(&I_DolphinWait_61x59, "iButton/DolphinWait_61x59", p, f);
|
||||
icon(&I_iButtonDolphinVerySuccess_108x52, "iButton/iButtonDolphinVerySuccess_108x52", p, f);
|
||||
icon(&I_DolphinReadingSuccess_59x63, "Infrared/DolphinReadingSuccess_59x63", p, f);
|
||||
icon(&I_Lockscreen, "Interface/Lockscreen", p, f);
|
||||
icon(&I_WarningDolphin_45x42, "Interface/WarningDolphin_45x42", p, f);
|
||||
icon(&I_NFC_dolphin_emulation_47x61, "NFC/NFC_dolphin_emulation_47x61", p, f);
|
||||
icon(&I_passport_bad_46x49, "Passport/passport_bad_46x49", p, f);
|
||||
icon(&I_passport_DB, "Passport/passport_DB", p, f);
|
||||
icon(&I_passport_happy_46x49, "Passport/passport_happy_46x49", p, f);
|
||||
icon(&I_passport_okay_46x49, "Passport/passport_okay_46x49", p, f);
|
||||
icon(&I_RFIDDolphinReceive_97x61, "RFID/RFIDDolphinReceive_97x61", p, f);
|
||||
icon(&I_RFIDDolphinSend_97x61, "RFID/RFIDDolphinSend_97x61", p, f);
|
||||
icon(&I_RFIDDolphinSuccess_108x57, "RFID/RFIDDolphinSuccess_108x57", p, f);
|
||||
icon(&I_Cry_dolph_55x52, "Settings/Cry_dolph_55x52", p, f);
|
||||
icon(&I_Background_128x11, "StatusBar/Background_128x11", p, f);
|
||||
icon(&I_Fishing_123x52, "SubGhz/Fishing_123x52", p, f);
|
||||
icon(&I_Scanning_123x52, "SubGhz/Scanning_123x52", p, f);
|
||||
icon(&I_Auth_62x31, "U2F/Auth_62x31", p, f);
|
||||
icon(&I_Connect_me_62x31, "U2F/Connect_me_62x31", p, f);
|
||||
icon(&I_Connected_62x31, "U2F/Connected_62x31", p, f);
|
||||
icon(&I_Error_62x31, "U2F/Error_62x31", p, f);
|
||||
}
|
||||
|
||||
void XTREME_ASSETS_LOAD() {
|
||||
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
|
||||
if(xtreme_settings->asset_pack[0] == '\0') return;
|
||||
xtreme_assets.is_nsfw = strncmp(xtreme_settings->asset_pack, "NSFW", strlen("NSFW")) == 0;
|
||||
const char* pack = XTREME_SETTINGS()->asset_pack;
|
||||
if(pack[0] == '\0') return;
|
||||
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FuriString* p = furi_string_alloc();
|
||||
FileInfo info;
|
||||
FuriString* path = furi_string_alloc();
|
||||
furi_string_printf(path, XTREME_ASSETS_PATH "/%s", xtreme_settings->asset_pack);
|
||||
if(storage_common_stat(storage, furi_string_get_cstr(path), &info) == FSE_OK &&
|
||||
furi_string_printf(p, XTREME_ASSETS_PATH "/%s", pack);
|
||||
if(storage_common_stat(storage, furi_string_get_cstr(p), &info) == FSE_OK &&
|
||||
info.flags & FSF_DIRECTORY) {
|
||||
File* file = storage_file_alloc(storage);
|
||||
swap(path, file);
|
||||
storage_file_free(file);
|
||||
File* f = storage_file_alloc(storage);
|
||||
|
||||
ani(&A_Levelup_128x64, "Animations/Levelup_128x64", p, f);
|
||||
ico(&I_BLE_Pairing_128x64, "BLE/BLE_Pairing_128x64", p, f);
|
||||
ico(&I_DolphinCommon_56x48, "Dolphin/DolphinCommon_56x48", p, f);
|
||||
ico(&I_DolphinMafia_115x62, "iButton/DolphinMafia_115x62", p, f);
|
||||
ico(&I_DolphinNice_96x59, "iButton/DolphinNice_96x59", p, f);
|
||||
ico(&I_DolphinWait_61x59, "iButton/DolphinWait_61x59", p, f);
|
||||
ico(&I_iButtonDolphinVerySuccess_108x52, "iButton/iButtonDolphinVerySuccess_108x52", p, f);
|
||||
ico(&I_DolphinReadingSuccess_59x63, "Infrared/DolphinReadingSuccess_59x63", p, f);
|
||||
ico(&I_Lockscreen, "Interface/Lockscreen", p, f);
|
||||
ico(&I_WarningDolphin_45x42, "Interface/WarningDolphin_45x42", p, f);
|
||||
ico(&I_NFC_dolphin_emulation_47x61, "NFC/NFC_dolphin_emulation_47x61", p, f);
|
||||
ico(&I_passport_bad_46x49, "Passport/passport_bad_46x49", p, f);
|
||||
ico(&I_passport_DB, "Passport/passport_DB", p, f);
|
||||
ico(&I_passport_happy_46x49, "Passport/passport_happy_46x49", p, f);
|
||||
ico(&I_passport_okay_46x49, "Passport/passport_okay_46x49", p, f);
|
||||
ico(&I_RFIDDolphinReceive_97x61, "RFID/RFIDDolphinReceive_97x61", p, f);
|
||||
ico(&I_RFIDDolphinSend_97x61, "RFID/RFIDDolphinSend_97x61", p, f);
|
||||
ico(&I_RFIDDolphinSuccess_108x57, "RFID/RFIDDolphinSuccess_108x57", p, f);
|
||||
ico(&I_Cry_dolph_55x52, "Settings/Cry_dolph_55x52", p, f);
|
||||
ico(&I_Background_128x11, "StatusBar/Background_128x11", p, f);
|
||||
ico(&I_Fishing_123x52, "SubGhz/Fishing_123x52", p, f);
|
||||
ico(&I_Scanning_123x52, "SubGhz/Scanning_123x52", p, f);
|
||||
ico(&I_Auth_62x31, "U2F/Auth_62x31", p, f);
|
||||
ico(&I_Connect_me_62x31, "U2F/Connect_me_62x31", p, f);
|
||||
ico(&I_Connected_62x31, "U2F/Connected_62x31", p, f);
|
||||
ico(&I_Error_62x31, "U2F/Error_62x31", p, f);
|
||||
|
||||
storage_file_free(f);
|
||||
}
|
||||
furi_string_free(path);
|
||||
furi_string_free(p);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
}
|
||||
|
||||
XtremeAssets* XTREME_ASSETS() {
|
||||
return &xtreme_assets;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ void XTREME_SETTINGS_LOAD() {
|
||||
FuriString* string = furi_string_alloc();
|
||||
if(flipper_format_read_string(file, "asset_pack", string)) {
|
||||
strlcpy(x->asset_pack, furi_string_get_cstr(string), XTREME_ASSETS_PACK_NAME_LEN);
|
||||
x->is_nsfw = strncmp(x->asset_pack, "NSFW", strlen("NSFW")) == 0;
|
||||
}
|
||||
furi_string_free(string);
|
||||
flipper_format_rewind(file);
|
||||
|
||||
@@ -14,6 +14,7 @@ extern "C" {
|
||||
|
||||
typedef struct {
|
||||
char asset_pack[XTREME_ASSETS_PACK_NAME_LEN];
|
||||
bool is_nsfw; // TODO: replace with packs text support
|
||||
uint32_t anim_speed;
|
||||
int32_t cycle_anims;
|
||||
bool unlock_anims;
|
||||
@@ -41,12 +42,6 @@ typedef struct {
|
||||
void XTREME_SETTINGS_SAVE();
|
||||
XtremeSettings* XTREME_SETTINGS();
|
||||
|
||||
typedef struct {
|
||||
bool is_nsfw;
|
||||
} XtremeAssets;
|
||||
|
||||
XtremeAssets* XTREME_ASSETS();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user