From a647535df0651c55da86a78d0fc604ad1a3d176f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 23 Apr 2013 03:17:45 +0200 Subject: [PATCH] Move logger_init/logger_deinit to frontend_console.c and out of platform implementations --- frontend/frontend_console.c | 37 +++++++++++++------------------- frontend/platform/platform_gx.c | 13 ++--------- frontend/platform/platform_ps3.c | 12 ----------- frontend/platform/platform_psp.c | 6 ------ frontend/platform/platform_xdk.c | 11 +--------- 5 files changed, 18 insertions(+), 61 deletions(-) diff --git a/frontend/frontend_console.c b/frontend/frontend_console.c index e43b9d0099..171a2e94e1 100644 --- a/frontend/frontend_console.c +++ b/frontend/frontend_console.c @@ -24,28 +24,6 @@ char input_path[1024]; -static inline void inl_logger_init(void) -{ -#if defined(HAVE_LOGGER) - g_extern.verbose = true; - logger_init(); -#elif defined(HAVE_FILE_LOGGER) - g_extern.verbose = true; - g_extern.log_file = fopen("/retroarch-log.txt", "w"); -#endif -} - -static inline void inl_logger_deinit(void) -{ -#if defined(HAVE_LOGGER) - logger_shutdown(); -#elif defined(HAVE_FILE_LOGGER) - if (g_extern.log_file) - fclose(g_extern.log_file); - g_extern.log_file = NULL; -#endif -} - #if defined(__CELLOS_LV2__) #include "platform/platform_ps3_exec.c" #include "platform/platform_ps3.c" @@ -110,6 +88,13 @@ static bool libretro_install_core(const char *path_prefix, const char *extension int rarch_main(int argc, char *argv[]) { system_init(); +#if defined(HAVE_LOGGER) + g_extern.verbose = true; + logger_init(); +#elif defined(HAVE_FILE_LOGGER) + g_extern.verbose = true; + g_extern.log_file = fopen("/retroarch-log.txt", "w"); +#endif rarch_main_clear_state(); @@ -237,6 +222,14 @@ int rarch_main(int argc, char *argv[]) rarch_perf_log(); #endif +#if defined(HAVE_LOGGER) + logger_shutdown(); +#elif defined(HAVE_FILE_LOGGER) + if (g_extern.log_file) + fclose(g_extern.log_file); + g_extern.log_file = NULL; +#endif + system_deinit(); if (g_extern.lifecycle_mode_state & (1ULL << MODE_EXITSPAWN)) diff --git a/frontend/platform/platform_gx.c b/frontend/platform/platform_gx.c index fbc86f146b..1037830e8c 100644 --- a/frontend/platform/platform_gx.c +++ b/frontend/platform/platform_gx.c @@ -299,18 +299,14 @@ static void system_init(void) fatInitDefault(); #ifdef HAVE_LOGGER - inl_logger_init(); devoptab_list[STD_OUT] = &dotab_stdout; devoptab_list[STD_ERR] = &dotab_stdout; dotab_stdout.write_r = gx_logger_net; -#elif defined(HAVE_FILE_LOGGER) - inl_logger_init(); -#ifndef IS_SALAMANDER +#elif defined(HAVE_FILE_LOGGER) && !defined(IS_SALAMANDER) devoptab_list[STD_OUT] = &dotab_stdout; devoptab_list[STD_ERR] = &dotab_stdout; dotab_stdout.write_r = gx_logger_file; #endif -#endif #if defined(HW_RVL) && !defined(IS_SALAMANDER) lwp_t gx_device_thread; @@ -336,12 +332,7 @@ static void system_exitspawn(void) #endif } -static void system_deinit(void) -{ -#if defined(HAVE_LOGGER) || defined(HAVE_FILE_LOGGER) - inl_logger_deinit(); -#endif -} +static void system_deinit(void) {} #ifndef IS_SALAMANDER static void system_process_args(int argc, char *argv[]) diff --git a/frontend/platform/platform_ps3.c b/frontend/platform/platform_ps3.c index 1f6be0826b..25781e9b26 100644 --- a/frontend/platform/platform_ps3.c +++ b/frontend/platform/platform_ps3.c @@ -320,13 +320,6 @@ static void system_init(void) #ifndef __PSL1GHT__ sys_net_initialize_network(); -#endif - -#if defined(HAVE_LOGGER) || defined(HAVE_FILE_LOGGER) - inl_logger_init(); -#endif - -#ifndef __PSL1GHT__ sceNpInit(NP_POOL_SIZE, np_pool); #endif @@ -368,12 +361,7 @@ static void system_deinit(void) { #ifndef IS_SALAMANDER -#if defined(HAVE_LOGGER) || defined(HAVE_FILE_LOGGER) - inl_logger_deinit(); -#endif - #if defined(HAVE_SYSMODULES) - #ifdef HAVE_FREETYPE /* Freetype font PRX */ cellSysmoduleLoadModule(CELL_SYSMODULE_FONTFT); diff --git a/frontend/platform/platform_psp.c b/frontend/platform/platform_psp.c index df5d6c76e3..9d660edfaf 100644 --- a/frontend/platform/platform_psp.c +++ b/frontend/platform/platform_psp.c @@ -105,12 +105,6 @@ static void system_process_args(int argc, char *argv[]) static void system_deinit(void) { -#ifdef HAVE_FILE_LOGGER - if (g_extern.log_file) - fclose(g_extern.log_file); - g_extern.log_file = NULL; -#endif - sceKernelExitGame(); } diff --git a/frontend/platform/platform_xdk.c b/frontend/platform/platform_xdk.c index 75086f7f18..f42481354c 100644 --- a/frontend/platform/platform_xdk.c +++ b/frontend/platform/platform_xdk.c @@ -258,10 +258,6 @@ static void get_environment_settings(int argc, char *argv[]) static void system_init(void) { -#if defined (HAVE_LOGGER) || defined(HAVE_FILE_LOGGER) - inl_logger_init(); -#endif - #if defined(_XBOX1) && !defined(IS_SALAMANDER) // Mount drives xbox_io_mount("A:", "cdrom0"); @@ -279,12 +275,7 @@ static void system_process_args(int argc, char *argv[]) (void)argv; } -static void system_deinit(void) -{ -#if defined (HAVE_LOGGER) || defined(HAVE_FILE_LOGGER) - logger_deinit(); -#endif -} +static void system_deinit(void) {} static void system_exitspawn(void) {