Further documentations have been made:

- src/fight: named more variables and functions, named some parameters
- src/core1, src/core2: named some dummy functions, documented a bit of the graphics stack
This commit is contained in:
mariob92
2024-09-06 19:37:28 +02:00
parent fbeb744fc6
commit 539d6f4804
25 changed files with 521 additions and 505 deletions

View File

@@ -14,28 +14,28 @@ typedef struct {
extern u8 D_803A5D00[2][0x1ecc0];
/* .data */
Gfx *D_80276580[2] = {NULL, NULL};
Gfx *gGfxStack[2] = {NULL, NULL};
s32 framebuffer_width = 292;
s32 framebuffer_height = 216;
/* .bss */
Mtx *D_80282FF0[2];
Vtx *D_80282FF8[2];
s32 D_80283000;
s32 D_80283004;
Mtx *gMtxStack[2];
Vtx *gVtxStack[2];
s32 gStackSelector;
s32 gTextureFilterPoint;
Struct_Core1_15B30 D_80283008[20];
s32 D_802831E8;
OSMesgQueue D_802831F0;
OSMesg D_80283208;
u16 D_8028320C;
u16 D_8028320E;
u16 D_80283210;
u16 D_80283212;
u16 gScissorBoxLeft;
u16 gScissorBoxRight;
u16 gScissorBoxTop;
u16 gScissorBoxBottom;
Gfx *D_80283214;
/* .h */
void func_80254348(void);
void func_80254464(void);
void scissorBox_setDefault(void);
void dummy_func_80254464(void);
/* .code */
void func_80253550(void){
@@ -71,13 +71,13 @@ void func_80253640(Gfx ** gdl, void *arg1){
gDPPipelineMode((*gdl)++, G_PM_NPRIMITIVE);
gDPSetAlphaCompare((*gdl)++, G_AC_NONE);
gDPSetColorDither((*gdl)++, G_CD_MAGICSQ);
gDPSetScissor((*gdl)++, G_SC_NON_INTERLACE, D_8028320C, D_8028320E, D_80283210, D_80283212);
gDPSetScissor((*gdl)++, G_SC_NON_INTERLACE, gScissorBoxLeft, gScissorBoxRight, gScissorBoxTop, gScissorBoxBottom);
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);
if(D_80283004){
if(gTextureFilterPoint){
gDPSetTextureFilter((*gdl)++, G_TF_POINT);
}else{
gDPSetTextureFilter((*gdl)++, G_TF_BILERP);
@@ -85,24 +85,24 @@ void func_80253640(Gfx ** gdl, void *arg1){
gDPSetTextureLOD((*gdl)++, G_TL_TILE);
gDPSetTextureLUT((*gdl)++, G_TT_NONE);
gDPSetTexturePersp((*gdl)++, G_TP_PERSP);
func_802534CC(gdl);
zBuffer_set(gdl);
}
void func_802539AC(Gfx **gdl, s32 arg1){
void scissorBox_SetForGameMode(Gfx **gdl, s32 framebuffer_idx) {
if(getGameMode() == GAME_MODE_8_BOTTLES_BONUS || getGameMode() == GAME_MODE_A_SNS_PICTURE)
{
func_8030C710();
scissorBox_setSmall();
func_80253640(gdl, func_8030C704());
}
else{
func_80254348();
func_80253640(gdl, D_803A5D00[arg1]);
scissorBox_setDefault();
func_80253640(gdl, D_803A5D00[framebuffer_idx]);
}
}
void func_80253A58(Gfx **gfx, s32 arg1){
void setupScissorBoxAndFramebuffer(Gfx **gfx, s32 framebuffer_address){
gSPSegment((*gfx)++, 0x00, 0x00000000);
gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, OS_PHYSICAL_TO_K0(arg1));
gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, OS_PHYSICAL_TO_K0(framebuffer_address));
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);
@@ -113,20 +113,20 @@ void func_80253A58(Gfx **gfx, s32 arg1){
gDPSetColorDither((*gfx)++, G_CD_DISABLE);
gDPSetRenderMode((*gfx)++, G_RM_AA_ZB_XLU_LINE, G_RM_AA_ZB_XLU_LINE2);
gSPClipRatio((*gfx)++, FRUSTRATIO_1);
gDPSetScissor((*gfx)++, G_SC_NON_INTERLACE, D_8028320C, D_8028320E, D_80283210, D_80283212);
gDPSetScissor((*gfx)++, G_SC_NON_INTERLACE, gScissorBoxLeft, gScissorBoxRight, gScissorBoxTop, gScissorBoxBottom);
gDPPipeSync((*gfx)++);
}
void func_80253D60(Gfx **gfx, s32 arg1){
func_80254348();
func_80253A58(gfx, D_803A5D00[arg1]);
void setupDefaultScissorBoxAndFramebuffer(Gfx **gfx, s32 framebuffer_idx){
scissorBox_setDefault();
setupScissorBoxAndFramebuffer(gfx, D_803A5D00[framebuffer_idx]);
}
void func_80253DC0(Gfx **gfx){
func_802476EC(gfx);
}
void func_80253DE0(Gfx **gdl) {
void finishFrame(Gfx **gdl) {
gDPFullSync((*gdl)++);
gSPEndDisplayList((*gdl)++);
}
@@ -174,11 +174,11 @@ void func_80253F94(Gfx **arg0, Gfx **arg1){
func_80253EE4(arg0, arg1, 0x40000000);
}
void func_80253FB4(u32 *arg0, u32 *arg1, u32 *arg2, u32 *arg3){
*arg0 = D_8028320C;
*arg1 = D_80283210;
*arg2 = D_8028320E;
*arg3 = D_80283212;
void scissorBox_get(u32 *left, u32 *top, u32 *right, u32 *bottom){
*left = gScissorBoxLeft;
*top = gScissorBoxTop;
*right = gScissorBoxRight;
*bottom = gScissorBoxBottom;
}
void func_80253FE8(void){
@@ -194,10 +194,10 @@ void func_80254028(void){
osCreateMesgQueue(&D_802831F0, &D_80283208, 1);
osSendMesg(&D_802831F0, NULL, 1);
func_80247560();
func_80254348();
scissorBox_setDefault();
}
void func_80254084(Gfx **gfx, s32 x, s32 y, s32 w, s32 h, s32 r, s32 g, s32 b){
void drawRectangle2D(Gfx **gfx, s32 x, s32 y, s32 w, s32 h, s32 r, s32 g, s32 b){
gDPPipeSync((*gfx)++);
gDPPipelineMode((*gfx)++, G_PM_NPRIMITIVE);
gDPSetCycleType((*gfx)++, G_CYC_FILL);
@@ -206,45 +206,45 @@ void func_80254084(Gfx **gfx, s32 x, s32 y, s32 w, s32 h, s32 r, s32 g, s32 b){
gDPScisFillRectangle((*gfx)++, x, y, x + w -1, y + h -1);
}
void func_802541E8(void){
if(D_80276580[0]){
free(D_80276580[0]);
free(D_80276580[1]);
free(D_80282FF0[0]);
free(D_80282FF0[1]);
free(D_80282FF8[0]);
free(D_80282FF8[1]);
D_80276580[0] = NULL;
void graphicsCache_release(void){
if(gGfxStack[0]){
free(gGfxStack[0]);
free(gGfxStack[1]);
free(gMtxStack[0]);
free(gMtxStack[1]);
free(gVtxStack[0]);
free(gVtxStack[1]);
gGfxStack[0] = NULL;
}
}
void func_8025425C(void){
if(D_80276580[0] == NULL){
D_80276580[0] = (Gfx *)malloc(29600);
D_80276580[1] = (Gfx *)malloc(29600);
D_80282FF0[0] = (Mtx *)malloc(44800);
D_80282FF0[1] = (Mtx *)malloc(44800);
D_80282FF8[0] = (Vtx *)malloc(6880);
D_80282FF8[1] = (Vtx *)malloc(6880);
func_80254464();
void graphicsCache_init(void){
if(gGfxStack[0] == NULL){
gGfxStack[0] = (Gfx *)malloc(29600); // 3700 dlist commands
gGfxStack[1] = (Gfx *)malloc(29600);
gMtxStack[0] = (Mtx *)malloc(44800); // 700 matrices
gMtxStack[1] = (Mtx *)malloc(44800);
gVtxStack[0] = (Vtx *)malloc(6880); // 430 vertices
gVtxStack[1] = (Vtx *)malloc(6880);
dummy_func_80254464();
}
D_80283000 = 0;
D_80283004 = 0;
gStackSelector = 0;
gTextureFilterPoint = 0;
}
void func_802542F4(s32 arg0, s32 arg1, s32 arg2, s32 arg3) {
D_8028320C = arg0;
D_80283210 = arg1;
D_8028320E = arg2;
D_80283212 = arg3;
framebuffer_width = arg1 - arg0;
framebuffer_height = arg3 - arg2;
void scissorBox_set(s32 left, s32 top, s32 right, s32 bottom) {
gScissorBoxLeft = left;
gScissorBoxTop = top;
gScissorBoxRight = right;
gScissorBoxBottom = bottom;
framebuffer_width = top - left;
framebuffer_height = bottom - right;
func_8024CC5C();
}
void func_80254348(void){
func_802542F4(0, 0x124, 0, 0xd8);
void scissorBox_setDefault(void){
scissorBox_set(0, 292, 0, 216);
}
void func_80254374(s32 arg0) {
@@ -259,16 +259,16 @@ void func_80254374(s32 arg0) {
func_80246670(sp1C);
}
void func_802543EC(void){
u32 ret_val = D_80283004;
D_80283004 = ret_val < 1;
void toggleTextureFilterPoint(void){
u32 ret_val = gTextureFilterPoint;
gTextureFilterPoint = ret_val < 1;
}
void func_80254404(Gfx **gfx, Mtx **mtx, Vtx **vtx){
D_80283000 = (1 - D_80283000);
*gfx = D_80276580[D_80283000];
*mtx = D_80282FF0[D_80283000];
*vtx = D_80282FF8[D_80283000];
void getGraphicsStacks(Gfx **gfx, Mtx **mtx, Vtx **vtx){
gStackSelector = (1 - gStackSelector);
*gfx = gGfxStack[gStackSelector];
*mtx = gMtxStack[gStackSelector];
*vtx = gVtxStack[gStackSelector];
}
void func_80254464(void){}
void dummy_func_80254464(void){}