mirror of
https://github.com/zeldaret/mm.git
synced 2026-05-24 15:20:49 -04:00
23d63852de
* Restore padding in ObjVisiblock struct * Copy overlays out of compiled `code.elf` to put into the ROM This is just a "tempory fix" It seems like the built code/assets in `code.elf` should not be copied into `build/baserom/...` (over the original ROM's files) but instead into a `build/decomp/...` tree or similar. `dmadata_table.txt` would also need to be updated to read from the correct location. * Use dmadata_table.txt to generate build rules `makerom_files.txt` & `makerom_uncompressed_files.txt` contained a lot of the same data in `dmadata_table.txt`, so I added a small python script to generate this information into `build/` Segments are no longer dumped out of `code.elf` into `build/baserom/``, instead they are put in `build/binary/`. `linker_scripts/dmadata_script.txt` was checked in, but generated by `dmadata.py`. I deleted it / moved it to `build/dmadata_script.txt.pre`. I also introduced some sentinel files (`dep`). I ended up needing these to make incremental builds work smoothly? (Without them, there were a lot of steps that were getting re-triggered on every build.) If this style isn't welcome, I can try to fiddle with the Makefile more to try to avoid having them? * Restore padding in BgLbfshot struct * Touch sentinel file before command; rm on failure * Restore padding in ObjKepnKoya struct * Ensure asm/ directories exist before disasm steps * Clean up Makefile rules * Set default goal; silent objcopy; fix code_script path * Fix ovl_En_Ginko_Man, ovl_Obj_Lightswitch merge ovl_En_Encount2 still needs work to bring back to matching * Fix ovl_En_Encount2 merge
31 lines
1.1 KiB
Python
Executable File
31 lines
1.1 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
import argparse, os
|
|
|
|
if __name__ == '__main__':
|
|
parser = argparse.ArgumentParser()
|
|
|
|
parser.add_argument('input', help='input .c file')
|
|
parser.add_argument('output', help='output .d file')
|
|
args = parser.parse_args()
|
|
|
|
asm_file = None
|
|
with open(args.input, 'r') as f:
|
|
lines = f.readlines()
|
|
# Search for the first GLOBAL_ASM and use that as a dependency
|
|
# We won't list all split assembly files as it is tricky to properly set up make recipes with multiple outputs
|
|
for line in lines:
|
|
if '#pragma GLOBAL_ASM(' in line:
|
|
base_path = os.path.normpath(line.split('"')[1])
|
|
path = os.path.split(base_path)[0]
|
|
asm_file = path.replace('non_matchings/', '') + '.asm ' # base .asm file
|
|
asm_file += path + "/dep" # split function .asm directory (sentinel file)
|
|
break
|
|
|
|
with open(args.output, 'w') as f:
|
|
f.write('build/' + args.input.replace('.c', '.o' + ': '))
|
|
if asm_file is not None:
|
|
f.write(asm_file + ' ')
|
|
|
|
f.write('\n')
|
|
|