feat(bionic): dd-directinput pass-through mode, switchable while the game runs

dd-directinput gets a second mode: every XInput call goes to Wine's own xinput (the
dd-directinput-wine-xinput.dll copy it already loads for rumble), as if the DLL were not
there. A background thread reads the mode file every 250 ms ('1' direct, '0' pass-through),
so the mode can change while the game runs; DroidDeck's in-game menu can switch it later
by writing that file. The same thread now does the once-a-second ring and pad-node checks,
so a game thread never waits on a file (they run in the calls only if the thread cannot
start).

launch.sh writes the mode file next to the controller folder (FAKE_EVDEV_DIR's parent,
dd-directinput.mode) and names it in DD_DIRECTINPUT_CONTROL; DD_DIRECTINPUT=0 now starts
the game in pass-through instead of leaving the DLLs out.
This commit is contained in:
The412Banner committed 2026-12-06 01:36:30 -05:00
1 parent 9ad5961e4c
commit 13f4babcd0
3 files changed
+317 -81

No files matched your search

+12 -3
View File
@@ -431,7 +431,9 @@ fi
# (bionic/dd-directinput), which answer from the pad state DroidDeck keeps in each ring file instead of the queue
# of HID reports Wine's xinput reads (a game that reads slower than the pad reports kept moving after the stick
# was let go). They go into the prefix as copies, never through the links to this tool's builtins, with Wine's
# xinput1_4 beside them as dd-directinput-wine-xinput.dll for rumble. DD_DIRECTINPUT=0 keeps Wine's own; a game
# xinput1_4 beside them as dd-directinput-wine-xinput.dll for rumble and pass-through. The mode file next to the
# controller folder (DD_DIRECTINPUT_CONTROL, '1' direct / '0' pass-through to Wine's xinput) is read by the DLLs
# while the game runs, so DroidDeck can switch it live; it starts as DD_DIRECTINPUT says (0 = pass-through). A game
# no longer set to start without Steam gets Wine's links back.
DDI=$TOOL/bionic/dd-directinput
ddi_names="xinput1_1 xinput1_2 xinput1_3 xinput1_4 xinput9_1_0 xinputuap"
@@ -441,7 +443,7 @@ ddi_put() { # src dst: dst becomes a copy of src; a link there is removed first,
}
ddi_ours() { [ -f "$1" ] && [ ! -L "$1" ] && grep -qF "dd-directinput: " "$1"; }
DDW=$COMPAT/pfx/drive_c/windows
if on "${DROIDDECK_NO_STEAM:-}" && [ "${DD_DIRECTINPUT:-1}" != 0 ] && [ -d "$DDI/arm64x" ] && [ -d "$DDI/i386" ]; then
if on "${DROIDDECK_NO_STEAM:-}" && [ -d "$DDI/arm64x" ] && [ -d "$DDI/i386" ]; then
for a in arm64x:system32:aarch64-windows i386:syswow64:i386-windows; do
src=$DDI/${a%%:*}; rest=${a#*:}; dir=$DDW/${rest%%:*}; wine=$F/lib/wine/${rest#*:}
[ -d "$dir" ] || continue
@@ -449,7 +451,14 @@ if on "${DROIDDECK_NO_STEAM:-}" && [ "${DD_DIRECTINPUT:-1}" != 0 ] && [ -d "$DDI
ddi_put "$wine/xinput1_4.dll" "$dir/dd-directinput-wine-xinput.dll"
done
export WINEDLLOVERRIDES="$WINEDLLOVERRIDES;xinput1_1,xinput1_2,xinput1_3,xinput1_4,xinput9_1_0,xinputuap=n,b"
echo "$(date +%H:%M:%S) dd-directinput on (XInput from the pad state)"
ddi_mode=1 ddi_name=direct
[ "${DD_DIRECTINPUT:-1}" = 0 ] && ddi_mode=0 ddi_name=pass-through
if [ -n "${FAKE_EVDEV_DIR:-}" ] && echo "$ddi_mode" > "${FAKE_EVDEV_DIR%/*}/dd-directinput.mode"; then
export DD_DIRECTINPUT_CONTROL="${FAKE_EVDEV_DIR%/*}/dd-directinput.mode"
else
ddi_name="direct (no mode file)"
fi
echo "$(date +%H:%M:%S) dd-directinput on (starts $ddi_name)"
else
back=0
for a in system32:aarch64-windows syswow64:i386-windows; do