diff --git a/INSTALL.md b/INSTALL.md index fcdd8b655..8825e49da 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -101,3 +101,16 @@ If you've only changed `.c` or `.s` files, you can turn off the dependency scann `make NODEP=1` +# Building with devkitARM's C compiler + +This project supports the `arm-none-eabi-gcc` compiler which ships with devkitARM r52. To build this target, simply run: + + make modern + +# Building with your own toolchain + +To build Pokemon Emerald with a toolchain other than devkitARM, override the `DEVKITARM` environment variable with the path to your toolchain. Example: + + make compare DEVKITARM=/usr/local/arm-none-eabi + +The path you pass to the `DEVKITARM` variable must contain the subdirectory `bin`. If you compile the `modern` target with this toolchain, the subdirectories `lib`, `include`, and `arm-none-eabi` must also be present. diff --git a/Makefile b/Makefile index a47c45135..1f974c770 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,11 @@ +ifneq (,$(wildcard $(DEVKITARM)/base_tools)) include $(DEVKITARM)/base_tools +else +PREFIX := $(DEVKITARM)/bin/arm-none-eabi- +OBJCOPY := $(PREFIX)objcopy +CC := $(PREFIX)gcc +AS := $(PREFIX)as +endif export CPP := $(PREFIX)cpp export LD := $(PREFIX)ld @@ -48,7 +55,14 @@ OBJ_DIR := build/modern LIBPATH := -L $(DEVKITARM)/lib/gcc/arm-none-eabi/*/thumb -L $(DEVKITARM)/arm-none-eabi/lib/thumb endif -CPPFLAGS := -I tools/agbcc/include -I tools/agbcc -iquote include -Wno-trigraphs -DMODERN=$(MODERN) +ifeq ($(DEBUG),1) +CFLAGS += -g +endif + +CPPFLAGS := -iquote include -Wno-trigraphs -DMODERN=$(MODERN) +ifeq ($(MODERN),0) +CPPFLAGS += -I tools/agbcc/include -I tools/agbcc +endif LDFLAGS = -Map ../../$(MAP) diff --git a/include/fieldmap.h b/include/fieldmap.h index 2384ed46a..be5610a46 100644 --- a/include/fieldmap.h +++ b/include/fieldmap.h @@ -23,9 +23,9 @@ int GetMapBorderIdAt(int x, int y); int CanCameraMoveInDirection(int direction); u16 GetBehaviorByMetatileId(u16 metatileId); void GetCameraFocusCoords(u16 *x, u16 *y); -u8 MapGridGetMetatileLayerTypeAt(s32 x, s32 y); +u8 MapGridGetMetatileLayerTypeAt(int x, int y); u8 MapGridGetZCoordAt(int x, int y); -u8 CameraMove(s32 deltaX, s32 deltaY); +bool8 CameraMove(int deltaX, int deltaY); struct MapConnection *sub_8088950(u8 direction, int x, int y); bool8 sub_80889A8(u8 direction, int x, int y, struct MapConnection *connection); bool8 sub_8088A0C(int x, int src_width, int dest_width, int offset); diff --git a/include/global.h b/include/global.h index 712a40866..a76d6e4e3 100644 --- a/include/global.h +++ b/include/global.h @@ -2,6 +2,7 @@ #define GUARD_GLOBAL_H #include +#include #include "config.h" // we need to define config before gba headers as print stuff needs the functions nulled before defines. #include "gba/gba.h" #include "constants/global.h" diff --git a/include/link_rfu.h b/include/link_rfu.h index dc5b963d1..4bf106ec1 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -278,7 +278,7 @@ bool32 sub_8011B90(void); void sub_800FE50(u16 *a0); bool32 sub_800E540(u16 id, u8 *name); void sub_8011DE0(u32 arg0); -u8 sub_801100C(int a0); +u8 sub_801100C(s32 a0); void sub_800EF7C(void); bool8 sub_800DE7C(struct UnkLinkRfuStruct_02022B14 *buff1, u8 *buff2, u8 idx); bool8 sub_800DF34(struct UnkLinkRfuStruct_02022B14 *buff1, u8 *buff2, u8 idx);