diff --git a/OpenGL.cpp b/OpenGL.cpp index d45ce1bb..2656e971 100644 --- a/OpenGL.cpp +++ b/OpenGL.cpp @@ -1286,17 +1286,12 @@ void TextureFilterHandler::init() wchar_t wRomName[32]; ::mbstowcs(wRomName, RSP.romname, 32); - wchar_t buffer[MAX_PATH]; - GetModuleFileNameW(NULL, buffer, MAX_PATH); - wstring pluginPath(buffer); - wstring::size_type pos = pluginPath.find_last_of(L"\\/"); - m_inited = txfilter_init(maxTextureSize, // max texture width supported by hardware maxTextureSize, // max texture height supported by hardware 32, // max texture bpp supported by hardware options, config.textureFilter.txCacheSize, // cache texture to system memory - pluginPath.substr(0, pos).c_str(), // plugin path + RSP.pluginpath, // plugin path wRomName, // name of ROM. must be no longer than 256 characters displayLoadProgress); } diff --git a/RSP.cpp b/RSP.cpp index 18d7ff99..09fd674a 100644 --- a/RSP.cpp +++ b/RSP.cpp @@ -283,6 +283,11 @@ void RSP_Init() if (strstr(RSP.romname, (const char *)"OgreBattle64")) config.hacks |= hack_Ogre64; + GetModuleFileNameW(NULL, RSP.pluginpath, PLUGIN_PATH_SIZE); + wstring pluginPath(RSP.pluginpath); + wstring::size_type pos = pluginPath.find_last_of(L"\\/"); + wcscpy(RSP.pluginpath, pluginPath.substr(0, pos).c_str()); + memset(&gSP, 0, sizeof(gSPInfo)); gSPTexture(1.0f, 1.0f, 0, 0, TRUE); diff --git a/RSP.h b/RSP.h index 81c8a8b5..a0d0f779 100644 --- a/RSP.h +++ b/RSP.h @@ -3,12 +3,15 @@ #include "Types.h" +#define PLUGIN_PATH_SIZE 260 + typedef struct { u32 PC[18], PCi, busy, halt, close, DList, uc_start, uc_dstart, cmd, nextCmd; s32 count; bool bLLE; char romname[21]; + wchar_t pluginpath[PLUGIN_PATH_SIZE]; } RSPInfo; extern RSPInfo RSP;