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
This commit is contained in:
libretroadmin authored and libretroadmin committed 2026-08-12 17:24:49 +02:00
1 parent 59d116d0d9
commit 2fbeeaeac5
1 file changed
+9
+9
View File
@@ -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",