From d6fda80057bbacd94add9f594b7db6b9030c331d Mon Sep 17 00:00:00 2001 From: Christoph Baumann Date: Wed, 21 May 2025 12:31:17 +0200 Subject: [PATCH] remove prints, fix backup/restore --- bdk/libs/fatfs/ff.c | 4 ++-- bdk/storage/boot_storage.c | 3 --- bdk/storage/file_based_storage.c | 6 ------ bootloader/storage/emusd.c | 14 -------------- .../frontend/gui_tools_partition_manager.c | 19 ++++++++++--------- 5 files changed, 12 insertions(+), 34 deletions(-) diff --git a/bdk/libs/fatfs/ff.c b/bdk/libs/fatfs/ff.c index e0ffb3e6..9af6306c 100644 --- a/bdk/libs/fatfs/ff.c +++ b/bdk/libs/fatfs/ff.c @@ -41,8 +41,8 @@ #include #include -#define EFSPRINTF(text, ...) print_error(); gfx_printf("%k"text"%k\n", 0xFFFFFF00, 0xFFFFFFFF); -//#define EFSPRINTF(...) +// #define EFSPRINTF(text, ...) print_error(); gfx_printf("%k"text"%k\n", 0xFFFFFF00, 0xFFFFFFFF); +#define EFSPRINTF(...) /*-------------------------------------------------------------------------- diff --git a/bdk/storage/boot_storage.c b/bdk/storage/boot_storage.c index 2bbe60a4..d5e750a9 100644 --- a/bdk/storage/boot_storage.c +++ b/bdk/storage/boot_storage.c @@ -121,15 +121,12 @@ static bool _boot_storage_mount(){ for(BYTE i = 0; i < ARRAY_SIZE(emmc_drives); i++){ res = f_mount(&boot_storage_fs, drive_base_paths[emmc_drives[i]], true); if(res == FR_OK){ - gfx_printf("trying %s\n", drive_base_paths[emmc_drives[i]]); res = f_chdrive(drive_base_paths[emmc_drives[i]]); if(res == FR_OK && _is_eligible()){ - gfx_printf("%s ok\n", drive_base_paths[emmc_drives[i]]); drive_cur = emmc_drives[i]; drive = drive_cur; break; }else{ - gfx_printf("%s fail\n", drive_base_paths[emmc_drives[i]]); f_mount(NULL, drive_base_paths[emmc_drives[i]],false); res = FR_INVALID_DRIVE; } diff --git a/bdk/storage/file_based_storage.c b/bdk/storage/file_based_storage.c index 3ba9e0e1..27692bc8 100644 --- a/bdk/storage/file_based_storage.c +++ b/bdk/storage/file_based_storage.c @@ -2,7 +2,6 @@ #include #include #include -#include "gfx_utils.h" typedef struct{ FIL active_file; @@ -21,8 +20,6 @@ int file_based_storage_init(const char *base_path) { strcpy(ctx.base_path, base_path); strcat(ctx.base_path, "00"); - gfx_printf("file based init %d %s\n", ctx.base_path_len, ctx.base_path); - FILINFO fi; if(f_stat(ctx.base_path, &fi) != FR_OK) { return 0; @@ -30,7 +27,6 @@ int file_based_storage_init(const char *base_path) { if(fi.fsize) { ctx.part_sz_sct = fi.fsize >> 9; - gfx_printf("file based init sz 0x%x\n", ctx.part_sz_sct); }else{ return 0; } @@ -67,7 +63,6 @@ static int file_based_storage_change_file(const char *name, s32 idx) { #endif if(res != FR_OK){ - gfx_printf("file based open fail %s\n", ctx.base_path); return res; } @@ -95,7 +90,6 @@ static int file_based_storage_readwrite_single(u32 sector, u32 num_sectors, void } if(res != FR_OK){ - gfx_printf("file based rw fail %s 0x%x 0x%x \n", ctx.base_path, num_sectors, sector); return res; } diff --git a/bootloader/storage/emusd.c b/bootloader/storage/emusd.c index 7d0c33a7..2ac5f2e9 100644 --- a/bootloader/storage/emusd.c +++ b/bootloader/storage/emusd.c @@ -94,14 +94,10 @@ bool emusd_set_path(char *path) { strcat(emu_sd_cfg.emummc_file_based_path, ""); strcpy(emu_sd_cfg.emummc_file_based_path, path); strcat(emu_sd_cfg.emummc_file_based_path, "/raw_emmc_based"); - gfx_printf("1 %s \n", emu_sd_cfg.emummc_file_based_path); if(!f_open(&fp, emu_sd_cfg.emummc_file_based_path, FA_READ)) { - gfx_printf("open done\n"); if(!f_read(&fp, &emu_sd_cfg.sector, 4, NULL)){ - gfx_printf("found sct\n"); if(emu_sd_cfg.sector){ - gfx_printf("!=0\n"); found = true; emu_sd_cfg.enabled = 4; goto out; @@ -112,14 +108,10 @@ bool emusd_set_path(char *path) { strcpy(emu_sd_cfg.emummc_file_based_path, ""); strcat(emu_sd_cfg.emummc_file_based_path, path); strcat(emu_sd_cfg.emummc_file_based_path, "/raw_emmc_based"); - gfx_printf("1 %s \n", emu_sd_cfg.emummc_file_based_path); if (!f_open(&fp, emu_sd_cfg.emummc_file_based_path, FA_READ)) { - gfx_printf("open done\n"); if (!f_read(&fp, &emu_sd_cfg.sector, 4, NULL)){ - gfx_printf("found sct\n"); if (emu_sd_cfg.sector){ - gfx_printf("!=0\n"); found = true; emu_sd_cfg.enabled = 4; goto out; @@ -131,15 +123,12 @@ bool emusd_set_path(char *path) { strcpy(emu_sd_cfg.emummc_file_based_path, ""); strcat(emu_sd_cfg.emummc_file_based_path, path); strcat(emu_sd_cfg.emummc_file_based_path, "/file_based"); - gfx_printf("1 %s \n", emu_sd_cfg.emummc_file_based_path); if (!f_stat(emu_sd_cfg.emummc_file_based_path, NULL)) { - gfx_printf("open done\n"); emu_sd_cfg.sector = 0; emu_sd_cfg.path = path; emu_sd_cfg.enabled = 1; - gfx_printf("path %s\n", emu_sd_cfg.path); found = true; goto out; } @@ -148,15 +137,12 @@ bool emusd_set_path(char *path) { strcpy(emu_sd_cfg.emummc_file_based_path, ""); strcat(emu_sd_cfg.emummc_file_based_path, path); strcat(emu_sd_cfg.emummc_file_based_path, "/file_emmc_based"); - gfx_printf("1 %s \n", emu_sd_cfg.emummc_file_based_path); if (!f_stat(emu_sd_cfg.emummc_file_based_path, NULL)) { - gfx_printf("open done\n"); emu_sd_cfg.sector = 0; emu_sd_cfg.path = path; emu_sd_cfg.enabled = 4; - gfx_printf("path %s\n", emu_sd_cfg.path); found = true; goto out; } diff --git a/nyx/nyx_gui/frontend/gui_tools_partition_manager.c b/nyx/nyx_gui/frontend/gui_tools_partition_manager.c index 5fbf856a..2bd19112 100644 --- a/nyx/nyx_gui/frontend/gui_tools_partition_manager.c +++ b/nyx/nyx_gui/frontend/gui_tools_partition_manager.c @@ -222,7 +222,7 @@ static int _stat_and_copy_files(const char *src, const char *dst, char *path, u3 u32 dirLength = 0; static FILINFO fno; - DBG_PRINT_ARGS("chdrive %d", f_chdrive(src)); + f_chdrive(src); // Open directory. res = f_opendir(&dir, path); @@ -287,9 +287,9 @@ static int _stat_and_copy_files(const char *src, const char *dst, char *path, u3 // Open file for writing. f_chdrive(dst); - DBG_PRINT_ARGS("open %d", f_open(&fp_dst, path, FA_CREATE_ALWAYS | FA_WRITE)); - DBG_PRINT_ARGS("seek1 %d", f_lseek(&fp_dst, fno.fsize)); - DBG_PRINT_ARGS("seek2 %d", f_lseek(&fp_dst, 0)); + f_open(&fp_dst, path, FA_CREATE_ALWAYS | FA_WRITE); + f_lseek(&fp_dst, fno.fsize); + f_lseek(&fp_dst, 0); // Open file for reading. f_chdrive(src); @@ -1793,8 +1793,11 @@ static int _backup_and_restore_files(bool backup, const char *drive, lv_obj_t ** // Copy all or hekate/Nyx files. DBG_PRINT("start stat"); + gfx_printf("src %s\ndst %s\npath %s\n", src_drv, dst_drv, path); res = _stat_and_copy_files(src_drv, dst_drv, path, &total_files, &total_size, labels); + gfx_printf("bkup res %d mws %d pld %d tot %d\n", res, (u32)backup_mws, (u32)backup_pld, total_files); + // If incomplete backup mode, copy MWS and payload.bin also. if (!res) { @@ -1998,8 +2001,6 @@ static lv_res_t _create_mbox_start_partitioning(lv_obj_t *btn) } } - DBG_PRINT("backup done"); - if(part_info.drive == DRIVE_SD){ sd_unmount(); }else{ @@ -2041,7 +2042,6 @@ static lv_res_t _create_mbox_start_partitioning(lv_obj_t *btn) } } - lv_label_set_text(lbl_status, "#00ddff Status:# Formatting FAT32 partition..."); manual_system_maintenance(true); @@ -2095,10 +2095,11 @@ static lv_res_t _create_mbox_start_partitioning(lv_obj_t *btn) if(part_info.drive == DRIVE_SD){ sd_mount(); }else{ - DBG_PRINT_ARGS("emmc mount %d", emmc_mount()); + emmc_mount(); } - f_setlabel(part_info.drive == DRIVE_SD ? "sd:SWITCH SD" : "emmc:SWITCH EMMC"); + int res = f_setlabel(part_info.drive == DRIVE_SD ? "sd:SWITCH SD" : "emmc:SWITCH EMMC"); + gfx_printf("setlabel %d\n", res); if(boot_storage_get_drive() != part_info.drive){ // if we havent booted from the drive currently being formatted, create .no_boot_storage