Stub out unused exit logic, close SM handle once we don't need it anymore

This commit is contained in:
fincs 2019-07-29 15:12:38 +02:00
parent 549adde3ca
commit 104e0fb0b3
2 changed files with 5 additions and 5 deletions

View File

@ -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

View File

@ -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();