mirror of
https://github.com/Orbmu2k/nvidiaProfileInspector.git
synced 2026-01-03 12:28:08 -05:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d3237bfeb | ||
|
|
5dbb8ef721 | ||
|
|
fcd9ef5346 | ||
|
|
67bb397b6a | ||
|
|
ffff16ca83 | ||
|
|
cd8caa5702 | ||
|
|
2d57d6b885 |
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 |
@@ -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,97 +104,28 @@ 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 ((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 (checkedSettingsCount >= profile.numOfSettings)
|
||||
@@ -207,8 +137,17 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -245,6 +184,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);
|
||||
|
||||
@@ -449,7 +449,7 @@ namespace nspector.Common
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
@@ -482,7 +482,7 @@ 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);
|
||||
|
||||
});
|
||||
|
||||
@@ -499,24 +499,25 @@ 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}";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -108,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);
|
||||
}
|
||||
@@ -142,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);
|
||||
@@ -698,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;
|
||||
|
||||
@@ -913,7 +917,7 @@ namespace nspector
|
||||
//{
|
||||
// drs.DeleteApplication(currentProfile, e.ClickedItem.Text);
|
||||
//}
|
||||
_drs.DeleteApplication(_CurrentProfile, e.ClickedItem.Text);
|
||||
_drs.RemoveApplication(_CurrentProfile, e.ClickedItem.Tag.ToString());
|
||||
RefreshCurrentProfile();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user