Add RETRO_ENVIRONMENT_EXEC - refactor some stuff internally in
libretro frontend to implement this new functionality
This commit is contained in:
parent
8aef9f4c64
commit
edfab9630a
25
dynamic.c
25
dynamic.c
|
@ -757,10 +757,35 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
||||||
}
|
}
|
||||||
case RETRO_ENVIRONMENT_SET_LIBRETRO_PATH:
|
case RETRO_ENVIRONMENT_SET_LIBRETRO_PATH:
|
||||||
{
|
{
|
||||||
|
RARCH_LOG("Environ SET_LIBRETRO_PATH.\n");
|
||||||
|
|
||||||
struct retro_variable *var = (struct retro_variable*)data;
|
struct retro_variable *var = (struct retro_variable*)data;
|
||||||
strlcpy(g_settings.libretro, var->value, sizeof(g_settings.libretro));
|
strlcpy(g_settings.libretro, var->value, sizeof(g_settings.libretro));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case RETRO_ENVIRONMENT_EXEC:
|
||||||
|
{
|
||||||
|
RARCH_LOG("Environ EXEC.\n");
|
||||||
|
|
||||||
|
struct retro_variable *var = (struct retro_variable*)data;
|
||||||
|
if (var->value)
|
||||||
|
strlcpy(g_extern.fullpath, var->value, sizeof(g_extern.fullpath));
|
||||||
|
else
|
||||||
|
*g_extern.fullpath = '\0';
|
||||||
|
|
||||||
|
if (strcasecmp(var->key, "EXEC_RELOAD") == 0)
|
||||||
|
{
|
||||||
|
#if !defined( HAVE_DYNAMIC) && defined(RARCH_CONSOLE)
|
||||||
|
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_GAME);
|
||||||
|
g_extern.lifecycle_mode_state |= (1ULL << MODE_EXITSPAWN);
|
||||||
|
g_extern.lifecycle_mode_state |= (1ULL << MODE_EXITSPAWN_START_GAME);
|
||||||
|
#elif defined(HAVE_DYNAMIC)
|
||||||
|
g_extern.lifecycle_mode_state |= (1ULL << MODE_LOAD_GAME);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
RARCH_LOG("Environ UNSUPPORTED (#%u).\n", cmd);
|
RARCH_LOG("Environ UNSUPPORTED (#%u).\n", cmd);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -449,24 +449,18 @@ void load_menu_game_history(unsigned game_index)
|
||||||
rarch_environment_cb(RETRO_ENVIRONMENT_SET_LIBRETRO_PATH, &var);
|
rarch_environment_cb(RETRO_ENVIRONMENT_SET_LIBRETRO_PATH, &var);
|
||||||
|
|
||||||
if (path)
|
if (path)
|
||||||
{
|
|
||||||
rgui->load_no_rom = false;
|
rgui->load_no_rom = false;
|
||||||
strlcpy(g_extern.fullpath, path, sizeof(g_extern.fullpath));
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
rgui->load_no_rom = true;
|
rgui->load_no_rom = true;
|
||||||
*g_extern.fullpath = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
#if !defined( HAVE_DYNAMIC) && defined(RARCH_CONSOLE)
|
var.key = "EXEC_RELOAD";
|
||||||
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_GAME);
|
var.value = path;
|
||||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_EXITSPAWN);
|
|
||||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_EXITSPAWN_START_GAME);
|
rarch_environment_cb(RETRO_ENVIRONMENT_EXEC, &var);
|
||||||
#elif defined(HAVE_DYNAMIC)
|
|
||||||
|
#if defined(HAVE_DYNAMIC)
|
||||||
libretro_free_system_info(&rgui->info);
|
libretro_free_system_info(&rgui->info);
|
||||||
libretro_get_system_info(g_settings.libretro, &rgui->info, NULL);
|
libretro_get_system_info(g_settings.libretro, &rgui->info, NULL);
|
||||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_LOAD_GAME);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -512,6 +512,13 @@ enum retro_mod
|
||||||
#define RETRO_ENVIRONMENT_SET_LIBRETRO_PATH 22
|
#define RETRO_ENVIRONMENT_SET_LIBRETRO_PATH 22
|
||||||
// struct retro_variable * --
|
// struct retro_variable * --
|
||||||
// Sets the absolute path for the libretro core pointed to.
|
// Sets the absolute path for the libretro core pointed to.
|
||||||
|
#define RETRO_ENVIRONMENT_EXEC 23
|
||||||
|
// struct retro_variable * --
|
||||||
|
// Sets an input file for the libretro core to execute with, and (based on key name) will determine what
|
||||||
|
// exec method to follow.
|
||||||
|
// "EXEC_LOAD" : will start the input file whose path was passed from the parameter to RETRO_ENVIRONMENT_EXEC.
|
||||||
|
// "EXEC_RELOAD" : will set the current libretro core, deinitialize the currently running media and then
|
||||||
|
// start the input file whose path was passed from the parameter to RETRO_ENVIRONMENT_EXEC.
|
||||||
|
|
||||||
// Notifies libretro that audio data should be written.
|
// Notifies libretro that audio data should be written.
|
||||||
typedef void (*retro_audio_callback_t)(void);
|
typedef void (*retro_audio_callback_t)(void);
|
||||||
|
|
Loading…
Reference in New Issue