mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-06 20:58:37 +01:00
[util] Add functionality to support hashed app profiles
This commit is contained in:
parent
813ae020b6
commit
80bfd2ed97
1 changed files with 38 additions and 4 deletions
|
@ -11,12 +11,14 @@
|
||||||
|
|
||||||
#include "../util_env.h"
|
#include "../util_env.h"
|
||||||
|
|
||||||
|
#include "../sha1/sha1_util.h"
|
||||||
|
|
||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
|
|
||||||
using ProfileList = std::vector<std::pair<const char*, Config>>;
|
using ProfileList = std::vector<std::pair<const char*, Config>>;
|
||||||
|
|
||||||
|
|
||||||
const static ProfileList g_profiles = {{
|
const static ProfileList g_profiles = {
|
||||||
/**********************************************/
|
/**********************************************/
|
||||||
/* D3D12 GAMES (vkd3d-proton with dxvk dxgi) */
|
/* D3D12 GAMES (vkd3d-proton with dxvk dxgi) */
|
||||||
/**********************************************/
|
/**********************************************/
|
||||||
|
@ -1204,16 +1206,21 @@ namespace dxvk {
|
||||||
{ R"(\\bin\\trainz\.exe$)", {{
|
{ R"(\\bin\\trainz\.exe$)", {{
|
||||||
{ "d3d9.deviceLossOnFocusLoss", "True" },
|
{ "d3d9.deviceLossOnFocusLoss", "True" },
|
||||||
}} },
|
}} },
|
||||||
}};
|
};
|
||||||
|
|
||||||
|
|
||||||
const static ProfileList g_deckProfiles = {{
|
const static ProfileList g_deckProfiles = {
|
||||||
/* Fallout 4: Defaults to 45 FPS on OLED, but also breaks above 60 FPS */
|
/* Fallout 4: Defaults to 45 FPS on OLED, but also breaks above 60 FPS */
|
||||||
{ R"(\\Fallout4\.exe$)", {{
|
{ R"(\\Fallout4\.exe$)", {{
|
||||||
{ "dxgi.syncInterval", "1" },
|
{ "dxgi.syncInterval", "1" },
|
||||||
{ "dxgi.maxFrameRate", "60" },
|
{ "dxgi.maxFrameRate", "60" },
|
||||||
}} },
|
}} },
|
||||||
}};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const static ProfileList g_hashedProfiles = {
|
||||||
|
/* Nothing to see here */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
const Config* findProfile(const ProfileList& profiles, const std::string& appName) {
|
const Config* findProfile(const ProfileList& profiles, const std::string& appName) {
|
||||||
|
@ -1237,6 +1244,30 @@ namespace dxvk {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Config* findHashedProfile(const ProfileList& profiles, const std::string& appName) {
|
||||||
|
// Don't bother hashing exe names if we don't have
|
||||||
|
// any top-secret app profiles to begin with
|
||||||
|
if (profiles.empty())
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
auto n = appName.find_last_of('\\') + 1u;
|
||||||
|
|
||||||
|
if (n >= appName.size())
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
auto hash = Sha1Hash::compute(&appName[n], appName.size() - n).toString();
|
||||||
|
|
||||||
|
auto appConfig = std::find_if(profiles.begin(), profiles.end(),
|
||||||
|
[&hash] (const std::pair<const char*, Config>& pair) {
|
||||||
|
return hash == pair.first;
|
||||||
|
});
|
||||||
|
|
||||||
|
return appConfig != profiles.end()
|
||||||
|
? &appConfig->second
|
||||||
|
: nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool isWhitespace(char ch) {
|
static bool isWhitespace(char ch) {
|
||||||
return ch == ' ' || ch == '\x9' || ch == '\r';
|
return ch == ' ' || ch == '\x9' || ch == '\r';
|
||||||
}
|
}
|
||||||
|
@ -1494,6 +1525,9 @@ namespace dxvk {
|
||||||
if (!config)
|
if (!config)
|
||||||
config = findProfile(g_profiles, appName);
|
config = findProfile(g_profiles, appName);
|
||||||
|
|
||||||
|
if (!config)
|
||||||
|
config = findHashedProfile(g_hashedProfiles, appName);
|
||||||
|
|
||||||
if (config) {
|
if (config) {
|
||||||
// Inform the user that we loaded a default config
|
// Inform the user that we loaded a default config
|
||||||
Logger::info(str::format("Found built-in config:"));
|
Logger::info(str::format("Found built-in config:"));
|
||||||
|
|
Loading…
Add table
Reference in a new issue