summaryrefslogtreecommitdiff
path: root/tools/compress.py
diff options
context:
space:
mode:
authorDerek Hensley <hensley.derek58@gmail.com>2024-02-12 17:10:20 -0800
committerGitHub <noreply@github.com>2024-02-12 20:10:20 -0500
commit0ac4448d99d2598f8b39602b9f385b03f7f6e98f (patch)
tree0de05b61c1e4109b4f9e53a2a3ecf0d796e21146 /tools/compress.py
parent6c405b6ea3fc00f1a335353b9140bbe5f0486a59 (diff)
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
Diffstat (limited to 'tools/compress.py')
-rwxr-xr-xtools/compress.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/tools/compress.py b/tools/compress.py
index d934ecb52..8abb8b09c 100755
--- a/tools/compress.py
+++ b/tools/compress.py
@@ -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):