gpu_unai: fix some 64bit issues
authornotaz <notasas@gmail.com>
Tue, 3 Feb 2015 22:31:01 +0000 (00:31 +0200)
committernotaz <notasas@gmail.com>
Tue, 3 Feb 2015 22:31:01 +0000 (00:31 +0200)
plugins/gpu_unai/gpu.cpp
plugins/gpu_unai/gpu_command.h
plugins/gpu_unai/gpu_raster_line.h
plugins/gpu_unai/gpulib_if.cpp

index d509617..1552bed 100644 (file)
@@ -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;
 
index 049b146..d6e7a74 100644 (file)
@@ -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));
                        }
index 4edfa06..fc59b79 100644 (file)
@@ -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);
 }
index 0d506bc..646b0f2 100644 (file)
@@ -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;
       }