Compare commits

..

10 Commits

Author SHA1 Message Date
Orbmu2k
9adc3b9cb9 #38 enable wheel scrolling in toolstrip dropdownmenu & cleanups 2020-01-13 20:06:59 +01:00
Orbmu2k
57a8879a2c added ShowCustomizedSettingNamesOnly & ShowScannedUnknownSettings to user settings 2020-01-12 15:46:04 +01:00
Orbmu2k
c47e69d81c moved CFR setting to SLI group 2020-01-12 15:36:48 +01:00
Orbmu2k
21674d3f09 use hex settingnames only as fallback even if the setting source priority is higher 2020-01-12 14:59:09 +01:00
Orbmu2k
b5a13cf6fe migrated 3dvision setting names to reference.xml 2020-01-12 14:50:33 +01:00
Orbmu2k
c222cf1b06 further optimized unified scan for modified profiles 2020-01-12 14:28:59 +01:00
Orbmu2k
6d3237bfeb unified scan to a single run for better startup time #41 2020-01-12 14:20:22 +01:00
Orbmu2k
5dbb8ef721 fixed profiles counter for 3d vision settings 2020-01-12 00:36:00 +01:00
Orbmu2k
fcd9ef5346 merge 2020-01-11 13:46:18 +01:00
Orbmu2k
67bb397b6a fixed readme 2020-01-11 13:42:52 +01:00
47 changed files with 1349 additions and 557 deletions

View File

@@ -8,4 +8,4 @@ For more information how to use this tool, you can find some very good wikis her
* https://wiki.step-project.com/Guide:NVIDIA_Inspector
* https://www.pcgamingwiki.com/wiki/Nvidia_Profile_Inspector
![screenshot](/npi_screenhshot.png)
![](npi_screenshot.png)

View File

Before

Width:  |  Height:  |  Size: 109 KiB

After

Width:  |  Height:  |  Size: 109 KiB

View File

