From de0f1dc156269601accbdb8ecac22b4b21c0e4ad Mon Sep 17 00:00:00 2001 From: Aurora Wright Date: Sat, 20 May 2017 13:46:12 +0200 Subject: [PATCH] Use arm11 entry define for screen.c, fix isFirmlaunch not being always defined --- loader/source/firm.c | 1 - loader/source/main.c | 2 +- source/firm.c | 2 +- source/main.c | 4 +--- source/screen.c | 2 +- source/types.h | 2 +- 6 files changed, 5 insertions(+), 8 deletions(-) diff --git a/loader/source/firm.c b/loader/source/firm.c index c336876..42de373 100644 --- a/loader/source/firm.c +++ b/loader/source/firm.c @@ -26,7 +26,6 @@ void launchFirm(Firm *firm, int argc, char **argv) { - //Copy FIRM sections to respective memory locations for(u32 sectionNum = 0; sectionNum < 4 && firm->section[sectionNum].size != 0; sectionNum++) memcpy(firm->section[sectionNum].address, (u8 *)firm + firm->section[sectionNum].offset, firm->section[sectionNum].size); diff --git a/loader/source/main.c b/loader/source/main.c index 23cf3af..2446297 100644 --- a/loader/source/main.c +++ b/loader/source/main.c @@ -30,7 +30,7 @@ void main(int argc __attribute__((unused)), char **argv) char absPath[24 + 255]; u32 i; - for(i = 0; i < 23 + 255 && argv[0][i] != 0; i++) + for(i = 0; i < sizeof(absPath) - 1 && argv[0][i] != 0; i++) absPath[i] = argv[0][i]; absPath[i] = 0; diff --git a/source/firm.c b/source/firm.c index f268aa5..05ce9ae 100755 --- a/source/firm.c +++ b/source/firm.c @@ -379,7 +379,7 @@ void launchFirm(FirmwareType firmType, bool loadFromStorage) if(!isFirmlaunch) deinitScreens(); //Set ARM11 kernel entrypoint - ARM11_CORE0_MAILBOX_ENTRYPOINT = (u32)firm->arm11Entry; + *ARM11_CORE0_MAILBOX_ENTRYPOINT = (u32)firm->arm11Entry; //Ensure that all memory transfers have completed and that the caches have been flushed flushEntireDCache(); diff --git a/source/main.c b/source/main.c index 8cc2fe1..d80ea35 100644 --- a/source/main.c +++ b/source/main.c @@ -38,7 +38,7 @@ extern CfgData configData; extern ConfigurationStatus needConfig; extern FirmwareSource firmSource; -bool isFirmlaunch, +bool isFirmlaunch = false, isSdMode; u16 launchedPath[41]; @@ -63,8 +63,6 @@ void main(int argc, char **argv) for(i = 0; i < 40 && argv[0][i] != 0; i++) //Copy and convert the path to utf16 launchedPath[i] = argv[0][i]; launchedPath[i] = 0; - - isFirmlaunch = false; break; } diff --git a/source/screen.c b/source/screen.c index 4d7f0fb..a9ce3b5 100644 --- a/source/screen.c +++ b/source/screen.c @@ -42,7 +42,7 @@ #include "i2c.h" #include "utils.h" -static vu32 *arm11Entry = (vu32 *)0x1FFFFFFC; +static vu32 *arm11Entry = ARM11_CORE0_MAILBOX_ENTRYPOINT; static const u32 brightness[4] = {0x5F, 0x4C, 0x39, 0x26}; diff --git a/source/types.h b/source/types.h index 7b017a9..661c06d 100644 --- a/source/types.h +++ b/source/types.h @@ -47,7 +47,7 @@ typedef volatile s64 vs64; #include "3dsheaders.h" -#define ARM11_CORE0_MAILBOX_ENTRYPOINT *(vu32 *)0x1FFFFFFC +#define ARM11_CORE0_MAILBOX_ENTRYPOINT ((vu32 *)0x1FFFFFFC) #define CFG_BOOTENV (*(vu32 *)0x10010000) #define CFG_UNITINFO (*(vu8 *)0x10010010)