Force GPU model in config.ini

This commit is contained in:
nastys
2020-04-08 19:42:01 +02:00
parent a151a9866b
commit c4695b2595
2 changed files with 21 additions and 1 deletions
+5 -1
View File
@@ -1,4 +1,4 @@
######################################### #########################################
# /!\ WARNING: DO NOT EDIT WITH NOTEPAD!# # /!\ WARNING: DO NOT EDIT WITH NOTEPAD!#
######################################### #########################################
@@ -6,6 +6,10 @@
# Load plugins including below options # Load plugins including below options
Enable=1 Enable=1
[GPU]
# Force GPU model (-1=auto; 0=Kepler; 1=Maxwell; 2=Turing)
Model=-1
[Launcher] [Launcher]
# Forces the launcher to be skipped, you can use the --launch parameter instead of this. # Forces the launcher to be skipped, you can use the --launch parameter instead of this.
Skip=0 Skip=0
@@ -31,11 +31,27 @@ namespace GPUModel
std::string getGpuName() std::string getGpuName()
{ {
WCHAR buffer[MAX_PATH];
GetModuleFileNameW(NULL, buffer, MAX_PATH);
std::wstring exepath = buffer;
std::wstring::size_type pos = exepath.find_last_of(L"\\/");
int nGPUModel = GetPrivateProfileIntW(L"gpu", L"model", -1, (exepath.substr(0, pos) + L"\\plugins\\config.ini").c_str());
if (nGPUModel>-1)
{
// -1=auto; 0=Kepler; 1=Maxwell; 2=Turing
std::string result("GK");
if (nGPUModel == 1) result[1]='M';
else if (nGPUModel == 2) result = "TU";
printf("[GPUModel] GPU Model override: %s\n", result.c_str());
Sleep(1000);
return std::string(result);
}
/* if (getWineVer() != "") /* if (getWineVer() != "")
{ {
return "Unknown"; return "Unknown";
} }
else {*/ else {*/
printf("[GPUModel] Checking GPU model\n");
HMODULE hdlNvapi = LoadLibraryW(L"nvapi64.dll"); HMODULE hdlNvapi = LoadLibraryW(L"nvapi64.dll");
if (hdlNvapi == NULL) return if (hdlNvapi == NULL) return