Compare commits

...

29 Commits

Author SHA1 Message Date
Serge
03bff51850 Improved 3rd (mid) fan detection https://github.com/seerge/g-helper/issues/2067 2024-02-16 18:35:04 +01:00
Serge
42a598f177 Aura tweaks 2024-02-15 14:22:11 +01:00
Serge
ebfb9b3875 Aura brightness check 2024-02-15 13:51:56 +01:00
Serge
60c4e08347 Debug button 2024-02-15 12:30:12 +01:00
Serge
e98cd2f5c1 Camera toggle for Vivobooks https://github.com/seerge/g-helper/issues/2060 2024-02-14 15:40:00 +01:00
Serge
697b5f0d2f Camera toggle for old Vivobooks https://github.com/seerge/g-helper/issues/2060 2024-02-14 09:41:50 +01:00
Serge
b638382799 Merge branch 'main' of https://github.com/seerge/g-helper 2024-02-13 14:26:36 +01:00
Serge
5f6afc0c6e Hotkeys fix https://github.com/seerge/g-helper/issues/2059 2024-02-13 14:26:33 +01:00
Serge
8de06ce5ad Update README.md 2024-02-13 09:26:24 +01:00
Serge
85725fb782 Slash lightning (#2058)
* Slash Lightning

* Slash lightning UI tweaks

* Slash Lightning tweaks

* Minor tweaks

* Slash Interval settings

* UI tweaks

* Slash tweaks

* More slash modes

* Cleanup
2024-02-12 18:43:27 +01:00
Serge
d2cb6965e0 Make app log longer 2024-02-12 18:29:39 +01:00
Serge
3f8083be50 Exception handling for case when USB device refuses to open https://github.com/seerge/g-helper/issues/2057 2024-02-12 18:24:11 +01:00
Serge
1d30699fa2 Merge branch 'main' of https://github.com/seerge/g-helper 2024-02-11 16:09:52 +01:00
Serge
060e3b7f7d Updates to RyzenControl to support Hawk Point CPUs 2024-02-11 16:09:51 +01:00
Serge
2785bc6267 Update README.md 2024-02-11 14:03:11 +01:00
Serge
094fce0117 Backlight brightness tweak for G14 2024 2024-02-11 11:46:37 +01:00
Serge
af9d3eb50e Skip airplane mode command for ancient devices https://github.com/seerge/g-helper/issues/2052 2024-02-10 22:53:22 +01:00
Serge
03f7d717b6 Merge branch 'main' of https://github.com/seerge/g-helper 2024-02-10 17:19:06 +01:00
Serge
833b750227 Anime Matrix cleanup 2024-02-10 17:19:04 +01:00
Serge
b6dbc1ed25 New Crowdin updates (#2050)
* New translations strings.resx (French)

* New translations strings.resx (French)
2024-02-10 12:43:11 +01:00
Serge
103c65a43d Custom fan curves fix for GA503.317 https://github.com/seerge/g-helper/issues/2049 2024-02-09 22:15:25 +01:00
Serge
d19ff265ab Version bump 2024-02-09 21:52:56 +01:00
Serge
5d71a40987 Merge branch 'main' of https://github.com/seerge/g-helper 2024-02-09 21:52:06 +01:00
Serge
9b33a43b49 Swapped fans workaround for GA503.317 2024-02-09 21:52:03 +01:00
Serge
df5bcbc376 New translations strings.resx (Spanish) (#2048) 2024-02-09 21:21:09 +01:00
Serge
71b74801ba New translations strings.resx (Spanish) (#2047) 2024-02-09 20:10:00 +01:00
Serge
6bab2fc9cb Anime Matrix hibernate wake-up tweaks 2024-02-09 15:49:09 +01:00
Serge
428b624ec6 Anime Matrix hibernate wake-up tweak 2024-02-09 15:48:24 +01:00
Serge
af001b056a UI Fixes 2024-02-07 21:22:12 +01:00
25 changed files with 614 additions and 253 deletions

View File

@@ -1,6 +1,5 @@
using NAudio.CoreAudioApi; using NAudio.CoreAudioApi;
using NAudio.Wave; using NAudio.Wave;
using Starlight.AnimeMatrix;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Drawing.Imaging; using System.Drawing.Imaging;
@@ -15,14 +14,17 @@ namespace GHelper.AnimeMatrix
SettingsForm settings; SettingsForm settings;
System.Timers.Timer matrixTimer = default!; System.Timers.Timer matrixTimer = default!;
public AnimeMatrixDevice? device;
public AnimeMatrixDevice? deviceMatrix;
public SlashDevice? deviceSlash;
double[]? AudioValues; double[]? AudioValues;
WasapiCapture? AudioDevice; WasapiCapture? AudioDevice;
string? AudioDeviceId; string? AudioDeviceId;
private MMDeviceEnumerator? AudioDeviceEnum; private MMDeviceEnumerator? AudioDeviceEnum;
public bool IsValid => device != null; public bool IsValid => deviceMatrix != null || deviceSlash != null;
public bool IsSlash => deviceSlash != null;
private long lastPresent; private long lastPresent;
private List<double> maxes = new List<double>(); private List<double> maxes = new List<double>();
@@ -33,38 +35,82 @@ namespace GHelper.AnimeMatrix
try try
{ {
device = new AnimeMatrixDevice(); if (AppConfig.IsSlash())
Task.Run(device.WakeUp); deviceSlash = new SlashDevice();
else
deviceMatrix = new AnimeMatrixDevice();
matrixTimer = new System.Timers.Timer(100); matrixTimer = new System.Timers.Timer(100);
matrixTimer.Elapsed += MatrixTimer_Elapsed; matrixTimer.Elapsed += MatrixTimer_Elapsed;
} }
catch catch (Exception ex)
{ {
device = null; Logger.WriteLine(ex.Message);
} }
} }
public void SetDevice(bool wakeUp = false)
{
if (deviceMatrix is not null) SetMatrix(wakeUp);
if (deviceSlash is not null) SetSlash(wakeUp);
}
public void SetSlash(bool wakeUp = false)
{
if (deviceSlash is null) return;
int brightness = AppConfig.Get("matrix_brightness", 0);
int running = AppConfig.Get("matrix_running", 0);
int inteval = AppConfig.Get("matrix_interval", 0);
bool auto = AppConfig.Is("matrix_auto");
Task.Run(() =>
{
try
{
deviceSlash.SetProvider();
}
catch (Exception ex)
{
Logger.WriteLine(ex.Message);
return;
}
if (wakeUp) deviceSlash.WakeUp();
if (brightness == 0 || (auto && SystemInformation.PowerStatus.PowerLineStatus != PowerLineStatus.Online))
{
deviceSlash.Init();
deviceSlash.SetOptions(false, 0, 0);
}
else
{
deviceSlash.Init();
deviceSlash.SetMode((SlashMode)running);
deviceSlash.SetOptions(true, brightness, inteval);
deviceSlash.Save();
}
});
}
public void SetBatteryAuto()
{
if (deviceSlash is not null) deviceSlash.SetBatterySaver(AppConfig.Is("matrix_auto"));
if (deviceMatrix is not null) SetMatrix();
}
public void SetMatrix(bool wakeUp = false) public void SetMatrix(bool wakeUp = false)
{ {
if (!IsValid) return; if (deviceMatrix is null) return;
int brightness = AppConfig.Get("matrix_brightness");
int running = AppConfig.Get("matrix_running");
int brightness = AppConfig.Get("matrix_brightness", 0);
int running = AppConfig.Get("matrix_running", 0);
bool auto = AppConfig.Is("matrix_auto"); bool auto = AppConfig.Is("matrix_auto");
if (brightness < 0) brightness = 0;
if (running < 0) running = 0;
BuiltInAnimation animation = new BuiltInAnimation(
(BuiltInAnimation.Running)running,
BuiltInAnimation.Sleeping.Starfield,
BuiltInAnimation.Shutdown.SeeYa,
BuiltInAnimation.Startup.StaticEmergence
);
StopMatrixTimer(); StopMatrixTimer();
StopMatrixAudio(); StopMatrixAudio();
@@ -72,7 +118,7 @@ namespace GHelper.AnimeMatrix
{ {
try try
{ {
device.SetProvider(); deviceMatrix.SetProvider();
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -80,18 +126,18 @@ namespace GHelper.AnimeMatrix
return; return;
} }
if (wakeUp && AppConfig.ContainsModel("401")) device.WakeUp(); if (wakeUp) deviceMatrix.WakeUp();
if (brightness == 0 || (auto && SystemInformation.PowerStatus.PowerLineStatus != PowerLineStatus.Online)) if (brightness == 0 || (auto && SystemInformation.PowerStatus.PowerLineStatus != PowerLineStatus.Online))
{ {
device.SetDisplayState(false); deviceMatrix.SetDisplayState(false);
device.SetDisplayState(false); // some devices are dumb deviceMatrix.SetDisplayState(false); // some devices are dumb
Logger.WriteLine("Matrix Off"); Logger.WriteLine("Matrix Off");
} }
else else
{ {
device.SetDisplayState(true); deviceMatrix.SetDisplayState(true);
device.SetBrightness((BrightnessMode)brightness); deviceMatrix.SetBrightness((BrightnessMode)brightness);
switch (running) switch (running)
{ {
@@ -105,8 +151,7 @@ namespace GHelper.AnimeMatrix
SetMatrixAudio(); SetMatrixAudio();
break; break;
default: default:
device.SetBuiltInAnimation(true, animation); SetBuiltIn(running);
Logger.WriteLine("Matrix builtin " + animation.AsByte);
break; break;
} }
@@ -115,6 +160,19 @@ namespace GHelper.AnimeMatrix
} }
private void SetBuiltIn(int running)
{
BuiltInAnimation animation = new BuiltInAnimation(
(BuiltInAnimation.Running)running,
BuiltInAnimation.Sleeping.Starfield,
BuiltInAnimation.Shutdown.SeeYa,
BuiltInAnimation.Startup.StaticEmergence
);
deviceMatrix.SetBuiltInAnimation(true, animation);
Logger.WriteLine("Matrix builtin: " + animation.AsByte);
}
private void StartMatrixTimer(int interval = 100) private void StartMatrixTimer(int interval = 100)
{ {
matrixTimer.Interval = interval; matrixTimer.Interval = interval;
@@ -129,15 +187,16 @@ namespace GHelper.AnimeMatrix
private void MatrixTimer_Elapsed(object? sender, ElapsedEventArgs e) private void MatrixTimer_Elapsed(object? sender, ElapsedEventArgs e)
{ {
//if (!IsValid) return;
if (deviceMatrix is null) return;
switch (AppConfig.Get("matrix_running")) switch (AppConfig.Get("matrix_running"))
{ {
case 2: case 2:
device.PresentNextFrame(); deviceMatrix.PresentNextFrame();
break; break;
case 3: case 3:
device.PresentClock(); deviceMatrix.PresentClock();
break; break;
} }
@@ -146,7 +205,7 @@ namespace GHelper.AnimeMatrix
public void SetMatrixClock() public void SetMatrixClock()
{ {
device.SetBuiltInAnimation(false); deviceMatrix.SetBuiltInAnimation(false);
StartMatrixTimer(1000); StartMatrixTimer(1000);
Logger.WriteLine("Matrix Clock"); Logger.WriteLine("Matrix Clock");
} }
@@ -177,9 +236,9 @@ namespace GHelper.AnimeMatrix
void SetMatrixAudio() void SetMatrixAudio()
{ {
if (!IsValid) return; if (deviceMatrix is null) return;
device.SetBuiltInAnimation(false); deviceMatrix.SetBuiltInAnimation(false);
StopMatrixTimer(); StopMatrixTimer();
StopMatrixAudio(); StopMatrixAudio();
@@ -251,18 +310,20 @@ namespace GHelper.AnimeMatrix
for (int x = 0; x < 2 - (y % 2); x++) for (int x = 0; x < 2 - (y % 2); x++)
{ {
//color = (byte)(Math.Min(1,(h - y - 2)*2) * 255); //color = (byte)(Math.Min(1,(h - y - 2)*2) * 255);
device.SetLedPlanar(x + dx, dy + y, (byte)(h * 255 / 30)); deviceMatrix.SetLedPlanar(x + dx, dy + y, (byte)(h * 255 / 30));
device.SetLedPlanar(x + dx, dy - y, 255); deviceMatrix.SetLedPlanar(x + dx, dy - y, 255);
} }
} }
void PresentAudio(double[] audio) void PresentAudio(double[] audio)
{ {
if (deviceMatrix is null) return;
if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastPresent) < 70) return; if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastPresent) < 70) return;
lastPresent = DateTimeOffset.Now.ToUnixTimeMilliseconds(); lastPresent = DateTimeOffset.Now.ToUnixTimeMilliseconds();
device.Clear(); deviceMatrix.Clear();
int size = 20; int size = 20;
double[] bars = new double[size]; double[] bars = new double[size];
@@ -280,7 +341,7 @@ namespace GHelper.AnimeMatrix
for (int i = 0; i < size; i++) DrawBar(20 - i, bars[i] * 20 / maxAverage); for (int i = 0; i < size; i++) DrawBar(20 - i, bars[i] * 20 / maxAverage);
device.Present(); deviceMatrix.Present();
} }
@@ -309,7 +370,7 @@ namespace GHelper.AnimeMatrix
AppConfig.Set("matrix_running", 2); AppConfig.Set("matrix_running", 2);
SetMatrixPicture(fileName); SetMatrixPicture(fileName);
settings.SetMatrixRunning(2); settings.VisualiseMatrixRunning(2);
} }
@@ -318,7 +379,8 @@ namespace GHelper.AnimeMatrix
public void SetMatrixPicture(string fileName, bool visualise = true) public void SetMatrixPicture(string fileName, bool visualise = true)
{ {
if (!IsValid) return; if (deviceMatrix is null) return;
StopMatrixTimer(); StopMatrixTimer();
try try
@@ -338,7 +400,7 @@ namespace GHelper.AnimeMatrix
} }
fs.Close(); fs.Close();
if (visualise) settings.VisualiseMatrix(fileName); if (visualise) settings.VisualiseMatrixPicture(fileName);
} }
} }
catch catch
@@ -351,8 +413,8 @@ namespace GHelper.AnimeMatrix
protected void ProcessPicture(Image image) protected void ProcessPicture(Image image)
{ {
device.SetBuiltInAnimation(false); deviceMatrix.SetBuiltInAnimation(false);
device.ClearFrames(); deviceMatrix.ClearFrames();
int matrixX = AppConfig.Get("matrix_x", 0); int matrixX = AppConfig.Get("matrix_x", 0);
int matrixY = AppConfig.Get("matrix_y", 0); int matrixY = AppConfig.Get("matrix_y", 0);
@@ -380,11 +442,11 @@ namespace GHelper.AnimeMatrix
image.SelectActiveFrame(dimension, i); image.SelectActiveFrame(dimension, i);
if (rotation == MatrixRotation.Planar) if (rotation == MatrixRotation.Planar)
device.GenerateFrame(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast); deviceMatrix.GenerateFrame(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast);
else else
device.GenerateFrameDiagonal(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast); deviceMatrix.GenerateFrameDiagonal(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast);
device.AddFrame(); deviceMatrix.AddFrame();
} }
@@ -397,11 +459,11 @@ namespace GHelper.AnimeMatrix
else else
{ {
if (rotation == MatrixRotation.Planar) if (rotation == MatrixRotation.Planar)
device.GenerateFrame(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast); deviceMatrix.GenerateFrame(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast);
else else
device.GenerateFrameDiagonal(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast); deviceMatrix.GenerateFrameDiagonal(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast);
device.Present(); deviceMatrix.Present();
} }
} }