@@ -6,7 +6,7 @@ namespace nspector.Common
internal class CachedSettingValue
{
internal CachedSettingValue() { }
internal CachedSettingValue() { }
internal CachedSettingValue(uint Value, string ProfileNames)
{

View File

@@ -6,14 +6,14 @@ namespace nspector.Common
{
internal class CachedSettings
{
internal CachedSettings() { }
internal CachedSettings() { }
internal CachedSettings(uint settingId, NVDRS_SETTING_TYPE settingType)
{
SettingId = settingId;
SettingType = settingType;
}
internal uint SettingId;
internal List<CachedSettingValue> SettingValues = new List<CachedSettingValue>();
@@ -21,7 +21,7 @@ namespace nspector.Common
internal uint ProfileCount = 0;
internal NVDRS_SETTING_TYPE SettingType = NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE;
internal void AddDwordValue(uint valueDword, string Profile)
{
var setting = SettingValues.FirstOrDefault(s => s.Value == valueDword);

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Xml.Serialization;
namespace nspector.Common.CustomSettings

View File

@@ -8,8 +8,6 @@ namespace nspector.Common.CustomSettings
[Serializable]
public class CustomSettingNames
{
public bool ShowCustomizedSettingNamesOnly = false;
public List<CustomSetting> Settings = new List<CustomSetting>();
public void StoreToFile(string filename)

View File

@@ -1,5 +1,4 @@
using System;
using System.Globalization;
namespace nspector.Common.CustomSettings
{

View File

@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Policy;
using System.Text;
using nspector.Common.Import;
using nspector.Native.NVAPI2;
@@ -18,8 +17,8 @@ namespace nspector.Common
private readonly DrsDecrypterService _DecrypterService;
public DrsImportService(
DrsSettingsMetaService metaService,
DrsSettingsService settingService,
DrsSettingsMetaService metaService,
DrsSettingsService settingService,
DrsScannerService scannerService,
DrsDecrypterService decrypterService)
: base(metaService)
@@ -77,7 +76,7 @@ namespace nspector.Common
{
result.Executeables.Add(app.appName);
}
var settings = GetProfileSettings(hSession, hProfile);
foreach (var setting in settings)
{
@@ -239,7 +238,7 @@ namespace nspector.Common
var decryptedSetting = setting;
_DecrypterService.DecryptSettingIfNeeded(profileName, ref decryptedSetting);
if (isPredefined && exitsValueInImport && ImportExportUitl.AreDrsSettingEqualToProfileSetting(decryptedSetting, importSetting))
if (isPredefined && exitsValueInImport && ImportExportUitl.AreDrsSettingEqualToProfileSetting(decryptedSetting, importSetting))
{
alreadySet.Add(setting.settingId);
}

View File

@@ -63,7 +63,7 @@ namespace nspector.Common
checkedSettingsCount++;
AddScannedSettingToCache(profile, setting);
alreadyCheckedSettingIds.Add(setting.settingId);
return true;
return (setting.isCurrentPredefined != 1);
}
else if (setting.isCurrentPredefined != 1)
{
@@ -79,11 +79,10 @@ namespace nspector.Common
return (current > 0) ? (int)Math.Round((current * 100f) / max) : 0; ;
}
public async Task ScanForModifiedProfilesAsync(IProgress<int> progress, CancellationToken token = default(CancellationToken))
public async Task ScanProfileSettingsAsync(bool justModified, IProgress<int> progress, CancellationToken token = default(CancellationToken))
{
await Task.Run(() =>
{
ModifiedProfiles = new List<string>();
UserProfiles = new HashSet<string>();
var knownPredefines = new List<uint>(_commonSettingIds);
@@ -105,100 +104,33 @@ namespace nspector.Common
var profile = GetProfileInfo(hSession, hProfile);
int checkedSettingsCount = 0;
bool foundModifiedProfile = false;
var alreadyChecked = new List<uint>();
bool foundModifiedProfile = false;
if (profile.isPredefined == 0)
{
ModifiedProfiles.Add(profile.profileName);
UserProfiles.Add(profile.profileName);
continue;
foundModifiedProfile = true;
if (justModified) continue;
}
if ((hBaseProfile == hProfile || profile.numOfApps > 0) && profile.numOfSettings > 0)
{
var alreadyChecked = new List<uint>();
foreach (uint settingId in knownPredefines)
{
if (CheckCommonSetting(hSession, hProfile, profile,
ref checkedSettingsCount, settingId, false, ref alreadyChecked))
{
foundModifiedProfile = true;
ModifiedProfiles.Add(profile.profileName);
break;
}
}
// the detection if only applications has changed in a profile makes the scan process very slow, we leave it out!
//if (!foundModifiedProfile && profile.numOfApps > 0)
//{
// var apps = GetProfileApplications(hSession, hProfile);
// foreach (var app in apps)
// {
// if (app.isPredefined == 0)
// {
// foundModifiedProfile = true;
// ModifiedProfiles.Add(profile.profileName);
// break;
// }
// }
//}
if (foundModifiedProfile || checkedSettingsCount >= profile.numOfSettings)
continue;
var settings = GetProfileSettings(hSession, hProfile);
foreach (var setting in settings)
{
if (knownPredefines.IndexOf(setting.settingId) < 0)
knownPredefines.Add(setting.settingId);
if (setting.isCurrentPredefined != 1)
{
ModifiedProfiles.Add(profile.profileName);
break;
}
}
}
}
});
});
}
public async Task ScanForPredefinedProfileSettingsAsync(IProgress<int> progress, CancellationToken token = default(CancellationToken))
{
await Task.Run(() =>
{
var knownPredefines = new List<uint>(_commonSettingIds);
DrsSession((hSession) =>
{
var profileHandles = EnumProfileHandles(hSession);
var maxProfileCount = profileHandles.Count;
int curProfilePos = 0;
foreach (IntPtr hProfile in profileHandles)
{
if (token.IsCancellationRequested) break;
progress?.Report(CalcPercent(curProfilePos++, maxProfileCount));
var profile = GetProfileInfo(hSession, hProfile);
int checkedSettingsCount = 0;
var alreadyChecked = new List<uint>();
foreach (uint kpd in knownPredefines)
{
CheckCommonSetting(hSession, hProfile, profile,
ref checkedSettingsCount, kpd, true, ref alreadyChecked);
if (CheckCommonSetting(hSession, hProfile, profile,
ref checkedSettingsCount, kpd, !justModified, ref alreadyChecked))
{
if (!foundModifiedProfile)
{
foundModifiedProfile = true;
ModifiedProfiles.Add(profile.profileName);
if (justModified) break;
}
}
}
if (checkedSettingsCount >= profile.numOfSettings)
if ((foundModifiedProfile && justModified) || checkedSettingsCount >= profile.numOfSettings)
continue;
var settings = GetProfileSettings(hSession, hProfile);
@@ -207,8 +139,18 @@ namespace nspector.Common
if (knownPredefines.IndexOf(setting.settingId) < 0)
knownPredefines.Add(setting.settingId);
if (alreadyChecked.IndexOf(setting.settingId) < 0)
if (!justModified && alreadyChecked.IndexOf(setting.settingId) < 0)
AddScannedSettingToCache(profile, setting);
if (setting.isCurrentPredefined != 1)
{
if (!foundModifiedProfile)
{
foundModifiedProfile = true;
ModifiedProfiles.Add(profile.profileName);
if (justModified) break;
}
}
}
}
});
@@ -245,6 +187,8 @@ namespace nspector.Common
else if (setting.settingType == NVDRS_SETTING_TYPE.NVDRS_BINARY_TYPE)
cachedSetting.AddBinaryValue(setting.predefinedValue.binaryValue, profile.profileName);
}
else
cachedSetting.ProfileCount++;
if (!cacheEntryExists)
CachedSettings.Add(cachedSetting);

View File

@@ -1,15 +1,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.IO;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
using nspector.Common.CustomSettings;
using nvw = nspector.Native.NVAPI2.NvapiDrsWrapper;
namespace nspector.Common
{
internal class DrsServiceLocator
@@ -53,6 +45,6 @@ namespace nspector.Common
return null;
}
}
}

View File

@@ -31,7 +31,7 @@ namespace nspector.Common
if (csRes != NvAPI_Status.NVAPI_OK)
throw new NvapiException("DRS_CreateSession", csRes);
if (!preventLoadSettings)
{
var nvRes = nvw.DRS_LoadSettings(GlobalSession);

View File

@@ -1,24 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using nspector.Common.Meta;
using nspector.Common.CustomSettings;
using nspector.Native.NVAPI2;
using nspector.Native.NvApi.DriverSettings;
namespace nspector.Common
{
internal class DrsSettingsMetaService
{
private ISettingMetaService ConstantMeta;
private ISettingMetaService CustomMeta;
public ISettingMetaService DriverMeta;
private ISettingMetaService ScannedMeta;
private ISettingMetaService ReferenceMeta;
private ISettingMetaService NvD3dUmxMeta;
private readonly CustomSettingNames _customSettings;
private readonly CustomSettingNames _referenceSettings;
@@ -39,7 +35,7 @@ namespace nspector.Common
{
settingMetaCache = new Dictionary<uint, SettingMeta>();
MetaServices = new List<MetaServiceItem>();
CustomMeta = new CustomSettingMetaService(_customSettings);
MetaServices.Add(new MetaServiceItem() { ValueNamePrio = 1, Service = CustomMeta });
@@ -62,13 +58,10 @@ namespace nspector.Common
ReferenceMeta = new CustomSettingMetaService(_referenceSettings, SettingMetaSource.ReferenceSettings);
MetaServices.Add(new MetaServiceItem() { ValueNamePrio = 4, Service = ReferenceMeta });
}
NvD3dUmxMeta = new NvD3dUmxSettingMetaService();
MetaServices.Add(new MetaServiceItem() { ValueNamePrio = 6, Service = NvD3dUmxMeta });
}
}
private NVDRS_SETTING_TYPE? GetSettingValueType(uint settingId)
{
foreach (var service in MetaServices.OrderBy(x => x.Service.Source))
@@ -80,16 +73,26 @@ namespace nspector.Common
return NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE;
}
private string GetSettingName(uint settingId)
{
foreach (var service in MetaServices.OrderBy(x=>x.Service.Source))
string hexCandidate = null;
foreach (var service in MetaServices.OrderBy(x => x.Service.Source))
{
var settingName = service.Service.GetSettingName(settingId);
if (settingName != null)
if (!string.IsNullOrEmpty(settingName))
{
if (settingName.StartsWith("0x"))
{
hexCandidate = settingName;
continue;
}
return settingName;
}
}
return null;
return hexCandidate;
}
private string GetGroupName(uint settingId)
@@ -123,7 +126,7 @@ namespace nspector.Common
if (settingDefault != null)
return settingDefault;
}
return null;
}
@@ -153,7 +156,7 @@ namespace nspector.Common
else
{
var currentNonScannedValues = a.Where(xa => xa.ValueSource != SettingMetaSource.ScannedSettings).Select(xa => xa.Value).ToList();
var newNonScannedValues = b.Where(xb => !currentNonScannedValues.Contains(xb.Value)).ToList();
a.AddRange(newNonScannedValues);
@@ -171,7 +174,7 @@ namespace nspector.Common
var atmp = a.FirstOrDefault();
if (atmp != null && atmp is IComparable)
return a.OrderBy(x=>x.Value).ToList();
return a.OrderBy(x => x.Value).ToList();
else
return a.ToList();
}
@@ -196,7 +199,7 @@ namespace nspector.Common
{
result = MergeSettingValues(result, service.Service.GetStringValues(settingId));
}
return result;
}
@@ -211,15 +214,15 @@ namespace nspector.Common
if (result != null)
{
result = (from v in result.Where(x=> 1==1
result = (from v in result.Where(x => 1 == 1
&& !x.ValueName.EndsWith("_NUM")
&& !x.ValueName.EndsWith("_MASK")
&& (!x.ValueName.EndsWith("_MIN") || x.ValueName.Equals("PREFERRED_PSTATE_PREFER_MIN"))
&& (!x.ValueName.EndsWith("_MAX") || x.ValueName.Equals("PREFERRED_PSTATE_PREFER_MAX"))
)
group v by v.ValueName into g
select g.First(t => t.ValueName == g.Key))
)
group v by v.ValueName into g
select g.First(t => t.ValueName == g.Key))
.OrderBy(v => v.ValueSource)
.ThenBy(v => v.ValuePos)
.ThenBy(v => v.ValueName).ToList();
@@ -228,7 +231,7 @@ namespace nspector.Common
return result;
}
public List<uint> GetSettingIds(SettingViewMode viewMode)
{
var settingIds = new List<uint>();
@@ -249,22 +252,21 @@ namespace nspector.Common
switch (viewMode)
{
case SettingViewMode.CustomSettingsOnly:
return new [] {
SettingMetaSource.CustomSettings
return new[] {
SettingMetaSource.CustomSettings
};
case SettingViewMode.IncludeScannedSetttings:
return new [] {
return new[] {
SettingMetaSource.ConstantSettings,
SettingMetaSource.ScannedSettings,
SettingMetaSource.CustomSettings,
SettingMetaSource.ScannedSettings,
SettingMetaSource.CustomSettings,
SettingMetaSource.DriverSettings,
SettingMetaSource.NvD3dUmxSettings,
SettingMetaSource.ReferenceSettings,
};
default:
return new [] {
SettingMetaSource.CustomSettings,
SettingMetaSource.DriverSettings,
return new[] {
SettingMetaSource.CustomSettings,
SettingMetaSource.DriverSettings,
};
}
}
@@ -284,7 +286,6 @@ namespace nspector.Common
SettingMetaSource.ScannedSettings,
SettingMetaSource.CustomSettings,
SettingMetaSource.DriverSettings,
SettingMetaSource.NvD3dUmxSettings,
SettingMetaSource.ReferenceSettings,
};
@@ -296,7 +297,7 @@ namespace nspector.Common
var settingType = GetSettingValueType(settingId);
var settingName = GetSettingName(settingId);
var groupName = GetGroupName(settingId);
if (groupName == null)
groupName = GetLegacyGroupName(settingId, settingName);
@@ -306,11 +307,11 @@ namespace nspector.Common
SettingName = settingName,
GroupName = groupName,
DefaultDwordValue =
settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE
DefaultDwordValue =
settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE
? GetDwordDefaultValue(settingId) : 0,
DefaultStringValue =
DefaultStringValue =
settingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE
? GetStringDefaultValue(settingId) : null,

View File

@@ -1,12 +1,9 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using nspector.Common.Helper;
using nspector.Common.Meta;
using nspector.Native.NVAPI2;
@@ -46,14 +43,14 @@ namespace nspector.Common
if (!fiDbInstaller.Exists) continue;
var fviDbInstaller = FileVersionInfo.GetVersionInfo(fiDbInstaller.FullName);
var fileversion = fviDbInstaller.FileVersion.Replace(".", "");
var driverver = DriverVersion.ToString().Replace(",","").Replace(".","");
var driverver = DriverVersion.ToString().Replace(",", "").Replace(".", "");
if (fileversion.EndsWith(driverver))
return fiDbInstaller.DirectoryName;
}
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
@"NVIDIA Corporation\Drs");
}
@@ -78,13 +75,13 @@ namespace nspector.Common
var tmpFile = TempFile.GetTempFileName();
try
{
File.WriteAllText(tmpFile, "BaseProfile \"Base Profile\"\r\nProfile \"Base Profile\"\r\nShowOn All\r\nProfileType Global\r\nEndProfile\r\n");
File.WriteAllText(tmpFile, "BaseProfile \"Base Profile\"\r\nSelectedGlobalProfile \"Base Profile\"\r\nProfile \"Base Profile\"\r\nShowOn All\r\nProfileType Global\r\nEndProfile\r\n");
DrsSession((hSession) =>
{
LoadSettingsFileEx(hSession, tmpFile);
SaveSettings(hSession);
});
}, forceNonGlobalSession: true, preventLoadSettings: true);
}
finally
{
@@ -137,13 +134,13 @@ namespace nspector.Common
var nvRes = nvw.DRS_DeleteProfile(hSession, hProfile);
if (nvRes != NvAPI_Status.NVAPI_OK)
throw new NvapiException("DRS_DeleteProfile", nvRes);
SaveSettings(hSession);
}
});
}
public List<string> GetProfileNames(ref string baseProfileName)
{
var lstResult = new List<string>();
@@ -154,7 +151,7 @@ namespace nspector.Common
var hBase = GetProfileHandle(hSession, null);
var baseProfile = GetProfileInfo(hSession, hBase);
tmpBaseProfileName = baseProfile.profileName;
lstResult.Add("_GLOBAL_DRIVER_PROFILE (" + tmpBaseProfileName + ")");
var profileHandles = EnumProfileHandles(hSession);
@@ -178,7 +175,7 @@ namespace nspector.Common
DrsSession((hSession) =>
{
var hProfile = CreateProfile(hSession, profileName);
if (applicationName != null)
AddApplication(hSession, hProfile, applicationName);
@@ -255,7 +252,7 @@ namespace nspector.Common
var nvRes = nvw.DRS_RestoreProfileDefaultSetting(hSession, hProfile, settingId);
if (nvRes != NvAPI_Status.NVAPI_OK)
throw new NvapiException("DRS_RestoreProfileDefaultSetting", nvRes);
SaveSettings(hSession);
var modifyCount = 0;
@@ -282,7 +279,7 @@ namespace nspector.Common
var hProfile = GetProfileHandle(hSession, profileName);
var dwordValue = ReadDwordValue(hSession, hProfile, settingId);
if (dwordValue != null)
return dwordValue.Value;
else if (returnDefaultValue)
@@ -302,7 +299,7 @@ namespace nspector.Common
});
}
public int StoreSettingsToProfile(string profileName, List<KeyValuePair<uint,string>> settings)
public int StoreSettingsToProfile(string profileName, List<KeyValuePair<uint, string>> settings)
{
DrsSession((hSession) =>
{
@@ -335,7 +332,7 @@ namespace nspector.Common
return 0;
}
private SettingItem CreateSettingItem(NVDRS_SETTING setting, bool useDefault = false)
{
@@ -447,7 +444,7 @@ namespace nspector.Common
IsStringValue = settingMeta.SettingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE,
};
}
public List<SettingItem> GetSettingsForProfile(string profileName, SettingViewMode viewMode, ref Dictionary<string, string> applications)
{
@@ -459,7 +456,7 @@ namespace nspector.Common
applications = DrsSession((hSession) =>
{
var hProfile = GetProfileHandle(hSession, profileName);
var profileSettings = GetProfileSettings(hSession, hProfile);
foreach (var profileSetting in profileSettings)
{
@@ -482,11 +479,11 @@ namespace nspector.Common
}
return GetProfileApplications(hSession, hProfile)
.Select(x => Tuple.Create(x.appName,GetApplicationFingerprint(x))).ToDictionary(x=> x.Item2, x=> x.Item1);
.Select(x => Tuple.Create(x.appName, GetApplicationFingerprint(x))).ToDictionary(x => x.Item2, x => x.Item1);
});
return result.OrderBy(x=>x.SettingText).ThenBy(x=>x.GroupName).ToList();
return result.OrderBy(x => x.SettingText).ThenBy(x => x.GroupName).ToList();
}
public void AddApplication(string profileName, string applicationName)
@@ -519,7 +516,7 @@ namespace nspector.Common
{
return $"{application.appName}|{application.fileInFolder}|{application.userFriendlyName}|{application.launcher}";
}
}
}

