Link chozodia_escape.c

This commit is contained in:
YohannDR 2023-05-31 09:59:17 +02:00
parent 8b89f523b1
commit 3518008d93
15 changed files with 3849 additions and 6597 deletions

View File

@ -4,7 +4,7 @@ This is a work in progress decompilation of Metroid - Zero Mission.
2595/2721 functions decompiled (95.37%, 126 left)
0x35075f/0x76b014 bytes of data not in blobs (44.68%, 0x41a8b5 left)
0x350773/0x76b014 bytes of data not in blobs (44.68%, 0x41a8a1 left)
Progress can be seen here : https://docs.google.com/spreadsheets/d/1X8XarD5evY8ZI7r_GQqh1pYmdVMbBcINYfRBUlogmKY/edit#gid=0

View File

@ -9588,7 +9588,7 @@ lbl_08011756:
thumb_func_start SpriteUtilGetFinalCompletionPercentage
SpriteUtilGetFinalCompletionPercentage: @ 0x0801175c
push {r4, r5, lr}
bl ChozodiaEscapeGetPercentAndEndingNumber
bl ChozodiaEscapeGetItemCountAndEndingNumber
lsrs r1, r0, #0x18
lsrs r4, r0, #0x10
lsls r4, r4, #0x18

View File

@ -10346,8 +10346,8 @@ lbl_080732f4:
.align 2, 0
lbl_080732fc: .4byte gLanguage
thumb_func_start sub_08073300
sub_08073300: @ 0x08073300
thumb_func_start SramWrite_FileScreenOptionsUnlocked
SramWrite_FileScreenOptionsUnlocked: @ 0x08073300
push {r4, r5, r6, lr}
ldr r2, lbl_08073388 @ =0x08754bc8
ldr r4, [r2]
@ -10561,7 +10561,7 @@ lbl_080734b8:
movs r0, #3
movs r3, #0xc
bl DMATransfer
bl sub_08073300
bl SramWrite_FileScreenOptionsUnlocked
lbl_080734d0:
add sp, #8
pop {r3, r4}

View File

@ -7419,7 +7419,7 @@ lbl_0807bd44: @ jump table
.4byte lbl_0807bd70 @ case 3
.4byte lbl_0807bd7a @ case 4
lbl_0807bd58:
bl sub_08073300
bl SramWrite_FileScreenOptionsUnlocked
ldr r2, lbl_0807bd6c @ =sNonGameplayRamPointer
ldr r0, [r2]
adds r0, #0x40

View File

@ -405,8 +405,8 @@ lbl_0807f3f2:
bx r1
.align 2, 0
thumb_func_start sub_0807f3fc
sub_0807f3fc: @ 0x0807f3fc
thumb_func_start CheckUnlockTimeAttack
CheckUnlockTimeAttack: @ 0x0807f3fc
push {r4, r5, r6, r7, lr}
mov r7, sb
mov r6, r8
@ -426,7 +426,7 @@ lbl_0807f414:
bne lbl_0807f420
b lbl_0807f5f4
lbl_0807f420:
bl ChozodiaEscapeGetPercentAndEndingNumber
bl ChozodiaEscapeGetItemCountAndEndingNumber
adds r3, r0, #0
movs r0, #0xff
lsrs r1, r3, #0x18
@ -1334,8 +1334,8 @@ lbl_0807fae4:
.align 2, 0
lbl_0807fb44: .4byte 0x08760c68
thumb_func_start check_set_new_time_attack_record
check_set_new_time_attack_record: @ 0x0807fb48
thumb_func_start TimeAttackCheckSetNewRecord
TimeAttackCheckSetNewRecord: @ 0x0807fb48
push {r4, r5, r6, r7, lr}
mov r7, sl
mov r6, sb
@ -1374,7 +1374,7 @@ check_set_new_time_attack_record: @ 0x0807fb48
ldrb r0, [r0]
lsls r0, r0, #8
adds r5, r1, r0
bl ChozodiaEscapeGetPercentAndEndingNumber
bl ChozodiaEscapeGetItemCountAndEndingNumber
movs r1, #0xff
lsrs r2, r0, #0x18
mov sl, r2

