mirror of
https://github.com/PCSX2/pcsx2-sourceforge.git
synced 2026-02-04 03:11:18 +01:00
Added an optional function to the spu2 plugin interface so I can read the IOP cycles var from spu2.
I use it to improve the sync between the emu and the spu2 by calculating the elapsed time also on register accesses. The function is optional so older plugins still work fine, and only called once every "open" so it doesn't make anything slower.
This commit is contained in:
@@ -341,6 +341,8 @@ void CALLBACK SPU2irqCallback(void (*SPU2callback)(),void (*DMA4callback)(),void
|
||||
// for now, pData is not used
|
||||
int CALLBACK SPU2setupRecording(int start, void* pData);
|
||||
|
||||
void CALLBACK SPU2setClockPtr(u32* ptr);
|
||||
|
||||
void CALLBACK SPU2async(u32 cycles);
|
||||
s32 CALLBACK SPU2freeze(int mode, freezeData *data);
|
||||
void CALLBACK SPU2configure();
|
||||
@@ -571,6 +573,9 @@ typedef void (CALLBACK* _SPU2setDMABaseAddr)(uptr baseaddr);
|
||||
typedef void (CALLBACK* _SPU2interruptDMA7)();
|
||||
typedef void (CALLBACK* _SPU2irqCallback)(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)());
|
||||
typedef int (CALLBACK* _SPU2setupRecording)(int, void*);
|
||||
|
||||
typedef void (CALLBACK* _SPU2setClockPtr)(u32*ptr);
|
||||
|
||||
typedef u32 (CALLBACK* _SPU2ReadMemAddr)(int core);
|
||||
typedef void (CALLBACK* _SPU2WriteMemAddr)(int core,u32 value);
|
||||
typedef void (CALLBACK* _SPU2async)(u32 cycles);
|
||||
@@ -579,6 +584,7 @@ typedef void (CALLBACK* _SPU2configure)();
|
||||
typedef s32 (CALLBACK* _SPU2test)();
|
||||
typedef void (CALLBACK* _SPU2about)();
|
||||
|
||||
|
||||
// CDVD
|
||||
// NOTE: The read/write functions CANNOT use XMM/MMX regs
|
||||
// If you want to use them, need to save and restore current ones
|
||||
@@ -767,6 +773,8 @@ _SPU2setupRecording SPU2setupRecording;
|
||||
_SPU2WriteMemAddr SPU2WriteMemAddr;
|
||||
_SPU2irqCallback SPU2irqCallback;
|
||||
|
||||
_SPU2setClockPtr SPU2setClockPtr;
|
||||
|
||||
_SPU2async SPU2async;
|
||||
_SPU2freeze SPU2freeze;
|
||||
_SPU2configure SPU2configure;
|
||||
|
||||
@@ -250,7 +250,9 @@ int LoadSPU2plugin(char *filename) {
|
||||
LoadSPU2sym1(WriteMemAddr, "SPU2WriteMemAddr");
|
||||
LoadSPU2sym1(irqCallback, "SPU2irqCallback");
|
||||
|
||||
LoadSPU2symN(setupRecording, "SPU2setupRecording");
|
||||
LoadSPU2symN(setClockPtr, "SPU2setClockPtr");
|
||||
|
||||
LoadSPU2symN(setupRecording, "SPU2setupRecording");
|
||||
|
||||
LoadSPU2sym0(freeze, "SPU2freeze");
|
||||
LoadSPU2sym0(configure, "SPU2configure");
|
||||
@@ -585,6 +587,10 @@ int OpenPlugins(const char* pTitleFilename) {
|
||||
SPU2irqCallback(spu2Irq,spu2DMA4Irq,spu2DMA7Irq);
|
||||
if( SPU2setDMABaseAddr != NULL )
|
||||
SPU2setDMABaseAddr((uptr)PSXM(0));
|
||||
|
||||
if(SPU2setClockPtr != NULL)
|
||||
SPU2setClockPtr(&psxRegs.cycle);
|
||||
|
||||
ret = SPU2open((void*)&pDsp);
|
||||
if (ret != 0) { SysMessage (_("Error Opening SPU2 Plugin")); goto OpenError; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user