From 30642faa3c5d6ddcb9af94c28c531e6d87e13a2a Mon Sep 17 00:00:00 2001 From: RocketRobz Date: Sat, 28 Dec 2024 22:56:09 -0700 Subject: [PATCH] Update ROM pre-load settings for *MegaMan ZX* & *ZX Advent* (3DS) --- retail/arm9/include/configuration.h | 6 +-- retail/arm9/source/conf_sd.cpp | 34 +++++++-------- retail/arm9/source/nds_loader_arm9.c | 7 +-- retail/bootloader/source/arm7/load_crt0.s | 6 ++- retail/bootloaderi/source/arm7/hook_arm9.c | 21 +++++---- retail/bootloaderi/source/arm7/load_crt0.s | 6 ++- retail/bootloaderi/source/arm7/main.arm7.c | 41 +++++++++++++----- .../cardenginei/arm9/source/cardDma.thumb.c | 11 +++-- .../arm9/source/card_engine_header.s | 2 + retail/cardenginei/arm9/source/cardengine.c | 11 +++-- .../common/include/cardengine_header_arm9.h | 4 +- retail/common/include/load_crt0.h | 6 +-- retail/preLoadSettings/Title list.txt | 28 ++++++++++++ .../files-3ds-frame/AFFE-70A6.bin | Bin 0 -> 12 bytes .../files-3ds-frame/AFFJ-BE5A.bin | Bin 0 -> 12 bytes .../files-3ds-frame/AFFP-1AE7.bin | Bin 0 -> 12 bytes .../files-3ds-frame/AZLE-236A.bin | Bin 0 -> 12 bytes .../files-3ds-frame/AZLJ-6133.bin | Bin 0 -> 12 bytes .../files-3ds-frame/AZLK-CBEC.bin | Bin 0 -> 12 bytes .../files-3ds-frame/AZLP-32D5.bin | Bin 0 -> 12 bytes .../files-3ds-frame/BZ3J-1CF7.bin | Bin 0 -> 12 bytes .../files-3ds-frame/BZ3J-D409.bin | Bin 0 -> 12 bytes .../files-3ds-frame/C24E-1F51.bin | Bin 0 -> 12 bytes .../files-3ds-frame/C24J-3CEC.bin | Bin 0 -> 12 bytes .../files-3ds-frame/C24P-432C.bin | Bin 0 -> 12 bytes .../files-3ds-frame/YVIE-3036.bin | Bin 0 -> 12 bytes .../files-3ds-frame/YVIJ-8FDB.bin | Bin 0 -> 12 bytes .../files-3ds-frame/YVIP-11DD.bin | Bin 0 -> 12 bytes .../preLoadSettings/files-3ds/AFFE-70A6.bin | Bin 12 -> 8 bytes .../preLoadSettings/files-3ds/AFFJ-BE5A.bin | Bin 12 -> 8 bytes .../preLoadSettings/files-3ds/AFFP-1AE7.bin | Bin 12 -> 8 bytes .../preLoadSettings/files-3ds/ARZE-DBFF.bin | Bin 8 -> 16 bytes .../preLoadSettings/files-3ds/ARZJ-82C7.bin | Bin 8 -> 16 bytes .../preLoadSettings/files-3ds/ARZP-BD7E.bin | Bin 8 -> 16 bytes .../preLoadSettings/files-3ds/AZLE-236A.bin | Bin 12 -> 8 bytes .../preLoadSettings/files-3ds/AZLJ-6133.bin | Bin 12 -> 8 bytes .../preLoadSettings/files-3ds/AZLK-CBEC.bin | Bin 12 -> 8 bytes .../preLoadSettings/files-3ds/AZLP-32D5.bin | Bin 12 -> 8 bytes .../preLoadSettings/files-3ds/BZ3J-1CF7.bin | Bin 12 -> 8 bytes .../preLoadSettings/files-3ds/BZ3J-D409.bin | Bin 12 -> 8 bytes .../preLoadSettings/files-3ds/C24E-1F51.bin | Bin 12 -> 8 bytes .../preLoadSettings/files-3ds/C24J-3CEC.bin | Bin 12 -> 8 bytes .../preLoadSettings/files-3ds/C24P-432C.bin | Bin 12 -> 8 bytes .../preLoadSettings/files-3ds/YVIE-3036.bin | Bin 12 -> 8 bytes .../preLoadSettings/files-3ds/YVIJ-8FDB.bin | Bin 12 -> 8 bytes .../preLoadSettings/files-3ds/YVIP-11DD.bin | Bin 12 -> 8 bytes .../preLoadSettings/files-3ds/YZXE-3057.bin | Bin 8 -> 16 bytes .../preLoadSettings/files-3ds/YZXJ-C0CC.bin | Bin 8 -> 16 bytes .../preLoadSettings/files-3ds/YZXP-B2AD.bin | Bin 8 -> 16 bytes .../files-dsi-frame/AFFE-70A6.bin | Bin 0 -> 12 bytes .../files-dsi-frame/AFFJ-BE5A.bin | Bin 0 -> 12 bytes .../files-dsi-frame/AFFP-1AE7.bin | Bin 0 -> 12 bytes .../files-dsi-frame/AZLE-236A.bin | Bin 0 -> 12 bytes .../files-dsi-frame/AZLJ-6133.bin | Bin 0 -> 12 bytes .../files-dsi-frame/AZLK-CBEC.bin | Bin 0 -> 12 bytes .../files-dsi-frame/AZLP-32D5.bin | Bin 0 -> 12 bytes .../files-dsi-frame/BZ3J-1CF7.bin | Bin 0 -> 12 bytes .../files-dsi-frame/BZ3J-D409.bin | Bin 0 -> 12 bytes .../files-dsi-frame/YVIE-3036.bin | Bin 0 -> 12 bytes .../files-dsi-frame/YVIJ-8FDB.bin | Bin 0 -> 12 bytes .../files-dsi-frame/YVIP-11DD.bin | Bin 0 -> 12 bytes .../preLoadSettings/files-dsi/AFFE-70A6.bin | Bin 12 -> 8 bytes .../preLoadSettings/files-dsi/AFFJ-BE5A.bin | Bin 12 -> 8 bytes .../preLoadSettings/files-dsi/AFFP-1AE7.bin | Bin 12 -> 8 bytes .../preLoadSettings/files-dsi/AZLE-236A.bin | Bin 12 -> 8 bytes .../preLoadSettings/files-dsi/AZLJ-6133.bin | Bin 12 -> 8 bytes .../preLoadSettings/files-dsi/AZLK-CBEC.bin | Bin 12 -> 8 bytes .../preLoadSettings/files-dsi/AZLP-32D5.bin | Bin 12 -> 8 bytes .../preLoadSettings/files-dsi/BZ3J-1CF7.bin | Bin 12 -> 8 bytes .../preLoadSettings/files-dsi/BZ3J-D409.bin | Bin 12 -> 8 bytes .../preLoadSettings/files-dsi/YVIE-3036.bin | Bin 12 -> 8 bytes .../preLoadSettings/files-dsi/YVIJ-8FDB.bin | Bin 12 -> 8 bytes .../preLoadSettings/files-dsi/YVIP-11DD.bin | Bin 12 -> 8 bytes 73 files changed, 119 insertions(+), 64 deletions(-) create mode 100644 retail/preLoadSettings/files-3ds-frame/AFFE-70A6.bin create mode 100644 retail/preLoadSettings/files-3ds-frame/AFFJ-BE5A.bin create mode 100644 retail/preLoadSettings/files-3ds-frame/AFFP-1AE7.bin create mode 100644 retail/preLoadSettings/files-3ds-frame/AZLE-236A.bin create mode 100644 retail/preLoadSettings/files-3ds-frame/AZLJ-6133.bin create mode 100644 retail/preLoadSettings/files-3ds-frame/AZLK-CBEC.bin create mode 100644 retail/preLoadSettings/files-3ds-frame/AZLP-32D5.bin create mode 100644 retail/preLoadSettings/files-3ds-frame/BZ3J-1CF7.bin create mode 100644 retail/preLoadSettings/files-3ds-frame/BZ3J-D409.bin create mode 100644 retail/preLoadSettings/files-3ds-frame/C24E-1F51.bin create mode 100644 retail/preLoadSettings/files-3ds-frame/C24J-3CEC.bin create mode 100644 retail/preLoadSettings/files-3ds-frame/C24P-432C.bin create mode 100644 retail/preLoadSettings/files-3ds-frame/YVIE-3036.bin create mode 100644 retail/preLoadSettings/files-3ds-frame/YVIJ-8FDB.bin create mode 100644 retail/preLoadSettings/files-3ds-frame/YVIP-11DD.bin create mode 100644 retail/preLoadSettings/files-dsi-frame/AFFE-70A6.bin create mode 100644 retail/preLoadSettings/files-dsi-frame/AFFJ-BE5A.bin create mode 100644 retail/preLoadSettings/files-dsi-frame/AFFP-1AE7.bin create mode 100644 retail/preLoadSettings/files-dsi-frame/AZLE-236A.bin create mode 100644 retail/preLoadSettings/files-dsi-frame/AZLJ-6133.bin create mode 100644 retail/preLoadSettings/files-dsi-frame/AZLK-CBEC.bin create mode 100644 retail/preLoadSettings/files-dsi-frame/AZLP-32D5.bin create mode 100644 retail/preLoadSettings/files-dsi-frame/BZ3J-1CF7.bin create mode 100644 retail/preLoadSettings/files-dsi-frame/BZ3J-D409.bin create mode 100644 retail/preLoadSettings/files-dsi-frame/YVIE-3036.bin create mode 100644 retail/preLoadSettings/files-dsi-frame/YVIJ-8FDB.bin create mode 100644 retail/preLoadSettings/files-dsi-frame/YVIP-11DD.bin diff --git a/retail/arm9/include/configuration.h b/retail/arm9/include/configuration.h index 0db491d84..66318acc6 100644 --- a/retail/arm9/include/configuration.h +++ b/retail/arm9/include/configuration.h @@ -37,9 +37,9 @@ typedef struct configuration { u32 apPatchSize; u32 cheatSize; u32 musicsSize; - u32 dataToPreloadAddr; - u32 dataToPreloadSize; - u32 dataToPreloadFrame; + u32 dataToPreloadAddr[2]; + u32 dataToPreloadSize[2]; + // u32 dataToPreloadFrame; u8 language; char* guiLanguage; s8 region; // SDK 5 diff --git a/retail/arm9/source/conf_sd.cpp b/retail/arm9/source/conf_sd.cpp index acfd8f8e0..78ca133ef 100644 --- a/retail/arm9/source/conf_sd.cpp +++ b/retail/arm9/source/conf_sd.cpp @@ -145,9 +145,9 @@ static void loadPreLoadSettings(configuration* conf, const char* pckPath, const } if (file) { - conf->dataToPreloadAddr = offsetOfOpenedNitroFile; - conf->dataToPreloadSize = getFileSize(file); - conf->dataToPreloadFrame = 0; + conf->dataToPreloadAddr[0] = offsetOfOpenedNitroFile; + conf->dataToPreloadSize[0] = getFileSize(file); + // conf->dataToPreloadFrame = 0; fclose(file); return; } @@ -196,20 +196,18 @@ static void loadPreLoadSettings(configuration* conf, const char* pckPath, const } if (offset > 0) { - if (size > 0xC) { - size = 0xC; + if (size > 0x10) { + size = 0x10; } fseek(file, offset, SEEK_SET); u32 *buffer = new u32[size/4]; fread(buffer, 1, size, file); - /* for (u32 i = 0; i < size/8; i++) { + for (u32 i = 0; i < size/8; i++) { conf->dataToPreloadAddr[i] = buffer[0+(i*2)]; conf->dataToPreloadSize[i] = buffer[1+(i*2)]; - } */ - conf->dataToPreloadAddr = buffer[0]; - conf->dataToPreloadSize = buffer[1]; - conf->dataToPreloadFrame = (size == 0xC) ? buffer[2] : 0; + } + // conf->dataToPreloadFrame = (size == 0xC) ? buffer[2] : 0; delete[] buffer; } } @@ -1592,11 +1590,11 @@ int loadFromSD(configuration* conf, const char *bootstrapPath) { fclose(cebin); loadPreLoadSettings(conf, conf->consoleModel > 0 ? "nitro:/preLoadSettings3DS.pck" : "nitro:/preLoadSettingsDSi.pck", romTid, headerCRC); - if (conf->dataToPreloadAddr == 0) { + if (conf->dataToPreloadAddr[0] == 0) { // Set NitroFS pre-load, in case if full ROM pre-load fails - conf->dataToPreloadAddr = ndsArm7BinOffset+ndsArm7Size; - conf->dataToPreloadSize = ((internalRomSize == 0 || internalRomSize > conf->romSize) ? conf->romSize : internalRomSize)-conf->dataToPreloadAddr; - conf->dataToPreloadFrame = 0; + conf->dataToPreloadAddr[0] = ndsArm7BinOffset+ndsArm7Size; + conf->dataToPreloadSize[0] = ((internalRomSize == 0 || internalRomSize > conf->romSize) ? conf->romSize : internalRomSize)-conf->dataToPreloadAddr[0]; + // conf->dataToPreloadFrame = 0; } } else { const bool binary3 = (REG_SCFG_EXT7 == 0 ? !dsiEnhancedMbk : (a7mbk6 != 0x00403000)); @@ -1926,11 +1924,11 @@ int loadFromSD(configuration* conf, const char *bootstrapPath) { b4dsDebugRam = (conf->b4dsMode == 2 || (*(vu32*)(0x02800000) == 0x314D454D && *(vu32*)(0x02C00000) == 0x324D454D)); loadPreLoadSettings(conf, "nitro:/preLoadSettingsMEP.pck", romTid, headerCRC); - if (conf->dataToPreloadAddr == 0) { + if (conf->dataToPreloadAddr[0] == 0) { // Set NitroFS pre-load, in case if full ROM pre-load fails - conf->dataToPreloadAddr = ndsArm7BinOffset+ndsArm7Size; - conf->dataToPreloadSize = ((internalRomSize == 0 || internalRomSize > conf->romSize) ? conf->romSize : internalRomSize)-conf->dataToPreloadAddr; - conf->dataToPreloadFrame = 0; + conf->dataToPreloadAddr[0] = ndsArm7BinOffset+ndsArm7Size; + conf->dataToPreloadSize[0] = ((internalRomSize == 0 || internalRomSize > conf->romSize) ? conf->romSize : internalRomSize)-conf->dataToPreloadAddr[0]; + // conf->dataToPreloadFrame = 0; } // Load in-game menu ce9 binary diff --git a/retail/arm9/source/nds_loader_arm9.c b/retail/arm9/source/nds_loader_arm9.c index 0f145395b..78f26f98b 100644 --- a/retail/arm9/source/nds_loader_arm9.c +++ b/retail/arm9/source/nds_loader_arm9.c @@ -270,9 +270,10 @@ int runNds(u32 cluster, u32 saveCluster, u32 donorTwlCluster, /* u32 gbaCluster, loader->saveSize = conf->saveSize; // loader->gbaRomSize = conf->gbaRomSize; // loader->gbaSaveSize = conf->gbaSaveSize; - loader->dataToPreloadAddr = conf->dataToPreloadAddr; - loader->dataToPreloadSize = conf->dataToPreloadSize; - loader->dataToPreloadFrame = conf->dataToPreloadFrame; + loader->dataToPreloadAddr[0] = conf->dataToPreloadAddr[0]; + loader->dataToPreloadSize[0] = conf->dataToPreloadSize[0]; + loader->dataToPreloadAddr[1] = conf->dataToPreloadAddr[1]; + loader->dataToPreloadSize[1] = conf->dataToPreloadSize[1]; loader->wideCheatFileCluster = wideCheatCluster; loader->wideCheatSize = conf->wideCheatSize; loader->apPatchFileCluster = apPatchCluster; diff --git a/retail/bootloader/source/arm7/load_crt0.s b/retail/bootloader/source/arm7/load_crt0.s index 1e348d861..11b7c43d2 100644 --- a/retail/bootloader/source/arm7/load_crt0.s +++ b/retail/bootloader/source/arm7/load_crt0.s @@ -43,7 +43,7 @@ @ .global gbaSaveSize .global dataToPreloadAddr .global dataToPreloadSize - .global dataToPreloadFrame + @ .global dataToPreloadFrame .global wideCheatFileCluster .global wideCheatSize .global apPatchFileCluster @@ -122,10 +122,12 @@ saveSize: @ .word 0x00000000 @ GBA .sav file size dataToPreloadAddr: .word 0x00000000 + .word 0x00000000 dataToPreloadSize: .word 0x00000000 -dataToPreloadFrame: .word 0x00000000 +@dataToPreloadFrame: +@ .word 0x00000000 wideCheatFileCluster: .word 0x00000000 wideCheatSize: diff --git a/retail/bootloaderi/source/arm7/hook_arm9.c b/retail/bootloaderi/source/arm7/hook_arm9.c index e766ab779..39fe4306c 100644 --- a/retail/bootloaderi/source/arm7/hook_arm9.c +++ b/retail/bootloaderi/source/arm7/hook_arm9.c @@ -213,10 +213,11 @@ int hookNdsRetailArm9( extern u32 baseFatOff; extern u32 baseFatSize; extern u32 romPaddingSize; - extern u32 dataToPreloadAddr; - extern u32 dataToPreloadSize; + extern u32 dataToPreloadAddr[2]; + extern u32 dataToPreloadSize[2]; // extern u32 dataToPreloadFrame; extern bool romLocationAdjust(const tNDSHeader* ndsHeader, const bool laterSdk, const bool isSdk5, const bool dsiBios, u32* romLocation); + extern u32 dataToPreloadFullSize(void); extern bool dataToPreloadFound(const tNDSHeader* ndsHeader); const char* romTid = getRomTid(ndsHeader); const bool laterSdk = ((moduleParams->sdk_version >= 0x2008000 && moduleParams->sdk_version != 0x2012774) || moduleParams->sdk_version == 0x20029A8); @@ -283,7 +284,6 @@ int hookNdsRetailArm9( //extern bool gbaRomFound; extern u8 gameOnFlashcard; bool runOverlayCheck = overlayPatch; - u32 dataToPreloadSizeAligned = 0; ce9->cacheBlockSize = cacheBlockSize; if (ce9->overlaysSrc) { ce9->overlaysSrcAlign = (ce9->overlaysSrc/ce9->cacheBlockSize)*ce9->cacheBlockSize; @@ -337,17 +337,16 @@ int hookNdsRetailArm9( //ce9->romLocation[1] = ce9->romLocation[0]+dataToPreloadSize[0]; // ce9->romLocation -= dataToPreloadAddr[0]; //ce9->romLocation[1] -= dataToPreloadAddr[1]; - configureRomMap(ce9, ndsHeader, dataToPreloadAddr, dsiMode); - for (u32 i = 0; i < dataToPreloadSize/*+dataToPreloadSize[1]*/; i += cacheBlockSize) { + configureRomMap(ce9, ndsHeader, dataToPreloadAddr[0], dsiMode); + for (u32 i = 0; i < dataToPreloadFullSize(); i += cacheBlockSize) { ce9->cacheAddress += cacheBlockSize; romLocationAdjust(ndsHeader, laterSdk, (ce9->valueBits & b_isSdk5), (ce9->valueBits & b_dsiBios), &ce9->cacheAddress); - dataToPreloadSizeAligned += cacheBlockSize; + ce9->cacheSlots--; + } + for (int i = 0; i < 2; i++) { + ce9->romPartSrc[i] = dataToPreloadAddr[i]; + ce9->romPartSize[i] = dataToPreloadSize[i]; } - ce9->cacheSlots -= dataToPreloadSizeAligned/cacheBlockSize; - ce9->romPartSrc = dataToPreloadAddr; - //ce9->romPartSrc[1] = dataToPreloadAddr[1]; - ce9->romPartSize = dataToPreloadSize; - //ce9->romPartSize[1] = dataToPreloadSize[1]; /* if (dataToPreloadFrame) { ce9->valueBits |= b_waitForPreloadToFinish; } */ diff --git a/retail/bootloaderi/source/arm7/load_crt0.s b/retail/bootloaderi/source/arm7/load_crt0.s index 1e348d861..11b7c43d2 100644 --- a/retail/bootloaderi/source/arm7/load_crt0.s +++ b/retail/bootloaderi/source/arm7/load_crt0.s @@ -43,7 +43,7 @@ @ .global gbaSaveSize .global dataToPreloadAddr .global dataToPreloadSize - .global dataToPreloadFrame + @ .global dataToPreloadFrame .global wideCheatFileCluster .global wideCheatSize .global apPatchFileCluster @@ -122,10 +122,12 @@ saveSize: @ .word 0x00000000 @ GBA .sav file size dataToPreloadAddr: .word 0x00000000 + .word 0x00000000 dataToPreloadSize: .word 0x00000000 -dataToPreloadFrame: .word 0x00000000 +@dataToPreloadFrame: +@ .word 0x00000000 wideCheatFileCluster: .word 0x00000000 wideCheatSize: diff --git a/retail/bootloaderi/source/arm7/main.arm7.c b/retail/bootloaderi/source/arm7/main.arm7.c index 661f7cc30..cf63832ae 100644 --- a/retail/bootloaderi/source/arm7/main.arm7.c +++ b/retail/bootloaderi/source/arm7/main.arm7.c @@ -105,9 +105,9 @@ extern u32 romSize; extern u32 saveSize; // extern u32 gbaRomSize; // extern u32 gbaSaveSize; -extern u32 dataToPreloadAddr; -extern u32 dataToPreloadSize; -extern u32 dataToPreloadFrame; +extern u32 dataToPreloadAddr[2]; +extern u32 dataToPreloadSize[2]; +// extern u32 dataToPreloadFrame; extern u32 wideCheatFileCluster; extern u32 wideCheatSize; extern u32 apPatchFileCluster; @@ -1018,13 +1018,25 @@ static void my_readUserSettings(tNDSHeader* ndsHeader) { } } +u32 dataToPreloadFullSize(void) { + u32 dataToPreloadSizeAlign[2] = {dataToPreloadSize[0], dataToPreloadSize[1]}; + for (int i = 0; i < 2; i++) { + if (!dataToPreloadSize[i]) break; + while ((dataToPreloadSizeAlign[i] % 0x4000) != 0) { + dataToPreloadSizeAlign[i]++; + } + } + + return dataToPreloadSizeAlign[0] + dataToPreloadSizeAlign[1]; +} + bool dataToPreloadFound(const tNDSHeader* ndsHeader) { if (strncmp(ndsHeader->gameCode, "UBR", 3) == 0) { - return (dataToPreloadSize > 0 && (dataToPreloadSize/*+dataToPreloadSize[1]*/) <= retail_CACHE_ADRESS_SIZE_BROWSER-0x40000); + return (dataToPreloadSize[0] > 0 && dataToPreloadFullSize() <= retail_CACHE_ADRESS_SIZE_BROWSER-0x40000); } const bool cheatsEnabled = (cheatSizeTotal > 4 && cheatSizeTotal <= 0x8000); - return (dataToPreloadSize > 0 && (dataToPreloadSize/*+dataToPreloadSize[1]*/) <= (consoleModel > 0 ? (dsiModeConfirmed ? (ndsHeader->unitCode > 0 ? dev_CACHE_ADRESS_SIZE_TWLSDK : dev_CACHE_ADRESS_SIZE_DSIMODE) : dev_CACHE_ADRESS_SIZE) : (dsiModeConfirmed ? (ndsHeader->unitCode > 0 ? (cheatsEnabled ? retail_CACHE_ADRESS_SIZE_TWLSDK_CHEAT : retail_CACHE_ADRESS_SIZE_TWLSDK) : retail_CACHE_ADRESS_SIZE_DSIMODE) : retail_CACHE_ADRESS_SIZE))-0x40000); + return (dataToPreloadSize[0] > 0 && dataToPreloadFullSize() <= (consoleModel > 0 ? (dsiModeConfirmed ? (ndsHeader->unitCode > 0 ? dev_CACHE_ADRESS_SIZE_TWLSDK : dev_CACHE_ADRESS_SIZE_DSIMODE) : dev_CACHE_ADRESS_SIZE) : (dsiModeConfirmed ? (ndsHeader->unitCode > 0 ? (cheatsEnabled ? retail_CACHE_ADRESS_SIZE_TWLSDK_CHEAT : retail_CACHE_ADRESS_SIZE_TWLSDK) : retail_CACHE_ADRESS_SIZE_DSIMODE) : retail_CACHE_ADRESS_SIZE))-0x40000); } static void loadROMPartIntoRAM(const tNDSHeader* ndsHeader, aFile* file) { @@ -1162,9 +1174,9 @@ static void buildRomMap(const tNDSHeader* ndsHeader, const module_params_t* modu // Load ROM into RAM const u32 romLocation = ROMinRAM ? getRomLocation(ndsHeader, !laterSdk, isSdk5(moduleParams), dsiBios) : getRomPartLocation(ndsHeader, !laterSdk, isSdk5(moduleParams), dsiBios); - u32 romOffset[2] = {(ROMinRAM ? 0 : dataToPreloadAddr), romOffset[0]}; - s32 romSizeEdit[2] = {(ROMinRAM ? baseRomSize : dataToPreloadSize), romSizeEdit[0]}; - bool skipArm7Binary = false; + u32 romOffset[2] = {(ROMinRAM ? 0 : dataToPreloadAddr[0]), (ROMinRAM ? 0 : dataToPreloadAddr[1])}; + s32 romSizeEdit[2] = {(ROMinRAM ? baseRomSize : dataToPreloadSize[0]), (ROMinRAM ? baseRomSize : dataToPreloadSize[1])}; + int iCount = 1; if (ROMinRAM) { if (usesCloneboot) { romOffset[0] = 0x4000; @@ -1182,13 +1194,18 @@ static void buildRomMap(const tNDSHeader* ndsHeader, const module_params_t* modu romSizeEdit[0] = overlaysSize; romOffset[1] = (baseArm7Off + baseArm7Size); romSizeEdit[1] -= romOffset[1]; - skipArm7Binary = true; + iCount++; } else { romSizeEdit[0] -= romOffset[0]; } } - } else if (!dataToPreloadFound(ndsHeader)) { - return; + } else { + if (!dataToPreloadFound(ndsHeader)) { + return; + } + if (dataToPreloadSize[1]) { + iCount++; + } } /* dbg_printf("romOffset[0]: "); @@ -1207,7 +1224,7 @@ static void buildRomMap(const tNDSHeader* ndsHeader, const module_params_t* modu u32 romLocationChange = romLocation; u32 romLocationChangePrep = romLocationChange; u32 romBlockSize = 0; - for (int i = 0; i < (skipArm7Binary ? 2 : 1); i++) { + for (int i = 0; i < iCount; i++) { u32 romOffsetChange = romOffset[i]; while (romSizeEdit[i] > 0) { bool readRom = false; diff --git a/retail/cardenginei/arm9/source/cardDma.thumb.c b/retail/cardenginei/arm9/source/cardDma.thumb.c index 23bee6736..9431315c3 100644 --- a/retail/cardenginei/arm9/source/cardDma.thumb.c +++ b/retail/cardenginei/arm9/source/cardDma.thumb.c @@ -382,17 +382,20 @@ void cardSetDma(u32 * params) { romPart = false; //int romPartNo = 0; if (!(ce9->valueBits & ROMinRAM)) { - /*for (int i = 0; i < 2; i++) { + #ifndef TWLSDK + for (int i = 0; i < 2; i++) { if (ce9->romPartSize[i] == 0) { break; } romPart = (src >= ce9->romPartSrc[i] && src < ce9->romPartSrc[i]+ce9->romPartSize[i]); if (romPart) { - romPartNo = i; + // romPartNo = i; break; } - }*/ - romPart = (ce9->romPartSize > 0 && src >= ce9->romPartSrc && src < ce9->romPartSrc+ce9->romPartSize); + } + #else + romPart = (ce9->romPartSize[0] > 0 && src >= ce9->romPartSrc[0] && src < ce9->romPartSrc[0]+ce9->romPartSize[0]); + #endif /* #ifndef DLDI #ifndef TWLSDK if (romPart && (ce9->valueBits & waitForPreloadToFinish)) { diff --git a/retail/cardenginei/arm9/source/card_engine_header.s b/retail/cardenginei/arm9/source/card_engine_header.s index f5c6b154c..344ea3d6b 100644 --- a/retail/cardenginei/arm9/source/card_engine_header.s +++ b/retail/cardenginei/arm9/source/card_engine_header.s @@ -64,8 +64,10 @@ cacheBlockSize: .hword 0 romPartSrc: .word 0x00000000 + .word 0x00000000 romPartSize: .word 0x00000000 + .word 0x00000000 #ifndef TWLSDK romMapLines: .word 0x00000000 diff --git a/retail/cardenginei/arm9/source/cardengine.c b/retail/cardenginei/arm9/source/cardengine.c index c1f198a0b..19503fb9a 100644 --- a/retail/cardenginei/arm9/source/cardengine.c +++ b/retail/cardenginei/arm9/source/cardengine.c @@ -836,17 +836,20 @@ void cardRead(u32* cacheStruct, u8* dst0, u32 src0, u32 len0) { romPart = false; //int romPartNo = 0; if (!(ce9->valueBits & ROMinRAM)) { - /*for (int i = 0; i < 2; i++) { + #ifndef TWLSDK + for (int i = 0; i < 2; i++) { if (ce9->romPartSize[i] == 0) { break; } romPart = (src >= ce9->romPartSrc[i] && src < ce9->romPartSrc[i]+ce9->romPartSize[i]); if (romPart) { - romPartNo = i; + // romPartNo = i; break; } - }*/ - romPart = (ce9->romPartSize > 0 && src >= ce9->romPartSrc && src < ce9->romPartSrc+ce9->romPartSize); + } + #else + romPart = (ce9->romPartSize[0] > 0 && src >= ce9->romPartSrc[0] && src < ce9->romPartSrc[0]+ce9->romPartSize[0]); + #endif /* #ifndef DLDI #ifndef TWLSDK if (romPart && (ce9->valueBits & waitForPreloadToFinish)) { diff --git a/retail/common/include/cardengine_header_arm9.h b/retail/common/include/cardengine_header_arm9.h index fde261baa..88b91cb5c 100644 --- a/retail/common/include/cardengine_header_arm9.h +++ b/retail/common/include/cardengine_header_arm9.h @@ -121,8 +121,8 @@ typedef struct cardengineArm9 { u32 cacheAddress; u16 cacheSlots; u16 cacheBlockSize; - u32 romPartSrc; - u32 romPartSize; + u32 romPartSrc[2]; + u32 romPartSize[2]; u32 romMapLines; u32 romMap[8][3]; // 0: ROM part start, 1: ROM part start in RAM, 2: ROM part end in RAM } cardengineArm9; diff --git a/retail/common/include/load_crt0.h b/retail/common/include/load_crt0.h index bfbfa5a23..a4cfa0731 100644 --- a/retail/common/include/load_crt0.h +++ b/retail/common/include/load_crt0.h @@ -26,9 +26,9 @@ typedef struct loadCrt0 { u32 saveSize; // u32 gbaRomSize; // u32 gbaSaveSize; - u32 dataToPreloadAddr; - u32 dataToPreloadSize; - u32 dataToPreloadFrame; + u32 dataToPreloadAddr[2]; + u32 dataToPreloadSize[2]; + // u32 dataToPreloadFrame; u32 wideCheatFileCluster; u32 wideCheatSize; u32 apPatchFileCluster; diff --git a/retail/preLoadSettings/Title list.txt b/retail/preLoadSettings/Title list.txt index 8f97329b0..3dfcc38b4 100644 --- a/retail/preLoadSettings/Title list.txt +++ b/retail/preLoadSettings/Title list.txt @@ -94,3 +94,31 @@ Ultimate Mortal Kombat (Europe) (YUTP) (DSi/3DS) WarioWare: D.I.Y. (USA) (UORE) (DSi) WarioWare: Do It Yourself (Europe) (UORP) (DSi/3DS) Made in Ore (Japan) (UORJ) (DSi) + +Pre-loaded data: + +Base 10 (Art Style) (MEP): +- Sound data + +MegaMan Battle Network 5: Double Team DS (USA) (DSi for all regions, 3DS for Europe version): +- Sound data and intro graphics + +MegaMan ZX (3DS): +- USA/Japan: Everything except for sound data and video cutscenes +- Europe: Everything except for sound data, video cutscenes, title_###.bin files, and x##.bin & z##.bin files + +MegaMan ZX Advent (3DS): +- USA/Japan: Everything except for sound data, video cutscenes, and Download Play client +- Europe: Everything except for sound data, video cutscenes, Download Play client, and language-specific text files + +SaGa 3: Jikuu no Hasha: Shadow or Light (DSi/3DS): +- Sound data + +Sonic Rush Adventure (MEP/DSi/3DS): +- Opening cutscene music + +Style Savvy (DSi/3DS): +- Sound data (minus padding) + +Super Mario 64 DS (DSi): +- Everything except the level data diff --git a/retail/preLoadSettings/files-3ds-frame/AFFE-70A6.bin b/retail/preLoadSettings/files-3ds-frame/AFFE-70A6.bin new file mode 100644 index 0000000000000000000000000000000000000000..5431963a9e97b55b7cbe483c44fbd1d57bdea75e GIT binary patch literal 12 TcmZQj(_>^%sbgSdU|;|M2X_GZ literal 0 HcmV?d00001 diff --git a/retail/preLoadSettings/files-3ds-frame/AFFJ-BE5A.bin b/retail/preLoadSettings/files-3ds-frame/AFFJ-BE5A.bin new file mode 100644 index 0000000000000000000000000000000000000000..6fb550abd38c7d88b1616b3ae97ebd38a90d6ead GIT binary patch literal 12 TcmZQj&|_p!sbgSdU|;|M2Q>im literal 0 HcmV?d00001 diff --git a/retail/preLoadSettings/files-3ds-frame/AFFP-1AE7.bin b/retail/preLoadSettings/files-3ds-frame/AFFP-1AE7.bin new file mode 100644 index 0000000000000000000000000000000000000000..ea478621b0589a8e407c46281078a959ab3fc6ef GIT binary patch literal 12 TcmZQbILdhBU=jl(0|Ns98J+_V literal 0 HcmV?d00001 diff --git a/retail/preLoadSettings/files-3ds-frame/AZLE-236A.bin b/retail/preLoadSettings/files-3ds-frame/AZLE-236A.bin new file mode 100644 index 0000000000000000000000000000000000000000..c17337b5fb91787c26023164759f8aa23dcf5918 GIT binary patch literal 12 TcmZRGQDI;Zo6f+NT0|Ns96hZ=V literal 0 HcmV?d00001 diff --git a/retail/preLoadSettings/files-3ds-frame/AZLP-32D5.bin b/retail/preLoadSettings/files-3ds-frame/AZLP-32D5.bin new file mode 100644 index 0000000000000000000000000000000000000000..8819562aaf750062a3a261948be35a08f3dca902 GIT binary patch literal 12 TcmZQLp~k=^%sbc^D1Cs#w literal 12 TcmZQj(_>^%sbgSdU|;|M2X_GZ diff --git a/retail/preLoadSettings/files-3ds/AFFJ-BE5A.bin b/retail/preLoadSettings/files-3ds/AFFJ-BE5A.bin index 6fb550abd38c7d88b1616b3ae97ebd38a90d6ead..bbac4fe11cb8d064d041880c19bb668da34e7f3d 100644 GIT binary patch literal 8 PcmZQj&|_p!sbc^D18D&A literal 12 TcmZQj&|_p!sbgSdU|;|M2Q>im diff --git a/retail/preLoadSettings/files-3ds/AFFP-1AE7.bin b/retail/preLoadSettings/files-3ds/AFFP-1AE7.bin index ea478621b0589a8e407c46281078a959ab3fc6ef..7e3d4b8bf118dce6af476dbc0b461b4ae06eef08 100644 GIT binary patch literal 8 PcmZQbILdhBU=jlW4PpZh literal 12 TcmZQbILdhBU=jl(0|Ns98J+_V diff --git a/retail/preLoadSettings/files-3ds/ARZE-DBFF.bin b/retail/preLoadSettings/files-3ds/ARZE-DBFF.bin index 62732ed2be3bfbb610938b837e5317480ea1a087..1a0608f18c8292e723250b72d79ceeece6e657ce 100644 GIT binary patch literal 16 XcmZRWBF?~&<<7|PO^As>Pn7`x8D9ds literal 8 PcmZR$W5L9b)xZD%38Vr6 diff --git a/retail/preLoadSettings/files-3ds/ARZJ-82C7.bin b/retail/preLoadSettings/files-3ds/ARZJ-82C7.bin index c08867a17e0cf39c1a21127c0d41bba40f8ca9d4..3d949587a6359d6126d25b3bbe9fb130769fd1c1 100644 GIT binary patch literal 16 WcmZR$BhJ8(M_3Vs4` literal 12 TcmZR$rozB*Yc>NT0|Ns96hZ=V diff --git a/retail/preLoadSettings/files-3ds/AZLP-32D5.bin b/retail/preLoadSettings/files-3ds/AZLP-32D5.bin index 8819562aaf750062a3a261948be35a08f3dca902..9debea67001050906429114d29d22732da0bff63 100644 GIT binary patch literal 8 PcmZQLp~k=2ATn3 literal 12 TcmZRGFlB6T;bmlGU|;|M3?czy diff --git a/retail/preLoadSettings/files-3ds/BZ3J-D409.bin b/retail/preLoadSettings/files-3ds/BZ3J-D409.bin index 8d6931682b15d48439bd542b71a5e342bef9e122..ba4f13723f4c24e223bce624519a4acda01b176e 100644 GIT binary patch literal 8 PcmX@}^%sbgSdU|;|M2X_GZ literal 0 HcmV?d00001 diff --git a/retail/preLoadSettings/files-dsi-frame/AFFJ-BE5A.bin b/retail/preLoadSettings/files-dsi-frame/AFFJ-BE5A.bin new file mode 100644 index 0000000000000000000000000000000000000000..6fb550abd38c7d88b1616b3ae97ebd38a90d6ead GIT binary patch literal 12 TcmZQj&|_p!sbgSdU|;|M2Q>im literal 0 HcmV?d00001 diff --git a/retail/preLoadSettings/files-dsi-frame/AFFP-1AE7.bin b/retail/preLoadSettings/files-dsi-frame/AFFP-1AE7.bin new file mode 100644 index 0000000000000000000000000000000000000000..ea478621b0589a8e407c46281078a959ab3fc6ef GIT binary patch literal 12 TcmZQbILdhBU=jl(0|Ns98J+_V literal 0 HcmV?d00001 diff --git a/retail/preLoadSettings/files-dsi-frame/AZLE-236A.bin b/retail/preLoadSettings/files-dsi-frame/AZLE-236A.bin new file mode 100644 index 0000000000000000000000000000000000000000..c17337b5fb91787c26023164759f8aa23dcf5918 GIT binary patch literal 12 TcmZRGQDI;Zo6f+NT0|Ns96hZ=V literal 0 HcmV?d00001 diff --git a/retail/preLoadSettings/files-dsi-frame/AZLP-32D5.bin b/retail/preLoadSettings/files-dsi-frame/AZLP-32D5.bin new file mode 100644 index 0000000000000000000000000000000000000000..8819562aaf750062a3a261948be35a08f3dca902 GIT binary patch literal 12 TcmZQLp~k=L6NaWMlU0|Ns9A9w>{ literal 0 HcmV?d00001 diff --git a/retail/preLoadSettings/files-dsi-frame/YVIE-3036.bin b/retail/preLoadSettings/files-dsi-frame/YVIE-3036.bin new file mode 100644 index 0000000000000000000000000000000000000000..3c471d4fd589a80f119ddc92e42913474786187c GIT binary patch literal 12 TcmZRWaE$GMY6F7;0|Ns97_kE4 literal 0 HcmV?d00001 diff --git a/retail/preLoadSettings/files-dsi-frame/YVIJ-8FDB.bin b/retail/preLoadSettings/files-dsi-frame/YVIJ-8FDB.bin new file mode 100644 index 0000000000000000000000000000000000000000..396fa98ed666389452057b29355e738d3c091064 GIT binary patch literal 12 TcmZQL7SDD-wShr_fq?-47X1RT literal 0 HcmV?d00001 diff --git a/retail/preLoadSettings/files-dsi-frame/YVIP-11DD.bin b/retail/preLoadSettings/files-dsi-frame/YVIP-11DD.bin new file mode 100644 index 0000000000000000000000000000000000000000..3c471d4fd589a80f119ddc92e42913474786187c GIT binary patch literal 12 TcmZRWaE$GMY6F7;0|Ns97_kE4 literal 0 HcmV?d00001 diff --git a/retail/preLoadSettings/files-dsi/AFFE-70A6.bin b/retail/preLoadSettings/files-dsi/AFFE-70A6.bin index 5431963a9e97b55b7cbe483c44fbd1d57bdea75e..3bbbeb7e28918a82796e8e247b5553f217d9c6ae 100644 GIT binary patch literal 8 PcmZQj(_>^%sbc^D1Cs#w literal 12 TcmZQj(_>^%sbgSdU|;|M2X_GZ diff --git a/retail/preLoadSettings/files-dsi/AFFJ-BE5A.bin b/retail/preLoadSettings/files-dsi/AFFJ-BE5A.bin index 6fb550abd38c7d88b1616b3ae97ebd38a90d6ead..bbac4fe11cb8d064d041880c19bb668da34e7f3d 100644 GIT binary patch literal 8 PcmZQj&|_p!sbc^D18D&A literal 12 TcmZQj&|_p!sbgSdU|;|M2Q>im diff --git a/retail/preLoadSettings/files-dsi/AFFP-1AE7.bin b/retail/preLoadSettings/files-dsi/AFFP-1AE7.bin index ea478621b0589a8e407c46281078a959ab3fc6ef..7e3d4b8bf118dce6af476dbc0b461b4ae06eef08 100644 GIT binary patch literal 8 PcmZQbILdhBU=jlW4PpZh literal 12 TcmZQbILdhBU=jl(0|Ns98J+_V diff --git a/retail/preLoadSettings/files-dsi/AZLE-236A.bin b/retail/preLoadSettings/files-dsi/AZLE-236A.bin index c17337b5fb91787c26023164759f8aa23dcf5918..5bec8647c5ea96c800c885bbd485a79eea408d3b 100644 GIT binary patch literal 8 PcmZRGQDI;Zo6Z0L1k?d8 literal 12 TcmZRGQDI;Zo6f+M_3Vs4` literal 12 TcmZR$rozB*Yc>NT0|Ns96hZ=V diff --git a/retail/preLoadSettings/files-dsi/AZLP-32D5.bin b/retail/preLoadSettings/files-dsi/AZLP-32D5.bin index 8819562aaf750062a3a261948be35a08f3dca902..9debea67001050906429114d29d22732da0bff63 100644 GIT binary patch literal 8 PcmZQLp~k=L6NaWMk`5%dFK literal 12 TcmZ2;G>L6NaWMlU0|Ns9A9w>{ diff --git a/retail/preLoadSettings/files-dsi/YVIE-3036.bin b/retail/preLoadSettings/files-dsi/YVIE-3036.bin index 3c471d4fd589a80f119ddc92e42913474786187c..8873d25ee6f505bc398ac77a52b1a498f1b40efa 100644 GIT binary patch literal 8 PcmZRWaE$GMY6AlR4JiV` literal 12 TcmZRWaE$GMY6F7;0|Ns97_kE4 diff --git a/retail/preLoadSettings/files-dsi/YVIJ-8FDB.bin b/retail/preLoadSettings/files-dsi/YVIJ-8FDB.bin index 396fa98ed666389452057b29355e738d3c091064..23c3669445b2df3b4daf66a76e32e2ed71e22445 100644 GIT binary patch literal 8 PcmZQL7SDD-wSfTu3^@Xk literal 12 TcmZQL7SDD-wShr_fq?-47X1RT diff --git a/retail/preLoadSettings/files-dsi/YVIP-11DD.bin b/retail/preLoadSettings/files-dsi/YVIP-11DD.bin index 3c471d4fd589a80f119ddc92e42913474786187c..8873d25ee6f505bc398ac77a52b1a498f1b40efa 100644 GIT binary patch literal 8 PcmZRWaE$GMY6AlR4JiV` literal 12 TcmZRWaE$GMY6F7;0|Ns97_kE4