1
0
mirror of synced 2024-09-24 03:18:22 +02:00

Fix possible crash in older Fantasia data, formatting fixes.

This commit is contained in:
Jennifer Taylor 2023-07-29 16:11:42 +00:00
parent 097078288d
commit b9ca730dca
2 changed files with 9 additions and 2 deletions

View File

@ -479,7 +479,12 @@ class PopnMusicFantasia(PopnMusicBase):
self.GAME_CHART_TYPE_NORMAL: self.CHART_TYPE_NORMAL,
self.GAME_CHART_TYPE_HYPER: self.CHART_TYPE_HYPER,
self.GAME_CHART_TYPE_EX: self.CHART_TYPE_EX,
}[node.child_value("sheet")]
}.get(node.child_value("sheet"))
if chart is None:
# Some old versions of Fantasia still send empty chart data for Tune Street
# charts that don't exist in the game. Ignore these or we end up crashing on
# profile save.
continue
medal = (node.child_value("n_data") >> (chart * 4)) & 0x000F
medal = {
self.GAME_PLAY_MEDAL_CIRCLE_FAILED: self.PLAY_MEDAL_CIRCLE_FAILED,

View File

@ -1134,7 +1134,9 @@ class TXP2File(TrackedCoverage, VerboseOutput):
if feature_mask & 0xFFF00000:
# We don't know these bits at all!
raise Exception(f"Invalid bits set in feature mask {hex(feature_mask & 0xFFF80000)}!")
raise Exception(
f"Invalid bits set in feature mask {hex(feature_mask & 0xFFF80000)}!"
)
if header_offset != header_length:
raise Exception("Failed to parse bitfield of header correctly!")