diff --git a/bemani/utils/read.py b/bemani/utils/read.py index 55cb24b..0fd2925 100644 --- a/bemani/utils/read.py +++ b/bemani/utils/read.py @@ -416,7 +416,7 @@ class ImportPopn(ImportBase): self.charts = [0, 1, 2, 3] else: raise Exception( - "Unsupported Pop'n Music version, expected one of the following: 19, 20, 21, 22, 23, 24, 25, 26!" + "Unsupported Pop'n Music version, expected one of the following: 19, 20, 21, 22, 23, 24, omni-24, 25, omni-25, 26, omni-26!" ) super().__init__( @@ -2566,6 +2566,67 @@ class ImportIIDX(ImportBase): self.finish_batch() +class DDRScrapeConfiguration: + def __init__( + self, + *, + version: str, + offset: int, + size: int, + length: int, + unpackfmt: str, + id_offset: int, + edit_offset: int, + bpm_min_offset: int, + bpm_max_offset: int, + folder_offset: int, + single_difficulties: int, + double_difficulties: int, + groove_single_beginner: int, + groove_single_basic: int, + groove_single_difficult: int, + groove_single_expert: int, + groove_single_challenge: int, + groove_double_basic: int, + groove_double_difficult: int, + groove_double_expert: int, + groove_double_challenge: int, + voltage: int, + stream: int, + air: int, + chaos: int, + freeze: int, + folder_start: int, + ) -> None: + self.version = version + self.offset = offset + self.size = size + self.length = length + self.unpackfmt = unpackfmt + self.id_offset = id_offset + self.edit_offset = edit_offset + self.bpm_min_offset = bpm_min_offset + self.bpm_max_offset = bpm_max_offset + self.folder_offset = folder_offset + self.single_difficulties = single_difficulties + self.double_difficulties = double_difficulties + self.groove_single_beginner = groove_single_beginner + self.groove_single_basic = groove_single_basic + self.groove_single_difficult = groove_single_difficult + self.groove_single_expert = groove_single_expert + self.groove_single_challenge = groove_single_challenge + self.groove_double_basic = groove_double_basic + self.groove_double_difficult = groove_double_difficult + self.groove_double_expert = groove_double_expert + self.groove_double_challenge = groove_double_challenge + self.voltage = voltage + self.stream = stream + self.air = air + self.chaos = chaos + self.freeze = freeze + self.folder_start = folder_start + + class ImportDDR(ImportBase): def __init__( self, @@ -2595,312 +2656,423 @@ class ImportDDR(ImportBase): data = myfile.read() myfile.close() + def add_skew(unpackfmt: str, size: int, skew: int) -> str: + # Skew is because I'm too lazy to count the Hs in the format, so just + # pad it for ease of construction here. + return unpackfmt + ("x" * (size - len(unpackfmt) - skew)) + + configurations: List[DDRScrapeConfiguration] = [] if self.version == VersionConstants.DDR_X2: # Based on JDX:J:A:A:2010111000 - offset = 0x254FC0 - size = 0x14C - length = 894 - # Basic stuff like ID, bpm, chart difficulties - unpackfmt = " List[Dict[str, Any]]: tree = ET.parse(infile)