From 2d3c4d02ae7877c8b28c3f8e7578dfc0f98bacd6 Mon Sep 17 00:00:00 2001 From: notaz Date: Fri, 19 Nov 2021 23:36:28 +0200 Subject: [PATCH] frontend: force full recompile on drc setting change Libretro port should do the same, but here it outdated and nobody cared updating it here. --- frontend/main.c | 2 +- frontend/menu.c | 12 ++++++++++-- frontend/menu.h | 2 +- libpcsxcore/new_dynarec/emu_if.c | 3 ++- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/frontend/main.c b/frontend/main.c index 4631618e..3ec252f0 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -634,7 +634,7 @@ int main(int argc, char *argv[]) } if (ready_to_go) { - menu_prepare_emu(); + menu_prepare_emu(0); // If a state has been specified, then load that if (loadst) { diff --git a/frontend/menu.c b/frontend/menu.c index 0dbaa400..f3049d92 100644 --- a/frontend/menu.c +++ b/frontend/menu.c @@ -1556,6 +1556,7 @@ static const char h_cfg_psxclk[] = "Over/under-clock the PSX, default is " DEFA static const char h_cfg_nosmc[] = "Will cause crashes when loading, break memcards"; static const char h_cfg_gteunn[] = "May cause graphical glitches"; static const char h_cfg_gteflgs[] = "Will cause graphical glitches"; +static const char h_cfg_gtestll[] = "Some games will run too fast"; static menu_entry e_menu_speed_hacks[] = { @@ -2329,8 +2330,11 @@ static void menu_leave_emu(void); void menu_loop(void) { + int cycle_multiplier_old = cycle_multiplier; + int ndrc_hacks_old = new_dynarec_hacks; static int warned_about_bios = 0; static int sel = 0; + int ndrc_changed; menu_leave_emu(); @@ -2365,7 +2369,9 @@ void menu_loop(void) in_set_config_int(0, IN_CFG_BLOCKING, 0); - menu_prepare_emu(); + ndrc_changed = cycle_multiplier_old != cycle_multiplier + || ndrc_hacks_old != new_dynarec_hacks; + menu_prepare_emu(ndrc_changed); } static int qsort_strcmp(const void *p1, const void *p2) @@ -2617,7 +2623,7 @@ static void menu_leave_emu(void) cpu_clock = plat_target_cpu_clock_get(); } -void menu_prepare_emu(void) +void menu_prepare_emu(int ndrc_config_changed) { R3000Acpu *prev_cpu = psxCpu; @@ -2634,6 +2640,8 @@ void menu_prepare_emu(void) // note that this does not really reset, just clears drc caches psxCpu->Reset(); } + else if (ndrc_config_changed) + new_dynarec_clear_full(); // core doesn't care about Config.Cdda changes, // so handle them manually here diff --git a/frontend/menu.h b/frontend/menu.h index 81cd1baf..9defc1ea 100644 --- a/frontend/menu.h +++ b/frontend/menu.h @@ -1,5 +1,5 @@ void menu_init(void); -void menu_prepare_emu(void); +void menu_prepare_emu(int ndrc_config_changed); void menu_loop(void); void menu_finish(void); diff --git a/libpcsxcore/new_dynarec/emu_if.c b/libpcsxcore/new_dynarec/emu_if.c index 60f005fd..f660e7f1 100644 --- a/libpcsxcore/new_dynarec/emu_if.c +++ b/libpcsxcore/new_dynarec/emu_if.c @@ -184,7 +184,8 @@ void new_dyna_freeze(void *f, int mode) if (bytes != size) return; - new_dynarec_load_blocks(addrs, size); + if (psxCpu != &psxInt) + new_dynarec_load_blocks(addrs, size); } //printf("drc: %d block info entries %s\n", size/8, mode ? "saved" : "loaded"); -- 2.39.5