diff --git a/decompressed.us.v10.yaml b/decompressed.us.v10.yaml index 00be3e68..8ab72e4e 100644 --- a/decompressed.us.v10.yaml +++ b/decompressed.us.v10.yaml @@ -364,18 +364,29 @@ segments: - [0xF51090, .data, code_2FA0] - [0xF510A0, .data, code_3250] - [0xF510B0, .data, code_3A70] - - [0xF510F0, bin, data_37EA0] # .data, code_5650] - - [0xF51110, bin, data_37EC0] + - [0xF510F0, .data, code_5650] + - [0xF51110, .data, code_7090] + - [0xF51120, bin, data_37ED0] + - [0xF51130, .data, code_7F60] - [0xF51140, .data, code_8C50] - [0xF51280, .data, code_9D30] - [0xF51430, .data, code_ABB0] - - [0xF51440, bin, data_381F0] # .data, done/code_CE60] - - [0xF514B0, bin, data_38260] + - [0xF51440, .data, done/code_CE60] + - [0xF514B0, .data, code_E360] + - [0xF51550, .data, code_EAF0] + - [0xF51560, bin, data_F51560] # .data, code_10A00] - [0xF51570, .data, code_11AC0] - [0xF51B00, .data, code_136D0] - - [0xF51DA0, bin, data_38B50] + - [0xF51DA0, .data, code_13990] + - [0xF51DB0, .data, code_15B30] + - [0xF51DC0, .data, memory] - [0xF51DF0, .data, code_18310] - - [0xF524E0, bin, data_39290] + - [0xF524E0, .data, code_18350] + - [0xF52660, .data, code_1BE90] + - [0xF52670, .data, code_1D5D0] + - [0xF52690, .data, done/code_1E360] + - [0xF526A0, .data, code_1E820] + - [0xF526B0, .data, done/audio/n_sl] - [0xF526C0, .data, done/audio/n_drvrNew] - [0xF52850, .data, done/audio/n_env] - [0xF52950, .data, os/initialize] @@ -397,19 +408,18 @@ segments: - [0xF52DB0, .data, done/io/vimodentsclan1] - [0xF52E50, bin, data_39C00] # .rodata, code_1D00] - [0xF52E70, .rodata, code_3250] - - [0xF52E80, bin, data_39C30] # .rodata, code_3A70] + - [0xF52E80, .rodata, code_3A70] - [0xF52E90, .rodata, code_5650] - [0xF52EF0, .rodata, code_72B0] - [0xF52F10, .rodata, code_7F60] - [0xF52F30, .rodata, code_9D30] - # - [0xF52F30, .rodata, code_ABB0] - [0xF52F50, .rodata, done/code_CE60] - [0xF53220, .rodata, code_EAF0] - [0xF532A0, .rodata, code_10A00] - [0xF539B0, .rodata, code_11AC0] - - [0xF539C0, bin, data_3A770] + - [0xF539C0, .rodata, code_12F10] - [0xF539D0, .rodata, code_136D0] - - [0xF53A50, bin, data_3A800] # .rodata, code_13990] + - [0xF53A50, .rodata, code_13990] - [0xF53A70, .rodata, code_18350] - [0xF53B70, .rodata, code_1BE90] - [0xF53BA0, .rodata, code_1D5D0] diff --git a/include/variables.h b/include/variables.h index 7ce79203..08c790ef 100644 --- a/include/variables.h +++ b/include/variables.h @@ -13,8 +13,8 @@ struct Overlay { extern struct Overlay gOverlayTable[]; -extern s32 D_80276588; -extern s32 D_8027658C; +extern s32 framebuffer_width; +extern s32 framebuffer_height; extern f32 climbPoleBottom[3]; extern f32 climbPoleTop[3]; diff --git a/src/core1/code_0.c b/src/core1/code_0.c index c0079ce3..9d843bf8 100644 --- a/src/core1/code_0.c +++ b/src/core1/code_0.c @@ -173,7 +173,7 @@ void func_8023DD0C(void){ ){ s32 offset; //render weird CRC failure image - for(x= 0x1e; x< D_8027658C - 0x1e; x++){//L8023DEB4 + for(x= 0x1e; x< framebuffer_height - 0x1e; x++){//L8023DEB4 g = x >> 3; for(y = 0x14; y < 0xeb; y++){ b = ((func_8023DB5C() << 3) + y*y + x*x) >> 3; @@ -182,7 +182,7 @@ void func_8023DD0C(void){ rgba |= _SHIFTL(r, 11, 5 ); rgba |= _SHIFTL(g, 6, 5); rgba |= _SHIFTL(1, 0, 1 ); - offset = ((D_80276588 - 0xff)/2 + y + x*D_80276588); + offset = ((framebuffer_width - 0xff)/2 + y + x*framebuffer_width); D_803A5D00[0][offset] = rgba; D_803A5D00[1][offset] = rgba; } diff --git a/src/core1/code_10A00.c b/src/core1/code_10A00.c index 57c0e81d..e5209754 100644 --- a/src/core1/code_10A00.c +++ b/src/core1/code_10A00.c @@ -33,18 +33,18 @@ typedef struct { f32 joystick[2]; }Struct_core1_10A00_1; -/* .data */ -extern s32 D_80275D38; - extern s32 D_80276574; // = CORE2_DATA_CRC2 +/* .data */ +extern s32 D_80275D30 = 0xC3A68832; //WHAT IS THIS? +extern s32 D_80275D34 = 0xDDC3A724; //WHAT IS THIS? +extern s32 D_80275D38 = 0; /* .bss */ UNK_TYPE(s32) D_802810E0[4][5]; u8 D_80281130; Struct_core1_10A00_0 D_80281138[4]; Struct_core1_10A00_0 D_80281218; -// u8 pad_80281230[0x20]; Struct_core1_10A00_1 D_80281250[4]; OSMesg D_802812B0; OSMesg D_802812B4; @@ -57,7 +57,7 @@ OSContStatus D_80281318; u8 pad_D_80281320[0x8]; volatile s32 D_80281328; OSThread D_80281330; -u8 pad_D_802814E0[0x200]; +u8 D_802814E0[0x200]; f32 D_802816E0; OSMesgQueue D_802816E8; OSMesg D_80281700[4]; @@ -319,7 +319,7 @@ void func_8024EFB0(void *arg0){ void func_8024F05C(void){ osCreateMesgQueue(&D_802812D8, &D_802812B0, 1); osCreateMesgQueue(&D_802812F0, &D_802812B4, 1); - osCreateThread(&D_80281330, 7, func_8024EFB0, NULL, &D_802816E0, 0x28); + osCreateThread(&D_80281330, 7, func_8024EFB0, NULL, D_802814E0 + 0x200, 0x28); osSetEventMesg(OS_EVENT_SI, &D_802812D8, &D_802812B0); osContInit(&D_802812D8, &D_80281130, &D_80281318); osContSetCh(1); diff --git a/src/core1/code_12F10.c b/src/core1/code_12F10.c index 37de28df..81504788 100644 --- a/src/core1/code_12F10.c +++ b/src/core1/code_12F10.c @@ -4,9 +4,6 @@ void func_8024F35C(s32); - -extern f64 D_80278190; - OSMesgQueue D_80282390; OSMesg D_802823A8; @@ -19,7 +16,7 @@ f32 D_80282424; f32 D_80282428; f32 D_8028242C; OSThread D_80282430; -u8 pad_D_80282430[0x200]; +u8 D_802825E0[0x200]; /* .code */ void func_80250D94(f32, f32, f32); @@ -110,7 +107,6 @@ void func_80250C08(void) { } void func_80250C84(void){ - extern s32 D_802827E0; s32 pfs_status; func_8024F35C(4); @@ -124,7 +120,7 @@ void func_80250C84(void){ D_802823B0 = D_802823AC; if(D_802823AC){ osCreateMesgQueue(&D_80282390, &D_802823A8, 1); - osCreateThread(&D_80282430, 8, func_8025098C, NULL, &D_802827E0, 0x19); + osCreateThread(&D_80282430, 8, func_8025098C, NULL, &D_802825E0[0x200], 0x19); osStartThread(&D_80282430); func_8024BDAC(&D_80282390, 0); } @@ -136,7 +132,7 @@ void func_80250D94(f32 arg0, f32 arg1, f32 arg2){ f32 f4; if(arg2 != 0.0f && D_802823AC){ if(func_802E4A08() == 0){ - if(!(D_80278190 < D_80282420 - D_80282424) || !(arg0 + arg1 < D_80282428 + D_8028242C)){ + if(!(0.1 < D_80282420 - D_80282424) || !(arg0 + arg1 < D_80282428 + D_8028242C)){ D_80282420 = arg2; D_80282424 = 0.0f; D_80282428 = arg0; diff --git a/src/core1/code_13990.c b/src/core1/code_13990.c index 2ae23791..1028f33b 100644 --- a/src/core1/code_13990.c +++ b/src/core1/code_13990.c @@ -9,13 +9,14 @@ void func_8024632C(Mtx*, f32, f32, f32, f32); f32 func_80263FF0(f32); f32 cosf(f32); -extern f32 D_80276578; -extern f32 D_8027657C; +#ifndef CORE2_DATA_CRC2 + #define CORE2_DATA_CRC2 0 +#endif - -extern f64 D_80278220; -extern f64 D_80278228; -extern f64 D_80278230; +s32 D_80276570 = 0xFF62C2B8; //WHAT IS THIS? +s32 D_80276574 = CORE2_DATA_CRC2; +f32 D_80276578 = BAD_DTOR; +f32 D_8027657C = BAD_DTOR; /*.bss*/ Mtx_t D_80282810; @@ -170,7 +171,7 @@ void mlMtxRotYaw(f32 arg0) { s32 i; if (arg0 != 0.0f) { - arg0 *= D_80278220; + arg0 *= BAD_DTOR; sin = sinf(arg0); cos = cosf(arg0); for(i = 0; i < 3; i++){ @@ -218,7 +219,7 @@ void func_80251F8C(f32 arg0) { s32 i; if (arg0 != 0.0f) { - arg0 *= D_80278228; + arg0 *= BAD_DTOR; sin = sinf(arg0); cos = cosf(arg0); for(i = 0; i < 3; i++){ @@ -238,7 +239,7 @@ void func_8025208C(f32 arg0) { s32 i; if (arg0 != 0.0f) { - arg0 *= D_80278230; + arg0 *= BAD_DTOR; sin = sinf(arg0); cos = cosf(arg0); for(i = 0; i < 3; i++){ diff --git a/src/core1/code_15770.c b/src/core1/code_15770.c index 5176d225..7a32966f 100644 --- a/src/core1/code_15770.c +++ b/src/core1/code_15770.c @@ -13,14 +13,14 @@ extern u8 D_803A5D00[2][0x1ecc0]; void func_80253208(Gfx **gdl, s32 x, s32 y, s32 w, s32 h, void *color_buffer); void func_80253190(Gfx **gdl){ - func_80253208(gdl, 0, 0, D_80276588, D_8027658C, D_803A5D00[func_8024BDA0()]); + func_80253208(gdl, 0, 0, framebuffer_width, framebuffer_height, D_803A5D00[func_8024BDA0()]); } void func_80253208(Gfx **gdl, s32 x, s32 y, s32 w, s32 h, void *color_buffer){ if( D_80282FE0.unk0 != NULL && (getGameMode() != GAME_MODE_4_PAUSED || func_80335134())){ //draw z_buffer gDPPipeSync((*gdl)++); - gDPSetColorImage((*gdl)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, D_80276588, OS_K0_TO_PHYSICAL(D_80282FE0.unk0)); + gDPSetColorImage((*gdl)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, OS_K0_TO_PHYSICAL(D_80282FE0.unk0)); gDPSetCycleType((*gdl)++, G_CYC_FILL); gDPSetRenderMode((*gdl)++, G_RM_NOOP, G_RM_NOOP2); gDPSetFillColor((*gdl)++, 0xFFFCFFFC); @@ -28,7 +28,7 @@ void func_80253208(Gfx **gdl, s32 x, s32 y, s32 w, s32 h, void *color_buffer){ //draw color_buffer gDPPipeSync((*gdl)++); - gDPSetColorImage((*gdl)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, D_80276588, OS_K0_TO_PHYSICAL(color_buffer)); + gDPSetColorImage((*gdl)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, OS_K0_TO_PHYSICAL(color_buffer)); } } diff --git a/src/core1/code_15B30.c b/src/core1/code_15B30.c index 83fc118f..7ba8f1c0 100644 --- a/src/core1/code_15B30.c +++ b/src/core1/code_15B30.c @@ -14,7 +14,9 @@ typedef struct { extern u8 D_803A5D00[2][0x1ecc0]; /* .data */ -extern Gfx *D_80276580[2]; +Gfx *D_80276580[2] = {NULL, NULL}; +s32 framebuffer_width = 292; +s32 framebuffer_height = 216; /* .bss */ Mtx *D_80282FF0[2]; @@ -70,8 +72,8 @@ void func_80253640(Gfx ** gdl, void *arg1){ gDPSetAlphaCompare((*gdl)++, G_AC_NONE); gDPSetColorDither((*gdl)++, G_CD_MAGICSQ); gDPSetScissor((*gdl)++, G_SC_NON_INTERLACE, D_8028320C, D_8028320E, D_80283210, D_80283212); - func_80253208(gdl, 0, 0, D_80276588, D_8027658C, arg1); - gDPSetColorImage((*gdl)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, D_80276588, OS_K0_TO_PHYSICAL(arg1)); + func_80253208(gdl, 0, 0, framebuffer_width, framebuffer_height, arg1); + gDPSetColorImage((*gdl)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, OS_K0_TO_PHYSICAL(arg1)); gDPSetCycleType((*gdl)++, G_CYC_1CYCLE); gDPSetTextureConvert((*gdl)++, G_TC_FILT); gDPSetTextureDetail((*gdl)++, G_TD_CLAMP); @@ -100,7 +102,7 @@ void func_802539AC(Gfx **gdl, s32 arg1){ void func_80253A58(Gfx **gfx, s32 arg1){ gSPSegment((*gfx)++, 0x00, 0x00000000); - gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, D_80276588, OS_PHYSICAL_TO_K0(arg1)); + gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, OS_PHYSICAL_TO_K0(arg1)); gSPClearGeometryMode((*gfx)++, G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH); gSPTexture((*gfx)++, 0, 0, 0, G_TX_RENDERTILE, G_OFF); gSPSetGeometryMode((*gfx)++, G_ZBUFFER | G_SHADE | G_SHADING_SMOOTH); @@ -222,8 +224,8 @@ void func_8025425C(void){ D_80276580[1] = (Gfx *)malloc(29600); D_80282FF0[0] = (Mtx *)malloc(44800); D_80282FF0[1] = (Mtx *)malloc(44800); - D_80282FF8[0] = malloc(6880); - D_80282FF8[1] = malloc(6880); + D_80282FF8[0] = (Vtx *)malloc(6880); + D_80282FF8[1] = (Vtx *)malloc(6880); func_80254464(); } D_80283000 = 0; @@ -235,8 +237,8 @@ void func_802542F4(s32 arg0, s32 arg1, s32 arg2, s32 arg3) { D_80283210 = arg1; D_8028320E = arg2; D_80283212 = arg3; - D_80276588 = arg1 - arg0; - D_8027658C = arg3 - arg2; + framebuffer_width = arg1 - arg0; + framebuffer_height = arg3 - arg2; func_8024CC5C(); } diff --git a/src/core1/code_18350.c b/src/core1/code_18350.c index a8f2650a..7967c9a4 100644 --- a/src/core1/code_18350.c +++ b/src/core1/code_18350.c @@ -5,11 +5,31 @@ #define BAD_DTOR (BAD_PI/180.0) /* .data*/ -extern u16 *D_80276CB8; //! ml_acosPrecValTblPtr +u32 D_80276CB0 = 0xD22FFFD8; //WHAT IS THIS? +u32 D_80276CB4 = 0xDEFEF692; //WHAT IS THIS? +u16 *D_80276CB8 = NULL; //! ml_acosPrecValTblPtr //! Might not be 90, but 91 or 92? Initial lowerIdx is OOB if 90 -extern f32 ml_acosValTbl[90]; //D_80276CBC +f32 ml_acosValTbl[90] = { //D_80276CBC + 1.0000000000, 0.9998480080, 0.9993910190, 0.9986299870, 0.9975640180, + 0.9961950180, 0.9945219760, 0.9925460220, 0.9902679920, 0.9876880050, + 0.9848080280, 0.9816269870, 0.9781479840, 0.9743700030, 0.9702960250, + 0.9659259920, 0.9612619880, 0.9563050270, 0.9510570170, 0.9455189700, + 0.9396929740, 0.9335799810, 0.9271839860, 0.9205049870, 0.9135450120, + 0.9063079950, 0.8987939950, 0.8910070060, 0.8829479810, 0.8746200200, + 0.8660249710, 0.8571670060, 0.8480479720, 0.8386710290, 0.8290380240, + 0.8191519980, 0.8090170030, 0.7986360190, 0.7880110140, 0.7771459820, + 0.7660440210, 0.7547100190, 0.7431449890, 0.7313539980, 0.7193400260, + 0.7071070080, 0.6946579810, 0.6819980140, 0.6691309810, 0.6560590270, + 0.6427879930, 0.6293200250, 0.6156619790, 0.6018149850, 0.5877850060, + 0.5735759740, 0.5591930150, 0.5446389910, 0.5299190280, 0.5150380130, + 0.5000000000, 0.4848099950, 0.4694719910, 0.4539909960, 0.4383710030, + 0.4226180020, 0.4067370000, 0.3907310070, 0.3746069970, 0.3583680090, + 0.3420200050, 0.3255679910, 0.3090170030, 0.2923719880, 0.2756370010, + 0.2588190140, 0.2419220060, 0.2249509990, 0.2079119980, 0.1908089970, + 0.1736480000, 0.1564340000, 0.1391730010, 0.1218689980, 0.1045280020, + 0.0871559978, 0.0697569996, 0.0523359999, 0.0348990001, 0.0174519997 +}; -// extern f32 func_8024C788(void); // .h diff --git a/src/core1/code_1BE90.c b/src/core1/code_1BE90.c index 724fb5ef..b8a7b82c 100644 --- a/src/core1/code_1BE90.c +++ b/src/core1/code_1BE90.c @@ -20,8 +20,8 @@ void func_8025ABB8(enum comusic_e, s32, s32, s32); void *func_802EDAA4(SLA **, s32*); /* .bss */ -extern CoMusic *D_80276E30; //active track ptr -extern int D_80276E34; +CoMusic *D_80276E30 = NULL; //active track ptr +int D_80276E34 = 0; /* .code */ CoMusic *func_802598B0(enum comusic_e track_id) { diff --git a/src/core1/code_1D5D0.c b/src/core1/code_1D5D0.c index bfe22a73..4d7036a2 100644 --- a/src/core1/code_1D5D0.c +++ b/src/core1/code_1D5D0.c @@ -4,6 +4,12 @@ #include "SnS.h" #include "save.h" +bool snsToRestoreItems = FALSE; +struct SnsPayload *snsBasePayloadPtr1 = NULL; +struct SnsPayload *snsBasePayloadPtr2 = NULL; +struct SnsPayload *snsBasePayloadPtr3 = NULL; +struct SnsPayload *snsBasePayloadPtr4 = NULL; + /* .bss */ StopNSwop_Data snsParsedKeys; struct GlobalSave gSaveData; diff --git a/src/core1/code_1E820.c b/src/core1/code_1E820.c index 12f7934d..4e6fd82d 100644 --- a/src/core1/code_1E820.c +++ b/src/core1/code_1E820.c @@ -2,7 +2,7 @@ #include "functions.h" #include "variables.h" -s64 D_80376E70; +s64 D_80376E70 = 0xAB8D9F7781280783; #pragma GLOBAL_ASM("asm/nonmatchings/core1/code_1E820/func_8025C240.s") diff --git a/src/core1/code_3A70.c b/src/core1/code_3A70.c index 094709a9..88cae1f2 100644 --- a/src/core1/code_3A70.c +++ b/src/core1/code_3A70.c @@ -13,9 +13,6 @@ Gfx D_80275880[] = { gsSPEndDisplayList() }; -extern f64 D_80277650; -extern f64 D_80277658; - /* .code */ void func_80241490(Gfx **gfx, Vtx **vtx, s32 *arg2[3], s32 arg3[3], s32 arg4[3], s32 arg5[3], s32 arg6, s32 arg7) { s32 spB4[3]; @@ -106,7 +103,7 @@ void func_802424D4(Gfx **gfx, Mtx **mtx, Vtx **vtx, f32 arg3[3], f32 arg4[3], f3 sp50[2] = arg4[2]; if ((arg3[0] != sp50[0]) || (arg3[1] != sp50[1]) || (arg3[2] != sp50[2])) { if ((arg3[0] == sp50[0]) && (arg3[2] == sp50[2])) { - sp50[0] += D_80277658; + sp50[0] += 0.05; } sp80[0] = sp50[0] - arg3[0]; sp80[1] = sp50[1] - arg3[1]; diff --git a/src/core1/code_7090.c b/src/core1/code_7090.c index db8c1a5f..9f774420 100644 --- a/src/core1/code_7090.c +++ b/src/core1/code_7090.c @@ -11,7 +11,7 @@ typedef struct struct_27_s{ u8 pad2[0x12]; }struct27s; -extern s16 * D_802758E0; +s16 * D_802758E0 = NULL; void func_80244C78(int arg0); diff --git a/src/core1/code_7F60.c b/src/core1/code_7F60.c index fde6cb71..d015b7e7 100644 --- a/src/core1/code_7F60.c +++ b/src/core1/code_7F60.c @@ -2,7 +2,8 @@ #include "functions.h" #include "variables.h" -extern f32 D_80275908; +u8 D_80275900[] = {0xCF, 0xAD, 0xA2, 0x90, 0x93, 0x4A, 0x83, 0xF1}; +f32 D_80275908 = BAD_DTOR; s32 func_80245980(f32 arg0){ return arg0*65536.0f; diff --git a/src/core1/code_9D30.c b/src/core1/code_9D30.c index 17027d18..fe8de73b 100644 --- a/src/core1/code_9D30.c +++ b/src/core1/code_9D30.c @@ -4,8 +4,8 @@ extern u16 D_803A5D00[2][0xF660]; //framebuffer -extern s32 D_80276588; //framebuffer width -extern s32 D_8027658C; //framebuffer height +extern s32 framebuffer_width; //framebuffer width +extern s32 framebuffer_height; //framebuffer height /* .data */ u8 D_80275A50[8][3] = { @@ -93,11 +93,11 @@ void func_80247750(s32 r, s32 g, s32 b){ void func_8024776C(s32 x, s32 y) { s32 rgba16; - if( ((x >= 0) && (x < D_80276588)) - && ((y >= 0) && (y < D_8027658C)) + if( ((x >= 0) && (x < framebuffer_width)) + && ((y >= 0) && (y < framebuffer_height)) ) { - D_803A5D00[0][x + y*D_80276588] = _SHIFTL(D_80275A68 >> 3, 11, 5) | _SHIFTL(D_80275A6C >> 3, 6, 5) | _SHIFTL(D_80275A70 >> 3, 1, 5) | _SHIFTL(1, 0, 1); - D_803A5D00[1][x + y*D_80276588] = _SHIFTL(D_80275A68 >> 3, 11, 5) | _SHIFTL(D_80275A6C >> 3, 6, 5) | _SHIFTL(D_80275A70 >> 3, 1, 5) | _SHIFTL(1, 0, 1); + D_803A5D00[0][x + y*framebuffer_width] = _SHIFTL(D_80275A68 >> 3, 11, 5) | _SHIFTL(D_80275A6C >> 3, 6, 5) | _SHIFTL(D_80275A70 >> 3, 1, 5) | _SHIFTL(1, 0, 1); + D_803A5D00[1][x + y*framebuffer_width] = _SHIFTL(D_80275A68 >> 3, 11, 5) | _SHIFTL(D_80275A6C >> 3, 6, 5) | _SHIFTL(D_80275A70 >> 3, 1, 5) | _SHIFTL(1, 0, 1); } } @@ -117,7 +117,7 @@ void func_80247818(s32 x, s32 y, s32 w, s32 h) { void func_802478C0(s32 r, s32 g, s32 b) { func_80247750(r, g, b); - func_80247818((D_80276588 - 128) / 2, (D_8027658C - 100) / 2, 128, 100); + func_80247818((framebuffer_width - 128) / 2, (framebuffer_height - 100) / 2, 128, 100); } void func_8024792C(void){} @@ -204,7 +204,7 @@ void func_80247C20(void) { } if (D_80275BE0) { - for(i = 0; i < D_80276588 * D_8027658C; i++){ + for(i = 0; i < framebuffer_width * framebuffer_height; i++){ D_803A5D00[0][i] = 0; D_803A5D00[1][i] = 0; } diff --git a/src/core1/code_ABB0.c b/src/core1/code_ABB0.c index 811a7aff..f21f8d60 100644 --- a/src/core1/code_ABB0.c +++ b/src/core1/code_ABB0.c @@ -14,8 +14,8 @@ void func_8024A85C(s32 buffer_indx); extern u16 D_803A5D00[2][0xF660]; //framebuffer -extern s32 D_80276588; //framebuffer width -extern s32 D_8027658C; //framebuffer height +extern s32 framebuffer_width; //framebuffer width +extern s32 framebuffer_height; //framebuffer height /* .bss */ s32 D_802806E0; @@ -70,12 +70,12 @@ void draw_sprite_ci4(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enable indx1 = ((*tmem) >> 4) & 0xF; indx2 = *tmem & 0xF; fb_x = (chunk->x + x) + ix; - if ((0 <= fb_x) && (fb_x < D_80276588)) + if ((0 <= fb_x) && (fb_x < framebuffer_width)) { fb_y = (chunk->y + y) + iy; - if ((fb_y >= 0) && (fb_y < D_8027658C)) + if ((fb_y >= 0) && (fb_y < framebuffer_height)) { - pxl_ptr = (framebuffer + fb_x) + (fb_y * D_80276588); + pxl_ptr = (framebuffer + fb_x) + (fb_y * framebuffer_width); color1 = palette[indx1]; if (color1 & 1) { *pxl_ptr = color1; @@ -141,12 +141,12 @@ void draw_sprite_ci8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enable for (iy = 0; iy < chunk->h; iy++){ for (ix = 0; ix < chunk->w; ix++){ fb_x = (chunk->x + x) + ix; - if ((0 <= fb_x) && (fb_x < D_80276588)) + if ((0 <= fb_x) && (fb_x < framebuffer_width)) { fb_y = (chunk->y + y) + iy; - if ((fb_y >= 0) && (fb_y < D_8027658C)) + if ((fb_y >= 0) && (fb_y < framebuffer_height)) { - pxl_ptr = (framebuffer + fb_x) + (fb_y * D_80276588); + pxl_ptr = (framebuffer + fb_x) + (fb_y * framebuffer_width); if (palette[*tmem] & 1){ *pxl_ptr = palette[*tmem]; } @@ -197,10 +197,10 @@ void draw_sprite_rgba16(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_en for(txtr_y = 0; txtr_y < chunk_ptr->h; txtr_y++) { for(txtr_x = 0; txtr_x < chunk_ptr->w; txtr_x++) { fb_x = chunk_ptr->x + x + txtr_x; - if ((fb_x >= 0) && (fb_x < D_80276588)) { + if ((fb_x >= 0) && (fb_x < framebuffer_width)) { fb_y = chunk_ptr->y + y + txtr_y; - if ((fb_y >= 0) && (fb_y < D_8027658C)) { - pxl_ptr = framebuffer_ptr + fb_x + (fb_y * D_80276588); + if ((fb_y >= 0) && (fb_y < framebuffer_height)) { + pxl_ptr = framebuffer_ptr + fb_x + (fb_y * framebuffer_width); rgba = *tmem; if (rgba & 1) { *pxl_ptr = rgba; @@ -244,12 +244,12 @@ void draw_sprite_i4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enable for(txtr_y = 0; txtr_y < chunk_ptr->h; txtr_y++) { for(txtr_x = 0; txtr_x < chunk_ptr->w; txtr_x += 2) { fb_x = chunk_ptr->x + x + txtr_x; - if ((fb_x >= 0) && (fb_x < D_80276588)) { + if ((fb_x >= 0) && (fb_x < framebuffer_width)) { fb_y = chunk_ptr->y + y + txtr_y; - if ((fb_y >= 0) && (fb_y < D_8027658C)) { + if ((fb_y >= 0) && (fb_y < framebuffer_height)) { p1 = (*tmem >> 4); p2 = (*tmem & 0xF); - fb_pxl_ptr = framebuffer_ptr + fb_x + (fb_y * D_80276588); + fb_pxl_ptr = framebuffer_ptr + fb_x + (fb_y * framebuffer_width); if (p1) { *fb_pxl_ptr = (p1 << 0xC) | (p1 << 0x7) | (p1 << 0x2) | 1; } else if (!aplha_enabled) { @@ -301,10 +301,10 @@ void draw_sprite_ia4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enabl for(txtr_y = 0; txtr_y < chunk_ptr->h; txtr_y++) { for(txtr_x = 0; txtr_x < chunk_ptr->w; txtr_x += 2) { fb_x = chunk_ptr->x + x + txtr_x; - if ((fb_x >= 0) && (fb_x < D_80276588)) { + if ((fb_x >= 0) && (fb_x < framebuffer_width)) { fb_y = chunk_ptr->y + y + txtr_y; - if ((fb_y >= 0) && (fb_y < D_8027658C)) { - fb_pxl_ptr = framebuffer_ptr + fb_x + (fb_y * D_80276588);\ + if ((fb_y >= 0) && (fb_y < framebuffer_height)) { + fb_pxl_ptr = framebuffer_ptr + fb_x + (fb_y * framebuffer_width);\ p1 = (*tmem >> 4); p2 = (*tmem & 0xF); p1_i = p1 & 0xE; @@ -358,10 +358,10 @@ void draw_sprite_i8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled for(txtr_x = 0; txtr_x < chunk_ptr->w; txtr_x++){ fb_x = chunk_ptr->x + x + txtr_x; if (fb_x >= 0) { - if (fb_x < D_80276588) { + if (fb_x < framebuffer_width) { fb_y = chunk_ptr->y + y + txtr_y; - if ((fb_y >= 0) && (fb_y < D_8027658C)) { - pixel_ptr = framebuffer_ptr + fb_x + fb_y * D_80276588; + if ((fb_y >= 0) && (fb_y < framebuffer_height)) { + pixel_ptr = framebuffer_ptr + fb_x + fb_y * framebuffer_width; intensity = (s32) *txtr_ptr >> 3; if (intensity != 0) { *pixel_ptr = (intensity << 0xB) | (intensity << 6) | (intensity << 1) | 1; @@ -406,10 +406,10 @@ void draw_sprite_ia8(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_enabl for(var_t3 = 0; var_t3 < chunk_ptr->h; var_t3++){ for(var_a3 = 0; var_a3 < chunk_ptr->w; var_a3++) { fb_x = chunk_ptr->x + x + var_a3; - if ((fb_x >= 0) && (fb_x < D_80276588)) { + if ((fb_x >= 0) && (fb_x < framebuffer_width)) { fb_y = chunk_ptr->y + y + var_t3; - if ((fb_y >= 0) && (fb_y < D_8027658C)) { - temp_a1 = framebuffer_ptr + fb_x + fb_y * D_80276588; + if ((fb_y >= 0) && (fb_y < framebuffer_height)) { + temp_a1 = framebuffer_ptr + fb_x + fb_y * framebuffer_width; temp_a2 = *var_t2; if (IA8_A(temp_a2)) { *temp_a1 = I4_2_RGBA16(IA8_I(temp_a2), 1); @@ -469,13 +469,13 @@ void draw_sprite_rgba32(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_ena for (ix = 0; ix < chunk_ptr->w; ix++) { fb_x = (chunk_ptr->x + x) + ix; - if ((fb_x >= 0) && (fb_x < D_80276588)) + if ((fb_x >= 0) && (fb_x < framebuffer_width)) { fb_y = (chunk_ptr->y + y) + iy; - if ((fb_y >= 0) && (fb_y < D_8027658C)) + if ((fb_y >= 0) && (fb_y < framebuffer_height)) { txtr_value = *tmem; - pxl_ptr = (framebuffer + fb_x) + (fb_y * D_80276588); + pxl_ptr = (framebuffer + fb_x) + (fb_y * framebuffer_width); fb_value = (unsigned int) (*pxl_ptr); alpha = _SHIFTR(txtr_value, 0, 8); if (alpha) {//blend texture with existing pixel color @@ -515,7 +515,7 @@ void draw_texture_ci4(s32 x, s32 y, void *tmem, s32 w, s32 h, bool alpha_enabled palette_ptr = (u16*)tmem; pixel_ptr = (u8*)&palette_ptr[0x10]; - framebuffer_ptr = &D_803A5D00[D_802806EC][x + y * D_80276588]; + framebuffer_ptr = &D_803A5D00[D_802806EC][x + y * framebuffer_width]; for(iy = 0; iy < h; iy++){ for(ix = 0; ix < w; ix++){ icolor = (ix & 1)? pixel_ptr[ix/2 + (iy*w)/2] & 0xF @@ -523,7 +523,7 @@ void draw_texture_ci4(s32 x, s32 y, void *tmem, s32 w, s32 h, bool alpha_enabled *framebuffer_ptr = palette_ptr[icolor]; framebuffer_ptr++; } - framebuffer_ptr += (D_80276588 - w); + framebuffer_ptr += (framebuffer_width - w); } } @@ -567,7 +567,7 @@ void func_80249DE0(s32 x, s32 y, s16 *arg2, s32 arg3, s32 arg4) { return; } //otherwise RGBA16 - framebuffer_ptr = &D_803A5D00[D_802806EC][x + y*D_80276588]; + framebuffer_ptr = &D_803A5D00[D_802806EC][x + y*framebuffer_width]; for(iy = 0; iy < temp_v0->h; iy++){ for(ix = 0; ix < temp_v0->w; ix++){ temp_v1 = *texture_ptr; @@ -579,7 +579,7 @@ void func_80249DE0(s32 x, s32 y, s16 *arg2, s32 arg3, s32 arg4) { texture_ptr++; framebuffer_ptr++; } - framebuffer_ptr += (D_80276588 - temp_v0->w); + framebuffer_ptr += (framebuffer_width - temp_v0->w); } } @@ -591,14 +591,14 @@ void func_8024A284(s32 x, s32 y, s32 arg2, s32 arg3, s32 horz_spacing, s32 vert_ s32 var_s2; s32 var_s3; - for(var_s2 = 0; var_s2 < D_80276588; var_s2 += horz_spacing){ - for(var_s3 = 0; var_s3 < D_8027658C; var_s3++){ + for(var_s2 = 0; var_s2 < framebuffer_width; var_s2 += horz_spacing){ + for(var_s3 = 0; var_s3 < framebuffer_height; var_s3++){ func_8024A3C8(x + var_s2, y + var_s3); } } - for(var_s3 = 0; var_s3 < D_8027658C; var_s3 += vert_spacing) { - for(var_s2 = 0; var_s2 < D_80276588; var_s2++){ + for(var_s3 = 0; var_s3 < framebuffer_height; var_s3 += vert_spacing) { + for(var_s2 = 0; var_s2 < framebuffer_width; var_s2++){ func_8024A3C8(x + var_s2, y + var_s3); } } @@ -609,8 +609,8 @@ void func_8024A3C8(s32 x, s32 y) { s32 temp_v0; if (x >= 0) { - if ((x < D_80276588) && (y >= 0) && (y < D_8027658C)) { - D_803A5D00[D_802806EC][x + y * D_80276588] = _SHIFTL(D_802806E0 >> 3, 11, 5) | _SHIFTL(D_802806E4 >> 3, 6, 5) | _SHIFTL(D_802806E8 >> 3, 1, 5) | _SHIFTL(1, 0, 1); + if ((x < framebuffer_width) && (y >= 0) && (y < framebuffer_height)) { + D_803A5D00[D_802806EC][x + y * framebuffer_width] = _SHIFTL(D_802806E0 >> 3, 11, 5) | _SHIFTL(D_802806E4 >> 3, 6, 5) | _SHIFTL(D_802806E8 >> 3, 1, 5) | _SHIFTL(1, 0, 1); } } } @@ -651,8 +651,8 @@ void func_8024A564(s32 x, s32 y, u16 *arg2, s32 arg3, s32 arg4, f32 arg5, f32 ar s16 *var_t0; s16 *var_t2; var_v0 = 0; - var_v1 = D_80276588; - var_t0 = &D_803A5D00[D_802806EC][x + (y * D_80276588)]; + var_v1 = framebuffer_width; + var_t0 = &D_803A5D00[D_802806EC][x + (y * framebuffer_width)]; new_var = (s32) (((f64) (256.0f / (new_var3 = arg6))) + 0.5); new_var2 = (s32) (((f64) (256.0f / arg5)) + 0.5); for (var_t1 = (arg4 * arg6) + 0.5; var_t1 != 0; var_t1--) @@ -667,7 +667,7 @@ void func_8024A564(s32 x, s32 y, u16 *arg2, s32 arg3, s32 arg4, f32 arg5, f32 ar var_t2++; } - var_t0 += D_80276588; + var_t0 += framebuffer_width; var_v0 += new_var; } diff --git a/src/core1/code_E360.c b/src/core1/code_E360.c index 2f593603..d015a3b5 100644 --- a/src/core1/code_E360.c +++ b/src/core1/code_E360.c @@ -14,8 +14,47 @@ typedef struct struct_1_s{ extern u32 D_80000300; -extern OSViMode D_80275C80; -extern OSViMode D_80275CD0; +OSViMode D_80275C80 = { + OS_VI_NTSC_LPN1, + { + VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON | 0x3200, /*ctrl*/ + 292, /* width*/ + 0x3E52239, /* burst*/ + 0x20D, /* vSync*/ + 0xC15, /* hSync*/ + 0xC150C15, /* leap */ + 0x8C02D5, /* hstart */ + 0x200, /* xScale */ + 0x0, /* vCurrent */ + }, + { + {0x248, 0x400, 0x3D01E8, 0xE0204, 2}, + {0x248, 0x400, 0x3D01E8, 0xE0204, 2}, + } +}; + +OSViMode D_80275CD0 = { + OS_VI_MPAL_LPN1, + { + VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON | 0x3200, /*ctrl*/ + 292, /* width*/ + 0x4651E39, /* burst*/ + 0x20D, /* vSync*/ + 0x40C11, /* hSync*/ + 0xC190C1A, /* leap */ + 0x8C02D5, /* hstart */ + 0x200, /* xScale */ + 0x0, /* vCurrent */ + }, + { + {0x248, 0x400, 0x3D01E8, 0xE0204, 2}, + {0x248, 0x400, 0x3D01E8, 0xE0204, 2}, + } +}; + +// 42200000 3FAD097B 41F00000 457A0000 +// C3A68832 DDC3A724 00000000 00000000 + u32 D_80280720; u32 D_80280724; @@ -183,8 +222,8 @@ void func_8024C408(s32 arg0){ void func_8024C428(void) { //zeros all both framebuffers - func_80253034(&D_803A5D00, 0, (s32) ((f32)D_80276588*2*D_8027658C*2)); - osWritebackDCache(&D_803A5D00, (s32) ((f32)D_80276588*2* D_8027658C*2)); + func_80253034(&D_803A5D00, 0, (s32) ((f32)framebuffer_width*2*framebuffer_height*2)); + osWritebackDCache(&D_803A5D00, (s32) ((f32)framebuffer_width*2* framebuffer_height*2)); } s32 func_8024C4E8(void){ diff --git a/src/core1/code_EAF0.c b/src/core1/code_EAF0.c index a525b965..865789be 100644 --- a/src/core1/code_EAF0.c +++ b/src/core1/code_EAF0.c @@ -6,10 +6,10 @@ extern void guPerspective(Mtx *, u16*, f32, f32, f32, f32, f32); extern f32 ml_vec3f_dot_product(f32[3], f32[3]); /* .data */ -extern f32 D_80275D20; //fovy -extern f32 D_80275D24; //aspect -extern f32 D_80275D28; //near -extern f32 D_80275D2C; //far +f32 D_80275D20 = 40.0f; //fovy +f32 D_80275D24 = 1.35185182f; //aspect +f32 D_80275D28 = 30.0f; //near +f32 D_80275D2C = 4000.0f; //far /* .data */ f32 D_80280EA0[3]; @@ -96,7 +96,7 @@ void func_8024C794(f32 *arg0, f32 *arg1, f32 *arg2){ void func_8024C7B8(Gfx **gfx, Mtx **mtx){ gSPViewport((*gfx)++, &D_80280F10[D_80281018]); - guOrtho(*mtx, -(2*(f32)D_80276588), (2*(f32)D_80276588), -(2*(f32)D_8027658C), (2*(f32)D_8027658C), 1.0f, 20.0f, 1.0f); + guOrtho(*mtx, -(2*(f32)framebuffer_width), (2*(f32)framebuffer_width), -(2*(f32)framebuffer_height), (2*(f32)framebuffer_height), 1.0f, 20.0f, 1.0f); gSPMatrix((*gfx)++, OS_K0_TO_PHYSICAL((*mtx)++), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); guTranslate(*mtx, 0.0f, 0.0f, 0.0f); @@ -153,7 +153,7 @@ f32 func_8024CC50(void){ } void func_8024CC5C(void){ - func_8024CE74((s32) ((f32)D_80276588/2), (s32) ((f32)D_8027658C/2), (s32) ((f32)D_80276588/2), (s32) ((f32)D_8027658C/2)); + func_8024CE74((s32) ((f32)framebuffer_width/2), (s32) ((f32)framebuffer_height/2), (s32) ((f32)framebuffer_width/2), (s32) ((f32)framebuffer_height/2)); } void func_8024CCC4(void){ @@ -395,13 +395,13 @@ bool func_8024E030(f32 arg0[3], f32 *arg1) return 0; } temp_f2 = gu_sqrtf((sp34[1] * sp34[1]) + (sp34[2] * sp34[2])) * sinf(sp28); - temp_f2_2 = (((f32) D_80276588) / ((f32) D_8027658C)) * temp_f2; - arg1[0] = (f32) (((sp34[0] / temp_f2_2) + 1) * (((f32) D_80276588) / 2)); - arg1[1] = (f32) ((1 - (sp34[1] / temp_f2)) * (((f32) D_8027658C) / 2)); - if ((arg1[0] < (-((f32) D_80276588))) || ((((f32) D_80276588) * 2) < arg1[0])) { + temp_f2_2 = (((f32) framebuffer_width) / ((f32) framebuffer_height)) * temp_f2; + arg1[0] = (f32) (((sp34[0] / temp_f2_2) + 1) * (((f32) framebuffer_width) / 2)); + arg1[1] = (f32) ((1 - (sp34[1] / temp_f2)) * (((f32) framebuffer_height) / 2)); + if ((arg1[0] < (-((f32) framebuffer_width))) || ((((f32) framebuffer_width) * 2) < arg1[0])) { return 0; } - if ((arg1[1] < (-((f32) D_8027658C))) || ((((f32) D_8027658C) * 2) < arg1[1])) { + if ((arg1[1] < (-((f32) framebuffer_height))) || ((((f32) framebuffer_height) * 2) < arg1[1])) { return 0; } return 1; diff --git a/src/core1/done/audio/n_sl.c b/src/core1/done/audio/n_sl.c index 8d21ca34..3c21883b 100644 --- a/src/core1/done/audio/n_sl.c +++ b/src/core1/done/audio/n_sl.c @@ -5,8 +5,8 @@ #include "n_libaudio.h" -extern N_ALSynth *D_80276E80; -extern N_ALSynth *n_syn; +N_ALSynth *D_80276E80 = NULL; +N_ALSynth *n_syn = NULL; void n_alInit(N_ALGlobals *g, ALSynConfig *config) { diff --git a/src/core1/done/code_1E360.c b/src/core1/done/code_1E360.c index 477e9a33..7a1b029e 100644 --- a/src/core1/done/code_1E360.c +++ b/src/core1/done/code_1E360.c @@ -8,7 +8,7 @@ * An index used to track the position in the outgoing payload * it should write the next key to. */ -extern s32 snsPayloadOutCurrPos; +s32 snsPayloadOutCurrPos = 0; /*.bss*/ /** diff --git a/src/core1/done/code_CE60.c b/src/core1/done/code_CE60.c index 0460eff4..183f20bf 100644 --- a/src/core1/done/code_CE60.c +++ b/src/core1/done/code_CE60.c @@ -15,11 +15,19 @@ typedef struct { void func_80250530(s32, u16 chan_mask, f32); /* .data */ -extern s32 D_80275C10; -extern s32 D_80275C14; -extern u8 D_80275C18; -extern u8 D_80275C1C; -extern Struct_Core1_CE60_0s D_80275C20[]; +s32 D_80275C10 = -1; +s32 D_80275C14 = 0; +u8 D_80275C18 = 0; +u8 D_80275C1C = 0; +Struct_Core1_CE60_0s D_80275C20[] = { + {0xE890, 0xF9D4, 0xDCD8, 0x2328, 0xE7C8, 0xFB34}, + {0xF95C, 0xFE73, 0xDCD8, 0x2328, 0xE69C, 0xF711}, + {0xFA83, 0xFFAB, 0xDCD8, 0x2328, 0xE886, 0xEFFB}, + {0xEA84, 0xF85B, 0xDCD8, 0x2328, 0xF830, 0xFD90}, + {0xFEC0, 0x0140, 0x05DC, 0x0960, 0xE890, 0xFE7B}, + {0xFD44, 0x05D8, 0xFD44, 0x06C2, 0xFC2E, 0x03D2}, + {0xE890, 0xF9D4, 0xDCD8, 0x2328, 0xE7C8, 0xFB34} +}; /* .bss */ s32 D_802806F0; diff --git a/src/core1/memory.c b/src/core1/memory.c index d2521519..1122c237 100644 --- a/src/core1/memory.c +++ b/src/core1/memory.c @@ -43,19 +43,20 @@ typedef struct empty_heap_block{ extern EmptyHeapBlock D_8002D500[LAST_HEAP_BLOCK + 1]; extern EmptyHeapBlock D_8023DA00; -extern struct{ - bool unk0; -}D_802765B0; -extern u32 heap_occupiedBytes; //occupied heap size -extern u8 D_80276594; -extern u8 D_80276598; -extern void *D_8027659C; -extern void *D_802765A0; -extern s32 D_802765A4; -extern void *D_802765A8; -extern s32 D_802765AC; -extern UNK_TYPE(void *) D_802765B4; +/* .data */ +u32 heap_occupiedBytes = 0; //occupied heap size +u8 D_80276594 = 0; +u8 D_80276598 = 0; +void *D_8027659C = NULL; +void *D_802765A0 = NULL; +s32 D_802765A4 = 0; +void *D_802765A8 = NULL; +s32 D_802765AC = 0; +struct{ + bool unk0; +}D_802765B0 = {0}; +UNK_TYPE(void *) D_802765B4 = NULL; /* .bss */ s32 D_80283220; diff --git a/src/core2/code_379B0.c b/src/core2/code_379B0.c index 1152a503..847ed2d5 100644 --- a/src/core2/code_379B0.c +++ b/src/core2/code_379B0.c @@ -25,7 +25,7 @@ void func_802BE940(void) { sp3C[1] = -1.0f; ml_vec3f_pitch_rotate_copy(sp24, sp3C, 68.0f); sp1C = 0.0f; - sp34 = sp24[1] * ((f32) D_80276588 / (f32) D_8027658C); + sp34 = sp24[1] * ((f32) framebuffer_width / (f32) framebuffer_height); D_8037DA40[0] = sp24[0]; D_8037DA40[1] = sp24[1]; D_8037DA40[2] = sp24[2]; diff --git a/src/core2/code_5C240.c b/src/core2/code_5C240.c index b1a990a2..56e4ccf7 100644 --- a/src/core2/code_5C240.c +++ b/src/core2/code_5C240.c @@ -10,8 +10,8 @@ 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 s32 framebuffer_width; //framebuffer_width +extern s32 framebuffer_height; //framebuffer_height extern s16 D_803A5D00[2][0xF660]; //framebuffer /* .bss */ @@ -34,7 +34,7 @@ void func_802E31D0(s32 arg0) { 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))); + osWritebackDCache(D_803A5D00[arg0], (s32) ((f32) framebuffer_width * (f32) framebuffer_height * sizeof(s16))); } } @@ -52,14 +52,14 @@ void func_802E329C(s32 arg0, Gfx **gfx_begin, Gfx **gfx_end) { 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); + func_80254084(&gfx, 0, 0, (s32) (f32) framebuffer_width, (s32) (f32) framebuffer_height, 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_80254084(&gfx, 0, 0, (s32) (f32) framebuffer_width, (s32) (f32) framebuffer_height, 0, 0, 0); func_8024C904(&gfx, &mtx); func_802F1858(D_8037E8C0.unk10, &gfx, &mtx, &vtx); } diff --git a/src/core2/code_5DBC0.c b/src/core2/code_5DBC0.c index a36813a5..317ff79c 100644 --- a/src/core2/code_5DBC0.c +++ b/src/core2/code_5DBC0.c @@ -481,7 +481,7 @@ void func_802E6628(s32 arg0, char *arg1) { sp2C = func_802E4E54(0); arg0 *= D_8037E900->unk4[sp2C].height; - func_802E502C((s32) (((f32) D_80276588 - (f32) func_802E51A4(arg1, sp2C, 0, D_8037E900->flags)) / 2), arg0, sp2C, arg1, sp28); + func_802E502C((s32) (((f32) framebuffer_width - (f32) func_802E51A4(arg1, sp2C, 0, D_8037E900->flags)) / 2), arg0, sp2C, arg1, sp28); } void func_802E66F0(s32 arg0, char *arg1) { @@ -491,7 +491,7 @@ void func_802E66F0(s32 arg0, char *arg1) { sp24 = func_802E4E54(0); arg0 *= D_8037E900->unk4[sp24].height; - func_802E502C((s32) (((f32) D_80276588 - (f32) func_802E51A4(arg1, sp24, 0, D_8037E900->flags)) / 2), arg0, sp24, arg1, D_8037E900->unk1C); + func_802E502C((s32) (((f32) framebuffer_width - (f32) func_802E51A4(arg1, sp24, 0, D_8037E900->flags)) / 2), arg0, sp24, arg1, D_8037E900->unk1C); } void func_802E67AC(void){ diff --git a/src/core2/code_6A4B0.c b/src/core2/code_6A4B0.c index 76ba5070..a1455637 100644 --- a/src/core2/code_6A4B0.c +++ b/src/core2/code_6A4B0.c @@ -100,7 +100,7 @@ void func_802F1440(Struct_Core2_6A4B0_2 *arg0, Gfx **gfx, Mtx **mtx, Vtx **vtx) gSPVertex((*gfx)++, osVirtualToPhysical(sp9C), 16, 0); for(sp4C = 0; sp4C < 6; sp4C++){ for(sp50 = 0; sp50 < 9; sp50++){ - gDPLoadTextureTile((*gfx)++, osVirtualToPhysical((u16*)arg0->unk8 + (sp4C*0x20 + 0xC) * D_80276588 + (sp50*0x20 + 1)), G_IM_FMT_RGBA, G_IM_SIZ_16b, D_80276588, 0, 0, 0, 33, 33, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + gDPLoadTextureTile((*gfx)++, osVirtualToPhysical((u16*)arg0->unk8 + (sp4C*0x20 + 0xC) * framebuffer_width + (sp50*0x20 + 1)), G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, 0, 0, 0, 33, 33, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); for(sp54 = 0; sp54 < 2; sp54++){ gSP1Triangle((*gfx)++, var_s3, var_s3 + 1, var_s3 + 2, 0); var_s3 += 3; @@ -154,12 +154,12 @@ Struct_Core2_6A4B0_2 *func_802F18F0(void){ void func_802F1934(Struct_Core2_6A4B0_2 * arg0, s32 arg1){ func_802F18B8(arg0); - arg0->unk4 = malloc(D_80276588*D_8027658C*sizeof(u16) + 0x10); + arg0->unk4 = malloc(framebuffer_width*framebuffer_height*sizeof(u16) + 0x10); arg0->unk8 = arg0->unk4; while((arg0->unk8 & 0x10) == 0){ (arg0->unk8)++; } - func_80253010(arg0->unk8, D_803A5D00[arg1], D_80276588*D_8027658C*sizeof(u16)); + func_80253010(arg0->unk8, D_803A5D00[arg1], framebuffer_width*framebuffer_height*sizeof(u16)); osWriteBackDCacheAll(); } @@ -186,8 +186,8 @@ void func_802F1A10(Struct_Core2_6A4B0_2 *arg0, f32 arg1) { cos = cosf(arg1 * 2 * BAD_PI); sin = sinf(arg1 * 2 * BAD_PI); func_8024C5CC(spC0); - spCC[0] = (-(D_80276588 / 2) * 4) + 8; - spCC[1] = ((D_8027658C / 2) * 4) - 0x38; + spCC[0] = (-(framebuffer_width / 2) * 4) + 8; + spCC[1] = ((framebuffer_height / 2) * 4) - 0x38; spCC[2] = -0xA; for(var_s6 = 0; var_s6 < 6; var_s6++){ for(var_s4 = 0; var_s4 < 9; var_s4++){ diff --git a/src/core2/code_6B030.c b/src/core2/code_6B030.c index 252d0358..effe3474 100644 --- a/src/core2/code_6B030.c +++ b/src/core2/code_6B030.c @@ -83,23 +83,23 @@ void func_802F1FC0(Struct65s *self, Gfx **gfx, Mtx **mtx, Vtx **vtx) { func_8025235C(&spD0, &spD0); spD0[0] = (-297.0f * spD0[0]) / spD0[2]; spD0[1] = (297.0f * spD0[1]) / spD0[2]; - spC4 = (s32) (spD0[0] + (f32) (D_80276588 / 2)); - spC0 = (s32) (spD0[1] + (f32) (D_8027658C / 2)); + spC4 = (s32) (spD0[0] + (f32) (framebuffer_width / 2)); + spC0 = (s32) (spD0[1] + (f32) (framebuffer_height / 2)); if (spC4 < 0) { spC4 = 0; - } else if (D_80276588 - 0x20 < spC4) { - spC4 = D_80276588 - 0x20; + } else if (framebuffer_width - 0x20 < spC4) { + spC4 = framebuffer_width - 0x20; } if (spC0 < 0) { spC0 = 0; - } else if (D_8027658C - 0x20 < spC0) { - spC0 = D_8027658C - 0x20; + } else if (framebuffer_height - 0x20 < spC0) { + spC0 = framebuffer_height - 0x20; } gSPDisplayList((*gfx)++, D_80368AC0); func_80347FC0(gfx, D_80368AB0[1].unk0, 0, 0, 0, 0, 0, NULL, NULL, &width, &height); - temp_addr = &D_803A5D00[func_8024BD80()][spC0*D_80276588 + (spC4 & 0xFFFC)]; - gDPSetTextureImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, D_80276588, temp_addr); + temp_addr = &D_803A5D00[func_8024BD80()][spC0*framebuffer_width + (spC4 & 0xFFFC)]; + gDPSetTextureImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, temp_addr); gDPSetTile((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 9, 0x0080, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOLOD); gDPLoadSync((*gfx)++); gDPLoadTile((*gfx)++, G_TX_LOADTILE, 0, 0, 0x008C, 0x007C); diff --git a/src/core2/code_6DA30.c b/src/core2/code_6DA30.c index 387ede61..ff4e72e0 100644 --- a/src/core2/code_6DA30.c +++ b/src/core2/code_6DA30.c @@ -738,14 +738,14 @@ void _printbuffer_draw_letter(s32 letter, f32* xPtr, f32* yPtr, f32 arg3, Gfx ** f32 temp_f24; f32 temp_f0_3; - spC0 = f28 - (D_8027658C - 1)*0.5; + spC0 = f28 - (framebuffer_height - 1)*0.5; temp_f24 = sp214->x - 1.0; spD0 = sp214->y - 1.0; gSPVertex((*gfx)++, *vtx, 4, 0); for(f28 = 0.0f; f28 < 2.0f; f28+= 1.0f){ for(temp_f0_3 = 0.0f; temp_f0_3 < 2.0f; temp_f0_3 += 1.0f){ - (*vtx)->v.ob[0] = (s16)(((f64)sp214->x*arg3*temp_f0_3 + ((f64)sp200 - D_80276588 * 0.5)) * 4.0); - (*vtx)->v.ob[1] = (s16)(((f64)spD0*arg3*f28 + ((f64)sp200 - D_80276588 * 0.5)) * 4.0); + (*vtx)->v.ob[0] = (s16)(((f64)sp214->x*arg3*temp_f0_3 + ((f64)sp200 - framebuffer_width * 0.5)) * 4.0); + (*vtx)->v.ob[1] = (s16)(((f64)spD0*arg3*f28 + ((f64)sp200 - framebuffer_width * 0.5)) * 4.0); (*vtx)->v.ob[2] = -0x14; (*vtx)->v.tc[0] = (s16)(temp_f0_3*temp_f24*64.0f); (*vtx)->v.tc[1] = (s16)(f28*spD0*64.0f); diff --git a/src/core2/code_763D0.c b/src/core2/code_763D0.c index f85f8481..575a5590 100644 --- a/src/core2/code_763D0.c +++ b/src/core2/code_763D0.c @@ -6,8 +6,8 @@ f32 time_getDelta(void); f32 func_802FB0DC(struct8s *); f32 func_802FB0E4(struct8s *); -extern s32 D_80276588; //framebuffer_w -extern s32 D_8027658C; //framebuffer_h +extern s32 framebuffer_width; //framebuffer_w +extern s32 framebuffer_height; //framebuffer_h Gfx D_80369920[] = { @@ -152,8 +152,8 @@ void func_802FD360(struct8s *arg0, Gfx **gfx, Mtx **mtx, Vtx **vtx){ tmp_f26 = (arg0->unk20 == ITEM_0_HOURGLASS_TIMER && spAC == 0x10) ? 1.0f : 0.0f; for(tmp_s4 = 0; tmp_s4 < 2; tmp_s4++){//L802FD528 for(tmp_s2 = 0; tmp_s2 < 2; tmp_s2++){// - (*vtx)->v.ob[0] = ((func_802FB0DC(arg0) + (((spAC*arg0->unk40*tmp_s2 - spAC*arg0->unk40/2) - (f32)D_80276588/2) + arg0->unk38)) + tmp_f26) * 4.0f; - (*vtx)->v.ob[1] = ((((spA8*arg0->unk40/2 - spA8*arg0->unk40*tmp_s4) + (f32)D_8027658C/2) - arg0->unk3C) - func_802FB0E4(arg0)*arg0->unk4C)*4.0f; + (*vtx)->v.ob[0] = ((func_802FB0DC(arg0) + (((spAC*arg0->unk40*tmp_s2 - spAC*arg0->unk40/2) - (f32)framebuffer_width/2) + arg0->unk38)) + tmp_f26) * 4.0f; + (*vtx)->v.ob[1] = ((((spA8*arg0->unk40/2 - spA8*arg0->unk40*tmp_s4) + (f32)framebuffer_height/2) - arg0->unk3C) - func_802FB0E4(arg0)*arg0->unk4C)*4.0f; (*vtx)->v.ob[2] = -0x14; (*vtx)->v.tc[0] = ((spAC -1) * tmp_s2) << 6; (*vtx)->v.tc[1] = ((spA8 -1) * tmp_s4) << 6; diff --git a/src/core2/code_76D90.c b/src/core2/code_76D90.c index 73af87a0..03bf42a7 100644 --- a/src/core2/code_76D90.c +++ b/src/core2/code_76D90.c @@ -139,8 +139,8 @@ void func_802FDEE0(s32 arg0, struct8s *arg1, Gfx **arg2, Mtx **arg3, Vtx **arg4) } } } - sp128 = (244.0f - ((f32) D_80276588 / 2)); - sp124 = func_802FB0E4(arg1) + ((f32) D_8027658C / 2) - 246.0f; + sp128 = (244.0f - ((f32) framebuffer_width / 2)); + sp124 = func_802FB0E4(arg1) + ((f32) framebuffer_height / 2) - 246.0f; guTranslate(*arg3, sp128 * 4.0f, sp124 * 4.0f, 0.0f); gSPMatrix((*arg2)++, OS_K0_TO_PHYSICAL((*arg3)++), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); guRotate(*arg3, func_802FDE60(D_803815D8 + D_803815DC), 0.0f, 0.0f, 1.0f); diff --git a/src/core2/code_77E50.c b/src/core2/code_77E50.c index ab33680a..2ad8e633 100644 --- a/src/core2/code_77E50.c +++ b/src/core2/code_77E50.c @@ -14,7 +14,7 @@ void func_802FEDE0(BKTextureList *texture_list, s32 indx, s32 x_offset, s32 y_of frame_buffer_ptr = D_803A5D00[func_8024BDA0()]; for(y = 0; y < 32; y++){//L802FEE60 for(x = 0; x < 32; x++){//L802FEE68 - sp24[32*(31 - y) + x] = frame_buffer_ptr[(y_offset + y)*D_80276588 + (x_offset + x)] | 1; //framebuffer to texture??? + sp24[32*(31 - y) + x] = frame_buffer_ptr[(y_offset + y)*framebuffer_width + (x_offset + x)] | 1; //framebuffer to texture??? }; }; } @@ -25,12 +25,12 @@ void func_802FEF48(BKModelBin *model_bin){ s32 x, y; texture_list = func_8033A104(model_bin); - osInvalDCache((void *)D_803A5D00[func_8024BDA0()], D_80276588 * D_8027658C*2); + osInvalDCache((void *)D_803A5D00[func_8024BDA0()], framebuffer_width * framebuffer_height*2); for(y = 0; y < 8; y++){//L802FEFEC for(x = 0; x < 10; x++){ //get textures from framebuffer??? - func_802FEDE0(texture_list, 10*y + x, 32*x + (D_80276588 - 10*32)/2, (s32)32*y + (D_8027658C - 8*32)/2); + func_802FEDE0(texture_list, 10*y + x, 32*x + (framebuffer_width - 10*32)/2, (s32)32*y + (framebuffer_height - 8*32)/2); } }; diff --git a/src/core2/code_78100.c b/src/core2/code_78100.c index 2ebe4a87..94f21384 100644 --- a/src/core2/code_78100.c +++ b/src/core2/code_78100.c @@ -188,8 +188,8 @@ void fxjinjoscore_draw(s32 arg0, struct8s *arg1, Gfx **gfx, Mtx **mtx, Vtx **vtx // If the jinjo is collected then it's drawn fully opaque, otherwise it's drawn with partial alpha gDPSetPrimColor((*gfx)++, 0, 0, 0x00, 0x00, 0x00, jinjo_collected ? 0xFF : 0x6E); } - center_x = pos_x - (f32) D_80276588 / 2 + x_offset; - center_y = (f32) D_8027658C / 2 + func_802FB0E4(arg1) - 266.0f + 40.0f + y_offset - D_80381E78[jinjo_id]; + center_x = pos_x - (f32) framebuffer_width / 2 + x_offset; + center_y = (f32) framebuffer_height / 2 + func_802FB0E4(arg1) - 266.0f + 40.0f + y_offset - D_80381E78[jinjo_id]; gSPVertex((*gfx)++, *vtx, 4, 0); // Set up the positions of the four vertices for(i = 0; i < 2; i++){ diff --git a/src/core2/code_78E50.c b/src/core2/code_78E50.c index eb843399..fd30805a 100644 --- a/src/core2/code_78E50.c +++ b/src/core2/code_78E50.c @@ -154,9 +154,9 @@ void func_802FFED4(s32 item_id, struct8s *arg1){ // var_fp = var_s4 + 4; // sp104 = temp_v0_5; // } -// temp_s5 = (s32) ((40.0f - ((f32) D_80276588 / 2.0f)) + (f32) spE0); +// temp_s5 = (s32) ((40.0f - ((f32) framebuffer_width / 2.0f)) + (f32) spE0); // temp_f12 = (f32) temp_s5; -// temp_f14 = (f32) (s32) (((((f32) D_8027658C / 2.0f) - func_802FB0E4(arg1)) - -16.0f) - (f32) spDC); +// temp_f14 = (f32) (s32) (((((f32) framebuffer_height / 2.0f) - func_802FB0E4(arg1)) - -16.0f) - (f32) spDC); // for(var_v1 = 0; var_v1 != var_s2; var_v1++){ // temp_f2 = (f32) var_v1; // temp_s2 = var_s2 - 1; diff --git a/src/core2/code_79C80.c b/src/core2/code_79C80.c index 62918ea4..3c500c40 100644 --- a/src/core2/code_79C80.c +++ b/src/core2/code_79C80.c @@ -4,8 +4,8 @@ extern f32 func_802FB0E4(struct8s*); -extern s32 D_80276588; -extern s32 D_8027658C; +extern s32 framebuffer_width; +extern s32 framebuffer_height; /* .data */ BKSprite * D_8036A910 = NULL; @@ -105,8 +105,8 @@ void func_80300D0C(enum item_e item_id, struct8s *arg1, Gfx **gfx, Mtx **mtx, Vt else{//L80300F58 gDPSetPrimColor((*gfx)++, 0, 0, 0xFF, 0xFF, 0xFF, 0x78); } - f20 = 96.0f - (f32)D_80276588/2 + (i*13); - f14 = (f32)D_8027658C/2 - func_802FB0E4(arg1) - D_80381F08[s6] - -48.0f; + f20 = 96.0f - (f32)framebuffer_width/2 + (i*13); + f14 = (f32)framebuffer_height/2 - func_802FB0E4(arg1) - D_80381F08[s6] - -48.0f; f14 = (i & 1) ? f14 + 5.75 : f14 - 5.75; gSPVertex((*gfx)++, *vtx, 4, 0); for(tmp_v1 = 0; tmp_v1 < 2; tmp_v1++){//L8030101C diff --git a/src/core2/code_7A760.c b/src/core2/code_7A760.c index 857a860e..08854c16 100644 --- a/src/core2/code_7A760.c +++ b/src/core2/code_7A760.c @@ -80,8 +80,8 @@ void func_803017D0(enum item_e item_id, struct8s *arg1, Gfx **gfx, Mtx **mtx, Vt } temp_f16 = func_802FB0E4(arg1); temp_f16 = (-40.0f + temp_f16); - var_f14 = (temp_f16 + D_80381F68[var_s6]) - ((f32) D_80276588 / 2); - temp_f16 = (((var_s4 * 15.5) + 78.0) - ((f32) D_8027658C / 2)); + var_f14 = (temp_f16 + D_80381F68[var_s6]) - ((f32) framebuffer_width / 2); + temp_f16 = (((var_s4 * 15.5) + 78.0) - ((f32) framebuffer_height / 2)); var_f14 = (var_s4 & 1) ? var_f14 + 5.0f : var_f14 - 5.0f; gSPVertex((*gfx)++, *vtx, 4, 0); for(var_v1 = 0; var_v1 < 2; var_v1++){ diff --git a/src/core2/code_8DC20.c b/src/core2/code_8DC20.c index c6dd034c..f6908fc4 100644 --- a/src/core2/code_8DC20.c +++ b/src/core2/code_8DC20.c @@ -40,10 +40,10 @@ void func_80314BB0(Gfx **gfx, Mtx **mtx, Vtx **vtx, void * frame_buffer_1, void s32 y; gSPDisplayList((*gfx)++, D_8036C630); - gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, D_80276588, OS_PHYSICAL_TO_K0(frame_buffer_1)); - for(y = 0; y < D_8027658C / 32 + 1; y++){ - for(x = 0; x < D_80276588 / 32 + 1; x++){ - gDPLoadTextureTile((*gfx)++, osVirtualToPhysical(frame_buffer_2), G_IM_FMT_RGBA, G_IM_SIZ_16b, D_80276588, D_8027658C, + gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, OS_PHYSICAL_TO_K0(frame_buffer_1)); + for(y = 0; y < framebuffer_height / 32 + 1; y++){ + for(x = 0; x < framebuffer_width / 32 + 1; x++){ + gDPLoadTextureTile((*gfx)++, osVirtualToPhysical(frame_buffer_2), G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, framebuffer_height, 0x20*x, 0x20*y, 0x20*(x + 1) - 1, 0x20*(y + 1) - 1, NULL, G_TX_CLAMP, G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, 0, 0 ); @@ -53,7 +53,7 @@ void func_80314BB0(Gfx **gfx, Mtx **mtx, Vtx **vtx, void * frame_buffer_1, void } } gSPDisplayList((*gfx)++, D_8036C690); - gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, D_80276588, OS_PHYSICAL_TO_K0(D_803A5D00[func_8024BDA0()])); + gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, OS_PHYSICAL_TO_K0(D_803A5D00[func_8024BDA0()])); } void func_80315084(Gfx **gfx, Mtx **mtx, Vtx **vtx){ diff --git a/src/core2/code_AD5B0.c b/src/core2/code_AD5B0.c index dbdce9a5..d065b6ef 100644 --- a/src/core2/code_AD5B0.c +++ b/src/core2/code_AD5B0.c @@ -27,7 +27,7 @@ void func_80334540(Gfx** gdl, Mtx **mptr, Vtx **vptr) { f32 sp40; if (D_803835E0 == 0) { - func_80254084(gdl, 0, 0, D_80276588, D_8027658C, 0, 0, 0); + func_80254084(gdl, 0, 0, framebuffer_width, framebuffer_height, 0, 0, 0); func_802BBD2C(&sp44, &sp40); func_8024CE60(sp44, sp40); func_8024C904(gdl, mptr); diff --git a/src/core2/code_C97F0.c b/src/core2/code_C97F0.c index c713d9c7..4e263fdd 100644 --- a/src/core2/code_C97F0.c +++ b/src/core2/code_C97F0.c @@ -136,14 +136,14 @@ void func_80350818(Gfx **gfx, Mtx **mtx, Vtx **vtx) { sp9C[2] = temp_s1->unk4[2]; ml_vec3f_yaw_rotate_copy(sp9C, sp9C, -spD0[1]); ml_vec3f_pitch_rotate_copy(sp9C, sp9C, -spD0[0]); - if (!(((1.2 * (f32)D_80276588) / 2) < sp9C[0]) && !(sp9C[0] < ((-1.2 * (f32)D_80276588) / 2))) { - if (!(((1.2 * (f32)D_8027658C) / 2) < sp9C[1]) && !(sp9C[1] < ((-1.2 * (f32)D_8027658C) / 2))) { + if (!(((1.2 * (f32)framebuffer_width) / 2) < sp9C[0]) && !(sp9C[0] < ((-1.2 * (f32)framebuffer_width) / 2))) { + if (!(((1.2 * (f32)framebuffer_height) / 2) < sp9C[1]) && !(sp9C[1] < ((-1.2 * (f32)framebuffer_height) / 2))) { sp90[0] = -sp9C[0]; sp90[1] = -sp9C[1]; sp90[2] = sp9C[2]; ml_vec3f_pitch_rotate_copy(sp90, sp90, spD0[0]); ml_vec3f_yaw_rotate_copy(sp90, sp90, spD0[1]); - var_f22 = 1.0f - (((sp9C[0] * sp9C[0]) + (sp9C[1] * sp9C[1])) / ((f32)D_8027658C * (f32)D_8027658C)); + var_f22 = 1.0f - (((sp9C[0] * sp9C[0]) + (sp9C[1] * sp9C[1])) / ((f32)framebuffer_height * (f32)framebuffer_height)); if (var_f22 < 0.0f) { var_f22 = 0.0f; } @@ -181,7 +181,7 @@ void func_80350BFC(void) { if (D_80386170.unk4 != NULL) { D_80386170.unk0 = func_80350780(D_80386170.unk4->unk10); D_80386170.unk8 = assetcache_get(0x882); - ml_vec3f_set_length(D_80386170.unk4->unk4, (2*(f32)D_80276588) / 2); + ml_vec3f_set_length(D_80386170.unk4->unk4, (2*(f32)framebuffer_width) / 2); D_8038617C.unk0 = 1; D_8038617C.unk1 = 0; } diff --git a/src/core2/gc/bound.c b/src/core2/gc/bound.c index 0a38405b..437331c7 100644 --- a/src/core2/gc/bound.c +++ b/src/core2/gc/bound.c @@ -26,7 +26,7 @@ u8 _gcbound_blue; //D_80380902 void _gcbound_draw(Gfx** dl, s32 a, s32 r, s32 g, s32 b){ gSPDisplayList((*dl)++, &D_803688E8); gDPSetFogColor((*dl)++, r, g, b, a); - gSPTextureRectangle((*dl)++, 0, 0, (D_80276588-1)<<2, (D_8027658C-1)<<2, 0, 0, 0, 0x100, 0x100); + gSPTextureRectangle((*dl)++, 0, 0, (framebuffer_width-1)<<2, (framebuffer_height-1)<<2, 0, 0, 0, 0x100, 0x100); } void gcbound_draw(Gfx** dl){ diff --git a/src/core2/gc/pauseMenu.c b/src/core2/gc/pauseMenu.c index 4c7b0bef..7092e606 100644 --- a/src/core2/gc/pauseMenu.c +++ b/src/core2/gc/pauseMenu.c @@ -1280,7 +1280,7 @@ void gcpausemenu_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) { } gcpausemenu_drawSprite(gfx, mtx, vtx, D_80383010.joystick_sprite, D_80383010.joystick_frame, 30.0f, 196.0f, 1, (s32) D_80383010.left_joystick_alpha); - gcpausemenu_drawSprite(gfx, mtx, vtx, D_80383010.joystick_sprite, D_80383010.joystick_frame, (f32) (D_80276588 - 0x1E), 196.0f, 0, (s32) D_80383010.right_joystick_alpha); + gcpausemenu_drawSprite(gfx, mtx, vtx, D_80383010.joystick_sprite, D_80383010.joystick_frame, (f32) (framebuffer_width - 0x1E), 196.0f, 0, (s32) D_80383010.right_joystick_alpha); var_a0 =((*((u32 *)&D_80383010.state) << 0x1c) >> 0x1f); //left_joystick_visible if ( var_a0 != 0) { if (D_80383010.left_joystick_alpha < 0xFF) { @@ -1303,7 +1303,7 @@ void gcpausemenu_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) { D_80383010.right_joystick_alpha = (D_80383010.right_joystick_alpha - 0xC > 0) ? D_80383010.right_joystick_alpha - 0xC : 0; } } - gcpausemenu_drawSprite(gfx, mtx, vtx, D_80383010.b_button_sprite, (s32) D_80383010.b_button_frame, D_80276588 * 0.5, 196.0f, 0, (s32) D_80383010.b_button_alpha); + gcpausemenu_drawSprite(gfx, mtx, vtx, D_80383010.b_button_sprite, (s32) D_80383010.b_button_frame, framebuffer_width * 0.5, 196.0f, 0, (s32) D_80383010.b_button_alpha); var_a0 = ((*((u32 *)&D_80383010.state) << 0x1e) >> 0x1f);//b_button_visible if (var_a0 != 0) { if (D_80383010.b_button_alpha < 0xFF) { diff --git a/src/core2/gc/sky.c b/src/core2/gc/sky.c index c266c4c4..f113d6d1 100644 --- a/src/core2/gc/sky.c +++ b/src/core2/gc/sky.c @@ -76,7 +76,7 @@ void sky_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx){ func_8024CE60(5.0f, 15000.0f); if(gcSky.model_bins[0]){ - func_80254084(gfx, 0, 0, (s32)(f32) D_80276588, (s32)(f32)D_8027658C,0, 0, 0); //fill screen with black + func_80254084(gfx, 0, 0, (s32)(f32) framebuffer_width, (s32)(f32)framebuffer_height,0, 0, 0); //fill screen with black func_8024C904(gfx, mtx); func_8024C5CC(position); for(i = 0; i < 3; i++){ @@ -90,7 +90,7 @@ void sky_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx){ } } else{//L8030B200 - func_80254084(gfx, 0, 0, (s32)(f32) D_80276588, (s32)(f32)D_8027658C, 0, 0, 0); + func_80254084(gfx, 0, 0, (s32)(f32) framebuffer_width, (s32)(f32)framebuffer_height, 0, 0, 0); }//L8030B254 } diff --git a/src/core2/gc/zoombox.c b/src/core2/gc/zoombox.c index 6083589d..e6e8cf50 100644 --- a/src/core2/gc/zoombox.c +++ b/src/core2/gc/zoombox.c @@ -869,7 +869,7 @@ void func_803164B0(gczoombox_t *this, Gfx **gfx, Mtx **mtx, s32 arg3, s32 arg4, } sp2C[1] = this->unk172 + ((f32) arg4 * this->unk198); sp2C[2] = -10.0f; - func_80252330((sp2C[0] * 4.0f) - ((f32)D_80276588 * 2), ((f32)D_8027658C * 2) - (sp2C[1] * 4.0f), sp2C[2]); + func_80252330((sp2C[0] * 4.0f) - ((f32)framebuffer_width * 2), ((f32)framebuffer_height * 2) - (sp2C[1] * 4.0f), sp2C[2]); temp_f12 = (f32) ((f64) this->unk198 * 0.8); mlMtxScale_xyz(temp_f12, temp_f12, 1.0f); mlMtxApply(*mtx); @@ -1413,8 +1413,8 @@ gczoombox_t *gczoombox_new(s32 arg0, enum talk_pic_e portrait_id, s32 arg2, s32 this->unk1A4_24 = arg3; if(this->unk1A4_24){ this->unk16A = 45; - this->unk174 = D_80276588 - 0x25; - this->unk170 = D_80276588 + 0x66; + this->unk174 = framebuffer_width - 0x25; + this->unk170 = framebuffer_width + 0x66; }else{ this->unk16A = 71; this->unk174 = 0x25; @@ -1610,9 +1610,9 @@ void func_80318640(gczoombox_t *this, s32 arg1, f32 arg2, f32 arg3, s32 arg4) { if (this != NULL) { if (this->unk1A4_24) { - this->unk174 = D_80276588 - arg1; + this->unk174 = framebuffer_width - arg1; this->unk16A = arg1 + (8.0f * arg2); - this->unk170 = (D_80276588 - arg1) + 0x8B; + this->unk170 = (framebuffer_width - arg1) + 0x8B; } else { this->unk174 = arg1; phi_v0 = arg4 ? 0x28 : 0x22; diff --git a/symbol_addrs.us.v10.txt b/symbol_addrs.us.v10.txt index 0b94fcc7..e15dadd6 100644 --- a/symbol_addrs.us.v10.txt +++ b/symbol_addrs.us.v10.txt @@ -332,9 +332,10 @@ __osLeoResume = 0x8027225C; alSynAllocFX = 0x80272350; D_80275844 = 0x80275844; D_80275848 = 0x80275848; +D_802758C0 = 0x802758C0; // size:0xC D_802759F8 = 0x802759F8; -D_80276588 = 0x80276588; -D_8027658C = 0x8027658C; +framebuffer_width = 0x80276588; +framebuffer_height = 0x8027658C; n_syn = 0x80276E84; alGlobals = 0x80277140; __osPiTable = 0x8027717C; diff --git a/undefined_syms.us.v10.txt b/undefined_syms.us.v10.txt index 06c6fcc9..38d9bf15 100644 --- a/undefined_syms.us.v10.txt +++ b/undefined_syms.us.v10.txt @@ -18,6 +18,7 @@ core1_D_803727F4 = 0x803727F4; __osBaseTimer = 0x80285D00; FP_D_80392864 = 0x80392864; D_803687F0 = 0x803687F0; +D_80276E70 = 0x80276E70; n_aspMainTextStart = _binary_bin_core1_n_aspMain_text_bin_start; n_aspMainTextEnd = _binary_bin_core1_n_aspMain_text_bin_end;