diff --git a/Makefile b/Makefile index 78a2c2a4f..d97634399 100644 --- a/Makefile +++ b/Makefile @@ -303,6 +303,7 @@ $1: $2 $$(shell $(SCANINC) -I include -I "" $2) $$(PREPROC) $$< charmap.txt | $$(CPP) -I include | $$(AS) $$(ASFLAGS) -o $$@ endef $(foreach src, $(REGULAR_DATA_ASM_SRCS), $(eval $(call DATA_ASM_DEP,$(patsubst $(DATA_ASM_SUBDIR)/%.s,$(DATA_ASM_BUILDDIR)/%.o, $(src)),$(src)))) +$(foreach src, $(C_ASM_SRCS), $(eval $(call DATA_ASM_DEP,$(patsubst $(C_SUBDIR)/%.s,$(C_BUILDDIR)/%.o, $(src)),$(src)))) endif $(SONG_BUILDDIR)/%.o: $(SONG_SUBDIR)/%.s diff --git a/src/crt0.s b/src/crt0.s index 49f214f80..cc83a04df 100644 --- a/src/crt0.s +++ b/src/crt0.s @@ -1,3 +1,4 @@ +#include "constants/global.h" .include "constants/gba_constants.inc" .syntax unified @@ -34,8 +35,8 @@ GPIOPortReadEnable: @ 80000C8 @ 80000CC .space 0x34 - .4byte 3 - .4byte 2 + .4byte GAME_VERSION + .4byte GAME_LANGUAGE .ascii "pokemon emerald version" .space 9 @@ -51,17 +52,33 @@ GPIOPortReadEnable: @ 80000C8 .4byte gMoveNames .4byte gDecorations - .4byte 0x00001270, 0x0000139c, 0x00000018, 0x00000988 - .4byte 0x00003b24, 0x00000046, 0x000008e4, 0x000008ac - .4byte 0x00000182 + .4byte 0x00001270 @ offsetof(struct SaveBlock1, flags) + .4byte 0x0000139c @ offsetof(struct SaveBlock1, vars) + .4byte 0x00000018 @ offsetof(struct SaveBlock2, pokedex) + .4byte 0x00000988 @ offsetof(struct SaveBlock1, seen1) + .4byte 0x00003b24 @ offsetof(struct SaveBlock1, seen2) + .4byte 0x00000046 @ ? + .4byte 0x000008e4 @ ? + .4byte 0x000008ac @ ? + .4byte 0x00000182 @ NATIONAL_DEX_COUNT? .byte 0x07, 0x0a, 0x0a, 0x0a, 0x0c, 0x0c, 0x06, 0x0c .byte 0x06, 0x10, 0x12, 0x0c, 0x0f, 0x0b, 0x01, 0x08 - .4byte 0x0000000c, 0x00000f2c, 0x00003d88, 0x00000234 - .4byte 0x00000238, 0x00000009, 0x0000000a, 0x00000000 - .4byte 0x00000008, 0x00000ca8, 0x00000ca8, 0x000031c7 - .4byte 0x000031b3, 0x00000000 + .4byte 0x0000000c @ ? + .4byte 0x00000f2c @ sizeof(struct SaveBlock2) + .4byte 0x00003d88 @ sizeof(struct SaveBlock1) + .4byte 0x00000234 @ offsetof(struct SaveBlock1, playerPartyCount) + .4byte 0x00000238 @ offsetof(struct SaveBlock1, playerParty) + .4byte 0x00000009 @ offsetof(struct SaveBlock2, specialSaveWarpFlags) + .4byte 0x0000000a @ offsetof(struct SaveBlock2, playerTrainerId) + .4byte 0x00000000 @ offsetof(struct SaveBlock2, playerName) + .4byte 0x00000008 @ offsetof(struct SaveBlock2, playerGender) + .4byte 0x00000ca8 @ offsetof(struct SaveBlock2, frontier.challengeStatus) + .4byte 0x00000ca8 @ offsetof(struct SaveBlock2, frontier.challengeStatus) + .4byte 0x000031c7 @ offsetof(struct SaveBlock1, ? part-way into giftRibbons) + .4byte 0x000031b3 @ offsetof(struct SaveBlock1, ? part-way into giftRibbons) + .4byte 0x00000000 .4byte gBaseStats .4byte gAbilityNames @@ -71,12 +88,19 @@ GPIOPortReadEnable: @ 80000C8 .4byte gBallSpriteSheets .4byte gBallSpritePalettes - .4byte 0x000000a8, 0x00000864, 0x0000089b + .4byte 0x000000a8 @ offsetof(struct SaveBlock2, gcnLinkFlags) + .4byte 0x00000864 @ ? + .4byte 0x0000089b @ ? .byte 0x1e, 0x1e, 0x10, 0x40 - .4byte 0x0000322e, 0x00000498, 0x000031a8, 0x000031f8 - .4byte 0x00000034, 0x00000000, 0x00000000 + .4byte 0x0000322e @ offsetof(struct SaveBlock1, ? part-way into unk_322C) + .4byte 0x00000498 @ offsetof(struct SaveBlock1, pcItems) + .4byte 0x000031a8 @ offsetof(struct SaveBlock1, giftRibbons) + .4byte 0x000031f8 @ offsetof(struct SaveBlock1, enigmaBerry) + .4byte 0x00000034 @ offsetof(struct SaveBlock1, mapView) + .4byte 0x00000000 + .4byte 0x00000000 .arm .align 2, 0