X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=plugins%2Fdfxvideo%2Fgpulib_if.c;h=d7d69a7657e552bb43f34f4273d9fb488d700838;hb=04bd10b132d06eff2a803125dc8da640be2454db;hp=6f425bdd55325f2654b7637fb2611abbea3a0d33;hpb=e929dec505f8d3692248fe0d42c84a37c994ad39;p=pcsx_rearmed.git diff --git a/plugins/dfxvideo/gpulib_if.c b/plugins/dfxvideo/gpulib_if.c index 6f425bdd..d7d69a76 100644 --- a/plugins/dfxvideo/gpulib_if.c +++ b/plugins/dfxvideo/gpulib_if.c @@ -40,7 +40,7 @@ #define SWAP16(x) ({ uint16_t y=(x); (((y)>>8 & 0xff) | ((y)<<8 & 0xff00)); }) #define SWAP32(x) ({ uint32_t y=(x); (((y)>>24 & 0xfful) | ((y)>>8 & 0xff00ul) | ((y)<<8 & 0xff0000ul) | ((y)<<24 & 0xff000000ul)); }) -#ifdef __BIG_ENDIAN__ +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ // big endian config #define HOST2LE32(x) SWAP32(x) @@ -219,18 +219,12 @@ extern int32_t drawH; #define KEY_BADTEXTURES 128 #define KEY_CHECKTHISOUT 256 -#if !defined(__BIG_ENDIAN__) || defined(__x86_64__) || defined(__i386__) -#ifndef __LITTLE_ENDIAN__ -#define __LITTLE_ENDIAN__ -#endif -#endif - -#ifdef __LITTLE_ENDIAN__ +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ #define RED(x) (x & 0xff) #define BLUE(x) ((x>>16) & 0xff) #define GREEN(x) ((x>>8) & 0xff) #define COLOR(x) (x & 0xffffff) -#elif defined __BIG_ENDIAN__ +#else #define RED(x) ((x>>24) & 0xff) #define BLUE(x) ((x>>8) & 0xff) #define GREEN(x) ((x>>16) & 0xff) @@ -260,14 +254,18 @@ unsigned short sSetMask = 0; unsigned long lSetMask = 0; long lLowerpart; +#if defined(__GNUC__) && __GNUC__ >= 6 +#pragma GCC diagnostic ignored "-Wmisleading-indentation" +#endif + #include "soft.c" #include "prim.c" ///////////////////////////////////////////////////////////////////////////// -int renderer_init(void) +static void set_vram(void *vram) { - psxVub=(void *)gpu.vram; + psxVub=vram; psxVsb=(signed char *)psxVub; // different ways of accessing PSX VRAM psxVsw=(signed short *)psxVub; @@ -276,6 +274,11 @@ int renderer_init(void) psxVul=(uint32_t *)psxVub; psxVuw_eom=psxVuw+1024*512; // pre-calc of end of vram +} + +int renderer_init(void) +{ + set_vram(gpu.vram); PSXDisplay.RGB24 = FALSE; // init some stuff PSXDisplay.Interlaced = FALSE; @@ -337,7 +340,12 @@ int do_cmd_list(unsigned int *list, int list_len, int *last_cmd) while(1) { - if((*list_position & 0xf000f000) == 0x50005000 || list_position >= list_end) + if(list_position >= list_end) { + cmd = -1; + goto breakloop; + } + + if((*list_position & 0xf000f000) == 0x50005000) break; list_position++; @@ -355,7 +363,12 @@ int do_cmd_list(unsigned int *list, int list_len, int *last_cmd) while(1) { - if((*list_position & 0xf000f000) == 0x50005000 || list_position >= list_end) + if(list_position >= list_end) { + cmd = -1; + goto breakloop; + } + + if((*list_position & 0xf000f000) == 0x50005000) break; list_position += 2; @@ -381,6 +394,7 @@ int do_cmd_list(unsigned int *list, int list_len, int *last_cmd) } } +breakloop: gpu.ex_regs[1] &= ~0x1ff; gpu.ex_regs[1] |= lGPUstatusRet & 0x1ff; @@ -416,4 +430,7 @@ void renderer_set_config(const struct rearmed_cbs *cbs) { iUseDither = cbs->gpu_peops.iUseDither; dwActFixes = cbs->gpu_peops.dwActFixes; + if (cbs->pl_set_gpu_caps) + cbs->pl_set_gpu_caps(0); + set_vram(gpu.vram); }