X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=plugins%2Fgpu_unai%2Fgpu_unai.h;h=7aa06679c64bf4b056d36bc78d93d2bd496d377a;hb=4949d4fff530344f0f4a1676bc45d0203749f291;hp=6886eb863fd7a23fc79b03ffbb6d4ae6117c7262;hpb=c89fac55014151734b4abb0d8a7e3747e5ce629a;p=pcsx_rearmed.git diff --git a/plugins/gpu_unai/gpu_unai.h b/plugins/gpu_unai/gpu_unai.h index 6886eb86..7aa06679 100644 --- a/plugins/gpu_unai/gpu_unai.h +++ b/plugins/gpu_unai/gpu_unai.h @@ -54,25 +54,67 @@ #define s32 int32_t #define s64 int64_t +typedef struct { + u32 v; +} le32_t; + +typedef struct { + u16 v; +} le16_t; + +static inline u32 le32_to_u32(le32_t le) +{ + return LE32TOH(le.v); +} + +static inline s32 le32_to_s32(le32_t le) +{ + return (int32_t) LE32TOH(le.v); +} + +static inline u32 le32_raw(le32_t le) +{ + return le.v; +} + +static inline le32_t u32_to_le32(u32 u) +{ + return (le32_t){ .v = HTOLE32(u) }; +} + +static inline u16 le16_to_u16(le16_t le) +{ + return LE16TOH(le.v); +} + +static inline s16 le16_to_s16(le16_t le) +{ + return (int16_t) LE16TOH(le.v); +} + +static inline u16 le16_raw(le16_t le) +{ + return le.v; +} + +static inline le16_t u16_to_le16(u16 u) +{ + return (le16_t){ .v = HTOLE16(u) }; +} + union PtrUnion { - u32 *U4; - s32 *S4; - u16 *U2; - s16 *S2; + le32_t *U4; + le16_t *U2; u8 *U1; - s8 *S1; void *ptr; }; union GPUPacket { - u32 U4[16]; - s32 S4[16]; - u16 U2[32]; - s16 S2[32]; + le32_t U4[16]; + le16_t U2[32]; u8 U1[64]; - s8 S1[64]; }; template static inline void SwapValues(T &x, T &y) @@ -136,7 +178,7 @@ static inline s32 GPU_DIV(s32 rs, s32 rt) struct gpu_unai_t { u32 GPU_GP1; GPUPacket PacketBuffer; - u16 *vram; + le16_t *vram; #ifdef USE_GPULIB u16 *downscale_vram; @@ -164,7 +206,7 @@ struct gpu_unai_t { struct { s32 px,py; s32 x_end,y_end; - u16* pvram; + le16_t* pvram; u32 *last_dma; // Last dma pointer bool FrameToRead; // Load image in progress bool FrameToWrite; // Store image in progress @@ -197,8 +239,8 @@ struct gpu_unai_t { s16 DrawingOffset[2]; // [0] : Drawing offset X (signed) // [1] : Drawing offset Y (signed) - u16* TBA; // Ptr to current texture in VRAM - u16* CBA; // Ptr to current CLUT in VRAM + le16_t* TBA; // Ptr to current texture in VRAM + le16_t* CBA; // Ptr to current CLUT in VRAM //////////////////////////////////////////////////////////////////////////// // Inner Loop parameters