diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2ad6d8123..3e633b442 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -90,6 +90,11 @@ jobs: echo "REPORTS_COMMIT_MSG=$( git log --format=%s ${GITHUB_SHA} )" >> $GITHUB_ENV cp sa2.map gh-pages/maps/${GITHUB_SHA}.map + #- name: Japan + #run: | + #make clean + #make japan -j${nproc} + - name: Europe run: | make clean diff --git a/.gitignore b/.gitignore index 29716c828..31f9e0fa8 100644 --- a/.gitignore +++ b/.gitignore @@ -49,6 +49,7 @@ Temporary Items # ========================= # Build Outputs # ========================= + *.gba *.sav *.elf @@ -56,6 +57,7 @@ Temporary Items *.bin *.a + *.hex *.o *.dump @@ -73,4 +75,6 @@ reports *.4bpp *.8bpp -!data/maps/*/*/tilemaps/*/*.bin \ No newline at end of file + +!data/maps/*/*/tilemaps/*/*.bin +*.exe \ No newline at end of file diff --git a/Makefile b/Makefile index a0ef6e23a..bb2b1dadc 100644 --- a/Makefile +++ b/Makefile @@ -193,6 +193,7 @@ clean-tools: tidy: $(RM) -f $(ROM) $(ELF) $(MAP) $(RM) -f $(BUILD_NAME)_europe.gba $(BUILD_NAME)_europe.elf $(BUILD_NAME)_europe.map + $(RM) -f $(BUILD_NAME)_japan.gba $(BUILD_NAME)_japan.elf $(BUILD_NAME)_japan.map $(RM) -r build/* #### Recipes #### @@ -285,6 +286,8 @@ $(SONG_BUILDDIR)/%.o: $(SONG_SUBDIR)/%.s @$(AS) $(ASFLAGS) -I sound -o $@ $< +japan: ; @$(MAKE) GAME_REGION=JAPAN + europe: ; @$(MAKE) GAME_REGION=EUROPE chao_garden/mb_chao_garden.gba: diff --git a/README.md b/README.md index 6b6c035db..3904a2775 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ This is a work in progress matching decompilation of Sonic Advance 2 It so far builds the following ROMs: * [**sa2.gba**](https://datomatic.no-intro.org/index.php?page=show_record&s=23&n=0890) `sha1: 7bcd6a07af7c894746fa28073fe0c0e34408022d` (USA) (En,Ja,Fr,De,Es,It) * [**sa2_europe.gba**](https://datomatic.no-intro.org/index.php?page=show_record&s=23&n=0900) `sha1: b0f64bdca097f2de8f05ac4c8caea2b80c5faeb1` (Europe) (En,Ja,Fr,De,Es,It) +* [**sa2_japan.gba**](https://datomatic.no-intro.org/index.php?page=show_record&s=23&n=0799) `sha1: dffd0188fc78154b42b401398a224ae0713edf23` (Japan) (En,Ja,Fr,De,Es,It) (:warning: Work in Progress) ### Current state diff --git a/config.mk b/config.mk index 33aec288a..414cec642 100644 --- a/config.mk +++ b/config.mk @@ -27,6 +27,11 @@ ifeq ($(GAME_REGION), USA) BUILD_NAME := $(BUILD_NAME) GAME_CODE := $(GAME_CODE)E else +ifeq ($(GAME_REGION), JAPAN) + BUILD_NAME := $(BUILD_NAME)_japan + GAME_CODE := $(GAME_CODE)J + MAKER_CODE := 8P +else ifeq ($(GAME_REGION), EUROPE) BUILD_NAME := $(BUILD_NAME)_europe GAME_CODE := $(GAME_CODE)P @@ -36,6 +41,7 @@ else $(error unknown region $(GAME_REGION)) endif endif +endif # Debug ifeq ($(DEBUG), 1) diff --git a/graphics/obj_tiles_4bpp.inc b/graphics/obj_tiles_4bpp.inc index df339c8f2..502ecbfb9 100644 --- a/graphics/obj_tiles_4bpp.inc +++ b/graphics/obj_tiles_4bpp.inc @@ -7264,7 +7264,7 @@ .incbin "graphics/obj_tiles/4bpp/anim_1117/f027.4bpp" .incbin "graphics/obj_tiles/4bpp/anim_1117/f028.4bpp" -#ifdef EUROPE +#ifndef USA .incbin "graphics/obj_tiles/4bpp/anim_1117_europe/f029.4bpp" .incbin "graphics/obj_tiles/4bpp/anim_1117_europe/f030.4bpp" .incbin "graphics/obj_tiles/4bpp/anim_1117_europe/f031.4bpp" diff --git a/multi_boot/collect_rings/config.mk b/multi_boot/collect_rings/config.mk index 4a6ded81a..52f6935fd 100644 --- a/multi_boot/collect_rings/config.mk +++ b/multi_boot/collect_rings/config.mk @@ -30,10 +30,15 @@ else ifeq ($(GAME_REGION), EUROPE) BUILD_NAME := $(BUILD_NAME)_europe GAME_CODE := $(GAME_CODE)P +else +ifeq ($(GAME_REGION), JAPAN) + BUILD_NAME := $(BUILD_NAME)_japan + GAME_CODE := $(GAME_CODE)J else $(error unknown region $(GAME_REGION)) endif endif +endif # Debug ifeq ($(DEBUG), 1) diff --git a/multi_boot/programs/subgame_loader/config.mk b/multi_boot/programs/subgame_loader/config.mk index 35e87d63e..046768e12 100644 --- a/multi_boot/programs/subgame_loader/config.mk +++ b/multi_boot/programs/subgame_loader/config.mk @@ -30,10 +30,15 @@ else ifeq ($(GAME_REGION), EUROPE) BUILD_NAME := $(BUILD_NAME)_europe GAME_CODE := $(GAME_CODE)P +else +ifeq ($(GAME_REGION), JAPAN) + BUILD_NAME := $(BUILD_NAME)_japan + GAME_CODE := $(GAME_CODE)J else $(error unknown region $(GAME_REGION)) endif endif +endif # Debug ifeq ($(DEBUG), 1) diff --git a/multi_boot/programs/subgame_loader/src/main.c b/multi_boot/programs/subgame_loader/src/main.c index f35d4353f..4edd3fcf8 100644 --- a/multi_boot/programs/subgame_loader/src/main.c +++ b/multi_boot/programs/subgame_loader/src/main.c @@ -56,12 +56,15 @@ static void sub_0203b798(void); // 8P #define DIMPS_MAKER_CODE 0x96 -#ifndef EUROPE +#ifdef USA // "A2NE" #define EXPECTED_GAME_CODE 0x454e3241 -#else +#elif EUROPE // "A2NP" #define EXPECTED_GAME_CODE 0x504e3241 +#else +// "A2NJ" +#define EXPECTED_GAME_CODE 0x4a4e3241 #endif // .rodata diff --git a/multi_boot/roms/collect_rings/config.mk b/multi_boot/roms/collect_rings/config.mk index a0088fae1..78c8aaba6 100644 --- a/multi_boot/roms/collect_rings/config.mk +++ b/multi_boot/roms/collect_rings/config.mk @@ -30,10 +30,15 @@ else ifeq ($(GAME_REGION), EUROPE) BUILD_NAME := $(BUILD_NAME)_europe GAME_CODE := $(GAME_CODE)P +else +ifeq ($(GAME_REGION), JAPAN) + BUILD_NAME := $(BUILD_NAME)_japan + GAME_CODE := $(GAME_CODE)J else $(error unknown region $(GAME_REGION)) endif endif +endif # Debug ifeq ($(DEBUG), 1) diff --git a/multi_boot/roms/subgame_loader/config.mk b/multi_boot/roms/subgame_loader/config.mk index 35e87d63e..046768e12 100644 --- a/multi_boot/roms/subgame_loader/config.mk +++ b/multi_boot/roms/subgame_loader/config.mk @@ -30,10 +30,15 @@ else ifeq ($(GAME_REGION), EUROPE) BUILD_NAME := $(BUILD_NAME)_europe GAME_CODE := $(GAME_CODE)P +else +ifeq ($(GAME_REGION), JAPAN) + BUILD_NAME := $(BUILD_NAME)_japan + GAME_CODE := $(GAME_CODE)J else $(error unknown region $(GAME_REGION)) endif endif +endif # Debug ifeq ($(DEBUG), 1) diff --git a/multi_boot/subgame_bootstrap/config.mk b/multi_boot/subgame_bootstrap/config.mk index 00ba5e6c1..f224e2646 100644 --- a/multi_boot/subgame_bootstrap/config.mk +++ b/multi_boot/subgame_bootstrap/config.mk @@ -30,10 +30,15 @@ else ifeq ($(GAME_REGION), EUROPE) BUILD_NAME := $(BUILD_NAME)_europe GAME_CODE := $(GAME_CODE)P +else +ifeq ($(GAME_REGION), JAPAN) + BUILD_NAME := $(BUILD_NAME)_japan + GAME_CODE := $(GAME_CODE)J else $(error unknown region $(GAME_REGION)) endif endif +endif # Debug ifeq ($(DEBUG), 1) diff --git a/sa2_japan.sha1 b/sa2_japan.sha1 new file mode 100644 index 000000000..1e524174e --- /dev/null +++ b/sa2_japan.sha1 @@ -0,0 +1 @@ +dffd0188fc78154b42b401398a224ae0713edf23 sa2_japan.gba diff --git a/src/game/stage/results.c b/src/game/stage/results.c index c30dae8d6..ca58b0eaf 100644 --- a/src/game/stage/results.c +++ b/src/game/stage/results.c @@ -165,7 +165,7 @@ u16 CreateStageResults(u32 courseTime, u16 ringCount, u8 spRingCount) s = &outro->s7; s->x = DISPLAY_WIDTH + 16; - s->y = 80; + s->y = (DISPLAY_HEIGHT / 2); s->graphics.dest = VramMalloc(4); s->graphics.anim = SA2_ANIM_TA_WHITE_BAR; s->variant = 0; diff --git a/src/game/time_attack/results.c b/src/game/time_attack/results.c index 8ec0460ad..7591ecc6c 100644 --- a/src/game/time_attack/results.c +++ b/src/game/time_attack/results.c @@ -64,7 +64,7 @@ u32 CreateTimeAttackResults(u32 finishTime) fade->window = 0; fade->flags = 1; - fade->speed = 0x100; + fade->speed = Q_8_8(1); fade->brightness = Q_8_8(0); fade->bldCnt = 0x3FFF; fade->bldAlpha = 0; @@ -125,7 +125,7 @@ u32 CreateTimeAttackResults(u32 finishTime) resultsCutScene->unk2D8 = sub_80899B8(finishTime); s = &resultsCutScene->unk12C; - s->x = 256; + s->x = DISPLAY_WIDTH + 16; s->y = (DISPLAY_HEIGHT / 2); s->graphics.dest = VramMalloc(4); s->graphics.anim = SA2_ANIM_TA_WHITE_BAR; @@ -142,7 +142,7 @@ u32 CreateTimeAttackResults(u32 finishTime) UpdateSpriteAnimation(s); s = &resultsCutScene->unkC[0]; - s->x = 256; + s->x = DISPLAY_WIDTH + 16; s->y = 41; s->graphics.dest = VramMalloc(sAnimsGotThroughCharacterNames[gSelectedCharacter][0]); s->graphics.anim = sAnimsGotThroughCharacterNames[gSelectedCharacter][1]; @@ -161,7 +161,7 @@ u32 CreateTimeAttackResults(u32 finishTime) isBossLevel = ACT_INDEX(gCurrentLevel) >> 1; s = &resultsCutScene->unkC[1]; - s->x = 256; + s->x = DISPLAY_WIDTH + 16; s->y = 49; s->graphics.dest = VramMalloc(sStageResultsHeadlineTexts[isBossLevel][0]); s->graphics.anim = sStageResultsHeadlineTexts[isBossLevel][1]; @@ -219,7 +219,7 @@ u32 CreateTimeAttackResults(u32 finishTime) s = &resultsCutScene->unk9C[1]; s->x = (DISPLAY_WIDTH / 2); - s->y = (DISPLAY_HEIGHT * (3. / 4.)); + s->y = (DISPLAY_HEIGHT / 2) + 40; s->graphics.dest = VramMalloc(16); s->graphics.anim = SA2_ANIM_TIME_ATTACK_DIGITS; if (resultsCutScene->unk2D8 != 0) { @@ -288,27 +288,27 @@ void sub_80897E8(void) u32 unk168 = resultsCutScene->unk168; u32 i; - if (unk168 < 0x18) { + if (unk168 < 24) { s32 temp; s = &resultsCutScene->unk12C; temp = 0; - if (unk168 < 0x11) { - temp = (0x10 - unk168) * 0x18; + if (unk168 < 17) { + temp = ((16 - unk168) * 24); } for (i = 0; i < 8; i++) { - s->x = temp + i * 0x20; + s->x = temp + (i * 32); DisplaySprite(s); } } else { s = &resultsCutScene->unk12C; for (i = 0; i < 8; i++) { - s->x = i << 5; // TODO: Does (i * 32) match? + s->x = (i * 32); // TODO: Does (i * 32) match? DisplaySprite(s); } } - if (unk168 > 0x1C) { + if (unk168 > 28) { s32 temp; if ((gCurrentLevel & ACT_BOSS) && !(gCurrentLevel & ACT_2)) { temp = 2; @@ -322,17 +322,17 @@ void sub_80897E8(void) } } - if (unk168 > 0x59) { + if (unk168 > 89) { s = &resultsCutScene->unk9C[0]; - if ((unk168 - 0x5A) < 0xB) { - s->x = (100 - unk168) * 16 + 40; + if ((unk168 - 90) < 11) { + s->x = (((DISPLAY_WIDTH / 2) - 20) - unk168) * 16 + 40; } DisplaySprite(s); } - if (unk168 > 0x77) { - s32 temp = (unk168 - 0x7F); - if (temp > 0x10) { + if (unk168 > 119) { + s32 temp = (unk168 - 127); + if (temp > 16) { if (resultsCutScene->unk2D8) { s = &resultsCutScene->unk9C[1]; resultsCutScene->transform.width @@ -361,7 +361,7 @@ void sub_80897E8(void) } for (i = 0; i < 7; i++) { - s32 index = (unk168 - 0x78) - i; + s32 index = (unk168 - 120) - i; if (index < 0) { break; } @@ -421,7 +421,7 @@ void sub_8089AEC(void) sub_8031314(); sub_80897E8(); - if (((unk168 > 0xA0) && (gPressedKeys & (A_BUTTON | START_BUTTON))) + if (((unk168 > 160) && (gPressedKeys & (A_BUTTON | START_BUTTON))) || (unk168 > 600)) { gCurTask->main = sub_8089B40; }