View File

@@ -5,7 +5,7 @@ using System.Drawing.Drawing2D;
using System.Drawing.Text; using System.Drawing.Text;
using System.Text; using System.Text;
namespace Starlight.AnimeMatrix namespace GHelper.AnimeMatrix
{ {
public class BuiltInAnimation public class BuiltInAnimation
{ {
@@ -71,7 +71,6 @@ namespace Starlight.AnimeMatrix
} }
public enum BrightnessMode : byte public enum BrightnessMode : byte
{ {
Off = 0, Off = 0,
@@ -81,7 +80,6 @@ namespace Starlight.AnimeMatrix
} }
public class AnimeMatrixDevice : Device public class AnimeMatrixDevice : Device
{ {
int UpdatePageLength = 490; int UpdatePageLength = 490;
@@ -93,7 +91,6 @@ namespace Starlight.AnimeMatrix
public int MaxRows = 61; public int MaxRows = 61;
public int MaxColumns = 34; public int MaxColumns = 34;
public int LedStart = 0; public int LedStart = 0;
public int FullRows = 11; public int FullRows = 11;
private int frameIndex = 0; private int frameIndex = 0;
@@ -139,6 +136,56 @@ namespace Starlight.AnimeMatrix
} }
public void WakeUp()
{
Set(Packet<AnimeMatrixPacket>(Encoding.ASCII.GetBytes("ASUS Tech.Inc.")));
}
public void SetBrightness(BrightnessMode mode)
{
Set(Packet<AnimeMatrixPacket>(0xC0, 0x04, (byte)mode));
}
public void SetDisplayState(bool enable)
{
Set(Packet<AnimeMatrixPacket>(0xC3, 0x01, enable ? (byte)0x00 : (byte)0x80));
}
public void SetBuiltInAnimation(bool enable)
{
Set(Packet<AnimeMatrixPacket>(0xC4, 0x01, enable ? (byte)0x00 : (byte)0x80));
}
public void SetBuiltInAnimation(bool enable, BuiltInAnimation animation)
{
SetBuiltInAnimation(enable);
Set(Packet<AnimeMatrixPacket>(0xC5, animation.AsByte));
}
public void Present()
{
int page = 0;
int start, end;
while (page * UpdatePageLength < LedCount)
{
start = page * UpdatePageLength;
end = Math.Min(LedCount, (page + 1) * UpdatePageLength);
Set(Packet<AnimeMatrixPacket>(0xC0, 0x02)
.AppendData(BitConverter.GetBytes((ushort)(start + 1)))
.AppendData(BitConverter.GetBytes((ushort)(end - start)))
.AppendData(_displayBuffer[start..end])
);
page++;
}
Set(Packet<AnimeMatrixPacket>(0xC0, 0x03));
}
private void LoadMFont() private void LoadMFont()
{ {
byte[] fontData = GHelper.Properties.Resources.MFont; byte[] fontData = GHelper.Properties.Resources.MFont;
@@ -151,10 +198,6 @@ namespace Starlight.AnimeMatrix
System.Runtime.InteropServices.Marshal.FreeCoTaskMem(fontPtr); System.Runtime.InteropServices.Marshal.FreeCoTaskMem(fontPtr);
} }
public byte[] GetBuffer()
{
return _displayBuffer;
}
public void PresentNextFrame() public void PresentNextFrame()
{ {
@@ -175,12 +218,6 @@ namespace Starlight.AnimeMatrix
frames.Add(_displayBuffer.ToArray()); frames.Add(_displayBuffer.ToArray());
} }
public void SendRaw(params byte[] data)
{
Set(Packet<AnimeMatrixPacket>(data));
}
public int Width() public int Width()
{ {
switch (_model) switch (_model)
@@ -294,99 +331,19 @@ namespace Starlight.AnimeMatrix
} }
public void WakeUp()
{
Set(Packet<AnimeMatrixPacket>(Encoding.ASCII.GetBytes("ASUS Tech.Inc.")));
}
public void SetLedLinear(int address, byte value) public void SetLedLinear(int address, byte value)
{ {
if (!IsAddressableLed(address)) return; if (!IsAddressableLed(address)) return;
_displayBuffer[address] = value; _displayBuffer[address] = value;
} }
public void SetLedLinearImmediate(int address, byte value)
{
if (!IsAddressableLed(address)) return;
_displayBuffer[address] = value;
Set(Packet<AnimeMatrixPacket>(0xC0, 0x02)
.AppendData(BitConverter.GetBytes((ushort)(address + 1)))
.AppendData(BitConverter.GetBytes((ushort)0x0001))
.AppendData(value)
);
Set(Packet<AnimeMatrixPacket>(0xC0, 0x03));
}
public void Clear(bool present = false) public void Clear(bool present = false)
{ {
for (var i = 0; i < _displayBuffer.Length; i++) for (var i = 0; i < _displayBuffer.Length; i++) _displayBuffer[i] = 0;
_displayBuffer[i] = 0; if (present) Present();
if (present)
Present();
} }
public void Present()
{
int page = 0;
int start, end;
while (page * UpdatePageLength < LedCount)
{
start = page * UpdatePageLength;
end = Math.Min(LedCount, (page + 1) * UpdatePageLength);
Set(Packet<AnimeMatrixPacket>(0xC0, 0x02)
.AppendData(BitConverter.GetBytes((ushort)(start + 1)))
.AppendData(BitConverter.GetBytes((ushort)(end - start)))
.AppendData(_displayBuffer[start..end])
);
page++;
}
Set(Packet<AnimeMatrixPacket>(0xC0, 0x03));
}
public void SetDisplayState(bool enable)
{
if (enable)
{
Set(Packet<AnimeMatrixPacket>(0xC3, 0x01)
.AppendData(0x00));
}
else
{
Set(Packet<AnimeMatrixPacket>(0xC3, 0x01)
.AppendData(0x80));
}
}
public void SetBrightness(BrightnessMode mode)
{
Set(Packet<AnimeMatrixPacket>(0xC0, 0x04)
.AppendData((byte)mode)
);
}
public void SetBuiltInAnimation(bool enable)
{
var enabled = enable ? (byte)0x00 : (byte)0x80;
Set(Packet<AnimeMatrixPacket>(0xC4, 0x01, enabled));
}
public void SetBuiltInAnimation(bool enable, BuiltInAnimation animation)
{
SetBuiltInAnimation(enable);
Set(Packet<AnimeMatrixPacket>(0xC5, animation.AsByte));
}
private void SetBitmapDiagonal(Bitmap bmp, int deltaX = 0, int deltaY = 0, int contrast = 100) private void SetBitmapDiagonal(Bitmap bmp, int deltaX = 0, int deltaY = 0, int contrast = 100)
{ {
for (int y = 0; y < bmp.Height; y++) for (int y = 0; y < bmp.Height; y++)

View File

@@ -36,11 +36,12 @@ namespace GHelper.AnimeMatrix.Communication.Platform
{ {
HidDevice = DeviceList.Local HidDevice = DeviceList.Local
.GetHidDevices(vendorId, productId) .GetHidDevices(vendorId, productId)
.First(x => x.GetMaxFeatureReportLength() == maxFeatureReportLength); .First(x => x.GetMaxFeatureReportLength() >= maxFeatureReportLength);
Logger.WriteLine("Matrix Device: " + HidDevice.DevicePath + " " + HidDevice.GetMaxFeatureReportLength());
} }
catch catch
{ {
throw new IOException("AniMe Matrix control device was not found on your machine."); throw new IOException("Matrix control device was not found on your machine.");
} }
var config = new OpenConfiguration(); var config = new OpenConfiguration();

View File

@@ -0,0 +1,138 @@
using GHelper.AnimeMatrix.Communication;
using System.Text;
namespace GHelper.AnimeMatrix
{
public enum SlashMode
{
Bounce,
Slash,
Loading,
BitStream,
Transmission,
Flow,
Flux,
Phantom,
Spectrum,
Hazard,
Interfacing,
Ramp,
GameOver,
Start,
Buzzer
}
internal class SlashPacket : Packet
{
public SlashPacket(byte[] command) : base(0x5E, 128, command)
{
}
}
public class SlashDevice : Device
{
public static Dictionary<SlashMode, string> Modes = new Dictionary<SlashMode, string>
{
{ SlashMode.Bounce, "Bounce"},
{ SlashMode.Slash, "Slash"},
{ SlashMode.Loading, "Loading"},
{ SlashMode.BitStream, "Bit Stream"},
{ SlashMode.Transmission, "Transmission"},
{ SlashMode.Flow, "Flow"},
{ SlashMode.Flux, "Flux"},
{ SlashMode.Phantom, "Phantom"},
{ SlashMode.Spectrum, "Spectrum"},
{ SlashMode.Hazard, "Hazard"},
{ SlashMode.Interfacing, "Interfacing"},
{ SlashMode.Ramp, "Ramp"},
{ SlashMode.GameOver, "Game Over"},
{ SlashMode.Start, "Start"},
{ SlashMode.Buzzer, "Buzzer"},
};
private static Dictionary<SlashMode, byte> modeCodes = new Dictionary<SlashMode, byte>
{
{ SlashMode.Bounce, 0x10},
{ SlashMode.Slash, 0x12},
{ SlashMode.Loading, 0x13},
{ SlashMode.BitStream, 0x1D},
{ SlashMode.Transmission, 0x1A},
{ SlashMode.Flow, 0x19},
{ SlashMode.Flux, 0x25},
{ SlashMode.Phantom, 0x24},
{ SlashMode.Spectrum, 0x26},
{ SlashMode.Hazard, 0x32},
{ SlashMode.Interfacing, 0x33},
{ SlashMode.Ramp, 0x34},
{ SlashMode.GameOver, 0x42},
{ SlashMode.Start, 0x43},
{ SlashMode.Buzzer, 0x44},
};
public SlashDevice() : base(0x0B05, 0x193B, 128)
{
}
public void WakeUp()
{
Set(Packet<SlashPacket>(Encoding.ASCII.GetBytes("ASUS Tech.Inc.")));
}
public void Init()
{
Set(Packet<SlashPacket>(0xD7, 0x00, 0x00, 0x01, 0xAC));
Set(Packet<SlashPacket>(0xD2, 0x02, 0x01, 0x08, 0xAB));
}
public void Save()
{
Set(Packet<SlashPacket>(0xD4, 0x00, 0x00, 0x01, 0xAB));
}
public void SetMode(SlashMode mode)
{
byte modeByte;
try
{
modeByte = modeCodes[mode];
}
catch (Exception)
{
modeByte = 0x00;
}
Set(Packet<SlashPacket>(0xD2, 0x03, 0x00, 0x0C));
Set(Packet<SlashPacket>(0xD3, 0x04, 0x00, 0x0C, 0x01, modeByte, 0x02, 0x19, 0x03, 0x13, 0x04, 0x11, 0x05, 0x12, 0x06, 0x13));
}
public void SetOptions(bool status, int brightness = 0, int interval = 0)
{
byte brightnessByte = (byte)(brightness * 85.333);
Set(Packet<SlashPacket>(0xD3, 0x03, 0x01, 0x08, 0xAB, 0xFF, 0x01, status ? (byte)0x01 : (byte)0x00, 0x06, brightnessByte, 0xFF, (byte)interval));
}
public void SetBatterySaver(bool status)
{
Set(Packet<SlashPacket>(0xD8, 0x01, 0x00, 0x01, status ? (byte)0x80 : (byte)0x00));
}
public void Set(Packet packet)
{
_usbProvider?.Set(packet.Data);
Logger.WriteLine("Slash:" + BitConverter.ToString(packet.Data));
}
}
}

View File

@@ -101,6 +101,8 @@ public static class AppConfig
} }
} }
//if (_model.Contains("GA402RK")) _model = "ROG Zephyrus G14 GA403UI"; // Debug Purposes
return _model; return _model;
} }
@@ -377,6 +379,16 @@ public static class AppConfig
return ContainsModel("GA401") || ContainsModel("FX517Z") || ContainsModel("FX516P") || ContainsModel("X13") || IsARCNM() || ContainsModel("GA502IU"); return ContainsModel("GA401") || ContainsModel("FX517Z") || ContainsModel("FX516P") || ContainsModel("X13") || IsARCNM() || ContainsModel("GA502IU");
} }
public static bool IsSlash()
{
return ContainsModel("GA403") || ContainsModel("GU605");
}
public static bool IsInputBacklight()
{
return ContainsModel("GA503") || IsSlash();
}
public static bool IsStrix() public static bool IsStrix()
{ {
return ContainsModel("Strix") || ContainsModel("Scar") || ContainsModel("G703G"); return ContainsModel("Strix") || ContainsModel("Scar") || ContainsModel("G703G");
@@ -387,6 +399,11 @@ public static class AppConfig
return (ContainsModel("G614JV") || ContainsModel("G614JZ") || ContainsModel("G512LI") || ContainsModel("G513R") || ContainsModel("G713PV") || ContainsModel("G513IE") || ContainsModel("G713RC") || ContainsModel("G513QM") || ContainsModel("G531G")) && !Is("per_key_rgb"); return (ContainsModel("G614JV") || ContainsModel("G614JZ") || ContainsModel("G512LI") || ContainsModel("G513R") || ContainsModel("G713PV") || ContainsModel("G513IE") || ContainsModel("G713RC") || ContainsModel("G513QM") || ContainsModel("G531G")) && !Is("per_key_rgb");
} }
public static bool IsNoAirplaneMode()
{
return ContainsModel("FX506");
}
public static bool IsNoDirectRGB() public static bool IsNoDirectRGB()
{ {
return ContainsModel("GA503") || ContainsModel("G533Q"); return ContainsModel("GA503") || ContainsModel("G533Q");
@@ -465,6 +482,21 @@ public static class AppConfig
} }
} }
public static bool IsSwappedFans()
{
if (!ContainsModel("GA503R")) return false;
try
{
var (bios, model) = GetBiosAndModel();
return (Int32.Parse(bios) == 317);
}
catch
{
return false;
}
}
public static bool IsFanRequired() public static bool IsFanRequired()
{ {
return ContainsModel("GA402X") || ContainsModel("G513") || ContainsModel("G713R") || ContainsModel("G713P"); return ContainsModel("GA402X") || ContainsModel("G513") || ContainsModel("G713R") || ContainsModel("G713P");

View File

@@ -46,7 +46,6 @@ public class AsusACPI
public const int KB_DUO_PgUpDn = 0x4B; public const int KB_DUO_PgUpDn = 0x4B;
public const int KB_DUO_SecondDisplay = 0x6A; public const int KB_DUO_SecondDisplay = 0x6A;
public const int Touchpad_Toggle = 0x6B; public const int Touchpad_Toggle = 0x6B;
public const int ChargerMode = 0x0012006C; public const int ChargerMode = 0x0012006C;
@@ -106,7 +105,7 @@ public class AsusACPI
public const int TUF_KB2 = 0x0010005a; public const int TUF_KB2 = 0x0010005a;
public const int TUF_KB_STATE = 0x00100057; public const int TUF_KB_STATE = 0x00100057;
public const int MICMUTE_LED = 0x00040017; public const int MicMuteLed = 0x00040017;
public const int TabletState = 0x00060077; public const int TabletState = 0x00060077;
public const int FnLock = 0x00100023; public const int FnLock = 0x00100023;
@@ -114,6 +113,8 @@ public class AsusACPI
public const int ScreenPadToggle = 0x00050031; public const int ScreenPadToggle = 0x00050031;
public const int ScreenPadBrightness = 0x00050032; public const int ScreenPadBrightness = 0x00050032;
public const int CameraLed = 0x00060079;
public const int BootSound = 0x00130022; public const int BootSound = 0x00130022;
public const int Tablet_Notebook = 0; public const int Tablet_Notebook = 0;
@@ -477,7 +478,11 @@ public class AsusACPI
if (fanScale != 100 && device == AsusFan.CPU) Logger.WriteLine("Custom fan scale: " + fanScale); if (fanScale != 100 && device == AsusFan.CPU) Logger.WriteLine("Custom fan scale: " + fanScale);
// it seems to be a bug, when some old model's bios can go nuts if fan is set to 100% if (AppConfig.IsSwappedFans())
{
device = (device == AsusFan.CPU) ? AsusFan.GPU : AsusFan.CPU;
Logger.WriteLine("Swapped fan fix");
}
for (int i = 8; i < curve.Length; i++) curve[i] = (byte)(Math.Max((byte)0, Math.Min((byte)100, curve[i])) * fanScale / 100); for (int i = 8; i < curve.Length; i++) curve[i] = (byte)(Math.Max((byte)0, Math.Min((byte)100, curve[i])) * fanScale / 100);
@@ -509,16 +514,25 @@ public class AsusACPI
default: fan_mode = 0; break; default: fan_mode = 0; break;
} }
byte[] result;
switch (device) switch (device)
{ {
case AsusFan.GPU: case AsusFan.GPU:
return DeviceGetBuffer(DevsGPUFanCurve, fan_mode); result = DeviceGetBuffer(DevsGPUFanCurve, fan_mode);
break;
case AsusFan.Mid: case AsusFan.Mid:
return DeviceGetBuffer(DevsMidFanCurve, fan_mode); result = DeviceGetBuffer(DevsMidFanCurve, fan_mode);
break;
default: default:
return DeviceGetBuffer(DevsCPUFanCurve, fan_mode); result = DeviceGetBuffer(DevsCPUFanCurve, fan_mode);
break;
} }
Logger.WriteLine($"GetFan {device} :" + BitConverter.ToString(result));
return result;
} }
public static bool IsInvalidCurve(byte[] curve) public static bool IsInvalidCurve(byte[] curve)
@@ -660,22 +674,32 @@ public class AsusACPI
} }
} }
public void ScanRange() public string ScanRange()
{ {
int value; int value;
string appPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\GHelper"; string appPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\GHelper";
string logFile = appPath + "\\scan.txt"; string logFile = appPath + "\\scan.txt";
for (uint i = 0x00000000; i <= 0x00160000; i++) using (StreamWriter w = File.AppendText(logFile))
{ {
value = DeviceGet(i); w.WriteLine($"Scan started {DateTime.Now}");
if (value >= 0) for (uint i = 0x00000000; i <= 0x00160000; i += 0x10000)
using (StreamWriter w = File.AppendText(logFile)) {
for (uint j = 0x00; j <= 0xFF; j++)
{ {
w.WriteLine(i.ToString("X8") + ": " + value.ToString("X4") + " (" + value + ")"); uint id = i + j;
w.Close(); value = DeviceGet(id);
if (value >= 0)
{
w.WriteLine(id.ToString("X8") + ": " + value.ToString("X4") + " (" + value + ")");
}
} }
}
w.WriteLine($"---------------------");
w.Close();
} }
return logFile;
} }
public void TUFKeyboardBrightness(int brightness) public void TUFKeyboardBrightness(int brightness)

