diff --git a/include/functions.h b/include/functions.h index c6ac828455..10037d5a4f 100644 --- a/include/functions.h +++ b/include/functions.h @@ -897,17 +897,6 @@ void SkinMatrix_SetYRotation(MtxF* mf, s16 a); void SkinMatrix_MulYRotation(MtxF* mf, s16 a); void SkinMatrix_SetZRotation(MtxF* mf, s16 a); -void func_80140E80(Struct_80140E80* arg0); -void func_80140EA0(Struct_80140E80* arg0); -// void func_80140EAC(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); -// void func_80141008(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10); -void func_8014116C(Gfx** gfxP, u16* arg1, u16* workBuffer, s32 width, s32 height, s32 arg5); -// void func_801411B4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10); -// void func_80141200(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); -// void func_8014151C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); -// void func_80141678(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); -void func_80141778(Struct_80140E80* arg0, Gfx** gfxp, void* unk_18E60, GraphicsContext* gfxCtx); - uintptr_t KaleidoManager_FaultAddrConv(uintptr_t address, void* param); void KaleidoManager_LoadOvl(KaleidoMgrOverlay* ovl); void KaleidoManager_ClearOvl(KaleidoMgrOverlay* ovl); diff --git a/include/gfx.h b/include/gfx.h index 63b3eadfca..bc309001e9 100644 --- a/include/gfx.h +++ b/include/gfx.h @@ -272,4 +272,13 @@ extern Gfx gEmptyDL[]; } \ (void)0 +// used only by code_80140E80 +#define gDPSetLODColor(pkt, c, m, l, d) \ + _DW({ \ + Gfx* _g = (Gfx*)(pkt); \ + \ + _g->words.w0 = (_SHIFTL(c, 24, 8) | _SHIFTL(m, 8, 8) | _SHIFTL(l, 0, 8)); \ + _g->words.w1 = (unsigned int)(d); \ + }) + #endif diff --git a/include/macros.h b/include/macros.h index bc74393947..c81d504494 100644 --- a/include/macros.h +++ b/include/macros.h @@ -92,7 +92,10 @@ #define ABS_ALT(x) ((x) < 0 ? -(x) : (x)) #define DECR(x) ((x) == 0 ? 0 : --(x)) +//! checks min first #define CLAMP(x, min, max) ((x) < (min) ? (min) : (x) > (max) ? (max) : (x)) +//! checks max first +#define CLAMP_ALT(x, min, max) ((x) > (max) ? (max) : (x) < (min) ? (min) : (x)) #define CLAMP_MAX(x, max) ((x) > (max) ? (max) : (x)) #define CLAMP_MIN(x, min) ((x) < (min) ? (min) : (x)) diff --git a/include/z64.h b/include/z64.h index f4a057c23f..072a1296a9 100644 --- a/include/z64.h +++ b/include/z64.h @@ -271,12 +271,4 @@ typedef enum { /* 3 */ PICTO_PHOTO_STATE_READY } PictoPhotoState; -typedef struct { - /* 0x00 */ u8 mode; - /* 0x04 */ f32 scale; - /* 0x08 */ f32 lodProportion; // expected to be between 0.0f and 1.0f - /* 0x0C */ Color_RGBA8_u32 primColor; - /* 0x10 */ Color_RGBA8_u32 envColor; -} Struct_80140E80; // size = 0x14 - #endif diff --git a/include/z64camera.h b/include/z64camera.h index ba0f6a614e..da27353fd3 100644 --- a/include/z64camera.h +++ b/include/z64camera.h @@ -2,7 +2,11 @@ #define Z64CAMERA_H #include "ultra64.h" +#include "z64actor.h" #include "z64save.h" +#include "unk.h" + +struct CollisionPoly; // these two angle conversion macros are slightly inaccurate #define CAM_DEG_TO_BINANG(degrees) (s16)((degrees) * ((f32)0xFFFF / 360) + .5f) @@ -373,7 +377,7 @@ typedef enum { typedef struct { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f norm; - /* 0x18 */ CollisionPoly* poly; + /* 0x18 */ struct CollisionPoly* poly; /* 0x1C */ VecGeo geoNorm; /* 0x24 */ s32 bgId; } CameraCollision; // size = 0x28 diff --git a/include/z64quake.h b/include/z64quake.h index 0150b54047..e98bfbbacb 100644 --- a/include/z64quake.h +++ b/include/z64quake.h @@ -59,7 +59,7 @@ s16 Distortion_GetTimeLeft(void); s16 Distortion_GetType(void); void Distortion_RemoveRequest(s32 type); -void Distortion_Init(PlayState* play); +void Distortion_Init(struct PlayState* play); void Distortion_Update(void); #endif diff --git a/include/z64save.h b/include/z64save.h index 0b68210384..25ce107f83 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -5,6 +5,7 @@ #include "PR/os.h" #include "z64item.h" #include "z64math.h" +#include "unk.h" struct GameState; struct PlayState; diff --git a/include/z64transition.h b/include/z64transition.h index fe6027a9f8..2670989971 100644 --- a/include/z64transition.h +++ b/include/z64transition.h @@ -81,7 +81,7 @@ typedef struct { /* 0x8 */ u16 timer; } TransitionFade; // size = 0xC -#define FBDEMO_CIRCLE_GET_MASK_TYPE(type) (type & 1) +#define FBDEMO_CIRCLE_GET_MASK_TYPE(type) ((type) & 1) typedef struct { /* 0x00 */ Color_RGBA8_u32 color; diff --git a/include/z64visfbuf.h b/include/z64visfbuf.h new file mode 100644 index 0000000000..00961b7daa --- /dev/null +++ b/include/z64visfbuf.h @@ -0,0 +1,38 @@ +#ifndef Z64_VISFBUF_H +#define Z64_VISFBUF_H + +#include "ultra64.h" +#include "color.h" +#include "PR/gs2dex.h" + +typedef enum VisFbufBgMode { + /* 0 */ VIS_FBUF_BG_CYC_1CYC, //!< Enable rescaling + /* 1 */ VIS_FBUF_BG_CYC_COPY //!< Direct copy, no scaling +} VisFbufBgMode; + +typedef enum VisFbufMode { + /* 0 */ VIS_FBUF_MODE_NONE, //!< Do nothing but waste time loading microcode + /* 1 */ VIS_FBUF_MODE_GENERAL, //!< Interpolation, filling and scaling + /* 2 */ VIS_FBUF_MODE_INTERPOLATE +} VisFbufMode; + +typedef struct VisFbuf { + /* 0x00 */ u8 mode; + /* 0x04 */ f32 scale; + /* 0x08 */ f32 lodProportion; // expected to be between 0.0f and 1.0f + /* 0x0C */ Color_RGBA8_u32 primColor; + /* 0x10 */ Color_RGBA8_u32 envColor; +} VisFbuf; // size = 0x14 + +void VisFbuf_Init(VisFbuf* this); +void VisFbuf_Destroy(VisFbuf* this); +void VisFbuf_DrawBgToColorImage(Gfx** gfxP, uObjBg* bg, void* img, s32 width, s32 height, VisFbufBgMode cycleMode); +void VisFbuf_SetBg(Gfx** gfxP, void* source, void* img, s32 width, s32 height, f32 x, f32 y, f32 scaleX, f32 scaleY, VisFbufBgMode cycleMode); +void VisFbuf_SetBgSimple(Gfx** gfxP, void* source, void* img, s32 width, s32 height, VisFbufBgMode cycleMode); +void VisFbuf_SetBgGeneral(Gfx** gfxP, void* source, void* img, s32 width, s32 height, f32 x, f32 y, f32 scaleX, f32 scaleY, VisFbufBgMode cycleMode); +void VisFbuf_ApplyEffects(VisFbuf* this, Gfx** gfxP, void* source, void* img, s32 width, s32 height); +void VisFbuf_DrawGeneral(VisFbuf* this, Gfx** gfxP, void* source, void* img, s32 width, s32 height); +void VisFbuf_DrawInterpolate(VisFbuf* this, Gfx** gfxP, void* img, s32 width, s32 height); +void VisFbuf_Draw(VisFbuf* this, Gfx** gfxP, void* img); + +#endif diff --git a/spec b/spec index a375a6692d..622a496473 100644 --- a/spec +++ b/spec @@ -519,7 +519,7 @@ beginseg include "build/src/code/z_view.o" include "build/src/code/z_vimode.o" include "build/src/code/z_viscvg.o" - include "build/src/code/code_80140E80.o" + include "build/src/code/z_visfbuf.o" include "build/src/code/z_vismono.o" include "build/src/code/z_viszbuf.o" include "build/src/code/z_vr_box.o" @@ -3158,8 +3158,7 @@ beginseg name "ovl_fbdemo_wipe4" compress include "build/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.o" - include "build/data/ovl_fbdemo_wipe4/ovl_fbdemo_wipe4.data.o" - include "build/data/ovl_fbdemo_wipe4/ovl_fbdemo_wipe4.reloc.o" + include "build/src/overlays/fbdemos/ovl_fbdemo_wipe4/ovl_fbdemo_wipe4_reloc.o" endseg beginseg diff --git a/src/code/code_80140E80.c b/src/code/code_80140E80.c deleted file mode 100644 index 56fcb663c6..0000000000 --- a/src/code/code_80140E80.c +++ /dev/null @@ -1,21 +0,0 @@ -#include "global.h" - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80140E80/func_80140E80.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80140E80/func_80140EA0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80140E80/func_80140EAC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80140E80/func_80141008.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80140E80/func_8014116C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80140E80/func_801411B4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80140E80/func_80141200.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80140E80/func_8014151C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80140E80/func_80141678.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80140E80/func_80141778.s") diff --git a/src/code/z_actor.c b/src/code/z_actor.c index e68f06809d..f2b39de4e5 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -4,12 +4,14 @@ */ #include "z64actor.h" +#include "prevent_bss_reordering.h" #include "fault.h" #include "sys_cfb.h" #include "loadfragment.h" #include "z64horse.h" #include "z64quake.h" #include "z64rumble.h" + #include "overlays/actors/ovl_En_Horse/z_en_horse.h" #include "overlays/actors/ovl_En_Part/z_en_part.h" #include "overlays/actors/ovl_En_Box/z_en_box.h" diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 2bef40dceb..f0807172cd 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "global.h" #include "fault.h" #include "fixed_point.h" diff --git a/src/code/z_camera.c b/src/code/z_camera.c index d019ee3952..56c6baf155 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -43,7 +43,6 @@ * */ -#include "prevent_bss_reordering.h" #include "global.h" #include "libc/string.h" #include "z64quake.h" diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 39b57cbd03..af1f4ad6c9 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "global.h" #include "z64collision_check.h" diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 1e3b74dfe0..fa0419de42 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -1,3 +1,6 @@ +#include "prevent_bss_reordering.h" +#include "prevent_bss_reordering2.h" + #include "PR/ultratypes.h" // Variables are put before most headers as a hacky way to bypass bss reordering @@ -11,16 +14,6 @@ static s16 sBssPad; u8 gDisablePlayerCsActionStartPos; s16 gDungeonBossWarpSceneId; -#include "prevent_bss_reordering.h" -#include "prevent_bss_reordering2.h" -// clang-format off -// Partial structs taken from "prevent_bss_reordering.h" -struct Dummy200 { int x; }; -struct Dummy201 { int x; }; -struct Dummy202 { int x; }; -// clang-format on - -#include "global.h" #include "z64quake.h" #include "z64rumble.h" #include "z64shrink_window.h" diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c index 5d1299bbf9..d9abe151d6 100644 --- a/src/code/z_lifemeter.c +++ b/src/code/z_lifemeter.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "global.h" #include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" #include "interface/parameter_static/parameter_static.h" diff --git a/src/code/z_message.c b/src/code/z_message.c index 3fb8f5bac5..4d717d8df1 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -5107,6 +5107,7 @@ void Message_Draw(PlayState* play) { GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); + polyOpa = POLY_OPA_DISP; nextDisplayList = Graph_GfxPlusOne(polyOpa); gSPDisplayList(OVERLAY_DISP++, nextDisplayList); @@ -5118,6 +5119,7 @@ void Message_Draw(PlayState* play) { gSPEndDisplayList(nextDisplayList++); Graph_BranchDlist(polyOpa, nextDisplayList); POLY_OPA_DISP = nextDisplayList; + CLOSE_DISPS(gfxCtx); } diff --git a/src/code/z_play.c b/src/code/z_play.c index 5d9b2c0480..17449e0422 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -3,6 +3,7 @@ #include "regs.h" #include "functions.h" #include "z64vismono.h" +#include "z64visfbuf.h" // Variables are put before most headers as a hacky way to bypass bss reordering s16 sTransitionFillTimer; @@ -11,8 +12,8 @@ TransitionTile sTransitionTile; s32 gTransitionTileState; VisMono sPlayVisMono; Color_RGBA8_u32 gVisMonoColor; -Struct_80140E80 D_801F6D38; -Struct_80140E80* D_801F6D4C; +VisFbuf sPlayVisFbuf; +VisFbuf* sPlayVisFbufInstance; BombersNotebook sBombersNotebook; u8 sBombersNotebookOpen; u8 sMotionBlurStatus; @@ -417,8 +418,8 @@ void Play_Destroy(GameState* thisx) { ShrinkWindow_Destroy(); TransitionFade_Destroy(&this->unk_18E48); VisMono_Destroy(&sPlayVisMono); - func_80140EA0(D_801F6D4C); - D_801F6D4C = NULL; + VisFbuf_Destroy(sPlayVisFbufInstance); + sPlayVisFbufInstance = NULL; if (CHECK_WEEKEVENTREG(WEEKEVENTREG_92_80)) { Actor_CleanupContext(&this->actorCtx, this); @@ -1110,7 +1111,7 @@ void Play_PostWorldDraw(PlayState* this) { Gfx* opa; GraphicsContext* gfxCtx = this->state.gfxCtx; - D_801F6D4C->scale = gSaveContext.screenScale / 1000.0f; + sPlayVisFbufInstance->scale = gSaveContext.screenScale / 1000.0f; OPEN_DISPS(gfxCtx); @@ -1118,7 +1119,7 @@ void Play_PostWorldDraw(PlayState* this) { nextOpa = Graph_GfxPlusOne(opa); gSPDisplayList(OVERLAY_DISP++, nextOpa); - func_80141778(D_801F6D4C, &nextOpa, this->unk_18E60, gfxCtx); + VisFbuf_Draw(sPlayVisFbufInstance, &nextOpa, this->unk_18E60); gSPEndDisplayList(nextOpa++); Graph_BranchDlist(opa, nextOpa); @@ -2311,18 +2312,18 @@ void Play_Init(GameState* thisx) { VisMono_Init(&sPlayVisMono); gVisMonoColor.a = 0; - D_801F6D4C = &D_801F6D38; - func_80140E80(D_801F6D4C); - D_801F6D4C->lodProportion = 0.0f; - D_801F6D4C->mode = 1; - D_801F6D4C->primColor.r = 0; - D_801F6D4C->primColor.g = 0; - D_801F6D4C->primColor.b = 0; - D_801F6D4C->primColor.a = 0; - D_801F6D4C->envColor.r = 0; - D_801F6D4C->envColor.g = 0; - D_801F6D4C->envColor.b = 0; - D_801F6D4C->envColor.a = 0; + sPlayVisFbufInstance = &sPlayVisFbuf; + VisFbuf_Init(sPlayVisFbufInstance); + sPlayVisFbufInstance->lodProportion = 0.0f; + sPlayVisFbufInstance->mode = VIS_FBUF_MODE_GENERAL; + sPlayVisFbufInstance->primColor.r = 0; + sPlayVisFbufInstance->primColor.g = 0; + sPlayVisFbufInstance->primColor.b = 0; + sPlayVisFbufInstance->primColor.a = 0; + sPlayVisFbufInstance->envColor.r = 0; + sPlayVisFbufInstance->envColor.g = 0; + sPlayVisFbufInstance->envColor.b = 0; + sPlayVisFbufInstance->envColor.a = 0; CutsceneFlags_UnsetAll(this); THA_GetRemaining(&this->state.tha); zAllocSize = THA_GetRemaining(&this->state.tha); diff --git a/src/code/z_visfbuf.c b/src/code/z_visfbuf.c new file mode 100644 index 0000000000..62242bcec5 --- /dev/null +++ b/src/code/z_visfbuf.c @@ -0,0 +1,329 @@ +/** + * @file z_visfbuf.c + * @brief Copies images between color images (generally framebuffers), possibly with filling, scaling, and colour + * interpolation. + * + * Used for several transition effects, and in z_play to shrink the screen at the end of the First and Second Days. + * + * @note to use the functions in this file, with the exception of VisFbuf_Draw(), it is necessary to load the S2DEX2 + * microcode first, and then re-load the 3D microcode afterwards for the rest of the drawing in the frame; see + * VisFbuf_Draw() for how to do this. + */ + +#include "global.h" +#include "z64visfbuf.h" +#include "sys_cfb.h" + +#define SCALE_MIN 0.032f +#define SCALE_MAX 1.0f //!< also unchanged scale + +void VisFbuf_Init(VisFbuf* this) { + bzero(this, sizeof(VisFbuf)); +} + +void VisFbuf_Destroy(VisFbuf* this) { +} + +// internal, only used in VisFbuf_SetBg +/** + * Draw a bg to the specified color image. + * + * @param[in,out] gfxP Pointer to current displaylist + * @param[in] bg BG object to draw + * @param[out] img Pointer to beginning of destination color image + * @param[in] width Output width in pixels + * @param[in] height Output height in pixels + * @param[in] cycleMode Which BG mode to use + */ +void VisFbuf_DrawBgToColorImage(Gfx** gfxP, uObjBg* bg, void* img, s32 width, s32 height, VisFbufBgMode cycleMode) { + Gfx* gfx = *gfxP; + + gDPPipeSync(gfx++); + // Set up color image to draw bg to + gDPSetColorImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, img); + gDPSetScissor(gfx++, 0, 0, 0, width, height); + + // Draw bg in appropriate type + gSPObjRenderMode(gfx++, G_OBJRM_ANTIALIAS | G_OBJRM_BILERP); + if (!!(cycleMode & VIS_FBUF_BG_CYC_COPY) != 0) { //! FAKE: may possibly be a better way + gSPBgRectCopy(gfx++, bg); + } else { + gSPBgRect1Cyc(gfx++, bg); + } + + gDPPipeSync(gfx++); + // Reset the color image and scissor to frame's defaults + gDPSetColorImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gCfbWidth, D_0F000000); + gSPDisplayList(gfx++, D_0E000000.setScissor); + + *gfxP = gfx; +} + +// internal +/** + * Set up a BG from a specified source image and draw it to the specified color image with + * VisFbuf_DrawBgToColorImage(), using the BG's settings. Use VisFbuf_SetBgSimple() or + * VisFbuf_SetBgGeneral() + * + * @param[out] gfxP Pointer to current displaylist + * @param[in] source Pointer to beginning of source color image + * @param[out] img Pointer to beginning of destination color image + * @param[in] width Output width in pixels + * @param[in] height Output height in pixels + * @param[in] x Left of drawn output + * @param[in] y Top of drawn output + * @param[in] scaleX Amount to rescale the image, (dsdx). No effect if `cycleMode` is `VIS_FBUF_BG_CYC_COPY`. + * @param[in] scaleY Amount to rescale the image, (dtdy). No effect if `cycleMode` is `VIS_FBUF_BG_CYC_COPY`. + * @param[in] cycleMode Which BG mode to use + */ +void VisFbuf_SetBg(Gfx** gfxP, void* source, void* img, s32 width, s32 height, f32 x, f32 y, f32 scaleX, f32 scaleY, + VisFbufBgMode cycleMode) { + Gfx* gfx = *gfxP; + Gfx* gfxTemp; + uObjBg* bg; + + // Allocate for BG + gfxTemp = gfx; + bg = Graph_DlistAlloc(&gfxTemp, sizeof(uObjBg)); + gfx = gfxTemp; + + // Set up BG + bg->b.imageX = 0; + bg->b.imageW = width << 2; + bg->b.frameX = x * 4; + bg->b.frameW = width << 2; + bg->b.imageY = 0; + bg->b.imageH = height << 2; + bg->b.frameY = y * 4; + bg->b.frameH = height << 2; + bg->b.imageLoad = G_BGLT_LOADTILE; + bg->b.imageFmt = G_IM_FMT_RGBA; + bg->b.imageSiz = G_IM_SIZ_16b; + bg->b.imagePal = 0; + bg->b.imageFlip = 0; + bg->b.imagePtr = source; + + if (!!(cycleMode & VIS_FBUF_BG_CYC_COPY) != 0) { //! FAKE: may possibly be a better way + guS2DInitBg(bg); + } else { + bg->s.scaleW = (s32)((1 << 10) / scaleX); + bg->s.scaleH = (s32)((1 << 10) / scaleY); + bg->s.imageYorig = bg->b.imageY; + } + + // draw BG to `img` + VisFbuf_DrawBgToColorImage(&gfx, bg, img, width, height, cycleMode); + + *gfxP = gfx; +} + +// used in FbdemoWipe5 and internally +// "default settings" wrapper for VisFbuf_SetBg +/** + * Set up a BG from a specified source image and draw it to the specified color image with + * VisFbuf_DrawBgToColorImage(), using the BG's settings. Position uses the default (0,0), and no rescaling is done + * even if 1-cycle mode is enabled. + * + * @see VisFbuf_SetBg() for arguments. + */ +void VisFbuf_SetBgSimple(Gfx** gfxP, void* source, void* img, s32 width, s32 height, VisFbufBgMode cycleMode) { + VisFbuf_SetBg(gfxP, source, img, width, height, 0.0f, 0.0f, SCALE_MAX, SCALE_MAX, cycleMode); +} + +// wrapper for VisFbuf_SetBg with general arguments, used in VisFbuf_ApplyEffects +/** + * Set up a BG from a specified source image and draw it to the specified color image with + * VisFbuf_DrawBgToColorImage(). Fully general settings are available. + * + * @see VisFbuf_SetBg() for arguments. + */ +void VisFbuf_SetBgGeneral(Gfx** gfxP, void* source, void* img, s32 width, s32 height, f32 x, f32 y, f32 scaleX, + f32 scaleY, VisFbufBgMode cycleMode) { + VisFbuf_SetBg(gfxP, source, img, width, height, x, y, scaleX, scaleY, cycleMode); +} + +// internal, used in VisFbuf_DrawGeneral +/** + * Most general redrawing function. + * + * - Copies `source` to `img`, + * - fills the current framebuffer with `this->primColor`, + * - applies colour interpolation to `img`, + * - copies `img` back to `source`, with rescaling. + * + * @param[in] this + * @param[in,out] gfxP Pointer to current displaylist + * @param[in,out] source Pointer to beginning of in/out color image + * @param[out] img Pointer to beginning of destination color image + * @param[in] width Output width in pixels + * @param[in] height Output height in pixels + */ +void VisFbuf_ApplyEffects(VisFbuf* this, Gfx** gfxP, void* source, void* img, s32 width, s32 height) { + Gfx* gfx = *gfxP; + s32 pad[3]; + + gDPPipeSync(gfx++); + // copy source to img + gDPSetOtherMode(gfx++, + G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_COPY | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2); + VisFbuf_SetBgSimple(&gfx, source, img, width, height, VIS_FBUF_BG_CYC_COPY); + + gDPPipeSync(gfx++); + // fill framebuffer with primColor + gDPSetOtherMode(gfx++, + G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_FILL | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2); + { + s32 color = GPACK_RGBA5551(this->primColor.r, this->primColor.g, (u32)this->primColor.b, 1); + + gDPSetFillColor(gfx++, (color << 0x10) | color); + } + //! @bug VisFbuf_SetBgSimple() sets the current color image back to the frame's default framebuffer at the end, + //! so this will always fill in the default framebuffer, whatever are used as `source` and `img`. This does not + //! arise in-game since this function is always used with `source = D_0F000000`. + gDPFillRectangle(gfx++, 0, 0, width - 1, height - 1); + + gDPPipeSync(gfx++); + // Set lod and primColor from struct, perform interpolation, draw image with scaling (this is the most general + // alteration this system can carry out). + { + s32 lodFrac = this->lodProportion * 255; + + gDPSetLODColor(gfx++, G_SETPRIMCOLOR, 0, lodFrac, this->primColor.rgba); + } + if (this->envColor.a == 0) { + // Interpolate between primColor and texel color using lod (but with max alpha) + gDPSetOtherMode(gfx++, + G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_THRESHOLD | G_ZS_PIXEL | AA_EN | CVG_DST_CLAMP | ZMODE_OPA | CVG_X_ALPHA | ALPHA_CVG_SEL | + GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_BL, G_BL_1MA) | + GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_BL, G_BL_1MA)); + gDPSetCombineLERP(gfx++, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, TEXEL0, 0, 0, 0, 1, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, + TEXEL0, 0, 0, 0, 1); + } else { + // Interpolate between envColor (the new black) and primColor (the new white) + gDPSetOtherMode(gfx++, + G_AD_DISABLE | G_CD_DISABLE | 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_PIXEL | G_RM_CLD_SURF | G_RM_NOOP2); + gDPSetColor(gfx++, G_SETENVCOLOR, this->envColor.rgba); + gDPSetCombineLERP(gfx++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, + ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, + ENVIRONMENT); + } + + // Draw scaled image in centre of `width * height` rectangle in `source` + { + f32 scale = CLAMP_ALT(this->scale, SCALE_MIN, SCALE_MAX); + + VisFbuf_SetBgGeneral(&gfx, img, source, width, height, width * 0.5f * (1.0f - scale), + height * 0.5f * (1.0f - scale), scale, scale, VIS_FBUF_BG_CYC_1CYC); + } + + gDPPipeSync(gfx++); + + *gfxP = gfx; +} + +// internal, used in VisFbuf_Draw, VIS_FBUF_MODE_GENERAL +/** + * If scale is within `(SCALE_MIN, SCALE_MAX)`, apply VisFbuf_ApplyEffects(). + * If it is smaller than `SCALE_MIN`, fill the framebuffer with `this->primColor` + * + * @param[in] this + * @param[in,out] gfxP Pointer to current displaylist + * @param[in,out] source Pointer to beginning of source color image + * @param[in,out] img Pointer to beginning of destination color image + * @param[in] width Output width in pixels + * @param[in] height Output height in pixels + */ +void VisFbuf_DrawGeneral(VisFbuf* this, Gfx** gfxP, void* source, void* img, s32 width, s32 height) { + if (this->scale < SCALE_MAX) { + Gfx* gfx = *gfxP; + u32 color; + + if (this->scale > SCALE_MIN) { + VisFbuf_ApplyEffects(this, &gfx, source, img, width, height); + } else { + gDPPipeSync(gfx++); + // fill the framebuffer with this->primColor + gDPSetOtherMode(gfx++, + G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_FILL | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2); + color = GPACK_RGBA5551(this->primColor.r, this->primColor.g, (u32)this->primColor.b, 1); + gDPSetFillColor(gfx++, (color << 0x10) | color); + //! @bug See corresponding note in VisFbuf_ApplyEffects() + gDPFillRectangle(gfx++, 0, 0, width - 1, height - 1); + + gDPPipeSync(gfx++); + } + + *gfxP = gfx; + } +} + +/** + * Redraw `img` in-place, using texel color to interpolate between envColor (the new black) and primColor (the new + * white) + * + * @param[in] this + * @param[in,out] gfxP Pointer to current displaylist + * @param[in,out] img Pointer to beginning of color image to modify in-place + * @param[in] width width of img + * @param[in] height height of img + */ +void VisFbuf_DrawInterpolate(VisFbuf* this, Gfx** gfxP, void* img, s32 width, s32 height) { + Gfx* gfx = *gfxP; + + gDPPipeSync(gfx++); + + gDPSetOtherMode(gfx++, + G_AD_DISABLE | G_CD_DISABLE | 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_PIXEL | G_RM_CLD_SURF | G_RM_NOOP2); + gDPSetColor(gfx++, G_SETPRIMCOLOR, this->primColor.rgba); + gDPSetColor(gfx++, G_SETENVCOLOR, this->envColor.rgba); + gDPSetCombineLERP(gfx++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT); + VisFbuf_SetBgSimple(&gfx, img, img, width, height, VIS_FBUF_BG_CYC_1CYC); + + gDPPipeSync(gfx++); + + *gfxP = gfx; +} + +// used in Play and FbdemoWipe4 +/** + * main drawing function in this file, draws depending on settings specified in `this`. + * + * @param[in] this + * @param[in,out] gfxP Pointer to current displaylist + * @param[in,out] img Pointer to beginning of destination color image + */ +void VisFbuf_Draw(VisFbuf* this, Gfx** gfxP, void* img) { + Gfx* gfx = *gfxP; + + gSPLoadUcodeL(gfx++, gspS2DEX2_fifo); + + switch (this->mode) { + case VIS_FBUF_MODE_GENERAL: + VisFbuf_DrawGeneral(this, &gfx, D_0F000000, img, gScreenWidth, gScreenHeight); + break; + + case VIS_FBUF_MODE_INTERPOLATE: + VisFbuf_DrawInterpolate(this, &gfx, D_0F000000, gScreenWidth, gScreenHeight); + break; + + default: + break; + } + + gSPLoadUcode(gfx++, SysUcode_GetUCode(), SysUcode_GetUCodeData()); + + *gfxP = gfx; +} diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c index 572327d153..4d2fc4db8b 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -4,7 +4,6 @@ * Description: Fishing Pond Elements (Owner, Fish, Props, Effects...) */ -#include "prevent_bss_reordering.h" #include "z_en_fishing.h" #include "z64rumble.h" #include "z64shrink_window.h" diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.c b/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.c index b12a9cb763..543fc6e087 100644 --- a/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.c +++ b/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.c @@ -32,9 +32,9 @@ TransitionInit TransitionWipe3_InitVars = { TransitionWipe3_SetColor, TransitionWipe3_SetEnvColor, TransitionWipe3_IsDone, }; -#define TRANS3_GET_SPEED(type) (type & 1) -#define TRANS3_GET_TEX_INDEX(type) ((type >> 1) & 7) -#define TRANS3_GET_COLOR(type) ((type >> 4) & 3) +#define TRANS3_GET_SPEED(type) ((type)&1) +#define TRANS3_GET_TEX_INDEX(type) (((type) >> 1) & 7) +#define TRANS3_GET_COLOR(type) (((type) >> 4) & 3) typedef enum { /* 0 */ TRANS_WIPE3_DIR_IN, diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.c b/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.c index 1acb8c07a3..562e1920bf 100644 --- a/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.c +++ b/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.c @@ -1,11 +1,25 @@ -/* - * File: z_fbdemo_wipe4.c +/** + * @file z_fbdemo_wipe4.c * Overlay: ovl_fbdemo_wipe4 * Description: + * + * @note The bug in TransitionWipe4_Draw() makes this transition do nothing apart from increase its timer until it is + * finished. */ #include "global.h" #include "z_fbdemo_wipe4.h" +#include "sys_cfb.h" + +#define THIS ((TransitionWipe4*)thisx) + +#define TRANS4_GET_COLORTYPE(type) (((type) >> 1) & 3) +#define TRANS4_GET_SPEEDTYPE(type) ((type)&1) + +typedef enum TransitionWipe4Direction { + /* 0 */ TRANS_WIPE4_DIR_IN, + /* 1 */ TRANS_WIPE4_DIR_OUT +} TransitionWipe4Direction; void* TransitionWipe4_Init(void* thisx); void TransitionWipe4_Destroy(void* thisx); @@ -17,35 +31,115 @@ void TransitionWipe4_SetColor(void* thisx, u32 color); void TransitionWipe4_SetEnvColor(void* thisx, u32 color); s32 TransitionWipe4_IsDone(void* thisx); -#if 0 TransitionInit TransitionWipe4_InitVars = { - TransitionWipe4_Init, - TransitionWipe4_Destroy, - TransitionWipe4_Update, - TransitionWipe4_Draw, - TransitionWipe4_Start, - TransitionWipe4_SetType, - TransitionWipe4_SetColor, - TransitionWipe4_SetEnvColor, - TransitionWipe4_IsDone, + TransitionWipe4_Init, TransitionWipe4_Destroy, TransitionWipe4_Update, + TransitionWipe4_Draw, TransitionWipe4_Start, TransitionWipe4_SetType, + TransitionWipe4_SetColor, TransitionWipe4_SetEnvColor, TransitionWipe4_IsDone, }; -#endif +void TransitionWipe4_Start(void* thisx) { + TransitionWipe4* this = (TransitionWipe4*)thisx; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe4/TransitionWipe4_Start.s") + this->isDone = false; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe4/TransitionWipe4_Init.s") + switch (this->speedType) { + default: + this->baseSpeed = 0.2f; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe4/TransitionWipe4_Destroy.s") + case 0: + this->baseSpeed = 0.1f; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe4/TransitionWipe4_Update.s") + case 1: + this->baseSpeed = 0.05f; + break; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe4/TransitionWipe4_Draw.s") + switch (this->colorType) { + default: + this->primColor.rgba = RGBA8(160, 160, 160, 255); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe4/TransitionWipe4_IsDone.s") + case 0: + this->primColor.rgba = RGBA8(0, 0, 0, 255); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe4/TransitionWipe4_SetType.s") + case 1: + this->primColor.rgba = RGBA8(160, 160, 160, 255); + break; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe4/TransitionWipe4_SetColor.s") +void* TransitionWipe4_Init(void* thisx) { + TransitionWipe4* this = (TransitionWipe4*)thisx; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe4/TransitionWipe4_SetEnvColor.s") + bzero(this, sizeof(TransitionWipe4)); + + return this; +} + +void TransitionWipe4_Destroy(void* thisx) { +} + +void TransitionWipe4_Update(void* thisx, s32 updateRate) { + TransitionWipe4* this = (TransitionWipe4*)thisx; + + this->progress += (this->baseSpeed * 3.0f) / updateRate; + if (this->progress >= 1.0f) { + this->progress = 1.0f; + this->isDone = true; + } +} + +// Use of THIS in this function is required to match +void TransitionWipe4_Draw(void* thisx, Gfx** gfxP) { + Gfx* gfx = *gfxP; + VisFbuf* copyFx = &THIS->copyFx; + + copyFx->primColor.rgba = THIS->primColor.rgba; + + if (THIS->direction != 0) { + copyFx->scale = THIS->progress; + copyFx->lodProportion = 1.0f - THIS->progress; + } else { + copyFx->scale = 1.0f - THIS->progress; + copyFx->lodProportion = THIS->progress; + } + + //! @bug (Possibly) Since copyFx->mode is never set after being initialised to 0, the switch in VisFbuf_Draw() + //! does nothing, so this function call does nothing but change to the sprite microcode, then back to 3D microcode. + VisFbuf_Draw(copyFx, &gfx, SysCfb_GetZBuffer()); + *gfxP = gfx; +} + +s32 TransitionWipe4_IsDone(void* thisx) { + TransitionWipe4* this = (TransitionWipe4*)thisx; + + return this->isDone; +} + +void TransitionWipe4_SetType(void* thisx, s32 type) { + TransitionWipe4* this = (TransitionWipe4*)thisx; + + if (type & TRANS_TYPE_SET_PARAMS) { + this->colorType = TRANS4_GET_COLORTYPE(type); + this->speedType = TRANS4_GET_SPEEDTYPE(type); + } else if (type == TRANS_INSTANCE_TYPE_FILL_OUT) { + this->direction = TRANS_WIPE4_DIR_OUT; + } else { + this->direction = TRANS_WIPE4_DIR_IN; + } +} + +void TransitionWipe4_SetColor(void* thisx, u32 color) { + TransitionWipe4* this = (TransitionWipe4*)thisx; + + this->primColor.rgba = color; +} + +void TransitionWipe4_SetEnvColor(void* thisx, u32 color) { + TransitionWipe4* this = (TransitionWipe4*)thisx; + + this->envColor.rgba = color; +} diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.h b/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.h index b0aec44be4..11357855a0 100644 --- a/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.h +++ b/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.h @@ -3,9 +3,18 @@ #include "ultra64.h" #include "color.h" +#include "z64visfbuf.h" -typedef struct { - /* 0x00 */ char unk_0[0x28]; +typedef struct TransitionWipe4 { + /* 0x00 */ Color_RGBA8_u32 primColor; + /* 0x04 */ Color_RGBA8_u32 envColor; + /* 0x08 */ f32 baseSpeed; + /* 0x0C */ f32 progress; + /* 0x10 */ u8 direction; + /* 0x11 */ u8 colorType; + /* 0x12 */ u8 speedType; + /* 0x13 */ u8 isDone; + /* 0x14 */ VisFbuf copyFx; } TransitionWipe4; // size = 0x28 #endif diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c b/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c index ee8aa689f9..8e307efd44 100644 --- a/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c +++ b/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c @@ -94,7 +94,7 @@ void TransitionWipe5_Draw(void* thisx, Gfx** gfxP) { G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_COPY | G_PM_NPRIMITIVE, G_AC_NONE | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2); - func_8014116C(&gfx, D_0F000000, workBuffer, width, height, 1); + VisFbuf_SetBgSimple(&gfx, D_0F000000, workBuffer, width, height, VIS_FBUF_BG_CYC_COPY); } else { if (alpha == 255) { gDPSetOtherMode(gfx++, @@ -110,7 +110,7 @@ void TransitionWipe5_Draw(void* thisx, Gfx** gfxP) { gDPSetEnvColor(gfx++, 255, 255, 255, alpha); gDPSetCombineLERP(gfx++, TEXEL0, 0, ENVIRONMENT, 0, 0, 0, 0, ENVIRONMENT, TEXEL0, 0, ENVIRONMENT, 0, 0, 0, 0, ENVIRONMENT); - func_8014116C(&gfx, workBuffer, D_0F000000, width, height, 0); + VisFbuf_SetBgSimple(&gfx, workBuffer, D_0F000000, width, height, VIS_FBUF_BG_CYC_1CYC); } gDPPipeSync(gfx++); gSPLoadUcode(gfx++, SysUcode_GetUCode(), SysUcode_GetUCodeData()); diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c index c99e6d718b..fee889b6b9 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c @@ -4,7 +4,6 @@ * Description: Pause Menu */ -#include "prevent_bss_reordering.h" #include "z_kaleido_scope.h" #include "z64view.h" #include "overlays/gamestates/ovl_opening/z_opening.h" diff --git a/tools/disasm/files.txt b/tools/disasm/files.txt index 56d6477ca8..3afbc0bbe8 100644 --- a/tools/disasm/files.txt +++ b/tools/disasm/files.txt @@ -429,7 +429,7 @@ 0x8013EE60 : "z_view", 0x80140260 : "z_vimode", 0x80140CE0 : "z_viscvg", - 0x80140E80 : "code_80140E80", + 0x80140E80 : "z_visfbuf", 0x801418B0 : "z_vismono", 0x801420C0 : "z_viszbuf", 0x80142440 : "z_vr_box", @@ -648,7 +648,7 @@ 0x801DF090 : "z_rumble", 0x801DF0A0 : "z_view", 0x801DF0B0 : "z_vimode", - 0x801DF120 : "code_80140E80", + 0x801DF120 : "z_visfbuf", 0x801DF130 : "z_vr_box", 0x801DF150 : "z_message", 0x801DF730 : "z_message_nes", diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index e8d717b458..3c1265e15d 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -2759,16 +2759,16 @@ 0x80140CE0:("VisCvg_Init",), 0x80140D04:("VisCvg_Destroy",), 0x80140D10:("VisCvg_Draw",), - 0x80140E80:("func_80140E80",), - 0x80140EA0:("func_80140EA0",), - 0x80140EAC:("func_80140EAC",), - 0x80141008:("func_80141008",), - 0x8014116C:("func_8014116C",), - 0x801411B4:("func_801411B4",), - 0x80141200:("func_80141200",), - 0x8014151C:("func_8014151C",), - 0x80141678:("func_80141678",), - 0x80141778:("func_80141778",), + 0x80140E80:("VisFbuf_Init",), + 0x80140EA0:("VisFbuf_Destroy",), + 0x80140EAC:("VisFbuf_DrawBgToColorImage",), + 0x80141008:("VisFbuf_SetBg",), + 0x8014116C:("VisFbuf_SetBgSimple",), + 0x801411B4:("VisFbuf_SetBgGeneral",), + 0x80141200:("VisFbuf_ApplyEffects",), + 0x8014151C:("VisFbuf_DrawGeneral",), + 0x80141678:("VisFbuf_DrawInterpolate",), + 0x80141778:("VisFbuf_Draw",), 0x801418B0:("VisMono_Init",), 0x80141900:("VisMono_Destroy",), 0x80141924:("VisMono_DesaturateTLUT",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index e240cf9a4a..f1ab300c72 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -3981,8 +3981,8 @@ 0x801F6D10:("gTransitionTileState","UNK_TYPE4","",0x4), 0x801F6D18:("sPlayVisMono","VisMono","",0x18), 0x801F6D30:("gVisMonoColor","Color_RGBA8","",0x4), - 0x801F6D38:("D_801F6D38","UNK_TYPE1","",0x1), - 0x801F6D4C:("D_801F6D4C","UNK_TYPE4","",0x4), + 0x801F6D38:("sPlayVisFbuf","UNK_TYPE1","",0x1), + 0x801F6D4C:("sPlayVisFbufInstance","UNK_TYPE4","",0x4), 0x801F6D50:("sBombersNotebook","UNK_TYPE1","",0x1), 0x801F6DFC:("sBombersNotebookOpen","u8","",0x1), 0x801F6DFD:("sMotionBlurStatus","UNK_TYPE1","",0x1), diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 54ec935033..702ebf7481 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -2273,16 +2273,16 @@ asm/non_matchings/code/z_vimode/func_80140970.s,func_80140970,0x80140970,0xDC asm/non_matchings/code/z_vimode/VisCvg_Init.s,VisCvg_Init,0x80140CE0,0x9 asm/non_matchings/code/z_vimode/VisCvg_Destroy.s,VisCvg_Destroy,0x80140D04,0x3 asm/non_matchings/code/z_vimode/VisCvg_Draw.s,VisCvg_Draw,0x80140D10,0x5C -asm/non_matchings/code/code_80140E80/func_80140E80.s,func_80140E80,0x80140E80,0x8 -asm/non_matchings/code/code_80140E80/func_80140EA0.s,func_80140EA0,0x80140EA0,0x3 +asm/non_matchings/code/code_80140E80/VisFbuf_Init.s,VisFbuf_Init,0x80140E80,0x8 +asm/non_matchings/code/code_80140E80/VisFbuf_Destroy.s,VisFbuf_Destroy,0x80140EA0,0x3 asm/non_matchings/code/code_80140E80/func_80140EAC.s,func_80140EAC,0x80140EAC,0x57 asm/non_matchings/code/code_80140E80/func_80141008.s,func_80141008,0x80141008,0x59 -asm/non_matchings/code/code_80140E80/func_8014116C.s,func_8014116C,0x8014116C,0x12 +asm/non_matchings/code/code_80140E80/VisFbuf_SetBgSimple.s,VisFbuf_SetBgSimple,0x8014116C,0x12 asm/non_matchings/code/code_80140E80/func_801411B4.s,func_801411B4,0x801411B4,0x13 asm/non_matchings/code/code_80140E80/func_80141200.s,func_80141200,0x80141200,0xC7 asm/non_matchings/code/code_80140E80/func_8014151C.s,func_8014151C,0x8014151C,0x57 asm/non_matchings/code/code_80140E80/func_80141678.s,func_80141678,0x80141678,0x40 -asm/non_matchings/code/code_80140E80/func_80141778.s,func_80141778,0x80141778,0x4E +asm/non_matchings/code/code_80140E80/VisFbuf_Draw.s,VisFbuf_Draw,0x80141778,0x4E asm/non_matchings/code/z_vismono/VisMono_Init.s,VisMono_Init,0x801418B0,0x14 asm/non_matchings/code/z_vismono/VisMono_Destroy.s,VisMono_Destroy,0x80141900,0x9 asm/non_matchings/code/z_vismono/VisMono_DesaturateTLUT.s,VisMono_DesaturateTLUT,0x80141924,0xC4