fs2open.github.com icon indicating copy to clipboard operation
fs2open.github.com copied to clipboard

Ingame options respect mods

Open MjnMixael opened this issue 2 years ago • 6 comments

This PR fixes #5697 by changing how in-game settings are saved and loaded. The key thing Wookie and I wanted here was to have these settings saved in a way that's specific to each mod but agnostic of mod versions (as far as Knossos/Nebula goes). The challenge there is that different mod versions are entirely unique mods to FSO even though Knossos knows better.

The solution this PR offers is a new ini file saved to %appdata/HardLightProductions\FreeSpaceOpen\data. This file is titled based on the Cmdline_mod parameter (retail_fs2_settings.ini if it's nullptr) by trimming a mod folder's version data off of it. For example, MPVS-4.7.2 becomes MVPS_settings.ini and will work for all version of the MediaVPs.

There's almost certainly room for improvement here but this needs to be solved sooner rather than later and a PR will get the discussion really going.

MjnMixael avatar Jan 03 '24 22:01 MjnMixael

And then I hit the approve button by accident.

JohnAFernandez avatar Feb 05 '24 23:02 JohnAFernandez

AFAICT, this is really well done. It is really hard to visualize string manipulation (at least for me, so I think I would like to know what kind of test cases you guys tried before I approve, in case I (or someone else) can think of some others that we can try.

Good question. I tried the following:

STRING-#.#.# (and multiple variations of number digits such as STRING-##.###.####) STRING-STRING-#.#.# -STRING-#.#.# STRING-#.#.#-STRING STRING-STRING-#.#.# STRING#.#.# STRING #.#.#

To make things easy for other people to test ideas I didn't think of I put the code in an online snippet. This runs the function unchanged from this PR on whatever the INPUT variable at the top of the code is set to. Feel free to run some other tests or list strings I didn't think to and I'll test them. https://onlinegdb.com/62TEvLJso

MjnMixael avatar Feb 06 '24 03:02 MjnMixael

Sorry for the slow reply, I'm always missing updates on github.

I managed to get this result just by playing around with some semi-nonsense semver strings:

Screenshot 2024-02-10 172250

What do you think, as intended?

FWIW, I think your test cases will handle the vast majority of cases, and something like this will probably never be chosen.

JohnAFernandez avatar Feb 10 '24 22:02 JohnAFernandez

Sorry for the slow reply, I'm always missing updates on github.

I managed to get this result just by playing around with some semi-nonsense semver strings:

Screenshot 2024-02-10 172250

What do you think, as intended?

FWIW, I think your test cases will handle the vast majority of cases, and something like this will probably never be chosen.

I tend to agree and even in the case of the -semver-string.semver it fellback gracefully to fs2_open.ini which is good. That's what I wanted; anything weird happens? Use fs2_open.ini.

MjnMixael avatar Feb 12 '24 01:02 MjnMixael

This needs an xstr update before merge. Just because of xstr madness, I'd really like #5927 and #5924 merged before this PR gets merged.

MjnMixael avatar Feb 27 '24 18:02 MjnMixael

XSTR has been handled. This is good to merge.

MjnMixael avatar Mar 25 '24 13:03 MjnMixael

Bit more discussion incoming from Discord so will hold off on merging at this moment, but ideally can get all questions answered soon.

wookieejedi avatar Mar 25 '24 15:03 wookieejedi