1
0
mirror of synced 2025-02-26 06:48:20 +01:00

Add support for IFS external reference

This commit is contained in:
ishmael573 2022-09-24 14:04:52 +00:00
parent aaa6e5231f
commit bb11f32bf5

View File

@ -2113,6 +2113,15 @@ class ImportIIDX(ImportBase):
continue continue
if sound_files is not None: if sound_files is not None:
def load_ifs(fname: str) -> Optional[IFS]:
fname = os.path.join(os.path.abspath(assets_dir), fname)
fp = open(fname, "rb")
data = fp.read()
fp.close()
return IFS(data, reference_loader=load_ifs)
if song.id in sound_files: if song.id in sound_files:
# Look up chart info! # Look up chart info!
filename = sound_files[song.id] filename = sound_files[song.id]
@ -2124,10 +2133,7 @@ class ImportIIDX(ImportBase):
data = fp.read() data = fp.read()
fp.close() fp.close()
else: else:
fp = open(filename, "rb") ifs = load_ifs(filename)
ifsdata = fp.read()
fp.close()
ifs = IFS(ifsdata)
for fn in ifs.filenames: for fn in ifs.filenames:
_, extension = os.path.splitext(fn) _, extension = os.path.splitext(fn)
if extension == ".1": if extension == ".1":