From d147415febc8321ae78d6b0bdd26c02df62cfd05 Mon Sep 17 00:00:00 2001 From: Jakob Date: Fri, 14 Jul 2023 11:16:21 +0200 Subject: [PATCH] fix fake profile and studio driver --- EnvyUpdate.sln | 13 +++++++++++-- EnvyUpdate/DashboardPage.xaml | 2 +- EnvyUpdate/DashboardPage.xaml.cs | 28 ++-------------------------- EnvyUpdate/EnvyUpdate.csproj | 31 +++++++++++++++++++++++++++++++ EnvyUpdate/MainWindow.xaml.cs | 15 +++++++++++++++ EnvyUpdate/Util.cs | 16 ++++++++++++++++ 6 files changed, 76 insertions(+), 29 deletions(-) diff --git a/EnvyUpdate.sln b/EnvyUpdate.sln index 5225e06..d7abf71 100644 --- a/EnvyUpdate.sln +++ b/EnvyUpdate.sln @@ -1,23 +1,32 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29411.108 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EnvyUpdate", "EnvyUpdate\EnvyUpdate.csproj", "{1BF2468D-9579-462D-9153-4836E9C8721F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug - ignoregpu|Any CPU = Debug - ignoregpu|Any CPU + Debug - ignoregpu|x86 = Debug - ignoregpu|x86 Debug|Any CPU = Debug|Any CPU + Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {1BF2468D-9579-462D-9153-4836E9C8721F}.Debug - ignoregpu|Any CPU.ActiveCfg = Debug - ignoregpu|Any CPU {1BF2468D-9579-462D-9153-4836E9C8721F}.Debug - ignoregpu|Any CPU.Build.0 = Debug - ignoregpu|Any CPU + {1BF2468D-9579-462D-9153-4836E9C8721F}.Debug - ignoregpu|x86.ActiveCfg = Debug - ignoregpu|x86 + {1BF2468D-9579-462D-9153-4836E9C8721F}.Debug - ignoregpu|x86.Build.0 = Debug - ignoregpu|x86 {1BF2468D-9579-462D-9153-4836E9C8721F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1BF2468D-9579-462D-9153-4836E9C8721F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1BF2468D-9579-462D-9153-4836E9C8721F}.Debug|x86.ActiveCfg = Debug|x86 + {1BF2468D-9579-462D-9153-4836E9C8721F}.Debug|x86.Build.0 = Debug|x86 {1BF2468D-9579-462D-9153-4836E9C8721F}.Release|Any CPU.ActiveCfg = Release|Any CPU {1BF2468D-9579-462D-9153-4836E9C8721F}.Release|Any CPU.Build.0 = Release|Any CPU + {1BF2468D-9579-462D-9153-4836E9C8721F}.Release|x86.ActiveCfg = Release|x86 + {1BF2468D-9579-462D-9153-4836E9C8721F}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/EnvyUpdate/DashboardPage.xaml b/EnvyUpdate/DashboardPage.xaml index b9572ba..128af7b 100644 --- a/EnvyUpdate/DashboardPage.xaml +++ b/EnvyUpdate/DashboardPage.xaml @@ -75,7 +75,7 @@ - + diff --git a/EnvyUpdate/DashboardPage.xaml.cs b/EnvyUpdate/DashboardPage.xaml.cs index abb0b90..6b4eba3 100644 --- a/EnvyUpdate/DashboardPage.xaml.cs +++ b/EnvyUpdate/DashboardPage.xaml.cs @@ -37,16 +37,6 @@ namespace EnvyUpdate { InitializeComponent(); - // Try to get command line arguments - try - { - arguments = Environment.GetCommandLineArgs(); - } - catch (IndexOutOfRangeException) - { - // This is necessary, since .NET throws an exception if you check for a non-existant arg. - } - // Delete installed legacy versions if (Directory.Exists(GlobalVars.appdata)) { @@ -63,20 +53,6 @@ namespace EnvyUpdate Debug.LogToFile("INFO Local driver version already known, updating info without reloading."); UpdateLocalVer(false); } - else - { - if (arguments.Contains("/fake")) - { - Debug.isFake = true; - Debug.LogToFile("WARN Faking GPU with debug info."); - } - else - { - Debug.LogToFile("FATAL No supported GPU found, terminating."); - MessageBox.Show(Properties.Resources.no_compatible_gpu); - Environment.Exit(255); - } - } Debug.LogToFile("INFO Detecting driver type."); @@ -320,7 +296,7 @@ namespace EnvyUpdate } } - private void radioGRD_Checked(object sender, RoutedEventArgs e) + private void switchStudioDriver_Unchecked(object sender, RoutedEventArgs e) { if (File.Exists(GlobalVars.exedirectory + "sd.envy")) { @@ -330,7 +306,7 @@ namespace EnvyUpdate } } - private void radioSD_Checked(object sender, RoutedEventArgs e) + private void switchStudioDriver_Checked(object sender, RoutedEventArgs e) { if (!File.Exists(GlobalVars.exedirectory + "sd.envy")) { diff --git a/EnvyUpdate/EnvyUpdate.csproj b/EnvyUpdate/EnvyUpdate.csproj index ef59029..29dd347 100644 --- a/EnvyUpdate/EnvyUpdate.csproj +++ b/EnvyUpdate/EnvyUpdate.csproj @@ -72,6 +72,37 @@ app.manifest + + true + bin\x86\Debug\ + DEBUG;TRACE + full + x86 + 7.3 + prompt + true + + + bin\x86\Release\ + TRACE + true + pdbonly + x86 + 7.3 + prompt + true + + + true + bin\x86\Debug - ignoregpu\ + DEBUG;TRACE + full + x86 + 7.3 + prompt + MinimumRecommendedRules.ruleset + true + diff --git a/EnvyUpdate/MainWindow.xaml.cs b/EnvyUpdate/MainWindow.xaml.cs index 271996c..672e8db 100644 --- a/EnvyUpdate/MainWindow.xaml.cs +++ b/EnvyUpdate/MainWindow.xaml.cs @@ -54,6 +54,21 @@ namespace EnvyUpdate Environment.Exit(1); } + if (!Util.IsNvidia()) + { + if (arguments.Contains("/fake")) + { + Debug.isFake = true; + Debug.LogToFile("WARN Faking GPU with debug info."); + } + else + { + Debug.LogToFile("FATAL No supported GPU found, terminating."); + MessageBox.Show(Properties.Resources.no_compatible_gpu); + Environment.Exit(255); + } + } + //Check if launched as miminized with arg if (arguments.Contains("/minimize")) { diff --git a/EnvyUpdate/Util.cs b/EnvyUpdate/Util.cs index fdd5fc2..9aa70cf 100644 --- a/EnvyUpdate/Util.cs +++ b/EnvyUpdate/Util.cs @@ -59,6 +59,22 @@ namespace EnvyUpdate } } + /// + /// Check for existence of Nvidia GPU + /// + /// + public static bool IsNvidia() + { + Debug.LogToFile("INFO Checking for existence of Nvidia GPU."); + + foreach (ManagementObject obj in new ManagementObjectSearcher("SELECT * FROM Win32_VideoController").Get()) + { + if (obj["Description"].ToString().ToLower().Contains("nvidia")) + return true; + } + return false; + } + /// /// Creates a standard Windows shortcut. ///