19
app/Extra.Designer.cs generated
View File

@@ -120,6 +120,7 @@ namespace GHelper
comboAPU = new RComboBox(); comboAPU = new RComboBox();
pictureAPUMem = new PictureBox(); pictureAPUMem = new PictureBox();
labelAPUMem = new Label(); labelAPUMem = new Label();
pictureScan = new PictureBox();
panelServices.SuspendLayout(); panelServices.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureService).BeginInit(); ((System.ComponentModel.ISupportInitialize)pictureService).BeginInit();
panelBindingsHeader.SuspendLayout(); panelBindingsHeader.SuspendLayout();
@@ -144,6 +145,7 @@ namespace GHelper
((System.ComponentModel.ISupportInitialize)pictureHibernate).BeginInit(); ((System.ComponentModel.ISupportInitialize)pictureHibernate).BeginInit();
panelAPU.SuspendLayout(); panelAPU.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureAPUMem).BeginInit(); ((System.ComponentModel.ISupportInitialize)pictureAPUMem).BeginInit();
((System.ComponentModel.ISupportInitialize)pictureScan).BeginInit();
SuspendLayout(); SuspendLayout();
// //
// panelServices // panelServices
@@ -1003,6 +1005,7 @@ namespace GHelper
// //
panelSettingsHeader.AutoSize = true; panelSettingsHeader.AutoSize = true;
panelSettingsHeader.BackColor = SystemColors.ControlLight; panelSettingsHeader.BackColor = SystemColors.ControlLight;
panelSettingsHeader.Controls.Add(pictureScan);
panelSettingsHeader.Controls.Add(pictureLog); panelSettingsHeader.Controls.Add(pictureLog);
panelSettingsHeader.Controls.Add(pictureSettings); panelSettingsHeader.Controls.Add(pictureSettings);
panelSettingsHeader.Controls.Add(labelSettings); panelSettingsHeader.Controls.Add(labelSettings);
@@ -1263,6 +1266,20 @@ namespace GHelper
labelAPUMem.TabIndex = 0; labelAPUMem.TabIndex = 0;
labelAPUMem.Text = "Memory Assigned to GPU"; labelAPUMem.Text = "Memory Assigned to GPU";
// //
// pictureScan
//
pictureScan.Anchor = AnchorStyles.Top | AnchorStyles.Right;
pictureScan.BackgroundImage = Resources.icons8_heartbeat_32;
pictureScan.BackgroundImageLayout = ImageLayout.Zoom;
pictureScan.Cursor = Cursors.Hand;
pictureScan.Location = new Point(891, 11);
pictureScan.Margin = new Padding(4, 3, 4, 3);
pictureScan.Name = "pictureScan";
pictureScan.Size = new Size(32, 32);
pictureScan.TabIndex = 13;
pictureScan.TabStop = false;
pictureScan.Visible = false;
//
// Extra // Extra
// //
AutoScaleDimensions = new SizeF(192F, 192F); AutoScaleDimensions = new SizeF(192F, 192F);
@@ -1326,6 +1343,7 @@ namespace GHelper
panelAPU.ResumeLayout(false); panelAPU.ResumeLayout(false);
panelAPU.PerformLayout(); panelAPU.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureAPUMem).EndInit(); ((System.ComponentModel.ISupportInitialize)pictureAPUMem).EndInit();
((System.ComponentModel.ISupportInitialize)pictureScan).EndInit();
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();
} }
@@ -1420,5 +1438,6 @@ namespace GHelper
private PictureBox pictureAPUMem; private PictureBox pictureAPUMem;
private Label labelAPUMem; private Label labelAPUMem;
private RComboBox comboAPU; private RComboBox comboAPU;
private PictureBox pictureScan;
} }
} }

