Merge pull request #1270 from PCSX2/monolithic-build

Monolithic build
This commit is contained in:
Gregory Hainaut 2016-04-03 11:20:07 +02:00
commit ee08a6fc53
11 changed files with 329 additions and 66 deletions

View File

@ -82,6 +82,40 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
message(STATUS "Building with Clang/LLVM.") message(STATUS "Building with Clang/LLVM.")
endif() endif()
#-------------------------------------------------------------------------------
# Select the support of plugin
#-------------------------------------------------------------------------------
option(BUILTIN_GS "Disable support of GS plugin (developer option)")
option(BUILTIN_PAD "Disable support of PAD plugin (developer option)")
option(BUILTIN_SPU2 "Disable support of SPU2 plugin (developer option)")
option(BUILTIN_USB "Disable support of USB plugin (developer option)")
option(BUILTIN_FW "Disable support of FW plugin (developer option)")
option(BUILTIN_DEV9 "Disable support of DEV9 plugin (developer option)")
option(BUILTIN_CDVD "Disable support of CDVD plugin (developer option)")
set(PLUGIN_SUPPORT "")
if(BUILTIN_GS)
set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_GS_PLUGIN")
endif()
if(BUILTIN_PAD)
set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_PAD_PLUGIN")
endif()
if(BUILTIN_SPU2)
set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_SPU2_PLUGIN")
endif()
if(BUILTIN_USB)
set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_USB_PLUGIN")
endif()
if(BUILTIN_FW)
set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_FW_PLUGIN")
endif()
if(BUILTIN_DEV)
set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_DEV_PLUGIN")
endif()
if(BUILTIN_CDVD)
set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_CDVD_PLUGIN")
endif()
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Select the architecture # Select the architecture
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
@ -312,7 +346,7 @@ else()
endif() endif()
# Note: -DGTK_DISABLE_DEPRECATED can be used to test a build without gtk deprecated feature. It could be useful to port to a newer API # Note: -DGTK_DISABLE_DEPRECATED can be used to test a build without gtk deprecated feature. It could be useful to port to a newer API
set(DEFAULT_GCC_FLAG "${ARCH_FLAG} ${COMMON_FLAG} ${DEFAULT_WARNINGS} ${AGGRESSIVE_WARNING} ${HARDENING_FLAG} ${DEBUG_FLAG} ${ASAN_FLAG} ${OPTIMIZATION_FLAG} ${LTO_FLAGS}") set(DEFAULT_GCC_FLAG "${ARCH_FLAG} ${COMMON_FLAG} ${DEFAULT_WARNINGS} ${AGGRESSIVE_WARNING} ${HARDENING_FLAG} ${DEBUG_FLAG} ${ASAN_FLAG} ${OPTIMIZATION_FLAG} ${LTO_FLAGS} ${PLUGIN_SUPPORT}")
# c++ only flags # c++ only flags
set(DEFAULT_CPP_FLAG "${DEFAULT_GCC_FLAG} -std=c++11 -Wno-invalid-offsetof") set(DEFAULT_CPP_FLAG "${DEFAULT_GCC_FLAG} -std=c++11 -Wno-invalid-offsetof")

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

