RetroBat-Official / emulatorlauncher

Emulators and application launcher used with RetroBat/EmulationStation to provide integrated features
37 stars 14 forks source link

Model 2 emulator (and possibly others) - non-graceful emulator exit causing NVRAM not to be saved #364

Closed andrewhayes1979 closed 6 months ago

andrewhayes1979 commented 6 months ago

Hi

Ran into this issue the other day when I upgraded to Retrobat 6 and an update to the m2emulator for Model 2 games changed all my NVRAM saves for the model 2 games, e.g. the number of laps setting on Daytona USA that I always have as Grand Prix rather than the default Short game-mode.

You can go into the Model 2 emulator, hit F2 to get into the test menu, change these settings, then exit to reboot. I believe these settings are saved to NVRAM when the emulator is gracefully exited, and reloaded on subsequent loads of the game (so preserving settings, high-scores, etc.)

I'm finding that Retrobat doesn't allow this NVRAM saving to occur when using the hotkey escape (whether button-combos on the controller or ESC on the keyboard)...when I load up Daytona USA, I have to now keep going into the F2 test menu to change the settings each time...less than ideal.

I found an old Launchbox issue on this subject, they suggested using a different command to request emulator exit: https://forums.launchbox-app.com/topic/39541-sega-model-2-not-saving-nvram/

...this apparently does allow the emulator to do it's saving on exit, whereas your current method of process killing does not

I've looked, doesn't seem emulator launch commands are user-editable on Retrobat, everything appears to go through EmulatorLauncher.exe via in the code here (looking from es_systems.cfg). It appears to be tied into the emulator-specific Generator classes in here...but I'm no C# programmer.

It's possible this same issue also affects the Model 3 SuperModel emulator too (believe it works similarly), maybe MAME as well...anything that has persistent storage of high-score tables etc. in NVRAM.

Regards

Andy

Tartifless commented 6 months ago

Hello,

3 topics here:

1) The NVRAM settings were changed with the upgrade because we have default nvram files that are copied in the emulator folder when retrobat is installed (that also happens when we upgrade), so we might check this 2) The exit for supermodel and MAME has been cleaned up to ensure we correctly save on exit, so we perform clean exit for these, as well as for cxbx and flycast. 3) Regarding the issue in question, i will check tonight whether i can send a cleaner exit instead of a KILL, you can try this immediately yourself by replacing the value in the file retrobat\emulationstation.emulationstation\es_padtokey for emulator_multicpu. I would suggest trying the following line instead of the current KILL:

<app name="emulator_multicpu">
        <input name="hotkey start" key="(%{CLOSE})"/>
    </app>
andrewhayes1979 commented 6 months ago

Hi

Thanks for the quick reply.

I understand about the NVRAM overwrites...it's emulator specific, and this is an emulator that insists on it's files living alongside the emulator itself.

I'll give the suggested change a go and report back πŸ‘

Tartifless commented 6 months ago

If it works we'll do the modification, i'll try tonight if i get some time. It worked for MAME and supermodel, so no reason it does not work, only risk is that we know m2emulator is a bit "finnicky with the exit !

andrewhayes1979 commented 6 months ago

Wow, the above actually worked 😎

<app name="emulator_multicpu">
        <input name="hotkey start" key="(%{CLOSE})"/>
    </app>

...NVRAM is now saving, emulator still exits properly back to emulationstation UI, no lingering windows or anything.

Guess this should be the default for this emulator...feel free to close the issue and/or move the issue to retrobat proper.

Tartifless commented 6 months ago

Good to hear, I'll update the default exit command