Fix invalid variable types
authorPaul Cercueil <paul@crapouillou.net>
Thu, 30 May 2024 09:52:21 +0000 (11:52 +0200)
committernotaz <notasas@gmail.com>
Thu, 30 May 2024 23:04:06 +0000 (02:04 +0300)
On SH4, uint32_t is "unsigned long" and int32_t is "long"; which means
that "int32_t" and "int" pointers cannot be used interchangeably without
an explicit cast.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
libpcsxcore/psxdma.c
plugins/gpulib/gpu.c

index 55d2a0a..68b9694 100644 (file)
@@ -136,7 +136,9 @@ static u32 gpuDmaChainSize(u32 addr) {
 void psxDma2(u32 madr, u32 bcr, u32 chcr) { // GPU
        u32 *ptr, madr_next, *madr_next_p;
        u32 words, words_left, words_max, words_copy;
-       int cycles_sum, cycles_last_cmd = 0, do_walking;
+       s32 cycles_last_cmd = 0;
+       int do_walking;
+       long cycles_sum;
 
        madr &= ~3;
        switch (chcr) {
@@ -225,7 +227,9 @@ void gpuInterrupt() {
        if (HW_DMA2_CHCR == SWAP32(0x01000401) && !(HW_DMA2_MADR & SWAP32(0x800000)))
        {
                u32 madr_next = 0xffffff, madr = SWAPu32(HW_DMA2_MADR);
-               int cycles_sum, cycles_last_cmd = 0;
+               s32 cycles_last_cmd = 0;
+               long cycles_sum;
+
                cycles_sum = GPU_dmaChain((u32 *)psxM, madr & 0x1fffff,
                                &madr_next, &cycles_last_cmd);
                HW_DMA2_MADR = SWAPu32(madr_next);
index b444dcf..9402787 100644 (file)
@@ -919,8 +919,8 @@ void GPUrearmedCallbacks(const struct rearmed_cbs *cbs)
   gpu.frameskip.advice = &cbs->fskip_advice;
   gpu.frameskip.active = 0;
   gpu.frameskip.frame_ready = 1;
-  gpu.state.hcnt = cbs->gpu_hcnt;
-  gpu.state.frame_count = cbs->gpu_frame_count;
+  gpu.state.hcnt = (uint32_t *)cbs->gpu_hcnt;
+  gpu.state.frame_count = (uint32_t *)cbs->gpu_frame_count;
   gpu.state.allow_interlace = cbs->gpu_neon.allow_interlace;
   gpu.state.enhancement_enable = cbs->gpu_neon.enhancement_enable;
   gpu.state.screen_centering_type_default = cbs->screen_centering_type_default;