Compare commits

...
54 Commits
Author SHA1 Message Date
Orbmu2k 9115ffa4cc Merge pull request #272 from emoose/listviewfix
Fix combobox requiring two clicks to open, add RTX digital vibrance
2025-02-15 12:27:10 +01:00
Orbmu2k b4f65906d9 Merge pull request #265 from renannmp/master
Update CustomSettingNames.xml to add CUDA - Sysmem Fallback Policy and  Vulkan/OpenGL present method.
2025-02-15 12:26:54 +01:00
emoose c0c37cbfbb Trim unneeded HDR settings, add RTX digital vibrance + DLSS preset L - O
nvapi returns presets L - O for future presets to use, add them to our list to make combobox items uniform
2025-02-14 08:24:06 +00:00
emoose e548c384ec ListViewEx: skip repositioning opened combobox, fixes combobox requiring two clicks 2025-02-14 08:11:36 +00:00
Warkratos b043a0cce6 Update CustomSettingNames.xml
Add CUDA - Sysmem Fallback Policy to 5 - Common
Add Vulkan/OpenGL present method to 2 - Sync and refresh
Small correction to hex for MPO_INDICATOR
2025-02-08 16:41:16 -03:00
Orbmu2k 7eca55a7a1 NVAPI R570 + .NET FW 4.8.1 + small improvements 2025-02-07 19:49:13 +01:00
Orbmu2k 332153bc23 Merge pull request #262 from renannmp/master
Update CustomSettingNames.xml to include MPO Indicator and Old Sharpening Method
2025-02-07 19:33:19 +01:00
Nyamp 8ff77c1f07 Update CustomSettingNames.xml
- Add MPO_INDICATOR to Extra
- Override Default Setting for Frame Generation Count
- Add Old Sharpening Method to Antialiasing
2025-02-04 23:34:52 -03:00
Orbmu2k 801fa76467 Merge pull request #261 from emoose/master
CustomSettingNames: add DLSS/HDR/SmoothMotion settings
2025-02-04 18:59:05 +01:00
emoose a40527f8de CustomSettingNames: add DLSS/HDR/SmoothMotion settings 2025-02-04 16:17:26 +00:00
Orbmu2k b5a0b0091a #247 temporary fix for 571.96 overflow bug - thanks emoose :) 2025-01-24 16:12:31 +01:00
Orbmu2k 8b6c13216a possible fix for #131 2023-03-26 11:35:33 +02:00
Orbmu2k 3c74a9b5e5 additional invariant culture checks for lower case 2023-03-26 11:30:05 +02:00
Orbmu2k 70c63b1239 possible fix for #128 2023-03-26 11:27:21 +02:00
Orbmu2k f003324d55 fallback functionIds 2023-03-26 11:25:42 +02:00
Orbmu2k b9563767ef fixed dpi 2022-11-30 23:22:10 +01:00
Orbmu2k 4c28abefa3 settings rename pt 2 2022-11-26 20:01:21 +01:00
Orbmu2k 76e5d34e24 'Raytracing - (Vulkan RT) enabled' setting added
added support for descriptions in CSN
added setting name filter (CTRL + F) revert with ESCAPE
added devmode view (CTRL + ALT + D)
and some fixes
2022-11-19 22:24:26 +01:00
Orbmu2k 3f1d636fae rBAR options added #75 #103 2022-11-13 21:07:04 +01:00
Orbmu2k acb5607a6d check CI build v2 2022-11-13 14:05:08 +01:00
Orbmu2k b6ec45a334 check CI build v1 2022-11-13 14:04:12 +01:00
Orbmu2k 75c99ea6c7 Shadercache - Cachesize added #88
Background Application Max Frame Rate added #79
Disable Ansel setting is back and working #54 #87
Ultra Low Latency setting is back #49
added workaround for some settings throw errors when changed #46 #96 #94
AO High Quality removed from settinngs #101
updated settings to R520 and .NET Framework Version to 4.8 #102
2022-11-13 13:58:24 +01:00
Orbmu2k 5aed1a0051 force some settings to be hidden 2021-02-03 00:18:59 +01:00
Orbmu2k 128efcdb86 create dump for setting store fails 2021-02-02 23:29:47 +01:00
Orbmu2k d4ce1c9018 updated driver settings to R460, removed deprecated settings from CSN 2021-01-19 01:45:27 +01:00
Orbmu2k abef5e1eb1 highlight not exposed API settings when debugger is attached 2021-01-16 20:33:45 +01:00
Orbmu2k c2f71c5d1e R445.75 removed restricted settings to avoid errors 2020-03-24 19:57:27 +01:00
Orbmu2k a4ea01dfd1 R442.19 - increased limiter v3 range 20..1000 FPS 2020-02-04 20:32:31 +01:00
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
Orbmu2k ffff16ca83 Update README.md 2020-01-11 13:39:36 +01:00
Orbmu2k cd8caa5702 fix #43 - delete application may not be successful 2020-01-11 13:38:06 +01:00
Orbmu2k 2d57d6b885 updated readme.md 2020-01-11 12:43:33 +01:00
Orbmu2k 84749fdf5f possible fix #27 #40 2020-01-11 01:10:00 +01:00
Orbmu2k b651dae816 moved ansel setting to common group 2020-01-11 00:18:15 +01:00
Orbmu2k 0a27ce1c36 STRG+C will copy userdefined settings to clipboard 2020-01-11 00:10:16 +01:00
Orbmu2k 499cdde758 fixed drs db reset 2020-01-10 22:55:25 +01:00
Orbmu2k cedcd4e2c6 fix #33 - using settings.xml in working folder if exists 2020-01-07 23:39:06 +01:00
Orbmu2k 5301c52c16 fixed "-disableScan" mode 2020-01-07 23:20:21 +01:00
Orbmu2k bf8243adaf Updated Settings R441 2020-01-07 11:17:35 +01:00
Orbmu2k 854cc3d0ee fix #13 remember window size, fix crash on closing app while scanning 2019-03-23 16:13:08 +01:00
Orbmu2k f1ecca7985 improved tempfile handling 2019-03-23 14:20:39 +01:00
Orbmu2k 1af9d1c4fb fixed game starter waiting until setting is stored (bit value editor) 2019-03-23 13:47:59 +01:00
Orbmu2k 2383de09ce xml constructor works again 2019-03-23 13:27:05 +01:00
Orbmu2k 210d5ea25f .NET 4.5 + async/await for setting scanner 2019-03-23 13:06:10 +01:00
Orbmu2k 0104d929e9 simplified version string in window title 2019-03-10 19:55:37 +01:00
61 changed files with 11342 additions and 4924 deletions

No files matched your search

+11 -1
View File
@@ -1 +1,11 @@
# nvidiaProfileInspector ![](/nspector/Images/n1-016.png) **NVIDIA Profile Inspector**
This tool is used for modifying game profiles inside the internal driver database of the nvidia driver.
All game profiles are provided by the nvidia driver, but you can add your own profiles for games missing in the driver database.
You also have access to hidden and undocumented settings, which are not provided by the drivers control panel.
For more information how to use this tool, you can find some very good wikis here:
* https://wiki.step-project.com/Guide:NVIDIA_Inspector
* https://www.pcgamingwiki.com/wiki/Nvidia_Profile_Inspector
![](npi_screenshot.png)
Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

