mirror of https://github.com/zeldaret/mm.git
Make dmadata tool usable from command line
This commit is contained in:
parent
7546b77798
commit
ec35f43925
2
Makefile
2
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 $< $@
|
||||
|
|
|
@ -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),
|
|
@ -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 == ''
|
Loading…
Reference in New Issue