View File

@@ -386,6 +386,7 @@ namespace GHelper
buttonServices.Click += ButtonServices_Click; buttonServices.Click += ButtonServices_Click;
pictureLog.Click += PictureLog_Click; pictureLog.Click += PictureLog_Click;
pictureScan.Click += PictureScan_Click;
checkGPUFix.Visible = Program.acpi.IsNVidiaGPU(); checkGPUFix.Visible = Program.acpi.IsNVidiaGPU();
checkGPUFix.Checked = AppConfig.IsGPUFix(); checkGPUFix.Checked = AppConfig.IsGPUFix();
@@ -398,6 +399,18 @@ namespace GHelper
InitHibernate(); InitHibernate();
} }
private void PictureScan_Click(object? sender, EventArgs e)
{
string logFile = Program.acpi.ScanRange();
new Process
{
StartInfo = new ProcessStartInfo(logFile)
{
UseShellExecute = true
}
}.Start();
}
private void ComboAPU_SelectedIndexChanged(object? sender, EventArgs e) private void ComboAPU_SelectedIndexChanged(object? sender, EventArgs e)
{ {
int mem = comboAPU.SelectedIndex; int mem = comboAPU.SelectedIndex;

View File

@@ -953,7 +953,7 @@ namespace GHelper
int chartCount = 2; int chartCount = 2;
// Middle / system fan check // Middle / system fan check
if (!AsusACPI.IsEmptyCurve(Program.acpi.GetFanCurve(AsusFan.Mid))) if (!AsusACPI.IsEmptyCurve(Program.acpi.GetFanCurve(AsusFan.Mid)) || Program.acpi.GetFan(AsusFan.Mid) >= 0)
{ {
AppConfig.Set("mid_fan", 1); AppConfig.Set("mid_fan", 1);
chartCount++; chartCount++;

View File

@@ -15,7 +15,7 @@
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly> <ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<AssemblyVersion>0.152</AssemblyVersion> <AssemblyVersion>0.154</AssemblyVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

View File

@@ -30,7 +30,7 @@ public static class Logger
try try
{ {
var file = File.ReadAllLines(logFile); var file = File.ReadAllLines(logFile);
int skip = Math.Max(0, file.Count() - 1000); int skip = Math.Max(0, file.Count() - 2000);
File.WriteAllLines(logFile, file.Skip(skip).ToArray()); File.WriteAllLines(logFile, file.Skip(skip).ToArray());
} }
catch { } catch { }

View File

@@ -500,7 +500,7 @@ namespace GHelper.Input
case "micmute": case "micmute":
bool muteStatus = Audio.ToggleMute(); bool muteStatus = Audio.ToggleMute();
Program.toast.RunToast(muteStatus ? "Muted" : "Unmuted", muteStatus ? ToastIcon.MicrophoneMute : ToastIcon.Microphone); Program.toast.RunToast(muteStatus ? "Muted" : "Unmuted", muteStatus ? ToastIcon.MicrophoneMute : ToastIcon.Microphone);
if (AppConfig.IsVivobook()) Program.acpi.DeviceSet(AsusACPI.MICMUTE_LED, muteStatus ? 1 : 0, "MicmuteLed"); if (AppConfig.IsVivobook()) Program.acpi.DeviceSet(AsusACPI.MicMuteLed, muteStatus ? 1 : 0, "MicmuteLed");
break; break;
case "brightness_up": case "brightness_up":
SetBrightness(+10); SetBrightness(+10);
@@ -628,6 +628,9 @@ namespace GHelper.Input
{ {
switch (EventID) switch (EventID)
{ {
case 134: // FN + F12 ON OLD DEVICES
KeyProcess("m4");
return;
case 124: // M3 case 124: // M3
KeyProcess("m3"); KeyProcess("m3");
return; return;
@@ -638,7 +641,7 @@ namespace GHelper.Input
KeyProcess("m6"); KeyProcess("m6");
return; return;
case 136: // FN + F12 case 136: // FN + F12
Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.Airplane, "Airplane"); if (!AppConfig.IsNoAirplaneMode()) Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.Airplane, "Airplane");
return; return;
case 181: // FN + Numpad Enter case 181: // FN + Numpad Enter
KeyProcess("fne"); KeyProcess("fne");
@@ -706,6 +709,9 @@ namespace GHelper.Input
else else
Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.Brightness_Up, "Brightness"); Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.Brightness_Up, "Brightness");
break; break;
case 133: // Camera Toggle
ToggleCamera();
break;
case 107: // FN+F10 case 107: // FN+F10
ToggleTouchpadEvent(); ToggleTouchpadEvent();
break; break;
@@ -784,6 +790,36 @@ namespace GHelper.Input
Program.toast.RunToast($"Screen Pad " + (toggle == 1 ? "On" : "Off"), toggle > 0 ? ToastIcon.BrightnessUp : ToastIcon.BrightnessDown); Program.toast.RunToast($"Screen Pad " + (toggle == 1 ? "On" : "Off"), toggle > 0 ? ToastIcon.BrightnessUp : ToastIcon.BrightnessDown);
} }
public static void ToggleCamera()
{
if (!ProcessHelper.IsUserAdministrator()) return;
string CameraRegistryKeyPath = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\webcam";
string CameraRegistryValueName = "Value";
try
{
var status = (string?)Registry.GetValue(CameraRegistryKeyPath, CameraRegistryValueName, "");
if (status == "Allow") status = "Deny";
else if (status == "Deny") status = "Allow";
else
{
Logger.WriteLine("Unknown camera status");
return;
}
Registry.SetValue(CameraRegistryKeyPath, CameraRegistryValueName, status, RegistryValueKind.String);
Program.acpi.DeviceSet(AsusACPI.CameraLed, (status == "Deny" ? 1 : 0), "Camera");
Program.toast.RunToast($"Camera " + (status == "Deny" ? "Off" : "On"));
}
catch (Exception ex)
{
Logger.WriteLine(ex.ToString());
}
}
public static void SetScreenpad(int delta) public static void SetScreenpad(int delta)
{ {

View File

@@ -24,26 +24,30 @@ public sealed class KeyboardHook : IDisposable
public static void KeyPress(Keys key) public static void KeyPress(Keys key)
{ {
keybd_event((byte)key, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero); keybd_event((byte)key, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero);
Thread.Sleep(1);
keybd_event((byte)key, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, IntPtr.Zero);
} }
public static void KeyKeyPress(Keys key, Keys key2) public static void KeyKeyPress(Keys key, Keys key2)
{ {
keybd_event((byte)key, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero); keybd_event((byte)key, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero);
keybd_event((byte)key2, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero); keybd_event((byte)key2, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero);
Thread.Sleep(1);
keybd_event((byte)key2, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, IntPtr.Zero); keybd_event((byte)key2, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, IntPtr.Zero);
keybd_event((byte)key, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, IntPtr.Zero); keybd_event((byte)key, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, IntPtr.Zero);
} }
public static void KeyKeyKeyPress(Keys key, Keys key2, Keys key3, int sleep = 0) public static void KeyKeyKeyPress(Keys key, Keys key2, Keys key3, int sleep = 1)
{ {
keybd_event((byte)key, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero); keybd_event((byte)key, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero);
keybd_event((byte)key2, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero); keybd_event((byte)key2, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero);
keybd_event((byte)key3, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero); keybd_event((byte)key3, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero);
if (sleep > 0) Thread.Sleep(sleep);
{
Thread.Sleep(sleep);
}
keybd_event((byte)key3, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, IntPtr.Zero); keybd_event((byte)key3, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, IntPtr.Zero);
keybd_event((byte)key2, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, IntPtr.Zero); keybd_event((byte)key2, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, IntPtr.Zero);

View File

@@ -66,7 +66,7 @@ namespace GHelper.Input
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.WriteLine(ex.ToString()); Logger.WriteLine($"Listener exited: {ex.Message}");
} }
} }

View File

@@ -62,8 +62,8 @@ namespace GHelper
comboRotation.SelectedValueChanged += ComboRotation_SelectedValueChanged; ; comboRotation.SelectedValueChanged += ComboRotation_SelectedValueChanged; ;
uiScale = panelPicture.Width / matrixControl.device.MaxColumns / 3; uiScale = panelPicture.Width / matrixControl.deviceMatrix.MaxColumns / 3;
panelPicture.Height = (int)(matrixControl.device.MaxRows * uiScale); panelPicture.Height = (int)(matrixControl.deviceMatrix.MaxRows * uiScale);
} }

