add as much button support as we can to the RC71 (ROG Ally)

This commit is contained in:
Kate Temkin
2023-08-02 20:44:09 -06:00
parent 662d5fb414
commit 8d9999c6c7
3 changed files with 369 additions and 316 deletions

555
app/Extra.Designer.cs generated

File diff suppressed because it is too large Load Diff

View File

@@ -90,6 +90,31 @@ namespace GHelper
{
InitializeComponent();
// Change text and hide irrelevant options on the ROG Ally,
// which is a bit of a special case piece of hardware.
if (AppConfig.ContainsModel("RC71"))
{
// The back paddles both seem to issue the same code;
// so we'll replace "M1/M2" with one field, for now.
// (Eventually, we should learn how Asus' software tells the difference.)
labelM1.Text = "Back Paddles";
labelM2.Visible = false;
comboM2.Visible = false;
textM2.Visible = false;
// Re-label M3 and M4 to match the front labels.
labelM3.Text = "Ctrl Center";
labelM4.Text = "ROG";
// Hide all of the FN options, as the Ally has no special keyboard FN key.
labelFNC.Visible = false;
comboFNC.Visible = false;
textFNC.Visible = false;
labelFNF4.Visible = false;
comboFNF4.Visible = false;
textFNF4.Visible = false;
}
labelBindings.Text = Properties.Strings.KeyBindings;
labelBacklightTitle.Text = Properties.Strings.LaptopBacklight;
labelSettings.Text = Properties.Strings.Other;

View File

@@ -428,45 +428,74 @@ namespace GHelper.Input
static void HandleEvent(int EventID)
{
switch (EventID)
// The ROG Ally uses different M-key codes.
// We'll special-case the translation of those.
if (AppConfig.ContainsModel("RC71"))
{
case 124: // M3
KeyProcess("m3");
return;
case 56: // M4 / Rog button
KeyProcess("m4");
return;
case 181: // FN + Numpad Enter
KeyProcess("fne");
return;
case 174: // FN+F5
modeControl.CyclePerformanceMode();
return;
case 179: // FN+F4
case 178: // FN+F4
KeyProcess("fnf4");
return;
case 158: // Fn + C
KeyProcess("fnc");
return;
case 78: // Fn + ESC
ToggleFnLock();
return;
case 189: // Tablet mode
TabletMode();
return;
case 197: // FN+F2
SetBacklight(-1);
return;
case 196: // FN+F3
SetBacklight(1);
return;
case 199: // ON Z13 - FN+F11 - cycles backlight
SetBacklight(4);
return;
case 53: // FN+F6 on GA-502DU model
NativeMethods.TurnOffScreen(Program.settingsForm.Handle);
return;
switch(EventID)
{
// This is both the M1 and M2 keys.
// There's a way to differentiate, apparently, but it isn't over USB or any other obvious protocol.
case 165:
KeyProcess("m1");
return;
// The Command Center ("play-looking") button below the select key.
// We'll call this M3.
case 166:
KeyProcess("m3");
return;
// The M4/ROG key.
case 56:
KeyProcess("m4");
return;
}
}
// All other devices seem to use the same HID key-codes,
// so we can process them all the same.
else
{
switch (EventID)
{
case 124: // M3
KeyProcess("m3");
return;
case 56: // M4 / Rog button
KeyProcess("m4");
return;
case 181: // FN + Numpad Enter
KeyProcess("fne");
return;
case 174: // FN+F5
modeControl.CyclePerformanceMode();
return;
case 179: // FN+F4
case 178: // FN+F4
KeyProcess("fnf4");
return;
case 158: // Fn + C
KeyProcess("fnc");
return;
case 78: // Fn + ESC
ToggleFnLock();
return;
case 189: // Tablet mode
TabletMode();
return;
case 197: // FN+F2
SetBacklight(-1);
return;
case 196: // FN+F3
SetBacklight(1);
return;
case 199: // ON Z13 - FN+F11 - cycles backlight
SetBacklight(4);
return;
case 53: // FN+F6 on GA-502DU model
NativeMethods.TurnOffScreen(Program.settingsForm.Handle);
return;
}
}
if (!OptimizationService.IsRunning())