From decba348a49c50232fc706d0f860d3f910a06453 Mon Sep 17 00:00:00 2001 From: retro-wertz Date: Tue, 11 Jun 2019 09:08:27 +0800 Subject: [PATCH] Allow dynarec speedhacks to be applied on-the-fly --- frontend/libretro.c | 62 +++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/frontend/libretro.c b/frontend/libretro.c index 9f7c4fe5..ccf14330 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -1626,6 +1626,38 @@ static void update_variables(bool in_flight) Config.Cdda = 0; } +#ifndef DRC_DISABLE + var.value = NULL; + var.key = "pcsx_rearmed_nosmccheck"; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value) + { + if (strcmp(var.value, "enabled") == 0) + new_dynarec_hacks |= NDHACK_NO_SMC_CHECK; + else + new_dynarec_hacks &= ~NDHACK_NO_SMC_CHECK; + } + + var.value = NULL; + var.key = "pcsx_rearmed_gteregsunneeded"; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value) + { + if (strcmp(var.value, "enabled") == 0) + new_dynarec_hacks |= NDHACK_GTE_UNNEEDED; + else + new_dynarec_hacks &= ~NDHACK_GTE_UNNEEDED; + } + + var.value = NULL; + var.key = "pcsx_rearmed_nogteflags"; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value) + { + if (strcmp(var.value, "enabled") == 0) + new_dynarec_hacks |= NDHACK_GTE_NO_FLAGS; + else + new_dynarec_hacks &= ~NDHACK_GTE_NO_FLAGS; + } +#endif + if (in_flight) { // inform core things about possible config changes plugin_call_rearmed_cbs(); @@ -1664,36 +1696,6 @@ static void update_variables(bool in_flight) int psxclock = atoi(var.value); cycle_multiplier = 10000 / psxclock; } - - var.value = NULL; - var.key = "pcsx_rearmed_nosmccheck"; - if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value) - { - if (strcmp(var.value, "enabled") == 0) - new_dynarec_hacks |= NDHACK_NO_SMC_CHECK; - else - new_dynarec_hacks &= ~NDHACK_NO_SMC_CHECK; - } - - var.value = NULL; - var.key = "pcsx_rearmed_gteregsunneeded"; - if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value) - { - if (strcmp(var.value, "enabled") == 0) - new_dynarec_hacks |= NDHACK_GTE_UNNEEDED; - else - new_dynarec_hacks &= ~NDHACK_GTE_UNNEEDED; - } - - var.value = NULL; - var.key = "pcsx_rearmed_nogteflags"; - if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value) - { - if (strcmp(var.value, "enabled") == 0) - new_dynarec_hacks |= NDHACK_GTE_NO_FLAGS; - else - new_dynarec_hacks &= ~NDHACK_GTE_NO_FLAGS; - } #endif } } -- 2.39.5