ValveSoftware / halflife

Half-Life 1 engine based games
Other
3.72k stars 625 forks source link

Fix for SDL2 mouse scroll wheel bugs in Linux #3088

Open NukemD opened 3 years ago

NukemD commented 3 years ago

There seems to be an issue with the scroll wheel on Half-Life, and by extension, mods of Half-Life (TFC, CS, NS, etc.) where scrolling the wheel in either direction will erratically trigger +attack and +attack2 (and sometimes +attack3 on mods that support it), and even the mouse3 input. This can happen whether or not you have mwheelup, mwheeldown or mouse3 bound to anything.

I did a bit of digging and found that the mouse wheel having erratic behavior was apparently a known SDL2 input bug back in 2013-2014, but it was apparently patched, so I was confused as to why it is still happening. Digging further, I notice that Half-Life had its own copy of libSDL2-2.0.so.0 that appears to be an ancient version before those patches were applied upstream and pushed down the grape vine.

So as an experiment, I removed libSDL2-2.0.so.0 in the /.steam/steamapps/common/Half-Life/ directory and replaced it with a symlink to the system's own /usr/lib/libSDL2-2.0.so.0, and lo and behold the mouse starts working perfectly.

I'm assuming the lib is included in the Half-Life directory for compatibility reasons to prevent dependency hell. Would it be possible for the version of libSDL2-2.0.so.0 included with Half-Life be updated to the most recent release? It seems to be an issue across multiple Linux distros. I'm running Fedora 33, but I also tried it on OpenSUSE and Debian and had the same erratic mouse issues until I replaced the offending lib with the much more recent version.

Idiot64 commented 3 years ago

i think you dont even have to create a symlink i'm not sure

NukemD commented 3 years ago

You can't leave it out because the next time the game updates or does a file integrity check, it'll download the old version of the file again.

ArijanJ commented 11 months ago

This still happens after the update, but now it presses random keys. Using distro's SDL instead works fine.

NukemD commented 11 months ago

Yep, Valve never fixed it. There are actually more dependency issues on the server side that break mods and Metamod plugins.