diff options
Diffstat (limited to 'source/gfx.h')
-rw-r--r-- | source/gfx.h | 188 |
1 files changed, 94 insertions, 94 deletions
diff --git a/source/gfx.h b/source/gfx.h index 5c55f64..2d0ab3c 100644 --- a/source/gfx.h +++ b/source/gfx.h @@ -94,20 +94,20 @@ #include "snes9x.h" void S9xStartScreenRefresh(); -void S9xDrawScanLine(uint8 Line); +void S9xDrawScanLine(uint8_t Line); void S9xEndScreenRefresh(); void S9xSetupOBJ(); void S9xUpdateScreen(); -void RenderLine(uint8 line); +void RenderLine(uint8_t line); void S9xBuildDirectColourMaps(); // External port interface which must be implemented or initialised for each // port. extern struct SGFX GFX; -bool8 S9xInitGFX(); +bool S9xInitGFX(); void S9xDeinitGFX(); -bool8 S9xInitUpdate(void); +bool S9xInitUpdate(void); #if 0 void S9xSyncSpeed(); #else @@ -118,62 +118,62 @@ void S9xSyncSpeed(); struct SGFX { // Initialize these variables - uint8* Screen_buffer; - uint8* SubScreen_buffer; - uint8* ZBuffer_buffer; - uint8* SubZBuffer_buffer; + uint8_t* Screen_buffer; + uint8_t* SubScreen_buffer; + uint8_t* ZBuffer_buffer; + uint8_t* SubZBuffer_buffer; - uint8* Screen; - uint8* SubScreen; - uint8* ZBuffer; - uint8* SubZBuffer; - uint32 Pitch; + uint8_t* Screen; + uint8_t* SubScreen; + uint8_t* ZBuffer; + uint8_t* SubZBuffer; + uint32_t Pitch; // Setup in call to S9xInitGFX() int Delta; - uint16* X2; - uint16* ZERO_OR_X2; - uint16* ZERO; - uint32 RealPitch; // True pitch of Screen buffer. - uint32 Pitch2; // Same as RealPitch except while using speed up hack for Glide. - uint32 ZPitch; // Pitch of ZBuffer - uint32 PPL; // Number of pixels on each of Screen buffer - uint32 PPLx2; - uint32 PixSize; - uint8 S_safety_margin[8]; - uint8* S; - uint8 DB_safety_margin[8]; - uint8* DB; - uint32 DepthDelta; - uint8 Z1; // Depth for comparison - uint8 Z2; // Depth to save - uint8 ZSprite; // Used to ensure only 1st sprite is drawn per pixel - uint32 FixedColour; + uint16_t* X2; + uint16_t* ZERO_OR_X2; + uint16_t* ZERO; + uint32_t RealPitch; // True pitch of Screen buffer. + uint32_t Pitch2; // Same as RealPitch except while using speed up hack for Glide. + uint32_t ZPitch; // Pitch of ZBuffer + uint32_t PPL; // Number of pixels on each of Screen buffer + uint32_t PPLx2; + uint32_t PixSize; + uint8_t S_safety_margin[8]; + uint8_t* S; + uint8_t DB_safety_margin[8]; + uint8_t* DB; + uint32_t DepthDelta; + uint8_t Z1; // Depth for comparison + uint8_t Z2; // Depth to save + uint8_t ZSprite; // Used to ensure only 1st sprite is drawn per pixel + uint32_t FixedColour; const char* InfoString; - uint32 InfoStringTimeout; - uint32 StartY; - uint32 EndY; + uint32_t InfoStringTimeout; + uint32_t StartY; + uint32_t EndY; struct ClipData* pCurrentClip; - uint32 Mode7Mask; - uint32 Mode7PriorityMask; - uint8 OBJWidths[128]; - uint8 OBJVisibleTiles[128]; + uint32_t Mode7Mask; + uint32_t Mode7PriorityMask; + uint8_t OBJWidths[128]; + uint8_t OBJVisibleTiles[128]; struct { - uint8 RTOFlags; - int16 Tiles; + uint8_t RTOFlags; + int16_t Tiles; struct { - int8 Sprite; - uint8 Line; + int8_t Sprite; + uint8_t Line; } OBJ[32]; } OBJLines [SNES_HEIGHT_EXTENDED]; - uint8 r212c; - uint8 r212d; - uint8 r2130; - uint8 r2131; - bool8 Pseudo; + uint8_t r212c; + uint8_t r212d; + uint8_t r2130; + uint8_t r2131; + bool Pseudo; }; @@ -181,8 +181,8 @@ struct SLineData { struct { - uint16 VOffset; - uint16 HOffset; + uint16_t VOffset; + uint16_t HOffset; } BG [4]; }; @@ -192,20 +192,20 @@ struct SLineData typedef struct { - uint32 TileSize; - uint32 BitShift; - uint32 TileShift; - uint32 TileAddress; - uint32 NameSelect; - uint32 SCBase; - - uint32 StartPalette; - uint32 PaletteShift; - uint32 PaletteMask; - - uint8* Buffer; - uint8* Buffered; - bool8 DirectColourMode; + uint32_t TileSize; + uint32_t BitShift; + uint32_t TileShift; + uint32_t TileAddress; + uint32_t NameSelect; + uint32_t SCBase; + + uint32_t StartPalette; + uint32_t PaletteShift; + uint32_t PaletteMask; + + uint8_t* Buffer; + uint8_t* Buffered; + bool DirectColourMode; } SBG; struct SLineMatrixData @@ -218,35 +218,35 @@ struct SLineMatrixData short CentreY; }; -extern uint32 odd_high [4][16]; -extern uint32 odd_low [4][16]; -extern uint32 even_high [4][16]; -extern uint32 even_low [4][16]; +extern uint32_t odd_high [4][16]; +extern uint32_t odd_low [4][16]; +extern uint32_t even_high [4][16]; +extern uint32_t even_low [4][16]; extern SBG BG; -extern uint16 DirectColourMaps [8][256]; +extern uint16_t DirectColourMaps [8][256]; -extern uint8 add32_32 [32][32]; -extern uint8 add32_32_half [32][32]; -extern uint8 sub32_32 [32][32]; -extern uint8 sub32_32_half [32][32]; -extern uint8 mul_brightness [16][32]; +extern uint8_t add32_32 [32][32]; +extern uint8_t add32_32_half [32][32]; +extern uint8_t sub32_32 [32][32]; +extern uint8_t sub32_32_half [32][32]; +extern uint8_t mul_brightness [16][32]; // Could use BSWAP instruction on Intel port... #define SWAP_DWORD(dw) dw = ((dw & 0xff) << 24) | ((dw & 0xff00) << 8) | \ ((dw & 0xff0000) >> 8) | ((dw & 0xff000000) >> 24) #ifdef FAST_LSB_WORD_ACCESS -#define READ_2BYTES(s) (*(uint16 *) (s)) -#define WRITE_2BYTES(s, d) *(uint16 *) (s) = (d) +#define READ_2BYTES(s) (*(uint16_t *) (s)) +#define WRITE_2BYTES(s, d) *(uint16_t *) (s) = (d) #else #ifdef LSB_FIRST -#define READ_2BYTES(s) (*(uint8 *) (s) | (*((uint8 *) (s) + 1) << 8)) -#define WRITE_2BYTES(s, d) *(uint8 *) (s) = (d), \ - *((uint8 *) (s) + 1) = (d) >> 8 +#define READ_2BYTES(s) (*(uint8_t *) (s) | (*((uint8_t *) (s) + 1) << 8)) +#define WRITE_2BYTES(s, d) *(uint8_t *) (s) = (d), \ + *((uint8_t *) (s) + 1) = (d) >> 8 #else // else MSB_FISRT -#define READ_2BYTES(s) (*(uint8 *) (s) | (*((uint8 *) (s) + 1) << 8)) -#define WRITE_2BYTES(s, d) *(uint8 *) (s) = (d), \ - *((uint8 *) (s) + 1) = (d) >> 8 +#define READ_2BYTES(s) (*(uint8_t *) (s) | (*((uint8_t *) (s) + 1) << 8)) +#define WRITE_2BYTES(s, d) *(uint8_t *) (s) = (d), \ + *((uint8_t *) (s) + 1) = (d) >> 8 #endif // LSB_FIRST #endif // i386 @@ -259,9 +259,9 @@ GFX.X2 [((((C1) & RGB_REMOVE_LOW_BITS_MASK) + \ ((C2) & RGB_REMOVE_LOW_BITS_MASK)) >> 1) + \ ((C1) & (C2) & RGB_LOW_BITS_MASK)] #else -static inline uint16 COLOR_ADD(uint16, uint16); +static inline uint16_t COLOR_ADD(uint16_t, uint16_t); -static inline uint16 COLOR_ADD(uint16 C1, uint16 C2) +static inline uint16_t COLOR_ADD(uint16_t C1, uint16_t C2) { if (C1 == 0) return C2; @@ -289,11 +289,11 @@ GFX.ZERO_OR_X2 [(((C1) | RGB_HI_BITS_MASKx2) - \ ((C2) & RGB_REMOVE_LOW_BITS_MASK)) >> 1] + \ ((C1) & RGB_LOW_BITS_MASK) - ((C2) & RGB_LOW_BITS_MASK)) #else -inline uint16 COLOR_SUB(uint16, uint16); +inline uint16_t COLOR_SUB(uint16_t, uint16_t); -inline uint16 COLOR_SUB(uint16 C1, uint16 C2) +inline uint16_t COLOR_SUB(uint16_t C1, uint16_t C2) { - uint16 mC1, mC2, v = 0; + uint16_t mC1, mC2, v = 0; mC1 = C1 & FIRST_COLOR_MASK; mC2 = C2 & FIRST_COLOR_MASK; @@ -315,14 +315,14 @@ inline uint16 COLOR_SUB(uint16 C1, uint16 C2) GFX.ZERO [(((C1) | RGB_HI_BITS_MASKx2) - \ ((C2) & RGB_REMOVE_LOW_BITS_MASK)) >> 1] -typedef void (*NormalTileRenderer)(uint32 Tile, int32 Offset, - uint32 StartLine, uint32 LineCount); -typedef void (*ClippedTileRenderer)(uint32 Tile, int32 Offset, - uint32 StartPixel, uint32 Width, - uint32 StartLine, uint32 LineCount); -typedef void (*LargePixelRenderer)(uint32 Tile, int32 Offset, - uint32 StartPixel, uint32 Pixels, - uint32 StartLine, uint32 LineCount); +typedef void (*NormalTileRenderer)(uint32_t Tile, int32_t Offset, + uint32_t StartLine, uint32_t LineCount); +typedef void (*ClippedTileRenderer)(uint32_t Tile, int32_t Offset, + uint32_t StartPixel, uint32_t Width, + uint32_t StartLine, uint32_t LineCount); +typedef void (*LargePixelRenderer)(uint32_t Tile, int32_t Offset, + uint32_t StartPixel, uint32_t Pixels, + uint32_t StartLine, uint32_t LineCount); #endif |