aboutsummaryrefslogtreecommitdiff
path: root/patches/mame2000/0004-rotation.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/mame2000/0004-rotation.patch')
-rw-r--r--patches/mame2000/0004-rotation.patch75
1 files changed, 75 insertions, 0 deletions
diff --git a/patches/mame2000/0004-rotation.patch b/patches/mame2000/0004-rotation.patch
new file mode 100644
index 0000000..5601a64
--- /dev/null
+++ b/patches/mame2000/0004-rotation.patch
@@ -0,0 +1,75 @@
+diff --git a/src/libretro/libretro.c b/src/libretro/libretro.c
+index f9b3cfe..0171ac1 100644
+--- a/src/libretro/libretro.c
++++ b/src/libretro/libretro.c
+@@ -68,6 +68,8 @@ int should_skip_frame = 0;
+ static int sample_rate = 32000;
+ static int stereo_enabled = true;
+
++static int rotate = false;
++
+ int game_index = -1;
+ unsigned short *gp2x_screen15;
+ int thread_done = 0;
+@@ -296,6 +298,19 @@ static void update_variables(bool first_run)
+ else
+ stereo_enabled = true;
+
++ var.value = NULL;
++ var.key = "mame2000-rotate";
++
++ if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
++ {
++ if(strcmp(var.value, "enabled") == 0)
++ rotate = true;
++ else
++ rotate = false;
++ }
++ else
++ rotate = false;
++
+ /* Reinitialise frameskipping, if required */
+ if (!first_run &&
+ ((frameskip_type != prev_frameskip_type)))
+@@ -312,6 +327,7 @@ void retro_set_environment(retro_environment_t cb)
+ { "mame2000-show_gameinfo", "Show Game Information; disabled|enabled" },
+ { "mame2000-sample_rate", "Audio Rate (Restart); 32000|11025|22050|32000|44100" },
+ { "mame2000-stereo", "Stereo (Restart); enabled|disabled" },
++ { "mame2000-rotate", "Rotate (Restart); disabled|enabled" },
+ { NULL, NULL },
+ };
+ environ_cb = cb;
+@@ -378,10 +394,17 @@ static void update_input(void)
+
+ key[KEY_1 + i] |= JS(i, START);
+ key[KEY_5 + i] |= JS(i, SELECT);
+- joy_pressed[c++] = JS(i, LEFT);
+- joy_pressed[c++] = JS(i, RIGHT);
+- joy_pressed[c++] = JS(i, UP);
+- joy_pressed[c++] = JS(i, DOWN);
++ if (rotate_controls) {
++ joy_pressed[c++] = JS(i, UP);
++ joy_pressed[c++] = JS(i, DOWN);
++ joy_pressed[c++] = JS(i, RIGHT);
++ joy_pressed[c++] = JS(i, LEFT);
++ } else {
++ joy_pressed[c++] = JS(i, LEFT);
++ joy_pressed[c++] = JS(i, RIGHT);
++ joy_pressed[c++] = JS(i, UP);
++ joy_pressed[c++] = JS(i, DOWN);
++ }
+ joy_pressed[c++] = JS(i, B);
+ joy_pressed[c++] = JS(i, A);
+ joy_pressed[c++] = JS(i, Y);
+@@ -911,6 +934,11 @@ bool retro_load_game(const struct retro_game_info *info)
+ options.samplerate = sample_rate;
+ usestereo = stereo_enabled;
+
++ if (rotate) {
++ options.ror = 1;
++ rotate_controls = 1;
++ }
++
+ /* This is needed so emulated YM3526/YM3812 chips are used instead on physical ones. */
+ options.use_emulated_ym3812 = 1;
+