From: David Guillen Fandos Date: Fri, 30 Jul 2021 18:54:08 +0000 (+0200) Subject: Fix initialization on Frontends without variable support. X-Git-Tag: r24l~575^2 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=abf1a2b64a04b78127062c338ceebf95f627af9c;p=pcsx_rearmed.git 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). --- 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)