Perils of Man

Perils of Man

View Stats:
Fix/hack/workaround for stuck Risk Atlas camera on Linux
Save the following to fix.c
#define _GNU_SOURCE #include <dlfcn.h> #include <X11/Xlib.h> int XWarpPointer(Display *display, Window src_w, Window dest_w, int src_x, int src_y, unsigned int src_width, unsigned int src_height, int dest_x, int dest_y) { static int (*xwp)(Display*, Window, Window, int, int, unsigned int, unsigned int, int, int) = 0; static int sometimes = 0; if (!xwp) xwp = dlsym(RTLD_NEXT, "XWarpPointer"); if (++sometimes == 10) { sometimes = 0; return xwp(display, src_w, dest_w, src_x, src_y, src_width, src_height, dest_x, dest_y); } else { return 0; } }
Compile with
gcc -m32 -fPIC -shared fix.c -o fix.so -ldl
put fix.so in the game directory
set launch options to
LD_LIBRARY_PATH=$PWD LD_PRELOAD=fix.so %command%

It just ignores 9 out of 10 of the XWarpPointer calls the game makes.
Last edited by pseudonym404; 2 Jul, 2016 @ 3:43am
< >
Showing 1-5 of 5 comments
Zyro 2 Jul, 2016 @ 3:45am 
I can guess how this library wrapping technique works. What I'd love to know: How did you find out what's wrong and how to fix it? (I'm software developer.)
pseudonym404 2 Jul, 2016 @ 3:48am 
Just based on a hunch from the way moving the mouse caused jitter movement, but always went back to a center point. That and being familiar with xlib. :)
Zyro 2 Jul, 2016 @ 3:50am 
Ok, sometimes programming is mostly intuition. :) Thanks for sharing!
pseudonym404 2 Jul, 2016 @ 9:01pm 
It is possible to get relative motion with alternating XWarpPointer calls and real pointing device events, but it seems that's where the bug is. It gets the relative motion right with 2 or more consecutive real pointing device events though, this hack just allows that to happen.
GadgetGamer 21 Sep, 2018 @ 1:37am 
It is two years later, and I still had to apply this fix to get the game working. Thanks to pseudonym404 for the great work writing this fix. Surely the developers could compile the code above and include in the base install themselves.

I had to change the compiler arguments to get it to work on my 64bit Linux Mint installation. I removed the -m32.

I used this:
gcc -fPIC -shared fix.c -o fix.so -ldl
< >
Showing 1-5 of 5 comments
Per page: 1530 50