From 104e0fb0b3c616d5a11a11120eb95fba5f17b85f Mon Sep 17 00:00:00 2001 From: fincs Date: Mon, 29 Jul 2019 15:12:38 +0200 Subject: [PATCH] Stub out unused exit logic, close SM handle once we don't need it anymore --- Makefile | 2 +- source/main.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index eb6d035..8bbd85e 100644 --- a/Makefile +++ b/Makefile @@ -57,7 +57,7 @@ CFLAGS += $(INCLUDE) -D__SWITCH__ CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions ASFLAGS := -g $(ARCH) -LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) +LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-wrap,exit -Wl,-Map,$(notdir $*.map) LIBS := -lnx diff --git a/source/main.c b/source/main.c index 53eedbf..a35a1b1 100644 --- a/source/main.c +++ b/source/main.c @@ -61,11 +61,10 @@ void __appInit(void) fsdevMountSdmc(); } -void __appExit(void) +void __wrap_exit(void) { - fsdevUnmountAll(); - fsExit(); - smExit(); + // exit() effectively never gets called, so let's stub it out. + fatalSimple(MAKERESULT(Module_HomebrewLoader, 39)); } static void* g_heapAddr; @@ -408,6 +407,7 @@ int main(int argc, char **argv) getIsApplication(); getIsAutomaticGameplayRecording(); + smExit(); // Close SM as we don't need it anymore. setupHbHeap(); getOwnProcessHandle(); loadNro();