// memory image of the PSX vram
////////////////////////////////////////////////////////////////////////
-unsigned char *psxVSecure;
unsigned char *psxVub;
-signed char *psxVsb;
unsigned short *psxVuw;
unsigned short *psxVuw_eom;
-signed short *psxVsw;
-uint32_t *psxVul;
-int32_t *psxVsl;
////////////////////////////////////////////////////////////////////////
// GPU globals
BOOL bDoLazyUpdate=FALSE;
uint32_t lGPUInfoVals[16];
static int iFakePrimBusy=0;
-static uint32_t vBlank=0;
static const int *skip_advice;
////////////////////////////////////////////////////////////////////////
// INIT, will be called after lib load... well, just do some var init...
////////////////////////////////////////////////////////////////////////
+// one extra MB for soft drawing funcs security
+static unsigned char vram[1024*512*2 + 1024*1024] __attribute__((aligned(2048)));
+
long CALLBACK GPUinit(void) // GPU INIT
{
memset(ulStatusControl,0,256*sizeof(uint32_t)); // init save state scontrol field
- psxVSecure = (unsigned char *)malloc((512*2)*1024 + (1024*1024)); // always alloc one extra MB for soft drawing funcs security
- if (!psxVSecure)
- return -1;
-
//!!! ATTENTION !!!
- psxVub=psxVSecure + 512 * 1024; // security offset into double sized psx vram!
+ psxVub=vram + 512 * 1024; // security offset into double sized psx vram!
- psxVsb=(signed char *)psxVub; // different ways of accessing PSX VRAM
- psxVsw=(signed short *)psxVub;
- psxVsl=(int32_t *)psxVub;
psxVuw=(unsigned short *)psxVub;
- psxVul=(uint32_t *)psxVub;
-
psxVuw_eom=psxVuw+1024*512; // pre-calc of end of vram
- memset(psxVSecure,0x00,(512*2)*1024 + (1024*1024));
+ memset(vram,0x00,(512*2)*1024 + (1024*1024));
memset(lGPUInfoVals,0x00,16*sizeof(uint32_t));
PSXDisplay.RGB24 = FALSE; // init some stuff
long CALLBACK GPUshutdown(void) // GPU SHUTDOWN
{
CloseDisplay(); // shutdown direct draw
- free(psxVSecure);
return 0; // nothinh to do
}
if(dwActFixes&0xa0) // -> pc fps calculation fix/old skipping fix
{
- int skip = (skip_advice && *skip_advice) || fps_skip < fFrameRateHz;
+ int skip = (skip_advice && *skip_advice) || UseFrameSkip == 1 || fps_skip < fFrameRateHz;
if(skip && !bSkipNextFrame) // -> skip max one in a row
{bSkipNextFrame = TRUE; fps_skip=fFrameRateHz;}
else bSkipNextFrame = FALSE;
GPUIsReadyForCommands;
}
}
- return lGPUstatusRet | vBlank;
+ return lGPUstatusRet;
}
////////////////////////////////////////////////////////////////////////
if((gpuDataC==254 && gpuDataP>=3) ||
(gpuDataC==255 && gpuDataP>=4 && !(gpuDataP&1)))
{
- if((gpuDataM[gpuDataP] & 0xF000F000) == 0x50005000)
+ if((gpuDataM[gpuDataP] & HOST2LE32(0xF000F000)) == HOST2LE32(0x50005000))
gpuDataP=gpuDataC-1;
}
}
if(count>0) GPUwriteDataMem(&baseAddrL[dmaMem>>2],count);
addr = GETLE32(&baseAddrL[addr>>2])&0xffffff;
- }
- while (addr != 0xffffff);
+ } while (!(addr & 0x800000)); // contrary to some documentation, the end-of-linked-list marker is not actually 0xFF'FFFF
+ // any pointer with bit 23 set will do.
GPUIsIdle;
// RESET TEXTURE STORE HERE, IF YOU USE SOMETHING LIKE THAT
+ PreviousPSXDisplay.Height = 0;
GPUwriteStatus(ulStatusControl[0]);
GPUwriteStatus(ulStatusControl[1]);
GPUwriteStatus(ulStatusControl[2]);
return 1;
}
-void CALLBACK GPUvBlank(int val)
-{
- vBlank=val?0x80000000:0;
-}
-
// rearmed thing
#include "../../frontend/plugin_lib.h"
+const struct rearmed_cbs *rcbs;
+
void GPUrearmedCallbacks(const struct rearmed_cbs *cbs)
{
// sync config
dwActFixes = cbs->gpu_peops.dwActFixes;
fFrameRateHz = cbs->gpu_peops.fFrameRateHz;
dwFrameRateTicks = cbs->gpu_peops.dwFrameRateTicks;
+ if (cbs->pl_vout_set_raw_vram)
+ cbs->pl_vout_set_raw_vram(psxVub);
+ if (cbs->pl_set_gpu_caps)
+ cbs->pl_set_gpu_caps(0);
skip_advice = &cbs->fskip_advice;
fps_skip = 100.0f;
+ rcbs = cbs;
}