aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraliaspider2015-10-06 01:24:03 +0100
committeraliaspider2015-10-06 01:24:03 +0100
commit25f26d4d7ad16c98f29dbe0070c3b3d40688cc6e (patch)
tree6c0182d6a02831c5c5d69998f5c0fa1626f27c0f
parentde5af8fb9af829578855593dbd01ebeb1efc14cb (diff)
downloadsnes9x2005-25f26d4d7ad16c98f29dbe0070c3b3d40688cc6e.tar.gz
snes9x2005-25f26d4d7ad16c98f29dbe0070c3b3d40688cc6e.tar.bz2
snes9x2005-25f26d4d7ad16c98f29dbe0070c3b3d40688cc6e.zip
add a core option to swap joypads.
-rw-r--r--libretro.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/libretro.c b/libretro.c
index 9fe26f3..650150b 100644
--- a/libretro.c
+++ b/libretro.c
@@ -325,6 +325,10 @@ void retro_init(void)
{
struct retro_log_callback log;
enum retro_pixel_format rgb565;
+ static const struct retro_variable vars[] = {
+ { "SwapJoypads", "Swap Joypads; disabled|enabled" },
+ { NULL, NULL },
+ };
if (environ_cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log))
log_cb = log.log;
@@ -349,6 +353,8 @@ void retro_init(void)
true,
Settings.SoundBufferSize);
#endif
+ environ_cb(RETRO_ENVIRONMENT_SET_VARIABLES, (void*)vars);
+
}
void retro_deinit(void)
@@ -401,6 +407,18 @@ uint32_t S9xReadJoypad(int port)
return joypad;
}
+static void check_variables(void)
+{
+ struct retro_variable var;
+
+ var.key = "SwapJoypads";
+ var.value = NULL;
+ if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
+ Settings.SwapJoypads = strcmp(var.value, "disabled");
+
+}
+
+
#ifdef PSP
#define FRAMESKIP
#endif
@@ -409,7 +427,10 @@ uint32_t S9xReadJoypad(int port)
static float samples_to_play = 0.0;
void retro_run(void)
{
- int i, port;
+ bool updated = false;
+
+ if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
+ check_variables();
#ifdef NO_VIDEO_OUTPUT
video_cb(NULL, IPPU.RenderedScreenWidth, IPPU.RenderedScreenHeight, GFX.Pitch);
@@ -486,9 +507,6 @@ void retro_run(void)
}
#endif
- // if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
- // check_variables();
-
}
void S9xGenerateSound()
@@ -877,6 +895,7 @@ bool retro_load_game(const struct retro_game_info* game)
{
CPU.Flags = 0;
init_descriptors();
+ check_variables();
#ifdef LOAD_FROM_MEMORY_TEST
if (!LoadROM(game))