File diff suppressed because it is too large Load Diff

3792
asm/disasm_0x08088ea0.s Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2685,4 +2685,5 @@ Blob_754bd0_75e6a8.bin;39640;0x754bd0;1
Blob_75fae4_75fd78.bin;660;0x75fae4;1
Blob_7602d4_760420.bin;332;0x7602d4;1
Blob_760458_760aa0.bin;1608;0x760458;1
Blob_760b18_7f7734.bin;617500;0x760b18;1
Blob_760b18_760d14.bin;508;0x760b18;1
Blob_760d38_7f7734.bin;616956;0x760d38;1

View File

@ -545,6 +545,8 @@ SECTIONS {
asm/disasm_0x0808117c.o(.text);
src/fusion_gallery.o(.text);
asm/disasm_0x08084c34.o(.text);
src/chozodia_escape.o(.text);
asm/disasm_0x08088ea0.o(.text);
asm/libgcc.o(.text);
asm/disasm_0x0808af18.o(.text);
@ -724,6 +726,8 @@ SECTIONS {
/* 760458-760aa0 */
src/data/menus/internal_title_screen_data.o(.rodata)
src/data/menus/internal_game_over_data.o(.rodata)
/* 760b18-7f7734 */
/* 760b18-760d14 */
src/data/internal_chozodia_escape_data.o(.rodata)
/* 760d28-7f7734 */
} >rom
}

View File

@ -760,19 +760,23 @@ u8 ChozodiaEscapeShipBlowingUp(void)
break;
case 1:
LZ77UncompVRAM(sMotherShipExplodingFlashGfx, VRAM_BASE + 0x8000);
LZ77UncompVRAM(0x847d014, VRAM_BASE + 0x8000);
// FIXME LZ77UncompVRAM(sMotherShipExplodingFlashGfx, VRAM_BASE + 0x8000);
break;
case 2:
LZ77UncompVRAM(sMotherShipBlowingUpExplosionsGfx, VRAM_BASE + 0x10000);
LZ77UncompVRAM(0x8480148, VRAM_BASE + 0x10000);
// FIXME LZ77UncompVRAM(sMotherShipBlowingUpExplosionsGfx, VRAM_BASE + 0x10000);
break;
case 3:
LZ77UncompVRAM(sChozodiaEscapeCraterBackgroundTileTable, VRAM_BASE + 0xE800);
LZ77UncompVRAM(sMotherShipExplodingFlashTileTable, VRAM_BASE + 0xF000);
LZ77UncompVRAM(0x847f884, VRAM_BASE + 0xF000);
// FIXME LZ77UncompVRAM(sMotherShipExplodingFlashTileTable, VRAM_BASE + 0xF000);
dma_set(3, sChozodiaEscapeShipExplodingPAL, PALRAM_BASE, DMA_ENABLE << 16 | ARRAY_SIZE(sChozodiaEscapeShipExplodingPAL) - 16 * 2);
dma_set(3, sMotherShipBlowingUpExplosionsPal, PALRAM_OBJ, DMA_ENABLE << 16 | ARRAY_SIZE(sMotherShipBlowingUpExplosionsPal));
dma_set(3, 0x8479520, PALRAM_OBJ, DMA_ENABLE << 16 | ARRAY_SIZE(sMotherShipBlowingUpExplosionsPal));
// FIXME dma_set(3, sMotherShipBlowingUpExplosionsPal, PALRAM_OBJ, DMA_ENABLE << 16 | ARRAY_SIZE(sMotherShipBlowingUpExplosionsPal));
write16(REG_BG0CNT, 0x1E08);
write16(REG_BG1CNT, 0x1D01);
@ -1200,7 +1204,7 @@ u32 ChozodiaEscapeSubroutine(void)
// Reset info
CHOZODIA_ESCAPE_DATA.stage++;
CHOZODIA_ESCAPE_DATA.unk_1 = 0;
CHOZODIA_ESCAPE_DATA.unk_1 = 0;
CHOZODIA_ESCAPE_DATA.unk_2 = 0;
CHOZODIA_ESCAPE_DATA.timer = 0;
// Reset OAM info

