aboutsummaryrefslogtreecommitdiff
path: root/patches/mame2000/0004-rotation.patch
blob: 5601a64856311757625a339658b3e016841a9ed1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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;