fix fake profile and studio driver

This commit is contained in:
Jakob 2023-07-14 11:16:21 +02:00
parent cdcfccd87c
commit d147415feb
6 changed files with 76 additions and 29 deletions

View file

@ -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

View file

@ -75,7 +75,7 @@
</Grid>
<ui:CardControl Margin="0,12,0,0" Grid.Row="4" Icon="Color24" Header="Studio Driver">
<ui:ToggleSwitch x:Name="switchStudioDriver" IsChecked="False" />
<ui:ToggleSwitch x:Name="switchStudioDriver" IsChecked="False" Checked="switchStudioDriver_Checked" Unchecked="switchStudioDriver_Unchecked" />
</ui:CardControl>
<ui:CardControl Margin="0,12,0,0" Grid.Row="5" Icon="LightbulbFilament48" Header="{x:Static p:Resources.ui_autostart}">

View file

@ -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"))
{

View file

@ -72,6 +72,37 @@
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug - ignoregpu|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug - ignoregpu\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Build.Framework" />
<Reference Include="Microsoft.Build.Utilities.v4.0" />

View file

@ -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"))
{

View file

@ -59,6 +59,22 @@ namespace EnvyUpdate
}
}
/// <summary>
/// Check for existence of Nvidia GPU
/// </summary>
/// <returns></returns>
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;
}
/// <summary>
/// Creates a standard Windows shortcut.
/// </summary>