Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion base/extract_rom.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ def _extract_data_recursive(folder: fnt.Folder, output_dir: Path) -> None:
for child_file in folder.files:
out_file = output_dir / child_file
out_file.parent.mkdir(exist_ok=True, parents=True)
out_file.write_bytes(rom.files[folder.idOf(child_file)])
file_id = folder.idOf(child_file)
if file_id is None:
raise Exception(f'ID of file {child_file} not found')
out_file.write_bytes(rom.files[file_id])
for child_folder_name, child_folder in folder.folders:
_extract_data_recursive(child_folder, output_dir / child_folder_name)

Expand Down
4 changes: 2 additions & 2 deletions base/rebuild_rom.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def reinsert_overlays(rom: NintendoDSRom, overlay_directory: Path) -> None:
# we'll handle adding the new overlay after this loop
continue

ot[overlay_number].data = overlay_file.read_bytes()
ot[overlay_number].data = bytearray(overlay_file.read_bytes())
rom.files[ot[overlay_number].fileID] = ot[overlay_number].save(compress=False)
print(f'Rebuilt overlay_{str(overlay_number).rjust(4, "0")}.bin')

Expand All @@ -100,7 +100,7 @@ def reinsert_overlays(rom: NintendoDSRom, overlay_directory: Path) -> None:
flags=0,
)
ot[new_overlay_number] = new_overlay
rom.files.append(None)
rom.files.append(None) # type: ignore
rom.files[new_overlay_file_id] = new_overlay.save(compress=False)
print(
f'Added new overlay_{str(new_overlay_number).rjust(4, "0")}.bin '
Expand Down
4 changes: 2 additions & 2 deletions base/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
click==8.1.3
ndspy==4.1.0
ndspy @ git+https://github.com/mike8699/ndspy.git@9d80480e8a3d65a389aac6f5d10978bd9113c977
Pillow==10.3.0
zed @ git+https://github.com/phst-randomizer/zed.git@5ee969236bf3c3d0707da963e5edc818ddf246d3
zed @ git+https://github.com/phst-randomizer/zed.git@e59a9653ea1344cbc147bab446821813200b9d19
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ dependencies = [
"PySide6==6.6.1",
"click==8.1.3",
"inflection==0.5.1",
"ndspy==4.1.0",
"ndspy@git+https://github.com/mike8699/ndspy.git@9d80480e8a3d65a389aac6f5d10978bd9113c977",
"ordered-set==4.1.0",
"pydantic==2.4.2",
"pyparsing==3.1.1",
"vidua==0.4.5",
"zed@git+https://github.com/phst-randomizer/zed.git@5ee969236bf3c3d0707da963e5edc818ddf246d3",
"zed@git+https://github.com/phst-randomizer/zed.git@e59a9653ea1344cbc147bab446821813200b9d19",
]

[project.optional-dependencies]
Expand Down
5 changes: 4 additions & 1 deletion scripts/dump_zmb.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
output_dir = Path.cwd() / 'zmbs'
output_dir.mkdir(exist_ok=True)

for folder in tqdm(rom.filenames.subfolder('Map').folders):
map_subfolder = rom.filenames.subfolder('Map')
assert map_subfolder is not None

for folder in tqdm(map_subfolder.folders):
folder_name = folder[0]
file_path = f'Map/{folder_name}'
for subfolder in folder:
Expand Down