mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-02 22:14:33 +00:00
Rework disassembly: out of makefile, separate sections, relocs (#1728)
* Rework disassembly: out of makefile, separate sections, relocs * another nice print * fix type hints for python 3.8 dinosaurs * reencode from utf-8 to euc-jp (iconv) before assemble * Add "include guards" to macro.inc * For producing the expected file object files, assemble sections together instead of linking together the individually assembled sections * review * fixup * require spimdisasm >=1.21.0 * remove assembling sections individually (for now) * uppercase encoding names (standard)
This commit is contained in:
parent
0ac4448d99
commit
1ba2d6d0f9
10 changed files with 753 additions and 744 deletions
20
Makefile
20
Makefile
|
@ -181,10 +181,6 @@ endif
|
|||
|
||||
OBJDUMP_FLAGS := -d -r -z -Mreg-names=32
|
||||
|
||||
DISASM_DATA_DIR := tools/disasm/$(VERSION)
|
||||
DISASM_FLAGS += --custom-suffix _unknown --sequential-label-names --no-use-fpccsr --no-cop0-named-registers
|
||||
DISASM_FLAGS += --config-dir $(DISASM_DATA_DIR) --symbol-addrs $(DISASM_DATA_DIR)/functions.txt --symbol-addrs $(DISASM_DATA_DIR)/variables.txt
|
||||
|
||||
#### Files ####
|
||||
|
||||
# ROM image
|
||||
|
@ -223,11 +219,6 @@ O_FILES := $(foreach f,$(S_FILES:.s=.o),$(BUILD_DIR)/$f) \
|
|||
|
||||
OVL_RELOC_FILES := $(shell $(CPP) $(CPPFLAGS) $(SPEC) | $(SPEC_REPLACE_VARS) | grep -o '[^"]*_reloc.o' )
|
||||
|
||||
DISASM_BASEROM := $(BASEROM_DIR)/baserom-decompressed.z64
|
||||
DISASM_DATA_FILES := $(wildcard $(DISASM_DATA_DIR)/*.csv) $(wildcard $(DISASM_DATA_DIR)/*.txt)
|
||||
DISASM_S_FILES := $(shell test -e $(PYTHON) && $(PYTHON) tools/disasm/list_generated_files.py -o $(EXPECTED_DIR) --config-dir $(DISASM_DATA_DIR))
|
||||
DISASM_O_FILES := $(DISASM_S_FILES:.s=.o)
|
||||
|
||||
# Automatic dependency files
|
||||
# (Only asm_processor dependencies and reloc dependencies are handled for now)
|
||||
DEP_FILES := $(O_FILES:.o=.asmproc.d) $(OVL_RELOC_FILES:.o=.d)
|
||||
|
@ -373,7 +364,9 @@ ifeq ($(VERSION),gc-eu-mq-dbg)
|
|||
$(PYTHON) tools/msgdis.py --text-out assets/text/message_data.h --staff-text-out assets/text/message_data_staff.h
|
||||
endif
|
||||
|
||||
disasm: $(DISASM_O_FILES)
|
||||
disasm:
|
||||
$(RM) -r $(EXPECTED_DIR)
|
||||
VERSION=$(VERSION) DISASM_BASEROM=$(BASEROM_DIR)/baserom-decompressed.z64 DISASM_DIR=$(EXPECTED_DIR) PYTHON=$(PYTHON) AS_CMD='$(AS) $(ASFLAGS)' LD=$(LD) ./tools/disasm/do_disasm.sh
|
||||
|
||||
run: $(ROM)
|
||||
ifeq ($(N64_EMULATOR),)
|
||||
|
@ -495,13 +488,6 @@ $(BUILD_DIR)/assets/%.bin.inc.c: assets/%.bin
|
|||
$(BUILD_DIR)/assets/%.jpg.inc.c: assets/%.jpg
|
||||
$(ZAPD) bren -eh -i $< -o $@
|
||||
|
||||
$(EXPECTED_DIR)/.disasm: $(DISASM_DATA_FILES)
|
||||
$(PYTHON) tools/disasm/disasm.py $(DISASM_FLAGS) $(DISASM_BASEROM) -o $(EXPECTED_DIR) --split-functions $(EXPECTED_DIR)/functions
|
||||
touch $@
|
||||
|
||||
$(EXPECTED_DIR)/%.o: $(EXPECTED_DIR)/.disasm
|
||||
iconv --from UTF-8 --to EUC-JP $(@:.o=.s) | $(AS) $(ASFLAGS) -o $@
|
||||
|
||||
-include $(DEP_FILES)
|
||||
|
||||
# Print target for debugging
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue