Skip to content

add tcp input server to support linux with wine#373

Open
aderumier wants to merge 2 commits into
argonlefou:masterfrom
aderumier:tcpinputserver
Open

add tcp input server to support linux with wine#373
aderumier wants to merge 2 commits into
argonlefou:masterfrom
aderumier:tcpinputserver

Conversation

@aderumier

@aderumier aderumier commented May 12, 2026

Copy link
Copy Markdown

Hi,
currently we can't use multiple guns on linux with wine, because wine is not supporting multiple rawmouse && merge all mouses input into a single one.

This patch serie add tcpinput instead rawinput in demulshooter , allowing a linux client to communicate through tcp with demulshooter directly.

I have use same kind of protocol than the unity plugins.

A linux python client is provided, connecting to demul or directly to the unity plugins tcp server for the unity games.

I have tested all unity games, model2, typex, sega ringedge/ringwide, seganu games.
Some games are not working (The House of The Dead : Remake for example, some arcadepc, but I think that not evertyhing is handled by demulshooter for theses games), but 90% of games are working.

aderumier added 2 commits May 12, 2026 08:52
Add a TcpInputServer listening on a 33610 for 46-byte
input packets sent by a Linux client (tcp_mouse_client.py). Each packet carries
normalized X/Y coordinates and trigger/reload/action button states for up to
4 players:
  X[4](float) Y[4](float) EnableInputsHack(byte) HideCrosshairs(byte)
  Trigger[4](byte) Reload[4](byte) Action[4](byte)

config.ini:

;Player1 Device configuration
P1Mode = TCPINPUT
P1DeviceName = TCPINPUT

;Player2 Device configuration
P2Mode = TCPINPUT
P2DeviceName = TCPINPUT

;Player3 Device configuration
P3Mode = TCPINPUT
P3DeviceName = TCPINPUT

;Player4 Device configuration
P4Mode = TCPINPUT
P4DeviceName = TCPINPUT
tcp_mouse_client.py is a Linux evdev client that reads light gun and mouse/
touchpad devices and forwards coordinates + button states to DemulShooter or
BepInEx game plugins via TCP.

Device handling:
- --gun1..--gun4: assign evdev devices to player slots (P1..P4)
- Auto-detected type: ABS_X+ABS_Y → GunState (light gun, reads absinfo
  min/max for normalization); REL_X+REL_Y → MouseState (clamped to screen)
- Offscreen reload: when a light gun fires outside the screen boundary the
  trigger is suppressed and a reload signal is sent instead

Packet formats (--game):
  demul, rha, wws, tra, owr, mib, mia, nha2, marss, pvz, pbx, rgs
  Each format matches the expected layout of the corresponding game plugin.

Button remapping:
- BTN_MIDDLE → KEY_1..4 (Start), BTN_1 → KEY_5..8 (Coin), per player slot
- BTN_5..8 → arrow keys (d-pad), shared across all players
- A UInput virtual keyboard device is created per player; the source device
  is grabbed exclusively (dev.grab) so the display server does not also
  receive the raw gun button events

Screen resolution:
- Auto-detected via xrandr (Xorg/XWayland), wlr-randr (Wayland), or
  /sys/class/drm/card*-*/mode (kernel DRM); --width/--height override
- Reconnects to the server automatically with a 2 s back-off
@argonlefou

Copy link
Copy Markdown
Owner

Hi,
Sorry for the delayed answer, your request coming at the exact time the Lindbergh emulator was released on windows XD

To be honest I've been really busy - out of the computer world - for some time and I'm not really available to check and dig into DemulShooter core input parts for now

On top of that, I've been working for months on some other project that might replace DemulShooter one day (if it goes more public than my own computer, not sure yet) and I'm not really into deeply modding DemulShooter for that reason.

I'm keeping the request here if you want other people to be able to use it, but in the current state I'm not sure to push it into the project


Now, about some technical points :

I made a linux equivalent of DS (very light, no GUI) a long time ago when I released the packed VMs with Star Trek or Target Terror games.
Linux itself provides an easy access to separate devices/mouse/lightgun by accessing hadware files to get axis data. I can find back my sources and share them with you if you're interrested, it's way more easy than creating TCP server/client system

Only thing is, I don't know how that would work with WINE....

@aderumier

Copy link
Copy Markdown
Author

Hi, no problem if it's not merged, I wanted to share it with other linux users that could use it.

I really don't known if we could have something similar to DS running on linux, then hooking into game.exe running under with wine. That's why I have done it this way. (The linux client example I have posted in second patch is also able to connect to unity plugins tcp ports directly).

anyway, maybe one day wine will finally fix on their side multiple raw device handling, but until that, this is doing the job :)

have also done the same patch for teknoparrot for people that want it:
https://github.com/aderumier/TeknoParrotUI/commits/tcpinput/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants