mirror of
https://gitlab.com/ryandwyer/perfect-dark
synced 2026-09-01 09:22:53 -04:00
Attempt to decompile tex0f1756c0
This commit is contained in:
+81
-45
@@ -75,13 +75,13 @@
|
||||
*
|
||||
* IMPLEMENTATION NOTE:
|
||||
* There is another group of RDP commands that includes the triangle commands
|
||||
* generated by the RSP code. These are the raw commands the rasterizer
|
||||
* hardware chews on, with slope info, etc. They will follow the RDP
|
||||
* generated by the RSP code. These are the raw commands the rasterizer
|
||||
* hardware chews on, with slope info, etc. They will follow the RDP
|
||||
* ordering...
|
||||
*
|
||||
* IMPLEMENTATION NOTE:
|
||||
* The RDP hardware has some of these bit patterns wired up. If the hardware
|
||||
* changes, we must adjust this table, likewise we can't change/add things
|
||||
* The RDP hardware has some of these bit patterns wired up. If the hardware
|
||||
* changes, we must adjust this table, likewise we can't change/add things
|
||||
* once the hardware is frozen. (actually, the RDP hardware only looks at
|
||||
* the lower 6 bits of the command byte)
|
||||
*
|
||||
@@ -198,7 +198,7 @@
|
||||
#define G_TEXRECT 0xe4 /* -28 */
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* The following commands are the "generated" RDP commands; the user
|
||||
* never sees them, the RSP microcode generates them.
|
||||
*
|
||||
@@ -231,8 +231,8 @@
|
||||
/* masks to build RDP triangle commands: */
|
||||
#define G_RDP_TRI_FILL_MASK 0x08
|
||||
#define G_RDP_TRI_SHADE_MASK 0x04
|
||||
#define G_RDP_TRI_TXTR_MASK 0x02
|
||||
#define G_RDP_TRI_ZBUFF_MASK 0x01
|
||||
#define G_RDP_TRI_TXTR_MASK 0x02
|
||||
#define G_RDP_TRI_ZBUFF_MASK 0x01
|
||||
|
||||
/*
|
||||
* HACK:
|
||||
@@ -318,7 +318,7 @@
|
||||
*
|
||||
* DO NOT USE THE LOW 8 BITS OF GEOMETRYMODE:
|
||||
* The weird bit-ordering is for the micro-code: the lower byte
|
||||
* can be OR'd in with G_TRI_SHADE (11001100) to construct
|
||||
* can be OR'd in with G_TRI_SHADE (11001100) to construct
|
||||
* the triangle command directly. Don't break it...
|
||||
*
|
||||
* DO NOT USE THE HIGH 8 BITS OF GEOMETRYMODE:
|
||||
@@ -332,7 +332,7 @@
|
||||
* appropriately and use primcolor to see anything.
|
||||
*
|
||||
* G_SHADING_SMOOTH enabled means use all 3 colors of the triangle.
|
||||
* If it is not set, then do 'flat shading', where only one vertex color
|
||||
* If it is not set, then do 'flat shading', where only one vertex color
|
||||
* is used (and all 3 vertices are set to that same color by the ucode)
|
||||
* See the man page for gSP1Triangle().
|
||||
*
|
||||
@@ -837,27 +837,27 @@
|
||||
Z_CMP | Z_UPD | CVG_DST_FULL | ALPHA_CVG_SEL | \
|
||||
ZMODE_OPA | \
|
||||
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM)
|
||||
|
||||
|
||||
#define RM_ZB_XLU_SURF(clk) \
|
||||
Z_CMP | IM_RD | CVG_DST_FULL | FORCE_BL | ZMODE_XLU | \
|
||||
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
|
||||
|
||||
|
||||
#define RM_ZB_OPA_DECAL(clk) \
|
||||
Z_CMP | CVG_DST_FULL | ALPHA_CVG_SEL | ZMODE_DEC | \
|
||||
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM)
|
||||
|
||||
|
||||
#define RM_ZB_XLU_DECAL(clk) \
|
||||
Z_CMP | IM_RD | CVG_DST_FULL | FORCE_BL | ZMODE_DEC | \
|
||||
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
|
||||
|
||||
|
||||
#define RM_ZB_CLD_SURF(clk) \
|
||||
Z_CMP | IM_RD | CVG_DST_SAVE | FORCE_BL | ZMODE_XLU | \
|
||||
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
|
||||
|
||||
|
||||
#define RM_ZB_OVL_SURF(clk) \
|
||||
Z_CMP | IM_RD | CVG_DST_SAVE | FORCE_BL | ZMODE_DEC | \
|
||||
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
|
||||
|
||||
|
||||
#define RM_ZB_PCL_SURF(clk) \
|
||||
Z_CMP | Z_UPD | CVG_DST_FULL | ZMODE_OPA | \
|
||||
G_AC_DITHER | \
|
||||
@@ -1044,7 +1044,7 @@
|
||||
* element, we can't depend on the C compiler to align things
|
||||
* properly.
|
||||
*
|
||||
* 64-bit structure alignment is enforced by wrapping structures with
|
||||
* 64-bit structure alignment is enforced by wrapping structures with
|
||||
* unions that contain a dummy "long long int". Why this works is
|
||||
* explained in the ANSI C Spec, or on page 186 of the second edition
|
||||
* of K&R, "The C Programming Language".
|
||||
@@ -1108,14 +1108,14 @@ typedef struct {
|
||||
/* 20 bytes for above */
|
||||
|
||||
/* padding to bring structure size to 64 bit allignment */
|
||||
char dummy[4];
|
||||
char dummy[4];
|
||||
|
||||
} uSprite_t;
|
||||
|
||||
typedef union {
|
||||
typedef union {
|
||||
uSprite_t s;
|
||||
|
||||
/* Need to make sure this is 64 bit aligned */
|
||||
/* Need to make sure this is 64 bit aligned */
|
||||
long long int force_structure_allignment[3];
|
||||
} uSprite;
|
||||
|
||||
@@ -1194,7 +1194,7 @@ typedef union {
|
||||
*/
|
||||
#ifdef F3DEX_GBI_2
|
||||
/* 0,4 are reserved by G_MTX */
|
||||
# define G_MV_MMTX 2
|
||||
# define G_MV_MMTX 2
|
||||
# define G_MV_PMTX 6
|
||||
# define G_MV_VIEWPORT 8
|
||||
# define G_MV_LIGHT 10
|
||||
@@ -1252,7 +1252,7 @@ typedef union {
|
||||
|
||||
/*
|
||||
* These are offsets from the address in the dmem table
|
||||
*/
|
||||
*/
|
||||
#define G_MWO_NUMLIGHT 0x00
|
||||
#define G_MWO_CLIP_RNX 0x04
|
||||
#define G_MWO_CLIP_RNY 0x0c
|
||||
@@ -1334,7 +1334,7 @@ typedef union {
|
||||
*
|
||||
* Note: only directional (infinite) lights are currently supported.
|
||||
*
|
||||
* Note: the weird order is for the DMEM alignment benefit of
|
||||
* Note: the weird order is for the DMEM alignment benefit of
|
||||
* the microcode.
|
||||
*
|
||||
*/
|
||||
@@ -1497,6 +1497,23 @@ typedef struct {
|
||||
Tri tri;
|
||||
} Gtri;
|
||||
|
||||
typedef struct {
|
||||
unsigned char cmd:8;
|
||||
unsigned char pad:8;
|
||||
unsigned char z4:4;
|
||||
unsigned char z3:4;
|
||||
unsigned char z2:4;
|
||||
unsigned char z1:4;
|
||||
unsigned char y4:4;
|
||||
unsigned char x4:4;
|
||||
unsigned char y3:4;
|
||||
unsigned char x3:4;
|
||||
unsigned char y2:4;
|
||||
unsigned char x2:4;
|
||||
unsigned char y1:4;
|
||||
unsigned char x1:4;
|
||||
} Gtri4;
|
||||
|
||||
typedef struct {
|
||||
int cmd:8;
|
||||
int pad1:24;
|
||||
@@ -1655,7 +1672,7 @@ typedef struct {
|
||||
|
||||
/*
|
||||
* Textured rectangles are 128 bits not 64 bits
|
||||
*/
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned long w0;
|
||||
unsigned long w1;
|
||||
@@ -1671,14 +1688,32 @@ typedef struct {
|
||||
unsigned int w1;
|
||||
} Gwords;
|
||||
|
||||
// xxxxxxxx 11223344 44555566 66666777
|
||||
// 88888888 99999999 9999aaaa aaaaaaaa
|
||||
typedef struct {
|
||||
unsigned int cmd:8;
|
||||
unsigned int unk08:2;
|
||||
unsigned int unk0a:2;
|
||||
unsigned int unk0c:2;
|
||||
unsigned int unk0e:4;
|
||||
unsigned int unk12:4;
|
||||
unsigned int flags:7;
|
||||
unsigned int subcmd:3;
|
||||
unsigned int unk20:8;
|
||||
unsigned int tile1:12;
|
||||
unsigned int tile2:12;
|
||||
} GunkC0;
|
||||
|
||||
/*
|
||||
* This union is the fundamental type of the display list.
|
||||
* It is, by law, exactly 64 bits in size.
|
||||
*/
|
||||
typedef union {
|
||||
Gwords words;
|
||||
u8 bytes[8];
|
||||
Gdma dma;
|
||||
Gtri tri;
|
||||
Gtri4 tri4;
|
||||
Gline3D line;
|
||||
Gpopmtx popmtx;
|
||||
Gsegment segment;
|
||||
@@ -1694,6 +1729,7 @@ typedef union {
|
||||
Gloadtile loadtile; /* use for loadblock also, th is dxt */
|
||||
Gsettilesize settilesize;
|
||||
Gloadtlut loadtlut;
|
||||
GunkC0 unkc0;
|
||||
long long int force_structure_alignment;
|
||||
} Gfx;
|
||||
|
||||
@@ -1803,7 +1839,7 @@ typedef union {
|
||||
gsDma1p(G_VTX, v, sizeof(Vtx)*(n), ((n)-1)<<4|(v0))
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef F3DEX_GBI_2
|
||||
# define gSPViewport(pkt, v) \
|
||||
gDma2p((pkt), G_MOVEMEM, (v), sizeof(Vp), G_MV_VIEWPORT, 0)
|
||||
@@ -2062,7 +2098,7 @@ typedef union {
|
||||
|
||||
/***
|
||||
*** 1 Triangle
|
||||
***/
|
||||
***/
|
||||
#define gSP1Triangle(pkt, v0, v1, v2, flag) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
@@ -2230,7 +2266,7 @@ typedef union {
|
||||
* Insert values into Matrix
|
||||
*
|
||||
* where = element of matrix (byte offset)
|
||||
* num = new element (32 bit value replacing 2 int or 2 frac matrix
|
||||
* num = new element (32 bit value replacing 2 int or 2 frac matrix
|
||||
* componants
|
||||
*/
|
||||
#ifdef F3DEX_GBI_2
|
||||
@@ -2258,7 +2294,7 @@ typedef union {
|
||||
#define gsSPForceMatrix(mptr) \
|
||||
gsDma2p(G_MOVEMEM,(mptr),sizeof(Mtx),G_MV_MATRIX,0), \
|
||||
gsMoveWd(G_MW_FORCEMTX,0,0x00010000)
|
||||
|
||||
|
||||
#else /* F3DEX_GBI_2 */
|
||||
#define gSPForceMatrix(pkt, mptr) \
|
||||
{ \
|
||||
@@ -2306,7 +2342,7 @@ typedef union {
|
||||
/*
|
||||
* gSPBranchLessZ Branch DL if (vtx.z) less than or equal (zval).
|
||||
*
|
||||
* dl = DL branch to
|
||||
* dl = DL branch to
|
||||
* vtx = Vertex
|
||||
* zval = Screen depth
|
||||
* near = Near plane
|
||||
@@ -2353,7 +2389,7 @@ typedef union {
|
||||
/*
|
||||
* gSPBranchLessZraw Branch DL if (vtx.z) less than or equal (raw zval).
|
||||
*
|
||||
* dl = DL branch to
|
||||
* dl = DL branch to
|
||||
* vtx = Vertex
|
||||
* zval = Raw value of screen depth
|
||||
*/
|
||||
@@ -2454,7 +2490,7 @@ typedef union {
|
||||
#define NUMLIGHTS_7 7
|
||||
/*
|
||||
* n should be one of: NUMLIGHTS_0, NUMLIGHTS_1, ..., NUMLIGHTS_7
|
||||
* NOTE: in addition to the number of directional lights specified,
|
||||
* NOTE: in addition to the number of directional lights specified,
|
||||
* there is always 1 ambient light
|
||||
*/
|
||||
#define gSPNumLights(pkt, n) \
|
||||
@@ -2466,7 +2502,7 @@ typedef union {
|
||||
#define LIGHT_2 2
|
||||
#define LIGHT_3 3
|
||||
#define LIGHT_4 4
|
||||
#define LIGHT_5 5
|
||||
#define LIGHT_5 5
|
||||
#define LIGHT_6 6
|
||||
#define LIGHT_7 7
|
||||
#define LIGHT_8 8
|
||||
@@ -2696,7 +2732,7 @@ typedef union {
|
||||
* min, max: range 0 to 1000: 0=nearplane, 1000=farplane
|
||||
* min is where fog begins (usually less than max and often 0)
|
||||
* max is where fog is thickest (usually 1000)
|
||||
*
|
||||
*
|
||||
*/
|
||||
#define gSPFogFactor(pkt, fm, fo) \
|
||||
gMoveWd(pkt, G_MW_FOG, G_MWO_FOG, \
|
||||
@@ -2736,7 +2772,7 @@ typedef union {
|
||||
_SHIFTL((level),11,3) | _SHIFTL((tile),8,3) | _SHIFTL((on),1,7)),\
|
||||
(_SHIFTL((s),16,16) | _SHIFTL((t),0,16)) \
|
||||
}
|
||||
/*
|
||||
/*
|
||||
* Different version of SPTexture macro, has an additional parameter
|
||||
* which is currently reserved in the microcode.
|
||||
*/
|
||||
@@ -2775,7 +2811,7 @@ typedef union {
|
||||
_SHIFTL((level),11,3)|_SHIFTL((tile),8,3)|_SHIFTL((on),0,8)), \
|
||||
(_SHIFTL((s),16,16)|_SHIFTL((t),0,16)) \
|
||||
}
|
||||
/*
|
||||
/*
|
||||
* Different version of SPTexture macro, has an additional parameter
|
||||
* which is currently reserved in the microcode.
|
||||
*/
|
||||
@@ -2975,7 +3011,7 @@ typedef union {
|
||||
gsSPSetOtherMode(G_SETOTHERMODE_H, G_MDSFT_ALPHADITHER, 2, mode)
|
||||
#endif
|
||||
|
||||
/* 'blendmask' is not supported anymore.
|
||||
/* 'blendmask' is not supported anymore.
|
||||
* The bits are reserved for future use.
|
||||
* Fri May 26 13:45:55 PDT 1995
|
||||
*/
|
||||
@@ -3181,7 +3217,7 @@ typedef union {
|
||||
*
|
||||
* This command makes all othermode parameters set.
|
||||
* Do not use this command in the same DL with another g*SPSetOtherMode DLs.
|
||||
*
|
||||
*
|
||||
* [Usage]
|
||||
* gDPSetOtherMode(pkt, modeA, modeB)
|
||||
*
|
||||
@@ -3434,9 +3470,9 @@ typedef union {
|
||||
((height)-1) << G_TEXTURE_IMAGE_FRAC) \
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Allow tmem address and render tile to be specified.
|
||||
* The S at the end means odd lines are already word Swapped
|
||||
* The S at the end means odd lines are already word Swapped
|
||||
*/
|
||||
#define gDPLoadMultiBlockS(pkt, timg, tmem, rtile, fmt, siz, width, \
|
||||
height, pal, cms, cmt, masks, maskt, shifts, shiftt) \
|
||||
@@ -3652,13 +3688,13 @@ typedef union {
|
||||
((width)-1) << G_TEXTURE_IMAGE_FRAC, \
|
||||
((height)-1) << G_TEXTURE_IMAGE_FRAC)
|
||||
|
||||
/*
|
||||
/*
|
||||
* Allows tmem and render tile to be specified. Useful when loading
|
||||
* several tiles at a time.
|
||||
*
|
||||
* Here is the static form of the pre-swapped texture block loading
|
||||
* See gDPLoadTextureBlockS() for reference. Basically, just don't
|
||||
* calculate DxT, use 0
|
||||
* calculate DxT, use 0
|
||||
*/
|
||||
|
||||
#define gsDPLoadMultiBlockS(timg, tmem, rtile, fmt, siz, width, height, \
|
||||
@@ -3742,7 +3778,7 @@ typedef union {
|
||||
}
|
||||
|
||||
/*
|
||||
* 4-bit load block. Allows tmem and render tile to be specified. Useful when
|
||||
* 4-bit load block. Allows tmem and render tile to be specified. Useful when
|
||||
* loading multiple tiles. The S means odd lines are already word swapped.
|
||||
*/
|
||||
#define gDPLoadMultiBlock_4bS(pkt, timg, tmem, rtile, fmt, width, height,\
|
||||
@@ -4177,7 +4213,7 @@ typedef union {
|
||||
G_IM_FMT_RGBA, G_IM_SIZ_16b, 4*16, 1, \
|
||||
pal, 0, 0, 0, 0, 0, 0)
|
||||
|
||||
#endif /* _HW_VERSION_1 */
|
||||
#endif /* _HW_VERSION_1 */
|
||||
|
||||
/*
|
||||
* Load a 256-entry palette (for 8-bit CI textures)
|
||||
@@ -4219,7 +4255,7 @@ typedef union {
|
||||
gsDPLoadSync(), \
|
||||
gsDPLoadTLUTCmd(G_TX_LOADTILE, 255), \
|
||||
gsDPPipeSync()
|
||||
|
||||
|
||||
#else /* **** WORKAROUND hardware 1 load_tlut bug ****** */
|
||||
|
||||
#define gsDPLoadTLUT_pal256(dram) \
|
||||
@@ -4274,7 +4310,7 @@ typedef union {
|
||||
G_IM_FMT_RGBA, G_IM_SIZ_16b, 4, count, \
|
||||
0, 0, 0, 0, 0, 0, 0)
|
||||
|
||||
#endif /* _HW_VERSION_1 */
|
||||
#endif /* _HW_VERSION_1 */
|
||||
|
||||
#define gDPSetScissor(pkt, mode, ulx, uly, lrx, lry) \
|
||||
{ \
|
||||
@@ -4429,7 +4465,7 @@ typedef union {
|
||||
}
|
||||
|
||||
/* Notice that textured rectangles are 128-bit commands, therefore
|
||||
* gsDPTextureRectangle() should not be used in display lists
|
||||
* gsDPTextureRectangle() should not be used in display lists
|
||||
* under normal circumstances (use gsSPTextureRectangle()).
|
||||
* That is also why there is no gDPTextureRectangle() macros.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user