From 8b51141f54744cec0815c7a01255b6728c78f8e1 Mon Sep 17 00:00:00 2001 From: TuxSH Date: Fri, 15 Mar 2019 21:43:12 +0100 Subject: [PATCH] Fix latest commit --- arm9/source/large_patches.s | 6 +++--- arm9/source/main.c | 15 ++++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/arm9/source/large_patches.s b/arm9/source/large_patches.s index dca1be9..90f3ffd 100644 --- a/arm9/source/large_patches.s +++ b/arm9/source/large_patches.s @@ -146,13 +146,13 @@ rebootPatch: mov r1, #0 mov r2, #0 mov r3, #0 - swi 0x7C + svc 0x7C goto_reboot: @ Jump to reboot code ldr r0, kernel_func_displ add r0, pc @ pc is two instructions ahead of the instruction being executed (12 = 2*4 + 4) - swi 0x7B + svc 0x7B die: b die @@ -171,7 +171,7 @@ rebootPatch: panic: mov r1, r0 @ unused register mov r0, #0 - swi 0x3C @ svcBreak(USERBREAK_PANIC) + svc 0x3C @ svcBreak(USERBREAK_PANIC) b die kernel_func_displ: diff --git a/arm9/source/main.c b/arm9/source/main.c index c5fa4f9..00d4092 100644 --- a/arm9/source/main.c +++ b/arm9/source/main.c @@ -61,7 +61,7 @@ void main(int argc, char **argv, u32 magicWord) FirmwareSource nandType; const vu8 *bootMediaStatus = (const vu8 *)0x1FFFE00C; const vu32 *bootPartitionsStatus = (const vu32 *)0x1FFFE010; - char firmlaunchTid[16+1]; + u32 firmlaunchTidLow = 0; //Shell closed, no error booting NTRCARD, NAND paritions not even considered isNtrBoot = bootMediaStatus[3] == 2 && !bootMediaStatus[1] && !bootPartitionsStatus[0] && !bootPartitionsStatus[1]; @@ -85,7 +85,8 @@ void main(int argc, char **argv, u32 magicWord) launchedPath[i] = p[i]; launchedPath[i] = 0; - strncpy(firmlaunchTid, argv[1], 16); + for(i = 0; i < 8; i++) + firmlaunchTidLow = (argv[1][2 * i] > '9' ? argv[1][2 * i] - 'a' + 10 : argv[1][2 * i] - '0') | (firmlaunchTidLow << 4); } else if(magicWord == 0xB002) //FIRM/NTRCARD boot { @@ -164,15 +165,15 @@ void main(int argc, char **argv, u32 magicWord) { if(needConfig == CREATE_CONFIGURATION) mcuPowerOff(); - switch(firmlaunchTid[14]) + switch(firmlaunchTidLow & 0xF) { - case '2': - firmType = (FirmwareType)(firmlaunchTid[10] - '0'); + case 2: + firmType = (FirmwareType)((firmlaunchTidLow >> 8) & 0xF); break; - case '3': + case 3: firmType = SAFE_FIRM; break; - case '1': + case 1: firmType = SYSUPDATER_FIRM; break; }