-
Notifications
You must be signed in to change notification settings - Fork 637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HL1/HL1SDK] Mouse input issues #1377
Comments
Do you have a sample mod you could point to with this issue? I have an idea of what the problem will be but I need to reproduce the problem to be sure. |
Basically I've just compiled the clean newest SDK you have here, those two dlls it gave life to and liblist.gam. Windows VS2010 build. I can upload it if interested..anyway. |
Here is the sample mod after all http://www.sendspace.com/file/4tkll7 But like I said it's just clean current SDK build. About reproducting mouse wheel being ignored, taking in case you guys would notice it not working if it'd be global issue, I guess it's this wireless mouse special problem, some HW incompatibility or so. But it's never working, no current GoldSrc game, doesn't matter if it's raw input or not. (It worked on old engine builds and it works elsewhere of course.) |
Line 494 in a06e5a1
SDL_GetRelativeMouseState( &deltaX, &deltaY ); deltaX and deltaY get 0, also if you press the windows key to get out of the game you see that the mouse is stuck in a window corner or edge. I am not SDL2 savvy, so I don't know if it's an SDL problem or if some other SDL functions (i.e. for Message Pumping) need to be called inbetween. |
I tried a separate SDL2 test-program (with SDL-2.0.0-7046). SDL_SetRelativeMouseMode(SDL_TRUE); Have to go to bed, will try to debug Half-Life tomorrow, maybe I'll find s.th.. |
Well yeah, with the custom mod SDL_SetRelativeMouseMode is not called by Half-Life. With the default valve mod SDL_SetRelativeMouseMode is called from inside hw.dll. I think one could do the calling of SDL_SetRelativeMouseMode in the client (IN_ActivateMouse, IN_DeactivateMouse and where it re-checks the m_rawinput CVAR), but I am not sure if that's the right way to do, or if we should relay on hw.dll instead, as it is for the default Half-Life mod? Btw dmc and ricochet client.dll inputw32.cpp doesn't have m_rawinput handling in the SDK, they always do rawinput, I suppose that is wanted this way (I am fine with that)? Regarding the mwheel issue, have you tried pressing attack (i.e.ENTER or Mouse button 1), after doing mwheel? You might be a bit confused, because it doesn't load the HUD sprites for the weapon menu from the valve folder (I think you will have to put them in your mod folder). |
It's strange game input gets handled differently for each game / MOD like this. Anyway, I'd say it doesn't really matter if SDL_SetRelativeMouseMode would be engine or SDK handled, keeping it engine wouldn't hurt anything I guess, not even code customizability. About the wheel issue, wheel !movements! are completly ignored. Wheel as button works, but moving the wheel does nothing, and that's pretty serious. Now I don't know if it happens globally or it's just my mouse, but that'd be weird, it works elsewhere perfectly. |
I sadly can't reproduce the mousewheel problem. I am more interested in 2), since 1) probably won't work as you said:
|
Both cases don't work. Now, message pump or whatever way SDL handles it never creates MWHEELUP/DOWN events at all. Seems to be specific mouse issue, but I don't get ..why it's not working here. |
@RichardRohac @alfred-valve I found this:
(The post linked above, might also contain solutions for you @RichardRohac ) And I looked into the SDL2 code to find this in SDL_windowsevents.c
And SDL_SendMouseWheel won't send the event when motion is 0. I won't blame that on the SDL2 developers since Microsoft themselves isn't too clear about how to use WHEEL_DELTA: Maybe someone file a bug report at SDL2 maybe (not me please): |
Following the article I got the problem fixed, so this is definitely SDL2 releated then, thanks for bothering, software for this mouse might get handy in future, fixing mousewheel in other applications as well. Mousewheel issue shouldn't be marked as Half Life bug then (?). Now there's yet to fix the rotation lock. (I mean calling SDL_SetRelativeMouseMode(SDL_TRUE) when in game for MODs as well, engine or SDK side whatever, as that is r e s o l u t i o n to this problem for me, I've tested it.) |
The not seeing SDL relative mode is a bug in HL1, I'll need to add a hinting API so that mods can tell the engine they support SDL2 (rather than the older OS specific methods). |
Yeah okay, so I guess this can be taken as solved then :). |
Well, as expected I ended up being the one to submit the bug to libsdl.org sigh :( Though you guys would need to update the SDL2.dll (that is in case they fix it). |
They fixed the bug in SDL2 in the hg repository.
It would be cool if you could test if that DLL file or your own compiled version of it (rename the original one for backup and don't join any VAC servers while using the modified one), solves the mouse issue in default settings (I mean with the driver normally installed where you got the problem). (You might need to scroll several lines before it reacts, but it should react now. Maybe try once with the old DLL first to verify the problem exits and then with the new DLL to test if it's gone.) But I assume we won't see a fix in Half-Life too soon, since @alfred-valve will probably want to wait for a stable SDL2 version I guess :) |
Thanks for all this bothering, they really have fixed the issue, scrolls instantly :) Until VALVe won't update the dependency I'll have to stick using the fixed driver anyway. I guess it'd be senseful to wait for stable SDL build, but, this is pretty serious for most of Microsoft mouse owners, I'd consider moving the fix to your current SDL build or so. edit: |
@slouken committed the fix, so this issue report should probably be reassigned to him. |
@Tele42 what do you mean, on libdsl.org the issue is assigned to him? This issue on github.com is for ValveSoftware. SDL and Valve have connections, but they are two different organisations. |
@ripieces Slouken is currently employed by Valve. |
He means http://hg.libsdl.org/SDL/rev/d8fb783475d5 - the fixed code is by @slouken |
thank you for reporting the bug in a previous topic that is assigned . |
As @L453rh4wk pointed out in #1546 the workaround above by @Matherunner won't work properly for m_rawinput 0 on Windows because it doesn't honor whether m_rawinput is 0 or 1. Also I am not sure if the game will call IN_ActivateMouse and IN_DeactivateMouse upon change of m_rawinput on Windows (which it might do, but I am unable to check atm, because Steam Client Bootstraper just crashes on my old laptop after the last update), meaning not sure if these are the right places to place those calls. |
so any news ? |
You can try: mouse & touchpad -> disable scroll inactive windows when i hover over them |
Doesn't SDL_GetRelativeMouseState get the last state since the previous mouse update and not current mouse position which then causes mouse movement to be off by one update or am I misunderstanding this SDL function? I also noticed SDL for half-life/counter-strike 1.6 in windows is using version 1.3.0.0 and not the latest 2.0.4, hopefully there are no bugs in this version and I wonder if using a newer dll would get you VAC banned on windows? |
See #1900 |
@mikela-valve Seeing that some work is being done on the engine again, could this be looked into? I experience the same mouse issues with the current engine version. @SamVanheer This is all great, but the actual SDL build needs to be updated as well. |
Yeah the SDL2 library needs updates for a couple reasons, see also #1887 |
Yes, plz update SDL |
Yeah some mouse wheel issues were fixed in another mod by replacing the SDL2 in HL1 folder. |
@mikela-valve Could you take a look at this issue? |
Would really like to see this get fixed :( |
@mikela-valve can you make the two "mod" 's dlls for a mod i am making .. or give me somebody that can do it .. i am ready to give a little amount of money . for those having the bug.. they should test using a well known steam path : like gearbox or dmc... |
@mikela-valve i looked into this and i think the solution is as Alfred said above to add a way to hint the engine that SDL is being used. Currently the engine sets relative mouse mode using To test this i hex edited the engine to replace the filename for It's probably easier to test by putting a mod dll in place of an official game dll, like A new engine function could be used to provide the hint:
Then on startup, probably in
The value provided would be used by So the engine should perform these steps:
In code:
Alternatively a function could be added to the client dll interface to ask it whether it uses SDL or not:
The rest is pretty straightforward: if the client provides this function it's used, otherwise the app id and filename checks are used. Also, given that many mods' source code is unavailable or lost, it might be good to add a |
Apparently, the problem is caused by this issue: ValveSoftware/halflife#1377 Which Solokiller has a fix for: twhl-community/halflife-updated@92ffa23 But seems to be originated from L453rh4wk: ValveSoftware/halflife#1546 (comment)
* Make project compile on Linux - Updated CMake files to support build on Linux - Deleted original Linux makefiles as they are not needed since CMake is introduced - Fixed minor problems in the code which prevented the project from compiling It likely breaks the Windows build, but hopefully it only causes minor problems those are easy to fix in a way that allows the project to compile on both platforms. The Linux CMake files don't try to deploy the built libraries to the game mod directory (people likely build in a separate environment, not where they have the game installed). * Explicitly link SDL2 to client library - Added SDL2 to the list of linked libraries to client.so Not sure if it helps anything, the library loaded without it successfully, but it doesn't hurt either. - Fixed symlinks to Linux and MacOS builds of SDL2 They were supposed to be symlinks and they are in Valve's repo, but in Solokiller's fork they lost their symlink flag with this commit: twhl-community/halflife-updated@6509102 * Port fix for getting mouse stuck in box Apparently, the problem is caused by this issue: ValveSoftware/halflife#1377 Which Solokiller has a fix for: twhl-community/halflife-updated@92ffa23 But seems to be originated from L453rh4wk: ValveSoftware/halflife#1546 (comment) Co-authored-by: MegaBrutal <megabrutal@devcentre>
* Make project compile on Linux - Updated CMake files to support build on Linux - Deleted original Linux makefiles as they are not needed since CMake is introduced - Fixed minor problems in the code which prevented the project from compiling It likely breaks the Windows build, but hopefully it only causes minor problems those are easy to fix in a way that allows the project to compile on both platforms. The Linux CMake files don't try to deploy the built libraries to the game mod directory (people likely build in a separate environment, not where they have the game installed). * Explicitly link SDL2 to client library - Added SDL2 to the list of linked libraries to client.so Not sure if it helps anything, the library loaded without it successfully, but it doesn't hurt either. - Fixed symlinks to Linux and MacOS builds of SDL2 They were supposed to be symlinks and they are in Valve's repo, but in Solokiller's fork they lost their symlink flag with this commit: twhl-community/halflife-updated@6509102 * Port fix for getting mouse stuck in box Apparently, the problem is caused by this issue: ValveSoftware/halflife#1377 Which Solokiller has a fix for: twhl-community/halflife-updated@92ffa23 But seems to be originated from L453rh4wk: ValveSoftware/halflife#1546 (comment) * Add CTriggerOnce.cpp to server library Co-authored-by: MegaBrutal <megabrutal@devcentre>
Addendum: the way the engine detects whether a game uses SDL causes it to hide the mouse cursor in VGUI1 menus when Edit: turns out this was caused by the workaround for the mouse-stuck-in-box issue which didn't account for VGUI1 making the cursor visible the same way the engine does. |
Is it possible to make HL use newer SDL2 without breaking hl or potentially getting vac banned? File link, replace file (steam.exe -noverifyfiles). In relation to not having fixed win10 version. |
If you run the game with |
OpenSuse Tumbleweed without raw input option, the mouse feels jittery and loses track when fast mouse movement is applied. |
Raw input works correctly on current (non beta) Half Life Steam build (just running regular Half Life), I get no lock on mouse rotation. But, compiled latest (8/10/2013) Half Life SDK (VS2010), I get the rotation lock when running the mod and raw input is enabled (same engine build is running, must be SDK issue I guess).
I also get no mouse wheel input whatsoever (every current GoldSrc game). (Microsoft Wireless Mouse 1000)
(Windows build)
The text was updated successfully, but these errors were encountered: