From 04b49b108ec57fb18dbb1cccd021b6cef5f4e79f Mon Sep 17 00:00:00 2001 From: mattmenke Date: Sat, 14 Mar 2009 02:12:17 +0000 Subject: [PATCH] Plugin APIs: Restored pDsp, renamed to pDisplay for clarity (Though arcum42's right and about needing documentation). Renamed PADinit for psx emulator compatibility. Played around a bit with SIO api, thinking for simplicity best to just use one plugin of each type (SIO PAD/MTAP, remote, and memcard. Could even be separate types, but no real need for it). Added PADFreeze() and its friend SIOFreeze(). git-svn-id: http://pcsx2.googlecode.com/svn/trunk@779 96395faa-99c1-11dd-bbfe-3dabce05a288 --- common/include/api/CDVDApi.h | 12 ++++++------ common/include/api/Dev9Api.h | 8 ++++---- common/include/api/FWApi.h | 8 ++++---- common/include/api/GSApi.h | 8 ++++---- common/include/api/PadApi.h | 11 ++++++----- common/include/api/SIOApi.h | 22 +++++++++++++++------- common/include/api/Spu2Api.h | 8 ++++---- common/include/api/USBApi.h | 8 ++++---- 8 files changed, 47 insertions(+), 38 deletions(-) diff --git a/common/include/api/CDVDApi.h b/common/include/api/CDVDApi.h index 9ace43c7ae..5a0310fe18 100644 --- a/common/include/api/CDVDApi.h +++ b/common/include/api/CDVDApi.h @@ -15,8 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - - + + #ifndef __CDVDAPI_H__ #define __CDVDAPI_H__ @@ -28,7 +28,7 @@ * shadowpcsx2@yahoo.gr, * and florinsasu@hotmail.com */ - + #include "Pcsx2Api.h" /* CDVD plugin API */ @@ -36,7 +36,7 @@ // Basic functions. EXPORT_C_(s32) CDVDinit(char *configpath); -EXPORT_C_(s32) CDVDopen(const char* pTitleFilename); +EXPORT_C_(s32) CDVDopen(void *pDisplay, const char* pTitleFilename); EXPORT_C_(void) CDVDclose(); EXPORT_C_(void) CDVDshutdown(); EXPORT_C_(s32) CDVDreadTrack(u32 lsn, int mode); @@ -92,7 +92,7 @@ CDVD_MODE_2328 2, // skip sync+head+sub (24) bytes CDVD_MODE_2048 3, // skip sync+head+sub (24) bytes CDVD_MODE_2368 4 // full 2352 bytes + 16 subq } TrackModes - + // CDVDgetDiskType returns: enum { CDVD_TYPE_ILLEGAL = 0xff, // Illegal Disc @@ -110,7 +110,7 @@ CDVD_TYPE_DETCTCD = 0x02, // Detecting Cd CDVD_TYPE_DETCT = 0x01, // Detecting CDVD_TYPE_NODISC = 0x00 // No Disc } DiskType; - + // CDVDgetTrayStatus returns: enum { CDVD_TRAY_CLOSE = 0x00, diff --git a/common/include/api/Dev9Api.h b/common/include/api/Dev9Api.h index cd6746453c..4523dbef90 100644 --- a/common/include/api/Dev9Api.h +++ b/common/include/api/Dev9Api.h @@ -15,8 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - - + + #ifndef __DEV9API_H__ #define __DEV9API_H__ @@ -28,7 +28,7 @@ * shadowpcsx2@yahoo.gr, * and florinsasu@hotmail.com */ - + #include "Pcsx2Api.h" typedef void (*DEV9callback)(int cycles); @@ -38,7 +38,7 @@ typedef int (*DEV9handler)(void); // NOTE: The read/write functions CANNOT use XMM/MMX regs // If you want to use them, need to save and restore current ones EXPORT_C_(s32) DEV9init(char *configpath); -EXPORT_C_(s32) DEV9open(); +EXPORT_C_(s32) DEV9open(void *pDisplay); EXPORT_C_(void) DEV9close(); EXPORT_C_(void) DEV9shutdown(); EXPORT_C_(u8) DEV9read8(u32 addr); diff --git a/common/include/api/FWApi.h b/common/include/api/FWApi.h index bc42f0a11c..df402bd2e9 100644 --- a/common/include/api/FWApi.h +++ b/common/include/api/FWApi.h @@ -15,8 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - - + + #ifndef __FWAPI_H__ #define __FWAPI_H__ @@ -28,7 +28,7 @@ * shadowpcsx2@yahoo.gr, * and florinsasu@hotmail.com */ - + #include "Pcsx2Api.h" /* FW plugin API */ @@ -38,7 +38,7 @@ // NOTE: The read/write functions CANNOT use XMM/MMX regs // If you want to use them, need to save and restore current ones EXPORT_C_(s32) CALLBACK FWinit(char *configpath); -EXPORT_C_(s32) CALLBACK FWopen(); +EXPORT_C_(s32) CALLBACK FWopen(void *pDisplay); EXPORT_C_(void) CALLBACK FWclose(); EXPORT_C_(void) CALLBACK FWshutdown(); EXPORT_C_(u32) CALLBACK FWread32(u32 addr); diff --git a/common/include/api/GSApi.h b/common/include/api/GSApi.h index e40972c6e2..db17cb7111 100644 --- a/common/include/api/GSApi.h +++ b/common/include/api/GSApi.h @@ -15,8 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - - + + #ifndef __GSAPI_H__ #define __GSAPI_H__ @@ -28,7 +28,7 @@ * shadowpcsx2@yahoo.gr, * and florinsasu@hotmail.com */ - + #include "Pcsx2Api.h" typedef struct _GSdriverInfo { @@ -38,7 +38,7 @@ typedef struct _GSdriverInfo { // Basic functions. EXPORT_C_(s32) GSinit(char *configpath); -EXPORT_C_(s32) GSopen(char *Title, bool multithread); +EXPORT_C_(s32) GSopen(void *pDisplay, char *Title, bool multithread); EXPORT_C_(void) GSclose(); EXPORT_C_(void) GSshutdown(); EXPORT_C_(void) GSvsync(int field); diff --git a/common/include/api/PadApi.h b/common/include/api/PadApi.h index 87658ddd81..5bee1f4eb1 100644 --- a/common/include/api/PadApi.h +++ b/common/include/api/PadApi.h @@ -15,8 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - - + + #ifndef __PADAPI_H__ #define __PADAPI_H__ @@ -28,15 +28,15 @@ * shadowpcsx2@yahoo.gr, * and florinsasu@hotmail.com */ - + #include "Pcsx2Api.h" /* PAD plugin API */ /* So obsolete that everyone uses it. */ // Basic functions. -EXPORT_C_(s32) CALLBACK PADinit(char *configpath, u32 flags); -EXPORT_C_(s32) CALLBACK PADopen(); +EXPORT_C_(s32) CALLBACK PADinitEx(char *configpath); +EXPORT_C_(s32) CALLBACK PADopen(void *pDsp); EXPORT_C_(void) CALLBACK PADclose(); EXPORT_C_(void) CALLBACK PADshutdown(); // PADkeyEvent is called every vsync (return NULL if no event) @@ -58,6 +58,7 @@ EXPORT_C_(u8) CALLBACK PADquery(); EXPORT_C_(void) CALLBACK PADupdate(u8 pad); // Extended functions +EXPORT_C_(s32) CALLBACK PADfreeze(int mode, freezeData *data); EXPORT_C_(void) CALLBACK PADgsDriverInfo(GSdriverInfo *info); EXPORT_C_(void) CALLBACK PADconfigure(); EXPORT_C_(void) CALLBACK PADabout(); diff --git a/common/include/api/SIOApi.h b/common/include/api/SIOApi.h index ec99b56343..91ffeb00f3 100644 --- a/common/include/api/SIOApi.h +++ b/common/include/api/SIOApi.h @@ -15,8 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - - + + #ifndef __SIOAPI_H__ #define __SIOAPI_H__ @@ -28,19 +28,27 @@ * shadowpcsx2@yahoo.gr, * and florinsasu@hotmail.com */ - + #include "Pcsx2Api.h" /* SIO plugin API */ // basic funcs -s32 CALLBACK SIOinit(char *configpath, u32 port, u32 slot, SIOchangeSlotCB f); -s32 CALLBACK SIOopen(); +// Single plugin can only be PAD, MTAP, RM, or MC. Only load one plugin of each type, +// but not both a PAD and MTAP. Simplifies plugin selection and interface, as well +// as API. +s32 CALLBACK SIOinit(char *configpath); +s32 CALLBACK SIOopen(void *pDisplay); void CALLBACK SIOclose(); void CALLBACK SIOshutdown(); -u8 CALLBACK SIOstartPoll(u8 value); -u8 CALLBACK SIOpoll(u8 value); +// Returns 0 if device doesn't exist. Simplifies things. Also means you don't +// have to distinguish between MTAP and PAD SIO plugins. +s32 CALLBACK SIOstartPoll(u8 deviceType, u32 port, u32 slot, u8 *returnValue); +// Returns 0 on the last output byte. +s32 CALLBACK SIOpoll(u8 value, u8 *returnValue); + +EXPORT_C_(keyEvent*) CALLBACK SIOkeyEvent(); // returns: SIO_TYPE_{PAD,MTAP,RM,MC} u32 CALLBACK SIOquery(); diff --git a/common/include/api/Spu2Api.h b/common/include/api/Spu2Api.h index 51e7ff7dff..e9abfced2e 100644 --- a/common/include/api/Spu2Api.h +++ b/common/include/api/Spu2Api.h @@ -15,8 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - - + + #ifndef __SPU2API_H__ #define __SPU2API_H__ @@ -28,11 +28,11 @@ * shadowpcsx2@yahoo.gr, * and florinsasu@hotmail.com */ - + #include "Pcsx2Api.h" EXPORT_C_(s32) SPU2init(char *configpath); -EXPORT_C_(s32) SPU2open(); +EXPORT_C_(s32) SPU2open(void *pDisplay); EXPORT_C_(void) SPU2close(); EXPORT_C_(void) SPU2shutdown(); EXPORT_C_(void) SPU2write(u32 mem, u16 value); diff --git a/common/include/api/USBApi.h b/common/include/api/USBApi.h index dd71dc2038..99697ab882 100644 --- a/common/include/api/USBApi.h +++ b/common/include/api/USBApi.h @@ -15,8 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - - + + #ifndef __USBAPI_H__ #define __USBAPI_H__ @@ -28,7 +28,7 @@ * shadowpcsx2@yahoo.gr, * and florinsasu@hotmail.com */ - + #include "Pcsx2Api.h" typedef void (*USBcallback)(int cycles); @@ -36,7 +36,7 @@ typedef int (*USBhandler)(void); // Basic functions. EXPORT_C_(s32) CALLBACK USBinit(char *configpath); -EXPORT_C_(s32) CALLBACK USBopen(); +EXPORT_C_(s32) CALLBACK USBopen(void *pDisplay); EXPORT_C_(void) CALLBACK USBclose(); EXPORT_C_(void) CALLBACK USBshutdown(); EXPORT_C_(u8) CALLBACK USBread8(u32 addr);