mirror of
https://github.com/zeldaret/oot.git
synced 2024-11-23 05:49:50 +00:00
Create separate build directories based on version (#1591)
* Create separate build directories based on version * Fix find_unused_asm.sh * Remove find_unused_asm.sh from Jenkinsfile * Revert diff.py * Clarify that gc-eu-mq is not "supported" yet * Revert xmlcreate.py (to be deleted) * Remove gc-eu-mq for now * Add version flags to diff_settings.py and sym_info.py * --version -> --oot-version * Fix --oot-version * Revert adding version flags to tools * Delete find_unused_asm.sh * Revert changes to first_diff.py output in tutorial * Factor out sed usages for spec
This commit is contained in:
parent
1f9c28f370
commit
25ff0a27de
5
Jenkinsfile
vendored
5
Jenkinsfile
vendored
@ -4,11 +4,6 @@ pipeline {
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Check for unused asm') {
|
||||
steps {
|
||||
sh './tools/find_unused_asm.sh'
|
||||
}
|
||||
}
|
||||
stage('Setup') {
|
||||
steps {
|
||||
sh 'cp /usr/local/etc/roms/baserom_oot.z64 baserom_original.z64'
|
||||
|
187
Makefile
187
Makefile
@ -14,6 +14,9 @@ NON_MATCHING := 0
|
||||
ORIG_COMPILER := 0
|
||||
# If COMPILER is "gcc", compile with GCC instead of IDO.
|
||||
COMPILER := ido
|
||||
# Target game version. Currently only the following version is supported:
|
||||
# gc-eu-mq-dbg GameCube Europe/PAL Master Quest Debug (default)
|
||||
VERSION := gc-eu-mq-dbg
|
||||
|
||||
CFLAGS ?=
|
||||
CPPFLAGS ?=
|
||||
@ -41,7 +44,15 @@ ifeq ($(NON_MATCHING),1)
|
||||
COMPARE := 0
|
||||
endif
|
||||
|
||||
# Version-specific settings
|
||||
ifeq ($(VERSION),gc-eu-mq-dbg)
|
||||
OPTFLAGS := -O2
|
||||
else
|
||||
$(error Unsupported version $(VERSION))
|
||||
endif
|
||||
|
||||
PROJECT_DIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||
BUILD_DIR := build/$(VERSION)
|
||||
|
||||
MAKE = make
|
||||
CPPFLAGS += -fno-dollars-in-identifiers -P
|
||||
@ -70,14 +81,12 @@ endif
|
||||
# Detect compiler and set variables appropriately.
|
||||
ifeq ($(COMPILER),gcc)
|
||||
CC := $(MIPS_BINUTILS_PREFIX)gcc
|
||||
else
|
||||
ifeq ($(COMPILER),ido)
|
||||
else ifeq ($(COMPILER),ido)
|
||||
CC := tools/ido_recomp/$(DETECTED_OS)/7.1/cc
|
||||
CC_OLD := tools/ido_recomp/$(DETECTED_OS)/5.3/cc
|
||||
else
|
||||
$(error Unsupported compiler. Please use either ido or gcc as the COMPILER variable.)
|
||||
endif
|
||||
endif
|
||||
|
||||
# if ORIG_COMPILER is 1, check that either QEMU_IRIX is set or qemu-irix package installed
|
||||
ifeq ($(ORIG_COMPILER),1)
|
||||
@ -98,7 +107,7 @@ OBJDUMP := $(MIPS_BINUTILS_PREFIX)objdump
|
||||
EMULATOR :=
|
||||
EMU_FLAGS :=
|
||||
|
||||
INC := -Iinclude -Iinclude/libc -Isrc -Ibuild -I.
|
||||
INC := -Iinclude -Iinclude/libc -Isrc -I$(BUILD_DIR) -I.
|
||||
|
||||
# Check code syntax with host compiler
|
||||
CHECK_WARNINGS := -Wall -Wextra -Wno-format-security -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-variable -Wno-missing-braces
|
||||
@ -110,10 +119,12 @@ ELF2ROM := tools/elf2rom
|
||||
ZAPD := tools/ZAPD/ZAPD.out
|
||||
FADO := tools/fado/fado.elf
|
||||
|
||||
# Command to replace path variables in the spec file. We can't use the C
|
||||
# preprocessor for this because it won't substitute inside string literals.
|
||||
SPEC_REPLACE_VARS := sed -e 's|$$(BUILD_DIR)|$(BUILD_DIR)|g'
|
||||
|
||||
ifeq ($(COMPILER),gcc)
|
||||
OPTFLAGS := -Os -ffast-math -fno-unsafe-math-optimizations
|
||||
else
|
||||
OPTFLAGS := -O2
|
||||
endif
|
||||
|
||||
ASFLAGS := -march=vr4300 -32 -no-pad-sections -Iinclude
|
||||
@ -147,7 +158,7 @@ OBJDUMP_FLAGS := -d -r -z -Mreg-names=32
|
||||
#### Files ####
|
||||
|
||||
# ROM image
|
||||
ROM := zelda_ocarina_mq_dbg.z64
|
||||
ROM := oot-$(VERSION).z64
|
||||
ELF := $(ROM:.z64=.elf)
|
||||
# description of ROM segments
|
||||
SPEC := spec
|
||||
@ -162,19 +173,19 @@ ASSET_BIN_DIRS := $(shell find assets/* -type d -not -path "assets/xml*" -not -p
|
||||
ASSET_FILES_XML := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.xml))
|
||||
ASSET_FILES_BIN := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.bin))
|
||||
ASSET_FILES_OUT := $(foreach f,$(ASSET_FILES_XML:.xml=.c),$f) \
|
||||
$(foreach f,$(ASSET_FILES_BIN:.bin=.bin.inc.c),build/$f) \
|
||||
$(foreach f,$(wildcard assets/text/*.c),build/$(f:.c=.o))
|
||||
$(foreach f,$(ASSET_FILES_BIN:.bin=.bin.inc.c),$(BUILD_DIR)/$f) \
|
||||
$(foreach f,$(wildcard assets/text/*.c),$(BUILD_DIR)/$(f:.c=.o))
|
||||
|
||||
UNDECOMPILED_DATA_DIRS := $(shell find data -type d)
|
||||
|
||||
# source files
|
||||
C_FILES := $(filter-out %.inc.c,$(foreach dir,$(SRC_DIRS) $(ASSET_BIN_DIRS),$(wildcard $(dir)/*.c)))
|
||||
S_FILES := $(foreach dir,$(SRC_DIRS) $(UNDECOMPILED_DATA_DIRS),$(wildcard $(dir)/*.s))
|
||||
O_FILES := $(foreach f,$(S_FILES:.s=.o),build/$f) \
|
||||
$(foreach f,$(C_FILES:.c=.o),build/$f) \
|
||||
$(foreach f,$(wildcard baserom/*),build/$f.o)
|
||||
O_FILES := $(foreach f,$(S_FILES:.s=.o),$(BUILD_DIR)/$f) \
|
||||
$(foreach f,$(C_FILES:.c=.o),$(BUILD_DIR)/$f) \
|
||||
$(foreach f,$(wildcard baserom/*),$(BUILD_DIR)/$f.o)
|
||||
|
||||
OVL_RELOC_FILES := $(shell $(CPP) $(CPPFLAGS) $(SPEC) | grep -o '[^"]*_reloc.o' )
|
||||
OVL_RELOC_FILES := $(shell $(CPP) $(CPPFLAGS) $(SPEC) | $(SPEC_REPLACE_VARS) | grep -o '[^"]*_reloc.o' )
|
||||
|
||||
# Automatic dependency files
|
||||
# (Only asm_processor dependencies and reloc dependencies are handled for now)
|
||||
@ -183,63 +194,63 @@ DEP_FILES := $(O_FILES:.o=.asmproc.d) $(OVL_RELOC_FILES:.o=.d)
|
||||
|
||||
TEXTURE_FILES_PNG := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.png))
|
||||
TEXTURE_FILES_JPG := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.jpg))
|
||||
TEXTURE_FILES_OUT := $(foreach f,$(TEXTURE_FILES_PNG:.png=.inc.c),build/$f) \
|
||||
$(foreach f,$(TEXTURE_FILES_JPG:.jpg=.jpg.inc.c),build/$f) \
|
||||
TEXTURE_FILES_OUT := $(foreach f,$(TEXTURE_FILES_PNG:.png=.inc.c),$(BUILD_DIR)/$f) \
|
||||
$(foreach f,$(TEXTURE_FILES_JPG:.jpg=.jpg.inc.c),$(BUILD_DIR)/$f) \
|
||||
|
||||
# create build directories
|
||||
$(shell mkdir -p build/baserom build/assets/text $(foreach dir,$(SRC_DIRS) $(UNDECOMPILED_DATA_DIRS) $(ASSET_BIN_DIRS),build/$(dir)))
|
||||
$(shell mkdir -p $(BUILD_DIR)/baserom $(BUILD_DIR)/assets/text $(foreach dir,$(SRC_DIRS) $(UNDECOMPILED_DATA_DIRS) $(ASSET_BIN_DIRS),$(BUILD_DIR)/$(dir)))
|
||||
|
||||
ifeq ($(COMPILER),ido)
|
||||
build/src/code/fault.o: CFLAGS += -trapuv
|
||||
build/src/code/fault.o: OPTFLAGS := -O2 -g3
|
||||
build/src/code/fault_drawer.o: CFLAGS += -trapuv
|
||||
build/src/code/fault_drawer.o: OPTFLAGS := -O2 -g3
|
||||
build/src/code/ucode_disas.o: OPTFLAGS := -O2 -g3
|
||||
build/src/code/fmodf.o: OPTFLAGS := -g
|
||||
build/src/code/__osMemset.o: OPTFLAGS := -g
|
||||
build/src/code/__osMemmove.o: OPTFLAGS := -g
|
||||
$(BUILD_DIR)/src/code/fault.o: CFLAGS += -trapuv
|
||||
$(BUILD_DIR)/src/code/fault.o: OPTFLAGS := -O2 -g3
|
||||
$(BUILD_DIR)/src/code/fault_drawer.o: CFLAGS += -trapuv
|
||||
$(BUILD_DIR)/src/code/fault_drawer.o: OPTFLAGS := -O2 -g3
|
||||
$(BUILD_DIR)/src/code/ucode_disas.o: OPTFLAGS := -O2 -g3
|
||||
$(BUILD_DIR)/src/code/fmodf.o: OPTFLAGS := -g
|
||||
$(BUILD_DIR)/src/code/__osMemset.o: OPTFLAGS := -g
|
||||
$(BUILD_DIR)/src/code/__osMemmove.o: OPTFLAGS := -g
|
||||
|
||||
build/src/audio/%.o: OPTFLAGS := -O2
|
||||
$(BUILD_DIR)/src/audio/%.o: OPTFLAGS := -O2
|
||||
|
||||
# Use signed chars instead of unsigned for this audio file (needed to match AudioDebug_ScrPrt)
|
||||
build/src/audio/general.o: CFLAGS += -signed
|
||||
$(BUILD_DIR)/src/audio/general.o: CFLAGS += -signed
|
||||
|
||||
# Put string literals in .data for some audio files (needed to match these files with literals)
|
||||
build/src/audio/sfx.o: CFLAGS += -use_readwrite_const
|
||||
build/src/audio/sequence.o: CFLAGS += -use_readwrite_const
|
||||
$(BUILD_DIR)/src/audio/sfx.o: CFLAGS += -use_readwrite_const
|
||||
$(BUILD_DIR)/src/audio/sequence.o: CFLAGS += -use_readwrite_const
|
||||
|
||||
build/src/libultra/libc/absf.o: OPTFLAGS := -O2 -g3
|
||||
build/src/libultra/libc/sqrt.o: OPTFLAGS := -O2 -g3
|
||||
build/src/libultra/libc/ll.o: OPTFLAGS := -O1
|
||||
build/src/libultra/libc/ll.o: MIPS_VERSION := -mips3 -32
|
||||
build/src/libultra/libc/llcvt.o: OPTFLAGS := -O1
|
||||
build/src/libultra/libc/llcvt.o: MIPS_VERSION := -mips3 -32
|
||||
$(BUILD_DIR)/src/libultra/libc/absf.o: OPTFLAGS := -O2 -g3
|
||||
$(BUILD_DIR)/src/libultra/libc/sqrt.o: OPTFLAGS := -O2 -g3
|
||||
$(BUILD_DIR)/src/libultra/libc/ll.o: OPTFLAGS := -O1
|
||||
$(BUILD_DIR)/src/libultra/libc/ll.o: MIPS_VERSION := -mips3 -32
|
||||
$(BUILD_DIR)/src/libultra/libc/llcvt.o: OPTFLAGS := -O1
|
||||
$(BUILD_DIR)/src/libultra/libc/llcvt.o: MIPS_VERSION := -mips3 -32
|
||||
|
||||
build/src/libultra/os/%.o: OPTFLAGS := -O1
|
||||
build/src/libultra/io/%.o: OPTFLAGS := -O2
|
||||
build/src/libultra/libc/%.o: OPTFLAGS := -O2
|
||||
build/src/libultra/rmon/%.o: OPTFLAGS := -O2
|
||||
build/src/libultra/gu/%.o: OPTFLAGS := -O2
|
||||
$(BUILD_DIR)/src/libultra/os/%.o: OPTFLAGS := -O1
|
||||
$(BUILD_DIR)/src/libultra/io/%.o: OPTFLAGS := -O2
|
||||
$(BUILD_DIR)/src/libultra/libc/%.o: OPTFLAGS := -O2
|
||||
$(BUILD_DIR)/src/libultra/rmon/%.o: OPTFLAGS := -O2
|
||||
$(BUILD_DIR)/src/libultra/gu/%.o: OPTFLAGS := -O2
|
||||
|
||||
build/assets/misc/z_select_static/%.o: CFLAGS += -DF3DEX_GBI
|
||||
$(BUILD_DIR)/assets/misc/z_select_static/%.o: CFLAGS += -DF3DEX_GBI
|
||||
|
||||
build/src/libultra/gu/%.o: CC := $(CC_OLD)
|
||||
build/src/libultra/io/%.o: CC := $(CC_OLD)
|
||||
build/src/libultra/libc/%.o: CC := $(CC_OLD)
|
||||
build/src/libultra/os/%.o: CC := $(CC_OLD)
|
||||
build/src/libultra/rmon/%.o: CC := $(CC_OLD)
|
||||
$(BUILD_DIR)/src/libultra/gu/%.o: CC := $(CC_OLD)
|
||||
$(BUILD_DIR)/src/libultra/io/%.o: CC := $(CC_OLD)
|
||||
$(BUILD_DIR)/src/libultra/libc/%.o: CC := $(CC_OLD)
|
||||
$(BUILD_DIR)/src/libultra/os/%.o: CC := $(CC_OLD)
|
||||
$(BUILD_DIR)/src/libultra/rmon/%.o: CC := $(CC_OLD)
|
||||
|
||||
build/src/code/jpegutils.o: CC := $(CC_OLD)
|
||||
build/src/code/jpegdecoder.o: CC := $(CC_OLD)
|
||||
$(BUILD_DIR)/src/code/jpegutils.o: CC := $(CC_OLD)
|
||||
$(BUILD_DIR)/src/code/jpegdecoder.o: CC := $(CC_OLD)
|
||||
|
||||
build/src/boot/%.o: CC := python3 tools/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) --
|
||||
build/src/code/%.o: CC := python3 tools/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) --
|
||||
build/src/overlays/%.o: CC := python3 tools/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) --
|
||||
$(BUILD_DIR)/src/boot/%.o: CC := python3 tools/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) --
|
||||
$(BUILD_DIR)/src/code/%.o: CC := python3 tools/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) --
|
||||
$(BUILD_DIR)/src/overlays/%.o: CC := python3 tools/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) --
|
||||
|
||||
build/assets/%.o: CC := python3 tools/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) --
|
||||
$(BUILD_DIR)/assets/%.o: CC := python3 tools/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) --
|
||||
else
|
||||
build/src/libultra/libc/ll.o: OPTFLAGS := -Ofast
|
||||
build/src/%.o: CC := $(CC) -fexec-charset=euc-jp
|
||||
$(BUILD_DIR)/src/libultra/libc/ll.o: OPTFLAGS := -Ofast
|
||||
$(BUILD_DIR)/src/%.o: CC := $(CC) -fexec-charset=euc-jp
|
||||
endif
|
||||
|
||||
#### Main Targets ###
|
||||
@ -251,12 +262,12 @@ ifeq ($(COMPARE),1)
|
||||
endif
|
||||
|
||||
clean:
|
||||
$(RM) -r $(ROM) $(ELF) build
|
||||
$(RM) -r $(ROM) $(ELF) $(BUILD_DIR)
|
||||
|
||||
assetclean:
|
||||
$(RM) -r $(ASSET_BIN_DIRS)
|
||||
$(RM) -r assets/text/*.h
|
||||
$(RM) -r build/assets
|
||||
$(RM) -r $(BUILD_DIR)/assets
|
||||
$(RM) -r .extracted-assets.json
|
||||
|
||||
distclean: clean assetclean
|
||||
@ -283,8 +294,8 @@ endif
|
||||
$(ROM): $(ELF)
|
||||
$(ELF2ROM) -cic 6105 $< $@
|
||||
|
||||
$(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(O_FILES) $(OVL_RELOC_FILES) build/ldscript.txt build/undefined_syms.txt
|
||||
$(LD) -T build/undefined_syms.txt -T build/ldscript.txt --no-check-sections --accept-unknown-input-arch --emit-relocs -Map build/z64.map -o $@
|
||||
$(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(O_FILES) $(OVL_RELOC_FILES) $(BUILD_DIR)/ldscript.txt $(BUILD_DIR)/undefined_syms.txt
|
||||
$(LD) -T $(BUILD_DIR)/undefined_syms.txt -T $(BUILD_DIR)/ldscript.txt --no-check-sections --accept-unknown-input-arch --emit-relocs -Map $(BUILD_DIR)/z64.map -o $@
|
||||
|
||||
## Order-only prerequisites
|
||||
# These ensure e.g. the O_FILES are built before the OVL_RELOC_FILES.
|
||||
@ -298,84 +309,84 @@ $(O_FILES): | asset_files
|
||||
|
||||
.PHONY: o_files asset_files
|
||||
|
||||
build/$(SPEC): $(SPEC)
|
||||
$(CPP) $(CPPFLAGS) $< > $@
|
||||
$(BUILD_DIR)/$(SPEC): $(SPEC)
|
||||
$(CPP) $(CPPFLAGS) $< | $(SPEC_REPLACE_VARS) > $@
|
||||
|
||||
build/ldscript.txt: build/$(SPEC)
|
||||
$(BUILD_DIR)/ldscript.txt: $(BUILD_DIR)/$(SPEC)
|
||||
$(MKLDSCRIPT) $< $@
|
||||
|
||||
build/undefined_syms.txt: undefined_syms.txt
|
||||
$(BUILD_DIR)/undefined_syms.txt: undefined_syms.txt
|
||||
$(CPP) $(CPPFLAGS) $< > $@
|
||||
|
||||
build/baserom/%.o: baserom/%
|
||||
$(BUILD_DIR)/baserom/%.o: baserom/%
|
||||
$(OBJCOPY) -I binary -O elf32-big $< $@
|
||||
|
||||
build/data/%.o: data/%.s
|
||||
$(BUILD_DIR)/data/%.o: data/%.s
|
||||
$(AS) $(ASFLAGS) $< -o $@
|
||||
|
||||
build/assets/text/%.enc.h: assets/text/%.h assets/text/charmap.txt
|
||||
$(BUILD_DIR)/assets/text/%.enc.h: assets/text/%.h assets/text/charmap.txt
|
||||
python3 tools/msgenc.py assets/text/charmap.txt $< $@
|
||||
|
||||
# Dependencies for files including message data headers
|
||||
# TODO remove when full header dependencies are used.
|
||||
build/assets/text/fra_message_data_static.o: build/assets/text/message_data.enc.h
|
||||
build/assets/text/ger_message_data_static.o: build/assets/text/message_data.enc.h
|
||||
build/assets/text/nes_message_data_static.o: build/assets/text/message_data.enc.h
|
||||
build/assets/text/staff_message_data_static.o: build/assets/text/message_data_staff.enc.h
|
||||
build/src/code/z_message_PAL.o: build/assets/text/message_data.enc.h build/assets/text/message_data_staff.enc.h
|
||||
$(BUILD_DIR)/assets/text/fra_message_data_static.o: $(BUILD_DIR)/assets/text/message_data.enc.h
|
||||
$(BUILD_DIR)/assets/text/ger_message_data_static.o: $(BUILD_DIR)/assets/text/message_data.enc.h
|
||||
$(BUILD_DIR)/assets/text/nes_message_data_static.o: $(BUILD_DIR)/assets/text/message_data.enc.h
|
||||
$(BUILD_DIR)/assets/text/staff_message_data_static.o: $(BUILD_DIR)/assets/text/message_data_staff.enc.h
|
||||
$(BUILD_DIR)/src/code/z_message_PAL.o: $(BUILD_DIR)/assets/text/message_data.enc.h $(BUILD_DIR)/assets/text/message_data_staff.enc.h
|
||||
|
||||
build/assets/%.o: assets/%.c
|
||||
$(BUILD_DIR)/assets/%.o: assets/%.c
|
||||
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
|
||||
$(OBJCOPY) -O binary $@ $@.bin
|
||||
|
||||
build/src/%.o: src/%.s
|
||||
$(BUILD_DIR)/src/%.o: src/%.s
|
||||
$(CPP) $(CPPFLAGS) -Iinclude $< | $(AS) $(ASFLAGS) -o $@
|
||||
|
||||
build/dmadata_table_spec.h: build/$(SPEC)
|
||||
$(BUILD_DIR)/dmadata_table_spec.h: $(BUILD_DIR)/$(SPEC)
|
||||
$(MKDMADATA) $< $@
|
||||
|
||||
# Dependencies for files that may include the dmadata header automatically generated from the spec file
|
||||
build/src/boot/z_std_dma.o: build/dmadata_table_spec.h
|
||||
build/src/dmadata/dmadata.o: build/dmadata_table_spec.h
|
||||
$(BUILD_DIR)/src/boot/z_std_dma.o: $(BUILD_DIR)/dmadata_table_spec.h
|
||||
$(BUILD_DIR)/src/dmadata/dmadata.o: $(BUILD_DIR)/dmadata_table_spec.h
|
||||
|
||||
# Dependencies for files including from include/tables/
|
||||
# TODO remove when full header dependencies are used.
|
||||
build/src/code/graph.o: include/tables/gamestate_table.h
|
||||
build/src/code/object_table.o: include/tables/object_table.h
|
||||
build/src/code/z_actor.o: include/tables/actor_table.h # so uses of ACTOR_ID_MAX update when the table length changes
|
||||
build/src/code/z_actor_dlftbls.o: include/tables/actor_table.h
|
||||
build/src/code/z_effect_soft_sprite_dlftbls.o: include/tables/effect_ss_table.h
|
||||
build/src/code/z_game_dlftbls.o: include/tables/gamestate_table.h
|
||||
build/src/code/z_scene_table.o: include/tables/scene_table.h include/tables/entrance_table.h
|
||||
$(BUILD_DIR)/src/code/graph.o: include/tables/gamestate_table.h
|
||||
$(BUILD_DIR)/src/code/object_table.o: include/tables/object_table.h
|
||||
$(BUILD_DIR)/src/code/z_actor.o: include/tables/actor_table.h # so uses of ACTOR_ID_MAX update when the table length changes
|
||||
$(BUILD_DIR)/src/code/z_actor_dlftbls.o: include/tables/actor_table.h
|
||||
$(BUILD_DIR)/src/code/z_effect_soft_sprite_dlftbls.o: include/tables/effect_ss_table.h
|
||||
$(BUILD_DIR)/src/code/z_game_dlftbls.o: include/tables/gamestate_table.h
|
||||
$(BUILD_DIR)/src/code/z_scene_table.o: include/tables/scene_table.h include/tables/entrance_table.h
|
||||
|
||||
build/src/%.o: src/%.c
|
||||
$(BUILD_DIR)/src/%.o: src/%.c
|
||||
$(CC_CHECK) $<
|
||||
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
|
||||
@$(OBJDUMP) $(OBJDUMP_FLAGS) $@ > $(@:.o=.s)
|
||||
|
||||
build/src/libultra/libc/ll.o: src/libultra/libc/ll.c
|
||||
$(BUILD_DIR)/src/libultra/libc/ll.o: src/libultra/libc/ll.c
|
||||
$(CC_CHECK) $<
|
||||
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
|
||||
python3 tools/set_o32abi_bit.py $@
|
||||
@$(OBJDUMP) $(OBJDUMP_FLAGS) $@ > $(@:.o=.s)
|
||||
|
||||
build/src/libultra/libc/llcvt.o: src/libultra/libc/llcvt.c
|
||||
$(BUILD_DIR)/src/libultra/libc/llcvt.o: src/libultra/libc/llcvt.c
|
||||
$(CC_CHECK) $<
|
||||
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
|
||||
python3 tools/set_o32abi_bit.py $@
|
||||
@$(OBJDUMP) $(OBJDUMP_FLAGS) $@ > $(@:.o=.s)
|
||||
|
||||
build/src/overlays/%_reloc.o: build/$(SPEC)
|
||||
$(BUILD_DIR)/src/overlays/%_reloc.o: $(BUILD_DIR)/$(SPEC)
|
||||
$(FADO) $$(tools/reloc_prereq $< $(notdir $*)) -n $(notdir $*) -o $(@:.o=.s) -M $(@:.o=.d)
|
||||
$(AS) $(ASFLAGS) $(@:.o=.s) -o $@
|
||||
|
||||
build/%.inc.c: %.png
|
||||
$(BUILD_DIR)/%.inc.c: %.png
|
||||
$(ZAPD) btex -eh -tt $(subst .,,$(suffix $*)) -i $< -o $@
|
||||
|
||||
build/assets/%.bin.inc.c: assets/%.bin
|
||||
$(BUILD_DIR)/assets/%.bin.inc.c: assets/%.bin
|
||||
$(ZAPD) bblb -eh -i $< -o $@
|
||||
|
||||
build/assets/%.jpg.inc.c: assets/%.jpg
|
||||
$(BUILD_DIR)/assets/%.jpg.inc.c: assets/%.jpg
|
||||
$(ZAPD) bren -eh -i $< -o $@
|
||||
|
||||
-include $(DEP_FILES)
|
||||
|
@ -29,7 +29,7 @@ The only build currently supported is Master Quest (Debug), but other versions a
|
||||
|
||||
It builds the following ROM:
|
||||
|
||||
* zelda_ocarina_mq_dbg.z64 `md5: f0b7f35375f9cc8ca1b2d59d78e35405`
|
||||
* oot-gc-eu-mq-dbg.z64 `md5: f0b7f35375f9cc8ca1b2d59d78e35405`
|
||||
|
||||
**Note: This repository does not include any of the assets necessary to build the ROM. A prior copy of the game is required to extract the needed assets.**
|
||||
|
||||
@ -123,16 +123,16 @@ Make sure your path to the project is not too long, otherwise this process may e
|
||||
make
|
||||
```
|
||||
|
||||
If all goes well, a new ROM called "zelda_ocarina_mq_debug.z64" should be built and the following text should be printed:
|
||||
If all goes well, a new ROM called "oot-gc-eu-mq-dbg.z64" should be built and the following text should be printed:
|
||||
|
||||
```bash
|
||||
zelda_ocarina_mq_dbg.z64: OK
|
||||
oot-gc-eu-mq-dbg.z64: OK
|
||||
```
|
||||
|
||||
If you instead see the following:
|
||||
|
||||
```bash
|
||||
zelda_ocarina_mq_dbg.z64: FAILED
|
||||
oot-gc-eu-mq-dbg.z64: FAILED
|
||||
md5sum: WARNING: 1 computed checksum did NOT match
|
||||
```
|
||||
|
||||
|
@ -1 +1 @@
|
||||
f0b7f35375f9cc8ca1b2d59d78e35405 zelda_ocarina_mq_dbg.z64
|
||||
f0b7f35375f9cc8ca1b2d59d78e35405 oot-gc-eu-mq-dbg.z64
|
||||
|
@ -1,6 +1,6 @@
|
||||
def apply(config, args):
|
||||
config['mapfile'] = 'build/z64.map'
|
||||
config['myimg'] = 'zelda_ocarina_mq_dbg.z64'
|
||||
config['mapfile'] = 'build/gc-eu-mq-dbg/z64.map'
|
||||
config['myimg'] = 'oot-gc-eu-mq-dbg.z64'
|
||||
config['baseimg'] = 'baserom.z64'
|
||||
config['makeflags'] = []
|
||||
config['source_directories'] = ['src', 'include', 'spec']
|
||||
|
@ -772,7 +772,7 @@ Once preliminary cleanup and struct filling is done, most time spent matching fu
|
||||
In order to use `diff.py` with the symbol names, we need a copy of the code to compare against. This is done by copying the `build` directory into a directory called `expected`. Copying in Windows on WSL is very slow, so run
|
||||
```
|
||||
$ mkdir expected
|
||||
cp -r build/ expected/
|
||||
cp -r build expected/
|
||||
```
|
||||
from the main directory of the repository. You should end up with the directory structure `expected/build/...`.
|
||||
|
||||
@ -914,7 +914,7 @@ It turns out that this is enough to completely fix the diff:
|
||||
|
||||
Everything *looks* fine, but we only know for sure when we run `make`. Thankfully doing so gives
|
||||
```
|
||||
zelda_ocarina_mq_dbg.z64: OK
|
||||
oot-gc-eu-mq-dbg.z64: OK
|
||||
```
|
||||
|
||||
which is either a sense of triumph or relief depending on how long you've spent on a function.
|
||||
|
@ -118,18 +118,18 @@ Now, open the file called `spec` in the base directory, find the section corresp
|
||||
```
|
||||
beginseg
|
||||
name "ovl_En_Tg"
|
||||
include "build/src/overlays/actors/ovl_En_Tg/z_en_tg.o"
|
||||
include "build/data/overlays/actors/z_en_tg.data.o"
|
||||
include "build/data/overlays/actors/z_en_tg.reloc.o"
|
||||
include "$(BUILD_DIR)/src/overlays/actors/ovl_En_Tg/z_en_tg.o"
|
||||
include "$(BUILD_DIR)/data/overlays/actors/z_en_tg.data.o"
|
||||
include "$(BUILD_DIR)/data/overlays/actors/z_en_tg.reloc.o"
|
||||
endseg
|
||||
```
|
||||
and comment out the .data line,
|
||||
```
|
||||
beginseg
|
||||
name "ovl_En_Tg"
|
||||
include "build/src/overlays/actors/ovl_En_Tg/z_en_tg.o"
|
||||
//include "build/data/overlays/actors/z_en_tg.data.o"
|
||||
include "build/data/overlays/actors/z_en_tg.reloc.o"
|
||||
include "$(BUILD_DIR)/src/overlays/actors/ovl_En_Tg/z_en_tg.o"
|
||||
//include "$(BUILD_DIR)/data/overlays/actors/z_en_tg.data.o"
|
||||
include "$(BUILD_DIR)/data/overlays/actors/z_en_tg.reloc.o"
|
||||
endseg
|
||||
```
|
||||
to tell the compiler not to look for the data in that file any more. Now run `make -j`, and if you did both steps correctly, you should get `OK`.
|
||||
@ -262,18 +262,18 @@ First, we tell the compiler to ignore the original data file. To do this, open t
|
||||
```
|
||||
beginseg
|
||||
name "ovl_En_Jj"
|
||||
include "build/src/overlays/actors/ovl_En_Jj/z_en_jj.o"
|
||||
include "build/data/overlays/actors/z_en_jj.data.o"
|
||||
include "build/data/overlays/actors/z_en_jj.reloc.o"
|
||||
include "$(BUILD_DIR)/src/overlays/actors/ovl_En_Jj/z_en_jj.o"
|
||||
include "$(BUILD_DIR)/data/overlays/actors/z_en_jj.data.o"
|
||||
include "$(BUILD_DIR)/data/overlays/actors/z_en_jj.reloc.o"
|
||||
endseg
|
||||
```
|
||||
We will eventually remove both of the bottom two lines and replace them with our own reloc file, but for now, just comment out the data line:
|
||||
```
|
||||
beginseg
|
||||
name "ovl_En_Jj"
|
||||
include "build/src/overlays/actors/ovl_En_Jj/z_en_jj.o"
|
||||
//include "build/data/overlays/actors/z_en_jj.data.o"
|
||||
include "build/data/overlays/actors/z_en_jj.reloc.o"
|
||||
include "$(BUILD_DIR)/src/overlays/actors/ovl_En_Jj/z_en_jj.o"
|
||||
//include "$(BUILD_DIR)/data/overlays/actors/z_en_jj.data.o"
|
||||
include "$(BUILD_DIR)/data/overlays/actors/z_en_jj.reloc.o"
|
||||
endseg
|
||||
```
|
||||
|
||||
@ -557,7 +557,7 @@ Ignore the first line: `gDmaDataTable` is always different if the ROM is shifted
|
||||
|
||||
To fix this, we use a binary diff program. A suitable one is `vbindiff`: run it on the baserom and the zelda_whatever one the compiler generates:
|
||||
```
|
||||
vbindiff baserom.z64 zelda_ocarina_mq_dbg.z64
|
||||
vbindiff baserom.z64 oot-gc-eu-mq-dbg.z64
|
||||
```
|
||||
In this, press `g` to open up goto position, and paste in the address `0xE3ED10` from the first important line of the `first_diff` output. This gives us the following:
|
||||
|
||||
@ -623,7 +623,7 @@ static ColliderCylinderInit sCylinderInit =
|
||||
|
||||
Running `make -j` again,
|
||||
```
|
||||
zelda_ocarina_mq_dbg.z64: OK
|
||||
oot-gc-eu-mq-dbg.z64: OK
|
||||
```
|
||||
|
||||
Hooray, we won!
|
||||
|
@ -26,9 +26,9 @@ Specifically, to use the automatically generated reloc, rather than the original
|
||||
```
|
||||
beginseg
|
||||
name "ovl_En_Jj"
|
||||
include "build/src/overlays/actors/ovl_En_Jj/z_en_jj.o"
|
||||
//include "build/data/overlays/actors/z_en_jj.data.o"
|
||||
include "build/data/overlays/actors/z_en_jj.reloc.o"
|
||||
include "$(BUILD_DIR)/src/overlays/actors/ovl_En_Jj/z_en_jj.o"
|
||||
//include "$(BUILD_DIR)/data/overlays/actors/z_en_jj.data.o"
|
||||
include "$(BUILD_DIR)/data/overlays/actors/z_en_jj.reloc.o"
|
||||
endseg
|
||||
```
|
||||
|
||||
@ -37,8 +37,8 @@ and change to use our reloc:
|
||||
```
|
||||
beginseg
|
||||
name "ovl_En_Jj"
|
||||
include "build/src/overlays/actors/ovl_En_Jj/z_en_jj.o"
|
||||
include "build/src/overlays/actors/ovl_En_Jj/ovl_En_Jj_reloc.o"
|
||||
include "$(BUILD_DIR)/src/overlays/actors/ovl_En_Jj/z_en_jj.o"
|
||||
include "$(BUILD_DIR)/src/overlays/actors/ovl_En_Jj/ovl_En_Jj_reloc.o"
|
||||
endseg
|
||||
```
|
||||
|
||||
|
@ -113,13 +113,13 @@ If in doubt, look at completed objects in the repo, and if still in doubt, ask.
|
||||
Just as when you decomp an actor you have to change the `spec` to tell it to use the new files, you have to do a similar thing for the object. Find the appropriate section for the object you have decompiled, and replace the line
|
||||
|
||||
```c
|
||||
include "build/baserom/object_name.o"
|
||||
include "$(BUILD_DIR)/baserom/object_name.o"
|
||||
```
|
||||
|
||||
by
|
||||
|
||||
```c
|
||||
include "build/assets/objects/object_name/object_name.o"
|
||||
include "$(BUILD_DIR)/assets/objects/object_name/object_name.o"
|
||||
number 6
|
||||
```
|
||||
|
||||
|
@ -83,7 +83,7 @@ to extract the contents of the object into the new folder, change the spec to us
|
||||
beginseg
|
||||
name "object_bg"
|
||||
romalign 0x1000
|
||||
include "build/baserom/object_bg.o"
|
||||
include "$(BUILD_DIR)/baserom/object_bg.o"
|
||||
endseg
|
||||
```
|
||||
|
||||
@ -93,7 +93,7 @@ to
|
||||
beginseg
|
||||
name "object_bg"
|
||||
romalign 0x1000
|
||||
include "build/assets/objects/object_bg/object_bg.o"
|
||||
include "$(BUILD_DIR)/assets/objects/object_bg/object_bg.o"
|
||||
number 6
|
||||
endseg
|
||||
```
|
||||
|
@ -50,7 +50,7 @@ You can create a `.vscode/c_cpp_properties.json` file with `C/C++: Edit Configur
|
||||
"includePath": [ // Matches makefile's includes
|
||||
"${workspaceFolder}/**",
|
||||
"src",
|
||||
"build",
|
||||
"build/gc-eu-mq-dbg",
|
||||
"include"
|
||||
],
|
||||
"defines": [
|
||||
|
@ -39,14 +39,14 @@ def firstDiffMain():
|
||||
parser = argparse.ArgumentParser(description="Find the first difference(s) between the built ROM and the base ROM.")
|
||||
|
||||
parser.add_argument("-c", "--count", type=int, default=5, help="find up to this many instruction difference(s)")
|
||||
parser.add_argument("-v", "--version", help="Which version should be processed", default="mq_dbg")
|
||||
parser.add_argument("-v", "--version", help="Which version should be processed", default="gc-eu-mq-dbg")
|
||||
parser.add_argument("-a", "--add-colons", action='store_true', help="Add colon between bytes" )
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
buildFolder = Path("build")
|
||||
buildFolder = Path("build") / args.version
|
||||
|
||||
BUILTROM = Path(f"zelda_ocarina_{args.version}.z64")
|
||||
BUILTROM = Path(f"oot-{args.version}.z64")
|
||||
BUILTMAP = buildFolder / f"z64.map"
|
||||
|
||||
EXPECTEDROM = Path("baserom.z64")
|
||||
|
@ -29,7 +29,7 @@ APPLY_OPTS = "--format --style=file"
|
||||
|
||||
# Compiler options used with Clang-Tidy
|
||||
# Normal warnings are disabled with -Wno-everything to focus only on tidying
|
||||
INCLUDES = "-Iinclude -Isrc -Ibuild -I."
|
||||
INCLUDES = "-Iinclude -Isrc -Ibuild/gc-eu-mq-dbg -I."
|
||||
DEFINES = "-D_LANGUAGE_C -DNON_MATCHING"
|
||||
COMPILER_OPTS = f"-fno-builtin -std=gnu90 -m32 -Wno-everything {INCLUDES} {DEFINES}"
|
||||
|
||||
|
@ -59,10 +59,10 @@ def GetNonMatchingSize(path):
|
||||
return size
|
||||
|
||||
def IsCFile(objfile):
|
||||
srcfile = objfile.strip().replace("build/", "").replace(".o", ".c")
|
||||
srcfile = objfile.strip().replace("build/gc-eu-mq-dbg/", "").replace(".o", ".c")
|
||||
return os.path.isfile(srcfile)
|
||||
|
||||
mapFile = ReadAllLines("build/z64.map")
|
||||
mapFile = ReadAllLines("build/gc-eu-mq-dbg/z64.map")
|
||||
curSegment = None
|
||||
src = 0
|
||||
code = 0
|
||||
@ -86,7 +86,7 @@ for line in mapFile:
|
||||
objFile = lineSplit[3]
|
||||
|
||||
if (section == ".text" and IsCFile(objFile)):
|
||||
if objFile.startswith("build/src"):
|
||||
if objFile.startswith("build/gc-eu-mq-dbg/src"):
|
||||
src += size
|
||||
|
||||
if curSegment == "code":
|
||||
|
@ -17,7 +17,7 @@ def symInfoMain():
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
BUILTMAP = Path(f"build") / f"z64.map"
|
||||
BUILTMAP = Path(f"build") / "gc-eu-mq-dbg" / f"z64.map"
|
||||
|
||||
mapPath = BUILTMAP
|
||||
if args.use_expected:
|
||||
|
@ -10,7 +10,7 @@ gAddressWidth = 18 # if your ld >= 2.40 change this to 10
|
||||
script_dir = os.path.dirname(os.path.realpath(__file__))
|
||||
root_dir = script_dir + "/../"
|
||||
asm_dir = root_dir + "asm/non_matchings/overlays/actors"
|
||||
build_dir = root_dir + "build/"
|
||||
build_dir = root_dir + "build/gc-eu-mq-dbg/"
|
||||
|
||||
def read_rom():
|
||||
with open("baserom.z64", "rb") as f:
|
||||
|
@ -1,40 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
shopt -s globstar
|
||||
|
||||
ls asm/non_matchings/**/*.s > old_list.txt
|
||||
grep GLOBAL_ASM -r src | cut -d '"' -f2 - > cur_list.txt
|
||||
|
||||
grep -F "build/data" spec | cut -d '"' -f2 - > data_list.txt
|
||||
grep -F "build/asm" spec | grep -v -E 'overlays' | cut -d '"' -f2 - >> data_list.txt
|
||||
|
||||
ls data/**/*.s > old_data_list.txt
|
||||
ls asm/*.s >> old_data_list.txt
|
||||
|
||||
while read p; do
|
||||
tmp=${p%.o}.s
|
||||
echo ${tmp#build/} >> list.txt
|
||||
done < data_list.txt
|
||||
|
||||
comm -3 <(sort old_list.txt) <(sort cur_list.txt) > diff.txt
|
||||
comm -3 <(sort old_data_list.txt) <(sort list.txt) >> diff.txt
|
||||
|
||||
rm old_list.txt cur_list.txt old_data_list.txt data_list.txt list.txt
|
||||
|
||||
if [ "$1" = "-d" ]
|
||||
then
|
||||
if [ -s diff.txt ]
|
||||
then
|
||||
rm $(cat diff.txt)
|
||||
fi
|
||||
rm diff.txt
|
||||
else
|
||||
if [ -s diff.txt ]
|
||||
then
|
||||
cat diff.txt
|
||||
rm diff.txt
|
||||
exit 55
|
||||
else
|
||||
rm diff.txt
|
||||
fi
|
||||
fi
|
Loading…
Reference in New Issue
Block a user