Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save data can get completely overridden if unserialization fails #3269

Open
EliteMasterEric opened this issue Oct 17, 2024 · 1 comment · May be fixed by #3270
Open

Save data can get completely overridden if unserialization fails #3269

EliteMasterEric opened this issue Oct 17, 2024 · 1 comment · May be fixed by #3270

Comments

@EliteMasterEric
Copy link
Contributor

try
{
final unserializer = new haxe.Unserializer(encodedData);
final resolver = { resolveEnum: Type.resolveEnum, resolveClass: SharedObject.__resolveClass };
unserializer.setResolver(cast resolver);
sharedObject.data = unserializer.unserialize();
}
catch (e:Dynamic) {}

Relevant issue: FunkinCrew/Funkin#3679

The v0.5.2 update for Funkin' introduced new properties to the user's save data. One of these properties was an Enum value, and as a result older versions of the game will fail to parse the save data.

In the case that save data fails to parse at this stage, sharedObject.data will remain null, and the game will act as though it is a fresh installation with no save data, and write to the save data file.

Without modifying this behavior, there is no chance for backup or recovery of the save data.

@EliteMasterEric
Copy link
Contributor Author

EliteMasterEric commented Oct 18, 2024

Looking at the code for FlxSave more, there is an FlxSaveStatus.ERROR but this is not used if there is an unserialization error.

EDIT: It also ignores the haxe.Unserializer.DEFAULT_RESOLVER! I was trying to override that to fix behavior myself but apparently that's not an option!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant