Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- DragonsDogma 2 DisableMouseAcceleration script by emoose
- -- https://www.nexusmods.com/dragonsdogma2/mods/342
- local app_WorkRate_getRateDeltaTime = sdk.find_type_definition("app.WorkRate"):get_method("getRateDeltaTime")
- local app_CameraManager = sdk.get_managed_singleton("app.CameraManager")
- local yaw_speed_rate = 0
- local pitch_speed_rate = 0
- local IsMouseMovedInFrame = nil
- local getInputAxisR = nil
- local input_speed_base = 0
- local cam_controller = nil
- sdk.hook(
- sdk.find_type_definition("app.RotateCameraControllerBase"):get_method("getInputRotationSpeedRate"),
- function(args)
- cam_controller = sdk.to_managed_object(args[2])
- yaw_speed_rate = app_CameraManager:getYawSpeedRate(cam_controller)
- pitch_speed_rate = app_CameraManager:getPitchSpeedRate(cam_controller)
- getInputAxisR = cam_controller:getInputAxisR()
- IsMouseMovedInFrame = cam_controller:get_IsMouseMovedInFrame()
- input_speed_base = sdk.to_float(args[3])
- return sdk.PreHookResult.SKIP_ORIGINAL
- end,
- function(retval)
- return sdk.float_to_ptr(input_speed_base / (cam_controller:get_ElapsedSecond() * 100))
- end
- )
- sdk.hook(
- sdk.find_type_definition("app.RotateCameraControllerBase"):get_method("updateRotationDampingParam"),
- function(args)
- args[3] = sdk.float_to_ptr(0)
- args[4] = sdk.float_to_ptr(0)
- return sdk.PreHookResult.CALL_ORIGINAL
- end,
- function(retval)
- return retval
- end
- )
- -- Make sure IsMouseInputSpeedAccel always returns false
- sdk.hook(
- sdk.find_type_definition("app.RotateCameraControllerBase"):get_method("get_IsMouseInputSpeedAccel"),
- function(args)
- return sdk.PreHookResult.SKIP_ORIGINAL
- end,
- function(retval)
- return sdk.to_ptr(false)
- end
- )
- re.on_draw_ui(function()
- if imgui.tree_node("MouseAccelDebug") then
- if cam_controller then
- imgui.text(" ")
- imgui.text("input_speed_base = " .. tostring(input_speed_base))
- imgui.text("yaw_speed_rate = " .. tostring(yaw_speed_rate))
- imgui.text("pitch_speed_rate = " .. tostring(pitch_speed_rate))
- imgui.text("IsMouseMovedInFrame = " .. tostring(IsMouseMovedInFrame))
- imgui.text("InputAxisR.x = " .. tostring(getInputAxisR.x))
- imgui.text("InputAxisR.y = " .. tostring(getInputAxisR.y))
- local useOptionnal = cam_controller["<UseOptionnalSpeedRate>k__BackingField"]
- local yawInputRate = cam_controller["<YawInputRate>k__BackingField"]
- local pitchInputRate = cam_controller["<PitchInputRate>k__BackingField"]
- local angle = cam_controller["_Angle"]
- local rotationSettings = cam_controller._RotationCameraSettings
- imgui.text("UseOptionnalSpeedRate: " .. tostring(useOptionnal))
- imgui.text("YawInputRate: " .. tostring(yawInputRate))
- imgui.text("PitchInputRate: " .. tostring(pitchInputRate))
- imgui.text("Angle.X: " .. tostring(angle.x))
- imgui.text("Angle.Y: " .. tostring(angle.y))
- imgui.text("Angle.Z: " .. tostring(angle.Z))
- imgui.text("rotationSettings._YawRotationSpeed " .. tostring(rotationSettings._YawRotationSpeed))
- imgui.text("rotationSettings._PitchRotationSpeed " .. tostring(rotationSettings._PitchRotationSpeed))
- imgui.text("rotationSettings._MouseInputYawRotationSpeedRate " .. tostring(rotationSettings._MouseInputYawRotationSpeedRate))
- imgui.text("rotationSettings._MouseInputPitchRotationSpeedRate " .. tostring(rotationSettings._MouseInputPitchRotationSpeedRate))
- imgui.text("rotationSettings._EnableMouseInputSpeedAccel " .. tostring(rotationSettings._EnableMouseInputSpeedAccel))
- imgui.text("rotationSettings._MouseMoveSpeedMax " .. tostring(rotationSettings._MouseMoveSpeedMax))
- end
- imgui.tree_pop()
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement