Properly deinit logging, call missing __fini(), return instead of calling _Exit(0);

This commit is contained in:
Maschell 2022-01-21 19:02:31 +01:00
parent fb5f06064e
commit 2e44af129e
2 changed files with 18 additions and 5 deletions

View File

@ -31,7 +31,7 @@ INCLUDES := source
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# options for code generation # options for code generation
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
CFLAGS := -g -Wall -O3 -ffunction-sections -fno-exceptions -fno-rtti\ CFLAGS := -g -Wall -O2 -ffunction-sections -fno-exceptions -fno-rtti\
$(MACHDEP) $(MACHDEP)
CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__ CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__

View File

@ -86,11 +86,19 @@ bool writeFileContent(const std::string &path, const std::string &content) {
return false; return false;
} }
extern "C" void __fini();
#ifdef DEBUG
bool module_log = false;
bool udp_log = false;
bool cafe_log = false;
#endif // DEBUG
int main(int argc, char **argv) { int main(int argc, char **argv) {
#ifdef DEBUG #ifdef DEBUG
if (!WHBLogModuleInit()) { if (!(module_log = WHBLogModuleInit())) {
WHBLogCafeInit(); cafe_log = WHBLogCafeInit();
WHBLogUdpInit(); udp_log = WHBLogUdpInit();
} }
#endif // DEBUG #endif // DEBUG
@ -230,7 +238,12 @@ int main(int argc, char **argv) {
} }
ProcUIShutdown(); ProcUIShutdown();
_Exit(0); #ifdef DEBUG
if (module_log) { WHBLogModuleDeinit(); }
if (udp_log) { WHBLogUdpDeinit(); }
if (cafe_log) { WHBLogCafeDeinit(); }
#endif // DEBUG
__fini();
return 0; return 0;
} }