mirror of
https://github.com/Orbmu2k/nvidiaProfileInspector.git
synced 2025-12-23 23:18:07 -05:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
985af53a27 | ||
|
|
c38992cd7c | ||
|
|
53ead6e9ef | ||
|
|
f35c4cda03 |
@@ -51,6 +51,11 @@ namespace nspector.Common
|
||||
return fiDbInstaller.DirectoryName;
|
||||
}
|
||||
|
||||
string sys32Path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), @"drivers\NVIDIA Corporation\Drs\dbInstaller.exe");
|
||||
|
||||
if (File.Exists(sys32Path))
|
||||
return sys32Path;
|
||||
|
||||
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
|
||||
@"NVIDIA Corporation\Drs");
|
||||
}
|
||||
|
||||
125
nspector/Common/Helper/DlssHelper.cs
Normal file
125
nspector/Common/Helper/DlssHelper.cs
Normal file
@@ -0,0 +1,125 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
|
||||
namespace nspector.Common.Helper
|
||||
{
|
||||
public class IniParser
|
||||
{
|
||||
public Dictionary<string, Dictionary<string, string>> Data { get; } = new();
|
||||
|
||||
public void Load(string filePath)
|
||||
{
|
||||
using var reader = new StreamReader(filePath);
|
||||
string? line;
|
||||
string? currentSection = null;
|
||||
|
||||
while ((line = reader.ReadLine()) != null)
|
||||
{
|
||||
line = line.Trim();
|
||||
|
||||
// Skip empty lines and comments
|
||||
if (string.IsNullOrEmpty(line) || line.StartsWith(";") || line.StartsWith("#"))
|
||||
continue;
|
||||
|
||||
// Section
|
||||
if (line.StartsWith("[") && line.EndsWith("]"))
|
||||
{
|
||||
currentSection = line.Substring(1, line.Length - 2).Trim();
|
||||
if (!Data.ContainsKey(currentSection))
|
||||
Data[currentSection] = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
// Key=Value
|
||||
else if (currentSection != null && line.Contains('='))
|
||||
{
|
||||
int idx = line.IndexOf('=');
|
||||
var key = line.Substring(0, idx).Trim();
|
||||
var value = line.Substring(idx + 1).Trim();
|
||||
Data[currentSection][key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string? GetValue(string section, string key)
|
||||
{
|
||||
if (Data.TryGetValue(section, out var sectionDict) &&
|
||||
sectionDict.TryGetValue(key, out var value))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<string> GetSections()
|
||||
{
|
||||
return Data.Keys.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public static class DlssHelper
|
||||
{
|
||||
private static Dictionary<string, Version> _ngxVersions = FetchVersions();
|
||||
|
||||
// Fetches latest versions installed in C:\ProgramData\NVIDIA\NGX\models\ folder
|
||||
private static Dictionary<string, Version> FetchVersions()
|
||||
{
|
||||
Dictionary<string, Version> versions = new Dictionary<string, Version>();
|
||||
|
||||
try
|
||||
{
|
||||
string ngxDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), @"NVIDIA\NGX\models\");
|
||||
string ngxConfigPath = Path.Combine(ngxDataPath, "nvngx_config.txt");
|
||||
if (!File.Exists(ngxConfigPath))
|
||||
return versions;
|
||||
|
||||
var ini = new IniParser();
|
||||
ini.Load(ngxConfigPath);
|
||||
|
||||
foreach (string section in ini.GetSections())
|
||||
{
|
||||
string versionStr = ini.GetValue(section, "app_E658700");
|
||||
if (string.IsNullOrEmpty(versionStr))
|
||||
continue;
|
||||
|
||||
Version ver = new Version(versionStr.Trim());
|
||||
|
||||
versions[section] = ver;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
versions.Clear();
|
||||
}
|
||||
|
||||
return versions;
|
||||
}
|
||||
|
||||
public static string GetSnippetLatestVersion(string snippet)
|
||||
{
|
||||
if (!_ngxVersions.ContainsKey(snippet))
|
||||
return "unknown";
|
||||
return "v" + _ngxVersions[snippet].ToString();
|
||||
}
|
||||
|
||||
public static string ReplaceDlssVersions(string str)
|
||||
{
|
||||
if (string.IsNullOrEmpty(str))
|
||||
return str;
|
||||
|
||||
if (str.Contains("${DlssVersion}"))
|
||||
str = str.Replace("${DlssVersion}", DlssHelper.GetSnippetLatestVersion("dlss").ToString());
|
||||
|
||||
if (str.Contains("${DlssgVersion}"))
|
||||
str = str.Replace("${DlssgVersion}", DlssHelper.GetSnippetLatestVersion("dlssg").ToString());
|
||||
|
||||
if (str.Contains("${DlssdVersion}"))
|
||||
str = str.Replace("${DlssdVersion}", DlssHelper.GetSnippetLatestVersion("dlssd").ToString());
|
||||
|
||||
return str;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ namespace nspector.Common.Helper
|
||||
|
||||
public bool ShowScannedUnknownSettings { get; set; } = false;
|
||||
|
||||
public List<string> HiddenSettingGroups { get; set; }
|
||||
public List<string> HiddenSettingGroups { get; set; } = new List<string>();
|
||||
|
||||
public bool DisableUpdateCheck { get; set; } = false;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using nspector.Native.NVAPI2;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using nspector.Common.Helper;
|
||||
|
||||
namespace nspector.Common.Meta
|
||||
{
|
||||
@@ -42,13 +43,19 @@ namespace nspector.Common.Meta
|
||||
}
|
||||
}
|
||||
|
||||
private string ProcessNameReplacements(string friendlyName)
|
||||
{
|
||||
// Apply string version replacements here before settings are fully loaded, so that string-to-value mappings can be preserved
|
||||
return DlssHelper.ReplaceDlssVersions(friendlyName);
|
||||
}
|
||||
|
||||
public string GetSettingName(uint settingId)
|
||||
{
|
||||
var setting = customSettings.Settings
|
||||
.FirstOrDefault(x => x.SettingId.Equals(settingId));
|
||||
|
||||
if (setting != null)
|
||||
return setting.UserfriendlyName;
|
||||
return ProcessNameReplacements(setting.UserfriendlyName);
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -86,7 +93,7 @@ namespace nspector.Common.Meta
|
||||
{
|
||||
ValuePos = i++,
|
||||
Value = x.SettingValue,
|
||||
ValueName = _source == SettingMetaSource.CustomSettings ? x.UserfriendlyName : DrsUtil.GetDwordString(x.SettingValue) + " " + x.UserfriendlyName,
|
||||
ValueName = _source == SettingMetaSource.CustomSettings ? ProcessNameReplacements(x.UserfriendlyName) : DrsUtil.GetDwordString(x.SettingValue) + " " + ProcessNameReplacements(x.UserfriendlyName),
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,13 +6,14 @@
|
||||
<HexSettingID>0x10E41E01</HexSettingID>
|
||||
<GroupName>5 - Common</GroupName>
|
||||
<MinRequiredDriverVersion>0</MinRequiredDriverVersion>
|
||||
<Description>If enabled, overrides DLSS with the latest global version installed (${DlssVersion}).\r\nNVIDIA periodically push OTA updates for the global version, though it often lags behind the actual latest available online.\r\nOnly DLSS2+ games support the global override, certain games may also disallow using it.</Description>
|
||||
<SettingValues>
|
||||
<CustomSettingValue>
|
||||
<UserfriendlyName>Off</UserfriendlyName>
|
||||
<HexValue>0x00000000</HexValue>
|
||||
</CustomSettingValue>
|
||||
<CustomSettingValue>
|
||||
<UserfriendlyName>On - DLSS overridden by latest available</UserfriendlyName>
|
||||
<UserfriendlyName>On - DLSS overridden by latest installed (${DlssVersion})</UserfriendlyName>
|
||||
<HexValue>0x00000001</HexValue>
|
||||
</CustomSettingValue>
|
||||
</SettingValues>
|
||||
@@ -23,13 +24,14 @@
|
||||
<HexSettingID>0x10E41E02</HexSettingID>
|
||||
<GroupName>5 - Common</GroupName>
|
||||
<MinRequiredDriverVersion>0</MinRequiredDriverVersion>
|
||||
<Description>If enabled, overrides DLSS-RR with the latest global version installed (${DlssdVersion}).\r\nNVIDIA periodically push OTA updates for the global version, though it often lags behind the actual latest available online.\r\nOnly DLSS2+ games support the global override, certain games may also disallow using it.</Description>
|
||||
<SettingValues>
|
||||
<CustomSettingValue>
|
||||
<UserfriendlyName>Off</UserfriendlyName>
|
||||
<HexValue>0x00000000</HexValue>
|
||||
</CustomSettingValue>
|
||||
<CustomSettingValue>
|
||||
<UserfriendlyName>On - DLSS-RR overridden by latest available</UserfriendlyName>
|
||||
<UserfriendlyName>On - DLSS-RR overridden by latest installed (${DlssdVersion})</UserfriendlyName>
|
||||
<HexValue>0x00000001</HexValue>
|
||||
</CustomSettingValue>
|
||||
</SettingValues>
|
||||
@@ -40,13 +42,14 @@
|
||||
<HexSettingID>0x10E41E03</HexSettingID>
|
||||
<GroupName>5 - Common</GroupName>
|
||||
<MinRequiredDriverVersion>0</MinRequiredDriverVersion>
|
||||
<Description>If enabled, overrides DLSS-FG with the latest global version installed (${DlssgVersion}).\r\nNVIDIA periodically push OTA updates for the global version, though it often lags behind the actual latest available online.\r\nOnly DLSS2+ games support the global override, certain games may also disallow using it.</Description>
|
||||
<SettingValues>
|
||||
<CustomSettingValue>
|
||||
<UserfriendlyName>Off</UserfriendlyName>
|
||||
<HexValue>0x00000000</HexValue>
|
||||
</CustomSettingValue>
|
||||
<CustomSettingValue>
|
||||
<UserfriendlyName>On - DLSS-FG overridden by latest available</UserfriendlyName>
|
||||
<UserfriendlyName>On - DLSS-FG overridden by latest installed (${DlssgVersion})</UserfriendlyName>
|
||||
<HexValue>0x00000001</HexValue>
|
||||
</CustomSettingValue>
|
||||
</SettingValues>
|
||||
@@ -156,7 +159,7 @@
|
||||
<HexValue>0x00000004</HexValue>
|
||||
</CustomSettingValue>
|
||||
<CustomSettingValue>
|
||||
<UserfriendlyName>Preset E (unused)</UserfriendlyName>
|
||||
<UserfriendlyName>Preset E</UserfriendlyName>
|
||||
<HexValue>0x00000005</HexValue>
|
||||
</CustomSettingValue>
|
||||
<CustomSettingValue>
|
||||
|
||||
2
nspector/frmDrvSettings.Designer.cs
generated
2
nspector/frmDrvSettings.Designer.cs
generated
@@ -570,6 +570,8 @@
|
||||
this.txtFilter.Location = new System.Drawing.Point(0, 0);
|
||||
this.txtFilter.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
this.txtFilter.Name = "txtFilter";
|
||||
this.txtFilter.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.None;
|
||||
this.txtFilter.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.None;
|
||||
this.txtFilter.Size = new System.Drawing.Size(2118, 35);
|
||||
this.txtFilter.TabIndex = 82;
|
||||
this.txtFilter.WatermarkText = "Search for setting...";
|
||||
|
||||
@@ -301,7 +301,7 @@ namespace nspector
|
||||
|
||||
var referenceSettings = DrsServiceLocator.ReferenceSettings?.Settings.FirstOrDefault(s => s.SettingId == settingid);
|
||||
|
||||
var description = settingMeta.Description;
|
||||
var description = DlssHelper.ReplaceDlssVersions(settingMeta.Description);
|
||||
if (!string.IsNullOrEmpty(settingMeta.AlternateNames))
|
||||
description = $"Alternate names: {settingMeta.AlternateNames}\r\n{description}";
|
||||
|
||||
@@ -313,7 +313,7 @@ namespace nspector
|
||||
}
|
||||
else
|
||||
{
|
||||
tbSettingDescription.Text = description;
|
||||
tbSettingDescription.Text = description.Replace("\\r\\n", "\r\n");
|
||||
tbSettingDescription.Visible = true;
|
||||
tbSettingDescription.BackColor = (referenceSettings?.HasConstraints ?? false) ? Color.LightCoral : SystemColors.Control;
|
||||
}
|
||||
|
||||
@@ -136,6 +136,7 @@
|
||||
<Compile Include="Common\DrsSessionScope.cs" />
|
||||
<Compile Include="Common\DrsSettingsMetaService.cs" />
|
||||
<Compile Include="Common\DrsUtil.cs" />
|
||||
<Compile Include="Common\Helper\DlssHelper.cs" />
|
||||
<Compile Include="Common\Helper\DropDownMenuScrollWheelHandler.cs" />
|
||||
<Compile Include="Common\Helper\GithubVersionHelper.cs" />
|
||||
<Compile Include="Common\Helper\ListViewGroupSorter.cs" />
|
||||
|
||||
Reference in New Issue
Block a user