Closed WarfarinBloodanger closed 4 months ago
Thank you so much for your detailed report! A bug fix will be delivered by Saturday! Since I am lacking of testing data so I had only tested the features with my own save file.
They should be fixed in 0b3d61f. However, as following what you said, I will test around with the new code before I publish the next version to NPM registry.
Since 1.0.8 was published to NPM, I'll close this issue. If the bug wasn't properly fixed, please reopen.
Hi there... Yet I don't have my own PC to make pull requests so I can just issue it here....
In your project I found some severe bugs that mess everything up, and I tried to fix them on my own.
1. Malformed Binary Data?
In the structure![图片](https://github.com/lamadaemon/phigros-save-manager/assets/85294649/a70680e7-2711-4a3a-9914-2bca282435ac)
LevelRecord
there is a field called unknown value. In binary data, it takes a byte in every pieces of records.Actually it matters. It represents the size of that piece of record. After reading all the necessary fields (e.g. score, accuracy), you are supposed to directly move the cursor to the next piece, skipping rest of bytes (I don't know why there they are , but they do exist. Maybe they represents the performance of Legacy chart or something).
But no skips are seen in![图片](https://github.com/lamadaemon/phigros-save-manager/assets/85294649/2fc088f7-aab3-4b1a-8c10-145024f345b6)
readFromDefinition
. Everything will be messed up since the program doesn't move the cursor to where it should be. To handle it, I made an if branch in the code that acts as what I mentioned above. The modified code looks like this:Similarly,![图片](https://github.com/lamadaemon/phigros-save-manager/assets/85294649/8191b9ca-4f15-4934-a87f-60ccbb939256)
writeFromDefiniton
should take this byte into consideration, too:By making it a fixed length with zero-padding, everything can be formed well. However I am not sure that whether discarding those rest-bytes is okay or not, for they may represent meaningful data or something, so before they are checked no final resolution should be made in my point of view.
2. Incorrect Results after Reading?
I found that performances of different levels in one song all come to the same... See my
readFromDefinition
. You should not directly assigndefinition.base
to the local variableobj
... Instead you can use{...definition.base}
to make clones, or they all refers to one particular object... That's why everything became same...3. Details That Cause Errors?
cli.ts
, functionallphi
, the full marks of Phigros should be 1000000 instead of 1e8.rere8
, you should callrere8()
instead ofpartialre8()
. Is it a mistake from Ctrl CV?I am not meaning to criticize anyone. I sincerely appreciate the repo owner who made save-managements available for us. I just want to suggest that code be tested before publishing them as a public repo.
Pardon my poor English expressions.