From 4144e9abc1fb8420e08e0a5ef48a9ceba7f26661 Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 4 Feb 2015 00:31:01 +0200 Subject: [PATCH] gpu_unai: fix some 64bit issues --- plugins/gpu_unai/gpu.cpp | 4 ++-- plugins/gpu_unai/gpu_command.h | 11 ++++++----- plugins/gpu_unai/gpu_raster_line.h | 2 +- plugins/gpu_unai/gpulib_if.cpp | 4 ++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/plugins/gpu_unai/gpu.cpp b/plugins/gpu_unai/gpu.cpp index d5096170..1552bed9 100644 --- a/plugins/gpu_unai/gpu.cpp +++ b/plugins/gpu_unai/gpu.cpp @@ -432,7 +432,7 @@ void GPU_readDataMem(u32* dmaAddress, s32 dmaCount) { if ((&pvram[px])>(VIDEO_END)) pvram-=512*1024; // lower 16 bit - u32 data = (unsigned long)pvram[px]; + u32 data = pvram[px]; if (++px>=x_end) { @@ -442,7 +442,7 @@ void GPU_readDataMem(u32* dmaAddress, s32 dmaCount) if ((&pvram[px])>(VIDEO_END)) pvram-=512*1024; // higher 16 bit (always, even if it's an odd width) - data |= (unsigned long)(pvram[px])<<16; + data |= (u32)(pvram[px])<<16; *dmaAddress++ = data; diff --git a/plugins/gpu_unai/gpu_command.h b/plugins/gpu_unai/gpu_command.h index 049b1462..d6e7a742 100644 --- a/plugins/gpu_unai/gpu_command.h +++ b/plugins/gpu_unai/gpu_command.h @@ -21,9 +21,9 @@ /////////////////////////////////////////////////////////////////////////////// INLINE void gpuSetTexture(u16 tpage) { - long tp; - long tx, ty; - GPU_GP1 = (GPU_GP1 & ~0x7FF) | (tpage & 0x7FF); + u32 tp; + u32 tx, ty; + GPU_GP1 = (GPU_GP1 & ~0x1FF) | (tpage & 0x1FF); TextureWindow[0]&= ~TextureWindow[2]; TextureWindow[1]&= ~TextureWindow[3]; @@ -31,6 +31,7 @@ INLINE void gpuSetTexture(u16 tpage) tp = (tpage >> 7) & 3; tx = (tpage & 0x0F) << 6; ty = (tpage & 0x10) << 4; + if (tp == 3) tp = 2; tx += (TextureWindow[0] >> (2 - tp)); ty += TextureWindow[1]; @@ -437,8 +438,8 @@ void gpuSendPacketFunction(const int PRIM) case 0xE5: { const u32 temp = PacketBuffer.U4[0]; - DrawingOffset[0] = ((long)temp<<(32-11))>>(32-11); - DrawingOffset[1] = ((long)temp<<(32-22))>>(32-11); + DrawingOffset[0] = ((s32)temp<<(32-11))>>(32-11); + DrawingOffset[1] = ((s32)temp<<(32-22))>>(32-11); //isSkip = false; DO_LOG(("DrawingOffset(0x%x)\n",PRIM)); } diff --git a/plugins/gpu_unai/gpu_raster_line.h b/plugins/gpu_unai/gpu_raster_line.h index 4edfa06f..fc59b797 100644 --- a/plugins/gpu_unai/gpu_raster_line.h +++ b/plugins/gpu_unai/gpu_raster_line.h @@ -26,7 +26,7 @@ #define GPU_DIGITS 16 #define GPU_DIGITSC (GPU_DIGITS+3) -INLINE long GPU_DIV(long rs, long rt) +INLINE s32 GPU_DIV(s32 rs, s32 rt) { return rt ? (rs / rt) : (0); } diff --git a/plugins/gpu_unai/gpulib_if.cpp b/plugins/gpu_unai/gpulib_if.cpp index 0d506bc7..646b0f22 100644 --- a/plugins/gpu_unai/gpulib_if.cpp +++ b/plugins/gpu_unai/gpulib_if.cpp @@ -490,8 +490,8 @@ int do_cmd_list(unsigned int *list, int list_len, int *last_cmd) } case 0xE5: { const u32 temp = PacketBuffer.U4[0]; - DrawingOffset[0] = ((long)temp<<(32-11))>>(32-11); - DrawingOffset[1] = ((long)temp<<(32-22))>>(32-11); + DrawingOffset[0] = ((s32)temp<<(32-11))>>(32-11); + DrawingOffset[1] = ((s32)temp<<(32-22))>>(32-11); gpu.ex_regs[5] = temp; break; } -- 2.39.5