Skip to content
This repository was archived by the owner on Jan 1, 2025. It is now read-only.

Commit ed91e7d

Browse files
authored
Mod menu keybind tweaks (#66)
1 parent 4fcb606 commit ed91e7d

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

Mods/ModMenuManager.py

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,30 @@ def HookShopInputKey(caller: UObject, function: UFunction, params: FStruct) -> b
5454
key = params.ukey
5555
event = params.uevent
5656

57-
if key in ["Escape", "Up", "Down"]:
57+
ControllerKeyMap = {
58+
"Gamepad_LeftStick_Up": "Up",
59+
"Gamepad_LeftStick_Down": "Down",
60+
"XboxTypeS_A": "Enter",
61+
"XboxTypeS_B": "Escape",
62+
"XboxTypeS_Y": "Q",
63+
"XboxTypeS_LeftTrigger": "PageUp",
64+
"XboxTypeS_RightTrigger": "PageDown"
65+
}
66+
if key in ControllerKeyMap:
67+
key = ControllerKeyMap[key]
68+
69+
if key in ("Escape", "Up", "Down"):
5870
return True
5971

72+
if event == 0 or event == 2:
73+
# These two are bugged on gearbox's end, we manually fix them
74+
if key == "PageUp":
75+
caller.ScrollDescription(True)
76+
return False
77+
elif key == "PageDown":
78+
caller.ScrollDescription(False)
79+
return False
80+
6081
selectedObject = caller.GetSelectedObject()
6182
try:
6283
modIndex = int(selectedObject.GetString(caller.Prop_offeringId))
@@ -100,7 +121,7 @@ def HookShopInputKey(caller: UObject, function: UFunction, params: FStruct) -> b
100121
pass
101122
caller.RefreshDLC()
102123

103-
elif key != "Enter":
124+
elif key not in ("Enter", "E", "XboxTypeS_Start", "XboxTypes_X"):
104125
return True
105126

106127
return False
@@ -179,3 +200,12 @@ def HookContentMenu(caller: UObject, function: UFunction, params: FStruct) -> bo
179200
return False
180201

181202
RunHook("WillowGame.FrontendGFxMovie.ShowMarketplaceMovie","HookContentMenu", HookContentMenu)
203+
204+
205+
def HookMainMenuInput(caller: UObject, function: UFunction, params: FStruct) -> bool:
206+
if params.ukey == "M" and params.uevent == 1:
207+
caller.ShowMarketplaceMovie()
208+
return True
209+
210+
211+
RunHook("WillowGame.FrontendGFxMovie.SharedHandleInputKey", "ModMenuBind", HookMainMenuInput)

0 commit comments

Comments
 (0)