From d39c3b8efc1e82286713b0fa0b14c3414aa43c2f Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Thu, 19 Apr 2018 07:07:43 -0600 Subject: [PATCH] Stratosphere: Properly overwrite appInit/appExit for libnx in loader --- stratosphere/loader/source/ldr_main.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/stratosphere/loader/source/ldr_main.cpp b/stratosphere/loader/source/ldr_main.cpp index 91d53d57e..f542796ef 100644 --- a/stratosphere/loader/source/ldr_main.cpp +++ b/stratosphere/loader/source/ldr_main.cpp @@ -13,13 +13,21 @@ #include "ldr_debug_monitor.hpp" #include "ldr_shell.hpp" -extern u32 __start__; +extern "C" { + extern u32 __start__; -u32 __nx_applet_type = AppletType_None; + u32 __nx_applet_type = AppletType_None; + + #define INNER_HEAP_SIZE 0x200000 + size_t nx_inner_heap_size = INNER_HEAP_SIZE; + char nx_inner_heap[INNER_HEAP_SIZE]; + + void __libnx_initheap(void); + void __appInit(void); + void __appExit(void); + +} -#define INNER_HEAP_SIZE 0x200000 -size_t nx_inner_heap_size = INNER_HEAP_SIZE; -char nx_inner_heap[INNER_HEAP_SIZE]; void __libnx_initheap(void) { void* addr = nx_inner_heap; @@ -49,10 +57,12 @@ void __appInit(void) { if (R_FAILED(rc)) fatalSimple(0xCAFE << 4 | 1); + /* Disable. rc = fsldrInitialize(); if (R_FAILED(rc)) fatalSimple(0xCAFE << 4 | 2); - + */ + fsdevInit(); } @@ -68,7 +78,7 @@ void __appExit(void) { int main(int argc, char **argv) { consoleDebugInit(debugDevice_SVC); - + /* TODO: What's a good timeout value to use here? */ WaitableManager *server_manager = new WaitableManager(U64_MAX);