Update and move DivaGL plugin conflict checks to launcher

This commit is contained in:
nastys
2024-04-10 20:00:12 +02:00
parent c6ceb61636
commit be29f090f3
7 changed files with 18 additions and 56 deletions
@@ -1087,9 +1087,10 @@ class PluginOption : public ConfigOptionBase
{
public:
bool _defaultVal;
std::wstring _builddate;
std::vector<ConfigOptionBase*> _configopts;
PluginOption(LPCWSTR iniVarName, LPCWSTR iniSectionName, LPCWSTR iniFilePath, LPCWSTR friendlyName, LPCWSTR description, bool defaultVal, std::vector<ConfigOptionBase*> configopts)
PluginOption(LPCWSTR iniVarName, LPCWSTR iniSectionName, LPCWSTR iniFilePath, LPCWSTR friendlyName, LPCWSTR description, bool defaultVal, std::vector<ConfigOptionBase*> configopts, std::wstring builddate = L"Unknown")
{
_iniVarName = iniVarName;
_iniSectionName = iniSectionName;
@@ -1098,6 +1099,7 @@ public:
_description = description;
_defaultVal = defaultVal;
_configopts = configopts;
_builddate = builddate;
}
virtual int AddToPanel(Panel^ panel, unsigned int left, unsigned int top, ToolTip^ tooltip)
@@ -474,7 +474,7 @@ std::vector<PluginOption*> GetPluginOptions(std::vector<PluginInfo>* plugins)
for (PluginInfo &pi : *plugins)
{
PluginOption* opt = new PluginOption(pi.filename.c_str(), L"plugins", CONFIG_FILE, pi.name.c_str(), pi.description.c_str(), true, pi.configopts);
PluginOption* opt = new PluginOption(pi.filename.c_str(), L"plugins", CONFIG_FILE, pi.name.c_str(), pi.description.c_str(), true, pi.configopts, pi.builddate);
outvec.push_back(opt);
}
+14 -5
View File
@@ -1112,8 +1112,9 @@ private: System::Boolean hasInvalidSettings()
bool divaGLEnabled = false;
bool novidiaEnabled = false;
bool shaderPatchEnabled = false;
bool divaImGuiOldEnabled = false;
for (ConfigOptionBase* option : AllPluginOpts)
for (PluginOption* option : AllPluginOpts)
{
if (lstrcmpW(option->_friendlyName, L"DivaGL") == 0)
{
@@ -1121,8 +1122,8 @@ private: System::Boolean hasInvalidSettings()
if (divaGLEnabled)
{
if (hasInvalidGLUT) goto divagl_freeglut;
else if (novidiaEnabled) goto divagl_novidia;
else if (shaderPatchEnabled) goto divagl_shaderpatch;
else if (novidiaEnabled || shaderPatchEnabled) goto divagl_novidia;
else if (divaImGuiOldEnabled) goto divagl_divaimguiold;
}
}
else if (lstrcmpW(option->_friendlyName, L"Novidia") == 0)
@@ -1133,7 +1134,12 @@ private: System::Boolean hasInvalidSettings()
else if (lstrcmpW(option->_friendlyName, L"ShaderPatch") == 0)
{
shaderPatchEnabled = ((CheckBox^)CheckBox::FromHandle(option->mainControlHandle))->Checked;
if (shaderPatchEnabled && divaGLEnabled) goto divagl_shaderpatch;
if (shaderPatchEnabled && divaGLEnabled) goto divagl_novidia;
}
else if (lstrcmpW(option->_friendlyName, L"DivaImGui") == 0 && option->_builddate == L"Unknown")
{
divaImGuiOldEnabled = ((CheckBox^)CheckBox::FromHandle(option->mainControlHandle))->Checked;
if (divaImGuiOldEnabled && divaGLEnabled) goto divagl_divaimguiold;
}
}
@@ -1144,9 +1150,12 @@ divagl_freeglut:
return true;
divagl_novidia:
divagl_shaderpatch:
SkinnedMessageBox::Show(this, "Plugins: Novidia and ShaderPatch must be disabled if DivaGL is enabled.", "PD Launcher", MessageBoxButtons::OK, MessageBoxIcon::Error);
return true;
divagl_divaimguiold:
SkinnedMessageBox::Show(this, "Plugins: Your version of DivaImGui is too old for DivaGL; please either update or disable it.", "PD Launcher", MessageBoxButtons::OK, MessageBoxIcon::Error);
return true;
}
private: System::Void Button_Launch_Click(System::Object^ sender, System::EventArgs^ e) {
@@ -380,12 +380,6 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
if (ul_reason_for_call == DLL_PROCESS_ATTACH)
{
if (hasConflicts())
{
// detected an incompatible plugin (i.e. DivaGL)
return TRUE;
}
loadConfig();
if (!disable_amd_check)
@@ -152,21 +152,3 @@ void InjectCode(void* address, const std::vector<uint8_t> data)
// delete[] hModules;
// return false;
//}
bool hasConflicts()
{
puts("[Novidia] Checking for conflicts...");
if(GetModuleHandleW(L"DivaGL.dva") != NULL)
{
// detected DivaGL
puts("[Novidia] Detected DivaGL! Quitting!");
#ifdef _DEBUG
MessageBoxExW(NULL, L"Detected DivaGL! Quitting!\n", L"Novidia", MB_OK, 0);
#endif
return true;
}
puts("[Novidia] No conflicts found.");
return false;
}
@@ -294,12 +294,6 @@ BOOL APIENTRY DllMain(HMODULE hModule,
{
if (ul_reason_for_call == DLL_PROCESS_ATTACH)
{
if (hasConflicts())
{
// detected an incompatible plugin (i.e. DivaGL)
return TRUE;
}
// install a thunk to hook
InjectCode((void*)0x1405e5991, { 0x48, 0x83, 0xec, 0x28 }); // SUB RSP, 0x28
InjectCode((void*)0x1405e5995, { 0xe8, 0x56, 0xe8, 0xb9, 0xff }); // CALL 0x1401841f0
@@ -161,22 +161,3 @@ LPCWSTR CONFIG_FILE = CONFIG_FILE_STRING.c_str();
// delete[] hModules;
// return false;
//}
bool hasConflicts()
{
puts("[ShaderPatch] Checking for conflicts...");
if (GetModuleHandleW(L"DivaGL.dva") != NULL)
{
// detected DivaGL
puts("[ShaderPatch] Detected DivaGL! Quitting!");
#ifdef _DEBUG
MessageBoxExW(NULL, L"Detected DivaGL! Quitting!\n", L"ShaderPatch", MB_OK, 0);
#endif
return true;
}
puts("[ShaderPatch] No conflicts found.");
return false;
}