mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-01-02 02:33:32 +00:00
RivaTuner Statistics Server crash fix
This commit is contained in:
parent
5c8968a32d
commit
ccf8360875
@ -663,6 +663,7 @@
|
|||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Services\CompatibilityService.cs" />
|
||||||
<Compile Include="Services\DialogService.cs" />
|
<Compile Include="Services\DialogService.cs" />
|
||||||
<Compile Include="Services\MetroDialogService.cs" />
|
<Compile Include="Services\MetroDialogService.cs" />
|
||||||
<Compile Include="Services\WindowService.cs" />
|
<Compile Include="Services\WindowService.cs" />
|
||||||
|
|||||||
@ -8,6 +8,7 @@ using System.Windows.Controls;
|
|||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using Artemis.DAL;
|
using Artemis.DAL;
|
||||||
using Artemis.InjectionModules;
|
using Artemis.InjectionModules;
|
||||||
|
using Artemis.Services;
|
||||||
using Artemis.Settings;
|
using Artemis.Settings;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
using Artemis.Utilities.ActiveWindowDetection;
|
using Artemis.Utilities.ActiveWindowDetection;
|
||||||
@ -32,6 +33,8 @@ namespace Artemis
|
|||||||
Logging.SetupLogging(SettingsProvider.Load<GeneralSettings>().LogLevel);
|
Logging.SetupLogging(SettingsProvider.Load<GeneralSettings>().LogLevel);
|
||||||
// Restore DDLs before interacting with any SDKs
|
// Restore DDLs before interacting with any SDKs
|
||||||
DllManager.RestoreLogitechDll();
|
DllManager.RestoreLogitechDll();
|
||||||
|
// Check compatibility before trying to boot further
|
||||||
|
CompatibilityService.CheckRivaTuner();
|
||||||
|
|
||||||
Initialize();
|
Initialize();
|
||||||
BindSpecialValues();
|
BindSpecialValues();
|
||||||
|
|||||||
@ -14,8 +14,7 @@ namespace Artemis.DeviceProviders.Logitech
|
|||||||
DllManager.RestoreLogitechDll();
|
DllManager.RestoreLogitechDll();
|
||||||
|
|
||||||
// Check to see if VC++ 2012 x64 is installed.
|
// Check to see if VC++ 2012 x64 is installed.
|
||||||
if (Registry.LocalMachine.OpenSubKey(
|
if (Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\Installer\Dependencies\{ca67548a-5ebe-413a-b50c-4b9ceb6d66c6}") == null)
|
||||||
@"SOFTWARE\Classes\Installer\Dependencies\{ca67548a-5ebe-413a-b50c-4b9ceb6d66c6}") == null)
|
|
||||||
{
|
{
|
||||||
CantEnableText = "Couldn't connect to your Logitech keyboard.\n" +
|
CantEnableText = "Couldn't connect to your Logitech keyboard.\n" +
|
||||||
"The Visual C++ 2012 Redistributable v11.0.61030.0 could not be found, which is required.\n" +
|
"The Visual C++ 2012 Redistributable v11.0.61030.0 could not be found, which is required.\n" +
|
||||||
|
|||||||
41
Artemis/Artemis/Services/CompatibilityService.cs
Normal file
41
Artemis/Artemis/Services/CompatibilityService.cs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
using NLog;
|
||||||
|
|
||||||
|
namespace Artemis.Services
|
||||||
|
{
|
||||||
|
public static class CompatibilityService
|
||||||
|
{
|
||||||
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
|
// Checks to see if RivaTuner Statistics Server is installed and if so places a profile disabling it for Artemis
|
||||||
|
public static void CheckRivaTuner()
|
||||||
|
{
|
||||||
|
// Find the installation path in the registry
|
||||||
|
var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\WOW6432Node\Unwinder\RTSS");
|
||||||
|
var value = key?.GetValue("InstallPath");
|
||||||
|
var installDir = Path.GetDirectoryName(value?.ToString());
|
||||||
|
|
||||||
|
if (installDir == null)
|
||||||
|
return;
|
||||||
|
var profilePath = Path.Combine(installDir, "ProfileTemplates\\Artemis.exe.cfg");
|
||||||
|
if (File.Exists(profilePath))
|
||||||
|
return;
|
||||||
|
|
||||||
|
File.WriteAllText(profilePath, "[Hooking]\r\nEnableHooking\t\t= 0");
|
||||||
|
|
||||||
|
// It's kill or be killed...
|
||||||
|
var rtssProcess = System.Diagnostics.Process.GetProcessesByName("RTSS").FirstOrDefault();
|
||||||
|
var rtssHookProcess = System.Diagnostics.Process.GetProcessesByName("RTSSHooksLoader64").FirstOrDefault();
|
||||||
|
rtssProcess?.Kill();
|
||||||
|
rtssHookProcess?.Kill();
|
||||||
|
|
||||||
|
// Funnily enough sleeping prevents the RTSS injection so that the process gets killed in time
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
|
||||||
|
Logger.Info("Detected that RivaTuner Statistics Server is installed, inserted a profile to prevent crashes.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user