libretro / libretro/RetroArch

Issue with RetroArch handling save files / save states for compressed games when launched via command line / external launcher

Open
#15,960 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
14.1k
Forks
2.2k
Avg merge
7h 35m
Merged PRs (30d)
51

Description

Issue

If RetroArch is launched via command line or external launcher, save files / save states that were created in RetroArch when RetroArch is launched directly are not recognized if the game files are compressed (i.e. zip, 7z, etc.). Additionally, save files / states created while running RA launched via command line are recognized only when running via command line and not by RetroArch when launched directly.

Findings

This may be due to the way RA handles compressed folders. When RA is launched directly, it appears to unzip the contents of the game before launching the game and then rezipping them afterwards. When launched via command line, it behaves differently. Below is a direct example.

Example

You have a legal backup of Fire Emblem for Game Boy Advance (GBA) in a folder called Fire Emblem (GBA).zip and inside that folder is a file called Fire Emblem (USA).gba. When launching RetroArch directly it will create save files with the string Fire Emblem (USA).srm (if save file compression is enabled in RA) and Fire Emblem (USA).sav because that is the file name of the .gba file. If you launch the game through command line however, it will create save files with the string Fire Emblem (GBA).srm and Fire Emblem (GBA).sav because that is the file name of the .zip folder that the .gba file is inside of. The same thing occurs with save states using the extension .state.

Workaround

This can be resolved by simply naming the rom itself with the exact same file name as the zip folder it is saved in (i.e. Fire Emblem (GBA).gba saved inside a zip folder called Fire Emblem (GBA).zip) as the difference in naming is what causes the underlying issue. Else, you could simply unzip all of your roms, however you lose compression and thus increase the overall file size of your library.

Alternatively, there may be an argument that fixes this discrepancy, however after researching applicable command line arguments, this doesn't appear to be an option. I have just gone through and put all the names in parity with their respective compressed formats, but this is extremely time consuming and not at all ideal.

Steps to reproduce the bug
  1. Launch a compressed rom via RetroArch directly.
  2. Create a sav game (.sav/.srm) and/or a save state (.state).
  3. Exit RA and relaunch RA using command line.
  4. The saves and save states will be missing.
  5. While in the command line launched RA instance, create a save / save state.
  6. Relaunch RA directly, the saves created when launching RA via command line will not appear, but the originals you created will.

NOTE: To solve this, you MUST name the compressed folder and the files within with the same string (i.e. Game Name (GBA).zip containing Game Name (GBA).gba). If the name of the compressed folder and the rom inside do not match, then when run via command line, RA will create saves and save states with the name of the internal file and not the compressed folder, and vice versa for launching RA directly.

Bisect Results

See above.

Version/Commit

RetroArch: Version 1.15.0, however the same issue occurs with older versions and nightly builds.

Environment information

OS: Windows 10 / Windows 11

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue using a compressed ROM with different archive and internal filenames, launching it first directly and then through the command-line or external-launcher entry point. Trace how each launch mode derives save-file and save-state names. Done means both launch paths recognize the same saves and states without requiring matching filenames or uncompressed ROMs.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.