mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
Add API function FindPluginPath()
since plugin's path is different for Mupen64Plus and Zilmar specs emus.
This commit is contained in:
parent
e2ddef7520
commit
c7c86b7152
|
@ -44,6 +44,8 @@ public:
|
||||||
int InitiateGFX(const GFX_INFO & _gfxInfo);
|
int InitiateGFX(const GFX_INFO & _gfxInfo);
|
||||||
void ChangeWindow();
|
void ChangeWindow();
|
||||||
|
|
||||||
|
void FindPluginPath(wchar_t * _strPath);
|
||||||
|
|
||||||
#ifndef MUPENPLUSAPI
|
#ifndef MUPENPLUSAPI
|
||||||
// Zilmar
|
// Zilmar
|
||||||
void DllTest(HWND /*_hParent*/) {}
|
void DllTest(HWND /*_hParent*/) {}
|
||||||
|
@ -86,7 +88,7 @@ private:
|
||||||
PluginAPI()
|
PluginAPI()
|
||||||
#ifdef RSPTHREAD
|
#ifdef RSPTHREAD
|
||||||
: m_pRspThread(NULL), m_command(acNone)
|
: m_pRspThread(NULL), m_command(acNone)
|
||||||
#endif
|
#endif
|
||||||
{}
|
{}
|
||||||
PluginAPI(const PluginAPI &);
|
PluginAPI(const PluginAPI &);
|
||||||
|
|
||||||
|
|
29
RSP.cpp
29
RSP.cpp
|
@ -10,6 +10,7 @@
|
||||||
#include "FrameBuffer.h"
|
#include "FrameBuffer.h"
|
||||||
#include "DepthBuffer.h"
|
#include "DepthBuffer.h"
|
||||||
#include "GBI.h"
|
#include "GBI.h"
|
||||||
|
#include "PluginAPI.h"
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -265,32 +266,6 @@ void RSP_SetDefaultState()
|
||||||
gDPPipelineMode(G_PM_NPRIMITIVE);
|
gDPPipelineMode(G_PM_NPRIMITIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
|
||||||
void _findPluginPath()
|
|
||||||
{
|
|
||||||
#ifdef OS_WINDOWS
|
|
||||||
GetModuleFileNameW(NULL, RSP.pluginpath, PLUGIN_PATH_SIZE);
|
|
||||||
#elif OS_LINUX
|
|
||||||
char path[512];
|
|
||||||
int res = readlink("/proc/self/exe", path, 510);
|
|
||||||
if (res != -1) {
|
|
||||||
path[res] = 0;
|
|
||||||
::mbstowcs(RSP.pluginpath, path, PLUGIN_PATH_SIZE);
|
|
||||||
}
|
|
||||||
#elif OS_MAC_OS_X
|
|
||||||
char path[MAXPATHLEN];
|
|
||||||
uint32_t pathLen = MAXPATHLEN*2;
|
|
||||||
if (_NSGetExecutablePath(path, pathLen) == 0) {
|
|
||||||
::mbstowcs(RSP.pluginpath, path, PLUGIN_PATH_SIZE);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
RSP.pluginpath = L"\0";
|
|
||||||
#endif
|
|
||||||
wstring pluginPath(RSP.pluginpath);
|
|
||||||
wstring::size_type pos = pluginPath.find_last_of(L"\\/");
|
|
||||||
wcscpy(RSP.pluginpath, pluginPath.substr(0, pos).c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void RSP_Init()
|
void RSP_Init()
|
||||||
{
|
{
|
||||||
#ifdef OS_WINDOWS
|
#ifdef OS_WINDOWS
|
||||||
|
@ -333,7 +308,7 @@ void RSP_Init()
|
||||||
if (strstr(RSP.romname, (const char *)"OgreBattle64"))
|
if (strstr(RSP.romname, (const char *)"OgreBattle64"))
|
||||||
config.generalEmulation.hacks |= hack_Ogre64;
|
config.generalEmulation.hacks |= hack_Ogre64;
|
||||||
|
|
||||||
_findPluginPath();
|
api().FindPluginPath(RSP.pluginpath);
|
||||||
|
|
||||||
RSP_SetDefaultState();
|
RSP_SetDefaultState();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "../PluginAPI.h"
|
#include "../PluginAPI.h"
|
||||||
#include "../OpenGL.h"
|
#include "../OpenGL.h"
|
||||||
#include "../Config.h"
|
#include "../Config.h"
|
||||||
|
#include "../RSP.h"
|
||||||
|
|
||||||
int PluginAPI::InitiateGFX(const GFX_INFO & _gfxInfo)
|
int PluginAPI::InitiateGFX(const GFX_INFO & _gfxInfo)
|
||||||
{
|
{
|
||||||
|
@ -10,3 +11,30 @@ int PluginAPI::InitiateGFX(const GFX_INFO & _gfxInfo)
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PluginAPI::FindPluginPath(wchar_t * _strPath)
|
||||||
|
{
|
||||||
|
if (_strPath == NULL)
|
||||||
|
return;
|
||||||
|
#ifdef OS_WINDOWS
|
||||||
|
GetModuleFileNameW(NULL, _strPath, PLUGIN_PATH_SIZE);
|
||||||
|
#elif OS_LINUX
|
||||||
|
char path[512];
|
||||||
|
int res = readlink("/proc/self/exe", path, 510);
|
||||||
|
if (res != -1) {
|
||||||
|
path[res] = 0;
|
||||||
|
::mbstowcs(_strPath, path, PLUGIN_PATH_SIZE);
|
||||||
|
}
|
||||||
|
#elif OS_MAC_OS_X
|
||||||
|
char path[MAXPATHLEN];
|
||||||
|
uint32_t pathLen = MAXPATHLEN * 2;
|
||||||
|
if (_NSGetExecutablePath(path, pathLen) == 0) {
|
||||||
|
::mbstowcs(_strPath, path, PLUGIN_PATH_SIZE);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
_strPath = L"\0";
|
||||||
|
#endif
|
||||||
|
std::wstring pluginPath(_strPath);
|
||||||
|
std::wstring::size_type pos = pluginPath.find_last_of(L"\\/");
|
||||||
|
wcscpy(_strPath, pluginPath.substr(0, pos).c_str());
|
||||||
|
}
|
||||||
|
|
|
@ -2,6 +2,11 @@
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include "../PluginAPI.h"
|
#include "../PluginAPI.h"
|
||||||
#include "../OpenGL.h"
|
#include "../OpenGL.h"
|
||||||
|
#include "../RSP.h"
|
||||||
|
|
||||||
|
#ifdef OS_WINDOWS
|
||||||
|
EXTERN_C IMAGE_DOS_HEADER __ImageBase;
|
||||||
|
#endif
|
||||||
|
|
||||||
BOOL CALLBACK FindToolBarProc( HWND hWnd, LPARAM lParam )
|
BOOL CALLBACK FindToolBarProc( HWND hWnd, LPARAM lParam )
|
||||||
{
|
{
|
||||||
|
@ -23,3 +28,20 @@ int PluginAPI::InitiateGFX(const GFX_INFO & _gfxInfo)
|
||||||
EnumChildWindows( hWnd, FindToolBarProc, 0 );
|
EnumChildWindows( hWnd, FindToolBarProc, 0 );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PluginAPI::FindPluginPath(wchar_t * _strPath)
|
||||||
|
{
|
||||||
|
if (_strPath == NULL)
|
||||||
|
return;
|
||||||
|
#ifdef OS_WINDOWS
|
||||||
|
TCHAR strDLLPath[PLUGIN_PATH_SIZE];
|
||||||
|
::GetModuleFileName((HINSTANCE)&__ImageBase, strDLLPath, PLUGIN_PATH_SIZE);
|
||||||
|
::mbstowcs(_strPath, strDLLPath, PLUGIN_PATH_SIZE);
|
||||||
|
#else
|
||||||
|
// TODO: for other OS
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
std::wstring pluginPath(_strPath);
|
||||||
|
std::wstring::size_type pos = pluginPath.find_last_of(L"\\/");
|
||||||
|
wcscpy(_strPath, pluginPath.substr(0, pos).c_str());
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user