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

@@ -0,0 +1,38 @@
#pragma once
#include "sections.h"
#include "LoaderInfo.h"
#include "patches/PatchCode.h"
DEFINE_SECTION_SYMBOLS(patch_bootstub);
extern IReadSectorsPatchCode::ReadSectorsFunc patch_bootstub_arm9reboot_readSdSectors_address;
extern const void* patch_bootstub_arm9reboot_dldi_address;
extern const char* patch_bootstub_arm9reboot_launcher_path;
extern loader_info_t patch_bootstub_arm9reboot_loader_info;
extern "C" void patch_bootstub_arm9reboot(void);
extern "C" void patch_bootstub_arm7reboot(void);
class BootstubPatchCode : public PatchCode
{
public:
BootstubPatchCode(PatchHeap& patchHeap, void* dldi, const char* launcherPath, const loader_info_t* loaderInfo,
const IReadSectorsPatchCode* readSectorsPatchCode)
: PatchCode(SECTION_START(patch_bootstub), SECTION_SIZE(patch_bootstub), patchHeap)
{
patch_bootstub_arm9reboot_dldi_address = dldi;
patch_bootstub_arm9reboot_readSdSectors_address = readSectorsPatchCode->GetReadSectorsFunction();
patch_bootstub_arm9reboot_launcher_path = launcherPath;
patch_bootstub_arm9reboot_loader_info = *loaderInfo;
}
const void* GetArm9RebootFunction() const
{
return GetAddressAtTarget((void*)patch_bootstub_arm9reboot);
}
const void* GetArm7RebootFunction() const
{
return GetAddressAtTarget((void*)patch_bootstub_arm7reboot);
}
};