Skip to content

Commit

Permalink
Make progress on projection-matrix-handling frame functions (#60)
Browse files Browse the repository at this point in the history
* Fix Frame offset comments

* Make progress on frameLoadVertex

* More progress on project matrix usages

* Use GXFogType

* Name frameDrawSetupFog functions

* Remove nLensBuffer
  • Loading branch information
cadmic authored Oct 8, 2024
1 parent bb46ead commit 1a090ef
Show file tree
Hide file tree
Showing 6 changed files with 258 additions and 114 deletions.
8 changes: 4 additions & 4 deletions config/oot-e/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -643,8 +643,8 @@ frameUpdateCache = .text:0x800499A8; // type:function size:0x254
frameLoadTile = .text:0x80049BFC; // type:function size:0x424
fn_8004A020 = .text:0x8004A020; // type:function size:0x2F4
fn_8004A314 = .text:0x8004A314; // type:function size:0x388
fn_8004A69C = .text:0x8004A69C; // type:function size:0x200
fn_8004A89C = .text:0x8004A89C; // type:function size:0x200
frameDrawSetupFog_StarFox = .text:0x8004A69C; // type:function size:0x200
frameDrawSetupFog_Default = .text:0x8004A89C; // type:function size:0x200
ZeldaDrawFrame = .text:0x8004AA9C; // type:function size:0x324
ZeldaGreyScaleConvert = .text:0x8004ADC0; // type:function size:0x3D8
fn_8004B198 = .text:0x8004B198; // type:function size:0x320
Expand Down Expand Up @@ -1487,9 +1487,9 @@ PSMTXTransApply = .text:0x8009CED8; // type:function size:0x4C
PSMTXScale = .text:0x8009CF24; // type:function size:0x28
PSMTXMultVec = .text:0x8009CF4C; // type:function size:0x54
C_MTXOrtho = .text:0x8009CFA0; // type:function size:0x98
fn_8009D008 = .text:0x8009D038; // type:function size:0x34
PSMTX44Identity = .text:0x8009D038; // type:function size:0x34
PSMTX44Concat = .text:0x8009D06C; // type:function size:0x104
fn_8009D140 = .text:0x8009D170; // type:function size:0x64
PSMTXTranspose = .text:0x8009D170; // type:function size:0x64
PSMTX44MultVecNoW = .text:0x8009D1D4; // type:function size:0x54
__GXDefaultTexRegionCallback = .text:0x8009D228; // type:function size:0xF4 scope:local
__GXDefaultTlutRegionCallback = .text:0x8009D31C; // type:function size:0x24 scope:local
Expand Down
8 changes: 4 additions & 4 deletions config/oot-j/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -643,8 +643,8 @@ frameUpdateCache = .text:0x800499A8; // type:function size:0x254
frameLoadTile = .text:0x80049BFC; // type:function size:0x424
fn_8004A020 = .text:0x8004A020; // type:function size:0x2F4
fn_8004A314 = .text:0x8004A314; // type:function size:0x388
fn_8004A69C = .text:0x8004A69C; // type:function size:0x200
fn_8004A89C = .text:0x8004A89C; // type:function size:0x200
frameDrawSetupFog_StarFox = .text:0x8004A69C; // type:function size:0x200
frameDrawSetupFog_Default = .text:0x8004A89C; // type:function size:0x200
ZeldaDrawFrame = .text:0x8004AA9C; // type:function size:0x324
ZeldaGreyScaleConvert = .text:0x8004ADC0; // type:function size:0x3D8
fn_8004B198 = .text:0x8004B198; // type:function size:0x320
Expand Down Expand Up @@ -1487,9 +1487,9 @@ PSMTXTransApply = .text:0x8009CEA8; // type:function size:0x4C
PSMTXScale = .text:0x8009CEF4; // type:function size:0x28
PSMTXMultVec = .text:0x8009CF1C; // type:function size:0x54
C_MTXOrtho = .text:0x8009CF70; // type:function size:0x98
fn_8009D008 = .text:0x8009D008; // type:function size:0x34
PSMTX44Identity = .text:0x8009D008; // type:function size:0x34
PSMTX44Concat = .text:0x8009D03C; // type:function size:0x104
fn_8009D140 = .text:0x8009D140; // type:function size:0x64
PSMTXTranspose = .text:0x8009D140; // type:function size:0x64
PSMTX44MultVecNoW = .text:0x8009D1A4; // type:function size:0x54
__GXDefaultTexRegionCallback = .text:0x8009D1F8; // type:function size:0xF4 scope:local
__GXDefaultTlutRegionCallback = .text:0x8009D2EC; // type:function size:0x24 scope:local
Expand Down
8 changes: 4 additions & 4 deletions config/oot-u/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -643,8 +643,8 @@ frameUpdateCache = .text:0x800499C4; // type:function size:0x254
frameLoadTile = .text:0x80049C18; // type:function size:0x424
fn_8004A020 = .text:0x8004A03C; // type:function size:0x2F4
fn_8004A314 = .text:0x8004A330; // type:function size:0x388
fn_8004A69C = .text:0x8004A6B8; // type:function size:0x200
fn_8004A89C = .text:0x8004A8B8; // type:function size:0x200
frameDrawSetupFog_StarFox = .text:0x8004A6B8; // type:function size:0x200
frameDrawSetupFog_Default = .text:0x8004A8B8; // type:function size:0x200
ZeldaDrawFrame = .text:0x8004AAB8; // type:function size:0x324
ZeldaGreyScaleConvert = .text:0x8004ADDC; // type:function size:0x3D8
fn_8004B198 = .text:0x8004B1B4; // type:function size:0x320
Expand Down Expand Up @@ -1487,9 +1487,9 @@ PSMTXTransApply = .text:0x8009CEB4; // type:function size:0x4C
PSMTXScale = .text:0x8009CF00; // type:function size:0x28
PSMTXMultVec = .text:0x8009CF28; // type:function size:0x54
C_MTXOrtho = .text:0x8009CF7C; // type:function size:0x98
fn_8009D008 = .text:0x8009D014; // type:function size:0x34
PSMTX44Identity = .text:0x8009D014; // type:function size:0x34
PSMTX44Concat = .text:0x8009D048; // type:function size:0x104
fn_8009D140 = .text:0x8009D14C; // type:function size:0x64
PSMTXTranspose = .text:0x8009D14C; // type:function size:0x64
PSMTX44MultVecNoW = .text:0x8009D1B0; // type:function size:0x54
__GXDefaultTexRegionCallback = .text:0x8009D204; // type:function size:0xF4 scope:local
__GXDefaultTlutRegionCallback = .text:0x8009D2F8; // type:function size:0x24 scope:local
Expand Down
55 changes: 27 additions & 28 deletions include/emulator/frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,26 +293,26 @@ typedef struct Frame {
/* 0x000B0 */ u32 nMode;
/* 0x000B4 */ u32 aMode[FMT_COUNT];
/* 0x000DC */ Viewport viewport;
/* 0x000FC */ FrameBuffer aBuffer[FBT_COUNT];
/* 0x000EC */ FrameBuffer aBuffer[FBT_COUNT];
/* 0x0013C */ u32 nOffsetDepth0;
/* 0x00140 */ u32 nOffsetDepth1;
/* 0x00144 */ s32 nWidthLine;
/* 0x00148 */ f32 rDepth;
/* 0x0014C */ f32 rDelta;
/* 0x00154 */ FrameDrawFunc aDraw[4];
/* 0x00150 */ FrameDrawFunc aDraw[4];
/* 0x00160 */ s32 nCountLight;
/* 0x00164 */ Light aLight[8];
/* 0x00360 */ LookAt lookAt;
/* 0x00344 */ LookAt lookAt;
/* 0x00378 */ s32 nCountVertex;
/* 0x00390 */ Vertex aVertex[80];
/* 0x00C44 */ TextureMemory TMEM;
/* 0x0037C */ Vertex aVertex[80];
/* 0x00C40 */ TextureMemory TMEM;
/* 0x01C40 */ void* aPixelData;
/* 0x01C44 */ void* aColorData;
/* 0x01C48 */ s32 nBlocksPixel;
/* 0x01C54 */ s32 nBlocksMaxPixel;
/* 0x01C4C */ s32 nBlocksColor;
/* 0x01C58 */ s32 nBlocksMaxColor;
/* 0x01C50 */ s32 nBlocksTexture;
/* 0x01C4C */ s32 nBlocksMaxPixel;
/* 0x01C50 */ s32 nBlocksColor;
/* 0x01C54 */ s32 nBlocksMaxColor;
/* 0x01C58 */ s32 nBlocksTexture;
/* 0x01C5C */ s32 nBlocksMaxTexture;
/* 0x01C60 */ u32 anPackPixel[48];
/* 0x01D20 */ u32 anPackColor[320];
Expand All @@ -327,10 +327,10 @@ typedef struct Frame {
/* 0x3E370 */ s32 iTileLoad;
/* 0x3E374 */ u32 n2dLoadTexType;
/* 0x3E378 */ s32 nLastX0;
/* 0x3E380 */ s32 nLastY0;
/* 0x3E384 */ s32 nLastX1;
/* 0x3E388 */ s32 nLastY1;
/* 0x3E3A8 */ Tile aTile[8];
/* 0x3E37C */ s32 nLastY0;
/* 0x3E380 */ s32 nLastX1;
/* 0x3E384 */ s32 nLastY1;
/* 0x3E388 */ Tile aTile[8];
/* 0x3E4E8 */ s32 anSizeX[FS_COUNT];
/* 0x3E4F0 */ s32 anSizeY[FS_COUNT];
/* 0x3E4F8 */ s32 iHintMatrix;
Expand All @@ -341,24 +341,23 @@ typedef struct Frame {
/* 0x3E548 */ s32 iHintHack;
/* 0x3E54C */ FrameMatrixProjection eTypeProjection;
/* 0x3E550 */ Mtx44 aMatrixModel[10];
/* 0x3E590 */ Mtx44 matrixProjection;
/* 0x3E5D0 */ Mtx44 matrixProjectionExtra;
/* 0x3E610 */ MatrixHint aMatrixHint[64];
/* 0x3EF10 */ Mtx44 unknown;
/* 0x3EF10 */ Mtx44 unknown2;
s32 pad2[0x12]; // 1 Mtx44 + 2 floats?
/* 0x3F212 */ u8 primLODmin;
/* 0x3F214 */ u8 primLODfrac;
/* 0x3F218 */ u8 lastTile;
/* 0x3F21C */ u8 iTileDrawn;
/* 0x3F220 */ GXColor aColor[FCT_COUNT];
/* 0x3E7D0 */ Mtx44 matrixProjection;
/* 0x3E810 */ Mtx44 matrixProjectionExtra;
/* 0x3E850 */ MatrixHint aMatrixHint[64];
/* 0x3F150 */ Mtx44 unknown;
/* 0x3F190 */ Mtx44 unknown2;
/* 0x3F1D0 */ Mtx44 unknown3;
/* 0x3F210 */ f32 unk_3F210; // rNear
/* 0x3F214 */ f32 unk_3F214; // rFar
/* 0x3F218 */ u8 primLODmin;
/* 0x3F219 */ u8 primLODfrac;
/* 0x3F21A */ u8 lastTile;
/* 0x3F21B */ u8 iTileDrawn;
/* 0x3F21C */ GXColor aColor[FCT_COUNT];
/* 0x3F230 */ u32 nModeVtx;

//! TODO: find which of these members got removed
/* 0x3F234 */ u16* nTempBuffer;
/* 0x3F238 */ u16* nCopyBuffer;
/* 0x3F23C */ u32* nLensBuffer;
// /* 0x3F008 */ u16* nCameraBuffer;
/* 0x3F23C */ u8* nCameraBuffer;
} Frame; // size = 0x3F240

extern _XL_OBJECTTYPE gClassFrame;
Expand Down
Loading

0 comments on commit 1a090ef

Please sign in to comment.