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(); 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; labelBindings.Text = Properties.Strings.KeyBindings;
labelBacklightTitle.Text = Properties.Strings.LaptopBacklight; labelBacklightTitle.Text = Properties.Strings.LaptopBacklight;
labelSettings.Text = Properties.Strings.Other; labelSettings.Text = Properties.Strings.Other;

View File

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