Fixed progress calculation for decompressed build

This commit is contained in:
Mr-Wiseguy 2022-11-15 21:26:15 -05:00
parent 8dc929aeee
commit 80ec28ad08
2 changed files with 8 additions and 16 deletions

View File

@ -192,20 +192,14 @@ verify: $(Z64)
@$(DIFF) decompressed.us.v10.z64 $(Z64) > /dev/null && \
$(PRINT) "$(YELLOW) _\n _( )_\n [ ]_\n ) _ _)\n [_( )_]\n$(BLUE)$(BASENAME).$(VERSION).z64$(NO_COL): $(GREEN)OK$(NO_COL)\n" || \
$(PRINT) "$(BLUE)$(BASEROM) $(RED)differs$(NO_COL)\n"
# @$(PRINT) "def apply(config, args):\n" > diff_settings.py
# @$(PRINT) "\tconfig[\"baseimg\"] = \"$(BASEROM)\"\n" >> diff_settings.py
# @$(PRINT) "\tconfig[\"myimg\"] = \"$(Z64)\"\n" >> diff_settings.py
# @$(PRINT) "\tconfig[\"mapfile\"] = \"$(Z64:.z64=.map)\"\n" >> diff_settings.py
# @$(PRINT) "\tconfig[\"source_directories\"] = ['$(SRC_ROOT)', 'include']\n" >> diff_settings.py
# @$(PRINT) "\tconfig[\"makeflags\"] = ['-s']\n" >> diff_settings.py
$(OVERLAY_PROG_SVGS) : progress/progress_%.svg: progress/progress.%.csv
$(call print1,Creating progress svg for:,$*)
@$(PROGRESS_READ) $< $(VERSION) $*
$(OVERLAY_PROG_CSVS) : progress/progress.%.csv: $(BUILD_DIR)/%.elf
$(OVERLAY_PROG_CSVS) : progress/progress.%.csv: $(ELF)
$(call print1,Calculating progress for:,$*)
@$(PROGRESS) . $(BUILD_DIR)/$*.elf .$* --version $(VERSION) --subcode $* > $@
@$(PROGRESS) . $(ELF) .$* --version $(VERSION) --subcode $* > $@
$(MAIN_PROG_SVG): $(MAIN_PROG_CSV)
$(call print1,Creating progress svg for:,boot)
@ -227,10 +221,6 @@ $(TOTAL_PROG_CSV): $(OVERLAY_PROG_CSVS) $(MAIN_PROG_CSV)
$(README_MD): $(TOTAL_PROG_SVG)
@head -n 21 $< | tail -n 1 | head -c -8 | tail -c +32 | xargs -i sed -i "/# banjo*/c\# banjo ({})" $@
# Additional symbols for core2
$(BUILD_DIR)/core2.elf: LDFLAGS_COMMON = -T symbol_addrs.core1.$(VERSION).txt -T symbol_addrs.core2.$(VERSION).txt -T symbol_addrs.global.$(VERSION).txt -T undefined_syms.$(VERSION).txt -T undefined_syms.libultra.txt --no-check-sections --accept-unknown-input-arch -T level_symbols.$(VERSION).txt
$(BUILD_DIR)/core2.temp.elf: LDFLAGS_COMMON = -T symbol_addrs.core1.$(VERSION).txt -T symbol_addrs.core2.$(VERSION).txt -T symbol_addrs.global.$(VERSION).txt -T undefined_syms.$(VERSION).txt -T undefined_syms.libultra.txt --no-check-sections --accept-unknown-input-arch -T level_symbols.$(VERSION).txt
# mkdir
$(ALL_DIRS) :
$(call print1,Making folder:,$@)

View File

@ -16,7 +16,7 @@ def get_functions(elffile, section, ending=None):
functions = {}
for line in nm_lines:
if f"g F {section}" in line or "g F *ABS* " in line:
if f"g F {section}" in line:
components = line.split()
size = int(components[4], 16)
name = components[5]
@ -24,14 +24,16 @@ def get_functions(elffile, section, ending=None):
return functions
def generate_csv(functions, nonmatching_funcs, version, section):
def generate_csv(functions, nonmatching_funcs, version, section, subcode):
ret = []
ret.append("version,section,function,length,matching")
for func in functions:
length = functions[func]["length"]
if length > 0:
matching = "no" if func in nonmatching_funcs else "yes"
ret.append(f"{version},{section},{func},{length},{matching}")
# Strip the boot_ prefix off symbols in bk_boot
func_name = func if subcode else func[5:]
ret.append(f"{version},{section},{func_name},{length},{matching}")
return "\n".join(ret)
def get_nonmatching_funcs(basedir, subcode):
@ -64,7 +66,7 @@ def main(basedir, elffile, section, ending, version, subcode):
functions = get_functions(elffile, section, ending)
section_name = section.split("_")[-1] # .code_game -> game
nonmatching_funcs = get_nonmatching_funcs(basedir, subcode)
csv = generate_csv(functions, nonmatching_funcs, version, section_name)
csv = generate_csv(functions, nonmatching_funcs, version, section_name, subcode)
print(csv)
if __name__ == '__main__':