Skip to content

Commit

Permalink
Fix *Shepherd's Crossing 2 DS* not booting
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketRobz committed Apr 2, 2024
1 parent 7eab01f commit 02b6b70
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 7 deletions.
1 change: 0 additions & 1 deletion retail/bootloader/source/arm7/hook_arm9.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ int hookNdsRetailArm9(
const char* romTid = getRomTid(ndsHeader);
extern u32 romPaddingSize;
extern u32 romLocation;
extern u32 romSizeLimit;
extern u16 s2FlashcardId;
extern bool maxHeapOpen;

Expand Down
5 changes: 3 additions & 2 deletions retail/bootloader/source/arm7/ips.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ bool applyIpsPatch(const tNDSHeader* ndsHeader, u8* ipsbyte, bool arm9Only, bool
if (usesCloneboot) {
rombyte -= 0x8000;
} else if (ndsHeader->arm9overlaySource == 0 || ndsHeader->arm9overlaySize == 0) {
rombyte -= ndsHeader->arm7romOffset;
rombyte -= ndsHeader->arm7binarySize;
rombyte -= (ndsHeader->arm7romOffset + ndsHeader->arm7binarySize);
} else if (ndsHeader->arm9overlaySource > ndsHeader->arm7romOffset) {
rombyte -= (ndsHeader->arm9romOffset + ndsHeader->arm9binarySize);
} else {
rombyte -= ndsHeader->arm9overlaySource;
}
Expand Down
7 changes: 5 additions & 2 deletions retail/bootloader/source/arm7/main.arm7.c
Original file line number Diff line number Diff line change
Expand Up @@ -694,8 +694,9 @@ static bool isROMLoadableInRAM(const tDSiHeader* dsiHeader, const tNDSHeader* nd
romSize -= 0x8000;
romSize += 0x88;
} else if (ndsHeader->arm9overlaySource == 0 || ndsHeader->arm9overlaySize == 0) {
romSize -= ndsHeader->arm7romOffset;
romSize -= ndsHeader->arm7binarySize;
romSize -= (ndsHeader->arm7romOffset + ndsHeader->arm7binarySize);
} else if (ndsHeader->arm9overlaySource > ndsHeader->arm7romOffset) {
romSize -= (ndsHeader->arm9romOffset + ndsHeader->arm9binarySize);
} else {
romSize -= ndsHeader->arm9overlaySource;
}
Expand Down Expand Up @@ -914,6 +915,8 @@ static void loadROMintoRAM(const tNDSHeader* ndsHeader, const module_params_t* m
romSizeEdit += 0x88;
} else if (ndsHeader->arm9overlaySource == 0 || ndsHeader->arm9overlaySize == 0) {
romOffset = (ndsHeader->arm7romOffset + ndsHeader->arm7binarySize);
} else if (ndsHeader->arm9overlaySource > ndsHeader->arm7romOffset) {
romOffset = (ndsHeader->arm9romOffset + ndsHeader->arm9binarySize);
} else {
romOffset = ndsHeader->arm9overlaySource;
}
Expand Down
2 changes: 2 additions & 0 deletions retail/bootloaderi/source/arm7/hook_arm9.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,8 @@ int hookNdsRetailArm9(
romOffset = 0x4000;
} else if (ndsHeader->arm9overlaySource == 0 || ndsHeader->arm9overlaySize == 0) {
romOffset = (ndsHeader->arm7romOffset + ndsHeader->arm7binarySize);
} else if (ndsHeader->arm9overlaySource > ndsHeader->arm7romOffset) {
romOffset = (ndsHeader->arm9romOffset + ndsHeader->arm9binarySize);
} else {
romOffset = ndsHeader->arm9overlaySource;
}
Expand Down
5 changes: 3 additions & 2 deletions retail/bootloaderi/source/arm7/ips.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ bool applyIpsPatch(const tNDSHeader* ndsHeader, u8* ipsbyte, const bool arm9Only
if (usesCloneboot) {
rombyte -= 0x4000;
} else if (ndsHeader->arm9overlaySource == 0 || ndsHeader->arm9overlaySize == 0) {
rombyte -= ndsHeader->arm7romOffset;
rombyte -= ndsHeader->arm7binarySize;
rombyte -= (ndsHeader->arm7romOffset + ndsHeader->arm7binarySize);
} else if (ndsHeader->arm9overlaySource > ndsHeader->arm7romOffset) {
rombyte -= (ndsHeader->arm9romOffset + ndsHeader->arm9binarySize);
} else {
rombyte -= ndsHeader->arm9overlaySource;
}
Expand Down
6 changes: 6 additions & 0 deletions retail/bootloaderi/source/arm7/main.arm7.c
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,8 @@ static bool isROMLoadableInRAM(const tDSiHeader* dsiHeader, const tNDSHeader* nd
romSize += 0x88;
} else if (ndsHeader->arm9overlaySource == 0 || ndsHeader->arm9overlaySize == 0) {
romOffset = (ndsHeader->arm7romOffset + ndsHeader->arm7binarySize);
} else if (ndsHeader->arm9overlaySource > ndsHeader->arm7romOffset) {
romOffset = (ndsHeader->arm9romOffset + ndsHeader->arm9binarySize);
} else {
romOffset = ndsHeader->arm9overlaySource;
}
Expand Down Expand Up @@ -1016,6 +1018,8 @@ static void loadIOverlaysintoRAM(const tDSiHeader* dsiHeader, aFile* file, const
romOffset = 0x4000;
} else if (ndsHeader->arm9overlaySource == 0 || ndsHeader->arm9overlaySize == 0) {
romOffset = (ndsHeader->arm7romOffset + ndsHeader->arm7binarySize);
} else if (ndsHeader->arm9overlaySource > ndsHeader->arm7romOffset) {
romOffset = (ndsHeader->arm9romOffset + ndsHeader->arm9binarySize);
} else {
romOffset = ndsHeader->arm9overlaySource;
}
Expand All @@ -1038,6 +1042,8 @@ static void loadROMintoRAM(const tNDSHeader* ndsHeader, const module_params_t* m
romSizeEdit += 0x88;
} else if (ndsHeader->arm9overlaySource == 0 || ndsHeader->arm9overlaySize == 0) {
romOffset = (ndsHeader->arm7romOffset + ndsHeader->arm7binarySize);
} else if (ndsHeader->arm9overlaySource > ndsHeader->arm7romOffset) {
romOffset = (ndsHeader->arm9romOffset + ndsHeader->arm9binarySize);
} else {
romOffset = ndsHeader->arm9overlaySource;
}
Expand Down

0 comments on commit 02b6b70

Please sign in to comment.