Skip to content

Commit

Permalink
BindFromIniOnly: only allows binds to be used from Input.ini/DefaultI…
Browse files Browse the repository at this point in the history
…nput.ini, prevents game from creating any that could collide with custom ones
  • Loading branch information
emoose committed Mar 4, 2021
1 parent 35d340c commit 6d046da
Show file tree
Hide file tree
Showing 3 changed files with 141 additions and 8 deletions.
9 changes: 9 additions & 0 deletions DQXI-SDK/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ struct {
bool LoadUnpackedFiles = true;
bool AllowDebugPackages = true;
bool FixCommonMisconfigs = true;
bool BindFromIniOnly = false;
} Options;

struct BindActionFnPtr
Expand Down Expand Up @@ -317,6 +318,7 @@ void InitPlugin()
Options.LoadUnpackedFiles = INI_GetBool(IniPath, L"Patches", L"LoadUnpackedFiles", Options.LoadUnpackedFiles);
Options.AllowDebugPackages = INI_GetBool(IniPath, L"Patches", L"AllowDebugPackages", Options.AllowDebugPackages);
Options.FixCommonMisconfigs = INI_GetBool(IniPath, L"Patches", L"FixCommonMisconfigs", Options.FixCommonMisconfigs);
Options.BindFromIniOnly = INI_GetBool(IniPath, L"Patches", L"BindFromIniOnly", Options.BindFromIniOnly);
}
}

Expand Down Expand Up @@ -352,6 +354,13 @@ void InitPlugin()
SafeWriteModule<uint8_t>(0x367FA48, 0x44);
SafeWriteModule<uint8_t>(0x3680100, 0x44);
}

// Only allows bindings from Input.ini/DefaultInput.ini, prevents game EXE from creating any that could collide with any custom binds
if (Options.BindFromIniOnly)
{
SafeWriteModule<uint8_t>(0x75A200, 0xC3);
SafeWriteModule<uint8_t>(0x7D0DF0, 0xC3);
}
}

