From 0aba2e4d0da90c94c1430e5db6479153758e04a5 Mon Sep 17 00:00:00 2001 From: ck5285 Date: Wed, 13 May 2026 11:40:24 -0700 Subject: [PATCH] fix(scaleform): update instructional button glyphs on input device change Fixes #167. - `InstructionalButton.Raw` cached the glyph string in the struct's `raw` field at construction time, so once a menu was built the buttons kept the glyph for whichever input device was active at that moment and never switched when the player swapped between keyboard/mouse and a controller. - The native `GET_CONTROL_INSTRUCTIONAL_BUTTONS_STRING(2, control, 1)` returns the glyph for the currently active input device, so the `Raw` getter now re-queries it on every access when the button was created from a `Control`. Buttons constructed from a raw string (sentinel `control == -1`) are unaffected and still return the cached value. --- LemonUI/Scaleform/InstructionalButton.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/LemonUI/Scaleform/InstructionalButton.cs b/LemonUI/Scaleform/InstructionalButton.cs index 751b15a..7f86948 100644 --- a/LemonUI/Scaleform/InstructionalButton.cs +++ b/LemonUI/Scaleform/InstructionalButton.cs @@ -67,7 +67,24 @@ public Control Control /// public string Raw { - get => raw; + get + { + if ((int)control == -1) + { + return raw; + } +#if FIVEM + return API.GetControlInstructionalButton(2, (int)control, 1); +#elif RAGEMP + return Invoker.Invoke(Natives.GetControlInstructionalButton, 2, (int)control, 1); +#elif RPH + return (string)NativeFunction.CallByHash(0x0499D7B09FC9B407, typeof(string), 2, (int)control, 1); +#elif SHVDN3 || SHVDNC + return Function.Call(Hash.GET_CONTROL_INSTRUCTIONAL_BUTTONS_STRING, 2, (int)control, 1); +#elif ALTV + return Alt.Natives.GetControlInstructionalButtonsString(2, (int)control, true); +#endif + } set { raw = value ?? throw new ArgumentNullException(nameof(value));