View File

@@ -229,7 +229,7 @@ namespace GHelper
BatteryControl.AutoBattery(init); BatteryControl.AutoBattery(init);
settingsForm.matrixControl.SetMatrix(true); settingsForm.matrixControl.SetDevice(true);
if (AppConfig.IsAlly()) if (AppConfig.IsAlly())
{ {
@@ -266,7 +266,7 @@ namespace GHelper
{ {
// If helper window is not on top, this just focuses on the app again // If helper window is not on top, this just focuses on the app again
// Pressing the ghelper button again will hide the app // Pressing the ghelper button again will hide the app
if (checkForFocus && !settingsForm.HasAnyFocus(trayClick)) if (checkForFocus && !settingsForm.HasAnyFocus(trayClick) && !AppConfig.Is("topmost"))
{ {
settingsForm.ShowAll(); settingsForm.ShowAll();
} }

View File

@@ -145,7 +145,7 @@
<value>¿Reiniciar ahora?</value> <value>¿Reiniciar ahora?</value>
</data> </data>
<data name="AllyController" xml:space="preserve"> <data name="AllyController" xml:space="preserve">
<value>Ally Controller</value> <value>Mando Ally</value>
</data> </data>
<data name="AnimationSpeed" xml:space="preserve"> <data name="AnimationSpeed" xml:space="preserve">
<value>Velocidad</value> <value>Velocidad</value>
@@ -274,13 +274,13 @@
<value>Cargar una vez al 100%</value> <value>Cargar una vez al 100%</value>
</data> </data>
<data name="Binding" xml:space="preserve"> <data name="Binding" xml:space="preserve">
<value>Binding</value> <value>Emparejado</value>
</data> </data>
<data name="BindingPrimary" xml:space="preserve"> <data name="BindingPrimary" xml:space="preserve">
<value>Primary</value> <value>Primario</value>
</data> </data>
<data name="BindingSecondary" xml:space="preserve"> <data name="BindingSecondary" xml:space="preserve">
<value>Secondary</value> <value>Secundario</value>
</data> </data>
<data name="BiosAndDriverUpdates" xml:space="preserve"> <data name="BiosAndDriverUpdates" xml:space="preserve">
<value>Actualizaciones de BIOS y Drivers</value> <value>Actualizaciones de BIOS y Drivers</value>
@@ -310,10 +310,10 @@
<value>Color</value> <value>Color</value>
</data> </data>
<data name="Contrast" xml:space="preserve"> <data name="Contrast" xml:space="preserve">
<value>Contrast</value> <value>Contraste</value>
</data> </data>
<data name="Controller" xml:space="preserve"> <data name="Controller" xml:space="preserve">
<value>Controller</value> <value>Mando</value>
</data> </data>
<data name="CPUBoost" xml:space="preserve"> <data name="CPUBoost" xml:space="preserve">
<value>CPU Boost</value> <value>CPU Boost</value>
@@ -328,7 +328,7 @@
<value>Por defecto</value> <value>Por defecto</value>
</data> </data>
<data name="DisableController" xml:space="preserve"> <data name="DisableController" xml:space="preserve">
<value>Disable Controller</value> <value>Deshabilitar mando</value>
</data> </data>
<data name="DisableOverdrive" xml:space="preserve"> <data name="DisableOverdrive" xml:space="preserve">
<value>Desactivar Overdrive</value> <value>Desactivar Overdrive</value>
@@ -349,7 +349,7 @@
<value>Eco</value> <value>Eco</value>
</data> </data>
<data name="EnableGPUOnShutdown" xml:space="preserve"> <data name="EnableGPUOnShutdown" xml:space="preserve">
<value>Enable GPU on shutdown (prevents issue with Eco mode)</value> <value>Habilitar GPU al apagar (evita problemas con el modo Eco)</value>
</data> </data>
<data name="EnableOptimusText" xml:space="preserve"> <data name="EnableOptimusText" xml:space="preserve">
<value>Deshabilitar la dGPU cambiando a modo Eco mientras el Modo de Pantalla en el Panel de Control de NVIDIA no está configurado en Optimus puede causar problemas con el control del brillo hasta después del próximo reinicio. <value>Deshabilitar la dGPU cambiando a modo Eco mientras el Modo de Pantalla en el Panel de Control de NVIDIA no está configurado en Optimus puede causar problemas con el control del brillo hasta después del próximo reinicio.
@@ -363,7 +363,7 @@
<value>Ajustes de energía</value> <value>Ajustes de energía</value>
</data> </data>
<data name="Export" xml:space="preserve"> <data name="Export" xml:space="preserve">
<value>Export Profile</value> <value>Exportar perfil</value>
</data> </data>
<data name="Extra" xml:space="preserve"> <data name="Extra" xml:space="preserve">
<value>Adicional</value> <value>Adicional</value>
@@ -438,10 +438,10 @@
<value>Alto</value> <value>Alto</value>
</data> </data>
<data name="ImageRotation" xml:space="preserve"> <data name="ImageRotation" xml:space="preserve">
<value>Image Rotation</value> <value>Rotación de imagen</value>
</data> </data>
<data name="Import" xml:space="preserve"> <data name="Import" xml:space="preserve">
<value>Import Profile</value> <value>Importar perfil</value>
</data> </data>
<data name="KeyBindings" xml:space="preserve"> <data name="KeyBindings" xml:space="preserve">
<value>Atajos de teclado</value> <value>Atajos de teclado</value>
@@ -477,10 +477,10 @@
<value>Bajo</value> <value>Bajo</value>
</data> </data>
<data name="LSDeadzones" xml:space="preserve"> <data name="LSDeadzones" xml:space="preserve">
<value>Left Stick Deadzones</value> <value>Punto muerto stick izquierdo</value>
</data> </data>
<data name="LTDeadzones" xml:space="preserve"> <data name="LTDeadzones" xml:space="preserve">
<value>Left Trigger Deadzones</value> <value>Punto muerto gatillo izquierdo</value>
</data> </data>
<data name="MatrixAudio" xml:space="preserve"> <data name="MatrixAudio" xml:space="preserve">
<value>Visualizador de audio</value> <value>Visualizador de audio</value>
@@ -531,7 +531,7 @@
<value>Respuesta del botón</value> <value>Respuesta del botón</value>
</data> </data>
<data name="MouseImportFailed" xml:space="preserve"> <data name="MouseImportFailed" xml:space="preserve">
<value>Import failed. Selected file is not a valid mouse profile or corrutpted.</value> <value>Importación fallida. El archivo seleccionado no es un perfil válido o está corrupto.</value>
</data> </data>
<data name="MouseLiftOffDistance" xml:space="preserve"> <data name="MouseLiftOffDistance" xml:space="preserve">
<value>Distancia de despegue (LOD)</value> <value>Distancia de despegue (LOD)</value>
@@ -618,7 +618,7 @@
<value>Quitar</value> <value>Quitar</value>
</data> </data>
<data name="Reset" xml:space="preserve"> <data name="Reset" xml:space="preserve">
<value>Reset</value> <value>Reiniciar</value>
</data> </data>
<data name="RestartGPU" xml:space="preserve"> <data name="RestartGPU" xml:space="preserve">
<value>Algo está usando la dGPU e impide el modo Eco. ¿Reiniciar dGPU en el administrador de dispositivos? (Proceda bajo su propio riesgo)</value> <value>Algo está usando la dGPU e impide el modo Eco. ¿Reiniciar dGPU en el administrador de dispositivos? (Proceda bajo su propio riesgo)</value>
@@ -627,16 +627,16 @@
<value>RPM</value> <value>RPM</value>
</data> </data>
<data name="RSDeadzones" xml:space="preserve"> <data name="RSDeadzones" xml:space="preserve">
<value>Right Stick Deadzones</value> <value>Punto muerto stick derecho</value>
</data> </data>
<data name="RTDeadzones" xml:space="preserve"> <data name="RTDeadzones" xml:space="preserve">
<value>Right Trigger Deadzones</value> <value>Punto muerto gatillo derecho</value>
</data> </data>
<data name="RunOnStartup" xml:space="preserve"> <data name="RunOnStartup" xml:space="preserve">
<value>Ejecutar al inicio</value> <value>Ejecutar al inicio</value>
</data> </data>
<data name="ScalingQuality" xml:space="preserve"> <data name="ScalingQuality" xml:space="preserve">
<value>Scaling Quality</value> <value>Calidad del escalado</value>
</data> </data>
<data name="ScreenPadDown" xml:space="preserve"> <data name="ScreenPadDown" xml:space="preserve">
<value>Bajar brillo ScreenPad</value> <value>Bajar brillo ScreenPad</value>
@@ -717,7 +717,7 @@
<value>Versión</value> <value>Versión</value>
</data> </data>
<data name="VibrationStrength" xml:space="preserve"> <data name="VibrationStrength" xml:space="preserve">
<value>Vibration Strength</value> <value>Intensidad de vibración</value>
</data> </data>
<data name="VolumeDown" xml:space="preserve"> <data name="VolumeDown" xml:space="preserve">
<value>Bajar volumen</value> <value>Bajar volumen</value>

View File

@@ -199,7 +199,7 @@
<value>Rapide</value> <value>Rapide</value>
</data> </data>
<data name="AuraLightingMode" xml:space="preserve"> <data name="AuraLightingMode" xml:space="preserve">
<value>Mode dÉclairage</value> <value>Effets d'éclairage</value>
</data> </data>
<data name="AuraNormal" xml:space="preserve"> <data name="AuraNormal" xml:space="preserve">
<value>Normal</value> <value>Normal</value>
@@ -235,7 +235,7 @@
<value>Molette</value> <value>Molette</value>
</data> </data>
<data name="AuraZoneUnderglow" xml:space="preserve"> <data name="AuraZoneUnderglow" xml:space="preserve">
<value>Underglow</value> <value>Led ROG</value>
</data> </data>
<data name="AutoApply" xml:space="preserve"> <data name="AutoApply" xml:space="preserve">
<value>Appliquer automatiquement</value> <value>Appliquer automatiquement</value>
@@ -363,7 +363,7 @@ Voulez-vous continuer ?</value>
<value>Paramètres d'énergie</value> <value>Paramètres d'énergie</value>
</data> </data>
<data name="Export" xml:space="preserve"> <data name="Export" xml:space="preserve">
<value>Exporter un profil</value> <value>Exporter profil</value>
</data> </data>
<data name="Extra" xml:space="preserve"> <data name="Extra" xml:space="preserve">
<value>+ d'options</value> <value>+ d'options</value>
@@ -441,7 +441,7 @@ Voulez-vous continuer ?</value>
<value>Rotation de l'image</value> <value>Rotation de l'image</value>
</data> </data>
<data name="Import" xml:space="preserve"> <data name="Import" xml:space="preserve">
<value>Importer un profil</value> <value>Importer profil</value>
</data> </data>
<data name="KeyBindings" xml:space="preserve"> <data name="KeyBindings" xml:space="preserve">
<value>Raccourcis clavier</value> <value>Raccourcis clavier</value>
@@ -522,7 +522,7 @@ Voulez-vous continuer ?</value>
<value>Minutes</value> <value>Minutes</value>
</data> </data>
<data name="MouseAngleSnapping" xml:space="preserve"> <data name="MouseAngleSnapping" xml:space="preserve">
<value>Angle Snapping</value> <value>Correction d'angle</value>
</data> </data>
<data name="MouseAutoPowerOff" xml:space="preserve"> <data name="MouseAutoPowerOff" xml:space="preserve">
<value>Arrêt automatique après</value> <value>Arrêt automatique après</value>
@@ -534,7 +534,7 @@ Voulez-vous continuer ?</value>
<value>Échec de l'importation. Le fichier sélectionné n'est pas un profil de souris valide ou corrompu.</value> <value>Échec de l'importation. Le fichier sélectionné n'est pas un profil de souris valide ou corrompu.</value>
</data> </data>
<data name="MouseLiftOffDistance" xml:space="preserve"> <data name="MouseLiftOffDistance" xml:space="preserve">
<value>Lift Off Distance</value> <value>Hauteur de détection</value>
</data> </data>
<data name="MouseLowBatteryWarning" xml:space="preserve"> <data name="MouseLowBatteryWarning" xml:space="preserve">
<value>Avertissement de batterie faible à</value> <value>Avertissement de batterie faible à</value>

View File

@@ -7,7 +7,6 @@
using GHelper.Helpers; using GHelper.Helpers;
using System.Management; using System.Management;
using System.Net; using System.Net;
using System.Reflection;
namespace Ryzen namespace Ryzen
{ {
@@ -23,7 +22,6 @@ namespace Ryzen
public static int MinTemp => AppConfig.Get("min_temp", 75); public static int MinTemp => AppConfig.Get("min_temp", 75);
public const int MaxTemp = 98; public const int MaxTemp = 98;
public static string[] FAM = { "RAVEN", "PICASSO", "DALI", "RENOIR/LUCIENNE", "MATISSE", "VANGOGH", "VERMEER", "CEZANNE/BARCELO", "REMBRANDT", "PHOENIX", "RAPHAEL/DRAGON RANGE" };
public static int FAMID { get; protected set; } public static int FAMID { get; protected set; }
public static string CPUModel = ""; public static string CPUModel = "";
@@ -42,6 +40,7 @@ namespace Ryzen
//PHEONIX - 9 //PHEONIX - 9
//RAPHAEL/DRAGON RANGE - 10 //RAPHAEL/DRAGON RANGE - 10
//MENDOCINO - 11 //MENDOCINO - 11
//HAWKPOINT - 12
public static void Init() public static void Init()
{ {
@@ -108,7 +107,7 @@ namespace Ryzen
FAMID = 8; //REMBRANDT FAMID = 8; //REMBRANDT
} }
if (CPUModel.Contains("Model " + Convert.ToString(116))) if (CPUModel.Contains("Model " + Convert.ToString(116)) || CPUModel.Contains("Model " + Convert.ToString(120)))
{ {
FAMID = 9; //PHEONIX FAMID = 9; //PHEONIX
} }
@@ -123,6 +122,11 @@ namespace Ryzen
FAMID = 11; //MENDOCINO FAMID = 11; //MENDOCINO
} }
if (CPUModel.Contains("Model " + Convert.ToString(117)))
{
FAMID = 12; //HAWKPOINT
}
Logger.WriteLine($"CPU: {FAMID} - {CPUName} - {CPUModel}"); Logger.WriteLine($"CPU: {FAMID} - {CPUName} - {CPUModel}");
SetAddresses(); SetAddresses();
@@ -224,7 +228,7 @@ namespace Ryzen
Smu.PSMU_ADDR_RSP = 0x3B10A80; Smu.PSMU_ADDR_RSP = 0x3B10A80;
Smu.PSMU_ADDR_ARG = 0x3B10A88; Smu.PSMU_ADDR_ARG = 0x3B10A88;
} }
else if (FAMID == 5 || FAMID == 8 || FAMID == 9 || FAMID == 11) else if (FAMID == 5 || FAMID == 8 || FAMID == 9 || FAMID == 11 || FAMID == 12)
{ {
Smu.MP1_ADDR_MSG = 0x3B10528; Smu.MP1_ADDR_MSG = 0x3B10528;
Smu.MP1_ADDR_RSP = 0x3B10578; Smu.MP1_ADDR_RSP = 0x3B10578;

View File

@@ -65,6 +65,7 @@ namespace GHelper
panelGPU = new Panel(); panelGPU = new Panel();
labelTipGPU = new Label(); labelTipGPU = new Label();
tableAMD = new TableLayoutPanel(); tableAMD = new TableLayoutPanel();
buttonOverlay = new RButton();
buttonFPS = new RButton(); buttonFPS = new RButton();
tableGPU = new TableLayoutPanel(); tableGPU = new TableLayoutPanel();
buttonStopGPU = new RButton(); buttonStopGPU = new RButton();
@@ -118,7 +119,7 @@ namespace GHelper
panelAllyTitle = new Panel(); panelAllyTitle = new Panel();
pictureAlly = new PictureBox(); pictureAlly = new PictureBox();
labelAlly = new Label(); labelAlly = new Label();
buttonOverlay = new RButton(); comboInterval = new RComboBox();
panelMatrix.SuspendLayout(); panelMatrix.SuspendLayout();
tableLayoutMatrix.SuspendLayout(); tableLayoutMatrix.SuspendLayout();
panelMatrixTitle.SuspendLayout(); panelMatrixTitle.SuspendLayout();
@@ -187,6 +188,7 @@ namespace GHelper
tableLayoutMatrix.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); tableLayoutMatrix.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
tableLayoutMatrix.Controls.Add(comboMatrix, 0, 0); tableLayoutMatrix.Controls.Add(comboMatrix, 0, 0);
tableLayoutMatrix.Controls.Add(comboMatrixRunning, 1, 0); tableLayoutMatrix.Controls.Add(comboMatrixRunning, 1, 0);
tableLayoutMatrix.Controls.Add(comboInterval, 2, 0);
tableLayoutMatrix.Controls.Add(buttonMatrix, 2, 0); tableLayoutMatrix.Controls.Add(buttonMatrix, 2, 0);
tableLayoutMatrix.Dock = DockStyle.Top; tableLayoutMatrix.Dock = DockStyle.Top;
tableLayoutMatrix.Location = new Point(20, 60); tableLayoutMatrix.Location = new Point(20, 60);
@@ -194,7 +196,8 @@ namespace GHelper
tableLayoutMatrix.Name = "tableLayoutMatrix"; tableLayoutMatrix.Name = "tableLayoutMatrix";
tableLayoutMatrix.RowCount = 1; tableLayoutMatrix.RowCount = 1;
tableLayoutMatrix.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); tableLayoutMatrix.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
tableLayoutMatrix.Size = new Size(787, 64); tableLayoutMatrix.RowStyles.Add(new RowStyle(SizeType.Absolute, 20F));
tableLayoutMatrix.Size = new Size(787, 84);
tableLayoutMatrix.TabIndex = 43; tableLayoutMatrix.TabIndex = 43;
// //
// comboMatrix // comboMatrix
@@ -707,6 +710,28 @@ namespace GHelper
tableAMD.TabIndex = 24; tableAMD.TabIndex = 24;
tableAMD.Visible = false; tableAMD.Visible = false;
// //
// buttonOverlay
//
buttonOverlay.Activated = false;
buttonOverlay.BackColor = SystemColors.ControlLightLight;
buttonOverlay.BorderColor = Color.Transparent;
buttonOverlay.BorderRadius = 5;
buttonOverlay.Dock = DockStyle.Fill;
buttonOverlay.FlatAppearance.BorderSize = 0;
buttonOverlay.FlatStyle = FlatStyle.Flat;
buttonOverlay.ForeColor = SystemColors.ControlText;
buttonOverlay.Image = Properties.Resources.icons8_heartbeat_32;
buttonOverlay.ImageAlign = ContentAlignment.MiddleRight;
buttonOverlay.Location = new Point(266, 4);
buttonOverlay.Margin = new Padding(4);
buttonOverlay.Name = "buttonOverlay";
buttonOverlay.Secondary = false;
buttonOverlay.Size = new Size(254, 72);
buttonOverlay.TabIndex = 12;
buttonOverlay.Text = "AMD Overlay";
buttonOverlay.TextImageRelation = TextImageRelation.ImageBeforeText;
buttonOverlay.UseVisualStyleBackColor = false;
//
// buttonFPS // buttonFPS
// //
buttonFPS.Activated = false; buttonFPS.Activated = false;
@@ -1586,27 +1611,20 @@ namespace GHelper
labelAlly.TabIndex = 26; labelAlly.TabIndex = 26;
labelAlly.Text = "Ally Controller"; labelAlly.Text = "Ally Controller";
// //
// buttonOverlay // comboInterval
// //
buttonOverlay.Activated = false; comboInterval.BorderColor = Color.White;
buttonOverlay.BackColor = SystemColors.ControlLightLight; comboInterval.ButtonColor = Color.FromArgb(255, 255, 255);
buttonOverlay.BorderColor = Color.Transparent; comboInterval.Dock = DockStyle.Top;
buttonOverlay.BorderRadius = 5; comboInterval.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
buttonOverlay.Dock = DockStyle.Fill; comboInterval.FormattingEnabled = true;
buttonOverlay.FlatAppearance.BorderSize = 0; comboInterval.ItemHeight = 32;
buttonOverlay.FlatStyle = FlatStyle.Flat; comboInterval.Location = new Point(7, 75);
buttonOverlay.ForeColor = SystemColors.ControlText; comboInterval.Margin = new Padding(7, 11, 7, 8);
buttonOverlay.Image = Properties.Resources.icons8_heartbeat_32; comboInterval.Name = "comboInterval";
buttonOverlay.ImageAlign = ContentAlignment.MiddleRight; comboInterval.Size = new Size(248, 40);
buttonOverlay.Location = new Point(266, 4); comboInterval.TabIndex = 19;
buttonOverlay.Margin = new Padding(4); comboInterval.Visible = false;
buttonOverlay.Name = "buttonOverlay";
buttonOverlay.Secondary = false;
buttonOverlay.Size = new Size(254, 72);
buttonOverlay.TabIndex = 12;
buttonOverlay.Text = "AMD Overlay";
buttonOverlay.TextImageRelation = TextImageRelation.ImageBeforeText;
buttonOverlay.UseVisualStyleBackColor = false;
// //
// SettingsForm // SettingsForm
// //
@@ -1784,5 +1802,6 @@ namespace GHelper
private RButton buttonFPS; private RButton buttonFPS;
private RButton buttonController; private RButton buttonController;
private RButton buttonOverlay; private RButton buttonOverlay;
private RComboBox comboInterval;
} }
} }

