mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
[LIBNX] Synchronize nxlink logging
- Logs were interleaved and caused instability on certain setups
This commit is contained in:
parent
77fba6d58d
commit
c39bc4ecab
@ -62,6 +62,10 @@ static uint32_t *splashData = NULL;
|
||||
|
||||
static bool psmInitialized = false;
|
||||
|
||||
#ifdef NXLINK
|
||||
extern bool nxlink_connected;
|
||||
#endif
|
||||
|
||||
#endif // HAVE_LIBNX
|
||||
|
||||
static void get_first_valid_core(char *path_return)
|
||||
@ -614,7 +618,7 @@ static void frontend_switch_init(void *data)
|
||||
#endif // HAVE_OPENGL
|
||||
#ifdef NXLINK
|
||||
socketInitializeDefault();
|
||||
nxlinkStdio();
|
||||
nxlink_connected = nxlinkStdio() != -1;
|
||||
#ifndef IS_SALAMANDER
|
||||
verbosity_enable();
|
||||
#endif // IS_SALAMANDER
|
||||
|
19
verbosity.c
19
verbosity.c
@ -63,6 +63,11 @@ static void* log_file_buf = NULL;
|
||||
static bool main_verbosity = false;
|
||||
static bool log_file_initialized = false;
|
||||
|
||||
#ifdef NXLINK
|
||||
static Mutex nxlink_mtx;
|
||||
bool nxlink_connected = false;
|
||||
#endif
|
||||
|
||||
void verbosity_enable(void)
|
||||
{
|
||||
main_verbosity = true;
|
||||
@ -101,6 +106,11 @@ void retro_main_log_file_init(const char *path)
|
||||
if (log_file_initialized)
|
||||
return;
|
||||
|
||||
#ifdef NXLINK
|
||||
if (path == NULL && nxlink_connected)
|
||||
mutexInit(&nxlink_mtx);
|
||||
#endif
|
||||
|
||||
log_file_fp = stderr;
|
||||
if (path == NULL)
|
||||
return;
|
||||
@ -199,6 +209,10 @@ void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap)
|
||||
|
||||
ui_companion_driver_log_msg(buffer);
|
||||
#else
|
||||
#if defined(NXLINK) && !defined(HAVE_FILE_LOGGER)
|
||||
if (nxlink_connected)
|
||||
mutexLock(&nxlink_mtx);
|
||||
#endif
|
||||
if (fp)
|
||||
{
|
||||
fprintf(fp, "%s ",
|
||||
@ -206,6 +220,11 @@ void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap)
|
||||
vfprintf(fp, fmt, ap);
|
||||
fflush(fp);
|
||||
}
|
||||
#if defined(NXLINK) && !defined(HAVE_FILE_LOGGER)
|
||||
if (nxlink_connected)
|
||||
mutexUnlock(&nxlink_mtx);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user