Skip to content

Commit

Permalink
Initial code required to build Japanese ROM (#135)
Browse files Browse the repository at this point in the history
* Update UI Positions of Timer/1-Up
* Update results.c
  • Loading branch information
BlueSpeedsterYT authored Apr 19, 2024
1 parent 86d632c commit 0e92bf9
Show file tree
Hide file tree
Showing 15 changed files with 72 additions and 24 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,15 @@ Temporary Items
# =========================
# Build Outputs
# =========================

*.gba
*.sav
*.elf
*.map
*.bin

*.a

*.hex
*.o
*.dump
Expand All @@ -73,4 +75,6 @@ reports
*.4bpp
*.8bpp

!data/maps/*/*/tilemaps/*/*.bin

!data/maps/*/*/tilemaps/*/*.bin
*.exe
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 ####
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -36,6 +41,7 @@ else
$(error unknown region $(GAME_REGION))
endif
endif
endif

# Debug
ifeq ($(DEBUG), 1)
Expand Down
2 changes: 1 addition & 1 deletion graphics/obj_tiles_4bpp.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions multi_boot/collect_rings/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions multi_boot/programs/subgame_loader/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 5 additions & 2 deletions multi_boot/programs/subgame_loader/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions multi_boot/roms/collect_rings/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions multi_boot/roms/subgame_loader/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions multi_boot/subgame_bootstrap/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions sa2_japan.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dffd0188fc78154b42b401398a224ae0713edf23 sa2_japan.gba
2 changes: 1 addition & 1 deletion src/game/stage/results.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
38 changes: 19 additions & 19 deletions src/game/time_attack/results.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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];
Expand All @@ -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];
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 0e92bf9

Please sign in to comment.