diff options
| author | SND\edgbla_cp <SND\edgbla_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-08-13 21:58:00 +0000 |
|---|---|---|
| committer | SND\edgbla_cp <SND\edgbla_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-08-13 21:58:00 +0000 |
| commit | d310056a1a1dc1305735178bc57b499001e92b4d (patch) | |
| tree | 9a0f65f3b4a0c736cdb1e85a090aa3cbc81a867d /libpcsxcore | |
| parent | 3e945aaa3675d69e746715fe0abc5dbef4923222 (diff) | |
Added gpu busy interface.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@56084 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'libpcsxcore')
| -rw-r--r-- | libpcsxcore/plugins.c | 16 | ||||
| -rw-r--r-- | libpcsxcore/plugins.h | 8 | ||||
| -rw-r--r-- | libpcsxcore/r3000a.c | 6 | ||||
| -rw-r--r-- | libpcsxcore/r3000a.h | 3 |
4 files changed, 31 insertions, 2 deletions
diff --git a/libpcsxcore/plugins.c b/libpcsxcore/plugins.c index f965e0d0..1bfeb132 100644 --- a/libpcsxcore/plugins.c +++ b/libpcsxcore/plugins.c @@ -50,6 +50,8 @@ GPUgetScreenPic GPU_getScreenPic; GPUshowScreenPic GPU_showScreenPic;
GPUclearDynarec GPU_clearDynarec;
GPUvBlank GPU_vBlank;
+GPUregisterCallback GPU_registerCallback;
+GPUidle GPU_idle;
CDRinit CDR_init;
CDRshutdown CDR_shutdown;
@@ -192,6 +194,16 @@ void CALLBACK GPU__displayText(char *pText) { SysPrintf("%s\n", pText);
}
+void CALLBACK GPUbusy( int ticks )
+{
+ //printf( "GPUbusy( %i )\n", ticks );
+ //fflush( 0 );
+
+ psxRegs.interrupt |= (1 << PSXINT_GPUBUSY);
+ psxRegs.intCycle[PSXINT_GPUBUSY].cycle = ticks;
+ psxRegs.intCycle[PSXINT_GPUBUSY].sCycle = psxRegs.cycle;
+}
+
long CALLBACK GPU__configure(void) { return 0; }
long CALLBACK GPU__test(void) { return 0; }
void CALLBACK GPU__about(void) {}
@@ -201,6 +213,8 @@ long CALLBACK GPU__getScreenPic(unsigned char *pMem) { return -1; } long CALLBACK GPU__showScreenPic(unsigned char *pMem) { return -1; }
void CALLBACK GPU__clearDynarec(void (CALLBACK *callback)(void)) {}
void CALLBACK GPU__vBlank(int val) {}
+void CALLBACK GPU__registerCallback(void (CALLBACK *callback)(int)) {};
+void CALLBACK GPU__idle(void) {}
#define LoadGpuSym1(dest, name) \
LoadSym(GPU_##dest, GPU##dest, name, TRUE);
@@ -241,6 +255,8 @@ static int LoadGPUplugin(const char *GPUdll) { LoadGpuSym0(showScreenPic, "GPUshowScreenPic");
LoadGpuSym0(clearDynarec, "GPUclearDynarec");
LoadGpuSym0(vBlank, "GPUvBlank");
+ LoadGpuSym0(registerCallback, "GPUregisterCallback");
+ LoadGpuSym0(idle, "GPUidle");
LoadGpuSym0(configure, "GPUconfigure");
LoadGpuSym0(test, "GPUtest");
LoadGpuSym0(about, "GPUabout");
diff --git a/libpcsxcore/plugins.h b/libpcsxcore/plugins.h index 9c24ecef..37957a13 100644 --- a/libpcsxcore/plugins.h +++ b/libpcsxcore/plugins.h @@ -94,6 +94,8 @@ typedef long (CALLBACK* GPUgetScreenPic)(unsigned char *); typedef long (CALLBACK* GPUshowScreenPic)(unsigned char *);
typedef void (CALLBACK* GPUclearDynarec)(void (CALLBACK *callback)(void));
typedef void (CALLBACK* GPUvBlank)(int);
+typedef void (CALLBACK* GPUregisterCallback)(void (CALLBACK *callback)(int));
+typedef void (CALLBACK* GPUidle)(void);
// GPU function pointers
extern GPUupdateLace GPU_updateLace;
@@ -119,6 +121,8 @@ extern GPUgetScreenPic GPU_getScreenPic; extern GPUshowScreenPic GPU_showScreenPic;
extern GPUclearDynarec GPU_clearDynarec;
extern GPUvBlank GPU_vBlank;
+extern GPUregisterCallback GPU_registerCallback;
+extern GPUidle GPU_idle;
// CD-ROM Functions
typedef long (CALLBACK* CDRinit)(void);
@@ -150,7 +154,7 @@ struct SubQ { unsigned char IndexNumber;
unsigned char TrackRelativeAddress[3];
unsigned char Filler;
- unsigned char AbsoluteAddress[3]; + unsigned char AbsoluteAddress[3];
unsigned char CRC[2];
char res1[72];
};
@@ -400,6 +404,8 @@ extern SIO1registerCallback SIO1_registerCallback; void CALLBACK clearDynarec(void);
+void CALLBACK GPUbusy( int ticks );
+
void SetIsoFile(const char *filename);
const char *GetIsoFile(void);
boolean UsingIso(void);
diff --git a/libpcsxcore/r3000a.c b/libpcsxcore/r3000a.c index 27c247bd..acc8eb60 100644 --- a/libpcsxcore/r3000a.c +++ b/libpcsxcore/r3000a.c @@ -151,6 +151,12 @@ void psxBranchTest() { spuInterrupt(); } } + if (psxRegs.interrupt & (1 << PSXINT_GPUBUSY)) { // gpu busy + if ((psxRegs.cycle - psxRegs.intCycle[PSXINT_GPUBUSY].sCycle) >= psxRegs.intCycle[PSXINT_GPUBUSY].cycle) { + psxRegs.interrupt &= ~(1 << PSXINT_GPUBUSY); + GPU_idle(); + } + } } if (psxHu32(0x1070) & psxHu32(0x1074)) { diff --git a/libpcsxcore/r3000a.h b/libpcsxcore/r3000a.h index ca5d3eba..0150b0e6 100644 --- a/libpcsxcore/r3000a.h +++ b/libpcsxcore/r3000a.h @@ -151,7 +151,8 @@ enum { PSXINT_CDREAD, PSXINT_GPUDMA, PSXINT_MDECOUTDMA, - PSXINT_SPUDMA + PSXINT_SPUDMA, + PSXINT_GPUBUSY }; typedef struct { |
