nyx: emu/emmc tools: homogenize return values

This commit is contained in:
CTCaer
2026-02-22 04:24:01 +02:00
parent 520bc8cbfb
commit 0b707ac1ae
2 changed files with 72 additions and 75 deletions

View File

@@ -170,7 +170,7 @@ static int _dump_emummc_file_part(emmc_tool_gui_t *gui, char *sd_path, sdmmc_sto
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
}
// Check if filesystem is FAT32 or the free space is smaller and dump in parts.
@@ -196,7 +196,7 @@ static int _dump_emummc_file_part(emmc_tool_gui_t *gui, char *sd_path, sdmmc_sto
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
}
u8 *buf = (u8 *)MIXD_BUF_ALIGNED;
@@ -242,7 +242,7 @@ static int _dump_emummc_file_part(emmc_tool_gui_t *gui, char *sd_path, sdmmc_sto
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
}
bytesWritten = 0;
@@ -264,7 +264,7 @@ static int _dump_emummc_file_part(emmc_tool_gui_t *gui, char *sd_path, sdmmc_sto
msleep(1000);
return 0;
return 1;
}
retryCount = 0;
@@ -290,7 +290,7 @@ static int _dump_emummc_file_part(emmc_tool_gui_t *gui, char *sd_path, sdmmc_sto
free(clmt);
f_unlink(outFilename);
return 0;
return 1;
}
else
{
@@ -316,7 +316,7 @@ static int _dump_emummc_file_part(emmc_tool_gui_t *gui, char *sd_path, sdmmc_sto
free(clmt);
f_unlink(outFilename);
return 0;
return 1;
}
pct = (u64)((u64)(lba_curr - part->lba_start) * 100u) / (u64)(part->lba_end - part->lba_start);
if (pct != prevPct)
@@ -350,12 +350,12 @@ static int _dump_emummc_file_part(emmc_tool_gui_t *gui, char *sd_path, sdmmc_sto
f_close(&fp);
free(clmt);
return 1;
return 0;
}
void dump_emummc_file(emmc_tool_gui_t *gui)
{
int res = 0;
int res = 1;
int base_len = 0;
u32 timer = 0;
@@ -432,7 +432,7 @@ void dump_emummc_file(emmc_tool_gui_t *gui)
strcat(sdPath, bootPart.name);
res = _dump_emummc_file_part(gui, sdPath, &emmc_storage, &bootPart);
if (!res)
if (res)
{
s_printf(txt_buf, "#FFDD00 Failed!#\n");
goto out_failed;
@@ -467,7 +467,7 @@ void dump_emummc_file(emmc_tool_gui_t *gui)
res = _dump_emummc_file_part(gui, sdPath, &emmc_storage, &rawPart);
if (!res)
if (res)
s_printf(txt_buf, "#FFDD00 Failed!#\n");
else
s_printf(txt_buf, "Done!\n");
@@ -479,7 +479,7 @@ out_failed:
timer = get_tmr_s() - timer;
emmc_end();
if (res)
if (!res)
{
s_printf(txt_buf, "Time taken: %dm %ds.\nFinished!", timer / 60, timer % 60);
gui->base_path[strlen(gui->base_path) - 5] = '\0';
@@ -543,7 +543,7 @@ static int _dump_emummc_raw_part(emmc_tool_gui_t *gui, int active_part, int part
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
}
user_offset = user_part->lba_start;
@@ -557,13 +557,13 @@ static int _dump_emummc_raw_part(emmc_tool_gui_t *gui, int active_part, int part
// Check for cancellation combo.
if (btn_read_vol() == (BTN_VOL_UP | BTN_VOL_DOWN))
{
s_printf(gui->txt_buf, "\n#FFDD00 The emuMMC was cancelled!#\n");
s_printf(gui->txt_buf, "\n#FFDD00 emuMMC creation was cancelled!#\n");
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
msleep(1000);
return 0;
return 1;
}
retryCount = 0;
@@ -586,7 +586,7 @@ static int _dump_emummc_raw_part(emmc_tool_gui_t *gui, int active_part, int part
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
}
else
{
@@ -616,7 +616,7 @@ static int _dump_emummc_raw_part(emmc_tool_gui_t *gui, int active_part, int part
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
}
else
{
@@ -688,7 +688,7 @@ static int _dump_emummc_raw_part(emmc_tool_gui_t *gui, int active_part, int part
s_printf(gui->txt_buf, "#FF0000 Failed (%d)!#\nPlease try again...\n", mkfs_error);
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
return 0;
return 1;
}
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, "Done!\n");
@@ -720,7 +720,7 @@ static int _dump_emummc_raw_part(emmc_tool_gui_t *gui, int active_part, int part
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
free(gpt);
return 0;
return 1;
}
// Set new emuMMC size and USER size.
@@ -761,7 +761,7 @@ static int _dump_emummc_raw_part(emmc_tool_gui_t *gui, int active_part, int part
free(gpt);
}
return 1;
return 0;
}
int emummc_raw_derive_bis_keys()
@@ -825,7 +825,7 @@ error:
void dump_emummc_raw(emmc_tool_gui_t *gui, int part_idx, u32 sector_start, u32 resized_count)
{
int res = 0;
int res = 1;
u32 timer = 0;
char *txt_buf = (char *)malloc(SZ_16K);
@@ -896,7 +896,7 @@ void dump_emummc_raw(emmc_tool_gui_t *gui, int part_idx, u32 sector_start, u32 r
strcat(sdPath, bootPart.name);
res = _dump_emummc_raw_part(gui, i, part_idx, sector_start, &bootPart, 0);
if (!res)
if (res)
{
s_printf(txt_buf, "#FFDD00 Failed!#\n");
goto out_failed;
@@ -930,7 +930,7 @@ void dump_emummc_raw(emmc_tool_gui_t *gui, int part_idx, u32 sector_start, u32 r
res = _dump_emummc_raw_part(gui, 2, part_idx, sector_start, &rawPart, resized_count);
if (!res)
if (res)
s_printf(txt_buf, "#FFDD00 Failed!#\n");
else
s_printf(txt_buf, "Done!\n");
@@ -943,7 +943,7 @@ out_failed:
timer = get_tmr_s() - timer;
emmc_end();
if (res)
if (!res)
{
s_printf(txt_buf, "Time taken: %dm %ds.\nFinished!", timer / 60, timer % 60);
strcpy(sdPath, gui->base_path);