mirror of
https://github.com/pret/pokefirered.git
synced 2024-11-26 23:00:28 +00:00
Start implementing LG and 1.1
This commit is contained in:
parent
7984a91c08
commit
ae881a3623
@ -27,5 +27,8 @@ matrix:
|
||||
script:
|
||||
- make tools CXX=g++-7
|
||||
- make -j2 compare
|
||||
- make -j2 compare_leafgreen
|
||||
- make -j2 compare_firered_rev1
|
||||
- make -j2 compare_leafgreen_rev1
|
||||
after_success:
|
||||
- .travis/calcrom/webhook.sh pokefirered
|
||||
|
53
Makefile
53
Makefile
@ -5,36 +5,7 @@ CPP := $(CC) -E
|
||||
LD := tools/binutils/bin/arm-none-eabi-ld
|
||||
OBJCOPY := tools/binutils/bin/arm-none-eabi-objcopy
|
||||
|
||||
GAME_VERSION := FIRERED
|
||||
REVISION := 0
|
||||
GAME_LANGUAGE := ENGLISH
|
||||
|
||||
# So long as baserom.gba is required, we error out if the
|
||||
# user tries to build any ROM other than FireRed.
|
||||
ifneq ($(GAME_VERSION),FIRERED)
|
||||
$(error We can only build English Pokemon FireRed v1.0 currently)
|
||||
else ifneq ($(REVISION),0)
|
||||
$(error We can only build English Pokemon FireRed v1.0 currently)
|
||||
else ifneq ($(GAME_LANGUAGE),ENGLISH)
|
||||
$(error We can only build English Pokemon FireRed v1.0 currently)
|
||||
endif
|
||||
|
||||
ifeq ($(GAME_VERSION),FIRERED)
|
||||
TITLE := POKEMON FIRE
|
||||
GAME_CODE := BPR
|
||||
BUILD_NAME := firered
|
||||
else
|
||||
TITLE := POKEMON LEAF
|
||||
GAME_CODE := BPL
|
||||
BUILD_NAME := leafgreen
|
||||
endif
|
||||
ifeq ($(GAME_LANGUAGE),ENGLISH)
|
||||
GAME_CODE := $(GAME_CODE)E
|
||||
endif
|
||||
ifneq ($(REVISION),0)
|
||||
BUILD_NAME := $(BUILD_NAME)_rev$(REVISION)
|
||||
endif
|
||||
MAKER_CODE := 01
|
||||
include config.mk
|
||||
|
||||
SHELL := /bin/bash -o pipefail
|
||||
|
||||
@ -57,12 +28,12 @@ DATA_ASM_BUILDDIR = $(OBJ_DIR)/$(DATA_ASM_SUBDIR)
|
||||
SONG_BUILDDIR = $(OBJ_DIR)/$(SONG_SUBDIR)
|
||||
MID_BUILDDIR = $(OBJ_DIR)/$(MID_SUBDIR)
|
||||
|
||||
ASFLAGS := -mcpu=arm7tdmi --defsym $(GAME_VERSION)=1 --defsym REVISION=$(REVISION) --defsym $(GAME_LANGUAGE)=1
|
||||
ASFLAGS := -mcpu=arm7tdmi --defsym $(GAME_VERSION)=1 --defsym REVISION=$(GAME_REVISION) --defsym $(GAME_LANGUAGE)=1
|
||||
|
||||
CC1 := tools/agbcc/bin/agbcc
|
||||
override CFLAGS += -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex-asm
|
||||
|
||||
CPPFLAGS := -I tools/agbcc -I tools/agbcc/include -iquote include -nostdinc -undef -D$(GAME_VERSION) -DREVISION=$(REVISION) -D$(GAME_LANGUAGE)
|
||||
CPPFLAGS := -I tools/agbcc -I tools/agbcc/include -iquote include -nostdinc -undef -D$(GAME_VERSION) -DREVISION=$(GAME_REVISION) -D$(GAME_LANGUAGE)
|
||||
|
||||
LDFLAGS = -Map ../../$(MAP)
|
||||
|
||||
@ -133,7 +104,7 @@ all: tools rom
|
||||
|
||||
rom: $(ROM)
|
||||
ifeq ($(COMPARE),1)
|
||||
@$(SHA1) rom.sha1
|
||||
@$(SHA1) $(BUILD_NAME).sha1
|
||||
endif
|
||||
|
||||
tools: $(TOOLDIRS)
|
||||
@ -219,7 +190,7 @@ $(ASM_BUILDDIR)/%.o: asm_dep = $(shell $(SCANINC) -I . $(ASM_SUBDIR)/$*.s)
|
||||
endif
|
||||
|
||||
$(ASM_BUILDDIR)/%.o: $(ASM_SUBDIR)/%.s $$(asm_dep)
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
$(CPP) $(CPPFLAGS) $< | $(AS) $(ASFLAGS) -o $@
|
||||
|
||||
ifeq ($(NODEP),1)
|
||||
$(DATA_ASM_BUILDDIR)/%.o: data_dep :=
|
||||
@ -233,7 +204,7 @@ berry_fix:
|
||||
berry_fix/berry_fix.gba: berry_fix
|
||||
|
||||
$(DATA_ASM_BUILDDIR)/%.o: $(DATA_ASM_SUBDIR)/%.s $$(data_dep)
|
||||
$(PREPROC) $< charmap.txt | $(CPP) -I include -nostdinc -undef -Wno-unicode - | $(AS) $(ASFLAGS) -o $@
|
||||
$(PREPROC) $< charmap.txt | $(CPP) $(CPPFLAGS) -I include -nostdinc -undef -Wno-unicode - | $(AS) $(ASFLAGS) -o $@
|
||||
|
||||
$(SONG_BUILDDIR)/%.o: $(SONG_SUBDIR)/%.s
|
||||
$(AS) $(ASFLAGS) -I sound -o $@ $<
|
||||
@ -252,8 +223,18 @@ $(OBJ_DIR)/ld_script.ld: ld_script.txt $(OBJ_DIR)/sym_bss.ld $(OBJ_DIR)/sym_comm
|
||||
|
||||
$(ELF): $(OBJ_DIR)/ld_script.ld $(OBJS)
|
||||
cd $(OBJ_DIR) && ../../$(LD) $(LDFLAGS) -T ld_script.ld -o ../../$@ $(LIB)
|
||||
$(FIX) $@ -t"$(TITLE)" -c$(GAME_CODE) -m$(MAKER_CODE) -r$(REVISION) --silent
|
||||
$(FIX) $@ -t"$(TITLE)" -c$(GAME_CODE) -m$(MAKER_CODE) -r$(GAME_REVISION) --silent
|
||||
|
||||
$(ROM): $(ELF)
|
||||
$(OBJCOPY) -O binary --gap-fill 0xFF --pad-to 0x9000000 $< $@
|
||||
|
||||
# "friendly" target names for convenience sake
|
||||
firered: ; @$(MAKE) GAME_VERSION=FIRERED
|
||||
firered_rev1: ; @$(MAKE) GAME_VERSION=FIRERED GAME_REVISION=1
|
||||
leafgreen: ; @$(MAKE) GAME_VERSION=LEAFGREEN
|
||||
leafgreen_rev1: ; @$(MAKE) GAME_VERSION=LEAFGREEN GAME_REVISION=1
|
||||
|
||||
compare_firered: ; @$(MAKE) GAME_VERSION=FIRERED COMPARE=1
|
||||
compare_firered_rev1: ; @$(MAKE) GAME_VERSION=FIRERED GAME_REVISION=1 COMPARE=1
|
||||
compare_leafgreen: ; @$(MAKE) GAME_VERSION=LEAFGREEN COMPARE=1
|
||||
compare_leafgreen_rev1: ; @$(MAKE) GAME_VERSION=LEAFGREEN GAME_REVISION=1 COMPARE=1
|
||||
|
63
asm/crt0.s
63
asm/crt0.s
@ -46,6 +46,7 @@ GPIOPortReadEnable: @ 80000C8
|
||||
.4byte 0xFFFFFFFF
|
||||
.4byte 0xFFFFFFFF
|
||||
.4byte 0xFFFFFFFF
|
||||
#if defined(FIRERED)
|
||||
.4byte 4
|
||||
.4byte 2
|
||||
.ascii "pokemon red version"
|
||||
@ -106,6 +107,68 @@ GPIOPortReadEnable: @ 80000C8
|
||||
.4byte 0x34 @ size of SaveBlock1 map header reconstruction data?
|
||||
.4byte 0
|
||||
.4byte 0xFFFFFFFF
|
||||
#elif defined(LEAFGREEN)
|
||||
.4byte 5
|
||||
.4byte 2
|
||||
.ascii "pokemon green version"
|
||||
.space 11
|
||||
.4byte 0x8235088 @ gMonFrontPicTable
|
||||
.4byte 0x8236528 @ gMonBackPicTable
|
||||
.4byte 0x82372E8 @ gMonPaletteTable
|
||||
.4byte 0x82380A8 @ gMonShinyPaletteTable
|
||||
.4byte 0x83D35DC @ gMonIconTable
|
||||
.4byte 0x83D3CBC @ gMonIconPaletteIndices
|
||||
.4byte 0x83D3E74 @ gMonIconPaletteTable
|
||||
.4byte 0x8245EBC @ gSpeciesNames
|
||||
.4byte 0x8247070 @ gMoveNames
|
||||
.4byte 0x8455118 @ gDecorations
|
||||
.4byte 0xEE0 @ offsetof(struct SaveBlock1, flags)
|
||||
.4byte 0x1000 @ offsetof(struct SaveBlock1, vars)
|
||||
.4byte 0x18 @ offsetof(struct SaveBlock2, pokedex)
|
||||
.4byte 0x5F8 @ offsetof(struct SaveBlock1, seen1)
|
||||
.4byte 0x3A18 @ offsetof(struct SaveBlock1, seen2)
|
||||
.4byte 0x3C
|
||||
.4byte 0x838
|
||||
.4byte 0x839
|
||||
.4byte 0x182
|
||||
.4byte 0xA0A0A07
|
||||
.4byte 0xC060C0C
|
||||
.4byte 0xC121006
|
||||
.4byte 0x8010B0F
|
||||
.4byte 0xC
|
||||
.4byte 0xF24 @ sizeof(struct SaveBlock2)
|
||||
.4byte 0x3D68 @ sizeof(struct SaveBlock1)
|
||||
.4byte 0x34 @ offsetof(struct SaveBlock1, playerPartyCount)
|
||||
.4byte 0x38 @ offsetof(struct SaveBlock1, playerParty)
|
||||
.4byte 9 @ offsetof(struct SaveBlock2, specialSaveWarp)
|
||||
.4byte 0xA @ offsetof(struct SaveBlock2, playerTrainerId)
|
||||
.4byte 0 @ offsetof(struct SaveBlock2, playerName)
|
||||
.4byte 8 @ offsetof(struct SaveBlock2, playerGender)
|
||||
|
||||
.4byte 0xAD @ offsetof(struct SaveBlock2, ?????? (0xAD))
|
||||
.4byte 0xAD @ offsetof(struct SaveBlock2, ?????? (0xAD))
|
||||
.4byte 0x30BB
|
||||
.4byte 0x30A7
|
||||
.4byte 0
|
||||
.4byte 0x8254760 @ gBaseStats
|
||||
.4byte 0x824FC1C @ gAbilityNames
|
||||
.4byte 0x824FAE4 @ gAbilityDescriptionPointers
|
||||
.4byte 0x83DAE64 @ gItems
|
||||
.4byte 0x8250BE0 @ gBattleMoves
|
||||
.4byte 0x826054C @ gBallSpriteSheets
|
||||
.4byte 0x82605AC @ gBallSpritePalettes
|
||||
.4byte 0xA8
|
||||
.4byte 0x82C
|
||||
.4byte 0x83B
|
||||
.4byte 0x3A0D1E2A
|
||||
.4byte 0x1E2B
|
||||
.4byte 0x298 @ offsetof(struct SaveBlock1, pcItems) // maybe all items were in a struct together?
|
||||
.4byte 0x309C @ offsetof(struct SaveBlock1, giftRibbons)
|
||||
.4byte 0x30EC @ offsetof(struct SaveBlock1, enigmaBerry)
|
||||
.4byte 0x34 @ size of SaveBlock1 map header reconstruction data?
|
||||
.4byte 0
|
||||
.4byte 0xFFFFFFFF
|
||||
#endif
|
||||
|
||||
.arm
|
||||
.align 2, 0
|
||||
|
26
asmdiff.sh
26
asmdiff.sh
@ -1,7 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$1" == "firered" ] || [ "$1" == "leafgreen" ] || [ "$1" == "firered_rev1" ] || [ "$1" == "leafgreen_rev1" ]; then
|
||||
buildname="$1"
|
||||
shift
|
||||
else
|
||||
buildname=firered
|
||||
fi
|
||||
|
||||
if [ "$buildname" == "firered" ]; then
|
||||
baserom=baserom
|
||||
elif [ "$buildname" == "leafgreen" ]; then
|
||||
baserom=baserom_lg
|
||||
elif [ "$buildname" == "firered_rev1" ]; then
|
||||
baserom=baserom_fr_rev1
|
||||
elif [ "$buildname" == "leafgreen_rev1" ]; then
|
||||
baserom=baserom_lg_rev1
|
||||
else
|
||||
echo unknown buildname $buildname
|
||||
exit 1
|
||||
fi
|
||||
|
||||
OBJDUMP="$DEVKITARM/bin/arm-none-eabi-objdump -D -bbinary -marmv4t -Mforce-thumb"
|
||||
OPTIONS="--start-address=$(($1)) --stop-address=$(($1 + $2))"
|
||||
$OBJDUMP $OPTIONS baserom.gba > baserom.dump
|
||||
$OBJDUMP $OPTIONS pokefirered.gba > pokefirered.dump
|
||||
diff -u baserom.dump pokefirered.dump
|
||||
$OBJDUMP $OPTIONS ${baserom}.gba > ${baserom}.dump || exit 1
|
||||
$OBJDUMP $OPTIONS poke${buildname}.gba > poke${buildname}.dump
|
||||
diff -u ${baserom}.dump poke${buildname}.dump
|
||||
|
51
config.mk
Normal file
51
config.mk
Normal file
@ -0,0 +1,51 @@
|
||||
# Default variables
|
||||
|
||||
GAME_VERSION ?= FIRERED
|
||||
GAME_REVISION ?= 0
|
||||
GAME_LANGUAGE ?= ENGLISH
|
||||
MODERN ?= 0
|
||||
COMPARE ?= 0
|
||||
|
||||
# For gbafix
|
||||
MAKER_CODE := 01
|
||||
|
||||
# Version
|
||||
ifeq ($(GAME_VERSION),FIRERED)
|
||||
TITLE := POKEMON FIRE
|
||||
GAME_CODE := BPR
|
||||
BUILD_NAME := firered
|
||||
else
|
||||
ifeq ($(GAME_VERSION),LEAFGREEN)
|
||||
TITLE := POKEMON LEAF
|
||||
GAME_CODE := BPG
|
||||
BUILD_NAME := leafgreen
|
||||
else
|
||||
$(error unknown version $(GAME_VERSION))
|
||||
endif
|
||||
endif
|
||||
|
||||
# Revision
|
||||
ifeq ($(GAME_REVISION),0)
|
||||
BUILD_NAME := $(BUILD_NAME)
|
||||
else
|
||||
ifeq ($(GAME_REVISION),1)
|
||||
BUILD_NAME := $(BUILD_NAME)_rev1
|
||||
else
|
||||
$(error unknown revision $(GAME_REVISION))
|
||||
endif
|
||||
endif
|
||||
|
||||
# Language
|
||||
ifeq ($(GAME_LANGUAGE),ENGLISH)
|
||||
BUILD_NAME := $(BUILD_NAME)
|
||||
GAME_CODE := $(GAME_CODE)E
|
||||
else
|
||||
$(error unknown language $(GAME_LANGUAGE))
|
||||
endif
|
||||
|
||||
# Modern GCC
|
||||
ifeq ($(MODERN), 0)
|
||||
BUILD_NAME := $(BUILD_NAME)
|
||||
else
|
||||
BUILD_NAME := $(BUILD_NAME)_modern
|
||||
endif
|
1
firered_rev1.sha1
Normal file
1
firered_rev1.sha1
Normal file
@ -0,0 +1 @@
|
||||
dd5945db9b930750cb39d00c84da8571feebf417 pokefirered_rev1.gba
|
1
leafgreen.sha1
Normal file
1
leafgreen.sha1
Normal file
@ -0,0 +1 @@
|
||||
574fa542ffebb14be69902d1d36f1ec0a4afd71e pokeleafgreen.gba
|
1
leafgreen_rev1.sha1
Normal file
1
leafgreen_rev1.sha1
Normal file
@ -0,0 +1 @@
|
||||
7862c67bdecbe21d1d69ce082ce34327e1c6ed5e pokeleafgreen_rev1.gba
|
@ -57,8 +57,10 @@ static void IntrDummy(void);
|
||||
|
||||
#if defined(FIRERED)
|
||||
#define GAME_VERSION VERSION_FIRE_RED
|
||||
#elif defined(LEAF_GREEN)
|
||||
#elif defined(LEAFGREEN)
|
||||
#define GAME_VERSION VERSION_LEAF_GREEN
|
||||
#else
|
||||
#error unknown version
|
||||
#endif
|
||||
const u8 gGameVersion = GAME_VERSION;
|
||||
|
||||
|
@ -60,6 +60,7 @@ static void UpdateScanlineEffectRegBuffer(s16 a0);
|
||||
static void ScheduleStopScanlineEffect(void);
|
||||
static void LoadMainTitleScreenPalsAndResetBgs(void);
|
||||
static void CB2_FadeOutTransitionToSaveClearScreen(void);
|
||||
static void SpriteCallback_TitleScreenFlameOrLeaf(struct Sprite * sprite);
|
||||
static void CB2_FadeOutTransitionToBerryFix(void);
|
||||
static void LoadSpriteGfxAndPals(void);
|
||||
static void Task_FlameOrLeafSpawner(u8 taskId);
|
||||
@ -238,6 +239,12 @@ static const u8 gUnknown_83BFBD4[] = {
|
||||
0x04, 0x10, 0x1a, 0x20, 0x30, 0xc8, 0xd8, 0xe0, 0xe8, 0x3c, 0x4c, 0x5c, 0x6c, 0x80, 0x90
|
||||
};
|
||||
|
||||
#if defined(LEAFGREEN)
|
||||
static const u16 gUnknown_LG_83BFA10[] = {
|
||||
50, 80, 110, 60, 90, 70, 100, 50
|
||||
};
|
||||
#endif
|
||||
|
||||
void CB2_InitTitleScreen(void)
|
||||
{
|
||||
switch (gMain.state)
|
||||
@ -876,6 +883,7 @@ static void SpriteCallback_TitleScreenFlameOrLeaf(struct Sprite * sprite)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(FIRERED)
|
||||
static bool32 CreateFlameOrLeafSprite(s32 x, s32 y, s32 xspeed, s32 yspeed, bool32 templateId)
|
||||
{
|
||||
u8 spriteId;
|
||||
@ -901,6 +909,35 @@ static bool32 CreateFlameOrLeafSprite(s32 x, s32 y, s32 xspeed, s32 yspeed, bool
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
#elif defined(LEAFGREEN)
|
||||
void _CreateFlameOrLeafSprite(s32 y0, s32 x1, s32 y1)
|
||||
{
|
||||
u8 spriteId = CreateSprite(&sSpriteTemplate_FlameOrLeaf_State0, 0xF0, y0, 0);
|
||||
if (spriteId != MAX_SPRITES)
|
||||
{
|
||||
gSprites[spriteId].data[0] = 0xF00;
|
||||
gSprites[spriteId].data[1] = x1;
|
||||
gSprites[spriteId].data[2] = y0 << 4;
|
||||
gSprites[spriteId].data[3] = y1;
|
||||
gSprites[spriteId].callback = SpriteCallback_TitleScreenFlameOrLeaf;
|
||||
}
|
||||
}
|
||||
|
||||
void SpriteCallback_LG_8079800(struct Sprite * sprite)
|
||||
{
|
||||
sprite->pos1.x -= 7;
|
||||
if (sprite->pos1.x < -16)
|
||||
{
|
||||
sprite->pos1.x = 0x100;
|
||||
sprite->data[7]++;
|
||||
if (sprite->data[7] >= NELEMS(gUnknown_LG_83BFA10))
|
||||
sprite->data[7] = 0;
|
||||
sprite->pos1.y = gUnknown_LG_83BFA10[sprite->data[7]];
|
||||
}
|
||||
}
|
||||
|
||||
#define CreateFlameOrLeafSprite ((bool32 (*)())_CreateFlameOrLeafSprite)
|
||||
#endif //FRLG
|
||||
|
||||
static void Task_FlameOrLeafSpawner(u8 taskId)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user