mirror of
https://github.com/Orbmu2k/nvidiaProfileInspector.git
synced 2026-01-04 04:48:11 -05:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9adc3b9cb9 | ||
|
|
57a8879a2c | ||
|
|
c47e69d81c | ||
|
|
21674d3f09 | ||
|
|
b5a13cf6fe | ||
|
|
c222cf1b06 | ||
|
|
6d3237bfeb | ||
|
|
5dbb8ef721 | ||
|
|
fcd9ef5346 | ||
|
|
67bb397b6a | ||
|
|
ffff16ca83 | ||
|
|
cd8caa5702 | ||
|
|
2d57d6b885 | ||
|
|
84749fdf5f | ||
|
|
b651dae816 | ||
|
|
0a27ce1c36 | ||
|
|
499cdde758 | ||
|
|
cedcd4e2c6 | ||
|
|
5301c52c16 | ||
|
|
bf8243adaf |
12
README.md
12
README.md
@@ -1 +1,11 @@
|
||||
# nvidiaProfileInspector
|
||||
 **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
|
||||
|
||||

|
||||
BIN
npi_screenshot.png
Normal file
BIN
npi_screenshot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 109 KiB |
@@ -6,7 +6,7 @@ namespace nspector.Common
|
||||
internal class CachedSettingValue
|
||||
{
|
||||
|
||||
internal CachedSettingValue() { }
|
||||
internal CachedSettingValue() { }
|
||||
|
||||
internal CachedSettingValue(uint Value, string ProfileNames)
|
||||
{
|
||||
|
||||
@@ -6,14 +6,14 @@ namespace nspector.Common
|
||||
{
|
||||
internal class CachedSettings
|
||||
{
|
||||
internal CachedSettings() { }
|
||||
internal CachedSettings() { }
|
||||
|
||||
internal CachedSettings(uint settingId, NVDRS_SETTING_TYPE settingType)
|
||||
{
|
||||
SettingId = settingId;
|
||||
SettingType = settingType;
|
||||
}
|
||||
|
||||
|
||||
internal uint SettingId;
|
||||
|
||||
internal List<CachedSettingValue> SettingValues = new List<CachedSettingValue>();
|
||||
@@ -21,7 +21,7 @@ namespace nspector.Common
|
||||
internal uint ProfileCount = 0;
|
||||
|
||||
internal NVDRS_SETTING_TYPE SettingType = NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE;
|
||||
|
||||
|
||||
internal void AddDwordValue(uint valueDword, string Profile)
|
||||
{
|
||||
var setting = SettingValues.FirstOrDefault(s => s.Value == valueDword);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace nspector.Common.CustomSettings
|
||||
|
||||
@@ -8,8 +8,6 @@ namespace nspector.Common.CustomSettings
|
||||
[Serializable]
|
||||
public class CustomSettingNames
|
||||
{
|
||||
public bool ShowCustomizedSettingNamesOnly = false;
|
||||
|
||||
public List<CustomSetting> Settings = new List<CustomSetting>();
|
||||
|
||||
public void StoreToFile(string filename)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
namespace nspector.Common.CustomSettings
|
||||
{
|
||||
|
||||
@@ -31,7 +31,11 @@ namespace nspector.Common
|
||||
|
||||
public DrsDecrypterService(DrsSettingsMetaService metaService) : base(metaService)
|
||||
{
|
||||
CreateInternalSettingMap();
|
||||
try
|
||||
{
|
||||
CreateInternalSettingMap();
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private uint GetDwordFromKey(uint offset)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Policy;
|
||||
using System.Text;
|
||||
using nspector.Common.Import;
|
||||
using nspector.Native.NVAPI2;
|
||||
@@ -18,8 +17,8 @@ namespace nspector.Common
|
||||
private readonly DrsDecrypterService _DecrypterService;
|
||||
|
||||
public DrsImportService(
|
||||
DrsSettingsMetaService metaService,
|
||||
DrsSettingsService settingService,
|
||||
DrsSettingsMetaService metaService,
|
||||
DrsSettingsService settingService,
|
||||
DrsScannerService scannerService,
|
||||
DrsDecrypterService decrypterService)
|
||||
: base(metaService)
|
||||
@@ -43,7 +42,7 @@ namespace nspector.Common
|
||||
{
|
||||
LoadSettingsFileEx(hSession, filename);
|
||||
SaveSettings(hSession);
|
||||
});
|
||||
}, forceNonGlobalSession: true, preventLoadSettings: true);
|
||||
}
|
||||
|
||||
internal void ExportProfiles(List<string> profileNames, string filename, bool includePredefined)
|
||||
@@ -77,7 +76,7 @@ namespace nspector.Common
|
||||
{
|
||||
result.Executeables.Add(app.appName);
|
||||
}
|
||||
|
||||
|
||||
var settings = GetProfileSettings(hSession, hProfile);
|
||||
foreach (var setting in settings)
|
||||
{
|
||||
@@ -239,7 +238,7 @@ namespace nspector.Common
|
||||
var decryptedSetting = setting;
|
||||
_DecrypterService.DecryptSettingIfNeeded(profileName, ref decryptedSetting);
|
||||
|
||||
if (isPredefined && exitsValueInImport && ImportExportUitl.AreDrsSettingEqualToProfileSetting(decryptedSetting, importSetting))
|
||||
if (isPredefined && exitsValueInImport && ImportExportUitl.AreDrsSettingEqualToProfileSetting(decryptedSetting, importSetting))
|
||||
{
|
||||
alreadySet.Add(setting.settingId);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace nspector.Common
|
||||
checkedSettingsCount++;
|
||||
AddScannedSettingToCache(profile, setting);
|
||||
alreadyCheckedSettingIds.Add(setting.settingId);
|
||||
return true;
|
||||
return (setting.isCurrentPredefined != 1);
|
||||
}
|
||||
else if (setting.isCurrentPredefined != 1)
|
||||
{
|
||||
@@ -79,11 +79,10 @@ namespace nspector.Common
|
||||
return (current > 0) ? (int)Math.Round((current * 100f) / max) : 0; ;
|
||||
}
|
||||
|
||||
public async Task ScanForModifiedProfilesAsync(IProgress<int> progress, CancellationToken token = default(CancellationToken))
|
||||
public async Task ScanProfileSettingsAsync(bool justModified, IProgress<int> progress, CancellationToken token = default(CancellationToken))
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
|
||||
ModifiedProfiles = new List<string>();
|
||||
UserProfiles = new HashSet<string>();
|
||||
var knownPredefines = new List<uint>(_commonSettingIds);
|
||||
@@ -105,100 +104,33 @@ namespace nspector.Common
|
||||
var profile = GetProfileInfo(hSession, hProfile);
|
||||
|
||||
int checkedSettingsCount = 0;
|
||||
bool foundModifiedProfile = false;
|
||||
var alreadyChecked = new List<uint>();
|
||||
|
||||
bool foundModifiedProfile = false;
|
||||
if (profile.isPredefined == 0)
|
||||
{
|
||||
ModifiedProfiles.Add(profile.profileName);
|
||||
UserProfiles.Add(profile.profileName);
|
||||
continue;
|
||||
foundModifiedProfile = true;
|
||||
if (justModified) continue;
|
||||
}
|
||||
|
||||
if ((hBaseProfile == hProfile || profile.numOfApps > 0) && profile.numOfSettings > 0)
|
||||
{
|
||||
var alreadyChecked = new List<uint>();
|
||||
|
||||
foreach (uint settingId in knownPredefines)
|
||||
{
|
||||
if (CheckCommonSetting(hSession, hProfile, profile,
|
||||
ref checkedSettingsCount, settingId, false, ref alreadyChecked))
|
||||
{
|
||||
foundModifiedProfile = true;
|
||||
ModifiedProfiles.Add(profile.profileName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// the detection if only applications has changed in a profile makes the scan process very slow, we leave it out!
|
||||
//if (!foundModifiedProfile && profile.numOfApps > 0)
|
||||
//{
|
||||
// var apps = GetProfileApplications(hSession, hProfile);
|
||||
// foreach (var app in apps)
|
||||
// {
|
||||
// if (app.isPredefined == 0)
|
||||
// {
|
||||
// foundModifiedProfile = true;
|
||||
// ModifiedProfiles.Add(profile.profileName);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
if (foundModifiedProfile || checkedSettingsCount >= profile.numOfSettings)
|
||||
continue;
|
||||
|
||||
var settings = GetProfileSettings(hSession, hProfile);
|
||||
foreach (var setting in settings)
|
||||
{
|
||||
if (knownPredefines.IndexOf(setting.settingId) < 0)
|
||||
knownPredefines.Add(setting.settingId);
|
||||
|
||||
if (setting.isCurrentPredefined != 1)
|
||||
{
|
||||
ModifiedProfiles.Add(profile.profileName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public async Task ScanForPredefinedProfileSettingsAsync(IProgress<int> progress, CancellationToken token = default(CancellationToken))
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
|
||||
var knownPredefines = new List<uint>(_commonSettingIds);
|
||||
|
||||
DrsSession((hSession) =>
|
||||
{
|
||||
var profileHandles = EnumProfileHandles(hSession);
|
||||
|
||||
var maxProfileCount = profileHandles.Count;
|
||||
int curProfilePos = 0;
|
||||
|
||||
foreach (IntPtr hProfile in profileHandles)
|
||||
{
|
||||
if (token.IsCancellationRequested) break;
|
||||
|
||||
progress?.Report(CalcPercent(curProfilePos++, maxProfileCount));
|
||||
|
||||
var profile = GetProfileInfo(hSession, hProfile);
|
||||
|
||||
int checkedSettingsCount = 0;
|
||||
var alreadyChecked = new List<uint>();
|
||||
|
||||
foreach (uint kpd in knownPredefines)
|
||||
{
|
||||
CheckCommonSetting(hSession, hProfile, profile,
|
||||
ref checkedSettingsCount, kpd, true, ref alreadyChecked);
|
||||
if (CheckCommonSetting(hSession, hProfile, profile,
|
||||
ref checkedSettingsCount, kpd, !justModified, ref alreadyChecked))
|
||||
{
|
||||
if (!foundModifiedProfile)
|
||||
{
|
||||
foundModifiedProfile = true;
|
||||
ModifiedProfiles.Add(profile.profileName);
|
||||
if (justModified) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (checkedSettingsCount >= profile.numOfSettings)
|
||||
if ((foundModifiedProfile && justModified) || checkedSettingsCount >= profile.numOfSettings)
|
||||
continue;
|
||||
|
||||
var settings = GetProfileSettings(hSession, hProfile);
|
||||
@@ -207,8 +139,18 @@ namespace nspector.Common
|
||||
if (knownPredefines.IndexOf(setting.settingId) < 0)
|
||||
knownPredefines.Add(setting.settingId);
|
||||
|
||||
if (alreadyChecked.IndexOf(setting.settingId) < 0)
|
||||
if (!justModified && alreadyChecked.IndexOf(setting.settingId) < 0)
|
||||
AddScannedSettingToCache(profile, setting);
|
||||
|
||||
if (setting.isCurrentPredefined != 1)
|
||||
{
|
||||
if (!foundModifiedProfile)
|
||||
{
|
||||
foundModifiedProfile = true;
|
||||
ModifiedProfiles.Add(profile.profileName);
|
||||
if (justModified) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -245,6 +187,8 @@ namespace nspector.Common
|
||||
else if (setting.settingType == NVDRS_SETTING_TYPE.NVDRS_BINARY_TYPE)
|
||||
cachedSetting.AddBinaryValue(setting.predefinedValue.binaryValue, profile.profileName);
|
||||
}
|
||||
else
|
||||
cachedSetting.ProfileCount++;
|
||||
|
||||
if (!cacheEntryExists)
|
||||
CachedSettings.Add(cachedSetting);
|
||||
|
||||
@@ -1,15 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using nspector.Common.CustomSettings;
|
||||
|
||||
using nvw = nspector.Native.NVAPI2.NvapiDrsWrapper;
|
||||
|
||||
namespace nspector.Common
|
||||
{
|
||||
internal class DrsServiceLocator
|
||||
@@ -53,6 +45,6 @@ namespace nspector.Common
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,12 +14,12 @@ namespace nspector.Common
|
||||
private static object _Sync = new object();
|
||||
|
||||
|
||||
public static T DrsSession<T>(Func<IntPtr, T> action, bool forceNonGlobalSession = false)
|
||||
public static T DrsSession<T>(Func<IntPtr, T> action, bool forceNonGlobalSession = false, bool preventLoadSettings = false)
|
||||
{
|
||||
lock (_Sync)
|
||||
{
|
||||
if (!HoldSession || forceNonGlobalSession)
|
||||
return NonGlobalDrsSession<T>(action);
|
||||
return NonGlobalDrsSession<T>(action, preventLoadSettings);
|
||||
|
||||
|
||||
if (GlobalSession == IntPtr.Zero)
|
||||
@@ -32,9 +32,12 @@ namespace nspector.Common
|
||||
if (csRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_CreateSession", csRes);
|
||||
|
||||
var nvRes = nvw.DRS_LoadSettings(GlobalSession);
|
||||
if (nvRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_LoadSettings", nvRes);
|
||||
if (!preventLoadSettings)
|
||||
{
|
||||
var nvRes = nvw.DRS_LoadSettings(GlobalSession);
|
||||
if (nvRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_LoadSettings", nvRes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
var csRes = nvw.DRS_CreateSession(ref hSession);
|
||||
@@ -67,9 +70,12 @@ namespace nspector.Common
|
||||
|
||||
try
|
||||
{
|
||||
var nvRes = nvw.DRS_LoadSettings(hSession);
|
||||
if (nvRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_LoadSettings", nvRes);
|
||||
if (!preventLoadSettings)
|
||||
{
|
||||
var nvRes = nvw.DRS_LoadSettings(hSession);
|
||||
if (nvRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_LoadSettings", nvRes);
|
||||
}
|
||||
|
||||
return action(hSession);
|
||||
}
|
||||
|
||||
@@ -1,24 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using nspector.Common.Meta;
|
||||
using nspector.Common.CustomSettings;
|
||||
using nspector.Native.NVAPI2;
|
||||
using nspector.Native.NvApi.DriverSettings;
|
||||
|
||||
namespace nspector.Common
|
||||
{
|
||||
internal class DrsSettingsMetaService
|
||||
{
|
||||
|
||||
|
||||
private ISettingMetaService ConstantMeta;
|
||||
private ISettingMetaService CustomMeta;
|
||||
public ISettingMetaService DriverMeta;
|
||||
private ISettingMetaService ScannedMeta;
|
||||
private ISettingMetaService ReferenceMeta;
|
||||
private ISettingMetaService NvD3dUmxMeta;
|
||||
|
||||
private readonly CustomSettingNames _customSettings;
|
||||
private readonly CustomSettingNames _referenceSettings;
|
||||
@@ -39,7 +35,7 @@ namespace nspector.Common
|
||||
{
|
||||
settingMetaCache = new Dictionary<uint, SettingMeta>();
|
||||
MetaServices = new List<MetaServiceItem>();
|
||||
|
||||
|
||||
CustomMeta = new CustomSettingMetaService(_customSettings);
|
||||
MetaServices.Add(new MetaServiceItem() { ValueNamePrio = 1, Service = CustomMeta });
|
||||
|
||||
@@ -62,13 +58,10 @@ namespace nspector.Common
|
||||
ReferenceMeta = new CustomSettingMetaService(_referenceSettings, SettingMetaSource.ReferenceSettings);
|
||||
MetaServices.Add(new MetaServiceItem() { ValueNamePrio = 4, Service = ReferenceMeta });
|
||||
}
|
||||
|
||||
NvD3dUmxMeta = new NvD3dUmxSettingMetaService();
|
||||
MetaServices.Add(new MetaServiceItem() { ValueNamePrio = 6, Service = NvD3dUmxMeta });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private NVDRS_SETTING_TYPE? GetSettingValueType(uint settingId)
|
||||
{
|
||||
foreach (var service in MetaServices.OrderBy(x => x.Service.Source))
|
||||
@@ -80,16 +73,26 @@ namespace nspector.Common
|
||||
|
||||
return NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE;
|
||||
}
|
||||
|
||||
|
||||
private string GetSettingName(uint settingId)
|
||||
{
|
||||
foreach (var service in MetaServices.OrderBy(x=>x.Service.Source))
|
||||
string hexCandidate = null;
|
||||
|
||||
foreach (var service in MetaServices.OrderBy(x => x.Service.Source))
|
||||
{
|
||||
var settingName = service.Service.GetSettingName(settingId);
|
||||
if (settingName != null)
|
||||
|
||||
if (!string.IsNullOrEmpty(settingName))
|
||||
{
|
||||
if (settingName.StartsWith("0x"))
|
||||
{
|
||||
hexCandidate = settingName;
|
||||
continue;
|
||||
}
|
||||
return settingName;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return hexCandidate;
|
||||
}
|
||||
|
||||
private string GetGroupName(uint settingId)
|
||||
@@ -123,7 +126,7 @@ namespace nspector.Common
|
||||
if (settingDefault != null)
|
||||
return settingDefault;
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -153,7 +156,7 @@ namespace nspector.Common
|
||||
else
|
||||
{
|
||||
var currentNonScannedValues = a.Where(xa => xa.ValueSource != SettingMetaSource.ScannedSettings).Select(xa => xa.Value).ToList();
|
||||
|
||||
|
||||
var newNonScannedValues = b.Where(xb => !currentNonScannedValues.Contains(xb.Value)).ToList();
|
||||
a.AddRange(newNonScannedValues);
|
||||
|
||||
@@ -171,7 +174,7 @@ namespace nspector.Common
|
||||
|
||||
var atmp = a.FirstOrDefault();
|
||||
if (atmp != null && atmp is IComparable)
|
||||
return a.OrderBy(x=>x.Value).ToList();
|
||||
return a.OrderBy(x => x.Value).ToList();
|
||||
else
|
||||
return a.ToList();
|
||||
}
|
||||
@@ -196,7 +199,7 @@ namespace nspector.Common
|
||||
{
|
||||
result = MergeSettingValues(result, service.Service.GetStringValues(settingId));
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -211,15 +214,15 @@ namespace nspector.Common
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
result = (from v in result.Where(x=> 1==1
|
||||
result = (from v in result.Where(x => 1 == 1
|
||||
&& !x.ValueName.EndsWith("_NUM")
|
||||
&& !x.ValueName.EndsWith("_MASK")
|
||||
&& (!x.ValueName.EndsWith("_MIN") || x.ValueName.Equals("PREFERRED_PSTATE_PREFER_MIN"))
|
||||
&& (!x.ValueName.EndsWith("_MAX") || x.ValueName.Equals("PREFERRED_PSTATE_PREFER_MAX"))
|
||||
|
||||
)
|
||||
group v by v.ValueName into g
|
||||
select g.First(t => t.ValueName == g.Key))
|
||||
|
||||
)
|
||||
group v by v.ValueName into g
|
||||
select g.First(t => t.ValueName == g.Key))
|
||||
.OrderBy(v => v.ValueSource)
|
||||
.ThenBy(v => v.ValuePos)
|
||||
.ThenBy(v => v.ValueName).ToList();
|
||||
@@ -228,7 +231,7 @@ namespace nspector.Common
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public List<uint> GetSettingIds(SettingViewMode viewMode)
|
||||
{
|
||||
var settingIds = new List<uint>();
|
||||
@@ -249,22 +252,21 @@ namespace nspector.Common
|
||||
switch (viewMode)
|
||||
{
|
||||
case SettingViewMode.CustomSettingsOnly:
|
||||
return new [] {
|
||||
SettingMetaSource.CustomSettings
|
||||
return new[] {
|
||||
SettingMetaSource.CustomSettings
|
||||
};
|
||||
case SettingViewMode.IncludeScannedSetttings:
|
||||
return new [] {
|
||||
return new[] {
|
||||
SettingMetaSource.ConstantSettings,
|
||||
SettingMetaSource.ScannedSettings,
|
||||
SettingMetaSource.CustomSettings,
|
||||
SettingMetaSource.ScannedSettings,
|
||||
SettingMetaSource.CustomSettings,
|
||||
SettingMetaSource.DriverSettings,
|
||||
SettingMetaSource.NvD3dUmxSettings,
|
||||
SettingMetaSource.ReferenceSettings,
|
||||
};
|
||||
default:
|
||||
return new [] {
|
||||
SettingMetaSource.CustomSettings,
|
||||
SettingMetaSource.DriverSettings,
|
||||
return new[] {
|
||||
SettingMetaSource.CustomSettings,
|
||||
SettingMetaSource.DriverSettings,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -284,7 +286,6 @@ namespace nspector.Common
|
||||
SettingMetaSource.ScannedSettings,
|
||||
SettingMetaSource.CustomSettings,
|
||||
SettingMetaSource.DriverSettings,
|
||||
SettingMetaSource.NvD3dUmxSettings,
|
||||
SettingMetaSource.ReferenceSettings,
|
||||
|
||||
};
|
||||
@@ -296,7 +297,7 @@ namespace nspector.Common
|
||||
var settingType = GetSettingValueType(settingId);
|
||||
var settingName = GetSettingName(settingId);
|
||||
var groupName = GetGroupName(settingId);
|
||||
|
||||
|
||||
if (groupName == null)
|
||||
groupName = GetLegacyGroupName(settingId, settingName);
|
||||
|
||||
@@ -306,11 +307,11 @@ namespace nspector.Common
|
||||
SettingName = settingName,
|
||||
GroupName = groupName,
|
||||
|
||||
DefaultDwordValue =
|
||||
settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE
|
||||
DefaultDwordValue =
|
||||
settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE
|
||||
? GetDwordDefaultValue(settingId) : 0,
|
||||
|
||||
DefaultStringValue =
|
||||
DefaultStringValue =
|
||||
settingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE
|
||||
? GetStringDefaultValue(settingId) : null,
|
||||
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using nspector.Common.Helper;
|
||||
using nspector.Common.Meta;
|
||||
using nspector.Native.NVAPI2;
|
||||
@@ -38,6 +35,22 @@ namespace nspector.Common
|
||||
|
||||
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),
|
||||
@"NVIDIA Corporation\Drs");
|
||||
}
|
||||
@@ -62,13 +75,13 @@ namespace nspector.Common
|
||||
var tmpFile = TempFile.GetTempFileName();
|
||||
try
|
||||
{
|
||||
File.WriteAllText(tmpFile, "BaseProfile \"Base Profile\"\r\nProfile \"Base Profile\"\r\nShowOn All\r\nProfileType Global\r\nEndProfile\r\n");
|
||||
File.WriteAllText(tmpFile, "BaseProfile \"Base Profile\"\r\nSelectedGlobalProfile \"Base Profile\"\r\nProfile \"Base Profile\"\r\nShowOn All\r\nProfileType Global\r\nEndProfile\r\n");
|
||||
|
||||
DrsSession((hSession) =>
|
||||
{
|
||||
LoadSettingsFileEx(hSession, tmpFile);
|
||||
SaveSettings(hSession);
|
||||
});
|
||||
}, forceNonGlobalSession: true, preventLoadSettings: true);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -121,13 +134,13 @@ namespace nspector.Common
|
||||
var nvRes = nvw.DRS_DeleteProfile(hSession, hProfile);
|
||||
if (nvRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_DeleteProfile", nvRes);
|
||||
|
||||
|
||||
SaveSettings(hSession);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public List<string> GetProfileNames(ref string baseProfileName)
|
||||
{
|
||||
var lstResult = new List<string>();
|
||||
@@ -138,7 +151,7 @@ namespace nspector.Common
|
||||
var hBase = GetProfileHandle(hSession, null);
|
||||
var baseProfile = GetProfileInfo(hSession, hBase);
|
||||
tmpBaseProfileName = baseProfile.profileName;
|
||||
|
||||
|
||||
lstResult.Add("_GLOBAL_DRIVER_PROFILE (" + tmpBaseProfileName + ")");
|
||||
|
||||
var profileHandles = EnumProfileHandles(hSession);
|
||||
@@ -162,7 +175,7 @@ namespace nspector.Common
|
||||
DrsSession((hSession) =>
|
||||
{
|
||||
var hProfile = CreateProfile(hSession, profileName);
|
||||
|
||||
|
||||
if (applicationName != null)
|
||||
AddApplication(hSession, hProfile, applicationName);
|
||||
|
||||
@@ -239,7 +252,7 @@ namespace nspector.Common
|
||||
var nvRes = nvw.DRS_RestoreProfileDefaultSetting(hSession, hProfile, settingId);
|
||||
if (nvRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_RestoreProfileDefaultSetting", nvRes);
|
||||
|
||||
|
||||
SaveSettings(hSession);
|
||||
|
||||
var modifyCount = 0;
|
||||
@@ -266,7 +279,7 @@ namespace nspector.Common
|
||||
var hProfile = GetProfileHandle(hSession, profileName);
|
||||
|
||||
var dwordValue = ReadDwordValue(hSession, hProfile, settingId);
|
||||
|
||||
|
||||
if (dwordValue != null)
|
||||
return dwordValue.Value;
|
||||
else if (returnDefaultValue)
|
||||
@@ -286,7 +299,7 @@ namespace nspector.Common
|
||||
});
|
||||
}
|
||||
|
||||
public int StoreSettingsToProfile(string profileName, List<KeyValuePair<uint,string>> settings)
|
||||
public int StoreSettingsToProfile(string profileName, List<KeyValuePair<uint, string>> settings)
|
||||
{
|
||||
DrsSession((hSession) =>
|
||||
{
|
||||
@@ -319,7 +332,7 @@ namespace nspector.Common
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private SettingItem CreateSettingItem(NVDRS_SETTING setting, bool useDefault = false)
|
||||
{
|
||||
@@ -431,9 +444,9 @@ namespace nspector.Common
|
||||
IsStringValue = settingMeta.SettingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
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 settingIds = meta.GetSettingIds(viewMode);
|
||||
@@ -443,7 +456,7 @@ namespace nspector.Common
|
||||
applications = DrsSession((hSession) =>
|
||||
{
|
||||
var hProfile = GetProfileHandle(hSession, profileName);
|
||||
|
||||
|
||||
var profileSettings = GetProfileSettings(hSession, hProfile);
|
||||
foreach (var profileSetting in profileSettings)
|
||||
{
|
||||
@@ -466,11 +479,11 @@ namespace nspector.Common
|
||||
}
|
||||
|
||||
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)
|
||||
@@ -483,26 +496,27 @@ namespace nspector.Common
|
||||
});
|
||||
}
|
||||
|
||||
public void DeleteApplication(string profileName, string applicationName)
|
||||
public void RemoveApplication(string profileName, string applicationFingerprint)
|
||||
{
|
||||
DrsSession((hSession) =>
|
||||
{
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
public List<string> GetApplications(string profileName)
|
||||
private string GetApplicationFingerprint(NVDRS_APPLICATION_V3 application)
|
||||
{
|
||||
return DrsSession((hSession) =>
|
||||
{
|
||||
var hProfile = GetProfileHandle(hSession, profileName);
|
||||
var applications = GetProfileApplications(hSession, hProfile);
|
||||
return applications.Select(x => x.appName).ToList();
|
||||
});
|
||||
return $"{application.appName}|{application.fileInFolder}|{application.userFriendlyName}|{application.launcher}";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -41,13 +41,13 @@ namespace nspector.Common
|
||||
return result;
|
||||
}
|
||||
|
||||
protected void DrsSession(Action<IntPtr> action)
|
||||
protected void DrsSession(Action<IntPtr> action, bool forceNonGlobalSession = false, bool preventLoadSettings = false)
|
||||
{
|
||||
DrsSessionScope.DrsSession<bool>((hSession) =>
|
||||
{
|
||||
action(hSession);
|
||||
return true;
|
||||
});
|
||||
}, forceNonGlobalSession: forceNonGlobalSession, preventLoadSettings: preventLoadSettings);
|
||||
}
|
||||
|
||||
protected T DrsSession<T>(Func<IntPtr, T> action, bool forceDedicatedScope = false)
|
||||
@@ -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)
|
||||
throw new NvapiException("DRS_DeleteApplication", caRes);
|
||||
}
|
||||
@@ -262,7 +262,7 @@ namespace nspector.Common
|
||||
protected List<NVDRS_SETTING> GetProfileSettings(IntPtr hSession, IntPtr hProfile)
|
||||
{
|
||||
uint settingCount = 512;
|
||||
var settings = new NVDRS_SETTING[512];
|
||||
var settings = new NVDRS_SETTING[settingCount];
|
||||
settings[0].version = NvapiDrsWrapper.NVDRS_SETTING_VER;
|
||||
|
||||
var esRes = NvapiDrsWrapper.DRS_EnumSettings(hSession, hProfile, 0, ref settingCount, ref settings);
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
using nspector.Common.Meta;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace nspector.Common
|
||||
{
|
||||
public static class DrsUtil
|
||||
{
|
||||
public static string StringValueRaw = "Text";
|
||||
|
||||
|
||||
public static string GetDwordString(uint dword)
|
||||
{
|
||||
return string.Format("0x{0:X8}", dword);
|
||||
@@ -50,7 +48,7 @@ namespace nspector.Common
|
||||
var settingValue = meta.DwordValues
|
||||
.FirstOrDefault(x => x.Value.Equals(dwordValue));
|
||||
|
||||
return settingValue == null ? GetDwordString(dwordValue): settingValue.ValueName;
|
||||
return settingValue == null ? GetDwordString(dwordValue) : settingValue.ValueName;
|
||||
}
|
||||
|
||||
internal static string ParseStringSettingValue(SettingMeta meta, string text)
|
||||
|
||||
@@ -9,9 +9,9 @@ namespace nspector.Common.Helper
|
||||
{
|
||||
var identity = WindowsIdentity.GetCurrent();
|
||||
var principal = new WindowsPrincipal(identity);
|
||||
isAdmin = principal.IsInRole(WindowsBuiltInRole.Administrator);
|
||||
isAdmin = principal.IsInRole(WindowsBuiltInRole.Administrator);
|
||||
}
|
||||
|
||||
|
||||
public static bool IsAdmin
|
||||
{
|
||||
get { return isAdmin; }
|
||||
|
||||
82
nspector/Common/Helper/DropDownMenuScrollWheelHandler.cs
Normal file
82
nspector/Common/Helper/DropDownMenuScrollWheelHandler.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace nspector.Common.Helper
|
||||
{
|
||||
|
||||
//by Bryce Wagner https://stackoverflow.com/questions/13139074/mouse-wheel-scrolling-toolstrip-menu-items
|
||||
|
||||
public class DropDownMenuScrollWheelHandler : IMessageFilter
|
||||
{
|
||||
private static DropDownMenuScrollWheelHandler Instance;
|
||||
public static void Enable(bool enabled)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
if (Instance == null)
|
||||
{
|
||||
Instance = new DropDownMenuScrollWheelHandler();
|
||||
Application.AddMessageFilter(Instance);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Instance != null)
|
||||
{
|
||||
Application.RemoveMessageFilter(Instance);
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
private IntPtr activeHwnd;
|
||||
private ToolStripDropDown activeMenu;
|
||||
|
||||
public bool PreFilterMessage(ref Message m)
|
||||
{
|
||||
if (m.Msg == 0x200 && activeHwnd != m.HWnd) // WM_MOUSEMOVE
|
||||
{
|
||||
activeHwnd = m.HWnd;
|
||||
this.activeMenu = Control.FromHandle(m.HWnd) as ToolStripDropDown;
|
||||
}
|
||||
else if (m.Msg == 0x20A && this.activeMenu != null) // WM_MOUSEWHEEL
|
||||
{
|
||||
int delta = (short)(ushort)(((uint)(ulong)m.WParam) >> 16);
|
||||
HandleDelta(this.activeMenu, delta);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static readonly Action<ToolStrip, int> ScrollInternal
|
||||
= (Action<ToolStrip, int>)Delegate.CreateDelegate(typeof(Action<ToolStrip, int>),
|
||||
typeof(ToolStrip).GetMethod("ScrollInternal",
|
||||
System.Reflection.BindingFlags.NonPublic
|
||||
| System.Reflection.BindingFlags.Instance));
|
||||
|
||||
private void HandleDelta(ToolStripDropDown ts, int delta)
|
||||
{
|
||||
if (ts.Items.Count == 0)
|
||||
return;
|
||||
|
||||
var firstItem = ts.Items[0];
|
||||
var lastItem = ts.Items[ts.Items.Count - 1];
|
||||
|
||||
if (lastItem.Bounds.Bottom < ts.Height && firstItem.Bounds.Top > 0)
|
||||
return;
|
||||
|
||||
delta = delta / -4;
|
||||
|
||||
if (delta < 0 && firstItem.Bounds.Top - delta > 9)
|
||||
{
|
||||
delta = firstItem.Bounds.Top - 9;
|
||||
}
|
||||
else if (delta > 0 && delta > lastItem.Bounds.Bottom - ts.Height + 9)
|
||||
{
|
||||
delta = lastItem.Bounds.Bottom - ts.Height + 9;
|
||||
}
|
||||
|
||||
if (delta != 0)
|
||||
ScrollInternal(ts, delta);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ namespace nspector.Common.Helper
|
||||
var buttonCancel = new Button();
|
||||
var imageBox = new PictureBox();
|
||||
|
||||
EventHandler textchanged = delegate(object sender, EventArgs e)
|
||||
EventHandler textchanged = delegate (object sender, EventArgs e)
|
||||
{
|
||||
bool mandatory_success = Regex.IsMatch(textBox.Text, mandatoryFormatRegExPattern);
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace nspector.Common.Helper
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using nspector.Native.WINAPI;
|
||||
|
||||
namespace nspector.Common.Helper
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.Win32;
|
||||
@@ -36,7 +35,7 @@ namespace nspector.Common.Helper
|
||||
if (steamPath != null)
|
||||
return Path.Combine(steamPath, @"appcache\appinfo.vdf");
|
||||
}
|
||||
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -90,7 +89,7 @@ namespace nspector.Common.Helper
|
||||
|
||||
var bid = BitConverter.GetBytes(appid);
|
||||
int offset = 0;
|
||||
|
||||
|
||||
var appidPattern = new byte[] { 0x08, bid[0], bid[1], bid[2], bid[3] };
|
||||
var launchPattern = new byte[] { 0x00, 0x6C, 0x61, 0x75, 0x6E, 0x63, 0x68, 0x00 };
|
||||
|
||||
@@ -157,7 +156,7 @@ namespace nspector.Common.Helper
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static int FindOffset(byte[] bytes, byte[] pattern, int offset = 0, byte? wildcard = null)
|
||||
{
|
||||
for (int i = offset; i < bytes.Length; i++)
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace nspector.Common.Helper
|
||||
{
|
||||
@@ -16,7 +12,7 @@ namespace nspector.Common.Helper
|
||||
var tempFile = GenerateTempFileName();
|
||||
if (!File.Exists(tempFile))
|
||||
return tempFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static string GenerateTempFileName()
|
||||
|
||||
@@ -17,8 +17,15 @@ namespace nspector.Common.Helper
|
||||
|
||||
public FormWindowState WindowState { get; set; }
|
||||
|
||||
public bool ShowCustomizedSettingNamesOnly { get; set; } = false;
|
||||
|
||||
public bool ShowScannedUnknownSettings { get; set; } = false;
|
||||
|
||||
private static string GetSettingsFilename()
|
||||
{
|
||||
var fiPortalbleSettings = new FileInfo("settings.xml");
|
||||
if (fiPortalbleSettings.Exists) return fiPortalbleSettings.FullName;
|
||||
|
||||
var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), Application.ProductName);
|
||||
if (!Directory.Exists(path)) Directory.CreateDirectory(path);
|
||||
return Path.Combine(path, "settings.xml"); ;
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using nspector.Native.NVAPI2;
|
||||
|
||||
namespace nspector.Common.Import
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace nspector.Common.Import
|
||||
|
||||
[XmlElement(ElementName = "SettingID")]
|
||||
public uint SettingId = 0;
|
||||
|
||||
|
||||
public string SettingValue = "0";
|
||||
|
||||
public SettingValueType ValueType = SettingValueType.Dword;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace nspector.Common.Import
|
||||
{
|
||||
public enum SettingValueType: int
|
||||
public enum SettingValueType : int
|
||||
{
|
||||
Dword,
|
||||
AnsiString,
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using nspector.Native.NvApi.DriverSettings;
|
||||
using nspector.Native.NVAPI2;
|
||||
|
||||
@@ -19,7 +18,7 @@ namespace nspector.Common.Meta
|
||||
|
||||
private readonly Dictionary<ESetting, Type> settingEnumTypeCache;
|
||||
|
||||
private string[] ignoreSettingNames = new[] { "TOTAL_DWORD_SETTING_NUM", "TOTAL_WSTRING_SETTING_NUM",
|
||||
private string[] ignoreSettingNames = new[] { "TOTAL_DWORD_SETTING_NUM", "TOTAL_WSTRING_SETTING_NUM",
|
||||
"TOTAL_SETTING_NUM", "INVALID_SETTING_ID" };
|
||||
|
||||
private Dictionary<ESetting, Type> CreateSettingEnumTypeCache()
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using nspector.Common.CustomSettings;
|
||||
using nspector.Native.NVAPI2;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace nspector.Common.Meta
|
||||
{
|
||||
@@ -74,11 +72,11 @@ namespace nspector.Common.Meta
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public List<uint> GetSettingIds()
|
||||
{
|
||||
return customSettings.Settings
|
||||
.Select(x => x.SettingId).ToList();
|
||||
return customSettings.Settings
|
||||
.Select(x => x.SettingId).ToList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using nspector.Common.CustomSettings;
|
||||
|
||||
using nspector.Native.NvApi.DriverSettings;
|
||||
using nspector.Native.NVAPI2;
|
||||
using nvw = nspector.Native.NVAPI2.NvapiDrsWrapper;
|
||||
using nvw = nspector.Native.NVAPI2.NvapiDrsWrapper;
|
||||
|
||||
namespace nspector.Common.Meta
|
||||
{
|
||||
@@ -26,14 +20,14 @@ namespace nspector.Common.Meta
|
||||
private List<uint> InitSettingIds()
|
||||
{
|
||||
var settingIds = new List<uint>();
|
||||
|
||||
|
||||
var nvRes = nvw.DRS_EnumAvailableSettingIds(out settingIds, 512);
|
||||
if (nvRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_EnumAvailableSettingIds", nvRes);
|
||||
|
||||
return settingIds;
|
||||
}
|
||||
|
||||
|
||||
private SettingMeta GetDriverSettingMetaInternal(uint settingId)
|
||||
{
|
||||
var values = new NVDRS_SETTING_VALUES();
|
||||
@@ -44,10 +38,10 @@ namespace nspector.Common.Meta
|
||||
|
||||
if (nvRes == NvAPI_Status.NVAPI_SETTING_NOT_FOUND)
|
||||
return null;
|
||||
|
||||
|
||||
if (nvRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_EnumAvailableSettingValues", nvRes);
|
||||
|
||||
|
||||
|
||||
var sbSettingName = new StringBuilder((int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX);
|
||||
nvRes = nvw.DRS_GetSettingNameFromId(settingId, sbSettingName);
|
||||
@@ -58,11 +52,12 @@ namespace nspector.Common.Meta
|
||||
if (string.IsNullOrWhiteSpace(settingName))
|
||||
settingName = DrsUtil.GetDwordString(settingId);
|
||||
|
||||
var result = new SettingMeta {
|
||||
var result = new SettingMeta
|
||||
{
|
||||
SettingType = values.settingType,
|
||||
SettingName = settingName,
|
||||
};
|
||||
|
||||
|
||||
|
||||
if (values.settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE)
|
||||
{
|
||||
@@ -71,13 +66,14 @@ namespace nspector.Common.Meta
|
||||
for (int i = 0; i < values.numSettingValues; i++)
|
||||
{
|
||||
result.DwordValues.Add(
|
||||
new SettingValue<uint> (Source) {
|
||||
new SettingValue<uint>(Source)
|
||||
{
|
||||
Value = values.settingValues[i].dwordValue,
|
||||
ValueName = DrsUtil.GetDwordString(values.settingValues[i].dwordValue),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (values.settingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE)
|
||||
{
|
||||
result.DefaultStringValue = values.defaultValue.stringValue;
|
||||
@@ -116,7 +112,7 @@ namespace nspector.Common.Meta
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private SettingMeta GetSettingsMeta(uint settingId)
|
||||
@@ -135,13 +131,13 @@ namespace nspector.Common.Meta
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public string GetSettingName(uint settingId)
|
||||
{
|
||||
var settingMeta = GetSettingsMeta(settingId);
|
||||
if (settingMeta != null)
|
||||
return settingMeta.SettingName;
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -180,7 +176,7 @@ namespace nspector.Common.Meta
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public List<uint> GetSettingIds()
|
||||
{
|
||||
return _settingIds;
|
||||
@@ -194,7 +190,7 @@ namespace nspector.Common.Meta
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public string GetGroupName(uint settingId)
|
||||
{
|
||||
return null;
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace nspector.Common.Meta
|
||||
{
|
||||
internal interface ISettingMetaService
|
||||
{
|
||||
SettingMetaSource Source {get; }
|
||||
SettingMetaSource Source { get; }
|
||||
|
||||
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)
|
||||
{
|
||||
var cached = CachedSettings.FirstOrDefault(x=>x.SettingId.Equals(settingId));
|
||||
var cached = CachedSettings.FirstOrDefault(x => x.SettingId.Equals(settingId));
|
||||
if (cached != null)
|
||||
return string.Format("0x{0:X8} ({1} Profiles)", settingId, cached.ProfileCount);
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace nspector.Common.Meta
|
||||
|
||||
public List<SettingValue<uint>> GetDwordValues(uint settingId)
|
||||
{
|
||||
var cached = CachedSettings.FirstOrDefault(x=>x.SettingId.Equals(settingId));
|
||||
var cached = CachedSettings.FirstOrDefault(x => x.SettingId.Equals(settingId));
|
||||
if (cached != null)
|
||||
return cached.SettingValues.Select(s => new SettingValue<uint>(Source)
|
||||
{
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using nspector.Native.NVAPI2;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace nspector.Common.Meta
|
||||
{
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace nspector.Common.Meta
|
||||
namespace nspector.Common.Meta
|
||||
{
|
||||
public enum SettingMetaSource
|
||||
{
|
||||
@@ -11,7 +6,6 @@ namespace nspector.Common.Meta
|
||||
DriverSettings = 20,
|
||||
ConstantSettings = 30,
|
||||
ReferenceSettings = 40,
|
||||
NvD3dUmxSettings = 50,
|
||||
ScannedSettings = 60,
|
||||
ScannedSettings = 50,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace nspector.Common.Meta
|
||||
namespace nspector.Common.Meta
|
||||
{
|
||||
internal class SettingValue<T>
|
||||
{
|
||||
@@ -14,7 +9,7 @@ namespace nspector.Common.Meta
|
||||
{
|
||||
ValueSource = source;
|
||||
}
|
||||
|
||||
|
||||
public int ValuePos { get; set; }
|
||||
public string ValueName { get; set; }
|
||||
public T Value { get; set; }
|
||||
@@ -26,6 +21,6 @@ namespace nspector.Common.Meta
|
||||
|
||||
return string.Format("Value={0}; ValueName={1};", Value, ValueName);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using nspector.Native.NVAPI2;
|
||||
|
||||
namespace nspector.Common
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace nspector.Common
|
||||
namespace nspector.Common
|
||||
{
|
||||
|
||||
internal enum SettingState
|
||||
@@ -17,7 +12,7 @@ namespace nspector.Common
|
||||
internal class SettingItem
|
||||
{
|
||||
public uint SettingId { get; set; }
|
||||
|
||||
|
||||
public string SettingText { get; set; }
|
||||
|
||||
public string ValueText { get; set; }
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace nspector.Common
|
||||
namespace nspector.Common
|
||||
{
|
||||
public enum SettingViewMode
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -35,12 +35,13 @@
|
||||
ANSEL_WHITELISTED_ID = 0x1085DA8A,
|
||||
APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_ID = 0x104554B6,
|
||||
APPLICATION_STEAM_ID_ID = 0x107CDDBC,
|
||||
BATTERY_BOOST_ID = 0x10115C89,
|
||||
AUTOFL_ID = 0x10834FFE,
|
||||
BATTERY_BOOST_APP_FPS_ID = 0x10115C8C,
|
||||
CPL_HIDDEN_PROFILE_ID = 0x106D5CFF,
|
||||
CUDA_EXCLUDED_GPUS_ID = 0x10354FF8,
|
||||
D3DOGL_GPU_MAX_POWER_ID = 0x10D1EF29,
|
||||
EXPORT_PERF_COUNTERS_ID = 0x108F0841,
|
||||
EXTERNAL_QUIET_MODE_ID = 0x10115C8D,
|
||||
FXAA_ALLOW_ID = 0x1034CB89,
|
||||
FXAA_ENABLE_ID = 0x1074C972,
|
||||
FXAA_INDICATOR_ENABLE_ID = 0x1068FB9C,
|
||||
@@ -100,9 +101,9 @@
|
||||
SET_VAB_DATA_ID = 0x00AB8687,
|
||||
VSYNCMODE_ID = 0x00A879CF,
|
||||
VSYNCTEARCONTROL_ID = 0x005A375C,
|
||||
TOTAL_DWORD_SETTING_NUM = 95,
|
||||
TOTAL_DWORD_SETTING_NUM = 96,
|
||||
TOTAL_WSTRING_SETTING_NUM = 4,
|
||||
TOTAL_SETTING_NUM = 99,
|
||||
TOTAL_SETTING_NUM = 100,
|
||||
INVALID_SETTING_ID = 0xFFFFFFFF
|
||||
}
|
||||
|
||||
@@ -209,11 +210,11 @@
|
||||
}
|
||||
|
||||
public enum EValues_OGL_SLI_CFR_MODE : uint {
|
||||
OGL_SLI_CFR_MODE_CFR = 0x00,
|
||||
OGL_SLI_CFR_MODE_CLASSIC_SFR = 0x01,
|
||||
OGL_SLI_CFR_MODE_DISABLE = 0x02,
|
||||
OGL_SLI_CFR_MODE_DISABLE = 0x00,
|
||||
OGL_SLI_CFR_MODE_ENABLE = 0x01,
|
||||
OGL_SLI_CFR_MODE_CLASSIC_SFR = 0x02,
|
||||
OGL_SLI_CFR_MODE_NUM_VALUES = 3,
|
||||
OGL_SLI_CFR_MODE_DEFAULT = OGL_SLI_CFR_MODE_CFR
|
||||
OGL_SLI_CFR_MODE_DEFAULT = OGL_SLI_CFR_MODE_DISABLE
|
||||
}
|
||||
|
||||
public enum EValues_OGL_SLI_MULTICAST : uint {
|
||||
@@ -441,13 +442,11 @@
|
||||
APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_DEFAULT = APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_DISABLED
|
||||
}
|
||||
|
||||
public enum EValues_BATTERY_BOOST : uint {
|
||||
BATTERY_BOOST_MIN = 0x00000001,
|
||||
BATTERY_BOOST_MAX = 0x000000ff,
|
||||
BATTERY_BOOST_ENABLED = 0x10000000,
|
||||
BATTERY_BOOST_DISABLED = 0x00000000,
|
||||
BATTERY_BOOST_NUM_VALUES = 4,
|
||||
BATTERY_BOOST_DEFAULT = BATTERY_BOOST_DISABLED
|
||||
public enum EValues_AUTOFL : uint {
|
||||
AUTOFL_OFF = 0,
|
||||
AUTOFL_ON = 1,
|
||||
AUTOFL_NUM_VALUES = 2,
|
||||
AUTOFL_DEFAULT = AUTOFL_ON
|
||||
}
|
||||
|
||||
public enum EValues_BATTERY_BOOST_APP_FPS : uint {
|
||||
@@ -472,6 +471,13 @@
|
||||
EXPORT_PERF_COUNTERS_DEFAULT = EXPORT_PERF_COUNTERS_OFF
|
||||
}
|
||||
|
||||
public enum EValues_EXTERNAL_QUIET_MODE : uint {
|
||||
EXTERNAL_QUIET_MODE_ON = 0x00000001,
|
||||
EXTERNAL_QUIET_MODE_OFF = 0x00000000,
|
||||
EXTERNAL_QUIET_MODE_NUM_VALUES = 2,
|
||||
EXTERNAL_QUIET_MODE_DEFAULT = EXTERNAL_QUIET_MODE_OFF
|
||||
}
|
||||
|
||||
public enum EValues_FXAA_ALLOW : uint {
|
||||
FXAA_ALLOW_DISALLOWED = 0,
|
||||
FXAA_ALLOW_ALLOWED = 1,
|
||||
@@ -549,9 +555,11 @@
|
||||
PS_FRAMERATE_LIMITER_FPSMASK = 0x000000ff,
|
||||
PS_FRAMERATE_LIMITER_NO_ALIGN = 0x00004000,
|
||||
PS_FRAMERATE_LIMITER_BB_QM = 0x00008000,
|
||||
PS_FRAMERATE_LIMITER_LOW_LATENCY_AUTO = 0x00010000,
|
||||
PS_FRAMERATE_LIMITER_LOWER_FPS_TO_ALIGN = 0x00020000,
|
||||
PS_FRAMERATE_LIMITER_FORCE_VSYNC_OFF = 0x00040000,
|
||||
PS_FRAMERATE_LIMITER_GPS_WEB = 0x00080000,
|
||||
PS_FRAMERATE_LIMITER_LOW_LATENCY_LOG = 0x00100000,
|
||||
PS_FRAMERATE_LIMITER_DISALLOWED = 0x00200000,
|
||||
PS_FRAMERATE_LIMITER_USE_CPU_WAIT = 0x00400000,
|
||||
PS_FRAMERATE_LIMITER_NO_LAG_OFFSET = 0x00800000,
|
||||
@@ -560,8 +568,8 @@
|
||||
PS_FRAMERATE_LIMITER_FORCEON = 0x40000000,
|
||||
PS_FRAMERATE_LIMITER_ENABLED = 0x80000000,
|
||||
PS_FRAMERATE_LIMITER_OPENGL_REMOTE_DESKTOP = 0xe000003c,
|
||||
PS_FRAMERATE_LIMITER_MASK = 0xf0eec0ff,
|
||||
PS_FRAMERATE_LIMITER_NUM_VALUES = 19,
|
||||
PS_FRAMERATE_LIMITER_MASK = 0xf0ffc0ff,
|
||||
PS_FRAMERATE_LIMITER_NUM_VALUES = 21,
|
||||
PS_FRAMERATE_LIMITER_DEFAULT = PS_FRAMERATE_LIMITER_DISABLED
|
||||
}
|
||||
|
||||
@@ -600,7 +608,7 @@
|
||||
PS_FRAMERATE_MONITOR_CTRL_THRESHOLD_PCT_MASK = 0x000000FF,
|
||||
PS_FRAMERATE_MONITOR_CTRL_MOVING_AVG_X_MASK = 0x00000F00,
|
||||
PS_FRAMERATE_MONITOR_CTRL_MOVING_AVG_X_SHIFT = 8,
|
||||
PS_FRAMERATE_MONITOR_CTRL_ENABLE_FINE_GRAINED = 0x00400000,
|
||||
PS_FRAMERATE_MONITOR_CTRL_LOW_LATENCY_LOG = 0x00100000,
|
||||
PS_FRAMERATE_MONITOR_CTRL_ENABLE_ON_VSYNC = 0x00800000,
|
||||
PS_FRAMERATE_MONITOR_CTRL_VSYNC_OFFSET_MASK = 0x0000F000,
|
||||
PS_FRAMERATE_MONITOR_CTRL_VSYNC_OFFSET_SHIFT = 12,
|
||||
@@ -671,8 +679,10 @@
|
||||
SHIM_RENDERING_OPTIONS_HANDLE_WINDOWED_MODE_PERF_OPT = 0x00200000,
|
||||
SHIM_RENDERING_OPTIONS_HANDLE_WIN7_ASYNC_RUNTIME_BUG = 0x00400000,
|
||||
SHIM_RENDERING_OPTIONS_EXPLICIT_ADAPTER_OPTED_BY_APP = 0x00800000,
|
||||
SHIM_RENDERING_OPTIONS_NUM_VALUES = 25,
|
||||
SHIM_RENDERING_OPTIONS_DEFAULT = SHIM_RENDERING_OPTIONS_DEFAULT_RENDERING_MODE
|
||||
SHIM_RENDERING_OPTIONS_ALLOW_DYNAMIC_DISPLAY_MUX_SWITCH = 0x01000000,
|
||||
SHIM_RENDERING_OPTIONS_DISALLOW_DYNAMIC_DISPLAY_MUX_SWITCH = 0x02000000,
|
||||
SHIM_RENDERING_OPTIONS_NUM_VALUES = 27,
|
||||
SHIM_RENDERING_OPTIONS_DEFAULT = 0x00000000
|
||||
}
|
||||
|
||||
public enum EValues_SLI_GPU_COUNT : uint {
|
||||
@@ -868,7 +878,7 @@
|
||||
WKS_STEREO_DONGLE_SUPPORT_DAC = 1,
|
||||
WKS_STEREO_DONGLE_SUPPORT_DLP = 2,
|
||||
WKS_STEREO_DONGLE_SUPPORT_NUM_VALUES = 3,
|
||||
WKS_STEREO_DONGLE_SUPPORT_DEFAULT = WKS_STEREO_DONGLE_SUPPORT_OFF
|
||||
WKS_STEREO_DONGLE_SUPPORT_DEFAULT = WKS_STEREO_DONGLE_SUPPORT_DAC
|
||||
}
|
||||
|
||||
public enum EValues_WKS_STEREO_SUPPORT : uint {
|
||||
|
||||
@@ -74,12 +74,13 @@
|
||||
#define ANSEL_WHITELISTED_STRING L"Ansel flags for enabled applications"
|
||||
#define APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_STRING L"Application Profile Notification Popup Timeout"
|
||||
#define APPLICATION_STEAM_ID_STRING L"Steam Application ID"
|
||||
#define BATTERY_BOOST_STRING L"Battery Boost"
|
||||
#define AUTOFL_STRING L"Platform Boost"
|
||||
#define BATTERY_BOOST_APP_FPS_STRING L"Battery Boost Application FPS"
|
||||
#define CPL_HIDDEN_PROFILE_STRING L"Do not display this profile in the Control Panel"
|
||||
#define CUDA_EXCLUDED_GPUS_STRING L"List of Universal GPU ids"
|
||||
#define D3DOGL_GPU_MAX_POWER_STRING L"Maximum GPU Power"
|
||||
#define EXPORT_PERF_COUNTERS_STRING L"Export Performance Counters"
|
||||
#define EXTERNAL_QUIET_MODE_STRING L"External Quiet Mode (XQM)"
|
||||
#define FXAA_ALLOW_STRING L"NVIDIA Predefined FXAA Usage"
|
||||
#define FXAA_ENABLE_STRING L"Enable FXAA"
|
||||
#define FXAA_INDICATOR_ENABLE_STRING L"Enable FXAA Indicator"
|
||||
@@ -175,12 +176,13 @@ enum ESetting {
|
||||
ANSEL_WHITELISTED_ID = 0x1085DA8A,
|
||||
APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_ID = 0x104554B6,
|
||||
APPLICATION_STEAM_ID_ID = 0x107CDDBC,
|
||||
BATTERY_BOOST_ID = 0x10115C89,
|
||||
AUTOFL_ID = 0x10834FFE,
|
||||
BATTERY_BOOST_APP_FPS_ID = 0x10115C8C,
|
||||
CPL_HIDDEN_PROFILE_ID = 0x106D5CFF,
|
||||
CUDA_EXCLUDED_GPUS_ID = 0x10354FF8,
|
||||
D3DOGL_GPU_MAX_POWER_ID = 0x10D1EF29,
|
||||
EXPORT_PERF_COUNTERS_ID = 0x108F0841,
|
||||
EXTERNAL_QUIET_MODE_ID = 0x10115C8D,
|
||||
FXAA_ALLOW_ID = 0x1034CB89,
|
||||
FXAA_ENABLE_ID = 0x1074C972,
|
||||
FXAA_INDICATOR_ENABLE_ID = 0x1068FB9C,
|
||||
@@ -240,9 +242,9 @@ enum ESetting {
|
||||
SET_VAB_DATA_ID = 0x00AB8687,
|
||||
VSYNCMODE_ID = 0x00A879CF,
|
||||
VSYNCTEARCONTROL_ID = 0x005A375C,
|
||||
TOTAL_DWORD_SETTING_NUM = 95,
|
||||
TOTAL_DWORD_SETTING_NUM = 96,
|
||||
TOTAL_WSTRING_SETTING_NUM = 4,
|
||||
TOTAL_SETTING_NUM = 99,
|
||||
TOTAL_SETTING_NUM = 100,
|
||||
INVALID_SETTING_ID = 0xFFFFFFFF
|
||||
};
|
||||
|
||||
@@ -354,11 +356,11 @@ enum EValues_OGL_SINGLE_BACKDEPTH_BUFFER {
|
||||
};
|
||||
|
||||
enum EValues_OGL_SLI_CFR_MODE {
|
||||
OGL_SLI_CFR_MODE_CFR = 0x00,
|
||||
OGL_SLI_CFR_MODE_CLASSIC_SFR = 0x01,
|
||||
OGL_SLI_CFR_MODE_DISABLE = 0x02,
|
||||
OGL_SLI_CFR_MODE_DISABLE = 0x00,
|
||||
OGL_SLI_CFR_MODE_ENABLE = 0x01,
|
||||
OGL_SLI_CFR_MODE_CLASSIC_SFR = 0x02,
|
||||
OGL_SLI_CFR_MODE_NUM_VALUES = 3,
|
||||
OGL_SLI_CFR_MODE_DEFAULT = OGL_SLI_CFR_MODE_CFR
|
||||
OGL_SLI_CFR_MODE_DEFAULT = OGL_SLI_CFR_MODE_DISABLE
|
||||
};
|
||||
|
||||
enum EValues_OGL_SLI_MULTICAST {
|
||||
@@ -586,13 +588,11 @@ enum EValues_APPLICATION_PROFILE_NOTIFICATION_TIMEOUT {
|
||||
APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_DEFAULT = APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_DISABLED
|
||||
};
|
||||
|
||||
enum EValues_BATTERY_BOOST {
|
||||
BATTERY_BOOST_MIN = 0x00000001,
|
||||
BATTERY_BOOST_MAX = 0x000000ff,
|
||||
BATTERY_BOOST_ENABLED = 0x10000000,
|
||||
BATTERY_BOOST_DISABLED = 0x00000000,
|
||||
BATTERY_BOOST_NUM_VALUES = 4,
|
||||
BATTERY_BOOST_DEFAULT = BATTERY_BOOST_DISABLED
|
||||
enum EValues_AUTOFL {
|
||||
AUTOFL_OFF = 0,
|
||||
AUTOFL_ON = 1,
|
||||
AUTOFL_NUM_VALUES = 2,
|
||||
AUTOFL_DEFAULT = AUTOFL_ON
|
||||
};
|
||||
|
||||
enum EValues_BATTERY_BOOST_APP_FPS {
|
||||
@@ -625,6 +625,13 @@ enum EValues_EXPORT_PERF_COUNTERS {
|
||||
EXPORT_PERF_COUNTERS_DEFAULT = EXPORT_PERF_COUNTERS_OFF
|
||||
};
|
||||
|
||||
enum EValues_EXTERNAL_QUIET_MODE {
|
||||
EXTERNAL_QUIET_MODE_ON = 0x00000001,
|
||||
EXTERNAL_QUIET_MODE_OFF = 0x00000000,
|
||||
EXTERNAL_QUIET_MODE_NUM_VALUES = 2,
|
||||
EXTERNAL_QUIET_MODE_DEFAULT = EXTERNAL_QUIET_MODE_OFF
|
||||
};
|
||||
|
||||
enum EValues_FXAA_ALLOW {
|
||||
FXAA_ALLOW_DISALLOWED = 0,
|
||||
FXAA_ALLOW_ALLOWED = 1,
|
||||
@@ -702,9 +709,11 @@ enum EValues_PS_FRAMERATE_LIMITER {
|
||||
PS_FRAMERATE_LIMITER_FPSMASK = 0x000000ff,
|
||||
PS_FRAMERATE_LIMITER_NO_ALIGN = 0x00004000,
|
||||
PS_FRAMERATE_LIMITER_BB_QM = 0x00008000,
|
||||
PS_FRAMERATE_LIMITER_LOW_LATENCY_AUTO = 0x00010000,
|
||||
PS_FRAMERATE_LIMITER_LOWER_FPS_TO_ALIGN = 0x00020000,
|
||||
PS_FRAMERATE_LIMITER_FORCE_VSYNC_OFF = 0x00040000,
|
||||
PS_FRAMERATE_LIMITER_GPS_WEB = 0x00080000,
|
||||
PS_FRAMERATE_LIMITER_LOW_LATENCY_LOG = 0x00100000,
|
||||
PS_FRAMERATE_LIMITER_DISALLOWED = 0x00200000,
|
||||
PS_FRAMERATE_LIMITER_USE_CPU_WAIT = 0x00400000,
|
||||
PS_FRAMERATE_LIMITER_NO_LAG_OFFSET = 0x00800000,
|
||||
@@ -713,8 +722,8 @@ enum EValues_PS_FRAMERATE_LIMITER {
|
||||
PS_FRAMERATE_LIMITER_FORCEON = 0x40000000,
|
||||
PS_FRAMERATE_LIMITER_ENABLED = 0x80000000,
|
||||
PS_FRAMERATE_LIMITER_OPENGL_REMOTE_DESKTOP = 0xe000003c,
|
||||
PS_FRAMERATE_LIMITER_MASK = 0xf0eec0ff,
|
||||
PS_FRAMERATE_LIMITER_NUM_VALUES = 19,
|
||||
PS_FRAMERATE_LIMITER_MASK = 0xf0ffc0ff,
|
||||
PS_FRAMERATE_LIMITER_NUM_VALUES = 21,
|
||||
PS_FRAMERATE_LIMITER_DEFAULT = PS_FRAMERATE_LIMITER_DISABLED
|
||||
};
|
||||
|
||||
@@ -753,7 +762,7 @@ enum EValues_PS_FRAMERATE_MONITOR_CTRL {
|
||||
PS_FRAMERATE_MONITOR_CTRL_THRESHOLD_PCT_MASK = 0x000000FF,
|
||||
PS_FRAMERATE_MONITOR_CTRL_MOVING_AVG_X_MASK = 0x00000F00,
|
||||
PS_FRAMERATE_MONITOR_CTRL_MOVING_AVG_X_SHIFT = 8,
|
||||
PS_FRAMERATE_MONITOR_CTRL_ENABLE_FINE_GRAINED = 0x00400000,
|
||||
PS_FRAMERATE_MONITOR_CTRL_LOW_LATENCY_LOG = 0x00100000,
|
||||
PS_FRAMERATE_MONITOR_CTRL_ENABLE_ON_VSYNC = 0x00800000,
|
||||
PS_FRAMERATE_MONITOR_CTRL_VSYNC_OFFSET_MASK = 0x0000F000,
|
||||
PS_FRAMERATE_MONITOR_CTRL_VSYNC_OFFSET_SHIFT = 12,
|
||||
@@ -824,8 +833,10 @@ enum EValues_SHIM_RENDERING_OPTIONS {
|
||||
SHIM_RENDERING_OPTIONS_HANDLE_WINDOWED_MODE_PERF_OPT = 0x00200000,
|
||||
SHIM_RENDERING_OPTIONS_HANDLE_WIN7_ASYNC_RUNTIME_BUG = 0x00400000,
|
||||
SHIM_RENDERING_OPTIONS_EXPLICIT_ADAPTER_OPTED_BY_APP = 0x00800000,
|
||||
SHIM_RENDERING_OPTIONS_NUM_VALUES = 25,
|
||||
SHIM_RENDERING_OPTIONS_DEFAULT = SHIM_RENDERING_OPTIONS_DEFAULT_RENDERING_MODE
|
||||
SHIM_RENDERING_OPTIONS_ALLOW_DYNAMIC_DISPLAY_MUX_SWITCH = 0x01000000,
|
||||
SHIM_RENDERING_OPTIONS_DISALLOW_DYNAMIC_DISPLAY_MUX_SWITCH = 0x02000000,
|
||||
SHIM_RENDERING_OPTIONS_NUM_VALUES = 27,
|
||||
SHIM_RENDERING_OPTIONS_DEFAULT = 0x00000000
|
||||
};
|
||||
|
||||
enum EValues_SLI_GPU_COUNT {
|
||||
@@ -1021,7 +1032,7 @@ enum EValues_WKS_STEREO_DONGLE_SUPPORT {
|
||||
WKS_STEREO_DONGLE_SUPPORT_DAC = 1,
|
||||
WKS_STEREO_DONGLE_SUPPORT_DLP = 2,
|
||||
WKS_STEREO_DONGLE_SUPPORT_NUM_VALUES = 3,
|
||||
WKS_STEREO_DONGLE_SUPPORT_DEFAULT = WKS_STEREO_DONGLE_SUPPORT_OFF
|
||||
WKS_STEREO_DONGLE_SUPPORT_DEFAULT = WKS_STEREO_DONGLE_SUPPORT_DAC
|
||||
};
|
||||
|
||||
enum EValues_WKS_STEREO_SUPPORT {
|
||||
@@ -1063,7 +1074,6 @@ enum EValues_AUTO_LODBIASADJUST {
|
||||
AUTO_LODBIASADJUST_DEFAULT = AUTO_LODBIASADJUST_ON
|
||||
};
|
||||
|
||||
|
||||
enum EValues_EXPORT_PERF_COUNTERS_DX9_ONLY {
|
||||
EXPORT_PERF_COUNTERS_DX9_ONLY_OFF = 0x00000000,
|
||||
EXPORT_PERF_COUNTERS_DX9_ONLY_ON = 0x00000001,
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace nspector.Native
|
||||
{
|
||||
@@ -51,6 +49,6 @@ namespace nspector.Native
|
||||
targetPointer = Marshal.AllocHGlobal(sizeOfItem);
|
||||
Marshal.StructureToPtr(item, targetPointer, true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ namespace nspector.Native.WINAPI
|
||||
internal string lpData;
|
||||
}
|
||||
|
||||
|
||||
|
||||
internal struct WINDOWPLACEMENT
|
||||
{
|
||||
internal int length;
|
||||
@@ -301,7 +301,7 @@ namespace nspector.Native.WINAPI
|
||||
internal bool bringAppToFront(int hWnd)
|
||||
{
|
||||
WINDOWPLACEMENT param = new WINDOWPLACEMENT();
|
||||
if (GetWindowPlacement(hWnd,ref param))
|
||||
if (GetWindowPlacement(hWnd, ref param))
|
||||
{
|
||||
if (param.showCmd != SW_NORMAL)
|
||||
{
|
||||
@@ -312,7 +312,7 @@ namespace nspector.Native.WINAPI
|
||||
}
|
||||
return SetForegroundWindow(hWnd);
|
||||
}
|
||||
|
||||
|
||||
internal int sendWindowsStringMessage(int hWnd, int wParam, string msg)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
@@ -241,7 +241,7 @@ namespace nspector.Native.WINAPI
|
||||
private class NativeMethods
|
||||
{
|
||||
[DllImport("Shell32", CharSet = CharSet.Auto)]
|
||||
internal extern static int ExtractIconEx([MarshalAs(UnmanagedType.LPTStr)]
|
||||
internal extern static int ExtractIconEx([MarshalAs(UnmanagedType.LPTStr)]
|
||||
string lpszFile,
|
||||
int nIconIndex,
|
||||
IntPtr[] phIconLarge,
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace nspector.Native.WINAPI
|
||||
THBF_NOBACKGROUND = 0x0004,
|
||||
THBF_HIDDEN = 0x0008
|
||||
}
|
||||
|
||||
|
||||
[Flags]
|
||||
internal enum THB
|
||||
{
|
||||
@@ -37,18 +37,18 @@ namespace nspector.Native.WINAPI
|
||||
}
|
||||
|
||||
internal enum TBPFLAG
|
||||
{
|
||||
TBPF_NOPROGRESS = 0,
|
||||
TBPF_INDETERMINATE = 0x1,
|
||||
TBPF_NORMAL = 0x2,
|
||||
TBPF_ERROR = 0x4,
|
||||
TBPF_PAUSED = 0x8
|
||||
{
|
||||
TBPF_NOPROGRESS = 0,
|
||||
TBPF_INDETERMINATE = 0x1,
|
||||
TBPF_NORMAL = 0x2,
|
||||
TBPF_ERROR = 0x4,
|
||||
TBPF_PAUSED = 0x8
|
||||
}
|
||||
|
||||
internal enum TBATFLAG
|
||||
{
|
||||
TBATF_USEMDITHUMBNAIL = 0x1,
|
||||
TBATF_USEMDILIVEPREVIEW = 0x2
|
||||
{
|
||||
TBATF_USEMDITHUMBNAIL = 0x1,
|
||||
TBATF_USEMDILIVEPREVIEW = 0x2
|
||||
}
|
||||
|
||||
[ComImport,
|
||||
@@ -57,7 +57,7 @@ namespace nspector.Native.WINAPI
|
||||
internal interface ITaskbarList3
|
||||
{
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall,
|
||||
[MethodImpl(MethodImplOptions.InternalCall,
|
||||
MethodCodeType = MethodCodeType.Runtime)]
|
||||
void HrInit();
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace nspector.Native.WINAPI
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall,
|
||||
MethodCodeType = MethodCodeType.Runtime)]
|
||||
void MarkFullscreenWindow([In] IntPtr hwnd,
|
||||
void MarkFullscreenWindow([In] IntPtr hwnd,
|
||||
[In, MarshalAs(UnmanagedType.Bool)] bool fFullscreen);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall,
|
||||
@@ -87,8 +87,8 @@ namespace nspector.Native.WINAPI
|
||||
void SetProgressValue([In] IntPtr hwnd,
|
||||
[In] ulong ullCompleted,
|
||||
[In] ulong ullTotal);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall,
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall,
|
||||
MethodCodeType = MethodCodeType.Runtime)]
|
||||
void SetProgressState([In] IntPtr hwnd,
|
||||
[In] TBPFLAG tbpFlags);
|
||||
@@ -120,7 +120,7 @@ namespace nspector.Native.WINAPI
|
||||
[In] uint cButtons,
|
||||
[In] IntPtr pButton);
|
||||
///* [size_is][in] */ __RPC__in_ecount_full(cButtons) LPTHUMBBUTTON pButton);
|
||||
|
||||
|
||||
//preliminary
|
||||
[MethodImpl(MethodImplOptions.InternalCall,
|
||||
MethodCodeType = MethodCodeType.Runtime)]
|
||||
@@ -150,7 +150,7 @@ namespace nspector.Native.WINAPI
|
||||
MethodCodeType = MethodCodeType.Runtime)]
|
||||
void SetThumbnailClip([In] IntPtr hwnd,
|
||||
[In] IntPtr prcClip);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.IO;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using nspector.Common;
|
||||
using nspector.Common.Import;
|
||||
using nspector.Common.Helper;
|
||||
using nspector.Native.WINAPI;
|
||||
|
||||
namespace nspector
|
||||
@@ -29,6 +29,7 @@ namespace nspector
|
||||
#endif
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
DropDownMenuScrollWheelHandler.Enable(true);
|
||||
|
||||
var argFileIndex = ArgFileIndex(args);
|
||||
if (argFileIndex != -1)
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("NVIDIA Profile Inspector")]
|
||||
[assembly: AssemblyCopyright("©2019 by Orbmu2k")]
|
||||
[assembly: AssemblyCopyright("©2020 by Orbmu2k")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
1
nspector/frmDrvSettings.Designer.cs
generated
1
nspector/frmDrvSettings.Designer.cs
generated
@@ -515,6 +515,7 @@
|
||||
this.lvSettings.SelectedIndexChanged += new System.EventHandler(this.lvSettings_SelectedIndexChanged);
|
||||
this.lvSettings.DoubleClick += new System.EventHandler(this.lvSettings_DoubleClick);
|
||||
this.lvSettings.Resize += new System.EventHandler(this.lvSettings_Resize);
|
||||
this.lvSettings.KeyDown += new System.Windows.Forms.KeyEventHandler(this.lvSettings_KeyDown);
|
||||
//
|
||||
// chSettingID
|
||||
//
|
||||
|
||||
@@ -10,6 +10,7 @@ using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
@@ -107,15 +108,16 @@ namespace nspector
|
||||
return item;
|
||||
}
|
||||
|
||||
private void RefreshApplicationsCombosAndText(List<string> applications)
|
||||
private void RefreshApplicationsCombosAndText(Dictionary<string,string> applications)
|
||||
{
|
||||
lblApplications.Text = "";
|
||||
tssbRemoveApplication.DropDownItems.Clear();
|
||||
|
||||
lblApplications.Text = " " + string.Join(", ", applications);
|
||||
lblApplications.Text = " " + string.Join(", ", applications.Select(x=>x.Value));
|
||||
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);
|
||||
}
|
||||
@@ -141,7 +143,7 @@ namespace nspector
|
||||
{
|
||||
lvSettings.Items.Clear();
|
||||
lvSettings.Groups.Clear();
|
||||
var applications = new List<string>();
|
||||
var applications = new Dictionary<string,string>();
|
||||
|
||||
_currentProfileSettingItems = _drs.GetSettingsForProfile(_CurrentProfile, GetSettingViewMode(), ref applications);
|
||||
RefreshApplicationsCombosAndText(applications);
|
||||
@@ -667,7 +669,19 @@ namespace nspector
|
||||
private async Task ScanProfilesSilentAsync(bool scanPredefined, bool showProfileDialog)
|
||||
{
|
||||
if (_skipScan)
|
||||
{
|
||||
|
||||
if (scanPredefined && !_alreadyScannedForPredefinedSettings)
|
||||
{
|
||||
_alreadyScannedForPredefinedSettings = true;
|
||||
_meta.ResetMetaCache();
|
||||
tsbModifiedProfiles.Enabled = true;
|
||||
exportUserdefinedProfilesToolStripMenuItem.Enabled = false;
|
||||
RefreshCurrentProfile();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
tsbModifiedProfiles.Enabled = false;
|
||||
tsbRefreshProfile.Enabled = false;
|
||||
@@ -685,12 +699,15 @@ namespace nspector
|
||||
if (scanPredefined && !_alreadyScannedForPredefinedSettings)
|
||||
{
|
||||
_alreadyScannedForPredefinedSettings = true;
|
||||
await _scanner.ScanForPredefinedProfileSettingsAsync(progressHandler, _scannerCancelationTokenSource.Token);
|
||||
await _scanner.ScanProfileSettingsAsync(false, progressHandler, _scannerCancelationTokenSource.Token);
|
||||
_meta.ResetMetaCache();
|
||||
tscbShowScannedUnknownSettings.Enabled = true;
|
||||
}
|
||||
|
||||
await _scanner.ScanForModifiedProfilesAsync(progressHandler, _scannerCancelationTokenSource.Token);
|
||||
else
|
||||
{
|
||||
await _scanner.ScanProfileSettingsAsync(true, progressHandler, _scannerCancelationTokenSource.Token);
|
||||
}
|
||||
|
||||
RefreshModifiesProfilesDropDown();
|
||||
tsbModifiedProfiles.Enabled = true;
|
||||
|
||||
@@ -813,7 +830,7 @@ namespace nspector
|
||||
new Thread(SetTaskbarIcon).Start();
|
||||
await ScanProfilesSilentAsync(true, false);
|
||||
|
||||
if (!_scannerCancelationTokenSource.Token.IsCancellationRequested && WindowState != FormWindowState.Maximized)
|
||||
if (_scannerCancelationTokenSource != null && !_scannerCancelationTokenSource.Token.IsCancellationRequested && WindowState != FormWindowState.Maximized)
|
||||
{
|
||||
new MessageHelper().bringAppToFront((int)this.Handle);
|
||||
}
|
||||
@@ -828,6 +845,9 @@ namespace nspector
|
||||
if (MessageBox.Show(this, "Really delete all profiles?", "Delete all profiles", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
|
||||
{
|
||||
_drs.DeleteAllProfilesHard();
|
||||
ChangeCurrentProfile(_baseProfileName);
|
||||
DrsSessionScope.DestroyGlobalSession();
|
||||
RefreshAll();
|
||||
}
|
||||
}
|
||||
else if (MessageBox.Show(this, "Really delete this profile?\r\n\r\nNote: NVIDIA predefined profiles can not be restored until next driver installation!", "Delete Profile", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
|
||||
@@ -900,7 +920,7 @@ namespace nspector
|
||||
//{
|
||||
// drs.DeleteApplication(currentProfile, e.ClickedItem.Text);
|
||||
//}
|
||||
_drs.DeleteApplication(_CurrentProfile, e.ClickedItem.Text);
|
||||
_drs.RemoveApplication(_CurrentProfile, e.ClickedItem.Tag.ToString());
|
||||
RefreshCurrentProfile();
|
||||
}
|
||||
|
||||
@@ -1032,6 +1052,7 @@ namespace nspector
|
||||
{
|
||||
_import.ImportAllProfilesFromNvidiaTextFile(openDialog.FileName);
|
||||
MessageBox.Show("Profile(s) successfully imported!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DrsSessionScope.DestroyGlobalSession();
|
||||
RefreshAll();
|
||||
}
|
||||
catch (NvapiException)
|
||||
@@ -1168,6 +1189,8 @@ namespace nspector
|
||||
settings.WindowWidth = RestoreBounds.Width;
|
||||
}
|
||||
settings.WindowState = WindowState;
|
||||
settings.ShowCustomizedSettingNamesOnly = tscbShowCustomSettingNamesOnly.Checked;
|
||||
settings.ShowScannedUnknownSettings = tscbShowScannedUnknownSettings.Checked;
|
||||
settings.SaveSettings();
|
||||
}
|
||||
|
||||
@@ -1177,6 +1200,8 @@ namespace nspector
|
||||
SetBounds(settings.WindowLeft, settings.WindowTop, settings.WindowWidth, settings.WindowHeight);
|
||||
WindowState = settings.WindowState != FormWindowState.Minimized ? settings.WindowState : FormWindowState.Normal;
|
||||
HandleScreenConstraints();
|
||||
tscbShowCustomSettingNamesOnly.Checked = settings.ShowCustomizedSettingNamesOnly;
|
||||
tscbShowScannedUnknownSettings.Checked = !_skipScan && settings.ShowScannedUnknownSettings;
|
||||
}
|
||||
|
||||
private void frmDrvSettings_FormClosed(object sender, FormClosedEventArgs e)
|
||||
@@ -1184,6 +1209,39 @@ namespace nspector
|
||||
_scannerCancelationTokenSource?.Cancel();
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
private void lvSettings_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Control && e.KeyCode == Keys.C)
|
||||
{
|
||||
CopyModifiedSettingsToClipBoard();
|
||||
}
|
||||
}
|
||||
|
||||
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());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -135,6 +135,7 @@
|
||||
<Compile Include="Common\DrsSessionScope.cs" />
|
||||
<Compile Include="Common\DrsSettingsMetaService.cs" />
|
||||
<Compile Include="Common\DrsUtil.cs" />
|
||||
<Compile Include="Common\Helper\DropDownMenuScrollWheelHandler.cs" />
|
||||
<Compile Include="Common\Helper\ListViewGroupSorter.cs" />
|
||||
<Compile Include="Common\Helper\ShortcutResolver.cs" />
|
||||
<Compile Include="Common\Helper\SteamAppResolver.cs" />
|
||||
@@ -142,7 +143,6 @@
|
||||
<Compile Include="Common\Helper\UserSettings.cs" />
|
||||
<Compile Include="Common\Import\ImportExportUitl.cs" />
|
||||
<Compile Include="Common\Import\SettingValueType.cs" />
|
||||
<Compile Include="Common\Meta\NvD3dUmxSettingMetaService.cs" />
|
||||
<Compile Include="Common\Meta\MetaServiceItem.cs" />
|
||||
<Compile Include="Common\Meta\ConstantSettingMetaService.cs" />
|
||||
<Compile Include="Common\Meta\CustomSettingMetaService.cs" />
|
||||
|
||||
Reference in New Issue
Block a user