mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
Make late binding possible for frontend drivers
(PS3) Fix shutdown/quit hang - now we have to fix exitspawn instead
This commit is contained in:
parent
4787c463b6
commit
cdef82b185
2
driver.c
2
driver.c
@ -38,8 +38,6 @@ void driver_free(void)
|
||||
{
|
||||
if (g_driver)
|
||||
free(g_driver);
|
||||
|
||||
g_driver = NULL;
|
||||
}
|
||||
|
||||
static driver_t *driver_new(void)
|
||||
|
2
driver.h
2
driver.h
@ -194,7 +194,7 @@ enum
|
||||
|
||||
typedef struct driver
|
||||
{
|
||||
const frontend_ctx_driver_t *frontend_ctx;
|
||||
frontend_ctx_driver_t *frontend_ctx;
|
||||
const ui_companion_driver_t *ui_companion;
|
||||
const audio_driver_t *audio;
|
||||
const video_driver_t *video;
|
||||
|
@ -1048,7 +1048,7 @@ static int frontend_android_parse_drive_list(void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
const frontend_ctx_driver_t frontend_ctx_android = {
|
||||
frontend_ctx_driver_t frontend_ctx_android = {
|
||||
frontend_android_get_environment_settings,
|
||||
frontend_android_init,
|
||||
frontend_android_deinit,
|
||||
|
@ -223,7 +223,7 @@ static int frontend_ctr_parse_drive_list(void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
const frontend_ctx_driver_t frontend_ctx_ctr = {
|
||||
frontend_ctx_driver_t frontend_ctx_ctr = {
|
||||
frontend_ctr_get_environment_settings,
|
||||
frontend_ctr_init,
|
||||
frontend_ctr_deinit,
|
||||
|
@ -609,7 +609,7 @@ static int frontend_darwin_parse_drive_list(void *data)
|
||||
return ret;
|
||||
}
|
||||
|
||||
const frontend_ctx_driver_t frontend_ctx_darwin = {
|
||||
frontend_ctx_driver_t frontend_ctx_darwin = {
|
||||
frontend_darwin_get_environment_settings,
|
||||
NULL, /* init */
|
||||
NULL, /* deinit */
|
||||
|
@ -409,7 +409,7 @@ static int frontend_gx_parse_drive_list(void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
const frontend_ctx_driver_t frontend_ctx_gx = {
|
||||
frontend_ctx_driver_t frontend_ctx_gx = {
|
||||
frontend_gx_get_environment_settings,
|
||||
frontend_gx_init,
|
||||
frontend_gx_deinit,
|
||||
|
@ -465,7 +465,7 @@ static void frontend_linux_get_os(char *s, size_t len, int *major, int *minor)
|
||||
strlcpy(s, "Linux", len);
|
||||
}
|
||||
|
||||
const frontend_ctx_driver_t frontend_ctx_linux = {
|
||||
frontend_ctx_driver_t frontend_ctx_linux = {
|
||||
NULL, /* environment_get */
|
||||
NULL, /* init */
|
||||
NULL, /* deinit */
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
const frontend_ctx_driver_t frontend_ctx_null = {
|
||||
frontend_ctx_driver_t frontend_ctx_null = {
|
||||
NULL, /* environment_get */
|
||||
NULL, /* init */
|
||||
NULL, /* deinit */
|
||||
|
@ -57,6 +57,10 @@ static bool multiman_detected = false;
|
||||
static bool exit_spawn = false;
|
||||
static bool exitspawn_start_game = false;
|
||||
|
||||
static void frontend_ps3_shutdown(bool unused)
|
||||
{
|
||||
sys_process_exit(0);
|
||||
}
|
||||
|
||||
#ifdef HAVE_SYSUTILS
|
||||
static void callback_sysutil_exit(uint64_t status,
|
||||
@ -73,10 +77,13 @@ static void callback_sysutil_exit(uint64_t status,
|
||||
{
|
||||
case CELL_SYSUTIL_REQUEST_EXITGAME:
|
||||
{
|
||||
frontend_ctx_driver_t *frontend = frontend_get_ptr();
|
||||
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
||||
|
||||
if (system)
|
||||
system->shutdown = true;
|
||||
if (frontend)
|
||||
frontend->shutdown = frontend_ps3_shutdown;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -313,47 +320,12 @@ static void frontend_ps3_deinit(void *data)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void frontend_ps3_exec(const char *path, bool should_load_game);
|
||||
|
||||
static void frontend_ps3_set_fork(bool exit, bool start_game)
|
||||
{
|
||||
exit_spawn = exitspawn;
|
||||
exitspawn_start_game = start_game;
|
||||
}
|
||||
|
||||
static void frontend_ps3_exitspawn(char *core_path, size_t core_path_size)
|
||||
{
|
||||
#ifdef HAVE_RARCH_EXEC
|
||||
bool should_load_game = false;
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
global_t *global = global_get_ptr();
|
||||
bool original_verbose = global->verbosity;
|
||||
global->verbosity = true;
|
||||
|
||||
should_load_game = exitspawn_start_game;
|
||||
|
||||
if (!exit_spawn)
|
||||
return;
|
||||
#endif
|
||||
|
||||
frontend_ps3_exec(core_path, should_load_game);
|
||||
|
||||
#ifdef IS_SALAMANDER
|
||||
cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_GAME);
|
||||
cellSysmoduleLoadModule(CELL_SYSMODULE_FS);
|
||||
cellSysmoduleLoadModule(CELL_SYSMODULE_IO);
|
||||
#else
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
global->verbosity = original_verbose;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void frontend_ps3_exec(const char *path, bool should_load_game)
|
||||
{
|
||||
unsigned i;
|
||||
@ -439,6 +411,44 @@ static void frontend_ps3_exec(const char *path, bool should_load_game)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void frontend_ps3_exitspawn(char *core_path, size_t core_path_size)
|
||||
{
|
||||
#ifdef HAVE_RARCH_EXEC
|
||||
bool should_load_game = false;
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
global_t *global = global_get_ptr();
|
||||
bool original_verbose = global->verbosity;
|
||||
global->verbosity = true;
|
||||
|
||||
should_load_game = exitspawn_start_game;
|
||||
|
||||
if (!exit_spawn)
|
||||
{
|
||||
frontend_ctx_driver_t *frontend = frontend_get_ptr();
|
||||
|
||||
if (frontend)
|
||||
frontend->shutdown = frontend_ps3_shutdown;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
frontend_ps3_exec(core_path, should_load_game);
|
||||
|
||||
#ifdef IS_SALAMANDER
|
||||
cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_GAME);
|
||||
cellSysmoduleLoadModule(CELL_SYSMODULE_FS);
|
||||
cellSysmoduleLoadModule(CELL_SYSMODULE_IO);
|
||||
#endif
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
global->verbosity = original_verbose;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static int frontend_ps3_get_rating(void)
|
||||
{
|
||||
return 10;
|
||||
@ -481,7 +491,7 @@ static int frontend_ps3_parse_drive_list(void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
const frontend_ctx_driver_t frontend_ctx_ps3 = {
|
||||
frontend_ctx_driver_t frontend_ctx_ps3 = {
|
||||
frontend_ps3_get_environment_settings,
|
||||
frontend_ps3_init,
|
||||
frontend_ps3_deinit,
|
||||
|
@ -290,7 +290,7 @@ static int frontend_psp_parse_drive_list(void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
const frontend_ctx_driver_t frontend_ctx_psp = {
|
||||
frontend_ctx_driver_t frontend_ctx_psp = {
|
||||
frontend_psp_get_environment_settings,
|
||||
frontend_psp_init,
|
||||
frontend_psp_deinit,
|
||||
|
@ -64,7 +64,7 @@ enum frontend_architecture frontend_qnx_get_architecture(void)
|
||||
return FRONTEND_ARCH_ARM;
|
||||
}
|
||||
|
||||
const frontend_ctx_driver_t frontend_ctx_qnx = {
|
||||
frontend_ctx_driver_t frontend_ctx_qnx = {
|
||||
frontend_qnx_get_environment_settings,
|
||||
frontend_qnx_init,
|
||||
NULL, /* deinit */
|
||||
|
@ -227,7 +227,7 @@ static int frontend_win32_parse_drive_list(void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
const frontend_ctx_driver_t frontend_ctx_win32 = {
|
||||
frontend_ctx_driver_t frontend_ctx_win32 = {
|
||||
NULL, /* environment_get */
|
||||
frontend_win32_init,
|
||||
NULL, /* deinit */
|
||||
|
@ -407,7 +407,7 @@ static int frontend_xdk_parse_drive_list(void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
const frontend_ctx_driver_t frontend_ctx_xdk = {
|
||||
frontend_ctx_driver_t frontend_ctx_xdk = {
|
||||
frontend_xdk_get_environment_settings,
|
||||
frontend_xdk_init,
|
||||
NULL, /* deinit */
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
static const frontend_ctx_driver_t *frontend_ctx_drivers[] = {
|
||||
static frontend_ctx_driver_t *frontend_ctx_drivers[] = {
|
||||
#if defined(__CELLOS_LV2__)
|
||||
&frontend_ctx_ps3,
|
||||
#endif
|
||||
@ -65,7 +65,7 @@ static const frontend_ctx_driver_t *frontend_ctx_drivers[] = {
|
||||
*
|
||||
* Returns: pointer to driver if successful, otherwise NULL.
|
||||
**/
|
||||
const frontend_ctx_driver_t *frontend_ctx_find_driver(const char *ident)
|
||||
frontend_ctx_driver_t *frontend_ctx_find_driver(const char *ident)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
@ -85,10 +85,10 @@ const frontend_ctx_driver_t *frontend_ctx_find_driver(const char *ident)
|
||||
*
|
||||
* Returns: pointer to first suitable driver, otherwise NULL.
|
||||
**/
|
||||
const frontend_ctx_driver_t *frontend_ctx_init_first(void)
|
||||
frontend_ctx_driver_t *frontend_ctx_init_first(void)
|
||||
{
|
||||
unsigned i;
|
||||
const frontend_ctx_driver_t *frontend = NULL;
|
||||
frontend_ctx_driver_t *frontend = NULL;
|
||||
|
||||
for (i = 0; frontend_ctx_drivers[i]; i++)
|
||||
{
|
||||
@ -100,7 +100,7 @@ const frontend_ctx_driver_t *frontend_ctx_init_first(void)
|
||||
}
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
const frontend_ctx_driver_t *frontend_get_ptr(void)
|
||||
frontend_ctx_driver_t *frontend_get_ptr(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
@ -110,7 +110,7 @@ const frontend_ctx_driver_t *frontend_get_ptr(void)
|
||||
|
||||
int frontend_driver_parse_drive_list(void *data)
|
||||
{
|
||||
const frontend_ctx_driver_t *frontend = frontend_get_ptr();
|
||||
frontend_ctx_driver_t *frontend = frontend_get_ptr();
|
||||
|
||||
if (!frontend || !frontend->parse_drive_list)
|
||||
return -1;
|
||||
|
@ -76,17 +76,17 @@ typedef struct frontend_ctx_driver
|
||||
const struct video_driver *(*get_video_driver)(void);
|
||||
} frontend_ctx_driver_t;
|
||||
|
||||
extern const frontend_ctx_driver_t frontend_ctx_gx;
|
||||
extern const frontend_ctx_driver_t frontend_ctx_ps3;
|
||||
extern const frontend_ctx_driver_t frontend_ctx_xdk;
|
||||
extern const frontend_ctx_driver_t frontend_ctx_qnx;
|
||||
extern const frontend_ctx_driver_t frontend_ctx_darwin;
|
||||
extern const frontend_ctx_driver_t frontend_ctx_android;
|
||||
extern const frontend_ctx_driver_t frontend_ctx_linux;
|
||||
extern const frontend_ctx_driver_t frontend_ctx_psp;
|
||||
extern const frontend_ctx_driver_t frontend_ctx_ctr;
|
||||
extern const frontend_ctx_driver_t frontend_ctx_win32;
|
||||
extern const frontend_ctx_driver_t frontend_ctx_null;
|
||||
extern frontend_ctx_driver_t frontend_ctx_gx;
|
||||
extern frontend_ctx_driver_t frontend_ctx_ps3;
|
||||
extern frontend_ctx_driver_t frontend_ctx_xdk;
|
||||
extern frontend_ctx_driver_t frontend_ctx_qnx;
|
||||
extern frontend_ctx_driver_t frontend_ctx_darwin;
|
||||
extern frontend_ctx_driver_t frontend_ctx_android;
|
||||
extern frontend_ctx_driver_t frontend_ctx_linux;
|
||||
extern frontend_ctx_driver_t frontend_ctx_psp;
|
||||
extern frontend_ctx_driver_t frontend_ctx_ctr;
|
||||
extern frontend_ctx_driver_t frontend_ctx_win32;
|
||||
extern frontend_ctx_driver_t frontend_ctx_null;
|
||||
|
||||
/**
|
||||
* frontend_ctx_find_driver:
|
||||
@ -96,9 +96,9 @@ extern const frontend_ctx_driver_t frontend_ctx_null;
|
||||
*
|
||||
* Returns: pointer to driver if successful, otherwise NULL.
|
||||
**/
|
||||
const frontend_ctx_driver_t *frontend_ctx_find_driver(const char *ident);
|
||||
frontend_ctx_driver_t *frontend_ctx_find_driver(const char *ident);
|
||||
|
||||
const frontend_ctx_driver_t *frontend_get_ptr(void);
|
||||
frontend_ctx_driver_t *frontend_get_ptr(void);
|
||||
|
||||
/**
|
||||
* frontend_ctx_init_first:
|
||||
@ -107,7 +107,7 @@ const frontend_ctx_driver_t *frontend_get_ptr(void);
|
||||
*
|
||||
* Returns: pointer to first suitable driver, otherwise NULL.
|
||||
**/
|
||||
const frontend_ctx_driver_t *frontend_ctx_init_first(void);
|
||||
frontend_ctx_driver_t *frontend_ctx_init_first(void);
|
||||
|
||||
int frontend_driver_parse_drive_list(void *data);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user