1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-04 06:54:33 +00:00

Syms DMA Entries Extraction Support (#1708)

* Archive compression support + small cleanups

* UNSET spec and PR comment

* UNSET -> SYMS

* Syms comment

* PR review

* remove stderr

* Format

* format2

* Remove trailing ,s
This commit is contained in:
Derek Hensley 2024-02-12 17:10:20 -08:00 committed by GitHub
parent 6c405b6ea3
commit 0ac4448d99
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 35 additions and 14 deletions

View file

@ -8,7 +8,6 @@ from __future__ import annotations
import argparse
from pathlib import Path
import dataclasses
import struct
import time
import multiprocessing
import multiprocessing.pool
@ -28,6 +27,7 @@ class RomSegment:
vrom_start: int
vrom_end: int
is_compressed: bool
is_syms: bool
data: memoryview | None
data_async: multiprocessing.pool.AsyncResult | None
@ -92,6 +92,7 @@ def compress_rom(
dma_entry.vrom_start,
dma_entry.vrom_end,
is_compressed,
dma_entry.is_syms(),
segment_data,
segment_data_async,
)
@ -167,17 +168,23 @@ def compress_rom(
assert i <= len(compressed_rom_data)
compressed_rom_data[segment_rom_start:i] = segment.data
rom_offset = segment_rom_end
if segment.is_syms:
segment_rom_start = 0xFFFFFFFF
segment_rom_end = 0xFFFFFFFF
elif not segment.is_compressed:
segment_rom_end = 0
compressed_rom_dma_entries.append(
dmadata.DmaEntry(
segment.vrom_start,
segment.vrom_end,
segment_rom_start,
segment_rom_end if segment.is_compressed else 0,
segment_rom_end,
)
)
rom_offset = segment_rom_end
assert rom_offset == compressed_rom_size
# Pad the compressed rom with the pattern matching the baseroms
for i in range(compressed_rom_size, compressed_rom_size_padded):