View File

@@ -262,7 +262,7 @@ namespace nspector.Common
protected List<NVDRS_SETTING> GetProfileSettings(IntPtr hSession, IntPtr hProfile)
{
uint settingCount = 512;
var settings = new NVDRS_SETTING[512];
var settings = new NVDRS_SETTING[settingCount];
settings[0].version = NvapiDrsWrapper.NVDRS_SETTING_VER;
var esRes = NvapiDrsWrapper.DRS_EnumSettings(hSession, hProfile, 0, ref settingCount, ref settings);

View File

@@ -1,16 +1,14 @@
using nspector.Common.Meta;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
namespace nspector.Common
{
public static class DrsUtil
{
public static string StringValueRaw = "Text";
public static string GetDwordString(uint dword)
{
return string.Format("0x{0:X8}", dword);
@@ -50,7 +48,7 @@ namespace nspector.Common
var settingValue = meta.DwordValues
.FirstOrDefault(x => x.Value.Equals(dwordValue));
return settingValue == null ? GetDwordString(dwordValue): settingValue.ValueName;
return settingValue == null ? GetDwordString(dwordValue) : settingValue.ValueName;
}
internal static string ParseStringSettingValue(SettingMeta meta, string text)

View File

@@ -9,9 +9,9 @@ namespace nspector.Common.Helper
{
var identity = WindowsIdentity.GetCurrent();
var principal = new WindowsPrincipal(identity);
isAdmin = principal.IsInRole(WindowsBuiltInRole.Administrator);
isAdmin = principal.IsInRole(WindowsBuiltInRole.Administrator);
}
public static bool IsAdmin
{
get { return isAdmin; }

View File

@@ -0,0 +1,82 @@
using System;
using System.Windows.Forms;
namespace nspector.Common.Helper
{
//by Bryce Wagner https://stackoverflow.com/questions/13139074/mouse-wheel-scrolling-toolstrip-menu-items
public class DropDownMenuScrollWheelHandler : IMessageFilter
{
private static DropDownMenuScrollWheelHandler Instance;
public static void Enable(bool enabled)
{
if (enabled)
{
if (Instance == null)
{
Instance = new DropDownMenuScrollWheelHandler();
Application.AddMessageFilter(Instance);
}
}
else
{
if (Instance != null)
{
Application.RemoveMessageFilter(Instance);
Instance = null;
}
}
}
private IntPtr activeHwnd;
private ToolStripDropDown activeMenu;
public bool PreFilterMessage(ref Message m)
{
if (m.Msg == 0x200 && activeHwnd != m.HWnd) // WM_MOUSEMOVE
{
activeHwnd = m.HWnd;
this.activeMenu = Control.FromHandle(m.HWnd) as ToolStripDropDown;
}
else if (m.Msg == 0x20A && this.activeMenu != null) // WM_MOUSEWHEEL
{
int delta = (short)(ushort)(((uint)(ulong)m.WParam) >> 16);
HandleDelta(this.activeMenu, delta);
return true;
}
return false;
}
private static readonly Action<ToolStrip, int> ScrollInternal
= (Action<ToolStrip, int>)Delegate.CreateDelegate(typeof(Action<ToolStrip, int>),
typeof(ToolStrip).GetMethod("ScrollInternal",
System.Reflection.BindingFlags.NonPublic
| System.Reflection.BindingFlags.Instance));
private void HandleDelta(ToolStripDropDown ts, int delta)
{
if (ts.Items.Count == 0)
return;
var firstItem = ts.Items[0];
var lastItem = ts.Items[ts.Items.Count - 1];
if (lastItem.Bounds.Bottom < ts.Height && firstItem.Bounds.Top > 0)
return;
delta = delta / -4;
if (delta < 0 && firstItem.Bounds.Top - delta > 9)
{
delta = firstItem.Bounds.Top - 9;
}
else if (delta > 0 && delta > lastItem.Bounds.Bottom - ts.Height + 9)
{
delta = lastItem.Bounds.Bottom - ts.Height + 9;
}
if (delta != 0)
ScrollInternal(ts, delta);
}
}
}

View File

@@ -17,7 +17,7 @@ namespace nspector.Common.Helper
var buttonCancel = new Button();
var imageBox = new PictureBox();
EventHandler textchanged = delegate(object sender, EventArgs e)
EventHandler textchanged = delegate (object sender, EventArgs e)
{
bool mandatory_success = Regex.IsMatch(textBox.Text, mandatoryFormatRegExPattern);

View File

@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using System.Windows.Forms;
namespace nspector.Common.Helper

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.IO;
using nspector.Native.WINAPI;
namespace nspector.Common.Helper

View File

@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Microsoft.Win32;
@@ -36,7 +35,7 @@ namespace nspector.Common.Helper
if (steamPath != null)
return Path.Combine(steamPath, @"appcache\appinfo.vdf");
}
return "";
}
@@ -90,7 +89,7 @@ namespace nspector.Common.Helper
var bid = BitConverter.GetBytes(appid);
int offset = 0;
var appidPattern = new byte[] { 0x08, bid[0], bid[1], bid[2], bid[3] };
var launchPattern = new byte[] { 0x00, 0x6C, 0x61, 0x75, 0x6E, 0x63, 0x68, 0x00 };
@@ -157,7 +156,7 @@ namespace nspector.Common.Helper
}
}
}
private static int FindOffset(byte[] bytes, byte[] pattern, int offset = 0, byte? wildcard = null)
{
for (int i = offset; i < bytes.Length; i++)

View File

@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace nspector.Common.Helper
{
@@ -16,7 +12,7 @@ namespace nspector.Common.Helper
var tempFile = GenerateTempFileName();
if (!File.Exists(tempFile))
return tempFile;
}
}
}
private static string GenerateTempFileName()

