Skip to content

Exceptions raised while parsing malformed notedata that StepMania handles fine #49

@som1sezhi

Description

@som1sezhi

There are a few instances of malformed #NOTES data out in the wild that StepMania accepts, but simfile will error out on:

  • Some simfiles' notedata contains invalid notetypes. For example, the dance-routine chart for Cringle Desolation/Think About You contains a Y note that simfile raises an exception on:
    Traceback (most recent call last):
      (...)
      File "/app/itgdb_site/utils/analysis/analyzer.py", line 240, in last_note_beat
        for last_note in self.notes:
      File "/.venv/lib/python3.10/site-packages/simfile/notes/__init__.py", line 286, in __iter__
        yield from self._iter_measure(p, m, measure.strip())
      File "/.venv/lib/python3.10/site-packages/simfile/notes/__init__.py", line 268, in _iter_measure
        note_type=NoteType(column),
      File "/usr/local/lib/python3.10/enum.py", line 385, in __call__
        return cls.__new__(cls, value)
      File "/usr/local/lib/python3.10/enum.py", line 710, in __new__
        raise ve_exc
    ValueError: 'Y' is not a valid NoteType
    
    StepMania handles this by just ignoring the note.
  • A notedata row can have a different number of columns than expected. For example, Aoreo hates oreos/You Goddamn Fish has a row of length 7 (0000738) at the beginning of the chart:
    ...
    #NOTES:
         dance-single:
         J. Nero:
         Challenge:
         12:
         1.000,1.000,0.191,1.000,0.402:
    0000738
    0000
    0000
    0000
    ,
    ...
    
    StepMania handles this by exiting the loop early once the number of columns read equals the number of expected columns; see the iTrack < iNumTracks condition on this line. When simfile processes this file, it tries to yield the 7 note and errors out in the same way as above, but it probably shouldn't be trying to emit this note in the first place given that it's on an invalid column.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions