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

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