2014-09-21 05:54:13 +00:00
|
|
|
#include "GLideN64_mupenplus.h"
|
2014-09-11 07:38:56 +00:00
|
|
|
#include "../PluginAPI.h"
|
|
|
|
#include "../GLideN64.h"
|
|
|
|
#include "../OpenGL.h"
|
|
|
|
|
|
|
|
#ifdef _WINDOWS
|
|
|
|
#define DLSYM(a, b) GetProcAddress(a, b)
|
|
|
|
#else
|
|
|
|
#define DLSYM(a, b) dlsym(a, b)
|
|
|
|
#endif // _WINDOWS
|
|
|
|
|
2014-09-21 05:54:13 +00:00
|
|
|
ptr_ConfigGetSharedDataFilepath ConfigGetSharedDataFilepath = NULL;
|
|
|
|
ptr_ConfigGetUserConfigPath ConfigGetUserConfigPath = NULL;
|
2014-09-30 15:14:25 +00:00
|
|
|
ptr_ConfigOpenSection ConfigOpenSection = NULL;
|
|
|
|
ptr_ConfigSetDefaultInt ConfigSetDefaultInt = NULL;
|
|
|
|
ptr_ConfigSetDefaultBool ConfigSetDefaultBool = NULL;
|
|
|
|
ptr_ConfigGetParamInt ConfigGetParamInt = NULL;
|
|
|
|
ptr_ConfigGetParamBool ConfigGetParamBool = NULL;
|
2014-09-21 05:54:13 +00:00
|
|
|
|
|
|
|
/* definitions of pointers to Core video extension functions */
|
|
|
|
ptr_VidExt_Init CoreVideo_Init = NULL;
|
|
|
|
ptr_VidExt_Quit CoreVideo_Quit = NULL;
|
|
|
|
ptr_VidExt_ListFullscreenModes CoreVideo_ListFullscreenModes = NULL;
|
|
|
|
ptr_VidExt_SetVideoMode CoreVideo_SetVideoMode = NULL;
|
|
|
|
ptr_VidExt_SetCaption CoreVideo_SetCaption = NULL;
|
|
|
|
ptr_VidExt_ToggleFullScreen CoreVideo_ToggleFullScreen = NULL;
|
|
|
|
ptr_VidExt_ResizeWindow CoreVideo_ResizeWindow = NULL;
|
|
|
|
ptr_VidExt_GL_GetProcAddress CoreVideo_GL_GetProcAddress = NULL;
|
|
|
|
ptr_VidExt_GL_SetAttribute CoreVideo_GL_SetAttribute = NULL;
|
|
|
|
ptr_VidExt_GL_GetAttribute CoreVideo_GL_GetAttribute = NULL;
|
|
|
|
ptr_VidExt_GL_SwapBuffers CoreVideo_GL_SwapBuffers = NULL;
|
|
|
|
|
2014-09-30 10:09:40 +00:00
|
|
|
void(*renderCallback)(int) = NULL;
|
2014-09-21 05:54:13 +00:00
|
|
|
|
2014-09-11 07:38:56 +00:00
|
|
|
m64p_error PluginAPI::PluginStartup(m64p_dynlib_handle _CoreLibHandle)
|
|
|
|
{
|
|
|
|
ConfigGetSharedDataFilepath = (ptr_ConfigGetSharedDataFilepath) DLSYM(_CoreLibHandle, "ConfigGetSharedDataFilepath");
|
|
|
|
ConfigGetUserConfigPath = (ptr_ConfigGetUserConfigPath) DLSYM(_CoreLibHandle, "ConfigGetUserConfigPath");
|
2014-09-30 15:14:25 +00:00
|
|
|
ConfigOpenSection = (ptr_ConfigOpenSection)DLSYM(_CoreLibHandle, "ConfigOpenSection");
|
|
|
|
ConfigSetDefaultInt = (ptr_ConfigSetDefaultInt)DLSYM(_CoreLibHandle, "ConfigSetDefaultInt");
|
|
|
|
ConfigSetDefaultBool = (ptr_ConfigSetDefaultBool)DLSYM(_CoreLibHandle, "ConfigSetDefaultBool");
|
|
|
|
ConfigGetParamInt = (ptr_ConfigGetParamInt)DLSYM(_CoreLibHandle, "ConfigGetParamInt");
|
|
|
|
ConfigGetParamBool = (ptr_ConfigGetParamBool)DLSYM(_CoreLibHandle, "ConfigGetParamBool");
|
2014-09-11 07:38:56 +00:00
|
|
|
|
|
|
|
/* Get the core Video Extension function pointers from the library handle */
|
|
|
|
CoreVideo_Init = (ptr_VidExt_Init) DLSYM(_CoreLibHandle, "VidExt_Init");
|
|
|
|
CoreVideo_Quit = (ptr_VidExt_Quit) DLSYM(_CoreLibHandle, "VidExt_Quit");
|
|
|
|
CoreVideo_ListFullscreenModes = (ptr_VidExt_ListFullscreenModes) DLSYM(_CoreLibHandle, "VidExt_ListFullscreenModes");
|
|
|
|
CoreVideo_SetVideoMode = (ptr_VidExt_SetVideoMode) DLSYM(_CoreLibHandle, "VidExt_SetVideoMode");
|
|
|
|
CoreVideo_SetCaption = (ptr_VidExt_SetCaption) DLSYM(_CoreLibHandle, "VidExt_SetCaption");
|
|
|
|
CoreVideo_ToggleFullScreen = (ptr_VidExt_ToggleFullScreen) DLSYM(_CoreLibHandle, "VidExt_ToggleFullScreen");
|
|
|
|
CoreVideo_ResizeWindow = (ptr_VidExt_ResizeWindow) DLSYM(_CoreLibHandle, "VidExt_ResizeWindow");
|
|
|
|
CoreVideo_GL_GetProcAddress = (ptr_VidExt_GL_GetProcAddress) DLSYM(_CoreLibHandle, "VidExt_GL_GetProcAddress");
|
|
|
|
CoreVideo_GL_SetAttribute = (ptr_VidExt_GL_SetAttribute) DLSYM(_CoreLibHandle, "VidExt_GL_SetAttribute");
|
|
|
|
CoreVideo_GL_GetAttribute = (ptr_VidExt_GL_GetAttribute) DLSYM(_CoreLibHandle, "VidExt_GL_GetAttribute");
|
|
|
|
CoreVideo_GL_SwapBuffers = (ptr_VidExt_GL_SwapBuffers) DLSYM(_CoreLibHandle, "VidExt_GL_SwapBuffers");
|
|
|
|
|
|
|
|
return M64ERR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
m64p_error PluginAPI::PluginShutdown()
|
|
|
|
{
|
2014-09-21 12:15:22 +00:00
|
|
|
#ifdef RSPTHREAD
|
|
|
|
_callAPICommand(acRomClosed);
|
|
|
|
delete m_pRspThread;
|
|
|
|
m_pRspThread = NULL;
|
|
|
|
#else
|
|
|
|
video().stop();
|
|
|
|
#endif
|
2014-09-11 07:38:56 +00:00
|
|
|
return M64ERR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
m64p_error PluginAPI::PluginGetVersion(
|
|
|
|
m64p_plugin_type * _PluginType,
|
|
|
|
int * _PluginVersion,
|
|
|
|
int * _APIVersion,
|
|
|
|
const char ** _PluginNamePtr,
|
|
|
|
int * _Capabilities
|
|
|
|
)
|
|
|
|
{
|
|
|
|
/* set version info */
|
|
|
|
if (_PluginType != NULL)
|
|
|
|
*_PluginType = M64PLUGIN_GFX;
|
|
|
|
|
|
|
|
if (_PluginVersion != NULL)
|
|
|
|
*_PluginVersion = PLUGIN_VERSION;
|
|
|
|
|
|
|
|
if (_APIVersion != NULL)
|
|
|
|
*_APIVersion = VIDEO_PLUGIN_API_VERSION;
|
|
|
|
|
|
|
|
if (_PluginNamePtr != NULL)
|
|
|
|
*_PluginNamePtr = pluginName;
|
|
|
|
|
|
|
|
if (_Capabilities != NULL)
|
|
|
|
{
|
|
|
|
*_Capabilities = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return M64ERR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
void PluginAPI::SetRenderingCallback(void (*callback)(int))
|
|
|
|
{
|
|
|
|
renderCallback = callback;
|
|
|
|
}
|
2014-10-01 09:04:15 +00:00
|
|
|
|
|
|
|
void PluginAPI::ResizeVideoOutput(int _Width, int _Height)
|
|
|
|
{
|
|
|
|
video().setWindowSize(_Width, _Height);
|
|
|
|
}
|