InsanityBringer / InjectD3

Descent 3 dll-injection patcher. Adds windowed support, new mouse code, and more.
Other
22 stars 3 forks source link

Slide left/right - Mouse down is interpreted as mouse down AND mouse up. #5

Closed roncli closed 2 years ago

roncli commented 2 years ago

I use the left and right mouse buttons to slide left and right, and when I hold down the button, it only attempts to slide me in that direction for one frame, as if it's interpreting a mouse down and a mouse up instead of just a mouse down.

Sol1vaN commented 2 years ago

Your're right.

I play with similar mouse config, but for forward/backward and this work right.

forward/backward https://i.imgur.com/55uT7w3.png

slide left/right https://i.imgur.com/wACo8L1.png

So this problem is about the key events pressing. In your case the bindings are detected by an instant mouse down / mouse up key event.

InsanityBringer commented 2 years ago

Seemingly the problem is caused by the new mouse code only flagging buttons as down when they're pressed down. The old DirectInput code, every frame, would check what buttons are down and set the flags accordingly. The flags are cleared when reading buttons, presumably to avoid issues with one input being read multiple times in one frame. I suspect I'm going to have to hook ddio_InternalMouseFrame to constantly reset the flags.

More curiously I don't know why this only affects sliding, and not thrust. It makes no sense to me.

InsanityBringer commented 2 years ago

Should be fixed. So far as I can tell unlike thrust, slide (at least with the mouse) doesn't use the button press time, so it isn't ramped and expects that the button flag is continually maintained. Weird.