mirror of
https://github.com/Orbmu2k/nvidiaProfileInspector.git
synced 2025-12-23 23:18:07 -05:00
Drs: implement Min/Max driver version checking
Will also hide most 3D vision settings on driver above 425.31 CTRL+ALT+D can be used to unhide version-checked settings
This commit is contained in:
@@ -15,6 +15,7 @@ namespace nspector.Common.CustomSettings
|
||||
public string GroupName { get; set; }
|
||||
public string OverrideDefault { get; set; }
|
||||
public float MinRequiredDriverVersion { get; set; }
|
||||
public float MaxRequiredDriverVersion { get; set; }
|
||||
public bool Hidden { get; set; }
|
||||
public bool HasConstraints { get; set; }
|
||||
public string DataType { get; set; }
|
||||
|
||||
@@ -421,7 +421,10 @@ namespace nspector.Common
|
||||
private bool GetIsSettingHidden(uint settingId)
|
||||
{
|
||||
var csnMeta = MetaServices.FirstOrDefault(m => m.Service.Source == SettingMetaSource.CustomSettings);
|
||||
return (csnMeta != null && ((CustomSettingMetaService)csnMeta.Service).IsSettingHidden(settingId));
|
||||
var refMeta = MetaServices.FirstOrDefault(m => m.Service.Source == SettingMetaSource.ReferenceSettings);
|
||||
|
||||
return (csnMeta != null && ((CustomSettingMetaService)csnMeta.Service).IsSettingHidden(settingId)) ||
|
||||
refMeta != null && ((CustomSettingMetaService)refMeta.Service).IsSettingHidden(settingId);
|
||||
}
|
||||
|
||||
private string GetDescription(uint settingId)
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace nspector.Common
|
||||
{
|
||||
internal abstract class DrsSettingsServiceBase
|
||||
{
|
||||
public static readonly float DriverVersion = GetDriverVersionInternal();
|
||||
|
||||
protected DrsSettingsMetaService meta;
|
||||
protected DrsDecrypterService decrypter;
|
||||
@@ -22,11 +23,9 @@ namespace nspector.Common
|
||||
{
|
||||
meta = metaService;
|
||||
decrypter = decrpterService;
|
||||
DriverVersion = GetDriverVersionInternal();
|
||||
}
|
||||
|
||||
public readonly float DriverVersion;
|
||||
private float GetDriverVersionInternal()
|
||||
private static float GetDriverVersionInternal()
|
||||
{
|
||||
float result = 0f;
|
||||
uint sysDrvVersion = 0;
|
||||
|
||||
@@ -126,6 +126,21 @@ namespace nspector.Common.Meta
|
||||
var setting = customSettings.Settings
|
||||
.FirstOrDefault(x => x.SettingId.Equals(settingId));
|
||||
|
||||
if (DrsSettingsServiceBase.DriverVersion > 0)
|
||||
{
|
||||
if (DrsSettingsServiceBase.DriverVersion > 425.31 && (settingId & 0xFF000000) == 0x70000000)
|
||||
return true; // 3D vision settings removed after 425.31
|
||||
|
||||
if (setting == null)
|
||||
return false;
|
||||
|
||||
if (setting.MinRequiredDriverVersion > 0 && setting.MinRequiredDriverVersion > DrsSettingsServiceBase.DriverVersion)
|
||||
return true;
|
||||
|
||||
if (setting.MaxRequiredDriverVersion > 0 && setting.MaxRequiredDriverVersion < DrsSettingsServiceBase.DriverVersion)
|
||||
return true;
|
||||
}
|
||||
|
||||
return setting?.Hidden ?? false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- NOTE: 3D Vision settings will be hidden from NVPI when using driver later than 425.31, CTRL+ALT+D can be used to unhide if needed. -->
|
||||
<CustomSettingNames>
|
||||
<Settings>
|
||||
<CustomSetting>
|
||||
@@ -1975,6 +1976,7 @@
|
||||
<Description/>
|
||||
<GroupName>8 - Extra</GroupName>
|
||||
<OverrideDefault>0x00000001</OverrideDefault>
|
||||
<MinRequiredDriverVersion>526.48</MinRequiredDriverVersion>
|
||||
<SettingValues>
|
||||
<CustomSettingValue>
|
||||
<UserfriendlyName>Off</UserfriendlyName>
|
||||
@@ -1992,6 +1994,7 @@
|
||||
<HexSettingID>0x10523DC0</HexSettingID>
|
||||
<Description/>
|
||||
<GroupName>8 - Extra</GroupName>
|
||||
<MaxRequiredDriverVersion>526.47</MaxRequiredDriverVersion>
|
||||
<SettingValues>
|
||||
<CustomSettingValue>
|
||||
<UserfriendlyName>Off</UserfriendlyName>
|
||||
@@ -3484,9 +3487,10 @@
|
||||
</CustomSetting>
|
||||
<CustomSetting>
|
||||
<UserfriendlyName>Antialiasing - Combined (Mode + Setting) (pre-526.47)</UserfriendlyName>
|
||||
<HexSettingID>0x100B8EDE</HexSettingID>
|
||||
<HexSettingID>0x100B8EDE</HexSettingID>
|
||||
<Description/>
|
||||
<GroupName>3 - Antialiasing</GroupName>
|
||||
<MaxRequiredDriverVersion>526.47</MaxRequiredDriverVersion>
|
||||
<SettingValues>
|
||||
<CustomSettingValue>
|
||||
<UserfriendlyName>Application-controlled / Off</UserfriendlyName>
|
||||
@@ -3804,6 +3808,7 @@
|
||||
<HexSettingID>0x10D7162F</HexSettingID>
|
||||
<Description/>
|
||||
<GroupName>3 - Antialiasing</GroupName>
|
||||
<MinRequiredDriverVersion>526.48</MinRequiredDriverVersion>
|
||||
<SettingValues>
|
||||
<CustomSettingValue>
|
||||
<UserfriendlyName>Application-controlled / Off</UserfriendlyName>
|
||||
@@ -4264,6 +4269,7 @@
|
||||
<HexSettingID>0x10F74257</HexSettingID>
|
||||
<Description/>
|
||||
<GroupName>4 - Texture Filtering</GroupName>
|
||||
<MaxRequiredDriverVersion>526.47</MaxRequiredDriverVersion>
|
||||
<SettingValues>
|
||||
<CustomSettingValue>
|
||||
<UserfriendlyName>Application-controlled</UserfriendlyName>
|
||||
@@ -4313,6 +4319,7 @@
|
||||
<HexSettingID>0x10E30043</HexSettingID>
|
||||
<Description/>
|
||||
<GroupName>4 - Texture Filtering</GroupName>
|
||||
<MinRequiredDriverVersion>526.48</MinRequiredDriverVersion>
|
||||
<SettingValues>
|
||||
<CustomSettingValue>
|
||||
<UserfriendlyName>Application-controlled</UserfriendlyName>
|
||||
|
||||
@@ -82,6 +82,8 @@ namespace nspector
|
||||
var group = FindOrCreateGroup(setting.GroupName);
|
||||
|
||||
var settingName = isDevMode ? $"0x{setting.SettingId:X8} {setting.SettingText}" : setting.SettingText;
|
||||
if (setting.IsSettingHidden)
|
||||
settingName = "[H] " + settingName;
|
||||
|
||||
var item = new ListViewItem(settingName);
|
||||
item.Tag = setting.SettingId;
|
||||
@@ -158,7 +160,7 @@ namespace nspector
|
||||
|
||||
foreach (var settingItem in _currentProfileSettingItems)
|
||||
{
|
||||
if (settingItem.IsSettingHidden) continue;
|
||||
if (settingItem.IsSettingHidden && !isDevMode) continue;
|
||||
|
||||
var itm = lvSettings.Items.Add(CreateListViewItem(settingItem));
|
||||
if (Debugger.IsAttached && !settingItem.IsApiExposed)
|
||||
@@ -516,7 +518,7 @@ namespace nspector
|
||||
var version = Assembly.GetExecutingAssembly().GetName().Version;
|
||||
var fileVersionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
|
||||
var externalCsn = DrsServiceLocator.IsExternalCustomSettings ? " - CSN OVERRIDE!" : "";
|
||||
Text = $"{Application.ProductName} {version} - Geforce {_drs.DriverVersion.ToString("#.00", numberFormat)} - Profile Settings - {fileVersionInfo.LegalCopyright}{externalCsn}";
|
||||
Text = $"{Application.ProductName} {version} - Geforce {DrsSettingsServiceBase.DriverVersion.ToString("#.00", numberFormat)} - Profile Settings - {fileVersionInfo.LegalCopyright}{externalCsn}";
|
||||
}
|
||||
|
||||
private static void InitMessageFilter(IntPtr handle)
|
||||
@@ -714,8 +716,6 @@ namespace nspector
|
||||
|
||||
private void ChangeCurrentProfile(string profileName)
|
||||
{
|
||||
txtFilter.Text = "";
|
||||
|
||||
if (profileName == GetBaseProfileName() || profileName == _baseProfileName)
|
||||
{
|
||||
_CurrentProfile = _baseProfileName;
|
||||
@@ -734,6 +734,8 @@ namespace nspector
|
||||
appPathsTooltip.SetToolTip(lblApplications, "Double-click to add application");
|
||||
}
|
||||
|
||||
txtFilter.Text = "";
|
||||
|
||||
RefreshCurrentProfile();
|
||||
}
|
||||
|
||||
@@ -998,7 +1000,7 @@ namespace nspector
|
||||
}
|
||||
else if (MessageBox.Show(this, "Really delete this profile?\r\n\r\nNote: NVIDIA predefined profiles can not be restored until next driver installation!", "Delete Profile", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
|
||||
{
|
||||
if (_drs.DriverVersion > 280 && _drs.DriverVersion < 310)
|
||||
if (DrsSettingsServiceBase.DriverVersion > 280 && DrsSettingsServiceBase.DriverVersion < 310)
|
||||
// hack for driverbug
|
||||
_drs.DeleteProfileHard(_CurrentProfile);
|
||||
else
|
||||
@@ -1378,7 +1380,7 @@ namespace nspector
|
||||
|
||||
else if (e.Control && e.Alt && e.KeyCode == Keys.D)
|
||||
{
|
||||
EnableDevmode();
|
||||
ToggleDevMode();
|
||||
}
|
||||
|
||||
else if (Debugger.IsAttached && e.Control && e.KeyCode == Keys.T)
|
||||
@@ -1445,15 +1447,25 @@ namespace nspector
|
||||
{
|
||||
RefreshCurrentProfile();
|
||||
|
||||
txtFilter.Focus(); // Setting listbox sometimes steals focus away
|
||||
if(!string.IsNullOrEmpty(txtFilter.Text))
|
||||
txtFilter.Focus(); // Setting listbox sometimes steals focus away
|
||||
}
|
||||
|
||||
private void EnableDevmode()
|
||||
private void ToggleDevMode()
|
||||
{
|
||||
isDevMode = true;
|
||||
lvSettings.Font = new Font("Consolas", 9);
|
||||
cbValues.Font = new Font("Consolas", 9);
|
||||
lvSettings.HeaderStyle = ColumnHeaderStyle.Nonclickable;
|
||||
isDevMode = !isDevMode;
|
||||
if (isDevMode)
|
||||
{
|
||||
lvSettings.Font = new Font("Consolas", 9);
|
||||
cbValues.Font = new Font("Consolas", 9);
|
||||
lvSettings.HeaderStyle = ColumnHeaderStyle.Nonclickable;
|
||||
}
|
||||
else
|
||||
{
|
||||
lvSettings.Font = null;
|
||||
cbValues.Font = null;
|
||||
lvSettings.HeaderStyle = ColumnHeaderStyle.None;
|
||||
}
|
||||
RefreshCurrentProfile();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user