Jump to content
LaunchBox Community Forums

Nintendo Game Boy Link Cable Emulation with Retroarch - Question on save states


Recommended Posts

Posted (edited)

Hey everyone,

I've run into an issue and hope someone can help me out.

I'm trying to set up a way to emulate Nintendo Game Boy games with the Link Cable feature. I'm using Retroarch and Sameboy as a core, although I think TGB Dual would also work.

Here is what I want to do specifically:

1. I want to emulate two different Pokemon games at the same time, for example Red and Blue. --> This already works

2. I want to start Red and Blue using a Custon Command Line in LaunchBox --> This already works (e.g., when using this on Pokemon Blue in launchbox, Sameboy will start with Pokemon Red and Blue in dual game mode, although strangely with Red as game 1 instead of blue, but that doesn't matter so much):

-L ".\cores\sameboy_libretro.dll"  --subsystem gb_link_2p "M:\Pokemon - Red Version (USA, Europe) (SGB Enhanced).gb"

3. I want to be able to use the same save files for each of the Pokemon games in single game mode and dual game mode --> This already works (Sameboy handles this automatically)

4. I want to be able to use save states --> here is where I have a problem

What is the problem?

When Launching Dual Game Boy games with the command line shown above, Sameboy will create a save state which looks like this:

Pokemon - Red Version (USA, Europe) (SGB Enhanced).state

This looks just like the save state of Pokemon Red if I were to use it in single game mode, but in reality it is a combined save state for Red and Blue (which makes sense).

That means that this save state CANNOT be loaded when launching Pokemon Red in single game mode. And if this dual game save state overrides my "true" single game save state, I might lose progress.

But, I found something interesting out:

If I go to the RetroArch "history" menu point and launch the dual game entry (it will appear as just Pokemon Red, but it will launch both red and blue in dual game mode), and THEN create a save state RetroArch will save it as:

Pokemon - Red Version (USA, Europe) (SGB Enhanced) + Pokemon - Blue Version (USA, Europe) (SGB Enhanced).state

This is a great solution and exactly what I want. Retroarch.log has the follwoing line related to this new save state:

[INFO] [Override] Redirecting save state to "M:\Launchbox\Emulators\RetroArch\RetroArch\states\SameBoy\Pokemon - Red Version (USA, Europe) (SGB Enhanced) + Pokemon - Blue Version (USA, Europe) (SGB Enhanced).state".

This brings me finally to my question:

Is there a way (maybe via an addition to the Custom Command Line) to include this "Redirecting save state" part, so that RetroArch will create the dual save state with the appropriate naming? That way I could keep the single game save states separate from the dual game save states.

Or maybe there is a different solution to achieve what I want that I'm not seeing.

Hope someone can help 😃

Edited by SiriusVI
Posted
9 minutes ago, SiriusVI said:

sameboy will start with Pokemon Red and Blue parallel, although strangely with Red as game 1 instead of blue

Since LB adds the game you're launching to then end of the command line, RA [probably] loads them in that order.

Using LB's built in parameters, you could use something like this to place it (Blue) before the other (Red):

-L ".\cores\sameboy_libretro.dll" --subsystem gb_link_2p "%romfile%" "M:\Pokemon - Red Version (USA, Europe) (SGB Enhanced).gb"

 

 

18 minutes ago, SiriusVI said:

Is there a way (maybe via an addition to the Custom Command Line) to include this "Redirecting save state" part

A quick search shows you can use the parameter --savestate "/path/to/custom_state.state".  (not tested, but looks really good 'on paper')

This should work internally with RA, but how LB sees/addresses/uses that save state in its save states feature may be a different story.

  • Like 1
Posted (edited)
4 hours ago, JoeViking245 said:

Since LB adds the game you're launching to then end of the command line, RA [probably] loads them in that order.

Using LB's built in parameters, you could use something like this to place it (Blue) before the other (Red):

-L ".\cores\sameboy_libretro.dll" --subsystem gb_link_2p "%romfile%" "M:\Pokemon - Red Version (USA, Europe) (SGB Enhanced).gb"

 

 

A quick search shows you can use the parameter --savestate "/path/to/custom_state.state".  (not tested, but looks really good 'on paper')

This should work internally with RA, but how LB sees/addresses/uses that save state in its save states feature may be a different story.

Hey @JoeViking245,

thanks so much for the input! I got the rom load order sorted out, though the correct command line is:

-L ".\cores\sameboy_libretro.dll" %romfile% --subsystem gb_link_2p "M:\Pokemon - Red Version (USA, Europe) (SGB Enhanced).gb"

I wasn't so lucky with the custom save state name. I believe the "--savestate" command is just for setting a custom path, but not a custom file name. If I save the dual game, it will still just use the single game format:

Pokemon - Blue Version (USA, Europe) (SGB Enhanced).state

Retroarch.log reads:

[INFO] [Override] Redirecting save state to "M:\Launchbox\Emulators\RetroArch\RetroArch\states\SameBoy\Pokemon - Blue Version (USA, Europe) (SGB Enhanced).state".

Also, accordung to the Retroarch cli help, this command is deprecated:

image.thumb.png.a3d74b17447d107fc256c373ffd79e35.png

Do you have any other ideas how to make Retroarch set a custom file name like it does when loading the dual game from the launch history menu point?

Edit:

content_history.lpl lists the dual game entry as:

    {
      "path": "M:\\Pokemon - Blue Version (USA, Europe) (SGB Enhanced).gb",
      "label": "",
      "core_path": "M:\\Launchbox\\Emulators\\RetroArch\\RetroArch\\cores\\sameboy_libretro.dll",
      "core_name": "Nintendo - Game Boy / Color (SameBoy)",
      "crc32": "",
      "db_name": "Nintendo - Game Boy|Nintendo - Game Boy Color",
      "subsystem_ident": "gb_link_2p",
      "subsystem_name": "2 Player Game Boy Link",
      "subsystem_roms": [
        "M:\\Pokemon - Blue Version (USA, Europe) (SGB Enhanced).gb",
        "M:\\Pokemon - Red Version (USA, Europe) (SGB Enhanced).gb"
      ]
    },
    {

Could I maybe somehow import a file containing this code into Launchbox as a rom and then make Retroarch run it?

Edited by SiriusVI
Posted
2 hours ago, SiriusVI said:

it will still just use the single game format:

Pokemon - Blue Version (USA, Europe) (SGB Enhanced).state

Retroarch.log reads:

[INFO] [Override] Redirecting save state to "M:\Launchbox\Emulators\RetroArch\RetroArch\states\SameBoy\Pokemon - Blue Version (USA, Europe) (SGB Enhanced).state".

Also, accordung to the Retroarch cli help, this command is deprecated:

image.thumb.png.a3d74b17447d107fc256c373ffd79e35.png

Do you have any other ideas how to make Retroarch set a custom file name like it does when loading the dual game from the launch history menu point?

Based on the info you provided, I'd say create a special folder for your Link Cable games' save states.  e.g. M:\LinkCableGamesSaveStates\

(I like to use camelCase for file names and folders to help reduce errors with spaces in the names. But feel free to name it to your liking.)

You can probably put this in that same folder... Create a custom config file to direct where the save states should be save when "this" config file is loaded.  Call the file e.g. LinkCableSaveStateFolder.cfg.  In it, add just one line.

savestate_directory = M:\LinkCableGamesSaveStates

Now add to your custom command-line parameters

--appendconfig M:\LinkCableGamesSaveStates\LinkCableSaveStateFolder.cfg

(Depending on your folder and file names, you may want to add quotes around the "/path/to/your/config/file.cfg")

 

[still] Not tested, but looks even better 'on paper' than the last one did. :D 

  • Like 1
Posted (edited)
14 hours ago, JoeViking245 said:

Based on the info you provided, I'd say create a special folder for your Link Cable games' save states.  e.g. M:\LinkCableGamesSaveStates\

(I like to use camelCase for file names and folders to help reduce errors with spaces in the names. But feel free to name it to your liking.)

You can probably put this in that same folder... Create a custom config file to direct where the save states should be save when "this" config file is loaded.  Call the file e.g. LinkCableSaveStateFolder.cfg.  In it, add just one line.

savestate_directory = M:\LinkCableGamesSaveStates

Now add to your custom command-line parameters

--appendconfig M:\LinkCableGamesSaveStates\LinkCableSaveStateFolder.cfg

(Depending on your folder and file names, you may want to add quotes around the "/path/to/your/config/file.cfg")

 

[still] Not tested, but looks even better 'on paper' than the last one did. :D 

Thank you, that worked!

However, it does not entirely fix my issue. Now the Dual Game states are created in:

RetroArch\LinkCableGamesSaveStates\SameBoy\

E.g. for Pokemon Blue and Red, it is: 

RetroArch\LinkCableGamesSaveStates\SameBoy\Pokemon - Blue Version (USA, Europe) (SGB Enhanced).state

It still has the same name as single mode Pokemon Blue, but it doesn't matter, because it is in a different location.

So far so good.

However, Pokemon games can be linked up in many different variations accross GB and GBC:

Blue + Red

Blue + Yellow

Blue + Green

Blue + Gold

Blue + Silver

Blue + Crystal

So if I use the "Pokemon - Blue Version (USA, Europe) (SGB Enhanced).state" name for Blue and Red, I cannot use it for say Blue and Yellow, and other combinations.

I could of course set up different save file locations for each different combination, but that is a bit too hacky for me and I'd like to avoid doing something like this.

That's why the alternate naming convention when launching from the RetroArch history menu is so elegant, because it will create a different name for the state depending on the exact games that are linked, e.g.:

Pokemon - Red Version (USA, Europe) (SGB Enhanced) + Pokemon - Blue Version (USA, Europe) (SGB Enhanced).state

There must be some way to tell RetroArch to do this from the start, right?

Anyway, thank you for your help so far 😃

 

Edit:

Just in case anyone wants to try the "hacky" solution, there are a few things to keep in mind that drove me almost crazy:

1. You must disable the automatic Retroachievements login that is done through the LaunchBox plugin (go to manage --> emulators --> Retroarch --> retroachievements --> disable "log in on Game Launch". This is because this automatic login is also done via --appendconfig and that leads to the --appendconfig that is added to the custom command line not working.

2. The custom save state path / folders that are specified in the custom .cfg file must be created manually, otherwise it doesn't work. Retroarch.log reads: [WARN] [Config] "savestate_directory" is not a directory, ignoring...

 

EDIT 2:

Alright, so my "hacky" solution looks as follows for now:

1. I create 7 different config files in: ...\RetroArch\Custom_Configs\LinkCableSaveStates\

image.thumb.png.5e838381336e06b69cc4afda06429593.png

These config files will each use a different --appendconfig command to set a different save state folder according to the game that the primary game is linked to, e.g: ...\RetroArch\states\LinkCableSaveStates\Pokemon_Linked_to_Red

So all save states for Pokemon games linked to Pokemon Red will go there. Same for the other games.

2. Again, these folders must be created manually:

image.thumb.png.103d05b6222b5cc25967912b475335da.png

 

Example use scenario:

1. I create a Platform in LaunchBox called something like "Game Boy Multiplayer" or "Game Boy Link Cable".

2. I import Pokemon Blue and change the Name to e.g.: "Pokemon Blue linked to Pokemon Red"

3. I toggle "Use Custom Command-line Parameters" and insert:

-L ".\cores\sameboy_libretro.dll" %romfile% --subsystem gb_link_2p "M:\Pokemon - Red Version (USA, Europe) (SGB Enhanced).gb" --appendconfig ".\Custom_Configs\LinkCableSaveStates\Pokemon_Linked_to_Red.cfg"

4. Launch the game and create a save state. The save state will be located in ...\RetroArch\states\LinkCableSaveStates\Pokemon_Linked_to_Red

5. I then import Pokemon Blue again like before, but this time I rename it to: "Pokemon Blue linked to Pokemon Gold"

6. For "Use Custom Command-line Parameters" I insert:

-L ".\cores\sameboy_libretro.dll" %romfile% --subsystem gb_link_2p "M:\Pokemon - Gold Version (USA, Europe) (SGB Enhanced) (GB Compatible).gbc" --appendconfig ".\Custom_Configs\LinkCableSaveStates\Pokemon_Linked_to_Gold.cfg"

7. I launch the game and create a save state. The save state will no be located in ...\RetroArch\states\LinkCableSaveStates\Pokemon_Linked_to_Gold

And so on.

This allows me to be able to create individual save states for each possible Pokemon-Link-Combination. There is no danger of accidentally overriding and corrupting a save state.

Note that this does not affect the single game save states, because those games are launched from a different platform in Launchbox (Nintendo Game Boy), which does not use Custom Command-line Parameters.

It does also not affect regular game saves, because they are handled perfectly fine by Sameboy no matter if a game is used in dual mode or single mode.

Still, if anyone has a better, less "hacky" solution, I'd be glad to implement it. The Pokemon - Red Version (USA, Europe) (SGB Enhanced) + Pokemon - Blue Version (USA, Europe) (SGB Enhanced).state option is right there. I'd just need to figure out a way to make RetroArch always create these custom state names.

Edited by SiriusVI
  • Game On 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...