Advertisement
em00se

Untitled

Apr 1st, 2024
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.90 KB | None | 0 0
  1. -- DragonsDogma 2 DisableMouseAcceleration script by emoose
  2. -- https://www.nexusmods.com/dragonsdogma2/mods/342
  3.  
  4. local app_WorkRate_getRateDeltaTime = sdk.find_type_definition("app.WorkRate"):get_method("getRateDeltaTime")
  5.  
  6. local app_CameraManager = sdk.get_managed_singleton("app.CameraManager")
  7.  
  8. local yaw_speed_rate = 0
  9. local pitch_speed_rate = 0
  10. local IsMouseMovedInFrame = nil
  11. local getInputAxisR = nil
  12.  
  13. local input_speed_base = 0
  14. local cam_controller = nil
  15. sdk.hook(
  16. sdk.find_type_definition("app.RotateCameraControllerBase"):get_method("getInputRotationSpeedRate"),
  17. function(args)
  18. cam_controller = sdk.to_managed_object(args[2])
  19.  
  20. yaw_speed_rate = app_CameraManager:getYawSpeedRate(cam_controller)
  21. pitch_speed_rate = app_CameraManager:getPitchSpeedRate(cam_controller)
  22.  
  23. getInputAxisR = cam_controller:getInputAxisR()
  24. IsMouseMovedInFrame = cam_controller:get_IsMouseMovedInFrame()
  25.  
  26. input_speed_base = sdk.to_float(args[3])
  27. return sdk.PreHookResult.SKIP_ORIGINAL
  28. end,
  29. function(retval)
  30. return sdk.float_to_ptr(input_speed_base / (cam_controller:get_ElapsedSecond() * 100))
  31. end
  32. )
  33.  
  34. sdk.hook(
  35. sdk.find_type_definition("app.RotateCameraControllerBase"):get_method("updateRotationDampingParam"),
  36. function(args)
  37. args[3] = sdk.float_to_ptr(0)
  38. args[4] = sdk.float_to_ptr(0)
  39. return sdk.PreHookResult.CALL_ORIGINAL
  40. end,
  41. function(retval)
  42. return retval
  43. end
  44. )
  45.  
  46. -- Make sure IsMouseInputSpeedAccel always returns false
  47. sdk.hook(
  48. sdk.find_type_definition("app.RotateCameraControllerBase"):get_method("get_IsMouseInputSpeedAccel"),
  49. function(args)
  50. return sdk.PreHookResult.SKIP_ORIGINAL
  51. end,
  52. function(retval)
  53. return sdk.to_ptr(false)
  54. end
  55. )
  56.  
  57. re.on_draw_ui(function()
  58. if imgui.tree_node("MouseAccelDebug") then
  59. if cam_controller then
  60.  
  61. imgui.text(" ")
  62. imgui.text("yaw_speed_rate = " .. tostring(yaw_speed_rate))
  63. imgui.text("pitch_speed_rate = " .. tostring(pitch_speed_rate))
  64. imgui.text("IsMouseMovedInFrame = " .. tostring(IsMouseMovedInFrame))
  65. imgui.text("InputAxisR.x = " .. tostring(getInputAxisR.x))
  66. imgui.text("InputAxisR.y = " .. tostring(getInputAxisR.y))
  67.  
  68. local useOptionnal = cam_controller["<UseOptionnalSpeedRate>k__BackingField"]
  69. local yawInputRate = cam_controller["<YawInputRate>k__BackingField"]
  70. local pitchInputRate = cam_controller["<PitchInputRate>k__BackingField"]
  71. local angle = cam_controller["_Angle"]
  72. local rotationSettings = cam_controller._RotationCameraSettings
  73. imgui.text("UseOptionnalSpeedRate: " .. tostring(useOptionnal))
  74. imgui.text("YawInputRate: " .. tostring(yawInputRate))
  75. imgui.text("PitchInputRate: " .. tostring(pitchInputRate))
  76. imgui.text("Angle.X: " .. tostring(angle.x))
  77. imgui.text("Angle.Y: " .. tostring(angle.y))
  78. imgui.text("Angle.Z: " .. tostring(angle.Z))
  79. imgui.text("rotationSettings._YawRotationSpeed " .. tostring(rotationSettings._YawRotationSpeed))
  80. imgui.text("rotationSettings._PitchRotationSpeed " .. tostring(rotationSettings._PitchRotationSpeed))
  81. imgui.text("rotationSettings._MouseInputYawRotationSpeedRate " .. tostring(rotationSettings._MouseInputYawRotationSpeedRate))
  82. imgui.text("rotationSettings._MouseInputPitchRotationSpeedRate " .. tostring(rotationSettings._MouseInputPitchRotationSpeedRate))
  83. imgui.text("rotationSettings._EnableMouseInputSpeedAccel " .. tostring(rotationSettings._EnableMouseInputSpeedAccel))
  84. imgui.text("rotationSettings._MouseMoveSpeedMax " .. tostring(rotationSettings._MouseMoveSpeedMax))
  85. end
  86. imgui.tree_pop()
  87. end
  88. end)
  89.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement