Skip to content

Commit

Permalink
Added gpu busy interface.
Browse files Browse the repository at this point in the history
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@56084 e17a0e51-4ae3-4d35-97c3-1a29b211df97
  • Loading branch information
SND\edgbla_cp authored and SND\edgbla_cp committed Aug 13, 2010
1 parent 3e945aa commit d310056
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 2 deletions.
10 changes: 10 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
August 14, 2010 edgbla <[email protected]>

* gui/Plugin.c: Added gpu busy interface.
* macosx/Plugin.c: Likewise.
* win32/gui/plugin.c: Likewise.
* libpcsxcore/r3000a.c: Likewise.
* libpcsxcore/r3000a.h: Likewise.
* libpcsxcore/plugins.c: Likewise.
* libpcsxcore/plugins.h: Likewise.

August 13, 2010 Wei Mingzhi <[email protected]>

* plugins/dfxvideo/cfg.h: Readded Windows support.
Expand Down
1 change: 1 addition & 0 deletions gui/Plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ int _OpenPlugins() {
SPU_registerCallback(SPUirq);
ret = GPU_open(&gpuDisp, "PCSX", NULL);
if (ret < 0) { SysMessage(_("Error opening GPU plugin!")); return -1; }
GPU_registerCallback(GPUbusy);
ret = PAD1_open(&gpuDisp);
if (ret < 0) { SysMessage(_("Error opening Controller 1 plugin!")); return -1; }
ret = PAD2_open(&gpuDisp);
Expand Down
16 changes: 16 additions & 0 deletions libpcsxcore/plugins.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {}
Expand All @@ -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);
Expand Down Expand Up @@ -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");
Expand Down
8 changes: 7 additions & 1 deletion libpcsxcore/plugins.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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];
};
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions libpcsxcore/r3000a.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
3 changes: 2 additions & 1 deletion libpcsxcore/r3000a.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ enum {
PSXINT_CDREAD,
PSXINT_GPUDMA,
PSXINT_MDECOUTDMA,
PSXINT_SPUDMA
PSXINT_SPUDMA,
PSXINT_GPUBUSY
};

typedef struct {
Expand Down
1 change: 1 addition & 0 deletions macosx/Plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ int _OpenPlugins() {
SPU_registerCallback(SPUirq);
ret = GPU_open(&gpuDisp, "PCSX", /*pathUrl ? path :*/ NULL);
if (ret < 0) { SysMessage(_("Error Opening GPU Plugin")); return -1; }
GPU_registerCallback(GPUbusy);
ret = PAD1_open(&gpuDisp);
if (ret < 0) { SysMessage(_("Error Opening PAD1 Plugin")); return -1; }
ret = PAD2_open(&gpuDisp);
Expand Down
1 change: 1 addition & 0 deletions win32/gui/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ int _OpenPlugins(HWND hWnd) {

ret = GPU_open(hWnd);
if (ret < 0) { SysMessage (_("Error Opening GPU Plugin (%d)"), ret); return -1; }
GPU_registerCallback(GPUbusy);
ret = SPU_open(hWnd);
if (ret < 0) { SysMessage (_("Error Opening SPU Plugin (%d)"), ret); return -1; }
SPU_registerCallback(SPUirq);
Expand Down

0 comments on commit d310056

Please sign in to comment.