allow to disable SH2 dynarec on runtime
[picodrive.git] / platform / libretro.c
index 3ae8974..cc50307 100644 (file)
@@ -185,6 +185,9 @@ void retro_set_environment(retro_environment_t cb)
                //{ "region", "Region; Auto|NTSC|PAL" },
                { "picodrive_input1", "Input device 1; 3 button pad|6 button pad|None" },
                { "picodrive_input2", "Input device 2; 3 button pad|6 button pad|None" },
+#ifdef DRC_SH2
+               { "picodrive_drc", "Dynamic recompilers; enabled|disabled" },
+#endif
                { NULL, NULL },
        };
 
@@ -688,6 +691,17 @@ static void update_variables(void)
        var.key = "picodrive_input2";
        if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
                PicoSetInputDevice(1, input_name_to_val(var.value));
+
+#ifdef DRC_SH2
+       var.value = NULL;
+       var.key = "picodrive_drc";
+       if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
+               if (strcmp(var.value, "enabled") == 0)
+                       PicoOpt |= POPT_EN_DRC;
+               else
+                       PicoOpt &= ~POPT_EN_DRC;
+       }
+#endif
 }
 
 void retro_run(void)