[UX Improvement] Catch save loading errors and notify user #3979
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.
The aim of this PR is simple: prevent crashes from loading corrupted save files, gracefully prevent future load issues, and notify the user that something was wrong. This is accomplished by adding a new window,
SohModalWindow
, which is used to draw modal popups on demand with just a few inputs from code, but has options for customizing title, body, and button texts, adding a second button, and registering callbacks for each button. With certain flags, it's always centered in the window, isn't moveable, resizes itself, and has no scrollbars. This system is usable anywhere SohGui can be referenced (didn't know a better place to put the function to register a modal).In the case of save loading errors, it catches, renames the file to
filex.bak
, and then registers the popup.Two problems I can think this might have: first, as of now, it's only setup to handle static functions and I have no idea how to make it handle class-instance functions, or if that's even necessary.
Second is that, as it stands, it's only useable in C++, and I have no idea how to make the function callbacks useable in C. Theoretically, it could still be used just to print a message to the player with a C bridge function in OTRGlobals, but I don't know if that's necessary or a good idea either.
Build Artifacts