libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.38k stars 1.84k forks source link

Save state path changed in v1.18.0 #16430

Closed cmitu closed 7 months ago

cmitu commented 7 months ago

Description

Save states location has been changed after commit 338c9a4fe441899e98 (between 1.17.0 and 1.18.0). This affects configurations where saves state location has been configured as content dir, via savestates_in_content_dir = "true".

After the commit, the save state path is under a sub-folder named after the core name, instead of being the content dir itself. E.g with the 'NP2Kai' (PC98) core:

Obviously, upgrading with such a config breaks the existing save states, which is how I noticed the error, after my previous save states weren't found.

Steps to reproduce the bug

  1. Configure savestates_in_content_dir = "true" in retroarch.cfg
  2. Start a game/core
  3. Save the state and check where the .state file is saved - is not in the content dir.

Bisect Results

Bisected to 338c9a4fe441899e98c95ab082e18ddb5f931e49

Version/Commit

Error found in v1.18.0

Environment information

sonninnos commented 7 months ago

It is supposed to simply combine the path with the sorting option as expected, so isn't the correct approach to just disable the sorting to get the previous behavior with the "write to content dir" only?

Not causing minor reconfiguration needs is pretty much impossible with this addition. Since previously the content dir option ignored the sorting options, which are enabled by default, but the content dir is not.

cmitu commented 7 months ago

I don't know what 'sorting' is supposed to do - I've just read what's supposed to do in https://github.com/libretro/RetroArch/pull/16369 but and I see that the change may be intentional. FWIW I don't have any sorting options explicitely set.

I see it's specified in the PR:

If "put X in content directory" is set, replace that with the content base dir If "sort X into folders by core name" is set, append core-name directory If "sort X into folders by content directory" is set, append content directory

So based on what it says there, I'd expect that the 1st option (which is set in my config) to be used. It was used with 1.17.0, but suddenly in 1.18.0 with the same configuration I can't load my previous saves. Is this supposed to happen ?

FWIW the example given in the PR is a bit forced, I think most users organize their ROMs/games by system/platform (e.g. roms/snes, roms/amiga, etc.), but that's beside the point.

sonninnos commented 7 months ago

Sure if the "sort by core name" option is not enabled and it still adds that path, then there is a bug, otherwise it is as intended and desired. I haven't tested this addition yet.

cmitu commented 7 months ago

The issue is the defaults for the sort saves/states is true (here).

After the change, the 'sorting' happens automatically, whereas before the change it was not (i.e. the content dir was treated specially and there was no subsequent sorting happening). The result is a missing state (or save) file.

EDIT: can confirm that after setting the sorting vars to false (sort_savestates_enable/ sort_savefiles_enable) I can load the previous state file.

cmitu commented 7 months ago

OK, I'll close this issue since it's clearly working as designed. It just the design changed with the above mentioned commit - the impact is for configuration with savestates_in_content_dir and savefiles_in_content_dir options toggled on (which is not the default).

@sonninnos thank you for the reply.