From 11073b4bca9dfdceb686e17f0b454a9fba338285 Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Wed, 3 Aug 2022 15:20:56 -0500 Subject: [PATCH] core2/code_5C870.c --- include/enums.h | 29 ++-- progress/progress_core2.svg | 6 +- progress/progress_total.svg | 6 +- src/core1/code_15B30.c | 12 +- src/core2/code_5C240.c | 162 +++++++++++++++++++++- src/core2/code_5C870.c | 259 ++++++++++++++++++++++++++++++------ src/core2/code_67650.c | 22 ++- src/core2/code_679A0.c | 1 - src/core2/vla.c | 8 +- subyaml/core2.us.v10.yaml | 11 +- 10 files changed, 428 insertions(+), 88 deletions(-) diff --git a/include/enums.h b/include/enums.h index 3a02451d..fcc74811 100644 --- a/include/enums.h +++ b/include/enums.h @@ -1970,13 +1970,16 @@ enum animctrl_direction_e enum game_mode_e { - GAME_MODE_3_NORMAL = 3, - GAME_MODE_4_PAUSED = 4, - GAME_MODE_6_FILE_PLAYBACK = 6, - GAME_MODE_7_ATTRACT_DEMO = 7, - GAME_MODE_8_BOTTLES_BONUS = 8, - GAME_MODE_9_BANJO_AND_KAZOOIE = 9, - GAME_MODE_A_SNS_PICTURE = 10 + GAME_MODE_1_UNKNOWN = 1, + GAME_MODE_2_UNKNOWN, + GAME_MODE_3_NORMAL, + GAME_MODE_4_PAUSED, + GAME_MODE_5_UNKNOWN, + GAME_MODE_6_FILE_PLAYBACK, + GAME_MODE_7_ATTRACT_DEMO, + GAME_MODE_8_BOTTLES_BONUS, + GAME_MODE_9_BANJO_AND_KAZOOIE, + GAME_MODE_A_SNS_PICTURE }; enum asset_e @@ -3261,8 +3264,8 @@ enum asset_e ASSET_6DC_SPRITE_XMAS_TREE_TIMER, SPRITE_DIALOG_FONT_ALPHAMASK = 0x6eb, - SPRITE_BOLD_FONT_LETTERS_ALPHAMASK = 0x6ec, - SPRITE_BOLD_FONT_NUMBERS_ALPHAMASK = 0x6ed, + SPRITE_BOLD_FONT_LETTERS_ALPHAMASK, + SPRITE_BOLD_FONT_NUMBERS_ALPHAMASK, ASSET_700_SPRITE_DUST = 0x700, ASSET_701_SPRITE_LENS_SHUTTER_MASK, @@ -3271,10 +3274,10 @@ enum asset_e ASSET_708_SPRITE_EGG_PROJECTILE = 0x708, ASSET_70A_SPRITE_BUBBLE_1 = 0x70a, - ASSET_70B_SPRITE_BUBBLE_2 = 0x70b, - ASSET_70C_SPRITE_RIPPLE = 0x70c, - ASSET_70D_SPRITE_SMOKE_1 = 0x70d, - ASSET_70E_SPRITE_SMOKE_2 = 0x70e, + ASSET_70B_SPRITE_BUBBLE_2, + ASSET_70C_SPRITE_RIPPLE, + ASSET_70D_SPRITE_SMOKE_1, + ASSET_70E_SPRITE_SMOKE_2, ASSET_710_SPRITE_SPARKLE_PURPLE = 0x710, ASSET_711_SPRITE_SPARKLE_DARK_BLUE, diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index 12dfbfca..bac4eefd 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ core2 - 76.6689% - 76.6689% + 77.0566% + 77.0566% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index c59d1329..555a9189 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 81.4055% - 81.4055% + 81.6280% + 81.6280% \ No newline at end of file diff --git a/src/core1/code_15B30.c b/src/core1/code_15B30.c index 43780c51..7c82dea2 100644 --- a/src/core1/code_15B30.c +++ b/src/core1/code_15B30.c @@ -5,8 +5,8 @@ typedef struct { s32 unk0; s32 unk4; - s32 unk8; - s32 unkC; + Gfx *unk8; + Gfx *unkC; s32 unk10; s32 unk14; }Struct_Core1_15B30; @@ -40,7 +40,7 @@ void func_8025357C(void){ osSendMesg(&D_802831F0, NULL, OS_MESG_BLOCK); } -void func_802535A8(UNK_TYPE(s32) arg0, UNK_TYPE(s32)arg1, UNK_TYPE(s32) arg2, UNK_TYPE(s32) arg3) { +void func_802535A8(Gfx **arg0, Gfx **arg1, UNK_TYPE(s32) arg2, UNK_TYPE(s32) arg3) { Struct_Core1_15B30 *sp1C; func_80253550(); @@ -125,7 +125,7 @@ void func_80253DE0(Gfx **gdl) { gSPEndDisplayList((*gdl)++); } -void func_80253E14(Gfx **arg0, Gfx **arg1, s32 arg2){ +void func_80253E14(Gfx *arg0, Gfx *arg1, s32 arg2){ Struct_Core1_15B30 *sp1C; func_80253550(); sp1C = D_80283008 + D_802831E8; @@ -138,11 +138,11 @@ void func_80253E14(Gfx **arg0, Gfx **arg1, s32 arg2){ func_80246670((OSMesg) sp1C); } -void func_80253EA4(Gfx **arg0, Gfx **arg1){ +void func_80253EA4(Gfx *arg0, Gfx *arg1){ func_80253E14(arg0, arg1, 0); } -void func_80253EC4(Gfx **arg0, Gfx **arg1){ +void func_80253EC4(Gfx *arg0, Gfx *arg1){ func_80253E14(arg0, arg1, 0x40000000); } diff --git a/src/core2/code_5C240.c b/src/core2/code_5C240.c index 3afb3e6b..b1a990a2 100644 --- a/src/core2/code_5C240.c +++ b/src/core2/code_5C240.c @@ -2,22 +2,170 @@ #include "functions.h" #include "variables.h" +extern void func_8023DFF0(s32); +extern void func_80259BD0(void); +extern void func_802F1A10(void *, f32); +extern void func_8033DC10(void); +extern void func_8033DC18(void); +extern f32 func_8033DC20(void); +extern void func_8033DC9C(f32); + +extern s32 D_80276588; //framebuffer_width +extern s32 D_8027658C; //framebuffer_height +extern s16 D_803A5D00[2][0xF660]; //framebuffer + /* .bss */ struct { - u8 pad0[0x20]; + f32 unk0; + f32 unk4; + s32 unk8; + s32 unkC; + void *unk10; + s32 unk14; + f32 unk18; + // u8 pad1C[0x4]; }D_8037E8C0; /* .code */ -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_5C240/func_802E31D0.s") +void func_802E31D0(s32 arg0) { + s32 temp_v0; -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_5C240/func_802E329C.s") + temp_v0 = D_8037E8C0.unk14; + if ((temp_v0 == 0) || (temp_v0 == 3)) { + func_8024A85C(arg0); + func_80249DE0(0, 0, D_8037E8C0.unkC, 0, 0); + osWritebackDCache(D_803A5D00[arg0], (s32) ((f32) D_80276588 * (f32) D_8027658C * sizeof(s16))); + } +} -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_5C240/func_802E3460.s") +void func_802E329C(s32 arg0, Gfx **gfx_begin, Gfx **gfx_end) { + Gfx *gfx; + Gfx *gfx_start; + Mtx *mtx; + Mtx *mtx_start; + Vtx *vtx; + Vtx *vtx_start; -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_5C240/func_802E3524.s") + func_80254404(&gfx, &mtx, &vtx); + gfx_start = gfx; + mtx_start = mtx; + vtx_start = vtx; + func_802539AC(&gfx, arg0); + if (D_8037E8C0.unk14 == 2) { + func_80254084(&gfx, 0, 0, (s32) (f32) D_80276588, (s32) (f32) D_8027658C, 0, 0, 0); + } + if ((D_8037E8C0.unk14 == 0) || (D_8037E8C0.unk14 == 3)) { + func_8024C904(&gfx, &mtx); + gcbound_draw(&gfx); + } + if (D_8037E8C0.unk14 == 1) { + func_80254084(&gfx, 0, 0, (s32) (f32) D_80276588, (s32) (f32) D_8027658C, 0, 0, 0); + func_8024C904(&gfx, &mtx); + func_802F1858(D_8037E8C0.unk10, &gfx, &mtx, &vtx); + } + func_80253DE0(&gfx); + osWritebackDCache(mtx_start, (mtx - mtx_start) * sizeof(Mtx)); + osWritebackDCache(vtx_start, (vtx - vtx_start) * sizeof(Vtx)); + *gfx_begin = gfx_start; + *gfx_end = gfx; +} -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_5C240/func_802E3580.s") +void func_802E3460(s32 arg0) { + D_8037E8C0.unk14 = arg0; + if (D_8037E8C0.unk14 == 0) { + D_8037E8C0.unk8 = 0xFF; + D_8037E8C0.unk0 = 0.0f; + func_8025A6EC(COMUSIC_31_GAME_OVER, -1); + func_8033DC04(); + } + else if (D_8037E8C0.unk14 == 1) { + D_8037E8C0.unk4 = 0.0f; + if (func_8025AD7C(COMUSIC_31_GAME_OVER)) { + comusic_8025AB44(COMUSIC_31_GAME_OVER, 0, 200); + } + func_802F1934(D_8037E8C0.unk10, func_8024BDA0()); + } + else if (D_8037E8C0.unk14 == 3) { + D_8037E8C0.unk0 = 0.0f; + } +} + +void func_802E3524(s32 arg0) { + Gfx *gfx_begin; + Gfx *gfx_end; + + func_802E31D0(func_8024BD80()); + func_802E329C(func_8024BD80(), &gfx_begin, &gfx_end); + func_80253EA4(gfx_begin, gfx_end); + func_80254008(); + func_8024C1B4(); +} + +void func_802E3580(void) { + assetcache_release(D_8037E8C0.unkC); + func_802F1884(D_8037E8C0.unk10); + func_802E5F68(); + func_80259B14(); + func_80253420(); + func_8024BF94(2); +} void func_802E35D0(void){} -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_5C240/func_802E35D8.s") +void func_802E35D8(void ) { + s32 sp40[6]; + s32 i; + s32 sp38; + + if (D_8037E8C0.unk18 == 0.0f) { + func_8033DC9C(0.0f); + } else { + func_8033DC18(); + func_8033DC9C(func_8033DC20()); + } + func_8033DC10(); + D_8037E8C0.unk18 += time_getDelta(); + D_8037E8C0.unk0 += time_getDelta(); + if (0.83333333333333337 <= D_8037E8C0.unk0) { + D_8037E8C0.unk0 -= 0.83333333333333337; + } + if (D_8037E8C0.unk14 == 0) { + D_8037E8C0.unk8 -= 0x10; + if (D_8037E8C0.unk8 <= 0) { + D_8037E8C0.unk8 = 0; + func_802E3460(3); + } + } else if (D_8037E8C0.unk14 == 3) { + sp38 = 0; + func_8024E55C(0, &sp40); + for(i = 0; i < 6; i++){ + if (sp40[i] == 1) { + sp38++; + } + } + if (D_8037E8C0.unk18 > 15.0f) { + sp38++; + } + if (func_8024E67C(0) == 1) { + sp38++; + } + if (sp38 != 0) { + func_802E3460(1); + } + } else if (D_8037E8C0.unk14 == 1) { + D_8037E8C0.unk4 += 0.01; + if (D_8037E8C0.unk4 >= 1.0f) { + func_8023DFF0(1); + func_802E3460(2); + return; + } + } + func_80259BD0(); + if (D_8037E8C0.unk14 == 0) { + gcbound_alpha(D_8037E8C0.unk8); + } + if (D_8037E8C0.unk14 == 1) { + func_802F1A10(D_8037E8C0.unk10, D_8037E8C0.unk4); + } + func_802E3524(0); +} diff --git a/src/core2/code_5C870.c b/src/core2/code_5C870.c index 99d27194..ea106190 100644 --- a/src/core2/code_5C870.c +++ b/src/core2/code_5C870.c @@ -8,7 +8,23 @@ extern void func_8024C510(f32); extern void func_8024CDF8(f32, f32, f32); extern void func_8024CE40(f32, f32, f32); extern void func_8024CE60(f32, f32); +extern void func_802F5374(void); +extern void func_802FA0F8(void); +extern void timedFuncQueue_update(void); +extern void func_80335128(s32); +extern void func_8025A2B0(void); +extern void func_8025A430(s32, s32, s32); +extern void func_80335110(s32); +extern void func_8034BB90(void); +extern void func_8030C27C(void); +extern void func_80321C34(void); +extern void func_8030ED0C(void); +extern void func_80259BD0(void); +enum transition_e { + TRANSITION_0_NONE, + +}; void func_802E3BD0(s32 frame_buffer_indx); void func_802E40A8(s32 map, s32 exit); @@ -21,11 +37,8 @@ f32 func_8033DC20(void); void func_8033DC9C(f32); extern void func_80324C58(void); - -/* .rodata */ -extern f32 D_80377110; -extern f32 D_80377114; - +/* .data */ +extern s16 D_80367FF0[]; /* .bss */ struct{ @@ -34,9 +47,9 @@ struct{ f32 unk8; s32 unkC; //freeze_scene_flag (used for pause menu) f32 unk10; - u8 unk14; // - u8 unk15; //map - u8 unk16; //exit + u8 transition; + u8 map; + u8 exit; u8 unk17; //reset_on_map_load u8 unk18; u8 unk19; @@ -48,7 +61,7 @@ struct{ void func_802E3800(void){ func_8024CDF8(0.0f, 0.0f, 0.0f); func_8024CE40(-30.0f, 30.0f, 0.0f); - func_8024C510(D_80377110); + func_8024C510(3000.0f); func_8024CFD4(); } @@ -88,8 +101,14 @@ void func_802E38E8(enum map_e map, s32 exit, s32 reset_on_load){ func_8033DC10(); } -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_5C870/func_802E398C.s") - +void func_802E398C(s32 arg0) { + func_80334910(); + func_8030ED0C(); + func_80259BD0(); + if (arg0 != 0) { + func_802E3854(); + } +} void func_802E39D0(Gfx **gdl, Mtx **mptr, Vtx **vptr, s32 arg3, s32 arg4){ Mtx* m_start = *mptr; @@ -206,7 +225,7 @@ void func_802E3BF8(enum game_mode_e next_mode, s32 arg1){ } else if(func_802E4A08()){//L802E3DBC sp20 = TRUE; - sp1C = func_8034BDA4(D_8037E8E0.unk15, D_8037E8E0.unk16); + sp1C = func_8034BDA4(D_8037E8E0.map, D_8037E8E0.exit); } if(sp20) @@ -237,11 +256,11 @@ void func_802E3E7C(enum game_mode_e mode){ func_80254008(); sp34 = D_8037E8E0.unk18; sp30 = D_8037E8E0.unk17; - map = D_8037E8E0.unk15; - sp28 = D_8037E8E0.unk16; + map = D_8037E8E0.map; + sp28 = D_8037E8E0.exit; prev_mode = D_8037E8E0.unk0; func_802E3BF8(2, 0); - if(!func_80320454(0x21, 0) || map_getLevel(map_get()) == map_getLevel(D_8037E8E0.unk15)){ + if(!func_80320454(0x21, 0) || map_getLevel(map_get()) == map_getLevel(D_8037E8E0.map)){ if(!func_803203FC(0x1F)) mapSavestate_save(map_get()); } @@ -254,7 +273,9 @@ void func_802E3E7C(enum game_mode_e mode){ func_80346CA8(); } -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_5C870/func_802E3F80.s") +s32 func_802E3F80(void){ + return D_8037E8E0.unk0; +} //game_draw void func_802E3F8C(s32 arg0){ @@ -298,18 +319,18 @@ extern void func_802E4078(enum map_e map, s32 exit, s32 transition){ void func_802E40A8(s32 map, s32 exit){ D_8037E8E0.unk18 = 1; - D_8037E8E0.unk15 = map; - D_8037E8E0.unk16 = exit; + D_8037E8E0.map = map; + D_8037E8E0.exit = exit; } void func_802E40C4( s32 arg0){ - D_8037E8E0.unk14 = arg0; + D_8037E8E0.transition = arg0; } void func_802E40D0(s32 map, s32 exit){ D_8037E8E0.unk18 = 0; - D_8037E8E0.unk15 = map; - D_8037E8E0.unk16 = exit; + D_8037E8E0.map = map; + D_8037E8E0.exit = exit; } void func_802E40E8(s32 transition){ @@ -348,19 +369,11 @@ void func_802E4170(void){ func_8030D8DC(); } -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_5C870/func_802E4214.s") -#else -// //99.9% there void func_802E4214(s32 arg0){ - D_8037E8E0.unk14 = 0; - D_8037E8E0.unk18 = 0; - D_8037E8E0.unk19 = 0; - D_8037E8E0.unk17 = 0; - D_8037E8E0.unk16 = 0; - D_8037E8E0.unk15 = 0; - D_8037E8E0.unk1A = 0; - D_8037E8E0.unk1B = 0; + D_8037E8E0.transition = TRANSITION_0_NONE; + D_8037E8E0.unk19 = D_8037E8E0.unk18 = 0; + D_8037E8E0.map = D_8037E8E0.exit = D_8037E8E0.unk17 = 0; + D_8037E8E0.unk1B = D_8037E8E0.unk1A = 0; D_8037E8E0.unkC = 0; D_8037E8E0.unk1C = 0; func_8033C070(); @@ -379,7 +392,7 @@ void func_802E4214(s32 arg0){ func_80253428(1); func_80288070(); func_8024CCC4(); - func_8024CE60(1.0f, D_80377114); + func_8024CE60(1.0f, 10000.0f); func_8034A6B4(); func_80254348(); func_80253FE8(); @@ -397,7 +410,6 @@ void func_802E4214(s32 arg0){ D_8037E8E0.unk0 = 0; func_802E3BF8(3,1); } -#endif void func_802E4384(void){ if(D_8037E8E0.unk8 == 0.0f){ @@ -413,7 +425,150 @@ void func_802E4384(void){ D_8037E8E0.unk8 += time_getDelta(); } -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_5C870/func_802E4424.s") +bool func_802E4424(void) { + s32 sp1C; + u8 temp_v0; + + func_8024CC00(); + func_8034A85C(); + if (!gctransition_8030BDC0()) { + temp_v0 = D_8037E8E0.transition; + D_8037E8E0.transition = TRANSITION_0_NONE; + switch (temp_v0) { /* switch 1 */ + case 9: /* switch 1 */ + if( (D_8037E8E0.game_mode == GAME_MODE_7_ATTRACT_DEMO) + || (D_8037E8E0.game_mode == GAME_MODE_8_BOTTLES_BONUS) + || (D_8037E8E0.game_mode == GAME_MODE_A_SNS_PICTURE) + || (D_8037E8E0.game_mode == GAME_MODE_9_BANJO_AND_KAZOOIE) + ) { + func_8034B940(); + } + func_8031ABF8(); + func_802E3E7C(GAME_MODE_3_NORMAL); + return FALSE; + + case 10: /* switch 1 */ + if( (D_8037E8E0.game_mode == GAME_MODE_7_ATTRACT_DEMO) + || (D_8037E8E0.game_mode == GAME_MODE_8_BOTTLES_BONUS) + || (D_8037E8E0.game_mode == GAME_MODE_A_SNS_PICTURE) + || (D_8037E8E0.game_mode == GAME_MODE_9_BANJO_AND_KAZOOIE) + ) { + func_8034B940(); + } + func_8031ABA0(); + func_802E3E7C(GAME_MODE_3_NORMAL); + return FALSE; + + case 1: /* switch 1 */ + if( (D_8037E8E0.game_mode == GAME_MODE_7_ATTRACT_DEMO) + || (D_8037E8E0.game_mode == GAME_MODE_8_BOTTLES_BONUS) + || (D_8037E8E0.game_mode == GAME_MODE_A_SNS_PICTURE) + || (D_8037E8E0.game_mode == GAME_MODE_9_BANJO_AND_KAZOOIE) + ) { + func_8034B940(); + } + func_802E3E7C(GAME_MODE_3_NORMAL); + return FALSE; + + case 6: /* switch 1 */ + func_8034B8C0(D_8037E8E0.map, D_8037E8E0.exit); + func_802E3E7C(GAME_MODE_7_ATTRACT_DEMO); + return FALSE; + + case 12: /* switch 1 */ + func_8034B8C0(D_8037E8E0.map, D_8037E8E0.exit); + func_802E3E7C(GAME_MODE_A_SNS_PICTURE); + return FALSE; + + case 7: /* switch 1 */ + func_8034B8C0(D_8037E8E0.map, D_8037E8E0.exit); + func_802E3E7C(GAME_MODE_8_BOTTLES_BONUS); + return FALSE; + + case 8: /* switch 1 */ + func_8034B8C0(D_8037E8E0.map, D_8037E8E0.exit); + func_802E3E7C(GAME_MODE_9_BANJO_AND_KAZOOIE); + return FALSE; + + case 11: /* switch 1 */ + func_802E3E7C(D_8037E8E0.game_mode); + return FALSE; + + case 2: /* switch 1 */ + func_8023DFF0(1); + return FALSE; + + case 3: /* switch 1 */ + func_8023DFF0(4); + return FALSE; + case 0: + break; + } + } + if (D_8037E8E0.unk1A != 0) { + func_802E3BF8(D_8037E8E0.unk1A - 1, D_8037E8E0.unk1B); + D_8037E8E0.unk1A = 0; + } + sp1C = func_80334ECC(); + func_80321C34(); + func_8030ED0C(); + func_80259BD0(); + switch (D_8037E8E0.game_mode) { + case GAME_MODE_8_BOTTLES_BONUS: + case GAME_MODE_A_SNS_PICTURE: + func_8030C27C(); + /* fallthrough */ + case GAME_MODE_7_ATTRACT_DEMO: + case GAME_MODE_9_BANJO_AND_KAZOOIE: + func_8034BB90(); + if ((func_8024E67C(0) == 1) && (D_8037E8E0.unk0 != 0)) { + func_802E3BF8(GAME_MODE_1_UNKNOWN, 0U); + } + break; + case GAME_MODE_3_NORMAL: /* switch 2 */ + D_8037E8E0.unk10 += time_getDelta(); + if( (func_8024E698(0) == 1) + && func_8028F070() + && (func_8028EC04() == 0) + && !gctransition_8030BDC0() + && gctransition_8030BD98() + && (level_get() != 0) + && (0.6 < D_8037E8E0.unk10) + && func_80314B00() + && !func_8028F22C() + && func_8032056C() + && levelSpecificFlags_validateCRC1() + && func_80320248() + ) { + func_802E3BF8(GAME_MODE_4_PAUSED, 0U); + } else if ((func_8024E67C(0) == 1) && (D_8037E8E0.unk0 != 0)) { + func_802E3BF8(GAME_MODE_1_UNKNOWN, 0U); + } else if (sp1C == 0) { + func_802E3BF8(GAME_MODE_3_NORMAL, 1U); + } + break; + + case GAME_MODE_4_PAUSED: /* switch 2 */ + if (func_80313380() || func_8031C880()) { + FUNC_8030E624(SFX_C9_PAUSEMENU_ENTER, 0.899316, 32736); + func_80335110(1); + func_8025A430(-1, 2000, 3); + func_8025A2B0(); + func_80335128(1); + func_802E3BF8(GAME_MODE_3_NORMAL, 0U); + } + break; + } + if ((D_8037E8E0.game_mode == GAME_MODE_3_NORMAL) || (func_802E4A08() != 0)) { + timedFuncQueue_update(); + func_802FA0F8(); + } + gctransition_update(); + if (func_802E4A08() == 0) { + func_802F5374(); + } + return TRUE; +} void func_802E48B8(enum game_mode_e mode, s32 arg1){ func_802E3BF8(mode, arg1); @@ -484,21 +639,37 @@ u8 func_802E4A8C(void){ return D_8037E8E0.unk1C; } -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_5C870/func_802E4A98.s") +s32 func_802E4A98(s32 arg0){ + return D_80367FF0[arg0*8 + 0]; +} -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_5C870/func_802E4AAC.s") +s32 func_802E4AAC(s32 arg0){ + return D_80367FF0[arg0*8 + 1]; +} -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_5C870/func_802E4AC0.s") +s32 func_802E4AC0(s32 arg0){ + return D_80367FF0[arg0*8 + 2]; +} -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_5C870/func_802E4AD4.s") +s32 func_802E4AD4(s32 arg0){ + return D_80367FF0[arg0*8 + 3]; +} -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_5C870/func_802E4AE8.s") +s32 func_802E4AE8(s32 arg0){ + return D_80367FF0[arg0*8 + 4]; +} -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_5C870/func_802E4AFC.s") +s32 func_802E4AFC(s32 arg0){ + return D_80367FF0[arg0*8 + 5]; +} -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_5C870/func_802E4B10.s") +s32 func_802E4B10(s32 arg0){ + return D_80367FF0[arg0*8 + 6]; +} -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_5C870/func_802E4B24.s") +s32 func_802E4B24(s32 arg0){ + return D_80367FF0[arg0*8 + 7]; +} f32 func_802E4B38(void){ return D_8037E8E0.unk8; diff --git a/src/core2/code_67650.c b/src/core2/code_67650.c index ffb7ab4f..e98685e1 100644 --- a/src/core2/code_67650.c +++ b/src/core2/code_67650.c @@ -2,6 +2,12 @@ #include "functions.h" #include "variables.h" +/* .data */ +s16 D_80368930[3] = { + ASSET_700_SPRITE_DUST, + ASSET_702_SPRITE_UNKNOWN, + ASSET_70D_SPRITE_SMOKE_1 +}; /* .bss */ u8 D_80380910[3]; @@ -19,8 +25,20 @@ bool func_802EE5F0(s32 arg0){ return (arg0 < 3) ? !func_802EF648(func_802F0EF0(D_80380910[arg0])) : FALSE; } -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_67650/func_802EE63C.s") +void func_802EE63C(void) { + s32 i; -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_67650/func_802EE684.s") + for(i = 0; i < 3; i++){ + D_80380910[i] = func_802F0F78(0x20); + } +} + +void func_802EE684(void) { + s32 i; + + for(i = 0; i < 3; i++){ + func_802F1190(D_80380910[i]); + } +} #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_67650/func_802EE6CC.s") diff --git a/src/core2/code_679A0.c b/src/core2/code_679A0.c index 3cb22294..56bae9c9 100644 --- a/src/core2/code_679A0.c +++ b/src/core2/code_679A0.c @@ -22,7 +22,6 @@ void func_802EFF9C(ParticleEmitter *, f32); void func_802F0C78(ParticleEmitter *this); -extern s16 D_80368930[] = {0x700, 0x702, 0x70D}; extern Gfx D_80368940[] = { gsSPClearGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH), gsSPSetGeometryMode(G_ZBUFFER | G_SHADE | G_TEXTURE_GEN_LINEAR | G_SHADING_SMOOTH), diff --git a/src/core2/vla.c b/src/core2/vla.c index fdf15a9f..71e1bae5 100644 --- a/src/core2/vla.c +++ b/src/core2/vla.c @@ -57,7 +57,7 @@ void *vector_insertNew(VLA **thisPtr, s32 indx){ this = *thisPtr; i = ((s32)this->end - (s32)this->begin)/this->elem_size; while(indx < --i){ - memcpy((s32)this->begin + (i)*this->elem_size, (s32)this->begin + (i -1)*this->elem_size, this->elem_size); + memcpy((void *)((s32)this->begin + (i)*this->elem_size), (void *)((s32)this->begin + (i -1)*this->elem_size), this->elem_size); } return (void *)((s32)this->begin + indx*this->elem_size); } @@ -80,8 +80,8 @@ void vector_remove(VLA *this, u32 indx){ u32 nextOffset = (u32)this->begin + (indx + 1) * this->elem_size;\ u32 size = (u32)this->end - (u32)this->begin; - memcpy( elemOffset, nextOffset, size - (indx + 1) * this->elem_size); - this->end = (u32)this->end - this->elem_size; + memcpy((void *)elemOffset, (void *)nextOffset, size - (indx + 1) * this->elem_size); + this->end = (void *)((u32)this->end - this->elem_size); } @@ -90,7 +90,7 @@ void vector_popBack_n(VLA *this, u32 n){ } void vector_assign(VLA *this, s32 indx, void* value){ - memcpy((s32)this->begin + indx * this->elem_size, value, this->elem_size); + memcpy((void*)((s32)this->begin + indx * this->elem_size), value, this->elem_size); } VLA * vector_defrag(VLA *this){ diff --git a/subyaml/core2.us.v10.yaml b/subyaml/core2.us.v10.yaml index a565dc14..31cf5078 100644 --- a/subyaml/core2.us.v10.yaml +++ b/subyaml/core2.us.v10.yaml @@ -231,8 +231,8 @@ segments: - [0x5B6A0, c, code_5B6A0] - [0x5BD90, c, code_5BD90] #DONE - [0x5BEB0, c, code_5BEB0] - - [0x5C240, c, code_5C240] - - [0x5C870, c, code_5C870] + - [0x5C240, c, code_5C240] #DONE + - [0x5C870, c, code_5C870] #DONE - [0x5DBC0, c, code_5DBC0] - [0x5FD80, c, code_5FD80] #DONE - [0x5FD90, c, code_5FD90] @@ -517,7 +517,8 @@ segments: - [0xE1860, bin, data_E1860] - [0xE18D0, .data, code_66FB0] - [0xE1950, .data, gc/bound] - - [0xE19A0, bin, data_E19A0] + - [0xE19A0, .data, code_67650] + - [0xE19B0, bin, data_E19B0] - [0xE1DF0, .data, code_6CD20] - [0xE1E40, .data, code_6D030] - [0xE1E50, bin, data_E1E50] @@ -714,8 +715,8 @@ segments: - [0xF0110, .rodata, ch/code_5AB30] - [0xF0140, .rodata, code_5B6A0] - [0xF0160, bin, data_F0160] #.rodata, code_5B6A0] - - [0xF0170, bin, data_F0170] - - [0xF0180, bin, data_F0180] + - [0xF0170, .rodata, code_5C240] + - [0xF0180, .rodata, code_5C870] - [0xF01F0, bin, data_F01F0] #.rodata, code_5FD90] - [0xF0200, .rodata, code_66FB0] - [0xF0210, bin, data_F0210]