View File

@@ -173,9 +173,11 @@ namespace GHelper
comboMatrix.DropDownStyle = ComboBoxStyle.DropDownList; comboMatrix.DropDownStyle = ComboBoxStyle.DropDownList;
comboMatrixRunning.DropDownStyle = ComboBoxStyle.DropDownList; comboMatrixRunning.DropDownStyle = ComboBoxStyle.DropDownList;
comboInterval.DropDownStyle = ComboBoxStyle.DropDownList;
comboMatrix.DropDownClosed += ComboMatrix_SelectedValueChanged; comboMatrix.DropDownClosed += ComboMatrix_SelectedValueChanged;
comboMatrixRunning.DropDownClosed += ComboMatrixRunning_SelectedValueChanged; comboMatrixRunning.DropDownClosed += ComboMatrixRunning_SelectedValueChanged;
comboInterval.DropDownClosed += ComboInterval_DropDownClosed;
buttonMatrix.Click += ButtonMatrix_Click; buttonMatrix.Click += ButtonMatrix_Click;
@@ -424,7 +426,7 @@ namespace GHelper
} }
} }
public void VisualiseMatrix(string image) public void VisualiseMatrixPicture(string image)
{ {
if (matrixForm == null || matrixForm.Text == "") return; if (matrixForm == null || matrixForm.Text == "") return;
matrixForm.VisualiseMatrix(image); matrixForm.VisualiseMatrix(image);
@@ -686,7 +688,7 @@ namespace GHelper
private void CheckMatrix_CheckedChanged(object? sender, EventArgs e) private void CheckMatrix_CheckedChanged(object? sender, EventArgs e)
{ {
AppConfig.Set("matrix_auto", checkMatrix.Checked ? 1 : 0); AppConfig.Set("matrix_auto", checkMatrix.Checked ? 1 : 0);
matrixControl.SetMatrix(); matrixControl.SetBatteryAuto();
} }
@@ -712,7 +714,7 @@ namespace GHelper
} }
public void SetMatrixRunning(int mode) public void VisualiseMatrixRunning(int mode)
{ {
Invoke(delegate Invoke(delegate
{ {
@@ -721,17 +723,23 @@ namespace GHelper
}); });
} }
private void ComboInterval_DropDownClosed(object? sender, EventArgs e)
{
AppConfig.Set("matrix_interval", comboInterval.SelectedIndex);
matrixControl.SetDevice();
}
private void ComboMatrixRunning_SelectedValueChanged(object? sender, EventArgs e) private void ComboMatrixRunning_SelectedValueChanged(object? sender, EventArgs e)
{ {
AppConfig.Set("matrix_running", comboMatrixRunning.SelectedIndex); AppConfig.Set("matrix_running", comboMatrixRunning.SelectedIndex);
matrixControl.SetMatrix(); matrixControl.SetDevice();
} }
private void ComboMatrix_SelectedValueChanged(object? sender, EventArgs e) private void ComboMatrix_SelectedValueChanged(object? sender, EventArgs e)
{ {
AppConfig.Set("matrix_brightness", comboMatrix.SelectedIndex); AppConfig.Set("matrix_brightness", comboMatrix.SelectedIndex);
matrixControl.SetMatrix(); matrixControl.SetDevice();
} }
@@ -896,8 +904,26 @@ namespace GHelper
return; return;
} }
if (matrixControl.IsSlash)
{
labelMatrix.Text = "Slash Lightning";
comboMatrixRunning.Items.Clear();
foreach (var item in SlashDevice.Modes)
{
comboMatrixRunning.Items.Add(item.Value);
}
comboInterval.Visible = true;
comboInterval.Items.Add($"Interval Off");
for (int i = 1; i <= 5; i++) comboInterval.Items.Add($"Interval {i}s");
buttonMatrix.Visible = false;
}
comboMatrix.SelectedIndex = Math.Min(AppConfig.Get("matrix_brightness", 0), comboMatrix.Items.Count - 1); comboMatrix.SelectedIndex = Math.Min(AppConfig.Get("matrix_brightness", 0), comboMatrix.Items.Count - 1);
comboMatrixRunning.SelectedIndex = Math.Min(AppConfig.Get("matrix_running", 0), comboMatrixRunning.Items.Count - 1); comboMatrixRunning.SelectedIndex = Math.Min(AppConfig.Get("matrix_running", 0), comboMatrixRunning.Items.Count - 1);
comboInterval.SelectedIndex = Math.Min(AppConfig.Get("matrix_interval", 0), comboInterval.Items.Count - 1);
checkMatrix.Checked = AppConfig.Is("matrix_auto"); checkMatrix.Checked = AppConfig.Is("matrix_auto");
checkMatrix.CheckedChanged += CheckMatrix_CheckedChanged; checkMatrix.CheckedChanged += CheckMatrix_CheckedChanged;
@@ -909,7 +935,7 @@ namespace GHelper
{ {
comboMatrix.SelectedIndex = Math.Min(Math.Max(0, comboMatrix.SelectedIndex + delta), comboMatrix.Items.Count - 1); comboMatrix.SelectedIndex = Math.Min(Math.Max(0, comboMatrix.SelectedIndex + delta), comboMatrix.Items.Count - 1);
AppConfig.Set("matrix_brightness", comboMatrix.SelectedIndex); AppConfig.Set("matrix_brightness", comboMatrix.SelectedIndex);
matrixControl.SetMatrix(); matrixControl.SetDevice();
Program.toast.RunToast(comboMatrix.GetItemText(comboMatrix.SelectedItem), delta > 0 ? ToastIcon.BacklightUp : ToastIcon.BacklightDown); Program.toast.RunToast(comboMatrix.GetItemText(comboMatrix.SelectedItem), delta > 0 ? ToastIcon.BacklightUp : ToastIcon.BacklightDown);
} }

