Metalit / PlayerDataKeeper

7 stars 8 forks source link

Mod erases local score files #3

Closed bodograumann closed 2 years ago

bodograumann commented 2 years ago

My local scores where getting lost. I had to search for quite a while to find the root cause of this issue. To reproduce:

Workaround: Manually delete LocalLeaderboards.dat and LocalDailyLeaderboards.dat from the backup location.

I think simply not copying all the files when initially creating the backup folder in setup(), would prevent the issue from occuring. Though backing up the scores correctly was probably intended and a more involved fix is needed.

This is with game version 1.24.0

Metalit commented 2 years ago

Thanks for investigating this. Are you sure that the hook isn't run for the leaderboard files? There isn't any filtering code, it should copy over any json file saved to the game's data location.

Metalit commented 2 years ago

However you are right that copying over all the files immediately isn't actually necessary and I can probably replace that with only creating the parent directory and letting files get saved with updates. The only potential issue is that some files may not be kept if the game isn't played much but that seems to be smaller than the number of cases where restored manual files are being overwritten with blanks due to ordering issues

bodograumann commented 2 years ago

Pretty sure about what I found. Tested multiple times and even after removing the empty backed up files, they are not saved via the hook. Maybe for those files a new method is used in 1.24 instead of SaveToJSONFile. Not sure how to tell though.

Metalit commented 2 years ago

You're right, it uses a different method to save the JSON for some reason. I'll add a hook to catch them as well