mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-21 22:05:59 +00:00
chore: consistent code branding (#2800)
* chore: consistent code branding * fix: carry legacy overrides, queues and live sync rows across the rename * fix: keep queued legacy overrides on a failed rename and separate merged queue entries
This commit is contained in:
1 parent
ad9348879d
commit
eabcfc7b74
229 files changed
+2584
-2468
No files matched your search
@@ -2312,7 +2312,7 @@ __attribute__((visibility("hidden"))) static int inject_uevent(const char *actio
|
||||
const char *subsystem, const char *devname,
|
||||
unsigned major, unsigned minor) {
|
||||
using inject_fn = int (*)(const char *, const char *, const char *, const char *, unsigned, unsigned);
|
||||
static auto inject = reinterpret_cast<inject_fn>(dlsym(RTLD_DEFAULT, "bl_udevmon_inject"));
|
||||
static auto inject = reinterpret_cast<inject_fn>(dlsym(RTLD_DEFAULT, "dd_udevmon_inject"));
|
||||
return inject ? inject(action, devpath, subsystem, devname, major, minor) : -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ add_library(droiddeckwayland SHARED
|
||||
generated/linux-dmabuf-v1-protocol.c
|
||||
generated/wayland-android-protocol.c
|
||||
generated/viewporter-protocol.c
|
||||
generated/banner-desktop-v1-protocol.c
|
||||
generated/droiddeck-desktop-v1-protocol.c
|
||||
generated/presentation-time-protocol.c
|
||||
generated/pointer-constraints-unstable-v1-protocol.c
|
||||
generated/relative-pointer-unstable-v1-protocol.c
|
||||
|
||||
+9
-9
@@ -38,7 +38,7 @@
|
||||
|
||||
extern const struct wl_interface wl_surface_interface;
|
||||
|
||||
static const struct wl_interface *banner_desktop_v1_types[] = {
|
||||
static const struct wl_interface *droiddeck_desktop_v1_types[] = {
|
||||
NULL,
|
||||
&wl_surface_interface,
|
||||
&wl_surface_interface,
|
||||
@@ -47,16 +47,16 @@ static const struct wl_interface *banner_desktop_v1_types[] = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const struct wl_message banner_desktop_v1_requests[] = {
|
||||
{ "destroy", "", banner_desktop_v1_types + 0 },
|
||||
{ "set_desktop", "o", banner_desktop_v1_types + 1 },
|
||||
{ "set_window", "ouii", banner_desktop_v1_types + 2 },
|
||||
{ "set_zorder", "a", banner_desktop_v1_types + 0 },
|
||||
static const struct wl_message droiddeck_desktop_v1_requests[] = {
|
||||
{ "destroy", "", droiddeck_desktop_v1_types + 0 },
|
||||
{ "set_desktop", "o", droiddeck_desktop_v1_types + 1 },
|
||||
{ "set_window", "ouii", droiddeck_desktop_v1_types + 2 },
|
||||
{ "set_zorder", "a", droiddeck_desktop_v1_types + 0 },
|
||||
};
|
||||
|
||||
WL_PRIVATE const struct wl_interface banner_desktop_v1_interface = {
|
||||
"banner_desktop_v1", 1,
|
||||
4, banner_desktop_v1_requests,
|
||||
WL_PRIVATE const struct wl_interface droiddeck_desktop_v1_interface = {
|
||||
"droiddeck_desktop_v1", 1,
|
||||
4, droiddeck_desktop_v1_requests,
|
||||
0, NULL,
|
||||
};
|
||||
|
||||
+12
-12
@@ -1,6 +1,6 @@
|
||||
|
||||
#ifndef BANNER_DESKTOP_V1_SERVER_PROTOCOL_H
|
||||
#define BANNER_DESKTOP_V1_SERVER_PROTOCOL_H
|
||||
#ifndef DROIDDECK_DESKTOP_V1_SERVER_PROTOCOL_H
|
||||
#define DROIDDECK_DESKTOP_V1_SERVER_PROTOCOL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
@@ -14,7 +14,7 @@ struct wl_client;
|
||||
struct wl_resource;
|
||||
|
||||
/*
|
||||
* @section page_copyright_banner_desktop_v1 Copyright
|
||||
* @section page_copyright_droiddeck_desktop_v1 Copyright
|
||||
*
|
||||
* Copyright 2026 The412Banner
|
||||
*
|
||||
@@ -42,15 +42,15 @@ struct wl_resource;
|
||||
|
||||
|
||||
|
||||
struct banner_desktop_v1;
|
||||
struct droiddeck_desktop_v1;
|
||||
struct wl_surface;
|
||||
|
||||
#ifndef BANNER_DESKTOP_V1_INTERFACE
|
||||
#define BANNER_DESKTOP_V1_INTERFACE
|
||||
extern const struct wl_interface banner_desktop_v1_interface;
|
||||
#ifndef DROIDDECK_DESKTOP_V1_INTERFACE
|
||||
#define DROIDDECK_DESKTOP_V1_INTERFACE
|
||||
extern const struct wl_interface droiddeck_desktop_v1_interface;
|
||||
#endif
|
||||
|
||||
struct banner_desktop_v1_interface {
|
||||
struct droiddeck_desktop_v1_interface {
|
||||
void (*destroy)(struct wl_client *client,
|
||||
struct wl_resource *resource);
|
||||
void (*set_desktop)(struct wl_client *client,
|
||||
@@ -68,10 +68,10 @@ struct banner_desktop_v1_interface {
|
||||
};
|
||||
|
||||
|
||||
#define BANNER_DESKTOP_V1_DESTROY_SINCE_VERSION 1
|
||||
#define BANNER_DESKTOP_V1_SET_DESKTOP_SINCE_VERSION 1
|
||||
#define BANNER_DESKTOP_V1_SET_WINDOW_SINCE_VERSION 1
|
||||
#define BANNER_DESKTOP_V1_SET_ZORDER_SINCE_VERSION 1
|
||||
#define DROIDDECK_DESKTOP_V1_DESTROY_SINCE_VERSION 1
|
||||
#define DROIDDECK_DESKTOP_V1_SET_DESKTOP_SINCE_VERSION 1
|
||||
#define DROIDDECK_DESKTOP_V1_SET_WINDOW_SINCE_VERSION 1
|
||||
#define DROIDDECK_DESKTOP_V1_SET_ZORDER_SINCE_VERSION 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="banner_desktop_v1">
|
||||
<protocol name="droiddeck_desktop_v1">
|
||||
<copyright>
|
||||
Copyright 2026 The412Banner
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
</copyright>
|
||||
|
||||
<interface name="banner_desktop_v1" version="1">
|
||||
<interface name="droiddeck_desktop_v1" version="1">
|
||||
<description summary="Windows virtual desktop layout">
|
||||
Each Wine process is a separate Wayland client, so a Windows virtual
|
||||
desktop can't be built from subsurfaces. Instead the process that owns
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "sc_layer.h"
|
||||
#include "ahb_swapchain.h"
|
||||
#include "viewporter-server-protocol.h"
|
||||
#include "banner-desktop-v1-server-protocol.h"
|
||||
#include "droiddeck-desktop-v1-server-protocol.h"
|
||||
#include "presentation-time-server-protocol.h"
|
||||
#include "pointer-constraints-unstable-v1-server-protocol.h"
|
||||
#include "relative-pointer-unstable-v1-server-protocol.h"
|
||||
@@ -79,7 +79,7 @@ static void open_session_log(void) {
|
||||
|
||||
localtime_r(&now, &tm);
|
||||
strftime(stamp, sizeof(stamp), "%Y-%m-%d_%H-%M-%S", &tm);
|
||||
const char *given = getenv("BL_WAYLAND_LOG");
|
||||
const char *given = getenv("DD_WAYLAND_LOG");
|
||||
if (given && *given) {
|
||||
snprintf(path, sizeof(path), "%s", given);
|
||||
} else {
|
||||
@@ -1796,14 +1796,14 @@ static void desktop_set_zorder(struct wl_client *c, struct wl_resource *r, struc
|
||||
apply_zorder();
|
||||
schedule_render();
|
||||
}
|
||||
static const struct banner_desktop_v1_interface desktop_impl = {
|
||||
static const struct droiddeck_desktop_v1_interface desktop_impl = {
|
||||
.destroy = desktop_destroy_req,
|
||||
.set_desktop = desktop_set_desktop,
|
||||
.set_window = desktop_set_window,
|
||||
.set_zorder = desktop_set_zorder,
|
||||
};
|
||||
static void bind_desktop(struct wl_client *c, void *data, uint32_t ver, uint32_t id) {
|
||||
struct wl_resource *r = wl_resource_create(c, &banner_desktop_v1_interface, ver, id);
|
||||
struct wl_resource *r = wl_resource_create(c, &droiddeck_desktop_v1_interface, ver, id);
|
||||
wl_resource_set_implementation(r, &desktop_impl, NULL, NULL);
|
||||
}
|
||||
|
||||
@@ -4083,7 +4083,7 @@ int droiddeck_wayland_run(void) {
|
||||
wl_global_create(display, &zwp_linux_dmabuf_v1_interface, 4, NULL, bind_dmabuf);
|
||||
droiddeck_android_wlegl_init(display);
|
||||
wl_global_create(display, &wl_seat_interface, 9, NULL, bind_seat);
|
||||
wl_global_create(display, &banner_desktop_v1_interface, 1, NULL, bind_desktop);
|
||||
wl_global_create(display, &droiddeck_desktop_v1_interface, 1, NULL, bind_desktop);
|
||||
wl_global_create(display, &wp_presentation_interface, 2, NULL, bind_presentation);
|
||||
wl_global_create(display, &zwp_pointer_constraints_v1_interface, 1, NULL, bind_pointer_constraints);
|
||||
wl_global_create(display, &zwp_relative_pointer_manager_v1_interface, 1, NULL, bind_relative_pointer_manager);
|
||||
|
||||
@@ -2745,7 +2745,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
val waylandLog = File(SessionPaths.beginOrCurrent(this), "wayland.log")
|
||||
WaylandCompositor.setSessionLogFile(waylandLog)
|
||||
try {
|
||||
android.system.Os.setenv("BL_WAYLAND_LOG", waylandLog.path, true)
|
||||
android.system.Os.setenv("DD_WAYLAND_LOG", waylandLog.path, true)
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "could not point the compositor's log at $waylandLog", e)
|
||||
}
|
||||
|
||||
@@ -58,7 +58,8 @@ object AgentEnv {
|
||||
fun override(context: Context, name: String): JSONObject = synchronized(lock) {
|
||||
AgentAccess.requireCommands(context)
|
||||
if (NAME.matchEntire(name) == null || name in setOf(".", "..")) throw AgentException("INVALID_NAME", "Override names are letters, digits, '.', '_' and '-'")
|
||||
if (name == "libblfastpath.so" && (SessionState.running || SessionState.guestPid > 0 || SessionState.phase == SessionPhase.STOPPING)) {
|
||||
if (name == LEGACY_FAST_PATH) throw AgentException("INVALID_NAME", "The fast-path library is now $FAST_PATH")
|
||||
if (name == "libddfastpath.so" && (SessionState.running || SessionState.guestPid > 0 || SessionState.phase == SessionPhase.STOPPING)) {
|
||||
throw AgentException("SESSION_ACTIVE", "Stop the session before installing a fast-path library")
|
||||
}
|
||||
val source = File(inbox(context), name)
|
||||
@@ -73,7 +74,7 @@ object AgentEnv {
|
||||
staged.delete()
|
||||
throw AgentException("OVERRIDE_FAILED", "Could not stage the override")
|
||||
}
|
||||
if (name == "libblfastpath.so" && !arm64SharedLibrary(staged)) {
|
||||
if (name == "libddfastpath.so" && !arm64SharedLibrary(staged)) {
|
||||
staged.delete()
|
||||
throw AgentException("INVALID_LIBRARY", "The fast path must be a 64-bit little-endian ARM64 ELF shared library")
|
||||
}
|
||||
@@ -86,7 +87,7 @@ object AgentEnv {
|
||||
state.put("pendingOverrides", JSONArray(merge(strings(state.optJSONArray("pendingOverrides")), listOf(name))))
|
||||
save(context, state)
|
||||
state.put("installed", "$GUEST_BIN/$name")
|
||||
if (name == "libblfastpath.so") {
|
||||
if (name == "libddfastpath.so") {
|
||||
val digest = MessageDigest.getInstance("SHA-256")
|
||||
target.inputStream().use { input ->
|
||||
val buffer = ByteArray(65536)
|
||||
@@ -103,10 +104,10 @@ object AgentEnv {
|
||||
|
||||
fun fastPathLibrary(context: Context): String = synchronized(lock) {
|
||||
if (!AgentAccess.commandsAllowed(context)) return@synchronized ProotFastPath.LIBRARY
|
||||
if ("libblfastpath.so" !in strings(load(context).optJSONArray("activeOverrides"))) return@synchronized ProotFastPath.LIBRARY
|
||||
val file = File(bin(context), "libblfastpath.so")
|
||||
if ("libddfastpath.so" !in strings(load(context).optJSONArray("activeOverrides"))) return@synchronized ProotFastPath.LIBRARY
|
||||
val file = File(bin(context), "libddfastpath.so")
|
||||
if (!file.isFile || Files.isSymbolicLink(file.toPath())) return@synchronized ProotFastPath.LIBRARY
|
||||
"$GUEST_BIN/libblfastpath.so"
|
||||
"$GUEST_BIN/libddfastpath.so"
|
||||
}
|
||||
|
||||
private fun arm64SharedLibrary(file: File): Boolean = file.inputStream().use { input ->
|
||||
@@ -129,13 +130,18 @@ object AgentEnv {
|
||||
}
|
||||
val state = load(context)
|
||||
val active = strings(state.optJSONArray("pending"))
|
||||
val overrides = strings(state.optJSONArray("pendingOverrides"))
|
||||
val queued = strings(state.optJSONArray("pendingOverrides"))
|
||||
val legacy = File(bin(context), LEGACY_FAST_PATH)
|
||||
val stranded = FAST_PATH in queued && legacy.isFile && !File(bin(context), FAST_PATH).exists() &&
|
||||
!legacy.renameTo(File(bin(context), FAST_PATH))
|
||||
if (stranded) Log.w(TAG, "could not rename the queued $LEGACY_FAST_PATH; it stays queued for the next session")
|
||||
val overrides = if (stranded) queued - FAST_PATH else queued
|
||||
bin(context).listFiles()
|
||||
?.filter { it.name !in overrides }?.forEach { it.delete() }
|
||||
?.filter { it.name !in overrides && !(stranded && it.name == LEGACY_FAST_PATH) }?.forEach { it.delete() }
|
||||
val lines = strings(state.optJSONArray("persistent")) + active
|
||||
val withPath = if (overrides.none { it != "libblfastpath.so" }) lines else lines + "PATH=$GUEST_BIN:${pathOf(lines)}"
|
||||
val withPath = if (overrides.none { it != "libddfastpath.so" }) lines else lines + "PATH=$GUEST_BIN:${pathOf(lines)}"
|
||||
state.put("active", JSONArray(active)).put("pending", JSONArray())
|
||||
state.put("activeOverrides", JSONArray(overrides)).put("pendingOverrides", JSONArray())
|
||||
state.put("activeOverrides", JSONArray(overrides)).put("pendingOverrides", JSONArray(if (stranded) listOf(FAST_PATH) else emptyList()))
|
||||
save(context, state)
|
||||
if (withPath.isNotEmpty()) Log.i(TAG, "agent environment keys for this session: ${withPath.map { it.substringBefore('=') }}")
|
||||
withPath
|
||||
@@ -158,6 +164,9 @@ object AgentEnv {
|
||||
save(context, state)
|
||||
}
|
||||
|
||||
private const val FAST_PATH = "libddfastpath.so"
|
||||
private const val LEGACY_FAST_PATH = "libblfastpath.so"
|
||||
|
||||
private fun pathOf(lines: List<String>) =
|
||||
lines.lastOrNull { it.startsWith("PATH=") }?.substringAfter('=')?.takeIf { it.isNotBlank() } ?: LinuxRuntime.GUEST_PATH
|
||||
|
||||
@@ -186,6 +195,9 @@ object AgentEnv {
|
||||
for (key in listOf("pending", "active", "persistent", "pendingOverrides", "activeOverrides")) {
|
||||
if (!state.has(key)) state.put(key, JSONArray())
|
||||
}
|
||||
for (key in listOf("pendingOverrides", "activeOverrides")) {
|
||||
state.put(key, JSONArray(strings(state.optJSONArray(key)).map { if (it == LEGACY_FAST_PATH) FAST_PATH else it }.distinct()))
|
||||
}
|
||||
return state
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ object GameEnvironment {
|
||||
)
|
||||
|
||||
fun validName(name: String) = namePattern.matches(name)
|
||||
fun currentName(name: String) = if (name.startsWith("BL_")) "DD_" + name.removePrefix("BL_") else name
|
||||
fun supported(name: String) = name !in unused && !name.startsWith("BOX64_") && !name.startsWith("BOX86_")
|
||||
fun validValue(value: String) = '\u0000' !in value && value.length <= 8192
|
||||
fun validScope(scope: String) = scope.isEmpty() || (Regex("[1-9][0-9]*").matches(scope) && scope.toLongOrNull()?.let { it in 1..4294967295L } == true)
|
||||
@@ -97,14 +98,14 @@ object GameEnvironment {
|
||||
|
||||
val syncBackends = listOf(SessionPrefs.SYNC_NTSYNC, SessionPrefs.SYNC_FSYNC, SessionPrefs.SYNC_ESYNC, SessionPrefs.SYNC_WINESERVER)
|
||||
|
||||
val syncKeys = listOf("BL_SYNC", "BL_FSYNC_FIRST", "BL_SYNC_FALLBACK", "PROTON_NO_ESYNC", "PROTON_NO_FSYNC", "PROTON_NO_NTSYNC", "WINEESYNC")
|
||||
val syncKeys = listOf("DD_SYNC", "DD_FSYNC_FIRST", "DD_SYNC_FALLBACK", "PROTON_NO_ESYNC", "PROTON_NO_FSYNC", "PROTON_NO_NTSYNC", "WINEESYNC")
|
||||
|
||||
fun syncEnvironment(backend: String): Map<String, String> {
|
||||
require(backend in syncBackends) { "unknown sync $backend" }
|
||||
return buildMap {
|
||||
put("BL_SYNC", if (backend == SessionPrefs.SYNC_NTSYNC) "1" else "0")
|
||||
put("BL_FSYNC_FIRST", if (backend == SessionPrefs.SYNC_FSYNC) "1" else "0")
|
||||
put("BL_SYNC_FALLBACK", if (backend == SessionPrefs.SYNC_WINESERVER) "0" else "1")
|
||||
put("DD_SYNC", if (backend == SessionPrefs.SYNC_NTSYNC) "1" else "0")
|
||||
put("DD_FSYNC_FIRST", if (backend == SessionPrefs.SYNC_FSYNC) "1" else "0")
|
||||
put("DD_SYNC_FALLBACK", if (backend == SessionPrefs.SYNC_WINESERVER) "0" else "1")
|
||||
if (backend == SessionPrefs.SYNC_FSYNC) put("PROTON_NO_ESYNC", "1")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ object GameEnvironmentOptions {
|
||||
Option("PROTON_NO_NTSYNC", "1", R.string.game_env_no_ntsync, Type.TOGGLE, listOf("0", "1")),
|
||||
Option("PROTON_NO_ESYNC", "1", R.string.game_env_no_esync, Type.TOGGLE, listOf("0", "1")),
|
||||
Option("PROTON_NO_FSYNC", "1", R.string.game_env_no_fsync, Type.TOGGLE, listOf("0", "1")),
|
||||
Option("BL_FSYNC_FIRST", "1", R.string.game_env_fsync_first, Type.TOGGLE, listOf("0", "1")),
|
||||
Option("DD_FSYNC_FIRST", "1", R.string.game_env_fsync_first, Type.TOGGLE, listOf("0", "1")),
|
||||
Option("DXVK_HUD", "fps", R.string.game_env_hud, Type.MULTIPLE, listOf("scale=0.5", "scale=0.7", "opacity=0.5", "opacity=0.7", "devinfo", "fps", "frametimes", "submissions", "drawcalls", "pipelines", "descriptors", "memory", "gpuload", "version", "api", "cs", "compiler", "samplers")),
|
||||
Option("DXVK_CONFIG", "dxvk.maxFrameRate = 60", R.string.game_env_dxvk_config, Type.TEXT),
|
||||
Option("VKD3D_FRAME_RATE", "60", R.string.game_env_vkd3d_limit, Type.NUMBER),
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.function.Supplier;
|
||||
|
||||
public final class LinuxVulkanDriver {
|
||||
private static final String TAG = "LinuxVulkanDriver";
|
||||
public static final String ENV = "BL_VK_DRIVER";
|
||||
public static final String ENV = "DD_VK_DRIVER";
|
||||
|
||||
public static final String HELP_TEXT =
|
||||
"The driver the Steam client, the games it launches and the desktop's programs render on, "
|
||||
|
||||
@@ -256,12 +256,12 @@ public final class SystemVulkanDriver {
|
||||
if (xclipse) environment.add("DROIDDECK_HYBRIS_DXVK=dxvk-2.6.2");
|
||||
// The Android driver has a render node, but no KMS primary node. SDL presents
|
||||
// through the wrapper's Wayland Vulkan swapchain instead of a KMS-style path.
|
||||
environment.add("BL_GAMESCOPE_BACKEND=sdl");
|
||||
environment.add("DD_GAMESCOPE_BACKEND=sdl");
|
||||
// The Android pvr kernel accepts Vulkan DMA-BUF imports but rejects PRIME GEM handles.
|
||||
environment.add("BL_POWERVR_DRM_HANDLES=1");
|
||||
environment.add("BL_POWERVR_RENDER_NODE=" + node);
|
||||
environment.add("DD_POWERVR_DRM_HANDLES=1");
|
||||
environment.add("DD_POWERVR_RENDER_NODE=" + node);
|
||||
// Inner Gamescope/Xwayland lacks the bridge's Android-buffer WSI protocols.
|
||||
environment.add("BL_STEAM_GL_PRESENT=1");
|
||||
environment.add("DD_STEAM_GL_PRESENT=1");
|
||||
// Only actual Proton game launches use the bundled DXVK and X11 WSI layer.
|
||||
environment.add("DROIDDECK_POWERVR_RUNTIME=" + directory.getPath());
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ internal class GameFrameFeed(
|
||||
private const val INFO_NS = 500_000_000L
|
||||
private const val SHIFT_NS = 1_000_000_000L
|
||||
private const val SHIFT_RECHECK_NS = 100_000_000L
|
||||
private const val CLOCK_CONTROL_PATH = "tmp/.bl-clock"
|
||||
private const val CLOCK_CONTROL_PATH = "tmp/.dd-clock"
|
||||
|
||||
fun forRoot(root: File) = GameFrameFeed(File(root, HudFrames.PATH), clockControl = File(root, CLOCK_CONTROL_PATH))
|
||||
|
||||
|
||||
@@ -21,6 +21,10 @@ object LegacyNames {
|
||||
"etc/bannerlator-network.json" to "etc/droiddeck-network.json",
|
||||
"etc/bannerlator-wifi-scan-request" to "etc/droiddeck-wifi-scan-request",
|
||||
)
|
||||
private val RETIRED_FILES = listOf("libblsession.so", "libblfastpath.so", "libblaudit.so").map { "usr/local/lib/$it" } +
|
||||
listOf("x86_64", "i386").map { "usr/local/lib/droiddeck-fex/$it/libblsession.so" }
|
||||
private const val LEGACY_MARKER = ".bl-"
|
||||
private val QUEUED_MARKERS = setOf(".bl-proton-extra", ".bl-steam-urls")
|
||||
private val MENU_REWRITES = listOf(
|
||||
Triple("usr/local/share/applications", "/usr/local/bin/bannerlator-", "/usr/local/bin/droiddeck-"),
|
||||
Triple("usr/share/applications", "Exec=env APPIMAGE_EXTRACT_AND_RUN=1 /opt/appimages/",
|
||||
@@ -38,6 +42,20 @@ object LegacyNames {
|
||||
fun migrateRootfs(root: File) {
|
||||
migrateEtc(root)
|
||||
for ((old, new) in MOVED_FILES) move(File(root, old), File(root, new))
|
||||
for (path in RETIRED_FILES) File(root, path).delete()
|
||||
File(root, "root").listFiles { f -> f.name.startsWith(LEGACY_MARKER) }?.forEach {
|
||||
val target = File(it.parentFile, ".dd-" + it.name.removePrefix(LEGACY_MARKER))
|
||||
if (it.name in QUEUED_MARKERS && it.isFile && !isLink(it) && target.isFile && !isLink(target)) {
|
||||
val queued = it.readText()
|
||||
if (queued.isNotBlank()) {
|
||||
val separator = if (target.length() > 0 && !target.readText().endsWith("\n")) "\n" else ""
|
||||
target.appendText(separator + if (queued.endsWith("\n")) queued else queued + "\n")
|
||||
}
|
||||
FileUtils.delete(it)
|
||||
} else {
|
||||
move(it, target)
|
||||
}
|
||||
}
|
||||
linkScripts(root)
|
||||
rewriteMenuEntries(root)
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.security.MessageDigest
|
||||
|
||||
object ProotFastPath {
|
||||
private const val TAG = "ProotFastPath"
|
||||
const val LIBRARY = "/usr/local/lib/libblfastpath.so"
|
||||
const val LIBRARY = "/usr/local/lib/libddfastpath.so"
|
||||
const val MAX_BINDS = 256
|
||||
|
||||
fun allows(preference: Boolean, noSeccomp: Boolean, source: String, nativeUserland: Boolean = false): Boolean =
|
||||
|
||||
@@ -315,11 +315,11 @@ object BottomDesktop {
|
||||
main.post { if (generation == guestGeneration) watchIme(imeDir) }
|
||||
val binds = LinuxRuntime.binds(context, current.sessionRoot, runtime, Environment.getExternalStorageDirectory(), current.binds)
|
||||
val guest = ArrayList(current.guest).apply {
|
||||
add("BL_WIDTH=$width")
|
||||
add("BL_HEIGHT=$height")
|
||||
add("BL_DEBUG_DIR=" + dir.path)
|
||||
add("BL_TOP_SESSION=" + SessionState.mode)
|
||||
add("BL_IME_DIR=" + imeDir.path)
|
||||
add("DD_WIDTH=$width")
|
||||
add("DD_HEIGHT=$height")
|
||||
add("DD_DEBUG_DIR=" + dir.path)
|
||||
add("DD_TOP_SESSION=" + SessionState.mode)
|
||||
add("DD_IME_DIR=" + imeDir.path)
|
||||
add(SCRIPT)
|
||||
}
|
||||
val command = if (current.nativeUserland) {
|
||||
|
||||
@@ -440,7 +440,7 @@ object EsyncPacks {
|
||||
|
||||
fun enabled(context: Context): Boolean = SessionPrefs.syncFallback(context) || try {
|
||||
GameEnvironmentStore.read(context).let { config ->
|
||||
(listOf(config.shared) + config.games.values).any { it["BL_SYNC_FALLBACK"] == "1" }
|
||||
(listOf(config.shared) + config.games.values).any { it["DD_SYNC_FALLBACK"] == "1" }
|
||||
}
|
||||
} catch (t: Throwable) {
|
||||
false
|
||||
|
||||
@@ -57,8 +57,8 @@ object FexCatalog {
|
||||
}
|
||||
|
||||
fun environment(build: Build, sources: List<String> = DownloadSource.candidates(build.url)): List<String> = listOf(
|
||||
"BL_FEX_TAG=${build.tag}",
|
||||
"BL_FEX_SHA256=${build.sha256}",
|
||||
"BL_FEX_URLS=" + sources.joinToString(" "),
|
||||
"DD_FEX_TAG=${build.tag}",
|
||||
"DD_FEX_SHA256=${build.sha256}",
|
||||
"DD_FEX_URLS=" + sources.joinToString(" "),
|
||||
)
|
||||
}
|
||||
@@ -29,7 +29,8 @@ object GameEnvironmentStore {
|
||||
require(GameEnvironment.validName(name))
|
||||
val entry = value.get(name)
|
||||
require(entry == JSONObject.NULL || entry is String && GameEnvironment.validValue(entry))
|
||||
put(name, if (entry == JSONObject.NULL) null else entry as String)
|
||||
val current = GameEnvironment.currentName(name)
|
||||
if (current == name || !value.has(current)) put(current, if (entry == JSONObject.NULL) null else entry as String)
|
||||
}
|
||||
}
|
||||
val games = json.optJSONObject("games")
|
||||
@@ -52,10 +53,9 @@ object GameEnvironmentStore {
|
||||
|
||||
@Synchronized
|
||||
fun save(context: Context, config: GameEnvironment.Config) {
|
||||
val json = encode(config)
|
||||
decode(json)
|
||||
write(File(context.filesDir, SETTINGS), json.toString())
|
||||
publish(context, config)
|
||||
val normalized = decode(encode(config))
|
||||
write(File(context.filesDir, SETTINGS), encode(normalized).toString())
|
||||
publish(context, normalized)
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
|
||||
@@ -34,8 +34,8 @@ object GraphicsReport {
|
||||
|
||||
/** The guest keys the report repeats: everything that decides which Vulkan driver loads. */
|
||||
private val ENV_PREFIXES = listOf(
|
||||
"VK_", "BL_VK", "BL_DRM", "BL_VKBRIDGE", "VKBRIDGE", "MESA_", "GALLIUM_", "ZINK", "TU_", "PANVK",
|
||||
"DROIDDECK_POWERVR", "DROIDDECK_HYBRIS", "BL_GAME_LOGS", "LIBGL_", "GAMESCOPE_DISABLE", "XWAYLAND",
|
||||
"VK_", "DD_VK", "DD_DRM", "DD_VKBRIDGE", "VKBRIDGE", "MESA_", "GALLIUM_", "ZINK", "TU_", "PANVK",
|
||||
"DROIDDECK_POWERVR", "DROIDDECK_HYBRIS", "DD_GAME_LOGS", "LIBGL_", "GAMESCOPE_DISABLE", "XWAYLAND",
|
||||
)
|
||||
|
||||
/** Per-game graphics logs and the guest's Vulkan summary: on for a non-Adreno GPU, or by Setup's switch. */
|
||||
|
||||
@@ -37,7 +37,7 @@ object ProtonExtras {
|
||||
)
|
||||
|
||||
private fun home(context: Context) = File(LinuxRuntime.rootDir(context), "root")
|
||||
private fun requests(context: Context) = File(home(context), ".bl-proton-extra")
|
||||
private fun requests(context: Context) = File(home(context), ".dd-proton-extra")
|
||||
private fun toolsDir(context: Context) = File(home(context), ".local/share/Steam/compatibilitytools.d")
|
||||
private fun releasesFile(context: Context) = File(context.filesDir, "proton-extras.json")
|
||||
private fun latestFile(context: Context) = File(context.filesDir, "proton-latest.json")
|
||||
|
||||
@@ -68,7 +68,7 @@ object QuestExperimental {
|
||||
appendLine("driverMode=${SessionPrefs.gpuDriverMode(context)}")
|
||||
appendLine("androidDriver=${SessionPrefs.androidDriver(context)}")
|
||||
appendLine("steamSurfaceControlWorkaround=${SessionPrefs.hdr(context, "steam")}")
|
||||
appendLine("GPUOBJ fallback installed in Android driver and ARM64 libblsession")
|
||||
appendLine("GPUOBJ fallback installed in Android driver and ARM64 libddsession")
|
||||
appendLine("Experimental Quest 2/3/3S compatibility; 2D panel application")
|
||||
}
|
||||
Log.i(TAG, report)
|
||||
|
||||
@@ -109,11 +109,11 @@ object SessionFiles {
|
||||
"usr/local/bin/droiddeck-steam-compat" to "usr/local/bin/droiddeck-steam-compat",
|
||||
"usr/local/bin/droiddeck-steam-taskset" to "usr/local/libexec/droiddeck-steam/taskset",
|
||||
"usr/local/bin/droiddeck-fex" to "usr/local/bin/droiddeck-fex",
|
||||
"libblsession.so" to "usr/local/lib/libblsession.so",
|
||||
"libddsession.so" to "usr/local/lib/libddsession.so",
|
||||
"libfakeinput.so" to "usr/local/lib/libfakeinput.so",
|
||||
"libblfastpath.so" to "usr/local/lib/libblfastpath.so",
|
||||
"libddfastpath.so" to "usr/local/lib/libddfastpath.so",
|
||||
"libddnatv-hook.so" to "usr/lib/libddnatv-hook.so",
|
||||
"libblaudit.so" to "usr/local/lib/libblaudit.so",
|
||||
"libddaudit.so" to "usr/local/lib/libddaudit.so",
|
||||
"libssbs.so" to "usr/local/lib/libssbs.so",
|
||||
"usr/local/bin/droiddeck-session" to "usr/local/bin/droiddeck-session",
|
||||
"usr/local/bin/droiddeck-fonts" to "usr/local/bin/droiddeck-fonts",
|
||||
@@ -238,7 +238,7 @@ object SessionFiles {
|
||||
"usr/local/lib/droiddeck-gpuload/VK_LAYER_DROIDDECK_vram_cap.json" to "usr/share/vulkan/implicit_layer.d/droiddeck_vram_cap.json",
|
||||
)
|
||||
val fexPreloads = listOf("x86_64", "i386").flatMap { arch ->
|
||||
listOf("libblsession.so", "libfakeinput.so", "libfaultreport.so").map { "$arch/$it" to "usr/local/lib/droiddeck-fex/$arch/$it" }
|
||||
listOf("libddsession.so", "libfakeinput.so", "libfaultreport.so").map { "$arch/$it" to "usr/local/lib/droiddeck-fex/$arch/$it" }
|
||||
} + listOf("libvulkan-thunk.so", "libwebkitinput.so").map { "x86_64/$it" to "usr/local/lib/droiddeck-fex/x86_64/$it" }
|
||||
// The Mali compatibility layer (tools/venus/layer, David Cimo): an implicit Vulkan layer that
|
||||
// fills in the features DXVK requires and Mali lacks. Idle outside Wine and on GPUs that have them.
|
||||
@@ -315,7 +315,7 @@ object SessionFiles {
|
||||
for (pack in SERVICE_PACKS.keys) stageStoreService(context, root, pack, ledger)
|
||||
ledger.save()
|
||||
for (old in arrayOf("aarch64-unix", "aarch64-windows", "i386-windows")) File(root, "$DIRECTAUDIO_DIR/lib/wine/$old").deleteRecursively()
|
||||
val preload = StringBuilder("/usr/local/lib/libblsession.so\n")
|
||||
val preload = StringBuilder("/usr/local/lib/libddsession.so\n")
|
||||
if (!File(Environment.getExternalStorageDirectory(), NO_PAD_SWITCH).exists()) {
|
||||
preload.append("/usr/local/lib/libfakeinput.so\n")
|
||||
}
|
||||
|
||||
@@ -694,7 +694,7 @@ object SessionPrefs {
|
||||
}
|
||||
|
||||
private fun shaderPrecacheApplied(context: Context) =
|
||||
java.io.File(com.droiddeck.launcher.runtime.LinuxRuntime.rootDir(context), "root/.bl-shader-precache-applied")
|
||||
java.io.File(com.droiddeck.launcher.runtime.LinuxRuntime.rootDir(context), "root/.dd-shader-precache-applied")
|
||||
|
||||
fun pendingShaderPrecache(context: Context): Boolean? {
|
||||
val prefs = prefs(context)
|
||||
|
||||
@@ -612,7 +612,7 @@ class SessionService : Service() {
|
||||
stopSession(-1, gen)
|
||||
return
|
||||
}
|
||||
if (steamHere) guest.add("BL_EPIC_APP_ID=" + com.droiddeck.launcher.stores.epic.EpicClient.shortcutAppId)
|
||||
if (steamHere) guest.add("DD_EPIC_APP_ID=" + com.droiddeck.launcher.stores.epic.EpicClient.shortcutAppId)
|
||||
val fastPathAt = guest.size
|
||||
|
||||
val pulse = SessionEvents.step("audio") { startAudio(guest, sessionDir, directAudioPack) }
|
||||
@@ -624,36 +624,36 @@ class SessionService : Service() {
|
||||
val encoder = VideoEncodeBridge(File(filesDir, "venc/venc.sock"))
|
||||
encoder.attach(this)
|
||||
components.add(encoder)
|
||||
guest.add("BL_VENC_SOCKET=" + encoder.socket.absolutePath)
|
||||
guest.add("DD_VENC_SOCKET=" + encoder.socket.absolutePath)
|
||||
}
|
||||
com.droiddeck.launcher.gpu.ClockLogComponent(File(sessionDir, "clocks.log")).let {
|
||||
it.attach(this)
|
||||
components.add(it)
|
||||
}
|
||||
|
||||
guest.add("BL_WIDTH=" + size.first)
|
||||
guest.add("BL_HEIGHT=" + size.second)
|
||||
guest.add("DD_WIDTH=" + size.first)
|
||||
guest.add("DD_HEIGHT=" + size.second)
|
||||
if (noSteamGame()) runCatching {
|
||||
val scope = NoSteamLaunch.scopeOf(SessionState.program, SessionState.programArgs) { NoSteamLaunch.battleNetTitleScope(this, it) }
|
||||
NoSteamLaunch.resolution(GameEnvironmentStore.read(this), scope, size)
|
||||
}.onFailure { Log.w(TAG, "game resolution", it) }.getOrNull()?.let { (w, h) ->
|
||||
guest.add("BL_GAME_WIDTH=$w")
|
||||
guest.add("BL_GAME_HEIGHT=$h")
|
||||
guest.add("DD_GAME_WIDTH=$w")
|
||||
guest.add("DD_GAME_HEIGHT=$h")
|
||||
Log.i(TAG, "game resolution: ${w}x$h on a ${size.first}x${size.second} output")
|
||||
}
|
||||
if (SessionState.followScreen || size.first < size.second ||
|
||||
SessionPrefs.orientation(this) == android.content.pm.ActivityInfo.SCREEN_ORIENTATION_USER)
|
||||
guest.add("BL_FOLLOW_OUTPUT=1")
|
||||
guest.add("DD_FOLLOW_OUTPUT=1")
|
||||
if (SessionState.hdr) {
|
||||
guest.add("BL_HDR=1")
|
||||
guest.add("DD_HDR=1")
|
||||
guest.add("DXVK_HDR=1")
|
||||
Log.i(TAG, "hdr: gamescope --hdr-enabled, DXVK_HDR=1")
|
||||
}
|
||||
guest.add("DROIDDECK_WSI_BYPASS_CHECK_MS=100")
|
||||
guest.add("WINE_OFFSCREEN_CHECK_MS=100")
|
||||
guest.add("BL_REFRESH=" + Math.round(SessionState.refreshHz))
|
||||
guest.add("BL_LOG=" + sessionLog.path)
|
||||
guest.add("BL_DEBUG_DIR=" + sessionDir.path)
|
||||
guest.add("DD_REFRESH=" + Math.round(SessionState.refreshHz))
|
||||
guest.add("DD_LOG=" + sessionLog.path)
|
||||
guest.add("DD_DEBUG_DIR=" + sessionDir.path)
|
||||
if (EnhancedDiagnostics.isActive(this, sessionDir)) guest.add("DROIDDECK_ENHANCED_DIAGNOSTICS=1")
|
||||
|
||||
val fakeInputDir = File(sessionRoot, "dev/input").apply { mkdirs() }
|
||||
@@ -666,7 +666,7 @@ class SessionService : Service() {
|
||||
SessionEvents.step("controller-sync") { SessionState.padBridge?.syncConnectedControllers() }
|
||||
}
|
||||
val noSteamGame = noSteamGame()
|
||||
if (noSteamGame) guest.add("BL_PIN_CORES=0")
|
||||
if (noSteamGame) guest.add("DD_PIN_CORES=0")
|
||||
if ((steamHere || SessionState.program == NoSteamLaunch.EPIC) && com.droiddeck.launcher.stores.epic.EpicClient.read(this).installed) {
|
||||
runCatching { SessionEvents.step("epic-library") { com.droiddeck.launcher.stores.epic.EpicClientLibrary.sync(this) } }
|
||||
.onFailure { Log.w(TAG, "Epic library sync failed", it) }
|
||||
@@ -676,17 +676,19 @@ class SessionService : Service() {
|
||||
if (steamHere || noSteamGame) {
|
||||
val added = SessionEvents.step("added-games-scan") { com.droiddeck.launcher.frontend.AddedGames.scan(this) }
|
||||
val listing = SessionEvents.step("added-games-listing") { com.droiddeck.launcher.frontend.AddedGames.writeListing(this, added) }
|
||||
guest.add("BL_ADDED_GAMES=" + listing.path)
|
||||
if (OfflineMode.enabled(this)) guest.add("BL_STEAM_OFFLINE=1")
|
||||
if (com.droiddeck.launcher.gpu.Lossless.owned(this)) guest.add("BL_LOSSLESS_OWNED=1")
|
||||
guest.add("DD_ADDED_GAMES=" + listing.path)
|
||||
if (OfflineMode.enabled(this)) guest.add("DD_STEAM_OFFLINE=1")
|
||||
if (com.droiddeck.launcher.gpu.Lossless.owned(this)) guest.add("DD_LOSSLESS_OWNED=1")
|
||||
if (added.isNotEmpty()) Log.i(TAG, "added games: " + added.joinToString { "${it.name} (${it.exe.name})" })
|
||||
}
|
||||
guest.add("DD_LAUNCH_DIR=" + sessionRoot.path)
|
||||
// Proton builds up to 11.12 report X11 text fields under this name.
|
||||
guest.add("BL_LAUNCH_DIR=" + sessionRoot.path)
|
||||
GameStorage.effective(this)?.let { guest.add("BL_LIBRARY_LABEL=" + it.label.replace('"', ' ')) }
|
||||
if (SessionState.mode == MODE_STEAM && SessionState.steamUi == "desktop") guest.add("BL_STEAM_UI=desktop")
|
||||
GameStorage.effective(this)?.let { guest.add("DD_LIBRARY_LABEL=" + it.label.replace('"', ' ')) }
|
||||
if (SessionState.mode == MODE_STEAM && SessionState.steamUi == "desktop") guest.add("DD_STEAM_UI=desktop")
|
||||
// Detailed graphics logs: per-game logs and the guest's Vulkan summary (a GPU that is not
|
||||
// an Adreno, or Setup's switch), and graphics-report.txt for every session.
|
||||
if (GraphicsReport.detailed(this)) guest.add("BL_GAME_LOGS=1")
|
||||
if (GraphicsReport.detailed(this)) guest.add("DD_GAME_LOGS=1")
|
||||
SessionEvents.step("graphics-report") { GraphicsReport.begin(this, sessionDir, guest) }
|
||||
val shellGuest = ArrayList(guest).apply {
|
||||
add("SHELL=/bin/bash")
|
||||
@@ -873,8 +875,8 @@ class SessionService : Service() {
|
||||
if (!pulse.setSinkSuspended(false)) Log.w(TAG, "could not resume audio sink")
|
||||
if (!pulse.setMicSuspended(false)) Log.w(TAG, "could not resume microphone source")
|
||||
},
|
||||
zramControl = File(filesDir, "${LinuxRuntime.DIR}/tmp/.bl-zram"),
|
||||
clockControl = File(filesDir, "${LinuxRuntime.DIR}/tmp/.bl-clock"),
|
||||
zramControl = File(filesDir, "${LinuxRuntime.DIR}/tmp/.dd-zram"),
|
||||
clockControl = File(filesDir, "${LinuxRuntime.DIR}/tmp/.dd-clock"),
|
||||
mapClockControl = { WaylandCompositor.nativeSetClockControl(it.path) },
|
||||
pagedOut = { processes, unacknowledged, residentKb, swapKb, swapBeforeKb, millis ->
|
||||
Log.i(TAG, "paged out $processes processes ($unacknowledged unacknowledged) in $millis ms: " +
|
||||
@@ -943,16 +945,16 @@ class SessionService : Service() {
|
||||
} else {
|
||||
guest.add("LANG=C.UTF-8")
|
||||
}
|
||||
guest.add("BL_STEAM_LANGUAGE=" + SteamLanguage.forLocale(
|
||||
guest.add("DD_STEAM_LANGUAGE=" + SteamLanguage.forLocale(
|
||||
com.droiddeck.launcher.core.AppLanguage.effective(this),
|
||||
com.droiddeck.launcher.core.AppLanguage.system(this).country,
|
||||
))
|
||||
guest.add("TZ=" + java.util.TimeZone.getDefault().id)
|
||||
if (SessionState.mode == MODE_STEAM) SessionPrefs.pendingShaderPrecache(this)?.let { guest.add("BL_SHADER_PRECACHE=" + if (it) "1" else "0") }
|
||||
if (SessionState.mode == MODE_STEAM) SessionPrefs.pendingShaderPrecache(this)?.let { guest.add("DD_SHADER_PRECACHE=" + if (it) "1" else "0") }
|
||||
guest.add("XDG_RUNTIME_DIR=" + LinuxRuntime.GUEST_RUNTIME_DIR)
|
||||
guest.add("XDG_SESSION_TYPE=wayland")
|
||||
guest.add("WAYLAND_DISPLAY=wayland-0")
|
||||
guest.add("BL_ANDROID_CLIPBOARD=" + File(filesDir, "session/android-clipboard").path)
|
||||
guest.add("DD_ANDROID_CLIPBOARD=" + File(filesDir, "session/android-clipboard").path)
|
||||
guest.add("GAMESCOPE_FORCE_GENERAL_QUEUE=1")
|
||||
guest.add("MESA_LOADER_DRIVER_OVERRIDE=zink")
|
||||
guest.add("GALLIUM_DRIVER=zink")
|
||||
@@ -981,7 +983,7 @@ class SessionService : Service() {
|
||||
guest.add("XWAYLAND_NO_GLAMOR=1")
|
||||
Log.w(TAG, "xwayland: the last session's Xwayland crashed; glamor off for this one (XWAYLAND_NO_GLAMOR=1)")
|
||||
}
|
||||
if (!com.droiddeck.launcher.core.DeviceSupport.adreno()) guest.add("BL_RAISE_NOFILE=1")
|
||||
if (!com.droiddeck.launcher.core.DeviceSupport.adreno()) guest.add("DD_RAISE_NOFILE=1")
|
||||
if (!com.droiddeck.launcher.core.DeviceSupport.adreno()) {
|
||||
val kernel = System.getProperty("os.version").orEmpty()
|
||||
val old = kernelBefore(kernel, 6, 6)
|
||||
@@ -995,11 +997,11 @@ class SessionService : Service() {
|
||||
if (SessionPrefs.steamGpuCompositing(this)) {
|
||||
Log.i(TAG, "steam: GPU web compositing (Setup's \"Steam interface: GPU drawing\")")
|
||||
} else {
|
||||
guest.add("BL_STEAM_SOFT_COMPOSITING=1")
|
||||
guest.add("DD_STEAM_SOFT_COMPOSITING=1")
|
||||
Log.i(TAG, "steam: software web compositing for the open driver pair (GPU raster kept)")
|
||||
}
|
||||
guest.add("BL_OPEN_DRIVER=1")
|
||||
LinuxRuntime.gpuStandIn(this)?.takeIf { it == LinuxRuntime.MALI_DEVICE }?.let { guest.add("BL_DRM_STANDIN=$it") }
|
||||
guest.add("DD_OPEN_DRIVER=1")
|
||||
LinuxRuntime.gpuStandIn(this)?.takeIf { it == LinuxRuntime.MALI_DEVICE }?.let { guest.add("DD_DRM_STANDIN=$it") }
|
||||
}
|
||||
val tuOverride = tuDebugOverride()
|
||||
val tuDriver = sysmemDriver(linuxDriverId)
|
||||
@@ -1013,10 +1015,10 @@ class SessionService : Service() {
|
||||
guest.add("MESA_DISK_CACHE_DATABASE=1")
|
||||
guest.addAll(GpuStatsComponent.guestEnv(LinuxRuntime.rootDir(this)))
|
||||
guest.add("GLIBC_TUNABLES=glibc.pthread.rseq=0:glibc.malloc.top_pad=16777216")
|
||||
if (SessionState.mode == MODE_STEAM) guest.add("BL_MANGOAPP=" + (if (SessionPrefs.mangoapp(this)) "1" else "0"))
|
||||
if (SessionState.mode == MODE_STEAM) guest.add("DD_MANGOAPP=" + (if (SessionPrefs.mangoapp(this)) "1" else "0"))
|
||||
SessionState.steamClientArch = if (steamHere) SessionPrefs.steamClientArch(this) else null
|
||||
SessionState.steamClientArch?.let { arch ->
|
||||
guest.add("BL_STEAM_CLIENT_ARCH=$arch")
|
||||
guest.add("DD_STEAM_CLIENT_ARCH=$arch")
|
||||
SessionPaths.current()?.let {
|
||||
SessionArtifacts.recordClient(it, arch)
|
||||
SessionArtifacts.markSteamLogs(it, File(SessionPrefs.steamRoot(this, arch), "logs"))
|
||||
@@ -1024,23 +1026,23 @@ class SessionService : Service() {
|
||||
}
|
||||
FexCatalog.cached(this)?.let { guest.addAll(FexCatalog.environment(it)) }
|
||||
if (SessionState.mode == MODE_STEAM) {
|
||||
guest.add("BL_GAMESCOPE_STRETCH_16X9=" + (if (SessionPrefs.stretch16x9(this)) "1" else "0"))
|
||||
guest.add("DD_GAMESCOPE_STRETCH_16X9=" + (if (SessionPrefs.stretch16x9(this)) "1" else "0"))
|
||||
}
|
||||
if (SessionPrefs.noXalia(this)) guest.add("PROTON_USE_XALIA=0")
|
||||
guest.add("BL_SYNC=" + (if (SessionPrefs.fastSync(this)) "1" else "0"))
|
||||
guest.add("BL_SYNC_FALLBACK=" + (if (SessionPrefs.syncFallback(this)) "1" else "0"))
|
||||
guest.add("BL_FSYNC_FIRST=" + (if (SessionPrefs.fsyncFirst(this)) "1" else "0"))
|
||||
guest.add("BL_PACE_CORES=" + (if (SessionPrefs.paceCores(this)) "1" else "0"))
|
||||
guest.add("BL_GAMESCOPE_REALTIME=" + (if (SessionPrefs.gamescopeRealtime(this)) "1" else "0"))
|
||||
if (SessionPrefs.cursorComposite(this)) guest.add("BL_CURSOR_COMPOSITE=1")
|
||||
guest.add("DD_SYNC=" + (if (SessionPrefs.fastSync(this)) "1" else "0"))
|
||||
guest.add("DD_SYNC_FALLBACK=" + (if (SessionPrefs.syncFallback(this)) "1" else "0"))
|
||||
guest.add("DD_FSYNC_FIRST=" + (if (SessionPrefs.fsyncFirst(this)) "1" else "0"))
|
||||
guest.add("DD_PACE_CORES=" + (if (SessionPrefs.paceCores(this)) "1" else "0"))
|
||||
guest.add("DD_GAMESCOPE_REALTIME=" + (if (SessionPrefs.gamescopeRealtime(this)) "1" else "0"))
|
||||
if (SessionPrefs.cursorComposite(this)) guest.add("DD_CURSOR_COMPOSITE=1")
|
||||
relativeMouseForSession().takeIf { it != 0 }?.let { guest.add("gamescope_relative_mouse=$it") }
|
||||
if (com.droiddeck.launcher.core.ZramSupport.supported()) {
|
||||
guest.add("BL_ZRAM=1")
|
||||
if (steamHere) SessionPrefs.ramCapMb(this).takeIf { it > 0 }?.let { guest.add("BL_RAM_CAP_MB=$it") }
|
||||
if (!SessionPrefs.zramClient(this)) guest.add("BL_ZRAM_CLIENT=0")
|
||||
if (!SessionPrefs.zramIdle(this)) guest.add("BL_ZRAM_IDLE=0")
|
||||
guest.add("DD_ZRAM=1")
|
||||
if (steamHere) SessionPrefs.ramCapMb(this).takeIf { it > 0 }?.let { guest.add("DD_RAM_CAP_MB=$it") }
|
||||
if (!SessionPrefs.zramClient(this)) guest.add("DD_ZRAM_CLIENT=0")
|
||||
if (!SessionPrefs.zramIdle(this)) guest.add("DD_ZRAM_IDLE=0")
|
||||
}
|
||||
SessionPrefs.vramCapMb(this).takeIf { it > 0 }?.let { guest.add("BL_VRAM_MB=$it") }
|
||||
SessionPrefs.vramCapMb(this).takeIf { it > 0 }?.let { guest.add("DD_VRAM_MB=$it") }
|
||||
guest.add("AUDIO_DIRECT_DECAY=0")
|
||||
val extra = extraEnv() + agentEnvironment
|
||||
guest.addAll(TurnipEnvironment.gameEnvironment(tuOverride, tuDriver, SessionPrefs.tuSysmem(this), extra))
|
||||
@@ -1049,10 +1051,10 @@ class SessionService : Service() {
|
||||
com.droiddeck.launcher.gpu.TpUbwcHint.forThisDevice(this)?.let { guest.add("${com.droiddeck.launcher.gpu.TpUbwcHint.ENV}=$it") }
|
||||
val clientPinned = steamHere && SessionPrefs.clientCpusOverride(this)
|
||||
if (clientPinned) {
|
||||
guest.add("BL_CLIENT_CPUS=" + CpuCores.listOrAll(SessionPrefs.clientCpus(this)))
|
||||
guest.add("DD_CLIENT_CPUS=" + CpuCores.listOrAll(SessionPrefs.clientCpus(this)))
|
||||
}
|
||||
CpuCores.gameLaunchList(SessionPrefs.gameCpus(this), clientPinned)
|
||||
.takeIf { it.isNotEmpty() }?.let { guest.add("BL_GAME_CPUS=$it") }
|
||||
.takeIf { it.isNotEmpty() }?.let { guest.add("DD_GAME_CPUS=$it") }
|
||||
}
|
||||
|
||||
private fun startVkBridge(guest: MutableList<String>, sessionDir: File) {
|
||||
@@ -1061,16 +1063,16 @@ class SessionService : Service() {
|
||||
val bridge = com.droiddeck.launcher.gpu.VkBridgeComponent(socket, File(sessionDir, "vkbridge-server.log"))
|
||||
bridge.attach(this)
|
||||
components.add(bridge)
|
||||
guest.add("BL_VKBRIDGE=1")
|
||||
if (SessionPrefs.steamGpuCompositing(this)) guest.add("BL_STEAM_GPU_COMPOSITING=1")
|
||||
guest.add("DD_VKBRIDGE=1")
|
||||
if (SessionPrefs.steamGpuCompositing(this)) guest.add("DD_STEAM_GPU_COMPOSITING=1")
|
||||
SessionPrefs.linuxDriver(this).takeIf { it.isNotEmpty() }
|
||||
?.let { runCatching { LinuxVulkanDriver.resolveIcdPath(this, it) }.getOrNull() }
|
||||
?.let { guest.add("BL_VKBRIDGE_FALLBACK_ICD=$it") }
|
||||
?.let { guest.add("DD_VKBRIDGE_FALLBACK_ICD=$it") }
|
||||
guest.add("VKBRIDGE_SOCKET=" + socket.path)
|
||||
guest.add("VKBRIDGE_CLIENT_LOG=" + File(sessionDir, "vkbridge-client.log").path)
|
||||
guest.add("VKBRIDGE_MODE=" + SessionPrefs.vkBridgeMode(this))
|
||||
LinuxRuntime.gpuStandIn(this)?.let { node ->
|
||||
guest.add("BL_DRM_STANDIN=$node")
|
||||
guest.add("DD_DRM_STANDIN=$node")
|
||||
LinuxRuntime.deviceNumbers(node)?.let { guest.add("VKBRIDGE_DRM_RENDER=$it") }
|
||||
}
|
||||
Log.i(TAG, "vkbridge: on (${com.droiddeck.launcher.core.DeviceSupport.gpuName(this)}, ${SessionPrefs.vkBridgeMode(this)} mode), socket $socket")
|
||||
@@ -1084,7 +1086,7 @@ class SessionService : Service() {
|
||||
SessionPrefs.directAudio(this)
|
||||
val wantsMic = SessionPrefs.micEnabled(this) &&
|
||||
checkSelfPermission(android.Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED
|
||||
guest.add("BL_MIC_ENABLED=" + if (wantsMic) "1" else "0")
|
||||
guest.add("DD_MIC_ENABLED=" + if (wantsMic) "1" else "0")
|
||||
guest.add("AUDIO_DIRECT_MIC=" + if (wantsMic) "1" else "0")
|
||||
val audioDir = File(filesDir, "directaudio").apply { mkdirs() }
|
||||
val relaySocket = File(audioDir, "relay.sock")
|
||||
@@ -1112,7 +1114,7 @@ class SessionService : Service() {
|
||||
components.add(relay)
|
||||
}
|
||||
if (wantsDirectAudio) {
|
||||
guest.add("BL_DIRECTAUDIO=/" + SessionFiles.DIRECTAUDIO_DIR)
|
||||
guest.add("DD_DIRECTAUDIO=/" + SessionFiles.DIRECTAUDIO_DIR)
|
||||
guest.add("AUDIO_DIRECT_RELAY=" + relaySocket.absolutePath)
|
||||
val lowLatency = com.droiddeck.launcher.audio.DirectAudioTiming.lowLatencyOutput()
|
||||
val timing = com.droiddeck.launcher.audio.DirectAudioTiming.environment(lowLatency)
|
||||
@@ -1268,9 +1270,9 @@ class SessionService : Service() {
|
||||
)
|
||||
if (device != null) {
|
||||
val envAt = guest.indexOf(LinuxRuntime.SESSION_SCRIPT).takeIf { it >= 0 } ?: guest.size
|
||||
guest.add(envAt, "BL_STORAGE_DIAGNOSTICS=1")
|
||||
guest.add(envAt + 1, "BL_STORAGE_DEVICE=$device")
|
||||
guest.add(envAt + 2, "BL_STORAGE_LOG=${File(sessionDir, "storage.log").absolutePath}")
|
||||
guest.add(envAt, "DD_STORAGE_DIAGNOSTICS=1")
|
||||
guest.add(envAt + 1, "DD_STORAGE_DEVICE=$device")
|
||||
guest.add(envAt + 2, "DD_STORAGE_LOG=${File(sessionDir, "storage.log").absolutePath}")
|
||||
} else {
|
||||
Log.w(TAG, "storage diagnostics: selected library could not be identified; metadata snapshot only")
|
||||
}
|
||||
@@ -1415,7 +1417,7 @@ class SessionService : Service() {
|
||||
val listing = File(filesDir, "session/steam-libraries-x64.json").apply { parentFile?.mkdirs() }
|
||||
listing.writeText(x64Libraries.toString())
|
||||
val envAt = guest.indexOf(LinuxRuntime.SESSION_SCRIPT).takeIf { it >= 0 } ?: guest.size
|
||||
guest.add(envAt, "BL_X64_STEAM_LIBRARIES=" + listing.path)
|
||||
guest.add(envAt, "DD_X64_STEAM_LIBRARIES=" + listing.path)
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "x86-64 steam library: the list could not be written; internal storage alone this session", e)
|
||||
}
|
||||
@@ -1425,7 +1427,7 @@ class SessionService : Service() {
|
||||
for ((path, label) in libraries) json.put(org.json.JSONObject().put("path", path).put("label", label.replace('"', ' ').replace('\\', ' ')))
|
||||
listing.writeText(json.toString())
|
||||
val envAt = guest.indexOf(LinuxRuntime.SESSION_SCRIPT).takeIf { it >= 0 } ?: guest.size
|
||||
guest.add(envAt, "BL_STEAM_LIBRARIES=" + listing.path)
|
||||
guest.add(envAt, "DD_STEAM_LIBRARIES=" + listing.path)
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "steam library: the list could not be written; the card alone this session", e)
|
||||
}
|
||||
@@ -1446,7 +1448,7 @@ class SessionService : Service() {
|
||||
}
|
||||
listing.writeText(volumes.toString())
|
||||
val envAt = guest.indexOf(LinuxRuntime.SESSION_SCRIPT).takeIf { it >= 0 } ?: guest.size
|
||||
guest.add(envAt, "BL_DESKTOP_VOLUMES=" + listing.path)
|
||||
guest.add(envAt, "DD_DESKTOP_VOLUMES=" + listing.path)
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "desktop volumes: the list could not be written", e)
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ internal class SessionSuspendController(
|
||||
}
|
||||
val targets = records.values.filter { record ->
|
||||
try {
|
||||
File(procRoot, "${record.pid}/maps").useLines { lines -> lines.any { it.endsWith("/libblsession.so") } }
|
||||
File(procRoot, "${record.pid}/maps").useLines { lines -> lines.any { it.endsWith("/libddsession.so") } }
|
||||
} catch (_: IOException) {
|
||||
false
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ internal class SteamDownloadMonitor {
|
||||
val steam = File(home, ".local/share/Steam")
|
||||
val stamped = File(steam, "package/droiddeck-installed").isFile ||
|
||||
File(steam, "package/bannerlator-installed").isFile
|
||||
return !(stamped && File(steam, "steamrtarm64/steam").isFile) || File(home, ".bl-steam-repair").exists()
|
||||
return !(stamped && File(steam, "steamrtarm64/steam").isFile) || File(home, ".dd-steam-repair").exists()
|
||||
}
|
||||
|
||||
internal fun manifests(runtimeRoot: File, mounts: Map<String, File>): List<File> {
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.io.File
|
||||
|
||||
object SteamRepair {
|
||||
private fun home(context: Context) = File(LinuxRuntime.rootDir(context), "root")
|
||||
private fun request(context: Context) = File(home(context), ".bl-steam-repair")
|
||||
private fun request(context: Context) = File(home(context), ".dd-steam-repair")
|
||||
private fun unconfirmed(context: Context) = File(home(context), ".local/share/Steam/package/droiddeck-unconfirmed")
|
||||
private fun x64Unconfirmed(context: Context) = File(home(context), ".droiddeck-x64/.local/share/Steam/package/droiddeck-unconfirmed")
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ class VenusComponent(private val logFile: File?) : SessionPart() {
|
||||
// (Steam's GL, Xwayland's glamor) requires robustness2's nullDescriptor, which the
|
||||
// layer stands in for. The session script checks it and falls back to llvmpipe.
|
||||
"DROIDDECK_MALI_COMPAT=1",
|
||||
"BL_VENUS=1",
|
||||
"DD_VENUS=1",
|
||||
// gamescope's composite layout without immutable YCbCr samplers from the start
|
||||
// (patch 0930): a Mali-G615 refused every composite pipeline with them, and testing
|
||||
// that through Venus took the render server down.
|
||||
|
||||
@@ -70,7 +70,7 @@ class BottomDesktopCompositorService : Service() {
|
||||
FileUtils.copyAsset(this, "wayland/keymap.xkb", File(runtimeDir, "keymap.xkb"))
|
||||
data.getString(KEY_LOG)?.let { path ->
|
||||
WaylandCompositor.setSessionLogFile(File(path))
|
||||
runCatching { android.system.Os.setenv("BL_WAYLAND_LOG", path, true) }
|
||||
runCatching { android.system.Os.setenv("DD_WAYLAND_LOG", path, true) }
|
||||
.onFailure { Log.w(TAG, "could not point the compositor's log at $path", it) }
|
||||
}
|
||||
WaylandCompositor.setFirstFrameListener { reply(MSG_FIRST_FRAME) }
|
||||
|
||||
@@ -50,7 +50,7 @@ object CompositorHost {
|
||||
refreshHz: Float,
|
||||
fpsLimit: Int,
|
||||
): Boolean {
|
||||
WaylandCompositor.nativeSetClockControl(java.io.File(context.filesDir, "${com.droiddeck.launcher.runtime.LinuxRuntime.DIR}/tmp/.bl-clock").path)
|
||||
WaylandCompositor.nativeSetClockControl(java.io.File(context.filesDir, "${com.droiddeck.launcher.runtime.LinuxRuntime.DIR}/tmp/.dd-clock").path)
|
||||
ownVsyncThread = SessionPrefs.vsyncThread(context)
|
||||
WaylandCompositor.nativeSetRenderOnCommit(SessionPrefs.renderOnCommit(context))
|
||||
blackFrameInsertion = SessionPrefs.blackFrameInsertion(context)
|
||||
|
||||
@@ -84,7 +84,7 @@ public class DroidDeckLowLatencyDecoderFactory implements VideoDecoderFactory {
|
||||
|
||||
private Surface standInSurface() {
|
||||
if (standIn == null) {
|
||||
standInThread = new HandlerThread("bl-decoder-standin");
|
||||
standInThread = new HandlerThread("dd-decoder-standin");
|
||||
standInThread.start();
|
||||
standIn = ImageReader.newInstance(Math.max(width, 16), Math.max(height, 16), ImageFormat.PRIVATE, 3);
|
||||
standIn.setOnImageAvailableListener(reader -> {
|
||||
|
||||
@@ -209,7 +209,7 @@ class AgentSecurityTest {
|
||||
|
||||
@Test fun fastPathLibraryIsValidatedAndSelectedForOneSession() {
|
||||
AgentAccess.setCommandsEnabled(context, true)
|
||||
val source = File(AgentEnv.inbox(context).apply { mkdirs() }, "libblfastpath.so")
|
||||
val source = File(AgentEnv.inbox(context).apply { mkdirs() }, "libddfastpath.so")
|
||||
source.writeText("wrong architecture")
|
||||
refused("INVALID_LIBRARY") { AgentEnv.override(context, source.name) }
|
||||
val header = ByteArray(64)
|
||||
@@ -227,11 +227,43 @@ class AgentSecurityTest {
|
||||
assertEquals(64, response.getString("sha256").length)
|
||||
assertEquals(ProotFastPath.LIBRARY, AgentEnv.fastPathLibrary(context))
|
||||
AgentEnv.beginSession(context)
|
||||
assertEquals("/opt/droiddeck-agent/bin/libblfastpath.so", AgentEnv.fastPathLibrary(context))
|
||||
assertEquals("/opt/droiddeck-agent/bin/libddfastpath.so", AgentEnv.fastPathLibrary(context))
|
||||
AgentEnv.endSession(context)
|
||||
assertEquals(ProotFastPath.LIBRARY, AgentEnv.fastPathLibrary(context))
|
||||
}
|
||||
|
||||
@Test fun aFastPathOverrideQueuedUnderTheOldNameStillApplies() {
|
||||
AgentAccess.setCommandsEnabled(context, true)
|
||||
File(AgentEnv.inbox(context).apply { mkdirs() }, "libblfastpath.so").writeText("old")
|
||||
refused("INVALID_NAME") { AgentEnv.override(context, "libblfastpath.so") }
|
||||
val bin = File(LinuxRuntime.rootDir(context), "opt/droiddeck-agent/bin").apply { mkdirs() }
|
||||
File(bin, "libblfastpath.so").writeText("queued")
|
||||
File(context.filesDir, "agent-env.json").writeText("""{"pendingOverrides":["libblfastpath.so"]}""")
|
||||
AgentEnv.beginSession(context)
|
||||
assertEquals("/opt/droiddeck-agent/bin/libddfastpath.so", AgentEnv.fastPathLibrary(context))
|
||||
assertEquals("queued", File(bin, "libddfastpath.so").readText())
|
||||
assertFalse(File(bin, "libblfastpath.so").exists())
|
||||
AgentEnv.endSession(context)
|
||||
}
|
||||
|
||||
@Test fun aQueuedOldNameOverrideThatCannotBeRenamedWaits() {
|
||||
AgentAccess.setCommandsEnabled(context, true)
|
||||
val bin = File(LinuxRuntime.rootDir(context), "opt/droiddeck-agent/bin").apply { mkdirs() }
|
||||
File(bin, "libblfastpath.so").writeText("queued")
|
||||
File(context.filesDir, "agent-env.json").writeText("""{"pendingOverrides":["libblfastpath.so"]}""")
|
||||
bin.setWritable(false)
|
||||
try {
|
||||
org.junit.Assume.assumeFalse(bin.canWrite())
|
||||
AgentEnv.beginSession(context)
|
||||
assertEquals(ProotFastPath.LIBRARY, AgentEnv.fastPathLibrary(context))
|
||||
assertTrue(File(bin, "libblfastpath.so").isFile)
|
||||
val state = JSONObject(File(context.filesDir, "agent-env.json").readText())
|
||||
assertEquals("libddfastpath.so", state.getJSONArray("pendingOverrides").getString(0))
|
||||
} finally {
|
||||
bin.setWritable(true)
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun environmentValuesAreNotLogged() {
|
||||
AgentAccess.setCommandsEnabled(context, true)
|
||||
AgentEnv.set(context, listOf("CUSTOM=synthetic-private-value"), false)
|
||||
|
||||
@@ -134,12 +134,12 @@ class GameEnvironmentTest {
|
||||
assertEquals("1", chosen.games["42"]!!["FEX_TSOENABLED"])
|
||||
}
|
||||
val ntsync = GameEnvironment.withGameSync(base, "42", "ntsync").games["42"]!!
|
||||
assertEquals(listOf("1", "0", "1"), listOf(ntsync["BL_SYNC"], ntsync["BL_FSYNC_FIRST"], ntsync["BL_SYNC_FALLBACK"]))
|
||||
assertEquals(listOf("1", "0", "1"), listOf(ntsync["DD_SYNC"], ntsync["DD_FSYNC_FIRST"], ntsync["DD_SYNC_FALLBACK"]))
|
||||
assertFalse(ntsync.containsKey("PROTON_NO_ESYNC"))
|
||||
val fsync = GameEnvironment.withGameSync(base, "42", "fsync").games["42"]!!
|
||||
assertEquals(listOf("0", "1", "1", "1"), listOf(fsync["BL_SYNC"], fsync["BL_FSYNC_FIRST"], fsync["BL_SYNC_FALLBACK"], fsync["PROTON_NO_ESYNC"]))
|
||||
assertEquals(listOf("0", "1", "1", "1"), listOf(fsync["DD_SYNC"], fsync["DD_FSYNC_FIRST"], fsync["DD_SYNC_FALLBACK"], fsync["PROTON_NO_ESYNC"]))
|
||||
val wineserver = GameEnvironment.withGameSync(base, "42", "wineserver").games["42"]!!
|
||||
assertEquals(listOf("0", "0", "0"), listOf(wineserver["BL_SYNC"], wineserver["BL_FSYNC_FIRST"], wineserver["BL_SYNC_FALLBACK"]))
|
||||
assertEquals(listOf("0", "0", "0"), listOf(wineserver["DD_SYNC"], wineserver["DD_FSYNC_FIRST"], wineserver["DD_SYNC_FALLBACK"]))
|
||||
val inherited = GameEnvironment.withGameSync(base, "42", null)
|
||||
assertNull(GameEnvironment.gameSync(inherited, "42"))
|
||||
assertEquals(mapOf("FEX_TSOENABLED" to "1"), inherited.games["42"])
|
||||
|
||||
@@ -35,7 +35,7 @@ class ModeSettingsLoadingTest {
|
||||
@Test fun desktopDoesNotConsumeSteamsAppliedShaderChoice() {
|
||||
val activity = Robolectric.buildActivity(FrontEndActivity::class.java).get()
|
||||
SessionPrefs.setShaderPrecache(activity, false)
|
||||
val applied = File(LinuxRuntime.rootDir(activity), "root/.bl-shader-precache-applied")
|
||||
val applied = File(LinuxRuntime.rootDir(activity), "root/.dd-shader-precache-applied")
|
||||
applied.parentFile!!.mkdirs()
|
||||
applied.writeText("0")
|
||||
load(activity, SessionService.MODE_DESKTOP)
|
||||
|
||||
@@ -82,7 +82,7 @@ class FrameStatsTest {
|
||||
}
|
||||
|
||||
@Test fun guestFrameTimesMoveByThePausedSessionsClockShift() {
|
||||
val control = java.io.File.createTempFile("bl-clock", null)
|
||||
val control = java.io.File.createTempFile("dd-clock", null)
|
||||
try {
|
||||
control.writeBytes(java.nio.ByteBuffer.allocate(8).order(java.nio.ByteOrder.LITTLE_ENDIAN).putLong(62_283_930_706L).array())
|
||||
val feed = GameFrameFeed(java.io.File("/nonexistent/droiddeck-hud/frames"), clockControl = control)
|
||||
|
||||
@@ -60,10 +60,10 @@ class BwrapSpawnerTest {
|
||||
val env = mutableMapOf(
|
||||
"DDNATV_ROOT" to rootfs, "DDNATV_BINDS" to "/dev:/dev", "HOME" to "/root",
|
||||
"SPA_PLUGIN_DIR" to "/usr/local/lib/droiddeck-pipewire/lib/spa-0.2",
|
||||
"LD_PRELOAD" to "/run/droiddeck-preload/libblsession.so:$rootfs/usr/local/lib/libblsession.so:$rootfs/usr/lib/libddnatv-hook.so",
|
||||
"LD_PRELOAD" to "/run/droiddeck-preload/libddsession.so:$rootfs/usr/local/lib/libddsession.so:$rootfs/usr/lib/libddnatv-hook.so",
|
||||
)
|
||||
BwrapSpawner.withoutRootfsSettings(env, rootfs)
|
||||
assertEquals(mapOf("HOME" to "/root", "LD_PRELOAD" to "/run/droiddeck-preload/libblsession.so"), env)
|
||||
assertEquals(mapOf("HOME" to "/root", "LD_PRELOAD" to "/run/droiddeck-preload/libddsession.so"), env)
|
||||
val onlySession = mutableMapOf("LD_PRELOAD" to "$rootfs/usr/lib/libddnatv-hook.so")
|
||||
BwrapSpawner.withoutRootfsSettings(onlySession, rootfs)
|
||||
assertTrue(onlySession.isEmpty())
|
||||
@@ -117,33 +117,33 @@ class BwrapSpawnerPlanTest {
|
||||
lib.parentFile!!.mkdirs()
|
||||
lib.writeText("")
|
||||
val root = File(dir, "root").apply { mkdirs() }
|
||||
for (session in listOf(emptyMap(), mapOf("BL_DESKTOP" to "1"),
|
||||
mapOf("BL_DESKTOP" to "1", "GALLIUM_DRIVER" to "zink", "MESA_LOADER_DRIVER_OVERRIDE" to "zink"))) {
|
||||
for (session in listOf(emptyMap(), mapOf("DD_DESKTOP" to "1"),
|
||||
mapOf("DD_DESKTOP" to "1", "GALLIUM_DRIVER" to "zink", "MESA_LOADER_DRIVER_OVERRIDE" to "zink"))) {
|
||||
val env = session.toMutableMap()
|
||||
val binds = BwrapSpawner.gpu(runtime.path, root, env, true)!!
|
||||
assertTrue(binds.any { it.host == lib.canonicalPath && it.guest == "/run/droiddeck-gpu/libvulkan_freedreno.so" })
|
||||
assertEquals("/run/droiddeck-gpu/freedreno_icd.json", env["VK_DRIVER_FILES"])
|
||||
assertEquals("zink", env["GALLIUM_DRIVER"])
|
||||
assertEquals(session["BL_DESKTOP"], env["BL_DESKTOP"])
|
||||
assertEquals(session["DD_DESKTOP"], env["DD_DESKTOP"])
|
||||
}
|
||||
for (choice in listOf(mapOf("VK_DRIVER_FILES" to "/custom/icd.json"),
|
||||
mapOf("VK_ICD_FILENAMES" to ""), mapOf("LIBGL_ALWAYS_SOFTWARE" to "1"))) {
|
||||
val env = (choice + ("BL_DESKTOP" to "1")).toMutableMap()
|
||||
val env = (choice + ("DD_DESKTOP" to "1")).toMutableMap()
|
||||
val original = env.toMap()
|
||||
assertEquals(null, BwrapSpawner.gpu(runtime.path, root, env, true))
|
||||
assertEquals(original, env)
|
||||
}
|
||||
val env = mutableMapOf("BL_DESKTOP" to "1", "GALLIUM_DRIVER" to "llvmpipe")
|
||||
val env = mutableMapOf("DD_DESKTOP" to "1", "GALLIUM_DRIVER" to "llvmpipe")
|
||||
assertTrue(BwrapSpawner.gpu(runtime.path, root, env, true)!!.isNotEmpty())
|
||||
assertEquals("llvmpipe", env["GALLIUM_DRIVER"])
|
||||
val gamescope = mutableMapOf("BL_DESKTOP" to "1", "LIBGL_ALWAYS_SOFTWARE" to "1", "GAMESCOPE_WAYLAND_DISPLAY" to "gamescope-0")
|
||||
val gamescope = mutableMapOf("DD_DESKTOP" to "1", "LIBGL_ALWAYS_SOFTWARE" to "1", "GAMESCOPE_WAYLAND_DISPLAY" to "gamescope-0")
|
||||
assertTrue(BwrapSpawner.gpu(runtime.path, root, gamescope, true)!!.isNotEmpty())
|
||||
val unavailable = mutableMapOf("BL_DESKTOP" to "1")
|
||||
val unavailable = mutableMapOf("DD_DESKTOP" to "1")
|
||||
assertEquals(null, BwrapSpawner.gpu(runtime.path, root, unavailable, false))
|
||||
assertEquals(mapOf("BL_DESKTOP" to "1"), unavailable)
|
||||
assertEquals(mapOf("DD_DESKTOP" to "1"), unavailable)
|
||||
assertTrue(lib.delete())
|
||||
assertEquals(null, BwrapSpawner.gpu(runtime.path, root, unavailable, true))
|
||||
assertEquals(mapOf("BL_DESKTOP" to "1"), unavailable)
|
||||
assertEquals(mapOf("DD_DESKTOP" to "1"), unavailable)
|
||||
}
|
||||
|
||||
@Test fun buildsTheTreeFlatpakAsksFor() {
|
||||
@@ -181,8 +181,8 @@ class BwrapSpawnerPlanTest {
|
||||
@Test fun fexSandboxesStartThroughTheEnvTheyBringAndSkipArmPreloads() {
|
||||
val context = RuntimeEnvironment.getApplication()
|
||||
val rootfs = LinuxRuntime.rootDir(context)
|
||||
val lib = File(rootfs, "usr/local/lib/libblsession.so").apply { parentFile?.mkdirs(); writeText("") }
|
||||
val preload = File(rootfs, "etc/ld.so.preload").apply { parentFile?.mkdirs(); writeText("/usr/local/lib/libblsession.so\n") }
|
||||
val lib = File(rootfs, "usr/local/lib/libddsession.so").apply { parentFile?.mkdirs(); writeText("") }
|
||||
val preload = File(rootfs, "etc/ld.so.preload").apply { parentFile?.mkdirs(); writeText("/usr/local/lib/libddsession.so\n") }
|
||||
try {
|
||||
val plan = BwrapSpawner.plan(context, request(op("t" to "dir", "dest" to "/tmp"))
|
||||
.put("envTool", "/run/droiddeck-fex/bin/env"), dir)
|
||||
@@ -197,12 +197,12 @@ class BwrapSpawnerPlanTest {
|
||||
@Test fun sandboxedAppsSeeTheSessionsNetworkLink() {
|
||||
val context = RuntimeEnvironment.getApplication()
|
||||
val rootfs = LinuxRuntime.rootDir(context)
|
||||
val lib = File(rootfs, "usr/local/lib/libblsession.so").apply { parentFile?.mkdirs(); writeText("") }
|
||||
val preload = File(rootfs, "etc/ld.so.preload").apply { parentFile?.mkdirs(); writeText("/usr/local/lib/libblsession.so\n") }
|
||||
val lib = File(rootfs, "usr/local/lib/libddsession.so").apply { parentFile?.mkdirs(); writeText("") }
|
||||
val preload = File(rootfs, "etc/ld.so.preload").apply { parentFile?.mkdirs(); writeText("/usr/local/lib/libddsession.so\n") }
|
||||
val link = File(rootfs, "etc/droiddeck-net").apply { writeText("if wlan0 2 1500\n") }
|
||||
try {
|
||||
val plan = BwrapSpawner.plan(context, request(op("t" to "dir", "dest" to "/tmp")), dir)
|
||||
assertEquals("/run/droiddeck-preload/libblsession.so", plan.env["LD_PRELOAD"])
|
||||
assertEquals("/run/droiddeck-preload/libddsession.so", plan.env["LD_PRELOAD"])
|
||||
assertEquals(link.path, plan.binds.single { it.guest == "/etc/droiddeck-net" }.host)
|
||||
} finally {
|
||||
listOf(lib, preload, link).forEach { it.delete() }
|
||||
|
||||
@@ -93,4 +93,41 @@ class LegacyNamesTest {
|
||||
assertEquals("Exec=env APPIMAGE_EXTRACT_AND_RUN=1 /opt/appimages/other.AppImage\n",
|
||||
File(root, "usr/share/applications/other.desktop").readText())
|
||||
}
|
||||
|
||||
@Test fun homeMarkersKeepTheirStateAndRetiredLibrariesGo() {
|
||||
write("root/.bl-lossless-asked", "1")
|
||||
write("root/.bl-compat-pending", "550\n")
|
||||
write("root/.dd-seed-beat", "new")
|
||||
write("root/.bl-seed-beat", "old")
|
||||
write("usr/local/lib/libblsession.so", "old")
|
||||
write("usr/local/lib/droiddeck-fex/x86_64/libblsession.so", "old")
|
||||
write("usr/local/lib/libddsession.so", "new")
|
||||
LegacyNames.migrateRootfs(root)
|
||||
assertEquals("1", File(root, "root/.dd-lossless-asked").readText())
|
||||
assertEquals("550\n", File(root, "root/.dd-compat-pending").readText())
|
||||
assertEquals("new", File(root, "root/.dd-seed-beat").readText())
|
||||
assertFalse(File(root, "root/.bl-lossless-asked").exists())
|
||||
assertFalse(File(root, "root/.bl-seed-beat").exists())
|
||||
assertFalse(File(root, "usr/local/lib/libblsession.so").exists())
|
||||
assertFalse(File(root, "usr/local/lib/droiddeck-fex/x86_64/libblsession.so").exists())
|
||||
assertEquals("new", File(root, "usr/local/lib/libddsession.so").readText())
|
||||
}
|
||||
|
||||
@Test fun queuedRequestsUnderBothNamesAreAllKept() {
|
||||
write("root/.bl-proton-extra", "ge")
|
||||
write("root/.dd-proton-extra", "em\n")
|
||||
LegacyNames.migrateRootfs(root)
|
||||
assertEquals("em\nge\n", File(root, "root/.dd-proton-extra").readText())
|
||||
assertFalse(File(root, "root/.bl-proton-extra").exists())
|
||||
}
|
||||
|
||||
@Test fun queuedRequestsStaySeparateWhenTheNewQueueIsUnterminated() {
|
||||
write("root/.bl-proton-extra", "ge\n")
|
||||
write("root/.dd-proton-extra", "cachyos")
|
||||
write("root/.bl-steam-urls", "steam://run/440")
|
||||
write("root/.dd-steam-urls", "steam://run/570")
|
||||
LegacyNames.migrateRootfs(root)
|
||||
assertEquals("cachyos\nge\n", File(root, "root/.dd-proton-extra").readText())
|
||||
assertEquals("steam://run/570\nsteam://run/440\n", File(root, "root/.dd-steam-urls").readText())
|
||||
}
|
||||
}
|
||||
@@ -679,11 +679,11 @@ class EsyncPacksTest {
|
||||
val root = temp.newFolder("rootfs")
|
||||
EsyncPacks.store(root).mkdirs()
|
||||
assertEquals(0, EsyncPacks.fetchWanted(context, root))
|
||||
GameEnvironmentStore.save(context, GameEnvironment.Config(games = mapOf("42" to mapOf("BL_SYNC_FALLBACK" to "1"))))
|
||||
GameEnvironmentStore.save(context, GameEnvironment.Config(games = mapOf("42" to mapOf("DD_SYNC_FALLBACK" to "1"))))
|
||||
assertTrue(EsyncPacks.enabled(context))
|
||||
GameEnvironmentStore.save(context, GameEnvironment.Config(shared = mapOf("BL_SYNC_FALLBACK" to "1")))
|
||||
GameEnvironmentStore.save(context, GameEnvironment.Config(shared = mapOf("DD_SYNC_FALLBACK" to "1")))
|
||||
assertTrue(EsyncPacks.enabled(context))
|
||||
GameEnvironmentStore.save(context, GameEnvironment.Config(games = mapOf("42" to mapOf("BL_SYNC_FALLBACK" to "0"))))
|
||||
GameEnvironmentStore.save(context, GameEnvironment.Config(games = mapOf("42" to mapOf("DD_SYNC_FALLBACK" to "0"))))
|
||||
assertFalse(EsyncPacks.enabled(context))
|
||||
SessionPrefs.setSyncFallback(context, true)
|
||||
assertTrue(EsyncPacks.enabled(context))
|
||||
|
||||
@@ -41,6 +41,6 @@ class FexCatalogTest {
|
||||
|
||||
@Test fun theSessionGetsTheBuildAndEverySource() {
|
||||
val env = FexCatalog.environment(FexCatalog.Build("fex-2610-r5", url, sha), listOf(url, "https://ghfast.top/$url"))
|
||||
assertEquals(listOf("BL_FEX_TAG=fex-2610-r5", "BL_FEX_SHA256=$sha", "BL_FEX_URLS=$url https://ghfast.top/$url"), env)
|
||||
assertEquals(listOf("DD_FEX_TAG=fex-2610-r5", "DD_FEX_SHA256=$sha", "DD_FEX_URLS=$url https://ghfast.top/$url"), env)
|
||||
}
|
||||
}
|
||||
@@ -315,4 +315,12 @@ class GameEnvironmentStoreTest {
|
||||
GameEnvironmentStore.save(context, config)
|
||||
assertEquals(config, GameEnvironmentStore.read(context))
|
||||
}
|
||||
|
||||
@Test fun savedSettingsFromBeforeTheRenameKeepTheirValues() {
|
||||
val json = JSONObject("""{"version":1,"shared":{"BL_SYNC":"1","DXVK_HUD":"fps"},
|
||||
"games":{"440":{"BL_FSYNC_FIRST":"1","BL_SYNC_FALLBACK":"0","DD_SYNC_FALLBACK":"1"}}}""")
|
||||
val config = GameEnvironmentStore.decode(json)
|
||||
assertEquals(mapOf("DD_SYNC" to "1", "DXVK_HUD" to "fps"), config.shared)
|
||||
assertEquals(mapOf("DD_FSYNC_FIRST" to "1", "DD_SYNC_FALLBACK" to "1"), config.games["440"])
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ class SessionSuspendControllerTest {
|
||||
assertEquals(listOf(Triple(1, 1_000_000L, 3_000_000L)), fixture.pagedOut)
|
||||
assertEquals(0, fixture.unacknowledged)
|
||||
assertTrue(fixture.game.threads.all { it.state == 't' })
|
||||
assertFalse(File(fixture.control.parentFile, ".bl-zram.ack.$GAME").exists())
|
||||
assertFalse(File(fixture.control.parentFile, ".dd-zram.ack.$GAME").exists())
|
||||
}
|
||||
|
||||
@Test fun unchangedSwapIsNotTakenForAFinishedPageOut() {
|
||||
@@ -478,8 +478,8 @@ class SessionSuspendControllerTest {
|
||||
var emptyGameTasks = false
|
||||
var rootGone = false
|
||||
var afterSleep: (() -> Unit)? = null
|
||||
val control = File(tmp, ".bl-zram")
|
||||
val clock = File(tmp, ".bl-clock")
|
||||
val control = File(tmp, ".dd-zram")
|
||||
val clock = File(tmp, ".dd-clock")
|
||||
var clockAtContinue: Long? = null
|
||||
var clockAtMapping: Long? = null
|
||||
val pagedOut = mutableListOf<Triple<Int, Long, Long>>()
|
||||
@@ -582,7 +582,7 @@ class SessionSuspendControllerTest {
|
||||
"TracerPid: ${group.tracer}\n" +
|
||||
if (group == game) "VmRSS:\t$gameResidentKb kB\nVmSwap:\t$gameSwapKb kB\n" else "",
|
||||
)
|
||||
if (group == game) File(dir, "maps").writeText("7f00000000-7f00001000 r-xp 00000000 fe:05 42 /usr/local/lib/libblsession.so\n")
|
||||
if (group == game) File(dir, "maps").writeText("7f00000000-7f00001000 r-xp 00000000 fe:05 42 /usr/local/lib/libddsession.so\n")
|
||||
val taskDir = File(dir, "task")
|
||||
if (group == game && missingGameTasks) { taskDir.deleteRecursively(); continue }
|
||||
taskDir.mkdirs()
|
||||
|
||||
@@ -250,7 +250,7 @@ class SteamDownloadMonitorTest {
|
||||
File(steam, "package").mkdirs()
|
||||
File(steam, "package/bannerlator-installed").writeText("1\n")
|
||||
assertFalse(SteamDownloadMonitor.clientInstallPending(root))
|
||||
File(root, "root/.bl-steam-repair").writeText("1\n")
|
||||
File(root, "root/.dd-steam-repair").writeText("1\n")
|
||||
assertTrue(SteamDownloadMonitor.clientInstallPending(root))
|
||||
} finally {
|
||||
root.deleteRecursively()
|
||||
|
||||
Reference in new issue
Block a user