mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Link the video plugin statically into the main binary on OS X.
This makes the OS X build more robust and should help pave the way for the integration of the video plugins as well as LTO. There are now no more global class level namespace conflicts left, as evidenced by the fact that Dolphin can be linked with -all_load, not that you would want to. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6958 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -76,17 +76,20 @@ int DynamicLibrary::Load(const char* filename)
|
||||
|
||||
#ifdef _WIN32
|
||||
library = LoadLibrary(filename);
|
||||
#else
|
||||
#elif defined __linux__
|
||||
// RTLD_NOW: resolve all symbols on load
|
||||
// RTLD_LOCAL: don't resolve symbols for other libraries
|
||||
library = dlopen(filename, RTLD_NOW | RTLD_LOCAL);
|
||||
#else
|
||||
library = RTLD_SELF;
|
||||
return 1;
|
||||
#endif
|
||||
|
||||
DEBUG_LOG(COMMON, "DL: LoadLibrary: %s(%p)", filename, library);
|
||||
|
||||
if (!library) {
|
||||
ERROR_LOG(COMMON, "DL: Error loading DLL %s: %s", filename,
|
||||
DllGetLastError());
|
||||
DllGetLastError());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -104,33 +107,35 @@ int DynamicLibrary::Load(const char* filename)
|
||||
int DynamicLibrary::Unload()
|
||||
{
|
||||
INFO_LOG(COMMON, "DL: Unloading dynamic library %s", library_file.c_str());
|
||||
int retval;
|
||||
if (!IsLoaded()) { // library != null
|
||||
int retval;
|
||||
if (!IsLoaded()) { // library != null
|
||||
ERROR_LOG(COMMON, "DL: Unload failed for %s: not loaded",
|
||||
library_file.c_str());
|
||||
PanicAlert("DL: Unload failed %s: not loaded",
|
||||
library_file.c_str());
|
||||
return 0;
|
||||
}
|
||||
library_file.c_str());
|
||||
PanicAlert("DL: Unload failed %s: not loaded",
|
||||
library_file.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEBUG_LOG(COMMON, "DL: FreeLibrary: %s %p\n",
|
||||
library_file.c_str(), library);
|
||||
DEBUG_LOG(COMMON, "DL: FreeLibrary: %s %p\n",
|
||||
library_file.c_str(), library);
|
||||
#ifdef _WIN32
|
||||
retval = FreeLibrary(library);
|
||||
retval = FreeLibrary(library);
|
||||
#else
|
||||
retval = dlclose(library)?0:1;
|
||||
if (library == RTLD_SELF)
|
||||
return 1;
|
||||
else
|
||||
retval = dlclose(library) ? 0 : 1;
|
||||
#endif
|
||||
|
||||
if (! retval) {
|
||||
ERROR_LOG(COMMON, "DL: Unload failed %s: %s",
|
||||
library_file.c_str(),
|
||||
DllGetLastError());
|
||||
}
|
||||
library = 0;
|
||||
if (! retval) {
|
||||
ERROR_LOG(COMMON, "DL: Unload failed %s: %s",
|
||||
library_file.c_str(), DllGetLastError());
|
||||
}
|
||||
library = 0;
|
||||
|
||||
INFO_LOG(COMMON, "DL: Done unloading dynamic library %s",
|
||||
library_file.c_str());
|
||||
return retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
// Returns the address where symbol funcname is loaded or NULL on failure
|
||||
@ -156,11 +161,10 @@ void* DynamicLibrary::Get(const char* funcname) const
|
||||
if (!retval)
|
||||
{
|
||||
WARN_LOG(COMMON, "DL: Symbol %s missing in %s (error: %s)\n",
|
||||
funcname, library_file.c_str(),
|
||||
DllGetLastError());
|
||||
funcname, library_file.c_str(), DllGetLastError());
|
||||
}
|
||||
|
||||
INFO_LOG(COMMON, "DL: Done getting symbol %s: %s", library_file.c_str(),
|
||||
funcname);
|
||||
funcname);
|
||||
return retval;
|
||||
}
|
||||
|
@ -30,18 +30,18 @@ PluginVideo::PluginVideo(const char *_Filename) : CPlugin(_Filename), validVideo
|
||||
Video_Screenshot = 0;
|
||||
Video_AddMessage = 0;
|
||||
Video_AccessEFB = 0;
|
||||
Video_SetRendering = 0;
|
||||
Video_CommandProcessorRead16 = 0;
|
||||
Video_CommandProcessorWrite16 = 0;
|
||||
Video_PixelEngineRead16 = 0;
|
||||
Video_PixelEngineWrite16 = 0;
|
||||
Video_PixelEngineWrite32 = 0;
|
||||
Video_GatherPipeBursted = 0;
|
||||
Video_WaitForFrameFinish = 0;
|
||||
Video_SetRendering = 0;
|
||||
Video_CommandProcessorRead16 = 0;
|
||||
Video_CommandProcessorWrite16 = 0;
|
||||
Video_PixelEngineRead16 = 0;
|
||||
Video_PixelEngineWrite16 = 0;
|
||||
Video_PixelEngineWrite32 = 0;
|
||||
Video_GatherPipeBursted = 0;
|
||||
Video_WaitForFrameFinish = 0;
|
||||
Video_IsFifoBusy = 0;
|
||||
Video_AbortFrame = 0;
|
||||
|
||||
Video_Prepare = reinterpret_cast<TVideo_Prepare>
|
||||
Video_Prepare = reinterpret_cast<TVideo_Prepare>
|
||||
(LoadSymbol("Video_Prepare"));
|
||||
Video_BeginField = reinterpret_cast<TVideo_BeginField>
|
||||
(LoadSymbol("Video_BeginField"));
|
||||
@ -59,43 +59,43 @@ PluginVideo::PluginVideo(const char *_Filename) : CPlugin(_Filename), validVideo
|
||||
(LoadSymbol("Video_AccessEFB"));
|
||||
Video_SetRendering = reinterpret_cast<TVideo_SetRendering>
|
||||
(LoadSymbol("Video_SetRendering"));
|
||||
Video_CommandProcessorRead16 = reinterpret_cast<TVideo_Read16>
|
||||
Video_CommandProcessorRead16 = reinterpret_cast<TVideo_Read16>
|
||||
(LoadSymbol("Video_CommandProcessorRead16"));
|
||||
Video_CommandProcessorWrite16 = reinterpret_cast<TVideo_Write16>
|
||||
Video_CommandProcessorWrite16 = reinterpret_cast<TVideo_Write16>
|
||||
(LoadSymbol("Video_CommandProcessorWrite16"));
|
||||
Video_PixelEngineRead16 = reinterpret_cast<TVideo_Read16>
|
||||
Video_PixelEngineRead16 = reinterpret_cast<TVideo_Read16>
|
||||
(LoadSymbol("Video_PixelEngineRead16"));
|
||||
Video_PixelEngineWrite16 = reinterpret_cast<TVideo_Write16>
|
||||
Video_PixelEngineWrite16 = reinterpret_cast<TVideo_Write16>
|
||||
(LoadSymbol("Video_PixelEngineWrite16"));
|
||||
Video_PixelEngineWrite32 = reinterpret_cast<TVideo_Write32>
|
||||
Video_PixelEngineWrite32 = reinterpret_cast<TVideo_Write32>
|
||||
(LoadSymbol("Video_PixelEngineWrite32"));
|
||||
Video_GatherPipeBursted = reinterpret_cast<TVideo_GatherPipeBursted>
|
||||
Video_GatherPipeBursted = reinterpret_cast<TVideo_GatherPipeBursted>
|
||||
(LoadSymbol("Video_GatherPipeBursted"));
|
||||
Video_WaitForFrameFinish = reinterpret_cast<TVideo_WaitForFrameFinish>
|
||||
Video_WaitForFrameFinish = reinterpret_cast<TVideo_WaitForFrameFinish>
|
||||
(LoadSymbol("Video_WaitForFrameFinish"));
|
||||
Video_IsFifoBusy = reinterpret_cast<TVideo_IsFifoBusy>
|
||||
Video_IsFifoBusy = reinterpret_cast<TVideo_IsFifoBusy>
|
||||
(LoadSymbol("Video_IsFifoBusy"));
|
||||
Video_AbortFrame = reinterpret_cast<TVideo_AbortFrame>
|
||||
Video_AbortFrame = reinterpret_cast<TVideo_AbortFrame>
|
||||
(LoadSymbol("Video_AbortFrame"));
|
||||
if ((Video_Prepare != 0) &&
|
||||
(Video_BeginField != 0) &&
|
||||
(Video_EndField != 0) &&
|
||||
(Video_EnterLoop != 0) &&
|
||||
(Video_ExitLoop != 0) &&
|
||||
(Video_Screenshot != 0) &&
|
||||
(Video_AddMessage != 0) &&
|
||||
(Video_SetRendering != 0) &&
|
||||
(Video_AccessEFB != 0) &&
|
||||
(Video_SetRendering != 0) &&
|
||||
(Video_CommandProcessorRead16 != 0) &&
|
||||
(Video_CommandProcessorWrite16 != 0) &&
|
||||
(Video_PixelEngineRead16 != 0) &&
|
||||
(Video_PixelEngineWrite16 != 0) &&
|
||||
(Video_PixelEngineWrite32 != 0) &&
|
||||
(Video_GatherPipeBursted != 0) &&
|
||||
(Video_WaitForFrameFinish != 0) &&
|
||||
(Video_IsFifoBusy != 0) &&
|
||||
(Video_AbortFrame != 0))
|
||||
if ((Video_Prepare != 0) &&
|
||||
(Video_BeginField != 0) &&
|
||||
(Video_EndField != 0) &&
|
||||
(Video_EnterLoop != 0) &&
|
||||
(Video_ExitLoop != 0) &&
|
||||
(Video_Screenshot != 0) &&
|
||||
(Video_AddMessage != 0) &&
|
||||
(Video_SetRendering != 0) &&
|
||||
(Video_AccessEFB != 0) &&
|
||||
(Video_SetRendering != 0) &&
|
||||
(Video_CommandProcessorRead16 != 0) &&
|
||||
(Video_CommandProcessorWrite16 != 0) &&
|
||||
(Video_PixelEngineRead16 != 0) &&
|
||||
(Video_PixelEngineWrite16 != 0) &&
|
||||
(Video_PixelEngineWrite32 != 0) &&
|
||||
(Video_GatherPipeBursted != 0) &&
|
||||
(Video_WaitForFrameFinish != 0) &&
|
||||
(Video_IsFifoBusy != 0) &&
|
||||
(Video_AbortFrame != 0))
|
||||
validVideo = true;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ typedef void (__cdecl* TVideo_Prepare)();
|
||||
typedef void (__cdecl* TVideo_SendFifoData)(u8*,u32);
|
||||
typedef void (__cdecl* TVideo_BeginField)(u32, FieldType, u32, u32);
|
||||
typedef void (__cdecl* TVideo_EndField)();
|
||||
typedef bool (__cdecl* TVideo_Screenshot)(const char* filename);
|
||||
typedef void (__cdecl* TVideo_Screenshot)(const char* filename);
|
||||
typedef void (__cdecl* TVideo_EnterLoop)();
|
||||
typedef void (__cdecl* TVideo_ExitLoop)();
|
||||
typedef void (__cdecl* TVideo_SetRendering)(bool bEnabled);
|
||||
|
Reference in New Issue
Block a user