mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 20:36:04 +00:00
fix: avoid incompatible Turnip selection and explain Steam startup failures
This commit is contained in:
1 parent
ffa40a15d5
commit
42de5f3dd1
14 files changed
+381
-6
No files matched your search
@@ -2001,9 +2001,17 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
if (line.contains(FEX_MISSING)) fexMissing = true
|
||||
}
|
||||
val steamSetup = com.droiddeck.launcher.session.SteamClientSetupFailure.find(text.lineSequence())
|
||||
val launchFailure = com.droiddeck.launcher.session.SessionLaunchFailure.find(text.lineSequence())
|
||||
if (steamSetup != null) {
|
||||
val message = getString(if (steamSetup.download) R.string.session_end_steam_download else R.string.session_end_steam_setup)
|
||||
EndHint(listOfNotNull(message, steamSetup.curlError).joinToString("\n"))
|
||||
} else if (launchFailure == com.droiddeck.launcher.session.SessionLaunchFailure.STEAM_ILLEGAL_INSTRUCTION) {
|
||||
val message = getString(R.string.session_end_steam_sigill)
|
||||
val fallback = if (SessionState.steamClientArch == "arm64") getString(R.string.session_end_steam_try_x64) else null
|
||||
EndHint(listOfNotNull(message, fallback).joinToString("\n"))
|
||||
} else if (launchFailure == com.droiddeck.launcher.session.SessionLaunchFailure.VULKAN_DEVICE_MISSING) {
|
||||
val adreno = com.droiddeck.launcher.gpu.GpuInfo.detect().family != com.droiddeck.launcher.gpu.GpuInfo.Family.NOT_ADRENO
|
||||
EndHint(getString(if (adreno) R.string.session_end_vulkan_device else R.string.session_end_gpu_unsupported))
|
||||
} else if (fexMissing) {
|
||||
val what = com.droiddeck.launcher.frontend.Library.nameForProgram(SessionState.program) ?: getString(R.string.session_end_program)
|
||||
EndHint(getString(R.string.session_end_fex_missing, what), evenOnSuccess = true)
|
||||
|
||||
@@ -29,6 +29,11 @@ import java.util.Locale
|
||||
object DeviceReport {
|
||||
private const val TAG = "DeviceReport"
|
||||
|
||||
internal fun cpuFeaturesSummary(cpuInfo: String): String = cpuInfo.lineSequence()
|
||||
.filter { it.substringBefore(':').trim() == "Features" }
|
||||
.map { it.substringAfter(':').trim().split(Regex("\\s+")).filter(String::isNotEmpty).joinToString(" ") }
|
||||
.filter(String::isNotEmpty).distinct().joinToString(" | ").ifEmpty { "not reported" }
|
||||
|
||||
fun write(context: Context, target: File, mode: String) {
|
||||
try {
|
||||
target.writeText(build(context, mode))
|
||||
@@ -141,6 +146,7 @@ object DeviceReport {
|
||||
|
||||
h("CPU and memory")
|
||||
k("Cores", CpuCores.all.size)
|
||||
k("CPU features", cpuFeaturesSummary(FileUtils.readString(File("/proc/cpuinfo")).orEmpty()))
|
||||
b.append("Core ceilings ")
|
||||
b.append(CpuCores.all.joinToString(", ") { c ->
|
||||
"cpu$c " + (CpuCores.maxGhz(c)?.let { String.format(Locale.US, "%.2f GHz", it) } ?: "?")
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
@@ -47,10 +48,16 @@ public final class TurnipDriver {
|
||||
|
||||
private final Context context;
|
||||
private final File contentDir;
|
||||
private final Supplier<GpuInfo> gpuDetector;
|
||||
|
||||
public TurnipDriver(Context context) {
|
||||
this(context, GpuInfo.Companion::detect);
|
||||
}
|
||||
|
||||
TurnipDriver(Context context, Supplier<GpuInfo> gpuDetector) {
|
||||
this.context = context;
|
||||
this.contentDir = new File(context.getFilesDir(), "graphics_driver");
|
||||
this.gpuDetector = gpuDetector;
|
||||
}
|
||||
|
||||
public String driverPath(String driverId) {
|
||||
@@ -284,7 +291,12 @@ public final class TurnipDriver {
|
||||
}
|
||||
String quest = QuestExperimental.INSTANCE.defaultAndroidDriver();
|
||||
if (quest != null) return quest;
|
||||
int model = GpuInfo.Companion.detect().getModel();
|
||||
GpuInfo gpu = gpuDetector.get();
|
||||
if (gpu.getFamily() == GpuInfo.Family.NOT_ADRENO) {
|
||||
Log.i(TAG, "not an Adreno GPU; leaving the display driver to the system");
|
||||
return null;
|
||||
}
|
||||
int model = gpu.getModel();
|
||||
Log.i(TAG, "gpu model: " + (model == 0 ? "unknown" : model));
|
||||
return chooseByModel(model, android.os.Build.VERSION.SDK_INT);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
enum class SessionLaunchFailure {
|
||||
STEAM_ILLEGAL_INSTRUCTION,
|
||||
VULKAN_DEVICE_MISSING;
|
||||
|
||||
companion object {
|
||||
private val ANSI = Regex("\u001b\\[[0-?]*[ -/]*[@-~]")
|
||||
private val STEAM_EXIT = Regex("== steam exited rc=(\\d+)")
|
||||
|
||||
fun find(lines: Sequence<String>): SessionLaunchFailure? {
|
||||
var steamStarted = false
|
||||
var illegalInstruction = false
|
||||
var missingDevice = false
|
||||
lines.forEach { raw ->
|
||||
val line = ANSI.replace(raw, "").trim()
|
||||
when {
|
||||
line.startsWith("== droiddeck-session ") -> {
|
||||
steamStarted = false
|
||||
illegalInstruction = false
|
||||
missingDevice = false
|
||||
}
|
||||
line.startsWith("== STEP ") && line.contains("starting the Steam client") -> {
|
||||
steamStarted = true
|
||||
illegalInstruction = false
|
||||
}
|
||||
STEAM_EXIT.matches(line) && steamStarted ->
|
||||
illegalInstruction = STEAM_EXIT.matchEntire(line)?.groupValues?.get(1) == "132"
|
||||
line.startsWith("[gamescope]") && line.contains("vulkan:") -> when {
|
||||
line.contains("failed to find physical device") -> missingDevice = true
|
||||
line.contains("selecting physical device") -> missingDevice = false
|
||||
}
|
||||
}
|
||||
}
|
||||
return when {
|
||||
illegalInstruction -> STEAM_ILLEGAL_INSTRUCTION
|
||||
missingDevice -> VULKAN_DEVICE_MISSING
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user