Metalit / PlayerDataKeeper

7 stars 8 forks source link

Data keeps being replaced #6

Closed maksym456 closed 1 year ago

maksym456 commented 1 year ago

Data keeps being replaced and not overwritten - I can't make any progress, it just returns to the data that's in the folder everytime i boot up the game

L3Home commented 1 year ago

I have the same issue. I am using the core mod for BS version 1.25.1.

After some investigation I have found that the datakeeper mod's PlayerData.dat file (as stored in its own data folder) is definitely behind the PlayerData.dat file that is in the BMBF folder.

Comparing them, the first thing that stood out was the "version" value; BMBF's file shows 2.0.22 while datakeeper's file shows 2.0.20. I wasn't convinced that the version value meant any difference in the actual data, so looked further.

The player stats (total time played, total score, etc.) do match between the two files; so it's evident that datakeeper is paying attention and writing to its own file, and tracking at least some of the data correctly.

But I located the hash for one of the songs I just beat my last high score and rank in last night. I then searched the two PlayerData.dat files for that hash to see if it reported the same data. It does not. The exact same song, and the exact same difficulty value, is misreported by datakeeper with the information it had prior to last night. It shows my maxrank as 5, and the BMBF file shows a maxrank of 6.

The reason I began investigating this problem is that I've begun to notice that I'll get a new high score and then it goes missing the next time I launch the game. It shows the correct score while I'm in the same session, but any time the game either crashes OR I close it normally, on the next launch those scores are all gone. Also, I've since noticed that songs I haven't played before (as I often search with that filter), once played and I've set a score on, will disappear from the search list (as they should), but the next time I play, they are back -- with no scores set for any difficulty level.

It seems this mod might copy its version of the file over BMBF's on launch? Or else it simply replaces the values within the session memory? I'm hopeful that the actual scores have been saved in BMBF's file in the background so that disabling this mod might restore the scores that I haven't been seeing -- and not just the ones from last night.

L3Home commented 1 year ago

After posting, I just realized that there isn't a way to disable a core mod. (facepalm)

I'm considering making a backup of the mod's PlayerData file and then replacing it with the one from the BMBF folder. Even if I have to do that each night or periodically when I want to see my latest scores, that would be preferable to "losing" them.

L3Home commented 1 year ago

As I was going into the folder to see about replacing the file, I noticed a .tmp file for the PlayerData. I opened it and compared the data, and discovered that it matches the most recent data!

Perhaps the app crashed and saved a temp file but never compared and replaced the main one with that temp data? This is quite bizarre.

I hope this information helps! I'm going to back up the .dat file in there and then replace it with a copy of the .dat.tmp file.

L3Home commented 1 year ago

Just an update after additional playing and observation...

Scores continue to fail to save. This issue affects the Solo gameplay as well as Local Leaderboard scores (in Party mode). Also, Campaign progress is not retained.

The PlayerData.dat file in datakeeper's folder hasn't updated since I upgraded to Beat Saber 1.25.1 from 1.24. BMBF made a backup of the file (to its own folder) when I upgraded, but since then, while the .dat.tmp version of the file does update as I play, when the game closes, it does not copy the contents of that file over the top of the .dat file (as I believe it likely did in the prior mod version). When the game is relaunched, I suspect that the old .dat file (which normally would contain that copied, most recent data) is copied to the working .tmp file, which is again used to save new scores, and then wiped again the next time the game is closed and relaunched.

I'm guessing that this will continue to be an issue until the 1.25 mod is fixed, so I may end up reverting to 1.24 until then. That, or manually copying the .tmp file over the .dat. We'll see if that's viable.

L3Home commented 1 year ago

Something strange I discovered in the main BS game folder. Most mods create a Log file. Datakeeper isn't doing so (I keyword searched the global log as well). Maybe it isn't supposed to, but I thought I'd mention it!

L3Home commented 1 year ago

I am able to save scores again. I "fixed" the issue by essentially disabling the mod's behavior. Out of desperation, I copied all of the files in the mod's data file folder (just to back it up) and then deleted all of them. Since then, the mod still creates a .tmp file while the game is active, then deletes it when the game is closed; but otherwise, it seems to perform no other actual function, and does not replace the game's working PlayerData file any more. It seems that since it hadn't been updating that file anyway, now that it's missing, there's no file for it to use, and thus no damage occurs.

Hopefully, until the issue is resolved, this may help someone in the meantime.

Metalit commented 1 year ago

As mentioned in #7 it's fixed for 1.27