Skip to content

Commit e38e32e

Browse files
committed
Remove unneeded thumb sleep mode alt patches
1 parent 396c118 commit e38e32e

File tree

1 file changed

+6
-29
lines changed

1 file changed

+6
-29
lines changed

bootloader/source/card_patcher.c

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,8 @@ u16 cardReadDmaEndSignatureThumbAlt[4] = {0x8000,0x01FF,0x0000,0x0200};
157157

158158
u32 aRandomPatch[4] = {0xE3500000, 0x1597002C, 0x10406004,0x03E06000};
159159
u32 sleepPatch[2] = {0x0A000001, 0xE3A00601};
160-
u16 sleepPatchThumb[2] = {0xD002,0x4831};
161-
u16 sleepPatchThumbAlt1[4] = {0x2900,0xD002,0x4831,0xF7F4};
162-
u16 sleepPatchThumbAlt2[2] = {0xD002,0x0440};
163-
u16 sleepPatchThumbAlt3[4] = {0x4201,0xD002,0x0440,0xF7F6};
160+
u16 sleepPatchThumb[2] = {0xD002,0x4831};
161+
u16 sleepPatchThumbAlt[2] = {0xD002,0x0440};
164162

165163

166164

@@ -2171,43 +2169,22 @@ u32 patchCardNdsArm7 (const tNDSHeader* ndsHeader, u32* cardEngineLocation, modu
21712169
*(u32*)(sleepPatchOffset+8) = 0;
21722170
}
21732171
if (usesThumb) {
2174-
int alignType = 0;
2175-
21762172
sleepPatchOffset =
21772173
getOffsetThumb((u16*)ndsHeader->arm7destination, 0x00020000,//, ndsHeader->arm9binarySize,
21782174
(u16*)sleepPatchThumb, 2, 1);
21792175
if (!sleepPatchOffset) {
21802176
dbg_printf("Thumb sleep patch not found. Trying alt\n");
2181-
alignType = 1;
2182-
sleepPatchOffset =
2183-
getOffsetThumb((u16*)ndsHeader->arm7destination, 0x00020000,//, ndsHeader->arm9binarySize,
2184-
(u16*)sleepPatchThumbAlt1, 4, 1);
2185-
}
2186-
if (!sleepPatchOffset) {
2187-
dbg_printf("Thumb sleep patch alt not found. Trying alt2\n");
2188-
alignType = 0;
21892177
sleepPatchOffset =
21902178
getOffsetThumb((u16*)ndsHeader->arm7destination, 0x00020000,//, ndsHeader->arm9binarySize,
2191-
(u16*)sleepPatchThumbAlt2, 2, 1);
2179+
(u16*)sleepPatchThumbAlt, 2, 1);
21922180
}
21932181
if (!sleepPatchOffset) {
2194-
dbg_printf("Thumb sleep patch alt2 not found. Trying alt3\n");
2195-
alignType = 1;
2196-
sleepPatchOffset =
2197-
getOffsetThumb((u16*)ndsHeader->arm7destination, 0x00020000,//, ndsHeader->arm9binarySize,
2198-
(u16*)sleepPatchThumbAlt3, 4, 1);
2199-
}
2200-
if (!sleepPatchOffset) {
2201-
dbg_printf("Thumb sleep patch alt3 not found\n");
2182+
dbg_printf("Thumb sleep patch alt not found\n");
22022183
}
22032184
if (sleepPatchOffset>0) {
22042185
dbg_printf("Thumb sleep patch found\n");
2205-
if (alignType == 0) {
2206-
*(u32*)(sleepPatchOffset+4) = 0;
2207-
} else if (alignType == 1) {
2208-
*(u16*)(sleepPatchOffset+6) = 0;
2209-
*(u16*)(sleepPatchOffset+8) = 0;
2210-
}
2186+
*(u16*)(sleepPatchOffset+4) = 0;
2187+
*(u16*)(sleepPatchOffset+6) = 0;
22112188
}
22122189
}
22132190

0 commit comments

Comments
 (0)