mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
More slash modes
This commit is contained in:
@@ -36,7 +36,7 @@ namespace GHelper.AnimeMatrix
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (AppConfig.ContainsModel("GA403"))
|
if (AppConfig.ContainsModel("GA403") || AppConfig.ContainsModel("GU605"))
|
||||||
deviceSlash = new SlashDevice();
|
deviceSlash = new SlashDevice();
|
||||||
else
|
else
|
||||||
deviceMatrix = new AnimeMatrixDevice();
|
deviceMatrix = new AnimeMatrixDevice();
|
||||||
@@ -85,7 +85,7 @@ namespace GHelper.AnimeMatrix
|
|||||||
if (brightness == 0 || (auto && SystemInformation.PowerStatus.PowerLineStatus != PowerLineStatus.Online))
|
if (brightness == 0 || (auto && SystemInformation.PowerStatus.PowerLineStatus != PowerLineStatus.Online))
|
||||||
{
|
{
|
||||||
deviceSlash.Init();
|
deviceSlash.Init();
|
||||||
deviceSlash.SetOptions(false);
|
deviceSlash.SetOptions(false, 0, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -97,6 +97,12 @@ namespace GHelper.AnimeMatrix
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,26 @@
|
|||||||
using GHelper.AnimeMatrix.Communication;
|
using GHelper.AnimeMatrix.Communication;
|
||||||
|
using GHelper.Mode;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace GHelper.AnimeMatrix
|
namespace GHelper.AnimeMatrix
|
||||||
{
|
{
|
||||||
public enum SlashMode
|
public enum SlashMode
|
||||||
{
|
{
|
||||||
|
Bounce,
|
||||||
|
Slash,
|
||||||
|
Loading,
|
||||||
|
BitStream,
|
||||||
Transmission,
|
Transmission,
|
||||||
Bitstream
|
Flow,
|
||||||
|
Flux,
|
||||||
|
Phantom,
|
||||||
|
Spectrum,
|
||||||
|
Hazard,
|
||||||
|
Interfacing,
|
||||||
|
Ramp,
|
||||||
|
GameOver,
|
||||||
|
Start,
|
||||||
|
Buzzer
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class SlashPacket : Packet
|
internal class SlashPacket : Packet
|
||||||
@@ -18,6 +32,53 @@ namespace GHelper.AnimeMatrix
|
|||||||
|
|
||||||
public class SlashDevice : Device
|
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 SlashDevice() : base(0x0B05, 0x193B, 128)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -40,15 +101,30 @@ namespace GHelper.AnimeMatrix
|
|||||||
|
|
||||||
public void SetMode(SlashMode mode)
|
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>(0xD2, 0x03, 0x00, 0x0C));
|
||||||
Set(Packet<SlashPacket>(0xD3, 0x04, 0x00, 0x0C, 0x01, (mode == SlashMode.Bitstream) ? (byte)0x1D : (byte)0x1A, 0x02, 0x19, 0x03, 0x13, 0x04, 0x11, 0x05, 0x12, 0x06, 0x13));
|
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)
|
public void SetOptions(bool status, int brightness = 0, int interval = 0)
|
||||||
{
|
{
|
||||||
byte brightnessByte = (byte)(brightness * 85.333);
|
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));
|
Set(Packet<SlashPacket>(0xD3, 0x03, 0x01, 0x08, 0xAB, 0xFF, 0x01, status ? (byte)0x01 : (byte)0x00, 0x06, brightnessByte, 0xFF, (byte)interval));
|
||||||
Save();
|
}
|
||||||
|
|
||||||
|
public void SetBatterySaver(bool status)
|
||||||
|
{
|
||||||
|
Set(Packet<SlashPacket>(0xD8, 0x01, 0x00, 0x01, status ? (byte)0x80 : (byte)0x00));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Set(Packet packet)
|
public void Set(Packet packet)
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ public static class AppConfig
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (_model.Contains("GA402")) _model = "ROG Zephyrus G14 GA403UI"; // Debug Purposes
|
if (_model.Contains("GA402")) _model = "ROG Zephyrus G14 GA403UI"; // Debug Purposes
|
||||||
|
|
||||||
return _model;
|
return _model;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -688,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.SetDevice();
|
matrixControl.SetBatteryAuto();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -908,8 +908,11 @@ namespace GHelper
|
|||||||
{
|
{
|
||||||
labelMatrix.Text = "Slash Lightning";
|
labelMatrix.Text = "Slash Lightning";
|
||||||
comboMatrixRunning.Items.Clear();
|
comboMatrixRunning.Items.Clear();
|
||||||
comboMatrixRunning.Items.Add("Transmission");
|
|
||||||
comboMatrixRunning.Items.Add("Bit Stream");
|
foreach (var item in SlashDevice.Modes)
|
||||||
|
{
|
||||||
|
comboMatrixRunning.Items.Add(item.Value);
|
||||||
|
}
|
||||||
|
|
||||||
comboInterval.Visible = true;
|
comboInterval.Visible = true;
|
||||||
comboInterval.Items.Add($"Interval Off");
|
comboInterval.Items.Add($"Interval Off");
|
||||||
|
|||||||
@@ -294,12 +294,10 @@ namespace GHelper.USB
|
|||||||
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);
|
AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xBA, 0xC5, 0xC4, (byte)brightness }, log);
|
||||||
|
|
||||||
if (AppConfig.IsAlly()) ApplyAura();
|
if (AppConfig.IsAlly()) ApplyAura();
|
||||||
|
|
||||||
if (AppConfig.IsInputBacklight())
|
|
||||||
AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xBA, 0xC5, 0xC4, (byte)brightness }, log);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user