Only write config files to disk when parameters change #10524
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
At present, RetroArch continuously overwrites its configuration files:
retroarch.cfg
is written every time content is closed, and when closing RetroArch itselfCore options are written every time content is closed
This represents a large amount of unnecessary disk access, which is quite slow (and also causes wear on solid state drives!)
With this PR, configuration files are only written to disk when the content actually changes.
All types of configuration file should now be 'well behaved' - with the exception of cheat files. These are still overwritten when closing content, since reusing old parameters may cause issues (and since I don't use cheats at all, I didn't feel confident enough to dabble with this)
While making these changes, I discovered and fixed a number of bugs:
RetroArch no longer crashes when attempting to save a config file after 'unsetting' a parameter (currently, this can be triggered quite easily by manipulating input remaps)
When using Material UI, RetroArch no longer modifies the wrong setting (or segfaults...) when tapping entries in the Quick Menu > Controls input remapping submenu
Quite a few real and potential memory leaks have been fixed.