LilyPad, Plugin APIs: Slightly changed how multitap API additions work. Now enabling is handled completely by the pad plugin. If anyone ever really feels like adding support for more memcards, can move it over to PCSX2 itself.

Also add some documentation to PadApi.h.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@853 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
mattmenke 2009-03-29 06:14:59 +00:00
parent de86b1dba7
commit e3b40d1933
6 changed files with 36 additions and 10 deletions

View File

@ -548,7 +548,9 @@ typedef void (CALLBACK* _PADgsDriverInfo)(GSdriverInfo *info);
typedef void (CALLBACK* _PADconfigure)();
typedef s32 (CALLBACK* _PADtest)();
typedef void (CALLBACK* _PADabout)();
typedef int (CALLBACK* _PADfreeze)(int mode, freezeData *data);
typedef int (CALLBACK* _PADfreeze)(int mode, freezeData *data);
typedef s32 (CALLBACK* _PADsetSlot)(u8 port, u8 slot);
typedef s32 (CALLBACK* _PADqueryMtap)(u8 port);
// SIO
typedef s32 (CALLBACK* _SIOinit)(u32 port, u32 slot, SIOchangeSlotCB f);
@ -734,6 +736,8 @@ extern _PADconfigure PAD1configure;
extern _PADtest PAD1test;
extern _PADabout PAD1about;
extern _PADfreeze PAD1freeze;
extern _PADsetSlot PAD1setSlot;
extern _PADqueryMtap PAD1queryMtap;
// PAD2
extern _PADinit PAD2init;
@ -751,6 +755,8 @@ extern _PADconfigure PAD2configure;
extern _PADtest PAD2test;
extern _PADabout PAD2about;
extern _PADfreeze PAD2freeze;
extern _PADsetSlot PAD2setSlot;
extern _PADqueryMtap PAD2queryMtap;
// SIO[2]
extern _SIOinit SIOinit[2][9];

View File

@ -83,6 +83,8 @@ typedef s32 (CALLBACK* _PADfreeze)(u8 mode, freezeData *data);
typedef void (CALLBACK* _PADconfigure)();
typedef s32 (CALLBACK* _PADtest)();
typedef void (CALLBACK* _PADabout)();
typedef s32 (CALLBACK* _PADsetSlot)(u8 port, u8 slot);
typedef s32 (CALLBACK* _PADqueryMtap)(u8 port);
// SIO
typedef s32 (CALLBACK* _SIOinit)(int types, SIOchangeSlotCB f);

View File

@ -60,7 +60,19 @@ EXPORT_C_(void) PADupdate(u8 pad);
// Extended functions
EXPORT_C_(void) PADgsDriverInfo(GSdriverInfo *info);
EXPORT_C_(s32) PADfreeze(u8 mode, freezeData *data);
EXPORT_C_(s32) PADfreeze(u8 mode, freezeData *data);
// Returns 1 if the pad plugin wants a multitap on the specified port.
// 0 otherwise.
EXPORT_C_(s32) PADqueryMtap(u8 port);
// Sets the active pad slot for the specified port.
// Both numbers are 1-based indices. Should return 0 if there's no
// pad on the specified slot. Even if PADqueryMtap(port) returns 0,
// should handle this properly for slot != 1, to so PCSX2 can allow
// Multitap to be enabled/disabled elsewhere.
EXPORT_C_(s32) PADsetSlot(u8 port, u8 slot);
EXPORT_C_(void) PADconfigure();
EXPORT_C_(void) PADabout();
EXPORT_C_(s32) PADtest();

View File

@ -63,7 +63,8 @@ EXPORT_C_(u32) PSEgetLibType();
EXPORT_C_(u32) PSEgetLibVersion();
EXPORT_C_(void) PADconfigure();
EXPORT_C_(s32) PADfreeze(int mode, freezeData *data);
EXPORT_C_(s32) PADsetSlot(int port, int slot);
EXPORT_C_(s32) PADsetSlot(u8 port, u8 slot);
EXPORT_C_(s32) PADqueryMtap(u8 port);
#ifdef NO_CRT
inline void * malloc(size_t size) {

View File

@ -1378,10 +1378,14 @@ extern "C" long _cdecl _ftol2() {
}
#endif
s32 CALLBACK PADsetSlot(int port, int slot) {
port --;
slot --;
if ((unsigned int)port > 1 || (unsigned int)slot > 3) return 0;
s32 CALLBACK PADqueryMtap(u8 port) {
return config.multitap[port];
}
s32 CALLBACK PADsetSlot(u8 port, u8 slot) {
port--;
slot--;
if (port > 1 || slot > 3) return 0;
// Even if no pad there, record the slot, as it is the active slot regardless.
slots[port] = slot;
return pads[port][slot].enabled;

View File

@ -21,3 +21,4 @@ EXPORTS
PADupdate
PADfreeze
PADsetSlot
PADqueryMtap