Skip to content

Commit 819e365

Browse files
no more arrow issues
1 parent 648e5f5 commit 819e365

1 file changed

Lines changed: 34 additions & 31 deletions

File tree

AuthFix/AuthPlugin.cs

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,26 @@ public partial class AuthPlugin : BasePlugin
4545

4646
internal static bool UseKeyboardMode => Instance?.KeyboardMode?.Value ?? _useKeyboard;
4747

48+
private static void ForceKeyboardMode()
49+
{
50+
var oldType = ActiveInputManager.currentControlType;
51+
ActiveInputManager.currentControlType = ActiveInputManager.InputType.Keyboard;
52+
53+
if (HudManager.InstanceExists)
54+
{
55+
var joystick = HudManager.Instance.joystick;
56+
if (joystick == null || joystick.TryCast<KeyboardJoystick> == null)
57+
{
58+
HudManager.Instance.SetTouchType(ControlTypes.Keyboard);
59+
}
60+
}
61+
62+
if (oldType != ActiveInputManager.InputType.Keyboard)
63+
{
64+
ActiveInputManager.CurrentInputSourceChanged?.Invoke();
65+
}
66+
}
67+
4868
public static string GetLobby()
4969
{
5070
return Marshal.PtrToStringUTF8(get_lobby()) ?? string.Empty;
@@ -212,6 +232,12 @@ public static bool Prefix()
212232
return true;
213233
}
214234

235+
if (ActiveInputManager.Instance != null && ActiveInputManager.Instance.lastUsedController != null)
236+
{
237+
ActiveInputManager.Instance.lastUsedController = null;
238+
}
239+
240+
ForceKeyboardMode();
215241
return false;
216242
}
217243
}
@@ -226,15 +252,12 @@ public static bool Prefix()
226252
return true;
227253
}
228254

229-
ActiveInputManager.InputType inputType = ActiveInputManager.InputType.Keyboard;
230-
if (inputType != ActiveInputManager.currentControlType)
255+
if (ActiveInputManager.Instance != null && ActiveInputManager.Instance.lastUsedController != null)
231256
{
232-
ActiveInputManager.CurrentInputSourceChanged?.Invoke();
233-
if (HudManager.InstanceExists)
234-
{
235-
HudManager.Instance.SetTouchType(ControlTypes.Keyboard);
236-
}
257+
ActiveInputManager.Instance.lastUsedController = null;
237258
}
259+
260+
ForceKeyboardMode();
238261
return false;
239262
}
240263
}
@@ -274,12 +297,7 @@ static class ConsoleJoystick_SetMapEnabledPatch
274297
{
275298
public static bool Prefix()
276299
{
277-
if (!UseKeyboardMode)
278-
{
279-
return true;
280-
}
281-
282-
return false;
300+
return true;
283301
}
284302
}
285303

@@ -288,12 +306,7 @@ static class ConsoleJoystick_UpdatePatch
288306
{
289307
public static bool Prefix()
290308
{
291-
if (!UseKeyboardMode)
292-
{
293-
return true;
294-
}
295-
296-
return false;
309+
return true;
297310
}
298311
}
299312

@@ -302,12 +315,7 @@ static class ControllerManager_UpdatePatch
302315
{
303316
public static bool Prefix()
304317
{
305-
if (!UseKeyboardMode)
306-
{
307-
return true;
308-
}
309-
310-
return false;
318+
return true;
311319
}
312320
}
313321

@@ -316,12 +324,7 @@ static class VirtualCursor_UpdatePatch
316324
{
317325
public static bool Prefix()
318326
{
319-
if (!UseKeyboardMode)
320-
{
321-
return true;
322-
}
323-
324-
return false;
327+
return true;
325328
}
326329
}
327330

0 commit comments

Comments
 (0)