summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile37
-rw-r--r--berry_fix/Makefile28
-rw-r--r--berry_fix/payload/Makefile26
-rw-r--r--gflib/bg.c (renamed from src/bg.c)0
-rw-r--r--gflib/bg.h (renamed from include/bg.h)0
-rw-r--r--gflib/blit.c (renamed from src/blit.c)0
-rw-r--r--gflib/blit.h (renamed from include/blit.h)0
-rw-r--r--gflib/dma3.h (renamed from include/dma3.h)0
-rw-r--r--gflib/dma3_manager.c (renamed from src/dma3_manager.c)0
-rw-r--r--gflib/gpu_regs.c (renamed from src/gpu_regs.c)0
-rw-r--r--gflib/gpu_regs.h (renamed from include/gpu_regs.h)0
-rw-r--r--gflib/malloc.c (renamed from src/alloc.c)0
-rw-r--r--gflib/malloc.h (renamed from include/alloc.h)0
-rw-r--r--gflib/sprite.c (renamed from src/sprite.c)0
-rw-r--r--gflib/sprite.h (renamed from include/sprite.h)0
-rw-r--r--gflib/string_util.c (renamed from src/string_util.c)0
-rw-r--r--gflib/string_util.h (renamed from include/string_util.h)0
-rw-r--r--gflib/text.c (renamed from src/text.c)0
-rw-r--r--gflib/text.h (renamed from include/text.h)0
-rw-r--r--gflib/window.c (renamed from src/window.c)2
-rw-r--r--gflib/window.h (renamed from include/window.h)0
-rw-r--r--ld_script.txt44
-rw-r--r--ld_script_modern.txt7
-rw-r--r--libagbsyscall/Makefile98
-rw-r--r--libagbsyscall/libagbsyscall.s432
-rw-r--r--src/apprentice.c2
-rw-r--r--src/battle_anim_effects_1.c2
-rwxr-xr-xsrc/battle_anim_effects_2.c2
-rwxr-xr-xsrc/battle_anim_effects_3.c2
-rw-r--r--src/battle_anim_mons.c2
-rw-r--r--src/battle_anim_utility_funcs.c2
-rw-r--r--src/battle_dome.c2
-rw-r--r--src/battle_factory_screen.c2
-rw-r--r--src/battle_gfx_sfx_util.c2
-rw-r--r--src/battle_main.c2
-rw-r--r--src/battle_message.c2
-rw-r--r--src/battle_pike.c2
-rw-r--r--src/battle_pyramid.c2
-rw-r--r--src/battle_pyramid_bag.c2
-rw-r--r--src/battle_records.c2
-rw-r--r--src/battle_script_commands.c2
-rw-r--r--src/battle_transition.c2
-rw-r--r--src/battle_util2.c2
-rw-r--r--src/berry_blender.c2
-rwxr-xr-xsrc/berry_crush.c2
-rw-r--r--src/berry_fix_program.c2
-rw-r--r--src/berry_tag_screen.c8
-rw-r--r--src/cable_car.c2
-rw-r--r--src/contest.c2
-rw-r--r--src/contest_link_80F57C4.c2
-rw-r--r--src/contest_painting.c2
-rw-r--r--src/credits.c2
-rw-r--r--src/data.c2
-rw-r--r--src/decompress.c2
-rw-r--r--src/decoration.c2
-rw-r--r--src/dewford_trend.c2
-rw-r--r--src/diploma.c2
-rw-r--r--src/dodrio_berry_picking.c2
-rw-r--r--src/easy_chat.c2
-rw-r--r--src/egg_hatch.c2
-rwxr-xr-xsrc/ereader_helpers.c2
-rwxr-xr-xsrc/ereader_screen.c2
-rw-r--r--src/event_object_movement.c2
-rw-r--r--src/evolution_scene.c2
-rw-r--r--src/field_region_map.c2
-rw-r--r--src/field_specials.c10
-rw-r--r--src/fldeff_cut.c2
-rw-r--r--src/frontier_pass.c2
-rw-r--r--src/frontier_util.c2
-rw-r--r--src/hall_of_fame.c2
-rw-r--r--src/intro.c2
-rw-r--r--src/item.c2
-rw-r--r--src/item_icon.c2
-rwxr-xr-xsrc/item_menu.c50
-rwxr-xr-xsrc/item_use.c4
-rw-r--r--src/libagbsyscall.s116
-rw-r--r--src/link.c2
-rw-r--r--src/link_rfu.c2
-rw-r--r--src/list_menu.c2
-rw-r--r--src/load_save.c2
-rw-r--r--src/mail.c2
-rw-r--r--src/main.c2
-rw-r--r--src/main_menu.c8
-rw-r--r--src/match_call.c12
-rw-r--r--src/mauville_old_man.c2
-rw-r--r--src/menu.c10
-rw-r--r--src/menu_specialized.c8
-rw-r--r--src/mevent_801BAAC.c2
-rw-r--r--src/mevent_client.c2
-rw-r--r--src/mevent_server.c2
-rw-r--r--src/mevent_server_helpers.c2
-rw-r--r--src/mirage_tower.c2
-rw-r--r--src/mossdeep_gym.c2
-rw-r--r--src/move_relearner.c2
-rw-r--r--src/mystery_gift.c2
-rw-r--r--src/naming_screen.c2
-rw-r--r--src/overworld.c2
-rwxr-xr-xsrc/party_menu.c16
-rw-r--r--src/player_pc.c2
-rw-r--r--src/pokeblock.c2
-rw-r--r--src/pokeblock_feed.c2
-rw-r--r--src/pokedex.c4
-rwxr-xr-xsrc/pokedex_area_screen.c2
-rw-r--r--src/pokedex_cry_screen.c2
-rw-r--r--src/pokemon.c2
-rwxr-xr-xsrc/pokemon_jump.c2
-rw-r--r--src/pokemon_size_record.c4
-rw-r--r--src/pokemon_storage_system.c4
-rw-r--r--src/pokemon_summary_screen.c40
-rw-r--r--src/pokenav.c2
-rw-r--r--src/pokenav_unk_2.c2
-rw-r--r--src/rayquaza_scene.c2
-rw-r--r--src/record_mixing.c2
-rw-r--r--src/recorded_battle.c2
-rw-r--r--src/region_map.c2
-rw-r--r--src/reset_rtc_screen.c8
-rw-r--r--src/reset_save_heap.c2
-rw-r--r--src/rom_8034C54.c2
-rw-r--r--src/rom_81520A8.c2
-rw-r--r--src/roulette.c4
-rw-r--r--src/scrcmd.c6
-rw-r--r--src/secret_base.c2
-rwxr-xr-xsrc/shop.c4
-rw-r--r--src/slot_machine.c2
-rw-r--r--src/trade.c2
-rwxr-xr-xsrc/trainer_card.c36
-rw-r--r--src/trainer_hill.c2
-rw-r--r--src/trainer_pokemon_sprites.c2
-rw-r--r--src/tv.c2
-rw-r--r--src/union_room.c2
-rw-r--r--src/union_room_battle.c2
-rwxr-xr-xsrc/union_room_chat.c2
-rw-r--r--src/unk_pokedex_area_screen_helper.c2
-rw-r--r--src/use_pokeblock.c2
-rw-r--r--sym_bss.txt12
-rw-r--r--sym_common.txt36
-rw-r--r--sym_ewram.txt8
137 files changed, 894 insertions, 368 deletions
diff --git a/Makefile b/Makefile
index 85d3f6a51..293f86f17 100644
--- a/Makefile
+++ b/Makefile
@@ -43,6 +43,7 @@ ELF = $(ROM:.gba=.elf)
MAP = $(ROM:.gba=.map)
C_SUBDIR = src
+GFLIB_SUBDIR = gflib
ASM_SUBDIR = asm
DATA_SRC_SUBDIR = src/data
DATA_ASM_SUBDIR = data
@@ -50,6 +51,7 @@ SONG_SUBDIR = sound/songs
MID_SUBDIR = sound/songs/midi
C_BUILDDIR = $(OBJ_DIR)/$(C_SUBDIR)
+GFLIB_BUILDDIR = $(OBJ_DIR)/$(GFLIB_SUBDIR)
ASM_BUILDDIR = $(OBJ_DIR)/$(ASM_SUBDIR)
DATA_ASM_BUILDDIR = $(OBJ_DIR)/$(DATA_ASM_SUBDIR)
SONG_BUILDDIR = $(OBJ_DIR)/$(SONG_SUBDIR)
@@ -73,14 +75,14 @@ OBJ_DIR := build/modern
LIBPATH := -L $(TOOLCHAIN)/lib/gcc/arm-none-eabi/$(GCC_VER)/thumb -L $(TOOLCHAIN)/arm-none-eabi/lib/thumb
endif
-CPPFLAGS := -iquote include -Wno-trigraphs -DMODERN=$(MODERN)
+CPPFLAGS := -iquote include -iquote $(GFLIB_SUBDIR) -Wno-trigraphs -DMODERN=$(MODERN)
ifeq ($(MODERN),0)
CPPFLAGS += -I tools/agbcc/include -I tools/agbcc
endif
LDFLAGS = -Map ../../$(MAP)
-LIB := $(LIBPATH) -lgcc -lc
+LIB := $(LIBPATH) -lgcc -lc -L../../libagbsyscall -lagbsyscall
SHA1 := $(shell { command -v sha1sum || command -v shasum; } 2>/dev/null) -c
GFX := tools/gbagfx/gbagfx$(EXE)
@@ -109,7 +111,7 @@ MAKEFLAGS += --no-print-directory
# Secondary expansion is required for dependency variables in object rules.
.SECONDEXPANSION:
-.PHONY: all rom clean compare tidy tools mostlyclean clean-tools $(TOOLDIRS) berry_fix
+.PHONY: all rom clean compare tidy tools mostlyclean clean-tools $(TOOLDIRS) berry_fix libagbsyscall
infoshell = $(foreach line, $(shell $1 | sed "s/ /__SPACE__/g"), $(info $(subst __SPACE__, ,$(line))))
@@ -125,6 +127,9 @@ C_SRCS_IN := $(wildcard $(C_SUBDIR)/*.c $(C_SUBDIR)/*/*.c $(C_SUBDIR)/*/*/*.c)
C_SRCS := $(foreach src,$(C_SRCS_IN),$(if $(findstring .inc.c,$(src)),,$(src)))
C_OBJS := $(patsubst $(C_SUBDIR)/%.c,$(C_BUILDDIR)/%.o,$(C_SRCS))
+GFLIB_SRCS := $(wildcard $(GFLIB_SUBDIR)/*.c)
+GFLIB_OBJS := $(patsubst $(GFLIB_SUBDIR)/%.c,$(GFLIB_BUILDDIR)/%.o,$(GFLIB_SRCS))
+
C_ASM_SRCS += $(wildcard $(C_SUBDIR)/*.s $(C_SUBDIR)/*/*.s $(C_SUBDIR)/*/*/*.s)
C_ASM_OBJS := $(patsubst $(C_SUBDIR)/%.s,$(C_BUILDDIR)/%.o,$(C_ASM_SRCS))
@@ -140,7 +145,7 @@ SONG_OBJS := $(patsubst $(SONG_SUBDIR)/%.s,$(SONG_BUILDDIR)/%.o,$(SONG_SRCS))
MID_SRCS := $(wildcard $(MID_SUBDIR)/*.mid)
MID_OBJS := $(patsubst $(MID_SUBDIR)/%.mid,$(MID_BUILDDIR)/%.o,$(MID_SRCS))
-OBJS := $(C_OBJS) $(C_ASM_OBJS) $(ASM_OBJS) $(DATA_ASM_OBJS) $(SONG_OBJS) $(MID_OBJS)
+OBJS := $(C_OBJS) $(GFLIB_OBJS) $(C_ASM_OBJS) $(ASM_OBJS) $(DATA_ASM_OBJS) $(SONG_OBJS) $(MID_OBJS)
OBJS_REL := $(patsubst $(OBJ_DIR)/%,%,$(OBJS))
SUBDIRS := $(sort $(dir $(OBJS)))
@@ -156,7 +161,7 @@ tools: $(TOOLDIRS)
$(TOOLDIRS):
@$(MAKE) -C $@ CC=$(HOSTCC) CXX=$(HOSTCXX)
-rom: berry_fix $(ROM)
+rom: $(ROM)
ifeq ($(COMPARE),1)
@$(SHA1) rom.sha1
endif
@@ -178,6 +183,7 @@ mostlyclean: tidy
find $(DATA_ASM_SUBDIR)/maps \( -iname 'connections.inc' -o -iname 'events.inc' -o -iname 'header.inc' \) -exec rm {} +
rm -f $(AUTO_GEN_TARGETS)
@$(MAKE) clean -C berry_fix
+ @$(MAKE) clean -C libagbsyscall
tidy:
rm -f $(ROM) $(ELF) $(MAP)
@@ -230,7 +236,7 @@ endif
ifeq ($(NODEP),1)
$(C_BUILDDIR)/%.o: c_dep :=
else
-$(C_BUILDDIR)/%.o: c_dep = $(shell [[ -f $(C_SUBDIR)/$*.c ]] && $(SCANINC) -I include -I tools/agbcc/include $(C_SUBDIR)/$*.c)
+$(C_BUILDDIR)/%.o: c_dep = $(shell [[ -f $(C_SUBDIR)/$*.c ]] && $(SCANINC) -I include -I tools/agbcc/include -I gflib $(C_SUBDIR)/$*.c)
endif
ifeq ($(DINFO),1)
@@ -244,6 +250,18 @@ $(C_BUILDDIR)/%.o : $(C_SUBDIR)/%.c $$(c_dep)
$(AS) $(ASFLAGS) -o $@ $(C_BUILDDIR)/$*.s
ifeq ($(NODEP),1)
+$(GFLIB_BUILDDIR)/%.o: c_dep :=
+else
+$(GFLIB_BUILDDIR)/%.o: c_dep = $(shell [[ -f $(GFLIB_SUBDIR)/$*.c ]] && $(SCANINC) -I include -I tools/agbcc/include -I gflib $(GFLIB_SUBDIR)/$*.c)
+endif
+
+$(GFLIB_BUILDDIR)/%.o : $(GFLIB_SUBDIR)/%.c $$(c_dep)
+ @$(CPP) $(CPPFLAGS) $< -o $(GFLIB_BUILDDIR)/$*.i
+ @$(PREPROC) $(GFLIB_BUILDDIR)/$*.i charmap.txt | $(CC1) $(CFLAGS) -o $(GFLIB_BUILDDIR)/$*.s
+ @echo -e ".text\n\t.align\t2, 0\n" >> $(GFLIB_BUILDDIR)/$*.s
+ $(AS) $(ASFLAGS) -o $@ $(GFLIB_BUILDDIR)/$*.s
+
+ifeq ($(NODEP),1)
$(C_BUILDDIR)/%.o: c_asm_dep :=
else
$(C_BUILDDIR)/%.o: c_asm_dep = $(shell [[ -f $(C_SUBDIR)/$*.s ]] && $(SCANINC) -I "" $(C_SUBDIR)/$*.s)
@@ -293,7 +311,7 @@ endif
$(OBJ_DIR)/ld_script.ld: $(LD_SCRIPT) $(LD_SCRIPT_DEPS)
cd $(OBJ_DIR) && sed "s#tools/#../../tools/#g" ../../$(LD_SCRIPT) > ld_script.ld
-$(ELF): $(OBJ_DIR)/ld_script.ld $(OBJS)
+$(ELF): $(OBJ_DIR)/ld_script.ld $(OBJS) berry_fix libagbsyscall
cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ld_script.ld -o ../../$@ $(OBJS_REL) $(LIB)
$(FIX) $@ -t"$(TITLE)" -c$(GAME_CODE) -m$(MAKER_CODE) -r$(REVISION) --silent
@@ -306,4 +324,7 @@ modern: ; @$(MAKE) MODERN=1
berry_fix/berry_fix.gba: berry_fix
berry_fix:
- @$(MAKE) -C berry_fix COMPARE=$(COMPARE)
+ @$(MAKE) -C berry_fix COMPARE=$(COMPARE) TOOLCHAIN=$(TOOLCHAIN)
+
+libagbsyscall:
+ @$(MAKE) -C libagbsyscall TOOLCHAIN=$(TOOLCHAIN)
diff --git a/berry_fix/Makefile b/berry_fix/Makefile
index 2bc225eba..0ead3804f 100644
--- a/berry_fix/Makefile
+++ b/berry_fix/Makefile
@@ -1,7 +1,29 @@
-include $(DEVKITARM)/base_tools
+TOOLCHAIN := $(DEVKITARM)
+COMPARE ?= 0
+
+ifeq ($(CC),)
+HOSTCC := gcc
+else
+HOSTCC := $(CC)
+endif
+
+ifeq ($(CXX),)
+HOSTCXX := g++
+else
+HOSTCXX := $(CXX)
+endif
+
+ifneq (,$(wildcard $(TOOLCHAIN)/base_tools))
+include $(TOOLCHAIN)/base_tools
+else
+export PATH := $(TOOLCHAIN)/bin:$(PATH)
+PREFIX := arm-none-eabi-
+OBJCOPY := $(PREFIX)objcopy
+export CC := $(PREFIX)gcc
+export AS := $(PREFIX)as
+endif
export CPP := $(PREFIX)cpp
export LD := $(PREFIX)ld
-COMPARE ?= 0
ifeq ($(OS),Windows_NT)
EXE := .exe
@@ -144,7 +166,7 @@ $(DATA_ASM_BUILDDIR)/%.o: data_dep = $(shell $(SCANINC) $(DATA_ASM_SUBDIR)/$*.s)
endif
payload:
- @$(MAKE) -C payload COMPARE=$(COMPARE)
+ @$(MAKE) -C payload COMPARE=$(COMPARE) TOOLCHAIN=$(TOOLCHAIN)
payload/payload.gba: payload
diff --git a/berry_fix/payload/Makefile b/berry_fix/payload/Makefile
index 63e326724..a121fda93 100644
--- a/berry_fix/payload/Makefile
+++ b/berry_fix/payload/Makefile
@@ -1,7 +1,29 @@
-include $(DEVKITARM)/base_tools
+TOOLCHAIN := $(DEVKITARM)
+COMPARE ?= 0
+
+ifeq ($(CC),)
+HOSTCC := gcc
+else
+HOSTCC := $(CC)
+endif
+
+ifeq ($(CXX),)
+HOSTCXX := g++
+else
+HOSTCXX := $(CXX)
+endif
+
+ifneq (,$(wildcard $(TOOLCHAIN)/base_tools))
+include $(TOOLCHAIN)/base_tools
+else
+export PATH := $(TOOLCHAIN)/bin:$(PATH)
+PREFIX := arm-none-eabi-
+OBJCOPY := $(PREFIX)objcopy
+export CC := $(PREFIX)gcc
+export AS := $(PREFIX)as
+endif
export CPP := $(PREFIX)cpp
export LD := $(PREFIX)ld
-COMPARE ?= 0
ifeq ($(OS),Windows_NT)
EXE := .exe
diff --git a/src/bg.c b/gflib/bg.c
index ab4e8b60d..ab4e8b60d 100644
--- a/src/bg.c
+++ b/gflib/bg.c
diff --git a/include/bg.h b/gflib/bg.h
index 3c7eee292..3c7eee292 100644
--- a/include/bg.h
+++ b/gflib/bg.h
diff --git a/src/blit.c b/gflib/blit.c
index 26a63fe9b..26a63fe9b 100644
--- a/src/blit.c
+++ b/gflib/blit.c
diff --git a/include/blit.h b/gflib/blit.h
index 78f67766e..78f67766e 100644
--- a/include/blit.h
+++ b/gflib/blit.h
diff --git a/include/dma3.h b/gflib/dma3.h
index 8eff34f55..8eff34f55 100644
--- a/include/dma3.h
+++ b/gflib/dma3.h
diff --git a/src/dma3_manager.c b/gflib/dma3_manager.c
index 43744883f..43744883f 100644
--- a/src/dma3_manager.c
+++ b/gflib/dma3_manager.c
diff --git a/src/gpu_regs.c b/gflib/gpu_regs.c
index 3bcc4fd93..3bcc4fd93 100644
--- a/src/gpu_regs.c
+++ b/gflib/gpu_regs.c
diff --git a/include/gpu_regs.h b/gflib/gpu_regs.h
index 89e0cb64b..89e0cb64b 100644
--- a/include/gpu_regs.h
+++ b/gflib/gpu_regs.h
diff --git a/src/alloc.c b/gflib/malloc.c
index 4d1a9fe5c..4d1a9fe5c 100644
--- a/src/alloc.c
+++ b/gflib/malloc.c
diff --git a/include/alloc.h b/gflib/malloc.h
index f2dcf6d46..f2dcf6d46 100644
--- a/include/alloc.h
+++ b/gflib/malloc.h
diff --git a/src/sprite.c b/gflib/sprite.c
index e25eac62e..e25eac62e 100644
--- a/src/sprite.c
+++ b/gflib/sprite.c
diff --git a/include/sprite.h b/gflib/sprite.h
index 9753837fd..9753837fd 100644
--- a/include/sprite.h
+++ b/gflib/sprite.h
diff --git a/src/string_util.c b/gflib/string_util.c
index bce299057..bce299057 100644
--- a/src/string_util.c
+++ b/gflib/string_util.c
diff --git a/include/string_util.h b/gflib/string_util.h
index b921d2391..b921d2391 100644
--- a/include/string_util.h
+++ b/gflib/string_util.h
diff --git a/src/text.c b/gflib/text.c
index 7e4fa7104..7e4fa7104 100644
--- a/src/text.c
+++ b/gflib/text.c
diff --git a/include/text.h b/gflib/text.h
index e37773475..e37773475 100644
--- a/include/text.h
+++ b/gflib/text.h
diff --git a/src/window.c b/gflib/window.c
index fbce57743..7c87ea86d 100644
--- a/src/window.c
+++ b/gflib/window.c
@@ -1,6 +1,6 @@
#include "global.h"
#include "window.h"
-#include "alloc.h"
+#include "malloc.h"
#include "bg.h"
#include "blit.h"
diff --git a/include/window.h b/gflib/window.h
index 10e447789..10e447789 100644
--- a/include/window.h
+++ b/gflib/window.h
diff --git a/ld_script.txt b/ld_script.txt
index 4247fca4d..d37cd595f 100644
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -49,15 +49,15 @@ SECTIONS {
{
src/crt0.o(.text);
src/main.o(.text);
- src/alloc.o(.text);
- src/dma3_manager.o(.text);
- src/gpu_regs.o(.text);
- src/bg.o(.text);
- src/blit.o(.text);
- src/window.o(.text);
- src/text.o(.text);
- src/sprite.o(.text);
- src/string_util.o(.text);
+ gflib/malloc.o(.text);
+ gflib/dma3_manager.o(.text);
+ gflib/gpu_regs.o(.text);
+ gflib/bg.o(.text);
+ gflib/blit.o(.text);
+ gflib/window.o(.text);
+ gflib/text.o(.text);
+ gflib/sprite.o(.text);
+ gflib/string_util.o(.text);
src/link.o(.text);
src/link_rfu.o(.text);
src/union_room.o(.text);
@@ -361,7 +361,21 @@ SECTIONS {
src/librfu_rfu.o(.text);
asm/librfu.o(.text);
src/libisagbprn.o(.text);
- src/libagbsyscall.o(.text);
+ *libagbsyscall.a:ArcTan2.o(.text);
+ *libagbsyscall.a:BgAffineSet.o(.text);
+ *libagbsyscall.a:CpuFastSet.o(.text);
+ *libagbsyscall.a:CpuSet.o(.text);
+ *libagbsyscall.a:Div.o(.text);
+ *libagbsyscall.a:LZ77UnCompVram.o(.text);
+ *libagbsyscall.a:LZ77UnCompWram.o(.text);
+ *libagbsyscall.a:MultiBoot.o(.text);
+ *libagbsyscall.a:ObjAffineSet.o(.text);
+ *libagbsyscall.a:RLUnCompVram.o(.text);
+ *libagbsyscall.a:RLUnCompWram.o(.text);
+ *libagbsyscall.a:RegisterRamReset.o(.text);
+ *libagbsyscall.a:SoftReset.o(.text);
+ *libagbsyscall.a:Sqrt.o(.text);
+ *libagbsyscall.a:VBlankIntrWait.o(.text);
*libgcc.a:_call_via_rX.o(.text);
*libgcc.a:_divdi3.o(.text);
*libgcc.a:_divsi3.o(.text);
@@ -420,12 +434,12 @@ SECTIONS {
ALIGN(4)
{
src/main.o(.rodata);
- src/bg.o(.rodata);
- src/window.o(.rodata);
- src/text.o(.rodata);
- src/sprite.o(.rodata);
+ gflib/bg.o(.rodata);
+ gflib/window.o(.rodata);
+ gflib/text.o(.rodata);
+ gflib/sprite.o(.rodata);
data/io_reg.o(.rodata);
- src/string_util.o(.rodata);
+ gflib/string_util.o(.rodata);
src/link.o(.rodata);
src/link.o(.rodata.str1.4);
src/link_rfu.o(.rodata);
diff --git a/ld_script_modern.txt b/ld_script_modern.txt
index 5157e81dc..bf575857e 100644
--- a/ld_script_modern.txt
+++ b/ld_script_modern.txt
@@ -14,6 +14,7 @@ SECTIONS {
. = 0x1C000;
src/*.o(ewram_data);
+ gflib/*.o(ewram_data);
. = 0x40000;
}
@@ -25,12 +26,14 @@ SECTIONS {
{
/* .bss starts at 0x3000000 */
src/*.o(.bss);
+ gflib/*.o(.bss);
/* .bss.code starts at 0x3001AA8 */
src/m4a.o(.bss.code);
/* COMMON starts at 0x30022A8 */
src/*.o(COMMON);
+ gflib/*.o(COMMON);
*libc.a:sbrkr.o(COMMON);
end = .;
. = 0x8000;
@@ -43,6 +46,7 @@ SECTIONS {
{
src/crt0.o(.text);
src/*.o(.text);
+ gflib/*.o(.text);
asm/*.o(.text);
} =0
@@ -67,7 +71,7 @@ SECTIONS {
asm/librfu_intr.o(.text);
src/librfu_rfu.o(.text);
asm/librfu.o(.text);
- src/libagbsyscall.o(.text);
+ *libagbsyscall.a:*.o(.text*);
*libgcc.a:*.o(.text*);
*libc.a:*.o(.text*);
src/libisagbprn.o(.text);
@@ -77,6 +81,7 @@ SECTIONS {
ALIGN(4)
{
src/*.o(.rodata*);
+ gflib/*.o(.rodata*);
data/*.o(.rodata*);
} =0
diff --git a/libagbsyscall/Makefile b/libagbsyscall/Makefile
new file mode 100644
index 000000000..911cdb237
--- /dev/null
+++ b/libagbsyscall/Makefile
@@ -0,0 +1,98 @@
+TOOLCHAIN := $(DEVKITARM)
+COMPARE ?= 0
+
+ifeq ($(CC),)
+HOSTCC := gcc
+else
+HOSTCC := $(CC)
+endif
+
+ifeq ($(CXX),)
+HOSTCXX := g++
+else
+HOSTCXX := $(CXX)
+endif
+
+ifneq (,$(wildcard $(TOOLCHAIN)/base_tools))
+include $(TOOLCHAIN)/base_tools
+else
+export PATH := $(TOOLCHAIN)/bin:$(PATH)
+PREFIX := arm-none-eabi-
+OBJCOPY := $(PREFIX)objcopy
+export CC := $(PREFIX)gcc
+export AS := $(PREFIX)as
+endif
+export CPP := $(PREFIX)cpp
+export LD := $(PREFIX)ld
+
+ifeq ($(OS),Windows_NT)
+EXE := .exe
+else
+EXE :=
+endif
+
+ASFLAGS := -mcpu=arm7tdmi
+ARFLAGS := rc
+
+SYSCALLS := IntrWait \
+ RegisterRamReset \
+ Sqrt \
+ MusicPlayerOpen \
+ SoundBiasReset \
+ SoundDriverVSyncOn \
+ Mod \
+ VBlankIntrWait \
+ MusicPlayerStart \
+ SoundDriverVSyncOff \
+ HuffUnComp \
+ SoftResetExram \
+ MusicPlayerFadeOut \
+ LZ77UnCompWram \
+ SoundDriverMain \
+ SoundBiasChange \
+ LZ77UnCompVram \
+ ArcTan2 \
+ MusicPlayerStop \
+ DivArm \
+ ModArm \
+ SoundDriverVSync \
+ SoundDriverInit \
+ BgAffineSet \
+ Diff8bitUnFilterWram \
+ MultiBoot \
+ MidiKey2Freq \
+ Div \
+ Diff8bitUnFilterVram \
+ ArcTan \
+ ObjAffineSet \
+ SoftResetRom \
+ SoundDriverMode \
+ RLUnCompWram \
+ BitUnPack \
+ SoundChannelClear \
+ CpuFastSet \
+ CpuSet \
+ Diff16bitUnFilter \
+ SoundBiasSet \
+ MusicPlayerContinue \
+ SoftReset \
+ RLUnCompVram
+
+ASM_SRCS := libagbsyscall.s
+ASM_OBJS := $(foreach syscall, $(SYSCALLS), $(syscall).o)
+
+LIB := libagbsyscall.a
+
+.PHONY: all clean
+
+all: $(LIB)
+ @:
+
+clean:
+ rm -f $(LIB) $(ASM_OBJS)
+
+$(LIB): $(ASM_OBJS)
+ $(AR) $(ARFLAGS) $@ $^
+
+$(ASM_OBJS): libagbsyscall.s
+ $(AS) $(ASFLAGS) --defsym L_$(*F)=1 -o $@ $<
diff --git a/libagbsyscall/libagbsyscall.s b/libagbsyscall/libagbsyscall.s
new file mode 100644
index 000000000..893235e32
--- /dev/null
+++ b/libagbsyscall/libagbsyscall.s
@@ -0,0 +1,432 @@
+ .include "../constants/gba_constants.inc"
+ .include "../asm/macros/function.inc"
+
+ .text
+
+ .set SOFT_RESET_DIRECT_BUF, 0x03007FFA
+ .set RESET_EX_WRAM_FLAG, 0x1
+
+ .ifdef NO_GRANULAR_AGBSYSCALL
+ .set L_IntrWait, 1
+ .set L_RegisterRamReset, 1
+ .set L_Sqrt, 1
+ .set L_MusicPlayerOpen, 1
+ .set L_SoundBiasReset, 1
+ .set L_SoundDriverVSyncOn, 1
+ .set L_Mod, 1
+ .set L_VBlankIntrWait, 1
+ .set L_MusicPlayerStart, 1
+ .set L_SoundDriverVSyncOff, 1
+ .set L_HuffUnComp, 1
+ .set L_SoftResetExram, 1
+ .set L_MusicPlayerFadeOut, 1
+ .set L_LZ77UnCompWram, 1
+ .set L_SoundDriverMain, 1
+ .set L_SoundBiasChange, 1
+ .set L_LZ77UnCompVram, 1
+ .set L_ArcTan2, 1
+ .set L_MusicPlayerStop, 1
+ .set L_DivArm, 1
+ .set L_ModArm, 1
+ .set L_SoundDriverVSync, 1
+ .set L_SoundDriverInit, 1
+ .set L_BgAffineSet, 1
+ .set L_Diff8bitUnFilterWram, 1
+ .set L_MultiBoot, 1
+ .set L_MidiKey2Freq, 1
+ .set L_Div, 1
+ .set L_Diff8bitUnFilterVram, 1
+ .set L_ArcTan, 1
+ .set L_ObjAffineSet, 1
+ .set L_SoftResetRom, 1
+ .set L_SoundDriverMode, 1
+ .set L_RLUnCompWram, 1
+ .set L_BitUnPack, 1
+ .set L_SoundChannelClear, 1
+ .set L_CpuFastSet, 1
+ .set L_CpuSet, 1
+ .set L_Diff16bitUnFilter, 1
+ .set L_SoundBiasSet, 1
+ .set L_MusicPlayerContinue, 1
+ .set L_SoftReset, 1
+ .set L_RLUnCompVram, 1
+ .endif
+
+ .ifdef L_IntrWait
+ thumb_func_start IntrWait
+IntrWait:
+ mov r2, #0
+ swi 4
+ bx lr
+ thumb_func_end IntrWait
+ .endif
+
+ .ifdef L_RegisterRamReset
+ thumb_func_start RegisterRamReset
+RegisterRamReset:
+ swi 1
+ bx lr
+ thumb_func_end RegisterRamReset
+ .endif
+
+ .ifdef L_Sqrt
+ thumb_func_start Sqrt
+Sqrt:
+ swi 8
+ bx lr
+ thumb_func_end Sqrt
+ .endif
+
+ .ifdef L_MusicPlayerOpen
+ thumb_func_start MusicPlayerOpen
+MusicPlayerOpen:
+ swi 32
+ bx lr
+ thumb_func_end MusicPlayerOpen
+ .endif
+
+ .ifdef L_SoundBiasReset
+ thumb_func_start SoundBiasReset
+SoundBiasReset:
+ mov r0, #0
+ swi 25
+ bx lr
+ thumb_func_end SoundBiasReset
+ .endif
+
+ .ifdef L_SoundDriverVSyncOn
+ thumb_func_start SoundDriverVSyncOn
+SoundDriverVSyncOn:
+ swi 41
+ bx lr
+ thumb_func_end SoundDriverVSyncOn
+ .endif
+
+ .ifdef L_Mod
+ thumb_func_start Mod
+Mod:
+ swi 6
+ mov r0, r1
+ bx lr
+ thumb_func_end Mod
+ .endif
+
+ .ifdef L_VBlankIntrWait
+ thumb_func_start VBlankIntrWait
+VBlankIntrWait:
+ mov r2, #0
+ swi 5
+ bx lr
+ thumb_func_end VBlankIntrWait
+ .endif
+
+ .ifdef L_MusicPlayerStart
+ thumb_func_start MusicPlayerStart
+MusicPlayerStart:
+ swi 33
+ bx lr
+ thumb_func_end MusicPlayerStart
+ .endif
+
+ .ifdef L_SoundDriverVSyncOff
+ thumb_func_start SoundDriverVSyncOff
+SoundDriverVSyncOff:
+ swi 40
+ bx lr
+ thumb_func_end SoundDriverVSyncOff
+ .endif
+
+ .ifdef L_HuffUnComp
+ thumb_func_start HuffUnComp
+HuffUnComp:
+ swi 19
+ bx lr
+ thumb_func_end HuffUnComp
+ .endif
+
+ .ifdef L_SoftResetExram
+ thumb_func_start SoftResetExram
+SoftResetExram:
+ ldr r3, =REG_IME
+ mov r2, #0
+ strb r2, [r3, #0]
+ ldr r3, =SOFT_RESET_DIRECT_BUF
+ mov r2, #1
+ strb r2, [r3, #0]
+ sub r3, #SOFT_RESET_DIRECT_BUF - 0x3007f00
+ mov sp, r3
+ mov r2, #RESET_EX_WRAM_FLAG
+ bic r0, r2
+ swi 1
+ swi 0
+ .pool
+ thumb_func_end SoftResetExram
+ .endif
+
+ .ifdef L_MusicPlayerFadeOut
+ thumb_func_start MusicPlayerFadeOut
+MusicPlayerFadeOut:
+ swi 36
+ bx lr
+ thumb_func_end MusicPlayerFadeOut
+ .endif
+
+ .ifdef L_LZ77UnCompWram
+ thumb_func_start LZ77UnCompWram
+LZ77UnCompWram:
+ swi 17
+ bx lr
+ thumb_func_end LZ77UnCompWram
+ .endif
+
+ .ifdef L_SoundDriverMain
+ thumb_func_start SoundDriverMain
+SoundDriverMain:
+ swi 28
+ bx lr
+ thumb_func_end SoundDriverMain
+ .endif
+
+ .ifdef L_SoundBiasChange
+ thumb_func_start SoundBiasChange
+SoundBiasChange:
+ swi 25
+ bx lr
+ thumb_func_end SoundBiasChange
+ .endif
+
+ .ifdef L_LZ77UnCompVram
+ thumb_func_start LZ77UnCompVram
+LZ77UnCompVram:
+ swi 18
+ bx lr
+ thumb_func_end LZ77UnCompVram
+ .endif
+
+ .ifdef L_ArcTan2
+ thumb_func_start ArcTan2
+ArcTan2:
+ swi 10
+ bx lr
+ thumb_func_end ArcTan2
+ .endif
+
+ .ifdef L_MusicPlayerStop
+ thumb_func_start MusicPlayerStop
+MusicPlayerStop:
+ swi 34
+ bx lr
+ thumb_func_end MusicPlayerStop
+ .endif
+
+ .ifdef L_DivArm
+ thumb_func_start DivArm
+DivArm:
+ swi 7
+ bx lr
+ thumb_func_end DivArm
+ .endif
+
+ .ifdef L_ModArm
+ thumb_func_start ModArm
+ModArm:
+ swi 7
+ mov r0, r1
+ bx lr
+ thumb_func_end ModArm
+ .endif
+
+ .ifdef L_SoundDriverVSync
+ thumb_func_start SoundDriverVSync
+SoundDriverVSync:
+ swi 29
+ bx lr
+ thumb_func_end SoundDriverVSync
+ .endif
+
+ .ifdef L_SoundDriverInit
+ thumb_func_start SoundDriverInit
+SoundDriverInit:
+ swi 26
+ bx lr
+ thumb_func_end SoundDriverInit
+ .endif
+
+ .ifdef L_BgAffineSet
+ thumb_func_start BgAffineSet
+BgAffineSet:
+ swi 14
+ bx lr
+ thumb_func_end BgAffineSet
+ .endif
+
+ .ifdef L_Diff8bitUnFilterWram
+ thumb_func_start Diff8bitUnFilterWram
+Diff8bitUnFilterWram:
+ swi 22
+ bx lr
+ thumb_func_end Diff8bitUnFilterWram
+ .endif
+
+ .ifdef L_MultiBoot
+ thumb_func_start MultiBoot
+MultiBoot:
+ mov r1, #1
+ swi 37
+ bx lr
+ thumb_func_end MultiBoot
+ .endif
+
+ .ifdef L_MidiKey2Freq
+ thumb_func_start MidiKey2Freq
+MidiKey2Freq:
+ swi 31
+ bx lr
+ thumb_func_end MidiKey2Freq
+ .endif
+
+ .ifdef L_Div
+ thumb_func_start Div
+Div:
+ swi 6
+ bx lr
+ thumb_func_end Div
+ .endif
+
+ .ifdef L_Diff8bitUnFilterVram
+ thumb_func_start Diff8bitUnFilterVram
+Diff8bitUnFilterVram:
+ swi 23
+ bx lr
+ thumb_func_end Diff8bitUnFilterVram
+ .endif
+
+ .ifdef L_ArcTan
+ thumb_func_start ArcTan
+ArcTan:
+ swi 9
+ bx lr
+ thumb_func_end ArcTan
+ .endif
+
+ .ifdef L_ObjAffineSet
+ thumb_func_start ObjAffineSet
+ObjAffineSet:
+ swi 15
+ bx lr
+ thumb_func_end ObjAffineSet
+ .endif
+
+ .ifdef L_SoftResetRom
+ thumb_func_start SoftResetRom
+SoftResetRom:
+ ldr r3, =REG_IME
+ mov r2, #0
+ strb r2, [r3, #0]
+ ldr r3, =SOFT_RESET_DIRECT_BUF
+ mov r2, #0
+ strb r2, [r3, #0]
+ sub r3, #SOFT_RESET_DIRECT_BUF - 0x3007f00
+ mov sp, r3
+ swi 1
+ swi 0
+ .pool
+ thumb_func_end SoftResetRom
+ .endif
+
+ .ifdef L_SoundDriverMode
+ thumb_func_start SoundDriverMode
+SoundDriverMode:
+ swi 27
+ bx lr
+ thumb_func_end SoundDriverMode
+ .endif
+
+ .ifdef L_RLUnCompWram
+ thumb_func_start RLUnCompWram
+RLUnCompWram:
+ swi 20
+ bx lr
+ thumb_func_end RLUnCompWram
+ .endif
+
+ .ifdef L_BitUnPack
+ thumb_func_start BitUnPack
+BitUnPack:
+ swi 16
+ bx lr
+ thumb_func_end BitUnPack
+ .endif
+
+ .ifdef L_SoundChannelClear
+ thumb_func_start SoundChannelClear
+SoundChannelClear:
+ swi 30
+ bx lr
+ thumb_func_end SoundChannelClear
+ .endif
+
+ .ifdef L_CpuFastSet
+ thumb_func_start CpuFastSet
+CpuFastSet:
+ swi 12
+ bx lr
+ thumb_func_end CpuFastSet
+ .endif
+
+ .ifdef L_CpuSet
+ thumb_func_start CpuSet
+CpuSet:
+ swi 11
+ bx lr
+ thumb_func_end CpuSet
+ .endif
+
+ .ifdef L_Diff16bitUnFilter
+ thumb_func_start Diff16bitUnFilter
+Diff16bitUnFilter:
+ swi 24
+ bx lr
+ thumb_func_end Diff16bitUnFilter
+ .endif
+
+ .ifdef L_SoundBiasSet
+ thumb_func_start SoundBiasSet
+SoundBiasSet:
+ mov r0, #1
+ swi 25
+ bx lr
+ thumb_func_end SoundBiasSet
+ .endif
+
+ .ifdef L_MusicPlayerContinue
+ thumb_func_start MusicPlayerContinue
+MusicPlayerContinue:
+ swi 35
+ bx lr
+ thumb_func_end MusicPlayerContinue
+ .endif
+
+ .ifdef L_SoftReset
+ thumb_func_start SoftReset
+SoftReset:
+ ldr r3, =REG_IME
+ mov r2, #0
+ strb r2, [r3, #0]
+ ldr r1, =0x3007f00
+ mov sp, r1
+ swi 1
+ swi 0
+ .pool
+ thumb_func_end SoftReset
+ .endif
+
+ .ifdef L_RLUnCompVram
+ thumb_func_start RLUnCompVram
+RLUnCompVram:
+ swi 21
+ bx lr
+ thumb_func_end RLUnCompVram
+ .endif
+
+ .align 2, 0 @ Don't pad with nop
diff --git a/src/apprentice.c b/src/apprentice.c
index 113b22f6e..189647991 100644
--- a/src/apprentice.c
+++ b/src/apprentice.c
@@ -10,7 +10,7 @@
#include "item.h"
#include "item_menu.h"
#include "main.h"
-#include "alloc.h"
+#include "malloc.h"
#include "menu.h"
#include "new_game.h"
#include "party_menu.h"
diff --git a/src/battle_anim_effects_1.c b/src/battle_anim_effects_1.c
index db9057cb4..b2999a127 100644
--- a/src/battle_anim_effects_1.c
+++ b/src/battle_anim_effects_1.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "battle_anim.h"
#include "battle_interface.h"
#include "decompress.h"
diff --git a/src/battle_anim_effects_2.c b/src/battle_anim_effects_2.c
index 1add76bf3..87023e7e1 100755
--- a/src/battle_anim_effects_2.c
+++ b/src/battle_anim_effects_2.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "battle_anim.h"
#include "battle_interface.h"
#include "decompress.h"
diff --git a/src/battle_anim_effects_3.c b/src/battle_anim_effects_3.c
index 79b728e61..ea69780ef 100755
--- a/src/battle_anim_effects_3.c
+++ b/src/battle_anim_effects_3.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "battle.h"
#include "battle_anim.h"
#include "bg.h"
diff --git a/src/battle_anim_mons.c b/src/battle_anim_mons.c
index a667daecf..9a588a9ca 100644
--- a/src/battle_anim_mons.c
+++ b/src/battle_anim_mons.c
@@ -7,7 +7,7 @@
#include "decompress.h"
#include "dma3.h"
#include "gpu_regs.h"
-#include "alloc.h"
+#include "malloc.h"
#include "palette.h"
#include "pokemon_icon.h"
#include "sprite.h"
diff --git a/src/battle_anim_utility_funcs.c b/src/battle_anim_utility_funcs.c
index efe35e1b4..1a0200271 100644
--- a/src/battle_anim_utility_funcs.c
+++ b/src/battle_anim_utility_funcs.c
@@ -3,7 +3,7 @@
#include "contest.h"
#include "gpu_regs.h"
#include "graphics.h"
-#include "alloc.h"
+#include "malloc.h"
#include "palette.h"
#include "sound.h"
#include "sprite.h"
diff --git a/src/battle_dome.c b/src/battle_dome.c
index 1c116467d..22a1ecaf2 100644
--- a/src/battle_dome.c
+++ b/src/battle_dome.c
@@ -8,7 +8,7 @@
#include "event_data.h"
#include "overworld.h"
#include "util.h"
-#include "alloc.h"
+#include "malloc.h"
#include "string_util.h"
#include "random.h"
#include "task.h"
diff --git a/src/battle_factory_screen.c b/src/battle_factory_screen.c
index f56442432..36839cde5 100644
--- a/src/battle_factory_screen.c
+++ b/src/battle_factory_screen.c
@@ -11,7 +11,7 @@
#include "palette.h"
#include "task.h"
#include "main.h"
-#include "alloc.h"
+#include "malloc.h"
#include "bg.h"
#include "gpu_regs.h"
#include "string_util.h"
diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c
index de403aec7..737e6b61e 100644
--- a/src/battle_gfx_sfx_util.c
+++ b/src/battle_gfx_sfx_util.c
@@ -6,7 +6,7 @@
#include "constants/battle_anim.h"
#include "battle_interface.h"
#include "main.h"
-#include "alloc.h"
+#include "malloc.h"
#include "graphics.h"
#include "random.h"
#include "util.h"
diff --git a/src/battle_main.c b/src/battle_main.c
index 27889e81e..26e9e91ae 100644
--- a/src/battle_main.c
+++ b/src/battle_main.c
@@ -26,7 +26,7 @@
#include "link_rfu.h"
#include "load_save.h"
#include "main.h"
-#include "alloc.h"
+#include "malloc.h"
#include "m4a.h"
#include "palette.h"
#include "party_menu.h"
diff --git a/src/battle_message.c b/src/battle_message.c
index 3fec571f4..22cdee0b8 100644
--- a/src/battle_message.c
+++ b/src/battle_message.c
@@ -2759,7 +2759,7 @@ static void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst)
value = T1_READ_32(&src[srcID + 3]);
break;
}
- ConvertIntToDecimalStringN(dst, value, 0, src[srcID + 2]);
+ ConvertIntToDecimalStringN(dst, value, STR_CONV_MODE_LEFT_ALIGN, src[srcID + 2]);
srcID += src[srcID + 1] + 3;
break;
case B_BUFF_MOVE: // move name
diff --git a/src/battle_pike.c b/src/battle_pike.c
index 4e2be23e4..bfb87f679 100644
--- a/src/battle_pike.c
+++ b/src/battle_pike.c
@@ -9,7 +9,7 @@
#include "task.h"
#include "battle_tower.h"
#include "party_menu.h"
-#include "alloc.h"
+#include "malloc.h"
#include "palette.h"
#include "script.h"
#include "battle_setup.h"
diff --git a/src/battle_pyramid.c b/src/battle_pyramid.c
index 4d35f4244..6bcf00748 100644
--- a/src/battle_pyramid.c
+++ b/src/battle_pyramid.c
@@ -23,7 +23,7 @@
#include "main.h"
#include "load_save.h"
#include "script.h"
-#include "alloc.h"
+#include "malloc.h"
#include "overworld.h"
#include "event_scripts.h"
#include "constants/battle_frontier.h"
diff --git a/src/battle_pyramid_bag.c b/src/battle_pyramid_bag.c
index b4ec6cd62..a17a93499 100644
--- a/src/battle_pyramid_bag.c
+++ b/src/battle_pyramid_bag.c
@@ -17,7 +17,7 @@
#include "list_menu.h"
#include "mail.h"
#include "main.h"
-#include "alloc.h"
+#include "malloc.h"
#include "menu.h"
#include "menu_helpers.h"
#include "overworld.h"
diff --git a/src/battle_records.c b/src/battle_records.c
index 3d4cabcb0..ccd16e219 100644
--- a/src/battle_records.c
+++ b/src/battle_records.c
@@ -18,7 +18,7 @@
#include "international_string_util.h"
#include "sound.h"
#include "constants/songs.h"
-#include "alloc.h"
+#include "malloc.h"
#include "gpu_regs.h"
#include "constants/game_stat.h"
#include "trainer_hill.h"
diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c
index 35d47fa82..3c3e2480f 100644
--- a/src/battle_script_commands.c
+++ b/src/battle_script_commands.c
@@ -8524,7 +8524,7 @@ static void atkAD_tryspiteppreduce(void)
PREPARE_MOVE_BUFFER(gBattleTextBuff1, gLastMoves[gBattlerTarget])
- ConvertIntToDecimalStringN(gBattleTextBuff2, ppToDeduct, 0, 1);
+ ConvertIntToDecimalStringN(gBattleTextBuff2, ppToDeduct, STR_CONV_MODE_LEFT_ALIGN, 1);
PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff2, 1, ppToDeduct)
diff --git a/src/battle_transition.c b/src/battle_transition.c
index fb7fd0c2f..c34419048 100644
--- a/src/battle_transition.c
+++ b/src/battle_transition.c
@@ -9,7 +9,7 @@
#include "field_weather.h"
#include "gpu_regs.h"
#include "main.h"
-#include "alloc.h"
+#include "malloc.h"
#include "overworld.h"
#include "palette.h"
#include "random.h"
diff --git a/src/battle_util2.c b/src/battle_util2.c
index f840cd58b..ce2153b2d 100644
--- a/src/battle_util2.c
+++ b/src/battle_util2.c
@@ -2,7 +2,7 @@
#include "battle.h"
#include "battle_anim.h"
#include "battle_controllers.h"
-#include "alloc.h"
+#include "malloc.h"
#include "pokemon.h"
#include "trainer_hill.h"
#include "party_menu.h"
diff --git a/src/berry_blender.c b/src/berry_blender.c
index 911c3e545..6c8d9c812 100644
--- a/src/berry_blender.c
+++ b/src/berry_blender.c
@@ -12,7 +12,7 @@
#include "bg.h"
#include "palette.h"
#include "decompress.h"
-#include "alloc.h"
+#include "malloc.h"
#include "gpu_regs.h"
#include "text.h"
#include "text_window.h"
diff --git a/src/berry_crush.c b/src/berry_crush.c
index 6259e0a41..8b4c7a545 100755
--- a/src/berry_crush.c
+++ b/src/berry_crush.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "berry_powder.h"
#include "bg.h"
#include "event_data.h"
diff --git a/src/berry_fix_program.c b/src/berry_fix_program.c
index 37be569f8..e3c4e2675 100644
--- a/src/berry_fix_program.c
+++ b/src/berry_fix_program.c
@@ -1,7 +1,7 @@
#include "global.h"
#include "gpu_regs.h"
#include "multiboot.h"
-#include "alloc.h"
+#include "malloc.h"
#include "bg.h"
#include "graphics.h"
#include "main.h"
diff --git a/src/berry_tag_screen.c b/src/berry_tag_screen.c
index 10a45dc65..e7f6291c4 100644
--- a/src/berry_tag_screen.c
+++ b/src/berry_tag_screen.c
@@ -19,7 +19,7 @@
#include "string_util.h"
#include "strings.h"
#include "bg.h"
-#include "alloc.h"
+#include "malloc.h"
#include "scanline_effect.h"
#include "gpu_regs.h"
#include "graphics.h"
@@ -401,7 +401,7 @@ static void PrintAllBerryData(void)
static void PrintBerryNumberAndName(void)
{
const struct Berry *berry = GetBerryInfo(sBerryTag->berryId);
- ConvertIntToDecimalStringN(gStringVar1, sBerryTag->berryId, 2, 2);
+ ConvertIntToDecimalStringN(gStringVar1, sBerryTag->berryId, STR_CONV_MODE_LEADING_ZEROS, 2);
StringCopy(gStringVar2, berry->name);
StringExpandPlaceholders(gStringVar4, gText_UnkF908Var1Var2);
PrintTextInBerryTagScreen(WIN_BERRY_NAME, gStringVar4, 0, 1, 0, 0);
@@ -421,8 +421,8 @@ static void PrintBerrySize(void)
fraction = (inches % 100) / 10;
inches /= 100;
- ConvertIntToDecimalStringN(gStringVar1, inches, 0, 2);
- ConvertIntToDecimalStringN(gStringVar2, fraction, 0, 2);
+ ConvertIntToDecimalStringN(gStringVar1, inches, STR_CONV_MODE_LEFT_ALIGN, 2);
+ ConvertIntToDecimalStringN(gStringVar2, fraction, STR_CONV_MODE_LEFT_ALIGN, 2);
StringExpandPlaceholders(gStringVar4, gText_Var1DotVar2);
AddTextPrinterParameterized(WIN_SIZE_FIRM, 1, gStringVar4, 0x28, 1, 0, NULL);
}
diff --git a/src/cable_car.c b/src/cable_car.c
index adeee2647..c6e7e724e 100644
--- a/src/cable_car.c
+++ b/src/cable_car.c
@@ -6,7 +6,7 @@
#include "field_weather.h"
#include "gpu_regs.h"
#include "graphics.h"
-#include "alloc.h"
+#include "malloc.h"
#include "main.h"
#include "menu.h"
#include "overworld.h"
diff --git a/src/contest.c b/src/contest.c
index 79c1616c2..e9a2f456f 100644
--- a/src/contest.c
+++ b/src/contest.c
@@ -1,7 +1,7 @@
#include "global.h"
#include "gpu_regs.h"
#include "bg.h"
-#include "alloc.h"
+#include "malloc.h"
#include "constants/items.h"
#include "constants/event_objects.h"
#include "constants/moves.h"
diff --git a/src/contest_link_80F57C4.c b/src/contest_link_80F57C4.c
index a0a29f0ad..54b2326d0 100644
--- a/src/contest_link_80F57C4.c
+++ b/src/contest_link_80F57C4.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "battle.h"
#include "battle_gfx_sfx_util.h"
#include "bg.h"
diff --git a/src/contest_painting.c b/src/contest_painting.c
index 1b95e1ed9..2b36d5e38 100644
--- a/src/contest_painting.c
+++ b/src/contest_painting.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "battle.h"
#include "battle_gfx_sfx_util.h"
#include "bg.h"
diff --git a/src/credits.c b/src/credits.c
index 44fa2002c..e2c125d3f 100644
--- a/src/credits.c
+++ b/src/credits.c
@@ -3,7 +3,7 @@
#include "main.h"
#include "task.h"
#include "bg.h"
-#include "alloc.h"
+#include "malloc.h"
#include "window.h"
#include "text.h"
#include "menu.h"
diff --git a/src/data.c b/src/data.c
index 7aebd63ed..8d6640223 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "battle.h"
#include "data.h"
#include "graphics.h"
diff --git a/src/decompress.c b/src/decompress.c
index 46e4ef614..5e85e065f 100644
--- a/src/decompress.c
+++ b/src/decompress.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "data.h"
#include "decompress.h"
#include "pokemon.h"
diff --git a/src/decoration.c b/src/decoration.c
index cb371b300..2a47dd553 100644
--- a/src/decoration.c
+++ b/src/decoration.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "decompress.h"
#include "decoration.h"
#include "decoration_inventory.h"
diff --git a/src/dewford_trend.c b/src/dewford_trend.c
index ee310af04..57a97d8f3 100644
--- a/src/dewford_trend.c
+++ b/src/dewford_trend.c
@@ -3,7 +3,7 @@
#include "easy_chat.h"
#include "event_data.h"
#include "link.h"
-#include "alloc.h"
+#include "malloc.h"
#include "random.h"
#include "text.h"
#include "tv.h"
diff --git a/src/diploma.c b/src/diploma.c
index 8e0901fa8..3c03c057f 100644
--- a/src/diploma.c
+++ b/src/diploma.c
@@ -5,7 +5,7 @@
#include "gpu_regs.h"
#include "scanline_effect.h"
#include "task.h"
-#include "alloc.h"
+#include "malloc.h"
#include "decompress.h"
#include "bg.h"
#include "window.h"
diff --git a/src/dodrio_berry_picking.c b/src/dodrio_berry_picking.c
index 714b10ef6..4b636e2b9 100644
--- a/src/dodrio_berry_picking.c
+++ b/src/dodrio_berry_picking.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "bg.h"
#include "dodrio_berry_picking.h"
#include "dynamic_placeholder_text_util.h"
diff --git a/src/easy_chat.c b/src/easy_chat.c
index ba54de783..f4ac92d06 100644
--- a/src/easy_chat.c
+++ b/src/easy_chat.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "bard_music.h"
#include "bg.h"
#include "data.h"
diff --git a/src/egg_hatch.c b/src/egg_hatch.c
index 1eaf4e4a1..9e9d1c2c5 100644
--- a/src/egg_hatch.c
+++ b/src/egg_hatch.c
@@ -17,7 +17,7 @@
#include "menu.h"
#include "trig.h"
#include "random.h"
-#include "alloc.h"
+#include "malloc.h"
#include "dma3.h"
#include "gpu_regs.h"
#include "bg.h"
diff --git a/src/ereader_helpers.c b/src/ereader_helpers.c
index f184dea82..7f0887790 100755
--- a/src/ereader_helpers.c
+++ b/src/ereader_helpers.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "decompress.h"
#include "ereader_helpers.h"
#include "link.h"
diff --git a/src/ereader_screen.c b/src/ereader_screen.c
index 13e964224..0e865558a 100755
--- a/src/ereader_screen.c
+++ b/src/ereader_screen.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "decompress.h"
#include "ereader_helpers.h"
#include "link.h"
diff --git a/src/event_object_movement.c b/src/event_object_movement.c
index 75f758a12..c493c6d87 100644
--- a/src/event_object_movement.c
+++ b/src/event_object_movement.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "battle_pyramid.h"
#include "berry.h"
#include "decoration.h"
diff --git a/src/evolution_scene.c b/src/evolution_scene.c
index 96ca2ed1c..5ba979453 100644
--- a/src/evolution_scene.c
+++ b/src/evolution_scene.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "battle.h"
#include "battle_message.h"
#include "bg.h"
diff --git a/src/field_region_map.c b/src/field_region_map.c
index ac1b26154..184c49b40 100644
--- a/src/field_region_map.c
+++ b/src/field_region_map.c
@@ -3,7 +3,7 @@
#include "gpu_regs.h"
#include "international_string_util.h"
#include "main.h"
-#include "alloc.h"
+#include "malloc.h"
#include "menu.h"
#include "palette.h"
#include "region_map.h"
diff --git a/src/field_specials.c b/src/field_specials.c
index a0b7111c9..7a43eca67 100644
--- a/src/field_specials.c
+++ b/src/field_specials.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "battle.h"
#include "battle_tower.h"
#include "cable_club.h"
@@ -1633,20 +1633,20 @@ void BufferLottoTicketNumber(void)
else if (gSpecialVar_Result >= 1000)
{
gStringVar1[0] = CHAR_0;
- ConvertIntToDecimalStringN(gStringVar1 + 1, gSpecialVar_Result, 0, CountDigits(gSpecialVar_Result));
+ ConvertIntToDecimalStringN(gStringVar1 + 1, gSpecialVar_Result, STR_CONV_MODE_LEFT_ALIGN, CountDigits(gSpecialVar_Result));
}
else if (gSpecialVar_Result >= 100)
{
gStringVar1[0] = CHAR_0;
gStringVar1[1] = CHAR_0;
- ConvertIntToDecimalStringN(gStringVar1 + 2, gSpecialVar_Result, 0, CountDigits(gSpecialVar_Result));
+ ConvertIntToDecimalStringN(gStringVar1 + 2, gSpecialVar_Result, STR_CONV_MODE_LEFT_ALIGN, CountDigits(gSpecialVar_Result));
}
else if (gSpecialVar_Result >= 10)
{
gStringVar1[0] = CHAR_0;
gStringVar1[1] = CHAR_0;
gStringVar1[2] = CHAR_0;
- ConvertIntToDecimalStringN(gStringVar1 + 3, gSpecialVar_Result, 0, CountDigits(gSpecialVar_Result));
+ ConvertIntToDecimalStringN(gStringVar1 + 3, gSpecialVar_Result, STR_CONV_MODE_LEFT_ALIGN, CountDigits(gSpecialVar_Result));
}
else
{
@@ -1654,7 +1654,7 @@ void BufferLottoTicketNumber(void)
gStringVar1[1] = CHAR_0;
gStringVar1[2] = CHAR_0;
gStringVar1[3] = CHAR_0;
- ConvertIntToDecimalStringN(gStringVar1 + 4, gSpecialVar_Result, 0, CountDigits(gSpecialVar_Result));
+ ConvertIntToDecimalStringN(gStringVar1 + 4, gSpecialVar_Result, STR_CONV_MODE_LEFT_ALIGN, CountDigits(gSpecialVar_Result));
}
}
diff --git a/src/fldeff_cut.c b/src/fldeff_cut.c
index 3115ff231..00eed7624 100644
--- a/src/fldeff_cut.c
+++ b/src/fldeff_cut.c
@@ -7,7 +7,7 @@
#include "field_player_avatar.h"
#include "fieldmap.h"
#include "fldeff.h"
-#include "alloc.h"
+#include "malloc.h"
#include "metatile_behavior.h"
#include "overworld.h"
#include "party_menu.h"
diff --git a/src/frontier_pass.c b/src/frontier_pass.c
index fff93c3c7..a4ef500d7 100644
--- a/src/frontier_pass.c
+++ b/src/frontier_pass.c
@@ -5,7 +5,7 @@
#include "battle_anim.h"
#include "event_data.h"
#include "recorded_battle.h"
-#include "alloc.h"
+#include "malloc.h"
#include "sprite.h"
#include "scanline_effect.h"
#include "text_window.h"
diff --git a/src/frontier_util.c b/src/frontier_util.c
index 88e466e8c..83934c9f6 100644
--- a/src/frontier_util.c
+++ b/src/frontier_util.c
@@ -24,7 +24,7 @@
#include "data.h"
#include "record_mixing.h"
#include "strings.h"
-#include "alloc.h"
+#include "malloc.h"
#include "save.h"
#include "load_save.h"
#include "battle_dome.h"
diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c
index ac37b2ece..d138abbb1 100644
--- a/src/hall_of_fame.c
+++ b/src/hall_of_fame.c
@@ -6,7 +6,7 @@
#include "pokemon.h"
#include "text.h"
#include "text_window.h"
-#include "alloc.h"
+#include "malloc.h"
#include "gpu_regs.h"
#include "graphics.h"
#include "main.h"
diff --git a/src/intro.c b/src/intro.c
index e97fbedb0..58f2509cc 100644
--- a/src/intro.c
+++ b/src/intro.c
@@ -5,7 +5,7 @@
#include "task.h"
#include "title_screen.h"
#include "libgcnmultiboot.h"
-#include "alloc.h"
+#include "malloc.h"
#include "gpu_regs.h"
#include "link.h"
#include "multiboot_pokemon_colosseum.h"
diff --git a/src/item.c b/src/item.c
index 5e505724c..6b8f51f12 100644
--- a/src/item.c
+++ b/src/item.c
@@ -4,7 +4,7 @@
#include "string_util.h"
#include "text.h"
#include "event_data.h"
-#include "alloc.h"
+#include "malloc.h"
#include "secret_base.h"
#include "item_menu.h"
#include "strings.h"
diff --git a/src/item_icon.c b/src/item_icon.c
index 91c32951a..6ae7eac58 100644
--- a/src/item_icon.c
+++ b/src/item_icon.c
@@ -2,7 +2,7 @@
#include "decompress.h"
#include "graphics.h"
#include "item_icon.h"
-#include "alloc.h"
+#include "malloc.h"
#include "sprite.h"
#include "constants/items.h"
diff --git a/src/item_menu.c b/src/item_menu.c
index 12f03b328..c19113c60 100755
--- a/src/item_menu.c
+++ b/src/item_menu.c
@@ -25,7 +25,7 @@
#include "link.h"
#include "mail.h"
#include "main.h"
-#include "alloc.h"
+#include "malloc.h"
#include "map_name_popup.h"
#include "menu.h"
#include "money.h"
@@ -790,17 +790,17 @@ void GetItemName(s8 *dest, u16 itemId)
StringCopy(gStringVar2, gMoveNames[ItemIdToBattleMoveId(itemId)]);
if (itemId >= ITEM_HM01)
{
- ConvertIntToDecimalStringN(gStringVar1, itemId - ITEM_HM01 + 1, 2, 1);
+ ConvertIntToDecimalStringN(gStringVar1, itemId - ITEM_HM01 + 1, STR_CONV_MODE_LEADING_ZEROS, 1);
StringExpandPlaceholders(dest, gText_ClearTo11Var1Clear5Var2);
}
else
{
- ConvertIntToDecimalStringN(gStringVar1, itemId - ITEM_TM01 + 1, 2, 2);
+ ConvertIntToDecimalStringN(gStringVar1, itemId - ITEM_TM01 + 1, STR_CONV_MODE_LEADING_ZEROS, 2);
StringExpandPlaceholders(dest, gText_UnkF908Var1Clear7Var2);
}
break;
case BERRIES_POCKET:
- ConvertIntToDecimalStringN(gStringVar1, itemId - ITEM_CHERI_BERRY + 1, 2, 2);
+ ConvertIntToDecimalStringN(gStringVar1, itemId - ITEM_CHERI_BERRY + 1, STR_CONV_MODE_LEADING_ZEROS, 2);
CopyItemName(itemId, gStringVar2);
StringExpandPlaceholders(dest, gText_UnkF908Var1Clear7Var2);
break;
@@ -851,14 +851,14 @@ void PrintItemQuantityPlusGFX(u8 rboxId, s32 item_index_in_pocket, u8 a)
BlitBitmapToWindow(rboxId, gBagMenuHMIcon_Gfx, 8, a - 1, 16, 16);
if (gBagPositionStruct.pocket == BERRIES_POCKET)
{
- ConvertIntToDecimalStringN(gStringVar1, itemQuantity, 1, 3);
+ ConvertIntToDecimalStringN(gStringVar1, itemQuantity, STR_CONV_MODE_RIGHT_ALIGN, 3);
StringExpandPlaceholders(gStringVar4, gText_xVar1);
offset = GetStringRightAlignXOffset(7, gStringVar4, 0x77);
BagMenu_Print(rboxId, 7, gStringVar4, offset, a, 0, 0, -1, 0);
}
else if (gBagPositionStruct.pocket != KEYITEMS_POCKET && (unique = ItemId_GetImportance(itemId)) == FALSE)
{
- ConvertIntToDecimalStringN(gStringVar1, itemQuantity, 1, 2);
+ ConvertIntToDecimalStringN(gStringVar1, itemQuantity, STR_CONV_MODE_RIGHT_ALIGN, 2);
StringExpandPlaceholders(gStringVar4, gText_xVar1);
offset = GetStringRightAlignXOffset(7, gStringVar4, 0x77);
BagMenu_Print(rboxId, 7, gStringVar4, offset, a, unique, unique, -1, unique);
@@ -1053,21 +1053,21 @@ void sub_81ABC3C(u8 a)
PrintItemDepositAmount(BagMenu_AddWindow(a), 1);
}
-void PrintItemDepositAmount(u8 a, s16 b)
+void PrintItemDepositAmount(u8 windowId, s16 numDeposited)
{
- u8 r3 = (gBagPositionStruct.pocket == BERRIES_POCKET) ? 3 : 2;
- ConvertIntToDecimalStringN(gStringVar1, b, 2, r3);
+ u8 numDigits = (gBagPositionStruct.pocket == BERRIES_POCKET) ? 3 : 2;
+ ConvertIntToDecimalStringN(gStringVar1, numDeposited, STR_CONV_MODE_LEADING_ZEROS, numDigits);
StringExpandPlaceholders(gStringVar4, gText_xVar1);
- AddTextPrinterParameterized(a, 1, gStringVar4, GetStringCenterAlignXOffset(1, gStringVar4, 0x28), 2, 0, 0);
+ AddTextPrinterParameterized(windowId, 1, gStringVar4, GetStringCenterAlignXOffset(1, gStringVar4, 0x28), 2, 0, 0);
}
-void sub_81ABCC0(int a, int b, int c)
+void PrintItemSoldAmount(int windowId, int numSold, int moneyEarned)
{
- u8 r3 = (gBagPositionStruct.pocket == BERRIES_POCKET) ? 3 : 2;
- ConvertIntToDecimalStringN(gStringVar1, b, 2, r3);
+ u8 numDigits = (gBagPositionStruct.pocket == BERRIES_POCKET) ? 3 : 2;
+ ConvertIntToDecimalStringN(gStringVar1, numSold, STR_CONV_MODE_LEADING_ZEROS, numDigits);
StringExpandPlaceholders(gStringVar4, gText_xVar1);
- AddTextPrinterParameterized(a, 1, gStringVar4, 0, 1, -1, 0);
- PrintMoneyAmount(a, 0x26, 1, c, 0);
+ AddTextPrinterParameterized(windowId, 1, gStringVar4, 0, 1, -1, 0);
+ PrintMoneyAmount(windowId, 38, 1, moneyEarned, 0);
}
void Task_BagMenu(u8 taskId)
@@ -1682,7 +1682,7 @@ void BagMenu_TossItems(u8 taskId)
s16* data = gTasks[taskId].data;
CopyItemName(gSpecialVar_ItemId, gStringVar1);
- ConvertIntToDecimalStringN(gStringVar2, data[8], 0, 3);
+ ConvertIntToDecimalStringN(gStringVar2, data[8], STR_CONV_MODE_LEFT_ALIGN, 3);
StringExpandPlaceholders(gStringVar4, gText_ConfirmTossItems);
FillWindowPixelBuffer(1, PIXEL_FILL(0));
BagMenu_Print(1, 1, gStringVar4, 3, 1, 0, 0, 0, 0);
@@ -1725,7 +1725,7 @@ void BagMenu_ConfirmToss(u8 taskId)
s16* data = gTasks[taskId].data;
CopyItemName(gSpecialVar_ItemId, gStringVar1);
- ConvertIntToDecimalStringN(gStringVar2, data[8], 0, 3);
+ ConvertIntToDecimalStringN(gStringVar2, data[8], STR_CONV_MODE_LEFT_ALIGN, 3);
StringExpandPlaceholders(gStringVar4, gText_ThrewAwayVar2Var1s);
FillWindowPixelBuffer(1, PIXEL_FILL(0));
BagMenu_Print(1, 1, gStringVar4, 3, 1, 0, 0, 0, 0);
@@ -1936,7 +1936,7 @@ void sub_81AD680(u8 taskId)
{
s16* data = gTasks[taskId].data;
- ConvertIntToDecimalStringN(gStringVar1, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * data[8], 0, 6);
+ ConvertIntToDecimalStringN(gStringVar1, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * data[8], STR_CONV_MODE_LEFT_ALIGN, 6);
StringExpandPlaceholders(gStringVar4, gText_ICanPayVar1);
DisplayItemMessage(taskId, 1, gStringVar4, sub_81AD6E4);
}
@@ -1961,7 +1961,7 @@ void sub_81AD730(u8 taskId)
s16* data = gTasks[taskId].data;
u8 windowId = BagMenu_AddWindow(8);
- sub_81ABCC0(windowId, 1, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * data[8]);
+ PrintItemSoldAmount(windowId, 1, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * data[8]);
bag_menu_AddMoney_window();
gTasks[taskId].func = sub_81AD794;
}
@@ -1972,7 +1972,7 @@ void sub_81AD794(u8 taskId)
if (AdjustQuantityAccordingToDPadInput(&data[8], data[2]) == TRUE)
{
- sub_81ABCC0(gBagMenu->unk818, data[8], (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * data[8]);
+ PrintItemSoldAmount(gBagMenu->unk818, data[8], (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * data[8]);
}
else if (gMain.newKeys & A_BUTTON)
{
@@ -1996,7 +1996,7 @@ void BagMenu_ConfirmSell(u8 taskId)
s16* data = gTasks[taskId].data;
CopyItemName(gSpecialVar_ItemId, gStringVar2);
- ConvertIntToDecimalStringN(gStringVar1, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * data[8], 0, 6);
+ ConvertIntToDecimalStringN(gStringVar1, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * data[8], STR_CONV_MODE_LEFT_ALIGN, 6);
StringExpandPlaceholders(gStringVar4, gText_TurnedOverVar1ForVar2);
DisplayItemMessage(taskId, 1, gStringVar4, sub_81AD8C8);
}
@@ -2087,7 +2087,7 @@ void sub_81ADB14(u8 taskId)
else if (AddPCItem(gSpecialVar_ItemId, data[8]) == TRUE)
{
CopyItemName(gSpecialVar_ItemId, gStringVar1);
- ConvertIntToDecimalStringN(gStringVar2, data[8], 0, 3);
+ ConvertIntToDecimalStringN(gStringVar2, data[8], STR_CONV_MODE_LEFT_ALIGN, 3);
StringExpandPlaceholders(gStringVar4, gText_DepositedVar2Var1s);
BagMenu_Print(1, 1, gStringVar4, 3, 1, 0, 0, 0, 0);
gTasks[taskId].func = Task_ActuallyToss;
@@ -2398,7 +2398,7 @@ void PrintTMHMMoveData(u16 itemId)
}
else
{
- ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[moveId].power, 1, 3);
+ ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[moveId].power, STR_CONV_MODE_RIGHT_ALIGN, 3);
text = gStringVar1;
}
BagMenu_Print(4, 1, text, 7, 12, 0, 0, -1, 4);
@@ -2408,11 +2408,11 @@ void PrintTMHMMoveData(u16 itemId)
}
else
{
- ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[moveId].accuracy, 1, 3);
+ ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[moveId].accuracy, STR_CONV_MODE_RIGHT_ALIGN, 3);
text = gStringVar1;
}
BagMenu_Print(4, 1, text, 7, 24, 0, 0, -1, 4);
- ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[moveId].pp, 1, 3);
+ ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[moveId].pp, STR_CONV_MODE_RIGHT_ALIGN, 3);
BagMenu_Print(4, 1, gStringVar1, 7, 36, 0, 0, -1, 4);
CopyWindowToVram(4, 2);
}
diff --git a/src/item_use.c b/src/item_use.c
index 2f4374423..46f8cdf4a 100755
--- a/src/item_use.c
+++ b/src/item_use.c
@@ -623,7 +623,7 @@ void sub_80FDC00(u8 taskId)
void ItemUseOutOfBattle_CoinCase(u8 taskId)
{
- ConvertIntToDecimalStringN(gStringVar1, GetCoins(), 0, 4);
+ ConvertIntToDecimalStringN(gStringVar1, GetCoins(), STR_CONV_MODE_LEFT_ALIGN, 4);
StringExpandPlaceholders(gStringVar4, gText_CoinCase);
if (!gTasks[taskId].data[3])
@@ -638,7 +638,7 @@ void ItemUseOutOfBattle_CoinCase(u8 taskId)
void ItemUseOutOfBattle_PowderJar(u8 taskId)
{
- ConvertIntToDecimalStringN(gStringVar1, GetBerryPowder(), 0, 5);
+ ConvertIntToDecimalStringN(gStringVar1, GetBerryPowder(), STR_CONV_MODE_LEFT_ALIGN, 5);
StringExpandPlaceholders(gStringVar4, gText_PowderQty);
if (!gTasks[taskId].data[3])
diff --git a/src/libagbsyscall.s b/src/libagbsyscall.s
deleted file mode 100644
index d5639f689..000000000
--- a/src/libagbsyscall.s
+++ /dev/null
@@ -1,116 +0,0 @@
- .include "constants/gba_constants.inc"
- .include "asm/macros.inc"
-
- .syntax unified
-
- .text
-
- thumb_func_start ArcTan2
-ArcTan2: @ 82E7078
- swi 0xA
- bx lr
- thumb_func_end ArcTan2
-
- thumb_func_start BgAffineSet
-@ void BgAffineSet(BgAffineSet_src_data *src, BgAffineSet_dest_data *dest, int entry_count)
-BgAffineSet: @ 82E707C
- swi 0xE
- bx lr
- thumb_func_end BgAffineSet
-
- thumb_func_start CpuFastSet
-@ void CpuFastSet(void *src, void *dest, unsigned int mode)
-CpuFastSet: @ 82E7080
- swi 0xC
- bx lr
- thumb_func_end CpuFastSet
-
- thumb_func_start CpuSet
-@ void CpuSet(void *src, void *dest, unsigned int mode)
-CpuSet: @ 82E7084
- swi 0xB
- bx lr
- thumb_func_end CpuSet
-
- thumb_func_start Div
-Div: @ 82E7088
- swi 0x6
- bx lr
- thumb_func_end Div
-
- thumb_func_start LZ77UnCompVram
-@ void LZ77UnCompVram(void *src, void *dest)
-LZ77UnCompVram: @ 82E708C
- swi 0x12
- bx lr
- thumb_func_end LZ77UnCompVram
-
- thumb_func_start LZ77UnCompWram
-@ void LZ77UnCompWram(void *src, void *dest)
-LZ77UnCompWram: @ 82E7090
- swi 0x11
- bx lr
- thumb_func_end LZ77UnCompWram
-
- thumb_func_start MultiBoot
-@ s32 MultiBoot(struct MultiBootParam *mp)
-MultiBoot: @ 82E7094
- movs r1, 0x1
- swi 0x25
- bx lr
- thumb_func_end MultiBoot
-
- thumb_func_start ObjAffineSet
-ObjAffineSet: @ 82E709C
- swi 0xF
- bx lr
- thumb_func_end ObjAffineSet
-
- thumb_func_start RLUnCompVram
-RLUnCompVram: @ 82E70A0
- swi 0x15
- bx lr
- thumb_func_end RLUnCompVram
-
- thumb_func_start RLUnCompWram
-RLUnCompWram: @ 82E70A4
- swi 0x14
- bx lr
- thumb_func_end RLUnCompWram
-
- thumb_func_start RegisterRamReset
-@ void RegisterRamReset(int ResetFlags)
-RegisterRamReset: @ 82E70A8
- swi 0x1
- bx lr
- thumb_func_end RegisterRamReset
-
- thumb_func_start SoftReset
-@ void SoftReset()
-SoftReset: @ 82E70AC
- ldr r3, =REG_IME
- movs r2, 0
- strb r2, [r3]
- ldr r1, =0x3007F00
- mov sp, r1
- swi 0x1
- swi 0
- .pool
- thumb_func_end SoftReset
-
- thumb_func_start Sqrt
-@ s16 Sqrt(int)
-Sqrt: @ 82E70C4
- swi 0x8
- bx lr
- thumb_func_end Sqrt
-
- thumb_func_start VBlankIntrWait
-@ void VBlankIntrWait()
-VBlankIntrWait: @ 82E70C8
- movs r2, 0
- swi 0x5
- bx lr
- thumb_func_end VBlankIntrWait
-
- .align 2, 0 @ Don't pad with nop.
diff --git a/src/link.c b/src/link.c
index 9928b48da..db72be19a 100644
--- a/src/link.c
+++ b/src/link.c
@@ -2,7 +2,7 @@
// Includes
#include "global.h"
#include "m4a.h"
-#include "alloc.h"
+#include "malloc.h"
#include "reset_save_heap.h"
#include "save.h"
#include "bg.h"
diff --git a/src/link_rfu.c b/src/link_rfu.c
index 4b0b0a2a5..3b533a3a4 100644
--- a/src/link_rfu.c
+++ b/src/link_rfu.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "battle.h"
#include "berry_blender.h"
#include "decompress.h"
diff --git a/src/list_menu.c b/src/list_menu.c
index 6d51559f7..797aff5f8 100644
--- a/src/list_menu.c
+++ b/src/list_menu.c
@@ -8,7 +8,7 @@
#include "trig.h"
#include "decompress.h"
#include "palette.h"
-#include "alloc.h"
+#include "malloc.h"
#include "strings.h"
#include "sound.h"
#include "constants/songs.h"
diff --git a/src/load_save.c b/src/load_save.c
index 5857f2b46..24dfda20c 100644
--- a/src/load_save.c
+++ b/src/load_save.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "berry_powder.h"
#include "item.h"
#include "load_save.h"
diff --git a/src/mail.c b/src/mail.c
index 0078bc4fc..cdf965545 100644
--- a/src/mail.c
+++ b/src/mail.c
@@ -17,7 +17,7 @@
#include "bg.h"
#include "pokemon_icon.h"
#include "constants/species.h"
-#include "alloc.h"
+#include "malloc.h"
#include "easy_chat.h"
#include "constants/rgb.h"
diff --git a/src/main.c b/src/main.c
index 06425e661..f488e7f6d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,6 +1,6 @@
#include "global.h"
#include "crt0.h"
-#include "alloc.h"
+#include "malloc.h"
#include "link.h"
#include "link_rfu.h"
#include "librfu.h"
diff --git a/src/main_menu.c b/src/main_menu.c
index 6a0bd9e2d..0cb91ae09 100644
--- a/src/main_menu.c
+++ b/src/main_menu.c
@@ -2158,9 +2158,9 @@ static void MainMenu_FormatSavegameTime(void)
StringExpandPlaceholders(gStringVar4, gText_ContinueMenuTime);
AddTextPrinterParameterized3(2, 1, 0x6C, 17, sTextColor_PlayerGenderColor, -1, gStringVar4);
- ptr = ConvertIntToDecimalStringN(str, gSaveBlock2Ptr->playTimeHours, 0, 3);
+ ptr = ConvertIntToDecimalStringN(str, gSaveBlock2Ptr->playTimeHours, STR_CONV_MODE_LEFT_ALIGN, 3);
*ptr = 0xF0;
- ConvertIntToDecimalStringN(ptr + 1, gSaveBlock2Ptr->playTimeMinutes, 2, 2);
+ ConvertIntToDecimalStringN(ptr + 1, gSaveBlock2Ptr->playTimeMinutes, STR_CONV_MODE_LEADING_ZEROS, 2);
AddTextPrinterParameterized3(2, 1, GetStringRightAlignXOffset(1, str, 0xD0), 17, sTextColor_PlayerGenderColor, -1, str);
}
@@ -2177,7 +2177,7 @@ static void MainMenu_FormatSavegamePokedex(void)
dexCount = GetHoennPokedexCount(1);
StringExpandPlaceholders(gStringVar4, gText_ContinueMenuPokedex);
AddTextPrinterParameterized3(2, 1, 0, 33, sTextColor_PlayerGenderColor, -1, gStringVar4);
- ConvertIntToDecimalStringN(str, dexCount, 0, 3);
+ ConvertIntToDecimalStringN(str, dexCount, STR_CONV_MODE_LEFT_ALIGN, 3);
AddTextPrinterParameterized3(2, 1, GetStringRightAlignXOffset(1, str, 100), 33, sTextColor_PlayerGenderColor, -1, str);
}
}
@@ -2195,7 +2195,7 @@ static void MainMenu_FormatSavegameBadges(void)
}
StringExpandPlaceholders(gStringVar4, gText_ContinueMenuBadges);
AddTextPrinterParameterized3(2, 1, 0x6C, 33, sTextColor_PlayerGenderColor, -1, gStringVar4);
- ConvertIntToDecimalStringN(str, badgeCount, 2, 1);
+ ConvertIntToDecimalStringN(str, badgeCount, STR_CONV_MODE_LEADING_ZEROS, 1);
AddTextPrinterParameterized3(2, 1, GetStringRightAlignXOffset(1, str, 0xD0), 33, sTextColor_PlayerGenderColor, -1, str);
}
diff --git a/src/match_call.c b/src/match_call.c
index 3ed684938..646b14cea 100644
--- a/src/match_call.c
+++ b/src/match_call.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "battle.h"
#include "battle_setup.h"
#include "bg.h"
@@ -1743,7 +1743,7 @@ static void PopulateBattleFrontierStreak(int matchCallId, u8 *destStr)
i++;
}
- ConvertIntToDecimalStringN(destStr, gBattleFrontierStreakInfo.streak, 0, i);
+ ConvertIntToDecimalStringN(destStr, gBattleFrontierStreakInfo.streak, STR_CONV_MODE_LEFT_ALIGN, i);
}
static const u16 sBadgeFlags[] =
@@ -1976,8 +1976,8 @@ void sub_8197080(u8 *destStr)
numSeen = GetHoennPokedexCount(FLAG_GET_SEEN);
numCaught = GetHoennPokedexCount(FLAG_GET_CAUGHT);
- ConvertIntToDecimalStringN(gStringVar1, numSeen, 0, 3);
- ConvertIntToDecimalStringN(gStringVar2, numCaught, 0, 3);
+ ConvertIntToDecimalStringN(gStringVar1, numSeen, STR_CONV_MODE_LEFT_ALIGN, 3);
+ ConvertIntToDecimalStringN(gStringVar2, numCaught, STR_CONV_MODE_LEFT_ALIGN, 3);
dexRatingLevel = GetPokedexRatingLevel(numCaught);
str = StringCopy(buffer, gBirchDexRatingText_AreYouCurious);
str[0] = CHAR_PROMPT_CLEAR;
@@ -1994,8 +1994,8 @@ void sub_8197080(u8 *destStr)
str++;
numSeen = GetNationalPokedexCount(FLAG_GET_SEEN);
numCaught = GetNationalPokedexCount(FLAG_GET_CAUGHT);
- ConvertIntToDecimalStringN(gStringVar1, numSeen, 0, 3);
- ConvertIntToDecimalStringN(gStringVar2, numCaught, 0, 3);
+ ConvertIntToDecimalStringN(gStringVar1, numSeen, STR_CONV_MODE_LEFT_ALIGN, 3);
+ ConvertIntToDecimalStringN(gStringVar2, numCaught, STR_CONV_MODE_LEFT_ALIGN, 3);
StringExpandPlaceholders(str, gBirchDexRatingText_OnANationwideBasis);
}
diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c
index a4d70c062..f55dd2b8b 100644
--- a/src/mauville_old_man.c
+++ b/src/mauville_old_man.c
@@ -1132,7 +1132,7 @@ static void StorytellerDisplayStory(u32 player)
{
u8 stat = sStorytellerPtr->gameStatIDs[player];
- ConvertIntToDecimalStringN(gStringVar1, StorytellerGetRecordedTrainerStat(player), 0, 10);
+ ConvertIntToDecimalStringN(gStringVar1, StorytellerGetRecordedTrainerStat(player), STR_CONV_MODE_LEFT_ALIGN, 10);
StringCopy(gStringVar2, GetStoryActionByStat(stat));
GetStoryByStattellerPlayerName(player, gStringVar3);
ConvertInternationalString(gStringVar3, sStorytellerPtr->language[player]);
diff --git a/src/menu.c b/src/menu.c
index 8d50d4dcc..7495d7ebc 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "bg.h"
#include "blit.h"
#include "dma3.h"
@@ -2148,15 +2148,15 @@ void sub_819A344(u8 a0, u8 *dest, u8 color)
break;
case 1:
if (IsNationalPokedexEnabled())
- string = ConvertIntToDecimalStringN(string, GetNationalPokedexCount(1), 0, 3);
+ string = ConvertIntToDecimalStringN(string, GetNationalPokedexCount(1), STR_CONV_MODE_LEFT_ALIGN, 3);
else
- string = ConvertIntToDecimalStringN(string, GetHoennPokedexCount(1), 0, 3);
+ string = ConvertIntToDecimalStringN(string, GetHoennPokedexCount(1), STR_CONV_MODE_LEFT_ALIGN, 3);
*string = EOS;
break;
case 2:
- string = ConvertIntToDecimalStringN(string, gSaveBlock2Ptr->playTimeHours, 0, 3);
+ string = ConvertIntToDecimalStringN(string, gSaveBlock2Ptr->playTimeHours, STR_CONV_MODE_LEFT_ALIGN, 3);
*(string++) = CHAR_COLON;
- ConvertIntToDecimalStringN(string, gSaveBlock2Ptr->playTimeMinutes, 2, 2);
+ ConvertIntToDecimalStringN(string, gSaveBlock2Ptr->playTimeMinutes, STR_CONV_MODE_LEADING_ZEROS, 2);
break;
case 3:
sub_81245DC(string, gMapHeader.regionMapSectionId);
diff --git a/src/menu_specialized.c b/src/menu_specialized.c
index 1536cf413..75317e3ff 100644
--- a/src/menu_specialized.c
+++ b/src/menu_specialized.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "battle_main.h"
#include "contest_effect.h"
#include "data.h"
@@ -761,7 +761,7 @@ static void MoveRelearnerLoadBattleMoveDescription(u32 chosenMove)
AddTextPrinterParameterized(0, 1, str, 4, 0x19, TEXT_SPEED_FF, NULL);
x = 4 + GetStringWidth(1, gText_MoveRelearnerPP, 0);
- ConvertIntToDecimalStringN(buffer, move->pp, 0, 2);
+ ConvertIntToDecimalStringN(buffer, move->pp, STR_CONV_MODE_LEFT_ALIGN, 2);
AddTextPrinterParameterized(0, 1, buffer, x, 0x29, TEXT_SPEED_FF, NULL);
if (move->power < 2)
@@ -770,7 +770,7 @@ static void MoveRelearnerLoadBattleMoveDescription(u32 chosenMove)
}
else
{
- ConvertIntToDecimalStringN(buffer, move->power, 0, 3);
+ ConvertIntToDecimalStringN(buffer, move->power, STR_CONV_MODE_LEFT_ALIGN, 3);
str = buffer;
}
AddTextPrinterParameterized(0, 1, str, 0x6A, 0x19, TEXT_SPEED_FF, NULL);
@@ -781,7 +781,7 @@ static void MoveRelearnerLoadBattleMoveDescription(u32 chosenMove)
}
else
{
- ConvertIntToDecimalStringN(buffer, move->accuracy, 0, 3);
+ ConvertIntToDecimalStringN(buffer, move->accuracy, STR_CONV_MODE_LEFT_ALIGN, 3);
str = buffer;
}
AddTextPrinterParameterized(0, 1, str, 0x6A, 0x29, TEXT_SPEED_FF, NULL);
diff --git a/src/mevent_801BAAC.c b/src/mevent_801BAAC.c
index 8f5b2d636..24d55c511 100644
--- a/src/mevent_801BAAC.c
+++ b/src/mevent_801BAAC.c
@@ -4,7 +4,7 @@
#include "gpu_regs.h"
#include "palette.h"
#include "decompress.h"
-#include "alloc.h"
+#include "malloc.h"
#include "menu.h"
#include "pokemon_icon.h"
#include "union_room.h"
diff --git a/src/mevent_client.c b/src/mevent_client.c
index ec8908af2..659b772df 100644
--- a/src/mevent_client.c
+++ b/src/mevent_client.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "decompress.h"
#include "overworld.h"
#include "script.h"
diff --git a/src/mevent_server.c b/src/mevent_server.c
index 06b10dd95..0d3afea30 100644
--- a/src/mevent_server.c
+++ b/src/mevent_server.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "script.h"
#include "mevent.h"
#include "mevent_server.h"
diff --git a/src/mevent_server_helpers.c b/src/mevent_server_helpers.c
index 9d47ba745..616f394f7 100644
--- a/src/mevent_server_helpers.c
+++ b/src/mevent_server_helpers.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "decompress.h"
#include "util.h"
#include "link.h"
diff --git a/src/mirage_tower.c b/src/mirage_tower.c
index bb9c6e958..0c2b8ce74 100644
--- a/src/mirage_tower.c
+++ b/src/mirage_tower.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "bg.h"
#include "event_data.h"
#include "event_object_movement.h"
diff --git a/src/mossdeep_gym.c b/src/mossdeep_gym.c
index 880780638..bc279334b 100644
--- a/src/mossdeep_gym.c
+++ b/src/mossdeep_gym.c
@@ -1,7 +1,7 @@
#include "global.h"
#include "event_object_movement.h"
#include "fieldmap.h"
-#include "alloc.h"
+#include "malloc.h"
#include "mossdeep_gym.h"
#include "script_movement.h"
#include "constants/event_object_movement_constants.h"
diff --git a/src/move_relearner.c b/src/move_relearner.c
index 867c6c995..121ac66e8 100644
--- a/src/move_relearner.c
+++ b/src/move_relearner.c
@@ -9,7 +9,7 @@
#include "gpu_regs.h"
#include "move_relearner.h"
#include "list_menu.h"
-#include "alloc.h"
+#include "malloc.h"
#include "menu.h"
#include "menu_helpers.h"
#include "menu_specialized.h"
diff --git a/src/mystery_gift.c b/src/mystery_gift.c
index ab3df9020..aae7d127e 100644
--- a/src/mystery_gift.c
+++ b/src/mystery_gift.c
@@ -2,7 +2,7 @@
#include "main.h"
#include "text.h"
#include "task.h"
-#include "alloc.h"
+#include "malloc.h"
#include "gpu_regs.h"
#include "scanline_effect.h"
#include "text_window.h"
diff --git a/src/naming_screen.c b/src/naming_screen.c
index 472489a26..095a43117 100644
--- a/src/naming_screen.c
+++ b/src/naming_screen.c
@@ -1,6 +1,6 @@
#include "global.h"
#include "naming_screen.h"
-#include "alloc.h"
+#include "malloc.h"
#include "palette.h"
#include "task.h"
#include "sprite.h"
diff --git a/src/overworld.c b/src/overworld.c
index 0cac8390a..e32024c77 100644
--- a/src/overworld.c
+++ b/src/overworld.c
@@ -26,7 +26,7 @@
#include "link_rfu.h"
#include "load_save.h"
#include "main.h"
-#include "alloc.h"
+#include "malloc.h"
#include "m4a.h"
#include "map_name_popup.h"
#include "match_call.h"
diff --git a/src/party_menu.c b/src/party_menu.c
index f4b749bde..b3938ef2a 100755
--- a/src/party_menu.c
+++ b/src/party_menu.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "battle.h"
#include "battle_anim.h"
#include "battle_controllers.h"
@@ -2918,7 +2918,7 @@ static void sub_81B1E60(u8 taskId)
if (data[3] == 0 || data[0] == 0 || data[0] == data[1])
{
if (data[0] > data[5])
- ConvertIntToDecimalStringN(gStringVar2, data[0] - data[5], 0, 3);
+ ConvertIntToDecimalStringN(gStringVar2, data[0] - data[5], STR_CONV_MODE_LEFT_ALIGN, 3);
SwitchTaskToFollowupFunc(taskId);
}
}
@@ -3412,7 +3412,7 @@ static void DisplayPartyPokemonLevelCheck(struct Pokemon *mon, struct Struct203C
static void DisplayPartyPokemonLevel(u8 level, struct Struct203CEDC *ptr)
{
- ConvertIntToDecimalStringN(gStringVar2, level, 0, 3);
+ ConvertIntToDecimalStringN(gStringVar2, level, STR_CONV_MODE_LEFT_ALIGN, 3);
StringCopy(gStringVar1, gText_LevelSymbol);
StringAppend(gStringVar1, gStringVar2);
DisplayPartyPokemonBarDetail(ptr->windowId, gStringVar1, 0, &ptr->unk0->unk4[4]);
@@ -3464,7 +3464,7 @@ static void DisplayPartyPokemonHPCheck(struct Pokemon *mon, struct Struct203CEDC
static void DisplayPartyPokemonHP(u16 hp, struct Struct203CEDC *ptr)
{
- u8 *strOut = ConvertIntToDecimalStringN(gStringVar1, hp, 1, 3);
+ u8 *strOut = ConvertIntToDecimalStringN(gStringVar1, hp, STR_CONV_MODE_RIGHT_ALIGN, 3);
strOut[0] = CHAR_SLASH;
strOut[1] = EOS;
@@ -3485,7 +3485,7 @@ static void DisplayPartyPokemonMaxHPCheck(struct Pokemon *mon, struct Struct203C
static void DisplayPartyPokemonMaxHP(u16 maxhp, struct Struct203CEDC *ptr)
{
- ConvertIntToDecimalStringN(gStringVar2, maxhp, 1, 3);
+ ConvertIntToDecimalStringN(gStringVar2, maxhp, STR_CONV_MODE_RIGHT_ALIGN, 3);
StringCopy(gStringVar1, gText_Slash);
StringAppend(gStringVar1, gStringVar2);
DisplayPartyPokemonBarDetail(ptr->windowId, gStringVar1, 0, &ptr->unk0->unk4[16]);
@@ -4580,7 +4580,7 @@ static void CursorCb_Enter(u8 taskId)
return;
}
}
- ConvertIntToDecimalStringN(gStringVar1, unk, 0, 1);
+ ConvertIntToDecimalStringN(gStringVar1, unk, STR_CONV_MODE_LEFT_ALIGN, 1);
StringExpandPlaceholders(gStringVar4, gText_NoMoreThanVar1Pkmn);
PlaySE(SE_HAZURE);
sub_81B1B5C(gStringVar4, 1);
@@ -6004,7 +6004,7 @@ void dp05_rare_candy(u8 taskId, TaskFunc task)
sub_81B754C(gUnknown_0203CEC8.slotId, mon);
RemoveBagItem(gSpecialVar_ItemId, 1);
GetMonNickname(mon, gStringVar1);
- ConvertIntToDecimalStringN(gStringVar2, GetMonData(mon, MON_DATA_LEVEL), 0, 3);
+ ConvertIntToDecimalStringN(gStringVar2, GetMonData(mon, MON_DATA_LEVEL), STR_CONV_MODE_LEFT_ALIGN, 3);
StringExpandPlaceholders(gStringVar4, gText_PkmnElevatedToLvVar2);
sub_81B1B5C(gStringVar4, 1);
schedule_bg_copy_tilemap_to_vram(2);
@@ -6634,7 +6634,7 @@ static u8 sub_81B865C(void)
{
if (unk == 1)
return 14;
- ConvertIntToDecimalStringN(gStringVar1, unk, 0, 1);
+ ConvertIntToDecimalStringN(gStringVar1, unk, STR_CONV_MODE_LEFT_ALIGN, 1);
return 17;
}
diff --git a/src/player_pc.c b/src/player_pc.c
index 08f24d379..dd90bbd8a 100644
--- a/src/player_pc.c
+++ b/src/player_pc.c
@@ -14,7 +14,7 @@
#include "list_menu.h"
#include "mail.h"
#include "main.h"
-#include "alloc.h"
+#include "malloc.h"
#include "menu.h"
#include "menu_helpers.h"
#include "overworld.h"
diff --git a/src/pokeblock.c b/src/pokeblock.c
index 30e630d9a..14e5b6a1f 100644
--- a/src/pokeblock.c
+++ b/src/pokeblock.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "battle.h"
#include "battle_controllers.h"
#include "battle_message.h"
diff --git a/src/pokeblock_feed.c b/src/pokeblock_feed.c
index 4ad15414d..2c0b68dc6 100644
--- a/src/pokeblock_feed.c
+++ b/src/pokeblock_feed.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "battle.h"
#include "bg.h"
#include "data.h"
diff --git a/src/pokedex.c b/src/pokedex.c
index c1787ef6a..98ac962db 100644
--- a/src/pokedex.c
+++ b/src/pokedex.c
@@ -8,7 +8,7 @@
#include "graphics.h"
#include "international_string_util.h"
#include "main.h"
-#include "alloc.h"
+#include "malloc.h"
#include "menu.h"
#include "m4a.h"
#include "overworld.h"
@@ -3889,7 +3889,7 @@ void sub_80C020C(u32 num, u32 value, u32 c, u32 d)
value = NationalToHoennOrder(num);
else
value = num;
- ConvertIntToDecimalStringN(StringCopy(str, gText_UnkCtrlF908Clear01), value, 2, 3);
+ ConvertIntToDecimalStringN(StringCopy(str, gText_UnkCtrlF908Clear01), value, STR_CONV_MODE_LEADING_ZEROS, 3);
sub_80BE8DC(str, 0x60, 0x19);
natNum = NationalPokedexNumToSpecies(num);
if (natNum)
diff --git a/src/pokedex_area_screen.c b/src/pokedex_area_screen.c
index dc69b5d54..697fdb792 100755
--- a/src/pokedex_area_screen.c
+++ b/src/pokedex_area_screen.c
@@ -4,7 +4,7 @@
#include "gpu_regs.h"
#include "graphics.h"
#include "main.h"
-#include "alloc.h"
+#include "malloc.h"
#include "menu.h"
#include "overworld.h"
#include "palette.h"
diff --git a/src/pokedex_cry_screen.c b/src/pokedex_cry_screen.c
index 487db6d58..0b35b00ee 100644
--- a/src/pokedex_cry_screen.c
+++ b/src/pokedex_cry_screen.c
@@ -2,7 +2,7 @@
#include "bg.h"
#include "m4a.h"
#include "main.h"
-#include "alloc.h"
+#include "malloc.h"
#include "palette.h"
#include "pokedex_cry_screen.h"
#include "sound.h"
diff --git a/src/pokemon.c b/src/pokemon.c
index 8812e5bc4..da659b10d 100644
--- a/src/pokemon.c
+++ b/src/pokemon.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "apprentice.h"
#include "battle.h"
#include "battle_anim.h"
diff --git a/src/pokemon_jump.c b/src/pokemon_jump.c
index 8f16e1ce2..cc9c2f4ff 100755
--- a/src/pokemon_jump.c
+++ b/src/pokemon_jump.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "battle_anim.h"
#include "bg.h"
#include "data.h"
diff --git a/src/pokemon_size_record.c b/src/pokemon_size_record.c
index f63e1ccba..914d68925 100644
--- a/src/pokemon_size_record.c
+++ b/src/pokemon_size_record.c
@@ -100,9 +100,9 @@ static void FormatMonSizeRecord(u8 *string, u32 size)
size = (double)(size * 10) / (CM_PER_INCH * 10);
#endif
- string = ConvertIntToDecimalStringN(string, size / 10, 0, 8);
+ string = ConvertIntToDecimalStringN(string, size / 10, STR_CONV_MODE_LEFT_ALIGN, 8);
string = StringAppend(string, gText_DecimalPoint);
- ConvertIntToDecimalStringN(string, size % 10, 0, 1);
+ ConvertIntToDecimalStringN(string, size % 10, STR_CONV_MODE_LEFT_ALIGN, 1);
}
static u8 CompareMonSize(u16 species, u16 *sizeRecord)
diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c
index fa9e61504..560260745 100644
--- a/src/pokemon_storage_system.c
+++ b/src/pokemon_storage_system.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "bg.h"
#include "data.h"
#include "decompress.h"
@@ -2107,7 +2107,7 @@ static void sub_80C7BE4(void)
center = GetStringCenterAlignXOffset(1, boxName, 64);
AddTextPrinterParameterized3(windowId, 1, center, 1, gUnknown_08571734, TEXT_SPEED_FF, boxName);
- ConvertIntToDecimalStringN(text, nPokemonInBox, 1, 2);
+ ConvertIntToDecimalStringN(text, nPokemonInBox, STR_CONV_MODE_RIGHT_ALIGN, 2);
StringAppend(text, gUnknown_08571737);
center = GetStringCenterAlignXOffset(1, text, 64);
AddTextPrinterParameterized3(windowId, 1, center, 17, gUnknown_08571734, TEXT_SPEED_FF, text);
diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c
index 8697c557f..1190b73d5 100644
--- a/src/pokemon_summary_screen.c
+++ b/src/pokemon_summary_screen.c
@@ -20,7 +20,7 @@
#include "item.h"
#include "link.h"
#include "m4a.h"
-#include "alloc.h"
+#include "malloc.h"
#include "menu.h"
#include "menu_helpers.h"
#include "mon_markings.h"
@@ -2716,7 +2716,7 @@ static void PrintNotEggInfo(void)
if (dexNum != 0xFFFF)
{
StringCopy(gStringVar1, &gText_UnkCtrlF908Clear01[0]);
- ConvertIntToDecimalStringN(gStringVar2, dexNum, 2, 3);
+ ConvertIntToDecimalStringN(gStringVar2, dexNum, STR_CONV_MODE_LEADING_ZEROS, 3);
StringAppend(gStringVar1, gStringVar2);
if (!IsMonShiny(mon))
{
@@ -2739,7 +2739,7 @@ static void PrintNotEggInfo(void)
SetDexNumberColor(TRUE);
}
StringCopy(gStringVar1, &gText_LevelSymbol[0]);
- ConvertIntToDecimalStringN(gStringVar2, summary->level, 0, 3);
+ ConvertIntToDecimalStringN(gStringVar2, summary->level, STR_CONV_MODE_LEFT_ALIGN, 3);
StringAppend(gStringVar1, gStringVar2);
SummaryScreen_PrintTextOnWindow(PSS_LABEL_WINDOW_PORTRAIT_SPECIES, gStringVar1, 0x18, 17, 0, 1);
GetMonNickname(mon, gStringVar1);
@@ -3054,7 +3054,7 @@ static void PrintMonOTID(void)
int xPos;
if (InBattleFactory() != TRUE && InSlateportBattleTent() != TRUE)
{
- ConvertIntToDecimalStringN(StringCopy(gStringVar1, gText_UnkCtrlF907F908), (u16)sMonSummaryScreen->summary.OTID, 2, 5);
+ ConvertIntToDecimalStringN(StringCopy(gStringVar1, gText_UnkCtrlF907F908), (u16)sMonSummaryScreen->summary.OTID, STR_CONV_MODE_LEADING_ZEROS, 5);
xPos = GetStringRightAlignXOffset(1, gStringVar1, 56);
SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(sPageInfoTemplate, PSS_DATA_WINDOW_INFO_ID), gStringVar1, xPos, 1, 0, 1);
}
@@ -3141,7 +3141,7 @@ static void GetMetLevelString(u8 *output)
u8 level = sMonSummaryScreen->summary.metLevel;
if (level == 0)
level = EGG_HATCH_LEVEL;
- ConvertIntToDecimalStringN(output, level, 0, 3);
+ ConvertIntToDecimalStringN(output, level, STR_CONV_MODE_LEFT_ALIGN, 3);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(3, output);
}
@@ -3336,7 +3336,7 @@ static void PrintRibbonCount(void)
}
else
{
- ConvertIntToDecimalStringN(gStringVar1, sMonSummaryScreen->summary.ribbonCount, 1, 2);
+ ConvertIntToDecimalStringN(gStringVar1, sMonSummaryScreen->summary.ribbonCount, STR_CONV_MODE_RIGHT_ALIGN, 2);
StringExpandPlaceholders(gStringVar4, gText_RibbonsVar1);
text = gStringVar4;
}
@@ -3352,10 +3352,10 @@ static void BufferLeftColumnStats(void)
u8 *attackString = Alloc(8);
u8 *defenseString = Alloc(8);
- ConvertIntToDecimalStringN(currentHPString, sMonSummaryScreen->summary.currentHP, 1, 3);
- ConvertIntToDecimalStringN(maxHPString, sMonSummaryScreen->summary.maxHP, 1, 3);
- ConvertIntToDecimalStringN(attackString, sMonSummaryScreen->summary.atk, 1, 7);
- ConvertIntToDecimalStringN(defenseString, sMonSummaryScreen->summary.def, 1, 7);
+ ConvertIntToDecimalStringN(currentHPString, sMonSummaryScreen->summary.currentHP, STR_CONV_MODE_RIGHT_ALIGN, 3);
+ ConvertIntToDecimalStringN(maxHPString, sMonSummaryScreen->summary.maxHP, STR_CONV_MODE_RIGHT_ALIGN, 3);
+ ConvertIntToDecimalStringN(attackString, sMonSummaryScreen->summary.atk, STR_CONV_MODE_RIGHT_ALIGN, 7);
+ ConvertIntToDecimalStringN(defenseString, sMonSummaryScreen->summary.def, STR_CONV_MODE_RIGHT_ALIGN, 7);
DynamicPlaceholderTextUtil_Reset();
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, currentHPString);
@@ -3377,9 +3377,9 @@ static void PrintLeftColumnStats(void)
static void BufferRightColumnStats(void)
{
- ConvertIntToDecimalStringN(gStringVar1, sMonSummaryScreen->summary.spatk, 1, 3);
- ConvertIntToDecimalStringN(gStringVar2, sMonSummaryScreen->summary.spdef, 1, 3);
- ConvertIntToDecimalStringN(gStringVar3, sMonSummaryScreen->summary.speed, 1, 3);
+ ConvertIntToDecimalStringN(gStringVar1, sMonSummaryScreen->summary.spatk, STR_CONV_MODE_RIGHT_ALIGN, 3);
+ ConvertIntToDecimalStringN(gStringVar2, sMonSummaryScreen->summary.spdef, STR_CONV_MODE_RIGHT_ALIGN, 3);
+ ConvertIntToDecimalStringN(gStringVar3, sMonSummaryScreen->summary.speed, STR_CONV_MODE_RIGHT_ALIGN, 3);
DynamicPlaceholderTextUtil_Reset();
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1);
@@ -3400,7 +3400,7 @@ static void PrintExpPointsNextLevel(void)
int offset;
u32 expToNextLevel;
- ConvertIntToDecimalStringN(gStringVar1, sum->exp, 1, 7);
+ ConvertIntToDecimalStringN(gStringVar1, sum->exp, STR_CONV_MODE_RIGHT_ALIGN, 7);
offset = GetStringRightAlignXOffset(1, gStringVar1, 42) + 2;
SummaryScreen_PrintTextOnWindow(windowId, gStringVar1, offset, 1, 0, 0);
@@ -3409,7 +3409,7 @@ static void PrintExpPointsNextLevel(void)
else
expToNextLevel = 0;
- ConvertIntToDecimalStringN(gStringVar1, expToNextLevel, 1, 6);
+ ConvertIntToDecimalStringN(gStringVar1, expToNextLevel, STR_CONV_MODE_RIGHT_ALIGN, 6);
offset = GetStringRightAlignXOffset(1, gStringVar1, 42) + 2;
SummaryScreen_PrintTextOnWindow(windowId, gStringVar1, offset, 17, 0, 0);
}
@@ -3496,8 +3496,8 @@ static void PrintMoveNameAndPP(u8 moveIndex)
{
pp = CalculatePPWithBonus(move, summaryStruct->summary.ppBonuses, moveIndex);
SummaryScreen_PrintTextOnWindow(moveNameWindowId, gMoveNames[move], 0, moveIndex * 16 + 1, 0, 1);
- ConvertIntToDecimalStringN(gStringVar1, summaryStruct->summary.pp[moveIndex], 1, 2);
- ConvertIntToDecimalStringN(gStringVar2, pp, 1, 2);
+ ConvertIntToDecimalStringN(gStringVar1, summaryStruct->summary.pp[moveIndex], STR_CONV_MODE_RIGHT_ALIGN, 2);
+ ConvertIntToDecimalStringN(gStringVar2, pp, STR_CONV_MODE_RIGHT_ALIGN, 2);
DynamicPlaceholderTextUtil_Reset();
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, gStringVar2);
@@ -3530,7 +3530,7 @@ static void PrintMovePowerAndAccuracy(u16 moveIndex)
}
else
{
- ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[moveIndex].power, 1, 3);
+ ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[moveIndex].power, STR_CONV_MODE_RIGHT_ALIGN, 3);
text = gStringVar1;
}
@@ -3542,7 +3542,7 @@ static void PrintMovePowerAndAccuracy(u16 moveIndex)
}
else
{
- ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[moveIndex].accuracy, 1, 3);
+ ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[moveIndex].accuracy, STR_CONV_MODE_RIGHT_ALIGN, 3);
text = gStringVar1;
}
@@ -3660,7 +3660,7 @@ static void PrintNewMoveDetailsOrCancelText(void)
else
SummaryScreen_PrintTextOnWindow(windowId1, gMoveNames[move], 0, 65, 0, 5);
- ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[move].pp, 1, 2);
+ ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[move].pp, STR_CONV_MODE_RIGHT_ALIGN, 2);
DynamicPlaceholderTextUtil_Reset();
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, gStringVar1);
diff --git a/src/pokenav.c b/src/pokenav.c
index a5bb51789..2a1647a6f 100644
--- a/src/pokenav.c
+++ b/src/pokenav.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "task.h"
#include "main.h"
#include "overworld.h"
diff --git a/src/pokenav_unk_2.c b/src/pokenav_unk_2.c
index 1c40e146f..cb9467a9c 100644
--- a/src/pokenav_unk_2.c
+++ b/src/pokenav_unk_2.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "decompress.h"
#include "bg.h"
#include "palette.h"
diff --git a/src/rayquaza_scene.c b/src/rayquaza_scene.c
index fc2860797..4e5e492f2 100644
--- a/src/rayquaza_scene.c
+++ b/src/rayquaza_scene.c
@@ -5,7 +5,7 @@
#include "graphics.h"
#include "bg.h"
#include "main.h"
-#include "alloc.h"
+#include "malloc.h"
#include "palette.h"
#include "scanline_effect.h"
#include "menu.h"
diff --git a/src/record_mixing.c b/src/record_mixing.c
index 32e0404b9..8df0a8a8b 100644
--- a/src/record_mixing.c
+++ b/src/record_mixing.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "random.h"
#include "constants/items.h"
#include "text.h"
diff --git a/src/recorded_battle.c b/src/recorded_battle.c
index 432c5dbe6..bd1974d48 100644
--- a/src/recorded_battle.c
+++ b/src/recorded_battle.c
@@ -10,7 +10,7 @@
#include "string_util.h"
#include "palette.h"
#include "save.h"
-#include "alloc.h"
+#include "malloc.h"
#include "util.h"
#include "task.h"
#include "text.h"
diff --git a/src/region_map.c b/src/region_map.c
index ea2cbfa6a..3bb532a19 100644
--- a/src/region_map.c
+++ b/src/region_map.c
@@ -2,7 +2,7 @@
#include "main.h"
#include "text.h"
#include "menu.h"
-#include "alloc.h"
+#include "malloc.h"
#include "gpu_regs.h"
#include "palette.h"
#include "party_menu.h"
diff --git a/src/reset_rtc_screen.c b/src/reset_rtc_screen.c
index 1fe9f2279..eebaab52f 100644
--- a/src/reset_rtc_screen.c
+++ b/src/reset_rtc_screen.c
@@ -300,19 +300,19 @@ static void PrintTime(u8 windowId, u8 x, u8 y, u16 days, u8 hours, u8 minutes, u
{
u8 *dest = gStringVar4;
- ConvertIntToDecimalStringN(gStringVar1, days, 1, 4);
+ ConvertIntToDecimalStringN(gStringVar1, days, STR_CONV_MODE_RIGHT_ALIGN, 4);
dest = StringCopy(dest, gStringVar1);
dest = StringCopy(dest, gText_Day);
- ConvertIntToDecimalStringN(gStringVar1, hours, 1, 3);
+ ConvertIntToDecimalStringN(gStringVar1, hours, STR_CONV_MODE_RIGHT_ALIGN, 3);
dest = StringCopy(dest, gStringVar1);
dest = StringCopy(dest, gText_Colon3);
- ConvertIntToDecimalStringN(gStringVar1, minutes, 2, 2);
+ ConvertIntToDecimalStringN(gStringVar1, minutes, STR_CONV_MODE_LEADING_ZEROS, 2);
dest = StringCopy(dest, gStringVar1);
dest = StringCopy(dest, gText_Colon3);
- ConvertIntToDecimalStringN(gStringVar1, seconds, 2, 2);
+ ConvertIntToDecimalStringN(gStringVar1, seconds, STR_CONV_MODE_LEADING_ZEROS, 2);
dest = StringCopy(dest, gStringVar1);
AddTextPrinterParameterized(windowId, 1, gStringVar4, x, y, TEXT_SPEED_FF, NULL);
diff --git a/src/reset_save_heap.c b/src/reset_save_heap.c
index beba742f5..5a54a2177 100644
--- a/src/reset_save_heap.c
+++ b/src/reset_save_heap.c
@@ -6,7 +6,7 @@
#include "save.h"
#include "new_game.h"
#include "overworld.h"
-#include "alloc.h"
+#include "malloc.h"
void sub_81700F8(void)
{
diff --git a/src/rom_8034C54.c b/src/rom_8034C54.c
index 42817fc2b..7cc30c775 100644
--- a/src/rom_8034C54.c
+++ b/src/rom_8034C54.c
@@ -1,6 +1,6 @@
#include "global.h"
#include "rom_8034C54.h"
-#include "alloc.h"
+#include "malloc.h"
#include "decompress.h"
#include "main.h"
#include "battle_main.h"
diff --git a/src/rom_81520A8.c b/src/rom_81520A8.c
index f06823594..f6d14d49c 100644
--- a/src/rom_81520A8.c
+++ b/src/rom_81520A8.c
@@ -1,6 +1,6 @@
#include "global.h"
#include "rom_81520A8.h"
-#include "alloc.h"
+#include "malloc.h"
#include "main.h"
#include "rom_8034C54.h"
diff --git a/src/roulette.c b/src/roulette.c
index 662522aae..537d2f9c7 100644
--- a/src/roulette.c
+++ b/src/roulette.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "bg.h"
#include "coins.h"
#include "decompress.h"
@@ -3134,7 +3134,7 @@ static void Task_Roulette_0(u8 taskId)
s32 temp;
PrintCoinsString(gTasks[taskId].data[13]);
temp = gUnknown_085B6344[(gSpecialVar_0x8004 & 1) + (gSpecialVar_0x8004 >> 7 << 1)];
- ConvertIntToDecimalStringN(gStringVar1, temp, 2, 1);
+ ConvertIntToDecimalStringN(gStringVar1, temp, STR_CONV_MODE_LEADING_ZEROS, 1);
if (gTasks[taskId].data[13] >= temp)
{
if ((gSpecialVar_0x8004 & 0x80) && (gSpecialVar_0x8004 & 1))
diff --git a/src/scrcmd.c b/src/scrcmd.c
index 4c8895ab8..9861f9dae 100644
--- a/src/scrcmd.c
+++ b/src/scrcmd.c
@@ -1612,10 +1612,10 @@ bool8 ScrCmd_buffermovename(struct ScriptContext *ctx)
bool8 ScrCmd_buffernumberstring(struct ScriptContext *ctx)
{
u8 stringVarIndex = ScriptReadByte(ctx);
- u16 v1 = VarGet(ScriptReadHalfword(ctx));
- u8 v2 = CountDigits(v1);
+ u16 num = VarGet(ScriptReadHalfword(ctx));
+ u8 numDigits = CountDigits(num);
- ConvertIntToDecimalStringN(sScriptStringVars[stringVarIndex], v1, 0, v2);
+ ConvertIntToDecimalStringN(sScriptStringVars[stringVarIndex], num, STR_CONV_MODE_LEFT_ALIGN, numDigits);
return FALSE;
}
diff --git a/src/secret_base.c b/src/secret_base.c
index d02011406..76dbe7668 100644
--- a/src/secret_base.c
+++ b/src/secret_base.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "battle.h"
#include "battle_setup.h"
#include "decoration.h"
diff --git a/src/shop.c b/src/shop.c
index bf15568fb..ebbc2a847 100755
--- a/src/shop.c
+++ b/src/shop.c
@@ -17,7 +17,7 @@
#include "item_menu.h"
#include "list_menu.h"
#include "main.h"
-#include "alloc.h"
+#include "malloc.h"
#include "menu.h"
#include "menu_helpers.h"
#include "money.h"
@@ -1147,7 +1147,7 @@ static void BuyMenuPrintItemQuantityAndPrice(u8 taskId)
FillWindowPixelBuffer(4, PIXEL_FILL(1));
PrintMoneyAmount(4, 38, 1, gShopDataPtr->totalCost, TEXT_SPEED_FF);
- ConvertIntToDecimalStringN(gStringVar1, tItemCount, 2, 2);
+ ConvertIntToDecimalStringN(gStringVar1, tItemCount, STR_CONV_MODE_LEADING_ZEROS, 2);
StringExpandPlaceholders(gStringVar4, gText_xVar1);
BuyMenuPrint(4, gStringVar4, 0, 1, 0, 0);
}
diff --git a/src/slot_machine.c b/src/slot_machine.c
index 003ac3327..37071926e 100644
--- a/src/slot_machine.c
+++ b/src/slot_machine.c
@@ -14,7 +14,7 @@
#include "util.h"
#include "text.h"
#include "menu.h"
-#include "alloc.h"
+#include "malloc.h"
#include "bg.h"
#include "gpu_regs.h"
#include "coins.h"
diff --git a/src/trade.c b/src/trade.c
index c29fe54c3..196d9659c 100644
--- a/src/trade.c
+++ b/src/trade.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "battle_anim.h"
#include "battle_interface.h"
#include "bg.h"
diff --git a/src/trainer_card.c b/src/trainer_card.c
index 9c4816c42..f3bff3731 100755
--- a/src/trainer_card.c
+++ b/src/trainer_card.c
@@ -4,7 +4,7 @@
#include "task.h"
#include "main.h"
#include "window.h"
-#include "alloc.h"
+#include "malloc.h"
#include "link.h"
#include "bg.h"
#include "sound.h"
@@ -1010,7 +1010,7 @@ static void PrintMoneyOnCard(void)
else
AddTextPrinterParameterized3(1, 1, 16, 57, gUnknown_0856FB0C, TEXT_SPEED_FF, gText_TrainerCardMoney);
- ConvertIntToDecimalStringN(gStringVar1, sData->trainerCard.money, 0, 6);
+ ConvertIntToDecimalStringN(gStringVar1, sData->trainerCard.money, STR_CONV_MODE_LEFT_ALIGN, 6);
StringExpandPlaceholders(gStringVar4, gText_PokedollarVar1);
if (!sData->isHoenn)
{
@@ -1043,7 +1043,7 @@ static void PrintPokedexOnCard(void)
AddTextPrinterParameterized3(1, 1, 20, 72, gUnknown_0856FB0C, TEXT_SPEED_FF, gText_TrainerCardPokedex);
else
AddTextPrinterParameterized3(1, 1, 16, 73, gUnknown_0856FB0C, TEXT_SPEED_FF, gText_TrainerCardPokedex);
- StringCopy(ConvertIntToDecimalStringN(gStringVar4, sData->trainerCard.caughtMonsCount, 0, 3), gText_EmptyString6);
+ StringCopy(ConvertIntToDecimalStringN(gStringVar4, sData->trainerCard.caughtMonsCount, STR_CONV_MODE_LEFT_ALIGN, 3), gText_EmptyString6);
if (!sData->isHoenn)
{
xOffset = GetStringRightAlignXOffset(1, gStringVar4, 144);
@@ -1103,12 +1103,12 @@ static void PrintTimeOnCard(void)
r7 -= r10;
FillWindowPixelRect(1, PIXEL_FILL(0), r7, r4, r10, 15);
- ConvertIntToDecimalStringN(gStringVar4, hours, 1, 3);
+ ConvertIntToDecimalStringN(gStringVar4, hours, STR_CONV_MODE_RIGHT_ALIGN, 3);
AddTextPrinterParameterized3(1, 1, r7, r4, gUnknown_0856FB0C, TEXT_SPEED_FF, gStringVar4);
r7 += 18;
AddTextPrinterParameterized3(1, 1, r7, r4, gUnknown_0856FB40[sData->var_7], TEXT_SPEED_FF, gText_Colon2);
r7 += width;
- ConvertIntToDecimalStringN(gStringVar4, minutes, 2, 2);
+ ConvertIntToDecimalStringN(gStringVar4, minutes, STR_CONV_MODE_LEADING_ZEROS, 2);
AddTextPrinterParameterized3(1, 1, r7, r4, gUnknown_0856FB0C, TEXT_SPEED_FF, gStringVar4);
}
@@ -1151,9 +1151,9 @@ static void PrintHofTimeOnCard(void)
{
if (sData->hasHofResult)
{
- ConvertIntToDecimalStringN(gStringVar1, sData->trainerCard.hofDebutHours, 1, 3);
- ConvertIntToDecimalStringN(gStringVar2, sData->trainerCard.hofDebutMinutes, 2, 2);
- ConvertIntToDecimalStringN(gStringVar3, sData->trainerCard.hofDebutSeconds, 2, 2);
+ ConvertIntToDecimalStringN(gStringVar1, sData->trainerCard.hofDebutHours, STR_CONV_MODE_RIGHT_ALIGN, 3);
+ ConvertIntToDecimalStringN(gStringVar2, sData->trainerCard.hofDebutMinutes, STR_CONV_MODE_LEADING_ZEROS, 2);
+ ConvertIntToDecimalStringN(gStringVar3, sData->trainerCard.hofDebutSeconds, STR_CONV_MODE_LEADING_ZEROS, 2);
StringExpandPlaceholders(sData->var_93, gUnknown_0856FB4C);
}
}
@@ -1180,8 +1180,8 @@ static void PrintLinkResultsNumsOnCard(void)
if (sData->hasLinkResults)
{
StringCopy(sData->var_D9, gUnknown_0856FB5C[sData->cardType]);
- ConvertIntToDecimalStringN(sData->var_165, sData->trainerCard.linkBattleWins, 0, 4);
- ConvertIntToDecimalStringN(sData->var_1AB, sData->trainerCard.linkBattleLosses, 0, 4);
+ ConvertIntToDecimalStringN(sData->var_165, sData->trainerCard.linkBattleWins, STR_CONV_MODE_LEFT_ALIGN, 4);
+ ConvertIntToDecimalStringN(sData->var_1AB, sData->trainerCard.linkBattleLosses, STR_CONV_MODE_LEFT_ALIGN, 4);
}
}
@@ -1199,7 +1199,7 @@ static void PrintWinsLossesStringOnCard(void)
static void PrintTradesNumOnCard(void)
{
if (sData->hasTrades)
- ConvertIntToDecimalStringN(sData->var_237, sData->trainerCard.pokemonTrades, 1, 5);
+ ConvertIntToDecimalStringN(sData->var_237, sData->trainerCard.pokemonTrades, STR_CONV_MODE_RIGHT_ALIGN, 5);
}
static void PrintTradesStringOnCard(void)
@@ -1211,7 +1211,7 @@ static void PrintTradesStringOnCard(void)
static void PrintBerryCrushNumOnCard(void)
{
if (sData->cardType == CARD_TYPE_FRLG && sData->trainerCard.berryCrushPoints)
- ConvertIntToDecimalStringN(sData->var_2C3, sData->trainerCard.berryCrushPoints, 1, 5);
+ ConvertIntToDecimalStringN(sData->var_2C3, sData->trainerCard.berryCrushPoints, STR_CONV_MODE_RIGHT_ALIGN, 5);
}
static void PrintBerryCrushStringOnCard(void)
@@ -1223,7 +1223,7 @@ static void PrintBerryCrushStringOnCard(void)
static void PrintUnionNumOnCard(void)
{
if (sData->cardType == CARD_TYPE_FRLG && sData->trainerCard.unionRoomNum)
- ConvertIntToDecimalStringN(sData->var_34F, sData->trainerCard.unionRoomNum, 1, 5);
+ ConvertIntToDecimalStringN(sData->var_34F, sData->trainerCard.unionRoomNum, STR_CONV_MODE_RIGHT_ALIGN, 5);
}
static void PrintUnionStringOnCard(void)
@@ -1236,7 +1236,7 @@ static void PrintPokeblocksNumOnCard(void)
{
if (sData->cardType != CARD_TYPE_FRLG && sData->trainerCard.pokeblocksWithFriends)
{
- ConvertIntToDecimalStringN(gStringVar1, sData->trainerCard.pokeblocksWithFriends, 1, 5);
+ ConvertIntToDecimalStringN(gStringVar1, sData->trainerCard.pokeblocksWithFriends, STR_CONV_MODE_RIGHT_ALIGN, 5);
StringExpandPlaceholders(sData->var_395, gText_Var1DarkGreyShadowLightGrey);
}
}
@@ -1250,7 +1250,7 @@ static void PrintPokeblockStringOnCard(void)
static void PrintContestNumOnCard(void)
{
if (sData->cardType != CARD_TYPE_FRLG && sData->trainerCard.contestsWithFriends)
- ConvertIntToDecimalStringN(sData->var_3DB, sData->trainerCard.contestsWithFriends, 1, 5);
+ ConvertIntToDecimalStringN(sData->var_3DB, sData->trainerCard.contestsWithFriends, STR_CONV_MODE_RIGHT_ALIGN, 5);
}
static void PrintContestStringOnCard(void)
@@ -1266,15 +1266,15 @@ static void PrintBattleFacilityNumsOnCard(void)
case CARD_TYPE_RS:
if (sData->hasBattleTowerWins)
{
- ConvertIntToDecimalStringN(gStringVar1, sData->trainerCard.battleTowerWins, 1, 4);
- ConvertIntToDecimalStringN(gStringVar2, sData->trainerCard.battleTowerStraightWins, 1, 4);
+ ConvertIntToDecimalStringN(gStringVar1, sData->trainerCard.battleTowerWins, STR_CONV_MODE_RIGHT_ALIGN, 4);
+ ConvertIntToDecimalStringN(gStringVar2, sData->trainerCard.battleTowerStraightWins, STR_CONV_MODE_RIGHT_ALIGN, 4);
StringExpandPlaceholders(sData->var_421, gText_WSlashStraightSlash);
}
break;
case CARD_TYPE_EMERALD:
if (sData->trainerCard.frontierBP)
{
- ConvertIntToDecimalStringN(gStringVar1, sData->trainerCard.frontierBP, 1, 5);
+ ConvertIntToDecimalStringN(gStringVar1, sData->trainerCard.frontierBP, STR_CONV_MODE_RIGHT_ALIGN, 5);
StringExpandPlaceholders(sData->var_421, gText_Var1DarkLightGreyBP);
}
break;
diff --git a/src/trainer_hill.c b/src/trainer_hill.c
index 2a7e003d9..995dc164a 100644
--- a/src/trainer_hill.c
+++ b/src/trainer_hill.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "battle.h"
#include "battle_tower.h"
#include "battle_setup.h"
diff --git a/src/trainer_pokemon_sprites.c b/src/trainer_pokemon_sprites.c
index 047783a85..f360ec84c 100644
--- a/src/trainer_pokemon_sprites.c
+++ b/src/trainer_pokemon_sprites.c
@@ -1,7 +1,7 @@
#include "global.h"
#include "sprite.h"
#include "window.h"
-#include "alloc.h"
+#include "malloc.h"
#include "constants/species.h"
#include "palette.h"
#include "decompress.h"
diff --git a/src/tv.c b/src/tv.c
index 62d261a63..4696a25e3 100644
--- a/src/tv.c
+++ b/src/tv.c
@@ -31,7 +31,7 @@
#include "text.h"
#include "script_menu.h"
#include "naming_screen.h"
-#include "alloc.h"
+#include "malloc.h"
#include "region_map.h"
#include "constants/region_map_sections.h"
#include "decoration.h"
diff --git a/src/union_room.c b/src/union_room.c
index 8c88c19f8..8ae111926 100644
--- a/src/union_room.c
+++ b/src/union_room.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "battle.h"
#include "berry_crush.h"
#include "bg.h"
diff --git a/src/union_room_battle.c b/src/union_room_battle.c
index 79d12291d..b49406eac 100644
--- a/src/union_room_battle.c
+++ b/src/union_room_battle.c
@@ -6,7 +6,7 @@
#include "bg.h"
#include "palette.h"
#include "gpu_regs.h"
-#include "alloc.h"
+#include "malloc.h"
#include "menu.h"
#include "window.h"
#include "text_window.h"
diff --git a/src/union_room_chat.c b/src/union_room_chat.c
index 4afeb99cf..8a3ab758e 100755
--- a/src/union_room_chat.c
+++ b/src/union_room_chat.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "alloc.h"
+#include "malloc.h"
#include "bg.h"
#include "decompress.h"
#include "dma3.h"
diff --git a/src/unk_pokedex_area_screen_helper.c b/src/unk_pokedex_area_screen_helper.c
index 0041d628c..9b2401cb2 100644
--- a/src/unk_pokedex_area_screen_helper.c
+++ b/src/unk_pokedex_area_screen_helper.c
@@ -2,7 +2,7 @@
#include "main.h"
#include "menu.h"
#include "bg.h"
-#include "alloc.h"
+#include "malloc.h"
#include "palette.h"
#include "unk_pokedex_area_screen_helper.h"
diff --git a/src/use_pokeblock.c b/src/use_pokeblock.c
index 655f38def..4d7605c50 100644
--- a/src/use_pokeblock.c
+++ b/src/use_pokeblock.c
@@ -1,7 +1,7 @@
#include "global.h"
#include "main.h"
#include "pokeblock.h"
-#include "alloc.h"
+#include "malloc.h"
#include "decompress.h"
#include "graphics.h"
#include "palette.h"
diff --git a/sym_bss.txt b/sym_bss.txt
index 29b30f2db..c2a60404e 100644
--- a/sym_bss.txt
+++ b/sym_bss.txt
@@ -1,10 +1,10 @@
.include "src/main.o"
- .include "src/alloc.o"
- .include "src/dma3_manager.o"
- .include "src/gpu_regs.o"
- .include "src/bg.o"
- .include "src/text.o"
- .include "src/sprite.o"
+ .include "gflib/malloc.o"
+ .include "gflib/dma3_manager.o"
+ .include "gflib/gpu_regs.o"
+ .include "gflib/bg.o"
+ .include "gflib/text.o"
+ .include "gflib/sprite.o"
.include "src/link.o"
.include "src/link_rfu.o"
.include "src/union_room.o"
diff --git a/sym_common.txt b/sym_common.txt
index f277ed0f2..7c306c61b 100644
--- a/sym_common.txt
+++ b/sym_common.txt
@@ -1,9 +1,37 @@
.space 0x8
.include "main.o"
- .include "bg.o"
- .include "window.o"
- .include "text.o"
- .include "sprite.o"
+ @ ../gflib/bg.o
+ .align 2
+gUnneededFireRedVariable:
+ .space 4
+ @ ../gflib/window.o
+ .align 4
+gTransparentTileNumber:
+ .space 1
+ .align 4
+gUnknown_03002F70:
+ .space 16
+ @ ../gflib/text.o
+ .align 4
+gFonts:
+ .space 4
+ .align 2
+gUnknown_03002F84:
+ .space 1
+ .align 4
+gUnknown_03002F90:
+ .space 132
+ .align 2
+gTextFlags:
+ .space 4
+ @ ../gflib/sprite.o
+ .align 2
+gOamMatrixAllocBitmap:
+ .space 4
+ .align 2
+gReservedSpritePaletteCount:
+ .space 1
+ .align 4
.include "link.o"
.include "link_rfu.o"
.include "rtc.o"
diff --git a/sym_ewram.txt b/sym_ewram.txt
index 3de0c45cb..bdbb85d37 100644
--- a/sym_ewram.txt
+++ b/sym_ewram.txt
@@ -1,9 +1,9 @@
.include "src/decompress.o"
.include "src/main.o"
- .include "src/window.o"
- .include "src/text.o"
- .include "src/sprite.o"
- .include "src/string_util.o"
+ .include "gflib/window.o"
+ .include "gflib/text.o"
+ .include "gflib/sprite.o"
+ .include "gflib/string_util.o"
.include "src/link.o"
.include "src/link_rfu.o"
.include "src/union_room.o"