diff --git a/Makefile b/Makefile index 38c712c2a9..94e08012a3 100644 --- a/Makefile +++ b/Makefile @@ -96,7 +96,7 @@ clean: rm $(ROM) code.elf code.bin boot.bin -r build build/baserom/dmadata: $(COMP_FILES) $(BASEROM_BUILD_FILES) - python3 dmadata.py + python3 ./tools/dmadata.py ./tables/dmadata_table.py $@ build/baserom/boot: boot.bin cp $< $@ diff --git a/dmadata_table.py b/tables/dmadata_table.py similarity index 99% rename from dmadata_table.py rename to tables/dmadata_table.py index 7e8d25bc2e..528a09df2a 100644 --- a/dmadata_table.py +++ b/tables/dmadata_table.py @@ -1,4 +1,5 @@ -dmadata_table = [ +# Follows the format of (File Path (blank if it's a null entry), Compressed File Path (if compressed), Alignment, Size (for a null entry)) +[ ('build/baserom/makerom', '', 0x10, 0), ('build/baserom/boot', '', 0x10, 0), ('dmadata', '', 0x10, 0), diff --git a/dmadata.py b/tools/dmadata.py similarity index 86% rename from dmadata.py rename to tools/dmadata.py index 6ed4174bc3..a28416a955 100644 --- a/dmadata.py +++ b/tools/dmadata.py @@ -1,18 +1,18 @@ -import os -import struct -import sys - -OUT = 'build/baserom/dmadata' - -from dmadata_table import * +import os, struct, sys, ast, argparse def align_up(base, align_to): return ((base + align_to - 1) // align_to) * align_to if __name__ == "__main__": - with open(OUT, 'wb') as dmadata: + parser = argparse.ArgumentParser() + parser.add_argument('files', help='file list') + parser.add_argument('out', help='output file') + args = parser.parse_args() + + with open(args.out, 'wb') as dmadata, open(args.files, 'r') as files: curr_vrom = 0 curr_phys = 0 + dmadata_table = ast.literal_eval(files.read()) for base_file, comp_file, alignment, size_if_missing in dmadata_table: try: uncompressed = comp_file == ''