novidia: add nv check so plugin can be enabled by default

This commit is contained in:
somewhatlurker
2020-11-20 12:56:34 +11:00
parent 6a872fcd45
commit 1e7cda3f0d
5 changed files with 23 additions and 10 deletions
@@ -145,5 +145,4 @@ r.Height=1080
[plugins]
DivaWig.dva=0
DSCRemote.dva=0
Novidia.dva=0
custom_freeplay_text_example.p=0
+6 -7
View File
@@ -1,15 +1,14 @@
/*
Simple header for detecting Nvidia GPU models
*/
#pragma once
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <string>
#include <stdio.h>
#pragma comment(lib, "advapi32")
namespace GPUModel
{
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <string>
#include <stdio.h>
#pragma comment(lib, "advapi32")
std::wstring ExePath() {
WCHAR buffer[MAX_PATH];
GetModuleFileNameW(NULL, buffer, MAX_PATH);
@@ -57,7 +57,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>..\..\..\dependencies\xdelta3;..\..\..\dependencies\PluginConfigApi;..\..\..\dependencies\detours\include;</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\..\dependencies\GPUModel;..\..\..\dependencies\xdelta3;..\..\..\dependencies\PluginConfigApi;..\..\..\dependencies\detours\include;</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -74,7 +74,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>..\..\..\dependencies\xdelta3;..\..\..\dependencies\PluginConfigApi;..\..\..\dependencies\detours\include;</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\..\dependencies\GPUModel;..\..\..\dependencies\xdelta3;..\..\..\dependencies\PluginConfigApi;..\..\..\dependencies\detours\include;</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -1,6 +1,7 @@
#include "framework.h"
#include "glStuff.h"
#include <PluginConfigApi.h>
#include <GPUModel.h>
extern "C" {
// well, only good for 64 bit now, ont that is matters lol
@@ -381,6 +382,17 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
{
loadConfig();
if (!disable_nvidia_check)
{
std::string gpuName = GPUModel::getGpuName();
if (gpuName != "Other" && gpuName != "Unknown")
{
// detected Nvidia GPU
printf("[Novidia] Detected Nvidia GPU! Quitting!\n");
return TRUE;
}
}
DisableThreadLibraryCalls(hModule);
DetourTransactionBegin();
@@ -432,6 +444,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
using namespace PluginConfig;
PluginConfigOption config[] = {
{ CONFIG_BOOLEAN, new PluginConfigBooleanData{ L"disable_nvidia_check", L"general", CONFIG_FILE, L"Disable Nvidia Check", L"On systems with both AMD and Nvidia graphics, the plugin may disable functionality due to detecting the Nvidia GPU. Set this to forcefully enable functionality.", false, false } },
{ CONFIG_BOOLEAN, new PluginConfigBooleanData{ L"enable_chara_skinning", L"general", CONFIG_FILE, L"Enable Chara Skinning", L"If you really need to get extra performance, you can disable uploading skinning data. (character models will disappear)", true, false } },
{ CONFIG_BOOLEAN, new PluginConfigBooleanData{ L"use_TexSubImage", L"general", CONFIG_FILE, L"Use glTexSubImage", L"glTexSubImage should offer higher performance, but stuttering has been reported when it is used.\nTry disabling this if you have issues.", true, false } },
{ CONFIG_BOOLEAN, new PluginConfigBooleanData{ L"force_BGRA_upload", L"general", CONFIG_FILE, L"Force BGRA Texture Uploads", L"BGRA format uploads seem to run faster (on some hardware), but drivers may suggest RGBA instead.\nUsing this forces uploads to use the BGRA format.\n\nDisabling this may decrease or improve performance.", true, false } },
@@ -24,6 +24,7 @@ bool checkBufferTargetOk(GLenum target)
int __stdcall stub() { return 1; }
bool disable_nvidia_check;
bool enable_chara_skinning;
bool use_TexSubImage;
bool force_BGRA_upload;
@@ -89,6 +90,7 @@ LPCWSTR CONFIG_FILE = CONFIG_FILE_STRING.c_str();
void loadConfig()
{
disable_nvidia_check = GetPrivateProfileIntW(L"general", L"disable_nvidia_check", 0, CONFIG_FILE) > 0 ? true : false;
enable_chara_skinning = GetPrivateProfileIntW(L"general", L"enable_chara_skinning", 1, CONFIG_FILE) > 0 ? true : false;
use_TexSubImage = GetPrivateProfileIntW(L"general", L"use_TexSubImage", 1, CONFIG_FILE) > 0 ? true : false;
force_BGRA_upload = GetPrivateProfileIntW(L"general", L"force_BGRA_upload", 1, CONFIG_FILE) > 0 ? true : false;