mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-05 12:35:42 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
57b2533656 |
No files matched your search
@@ -13,6 +13,12 @@ object NoSteamLaunch {
|
||||
|
||||
class Command(val program: String, val args: List<String>, val name: String)
|
||||
|
||||
fun running(mode: String, program: String?): Boolean =
|
||||
mode == SessionService.MODE_RUN && program in setOf(PROTON_RUN, EPIC, BATTLENET)
|
||||
|
||||
fun windowsGames(mode: String, program: String?): Boolean =
|
||||
mode == SessionService.MODE_STEAM || mode == SessionService.MODE_DESKTOP || running(mode, program)
|
||||
|
||||
fun scope(game: Library.SteamGame): String? = when {
|
||||
game.library == Library.EPIC_LAUNCHER -> EpicClient.shortcutAppId.toString()
|
||||
game.library == Library.BATTLENET_LAUNCHER -> com.droiddeck.launcher.runtime.BattleNet.APP_ID.toString()
|
||||
|
||||
@@ -598,7 +598,7 @@ class SessionService : Service() {
|
||||
runCatching { SessionEvents.step("components-republish") { ComponentsManager.republish(this) } }
|
||||
.onSuccess { if (it) Log.i(TAG, "component selections published for the installed Proton builds") }
|
||||
.onFailure { Log.w(TAG, "component selections", it) }
|
||||
if (steamHere) {
|
||||
if (windowsGames()) {
|
||||
runCatching { SessionEvents.step("components-forced") { ComponentsManager.ensureForcedPackages(this) } }
|
||||
.onSuccess { if (it != null) Log.i(TAG, it) }
|
||||
.onFailure { Log.w(TAG, "forced components", it) }
|
||||
@@ -1074,12 +1074,13 @@ class SessionService : Service() {
|
||||
}
|
||||
Log.i(TAG, "vkbridge: on (${com.droiddeck.launcher.core.DeviceSupport.gpuName(this)}, ${SessionPrefs.vkBridgeMode(this)} mode), socket $socket")
|
||||
}
|
||||
private fun noSteamGame(): Boolean =
|
||||
SessionState.mode == MODE_RUN && SessionState.program in setOf(NoSteamLaunch.PROTON_RUN, NoSteamLaunch.EPIC, NoSteamLaunch.BATTLENET)
|
||||
private fun noSteamGame(): Boolean = NoSteamLaunch.running(SessionState.mode, SessionState.program)
|
||||
|
||||
private fun windowsGames(): Boolean = NoSteamLaunch.windowsGames(SessionState.mode, SessionState.program)
|
||||
|
||||
private fun startAudio(guest: MutableList<String>, sessionDir: File, directAudioPack: Boolean): PulseAudioComponent {
|
||||
val wantsDirectAudio = directAudioPack &&
|
||||
(SessionState.mode == MODE_STEAM || SessionState.mode == MODE_DESKTOP || noSteamGame()) &&
|
||||
windowsGames() &&
|
||||
SessionPrefs.directAudio(this)
|
||||
val wantsMic = SessionPrefs.micEnabled(this) &&
|
||||
checkSelfPermission(android.Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED
|
||||
|
||||
@@ -101,4 +101,22 @@ class NoSteamLaunchTest {
|
||||
assertNull(NoSteamLaunch.nameFor("/usr/bin/retroarch", emptyList()))
|
||||
assertNull(NoSteamLaunch.nameFor(NoSteamLaunch.PROTON_RUN, listOf("/x/a.exe")))
|
||||
}
|
||||
|
||||
@Test fun windowsGameSessionsAreSteamTheDesktopAndProtonLaunchesFromTheLibrary() {
|
||||
assertTrue(NoSteamLaunch.windowsGames(SessionService.MODE_STEAM, null))
|
||||
assertTrue(NoSteamLaunch.windowsGames(SessionService.MODE_DESKTOP, null))
|
||||
for (program in listOf(NoSteamLaunch.PROTON_RUN, NoSteamLaunch.EPIC, NoSteamLaunch.BATTLENET)) {
|
||||
assertTrue(program, NoSteamLaunch.running(SessionService.MODE_RUN, program))
|
||||
assertTrue(program, NoSteamLaunch.windowsGames(SessionService.MODE_RUN, program))
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun otherProgramsAreNotWindowsGameSessions() {
|
||||
for (program in listOf("/usr/bin/retroarch", "/usr/local/bin/droiddeck-session", null)) {
|
||||
assertFalse("$program", NoSteamLaunch.running(SessionService.MODE_RUN, program))
|
||||
assertFalse("$program", NoSteamLaunch.windowsGames(SessionService.MODE_RUN, program))
|
||||
}
|
||||
assertFalse(NoSteamLaunch.running(SessionService.MODE_STEAM, NoSteamLaunch.PROTON_RUN))
|
||||
assertFalse(NoSteamLaunch.running(SessionService.MODE_DESKTOP, null))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user