Mouse Panning and Mouse Button binder for Ryujinx(https://ryujinx.org/).
It's a simple learning project. I wanted to use my mouse and change the camera view position but Ryujinx doesn't support this yet, you have to use third-party software to achieve it. In short, this lets you use your mouse to change the in-game camera view position for some games.
Well, if your desired game changes its camera view position according to your right-stick/left-stick/d-pad input and if you've bound these inputs with your keyboard then this can help you.
This also let's you bind mouse buttons with controller buttons such as ZL/ZR.
Just be able to run Ryujinx and for now this only works for Windows, Linux(X11 Window Manager) and macOS(12+). But the code structure was designed to work on all the platforms Ryujinx supports, only needs to support native API(s) for specific platforms.
It simulates keypress of your keyboard according to the mouse position change.
If you've bound the right-stick(Or the stick which changes the camera) inputs with your keyboard eg. the default Ryujinx input configuration binds the right-stick inputs like this:
then after enabling mouse panning.
-
If you move your mouse UP (↑) it will send I keypress to Ryujinx.
-
If you move DOWN (↓) it will send K and so on.
-
If you've changed these keys in Ryujinx make sure you also change those in RMB's configuration.
You can change the Sensitivity according to your need.
Now you can bind your mouse buttons with any keyboard key. Example if you want to press the ZR key and bound that key with O in Ryujinx (the dafualt configuration).
Then you can bind right mouse button or left mouse button with O or Q or whatever key is mapped to the desired controller button in Ryujinx.
- BTW, make sure 'Bind Mouse Buttons' is ticked.
- If you don't want to apply the mouse binding feature at the moment but still want to keep your binding settings just untick 'Bind Mouse Buttons' for the moment.
You can now unbound the mouse buttons or set to None by clicking on them and pressing Ctrl+C.
This was a simple learning project so, things might get broken. Since it simulates key presses according to the mouse position, you might feel the camera movement is a bit choppy and weird/wrong. And you should close(recommended) or hide/minimize other applications.
-
Make sure Ryujinx is running, focused, and is in the centre of your screen before enabling mouse panning..
-
Default Panning Toggle Hotkey is Ctrl+F9 if any other application uses the same hotkey it will fail so make sure to choose a unique hotkey or just close other applications.
-
If you don't want to bind mouse buttons with your keyboard keys then just simply press the 'Default' button and set the mouse binding keys to None or just untick the 'Bind Mouse Buttons'
-
It uses GLFW and ImGui for the UI part. It directly calls Native functions to handle keyboard and mouse events.
-
It always sets the mouse position to the center of the screen and if the user moves the mouse then it calculates which direction it was moved from the center of the screen and simulates key presses.
- GLFW 3.4+ for windows/Linux a custom build was placed in this repo.
- ImGui for simple immediate mode UI.
Output directory: build/RMB/${Build}/${Platform-Arch}/RMB{.exe; windows}
- Build:
Release, Debug - Platform:
macos, linux, windows - Arch:
x64, arm64
- Visual Studio 2019+ with
Desktop development with C++components installed andvc143+should be able to build this. (Yes, no need to manually link ImGui and GLFW libs).- Make sure
cl.exeis in yourPATHenvironment variable, typicall openDeveloper PowerShell for VS {VERSION}orDeveloper Command Prompt for VS {VERSION}and run the commands - PowerShell:
cl.exe nob.c; .\nob.exe
- Command Prompt:
cl.exe nob.c && nob.exe - Make sure
- Install required libs.
- Debian/Ubuntu based distros:
sudo apt install libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxkbfile-dev libxi-dev libxext-dev libxtst-dev mesa-common-dev
- Arch based Linux distros:
sudo pacman -Syu base-devel libx11 libxcursor libxrandr libxinerama libxkbfile libxi libxext libxtst mesa
- After installing these libs simply run
cc nob.c -o nob && nobin the directory.
Thanks to @VladimirProg for help with testing! The build is now stable and performs well — safe to use.
Added macOS support based on user requests. Since I don't own a Mac ourselves, we haven't been able to test it in a real environment, things might not work as expected.
Apple's default compiler doesn't support a modern C++ feature (jthread) that RMB requires. So, we'll need llvm 20+ toolchain.
Follow instructions from the official HomeBrew site.
- Follow the on-screen instructions
- After installation, verify it worked by typing:
cc --versionIf you see version information, you're good to go. If not, try following Homebrew's installation guide again.
In Terminal, run:
brew install llvmThis installs LLVM version 20 or newer. It may take a few minutes.
In Terminal, run:
git clone --depth=1 https://github.com/IamSanjid/RMB.git && cd RMBThis downloads RMB and moves you into the project folder.
Most users can skip this step.
If you installed LLVM in a non-standard location, you'll need to tell RMB's build system where to find it.
- Find where LLVM is installed:
brew --prefix llvm- Open the file
.nob/nob_config.hin a text editor - Add this line at the very top (replace
<path>with the path from the command above):
#define LLVM_TOOLCHAIN "<path>"In Terminal, make sure you're in the downloaded RMB folder, you will be if you've followed the previous steps step by step.
Run:
cc -o nob nob.c && ./nobYou'll see some compiler warnings — these are normal and safe to ignore. The build should complete successfully.
Depending on your Mac's chip:
- Apple Silicon (M1, M2, M3, etc.) — run:
build/RMB/Release/macos-arm64/RMB- Intel — run:
build/RMB/Release/macos-x64/RMB- macOS 12.0 (Monterey) or newer
- Older versions (10.x–11.x) should work in theory but haven't been tested
- Tested on Tahoe 26.1
First-time setup: macOS will ask for Accessibility permissions. You need to allow these for RMB to work properly. Just allow it from the settings.
-
First you need to implement a global hotkey listener, for windows, a dummy window is created and
RegisterHotKeyAPI is used to register the hotkeys for that window and listened toWM_HOTKEYmessages on that window.XGrabKeyis used for X11 window manager. -
Then you need to implement how to simulate the key presses on the corresponding OS, for windows
SendInputwas enough. For X11 wmXTestFakeKeyEventAPI was used. -
You now need to implement how to get the cursor position, for Windows
GetCursorPosand for X11 wmXQueryPointerAPI(s) was used. -
After that you need to implement how to set your cursor position, for Windows
SetCursorPosAPI was used, same effect can be done by usingSendInput. For X11 wmXWarpPointerdid the job. -
Detect if Ryujinx is active/focused or not. On windows
GetForegroundWindowand on X11 wmXGetWindowPropertyAPI(s) was used, check here. -
(Optional) If you want to hide your cursor during panning mode you need to actually change the cursor image file your system currently using, for Windows
SetSystemCursorAPI is used. For X11 wm simpleXFixesHideCursor/XFixesShowCursorAPI(s) did the job. -
(Optional) If you want to automatically focus Ryujinx after entering panning mode then again you need to use some native API(s), for windows
SetForegroundWindowAPI was used and for X11 wmXSendEventwas able to help. On both platforms you have to check all the visible windows and you can either check their class name/title name to select your target processs and send Focus/Active action. -
(Optional) If you want to add the mouse button to keyboard binder feature, you going to need to listen to global mouse button press/release events, on windows this was achieved via
SetWindowHookExandLowLevelMouseProcWin32 API, on X11 wm had to useXRecordAPI(s) you can checkXRecordHandlerfrom here. Then it uses the 2nd feature to send the keyboard key press.
Check native.h a simple interface that was used as a bridge to call these native API(s).
Use this as a base class for your specific OS implementation.
Again this is a learning project, if anyone wants to help me improve this I would really appreciate it. If you find any bugs or issues let me know by opening an issue. Feel free to pull any request. Thank you for your time.
You can download available binaries from releases.
Videos shows demo with an older version but the main usage remains the same.
The differences you can notice are:
-
No longer need to set the
Camera Update Time. -
You can specify the emulator target window by providing the name. It means you can also use it on other emulators like CEMU just need to configure it correctly.
-
You can set more settings regarding mouse panning, such as X and Y offset, range, deadzone etc.




