denpadokei / HttpSiraStatus

Live game status over web sockets.
MIT License
24 stars 3 forks source link

NaN present in JSON #38

Closed TakingFire closed 2 years ago

TakingFire commented 2 years ago

Current behavior

Some older beatmaps produce a message containing NaN in the Performance object. In this example, multiplierProgress:

{"status":{"performance":{"currentSongTime":10,"relativeScore":0.886956512928009,"multiplier":0,"combo":4,"maxCombo":4,"currentMaxScore":0,"lastNoteScore":0,"hitNotes":4,"missedNotes":0,"rank":"S","passedBombs":0,"softFailed":false,"rawScore":0,"batteryEnergy":null,"passedNotes":4,"score":0,"hitBombs":0,"multiplierProgress":NaN,"energy":0.539999961853027}},"time":1662254394851,"event":"scoreChanged"}

This is invalid JSON and can cause issues with parsing.

Expected behavior

NaN is replaced with null or 0 to keep the JSON valid.

Reproduction steps

  1. Start an old map (for example: https://beatsaver.com/maps/45)
  2. Catch any socket message containing the Performance object
  3. Attempt to parse JSON

Environment

BeatSaber version: 1.24.1 HTTP Status version: 8.0.2 Platform: SteamVR, Windows

denpadokei commented 2 years ago

Thank you for your report. Start investigating.

denpadokei commented 2 years ago

The problem did not reproduce. Could you upload the log when the phenomenon occurred? (InstDir)/Logs

TakingFire commented 2 years ago

On further testing, it only occurs when viewing Replays. I believe it may be old replays, rather than old levels. Here is the _latest.log, it contains the beginning of two songs that both cause the issue.

Here is also my replay file for https://beatsaver.com/maps/45, if it is useful: 76561198257862880-Give It Up-9BCFBD06C6CEAC3E4FF44093FBC33AB83587108B.zip

denpadokei commented 2 years ago

It seems to be by design that multiplierProgress returns incorrect values with old replay data. Make HTTPSiraStatus always return 0 instead of NaN.

Could you please test this DLL and confirm that 0 is returned? HttpSiraStatus-8.0.3-rc1-bs1.21.0-b844f89.zip

TakingFire commented 2 years ago

I still appear to be getting NaN for multiplierProgress. Demonstration video:

https://user-images.githubusercontent.com/38340654/188304737-69d63d9c-e3dd-4d5f-8be3-3b4ebb824117.mp4

denpadokei commented 2 years ago

HttpSiraStatus-8.0.3-rc2-bs1.21.0-074797c.zip Here is the output of the performance as a log. Could you upload the output log after playing the NaN replay here?

TakingFire commented 2 years ago

This version works perfectly, here's the log showing it is 0 now. I'm not sure why the other .dll didn't work.

Many of the replays were giving invalid JSON, so I'm glad to see it working properly now! It's somewhat strange that score and currentMaxScore are mostly 0, but it's likely just due to the outdated replay.

denpadokei commented 2 years ago

thank you for making sure I release this version.

Since the implementation of the replay function is a black box, it is difficult for me to deal with it any further. You'll probably need to contact the ScoreSaber team, but your proposal will probably be rejected because the results and effort you're getting aren't worth it.