Merge pull request #8656 from m4xw/libnx_fixes

Libnx fixes
This commit is contained in:
Twinaphex 2019-04-29 18:26:38 +02:00 committed by GitHub
commit 3b5954b877
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 43 deletions

View File

@ -865,37 +865,12 @@ static void frontend_switch_get_os(char *s, size_t len, int *major, int *minor)
strlcpy(s, "Horizon OS", len);
#ifdef HAVE_LIBNX
/* There is pretty sure a better way, but this will do just fine */
if (kernelAbove600())
{
*major = 6;
*minor = 0;
}
else if(kernelAbove500())
{
*major = 5;
*minor = 0;
}else if (kernelAbove400())
{
*major = 4;
*minor = 0;
}
else if (kernelAbove300())
{
*major = 3;
*minor = 0;
}
else if (kernelAbove200())
{
*major = 2;
*minor = 0;
}
else
{
/* either 1.0 or > 5.x */
*major = 1;
*minor = 0;
}
*major = 0;
*minor = 0;
u32 hosVersion = hosversionGet();
*major = HOSVER_MAJOR(hosVersion);
*minor = HOSVER_MINOR(hosVersion);
#else
/* defaults in case we error out */
*major = 0;
@ -935,6 +910,17 @@ static void frontend_switch_get_name(char *s, size_t len)
strlcpy(s, "Nintendo Switch", len);
}
void frontend_switch_process_args(int *argc, char *argv[])
{
#ifdef HAVE_STATIC_DUMMY
if (*argc >= 1)
{
/* Ensure current Path is set, only works for the static dummy, likely a hbloader args Issue (?) */
path_set(RARCH_PATH_CORE, argv[0]);
}
#endif
}
frontend_ctx_driver_t frontend_ctx_switch =
{
frontend_switch_get_environment_settings,
@ -942,7 +928,7 @@ frontend_ctx_driver_t frontend_ctx_switch =
frontend_switch_deinit,
#ifdef HAVE_LIBNX
frontend_switch_exitspawn,
NULL, /* process_args */
frontend_switch_process_args,
frontend_switch_exec,
#ifdef IS_SALAMANDER
NULL,

View File

@ -68,10 +68,12 @@ static void* log_file_buf = NULL;
static bool main_verbosity = false;
static bool log_file_initialized = false;
#ifdef HAVE_LIBNX
static Mutex logging_mtx;
#ifdef NXLINK
static Mutex nxlink_mtx;
bool nxlink_connected = false;
#endif
#endif /* NXLINK */
#endif /* HAVE_LIBNX */
void verbosity_enable(void)
{
@ -116,9 +118,8 @@ void retro_main_log_file_init(const char *path, bool append)
if (log_file_initialized)
return;
#ifdef NXLINK
if (path == NULL && nxlink_connected)
mutexInit(&nxlink_mtx);
#ifdef HAVE_LIBNX
mutexInit(&logging_mtx);
#endif
log_file_fp = stderr;
@ -243,9 +244,8 @@ void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap)
OutputDebugStringA(buffer);
#endif
#else
#if defined(NXLINK) && !defined(HAVE_FILE_LOGGER)
if (nxlink_connected)
mutexLock(&nxlink_mtx);
#if defined(HAVE_LIBNX)
mutexLock(&logging_mtx);
#endif
if (fp)
{
@ -254,9 +254,8 @@ 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);
#if defined(HAVE_LIBNX)
mutexUnlock(&logging_mtx);
#endif
#endif