View File

@ -0,0 +1,21 @@
#include "data/internal_chozodia_escape_data.h"*
#include "data/io_transfer_data.h"
#include "macros.h"
#include "chozodia_escape.h"
const ChozodiaEscapeFunc_T sChozodiaEscapeFunctionPointers[5] = {
[0] = ChozodiaEscapeShipLeaving,
[1] = ChozodiaEscapeShipHeatingUp,
[2] = ChozodiaEscapeShipBlowingUp,
[3] = ChozodiaEscapeShipLeavingPlanet,
[4] = ChozodiaEscapeMissionAccomplished,
};
static const u8* const sPlayerNumbersStringPointers[4] = {
[0] = sPlayer1String,
[1] = sPlayer2String,
[2] = sPlayer3String,
[3] = sPlayer4String,
};
static const u8 sTempArray_760d38[0x969fc] = INCBIN_U8("data/Blob_760d38_7f7734.bin");

View File

@ -20,4 +20,4 @@ const i8 sGameOver_760b0f[9] = {
0, 1, 2, 3, 2, 1, 0, 0, 0
};
static const u8 sTempArray_760b18[0x96c1c] = INCBIN_U8("data/Blob_760b18_7f7734.bin");
static const u8 sTempArray_760b18[0x1fc] = INCBIN_U8("data/Blob_760b18_760d14.bin");

View File

@ -909,7 +909,7 @@ void EndScreenInit(void)
zero = 0;
dma_set(3, &zero, &gNonGameplayRAM, (DMA_ENABLE | DMA_32BIT | DMA_SRC_FIXED) << 16 | sizeof(gNonGameplayRAM) / 4);
ENDING_DATA.endingNumber = ChozodiaEscapeGetPercentAndEndingNumber() & 7;
ENDING_DATA.endingNumber = ChozodiaEscapeGetItemCountAndEndingNumber() & 7;
ENDING_DATA.dispcnt = DCNT_BG1 | DCNT_BG2 | DCNT_BG3 | DCNT_OBJ;
gWrittenToBLDALPHA_L = 16;
@ -1254,7 +1254,7 @@ void EndingImageInit(void)
zero = 0;
dma_set(3, &zero, &gNonGameplayRAM, (DMA_ENABLE | DMA_32BIT | DMA_SRC_FIXED) << 16 | sizeof(gNonGameplayRAM) / 4);
pen = ChozodiaEscapeGetPercentAndEndingNumber();
pen = ChozodiaEscapeGetItemCountAndEndingNumber();
mask = 0xFF;
// TODO figure out how PEN is structured

View File

@ -3361,7 +3361,7 @@ u32 SpriteUtilGetFinalCompletionPercentage(void)
u32 part4;
u32 part5;
u32 pen = ChozodiaEscapeGetPercentAndEndingNumber();
u32 pen = ChozodiaEscapeGetItemCountAndEndingNumber();
// TODO figure out how PEN is structured
part1 = pen >> 0x18;

View File

@ -294,7 +294,7 @@ void CheckUnlockTimeAttack(void)
if (gFileScreenOptionsUnlocked.timeAttack & 1 || !TimeAttackCheckSaveFileValidity())
return;
pen = ChozodiaEscapeGetPercentAndEndingNumber();
pen = ChozodiaEscapeGetItemCountAndEndingNumber();
mask = 0xFF;
// TODO figure out how PEN is structured
@ -753,7 +753,7 @@ u8 TimeAttackCheckSetNewRecord(void)
converted100RecordIgt = (gTimeAttackRecord.igt100.hours << 24) + (gTimeAttackRecord.igt100.minutes << 16) +
(gTimeAttackRecord.igt100.seconds << 8);
pen = ChozodiaEscapeGetPercentAndEndingNumber();
pen = ChozodiaEscapeGetItemCountAndEndingNumber();
mask = 0xFF;
// TODO figure out how PEN is structured