aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornotaz2013-12-22 19:54:41 +0200
committernotaz2013-12-22 19:54:41 +0200
commit48f615ba48949d7b6cf7b6765a15f069033a3fdd (patch)
tree0c9902342ded6ceafdebafd9987050e90314630f
parent578c68827e20b1e4c0a1a6352dd4a74ab3d05ef2 (diff)
downloadpcsx_rearmed-48f615ba48949d7b6cf7b6765a15f069033a3fdd.tar.gz
pcsx_rearmed-48f615ba48949d7b6cf7b6765a15f069033a3fdd.tar.bz2
pcsx_rearmed-48f615ba48949d7b6cf7b6765a15f069033a3fdd.zip
libretro: add dynarec switch
-rw-r--r--Makefile1
-rw-r--r--frontend/libretro.c24
2 files changed, 25 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index a472492..cc19e77 100644
--- a/Makefile
+++ b/Makefile
@@ -60,6 +60,7 @@ OBJS += libpcsxcore/new_dynarec/new_dynarec.o libpcsxcore/new_dynarec/linkage_ar
OBJS += libpcsxcore/new_dynarec/pcsxmem.o
else
libpcsxcore/new_dynarec/emu_if.o: CFLAGS += -DDRC_DISABLE
+frontend/libretro.o: CFLAGS += -DDRC_DISABLE
endif
OBJS += libpcsxcore/new_dynarec/emu_if.o
libpcsxcore/new_dynarec/new_dynarec.o: libpcsxcore/new_dynarec/assem_arm.c \
diff --git a/frontend/libretro.c b/frontend/libretro.c
index be132a1..23eecf6 100644
--- a/frontend/libretro.c
+++ b/frontend/libretro.c
@@ -243,6 +243,9 @@ void retro_set_environment(retro_environment_t cb)
{ "frameskip", "Frameskip; 0|1|2|3" },
{ "region", "Region; Auto|NTSC|PAL" },
{ "pad1type", "Pad 1 Type; standard|analog" },
+#ifndef DRC_DISABLE
+ { "rearmed_drc", "Dynamic recompiler; enabled|disabled" },
+#endif
#ifdef __ARM_NEON__
{ "neon_interlace_enable", "Enable interlacing mode(s); disabled|enabled" },
{ "neon_enhancement_enable", "Enhanced resolution (slow); disabled|enabled" },
@@ -831,6 +834,27 @@ static void update_variables(bool in_flight)
pl_rearmed_cbs.gpu_neon.enhancement_no_main = 1;
}
#endif
+#ifndef DRC_DISABLE
+ var.value = NULL;
+ var.key = "rearmed_drc";
+
+ if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value)
+ {
+ R3000Acpu *prev_cpu = psxCpu;
+
+ if (strcmp(var.value, "disabled") == 0)
+ Config.Cpu = CPU_INTERPRETER;
+ else if (strcmp(var.value, "enabled") == 0)
+ Config.Cpu = CPU_DYNAREC;
+
+ psxCpu = (Config.Cpu == CPU_INTERPRETER) ? &psxInt : &psxRec;
+ if (psxCpu != prev_cpu) {
+ prev_cpu->Shutdown();
+ psxCpu->Init();
+ psxCpu->Reset(); // not really a reset..
+ }
+ }
+#endif
if (in_flight) {
// inform core things about possible config changes