mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-06 13:05:47 +00:00
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:
1 parent
9ad5961e4c
commit
13f4babcd0
3 files changed
+317
-81
No files matched your search
@@ -146,9 +146,10 @@ class DirectInput(unittest.TestCase):
|
||||
on = re.search(r'^on\(\) \{.*\}$', text, re.M).group(0)
|
||||
start = text.index('# dd-directinput: a game set to start')
|
||||
end = text.index("dd-directinput off: Wine's xinput again\"\nfi\n") + len("dd-directinput off: Wine's xinput again\"\nfi\n")
|
||||
script = on + '\n' + text[start:end] + 'echo "overrides=$WINEDLLOVERRIDES"\n'
|
||||
script = on + '\n' + text[start:end] + 'echo "overrides=$WINEDLLOVERRIDES"; echo "control=${DD_DIRECTINPUT_CONTROL:-}"\n'
|
||||
(self.root / 'session/dev/input').mkdir(parents=True, exist_ok=True)
|
||||
base = dict(PATH=os.environ['PATH'], TOOL=str(self.tool), COMPAT=str(self.compat), F=str(self.f),
|
||||
WINEDLLOVERRIDES='d3d11=n,b')
|
||||
WINEDLLOVERRIDES='d3d11=n,b', FAKE_EVDEV_DIR=str(self.root / 'session/dev/input'))
|
||||
result = subprocess.run(['sh', '-c', script], env=dict(base, **env), text=True, capture_output=True, check=True)
|
||||
return result.stdout
|
||||
|
||||
@@ -167,7 +168,10 @@ class DirectInput(unittest.TestCase):
|
||||
self.assertIn('Wine builtin DLL', (self.win / pfx / 'dd-directinput-wine-xinput.dll').read_text())
|
||||
self.builtins_untouched()
|
||||
self.assertIn('overrides=d3d11=n,b;xinput1_1,xinput1_2,xinput1_3,xinput1_4,xinput9_1_0,xinputuap=n,b', out)
|
||||
self.assertIn('dd-directinput on', out)
|
||||
mode = self.root / 'session/dev/dd-directinput.mode'
|
||||
self.assertEqual('1', mode.read_text().strip())
|
||||
self.assertIn(f'control={mode}', out)
|
||||
self.assertIn('dd-directinput on (starts direct)', out)
|
||||
|
||||
def test_switched_off_puts_wines_links_back(self):
|
||||
self.run_step(DROIDDECK_NO_STEAM='1')
|
||||
@@ -182,11 +186,16 @@ class DirectInput(unittest.TestCase):
|
||||
self.assertIn('overrides=d3d11=n,b\n', out)
|
||||
self.assertIn("dd-directinput off: Wine's xinput again", out)
|
||||
|
||||
def test_dd_directinput_0_keeps_wines_own(self):
|
||||
def test_dd_directinput_0_starts_in_pass_through(self):
|
||||
out = self.run_step(DROIDDECK_NO_STEAM='1', DD_DIRECTINPUT='0')
|
||||
self.assertTrue((self.win / 'system32/xinput1_3.dll').is_symlink())
|
||||
self.assertIn('overrides=d3d11=n,b\n', out)
|
||||
self.assertNotIn('dd-directinput on', out)
|
||||
self.assertFalse((self.win / 'system32/xinput1_3.dll').is_symlink())
|
||||
self.assertEqual('0', (self.root / 'session/dev/dd-directinput.mode').read_text().strip())
|
||||
self.assertIn('dd-directinput on (starts pass-through)', out)
|
||||
|
||||
def test_without_a_controller_folder_it_stays_direct(self):
|
||||
text = self.run_step(DROIDDECK_NO_STEAM='1', FAKE_EVDEV_DIR='')
|
||||
self.assertIn('control=\n', text)
|
||||
self.assertIn('dd-directinput on (starts direct (no mode file))', text)
|
||||
|
||||
def test_a_native_xinput_that_is_not_ours_stays(self):
|
||||
t = self.win / 'system32/xinput1_3.dll'
|
||||
|
||||
Reference in new issue
Block a user