Only setup homebrew bootstub when launcherPath is set

This commit is contained in:
Gericom
2026-01-10 16:35:00 +01:00
parent a17194dc67
commit 0ba88b55b7
4 changed files with 31 additions and 32 deletions

View File

@@ -10,9 +10,5 @@ extern u8 __bss_size[];
pload_header7_t gLoaderHeader
{
.entryPoint = (void*)&_start,
.apiVersion = PICO_LOADER_API_VERSION,
.v2 =
{
.launcherPath = "/_picoboot.nds"
}
.apiVersion = PICO_LOADER_API_VERSION
};

View File

@@ -436,7 +436,9 @@ void NdsLoader::InsertArgv()
void NdsLoader::HandleHomebrewPatching()
{
sendToArm9(IPC_COMMAND_ARM9_APPLY_HOMEBREW_PATCHES);
if (_launcherPath != nullptr && _launcherPath[0] != 0)
{
sendToArm9(IPC_COMMAND_ARM9_SETUP_HOMEBREW_BOOTSTUB);
sendToArm9(16 * 1024); // required dldi space
void* dldiSpace = (void*)receiveFromArm9();
char* launcherPath = (char*)receiveFromArm9();
@@ -447,6 +449,8 @@ void NdsLoader::HandleHomebrewPatching()
if (launcherPath != nullptr)
{
strncpy(launcherPath, _launcherPath, 256);
launcherPath[255] = 0;
}
}
}

View File

@@ -233,9 +233,8 @@ static void handleBootCommand()
bootArm9();
}
static void handleApplyHomebrewPatches(u32 dldiRequiredSpace)
static void handleSetupHomebrewBootstub(u32 dldiRequiredSpace)
{
// Insert bootstub
PatchHeap patchHeap;
PatchCodeCollection patchCodeCollection;
void* patchSpace = (void*)&HOMEBREW_BOOTSTUB[1];
@@ -328,10 +327,10 @@ static void handleArm7Command(u32 command)
handleBootCommand();
break;
}
case IPC_COMMAND_ARM9_APPLY_HOMEBREW_PATCHES:
case IPC_COMMAND_ARM9_SETUP_HOMEBREW_BOOTSTUB:
{
u32 dldiRequiredSpace = receiveFromArm7();
handleApplyHomebrewPatches(dldiRequiredSpace);
handleSetupHomebrewBootstub(dldiRequiredSpace);
break;
}
}

View File

@@ -12,4 +12,4 @@
#define IPC_COMMAND_ARM9_DISPLAY_ERROR 0xB
#define IPC_COMMAND_ARM9_SWITCH_TO_DS_MODE 0xD
#define IPC_COMMAND_ARM9_BOOT 0xF
#define IPC_COMMAND_ARM9_APPLY_HOMEBREW_PATCHES 0x10
#define IPC_COMMAND_ARM9_SETUP_HOMEBREW_BOOTSTUB 0x10