BugfixedHL-Rebased icon indicating copy to clipboard operation
BugfixedHL-Rebased copied to clipboard

Direct Input

Open gohlrhi opened this issue 1 year ago • 7 comments

what does direct input do exactly and why is it recommended? Thus what is the difference between engine, raw input and direct input?

gohlrhi avatar Feb 14 '24 12:02 gohlrhi

TL;DR Use DirectInput on Windows and Raw Input on Linux because there is no mouse acceleration

The three input modes are:

  • Engine (which is incorrectly named, a better name is "WinAPI")
  • Direct Input
  • Raw Input

Engine/WinAPI method queries the on-screen mouse cursor position. This means that mouse movement is influenced by Windows settings (like sensitivity, mouse acceleration).

Direct Input and Raw Input both read raw data directly from the mouse, before Windows processes it.

Direct Input uses DirectX API, while Raw Input uses the SDL2 library bundled with the engine (like Raw Input checkbox in the mouse settings).

Windows: Direct Input is the preferred method on Windows. Before HL25 update, the game used an old version of SDL2 that had some bugs related to mouse input. Also, Direct Input was added to BHL before the 2013 SteamPipe engine update, that added SDL2 and Raw Input.

Linux: There is no WinAPI or DirectX so Raw Input is the only supported method.

tmp64 avatar Feb 17 '24 02:02 tmp64

thank you for your answer. i have another question. Via directinput what should be m_customaccel settings? i experienced that even m_customaccel set to 0, when you change m_customaccel exponent and m_customaccel scale values sensitivity or maybe acceleretaion changes. What customaccel settings commonly used and what should they set in order to 1:1 raw no accelereation?

gohlrhi avatar Mar 19 '24 07:03 gohlrhi

@gohlrhi, when direct input is enabled, accel seeings don't matter anymore.

Safety1st avatar Mar 19 '24 09:03 Safety1st

I doubt that because when directinput is enabled evet m_customaccel is set to 0 if i change m_customaccel_exponent and m_customaccel_scale values sensitivity and feeling change clearly.

gohlrhi avatar Mar 19 '24 10:03 gohlrhi

I don't understand what are you talking about 🤷‍♂️

Safety1st avatar Mar 19 '24 11:03 Safety1st

@Safety1st Input method only affects how mouse is read. m_customaccel stuff is applied after that, so it works with any input method.

@gohlrhi When m_customaccel == 0, no custom acceleration is applied. The relevant code is here. So it's a placebo effect or something similar. I personally don't feel any changes when setting m_customaccel_scale 1000 or m_customaccel_exponent 10.

Btw, the formula is mousesensitivity = ( rawmousedelta^m_customaccel_exponent ) * m_customaccel_scale + sensitivity

tmp64 avatar Mar 19 '24 13:03 tmp64

thanks for your answer but i am sure it feels different by different values of scale and exponent with m_customaccel is set to 0. i have found many other guy complain about it on net so may be there is a bug about it idk.

gohlrhi avatar Mar 19 '24 13:03 gohlrhi