View File

@@ -34,6 +34,7 @@ namespace GHelper.UI
{ {
var parms = base.CreateParams; var parms = base.CreateParams;
parms.Style &= ~0x02000000; // Turn off WS_CLIPCHILDREN parms.Style &= ~0x02000000; // Turn off WS_CLIPCHILDREN
parms.ClassStyle &= ~0x00020000;
return parms; return parms;
} }
} }

View File

@@ -90,18 +90,24 @@ public static class AsusHid
if (devices is null) return; if (devices is null) return;
foreach (var device in devices) foreach (var device in devices)
using (var stream = device.Open()) try
foreach (var data in dataList) {
try using (var stream = device.Open())
{ foreach (var data in dataList)
stream.Write(data); try
Logger.WriteLine($"{log} {device.ProductID.ToString("X")}: {BitConverter.ToString(data)}"); {
} stream.Write(data);
catch (Exception ex) Logger.WriteLine($"{log} {device.ProductID.ToString("X")}: {BitConverter.ToString(data)}");
{ }
Logger.WriteLine($"Error writing {log} {device.ProductID.ToString("X")}: {ex.Message} {BitConverter.ToString(data)} "); catch (Exception ex)
} {
Logger.WriteLine($"Error writing {log} {device.ProductID.ToString("X")}: {ex.Message} {BitConverter.ToString(data)} ");
}
}
catch (Exception ex)
{
Logger.WriteLine($"Error opening {log} {device.ProductID.ToString("X")}: {ex.Message}");
}
} }
public static void WriteAura(byte[] data) public static void WriteAura(byte[] data)

