forked from Hay1tsme/artemis
mai2: add patch reader
This commit is contained in:
parent
8b9771b5af
commit
cad523dfce
@ -73,6 +73,13 @@ class Mai2Reader(BaseReader):
|
|||||||
|
|
||||||
self.read_old_events(evt_table)
|
self.read_old_events(evt_table)
|
||||||
|
|
||||||
|
if self.opt_dir is not None:
|
||||||
|
evt_table = self.load_table_raw(f"{self.opt_dir}/tables", "mmEvent.bin", key)
|
||||||
|
txt_table = self.load_table_raw(f"{self.opt_dir}/tables", "mmtextout_jp.bin", key)
|
||||||
|
score_table = self.load_table_raw(f"{self.opt_dir}/tables", "mmScore.bin", key)
|
||||||
|
|
||||||
|
self.read_old_events(evt_table)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def load_table_raw(self, dir: str, file: str, key: Optional[bytes]) -> Optional[List[Dict[str, str]]]:
|
def load_table_raw(self, dir: str, file: str, key: Optional[bytes]) -> Optional[List[Dict[str, str]]]:
|
||||||
@ -95,7 +102,7 @@ class Mai2Reader(BaseReader):
|
|||||||
self.logger.warn(f"file {dir} could not be read, skipping")
|
self.logger.warn(f"file {dir} could not be read, skipping")
|
||||||
return
|
return
|
||||||
|
|
||||||
f_data_deflate = zlib.decompress(f_data, wbits = zlib.MAX_WBITS | 16)
|
f_data_deflate = zlib.decompress(f_data, wbits = zlib.MAX_WBITS | 16)[0x12:] # lop off the junk at the beginning
|
||||||
f_decoded = codecs.utf_16_le_decode(f_data_deflate)[0]
|
f_decoded = codecs.utf_16_le_decode(f_data_deflate)[0]
|
||||||
f_split = f_decoded.splitlines()
|
f_split = f_decoded.splitlines()
|
||||||
|
|
||||||
@ -313,7 +320,10 @@ class Mai2Reader(BaseReader):
|
|||||||
)
|
)
|
||||||
self.logger.info(f"Added ticket {id}...")
|
self.logger.info(f"Added ticket {id}...")
|
||||||
|
|
||||||
def read_old_events(self, events: List[Dict[str, str]]) -> None:
|
def read_old_events(self, events: Optional[List[Dict[str, str]]]) -> None:
|
||||||
|
if events is None:
|
||||||
|
return
|
||||||
|
|
||||||
for event in events:
|
for event in events:
|
||||||
evt_id = int(event.get('イベントID', '0'))
|
evt_id = int(event.get('イベントID', '0'))
|
||||||
evt_expire_time = float(event.get('オフ時強制時期', '0.0'))
|
evt_expire_time = float(event.get('オフ時強制時期', '0.0'))
|
||||||
@ -325,3 +335,8 @@ class Mai2Reader(BaseReader):
|
|||||||
|
|
||||||
if not (is_exp or is_aou):
|
if not (is_exp or is_aou):
|
||||||
self.data.static.toggle_game_event(self.version, evt_id, False)
|
self.data.static.toggle_game_event(self.version, evt_id, False)
|
||||||
|
|
||||||
|
def read_old_music(self, scores: Optional[List[Dict[str, str]]], text: Optional[List[Dict[str, str]]]) -> None:
|
||||||
|
if scores is None or text is None:
|
||||||
|
return
|
||||||
|
# TODO
|
||||||
|
Loading…
Reference in New Issue
Block a user