mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Improved Ally Auto Controller mode
This commit is contained in:
@@ -347,6 +347,7 @@ namespace GHelper.Ally
|
|||||||
if (!autoTDP && _mode != ControllerMode.Auto) return;
|
if (!autoTDP && _mode != ControllerMode.Auto) return;
|
||||||
|
|
||||||
float fps = amdControl.GetFPS();
|
float fps = amdControl.GetFPS();
|
||||||
|
int? usage = 0;
|
||||||
|
|
||||||
if (autoTDP && fpsLimit > 0 && fpsLimit <= 120)
|
if (autoTDP && fpsLimit > 0 && fpsLimit <= 120)
|
||||||
{
|
{
|
||||||
@@ -377,7 +378,8 @@ namespace GHelper.Ally
|
|||||||
|
|
||||||
if (_mode == ControllerMode.Auto)
|
if (_mode == ControllerMode.Auto)
|
||||||
{
|
{
|
||||||
ControllerMode newMode = (fps > 0) ? ControllerMode.Gamepad : ControllerMode.Mouse;
|
if (fps > 0) usage = amdControl.GetiGpuUse();
|
||||||
|
ControllerMode newMode = (fps > 0 && usage > 15) ? ControllerMode.Gamepad : ControllerMode.Mouse;
|
||||||
|
|
||||||
if (_applyMode != newMode) _autoCount++;
|
if (_applyMode != newMode) _autoCount++;
|
||||||
else _autoCount = 0;
|
else _autoCount = 0;
|
||||||
@@ -386,7 +388,7 @@ namespace GHelper.Ally
|
|||||||
{
|
{
|
||||||
_autoCount = 0;
|
_autoCount = 0;
|
||||||
ApplyMode(newMode);
|
ApplyMode(newMode);
|
||||||
Logger.WriteLine($"Controller Mode {fps}: {newMode}");
|
Logger.WriteLine($"Controller Mode (FPS={fps}, USAGE={usage}%): {newMode}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -119,6 +119,18 @@ public class AmdGpuControl : IGpuControl
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int? GetiGpuUse()
|
||||||
|
{
|
||||||
|
if (_adlContextHandle == nint.Zero || _iGPU == null) return null;
|
||||||
|
if (ADL2_New_QueryPMLogData_Get(_adlContextHandle, ((ADLAdapterInfo)_iGPU).AdapterIndex, out ADLPMLogDataOutput adlpmLogDataOutput) != Adl2.ADL_SUCCESS) return null;
|
||||||
|
|
||||||
|
ADLSingleSensorData gpuUsage = adlpmLogDataOutput.Sensors[(int)ADLSensorType.PMLOG_INFO_ACTIVITY_GFX];
|
||||||
|
if (gpuUsage.Supported == 0) return null;
|
||||||
|
|
||||||
|
return gpuUsage.Value;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public int? GetGpuPower()
|
public int? GetGpuPower()
|
||||||
{
|
{
|
||||||
if (_adlContextHandle == nint.Zero || _iGPU == null) return null;
|
if (_adlContextHandle == nint.Zero || _iGPU == null) return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user