mupen64plus / mupen64plus-core

Core module of the Mupen64Plus project
1.29k stars 257 forks source link

With `AutoStateSlotIncrement = True` `CurrentStateSlot` is not updated #978

Closed rafaelbeirigo closed 1 year ago

rafaelbeirigo commented 1 year ago

Steps to reproduce:

  1. Set the following options in mupen64plus.cfg: AutoStateSlotIncrement = True CurrentStateSlot = 0
  2. Open a game
  3. Save the state (F5) twice; the emulator uses the slots 0 and 1; current slot is 2
  4. Close the game
  5. Check mupen64plus.cfg to see that CurrentStateSlot was not updated: CurrentStateSlot = 0
richard42 commented 1 year ago

This is not a problem with the mupen64plus core. Each time the slot is updated, via any of the methods of updating the savestate slot number, the current value is stored in the emulator's internal configuration map. I believe the reason why you are observing the behavior you outlined is that the front-end application which you are using does not save the configuration data back to disk after closing the game. Which front-end are you using?

rafaelbeirigo commented 1 year ago

Oh, sorry for the inconvenience, I didn't know that.

The frontend I'm using is the one I get by executing apt install mupen64plus-ui-console on Debian GNU/Linux 10 (buster):

rafa@bach:~$ mupen64plus
 __  __                         __   _  _   ____  _             
|  \/  |_   _ _ __   ___ _ __  / /_ | || | |  _ \| |_   _ ___ 
| |\/| | | | | '_ \ / _ \ '_ \| '_ \| || |_| |_) | | | | / __|  
| |  | | |_| | |_) |  __/ | | | (_) |__   _|  __/| | |_| \__ \  
|_|  |_|\__,_| .__/ \___|_| |_|\___/   |_| |_|   |_|\__,_|___/  
             |_|         http://code.google.com/p/mupen64plus/  
Mupen64Plus Console User-Interface Version 2.5.0

UI-Console: attached to core library 'Mupen64Plus Core' version 2.5.0
UI-Console:             Includes support for Dynamic Recompiler.
UI-Console:             Includes support for MIPS r4300 Debugger.
UI-Console Error: no ROM filepath given
rafa@bach:~$
richard42 commented 1 year ago

Okay that is the front-end application that we maintain. From looking at the code, I think it ought to be saving all of the config file parameters after shutting down the game. Are you by any chance giving it the "--nosaveoptions" command-line parameter?

rafaelbeirigo commented 1 year ago

Are you by any chance giving it the "--nosaveoptions" command-line parameter?

No. I'm running $ mupen64plus rom.z64 with no options whatsoever.

From looking at the code, I think it ought to be saving all of the config file parameters after shutting down the game.

I did a test, and

  1. Deleted the config file (in my case /home/rafa/.config/mupen64plus/mupen64plus.cfg)
  2. Ran $ mupen64plus with no rom file. This created a new default config file /home/rafa/.config/mupen64plus/mupen64plus.cfg
  3. Changed from AutoStateSlotIncrement = False to AutoStateSlotIncrement = True
  4. Ran $ mupen64plus rom.z64, this time with the rom file, but still with no options whatsoever for the two tests below
richard42 commented 1 year ago

thanks for the testing; this led me to the exact source of the problem. I just pushed a fix in the core for this.