Skip to content

Commit

Permalink
Allow manual disabling of all functions related to the GPU
Browse files Browse the repository at this point in the history
  • Loading branch information
yinyue200 committed Nov 10, 2024
1 parent c2c5d2a commit 26222d8
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 29 deletions.
14 changes: 7 additions & 7 deletions app/AnimeMatrix/AniMatrixControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ public AniMatrixControl(SettingsForm settingsForm)
deviceMatrix = new AnimeMatrixDevice();
}

matrixTimer = new System.Timers.Timer(100);
matrixTimer.Elapsed += MatrixTimer_Elapsed;
matrixTimer = new System.Timers.Timer(100);
matrixTimer.Elapsed += MatrixTimer_Elapsed;

}
catch (Exception ex)
{
Logger.WriteLine(ex.Message);
}
}
catch (Exception ex)
{
Logger.WriteLine(ex.Message);
}

}

public void SetDevice(bool wakeUp = false)
Expand Down
5 changes: 5 additions & 0 deletions app/AppConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,11 @@ public static bool IsNoDirectRGB()
return ContainsModel("GA503") || ContainsModel("G533Q") || ContainsModel("GU502") || ContainsModel("GU603") || IsSlash();
}

public static bool NoGpu()
{
return Is("no_gpu");
}

public static bool IsStrixNumpad()
{
return ContainsModel("G713R");
Expand Down
2 changes: 1 addition & 1 deletion app/Gpu/AMD/AmdGpuControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class AmdGpuControl : IGpuControl

public AmdGpuControl()
{
if (!Adl2.Load())
if (!Adl2.Load() || AppConfig.NoGpu())
return;

try
Expand Down
2 changes: 1 addition & 1 deletion app/Gpu/GPUModeControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void InitGPUMode()
// GPU mode not supported
if (eco < 0 && mux < 0)
{
if (gpuExists is null) gpuExists = Program.acpi.GetFan(AsusFan.GPU) >= 0;
if (gpuExists is null) gpuExists = (!AppConfig.NoGpu()) && Program.acpi.GetFan(AsusFan.GPU) >= 0;
settings.HideGPUModes((bool)gpuExists);
}
}
Expand Down
37 changes: 20 additions & 17 deletions app/HardwareControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,26 +289,29 @@ public static void RecreateGpuControl()
{
GpuControl?.Dispose();

IGpuControl _gpuControl = new NvidiaGpuControl();

if (_gpuControl.IsValid)
if (!AppConfig.NoGpu())
{
GpuControl = _gpuControl;
Logger.WriteLine(GpuControl.FullName);
return;
}
IGpuControl _gpuControl = new NvidiaGpuControl();

_gpuControl.Dispose();
if (_gpuControl.IsValid)
{
GpuControl = _gpuControl;
Logger.WriteLine(GpuControl.FullName);
return;
}

_gpuControl = new AmdGpuControl();
if (_gpuControl.IsValid)
{
GpuControl = _gpuControl;
if (GpuControl.FullName.Contains("6850M")) AppConfig.Set("xgm_special", 1);
Logger.WriteLine(GpuControl.FullName);
return;
}
_gpuControl.Dispose();
_gpuControl.Dispose();

_gpuControl = new AmdGpuControl();
if (_gpuControl.IsValid)
{
GpuControl = _gpuControl;
if (GpuControl.FullName.Contains("6850M")) AppConfig.Set("xgm_special", 1);
Logger.WriteLine(GpuControl.FullName);
return;
}
_gpuControl.Dispose();
}

Logger.WriteLine("dGPU not found");
GpuControl = null;
Expand Down
5 changes: 2 additions & 3 deletions app/Peripherals/Mouse/AsusMouse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,8 @@ public bool IsDeviceConnected()
{
try
{
HidSharp.DeviceList.Local.GetHidDevices(VendorID(), ProductID())
.First(x => x.DevicePath.Contains(path));
return true;
return HidSharp.DeviceList.Local.GetHidDevices(VendorID(), ProductID())
.FirstOrDefault(x => x.DevicePath.Contains(path)) != null;
}
catch
{
Expand Down

0 comments on commit 26222d8

Please sign in to comment.