View File

@@ -17,11 +17,15 @@ namespace nspector.Common.Helper
public FormWindowState WindowState { get; set; }
public bool ShowCustomizedSettingNamesOnly { get; set; } = false;
public bool ShowScannedUnknownSettings { get; set; } = false;
private static string GetSettingsFilename()
{
var fiPortalbleSettings = new FileInfo("settings.xml");
if (fiPortalbleSettings.Exists) return fiPortalbleSettings.FullName;
var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), Application.ProductName);
if (!Directory.Exists(path)) Directory.CreateDirectory(path);
return Path.Combine(path, "settings.xml"); ;

View File

@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using nspector.Native.NVAPI2;
namespace nspector.Common.Import

View File

@@ -10,7 +10,7 @@ namespace nspector.Common.Import
[XmlElement(ElementName = "SettingID")]
public uint SettingId = 0;
public string SettingValue = "0";
public SettingValueType ValueType = SettingValueType.Dword;

View File

@@ -1,6 +1,6 @@
namespace nspector.Common.Import
{
public enum SettingValueType: int
public enum SettingValueType : int
{
Dword,
AnsiString,

View File

@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using nspector.Native.NvApi.DriverSettings;
using nspector.Native.NVAPI2;
@@ -19,7 +18,7 @@ namespace nspector.Common.Meta
private readonly Dictionary<ESetting, Type> settingEnumTypeCache;
private string[] ignoreSettingNames = new[] { "TOTAL_DWORD_SETTING_NUM", "TOTAL_WSTRING_SETTING_NUM",
private string[] ignoreSettingNames = new[] { "TOTAL_DWORD_SETTING_NUM", "TOTAL_WSTRING_SETTING_NUM",
"TOTAL_SETTING_NUM", "INVALID_SETTING_ID" };
private Dictionary<ESetting, Type> CreateSettingEnumTypeCache()

View File

@@ -1,9 +1,7 @@
using nspector.Common.CustomSettings;
using nspector.Native.NVAPI2;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace nspector.Common.Meta
{
@@ -74,11 +72,11 @@ namespace nspector.Common.Meta
return null;
}
public List<uint> GetSettingIds()
{
return customSettings.Settings
.Select(x => x.SettingId).ToList();
return customSettings.Settings
.Select(x => x.SettingId).ToList();
}

View File

@@ -1,13 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;
using System.Text;
using nspector.Common.CustomSettings;
using nspector.Native.NvApi.DriverSettings;
using nspector.Native.NVAPI2;
using nvw = nspector.Native.NVAPI2.NvapiDrsWrapper;
using nvw = nspector.Native.NVAPI2.NvapiDrsWrapper;
namespace nspector.Common.Meta
{
@@ -26,14 +20,14 @@ namespace nspector.Common.Meta
private List<uint> InitSettingIds()
{
var settingIds = new List<uint>();
var nvRes = nvw.DRS_EnumAvailableSettingIds(out settingIds, 512);
if (nvRes != NvAPI_Status.NVAPI_OK)
throw new NvapiException("DRS_EnumAvailableSettingIds", nvRes);
return settingIds;
}
private SettingMeta GetDriverSettingMetaInternal(uint settingId)
{
var values = new NVDRS_SETTING_VALUES();
@@ -44,10 +38,10 @@ namespace nspector.Common.Meta
if (nvRes == NvAPI_Status.NVAPI_SETTING_NOT_FOUND)
return null;
if (nvRes != NvAPI_Status.NVAPI_OK)
throw new NvapiException("DRS_EnumAvailableSettingValues", nvRes);
var sbSettingName = new StringBuilder((int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX);
nvRes = nvw.DRS_GetSettingNameFromId(settingId, sbSettingName);
@@ -58,11 +52,12 @@ namespace nspector.Common.Meta
if (string.IsNullOrWhiteSpace(settingName))
settingName = DrsUtil.GetDwordString(settingId);
var result = new SettingMeta {
var result = new SettingMeta
{
SettingType = values.settingType,
SettingName = settingName,
};
if (values.settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE)
{
@@ -71,13 +66,14 @@ namespace nspector.Common.Meta
for (int i = 0; i < values.numSettingValues; i++)
{
result.DwordValues.Add(
new SettingValue<uint> (Source) {
new SettingValue<uint>(Source)
{
Value = values.settingValues[i].dwordValue,
ValueName = DrsUtil.GetDwordString(values.settingValues[i].dwordValue),
});
}
}
if (values.settingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE)
{
result.DefaultStringValue = values.defaultValue.stringValue;
@@ -116,7 +112,7 @@ namespace nspector.Common.Meta
}
}
return result;
}
private SettingMeta GetSettingsMeta(uint settingId)
@@ -135,13 +131,13 @@ namespace nspector.Common.Meta
return null;
}
}
public string GetSettingName(uint settingId)
{
var settingMeta = GetSettingsMeta(settingId);
if (settingMeta != null)
return settingMeta.SettingName;
return null;
}
@@ -180,7 +176,7 @@ namespace nspector.Common.Meta
return null;
}
public List<uint> GetSettingIds()
{
return _settingIds;
@@ -194,7 +190,7 @@ namespace nspector.Common.Meta
return null;
}
public string GetGroupName(uint settingId)
{
return null;

View File

@@ -8,7 +8,7 @@ namespace nspector.Common.Meta
{
internal interface ISettingMetaService
{
SettingMetaSource Source {get; }
SettingMetaSource Source { get; }
NVDRS_SETTING_TYPE? GetSettingValueType(uint settingId);

View File

@@ -1,207 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using nspector.Native.NvApi.DriverSettings;
using nspector.Native.NVAPI2;
namespace nspector.Common.Meta
{
internal class NvD3dUmxSettingMetaService : ISettingMetaService
{
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
struct NvD3dUmxName
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)]
public string settingName;
public uint settingId;
public uint unknown;
}
[StructLayout(LayoutKind.Sequential)]
struct NvD3dUmxNameList
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 255)]
public NvD3dUmxName[] settingNames;
}
private static int FindOffset(byte[] bytes, byte[] pattern, int offset = 0, byte? wildcard = null)
{
for (int i = offset; i < bytes.Length; i++)
{
if (pattern[0] == bytes[i] && bytes.Length - i >= pattern.Length)
{
bool ismatch = true;
for (int j = 1; j < pattern.Length && ismatch == true; j++)
{
if (bytes[i + j] != pattern[j] && ((wildcard.HasValue && wildcard != pattern[j]) || !wildcard.HasValue))
{
ismatch = false;
break;
}
}
if (ismatch)
return i;
}
}
return -1;
}
private static List<NvD3dUmxName> ParseNvD3dUmxNames(string filename)
{
if (!File.Exists(filename)) return null;
var bytes = File.ReadAllBytes(filename);
var runtimeNameOffset = FindOffset(bytes, new byte[] { 0x52, 0x75, 0x6E, 0x54, 0x69, 0x6D, 0x65, 0x4E, 0x61, 0x6D, 0x65 });
if (runtimeNameOffset > -1)
{
var _2ddNotesOffset = FindOffset(bytes, new byte[] { 0x32, 0x44, 0x44, 0x5F, 0x4E, 0x6F, 0x74, 0x65, 0x73 });
if (_2ddNotesOffset > -1)
{
var itemSize = Marshal.SizeOf(typeof(NvD3dUmxName));
var startOffset = runtimeNameOffset - itemSize;
var endOffset = _2ddNotesOffset + itemSize;
var tableLength = endOffset - startOffset;
var bufferSize = Marshal.SizeOf(typeof(NvD3dUmxNameList));
if (tableLength > bufferSize)
{
tableLength = bufferSize;
}
var itemCount = tableLength / itemSize;
var buffer = new byte[bufferSize];
Buffer.BlockCopy(bytes, startOffset, buffer, 0, tableLength);
var poBuffer = GCHandle.Alloc(buffer, GCHandleType.Pinned);
try
{
var nvD3dUmxNames = (NvD3dUmxNameList)Marshal.PtrToStructure(
poBuffer.AddrOfPinnedObject(),
typeof(NvD3dUmxNameList));
var result = new List<NvD3dUmxName>();
for (int i = 0; i < itemCount; i++)
{
result.Add(nvD3dUmxNames.settingNames[i]);
}
return result;
}
finally
{
poBuffer.Free();
}
}
}
return null;
}
private readonly List<NvD3dUmxName> _SettingNames;
private void ExportSettingsToCsn()
{
var settings = _SettingNames.Select(s => new CustomSettings.CustomSetting()
{
GroupName = "7 - Stereo",
HexSettingId = $"0x{s.settingId.ToString("X8")}",
UserfriendlyName = s.settingName,
}).ToList();
var xml = new CustomSettings.CustomSettingNames();
xml.Settings.AddRange(settings);
xml.StoreToFile("NvD3dUmx.xml");
}
public NvD3dUmxSettingMetaService()
{
var systemPath = Environment.GetFolderPath(Environment.SpecialFolder.System);
var nvD3dUmxPath = Path.Combine(systemPath, "nvd3dumx.dll");
_SettingNames = ParseNvD3dUmxNames(nvD3dUmxPath);
//ExportSettingsToCsn();
}
public Type GetSettingEnumType(uint settingId)
{
return null;
}
public NVDRS_SETTING_TYPE? GetSettingValueType(uint settingId)
{
return null;
}
public string GetSettingName(uint settingId)
{
if (_SettingNames != null)
{
var setting = _SettingNames.FirstOrDefault(s => s.settingId == settingId);
return setting.settingId != 0 ? setting.settingName : null;
}
return null;
}
public uint? GetDwordDefaultValue(uint settingId)
{
return null;
}
public string GetStringDefaultValue(uint settingId)
{
return null;
}
public List<SettingValue<string>> GetStringValues(uint settingId)
{
return null;
}
public List<SettingValue<uint>> GetDwordValues(uint settingId)
{
return null;
}
public List<uint> GetSettingIds()
{
if (_SettingNames != null)
{
return _SettingNames.Select(s => s.settingId).ToList();
}
return new List<uint>();
}
public string GetGroupName(uint settingId)
{
if (_SettingNames != null)
{
var setting = _SettingNames.FirstOrDefault(s => s.settingId == settingId);
return setting.settingId != 0 ? "7 - Stereo" : null;
}
return null;
}
public byte[] GetBinaryDefaultValue(uint settingId)
{
return null;
}
public List<SettingValue<byte[]>> GetBinaryValues(uint settingId)
{
return null;
}
public SettingMetaSource Source
{
get { return SettingMetaSource.NvD3dUmxSettings; }
}
}
}

