From 5392971c2c21f436beb2ed4348b9e4cde5275049 Mon Sep 17 00:00:00 2001 From: CTCaer Date: Tue, 11 Oct 2022 04:19:29 +0300 Subject: [PATCH] hekate/nyx: utilize emmc_end --- bootloader/frontend/fe_emmc_tools.c | 4 ++-- bootloader/frontend/fe_info.c | 2 +- bootloader/frontend/fe_tools.c | 6 +++--- bootloader/hos/hos.c | 4 ++-- bootloader/main.c | 2 +- bootloader/storage/emummc.c | 16 ++++++++-------- nyx/nyx_gui/frontend/fe_emmc_tools.c | 4 ++-- nyx/nyx_gui/frontend/fe_emummc_tools.c | 6 +++--- nyx/nyx_gui/frontend/gui_emmc_tools.c | 2 -- nyx/nyx_gui/frontend/gui_emummc_tools.c | 4 ++-- nyx/nyx_gui/frontend/gui_info.c | 8 ++++---- nyx/nyx_gui/frontend/gui_tools.c | 4 ++-- nyx/nyx_gui/nyx.c | 2 +- 13 files changed, 31 insertions(+), 33 deletions(-) diff --git a/bootloader/frontend/fe_emmc_tools.c b/bootloader/frontend/fe_emmc_tools.c index 6c57e78..ec72e7b 100644 --- a/bootloader/frontend/fe_emmc_tools.c +++ b/bootloader/frontend/fe_emmc_tools.c @@ -557,7 +557,7 @@ static void _dump_emmc_selected(emmcPartType_t dumpType) gfx_putc('\n'); timer = get_tmr_s() - timer; gfx_printf("Time taken: %dm %ds.\n", timer / 60, timer % 60); - sdmmc_storage_end(&emmc_storage); + emmc_end(); if (res) gfx_printf("\n%kFinished and verified!%k\nPress any key...\n", TXT_CLR_GREENISH, TXT_CLR_DEFAULT); @@ -892,7 +892,7 @@ static void _restore_emmc_selected(emmcPartType_t restoreType) gfx_putc('\n'); timer = get_tmr_s() - timer; gfx_printf("Time taken: %dm %ds.\n", timer / 60, timer % 60); - sdmmc_storage_end(&emmc_storage); + emmc_end(); if (res) gfx_printf("\n%kFinished and verified!%k\nPress any key...\n", TXT_CLR_GREENISH, TXT_CLR_DEFAULT); diff --git a/bootloader/frontend/fe_info.c b/bootloader/frontend/fe_info.c index c1fb7cc..b9a97f6 100644 --- a/bootloader/frontend/fe_info.c +++ b/bootloader/frontend/fe_info.c @@ -239,7 +239,7 @@ void print_mmc_info() } out: - sdmmc_storage_end(&emmc_storage); + emmc_end(); btn_wait(); } diff --git a/bootloader/frontend/fe_tools.c b/bootloader/frontend/fe_tools.c index 8d29f85..41b422d 100644 --- a/bootloader/frontend/fe_tools.c +++ b/bootloader/frontend/fe_tools.c @@ -233,7 +233,7 @@ out_free: free(warmboot); free(loader); free(pkg2); - sdmmc_storage_end(&emmc_storage); + emmc_end(); sd_end(); if (kb >= KB_FIRMWARE_VERSION_620) @@ -280,7 +280,7 @@ void _toggle_autorcm(bool enable) } free(tempbuf); - sdmmc_storage_end(&emmc_storage); + emmc_end(); if (enable) gfx_printf("%kAutoRCM mode enabled!%k", TXT_CLR_ORANGE, TXT_CLR_DEFAULT); @@ -333,7 +333,7 @@ void menu_autorcm() disabled = false; free(tempbuf); - sdmmc_storage_end(&emmc_storage); + emmc_end(); // Create AutoRCM menu. ment_t *ments = (ment_t *)malloc(sizeof(ment_t) * 6); diff --git a/bootloader/hos/hos.c b/bootloader/hos/hos.c index 4ce3295..cc21e42 100644 --- a/bootloader/hos/hos.c +++ b/bootloader/hos/hos.c @@ -1067,7 +1067,7 @@ int hos_launch(ini_sec_t *cfg) // Unmount SD card and eMMC. sd_end(); - sdmmc_storage_end(&emmc_storage); + emmc_end(); gfx_printf("Rebuilt & loaded pkg2\n\n%kBooting...%k\n", TXT_CLR_GREENISH, TXT_CLR_DEFAULT); @@ -1176,7 +1176,7 @@ int hos_launch(ini_sec_t *cfg) bpmp_halt(); error: - sdmmc_storage_end(&emmc_storage); + emmc_end(); return 0; } diff --git a/bootloader/main.c b/bootloader/main.c index 3fde4c5..b10ea82 100644 --- a/bootloader/main.c +++ b/bootloader/main.c @@ -80,7 +80,7 @@ void emmcsn_path_impl(char *path, char *sub_dir, char *filename, sdmmc_storage_t memcpy(path + strlen(path), filename, filename_len + 1); if (init_done) - sdmmc_storage_end(&emmc_storage); + emmc_end(); } void render_default_bootlogo() diff --git a/bootloader/storage/emummc.c b/bootloader/storage/emummc.c index a920fcf..fb64d88 100644 --- a/bootloader/storage/emummc.c +++ b/bootloader/storage/emummc.c @@ -55,14 +55,14 @@ void emummc_load_cfg() LIST_FOREACH_ENTRY(ini_kv_t, kv, &ini_sec->kvs, link) { - if (!strcmp("enabled", kv->key)) + if (!strcmp("enabled", kv->key)) emu_cfg.enabled = atoi(kv->val); - else if (!strcmp("sector", kv->key)) - emu_cfg.sector = strtol(kv->val, NULL, 16); - else if (!strcmp("id", kv->key)) - emu_cfg.id = strtol(kv->val, NULL, 16); - else if (!strcmp("path", kv->key)) - emu_cfg.path = kv->val; + else if (!strcmp("sector", kv->key)) + emu_cfg.sector = strtol(kv->val, NULL, 16); + else if (!strcmp("id", kv->key)) + emu_cfg.id = strtol(kv->val, NULL, 16); + else if (!strcmp("path", kv->key)) + emu_cfg.path = kv->val; else if (!strcmp("nintendo_path", kv->key)) strcpy(emu_cfg.nintendo_path, kv->val); } @@ -177,7 +177,7 @@ out: int emummc_storage_end() { if (!emu_cfg.enabled || h_cfg.emummc_force_disable) - sdmmc_storage_end(&emmc_storage); + emmc_end(); else sd_end(); diff --git a/nyx/nyx_gui/frontend/fe_emmc_tools.c b/nyx/nyx_gui/frontend/fe_emmc_tools.c index 3e65afb..8715b2f 100644 --- a/nyx/nyx_gui/frontend/fe_emmc_tools.c +++ b/nyx/nyx_gui/frontend/fe_emmc_tools.c @@ -912,7 +912,7 @@ void dump_emmc_selected(emmcPartType_t dumpType, emmc_tool_gui_t *gui) } timer = get_tmr_s() - timer; - sdmmc_storage_end(&emmc_storage); + emmc_end(); if (res && n_cfg.verification && !gui->raw_emummc) s_printf(txt_buf, "Time taken: %dm %ds.\n#96FF00 Finished and verified!#", timer / 60, timer % 60); @@ -1536,7 +1536,7 @@ void restore_emmc_selected(emmcPartType_t restoreType, emmc_tool_gui_t *gui) } timer = get_tmr_s() - timer; - sdmmc_storage_end(&emmc_storage); + emmc_end(); if (res && n_cfg.verification && !gui->raw_emummc) s_printf(txt_buf, "Time taken: %dm %ds.\n#96FF00 Finished and verified!#", timer / 60, timer % 60); diff --git a/nyx/nyx_gui/frontend/fe_emummc_tools.c b/nyx/nyx_gui/frontend/fe_emummc_tools.c index 496bd2a..85a52ea 100644 --- a/nyx/nyx_gui/frontend/fe_emummc_tools.c +++ b/nyx/nyx_gui/frontend/fe_emummc_tools.c @@ -474,7 +474,7 @@ void dump_emummc_file(emmc_tool_gui_t *gui) out_failed: timer = get_tmr_s() - timer; - sdmmc_storage_end(&emmc_storage); + emmc_end(); if (res) { @@ -864,7 +864,7 @@ void dump_emummc_raw(emmc_tool_gui_t *gui, int part_idx, u32 sector_start, u32 r { s_printf(gui->txt_buf, "#FFDD00 For formatting USER partition,#\n#FFDD00 BIS keys are needed!#\n"); lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf); - sdmmc_storage_end(&emmc_storage); + emmc_end(); goto out; } @@ -952,7 +952,7 @@ void dump_emummc_raw(emmc_tool_gui_t *gui, int part_idx, u32 sector_start, u32 r out_failed: timer = get_tmr_s() - timer; - sdmmc_storage_end(&emmc_storage); + emmc_end(); if (res) { diff --git a/nyx/nyx_gui/frontend/gui_emmc_tools.c b/nyx/nyx_gui/frontend/gui_emmc_tools.c index 7908921..1720b6b 100644 --- a/nyx/nyx_gui/frontend/gui_emmc_tools.c +++ b/nyx/nyx_gui/frontend/gui_emmc_tools.c @@ -33,8 +33,6 @@ extern hekate_config h_cfg; extern char *emmcsn_path_impl(char *path, char *sub_dir, char *filename, sdmmc_storage_t *storage); -lv_obj_t *ums_mbox; - typedef struct _emmc_backup_buttons_t { lv_obj_t *emmc_boot; diff --git a/nyx/nyx_gui/frontend/gui_emummc_tools.c b/nyx/nyx_gui/frontend/gui_emummc_tools.c index 56d19ff..1e65c0c 100644 --- a/nyx/nyx_gui/frontend/gui_emummc_tools.c +++ b/nyx/nyx_gui/frontend/gui_emummc_tools.c @@ -221,7 +221,7 @@ static void _create_mbox_emummc_raw() u32 emmc_size_safe = emmc_storage.sec_cnt + 0xC000; // eMMC GPP size + BOOT0/1. - sdmmc_storage_end(&emmc_storage); + emmc_end(); for (int i = 1; i < 4; i++) { @@ -838,7 +838,7 @@ static lv_res_t _create_mbox_emummc_migrate(lv_obj_t *btn) backup = backup && rawnand_backup; sd_unmount(); - sdmmc_storage_end(&emmc_storage); + emmc_end(); // Check available types and enable the corresponding buttons. if (backup) diff --git a/nyx/nyx_gui/frontend/gui_info.c b/nyx/nyx_gui/frontend/gui_info.c index db0a37e..c40f544 100644 --- a/nyx/nyx_gui/frontend/gui_info.c +++ b/nyx/nyx_gui/frontend/gui_info.c @@ -376,7 +376,7 @@ static lv_res_t _create_mbox_cal0(lv_obj_t *btn) out: free(txt_buf); sd_unmount(); - sdmmc_storage_end(&emmc_storage); + emmc_end(); lv_mbox_add_btns(mbox, mbox_btn_map, _cal0_dump_window_action); @@ -1132,7 +1132,7 @@ static lv_res_t _create_mbox_emmc_sandisk_report(lv_obj_t * btn) } int res = sdmmc_storage_vendor_sandisk_report(&emmc_storage, buf); - sdmmc_storage_end(&emmc_storage); + emmc_end(); if (!res) { @@ -1516,7 +1516,7 @@ error: if (sd_bench) sd_unmount(); else - sdmmc_storage_end(&emmc_storage); + emmc_end(); out: free(txt_buf); @@ -1789,7 +1789,7 @@ static lv_res_t _create_window_emmc_info_status(lv_obj_t *btn) } out: - sdmmc_storage_end(&emmc_storage); + emmc_end(); free(txt_buf); return LV_RES_OK; diff --git a/nyx/nyx_gui/frontend/gui_tools.c b/nyx/nyx_gui/frontend/gui_tools.c index 6ca9e92..f631a7c 100644 --- a/nyx/nyx_gui/frontend/gui_tools.c +++ b/nyx/nyx_gui/frontend/gui_tools.c @@ -124,7 +124,7 @@ bool get_autorcm_status(bool toggle) out: free(tempbuf); - sdmmc_storage_end(&emmc_storage); + emmc_end(); return enabled; } @@ -1422,7 +1422,7 @@ out_free: free(loader); free(pkg2); free(txt_buf); - sdmmc_storage_end(&emmc_storage); + emmc_end(); sd_unmount(); if (kb >= KB_FIRMWARE_VERSION_620) diff --git a/nyx/nyx_gui/nyx.c b/nyx/nyx_gui/nyx.c index f12e527..67c4406 100644 --- a/nyx/nyx_gui/nyx.c +++ b/nyx/nyx_gui/nyx.c @@ -63,7 +63,7 @@ char *emmcsn_path_impl(char *path, char *sub_dir, char *filename, sdmmc_storage_ else { itoa(emmc_storage.cid.serial, emmc_sn, 16); - sdmmc_storage_end(&emmc_storage); + emmc_end(); } } else