From abf1a2b64a04b78127062c338ceebf95f627af9c Mon Sep 17 00:00:00 2001 From: David Guillen Fandos Date: Fri, 30 Jul 2021 20:54:08 +0200 Subject: [PATCH] Fix initialization on Frontends without variable support. Frontends that do not support RETRO_ENVIRONMENT_GET_VARIABLE (like miniretro & nanoarch) cause a segfault in the CPU emulation path unless the BIOS file is present. This is due to the emulator not supporting running without a BIOS in dynarec mode and the code not being able to swap CPU types (unless the callback returns true). --- frontend/libretro.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/libretro.c b/frontend/libretro.c index d0a0da76..59e986e7 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -1634,7 +1634,9 @@ static void update_variables(bool in_flight) var.value = NULL; var.key = "pcsx_rearmed_drc"; - if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + if (!environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var)) + var.value = "enabled"; + { R3000Acpu *prev_cpu = psxCpu; #if defined(LIGHTREC) -- 2.39.2