Saving states in OpenMSX

By SupraKarma1979

Supporter (6)

SupraKarma1979's picture

08-05-2018, 07:45

I noticed that when saving a state from the menu, it names the state after the game, and counts up every time you save state (e.g. '10 Yard Fight 0001,' '10 Yard Fight 0002, etc). But when I save a state normally, I am limited to either a 'quicksave' or manually typing in the name. Is it possible to set things up so that every time I press a keyboard hotkey, the GAME NAME (and then a specific number for different slots) is saved? That would be ideal, this is how it works in most emulators. If I switch games all of my old 'quicksaves' are going to be overwritten.

Any help figuring this out would be much appreciated. Smile

Login or register to post comments

By Manuel

Ascended (14573)

Manuel's picture

08-05-2018, 09:23

What do you mean with "save a state normally"? What exactly are you doing then?

openMSX doesn't have a slots concept for save states. You just save to a file.

By SupraKarma1979

Supporter (6)

SupraKarma1979's picture

08-05-2018, 14:07

I'm just looking for a way to save states from the keyboard with the filename/gamename included in them, like it does from the menu, whether it be some code I can put in the settings.xml or otherwise. Smile

By SupraKarma1979

Supporter (6)

SupraKarma1979's picture

08-05-2018, 14:06

edit

By Manuel

Ascended (14573)

Manuel's picture

08-05-2018, 23:51

You don't ever need to put stuff in settings.xml, let openMSX do that for you Smile

You can add the name to the savestate command... And you could use a proc like guess_title to combine things. This is basically what is done in some of the scripts like the menu. I'm very short on time now, but please check what happens there, you can probably extract the right command to bind to a hotkey. Let me know and I"ll get back to you later.

OK, this is close: savestate [guess_title]
But, unfortunately, it will overwrite any existing savestate of the same name. So it doesn't do auto-counting. We have a special proc for that, but it isn't used in the savestate script. The only solution now is to add it to that script (or create a new script which is heavily duplicating that script). Adding would have to be done in a smart way to stay backwards compatible. I'll think about that.

By SupraKarma1979

Supporter (6)

SupraKarma1979's picture

09-05-2018, 00:20

Thank you for your help, what you are suggesting seems to be exactly what I'm trying to do. I'm a little unclear on how to accomplish it though.

So for example if I press f10 to bring up the console, I can type:

bind ctrl+1 savestate 1

And every time I press ctrl+1, I will get a save state named "1.oms."

How do I add the guess_title? I'm new to this, but I tried:

bind ctrl+1 savestate guess_title

And also:

bind ctrl+1 savestate proc guess_title

That didn't work though.

Ideally, I'd like to be able to do things in such a way that a number (1-9) is added right after the 'guess_title,' and I have each one mapped to ctrl+1, ctrl+2, ctrl+3, etc. If that makes sense.

But if I can get a single save state working via keyboard hotkey named after the 'guess_title,' I would be satisfied with that also. Smile

By Manuel

Ascended (14573)

Manuel's picture

09-05-2018, 00:25

Try: bind CTRL+1 {savestate [guess_title]_1}
and likewise bind CTRL+2 {savestate [guess_title]_2}, etc.

Realize that CTRL is also picked up by the emulated MSX. It's typically not a good idea to use hotkeys which are also MSX keys. (But then again, there aren't that many unused left...)

By SupraKarma1979

Supporter (6)

SupraKarma1979's picture

09-05-2018, 00:35

Good point - do you know of two unused keys that would be ideal (one for save, and one for load) that could be used in combination with 1-9?

By SupraKarma1979

Supporter (6)

SupraKarma1979's picture

09-05-2018, 00:37

I just tried your suggestion, and it works beatifully btw... thank you very much. Smile

My MSX profile