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"
|
|
|
|
|
2014-10-13 07:57:14 +00:00
|
|
|
#ifdef OS_WINDOWS
|
2014-09-11 07:38:56 +00:00
|
|
|
#define DLSYM(a, b) GetProcAddress(a, b)
|
|
|
|
#else
|
|
|
|
#define DLSYM(a, b) dlsym(a, b)
|
2014-10-13 07:57:14 +00:00
|
|
|
#endif // OS_WINDOWS
|
2014-09-11 07:38:56 +00:00
|
|
|
|
2016-06-10 06:06:06 +00:00
|
|
|
ptr_ConfigGetSharedDataFilepath ConfigGetSharedDataFilepath = nullptr;
|
|
|
|
ptr_ConfigGetUserConfigPath ConfigGetUserConfigPath = nullptr;
|
|
|
|
ptr_ConfigGetUserDataPath ConfigGetUserDataPath = nullptr;
|
|
|
|
ptr_ConfigGetUserCachePath ConfigGetUserCachePath = nullptr;
|
|
|
|
ptr_ConfigOpenSection ConfigOpenSection = nullptr;
|
|
|
|
ptr_ConfigDeleteSection ConfigDeleteSection = nullptr;
|
|
|
|
ptr_ConfigSaveSection ConfigSaveSection = nullptr;
|
|
|
|
ptr_ConfigSaveFile ConfigSaveFile = nullptr;
|
|
|
|
ptr_ConfigSetDefaultInt ConfigSetDefaultInt = nullptr;
|
|
|
|
ptr_ConfigSetDefaultFloat ConfigSetDefaultFloat = nullptr;
|
|
|
|
ptr_ConfigSetDefaultBool ConfigSetDefaultBool = nullptr;
|
|
|
|
ptr_ConfigSetDefaultString ConfigSetDefaultString = nullptr;
|
|
|
|
ptr_ConfigGetParamInt ConfigGetParamInt = nullptr;
|
|
|
|
ptr_ConfigGetParamFloat ConfigGetParamFloat = nullptr;
|
|
|
|
ptr_ConfigGetParamBool ConfigGetParamBool = nullptr;
|
|
|
|
ptr_ConfigGetParamString ConfigGetParamString = nullptr;
|
2014-09-21 05:54:13 +00:00
|
|
|
|
|
|
|
/* definitions of pointers to Core video extension functions */
|
2016-06-10 06:06:06 +00:00
|
|
|
ptr_VidExt_Init CoreVideo_Init = nullptr;
|
|
|
|
ptr_VidExt_Quit CoreVideo_Quit = nullptr;
|
|
|
|
ptr_VidExt_ListFullscreenModes CoreVideo_ListFullscreenModes = nullptr;
|
|
|
|
ptr_VidExt_SetVideoMode CoreVideo_SetVideoMode = nullptr;
|
|
|
|
ptr_VidExt_SetCaption CoreVideo_SetCaption = nullptr;
|
|
|
|
ptr_VidExt_ToggleFullScreen CoreVideo_ToggleFullScreen = nullptr;
|
|
|
|
ptr_VidExt_ResizeWindow CoreVideo_ResizeWindow = nullptr;
|
|
|
|
ptr_VidExt_GL_GetProcAddress CoreVideo_GL_GetProcAddress = nullptr;
|
|
|
|
ptr_VidExt_GL_SetAttribute CoreVideo_GL_SetAttribute = nullptr;
|
|
|
|
ptr_VidExt_GL_GetAttribute CoreVideo_GL_GetAttribute = nullptr;
|
|
|
|
ptr_VidExt_GL_SwapBuffers CoreVideo_GL_SwapBuffers = nullptr;
|
|
|
|
|
|
|
|
void(*renderCallback)(int) = nullptr;
|
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");
|
2015-05-23 11:53:08 +00:00
|
|
|
ConfigGetUserCachePath = (ptr_ConfigGetUserCachePath)DLSYM(_CoreLibHandle, "ConfigGetUserCachePath");
|
|
|
|
ConfigGetUserDataPath = (ptr_ConfigGetUserDataPath)DLSYM(_CoreLibHandle, "ConfigGetUserDataPath");
|
|
|
|
|
2014-09-30 15:14:25 +00:00
|
|
|
ConfigOpenSection = (ptr_ConfigOpenSection)DLSYM(_CoreLibHandle, "ConfigOpenSection");
|
2015-02-11 09:54:10 +00:00
|
|
|
ConfigDeleteSection = (ptr_ConfigDeleteSection)DLSYM(_CoreLibHandle, "ConfigDeleteSection");
|
2015-05-01 09:20:51 +00:00
|
|
|
ConfigSaveSection = (ptr_ConfigSaveSection)DLSYM(_CoreLibHandle, "ConfigSaveSection");
|
2015-03-06 06:21:04 +00:00
|
|
|
ConfigSaveFile = (ptr_ConfigSaveFile)DLSYM(_CoreLibHandle, "ConfigSaveFile");
|
2014-09-30 15:14:25 +00:00
|
|
|
ConfigSetDefaultInt = (ptr_ConfigSetDefaultInt)DLSYM(_CoreLibHandle, "ConfigSetDefaultInt");
|
2015-07-06 11:58:51 +00:00
|
|
|
ConfigSetDefaultFloat = (ptr_ConfigSetDefaultFloat)DLSYM(_CoreLibHandle, "ConfigSetDefaultFloat");
|
2014-09-30 15:14:25 +00:00
|
|
|
ConfigSetDefaultBool = (ptr_ConfigSetDefaultBool)DLSYM(_CoreLibHandle, "ConfigSetDefaultBool");
|
2014-11-28 06:49:52 +00:00
|
|
|
ConfigSetDefaultString = (ptr_ConfigSetDefaultString)DLSYM(_CoreLibHandle, "ConfigSetDefaultString");
|
2014-09-30 15:14:25 +00:00
|
|
|
ConfigGetParamInt = (ptr_ConfigGetParamInt)DLSYM(_CoreLibHandle, "ConfigGetParamInt");
|
2015-07-06 11:58:51 +00:00
|
|
|
ConfigGetParamFloat = (ptr_ConfigGetParamFloat)DLSYM(_CoreLibHandle, "ConfigGetParamFloat");
|
2014-09-30 15:14:25 +00:00
|
|
|
ConfigGetParamBool = (ptr_ConfigGetParamBool)DLSYM(_CoreLibHandle, "ConfigGetParamBool");
|
2014-11-28 06:49:52 +00:00
|
|
|
ConfigGetParamString = (ptr_ConfigGetParamString)DLSYM(_CoreLibHandle, "ConfigGetParamString");
|
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;
|
2016-06-10 06:06:06 +00:00
|
|
|
m_pRspThread = nullptr;
|
2014-09-21 12:15:22 +00:00
|
|
|
#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 */
|
2016-06-10 06:06:06 +00:00
|
|
|
if (_PluginType != nullptr)
|
2014-09-11 07:38:56 +00:00
|
|
|
*_PluginType = M64PLUGIN_GFX;
|
|
|
|
|
2016-06-10 06:06:06 +00:00
|
|
|
if (_PluginVersion != nullptr)
|
2014-09-11 07:38:56 +00:00
|
|
|
*_PluginVersion = PLUGIN_VERSION;
|
|
|
|
|
2016-06-10 06:06:06 +00:00
|
|
|
if (_APIVersion != nullptr)
|
2014-09-11 07:38:56 +00:00
|
|
|
*_APIVersion = VIDEO_PLUGIN_API_VERSION;
|
|
|
|
|
2016-06-10 06:06:06 +00:00
|
|
|
if (_PluginNamePtr != nullptr)
|
2014-09-11 07:38:56 +00:00
|
|
|
*_PluginNamePtr = pluginName;
|
|
|
|
|
2016-06-10 06:06:06 +00:00
|
|
|
if (_Capabilities != nullptr)
|
2014-09-11 07:38:56 +00:00
|
|
|
{
|
|
|
|
*_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);
|
|
|
|
}
|
2014-10-02 09:18:28 +00:00
|
|
|
|
|
|
|
void PluginAPI::ReadScreen2(void * _dest, int * _width, int * _height, int _front)
|
|
|
|
{
|
|
|
|
video().readScreen2(_dest, _width, _height, _front);
|
|
|
|
}
|