1
0
mirror of https://github.com/libretro/RetroArch synced 2025-04-01 04:20:27 +00:00

Move logger_init/logger_deinit to frontend_console.c and out

of platform implementations
This commit is contained in:
twinaphex 2013-04-23 03:17:45 +02:00
parent fda5db7476
commit a647535df0
5 changed files with 18 additions and 61 deletions

@ -24,28 +24,6 @@
char input_path[1024]; 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__) #if defined(__CELLOS_LV2__)
#include "platform/platform_ps3_exec.c" #include "platform/platform_ps3_exec.c"
#include "platform/platform_ps3.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[]) int rarch_main(int argc, char *argv[])
{ {
system_init(); 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(); rarch_main_clear_state();
@ -237,6 +222,14 @@ int rarch_main(int argc, char *argv[])
rarch_perf_log(); rarch_perf_log();
#endif #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(); system_deinit();
if (g_extern.lifecycle_mode_state & (1ULL << MODE_EXITSPAWN)) if (g_extern.lifecycle_mode_state & (1ULL << MODE_EXITSPAWN))

@ -299,18 +299,14 @@ static void system_init(void)
fatInitDefault(); fatInitDefault();
#ifdef HAVE_LOGGER #ifdef HAVE_LOGGER
inl_logger_init();
devoptab_list[STD_OUT] = &dotab_stdout; devoptab_list[STD_OUT] = &dotab_stdout;
devoptab_list[STD_ERR] = &dotab_stdout; devoptab_list[STD_ERR] = &dotab_stdout;
dotab_stdout.write_r = gx_logger_net; dotab_stdout.write_r = gx_logger_net;
#elif defined(HAVE_FILE_LOGGER) #elif defined(HAVE_FILE_LOGGER) && !defined(IS_SALAMANDER)
inl_logger_init();
#ifndef IS_SALAMANDER
devoptab_list[STD_OUT] = &dotab_stdout; devoptab_list[STD_OUT] = &dotab_stdout;
devoptab_list[STD_ERR] = &dotab_stdout; devoptab_list[STD_ERR] = &dotab_stdout;
dotab_stdout.write_r = gx_logger_file; dotab_stdout.write_r = gx_logger_file;
#endif #endif
#endif
#if defined(HW_RVL) && !defined(IS_SALAMANDER) #if defined(HW_RVL) && !defined(IS_SALAMANDER)
lwp_t gx_device_thread; lwp_t gx_device_thread;
@ -336,12 +332,7 @@ static void system_exitspawn(void)
#endif #endif
} }
static void system_deinit(void) static void system_deinit(void) {}
{
#if defined(HAVE_LOGGER) || defined(HAVE_FILE_LOGGER)
inl_logger_deinit();
#endif
}
#ifndef IS_SALAMANDER #ifndef IS_SALAMANDER
static void system_process_args(int argc, char *argv[]) static void system_process_args(int argc, char *argv[])

@ -320,13 +320,6 @@ static void system_init(void)
#ifndef __PSL1GHT__ #ifndef __PSL1GHT__
sys_net_initialize_network(); 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); sceNpInit(NP_POOL_SIZE, np_pool);
#endif #endif
@ -368,12 +361,7 @@ static void system_deinit(void)
{ {
#ifndef IS_SALAMANDER #ifndef IS_SALAMANDER
#if defined(HAVE_LOGGER) || defined(HAVE_FILE_LOGGER)
inl_logger_deinit();
#endif
#if defined(HAVE_SYSMODULES) #if defined(HAVE_SYSMODULES)
#ifdef HAVE_FREETYPE #ifdef HAVE_FREETYPE
/* Freetype font PRX */ /* Freetype font PRX */
cellSysmoduleLoadModule(CELL_SYSMODULE_FONTFT); cellSysmoduleLoadModule(CELL_SYSMODULE_FONTFT);

@ -105,12 +105,6 @@ static void system_process_args(int argc, char *argv[])
static void system_deinit(void) 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(); sceKernelExitGame();
} }

@ -258,10 +258,6 @@ static void get_environment_settings(int argc, char *argv[])
static void system_init(void) static void system_init(void)
{ {
#if defined (HAVE_LOGGER) || defined(HAVE_FILE_LOGGER)
inl_logger_init();
#endif
#if defined(_XBOX1) && !defined(IS_SALAMANDER) #if defined(_XBOX1) && !defined(IS_SALAMANDER)
// Mount drives // Mount drives
xbox_io_mount("A:", "cdrom0"); xbox_io_mount("A:", "cdrom0");
@ -279,12 +275,7 @@ static void system_process_args(int argc, char *argv[])
(void)argv; (void)argv;
} }
static void system_deinit(void) static void system_deinit(void) {}
{
#if defined (HAVE_LOGGER) || defined(HAVE_FILE_LOGGER)
logger_deinit();
#endif
}
static void system_exitspawn(void) static void system_exitspawn(void)
{ {