mirror of
https://github.com/LNH-team/pico-loader.git
synced 2026-06-02 09:16:49 +02:00
Further work on implementing support for cheats
This commit is contained in:
@@ -522,7 +522,13 @@ void NdsLoader::HandleHomebrewPatching()
|
||||
void NdsLoader::ApplyArm7Patches()
|
||||
{
|
||||
sendToArm9(IPC_COMMAND_ARM9_APPLY_ARM7_PATCHES);
|
||||
sendToArm9(_cheats ? _cheats->length : 0);
|
||||
void* patchSpaceStart = (void*)receiveFromArm9();
|
||||
void* cheatsPtr = (void*)receiveFromArm9();
|
||||
if (cheatsPtr != nullptr && _cheats != nullptr)
|
||||
{
|
||||
memcpy(cheatsPtr, _cheats, _cheats->length);
|
||||
}
|
||||
if (patchSpaceStart)
|
||||
{
|
||||
u32 mbk6 = 0;
|
||||
|
||||
@@ -42,6 +42,13 @@ public:
|
||||
_argumentsLength = argumentsLength;
|
||||
}
|
||||
|
||||
/// @brief Sets the cheats to apply to the rom.
|
||||
/// @param cheats The cheats.
|
||||
void SetCheats(const pload_cheats_t* cheats)
|
||||
{
|
||||
_cheats = cheats;
|
||||
}
|
||||
|
||||
/// @brief Loads the rom according to the specified \p bootMode.
|
||||
/// @param bootMode The boot mode.
|
||||
void Load(BootMode bootMode);
|
||||
@@ -53,6 +60,7 @@ private:
|
||||
const TCHAR* _launcherPath = nullptr;
|
||||
u32 _argumentsLength = 0;
|
||||
const char* _arguments = nullptr;
|
||||
const pload_cheats_t* _cheats = nullptr;
|
||||
nds_header_twl_t _romHeader;
|
||||
DsiWareSaveResult _dsiwareSaveResult;
|
||||
|
||||
|
||||
@@ -219,10 +219,19 @@ extern "C" void loaderMain()
|
||||
}
|
||||
else
|
||||
{
|
||||
pload_cheats_t* cheats = nullptr;
|
||||
if (gLoaderHeader.v3.cheats != nullptr && gLoaderHeader.v3.cheats->numberOfCheats != 0)
|
||||
{
|
||||
// Copy cheats to vram
|
||||
cheats = (pload_cheats_t*)malloc(gLoaderHeader.v3.cheats->length);
|
||||
memcpy(cheats, gLoaderHeader.v3.cheats, gLoaderHeader.v3.cheats->length);
|
||||
}
|
||||
|
||||
sLoader.SetRomPath(gLoaderHeader.loadParams.romPath);
|
||||
handleSavePath();
|
||||
sLoader.SetArguments(gLoaderHeader.loadParams.arguments, gLoaderHeader.loadParams.argumentsLength);
|
||||
sLoader.SetLauncherPath(gLoaderHeader.v2.launcherPath);
|
||||
sLoader.SetCheats(cheats);
|
||||
sLoader.Load(BootMode::Normal);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user