From 20453016f9d38324961087b62f38145a455e409a Mon Sep 17 00:00:00 2001 From: neonloop Date: Tue, 10 Aug 2021 14:55:06 +0000 Subject: Adds vertical mode to mame2000 --- patches/mame2000/1004-rotation.patch | 75 ++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 patches/mame2000/1004-rotation.patch (limited to 'patches') diff --git a/patches/mame2000/1004-rotation.patch b/patches/mame2000/1004-rotation.patch new file mode 100644 index 0000000..f28b452 --- /dev/null +++ b/patches/mame2000/1004-rotation.patch @@ -0,0 +1,75 @@ +diff --git a/src/libretro/libretro.c b/src/libretro/libretro.c +index aad93bc..2f37f52 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 Info; disabled|enabled" }, + { "mame2000-sample_rate", "Snd. Rate (Restart); 11025|22050|32000|44100" }, + { "mame2000-stereo", "Stereo (Restart); disabled|enabled" }, ++ { "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; + -- cgit v1.2.3