mirror of
https://github.com/LNH-team/pico-loader.git
synced 2026-06-02 09:16:49 +02:00
Added detection of DS mode DSiWare. Fixes #95.
This commit is contained in:
@@ -35,8 +35,8 @@ void* Arm7Patcher::ApplyPatches(const LoaderPlatform* loaderPlatform) const
|
||||
{
|
||||
(void*)romHeader->arm7LoadAddress,
|
||||
romHeader->arm7Size,
|
||||
(romHeader->IsTwlRom()) ? (void*)twlRomHeader->arm7iLoadAddress : nullptr,
|
||||
(romHeader->IsTwlRom()) ? twlRomHeader->arm7iSize : 0,
|
||||
(romHeader->SupportsDsiMode()) ? (void*)twlRomHeader->arm7iLoadAddress : nullptr,
|
||||
(romHeader->SupportsDsiMode()) ? twlRomHeader->arm7iSize : 0,
|
||||
sdkVersion,
|
||||
romHeader->gameCode,
|
||||
romHeader->softwareVersion,
|
||||
@@ -114,7 +114,7 @@ void* Arm7Patcher::ApplyPatches(const LoaderPlatform* loaderPlatform) const
|
||||
u32 mbk6 = 0;
|
||||
u32 mbk7 = 0;
|
||||
u32 mbk8 = 0;
|
||||
if (gIsDsiMode && romHeader->IsTwlRom())
|
||||
if (gIsDsiMode && romHeader->SupportsDsiMode())
|
||||
{
|
||||
mbk6 = REG_MBK6;
|
||||
mbk7 = REG_MBK7;
|
||||
@@ -133,7 +133,7 @@ void* Arm7Patcher::ApplyPatches(const LoaderPlatform* loaderPlatform) const
|
||||
ic_invalidateAll();
|
||||
|
||||
// If in DSi mode and the rom is a DSi rom, restore twl wram.
|
||||
if (gIsDsiMode && romHeader->IsTwlRom())
|
||||
if (gIsDsiMode && romHeader->SupportsDsiMode())
|
||||
{
|
||||
REG_MBK6 = mbk6;
|
||||
REG_MBK7 = mbk7;
|
||||
|
||||
@@ -51,7 +51,7 @@ void Arm9Patcher::ApplyPatches(const LoaderPlatform* loaderPlatform, const ApLis
|
||||
auto romHeader = (const nds_header_ntr_t*)TWL_SHARED_MEMORY->ntrSharedMem.romHeader;
|
||||
auto twlRomHeader = (const nds_header_twl_t*)TWL_SHARED_MEMORY->twlRomHeader;
|
||||
u32 arm9Size = romHeader->arm9Size;
|
||||
u32 arm9iSize = romHeader->IsTwlRom() ? twlRomHeader->arm9iSize : 0;
|
||||
u32 arm9iSize = romHeader->SupportsDsiMode() ? twlRomHeader->arm9iSize : 0;
|
||||
u32 compressedEnd = 0;
|
||||
auto moduleParams = ModuleParamsLocator().FindModuleParams(romHeader);
|
||||
SdkVersion sdkVersion = moduleParams ? moduleParams->sdkVersion : 0u;
|
||||
@@ -76,7 +76,7 @@ void Arm9Patcher::ApplyPatches(const LoaderPlatform* loaderPlatform, const ApLis
|
||||
}
|
||||
}
|
||||
|
||||
if (gIsDsiMode && romHeader->IsTwlRom())
|
||||
if (gIsDsiMode && romHeader->SupportsDsiMode())
|
||||
{
|
||||
auto arm9iModuleParams = (module_params_twl_t*)(romHeader->arm9LoadAddress + twlRomHeader->arm9iModuleParamsAddress);
|
||||
if (arm9iModuleParams->magicBigEndian == MODULE_PARAMS_TWL_MAGIC_BE &&
|
||||
@@ -112,7 +112,7 @@ void Arm9Patcher::ApplyPatches(const LoaderPlatform* loaderPlatform, const ApLis
|
||||
{
|
||||
(void*)romHeader->arm9LoadAddress,
|
||||
arm9Size,
|
||||
romHeader->IsTwlRom() ? (void*)twlRomHeader->arm9iLoadAddress : nullptr,
|
||||
romHeader->SupportsDsiMode() ? (void*)twlRomHeader->arm9iLoadAddress : nullptr,
|
||||
arm9iSize,
|
||||
sdkVersion,
|
||||
romHeader->gameCode,
|
||||
@@ -156,13 +156,10 @@ void Arm9Patcher::ApplyPatches(const LoaderPlatform* loaderPlatform, const ApLis
|
||||
{
|
||||
if (!twlRomHeader->IsDsiWare())
|
||||
{
|
||||
// if ((romHeader->unitCode & 3) != 3)
|
||||
{
|
||||
patchCollection.AddPatch(new CardiIsRomDmaAvailablePatch());
|
||||
}
|
||||
patchCollection.AddPatch(new CardiIsRomDmaAvailablePatch());
|
||||
patchCollection.AddPatch(new CardiReadRomWithCpuPatch());
|
||||
|
||||
if (gIsDsiMode && romHeader->IsTwlRom())
|
||||
if (gIsDsiMode && romHeader->SupportsDsiMode())
|
||||
{
|
||||
patchCollection.AddPatch(new CardiReadCardWithHashInternalAsyncPatch());
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ static void handleBootCommand()
|
||||
Arm9IoRegisterClearer().ClearNtrIoRegisters(isSdkResetSystem);
|
||||
REG_EXMEMCNT |= 0x0880; // map ds and gba slot to arm7
|
||||
auto ntrRomHeader = (const nds_header_ntr_t*)TWL_SHARED_MEMORY->ntrSharedMem.romHeader;
|
||||
if (gIsDsiMode && ntrRomHeader->IsTwlRom())
|
||||
if (gIsDsiMode && ntrRomHeader->SupportsDsiMode())
|
||||
{
|
||||
Arm9IoRegisterClearer().ClearTwlIoRegisters();
|
||||
REG_SCFG_EXT = 0x8307F100;
|
||||
|
||||
Reference in New Issue
Block a user