1
0
Fork 0
mirror of https://github.com/CTCaer/hekate.git synced 2024-11-08 11:31:44 +00:00

fss: remove dynamic path

Atmosphere never implemented per sysMMC/emuMMC support for configs.
So remove path parsing to reduce codesize.
This commit is contained in:
CTCaer 2024-03-27 09:33:08 +02:00
parent e846f4576e
commit 622f7124ac
3 changed files with 26 additions and 51 deletions

View file

@ -1,7 +1,7 @@
/* /*
* Atmosphère Fusée Secondary Storage (Package3) parser. * Atmosphère Fusée Secondary Storage (Package3) parser.
* *
* Copyright (c) 2019-2023 CTCaer * Copyright (c) 2019-2024 CTCaer
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@ -82,34 +82,13 @@ typedef struct _fss_content_t
char name[0x10]; char name[0x10];
} fss_content_t; } fss_content_t;
static void _set_fss_path_and_update_r2p(launch_ctxt_t *ctxt, const char *path) static void _fss_update_r2p()
{ {
char *r2p_path = malloc(256); u8 *r2p_payload = sd_file_read("atmosphere/reboot_payload.bin", NULL);
u32 path_len = strlen(path);
strcpy(r2p_path, path); is_ipl_updated(r2p_payload, "atmosphere/reboot_payload.bin", h_cfg.updater2p ? true : false);
while (path_len)
{
if ((r2p_path[path_len - 1] == '/') || (r2p_path[path_len - 1] == '\\'))
{
r2p_path[path_len] = 0;
strcat(r2p_path, "reboot_payload.bin");
u8 *r2p_payload = sd_file_read(r2p_path, NULL);
is_ipl_updated(r2p_payload, r2p_path, h_cfg.updater2p ? true : false);
free(r2p_payload); free(r2p_payload);
// Save FSS0 parent path.
r2p_path[path_len] = 0;
ctxt->fss0_main_path = r2p_path;
return;
}
path_len--;
}
free(r2p_path);
} }
int parse_fss(launch_ctxt_t *ctxt, const char *path) int parse_fss(launch_ctxt_t *ctxt, const char *path)
@ -230,8 +209,8 @@ int parse_fss(launch_ctxt_t *ctxt, const char *path)
gfx_printf("Done!\n"); gfx_printf("Done!\n");
f_close(&fp); f_close(&fp);
// Set FSS0 path and update r2p if needed. // Update r2p if needed.
_set_fss_path_and_update_r2p(ctxt, path); _fss_update_r2p();
return 1; return 1;
} }

View file

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2018 naehrwert * Copyright (c) 2018 naehrwert
* Copyright (c) 2018-2023 CTCaer * Copyright (c) 2018-2024 CTCaer
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@ -109,7 +109,6 @@ typedef struct _launch_ctxt_t
bool stock; bool stock;
bool emummc_forced; bool emummc_forced;
char *fss0_main_path;
u32 fss0_hosver; u32 fss0_hosver;
bool atmosphere; bool atmosphere;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2023 CTCaer * Copyright (c) 2018-2024 CTCaer
* Copyright (c) 2019 Atmosphère-NX * Copyright (c) 2019 Atmosphère-NX
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@ -245,16 +245,12 @@ void config_exosphere(launch_ctxt_t *ctxt, u32 warmboot_base)
} }
break; break;
} }
}
// Parse usb mtim settings. Avoid parsing if it's overridden. // Parse usb mtim settings. Avoid parsing if it's overridden.
if (ctxt->fss0_main_path && !ctxt->exo_ctx.usb3_force) if (!ctxt->exo_ctx.usb3_force)
{ {
char settings_path[256]; LIST_INIT(ini_sections);
strcpy(settings_path, ctxt->fss0_main_path); if (ini_parse(&ini_sections, "atmosphere/config/system_settings.ini", false))
strcat(settings_path, "config/system_settings.ini");
LIST_INIT(sys_settings);
if (ini_parse(&ini_sections, settings_path, false))
{ {
LIST_FOREACH_ENTRY(ini_sec_t, ini_sec, &ini_sections, link) LIST_FOREACH_ENTRY(ini_sec_t, ini_sec, &ini_sections, link)
{ {
@ -275,6 +271,7 @@ void config_exosphere(launch_ctxt_t *ctxt, u32 warmboot_base)
} }
} }
} }
}
// To avoid problems, make private debug mode always on if not semi-stock. // To avoid problems, make private debug mode always on if not semi-stock.
if (!ctxt->stock || (emu_cfg.enabled && !h_cfg.emummc_force_disable)) if (!ctxt->stock || (emu_cfg.enabled && !h_cfg.emummc_force_disable))
@ -416,7 +413,7 @@ void secmon_exo_check_panic()
// Save context to the SD card. // Save context to the SD card.
char filepath[0x40]; char filepath[0x40];
f_mkdir("atmosphere/fatal_errors"); f_mkdir("atmosphere/fatal_errors");
strcpy(filepath, "/atmosphere/fatal_errors/report_"); strcpy(filepath, "atmosphere/fatal_errors/report_");
itoa((u32)((u64)rpt->report_identifier >> 32), filepath + strlen(filepath), 16); itoa((u32)((u64)rpt->report_identifier >> 32), filepath + strlen(filepath), 16);
itoa((u32)(rpt->report_identifier), filepath + strlen(filepath), 16); itoa((u32)(rpt->report_identifier), filepath + strlen(filepath), 16);
strcat(filepath, ".bin"); strcat(filepath, ".bin");