mirror of https://github.com/zeldaret/mm.git
z_viszbuf (code_801420C0) OK (#1211)
* first pass * Match * variables.txt * Update include/functions.h Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com> --------- Co-authored-by: angie <angheloalf95@gmail.com>
This commit is contained in:
parent
255c4599bf
commit
8efba39749
|
|
@ -2133,9 +2133,10 @@ void VisMono_Destroy(VisMono* this);
|
|||
// void VisMono_DesaturateDList(Gfx* gfx);
|
||||
void VisMono_Draw(VisMono* this, Gfx** gfxp);
|
||||
// void VisMono_DrawOld(VisMono* this);
|
||||
void func_801420C0(void* arg0);
|
||||
void func_801420F4(void* arg0);
|
||||
void func_80142100(void* arg0, Gfx** gfx, u32 arg2);
|
||||
|
||||
void VisZbuf_Init(VisZbuf* this);
|
||||
void VisZbuf_Destroy(VisZbuf* this);
|
||||
void VisZbuf_Draw(VisZbuf* this, Gfx** gfxP, void* zbuffer);
|
||||
|
||||
// void func_80147520(void);
|
||||
void func_80147564(PlayState* play);
|
||||
|
|
@ -2374,7 +2375,7 @@ void AudioMgr_Init(AudioMgr* audioMgr, void* stack, OSPri pri, OSId id, SchedCon
|
|||
|
||||
void Game_UpdateFramerateVariables(s32 divisor);
|
||||
void Game_SetFramerateDivisor(GameState* gameState, s32 divisor);
|
||||
void GameState_SetFBFilter(Gfx** gfx, u32 arg1);
|
||||
void GameState_SetFBFilter(Gfx** gfx, void* zbuffer);
|
||||
void Game_Nop80173534(GameState* gameState);
|
||||
void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx);
|
||||
void GameState_SetFrameBuffer(GraphicsContext* gfxCtx);
|
||||
|
|
|
|||
|
|
@ -2440,7 +2440,7 @@ extern u8 sMotionBlurStatus;
|
|||
|
||||
extern UNK_TYPE1 D_801F7FF0;
|
||||
extern struct_801F8010 D_801F8010;
|
||||
extern struct_801F8020 D_801F8020;
|
||||
extern VisZbuf sVisZbuf;
|
||||
extern VisMono sMonoColors;
|
||||
extern UNK_TYPE1 D_801F8048;
|
||||
extern FaultAddrConvClient sGraphFaultAddrConvClient;
|
||||
|
|
|
|||
|
|
@ -755,9 +755,9 @@ typedef struct {
|
|||
typedef struct {
|
||||
/* 0x0 */ u32 useRgba;
|
||||
/* 0x4 */ u32 setScissor;
|
||||
/* 0x8 */ Color_RGBA8 primColor;
|
||||
/* 0xC */ Color_RGBA8 envColor;
|
||||
} struct_801F8020; // size = 0x10
|
||||
/* 0x8 */ Color_RGBA8_u32 primColor;
|
||||
/* 0xC */ Color_RGBA8_u32 envColor;
|
||||
} VisZbuf; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 unk_00;
|
||||
|
|
|
|||
2
spec
2
spec
|
|
@ -527,7 +527,7 @@ beginseg
|
|||
include "build/data/code/code_80140CE0.data.o"
|
||||
include "build/src/code/code_80140E80.o"
|
||||
include "build/src/code/z_vismono.o"
|
||||
include "build/src/code/code_801420C0.o"
|
||||
include "build/src/code/z_viszbuf.o"
|
||||
include "build/src/code/z_vr_box.o"
|
||||
include "build/src/code/z_vr_box_draw.o"
|
||||
include "build/src/code/z_sram_NES.o"
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
#include "global.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_801420C0/func_801420C0.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_801420C0/func_801420F4.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_801420C0/func_80142100.s")
|
||||
|
|
@ -22,7 +22,7 @@ void Game_SetFramerateDivisor(GameState* gameState, s32 divisor) {
|
|||
Game_UpdateFramerateVariables(divisor);
|
||||
}
|
||||
|
||||
void GameState_SetFBFilter(Gfx** gfx, u32 arg1) {
|
||||
void GameState_SetFBFilter(Gfx** gfx, void* zbuffer) {
|
||||
Gfx* dlist = *gfx;
|
||||
|
||||
if ((R_FB_FILTER_TYPE > 0) && (R_FB_FILTER_TYPE < 5)) {
|
||||
|
|
@ -31,21 +31,19 @@ void GameState_SetFBFilter(Gfx** gfx, u32 arg1) {
|
|||
D_801F8010.color.g = R_FB_FILTER_PRIM_COLOR(1);
|
||||
D_801F8010.color.b = R_FB_FILTER_PRIM_COLOR(2);
|
||||
D_801F8010.color.a = R_FB_FILTER_A;
|
||||
func_80140D10(&D_801F8010, &dlist, arg1);
|
||||
} else {
|
||||
if ((R_FB_FILTER_TYPE == 5) || (R_FB_FILTER_TYPE == 6)) {
|
||||
D_801F8020.useRgba = (R_FB_FILTER_TYPE == 6);
|
||||
D_801F8020.primColor.r = R_FB_FILTER_PRIM_COLOR(0);
|
||||
D_801F8020.primColor.g = R_FB_FILTER_PRIM_COLOR(1);
|
||||
D_801F8020.primColor.b = R_FB_FILTER_PRIM_COLOR(2);
|
||||
D_801F8020.primColor.a = R_FB_FILTER_A;
|
||||
D_801F8020.envColor.r = R_FB_FILTER_ENV_COLOR(0);
|
||||
D_801F8020.envColor.g = R_FB_FILTER_ENV_COLOR(1);
|
||||
D_801F8020.envColor.b = R_FB_FILTER_ENV_COLOR(2);
|
||||
D_801F8020.envColor.a = R_FB_FILTER_A;
|
||||
func_80142100(&D_801F8020, &dlist, arg1);
|
||||
} else {
|
||||
if (R_FB_FILTER_TYPE == 7) {
|
||||
func_80140D10(&D_801F8010, &dlist, zbuffer);
|
||||
} else if ((R_FB_FILTER_TYPE == 5) || (R_FB_FILTER_TYPE == 6)) {
|
||||
sVisZbuf.useRgba = (R_FB_FILTER_TYPE == 6);
|
||||
sVisZbuf.primColor.r = R_FB_FILTER_PRIM_COLOR(0);
|
||||
sVisZbuf.primColor.g = R_FB_FILTER_PRIM_COLOR(1);
|
||||
sVisZbuf.primColor.b = R_FB_FILTER_PRIM_COLOR(2);
|
||||
sVisZbuf.primColor.a = R_FB_FILTER_A;
|
||||
sVisZbuf.envColor.r = R_FB_FILTER_ENV_COLOR(0);
|
||||
sVisZbuf.envColor.g = R_FB_FILTER_ENV_COLOR(1);
|
||||
sVisZbuf.envColor.b = R_FB_FILTER_ENV_COLOR(2);
|
||||
sVisZbuf.envColor.a = R_FB_FILTER_A;
|
||||
VisZbuf_Draw(&sVisZbuf, &dlist, zbuffer);
|
||||
} else if (R_FB_FILTER_TYPE == 7) {
|
||||
sMonoColors.unk_00 = 0;
|
||||
sMonoColors.primColor.r = R_FB_FILTER_PRIM_COLOR(0);
|
||||
sMonoColors.primColor.g = R_FB_FILTER_PRIM_COLOR(1);
|
||||
|
|
@ -57,8 +55,6 @@ void GameState_SetFBFilter(Gfx** gfx, u32 arg1) {
|
|||
sMonoColors.envColor.a = R_FB_FILTER_A;
|
||||
VisMono_Draw(&sMonoColors, &dlist);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*gfx = dlist;
|
||||
}
|
||||
|
|
@ -76,7 +72,7 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) {
|
|||
gSPDisplayList(OVERLAY_DISP++, nextDisplayList);
|
||||
|
||||
if (R_FB_FILTER_TYPE && R_FB_FILTER_ENV_COLOR(3) == 0) {
|
||||
GameState_SetFBFilter(&nextDisplayList, (u32)gfxCtx->zbuffer);
|
||||
GameState_SetFBFilter(&nextDisplayList, gfxCtx->zbuffer);
|
||||
}
|
||||
|
||||
if (R_ENABLE_ARENA_DBG < 0) {
|
||||
|
|
@ -215,7 +211,7 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g
|
|||
init(gameState);
|
||||
|
||||
func_80140CE0(&D_801F8010);
|
||||
func_801420C0(&D_801F8020);
|
||||
VisZbuf_Init(&sVisZbuf);
|
||||
VisMono_Init(&sMonoColors);
|
||||
func_80140898(&D_801F8048);
|
||||
func_801773A0(&D_801F7FF0);
|
||||
|
|
@ -237,7 +233,7 @@ void GameState_Destroy(GameState* gameState) {
|
|||
Rumble_Destroy();
|
||||
func_801773C4(&D_801F7FF0);
|
||||
func_80140D04(&D_801F8010);
|
||||
func_801420F4(&D_801F8020);
|
||||
VisZbuf_Destroy(&sVisZbuf);
|
||||
VisMono_Destroy(&sMonoColors);
|
||||
func_80140900(&D_801F8048);
|
||||
THA_Destroy(&gameState->heap);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
#include "global.h"
|
||||
|
||||
#define VISZBUF_ZBUFFRAG_HEIGHT (TMEM_SIZE / (D_801FBBCC * G_IM_SIZ_16b_BYTES))
|
||||
|
||||
void VisZbuf_Init(VisZbuf* this) {
|
||||
this->useRgba = false;
|
||||
this->setScissor = false;
|
||||
this->primColor.r = 255;
|
||||
this->primColor.g = 255;
|
||||
this->primColor.b = 255;
|
||||
this->primColor.a = 255;
|
||||
this->envColor.r = 0;
|
||||
this->envColor.g = 0;
|
||||
this->envColor.b = 0;
|
||||
this->envColor.a = 255;
|
||||
}
|
||||
|
||||
void VisZbuf_Destroy(VisZbuf* this) {
|
||||
}
|
||||
|
||||
void VisZbuf_Draw(VisZbuf* this, Gfx** gfxP, void* zbuffer) {
|
||||
Gfx* gfx = *gfxP;
|
||||
s32 height = VISZBUF_ZBUFFRAG_HEIGHT;
|
||||
s32 y;
|
||||
s32 fmt = !this->useRgba ? G_IM_FMT_IA : G_IM_FMT_RGBA;
|
||||
|
||||
if (zbuffer == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
if (this->setScissor == true) {
|
||||
gSPDisplayList(gfx++, D_0E000000.setScissor);
|
||||
}
|
||||
|
||||
gDPSetOtherMode(gfx++,
|
||||
G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_POINT | G_TT_NONE | G_TL_TILE |
|
||||
G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
|
||||
G_AC_NONE | G_ZS_PRIM | G_RM_OPA_SURF | G_RM_OPA_SURF2);
|
||||
gDPSetCombineLERP(gfx++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT,
|
||||
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT);
|
||||
gDPSetColor(gfx++, G_SETPRIMCOLOR, this->primColor.rgba);
|
||||
gDPSetColor(gfx++, G_SETENVCOLOR, this->envColor.rgba);
|
||||
|
||||
for (y = 0; y < (D_801FBBCE - height) + 1; y += height) {
|
||||
gDPLoadTextureTile(gfx++, zbuffer, fmt, G_IM_SIZ_16b, D_801FBBCC, 0, 0, y, D_801FBBCC - 1, (y + height) - 1, 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);
|
||||
|
||||
gSPTextureRectangle(gfx++, 0, y << 2, D_801FBBCC << 2, (y + height) << 2, G_TX_RENDERTILE, 0, y << 5, 1 << 10,
|
||||
1 << 10);
|
||||
}
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
*gfxP = gfx;
|
||||
}
|
||||
|
|
@ -431,7 +431,7 @@
|
|||
0x80140CE0 : "code_80140CE0",
|
||||
0x80140E80 : "code_80140E80",
|
||||
0x801418B0 : "z_vismono",
|
||||
0x801420C0 : "code_801420C0",
|
||||
0x801420C0 : "z_viszbuf",
|
||||
0x80142440 : "z_vr_box",
|
||||
0x801435A0 : "z_vr_box_draw",
|
||||
0x80143A10 : "z_sram_NES",
|
||||
|
|
|
|||
|
|
@ -2775,9 +2775,9 @@
|
|||
0x80141C34:("VisMono_DesaturateDList",),
|
||||
0x80141E60:("VisMono_Draw",),
|
||||
0x8014204C:("VisMono_DrawOld",),
|
||||
0x801420C0:("func_801420C0",),
|
||||
0x801420F4:("func_801420F4",),
|
||||
0x80142100:("func_80142100",),
|
||||
0x801420C0:("VisZbuf_Init",),
|
||||
0x801420F4:("VisZbuf_Destroy",),
|
||||
0x80142100:("VisZbuf_Draw",),
|
||||
0x80142440:("func_80142440",),
|
||||
0x80143148:("func_80143148",),
|
||||
0x801431E8:("Skybox_Setup",),
|
||||
|
|
|
|||
|
|
@ -4067,7 +4067,7 @@
|
|||
0x801F6FE8:("sSlowlyStack","u8","[4096]",0x1000),
|
||||
0x801F7FF0:("D_801F7FF0","UNK_TYPE1","",0x1),
|
||||
0x801F8010:("D_801F8010","struct_801F8010","",0x10),
|
||||
0x801F8020:("D_801F8020","struct_801F8020","",0x10),
|
||||
0x801F8020:("sVisZbuf","VisZbuf","",0x10),
|
||||
0x801F8030:("sMonoColors","VisMono","",0x18),
|
||||
0x801F8048:("D_801F8048","UNK_TYPE1","",0x1),
|
||||
0x801F80D0:("sGraphFaultAddrConvClient","FaultAddrConvClient","",0xc),
|
||||
|
|
|
|||
|
|
@ -2289,9 +2289,9 @@ asm/non_matchings/code/z_vismono/VisMono_DesaturateTLUT.s,VisMono_DesaturateTLUT
|
|||
asm/non_matchings/code/z_vismono/VisMono_DesaturateDList.s,VisMono_DesaturateDList,0x80141C34,0x8B
|
||||
asm/non_matchings/code/z_vismono/VisMono_Draw.s,VisMono_Draw,0x80141E60,0x7B
|
||||
asm/non_matchings/code/z_vismono/VisMono_DrawOld.s,VisMono_DrawOld,0x8014204C,0x1D
|
||||
asm/non_matchings/code/code_801420C0/func_801420C0.s,func_801420C0,0x801420C0,0xD
|
||||
asm/non_matchings/code/code_801420C0/func_801420F4.s,func_801420F4,0x801420F4,0x3
|
||||
asm/non_matchings/code/code_801420C0/func_80142100.s,func_80142100,0x80142100,0xD0
|
||||
asm/non_matchings/code/z_viszbuf/VisZbuf_Init.s,VisZbuf_Init,0x801420C0,0xD
|
||||
asm/non_matchings/code/z_viszbuf/VisZbuf_Destroy.s,VisZbuf_Destroy,0x801420F4,0x3
|
||||
asm/non_matchings/code/z_viszbuf/VisZbuf_Draw.s,VisZbuf_Draw,0x80142100,0xD0
|
||||
asm/non_matchings/code/z_vr_box/func_80142440.s,func_80142440,0x80142440,0x342
|
||||
asm/non_matchings/code/z_vr_box/func_80143148.s,func_80143148,0x80143148,0x28
|
||||
asm/non_matchings/code/z_vr_box/Skybox_Setup.s,Skybox_Setup,0x801431E8,0x4F
|
||||
|
|
|
|||
|
Loading…
Reference in New Issue