1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

RivaTuner Statistics Server crash fix

This commit is contained in:
SpoinkyNL 2017-05-06 16:45:18 +02:00
parent 5c8968a32d
commit ccf8360875
4 changed files with 46 additions and 2 deletions

View File

@ -663,6 +663,7 @@
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Services\CompatibilityService.cs" />
<Compile Include="Services\DialogService.cs" />
<Compile Include="Services\MetroDialogService.cs" />
<Compile Include="Services\WindowService.cs" />

View File

@ -8,6 +8,7 @@ using System.Windows.Controls;
using System.Windows.Input;
using Artemis.DAL;
using Artemis.InjectionModules;
using Artemis.Services;
using Artemis.Settings;
using Artemis.Utilities;
using Artemis.Utilities.ActiveWindowDetection;
@ -32,6 +33,8 @@ namespace Artemis
Logging.SetupLogging(SettingsProvider.Load<GeneralSettings>().LogLevel);
// Restore DDLs before interacting with any SDKs
DllManager.RestoreLogitechDll();
// Check compatibility before trying to boot further
CompatibilityService.CheckRivaTuner();
Initialize();
BindSpecialValues();

View File

@ -14,8 +14,7 @@ namespace Artemis.DeviceProviders.Logitech
DllManager.RestoreLogitechDll();
// Check to see if VC++ 2012 x64 is installed.
if (Registry.LocalMachine.OpenSubKey(
@"SOFTWARE\Classes\Installer\Dependencies\{ca67548a-5ebe-413a-b50c-4b9ceb6d66c6}") == null)
if (Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\Installer\Dependencies\{ca67548a-5ebe-413a-b50c-4b9ceb6d66c6}") == null)
{
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" +

View 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.");
}
}
}