z64vi*.h and sys_cfb.h headers (#1259)

* z64vimode.h

* z64viscvg.h

* z64vis*.h

* VisCvg

* sys_cfb.h

* a bit of naming

* review

* Renames

* bss

* fix

* bss

* bss

* bss

* messed up the merge

* bss is borken

* reordering 2

* remove prevent header from fault.c
This commit is contained in:
Anghelo Carvajal
2023-08-09 19:44:31 -04:00
committed by GitHub
parent 17b774effe
commit d107b6c2a9
37 changed files with 300 additions and 196 deletions
+45 -34
View File
@@ -1,11 +1,22 @@
#include "global.h"
#include "audiomgr.h"
#include "idle.h"
#include "sys_cfb.h"
#include "system_malloc.h"
#include "z64debug_text.h"
#include "z64rumble.h"
#include "z64vimode.h"
#include "z64viscvg.h"
#include "z64vismono.h"
#include "z64viszbuf.h"
#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h"
extern UNK_TYPE1 D_801F7FF0;
extern VisCvg sGameVisCvg;
extern VisZbuf sGameVisZbuf;
extern VisMono sGameVisMono;
extern ViMode sGameViMode;
s32 gFramerateDivisor = 1;
f32 gFramerateDivisorF = 1.0f;
f32 gFramerateDivisorHalf = 1.0f / 2.0f;
@@ -28,34 +39,34 @@ void GameState_SetFBFilter(Gfx** gfx, void* zbuffer) {
Gfx* dlist = *gfx;
if ((R_FB_FILTER_TYPE > 0) && (R_FB_FILTER_TYPE < 5)) {
D_801F8010.type = R_FB_FILTER_TYPE;
D_801F8010.color.r = R_FB_FILTER_PRIM_COLOR(0);
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;
VisCvg_Draw(&D_801F8010, &dlist);
sGameVisCvg.type = R_FB_FILTER_TYPE;
sGameVisCvg.color.r = R_FB_FILTER_PRIM_COLOR(0);
sGameVisCvg.color.g = R_FB_FILTER_PRIM_COLOR(1);
sGameVisCvg.color.b = R_FB_FILTER_PRIM_COLOR(2);
sGameVisCvg.color.a = R_FB_FILTER_A;
VisCvg_Draw(&sGameVisCvg, &dlist);
} 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);
sGameVisZbuf.useRgba = (R_FB_FILTER_TYPE == 6);
sGameVisZbuf.primColor.r = R_FB_FILTER_PRIM_COLOR(0);
sGameVisZbuf.primColor.g = R_FB_FILTER_PRIM_COLOR(1);
sGameVisZbuf.primColor.b = R_FB_FILTER_PRIM_COLOR(2);
sGameVisZbuf.primColor.a = R_FB_FILTER_A;
sGameVisZbuf.envColor.r = R_FB_FILTER_ENV_COLOR(0);
sGameVisZbuf.envColor.g = R_FB_FILTER_ENV_COLOR(1);
sGameVisZbuf.envColor.b = R_FB_FILTER_ENV_COLOR(2);
sGameVisZbuf.envColor.a = R_FB_FILTER_A;
VisZbuf_Draw(&sGameVisZbuf, &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);
sMonoColors.primColor.b = R_FB_FILTER_PRIM_COLOR(2);
sMonoColors.primColor.a = R_FB_FILTER_A;
sMonoColors.envColor.r = R_FB_FILTER_ENV_COLOR(0);
sMonoColors.envColor.g = R_FB_FILTER_ENV_COLOR(1);
sMonoColors.envColor.b = R_FB_FILTER_ENV_COLOR(2);
sMonoColors.envColor.a = R_FB_FILTER_A;
VisMono_Draw(&sMonoColors, &dlist);
sGameVisMono.unk_00 = 0;
sGameVisMono.primColor.r = R_FB_FILTER_PRIM_COLOR(0);
sGameVisMono.primColor.g = R_FB_FILTER_PRIM_COLOR(1);
sGameVisMono.primColor.b = R_FB_FILTER_PRIM_COLOR(2);
sGameVisMono.primColor.a = R_FB_FILTER_A;
sGameVisMono.envColor.r = R_FB_FILTER_ENV_COLOR(0);
sGameVisMono.envColor.g = R_FB_FILTER_ENV_COLOR(1);
sGameVisMono.envColor.b = R_FB_FILTER_ENV_COLOR(2);
sGameVisMono.envColor.a = R_FB_FILTER_A;
VisMono_Draw(&sGameVisMono, &dlist);
}
*gfx = dlist;
@@ -209,10 +220,10 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g
init(gameState);
VisCvg_Init(&D_801F8010);
VisZbuf_Init(&sVisZbuf);
VisMono_Init(&sMonoColors);
ViMode_Init(&D_801F8048);
VisCvg_Init(&sGameVisCvg);
VisZbuf_Init(&sGameVisZbuf);
VisMono_Init(&sGameVisMono);
ViMode_Init(&sGameViMode);
func_801773A0(&D_801F7FF0);
Rumble_Init();
@@ -230,10 +241,10 @@ void GameState_Destroy(GameState* gameState) {
Rumble_Destroy();
func_801773C4(&D_801F7FF0);
VisCvg_Destroy(&D_801F8010);
VisZbuf_Destroy(&sVisZbuf);
VisMono_Destroy(&sMonoColors);
ViMode_Destroy(&D_801F8048);
VisCvg_Destroy(&sGameVisCvg);
VisZbuf_Destroy(&sGameVisZbuf);
VisMono_Destroy(&sGameVisMono);
ViMode_Destroy(&sGameViMode);
THA_Destroy(&gameState->heap);
GameAlloc_Cleanup(&gameState->alloc);
}
+1
View File
@@ -14,6 +14,7 @@ OSTime sGraphTaskStartTime;
#include "macros.h"
#include "buffers.h"
#include "idle.h"
#include "sys_cfb.h"
#include "system_malloc.h"
#include "overlays/gamestates/ovl_daytelop/z_daytelop.h"
#include "overlays/gamestates/ovl_file_choose/z_file_select.h"
+15 -7
View File
@@ -1,11 +1,9 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "buffers.h"
#include "system_malloc.h"
extern u16 gFramebufferHiRes0[HIRES_BUFFER_WIDTH][HIRES_BUFFER_HEIGHT];
extern u16 gFramebufferHiRes1[HIRES_BUFFER_WIDTH][HIRES_BUFFER_HEIGHT];
#include "z64.h"
#include "regs.h"
#include "functions.h"
#include "macros.h"
// Variables are put before most headers as a hacky way to bypass bss reordering
OSViMode sNotebookViMode; // placeholder name
void* gFramebuffers[2];
OSViMode* gActiveViMode;
@@ -35,6 +33,16 @@ s16 gCfbUpperAdjust;
u8 gSysCfbHiResEnabled;
#include "variables.h"
#include "sys_cfb.h"
#include "libc/stdbool.h"
#include "buffers.h"
#include "system_malloc.h"
#include "z64vimode.h"
extern u16 gFramebufferHiRes0[HIRES_BUFFER_WIDTH][HIRES_BUFFER_HEIGHT];
extern u16 gFramebufferHiRes1[HIRES_BUFFER_WIDTH][HIRES_BUFFER_HEIGHT];
void SysCfb_SetLoResMode(void) {
gFramebuffers[1] = sCfbLoRes1;
gFramebuffers[0] = sCfbLoRes0;
+1
View File
@@ -5,6 +5,7 @@
#include "global.h"
#include "fault.h"
#include "sys_cfb.h"
#include "loadfragment.h"
#include "z64horse.h"
#include "z64quake.h"
+1
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "sys_cfb.h"
typedef enum {
/* 0 */ TRANS_CIRCLE_DIR_IN,
+1
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "sys_cfb.h"
#include "objects/gameplay_keep/gameplay_keep.h"
LightsBuffer sLightsBuffer;
+1
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "sys_cfb.h"
#include "z64snap.h"
#include "z64view.h"
#include "archives/icon_item_static/icon_item_static_yar.h"
+26 -18
View File
@@ -1,13 +1,33 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "z64.h"
#include "regs.h"
#include "functions.h"
#include "z64vismono.h"
// Variables are put before most headers as a hacky way to bypass bss reordering
s16 sTransitionFillTimer;
Input D_801F6C18;
TransitionTile sTransitionTile;
s32 gTransitionTileState;
VisMono sPlayVisMono;
Color_RGBA8_u32 gVisMonoColor;
Struct_80140E80 D_801F6D38;
Struct_80140E80* D_801F6D4C;
BombersNotebook sBombersNotebook;
u8 sBombersNotebookOpen;
u8 sMotionBlurStatus;
#include "variables.h"
#include "macros.h"
#include "buffers.h"
#include "idle.h"
#include "sys_cfb.h"
#include "z64bombers_notebook.h"
#include "z64debug_display.h"
#include "z64quake.h"
#include "z64rumble.h"
#include "z64shrink_window.h"
#include "z64view.h"
#include "overlays/gamestates/ovl_daytelop/z_daytelop.h"
#include "overlays/gamestates/ovl_opening/z_opening.h"
#include "overlays/gamestates/ovl_file_choose/z_file_select.h"
@@ -16,18 +36,6 @@
s32 gDbgCamEnabled = false;
u8 D_801D0D54 = false;
s16 sTransitionFillTimer;
Input D_801F6C18;
TransitionTile sTransitionTile;
s32 gTransitionTileState;
VisMono sVisMono;
Color_RGBA8_u32 gVisMonoColor;
Struct_80140E80 D_801F6D38;
Struct_80140E80* D_801F6D4C;
BombersNotebook sBombersNotebook;
u8 sBombersNotebookOpen;
u8 sMotionBlurStatus;
typedef enum {
/* 0 */ MOTION_BLUR_OFF,
/* 1 */ MOTION_BLUR_SETUP,
@@ -406,7 +414,7 @@ void Play_Destroy(GameState* thisx) {
ShrinkWindow_Destroy();
TransitionFade_Destroy(&this->unk_18E48);
VisMono_Destroy(&sVisMono);
VisMono_Destroy(&sPlayVisMono);
func_80140EA0(D_801F6D4C);
D_801F6D4C = NULL;
@@ -1227,8 +1235,8 @@ void Play_DrawMain(PlayState* this) {
TransitionFade_Draw(&this->unk_18E48, &sp218);
if (gVisMonoColor.a != 0) {
sVisMono.primColor.rgba = gVisMonoColor.rgba;
VisMono_Draw(&sVisMono, &sp218);
sPlayVisMono.primColor.rgba = gVisMonoColor.rgba;
VisMono_Draw(&sPlayVisMono, &sp218);
}
gSPEndDisplayList(sp218++);
@@ -2299,7 +2307,7 @@ void Play_Init(GameState* thisx) {
TransitionFade_SetType(&this->unk_18E48, 3);
TransitionFade_SetColor(&this->unk_18E48, RGBA8(160, 160, 160, 255));
TransitionFade_Start(&this->unk_18E48);
VisMono_Init(&sVisMono);
VisMono_Init(&sPlayVisMono);
gVisMonoColor.a = 0;
D_801F6D4C = &D_801F6D38;
+1
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "sys_cfb.h"
#include "z64bombers_notebook.h"
#include "interface/schedule_static/schedule_static.h"
#include "archives/schedule_dma_static/schedule_dma_static_yar.h"
+1
View File
@@ -1,3 +1,4 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#define FLAGS \
+1
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "sys_cfb.h"
#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h"
Gfx gSetupDLs[SETUPDL_MAX][6] = {
+1
View File
@@ -1,3 +1,4 @@
#include "prevent_bss_reordering.h"
#include "global.h"
s32 sMatAnimStep;
+1
View File
@@ -1,3 +1,4 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "z64skin.h"
+1
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "z64vimode.h"
#include "ultra64/viint.h"
typedef struct {
+4 -3
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "z64viscvg.h"
Gfx D_801C5DD0[] = {
gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE |
@@ -39,7 +40,7 @@ Gfx D_801C5E00[] = {
gsSPBranchList(D_0E000000.fillRect),
};
void VisCvg_Init(struct_801F8010* this) {
void VisCvg_Init(VisCvg* this) {
this->type = 0;
this->setScissor = false;
this->color.r = 255;
@@ -48,10 +49,10 @@ void VisCvg_Init(struct_801F8010* this) {
this->color.a = 255;
}
void VisCvg_Destroy(struct_801F8010* this) {
void VisCvg_Destroy(VisCvg* this) {
}
void VisCvg_Draw(struct_801F8010* this, Gfx** gfxp) {
void VisCvg_Draw(VisCvg* this, Gfx** gfxp) {
Gfx* gfx = *gfxp;
gDPPipeSync(gfx++);
+1
View File
@@ -4,6 +4,7 @@
*/
#include "global.h"
#include "z64vismono.h"
#include "system_malloc.h"
// Height of the fragments the color frame buffer (CFB) is split into.
+3
View File
@@ -1,4 +1,7 @@
#include "global.h"
#include "z64viszbuf.h"
#include "sys_cfb.h"
#include "libc/stdbool.h"
#define VISZBUF_ZBUFFRAG_HEIGHT (TMEM_SIZE / (gCfbWidth * G_IM_SIZ_16b_BYTES))