From 2fbeeaeac5528cd95434701f19e13fe3dcbdf150 Mon Sep 17 00:00:00 2001 From: libretroadmin <> Date: Wed, 12 Aug 2026 14:46:53 +0000 Subject: [PATCH] libretro: clear the forced-machine state on every content load forced_machine_at_init/forced_machine_idx are set by the TS2068 .dck special case in retro_load_game() and never cleared again. A frontend may load new content without an intervening retro_deinit() - the tape buffers and Fuse teardown a few lines below already account for that - so both flags survive into the next load. Two things then go wrong for the rest of the session: - update_variables() overrides the fuse_machine option with forced_machine_idx, pinning the machine to TS2068; - the identify code takes the 'forced_machine_idx == 10' branch and declares the content to be a .dck cartridge whatever it is. Loading a .dck and then a .tzx therefore ran the tape through utils_open_file() as "*.dck" on a TS2068, with the frontend still showing whatever the user had chosen under Model. Before, second load with Model = Spectrum 128K: [core] Opened "tc2068-0.rom" from memory [core] Opened "*.dck" from memory av2: 640x480 fps=60.000000 After: [core] Opened "*.tzx" from memory av2: 320x240 fps=50.000000 --- src/libretro.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/libretro.c b/src/libretro.c index 91c519c..90c6452 100644 --- a/src/libretro.c +++ b/src/libretro.c @@ -1879,6 +1879,15 @@ bool retro_load_game(const struct retro_game_info *info) keyb_send = 0; snapshot_buffer = NULL; snapshot_size = 0; + /* Per-load state: a frontend may load new content without an intervening + retro_deinit(), and these two survive it. Leaving them set meant that + once a .dck had been loaded, every later load in that session stayed + pinned to TS2068 - and took the forced_machine_idx branch in the + identify code below, which declares the content to be a .dck whatever + it actually is. Loading a .dck and then a .tzx opened the tape as + "*.dck" on a TS2068. */ + forced_machine_at_init = 0; + forced_machine_idx = 0; char *argv[] = { "fuse",