Hex Cleanup (#960)

* Hex Cleanup

* PR Suggestions
This commit is contained in:
engineer124 2022-07-23 14:57:47 -04:00 committed by GitHub
parent eff952b944
commit 260be2c36b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 197 additions and 198 deletions

View File

@ -17,24 +17,24 @@
# define F3DEX_GBI
# endif
#define G_NOOP 0x00
#define G_RDPHALF_2 0xf1
#define G_SETOTHERMODE_H 0xe3
#define G_SETOTHERMODE_L 0xe2
#define G_RDPHALF_1 0xe1
#define G_SPNOOP 0xe0
#define G_ENDDL 0xdf
#define G_DL 0xde
#define G_LOAD_UCODE 0xdd
#define G_MOVEMEM 0xdc
#define G_MOVEWORD 0xdb
#define G_MTX 0xda
#define G_GEOMETRYMODE 0xd9
#define G_POPMTX 0xd8
#define G_TEXTURE 0xd7
#define G_DMA_IO 0xd6
#define G_SPECIAL_1 0xd5
#define G_SPECIAL_2 0xd4
#define G_SPECIAL_3 0xd3
#define G_RDPHALF_2 0xF1
#define G_SETOTHERMODE_H 0xE3
#define G_SETOTHERMODE_L 0xE2
#define G_RDPHALF_1 0xE1
#define G_SPNOOP 0xE0
#define G_ENDDL 0xDF
#define G_DL 0xDE
#define G_LOAD_UCODE 0xDD
#define G_MOVEMEM 0xDC
#define G_MOVEWORD 0xDB
#define G_MTX 0xDA
#define G_GEOMETRYMODE 0xD9
#define G_POPMTX 0xD8
#define G_TEXTURE 0xD7
#define G_DMA_IO 0xD6
#define G_SPECIAL_1 0xD5
#define G_SPECIAL_2 0xD4
#define G_SPECIAL_3 0xD3
#define G_VTX 0x01
#define G_MODIFYVTX 0x02
@ -89,38 +89,38 @@
#define G_SPRITE2D_DRAW (G_IMMFIRST-2)
/* RDP commands: */
#define G_NOOP 0xc0 /* 0 */
#define G_NOOP 0xC0 /* 0 */
#endif /* F3DEX_GBI_2 */
/* RDP commands: */
#define G_SETCIMG 0xff /* -1 */
#define G_SETZIMG 0xfe /* -2 */
#define G_SETTIMG 0xfd /* -3 */
#define G_SETCOMBINE 0xfc /* -4 */
#define G_SETENVCOLOR 0xfb /* -5 */
#define G_SETPRIMCOLOR 0xfa /* -6 */
#define G_SETBLENDCOLOR 0xf9 /* -7 */
#define G_SETFOGCOLOR 0xf8 /* -8 */
#define G_SETFILLCOLOR 0xf7 /* -9 */
#define G_FILLRECT 0xf6 /* -10 */
#define G_SETTILE 0xf5 /* -11 */
#define G_LOADTILE 0xf4 /* -12 */
#define G_LOADBLOCK 0xf3 /* -13 */
#define G_SETTILESIZE 0xf2 /* -14 */
#define G_LOADTLUT 0xf0 /* -16 */
#define G_RDPSETOTHERMODE 0xef /* -17 */
#define G_SETPRIMDEPTH 0xee /* -18 */
#define G_SETSCISSOR 0xed /* -19 */
#define G_SETCONVERT 0xec /* -20 */
#define G_SETKEYR 0xeb /* -21 */
#define G_SETKEYGB 0xea /* -22 */
#define G_RDPFULLSYNC 0xe9 /* -23 */
#define G_RDPTILESYNC 0xe8 /* -24 */
#define G_RDPPIPESYNC 0xe7 /* -25 */
#define G_RDPLOADSYNC 0xe6 /* -26 */
#define G_TEXRECTFLIP 0xe5 /* -27 */
#define G_TEXRECT 0xe4 /* -28 */
#define G_SETCIMG 0xFF /* -1 */
#define G_SETZIMG 0xFE /* -2 */
#define G_SETTIMG 0xFD /* -3 */
#define G_SETCOMBINE 0xFC /* -4 */
#define G_SETENVCOLOR 0xFB /* -5 */
#define G_SETPRIMCOLOR 0xFA /* -6 */
#define G_SETBLENDCOLOR 0xF9 /* -7 */
#define G_SETFOGCOLOR 0xF8 /* -8 */
#define G_SETFILLCOLOR 0xF7 /* -9 */
#define G_FILLRECT 0xF6 /* -10 */
#define G_SETTILE 0xF5 /* -11 */
#define G_LOADTILE 0xF4 /* -12 */
#define G_LOADBLOCK 0xF3 /* -13 */
#define G_SETTILESIZE 0xF2 /* -14 */
#define G_LOADTLUT 0xF0 /* -16 */
#define G_RDPSETOTHERMODE 0xEF /* -17 */
#define G_SETPRIMDEPTH 0xEE /* -18 */
#define G_SETSCISSOR 0xED /* -19 */
#define G_SETCONVERT 0xEC /* -20 */
#define G_SETKEYR 0xEB /* -21 */
#define G_SETKEYGB 0xEA /* -22 */
#define G_RDPFULLSYNC 0xE9 /* -23 */
#define G_RDPTILESYNC 0xE8 /* -24 */
#define G_RDPPIPESYNC 0xE7 /* -25 */
#define G_RDPLOADSYNC 0xE6 /* -26 */
#define G_TEXRECTFLIP 0xE5 /* -27 */
#define G_TEXRECT 0xE4 /* -28 */
/*
@ -131,14 +131,14 @@
* These id's are -56, -52, -54, -50, -55, -51, -53, -49, ...
* edge, shade, texture, zbuff bits: estz
*/
#define G_TRI_FILL 0xc8 /* fill triangle: 11001000 */
#define G_TRI_SHADE 0xcc /* shade triangle: 11001100 */
#define G_TRI_TXTR 0xca /* texture triangle: 11001010 */
#define G_TRI_SHADE_TXTR 0xce /* shade, texture triangle: 11001110 */
#define G_TRI_FILL_ZBUFF 0xc9 /* fill, zbuff triangle: 11001001 */
#define G_TRI_SHADE_ZBUFF 0xcd /* shade, zbuff triangle: 11001101 */
#define G_TRI_TXTR_ZBUFF 0xcb /* texture, zbuff triangle: 11001011 */
#define G_TRI_SHADE_TXTR_ZBUFF 0xcf /* shade, txtr, zbuff trngl: 11001111 */
#define G_TRI_FILL 0xC8 /* fill triangle: 11001000 */
#define G_TRI_SHADE 0xCC /* shade triangle: 11001100 */
#define G_TRI_TXTR 0xCA /* texture triangle: 11001010 */
#define G_TRI_SHADE_TXTR 0xCE /* shade, texture triangle: 11001110 */
#define G_TRI_FILL_ZBUFF 0xC9 /* fill, zbuff triangle: 11001001 */
#define G_TRI_SHADE_ZBUFF 0xCD /* shade, zbuff triangle: 11001101 */
#define G_TRI_TXTR_ZBUFF 0xCB /* texture, zbuff triangle: 11001011 */
#define G_TRI_SHADE_TXTR_ZBUFF 0xCF /* shade, txtr, zbuff trngl: 11001111 */
/*
* A TRI_FILL triangle is just the edges. You need to set the DP
@ -178,13 +178,13 @@
/* gets added to RDP command, in order to test for addres fixup: */
#define G_RDP_ADDR_FIXUP 3 /* |RDP cmds| <= this, do addr fixup */
#ifdef _LANGUAGE_ASSEMBLY
#define G_RDP_TEXRECT_CHECK ((-1*G_TEXRECTFLIP)& 0xff)
#define G_RDP_TEXRECT_CHECK ((-1*G_TEXRECTFLIP)& 0xFF)
#endif
/* macros for command parsing: */
#define GDMACMD(x) (x)
#define GIMMCMD(x) (G_IMMFIRST-(x))
#define GRDPCMD(x) (0xff-(x))
#define GRDPCMD(x) (0xFF-(x))
#define G_DMACMDSIZ 128
#define G_IMMCMDSIZ 64
@ -211,11 +211,11 @@
* Note : this number is NOT the viewport z-scale constant.
* See the comment next to G_MAXZ for more info.
*/
#define G_MAXFBZ 0x3fff /* 3b exp, 11b mantissa */
#define G_MAXFBZ 0x3FFF /* 3b exp, 11b mantissa */
#define GPACK_RGBA5551(r, g, b, a) ((((r)<<8) & 0xf800) | \
(((g)<<3) & 0x7c0) | \
(((b)>>2) & 0x3e) | ((a) & 0x1))
#define GPACK_RGBA5551(r, g, b, a) ((((r)<<8) & 0xF800) | \
(((g)<<3) & 0x7C0) | \
(((b)>>2) & 0x3E) | ((a) & 0x1))
#define GPACK_IA16(i, a) (((i) << 8) | (a))
#define GPACK_ZDZ(z, dz) ((z) << 2 | (dz))
@ -590,7 +590,7 @@
#define ZMODE_OPA 0
#define ZMODE_INTER 0x400
#define ZMODE_XLU 0x800
#define ZMODE_DEC 0xc00
#define ZMODE_DEC 0xC00
#define CVG_X_ALPHA 0x1000
#define ALPHA_CVG_SEL 0x2000
#define FORCE_BL 0x4000
@ -1075,7 +1075,7 @@ typedef struct {
* but we don't have the ucode to do that...
*
*/
#define G_MAXZ 0x03ff /* 10 bits of integer screen-Z precision */
#define G_MAXZ 0x03FF /* 10 bits of integer screen-Z precision */
/*
* The viewport structure elements have 2 bits of fraction, necessary
@ -1131,17 +1131,17 @@ typedef union {
# define G_MV_LOOKATX 0x84
# define G_MV_L0 0x86
# define G_MV_L1 0x88
# define G_MV_L2 0x8a
# define G_MV_L3 0x8c
# define G_MV_L4 0x8e
# define G_MV_L2 0x8A
# define G_MV_L3 0x8C
# define G_MV_L4 0x8E
# define G_MV_L5 0x90
# define G_MV_L6 0x92
# define G_MV_L7 0x94
# define G_MV_TXTATT 0x96
# define G_MV_MATRIX_1 0x9e /* NOTE: this is in moveword table */
# define G_MV_MATRIX_1 0x9E /* NOTE: this is in moveword table */
# define G_MV_MATRIX_2 0x98
# define G_MV_MATRIX_3 0x9a
# define G_MV_MATRIX_4 0x9c
# define G_MV_MATRIX_3 0x9A
# define G_MV_MATRIX_4 0x9C
#endif /* F3DEX_GBI_2 */
/*
@ -1157,22 +1157,22 @@ typedef union {
#define G_MW_CLIP 0x04
#define G_MW_SEGMENT 0x06
#define G_MW_FOG 0x08
#define G_MW_LIGHTCOL 0x0a
#define G_MW_LIGHTCOL 0x0A
#ifdef F3DEX_GBI_2
# define G_MW_FORCEMTX 0x0c
# define G_MW_FORCEMTX 0x0C
#else /* F3DEX_GBI_2 */
# define G_MW_POINTS 0x0c
# define G_MW_POINTS 0x0C
#endif /* F3DEX_GBI_2 */
#define G_MW_PERSPNORM 0x0e
#define G_MW_PERSPNORM 0x0E
/*
* 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
#define G_MWO_CLIP_RNY 0x0C
#define G_MWO_CLIP_RPX 0x14
#define G_MWO_CLIP_RPY 0x1c
#define G_MWO_CLIP_RPY 0x1C
#define G_MWO_SEGMENT_0 0x00
#define G_MWO_SEGMENT_1 0x01
#define G_MWO_SEGMENT_2 0x02
@ -1183,30 +1183,30 @@ typedef union {
#define G_MWO_SEGMENT_7 0x07
#define G_MWO_SEGMENT_8 0x08
#define G_MWO_SEGMENT_9 0x09
#define G_MWO_SEGMENT_A 0x0a
#define G_MWO_SEGMENT_B 0x0b
#define G_MWO_SEGMENT_C 0x0c
#define G_MWO_SEGMENT_D 0x0d
#define G_MWO_SEGMENT_E 0x0e
#define G_MWO_SEGMENT_F 0x0f
#define G_MWO_SEGMENT_A 0x0A
#define G_MWO_SEGMENT_B 0x0B
#define G_MWO_SEGMENT_C 0x0C
#define G_MWO_SEGMENT_D 0x0D
#define G_MWO_SEGMENT_E 0x0E
#define G_MWO_SEGMENT_F 0x0F
#define G_MWO_FOG 0x00
#define G_MWO_aLIGHT_1 0x00
#define G_MWO_bLIGHT_1 0x04
#ifdef F3DEX_GBI_2
#define G_MWO_aLIGHT_2 0x18
#define G_MWO_bLIGHT_2 0x1c
#define G_MWO_bLIGHT_2 0x1C
#define G_MWO_aLIGHT_3 0x30
#define G_MWO_bLIGHT_3 0x34
#define G_MWO_aLIGHT_4 0x48
#define G_MWO_bLIGHT_4 0x4c
#define G_MWO_bLIGHT_4 0x4C
#define G_MWO_aLIGHT_5 0x60
#define G_MWO_bLIGHT_5 0x64
#define G_MWO_aLIGHT_6 0x78
#define G_MWO_bLIGHT_6 0x7c
#define G_MWO_bLIGHT_6 0x7C
#define G_MWO_aLIGHT_7 0x90
#define G_MWO_bLIGHT_7 0x94
#define G_MWO_aLIGHT_8 0xa8
#define G_MWO_bLIGHT_8 0xac
#define G_MWO_aLIGHT_8 0xA8
#define G_MWO_bLIGHT_8 0xAC
#else
#define G_MWO_aLIGHT_2 0x20
#define G_MWO_bLIGHT_2 0x24
@ -1216,33 +1216,33 @@ typedef union {
#define G_MWO_bLIGHT_4 0x64
#define G_MWO_aLIGHT_5 0x80
#define G_MWO_bLIGHT_5 0x84
#define G_MWO_aLIGHT_6 0xa0
#define G_MWO_bLIGHT_6 0xa4
#define G_MWO_aLIGHT_7 0xc0
#define G_MWO_bLIGHT_7 0xc4
#define G_MWO_aLIGHT_8 0xe0
#define G_MWO_bLIGHT_8 0xe4
#define G_MWO_aLIGHT_6 0xA0
#define G_MWO_bLIGHT_6 0xA4
#define G_MWO_aLIGHT_7 0xC0
#define G_MWO_bLIGHT_7 0xC4
#define G_MWO_aLIGHT_8 0xE0
#define G_MWO_bLIGHT_8 0xE4
#endif
#define G_MWO_MATRIX_XX_XY_I 0x00
#define G_MWO_MATRIX_XZ_XW_I 0x04
#define G_MWO_MATRIX_YX_YY_I 0x08
#define G_MWO_MATRIX_YZ_YW_I 0x0c
#define G_MWO_MATRIX_YZ_YW_I 0x0C
#define G_MWO_MATRIX_ZX_ZY_I 0x10
#define G_MWO_MATRIX_ZZ_ZW_I 0x14
#define G_MWO_MATRIX_WX_WY_I 0x18
#define G_MWO_MATRIX_WZ_WW_I 0x1c
#define G_MWO_MATRIX_WZ_WW_I 0x1C
#define G_MWO_MATRIX_XX_XY_F 0x20
#define G_MWO_MATRIX_XZ_XW_F 0x24
#define G_MWO_MATRIX_YX_YY_F 0x28
#define G_MWO_MATRIX_YZ_YW_F 0x2c
#define G_MWO_MATRIX_YZ_YW_F 0x2C
#define G_MWO_MATRIX_ZX_ZY_F 0x30
#define G_MWO_MATRIX_ZZ_ZW_F 0x34
#define G_MWO_MATRIX_WX_WY_F 0x38
#define G_MWO_MATRIX_WZ_WW_F 0x3c
#define G_MWO_MATRIX_WZ_WW_F 0x3C
#define G_MWO_POINT_RGBA 0x10
#define G_MWO_POINT_ST 0x14
#define G_MWO_POINT_XYSCREEN 0x18
#define G_MWO_POINT_ZSCREEN 0x1c
#define G_MWO_POINT_ZSCREEN 0x1C
/*
* Light structure.
@ -2373,14 +2373,14 @@ _DW({ \
Gfx *_g = (Gfx *)(pkt); \
\
_g->words.w0 = _SHIFTL(G_CULLDL, 24, 8) | \
((0x0f & (vstart))*40); \
_g->words.w1 = (unsigned int)((0x0f & ((vend)+1))*40); \
((0x0FF& (vstart))*40); \
_g->words.w1 = (unsigned int)((0x0F & ((vend)+1))*40); \
}
#define gsSPCullDisplayList(vstart,vend) \
{ \
_SHIFTL(G_CULLDL, 24, 8) | ((0x0f & (vstart))*40), \
((0x0f & ((vend)+1))*40) \
_SHIFTL(G_CULLDL, 24, 8) | ((0x0F & (vstart))*40), \
((0x0F & ((vend)+1))*40) \
}
#endif
@ -2393,17 +2393,17 @@ _DW({ \
* Clipping Macros
*/
#define FR_NEG_FRUSTRATIO_1 0x00000001
#define FR_POS_FRUSTRATIO_1 0x0000ffff
#define FR_POS_FRUSTRATIO_1 0x0000FFFF
#define FR_NEG_FRUSTRATIO_2 0x00000002
#define FR_POS_FRUSTRATIO_2 0x0000fffe
#define FR_POS_FRUSTRATIO_2 0x0000FFFE
#define FR_NEG_FRUSTRATIO_3 0x00000003
#define FR_POS_FRUSTRATIO_3 0x0000fffd
#define FR_POS_FRUSTRATIO_3 0x0000FFFD
#define FR_NEG_FRUSTRATIO_4 0x00000004
#define FR_POS_FRUSTRATIO_4 0x0000fffc
#define FR_POS_FRUSTRATIO_4 0x0000FFFC
#define FR_NEG_FRUSTRATIO_5 0x00000005
#define FR_POS_FRUSTRATIO_5 0x0000fffb
#define FR_POS_FRUSTRATIO_5 0x0000FFFB
#define FR_NEG_FRUSTRATIO_6 0x00000006
#define FR_POS_FRUSTRATIO_6 0x0000fffa
#define FR_POS_FRUSTRATIO_6 0x0000FFFA
/*
* r should be one of: FRUSTRATIO_1, FRUSTRATIO_2, FRUSTRATIO_3, ... FRUSTRATIO_6
*/
@ -2867,18 +2867,18 @@ _DW({ \
gsSPLookAtY((char *)(la)+16)
#define gDPSetHilite1Tile(pkt, tile, hilite, width, height) \
gDPSetTileSize(pkt, tile, (hilite)->h.x1 & 0xfff, (hilite)->h.y1 & 0xfff, \
((((width)-1)*4)+(hilite)->h.x1) & 0xfff, ((((height)-1)*4)+(hilite)->h.y1) & 0xfff)
gDPSetTileSize(pkt, tile, (hilite)->h.x1 & 0xFFF, (hilite)->h.y1 & 0xFFF, \
((((width)-1)*4)+(hilite)->h.x1) & 0xFFF, ((((height)-1)*4)+(hilite)->h.y1) & 0xFFF)
#define gsDPSetHilite1Tile(tile, hilite, width, height) \
gsDPSetTileSize(tile, (hilite)->h.x1 & 0xfff, (hilite)->h.y1 & 0xfff, \
((((width)-1)*4)+(hilite)->h.x1) & 0xfff, ((((height)-1)*4)+(hilite)->h.y1) & 0xfff)
gsDPSetTileSize(tile, (hilite)->h.x1 & 0xFFF, (hilite)->h.y1 & 0xFFF, \
((((width)-1)*4)+(hilite)->h.x1) & 0xFFF, ((((height)-1)*4)+(hilite)->h.y1) & 0xFFF)
#define gDPSetHilite2Tile(pkt, tile, hilite, width, height) \
gDPSetTileSize(pkt, tile, (hilite)->h.x2 & 0xfff, (hilite)->h.y2 & 0xfff, \
((((width)-1)*4)+(hilite)->h.x2) & 0xfff, ((((height)-1)*4)+(hilite)->h.y2) & 0xfff)
gDPSetTileSize(pkt, tile, (hilite)->h.x2 & 0xFFF, (hilite)->h.y2 & 0xFFF, \
((((width)-1)*4)+(hilite)->h.x2) & 0xFFF, ((((height)-1)*4)+(hilite)->h.y2) & 0xFFF)
#define gsDPSetHilite2Tile(tile, hilite, width, height) \
gsDPSetTileSize(tile, (hilite)->h.x2 & 0xfff, (hilite)->h.y2 & 0xfff, \
((((width)-1)*4)+(hilite)->h.x2) & 0xfff, ((((height)-1)*4)+(hilite)->h.y2) & 0xfff)
gsDPSetTileSize(tile, (hilite)->h.x2 & 0xFFF, (hilite)->h.y2 & 0xFFF, \
((((width)-1)*4)+(hilite)->h.x2) & 0xFFF, ((((height)-1)*4)+(hilite)->h.y2) & 0xFFF)
/*
* FOG macros
@ -4333,7 +4333,7 @@ _DW({ \
{ \
gDPSetTextureImage(pkt, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, dram); \
gDPTileSync(pkt); \
gDPSetTile(pkt, 0, 0, 0, (256+(((pal)&0xf)*16)), \
gDPSetTile(pkt, 0, 0, 0, (256+(((pal)&0xF)*16)), \
G_TX_LOADTILE, 0 , 0, 0, 0, 0, 0, 0); \
gDPLoadSync(pkt); \
gDPLoadTLUTCmd(pkt, G_TX_LOADTILE, 15); \
@ -4344,7 +4344,7 @@ _DW({ \
#define gDPLoadTLUT_pal16(pkt, pal, dram) \
\
_gDPLoadTextureBlock(pkt, dram, (256+(((pal)&0xf)*16)), \
_gDPLoadTextureBlock(pkt, dram, (256+(((pal)&0xF)*16)), \
G_IM_FMT_RGBA, G_IM_SIZ_16b, 4*16, 1, \
pal, 0, 0, 0, 0, 0, 0)
@ -4361,7 +4361,7 @@ _DW({ \
\
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, dram), \
gsDPTileSync(), \
gsDPSetTile(0, 0, 0, (256+(((pal)&0xf)*16)), \
gsDPSetTile(0, 0, 0, (256+(((pal)&0xF)*16)), \
G_TX_LOADTILE, 0 , 0, 0, 0, 0, 0, 0), \
gsDPLoadSync(), \
gsDPLoadTLUTCmd(G_TX_LOADTILE, 15), \
@ -4371,7 +4371,7 @@ _DW({ \
#define gsDPLoadTLUT_pal16(pal, dram) \
\
_gsDPLoadTextureBlock(dram, (256+(((pal)&0xf)*16)), \
_gsDPLoadTextureBlock(dram, (256+(((pal)&0xF)*16)), \
G_IM_FMT_RGBA, G_IM_SIZ_16b, 4*16, 1, \
pal, 0, 0, 0, 0, 0, 0)

View File

@ -87,7 +87,7 @@
**************************************************************************/
#define NUM_SEGMENTS (16)
#define SEGMENT_OFFSET(a) ((unsigned int)(a) & 0x00ffffff)
#define SEGMENT_OFFSET(a) ((unsigned int)(a) & 0x00FFFFFF)
#define SEGMENT_NUMBER(a) (((unsigned int)(a) << 4) >> 28)
#define SEGMENT_ADDR(num, off) (((num) << 24) + (off))

View File

@ -11,19 +11,19 @@ typedef u32 uintptr_t;
#define INT32_MIN (-0x80000000)
#define INT64_MIN (-0x8000000000000000)
#define INT8_MAX 0x7f
#define INT16_MAX 0x7fff
#define INT32_MAX 0x7fffffff
#define INT64_MAX 0x7fffffffffffffff
#define INT8_MAX 0x7F
#define INT16_MAX 0x7FFF
#define INT32_MAX 0x7FFFFFFF
#define INT64_MAX 0x7FFFFFFFFFFFFFFF
#define UINT8_MAX 0xff
#define UINT16_MAX 0xffff
#define UINT32_MAX 0xffffffff
#define UINT64_MAX 0xffffffffffffffff
#define UINT8_MAX 0xFF
#define UINT16_MAX 0xFFFF
#define UINT32_MAX 0xFFFFFFFF
#define UINT64_MAX 0xFFFFFFFFFFFFFFFF
#define INTPTR_MIN (-0x80000000)
#define INTPTR_MAX 0x7fffffff
#define UINTPTR_MAX 0xffffffff
#define INTPTR_MAX 0x7FFFFFFF
#define UINTPTR_MAX 0xFFFFFFFF
#endif /* STDINT_H */

View File

@ -20,7 +20,7 @@ extern "C" {
* Background
*---------------------------------------------------------------------------*/
#define G_BGLT_LOADBLOCK 0x0033
#define G_BGLT_LOADTILE 0xfff4
#define G_BGLT_LOADTILE 0xFFF4
#define G_BG_FLAG_FLIPS 0x01
#define G_BG_FLAG_FLIPT 0x10
@ -155,7 +155,7 @@ typedef union {
* Loading into TMEM
*---------------------------------------------------------------------------*/
#define G_OBJLT_TXTRBLOCK 0x00001033
#define G_OBJLT_TXTRTILE 0x00fc1034
#define G_OBJLT_TXTRTILE 0x00FC1034
#define G_OBJLT_TLUT 0x00000030
#define GS_TB_TSIZE(pix,siz) (GS_PIX2TMEM((pix),(siz))-1)
@ -220,9 +220,9 @@ typedef struct {
*===========================================================================*/
/* GBI Header */
#ifdef F3DEX_GBI_2
#define G_OBJ_RECTANGLE_R 0xda
#define G_OBJ_MOVEMEM 0xdc
#define G_RDPHALF_0 0xe4
#define G_OBJ_RECTANGLE_R 0xDA
#define G_OBJ_MOVEMEM 0xDC
#define G_RDPHALF_0 0xE4
#define G_OBJ_RECTANGLE 0x01
#define G_OBJ_SPRITE 0x02
#define G_SELECT_DL 0x04
@ -231,22 +231,22 @@ typedef struct {
#define G_OBJ_LDTX_RECT 0x07
#define G_OBJ_LDTX_RECT_R 0x08
#define G_BG_1CYC 0x09
#define G_BG_COPY 0x0a
#define G_OBJ_RENDERMODE 0x0b
#define G_BG_COPY 0x0A
#define G_OBJ_RENDERMODE 0x0B
#else
#define G_BG_1CYC 0x01
#define G_BG_COPY 0x02
#define G_OBJ_RECTANGLE 0x03
#define G_OBJ_SPRITE 0x04
#define G_OBJ_MOVEMEM 0x05
#define G_SELECT_DL 0xb0
#define G_OBJ_RENDERMODE 0xb1
#define G_OBJ_RECTANGLE_R 0xb2
#define G_OBJ_LOADTXTR 0xc1
#define G_OBJ_LDTX_SPRITE 0xc2
#define G_OBJ_LDTX_RECT 0xc3
#define G_OBJ_LDTX_RECT_R 0xc4
#define G_RDPHALF_0 0xe4
#define G_SELECT_DL 0xB0
#define G_OBJ_RENDERMODE 0xB1
#define G_OBJ_RECTANGLE_R 0xB2
#define G_OBJ_LOADTXTR 0xC1
#define G_OBJ_LDTX_SPRITE 0xC2
#define G_OBJ_LDTX_RECT 0xC3
#define G_OBJ_LDTX_RECT_R 0xC4
#define G_RDPHALF_0 0xE4
#endif
/*---------------------------------------------------------------------------*
@ -293,16 +293,16 @@ typedef struct {
* Select Display List
*---------------------------------------------------------------------------*/
#define gSPSelectDL(pkt, mptr, sid, flag, mask) \
{ gDma1p((pkt), G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \
{ gDma1p((pkt), G_RDPHALF_0, (flag), (u32)(mptr) & 0xFFFF, (sid)); \
gDma1p((pkt), G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_PUSH); }
#define gsSPSelectDL(mptr, sid, flag, mask) \
{ gsDma1p(G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \
{ gsDma1p(G_RDPHALF_0, (flag), (u32)(mptr) & 0xFFFF, (sid)); \
gsDma1p(G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_PUSH); }
#define gSPSelectBranchDL(pkt, mptr, sid, flag, mask) \
{ gDma1p((pkt), G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \
{ gDma1p((pkt), G_RDPHALF_0, (flag), (u32)(mptr) & 0xFFFF, (sid)); \
gDma1p((pkt), G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_NOPUSH); }
#define gsSPSelectBranchDL(mptr, sid, flag, mask) \
{ gsDma1p(G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \
{ gsDma1p(G_RDPHALF_0, (flag), (u32)(mptr) & 0xFFFF, (sid)); \
gsDma1p(G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_NOPUSH); }
/*---------------------------------------------------------------------------*

View File

@ -63,7 +63,7 @@ typedef struct {
/* 0x02 */ u16 retraceCount;
/* 0x04 */ void* buffer;
/* 0x08 */ OSViMode* modep;
/* 0x0c */ u32 features;
/* 0x0C */ u32 features;
/* 0x10 */ OSMesgQueue* mq;
/* 0x14 */ OSMesg* msg;
/* 0x18 */ __OSViScale x;

View File

@ -1266,21 +1266,21 @@ enum fram_command {
Writes Contents in FLASHRAM_MODE_WRITE
After execution, sets FRAM_MODE to FRAM_MODE_NOP */
FRAM_COMMAND_EXECUTE = 0xD2000000,
/* flashram->erase_offset = (command & 0xffff) * 128; */
/* flashram->erase_offset = (command & 0xFFFF) * 128; */
FRAM_COMMAND_SET_ERASE_SECTOR_OFFSET = 0x4B000000,
/* flashram->mode = FLASHRAM_MODE_ERASE;
flashram->status = 0x1111800800c20000LL; */
flashram->status = 0x1111800800C20000LL; */
FRAM_COMMAND_SET_MODE_ERASE_AND_STATUS = 0x78000000,
/* flashram->erase_offset = (command & 0xffff) * 128;
flashram->status = 0x1111800400c20000LL; */
/* flashram->erase_offset = (command & 0xFFFF) * 128;
flashram->status = 0x1111800400C20000LL; */
FRAM_COMMAND_SET_ERASE_SECTOR_OFFSET_AND_STATUS = 0xA5000000,
/* flashram->mode = FLASHRAM_MODE_WRITE; */
FRAM_COMMAND_SET_MODE_WRITE = 0xB4000000,
/* flashram->mode = FLASHRAM_MODE_STATUS;
flashram->status = 0x1111800100c20000LL; */
flashram->status = 0x1111800100C20000LL; */
FRAM_COMMAND_SET_MODE_STATUS_AND_STATUS = 0xE1000000,
/* flashram->mode = FLASHRAM_MODE_READ;
flashram->status = 0x11118004f0000000LL; */
flashram->status = 0x11118004F0000000LL; */
FRAM_COMMAND_SET_MODE_READ_AND_STATUS = 0xF0000000,
/* unk */
FRAM_COMMAND_UNK_ERASE_OPERATION = 0x3C000000

View File

@ -269,9 +269,9 @@ void Fault_DrawCornerRec(u16 color) {
void Fault_PrintFReg(s32 idx, f32* value) {
u32 raw = *(u32*)value;
s32 v0 = ((raw & 0x7f800000) >> 0x17) - 0x7f;
s32 v0 = ((raw & 0x7F800000) >> 0x17) - 0x7F;
if ((v0 >= -0x7e && v0 < 0x80) || raw == 0) {
if ((v0 >= -0x7E && v0 < 0x80) || raw == 0) {
FaultDrawer_Printf("F%02d:%14.7e ", idx, *value);
} else {
FaultDrawer_Printf("F%02d: %08x(16) ", idx, raw);
@ -320,7 +320,7 @@ void osSyncPrintfFPCR(u32 value) {
void Fault_PrintThreadContext(OSThread* t) {
__OSThreadContext* ctx;
s32 causeStrIdx = (s32)((((u32)t->context.cause >> 2) & 0x1f) << 0x10) >> 0x10;
s32 causeStrIdx = (s32)((((u32)t->context.cause >> 2) & 0x1F) << 0x10) >> 0x10;
if (causeStrIdx == 0x17) {
causeStrIdx = 0x10;
}
@ -383,11 +383,11 @@ void Fault_PrintThreadContext(OSThread* t) {
void osSyncPrintfThreadContext(OSThread* t) {
__OSThreadContext* ctx;
s32 causeStrIdx = (s32)((((u32)t->context.cause >> 2) & 0x1f) << 0x10) >> 0x10;
s32 causeStrIdx = (s32)((((u32)t->context.cause >> 2) & 0x1F) << 0x10) >> 0x10;
if (causeStrIdx == 0x17) {
causeStrIdx = 0x10;
}
if (causeStrIdx == 0x1f) {
if (causeStrIdx == 0x1F) {
causeStrIdx = 0x11;
}
@ -416,29 +416,29 @@ void osSyncPrintfThreadContext(OSThread* t) {
osSyncPrintfFReg(6, &ctx->fp6.f.f_even);
osSyncPrintf("\n");
osSyncPrintfFReg(8, &ctx->fp8.f.f_even);
osSyncPrintfFReg(0xa, &ctx->fp10.f.f_even);
osSyncPrintfFReg(10, &ctx->fp10.f.f_even);
osSyncPrintf("\n");
osSyncPrintfFReg(0xc, &ctx->fp12.f.f_even);
osSyncPrintfFReg(0xe, &ctx->fp14.f.f_even);
osSyncPrintfFReg(12, &ctx->fp12.f.f_even);
osSyncPrintfFReg(14, &ctx->fp14.f.f_even);
osSyncPrintf("\n");
osSyncPrintfFReg(0x10, &ctx->fp16.f.f_even);
osSyncPrintfFReg(0x12, &ctx->fp18.f.f_even);
osSyncPrintfFReg(16, &ctx->fp16.f.f_even);
osSyncPrintfFReg(18, &ctx->fp18.f.f_even);
osSyncPrintf("\n");
osSyncPrintfFReg(0x14, &ctx->fp20.f.f_even);
osSyncPrintfFReg(0x16, &ctx->fp22.f.f_even);
osSyncPrintfFReg(20, &ctx->fp20.f.f_even);
osSyncPrintfFReg(22, &ctx->fp22.f.f_even);
osSyncPrintf("\n");
osSyncPrintfFReg(0x18, &ctx->fp24.f.f_even);
osSyncPrintfFReg(0x1a, &ctx->fp26.f.f_even);
osSyncPrintfFReg(24, &ctx->fp24.f.f_even);
osSyncPrintfFReg(26, &ctx->fp26.f.f_even);
osSyncPrintf("\n");
osSyncPrintfFReg(0x1c, &ctx->fp28.f.f_even);
osSyncPrintfFReg(0x1e, &ctx->fp30.f.f_even);
osSyncPrintfFReg(28, &ctx->fp28.f.f_even);
osSyncPrintfFReg(30, &ctx->fp30.f.f_even);
osSyncPrintf("\n");
}
OSThread* Fault_FindFaultedThread() {
OSThread* iter = __osGetActiveQueue();
while (iter->priority != -1) {
if (iter->priority > 0 && iter->priority < 0x7f && (iter->flags & 3)) {
if (iter->priority > 0 && iter->priority < 0x7F && (iter->flags & 3)) {
return iter;
}
iter = iter->tlnext;
@ -459,7 +459,7 @@ void Fault_Wait5Seconds(void) {
void Fault_WaitForButtonCombo(void) {
Input* input = &sFaultContext->padInput[0];
FaultDrawer_SetForeColor(0xffff);
FaultDrawer_SetForeColor(0xFFFF);
FaultDrawer_SetBackColor(1);
do {
do {
@ -480,8 +480,8 @@ void Fault_DrawMemDumpPage(const char* title, u32* addr, u32 param_3) {
if (alignedAddr < (u32*)0x80000000) {
alignedAddr = (u32*)0x80000000;
}
if (alignedAddr > (u32*)0x807fff00) {
alignedAddr = (u32*)0x807fff00;
if (alignedAddr > (u32*)0x807FFF00) {
alignedAddr = (u32*)0x807FFF00;
}
alignedAddr = (u32*)((u32)alignedAddr & ~3);
@ -513,8 +513,8 @@ void Fault_DrawMemDump(u32 pc, u32 sp, u32 unk0, u32 unk1) {
if (addr < 0x80000000) {
addr = 0x80000000;
}
if (addr > 0x807fff00) {
addr = 0x807fff00;
if (addr > 0x807FFF00) {
addr = 0x807FFF00;
}
addr &= ~0xF;
@ -696,7 +696,7 @@ void Fault_ResumeThread(OSThread* t) {
t->context.cause = 0;
t->context.fpcsr = 0;
t->context.pc += 4;
*(u32*)t->context.pc = 0xd;
*(u32*)t->context.pc = 0x0000000D; // write in a break instruction
osWritebackDCache((void*)t->context.pc, 4);
osInvalICache((void*)t->context.pc, 4);
osStartThread(t);

View File

@ -229,7 +229,7 @@ void func_8014CCB4(PlayState* play, s16* decodedBufPos, s32* offset, f32* arg3)
s32 k = *offset;
f32 f = *arg3;
Font_LoadChar(play, 0x838B, k); // 0x838b = ル in JISX0213
Font_LoadChar(play, 0x838B, k); // 0x838B = ル in JISX0213
k += FONT_CHAR_TEX_SIZE;
msgCtx->decodedBuffer.wchar[t] = 0x838B;
t += 1;

View File

@ -58,7 +58,7 @@ void Room_DrawType1Mesh(PlayState* play, Room* room, u32 flags) {
} else if (mesh->format == 2) {
func_8012E32C(play, room, flags);
} else {
__assert("../z_room.c", 0x3c5);
__assert("../z_room.c", 965);
}
}
@ -85,9 +85,8 @@ s32 Room_StartRoomTransition(PlayState* play, RoomContext* roomCtx, s32 index) {
roomCtx->unk31 = 1;
size = play->roomList[index].vromEnd - play->roomList[index].vromStart;
roomCtx->activeRoomVram =
(void*)(((s32)roomCtx->roomMemPages[roomCtx->activeMemPage] - (size + 8) * roomCtx->activeMemPage + 8) &
0xfffffff0);
roomCtx->activeRoomVram = (void*)(ALIGN16((u32)roomCtx->roomMemPages[roomCtx->activeMemPage] -
(size + 8) * roomCtx->activeMemPage - 7));
osCreateMesgQueue(&roomCtx->loadQueue, roomCtx->loadMsg, 1);
DmaMgr_SendRequestImpl(&roomCtx->dmaRequest, roomCtx->activeRoomVram, play->roomList[index].vromStart, size, 0,
@ -114,7 +113,7 @@ s32 Room_HandleLoadCallbacks(PlayState* play, RoomContext* roomCtx) {
if (((play->sceneNum != SCENE_IKANA) || (roomCtx->currRoom.num != 1)) &&
(play->sceneNum != SCENE_IKNINSIDE)) {
play->envCtx.lightSettingOverride = 0xff;
play->envCtx.lightSettingOverride = 0xFF;
play->envCtx.unk_E0 = 0;
}
func_800FEAB0();

View File

@ -237,9 +237,9 @@ void Scene_HeaderCmdRoomBehavior(PlayState* play, SceneCmd* cmd) {
play->roomCtx.currRoom.unk3 = cmd->roomBehavior.gpFlag1;
play->roomCtx.currRoom.unk2 = cmd->roomBehavior.gpFlag2 & 0xFF;
play->roomCtx.currRoom.unk5 = (cmd->roomBehavior.gpFlag2 >> 8) & 1;
play->msgCtx.unk12044 = (cmd->roomBehavior.gpFlag2 >> 0xa) & 1;
play->roomCtx.currRoom.enablePosLights = (cmd->roomBehavior.gpFlag2 >> 0xb) & 1;
play->envCtx.unk_E2 = (cmd->roomBehavior.gpFlag2 >> 0xc) & 1;
play->msgCtx.unk12044 = (cmd->roomBehavior.gpFlag2 >> 0xA) & 1;
play->roomCtx.currRoom.enablePosLights = (cmd->roomBehavior.gpFlag2 >> 0xB) & 1;
play->envCtx.unk_E2 = (cmd->roomBehavior.gpFlag2 >> 0xC) & 1;
}
// SceneTableEntry Header Command 0x0A: Mesh Header

View File

@ -1,6 +1,6 @@
#include "global.h"
#define FTOFRAC8(x) ((s32)MIN(((x) * (128.0f)), 127.0f) & 0xff)
#define FTOFRAC8(x) ((s32)MIN(((x) * (128.0f)), 127.0f) & 0xFF)
void guLookAtHiliteF(f32 mf[4][4], LookAt* l, Hilite* h, f32 xEye, f32 yEye, f32 zEye, f32 xAt, f32 yAt, f32 zAt,
f32 xUp, f32 yUp, f32 zUp, f32 xl1, f32 yl1, f32 zl1, /* light 1 direction */

View File

@ -28,7 +28,7 @@ void osContGetReadData(OSContPad* data) {
ptr = (u8*)__osContPifRam.ramarray;
for (i = 0; i < __osMaxControllers; i++, ptr += sizeof(__OSContReadFormat), data++) {
readformat = *(__OSContReadFormat*)ptr;
data->errno = (readformat.rxsize & 0xc0) >> 4;
data->errno = (readformat.rxsize & 0xC0) >> 4;
if (data->errno == 0) {
data->button = readformat.button;
data->stick_x = readformat.stick_x;

View File

@ -58,7 +58,7 @@ void __osContGetInitData(u8* pattern, OSContStatus* data) {
ptr = (u8*)__osContPifRam.ramarray;
for (i = 0; i < __osMaxControllers; i++, ptr += sizeof(requestHeader), data++) {
requestHeader = *(__OSContRequestHeader*)ptr;
data->errno = (requestHeader.rxsize & 0xc0) >> 4;
data->errno = (requestHeader.rxsize & 0xC0) >> 4;
if (data->errno == 0) {
data->type = requestHeader.typel << 8 | requestHeader.typeh;
data->status = requestHeader.status;

View File

@ -53,7 +53,7 @@ s32 __osEPiRawStartDma(OSPiHandle* handle, s32 direction, u32 cartAddr, void* dr
}
HW_REG(PI_DRAM_ADDR_REG, void*) = (void*)osVirtualToPhysical(dramAddr);
HW_REG(PI_CART_ADDR_REG, void*) = (void*)((handle->baseAddress | cartAddr) & 0x1fffffff);
HW_REG(PI_CART_ADDR_REG, void*) = (void*)((handle->baseAddress | cartAddr) & 0x1FFFFFFF);
switch (direction) {
case OS_READ:

View File

@ -10,7 +10,7 @@ void osViSetXScale(f32 value) {
__osViNext->state |= 0x2;
nomValue = __osViNext->modep->comRegs.xScale & 0xfff;
nomValue = __osViNext->modep->comRegs.xScale & 0xFFF;
__osViNext->x.scale = (u32)(__osViNext->x.factor * nomValue) & 0xFFF;
__osRestoreInt(saveMask);

View File

@ -4,7 +4,7 @@
typedef struct {
/* 0x0 */ u32 ins_00; // lui k0, 0x8000
/* 0x4 */ u32 ins_04; // addiu k0, k0, 0x39e0
/* 0x4 */ u32 ins_04; // addiu k0, k0, 0x39E0
/* 0x8 */ u32 ins_08; // jr k0 ; __osException
/* 0xC */ u32 ins_0C; // nop
} struct_exceptionPreamble;

View File

@ -9,13 +9,13 @@ const f64 digs[] = { 10e0L, 10e1L, 10e3L, 10e7L, 10e15L, 10e31L, 10e63L, 10e127L
/* float properties */
#define _D0 0
#define _DBIAS 0x3ff
#define _DBIAS 0x3FF
#define _DLONG 1
#define _DOFF 4
#define _FBIAS 0x7e
#define _FBIAS 0x7E
#define _FOFF 7
#define _FRND 1
#define _LBIAS 0x3ffe
#define _LBIAS 0x3FFE
#define _LOFF 15
/* integer properties */
#define _C2 1
@ -26,7 +26,7 @@ const f64 digs[] = { 10e0L, 10e1L, 10e3L, 10e7L, 10e15L, 10e31L, 10e63L, 10e127L
#define INF 1
#define FINITE -1
#define _DFRAC ((1 << _DOFF) - 1)
#define _DMASK (0x7fff & ~_DFRAC)
#define _DMASK (0x7FFF & ~_DFRAC)
#define _DMAX ((1 << (15 - _DOFF)) - 1)
#define _DNAN (0x8000 | _DMAX << _DOFF | 1 << (_DOFF - 1))
#define _DSIGN 0x8000

View File

@ -326,7 +326,7 @@ static unkstructInvadepoh1 D_80B4EA24[] = {
{ 1, 1.0f },
};
static unkstructInvadepoh4 D_80B4EA2C = { 2, &D_80B4E9C4, 4, D_80B4EA04, 0x28, 0x3c };
static unkstructInvadepoh4 D_80B4EA2C = { 2, &D_80B4E9C4, 4, D_80B4EA04, 0x28, 0x3C };
static unkstructInvadepoh3 D_80B4EA40 = {
1,