exch-bms2 / beatoraja

Cross-platform rhythm game based on Java and libGDX.
GNU General Public License v3.0
639 stars 148 forks source link

beatoraja crash when scrolling over song with no #BPM field #343

Closed wcko87 closed 6 years ago

wcko87 commented 6 years ago

If a bms has no #BPM field, scrolling over the song in music select will crash beatoraja.

This crash happens with a PMS chart in GENOSIDE 2018 (DataErr0r, 9KEY Hyper) dataerr0r_9h_pms.zip

If you add #BPM 180 to the file, beatoraja will not crash.

Crash video: VIDEO

SEVERE: BMS Search??????:Field not found: id (bms.player.beatoraja.external.BMSSearchAccessor$Fumen)
Serialization trace:
[][0].fumen[0].id
fumen (bms.player.beatoraja.external.BMSSearchAccessor$BMSSearchElement)
Exception in thread "LWJGL Application" java.lang.NegativeArraySizeException
        at bms.player.beatoraja.skin.SkinNoteDistributionGraph.updateGraph(Unknown Source)
        at bms.player.beatoraja.skin.SkinNoteDistributionGraph.draw(Unknown Source)
        at bms.player.beatoraja.skin.SkinNoteDistributionGraph.draw(Unknown Source)
        at bms.player.beatoraja.skin.Skin.drawAllObjects(Unknown Source)
        at bms.player.beatoraja.MainController.render(Unknown Source)
        at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:225)
        at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126)
exch-bms2 commented 6 years ago

This PMS chart lacks BPM definition in the section 000-007. Maybe some BMS players also crash when parsing it.,so that I think beatoraja needs to reject such a illegal chart. What do you think?

wcko87 commented 6 years ago

Yes I think beatoraja should ignore invalid charts like this, or display an error message that the chart is invalid and cannot be played. Crashing suddenly is confusing to the user.

The same exception also occurs when the song pack is added in the config menu.

wcko87 commented 6 years ago

It seems like according to the (very old) bms spec, default bpm is 130 if not specified. http://bm98.yaneu.com/bm98/bmsformat.html

I think LR2 uses the first bpm change if no bpm is specified.

exch-bms2 commented 6 years ago

fixed on 0.6.1. (ingores start bpm = 0 chart)