summaryrefslogtreecommitdiff
path: root/soh/include
diff options
context:
space:
mode:
authorArchez <Archez@users.noreply.github.com>2024-11-09 12:51:31 -0500
committerGitHub <noreply@github.com>2024-11-09 12:51:31 -0500
commitf12a2bbbb7f6201a0bc8787d23cd446a1a2b4d48 (patch)
tree932f88be2e593d76120f22b8b64b006e1b4e1706 /soh/include
parent2603b9736632541fcf86d64af17a461f4447fc7a (diff)
Port over decomp updates for vis* and reimplement vismono fb (#4533)
* Port over decomp updates for vis* * move vismono framebuffer handling to file
Diffstat (limited to 'soh/include')
-rw-r--r--soh/include/functions.h12
-rw-r--r--soh/include/gfx.h9
-rw-r--r--soh/include/macros.h4
-rw-r--r--soh/include/variables.h2
-rw-r--r--soh/include/z64.h27
-rw-r--r--soh/include/z64vis.h101
6 files changed, 117 insertions, 38 deletions
diff --git a/soh/include/functions.h b/soh/include/functions.h
index 15fb5ba9d..b3e597791 100644
--- a/soh/include/functions.h
+++ b/soh/include/functions.h
@@ -1419,18 +1419,6 @@ void ViMode_Init(ViMode* viMode);
void ViMode_Destroy(ViMode* viMode);
void ViMode_ConfigureFeatures(ViMode* viMode, s32 viFeatures);
void ViMode_Update(ViMode* viMode, Input* input);
-void func_800ACE70(struct_801664F0* this);
-void func_800ACE90(struct_801664F0* this);
-void func_800ACE98(struct_801664F0* this, Gfx** gfxp);
-void VisMono_Init(VisMono* this);
-void VisMono_Destroy(VisMono* this);
-void VisMono_UpdateTexture(VisMono* this, u16* tex);
-Gfx* VisMono_DrawTexture(VisMono* this, Gfx* gfx);
-void VisMono_Draw(VisMono* this, Gfx** gfxp);
-void VisMono_DrawOld(VisMono* this);
-void func_800AD920(struct_80166500* this);
-void func_800AD950(struct_80166500* this);
-void func_800AD958(struct_80166500* this, Gfx** gfxp);
void Skybox_Init(GameState* state, SkyboxContext* skyboxCtx, s16 skyboxId);
Mtx* SkyboxDraw_UpdateMatrix(SkyboxContext* skyboxCtx, f32 x, f32 y, f32 z);
void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyboxId, s16 blend, f32 x, f32 y, f32 z);
diff --git a/soh/include/gfx.h b/soh/include/gfx.h
new file mode 100644
index 000000000..d8aa9945f
--- /dev/null
+++ b/soh/include/gfx.h
@@ -0,0 +1,9 @@
+#ifndef GFX_H
+#define GFX_H
+
+// Texture memory size, 4 KiB
+#define TMEM_SIZE 0x1000
+
+// Upstream TODO: Rest of this file
+
+#endif
diff --git a/soh/include/macros.h b/soh/include/macros.h
index 9c7c43d80..c10f40599 100644
--- a/soh/include/macros.h
+++ b/soh/include/macros.h
@@ -299,6 +299,10 @@ extern GraphicsContext* __gfxCtx;
#define BGCHECK_POS_ERROR_CHECK(vec3f) BgCheck_PosErrorCheck(vec3f, __FILE__, __LINE__)
#define SEG_ADDR(seg, addr) (addr | (seg << 24) | 1)
+
+// Upstream TODO: Bring back decomp file/line macro use in src (but ignore the args for our needs)
+#define SYSTEM_ARENA_MALLOC(size, file, line) SystemArena_MallocDebug(size, __FILE__, __LINE__)
+#define SYSTEM_ARENA_FREE(ptr, file, line) SystemArena_FreeDebug(ptr, __FILE__, __LINE__)
// #endregion
#define DPAD_ITEM(button) ((gSaveContext.buttonStatus[(button) + 5] != BTN_DISABLED) \
diff --git a/soh/include/variables.h b/soh/include/variables.h
index 6b8451f5f..f5486f761 100644
--- a/soh/include/variables.h
+++ b/soh/include/variables.h
@@ -203,7 +203,7 @@ extern "C"
extern f32 gBossMarkScale;
extern PauseMapMarksData* gLoadedPauseMarkDataTable;
extern s32 gTrnsnUnkState;
- extern Color_RGBA8_u32 D_801614B0;
+ extern Color_RGBA8_u32 gVisMonoColor;
extern PreNmiBuff* gAppNmiBufferPtr;
extern SchedContext gSchedContext;
extern PadMgr gPadMgr;
diff --git a/soh/include/z64.h b/soh/include/z64.h
index 00a67c844..903805f8c 100644
--- a/soh/include/z64.h
+++ b/soh/include/z64.h
@@ -25,12 +25,14 @@
#include "z64skin.h"
#include "z64transition.h"
#include "z64interface.h"
+#include "z64vis.h"
#include "alignment.h"
#include "sequence.h"
#include "sfx.h"
#include <libultraship/color.h>
#include "ichain.h"
#include "regs.h"
+#include "gfx.h"
#if defined(__LP64__)
#define _SOH64
@@ -2225,31 +2227,6 @@ typedef struct {
/* 0x0084 */ u32 unk_84;
} ViMode;
-// Vis...
-typedef struct {
- /* 0x00 */ u32 type;
- /* 0x04 */ u32 setScissor;
- /* 0x08 */ Color_RGBA8_u32 color;
- /* 0x0C */ Color_RGBA8_u32 envColor;
-} struct_801664F0; // size = 0x10
-
-typedef struct {
- /* 0x00 */ u32 unk_00;
- /* 0x04 */ u32 setScissor;
- /* 0x08 */ Color_RGBA8_u32 primColor;
- /* 0x0C */ Color_RGBA8_u32 envColor;
- /* 0x10 */ u16* tlut;
- /* 0x14 */ Gfx* monoDl;
-} VisMono; // size = 0x18
-
-// Vis...
-typedef struct {
- /* 0x00 */ u32 useRgba;
- /* 0x04 */ u32 setScissor;
- /* 0x08 */ Color_RGBA8_u32 primColor;
- /* 0x08 */ Color_RGBA8_u32 envColor;
-} struct_80166500; // size = 0x10
-
typedef struct {
/* 0x000 */ u8 rumbleEnable[4];
/* 0x004 */ u8 unk_04[0x40];
diff --git a/soh/include/z64vis.h b/soh/include/z64vis.h
new file mode 100644
index 000000000..1798baa1f
--- /dev/null
+++ b/soh/include/z64vis.h
@@ -0,0 +1,101 @@
+#ifndef Z64_VIS_H
+#define Z64_VIS_H
+
+// #include "ultra64.h"
+// #include "color.h"
+#include <libultraship/libultra.h>
+
+
+#ifdef __cplusplus
+#define this thisx
+extern "C"
+{
+#endif
+
+typedef enum FramebufferFilterType {
+ /* 0 */ FB_FILTER_NONE,
+ /* 1 */ FB_FILTER_CVG_RGB,
+ /* 2 */ FB_FILTER_CVG_RGB_UNIFORM,
+ /* 3 */ FB_FILTER_CVG_ONLY,
+ /* 4 */ FB_FILTER_CVG_RGB_FOG, // Not recommended, easily overflows blender
+ /* 5 */ FB_FILTER_ZBUF_IA,
+ /* 6 */ FB_FILTER_ZBUF_RGBA,
+ /* 7 */ FB_FILTER_MONO
+} FramebufferFilterType;
+
+typedef enum VisScissorType {
+ /* 0 */ VIS_NO_SETSCISSOR,
+ /* 1 */ VIS_SETSCISSOR
+} VisScissorType;
+
+typedef struct Vis {
+ /* 0x00 */ u32 type;
+ /* 0x04 */ u32 scissorType;
+ /* 0x08 */ Color_RGBA8_u32 primColor;
+ /* 0x0C */ Color_RGBA8_u32 envColor;
+} Vis; // size = 0x10
+
+
+
+/* Cvg: Coverage */
+
+#define FB_FILTER_TO_CVG_TYPE(filter) (filter)
+
+typedef enum VisCvgType {
+ /* 0 */ VIS_CVG_TYPE_NONE = FB_FILTER_TO_CVG_TYPE(FB_FILTER_NONE),
+ /* 1 */ VIS_CVG_TYPE_CVG_RGB = FB_FILTER_TO_CVG_TYPE(FB_FILTER_CVG_RGB),
+ /* 2 */ VIS_CVG_TYPE_CVG_RGB_UNIFORM = FB_FILTER_TO_CVG_TYPE(FB_FILTER_CVG_RGB_UNIFORM),
+ /* 3 */ VIS_CVG_TYPE_CVG_ONLY = FB_FILTER_TO_CVG_TYPE(FB_FILTER_CVG_ONLY),
+ /* 4 */ VIS_CVG_TYPE_CVG_RGB_FOG = FB_FILTER_TO_CVG_TYPE(FB_FILTER_CVG_RGB_FOG)
+} VisCvgType;
+
+typedef struct VisCvg {
+ /* 0x00 */ Vis vis;
+} VisCvg; // size = 0x10
+
+void VisCvg_Init(VisCvg* this);
+void VisCvg_Destroy(VisCvg* this);
+void VisCvg_Draw(VisCvg* this, Gfx** gfxP);
+
+
+
+/* Mono: Desaturation */
+
+// Only one type
+
+typedef struct VisMono {
+ /* 0x00 */ Vis vis;
+ /* 0x10 */ u16* tlut;
+ /* 0x14 */ Gfx* dList;
+} VisMono; // size = 0x18
+
+void VisMono_Init(VisMono* this);
+void VisMono_Destroy(VisMono* this);
+void VisMono_Draw(VisMono* this, Gfx** gfxP);
+
+
+
+/* ZBuf: Z-Buffer */
+
+#define FB_FILTER_TO_ZBUF_TYPE(filter) ((filter) - FB_FILTER_ZBUF_IA)
+
+typedef enum VisZBufType {
+ /* 0 */ VIS_ZBUF_TYPE_IA = FB_FILTER_TO_ZBUF_TYPE(FB_FILTER_ZBUF_IA),
+ /* 1 */ VIS_ZBUF_TYPE_RGBA = FB_FILTER_TO_ZBUF_TYPE(FB_FILTER_ZBUF_RGBA)
+} VisZBufType;
+
+typedef struct VisZBuf {
+ /* 0x00 */ Vis vis;
+} VisZBuf; // size = 0x10
+
+void VisZBuf_Init(VisZBuf* this);
+void VisZBuf_Destroy(VisZBuf* this);
+void VisZBuf_Draw(VisZBuf* this, Gfx** gfxP);
+
+
+#ifdef __cplusplus
+#undef this
+}
+#endif
+
+#endif