mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-05 20:45:43 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
66e238378e | ||
|
|
9971d8bbf0 | ||
|
|
41807e320f | ||
|
|
d7727d64e5 | ||
|
|
f533e9c5a7 | ||
|
|
b506652c36 | ||
|
|
60fba082e0 |
No files matched your search
@@ -898,7 +898,10 @@ static void take_dmabuf(struct surface *s, struct dmabuf_buffer *b, struct wl_re
|
||||
* the display layer draws on screen while the counter sat at 0.0 fps and 1000.0 ms. */
|
||||
if (s == g_hud_surface) {
|
||||
g_hud_alive_ns = now_ns();
|
||||
if (!repeat) { g_hud_last_ns = g_hud_alive_ns; g_hud_fresh = 1; droiddeck_on_game_frame(); }
|
||||
if (!repeat) { g_hud_last_ns = g_hud_alive_ns; g_hud_fresh = 1; droiddeck_on_game_frame();
|
||||
droiddeck_log("dd-source", "recv=%lld tick=%lld buffer=%u", (long long)g_hud_last_ns,
|
||||
(long long)g_tick_vsync_ns, wl_resource_get_id(buffer));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2337,6 +2340,7 @@ static void on_vsync(int64_t frame_time_ns) {
|
||||
}
|
||||
g_last_vsync_ns = now;
|
||||
g_tick_vsync_ns = frame_time_ns;
|
||||
droiddeck_log("dd-vtick", "frame=%lld dispatch=%lld", (long long)frame_time_ns, (long long)now);
|
||||
/* The app's surface may have been replaced or taken away since the last frame: apply that now
|
||||
* (the app never waits for us), and redraw the scene onto a new one. */
|
||||
if (vkp_apply_window_request()) g_dirty = 1;
|
||||
|
||||
@@ -116,7 +116,6 @@ class MainActivity : ComponentActivity() {
|
||||
private var frameGenLabel by mutableStateOf("")
|
||||
private var lossless by mutableStateOf(Lossless.State.NONE)
|
||||
private var showRemove by mutableStateOf(false)
|
||||
private var showResetSettings by mutableStateOf(false)
|
||||
private var showNonAdreno by mutableStateOf<LinuxRuntimeInstaller.Release?>(null)
|
||||
private var glThread by mutableStateOf(true)
|
||||
private var noGlError by mutableStateOf(true)
|
||||
@@ -351,8 +350,6 @@ class MainActivity : ComponentActivity() {
|
||||
private var touchMode by mutableStateOf(SessionPrefs.TOUCH_AUTO)
|
||||
private var suspendPolicy by mutableStateOf(SessionPrefs.SUSPEND_MANUAL)
|
||||
private var steamDownloadsInBackground by mutableStateOf(false)
|
||||
private var zramCompression by mutableStateOf(false)
|
||||
private var zramSupported by mutableStateOf<Boolean?>(null)
|
||||
private var oscMode by mutableStateOf(SessionPrefs.OSC_AUTO)
|
||||
private var backActionsInverted by mutableStateOf(false)
|
||||
private var gameStorage by mutableStateOf("")
|
||||
@@ -728,10 +725,6 @@ class MainActivity : ComponentActivity() {
|
||||
}
|
||||
}, "clear-logs").start()
|
||||
},
|
||||
onResetSettings = {
|
||||
if (SessionState.running) android.widget.Toast.makeText(this, R.string.setup_reset_settings_session_running, android.widget.Toast.LENGTH_LONG).show()
|
||||
else showResetSettings = true
|
||||
},
|
||||
onOffline = {
|
||||
OfflineMode.setEnabled(this, !OfflineMode.enabled(this))
|
||||
offline = OfflineMode.enabled(this)
|
||||
@@ -877,10 +870,6 @@ class MainActivity : ComponentActivity() {
|
||||
onConfirm = { showRemove = false; removeRuntime() },
|
||||
onDismiss = { showRemove = false },
|
||||
)
|
||||
if (showResetSettings) com.droiddeck.launcher.ui.ResetSettingsDialog(
|
||||
onConfirm = { gameProfiles -> resetSettings(gameProfiles) },
|
||||
onDismiss = { showResetSettings = false },
|
||||
)
|
||||
flood?.let { f -> com.droiddeck.launcher.ui.LaunchFlood(f.from, onProgress = { floodProgress = it }) { launchFlooded(f) } }
|
||||
returning?.let { r ->
|
||||
com.droiddeck.launcher.ui.FloodReturn(androidx.compose.ui.graphics.Color(r.color), r.to, onProgress = { floodProgress = it }) {
|
||||
@@ -1304,8 +1293,6 @@ class MainActivity : ComponentActivity() {
|
||||
touchMode = touchMode,
|
||||
suspendPolicy = suspendPolicy,
|
||||
steamDownloadsInBackground = steamDownloadsInBackground,
|
||||
zramCompression = if (mode == SessionService.MODE_STEAM) zramCompression else null,
|
||||
zramSupported = zramSupported,
|
||||
pipSupported = com.droiddeck.launcher.session.SessionPipController.supported(this),
|
||||
pipAutoEnter = pipAutoEnter,
|
||||
unfoldedControls = if (mode == SessionService.MODE_STEAM &&
|
||||
@@ -1364,7 +1351,6 @@ class MainActivity : ComponentActivity() {
|
||||
SessionPrefs.setSteamDownloadsInBackground(this, enabled)
|
||||
steamDownloadsInBackground = enabled
|
||||
},
|
||||
onZramCompression = { on -> SessionPrefs.setZramCompression(this, on); zramCompression = on },
|
||||
onPipAutoEnter = { on -> SessionPrefs.setPipAutoEnter(this, on); pipAutoEnter = on },
|
||||
onUnfoldedControls = { on -> SessionPrefs.setUnfoldedControls(this, on); unfoldedControls = on },
|
||||
onOsc = { o -> SessionPrefs.setOscMode(this, o); oscMode = o },
|
||||
@@ -1553,9 +1539,6 @@ class MainActivity : ComponentActivity() {
|
||||
// The sheet lifts at once, on what was last read; the slow part (driver files, a walk of the
|
||||
// added-games folders, the storage volumes) lands while it rises.
|
||||
Thread({
|
||||
val zram = com.droiddeck.launcher.core.ZramSupport.supported()
|
||||
val zramOn = SessionPrefs.zramCompression(this)
|
||||
ui.post { zramSupported = zram; zramCompression = zramOn }
|
||||
drivers.refreshDrivers()
|
||||
val storage = GameStorage.options(this)
|
||||
val deckyInstalled = if (mode == SessionService.MODE_STEAM) DeckyManager.installed(this) else null
|
||||
@@ -1759,22 +1742,6 @@ class MainActivity : ComponentActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
/** Setup's Reset all settings; the activity is recreated so every screen reads the defaults (and the language) again. */
|
||||
private fun resetSettings(gameProfiles: Boolean) {
|
||||
if (SessionState.running) return
|
||||
val scopes = steamGames.map { it.profileKey }
|
||||
Thread({
|
||||
val ok = com.droiddeck.launcher.session.SettingsReset.resetAll(this, gameProfiles, scopes)
|
||||
ui.post {
|
||||
if (isDestroyed) return@post
|
||||
com.droiddeck.launcher.core.AppLanguage.setChosen(this, com.droiddeck.launcher.core.AppLanguage.SYSTEM)
|
||||
if (!ok) android.widget.Toast.makeText(this, R.string.setup_reset_settings_partial, android.widget.Toast.LENGTH_LONG).show()
|
||||
com.droiddeck.launcher.ui.Motion.refresh(this)
|
||||
recreate()
|
||||
}
|
||||
}, "reset-settings").start()
|
||||
}
|
||||
|
||||
private fun removeRuntime() {
|
||||
if (runtimeChangesBlocked()) return
|
||||
val removal = LinuxRuntimeInstaller.beginUninstall(this) ?: return
|
||||
|
||||
@@ -1349,7 +1349,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
// Turnip, not the system Adreno driver: importing the dma-bufs gamescope commits needs
|
||||
// VK_EXT_image_drm_format_modifier, which the system driver does not implement.
|
||||
val turnip = TurnipDriver(this)
|
||||
com.droiddeck.launcher.gpu.DriverSetupLog.write(this, "surface.driver-setup")
|
||||
val driverId = if (CompositorHost.isStarted) null else turnip.install()
|
||||
|
||||
// The output size belongs to the session, not to the Surface: gamescope's display is
|
||||
@@ -1418,7 +1417,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
)
|
||||
Log.i(TAG, "hdr: " + (if (on) "on" else if (wanted) "wanted but ${probe.reason}" else "off") + " · display ${probe.formats.ifEmpty { "SDR" }}")
|
||||
}
|
||||
com.droiddeck.launcher.gpu.DriverSetupLog.write(this, "compositor.start driver=$driverId")
|
||||
CompositorHost.startOrAttach(
|
||||
holder.surface, runtimeDir.path,
|
||||
driverId?.let { turnip.driverPath(it) }, driverId?.let { turnip.libraryName(it) },
|
||||
|
||||
@@ -22,11 +22,7 @@ object AppLanguage {
|
||||
const val SYSTEM = ""
|
||||
|
||||
/** The languages the app ships, as BCP 47 tags, in the order the picker lists them. */
|
||||
val supported: List<String> = listOf(
|
||||
"en", "id", "ms", "cs", "da", "de", "es", "es-419", "fr", "it", "hu", "nl", "nb", "pl",
|
||||
"pt-BR", "pt-PT", "ro", "fi", "sv", "vi", "tr", "el", "bg", "ru", "uk", "ar", "hi", "th",
|
||||
"ja", "ko", "zh-CN", "zh-TW", "zh-HK",
|
||||
)
|
||||
val supported: List<String> = listOf("en", "es", "fr", "ru", "ja", "ko", "zh-CN", "zh-TW", "zh-HK")
|
||||
|
||||
private const val PREFS = "language"
|
||||
private const val KEY = "app_language"
|
||||
@@ -101,18 +97,9 @@ object AppLanguage {
|
||||
// 0 leaves it undefined, so only the locale is changed.
|
||||
private fun override(locale: Locale) = Configuration().apply { fontScale = 0f; setLocales(LocaleList(locale)) }
|
||||
|
||||
private val latinAmerica = setOf(
|
||||
"419", "AR", "BO", "BR", "BZ", "CL", "CO", "CR", "CU", "DO", "EC", "GT", "HN", "MX", "NI", "PA",
|
||||
"PE", "PR", "PY", "SV", "US", "UY", "VE",
|
||||
)
|
||||
|
||||
/** Which of the app's languages [locale] reads as, or null when the app does not ship it. */
|
||||
fun supportedTag(locale: Locale): String? = when (locale.language) {
|
||||
"en", "fr", "ru", "ja", "ko", "ms", "cs", "da", "de", "it", "hu", "nl", "nb", "pl", "ro", "fi",
|
||||
"sv", "vi", "tr", "el", "bg", "uk", "ar", "hi", "th" -> locale.language
|
||||
"in", "id" -> "id"
|
||||
"es" -> if (locale.country in latinAmerica) "es-419" else "es"
|
||||
"pt" -> if (locale.country.isEmpty() || locale.country == "BR") "pt-BR" else "pt-PT"
|
||||
"en", "es", "fr", "ru", "ja", "ko" -> locale.language
|
||||
"zh" -> when {
|
||||
locale.script == "Hans" -> "zh-CN"
|
||||
locale.country == "HK" || locale.country == "MO" -> "zh-HK"
|
||||
@@ -129,33 +116,9 @@ object AppLanguage {
|
||||
/** A language's name in that language, for the picker: what a reader of it looks for. */
|
||||
fun nativeName(tag: String): String = when (tag) {
|
||||
"en" -> "English"
|
||||
"id" -> "Bahasa Indonesia"
|
||||
"ms" -> "Bahasa Melayu"
|
||||
"cs" -> "Čeština"
|
||||
"da" -> "Dansk"
|
||||
"de" -> "Deutsch"
|
||||
"es" -> "Español (España)"
|
||||
"es-419" -> "Español (Latinoamérica)"
|
||||
"es" -> "Español"
|
||||
"fr" -> "Français"
|
||||
"it" -> "Italiano"
|
||||
"hu" -> "Magyar"
|
||||
"nl" -> "Nederlands"
|
||||
"nb" -> "Norsk bokmål"
|
||||
"pl" -> "Polski"
|
||||
"pt-BR" -> "Português (Brasil)"
|
||||
"pt-PT" -> "Português (Portugal)"
|
||||
"ro" -> "Română"
|
||||
"fi" -> "Suomi"
|
||||
"sv" -> "Svenska"
|
||||
"vi" -> "Tiếng Việt"
|
||||
"tr" -> "Türkçe"
|
||||
"el" -> "Ελληνικά"
|
||||
"bg" -> "Български"
|
||||
"ru" -> "Русский"
|
||||
"uk" -> "Українська"
|
||||
"ar" -> "العربية"
|
||||
"hi" -> "हिन्दी"
|
||||
"th" -> "ไทย"
|
||||
"ja" -> "日本語"
|
||||
"ko" -> "한국어"
|
||||
"zh-CN" -> "简体中文"
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
package com.droiddeck.launcher.core
|
||||
|
||||
import android.app.ActivityManager
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import java.io.File
|
||||
|
||||
/** Whether the client's memory can be paged out to compressed swap: MADV_PAGEOUT (Linux 5.4) and a zram or other swap device. */
|
||||
object ZramSupport {
|
||||
private const val GIB = 1L shl 30
|
||||
|
||||
fun supported(): Boolean = kernelAtLeast(System.getProperty("os.version").orEmpty(), 5, 4) && swapTotalKb() > 0
|
||||
|
||||
fun recommended(context: Context): Boolean {
|
||||
if (!supported()) return false
|
||||
val memory = ActivityManager.MemoryInfo()
|
||||
context.getSystemService(ActivityManager::class.java).getMemoryInfo(memory)
|
||||
val advertised = if (Build.VERSION.SDK_INT >= 34) memory.advertisedMem else 0L
|
||||
return belowTwelveGb(advertised, memory.totalMem)
|
||||
}
|
||||
|
||||
fun belowTwelveGb(advertisedBytes: Long, totalBytes: Long): Boolean =
|
||||
if (advertisedBytes > 0) advertisedBytes < 11 * GIB else totalBytes < 10 * GIB
|
||||
|
||||
fun kernelAtLeast(release: String, major: Int, minor: Int): Boolean {
|
||||
val parts = Regex("^(\\d+)\\.(\\d+)").find(release)?.groupValues ?: return false
|
||||
val ma = parts[1].toInt()
|
||||
val mi = parts[2].toInt()
|
||||
return ma > major || (ma == major && mi >= minor)
|
||||
}
|
||||
|
||||
fun swapTotalKb(meminfo: List<String> = runCatching { File("/proc/meminfo").readLines() }.getOrDefault(emptyList())): Long =
|
||||
meminfo.firstOrNull { it.startsWith("SwapTotal:") }
|
||||
?.substringAfter(':')?.trim()?.substringBefore(' ')?.toLongOrNull() ?: 0L
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package com.droiddeck.launcher.gpu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
|
||||
/** Setup breadcrumbs survive failures before a session log exists. No account data. */
|
||||
public final class DriverSetupLog {
|
||||
private DriverSetupLog() {}
|
||||
|
||||
public static synchronized void write(Context context, String stage) {
|
||||
Log.i("DriverSetup", stage);
|
||||
append(context.getFilesDir(), stage);
|
||||
try { append(context.getExternalFilesDir(null), stage); }
|
||||
catch (Exception ignored) { /* External storage is optional. */ }
|
||||
}
|
||||
|
||||
private static void append(File directory, String stage) {
|
||||
if (directory == null) return;
|
||||
try {
|
||||
directory.mkdirs();
|
||||
File file = new File(directory, "driver-setup.txt");
|
||||
// Keep the latest run's breadcrumbs bounded across repeated attempts.
|
||||
try (FileWriter out = new FileWriter(file, file.length() < 131072)) {
|
||||
out.write(System.currentTimeMillis() + " " + stage + "\n");
|
||||
}
|
||||
} catch (Exception ignored) { /* Diagnostics must never prevent startup. */ }
|
||||
}
|
||||
}
|
||||
@@ -45,16 +45,13 @@ import java.util.zip.ZipInputStream;
|
||||
*/
|
||||
public final class TurnipDriver {
|
||||
private static final String TAG = "TurnipDriver";
|
||||
/** Pinned A6xx/A7xx upstream build; used as the A6xx offline fallback. */
|
||||
private static final String DRIVER_A6XX = "turnip26.3.0-a6xx";
|
||||
/** Adreno 7xx (8 Gen 2/3, e.g. the Pocket FIT's A750). */
|
||||
private static final String DRIVER_A7XX = "turnip25.1.0";
|
||||
/** Adreno 8xx (8 Elite, e.g. a Fold 8's A830). */
|
||||
private static final String DRIVER_A8XX = "turnip-sdk36";
|
||||
/** The two the apk carries; never removable, unpacked on demand. */
|
||||
public static final List<String> BUNDLED = Collections.unmodifiableList(Arrays.asList(
|
||||
DRIVER_A7XX, DRIVER_A8XX, com.droiddeck.launcher.session.QuestExperimental.DRIVER,
|
||||
DRIVER_A6XX, com.droiddeck.launcher.session.QuestExperimental.DRIVER_A6XX));
|
||||
DRIVER_A7XX, DRIVER_A8XX, com.droiddeck.launcher.session.QuestExperimental.DRIVER));
|
||||
/** Overrides the pick, for a device we cannot reach: a7xx, a8xx or system. */
|
||||
private static final String OVERRIDE_FILE = "Download/droiddeck-driver";
|
||||
/** Bundled drivers the user deleted: hidden from the list, their unpacked copy removed. */
|
||||
@@ -292,14 +289,12 @@ public final class TurnipDriver {
|
||||
*/
|
||||
public String install() {
|
||||
String id = choose();
|
||||
DriverSetupLog.write(context, "install.begin driver=" + id);
|
||||
if (id == null) return null;
|
||||
File dir = new File(contentDir, id);
|
||||
if (!new File(dir, "meta.json").isFile()) {
|
||||
FileUtils.delete(dir);
|
||||
if (!TarZst.extractAsset(context, "graphics_driver/adrenotools-" + id + ".tzst", dir)) {
|
||||
Log.e(TAG, "could not unpack " + id);
|
||||
DriverSetupLog.write(context, "install.unpack-failed driver=" + id);
|
||||
FileUtils.delete(dir);
|
||||
return null;
|
||||
}
|
||||
@@ -310,7 +305,6 @@ public final class TurnipDriver {
|
||||
return null;
|
||||
}
|
||||
Log.i(TAG, "graphics driver " + id + " (" + library + ")");
|
||||
DriverSetupLog.write(context, "install.ready driver=" + id + " library=" + library);
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -344,7 +338,6 @@ public final class TurnipDriver {
|
||||
if (forced.startsWith("system")) return null;
|
||||
if (forced.startsWith("a8")) return DRIVER_A8XX;
|
||||
if (forced.startsWith("a7")) return DRIVER_A7XX;
|
||||
if (forced.startsWith("a6")) return DRIVER_A6XX;
|
||||
}
|
||||
String model = gpuModel();
|
||||
Log.i(TAG, "gpu model: " + (model == null ? "unknown" : model));
|
||||
@@ -355,7 +348,6 @@ public final class TurnipDriver {
|
||||
char generation = m.group(1).charAt(0);
|
||||
if (generation >= '8') return DRIVER_A8XX;
|
||||
if (generation == '7') return DRIVER_A7XX;
|
||||
if (generation == '6') return DRIVER_A6XX;
|
||||
}
|
||||
}
|
||||
// Nothing to go on: Android 16 shipped with the 8 Elite, so treat a new device as 8xx.
|
||||
|
||||
@@ -2,12 +2,10 @@ package com.droiddeck.launcher.input
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.text.InputType
|
||||
import android.view.KeyCharacterMap
|
||||
import android.view.KeyEvent
|
||||
import android.view.View
|
||||
import android.view.WindowInsets
|
||||
import android.view.inputmethod.BaseInputConnection
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import android.view.inputmethod.InputConnection
|
||||
@@ -55,10 +53,7 @@ class KeyboardHost(
|
||||
return KeyConnection()
|
||||
}
|
||||
|
||||
fun toggle() = if (shown && imeVisible()) hide() else show()
|
||||
|
||||
private fun imeVisible() = Build.VERSION.SDK_INT < Build.VERSION_CODES.R ||
|
||||
rootWindowInsets?.isVisible(WindowInsets.Type.ime()) != false
|
||||
fun toggle() = if (shown) hide() else show()
|
||||
|
||||
fun show() {
|
||||
shown = true
|
||||
|
||||
@@ -13,7 +13,6 @@ import android.util.Log
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.input.SteamTouchConfig.Element
|
||||
import java.util.concurrent.Executors
|
||||
import kotlin.math.abs
|
||||
@@ -336,7 +335,7 @@ class SteamTouchControls(
|
||||
if (editing) {
|
||||
text.textSize = r * 0.3f
|
||||
text.color = Color.argb(alpha / 2, 255, 255, 255)
|
||||
canvas.drawText(context.getString(R.string.deck_surface_trackpad), x, y - (text.descent() + text.ascent()) / 2, text)
|
||||
canvas.drawText("Trackpad", x, y - (text.descent() + text.ascent()) / 2, text)
|
||||
}
|
||||
}
|
||||
SteamTouchConfig.STEAM -> {
|
||||
@@ -580,7 +579,7 @@ class SteamTouchControls(
|
||||
SteamTouchConfig.STEAM -> "STEAM"
|
||||
SteamTouchConfig.THUMB -> "…"
|
||||
SteamTouchConfig.KEYBOARD -> "⌨"
|
||||
SteamTouchConfig.PASTE -> context.getString(R.string.touch_paste)
|
||||
SteamTouchConfig.PASTE -> "Paste"
|
||||
SteamTouchConfig.SELECT -> "⧉"
|
||||
SteamTouchConfig.START -> "☰"
|
||||
SteamTouchConfig.BUMPER_LEFT -> "LB"
|
||||
@@ -881,15 +880,15 @@ class SteamTouchControls(
|
||||
}
|
||||
|
||||
private fun controlName(type: Int) = when (type) {
|
||||
SteamTouchConfig.DPAD -> context.getString(R.string.touch_dpad)
|
||||
SteamTouchConfig.JOYSTICK_LEFT -> context.getString(R.string.touch_left_stick)
|
||||
SteamTouchConfig.JOYSTICK_RIGHT -> context.getString(R.string.touch_right_stick)
|
||||
SteamTouchConfig.TRACKPAD_LEFT -> context.getString(R.string.deck_left_trackpad)
|
||||
SteamTouchConfig.TRACKPAD_RIGHT -> context.getString(R.string.deck_right_trackpad)
|
||||
SteamTouchConfig.TRACKPAD_CENTER -> context.getString(R.string.deck_surface_trackpad)
|
||||
SteamTouchConfig.DPAD -> "D-pad"
|
||||
SteamTouchConfig.JOYSTICK_LEFT -> "Left stick"
|
||||
SteamTouchConfig.JOYSTICK_RIGHT -> "Right stick"
|
||||
SteamTouchConfig.TRACKPAD_LEFT -> "Left trackpad"
|
||||
SteamTouchConfig.TRACKPAD_RIGHT -> "Right trackpad"
|
||||
SteamTouchConfig.TRACKPAD_CENTER -> "Trackpad"
|
||||
SteamTouchConfig.STEAM -> "Steam"
|
||||
SteamTouchConfig.THUMB -> context.getString(R.string.touch_menu)
|
||||
SteamTouchConfig.KEYBOARD -> context.getString(R.string.touch_keyboard)
|
||||
SteamTouchConfig.THUMB -> "Menu"
|
||||
SteamTouchConfig.KEYBOARD -> "Keyboard"
|
||||
else -> label(type)
|
||||
}
|
||||
|
||||
@@ -900,22 +899,22 @@ class SteamTouchControls(
|
||||
val list = android.widget.LinearLayout(context).apply { orientation = android.widget.LinearLayout.VERTICAL; setPadding((12 * density).toInt(), 0, (12 * density).toInt(), 0) }
|
||||
var close: () -> Unit = {}
|
||||
val copied = prefs.getString("copiedLayout", null)
|
||||
fun item(name: Int, enabled: Boolean = true, action: () -> Unit) = list.addView(android.widget.Button(context).apply {
|
||||
setText(name)
|
||||
fun item(name: String, enabled: Boolean = true, action: () -> Unit) = list.addView(android.widget.Button(context).apply {
|
||||
text = name
|
||||
isAllCaps = false
|
||||
isEnabled = enabled
|
||||
setOnClickListener { close(); action(); invalidate() }
|
||||
})
|
||||
item(R.string.touch_color_opacity) { pickColor() }
|
||||
item(R.string.touch_copy_layout) {
|
||||
item("Colour and opacity…") { pickColor() }
|
||||
item("Copy this layout") {
|
||||
prefs.edit().putString("copiedLayout", (editElements + hidden).joinToString(";") {
|
||||
"${it.type},${it.visible},${it.x},${it.y},${it.xScale},${it.yScale}"
|
||||
}).apply()
|
||||
Toast.makeText(context, R.string.touch_layout_copied, Toast.LENGTH_SHORT).show()
|
||||
Toast.makeText(context, "Layout copied; paste it into any game's touch layout", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
item(R.string.touch_paste_layout, copied != null) { pasteLayout(copied ?: "") }
|
||||
item(R.string.touch_reset_layout) { resetEditSet() }
|
||||
close = SteamTouchIconPicker.showPanel(host, context.getString(R.string.ctrl_layout), list, listOf(context.getString(R.string.common_close) to {}))
|
||||
item("Paste copied layout", copied != null) { pasteLayout(copied ?: "") }
|
||||
item("Reset to Steam's default") { resetEditSet() }
|
||||
close = SteamTouchIconPicker.showPanel(host, "Layout", list, listOf("Close" to {}))
|
||||
}
|
||||
|
||||
/** A copied layout onto this action set: each control the set has takes the copied place. */
|
||||
@@ -986,12 +985,11 @@ class SteamTouchControls(
|
||||
RectF(frame.left + l * s, frame.top + t * s, frame.left + r * s, frame.top + b * s)
|
||||
|
||||
private fun text(canvas: Canvas, str: String, x: Float, y: Float, size: Float, color: Int = Color.WHITE, bold: Boolean = true,
|
||||
align: Paint.Align = Paint.Align.CENTER, maxWidth: Float = 0f) {
|
||||
align: Paint.Align = Paint.Align.CENTER) {
|
||||
val p = Paint(Paint.ANTI_ALIAS_FLAG).apply {
|
||||
this.color = color; textSize = size; textAlign = align
|
||||
typeface = if (bold) android.graphics.Typeface.DEFAULT_BOLD else android.graphics.Typeface.DEFAULT
|
||||
}
|
||||
if (maxWidth > 0f) p.measureText(str).let { if (it > maxWidth) p.textSize = size * maxWidth / it }
|
||||
canvas.drawText(str, x, y - (p.descent() + p.ascent()) / 2, p)
|
||||
}
|
||||
|
||||
@@ -1006,7 +1004,7 @@ class SteamTouchControls(
|
||||
canvas.drawRoundRect(r, radius, radius, Paint(Paint.ANTI_ALIAS_FLAG).apply { color = line2; style = Paint.Style.STROKE; strokeWidth = 1.2f * s })
|
||||
}
|
||||
val ink = when { !enabled -> Color.argb(110, 242, 244, 247); primary -> onAccent; else -> onSurface }
|
||||
text(canvas, text, r.centerX(), r.centerY(), 14f * s, ink, maxWidth = r.width() - 16f * s)
|
||||
text(canvas, text, r.centerX(), r.centerY(), 14f * s, ink)
|
||||
if (enabled) hots += Hot(r, onTap)
|
||||
}
|
||||
|
||||
@@ -1046,7 +1044,7 @@ class SteamTouchControls(
|
||||
BIG_PICTURE -> "Steam"
|
||||
else -> gameNames[appId] ?: run {
|
||||
val app = appId
|
||||
gameNames[app] = context.getString(R.string.touch_app_id, app)
|
||||
gameNames[app] = "app $app"
|
||||
loader.execute {
|
||||
val name = SteamTouchConfig.gameName(context, app) ?: return@execute
|
||||
handler.post { gameNames[app] = name; invalidate() }
|
||||
@@ -1063,7 +1061,7 @@ class SteamTouchControls(
|
||||
// Header: power (DroidDeck's own menu: stop, settings), the Steam mark, what is running, close.
|
||||
iconButton(canvas, ref(f, s, 494f, 18f, 531f, 55f), false, { menuOpen = false; onMenu() }) { c, r, col -> drawPower(c, r, col) }
|
||||
drawMark(canvas, f.left + 104f * s, f.top + 37f * s, 13f * s)
|
||||
text(canvas, context.getString(R.string.touch_title), f.left + 124f * s, f.top + 30f * s, 14f * s, onSurface, align = Paint.Align.LEFT)
|
||||
text(canvas, "Touch controls", f.left + 124f * s, f.top + 30f * s, 14f * s, onSurface, align = Paint.Align.LEFT)
|
||||
text(canvas, gameName(), f.left + 124f * s, f.top + 46f * s, 11f * s, muted, bold = false, align = Paint.Align.LEFT)
|
||||
closeButton(canvas, f, s) { menuOpen = false }
|
||||
val controller = options.inputMode != SteamTouchConfig.INPUT_MOUSE
|
||||
@@ -1073,10 +1071,10 @@ class SteamTouchControls(
|
||||
m -> SteamTouchConfig.INPUT_MOUSE
|
||||
else -> SteamTouchConfig.INPUT_CONTROLLER
|
||||
}))
|
||||
tile(canvas, ref(f, s, 45f, 81f, 249f, 271f), s, context.getString(R.string.touch_controller), controller, { setModes(!controller, mouse || controller) }) { c, r, col ->
|
||||
tile(canvas, ref(f, s, 45f, 81f, 249f, 271f), s, "Touch Controller", controller, { setModes(!controller, mouse || controller) }) { c, r, col ->
|
||||
drawPhonePad(c, r, col)
|
||||
}
|
||||
tile(canvas, ref(f, s, 271f, 81f, 475f, 271f), s, context.getString(R.string.touch_mouse), mouse, { setModes(controller || mouse, !mouse) }) { c, r, col ->
|
||||
tile(canvas, ref(f, s, 271f, 81f, 475f, 271f), s, "Mouse", mouse, { setModes(controller || mouse, !mouse) }) { c, r, col ->
|
||||
drawMouse(c, r, col, crossed = false)
|
||||
}
|
||||
// Under the controller: gyroscope, fade, vibrate on touch.
|
||||
@@ -1104,13 +1102,10 @@ class SteamTouchControls(
|
||||
val speed = speeds.indexOfFirst { abs(it - options.trackpadSensitivity) < 0.2f }.coerceAtLeast(1)
|
||||
iconButton(canvas, ref(f, s, 412f, 278f, 475f, 318f), mouse && relative, {
|
||||
setOptions(options.copy(trackpadSensitivity = speeds[(speed + 1) % speeds.size]))
|
||||
}) { c, r, col ->
|
||||
val name = context.getString(listOf(R.string.touch_speed_slow, R.string.touch_speed_normal, R.string.touch_speed_fast)[speed])
|
||||
text(c, name, r.centerX(), r.centerY(), r.height() * 0.32f, col, maxWidth = r.width() - 6f * s)
|
||||
}
|
||||
}) { c, r, col -> text(c, listOf("Slow", "Normal", "Fast")[speed], r.centerX(), r.centerY(), r.height() * 0.32f, col) }
|
||||
drawVolume(canvas, f, s)
|
||||
blueButton(canvas, ref(f, s, 45f, 329f, 249f, 372f), context.getString(R.string.touch_edit_layout), s, primary = true) { menuOpen = false; startEditing() }
|
||||
blueButton(canvas, ref(f, s, 271f, 329f, 475f, 372f), context.getString(R.string.touch_droiddeck_menu), s) { menuOpen = false; onMenu() }
|
||||
blueButton(canvas, ref(f, s, 45f, 329f, 249f, 372f), "Edit layout", s, primary = true) { menuOpen = false; startEditing() }
|
||||
blueButton(canvas, ref(f, s, 271f, 329f, 475f, 372f), "DroidDeck menu", s) { menuOpen = false; onMenu() }
|
||||
}
|
||||
|
||||
private val audio by lazy { context.getSystemService(Context.AUDIO_SERVICE) as android.media.AudioManager }
|
||||
@@ -1178,7 +1173,7 @@ class SteamTouchControls(
|
||||
canvas.drawRoundRect(r, radius, radius, Paint(Paint.ANTI_ALIAS_FLAG).apply {
|
||||
color = if (on) accent else line; style = Paint.Style.STROKE; strokeWidth = (if (on) 2f else 1.2f) * s
|
||||
})
|
||||
text(canvas, title, r.left + 16f * s, r.top + 22f * s, 14f * s, onSurface, align = Paint.Align.LEFT, maxWidth = r.width() - 72f * s)
|
||||
text(canvas, title, r.left + 16f * s, r.top + 22f * s, 14f * s, onSurface, align = Paint.Align.LEFT)
|
||||
// A switch, top right.
|
||||
val sw = RectF(r.right - 50f * s, r.top + 12f * s, r.right - 14f * s, r.top + 32f * s)
|
||||
canvas.drawRoundRect(sw, sw.height() / 2, sw.height() / 2, Paint(Paint.ANTI_ALIAS_FLAG).apply { color = if (on) accent else line2 })
|
||||
@@ -1186,7 +1181,7 @@ class SteamTouchControls(
|
||||
Paint(Paint.ANTI_ALIAS_FLAG).apply { color = if (on) onAccent else muted })
|
||||
val artRect = RectF(r.centerX() - 58f * s, r.top + 62f * s, r.centerX() + 58f * s, r.top + 140f * s)
|
||||
art(canvas, artRect, if (on) onSurface else muted)
|
||||
text(canvas, context.getString(if (on) R.string.touch_on else R.string.touch_off), r.left + 16f * s, r.bottom - 18f * s, 12f * s, if (on) accent else muted, bold = false, align = Paint.Align.LEFT)
|
||||
text(canvas, if (on) "On" else "Off", r.left + 16f * s, r.bottom - 18f * s, 12f * s, if (on) accent else muted, bold = false, align = Paint.Align.LEFT)
|
||||
hots += Hot(r, toggle)
|
||||
}
|
||||
|
||||
@@ -1199,9 +1194,9 @@ class SteamTouchControls(
|
||||
closeButton(canvas, f, s) { save() }
|
||||
val sets = SteamTouchConfig.actionSets(config)
|
||||
val setName = sets.firstOrNull { it.first == editSet }?.second
|
||||
val title = if (sets.size > 1 && setName != null) "${gameName()} · $setName" else "${gameName()} ${config.title ?: context.getString(R.string.ctrl_layout)}"
|
||||
text(canvas, title, f.centerX(), f.top + 30f * s, 14f * s, onSurface, maxWidth = f.width() - 200f * s)
|
||||
text(canvas, context.getString(R.string.touch_drag_hint), f.centerX(), f.top + 47f * s, 11f * s, muted, bold = false, maxWidth = f.width() - 200f * s)
|
||||
val title = if (sets.size > 1 && setName != null) "${gameName()} · $setName" else "${gameName()} ${config.title ?: "Layout"}"
|
||||
text(canvas, title, f.centerX(), f.top + 30f * s, 14f * s, onSurface)
|
||||
text(canvas, "Drag controls onto the screen", f.centerX(), f.top + 47f * s, 11f * s, muted, bold = false)
|
||||
if (sets.size > 1) {
|
||||
arrowPill(canvas, ref(f, s, 120f, 26f, 150f, 44f), -1) { stepEditSet(-1) }
|
||||
arrowPill(canvas, ref(f, s, 474f, 26f, 504f, 44f), 1) { stepEditSet(1) }
|
||||
@@ -1256,8 +1251,8 @@ class SteamTouchControls(
|
||||
shader = android.graphics.RadialGradient(wheel.centerX(), wheel.centerY(), wheel.width() / 2f, Color.WHITE, Color.TRANSPARENT, android.graphics.Shader.TileMode.CLAMP)
|
||||
})
|
||||
hots += Hot(wheel, { pickColor() })
|
||||
blueButton(canvas, ref(f, s, 45f, 329f, 232f, 372f), context.getString(R.string.touch_arrange), s, primary = true) { trayOpen = false }
|
||||
blueButton(canvas, ref(f, s, 254f, 329f, 441f, 372f), context.getString(R.string.touch_discard), s) { stopEditing() }
|
||||
blueButton(canvas, ref(f, s, 45f, 329f, 232f, 372f), "Arrange", s, primary = true) { trayOpen = false }
|
||||
blueButton(canvas, ref(f, s, 254f, 329f, 441f, 372f), "Discard", s) { stopEditing() }
|
||||
}
|
||||
|
||||
private fun arrowPill(canvas: Canvas, r: RectF, dir: Int, onTap: () -> Unit) {
|
||||
@@ -1295,10 +1290,7 @@ class SteamTouchControls(
|
||||
return RectF(x - r, y - r, x + r, y + r)
|
||||
}
|
||||
|
||||
private val contextLabels by lazy {
|
||||
listOf(R.string.touch_icon, R.string.touch_narrower, R.string.touch_wider, R.string.touch_shorter, R.string.touch_taller, R.string.touch_hide)
|
||||
.map(context::getString)
|
||||
}
|
||||
private val contextLabels = listOf("Icon", "W−", "W+", "H−", "H+", "Hide")
|
||||
|
||||
private fun contextRects(): List<RectF> {
|
||||
val e = editElements.getOrNull(selected) ?: return emptyList()
|
||||
@@ -1321,11 +1313,11 @@ class SteamTouchControls(
|
||||
canvas.drawRoundRect(m, m.width() * 0.15f, m.width() * 0.15f, p)
|
||||
drawDots(canvas, m.centerX(), m.centerY() - m.height() * 0.1f, m.width() * 0.5f, Color.WHITE)
|
||||
hots += Hot(m, { trayOpen = true })
|
||||
if (saving) text(canvas, context.getString(R.string.touch_saving), width / 2f, height * 0.08f, 22f * max(unit(), 0.6f))
|
||||
if (saving) text(canvas, "Saving…", width / 2f, height * 0.08f, 22f * max(unit(), 0.6f))
|
||||
contextRects().forEachIndexed { i, r ->
|
||||
canvas.drawRoundRect(r, r.height() * 0.3f, r.height() * 0.3f, Paint(Paint.ANTI_ALIAS_FLAG).apply { color = surface })
|
||||
canvas.drawRoundRect(r, r.height() * 0.3f, r.height() * 0.3f, Paint(Paint.ANTI_ALIAS_FLAG).apply { color = line2; style = Paint.Style.STROKE; strokeWidth = 1.2f })
|
||||
text(canvas, contextLabels[i], r.centerX(), r.centerY(), r.height() * 0.4f, onSurface, bold = false, maxWidth = r.width() - 6f)
|
||||
text(canvas, contextLabels[i], r.centerX(), r.centerY(), r.height() * 0.4f, onSurface, bold = false)
|
||||
hots += Hot(r, { contextTool(i) })
|
||||
}
|
||||
}
|
||||
@@ -1456,14 +1448,12 @@ class SteamTouchControls(
|
||||
val ref = visual?.ref
|
||||
val binding = visual?.binding
|
||||
if (ref == null || binding == null) {
|
||||
Toast.makeText(context, R.string.touch_no_binding, Toast.LENGTH_SHORT).show()
|
||||
Toast.makeText(context, "This control has no binding in Steam to put an icon on", Toast.LENGTH_SHORT).show()
|
||||
return
|
||||
}
|
||||
val name = if (e.type == SteamTouchConfig.DPAD) {
|
||||
context.getString(listOf(R.string.touch_dpad_up, R.string.touch_dpad_down, R.string.touch_dpad_left, R.string.touch_dpad_right)[selectedArm])
|
||||
} else label(e.type)
|
||||
val name = if (e.type == SteamTouchConfig.DPAD) "D-pad " + listOf("up", "down", "left", "right")[selectedArm] else label(e.type)
|
||||
val host = parent as? android.view.ViewGroup ?: return
|
||||
SteamTouchIconPicker(context, host, appId, context.getString(R.string.touch_icon_for, name), binding) { picked ->
|
||||
SteamTouchIconPicker(context, host, appId, "Icon for $name", binding) { picked ->
|
||||
pendingBindings[ref] = picked
|
||||
rebuildVisuals()
|
||||
invalidate()
|
||||
@@ -1490,9 +1480,9 @@ class SteamTouchControls(
|
||||
}
|
||||
}, android.widget.LinearLayout.LayoutParams(dp(30), dp(30)).apply { marginEnd = dp(6) })
|
||||
}
|
||||
root.addView(android.widget.TextView(context).apply { setText(R.string.ctrl_color) })
|
||||
root.addView(android.widget.TextView(context).apply { text = "Colour" })
|
||||
root.addView(android.widget.HorizontalScrollView(context).apply { addView(swatchRow) })
|
||||
root.addView(android.widget.TextView(context).apply { setText(R.string.ctrl_opacity); setPadding(0, dp(12), 0, 0) })
|
||||
root.addView(android.widget.TextView(context).apply { text = "Opacity"; setPadding(0, dp(12), 0, 0) })
|
||||
val opacityRow = android.widget.LinearLayout(context)
|
||||
listOf(20, 35, 50, 65, 80, 100).forEach { percent ->
|
||||
opacityRow.addView(android.widget.Button(context).apply {
|
||||
@@ -1507,7 +1497,7 @@ class SteamTouchControls(
|
||||
}
|
||||
root.addView(android.widget.HorizontalScrollView(context).apply { addView(opacityRow) })
|
||||
val host = parent as? android.view.ViewGroup ?: return
|
||||
SteamTouchIconPicker.showPanel(host, context.getString(R.string.touch_layout_color), root, listOf(context.getString(R.string.touch_done) to {}))
|
||||
SteamTouchIconPicker.showPanel(host, "Touch layout colour", root, listOf("Done" to {}))
|
||||
}
|
||||
|
||||
private fun save() {
|
||||
@@ -1538,11 +1528,11 @@ class SteamTouchControls(
|
||||
handler.post {
|
||||
saving = false
|
||||
if (file == null) {
|
||||
Toast.makeText(context, R.string.touch_save_failed, Toast.LENGTH_SHORT).show()
|
||||
Toast.makeText(context, "Could not save the touch layout", Toast.LENGTH_SHORT).show()
|
||||
invalidate()
|
||||
return@post
|
||||
}
|
||||
Toast.makeText(context, R.string.touch_saved, Toast.LENGTH_SHORT).show()
|
||||
Toast.makeText(context, "Touch layout saved to Steam", Toast.LENGTH_SHORT).show()
|
||||
onSaved()
|
||||
stopEditing()
|
||||
reloadConfig()
|
||||
|
||||
@@ -21,7 +21,6 @@ import android.widget.HorizontalScrollView
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import com.droiddeck.launcher.R
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
/**
|
||||
@@ -51,7 +50,7 @@ class SteamTouchIconPicker(
|
||||
val root = LinearLayout(context).apply { orientation = LinearLayout.HORIZONTAL; setPadding(dp(16), dp(8), dp(16), 0) }
|
||||
val left = LinearLayout(context).apply { orientation = LinearLayout.VERTICAL }
|
||||
val label = EditText(context).apply {
|
||||
setHint(R.string.touch_label_hint)
|
||||
hint = "Label (optional)"
|
||||
setText(current.label)
|
||||
inputType = InputType.TYPE_CLASS_TEXT
|
||||
setSingleLine()
|
||||
@@ -78,22 +77,21 @@ class SteamTouchIconPicker(
|
||||
setPadding(0, dp(8), 0, 0)
|
||||
addView(preview, LinearLayout.LayoutParams(dp(56), dp(56)))
|
||||
addView(TextView(context).apply {
|
||||
text = if (names.isEmpty()) context.getString(R.string.touch_icons_missing)
|
||||
else context.resources.getQuantityString(R.plurals.touch_icons_found, names.size, names.size)
|
||||
text = if (names.isEmpty()) "Steam's icons were not found" else "${names.size} icons from Steam"
|
||||
setPadding(dp(12), 0, 0, 0)
|
||||
})
|
||||
})
|
||||
left.addView(paletteRow(context.getString(R.string.touch_icon_color), { foreground }) { foreground = it; adapter.notifyDataSetChanged(); updatePreview(preview) })
|
||||
left.addView(paletteRow(context.getString(R.string.touch_button_color), { background }) { background = it; adapter.notifyDataSetChanged(); updatePreview(preview) })
|
||||
left.addView(paletteRow("Icon colour", { foreground }) { foreground = it; adapter.notifyDataSetChanged(); updatePreview(preview) })
|
||||
left.addView(paletteRow("Button colour", { background }) { background = it; adapter.notifyDataSetChanged(); updatePreview(preview) })
|
||||
root.addView(left, LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f))
|
||||
root.addView(grid, LinearLayout.LayoutParams(0, dp(250), 1.2f).apply { marginStart = dp(16) })
|
||||
updatePreview(preview)
|
||||
showPanel(host, title, root, listOf(
|
||||
context.getString(R.string.touch_no_icon) to {
|
||||
"No icon" to {
|
||||
onPicked(current.copy(label = label.text.toString().replace(",", " ").trim(), icon = "", foreground = "", background = ""))
|
||||
},
|
||||
context.getString(R.string.common_cancel) to {},
|
||||
context.getString(R.string.common_use) to {
|
||||
"Cancel" to {},
|
||||
"Use" to {
|
||||
onPicked(current.copy(label = label.text.toString().replace(",", " ").trim(), icon = icon,
|
||||
foreground = if (icon.isEmpty()) "" else foreground, background = if (icon.isEmpty()) "" else background))
|
||||
},
|
||||
|
||||
@@ -10,36 +10,29 @@ import java.io.File
|
||||
object QuestExperimental {
|
||||
private const val TAG = "QuestExperimental"
|
||||
const val DRIVER = "turnip25.1.0-quest1"
|
||||
const val DRIVER_A6XX = "turnip26.3.0-quest2"
|
||||
|
||||
internal fun quest2(model: String, device: String, manufacturer: String): Boolean =
|
||||
model.equals("Quest 2", ignoreCase = true) ||
|
||||
((manufacturer.equals("Oculus", ignoreCase = true) || manufacturer.equals("Meta", ignoreCase = true)) &&
|
||||
device == "hollywood")
|
||||
|
||||
// Quest 2 has an A6xx GPU and cannot use this bundled A7xx driver.
|
||||
internal fun supported(model: String, device: String, manufacturer: String): Boolean =
|
||||
quest2(model, device, manufacturer) || model.equals("Quest 3", ignoreCase = true) || model.equals("Quest 3S", ignoreCase = true) ||
|
||||
model.equals("Quest 3", ignoreCase = true) || model.equals("Quest 3S", ignoreCase = true) ||
|
||||
((manufacturer.equals("Oculus", ignoreCase = true) || manufacturer.equals("Meta", ignoreCase = true)) &&
|
||||
(device == "eureka" || device == "panther"))
|
||||
|
||||
fun isSupported(): Boolean = supported(Build.MODEL, Build.DEVICE, Build.MANUFACTURER)
|
||||
fun isQuest2(): Boolean = quest2(Build.MODEL, Build.DEVICE, Build.MANUFACTURER)
|
||||
|
||||
fun initialize(context: Context) {
|
||||
if (!isSupported()) return
|
||||
val prefs = context.getSharedPreferences("session", Context.MODE_PRIVATE)
|
||||
val defaultsKey = if (isQuest2()) "quest2DefaultsV1" else "questDefaultsV1"
|
||||
if (!prefs.getBoolean(defaultsKey, false)) {
|
||||
if (!prefs.getBoolean("questDefaultsV1", false)) {
|
||||
// Auto would download an unwrapped display driver and lose the compatibility path.
|
||||
// Apply once so deliberate changes made during headset testing remain possible.
|
||||
prefs.edit()
|
||||
.putString("gpuDriverMode", SessionPrefs.GPU_DRIVERS_MANUAL)
|
||||
.putString("androidDriver", if (isQuest2()) DRIVER_A6XX else DRIVER)
|
||||
.putString("androidDriver", DRIVER)
|
||||
.putString("linuxDriver", "")
|
||||
// The existing HDR option uses SurfaceControl presentation. This is a
|
||||
// corruption workaround from upstream issue #245, not a claim of HDR accuracy.
|
||||
.putBoolean("hdr.steam", true)
|
||||
.putBoolean(defaultsKey, true)
|
||||
.putBoolean("questDefaultsV1", true)
|
||||
.apply()
|
||||
}
|
||||
val report = buildString {
|
||||
@@ -58,7 +51,7 @@ object QuestExperimental {
|
||||
appendLine("androidDriver=${SessionPrefs.androidDriver(context)}")
|
||||
appendLine("steamSurfaceControlWorkaround=${SessionPrefs.hdr(context, "steam")}")
|
||||
appendLine("GPUOBJ fallback installed in Android driver and ARM64 libblsession")
|
||||
appendLine("Experimental Quest 2/3/3S compatibility; 2D panel application")
|
||||
appendLine("Experimental Quest 3/3S compatibility; 2D panel application")
|
||||
}
|
||||
Log.i(TAG, report)
|
||||
runCatching { File(context.filesDir, "quest-startup.txt").writeText(report) }
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.core.CpuAllocationDefaults
|
||||
import com.droiddeck.launcher.core.GameEnvironment
|
||||
import com.droiddeck.launcher.core.TextureFiltering
|
||||
import com.droiddeck.launcher.core.ZramSupport
|
||||
import com.droiddeck.launcher.gpu.Cardboard
|
||||
import com.droiddeck.launcher.gpu.ScreenEffects
|
||||
import org.json.JSONObject
|
||||
@@ -1058,16 +1057,6 @@ object SessionPrefs {
|
||||
}.apply()
|
||||
}
|
||||
|
||||
/** Steam only: the client's memory goes to the device's zram while a game runs (ZramSupport). */
|
||||
fun zramCompression(context: Context): Boolean {
|
||||
val prefs = prefs(context)
|
||||
return if (prefs.contains("zramCompression")) prefs.getBoolean("zramCompression", false) else ZramSupport.recommended(context)
|
||||
}
|
||||
|
||||
fun setZramCompression(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("zramCompression", on).apply()
|
||||
}
|
||||
|
||||
// ── Game storage ────────────────────────────────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
|
||||
@@ -660,8 +660,6 @@ class SessionService : Service() {
|
||||
// gamescope's realtime Vulkan queues (the session script turns this into
|
||||
// GAMESCOPE_FORCE_VULKAN_REALTIME); off unless the user turns it on.
|
||||
guest.add("BL_GAMESCOPE_REALTIME=" + (if (SessionPrefs.gamescopeRealtime(this)) "1" else "0"))
|
||||
if (SessionState.mode == MODE_STEAM && SessionPrefs.zramCompression(this) &&
|
||||
com.droiddeck.launcher.core.ZramSupport.supported()) guest.add("BL_ZRAM=1")
|
||||
guest.add("BANNER_AUDIO_DIRECT_DECAY=0")
|
||||
// Anything else, for a device that cannot be reached with a debugger: droiddeck-env in the
|
||||
// app's own external files (envSwitchFile) holds KEY=VALUE lines that go into the session's
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.droiddeck.launcher.core.GameEnvironment
|
||||
import com.droiddeck.launcher.input.ControllerPrefs
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
|
||||
/**
|
||||
* Setup's "Reset all settings": every choice goes back to the default its getter falls back to.
|
||||
*
|
||||
* Only settings are removed. The "session" file also holds the library (added games' names, exes,
|
||||
* appids and art picks), migration records, the drivers Auto installed, the storage and ROMs
|
||||
* folders and the one-time permission prompts; those stay, as do store sign-ins, imported drivers
|
||||
* and Lossless Scaling. Game profiles (each game's and the Default profile's environment
|
||||
* overrides) are cleared only when asked for.
|
||||
*/
|
||||
object SettingsReset {
|
||||
private const val TAG = "SettingsReset"
|
||||
|
||||
internal val SESSION_KEYS = setOf(
|
||||
"orientation", "launcherFullscreen", "animations", "theme", "runSteamAtStartup", "addedGamesArt",
|
||||
"gameStoresEnabled", "gameStoresSpeedTier", "gameStoresParallel", "storesOpenTab", "storesShowMature",
|
||||
"hud", "hudDeck", "backActionsInverted", "touch", "osc", "shape", "steamController",
|
||||
"gamepadLeft", "gamepadRight", "pipAutoEnter", "unfoldedControls", "stretch16x9",
|
||||
"gpuDriverMode", "androidDriver", "linuxDriver", "linuxDriver.steam", "linuxDriver.desktop",
|
||||
"tuSysmem", "glThread", "noGlError", "zinkLazy", "mangoapp", "gpuClockPin", "gamescopeRealtime",
|
||||
"directAudio", "mic", "wifiDiscovery", "clientCpusOverride", "clientCpus", "gameCpus",
|
||||
"noXalia", "fastSync", "fsyncFirst", "syncFallback", "prootNoSeccomp", "prootFastPath",
|
||||
"guestHostname", "fexPreset", "forceSsbs", "logs", "storageDiagnostics",
|
||||
"upscaler", "upscaleSharpness", "screenEffects", "textureAnisotropy", "textureLodBias",
|
||||
"steamDownloadsInBackground", "steam_offline",
|
||||
// Cleared so the Quest's one-time compatibility defaults are written again.
|
||||
"questDefaultsV1",
|
||||
)
|
||||
|
||||
/** Per-mode settings, stored as "<prefix><mode>". */
|
||||
internal val SESSION_PREFIXES = listOf(
|
||||
"resolutionCap.", "displayResolution.", "customRes.", "hdr.", "fpsLimit.", "suspendPolicy.",
|
||||
)
|
||||
|
||||
private val STEAM_TOUCH_KEYS = listOf("feedback", "autoFade", "gyro", "shake")
|
||||
|
||||
internal fun isSessionSetting(key: String) = key in SESSION_KEYS || SESSION_PREFIXES.any { key.startsWith(it) }
|
||||
|
||||
/**
|
||||
* Resets the settings, then per-game profiles when [gameProfiles] is set ([gameScopes] are the
|
||||
* library's profile keys; scopes with saved overrides are found on their own). Blocking: call
|
||||
* off the main thread. Returns false if a part could not be reset; the rest is still done.
|
||||
* The language is not reset here: AppLanguage.setChosen changes the process locale, so the
|
||||
* caller does that on the main thread.
|
||||
*/
|
||||
fun resetAll(context: Context, gameProfiles: Boolean, gameScopes: Collection<String> = emptyList()): Boolean {
|
||||
var ok = true
|
||||
val session = context.getSharedPreferences("session", Context.MODE_PRIVATE)
|
||||
session.edit().apply { session.all.keys.filter { isSessionSetting(it) }.forEach { remove(it) } }.commit()
|
||||
ControllerPrefs.resetAll(context)
|
||||
context.getSharedPreferences("app-ui", Context.MODE_PRIVATE).edit().clear().commit()
|
||||
context.getSharedPreferences("frame_gen", Context.MODE_PRIVATE).edit().clear().commit()
|
||||
context.getSharedPreferences("steam_touch", Context.MODE_PRIVATE).edit()
|
||||
.apply { STEAM_TOUCH_KEYS.forEach { remove(it) } }.commit()
|
||||
com.droiddeck.launcher.agent.AgentAccess.setCommandsEnabled(context, false)
|
||||
|
||||
if (gameProfiles) {
|
||||
val scopes = (gameScopes + runCatching { GameEnvironmentStore.read(context).games.keys }.getOrDefault(emptySet()) +
|
||||
SessionPrefs.gameTextureFiltering(context).keys)
|
||||
.filter { it.isNotEmpty() && GameEnvironment.validScope(it) }.toSet()
|
||||
scopes.forEach { scope ->
|
||||
runCatching { GameProfileManager.reset(context, scope) }
|
||||
.onFailure { ok = false; Log.w(TAG, "Could not reset the profile of $scope", it) }
|
||||
}
|
||||
session.edit().remove("gameTextureFiltering").commit()
|
||||
runCatching { GameEnvironmentStore.save(context, GameEnvironmentStore.read(context).copy(shared = emptyMap())) }
|
||||
.onFailure { ok = false; Log.w(TAG, "Could not clear the Default profile's environment", it) }
|
||||
}
|
||||
|
||||
QuestExperimental.initialize(context)
|
||||
runCatching { OfflineMode.apply(context, LinuxRuntime.rootDir(context)) }
|
||||
.onFailure { ok = false; Log.w(TAG, "Could not turn offline mode off", it) }
|
||||
runCatching { GameEnvironmentStore.publish(context) }
|
||||
.onFailure { ok = false; Log.w(TAG, "Could not update game environment", it) }
|
||||
Log.i(TAG, "settings reset (game profiles: $gameProfiles, ok: $ok)")
|
||||
return ok
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@ object AmazonBackend : StoreBackend {
|
||||
val quiet = cached.isNotEmpty() && !force
|
||||
StoresState.post {
|
||||
if (cached.isNotEmpty()) publish(app, cached)
|
||||
if (!quiet) StoresState.status[store] = app.getString(com.droiddeck.launcher.R.string.stores_sync_library)
|
||||
if (!quiet) StoresState.status[store] = "Fetching your library…"
|
||||
}
|
||||
val result = AmazonLibrary.sync(app, force) { line -> if (!quiet) StoresState.post { StoresState.status[store] = line } }
|
||||
StoresState.post {
|
||||
@@ -94,7 +94,7 @@ object AmazonBackend : StoreBackend {
|
||||
private val cancelled = AtomicBoolean(false)
|
||||
|
||||
override fun run(handle: DownloadQueue.JobHandle): String? {
|
||||
handle.stage(DownloadStage.MANIFEST, app.getString(com.droiddeck.launcher.R.string.stores_sync_sign_in))
|
||||
handle.stage(DownloadStage.MANIFEST, "Checking sign-in…")
|
||||
val token = AmazonCredentialStore.getValidAccessToken(app) ?: throw AmazonDownloadManager.InstallException("Not signed in to Amazon Games")
|
||||
StoreInstalls.begin(folder, Store.AMAZON, game.productId, game.title, item.tallImageUrl ?: item.imageUrl, item.imageUrl)
|
||||
var downloading = false
|
||||
@@ -111,7 +111,7 @@ object AmazonBackend : StoreBackend {
|
||||
override fun onSizes(downloadBytes: Long, diskBytes: Long) { handle.diskSize(diskBytes) }
|
||||
}) ?: return null
|
||||
if (cancelled.get()) return null
|
||||
handle.stage(DownloadStage.INSTALL, app.getString(com.droiddeck.launcher.R.string.stores_registering))
|
||||
handle.stage(DownloadStage.INSTALL, "Registering with Steam…")
|
||||
AmazonLibrary.rememberSize(app, game.productId, result.bytes)
|
||||
AmazonPrefs.get(app).edit().putString("version_${game.productId}", result.versionId).apply()
|
||||
val spec = AmazonLaunchHelper.buildLaunchSpec(folder, game.title)
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.droiddeck.launcher.stores.amazon
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.util.Log
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.stores.CatalogItem
|
||||
import com.droiddeck.launcher.stores.Store
|
||||
import com.droiddeck.launcher.stores.StoreNet
|
||||
@@ -67,38 +66,38 @@ object AmazonLibrary {
|
||||
val p = AmazonPrefs.get(app)
|
||||
val cachedList = cached(app)
|
||||
if (!force && cachedList.isNotEmpty() && System.currentTimeMillis() - p.getLong(LAST_SYNC_KEY, 0L) < THROTTLE_MS) {
|
||||
backfillPosters(app, p, cachedList, onStatus)
|
||||
backfillPosters(p, cachedList, onStatus)
|
||||
return SyncResult.Throttled
|
||||
}
|
||||
onStatus(app.getString(R.string.stores_sync_sign_in))
|
||||
onStatus("Checking sign-in…")
|
||||
val creds = AmazonCredentialStore.load(app) ?: return SyncResult.NotLoggedIn
|
||||
val token = AmazonCredentialStore.getValidAccessToken(app) ?: return SyncResult.Failed(StoresState.notSignedInLine(Store.AMAZON))
|
||||
onStatus(app.getString(R.string.stores_sync_game_list))
|
||||
onStatus("Fetching game list…")
|
||||
// Refused with the stored token (revoked, or an expiry read wrong): once more on a fresh one.
|
||||
val all = AmazonApiClient.getEntitlements(token, creds.deviceSerial)
|
||||
?: AmazonCredentialStore.refresh(app)?.let { AmazonApiClient.getEntitlements(it, creds.deviceSerial) }
|
||||
if (all == null) return if (cachedList.isEmpty()) SyncResult.Failed(app.getString(R.string.stores_sync_amazon_no_answer)) else SyncResult.Ok(cachedList)
|
||||
if (all.isEmpty()) return if (cachedList.isEmpty()) SyncResult.Failed(app.getString(R.string.stores_sync_no_games, Store.AMAZON.label)) else SyncResult.Ok(cachedList)
|
||||
if (all == null) return if (cachedList.isEmpty()) SyncResult.Failed("Amazon Games did not answer for your library: refresh, or sign in again") else SyncResult.Ok(cachedList)
|
||||
if (all.isEmpty()) return if (cachedList.isEmpty()) SyncResult.Failed("No games found in your Amazon library") else SyncResult.Ok(cachedList)
|
||||
val games = all.filter { !(it.isDLC && it.parentProductId.isNotEmpty()) }.ifEmpty { all }
|
||||
.sortedWith { a, b -> a.title.compareTo(b.title, ignoreCase = true) }
|
||||
for (fresh in games) cachedList.firstOrNull { it.productId == fresh.productId }?.let { fresh.versionId = it.versionId }
|
||||
saveCache(p, games)
|
||||
p.edit().putLong(LAST_SYNC_KEY, System.currentTimeMillis()).apply()
|
||||
backfillPosters(app, p, games, onStatus)
|
||||
backfillPosters(p, games, onStatus)
|
||||
Log.i(TAG, "sync: entitlements=${all.size} games=${games.size}")
|
||||
return SyncResult.Ok(games)
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "sync failed: ${e.message}")
|
||||
return SyncResult.Failed(e.message ?: context.getString(R.string.stores_sync_failed))
|
||||
return SyncResult.Failed(e.message ?: "Sync failed")
|
||||
} finally {
|
||||
syncing.set(false)
|
||||
}
|
||||
}
|
||||
|
||||
private fun backfillPosters(app: Context, p: SharedPreferences, games: List<AmazonGame>, onStatus: (String) -> Unit) {
|
||||
private fun backfillPosters(p: SharedPreferences, games: List<AmazonGame>, onStatus: (String) -> Unit) {
|
||||
val missing = games.filter { it.productId.isNotEmpty() && !p.contains("vcover_${it.productId}") }.take(POSTER_BUDGET)
|
||||
if (missing.isEmpty()) return
|
||||
onStatus(app.getString(R.string.stores_sync_cover_art))
|
||||
onStatus("Fetching cover art…")
|
||||
val pool = Executors.newFixedThreadPool(4)
|
||||
val futures = missing.map { g -> pool.submit(Callable { g.productId to StoreNet.sgdbPoster(g.title) }) }
|
||||
pool.shutdown()
|
||||
|
||||
@@ -47,7 +47,7 @@ object EpicBackend : StoreBackend, EpicLaunchSupport {
|
||||
val quiet = cached.isNotEmpty() && !force
|
||||
StoresState.post {
|
||||
if (cached.isNotEmpty()) StoresState.library[store] = com.droiddeck.launcher.stores.mergeItems(StoresState.library[store], cached)
|
||||
if (!quiet) StoresState.status[store] = app.getString(com.droiddeck.launcher.R.string.stores_sync_library)
|
||||
if (!quiet) StoresState.status[store] = "Fetching your library…"
|
||||
}
|
||||
val result = EpicLibrary.sync(app, force) { line -> if (!quiet) StoresState.post { StoresState.status[store] = line } }
|
||||
StoresState.post {
|
||||
@@ -122,7 +122,7 @@ object EpicBackend : StoreBackend, EpicLaunchSupport {
|
||||
private fun hasChunks(dir: File): Boolean = dir.isDirectory && (dir.list()?.isNotEmpty() == true)
|
||||
|
||||
override fun run(handle: DownloadQueue.JobHandle): String? {
|
||||
handle.stage(DownloadStage.MANIFEST, app.getString(com.droiddeck.launcher.R.string.stores_sync_sign_in))
|
||||
handle.stage(DownloadStage.MANIFEST, "Checking sign-in…")
|
||||
val token = EpicCredentialStore.getValidAccessToken(app) ?: throw EpicDownloadManager.InstallException("Not signed in to Epic Games")
|
||||
StoreInstalls.begin(folder, Store.EPIC, item.id, item.title, item.tallImageUrl ?: item.imageUrl, item.imageUrl)
|
||||
if (scratch == null && hasChunks(File(folder, ".chunks"))) handle.log("epic: resuming \"${item.title}\" with the chunks already beside it")
|
||||
@@ -151,7 +151,7 @@ object EpicBackend : StoreBackend, EpicLaunchSupport {
|
||||
}
|
||||
}) ?: return null
|
||||
if (cancelled.get()) return null
|
||||
handle.stage(DownloadStage.INSTALL, app.getString(com.droiddeck.launcher.R.string.stores_registering))
|
||||
handle.stage(DownloadStage.INSTALL, "Registering with Steam…")
|
||||
EpicLibrary.rememberSize(app, item.id, result.bytes)
|
||||
val deploymentId = runCatching { JSONObject(manifestJson).optString("deploymentId", "") }.getOrDefault("")
|
||||
val exe = StoreExe.pick(folder, result.launchExe, item.title)
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.droiddeck.launcher.stores.epic
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.util.Log
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.stores.CatalogItem
|
||||
import com.droiddeck.launcher.stores.Store
|
||||
import org.json.JSONArray
|
||||
@@ -68,17 +67,17 @@ object EpicLibrary {
|
||||
val cachedList = cached(app)
|
||||
val lastSync = p.getLong(LAST_SYNC_KEY, 0L)
|
||||
if (!force && cachedList.isNotEmpty() && System.currentTimeMillis() - lastSync < THROTTLE_MS) return SyncResult.Throttled
|
||||
onStatus(app.getString(R.string.stores_sync_sign_in))
|
||||
onStatus("Checking sign-in…")
|
||||
val token = EpicCredentialStore.getValidAccessToken(app) ?: return SyncResult.NotLoggedIn
|
||||
onStatus(app.getString(R.string.stores_sync_game_list))
|
||||
onStatus("Fetching game list…")
|
||||
val raw = EpicApiClient.getLibraryItems(token)
|
||||
if (raw.isNullOrEmpty()) return if (cachedList.isEmpty()) SyncResult.Failed(app.getString(R.string.stores_sync_no_games, Store.EPIC.label)) else SyncResult.Ok(cachedList)
|
||||
if (raw.isNullOrEmpty()) return if (cachedList.isEmpty()) SyncResult.Failed("No games found in your Epic library") else SyncResult.Ok(cachedList)
|
||||
val total = raw.size
|
||||
var done = 0
|
||||
for (game in raw) {
|
||||
EpicApiClient.enrichFromCatalog(token, game)
|
||||
done++
|
||||
if (done % 5 == 0) onStatus(app.getString(R.string.stores_sync_details, done, total))
|
||||
if (done % 5 == 0) onStatus("Loading game details… ($done/$total)")
|
||||
}
|
||||
val main = raw.filter { !it.isDLC }
|
||||
val display = (if (main.isEmpty()) raw else main).distinctBy { it.appName }.sortedWith { a, b -> a.title.compareTo(b.title, ignoreCase = true) }
|
||||
@@ -93,7 +92,7 @@ object EpicLibrary {
|
||||
return SyncResult.Ok(display)
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "sync failed: ${e.message}")
|
||||
return SyncResult.Failed(e.message ?: context.getString(R.string.stores_sync_failed))
|
||||
return SyncResult.Failed(e.message ?: "Sync failed")
|
||||
} finally {
|
||||
syncing.set(false)
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ object GogBackend : StoreBackend {
|
||||
val quiet = cached.isNotEmpty() && !force
|
||||
StoresState.post {
|
||||
if (cached.isNotEmpty()) StoresState.library[store] = com.droiddeck.launcher.stores.mergeItems(StoresState.library[store], cached)
|
||||
if (!quiet) StoresState.status[store] = app.getString(com.droiddeck.launcher.R.string.stores_sync_library)
|
||||
if (!quiet) StoresState.status[store] = "Fetching your library…"
|
||||
}
|
||||
val result = GogLibrary.sync(app, force) { line -> if (!quiet) StoresState.post { StoresState.status[store] = line } }
|
||||
StoresState.post {
|
||||
@@ -106,7 +106,7 @@ object GogBackend : StoreBackend {
|
||||
}
|
||||
}, cancelled) ?: return null
|
||||
if (cancelled.get()) return null
|
||||
handle.stage(DownloadStage.INSTALL, app.getString(com.droiddeck.launcher.R.string.stores_registering))
|
||||
handle.stage(DownloadStage.INSTALL, "Registering with Steam…")
|
||||
val sidecar = StoreGameSidecar(
|
||||
Store.GOG, game.gameId, game.title, exe = result.exeRelative.ifEmpty { "" },
|
||||
installVersion = result.buildId, installedAt = System.currentTimeMillis(),
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.droiddeck.launcher.stores.gog
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.util.Log
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.stores.CatalogItem
|
||||
import com.droiddeck.launcher.stores.Store
|
||||
import com.droiddeck.launcher.stores.StoreNet
|
||||
@@ -61,9 +60,9 @@ object GogLibrary {
|
||||
val app = context.applicationContext
|
||||
val p = GogPrefs.get(app)
|
||||
val token = GogAuth.validToken(app) ?: return SyncResult.NotLoggedIn
|
||||
onStatus(app.getString(R.string.stores_sync_game_list))
|
||||
onStatus("Fetching game list…")
|
||||
val gamesJson = StoreNet.get("https://embed.gog.com/user/data/games", bearer = token, userAgent = GogAuth.GALAXY_UA)
|
||||
?: return SyncResult.Failed(app.getString(R.string.stores_sync_gog_unreachable))
|
||||
?: return SyncResult.Failed("Couldn't reach GOG")
|
||||
val ids = ArrayList<String>()
|
||||
val parsed = runCatching {
|
||||
val owned = JSONObject(gamesJson).optJSONArray("owned")
|
||||
@@ -73,7 +72,7 @@ object GogLibrary {
|
||||
if (id != "1801418160" && id != "0") ids.add(id)
|
||||
}
|
||||
}.isSuccess
|
||||
if (!parsed) return SyncResult.Failed(app.getString(R.string.stores_sync_gog_unreadable))
|
||||
if (!parsed) return SyncResult.Failed("Error parsing library")
|
||||
|
||||
val ownedSet = ids.toHashSet()
|
||||
val cachedList = cached(app)
|
||||
@@ -93,7 +92,7 @@ object GogLibrary {
|
||||
saveCache(p, list)
|
||||
return SyncResult.Ok(list.sortedBy { it.title.lowercase() }, 0)
|
||||
}
|
||||
onStatus(app.resources.getQuantityString(R.plurals.stores_sync_games, idsToFetch.size, idsToFetch.size))
|
||||
onStatus("Syncing ${idsToFetch.size} game${if (idsToFetch.size == 1) "" else "s"}…")
|
||||
val pool = Executors.newFixedThreadPool(5)
|
||||
val futures = idsToFetch.map { id -> pool.submit(Callable<GogGame?> { fetchGame(p, id, token, skipped) }) }
|
||||
pool.shutdown()
|
||||
@@ -101,7 +100,7 @@ object GogLibrary {
|
||||
for ((idx, f) in futures.withIndex()) {
|
||||
val g = runCatching { f.get() }.getOrNull()
|
||||
if (g != null) { merged[g.gameId] = g; fetched++ }
|
||||
if ((idx + 1) % 5 == 0) onStatus(app.getString(R.string.stores_sync_progress, idx + 1, futures.size))
|
||||
if ((idx + 1) % 5 == 0) onStatus("Syncing… ${idx + 1}/${futures.size}")
|
||||
}
|
||||
val finalList = merged.values.toList()
|
||||
saveCache(p, finalList)
|
||||
@@ -112,7 +111,7 @@ object GogLibrary {
|
||||
return SyncResult.Ok(finalList.sortedBy { it.title.lowercase() }, fetched)
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "sync failed: ${e.message}")
|
||||
return SyncResult.Failed(e.message ?: context.getString(R.string.stores_sync_failed))
|
||||
return SyncResult.Failed(e.message ?: "Sync failed")
|
||||
} finally {
|
||||
syncing.set(false)
|
||||
}
|
||||
|
||||
@@ -205,8 +205,6 @@ class FrontEndActions(
|
||||
val onAgentCommands: () -> Unit = {},
|
||||
val onShareLogs: () -> Unit = {},
|
||||
val onClearLogs: () -> Unit = {},
|
||||
/** Setup's Reset all settings: asks first, then puts every setting back to its default. */
|
||||
val onResetSettings: () -> Unit = {},
|
||||
val onOffline: () -> Unit,
|
||||
val onPageBack: () -> Unit = {},
|
||||
val onTheme: (String) -> Unit = {},
|
||||
|
||||
@@ -405,8 +405,6 @@ internal fun SetupPanel(
|
||||
ActionRow(stringResource(R.string.setup_latest_logs), stringResource(R.string.drawer_logs_hint), stringResource(R.string.drawer_share_logs), a.onShareLogs,
|
||||
progress = com.droiddeck.launcher.session.SessionLogShare.progress)
|
||||
ActionRow(stringResource(R.string.setup_saved_logs), stringResource(R.string.setup_saved_logs_hint, com.droiddeck.launcher.session.SessionPaths.KEEP_SESSIONS), stringResource(R.string.setup_clear_logs), a.onClearLogs)
|
||||
ActionRow(stringResource(R.string.setup_reset_settings), stringResource(R.string.setup_reset_settings_hint),
|
||||
stringResource(R.string.setup_reset_settings_button), a.onResetSettings)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,29 +2,17 @@ package com.droiddeck.launcher.ui
|
||||
|
||||
import com.droiddeck.launcher.R
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.selection.toggleable
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.Checkbox
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.semantics.Role
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.droiddeck.launcher.HomeApp
|
||||
import com.droiddeck.launcher.input.SecondScreenDisplay
|
||||
@@ -65,32 +53,3 @@ fun ConfirmDialog(title: String, text: String, confirm: String, onConfirm: () ->
|
||||
dismissButton = { TextButton(onClick = onDismiss) { Text(stringResource(R.string.common_cancel)) } },
|
||||
)
|
||||
}
|
||||
|
||||
/** Setup's Reset all settings, with the choice to clear game profiles too (off unless ticked). */
|
||||
@Composable
|
||||
fun ResetSettingsDialog(onConfirm: (gameProfiles: Boolean) -> Unit, onDismiss: () -> Unit) {
|
||||
var gameProfiles by remember { mutableStateOf(false) }
|
||||
AlertDialog(
|
||||
onDismissRequest = onDismiss,
|
||||
title = { Text(stringResource(R.string.setup_reset_settings_title)) },
|
||||
text = {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {
|
||||
Text(stringResource(R.string.setup_reset_settings_body))
|
||||
Row(
|
||||
Modifier.fillMaxWidth().toggleable(gameProfiles, role = Role.Checkbox) { gameProfiles = it },
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
Checkbox(checked = gameProfiles, onCheckedChange = null)
|
||||
Spacer(Modifier.width(8.dp))
|
||||
Text(stringResource(R.string.setup_reset_settings_profiles), style = MaterialTheme.typography.bodyMedium)
|
||||
}
|
||||
}
|
||||
},
|
||||
confirmButton = {
|
||||
TextButton(onClick = { onDismiss(); onConfirm(gameProfiles) }) {
|
||||
Text(stringResource(R.string.setup_reset_settings_button), color = MaterialTheme.colorScheme.error)
|
||||
}
|
||||
},
|
||||
dismissButton = { TextButton(onClick = onDismiss) { Text(stringResource(R.string.common_cancel)) } },
|
||||
)
|
||||
}
|
||||
@@ -70,10 +70,6 @@ class ModeSettings(
|
||||
val touchMode: String,
|
||||
val suspendPolicy: String,
|
||||
val steamDownloadsInBackground: Boolean = false,
|
||||
/** Steam only; null hides it. */
|
||||
val zramCompression: Boolean? = null,
|
||||
/** Null until checked off the main thread. */
|
||||
val zramSupported: Boolean? = null,
|
||||
val pipSupported: Boolean = false,
|
||||
val pipAutoEnter: Boolean = false,
|
||||
/** Steam only. */
|
||||
@@ -131,7 +127,6 @@ class ModeSettingsActions(
|
||||
val onTouch: (String) -> Unit,
|
||||
val onSuspendPolicy: (String) -> Unit,
|
||||
val onSteamDownloadsInBackground: (Boolean) -> Unit = {},
|
||||
val onZramCompression: (Boolean) -> Unit = {},
|
||||
val onPipAutoEnter: (Boolean) -> Unit = {},
|
||||
val onOsc: (String) -> Unit,
|
||||
val onBackActionsInverted: (Boolean) -> Unit = {},
|
||||
@@ -308,12 +303,6 @@ fun ModeSheetRows(s: ModeSettings, a: ModeSettingsActions, tab: String, extras:
|
||||
stringResource(R.string.mode_background_downloads_hint),
|
||||
s.steamDownloadsInBackground, onChange = a.onSteamDownloadsInBackground,
|
||||
)
|
||||
if (s.zramCompression != null) ToggleRow(
|
||||
host, "zram", stringResource(R.string.mode_zram),
|
||||
stringResource(if (s.zramSupported == false) R.string.mode_zram_unsupported else R.string.mode_zram_hint),
|
||||
s.zramCompression && s.zramSupported != false, enabled = s.zramSupported == true,
|
||||
onChange = a.onZramCompression,
|
||||
)
|
||||
}
|
||||
if (s.pipSupported) SettingsGroup(stringResource(R.string.pip_title)) {
|
||||
ToggleRow(host, "pip-auto", stringResource(R.string.pip_auto), null,
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,93 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string-array name="loading_hints">
|
||||
<item>La primera vez se descarga Steam. Puede tardar unos minutos.</item>
|
||||
<item>De forma predeterminada, al salir de la app Steam se pausa y continúa donde lo dejaste cuando vuelves.</item>
|
||||
<item>Tu control aparece como un control de Xbox 360. Si no, usa los controles en pantalla.</item>
|
||||
</string-array>
|
||||
<string-array name="loading_hints_desktop">
|
||||
<item>La primera vez se prepara el escritorio. Puede tardar unos minutos.</item>
|
||||
<item>De forma predeterminada, al salir de la app la sesión se pausa y continúa donde la dejaste cuando vuelves.</item>
|
||||
<item>El tacto funciona como un touchpad: arrastra para mover el puntero y toca para hacer clic.</item>
|
||||
<item>Tu control aparece como un control de Xbox 360. Si no, usa los controles en pantalla.</item>
|
||||
</string-array>
|
||||
<string name="second_library_import_hint">Agrega una biblioteca de Steam y busca juegos de Windows en ella. Los juegos que tienes usan sus entradas de Steam; el resto se convierten en accesos directos ajenos a Steam.</string>
|
||||
<string name="game_env_add">Agregar variable</string>
|
||||
<string name="game_env_xalia">Pon 0 para desactivar el asistente de navegación con control de Proton en este juego.</string>
|
||||
<string name="user_apps_add">Agregar</string>
|
||||
<string name="user_apps_added">%1$s agregada</string>
|
||||
<string name="user_apps_remove_confirm">Presiona de nuevo para quitar</string>
|
||||
<string name="user_apps_failed">No se pudo agregar la app</string>
|
||||
<string name="add_app_title">Agregar una app</string>
|
||||
<string name="add_app_confirm">Agregar</string>
|
||||
<string name="common_add_ellipsis">Agregar…</string>
|
||||
<string name="mode_osc_note">Auto muestra los controles en pantalla cuando no hay ningún control conectado.</string>
|
||||
<string name="mode_controller">Control</string>
|
||||
<string name="mode_controller_hint">Cómo ve Steam tu control. Se aplica en la próxima sesión.</string>
|
||||
<string name="mode_controller_deck">Control de Steam Deck</string>
|
||||
<string name="mode_controller_x360">Control de Xbox 360</string>
|
||||
<string name="games_add">Agregar juego</string>
|
||||
<string name="games_add_title">Agregar un juego:</string>
|
||||
<string name="mode_storage_note">Los juegos que cargan recursos desde la SD o el almacenamiento compartido pueden tener microcortes.</string>
|
||||
<string name="comp_no_proton">Aún no hay ningún Proton instalado. Inicia Steam una vez para descargar su Proton ARM64, o agrega GE-Proton o CachyOS desde Configuración.</string>
|
||||
<string name="perf_gpuclock_hint">Solo Adreno. Menos microcortes, más consumo de batería y calor.</string>
|
||||
<string name="perf_xalia_hint">Desactiva el asistente de navegación con control de Proton, que consume CPU en cada juego.</string>
|
||||
<string name="perf_fastpath_hint">Búsquedas de archivos más rápidas y menos microcortes. Desactívalo si un programa no encuentra sus archivos.</string>
|
||||
<string name="drawer_page_controller">Control</string>
|
||||
<string name="setup_manage">Administrar</string>
|
||||
<string name="setup_tab_controller">Control</string>
|
||||
<string name="setup_sign_in">Presiona Jugar en Steam e inicia sesión</string>
|
||||
<string name="setup_controller">Control</string>
|
||||
<string name="setup_controller_unavailable">Los ajustes del control no están disponibles.</string>
|
||||
<string name="setup_tool_files_hint">Explorar y administrar archivos</string>
|
||||
<string name="store_setup_text">Agrega Flatpak y lo conecta a Flathub (unos 20 MB). La primera app también descarga su runtime.</string>
|
||||
<string name="store_press_again">Presiona de nuevo para quitar</string>
|
||||
<string name="gate_no_toggle">Esta versión de Android no tiene un interruptor para ello, así que DroidDeck lo cambia mediante la Depuración inalámbrica. Tarda un minuto y no necesitas una computadora.</string>
|
||||
<string name="gate_code_needed">Ventana encontrada. Ingresa su código en la notificación.</string>
|
||||
<string name="gate_other_toggle">Depuración inalámbrica, dirección manual, ADB desde una computadora</string>
|
||||
<string name="gate_other_no_toggle">Dirección manual, ADB desde una computadora, Opciones de desarrollador</string>
|
||||
<string name="gate_some_roms">Algunas ROM agregan el interruptor de todos modos. Busca “procesos secundarios” en Opciones de desarrollador.</string>
|
||||
<string name="gate_manual_hint">Si la notificación no funciona, ingresa manualmente la dirección y el código de la ventana.</string>
|
||||
<string name="gate_enter_manually">Ingresar dirección manualmente</string>
|
||||
<string name="gate_from_computer">Desde una computadora con ADB:</string>
|
||||
<string name="wadb_enter_port">Vinculado. Ingresa el puerto de Ajustes.</string>
|
||||
<string name="wadb_computer_last">3 · ADB desde una computadora (último recurso)</string>
|
||||
<string name="wadb_computer_group">3 · ADB desde una computadora (último recurso)</string>
|
||||
<string name="ctrl_select_steam">Presiona Select para abrir el menú de Steam</string>
|
||||
<string name="ctrl_reset_all">Restablecer control</string>
|
||||
<string name="ctrl_reset_all_hint">Restaura todos los ajustes del control y la disposición</string>
|
||||
<string name="content_add_roms">Agrega juegos de %1$s a ROMs/%2$s.</string>
|
||||
<string name="desktop_remove_text">Elimina el escritorio y sus apps incluidas. Se conservan los juegos, las apps agregadas, los ajustes y las bibliotecas compartidas.</string>
|
||||
<string name="games_manage_saves">Administrar partidas guardadas</string>
|
||||
<string name="games_added">Juego agregado</string>
|
||||
<string name="deck_tab_gamepad">Control</string>
|
||||
<string name="game_shortcut_add">Agregar a la pantalla de inicio</string>
|
||||
<string name="game_shortcut_unsupported">Este launcher no puede agregar accesos directos. Usa Copiar enlace de inicio.</string>
|
||||
<string name="session_runtime_catalog_unreachable">No se pudo acceder al catálogo del runtime. Revisa la conexión y vuelve a presionar Jugar.</string>
|
||||
<string name="session_runtime_install_failed">El runtime de Linux no se instaló. Revisa el runtime en Configuración y vuelve a presionar Jugar.</string>
|
||||
<string name="session_desktop_install_failed">El escritorio no se instaló (%1$s). Revisa la conexión y presiona Escritorio de nuevo.</string>
|
||||
<string name="store_cat_audio_video">Audio y video</string>
|
||||
<string name="theme_graphite_detail">Superficies grafito, con el azul del orbe del logotipo para todo lo seleccionado, enfocado o presionado.</string>
|
||||
<string name="theme_icon_blue_detail">Fondo negro, texto blanco y el azul para todo lo seleccionado, enfocado o presionado.</string>
|
||||
<string name="pckb_key_enter">Enter ⏎</string>
|
||||
<string name="game_sync_err_added_games">La carpeta de juegos agregados no está disponible</string>
|
||||
<string name="fm_favorite_add">Agregar a Favoritos</string>
|
||||
<string name="fm_conflict_merge_hint">Combinar agrega y reemplaza archivos dentro de la carpeta existente.</string>
|
||||
<string name="fm_favorite_added">Se agregó \"%1$s\" a Favoritos</string>
|
||||
<string name="adbfix_enter_address">Ingresa la dirección IP y el puerto actuales de la Depuración inalámbrica</string>
|
||||
<string name="adbpair_six_digits">Ingresa los 6 dígitos del código</string>
|
||||
<string name="adbpair_code_rejected">Ese código no funcionó. Vuelve a abrir la ventana de vinculación e ingresa su nuevo código.</string>
|
||||
<string name="adbpair_waiting_long">Activa la Depuración inalámbrica y toca “Vincular dispositivo con código de vinculación”. Quédate en Ajustes: el código se ingresa en esta notificación.</string>
|
||||
<string name="adbpair_code_hint">Toca Ingresar código y escribe los 6 dígitos que muestra Ajustes.</string>
|
||||
<string name="adbpair_title_code">Ingresa el código de vinculación Wi-Fi</string>
|
||||
<string name="adbpair_enter_code">Ingresar código</string>
|
||||
<string name="phantom_instructions_fix">%1$s Si no es posible, conecta este dispositivo a una computadora con ADB y ejecuta el comando de abajo. Después vuelve aquí y comprueba de nuevo.</string>
|
||||
<string name="stores_kv_steam_on">se agrega a Steam al instalar (interfaz Deck + Steam Input)</string>
|
||||
<string name="stores_download_manager">Administrador de descargas</string>
|
||||
<string name="games_add_all">Agregar todos los juegos de esta carpeta</string>
|
||||
<plurals name="games_added_n">
|
||||
<item quantity="one">%1$d juego agregado</item>
|
||||
<item quantity="many">%1$d juegos agregados</item>
|
||||
<item quantity="other">%1$d juegos agregados</item>
|
||||
</plurals>
|
||||
</resources>
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -278,9 +278,6 @@
|
||||
<string name="mode_suspend_steam_note">Auto pauses and resumes when shown. Native prepares Steam for sleep first. Manual waits for Resume. Never keeps running.</string>
|
||||
<string name="mode_background_downloads">Keep downloads running</string>
|
||||
<string name="mode_background_downloads_hint">Delay background suspension while Steam is actively downloading.</string>
|
||||
<string name="mode_zram">zRAM compression</string>
|
||||
<string name="mode_zram_hint">While a game runs, the Steam client\'s memory is compressed into the device\'s zram, leaving more RAM for the game. Applies the next time Steam starts.</string>
|
||||
<string name="mode_zram_unsupported">Unavailable: this device has no zram or swap, or its kernel is older than 5.4.</string>
|
||||
<string name="mode_suspend_note">Auto pauses in the background and resumes when shown. Manual waits for Resume. Never keeps running.</string>
|
||||
<string name="mode_startup">Startup</string>
|
||||
<string name="mode_steam_startup">Start Steam with DroidDeck</string>
|
||||
@@ -716,14 +713,6 @@
|
||||
<string name="setup_saved_logs">Saved session logs</string>
|
||||
<string name="setup_saved_logs_hint">Keeps the newest %1$d</string>
|
||||
<string name="setup_clear_logs">Clear logs</string>
|
||||
<string name="setup_reset_settings">Reset all settings</string>
|
||||
<string name="setup_reset_settings_hint">Puts every setting back to its default</string>
|
||||
<string name="setup_reset_settings_button">Reset</string>
|
||||
<string name="setup_reset_settings_title">Reset all settings?</string>
|
||||
<string name="setup_reset_settings_body">Display, performance, controller, theme, language and launcher settings go back to their defaults. Your games, Steam sign-in, store accounts, downloaded drivers and storage folders are kept.</string>
|
||||
<string name="setup_reset_settings_profiles">Also reset game profiles (each game\'s Proton, FEX, components and environment, and the Default profile\'s environment)</string>
|
||||
<string name="setup_reset_settings_session_running">Stop the session before resetting settings.</string>
|
||||
<string name="setup_reset_settings_partial">Settings were reset, but some parts could not be. The logs have the details.</string>
|
||||
<string name="setup_offline">Offline mode</string>
|
||||
<string name="setup_sign_in_first">Sign in to Steam first</string>
|
||||
<string name="setup_launcher">Launcher</string>
|
||||
@@ -2368,72 +2357,4 @@
|
||||
<string name="gog_achievements_enable_store">Enable GOG achievements in Stores settings</string>
|
||||
<string name="gog_achievements_unavailable">Achievements unavailable; check session logs</string>
|
||||
<string name="achievement_unlocked">Achievement unlocked</string>
|
||||
<string name="touch_paste">Paste</string>
|
||||
<string name="touch_dpad">D-pad</string>
|
||||
<string name="touch_left_stick">Left stick</string>
|
||||
<string name="touch_right_stick">Right stick</string>
|
||||
<string name="touch_menu">Menu</string>
|
||||
<string name="touch_keyboard">Keyboard</string>
|
||||
<string name="touch_dpad_up">D-pad up</string>
|
||||
<string name="touch_dpad_down">D-pad down</string>
|
||||
<string name="touch_dpad_left">D-pad left</string>
|
||||
<string name="touch_dpad_right">D-pad right</string>
|
||||
<string name="touch_title">Touch controls</string>
|
||||
<string name="touch_controller">Touch Controller</string>
|
||||
<string name="touch_mouse">Mouse</string>
|
||||
<string name="touch_on">On</string>
|
||||
<string name="touch_off">Off</string>
|
||||
<string name="touch_speed_slow">Slow</string>
|
||||
<string name="touch_speed_normal">Normal</string>
|
||||
<string name="touch_speed_fast">Fast</string>
|
||||
<string name="touch_edit_layout">Edit layout</string>
|
||||
<string name="touch_droiddeck_menu">DroidDeck menu</string>
|
||||
<string name="touch_drag_hint">Drag controls onto the screen</string>
|
||||
<string name="touch_arrange">Arrange</string>
|
||||
<string name="touch_discard">Discard</string>
|
||||
<string name="touch_saving">Saving…</string>
|
||||
<string name="touch_icon">Icon</string>
|
||||
<string name="touch_narrower">W−</string>
|
||||
<string name="touch_wider">W+</string>
|
||||
<string name="touch_shorter">H−</string>
|
||||
<string name="touch_taller">H+</string>
|
||||
<string name="touch_hide">Hide</string>
|
||||
<string name="touch_color_opacity">Color and opacity…</string>
|
||||
<string name="touch_copy_layout">Copy this layout</string>
|
||||
<string name="touch_layout_copied">Layout copied; paste it into any game\'s touch layout</string>
|
||||
<string name="touch_paste_layout">Paste copied layout</string>
|
||||
<string name="touch_reset_layout">Reset to Steam\'s default</string>
|
||||
<string name="touch_no_binding">This control has no binding in Steam to put an icon on</string>
|
||||
<string name="touch_icon_for">Icon for %1$s</string>
|
||||
<string name="touch_layout_color">Touch layout color</string>
|
||||
<string name="touch_done">Done</string>
|
||||
<string name="touch_save_failed">Could not save the touch layout</string>
|
||||
<string name="touch_saved">Touch layout saved to Steam</string>
|
||||
<string name="touch_app_id">App %1$d</string>
|
||||
<string name="touch_label_hint">Label (optional)</string>
|
||||
<string name="touch_icons_missing">Steam\'s icons were not found</string>
|
||||
<plurals name="touch_icons_found">
|
||||
<item quantity="one">%1$d icon from Steam</item>
|
||||
<item quantity="other">%1$d icons from Steam</item>
|
||||
</plurals>
|
||||
<string name="touch_icon_color">Icon color</string>
|
||||
<string name="touch_button_color">Button color</string>
|
||||
<string name="touch_no_icon">No icon</string>
|
||||
|
||||
<string name="stores_sync_sign_in">Checking sign-in…</string>
|
||||
<string name="stores_sync_library">Fetching your library…</string>
|
||||
<string name="stores_sync_game_list">Fetching game list…</string>
|
||||
<string name="stores_sync_details">Loading game details… (%1$d/%2$d)</string>
|
||||
<plurals name="stores_sync_games">
|
||||
<item quantity="one">Syncing %1$d game…</item>
|
||||
<item quantity="other">Syncing %1$d games…</item>
|
||||
</plurals>
|
||||
<string name="stores_sync_progress">Syncing… %1$d/%2$d</string>
|
||||
<string name="stores_sync_cover_art">Fetching cover art…</string>
|
||||
<string name="stores_sync_failed">Sync failed</string>
|
||||
<string name="stores_sync_no_games">No games found in your %1$s library</string>
|
||||
<string name="stores_sync_amazon_no_answer">Amazon Games did not answer for your library: refresh, or sign in again</string>
|
||||
<string name="stores_sync_gog_unreachable">Couldn\'t reach GOG</string>
|
||||
<string name="stores_sync_gog_unreadable">Could not read your GOG library</string>
|
||||
<string name="stores_registering">Registering with Steam…</string>
|
||||
</resources>
|
||||
@@ -3,33 +3,9 @@
|
||||
AppLanguage.supported and the values-* folders. -->
|
||||
<locale-config xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<locale android:name="en" />
|
||||
<locale android:name="id" />
|
||||
<locale android:name="ms" />
|
||||
<locale android:name="cs" />
|
||||
<locale android:name="da" />
|
||||
<locale android:name="de" />
|
||||
<locale android:name="es" />
|
||||
<locale android:name="es-419" />
|
||||
<locale android:name="fr" />
|
||||
<locale android:name="it" />
|
||||
<locale android:name="hu" />
|
||||
<locale android:name="nl" />
|
||||
<locale android:name="nb" />
|
||||
<locale android:name="pl" />
|
||||
<locale android:name="pt-BR" />
|
||||
<locale android:name="pt-PT" />
|
||||
<locale android:name="ro" />
|
||||
<locale android:name="fi" />
|
||||
<locale android:name="sv" />
|
||||
<locale android:name="vi" />
|
||||
<locale android:name="tr" />
|
||||
<locale android:name="el" />
|
||||
<locale android:name="bg" />
|
||||
<locale android:name="ru" />
|
||||
<locale android:name="uk" />
|
||||
<locale android:name="ar" />
|
||||
<locale android:name="hi" />
|
||||
<locale android:name="th" />
|
||||
<locale android:name="ja" />
|
||||
<locale android:name="ko" />
|
||||
<locale android:name="zh-CN" />
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
package com.droiddeck.launcher.core
|
||||
|
||||
import java.io.File
|
||||
import java.util.Locale
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class AppLanguageTest {
|
||||
private fun tag(languageTag: String) = AppLanguage.supportedTag(Locale.forLanguageTag(languageTag))
|
||||
|
||||
private val folders = mapOf(
|
||||
"id" to "in", "ms" to "ms", "cs" to "cs", "da" to "da", "de" to "de", "es" to "es",
|
||||
"es-419" to "b+es+419", "fr" to "fr", "it" to "it", "hu" to "hu", "nl" to "nl", "nb" to "nb",
|
||||
"pl" to "pl", "pt-BR" to "pt", "pt-PT" to "pt-rPT", "ro" to "ro", "fi" to "fi", "sv" to "sv",
|
||||
"vi" to "vi", "tr" to "tr", "el" to "el", "bg" to "bg", "ru" to "ru", "uk" to "uk", "ar" to "ar",
|
||||
"hi" to "hi", "th" to "th", "ja" to "ja", "ko" to "ko", "zh-CN" to "zh-rCN", "zh-TW" to "zh-rTW",
|
||||
"zh-HK" to "zh-rHK",
|
||||
)
|
||||
|
||||
@Test fun everyLanguageReadsAsItself() {
|
||||
AppLanguage.supported.forEach { assertEquals(it, tag(it)) }
|
||||
}
|
||||
|
||||
@Test fun everyLanguageHasItsOwnName() {
|
||||
val names = AppLanguage.supported.map(AppLanguage::nativeName)
|
||||
assertEquals(names.size, names.toSet().size)
|
||||
AppLanguage.supported.forEach { assertTrue(it, AppLanguage.nativeName(it) != it) }
|
||||
}
|
||||
|
||||
@Test fun systemLocalesFindTheirLanguage() {
|
||||
assertEquals("es-419", tag("es-MX"))
|
||||
assertEquals("es-419", tag("es-US"))
|
||||
assertEquals("es", tag("es-ES"))
|
||||
assertEquals("pt-BR", tag("pt-BR"))
|
||||
assertEquals("pt-BR", tag("pt"))
|
||||
assertEquals("pt-PT", tag("pt-PT"))
|
||||
assertEquals("pt-PT", tag("pt-AO"))
|
||||
assertEquals("id", tag("in-ID"))
|
||||
assertEquals("id", tag("id-ID"))
|
||||
assertEquals("de", tag("de-AT"))
|
||||
assertEquals("ar", tag("ar-EG"))
|
||||
assertEquals("zh-HK", tag("zh-MO"))
|
||||
assertNull(tag("sw-KE"))
|
||||
assertNull(tag("nn-NO"))
|
||||
}
|
||||
|
||||
@Test fun everyLanguageShipsStringsAndIsOfferedToAndroid() {
|
||||
assertEquals(AppLanguage.supported.toSet() - "en", folders.keys)
|
||||
val res = File("src/main/res")
|
||||
folders.values.forEach { assertTrue(it, File(res, "values-$it/strings.xml").isFile) }
|
||||
val config = File(res, "xml/locales_config.xml").readText()
|
||||
val offered = Regex("""android:name="([^"]+)"""").findAll(config).map { it.groupValues[1] }.toList()
|
||||
assertEquals(AppLanguage.supported, offered)
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.droiddeck.launcher.core
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class ZramSupportTest {
|
||||
@Test
|
||||
fun kernelVersionsFromAndroidReleases() {
|
||||
assertTrue(ZramSupport.kernelAtLeast("6.12.38-android16-5-g665eafb62659-ab14778838-4k", 5, 4))
|
||||
assertTrue(ZramSupport.kernelAtLeast("5.4.0", 5, 4))
|
||||
assertFalse(ZramSupport.kernelAtLeast("4.19.157-perf+", 5, 4))
|
||||
assertFalse(ZramSupport.kernelAtLeast("", 5, 4))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun underTwelveGbFromAdvertisedOrTotalMemory() {
|
||||
val gb = 1_000_000_000L
|
||||
val gib = 1L shl 30
|
||||
assertTrue(ZramSupport.belowTwelveGb(8 * gb, 0))
|
||||
assertTrue(ZramSupport.belowTwelveGb(8 * gib, 0))
|
||||
assertFalse(ZramSupport.belowTwelveGb(12 * gb, 0))
|
||||
assertFalse(ZramSupport.belowTwelveGb(12 * gib, 0))
|
||||
assertTrue(ZramSupport.belowTwelveGb(0, 7_400_000L * 1024))
|
||||
assertTrue(ZramSupport.belowTwelveGb(0, 9_300_000L * 1024))
|
||||
assertFalse(ZramSupport.belowTwelveGb(0, 11_100_000L * 1024))
|
||||
assertFalse(ZramSupport.belowTwelveGb(0, 15_600_380L * 1024))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun swapTotalComesFromMeminfo() {
|
||||
assertEquals(12582908L, ZramSupport.swapTotalKb(listOf("MemTotal: 15600380 kB", "SwapTotal: 12582908 kB")))
|
||||
assertEquals(0L, ZramSupport.swapTotalKb(listOf("SwapTotal: 0 kB")))
|
||||
assertEquals(0L, ZramSupport.swapTotalKb(emptyList()))
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package com.droiddeck.launcher.input
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.os.Looper
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.FrameLayout
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.Robolectric
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.Shadows.shadowOf
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(manifest = Config.NONE)
|
||||
class KeyboardHostTest {
|
||||
private lateinit var imm: InputMethodManager
|
||||
private lateinit var host: KeyboardHost
|
||||
|
||||
@Before fun setUp() {
|
||||
val activity = Robolectric.buildActivity(Activity::class.java).setup().get()
|
||||
imm = activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
host = KeyboardHost(activity)
|
||||
activity.setContentView(FrameLayout(activity).apply { addView(host) })
|
||||
idle()
|
||||
}
|
||||
|
||||
@Config(sdk = [33])
|
||||
@Test fun toggleShowsAKeyboardTheSystemDismissed() {
|
||||
host.show()
|
||||
idle()
|
||||
imm.hideSoftInputFromWindow(host.windowToken, 0)
|
||||
idle()
|
||||
host.toggle()
|
||||
idle()
|
||||
assertTrue(shadowOf(imm).isSoftInputVisible)
|
||||
assertTrue(host.shown)
|
||||
}
|
||||
|
||||
@Config(sdk = [28])
|
||||
@Test fun toggleHidesAKeyboardThatIsShowing() {
|
||||
host.show()
|
||||
idle()
|
||||
host.toggle()
|
||||
idle()
|
||||
assertFalse(shadowOf(imm).isSoftInputVisible)
|
||||
assertFalse(host.shown)
|
||||
}
|
||||
|
||||
private fun idle() = shadowOf(Looper.getMainLooper()).idle()
|
||||
}
|
||||
@@ -23,33 +23,15 @@ class QuestExperimentalTest {
|
||||
ShadowBuild.setDevice("phone")
|
||||
}
|
||||
|
||||
@Test fun otherDevicesKeepTheirSettings() {
|
||||
for (model in listOf("Phone", "Quest", "Quest Pro")) {
|
||||
@Test fun otherDevicesAndQuest2KeepTheirSettings() {
|
||||
for (model in listOf("Phone", "Quest 2")) {
|
||||
ShadowBuild.setModel(model)
|
||||
QuestExperimental.initialize(context)
|
||||
assertEquals(SessionPrefs.GPU_DRIVERS_AUTO, SessionPrefs.gpuDriverMode(context))
|
||||
assertEquals("", SessionPrefs.androidDriver(context))
|
||||
assertFalse(SessionPrefs.hdr(context, "steam"))
|
||||
}
|
||||
assertFalse(QuestExperimental.supported("Phone", "hollywood", "Other"))
|
||||
}
|
||||
|
||||
@Test fun quest2SelectsA6xxInsteadOfQuest3DriverAndPreservesLaterChoices() {
|
||||
ShadowBuild.setModel("Quest 2")
|
||||
// A prior Quest 3 flag must not suppress Quest 2's own migration.
|
||||
context.getSharedPreferences("session", Context.MODE_PRIVATE).edit()
|
||||
.putBoolean("questDefaultsV1", true).commit()
|
||||
QuestExperimental.initialize(context)
|
||||
assertEquals(SessionPrefs.GPU_DRIVERS_MANUAL, SessionPrefs.gpuDriverMode(context))
|
||||
assertEquals(QuestExperimental.DRIVER_A6XX, SessionPrefs.androidDriver(context))
|
||||
assertEquals("", SessionPrefs.linuxDriver(context))
|
||||
assertTrue(SessionPrefs.hdr(context, "steam"))
|
||||
assertTrue(QuestExperimental.supported("unknown", "hollywood", "Oculus"))
|
||||
assertTrue(QuestExperimental.supported("unknown", "hollywood", "Meta"))
|
||||
assertFalse(QuestExperimental.quest2("Quest 3", "eureka", "Meta"))
|
||||
SessionPrefs.setAndroidDriver(context, "chosen-a6xx-driver")
|
||||
QuestExperimental.initialize(context)
|
||||
assertEquals("chosen-a6xx-driver", SessionPrefs.androidDriver(context))
|
||||
assertFalse(QuestExperimental.supported("Quest 2", "hollywood", "Oculus"))
|
||||
}
|
||||
|
||||
@Test fun questDefaultsSelectBothCompatibilityPathsAndAreAppliedOnlyOnce() {
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import android.content.Context
|
||||
import com.droiddeck.launcher.core.AppUiPrefs
|
||||
import com.droiddeck.launcher.gpu.FrameGen
|
||||
import com.droiddeck.launcher.input.ControllerPrefs
|
||||
import org.junit.Assert.*
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.RuntimeEnvironment
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [33])
|
||||
class SettingsResetTest {
|
||||
private val app get() = RuntimeEnvironment.getApplication()
|
||||
private fun prefs(name: String) = app.getSharedPreferences(name, Context.MODE_PRIVATE)
|
||||
private val session get() = prefs("session")
|
||||
|
||||
@Before fun clear() {
|
||||
listOf("session", "controller", "app-ui", "frame_gen", "steam_touch", "agent").forEach {
|
||||
prefs(it).edit().clear().commit()
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun settingsGoBackToTheirDefaults() {
|
||||
SessionPrefs.setTheme(app, "ocean")
|
||||
SessionPrefs.setNoXalia(app, false)
|
||||
SessionPrefs.setFpsLimit(app, SessionService.MODE_STEAM, 30)
|
||||
SessionPrefs.setHdr(app, SessionService.MODE_DESKTOP, true)
|
||||
SessionPrefs.setResolutionChoice(app, SessionService.MODE_STEAM, "1280x800")
|
||||
SessionPrefs.setGuestHostname(app, "MyDeck")
|
||||
ControllerPrefs.setOpacity(app, 40)
|
||||
AppUiPrefs.setScale(app, 150)
|
||||
FrameGen.set(app, FrameGen.Mode(FrameGen.ENGINE_WINFG, 3))
|
||||
prefs("steam_touch").edit().putBoolean("gyro", false).commit()
|
||||
|
||||
assertTrue(SettingsReset.resetAll(app, gameProfiles = false))
|
||||
|
||||
assertEquals("graphite", SessionPrefs.theme(app))
|
||||
assertTrue(SessionPrefs.noXalia(app))
|
||||
assertEquals(0, SessionPrefs.fpsLimit(app, SessionService.MODE_STEAM))
|
||||
assertFalse(SessionPrefs.hdr(app, SessionService.MODE_DESKTOP))
|
||||
assertFalse(SessionPrefs.resolutionChosen(app, SessionService.MODE_STEAM))
|
||||
assertEquals(SessionPrefs.DEFAULT_GUEST_HOSTNAME, SessionPrefs.guestHostname(app))
|
||||
assertEquals(100, ControllerPrefs.read(app).opacity)
|
||||
assertEquals(AppUiPrefs.DEFAULT_SCALE, AppUiPrefs.scale(app))
|
||||
assertEquals(FrameGen.Mode.OFF.engine, FrameGen.engine(app))
|
||||
assertFalse(prefs("steam_touch").contains("gyro"))
|
||||
}
|
||||
|
||||
@Test fun libraryAndRecordsAreKept() {
|
||||
val folder = "/storage/emulated/0/Games/Foo"
|
||||
SessionPrefs.setAddedGameName(app, folder, "Foo")
|
||||
SessionPrefs.setAddedGameExe(app, folder, "$folder/foo.exe")
|
||||
SessionPrefs.addedGameAppId(app, folder, 1234L)
|
||||
SessionPrefs.setAddedGameRemoved(app, "/storage/emulated/0/Games/Bar", true)
|
||||
SessionPrefs.setGamesFoldersMigrated(app)
|
||||
SessionPrefs.setGpuAutoInstalled(app, setOf("turnip-a"))
|
||||
SessionPrefs.setRomsDir(app, "/storage/emulated/0/ROMs")
|
||||
SessionPrefs.setGameStorage(app, "/storage/ABCD-1234", "SD Card")
|
||||
SessionPrefs.setMicAsked(app)
|
||||
prefs("steam_touch").edit().putString("copiedLayout", "a:1,2").commit()
|
||||
|
||||
SettingsReset.resetAll(app, gameProfiles = false)
|
||||
|
||||
assertEquals("Foo", SessionPrefs.addedGameName(app, folder))
|
||||
assertEquals("$folder/foo.exe", SessionPrefs.addedGameExe(app, folder))
|
||||
assertEquals(1234L, SessionPrefs.addedGameStoredAppId(app, folder))
|
||||
assertEquals(listOf("/storage/emulated/0/Games/Bar"), SessionPrefs.removedAddedGames(app))
|
||||
assertTrue(SessionPrefs.gamesFoldersMigrated(app))
|
||||
assertEquals(setOf("turnip-a"), SessionPrefs.gpuAutoInstalled(app))
|
||||
assertEquals("/storage/emulated/0/ROMs", SessionPrefs.romsDir(app))
|
||||
assertEquals("/storage/ABCD-1234", SessionPrefs.gameStorage(app))
|
||||
assertTrue(SessionPrefs.micAsked(app))
|
||||
assertEquals("a:1,2", prefs("steam_touch").getString("copiedLayout", null))
|
||||
}
|
||||
|
||||
@Test fun gameTextureFilteringIsKeptUnlessGameProfilesAreReset() {
|
||||
session.edit().putString("gameTextureFiltering", """{"440":{"anisotropy":16}}""").commit()
|
||||
SettingsReset.resetAll(app, gameProfiles = false)
|
||||
assertEquals(16, SessionPrefs.gameTextureFiltering(app, "440").anisotropy)
|
||||
|
||||
SettingsReset.resetAll(app, gameProfiles = true)
|
||||
assertTrue(SessionPrefs.gameTextureFiltering(app).isEmpty())
|
||||
}
|
||||
|
||||
@Test fun perModeKeysAreSettings() {
|
||||
listOf("resolutionCap.steam", "displayResolution.desktop", "customRes.steam", "hdr.steam", "fpsLimit.desktop", "suspendPolicy.steam")
|
||||
.forEach { assertTrue(it, SettingsReset.isSessionSetting(it)) }
|
||||
listOf("addedName:/x", "addedAppId:/x", "gpuAutoInstalled", "romsDir", "gameStorage", "micAsked", "gameTextureFiltering")
|
||||
.forEach { assertFalse(it, SettingsReset.isSessionSetting(it)) }
|
||||
}
|
||||
}
|
||||
@@ -18,18 +18,6 @@ class SteamLanguageTest {
|
||||
assertEquals("tchinese", steam("zh-HK"))
|
||||
}
|
||||
|
||||
@Test fun everyAppLanguageButHindiHasSteamsOwn() {
|
||||
com.droiddeck.launcher.core.AppLanguage.supported.forEach {
|
||||
val steam = steam(it)
|
||||
assertTrue("$it -> $steam", (steam == "english") == (it == "en" || it == "hi"))
|
||||
}
|
||||
assertEquals("brazilian", steam("pt-BR"))
|
||||
assertEquals("portuguese", steam("pt-PT"))
|
||||
assertEquals("latam", steam("es-419"))
|
||||
assertEquals("indonesian", steam("id"))
|
||||
assertEquals("malay", steam("ms"))
|
||||
}
|
||||
|
||||
@Test fun chineseFollowsTheScriptBeforeTheRegion() {
|
||||
assertEquals("tchinese", steam("zh-Hant-CN"))
|
||||
assertEquals("schinese", steam("zh-Hans-HK"))
|
||||
|
||||
+2
-18
@@ -1,23 +1,7 @@
|
||||
# Experimental Quest 2/3/3S support
|
||||
# Experimental Quest 3/3S support
|
||||
|
||||
Quest 3/3S runs DroidDeck as a 2D panel. This does not add immersive VR or
|
||||
OpenXR support. Quest 2 has a separate experimental Adreno 6xx driver path.
|
||||
|
||||
Quest 2 selects `turnip26.3.0-quest2`, a pinned Banners-Turnip A6xx/A7xx build
|
||||
with the same GPUOBJ adapter. It does not select the Quest 3 A7xx binary.
|
||||
The first Quest 2 launch applies manual driver selection and the SurfaceControl
|
||||
workaround, even if `questDefaultsV1` exists from an earlier install. Later user
|
||||
choices are retained. The separate `turnip26.3.0-a6xx` bundle provides a plain
|
||||
Adreno 6xx offline fallback for other devices; their driver Auto behavior remains.
|
||||
Neither family-wide hardware coverage nor Quest 2 operation has been verified.
|
||||
|
||||
The A6xx input URL and SHA-256 are pinned in `tools/quest/build-driver.py`.
|
||||
Both A6xx bundles are prepared by the existing local/CI wrapper build step and
|
||||
covered by runtime-input attestation. Quest 3/3S retains its original driver.
|
||||
Early installation and compositor breadcrumbs are written to `driver-setup.txt`
|
||||
in private files and, when available, the app's external files directory. They
|
||||
do not require a Steam session. The existing Quest Java crash file now also
|
||||
applies to Quest 2; native crashes still require Android logcat.
|
||||
OpenXR support. Quest 2 is outside the bundled Adreno 7xx driver path.
|
||||
|
||||
Install the standard DroidDeck APK on Quest 3/3S. Device detection on the
|
||||
first launch selects manual drivers, the bundled
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
--- a/src/steamcompmgr.cpp
|
||||
+++ b/src/steamcompmgr.cpp
|
||||
@@ -7979,6 +7979,18 @@
|
||||
{
|
||||
gpuvis_trace_printf( "commit %lu done", w->commit_queue[ j ]->commitID );
|
||||
w->commit_queue[ j ]->done = true;
|
||||
+ if (w->appID == 1794680) {
|
||||
+ static uint64_t last=0, start=0; static unsigned h[12]={};
|
||||
+ const uint64_t now=get_time_in_nanos();
|
||||
+ if (last) h[std::min<uint64_t>((now-last)/4000000,11)]++;
|
||||
+ last=now; if (!start) start=now;
|
||||
+ if (now-start>=10000000000ULL) {
|
||||
+ fprintf(stderr,"[dd-latch] span=%lu bins4ms:",now-start);
|
||||
+ for (unsigned value:h) fprintf(stderr," %u",value);
|
||||
+ fprintf(stderr,"\n"); memset(h,0,sizeof(h)); start=now;
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
w->commit_queue[ j ]->earliest_present_time = earliestPresentTime;
|
||||
w->commit_queue[ j ]->present_margin = earliestPresentTime - earliestLatchTime;
|
||||
bFoundWindow = true;
|
||||
--- a/src/Backends/WaylandBackend.cpp
|
||||
+++ b/src/Backends/WaylandBackend.cpp
|
||||
@@ -1473,6 +1473,20 @@
|
||||
|
||||
void CWaylandPlane::Present( std::optional<WaylandPlaneState> oState )
|
||||
{
|
||||
+ static wl_buffer *lastBuffer=nullptr;
|
||||
+ if (oState && oState->bOpaque && oState->flSrcWidth>1 && oState->pBuffer!=lastBuffer) {
|
||||
+ lastBuffer=oState->pBuffer;
|
||||
+ static uint64_t last=0, start=0; static unsigned h[12]={};
|
||||
+ const uint64_t now=get_time_in_nanos();
|
||||
+ if (last) h[std::min<uint64_t>((now-last)/4000000,11)]++;
|
||||
+ last=now; if (!start) start=now;
|
||||
+ if (now-start>=10000000000ULL) {
|
||||
+ fprintf(stderr,"[dd-plane-cadence] span=%lu bins4ms:",now-start);
|
||||
+ for (unsigned value:h) fprintf(stderr," %u",value);
|
||||
+ fprintf(stderr,"\n"); memset(h,0,sizeof(h)); start=now;
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
{
|
||||
std::unique_lock lock( m_PlaneStateLock );
|
||||
m_oCurrentPlaneState = oState;
|
||||
@@ -1,54 +0,0 @@
|
||||
diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp
|
||||
index 5b0e300..7c85f0c 100644
|
||||
--- a/src/steamcompmgr.cpp
|
||||
+++ b/src/steamcompmgr.cpp
|
||||
@@ -10391,6 +10391,40 @@ steamcompmgr_main(int argc, char **argv)
|
||||
// application can commit a new frame that completes before we ever displayed
|
||||
// the current pending commit.
|
||||
static uint64_t vblank_idx = 0;
|
||||
+ // The limiter shows a capped window's frames on every Nth refresh (vblank_idx % N). Count
|
||||
+ // refreshes, not timer wakeups: nested in a host compositor the timer is re-armed from each
|
||||
+ // presentation feedback, and it can wake twice for one refresh or sleep through one under
|
||||
+ // load. Every such wakeup moved the cap's slot by a refresh, so a game capped at 30 on a
|
||||
+ // 60 Hz host reached it 1 and 3 refreshes apart a quarter of the time.
|
||||
+ // (With VRR the limiter schedules by time instead, and vblanks need not come from the timer.)
|
||||
+ static uint64_t s_ulLastIndexedVBlank = 0;
|
||||
+ if ( vblank && !bVRR )
|
||||
+ {
|
||||
+ const uint64_t ulTarget = g_SteamCompMgrVBlankTime.schedule.ulTargetVBlank;
|
||||
+ const uint64_t ulCycle = gamescope::mHzToRefreshCycle( g_nNestedRefresh ? g_nNestedRefresh : g_nOutputRefresh );
|
||||
+ if ( s_ulLastIndexedVBlank && ulCycle && ulTarget + ulCycle / 2 > s_ulLastIndexedVBlank )
|
||||
+ {
|
||||
+ const uint64_t ulRefreshes = ( ulTarget + ulCycle / 2 - s_ulLastIndexedVBlank ) / ulCycle;
|
||||
+ if ( ulRefreshes == 0 )
|
||||
+ vblank = false; // A second wakeup for a refresh already handled.
|
||||
+ else
|
||||
+ {
|
||||
+ vblank_idx += ulRefreshes;
|
||||
+ s_ulLastIndexedVBlank = ulTarget;
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if ( s_ulLastIndexedVBlank )
|
||||
+ vblank = false; // A refresh earlier than one already handled.
|
||||
+ else
|
||||
+ s_ulLastIndexedVBlank = ulTarget;
|
||||
+ }
|
||||
+ }
|
||||
+ else if ( vblank )
|
||||
+ {
|
||||
+ vblank_idx++;
|
||||
+ }
|
||||
if ( vblank )
|
||||
{
|
||||
{
|
||||
@@ -10441,8 +10475,6 @@ steamcompmgr_main(int argc, char **argv)
|
||||
|
||||
if ( vblank )
|
||||
{
|
||||
- vblank_idx++;
|
||||
-
|
||||
int nRealRefreshmHz = g_nNestedRefresh ? g_nNestedRefresh : g_nOutputRefresh;
|
||||
g_SteamCompMgrAppRefreshCycle = gamescope::mHzToRefreshCycle( nRealRefreshmHz );
|
||||
g_SteamCompMgrLimitedAppRefreshCycle = g_SteamCompMgrAppRefreshCycle;
|
||||
@@ -0,0 +1,36 @@
|
||||
--- a/src/vblankmanager.cpp
|
||||
+++ b/src/vblankmanager.cpp
|
||||
@@ -89,7 +89,12 @@
|
||||
|
||||
uint64_t ulTargetPoint = GetLastVBlank() + ulIntervalNSecs - ulOffset;
|
||||
|
||||
- while ( ulTargetPoint < ulNow )
|
||||
+ // Host feedback can re-arm us after we already woke for this refresh.
|
||||
+ // A decaying draw offset then puts the same refresh's wakeup ahead of
|
||||
+ // now again. Do not count it twice; allow small host-clock corrections.
|
||||
+ const uint64_t ulLastTimerVBlank = m_ulLastTimerVBlank.load();
|
||||
+ while ( ulTargetPoint < ulNow ||
|
||||
+ ulTargetPoint + ulOffset < ulLastTimerVBlank + ulIntervalNSecs / 2 )
|
||||
ulTargetPoint += ulIntervalNSecs;
|
||||
|
||||
return ulTargetPoint;
|
||||
@@ -299,6 +304,8 @@
|
||||
return;
|
||||
|
||||
|
||||
+ m_ulLastTimerVBlank = m_TimerFDSchedule.ulTargetVBlank;
|
||||
+
|
||||
m_PendingVBlank = VBlankTime
|
||||
{
|
||||
.schedule = m_TimerFDSchedule,
|
||||
--- a/src/vblankmanager.hpp
|
||||
+++ b/src/vblankmanager.hpp
|
||||
@@ -69,6 +69,8 @@
|
||||
|
||||
uint64_t m_ulTargetVBlank = 0;
|
||||
std::atomic<uint64_t> m_ulLastVBlank = { 0 };
|
||||
+ // Last timerfd refresh dispatched; the frame-sync/nudge path is unchanged.
|
||||
+ std::atomic<uint64_t> m_ulLastTimerVBlank = { 0 };
|
||||
std::atomic<bool> m_bArmed = { false };
|
||||
std::atomic<bool> m_bRunning = { true };
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
--- a/src/Backends/WaylandBackend.cpp
|
||||
+++ b/src/Backends/WaylandBackend.cpp
|
||||
@@ -1183,7 +1183,12 @@
|
||||
wl_display_flush( m_pBackend->GetDisplay() );
|
||||
|
||||
GetVBlankTimer().UpdateWasCompositing( bNeedsFullComposite );
|
||||
- GetVBlankTimer().UpdateLastDrawTime( get_time_in_nanos() - g_SteamCompMgrVBlankTime.ulWakeupTime );
|
||||
+ // Direct planes still need time for the host compositor to dispatch and draw.
|
||||
+ // Measuring only our submission lets the offset decay towards the host's
|
||||
+ // latch deadline, so small dispatch delays make a capped frame miss a refresh.
|
||||
+ GetVBlankTimer().UpdateLastDrawTime( std::max<uint64_t>(
|
||||
+ get_time_in_nanos() - g_SteamCompMgrVBlankTime.ulWakeupTime,
|
||||
+ CVBlankTimer::kDefaultVBlankDrawTimeMinCompositing ) );
|
||||
|
||||
m_pBackend->PollState();
|
||||
|
||||
@@ -489,60 +489,6 @@ case $mode in
|
||||
done
|
||||
) &
|
||||
fi
|
||||
# zRAM compression (BL_ZRAM): 20 s into a game the client and its web helpers page their memory
|
||||
# out to the device's zram (libblsession zram.c), again every 5 minutes, and read it back once
|
||||
# the game has exited. A game is running while Steam's reaper is.
|
||||
if [ "${BL_ZRAM:-0}" = 1 ]; then
|
||||
printf 0 > /tmp/.bl-zram
|
||||
step "zRAM compression: on"
|
||||
(
|
||||
bl_zram_scan() {
|
||||
_bl_game=0 _bl_pids=()
|
||||
for _d in /proc/[0-9]*; do
|
||||
IFS= read -r -d '' _c 2>/dev/null < "$_d/cmdline" || continue
|
||||
case ${_c##*/} in
|
||||
reaper) _bl_game=1 ;;
|
||||
steam|steamwebhelper) _bl_pids+=("${_d#/proc/}") ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
bl_zram_usage() {
|
||||
local _p _k _v _u _rss=0 _swap=0
|
||||
for _p in "${_bl_pids[@]}"; do
|
||||
while read -r _k _v _u; do
|
||||
case $_k in VmRSS:) _rss=$((_rss + _v)) ;; VmSwap:) _swap=$((_swap + _v)) ;; esac
|
||||
done 2>/dev/null < "/proc/$_p/status"
|
||||
done
|
||||
echo "${#_bl_pids[@]} processes, resident $((_rss / 1024)) MB, in zram $((_swap / 1024)) MB"
|
||||
}
|
||||
bl_zram_send() {
|
||||
step "zRAM: $2 ($(bl_zram_usage))"
|
||||
printf '%s' "$1" > /tmp/.bl-zram
|
||||
[ "${#_bl_pids[@]}" = 0 ] || kill -URG "${_bl_pids[@]}" 2>/dev/null
|
||||
nap 5
|
||||
bl_zram_scan
|
||||
step "zRAM: done ($(bl_zram_usage))"
|
||||
}
|
||||
_bl_since=-1 _bl_packed=-1
|
||||
while kill -0 $$ 2>/dev/null; do
|
||||
bl_zram_scan
|
||||
if [ "$_bl_game" = 1 ]; then
|
||||
[ "$_bl_since" -ge 0 ] || _bl_since=$SECONDS
|
||||
if [ $((SECONDS - _bl_since)) -ge 20 ] && [ "${#_bl_pids[@]}" -gt 0 ] &&
|
||||
{ [ "$_bl_packed" -lt 0 ] || [ $((SECONDS - _bl_packed)) -ge 300 ]; }; then
|
||||
bl_zram_send 1 "compressing the client"
|
||||
_bl_packed=$SECONDS
|
||||
fi
|
||||
elif [ "$_bl_since" -ge 0 ]; then
|
||||
[ "$_bl_packed" -lt 0 ] || bl_zram_send 0 "game closed, reading the client back"
|
||||
_bl_since=-1 _bl_packed=-1
|
||||
fi
|
||||
nap 5
|
||||
done
|
||||
) &
|
||||
else
|
||||
rm -f /tmp/.bl-zram
|
||||
fi
|
||||
# Rockstar's launcher keeps drawing its hidden web interface for as long as a game of theirs
|
||||
# runs; droiddeck-launcher-cores holds it on one slow core while it is out of sight, from
|
||||
# gamescope's focus as the agent publishes it. BL_LAUNCHER_CORES=0 leaves launchers alone.
|
||||
|
||||
@@ -1,176 +0,0 @@
|
||||
#define _GNU_SOURCE
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
#include <signal.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/uio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* zRAM for the Steam client while a game runs: on SIGURG the process pages its private anonymous
|
||||
* memory out (ZR_CTL holds 1) or reads it back (0). Raw syscalls only, as this library wraps
|
||||
* close(), openat() and syscall(). */
|
||||
|
||||
#ifndef MADV_PAGEOUT
|
||||
#define MADV_PAGEOUT 21
|
||||
#endif
|
||||
#ifndef ZR_CTL
|
||||
#define ZR_CTL "/tmp/.bl-zram"
|
||||
#endif
|
||||
#define ZR_SWAPPED (1ULL << 62)
|
||||
#define ZR_BATCH 512
|
||||
|
||||
static long (*zr_sys)(long, ...);
|
||||
static unsigned long zr_page;
|
||||
static int zr_busy;
|
||||
static int zr_pending;
|
||||
static char zr_maps[8192];
|
||||
static uint64_t zr_entries[ZR_BATCH];
|
||||
static struct iovec zr_iov[ZR_BATCH];
|
||||
static char zr_sink[ZR_BATCH];
|
||||
|
||||
static int zr_open(const char *path) {
|
||||
return (int)zr_sys(SYS_openat, AT_FDCWD, path, O_RDONLY | O_CLOEXEC, 0);
|
||||
}
|
||||
|
||||
static int zr_mode(void) {
|
||||
char c = 0;
|
||||
int fd = zr_open(ZR_CTL);
|
||||
if (fd < 0) return -1;
|
||||
long n = zr_sys(SYS_read, fd, &c, 1);
|
||||
zr_sys(SYS_close, fd);
|
||||
return n == 1 && (c == '0' || c == '1') ? c - '0' : -1;
|
||||
}
|
||||
|
||||
static unsigned long zr_hex(const char **p) {
|
||||
unsigned long v = 0;
|
||||
for (;; (*p)++) {
|
||||
char c = **p;
|
||||
if (c >= '0' && c <= '9') v = v * 16 + (unsigned long)(c - '0');
|
||||
else if (c >= 'a' && c <= 'f') v = v * 16 + (unsigned long)(c - 'a' + 10);
|
||||
else return v;
|
||||
}
|
||||
}
|
||||
|
||||
/* Paged out: private writable anonymous memory (the heap, unnamed and [anon:name] mappings).
|
||||
* Read back: every private readable mapping, as the kernel may have swapped others meanwhile. */
|
||||
static int zr_eligible(const char *line, int compress, unsigned long *start, unsigned long *end) {
|
||||
const char *p = line;
|
||||
*start = zr_hex(&p);
|
||||
if (*p++ != '-') return 0;
|
||||
*end = zr_hex(&p);
|
||||
if (*p++ != ' ' || p[0] != 'r' || p[3] != 'p') return 0;
|
||||
if (!compress) return 1;
|
||||
if (p[1] != 'w') return 0;
|
||||
for (int field = 0; field < 4; field++) {
|
||||
while (*p && *p != ' ') p++;
|
||||
while (*p == ' ') p++;
|
||||
}
|
||||
return *p == 0 || strncmp(p, "[heap]", 6) == 0 || strncmp(p, "[anon:", 6) == 0;
|
||||
}
|
||||
|
||||
static void zr_read_back(int pagemap, unsigned long start, unsigned long end) {
|
||||
pid_t self = (pid_t)zr_sys(SYS_getpid);
|
||||
struct iovec local = {zr_sink, 0};
|
||||
for (unsigned long addr = start; addr < end;) {
|
||||
unsigned long count = (end - addr) / zr_page;
|
||||
if (count > ZR_BATCH) count = ZR_BATCH;
|
||||
if (zr_sys(SYS_lseek, pagemap, (long)(addr / zr_page * sizeof(uint64_t)), SEEK_SET) < 0) return;
|
||||
long got = zr_sys(SYS_read, pagemap, zr_entries, count * sizeof(uint64_t));
|
||||
if (got < (long)sizeof(uint64_t)) return;
|
||||
unsigned long n = 0;
|
||||
for (unsigned long i = 0; i < (unsigned long)got / sizeof(uint64_t); i++) {
|
||||
if (!(zr_entries[i] & ZR_SWAPPED)) continue;
|
||||
zr_iov[n].iov_base = (void *)(addr + i * zr_page);
|
||||
zr_iov[n++].iov_len = 1;
|
||||
}
|
||||
for (unsigned long done = 0; done < n;) {
|
||||
local.iov_len = n - done;
|
||||
long r = zr_sys(SYS_process_vm_readv, self, &local, 1UL, zr_iov + done, n - done, 0UL);
|
||||
done += r > 0 ? (unsigned long)r : 1;
|
||||
}
|
||||
addr += (unsigned long)got / sizeof(uint64_t) * zr_page;
|
||||
}
|
||||
}
|
||||
|
||||
static void zr_walk(int compress) {
|
||||
int maps = zr_open("/proc/self/maps");
|
||||
if (maps < 0) return;
|
||||
int pagemap = compress ? -1 : zr_open("/proc/self/pagemap");
|
||||
if (!compress && pagemap < 0) {
|
||||
zr_sys(SYS_close, maps);
|
||||
return;
|
||||
}
|
||||
size_t have = 0;
|
||||
for (;;) {
|
||||
long n = zr_sys(SYS_read, maps, zr_maps + have, sizeof(zr_maps) - 1 - have);
|
||||
if (n < 0 && errno == EINTR) continue;
|
||||
if (n <= 0) break;
|
||||
have += (size_t)n;
|
||||
zr_maps[have] = 0;
|
||||
char *line = zr_maps;
|
||||
char *nl;
|
||||
while ((nl = memchr(line, '\n', have - (size_t)(line - zr_maps))) != NULL) {
|
||||
*nl = 0;
|
||||
unsigned long s, e;
|
||||
if (zr_eligible(line, compress, &s, &e) && e > s) {
|
||||
if (compress) zr_sys(SYS_madvise, s, e - s, MADV_PAGEOUT);
|
||||
else zr_read_back(pagemap, s, e);
|
||||
}
|
||||
line = nl + 1;
|
||||
}
|
||||
have -= (size_t)(line - zr_maps);
|
||||
memmove(zr_maps, line, have);
|
||||
if (have == sizeof(zr_maps) - 1) have = 0;
|
||||
}
|
||||
if (pagemap >= 0) zr_sys(SYS_close, pagemap);
|
||||
zr_sys(SYS_close, maps);
|
||||
}
|
||||
|
||||
static void zr_handler(int sig, siginfo_t *info, void *context) {
|
||||
(void)sig;
|
||||
(void)context;
|
||||
if (info == NULL || info->si_code != SI_USER) return;
|
||||
int saved = errno;
|
||||
__atomic_store_n(&zr_pending, 1, __ATOMIC_SEQ_CST);
|
||||
while (__atomic_load_n(&zr_pending, __ATOMIC_SEQ_CST)
|
||||
&& !__atomic_exchange_n(&zr_busy, 1, __ATOMIC_SEQ_CST)) {
|
||||
__atomic_store_n(&zr_pending, 0, __ATOMIC_SEQ_CST);
|
||||
int mode = zr_mode();
|
||||
if (mode >= 0) zr_walk(mode);
|
||||
__atomic_store_n(&zr_busy, 0, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
errno = saved;
|
||||
}
|
||||
|
||||
static void zr_child(void) {
|
||||
__atomic_store_n(&zr_busy, 0, __ATOMIC_SEQ_CST);
|
||||
__atomic_store_n(&zr_pending, 0, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
|
||||
__attribute__((constructor)) static void zr_init(void) {
|
||||
const char *name = program_invocation_short_name;
|
||||
if (strcmp(name, "steam") != 0 && strcmp(name, "steamwebhelper") != 0) return;
|
||||
void *libc = dlopen("libc.so.6", RTLD_LAZY | RTLD_NOLOAD);
|
||||
if (libc == NULL) return;
|
||||
zr_sys = (long (*)(long, ...))dlsym(libc, "syscall");
|
||||
if (zr_sys == NULL) return;
|
||||
int fd = zr_open(ZR_CTL);
|
||||
if (fd < 0) return;
|
||||
zr_sys(SYS_close, fd);
|
||||
long page = sysconf(_SC_PAGESIZE);
|
||||
zr_page = page > 0 ? (unsigned long)page : 4096UL;
|
||||
struct sigaction old;
|
||||
if (sigaction(SIGURG, NULL, &old) != 0) return;
|
||||
if ((old.sa_flags & SA_SIGINFO) || old.sa_handler != SIG_DFL) return;
|
||||
struct sigaction sa;
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
sa.sa_sigaction = zr_handler;
|
||||
sa.sa_flags = SA_SIGINFO | SA_RESTART;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
if (sigaction(SIGURG, &sa, NULL) == 0) pthread_atfork(NULL, NULL, zr_child);
|
||||
}
|
||||
@@ -7,81 +7,9 @@ import subprocess
|
||||
import sys
|
||||
import tarfile
|
||||
import tempfile
|
||||
import hashlib
|
||||
import urllib.request
|
||||
import zipfile
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
OUTPUT = ROOT / 'app/build/prepared-assets/graphics_driver/adrenotools-turnip25.1.0-quest1.tzst'
|
||||
A6XX_TAG = 'v26.3.0-20261012-r2'
|
||||
A6XX_SHA256 = 'bb1b2c51e6446cf428d70255d037be169ac68108c00af33aa1ba7ece711f8336'
|
||||
A6XX_URL = f'https://github.com/The412Banner/Banners-Turnip/releases/download/{A6XX_TAG}/Turnip-{A6XX_TAG}.zip'
|
||||
|
||||
|
||||
def pack(entries, output):
|
||||
stream = io.BytesIO()
|
||||
with tarfile.open(fileobj=stream, mode='w', format=tarfile.USTAR_FORMAT) as archive:
|
||||
for name, content in entries:
|
||||
entry = tarfile.TarInfo(name)
|
||||
entry.size = len(content)
|
||||
entry.mode = 0o644
|
||||
archive.addfile(entry, io.BytesIO(content))
|
||||
compressed = subprocess.run(['zstd', '-q', '-19', '-c'], input=stream.getvalue(),
|
||||
capture_output=True, check=True).stdout
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
output.write_bytes(compressed)
|
||||
print(output)
|
||||
|
||||
|
||||
def build_a6xx(ndk, output_dir=OUTPUT.parent, archive_path=None):
|
||||
"""Pin a real A6xx driver, with a separate Quest adapter around the same bytes."""
|
||||
cached = archive_path or ROOT / 'app/build/quest-inputs' / f'Turnip-{A6XX_TAG}.zip'
|
||||
if not cached.exists():
|
||||
cached.parent.mkdir(parents=True, exist_ok=True)
|
||||
data = urllib.request.urlopen(A6XX_URL, timeout=120).read()
|
||||
if hashlib.sha256(data).hexdigest() != A6XX_SHA256:
|
||||
raise ValueError('A6xx archive checksum mismatch')
|
||||
cached.write_bytes(data)
|
||||
data = cached.read_bytes()
|
||||
if hashlib.sha256(data).hexdigest() != A6XX_SHA256:
|
||||
raise ValueError('A6xx archive checksum mismatch')
|
||||
with zipfile.ZipFile(io.BytesIO(data)) as archive:
|
||||
driver = archive.read('libvulkan_freedreno.so')
|
||||
original_meta = json.loads(archive.read('meta.json'))
|
||||
if original_meta.get('libraryName') != 'libvulkan_freedreno.so':
|
||||
raise ValueError('Unexpected A6xx driver library')
|
||||
hosts = list((Path(ndk) / 'toolchains/llvm/prebuilt').glob('*'))
|
||||
if len(hosts) != 1:
|
||||
raise ValueError('Expected one NDK host toolchain')
|
||||
llvm = hosts[0] / 'bin'
|
||||
provenance = (f'Banners-Turnip {A6XX_TAG}\n{A6XX_URL}\nSHA256 {A6XX_SHA256}\n'
|
||||
'Mesa source: a0ff50acf0e1d152f54949490fa41558d2e0f7a4\n'
|
||||
'Quest adapter: DroidDeck tools/quest (GPL-3.0-or-later)\n').encode()
|
||||
for quest in (False, True):
|
||||
meta = dict(original_meta)
|
||||
meta['name'] = 'Turnip Adreno 6xx' + (' - Quest 2 GPUOBJ experimental' if quest else ' - bundled fallback')
|
||||
meta['description'] += ' Bundled for Adreno 6xx; Quest 2 hardware validation pending.'
|
||||
entries = [('libvulkan_freedreno.so', driver), ('SOURCE.txt', provenance)]
|
||||
if quest:
|
||||
with tempfile.TemporaryDirectory(prefix='quest-a6xx-') as folder:
|
||||
work = Path(folder)
|
||||
original = work / 'libvulkan_freedreno.so'
|
||||
original.write_bytes(driver)
|
||||
wrapper = work / 'libquest_turnip.so'
|
||||
subprocess.run([
|
||||
str(llvm / 'aarch64-linux-android28-clang'), '-shared', '-fPIC', '-O2',
|
||||
'-Wall', '-Wextra', '-Werror', '-fvisibility=hidden',
|
||||
'-Wl,-z,max-page-size=16384', '-Wl,-soname,libquest_turnip.so',
|
||||
'-Wl,--no-as-needed', str(original), '-Wl,--as-needed',
|
||||
str(ROOT / 'tools/quest/android_wrapper.c'), str(ROOT / 'tools/quest/kgsl_compat.c'),
|
||||
'-ldl', '-llog', '-o', str(wrapper),
|
||||
], check=True)
|
||||
subprocess.run([str(llvm / 'llvm-strip'), '--strip-unneeded', str(wrapper)], check=True)
|
||||
entries.append(('libquest_turnip.so', wrapper.read_bytes()))
|
||||
meta['libraryName'] = 'libquest_turnip.so'
|
||||
entries.append(('meta.json', (json.dumps(meta, indent=2) + '\n').encode()))
|
||||
name = 'turnip26.3.0-quest2' if quest else 'turnip26.3.0-a6xx'
|
||||
pack(entries, output_dir / f'adrenotools-{name}.tzst')
|
||||
|
||||
|
||||
def build(ndk, output=OUTPUT):
|
||||
@@ -130,4 +58,3 @@ def build(ndk, output=OUTPUT):
|
||||
|
||||
if __name__ == '__main__':
|
||||
build(sys.argv[1])
|
||||
build_a6xx(sys.argv[1])
|
||||
@@ -53,16 +53,11 @@ def outputs(root):
|
||||
result['assets/pulseaudio.tzst'] = 'app/build/prepared-assets/pulseaudio.tzst'
|
||||
result['assets/graphics_driver/adrenotools-turnip25.1.0-quest1.tzst'] = \
|
||||
'app/build/prepared-assets/graphics_driver/adrenotools-turnip25.1.0-quest1.tzst'
|
||||
for name in ['turnip26.3.0-a6xx', 'turnip26.3.0-quest2']:
|
||||
result[f'assets/graphics_driver/adrenotools-{name}.tzst'] = \
|
||||
f'app/build/prepared-assets/graphics_driver/adrenotools-{name}.tzst'
|
||||
return result
|
||||
|
||||
|
||||
def required():
|
||||
paths = ['assets/graphics_driver/adrenotools-turnip25.1.0-quest1.tzst']
|
||||
paths += [f'assets/graphics_driver/adrenotools-{name}.tzst'
|
||||
for name in ['turnip26.3.0-a6xx', 'turnip26.3.0-quest2']]
|
||||
paths += ['assets/linuxfs/' + name for name in ['libfakeinput.so', 'libblsession.so',
|
||||
'libblfastpath.so', 'libssbs.so', 'usr/local/bin/droiddeck-clipboard',
|
||||
'usr/local/bin/gamescope', 'usr/local/lib/droiddeck/uruntime']]
|
||||
|
||||
@@ -1,176 +0,0 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
PRELOAD = Path(__file__).resolve().parents[1] / "linuxfs/preload"
|
||||
|
||||
PROGRAM = r"""
|
||||
#define _GNU_SOURCE
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
#include <signal.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static const char *ctl;
|
||||
static size_t size, page;
|
||||
static volatile int stop;
|
||||
static unsigned char *shared;
|
||||
|
||||
static long status(const char *key) {
|
||||
FILE *f = fopen("/proc/self/status", "r");
|
||||
char line[256];
|
||||
long v = -1;
|
||||
while (f && fgets(line, sizeof(line), f))
|
||||
if (!strncmp(line, key, strlen(key))) v = atol(line + strlen(key));
|
||||
if (f) fclose(f);
|
||||
return v;
|
||||
}
|
||||
|
||||
static void request(char mode) {
|
||||
int fd = open(ctl, O_WRONLY | O_TRUNC);
|
||||
if (fd < 0 || write(fd, &mode, 1) != 1) exit(3);
|
||||
close(fd);
|
||||
kill(getpid(), SIGURG);
|
||||
}
|
||||
|
||||
static uint64_t sum(const unsigned char *p, size_t n) {
|
||||
uint64_t s = 0;
|
||||
for (size_t i = 0; i < n; i += 64) s = s * 31 + p[i];
|
||||
return s;
|
||||
}
|
||||
|
||||
/* Rewrites its pages with a round number and checks every page it wrote last round. */
|
||||
static void *writer(void *arg) {
|
||||
unsigned char *mine = shared + (size_t)(uintptr_t)arg * (size / 4);
|
||||
for (unsigned char round = 1; !stop; round++) {
|
||||
for (size_t i = 0; i < size / 4; i += page) {
|
||||
if (round > 1 && mine[i] != (unsigned char)(round - 1)) {
|
||||
printf("corrupt\n");
|
||||
exit(4);
|
||||
}
|
||||
mine[i] = round;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
ctl = argv[1];
|
||||
size = strtoul(argv[2], NULL, 0) << 20;
|
||||
int cycles = atoi(argv[3]);
|
||||
page = (size_t)sysconf(_SC_PAGESIZE);
|
||||
unsigned char *data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
for (size_t i = 0; i < size; i++) data[i] = (unsigned char)(i * 7 + i / 4096);
|
||||
uint64_t before = sum(data, size);
|
||||
shared = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
memset(shared, 0, size);
|
||||
pthread_t t[2];
|
||||
for (uintptr_t i = 0; i < 2; i++) pthread_create(&t[i], NULL, writer, (void *)i);
|
||||
struct sigaction sa;
|
||||
sigaction(SIGURG, NULL, &sa);
|
||||
printf("handler %d\n", (sa.sa_flags & SA_SIGINFO) ? 1 : 0);
|
||||
if (argc > 4) {
|
||||
/* Read-only memory the process never pages out itself, swapped as the kernel would. */
|
||||
unsigned char *ro = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
memset(ro, 0x5a, size);
|
||||
mprotect(ro, size, PROT_READ);
|
||||
madvise(ro, size, 21);
|
||||
printf("elsewhere %ld\n", status("VmSwap:"));
|
||||
request('0');
|
||||
printf("back %ld\n", status("VmSwap:"));
|
||||
}
|
||||
for (int c = 0; c < cycles; c++) {
|
||||
request('1');
|
||||
printf("out %ld\n", status("VmSwap:"));
|
||||
request('0');
|
||||
printf("back %ld\n", status("VmSwap:"));
|
||||
}
|
||||
stop = 1;
|
||||
for (int i = 0; i < 2; i++) pthread_join(t[i], NULL);
|
||||
printf("intact %d\n", sum(data, size) == before);
|
||||
return 0;
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
def swap_total_kb():
|
||||
for line in Path("/proc/meminfo").read_text().splitlines():
|
||||
if line.startswith("SwapTotal:"):
|
||||
return int(line.split()[1])
|
||||
return 0
|
||||
|
||||
|
||||
@unittest.skipUnless(shutil.which("cc"), "needs a C compiler")
|
||||
class ZramPreloadTest(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.dir = Path(tempfile.mkdtemp())
|
||||
cls.ctl = cls.dir / "ctl"
|
||||
build = cls.dir / "build"
|
||||
build.mkdir()
|
||||
(build / "program.c").write_text(PROGRAM)
|
||||
cls.lib = build / "libblsession.so"
|
||||
subprocess.run(["cc", "-shared", "-fPIC", "-O2", "-Wall", "-pthread", "-DZR_CTL=\"%s\"" % cls.ctl,
|
||||
"-o", str(cls.lib), *map(str, sorted(PRELOAD.glob("*.c"))), "-ldl"], check=True)
|
||||
cls.steam = cls.dir / "steam"
|
||||
subprocess.run(["cc", "-O2", "-pthread", "-o", str(cls.steam), str(build / "program.c")], check=True)
|
||||
cls.game = cls.dir / "game"
|
||||
shutil.copy(cls.steam, cls.game)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
shutil.rmtree(cls.dir, True)
|
||||
|
||||
def setUp(self):
|
||||
self.ctl.write_text("0")
|
||||
|
||||
def run_program(self, program=None, mb=48, cycles=1, *extra):
|
||||
environment = dict(os.environ, LD_PRELOAD=str(self.lib))
|
||||
result = subprocess.run([str(program or self.steam), str(self.ctl), str(mb), str(cycles), *extra], env=environment,
|
||||
capture_output=True, text=True, check=True, timeout=120)
|
||||
out = {}
|
||||
for line in result.stdout.splitlines():
|
||||
key, value = line.split()
|
||||
out.setdefault(key, []).append(int(value))
|
||||
return out
|
||||
|
||||
def test_only_the_client_takes_the_signal(self):
|
||||
self.assertEqual([1], self.run_program()["handler"])
|
||||
self.assertEqual([0], self.run_program(self.game)["handler"])
|
||||
|
||||
def test_nothing_is_installed_without_the_control_file(self):
|
||||
self.ctl.unlink()
|
||||
try:
|
||||
self.assertEqual([0], self.run_program(cycles=0)["handler"])
|
||||
finally:
|
||||
self.ctl.write_text("0")
|
||||
|
||||
@unittest.skipUnless(swap_total_kb() > 256 * 1024, "needs swap")
|
||||
def test_pages_out_and_reads_back(self):
|
||||
out = self.run_program(mb=48)
|
||||
self.assertGreater(out["out"][0], 32 * 1024)
|
||||
self.assertLess(out["back"][0], out["out"][0] // 4)
|
||||
self.assertEqual([1], out["intact"])
|
||||
|
||||
@unittest.skipUnless(swap_total_kb() > 256 * 1024, "needs swap")
|
||||
def test_reads_back_what_the_kernel_swapped_elsewhere(self):
|
||||
out = self.run_program(None, 32, 0, "read-only")
|
||||
self.assertGreater(out["elsewhere"][0], 16 * 1024)
|
||||
self.assertLess(out["back"][0], out["elsewhere"][0] // 4)
|
||||
|
||||
def test_memory_stays_intact_under_writers(self):
|
||||
out = self.run_program(mb=32, cycles=6)
|
||||
self.assertEqual([1], out["intact"])
|
||||
self.assertEqual(6, len(out["out"]))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user