Initial work on homebrew return to loader

This commit is contained in:
Gericom
2026-01-04 15:39:47 +01:00
parent f1e5f0cddc
commit 5c8e98a03f
13 changed files with 387 additions and 5 deletions

View File

@@ -344,6 +344,7 @@ void NdsLoader::Load(BootMode bootMode)
if (isHomebrew)
{
InsertArgv();
HandleHomebrewPatching();
}
HandleDldiPatching();
@@ -429,6 +430,22 @@ void NdsLoader::InsertArgv()
HOMEBREW_ARGV->length = argSize;
}
void NdsLoader::HandleHomebrewPatching()
{
sendToArm9(IPC_COMMAND_ARM9_APPLY_HOMEBREW_PATCHES);
sendToArm9(16 * 1024); // required dldi space
void* dldiSpace = (void*)receiveFromArm9();
char* launcherPath = (char*)receiveFromArm9();
if (dldiSpace != nullptr)
{
dldi_copyTo(dldiSpace);
}
if (launcherPath != nullptr)
{
strncpy(launcherPath, _launcherPath, 256);
}
}
void NdsLoader::ApplyArm7Patches()
{
sendToArm9(IPC_COMMAND_ARM9_APPLY_ARM7_PATCHES);