plugin: add define to select builtin plugin

This commit is contained in:
Gregory Hainaut 2016-03-30 09:47:27 +02:00
parent 3a8164ac4e
commit f010f9458b
2 changed files with 62 additions and 9 deletions

View File

@ -228,7 +228,7 @@ extern "C" {
// if this file is included with this define // if this file is included with this define
// the next api will not be skipped by the compiler // the next api will not be skipped by the compiler
#ifdef GSdefs #if defined(GSdefs) || defined(BUILTIN_GS_PLUGIN)
// basic funcs // basic funcs
@ -287,7 +287,7 @@ s32 CALLBACK GStest();
// if this file is included with this define // if this file is included with this define
// the next api will not be skipped by the compiler // the next api will not be skipped by the compiler
#ifdef PADdefs #if defined(PADdefs) || defined(BUILTIN_PAD_PLUGIN)
// basic funcs // basic funcs
@ -334,7 +334,7 @@ s32 CALLBACK PADtest();
// if this file is included with this define // if this file is included with this define
// the next api will not be skipped by the compiler // the next api will not be skipped by the compiler
#ifdef SPU2defs #if defined(SPU2defs) || defined(BUILTIN_SPU2_PLUGIN)
// basic funcs // basic funcs
@ -396,7 +396,7 @@ s32 CALLBACK SPU2test();
// if this file is included with this define // if this file is included with this define
// the next api will not be skipped by the compiler // the next api will not be skipped by the compiler
#ifdef CDVDdefs #if defined(CDVDdefs) || defined(BUILTIN_CDVD_PLUGIN)
// basic funcs // basic funcs
@ -445,7 +445,7 @@ s32 CALLBACK CDVDgetDualInfo(s32* dualType, u32* _layer1start);
// if this file is included with this define // if this file is included with this define
// the next api will not be skipped by the compiler // the next api will not be skipped by the compiler
#ifdef DEV9defs #if defined(DEV9defs) || defined(BUILTIN_DEV9_PLUGIN)
// basic funcs // basic funcs
@ -490,7 +490,7 @@ s32 CALLBACK DEV9test();
// if this file is included with this define // if this file is included with this define
// the next api will not be skipped by the compiler // the next api will not be skipped by the compiler
#ifdef USBdefs #if defined(USBdefs) || defined(BUILTIN_USB_PLUGIN)
// basic funcs // basic funcs
@ -528,7 +528,7 @@ s32 CALLBACK USBtest();
// if this file is included with this define // if this file is included with this define
// the next api will not be skipped by the compiler // the next api will not be skipped by the compiler
#ifdef FWdefs #if defined(BUILTIN_FW_PLUGIN) || defined(BUILTIN_FW_PLUGIN)
// basic funcs // basic funcs
// NOTE: The read/write functions CANNOT use XMM/MMX regs // NOTE: The read/write functions CANNOT use XMM/MMX regs
@ -722,6 +722,7 @@ typedef void (CALLBACK* _FWirqCallback)(void (*callback)());
#ifdef PLUGINfuncs #ifdef PLUGINfuncs
// GS // GS
#ifndef BUILTIN_GS_PLUGIN
extern _GSopen GSopen; extern _GSopen GSopen;
extern _GSopen2 GSopen2; extern _GSopen2 GSopen2;
extern _GSvsync GSvsync; extern _GSvsync GSvsync;
@ -749,8 +750,10 @@ extern _GSsetVsync GSsetVsync;
extern _GSsetupRecording GSsetupRecording; extern _GSsetupRecording GSsetupRecording;
extern _GSreset GSreset; extern _GSreset GSreset;
extern _GSwriteCSR GSwriteCSR; extern _GSwriteCSR GSwriteCSR;
#endif
// PAD // PAD
#ifndef BUILTIN_PAD_PLUGIN
extern _PADopen PADopen; extern _PADopen PADopen;
extern _PADstartPoll PADstartPoll; extern _PADstartPoll PADstartPoll;
extern _PADpoll PADpoll; extern _PADpoll PADpoll;
@ -761,8 +764,10 @@ extern _PADgsDriverInfo PADgsDriverInfo;
extern _PADsetSlot PADsetSlot; extern _PADsetSlot PADsetSlot;
extern _PADqueryMtap PADqueryMtap; extern _PADqueryMtap PADqueryMtap;
extern _PADWriteEvent PADWriteEvent; extern _PADWriteEvent PADWriteEvent;
#endif
// SPU2 // SPU2
#ifndef BUILTIN_SPU2_PLUGIN
extern _SPU2open SPU2open; extern _SPU2open SPU2open;
extern _SPU2reset SPU2reset; extern _SPU2reset SPU2reset;
extern _SPU2write SPU2write; extern _SPU2write SPU2write;
@ -794,8 +799,10 @@ extern _SPU2setClockPtr SPU2setClockPtr;
extern _SPU2setTimeStretcher SPU2setTimeStretcher; extern _SPU2setTimeStretcher SPU2setTimeStretcher;
extern _SPU2async SPU2async; extern _SPU2async SPU2async;
#endif
// DEV9 // DEV9
#ifndef BUILTIN_DEV9_PLUGIN
extern _DEV9open DEV9open; extern _DEV9open DEV9open;
extern _DEV9read8 DEV9read8; extern _DEV9read8 DEV9read8;
extern _DEV9read16 DEV9read16; extern _DEV9read16 DEV9read16;
@ -814,8 +821,10 @@ extern _DEV9writeDMA8Mem DEV9writeDMA8Mem;
extern _DEV9irqCallback DEV9irqCallback; extern _DEV9irqCallback DEV9irqCallback;
extern _DEV9irqHandler DEV9irqHandler; extern _DEV9irqHandler DEV9irqHandler;
extern _DEV9async DEV9async; extern _DEV9async DEV9async;
#endif
// USB // USB
#ifndef BUILTIN_USB_PLUGIN
extern _USBopen USBopen; extern _USBopen USBopen;
extern _USBread8 USBread8; extern _USBread8 USBread8;
extern _USBread16 USBread16; extern _USBread16 USBread16;
@ -828,12 +837,15 @@ extern _USBasync USBasync;
extern _USBirqCallback USBirqCallback; extern _USBirqCallback USBirqCallback;
extern _USBirqHandler USBirqHandler; extern _USBirqHandler USBirqHandler;
extern _USBsetRAM USBsetRAM; extern _USBsetRAM USBsetRAM;
#endif
// FW // FW
#ifndef BUILTIN_FW_PLUGIN
extern _FWopen FWopen; extern _FWopen FWopen;
extern _FWread32 FWread32; extern _FWread32 FWread32;
extern _FWwrite32 FWwrite32; extern _FWwrite32 FWwrite32;
extern _FWirqCallback FWirqCallback; extern _FWirqCallback FWirqCallback;
#endif
#endif #endif

View File

@ -153,6 +153,7 @@ static void CALLBACK fallback_configure() {}
static void CALLBACK fallback_about() {} static void CALLBACK fallback_about() {}
static s32 CALLBACK fallback_test() { return 0; } static s32 CALLBACK fallback_test() { return 0; }
#ifndef BUILTIN_GS_PLUGIN
_GSvsync GSvsync; _GSvsync GSvsync;
_GSopen GSopen; _GSopen GSopen;
_GSopen2 GSopen2; _GSopen2 GSopen2;
@ -179,6 +180,7 @@ _GSsetExclusive GSsetExclusive;
_GSsetupRecording GSsetupRecording; _GSsetupRecording GSsetupRecording;
_GSreset GSreset; _GSreset GSreset;
_GSwriteCSR GSwriteCSR; _GSwriteCSR GSwriteCSR;
#endif
static void CALLBACK GS_makeSnapshot(const char *path) {} static void CALLBACK GS_makeSnapshot(const char *path) {}
static void CALLBACK GS_setGameCRC(u32 crc, int gameopts) {} static void CALLBACK GS_setGameCRC(u32 crc, int gameopts) {}
@ -269,6 +271,7 @@ static void CALLBACK GS_Legacy_GSreadFIFO2(u64* pMem, int qwc) {
} }
// PAD // PAD
#ifndef BUILTIN_PAD_PLUGIN
_PADinit PADinit; _PADinit PADinit;
_PADopen PADopen; _PADopen PADopen;
_PADstartPoll PADstartPoll; _PADstartPoll PADstartPoll;
@ -279,10 +282,12 @@ _PADkeyEvent PADkeyEvent;
_PADsetSlot PADsetSlot; _PADsetSlot PADsetSlot;
_PADqueryMtap PADqueryMtap; _PADqueryMtap PADqueryMtap;
_PADWriteEvent PADWriteEvent; _PADWriteEvent PADWriteEvent;
#endif
static void PAD_update( u32 padslot ) { } static void PAD_update( u32 padslot ) { }
// SPU2 // SPU2
#ifndef BUILTIN_SPU2_PLUGIN
_SPU2open SPU2open; _SPU2open SPU2open;
_SPU2write SPU2write; _SPU2write SPU2write;
_SPU2reset SPU2reset; _SPU2reset SPU2reset;
@ -307,9 +312,11 @@ _SPU2irqCallback SPU2irqCallback;
_SPU2setClockPtr SPU2setClockPtr; _SPU2setClockPtr SPU2setClockPtr;
_SPU2async SPU2async; _SPU2async SPU2async;
#endif
// DEV9 // DEV9
#ifndef BUILTIN_DEV9_PLUGIN
_DEV9open DEV9open; _DEV9open DEV9open;
_DEV9read8 DEV9read8; _DEV9read8 DEV9read8;
_DEV9read16 DEV9read16; _DEV9read16 DEV9read16;
@ -328,8 +335,10 @@ _DEV9writeDMA8Mem DEV9writeDMA8Mem;
_DEV9irqCallback DEV9irqCallback; _DEV9irqCallback DEV9irqCallback;
_DEV9irqHandler DEV9irqHandler; _DEV9irqHandler DEV9irqHandler;
_DEV9async DEV9async; _DEV9async DEV9async;
#endif
// USB // USB
#ifndef BUILTIN_USB_PLUGIN
_USBopen USBopen; _USBopen USBopen;
_USBread8 USBread8; _USBread8 USBread8;
_USBread16 USBread16; _USBread16 USBread16;
@ -342,12 +351,15 @@ _USBasync USBasync;
_USBirqCallback USBirqCallback; _USBirqCallback USBirqCallback;
_USBirqHandler USBirqHandler; _USBirqHandler USBirqHandler;
_USBsetRAM USBsetRAM; _USBsetRAM USBsetRAM;
#endif
// FW // FW
#ifndef BUILTIN_FW_PLUGIN
_FWopen FWopen; _FWopen FWopen;
_FWread32 FWread32; _FWread32 FWread32;
_FWwrite32 FWwrite32; _FWwrite32 FWwrite32;
_FWirqCallback FWirqCallback; _FWirqCallback FWirqCallback;
#endif
DEV9handler dev9Handler; DEV9handler dev9Handler;
USBhandler usbHandler; USBhandler usbHandler;
@ -920,9 +932,38 @@ SysCorePlugins::PluginStatus_t::PluginStatus_t( PluginsEnum_t _pid, const wxStri
IsInitialized = false; IsInitialized = false;
IsOpened = false; IsOpened = false;
IsStatic = false;
Lib = new DynamicLibrary();
switch (_pid) {
#ifdef BUILTIN_GS_PLUGIN
case PluginId_GS:
#endif
#ifdef BUILTIN_PAD_PLUGIN
case PluginId_PAD:
#endif
#ifdef BUILTIN_SPU2_PLUGIN
case PluginId_SPU2:
#endif
#ifdef BUILTIN_CDVD_PLUGIN
case PluginId_CDVD:
#endif
#ifdef BUILTIN_DEV9_PLUGIN
case PluginId_DEV9:
#endif
#ifdef BUILTIN_USB_PLUGIN
case PluginId_USB:
#endif
#ifdef BUILTIN_FW_PLUGIN
case PluginId_FW:
#endif
case PluginId_Count:
IsStatic = true;
Lib = new StaticLibrary(_pid);
break;
default:
IsStatic = false;
Lib = new DynamicLibrary();
break;
}
if (IsStatic) { if (IsStatic) {
BindCommon( pid ); BindCommon( pid );