ref: ece639e2f9dfb52f9f63423f7ce6dc224c176dbc
parent: 5ce0996691986e7704d58e53d052fca3a1256a85
author: Snesrev <snesrev@protonmail.com>
date: Wed Oct 12 15:01:44 EDT 2022
Use --sprites-from-png to parse the images from png
--- a/tables/compile_resources.py
+++ b/tables/compile_resources.py
@@ -8,7 +8,15 @@
import array, hashlib, struct
from util import cache
import sprite_sheets
+import argparse
+parser = argparse.ArgumentParser(description='Compile resources.')
+parser.add_argument('rom', nargs='?', help='the rom file')
+parser.add_argument('--sprites-from-png', action='store_true', help='Use the sprite images from the .PNG files')
+args = parser.parse_args()
+
+ROM = util.LoadedRom(args.rom)
+
def flatten(xss):
return [x for xs in xss for x in xs]
@@ -75,8 +83,6 @@
add_asset_uint16('kDialogueOffs', offs)
add_asset_uint8('kDialogueText', new_r)
-ROM = util.LoadedRom(sys.argv[1] if len(sys.argv) >= 2 else None)
-
def compress_store(r):
rr = []
j, jend = 0, len(r)
@@ -97,7 +103,7 @@
return b''.join([struct.pack('I', i) for i in all_offs] + arr)
def print_images():
- sprsheet = sprite_sheets.load_sprite_sheets()
+ sprsheet = sprite_sheets.load_sprite_sheets() if args.sprites_from_png else None
all = []
for i in range(108):