garcia / simfile

A modern simfile parsing & editing library for Python 3
MIT License
62 stars 7 forks source link

simfile.timing: BeatValues can't handle junk data #4

Open garcia opened 3 years ago

garcia commented 3 years ago

For example, OceanLab Megamix contains spurious control characters in some BPM values. StepMania appears to use the C++ function std::stof to parse each number, which stops when it reaches any character that can't be parsed into the number. The control characters only ever cut off zeros in the decimals, so there is no impact to gameplay in this case. As far as StepMania is concerned, there's nothing wrong with the file.

TimingData, on the other hand, throws an exception when presented with this simfile. This is because Python's Decimal class constructor expects the incoming string data to be clean. We should change our behavior to match StepMania to support this and similar files.

garcia commented 5 months ago

This should now be fixed on the v3 branch for non-strict-ly parsed simfiles: https://github.com/garcia/simfile/compare/7c8d8c87f4ff29a0fcfdcad9daf9df0f0f57dd4b..eb46093a389146dcdd7ebf61801a2aaff0a507a9