mirror of
https://github.com/libretro/RetroArch
synced 2025-04-18 05:43:34 +00:00
Add SET_VARIABLES interface.
This commit is contained in:
parent
fea632b0e9
commit
3bda32d6f1
19
dynamic.c
19
dynamic.c
@ -337,7 +337,7 @@ static bool environment_cb(unsigned cmd, void *data)
|
|||||||
|
|
||||||
case SNES_ENVIRONMENT_GET_VARIABLE:
|
case SNES_ENVIRONMENT_GET_VARIABLE:
|
||||||
{
|
{
|
||||||
struct snes_variable *var = data;
|
struct snes_variable *var = (struct snes_variable*)data;
|
||||||
if (var->key)
|
if (var->key)
|
||||||
{
|
{
|
||||||
// Split string has '\0' delimiters so we have to find the position in original string,
|
// Split string has '\0' delimiters so we have to find the position in original string,
|
||||||
@ -362,6 +362,23 @@ static bool environment_cb(unsigned cmd, void *data)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case SNES_ENVIRONMENT_SET_VARIABLES:
|
||||||
|
{
|
||||||
|
SSNES_LOG("Environ SET_VARIABLES:\n");
|
||||||
|
SSNES_LOG("=======================\n");
|
||||||
|
const struct snes_variable *vars = (const struct snes_variable*)data;
|
||||||
|
while (vars->key)
|
||||||
|
{
|
||||||
|
SSNES_LOG("\t%s :: %s\n",
|
||||||
|
vars->key,
|
||||||
|
vars->value ? vars->value : "N/A");
|
||||||
|
|
||||||
|
vars++;
|
||||||
|
}
|
||||||
|
SSNES_LOG("=======================\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
SSNES_LOG("Environ UNSUPPORTED (#%u)!\n", cmd);
|
SSNES_LOG("Environ UNSUPPORTED (#%u)!\n", cmd);
|
||||||
return false;
|
return false;
|
||||||
|
@ -150,7 +150,7 @@ static void *sdl_input_init(void)
|
|||||||
if (g_settings.input.joypad_map[i] < 0)
|
if (g_settings.input.joypad_map[i] < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (sdl->num_joysticks > g_settings.input.joypad_map[i])
|
if (sdl->num_joysticks > (unsigned)g_settings.input.joypad_map[i])
|
||||||
{
|
{
|
||||||
sdl->joysticks[i] = SDL_JoystickOpen(g_settings.input.joypad_map[i]);
|
sdl->joysticks[i] = SDL_JoystickOpen(g_settings.input.joypad_map[i]);
|
||||||
if (!sdl->joysticks[i])
|
if (!sdl->joysticks[i])
|
||||||
|
@ -99,12 +99,18 @@ extern "C" {
|
|||||||
// Boolean value telling if SSNES is able to rewind.
|
// Boolean value telling if SSNES is able to rewind.
|
||||||
// Some implementations might need to take extra precautions
|
// Some implementations might need to take extra precautions
|
||||||
// to allow this as smoothly as possible.
|
// to allow this as smoothly as possible.
|
||||||
|
//
|
||||||
#define SNES_ENVIRONMENT_GET_VARIABLE 8 // struct snes_variable * --
|
#define SNES_ENVIRONMENT_GET_VARIABLE 8 // struct snes_variable * --
|
||||||
// Interface to aquire user-defined information from environment
|
// Interface to aquire user-defined information from environment
|
||||||
// that cannot feasibly be supported in a multi-system way.
|
// that cannot feasibly be supported in a multi-system way.
|
||||||
// Mostly used for obscure,
|
// Mostly used for obscure,
|
||||||
// specific features that the user can tap into when neseccary.
|
// specific features that the user can tap into when neseccary.
|
||||||
|
//
|
||||||
|
#define SNES_ENVIRONMENT_SET_VARIABLES 9 // const struct snes_variable * --
|
||||||
|
// Allows an implementation to signal the environment
|
||||||
|
// which variables it might want to check for later using GET_VARIABLE.
|
||||||
|
// 'data' points to an array of snes_variable structs terminated by a { NULL, NULL } element.
|
||||||
|
// snes_variable::value should contain a human readable description of the key.
|
||||||
|
|
||||||
struct snes_variable
|
struct snes_variable
|
||||||
{
|
{
|
||||||
|
@ -216,8 +216,8 @@ void config_set_defaults(void)
|
|||||||
memcpy(g_settings.input.binds[i], snes_keybinds_rest, sizeof(snes_keybinds_rest));
|
memcpy(g_settings.input.binds[i], snes_keybinds_rest, sizeof(snes_keybinds_rest));
|
||||||
|
|
||||||
// Verify that binds are in proper order.
|
// Verify that binds are in proper order.
|
||||||
for (unsigned i = 0; i < MAX_PLAYERS; i++)
|
for (int i = 0; i < MAX_PLAYERS; i++)
|
||||||
for (unsigned j = 0; j < SSNES_BIND_LIST_END; j++)
|
for (int j = 0; j < SSNES_BIND_LIST_END; j++)
|
||||||
if (g_settings.input.binds[i][j].valid)
|
if (g_settings.input.binds[i][j].valid)
|
||||||
ssnes_assert(j == g_settings.input.binds[i][j].id);
|
ssnes_assert(j == g_settings.input.binds[i][j].id);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user