Apparently as someone just joining the community, I cannot ask for clarification on answers. There is no way to message a user, so I'm posting a new question relating to the following post.
How can I invert the mouse Y axis in Minecraft PI
The answer lists: "To invert the mouse Y, find the part of the library where it normally sends the deltaY value and invert it!"
and lists code for the instructions, however I'm not sure where the "library" is located. Can anyone help?
Just to be clear, I do not know where the library is that the solution is suggesting to search
Here is the full answer from jdonald https://raspberrypi.stackexchange.com/users/74822/jdonald:
One way to effectively mod this closed-source executable is to intercept SDL function calls with your own modified SDL.
sudo apt install libx11-dev libxext-dev
curl -O https://www.libsdl.org/release/SDL-1.2.15.tar.gz
tar xvf SDL-1.2.15.tar.gz
cd SDL-1.2.15
./configure
To invert the mouse Y, find the part of the library where it normally sends the deltaY value and invert it!
--- a/src/events/SDL_mouse.c
+++ b/src/events/SDL_mouse.c
@@ -185,7 +185,7 @@ printf("Mouse event didn't change state - dropped!\n");
event.motion.x = X;
event.motion.y = Y;
event.motion.xrel = Xrel;
- event.motion.yrel = Yrel;
+ event.motion.yrel = -Yrel;
if ( (SDL_EventOK == NULL) || (*SDL_EventOK)(&event) ) {
posted = 1;
SDL_PushEvent(&event);
then build and inject your modified library to test:
make
LD_PRELOAD=$(pwd)/build/.libs/libSDL-1.2.so.0 minecraft-pi
Or if you have enabled full OpenGL with KMS, you may have to avoid the script at /usr/bin/minecraft-pi overriding with its own LD_PRELOAD setting. More complicated, but you can inject the Mesa wrapper alongside like so:
(cd /opt/minecraft-pi && \
LD_PRELOAD="$(cd -)/build/.libs/libSDL-1.2.so.0 libbcm_host.so.1.0" \
LD_LIBRARY_PATH=lib/mesa \
./minecraft-pi)
One cool perk of this approach is that because mouse look uses relative movements while you're leaving the absolute Y position untouched, cursor movement still functions as before.
If you wish to make further modifications or need to debug your changes, add printf() statements, rebuild, and rerun.