1
0
mirror of synced 2025-01-24 15:12:19 +01:00

utils.py: Pin down "Difficulty" header bytes

This commit is contained in:
Viv 2023-06-02 16:33:47 -04:00
parent aadbb3f8ba
commit 60fb3215d7

View File

@ -52,15 +52,15 @@ def validateHeaderMetadata(headerBytes):
elif idx == 5: elif idx == 5:
assert val == 39, f"Expected 39 at position '{idx}', got '{val}' instead." assert val == 39, f"Expected 39 at position '{idx}', got '{val}' instead."
# 2. TODO # 2. Difficulty
# Notes: # Notes:
# * Breakdown of distribution of different byte combinations: # * Breakdown of distribution of different byte combinations:
# - 3611/7482 charts: [88, 27] # - 1805/7482 charts: [112, 23] (Easy)
# - 2016/7482 charts: [64, 31] # - 3611/7482 charts: [88, 27] (Normal, Hard)
# - 1805/7482 charts: [112, 23] # - 2016/7482 charts: [64, 31] (Oni, Ura)
# * In other words, there are only three different byte-pairs across all valid fumens. # * In other words, all 5 difficulties map to only three different byte-pairs across all valid fumens.
elif idx == 8: elif idx == 8:
assert val in [88, 64, 27], f"Expected 88/64/112 at position '{idx}', got '{val}' instead." assert val in [88, 64, 112], f"Expected 88/64/112 at position '{idx}', got '{val}' instead."
elif idx == 9: elif idx == 9:
assert val in [27, 31, 23], f"Expected 27/31/23 at position '{idx}', got '{val}' instead." assert val in [27, 31, 23], f"Expected 27/31/23 at position '{idx}', got '{val}' instead."
@ -157,18 +157,18 @@ def validateHeaderMetadata(headerBytes):
elif idx == 72: elif idx == 72:
assert val in [20, 0], f"Expected 20/0 at position '{idx}', got '{val}' instead." assert val in [20, 0], f"Expected 20/0 at position '{idx}', got '{val}' instead."
# 10. TODO # 10. Difficulty (Gen2) and ???? (Gen3)
# Notes: # Notes:
# * In Gen2 charts (AC, Wii), these values would be evenly distributed between 4 different byte combinations. # * In Gen2 charts (AC, Wii), these values would be one of 4 different byte combinations.
# * These values correspond to the difficulty of the song (no Uras in Gen2, hence 4 values): # * These values correspond to the difficulty of the song (no Uras in Gen2, hence 4 values):
# - (288, 193, 44) # - [192, 42, 12] (Easy)
# - (192, 42, 12) # - [92, 205, 23] (Normal)
# - (92, 205, 23) # - [8, 206, 31] (Hard)
# - (8, 206, 31) # - [288, 193, 44] (Oni)
# * However, starting in Gen3 (AC, console), these bytes were given unique per-song values. # * However, starting in Gen3 (AC, console), these bytes were given unique per-song, per-chart values.
# - In total, Gen3 contains 6449 unique combinations of bytes. # - In total, Gen3 contains 6449 unique combinations of bytes (with some minor overlaps between games).
# For TJA conversion, I am not sure whether to try and figure out the Gen3 scheme for these bytes (difficult!), # For TJA conversion, I plan to just stick with the Gen2 scheme (and make up the missing value for Uras),
# or to just stick with the Gen2 scheme (and make up the missing value for Uras), which would be much easier. # which would be much easier than trying to figure out the Gen3 scheme.
elif idx in [76, 77, 78]: elif idx in [76, 77, 78]:
pass pass