+1 -1
View File
@@ -6,7 +6,7 @@ namespace nspector.Common
internal class CachedSettingValue internal class CachedSettingValue
{ {
internal CachedSettingValue() { } internal CachedSettingValue() { }
internal CachedSettingValue(uint Value, string ProfileNames) internal CachedSettingValue(uint Value, string ProfileNames)
{ {
+3 -3
View File
@@ -6,14 +6,14 @@ namespace nspector.Common
{ {
internal class CachedSettings internal class CachedSettings
{ {
internal CachedSettings() { } internal CachedSettings() { }
internal CachedSettings(uint settingId, NVDRS_SETTING_TYPE settingType) internal CachedSettings(uint settingId, NVDRS_SETTING_TYPE settingType)
{ {
SettingId = settingId; SettingId = settingId;
SettingType = settingType; SettingType = settingType;
} }
internal uint SettingId; internal uint SettingId;
internal List<CachedSettingValue> SettingValues = new List<CachedSettingValue>(); internal List<CachedSettingValue> SettingValues = new List<CachedSettingValue>();
@@ -21,7 +21,7 @@ namespace nspector.Common
internal uint ProfileCount = 0; internal uint ProfileCount = 0;
internal NVDRS_SETTING_TYPE SettingType = NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE; internal NVDRS_SETTING_TYPE SettingType = NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE;
internal void AddDwordValue(uint valueDword, string Profile) internal void AddDwordValue(uint valueDword, string Profile)
{ {
var setting = SettingValues.FirstOrDefault(s => s.Value == valueDword); var setting = SettingValues.FirstOrDefault(s => s.Value == valueDword);
@@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Xml.Serialization; using System.Xml.Serialization;
namespace nspector.Common.CustomSettings namespace nspector.Common.CustomSettings
@@ -16,6 +15,9 @@ namespace nspector.Common.CustomSettings
public string GroupName { get; set; } public string GroupName { get; set; }
public string OverrideDefault { get; set; } public string OverrideDefault { get; set; }
public float MinRequiredDriverVersion { get; set; } public float MinRequiredDriverVersion { get; set; }
public bool Hidden { get; set; }
public bool HasConstraints { get; set; }
public string DataType { get; set; }
public List<CustomSettingValue> SettingValues { get; set; } public List<CustomSettingValue> SettingValues { get; set; }
@@ -8,8 +8,6 @@ namespace nspector.Common.CustomSettings
[Serializable] [Serializable]
public class CustomSettingNames public class CustomSettingNames
{ {
public bool ShowCustomizedSettingNamesOnly = false;
public List<CustomSetting> Settings = new List<CustomSetting>(); public List<CustomSetting> Settings = new List<CustomSetting>();
public void StoreToFile(string filename) public void StoreToFile(string filename)
@@ -1,5 +1,4 @@
using System; using System;
using System.Globalization;
namespace nspector.Common.CustomSettings namespace nspector.Common.CustomSettings
{ {
+47 -37
View File
@@ -1,16 +1,16 @@
using System; using nspector.Common.Helper;
using nspector.Native.NVAPI2;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using nspector.Native.NVAPI2;
namespace nspector.Common namespace nspector.Common
{ {
internal class DrsDecrypterService : DrsSettingsServiceBase internal class DrsDecrypterService : DrsSettingsServiceBase
{ {
private static readonly byte[] _InternalSettingsKey = new byte[] { private static readonly byte[] _InternalSettingsKey = new byte[] {
0x2f, 0x7c, 0x4f, 0x8b, 0x20, 0x24, 0x52, 0x8d, 0x26, 0x3c, 0x94, 0x77, 0xf3, 0x7c, 0x98, 0xa5, 0x2f, 0x7c, 0x4f, 0x8b, 0x20, 0x24, 0x52, 0x8d, 0x26, 0x3c, 0x94, 0x77, 0xf3, 0x7c, 0x98, 0xa5,
0xfa, 0x71, 0xb6, 0x80, 0xdd, 0x35, 0x84, 0xba, 0xfd, 0xb6, 0xa6, 0x1b, 0x39, 0xc4, 0xcc, 0xb0, 0xfa, 0x71, 0xb6, 0x80, 0xdd, 0x35, 0x84, 0xba, 0xfd, 0xb6, 0xa6, 0x1b, 0x39, 0xc4, 0xcc, 0xb0,
@@ -31,9 +31,13 @@ namespace nspector.Common
public DrsDecrypterService(DrsSettingsMetaService metaService) : base(metaService) public DrsDecrypterService(DrsSettingsMetaService metaService) : base(metaService)
{ {
CreateInternalSettingMap(); try
{
CreateInternalSettingMap();
}
catch { }
} }
private uint GetDwordFromKey(uint offset) private uint GetDwordFromKey(uint offset)
{ {
var bytes = new byte[4]; var bytes = new byte[4];
@@ -82,10 +86,10 @@ namespace nspector.Common
} }
} }
} }
private string FormatInternalSettingKey(string profileName, uint settingId) private string FormatInternalSettingKey(string profileName, uint settingId)
{ {
return profileName + settingId.ToString("X8").ToLower(); return profileName + settingId.ToString("X8").ToLowerInvariant();
} }
public bool IsInternalSetting(string profileName, uint settingId) public bool IsInternalSetting(string profileName, uint settingId)
@@ -97,40 +101,46 @@ namespace nspector.Common
private void CreateInternalSettingMap() private void CreateInternalSettingMap()
{ {
string tmpfile = Path.GetTempFileName(); string tmpfile = TempFile.GetTempFileName();
DrsSession((hSession) =>
try
{ {
SaveSettingsFileEx(hSession, tmpfile); DrsSession((hSession) =>
});
if (File.Exists(tmpfile))
{
var lines = File.ReadAllLines(tmpfile);
_InternalSettings = new HashSet<string>();
var paProfile = "Profile\\s\\\"(?<profileName>.*?)\\\"";
var rxProfile = new Regex(paProfile, RegexOptions.Compiled);
var paSetting = "ID_0x(?<sid>[0-9a-fA-F]+)\\s\\=.*?InternalSettingFlag\\=V0";
var rxSetting = new Regex(paSetting, RegexOptions.Compiled);
var currentProfileName = "";
for (int i = 0; i < lines.Length; i++)
{ {
foreach (Match ms in rxProfile.Matches(lines[i])) SaveSettingsFileEx(hSession, tmpfile);
});
if (File.Exists(tmpfile))
{
var lines = File.ReadAllLines(tmpfile);
_InternalSettings = new HashSet<string>();
var paProfile = "Profile\\s\\\"(?<profileName>.*?)\\\"";
var rxProfile = new Regex(paProfile, RegexOptions.Compiled);
var paSetting = "ID_0x(?<sid>[0-9a-fA-F]+)\\s\\=.*?InternalSettingFlag\\=V0";
var rxSetting = new Regex(paSetting, RegexOptions.Compiled);
var currentProfileName = "";
for (int i = 0; i < lines.Length; i++)
{ {
currentProfileName = ms.Result("${profileName}"); foreach (Match ms in rxProfile.Matches(lines[i]))
} {
foreach (Match ms in rxSetting.Matches(lines[i])) currentProfileName = ms.Result("${profileName}");
{ }
_InternalSettings.Add(currentProfileName + ms.Result("${sid}")); foreach (Match ms in rxSetting.Matches(lines[i]))
{
_InternalSettings.Add(currentProfileName + ms.Result("${sid}"));
}
} }
} }
}
File.Delete(tmpfile); finally
{
if (File.Exists(tmpfile))
File.Delete(tmpfile);
} }
} }
} }
} }
+14 -7
View File
@@ -1,7 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Security.Policy;
using System.Text; using System.Text;
using nspector.Common.Import; using nspector.Common.Import;
using nspector.Native.NVAPI2; using nspector.Native.NVAPI2;
@@ -18,8 +17,8 @@ namespace nspector.Common
private readonly DrsDecrypterService _DecrypterService; private readonly DrsDecrypterService _DecrypterService;
public DrsImportService( public DrsImportService(
DrsSettingsMetaService metaService, DrsSettingsMetaService metaService,
DrsSettingsService settingService, DrsSettingsService settingService,
DrsScannerService scannerService, DrsScannerService scannerService,
DrsDecrypterService decrypterService) DrsDecrypterService decrypterService)
: base(metaService) : base(metaService)
@@ -43,7 +42,7 @@ namespace nspector.Common
{ {
LoadSettingsFileEx(hSession, filename); LoadSettingsFileEx(hSession, filename);
SaveSettings(hSession); SaveSettings(hSession);
}); }, forceNonGlobalSession: true, preventLoadSettings: true);
} }
internal void ExportProfiles(List<string> profileNames, string filename, bool includePredefined) internal void ExportProfiles(List<string> profileNames, string filename, bool includePredefined)
@@ -77,7 +76,7 @@ namespace nspector.Common
{ {
result.Executeables.Add(app.appName); result.Executeables.Add(app.appName);
} }
var settings = GetProfileSettings(hSession, hProfile); var settings = GetProfileSettings(hSession, hProfile);
foreach (var setting in settings) foreach (var setting in settings)
{ {
@@ -239,7 +238,7 @@ namespace nspector.Common
var decryptedSetting = setting; var decryptedSetting = setting;
_DecrypterService.DecryptSettingIfNeeded(profileName, ref decryptedSetting); _DecrypterService.DecryptSettingIfNeeded(profileName, ref decryptedSetting);
if (isPredefined && exitsValueInImport && ImportExportUitl.AreDrsSettingEqualToProfileSetting(decryptedSetting, importSetting)) if (isPredefined && exitsValueInImport && ImportExportUitl.AreDrsSettingEqualToProfileSetting(decryptedSetting, importSetting))
{ {
alreadySet.Add(setting.settingId); alreadySet.Add(setting.settingId);
} }
@@ -261,7 +260,15 @@ namespace nspector.Common
if (!alreadySet.Contains(setting.SettingId)) if (!alreadySet.Contains(setting.SettingId))
{ {
var newSetting = ImportExportUitl.ConvertProfileSettingToDrsSetting(setting); var newSetting = ImportExportUitl.ConvertProfileSettingToDrsSetting(setting);
StoreSetting(hSession, hProfile, newSetting); try
{
StoreSetting(hSession, hProfile, newSetting);
}
catch (NvapiException ex)
{
if (ex.Status != NvAPI_Status.NVAPI_SETTING_NOT_FOUND)
throw;
}
} }
} }
} }
+87 -148
View File
@@ -1,21 +1,17 @@
using System; using nspector.Common.Helper;
using nspector.Native.NVAPI2;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Security.Policy;
using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading; using System.Threading;
using nspector.Common.Import; using System.Threading.Tasks;
using nspector.Native.NVAPI2;
using nvw = nspector.Native.NVAPI2.NvapiDrsWrapper; using nvw = nspector.Native.NVAPI2.NvapiDrsWrapper;
using nspector.Common.Helper;
namespace nspector.Common namespace nspector.Common
{ {
internal delegate void SettingScanDoneEvent();
internal delegate void SettingScanProgressEvent(int percent);
internal class DrsScannerService : DrsSettingsServiceBase internal class DrsScannerService : DrsSettingsServiceBase
{ {
@@ -24,9 +20,6 @@ namespace nspector.Common
: base(metaService, decrpterService) : base(metaService, decrpterService)
{ } { }
public event SettingScanDoneEvent OnModifiedProfilesScanDone;
public event SettingScanDoneEvent OnPredefinedSettingsScanDone;
public event SettingScanProgressEvent OnSettingScanProgress;
internal List<CachedSettings> CachedSettings = new List<CachedSettings>(); internal List<CachedSettings> CachedSettings = new List<CachedSettings>();
internal List<string> ModifiedProfiles = new List<string>(); internal List<string> ModifiedProfiles = new List<string>();
@@ -70,7 +63,7 @@ namespace nspector.Common
checkedSettingsCount++; checkedSettingsCount++;
AddScannedSettingToCache(profile, setting); AddScannedSettingToCache(profile, setting);
alreadyCheckedSettingIds.Add(setting.settingId); alreadyCheckedSettingIds.Add(setting.settingId);
return true; return (setting.isCurrentPredefined != 1);
} }
else if (setting.isCurrentPredefined != 1) else if (setting.isCurrentPredefined != 1)
{ {
@@ -80,75 +73,64 @@ namespace nspector.Common
return false; return false;
} }
private void ReportProgress(int current, int max)
{
int percent = (current > 0) ? (int)Math.Round((current * 100f) / max) : 0;
if (OnSettingScanProgress != null) private int CalcPercent(int current, int max)
OnSettingScanProgress(percent); {
return (current > 0) ? (int)Math.Round((current * 100f) / max) : 0; ;
} }
private void ScanForModifiedProfiles() public async Task ScanProfileSettingsAsync(bool justModified, IProgress<int> progress, CancellationToken token = default(CancellationToken))
{ {
ModifiedProfiles = new List<string>(); await Task.Run(() =>
UserProfiles = new HashSet<string>();
var knownPredefines = new List<uint>(_commonSettingIds);
DrsSession((hSession) =>
{ {
IntPtr hBaseProfile = GetProfileHandle(hSession, ""); ModifiedProfiles = new List<string>();
var profileHandles = EnumProfileHandles(hSession); UserProfiles = new HashSet<string>();
var knownPredefines = new List<uint>(_commonSettingIds);
var maxProfileCount = profileHandles.Count; DrsSession((hSession) =>
int curProfilePos = 0;
foreach (IntPtr hProfile in profileHandles)
{ {
ReportProgress(curProfilePos++, maxProfileCount); IntPtr hBaseProfile = GetProfileHandle(hSession, "");
var profileHandles = EnumProfileHandles(hSession);
var profile = GetProfileInfo(hSession, hProfile); var maxProfileCount = profileHandles.Count;
int curProfilePos = 0;
int checkedSettingsCount = 0; foreach (IntPtr hProfile in profileHandles)
bool foundModifiedProfile = false;
if (profile.isPredefined == 0)
{ {
ModifiedProfiles.Add(profile.profileName); if (token.IsCancellationRequested) break;
UserProfiles.Add(profile.profileName);
continue;
}
if ((hBaseProfile == hProfile || profile.numOfApps > 0) && profile.numOfSettings > 0) progress?.Report(CalcPercent(curProfilePos++, maxProfileCount));
{
var profile = GetProfileInfo(hSession, hProfile);
int checkedSettingsCount = 0;
var alreadyChecked = new List<uint>(); var alreadyChecked = new List<uint>();
foreach (uint settingId in knownPredefines) bool foundModifiedProfile = false;
if (profile.isPredefined == 0)
{
ModifiedProfiles.Add(profile.profileName);
UserProfiles.Add(profile.profileName);
foundModifiedProfile = true;
if (justModified) continue;
}
foreach (uint kpd in knownPredefines)
{ {
if (CheckCommonSetting(hSession, hProfile, profile, if (CheckCommonSetting(hSession, hProfile, profile,
ref checkedSettingsCount, settingId, false, ref alreadyChecked)) ref checkedSettingsCount, kpd, !justModified, ref alreadyChecked))
{ {
foundModifiedProfile = true; if (!foundModifiedProfile)
ModifiedProfiles.Add(profile.profileName); {
break; foundModifiedProfile = true;
ModifiedProfiles.Add(profile.profileName);
if (justModified) break;
}
} }
} }
// the detection if only applications has changed in a profile makes the scan process very slow, we leave it out! if ((foundModifiedProfile && justModified) || checkedSettingsCount >= profile.numOfSettings)
//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; continue;
var settings = GetProfileSettings(hSession, hProfile); var settings = GetProfileSettings(hSession, hProfile);
@@ -157,82 +139,30 @@ namespace nspector.Common
if (knownPredefines.IndexOf(setting.settingId) < 0) if (knownPredefines.IndexOf(setting.settingId) < 0)
knownPredefines.Add(setting.settingId); knownPredefines.Add(setting.settingId);
if (!justModified && alreadyChecked.IndexOf(setting.settingId) < 0)
AddScannedSettingToCache(profile, setting);
if (setting.isCurrentPredefined != 1) if (setting.isCurrentPredefined != 1)
{ {
ModifiedProfiles.Add(profile.profileName); if (!foundModifiedProfile)
break; {
foundModifiedProfile = true;
ModifiedProfiles.Add(profile.profileName);
if (justModified) break;
}
} }
} }
} }
} });
}); });
if (OnModifiedProfilesScanDone != null)
OnModifiedProfilesScanDone();
} }
private void ScanForPredefinedProfileSettings()
{
var knownPredefines = new List<uint>(_commonSettingIds);
DrsSession((hSession) =>
{
var profileHandles = EnumProfileHandles(hSession);
var maxProfileCount = profileHandles.Count;
int curProfilePos = 0;
foreach (IntPtr hProfile in profileHandles)
{
ReportProgress(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 (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 (alreadyChecked.IndexOf(setting.settingId) < 0)
AddScannedSettingToCache(profile, setting);
}
}
});
if (OnPredefinedSettingsScanDone != null)
OnPredefinedSettingsScanDone();
}
public void StartScanForModifiedProfilesAsync()
{
var thread = new Thread(ScanForModifiedProfiles);
thread.Start();
}
public void StartScanForPredefinedSettingsAsync()
{
var thread = new Thread(ScanForPredefinedProfileSettings);
thread.Start();
}
private void AddScannedSettingToCache(NVDRS_PROFILE profile, NVDRS_SETTING setting) private void AddScannedSettingToCache(NVDRS_PROFILE profile, NVDRS_SETTING setting)
{ {
// Skip 3D Vision string values here for improved scan performance // 3D Vision is dead so dont bother scanning those values for improved scan performance
bool allowAddValue = setting.settingId < 0x70000000 || setting.settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE; bool allowAddValue = !((setting.settingId & 0x70000000) == 0x70000000);
//bool allowAddValue = true; //bool allowAddValue = true;
var cachedSetting = CachedSettings var cachedSetting = CachedSettings
@@ -255,46 +185,55 @@ namespace nspector.Common
cachedSetting.AddDwordValue(setting.predefinedValue.dwordValue, profile.profileName); cachedSetting.AddDwordValue(setting.predefinedValue.dwordValue, profile.profileName);
else if (setting.settingType == NVDRS_SETTING_TYPE.NVDRS_BINARY_TYPE) else if (setting.settingType == NVDRS_SETTING_TYPE.NVDRS_BINARY_TYPE)
cachedSetting.AddBinaryValue(setting.predefinedValue.binaryValue, profile.profileName); cachedSetting.AddBinaryValue(setting.predefinedValue.binaryValue, profile.profileName);
} }
else
cachedSetting.ProfileCount++;
if (!cacheEntryExists) if (!cacheEntryExists)
CachedSettings.Add(cachedSetting); CachedSettings.Add(cachedSetting);
} }
} }
public string FindProfilesUsingApplication(string applicationName) public string FindProfilesUsingApplication(string applicationName)
{ {
string lowerApplicationName = applicationName.ToLower(); string lowerApplicationName = applicationName.ToLowerInvariant();
string tmpfile = Path.GetTempFileName(); string tmpfile = TempFile.GetTempFileName();
var matchingProfiles = new List<string>();
DrsSession((hSession) => try
{ {
SaveSettingsFileEx(hSession, tmpfile); var matchingProfiles = new List<string>();
});
if (File.Exists(tmpfile)) DrsSession((hSession) =>
{
string content = File.ReadAllText(tmpfile);
string pattern = "\\sProfile\\s\\\"(?<profile>.*?)\\\"(?<scope>.*?Executable.*?)EndProfile";
foreach (Match m in Regex.Matches(content, pattern, RegexOptions.Singleline))
{ {
string scope = m.Result("${scope}"); SaveSettingsFileEx(hSession, tmpfile);
foreach (Match ms in Regex.Matches(scope, "Executable\\s\\\"(?<app>.*?)\\\"", RegexOptions.Singleline)) });
if (File.Exists(tmpfile))
{
string content = File.ReadAllText(tmpfile);
string pattern = "\\sProfile\\s\\\"(?<profile>.*?)\\\"(?<scope>.*?Executable.*?)EndProfile";
foreach (Match m in Regex.Matches(content, pattern, RegexOptions.Singleline))
{ {
if (ms.Result("${app}").ToLower() == lowerApplicationName) string scope = m.Result("${scope}");
foreach (Match ms in Regex.Matches(scope, "Executable\\s\\\"(?<app>.*?)\\\"", RegexOptions.Singleline))
{ {
matchingProfiles.Add(m.Result("${profile}")); if (ms.Result("${app}").ToLowerInvariant() == lowerApplicationName)
{
matchingProfiles.Add(m.Result("${profile}"));
}
} }
} }
} }
return string.Join(";", matchingProfiles);
}
finally
{
if (File.Exists(tmpfile))
File.Delete(tmpfile);
} }
if (File.Exists(tmpfile))
File.Delete(tmpfile);
return string.Join(";", matchingProfiles);
} }
} }
+22 -13
View File
@@ -1,15 +1,7 @@
using System; using System.IO;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text;
using System.Windows.Forms;
using nspector.Common.CustomSettings; using nspector.Common.CustomSettings;
using nvw = nspector.Native.NVAPI2.NvapiDrsWrapper;
namespace nspector.Common namespace nspector.Common
{ {
internal class DrsServiceLocator internal class DrsServiceLocator
@@ -22,6 +14,8 @@ namespace nspector.Common
public static readonly DrsScannerService ScannerService; public static readonly DrsScannerService ScannerService;
public static readonly DrsDecrypterService DecrypterService; public static readonly DrsDecrypterService DecrypterService;
public static bool IsExternalCustomSettings { get; private set; } = false;
static DrsServiceLocator() static DrsServiceLocator()
{ {
CustomSettings = LoadCustomSettings(); CustomSettings = LoadCustomSettings();
@@ -39,7 +33,18 @@ namespace nspector.Common
string csnDefaultPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\CustomSettingNames.xml"; string csnDefaultPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\CustomSettingNames.xml";
if (File.Exists(csnDefaultPath)) if (File.Exists(csnDefaultPath))
return CustomSettingNames.FactoryLoadFromFile(csnDefaultPath); {
try
{
var externalSettings = CustomSettingNames.FactoryLoadFromFile(csnDefaultPath);
IsExternalCustomSettings = true;
return externalSettings;
}
catch
{
return CustomSettingNames.FactoryLoadFromString(Properties.Resources.CustomSettingNames);
}
}
else else
return CustomSettingNames.FactoryLoadFromString(Properties.Resources.CustomSettingNames); return CustomSettingNames.FactoryLoadFromString(Properties.Resources.CustomSettingNames);
} }
@@ -48,11 +53,15 @@ namespace nspector.Common
{ {
string csnDefaultPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Reference.xml"; string csnDefaultPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Reference.xml";
if (File.Exists(csnDefaultPath)) try
return CustomSettingNames.FactoryLoadFromFile(csnDefaultPath); {
if (File.Exists(csnDefaultPath))
return CustomSettingNames.FactoryLoadFromFile(csnDefaultPath);
}
catch { }
return null; return null;
} }
} }
} }
+24 -18
View File
@@ -1,9 +1,5 @@
using System; using nspector.Native.NVAPI2;
using System.Collections.Generic; using System;
using System.Linq;
using System.Text;
using nspector.Native.NVAPI2;
using nvw = nspector.Native.NVAPI2.NvapiDrsWrapper; using nvw = nspector.Native.NVAPI2.NvapiDrsWrapper;
namespace nspector.Common namespace nspector.Common
@@ -18,11 +14,15 @@ namespace nspector.Common
private static object _Sync = new object(); private static object _Sync = new object();
public static T DrsSession<T>(Func<IntPtr, T> action) public static T DrsSession<T>(Func<IntPtr, T> action, bool forceNonGlobalSession = false, bool preventLoadSettings = false)
{ {
lock (_Sync) lock (_Sync)
{ {
if (HoldSession && (GlobalSession == IntPtr.Zero)) if (!HoldSession || forceNonGlobalSession)
return NonGlobalDrsSession<T>(action, preventLoadSettings);
if (GlobalSession == IntPtr.Zero)
{ {
#pragma warning disable CS0420 #pragma warning disable CS0420
@@ -32,18 +32,21 @@ namespace nspector.Common
if (csRes != NvAPI_Status.NVAPI_OK) if (csRes != NvAPI_Status.NVAPI_OK)
throw new NvapiException("DRS_CreateSession", csRes); throw new NvapiException("DRS_CreateSession", csRes);
var nvRes = nvw.DRS_LoadSettings(GlobalSession); if (!preventLoadSettings)
if (nvRes != NvAPI_Status.NVAPI_OK) {
throw new NvapiException("DRS_LoadSettings", nvRes); var nvRes = nvw.DRS_LoadSettings(GlobalSession);
if (nvRes != NvAPI_Status.NVAPI_OK)
throw new NvapiException("DRS_LoadSettings", nvRes);
}
} }
} }
if (HoldSession && GlobalSession != IntPtr.Zero) if (GlobalSession != IntPtr.Zero)
{ {
return action(GlobalSession); return action(GlobalSession);
} }
return NonGlobalDrsSession<T>(action); throw new Exception(nameof(GlobalSession) + " is Zero!");
} }
public static void DestroyGlobalSession() public static void DestroyGlobalSession()
@@ -58,7 +61,7 @@ namespace nspector.Common
} }
} }
private static T NonGlobalDrsSession<T>(Func<IntPtr, T> action) private static T NonGlobalDrsSession<T>(Func<IntPtr, T> action, bool preventLoadSettings = false)
{ {
IntPtr hSession = IntPtr.Zero; IntPtr hSession = IntPtr.Zero;
var csRes = nvw.DRS_CreateSession(ref hSession); var csRes = nvw.DRS_CreateSession(ref hSession);
@@ -67,9 +70,12 @@ namespace nspector.Common
try try
{ {
var nvRes = nvw.DRS_LoadSettings(hSession); if (!preventLoadSettings)
if (nvRes != NvAPI_Status.NVAPI_OK) {
throw new NvapiException("DRS_LoadSettings", nvRes); var nvRes = nvw.DRS_LoadSettings(hSession);
if (nvRes != NvAPI_Status.NVAPI_OK)
throw new NvapiException("DRS_LoadSettings", nvRes);
}
return action(hSession); return action(hSession);
} }
@@ -82,6 +88,6 @@ namespace nspector.Common
} }
} }
} }
+70 -38
View File
@@ -1,24 +1,20 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Linq.Expressions;
using System.Text;
using nspector.Common.Meta; using nspector.Common.Meta;
using nspector.Common.CustomSettings; using nspector.Common.CustomSettings;
using nspector.Native.NVAPI2; using nspector.Native.NVAPI2;
using nspector.Native.NvApi.DriverSettings;
namespace nspector.Common namespace nspector.Common
{ {
internal class DrsSettingsMetaService internal class DrsSettingsMetaService
{ {
private ISettingMetaService ConstantMeta; private ISettingMetaService ConstantMeta;
private ISettingMetaService CustomMeta; private ISettingMetaService CustomMeta;
public ISettingMetaService DriverMeta; public ISettingMetaService DriverMeta;
private ISettingMetaService ScannedMeta; private ISettingMetaService ScannedMeta;
private ISettingMetaService ReferenceMeta; private ISettingMetaService ReferenceMeta;
private ISettingMetaService NvD3dUmxMeta;
private readonly CustomSettingNames _customSettings; private readonly CustomSettingNames _customSettings;
private readonly CustomSettingNames _referenceSettings; private readonly CustomSettingNames _referenceSettings;
@@ -39,7 +35,7 @@ namespace nspector.Common
{ {
settingMetaCache = new Dictionary<uint, SettingMeta>(); settingMetaCache = new Dictionary<uint, SettingMeta>();
MetaServices = new List<MetaServiceItem>(); MetaServices = new List<MetaServiceItem>();
CustomMeta = new CustomSettingMetaService(_customSettings); CustomMeta = new CustomSettingMetaService(_customSettings);
MetaServices.Add(new MetaServiceItem() { ValueNamePrio = 1, Service = CustomMeta }); MetaServices.Add(new MetaServiceItem() { ValueNamePrio = 1, Service = CustomMeta });
@@ -62,13 +58,10 @@ namespace nspector.Common
ReferenceMeta = new CustomSettingMetaService(_referenceSettings, SettingMetaSource.ReferenceSettings); ReferenceMeta = new CustomSettingMetaService(_referenceSettings, SettingMetaSource.ReferenceSettings);
MetaServices.Add(new MetaServiceItem() { ValueNamePrio = 4, Service = ReferenceMeta }); 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) private NVDRS_SETTING_TYPE? GetSettingValueType(uint settingId)
{ {
foreach (var service in MetaServices.OrderBy(x => x.Service.Source)) foreach (var service in MetaServices.OrderBy(x => x.Service.Source))
@@ -80,16 +73,26 @@ namespace nspector.Common
return NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE; return NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE;
} }
private string GetSettingName(uint settingId) 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); var settingName = service.Service.GetSettingName(settingId);
if (settingName != null)
if (!string.IsNullOrEmpty(settingName))
{
if (settingName.StartsWith("0x"))
{
hexCandidate = settingName;
continue;
}
return settingName; return settingName;
}
} }
return null; return hexCandidate;
} }
private string GetGroupName(uint settingId) private string GetGroupName(uint settingId)
@@ -123,7 +126,7 @@ namespace nspector.Common
if (settingDefault != null) if (settingDefault != null)
return settingDefault; return settingDefault;
} }
return null; return null;
} }
@@ -153,7 +156,7 @@ namespace nspector.Common
else else
{ {
var currentNonScannedValues = a.Where(xa => xa.ValueSource != SettingMetaSource.ScannedSettings).Select(xa => xa.Value).ToList(); var currentNonScannedValues = a.Where(xa => xa.ValueSource != SettingMetaSource.ScannedSettings).Select(xa => xa.Value).ToList();
var newNonScannedValues = b.Where(xb => !currentNonScannedValues.Contains(xb.Value)).ToList(); var newNonScannedValues = b.Where(xb => !currentNonScannedValues.Contains(xb.Value)).ToList();
a.AddRange(newNonScannedValues); a.AddRange(newNonScannedValues);
@@ -171,7 +174,7 @@ namespace nspector.Common
var atmp = a.FirstOrDefault(); var atmp = a.FirstOrDefault();
if (atmp != null && atmp is IComparable) if (atmp != null && atmp is IComparable)
return a.OrderBy(x=>x.Value).ToList(); return a.OrderBy(x => x.Value).ToList();
else else
return a.ToList(); return a.ToList();
} }
@@ -196,7 +199,7 @@ namespace nspector.Common
{ {
result = MergeSettingValues(result, service.Service.GetStringValues(settingId)); result = MergeSettingValues(result, service.Service.GetStringValues(settingId));
} }
return result; return result;
} }
@@ -211,15 +214,15 @@ namespace nspector.Common
if (result != null) 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("_NUM")
&& !x.ValueName.EndsWith("_MASK") && !x.ValueName.EndsWith("_MASK")
&& (!x.ValueName.EndsWith("_MIN") || x.ValueName.Equals("PREFERRED_PSTATE_PREFER_MIN")) && (!x.ValueName.EndsWith("_MIN") || x.ValueName.Equals("PREFERRED_PSTATE_PREFER_MIN"))
&& (!x.ValueName.EndsWith("_MAX") || x.ValueName.Equals("PREFERRED_PSTATE_PREFER_MAX")) && (!x.ValueName.EndsWith("_MAX") || x.ValueName.Equals("PREFERRED_PSTATE_PREFER_MAX"))
) )
group v by v.ValueName into g group v by v.ValueName into g
select g.First(t => t.ValueName == g.Key)) select g.First(t => t.ValueName == g.Key))
.OrderBy(v => v.ValueSource) .OrderBy(v => v.ValueSource)
.ThenBy(v => v.ValuePos) .ThenBy(v => v.ValuePos)
.ThenBy(v => v.ValueName).ToList(); .ThenBy(v => v.ValueName).ToList();
@@ -228,7 +231,7 @@ namespace nspector.Common
return result; return result;
} }
public List<uint> GetSettingIds(SettingViewMode viewMode) public List<uint> GetSettingIds(SettingViewMode viewMode)
{ {
var settingIds = new List<uint>(); var settingIds = new List<uint>();
@@ -249,22 +252,21 @@ namespace nspector.Common
switch (viewMode) switch (viewMode)
{ {
case SettingViewMode.CustomSettingsOnly: case SettingViewMode.CustomSettingsOnly:
return new [] { return new[] {
SettingMetaSource.CustomSettings SettingMetaSource.CustomSettings
}; };
case SettingViewMode.IncludeScannedSetttings: case SettingViewMode.IncludeScannedSetttings:
return new [] { return new[] {
SettingMetaSource.ConstantSettings, SettingMetaSource.ConstantSettings,
SettingMetaSource.ScannedSettings, SettingMetaSource.ScannedSettings,
SettingMetaSource.CustomSettings, SettingMetaSource.CustomSettings,
SettingMetaSource.DriverSettings, SettingMetaSource.DriverSettings,
SettingMetaSource.NvD3dUmxSettings,
SettingMetaSource.ReferenceSettings, SettingMetaSource.ReferenceSettings,
}; };
default: default:
return new [] { return new[] {
SettingMetaSource.CustomSettings, SettingMetaSource.CustomSettings,
SettingMetaSource.DriverSettings, SettingMetaSource.DriverSettings,
}; };
} }
} }
@@ -284,7 +286,6 @@ namespace nspector.Common
SettingMetaSource.ScannedSettings, SettingMetaSource.ScannedSettings,
SettingMetaSource.CustomSettings, SettingMetaSource.CustomSettings,
SettingMetaSource.DriverSettings, SettingMetaSource.DriverSettings,
SettingMetaSource.NvD3dUmxSettings,
SettingMetaSource.ReferenceSettings, SettingMetaSource.ReferenceSettings,
}; };
@@ -296,21 +297,27 @@ namespace nspector.Common
var settingType = GetSettingValueType(settingId); var settingType = GetSettingValueType(settingId);
var settingName = GetSettingName(settingId); var settingName = GetSettingName(settingId);
var groupName = GetGroupName(settingId); var groupName = GetGroupName(settingId);
if (groupName == null) if (groupName == null)
groupName = GetLegacyGroupName(settingId, settingName); groupName = GetLegacyGroupName(settingId, settingName);
var result = new SettingMeta() var result = new SettingMeta()
{ {
SettingType = settingType, SettingType = settingType,
SettingName = settingName, SettingName = settingName,
GroupName = groupName, GroupName = groupName,
DefaultDwordValue = IsApiExposed = GetIsApiExposed(settingId),
settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE IsSettingHidden = GetIsSettingHidden(settingId),
Description = GetDescription(settingId),
DefaultDwordValue =
settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE
? GetDwordDefaultValue(settingId) : 0, ? GetDwordDefaultValue(settingId) : 0,
DefaultStringValue = DefaultStringValue =
settingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE settingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE
? GetStringDefaultValue(settingId) : null, ? GetStringDefaultValue(settingId) : null,
@@ -344,6 +351,9 @@ namespace nspector.Common
SettingName = settingMeta.SettingName, SettingName = settingMeta.SettingName,
SettingType = settingMeta.SettingType, SettingType = settingMeta.SettingType,
GroupName = settingMeta.GroupName, GroupName = settingMeta.GroupName,
IsApiExposed = settingMeta.IsApiExposed,
IsSettingHidden = settingMeta.IsSettingHidden,
Description = settingMeta.Description,
}; };
if (string.IsNullOrEmpty(newMeta.SettingName)) if (string.IsNullOrEmpty(newMeta.SettingName))
@@ -402,5 +412,27 @@ namespace nspector.Common
return "Other"; return "Other";
} }
private bool GetIsApiExposed(uint settingId)
{
var driverMeta = MetaServices.FirstOrDefault(m => m.Service.Source == SettingMetaSource.DriverSettings);
return (driverMeta != null && driverMeta.Service.GetSettingIds().Contains(settingId));
}
private bool GetIsSettingHidden(uint settingId)
{
var csnMeta = MetaServices.FirstOrDefault(m => m.Service.Source == SettingMetaSource.CustomSettings);
return (csnMeta != null && ((CustomSettingMetaService)csnMeta.Service).IsSettingHidden(settingId));
}
private string GetDescription(uint settingId)
{
var csn = MetaServices.FirstOrDefault(m => m.Service.Source == SettingMetaSource.CustomSettings);
var csnDescription = csn != null ? ((CustomSettingMetaService)csn.Service).GetDescription(settingId) ?? "" : "";
var refs = MetaServices.FirstOrDefault(m => m.Service.Source == SettingMetaSource.ReferenceSettings);
var refsDescription = refs != null ? ((CustomSettingMetaService)refs.Service).GetDescription(settingId) ?? "" : "";
return !string.IsNullOrEmpty(csnDescription) ? csnDescription : refsDescription;
}
} }
} }
+115 -53
View File
@@ -1,12 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Windows.Forms;
using nspector.Common.Helper; using nspector.Common.Helper;
using nspector.Common.Meta; using nspector.Common.Meta;
using nspector.Native.NVAPI2; using nspector.Native.NVAPI2;
@@ -38,6 +35,22 @@ namespace nspector.Common
private string GetDrsProgramPath() private string GetDrsProgramPath()
{ {
var nvidiaInstallerFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"NVIDIA Corporation\Installer2");
var driverFolders = Directory.EnumerateDirectories(nvidiaInstallerFolder, "Display.Driver.*");
foreach (var folder in driverFolders)
{
var fiDbInstaller = new FileInfo(Path.Combine(folder, "dbInstaller.exe"));
if (!fiDbInstaller.Exists) continue;
var fviDbInstaller = FileVersionInfo.GetVersionInfo(fiDbInstaller.FullName);
var fileversion = fviDbInstaller.FileVersion.Replace(".", "");
var driverver = DriverVersion.ToString().Replace(",", "").Replace(".", "");
if (fileversion.EndsWith(driverver))
return fiDbInstaller.DirectoryName;
}
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
@"NVIDIA Corporation\Drs"); @"NVIDIA Corporation\Drs");
} }
@@ -59,45 +72,56 @@ namespace nspector.Common
public void DeleteAllProfilesHard() public void DeleteAllProfilesHard()
{ {
var tmpFile = Path.GetTempFileName(); var tmpFile = TempFile.GetTempFileName();
File.WriteAllText(tmpFile, "BaseProfile \"Base Profile\"\r\nProfile \"Base Profile\"\r\nShowOn All\r\nProfileType Global\r\nEndProfile\r\n"); try
DrsSession((hSession) =>
{ {
LoadSettingsFileEx(hSession, tmpFile); File.WriteAllText(tmpFile, "BaseProfile \"Base Profile\"\r\nSelectedGlobalProfile \"Base Profile\"\r\nProfile \"Base Profile\"\r\nShowOn All\r\nProfileType Global\r\nEndProfile\r\n");
SaveSettings(hSession);
});
if (File.Exists(tmpFile)) DrsSession((hSession) =>
File.Delete(tmpFile); {
LoadSettingsFileEx(hSession, tmpFile);
SaveSettings(hSession);
}, forceNonGlobalSession: true, preventLoadSettings: true);
}
finally
{
if (File.Exists(tmpFile))
File.Delete(tmpFile);
}
} }
public void DeleteProfileHard(string profileName) public void DeleteProfileHard(string profileName)
{ {
var tmpFileName = Path.GetTempFileName(); var tmpFileName = TempFile.GetTempFileName();
var tmpFileContent = "";
DrsSession((hSession) => try
{ {
SaveSettingsFileEx(hSession, tmpFileName); var tmpFileContent = "";
tmpFileContent = File.ReadAllText(tmpFileName);
string pattern = "(?<rpl>\nProfile\\s\"" + Regex.Escape(profileName) + "\".*?EndProfile.*?\n)";
tmpFileContent = Regex.Replace(tmpFileContent, pattern, "", RegexOptions.Singleline);
File.WriteAllText(tmpFileName, tmpFileContent);
});
if (tmpFileContent != "")
{
DrsSession((hSession) => DrsSession((hSession) =>
{ {
LoadSettingsFileEx(hSession, tmpFileName); SaveSettingsFileEx(hSession, tmpFileName);
SaveSettings(hSession); tmpFileContent = File.ReadAllText(tmpFileName);
string pattern = "(?<rpl>\nProfile\\s\"" + Regex.Escape(profileName) + "\".*?EndProfile.*?\n)";
tmpFileContent = Regex.Replace(tmpFileContent, pattern, "", RegexOptions.Singleline);
File.WriteAllText(tmpFileName, tmpFileContent);
}); });
}
if (File.Exists(tmpFileName)) if (tmpFileContent != "")
File.Delete(tmpFileName); {
DrsSession((hSession) =>
{
LoadSettingsFileEx(hSession, tmpFileName);
SaveSettings(hSession);
});
}
}
finally
{
if (File.Exists(tmpFileName))
File.Delete(tmpFileName);
}
} }
public void DeleteProfile(string profileName) public void DeleteProfile(string profileName)
@@ -110,13 +134,13 @@ namespace nspector.Common
var nvRes = nvw.DRS_DeleteProfile(hSession, hProfile); var nvRes = nvw.DRS_DeleteProfile(hSession, hProfile);
if (nvRes != NvAPI_Status.NVAPI_OK) if (nvRes != NvAPI_Status.NVAPI_OK)
throw new NvapiException("DRS_DeleteProfile", nvRes); throw new NvapiException("DRS_DeleteProfile", nvRes);
SaveSettings(hSession); SaveSettings(hSession);
} }
}); });
} }
public List<string> GetProfileNames(ref string baseProfileName) public List<string> GetProfileNames(ref string baseProfileName)
{ {
var lstResult = new List<string>(); var lstResult = new List<string>();
@@ -127,7 +151,7 @@ namespace nspector.Common
var hBase = GetProfileHandle(hSession, null); var hBase = GetProfileHandle(hSession, null);
var baseProfile = GetProfileInfo(hSession, hBase); var baseProfile = GetProfileInfo(hSession, hBase);
tmpBaseProfileName = baseProfile.profileName; tmpBaseProfileName = baseProfile.profileName;
lstResult.Add("_GLOBAL_DRIVER_PROFILE (" + tmpBaseProfileName + ")"); lstResult.Add("_GLOBAL_DRIVER_PROFILE (" + tmpBaseProfileName + ")");
var profileHandles = EnumProfileHandles(hSession); var profileHandles = EnumProfileHandles(hSession);
@@ -151,7 +175,7 @@ namespace nspector.Common
DrsSession((hSession) => DrsSession((hSession) =>
{ {
var hProfile = CreateProfile(hSession, profileName); var hProfile = CreateProfile(hSession, profileName);
if (applicationName != null) if (applicationName != null)
AddApplication(hSession, hProfile, applicationName); AddApplication(hSession, hProfile, applicationName);
@@ -228,7 +252,7 @@ namespace nspector.Common
var nvRes = nvw.DRS_RestoreProfileDefaultSetting(hSession, hProfile, settingId); var nvRes = nvw.DRS_RestoreProfileDefaultSetting(hSession, hProfile, settingId);
if (nvRes != NvAPI_Status.NVAPI_OK) if (nvRes != NvAPI_Status.NVAPI_OK)
throw new NvapiException("DRS_RestoreProfileDefaultSetting", nvRes); throw new NvapiException("DRS_RestoreProfileDefaultSetting", nvRes);
SaveSettings(hSession); SaveSettings(hSession);
var modifyCount = 0; var modifyCount = 0;
@@ -248,14 +272,47 @@ namespace nspector.Common
removeFromModified = tmpRemoveFromModified; removeFromModified = tmpRemoveFromModified;
} }
public uint GetDwordValueFromProfile(string profileName, uint settingId, bool returnDefaultValue = false) public void DeleteValue(string profileName, uint settingId, out bool removeFromModified)
{
var tmpRemoveFromModified = false;
DrsSession((hSession) =>
{
var hProfile = GetProfileHandle(hSession, profileName);
if (hProfile != IntPtr.Zero)
{
int dropCount = 0;
var settings = GetProfileSettings(hSession, hProfile);
foreach (var setting in settings)
{
if (setting.settingId != settingId) continue;
if (setting.settingLocation == NVDRS_SETTING_LOCATION.NVDRS_CURRENT_PROFILE_LOCATION)
{
if (nvw.DRS_DeleteProfileSetting(hSession, hProfile, setting.settingId) == NvAPI_Status.NVAPI_OK)
{
dropCount++;
break;
}
}
}
tmpRemoveFromModified = (dropCount == 0);
SaveSettings(hSession);
}
});
removeFromModified = tmpRemoveFromModified;
}
public uint GetDwordValueFromProfile(string profileName, uint settingId, bool returnDefaultValue = false, bool forceDedicatedScope = false)
{ {
return DrsSession((hSession) => return DrsSession((hSession) =>
{ {
var hProfile = GetProfileHandle(hSession, profileName); var hProfile = GetProfileHandle(hSession, profileName);
var dwordValue = ReadDwordValue(hSession, hProfile, settingId); var dwordValue = ReadDwordValue(hSession, hProfile, settingId);
if (dwordValue != null) if (dwordValue != null)
return dwordValue.Value; return dwordValue.Value;
else if (returnDefaultValue) else if (returnDefaultValue)
@@ -275,7 +332,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) => DrsSession((hSession) =>
{ {
@@ -308,7 +365,7 @@ namespace nspector.Common
return 0; return 0;
} }
private SettingItem CreateSettingItem(NVDRS_SETTING setting, bool useDefault = false) private SettingItem CreateSettingItem(NVDRS_SETTING setting, bool useDefault = false)
{ {
@@ -418,11 +475,13 @@ namespace nspector.Common
ValueText = valueText, ValueText = valueText,
State = settingState, State = settingState,
IsStringValue = settingMeta.SettingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE, IsStringValue = settingMeta.SettingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE,
IsApiExposed = settingMeta.IsApiExposed,
IsSettingHidden = settingMeta.IsSettingHidden,
}; };
} }
public List<SettingItem> GetSettingsForProfile(string profileName, SettingViewMode viewMode, ref List<string> applications)
public List<SettingItem> GetSettingsForProfile(string profileName, SettingViewMode viewMode, ref Dictionary<string, string> applications)
{ {
var result = new List<SettingItem>(); var result = new List<SettingItem>();
var settingIds = meta.GetSettingIds(viewMode); var settingIds = meta.GetSettingIds(viewMode);
@@ -432,7 +491,7 @@ namespace nspector.Common
applications = DrsSession((hSession) => applications = DrsSession((hSession) =>
{ {
var hProfile = GetProfileHandle(hSession, profileName); var hProfile = GetProfileHandle(hSession, profileName);
var profileSettings = GetProfileSettings(hSession, hProfile); var profileSettings = GetProfileSettings(hSession, hProfile);
foreach (var profileSetting in profileSettings) foreach (var profileSetting in profileSettings)
{ {
@@ -444,6 +503,8 @@ namespace nspector.Common
foreach (var settingId in settingIds) foreach (var settingId in settingIds)
{ {
if (settingId == 0) continue;
var setting = ReadSetting(hSession, hProfile, settingId); var setting = ReadSetting(hSession, hProfile, settingId);
if (setting != null) if (setting != null)
result.Add(CreateSettingItem(setting.Value)); result.Add(CreateSettingItem(setting.Value));
@@ -455,11 +516,11 @@ namespace nspector.Common
} }
return GetProfileApplications(hSession, hProfile) return GetProfileApplications(hSession, hProfile)
.Select(x => x.appName).ToList(); ; .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) public void AddApplication(string profileName, string applicationName)
@@ -472,26 +533,27 @@ namespace nspector.Common
}); });
} }
public void DeleteApplication(string profileName, string applicationName) public void RemoveApplication(string profileName, string applicationFingerprint)
{ {
DrsSession((hSession) => DrsSession((hSession) =>
{ {
var hProfile = GetProfileHandle(hSession, profileName); var hProfile = GetProfileHandle(hSession, profileName);
DeleteApplication(hSession, hProfile, applicationName); var applications = GetProfileApplications(hSession, hProfile);
foreach (var app in applications)
{
if (GetApplicationFingerprint(app) != applicationFingerprint) continue;
DeleteApplication(hSession, hProfile, app);
break;
}
SaveSettings(hSession); SaveSettings(hSession);
}); });
} }
public List<string> GetApplications(string profileName) private string GetApplicationFingerprint(NVDRS_APPLICATION_V3 application)
{ {
return DrsSession((hSession) => return $"{application.appName}|{application.fileInFolder}|{application.userFriendlyName}|{application.launcher}";
{
var hProfile = GetProfileHandle(hSession, profileName);
var applications = GetProfileApplications(hSession, hProfile);
return applications.Select(x => x.appName).ToList();
});
} }
} }
} }
+7 -7
View File
@@ -41,18 +41,18 @@ namespace nspector.Common
return result; return result;
} }
protected void DrsSession(Action<IntPtr> action) protected void DrsSession(Action<IntPtr> action, bool forceNonGlobalSession = false, bool preventLoadSettings = false)
{ {
DrsSessionScope.DrsSession<bool>((hSession) => DrsSessionScope.DrsSession<bool>((hSession) =>
{ {
action(hSession); action(hSession);
return true; return true;
}); }, forceNonGlobalSession: forceNonGlobalSession, preventLoadSettings: preventLoadSettings);
} }
protected T DrsSession<T>(Func<IntPtr, T> action) protected T DrsSession<T>(Func<IntPtr, T> action, bool forceDedicatedScope = false)
{ {
return DrsSessionScope.DrsSession<T>(action); return DrsSessionScope.DrsSession<T>(action, forceDedicatedScope);
} }
protected IntPtr GetProfileHandle(IntPtr hSession, string profileName) protected IntPtr GetProfileHandle(IntPtr hSession, string profileName)
@@ -227,9 +227,9 @@ namespace nspector.Common
} }
protected void DeleteApplication(IntPtr hSession, IntPtr hProfile, string applicationName) protected void DeleteApplication(IntPtr hSession, IntPtr hProfile, NVDRS_APPLICATION_V3 application)
{ {
var caRes = nvw.DRS_DeleteApplication(hSession, hProfile, new StringBuilder(applicationName)); var caRes = nvw.DRS_DeleteApplicationEx(hSession, hProfile, ref application);
if (caRes != NvAPI_Status.NVAPI_OK) if (caRes != NvAPI_Status.NVAPI_OK)
throw new NvapiException("DRS_DeleteApplication", caRes); throw new NvapiException("DRS_DeleteApplication", caRes);
} }
@@ -262,7 +262,7 @@ namespace nspector.Common
protected List<NVDRS_SETTING> GetProfileSettings(IntPtr hSession, IntPtr hProfile) protected List<NVDRS_SETTING> GetProfileSettings(IntPtr hSession, IntPtr hProfile)
{ {
uint settingCount = 512; uint settingCount = 512;
var settings = new NVDRS_SETTING[512]; var settings = new NVDRS_SETTING[settingCount];
settings[0].version = NvapiDrsWrapper.NVDRS_SETTING_VER; settings[0].version = NvapiDrsWrapper.NVDRS_SETTING_VER;
var esRes = NvapiDrsWrapper.DRS_EnumSettings(hSession, hProfile, 0, ref settingCount, ref settings); var esRes = NvapiDrsWrapper.DRS_EnumSettings(hSession, hProfile, 0, ref settingCount, ref settings);
+4 -6
View File
@@ -1,16 +1,14 @@
using nspector.Common.Meta; using nspector.Common.Meta;
using System; using System;
using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using System.Text;
namespace nspector.Common namespace nspector.Common
{ {
public static class DrsUtil public static class DrsUtil
{ {
public static string StringValueRaw = "Text"; public static string StringValueRaw = "Text";
public static string GetDwordString(uint dword) public static string GetDwordString(uint dword)
{ {
return string.Format("0x{0:X8}", dword); return string.Format("0x{0:X8}", dword);
@@ -19,7 +17,7 @@ namespace nspector.Common
public static uint ParseDwordByInputSafe(string input) public static uint ParseDwordByInputSafe(string input)
{ {
uint result = 0; uint result = 0;
if (input.ToLower().StartsWith("0x")) if (input.ToLowerInvariant().StartsWith("0x"))
{ {
try try
{ {
@@ -50,12 +48,12 @@ namespace nspector.Common
var settingValue = meta.DwordValues var settingValue = meta.DwordValues
.FirstOrDefault(x => x.Value.Equals(dwordValue)); .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) internal static string ParseStringSettingValue(SettingMeta meta, string text)
{ {
var valueByName = meta.StringValues.FirstOrDefault(x => x.ValueName != null && x.ValueName.Equals(text)); var valueByName = meta.StringValues?.FirstOrDefault(x => x.ValueName != null && x.ValueName.Equals(text));
if (valueByName != null) if (valueByName != null)
return valueByName.Value; return valueByName.Value;
+2 -2
View File
@@ -9,9 +9,9 @@ namespace nspector.Common.Helper
{ {
var identity = WindowsIdentity.GetCurrent(); var identity = WindowsIdentity.GetCurrent();
var principal = new WindowsPrincipal(identity); var principal = new WindowsPrincipal(identity);
isAdmin = principal.IsInRole(WindowsBuiltInRole.Administrator); isAdmin = principal.IsInRole(WindowsBuiltInRole.Administrator);
} }
public static bool IsAdmin public static bool IsAdmin
{ {
get { return isAdmin; } get { return isAdmin; }
@@ -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);
}
}
}
+14 -8
View File
@@ -8,6 +8,7 @@ namespace nspector.Common.Helper
{ {
internal class InputBox internal class InputBox
{ {
internal static DialogResult Show(string title, string promptText, ref string value, List<string> invalidInputs, string mandatoryFormatRegExPattern, int maxLength) internal static DialogResult Show(string title, string promptText, ref string value, List<string> invalidInputs, string mandatoryFormatRegExPattern, int maxLength)
{ {
var form = new Form(); var form = new Form();
@@ -17,7 +18,7 @@ namespace nspector.Common.Helper
var buttonCancel = new Button(); var buttonCancel = new Button();
var imageBox = new PictureBox(); 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); bool mandatory_success = Regex.IsMatch(textBox.Text, mandatoryFormatRegExPattern);
@@ -59,12 +60,12 @@ namespace nspector.Common.Helper
buttonOk.Enabled = false; buttonOk.Enabled = false;
label.SetBounds(9, 20, 372, 13); label.SetBounds(Dpi(9), Dpi(20), Dpi(372), Dpi(13));
textBox.SetBounds(12, 36, 352, 20); textBox.SetBounds(Dpi(12), Dpi(36), Dpi(352), Dpi(20));
buttonOk.SetBounds(228, 72, 75, 23); buttonOk.SetBounds(Dpi(228), Dpi(72), Dpi(75), Dpi(23));
buttonCancel.SetBounds(309, 72, 75, 23); buttonCancel.SetBounds(Dpi(309), Dpi(72), Dpi(75), Dpi(23));
imageBox.SetBounds(368, 36, 16, 16); imageBox.SetBounds(Dpi(368), Dpi(36), Dpi(16), Dpi(16));
label.AutoSize = true; label.AutoSize = true;
imageBox.Anchor = AnchorStyles.Top | AnchorStyles.Right; imageBox.Anchor = AnchorStyles.Top | AnchorStyles.Right;
@@ -72,9 +73,9 @@ namespace nspector.Common.Helper
buttonOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
form.ClientSize = new Size(396, 107); form.ClientSize = new Size(Dpi(396), Dpi(107));
form.ClientSize = new Size(Math.Max(Dpi(300), label.Right + Dpi(10)), form.ClientSize.Height);
form.Controls.AddRange(new Control[] { label, textBox, imageBox, buttonOk, buttonCancel }); form.Controls.AddRange(new Control[] { label, textBox, imageBox, buttonOk, buttonCancel });
form.ClientSize = new Size(Math.Max(300, label.Right + 10), form.ClientSize.Height);
form.FormBorderStyle = FormBorderStyle.FixedDialog; form.FormBorderStyle = FormBorderStyle.FixedDialog;
form.StartPosition = FormStartPosition.CenterParent; form.StartPosition = FormStartPosition.CenterParent;
form.MinimizeBox = false; form.MinimizeBox = false;
@@ -88,5 +89,10 @@ namespace nspector.Common.Helper
value = textBox.Text; value = textBox.Text;
return dialogResult; return dialogResult;
} }
private static int Dpi(int input)
{
return (int)Math.Round(input * frmDrvSettings.ScaleFactor);
}
} }
} }
@@ -1,7 +1,4 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace nspector.Common.Helper namespace nspector.Common.Helper
+4 -8
View File
@@ -1,8 +1,4 @@
using System; using System.IO;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using nspector.Native.WINAPI; using nspector.Native.WINAPI;
namespace nspector.Common.Helper namespace nspector.Common.Helper
@@ -34,7 +30,7 @@ namespace nspector.Common.Helper
try try
{ {
switch (fileInfo.Extension.ToLower()) switch (fileInfo.Extension.ToLowerInvariant())
{ {
case ".lnk": return ResolveFromShellLinkFile(fileInfo.FullName); case ".lnk": return ResolveFromShellLinkFile(fileInfo.FullName);
case ".url": return ResolveFromUrlFile(fileInfo.FullName); case ".url": return ResolveFromUrlFile(fileInfo.FullName);
@@ -58,7 +54,7 @@ namespace nspector.Common.Helper
} }
var targetInfo = new FileInfo(shellLink.Target); var targetInfo = new FileInfo(shellLink.Target);
if (targetInfo.Name.ToLower() == SteamAppResolver.SteamExeName) if (targetInfo.Name.ToLowerInvariant() == SteamAppResolver.SteamExeName)
{ {
if (shellLink.Arguments.Contains(SteamAppResolver.SteamArgumentPattern)) if (shellLink.Arguments.Contains(SteamAppResolver.SteamArgumentPattern))
{ {
@@ -67,7 +63,7 @@ namespace nspector.Common.Helper
} }
} }
if (targetInfo.Extension.ToLower().Equals(".exe")) if (targetInfo.Extension.ToLowerInvariant().Equals(".exe"))
{ {
return targetInfo.Name; return targetInfo.Name;
} }
+3 -4
View File
@@ -1,7 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Microsoft.Win32; using Microsoft.Win32;
@@ -36,7 +35,7 @@ namespace nspector.Common.Helper
if (steamPath != null) if (steamPath != null)
return Path.Combine(steamPath, @"appcache\appinfo.vdf"); return Path.Combine(steamPath, @"appcache\appinfo.vdf");
} }
return ""; return "";
} }
@@ -90,7 +89,7 @@ namespace nspector.Common.Helper
var bid = BitConverter.GetBytes(appid); var bid = BitConverter.GetBytes(appid);
int offset = 0; int offset = 0;
var appidPattern = new byte[] { 0x08, bid[0], bid[1], bid[2], bid[3] }; 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 }; 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) private static int FindOffset(byte[] bytes, byte[] pattern, int offset = 0, byte? wildcard = null)
{ {
for (int i = offset; i < bytes.Length; i++) for (int i = offset; i < bytes.Length; i++)
+24
View File
@@ -0,0 +1,24 @@
using System;
using System.IO;
namespace nspector.Common.Helper
{
internal static class TempFile
{
public static string GetTempFileName()
{
while (true)
{
var tempFile = GenerateTempFileName();
if (!File.Exists(tempFile))
return tempFile;
}
}
private static string GenerateTempFileName()
{
return Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString().Replace("-", ""));
}
}
}
+54
View File
@@ -0,0 +1,54 @@
using System;
using System.IO;
using System.Text;
using System.Windows.Forms;
namespace nspector.Common.Helper
{
public class UserSettings
{
public int WindowTop { get; set; }
public int WindowLeft { get; set; }
public int WindowWidth { get; set; }
public int WindowHeight { get; set; }
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"); ;
}
public void SaveSettings()
{
XMLHelper<UserSettings>.SerializeToXmlFile(this, GetSettingsFilename(), Encoding.Unicode, true);
}
public static UserSettings LoadSettings()
{
var filename = GetSettingsFilename();
if (!File.Exists(filename)) return new UserSettings();
try
{
return XMLHelper<UserSettings>.DeserializeFromXMLFile(GetSettingsFilename());
}
catch
{
return new UserSettings();
}
}
}
}
+1 -3
View File
@@ -11,9 +11,7 @@ namespace nspector.Common.Helper
static XMLHelper() static XMLHelper()
{ {
//TODO: Fix It! xmlSerializer = new XmlSerializer(typeof(T));
//xmlSerializer = new XmlSerializer(typeof(T));
xmlSerializer = XmlSerializer.FromTypes(new[]{typeof(T)})[0];
} }
internal static string SerializeToXmlString(T xmlObject, Encoding encoding, bool removeNamespace) internal static string SerializeToXmlString(T xmlObject, Encoding encoding, bool removeNamespace)
@@ -1,7 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using nspector.Native.NVAPI2; using nspector.Native.NVAPI2;
namespace nspector.Common.Import namespace nspector.Common.Import
+1 -1
View File
@@ -10,7 +10,7 @@ namespace nspector.Common.Import
[XmlElement(ElementName = "SettingID")] [XmlElement(ElementName = "SettingID")]
public uint SettingId = 0; public uint SettingId = 0;
public string SettingValue = "0"; public string SettingValue = "0";
public SettingValueType ValueType = SettingValueType.Dword; public SettingValueType ValueType = SettingValueType.Dword;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace nspector.Common.Import namespace nspector.Common.Import
{ {
public enum SettingValueType: int public enum SettingValueType : int
{ {
Dword, Dword,
AnsiString, AnsiString,
@@ -2,7 +2,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text;
using nspector.Native.NvApi.DriverSettings; using nspector.Native.NvApi.DriverSettings;
using nspector.Native.NVAPI2; using nspector.Native.NVAPI2;
@@ -19,7 +18,7 @@ namespace nspector.Common.Meta
private readonly Dictionary<ESetting, Type> settingEnumTypeCache; 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" }; "TOTAL_SETTING_NUM", "INVALID_SETTING_ID" };
private Dictionary<ESetting, Type> CreateSettingEnumTypeCache() private Dictionary<ESetting, Type> CreateSettingEnumTypeCache()
@@ -3,7 +3,6 @@ using nspector.Native.NVAPI2;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
namespace nspector.Common.Meta namespace nspector.Common.Meta
{ {
@@ -21,7 +20,26 @@ namespace nspector.Common.Meta
public NVDRS_SETTING_TYPE? GetSettingValueType(uint settingId) public NVDRS_SETTING_TYPE? GetSettingValueType(uint settingId)
{ {
return null; var setting = customSettings.Settings
.FirstOrDefault(x => x.SettingId.Equals(settingId));
return MapType(setting?.DataType);
}
private NVDRS_SETTING_TYPE? MapType(string type)
{
if (string.IsNullOrEmpty(type)) return null;
switch(type.ToLowerInvariant())
{
case "dword":
return NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE;
case "string":
return NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE;
case "binary":
return NVDRS_SETTING_TYPE.NVDRS_BINARY_TYPE;
default: throw new ArgumentOutOfRangeException(type);
}
} }
public string GetSettingName(uint settingId) public string GetSettingName(uint settingId)
@@ -74,11 +92,11 @@ namespace nspector.Common.Meta
return null; return null;
} }
public List<uint> GetSettingIds() public List<uint> GetSettingIds()
{ {
return customSettings.Settings return customSettings.Settings
.Select(x => x.SettingId).ToList(); .Select(x => x.SettingId).ToList();
} }
@@ -103,6 +121,22 @@ namespace nspector.Common.Meta
return null; return null;
} }
public bool IsSettingHidden(uint settingId)
{
var setting = customSettings.Settings
.FirstOrDefault(x => x.SettingId.Equals(settingId));
return setting?.Hidden ?? false;
}
public string GetDescription(uint settingId)
{
var setting = customSettings.Settings
.FirstOrDefault(x => x.SettingId.Equals(settingId));
return setting?.Description;
}
public SettingMetaSource Source public SettingMetaSource Source
{ {
get { return _source; } get { return _source; }
@@ -1,13 +1,7 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text; using System.Text;
using nspector.Common.CustomSettings;
using nspector.Native.NvApi.DriverSettings;
using nspector.Native.NVAPI2; using nspector.Native.NVAPI2;
using nvw = nspector.Native.NVAPI2.NvapiDrsWrapper; using nvw = nspector.Native.NVAPI2.NvapiDrsWrapper;
namespace nspector.Common.Meta namespace nspector.Common.Meta
{ {
@@ -26,16 +20,21 @@ namespace nspector.Common.Meta
private List<uint> InitSettingIds() private List<uint> InitSettingIds()
{ {
var settingIds = new List<uint>(); var settingIds = new List<uint>();
var nvRes = nvw.DRS_EnumAvailableSettingIds(out settingIds, 512); var nvRes = nvw.DRS_EnumAvailableSettingIds(out settingIds, 512);
if (nvRes != NvAPI_Status.NVAPI_OK) if (nvRes != NvAPI_Status.NVAPI_OK)
throw new NvapiException("DRS_EnumAvailableSettingIds", nvRes); throw new NvapiException("DRS_EnumAvailableSettingIds", nvRes);
return settingIds; return settingIds;
} }
private SettingMeta GetDriverSettingMetaInternal(uint settingId) private SettingMeta GetDriverSettingMetaInternal(uint settingId)
{ {
// temporary fix for 571.96 overflow bug by emoose
if ((settingId & 0xFFFFF000) == 0x10c7d000)
return null;
var values = new NVDRS_SETTING_VALUES(); var values = new NVDRS_SETTING_VALUES();
values.version = nvw.NVDRS_SETTING_VALUES_VER; values.version = nvw.NVDRS_SETTING_VALUES_VER;
uint valueCount = 255; uint valueCount = 255;
@@ -44,10 +43,10 @@ namespace nspector.Common.Meta
if (nvRes == NvAPI_Status.NVAPI_SETTING_NOT_FOUND) if (nvRes == NvAPI_Status.NVAPI_SETTING_NOT_FOUND)
return null; return null;
if (nvRes != NvAPI_Status.NVAPI_OK) if (nvRes != NvAPI_Status.NVAPI_OK)
throw new NvapiException("DRS_EnumAvailableSettingValues", nvRes); throw new NvapiException("DRS_EnumAvailableSettingValues", nvRes);
var sbSettingName = new StringBuilder((int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX); var sbSettingName = new StringBuilder((int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX);
nvRes = nvw.DRS_GetSettingNameFromId(settingId, sbSettingName); nvRes = nvw.DRS_GetSettingNameFromId(settingId, sbSettingName);
@@ -58,11 +57,12 @@ namespace nspector.Common.Meta
if (string.IsNullOrWhiteSpace(settingName)) if (string.IsNullOrWhiteSpace(settingName))
settingName = DrsUtil.GetDwordString(settingId); settingName = DrsUtil.GetDwordString(settingId);
var result = new SettingMeta { var result = new SettingMeta
{
SettingType = values.settingType, SettingType = values.settingType,
SettingName = settingName, SettingName = settingName,
}; };
if (values.settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE) if (values.settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE)
{ {
@@ -71,13 +71,14 @@ namespace nspector.Common.Meta
for (int i = 0; i < values.numSettingValues; i++) for (int i = 0; i < values.numSettingValues; i++)
{ {
result.DwordValues.Add( result.DwordValues.Add(
new SettingValue<uint> (Source) { new SettingValue<uint>(Source)
{
Value = values.settingValues[i].dwordValue, Value = values.settingValues[i].dwordValue,
ValueName = DrsUtil.GetDwordString(values.settingValues[i].dwordValue), ValueName = DrsUtil.GetDwordString(values.settingValues[i].dwordValue),
}); });
} }
} }
if (values.settingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE) if (values.settingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE)
{ {
result.DefaultStringValue = values.defaultValue.stringValue; result.DefaultStringValue = values.defaultValue.stringValue;
@@ -116,7 +117,7 @@ namespace nspector.Common.Meta
} }
} }
return result; return result;
} }
private SettingMeta GetSettingsMeta(uint settingId) private SettingMeta GetSettingsMeta(uint settingId)
@@ -135,13 +136,13 @@ namespace nspector.Common.Meta
return null; return null;
} }
} }
public string GetSettingName(uint settingId) public string GetSettingName(uint settingId)
{ {
var settingMeta = GetSettingsMeta(settingId); var settingMeta = GetSettingsMeta(settingId);
if (settingMeta != null) if (settingMeta != null)
return settingMeta.SettingName; return settingMeta.SettingName;
return null; return null;
} }
@@ -180,7 +181,7 @@ namespace nspector.Common.Meta
return null; return null;
} }
public List<uint> GetSettingIds() public List<uint> GetSettingIds()
{ {
return _settingIds; return _settingIds;
@@ -194,7 +195,7 @@ namespace nspector.Common.Meta
return null; return null;
} }
public string GetGroupName(uint settingId) public string GetGroupName(uint settingId)
{ {
return null; return null;
+1 -1
View File
@@ -8,7 +8,7 @@ namespace nspector.Common.Meta
{ {
internal interface ISettingMetaService internal interface ISettingMetaService
{ {
SettingMetaSource Source {get; } SettingMetaSource Source { get; }
NVDRS_SETTING_TYPE? GetSettingValueType(uint settingId); NVDRS_SETTING_TYPE? GetSettingValueType(uint settingId);
@@ -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; }
}
}
}
@@ -31,7 +31,7 @@ namespace nspector.Common.Meta
public string GetSettingName(uint settingId) 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) if (cached != null)
return string.Format("0x{0:X8} ({1} Profiles)", settingId, cached.ProfileCount); 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) 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) if (cached != null)
return cached.SettingValues.Select(s => new SettingValue<uint>(Source) return cached.SettingValues.Select(s => new SettingValue<uint>(Source)
{ {
+6 -3
View File
@@ -1,8 +1,5 @@
using nspector.Native.NVAPI2; using nspector.Native.NVAPI2;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace nspector.Common.Meta namespace nspector.Common.Meta
{ {
@@ -20,6 +17,12 @@ namespace nspector.Common.Meta
public byte[] DefaultBinaryValue { get; set; } public byte[] DefaultBinaryValue { get; set; }
public bool IsApiExposed { get; set; }
public bool IsSettingHidden { get; set; }
public string Description { get; set; }
public List<SettingValue<string>> StringValues { get; set; } public List<SettingValue<string>> StringValues { get; set; }
public List<SettingValue<uint>> DwordValues { get; set; } public List<SettingValue<uint>> DwordValues { get; set; }
+2 -8
View File
@@ -1,9 +1,4 @@
using System; namespace nspector.Common.Meta
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace nspector.Common.Meta
{ {
public enum SettingMetaSource public enum SettingMetaSource
{ {
@@ -11,7 +6,6 @@ namespace nspector.Common.Meta
DriverSettings = 20, DriverSettings = 20,
ConstantSettings = 30, ConstantSettings = 30,
ReferenceSettings = 40, ReferenceSettings = 40,
NvD3dUmxSettings = 50, ScannedSettings = 50,
ScannedSettings = 60,
} }
} }
+3 -8
View File
@@ -1,9 +1,4 @@
using System; namespace nspector.Common.Meta
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace nspector.Common.Meta
{ {
internal class SettingValue<T> internal class SettingValue<T>
{ {
@@ -14,7 +9,7 @@ namespace nspector.Common.Meta
{ {
ValueSource = source; ValueSource = source;
} }
public int ValuePos { get; set; } public int ValuePos { get; set; }
public string ValueName { get; set; } public string ValueName { get; set; }
public T Value { get; set; } public T Value { get; set; }
@@ -26,6 +21,6 @@ namespace nspector.Common.Meta
return string.Format("Value={0}; ValueName={1};", Value, ValueName); return string.Format("Value={0}; ValueName={1};", Value, ValueName);
} }
} }
} }
-3
View File
@@ -1,7 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using nspector.Native.NVAPI2; using nspector.Native.NVAPI2;
namespace nspector.Common namespace nspector.Common
+6 -7
View File
@@ -1,9 +1,4 @@
using System; namespace nspector.Common
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace nspector.Common
{ {
internal enum SettingState internal enum SettingState
@@ -17,7 +12,7 @@ namespace nspector.Common
internal class SettingItem internal class SettingItem
{ {
public uint SettingId { get; set; } public uint SettingId { get; set; }
public string SettingText { get; set; } public string SettingText { get; set; }
public string ValueText { get; set; } public string ValueText { get; set; }
@@ -30,6 +25,10 @@ namespace nspector.Common
public bool IsStringValue { get; set; } public bool IsStringValue { get; set; }
public bool IsApiExposed { get; set; }
public bool IsSettingHidden { get; set; }
public override string ToString() public override string ToString()
{ {
return string.Format("{0}; 0x{1:X8}; {2}; {3}; {4};", State, SettingId, SettingText, ValueText, ValueRaw); return string.Format("{0}; 0x{1:X8}; {2}; {3}; {4};", State, SettingId, SettingText, ValueText, ValueRaw);
+1 -6
View File
@@ -1,9 +1,4 @@
using System; namespace nspector.Common
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace nspector.Common
{ {
public enum SettingViewMode public enum SettingViewMode
{ {
File diff suppressed because it is too large. Load diff
+86 -66
View File
@@ -9,46 +9,49 @@ using System.Windows.Forms;
namespace nspector namespace nspector
{ {
internal delegate void DropFilesNativeHandler(string[] files); internal delegate void DropFilesNativeHandler(string[] files);
internal class ListViewEx : ListView internal class ListViewEx : ListView
{ {
public event DropFilesNativeHandler OnDropFilesNative; public event DropFilesNativeHandler OnDropFilesNative;
[DllImport("user32.dll")] [DllImport("user32.dll")]
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wPar, IntPtr lPar); private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wPar, IntPtr lPar);
private const int LVM_FIRST = 0x1000; private const int LVM_FIRST = 0x1000;
private const int LVM_GETCOLUMNORDERARRAY = (LVM_FIRST + 59); private const int LVM_GETCOLUMNORDERARRAY = (LVM_FIRST + 59);
private const int WM_PAINT = 0x000F; private const int WM_PAINT = 0x000F;
private const int WM_VSCROLL = 0x0115;
private const int WM_HSCROLL = 0x0114;
private const int WM_MOUSEWHEEL = 0x020A;
private struct EmbeddedControl private struct EmbeddedControl
{ {
internal Control Control; internal Control Control;
internal int Column; internal int Column;
internal int Row; internal int Row;
internal DockStyle Dock; internal DockStyle Dock;
internal ListViewItem Item; internal ListViewItem Item;
} }
private ArrayList _embeddedControls = new ArrayList(); private ArrayList _embeddedControls = new ArrayList();
public ListViewEx() public ListViewEx()
{ {
this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.EnableNotifyMessage, true); this.SetStyle(ControlStyles.EnableNotifyMessage, true);
} }
protected override void OnNotifyMessage(Message m)
{
if (m.Msg != 0x14)
{
base.OnNotifyMessage(m);
}
}
protected override void OnNotifyMessage(Message m)
{
if (m.Msg != 0x14)
{
base.OnNotifyMessage(m);
}
}
protected int[] GetColumnOrder() protected int[] GetColumnOrder()
{ {
IntPtr lPar = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(int)) * Columns.Count); IntPtr lPar = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(int)) * Columns.Count);
@@ -94,18 +97,18 @@ namespace nspector
break; break;
subItemX += col.Width; subItemX += col.Width;
} }
subItemRect = new Rectangle(subItemX, lviBounds.Top-1, this.Columns[order[i]].Width, lviBounds.Height); subItemRect = new Rectangle(subItemX, lviBounds.Top-1, this.Columns[order[i]].Width, lviBounds.Height);
return subItemRect; return subItemRect;
} }
internal void AddEmbeddedControl(Control c, int col, int row) internal void AddEmbeddedControl(Control c, int col, int row)
{ {
AddEmbeddedControl(c,col,row,DockStyle.Fill); AddEmbeddedControl(c,col,row,DockStyle.Fill);
} }
internal void AddEmbeddedControl(Control c, int col, int row, DockStyle dock) internal void AddEmbeddedControl(Control c, int col, int row, DockStyle dock)
{ {
if (c==null) if (c==null)
throw new ArgumentNullException(); throw new ArgumentNullException();
@@ -122,11 +125,11 @@ namespace nspector
_embeddedControls.Add(ec); _embeddedControls.Add(ec);
c.Click += new EventHandler(_embeddedControl_Click); c.Click += new EventHandler(_embeddedControl_Click);
this.Controls.Add(c); this.Controls.Add(c);
} }
internal void RemoveEmbeddedControl(Control c) internal void RemoveEmbeddedControl(Control c)
{ {
if (c == null) if (c == null)
throw new ArgumentNullException(); throw new ArgumentNullException();
@@ -143,8 +146,8 @@ namespace nspector
} }
} }
} }
internal Control GetEmbeddedControl(int col, int row) internal Control GetEmbeddedControl(int col, int row)
{ {
foreach (EmbeddedControl ec in _embeddedControls) foreach (EmbeddedControl ec in _embeddedControls)
if (ec.Row == row && ec.Column == col) if (ec.Row == row && ec.Column == col)
@@ -154,9 +157,9 @@ namespace nspector
} }
[DefaultValue(View.LargeIcon)] [DefaultValue(View.LargeIcon)]
internal new View View internal new View View
{ {
get get
{ {
return base.View; return base.View;
} }
@@ -169,9 +172,9 @@ namespace nspector
} }
} }
[DllImport("shell32.dll", CharSet = CharSet.Auto)] [DllImport("shell32.dll", CharSet = CharSet.Auto)]
public static extern int DragQueryFile(IntPtr hDrop, uint iFile, [Out] StringBuilder lpszFile, int cch); public static extern int DragQueryFile(IntPtr hDrop, uint iFile, [Out] StringBuilder lpszFile, int cch);
private const int WM_DROPFILES = 0x233; private const int WM_DROPFILES = 0x233;
protected override void WndProc(ref Message m) protected override void WndProc(ref Message m)
{ {
@@ -183,6 +186,10 @@ namespace nspector
foreach (EmbeddedControl ec in _embeddedControls) foreach (EmbeddedControl ec in _embeddedControls)
{ {
// Skip repositioning if the control is a dropped-down ComboBox, prevents it from immediately closing on first click
if (ec.Control is ComboBox comboBox && comboBox.DroppedDown)
continue;
Rectangle rc = this.GetSubItemBounds(ec.Item, ec.Column); Rectangle rc = this.GetSubItemBounds(ec.Item, ec.Column);
if ((this.HeaderStyle != ColumnHeaderStyle.None) && if ((this.HeaderStyle != ColumnHeaderStyle.None) &&
@@ -220,44 +227,57 @@ namespace nspector
} }
rc.X = rc.X + ec.Control.Margin.Left; rc.X = rc.X + ec.Control.Margin.Left;
rc.Y = rc.Y + ec.Control.Margin.Top; rc.Y = rc.Y + ec.Control.Margin.Top;
rc.Width = rc.Width - ec.Control.Margin.Right; rc.Width = rc.Width - ec.Control.Margin.Right;
rc.Height = rc.Height - ec.Control.Margin.Bottom; rc.Height = rc.Height - ec.Control.Margin.Bottom;
ec.Control.Bounds = rc; ec.Control.Bounds = rc;
} }
break; break;
case WM_DROPFILES: case WM_VSCROLL:
case WM_HSCROLL:
if (OnDropFilesNative != null) case WM_MOUSEWHEEL:
{ // Close any opened comboboxes if listview is being scrolled
var dropped = DragQueryFile(m.WParam, 0xFFFFFFFF, null, 0); foreach (EmbeddedControl ec in _embeddedControls)
if (dropped > 0) {
{ if (ec.Control is ComboBox comboBox && comboBox.DroppedDown)
var files = new List<string>(); {
comboBox.DroppedDown = false;
for (uint i = 0; i < dropped; i++) }
{ }
var size = DragQueryFile(m.WParam, i, null, 0); break;
if (size > 0)
{
var sb = new StringBuilder(size + 1);
var result = DragQueryFile(m.WParam, i, sb, size + 1);
files.Add(sb.ToString());
}
}
OnDropFilesNative(files.ToArray()); case WM_DROPFILES:
}
}
base.WndProc(ref m); if (OnDropFilesNative != null)
break; {
var dropped = DragQueryFile(m.WParam, 0xFFFFFFFF, null, 0);
if (dropped > 0)
{
var files = new List<string>();
for (uint i = 0; i < dropped; i++)
{
var size = DragQueryFile(m.WParam, i, null, 0);
if (size > 0)
{
var sb = new StringBuilder(size + 1);
var result = DragQueryFile(m.WParam, i, sb, size + 1);
files.Add(sb.ToString());
}
}
OnDropFilesNative(files.ToArray());
}
}
base.WndProc(ref m);
break;
} }
base.WndProc (ref m); base.WndProc(ref m);
} }
private void _embeddedControl_Click(object sender, EventArgs e) private void _embeddedControl_Click(object sender, EventArgs e)
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+29 -14
View File
@@ -424,13 +424,17 @@ namespace nspector.Native.NVAPI2
} }
} }
private static void GetDelegate<T>(uint id, out T newDelegate) where T : class private static void GetDelegate<T>(uint id, out T newDelegate, uint? fallbackId = null) where T : class
{ {
IntPtr ptr = nvapi_QueryInterface(id); IntPtr ptr = nvapi_QueryInterface(id);
if (ptr != IntPtr.Zero) if (ptr != IntPtr.Zero)
{ {
newDelegate = Marshal.GetDelegateForFunctionPointer(ptr, typeof(T)) as T; newDelegate = Marshal.GetDelegateForFunctionPointer(ptr, typeof(T)) as T;
} }
else if (fallbackId.HasValue)
{
GetDelegate(fallbackId.Value, out newDelegate);
}
else else
{ {
newDelegate = null; newDelegate = null;
@@ -586,13 +590,25 @@ namespace nspector.Native.NVAPI2
public delegate NvAPI_Status DRS_FindApplicationByNameDelegate(IntPtr hSession, [MarshalAs(UnmanagedType.LPWStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]StringBuilder appName, ref IntPtr phProfile, ref NVDRS_APPLICATION_V3 pApplication); public delegate NvAPI_Status DRS_FindApplicationByNameDelegate(IntPtr hSession, [MarshalAs(UnmanagedType.LPWStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]StringBuilder appName, ref IntPtr phProfile, ref NVDRS_APPLICATION_V3 pApplication);
public static readonly DRS_FindApplicationByNameDelegate DRS_FindApplicationByName; public static readonly DRS_FindApplicationByNameDelegate DRS_FindApplicationByName;
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] public static NvAPI_Status DRS_SetSetting(IntPtr hSession, IntPtr hProfile, ref NVDRS_SETTING pSetting)
public delegate NvAPI_Status DRS_SetSettingDelegate(IntPtr hSession, IntPtr hProfile, ref NVDRS_SETTING pSetting); {
public static readonly DRS_SetSettingDelegate DRS_SetSetting; return _DRS_SetSetting(hSession, hProfile, ref pSetting, 0, 0);
}
public static NvAPI_Status DRS_GetSetting(IntPtr hSession, IntPtr hProfile, uint settingId, ref NVDRS_SETTING pSetting)
{
uint x = 0;
return _DRS_GetSetting(hSession, hProfile, settingId, ref pSetting, ref x);
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate NvAPI_Status DRS_GetSettingDelegate(IntPtr hSession, IntPtr hProfile, uint settingId, ref NVDRS_SETTING pSetting); public delegate NvAPI_Status DRS_SetSettingDelegate(IntPtr hSession, IntPtr hProfile, ref NVDRS_SETTING pSetting, uint x, uint y);
public static readonly DRS_GetSettingDelegate DRS_GetSetting; private static readonly DRS_SetSettingDelegate _DRS_SetSetting;
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate NvAPI_Status DRS_GetSettingDelegate(IntPtr hSession, IntPtr hProfile, uint settingId, ref NVDRS_SETTING pSetting, ref uint x);
private static readonly DRS_GetSettingDelegate _DRS_GetSetting;
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate NvAPI_Status DRS_EnumSettingsDelegate(IntPtr hSession, IntPtr hProfile, uint startIndex, ref uint settingsCount, IntPtr pSetting); private delegate NvAPI_Status DRS_EnumSettingsDelegate(IntPtr hSession, IntPtr hProfile, uint startIndex, ref uint settingsCount, IntPtr pSetting);
@@ -728,20 +744,19 @@ namespace nspector.Native.NVAPI2
GetDelegate(0xED1F8C69, out DRS_GetApplicationInfo); GetDelegate(0xED1F8C69, out DRS_GetApplicationInfo);
GetDelegate(0x7FA2173A, out DRS_EnumApplicationsInternal); GetDelegate(0x7FA2173A, out DRS_EnumApplicationsInternal);
GetDelegate(0xEEE566B2, out DRS_FindApplicationByName); GetDelegate(0xEEE566B2, out DRS_FindApplicationByName);
GetDelegate(0x577DD202, out DRS_SetSetting); GetDelegate(0x8A2CF5F5, out _DRS_SetSetting, 0x577DD202);
GetDelegate(0x73BF8338, out DRS_GetSetting); GetDelegate(0xEA99498D, out _DRS_GetSetting, 0x73BF8338);
GetDelegate(0xAE3039DA, out DRS_EnumSettingsInternal); GetDelegate(0xCFD6983E, out DRS_EnumSettingsInternal, 0xAE3039DA);
GetDelegate(0xF020614A, out DRS_EnumAvailableSettingIdsInternal); GetDelegate(0xE5DE48E5, out DRS_EnumAvailableSettingIdsInternal, 0xF020614A);
GetDelegate(0x2EC39F90, out DRS_EnumAvailableSettingValuesInternal); GetDelegate(0x2EC39F90, out DRS_EnumAvailableSettingValuesInternal);
GetDelegate(0xCB7309CD, out DRS_GetSettingIdFromName); GetDelegate(0xCB7309CD, out DRS_GetSettingIdFromName);
GetDelegate(0xD61CBE6E, out DRS_GetSettingNameFromId); GetDelegate(0x1EB13791, out DRS_GetSettingNameFromId, 0xD61CBE6E);
GetDelegate(0xE4A26362, out DRS_DeleteProfileSetting); GetDelegate(0xD20D29DF, out DRS_DeleteProfileSetting, 0xE4A26362);
GetDelegate(0x5927B094, out DRS_RestoreAllDefaults); GetDelegate(0x5927B094, out DRS_RestoreAllDefaults);
GetDelegate(0xFA5F6134, out DRS_RestoreProfileDefault); GetDelegate(0xFA5F6134, out DRS_RestoreProfileDefault);
GetDelegate(0x53F0381E, out DRS_RestoreProfileDefaultSetting); GetDelegate(0x7DD5B261, out DRS_RestoreProfileDefaultSetting, 0x53F0381E);
GetDelegate(0xDA8466A0, out DRS_GetBaseProfile); GetDelegate(0xDA8466A0, out DRS_GetBaseProfile);
#endregion #endregion
} }
} }
} }
+1 -3
View File
@@ -1,8 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text;
namespace nspector.Native namespace nspector.Native
{ {
@@ -51,6 +49,6 @@ namespace nspector.Native
targetPointer = Marshal.AllocHGlobal(sizeOfItem); targetPointer = Marshal.AllocHGlobal(sizeOfItem);
Marshal.StructureToPtr(item, targetPointer, true); Marshal.StructureToPtr(item, targetPointer, true);
} }
} }
} }
+3 -3
View File
@@ -287,7 +287,7 @@ namespace nspector.Native.WINAPI
internal string lpData; internal string lpData;
} }
internal struct WINDOWPLACEMENT internal struct WINDOWPLACEMENT
{ {
internal int length; internal int length;
@@ -301,7 +301,7 @@ namespace nspector.Native.WINAPI
internal bool bringAppToFront(int hWnd) internal bool bringAppToFront(int hWnd)
{ {
WINDOWPLACEMENT param = new WINDOWPLACEMENT(); WINDOWPLACEMENT param = new WINDOWPLACEMENT();
if (GetWindowPlacement(hWnd,ref param)) if (GetWindowPlacement(hWnd, ref param))
{ {
if (param.showCmd != SW_NORMAL) if (param.showCmd != SW_NORMAL)
{ {
@@ -312,7 +312,7 @@ namespace nspector.Native.WINAPI
} }
return SetForegroundWindow(hWnd); return SetForegroundWindow(hWnd);
} }
internal int sendWindowsStringMessage(int hWnd, int wParam, string msg) internal int sendWindowsStringMessage(int hWnd, int wParam, string msg)
{ {
int result = 0; int result = 0;
+1 -1
View File
@@ -241,7 +241,7 @@ namespace nspector.Native.WINAPI
private class NativeMethods private class NativeMethods
{ {
[DllImport("Shell32", CharSet = CharSet.Auto)] [DllImport("Shell32", CharSet = CharSet.Auto)]
internal extern static int ExtractIconEx([MarshalAs(UnmanagedType.LPTStr)] internal extern static int ExtractIconEx([MarshalAs(UnmanagedType.LPTStr)]
string lpszFile, string lpszFile,
int nIconIndex, int nIconIndex,
IntPtr[] phIconLarge, IntPtr[] phIconLarge,
+16 -16
View File
@@ -25,7 +25,7 @@ namespace nspector.Native.WINAPI
THBF_NOBACKGROUND = 0x0004, THBF_NOBACKGROUND = 0x0004,
THBF_HIDDEN = 0x0008 THBF_HIDDEN = 0x0008
} }
[Flags] [Flags]
internal enum THB internal enum THB
{ {
@@ -37,18 +37,18 @@ namespace nspector.Native.WINAPI
} }
internal enum TBPFLAG internal enum TBPFLAG
{ {
TBPF_NOPROGRESS = 0, TBPF_NOPROGRESS = 0,
TBPF_INDETERMINATE = 0x1, TBPF_INDETERMINATE = 0x1,
TBPF_NORMAL = 0x2, TBPF_NORMAL = 0x2,
TBPF_ERROR = 0x4, TBPF_ERROR = 0x4,
TBPF_PAUSED = 0x8 TBPF_PAUSED = 0x8
} }
internal enum TBATFLAG internal enum TBATFLAG
{ {
TBATF_USEMDITHUMBNAIL = 0x1, TBATF_USEMDITHUMBNAIL = 0x1,
TBATF_USEMDILIVEPREVIEW = 0x2 TBATF_USEMDILIVEPREVIEW = 0x2
} }
[ComImport, [ComImport,
@@ -57,7 +57,7 @@ namespace nspector.Native.WINAPI
internal interface ITaskbarList3 internal interface ITaskbarList3
{ {
[MethodImpl(MethodImplOptions.InternalCall, [MethodImpl(MethodImplOptions.InternalCall,
MethodCodeType = MethodCodeType.Runtime)] MethodCodeType = MethodCodeType.Runtime)]
void HrInit(); void HrInit();
@@ -79,7 +79,7 @@ namespace nspector.Native.WINAPI
[MethodImpl(MethodImplOptions.InternalCall, [MethodImpl(MethodImplOptions.InternalCall,
MethodCodeType = MethodCodeType.Runtime)] MethodCodeType = MethodCodeType.Runtime)]
void MarkFullscreenWindow([In] IntPtr hwnd, void MarkFullscreenWindow([In] IntPtr hwnd,
[In, MarshalAs(UnmanagedType.Bool)] bool fFullscreen); [In, MarshalAs(UnmanagedType.Bool)] bool fFullscreen);
[MethodImpl(MethodImplOptions.InternalCall, [MethodImpl(MethodImplOptions.InternalCall,
@@ -87,8 +87,8 @@ namespace nspector.Native.WINAPI
void SetProgressValue([In] IntPtr hwnd, void SetProgressValue([In] IntPtr hwnd,
[In] ulong ullCompleted, [In] ulong ullCompleted,
[In] ulong ullTotal); [In] ulong ullTotal);
[MethodImpl(MethodImplOptions.InternalCall, [MethodImpl(MethodImplOptions.InternalCall,
MethodCodeType = MethodCodeType.Runtime)] MethodCodeType = MethodCodeType.Runtime)]
void SetProgressState([In] IntPtr hwnd, void SetProgressState([In] IntPtr hwnd,
[In] TBPFLAG tbpFlags); [In] TBPFLAG tbpFlags);
@@ -120,7 +120,7 @@ namespace nspector.Native.WINAPI
[In] uint cButtons, [In] uint cButtons,
[In] IntPtr pButton); [In] IntPtr pButton);
///* [size_is][in] */ __RPC__in_ecount_full(cButtons) LPTHUMBBUTTON pButton); ///* [size_is][in] */ __RPC__in_ecount_full(cButtons) LPTHUMBBUTTON pButton);
//preliminary //preliminary
[MethodImpl(MethodImplOptions.InternalCall, [MethodImpl(MethodImplOptions.InternalCall,
MethodCodeType = MethodCodeType.Runtime)] MethodCodeType = MethodCodeType.Runtime)]
@@ -150,7 +150,7 @@ namespace nspector.Native.WINAPI
MethodCodeType = MethodCodeType.Runtime)] MethodCodeType = MethodCodeType.Runtime)]
void SetThumbnailClip([In] IntPtr hwnd, void SetThumbnailClip([In] IntPtr hwnd,
[In] IntPtr prcClip); [In] IntPtr prcClip);
} }
+3 -2
View File
@@ -4,7 +4,7 @@ using System.IO;
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using nspector.Common; using nspector.Common;
using nspector.Common.Import; using nspector.Common.Helper;
using nspector.Native.WINAPI; using nspector.Native.WINAPI;
namespace nspector namespace nspector
@@ -29,12 +29,13 @@ namespace nspector
#endif #endif
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
DropDownMenuScrollWheelHandler.Enable(true);
var argFileIndex = ArgFileIndex(args); var argFileIndex = ArgFileIndex(args);
if (argFileIndex != -1) if (argFileIndex != -1)
{ {
if (new FileInfo(args[argFileIndex]).Extension.ToLower() == ".nip") if (new FileInfo(args[argFileIndex]).Extension.ToLowerInvariant() == ".nip")
{ {
try try
{ {
+3 -3
View File
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NVIDIA Profile Inspector")] [assembly: AssemblyProduct("NVIDIA Profile Inspector")]
[assembly: AssemblyCopyright("©2019 by Orbmu2k")] [assembly: AssemblyCopyright("©2025 by Orbmu2k")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@@ -32,7 +32,7 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.3.0.0")] [assembly: AssemblyVersion("2.4.0.1")]
[assembly: AssemblyFileVersion("2.3.0.0")] [assembly: AssemblyFileVersion("2.4.0.1")]
+14 -11
View File
@@ -19,7 +19,7 @@ namespace nspector.Properties {
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Resources { public class Resources {
@@ -73,16 +73,19 @@ namespace nspector.Properties {
/// <summary> /// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; /// Sucht eine lokalisierte Zeichenfolge, die &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
///&lt;CustomSettingNames&gt; ///&lt;CustomSettingNames&gt;
/// &lt;ShowCustomizedSettingNamesOnly&gt;false&lt;/ShowCustomizedSettingNamesOnly&gt; /// &lt;Settings&gt;
/// &lt;Settings&gt; /// &lt;CustomSetting&gt;
/// &lt;CustomSetting&gt; /// &lt;UserfriendlyName&gt;DLSS - Enable DLL Override&lt;/UserfriendlyName&gt;
/// &lt;UserfriendlyName&gt;Enable Maxwell sample interleaving (MFAA)&lt;/UserfriendlyName&gt; /// &lt;HexSettingID&gt;0x10E41E01&lt;/HexSettingID&gt;
/// &lt;HexSettingID&gt;0x0098C1AC&lt;/HexSettingID&gt; /// &lt;GroupName&gt;5 - Common&lt;/GroupName&gt;
/// &lt;GroupName&gt;3 - Antialiasing&lt;/GroupName&gt; /// &lt;MinRequiredDriverVersion&gt;0&lt;/MinRequiredDriverVersion&gt;
/// &lt;MinRequiredDriverVersion&gt;344.11&lt;/MinRequiredDriverVersion&gt; /// &lt;SettingValues&gt;
/// &lt;SettingValues&gt; /// &lt;CustomSettingValue&gt;
/// &lt;CustomSettingValue&gt; /// &lt;UserfriendlyName&gt;Off&lt;/UserfriendlyName&gt;
/// &lt;UserfriendlyName&gt;Off&lt;/Userfrie [Rest der Zeichenfolge wurde abgeschnitten]&quot;; ähnelt. /// &lt;HexValue&gt;0x00000000&lt;/HexValue&gt;
/// &lt;/CustomSettingValue&gt;
/// &lt;CustomSettingValue&gt;
/// &lt;UserfriendlyName&gt;On [Rest der Zeichenfolge wurde abgeschnitten]&quot;; ähnelt.
/// </summary> /// </summary>
public static string CustomSettingNames { public static string CustomSettingNames {
get { get {
+1074 -1
View File
File diff suppressed because it is too large. Load diff
+3 -3
View File
@@ -1,3 +1,3 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1"/></startup></configuration>
+28 -37
View File
@@ -49,10 +49,10 @@
// btnClose // btnClose
// //
this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnClose.Location = new System.Drawing.Point(914, 806); this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnClose.Margin = new System.Windows.Forms.Padding(4); this.btnClose.Location = new System.Drawing.Point(731, 645);
this.btnClose.Name = "btnClose"; this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(132, 29); this.btnClose.Size = new System.Drawing.Size(106, 23);
this.btnClose.TabIndex = 1; this.btnClose.TabIndex = 1;
this.btnClose.Text = "Apply && Close"; this.btnClose.Text = "Apply && Close";
this.btnClose.UseVisualStyleBackColor = true; this.btnClose.UseVisualStyleBackColor = true;
@@ -62,10 +62,9 @@
// //
this.lValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.lValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.lValue.AutoSize = true; this.lValue.AutoSize = true;
this.lValue.Location = new System.Drawing.Point(21, 813); this.lValue.Location = new System.Drawing.Point(17, 650);
this.lValue.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lValue.Name = "lValue"; this.lValue.Name = "lValue";
this.lValue.Size = new System.Drawing.Size(48, 17); this.lValue.Size = new System.Drawing.Size(37, 13);
this.lValue.TabIndex = 2; this.lValue.TabIndex = 2;
this.lValue.Text = "Value:"; this.lValue.Text = "Value:";
// //
@@ -73,10 +72,9 @@
// //
this.lFilter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.lFilter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.lFilter.AutoSize = true; this.lFilter.AutoSize = true;
this.lFilter.Location = new System.Drawing.Point(187, 813); this.lFilter.Location = new System.Drawing.Point(150, 650);
this.lFilter.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lFilter.Name = "lFilter"; this.lFilter.Name = "lFilter";
this.lFilter.Size = new System.Drawing.Size(87, 17); this.lFilter.Size = new System.Drawing.Size(64, 13);
this.lFilter.TabIndex = 23; this.lFilter.TabIndex = 23;
this.lFilter.Text = "Profile Filter:"; this.lFilter.Text = "Profile Filter:";
// //
@@ -84,20 +82,18 @@
// //
this.tbFilter.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) this.tbFilter.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.tbFilter.Location = new System.Drawing.Point(274, 809); this.tbFilter.Location = new System.Drawing.Point(219, 647);
this.tbFilter.Margin = new System.Windows.Forms.Padding(4);
this.tbFilter.Name = "tbFilter"; this.tbFilter.Name = "tbFilter";
this.tbFilter.Size = new System.Drawing.Size(632, 22); this.tbFilter.Size = new System.Drawing.Size(506, 20);
this.tbFilter.TabIndex = 24; this.tbFilter.TabIndex = 24;
this.tbFilter.TextChanged += new System.EventHandler(this.tbFilter_TextChanged); this.tbFilter.TextChanged += new System.EventHandler(this.tbFilter_TextChanged);
// //
// textBox1 // textBox1
// //
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.textBox1.Location = new System.Drawing.Point(74, 809); this.textBox1.Location = new System.Drawing.Point(59, 647);
this.textBox1.Margin = new System.Windows.Forms.Padding(4);
this.textBox1.Name = "textBox1"; this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(86, 22); this.textBox1.Size = new System.Drawing.Size(70, 20);
this.textBox1.TabIndex = 31; this.textBox1.TabIndex = 31;
this.textBox1.Text = "0x00FF00FF"; this.textBox1.Text = "0x00FF00FF";
this.textBox1.Leave += new System.EventHandler(this.textBox1_Leave); this.textBox1.Leave += new System.EventHandler(this.textBox1_Leave);
@@ -106,10 +102,9 @@
// btnDirectApplyStart // btnDirectApplyStart
// //
this.btnDirectApplyStart.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btnDirectApplyStart.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnDirectApplyStart.Location = new System.Drawing.Point(6, 19); this.btnDirectApplyStart.Location = new System.Drawing.Point(5, 15);
this.btnDirectApplyStart.Margin = new System.Windows.Forms.Padding(4);
this.btnDirectApplyStart.Name = "btnDirectApplyStart"; this.btnDirectApplyStart.Name = "btnDirectApplyStart";
this.btnDirectApplyStart.Size = new System.Drawing.Size(105, 42); this.btnDirectApplyStart.Size = new System.Drawing.Size(84, 34);
this.btnDirectApplyStart.TabIndex = 32; this.btnDirectApplyStart.TabIndex = 32;
this.btnDirectApplyStart.Text = "GO!"; this.btnDirectApplyStart.Text = "GO!";
this.btnDirectApplyStart.UseVisualStyleBackColor = true; this.btnDirectApplyStart.UseVisualStyleBackColor = true;
@@ -123,11 +118,9 @@
this.gbDirectTest.Controls.Add(this.tbGamePath); this.gbDirectTest.Controls.Add(this.tbGamePath);
this.gbDirectTest.Controls.Add(this.lblGamePath); this.gbDirectTest.Controls.Add(this.lblGamePath);
this.gbDirectTest.Controls.Add(this.btnDirectApplyStart); this.gbDirectTest.Controls.Add(this.btnDirectApplyStart);
this.gbDirectTest.Location = new System.Drawing.Point(18, 733); this.gbDirectTest.Location = new System.Drawing.Point(14, 586);
this.gbDirectTest.Margin = new System.Windows.Forms.Padding(4);
this.gbDirectTest.Name = "gbDirectTest"; this.gbDirectTest.Name = "gbDirectTest";
this.gbDirectTest.Padding = new System.Windows.Forms.Padding(4); this.gbDirectTest.Size = new System.Drawing.Size(823, 53);
this.gbDirectTest.Size = new System.Drawing.Size(1029, 66);
this.gbDirectTest.TabIndex = 33; this.gbDirectTest.TabIndex = 33;
this.gbDirectTest.TabStop = false; this.gbDirectTest.TabStop = false;
this.gbDirectTest.Text = "Quick Bit Value Tester (stores this setting value to the current profile and imme" + this.gbDirectTest.Text = "Quick Bit Value Tester (stores this setting value to the current profile and imme" +
@@ -136,10 +129,9 @@
// btnBrowseGame // btnBrowseGame
// //
this.btnBrowseGame.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnBrowseGame.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnBrowseGame.Location = new System.Drawing.Point(971, 24); this.btnBrowseGame.Location = new System.Drawing.Point(777, 19);
this.btnBrowseGame.Margin = new System.Windows.Forms.Padding(4);
this.btnBrowseGame.Name = "btnBrowseGame"; this.btnBrowseGame.Name = "btnBrowseGame";
this.btnBrowseGame.Size = new System.Drawing.Size(41, 29); this.btnBrowseGame.Size = new System.Drawing.Size(33, 23);
this.btnBrowseGame.TabIndex = 35; this.btnBrowseGame.TabIndex = 35;
this.btnBrowseGame.Text = "..."; this.btnBrowseGame.Text = "...";
this.btnBrowseGame.UseVisualStyleBackColor = true; this.btnBrowseGame.UseVisualStyleBackColor = true;
@@ -149,19 +141,17 @@
// //
this.tbGamePath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.tbGamePath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.tbGamePath.Location = new System.Drawing.Point(218, 26); this.tbGamePath.Location = new System.Drawing.Point(174, 21);
this.tbGamePath.Margin = new System.Windows.Forms.Padding(4);
this.tbGamePath.Name = "tbGamePath"; this.tbGamePath.Name = "tbGamePath";
this.tbGamePath.Size = new System.Drawing.Size(745, 22); this.tbGamePath.Size = new System.Drawing.Size(597, 20);
this.tbGamePath.TabIndex = 34; this.tbGamePath.TabIndex = 34;
// //
// lblGamePath // lblGamePath
// //
this.lblGamePath.AutoSize = true; this.lblGamePath.AutoSize = true;
this.lblGamePath.Location = new System.Drawing.Point(119, 29); this.lblGamePath.Location = new System.Drawing.Point(95, 23);
this.lblGamePath.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblGamePath.Name = "lblGamePath"; this.lblGamePath.Name = "lblGamePath";
this.lblGamePath.Size = new System.Drawing.Size(98, 17); this.lblGamePath.Size = new System.Drawing.Size(73, 13);
this.lblGamePath.TabIndex = 33; this.lblGamePath.TabIndex = 33;
this.lblGamePath.Text = "Game to start:"; this.lblGamePath.Text = "Game to start:";
// //
@@ -179,11 +169,13 @@
this.clbBits.FullRowSelect = true; this.clbBits.FullRowSelect = true;
this.clbBits.GridLines = true; this.clbBits.GridLines = true;
this.clbBits.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; this.clbBits.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.clbBits.Location = new System.Drawing.Point(12, 12); this.clbBits.HideSelection = false;
this.clbBits.Location = new System.Drawing.Point(10, 10);
this.clbBits.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.clbBits.MultiSelect = false; this.clbBits.MultiSelect = false;
this.clbBits.Name = "clbBits"; this.clbBits.Name = "clbBits";
this.clbBits.ShowGroups = false; this.clbBits.ShowGroups = false;
this.clbBits.Size = new System.Drawing.Size(1035, 714); this.clbBits.Size = new System.Drawing.Size(829, 572);
this.clbBits.TabIndex = 34; this.clbBits.TabIndex = 34;
this.clbBits.UseCompatibleStateImageBehavior = false; this.clbBits.UseCompatibleStateImageBehavior = false;
this.clbBits.View = System.Windows.Forms.View.Details; this.clbBits.View = System.Windows.Forms.View.Details;
@@ -209,9 +201,9 @@
// //
// frmBitEditor // frmBitEditor
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(120F, 120F); this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(1059, 847); this.ClientSize = new System.Drawing.Size(847, 678);
this.Controls.Add(this.clbBits); this.Controls.Add(this.clbBits);
this.Controls.Add(this.gbDirectTest); this.Controls.Add(this.gbDirectTest);
this.Controls.Add(this.textBox1); this.Controls.Add(this.textBox1);
@@ -220,8 +212,7 @@
this.Controls.Add(this.lValue); this.Controls.Add(this.lValue);
this.Controls.Add(this.btnClose); this.Controls.Add(this.btnClose);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.Margin = new System.Windows.Forms.Padding(4); this.MinimumSize = new System.Drawing.Size(686, 495);
this.MinimumSize = new System.Drawing.Size(854, 609);
this.Name = "frmBitEditor"; this.Name = "frmBitEditor";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Bit Value Editor"; this.Text = "Bit Value Editor";
+40 -30
View File
@@ -4,6 +4,7 @@ using System.Drawing;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using nspector.Common; using nspector.Common;
using nspector.Common.CustomSettings; using nspector.Common.CustomSettings;
@@ -51,12 +52,14 @@ namespace nspector
var referenceSettings = DrsServiceLocator.ReferenceSettings?.Settings.FirstOrDefault(s => s.SettingId == _Settingid); var referenceSettings = DrsServiceLocator.ReferenceSettings?.Settings.FirstOrDefault(s => s.SettingId == _Settingid);
var settingsCache = DrsServiceLocator.ScannerService.CachedSettings.FirstOrDefault(x => x.SettingId == _Settingid); var settingsCache = DrsServiceLocator.ScannerService.CachedSettings.FirstOrDefault(x => x.SettingId == _Settingid);
if (settingsCache != null)
for (int bit = 0; bit < 32; bit++)
{ {
for (int bit = 0; bit < 32; bit++) string profileNames = "";
uint profileCount = 0;
if (settingsCache != null)
{ {
string profileNames = "";
uint profileCount = 0;
for (int i = 0; i < settingsCache.SettingValues.Count; i++) for (int i = 0; i < settingsCache.SettingValues.Count; i++)
{ {
@@ -73,7 +76,7 @@ namespace nspector
{ {
for (int f = 0; f < filters.Length; f++) for (int f = 0; f < filters.Length; f++)
{ {
if (settingProfileNames[p].ToLower().Contains(filters[f].ToLower())) if (settingProfileNames[p].ToLowerInvariant().Contains(filters[f].ToLower()))
{ {
profileNames += settingProfileNames[p] + ","; profileNames += settingProfileNames[p] + ",";
} }
@@ -83,31 +86,32 @@ namespace nspector
profileCount += settingsCache.SettingValues[i].ValueProfileCount; profileCount += settingsCache.SettingValues[i].ValueProfileCount;
} }
} }
}
uint mask = (uint)1 << bit;
string maskStr=""; uint mask = (uint)1 << bit;
string maskStr = "";
if (referenceSettings != null)
if (referenceSettings != null)
{
var maskValue = referenceSettings.SettingValues.FirstOrDefault(v => v.SettingValue == mask);
if (maskValue != null)
{ {
var maskValue = referenceSettings.SettingValues.FirstOrDefault(v => v.SettingValue == mask); maskStr = maskValue.UserfriendlyName;
if (maskValue != null) if (maskStr.Contains("("))
{ {
maskStr = maskValue.UserfriendlyName; maskStr = maskStr.Substring(0, maskStr.IndexOf("(") - 1);
if (maskStr.Contains("("))
{
maskStr = maskStr.Substring(0, maskStr.IndexOf("(") - 1);
}
} }
} }
}
clbBits.Items.Add(new ListViewItem(new string[] { clbBits.Items.Add(new ListViewItem(new string[] {
string.Format("#{0:00}",bit), string.Format("#{0:00}",bit),
maskStr, maskStr,
profileCount.ToString(), profileCount.ToString(),
profileNames, profileNames,
})); }));
}
} }
SetValue(lastValue); SetValue(lastValue);
@@ -210,24 +214,30 @@ namespace nspector
.SetDwordValueToProfile(_SettingsOwner._CurrentProfile, _Settingid, val); .SetDwordValueToProfile(_SettingsOwner._CurrentProfile, _Settingid, val);
} }
private uint GetStoredValue() private async void btnDirectApply_Click(object sender, EventArgs e)
{
return DrsServiceLocator
.SettingService
.GetDwordValueFromProfile(_SettingsOwner._CurrentProfile, _Settingid);
}
private void btnDirectApply_Click(object sender, EventArgs e)
{ {
ApplyValueToProfile(_CurrentValue); ApplyValueToProfile(_CurrentValue);
while (GetStoredValue() != _CurrentValue)
Application.DoEvents(); await CheckIfSettingIsStored();
if (File.Exists(tbGamePath.Text)) if (File.Exists(tbGamePath.Text))
{ {
Process.Start(tbGamePath.Text); Process.Start(tbGamePath.Text);
} }
} }
private async Task CheckIfSettingIsStored()
{
await Task.Run(async () =>
{
while (_CurrentValue != DrsServiceLocator.SettingService
.GetDwordValueFromProfile(_SettingsOwner._CurrentProfile, _Settingid, false, true))
{
await Task.Delay(50);
}
});
}
private void btnBrowseGame_Click(object sender, EventArgs e) private void btnBrowseGame_Click(object sender, EventArgs e)
{ {
OpenFileDialog ofd = new OpenFileDialog(); OpenFileDialog ofd = new OpenFileDialog();
+44 -13
View File
@@ -75,7 +75,10 @@
this.chSettingID = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chSettingID = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chSettingValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chSettingValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chSettingValueHex = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chSettingValueHex = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.tbSettingDescription = new System.Windows.Forms.TextBox();
this.pnlListview = new System.Windows.Forms.Panel();
this.tsMain.SuspendLayout(); this.tsMain.SuspendLayout();
this.pnlListview.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// ilListView // ilListView
@@ -267,28 +270,28 @@
// exportCurrentProfileOnlyToolStripMenuItem // exportCurrentProfileOnlyToolStripMenuItem
// //
this.exportCurrentProfileOnlyToolStripMenuItem.Name = "exportCurrentProfileOnlyToolStripMenuItem"; this.exportCurrentProfileOnlyToolStripMenuItem.Name = "exportCurrentProfileOnlyToolStripMenuItem";
this.exportCurrentProfileOnlyToolStripMenuItem.Size = new System.Drawing.Size(342, 22); this.exportCurrentProfileOnlyToolStripMenuItem.Size = new System.Drawing.Size(343, 22);
this.exportCurrentProfileOnlyToolStripMenuItem.Text = "Export current profile only"; this.exportCurrentProfileOnlyToolStripMenuItem.Text = "Export current profile only";
this.exportCurrentProfileOnlyToolStripMenuItem.Click += new System.EventHandler(this.exportCurrentProfileOnlyToolStripMenuItem_Click); this.exportCurrentProfileOnlyToolStripMenuItem.Click += new System.EventHandler(this.exportCurrentProfileOnlyToolStripMenuItem_Click);
// //
// exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem // exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem
// //
this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem.Name = "exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem"; this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem.Name = "exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem";
this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem.Size = new System.Drawing.Size(342, 22); this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem.Size = new System.Drawing.Size(343, 22);
this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem.Text = "Export current profile including predefined settings"; this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem.Text = "Export current profile including predefined settings";
this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem.Click += new System.EventHandler(this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem_Click); this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem.Click += new System.EventHandler(this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem_Click);
// //
// exportUserdefinedProfilesToolStripMenuItem // exportUserdefinedProfilesToolStripMenuItem
// //
this.exportUserdefinedProfilesToolStripMenuItem.Name = "exportUserdefinedProfilesToolStripMenuItem"; this.exportUserdefinedProfilesToolStripMenuItem.Name = "exportUserdefinedProfilesToolStripMenuItem";
this.exportUserdefinedProfilesToolStripMenuItem.Size = new System.Drawing.Size(342, 22); this.exportUserdefinedProfilesToolStripMenuItem.Size = new System.Drawing.Size(343, 22);
this.exportUserdefinedProfilesToolStripMenuItem.Text = "Export all customized profiles"; this.exportUserdefinedProfilesToolStripMenuItem.Text = "Export all customized profiles";
this.exportUserdefinedProfilesToolStripMenuItem.Click += new System.EventHandler(this.exportUserdefinedProfilesToolStripMenuItem_Click); this.exportUserdefinedProfilesToolStripMenuItem.Click += new System.EventHandler(this.exportUserdefinedProfilesToolStripMenuItem_Click);
// //
// exportAllProfilesNVIDIATextFormatToolStripMenuItem // exportAllProfilesNVIDIATextFormatToolStripMenuItem
// //
this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Name = "exportAllProfilesNVIDIATextFormatToolStripMenuItem"; this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Name = "exportAllProfilesNVIDIATextFormatToolStripMenuItem";
this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Size = new System.Drawing.Size(342, 22); this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Size = new System.Drawing.Size(343, 22);
this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Text = "Export all driver profiles (NVIDIA Text Format)"; this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Text = "Export all driver profiles (NVIDIA Text Format)";
this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Click += new System.EventHandler(this.exportAllProfilesNVIDIATextFormatToolStripMenuItem_Click); this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Click += new System.EventHandler(this.exportAllProfilesNVIDIATextFormatToolStripMenuItem_Click);
// //
@@ -308,14 +311,14 @@
// importProfilesToolStripMenuItem // importProfilesToolStripMenuItem
// //
this.importProfilesToolStripMenuItem.Name = "importProfilesToolStripMenuItem"; this.importProfilesToolStripMenuItem.Name = "importProfilesToolStripMenuItem";
this.importProfilesToolStripMenuItem.Size = new System.Drawing.Size(364, 22); this.importProfilesToolStripMenuItem.Size = new System.Drawing.Size(363, 22);
this.importProfilesToolStripMenuItem.Text = "Import profile(s)"; this.importProfilesToolStripMenuItem.Text = "Import profile(s)";
this.importProfilesToolStripMenuItem.Click += new System.EventHandler(this.importProfilesToolStripMenuItem_Click); this.importProfilesToolStripMenuItem.Click += new System.EventHandler(this.importProfilesToolStripMenuItem_Click);
// //
// importAllProfilesNVIDIATextFormatToolStripMenuItem // importAllProfilesNVIDIATextFormatToolStripMenuItem
// //
this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Name = "importAllProfilesNVIDIATextFormatToolStripMenuItem"; this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Name = "importAllProfilesNVIDIATextFormatToolStripMenuItem";
this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Size = new System.Drawing.Size(364, 22); this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Size = new System.Drawing.Size(363, 22);
this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Text = "Import (replace) all driver profiles (NVIDIA Text Format)"; this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Text = "Import (replace) all driver profiles (NVIDIA Text Format)";
this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Click += new System.EventHandler(this.importAllProfilesNVIDIATextFormatToolStripMenuItem_Click); this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Click += new System.EventHandler(this.importAllProfilesNVIDIATextFormatToolStripMenuItem_Click);
// //
@@ -491,22 +494,21 @@
// //
// lvSettings // lvSettings
// //
this.lvSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lvSettings.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.lvSettings.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.chSettingID, this.chSettingID,
this.chSettingValue, this.chSettingValue,
this.chSettingValueHex}); this.chSettingValueHex});
this.lvSettings.Dock = System.Windows.Forms.DockStyle.Fill;
this.lvSettings.FullRowSelect = true; this.lvSettings.FullRowSelect = true;
this.lvSettings.GridLines = true; this.lvSettings.GridLines = true;
this.lvSettings.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; this.lvSettings.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.lvSettings.Location = new System.Drawing.Point(12, 51); this.lvSettings.HideSelection = false;
this.lvSettings.Location = new System.Drawing.Point(0, 0);
this.lvSettings.Margin = new System.Windows.Forms.Padding(4); this.lvSettings.Margin = new System.Windows.Forms.Padding(4);
this.lvSettings.MultiSelect = false; this.lvSettings.MultiSelect = false;
this.lvSettings.Name = "lvSettings"; this.lvSettings.Name = "lvSettings";
this.lvSettings.ShowItemToolTips = true; this.lvSettings.ShowItemToolTips = true;
this.lvSettings.Size = new System.Drawing.Size(840, 418); this.lvSettings.Size = new System.Drawing.Size(840, 372);
this.lvSettings.SmallImageList = this.ilListView; this.lvSettings.SmallImageList = this.ilListView;
this.lvSettings.TabIndex = 2; this.lvSettings.TabIndex = 2;
this.lvSettings.UseCompatibleStateImageBehavior = false; this.lvSettings.UseCompatibleStateImageBehavior = false;
@@ -532,31 +534,58 @@
this.chSettingValueHex.Text = "SettingValueHex"; this.chSettingValueHex.Text = "SettingValueHex";
this.chSettingValueHex.Width = 96; this.chSettingValueHex.Width = 96;
// //
// tbSettingDescription
//
this.tbSettingDescription.Dock = System.Windows.Forms.DockStyle.Bottom;
this.tbSettingDescription.Location = new System.Drawing.Point(0, 372);
this.tbSettingDescription.Multiline = true;
this.tbSettingDescription.Name = "tbSettingDescription";
this.tbSettingDescription.ReadOnly = true;
this.tbSettingDescription.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.tbSettingDescription.Size = new System.Drawing.Size(840, 44);
this.tbSettingDescription.TabIndex = 81;
this.tbSettingDescription.Visible = false;
//
// pnlListview
//
this.pnlListview.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pnlListview.Controls.Add(this.lvSettings);
this.pnlListview.Controls.Add(this.tbSettingDescription);
this.pnlListview.Location = new System.Drawing.Point(12, 52);
this.pnlListview.Name = "pnlListview";
this.pnlListview.Size = new System.Drawing.Size(840, 416);
this.pnlListview.TabIndex = 82;
//
// frmDrvSettings // frmDrvSettings
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(864, 492); this.ClientSize = new System.Drawing.Size(864, 492);
this.Controls.Add(this.pnlListview);
this.Controls.Add(this.lblWidth30); this.Controls.Add(this.lblWidth30);
this.Controls.Add(this.lblWidth16); this.Controls.Add(this.lblWidth16);
this.Controls.Add(this.lblWidth330); this.Controls.Add(this.lblWidth330);
this.Controls.Add(this.lblWidth96); this.Controls.Add(this.lblWidth96);
this.Controls.Add(this.lvSettings);
this.Controls.Add(this.lblApplications); this.Controls.Add(this.lblApplications);
this.Controls.Add(this.tsMain); this.Controls.Add(this.tsMain);
this.Controls.Add(this.pbMain); this.Controls.Add(this.pbMain);
this.Controls.Add(this.btnResetValue); this.Controls.Add(this.btnResetValue);
this.Controls.Add(this.cbValues); this.Controls.Add(this.cbValues);
this.Margin = new System.Windows.Forms.Padding(4); this.Margin = new System.Windows.Forms.Padding(4);
this.MinimumSize = new System.Drawing.Size(880, 348); this.MinimumSize = new System.Drawing.Size(879, 346);
this.Name = "frmDrvSettings"; this.Name = "frmDrvSettings";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "nSpector - Driver Profile Settings"; this.Text = "nSpector - Driver Profile Settings";
this.Activated += new System.EventHandler(this.frmDrvSettings_Activated); this.Activated += new System.EventHandler(this.frmDrvSettings_Activated);
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.frmDrvSettings_FormClosed);
this.Load += new System.EventHandler(this.frmDrvSettings_Load); this.Load += new System.EventHandler(this.frmDrvSettings_Load);
this.Shown += new System.EventHandler(this.frmDrvSettings_Shown); this.Shown += new System.EventHandler(this.frmDrvSettings_Shown);
this.tsMain.ResumeLayout(false); this.tsMain.ResumeLayout(false);
this.tsMain.PerformLayout(); this.tsMain.PerformLayout();
this.pnlListview.ResumeLayout(false);
this.pnlListview.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@@ -608,5 +637,7 @@
private System.Windows.Forms.Label lblWidth16; private System.Windows.Forms.Label lblWidth16;
private System.Windows.Forms.Label lblWidth30; private System.Windows.Forms.Label lblWidth30;
private System.Windows.Forms.ToolStripMenuItem exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem;
private System.Windows.Forms.TextBox tbSettingDescription;
private System.Windows.Forms.Panel pnlListview;
} }
} }
+352 -171
View File
@@ -1,30 +1,29 @@
using System; using nspector.Common;
using System.Collections; using nspector.Common.Helper;
using nspector.Native.NVAPI2;
using nspector.Native.WINAPI;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using nspector.Common;
using nspector.Common.Helper;
using nspector.Native.NVAPI2;
using nspector.Native.WINAPI;
using nvw = nspector.Native.NVAPI2.NvapiDrsWrapper;
using System.Text.RegularExpressions;
using System.Diagnostics;
namespace nspector namespace nspector
{ {
internal partial class frmDrvSettings : Form internal partial class frmDrvSettings : Form
{ {
readonly DrsSettingsMetaService _meta = DrsServiceLocator.MetaService; private readonly DrsSettingsMetaService _meta = DrsServiceLocator.MetaService;
readonly DrsSettingsService _drs = DrsServiceLocator.SettingService; private readonly DrsSettingsService _drs = DrsServiceLocator.SettingService;
readonly DrsScannerService _scanner = DrsServiceLocator.ScannerService; private readonly DrsScannerService _scanner = DrsServiceLocator.ScannerService;
readonly DrsImportService _import = DrsServiceLocator.ImportService; private readonly DrsImportService _import = DrsServiceLocator.ImportService;
private List<SettingItem> _currentProfileSettingItems = new List<SettingItem>(); private List<SettingItem> _currentProfileSettingItems = new List<SettingItem>();
private bool _alreadyScannedForPredefinedSettings = false; private bool _alreadyScannedForPredefinedSettings = false;
@@ -32,7 +31,7 @@ namespace nspector
private bool _activated = false; private bool _activated = false;
private bool _isStartup = true; private bool _isStartup = true;
private bool _skipScan = false; private bool _skipScan = false;
private string _baseProfileName = ""; private string _baseProfileName = "";
private bool _isWin7TaskBar = false; private bool _isWin7TaskBar = false;
private int _lastComboRowIndex = -1; private int _lastComboRowIndex = -1;
@@ -40,6 +39,8 @@ namespace nspector
public string _CurrentProfile = ""; public string _CurrentProfile = "";
private bool isDevMode = false;
protected override void WndProc(ref Message m) protected override void WndProc(ref Message m)
{ {
switch (m.Msg) switch (m.Msg)
@@ -50,6 +51,7 @@ namespace nspector
copyDataStruct = (MessageHelper.COPYDATASTRUCT)m.GetLParam(copyDataType); copyDataStruct = (MessageHelper.COPYDATASTRUCT)m.GetLParam(copyDataType);
if (copyDataStruct.lpData.Equals("ProfilesImported")) if (copyDataStruct.lpData.Equals("ProfilesImported"))
{ {
DrsSessionScope.DestroyGlobalSession();
RefreshAll(); RefreshAll();
} }
break; break;
@@ -76,9 +78,12 @@ namespace nspector
{ {
var group = FindOrCreateGroup(setting.GroupName); var group = FindOrCreateGroup(setting.GroupName);
var item = new ListViewItem(setting.SettingText); var settingName = isDevMode ? $"0x{setting.SettingId:X8} {setting.SettingText}" : setting.SettingText;
var item = new ListViewItem(settingName);
item.Tag = setting.SettingId; item.Tag = setting.SettingId;
item.Group = group; item.Group = group;
item.SubItems.Add(setting.ValueText); item.SubItems.Add(setting.ValueText);
item.SubItems.Add(setting.ValueRaw); item.SubItems.Add(setting.ValueRaw);
@@ -108,15 +113,16 @@ namespace nspector
return item; return item;
} }
private void RefreshApplicationsCombosAndText(List<string> applications) private void RefreshApplicationsCombosAndText(Dictionary<string,string> applications)
{ {
lblApplications.Text = ""; lblApplications.Text = "";
tssbRemoveApplication.DropDownItems.Clear(); tssbRemoveApplication.DropDownItems.Clear();
lblApplications.Text = " " + string.Join(", ", applications); lblApplications.Text = " " + string.Join(", ", applications.Select(x=>x.Value));
foreach (var app in applications) foreach (var app in applications)
{ {
tssbRemoveApplication.DropDownItems.Add(app, Properties.Resources.ieframe_1_18212); var item = tssbRemoveApplication.DropDownItems.Add(app.Value, Properties.Resources.ieframe_1_18212);
item.Tag = app.Key;
} }
tssbRemoveApplication.Enabled = (tssbRemoveApplication.DropDownItems.Count > 0); tssbRemoveApplication.Enabled = (tssbRemoveApplication.DropDownItems.Count > 0);
} }
@@ -142,14 +148,20 @@ namespace nspector
{ {
lvSettings.Items.Clear(); lvSettings.Items.Clear();
lvSettings.Groups.Clear(); lvSettings.Groups.Clear();
var applications = new List<string>(); var applications = new Dictionary<string,string>();
_currentProfileSettingItems = _drs.GetSettingsForProfile(_CurrentProfile, GetSettingViewMode(), ref applications); _currentProfileSettingItems = _drs.GetSettingsForProfile(_CurrentProfile, GetSettingViewMode(), ref applications);
RefreshApplicationsCombosAndText(applications); RefreshApplicationsCombosAndText(applications);
foreach (var settingItem in _currentProfileSettingItems) foreach (var settingItem in _currentProfileSettingItems)
{ {
lvSettings.Items.Add(CreateListViewItem(settingItem)); if (settingItem.IsSettingHidden) continue;
var itm = lvSettings.Items.Add(CreateListViewItem(settingItem));
if (Debugger.IsAttached && !settingItem.IsApiExposed)
{
itm.ForeColor = Color.LightCoral;
}
} }
btnResetValue.Enabled = false; btnResetValue.Enabled = false;
@@ -205,6 +217,8 @@ namespace nspector
cbValues.BeginUpdate(); cbValues.BeginUpdate();
tsbBitValueEditor.Enabled = false;
cbValues.Items.Clear(); cbValues.Items.Clear();
cbValues.Tag = lvSettings.SelectedItems[0].Tag; cbValues.Tag = lvSettings.SelectedItems[0].Tag;
uint settingid = (uint)lvSettings.SelectedItems[0].Tag; uint settingid = (uint)lvSettings.SelectedItems[0].Tag;
@@ -224,8 +238,12 @@ namespace nspector
itm = v; itm = v;
cbValues.Items.Add(itm); cbValues.Items.Add(itm);
} }
tsbBitValueEditor.Enabled = valueNames.Count > 0;
} }
if (settingMeta.SettingType == Native.NVAPI2.NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE && settingMeta.StringValues != null) if (settingMeta.SettingType == Native.NVAPI2.NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE && settingMeta.StringValues != null)
@@ -241,13 +259,6 @@ namespace nspector
foreach (string v in valueNames) foreach (string v in valueNames)
cbValues.Items.Add(v); cbValues.Items.Add(v);
} }
var scannedCount = settingMeta?.DwordValues?
.Where(x => x.ValueSource == Common.Meta.SettingMetaSource.ScannedSettings)
.Count();
tsbBitValueEditor.Enabled = scannedCount > 0;
} }
if (cbValues.Items.Count < 1) if (cbValues.Items.Count < 1)
@@ -257,6 +268,21 @@ namespace nspector
} }
var referenceSettings = DrsServiceLocator.ReferenceSettings?.Settings.FirstOrDefault(s => s.SettingId == settingid);
if (string.IsNullOrEmpty(settingMeta.Description) && !(referenceSettings?.HasConstraints ?? false))
{
tbSettingDescription.Text = "";
tbSettingDescription.Visible = false;
tbSettingDescription.BackColor = SystemColors.Control;
}
else
{
tbSettingDescription.Text = settingMeta.Description;
tbSettingDescription.Visible = true;
tbSettingDescription.BackColor = (referenceSettings?.HasConstraints ?? false) ? Color.LightCoral : SystemColors.Control;
}
cbValues.Text = lvSettings.SelectedItems[0].SubItems[1].Text; cbValues.Text = lvSettings.SelectedItems[0].SubItems[1].Text;
cbValues.EndUpdate(); cbValues.EndUpdate();
@@ -268,7 +294,7 @@ namespace nspector
cbValues.Visible = true; cbValues.Visible = true;
} }
} }
else else
@@ -310,7 +336,7 @@ namespace nspector
{ {
var settingId = (uint)cbValues.Tag; var settingId = (uint)cbValues.Tag;
var activeImages = new[] { 0, 2 }; var activeImages = new[] { 0, 2 };
int idx = GetListViewIndexOfSetting(settingId); int idx = GetListViewIndexOfSetting(settingId);
if (idx != -1) if (idx != -1)
{ {
@@ -330,6 +356,7 @@ namespace nspector
valueHasChanged = currentProfileItem.ValueRaw != stringBehind; valueHasChanged = currentProfileItem.ValueRaw != stringBehind;
} }
if (valueHasChanged || activeImages.Contains(lvItem.ImageIndex)) if (valueHasChanged || activeImages.Contains(lvItem.ImageIndex))
{ {
lvItem.ForeColor = SystemColors.ControlText; lvItem.ForeColor = SystemColors.ControlText;
@@ -417,6 +444,22 @@ namespace nspector
} }
} }
private void DeleteSelectedValue()
{
if (lvSettings.SelectedItems != null && lvSettings.SelectedItems.Count > 0)
{
var settingId = (uint)lvSettings.SelectedItems[0].Tag;
bool removeFromModified;
_drs.DeleteValue(_CurrentProfile, settingId, out removeFromModified);
if (removeFromModified)
RemoveFromModifiedProfiles(_CurrentProfile);
RefreshCurrentProfile();
}
}
private void InitTaskbarList() private void InitTaskbarList()
{ {
if (Environment.OSVersion.Version.Major >= 6 && Environment.OSVersion.Version.Minor >= 1) if (Environment.OSVersion.Version.Major >= 6 && Environment.OSVersion.Version.Minor >= 1)
@@ -454,16 +497,8 @@ namespace nspector
var numberFormat = new NumberFormatInfo() { NumberDecimalSeparator = "." }; var numberFormat = new NumberFormatInfo() { NumberDecimalSeparator = "." };
var version = Assembly.GetExecutingAssembly().GetName().Version; var version = Assembly.GetExecutingAssembly().GetName().Version;
var fileVersionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location); var fileVersionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
var titleText = string.Format("{8} {0}.{1}{5}{2}{5}{4} - {6} Profile Settings {3}- {7}", var externalCsn = DrsServiceLocator.IsExternalCustomSettings ? " - CSN OVERRIDE!" : "";
version.Major, version.Minor, version.Build, AdminHelper.IsAdmin ? "(Elevated) " : "", Text = $"{Application.ProductName} {version} - Geforce {_drs.DriverVersion.ToString("#.00", numberFormat)} - Profile Settings - {fileVersionInfo.LegalCopyright}{externalCsn}";
(version.Revision > 0 ? version.Revision.ToString() : ""),
(version.Revision > 0 ? "." : ""),
(_drs.DriverVersion > 0) ? "GeForce " + _drs.DriverVersion.ToString("#.00", numberFormat) + " -" : "Driver",
fileVersionInfo.LegalCopyright,
Application.ProductName
);
Text = titleText;
} }
private static void InitMessageFilter(IntPtr handle) private static void InitMessageFilter(IntPtr handle)
@@ -481,14 +516,13 @@ namespace nspector
DragAcceptNativeHelper.ChangeWindowMessageFilter(DragAcceptNativeHelper.WM_COPYGLOBALDATA, DragAcceptNativeHelper.MSGFLT_ADD); DragAcceptNativeHelper.ChangeWindowMessageFilter(DragAcceptNativeHelper.WM_COPYGLOBALDATA, DragAcceptNativeHelper.MSGFLT_ADD);
} }
} }
internal frmDrvSettings() : this(false, false) { } internal frmDrvSettings() : this(false, false) { }
internal frmDrvSettings(bool showCsnOnly, bool skipScan) internal frmDrvSettings(bool showCsnOnly, bool skipScan)
{ {
_skipScan = skipScan; _skipScan = skipScan;
InitializeComponent(); InitializeComponent();
InitTaskbarList(); InitTaskbarList();
InitScannerEvents();
SetupDropFilesNative(); SetupDropFilesNative();
SetupToolbar(); SetupToolbar();
SetupDpiAdjustments(); SetupDpiAdjustments();
@@ -497,8 +531,12 @@ namespace nspector
Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
} }
public static double ScaleFactor = 1;
private void SetupDpiAdjustments() private void SetupDpiAdjustments()
{ {
ScaleFactor = lblWidth330.Width / 330;
chSettingID.Width = lblWidth330.Width; chSettingID.Width = lblWidth330.Width;
chSettingValueHex.Width = lblWidth96.Width; chSettingValueHex.Width = lblWidth96.Width;
} }
@@ -524,7 +562,7 @@ namespace nspector
Height = Screen.GetWorkingArea(this).Height - 20; Height = Screen.GetWorkingArea(this).Height - 20;
} }
} }
private void RefreshModifiesProfilesDropDown() private void RefreshModifiesProfilesDropDown()
{ {
tsbModifiedProfiles.DropDownItems.Clear(); tsbModifiedProfiles.DropDownItems.Clear();
@@ -547,6 +585,7 @@ namespace nspector
{ {
SetupLayout(); SetupLayout();
SetTitleVersion(); SetTitleVersion();
LoadSettings();
RefreshProfilesCombo(); RefreshProfilesCombo();
cbProfiles.Text = GetBaseProfileName(); cbProfiles.Text = GetBaseProfileName();
@@ -582,7 +621,10 @@ namespace nspector
private void btnResetValue_Click(object sender, EventArgs e) private void btnResetValue_Click(object sender, EventArgs e)
{ {
ResetSelectedValue(); if (Control.ModifierKeys == Keys.Control)
DeleteSelectedValue();
else
ResetSelectedValue();
} }
private void ChangeCurrentProfile(string profileName) private void ChangeCurrentProfile(string profileName)
@@ -632,7 +674,7 @@ namespace nspector
catch { } catch { }
} }
} }
private void AddToModifiedProfiles(string profileName, bool userProfile = false) private void AddToModifiedProfiles(string profileName, bool userProfile = false)
{ {
if (!_scanner.UserProfiles.Contains(profileName) && profileName != _baseProfileName && userProfile) if (!_scanner.UserProfiles.Contains(profileName) && profileName != _baseProfileName && userProfile)
@@ -661,134 +703,75 @@ namespace nspector
} }
} }
private void InvokeUi(Control invokeControl, Action action) private void ShowExportProfiles()
{ {
MethodInvoker mi = () => action(); if (_scanner.ModifiedProfiles.Count > 0)
{
if (invokeControl.InvokeRequired) var frmExport = new frmExportProfiles();
invokeControl.BeginInvoke(mi); frmExport.ShowDialog(this);
}
else else
mi.Invoke(); MessageBox.Show("No user modified profiles found! Nothing to export.", "Userprofile Search", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void frmDrvSettings_OnModifiedScanDoneAndShowExport()
{
InvokeUi(this, () =>
{
pbMain.Value = 0;
pbMain.Enabled = false;
SetTaskbarProgress(0);
if (_scanner.ModifiedProfiles.Count > 0)
{
var frmExport = new frmExportProfiles();
frmExport.ShowDialog(this);
}
else
MessageBox.Show("No user modified profiles found! Nothing to export.", "Userprofile Search", MessageBoxButtons.OK, MessageBoxIcon.Information);
RefreshModifiesProfilesDropDown();
tsbRefreshProfile.Enabled = true;
});
} }
private void frmDrvSettings_OnPredefinedScanDoneAndStartModifiedProfileScan() private CancellationTokenSource _scannerCancelationTokenSource;
{
InvokeUi(this, () => private async Task ScanProfilesSilentAsync(bool scanPredefined, bool showProfileDialog)
{
pbMain.Value = 0;
pbMain.Enabled = false;
SetTaskbarProgress(0);
tscbShowScannedUnknownSettings.Enabled = true;
});
StartModifiedProfilesScan(false);
}
private void frmDrvSettings_OnScanDoneDoNothing()
{
_meta.ResetMetaCache();
InvokeUi(this, () =>
{
pbMain.Value = 0;
pbMain.Enabled = false;
SetTaskbarProgress(0);
RefreshCurrentProfile();
RefreshModifiesProfilesDropDown();
tsbRefreshProfile.Enabled = true;
});
}
private void frmDrvSettings_OnSettingScanProgress(int percent)
{
InvokeUi(this, () =>
{
pbMain.Value = percent;
SetTaskbarProgress(percent);
});
}
private void InitScannerEvents()
{
_scanner.OnSettingScanProgress += new Common.SettingScanProgressEvent(frmDrvSettings_OnSettingScanProgress);
_scanner.OnPredefinedSettingsScanDone += new Common.SettingScanDoneEvent(frmDrvSettings_OnScanDoneDoNothing);
_scanner.OnModifiedProfilesScanDone += new Common.SettingScanDoneEvent(frmDrvSettings_OnScanDoneDoNothing);
}
private void StartModifiedProfilesScan(bool showProfilesDialog)
{
pbMain.Minimum = 0;
pbMain.Maximum = 100;
_scanner.OnModifiedProfilesScanDone -= new Common.SettingScanDoneEvent(frmDrvSettings_OnScanDoneDoNothing);
_scanner.OnModifiedProfilesScanDone -= new Common.SettingScanDoneEvent(frmDrvSettings_OnModifiedScanDoneAndShowExport);
if (showProfilesDialog)
_scanner.OnModifiedProfilesScanDone += new Common.SettingScanDoneEvent(frmDrvSettings_OnModifiedScanDoneAndShowExport);
else
_scanner.OnModifiedProfilesScanDone += new Common.SettingScanDoneEvent(frmDrvSettings_OnScanDoneDoNothing);
_scanner.StartScanForModifiedProfilesAsync();
}
private void StartPredefinedSettingsScan(bool startModifiedProfileScan)
{
pbMain.Minimum = 0;
pbMain.Maximum = 100;
_scanner.OnPredefinedSettingsScanDone -= new Common.SettingScanDoneEvent(frmDrvSettings_OnScanDoneDoNothing);
_scanner.OnPredefinedSettingsScanDone -= new Common.SettingScanDoneEvent(frmDrvSettings_OnPredefinedScanDoneAndStartModifiedProfileScan);
if (startModifiedProfileScan)
_scanner.OnPredefinedSettingsScanDone += new Common.SettingScanDoneEvent(frmDrvSettings_OnPredefinedScanDoneAndStartModifiedProfileScan);
else
_scanner.OnPredefinedSettingsScanDone += new Common.SettingScanDoneEvent(frmDrvSettings_OnScanDoneDoNothing);
_alreadyScannedForPredefinedSettings = true;
_scanner.StartScanForPredefinedSettingsAsync();
}
private void ScanProfilesSilent(bool scanPredefined, bool showProfileDialog)
{ {
if (_skipScan) if (_skipScan)
{
if (scanPredefined && !_alreadyScannedForPredefinedSettings)
{
_alreadyScannedForPredefinedSettings = true;
_meta.ResetMetaCache();
tsbModifiedProfiles.Enabled = true;
exportUserdefinedProfilesToolStripMenuItem.Enabled = false;
RefreshCurrentProfile();
}
return; return;
}
tsbModifiedProfiles.Enabled = false; tsbModifiedProfiles.Enabled = false;
tsbRefreshProfile.Enabled = false; tsbRefreshProfile.Enabled = false;
pbMain.Minimum = 0; pbMain.Minimum = 0;
pbMain.Maximum = 100; pbMain.Maximum = 100;
_scannerCancelationTokenSource = new CancellationTokenSource();
var progressHandler = new Progress<int>(value =>
{
pbMain.Value = value;
SetTaskbarProgress(value);
});
if (scanPredefined && !_alreadyScannedForPredefinedSettings) if (scanPredefined && !_alreadyScannedForPredefinedSettings)
StartPredefinedSettingsScan(true); {
_alreadyScannedForPredefinedSettings = true;
await _scanner.ScanProfileSettingsAsync(false, progressHandler, _scannerCancelationTokenSource.Token);
_meta.ResetMetaCache();
tscbShowScannedUnknownSettings.Enabled = true;
}
else else
StartModifiedProfilesScan(showProfileDialog); {
await _scanner.ScanProfileSettingsAsync(true, progressHandler, _scannerCancelationTokenSource.Token);
}
RefreshModifiesProfilesDropDown();
tsbModifiedProfiles.Enabled = true;
pbMain.Value = 0;
pbMain.Enabled = false;
SetTaskbarProgress(0);
if (showProfileDialog)
{
ShowExportProfiles();
}
RefreshCurrentProfile();
tsbRefreshProfile.Enabled = true;
} }
private void cbCustomSettingsOnly_CheckedChanged(object sender, EventArgs e) private void cbCustomSettingsOnly_CheckedChanged(object sender, EventArgs e)
@@ -805,7 +788,7 @@ namespace nspector
} }
} }
private void tsbRestoreProfile_Click(object sender, EventArgs e) private async void tsbRestoreProfile_Click(object sender, EventArgs e)
{ {
if (Control.ModifierKeys == Keys.Control) if (Control.ModifierKeys == Keys.Control)
{ {
@@ -818,7 +801,7 @@ namespace nspector
RefreshProfilesCombo(); RefreshProfilesCombo();
RefreshCurrentProfile(); RefreshCurrentProfile();
ScanProfilesSilent(true, false); await ScanProfilesSilentAsync(true, false);
cbProfiles.Text = GetBaseProfileName(); cbProfiles.Text = GetBaseProfileName();
} }
} }
@@ -890,14 +873,14 @@ namespace nspector
} }
} }
private void frmDrvSettings_Shown(object sender, EventArgs e) private async void frmDrvSettings_Shown(object sender, EventArgs e)
{ {
if (_isStartup) if (_isStartup)
{ {
new Thread(SetTaskbarIcon).Start(); new Thread(SetTaskbarIcon).Start();
ScanProfilesSilent(true, false); await ScanProfilesSilentAsync(true, false);
if (WindowState != FormWindowState.Maximized) if (_scannerCancelationTokenSource != null && !_scannerCancelationTokenSource.Token.IsCancellationRequested && WindowState != FormWindowState.Maximized)
{ {
new MessageHelper().bringAppToFront((int)this.Handle); new MessageHelper().bringAppToFront((int)this.Handle);
} }
@@ -912,6 +895,9 @@ namespace nspector
if (MessageBox.Show(this, "Really delete all profiles?", "Delete all profiles", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) if (MessageBox.Show(this, "Really delete all profiles?", "Delete all profiles", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
{ {
_drs.DeleteAllProfilesHard(); _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) 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)
@@ -984,7 +970,7 @@ namespace nspector
//{ //{
// drs.DeleteApplication(currentProfile, e.ClickedItem.Text); // drs.DeleteApplication(currentProfile, e.ClickedItem.Text);
//} //}
_drs.DeleteApplication(_CurrentProfile, e.ClickedItem.Text); _drs.RemoveApplication(_CurrentProfile, e.ClickedItem.Tag.ToString());
RefreshCurrentProfile(); RefreshCurrentProfile();
} }
@@ -1025,9 +1011,9 @@ namespace nspector
tsbImportProfiles.ShowDropDown(); tsbImportProfiles.ShowDropDown();
} }
private void exportUserdefinedProfilesToolStripMenuItem_Click(object sender, EventArgs e) private async void exportUserdefinedProfilesToolStripMenuItem_Click(object sender, EventArgs e)
{ {
ScanProfilesSilent(false, true); await ScanProfilesSilentAsync(false, true);
} }
private void ExportCurrentProfile(bool includePredefined) private void ExportCurrentProfile(bool includePredefined)
@@ -1091,10 +1077,10 @@ namespace nspector
} }
} }
private void RefreshAll() private async void RefreshAll()
{ {
RefreshProfilesCombo(); RefreshProfilesCombo();
ScanProfilesSilent(true, false); await ScanProfilesSilentAsync(true, false);
int idx = cbProfiles.Items.IndexOf(_CurrentProfile); int idx = cbProfiles.Items.IndexOf(_CurrentProfile);
if (idx == -1 || _CurrentProfile == _baseProfileName) if (idx == -1 || _CurrentProfile == _baseProfileName)
@@ -1116,6 +1102,7 @@ namespace nspector
{ {
_import.ImportAllProfilesFromNvidiaTextFile(openDialog.FileName); _import.ImportAllProfilesFromNvidiaTextFile(openDialog.FileName);
MessageBox.Show("Profile(s) successfully imported!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Profile(s) successfully imported!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
DrsSessionScope.DestroyGlobalSession();
RefreshAll(); RefreshAll();
} }
catch (NvapiException) catch (NvapiException)
@@ -1146,7 +1133,7 @@ namespace nspector
cbProfiles.Select(cbProfiles.Text.Length, 0); cbProfiles.Select(cbProfiles.Text.Length, 0);
} }
} }
public static void ShowImportDoneMessage(string importReport) public static void ShowImportDoneMessage(string importReport)
{ {
@@ -1172,7 +1159,7 @@ namespace nspector
if (files.Length == 1) if (files.Length == 1)
{ {
var fileInfo = new FileInfo(files[0]); var fileInfo = new FileInfo(files[0]);
if (fileInfo.Extension.ToLower().Equals(".nip")) if (fileInfo.Extension.ToLowerInvariant().Equals(".nip"))
{ {
ImportProfiles(fileInfo.FullName); ImportProfiles(fileInfo.FullName);
return; return;
@@ -1208,18 +1195,212 @@ namespace nspector
private void lvSettings_DoubleClick(object sender, EventArgs e) private void lvSettings_DoubleClick(object sender, EventArgs e)
{ {
if (Debugger.IsAttached && lvSettings.SelectedItems != null && lvSettings.SelectedItems.Count == 1) if (isDevMode && lvSettings.SelectedItems != null && lvSettings.SelectedItems.Count == 1)
{ {
var settingId = ((uint)lvSettings.SelectedItems[0].Tag); var settingId = ((uint)lvSettings.SelectedItems[0].Tag);
var settingName = lvSettings.SelectedItems[0].Text; var settingName = lvSettings.SelectedItems[0].Text;
Clipboard.SetText(string.Format($"0x{settingId:X8} {settingName}")); //Clipboard.SetText(string.Format($"0x{settingId:X8} {settingName}"));
Clipboard.SetText(string.Format($"{settingName}"));
} }
} }
private void HandleScreenConstraints()
{
var workingArea = Screen.GetWorkingArea(this);
if (Left < workingArea.X)
Left = workingArea.X;
if (Top < workingArea.Y)
Top = workingArea.Y;
if ((Left + Width) > workingArea.X + workingArea.Width)
Left = (workingArea.X + workingArea.Width) - Width;
if ((Top + Height) > workingArea.Y + workingArea.Height)
Top = (workingArea.Y + workingArea.Height) - Height;
}
private void SaveSettings()
{
var settings = UserSettings.LoadSettings();
if (WindowState == FormWindowState.Normal)
{
settings.WindowTop = Top;
settings.WindowLeft = Left;
settings.WindowHeight = Height;
settings.WindowWidth = Width;
}
else
{
settings.WindowTop = RestoreBounds.Top;
settings.WindowLeft = RestoreBounds.Left;
settings.WindowHeight = RestoreBounds.Height;
settings.WindowWidth = RestoreBounds.Width;
}
settings.WindowState = WindowState;
settings.ShowCustomizedSettingNamesOnly = tscbShowCustomSettingNamesOnly.Checked;
settings.ShowScannedUnknownSettings = tscbShowScannedUnknownSettings.Checked;
settings.SaveSettings();
}
private void LoadSettings()
{
var settings = UserSettings.LoadSettings();
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)
{
_scannerCancelationTokenSource?.Cancel();
SaveSettings();
}
private void lvSettings_KeyDown(object sender, KeyEventArgs e) private void lvSettings_KeyDown(object sender, KeyEventArgs e)
{ {
if (e.Control && e.KeyCode == Keys.C)
{
CopyModifiedSettingsToClipBoard();
}
if (e.Control && e.Alt && e.KeyCode == Keys.D)
{
EnableDevmode();
}
if (Debugger.IsAttached && e.Control && e.KeyCode == Keys.T)
{
TestStoreSettings();
}
if (e.Control && e.KeyCode == Keys.F)
{
SearchSetting();
}
if (e.KeyCode == Keys.Escape)
{
RefreshCurrentProfile();
}
}
private void SearchSetting()
{
string inputString = "";
if (InputBox.Show("Search Setting", "Please enter setting name:", ref inputString, new List<string>(), "", 2048) == System.Windows.Forms.DialogResult.OK)
{
var lowerInput = inputString.Trim().ToLowerInvariant();
lvSettings.BeginUpdate();
foreach(ListViewItem itm in lvSettings.Items)
{
if (!itm.Text.ToLowerInvariant().Contains(lowerInput))
{
itm.Remove();
}
}
lvSettings.EndUpdate();
}
} }
private void EnableDevmode()
{
isDevMode = true;
lvSettings.Font = new Font("Consolas", 9);
cbValues.Font = new Font("Consolas", 9);
lvSettings.HeaderStyle = ColumnHeaderStyle.Nonclickable;
RefreshCurrentProfile();
}
private void TestStoreSettings()
{
var sbSettings = new StringBuilder();
sbSettings.AppendFormat("{0,-40} {1}\r\n", "### Inspector Store Failed ###", _CurrentProfile);
pbMain.Minimum = 0;
pbMain.Maximum = lvSettings.Items.Count;
int cntIndex = 0;
foreach (ListViewGroup group in lvSettings.Groups)
{
bool groupTitleAdded = false;
foreach (ListViewItem item in group.Items)
{
try
{
pbMain.Value = cntIndex++;
var settingId = (uint)item.Tag;
var meta = _meta.GetSettingMeta(settingId);
if (meta.SettingType != NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE) continue;
var wasNotSet = new int[] { 1, 2, 3 }.Contains(item.ImageIndex);
if (wasNotSet)
{
_drs.SetDwordValueToProfile(_CurrentProfile, settingId, 0x0);
_drs.ResetValue(_CurrentProfile, settingId, out var rm);
}
else
{
var tmpValue = _drs.GetDwordValueFromProfile(_CurrentProfile, settingId);
_drs.SetDwordValueToProfile(_CurrentProfile, settingId, 0x0);
_drs.SetDwordValueToProfile(_CurrentProfile, settingId, tmpValue);
}
}
catch (NvapiException ne)
{
if (!groupTitleAdded)
{
sbSettings.AppendFormat("\r\n[{0}]\r\n", group.Header);
groupTitleAdded = true;
}
sbSettings.AppendFormat("{0,-40} SettingId: {1} Failed: {2}\r\n", item.Text, DrsUtil.GetDwordString((uint)item.Tag), ne.Status);
}
}
}
pbMain.Value = 0;
Clipboard.SetText(sbSettings.ToString());
MessageBox.Show("Failed Settings Stored to Clipboard");
}
private void CopyModifiedSettingsToClipBoard()
{
var sbSettings = new StringBuilder();
sbSettings.AppendFormat("{0,-40} {1}\r\n", "### NVIDIA Profile Inspector ###", _CurrentProfile);
foreach (ListViewGroup group in lvSettings.Groups)
{
bool groupTitleAdded = false;
foreach (ListViewItem item in group.Items)
{
if (item.ImageIndex != 0) continue;
if(!groupTitleAdded)
{
sbSettings.AppendFormat("\r\n[{0}]\r\n", group.Header);
groupTitleAdded = true;
}
sbSettings.AppendFormat("{0,-40} {1}\r\n", item.Text, item.SubItems[1].Text);
}
}
Clipboard.SetText(sbSettings.ToString());
}
} }
} }
+1 -4
View File
@@ -125,7 +125,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADI ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADI
DAAAAk1TRnQBSQFMAgEBBAEAAZABBwGQAQcBEAEAARABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFA DAAAAk1TRnQBSQFMAgEBBAEAAcABBwHAAQcBEAEAARABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFA
AwABIAMAAQEBAAEYBgABGP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/ADMAAcgBvQGvAacBkQF5BgAD/iEA AwABIAMAAQEBAAEYBgABGP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/ADMAAcgBvQGvAacBkQF5BgAD/iEA
A+QD2gYAA/4hAAGXAcMBqwFMAZwBcAYAA/4hAAOmA2gGAAP+FQAB8gHxAfABqQGPAXQBzwHHAbwD/wG6 A+QD2gYAA/4hAAGXAcMBqwFMAZwBcAYAA/4hAAOmA2gGAAP+FQAB8gHxAfABqQGPAXQBzwHHAbwD/wG6
AaUBjAGuAZQBeAHxAe8B7QHvAe0B6wGhAYgBbQHkAeAB2xIAA/UD3QPmA/8D4APeA/QD8wPaA+4SAAHt AaUBjAGuAZQBeAHxAe8B7QHvAe0B6wGhAYgBbQHkAeAB2xIAA/UD3QPmA/8D4APeA/QD8wPaA+4SAAHt
@@ -282,7 +282,4 @@
<metadata name="lblWidth30.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="lblWidth30.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="lvSettings.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root> </root>
+6 -6
View File
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>nspector</RootNamespace> <RootNamespace>nspector</RootNamespace>
<AssemblyName>nvidiaProfileInspector</AssemblyName> <AssemblyName>nvidiaProfileInspector</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
@@ -93,7 +93,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>bin\Release\</OutputPath> <OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE;RELEASE</DefineConstants>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<DebugType>none</DebugType> <DebugType>none</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
@@ -135,12 +135,14 @@
<Compile Include="Common\DrsSessionScope.cs" /> <Compile Include="Common\DrsSessionScope.cs" />
<Compile Include="Common\DrsSettingsMetaService.cs" /> <Compile Include="Common\DrsSettingsMetaService.cs" />
<Compile Include="Common\DrsUtil.cs" /> <Compile Include="Common\DrsUtil.cs" />
<Compile Include="Common\Helper\DropDownMenuScrollWheelHandler.cs" />
<Compile Include="Common\Helper\ListViewGroupSorter.cs" /> <Compile Include="Common\Helper\ListViewGroupSorter.cs" />
<Compile Include="Common\Helper\ShortcutResolver.cs" /> <Compile Include="Common\Helper\ShortcutResolver.cs" />
<Compile Include="Common\Helper\SteamAppResolver.cs" /> <Compile Include="Common\Helper\SteamAppResolver.cs" />
<Compile Include="Common\Helper\TempFile.cs" />
<Compile Include="Common\Helper\UserSettings.cs" />
<Compile Include="Common\Import\ImportExportUitl.cs" /> <Compile Include="Common\Import\ImportExportUitl.cs" />
<Compile Include="Common\Import\SettingValueType.cs" /> <Compile Include="Common\Import\SettingValueType.cs" />
<Compile Include="Common\Meta\NvD3dUmxSettingMetaService.cs" />
<Compile Include="Common\Meta\MetaServiceItem.cs" /> <Compile Include="Common\Meta\MetaServiceItem.cs" />
<Compile Include="Common\Meta\ConstantSettingMetaService.cs" /> <Compile Include="Common\Meta\ConstantSettingMetaService.cs" />
<Compile Include="Common\Meta\CustomSettingMetaService.cs" /> <Compile Include="Common\Meta\CustomSettingMetaService.cs" />
@@ -224,9 +226,7 @@
<DependentUpon>Resources.resx</DependentUpon> <DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
</Compile> </Compile>
<None Include="app.config"> <None Include="app.config" />
<SubType>Designer</SubType>
</None>
<None Include="app.manifest"> <None Include="app.manifest">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</None> </None>
+5 -2
View File
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14 # Visual Studio Version 17
VisualStudioVersion = 14.0.23107.0 VisualStudioVersion = 17.3.32929.385
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nvidiaProfileInspector", "nspector\nvidiaProfileInspector.csproj", "{27B20027-E783-4ADC-AF16-40A49463F4BF}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nvidiaProfileInspector", "nspector\nvidiaProfileInspector.csproj", "{27B20027-E783-4ADC-AF16-40A49463F4BF}"
EndProject EndProject
@@ -19,4 +19,7 @@ Global
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7FB061B1-515F-4B0E-B49F-552DFCA05527}
EndGlobalSection
EndGlobal EndGlobal