HMODULE ourModule;
Expand Down
7 changes: 6 additions & 1 deletion DQXIS-SDK.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; By default all patches will be enabled (eg. if this file doesn't exist)
; By default all patches will be enabled besides PreventGameBindings (eg. if this file doesn't exist)
[Patches]

; Fix character viewer/fun-size forge render resolution to match with the games, increases detail & reduces aliasing
Expand All @@ -22,3 +22,8 @@ AllowDebugPackages = true
; - sets r.JackLoadReduction.DisableDitherHidden to 0, allows NPCs to fade in/out instead of popping
; - sets r.Shadow.FilterMethod to 0 as 1 seems to break shadows (but still gets recommended by some ancient UE4 mod guides...)
FixCommonMisconfigs = true

; Only allows bindings from Input.ini/DefaultInput.ini, prevents game EXE from creating any that could collide with any custom binds
; (this way you have full control over what bindings are used, just edit the included Input.ini file!)
; Default = false, set this to true once you've copied the Input.ini over!
BindFromIniOnly = false
133 changes: 126 additions & 7 deletions Input.ini
Original file line number Diff line number Diff line change
@@ -1,16 +1,135 @@
; Only edit this file while game is closed, as game will overwrite any changes on exit
; TODO: find some way to remove already bound actions, keys can be unbound in-game, but not mouse/controller sadly
; If you want to prevent the game from colliding with any of your binds, make sure BindFromIniOnly inside DQXIS-SDK.ini is set to true!

[/Script/Engine.InputSettings]
; Keyboard binds
; Custom action bindings:
ActionMappings=(ActionName="FirstPersonCamera", Key=N)
ActionMappings=(ActionName="EnterPartyChat", Key=M)

; Mouse binds
; MiddleMouseButton is also bound to ToggleAutoRun, binding isn't set in Default ini, must be done in code?
; For now disable this since autorun will also be activated...
; ActionMappings=(ActionName="FirstPersonCamera", Key=MiddleMouseButton)
; MiddleMouseButton is usually bound to ToggleAutoRun
; Feel free to comment this & uncomment/restore that binding below
ActionMappings=(ActionName="FirstPersonCamera", Key=MiddleMouseButton)

; Gamepad binds
ActionMappings=(ActionName="FirstPersonCamera", Key=Gamepad_Special_Left)
ActionMappings=(ActionName="EnterPartyChat", Key=Gamepad_LeftThumbstick)

; Default game bindings
; Gamepad_FaceButton refers to the A/B/X/Y (X/Circle/Square/Triangle) on your gamepad, the direction decides which button
ActionMappings=(ActionName="Action",Key=Gamepad_FaceButton_Bottom)
ActionMappings=(ActionName="Action",Key=Gamepad_LeftTrigger)
ActionMappings=(ActionName="Action",Key=LeftMouseButton)
ActionMappings=(ActionName="Action",Key=Enter)
ActionMappings=(ActionName="Action",Key=V)
ActionMappings=(ActionName="Cancel",Key=Gamepad_FaceButton_Right)
ActionMappings=(ActionName="Cancel",Key=RightMouseButton)
ActionMappings=(ActionName="Cancel",Key=BackSpace)
ActionMappings=(ActionName="JumpExtend",Key=Gamepad_FaceButton_Right)
ActionMappings=(ActionName="JumpExtend",Key=SpaceBar)
ActionMappings=(ActionName="MoveDown",Key=Gamepad_FaceButton_Right)
ActionMappings=(ActionName="MoveDown",Key=BackSpace)
ActionMappings=(ActionName="Brake",Key=Gamepad_FaceButton_Left)
ActionMappings=(ActionName="Brake",Key=X)
ActionMappings=(ActionName="OpenWorldMap",Key=Gamepad_FaceButton_Left)
ActionMappings=(ActionName="OpenWorldMap",Key=X)
ActionMappings=(ActionName="SkipCutScene",Key=Gamepad_FaceButton_Left)
ActionMappings=(ActionName="SkipCutScene",Key=X)
ActionMappings=(ActionName="OpenMainMenuWindow",Key=Gamepad_FaceButton_Top)
ActionMappings=(ActionName="OpenMainMenuWindow",Key=Z)
ActionMappings=(ActionName="Dash",Key=Gamepad_RightTrigger)
ActionMappings=(ActionName="Dash",Key=LeftShift)
ActionMappings=(ActionName="Jump",Key=Gamepad_RightTrigger)
ActionMappings=(ActionName="Jump",Key=LeftShift)
;ActionMappings=(ActionName="ToggleAutoRun",Key=Gamepad_LeftThumbstick)
;ActionMappings=(ActionName="ToggleAutoRun",Key=MiddleMouseButton)
ActionMappings=(ActionName="ToggleAutoRun",Key=Home)
ActionMappings=(ActionName="ResetCamera",Key=Gamepad_RightThumbstick)
ActionMappings=(ActionName="ResetCamera",Key=C)
ActionMappings=(ActionName="OpenShortcutMenu",Key=Gamepad_Special_Right)
ActionMappings=(ActionName="OpenShortcutMenu",Key=I)
ActionMappings=(ActionName="PhotoMode",Key=Gamepad_DPad_Up)
ActionMappings=(ActionName="PhotoMode",Key=P)
ActionMappings=(ActionName="ResetCameraKeys1",Key=Q)
ActionMappings=(ActionName="ResetCameraKeys1",Key=E)
ActionMappings=(ActionName="DPad_Up",Key=Gamepad_DPad_Up)
ActionMappings=(ActionName="DPad_Up",Key=Up)
ActionMappings=(ActionName="DPad_Down",Key=Gamepad_DPad_Down)
ActionMappings=(ActionName="DPad_Down",Key=Down)
ActionMappings=(ActionName="DPad_Left",Key=Gamepad_DPad_Left)
ActionMappings=(ActionName="DPad_Left",Key=Left)
ActionMappings=(ActionName="DPad_Right",Key=Gamepad_DPad_Right)
ActionMappings=(ActionName="DPad_Right",Key=Right)
ActionMappings=(ActionName="UIButtonTop",Key=Gamepad_FaceButton_Top)
ActionMappings=(ActionName="UIButtonTop",Key=Z)
ActionMappings=(ActionName="UIButtonLeft",Key=Gamepad_FaceButton_Left)
ActionMappings=(ActionName="UIButtonLeft",Key=X)
ActionMappings=(ActionName="UIButtonBottom",Key=Gamepad_FaceButton_Bottom)
ActionMappings=(ActionName="UIButtonBottom",Key=LeftMouseButton)
ActionMappings=(ActionName="UIButtonBottom",Key=Enter)
ActionMappings=(ActionName="UIButtonRight",Key=Gamepad_FaceButton_Right)
ActionMappings=(ActionName="UIButtonRight",Key=RightMouseButton)
ActionMappings=(ActionName="UIButtonRight",Key=BackSpace)
ActionMappings=(ActionName="UIButtonL1",Key=Gamepad_LeftShoulder)
ActionMappings=(ActionName="UIButtonL1",Key=Q)
ActionMappings=(ActionName="UIButtonL2",Key=Gamepad_LeftTrigger)
ActionMappings=(ActionName="UIButtonL2",Key=LeftMouseButton)
ActionMappings=(ActionName="UIButtonL2",Key=V)
ActionMappings=(ActionName="UIButtonL3",Key=Gamepad_LeftThumbstick)
ActionMappings=(ActionName="UIButtonL3",Key=MiddleMouseButton)
ActionMappings=(ActionName="UIButtonL3",Key=Home)
ActionMappings=(ActionName="UIButtonR1",Key=Gamepad_RightShoulder)
ActionMappings=(ActionName="UIButtonR1",Key=E)
ActionMappings=(ActionName="UIButtonR2",Key=Gamepad_RightTrigger)
ActionMappings=(ActionName="UIButtonR2",Key=LeftShift)
ActionMappings=(ActionName="UIButtonR3",Key=Gamepad_RightThumbstick)
ActionMappings=(ActionName="UIButtonR3",Key=C)
ActionMappings=(ActionName="UIDPadTop",Key=Gamepad_DPad_Up)
ActionMappings=(ActionName="UIDPadTop",Key=Up)
ActionMappings=(ActionName="UIDPadBottom",Key=Gamepad_DPad_Down)
ActionMappings=(ActionName="UIDPadBottom",Key=Down)
ActionMappings=(ActionName="UIDPadLeft",Key=Gamepad_DPad_Left)
ActionMappings=(ActionName="UIDPadLeft",Key=Left)
ActionMappings=(ActionName="UIDPadRight",Key=Gamepad_DPad_Right)
ActionMappings=(ActionName="UIDPadRight",Key=Right)
ActionMappings=(ActionName="UIWheelButton",Key=Gamepad_RightThumbstick)
ActionMappings=(ActionName="UIWheelButton",Key=C)
ActionMappings=(ActionName="UIButtonOption",Key=Gamepad_Special_Right)
ActionMappings=(ActionName="UIButtonOption",Key=I)
AxisMappings=(AxisName="TripleMoveUp",Key=Gamepad_DPad_Up,Scale=1.f)
AxisMappings=(AxisName="TripleMoveUp",Key=Gamepad_DPad_Down,Scale=-1.f)
AxisMappings=(AxisName="TripleMoveRight",Key=Gamepad_DPad_Right,Scale=1.f)
AxisMappings=(AxisName="TripleMoveRight",Key=Gamepad_DPad_Left,Scale=-1.f)
AxisMappings=(AxisName="TripleMoveUp",Key=Up,Scale=1.f)
AxisMappings=(AxisName="TripleMoveUp",Key=Down,Scale=-1.f)
AxisMappings=(AxisName="TripleMoveRight",Key=Left,Scale=-1.f)
AxisMappings=(AxisName="TripleMoveRight",Key=Right,Scale=1.f)
AxisMappings=(AxisName="Rotate",Key=Gamepad_LeftShoulder,Scale=-1.f)
AxisMappings=(AxisName="Rotate",Key=Gamepad_RightShoulder,Scale=1.f)
AxisMappings=(AxisName="Rotate",Key=Q,Scale=-1.f)
AxisMappings=(AxisName="Rotate",Key=E,Scale=1.f)
AxisMappings=(AxisName="MoveForward",Key=Gamepad_LeftY,Scale=1.f)
AxisMappings=(AxisName="MoveRight",Key=Gamepad_LeftX,Scale=1.f)
AxisMappings=(AxisName="UILeftY",Key=Gamepad_LeftY,Scale=1.f)
AxisMappings=(AxisName="UILeftX",Key=Gamepad_LeftX,Scale=1.f)
AxisMappings=(AxisName="MoveForward",Key=W,Scale=1.f)
AxisMappings=(AxisName="MoveForward",Key=S,Scale=-1.f)
AxisMappings=(AxisName="MoveRight",Key=A,Scale=-1.f)
AxisMappings=(AxisName="MoveRight",Key=D,Scale=1.f)
AxisMappings=(AxisName="UILeftY",Key=W,Scale=1.f)
AxisMappings=(AxisName="UILeftY",Key=S,Scale=-1.f)
AxisMappings=(AxisName="UILeftX",Key=A,Scale=-1.f)
AxisMappings=(AxisName="UILeftX",Key=D,Scale=1.f)
AxisMappings=(AxisName="UIWheelAxis",Key=Gamepad_RightY,Scale=-1.f)
AxisMappings=(AxisName="LookUp",Key=Gamepad_RightY,Scale=-1.f)
AxisMappings=(AxisName="Turn",Key=Gamepad_RightX,Scale=-1.f)
AxisMappings=(AxisName="UIRightY",Key=Gamepad_RightY,Scale=1.f)
AxisMappings=(AxisName="UIRightX",Key=Gamepad_RightX,Scale=1.f)
AxisMappings=(AxisName="UIWheelAxis",Key=O,Scale=1.f)
AxisMappings=(AxisName="UIWheelAxis",Key=L,Scale=-1.f)
AxisMappings=(AxisName="LookUp",Key=O,Scale=1.f)
AxisMappings=(AxisName="LookUp",Key=L,Scale=-1.f)
AxisMappings=(AxisName="Turn",Key=K,Scale=1.f)
AxisMappings=(AxisName="Turn",Key=Semicolon,Scale=-1.f)
AxisMappings=(AxisName="UIRightY",Key=O,Scale=-1.f)
AxisMappings=(AxisName="UIRightY",Key=L,Scale=1.f)
AxisMappings=(AxisName="UIRightX",Key=K,Scale=-1.f)
AxisMappings=(AxisName="UIRightX",Key=Semicolon,Scale=1.f)

0 comments on commit 6d046da

Please sign in to comment.