support for file based and sd partition based emusd
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include <storage/boot_storage.h>
|
||||
#include "../storage/emusd.h"
|
||||
#include <string.h>
|
||||
|
||||
#include <bdk.h>
|
||||
@@ -87,9 +88,9 @@ typedef struct _pkg3_content_t
|
||||
|
||||
static void _pkg3_update_r2p()
|
||||
{
|
||||
u8 *r2p_payload = boot_storage_file_read("atmosphere/reboot_payload.bin", NULL);
|
||||
u8 *r2p_payload = emusd_file_read("atmosphere/reboot_payload.bin", NULL);
|
||||
|
||||
is_ipl_updated(r2p_payload, "atmosphere/reboot_payload.bin", h_cfg.updater2p ? true : false);
|
||||
is_ipl_updated(r2p_payload, "emusd:atmosphere/reboot_payload.bin", h_cfg.updater2p ? true : false);
|
||||
|
||||
free(r2p_payload);
|
||||
}
|
||||
@@ -127,6 +128,10 @@ static int _pkg3_kip1_skip(char ***pkg3_kip1_skip, u32 *pkg3_kip1_skip_num, char
|
||||
|
||||
int parse_pkg3(launch_ctxt_t *ctxt, const char *path)
|
||||
{
|
||||
char *path1 = (char *)malloc(256);
|
||||
strcpy(path1, "emusd:");
|
||||
strcat(path1, path);
|
||||
|
||||
FIL fp;
|
||||
|
||||
char **pkg3_kip1_skip = NULL;
|
||||
@@ -154,16 +159,25 @@ int parse_pkg3(launch_ctxt_t *ctxt, const char *path)
|
||||
}
|
||||
|
||||
#ifdef HOS_MARIKO_STOCK_SECMON
|
||||
if (stock && emummc_disabled && (pkg1_old || h_cfg.t210b01))
|
||||
if (stock && emummc_disabled && (pkg1_old || h_cfg.t210b01)) {
|
||||
free(path1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
if (stock && emummc_disabled && pkg1_old)
|
||||
if (stock && emummc_disabled && pkg1_old) {
|
||||
free(path1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Try to open PKG3.
|
||||
if (f_open(&fp, path, FA_READ) != FR_OK)
|
||||
if (f_open(&fp, path1, FA_READ) != FR_OK) {
|
||||
free(path1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void *pkg3 = malloc(f_size(&fp));
|
||||
|
||||
@@ -269,6 +283,7 @@ int parse_pkg3(launch_ctxt_t *ctxt, const char *path)
|
||||
_pkg3_update_r2p();
|
||||
|
||||
free(pkg3_kip1_skip);
|
||||
free(path1);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user