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
[Linux] Unable to aim towards top-left corner with mouse #44
Comments
I tried playing without any window manager running, and the problem persists, so it has nothing to do with 'awesome'. |
It seems like CS:GO ignores relative SDL_MOUSEMOTION events with mouse position (0, 0). I've managed to work around this bug by patching SDL2 to clamp the mouse to x > 0 when it is in relative mode. |
I am having a problem similar. When I look top left, my sensitivity drops almost in half. I noticed this on a few maps where I had to look up and to the left, like going into boiler on inferno map. I run Arch with AwesomeWM |
@sebth any chance youre still around to explain your workaround? i have no idea how to do what you mentioned |
This problem disappeared for me when I upgraded from Debian 7 to Debian 8. I haven't tried to figure out what could've caused the behaviour to change, but this is the patch I used: diff -ru SDL2-2.0.3/src/events/SDL_mouse.c SDL2-2.0.3.fix/src/events/SDL_mouse.c
--- SDL2-2.0.3/src/events/SDL_mouse.c 2014-03-16 03:31:44.000000000 +0100
+++ SDL2-2.0.3.fix/src/events/SDL_mouse.c 2014-09-24 16:10:19.000000000 +0200
@@ -238,31 +238,33 @@
}
/* Update internal mouse coordinates */
- if (!mouse->relative_mode) {
- mouse->x = x;
- mouse->y = y;
- } else {
- mouse->x += xrel;
- mouse->y += yrel;
- }
+ if (!relative) {
+ if (!mouse->relative_mode) {
+ mouse->x = x;
+ mouse->y = y;
+ } else {
+ mouse->x += xrel;
+ mouse->y += yrel;
+ }
- SDL_GetWindowSize(mouse->focus, &x_max, &y_max);
- --x_max;
- --y_max;
+ SDL_GetWindowSize(mouse->focus, &x_max, &y_max);
+ --x_max;
+ --y_max;
- /* make sure that the pointers find themselves inside the windows */
- if (mouse->x > x_max) {
- mouse->x = x_max;
- }
- if (mouse->x < 0) {
- mouse->x = 0;
- }
+ /* make sure that the pointers find themselves inside the windows */
+ if (mouse->x > x_max) {
+ mouse->x = x_max;
+ }
+ if (mouse->x < 0) {
+ mouse->x = 0;
+ }
- if (mouse->y > y_max) {
- mouse->y = y_max;
- }
- if (mouse->y < 0) {
- mouse->y = 0;
+ if (mouse->y > y_max) {
+ mouse->y = y_max;
+ }
+ if (mouse->y < 0) {
+ mouse->y = 0;
+ }
}
mouse->xdelta += xrel; Basically it stops the updating of mouse coordinates when the mouse is set to relative mode. This prevents the mouse from getting to coordinates (0, 0) when in-game. I guess you could also modify the statements under So, to get CS:GO to use this, just get the SDL2 source code (https://www.libsdl.org/release/SDL2-2.0.3.tar.gz), patch it with the patch above, and build it. You don't need to install the library as we are going to preload it. Remember to build it as a 32-bit library even if you're on a 64-bit system, as CS:GO is 32-bit. (If you need help on how to patch and build an open source project, there are many good guides on the web if you search for it.) After you've built the library, right click on CS:GO in your Steam games list, choose Properties, and then Set Launch Options. Use this as your Launch Options: |
Make sure you do "CFLAGS='-m32 -O2' LDFLAGS=-m32 ./configure --build=i686-pc-linux-gnu" before you build it so it builds as 32bit! |
I am trying to work out this issue but am not having much luck reproducing it so far. For people it occurs for, does it occur for other Source FPS games, such as TF2 or Portal 2? (Dota2 uses very different mouse code so isn't a good comparison point). |
So, I am having the version of the problem where my sensitivity is cut in half (approximately) when I move my view up and left, not that it stops altogether. I tried on TF2 and it seems to be completely fine. I don't have portal 2 installed nor time to test it at the moment, unfortunately. I've posted my specs and specific problem in #405 |
The Source FPSes I have are CS:GO and Half-Life 2. When I was running Debian 7, I only had this problem in CS:GO, not in Half-Life 2. |
@davidw-valve sebth's patch seems to have solved the problem for me. Tested Portal 2 - works fine as it is. |
@coffee-lord were you having sebth's version of the problem where you couldn't aim up and to the left at all, or mine where your sensitivity in that direction was halved? do you think you could upload your patched SDL? i am having no luck changing and building mine on my own. |
so i finally figured out how to correctly build the directory with the patched mouse file and can confirm that this problem is different than mine in #405 or at least that it did not solve it for me, if that's any help to you @davidw-valve |
@fallore in my case the problem was halved sensitivity when moving towards upper left corner. Initially i tried different polling rates for mouse (125,500,1000 Hz) and found that this issue had gotten worse when the polling rate was low (125 Hz). I might be wrong though. are you sure that the lib's preloaded correctly? it has to be 32 bit. i think the game will still launch if the lib's 64 bit but the fix won't work. |
@coffee-lord is there a way to check if i built the directory correctly, or if csgo is loading it correctly? i used the flags to make it 32 bit, or at least received no error when i input them before the ./configure and make commands. these are the commands i used: 153 CFLAGS='-m32 -O2' i made the correct changes to the mouse.c file before i built it, and i received no errors when i built it. my launch option is thus "LD_PRELOAD=/home/fallore/SDL2-2.0.3/build/.libs/libSDL2-2.0.so.0 %command% -freq 144 -novid -console " i also tried it without the -freq 144 etc commands to see if that was the problem any other info i can share that might enlighten why this did not work for me? |
@fallore what does the |
@coffee-lord i'm unable to open it in text editor. it tells me it doesn't detect the character encoding? how do i check? |
@fallore no it's a tool called
|
so file does show it linked to the proper file (file libSDL2-2.0.so.0 libSDL2-2.0.so.0: symbolic link to `libSDL2-2.0.so.0.2.1' ), but when i put the launch option CSGO wont start. i'm pretty lost at this point :( i was able to find this error log if anyone can tell me what it means/what i need to do |
@fallore
instead of
I'm talking out of my ass here but it might be still worth to try it. |
@fallore @coffee-lord CFLAGS='-m32 -O2'
LDFLAGS=-m32
./configure --build=i686-pc-linux-gnu is wrong. If you don't type CFLAGS='-m32 -O2' LDFLAGS=-m32 ./configure --build=i686-pc-linux-gnu or export CFLAGS='-m32 -O2'
export LDFLAGS=-m32
./configure --build=i686-pc-linux-gnu . To see which libSDL CS:GO is using, you can run |
I've uploaded a video demonstrating steps to reproduce this bug. While testing, I discovered that mouse DPI makes a huge difference on whether or not you'll trigger this bug under normal gameplay. Higher DPI means a higher chance of the cursor going into the top left corner, which causes the issue. I myself played for a whole year with 400 DPI and I had never triggered this bug before, but as soon as I raised it while playing around with my DPI+sensitivity due to the 2016-01-07 update, I immediately ran into it. I suspect this might be the reason why some people have always had trouble with this, while others have never experienced it, especially considering how popular 400 DPI is in CS:GO. I also wonder if this might be the reason why @davidw-valve has been unable to reproduce it so far. I can confirm that @sebth's patch fixes the issue, however it also causes my cursor to stop working if I press escape in game to access the menu, as I do in the video above. Because of this, I used instead the following patch, which prevents the cursor from going into the (0,0) position by warping it to (1,0). diff -drp -u10 SDL2-2.0.4.orig/src/events/SDL_mouse.c SDL2-2.0.4/src/events/SDL_mouse.c
--- SDL2-2.0.4.orig/src/events/SDL_mouse.c 2016-01-02 17:56:31.000000000 -0200
+++ SDL2-2.0.4/src/events/SDL_mouse.c 2016-01-08 16:43:48.590681755 -0200
@@ -261,20 +261,24 @@ SDL_PrivateSendMouseMotion(SDL_Window *
if (mouse->x < 0) {
mouse->x = 0;
}
if (mouse->y > y_max) {
mouse->y = y_max;
}
if (mouse->y < 0) {
mouse->y = 0;
}
+
+ if (relative && mouse->x == 0 && mouse->y == 0) {
+ mouse->x = 1;
+ }
}
mouse->xdelta += xrel;
mouse->ydelta += yrel;
/* Move the mouse cursor, if needed */
if (mouse->cursor_shown && !mouse->relative_mode &&
mouse->MoveCursor && mouse->cur_cursor) {
mouse->MoveCursor(mouse->cur_cursor);
} Some extra info:
|
Works fine in the buy menu. Just in game is broken
|
Just tested @ahnook 's patch with 2.0.4, it works. Corner bug gone. But I think I will use the valve version, I'm too worried about a VAC ban. |
You can simply use the SDL in built feature to load another SDL version: export SDL_DYNAMIC_API=/path to other sdl |
@ahnook How did you test this script? I already built the libSDL, placed it in the ~/.steam/steamapps/common/Counter-Strike Global Offensive/bin folder replacing the old libSDL2-2.0.so.0 library (I added some additional debugging to see, whether this file is used) and as I see, the game doesn't load this library. Could you provide more information what should I do to make it work? export SDL_DYNAMIC_API= - this doesn't work neither |
@BeniaminK I used LD_PRELOAD in csgo's launch options, as described by @sebth in his comment above where he posted his own patch. Here's a step by step of the whole process, since I saw others also having trouble testing this.
mkdir ~/libsdl
cd ~/libsdl
wget 'https://www.libsdl.org/release/SDL2-2.0.4.tar.gz'
tar xvzf SDL2-2.0.4.tar.gz
wget 'http://pastie.org/pastes/10680849/download' -O sdl_0x0.patch
patch -p0 < sdl_0x0.patch
cd SDL2-2.0.4
CFLAGS='-m32 -O2' LDFLAGS=-m32 ./configure --build=i686-pc-linux-gnu
make
If you already have %command% in there, then don't duplicate it, just prepend the LD_PRELOAD part. Remember to click OK to save your changes.
lsof -p `pidof csgo_linux` | grep libSDL If all went well, you should see a line ending in the path to your patched lib. If not, you will see the path to some other copy of the lib in your system. Note that it is critical that you compile the lib for 32-bit and also that LD_PRELOAD points correctly to it, without any typos. Finally, if you want to go back to valve's copy of the lib at any time, just edit the launch options again and remove the LD_PRELOAD part. I hope this helps. |
@thedoctorz Well yeah. That's a big part of the income/profit that keeps cs:go going. I would say that's a great thing that people are buying these skins, and Valve is smart enough to focus on these. Would be great though if they fixed issues like this and the sound-loop bug which is even more annoying. |
This fix seems so easy to make, that i just don't understand how are they still delaying it or something ? |
There's nothing smart about not fixing important bugs. It upsets customers. |
@hasufell Most people don't notice it and most people who notice it don't care. If you have finite resources, you need to prioritize. Look how many people are concerned with this bug, and how many are with skins... Don't get me wrong: I also consider fixing gamebreaking bugs more important than silly skins. But there is a bigger picture. You need stupid people to buy skins in order to continue develping the game. This bug WILL be fixed. And guess where the money will come from to employ the developer |
@andras-kiss I don't need a lecture on valves business model. And I don't care at all where their money comes from. I'm a customer and I care about bugs getting fixed in a resaonble timeframe. This timeframe is not reasonable. Period. |
@hasufell You can fix it yourself. ahnook's patch works. |
That is wrong. It's not an SDL bug. And I am not interested in getting VAC banned by hacking on libraries. |
@hasufell Yeah that's true. Let's hope Valve fixes it soon. |
Hey everyone, could we please keep the discussion on topic and not pollute the bug thread with opinions? @thedoctorz Could you paste the result of the ./configure line (before typing "make"). Here is what mine looks like. If SDL is not compiling then it's definitively not going to work when running CSGO. Also, what version of linux are you running?
|
Posting hacks that may get you VAC banned in a bug report thread isn't much more ontopic. This has to be fixed by valve. If you think this is an SDL bug (pretty unlikely), post it on the SDL bug tracker: https://bugzilla.libsdl.org/ |
@ramyD, I get this:
Building Shared Libraries |
what distro?, Ubuntu? |
Ah sorry, Forgot |
Ok then I'm not sure what kind of window system you're using since openSUSE has an experimental support for wayland. Please post your system information as described in the readme of this project. The error you're getting when launching CSGO "SDL_Init(SDL_INIT_VIDEO) failed: No available video device" happens when the SDL lib you compiled doesn't find where to output the video - I had this exact error and noticed that it wasn't detecting my x11 libs, hence my post for the config. I'm unsure if you're on another window compositor or if you're simply missing xorg-dev libs. I'll get a better idea after you post your system information |
@ramyD |
@thedoctorz sorry to bum you out but your problem is not plain enough for me to see and I don't have experience with opensuse to help you out. |
@ramyD It's alright man, it is not for you to fix in the first place anyway. |
Please fix that bug ASAP since it's known for a long time and the solution is easy (ship the updated SDL library). This is a game breaking bug and we lost at least two rounds at Dreamhack Leipzig because of it. Imagine the following situation: as a CT on de_dust2 defusing the bomb on A spot you are not able to defend yourself when a T is coming ramp. |
@micb25 this issue isn't caused by SDL, it's just worked around by changing SDL code. Bug is still in csgo software. |
We have a fix to this that we expect to ship in the next CS:GO update. |
@davidw-valve Thank god. I have been unable to play CSGO since about a month ago when an update triggered this bug for me. |
@davidw-valve That's great news. Thank you for your hard work. |
@davidw-valve Wish I could buy you a beer for this. Well, guess I'll get a key instead. |
@davidw-valve Thank you very much. |
I just tested the new update and I can confirm that it fixes this issue. |
I can also confirm that the update solved the issue for me. |
Issue fix at last. |
@sebth I think you can close this issue now |
When aiming towards the top-left corner with the mouse in-game (both offline and online), the view stops moving. I'm able to aim in all directions except diagonally towards the top-left corner. This happens both in fullscreen and in windowed mode, no matter how fast or slow I move the mouse, altough the mouse is allowed to travel a small distance before the view stops moving. Disabling raw mouse input doesn't help.
The distance the mouse is allowed to travel before the view stops moving seems to depend on the resolution / window size: the problem is more apparent with a low resolution and a low mouse sensitivity.
System information output from Steam:
(My mouse is a standard USB mouse which uses the evdev driver; nothing special. It works fine in other games like Counter-Strike 1.6 and Quake 3.)
The text was updated successfully, but these errors were encountered: