diff --git a/tools/bionic-runtime/tool/launch.sh b/tools/bionic-runtime/tool/launch.sh index be9cc347b7..9cbda98a83 100644 --- a/tools/bionic-runtime/tool/launch.sh +++ b/tools/bionic-runtime/tool/launch.sh @@ -41,7 +41,7 @@ for v in $(env | sed -n 's/^\([A-Za-z_][A-Za-z0-9_]*\)=.*/\1/p'); do ANDROID_*|BOOTCLASSPATH|DEX2OATBOOTCLASSPATH|SYSTEMSERVERCLASSPATH|EXTERNAL_STORAGE|ASEC_MOUNTPOINT) ;; FAKE_*|SDL_*|DD_WIDTH|DD_HEIGHT|DD_VK_DRIVER|WINEDLLOVERRIDES) ;; DISPLAY|GAMESCOPE_WAYLAND_DISPLAY|FEX_*) ;; - TU_DEBUG|MESA_NO_ERROR|DXVK_CONFIG|DXVK_HUD|DROIDDECK_FORCE_SSBS|BANNER_AUDIO_DIRECT_*) ;; + TU_DEBUG|MESA_NO_ERROR|DXVK_CONFIG|DXVK_HUD|DROIDDECK_FORCE_SSBS|DROIDDECK_NO_STEAM|BANNER_AUDIO_DIRECT_*) ;; mesa_glthread|vblank_mode|ZINK_*|GALLIUM_HUD|GALLIUM_THREAD) ;; DD_SYNC|DD_FSYNC_FIRST|DD_SYNC_FALLBACK|PROTON_NO_ESYNC|PROTON_NO_FSYNC|PROTON_NO_NTSYNC|WINEESYNC) ;; PROTON_USE_D7VK) ;; @@ -138,6 +138,13 @@ echo "sync ntsync=$WINENTSYNC esync=$WINEESYNC ssbs=${WINE_FORCE_SSBS:-0} tu_deb export WINESTEAMCLIENTPATH64=$ROOTFS/root/.local/share/Steam/androidarm64/libsteamclient.so # The layer sends a game's steamclient(64).dll to lsteamclient (and so to DroidDeck's Steam through the library # above) only with WINE_LSTEAMCLIENT set; without it Valve's Windows steamclient runs alone and SteamAPI_Init fails. +# A game set to start without Steam has no Steam client behind lsteamclient, and a steamclient64.dll it brings itself +# (a Steam emulator such as gbe_fork's ColdClient loader) would be replaced by it, so the game quit after its splash +# screen. Such a game keeps its own; a WINE_LSTEAMCLIENT the player set wins. +if [ -z "${WINE_LSTEAMCLIENT:-}" ] && on "${DROIDDECK_NO_STEAM:-}"; then + echo "lsteamclient off: started without Steam" + export WINE_LSTEAMCLIENT=0 +fi export WINE_LSTEAMCLIENT=${WINE_LSTEAMCLIENT:-1} # Steam Input data (Valve's Steam Deck layouts with game actions) lives in DroidDeck's /dev/shm; libsteamshm.so # points the Android library's shared memory there (it keeps its own in-process otherwise) and gives it the diff --git a/tools/tests/test_bionic_paths.py b/tools/tests/test_bionic_paths.py index e4931b48ae..d810aa09a6 100644 --- a/tools/tests/test_bionic_paths.py +++ b/tools/tests/test_bionic_paths.py @@ -86,6 +86,38 @@ class ToolArguments(unittest.TestCase): self.assertEqual(switches, {name: kept.get(name) for name in switches}) self.assertNotIn('OTHER', kept) + def test_start_without_steam_reaches_wine(self): + text = LAUNCH.read_text() + block = text[text.index('KEEP="'):text.index('export PATH=/system/bin')] + env = dict(PATH=os.environ['PATH'], DROIDDECK_BIONIC_KEEP='PATH', DROIDDECK_NO_STEAM='1') + result = subprocess.run(['sh', '-c', block + 'env\n'], env=env, text=True, capture_output=True, check=True) + self.assertIn('DROIDDECK_NO_STEAM=1', result.stdout.splitlines()) + + +def lsteamclient(**env): + text = LAUNCH.read_text() + on = re.search(r'^on\(\) \{.*\}$', text, re.M).group(0) + last = 'export WINE_LSTEAMCLIENT=${WINE_LSTEAMCLIENT:-1}\n' + block = text[text.index('# A game set to start without Steam'):text.index(last) + len(last)] + script = on + '\n' + block + 'echo "value=$WINE_LSTEAMCLIENT"\n' + result = subprocess.run(['sh', '-c', script], env=dict(env, PATH=os.environ['PATH']), + text=True, capture_output=True, check=True) + return result.stdout.splitlines()[-1].split('=', 1)[1] + + +class SteamBridge(unittest.TestCase): + def test_games_with_steam_use_lsteamclient(self): + self.assertEqual('1', lsteamclient()) + self.assertEqual('1', lsteamclient(DROIDDECK_NO_STEAM='0')) + + def test_a_game_started_without_steam_keeps_its_own_steamclient(self): + for value in ('1', 'on', 'true', 'yes'): + self.assertEqual('0', lsteamclient(DROIDDECK_NO_STEAM=value)) + + def test_the_players_value_wins(self): + self.assertEqual('1', lsteamclient(DROIDDECK_NO_STEAM='1', WINE_LSTEAMCLIENT='1')) + self.assertEqual('0', lsteamclient(WINE_LSTEAMCLIENT='0')) + class SessionLogs(unittest.TestCase): SESSION = '/data/user/0/com.droiddeck.launcher/files/logs/2026-11-22-09-steam'