View File

@@ -31,7 +31,7 @@ namespace nspector.Common.Meta
public string GetSettingName(uint settingId)
{
var cached = CachedSettings.FirstOrDefault(x=>x.SettingId.Equals(settingId));
var cached = CachedSettings.FirstOrDefault(x => x.SettingId.Equals(settingId));
if (cached != null)
return string.Format("0x{0:X8} ({1} Profiles)", settingId, cached.ProfileCount);
@@ -69,7 +69,7 @@ namespace nspector.Common.Meta
public List<SettingValue<uint>> GetDwordValues(uint settingId)
{
var cached = CachedSettings.FirstOrDefault(x=>x.SettingId.Equals(settingId));
var cached = CachedSettings.FirstOrDefault(x => x.SettingId.Equals(settingId));
if (cached != null)
return cached.SettingValues.Select(s => new SettingValue<uint>(Source)
{

View File

@@ -1,8 +1,5 @@
using nspector.Native.NVAPI2;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace nspector.Common.Meta
{

View File

@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace nspector.Common.Meta
namespace nspector.Common.Meta
{
public enum SettingMetaSource
{
@@ -11,7 +6,6 @@ namespace nspector.Common.Meta
DriverSettings = 20,
ConstantSettings = 30,
ReferenceSettings = 40,
NvD3dUmxSettings = 50,
ScannedSettings = 60,
ScannedSettings = 50,
}
}

View File

@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace nspector.Common.Meta
namespace nspector.Common.Meta
{
internal class SettingValue<T>
{
@@ -14,7 +9,7 @@ namespace nspector.Common.Meta
{
ValueSource = source;
}
public int ValuePos { get; set; }
public string ValueName { get; set; }
public T Value { get; set; }
@@ -26,6 +21,6 @@ namespace nspector.Common.Meta
return string.Format("Value={0}; ValueName={1};", Value, ValueName);
}
}
}

View File

@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using nspector.Native.NVAPI2;
namespace nspector.Common

View File

@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace nspector.Common
namespace nspector.Common
{
internal enum SettingState
@@ -17,7 +12,7 @@ namespace nspector.Common
internal class SettingItem
{
public uint SettingId { get; set; }
public string SettingText { get; set; }
public string ValueText { get; set; }

View File

@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace nspector.Common
namespace nspector.Common
{
public enum SettingViewMode
{

View File

@@ -1,11 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<CustomSettingNames>
<ShowCustomizedSettingNamesOnly>false</ShowCustomizedSettingNamesOnly>
<Settings>
<CustomSetting>
<UserfriendlyName>SLI CFR Mode</UserfriendlyName>
<HexSettingID>0x20343843</HexSettingID>
<GroupName>6 - SLI</GroupName>
</CustomSetting>
<CustomSetting>
<UserfriendlyName>Enable Ansel</UserfriendlyName>
<HexSettingID>0x1075D972</HexSettingID>
<Description />
<GroupName>5 - Common</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -22,7 +25,6 @@
<UserfriendlyName>Sharpening Filter</UserfriendlyName>
<HexSettingID>0x00598928</HexSettingID>
<MinRequiredDriverVersion>441.87</MinRequiredDriverVersion>
<Description />
<GroupName>3 - Antialiasing</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -39,7 +41,6 @@
<UserfriendlyName>Sharpening Value</UserfriendlyName>
<HexSettingID>0x002ED8CD</HexSettingID>
<MinRequiredDriverVersion>441.87</MinRequiredDriverVersion>
<Description />
<GroupName>3 - Antialiasing</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -457,7 +458,6 @@
<UserfriendlyName>Sharpening - Denoising Factor</UserfriendlyName>
<HexSettingID>0x002ED8CE</HexSettingID>
<MinRequiredDriverVersion>441.87</MinRequiredDriverVersion>
<Description />
<GroupName>3 - Antialiasing</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -875,7 +875,6 @@
<UserfriendlyName>Frame Rate Limiter V3</UserfriendlyName>
<HexSettingID>0x10835002</HexSettingID>
<MinRequiredDriverVersion>441.87</MinRequiredDriverVersion>
<Description />
<GroupName>2 - Sync and Refresh</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -2063,7 +2062,6 @@
<UserfriendlyName>Shadercache</UserfriendlyName>
<HexSettingID>0x00198FFF</HexSettingID>
<MinRequiredDriverVersion>337.50</MinRequiredDriverVersion>
<Description />
<GroupName>5 - Common</GroupName>
<OverrideDefault>0x00000001</OverrideDefault>
<SettingValues>
@@ -2082,7 +2080,6 @@
<UserfriendlyName>Antialiasing fix</UserfriendlyName>
<HexSettingID>0x000858F7</HexSettingID>
<MinRequiredDriverVersion>320.14</MinRequiredDriverVersion>
<Description />
<GroupName>1 - Compatibility</GroupName>
<OverrideDefault>0x00000001</OverrideDefault>
<SettingValues>
@@ -2100,7 +2097,6 @@
<UserfriendlyName>Vertical Sync Smooth AFR behavior</UserfriendlyName>
<HexSettingID>0x101AE763</HexSettingID>
<MinRequiredDriverVersion>310.00</MinRequiredDriverVersion>
<Description />
<GroupName>2 - Sync and Refresh</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -2118,7 +2114,6 @@
<UserfriendlyName>Texture filtering - Driver Controlled LOD Bias</UserfriendlyName>
<HexSettingID>0x00638E8F</HexSettingID>
<MinRequiredDriverVersion>313.00</MinRequiredDriverVersion>
<Description />
<GroupName>4 - Texture Filtering</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -2135,7 +2130,6 @@
<CustomSetting>
<UserfriendlyName>Flip Indicator</UserfriendlyName>
<HexSettingID>0x002CF156</HexSettingID>
<Description />
<GroupName>2 - Sync and Refresh</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -2173,7 +2167,6 @@
<UserfriendlyName>Frame Rate Limiter Mode</UserfriendlyName>
<HexSettingID>0x10834FFF</HexSettingID>
<MinRequiredDriverVersion>372.00</MinRequiredDriverVersion>
<Description />
<GroupName>2 - Sync and Refresh</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -2195,7 +2188,6 @@
<UserfriendlyName>Frame Rate Limiter</UserfriendlyName>
<HexSettingID>0x10834FEE</HexSettingID>
<MinRequiredDriverVersion>280.26</MinRequiredDriverVersion>
<Description />
<GroupName>2 - Sync and Refresh</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -3141,7 +3133,6 @@
<UserfriendlyName>Toggle FXAA on or off</UserfriendlyName>
<HexSettingID>0x1074C972</HexSettingID>
<MinRequiredDriverVersion>300.00</MinRequiredDriverVersion>
<Description />
<GroupName>3 - Antialiasing</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -3159,7 +3150,6 @@
<UserfriendlyName>Toggle FXAA Indicator on or off</UserfriendlyName>
<HexSettingID>0x1068FB9C</HexSettingID>
<MinRequiredDriverVersion>300.00</MinRequiredDriverVersion>
<Description />
<GroupName>3 - Antialiasing</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -3177,7 +3167,6 @@
<UserfriendlyName>NVIDIA Predefined FXAA Usage</UserfriendlyName>
<HexSettingID>0x1034CB89</HexSettingID>
<MinRequiredDriverVersion>300.00</MinRequiredDriverVersion>
<Description />
<GroupName>3 - Antialiasing</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -3194,7 +3183,6 @@
<CustomSetting>
<UserfriendlyName>Antialiasing - Line gamma</UserfriendlyName>
<HexSettingID>0x2089BF6C</HexSettingID>
<Description />
<GroupName>3 - Antialiasing</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -3215,7 +3203,6 @@
<CustomSetting>
<UserfriendlyName>Texture filtering - LOD Bias (DX)</UserfriendlyName>
<HexSettingID>0x00738E8F</HexSettingID>
<Description />
<GroupName>4 - Texture Filtering</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -3420,7 +3407,6 @@
<CustomSetting>
<UserfriendlyName>Texture filtering - LOD Bias (OGL)</UserfriendlyName>
<HexSettingID>0x20403F79</HexSettingID>
<Description />
<GroupName>4 - Texture Filtering</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -3817,21 +3803,18 @@
<CustomSetting>
<UserfriendlyName>SLI compatibility bits (OGL)</UserfriendlyName>
<HexSettingID>0x209746C1</HexSettingID>
<Description />
<GroupName>1 - Compatibility</GroupName>
<SettingValues />
</CustomSetting>
<CustomSetting>
<UserfriendlyName>SLI compatibility bits (DX12)</UserfriendlyName>
<HexSettingID>0x00A04746</HexSettingID>
<Description />
<GroupName>1 - Compatibility</GroupName>
<SettingValues />
</CustomSetting>
<CustomSetting>
<UserfriendlyName>SLI compatibility bits (DX10 + DX11)</UserfriendlyName>
<HexSettingID>0x00A06946</HexSettingID>
<Description />
<GroupName>1 - Compatibility</GroupName>
<SettingValues />
<SettingMasks>
@@ -3874,7 +3857,6 @@
<CustomSetting>
<UserfriendlyName>SLI compatibility bits</UserfriendlyName>
<HexSettingID>0x1095DEF8</HexSettingID>
<Description />
<GroupName>1 - Compatibility</GroupName>
<SettingValues />
<SettingMasks>
@@ -3931,7 +3913,6 @@
<CustomSetting>
<UserfriendlyName>Antialiasing compatibility</UserfriendlyName>
<HexSettingID>0x00D55F7D</HexSettingID>
<Description />
<GroupName>1 - Compatibility</GroupName>
<SettingValues />
<SettingMasks />
@@ -3939,7 +3920,6 @@
<CustomSetting>
<UserfriendlyName>Antialiasing compatibility (DX1x)</UserfriendlyName>
<HexSettingID>0x00E32F8A</HexSettingID>
<Description />
<GroupName>1 - Compatibility</GroupName>
<SettingValues />
<SettingMasks />
@@ -3947,7 +3927,6 @@
<CustomSetting>
<UserfriendlyName>Ambient Occlusion compatibility</UserfriendlyName>
<HexSettingID>0x002C7F45</HexSettingID>
<Description />
<GroupName>1 - Compatibility</GroupName>
<SettingValues />
<SettingMasks />
@@ -3956,7 +3935,6 @@
<UserfriendlyName>Antialiasing - Gamma correction</UserfriendlyName>
<HexSettingID>0x107D639D</HexSettingID>
<OverrideDefault>0x00000002</OverrideDefault>
<Description />
<GroupName>3 - Antialiasing</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -3973,7 +3951,6 @@
<CustomSetting>
<UserfriendlyName>Antialiasing - Behavior Flags</UserfriendlyName>
<HexSettingID>0x10ECDB82</HexSettingID>
<Description />
<GroupName>3 - Antialiasing</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -4014,7 +3991,6 @@
<CustomSetting>
<UserfriendlyName>Antialiasing - Mode</UserfriendlyName>
<HexSettingID>0x107EFC5B</HexSettingID>
<Description />
<GroupName>3 - Antialiasing</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -4035,7 +4011,6 @@
<CustomSetting>
<UserfriendlyName>Antialiasing - Setting</UserfriendlyName>
<HexSettingID>0x10D773D2</HexSettingID>
<Description />
<GroupName>3 - Antialiasing</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -4124,7 +4099,6 @@
<CustomSetting>
<UserfriendlyName>Antialiasing - Transparency Multisampling</UserfriendlyName>
<HexSettingID>0x10FC2D9C</HexSettingID>
<Description />
<GroupName>3 - Antialiasing</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -4141,7 +4115,6 @@
<CustomSetting>
<UserfriendlyName>Antialiasing - Transparency Supersampling</UserfriendlyName>
<HexSettingID>0x10D48A85</HexSettingID>
<Description />
<GroupName>3 - Antialiasing</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -4182,7 +4155,6 @@
<CustomSetting>
<UserfriendlyName>Anisotropic filtering mode</UserfriendlyName>
<HexSettingID>0x10D2BB16</HexSettingID>
<Description />
<GroupName>4 - Texture Filtering</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -4199,7 +4171,6 @@
<CustomSetting>
<UserfriendlyName>Anisotropic filtering setting</UserfriendlyName>
<HexSettingID>0x101E61A9</HexSettingID>
<Description />
<GroupName>4 - Texture Filtering</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -4240,7 +4211,6 @@
<CustomSetting>
<UserfriendlyName>Texture filtering - Anisotropic filter optimization</UserfriendlyName>
<HexSettingID>0x0084CD70</HexSettingID>
<Description />
<GroupName>4 - Texture Filtering</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -4257,7 +4227,6 @@
<CustomSetting>
<UserfriendlyName>Texture filtering - Anisotropic sample optimization</UserfriendlyName>
<HexSettingID>0x00E73211</HexSettingID>
<Description />
<GroupName>4 - Texture Filtering</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -4274,7 +4243,6 @@
<CustomSetting>
<UserfriendlyName>Texture filtering - Negative LOD bias</UserfriendlyName>
<HexSettingID>0x0019BB68</HexSettingID>
<Description />
<GroupName>4 - Texture Filtering</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -4291,7 +4259,6 @@
<CustomSetting>
<UserfriendlyName>Texture filtering - Quality</UserfriendlyName>
<HexSettingID>0x00CE2691</HexSettingID>
<Description />
<GroupName>4 - Texture Filtering</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -4316,7 +4283,6 @@
<CustomSetting>
<UserfriendlyName>Texture filtering - Trilinear optimization</UserfriendlyName>
<HexSettingID>0x002ECAF2</HexSettingID>
<Description />
<GroupName>4 - Texture Filtering</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -4333,7 +4299,6 @@
<CustomSetting>
<UserfriendlyName>Ambient Occlusion usage</UserfriendlyName>
<HexSettingID>0x00664339</HexSettingID>
<Description />
<GroupName>5 - Common</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -4350,7 +4315,6 @@
<CustomSetting>
<UserfriendlyName>Ambient Occlusion setting</UserfriendlyName>
<HexSettingID>0x00667329</HexSettingID>
<Description />
<GroupName>5 - Common</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -4375,7 +4339,6 @@
<CustomSetting>
<UserfriendlyName>Maximum pre-rendered frames</UserfriendlyName>
<HexSettingID>0x007BA09E</HexSettingID>
<Description />
<GroupName>2 - Sync and Refresh</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -4420,7 +4383,6 @@
<CustomSetting>
<UserfriendlyName>Threaded optimization</UserfriendlyName>
<HexSettingID>0x20C1221E</HexSettingID>
<Description />
<GroupName>5 - Common</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -4441,7 +4403,6 @@
<CustomSetting>
<UserfriendlyName>Triple buffering</UserfriendlyName>
<HexSettingID>0x20FDD1F9</HexSettingID>
<Description />
<GroupName>2 - Sync and Refresh</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -4458,7 +4419,6 @@
<CustomSetting>
<UserfriendlyName>Vertical Sync</UserfriendlyName>
<HexSettingID>0x00A879CF</HexSettingID>
<Description />
<GroupName>2 - Sync and Refresh</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -4496,7 +4456,6 @@
<UserfriendlyName>Vertical Sync Tear Control</UserfriendlyName>
<HexSettingID>0x005A375C</HexSettingID>
<MinRequiredDriverVersion>300.00</MinRequiredDriverVersion>
<Description />
<GroupName>2 - Sync and Refresh</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -4513,7 +4472,6 @@
<CustomSetting>
<UserfriendlyName>Show PhysX Visual Indicator</UserfriendlyName>
<HexSettingID>0x1094F16F</HexSettingID>
<Description />
<GroupName>5 - Common</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -4530,7 +4488,6 @@
<CustomSetting>
<UserfriendlyName>Power management mode</UserfriendlyName>
<HexSettingID>0x1057EB71</HexSettingID>
<Description />
<GroupName>5 - Common</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -4551,7 +4508,6 @@
<CustomSetting>
<UserfriendlyName>CUDA - Force P2 State</UserfriendlyName>
<HexSettingID>0x50166C5E</HexSettingID>
<Description />
<GroupName>5 - Common</GroupName>
<OverrideDefault>0x00000001</OverrideDefault>
<SettingValues>
@@ -4569,7 +4525,6 @@
<CustomSetting>
<UserfriendlyName>Optimize for Compute Performance</UserfriendlyName>
<HexSettingID>0x10C158AD</HexSettingID>
<Description />
<GroupName>5 - Common</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -4586,7 +4541,6 @@
<CustomSetting>
<UserfriendlyName>Extension limit</UserfriendlyName>
<HexSettingID>0x20FF7493</HexSettingID>
<Description />
<GroupName>5 - Common</GroupName>
<SettingValues>
<CustomSettingValue>
@@ -4603,7 +4557,6 @@
<CustomSetting>
<UserfriendlyName>Multi-display/mixed-GPU acceleration</UserfriendlyName>
<HexSettingID>0x200AEBFC</HexSettingID>
<Description />
<GroupName>5 - Common</GroupName>
<SettingValues>
<CustomSettingValue>

View File

@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace nspector.Native
{
@@ -51,6 +49,6 @@ namespace nspector.Native
targetPointer = Marshal.AllocHGlobal(sizeOfItem);
Marshal.StructureToPtr(item, targetPointer, true);
}
}
}

View File

@@ -287,7 +287,7 @@ namespace nspector.Native.WINAPI
internal string lpData;
}
internal struct WINDOWPLACEMENT
{
internal int length;
@@ -301,7 +301,7 @@ namespace nspector.Native.WINAPI
internal bool bringAppToFront(int hWnd)
{
WINDOWPLACEMENT param = new WINDOWPLACEMENT();
if (GetWindowPlacement(hWnd,ref param))
if (GetWindowPlacement(hWnd, ref param))
{
if (param.showCmd != SW_NORMAL)
{
@@ -312,7 +312,7 @@ namespace nspector.Native.WINAPI
}
return SetForegroundWindow(hWnd);
}
internal int sendWindowsStringMessage(int hWnd, int wParam, string msg)
{
int result = 0;

View File

@@ -241,7 +241,7 @@ namespace nspector.Native.WINAPI
private class NativeMethods
{
[DllImport("Shell32", CharSet = CharSet.Auto)]
internal extern static int ExtractIconEx([MarshalAs(UnmanagedType.LPTStr)]
internal extern static int ExtractIconEx([MarshalAs(UnmanagedType.LPTStr)]
string lpszFile,
int nIconIndex,
IntPtr[] phIconLarge,

View File

@@ -25,7 +25,7 @@ namespace nspector.Native.WINAPI
THBF_NOBACKGROUND = 0x0004,
THBF_HIDDEN = 0x0008
}
[Flags]
internal enum THB
{
@@ -37,18 +37,18 @@ namespace nspector.Native.WINAPI
}
internal enum TBPFLAG
{
TBPF_NOPROGRESS = 0,
TBPF_INDETERMINATE = 0x1,
TBPF_NORMAL = 0x2,
TBPF_ERROR = 0x4,
TBPF_PAUSED = 0x8
{
TBPF_NOPROGRESS = 0,
TBPF_INDETERMINATE = 0x1,
TBPF_NORMAL = 0x2,
TBPF_ERROR = 0x4,
TBPF_PAUSED = 0x8
}
internal enum TBATFLAG
{
TBATF_USEMDITHUMBNAIL = 0x1,
TBATF_USEMDILIVEPREVIEW = 0x2
{
TBATF_USEMDITHUMBNAIL = 0x1,
TBATF_USEMDILIVEPREVIEW = 0x2
}
[ComImport,
@@ -57,7 +57,7 @@ namespace nspector.Native.WINAPI
internal interface ITaskbarList3
{
[MethodImpl(MethodImplOptions.InternalCall,
[MethodImpl(MethodImplOptions.InternalCall,
MethodCodeType = MethodCodeType.Runtime)]
void HrInit();
@@ -79,7 +79,7 @@ namespace nspector.Native.WINAPI
[MethodImpl(MethodImplOptions.InternalCall,
MethodCodeType = MethodCodeType.Runtime)]
void MarkFullscreenWindow([In] IntPtr hwnd,
void MarkFullscreenWindow([In] IntPtr hwnd,
[In, MarshalAs(UnmanagedType.Bool)] bool fFullscreen);
[MethodImpl(MethodImplOptions.InternalCall,
@@ -87,8 +87,8 @@ namespace nspector.Native.WINAPI
void SetProgressValue([In] IntPtr hwnd,
[In] ulong ullCompleted,
[In] ulong ullTotal);
[MethodImpl(MethodImplOptions.InternalCall,
[MethodImpl(MethodImplOptions.InternalCall,
MethodCodeType = MethodCodeType.Runtime)]
void SetProgressState([In] IntPtr hwnd,
[In] TBPFLAG tbpFlags);
@@ -120,7 +120,7 @@ namespace nspector.Native.WINAPI
[In] uint cButtons,
[In] IntPtr pButton);
///* [size_is][in] */ __RPC__in_ecount_full(cButtons) LPTHUMBBUTTON pButton);
//preliminary
[MethodImpl(MethodImplOptions.InternalCall,
MethodCodeType = MethodCodeType.Runtime)]
@@ -150,7 +150,7 @@ namespace nspector.Native.WINAPI
MethodCodeType = MethodCodeType.Runtime)]
void SetThumbnailClip([In] IntPtr hwnd,
[In] IntPtr prcClip);
}

View File

@@ -4,7 +4,7 @@ using System.IO;
using System.Threading;
using System.Windows.Forms;
using nspector.Common;
using nspector.Common.Import;
using nspector.Common.Helper;
using nspector.Native.WINAPI;
namespace nspector
@@ -29,6 +29,7 @@ namespace nspector
#endif
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
DropDownMenuScrollWheelHandler.Enable(true);
var argFileIndex = ArgFileIndex(args);
if (argFileIndex != -1)

View File

File diff suppressed because it is too large Load Diff

View File

@@ -699,12 +699,15 @@ namespace nspector
if (scanPredefined && !_alreadyScannedForPredefinedSettings)
{
_alreadyScannedForPredefinedSettings = true;
await _scanner.ScanForPredefinedProfileSettingsAsync(progressHandler, _scannerCancelationTokenSource.Token);
await _scanner.ScanProfileSettingsAsync(false, progressHandler, _scannerCancelationTokenSource.Token);
_meta.ResetMetaCache();
tscbShowScannedUnknownSettings.Enabled = true;
}
await _scanner.ScanForModifiedProfilesAsync(progressHandler, _scannerCancelationTokenSource.Token);
else
{
await _scanner.ScanProfileSettingsAsync(true, progressHandler, _scannerCancelationTokenSource.Token);
}
RefreshModifiesProfilesDropDown();
tsbModifiedProfiles.Enabled = true;
@@ -842,6 +845,9 @@ namespace nspector
if (MessageBox.Show(this, "Really delete all profiles?", "Delete all profiles", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
{
_drs.DeleteAllProfilesHard();
ChangeCurrentProfile(_baseProfileName);
DrsSessionScope.DestroyGlobalSession();
RefreshAll();
}
}
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)
@@ -1183,6 +1189,8 @@ namespace nspector
settings.WindowWidth = RestoreBounds.Width;
}
settings.WindowState = WindowState;
settings.ShowCustomizedSettingNamesOnly = tscbShowCustomSettingNamesOnly.Checked;
settings.ShowScannedUnknownSettings = tscbShowScannedUnknownSettings.Checked;
settings.SaveSettings();
}
@@ -1192,6 +1200,8 @@ namespace nspector
SetBounds(settings.WindowLeft, settings.WindowTop, settings.WindowWidth, settings.WindowHeight);
WindowState = settings.WindowState != FormWindowState.Minimized ? settings.WindowState : FormWindowState.Normal;
HandleScreenConstraints();
tscbShowCustomSettingNamesOnly.Checked = settings.ShowCustomizedSettingNamesOnly;
tscbShowScannedUnknownSettings.Checked = !_skipScan && settings.ShowScannedUnknownSettings;
}
private void frmDrvSettings_FormClosed(object sender, FormClosedEventArgs e)

View File

@@ -135,6 +135,7 @@
<Compile Include="Common\DrsSessionScope.cs" />
<Compile Include="Common\DrsSettingsMetaService.cs" />
<Compile Include="Common\DrsUtil.cs" />
<Compile Include="Common\Helper\DropDownMenuScrollWheelHandler.cs" />
<Compile Include="Common\Helper\ListViewGroupSorter.cs" />
<Compile Include="Common\Helper\ShortcutResolver.cs" />
<Compile Include="Common\Helper\SteamAppResolver.cs" />
@@ -142,7 +143,6 @@
<Compile Include="Common\Helper\UserSettings.cs" />
<Compile Include="Common\Import\ImportExportUitl.cs" />
<Compile Include="Common\Import\SettingValueType.cs" />
<Compile Include="Common\Meta\NvD3dUmxSettingMetaService.cs" />
<Compile Include="Common\Meta\MetaServiceItem.cs" />
<Compile Include="Common\Meta\ConstantSettingMetaService.cs" />
<Compile Include="Common\Meta\CustomSettingMetaService.cs" />