Skip to content

Commit

Permalink
B4DS: Bug fix for CHN and KOR versions of SM64DS
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketRobz committed Sep 25, 2023
1 parent 21f5edb commit 3cf8c62
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
7 changes: 4 additions & 3 deletions retail/bootloader/source/arm7/main.arm7.c
Original file line number Diff line number Diff line change
Expand Up @@ -1304,9 +1304,10 @@ int arm7_main(void) {
dbg_printf("Music pack found!\n");
}

const bool laterSdk = (moduleParams->sdk_version >= 0x2008000 || moduleParams->sdk_version == 0x20029A8);
bool wramUsed = false;
u32 fatTableSize = 0;
u32 fatTableSizeNoExp = (moduleParams->sdk_version < 0x2008000) ? 0x19C00 : 0x1A400;
u32 fatTableSizeNoExp = !laterSdk ? 0x19C00 : 0x1A400;
if (s2FlashcardId == 0x334D || s2FlashcardId == 0x3647 || s2FlashcardId == 0x4353) {
fatTableAddr = (s2FlashcardId==0x4353 ? 0x09F7FE00 : 0x09F80000);
fatTableSize = 0x80000;
Expand All @@ -1325,7 +1326,7 @@ int arm7_main(void) {
fatTableSize = 0x80000;
}
} else {
if (moduleParams->sdk_version >= 0x2008000) {
if (laterSdk) {
fatTableAddr = ce9Alt ? 0x023FF268 : 0x023FF200;
fatTableSizeNoExp = ce9Alt ? 0x598 : 0x600;

Expand Down Expand Up @@ -1358,7 +1359,7 @@ int arm7_main(void) {
// const bool startMem = (!ce9NotInHeap && ndsHeader->unitCode > 0 && (u32)ndsHeader->arm9destination >= 0x02004000 && ((accessControl & BIT(4)) || arm7mbk == 0x080037C0) && romFile.fatTableCacheSize <= 0x4000);

// if (ce9NotInHeap) {
ce9AltLargeTable = ((romFile.fatTableCacheSize > fatTableSizeNoExp) && (moduleParams->sdk_version >= 0x2008000));
ce9AltLargeTable = ((romFile.fatTableCacheSize > fatTableSizeNoExp) && laterSdk);
if (ce9AltLargeTable) {
dbg_printf("\n");
dbg_printf("Cluster cache is above 0x");
Expand Down
2 changes: 1 addition & 1 deletion retail/bootloader/source/arm7/patch_arm9.c
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ void patchHiHeapPointer(cardengineArm9* ce9, const module_params_t* moduleParams
const bool ce9NotInHeap = (ce9Alt || (u32)ce9 == CARDENGINE_ARM9_LOCATION_DLDI_START);

if ((!nandAccess && extendedMemory)
|| moduleParams->sdk_version < 0x2008000
|| (moduleParams->sdk_version < 0x2008000 && moduleParams->sdk_version != 0x20029A8)
|| (ce9NotInHeap && !ce9AltLargeTable && cheatSizeTotal <= 4)
|| strncmp(romTid, "CLJ", 3) == 0 // Mario & Luigi: Bowser's Inside Story
|| strncmp(romTid, "VSO", 3) == 0 // Sonic Classic Collection
Expand Down
2 changes: 0 additions & 2 deletions retail/bootloader/source/arm7/save_patches/save_patch_v1.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,5 @@ u32 savePatchV1(const cardengineArm7* ce7, const tNDSHeader* ndsHeader, const mo

ce7->patches->arm7Functions->saveCluster = saveFileCluster;

dbg_printf("Arm7 patched!\n");

return 1;
}

0 comments on commit 3cf8c62

Please sign in to comment.