@ -630,6 +630,28 @@ set(pcsx2FinalLibs
${GCOV_LIBRARIES} ${GCOV_LIBRARIES}
) )
if(BUILTIN_GS)
set(pcsx2FinalLibs "${pcsx2FinalLibs} GSdx-1.0.0")
endif()
if(BUILTIN_PAD)
set(pcsx2FinalLibs "${pcsx2FinalLibs} onepad-1.2.0")
endif()
if(BUILTIN_SPU2)
set(pcsx2FinalLibs "${pcsx2FinalLibs} spu2x-2.0.0")
endif()
if(BUILTIN_USB)
set(pcsx2FinalLibs "${pcsx2FinalLibs} USBnull-0.7.0")
endif()
if(BUILTIN_FW)
set(pcsx2FinalLibs "${pcsx2FinalLibs} FWnull-0.7.0")
endif()
if(BUILTIN_DEV)
set(pcsx2FinalLibs "${pcsx2FinalLibs} dev9null-0.5.0")
endif()
if(BUILTIN_CDVD)
set(pcsx2FinalLibs "${pcsx2FinalLibs} CDVDnull")
endif()
# additonal include directories # additonal include directories
include_directories( include_directories(
gui gui

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;
@ -829,6 +841,87 @@ static void PS2E_CALLBACK pcsx2_OSD_WriteLn( int icon, const char* msg )
return; // not implemented... return; // not implemented...
} }
// ---------------------------------------------------------------------------------
// DynamicStaticLibrary
// ---------------------------------------------------------------------------------
StaticLibrary::StaticLibrary(PluginsEnum_t _pid) : pid(_pid)
{
}
bool StaticLibrary::Load(const wxString& name)
{
return true;
}
void* StaticLibrary::GetSymbol(const wxString &name)
{
#define RETURN_SYMBOL(s) if (name == #s) return (void*)&s;
#define RETURN_COMMON_SYMBOL(p) \
RETURN_SYMBOL(p##init) \
RETURN_SYMBOL(p##close) \
RETURN_SYMBOL(p##shutdown) \
RETURN_SYMBOL(p##keyEvent) \
RETURN_SYMBOL(p##setSettingsDir) \
RETURN_SYMBOL(p##setLogDir) \
RETURN_SYMBOL(p##freeze) \
RETURN_SYMBOL(p##test) \
RETURN_SYMBOL(p##configure) \
RETURN_SYMBOL(p##about)
#ifdef BUILTIN_GS_PLUGIN
RETURN_COMMON_SYMBOL(GS);
#endif
#ifdef BUILTIN_PAD_PLUGIN
RETURN_COMMON_SYMBOL(PAD);
#endif
#ifdef BUILTIN_SPU2_PLUGIN
RETURN_COMMON_SYMBOL(SPU2);
#endif
#ifdef BUILTIN_CDVD_PLUGIN
RETURN_COMMON_SYMBOL(CDVD);
#endif
#ifdef BUILTIN_DEV9_PLUGIN
RETURN_COMMON_SYMBOL(DEV9);
#endif
#ifdef BUILTIN_USB_PLUGIN
RETURN_COMMON_SYMBOL(USB);
#endif
#ifdef BUILTIN_FW_PLUGIN
RETURN_COMMON_SYMBOL(FW);
#endif
#undef RETURN_COMMON_SYMBOL
#undef RETURN_SYMBOL
return NULL;
}
bool StaticLibrary::HasSymbol(const wxString &name)
{
return false;
}
DynamicLibrary::DynamicLibrary() : Lib()
{
}
bool DynamicLibrary::Load(const wxString& name)
{
return Lib.Load(name);
}
void* DynamicLibrary::GetSymbol(const wxString &name)
{
return Lib.GetSymbol(name);
}
bool DynamicLibrary::HasSymbol(const wxString &name)
{
return Lib.HasSymbol(name);
}
// --------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------
// PluginStatus_t Implementations // PluginStatus_t Implementations
// --------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------
@ -845,56 +938,93 @@ SysCorePlugins::PluginStatus_t::PluginStatus_t( PluginsEnum_t _pid, const wxStri
IsInitialized = false; IsInitialized = false;
IsOpened = false; IsOpened = false;
if( Filename.IsEmpty() ) switch (_pid) {
throw Exception::PluginInitError( pid ).SetDiagMsg( L"Empty plugin filename" ); #ifdef BUILTIN_GS_PLUGIN
case PluginId_GS:
if( !wxFile::Exists( Filename ) ) #endif
throw Exception::PluginLoadError( pid ).SetStreamName(srcfile) #ifdef BUILTIN_PAD_PLUGIN
.SetBothMsgs(pxL("The configured %s plugin file was not found")); case PluginId_PAD:
#endif
if( !Lib.Load( Filename ) ) #ifdef BUILTIN_SPU2_PLUGIN
throw Exception::PluginLoadError( pid ).SetStreamName(Filename) case PluginId_SPU2:
.SetBothMsgs(pxL("The configured %s plugin file is not a valid dynamic library")); #endif
#ifdef BUILTIN_CDVD_PLUGIN
case PluginId_CDVD:
// Try to enumerate the new v2.0 plugin interface first. #endif
// If that fails, fall back on the old style interface. #ifdef BUILTIN_DEV9_PLUGIN
case PluginId_DEV9:
//m_libs[i].GetSymbol( L"PS2E_InitAPI" ); // on the TODO list! #endif
#ifdef BUILTIN_USB_PLUGIN
case PluginId_USB:
// 2.0 API Failed; Enumerate the Old Stuff! --> #endif
#ifdef BUILTIN_FW_PLUGIN
_PS2EgetLibName GetLibName = (_PS2EgetLibName) Lib.GetSymbol( L"PS2EgetLibName" ); case PluginId_FW:
_PS2EgetLibVersion2 GetLibVersion2 = (_PS2EgetLibVersion2) Lib.GetSymbol( L"PS2EgetLibVersion2" ); #endif
case PluginId_Count:
if( GetLibName == NULL || GetLibVersion2 == NULL ) IsStatic = true;
throw Exception::PluginLoadError( pid ).SetStreamName(Filename) Lib = new StaticLibrary(_pid);
.SetDiagMsg(L"%s plugin init failed: Method binding failure on GetLibName or GetLibVersion2.") break;
.SetUserMsg(_( "The configured %s plugin is not a PCSX2 plugin, or is for an older unsupported version of PCSX2.")); default:
IsStatic = false;
// Only Windows GSdx uses this. Should be removed in future after GSdx no longer relies on it to show the new config dialog. Lib = new DynamicLibrary();
#ifdef _WIN32 break;
// Since only Windows Gsdx has this symbol, that means every other plugin is going to cause error messages to be logged.
// Let's not do that for a hack function.
if (Lib.HasSymbol(L"PS2EsetEmuVersion")) {
_PS2EsetEmuVersion SetEmuVersion = (_PS2EsetEmuVersion)Lib.GetSymbol(L"PS2EsetEmuVersion");
if (SetEmuVersion)
SetEmuVersion("PCSX2", (PCSX2_VersionHi << 24) | (PCSX2_VersionMid << 16) | (PCSX2_VersionLo << 8) | 0);
} }
if (IsStatic) {
BindCommon( pid );
} else {
if( Filename.IsEmpty() )
throw Exception::PluginInitError( pid ).SetDiagMsg( L"Empty plugin filename" );
if( !wxFile::Exists( Filename ) )
throw Exception::PluginLoadError( pid ).SetStreamName(srcfile)
.SetBothMsgs(pxL("The configured %s plugin file was not found"));
if( !Lib->Load( Filename ) )
throw Exception::PluginLoadError( pid ).SetStreamName(Filename)
.SetBothMsgs(pxL("The configured %s plugin file is not a valid dynamic library"));
// Try to enumerate the new v2.0 plugin interface first.
// If that fails, fall back on the old style interface.
//m_libs[i].GetSymbol( L"PS2E_InitAPI" ); // on the TODO list!
// 2.0 API Failed; Enumerate the Old Stuff! -->
_PS2EgetLibName GetLibName = (_PS2EgetLibName) Lib->GetSymbol( L"PS2EgetLibName" );
_PS2EgetLibVersion2 GetLibVersion2 = (_PS2EgetLibVersion2) Lib->GetSymbol( L"PS2EgetLibVersion2" );
if( GetLibName == NULL || GetLibVersion2 == NULL )
throw Exception::PluginLoadError( pid ).SetStreamName(Filename)
.SetDiagMsg(L"%s plugin init failed: Method binding failure on GetLibName or GetLibVersion2.")
.SetUserMsg(_( "The configured %s plugin is not a PCSX2 plugin, or is for an older unsupported version of PCSX2."));
// Only Windows GSdx uses this. Should be removed in future after GSdx no longer relies on it to show the new config dialog.
#ifdef _WIN32
// Since only Windows Gsdx has this symbol, that means every other plugin is going to cause error messages to be logged.
// Let's not do that for a hack function.
if (Lib->HasSymbol(L"PS2EsetEmuVersion")) {
_PS2EsetEmuVersion SetEmuVersion = (_PS2EsetEmuVersion)Lib->GetSymbol(L"PS2EsetEmuVersion");
if (SetEmuVersion)
SetEmuVersion("PCSX2", (PCSX2_VersionHi << 24) | (PCSX2_VersionMid << 16) | (PCSX2_VersionLo << 8) | 0);
}
#endif #endif
Name = fromUTF8( GetLibName() ); Name = fromUTF8( GetLibName() );
int version = GetLibVersion2( tbl_PluginInfo[pid].typemask ); int version = GetLibVersion2( tbl_PluginInfo[pid].typemask );
Version.Printf( L"%d.%d.%d", (version>>8)&0xff, version&0xff, (version>>24)&0xff ); Version.Printf( L"%d.%d.%d", (version>>8)&0xff, version&0xff, (version>>24)&0xff );
// Bind Required Functions
// (generate critical error if binding fails)
// Bind Required Functions BindCommon( pid );
// (generate critical error if binding fails) BindRequired( pid );
BindOptional( pid );
}
BindCommon( pid );
BindRequired( pid );
BindOptional( pid );
// Run Plugin's Functionality Test. // Run Plugin's Functionality Test.
// A lot of plugins don't bother to implement this function and return 0 (success) // A lot of plugins don't bother to implement this function and return 0 (success)
@ -916,7 +1046,7 @@ void SysCorePlugins::PluginStatus_t::BindCommon( PluginsEnum_t pid )
while( current->MethodName != NULL ) while( current->MethodName != NULL )
{ {
*target = (VoidMethod*)Lib.GetSymbol( current->GetMethodName( pid ) ); *target = (VoidMethod*)Lib->GetSymbol( current->GetMethodName( pid ) );
if( *target == NULL ) if( *target == NULL )
*target = current->Fallback; *target = current->Fallback;
@ -936,13 +1066,12 @@ void SysCorePlugins::PluginStatus_t::BindCommon( PluginsEnum_t pid )
void SysCorePlugins::PluginStatus_t::BindRequired( PluginsEnum_t pid ) void SysCorePlugins::PluginStatus_t::BindRequired( PluginsEnum_t pid )
{ {
const LegacyApi_ReqMethod* current = s_MethMessReq[pid]; const LegacyApi_ReqMethod* current = s_MethMessReq[pid];
const wxDynamicLibrary& lib = Lib;
wxDoNotLogInThisScope please; wxDoNotLogInThisScope please;
while( current->MethodName != NULL ) while( current->MethodName != NULL )
{ {
*(current->Dest) = (VoidMethod*)lib.GetSymbol( current->GetMethodName() ); *(current->Dest) = (VoidMethod*)Lib->GetSymbol( current->GetMethodName() );
if( *(current->Dest) == NULL ) if( *(current->Dest) == NULL )
*(current->Dest) = current->Fallback; *(current->Dest) = current->Fallback;
@ -961,13 +1090,12 @@ void SysCorePlugins::PluginStatus_t::BindRequired( PluginsEnum_t pid )
void SysCorePlugins::PluginStatus_t::BindOptional( PluginsEnum_t pid ) void SysCorePlugins::PluginStatus_t::BindOptional( PluginsEnum_t pid )
{ {
const LegacyApi_OptMethod* current = s_MethMessOpt[pid]; const LegacyApi_OptMethod* current = s_MethMessOpt[pid];
const wxDynamicLibrary& lib = Lib;
wxDoNotLogInThisScope please; wxDoNotLogInThisScope please;
while( current->MethodName != NULL ) while( current->MethodName != NULL )
{ {
*(current->Dest) = (VoidMethod*)lib.GetSymbol( current->GetMethodName() ); *(current->Dest) = (VoidMethod*)Lib->GetSymbol( current->GetMethodName() );
current++; current++;
} }
} }

View File

@ -253,6 +253,46 @@ extern SysPluginBindings SysPlugins;
// SysCorePlugins Class // SysCorePlugins Class
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
// //
class DynamicStaticLibrary
{
public:
DynamicStaticLibrary() {};
virtual ~DynamicStaticLibrary() {};
virtual bool Load(const wxString& name) = 0;
virtual void* GetSymbol(const wxString &name) = 0;
virtual bool HasSymbol(const wxString &name) = 0;
};
class StaticLibrary : public DynamicStaticLibrary
{
PluginsEnum_t pid;
public:
StaticLibrary(PluginsEnum_t _pid);
virtual ~StaticLibrary() {};
bool Load(const wxString& name);
void* GetSymbol(const wxString &name);
bool HasSymbol(const wxString &name);
};
class DynamicLibrary : public DynamicStaticLibrary
{
wxDynamicLibrary Lib;
public:
DynamicLibrary();
virtual ~DynamicLibrary() {};
bool Load(const wxString& name);
void* GetSymbol(const wxString &name);
bool HasSymbol(const wxString &name);
};
class SysCorePlugins class SysCorePlugins
{ {
DeclareNoncopyableObject( SysCorePlugins ); DeclareNoncopyableObject( SysCorePlugins );
@ -265,23 +305,26 @@ protected:
bool IsInitialized; bool IsInitialized;
bool IsOpened; bool IsOpened;
bool IsStatic;
wxString Filename; wxString Filename;
wxString Name; wxString Name;
wxString Version; wxString Version;
LegacyPluginAPI_Common CommonBindings; LegacyPluginAPI_Common CommonBindings;
wxDynamicLibrary Lib; DynamicStaticLibrary* Lib;
public: public:
PluginStatus_t() PluginStatus_t()
{ {
IsInitialized = false; IsInitialized = false;
IsOpened = false; IsOpened = false;
IsStatic = false;
Lib = NULL;
} }
PluginStatus_t( PluginsEnum_t _pid, const wxString& srcfile ); PluginStatus_t( PluginsEnum_t _pid, const wxString& srcfile );
virtual ~PluginStatus_t() throw() { } virtual ~PluginStatus_t() throw() { delete Lib; }
protected: protected:
void BindCommon( PluginsEnum_t pid ); void BindCommon( PluginsEnum_t pid );

View File

@ -50,4 +50,8 @@ set(FWnullFinalLibs
${GTK2_LIBRARIES} ${GTK2_LIBRARIES}
) )
add_pcsx2_plugin(${Output} "${FWnullFinalSources}" "${FWnullFinalLibs}" "${FWnullFinalFlags}") if(BUILTIN_FW)
add_pcsx2_lib(${Output} "${FWnullFinalSources}" "${FWnullFinalLibs}" "${FWnullFinalFlags}")
else()
add_pcsx2_plugin(${Output} "${FWnullFinalSources}" "${FWnullFinalLibs}" "${FWnullFinalFlags}")
endif()

View File

@ -211,7 +211,11 @@ if (REBUILD_SHADER)
add_custom_command(OUTPUT res/glsl_source.h COMMAND perl ${CMAKE_SOURCE_DIR}/linux_various/glsl2h.pl) add_custom_command(OUTPUT res/glsl_source.h COMMAND perl ${CMAKE_SOURCE_DIR}/linux_various/glsl2h.pl)
endif() endif()
add_pcsx2_plugin(${Output} "${GSdxFinalSources}" "${GSdxFinalLibs}" "${GSdxFinalFlags}") if(BUILTIN_GS)
add_pcsx2_lib(${Output} "${GSdxFinalSources}" "${GSdxFinalLibs}" "${GSdxFinalFlags}")
else()
add_pcsx2_plugin(${Output} "${GSdxFinalSources}" "${GSdxFinalLibs}" "${GSdxFinalFlags}")
endif()
################################### Replay Loader ################################### Replay Loader
if(BUILD_REPLAY_LOADERS) if(BUILD_REPLAY_LOADERS)

View File

@ -50,4 +50,8 @@ set(USBnullFinalLibs
${GTK2_LIBRARIES} ${GTK2_LIBRARIES}
) )
add_pcsx2_plugin(${Output} "${USBnullFinalSources}" "${USBnullFinalLibs}" "${USBnullFinalFlags}") if(BUILTIN_USB)
add_pcsx2_lib(${Output} "${USBnullFinalSources}" "${USBnullFinalLibs}" "${USBnullFinalFlags}")
else()
add_pcsx2_plugin(${Output} "${USBnullFinalSources}" "${USBnullFinalLibs}" "${USBnullFinalFlags}")
endif()

View File

@ -47,4 +47,8 @@ set(dev9nullFinalLibs
${GTK2_LIBRARIES} ${GTK2_LIBRARIES}
) )
add_pcsx2_plugin(${Output} "${dev9nullFinalSources}" "${dev9nullFinalLibs}" "${dev9nullFinalFlags}") if(BUILTIN_DEV9)
add_pcsx2_lib(${Output} "${dev9nullFinalSources}" "${dev9nullFinalLibs}" "${dev9nullFinalFlags}")
else()
add_pcsx2_plugin(${Output} "${dev9nullFinalSources}" "${dev9nullFinalLibs}" "${dev9nullFinalFlags}")
endif()

View File

@ -126,4 +126,8 @@ foreach(result_file IN ITEMS
COMMAND perl ${CMAKE_SOURCE_DIR}/linux_various/hex2h.pl "${image_sources}/${result_file}.png" "${compiled_images}/${result_file}" ) COMMAND perl ${CMAKE_SOURCE_DIR}/linux_various/hex2h.pl "${image_sources}/${result_file}.png" "${compiled_images}/${result_file}" )
endforeach() endforeach()
add_pcsx2_plugin(${Output} "${onepadFinalSources}" "${onepadFinalLibs}" "${onepadFinalFlags}") if(BUILTIN_PAD)
add_pcsx2_lib(${Output} "${onepadFinalSources}" "${onepadFinalLibs}" "${onepadFinalFlags}")
else()
add_pcsx2_plugin(${Output} "${onepadFinalSources}" "${onepadFinalLibs}" "${onepadFinalFlags}")
endif()

View File

@ -114,4 +114,8 @@ else()
) )
endif() endif()
add_pcsx2_plugin(${Output} "${spu2xFinalSources}" "${spu2xFinalLibs}" "${spu2xFinalFlags}") if(BUILTIN_SPU2)
add_pcsx2_lib(${Output} "${spu2xFinalSources}" "${spu2xFinalLibs}" "${spu2xFinalFlags}")
else()
add_pcsx2_plugin(${Output} "${spu2xFinalSources}" "${spu2xFinalLibs}" "${spu2xFinalFlags}")
endif()