diff --git a/.gitignore b/.gitignore index a9cf9c898..97da1e5c0 100644 --- a/.gitignore +++ b/.gitignore @@ -58,7 +58,6 @@ Temporary Items *.gba *.elf *.map -objects.lst *.o src/*.s *.dump diff --git a/Makefile b/Makefile index 0949f4e4b..6a65abe8f 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,18 @@ #### Tools #### +COMPARE ?= 0 +MODERN ?= 0 + +ifeq (,$(MAKECMDGOALS)) + COMPARE := 1 +else ifeq (compare,$(MAKECMDGOALS)) + COMPARE := 1 +endif + +ifeq (modern,$(MAKECMDGOALS)) + MODERN := 1 +endif + ifeq ($(OS),Windows_NT) EXE := .exe else @@ -11,20 +24,37 @@ UNAME := $(shell uname) TOOLCHAIN ?= $(DEVKITARM) PREFIX ?= arm-none-eabi- -export PATH := $(TOOLCHAIN)/bin:$(PATH) +ifneq (,$(TOOLCHAIN)) + ifneq (,$(wildcard $(TOOLCHAIN)/bin)) + export PATH := $(TOOLCHAIN)/bin:$(PATH) + endif +endif ifeq ($(UNAME),Darwin) - SHELL := env PATH=$(PATH) /bin/bash + SHELL := env PATH=$(PATH) /bin/bash endif -CPP ?= $(PREFIX)cpp$(EXE) +ifeq ($(MODERN),0) + CPP ?= $(PREFIX)cpp$(EXE) +else + CPP := $(PREFIX)cpp$(EXE) +endif AS := $(PREFIX)as$(EXE) LD := $(PREFIX)ld$(EXE) OBJCOPY := $(PREFIX)objcopy$(EXE) STRIP := $(PREFIX)strip$(EXE) -CC1 := tools/agbcc/bin/agbcc$(EXE) -CC1_OLD := tools/agbcc/bin/old_agbcc$(EXE) +# note: the makefile must be set up so MODERNCC is never called +# if MODERN=0 +MODERNCC := $(PREFIX)gcc$(EXE) +PATH_MODERNCC := PATH="$(PATH)" $(MODERNCC) + +ifeq ($(MODERN),0) + CC1 := tools/agbcc/bin/agbcc$(EXE) + CC1_OLD := tools/agbcc/bin/old_agbcc$(EXE) +else + CC1 := $(shell $(PATH_MODERNCC) -print-prog-name=cc1) -quiet +endif BIN2C := tools/bin2c/bin2c$(EXE) GBAGFX := tools/gbagfx/gbagfx$(EXE) @@ -35,90 +65,193 @@ TEXTENCODE := tools/textencode/textencode$(EXE) JSONPROC := tools/jsonproc/jsonproc$(EXE) ifeq ($(UNAME),Darwin) - SED := sed -i '' + SED := sed -i '' else - SED := sed -i + SED := sed -i endif ifeq ($(UNAME),Darwin) - SHASUM := shasum + SHASUM := shasum else - SHASUM := sha1sum + SHASUM := sha1sum endif -CC1FLAGS := -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex-asm -ffix-debug-line -g -CPPFLAGS := -I tools/agbcc/include -iquote include -iquote . -nostdinc -undef -ASFLAGS := -mcpu=arm7tdmi -mthumb-interwork -I include +ifeq ($(MODERN),0) + CC1FLAGS := -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex-asm -ffix-debug-line -g +else + CC1FLAGS := -mthumb -mthumb-interwork -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Werror -g +endif +CPPFLAGS := -iquote include -iquote . -DMODERN=$(MODERN) +ifeq ($(MODERN),0) + CPPFLAGS += -I tools/agbcc/include -nostdinc -undef +endif +ASFLAGS := -mcpu=arm7tdmi -mthumb-interwork -I include #### Files #### +ROM_NAME := fireemblem8.gba +ELF_NAME := $(ROM_NAME:.gba=.elf) +MAP_NAME := $(ROM_NAME:.gba=.map) +BUILD_DIR_NAME := build/fe8u + +MODERN_ROM_NAME := fireemblem8_modern.gba +MODERN_ELF_NAME := $(MODERN_ROM_NAME:.gba=.elf) +MODERN_MAP_NAME := $(MODERN_ROM_NAME:.gba=.map) +MODERN_BUILD_DIR_NAME := build/modern + +ifeq ($(MODERN),0) + BUILD_DIR := $(BUILD_DIR_NAME) +else + BUILD_DIR := $(MODERN_BUILD_DIR_NAME) +endif + C_SUBDIR = src ASM_SUBDIR = asm DATA_SUBDIR = data DATA_SRC_SUBDIR = src/data +SOUND_SUBDIR = sound SAMPLE_SUBDIR = sound/direct_sound_samples MID_SUBDIR = sound/songs/midi +BANIM_SUBDIR = data/banim + +C_BUILDDIR = $(BUILD_DIR)/$(C_SUBDIR) +ASM_BUILDDIR = $(BUILD_DIR)/$(ASM_SUBDIR) +DATA_BUILDDIR = $(BUILD_DIR)/$(DATA_SUBDIR) +SOUND_BUILDDIR = $(BUILD_DIR)/$(SOUND_SUBDIR) +MID_BUILDDIR = $(BUILD_DIR)/$(MID_SUBDIR) -ROM := fireemblem8.gba -ELF := $(ROM:.gba=.elf) -MAP := $(ROM:.gba=.map) -LDSCRIPT := ldscript.txt -SYM_FILES := sym_iwram.txt -CFILES_GENERATED := $(C_SUBDIR)/msg_data.c -CFILES := $(wildcard $(C_SUBDIR)/*.c) -ifeq (,$(findstring $(CFILES_GENERATED),$(CFILES))) -CFILES += $(CFILES_GENERATED) -endif -ASM_S_FILES := $(wildcard $(ASM_SUBDIR)/*.s) -DATA_S_FILES := $(wildcard $(DATA_SUBDIR)/*.s) -SOUND_S_FILES := $(wildcard sound/*.s sound/songs/*.s sound/songs/mml/*.s sound/voicegroups/*.s) -SFILES := $(ASM_S_FILES) $(DATA_S_FILES) $(SOUND_S_FILES) -C_OBJECTS := $(CFILES:.c=.o) -ASM_OBJECTS := $(SFILES:.s=.o) -BANIM_OBJECT := data/banim/data_banim.o -MID_FILES := $(wildcard $(MID_SUBDIR)/*.mid) -MID_OBJECTS := $(MID_FILES:.mid=.o) -ALL_OBJECTS := $(C_OBJECTS) $(ASM_OBJECTS) $(BANIM_OBJECT) $(MID_OBJECTS) -OBJECTS_LST := objects.lst -DEPS_DIR := .dep +ifeq ($(MODERN),0) + ROM := $(ROM_NAME) +else + ROM := $(MODERN_ROM_NAME) +endif +ELF := $(ROM:.gba=.elf) +MAP := $(ROM:.gba=.map) +ifeq ($(MODERN),0) + LDSCRIPT := ldscript.txt + SYM_FILES := sym_iwram.txt + LDSCRIPT_DEPS := linker_script_sound.txt $(SYM_FILES) +else + LDSCRIPT := ldscript_modern.txt + LDSCRIPT_DEPS := +endif + +C_FILES_GENERATED := $(C_SUBDIR)/msg_data.c + +LDSCRIPT_BUILD := $(BUILD_DIR)/$(LDSCRIPT) +LDSCRIPT_DEPS_BUILD := $(foreach dep,$(LDSCRIPT_DEPS),$(BUILD_DIR)/$(dep)) + +BANIM_OBJECT := $(BANIM_SUBDIR)/data_banim.o +BANIM_OBJECT_BUILD := $(BUILD_DIR)/$(BANIM_OBJECT) + +OBJECTS_LST := objects.lst +OBJECTS_LST_BUILD := $(BUILD_DIR)/$(OBJECTS_LST) + +DEPS_DIR := $(BUILD_DIR)/.dep + +# check if we need to scan dependencies based on the rule +ifeq (,$(MAKECMDGOALS)) + SCAN_DEPS ?= 1 +else + # clean, tidy, tidymodern, tidynonmodern don't even build the ROM + ifeq (,$(filter-out clean tidy tidymodern tidynonmodern,$(MAKECMDGOALS))) + SCAN_DEPS ?= 0 + else + SCAN_DEPS ?= 1 + endif +endif + +ifneq ($(SCAN_DEPS),0) + C_FILES := $(wildcard $(C_SUBDIR)/*.c) + ifeq (,$(findstring $(C_FILES_GENERATED),$(C_FILES))) + C_FILES += $(C_FILES_GENERATED) + endif + C_OBJECTS := $(patsubst $(C_SUBDIR)/%.c,$(C_BUILDDIR)/%.o,$(C_FILES)) + + ASM_S_FILES := $(wildcard $(ASM_SUBDIR)/*.s) + ASM_OBJECTS := $(patsubst $(ASM_SUBDIR)/%.s,$(ASM_BUILDDIR)/%.o,$(ASM_S_FILES)) + + DATA_S_FILES := $(wildcard $(DATA_SUBDIR)/*.s $(BANIM_SUBDIR)/*.s) + DATA_OBJECTS := $(patsubst $(DATA_SUBDIR)/%.s,$(DATA_BUILDDIR)/%.o,$(DATA_S_FILES)) + + SOUND_S_FILES := $(wildcard $(SOUND_SUBDIR)/*.s $(SOUND_SUBDIR)/songs/*.s $(SOUND_SUBDIR)/songs/mml/*.s $(SOUND_SUBDIR)/voicegroups/*.s) + SOUND_OBJECTS := $(patsubst $(SOUND_SUBDIR)/%.s,$(SOUND_BUILDDIR)/%.o,$(SOUND_S_FILES)) + + MID_FILES := $(wildcard $(MID_SUBDIR)/*.mid) + MID_OBJECTS := $(patsubst $(MID_SUBDIR)/%.mid,$(MID_BUILDDIR)/%.o,$(MID_FILES)) + + ALL_OBJECTS := $(C_OBJECTS) $(ASM_OBJECTS) $(DATA_OBJECTS) $(BANIM_OBJECT_BUILD) $(SOUND_OBJECTS) $(MID_OBJECTS) + OBJECTS_RELATIVE := $(patsubst $(BUILD_DIR)/%,%,$(ALL_OBJECTS)) + + SUBDIRS := $(sort $(dir $(ALL_OBJECTS))) + $(shell mkdir -p $(SUBDIRS)) + + BANIM_OBJECTS_DIRS := $(addprefix $(BUILD_DIR)/,$(sort $(dir $(shell ./scripts/arm_compressing_linker.py -t linker_script_banim.txt -m)))) + $(shell mkdir -p $(BANIM_OBJECTS_DIRS)) +endif AUTO_GEN_TARGETS := +ifeq ($(MODERN),0) # Use the older compiler to build library code -src/agb_sram.o: CC1FLAGS := -mthumb-interwork -Wimplicit -Wparentheses -Werror -O1 -ffix-debug-line -g -src/m4a.o: CC1 := $(CC1_OLD) +$(C_BUILDDIR)/agb_sram.o: CC1FLAGS := -mthumb-interwork -Wimplicit -Wparentheses -Werror -O1 -ffix-debug-line -g +$(C_BUILDDIR)/m4a.o: CC1 := $(CC1_OLD) +else +$(C_BUILDDIR)/bmpatharrowdisp.o: CC1FLAGS += -Wno-stringop-overflow +$(C_BUILDDIR)/cursor_hand.o: CC1FLAGS += -Wno-aggressive-loop-optimizations +$(C_BUILDDIR)/m4a.o: CC1FLAGS += -Wno-pointer-to-int-cast +endif # TODO: find a more elegant solution to the inlining issue -src/bmitem.o: CC1FLAGS += -Wno-error +$(C_BUILDDIR)/bmitem.o: CC1FLAGS += -Wno-error #### Main Targets #### -compare: $(ROM) +# Clear the default suffixes +.SUFFIXES: + +# Don't delete intermediate files +.SECONDARY: + +# Secondary expansion is required for dependency variables in object rules. +.SECONDEXPANSION: + +.PHONY: rom compare modern clean tidy tidynonmodern tidymodern tag + +rom: $(ROM) +ifneq ($(COMPARE),0) $(SHASUM) -c checksum.sha1 +endif + +compare: rom -.PHONY: compare +modern: rom -clean: +clean: tidy find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.fk' -o -iname '*.latfont' -o -iname '*.hwjpnfont' -o -iname '*.fwjpnfont' \) -exec rm {} + - $(RM) $(ROM) $(ELF) $(MAP) $(ALL_OBJECTS) $(OBJECTS_LST) src/*.s graphics/*.h $(CFILES_GENERATED) - $(RM) -rf $(DEPS_DIR) - # Remove battle animation binaries - $(RM) -f data/banim/*.bin data/banim/*.o data/banim/*.lz data/banim/*.bak + $(RM) graphics/*.h $(C_FILES_GENERATED) # Remove converted sound samples $(RM) -f $(SAMPLE_SUBDIR)/*.bin # Remove converted songs $(RM) -f $(MID_SUBDIR)/*.s $(RM) -f $(AUTO_GEN_TARGETS) -.PHONY: clean +tidy: tidynonmodern tidymodern + $(RM) -rf build + +tidynonmodern: + $(RM) -f $(ROM_NAME) $(ELF_NAME) $(MAP_NAME) + $(RM) -rf $(BUILD_DIR_NAME) + +tidymodern: + $(RM) -f $(MODERN_ROM_NAME) $(MODERN_ELF_NAME) $(MODERN_MAP_NAME) + $(RM) -rf $(MODERN_BUILD_DIR_NAME) tag: gtags ctags -R cscope -Rbkq -.PHONY: tag - # Graphics Recipes include graphics_file_rules.mk @@ -145,8 +278,8 @@ sound/%.bin: sound/%.aif ; $(AIF2PCM) $< $@ # Battle Animation Recipes -$(BANIM_OBJECT): $(shell ./scripts/arm_compressing_linker.py -t linker_script_banim.txt -m) - ./scripts/arm_compressing_linker.py -o $@ -t linker_script_banim.txt -b 0x8c02000 -l $(LD) --objcopy $(OBJCOPY) -c ./scripts/compressor.py +$(BANIM_OBJECT_BUILD): $(shell ./scripts/arm_compressing_linker.py -t linker_script_banim.txt -m --build-dir $(BUILD_DIR)) + ./scripts/arm_compressing_linker.py -o $@ -t linker_script_banim.txt -b 0x8c02000 -l $(LD) --objcopy $(OBJCOPY) -c ./scripts/compressor.py --build-dir $(BUILD_DIR) %_modes.bin: %_motion.o $(OBJCOPY) -O binary -j .data.modes $< $@ @@ -159,75 +292,75 @@ $(BANIM_OBJECT): $(shell ./scripts/arm_compressing_linker.py -t linker_script_ba #### Recipes #### -# Automatic dependency generation -MAKEDEP = mkdir -p $(DEPS_DIR)/$(dir $*) && $(CPP) $(CPPFLAGS) $< -MM -MG -MT $*.o > $(DEPS_DIR)/$*.d - --include $(addprefix $(DEPS_DIR)/,$(CFILES:.c=.d)) +$(OBJECTS_LST_BUILD): $(ALL_OBJECTS) + @echo $(OBJECTS_RELATIVE) > $@ -$(DEPS_DIR)/%.d: %.c - @$(MAKEDEP) +$(LDSCRIPT_BUILD): $(LDSCRIPT) $(LDSCRIPT_DEPS_BUILD) + @cp -f $< $@ -$(OBJECTS_LST): $(ALL_OBJECTS) - @echo $(ALL_OBJECTS) > $@ +$(LDSCRIPT_DEPS_BUILD): $(BUILD_DIR)/%: % + @cp -f $< $@ -$(ELF): $(ALL_OBJECTS) $(OBJECTS_LST) $(LDSCRIPT) $(SYM_FILES) - $(LD) -T $(LDSCRIPT) -Map $(MAP) @$(OBJECTS_LST) -R $(BANIM_OBJECT).sym.o -L tools/agbcc/lib -o $@ -lc -lgcc +$(ELF): $(ALL_OBJECTS) $(OBJECTS_LST_BUILD) $(LDSCRIPT_BUILD) $(LDSCRIPT_DEPS_BUILD) + cd $(BUILD_DIR) && $(LD) -T $(LDSCRIPT) -Map ../../$(MAP) @$(OBJECTS_LST) -R $(BANIM_OBJECT).sym.o -L ../../tools/agbcc/lib -o ../../$@ -lc -lgcc $(STRIP) -N .gcc2_compiled. $@ -%.gba: %.elf +$(ROM): $(ELF) $(OBJCOPY) --strip-debug -O binary --pad-to 0x9000000 --gap-fill=0xff $< $@ # Generate msg_data.c -src/msg_data.c: msg_list.txt +$(C_SUBDIR)/msg_data.c: msg_list.txt $(TEXTENCODE) $< $@ -$(C_OBJECTS): %.o: %.c $(DEPS_DIR)/%.d - @$(MAKEDEP) - $(CPP) $(CPPFLAGS) $< | iconv -f UTF-8 -t CP932 | $(CC1) $(CC1FLAGS) -o $*.s - echo '.ALIGN 2, 0' >> $*.s -ifeq ($(UNAME),Darwin) - $(SED) -f scripts/align_2_before_debug_section_for_osx.sed $*.s -else - $(SED) '/.section .debug_line/i\.align 2, 0' $*.s -endif - $(AS) $(ASFLAGS) $*.s -o $@ +ifneq ($(SCAN_DEPS),0) -ifeq ($(NODEP),1) -asm/%.o: data_dep := -else -asm/%.o: data_dep = $(shell $(SCANINC) -I include -I "" $*.s) -endif +# Automatic dependency generation +MAKE_C_DEP = mkdir -p $(DEPS_DIR)/$(C_SUBDIR)/$(dir $*) && $(CPP) $(CPPFLAGS) $< -MM -MG -MT $(C_BUILDDIR)/$*.o > $(DEPS_DIR)/$(C_SUBDIR)/$*.d +MAKE_ASM_DEP = mkdir -p $(DEPS_DIR)/$(ASM_SUBDIR)/$(dir $*) && echo "$(ASM_BUILDDIR)/$*.o:" > $(DEPS_DIR)/$(ASM_SUBDIR)/$*.d && $(SCANINC) -I include -I "" $< >> $(DEPS_DIR)/$(ASM_SUBDIR)/$*.d && $(SED) ':a;N;$$!ba;s/\n/ /g' $(DEPS_DIR)/$(ASM_SUBDIR)/$*.d +MAKE_DATA_DEP = mkdir -p $(DEPS_DIR)/$(DATA_SUBDIR)/$(dir $*) && echo "$(DATA_BUILDDIR)/$*.o:" > $(DEPS_DIR)/$(DATA_SUBDIR)/$*.d && $(SCANINC) -I include -I "" $< >> $(DEPS_DIR)/$(DATA_SUBDIR)/$*.d && $(SED) ':a;N;$$!ba;s/\n/ /g' $(DEPS_DIR)/$(DATA_SUBDIR)/$*.d +MAKE_SOUND_DEP = mkdir -p $(DEPS_DIR)/$(SOUND_SUBDIR)/$(dir $*) && echo "$(SOUND_BUILDDIR)/$*.o:" > $(DEPS_DIR)/$(SOUND_SUBDIR)/$*.d && $(SCANINC) -I include -I "" $< >> $(DEPS_DIR)/$(SOUND_SUBDIR)/$*.d && $(SED) ':a;N;$$!ba;s/\n/ /g' $(DEPS_DIR)/$(SOUND_SUBDIR)/$*.d -ifeq ($(NODEP),1) -src/%.o: data_dep := -else -src/%.o: data_dep = $(shell $(SCANINC) -I include -I "" $*.s) -endif +-include $(addprefix $(DEPS_DIR)/,$(C_FILES:.c=.d)) +-include $(addprefix $(DEPS_DIR)/,$(ASM_S_FILES:.s=.d)) +-include $(addprefix $(DEPS_DIR)/,$(DATA_S_FILES:.s=.d)) +-include $(addprefix $(DEPS_DIR)/,$(SOUND_S_FILES:.s=.d)) -ifeq ($(NODEP),1) -data/%.o: data_dep := -else -data/%.o: data_dep = $(shell $(SCANINC) -I include -I "" $*.s) -endif +$(DEPS_DIR)/$(C_SUBDIR)/%.d: $(C_SUBDIR)/%.c + @$(MAKE_C_DEP) -ifeq ($(NODEP),1) -banim/%.o: data_dep := -else -banim/%.o: data_dep = $(shell $(SCANINC) -I include -I "" $*.s) -endif +$(DEPS_DIR)/$(ASM_SUBDIR)/%.d: $(ASM_SUBDIR)/%.s + @$(MAKE_ASM_DEP) + +$(DEPS_DIR)/$(DATA_SUBDIR)/%.d: $(DATA_SUBDIR)/%.s + @$(MAKE_DATA_DEP) -ifeq ($(NODEP),1) -sound/%.o: data_dep := +$(DEPS_DIR)/$(SOUND_SUBDIR)/%.d: $(SOUND_SUBDIR)/%.s + @$(MAKE_SOUND_DEP) + +$(C_BUILDDIR)/%.o: $(C_SUBDIR)/%.c $(DEPS_DIR)/$(C_SUBDIR)/%.d + @$(MAKE_C_DEP) + $(CPP) $(CPPFLAGS) $< | iconv -f UTF-8 -t CP932 | $(CC1) $(CC1FLAGS) -o $(C_BUILDDIR)/$*.s + echo '.ALIGN 2, 0' >> $(C_BUILDDIR)/$*.s +ifeq ($(UNAME),Darwin) + $(SED) -f scripts/align_2_before_debug_section_for_osx.sed $(C_BUILDDIR)/$*.s else -sound/%.o: data_dep = $(shell $(SCANINC) -I include -I "" $*.s) + $(SED) '/.section .debug_line/i\.align 2, 0' $(C_BUILDDIR)/$*.s endif + $(AS) $(ASFLAGS) $(C_BUILDDIR)/$*.s -o $@ -.SECONDEXPANSION: -$(ASM_OBJECTS): %.o: %.s $$(data_dep) +$(ASM_OBJECTS): $(ASM_BUILDDIR)/%.o: $(ASM_SUBDIR)/%.s $(DEPS_DIR)/$(ASM_SUBDIR)/%.d $$(data_dep) + @$(MAKE_ASM_DEP) $(AS) $(ASFLAGS) -g $< -o $@ -# Don't delete intermediate files -.SECONDARY: +$(DATA_OBJECTS): $(DATA_BUILDDIR)/%.o: $(DATA_SUBDIR)/%.s $(DEPS_DIR)/$(DATA_SUBDIR)/%.d $$(data_dep) + @$(MAKE_DATA_DEP) + $(AS) $(ASFLAGS) -g $< -o $@ + +$(SOUND_OBJECTS): $(SOUND_BUILDDIR)/%.o: $(SOUND_SUBDIR)/%.s $(DEPS_DIR)/$(SOUND_SUBDIR)/%.d $$(data_dep) + @$(MAKE_SOUND_DEP) + $(AS) $(ASFLAGS) -g $< -o $@ + +endif # SCAN_DEPS # debug print, to use, call "make print-(your label here)" print-% : ; $(info $* is a $(flavor $*) variable set to [$($*)]) @true diff --git a/data/fonts/glyphs_1.h b/data/fonts/glyphs_1.h index 93a8a1ad1..8d57c6943 100644 --- a/data/fonts/glyphs_1.h +++ b/data/fonts/glyphs_1.h @@ -1,4 +1,4 @@ -struct Glyph gUnknown_08589C9C = +CONST_DATA struct Glyph gUnknown_08589C9C = { .sjisNext = NULL, .sjisByte1 = 0, diff --git a/data/fonts/glyphs_2.h b/data/fonts/glyphs_2.h index 80a18677d..bd8f03911 100644 --- a/data/fonts/glyphs_2.h +++ b/data/fonts/glyphs_2.h @@ -1,4 +1,4 @@ -struct Glyph gUnknown_0858CBEC = +CONST_DATA struct Glyph gUnknown_0858CBEC = { .sjisNext = NULL, .sjisByte1 = 0, diff --git a/include/bmarch.h b/include/bmarch.h index 9a626c426..08d2e46ae 100644 --- a/include/bmarch.h +++ b/include/bmarch.h @@ -7,11 +7,11 @@ int GetSomeBallistaItemAt(int xPos, int yPos); struct Trap* AddBallista(int xPos, int yPos, int ballistaType); void RideBallista(struct Unit* unit); void TryRemoveUnitFromBallista(struct Unit* unit); -s8 IsBallista(struct Trap* trap); +s32 IsBallista(struct Trap* trap); int sub_8037AC0(struct Trap* trap); int sub_8037AEC(struct Trap* trap); int GetBallistaItemUses(struct Trap* trap); -// ??? ClearBallistaOccupied(???); -// ??? SetBallistaOccupied(???); +void ClearBallistaOccupied(struct Trap* trap); +void SetBallistaOccupied(struct Trap* trap); #endif // GUARD_BMARCH_H diff --git a/include/bmguide.h b/include/bmguide.h index 8e54e4d9b..405da2277 100644 --- a/include/bmguide.h +++ b/include/bmguide.h @@ -31,14 +31,8 @@ struct GuideSt /* 3D */ u8 unk_3d; /* 3E */ u8 unk_3e; /* 3F */ u8 numDetailLines; - /* 40 */ u8 unk_40[5]; - - /* 45 */ STRUCT_PAD(0x45, 0x54); - - /* 54 */ u8 unk_54[5]; // size unknown - - /* 59 */ STRUCT_PAD(0x59, 0x68); - + /* 40 */ u8 unk_40[20]; + /* 54 */ u8 unk_54[20]; /* 68 */ u8 unk_68[5]; /* 6D */ STRUCT_PAD(0x6d, 0x7c); diff --git a/include/bmmenu.h b/include/bmmenu.h index 43bdc4303..a368e25f6 100644 --- a/include/bmmenu.h +++ b/include/bmmenu.h @@ -74,7 +74,7 @@ int Menu_SwitchIn(struct MenuProc * menu, struct MenuItemProc * menuItem); int Menu_SwitchOut_DoNothing(struct MenuProc * menu, struct MenuItemProc * menuItem); void sub_80234AC(int x, int y); void ItemSubMenuEnd(struct MenuProc * menu); -u8 MenuCommand_SelectNo(struct MenuProc * menu, struct MenuItemProc * menuItem); +u8 MenuCommand_SelectNo(struct MenuProc * menu/*, struct MenuItemProc * menuItem*/); u8 sub_8023538(struct MenuProc * menu); u8 sub_8023550(struct MenuProc * menu); u8 sub_80235A8(struct MenuProc * menu); diff --git a/include/bmmind.h b/include/bmmind.h index 0fc21ed48..b943aa771 100644 --- a/include/bmmind.h +++ b/include/bmmind.h @@ -81,7 +81,7 @@ struct DeathDropAnimProc { void StoreRNStateToActionStruct(void); void LoadRNStateFromActionStruct(void); -unsigned int ApplyUnitAction(ProcPtr proc); +u32 ApplyUnitAction(ProcPtr proc); s8 ActionRescue(ProcPtr); int AfterDrop_CheckTrapAfterDropMaybe(struct AfterDropActionProc * proc); int sub_80321C8(void); diff --git a/include/bmsave.h b/include/bmsave.h index 820507044..4133b4c91 100755 --- a/include/bmsave.h +++ b/include/bmsave.h @@ -609,7 +609,7 @@ bool IsMultiArenaSaveReady(); void LoadAndVerfySuspendSave(); // ??? ReadExtraMapSaveHead(???); void const * GetExtraMapMapReadAddr(void); -unsigned GetExtraMapMapSize(void); +u32 GetExtraMapMapSize(void); // ??? GetExtraMapInfoReadAddr(???); // ??? GetExtraMapInfoSize(???); // ??? ExtraMapChecksum(???); diff --git a/include/bmshop.h b/include/bmshop.h index 659f4be89..b6c6829df 100644 --- a/include/bmshop.h +++ b/include/bmshop.h @@ -15,10 +15,7 @@ struct BmShopProc { /* 00 */ PROC_HEADER; /* 2C */ struct Unit* unit; - /* 30 */ u16 shopItems[20]; - - /* 58 */ u16 unk_58; - + /* 30 */ u16 shopItems[21]; /* 5A */ u8 shopItemCount; /* 5B */ u8 unitItemCount; /* 5C */ u8 curIndex; diff --git a/include/bmunit.h b/include/bmunit.h index 0c39c0295..545bf0cce 100644 --- a/include/bmunit.h +++ b/include/bmunit.h @@ -463,6 +463,7 @@ struct Unit* GetUnit(int id); const struct ClassData* GetClassData(int classId); const struct CharacterData* GetCharacterData(int charId); void UnitRemoveItem(struct Unit* unit, int slot); +s32 CanUnitCrossTerrain(struct Unit* unit, int terrain); #define UNIT_IS_VALID(aUnit) ((aUnit) && (aUnit)->pCharacterData) #define UNIT_CHAR_ID(aUnit) ((aUnit)->pCharacterData->number) diff --git a/include/efxbattle.h b/include/efxbattle.h index de5c38d72..6345b90a5 100644 --- a/include/efxbattle.h +++ b/include/efxbattle.h @@ -526,7 +526,7 @@ extern u32 gUnknown_02017750; extern u32 gUnknown_02017754; extern u32 gUnknown_02017758; extern u32 gUnknown_0201775C; -struct Vec2 gEkrBg2QuakeVec; +extern struct Vec2 gEkrBg2QuakeVec; extern s16 gUnknown_02017764[2]; extern s16 gUnknown_02017768[2]; diff --git a/include/event.h b/include/event.h index aaf4c0779..61a48f45d 100644 --- a/include/event.h +++ b/include/event.h @@ -422,7 +422,7 @@ void sub_800F8A8(struct Unit*, const struct UnitDefinition*, u16, s8); u8 Event2B_ConfigLoadUnit(struct EventEngineProc * proc); u8 Event2C_LoadUnits(struct EventEngineProc * proc); u8 TryPrepareEventUnitMovement(struct EventEngineProc * proc, int x, int y); -unsigned ModifyMoveUnitFlag(struct EventEngineProc *, s8); +u32 ModifyMoveUnitFlag(struct EventEngineProc *, s8); u8 Event2D_ChangeSpritePal(struct EventEngineProc * proc); u8 Event2E_CheckAt(struct EventEngineProc * proc); u8 Event2F_MoveUnit(struct EventEngineProc * proc); diff --git a/include/eventcall.h b/include/eventcall.h index 4b1306d69..969ffd06e 100644 --- a/include/eventcall.h +++ b/include/eventcall.h @@ -5,6 +5,7 @@ #include "event.h" #include "uimenu.h" #include "bmtrap.h" +#include "muctrl.h" struct UnkProc80855A0 { PROC_HEADER; diff --git a/include/global.h b/include/global.h index 818af6b99..4a515f6cb 100644 --- a/include/global.h +++ b/include/global.h @@ -2,6 +2,7 @@ #define GUARD_GLOBAL_H #include +#include #include "gba/gba.h" diff --git a/include/menu_def.h b/include/menu_def.h index 7de10076e..b42de7f64 100644 --- a/include/menu_def.h +++ b/include/menu_def.h @@ -4,21 +4,21 @@ struct MenuDef; struct SelectTarget; -extern const struct MenuDef gDebugClearMenuDef; -extern const struct MenuDef gDebugChargeMenuDef; -extern const struct MenuDef gDebugContinueMenuDef; -extern const struct MenuDef gDebugChuudanMenuDef; -extern const struct MenuDef gDebugMenuDef; -extern const struct MenuDef gMenuInfo_RepairItems; -extern const struct MenuDef gStealItemMenuDef; -extern const struct MenuDef gYesNoSelectionMenuDef; -extern const struct MenuDef gItemSubMenuDef; -extern const struct MenuDef gItemMenuDef; -extern const struct MenuDef gStaffItemSelectMenuDef; -extern const struct MenuDef gItemSelectMenuDef; -extern const struct MenuDef gBallistaRangeMenuDef; -extern const struct MenuDef gUnknownMenuDef; -extern const struct MenuDef gUnitActionMenuDef; +extern CONST_DATA struct MenuDef gDebugClearMenuDef; +extern CONST_DATA struct MenuDef gDebugChargeMenuDef; +extern CONST_DATA struct MenuDef gDebugContinueMenuDef; +extern CONST_DATA struct MenuDef gDebugChuudanMenuDef; +extern CONST_DATA struct MenuDef gDebugMenuDef; +extern CONST_DATA struct MenuDef gMenuInfo_RepairItems; +extern CONST_DATA struct MenuDef gStealItemMenuDef; +extern CONST_DATA struct MenuDef gYesNoSelectionMenuDef; +extern CONST_DATA struct MenuDef gItemSubMenuDef; +extern CONST_DATA struct MenuDef gItemMenuDef; +extern CONST_DATA struct MenuDef gStaffItemSelectMenuDef; +extern CONST_DATA struct MenuDef gItemSelectMenuDef; +extern CONST_DATA struct MenuDef gBallistaRangeMenuDef; +extern CONST_DATA struct MenuDef gUnknownMenuDef; +extern CONST_DATA struct MenuDef gUnitActionMenuDef; extern struct SelectInfo CONST_DATA gSelectInfo_OffensiveStaff; extern struct SelectInfo CONST_DATA gSelectInfo_Barrier; diff --git a/include/mu.h b/include/mu.h index ac1cadbfb..5c7155f3f 100644 --- a/include/mu.h +++ b/include/mu.h @@ -169,13 +169,13 @@ void MU_8078524(struct MUProc* proc); void MU_SetFacing(struct MUProc* proc, int facingId); void MU_SetDefaultFacing(struct MUProc* proc); void MU_SetDefaultFacing_Auto(void); -void MU_StartMoveScript_Auto(const u8 commands[MU_COMMAND_MAX_COUNT]); +void MU_StartMoveScript_Auto(const u8 commands[/*MU_COMMAND_MAX_COUNT*/]); s8 MU_Exists(void); s8 MU_IsAnyActive(void); s8 MU_IsActive(struct MUProc* proc); -void MU_StartMoveScript(struct MUProc* proc, const u8 commands[MU_COMMAND_MAX_COUNT]); +void MU_StartMoveScript(struct MUProc* proc, const u8 commands[/*MU_COMMAND_MAX_COUNT*/]); struct MUProc* MU_CreateScripted(u16 x, u16 y, u16 classIndex, unsigned palId, const u8 commands[MU_COMMAND_MAX_COUNT]); diff --git a/include/playerphase.h b/include/playerphase.h index bb3adfe48..c141cb0f6 100644 --- a/include/playerphase.h +++ b/include/playerphase.h @@ -70,7 +70,7 @@ void TrySwitchViewedUnit(int x, int y); void PlayerPhase_HandleAutoEnd(ProcPtr proc); extern const struct MenuDef gMapMenuDef; -extern const struct MenuDef gUnitActionMenuDef; +extern CONST_DATA struct MenuDef gUnitActionMenuDef; extern u16 gUnknown_08A02F34[]; extern u16 gUnknown_08A02F94[]; diff --git a/include/rng.h b/include/rng.h index 8a6f3c26b..5e869ef18 100644 --- a/include/rng.h +++ b/include/rng.h @@ -3,14 +3,14 @@ // rng.c int NextRN(void); -void InitRN(s32 unk1); +void InitRN(s32 seed); void StoreRNState(u16* seeds); void LoadRNState(const u16* seeds); int NextRN_100(void); int NextRN_N(int max); s8 Roll1RN(int threshold); s8 Roll2RN(int threshold); -void SetLCGRNValue(s32 Seed); +void SetLCGRNValue(s32 seed); unsigned AdvanceGetLCGRNValue(void); #endif diff --git a/include/statscreen.h b/include/statscreen.h index 1d9a6fb89..b2bce6965 100644 --- a/include/statscreen.h +++ b/include/statscreen.h @@ -158,11 +158,7 @@ struct HelpBoxInfo /* 18 */ void(*populate)(struct HelpBoxProc* proc); }; -#if !MODERN -#define DECL_INFO struct HelpBoxInfo CONST_DATA -#else -#define DECL_INFO struct HelpBoxInfo const -#endif +#define DECL_INFO CONST_DATA struct HelpBoxInfo int GetLastStatScreenUid(void); void SetLastStatScreenUid(int uid); diff --git a/include/variables.h b/include/variables.h index ec9ab7d21..86a7ed697 100644 --- a/include/variables.h +++ b/include/variables.h @@ -377,7 +377,7 @@ extern struct ProcCmd CONST_DATA ProcScr_0859163C[]; extern const char *gStrPrefix[][2]; //extern struct {u32 *unk0; u32 *unk4; u32 *unk8;} gStrPrefix; -// extern ??? gUnknown_08591AB4 +extern CONST_DATA int gUnknown_08591AB4[]; extern struct ProcCmd CONST_DATA ProcScr_EventFadefx[]; extern struct ProcCmd CONST_DATA ProcScr_ShinningStonefx[]; diff --git a/include/worldmap.h b/include/worldmap.h index 17bf40373..88bc5670b 100644 --- a/include/worldmap.h +++ b/include/worldmap.h @@ -448,8 +448,7 @@ struct GMapData /* 02 */ short xCamera, yCamera; /* 08 */ int ix, iy; /* 10 */ struct GMUnit units[8]; - /* 30 */ struct GMNode nodes[0x1C]; - /* A0 */ int unk_a0; // pad? + /* 30 */ struct GMNode nodes[0x1D]; /* A4 */ struct OpenPaths openPaths; /* C8 */ u8 current_node; // entry node id? /* C9 */ u8 unk_c9[3]; // List of active world map skirmishes diff --git a/json_data_rules.mk b/json_data_rules.mk index c45d32b19..e99c8d59f 100644 --- a/json_data_rules.mk +++ b/json_data_rules.mk @@ -23,8 +23,6 @@ $(MAP_OBJ_ANIM_TARGETS): %.inc: %.json $(DATA_SRC_SUBDIR)/map/obj_anim/map_obj_a $(MAP_PAL_ANIM_TARGETS): %.inc: %.json $(DATA_SRC_SUBDIR)/map/pal_anim/map_pal_anim.json.txt $(JSONPROC) $^ $@ -$(DATA_SUBDIR)/data_map_change.o: data_dep += $(MAP_CHANGE_TARGETS) +$(DATA_BUILDDIR)/data_map_change.o: data_dep += $(MAP_CHANGE_TARGETS) -$(DATA_SUBDIR)/data_map_anim.o: data_dep += $(MAP_OBJ_ANIM_TARGETS) $(MAP_PAL_ANIM_TARGETS) - -$(DATA_SUBDIR)/chapter_map_asset.o: data_dep += $(MAP_CHANGE_TARGETS) $(MAP_OBJ_ANIM_TARGETS) $(MAP_PAL_ANIM_TARGETS) +$(DATA_BUILDDIR)/data_map_anim.o: data_dep += $(MAP_OBJ_ANIM_TARGETS) $(MAP_PAL_ANIM_TARGETS) diff --git a/ldscript_modern.txt b/ldscript_modern.txt new file mode 100644 index 000000000..71e7a5777 --- /dev/null +++ b/ldscript_modern.txt @@ -0,0 +1,1276 @@ +OUTPUT_ARCH(arm) + +MEMORY +{ + rom : ORIGIN = 0x08000000, LENGTH = 32M + iwram : ORIGIN = 0x03000000, LENGTH = 32K + ewram : ORIGIN = 0x02000000, LENGTH = 256K +} + +__text_start = ORIGIN(rom); +__ewram_start = ORIGIN(ewram); +__iwram_start = ORIGIN(iwram); +__iwram_top = ORIGIN(iwram) + LENGTH(iwram); +__sp_irq = __iwram_top - 0x060; +__sp_usr = __sp_irq - 0x1A0; +__irq_flags = 0x03007ff8; + +ENTRY(Init) + +gNumMusicPlayers = 9; +gMaxLines = 0; + +SECTIONS +{ + /* TODO: figure out what is COMMON and .bss */ + + ewram_overlay_0 __ewram_start (NOLOAD) : ALIGN(4) + { + . = 0x000000; gUnk_02000000 = .; + . = 0x000280; gMinimapWinBuf = .; + . = 0x000500; gMinimapFrontWinBuf = .; + . = 0x000504; gMinimapBackWinBuf = .; + . = 0x000508; gMinimapDisplayedWinBuf = .; + . = 0x00050C; gMinimapObjectFlashPal = .; + . = 0x0007A0; gUnknown_020007A0 = .; + . = 0x0007E0; gUnknown_020007E0 = .; + . = 0x000920; gUnknown_02000920 = .; + . = 0x000938; gUnknown_02000938 = .; + . = 0x000940; gUnknown_02000940 = .; + . = 0x000944; gUnknown_02000944 = .; + . = 0x000948; gUnknown_02000948 = .; + . = 0x000968; gBonusClaimData = .; + . = 0x000D68; gBonusClaimDataUpdated = .; + . = 0x000FA0; gUnknown_02000FA0 = .; + . = 0x001000; gBmMapBuffer = .; + . = 0x001168; gBonusClaimItemList = .; + . = 0x001368; gBonusClaimConfig = .; + . = 0x001568; gBonusClaimItemCount = .; + . = 0x001668; gBonusClaimText = .; + . = 0x0017A0; gUnknown_020017A0 = .; + . = 0x001F70; gConvoyItemCount = .; + . = 0x001FA0; gUnknown_02001FA0 = .; + . = 0x002038; gUnknown_02002038 = .; + . = 0x002774; gUnknown_02002774 = .; + . = 0x00278C; gTradeMenuText = .; + . = 0x0027A0; gUnknown_020027A0 = .; + . = 0x0027DC; src/bmio.o(ewram_overlay_0); + . = 0x002FDC; gaBattleForecastTextStructs = .; + . = 0x00300C; gBkselPals = .; + . = 0x00310C; gUnknown_0200310C = .; + . = 0x0038AC; gUnknown_020038AC = .; + . = 0x0038C4; gUnknown_020038C4 = .; + . = 0x0038C8; gUnknown_020038C8 = .; + . = 0x003B08; gUnknown_02003B08 = .; + . = 0x003B48; gUnknown_02003B48 = .; + . = 0x003B70; gUnknown_02003B70 = .; + . = 0x003B88; gUnknown_02003B88 = .; + . = 0x003BA8; gUnknown_02003BA8 = .; + . = 0x003BE8; gUnknown_02003BE8 = .; + . = 0x003BFC; + . = ALIGN(4); src/statscreen.o(ewram_overlay_0); + . = ALIGN(4); src/uichapterstatus.o(ewram_overlay_0); + . = 0x004BE0; gMUGfxBuffer = .; + . = 0x007838; gUnknown_02007838 = .; + . = 0x0078D8; gUnknown_020078D8 = .; + . = 0x008000; gUnknown_02008000 = .; + . = 0x0087A0; gUnknown_020087A0 = .; + . = 0x00A2D8; gUnknown_0200A2D8 = .; + . = 0x00A300; gUnknown_0200A300 = .; + . = 0x00AF00; gUnknown_0200AF00 = .; + . = 0x00C300; gUnknown_0200C300 = .; + . = 0x00CB00; gUnknown_0200CB00 = .; + . = 0x00D3E0; gSortedUnitsBuf = .; + . = 0x00D6E0; gSortedUnits = .; + . = 0x00D7E0; gUnknown_0200D7E0 = .; + . = 0x00DFE0; gUnknown_0200DFE0 = .; + . = 0x00E060; gUnknown_0200E060 = .; + . = 0x00E098; gUnknown_0200E098 = .; + . = 0x00E0A0; gUnknown_0200E0A0 = .; + . = 0x00E0A8; gUnknown_0200E0A8 = .; + . = 0x00E140; gUnknown_0200E140 = .; + . = 0x00E148; gUnknown_0200E148 = .; + . = 0x00E150; gUnknown_0200E150 = .; + . = 0x00E158; gUnknown_0200E158 = .; + . = 0x00F158; gUnknown_0200F158 = .; + . = 0x00F15C; gUnknown_0200F15C = .; + . = 0x00F17C; gStringBufferAlt = .; + . = 0x01117C; gPrepMainMenuTexts = .; + . = 0x0111CC; gPrepUnitPool = .; + . = 0x0121CC; gPrepUnitList = .; + . = 0x0122D4; gPrepScreenItemList = .; + . = 0x012914; gUnknown_02012914 = .; + . = 0x012F54; gUnknown_02012F54 = .; + . = 0x012F56; gUnknown_02012F56 = .; + . = 0x012F58; gUnknown_02012F58 = .; + . = 0x013458; gUnknown_02013458 = .; + . = 0x013460; gUnknown_02013460 = .; + . = 0x013498; gPrepItemTexts = .; + . = 0x013510; gPrepItemScreenTexts = .; + . = 0x013590; gUnknown_02013590 = .; + . = 0x013598; gPrepUnitTexts = .; + . = 0x013648; gUnknown_02013648 = .; + . = 0x013660; gUnknown_02013660 = .; + . = 0x013668; gUnknown_02013668 = .; + . = 0x013670; gUnknown_02013670 = .; + . = 0x013698; gUnknown_02013698 = .; + . = 0x0136D8; gUnknown_020136D8 = .; + . = 0x0136F0; sSupportScreenUnitCount = .; + . = 0x0136F4; gUnknown_020136F4 = .; + . = 0x014EF4; gUnknown_02014EF4 = .; + . = 0x019D00; gUnknown_02019D00 = .; + . = 0x01AFC0; gFont_0201AFC0 = .; + . = 0x01AFF0; gUnknown_0201AFF0 = .; + . = 0x01B0D8; gUnknown_0201B0D8 = .; + . = 0x01B100; gUnknown_0201B100 = .; + . = 0x01B104; gUnknown_0201B104 = .; + . = 0x01B1E4; gUnknown_0201B1E4 = .; + . = 0x01B3A4; gUnknown_0201B3A4 = .; + . = 0x01B430; gUnknown_0201B430 = .; + . = 0x01B458; gUnknown_0201B458 = .; + . = 0x01B718; gUnknown_0201B718 = .; + . = 0x01B71C; gUnknown_0201B71C = .; + . = 0x01B758; gUnknown_0201B758 = .; + . = 0x01B7DA; gUnknown_0201B7DA = .; + . = 0x01B864; gUnknown_0201B864 = .; + . = 0x01B930; gUnknown_0201B930 = .; + . = 0x01B958; gUnknown_0201B958 = .; + . = 0x01BBD8; gUnknown_0201BBD8 = .; + . = 0x01BE30; gWmHblankStatus = .; + . = 0x01BE32; gUnknown_0201BE32 = .; + . = 0x01C5B4; gUnknown_0201C5B4 = .; + . = 0x01C5C0; gUnknown_0201C5C0 = .; + . = 0x01C5CC; gUnknown_0201C5CC = .; + . = 0x01C5CF; gUnknown_0201C5CF = .; + . = 0x01C5D0; gUnknown_0201C5D0 = .; + . = 0x01C5D1; gUnknown_0201C5D1 = .; + . = 0x01C5D4; gUnknown_0201C5D4 = .; + . = 0x01F148; gUnk_SoundRoom_0201F148 = .; + . = 0x01F19C; gSoundRoomVolumeGraphBuffer = .; + } + + ewram_overlay_gamestart __ewram_start (NOLOAD) : ALIGN(4) + { + . = 0x000000; + . = ALIGN(4); src/opinfo.o(ewram_overlay_gamestart); + . = 0x01CDD4; gUnk_OpSubtitle_0201CDD4 = .; + . = 0x01DB00; gUnk_Opinfo_0201DB00 = .; + . = 0x01DB28; gUnk_OpInfo_0201DB28 = .; + . = 0x01FB28; gUnk_OpInfo_0201FB28 = .; + } + + ewram_overlay_banim __ewram_start (NOLOAD) : ALIGN(4) + { + . = ALIGN(4); src/banim-ekrbattle.o(ewram_overlay_banim); + . = ALIGN(4); src/banim-efxlvup.o(ewram_overlay_banim); + . = ALIGN(4); src/banim-ekrdragonstatus.o(ewram_overlay_banim); + . = ALIGN(4); src/banim-efxsound.o(ewram_overlay_banim); + . = ALIGN(4); src/banim-ekrclasschg.o(ewram_overlay_banim); + . = ALIGN(4); src/banim-ekrlvup.o(ewram_overlay_banim); + . = ALIGN(4); src/banim-ekrtriangle.o(ewram_overlay_banim); + . = ALIGN(4); src/banim-ekrpopup.o(ewram_overlay_banim); + . = ALIGN(4); src/banim-ekrdragon-demonking.o(ewram_overlay_banim); + } + + ewram_overlay_sio __ewram_start (NOLOAD) : ALIGN(4) + { + . = 0x000000; gUnk_Sio_02000000 = .; + . = 0x000C60; Font_Sio_02000C60 = .; + . = 0x000C78; gUnk_Sio_02000C78 = .; + . = 0x000F00; gUnk_Sio_02000F00 = .; + . = 0x001180; gUnk_Sio_02001180 = .; + . = 0x001184; gUnk_Sio_02001184 = .; + . = 0x001188; gUnk_Sio_02001188 = .; + } + + ewram_data __ewram_start (NOLOAD) : ALIGN(4) + { + . = 0x20188; gGenericBuffer = .; /* TODO: is this part of hardware.o ? */ + . = 0x22188; gOpAnimSt = .; + . = 0x22288; + . = ALIGN(4); src/hardware.o(ewram_data); + . = ALIGN(4); src/soundwrapper.o(ewram_data); + . = ALIGN(4); src/proc.o(ewram_data); + . = ALIGN(4); src/icon.o(ewram_data); + . = ALIGN(4); src/fontgrp.o(ewram_data); + . = ALIGN(4); src/animedrv.o(ewram_data); + . = ALIGN(4); src/ctc.o(ewram_data); + . = ALIGN(4); src/face.o(ewram_data); + . = ALIGN(4); src/msg.o(ewram_data); + . = ALIGN(4); src/bm.o(ewram_data); + . = ALIGN(4); src/bmunit.o(ewram_data); + . = ALIGN(4); src/bmmap.o(ewram_data); + . = ALIGN(4); src/bmtarget.o(ewram_data); + . = ALIGN(4); src/bmudisp.o(ewram_data); + . = ALIGN(4); src/bmbattle.o(ewram_data); + . = ALIGN(4); src/bmtrade.o(ewram_data); + . = ALIGN(4); src/bmtrick.o(ewram_data); + . = ALIGN(4); src/bmcontainer.o(ewram_data); + . = ALIGN(4); src/bmusort.o(ewram_data); + . = ALIGN(4); src/bmarena.o(ewram_data); + . = ALIGN(4); src/bmmind.o(ewram_data); + . = ALIGN(4); src/bmpatharrowdisp.o(ewram_data); + . = ALIGN(4); src/unitinfowindow.o(ewram_data); + . = ALIGN(4); src/cp_phase.o(ewram_data); + . = ALIGN(4); src/cp_decide.o(ewram_data); + . = ALIGN(4); src/cp_0803E2F4.o(ewram_data); + . = ALIGN(4); src/sio_core.o(ewram_data); + . = 0x3DA24; gLinkArenaSt = .; + . = 0x3DA78; gUnk_Sio_0203DA78 = .; + . = 0x3DA88; gUnk_Sio_0203DA88 = .; + . = 0x3DAB0; Texts_0203DAB0 = .; + . = 0x3DAC0; gUnk_Sio_0203DAC0 = .; + . = 0x3DAC5; gUnk_Sio_0203DAC5 = .; + . = 0x3DB10; gSioSaveConfig = .; + . = 0x3DB14; Texts_0203DB14 = .; + . = 0x3DB1C; gUnk_Sio_0203DB1C = .; + . = 0x3DB64; Font_0203DB64 = .; + . = 0x3DB7C; gLinkArenaTeamList = .; + . = 0x3DC44; gSioResultRankings = .; + . = 0x3DC48; gUnk_Sio_0203DC48 = .; + . = 0x3DD0C; gSioTexts = .; + . = 0x3DD1C; Text_0203DB14 = .; + . = 0x3DD24; gUnk_Sio_0203DD24 = .; + . = 0x3DD28; gUnk_Sio_0203DD28 = .; + . = 0x3DD2C; gKeyInputSequenceBuffer = .; + . = 0x3DD4C; gKeyInputSequenceTimer = .; + . = 0x3DD50; gUnk_Sio_0203DD50 = .; + . = 0x3DD8C; gUnk_Sio_0203DD8C = .; + . = 0x3DD90; gUnk_Sio_0203DD90 = .; + . = 0x3DD94; gUnk_Sio_0203DD94 = .; + . = 0x3DD95; gUnk_Sio_0203DD95 = .; + . = 0x3DD9A; gUnk_Sio_0203DD9A = .; + . = 0x3DD9F; gUnk_Sio_0203DD9F = .; + . = 0x3DDB4; gUnk_Sio_0203DDB4 = .; + . = 0x3DDDC; gUnk_Sio_0203DDDC = .; + . = 0x3DDE0; + . = ALIGN(4); src/uiutils.o(ewram_data); + . = ALIGN(4); src/uiselecttarget.o(ewram_data); + . = ALIGN(4); src/banim-ekrbattle.o(ewram_data); + . = ALIGN(4); src/banim-ekrbattleintro.o(ewram_data); + . = ALIGN(4); src/banim-ekrcmd.o(ewram_data); + . = ALIGN(4); src/banim-ekrarena.o(ewram_data); + . = ALIGN(4); src/banim-efxop.o(ewram_data); + . = ALIGN(4); src/mapanim.o(ewram_data); + . = ALIGN(4); src/mapanim_scanline.o(ewram_data); + . = ALIGN(4); src/statscreen.o(ewram_data); + . = ALIGN(4); src/chapter_title.o(ewram_data); + . = ALIGN(4); src/helpbox.o(ewram_data); + . = ALIGN(4); src/cgtext.o(ewram_data); + . = ALIGN(4); src/prepscreen.o(ewram_data); + . = ALIGN(4); src/bmsave-lib.o(ewram_data); + . = ALIGN(4); src/bmsave-bwl.o(ewram_data); + . = ALIGN(4); src/bmsave.o(ewram_data); + . = ALIGN(4); src/bmsave-multiarena.o(ewram_data); + . = ALIGN(4); src/bmsave-xmap.o(ewram_data); + . = ALIGN(4); src/savemenu.o(ewram_data); + . = ALIGN(4); src/bmshop.o(ewram_data); + . = 0x3EFBC; gLoadUnitBuffer = .; + . = 0x3EFBC; end = .; + } + + IWRAM __iwram_start (NOLOAD) : + ALIGN(4) + { + . = ALIGN(4); src/rng.o(.bss); + + /* hardware.c*/ + . = 0x00000C; gKeyComboResetEN = .; + . = 0x00000D; sModifiedBGs = .; + . = 0x00000E; sModifiedPalette = .; + . = 0x000010; gKeyStatusIgnoredSt = .; + + . = 0x000014; gGameClock = .; + . = 0x000018; gUnknown_03000018 = .; + . = 0x000019; gUnknown_03000019 = .; + . = 0x00001A; gSoftwareResetFlag = .; + . = 0x000020; sOamHi = .; + . = 0x000030; sOamLo = .; + . = 0x000040; + . = ALIGN(4); src/soundwrapper.o(.bss); + . = ALIGN(4); src/scene.o(.bss); + . = 0x000108; src/ap.o(.bss); /* sAPArray = .; */ + . = 0x000428; gUnknown_03000428 = .; + . = 0x000430; gUnknown_03000430 = .; + . = 0x000434; gLoadedUnitBuffer = .; + . = 0x000438; gEventCallQueue = .; + . = 0x0004B8; gEventSlots = .; + . = 0x0004F0; gEventSlotQueue = .; + . = 0x000568; gEventSlotCounter = .; + . = 0x000570; gEventActiveQueue = .; + . = 0x0005B0; gGenericProc = .; + . = 0x0005D0; + . = ALIGN(4); src/popup.o(.bss); + . = ALIGN(4); src/eventscr3.o(.bss); + . = 0x000600; gUnknown_03000600 = .; + . = 0x000700; + . = ALIGN(4); src/eventfx-fade.o(.bss); + . = ALIGN(4); src/bmlib.o(.bss); + . = ALIGN(4); src/bmmap.o(.bss); + . = 0x001780; gDebugChapterModeIndex = .; + . = 0x001788; gUnknown_03001788 = .; + . = 0x0017A0; gDungeonState = .; + . = 0x0017AC; gUnknown_030017AC = .; + . = 0x0017C8; + . = ALIGN(4); src/cp_script.o(.bss); + . = ALIGN(4); src/cp_battle.o(.bss); + . = ALIGN(4); src/sio_core.o(.bss); + . = ALIGN(4); gCurrentKeyInSeqIndex = .; + . = 0x00180C; gTargetKeyInSeqIndex = .; + . = 0x001810; gUnknown_03001810 = .; + . = 0x001818; gUnknown_03001818 = .; + . = 0x00182C; gUnknown_0300182C = .; + . = 0x001830; gUnknown_03001830 = .; + . = 0x001834; gUnknown_03001834 = .; + . = 0x001838; gUnknown_03001838 = .; + . = 0x001840; gUnknown_03001840 = .; + . = 0x001850; gUnknown_03001850 = .; + . = 0x001860; gUnknown_03001860 = .; + . = 0x001864; gUnknown_03001864 = .; + . = 0x001870; + . = ALIGN(4); src/uimenu.o(.bss); + . = 0x0018F0; gUnknown_030018F0 = .; + . = 0x0018F8; + . = ALIGN(4); src/mu.o(.bss); + . = 0x001A30; gEventREDAs = .; + . = 0x001C34; gUnknown_03001C34 = .; + . = 0x001C35; gUnknown_03001C35 = .; + . = 0x001C36; gUnknown_03001C36 = .; + . = 0x001C38; gUnitDef1 = .; + . = 0x001C48; gUnknown_03001C48 = .; + . = 0x001C50; gUnitDef2 = .; + . = 0x001C68; gUnitDefEggHatching = .; + . = 0x001C74; gUnknown_03001C74 = .; + . = 0x001C7C; gUnknown_03001C7C = .; + . = 0x001C80; gActiveEventRegistry = .; + . = 0x001CC0; gUdefCnt = .; + . = 0x001CC8; gUdefREDAs = .; + . = 0x001CE8; gUdefs = .; + . = 0x001D50; gUnknown_03001D50 = .; + . = 0x001DA0; gText_GoldBox = .; + . = 0x001DA8; gUnknown_03001DA8 = .; + . = 0x001DE8; gUnknown_03001DE8 = .; + . = 0x001E30; gUnknown_03001E30 = .; + + . = 0x001E38; + . = ALIGN(4); sound/music_player_table.o(.bss); + + . = 0x002A68; + . = ALIGN(4); src/agb_sram.o(.bss); + . = ALIGN(4); *libc.a:syscalls.o(.bss); + /*. = ALIGN(4); *libgcc.a:dp-bit.o(.bss); + . = ALIGN(4); *libgcc.a:fp-bit.o(.bss);*/ + + /* COMMON */ + . = 0x002C60; SoundMainRAM_Buffer = .; + . = 0x002C61; gUnknown_03002C61 = .; + . = 0x003060; gUnknown_03003060 = .; + . = 0x003070; gOamLoPutIt = .; + . = 0x003070; gOamLoPutIt = .; + . = 0x003080; gLCDControlBuffer = .; + . = 0x0030C8; gOpAnimBgAffineDstData = .; + . = 0x0030D8; gUnknown_030030D8 = .; + . = 0x0030F0; gIRQHandlers = .; + . = 0x003128; gUnknown_03003128 = .; + . = 0x00312C; gOamAffinePutId = .; + . = 0x003130; gUnknown_03003130 = .; + . = 0x003134; sHBlankHandler1 = .; + . = 0x003140; gOam = .; + . = 0x003740; gUnknown_03003740 = .; + . = 0x003744; gOamHiPutIt = .; + . = 0x003748; sHBlankHandler2 = .; + . = 0x003750; gUnknown_03003750 = .; + . = 0x004150; gUnknown_03004150 = .; + . = 0x004154; gUnknown_03004154 = .; + . = 0x004158; gOamAffinePutIt = .; + . = 0x004160; IntrMain_Buffer = .; + . = 0x004960; gUnknown_03004960 = .; + . = 0x004970; gSpriteAllocIt = .; + . = 0x004980; gFaces = .; + . = 0x004990; gUnknown_03004990 = .; + . = 0x0049A0; gWorkingBmMap = .; + . = 0x0049B0; gMovMapFillStPool1 = .; + . = 0x004BB0; gWorkingTerrainMoveCosts = .; + . = 0x004C00; gStatGainSimUnit = .; + . = 0x004C50; gMovMapFillStPool2 = .; + . = 0x004E50; gActiveUnit = .; + . = 0x004E60; gMovMapFillState = .; + . = 0x004E70; gUnknown_03004E70 = .; + . = 0x004E74; gUnknown_03004E74 = .; + . = 0x004E80; gUnknown_03004E80 = .; + . = 0x004E86; gUnknown_03004E86 = .; + . = 0x004F08; gSioStateId = .; + . = 0x004F0C; gSioMsgBuf = .; + . = 0x004F10; AiDecideMainFunc = .; + . = 0x004F20; gUnknown_03004F20 = .; + . = 0x004FA0; gUnknown_03004FA0 = .; + . = 0x004FA4; gUnknown_03004FA4 = .; + . = 0x004FA8; gEkrXQuakeOff = .; + . = 0x004FAC; gBanimDebugCurrentIndex = .; + . = 0x004FB0; gEkrYQuakeOff = .; + . = 0x004FC0; + . = ALIGN(4); src/mapanim_debug.o(.bss); + . = ALIGN(4); src/mapanim_spellassocfx.o(.bss); + . = 0x005250; gPermanentFlagBits = .; + . = 0x005270; gChapterFlagBits = .; + . = 0x005280; gGMData = .; + . = 0x005324; gUnknown_03005324 = .; + . = 0x005349; gUnknown_03005349 = .; + . = 0x00534E; gGmMonsterRnState = .; + . = 0x005360; gFontClassChgMenu = .; + . = 0x005380; gFontClassChg = .; + . = 0x005398; gUnknown_03005398 = .; + . = 0x0053A0; gUnknown_030053A0 = .; + . = 0x0053E0; gUnknown_030053E0 = .; + . = 0x005408; gUnknown_03005408 = .; + . = 0x005410; gSoundInfo = .; + . = 0x0063C0; gMPlayInfo_SE4_BMP2 = .; + . = 0x006400; gMPlayInfo_SE5_BMP3 = .; + . = 0x006440; gMPlayInfo_BGM1 = .; + . = 0x006480; gMPlayJumpTable = .; + . = 0x006484; gUnknown_03006484 = .; + . = 0x006508; gUnknown_03006508 = .; + . = 0x00650C; gUnknown_0300650C = .; + . = 0x006510; gCgbChans = .; + . = 0x006610; gMPlayInfo_SE6_BMP4 = .; + . = 0x006650; gMPlayInfo_BGM2 = .; + . = 0x006690; gMPlayInfo_SE1_SYS1 = .; + . = 0x0066D0; gMPlayInfo_SE3_BMP1 = .; + . = 0x006710; gMPlayMemAccArea = .; + . = 0x006720; gMPlayInfo_SE7_EVT = .; + . = 0x006760; gMPlayInfo_SE2_SYS2 = .; + + /* src/agb_sram.o(COMMON); */ + . = 0x0067A0; ReadSramFast = .; + . = 0x0067A4; VerifySramFast = .; + + . = 0x67A8; + . = ALIGN(4); *libc.a:sbrkr.o(COMMON); + + . = ALIGN(4); *libgcc.a:dp-bit.o(.bss); + . = ALIGN(4); *libgcc.a:fp-bit.o(.bss); + } + + ROM __text_start : + ALIGN(4) + { + /* .text */ + asm/crt0.o(.text); + asm/arm.o(.text); + src/main.o(.text); + src/fe3_dummy.o(.text); + src/irq.o(.text); + src/rng.o(.text); + src/time.o(.text); + src/hardware.o(.text); + src/soundwrapper.o(.text); + src/ramfunc.o(.text); + src/proc.o(.text); + src/icon.o(.text); + src/fontgrp.o(.text); + src/animedrv.o(.text); + src/ctc.o(.text); + src/face.o(.text); + src/scene.o(.text); + src/sprite-animfx.o(.text); + src/ap.o(.text); + src/gamecontrol.o(.text); + src/msg.o(.text); + asm/spline.o(.text); + src/eventscr_utils.o(.text); + src/eventscr_gmap.o(.text); + src/event.o(.text); + src/eventscr.o(.text); + src/eventscr2.o(.text); + src/popup.o(.text); + src/eventscr3.o(.text); + src/eventfx-fade.o(.text); + src/eventcmd_warp.o(.text); + src/eventfx-shinningstone.o(.text); + src/eventfx-boomfog.o(.text); + src/eventfx-earthquake.o(.text); + src/eventfx-stoneshatter.o(.text); + src/bmlib.o(.text); + asm/bmlib-hblank.o(.text); + src/bmlib-math.o(.text); + src/bm.o(.text); + src/bmitem.o(.text); + src/bmunit.o(.text); + src/bmmap.o(.text); + src/bmidoten.o(.text); + src/bmdebug.o(.text); + src/playerphase.o(.text); + src/koido.o(.text); + src/bmxfade.o(.text); + src/bmcamadjust.o(.text); + src/convoymenu.o(.text); + src/fogmap.o(.text); + src/menuitempanel.o(.text); + src/prep_unitswap.o(.text); + src/phasechangefx.o(.text); + src/unit_facing.o(.text); + src/trapfx.o(.text); + src/popup2.o(.text); + src/chapterintrofx.o(.text); + src/gameoverbgfx.o(.text); + src/lightrunefx.o(.text); + src/danceringfx.o(.text); + src/eventwarpfx.o(.text); + src/whitecircularfadefx.o(.text); + src/emitstarfx.o(.text); + src/minefx.o(.text); + src/chapterintrofx_title.o(.text); + src/bmmenu.o(.text); + src/bmphase.o(.text); + src/bmgold.o(.text); + src/bmtarget.o(.text); + src/bmudisp.o(.text); + src/bmreliance.o(.text); + src/bmitemuse.o(.text); + src/bmbattle.o(.text); + src/bmtrade.o(.text); + src/bmtrick.o(.text); + src/bmusemind.o(.text); + src/bmio.o(.text); + src/bmcontainer.o(.text); + src/bmusort.o(.text); + src/bmarena.o(.text); + src/bmmind.o(.text); + src/bmpatharrowdisp.o(.text); + src/prep_sallycursor.o(.text); + asm/bmcommanddbg.o(.text); + src/chapterdata.o(.text); + src/unitinfowindow.o(.text); + src/bb.o(.text); + src/bmusailment.o(.text); + src/bksel.o(.text); + src/bmtrap.o(.text); + src/bmarch.o(.text); + src/bmdifficulty.o(.text); + src/cp_phase.o(.text); + src/cp_order.o(.text); + src/cp_decide.o(.text); + src/cp_perform.o(.text); + src/cp_utility.o(.text); + src/cp_script.o(.text); + src/cp_battle.o(.text); + src/cp_0803E2F4.o(.text); + src/cp_staff.o(.text); + src/cpextra_80407F0.o(.text); + src/sio_core.o(.text); + src/sio_main.o(.text); + src/sio_main2.o(.text); + src/sio_teamlist.o(.text); + asm/code_sio_8042DC8.o(.text); + src/sio_tactician.o(.text); + src/sio_postbattle.o(.text); + asm/code_sio.o(.text); + src/sio_result.o(.text); + src/sio_rulesettings.o(.text); + src/sio_menu.o(.text); + src/sio_event.o(.text); + src/sio_points.o(.text); + src/sio_battlemap.o(.text); + asm/code_sio_8048260.o(.text); + src/uiutils.o(.text); + src/uimenu.o(.text); + src/uiselecttarget.o(.text); + src/banim-ekrbattle.o(.text); + src/banim-ekrlvupfan.o(.text); + src/banim-ekrgauge.o(.text); + asm/banim-ekrgauge.o(.text); + src/banim-ekrdispup.o(.text); + src/banim-efxhpbar.o(.text); + src/banim-efxdeath.o(.text); + src/banim-efxbattle.o(.text); + src/banim-efxflashbg.o(.text); + src/banim-efxflashunit.o(.text); + src/banim-efxstatusunit.o(.text); + src/banim-efxflashobj.o(.text); + src/banim-ekrutils.o(.text); + src/banim-ekrbattlestarting.o(.text); + src/banim-ekrbattleending.o(.text); + src/banim-ekrbattleintro.o(.text); + src/banim-battleparse.o(.text); + src/banim-ekrcmd.o(.text); + src/banim-main.o(.text); + src/banim-ekrmain.o(.text); + src/banim-ekrmainmini.o(.text); + asm/code_battleanim.o(.text); + src/banim-ekrarena.o(.text); + src/banim-efxmagic.o(.text); + src/banim-efxmagic-phywpn.o(.text); + src/banim-efxmagic-refresh.o(.text); + src/banim-efxmagic-ballista.o(.text); + src/banim-efxmagic-bindingblade.o(.text); + src/banim-efxmagic-breath.o(.text); + src/banim-efxmagic-thunder.o(.text); + src/banim-efxmagic-fire.o(.text); + src/banim-efxmagic-fimbulvetr.o(.text); + src/banim-efxmagic-bolting.o(.text); + src/banim-efxmagic-aircalibur.o(.text); + src/banim-efxmagic-flux.o(.text); + src/banim-efxmagic-nosferatu.o(.text); + src/banim-efxmagic-light.o(.text); + src/banim-efxmagic-eclipse.o(.text); + src/banim-efxmagic-fenrir.o(.text); + src/banim-efxmagic-healstaves.o(.text); + src/banim-efxmagic-effectstaves.o(.text); + src/banim-efxmagic-shine.o(.text); + src/banim-efxmagic-luna.o(.text); + src/banim-efxmagic-excalibur.o(.text); + src/banim-efxmagic-gespenst.o(.text); + src/banim-efxmagic-aura.o(.text); + src/banim-efxmagic-ereshkigal.o(.text); + src/banim-efxmagic-dancerings.o(.text); + src/banim-efxmagic-ivaldi.o(.text); + src/banim-efxmagic-demonlight.o(.text); + src/banim-efxmagic-stone.o(.text); + src/banim-efxmagic-evileye.o(.text); + src/banim-efxmagic-naglfar.o(.text); + src/banim-efxmagic-wretchedair.o(.text); + src/banim-efxmagic-gleipnir.o(.text); + src/banim-efxmagic-crimsoneye.o(.text); + src/banim-efxmagic-shadowshot.o(.text); + src/banim-efxmagic-demonsurge.o(.text); + src/banim-efxhit.o(.text); + src/banim-efxmisc.o(.text); + src/banim-efxskill.o(.text); + src/banim-efxop.o(.text); + src/banim-ekrdragonstatus.o(.text); + src/banim-ekrdragon-dracozombie.o(.text); + src/banim-ekrdragon-utils.o(.text); + asm/banim-ekrdragon.o(.text); + src/banim-ekrdragon-8070710.o(.text); + src/banim-ekrdragon-myrrh.o(.text); + src/banim-efxutils.o(.text); + src/banim-efxsound.o(.text); + src/banim-ekrclasschg.o(.text); + src/banim-ekrlvup.o(.text); + src/banim-efxlvup.o(.text); + src/banim-ekrtriangle.o(.text); + src/banim-ekrpopup.o(.text); + src/banim-ekrhensei.o(.text); + src/banim-ekrdragon-demonking.o(.text); + src/banim-ekrdragon-demonkingobj.o(.text); + src/spellassoc.o(.text); + src/monstergen.o(.text); + src/mu.o(.text); + src/muctrl.o(.text); + src/mapanim.o(.text); + src/mapanim_summon.o(.text); + src/mapanim_api.o(.text); + src/mapanim_infobox.o(.text); + src/mapanim_expbar.o(.text); + src/mapanim_debug.o(.text); + src/mapanim_eventbattle.o(.text); + src/mapanim_specialeffect.o(.text); + src/mapanim_staffeffect.o(.text); + src/mapanim_lvupfx.o(.text); + src/mapanim_lvup.o(.text); + src/mapanim_spellassocfx.o(.text); + src/mapanim_eventcall.o(.text); + asm/mapanim_eventcall.o(.text); + src/mapanim_spellassoc.o(.text); + src/mapanim_scanline.o(.text); + asm/code_mapanim.o(.text); + src/eventinfo.o(.text); + src/uidebug.o(.text); + src/eventcall.o(.text); + src/events_script_utils.o(.text); + src/events_script.o(.text); + asm/code_8086934.o(.text); + src/statbar.o(.text); + src/mural_background.o(.text); + src/statscreen.o(.text); + src/chapter_title.o(.text); + src/helpbox.o(.text); + src/player_interface.o(.text); + src/sioerror.o(.text); + src/uichapterstatus.o(.text); + src/cgtext.o(.text); + src/unitlistscreen.o(.text); + src/prepscreen.o(.text); + src/prep_atmenu.o(.text); + src/prep_menuproc.o(.text); + src/prep_menuscroll.o(.text); + src/prep_sallycir.o(.text); + src/prep_utils.o(.text); + src/prep_itemscreen.o(.text); + src/prep_unitselect.o(.text); + src/prep_itemtrade.o(.text); + src/prep_itemuse.o(.text); + src/prep_itemusemind.o(.text); + src/prep_itemsupply.o(.text); + src/prep_itemlist.o(.text); + src/prep_wm_sell.o(.text); + src/prep_80A0760.o(.text); + src/uisupport.o(.text); + src/bmsave-lib.o(.text); + src/bmsave-bwl.o(.text); + src/bmsave.o(.text); + src/bmsave-multiarena.o(.text); + src/bmsave-xmap.o(.text); + src/bmsave-gmap.o(.text); + src/bmsave-misc.o(.text); + src/minimap.o(.text); + src/savemenu.o(.text); + src/savedraw.o(.text); + src/difficultymenu.o(.text); + asm/code_80AC6AC.o(.text); + src/cursor_hand.o(.text); + src/spinning_arrow.o(.text); + src/sysutil.o(.text); + src/sysutil-bmbgfx.o(.text); + src/code_80AE86C.o(.text); + src/soundroom.o(.text); + src/extramenu_unk.o(.text); + src/bonusclaim.o(.text); + src/uiconfig.o(.text); + src/colorfade.o(.text); + src/opinfo.o(.text); + src/classdisplayfont.o(.text); + src/bmshop.o(.text); + src/uiarena.o(.text); + src/gamerankings.o(.text); + src/cg.o(.text); + src/ending_details.o(.text); + src/worldmap_face.o(.text); + src/worldmap_main.o(.text); + src/worldmap_screen.o(.text); + src/worldmap_gmapunit.o(.text); + src/worldmap_screen2.o(.text); + src/worldmap_cursor.o(.text); + src/worldmap_path.o(.text); + src/worldmap_mapmu.o(.text); + src/worldmap_player_interface.o(.text); + src/worldmap_scrollmanage.o(.text); + src/worldmap_draw.o(.text); + src/worldmap_palette_fade.o(.text); + src/worldmap_entry.o(.text); + src/worldmap_line_fade.o(.text); + src/worldmap_tm_confront.o(.text); + src/worldmap_80C0834.o(.text); + src/worldmap_status_ui.o(.text); + src/worldmap_effect.o(.text); + src/worldmap_sogu.o(.text); + src/worldmap_timemons.o(.text); + src/worldmap_hb.o(.text); + src/worldmap_rm.o(.text); + src/worldmap_automu.o(.text); + src/worldmap_text.o(.text); + src/worldmap_radar.o(.text); + src/worldmap_basemenu.o(.text); + src/ending_credits.o(.text); + src/opsubtitle.o(.text); + src/titlescreen.o(.text); + src/opanimfx.o(.text); + asm/opanimfx.o(.text); + src/opanim-main.o(.text); + src/opanim-healthsafetyscreen.o(.text); + src/classchg-main.o(.text); + src/classchg-handler.o(.text); + src/classchg-sel.o(.text); + src/classchg-event.o(.text); + src/classchg-menuconfirm.o(.text); + src/classchg-menuselect.o(.text); + src/classchg-postconfirm.o(.text); + src/bmguide.o(.text); + asm/m4a_1.o(.text); + src/m4a.o(.text); + asm/libagbsyscall.o(.text); + src/agb_sram.o(.text); + *libgcc.a:_ashldi3.o(.text); + *libgcc.a:_call_via_rX.o(.text); + *libgcc.a:_divsi3.o(.text); + *libgcc.a:_dvmd_tls.o(.text); + *libgcc.a:_modsi3.o(.text); + *libgcc.a:_muldi3.o(.text); + *libgcc.a:_udivsi3.o(.text); + *libgcc.a:_umodsi3.o(.text); + *libc.a:memcpy.o(.text); + *libc.a:memset.o(.text); + *libc.a:sprintf.o(.text); + *libc.a:strcpy.o(.text); + *libc.a:strlen.o(.text); + *libc.a:strstr.o(.text); + *libc.a:vfprintf.o(.text); + *libc.a:vsprintf.o(.text); + *libc.a:wsetup.o(.text); + *libc.a:dtoa.o(.text); + *libc.a:fflush.o(.text); + *libc.a:findfp.o(.text); + *libc.a:freer.o(.text); + *libc.a:fvwrite.o(.text); + *libc.a:fwalk.o(.text); + *libc.a:locale.o(.text); + *libc.a:makebuf.o(.text); + *libc.a:mallocr.o(.text); + *libc.a:mbtowc_r.o(.text); + *libc.a:memchr.o(.text); + *libc.a:memmove.o(.text); + *libc.a:mlock.o(.text); + *libc.a:mprec.o(.text); + *libc.a:s_isinf.o(.text); + *libc.a:s_isnan.o(.text); + *libc.a:sbrkr.o(.text); + *libc.a:stdio.o(.text); + *libc.a:strcmp.o(.text); + *libc.a:syscalls.o(.text); + *libc.a:writer.o(.text); + *libc.a:callocr.o(.text); + *libc.a:closer.o(.text); + *libc.a:errno.o(.text); + *libc.a:fstatr.o(.text); + *libc.a:libcfunc.o(.text); + *libc.a:lseekr.o(.text); + *libc.a:readr.o(.text); + *libgcc.a:dp-bit.o(.text); + *libgcc.a:fp-bit.o(.text); + *libgcc.a:_lshrdi3.o(.text); + *libgcc.a:_negdi2.o(.text); + asm/arm_call.o(.text); + + /* .rodata */ + . = ALIGN(4); src/*.o(.rodata*); + . = ALIGN(4); data/trig_rodata.o(.rodata); + . = ALIGN(4); data/const_data_sio.o(.rodata); + . = ALIGN(4); data/const_data_D8714.o(.rodata); + . = ALIGN(4); data/const_data_D9F18.o(.rodata); + . = ALIGN(4); data/const_data_DAD68.o(.rodata); + . = ALIGN(4); data/const_data_DAEF0.o(.rodata); + . = ALIGN(4); data/const_data_DB034.o(.rodata); + . = ALIGN(4); data/const_data_efxmagic_DC944.o(.rodata); + . = ALIGN(4); data/const_data_banimekrdk.o(.rodata); + . = ALIGN(4); data/const_data_efxutils.o(.rodata); + . = ALIGN(4); data/const_data_E162A.o(.rodata); + . = ALIGN(4); data/const_data_chapter_maps.o(.rodata); + . = ALIGN(4); data/const_data_unit_icon_wait.o(.rodata); + . = ALIGN(4); data/const_data_1C0AFC.o(.rodata); + . = ALIGN(4); data/const_data_unit_icon_move.o(.rodata); + . = ALIGN(4); data/const_data_205714.o(.rodata); + . = ALIGN(4); sound/*.o(.rodata); + . = ALIGN(4); *libc.a:vfprintf.o(.rodata); + . = ALIGN(4); *libc.a:dtoa.o(.rodata); + . = ALIGN(4); *libc.a:impure.o(.rodata); + . = ALIGN(4); *libc.a:locale.o(.rodata); + . = ALIGN(4); *libc.a:mprec.o(.rodata); + . = ALIGN(4); *libc.a:syscalls.o(.rodata); + + /* .data */ + . = ALIGN(4); src/main.o(.data); + . = ALIGN(4); src/hardware.o(.data); + . = ALIGN(4); src/soundwrapper.o(.data); + . = ALIGN(4); src/proc.o(.data); + . = ALIGN(4); src/fontgrp.o(.data); + . = ALIGN(4); src/fontgrp-data.o(.data); + . = ALIGN(4); src/ctc.o(.data); + . = ALIGN(4); src/face.o(.data); + . = ALIGN(4); src/scene.o(.data); + . = ALIGN(4); src/sprite-animfx.o(.data); + . = ALIGN(4); src/ap.o(.data); + . = ALIGN(4); src/gamecontrol.o(.data); + . = ALIGN(4); src/msg.o(.data); + . = ALIGN(4); src/event.o(.data); + . = ALIGN(4); src/eventscr.o(.data); + . = ALIGN(4); src/popup.o(.data); + . = ALIGN(4); src/eventscr3.o(.data); + . = ALIGN(4); src/eventfx-fade.o(.data); + . = ALIGN(4); src/eventfx-shinningstone.o(.data); + . = ALIGN(4); src/eventfx-boomfog.o(.data); + . = ALIGN(4); src/eventfx-earthquake.o(.data); + . = ALIGN(4); src/eventfx-stoneshatter.o(.data); + . = ALIGN(4); data/data_item_icon.o(.data); + . = ALIGN(4); data/generic_icon.o(.data); + . = ALIGN(4); src/bmlib.o(.data); + . = ALIGN(4); src/bm.o(.data); + . = ALIGN(4); src/bmunit.o(.data); + . = ALIGN(4); src/bmmap.o(.data); + . = ALIGN(4); src/bmdebug.o(.data); + . = ALIGN(4); src/playerphase.o(.data); + . = ALIGN(4); src/koido.o(.data); + . = ALIGN(4); src/bmxfade.o(.data); + . = ALIGN(4); src/bmcamadjust.o(.data); + . = ALIGN(4); src/convoymenu.o(.data); + . = ALIGN(4); src/menuitempanel.o(.data); + . = ALIGN(4); src/prep_unitswap.o(.data); + . = ALIGN(4); src/phasechangefx.o(.data); + . = ALIGN(4); src/trapfx.o(.data); + . = ALIGN(4); src/popup2.o(.data); + . = ALIGN(4); src/chapterintrofx.o(.data); + . = ALIGN(4); src/gameoverbgfx.o(.data); + . = ALIGN(4); src/lightrunefx.o(.data); + . = ALIGN(4); src/danceringfx.o(.data); + . = ALIGN(4); src/eventwarpfx.o(.data); + . = ALIGN(4); src/whitecircularfadefx.o(.data); + . = ALIGN(4); src/emitstarfx.o(.data); + . = ALIGN(4); src/minefx.o(.data); + . = ALIGN(4); src/chapterintrofx_title.o(.data); + . = ALIGN(4); src/bmmenu.o(.data); + . = ALIGN(4); src/bmudisp.o(.data); + . = ALIGN(4); src/bmreliance.o(.data); + . = ALIGN(4); src/bmitemuse.o(.data); + . = ALIGN(4); src/bmbattle.o(.data); + . = ALIGN(4); src/bmtrade.o(.data); + . = ALIGN(4); src/bmtrick.o(.data); + . = ALIGN(4); src/bmusemind.o(.data); + . = ALIGN(4); src/menu_def.o(.data); + . = ALIGN(4); data/data_map_anim.o(.data); + . = ALIGN(4); src/bmio.o(.data); + . = ALIGN(4); src/bmarena.o(.data); + . = ALIGN(4); src/bmmind.o(.data); + . = ALIGN(4); src/bmpatharrowdisp.o(.data); + . = ALIGN(4); src/prep_sallycursor.o(.data); + . = ALIGN(4); src/unitinfowindow.o(.data); + . = ALIGN(4); src/bb.o(.data); + . = ALIGN(4); src/bmusailment.o(.data); + . = ALIGN(4); src/bksel.o(.data); + . = ALIGN(4); src/bmtrap.o(.data); + . = ALIGN(4); src/bmdifficulty.o(.data); + . = ALIGN(4); data/data_59E8E0.o(.data); + . = ALIGN(4); src/cp_phase.o(.data); + . = ALIGN(4); src/cp_order.o(.data); + . = ALIGN(4); src/cp_decide.o(.data); + . = ALIGN(4); src/cp_perform.o(.data); + . = ALIGN(4); src/cp_utility.o(.data); + . = ALIGN(4); src/cp_data.o(.data); + . = ALIGN(4); src/cp_battle.o(.data); + . = ALIGN(4); src/cp_0803E2F4.o(.data); + . = ALIGN(4); src/cp_staff.o(.data); + . = ALIGN(4); src/cpextra_80407F0.o(.data); + . = ALIGN(4); src/sio_core.o(.data); + . = ALIGN(4); src/sio_main.o(.data); + . = ALIGN(4); src/sio_main2.o(.data); + . = ALIGN(4); src/sio_teamlist.o(.data); + . = ALIGN(4); data/sio_tactician.o(.data); + . = ALIGN(4); src/sio_postbattle.o(.data); + . = ALIGN(4); data/data_5A92E0.o(.data); + . = ALIGN(4); src/sio_result.o(.data); + . = ALIGN(4); src/sio_rulesettings.o(.data); + . = ALIGN(4); src/sio_menu.o(.data); + . = ALIGN(4); src/sio_event.o(.data); + . = ALIGN(4); src/sio_points.o(.data); + . = ALIGN(4); src/sio_battlemap.o(.data); + . = ALIGN(4); data/data_5A9F48.o(.data); + . = ALIGN(4); src/uiutils.o(.data); + . = ALIGN(4); src/uimenu.o(.data); + . = ALIGN(4); src/uiselecttarget.o(.data); + . = ALIGN(4); data/data_5B65C0.o(.data); + . = ALIGN(4); src/banim-ekrbattle.o(.data); + . = ALIGN(4); src/banim-ekrlvupfan.o(.data); + . = ALIGN(4); src/banim-ekrgauge.o(.data); + . = ALIGN(4); data/data-ekrgauge.o(.data); + . = ALIGN(4); src/banim-ekrdispup.o(.data); + . = ALIGN(4); src/banim-efxhpbar.o(.data); + . = ALIGN(4); src/banim-efxdeath.o(.data); + . = ALIGN(4); src/banim-efxbattle.o(.data); + . = ALIGN(4); src/banim-efxflashbg.o(.data); + . = ALIGN(4); src/banim-efxflashunit.o(.data); + . = ALIGN(4); src/banim-efxstatusunit.o(.data); + . = ALIGN(4); src/banim-efxflashobj.o(.data); + . = ALIGN(4); src/banim-ekrutils.o(.data); + . = ALIGN(4); src/banim-ekrbattlestarting.o(.data); + . = ALIGN(4); src/banim-ekrbattleending.o(.data); + . = ALIGN(4); src/banim-ekrbattleintro.o(.data); + . = ALIGN(4); src/banim-ekrmain.o(.data); + . = ALIGN(4); src/banim-ekrmainmini.o(.data); + . = ALIGN(4); src/banim-ekrarena.o(.data); + . = ALIGN(4); data/data_banim_5B9D6C.o(.data); + . = ALIGN(4); data/banim-efxlvupfx.o(.data); + . = ALIGN(4); data/banim-ekrmainminifx.o(.data); + . = ALIGN(4); data/banim-efxhitfx.o(.data); + . = ALIGN(4); data/data_banim_5B9D5C.o(.data); + . = ALIGN(4); src/banim-efxmagic.o(.data); + . = ALIGN(4); src/banim-efxmagic-phywpn.o(.data); + . = ALIGN(4); src/banim-efxmagic-refresh.o(.data); + . = ALIGN(4); src/banim-efxmagic-ballista.o(.data); + . = ALIGN(4); src/banim-efxmagic-bindingblade.o(.data); + . = ALIGN(4); src/banim-efxmagic-breath.o(.data); + . = ALIGN(4); data/banim-efxmagic-thunder.o(.data); + . = ALIGN(4); data/banim-efxmagic-fire.o(.data); + . = ALIGN(4); src/banim-efxmagic-fimbulvetr.o(.data); + . = ALIGN(4); src/banim-efxmagic-bolting.o(.data); + . = ALIGN(4); src/banim-efxmagic-aircalibur.o(.data); + . = ALIGN(4); src/banim-efxmagic-flux.o(.data); + . = ALIGN(4); src/banim-efxmagic-nosferatu.o(.data); + . = ALIGN(4); src/banim-efxmagic-light.o(.data); + . = ALIGN(4); src/banim-efxmagic-eclipse.o(.data); + . = ALIGN(4); src/banim-efxmagic-fenrir.o(.data); + . = ALIGN(4); src/banim-efxmagic-healstaves.o(.data); + . = ALIGN(4); src/banim-efxmagic-effectstaves.o(.data); + . = ALIGN(4); src/banim-efxmagic-shine.o(.data); + . = ALIGN(4); src/banim-efxmagic-luna.o(.data); + . = ALIGN(4); src/banim-efxmagic-excalibur.o(.data); + . = ALIGN(4); src/banim-efxmagic-gespenst.o(.data); + . = ALIGN(4); src/banim-efxmagic-aura.o(.data); + . = ALIGN(4); src/banim-efxmagic-ereshkigal.o(.data); + . = ALIGN(4); src/banim-efxmagic-dancerings.o(.data); + . = ALIGN(4); src/banim-efxmagic-ivaldi.o(.data); + . = ALIGN(4); src/banim-efxmagic-demonlight.o(.data); + . = ALIGN(4); src/banim-efxmagic-stone.o(.data); + . = ALIGN(4); src/banim-efxmagic-evileye.o(.data); + . = ALIGN(4); src/banim-efxmagic-naglfar.o(.data); + . = ALIGN(4); src/banim-efxmagic-wretchedair.o(.data); + . = ALIGN(4); src/banim-efxmagic-gleipnir.o(.data); + . = ALIGN(4); src/banim-efxmagic-crimsoneye.o(.data); + . = ALIGN(4); src/banim-efxmagic-shadowshot.o(.data); + . = ALIGN(4); src/banim-efxmagic-demonsurge.o(.data); + . = ALIGN(4); src/banim-efxhit.o(.data); + . = ALIGN(4); src/banim-efxmisc.o(.data); + . = ALIGN(4); src/banim-efxskill.o(.data); + . = ALIGN(4); src/banim-efxop.o(.data); + . = ALIGN(4); data/data_banim.o(.data); + . = ALIGN(4); src/banim-ekrdragon-dracozombie.o(.data); + . = ALIGN(4); src/banim-ekrdragon-utils.o(.data); + . = ALIGN(4); data/data-ekrdragon.o(.data); + . = ALIGN(4); src/banim-ekrdragon-myrrh.o(.data); + . = ALIGN(4); src/banim-efxutils.o(.data); + . = ALIGN(4); src/banim-efxsound.o(.data); + . = ALIGN(4); src/banim-efxsound-data.o(.data); + . = ALIGN(4); src/banim-ekrclasschg.o(.data); + . = ALIGN(4); src/banim-ekrlvup.o(.data); + . = ALIGN(4); src/banim-efxlvup.o(.data); + . = ALIGN(4); src/banim-ekrtriangle.o(.data); + . = ALIGN(4); data/banim-ekrtriangle.o(.data); + . = ALIGN(4); data/data_btl_bg.o(.data); + . = ALIGN(4); src/banim-ekrpopup.o(.data); + . = ALIGN(4); src/banim-ekrhensei.o(.data); + . = ALIGN(4); data/data_banim_78D500.o(.data); + . = ALIGN(4); src/banim-ekrdragon-demonking.o(.data); + . = ALIGN(4); data/data-ekrdk.o(.data); + . = ALIGN(4); src/banim-ekrdragon-demonkingobj.o(.data); + . = ALIGN(4); data/data-ekrdk2.o(.data); + . = ALIGN(4); src/data_characters.o(.data); + . = ALIGN(4); src/data_classes.o(.data); + . = ALIGN(4); src/data_items.o(.data); + . = ALIGN(4); src/data_terrains.o(.data); + . = ALIGN(4); data/data_portrait.o(.data); + . = ALIGN(4); src/portrait_data.o(.data); + . = ALIGN(4); src/data_itemuse.o(.data); + . = ALIGN(4); src/data_debugpinfo.o(.data); + . = ALIGN(4); src/data_supports.o(.data); + . = ALIGN(4); src/data_itembonus.o(.data); + . = ALIGN(4); src/data_banimconf.o(.data); + . = ALIGN(4); src/data_banimconfunk.o(.data); + . = ALIGN(4); src/unit_icon_wait_data.o(.data); + . = ALIGN(4); src/spellassoc-data.o(.data); + . = ALIGN(4); src/bmreliance-data.o(.data); + . = ALIGN(4); src/data_debug_creditinfo.o(.data); + . = ALIGN(4); src/chapterdata.o(.data); + . = ALIGN(4); data/data_8B363C.o(.data); + . = ALIGN(4); src/events_udefs.o(.data); + . = ALIGN(4); src/monstergen_data.o(.data); + . = ALIGN(4); data/data_bg.o(.data); + . = ALIGN(4); src/eventscr2.o(.data); + . = ALIGN(4); src/classchg-data.o(.data); + . = ALIGN(4); data/data_map_anim_frames.o(.data); + . = ALIGN(4); data/data_99D6DC.o(.data); + . = ALIGN(4); src/mu.o(.data); + . = ALIGN(4); src/muctrl.o(.data); + . = ALIGN(4); src/unit_icon_move_data.o(.data); + . = ALIGN(4); src/mapanim.o(.data); + . = ALIGN(4); src/mapanim_summon.o(.data); + . = ALIGN(4); src/mapanim_api.o(.data); + . = ALIGN(4); src/mapanim_infobox.o(.data); + . = ALIGN(4); src/mapanim_expbar.o(.data); + . = ALIGN(4); src/mapanim_debug.o(.data); + . = ALIGN(4); src/mapanim_eventbattle.o(.data); + . = ALIGN(4); src/mapanim_specialeffect.o(.data); + . = ALIGN(4); src/mapanim_staffeffect.o(.data); + . = ALIGN(4); src/mapanim_lvupfx.o(.data); + . = ALIGN(4); src/mapanim_lvup.o(.data); + . = ALIGN(4); src/mapanim_spellassocfx.o(.data); + . = ALIGN(4); src/mapanim_eventcall.o(.data); + . = ALIGN(4); data/mapanim_eventcall.o(.data); + . = ALIGN(4); src/mapanim_spellassoc.o(.data); + . = ALIGN(4); data/data_9A31F8.o(.data); + . = ALIGN(4); src/eventinfo.o(.data); + . = ALIGN(4); src/events_info.o(.data); + . = ALIGN(4); src/data_battlequotes.o(.data); + . = ALIGN(4); src/data_event_trigger.o(.data); + . = ALIGN(4); src/uidebug.o(.data); + . = ALIGN(4); src/events_shoplist.o(.data); + . = ALIGN(4); src/events_trapdata.o(.data); + . = ALIGN(4); src/eventcall.o(.data); + . = ALIGN(4); src/events_script_utils.o(.data); + . = ALIGN(4); src/events_script.o(.data); + . = ALIGN(4); src/mural_background.o(.data); + . = ALIGN(4); src/statscreen.o(.data); + . = ALIGN(4); src/chap_title_data.o(.data); + . = ALIGN(4); src/helpbox.o(.data); + . = ALIGN(4); src/player_interface.o(.data); + . = ALIGN(4); src/uichapterstatus.o(.data); + . = ALIGN(4); src/cgtext.o(.data); + . = ALIGN(4); data/data_A01CC4.o(.data); + . = ALIGN(4); data/data_chap_title.o(.data); + . = ALIGN(4); data/data_A167C8.o(.data); + . = ALIGN(4); src/unitlistscreen.o(.data); + . = ALIGN(4); src/prepscreen.o(.data); + . = ALIGN(4); src/prep_atmenu.o(.data); + . = ALIGN(4); src/prep_menuproc.o(.data); + . = ALIGN(4); src/prep_menuscroll.o(.data); + . = ALIGN(4); src/prep_sallycir.o(.data); + . = ALIGN(4); src/prep_utils.o(.data); + . = ALIGN(4); src/prep_itemscreen.o(.data); + . = ALIGN(4); src/prep_unitselect.o(.data); + . = ALIGN(4); src/prep_itemtrade.o(.data); + . = ALIGN(4); src/prep_itemuse.o(.data); + . = ALIGN(4); src/prep_itemusemind.o(.data); + . = ALIGN(4); src/prep_itemsupply.o(.data); + . = ALIGN(4); src/prep_itemlist.o(.data); + . = ALIGN(4); src/prep_wm_sell.o(.data); + . = ALIGN(4); src/prep_80A0760.o(.data); + . = ALIGN(4); src/uisupport.o(.data); + . = ALIGN(4); data/data_A195B0.o(.data); + . = ALIGN(4); data/data_map_change.o(.data); + . = ALIGN(4); src/bmsave-lib.o(.data); + . = ALIGN(4); src/bmsave-multiarena.o(.data); + . = ALIGN(4); src/bmsave-xmap.o(.data); + . = ALIGN(4); data/data_A1FAF4.o(.data); + . = ALIGN(4); src/minimap.o(.data); + . = ALIGN(4); data/data_minimap.o(.data); + . = ALIGN(4); src/savemenu.o(.data); + . = ALIGN(4); src/savedraw.o(.data); + . = ALIGN(4); src/savemenu_data.o(.data); + . = ALIGN(4); src/difficultymenu.o(.data); + . = ALIGN(4); src/cursor_hand.o(.data); + . = ALIGN(4); src/spinning_arrow.o(.data); + . = ALIGN(4); src/sysutil.o(.data); + . = ALIGN(4); src/sysutil-bmbgfx.o(.data); + . = ALIGN(4); src/code_80AE86C.o(.data); + . = ALIGN(4); src/soundroom_data.o(.data); + . = ALIGN(4); src/soundroom.o(.data); + . = ALIGN(4); src/extramenu_unk.o(.data); + . = ALIGN(4); src/bonusclaim.o(.data); + . = ALIGN(4); data/data_A21658.o(.data); + . = ALIGN(4); src/uiconfig.o(.data); + . = ALIGN(4); src/colorfade.o(.data); + . = ALIGN(4); src/opinfo.o(.data); + . = ALIGN(4); src/classdisplayfont.o(.data); + . = ALIGN(4); data/data_A2EEF0.o(.data); + . = ALIGN(4); src/bmshop.o(.data); + . = ALIGN(4); src/uiarena.o(.data); + . = ALIGN(4); src/events_wm.o(.data); + . = ALIGN(4); src/gamerankings.o(.data); + . = ALIGN(4); src/cg.o(.data); + . = ALIGN(4); src/ending_details.o(.data); + . = ALIGN(4); src/worldmap_face.o(.data); + . = ALIGN(4); src/worldmap_main.o(.data); + . = ALIGN(4); src/worldmap_screen.o(.data); + . = ALIGN(4); src/worldmap_gmapunit.o(.data); + . = ALIGN(4); src/worldmap_screen2.o(.data); + . = ALIGN(4); src/worldmap_cursor.o(.data); + . = ALIGN(4); src/worldmap_path.o(.data); + . = ALIGN(4); src/worldmap_mapmu.o(.data); + . = ALIGN(4); src/worldmap_player_interface.o(.data); + . = ALIGN(4); src/worldmap_scrollmanage.o(.data); + . = ALIGN(4); src/worldmap_palette_fade.o(.data); + . = ALIGN(4); src/worldmap_entry.o(.data); + . = ALIGN(4); src/worldmap_line_fade.o(.data); + . = ALIGN(4); src/worldmap_tm_confront.o(.data); + . = ALIGN(4); src/worldmap_status_ui.o(.data); + . = ALIGN(4); src/worldmap_effect.o(.data); + . = ALIGN(4); src/worldmap_sogu.o(.data); + . = ALIGN(4); src/worldmap_timemons.o(.data); + . = ALIGN(4); src/worldmap_rm.o(.data); + . = ALIGN(4); src/worldmap_automu.o(.data); + . = ALIGN(4); src/worldmap_text.o(.data); + . = ALIGN(4); src/worldmap_radar.o(.data); + . = ALIGN(4); src/worldmap_basemenu.o(.data); + . = ALIGN(4); data/data_A3E4D4.o(.data); + . = ALIGN(4); src/ending_credits.o(.data); + . = ALIGN(4); src/opsubtitle.o(.data); + . = ALIGN(4); data/data_opsubtitle.o(.data); + . = ALIGN(4); src/titlescreen.o(.data); + . = ALIGN(4); src/opanimfx.o(.data); + . = ALIGN(4); src/opanim-main.o(.data); + . = ALIGN(4); data/data_AA6BFA.o(.data); + . = ALIGN(4); data/opanim.o(.data); + . = ALIGN(4); src/opanim-healthsafetyscreen.o(.data); + . = ALIGN(4); data/data_AA7760.o(.data); + . = ALIGN(4); data/data_opanim_gfx.o(.data); + . = ALIGN(4); src/classchg-main.o(.data); + . = ALIGN(4); src/classchg-handler.o(.data); + . = ALIGN(4); src/classchg-sel.o(.data); + . = ALIGN(4); src/classchg-event.o(.data); + . = ALIGN(4); src/classchg-menuconfirm.o(.data); + . = ALIGN(4); src/classchg-menuselect.o(.data); + . = ALIGN(4); src/classchg-postconfirm.o(.data); + . = ALIGN(4); src/bmguide.o(.data); + . = ALIGN(4); data/data_B12A60.o(.data); + . = ALIGN(4); *libc.a:impure.o(.data); + . = ALIGN(4); *libc.a:locale.o(.data); + . = ALIGN(4); *libc.a:mallocr.o(.data); + . = ALIGN(4); data/data_B1FE7C.o(.data); + FILL(0xFF); + . = 0xC00000; src/banim_data.o(.data.banim_array_len); + . = 0xC00008; src/banim_data.o(.data.banim_array); + FILL(0x00); /* TODO: This padding is handled by banim linking process itself? */ + . = 0xC02000; data/banim/data_banim.o(.data); + FILL(0xFF); + . = 0xEE0000; src/banim_terrain_data.o(.data.banim_terrain_head); src/banim_terrain_data.o(.data.banim_terrain_ptr_table); + FILL(0x00); + . = 0xEE0C00; data/data_banim_terrain.o(.data); + FILL(0xFF); + _banim_pal_start = 0xEF8000; + . = _banim_pal_start; + src/banim_pal_chara.o(.data.banim_pal_head); + src/banim_pal_chara.o(.data.banim_pal_ptr_table); + FILL(0x00); + . = _banim_pal_start + 0x1000; data/data_banim_pal.o(.data); + _banim_pal_end = .; + _banim_pal_size = . - _banim_pal_start; + FILL(0xFF); + . = 0xFE0000; data/data_FE0000.o(.data); + . = 0xFFF000; data/data_FFF000.o(.data); + } = 0 + + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + .gnu.build.attributes : { *(.gnu.build.attributes .gnu.build.attributes.*) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* DWARF 3 */ + .debug_pubtypes 0 : { *(.debug_pubtypes) } + .debug_ranges 0 : { *(.debug_ranges) } + /* DWARF Extension. */ + .debug_macro 0 : { *(.debug_macro) } + .debug_addr 0 : { *(.debug_addr) } + .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) } + .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) } + + /* Discard everything not specifically mentioned above. */ + /DISCARD/ : + { + *(*); + } +} diff --git a/scripts/arm_compressing_linker.py b/scripts/arm_compressing_linker.py index 89d425f73..e0667f0bc 100755 --- a/scripts/arm_compressing_linker.py +++ b/scripts/arm_compressing_linker.py @@ -40,7 +40,10 @@ def parse_linker_script(filename): obj_list.append((obj, sec, comp)) return obj_list -def convert_binary_to_object(filename, objcopy, with_label, is_debug): +def convert_binary_to_object(filename, objcopy, with_label, is_debug, build_dir): + build_filename = filename + if build_dir != '' and not filename.startswith(build_dir): + build_filename = build_dir + '/' + filename if with_label: label = os.path.basename(filename).split(".") # omit extension name .4bpp @@ -49,14 +52,14 @@ def convert_binary_to_object(filename, objcopy, with_label, is_debug): else: label = label[0] + '_' + label[1] cmd = '%s -I binary -O elf32-littlearm -B armv4t -S --add-symbol %s=.data:0 %s %s.o' \ - % (objcopy, label, filename, filename) + % (objcopy, label, filename, build_filename) else: cmd = '%s -I binary -O elf32-littlearm -B armv4t -S %s %s.o' \ - % (objcopy, filename, filename) + % (objcopy, filename, build_filename) if is_debug: print(cmd) os.system(cmd) - return filename + '.o' + return build_filename + '.o' def is_binary(filename): return os.path.splitext(filename)[-1] not in ('.o', '.obj', '.elf') @@ -104,7 +107,7 @@ def extract_symbol_file(filename, objcopy, is_debug): def change_outputfile_type(outputfile, objcopy, is_debug): cmd = 'mv %s %s' % (convert_binary_to_object( dump_binary_from_object(outputfile, '', objcopy, is_debug), - objcopy, False, is_debug), outputfile) + objcopy, False, is_debug, ''), outputfile) if is_debug: print(cmd) os.system(cmd) @@ -139,25 +142,25 @@ def remove_section_in_object(filename, section, objcopy, is_debug): os.system(cmd) def process_first_object(filename, section, objcopy, comptype, compressor, - is_debug): + is_debug, build_dir): if is_binary(filename): if comptype is not None: filename = compress_binary(filename, comptype, compressor, is_debug) - filename = convert_binary_to_object(filename, objcopy, True, is_debug) + filename = convert_binary_to_object(filename, objcopy, True, is_debug, build_dir) else: if comptype is not None: filename = dump_binary_from_object(filename, section, objcopy, is_debug) filename = compress_binary(filename, comptype, compressor, is_debug) - filename = convert_binary_to_object(filename, objcopy, True, is_debug) + filename = convert_binary_to_object(filename, objcopy, True, is_debug, '') return filename def process_input_object(filename, outputfile, section, base_addr, ld, objcopy, - comptype, compressor, is_debug): + comptype, compressor, is_debug, build_dir): if is_binary(filename): if comptype is not None: filename = compress_binary(filename, comptype, compressor, is_debug) - filename = convert_binary_to_object(filename, objcopy, True, is_debug) + filename = convert_binary_to_object(filename, objcopy, True, is_debug, build_dir) else: if comptype is not None: cmd = 'cp %s %s.bak.o' % (outputfile, outputfile) @@ -179,11 +182,17 @@ def process_input_object(filename, outputfile, section, base_addr, ld, objcopy, print(cmd) os.system(cmd) filename = compress_binary(filename, comptype, compressor, is_debug) - filename = convert_binary_to_object(filename, objcopy, True, is_debug) + filename = convert_binary_to_object(filename, objcopy, True, is_debug, '') return filename +def get_build_filename(filename, build_dir): + if build_dir != '' and filename.startswith('data/banim/'): + return build_dir + '/' + filename + else: + return filename + def link_objects(obj_list, outputfile, base_addr, - ld, objcopy, compressor, is_debug): + ld, objcopy, compressor, is_debug, build_dir): # os.mkdir('link_temp') # os.chdir('link_temp') # handle the first object @@ -192,21 +201,23 @@ def link_objects(obj_list, outputfile, base_addr, comptype = obj_list[0][2] section = obj_list[0][1] print('Compressing linking (1/%d): %s' % (total_number, filename)) + filename = get_build_filename(filename, build_dir) filename = process_first_object(filename, section, objcopy, - comptype, compressor, is_debug) + comptype, compressor, is_debug, build_dir) link_first_object(outputfile, filename, base_addr, ld, is_debug) extract_symbol_file(outputfile, objcopy, is_debug) change_outputfile_type(outputfile, objcopy, is_debug) # link other objects for i, obj in enumerate(obj_list[1:]): - print('Compressing linking (%d/%d): %s' - % (i + 2, total_number, filename)) filename = obj[0] comptype = obj[2] section = obj[1] + print('Compressing linking (%d/%d): %s' + % (i + 2, total_number, filename)) + filename = get_build_filename(filename, build_dir) filename = process_input_object(filename, outputfile, section, base_addr, ld, objcopy, - comptype, compressor, is_debug) + comptype, compressor, is_debug, build_dir) link_to_output(outputfile, filename, section, base_addr, ld, True, is_debug) extract_symbol_file(outputfile, objcopy, is_debug) @@ -224,6 +235,7 @@ def main(argv): objcopy = '' compressor = '' linker_script = 'linker_script.txt' + build_dir = '' base_addr = 0 is_debug = False is_dependency = False @@ -231,7 +243,7 @@ def main(argv): opts, args = getopt.getopt(argv, "ho:l:c:t:b:dm", ["help", "output=", "script=", "base=", "ld=", "objcopy=", "compressor=", "debug", - "dependency"]) + "dependency", "build-dir="]) except getopt.GetoptError: print('Error: wrong option. Use -h for help information.') sys.exit(1) @@ -256,6 +268,7 @@ def main(argv): print('\t-d, --debug\tEnable debug infomation output.\n') print('\t-m, --dependency\tOutput dependency from linker script \ for makefile.\n') + print('\t--build-dir \tSet the build directory.\n') sys.exit() elif opt in ('-o', '--output'): outputfile = arg @@ -273,11 +286,13 @@ def main(argv): is_debug = True elif opt in ('-m', '--dependency'): is_dependency = True + elif opt == '--build-dir': + build_dir = arg obj_list = parse_linker_script(linker_script) if is_dependency: s = [] for obj in obj_list: - s.append(obj[0]) + s.append(get_build_filename(obj[0], build_dir)) print(" ".join(s)) sys.exit() if objcopy == '': @@ -285,7 +300,7 @@ def main(argv): if os.path.exists(outputfile): os.remove(outputfile) link_objects(obj_list, outputfile, base_addr, ld, objcopy, compressor, - is_debug) + is_debug, build_dir) if __name__ == "__main__": diff --git a/songs.mk b/songs.mk index 83d70c3c0..2f6839df0 100644 --- a/songs.mk +++ b/songs.mk @@ -1,3 +1,6 @@ +$(MID_BUILDDIR)/%.o: $(MID_SUBDIR)/%.s + $(AS) $(ASFLAGS) -o $@ $< + $(MID_SUBDIR)/song001_agbfe3_bgm_opening.s: %.s: %.mid $(MID2AGB) $< $@ -E -G000 -R020 -P010 -V051 diff --git a/src/banim-efxflashbg.c b/src/banim-efxflashbg.c index 41b0a9022..02c8f5c08 100644 --- a/src/banim-efxflashbg.c +++ b/src/banim-efxflashbg.c @@ -31,7 +31,7 @@ void NewEfxFlashBgRed(struct Anim * anim, int duartion) proc->anim = anim; proc->timer = 0; proc->terminator = duartion; - CpuFastFill16(0x001F001F, gEfxPal, PLTT_SIZE); + CpuFastFill16(0x001F, gEfxPal, PLTT_SIZE); } void NewEfxFlashBgBlack(struct Anim * anim, int duartion) diff --git a/src/banim-efxmagic-crimsoneye.c b/src/banim-efxmagic-crimsoneye.c index 4dc372f8e..0cb0dbce7 100644 --- a/src/banim-efxmagic-crimsoneye.c +++ b/src/banim-efxmagic-crimsoneye.c @@ -1193,12 +1193,12 @@ void StartSubSpell_efxCrimsonEyeOBJ(struct Anim * anim) frontAnim->yPosition = proc->unk3A; frontAnim->oamBase = 0x3A000300; - (struct Anim *)(proc->unk44) = frontAnim = EfxCreateFrontAnim(anim, scr, scr, scr, scr); + *(struct Anim **)(&proc->unk44) = frontAnim = EfxCreateFrontAnim(anim, scr, scr, scr, scr); frontAnim->xPosition = proc->unk32; frontAnim->yPosition = proc->unk3A; frontAnim->oamBase = 0x38000300; - (struct Anim *)(proc->unk48) = frontAnim = EfxCreateFrontAnim(anim, scr, scr, scr, scr); + *(struct Anim **)(&proc->unk48) = frontAnim = EfxCreateFrontAnim(anim, scr, scr, scr, scr); frontAnim->xPosition = proc->unk32; frontAnim->yPosition = proc->unk3A; frontAnim->oamBase = 0x36000300; diff --git a/src/banim-efxmagic-shine.c b/src/banim-efxmagic-shine.c index 795e9a0c4..85cb22151 100644 --- a/src/banim-efxmagic-shine.c +++ b/src/banim-efxmagic-shine.c @@ -418,7 +418,7 @@ void efxShineOBJRND_Loop(struct ProcEfxOBJ * proc) proc->timer = 0; - (s16) proc->unk30 += 2; + proc->unk30 += 2; if ((s16)proc->unk30 > 7) { diff --git a/src/banim-ekrbattleintro.c b/src/banim-ekrbattleintro.c index d04433c41..8509043bb 100644 --- a/src/banim-ekrbattleintro.c +++ b/src/banim-ekrbattleintro.c @@ -1004,19 +1004,19 @@ bool PrepareBattleGraphicsMaybe(void) if (gEkrDistanceType == EKR_DISTANCE_PROMOTION) { - gBanimIdx[POS_L] = gBanimIdx_bak[POS_L] = GetBattleAnimationId(unit_bu1, animdef1, bu1->weapon, &animid1); - gBanimIdx[POS_R] = gBanimIdx_bak[POS_R] = GetBattleAnimationId(unit_bu2, animdef2, bu2->weapon, &animid2); + gBanimIdx[POS_L] = gBanimIdx_bak[POS_L] = GetBattleAnimationId(unit_bu1, animdef1, bu1->weapon, (u32*)&animid1); + gBanimIdx[POS_R] = gBanimIdx_bak[POS_R] = GetBattleAnimationId(unit_bu2, animdef2, bu2->weapon, (u32*)&animid2); } else { if (valid_l) { - gBanimIdx[POS_L] = gBanimIdx_bak[POS_L] = GetBattleAnimationId(unit_bu1, animdef1, bu1->weaponBefore, &animid1); + gBanimIdx[POS_L] = gBanimIdx_bak[POS_L] = GetBattleAnimationId(unit_bu1, animdef1, bu1->weaponBefore, (u32*)&animid1); } if (valid_r) { - gBanimIdx[POS_R] = gBanimIdx_bak[POS_R] = GetBattleAnimationId(unit_bu2, animdef2, bu2->weaponBefore, &animid2); + gBanimIdx[POS_R] = gBanimIdx_bak[POS_R] = GetBattleAnimationId(unit_bu2, animdef2, bu2->weaponBefore, (u32*)&animid2); } } @@ -1304,7 +1304,7 @@ bool PrepareBattleGraphicsMaybe(void) gBanimEffectiveness[POS_R] = IsItemEffectiveAgainst(bu2->weapon, unit_bu1); } - gBanimForceUnitChgDebug[POS_L] = gBanimForceUnitChgDebug[POS_R] = (void *)zero = 0; + gBanimForceUnitChgDebug[POS_L] = gBanimForceUnitChgDebug[POS_R] = *(void **)&zero = 0; if (valid_l) (void)GetItemIndex(bu1->weaponBefore); diff --git a/src/banim-ekrmain.c b/src/banim-ekrmain.c index 9d872b686..28ee462e8 100644 --- a/src/banim-ekrmain.c +++ b/src/banim-ekrmain.c @@ -490,7 +490,7 @@ void SwitchAISFrameDataFromBARoundType(struct Anim * anim, int type) if (frame != 0xFF) { if (GetAnimPosition(anim) == EKR_POS_L) { // use r1 for scr - scr = gpBanimModesLeft; + scr = (u32*)gpBanimModesLeft; scr = (void *)gBanimScrLeft + scr[frame]; } else { scr = (void *)gBanimScrRight + gpBanimModesRight[frame]; diff --git a/src/banim-ekrmainmini.c b/src/banim-ekrmainmini.c index f402030aa..60ef1935d 100644 --- a/src/banim-ekrmainmini.c +++ b/src/banim-ekrmainmini.c @@ -290,7 +290,7 @@ void sub_805A60C(struct AnimBuffer * pAnimBuf) if (pAnimBuf->state2 == 0) { - int * p; + u32 * p; puVar8 = pAnimBuf->unk_24; LZ77UnCompWram(ba2->oam_l, puVar8); p = (puVar8 + 0x15FC); @@ -298,7 +298,7 @@ void sub_805A60C(struct AnimBuffer * pAnimBuf) } else { - int * p; + u32 * p; puVar8 = pAnimBuf->unk_24; LZ77UnCompWram(ba2->oam_r, puVar8); p = (puVar8 + 0x15FC); @@ -406,7 +406,7 @@ void sub_805A7B4(struct AnimBuffer * pAnimBuf) if (pAnimBuf->state2 == 0) { - int * p; + u32 * p; puVar8 = pAnimBuf->unk_24; LZ77UnCompWram(ba2->oam_l, puVar8); p = (puVar8 + 0x15FC); @@ -414,7 +414,7 @@ void sub_805A7B4(struct AnimBuffer * pAnimBuf) } else { - int * p; + u32 * p; puVar8 = pAnimBuf->unk_24; LZ77UnCompWram(ba2->oam_r, puVar8); p = (puVar8 + 0x15FC); diff --git a/src/bb.c b/src/bb.c index 9a2a777f0..e6446f1da 100644 --- a/src/bb.c +++ b/src/bb.c @@ -59,7 +59,7 @@ void InitSubtitleHelpText(struct SubtitleHelpProc * proc) iter -= 2; line++; - GetCharTextLen(iter, &width); + GetCharTextLen(iter, (u32*)&width); Text_SetCursor(proc->text + line, (Text_GetCursor(proc->text) - width) - 0xC0); } diff --git a/src/bmarch.c b/src/bmarch.c index 3abd02cfc..abaaf1a38 100644 --- a/src/bmarch.c +++ b/src/bmarch.c @@ -7,8 +7,33 @@ #include "bmarch.h" +// To avoid compilation errors with modern gcc compilers due to forced function type conversion during external calls, +// the function implementing the same logic was divided into two versions with different return types. +// Theoretically, this should be a bug in the official code, and there should only be one version of the function with a return type of s8: +// 1. In the header file (.h), the function is declared with a return type of s32, while in the source file (.c), the function is defined with a return type of s8. +// 2. In such a case, if the current .c file does not include the corresponding .h file, it can be compiled successfully with the agbcc compiler, +// but this affects the compilation dependency relations in the Makefile. +// If we keep only one version of the function with a return type of s8, +// while declaring a version with a return type of s32 before external calls, +// it can also be compiled successfully with agbcc. +// However, since all function implementations are fully inlined in the current compilation unit, +// the resulting assembly file (.s) will not contain the symbol for this function, causing it to disappear eventually. +// Adding the extern keyword before the function definition can force modern gcc compilers to retain the function, +// but this leads to the issue of the function eventually disappearing when compiled with agbcc. +inline s32 IsBallista(struct Trap* trap) { -inline s8 IsBallista(struct Trap* trap) { + if (!trap) { + return 0; + } + + if (trap->type != TRAP_BALLISTA) { + return 0; + } + + return 1; +} + +static inline s8 IsBallistaInternal(struct Trap* trap) { if (!trap) { return 0; @@ -22,7 +47,7 @@ inline s8 IsBallista(struct Trap* trap) { } inline int sub_8037AC0(struct Trap* trap) { - if (!IsBallista(trap)) { + if (!IsBallistaInternal(trap)) { return 0; } @@ -30,7 +55,7 @@ inline int sub_8037AC0(struct Trap* trap) { } inline int sub_8037AEC(struct Trap* trap) { - if (!IsBallista(trap)) { + if (!IsBallistaInternal(trap)) { return 0; } @@ -38,7 +63,7 @@ inline int sub_8037AEC(struct Trap* trap) { } inline int GetBallistaItemUses(struct Trap* trap) { - if (!IsBallista(trap)) { + if (!IsBallistaInternal(trap)) { return 0; } diff --git a/src/bmdifficulty.c b/src/bmdifficulty.c index 07a7f37b4..3d16e85a4 100644 --- a/src/bmdifficulty.c +++ b/src/bmdifficulty.c @@ -1121,7 +1121,7 @@ extern u16 gUnknown_02003B88[]; extern struct Struct0859E7D4 gUnknown_02003BA8[]; // obj data? -const u16 CONST_DATA obj_859E79C[] = { +CONST_DATA u16 obj_859E79C[] = { 0x0002, 0x4000, 0x8000, 0x0100, 0x4000, 0x8020, 0x0104, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, diff --git a/src/bmmenu.c b/src/bmmenu.c index 3896fd726..c9041a3b4 100644 --- a/src/bmmenu.c +++ b/src/bmmenu.c @@ -1000,7 +1000,11 @@ void ItemSubMenuEnd(struct MenuProc* menu) { return; } -u8 MenuCommand_SelectNo(struct MenuProc* menu, struct MenuItemProc* menuItem) { +// In theory, this function should have a second parameter, but it has never been used in the code. +// If we keep this second parameter, calling the function in the code below after type conversion will result in compilation errors with modern gcc compilers. +// If we remove the second parameter, it will not cause any issues even if a second parameter (i.e., the r1 register) is passed in other non-explicit calls. +// This issue is likely due to a lack of synchronization in the official code. +u8 MenuCommand_SelectNo(struct MenuProc* menu/*, struct MenuItemProc* menuItem*/) { SetTextFont(NULL); TileMap_CopyRect(gUiTmScratchA, gBG0TilemapBuffer + 0x2B, 9, 19); @@ -1024,8 +1028,7 @@ u8 sub_8023550(struct MenuProc* menu) { ProcPtr proc; sub_8023538(menu); - // This is really caused by implicit declaration - ((void (*)(struct MenuProc*))MenuCommand_SelectNo)(menu); // TODO: FIXME: UB + MenuCommand_SelectNo(menu); proc = StartOrphanMenu(&gItemSelectMenuDef); @@ -1844,7 +1847,7 @@ int StealItemMenuCommand_Draw(struct MenuProc* menu, struct MenuItemProc* menuIt DrawItemMenuLine(&menuItem->text, item, isStealable, gBG0TilemapBuffer + TILEMAP_INDEX(menuItem->xTile, menuItem->yTile)); - return; + // return; } u8 StealItemMenuCommand_Effect(struct MenuProc* menu, struct MenuItemProc* menuItem) { @@ -2279,8 +2282,7 @@ u8 AttackBallistaCommandUsability(const struct MenuItemDef* def, int number) { trap = GetTrapAt(gActiveUnit->xPos, gActiveUnit->yPos); - // This is really caused by implicit declaration - isBallista = ((s32 (*)(struct Trap*))IsBallista)(trap); // TODO: FIXME: UB + isBallista = IsBallista(trap); if (isBallista == 0) { return MENU_NOTSHOWN; @@ -2373,7 +2375,7 @@ int ItemMenu_SwitchIn(struct MenuProc* menu, struct MenuItemProc* menuItem) { } int ItemMenu_SwitchOut_DoNothing(struct MenuProc* menu, struct MenuItemProc* menuItem) { - return; + // return; } u8 ItemMenuHelpBox(struct MenuProc* menu, struct MenuItemProc* menuItem) { diff --git a/src/bmtarget.c b/src/bmtarget.c index 9b07d9d60..b0d76501d 100644 --- a/src/bmtarget.c +++ b/src/bmtarget.c @@ -18,8 +18,6 @@ struct Unit* EWRAM_DATA gSubjectUnit = NULL; -s8 CanUnitCrossTerrain(struct Unit* unit, int terrain); - void ForEachUnitInMovement(void(*func)(struct Unit* unit)) { int ix; int iy; @@ -306,7 +304,7 @@ void TryAddToDropTargetList(int x, int y) { return; } - if (!CanUnitCrossTerrain(GetUnit(gSubjectUnit->rescue), gBmMapTerrain[y][x])) { + if (!(s8)CanUnitCrossTerrain(GetUnit(gSubjectUnit->rescue), gBmMapTerrain[y][x])) { return; } @@ -809,7 +807,7 @@ void AddAsTarget_IfPositionCleanForSummon(int x, int y) { return; } - if (!CanUnitCrossTerrain(gSubjectUnit, gBmMapTerrain[y][x])) { + if (!(s8)CanUnitCrossTerrain(gSubjectUnit, gBmMapTerrain[y][x])) { return; } @@ -841,7 +839,7 @@ void sub_8025CD8(int x, int y) { return; } - if (!CanUnitCrossTerrain(gSubjectUnit, gBmMapTerrain[y][x])) { + if (!(s8)CanUnitCrossTerrain(gSubjectUnit, gBmMapTerrain[y][x])) { return; } @@ -1272,7 +1270,7 @@ void TryAddToMineTargetList(int x, int y) { return; } - if (!CanUnitCrossTerrain(gSubjectUnit, gBmMapTerrain[y][x])) { + if (!(s8)CanUnitCrossTerrain(gSubjectUnit, gBmMapTerrain[y][x])) { return; } diff --git a/src/bmudisp.c b/src/bmudisp.c index 620c8bf6d..ad4ab19b1 100644 --- a/src/bmudisp.c +++ b/src/bmudisp.c @@ -982,7 +982,7 @@ struct SMSHandle* AddUnitSprite(int y) { it = it->pNext; } - return; + // return; } //! FE8U = 0x080273A4 diff --git a/src/bmunit.c b/src/bmunit.c index a30de7421..27b431990 100644 --- a/src/bmunit.c +++ b/src/bmunit.c @@ -989,7 +989,7 @@ void UnitChangeFaction(struct Unit* unit, int faction) { GetUnit(newUnit->rescue)->rescue = newUnit->index; } -inline s8 CanUnitCrossTerrain(struct Unit* unit, int terrain) { +inline s32 CanUnitCrossTerrain(struct Unit* unit, int terrain) { const s8* lookup = GetUnitMovementCost(unit); return (lookup[terrain] > 0) ? TRUE : FALSE; } @@ -1036,7 +1036,7 @@ void UnitGetDeathDropLocation(struct Unit* unit, int* xOut, int* yOut) { if (gBmMapHidden[iy][ix] & HIDDEN_BIT_UNIT) continue; - if (!CanUnitCrossTerrain(rescuee, gBmMapTerrain[iy][ix])) + if (!(s8)CanUnitCrossTerrain(rescuee, gBmMapTerrain[iy][ix])) continue; distance = RECT_DISTANCE(ix, iy, unit->xPos, unit->yPos); diff --git a/src/bmusemind.c b/src/bmusemind.c index 165aff1b8..ab9312ef8 100644 --- a/src/bmusemind.c +++ b/src/bmusemind.c @@ -25,8 +25,6 @@ #include "bmmind.h" #include "bmusemind.h" -s8 CanUnitCrossTerrain(struct Unit* unit, int terrain); - struct ProcCmd CONST_DATA ProcScr_PostWarpStaffAction[] = { PROC_SLEEP(0), PROC_CALL_2(PostWarpStaff_ExecTrap), @@ -142,7 +140,7 @@ void GetRescueStaffeePosition(struct Unit* unit, struct Unit* target, int* xOut, continue; } - if (!CanUnitCrossTerrain(target, gBmMapTerrain[iy][ix])) { + if (!(s8)CanUnitCrossTerrain(target, gBmMapTerrain[iy][ix])) { continue; } @@ -181,7 +179,7 @@ void GetRescueStaffeePosition(struct Unit* unit, struct Unit* target, int* xOut, continue; } - if (!CanUnitCrossTerrain(target, gBmMapTerrain[iy][ix])) { + if (!(s8)CanUnitCrossTerrain(target, gBmMapTerrain[iy][ix])) { continue; } diff --git a/src/bonusclaim.c b/src/bonusclaim.c index 789fbfbb0..6e6c1e082 100644 --- a/src/bonusclaim.c +++ b/src/bonusclaim.c @@ -350,7 +350,7 @@ void BonusClaim_Init(struct BonusClaimProc * proc) gLCDControlBuffer.wincnt.wout_enableBg0 = 1; gLCDControlBuffer.wincnt.wout_enableBg1 = 1; - gLCDControlBuffer.wincnt.wout_enableBg2 = 2; + gLCDControlBuffer.wincnt.wout_enableBg2 = 0; gLCDControlBuffer.wincnt.wout_enableBg3 = 1; gLCDControlBuffer.wincnt.wout_enableObj = 1; diff --git a/src/cgtext.c b/src/cgtext.c index 245ca6e67..e9587a862 100644 --- a/src/cgtext.c +++ b/src/cgtext.c @@ -687,7 +687,7 @@ void GetCgTextDimensions(const char * str, u8 * wOut, u8 * hOut) continue; default: - str = GetCharTextLen(str, &charWidth); + str = GetCharTextLen(str, (u32*)&charWidth); w += charWidth; continue; @@ -801,7 +801,7 @@ void GetCgTextBoxDimensions(const char * str, int * wOut, int * hOut) continue; default: - str = GetCharTextLen(str, &charWidth); + str = GetCharTextLen(str, (u32*)&charWidth); w += charWidth; continue; @@ -1269,7 +1269,7 @@ void CgTextInterpreter_808FF18(struct CgTextInterpreterProc * proc) int a = (parent->thIndex + 1) * 2; - sub_808FEA4(parent->vram, parent->boxWidth, a); + sub_808FEA4((int*)parent->vram, parent->boxWidth, a); proc->unk_4c++; diff --git a/src/code_80AE86C.c b/src/code_80AE86C.c index 0ee5bd882..5737b7c94 100644 --- a/src/code_80AE86C.c +++ b/src/code_80AE86C.c @@ -195,7 +195,7 @@ const char * sub_80AEAE8(char ** src, char ** dst) const char * result; int len; - result = GetCharTextLen(*src, &len); + result = GetCharTextLen(*src, (u32*)&len); result -= (uintptr_t)*src; memcpy(*dst, *src, (uintptr_t)result); diff --git a/src/cp_data.c b/src/cp_data.c index 44f855281..c72a2d288 100644 --- a/src/cp_data.c +++ b/src/cp_data.c @@ -1322,7 +1322,7 @@ struct AiScr CONST_DATA gAiScript_ActionInRange_ExceptNatasha[] = { AI_GOTO_START, }; -const u16 CONST_DATA gUnknown_085A8A24[] = { 0x100, 0x100, 0 }; +CONST_DATA u16 gUnknown_085A8A24[] = { 0x100, 0x100, 0 }; // 0x12 = Do not attack character ??? (points to 00 01 00 01) struct AiScr CONST_DATA gAiScript_085A8A2C[] = { @@ -1330,7 +1330,7 @@ struct AiScr CONST_DATA gAiScript_085A8A2C[] = { AI_GOTO_START, }; -const u16 CONST_DATA gUnknown_085A8A4C[] = { 0x100, 0 }; +CONST_DATA u16 gUnknown_085A8A4C[] = { 0x100, 0 }; // 0x13 = Do not attack character ??? (points to 00 01 00 00) struct AiScr CONST_DATA gAiScript_085A8A50[] = { @@ -1338,11 +1338,11 @@ struct AiScr CONST_DATA gAiScript_085A8A50[] = { AI_GOTO_START, }; -const u8 CONST_DATA gUnknown_085A8A70[] = { +CONST_DATA u8 gUnknown_085A8A70[] = { 5, 4, 80, 0 }; -const u8 CONST_DATA gUnknown_085A8A74[] = { +CONST_DATA u8 gUnknown_085A8A74[] = { 5, 3, 0, 0 }; @@ -1526,11 +1526,11 @@ AI_LABEL(0x1), AI_GOTO_START, }; -const u8 CONST_DATA gUnknown_085A90C0[] = { +CONST_DATA u8 gUnknown_085A90C0[] = { 0x0F, 0x11, 0, 0 }; -const u8 CONST_DATA gUnknown_085A90C4[] = { +CONST_DATA u8 gUnknown_085A90C4[] = { 0x0D, 0x0F, 0x12, 0x13 }; diff --git a/src/eventcall.c b/src/eventcall.c index 344ed6e22..f3efb50e5 100644 --- a/src/eventcall.c +++ b/src/eventcall.c @@ -253,7 +253,7 @@ void sub_8085670(struct Proc * proc) { if (GetGameClock() % 2) { - (u16)gBmSt.camera.x &= ~2; + gBmSt.camera.x = (u16)gBmSt.camera.x & 0xFFFD; gBmSt.camera.x ^= 1; } } @@ -274,7 +274,7 @@ void sub_80856D0(struct EventEngineProc * proc) } } else { if (GetGameClock() % 2) { - (u16)gBmSt.camera.y &= 0xFFFD; + gBmSt.camera.y = (u16)gBmSt.camera.y & 0xFFFD; gBmSt.camera.y ^= 1; } } @@ -334,7 +334,7 @@ void sub_808581C(ProcPtr parent) void sub_8085844(ProcPtr parent) { - (u16)gBmSt.camera.x &= 0xFFFC; + gBmSt.camera.x = (u16)gBmSt.camera.x & 0xFFFC; Proc_EndEach(gUnknown_089EE000); Sound_FadeOutSE(4); } @@ -348,7 +348,7 @@ CONST_DATA struct ProcCmd ProcScr_089EE048[] = { void sub_808586C(void) { - (u16)gBmSt.camera.y &= 0xFFFC; + gBmSt.camera.y = (u16)gBmSt.camera.y & 0xFFFC; Proc_EndEach(ProcScr_089EE030); Sound_FadeOutSE(4); } @@ -366,7 +366,7 @@ void sub_808589C(struct Proc * proc) { if (GetGameClock() % 2) { - (u16)gBmSt.camera.x &= 0xFFFD; + gBmSt.camera.x = (u16)gBmSt.camera.x & 0xFFFD; gBmSt.camera.x ^= 1; } } else @@ -390,7 +390,7 @@ void sub_808591C(struct EventEngineProc * proc) void sub_8085948(struct EventEngineProc * proc) { - (u16)gBmSt.camera.y &= 0xFFFC; + gBmSt.camera.y = (u16)gBmSt.camera.y & 0xFFFC; Sound_FadeOutSE(4); Proc_EndEach(ProcScr_089EE048); } diff --git a/src/eventfx-earthquake.c b/src/eventfx-earthquake.c index 40c79236c..1b6213f0d 100755 --- a/src/eventfx-earthquake.c +++ b/src/eventfx-earthquake.c @@ -74,8 +74,8 @@ void EndEventEarthQuake(void) switch (proc->type) { case 0: - (u16)gBmSt.camera.x &= 0xFFFC; - (u16)gBmSt.camera.y &= 0xFFFC; + gBmSt.camera.x = (u16)gBmSt.camera.x & 0xFFFC; + gBmSt.camera.y = (u16)gBmSt.camera.y & 0xFFFC; break; case 1: diff --git a/src/fogmap.c b/src/fogmap.c index c1d04a1f6..73e85e206 100644 --- a/src/fogmap.c +++ b/src/fogmap.c @@ -8,8 +8,6 @@ #include "hardware.h" #include "bmudisp.h" -s8 CanUnitCrossTerrain(struct Unit* unit, int terrain); - void UpdateMapViewWithFog(int vision_range) { if (vision_range < 0) @@ -51,7 +49,7 @@ void FillWarpRangeMap(struct Unit *unit_act, struct Unit *unit_tar) { if (gBmMapMovement[y][x] > 0x78) continue; - if (CanUnitCrossTerrain(unit_tar, gBmMapTerrain[y][x]) && + if ((s8)CanUnitCrossTerrain(unit_tar, gBmMapTerrain[y][x]) && 0 == gBmMapUnit[y][x]) continue; @@ -64,7 +62,7 @@ void FillWarpRangeMap(struct Unit *unit_act, struct Unit *unit_tar) { if (gBmMapMovement[y][x] > 0x78) continue; - if (CanUnitCrossTerrain(unit_tar, gBmMapTerrain[y][x]) && + if ((s8)CanUnitCrossTerrain(unit_tar, gBmMapTerrain[y][x]) && 0 == gBmMapUnit[y][x] && 0 != gBmMapFog[y][x]) continue; diff --git a/src/helpbox.c b/src/helpbox.c index 07e4f56a9..b2d0ba12d 100644 --- a/src/helpbox.c +++ b/src/helpbox.c @@ -1305,7 +1305,7 @@ void GetBoxDialogueSize(const char* str, int* wOut, int* hOut) { break; default: - str = GetCharTextLen(str, &charWidth); + str = GetCharTextLen(str, (u32*)&charWidth); w += charWidth; continue; @@ -1358,7 +1358,7 @@ void DialogBoxGetGlyphLen(const char* str, u8* xOut) { default: - it = GetCharTextLen(it, &charWidth); + it = GetCharTextLen(it, (u32*)&charWidth); x += charWidth; continue; diff --git a/src/mapanim_summon.c b/src/mapanim_summon.c index d6eda926d..3b63b93f8 100644 --- a/src/mapanim_summon.c +++ b/src/mapanim_summon.c @@ -202,9 +202,6 @@ void ProcSummonDK_ResetCounter(struct SumProc* proc) s8 SelectSummonPos(int x, int y, struct SumThing* result) { - // It is very strange that in this function, CanUnitCrossTerrain should return as int(*)(Unit*, int) - extern int CanUnitCrossTerrain(struct Unit* unit, int terrain); - struct SumThing array[9]; u8 chosen, count = 0; short iy, ix; diff --git a/src/menu_def.c b/src/menu_def.c index 3400abb2f..5ff915f72 100644 --- a/src/menu_def.c +++ b/src/menu_def.c @@ -92,7 +92,7 @@ CONST_DATA struct MenuItemDef gSendToConvoyMenuItems[] = { CONST_DATA struct MenuItemDef gYesNoSelectionMenuItems[] = { {"はい", 0x843, 0, 0, 0x32, MenuAlwaysEnabled, 0, MenuCommand_SelectYes, 0, 0, 0}, // Yes > - {"いいえ", 0x844, 0, 0, 0x33, MenuAlwaysEnabled, 0, MenuCommand_SelectNo, 0, 0, 0}, // No + {"いいえ", 0x844, 0, 0, 0x33, MenuAlwaysEnabled, 0, (MenuSelectFunc)MenuCommand_SelectNo, 0, 0, 0}, // No MenuItemsEnd }; @@ -282,7 +282,7 @@ CONST_DATA struct MenuDef gYesNoSelectionMenuDef = { 1, gYesNoSelectionMenuItems, 0, 0, 0, - MenuCommand_SelectNo, + (MenuSelectFunc)MenuCommand_SelectNo, 0, 0 }; @@ -293,7 +293,7 @@ CONST_DATA struct MenuDef gItemSubMenuDef = { 0, ItemSubMenuEnd, 0, - MenuCommand_SelectNo, + (MenuSelectFunc)MenuCommand_SelectNo, MenuAutoHelpBoxSelect, MenuStdHelpBox }; diff --git a/src/mu.c b/src/mu.c index ab5bc269c..2fb1c6c93 100644 --- a/src/mu.c +++ b/src/mu.c @@ -763,7 +763,7 @@ void MU_SetDefaultFacing_Auto(void) { MU_SetDefaultFacing(proc); } -void MU_StartMoveScript_Auto(const u8 commands[MU_COMMAND_MAX_COUNT]) { +void MU_StartMoveScript_Auto(const u8 commands[/*MU_COMMAND_MAX_COUNT*/]) { struct MUProc* proc = Proc_Find(gProcScr_MoveUnit); if (proc) @@ -802,7 +802,7 @@ s8 MU_IsActive(struct MUProc* proc) { return FALSE; } -void MU_StartMoveScript(struct MUProc* proc, const u8 commands[MU_COMMAND_MAX_COUNT]) { +void MU_StartMoveScript(struct MUProc* proc, const u8 commands[/*MU_COMMAND_MAX_COUNT*/]) { int i; for (i = 0; i < 0x40; ++i) @@ -1243,7 +1243,7 @@ void MU_AllEnable(void) { void MU_GetComputedEndPosition(int* xOut, int* yOut, const u8* commands) { while (TRUE) { - switch (*commands++) { + switch ((s32)*commands++) { case MU_COMMAND_END: return; diff --git a/src/proc.c b/src/proc.c index 2c20d68b3..70ed45169 100644 --- a/src/proc.c +++ b/src/proc.c @@ -21,7 +21,7 @@ EWRAM_DATA struct Proc *gProcTreeRootArray[8] = {0}; static struct Proc* AllocateProcess(void); static void FreeProcess(struct Proc *proc); -static void InsertRootProcess(struct Proc *proc, int rootIndex); +static void InsertRootProcess(struct Proc *proc, s32 rootIndex); static void InsertChildProcess(struct Proc *proc, struct Proc *parent); static void UnlinkProcess(struct Proc *proc); static void RunProcessScript(struct Proc *proc); diff --git a/src/rng.c b/src/rng.c index 17b9eee76..831957914 100644 --- a/src/rng.c +++ b/src/rng.c @@ -27,7 +27,7 @@ int NextRN(void) { return rn; } -void InitRN(int seed) { +void InitRN(s32 seed) { // This table is a collection of 8 possible initial rn state // 3 entries will be picked based of which "seed" was given @@ -95,7 +95,7 @@ s8 Roll2RN(int threshold) { // the second implementation of RN is an LCG (Linear Congruental Generator), // where gLCGRNValue is set to a seed and then advanced and retrieved on demand. -void SetLCGRNValue(int seed) { +void SetLCGRNValue(s32 seed) { gLCGRNValue = seed; } diff --git a/src/scene.c b/src/scene.c index 2390f4c3f..d4f20a767 100644 --- a/src/scene.c +++ b/src/scene.c @@ -2440,7 +2440,7 @@ int GetStrTalkLen(const char* str, s8 isBubbleOpen) { } } - str = GetCharTextLen(str, &chrLen); + str = GetCharTextLen(str, (u32*)&chrLen); currentLineLen += chrLen; } diff --git a/src/whitecircularfadefx.c b/src/whitecircularfadefx.c index 36fba8828..05999d84d 100644 --- a/src/whitecircularfadefx.c +++ b/src/whitecircularfadefx.c @@ -90,7 +90,7 @@ void StartCircularFadeAnim(ProcPtr parent, int x, int y) u32 r, b, g; struct ProcWhiteCircleFx *proc; u32 *cur = BG_CHR_ADDR(BGCHR_BMFX_IMG); - int val = 0; + u32 val = 0; for (i = 0; i < 0x20; i++) { for (j = 0; j < 0x8; j++)