View File

@@ -73,6 +73,9 @@ namespace GHelper.USB
private static AuraMode mode = AuraMode.AuraStatic; private static AuraMode mode = AuraMode.AuraStatic;
private static AuraSpeed speed = AuraSpeed.Normal; private static AuraSpeed speed = AuraSpeed.Normal;
private static bool backlight = false;
private static bool initDirect = false;
public static Color Color1 = Color.White; public static Color Color1 = Color.White;
public static Color Color2 = Color.Black; public static Color Color2 = Color.Black;
@@ -289,17 +292,27 @@ namespace GHelper.USB
public static void ApplyBrightness(int brightness, string log = "Backlight", bool delay = false) public static void ApplyBrightness(int brightness, string log = "Backlight", bool delay = false)
{ {
if (brightness == 0) backlight = false;
Task.Run(async () => Task.Run(async () =>
{ {
if (delay) await Task.Delay(TimeSpan.FromSeconds(1)); if (delay) await Task.Delay(TimeSpan.FromSeconds(1));
if (isACPI) Program.acpi.TUFKeyboardBrightness(brightness); if (isACPI) Program.acpi.TUFKeyboardBrightness(brightness);
AsusHid.Write(new byte[] { AsusHid.AURA_ID, 0xBA, 0xC5, 0xC4, (byte)brightness }, log); if (AppConfig.IsInputBacklight())
AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xBA, 0xC5, 0xC4, (byte)brightness }, log);
else
AsusHid.Write(new byte[] { AsusHid.AURA_ID, 0xBA, 0xC5, 0xC4, (byte)brightness }, log);
if (AppConfig.IsAlly()) ApplyAura(); if (AppConfig.IsAlly()) ApplyAura();
if (AppConfig.ContainsModel("GA503")) if (brightness > 0)
AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xBA, 0xC5, 0xC4, (byte)brightness }, log); {
if (!backlight) initDirect = true;
backlight = true;
}
}); });
@@ -493,6 +506,8 @@ namespace GHelper.USB
public static void ApplyDirect(Color[] color, bool init = false) public static void ApplyDirect(Color[] color, bool init = false)
{ {
if (!backlight) return;
const byte keySet = 167; const byte keySet = 167;
const byte ledCount = 178; const byte ledCount = 178;
const ushort mapSize = 3 * ledCount; const ushort mapSize = 3 * ledCount;
@@ -510,9 +525,9 @@ namespace GHelper.USB
buffer[6] = 0; buffer[6] = 0;
buffer[7] = 0x10; buffer[7] = 0x10;
if (init) if (init || initDirect)
{ {
Init(); initDirect = false;
AsusHid.WriteAura(new byte[] { AsusHid.AURA_ID, 0xBC }); AsusHid.WriteAura(new byte[] { AsusHid.AURA_ID, 0xBC });
} }
@@ -573,6 +588,8 @@ namespace GHelper.USB
public static void ApplyDirect(Color color, bool init = false) public static void ApplyDirect(Color color, bool init = false)
{ {
if (!backlight) return;
if (isACPI) if (isACPI)
{ {
Program.acpi.TUFKeyboardRGB(0, color, 0, null); Program.acpi.TUFKeyboardRGB(0, color, 0, null);
@@ -591,9 +608,9 @@ namespace GHelper.USB
return; return;
} }
if (init) if (init || initDirect)
{ {
//Init(); initDirect = false;
AsusHid.WriteAura(new byte[] { AsusHid.AURA_ID, 0xbc, 1 }); AsusHid.WriteAura(new byte[] { AsusHid.AURA_ID, 0xbc, 1 });
} }
@@ -720,6 +737,8 @@ namespace GHelper.USB
public static void ApplyAmbient(bool init = false) public static void ApplyAmbient(bool init = false)
{ {
if (!backlight) return;
var bound = Screen.GetBounds(Point.Empty); var bound = Screen.GetBounds(Point.Empty);
bound.Y += bound.Height / 3; bound.Y += bound.Height / 3;
bound.Height -= (int)Math.Round(bound.Height * (0.33f + 0.022f)); // cut 1/3 of the top screen + windows panel bound.Height -= (int)Math.Round(bound.Height * (0.33f + 0.022f)); // cut 1/3 of the top screen + windows panel

View File

@@ -112,7 +112,7 @@ Huge thanks to [@IceStormNG](https://github.com/IceStormNG) 👑 for contributio
- ``Ctrl + M1 / M2`` - Screen brightness Down / Up - ``Ctrl + M1 / M2`` - Screen brightness Down / Up
- ``Shift + M1 / M2`` - Backlight brightness Down / Up - ``Shift + M1 / M2`` - Backlight brightness Down / Up
- ``Fn + C`` - Fn-Lock - ``Fn + C`` - Fn-Lock
- ``Fn + Shift + F7 / F8`` - Matrix brightness Down / Up - ``Fn + Shift + F7 / F8`` - Matrix / Slash Lightning brightness Down / Up
- ``Fn + Shift + F7 / F8`` - Screenpad brightness Down / Up - ``Fn + Shift + F7 / F8`` - Screenpad brightness Down / Up
- ``Ctrl + Shift + F20`` - Mute Microphone - ``Ctrl + Shift + F20`` - Mute Microphone
- ``Ctrl + Shift + Alt + F14`` - Eco GPU Mode - ``Ctrl + Shift + Alt + F14`` - Eco GPU Mode