mirror of
https://github.com/Orbmu2k/nvidiaProfileInspector.git
synced 2026-01-11 08:18:16 -05:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ffff16ca83 | ||
|
|
cd8caa5702 | ||
|
|
2d57d6b885 | ||
|
|
84749fdf5f | ||
|
|
b651dae816 | ||
|
|
0a27ce1c36 | ||
|
|
499cdde758 | ||
|
|
cedcd4e2c6 | ||
|
|
5301c52c16 |
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_screenhshot .png
Normal file
BIN
npi_screenhshot .png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 109 KiB |
@@ -31,7 +31,11 @@ namespace nspector.Common
|
||||
|
||||
public DrsDecrypterService(DrsSettingsMetaService metaService) : base(metaService)
|
||||
{
|
||||
CreateInternalSettingMap();
|
||||
try
|
||||
{
|
||||
CreateInternalSettingMap();
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private uint GetDwordFromKey(uint offset)
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace nspector.Common
|
||||
{
|
||||
LoadSettingsFileEx(hSession, filename);
|
||||
SaveSettings(hSession);
|
||||
});
|
||||
}, forceNonGlobalSession: true, preventLoadSettings: true);
|
||||
}
|
||||
|
||||
internal void ExportProfiles(List<string> profileNames, string filename, bool includePredefined)
|
||||
|
||||
@@ -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)
|
||||
@@ -31,10 +31,13 @@ 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);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,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");
|
||||
}
|
||||
@@ -433,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);
|
||||
@@ -466,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);
|
||||
|
||||
});
|
||||
|
||||
@@ -483,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}";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,9 @@ namespace nspector.Common.Helper
|
||||
|
||||
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"); ;
|
||||
|
||||
@@ -2,6 +2,22 @@
|
||||
<CustomSettingNames>
|
||||
<ShowCustomizedSettingNamesOnly>false</ShowCustomizedSettingNamesOnly>
|
||||
<Settings>
|
||||
<CustomSetting>
|
||||
<UserfriendlyName>Enable Ansel</UserfriendlyName>
|
||||
<HexSettingID>0x1075D972</HexSettingID>
|
||||
<Description />
|
||||
<GroupName>5 - Common</GroupName>
|
||||
<SettingValues>
|
||||
<CustomSettingValue>
|
||||
<UserfriendlyName>Off</UserfriendlyName>
|
||||
<HexValue>0x00000000</HexValue>
|
||||
</CustomSettingValue>
|
||||
<CustomSettingValue>
|
||||
<UserfriendlyName>On</UserfriendlyName>
|
||||
<HexValue>0x00000001</HexValue>
|
||||
</CustomSettingValue>
|
||||
</SettingValues>
|
||||
</CustomSetting>
|
||||
<CustomSetting>
|
||||
<UserfriendlyName>Sharpening Filter</UserfriendlyName>
|
||||
<HexSettingID>0x00598928</HexSettingID>
|
||||
|
||||
@@ -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("")]
|
||||
|
||||
|
||||
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;
|
||||
@@ -813,7 +827,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);
|
||||
}
|
||||
@@ -900,7 +914,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 +1046,7 @@ namespace nspector
|
||||
{
|
||||
_import.ImportAllProfilesFromNvidiaTextFile(openDialog.FileName);
|
||||
MessageBox.Show("Profile(s) successfully imported!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DrsSessionScope.DestroyGlobalSession();
|
||||
RefreshAll();
|
||||
}
|
||||
catch (NvapiException)
|
||||
@@ -1184,6 +1199,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());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user