mirror of
https://github.com/libretro/RetroArch
synced 2025-03-20 10:20:51 +00:00
(Linux) Restarting of core in non-HAVE_DYNAMIC mode now properly
implemented
This commit is contained in:
parent
c67771fab6
commit
f29c61bacc
@ -138,7 +138,7 @@ void fill_pathname_abbreviate_special(char *out_path,
|
||||
}
|
||||
|
||||
#if !defined(RARCH_CONSOLE)
|
||||
void fill_pathname_application_path(char *buf, size_t size)
|
||||
void fill_pathname_application_path(char *s, size_t len)
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
CFBundleRef bundle = CFBundleGetMainBundle();
|
||||
@ -146,22 +146,22 @@ void fill_pathname_application_path(char *buf, size_t size)
|
||||
size_t i;
|
||||
(void)i;
|
||||
|
||||
if (!size)
|
||||
if (!len)
|
||||
return;
|
||||
|
||||
#ifdef _WIN32
|
||||
DWORD ret = GetModuleFileName(GetModuleHandle(NULL), buf, size - 1);
|
||||
buf[ret] = '\0';
|
||||
DWORD ret = GetModuleFileName(GetModuleHandle(NULL), s, len - 1);
|
||||
s[ret] = '\0';
|
||||
#elif defined(__APPLE__)
|
||||
if (bundle)
|
||||
{
|
||||
CFURLRef bundle_url = CFBundleCopyBundleURL(bundle);
|
||||
CFStringRef bundle_path = CFURLCopyPath(bundle_url);
|
||||
CFStringGetCString(bundle_path, buf, size, kCFStringEncodingUTF8);
|
||||
CFStringGetCString(bundle_path, s, len, kCFStringEncodingUTF8);
|
||||
CFRelease(bundle_path);
|
||||
CFRelease(bundle_url);
|
||||
|
||||
retro_assert(strlcat(buf, "nobin", size) < size);
|
||||
retro_assert(strlcat(s, "nobin", len) < len);
|
||||
return;
|
||||
}
|
||||
#elif defined(__HAIKU__)
|
||||
@ -172,7 +172,7 @@ void fill_pathname_application_path(char *buf, size_t size)
|
||||
{
|
||||
if (info.type == B_APP_IMAGE)
|
||||
{
|
||||
strlcpy(buf, info.name, size);
|
||||
strlcpy(s, info.name, len);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -182,7 +182,7 @@ void fill_pathname_application_path(char *buf, size_t size)
|
||||
static const char *exts[] = { "exe", "file", "path/a.out" };
|
||||
char link_path[PATH_MAX_LENGTH] = {0};
|
||||
|
||||
*buf = '\0';
|
||||
*s = '\0';
|
||||
pid = getpid();
|
||||
|
||||
/* Linux, BSD and Solaris paths. Not standardized. */
|
||||
@ -192,11 +192,11 @@ void fill_pathname_application_path(char *buf, size_t size)
|
||||
|
||||
snprintf(link_path, sizeof(link_path), "/proc/%u/%s",
|
||||
(unsigned)pid, exts[i]);
|
||||
ret = readlink(link_path, buf, size - 1);
|
||||
ret = readlink(link_path, s, len - 1);
|
||||
|
||||
if (ret >= 0)
|
||||
{
|
||||
buf[ret] = '\0';
|
||||
s[ret] = '\0';
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -2145,6 +2145,8 @@ static int frontend_android_parse_drive_list(void *data)
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_DYNAMIC
|
||||
#include "../../retroarch.h"
|
||||
|
||||
static bool frontend_linux_set_fork(enum frontend_fork fork_mode)
|
||||
{
|
||||
switch (fork_mode)
|
||||
@ -2159,9 +2161,16 @@ static bool frontend_linux_set_fork(enum frontend_fork fork_mode)
|
||||
break;
|
||||
case FRONTEND_FORK_RESTART:
|
||||
RARCH_LOG("FRONTEND_FORK_RESTART\n");
|
||||
/* NOTE: We don't implement Salamander, so just turn
|
||||
* this into FRONTEND_FORK_CORE. */
|
||||
linux_fork_mode = FRONTEND_FORK_CORE;
|
||||
|
||||
{
|
||||
char executable_path[PATH_MAX_LENGTH];
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
fill_pathname_application_path(executable_path, sizeof(executable_path));
|
||||
strlcpy(settings->libretro, executable_path, sizeof(settings->libretro));
|
||||
}
|
||||
rarch_ctl(RARCH_CTL_FORCE_QUIT, NULL);
|
||||
break;
|
||||
case FRONTEND_FORK_NONE:
|
||||
default:
|
||||
|
Loading…
x
Reference in New Issue
Block a user