Compare commits

..
248 changed files with 629 additions and 11696 deletions

No files matched your search

@@ -1,35 +0,0 @@
name: Build bionic runtime pack and DroidDeck-Bionic tool
on:
push:
paths:
- 'tools/bionic-runtime/**'
- 'tools/gamescope/patches/0117-wsi-cache-present-bypass-check.patch'
- 'tools/gamescope/patches/0119-wsi-default-images-under-limiter.patch'
- 'app/src/main/cpp/fakeinput_steam.cpp'
- 'tools/gpuload/**'
- '.github/workflows/build-bionic-runtime.yml'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- name: Host tools
run: |
set -euo pipefail
sudo apt-get update -qq
sudo apt-get install -y -qq --no-install-recommends libwayland-bin libwayland-dev libx11-dev libx11-xcb-dev \
libxcb1-dev libxcb-composite0-dev libglm-dev zstd
- name: Build
run: |
set -euo pipefail
export NDK="${ANDROID_NDK_LATEST_HOME:-${ANDROID_NDK_HOME:-$ANDROID_NDK_ROOT}}"
export BUILD_NUMBER=${{ github.run_number }}
tools/bionic-runtime/build.sh "$RUNNER_TEMP/bionic-runtime" "$PWD/out"
- uses: actions/upload-artifact@v4
with:
name: droiddeck-bionic-runtime-${{ github.sha }}
path: out/*
+3 -36
View File
@@ -754,17 +754,12 @@ jobs:
ln -sfn "$(cd "$jars" && pwd)" "$m2"
echo "cache=true" >> "$GITHUB_OUTPUT"
fi
- name: Restore Robolectric's Android jars
id: robolectric-cache
- name: Cache Robolectric's Android jars
if: steps.robolectric-jars.outputs.cache == 'true'
uses: actions/cache/restore@v4
uses: actions/cache@v4
with:
path: ../robolectric-jars
key: robolectric-android-all-v3-${{ steps.robolectric.outputs.version }}-${{ github.run_id }}
restore-keys: robolectric-android-all-v3-${{ steps.robolectric.outputs.version }}-
- name: Count the restored Robolectric jars
if: steps.robolectric-jars.outputs.cache == 'true'
run: echo "ROBOLECTRIC_JARS_BEFORE=$(find "$GITHUB_WORKSPACE/../robolectric-jars" -name '*.jar' | wc -l)" >> "$GITHUB_ENV"
key: robolectric-android-all-v2-${{ steps.robolectric.outputs.version }}
- name: Unit tests
id: unit-tests
env:
@@ -775,34 +770,6 @@ jobs:
mkdir -p app/build
./gradlew testReleaseUnitTest --console=plain --info --stacktrace -Drobolectric.logging=stderr -PndkVersion="$NDK_VERSION" 2>&1 | tee app/build/unit-tests.log
# actions/cache only saves when the job succeeds, so a run whose tests died on a Maven 429 never filled the cache.
# Save the complete jars even after a failed test step, when this run added some; a partial download is dropped first.
- name: Save Robolectric's Android jars
id: robolectric-jars-final
if: always() && steps.robolectric-jars.outputs.cache == 'true'
run: |
python3 - <<'PY'
import glob, os, zipfile
root = os.path.join(os.environ['GITHUB_WORKSPACE'], '..', 'robolectric-jars')
for f in glob.glob(os.path.join(root, '**', '*'), recursive=True):
if not os.path.isfile(f):
continue
try:
ok = f.endswith('.jar') and zipfile.ZipFile(f).testzip() is None
except Exception:
ok = False
if not ok:
os.remove(f)
PY
after=$(find "$GITHUB_WORKSPACE/../robolectric-jars" -name '*.jar' | wc -l)
[ "$after" -gt "${ROBOLECTRIC_JARS_BEFORE:-0}" ] && echo "save=true" >> "$GITHUB_OUTPUT" || true
- name: Store Robolectric's Android jars
if: always() && steps.robolectric-jars-final.outputs.save == 'true'
uses: actions/cache/save@v4
with:
path: ../robolectric-jars
key: robolectric-android-all-v3-${{ steps.robolectric.outputs.version }}-${{ github.run_id }}
- name: Upload unit test diagnostics
id: unit-test-diagnostics
if: always() && steps.unit-tests.outcome != 'skipped'
+7 -5
View File
@@ -7,10 +7,10 @@
DroidDeck brings the SteamOS experience to Android: Steam Gaming Mode, full Linux desktop, integration with GOG, Epic Games, Xbox, and other storefronts, Steam VR, and more!
<p align="center"><b>100% open source. No ads. No Subscriptions. No telemetry. No proprietary components. No source withheld.</b></p>
<p align="center"><b>100% open source. No ads. No telemetry. No proprietary components. No source withheld.</b></p>
<p align="center">
<a href="https://github.com/Droid-Deck/DroidDeck/releases/download/0.7.11/DroidDeck-0.7.11.apk"><img src="https://img.shields.io/badge/Download-DroidDeck%200.7.11%20APK-3DDC84?style=for-the-badge&logo=android&logoColor=white" alt="Download DroidDeck 0.7.11"></a>
<a href="https://github.com/Droid-Deck/DroidDeck/releases/download/0.7.1/DroidDeck-0.7.1.apk"><img src="https://img.shields.io/badge/Download-DroidDeck%200.7.1%20APK-3DDC84?style=for-the-badge&logo=android&logoColor=white" alt="Download DroidDeck 0.7.1"></a>
<a href="https://discord.gg/JRGAvawjsm"><img src="https://img.shields.io/badge/Discord-Join%20us-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Join the DroidDeck Discord"></a>
</p>
@@ -23,7 +23,7 @@ DroidDeck brings the SteamOS experience to Android: Steam Gaming Mode, full Linu
<a href="https://trendshift.io/repositories/267852"><img src="https://trendshift.io/api/badge/trendshift/repositories/267852/daily?language=Kotlin" alt="Droid-Deck%2FDroidDeck | Trendshift" width="250" height="55"></a>
</p>
<p align="center"><a href="https://www.youtube.com/watch?v=ruaTSm_7a2c"><img src="docs/media/droiddeck-showcase.gif" width="60%" alt="A table of handhelds and phones all running DroidDeck, one waking to the Steam menu, the AYN Thor's bottom screen used as a touchpad, and scrolling around Steam on a phone before swiping to the home screen. Footage from Cyber Dopamine's video, linked."></a></p>
<p align="center"><img src="docs/media/steam-to-desktop.gif" width="100%" alt="On a Retroid Pocket Duo: Play Steam from the DroidDeck launcher, open Pac-Man in Steam Big Picture and play it, exit the game, then Switch to Desktop from the Power menu"></p>
> The official website is [droid-deck.dev](https://droid-deck.dev). Only download DroidDeck from this repository's [Releases](https://github.com/Droid-Deck/DroidDeck/releases).
@@ -38,7 +38,7 @@ DroidDeck brings the SteamOS experience to Android: Steam Gaming Mode, full Linu
1. Android 9 or newer on Adreno 730 or newer, or any 8xx. Adreno 6xx, Mali, Xclipse and PowerVR are experimental. Adreno 710 is currently unsupported. No root needed.
2. About 3 GB free for the runtime, plus 1.1 GB for the desktop and emulators.
3. Install the [APK](https://github.com/Droid-Deck/DroidDeck/releases/download/0.7.11/DroidDeck-0.7.11.apk), install the Linux runtime, press **Play** and sign in to Steam.
3. Install the [APK](https://github.com/Droid-Deck/DroidDeck/releases/download/0.7.1/DroidDeck-0.7.1.apk), install the Linux runtime, press **Play** and sign in to Steam.
4. On Android 14 and newer, turn on **Disable child process restrictions** in Developer options. On Android 12 and 13, Steam's first launch shows a **Fix it for me** button that walks you through it.
Smart glasses setup is in the [support matrix](docs/smart-glasses-support.md). Release notes are in [docs/releases](docs/releases).
@@ -57,6 +57,9 @@ The APK lands in `app/build/outputs/apk/release/`. Install it with `tools/deploy
On Windows, see `tools/run_windows.ps1` and `tools/prepare_windows_runtime.py`.
## Limits
Compatibility and performance vary by device. Desktop compositing is software rendered, and Firefox sandboxing is reduced under proot.
## Credits and licence
@@ -69,7 +72,6 @@ DroidDeck is [GPL-3.0](LICENSE). Steam and Proton belong to Valve Corporation. V
- mmap ring buffer controller input by ribbit384 ([WinNative #345](https://github.com/WinNative-Emu/WinNative/pull/345)).
- [FEX](https://github.com/FEX-Emu/FEX) (MIT) runs x86 code. DroidDeck's build puts the platform name under `AT_PLATFORM` so [sharun](https://github.com/VHSgunzo/sharun) AppImages by VHSgunzo (MIT) start through its [userland-execve](https://crates.io/crates/userland-execve) loader (MIT), and its GL thunk hands X errors to the program's own error handler. FEX's code disk cache was checked in its source. The fix for host stack left behind when a program leaves a signal handler without returning follows the approach suggested in [FEX-Emu/FEX#2487](https://github.com/FEX-Emu/FEX/issues/2487). The host stack fix for system calls that end a block is a backport of Ryan Houdek's [FEX-Emu/FEX#6122](https://github.com/FEX-Emu/FEX/pull/6122).
- x86 AppImages, and arm64 ones whose runtime can't unpack on Android, are unpacked with [uruntime](https://github.com/VHSgunzo/uruntime) by VHSgunzo (MIT), shipped unmodified with its licence.
- DwarFS AppImages are unpacked without proot by `dwarfsextract` from [DwarFS](https://github.com/mhx/dwarfs) by Marcus Holland-Moritz (MIT), the release binary uruntime embeds, taken out of its self-extracting wrapper and shipped with its licence.
- x86 programs linking OpenSSL 3 use the copy in the [Steam Linux Runtime 4.0](https://gitlab.steamos.cloud/steamrt/steamrt). x86 Linux games get the `/etc/asound.conf` that [pressure-vessel](https://gitlab.steamos.cloud/steamrt/steam-runtime-tools) writes.
- `WriteProcessMemory` hooks fall back to `/proc/<pid>/mem` the way [Wine](https://gitlab.winehq.org/wine/wine)'s `server/ptrace.c` did before Wine 11.
- Windows programs on noexec storage get executable copies of their image pages, following [@yujikaido](https://github.com/yujikaido)'s finding in [droiddeck-rp4pro](https://github.com/yujikaido/droiddeck-rp4pro) that Wine's own processes need the noexec shim.
+2 -2
View File
@@ -132,8 +132,8 @@ android {
applicationId "com.droiddeck.launcher"
minSdkVersion 26
targetSdkVersion 34
versionCode 20
versionName "0.7.11"
versionCode 19
versionName "0.7.1"
buildConfigField "String", "BUILD_LABEL", "\"${escapedBuildLabel}\""
buildConfigField "String", "SOURCE_COMMIT", "\"${sourceCommit}\""
buildConfigField "int", "PR_NUMBER", "${prNumber}"
+51 -155
View File
@@ -58,59 +58,6 @@
#define EXPORT extern "C" __attribute__((visibility("default")))
struct SymbolSlot {
std::atomic<void *> fn{nullptr};
std::atomic<bool> resolved{false};
};
template <typename Fn> static Fn resolved_symbol(SymbolSlot &slot, void *handle, const char *name) {
if (!slot.resolved.load(std::memory_order_acquire)) {
slot.fn.store(dlsym(handle, name), std::memory_order_relaxed);
slot.resolved.store(true, std::memory_order_release);
}
return reinterpret_cast<Fn>(slot.fn.load(std::memory_order_relaxed));
}
enum class Next : size_t {
open,
openat,
close,
write,
ioctl,
poll,
ppoll,
select,
stat,
stat64,
fstat,
fstat64,
xstat,
xstat64,
fxstat,
fxstat64,
statx,
statfs,
fstatfs,
access,
faccessat,
opendir,
scandir,
inotify_add_watch,
count
};
static const char *const next_names[] = {"open", "openat", "close", "write", "ioctl", "poll", "ppoll", "select", "stat", "stat64", "fstat", "fstat64", "__xstat", "__xstat64", "__fxstat", "__fxstat64", "statx", "statfs", "fstatfs", "access", "faccessat", "opendir", "scandir", "inotify_add_watch"};
static_assert(sizeof(next_names) / sizeof(next_names[0]) == static_cast<size_t>(Next::count), "next_names");
static SymbolSlot next_slots[static_cast<size_t>(Next::count)];
template <typename Fn> static Fn next_symbol(Next which) {
return resolved_symbol<Fn>(next_slots[static_cast<size_t>(which)], RTLD_NEXT, next_names[static_cast<size_t>(which)]);
}
static void resolve_next_symbols() {
for (size_t i = 0; i < static_cast<size_t>(Next::count); i++) next_symbol<void *>(static_cast<Next>(i));
}
#ifdef __GLIBC__
typedef unsigned long ioctl_request_t;
#else
@@ -258,11 +205,6 @@ static void controller_fork_prepare();
static void controller_fork_parent();
static void controller_fork_child();
// bionic: libc's own start-up calls hooked functions (access) before environ is set. Settings read
// then would be empty and cached for good, so until environ exists hooks see defaults, uncached.
extern "C" char **environ;
static bool env_ready() { return environ != nullptr; }
struct FakeConfig {
const char *hook_dir;
const char *udev_data_dir;
@@ -276,10 +218,6 @@ struct FakeConfig {
// would throw a recursive-init error there, so the fields are filled without allocating, and a
// reentry on the initializing thread gets them while other threads wait for the fork handlers.
static FakeConfig &config() {
if (!env_ready()) {
static FakeConfig early = {"/data/data/com.termux/files/home/fake-input", nullptr, false, false, false};
return early;
}
static FakeConfig cfg;
static std::atomic<int> state{0};
static __thread bool initializing __attribute__((tls_model("initial-exec")));
@@ -495,7 +433,6 @@ void log(const char *message, ...) {
}
__attribute__((constructor)) static void library_init() {
resolve_next_symbols();
config();
controller_mutex();
controller_map();
@@ -650,7 +587,7 @@ get_fake_input_rdev(const char *event) {
__attribute__((visibility("hidden"))) static void load_ring_paths() {
std::lock_guard<std::recursive_mutex> guard(controller_mutex());
if (ring_paths_loaded || !env_ready())
if (ring_paths_loaded)
return;
const char *spec = getenv("FAKE_EVDEV_MEMFD_PATHS");
@@ -787,7 +724,7 @@ open_fake_input_ring(const char *event, int flags) {
return -1;
}
const auto my_open = next_symbol<int (*)(const char *, int, ...)>(Next::open);
static auto my_open = reinterpret_cast<int (*)(const char *, int, ...)>(dlsym(RTLD_NEXT, "open"));
int fd = my_open(ring_path.c_str(), O_RDWR | (flags & (O_NONBLOCK | O_CLOEXEC)));
if (fd < 0)
@@ -870,25 +807,12 @@ __attribute__((visibility("hidden"))) static bool is_steam_client() {
__attribute__((visibility("hidden"))) static bool presents_steam_virtual() {
static int known;
if (known == 0) {
if (!env_ready()) return false;
const char *enabled = getenv("FAKE_EVDEV_STEAM_VIRTUAL");
known = enabled && atoi(enabled) && !is_steam_client() ? 1 : -1;
}
return known == 1;
}
// The bionic Proton layer's winebus has no udev bus, and its SDL bus skips 28de:11ff (Proton reads Steam's virtual
// pad through udev/evdev), so with FAKE_EVDEV_STEAM_PAD_AS_X360=1 other processes see that pad as a plain Xbox 360 pad.
__attribute__((visibility("hidden"))) static bool steam_pad_as_x360() {
static int known;
if (known == 0) {
if (!env_ready()) return false;
const char *v = getenv("FAKE_EVDEV_STEAM_PAD_AS_X360");
known = v && atoi(v) && !is_steam_client() ? 1 : -1;
}
return known == 1;
}
__attribute__((visibility("hidden"))) static bool
presents_xbox_triggers(const FakeController &fake) {
return fake.uinput || !is_steam_client();
@@ -1054,7 +978,7 @@ __attribute__((visibility("hidden"))) static void unpublish_uinput(UinputWriter
}
__attribute__((visibility("hidden"))) static int claim_uinput_node(int *fd_out) {
const auto my_open = next_symbol<int (*)(const char *, int, ...)>(Next::open);
static auto my_open = reinterpret_cast<int (*)(const char *, int, ...)>(dlsym(RTLD_NEXT, "open"));
for (int node = UINPUT_EVENT_BASE; node < UINPUT_EVENT_LIMIT; node++) {
std::string path = uinput_ring_path(node);
int fd = my_open(path.c_str(), O_RDWR | O_CREAT | O_EXCL | O_CLOEXEC, 0644);
@@ -1081,7 +1005,7 @@ __attribute__((visibility("hidden"))) static int claim_uinput_node(int *fd_out)
}
__attribute__((visibility("hidden"))) static int publish_uinput(UinputWriter &w) {
const auto my_open = next_symbol<int (*)(const char *, int, ...)>(Next::open);
static auto my_open = reinterpret_cast<int (*)(const char *, int, ...)>(dlsym(RTLD_NEXT, "open"));
int fd = -1;
int node = claim_uinput_node(&fd);
if (node < 0) return -1;
@@ -1467,7 +1391,6 @@ static std::unordered_map<int, std::shared_ptr<DeckHidraw>> &deck_map() {
static bool fake_deck_enabled() {
static int enabled = -1;
if (enabled < 0 && !env_ready()) return false;
if (enabled < 0) enabled = getenv("FAKE_EVDEV_DECK") && atoi(getenv("FAKE_EVDEV_DECK")) ? 1 : 0;
return enabled == 1;
}
@@ -1475,7 +1398,6 @@ static bool fake_deck_enabled() {
__attribute__((visibility("hidden"))) static uint32_t session_pad_type() {
static int type = -1;
if (type < 0) {
if (!env_ready()) return PAD_TYPE_DECK;
const char *env = getenv("FAKE_EVDEV_PAD_TYPE");
type = env && !strcmp(env, "steamcontroller") ? PAD_TYPE_STEAM
: env && !strcmp(env, "xbox360") ? PAD_TYPE_XBOX
@@ -1494,7 +1416,7 @@ __attribute__((visibility("hidden"))) static const uint8_t *ring_blocks() {
std::lock_guard<std::mutex> guard(lock);
if ((mapped = block.load(std::memory_order_acquire))) return mapped;
tries.fetch_add(1, std::memory_order_relaxed);
const auto my_open = next_symbol<int (*)(const char *, int, ...)>(Next::open);
static auto my_open = reinterpret_cast<int (*)(const char *, int, ...)>(dlsym(RTLD_NEXT, "open"));
std::string path = get_ring_path_for_slot(0);
int fd = path.empty() ? -1 : my_open(path.c_str(), O_RDONLY | O_CLOEXEC);
if (fd < 0) return nullptr;
@@ -1548,7 +1470,6 @@ __attribute__((visibility("hidden"))) static uint64_t monotonic_us() {
static bool fake_triton_enabled() {
static int enabled = -1;
if (enabled < 0 && !env_ready()) return false;
if (enabled < 0)
enabled = fake_deck_enabled() && getenv("FAKE_EVDEV_TRITON") && atoi(getenv("FAKE_EVDEV_TRITON")) ? 1 : 0;
return enabled == 1;
@@ -1847,7 +1768,7 @@ __attribute__((visibility("hidden"))) static void *sony_report_thread(void *arg)
__attribute__((visibility("hidden"))) static int open_deck_hidraw(int flags, uint8_t sony = 0) {
const char *path = sony == 4 ? DS4_HIDRAW_PATH : sony == 5 ? DUALSENSE_HIDRAW_PATH : DECK_HIDRAW_PATH;
const auto my_open = next_symbol<int (*)(const char *, int, ...)>(Next::open);
static auto my_open = reinterpret_cast<int (*)(const char *, int, ...)>(dlsym(RTLD_NEXT, "open"));
if (!process_reads_pads()) {
Logger::log("deck: %s refused: not the Steam client\n", path);
errno = ENOENT;
@@ -2056,7 +1977,7 @@ __attribute__((visibility("hidden"))) static void *triton_pad_thread(void *arg)
}
__attribute__((visibility("hidden"))) static int open_triton_hidraw(int flags, bool emulated) {
const auto my_open = next_symbol<int (*)(const char *, int, ...)>(Next::open);
static auto my_open = reinterpret_cast<int (*)(const char *, int, ...)>(dlsym(RTLD_NEXT, "open"));
if (!process_reads_pads()) {
errno = ENOENT;
return -1;
@@ -2170,12 +2091,11 @@ static_assert(sizeof(TouchRingFile) <= TOUCH_RING_SIZE, "TouchRingFile layout");
__attribute__((visibility("hidden"))) static TouchRingFile *touch_ring() {
static TouchRingFile *ring = nullptr;
if (!env_ready()) return nullptr;
static std::once_flag once;
std::call_once(once, [] {
const char *path = getenv("FAKE_TOUCHCTL_RING");
if (!path || !*path || !fake_deck_enabled()) return;
const auto my_open = next_symbol<int (*)(const char *, int, ...)>(Next::open);
static auto my_open = reinterpret_cast<int (*)(const char *, int, ...)>(dlsym(RTLD_NEXT, "open"));
int fd = my_open(path, O_RDWR | O_CLOEXEC);
if (fd < 0) {
Logger::log("touch: %s not openable (%s)\n", path, strerror(errno));
@@ -2392,8 +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 SymbolSlot inject_slot;
const auto inject = resolved_symbol<inject_fn>(inject_slot, RTLD_DEFAULT, "dd_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;
}
@@ -2515,7 +2434,6 @@ __attribute__((constructor)) static void start_touch_controller() {
static constexpr long SYSFS_FS_MAGIC = 0x62656572;
__attribute__((visibility("hidden"))) static const char *deck_listing_dir() {
if (!env_ready()) return nullptr;
static const char *dir = getenv("FAKE_DECK_SYSFS_LISTING");
return dir && *dir ? dir : nullptr;
}
@@ -2551,7 +2469,7 @@ __attribute__((visibility("hidden"))) static void note_deck_sysfs(const char *ho
}
EXPORT int fstatfs(int fd, struct statfs *buf) {
const auto real = next_symbol<int (*)(int, struct statfs *)>(Next::fstatfs);
static auto real = reinterpret_cast<int (*)(int, struct statfs *)>(dlsym(RTLD_NEXT, "fstatfs"));
int result = real(fd, buf);
if (fake_deck_enabled() && is_deck_sysfs_fd(fd)) {
note_deck_sysfs("fstatfs", result);
@@ -2561,7 +2479,7 @@ EXPORT int fstatfs(int fd, struct statfs *buf) {
}
EXPORT int statfs(const char *path, struct statfs *buf) {
const auto real = next_symbol<int (*)(const char *, struct statfs *)>(Next::statfs);
static auto real = reinterpret_cast<int (*)(const char *, struct statfs *)>(dlsym(RTLD_NEXT, "statfs"));
int result = real(path, buf);
if (fake_deck_enabled() && is_deck_sysfs_path(path)) {
note_deck_sysfs(path, result);
@@ -2610,7 +2528,7 @@ __attribute__((visibility("hidden"))) static int deck_imu_mode_change(const uint
}
__attribute__((visibility("hidden"))) static void publish_imu_mode(const DeckHidraw &deck, int mode) {
const auto my_open = next_symbol<int (*)(const char *, int, ...)>(Next::open);
static auto my_open = reinterpret_cast<int (*)(const char *, int, ...)>(dlsym(RTLD_NEXT, "open"));
if (deck.mapping_size < FAKE_INPUT_RING_SIZE + DECK_IMU_BLOCK_SIZE) return;
std::string path = get_ring_path_for_slot(0);
int fd = path.empty() ? -1 : my_open(path.c_str(), O_WRONLY | O_CLOEXEC);
@@ -3119,7 +3037,7 @@ static int real_fstat(int fd, struct stat *buf);
__attribute__((visibility("hidden"))) static bool deck_mount_id_from_fdinfo(
int dirfd, const char *path, int flags, struct statx *buf) {
const auto real_openat = next_symbol<decltype(&::openat)>(Next::openat);
static auto real_openat = reinterpret_cast<decltype(&::openat)>(dlsym(RTLD_NEXT, "openat"));
int target;
if (!path || !*path) {
if (!(flags & AT_EMPTY_PATH)) return false;
@@ -3157,7 +3075,7 @@ __attribute__((visibility("hidden"))) static bool deck_mount_id_from_fdinfo(
}
EXPORT int statx(int dirfd, const char *path, int flags, unsigned mask, struct statx *buf) {
const auto real = next_symbol<decltype(&::statx)>(Next::statx);
static auto real = reinterpret_cast<decltype(&::statx)>(dlsym(RTLD_NEXT, "statx"));
int result = real(dirfd, path, flags, mask, buf);
int saved_errno = errno;
constexpr unsigned unique_mount_id = 0x4000;
@@ -3178,7 +3096,7 @@ EXPORT int statx(int dirfd, const char *path, int flags, unsigned mask, struct s
#endif
EXPORT DIR *opendir(const char *name) {
const auto real = next_symbol<DIR *(*)(const char *)>(Next::opendir);
static auto real = reinterpret_cast<DIR *(*)(const char *)>(dlsym(RTLD_NEXT, "opendir"));
DIR *dir = real(name);
if (!dir) {
note_sys_failure(AT_FDCWD, name);
@@ -3208,7 +3126,7 @@ EXPORT int open(const char *pathname, int flags, ...) {
va_end(va);
const auto my_open = next_symbol<int (*)(const char *, int, ...)>(Next::open);
static auto my_open = reinterpret_cast<int (*)(const char *, int, ...)>(dlsym(RTLD_NEXT, "open"));
if (fake_uinput_enabled() && is_uinput_path(pathname)) return open_uinput(flags);
if (is_deck_hidraw_path(pathname)) return open_deck_hidraw(flags);
@@ -3286,7 +3204,7 @@ EXPORT int openat(int dirfd, const char *pathname, int flags, ...) {
va_end(va);
const auto my_openat = next_symbol<int (*)(int, const char *, int, ...)>(Next::openat);
static auto my_openat = reinterpret_cast<int (*)(int, const char *, int, ...)>(dlsym(RTLD_NEXT, "openat"));
if (fake_uinput_enabled() && is_uinput_path(pathname)) return open_uinput(flags);
if (is_deck_hidraw_path(pathname)) return open_deck_hidraw(flags);
@@ -3445,10 +3363,10 @@ static int fake_stat_fd(int fd, S *buf, Real real) {
}
static int real_stat(const char *pathname, struct stat *statbuf) {
const auto fn = next_symbol<int (*)(const char *, struct stat *)>(Next::stat);
static auto fn = reinterpret_cast<int (*)(const char *, struct stat *)>(dlsym(RTLD_NEXT, "stat"));
if (fn) return fn(pathname, statbuf);
#ifdef _STAT_VER
const auto xfn = next_symbol<int (*)(int, const char *, struct stat *)>(Next::xstat);
static auto xfn = reinterpret_cast<int (*)(int, const char *, struct stat *)>(dlsym(RTLD_NEXT, "__xstat"));
if (xfn) return xfn(_STAT_VER, pathname, statbuf);
#endif
errno = ENOSYS;
@@ -3456,10 +3374,10 @@ static int real_stat(const char *pathname, struct stat *statbuf) {
}
static int real_fstat(int fd, struct stat *buf) {
const auto fn = next_symbol<int (*)(int, struct stat *)>(Next::fstat);
static auto fn = reinterpret_cast<int (*)(int, struct stat *)>(dlsym(RTLD_NEXT, "fstat"));
if (fn) return fn(fd, buf);
#ifdef _STAT_VER
const auto xfn = next_symbol<int (*)(int, int, struct stat *)>(Next::fxstat);
static auto xfn = reinterpret_cast<int (*)(int, int, struct stat *)>(dlsym(RTLD_NEXT, "__fxstat"));
if (xfn) return xfn(_STAT_VER, fd, buf);
#endif
errno = ENOSYS;
@@ -3475,7 +3393,7 @@ EXPORT int fstat(int fd, struct stat *buf) {
}
EXPORT int access(const char *pathname, int mode) {
const auto my_access = next_symbol<decltype(&::access)>(Next::access);
static auto my_access = reinterpret_cast<decltype(&::access)>(dlsym(RTLD_NEXT, "access"));
if (fake_uinput_enabled() && is_uinput_path(pathname)) return 0;
if (is_deck_hidraw_path(pathname) && process_reads_pads()) return 0;
if ((is_triton_hidraw_path(pathname) || is_triton_pad_path(pathname) || sony_pad_path(pathname)) &&
@@ -3516,7 +3434,7 @@ EXPORT int access(const char *pathname, int mode) {
}
EXPORT int faccessat(int dirfd, const char *pathname, int mode, int flags) {
const auto my_faccessat = next_symbol<decltype(&::faccessat)>(Next::faccessat);
static auto my_faccessat = reinterpret_cast<decltype(&::faccessat)>(dlsym(RTLD_NEXT, "faccessat"));
if (fake_uinput_enabled() && is_uinput_path(pathname)) return 0;
if (is_deck_hidraw_path(pathname) && process_reads_pads()) return 0;
if ((is_triton_hidraw_path(pathname) || is_triton_pad_path(pathname) || sony_pad_path(pathname)) &&
@@ -3560,7 +3478,7 @@ EXPORT int scandir(const char *dirp, struct dirent ***namelist,
int (*filter)(const struct dirent *),
int (*compar)(const struct dirent **,
const struct dirent **)) {
const auto my_scandir = next_symbol<decltype(&::scandir)>(Next::scandir);
static auto my_scandir = reinterpret_cast<decltype(&::scandir)>(dlsym(RTLD_NEXT, "scandir"));
if (dirp) {
if (!strcmp(dirp, "/dev/input")) {
@@ -3574,7 +3492,7 @@ EXPORT int scandir(const char *dirp, struct dirent ***namelist,
}
EXPORT int inotify_add_watch(int fd, const char *pathname, uint32_t mask) {
const auto my_inotify_add_watch = next_symbol<decltype(&::inotify_add_watch)>(Next::inotify_add_watch);
static auto my_inotify_add_watch = reinterpret_cast<decltype(&::inotify_add_watch)>(dlsym(RTLD_NEXT, "inotify_add_watch"));
char *fake_path = nullptr;
if (pathname) {
@@ -3713,7 +3631,7 @@ static bool wait_snapshot(std::shared_ptr<FakeController> fake,
static int forward_ioctl(int fd, ioctl_request_t op, void *argp) {
using ioctl_fn = int (*)(int, ioctl_request_t, ...);
const auto next = next_symbol<ioctl_fn>(Next::ioctl);
static const auto next = reinterpret_cast<ioctl_fn>(dlsym(RTLD_NEXT, "ioctl"));
return next ? next(fd, op, argp) : static_cast<int>(syscall(SYS_ioctl, fd, op, argp));
}
@@ -3771,10 +3689,6 @@ EXPORT int ioctl(int fd, ioctl_request_t op, ...) {
id.bustype = 0x03;
if (made) {
id = made->id;
if (steam_pad_as_x360() && id.vendor == STEAM_VIRTUAL_VENDOR_ID && id.product == STEAM_VIRTUAL_PRODUCT_ID) {
id.vendor = X360_VENDOR_ID;
id.product = X360_PRODUCT_ID;
}
} else if (presents_steam_virtual()) {
id.vendor = STEAM_VIRTUAL_VENDOR_ID;
id.product = STEAM_VIRTUAL_PRODUCT_ID;
@@ -3952,7 +3866,7 @@ EXPORT int ioctl(int fd, ioctl_request_t op, ...) {
}
EXPORT int close(int fd) {
const auto my_close = next_symbol<decltype(&::close)>(Next::close);
static auto my_close = reinterpret_cast<decltype(&::close)>(dlsym(RTLD_NEXT, "close"));
if (!watched(fd)) return my_close(fd);
close_uinput(fd);
@@ -4140,7 +4054,7 @@ EXPORT ssize_t readv(int fd, const struct iovec *iov, int iovcnt) {
}
EXPORT ssize_t write(int fd, const void *buf, size_t count) {
const auto my_write = next_symbol<decltype(&::write)>(Next::write);
static auto my_write = reinterpret_cast<decltype(&::write)>(dlsym(RTLD_NEXT, "write"));
if (!watched(fd)) return my_write(fd, buf, count);
std::unique_lock<std::recursive_mutex> guard(controller_mutex());
@@ -4215,8 +4129,8 @@ EXPORT ssize_t writev(int fd, const struct iovec *iov, int iovcnt) {
static int poll_fake(struct pollfd *fds, nfds_t nfds, int timeout,
const sigset_t *sigmask) {
const auto my_poll = next_symbol<decltype(&::poll)>(Next::poll);
const auto my_ppoll = next_symbol<decltype(&::ppoll)>(Next::ppoll);
static auto my_poll = reinterpret_cast<decltype(&::poll)>(dlsym(RTLD_NEXT, "poll"));
static auto my_ppoll = reinterpret_cast<decltype(&::ppoll)>(dlsym(RTLD_NEXT, "ppoll"));
nfds_t first = 0;
while (first < nfds && !watched(fds[first].fd)) first++;
@@ -4320,7 +4234,7 @@ EXPORT int poll(struct pollfd *fds, nfds_t nfds, int timeout) {
EXPORT int ppoll(struct pollfd *fds, nfds_t nfds,
const struct timespec *timeout, const sigset_t *sigmask) {
const auto my_ppoll = next_symbol<decltype(&::ppoll)>(Next::ppoll);
static auto my_ppoll = reinterpret_cast<decltype(&::ppoll)>(dlsym(RTLD_NEXT, "ppoll"));
if (timeout && (timeout->tv_sec < 0 || timeout->tv_nsec < 0 || timeout->tv_nsec >= 1000000000L)) {
errno = EINVAL;
return -1;
@@ -4347,7 +4261,7 @@ EXPORT int ppoll(struct pollfd *fds, nfds_t nfds,
EXPORT int select(int nfds, fd_set *readfds, fd_set *writefds,
fd_set *exceptfds, struct timeval *timeout) {
const auto my_select = next_symbol<decltype(&::select)>(Next::select);
static auto my_select = reinterpret_cast<decltype(&::select)>(dlsym(RTLD_NEXT, "select"));
fd_set original_readfds;
fd_set original_writefds;
@@ -4509,10 +4423,10 @@ EXPORT int openat64(int dirfd, const char *pathname, int flags, ...) {
}
static int real_stat64(const char *pathname, struct stat64 *statbuf) {
const auto fn = next_symbol<int (*)(const char *, struct stat64 *)>(Next::stat64);
static auto fn = reinterpret_cast<int (*)(const char *, struct stat64 *)>(dlsym(RTLD_NEXT, "stat64"));
if (fn) return fn(pathname, statbuf);
#ifdef _STAT_VER
const auto xfn = next_symbol<int (*)(int, const char *, struct stat64 *)>(Next::xstat64);
static auto xfn = reinterpret_cast<int (*)(int, const char *, struct stat64 *)>(dlsym(RTLD_NEXT, "__xstat64"));
if (xfn) return xfn(_STAT_VER, pathname, statbuf);
#endif
errno = ENOSYS;
@@ -4520,10 +4434,10 @@ static int real_stat64(const char *pathname, struct stat64 *statbuf) {
}
static int real_fstat64(int fd, struct stat64 *buf) {
const auto fn = next_symbol<int (*)(int, struct stat64 *)>(Next::fstat64);
static auto fn = reinterpret_cast<int (*)(int, struct stat64 *)>(dlsym(RTLD_NEXT, "fstat64"));
if (fn) return fn(fd, buf);
#ifdef _STAT_VER
const auto xfn = next_symbol<int (*)(int, int, struct stat64 *)>(Next::fxstat64);
static auto xfn = reinterpret_cast<int (*)(int, int, struct stat64 *)>(dlsym(RTLD_NEXT, "__fxstat64"));
if (xfn) return xfn(_STAT_VER, fd, buf);
#endif
errno = ENOSYS;
@@ -4539,27 +4453,27 @@ EXPORT int fstat64(int fd, struct stat64 *buf) {
}
EXPORT int __xstat(int version, const char *pathname, struct stat *statbuf) {
const auto real = next_symbol<int (*)(int, const char *, struct stat *)>(Next::xstat);
static auto real = reinterpret_cast<int (*)(int, const char *, struct stat *)>(dlsym(RTLD_NEXT, "__xstat"));
if (!real) return stat(pathname, statbuf);
return fake_stat_path(pathname, statbuf, [version, real](const char *path, struct stat *buf) { return real(version, path, buf); });
return fake_stat_path(pathname, statbuf, [version](const char *path, struct stat *buf) { return real(version, path, buf); });
}
EXPORT int __xstat64(int version, const char *pathname, struct stat64 *statbuf) {
const auto real = next_symbol<int (*)(int, const char *, struct stat64 *)>(Next::xstat64);
static auto real = reinterpret_cast<int (*)(int, const char *, struct stat64 *)>(dlsym(RTLD_NEXT, "__xstat64"));
if (!real) return stat64(pathname, statbuf);
return fake_stat_path(pathname, statbuf, [version, real](const char *path, struct stat64 *buf) { return real(version, path, buf); });
return fake_stat_path(pathname, statbuf, [version](const char *path, struct stat64 *buf) { return real(version, path, buf); });
}
EXPORT int __fxstat(int version, int fd, struct stat *buf) {
const auto real = next_symbol<int (*)(int, int, struct stat *)>(Next::fxstat);
static auto real = reinterpret_cast<int (*)(int, int, struct stat *)>(dlsym(RTLD_NEXT, "__fxstat"));
if (!real) return fstat(fd, buf);
return fake_stat_fd(fd, buf, [version, real](int f, struct stat *b) { return real(version, f, b); });
return fake_stat_fd(fd, buf, [version](int f, struct stat *b) { return real(version, f, b); });
}
EXPORT int __fxstat64(int version, int fd, struct stat64 *buf) {
const auto real = next_symbol<int (*)(int, int, struct stat64 *)>(Next::fxstat64);
static auto real = reinterpret_cast<int (*)(int, int, struct stat64 *)>(dlsym(RTLD_NEXT, "__fxstat64"));
if (!real) return fstat64(fd, buf);
return fake_stat_fd(fd, buf, [version, real](int f, struct stat64 *b) { return real(version, f, b); });
return fake_stat_fd(fd, buf, [version](int f, struct stat64 *b) { return real(version, f, b); });
}
#if defined(__x86_64__) || defined(__i386__)
@@ -4573,37 +4487,18 @@ static const char *const interposed_names[] = {
};
static dlsym_fn next_dlsym() {
static std::atomic<dlsym_fn> fn{nullptr};
static std::atomic<bool> resolved{false};
if (!resolved.load(std::memory_order_acquire)) {
static const dlsym_fn fn = [] {
#ifdef __x86_64__
const char *base = "GLIBC_2.2.5";
#else
const char *base = "GLIBC_2.0";
#endif
dlsym_fn found{};
for (const char *version : {base, "GLIBC_2.34"}) {
if ((found = reinterpret_cast<dlsym_fn>(dlvsym(RTLD_NEXT, "dlsym", version)))) break;
if (auto found = reinterpret_cast<dlsym_fn>(dlvsym(RTLD_NEXT, "dlsym", version))) return found;
}
fn.store(found, std::memory_order_relaxed);
resolved.store(true, std::memory_order_release);
}
return fn.load(std::memory_order_relaxed);
}
static void *libc_handle() {
static std::atomic<void *> handle{nullptr};
static std::atomic<bool> resolved{false};
if (!resolved.load(std::memory_order_acquire)) {
handle.store(dlopen(LIBC_SO, RTLD_LAZY | RTLD_NOLOAD), std::memory_order_relaxed);
resolved.store(true, std::memory_order_release);
}
return handle.load(std::memory_order_relaxed);
}
__attribute__((constructor)) static void resolve_dlsym_targets() {
next_dlsym();
libc_handle();
return dlsym_fn{};
}();
return fn;
}
static void *global_dlsym(void *, const char *name) { return next_dlsym()(RTLD_DEFAULT, name); }
@@ -4621,7 +4516,8 @@ extern "C" __attribute__((visibility("hidden"), used)) void *fakeinput_dlsym_tar
dlsym_fn next = next_dlsym();
if (!next) return reinterpret_cast<void *>(missing_dlsym);
if (handle == RTLD_DEFAULT || handle == RTLD_NEXT || name == nullptr) return reinterpret_cast<void *>(next);
if (handle != libc_handle() || !interposed(name)) return reinterpret_cast<void *>(next);
static void *const libc = dlopen(LIBC_SO, RTLD_LAZY | RTLD_NOLOAD);
if (handle != libc || !interposed(name)) return reinterpret_cast<void *>(next);
return reinterpret_cast<void *>(global_dlsym);
}
@@ -620,8 +620,7 @@ static void cursor_publish_shown(void) {
static void cursor_publish_hidden(void) {
pthread_mutex_lock(&g_cursor_lock);
// A client that hides the cursor before ever showing one (gamescope drawing its own) must still be reported.
if (!g_cursor_hidden || g_cursor_serial == 0) { g_cursor_hidden = 1; g_cursor_serial++; }
if (!g_cursor_hidden) { g_cursor_hidden = 1; g_cursor_serial++; }
pthread_mutex_unlock(&g_cursor_lock);
}
+1 -4
View File
@@ -163,7 +163,6 @@ struct layer {
ARect geo_src, geo_dst;
int geo_valid;
int alloc_tier;
unsigned import_failed_fmts;
uint64_t pool_modifier;
int first_logged;
int64_t drop_logged_ns;
@@ -488,8 +487,7 @@ static const char *tier_name(int tier) {
static int alloc_slot(struct layer *l, struct slot *s, int w, int h, uint32_t fmt) {
g_alloc_failed = 0;
const unsigned fmt_bit = fmt == AHB_RGB10A2 ? 2u : 1u;
while (l->alloc_tier <= TIER_LINEAR && !(l->import_failed_fmts & fmt_bit)) {
while (l->alloc_tier <= TIER_LINEAR) {
const int tier = l->alloc_tier;
AHardwareBuffer_Desc d = {
.width = (uint32_t)w, .height = (uint32_t)h, .layers = 1,
@@ -562,7 +560,6 @@ static int alloc_slot(struct layer *l, struct slot *s, int w, int h, uint32_t fm
nh ? nh->numFds : -1, nh ? nh->numInts : -1, hd);
AHardwareBuffer_release(ahb);
if (tier < TIER_LINEAR) { l->alloc_tier = tier + 1; continue; }
l->import_failed_fmts |= fmt_bit;
g_alloc_failed = 1;
return -1;
}
@@ -1494,7 +1494,7 @@ struct vkp_image *vkp_image_from_ahb(AHardwareBuffer *ahb) {
}
int vkp_can_import_ahb(void) {
return dev_init() == 0 && g_vendor_id != VKP_VENDOR_QUALCOMM && !g_library_name && g_ahb_import &&
return dev_init() == 0 && g_vendor_id != VKP_VENDOR_QUALCOMM && g_ahb_import &&
g_vk.GetAndroidHardwareBufferPropertiesANDROID;
}
@@ -53,8 +53,6 @@ import com.droiddeck.launcher.session.SessionLogShare
import com.droiddeck.launcher.session.SessionPaths
import com.droiddeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.session.SteamRepair
import com.droiddeck.launcher.session.LaunchCoordinator
import com.droiddeck.launcher.session.LaunchTicket
import com.droiddeck.launcher.core.CpuCores
import com.droiddeck.launcher.core.DownloadSource
import com.droiddeck.launcher.core.PhantomProcessLimit
@@ -141,7 +139,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
private var glThread by mutableStateOf(true)
private var noGlError by mutableStateOf(true)
private var returnAfterGame by mutableStateOf(true)
private var valveProtonOnDemand by mutableStateOf(true)
private var shaderPrecache by mutableStateOf<Boolean?>(null)
private var steamRepairQueued by mutableStateOf(false)
private var mangoapp by mutableStateOf(true)
@@ -169,7 +166,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
private var battleNetInstalled by mutableStateOf(false)
private var offlineAccount by mutableStateOf<String?>(null)
private var offline by mutableStateOf(false)
private var offlineAuto by mutableStateOf(true)
private var showPerformance by mutableStateOf(false)
private var clientOverride by mutableStateOf(false)
private var clientCores by mutableStateOf<Set<Int>>(emptySet())
@@ -192,7 +188,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
private var prootNoSeccomp by mutableStateOf(false)
private var prootFastPath by mutableStateOf(true)
private var nativeUserland by mutableStateOf(true)
private var cursorComposite by mutableStateOf(true)
private var cursorComposite by mutableStateOf(false)
private var guestHostname by mutableStateOf(SessionPrefs.DEFAULT_GUEST_HOSTNAME)
private var phantomWarning by mutableStateOf<String?>(null)
private var phantomProcessStatus by mutableStateOf(PhantomProcessStatus.NOT_APPLICABLE)
@@ -219,7 +215,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
private var soundtracksLoaded by mutableStateOf(false)
private var gameStoresSpeedTier by mutableStateOf("fast")
private var navRequest by mutableStateOf<String?>(null)
private val launchCoordinator = LaunchCoordinator<Intent, com.droiddeck.launcher.frontend.GameRequest>()
private val gameLaunchRequest = java.util.concurrent.atomic.AtomicLong()
private var preparingGames by mutableStateOf(emptySet<String>())
private var storesShowMature by mutableStateOf(false)
private var storesSort by mutableStateOf(SessionPrefs.STORES_SORTS.first())
@@ -901,6 +897,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
runCatching { com.droiddeck.launcher.frontend.AutoComponents.restoreMissing(this) }.onFailure { Log.w(TAG, "components: restore failed", it) }
}, "components-restore").start()
}
private var pendingGameLink: com.droiddeck.launcher.frontend.GameRequest? = null
private var gameLinkReading = false
private var gameLinkTried = false
private var gameSyncFolder by mutableStateOf<String?>(null)
@@ -954,6 +951,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
else "settings:" + (com.droiddeck.launcher.ui.SettingsSection.of(section) ?: com.droiddeck.launcher.ui.SettingsSection.OVERVIEW).key
request.data = null
gameLinkReading = false
pendingGameLink = null
syncDualPanel()
return
}
@@ -966,6 +964,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
steamGames = emptyList()
shortcutLibraryScanning = true
} else shortcutLibraryScanning = false
pendingGameLink = null
gameLinkReading = false
gameLinkTried = false
soundtrackLaunch = false
@@ -978,7 +977,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
return
}
if (GameLaunchIntent.accepts(request.action)) {
val ticket = launchCoordinator.beginLink(request)
gameLinkReading = true
com.droiddeck.launcher.ui.DualScreenPanel.hide(taskId)
val copy = Intent(request)
@@ -987,17 +985,12 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
ui.post {
if (intent === request && !isDestroyed) {
gameLinkReading = false
if (!launchCoordinator.resolve(ticket, game)) {
clearGameLinkIntent(request)
syncDualPanel()
return@post
}
pendingGameLink = game
if (game == null) {
launchCoordinator.consume(ticket)
syncDualPanel()
android.widget.Toast.makeText(this, R.string.game_link_invalid, android.widget.Toast.LENGTH_LONG).show()
} else {
handleGameLink(steamGames, scanned = false, ticket = ticket)
handleGameLink(steamGames, scanned = false)
refresh()
}
}
@@ -1006,66 +999,37 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
}
}
private fun beginUiLaunch(): LaunchTicket {
val dropped = launchCoordinator.pendingLink()
val ticket = launchCoordinator.beginLaunch()
dropped?.let { if (intent === it.owner) clearGameLinkIntent(it.owner) }
return ticket
}
private fun clearGameLinkIntent(link: Intent) {
link.data = null
link.action = Intent.ACTION_MAIN
link.removeExtra(GameLaunchIntent.EXTRA_APP_ID)
}
private fun launchGame(
game: Library.SteamGame,
returnHome: Boolean = false,
onHandled: () -> Unit = {},
onSettled: () -> Unit = {},
ticket: LaunchTicket? = null,
) {
private fun launchGame(game: Library.SteamGame, returnHome: Boolean = false, onHandled: () -> Unit = {}, onSettled: () -> Unit = {}) {
val request = gameLaunchRequest.incrementAndGet()
if (!SessionPrefs.soundtracksIngame(this)) com.droiddeck.launcher.playback.SoundtrackController.pause(this)
if (pkgStage != null) {
ticket?.let(launchCoordinator::releaseHandling)
onHandled()
android.widget.Toast.makeText(this, R.string.main_wait_install_game, android.widget.Toast.LENGTH_SHORT).show()
return
}
val request = ticket ?: beginUiLaunch()
if (!launchCoordinator.isCurrent(request)) {
onHandled()
return
}
val files = game.gameFiles
if (game.source != com.droiddeck.launcher.stores.Store.XBOX.id || files == null) {
if (startGame(game, returnHome, onHandled, request)) onSettled()
else launchCoordinator.releaseHandling(request)
if (startGame(game, returnHome, onHandled)) onSettled()
return
}
Thread({
val refused = com.droiddeck.launcher.stores.xbox.XboxManifest.needsAppModel(files)
ui.post {
when {
!launchCoordinator.isCurrent(request) || isFinishing || isDestroyed -> {
launchCoordinator.releaseHandling(request)
onHandled()
}
request != gameLaunchRequest.get() || isFinishing || isDestroyed -> onHandled()
refused -> {
onHandled()
android.widget.Toast.makeText(this, getString(R.string.game_needs_app_model, game.name), android.widget.Toast.LENGTH_LONG).show()
onSettled()
}
startGame(game, returnHome, onHandled, request) -> onSettled()
else -> launchCoordinator.releaseHandling(request)
startGame(game, returnHome, onHandled) -> onSettled()
}
}
}, "xbox-app-model").start()
}
private fun startGame(game: Library.SteamGame, returnHome: Boolean, onHandled: () -> Unit, ticket: LaunchTicket): Boolean {
if (com.droiddeck.launcher.session.NoSteamLaunch.enabled(this, game)) return launchWithoutSteam(game, returnHome, onHandled, ticket)
private fun startGame(game: Library.SteamGame, returnHome: Boolean, onHandled: () -> Unit): Boolean {
if (com.droiddeck.launcher.session.NoSteamLaunch.enabled(this, game)) return launchWithoutSteam(game, returnHome, onHandled)
onHandled()
if (SessionState.running) {
if (SessionState.mode != SessionService.MODE_STEAM || SessionState.stopRequested) {
@@ -1110,34 +1074,15 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
.apply { if (returnHome) putExtra(SessionActivity.EXTRA_LINK_TASK, task) }
}
private fun launchWithoutSteam(
game: Library.SteamGame,
returnHome: Boolean,
onHandled: () -> Unit = {},
ticket: LaunchTicket? = null,
): Boolean {
if (pkgStage != null) {
onHandled()
android.widget.Toast.makeText(this, R.string.main_wait_install_game, android.widget.Toast.LENGTH_SHORT).show()
return false
}
private fun launchWithoutSteam(game: Library.SteamGame, returnHome: Boolean, onHandled: () -> Unit = {}): Boolean {
val app = applicationContext
val request = ticket ?: beginUiLaunch()
if (!launchCoordinator.isCurrent(request)) {
onHandled()
return false
}
Thread({
val added = if (com.droiddeck.launcher.session.NoSteamLaunch.needsAddedGame(game)) runCatching { com.droiddeck.launcher.session.NoSteamLaunch.addedGame(app, game) }.getOrNull() else null
val command = com.droiddeck.launcher.session.NoSteamLaunch.command(game, added)
ui.post {
onHandled()
if (!launchCoordinator.isCurrent(request) || isFinishing || isDestroyed) {
launchCoordinator.releaseHandling(request)
return@post
}
if (isDestroyed) return@post
if (command == null) {
launchCoordinator.releaseHandling(request)
android.widget.Toast.makeText(this, R.string.game_link_failed, android.widget.Toast.LENGTH_LONG).show()
return@post
}
@@ -1289,27 +1234,22 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
ui.postDelayed(poll, SESSION_SWITCH_POLL_MS)
}
private fun handleGameLink(games: List<Library.SteamGame>, scanned: Boolean = true, ticket: LaunchTicket? = null) {
private fun handleGameLink(games: List<Library.SteamGame>, scanned: Boolean = true) {
if (!lifecycle.currentState.isAtLeast(androidx.lifecycle.Lifecycle.State.RESUMED)) return
val link = launchCoordinator.pendingLink() ?: return
if (ticket != null && link.ticket !== ticket) return
val request = link.request ?: return
if (launchCoordinator.isHandling(link.ticket)) return
if (ticket == null && !link.ownedBy(intent)) {
// A refresh may only finish the link that belongs to the intent this activity shows.
launchCoordinator.consume(link.ticket)
return
}
val request = pendingGameLink ?: return
val game = request.find(games, byTitle = scanned)
if (!scanned && game == null) return
gameLinkTried = true
ui.postDelayed({
if (!isDestroyed && lifecycle.currentState.isAtLeast(androidx.lifecycle.Lifecycle.State.RESUMED)) syncDualPanel()
}, LINK_PANEL_MS)
val linkIntent = link.owner
val link = intent
fun consume() {
if (!launchCoordinator.consume(link.ticket)) return
if (intent === linkIntent) clearGameLinkIntent(linkIntent)
if (intent !== link || pendingGameLink !== request) return
pendingGameLink = null
link.data = null
link.action = Intent.ACTION_MAIN
link.removeExtra(GameLaunchIntent.EXTRA_APP_ID)
}
if (game == null) {
consume()
@@ -1317,10 +1257,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
android.widget.Toast.makeText(this,
if (request.program != null) R.string.game_link_program_unknown else R.string.game_link_missing,
android.widget.Toast.LENGTH_LONG).show()
} else {
if (!launchCoordinator.beginHandling(link.ticket)) return
launchGame(game, returnHome = true, onSettled = ::consume, ticket = link.ticket)
}
} else launchGame(game, returnHome = true, onSettled = ::consume)
}
private fun chooseGameShortcut(game: Library.SteamGame) {
@@ -1417,7 +1354,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
gameSyncFolder = gameSyncFolder,
busy = busy, stage = stage, percent = percent,
desktopInstalled = desktopInstalled, desktopPresent = desktopPresent,
offlineAccount = offlineAccount, offline = offline, offlineAuto = offlineAuto,
offlineAccount = offlineAccount, offline = offline,
frameGenLabel = frameGenLabel, romsDir = romsDir, logsEnabled = logsEnabled,
enhancedDiagnosticsArmed = enhancedDiagnosticsArmed,
gameDebugLogsEnabled = gameDebugLogsEnabled, gameDebugLogsNeedsRestart = gameDebugLogsNeedsRestart,
@@ -1511,20 +1448,16 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
},
onStoreGame = { store, id ->
val key = "${store.id}:$id"
if (pkgStage != null) {
android.widget.Toast.makeText(this, R.string.main_wait_install_game, android.widget.Toast.LENGTH_SHORT).show()
} else if (key !in preparingGames) {
if (key !in preparingGames) {
preparingGames = preparingGames + key
val ticket = beginUiLaunch()
val app = applicationContext
Thread({
val g = runCatching { com.droiddeck.launcher.stores.StoreLaunch.installedGame(app, store, id) }.getOrNull()
runOnUiThread {
if (g != null && launchCoordinator.isCurrent(ticket) && !isFinishing && !isDestroyed) {
prepareAndLaunch(g, key, ticket)
} else {
if (g != null && !isFinishing && !isDestroyed) prepareAndLaunch(g, key)
else {
preparingGames = preparingGames - key
if (g == null && launchCoordinator.isCurrent(ticket) && !isFinishing && !isDestroyed) android.widget.Toast.makeText(this, R.string.stores_launch_not_registered, android.widget.Toast.LENGTH_LONG).show()
if (g == null && !isFinishing && !isDestroyed) android.widget.Toast.makeText(this, R.string.stores_launch_not_registered, android.widget.Toast.LENGTH_LONG).show()
}
}
}, "store-play").start()
@@ -1755,11 +1688,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
OfflineMode.setEnabled(this, !OfflineMode.enabled(this))
offline = OfflineMode.enabled(this)
},
onOfflineAuto = {
OfflineMode.setAuto(this, !OfflineMode.auto(this))
offlineAuto = OfflineMode.auto(this)
offline = OfflineMode.enabled(this)
},
onPageBack = { showPerformance = false; showComponents = false; showMapping = false },
onSoundtracksIngame = { on ->
SessionPrefs.setSoundtracksIngame(this, on)
@@ -2032,9 +1960,10 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
setIntent(intent)
supersedeUncommittedLaunch()
gameLaunchRequest.incrementAndGet()
if (intent.action == SteamIntegration.ACTION_SETUP) {
gameLinkReading = false
pendingGameLink = null
syncDualPanel()
readIntegrationIntent(intent)
return
@@ -2044,11 +1973,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
startSteamAtStartupIfEnabled()
}
/** A replacement activity intent supersedes anything this activity has not dispatched yet. */
private fun supersedeUncommittedLaunch() {
launchCoordinator.cancelAll()
}
private var soundtrackLaunch = false
// A restarted launcher starts before the old one stops, so each clears the hooks only if they are still its own.
@@ -2177,7 +2101,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
if (!triggerKeys.synthesizing && triggerKeys.nativeKey(event)) return true
val tabStep = com.droiddeck.launcher.ui.dualPageStep(event)
val tabs = com.droiddeck.launcher.ui.MainTabSteps.handler
if (tabStep == null && event.action == KeyEvent.ACTION_DOWN) com.droiddeck.launcher.ui.MainTabSteps.otherKeys++
if (tabStep != null && tabs != null) {
if (controllerHaptics) com.droiddeck.launcher.ui.ControllerHaptics.onKey(this, event)
if (event.action == KeyEvent.ACTION_DOWN && event.repeatCount == 0) tabs(tabStep)
@@ -2328,22 +2251,13 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
if (Build.VERSION.SDK_INT >= 33) state.getParcelable(key, Intent::class.java)
else @Suppress("DEPRECATION") state.getParcelable(key)
private fun prepareAndLaunch(g: Library.SteamGame, key: String, ticket: LaunchTicket? = null) {
if (pkgStage != null) {
preparingGames = preparingGames - key
android.widget.Toast.makeText(this, R.string.main_wait_install_game, android.widget.Toast.LENGTH_SHORT).show()
return
}
val request = ticket ?: beginUiLaunch()
if (!launchCoordinator.isCurrent(request)) {
preparingGames = preparingGames - key
return
}
private fun prepareAndLaunch(g: Library.SteamGame, key: String) {
val request = gameLaunchRequest.incrementAndGet()
val done = { preparingGames = preparingGames - key }
com.droiddeck.launcher.frontend.AutoComponents.beforeLaunch(this, g, onBlocked = done) {
if (!launchCoordinator.isCurrent(request) || isFinishing || isDestroyed) { done(); return@beforeLaunch }
if (request != gameLaunchRequest.get() || isFinishing || isDestroyed) { done(); return@beforeLaunch }
com.droiddeck.launcher.stores.StoreLaunch.prepare(this, g) {
if (launchCoordinator.isCurrent(request) && !isFinishing && !isDestroyed) launchGame(g, onHandled = done, ticket = request)
if (request == gameLaunchRequest.get() && !isFinishing && !isDestroyed) launchGame(g, onHandled = done)
else done()
}
}
@@ -2353,7 +2267,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
// The queued launch was saved before this; a restored activity keeps its copy, and this one must not start it too.
queuedLaunchRunner.destroy()
triggerKeys.cancel()
launchCoordinator.cancelAll()
gameLaunchRequest.incrementAndGet()
cancelCompatLaunch()
updates.unregister()
runCatching { unregisterReceiver(shortcutsInstallStatus) }
@@ -2391,7 +2305,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
homeScreenEnabled = HomeApp.isHomeScreenEnabled(this)
homeAppSelected = homeScreenEnabled && HomeApp.isDefault(this)
defaultHomeLabel = HomeApp.defaultLabel(this)
com.droiddeck.launcher.ui.NavTabs.syncHomeApps(this, homeAppSelected)
refreshAndroidApps()
integrationState = readIntegration()
}
@@ -2433,7 +2346,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
else com.droiddeck.launcher.ui.DualScreenPanel.hide(taskId)
}
private fun launchPending(): Boolean = gameLinkReading || (launchCoordinator.hasPending() && !gameLinkTried)
private fun launchPending(): Boolean = gameLinkReading || (pendingGameLink != null && !gameLinkTried)
private fun launchAndroidApp(app: HomeApp.LaunchableApp, displayId: Int?) {
val onOwnScreen = displayId == null || displayId == (display?.displayId ?: Display.DEFAULT_DISPLAY)
@@ -2792,7 +2705,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
steamClientArch = if (mode == SessionService.MODE_STEAM) steamClientArch else null,
returnAfterGame = if (mode == SessionService.MODE_STEAM) returnAfterGame else null,
shaderPrecache = if (mode == SessionService.MODE_STEAM) shaderPrecache else null,
valveProtonOnDemand = if (mode == SessionService.MODE_STEAM) valveProtonOnDemand else null,
steamRepairQueued = steamRepairQueued,
mangoapp = mangoapp,
steamController = if (mode == SessionService.MODE_STEAM) steamController else null,
@@ -2900,7 +2812,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
onMangoapp = { on -> SessionPrefs.setMangoapp(this, on); mangoapp = on },
onReturnAfterGame = { on -> SessionPrefs.setReturnAfterGame(this, on); returnAfterGame = on },
onShaderPrecache = { on -> SessionPrefs.setShaderPrecache(this, on); shaderPrecache = on },
onValveProtonOnDemand = { on -> SessionPrefs.setValveProtonOnDemand(this, on); valveProtonOnDemand = on },
onSteamController = { id -> SessionPrefs.setSteamController(this, id); steamController = id },
onStartupSession = { id ->
SessionPrefs.setStartupSession(this, id)
@@ -3173,7 +3084,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
steamRepairQueued = SteamRepair.queued(this)
mangoapp = SessionPrefs.mangoapp(this)
returnAfterGame = SessionPrefs.returnAfterGame(this)
valveProtonOnDemand = SessionPrefs.valveProtonOnDemand(this)
loadShaderPrecache(mode)
steamController = SessionPrefs.steamController(this)
startupSession = SessionPrefs.startupSession(this)
@@ -3325,7 +3235,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
battleNetInstalled = com.droiddeck.launcher.runtime.BattleNet.installed(this)
offlineAccount = OfflineMode.account(this)
offline = OfflineMode.enabled(this)
offlineAuto = OfflineMode.auto(this)
installed = LinuxRuntimeInstaller.installedVersion(this)
ready = LinuxRuntime.isInstalled(this)
vkBridge = SessionPrefs.vkBridge(this)
@@ -49,7 +49,7 @@ internal class ProtonMenu(
@VisibleForTesting internal var latestCheck: (Boolean) -> Boolean = { force -> ProtonExtras.checkLatest(activity, force) }
@VisibleForTesting internal var experimentalRefresh: () -> List<ExperimentalProtons.Release>? = { ExperimentalProtons.refresh(activity) }
@VisibleForTesting internal var installer: (ProtonExtras.Tool, (String, Int) -> Unit) -> String? =
{ tool, progress -> ProtonExtras.install(activity, tool, onProgress = progress) }
{ tool, progress -> ProtonExtras.install(activity, tool, progress) }
fun installProton(id: String, automatic: Boolean = false) {
val tool = ProtonExtras.tools.firstOrNull { it.id == id } ?: return
@@ -156,7 +156,7 @@ internal class ProtonMenu(
fun refreshProtons() {
refreshExperimental()
protonRows = ProtonExtras.offered(activity).map {
protonRows = ProtonExtras.tools.map {
val all = ProtonExtras.installedAll(activity, it)
ProtonRow(it.id, it.name, all.lastOrNull(), ProtonExtras.queued(activity, it), all, ProtonExtras.update(activity, it))
}
@@ -875,10 +875,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
cornerTap = SessionPrefs.drawerCornerTap(this)
applyOutputPacing()
if (!SessionState.running) {
SessionState.followScales = SessionPrefs.followScales(this, displayMode(),
com.droiddeck.launcher.session.SessionDisplay.panelSize(this))
SessionState.followScreen = followChoice()
SessionState.followScale = followScale()
}
applyFollowChoice()
applyFollowOrientation(resources.configuration)
goFullscreen()
volumeControlStream = android.media.AudioManager.STREAM_MUSIC
@@ -2834,7 +2833,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
private fun installProton(): String? {
uiHandler.post { loading.percent = -1; loading.say(getString(PROTON_LINES.downloading), PROTON_LINES.topic, readable = true) }
if (com.droiddeck.launcher.session.SessionPrefs.ownProtonFirst(this)) return installOwnProton()
val catalog = com.droiddeck.launcher.runtime.DesktopCatalog
val cancellation = com.droiddeck.launcher.core.Downloader.Cancellation { SessionState.stopRequested }
SessionState.installCancellation = cancellation
@@ -2847,24 +2845,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
}
}
private fun installOwnProton(): String? {
val extras = com.droiddeck.launcher.session.ProtonExtras
while ((extras.prefetching || extras.installInProgress) && !SessionState.stopRequested) {
try { Thread.sleep(250) } catch (_: InterruptedException) { Thread.currentThread().interrupt(); return "interrupted" }
}
if (SessionState.stopRequested) return "cancelled"
if (!com.droiddeck.launcher.runtime.DesktopCatalog.ownProtonMissing(this)) return null
val cancellation = com.droiddeck.launcher.core.Downloader.Cancellation { SessionState.stopRequested }
SessionState.installCancellation = cancellation
return try {
extras.install(this, extras.tools.first { it.id == extras.OWN }, cancellation) { label, percent ->
uiHandler.post { loading.percent = percent; loading.say(label, PROTON_LINES.topic, readable = true) }
}.also { if (it == null) com.droiddeck.launcher.session.Onboarding.recheck(this) }
} finally {
if (SessionState.installCancellation === cancellation) SessionState.installCancellation = null
}
}
override fun surfaceCreated(holder: SurfaceHolder) {
if (holder !== outputHolder()) return
if (installingRuntime || SessionState.stopRequested || ended) return
@@ -3015,10 +2995,16 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
private fun followPortrait(): Boolean = glassesScreen == null && SessionPrefs.portrait(this)
private fun applyFollowChoice() {
val scale = SessionState.followScales.let { if (followPortrait()) it.second else it.first }
SessionState.followScreen = scale != null
SessionState.followScale = scale ?: 1f
private fun followScale(): Float {
val mode = displayMode()
val choice = SessionPrefs.resolutionChoice(this, mode, com.droiddeck.launcher.session.SessionDisplay.panelSize(this), followPortrait())
return com.droiddeck.launcher.session.SessionDisplay.followScale(choice) ?: 1f
}
private fun followChoice(): Boolean {
val mode = displayMode()
return com.droiddeck.launcher.session.SessionDisplay.isFollow(
SessionPrefs.resolutionChoice(this, mode, com.droiddeck.launcher.session.SessionDisplay.panelSize(this), followPortrait()))
}
private fun applyFollowOrientation(config: android.content.res.Configuration) {
@@ -3032,7 +3018,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
SessionService.setActivityDisplay(this, sessionActivityDisplayId)
}
cancelTouchGestures()
applyFollowChoice()
applyFollowOrientation(newConfig)
applyNotchInset()
applyUnfoldedControls()
@@ -3414,7 +3399,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
if (status == 0) SessionState.takeRelaunch()?.let { next ->
next.putExtra(EXTRA_RETURN_HOME, intent.getBooleanExtra(EXTRA_RETURN_HOME, false))
next.putExtra(EXTRA_LINK_TASK, intent.getIntExtra(EXTRA_LINK_TASK, -1))
relaunch(next)
setIntent(next)
recreate()
return@runOnUiThread
}
showEnded(status, hint)
@@ -3422,16 +3408,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
}, "session-end-hint").start()
}
// recreate() keeps this window, and Compose content added to it afterwards never recomposes, so the
// loading screen of the next session stays up over a running session. A new instance gets its own window.
// This instance finishes first because the activity is singleTask and would otherwise take the intent itself.
private fun relaunch(next: Intent) {
closeAtOnce = true
super.finish()
startActivity(next)
overridePendingTransition(0, 0)
}
private fun showEnded(status: Int, hint: EndHint?) {
if (status == 0 && hint?.evenOnSuccess != true) {
finish()
@@ -5186,10 +5162,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
private var sessionTouchDown = false
private var screenTapsClick = true
private fun onScreenLeftMouseButtonShown(): Boolean = listOfNotNull(
private fun onScreenMouseButtonShown(): Boolean = listOfNotNull(
onScreenControls?.inputSurface, bottomInputControls?.inputSurface, unfoldedPanel?.inputSurface, unfoldedDeckSurface,
secondScreenPresentation?.controlsView, swappedInputSurface,
).any { it.isShown && inputProfile.showsLeftMouseButton(it.inputRole, it.shownElements, stockInputProfile) }
).any { it.isShown && inputProfile.showsMouseButton(it.inputRole, it.shownElements, stockInputProfile) }
override fun onTouchEvent(event: MotionEvent): Boolean = inSurfaceSpace(event) { handleTouch(event) }
@@ -5225,7 +5201,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
val snapshot = fingerTouchSnapshot(uiBlocking)
val route = com.droiddeck.launcher.input.TouchRouter.decide(snapshot)
if (event.actionMasked == MotionEvent.ACTION_DOWN) {
screenTapsClick = !onScreenLeftMouseButtonShown()
screenTapsClick = !onScreenMouseButtonShown()
if (::touchpad.isInitialized) touchpad.clicks = screenTapsClick
if (::scrollTouch.isInitialized) scrollTouch.clicks = screenTapsClick
}
@@ -6059,7 +6035,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
Log.w(TAG, "ignoring agent start while session phase is ${SessionState.phase}")
return
}
relaunch(android.content.Intent(intent).setClass(this, SessionActivity::class.java))
setIntent(intent)
recreate()
return
}
if (this.intent.getBooleanExtra(EXTRA_RETURN_HOME, false)) intent.putExtra(EXTRA_RETURN_HOME, true)
@@ -293,7 +293,6 @@ object DeviceReport {
k("Stretch 16:9 to panel", SessionPrefs.stretch16x9(context))
k("Avoid notch", SessionPrefs.avoidNotch(context))
k("Return to launcher after a game", SessionPrefs.returnAfterGame(context))
k("Valve Proton only when needed", SessionPrefs.valveProtonOnDemand(context))
k("Microphone", SessionPrefs.micEnabled(context))
k("On-screen controls", SessionPrefs.oscMode(context))
k("Touch mode", SessionPrefs.touchMode(context))
@@ -28,9 +28,7 @@ object DeviceSupport {
com.droiddeck.launcher.gpu.GpuInfo.detect().family.name.startsWith("MALI"))
}
fun bridgeUsable(): Boolean = bridgeUsable(adreno(), SystemVulkanDriver.isAvailable())
internal fun bridgeUsable(adreno: Boolean, systemDriverReady: Boolean): Boolean = !adreno && !systemDriverReady
fun bridgeUsable(): Boolean = !adreno() && !SystemVulkanDriver.isAvailable() && File("/dev/mali0").exists()
fun openDriverActive(context: Context): Boolean {
if (adreno()) return false
@@ -31,7 +31,6 @@ object AddedGames {
val exeUncertain: Boolean = false,
val launchOptions: String = "",
val single: Boolean = false,
val steamProgram: Boolean = true,
) {
fun folderName(): String = folder.name
}
@@ -239,7 +238,6 @@ object AddedGames {
for (entry in AddedExes.list(context)) {
val folder = File(entry.folder)
if (folder.path in removed || !folder.isDirectory) continue
if (StoreGameSidecar.read(folder)?.isInstalled == false) continue
scanGame(context, folder, out, single = entry, reuse = true)
}
for (folder in libraryDepotInstalls(context)) if (folder.path !in removed) scanGame(context, folder, out, reuse = true)
@@ -338,11 +336,7 @@ object AddedGames {
val owner = ownerFolder(app, exe)
if (owner != null && owner.path !in SessionPrefs.removedAddedGames(app)) {
single(app, owner.path)?.takeIf { canonical(it.exe) == path }?.let {
val keep = listOf(it.exe, exe).firstOrNull { f -> guestPath(app, f) != null }
if (keep != null) {
SessionPrefs.setAddedGameExe(app, owner.path, keep.path)
AddedExes.put(app, AddedExes.Entry(owner.path, keep.path))
}
if (guestPath(app, exe) != null) AddedExes.put(app, AddedExes.Entry(owner.path, exe.path))
return AddResult.Existing(it)
}
}
@@ -448,9 +442,9 @@ object AddedGames {
val chosen = picked.takeIf { it.isNotEmpty() }?.let { File(it) }?.takeIf { it.isFile }
?: single?.takeIf { it.picked }?.let { File(it.exe) }?.takeIf { it.isFile }
val found = chosen ?: sidecar?.exeFile(folder)?.takeIf { it.isFile } ?: candidates.firstOrNull() ?: return
val storeLauncher = sidecar?.takeIf { chosen == null || canonical(chosen) == canonical(it.exeFile(folder)) }
val epicLauncher = sidecar?.takeIf { it.store == Store.EPIC && (chosen == null || canonical(chosen) == canonical(it.exeFile(folder))) }
?.launcherFile(folder)?.takeIf { it.isFile }
val launch = storeLauncher ?: found
val launch = epicLauncher ?: if (chosen == null) sidecar?.launcherFile(folder)?.takeIf { it.isFile } ?: found else found
val foundGuest = guestPath(context, launch)
if (foundGuest == null) { Log.w(TAG, "${folder.name}: the session cannot see ${launch.path}"); return }
val autoName = sidecar?.title ?: identifiedName(folder, found) ?: folder.name
@@ -476,13 +470,7 @@ object AddedGames {
val guestDir = SessionPrefs.addedGameStartIn(context, folder.path).takeIf { sidecar == null && it.isNotEmpty() }
?: sidecarDir
?: guestPath(context, (if (adopted != null) adopted else launch).parentFile ?: folder) ?: return
if (adopted == null && SessionPrefs.addedGameAdopted(context, folder.path, "Exe") == null &&
guestPath(context, folder)?.let { steamEditedTo(it, record, guestExe) } == true) {
SessionPrefs.setAddedGameAdopted(context, folder.path, "Exe", exe.path)
}
val steamProgram = candidates.firstOrNull()?.let { canonical(it) == canonical(exe) } ?: true ||
SessionPrefs.addedGameAdopted(context, folder.path, "Exe")?.let { canonical(File(it)) == canonical(exe) } == true
val steamId = config?.takeIf { steamProgram }?.let { steamRoute(it, appId) }
val steamId = config?.let { steamRoute(it, appId) }
out.add(Game(folder, name, exe, guestExe, guestDir, appId,
steamId?.toLong() ?: ((appId shl 32) or 0x02000000L), candidates, steamId,
source = sidecar?.store?.id ?: Library.ADDED, storeId = sidecar?.id,
@@ -492,7 +480,7 @@ object AddedGames {
sidecar.store == Store.UBISOFT -> com.droiddeck.launcher.stores.ubisoft.UbisoftConnect.launchOptions(context)
else -> ""
},
single = single != null, steamProgram = steamProgram))
single = single != null))
}
}
@@ -532,11 +520,6 @@ object AddedGames {
return file.takeIf { inside && it.isFile }
}
internal fun steamEditedTo(folderGuest: String, record: JSONObject?, guestExe: String): Boolean {
val steam = unquote(record?.optJSONObject("steam")?.optString("Exe"))
return steam == guestExe && steam != unquote(record?.optJSONObject("app")?.optString("Exe")) && steam.startsWith("$folderGuest/")
}
private fun unquote(value: String?): String = value.orEmpty().trim().trim('"')
internal fun adoptSteamEdits(context: Context, folder: File, record: JSONObject) {
@@ -585,7 +568,6 @@ object AddedGames {
.append(",\"seen\":").append(SessionPrefs.addedGameExeSeen(context, g.folder.path))
if (g.launchOptions.isNotEmpty()) json.append(",\"launch\":").append(quote(g.launchOptions))
if (g.source != Library.ADDED) json.append(",\"store\":").append(quote(g.source))
if (!g.steamProgram) json.append(",\"route\":false")
val art = AddedGameArt.resolve(context, g)
val pieces = listOf("p" to art.portrait, "header" to art.header, "hero" to art.hero, "logo" to art.logo, "icon" to art.icon)
.mapNotNull { (k, f) -> f?.let { file -> artGuestPath(context, file)?.let { k to it } } }
@@ -13,7 +13,6 @@ object GamesFolderMigration {
@Synchronized
fun run(context: Context) {
repathInternalGuest(context)
val dirs = SessionPrefs.addedGamesDirs(context)
if (dirs.isEmpty()) return
val roots = legacyRoots(SessionPrefs.gameFolderBinds(context).map { it.first } + dirs)
@@ -59,30 +58,12 @@ object GamesFolderMigration {
SessionPrefs.setGamesFoldersMigrated(context)
}
private fun repathInternalGuest(context: Context) {
val binds = SessionPrefs.gameFolderBinds(context)
if (binds.none { it.second == StoreInstallRoot.INTERNAL_GUEST }) return
val hosts = binds.map { it.first }
val roots = legacyRoots(hosts).associateBy { it.host.path }
val taken = binds.map { it.second }.filter { it != StoreInstallRoot.INTERNAL_GUEST }.toMutableSet()
SessionPrefs.setGameFolderBinds(context, binds.map { (host, guest) ->
if (guest != StoreInstallRoot.INTERNAL_GUEST) return@map host to guest
val base = roots.getValue(host).guest
var next = base
var n = 2
while (next in taken) next = "$base-${n++}"
taken.add(next)
host to next
})
}
internal fun legacyRoots(paths: List<String>): List<AddedGames.Root> {
val hosts = paths.distinct().map { File(it) }
val names = hosts.groupingBy { it.name.lowercase() }.eachCount()
return hosts.map { host ->
val name = host.name.ifEmpty { "games" }
val clash = (names[name.lowercase()] ?: 0) > 1 || "${AddedGames.GUEST_DIR}/$name" == StoreInstallRoot.INTERNAL_GUEST
val guestName = if (clash) name + "-" + "%08x".format(CRC32().apply { update(host.path.toByteArray()) }.value).take(4) else name
val guestName = if ((names[name.lowercase()] ?: 0) > 1) name + "-" + "%08x".format(CRC32().apply { update(host.path.toByteArray()) }.value).take(4) else name
AddedGames.Root(host, "${AddedGames.GUEST_DIR}/$guestName")
}
}
@@ -33,13 +33,6 @@ object SocNames {
fun name(model: String, platform: String = GpuInfo.systemProperty("ro.board.platform")): String? =
MODELS[normalizedModel(model)] ?: PLATFORMS[platform.lowercase()]?.let { "$it family" }
// Without label's platform-family guess: a rebadged chip such as the Duo's CQ7790S reports a platform it is not.
fun plainName(model: String = model(), maker: String = manufacturer()): String =
MODELS[normalizedModel(model)]?.let { "$it ($model)" } ?: "$maker $model".trim()
private fun manufacturer(): String =
if (Build.VERSION.SDK_INT >= 31) Build.SOC_MANUFACTURER.takeIf { it != Build.UNKNOWN }.orEmpty() else ""
fun label(model: String = model(), platform: String = GpuInfo.systemProperty("ro.board.platform")): String {
val name = name(model, platform)
return when {
@@ -308,7 +308,8 @@ public final class TurnipDriver {
}
}
if (chosen != null && !chosen.isEmpty()) {
if (SessionPrefs.INSTANCE.displayDriverFromAuto(context)
if (SessionPrefs.GPU_DRIVERS_AUTO.equals(SessionPrefs.INSTANCE.gpuDriverMode(context))
&& SessionPrefs.INSTANCE.gpuAutoInstalled(context).contains(chosen)
&& gpuDetector.get().getFamily() == GpuInfo.Family.A7XX_LOW) {
Log.i(TAG, "Auto-selected display driver does not cover Adreno 710/720/722; leaving the display driver to the system");
return null;
@@ -1,39 +0,0 @@
package com.droiddeck.launcher.input
internal class AxisPacing(private val intervalMs: Long) {
private var lastWriteAt = 0L
private var written = false
private var heldUntil = NOT_HELD
fun dueAt(now: Long, axesOnly: Boolean): Long =
if (axesOnly && written && now - lastWriteAt < intervalMs) lastWriteAt + intervalMs else now
fun wrote(at: Long) {
lastWriteAt = at
written = true
}
fun hold(due: Long): Boolean {
if (heldUntil != NOT_HELD) return false
heldUntil = due
return true
}
fun release(now: Long): Boolean {
if (heldUntil == NOT_HELD || now < heldUntil) return false
heldUntil = NOT_HELD
return true
}
fun cancel(): Boolean {
if (heldUntil == NOT_HELD) return false
heldUntil = NOT_HELD
return true
}
companion object {
private const val NOT_HELD = Long.MIN_VALUE
@JvmStatic fun keepsMoving(before: Int, after: Int): Boolean = before == after || (before != 0 && after != 0)
}
}
@@ -1,9 +1,5 @@
package com.droiddeck.launcher.input;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Process;
import android.os.SystemClock;
import android.util.Log;
import java.io.File;
@@ -132,16 +128,6 @@ public class FakeInputWriter {
private static final Object RING_LOCK = new Object();
private static final RingSlot[] RING_SLOTS = new RingSlot[MAX_FAKE_INPUT_SLOTS];
private static final long AXIS_REPORT_INTERVAL_MS = 4;
private static final class Pacing {
static final Handler HANDLER;
static {
HandlerThread thread = new HandlerThread("pad-pacing", Process.THREAD_PRIORITY_DISPLAY);
thread.start();
HANDLER = new Handler(thread.getLooper());
}
}
static {
System.loadLibrary("sdnative");
@@ -170,9 +156,6 @@ public class FakeInputWriter {
private boolean hasChanges = false;
private boolean pendingFullResend = false;
private boolean forceResend = false;
private final AxisPacing axisPacing = new AxisPacing(AXIS_REPORT_INTERVAL_MS);
private final PadState pacedPad = new PadState();
private final Runnable pacedWrite = this::writePacedPad;
public FakeInputWriter(String fakeInputPath, int slot) {
this.slot = slot;
@@ -728,12 +711,10 @@ public class FakeInputWriter {
}
public synchronized void close() {
cancelPacedWrite();
isOpen = false;
}
public synchronized void reset() {
cancelPacedWrite();
if (!isOpen && !open())
return;
@@ -841,53 +822,6 @@ public class FakeInputWriter {
}
public synchronized void writePad(PadState state) {
long now = SystemClock.uptimeMillis();
long due = axisPacing.dueAt(now, !pendingFullResend && onlyAxesMove(state));
if (due > now) {
pacedPad.copyFrom(state);
if (axisPacing.hold(due))
Pacing.HANDLER.postAtTime(pacedWrite, due);
return;
}
cancelPacedWrite();
writePadNow(state);
}
private synchronized void writePacedPad() {
if (axisPacing.release(SystemClock.uptimeMillis()))
writePadNow(pacedPad);
}
private void cancelPacedWrite() {
if (axisPacing.cancel())
Pacing.HANDLER.removeCallbacks(pacedWrite);
}
private boolean onlyAxesMove(PadState state) {
for (int i = 0; i < 10; i++) {
if (prevButtonStates[i] != state.isDown(i))
return false;
}
return prevButtonStates[SNAPSHOT_IDX_MODE] == state.isDown(PadState.GUIDE)
&& prevQam == state.isDown(PadState.QAM)
&& prevHatX == state.hatX() && prevHatY == state.hatY()
&& AxisPacing.keepsMoving(prevThumbLX, stickValue(state.leftX))
&& AxisPacing.keepsMoving(prevThumbLY, stickValue(state.leftY))
&& AxisPacing.keepsMoving(prevThumbRX, stickValue(state.rightX))
&& AxisPacing.keepsMoving(prevThumbRY, stickValue(state.rightY))
&& AxisPacing.keepsMoving(prevTriggerL, triggerValue(state.leftTrigger))
&& AxisPacing.keepsMoving(prevTriggerR, triggerValue(state.rightTrigger));
}
private static int stickValue(float value) {
return (int) (value * 32767);
}
private static int triggerValue(float value) {
return (int) (value * 255);
}
private void writePadNow(PadState state) {
if (!isOpen && !open())
return;
@@ -911,10 +845,10 @@ public class FakeInputWriter {
hasChanges = true;
}
int lx = stickValue(state.leftX);
int ly = stickValue(state.leftY);
int rx = stickValue(state.rightX);
int ry = stickValue(state.rightY);
int lx = (int) (state.leftX * 32767);
int ly = (int) (state.leftY * 32767);
int rx = (int) (state.rightX * 32767);
int ry = (int) (state.rightY * 32767);
if (forceResend || lx != prevThumbLX) {
prevThumbLX = lx;
@@ -933,8 +867,8 @@ public class FakeInputWriter {
writeEvent(EV_ABS, ABS_RY, ry);
}
int tl = triggerValue(state.leftTrigger);
int tr = triggerValue(state.rightTrigger);
int tl = (int) (state.leftTrigger * 255);
int tr = (int) (state.rightTrigger * 255);
if (forceResend || tl != prevTriggerL) {
prevTriggerL = tl;
writeEvent(EV_ABS, ABS_BRAKE, tl);
@@ -961,8 +895,6 @@ public class FakeInputWriter {
if (!flushBuffer()) {
Log.e(TAG, "Gamepad write error: fake input mmap ring unavailable");
pendingFullResend = true;
} else {
axisPacing.wrote(SystemClock.uptimeMillis());
}
}
forceResend = false;
@@ -53,14 +53,14 @@ data class InputProfile(
fun elementClickAction(role: InputRole, element: InputSurfaceElement): InputAction = clicks[role]?.get(element.id)
?: defaultElementClick(element, elementAction(role, element.id, element.control)) { action(role, it) }
fun showsLeftMouseButton(role: InputRole, shown: List<InputSurfaceElement>, stock: InputProfile): Boolean = shown.any { element ->
fun showsMouseButton(role: InputRole, shown: List<InputSurfaceElement>, stock: InputProfile): Boolean = shown.any { element ->
val action = elementAction(role, element.id, element.control).takeIf {
elements[role]?.get(element.id) != stock.elements[role]?.get(element.id) || it != stock.elementAction(role, element.id, element.control)
}
val click = elementClickAction(role, element).takeIf {
clicks[role]?.get(element.id) != stock.clicks[role]?.get(element.id) || it != stock.elementClickAction(role, element)
}
listOfNotNull(action, click).any { it is InputAction.MouseButton && it.code == PointerGestures.BTN_LEFT }
listOfNotNull(action, click).any { it is InputAction.MouseButton && it.validFor(element.control) }
}
companion object {
@@ -207,8 +207,7 @@ object BattleNet {
val taken = HashSet<File>()
fun options(title: Title, folder: File) = listOfNotNull(folder, title.flavor?.let { File(folder, it) }?.takeIf { it.isDirectory })
for ((code, game) in games) {
val want = saved[code]?.let { runCatching { File(it).canonicalFile }.getOrNull() } ?: continue
val keep = options(game.first, game.second).firstOrNull { runCatching { it.canonicalFile }.getOrNull() == want }?.takeIf { it !in taken } ?: continue
val keep = saved[code]?.let(::File)?.takeIf { it in options(game.first, game.second) && it !in taken } ?: continue
out[code] = keep
taken.add(keep)
}
@@ -245,14 +244,6 @@ object BattleNet {
"/" + rootfs.relativize(resolved).joinToString("/")
}
}.trimEnd('/')
if (mapped?.startsWith("/") == true) {
val rootfs = LinuxRuntime.rootDir(context)
runCatching {
val home = rootfs.canonicalFile.toPath()
val host = File("$target/$relative").canonicalFile.toPath()
if (host.startsWith(home)) File(rootfs, home.relativize(host).toString()) else null
}.getOrNull()?.let { return it }
}
return com.droiddeck.launcher.frontend.AddedGames.hostPath(context, "$target/$relative")
}
@@ -436,7 +436,6 @@ object BwrapSpawner {
"DDNATV_ROOT" to sandbox,
"DDNATV_EXEC" to NativeGuest.execLoader.orEmpty(),
"DDNATV_LINK_ROOT" to rootfs.path,
"DDNATV_REAL_EXE" to program.path,
"DDNATV_BINDS" to plan.binds.joinToString("|") { "${it.host}:${it.guest}" },
"DDNATV_HOSTNAME" to SessionPrefs.guestHostname(context),
"LD_LIBRARY_PATH" to SANDBOX_LIB_DIRS.map(::host).filter { it.isDirectory }.joinToString(":") { it.path },
@@ -109,15 +109,9 @@ object DesktopCatalog {
FileUtils.readString(marker(context, id))?.trim()?.takeIf { it.isNotEmpty() }
fun protonSeedNeeded(context: Context): Boolean =
if (com.droiddeck.launcher.session.SessionPrefs.ownProtonFirst(context)) ownProtonMissing(context)
else installed(context, PROTON_SEED_ID) == null &&
installed(context, PROTON_SEED_ID) == null &&
!File(LinuxRuntime.rootDir(context), "root/.local/share/Steam/steamapps/appmanifest_4427310.acf").isFile
fun ownProtonMissing(context: Context): Boolean {
val extras = com.droiddeck.launcher.session.ProtonExtras
return extras.installedAll(context, extras.tools.first { it.id == extras.OWN }).isEmpty()
}
const val DESKTOP_ID = "desktop-kde"
const val EMULATORS_ID = "emulators"
private const val EMULATORS_SCRIPT = "/usr/local/bin/droiddeck-emulators"
@@ -73,10 +73,9 @@ object NativeGuest {
fun libraryPath(root: File): String = LIB_DIRS.joinToString(":") { File(root, it).path }
/** Environment every native process starts with; a guest `env -i` is re-seeded by the hook. */
fun environment(root: File, program: String, preload: List<String> = emptyList()): Map<String, String> = linkedMapOf(
fun environment(root: File, preload: List<String> = emptyList()): Map<String, String> = linkedMapOf(
"DDNATV_ROOT" to root.path,
"DDNATV_EXEC" to execLoader.orEmpty(),
"DDNATV_REAL_EXE" to hostProgram(root, program).path,
"LD_PRELOAD" to (preload.map { File(root, it.removePrefix("/")).path } + hook(root).path).joinToString(":"),
).filterValues { it.isNotEmpty() }
@@ -86,20 +85,17 @@ object NativeGuest {
*/
fun command(root: File, program: String, args: List<String>, libraryPath: String = libraryPath(root)): List<String> {
val loader = checkNotNull(loader(root)) { "no glibc loader in ${root.path}" }
val host = hostProgram(root, program)
val host = File(root, program.removePrefix("/"))
val launch = listOf(loader.path, "--library-path", libraryPath, "--argv0", host.name, host.path) + args
return simulator(root)?.let { it + launch } ?: (execPrefix(loader.path) + launch)
}
private fun hostProgram(root: File, program: String): File = File(root, program.removePrefix("/"))
/** The environment of the session process: the hook's root, the mounts proot used to make, the preload list. */
fun sessionEnvironment(root: File, binds: List<String>, program: String, hostname: String? = null): Map<String, String> {
fun sessionEnvironment(root: File, binds: List<String>, hostname: String? = null): Map<String, String> {
val preload = preloadList(root)
return linkedMapOf(
"DDNATV_ROOT" to root.path,
"DDNATV_EXEC" to execLoader.orEmpty(),
"DDNATV_REAL_EXE" to hostProgram(root, program).path,
"DDNATV_HOSTNAME" to hostname.orEmpty(),
"DDNATV_BINDS" to binds.joinToString("|") { if (it.contains(':')) it else "$it:$it" },
"DDNATV_PRELOAD" to preload.joinToString(":"),
@@ -118,7 +114,7 @@ object NativeGuest {
.also { builder ->
builder.environment().apply {
remove("LD_AUDIT")
putAll(sessionEnvironment(root, binds, guest.first(), SessionPrefs.guestHostname(context)))
putAll(sessionEnvironment(root, binds, SessionPrefs.guestHostname(context)))
}
}
@@ -282,7 +278,7 @@ object NativeGuest {
builder.directory(File(root, cwd.removePrefix("/")).takeIf { it.isDirectory } ?: root)
builder.environment().apply {
clear()
putAll(environment(root, program, preload))
putAll(environment(root, preload))
putAll(env)
}
return builder
@@ -22,7 +22,7 @@ class RuntimeInstallService : Service() {
if (intent?.action == ACTION_PACKAGE) return holdPackage(startId)
val removal = intent?.action == ACTION_REMOVE
val release = intent?.let(::releaseFrom)
val foreground = enterForeground(notification(getString(if (LinuxRuntimeInstaller.isMaintaining()) R.string.desktop_removing else if (removal) R.string.rtinst_removing else R.string.user_apps_starting), -1))
startForeground(NOTIFICATION_ID, notification(getString(if (LinuxRuntimeInstaller.isMaintaining()) R.string.desktop_removing else if (removal) R.string.rtinst_removing else R.string.user_apps_starting), -1))
if (release == null && !removal) {
stopSelf(startId)
return START_NOT_STICKY
@@ -31,7 +31,7 @@ class RuntimeInstallService : Service() {
val manager = getSystemService(NotificationManager::class.java)
var shown = ""
val progress = LinuxRuntimeInstaller.ProgressListener { stage, percent ->
if (foreground && "$stage:$percent" != shown) {
if ("$stage:$percent" != shown) {
shown = "$stage:$percent"
manager?.notify(NOTIFICATION_ID, notification(stage, percent))
}
@@ -46,10 +46,7 @@ class RuntimeInstallService : Service() {
}
private fun holdPackage(startId: Int): Int {
if (!enterForeground(notification(packageStage, packagePercent, packageTitle))) {
stopSelf(startId)
return START_NOT_STICKY
}
startForeground(NOTIFICATION_ID, notification(packageStage, packagePercent, packageTitle))
Thread({
val manager = getSystemService(NotificationManager::class.java)
var shown = ""
@@ -68,15 +65,6 @@ class RuntimeInstallService : Service() {
return START_NOT_STICKY
}
/** Android 12+ refuses a foreground start while the app is in the background; the work then goes on without the notification. */
private fun enterForeground(notification: Notification): Boolean = try {
startForeground(NOTIFICATION_ID, notification)
true
} catch (e: IllegalStateException) {
android.util.Log.w("RuntimeInstallService", "running without a foreground service: $e")
false
}
private fun notification(stage: String, percent: Int, title: String? = null): Notification {
val manager = getSystemService(NotificationManager::class.java)
manager?.createNotificationChannel(NotificationChannel(CHANNEL_ID, getString(R.string.setup_runtime),
@@ -328,7 +328,7 @@ object BottomDesktop {
LinuxRuntime.commandWithBinds(context, current.root, binds, guest)
}
val environment = if (current.nativeUserland) {
com.droiddeck.launcher.runtime.NativeGuest.sessionEnvironment(current.root, binds, guest.first(), SessionPrefs.guestHostname(context))
com.droiddeck.launcher.runtime.NativeGuest.sessionEnvironment(current.root, binds, SessionPrefs.guestHostname(context))
.map { (k, v) -> "$k=$v" }.toTypedArray()
} else current.hostEnvironment
val line = command.joinToString(" ") { it.replace("\\", "\\\\").replace(" ", "\\ ") }
@@ -88,8 +88,8 @@ object ComponentUpdater {
logLines(context).mapNotNull { STAMP.find(it)?.groupValues?.get(1) }.maxOrNull() ?: "0"
private fun lineOf(context: Context, state: JSONObject, p: ComponentsManager.Proton, comp: String): ComponentUpdates.Line? {
if (!ComponentUpdates.autoFollows(p, comp) || !ComponentsManager.supports(p, comp)) return null
if (comp == "fex") return ComponentUpdates.fexLine(p)
if (!ComponentUpdates.follows(p) || !ComponentsManager.supports(p, comp)) return null
if (comp == "fex") return ComponentUpdates.line("fex", false)
val key = "${p.id}|${p.version}"
val flavors = state.obj("flavors").obj(key)
val arm64ec = if (flavors.has(comp)) flavors.optBoolean(comp) else ComponentsManager.arm64ec(context, p, comp)?.also { flavors.put(comp, it) }
@@ -13,7 +13,7 @@ object ComponentUpdates {
const val BOOTED_SECONDS = 60L
const val FAILED_BOOTS_BEFORE_ROLLBACK = 2
data class Line(val key: String, val comp: String, val prefix: String, val release: String = ComponentsManager.DD_NIGHTLY)
data class Line(val key: String, val comp: String, val prefix: String)
val LINES = listOf(
Line("dxvk", "dxvk", "DD-dxvk-"),
@@ -21,19 +21,12 @@ object ComponentUpdates {
Line("vkd3d", "vkd3d", "DD-vkd3d-proton-"),
Line("vkd3d-arm64ec", "vkd3d", "DD-vkd3d-proton-arm64ec-"),
Line("fex", "fex", "DD-FEXCore-"),
Line("fex-bionic", "fex", "FEXCore-", ComponentsManager.DD_BIONIC),
)
private val OWN_PREFIX = ProtonExtras.tools.first { it.id == ProtonExtras.OWN }.prefix
fun follows(p: ComponentsManager.Proton): Boolean = !p.valve && p.dir.name.startsWith(OWN_PREFIX)
fun autoFollows(p: ComponentsManager.Proton, comp: String): Boolean =
follows(p) || (comp == "fex" && !p.valve && ComponentsManager.bionicTool(p.dir.name))
fun fexLine(p: ComponentsManager.Proton): Line =
if (ComponentsManager.bionicTool(p.dir.name)) LINES.first { it.release == ComponentsManager.DD_BIONIC } else line("fex", false)
fun ownId(protonId: String): Boolean = protonId.startsWith(ComponentsManager.safeName(OWN_PREFIX))
fun strays(
@@ -41,8 +34,8 @@ object ComponentUpdates {
choices: Map<String, Map<String, ComponentsManager.Choice>>,
placed: Set<String>,
): List<Pair<ComponentsManager.Proton, String>> =
protons.flatMap { p ->
choices[p.id].orEmpty().filter { (comp, c) -> !autoFollows(p, comp) && !c.auto && c.protonVersion == p.version && c.file in placed }.keys.map { p to it }
protons.filterNot(::follows).flatMap { p ->
choices[p.id].orEmpty().filter { (_, c) -> !c.auto && c.protonVersion == p.version && c.file in placed }.keys.map { p to it }
}
fun unseen(
@@ -60,14 +53,13 @@ object ComponentUpdates {
fun pick(items: List<ComponentsManager.CatalogItem>, line: Line, bad: Set<String>): ComponentsManager.CatalogItem? {
val newestBad = bad.filter { belongs(it, line) }.maxWithOrNull { a, b -> ProtonExtras.compareVersions(a, b) }
return items.filter { it.release == line.release && it.comp == line.comp && belongs(it.file, line) }
return items.filter { it.release == ComponentsManager.DD_NIGHTLY && it.comp == line.comp && belongs(it.file, line) }
.filter { newestBad == null || ProtonExtras.compareVersions(it.file, newestBad) > 0 }
.maxWithOrNull { a, b -> ProtonExtras.compareVersions(a.file, b.file) }
}
fun belongs(file: String, line: Line): Boolean =
file.startsWith(line.prefix) && file.removePrefix(line.prefix).firstOrNull()?.isDigit() == true &&
(line.comp != "fex" || ComponentsManager.bionicFex(file) == (line.release == ComponentsManager.DD_BIONIC))
file.startsWith(line.prefix) && file.removePrefix(line.prefix).firstOrNull()?.isDigit() == true
fun arm64ec(pe: ByteArray): Boolean? = runCatching {
val b = ByteBuffer.wrap(pe).order(ByteOrder.LITTLE_ENDIAN)
@@ -169,7 +161,7 @@ object ComponentUpdates {
fun stale(line: Line?, owned: Set<String>, stored: List<String>, keep: Set<String>, current: String, bad: Set<String> = emptySet()): List<String> {
val ranked = line?.takeIf { belongs(current, it) }
fun newer(file: String) = ranked != null && belongs(file, ranked) && ProtonExtras.compareVersions(file, current) > 0
return (owned + stored.filter { ranked != null && ranked.release == ComponentsManager.DD_NIGHTLY && belongs(it, ranked) })
return (owned + stored.filter { ranked != null && belongs(it, ranked) })
.filter { it !in keep && ((it in bad && it in owned) || !newer(it)) }.distinct()
}
}
@@ -29,7 +29,6 @@ object ComponentsManager {
private const val NIGHTLIES = "The412Banner/Nightlies"
private const val DD_COMPONENTS = "Droid-Deck/DroidDeck-Components"
internal const val DD_NIGHTLY = "linux-nightly"
internal const val DD_BIONIC = "bionic-stable"
private val RELEASES = linkedMapOf(
"FexCore-Linux" to "fex",
"Dxvk-Linux" to "dxvk",
@@ -38,9 +37,9 @@ object ComponentsManager {
"Vkd3d-proton-Linux" to "vkd3d",
)
private val NIGHTLY_PREFIXES = linkedMapOf("DD-dxvk-" to "dxvk", "DD-vkd3d-proton-" to "vkd3d", "DD-FEXCore-" to "fex")
private val SOURCES = RELEASES.keys.map { NIGHTLIES to it } + (DD_COMPONENTS to DD_NIGHTLY) + (DD_COMPONENTS to DD_BIONIC)
private val SOURCES = RELEASES.keys.map { NIGHTLIES to it } + (DD_COMPONENTS to DD_NIGHTLY)
private val DOWNLOAD_REPOS = listOf(NIGHTLIES, DD_COMPONENTS)
private val TYPES = mapOf("FEXCore-Linux" to "fex", "FEXCore-Bionic" to "fex", "DXVK-Linux" to "dxvk", "VKD3D-Linux" to "vkd3d")
private val TYPES = mapOf("FEXCore-Linux" to "fex", "DXVK-Linux" to "dxvk", "VKD3D-Linux" to "vkd3d")
private val TYPE_OF = mapOf("fex" to "FEXCore-Linux", "dxvk" to "DXVK-Linux", "vkd3d" to "VKD3D-Linux")
val COMPONENTS = listOf("fex", "dxvk", "vkd3d")
val LABEL = mapOf("fex" to "FEX", "dxvk" to "DXVK", "vkd3d" to "VKD3D-Proton")
@@ -202,34 +201,8 @@ object ComponentsManager {
COMPONENTS.mapNotNull { comp -> profile.optString(comp).takeIf(String::isNotEmpty)?.let { comp to it } }.toMap()
}
fun setGameComponent(context: Context, scope: String, comp: String, file: String?) {
fun setGameComponent(context: Context, scope: String, comp: String, file: String?) =
setGameComponent(context, scope, comp, file) { runtimeManaged(context, it) }
if (comp == "fex" && file != null) fetchFexTwin(context, safeName(file))
}
// Twin downloads in flight: one worker per name, so two profile changes cannot share one partial download.
private val twinDownloads = HashSet<String>()
private fun fetchFexTwin(context: Context, file: String) {
val twin = fexTwin(file) ?: return
if (protons(context).all { fexFits(it.dir.name, file) }) return
synchronized(lock) { if (isStored(context, twin) || !twinDownloads.add(twin)) return }
val app = context.applicationContext
Thread({
try {
runCatching {
val item = catalogItem(app, twin, if (bionicFex(twin)) DD_BIONIC else "FexCore-Linux")
if (item == null) Log.i(TAG, "$twin is not listed")
else {
download(app, item) {}
republish(app)
}
}.onFailure { Log.w(TAG, "download $twin", it) }
} finally {
synchronized(lock) { twinDownloads.remove(twin) }
}
}, "fex-twin").start()
}
internal fun setGameComponent(context: Context, scope: String, comp: String, file: String?, managed: (String) -> Boolean) = synchronized(lock) {
require(scope.matches(Regex("[1-9][0-9]{0,9}")) && scope.toLong() <= 4294967295L)
@@ -440,7 +413,7 @@ object ComponentsManager {
}
}
require(File(staged, "files").isDirectory) { "${wcp.name} has no files/" }
if (comp == "fex" && !bionicTool(dir.name)) FEX_FILES.filter { it.endsWith(".so") && !File(staged, it).isFile }.forEach { File(dir, it).delete() }
if (comp == "fex") FEX_FILES.filter { it.endsWith(".so") && !File(staged, it).isFile }.forEach { File(dir, it).delete() }
COMP_DIR[comp]?.let { compDir ->
for (arch in PE_ARCHES) {
val target = File(dir, "$compDir/$arch")
@@ -630,9 +603,7 @@ object ComponentsManager {
File(base, "files").walkTopDown().filter { it.isFile }.map { it.relativeTo(base).invariantSeparatorsPath }
.filter { owned(comp, it) }.associateWith { File(base, it) }
}
// A bionic tool never loses a FEX file: its launch.sh would put the whole bundled FEX back.
val removed = if (comp == "fex" && bionicTool(p.dir.name)) emptySet() else managed(comp) - files.keys
for (rel in removed) {
for (rel in managed(comp) - files.keys) {
lines.append(scope).append('\t').append(p.dir.name).append('\t').append(p.version).append('\t').append(comp)
.append('\t').append(rel).append("\t-\t-\n")
}
@@ -649,8 +620,7 @@ object ComponentsManager {
val version = safeName(file.removePrefix("original "))
"original-${p.id}-$version-$comp" to File(originalsDir(context), "${p.id}/$version/$comp.wcp")
} else {
val fit = (if (comp == "fex") launchFex(p.dir.name, file) { File(packagesDir(context), it).isFile } else file) ?: return null
safeName(fit.removeSuffix(".wcp")) to File(packagesDir(context), fit)
safeName(file.removeSuffix(".wcp")) to File(packagesDir(context), file)
}.takeIf { it.second.isFile }
}
@@ -681,14 +651,12 @@ object ComponentsManager {
for (scope in profiles.keys()) {
val profile = profiles.optJSONObject(scope) ?: continue
for (comp in COMPONENTS) {
val chosen = profile.optString(comp)
if (chosen.isEmpty()) continue
for (p in all) {
val file = (if (comp == "fex") launchFex(p.dir.name, chosen) { File(packagesDir(context), it).isFile } else chosen) ?: continue
val wcp = File(packagesDir(context), file)
if (!wcp.isFile) continue
append(scope, p, comp, safeName(file.removeSuffix(".wcp")), wcp)
}
val file = profile.optString(comp)
if (file.isEmpty()) continue
val wcp = File(packagesDir(context), file)
if (!wcp.isFile) continue
val key = safeName(file.removeSuffix(".wcp"))
for (p in all) append(scope, p, comp, key, wcp)
}
}
return PreparedLaunchState(lines.toString(), keep)
@@ -709,7 +677,6 @@ object ComponentsManager {
val wcp = File(packagesDir(context), safeName(file))
val info = packageInfo(context, wcp)
requireSelectable(context, info.comp)
requireFits(p, info)
val state = loadState(context)
if (inUse(context, p)) {
state.sub("queued").sub(p.id).put(info.comp, JSONObject().put("kind", "package").put("file", wcp.name).put("label", info.version)
@@ -723,11 +690,7 @@ object ComponentsManager {
context.getString(R.string.cmgr_swap_done, LABEL[info.comp], info.version, p.name)
}
private fun requireFits(p: Proton, info: Package) =
check(info.comp != "fex" || fexFits(p.dir.name, info.file)) { "${info.file} is not a FEX build for ${p.name}" }
private fun applyPackage(context: Context, p: Proton, info: Package, wcp: File, state: JSONObject, auto: Boolean = false) {
requireFits(p, info)
ensureOriginal(context, p, info.comp, state)
val hashes = installFiles(context, p.dir, info.comp, wcp)
state.sub("active").sub(p.id).put(info.comp, JSONObject()
@@ -840,18 +803,6 @@ object ComponentsManager {
internal fun liveOnAny(key: String, entry: JSONObject, installs: List<Proton>?): Boolean =
installs?.any { liveSelection(key, entry, it) } == true
// An installed tool that launches with `name` as the stored twin of a game's FEX choice (a Linux choice on
// DroidDeck-Bionic, a -bionic one on another Proton): deleting the twin would drop that choice for that tool.
internal fun twinUser(state: JSONObject, installed: List<Proton>, name: String): Proton? {
val profiles = state.optJSONObject("profiles") ?: return null
for (scope in profiles.keys()) {
val chosen = profiles.optJSONObject(scope)?.optString("fex")?.takeIf { it.isNotEmpty() } ?: continue
if (fexTwin(chosen) != name) continue
installed.firstOrNull { !fexFits(it.dir.name, chosen) }?.let { return it }
}
return null
}
internal fun packagesInUse(state: JSONObject, installed: List<Proton>): Set<String> {
val byId = installed.groupBy { it.id }
val names = HashSet<String>()
@@ -868,11 +819,7 @@ object ComponentsManager {
val profiles = state.optJSONObject("profiles")
for (scope in profiles?.keys() ?: emptyList<String>().iterator()) {
val profile = profiles?.optJSONObject(scope) ?: continue
COMPONENTS.forEach { comp ->
val file = profile.optString(comp).takeIf { it.isNotEmpty() } ?: return@forEach
names.add(file)
if (comp == "fex" && installed.any { !fexFits(it.dir.name, file) }) fexTwin(file)?.let(names::add)
}
COMPONENTS.forEach { comp -> profile.optString(comp).takeIf { it.isNotEmpty() }?.let(names::add) }
}
return names
}
@@ -943,7 +890,6 @@ object ComponentsManager {
val queued = state.sub("queued").sub(target.id)
var changed = false
wanted.forEach { (comp, entry) ->
if (comp == "fex" && !fexFits(target.dir.name, entry.optString("file"))) return@forEach
if (active?.has(comp) != true && !queued.has(comp)) {
queued.put(comp, entry)
changed = true
@@ -1024,8 +970,6 @@ object ComponentsManager {
fun deletePackage(context: Context, file: String): String = synchronized(lock) {
val name = safeName(file)
val state = loadState(context)
val twinTool = twinUser(state, protons(context), name)
check(twinTool == null) { context.getString(R.string.cmgr_package_in_use, name, twinTool?.name ?: "") }
val installed = protons(context).groupBy { it.id }
var changed = false
for (key in listOf("queued", "active")) {
@@ -1122,11 +1066,8 @@ object ComponentsManager {
return Catalog(items, o.optLong("fetchedAt"))
}
internal fun assetComp(release: String, name: String): String? = RELEASES[release] ?: when (release) {
DD_NIGHTLY -> NIGHTLY_PREFIXES.entries.firstOrNull { name.startsWith(it.key) }?.value
DD_BIONIC -> "fex"
else -> null
}
internal fun assetComp(release: String, name: String): String? =
RELEASES[release] ?: if (release == DD_NIGHTLY) NIGHTLY_PREFIXES.entries.firstOrNull { name.startsWith(it.key) }?.value else null
internal val CATALOG_ORDER: Comparator<CatalogItem> =
compareBy<CatalogItem> { it.comp }.thenBy { it.release == DD_NIGHTLY }.then(newestFirst { it.file })
@@ -1214,25 +1155,6 @@ object ComponentsManager {
return runCatching { readWcpEntry(original, rel) }.getOrNull()
}
// DroidDeck-Bionic loads only Android builds of FEX's unix libraries; other Protons only glibc builds.
internal fun bionicTool(dirName: String?): Boolean = dirName?.startsWith("DroidDeck-Bionic") == true
internal fun bionicFex(file: String): Boolean = file.endsWith("-bionic.wcp", ignoreCase = true)
internal fun fexFits(toolDir: String?, file: String): Boolean = bionicTool(toolDir) == bionicFex(file)
internal fun fexTwin(file: String): String? = when {
file.endsWith("-linux.wcp", ignoreCase = true) -> file.dropLast("-linux.wcp".length) + "-bionic.wcp"
file.endsWith("-bionic.wcp", ignoreCase = true) -> file.dropLast("-bionic.wcp".length) + "-linux.wcp"
else -> null
}
internal fun launchFex(toolDir: String, file: String, stored: (String) -> Boolean): String? =
if (fexFits(toolDir, file)) file else fexTwin(file)?.takeIf(stored)
internal fun <T> forTool(comp: String, toolDir: String?, items: List<T>, selected: String? = null, file: (T) -> String): List<T> =
if (comp != "fex") items else items.filter { file(it) == selected || fexFits(toolDir, file(it)) }
fun supports(p: Proton, comp: String): Boolean =
if (comp == "fex") File(p.dir, FEX_FILES.first()).isFile else File(p.dir, "${COMP_DIR.getValue(comp)}/aarch64-windows").isDirectory
@@ -1,52 +0,0 @@
package com.droiddeck.launcher.session
import android.util.Log
import com.droiddeck.launcher.stores.StoreInstalls
import java.io.File
object CpuCacheSysfs {
private const val TAG = "SessionService"
private val FEX_CPUID_SIZE_KB = mapOf(1 to 32, 2 to 512, 3 to 8192)
private val PROCESS = java.util.UUID.randomUUID().toString()
private val STARTS = java.util.concurrent.atomic.AtomicInteger()
fun binds(root: File, start: Int = STARTS.incrementAndGet(), host: File = File("/sys/devices/system/cpu"), process: String = PROCESS): List<String> = try {
root.listFiles()?.forEach { old -> if (old.name != process) StoreInstalls.deleteTree(old) }
val dir = File(root, "$process/$start")
StoreInstalls.deleteTree(dir)
val cpus = host.list { _, name -> name.matches(Regex("cpu\\d+")) }?.sorted().orEmpty()
val binds = cpus.mapNotNull { cpu ->
val staged = try {
stage(File(host, "$cpu/cache"), File(dir, cpu))
} catch (e: Exception) {
Log.w(TAG, "cpu cache: could not stage $cpu: $e")
false
}
if (staged) File(dir, cpu).path + ":" + File(host, "$cpu/cache").path else null
}
Log.i(TAG, "cpu cache: ${binds.size} of ${cpus.size} cores report the sizes the x86 CPUID reports")
binds
} catch (e: Exception) {
Log.w(TAG, "cpu cache: could not stage the core caches: $e")
emptyList()
}
private fun stage(cache: File, out: File): Boolean {
val indexes = cache.listFiles { f -> f.isDirectory && f.name.matches(Regex("index\\d+")) } ?: return false
var staged = false
for (index in indexes) {
val target = File(out, index.name).apply { mkdirs() }
val kb = runCatching { File(index, "level").readText().trim().toInt() }.getOrNull()?.let { FEX_CPUID_SIZE_KB[it] }
val files = index.listFiles { f -> f.isFile } ?: throw java.io.IOException("cannot list $index")
for (f in files) {
if (kb != null && f.name == "size") continue
File(target, f.name).writeText(f.readText())
}
if (kb == null) continue
File(target, "size").writeText("${kb}K\n")
staged = true
}
return staged
}
}
@@ -935,9 +935,9 @@ internal object EnhancedSessionLogShare {
private fun category(entry: String): Category {
val value = entry.lowercase(Locale.US)
if (value.startsWith("battlenet/") || value.startsWith("stores/") || value.startsWith("tools/") || value.startsWith("rpcs3/") ||
if (value.startsWith("battlenet/") || value.startsWith("stores/") || value.startsWith("tools/") ||
value.contains("droiddeck-esync/") || GAME_LOG.matches(value.substringAfterLast('/')) ||
listOf("proton", "wine", "dxvk", "vkd3d", "battle.net", "game-debug", "bionic").any(value::contains)) return Category.GAMES
listOf("proton", "wine", "dxvk", "vkd3d", "battle.net", "game-debug").any(value::contains)) return Category.GAMES
if (listOf("wayland", "gamescope", "xwayland", "vulkan", "gpu", "mesa", "egl", "glx", "drm", "compositor", "frame-trace").any(value::contains)) return Category.GRAPHICS
return Category.SESSION
}
@@ -948,9 +948,8 @@ internal object EnhancedSessionLogShare {
"droiddeck", "droiddeck-esync", "session.log", "app.log", "wayland.log", "audio.log",
"device.txt", "network.txt", "events.jsonl", "memory.csv", "capture.json", "crash.log",
"frame-trace.log", "process-trace.log", "game-lifecycle.log", "launches.log", "tools.tsv", "wanted.tsv", "prefixes.json",
"battlenet.log", "spawned.log", "flatpak-install.log", "cef_log.txt", "cef_log.previous.txt", "droiddeck-bionic.log",
"battlenet.log", "spawned.log", "flatpak-install.log", "cef_log.txt", "cef_log.previous.txt",
"console_log.txt", "webhelper_js.txt", "controller_support.txt", "systemperfmanager.txt",
"rpcs3", "RPCS3.log",
)
private val KNOWN_COMPONENT_PATTERNS = listOf(
Regex("[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2,}-[a-z0-9-]{1,24}"),
@@ -74,16 +74,10 @@ object ExperimentalProtons {
return PREFIX + base + (tag?.let { "-$it" } ?: "")
}
/** DroidDeck-Bionic test builds are prereleases of the same repository and have their own row in the Proton list. */
internal fun listed(assets: List<ProtonExtras.Asset>): List<ProtonExtras.Asset> {
val bionic = ProtonExtras.tools.first { it.id == ProtonExtras.BIONIC }
return assets.filterNot { bionic.assetPattern.containsMatchIn(it.name) }
}
fun refresh(context: Context): List<Release>? {
val tool = ProtonExtras.tools.first { it.id == ProtonExtras.OWN }
val fetched = ProtonExtras.releasesForRemoval(tool) ?: return null
val assets = listed(ProtonExtras.assets(tool, fetched.releases, prerelease = true))
val assets = ProtonExtras.assets(tool, fetched.releases, prerelease = true)
val rows = assets.map { Release(it.tag, it.name, it.url, it.sha512, it.size, it.releaseName) }.distinctBy { it.tag }
if (!SessionState.running) {
reconcile(context, fetched)
@@ -1,82 +0,0 @@
package com.droiddeck.launcher.session
/**
* Orders launch attempts and at most one pending game link.
*
* This is main-thread state: call it from the UI thread. A ticket is an identity,
* not a counter comparison, so a stale callback can only act on its own request.
*/
internal class LaunchTicket internal constructor(val serial: Long)
internal class LaunchCoordinator<O : Any, R : Any> {
internal class Link<O : Any, R : Any> internal constructor(
val ticket: LaunchTicket,
val owner: O,
val request: R?,
) {
/** Only the activity intent that delivered this link may finish it by a refresh. */
fun ownedBy(owner: O?): Boolean = this.owner === owner
}
private var next = 0L
private var current: LaunchTicket? = null
private var pending: Link<O, R>? = null
private var handling: LaunchTicket? = null
/** A launch that is allowed to proceed; it supersedes any pending link. */
fun beginLaunch(): LaunchTicket {
val ticket = LaunchTicket(++next)
current = ticket
pending = null
handling = null
return ticket
}
/** A game-link intent; it supersedes any earlier launch or link. */
fun beginLink(owner: O): LaunchTicket {
val ticket = LaunchTicket(++next)
current = ticket
pending = Link(ticket, owner, null)
handling = null
return ticket
}
/** The asynchronous link read returned; false means a newer request won. */
fun resolve(ticket: LaunchTicket, request: R?): Boolean {
val link = pending ?: return false
if (link.ticket !== ticket) return false
pending = Link(ticket, link.owner, request)
return true
}
fun beginHandling(ticket: LaunchTicket): Boolean {
val link = pending ?: return false
if (link.ticket !== ticket || link.request == null) return false
handling = ticket
return true
}
fun releaseHandling(ticket: LaunchTicket) {
if (handling === ticket) handling = null
}
fun isHandling(ticket: LaunchTicket): Boolean = handling === ticket
fun isCurrent(ticket: LaunchTicket): Boolean = current === ticket
fun hasPending(): Boolean = pending != null
fun pendingLink(): Link<O, R>? = pending
fun consume(ticket: LaunchTicket): Boolean {
val link = pending ?: return false
if (link.ticket !== ticket) return false
pending = null
handling = null
return true
}
fun cancelAll() {
next++
current = null
pending = null
handling = null
}
}
@@ -2,20 +2,16 @@ package com.droiddeck.launcher.session
import android.content.Context
import android.util.Log
import com.droiddeck.launcher.agent.AgentGuest
import com.droiddeck.launcher.runtime.LinuxRuntime
import java.io.File
object OfflineMode {
private const val TAG = "OfflineMode"
private const val KEY = "steam_offline"
private const val AUTO_KEY = "steam_offline_auto"
private const val NETWORK_KEY = "steam_offline_by_network"
private val WANTS = Regex("""^(\s*"WantsOfflineMode"\s*")([01])(".*)$""")
private val SKIP = Regex("""^(\s*"SkipOfflineModeWarning"\s*")([01])(".*)$""")
private val REMEMBER = Regex(""""RememberPassword"\s*"1"""")
private val PERSONA = Regex(""""PersonaName"\s*"([^"]*)"""")
private const val EVAL_TIMEOUT_MS = 10_000L
private fun prefs(context: Context) = context.getSharedPreferences("session", Context.MODE_PRIVATE)
@@ -23,12 +19,10 @@ object OfflineMode {
private fun x64LoginUsers(root: File) = File(root, "root/.droiddeck-x64/.local/share/Steam/config/loginusers.vdf")
private fun activeLoginUsers(context: Context, root: File) =
x64LoginUsers(root).takeIf { SessionPrefs.activeSteamClientArch(context) == "x86_64" && it.isFile }
?: loginUsers(root)
fun account(context: Context): String? {
val file = activeLoginUsers(context, LinuxRuntime.rootDir(context))
val root = LinuxRuntime.rootDir(context)
val file = x64LoginUsers(root).takeIf { SessionPrefs.activeSteamClientArch(context) == "x86_64" && it.isFile }
?: loginUsers(root)
val text = try {
if (file.isFile) file.readText() else return null
} catch (e: Exception) {
@@ -38,114 +32,21 @@ object OfflineMode {
return PERSONA.find(text)?.groupValues?.get(1)?.takeIf { it.isNotBlank() }.orEmpty()
}
private fun steamWants(context: Context, root: File): Boolean? {
val file = activeLoginUsers(context, root)
val lines = try {
if (file.isFile) file.readLines() else return null
} catch (e: Exception) {
Log.w(TAG, "could not read loginusers.vdf", e); return null
}
val values = lines.mapNotNull { WANTS.matchEntire(it)?.groupValues?.get(2) }
return if (values.isEmpty()) null else "1" in values
}
fun enabled(context: Context): Boolean = prefs(context).getBoolean(KEY, false)
internal fun manual(steamWants: Boolean?, automatic: Boolean, saved: Boolean): Boolean =
if (steamWants == null) saved else steamWants && !automatic
internal fun offline(manual: Boolean, online: Boolean, auto: Boolean = true): Boolean = manual || (auto && !online)
internal fun afterNetworkChange(manual: Boolean, online: Boolean): Boolean = manual && !online
fun auto(context: Context): Boolean = prefs(context).getBoolean(AUTO_KEY, true)
fun enabled(context: Context): Boolean = saved(context, LinuxRuntime.rootDir(context))
fun active(context: Context): Boolean =
offline(enabled(context), isOnline(context), auto(context))
@Synchronized
fun setEnabled(context: Context, on: Boolean) {
write(context, LinuxRuntime.rootDir(context), on)
SteamOfflineFollow.request()
prefs(context).edit().putBoolean(KEY, on).apply()
apply(context, LinuxRuntime.rootDir(context))
}
@Synchronized
fun setAuto(context: Context, on: Boolean) {
val manual = if (on) false else steamWants(context, LinuxRuntime.rootDir(context)) ?: active(context)
prefs(context).edit().putBoolean(AUTO_KEY, on).commit()
setEnabled(context, manual)
fun apply(context: Context, root: File) {
applyTo(context, loginUsers(root))
applyTo(context, x64LoginUsers(root))
}
fun apply(context: Context, root: File): Boolean = write(context, root, saved(context, root))
fun sync(context: Context): Boolean? {
val root = LinuxRuntime.rootDir(context)
val offline = synchronized(this) { write(context, root, saved(context, root)) }
return switchLive(context, offline)
}
fun follow(context: Context): Boolean? {
val root = LinuxRuntime.rootDir(context)
val (byNetwork, offline) = synchronized(this) {
if (!auto(context)) return false
prefs(context).getBoolean(NETWORK_KEY, false) to
write(context, root, afterNetworkChange(saved(context, root), isOnline(context)))
}
val result = switchLive(context, offline)
if (result == null && !offline && byNetwork) restoreNetworkOffline(context)
return result
}
@Synchronized
internal fun restoreNetworkOffline(context: Context) {
val prefs = prefs(context)
if (!auto(context) || prefs.getBoolean(KEY, false) || prefs.getBoolean(NETWORK_KEY, false)) return
prefs.edit().putBoolean(NETWORK_KEY, true).apply()
}
private fun isOnline(context: Context) = com.droiddeck.launcher.frontend.AutoComponents.isOnline(context)
private fun saved(context: Context, root: File): Boolean {
val prefs = prefs(context)
return manual(steamWants(context, root), prefs.getBoolean(NETWORK_KEY, false), prefs.getBoolean(KEY, false))
}
@Synchronized
private fun remember(context: Context, manual: Boolean): Boolean {
val online = isOnline(context)
val auto = auto(context)
val offline = offline(manual, online, auto)
prefs(context).edit().putBoolean(KEY, manual).putBoolean(NETWORK_KEY, offline && !manual).apply()
Log.i(TAG, "auto=$auto manual=$manual online=$online offline=$offline")
return offline
}
private fun switchLive(context: Context, offline: Boolean): Boolean? {
val answer = try {
AgentGuest.steamEval(context, "$SWITCH($offline)", EVAL_TIMEOUT_MS)
} catch (e: Exception) {
Log.w(TAG, "steam not reachable: ${e.javaClass.simpleName}: ${e.message}")
return null
}
val result = if (answer.optBoolean("ok")) answer.optString("value") else answer.optJSONObject("error")?.optString("message")
Log.i(TAG, "live offline=$offline: $result")
return when (result) {
"switched" -> true
"same" -> false
else -> null
}
}
private fun write(context: Context, root: File, manual: Boolean): Boolean {
val offline = remember(context, manual)
applyTo(loginUsers(root), offline)
applyTo(x64LoginUsers(root), offline)
return offline
}
private fun applyTo(file: File, offline: Boolean) {
private fun applyTo(context: Context, file: File) {
if (!file.isFile) return
val want = if (offline) "1" else "0"
val want = if (enabled(context)) "1" else "0"
try {
val lines = file.readLines()
val out = ArrayList<String>(lines.size + 4)
@@ -193,25 +94,4 @@ object OfflineMode {
Log.w(TAG, "could not write loginusers.vdf", e)
}
}
private val SWITCH = """(async want => {
const user = globalThis.SteamClient?.User;
if (typeof user?.GoOffline !== 'function' || typeof user?.GoOnline !== 'function') return "missing";
const seen = globalThis.__droiddeckSteamOffline ??= { value: null };
seen.want = want;
if (!seen.registered) {
seen.registered = true;
user.RegisterForCurrentUserChanges(u => { seen.value = !!u?.bIsOfflineMode; });
globalThis.SteamClient.GameSessions?.RegisterForAppLifetimeNotifications?.(n => {
if (n?.bRunning) return;
setTimeout(() => { if (seen.want === true && seen.value === false) user.GoOffline(); }, 2000);
});
}
for (let waited = 0; seen.value === null && waited < 4000; waited += 100) await new Promise(done => setTimeout(done, 100));
const current = seen.value;
if (current === null) return "unknown";
if (current === want) return "same";
if (want) user.GoOffline(); else user.GoOnline();
return "switched";
})"""
}
@@ -14,8 +14,7 @@ object ProtonDefault {
data class Tool(val name: String, val display: String, val dir: String, val valve: Boolean)
data class Request(val seq: Long, val valve: Boolean, val dir: String)
data class State(val default: String?, val applied: Long, val live: Boolean, val pending: String?, val tools: List<Tool>,
val source: String? = null)
data class State(val default: String?, val applied: Long, val live: Boolean, val pending: String?, val tools: List<Tool>)
data class GameChoice(val valve: Boolean, val dir: String)
enum class Outcome { LIVE, NEXT_START, NOT_RUNNABLE }
@@ -35,7 +34,6 @@ object ProtonDefault {
Tool(t.optString("name"), t.optString("display"), t.optString("dir"), t.optBoolean("valve"))
}?.takeIf { it.name.isNotEmpty() }
},
source = o.optString("source").ifEmpty { null },
)
}
@@ -101,13 +99,7 @@ object ProtonDefault {
if (!runnable(state, proton)) return Outcome.NOT_RUNNABLE
val d = dir(context)
val seq = nextSeq(System.currentTimeMillis(), state, parseRequest(read(File(d, "request.json"))))
writeRequest(d, Request(seq, proton.valve, proton.dir.name))
val tool = state.tools.firstOrNull { it.valve == proton.valve && it.dir == proton.dir.name }
return if (SessionState.running && state.live && (tool == null || state.pending != tool.name)) Outcome.LIVE else Outcome.NEXT_START
}
private fun writeRequest(d: File, request: Request) {
val body = JSONObject().put("seq", request.seq).put("valve", request.valve).put("dir", request.dir).toString(1) + "\n"
val body = JSONObject().put("seq", seq).put("valve", proton.valve).put("dir", proton.dir.name).toString(1) + "\n"
val staged = File(d, "request.json.staged")
try {
d.mkdirs()
@@ -118,45 +110,8 @@ object ProtonDefault {
Log.w(TAG, "could not write the Proton request", e)
throw e
}
}
// The default that names a tool an update replaces moves to the new one, as the per-game picks do: otherwise the guest
// no longer finds it and falls back to DroidDeck-Proton.
internal fun movedDefault(state: State, request: Request?, from: Set<String>, to: String, now: Long): Request? {
val (valve, dir) = chosen(state, request) ?: return null
if (valve || dir !in from) return null
return Request(nextSeq(now, state, request), false, to)
}
@Synchronized
fun moveDefault(context: Context, from: Set<String>, to: String) {
val d = dir(context)
val moved = movedDefault(state(context), parseRequest(read(File(d, "request.json"))), from, to, System.currentTimeMillis()) ?: return
writeRequest(d, moved)
}
// DroidDeck-Bionic keeps one build. A default naming another one moves to the installed build: an app from before
// updates carried the default over left it, or the guest fell back to its own tool when that build was gone (the
// request the app last wrote still names it).
internal fun bionicDefault(state: State, request: Request?, prefix: String, newest: String, now: Long): Request? {
val current = chosen(state, request)
val stale = when {
current != null && !current.first && current.second.startsWith(prefix) -> current.second
state.source == "fallback" && request != null && !request.valve && request.dir.startsWith(prefix) -> request.dir
else -> return null
}
return if (stale == newest) null else Request(nextSeq(now, state, request), false, newest)
}
/** The default and the per-game picks that name a DroidDeck-Bionic build other than [newest] move to it. */
@Synchronized
fun keepBionicCurrent(context: Context, prefix: String, newest: String) {
val d = dir(context)
bionicDefault(state(context), parseRequest(read(File(d, "request.json"))), prefix, newest, System.currentTimeMillis())
?.let { writeRequest(d, it) }
val games = parseGames(read(File(d, GAMES)))
val stale = games.values.filterNotNull().filter { !it.valve && it.dir.startsWith(prefix) && it.dir != newest }.map { it.dir }.toSet()
if (stale.isNotEmpty()) movedGames(games, stale, newest)?.let { writeGames(d, it) }
val tool = state.tools.firstOrNull { it.valve == proton.valve && it.dir == proton.dir.name }
return if (SessionState.running && state.live && (tool == null || state.pending != tool.name)) Outcome.LIVE else Outcome.NEXT_START
}
internal fun movedGames(choices: Map<String, GameChoice?>, from: Set<String>, to: String): Map<String, GameChoice?>? {
@@ -8,7 +8,6 @@ import android.util.Log
import com.droiddeck.launcher.core.Downloader
import com.droiddeck.launcher.core.FileUtils
import com.droiddeck.launcher.runtime.LinuxRuntime
import com.droiddeck.launcher.runtime.NativeGuest
import java.io.File
import java.util.Locale
import org.json.JSONArray
@@ -33,27 +32,20 @@ object ProtonExtras {
@Volatile
private var replacing = false
class Tool(val id: String, val name: String, val prefix: String, val repo: String, val assetPattern: Regex,
val prereleases: Boolean = false)
class Tool(val id: String, val name: String, val prefix: String, val repo: String, val assetPattern: Regex)
internal data class Asset(val tag: String, val name: String, val url: String, val sha512: String?, val size: Long,
val sha256: String? = null, val releaseName: String = tag)
internal data class ReleaseFetch(val releases: JSONArray, val complete: Boolean)
const val OWN = "droiddeck"
const val BIONIC = "bionic"
val tools = listOf(
Tool("ge", "GE-Proton", "GE-Proton", "GloriousEggroll/proton-ge-custom", Regex("aarch64\\.tar\\.(gz|xz)$")),
Tool("cachyos", "proton-cachyos", "proton-cachyos", "CachyOS/proton-cachyos", Regex("arm64\\.tar\\.(gz|xz)$")),
Tool("droiddeck", "DroidDeck-Proton", "DroidDeck-Proton", "Droid-Deck/DroidDeck-Proton", Regex("^DroidDeck-Proton-.*aarch64\\.tar\\.(gz|xz)$")),
// Bionic (Android libc) Proton started outside the Linux userland; test builds are prereleases. No-proot only.
Tool(BIONIC, "DroidDeck-Bionic", "DroidDeck-Bionic", "Droid-Deck/DroidDeck-Proton", Regex("^DroidDeck-Bionic-.*aarch64\\.tar\\.(gz|xz)$"), prereleases = true),
Tool("droiddeck", "DroidDeck-Proton", "DroidDeck-Proton", "Droid-Deck/DroidDeck-Proton", Regex("aarch64\\.tar\\.(gz|xz)$")),
)
/** The sources offered on this device: DroidDeck-Bionic only with Run without proot on. */
fun offered(context: Context): List<Tool> = tools.filter { it.id != BIONIC || NativeGuest.enabled(context) }
private fun home(context: Context) = File(LinuxRuntime.rootDir(context), "root")
private fun requests(context: Context) = File(home(context), ".dd-proton-extra")
private fun toolsDir(context: Context) = File(home(context), ".local/share/Steam/compatibilitytools.d")
@@ -128,11 +120,10 @@ object ProtonExtras {
private var lastAttempt = 0L
fun checkLatest(context: Context, force: Boolean = false, now: Long = System.currentTimeMillis()): Boolean {
keepBionicCurrent(context)
synchronized(checkLock) {
val file = latestFile(context)
val cache = readJson(file)
val due = offered(context).filter { tool ->
val due = tools.filter { tool ->
val at = cache.optJSONObject(tool.id)?.optLong("at", 0L) ?: 0L
force || (now - at) !in 0 until CHECK_EVERY_MS
}
@@ -182,32 +173,15 @@ object ProtonExtras {
fun remove(context: Context, tool: Tool, dir: String? = null) {
val name = if (dir != null) dir.takeIf { it in installedAll(context, tool) } ?: return else installed(context, tool) ?: return
if (deleteTool(context, name)) ComponentsManager.forgetProton(context, name)
}
// A tool folder can hold links that point out of it (a prefix template's dosdevices/z: -> /), and
// File.deleteRecursively() follows links into directories: remove each link itself, never what it points to.
private fun deleteTool(context: Context, name: String): Boolean {
val dir = File(toolsDir(context), name)
FileUtils.delete(dir)
return !dir.exists() && !java.nio.file.Files.isSymbolicLink(dir.toPath())
if (File(toolsDir(context), name).deleteRecursively()) ComponentsManager.forgetProton(context, name)
}
fun removeOlder(context: Context, tool: Tool) {
installedAll(context, tool).dropLast(1).forEach {
if (deleteTool(context, it)) ComponentsManager.forgetProton(context, it)
if (File(toolsDir(context), it).deleteRecursively()) ComponentsManager.forgetProton(context, it)
}
}
// DroidDeck-Bionic: the default and the game picks name the installed build, also when they were left on one an
// older app deleted without moving them.
private fun keepBionicCurrent(context: Context) {
if (SessionState.running) return
val tool = tools.firstOrNull { it.id == BIONIC } ?: return
val newest = installedAll(context, tool).lastOrNull() ?: return
runCatching { ProtonDefault.keepBionicCurrent(context, tool.prefix, newest) }.onFailure { Log.w(TAG, "bionic default and picks", it) }
}
private fun replaceOlder(context: Context, tool: Tool) {
val all = installedAll(context, tool)
val newest = all.lastOrNull() ?: return
@@ -220,9 +194,7 @@ object ProtonExtras {
if (runCatching { ComponentsManager.carryOver(context, old, newest) }.onFailure { Log.w(TAG, "components of $old", it) }.isFailure) continue
if (runCatching { keepUserSettings(context, old, newest) }.onFailure { Log.w(TAG, "user settings of $old", it) }.isFailure) continue
if (runCatching { ProtonDefault.moveGames(context, setOf(old), newest) }.onFailure { Log.w(TAG, "per-game picks of $old", it) }.isFailure) continue
// DroidDeck-Bionic only: the guest finds no default for a deleted Bionic build and falls back to DroidDeck-Proton
if (tool.id == BIONIC && runCatching { ProtonDefault.moveDefault(context, setOf(old), newest) }.onFailure { Log.w(TAG, "default pick of $old", it) }.isFailure) continue
if (deleteTool(context, old)) ComponentsManager.forgetProton(context, old)
if (File(toolsDir(context), old).deleteRecursively()) ComponentsManager.forgetProton(context, old)
else Log.w(TAG, "could not remove $old")
}
} finally {
@@ -249,24 +221,21 @@ object ProtonExtras {
}
@Synchronized
fun install(context: Context, tool: Tool, cancelled: java.util.function.BooleanSupplier? = null,
onProgress: (String, Int) -> Unit): String? {
fun install(context: Context, tool: Tool, onProgress: (String, Int) -> Unit): String? {
if (installInProgress || prefetching) return context.getString(R.string.pextra_busy)
installInProgress = true
return try { installNow(context, tool, cancelled, onProgress) } finally { installInProgress = false }
return try { installNow(context, tool, onProgress) } finally { installInProgress = false }
}
private fun fetchArchive(context: Context, tool: Tool, asset: Asset, archive: File, onProgress: (String, Int) -> Unit,
cancelled: java.util.function.BooleanSupplier? = null): String? {
private fun fetchArchive(context: Context, tool: Tool, asset: Asset, archive: File, onProgress: (String, Int) -> Unit): String? {
val downloading = context.getString(R.string.pextra_downloading, tool.name, asset.tag)
onProgress(downloading, 0)
var downloaded = false
for (attempt in 0 until 5) {
downloaded = Downloader.downloadFile(asset.url, archive, true, asset.sha256, cancelled) { fraction ->
downloaded = Downloader.downloadFile(asset.url, archive, true, asset.sha256) { fraction ->
onProgress(downloading, if (fraction < 0) -1 else (fraction * 100f).toInt().coerceIn(0, 100))
}
if (downloaded) break
if (cancelled?.asBoolean == true) return context.getString(R.string.pextra_interrupted)
if (attempt < 4) {
onProgress(context.getString(R.string.pextra_retrying, attempt + 2, 5), -1)
try { Thread.sleep(3_000) } catch (_: InterruptedException) {
@@ -300,8 +269,7 @@ object ProtonExtras {
return problem
}
private fun installNow(context: Context, tool: Tool, cancelled: java.util.function.BooleanSupplier?,
onProgress: (String, Int) -> Unit): String? {
private fun installNow(context: Context, tool: Tool, onProgress: (String, Int) -> Unit): String? {
if (SessionState.running) return context.getString(R.string.pextra_stop_session)
if (!LinuxRuntime.isInstalled(context)) return context.getString(R.string.user_apps_runtime_required)
@@ -316,7 +284,7 @@ object ProtonExtras {
val checked = asset.sha256 != null && asset.size > 0 && checkedArchive == fingerprint(archive) &&
checkedDigest.equals(asset.sha256, ignoreCase = true)
if (!checked) fetchArchive(context, tool, asset, archive, onProgress, cancelled)?.let { return it }
if (!checked) fetchArchive(context, tool, asset, archive, onProgress)?.let { return it }
if (asset.size > 0 && archive.length() != asset.size) {
if (archive.length() > asset.size) {
archive.delete()
@@ -374,7 +342,7 @@ object ProtonExtras {
archive.delete()
unqueue(context, tool)
record(context, tool, placed, asset.tag)
if (tool.id == OWN || tool.id == BIONIC) replaceOlder(context, tool)
if (tool.id == OWN) replaceOlder(context, tool)
if (EsyncPacks.enabled(context)) {
onProgress(context.getString(R.string.esync_fetching), -1)
try {
@@ -459,7 +427,7 @@ object ProtonExtras {
internal fun pickAsset(tool: Tool, array: JSONArray): Asset? {
val candidates = (0 until array.length()).asSequence()
.mapNotNull { array.optJSONObject(it) }
.filter { !it.optBoolean("draft", false) && (tool.prereleases || !it.optBoolean("prerelease", false)) }
.filter { !it.optBoolean("draft", false) && !it.optBoolean("prerelease", false) }
return candidates.firstNotNullOfOrNull { assetOf(tool, it) }
}
@@ -75,7 +75,6 @@ object SessionArtifacts {
LogRedactor.learnFromRuntime(LinuxRuntime.rootDir(context))
val record = Record(dir)
copySteamLogs(context, dir, record, steamArch)
copyRpcs3Log(context, dir, record)
VacDiagnostics.collect(context, dir)
SessionLogCapture.dumpCrashBuffer(File(dir, "crash.log"))
SessionLogCapture.dumpMemoryPressure(File(dir, "memory-pressure.log"))
@@ -322,9 +321,6 @@ object SessionArtifacts {
runCatching { File(dir, CLIENT_FILE).readText().trim() }.getOrNull()?.takeIf { it == "arm64" || it == "x86_64" }
private const val LOG_MARKS = "steam-log-marks.txt"
private const val RPCS3_LOG_MARKS = "rpcs3-log-marks.txt"
private const val RPCS3_LOGS = "root/.cache/rpcs3"
private const val RPCS3_LOG = "RPCS3.log"
private const val MAX_STEAM_LOG = 8L * 1024 * 1024
private const val HEAD = 4096L
@@ -332,19 +328,11 @@ object SessionArtifacts {
private class CopyResult(val files: List<File>, val failed: Boolean, val deferred: Boolean)
fun markSteamLogs(dir: File, logs: File) {
logs.listFiles { f -> f.isFile }?.let { markLogs(dir, LOG_MARKS, it.toList()) }
}
fun markRpcs3Log(dir: File, root: File) {
markLogs(dir, RPCS3_LOG_MARKS, listOf(File(root, "$RPCS3_LOGS/$RPCS3_LOG")).filter { it.isFile })
}
private fun markLogs(dir: File, marks: String, files: List<File>) {
val lines = files.mapNotNull { f ->
val lines = logs.listFiles { f -> f.isFile }?.mapNotNull { f ->
val size = f.length()
head(f, size)?.let { "$size\t$it\t${f.name}" }
}
runCatching { File(dir, marks).writeText(lines.joinToString("") { "$it\n" }) }
} ?: return
runCatching { File(dir, LOG_MARKS).writeText(lines.joinToString("") { "$it\n" }) }
}
private fun head(f: File, length: Long): String? = runCatching {
@@ -360,8 +348,8 @@ object SessionArtifacts {
java.security.MessageDigest.getInstance("SHA-1").digest(buf).joinToString("") { "%02x".format(it) }
}.getOrNull()
private fun logMarks(dir: File, marks: String): List<Mark>? = runCatching {
File(dir, marks).readLines().mapNotNull { line ->
private fun steamLogMarks(dir: File): List<Mark>? = runCatching {
File(dir, LOG_MARKS).readLines().mapNotNull { line ->
val parts = line.split('\t', limit = 3)
parts.getOrNull(0)?.toLongOrNull()?.let { size -> parts.getOrNull(1)?.let { Mark(size, it) } }
}
@@ -383,32 +371,11 @@ object SessionArtifacts {
val logs = File(steamArch?.let { SessionPrefs.steamRoot(context, it) } ?: SessionPrefs.activeSteamRoot(context), "logs")
if (!logs.isDirectory) return
val out = File(dir, "steam").apply { mkdirs() }
addCopied(record, copySessionLogsResult(logs, dir, out) { stopWhenSessionStarts && SessionState.running })
Log.i(TAG, "collected ${out.listFiles()?.size ?: 0} Steam log(s), scrubbed, into $out")
}
private fun copyRpcs3Log(context: Context, dir: File, record: Record, stopWhenSessionStarts: Boolean = false) {
val out = File(dir, "rpcs3")
val logs = File(LinuxRuntime.rootDir(context), RPCS3_LOGS)
val copied = copyRpcs3LogResult(logs, dir, out) { stopWhenSessionStarts && SessionState.running } ?: return
addCopied(record, copied)
if (copied.files.isNotEmpty()) Log.i(TAG, "collected RPCS3's log, scrubbed, into $out")
}
internal fun copyRpcs3Log(logs: File, dir: File, out: File): List<File> = copyRpcs3LogResult(logs, dir, out) { false }?.files.orEmpty()
private fun copyRpcs3LogResult(logs: File, dir: File, out: File, shouldStop: () -> Boolean): CopyResult? {
if (!File(dir, RPCS3_LOG_MARKS).isFile || !File(logs, RPCS3_LOG).isFile) return null
out.mkdirs()
val result = copySessionLogsResult(logs, dir, out, marksName = RPCS3_LOG_MARKS, accept = { it.name == RPCS3_LOG }, shouldStop = shouldStop)
if (result.files.isEmpty()) out.delete()
return result
}
private fun addCopied(record: Record, result: CopyResult) {
val result = copySessionLogsResult(logs, dir, out) { stopWhenSessionStarts && SessionState.running }
result.files.forEach { dst -> record.files[dst] = Scrubbed(dst.length(), dst.lastModified()) }
record.failed = record.failed || result.failed
record.deferred = record.deferred || result.deferred
Log.i(TAG, "collected ${out.listFiles()?.size ?: 0} Steam log(s), scrubbed, into $out")
}
internal fun copySessionLogs(
@@ -416,22 +383,20 @@ object SessionArtifacts {
dir: File,
out: File,
openWriter: (File) -> Writer = { it.bufferedWriter() },
): List<File> = copySessionLogsResult(logs, dir, out, openWriter = openWriter) { false }.files
): List<File> = copySessionLogsResult(logs, dir, out, openWriter) { false }.files
private fun copySessionLogsResult(
logs: File,
dir: File,
out: File,
marksName: String = LOG_MARKS,
accept: (File) -> Boolean = { true },
openWriter: (File) -> Writer = { it.bufferedWriter() },
shouldStop: () -> Boolean,
): CopyResult {
val marks = logMarks(dir, marksName)
val marks = steamLogMarks(dir)
val copied = ArrayList<File>()
var failed = false
var deferred = false
val sources = logs.listFiles { f -> f.isFile && accept(f) } ?: return CopyResult(copied, true, false)
val sources = logs.listFiles { f -> f.isFile } ?: return CopyResult(copied, true, false)
for (src in sources) {
if (shouldStop()) {
failed = true
@@ -602,7 +567,6 @@ object SessionArtifacts {
steamArch = recordedClient(dir),
stopWhenSessionStarts = stopWhenSessionStarts,
)
copyRpcs3Log(context, dir, record, stopWhenSessionStarts)
if (!record.deferred && (!stopWhenSessionStarts || !SessionState.running)) {
if (!record.failed && VacDiagnostics.collect(context, dir)) {
try {
@@ -28,14 +28,12 @@ object SessionFiles {
"usr/local/bin/droiddeck-bottom-desktop" to "usr/local/bin/droiddeck-bottom-desktop",
"usr/local/bin/droiddeck-gpu" to "usr/local/bin/droiddeck-gpu",
"usr/local/bin/droiddeck-desktop-gpu" to "usr/local/bin/droiddeck-desktop-gpu",
"usr/local/bin/droiddeck-device-info" to "usr/local/bin/droiddeck-device-info",
"usr/local/bin/droiddeck-desktop-window-rules" to "usr/local/bin/droiddeck-desktop-window-rules",
"usr/local/bin/droiddeck-library-perms" to "usr/local/bin/droiddeck-library-perms",
"usr/local/bin/droiddeck-ime" to "usr/local/bin/droiddeck-ime",
"usr/local/bin/kwin_wayland_wrapper" to "usr/local/bin/kwin_wayland_wrapper",
"usr/lib/firefox/defaults/pref/droiddeck.js" to "usr/lib/firefox/defaults/pref/droiddeck.js",
"etc/xdg/autostart/droiddeck-clipboard.desktop" to "etc/xdg/autostart/droiddeck-clipboard.desktop",
"etc/xdg/fastfetch/config.jsonc" to "etc/xdg/fastfetch/config.jsonc",
)
private val SERVICE_PACKS = mapOf(
@@ -145,7 +143,6 @@ object SessionFiles {
"usr/local/bin/droiddeck-proton-extra" to "usr/local/bin/droiddeck-proton-extra",
"usr/local/bin/droiddeck-netmanager" to "usr/local/bin/droiddeck-netmanager",
"usr/local/bin/droiddeck-login1" to "usr/local/bin/droiddeck-login1",
"usr/local/bin/droiddeck-documents" to "usr/local/bin/droiddeck-documents",
"usr/local/bin/droiddeck-steam-launch" to "usr/local/bin/droiddeck-steam-launch",
"usr/local/bin/droiddeck-desktop-games" to "usr/local/bin/droiddeck-desktop-games",
"usr/local/bin/droiddeck-desktop-programs" to "usr/local/bin/droiddeck-desktop-programs",
@@ -157,7 +154,6 @@ object SessionFiles {
"usr/local/bin/droiddeck-emulators" to "usr/local/bin/droiddeck-emulators",
"usr/local/bin/droiddeck-snap-run" to "usr/local/bin/droiddeck-snap-run",
"usr/local/bin/droiddeck-snap-confine" to "usr/local/bin/droiddeck-snap-confine",
"usr/local/bin/droiddeck-diversion-stub" to "usr/local/bin/droiddeck-diversion-stub",
"usr/local/bin/droiddeck-snapctl" to "usr/local/bin/droiddeck-snapctl",
"usr/local/bin/droiddeck-systemd-run" to "usr/local/bin/systemd-run",
"usr/local/bin/droiddeck-snap-cli" to "usr/local/bin/snap",
@@ -267,9 +263,7 @@ object SessionFiles {
"usr/local/share/vkbridge/droidbridge_icd.json" to "usr/local/share/vkbridge/droidbridge_icd.json",
"usr/local/bin/droiddeck-vkbridge-smoke" to "usr/local/bin/droiddeck-vkbridge-smoke",
"usr/local/lib/droiddeck/uruntime" to "usr/local/lib/droiddeck/uruntime",
"usr/local/lib/droiddeck/dwarfsextract" to "usr/local/lib/droiddeck/dwarfsextract",
"usr/local/lib/droiddeck-pipewire.tzst" to "usr/local/lib/droiddeck-pipewire.tzst",
"usr/local/share/licenses/dwarfs/LICENSE" to "usr/local/share/licenses/dwarfs/LICENSE",
"usr/local/share/licenses/uruntime/LICENSE" to "usr/local/share/licenses/uruntime/LICENSE",
) + mangoapp + xclipse.map { it to it } + maliCompat + msitools.map { it to it } + vr + gpuLoad + fexPreloads).filter { (asset, _) ->
val dir = asset.substringBeforeLast('/')
@@ -448,13 +448,6 @@ object SessionPrefs {
prefs(context).edit().putString("navTabHidden", keys.joinToString(",")).apply()
}
fun appsTabHomeSeen(context: Context): Boolean? =
prefs(context).takeIf { it.contains("appsTabHomeSeen") }?.getBoolean("appsTabHomeSeen", false)
fun setAppsTabHomeSeen(context: Context, seen: Boolean) {
prefs(context).edit().putBoolean("appsTabHomeSeen", seen).apply()
}
private fun idList(raw: String?): List<String> = raw.orEmpty().split(',').map { it.trim() }.filter { it.isNotEmpty() }
val STORES_SORTS = listOf("lastPlayed", "recentlyInstalled", "titleAsc", "titleDesc", "sizeDesc", "sizeAsc", "releaseDateDesc")
@@ -821,11 +814,6 @@ object SessionPrefs {
prefs(context).edit().putStringSet("gpuAutoInstalled", ids.toSet()).apply()
}
fun displayDriverFromAuto(context: Context): Boolean {
val id = androidDriver(context)
return id.isEmpty() || (gpuDriverMode(context) == GPU_DRIVERS_AUTO && id in gpuAutoInstalled(context))
}
fun picturePosition(context: Context): String =
prefs(context).getString("picturePosition", "center")
@@ -845,15 +833,6 @@ object SessionPrefs {
fun returnAfterGame(context: Context): Boolean = prefs(context).getBoolean("returnAfterGame", true)
fun valveProtonOnDemand(context: Context): Boolean = prefs(context).getBoolean("valveProtonOnDemand", true)
fun setValveProtonOnDemand(context: Context, on: Boolean) {
prefs(context).edit().putBoolean("valveProtonOnDemand", on).apply()
}
/** DroidDeck-Proton is the Proton placed before the client starts; Valve's ARM64 Proton waits for a title that needs it. */
fun ownProtonFirst(context: Context): Boolean = valveProtonOnDemand(context) && !ProtonExtras.declined(context)
fun setReturnAfterGame(context: Context, on: Boolean) {
prefs(context).edit().putBoolean("returnAfterGame", on).apply()
}
@@ -1058,7 +1037,7 @@ object SessionPrefs {
prefs(context).edit().putBoolean("prootFastPath", on).apply()
}
fun cursorComposite(context: Context): Boolean = prefs(context).getBoolean("cursorComposite", true)
fun cursorComposite(context: Context): Boolean = prefs(context).getBoolean("cursorComposite", false)
fun setCursorComposite(context: Context, on: Boolean) {
prefs(context).edit().putBoolean("cursorComposite", on).apply()
@@ -1364,10 +1343,6 @@ object SessionPrefs {
SessionDisplay.effectiveChoice(
resolutionStored(context, mode, panel, false), resolutionStored(context, mode, panel, true), portrait)
fun followScales(context: Context, mode: String, panel: Pair<Int, Int>): Pair<Float?, Float?> =
SessionDisplay.followScale(resolutionChoice(context, mode, panel, false)) to
SessionDisplay.followScale(resolutionChoice(context, mode, panel, true))
fun resolutionStored(context: Context, mode: String, panel: Pair<Int, Int>, portrait: Boolean): String {
if (!portrait) return landscapeResolutionStored(context, mode, panel)
val value = prefs(context).getString("displayResolution.portrait.$mode", null) ?: return SessionDisplay.LINK_LANDSCAPE
@@ -1578,7 +1553,7 @@ object SessionPrefs {
fun adoptAddedGameExe(context: Context, folderPath: String, expected: String, path: String, seen: Int): Boolean =
synchronized(addedGameLock) {
val unchanged = addedGameExe(context, folderPath) == expected
if (unchanged) prefs(context).edit().putString("addedExe:$folderPath", path).putString("addedAdopted:Exe:$folderPath", path).putInt("addedExeSeen:$folderPath", seen).apply()
if (unchanged) prefs(context).edit().putString("addedExe:$folderPath", path).putInt("addedExeSeen:$folderPath", seen).apply()
unchanged
}
@@ -669,8 +669,6 @@ class SessionService : Service() {
guest.add("DROIDDECK_WSI_BYPASS_CHECK_MS=100")
guest.add("WINE_OFFSCREEN_CHECK_MS=100")
guest.add("DD_REFRESH=" + Math.round(SessionState.refreshHz))
guest.add("DD_DEVICE_NAME=" + android.os.Build.MODEL)
com.droiddeck.launcher.gpu.SocNames.plainName().takeIf { it.isNotEmpty() }?.let { guest.add("DD_SOC_NAME=$it") }
guest.add("DD_LOG=" + sessionLog.path)
guest.add("DD_DEBUG_DIR=" + sessionDir.path)
if (EnhancedDiagnostics.isActive(this, sessionDir)) guest.add("DROIDDECK_ENHANCED_DIAGNOSTICS=1")
@@ -696,7 +694,7 @@ class SessionService : Service() {
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("DD_ADDED_GAMES=" + listing.path)
if (OfflineMode.active(this)) guest.add("DD_STEAM_OFFLINE=1")
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})" })
}
@@ -786,7 +784,7 @@ class SessionService : Service() {
if (drives > 0) Log.i(TAG, "$drives Wine drive links given their guest paths back")
val hostEnv = if (nativeUserland) HostEnvironment().also { env ->
Log.i(TAG, "native userland: no proot (${sessionBindSpecs.size} mounts)")
com.droiddeck.launcher.runtime.NativeGuest.sessionEnvironment(root, sessionBindSpecs, guest.first(), SessionPrefs.guestHostname(this))
com.droiddeck.launcher.runtime.NativeGuest.sessionEnvironment(root, sessionBindSpecs, SessionPrefs.guestHostname(this))
.forEach { (k, v) -> env[k] = v }
} else prootEnv
@@ -815,11 +813,6 @@ class SessionService : Service() {
.onFailure { Log.w(TAG, "desktop language pack: $it") }
}
if (SessionState.mode == MODE_STEAM || SessionState.mode == MODE_DESKTOP) {
val steamOffline = SteamOfflineFollow()
steamOffline.attach(this)
components.add(steamOffline)
}
val networkLink = LinuxNetworkLinkComponent(this, root)
networkLink.attach(this)
networkLink.publish()
@@ -1009,7 +1002,6 @@ class SessionService : Service() {
))
guest.add("TZ=" + java.util.TimeZone.getDefault().id)
if (SessionState.mode == MODE_STEAM) SessionPrefs.pendingShaderPrecache(this)?.let { guest.add("DD_SHADER_PRECACHE=" + if (it) "1" else "0") }
guest.add("DD_VALVE_PROTON=" + if (SessionPrefs.ownProtonFirst(this)) "0" else "1")
guest.add("XDG_RUNTIME_DIR=" + LinuxRuntime.GUEST_RUNTIME_DIR)
guest.add("XDG_SESSION_TYPE=wayland")
guest.add("WAYLAND_DISPLAY=wayland-0")
@@ -1041,9 +1033,6 @@ class SessionService : Service() {
)
(if (bridge || venus) null else LinuxVulkanDriver.resolveIcdPath(this, linuxDriverId))
?.let { guest.add(LinuxVulkanDriver.ENV + "=" + it) }
// DroidDeck-Bionic games load an Android driver build; this is the one the display uses, for a runtime driver
// that has none.
guest.add("DROIDDECK_DISPLAY_DRIVER=" + com.droiddeck.launcher.gpu.TurnipDriver(this).effectiveId())
if (!com.droiddeck.launcher.core.DeviceSupport.adreno() && lastXwaylandCrashed()) {
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)")
@@ -1081,7 +1070,6 @@ class SessionService : Service() {
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("DD_MANGOAPP=" + (if (SessionPrefs.mangoapp(this)) "1" else "0"))
SessionPaths.current()?.let { SessionArtifacts.markRpcs3Log(it, LinuxRuntime.rootDir(this)) }
SessionState.steamClientArch = if (steamHere) SessionPrefs.steamClientArch(this) else null
SessionState.steamClientArch?.let { arch ->
guest.add("DD_STEAM_CLIENT_ARCH=$arch")
@@ -1275,7 +1263,6 @@ class SessionService : Service() {
components.add(hwmon)
binds.add(hwmon.dir.path + ":/sys/class/hwmon")
}
binds.addAll(CpuCacheSysfs.binds(File(filesDir, "session/sys/cpu-cache")))
val cpuStat = CpuStatComponent(File(filesDir, "session/proc-stat"))
if (cpuStat.prepare()) {
cpuStat.attach(this)
@@ -148,9 +148,6 @@ object SessionState {
@Volatile
var outputSize: Pair<Int, Int> = Pair(1920, 1080)
@Volatile
var followScales: Pair<Float?, Float?> = null to null
@Volatile
var followScreen = false
var followScale = 1f
@@ -25,7 +25,7 @@ object SettingsReset {
"noXalia", "fastSync", "fsyncFirst", "syncFallback", "prootNoSeccomp", "prootFastPath", "nativeUserland", "cursorComposite",
"guestHostname", "fexPreset", "forceSsbs", "logs", "gameDebugLogsEnabled", "enhancedDiagnosticsNext", "storageDiagnostics", "buildWatermark",
"upscaler", "upscaleSharpness", "screenEffects", "blackFrameInsertion", "textureAnisotropy", "textureLodBias",
"steamDownloadsInBackground", "steam_offline", "steam_offline_auto", "steam_offline_by_network", "bootMovie", "bootMovieSound", "bootMovieVolume", "bootMovieSeconds", "skipBootMovie",
"steamDownloadsInBackground", "steam_offline", "bootMovie", "bootMovieSound", "bootMovieVolume", "bootMovieSeconds", "skipBootMovie",
"bootMovieApplyNext", "bootMovieSteamSeen", "bootMovieShuffle",
"questDefaultsV1", "telemetryAuto", "telemetryOff", "statsStrip", "statsHud", "bottomHud", "bottomStripMetrics", "bottomStripTabs", "statsDash", "statsSpeedUnit",
)
@@ -67,7 +67,7 @@ object SettingsReset {
}
QuestExperimental.initialize(context)
runCatching { OfflineMode.setEnabled(context, false) }
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) }
@@ -1,104 +0,0 @@
package com.droiddeck.launcher.session
import android.net.ConnectivityManager
import android.net.Network
import android.net.NetworkCapabilities
import android.os.Handler
import android.os.HandlerThread
import android.util.Log
import com.droiddeck.launcher.core.SessionPart
import com.droiddeck.launcher.frontend.AutoComponents
class SteamOfflineFollow : SessionPart() {
private var thread: HandlerThread? = null
@Volatile private var handler: Handler? = null
private var callback: ConnectivityManager.NetworkCallback? = null
private var online: Boolean? = null
private var retries = 0
private var requested = false
private val check = object : Runnable {
override fun run() {
val handler = handler ?: return
if (SessionState.running && SessionState.suspended) {
handler.postDelayed(this, SUSPENDED_POLL_MS)
return
}
val result = if (requested) OfflineMode.sync(app()) else OfflineMode.follow(app())
if (result != null) requested = false
if (result == null && retries < MAX_RETRIES) {
retries++
handler.postDelayed(this, RETRY_MS)
}
}
}
override fun start() {
val started = HandlerThread("steam-offline").also { it.start() }
val handler = Handler(started.looper)
thread = started
this.handler = handler
val registered = object : ConnectivityManager.NetworkCallback() {
override fun onCapabilitiesChanged(network: Network, capabilities: NetworkCapabilities) =
changed(capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) &&
capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED))
override fun onLost(network: Network) = changed(false)
}
callback = registered
active = this
online = AutoComponents.isOnline(app())
app().getSystemService(ConnectivityManager::class.java).registerDefaultNetworkCallback(registered, handler)
sync()
}
private fun changed(now: Boolean) {
val handler = handler ?: return
if (now == online) return
online = now
handler.removeCallbacks(check)
retries = 0
if (OfflineMode.auto(app())) requested = false
handler.postDelayed(check, if (now) ONLINE_DELAY_MS else OFFLINE_DELAY_MS)
}
private fun sync() {
handler?.post {
val handler = handler ?: return@post
handler.removeCallbacks(check)
retries = 0
requested = true
handler.post(check)
}
}
override fun stop() {
if (active === this) active = null
val registered = callback
callback = null
if (registered != null) {
try {
app().getSystemService(ConnectivityManager::class.java).unregisterNetworkCallback(registered)
} catch (e: IllegalArgumentException) {
Log.w(TAG, "network callback was already gone", e)
}
}
handler?.removeCallbacksAndMessages(null)
handler = null
thread?.quitSafely()
thread = null
}
companion object {
private const val TAG = "SteamOfflineFollow"
@Volatile private var active: SteamOfflineFollow? = null
const val ONLINE_DELAY_MS = 2_000L
const val OFFLINE_DELAY_MS = 10_000L
const val RETRY_MS = 15_000L
const val MAX_RETRIES = 8
const val SUSPENDED_POLL_MS = 1_000L
fun request() {
active?.sync()
}
}
}
@@ -3,10 +3,8 @@ package com.droiddeck.launcher.stores
import android.content.Context
import android.os.StatFs
import android.os.storage.StorageManager
import com.droiddeck.launcher.frontend.AddedGames
import com.droiddeck.launcher.runtime.LinuxRuntime
import com.droiddeck.launcher.session.GameStorage
import com.droiddeck.launcher.session.SecondaryLibrary
import com.droiddeck.launcher.session.SessionPrefs
import java.io.File
import java.util.zip.CRC32
@@ -14,7 +12,6 @@ import java.util.zip.CRC32
object StoreInstallRoot {
const val SPACE_UNKNOWN = -1L
private const val INTERNAL = "root/Games/Stores"
const val INTERNAL_GUEST = "/$INTERNAL"
private const val ON_VOLUME = "Games"
const val GUEST_EXTERNAL = "/mnt/droiddeck-stores"
@@ -182,24 +179,6 @@ object StoreInstallRoot {
fun externalBindSpecsForXodus(context: Context): List<String> =
externalBindSpecs(externalRootsForXodus(context), LinuxRuntime.rootDir(context))
fun guestBinds(context: Context): List<String> {
val out = ArrayList<String>(externalBindSpecs(context))
val root = LinuxRuntime.rootDir(context)
GameStorage.effective(context)?.takeIf { File(it.path).isDirectory }?.let { library ->
val content = SecondaryLibrary.contentPath(File(library.path)).path
for (guest in SecondaryLibrary.CARD_GUESTS) {
File(root, guest.removePrefix("/")).mkdirs()
out += "$content:$guest"
}
}
for (folder in AddedGames.roots(context)) {
if (!folder.host.isDirectory || !folder.host.canRead()) continue
File(root, folder.guest.removePrefix("/")).mkdirs()
out += folder.host.path + ":" + folder.guest
}
return out
}
internal fun externalBindSpecs(roots: List<Pair<File, String>>, guestRoot: File): List<String> =
roots.mapNotNull { (host, guest) ->
if (!host.isDirectory || !host.canRead()) return@mapNotNull null
@@ -12,11 +12,8 @@ object StoreLaunch {
const val EPIC_CODE = ".droiddeck-epic-code"
const val EPIC_ARGS = ".droiddeck-epic-args"
const val UBISOFT_LAUNCH = ".droiddeck-ubisoft.json"
/** DroidDeck-Bionic's Wine has Android's root on Z:; that tool sets this to the guest's root as its Wine names it. */
const val GUEST_ROOT = "DROIDDECK_GUEST_ROOT"
private const val ROOT_VAR = "DD_R"
private const val UBISOFT_SERVICE = "%$ROOT_VAR%\\usr\\local\\lib\\droiddeck-ubisoft\\droiddeck-upc.exe"
const val EPIC_PARENT = "%$ROOT_VAR%\\usr\\local\\lib\\droiddeck-epic\\EpicGamesLauncher.exe"
private const val UBISOFT_SERVICE = "Z:\\usr\\local\\lib\\droiddeck-ubisoft\\droiddeck-upc.exe"
const val EPIC_PARENT = "Z:\\usr\\local\\lib\\droiddeck-epic\\EpicGamesLauncher.exe"
/** Per-game environment switch: 1 starts any Epic game under [EPIC_PARENT], 0 never does. */
const val EPIC_PARENT_SWITCH = "DD_EPIC_PARENT"
/** Epic app names whose launchers treat the game as unowned unless a process named EpicGamesLauncher.exe started it. */
@@ -50,10 +47,6 @@ object StoreLaunch {
for ((k, v) in sidecar.env) if (ENV_NAME.matches(k)) lines += "set \"$k=${v.replace("\"", "")}\""
val args = sidecar.args.joinToString(" ") { if (sidecar.store == Store.ROCKSTAR) batchArg(it) else quoteArg(it) }
val run = "\"%~dp0$exe\"" + (if (args.isNotEmpty()) " $args" else "")
if (sidecar.store == Store.EPIC || sidecar.store == Store.UBISOFT) {
lines += "set \"$ROOT_VAR=Z:\""
lines += "if defined $GUEST_ROOT set \"$ROOT_VAR=%$GUEST_ROOT%\""
}
if (sidecar.store == Store.EPIC) {
lines += "set \"$PARENT_VAR=${if (sidecar.id in EPIC_PARENT_TITLES) "1" else ""}\""
lines += "if \"%$EPIC_PARENT_SWITCH%\"==\"1\" set \"$PARENT_VAR=1\""
@@ -144,6 +137,7 @@ object StoreLaunch {
if (sidecar.store !in listOf(Store.UBISOFT, Store.ROCKSTAR) || !sidecar.isInstalled) return sidecar
if (sidecar.store == Store.ROCKSTAR && java.nio.file.Files.isSymbolicLink(File(folder, LAUNCHER).toPath())) return sidecar.copy(launcher = null)
val wrongExe = !sidecar.exeFile(folder).isFile || sidecar.exe.contains("installer", ignoreCase = true) || sidecar.exe.contains("autorun", ignoreCase = true)
if (sidecar.store == Store.UBISOFT && sidecar.launcher == LAUNCHER && !wrongExe) return sidecar
val metadataExe = if (sidecar.store == Store.ROCKSTAR) com.droiddeck.launcher.stores.rockstar.RockstarMetadata.find(folder)?.exe
?.takeIf { File(folder, it).isFile && File(folder, it).canonicalPath.startsWith(folder.canonicalPath + File.separator) } else null
val exe = metadataExe ?: if (wrongExe) StoreExe.pick(folder, null, sidecar.title).ifEmpty { sidecar.exe } else sidecar.exe
@@ -65,7 +65,6 @@ class StoreLoginActivity : ComponentActivity() {
val readsPage: Boolean get() = false
val pageScript: String get() = "(function(){ try { return document.body.innerText; } catch(e){ return ''; } })()"
fun pageReady(result: String): Boolean = true
fun browserStep(page: String): String? = null
fun forgetSignIn(done: () -> Unit) = done()
fun pageFinished(view: WebView, url: String) {}
}
@@ -73,7 +72,6 @@ class StoreLoginActivity : ComponentActivity() {
private var store: Store? = null
private var clientUrl: String? = null
private var flow: Flow? = null
private var pendingBrowserStep: String? = null
private var webViewRef: WebView? = null
private var popupWebView: WebView? = null
private lateinit var contentHost: FrameLayout
@@ -213,7 +211,6 @@ class StoreLoginActivity : ComponentActivity() {
private fun reloadLogin() {
dismissPopup(); clearError()
pendingBrowserStep = null
captured.set(false)
val fresh = generateState()
oauthState = fresh
@@ -335,13 +332,9 @@ class StoreLoginActivity : ComponentActivity() {
private fun readPage(view: WebView, f: Flow, left: Int) {
view.evaluateJavascript(f.pageScript) { json ->
if (flow !== f) return@evaluateJavascript
val result = json ?: ""
if (!f.pageReady(result) && left > 0) view.postDelayed({ readPage(view, f, left - 1) }, PAGE_RETRY_MS)
else {
val step = f.browserStep(result)
if (step == null || !continueInBrowser(step)) Thread({ settle(f.finish(this, view, result)) }, "store-login").start()
}
else Thread({ settle(f.finish(this, view, result)) }, "store-login").start()
}
}
@@ -357,21 +350,6 @@ class StoreLoginActivity : ComponentActivity() {
if (f.readsPage) readPage(view, f, PAGE_TRIES) else Thread({ settle(f.finish(this, view, url)) }, "store-login").start()
}
private fun continueInBrowser(url: String): Boolean {
if (isFinishing || isDestroyed) return false
if (!lifecycle.currentState.isAtLeast(androidx.lifecycle.Lifecycle.State.STARTED)) {
pendingBrowserStep = url
return true
}
val opened = runCatching { startActivity(android.content.Intent(android.content.Intent.ACTION_VIEW, Uri.parse(url))) }
.onFailure { Log.w(TAG, "no browser took the sign-in step: ${it.javaClass.simpleName}") }
.isSuccess
if (!opened) return false
titleText.text = getString(R.string.stores_login_title, store?.label ?: "")
showError(getString(R.string.stores_login_continue_in_browser, store?.label ?: ""))
return true
}
private fun settle(problem: String?) {
runOnUiThread {
if (problem == null) { StoresState.refresh(this); finish(); return@runOnUiThread }
@@ -389,10 +367,6 @@ class StoreLoginActivity : ComponentActivity() {
override fun onStart() {
super.onStart()
pendingBrowserStep?.let { step ->
pendingBrowserStep = null
if (!continueInBrowser(step)) reloadLogin()
}
if (clientUrl != null && !isFinishing) com.droiddeck.launcher.session.SessionService.holdForSignIn(this, true)
}
@@ -7,7 +7,9 @@ import com.droiddeck.launcher.R
import com.droiddeck.launcher.frontend.AddedGames
import com.droiddeck.launcher.runtime.BattleNet
import com.droiddeck.launcher.runtime.GuestCommand
import com.droiddeck.launcher.runtime.LinuxRuntime
import com.droiddeck.launcher.session.GameStorage
import com.droiddeck.launcher.session.SecondaryLibrary
import com.droiddeck.launcher.stores.CatalogItem
import com.droiddeck.launcher.stores.InstalledStoreGame
import com.droiddeck.launcher.stores.Store
@@ -73,10 +75,22 @@ object BattleNetInstall {
}
internal fun binds(context: Context): List<String> {
val out = ArrayList<String>(StoreInstallRoot.externalBindSpecs(context))
val root = LinuxRuntime.rootDir(context)
GameStorage.effective(context)?.let { library ->
if (!File(library.path).isDirectory) throw IllegalStateException(context.getString(R.string.game_sync_err_game_storage))
val content = SecondaryLibrary.contentPath(File(library.path)).path
for (guest in SecondaryLibrary.CARD_GUESTS) {
File(root, guest.removePrefix("/")).mkdirs()
out += "$content:$guest"
}
}
return StoreInstallRoot.guestBinds(context)
for (folder in AddedGames.roots(context)) {
if (!folder.host.isDirectory || !folder.host.canRead()) continue
File(root, folder.guest.removePrefix("/")).mkdirs()
out += folder.host.path + ":" + folder.guest
}
return out
}
internal fun run(context: Context, args: List<String>, cancelled: AtomicBoolean?, onLine: (String) -> Unit): Int =
@@ -5,9 +5,8 @@ import android.webkit.WebView
import com.droiddeck.launcher.R
import com.droiddeck.launcher.stores.StoreLoginActivity
import org.json.JSONObject
import org.json.JSONTokener
internal class EpicLogin internal constructor(
internal class EpicLogin private constructor(
override val startUrl: String,
override val userAgent: String,
private val redirectPrefix: String,
@@ -16,12 +15,6 @@ internal class EpicLogin internal constructor(
override fun isRedirect(url: String): Boolean = url.startsWith(redirectPrefix)
override fun browserStep(page: String): String? {
val action = correctiveAction(page) ?: return null
Log.i(TAG, "the redirect page asks for a corrective action: $action")
return ACCOUNT_SIGN_IN_URL
}
override fun finish(activity: StoreLoginActivity, view: WebView, url: String): String? {
val code = EpicNative.call("auth.codeFromPage", JSONObject().put("text", url))?.optString("code", "").orEmpty()
if (code.isEmpty()) {
@@ -45,15 +38,6 @@ internal class EpicLogin internal constructor(
companion object {
private const val TAG = "EpicLogin"
private const val CORRECTIVE_ACTION_REQUIRED = "errors.com.epicgames.oauth.corrective_action_required"
internal const val ACCOUNT_SIGN_IN_URL = "https://www.epicgames.com/id/login?redirectUrl=https%3A%2F%2Fwww.epicgames.com%2Faccount%2Fpersonal"
internal fun correctiveAction(page: String): String? {
val text = runCatching { JSONTokener(page).nextValue() }.getOrNull() as? String ?: page
val body = runCatching { JSONObject(text.trim()) }.getOrNull() ?: return null
if (body.optString("errorCode") != CORRECTIVE_ACTION_REQUIRED) return null
return body.optJSONObject("metadata")?.optString("correctiveAction").orEmpty().ifEmpty { "unknown" }
}
fun create(): StoreLoginActivity.Flow? {
val config = EpicNative.call("auth.config") ?: return null
@@ -4,6 +4,7 @@ import android.content.Context;
import android.util.Log;
import com.droiddeck.launcher.frontend.AddedGames;
import com.droiddeck.launcher.runtime.GuestCommand;
import com.droiddeck.launcher.stores.StoreLanguage;
import com.droiddeck.launcher.stores.StoreLog;
import com.droiddeck.launcher.stores.download.StoreDownloadTier;
@@ -270,10 +271,11 @@ public final class GogDownloadManager {
long planned = 0;
boolean sized = true;
for (InstallerPart part : parts) { planned += part.size; if (part.size <= 0) sized = false; }
long needed = installerBytesNeeded(knownPartBytes(parts), GogLibrary.INSTANCE.sizeOf(ctx, game.gameId));
long usable = com.droiddeck.launcher.stores.StoreInstallRoot.availableBytes(installPath);
if (com.droiddeck.launcher.stores.StoreInstallRoot.insufficientSpace(needed, usable)) {
throw new InstallException("Not enough free space: need " + formatBytes(needed) + ", only " + formatBytes(usable) + " free");
if (sized) {
long usable = com.droiddeck.launcher.stores.StoreInstallRoot.availableBytes(installPath);
if (com.droiddeck.launcher.stores.StoreInstallRoot.insufficientSpace(planned, usable)) {
throw new InstallException("Not enough free space: need " + formatBytes(planned) + ", only " + formatBytes(usable) + " free");
}
}
long total = 0;
for (InstallerPart part : parts) {
@@ -325,7 +327,10 @@ public final class GogDownloadManager {
cb.onProgress("Extracting installer…", 95);
int rc;
try {
rc = GogInnoextract.extract(ctx, guestSetup, guestDir, "gog-innoextract", cancelled,
rc = GuestCommand.INSTANCE.run(ctx, Arrays.asList(
"/usr/local/bin/droiddeck-innoextract", "--gog", "--silent",
"-d", guestDir, guestSetup),
false, "gog-innoextract", null, null, false, cancelled, null,
line -> { cb.onLog("gog innoextract: " + line); return kotlin.Unit.INSTANCE; });
} catch (Exception e) {
throw new InstallException("The installer could not be extracted: " + e.getClass().getSimpleName());
@@ -334,16 +339,6 @@ public final class GogDownloadManager {
if (rc != 0) throw new InstallException("The installer could not be extracted (innoextract exit " + rc + ")");
}
static long knownPartBytes(List<InstallerPart> parts) {
long known = 0;
for (InstallerPart part : parts) if (part.size > 0) known += part.size;
return known;
}
static long installerBytesNeeded(long downloadBytes, long installedBytes) {
return Math.max(0, downloadBytes) + Math.max(0, installedBytes);
}
static final class InstallerPart {
final String url;
final String filename;
@@ -1,17 +0,0 @@
package com.droiddeck.launcher.stores.gog
import android.content.Context
import com.droiddeck.launcher.runtime.GuestCommand
import com.droiddeck.launcher.stores.StoreInstallRoot
import java.util.concurrent.atomic.AtomicBoolean
internal object GogInnoextract {
private const val PROGRAM = "/usr/local/bin/droiddeck-innoextract"
@JvmStatic
fun extract(context: Context, setup: String, target: String, logName: String, cancelled: AtomicBoolean, onLine: (String) -> Unit): Int =
GuestCommand.run(context, argv(setup, target), logName = logName,
extraBinds = StoreInstallRoot.guestBinds(context), cancelled = cancelled, onLine = onLine)
internal fun argv(setup: String, target: String): List<String> = listOf(PROGRAM, "--gog", "--silent", "-d", target, setup)
}
@@ -3,9 +3,11 @@ package com.droiddeck.launcher.stores.gog
import android.content.Context
import com.droiddeck.launcher.agent.AgentGuest
import com.droiddeck.launcher.frontend.AddedGames
import com.droiddeck.launcher.runtime.GuestCommand
import com.droiddeck.launcher.session.SessionService
import com.droiddeck.launcher.session.SessionState
import com.droiddeck.launcher.stores.StoreGameSidecar
import com.droiddeck.launcher.stores.StoreInstallRoot
import com.droiddeck.launcher.stores.download.DownloadQueue
import com.droiddeck.launcher.stores.download.DownloadStage
import org.json.JSONArray
@@ -69,7 +71,8 @@ internal object GogOffline {
val source = AddedGames.guestPath(context, installer) ?: error("The GOG installer is not visible to Linux")
val target = AddedGames.guestPath(context, extracted) ?: error("The GOG staging folder is not visible to Linux")
handle.stage(DownloadStage.INSTALL, "Extracting the full offline installer")
val rc = GogInnoextract.extract(context, source, target, "gog-refresh", stop, handle::log)
val rc = GuestCommand.run(context, listOf("/usr/local/bin/droiddeck-innoextract", "--gog", "--silent", "-d", target, source),
extraBinds = StoreInstallRoot.externalBindSpecs(context), cancelled = stop, logName = "gog-refresh", onLine = handle::log)
if (stop.get()) return
check(rc == 0) { "GOG installer extraction failed (exit $rc)" }
applyRefresh(proposal, extracted, handle, stop)
@@ -117,7 +117,6 @@ import com.droiddeck.launcher.IconPack
import android.content.pm.ShortcutInfo
import android.graphics.Bitmap
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.drop
import kotlinx.coroutines.withContext
import com.droiddeck.launcher.HomeWidgets
@@ -389,49 +388,21 @@ internal fun AndroidAppsPage(s: FrontEndState, a: FrontEndActions, modifier: Mod
}
val front = LocalFrontFocus.current
val steer = rememberCoroutineScope()
// The tile a move is heading to, by its id so that a list update cannot shift it, and the number of the latest move.
val aim = remember { arrayOfNulls<String>(1) }
val moves = remember { intArrayOf(0) }
val move = remember { arrayOfNulls<Job>(1) }
// Up and Down go to the tile straight above or below. The grid's own search works from where the tiles are drawn at that
// moment, so while a scroll is still catching up with fast presses it skips a row or drifts a column, and above a short or
// Down goes to the tile straight below. The grid's own search only sees the tiles laid out so far, so above a short or
// unseen last row it lands on a tile further left; above a gap in a short last row the row's last tile takes it.
// Presses aim from the tile a move is already heading to, so none is lost before the focus lands.
Box(Modifier.weight(1f).fillMaxWidth().onPreviewKeyEvent { event ->
val k = event.nativeKeyEvent
val down = k.keyCode == KeyEvent.KEYCODE_DPAD_DOWN
if ((!down && k.keyCode != KeyEvent.KEYCODE_DPAD_UP) || front == null) return@onPreviewKeyEvent false
val aimed = aim[0]?.let { id -> entries.indexOfFirst { tileId(it) == id } } ?: -1
if (aim[0] != null && aimed < 0) {
// The tile a move was heading to has left the list: that move is dropped and the press aims from the focus.
move[0]?.cancel()
aim[0] = null
}
val from = aimed.takeIf { it >= 0 } ?: entries.indexOfFirst { tileId(it) == front.last }
if (k.keyCode != KeyEvent.KEYCODE_DPAD_DOWN || front == null) return@onPreviewKeyEvent false
val from = entries.indexOfFirst { tileId(it) == front.last }
val columns = (grid.layoutInfo.visibleItemsInfo.maxOfOrNull { it.column } ?: 0) + 1
if (from < 0) return@onPreviewKeyEvent false
// At the first or last row the press leaves the grid, unless a move has not landed yet: then it waits for it.
val edge = if (down) from / columns == entries.lastIndex / columns else from < columns
if (edge) return@onPreviewKeyEvent aim[0] != null
if (from < 0 || from / columns == entries.lastIndex / columns) return@onPreviewKeyEvent false
if (k.action == KeyEvent.ACTION_DOWN) {
val to = if (down) minOf(from + columns, entries.lastIndex) else from - columns
val id = tileId(entries[to])
aim[0] = id
val mine = ++moves[0]
// A newer move replaces the one still on its way, so an older target cannot take focus after it lands.
move[0]?.cancel()
move[0] = steer.launch {
try {
// Show the row before it takes focus. The grid composes rows ahead of the view without placing them, and a
// tile focused there neither scrolls in nor has a place for the next search to start from.
grid.reveal(to + leadItems)
if (moves[0] != mine) return@launch
focusSoon { front.items.getValue(id) }
} finally {
// Also when a touch scroll cancels the reveal, so the edge rows do not keep waiting for a move that ended.
// Only the latest move clears it: a cancelled one finishing late must not clear a newer move's target.
if (moves[0] == mine) aim[0] = null
}
val id = tileId(entries[minOf(from + columns, entries.lastIndex)])
val shown = (front.attached[id] ?: 0) > 0
if (!shown || runCatching { front.items.getValue(id).requestFocus() }.isFailure) steer.launch {
// The row below is not laid out yet: bring it in, then take it.
if (!shown) grid.scrollBy((grid.layoutInfo.visibleItemsInfo.firstOrNull { it.index == from + leadItems }?.size?.height ?: 0).toFloat())
focusSoon { front.items.getValue(id) }
}
}
true
@@ -587,26 +558,6 @@ private fun HeaderChoiceButton(
}
}
/** Scrolls the least that shows item [index] whole inside the padding, a row at a time while it is still outside the laid out items. */
private suspend fun LazyGridState.reveal(index: Int) {
repeat(4) {
val info = layoutInfo
val shown = info.visibleItemsInfo
val item = shown.firstOrNull { it.index == index }
val by = when {
item != null -> {
val bottom = item.offset.y + item.size.height - (info.viewportEndOffset - info.afterContentPadding)
if (item.offset.y < 0) item.offset.y else maxOf(bottom, 0)
}
index > (shown.lastOrNull() ?: return).index -> shown.last().size.height
index < shown.first().index -> -shown.first().size.height
else -> return
}
if (by == 0) return
scrollBy(by.toFloat())
}
}
@Composable
private fun AlphabetScroller(entries: List<AppEntry>, grid: LazyGridState, leadItems: Int, modifier: Modifier) {
val colors = MaterialTheme.colorScheme
@@ -526,11 +526,11 @@ fun ComponentsPage(
val availableTitle: @Composable (String) -> String = { l ->
when (l) {
PROTON_TAB -> stringResource(R.string.comp_available_count, protons.rows.count(ProtonRow::available))
else -> stringResource(R.string.comp_nightlies_count, availableRows(l, catalog, snapshot, view?.proton?.dir?.name).size)
else -> stringResource(R.string.comp_nightlies_count, availableRows(l, catalog, snapshot).size)
}
}
val followed: (String) -> Boolean = { l -> view?.proton?.let { ComponentUpdates.autoFollows(it, l) } == true }
val moded: (String) -> Boolean = { followed(it) && it in compModes && it !in compAutoHeld && !ComponentsManager.runtimeManaged(it, gpu.systemPowerVr) }
val followed = view?.proton?.let(ComponentUpdates::follows) == true
val moded: (String) -> Boolean = { followed && it in compModes && it !in compAutoHeld && !ComponentsManager.runtimeManaged(it, gpu.systemPowerVr) }
val automatic: (String) -> Boolean = { moded(it) && compModes[it] == ComponentUpdates.AUTO }
val installedRows: @Composable ColumnScope.(String, Boolean) -> Unit = { l, right ->
when (l) {
@@ -614,7 +614,7 @@ fun ComponentsPage(
}
}
else -> {
val available = availableRows(l, catalog, snapshot, view?.proton?.dir?.name)
val available = availableRows(l, catalog, snapshot)
if (available.isEmpty()) EmptyLine(if (catalogAt == 0L) stringResource(R.string.comp_refresh_to_list) else stringResource(R.string.comp_nothing_new))
for ((stable, nightly) in available) {
val d = if (nightly != null && nightlyPicked[stable.file] == true) nightly else stable
@@ -974,18 +974,18 @@ private fun installedFor(l: String, view: ComponentsManager.ProtonView?, snapsho
o.label.substringAfterLast(" · ", "").ifEmpty { o.label }.let { if (isCurrent) stringResource(R.string.comp_this_build, it) else stringResource(R.string.comp_earlier_build, it) },
"ORIGINAL", activeIsOriginal && isCurrent, !isCurrent, null, o.protonVersion,
)
} + ComponentsManager.forTool(l, view.proton.dir.name, (snapshot?.packages ?: emptyList()).filter { it.comp == l }, st.activeFile) { it.file }.map { s ->
} + (snapshot?.packages ?: emptyList()).filter { it.comp == l }.map { s ->
InstalledItem(s.version, stringResource(R.string.common_size_mb, s.size / 1048576.0), "STORED", !runtimeManaged && s.file == st.activeFile, true, s.file, null)
}
}
private fun availableFor(l: String, catalog: List<CatalogItem>, snapshot: Snapshot?, toolDir: String?): List<CatalogItem> {
private fun availableFor(l: String, catalog: List<CatalogItem>, snapshot: Snapshot?): List<CatalogItem> {
val stored = (snapshot?.packages ?: emptyList()).map { it.file }.toSet()
return ComponentsManager.forTool(l, toolDir, catalog.filter { it.comp == l && ComponentsManager.safeName(it.file) !in stored }) { it.file }
return catalog.filter { it.comp == l && ComponentsManager.safeName(it.file) !in stored }
}
private fun availableRows(l: String, catalog: List<CatalogItem>, snapshot: Snapshot?, toolDir: String?): List<Pair<CatalogItem, CatalogItem?>> {
val available = availableFor(l, catalog, snapshot, toolDir)
private fun availableRows(l: String, catalog: List<CatalogItem>, snapshot: Snapshot?): List<Pair<CatalogItem, CatalogItem?>> {
val available = availableFor(l, catalog, snapshot)
val pairs = ComponentsManager.nightlyPairs(available)
val paired = pairs.values.toSet()
return available.filter { it !in paired }.map { it to pairs[it] }
@@ -1201,7 +1201,7 @@ private fun GameComponentOverrides(
}
GamePackageRow(
comp = "fex",
packages = ComponentsManager.forTool("fex", protonChoice?.dir ?: generalProton?.dir?.name, packages, componentChoices["fex"]) { it.file },
packages = packages,
selectedFile = componentChoices["fex"],
open = componentMenu == "fex",
busy = busy,
@@ -60,8 +60,7 @@ import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.droiddeck.launcher.R
import com.droiddeck.launcher.files.StorageRoot
import com.droiddeck.launcher.files.StorageRoots
import com.droiddeck.launcher.session.GameStorage
import com.droiddeck.launcher.stores.formatBytes
import java.io.File
@@ -75,16 +74,10 @@ internal class PickVolume(val root: File, val label: String, val removable: Bool
}
internal fun pickVolumes(context: Context): List<PickVolume> =
pickVolumes(Environment.getExternalStorageDirectory(), context.getString(R.string.games_internal), StorageRoots.list(context))
internal fun pickVolumes(internal: File, internalLabel: String, roots: List<StorageRoot>): List<PickVolume> {
val internalPath = internal.absolutePath.trimEnd('/')
fun overlapsInternal(path: String) = path == internalPath || path.startsWith("$internalPath/") || internalPath.startsWith("$path/")
return listOf(PickVolume(internal, internalLabel, removable = false)) +
roots.filter { it.readable && !overlapsInternal(it.dir.absolutePath.trimEnd('/')) }
.map { PickVolume(it.dir, it.label, removable = true) }
.distinctBy { it.root.absolutePath }
}
listOf(PickVolume(Environment.getExternalStorageDirectory(), context.getString(R.string.games_internal), removable = false)) +
GameStorage.options(context).mapNotNull { o ->
File(o.path.substringBefore("/Android/")).takeIf { it.isDirectory }?.let { PickVolume(it, o.name, removable = true) }
}.distinctBy { it.root.absolutePath }
internal class PickFolder(val dir: File, val readable: Boolean)
@@ -58,7 +58,6 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.snapshotFlow
import androidx.compose.runtime.withFrameNanos
import kotlinx.coroutines.launch
import kotlinx.coroutines.flow.first
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
@@ -103,7 +102,6 @@ class FrontEndState(
val desktopPresent: Boolean = desktopInstalled,
val offlineAccount: String?,
val offline: Boolean,
val offlineAuto: Boolean = true,
val frameGenLabel: String,
val romsDir: String?,
val logsEnabled: Boolean,
@@ -274,7 +272,6 @@ class FrontEndActions(
val onClearLogs: () -> Unit = {},
val onResetSettings: () -> Unit = {},
val onOffline: () -> Unit,
val onOfflineAuto: () -> Unit = {},
val onPageBack: () -> Unit = {},
val onTheme: (String) -> Unit = {},
val onLanguage: (String) -> Unit = {},
@@ -767,31 +764,12 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
focusManager.clearFocus(force = true)
onRailSelect(key)
}, a)
val stepScope = androidx.compose.runtime.rememberCoroutineScope()
val pageKeyNow = androidx.compose.runtime.rememberUpdatedState(s.pageKey)
var railHold by remember { mutableStateOf<kotlinx.coroutines.Job?>(null) }
val tabStep = androidx.compose.runtime.rememberUpdatedState { step: Int ->
if (!processSettingsPageVisible) {
val keys = navigationKeys(s)
keys.getOrNull(keys.indexOf(railSelectionNow.value) + step)?.let { key ->
PageSwipe.direction = step
if (s.dualScreen) { onRailSelect(key); return@let }
showRailPage(key, false)
if (inputModeManager.inputMode != InputMode.Keyboard) inputModeManager.requestInputMode(InputMode.Keyboard)
val since = MainTabSteps.otherKeys
val owner = selected
val ownPage = if (key == "components") "components" else null
railHold?.cancel()
// Pages focus their own first control as they appear; the ring stays on the rail until another key moves it.
railHold = stepScope.launch {
var pageShown = false
repeat(RAIL_HOLD_FRAMES) {
withFrameNanos { }
if (MainTabSteps.otherKeys != since || selected != owner) return@launch
if (pageKeyNow.value == ownPage) pageShown = true else if (pageShown) return@launch
if (frontFocus.focusedRail != key) runCatching { frontFocus.railFor(key).requestFocus() }
}
}
onRailSelect(key)
}
}
}
@@ -922,7 +900,4 @@ internal object ChildProcessSetup {
internal object MainTabSteps {
@Volatile var handler: ((Int) -> Unit)? = null
@Volatile var otherKeys = 0
}
private const val RAIL_HOLD_FRAMES = 60
@@ -1098,6 +1098,8 @@ internal fun GameSettingsMenus(host: MenuHost, game: com.droiddeck.launcher.fron
internal const val GAME_SETTINGS_MENU = "game-settings"
private const val EPIC_RESOLVE_URL = "https://www.epicgames.com/id/login?redirectUrl=https%3A%2F%2Fwww.epicgames.com%2Faccount%2Fpersonal"
@Composable
private fun StoreLaunchCard(host: MenuHost, folder: java.io.File, store: com.droiddeck.launcher.stores.Store) {
val appContext = androidx.compose.ui.platform.LocalContext.current.applicationContext
@@ -1147,7 +1149,7 @@ private fun StoreLaunchCard(host: MenuHost, folder: java.io.File, store: com.dro
MenuItem(stringResource(R.string.epic_resolve), checked = false) {
host.open = null
runCatching {
appContext.startActivity(android.content.Intent(android.content.Intent.ACTION_VIEW, android.net.Uri.parse(com.droiddeck.launcher.stores.epic.EpicLogin.ACCOUNT_SIGN_IN_URL)).addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK))
appContext.startActivity(android.content.Intent(android.content.Intent.ACTION_VIEW, android.net.Uri.parse(EPIC_RESOLVE_URL)).addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK))
}
}
}
@@ -38,10 +38,8 @@ import com.droiddeck.launcher.input.InputButtonShape
import com.droiddeck.launcher.input.InputButtonImages
import com.droiddeck.launcher.input.PadBridge
import com.droiddeck.launcher.input.PadKit
import com.droiddeck.launcher.input.ThrottledRedraw
import com.droiddeck.launcher.input.pcKeyLabel
import com.droiddeck.launcher.session.SessionPrefs
import kotlin.math.abs
import kotlin.math.atan2
import kotlin.math.hypot
import kotlin.math.min
@@ -583,10 +581,6 @@ class InputSurfaceView(
private var originY = 0f
private var knobX = 0f
private var knobY = 0f
private var drawnX = 0f
private var drawnY = 0f
private var atRim = false
private val redraw = ThrottledRedraw(this, STICK_REDRAW_MS)
private val ring = Paint(Paint.ANTI_ALIAS_FLAG).apply { style = Paint.Style.STROKE }
private val knob = Paint(Paint.ANTI_ALIAS_FLAG)
@@ -669,7 +663,6 @@ class InputSurfaceView(
MotionEvent.ACTION_MOVE -> follow(event.getX(0), event.getY(0), r)
MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> {
touching = false
atRim = false
val cancelled = event.actionMasked == MotionEvent.ACTION_CANCEL || event.flags and MotionEvent.FLAG_CANCELED != 0
travel = maxOf(travel, hypot(event.x - downX, event.y - downY))
lastUp = if (!clicking && !cancelled && event.eventTime - downAt <= STICK_TAP_MS && travel <= tapSlop) event.eventTime else 0L
@@ -685,27 +678,15 @@ class InputSurfaceView(
var dx = x - originX
var dy = y - originY
val length = hypot(dx, dy)
val rim = length > r
if (rim) { dx *= r / length; dy *= r / length }
val reachedRim = rim && !atRim
atRim = rim
if (force || dx != knobX || dy != knobY) move(dx, dy, r, throttled = !force && !reachedRim, rim = rim)
if (length > r) { dx *= r / length; dy *= r / length }
if (force || dx != knobX || dy != knobY) move(dx, dy, r)
}
private fun move(dx: Float, dy: Float, r: Float, throttled: Boolean = false, rim: Boolean = false) {
private fun move(dx: Float, dy: Float, r: Float) {
knobX = dx
knobY = dy
source?.update(dx / r, dy / r)
if (!throttled) {
redraw.cancel()
drawnX = dx
drawnY = dy
invalidate()
} else if (rim || abs(dx - drawnX) >= MIN_STICK_MOVE_PX || abs(dy - drawnY) >= MIN_STICK_MOVE_PX) {
drawnX = dx
drawnY = dy
redraw.request()
}
invalidate()
}
private fun setClick(down: Boolean) {
@@ -718,7 +699,6 @@ class InputSurfaceView(
override fun onDetachedFromWindow() {
setClick(false)
if (knobX != 0f || knobY != 0f) move(0f, 0f, 1f)
redraw.cancel()
super.onDetachedFromWindow()
}
}
@@ -786,8 +766,6 @@ class InputSurfaceView(
companion object {
private const val CLICK_MS = 300L
private const val STICK_TAP_MS = 200L
private const val STICK_REDRAW_MS = 33L
private const val MIN_STICK_MOVE_PX = 1f
private const val CLASSIC_REACH = 0.5f
private const val PANEL_REACH = 0.30f
private const val HIT_SLACK = 0.25f
@@ -93,7 +93,6 @@ class ModeSettings(
val steamClientArch: String? = null,
val returnAfterGame: Boolean? = null,
val shaderPrecache: Boolean? = null,
val valveProtonOnDemand: Boolean? = null,
val steamRepairQueued: Boolean = false,
val mangoapp: Boolean = true,
val steamController: String? = null,
@@ -159,7 +158,6 @@ class ModeSettingsActions(
val onMangoapp: (Boolean) -> Unit = {},
val onReturnAfterGame: (Boolean) -> Unit = {},
val onShaderPrecache: (Boolean) -> Unit = {},
val onValveProtonOnDemand: (Boolean) -> Unit = {},
val onSteamController: (String) -> Unit = {},
val onUnfoldedControls: (Boolean) -> Unit = {},
val onUnfoldedControlsWithController: (Boolean) -> Unit = {},
@@ -536,10 +534,6 @@ fun ModeSheetRows(s: ModeSettings, a: ModeSettingsActions, tab: String, extras:
stringResource(R.string.mode_shader_precache_hint),
s.shaderPrecache, onChange = a.onShaderPrecache,
)
if (s.valveProtonOnDemand != null) ToggleRow(
host, "valveprotonondemand", stringResource(R.string.mode_valve_proton_on_demand), null,
s.valveProtonOnDemand, onChange = a.onValveProtonOnDemand,
)
SettingsRow(
stringResource(R.string.mode_steam_repair),
stringResource(if (s.steamRepairQueued) R.string.mode_steam_repair_queued else R.string.mode_steam_repair_hint),
@@ -27,9 +27,9 @@ internal object DeveloperTools {
internal object NavTabs {
const val MORE = "more"
val ALL = listOf("steam", "desktop", "games", "downloads", "setup", "updates", "stores", "soundtracks", "components", "storage", "sync", "decky", "boot-movies", "android-apps", "agent")
val DEFAULT_SHELVED = setOf("soundtracks", "components", "storage", "sync", "decky", "boot-movies", "agent")
val DEFAULT_SHELVED = setOf("soundtracks", "components", "storage", "sync", "decky", "boot-movies", "android-apps", "agent")
val DEFAULT_HIDDEN = setOf("android-apps", "agent")
private val SHELVED_WHEN_NEW = setOf("storage", "sync", "decky", "boot-movies", "agent")
private val SHELVED_WHEN_NEW = setOf("storage", "sync", "decky", "boot-movies", "android-apps", "agent")
private val OLD_ORDER = listOf("steam", "games", "soundtracks", "stores", "downloads", "desktop", "agent", "components", "android-apps", "storage", "sync", "setup", "updates")
private val OLD_SHELVED = setOf("soundtracks", "agent", "storage", "sync")
private const val LAYOUT_VERSION = 2
@@ -95,15 +95,6 @@ internal object NavTabs {
else -> true
}
// Apps only has content when DroidDeck is the home app, so it follows that state on each change and
// otherwise stays wherever the user put it.
fun syncHomeApps(context: Context, homeSelected: Boolean) {
val seen = SessionPrefs.appsTabHomeSeen(context)
SessionPrefs.setAppsTabHomeSeen(context, homeSelected)
if (seen == homeSelected || (seen == null && !homeSelected)) return
setHidden(context, "android-apps", !homeSelected)
}
fun hideable(key: String) = key != "setup"
fun place(s: FrontEndState, key: String): TabPlace = when {
@@ -1787,15 +1787,12 @@ private fun ComponentsDrawerPage(host: MenuHost, a: DrawerActions, track: (Strin
chipModifier = track("cmp-proton"),
onPick = { id -> a.onGameProton(gameProfile.appId, id) },
)
val gameTool = snap.protons.firstOrNull { it.proton.id == gameProfile.protonId }?.proton?.dir?.name
for (comp in ComponentsManager.COMPONENTS) {
val value = gameProfile.components.getValue(comp)
val managedDxvk = ComponentsManager.runtimeManaged(comp, a.systemPowerVr)
val options: List<Pair<String?, String>> =
listOf(null to stringResource(R.string.comp_game_use_general)) +
if (managedDxvk) emptyList() else ComponentsManager.forTool(
comp, gameTool, snap.packages.filter { it.comp == comp }, gameProfile.componentFiles[comp],
) { it.file }.map { it.file to it.version }
if (managedDxvk) emptyList() else snap.packages.filter { it.comp == comp }.map { it.file to it.version }
DrawerStackedChoice(
host = host,
key = "game-cmp-$comp",
@@ -1878,7 +1875,7 @@ private fun ComponentsDrawerPage(host: MenuHost, a: DrawerActions, track: (Strin
val managedDxvk = ComponentsManager.runtimeManaged(comp, a.systemPowerVr)
val originals = view.originals.filter { it.comp == comp }
val options = originals.map { "orig:${it.protonVersion}" to (if (it.protonVersion == build) originalLabel else stringResource(R.string.comp_original, it.protonVersion)) } +
ComponentsManager.forTool(comp, p.dir.name, snap.packages.filter { it.comp == comp }, st.activeFile) { it.file }.map { it.file to it.version }
snap.packages.filter { it.comp == comp }.map { it.file to it.version }
if (options.isEmpty() && !managedDxvk) continue
val current = st.activeFile ?: "orig:$build"
val shown = options.firstOrNull { it.first == current }?.second
@@ -115,11 +115,10 @@ internal fun SteamHome(s: FrontEndState, a: FrontEndActions, modifier: Modifier)
account = { host ->
SettingsGroup(stringResource(R.string.setup_account)) {
ToggleRow(
host, "offline-auto", stringResource(R.string.setup_offline_auto),
host, "offline", stringResource(R.string.setup_offline),
s.offlineAccount?.let { if (it.isEmpty()) stringResource(R.string.setup_signed_in_unnamed) else stringResource(R.string.setup_signed_in, it) } ?: stringResource(R.string.setup_sign_in_first),
s.offlineAuto, enabled = s.offlineAccount != null,
) { a.onOfflineAuto() }
if (!s.offlineAuto) ToggleRow(host, "offline", stringResource(R.string.setup_offline), null, s.offline, enabled = s.offlineAccount != null) { a.onOffline() }
s.offline, enabled = s.offlineAccount != null,
) { a.onOffline() }
}
},
)
@@ -84,7 +84,7 @@ object CompositorHost {
com.droiddeck.launcher.gpu.TpUbwcHint.applyToProcess(context)
WaylandCompositor.nativeStartWithSurface(
surface, xdgRuntimeDir, driverPath, libraryName, nativeLibDir,
SessionPrefs.displayDriverFromAuto(context),
SessionPrefs.androidDriver(context).isEmpty(),
)
attached = surface
started = true
-2
View File
@@ -934,7 +934,6 @@
<string name="setup_reset_settings_session_running">أوقف الجلسة قبل إعادة تعيين الإعدادات.</string>
<string name="setup_reset_settings_partial">أُعيد تعيين الإعدادات، لكن ليس كلها. التفاصيل في السجلات.</string>
<string name="setup_offline">وضع عدم الاتصال</string>
<string name="setup_offline_auto">وضع عدم الاتصال التلقائي</string>
<string name="setup_sign_in_first">سجّل الدخول إلى Steam أولًا</string>
<string name="setup_launcher">المشغّل</string>
<string name="setup_language">اللغة</string>
@@ -2819,7 +2818,6 @@
<string name="stores_login_error_ssl">الاتصال بصفحة تسجيل الدخول غير آمن.</string>
<string name="stores_login_error_verification">تعذّر التحقّق من تسجيل الدخول. حاوِل مرة أخرى.</string>
<string name="stores_login_error_generic">فشل تسجيل الدخول. حاوِل مرة أخرى.</string>
<string name="stores_login_continue_in_browser">يحتاج %1$s إلى خطوة أخرى. أكملها في المتصفح الذي فُتح، ثم حاول مرة أخرى.</string>
<string name="common_close">إغلاق</string>
<string name="common_back">رجوع</string>
<string name="common_edit">تعديل</string>
@@ -952,7 +952,6 @@
<string name="setup_reset_settings_session_running">Detén la sesión antes de restablecer los ajustes.</string>
<string name="setup_reset_settings_partial">Los ajustes se restablecieron, pero algunas partes no se pudieron restablecer. Los registros tienen los detalles.</string>
<string name="setup_offline">Modo sin conexión</string>
<string name="setup_offline_auto">Modo sin conexión automático</string>
<string name="setup_sign_in_first">Inicia sesión en Steam primero</string>
<string name="setup_launcher">Launcher</string>
<string name="setup_language">Idioma</string>
@@ -2785,7 +2784,6 @@
<string name="stores_login_error_ssl">La conexión con la página de inicio de sesión no es segura.</string>
<string name="stores_login_error_verification">No se pudo verificar el inicio de sesión. Inténtalo de nuevo.</string>
<string name="stores_login_error_generic">No se pudo iniciar sesión. Inténtalo de nuevo.</string>
<string name="stores_login_continue_in_browser">%1$s necesita un paso más. Complétalo en el navegador que se abrió y vuelve a intentarlo.</string>
<string name="common_close">Cerrar</string>
<string name="common_back">Atrás</string>
<string name="common_edit">Editar</string>
-2
View File
@@ -922,7 +922,6 @@
<string name="setup_reset_settings_session_running">Спри сесията, преди да нулираш настройките.</string>
<string name="setup_reset_settings_partial">Настройките са нулирани, но не всички. Подробностите са в логовете.</string>
<string name="setup_offline">Офлайн режим</string>
<string name="setup_offline_auto">Автоматичен офлайн режим</string>
<string name="setup_sign_in_first">Първо влезте в Steam</string>
<string name="setup_launcher">Лаунчър</string>
<string name="setup_language">Език</string>
@@ -2715,7 +2714,6 @@
<string name="stores_login_error_ssl">Връзката със страницата за вход не е защитена.</string>
<string name="stores_login_error_verification">Входът не можа да бъде потвърден. Опитай отново.</string>
<string name="stores_login_error_generic">Входът се провали. Опитай отново.</string>
<string name="stores_login_continue_in_browser">%1$s изисква още една стъпка. Завърши я в браузъра, който се отвори, и опитай отново.</string>
<string name="common_close">Затвори</string>
<string name="common_back">Назад</string>
<string name="common_edit">Редактирай</string>
-2
View File
@@ -928,7 +928,6 @@
<string name="setup_reset_settings_session_running">Před obnovením nastavení zastav relaci.</string>
<string name="setup_reset_settings_partial">Nastavení byla obnovena, ale ne všechna. Podrobnosti jsou v logech.</string>
<string name="setup_offline">Režim offline</string>
<string name="setup_offline_auto">Automatický režim offline</string>
<string name="setup_sign_in_first">Nejprve se přihlaste ke Steamu</string>
<string name="setup_launcher">Spouštěč</string>
<string name="setup_language">Jazyk</string>
@@ -2767,7 +2766,6 @@
<string name="stores_login_error_ssl">Spojení s přihlašovací stránkou není zabezpečené.</string>
<string name="stores_login_error_verification">Přihlášení se nepodařilo ověřit. Zkuste to znovu.</string>
<string name="stores_login_error_generic">Přihlášení se nezdařilo. Zkuste to znovu.</string>
<string name="stores_login_continue_in_browser">%1$s vyžaduje ještě jeden krok. Dokončete ho v prohlížeči, který se otevřel, a zkuste to znovu.</string>
<string name="common_close">Zavřít</string>
<string name="common_back">Zpět</string>
<string name="common_edit">Upravit</string>
-2
View File
@@ -922,7 +922,6 @@
<string name="setup_reset_settings_session_running">Stop sessionen, før du nulstiller indstillinger.</string>
<string name="setup_reset_settings_partial">Indstillingerne blev nulstillet, men ikke alle. Detaljerne står i loggen.</string>
<string name="setup_offline">Offlinetilstand</string>
<string name="setup_offline_auto">Automatisk offlinetilstand</string>
<string name="setup_sign_in_first">Log ind på Steam først</string>
<string name="setup_launcher">Launcher</string>
<string name="setup_language">Sprog</string>
@@ -2715,7 +2714,6 @@
<string name="stores_login_error_ssl">Forbindelsen til loginsiden er ikke sikker.</string>
<string name="stores_login_error_verification">Login kunne ikke bekræftes. Forsøg igen.</string>
<string name="stores_login_error_generic">Login mislykkedes. Forsøg igen.</string>
<string name="stores_login_continue_in_browser">%1$s kræver et trin mere. Fuldfør det i browseren, der blev åbnet, og prøv igen.</string>
<string name="common_close">Luk</string>
<string name="common_back">Tilbage</string>
<string name="common_edit">Rediger</string>
-2
View File
@@ -914,7 +914,6 @@
<string name="setup_log_export_failed">Sitzungsprotokolle konnten nicht gespeichert werden.</string>
<string name="setup_log_delete_failed">Sitzungsprotokolle konnten nicht gelöscht werden.</string>
<string name="setup_offline">Offlinemodus</string>
<string name="setup_offline_auto">Automatischer Offlinemodus</string>
<string name="setup_sign_in_first">Melde dich zuerst bei Steam an</string>
<string name="setup_launcher">Launcher</string>
<string name="setup_language">Sprache</string>
@@ -2704,7 +2703,6 @@
<string name="stores_login_error_ssl">Die Verbindung zur Anmeldeseite ist nicht sicher.</string>
<string name="stores_login_error_verification">Die Anmeldung konnte nicht bestätigt werden. Versuche es erneut.</string>
<string name="stores_login_error_generic">Anmeldung fehlgeschlagen. Versuche es erneut.</string>
<string name="stores_login_continue_in_browser">%1$s braucht noch einen Schritt. Schließe ihn im geöffneten Browser ab und versuche es dann erneut.</string>
<string name="common_close">Schließen</string>
<string name="common_back">Zurück</string>
<string name="common_edit">Bearbeiten</string>
-2
View File
@@ -922,7 +922,6 @@
<string name="setup_reset_settings_session_running">Σταμάτησε τη συνεδρία πριν κάνεις επαναφορά ρυθμίσεων.</string>
<string name="setup_reset_settings_partial">Οι ρυθμίσεις επαναφέρθηκαν, αλλά όχι όλες. Οι λεπτομέρειες είναι στα αρχεία καταγραφής.</string>
<string name="setup_offline">Λειτουργία εκτός σύνδεσης</string>
<string name="setup_offline_auto">Αυτόματη λειτουργία εκτός σύνδεσης</string>
<string name="setup_sign_in_first">Συνδεθείτε πρώτα στο Steam</string>
<string name="setup_launcher">Εκκινητής</string>
<string name="setup_language">Γλώσσα</string>
@@ -2715,7 +2714,6 @@
<string name="stores_login_error_ssl">Η σύνδεση με τη σελίδα σύνδεσης δεν είναι ασφαλής.</string>
<string name="stores_login_error_verification">Δεν ήταν δυνατή η επαλήθευση της σύνδεσης. Δοκιμάστε ξανά.</string>
<string name="stores_login_error_generic">Η σύνδεση απέτυχε. Δοκιμάστε ξανά.</string>
<string name="stores_login_continue_in_browser">Το %1$s χρειάζεται ένα ακόμη βήμα. Ολοκληρώστε το στο πρόγραμμα περιήγησης που άνοιξε και δοκιμάστε ξανά.</string>
<string name="common_close">Κλείσιμο</string>
<string name="common_back">Πίσω</string>
<string name="common_edit">Επεξεργασία</string>
-2
View File
@@ -925,7 +925,6 @@
<string name="setup_reset_settings_session_running">Detén la sesión antes de restablecer los ajustes.</string>
<string name="setup_reset_settings_partial">Los ajustes se restablecieron, pero algunas partes no se pudieron restablecer. Los registros tienen los detalles.</string>
<string name="setup_offline">Modo sin conexión</string>
<string name="setup_offline_auto">Modo sin conexión automático</string>
<string name="setup_sign_in_first">Inicia sesión en Steam primero</string>
<string name="setup_launcher">Launcher</string>
<string name="setup_language">Idioma</string>
@@ -2738,7 +2737,6 @@
<string name="stores_login_error_ssl">La conexión con la página de inicio de sesión no es segura.</string>
<string name="stores_login_error_verification">No se pudo verificar el inicio de sesión. Inténtalo de nuevo.</string>
<string name="stores_login_error_generic">No se pudo iniciar sesión. Inténtalo de nuevo.</string>
<string name="stores_login_continue_in_browser">%1$s necesita un paso más. Complétalo en el navegador que se abrió y vuelve a intentarlo.</string>
<string name="common_close">Cerrar</string>
<string name="common_back">Atrás</string>
<string name="common_edit">Editar</string>
-2
View File
@@ -922,7 +922,6 @@
<string name="setup_reset_settings_session_running">Pysäytä istunto ennen asetusten palauttamista.</string>
<string name="setup_reset_settings_partial">Asetukset palautettiin, mutta ei kaikkia. Tiedot ovat lokeissa.</string>
<string name="setup_offline">Offline-tila</string>
<string name="setup_offline_auto">Automaattinen offline-tila</string>
<string name="setup_sign_in_first">Kirjaudu Steamiin ensin</string>
<string name="setup_launcher">Käynnistin</string>
<string name="setup_language">Kieli</string>
@@ -2715,7 +2714,6 @@
<string name="stores_login_error_ssl">Yhteys kirjautumissivulle ei ole suojattu.</string>
<string name="stores_login_error_verification">Kirjautumista ei voitu vahvistaa. Yritä uudelleen.</string>
<string name="stores_login_error_generic">Kirjautuminen epäonnistui. Yritä uudelleen.</string>
<string name="stores_login_continue_in_browser">%1$s vaatii vielä yhden vaiheen. Viimeistele se avautuneessa selaimessa ja yritä sitten uudelleen.</string>
<string name="common_close">Sulje</string>
<string name="common_back">Takaisin</string>
<string name="common_edit">Muokkaa</string>
-2
View File
@@ -925,7 +925,6 @@
<string name="setup_reset_settings_session_running">Arrêtez la session avant de réinitialiser les paramètres.</string>
<string name="setup_reset_settings_partial">Les paramètres ont été réinitialisés, mais certaines parties n\'ont pas pu l\'être. Les journaux contiennent les détails.</string>
<string name="setup_offline">Mode hors ligne</string>
<string name="setup_offline_auto">Mode hors ligne automatique</string>
<string name="setup_sign_in_first">Veuillez d\'abord vous connecter à Steam</string>
<string name="setup_launcher">Lanceur</string>
<string name="setup_language">Langue</string>
@@ -2737,7 +2736,6 @@
<string name="stores_login_error_ssl">La liaison avec la page de connexion n\'est pas sécurisée.</string>
<string name="stores_login_error_verification">Impossible de vérifier la connexion. Réessayez.</string>
<string name="stores_login_error_generic">Échec de la connexion. Réessayez.</string>
<string name="stores_login_continue_in_browser">%1$s demande une étape de plus. Terminez-la dans le navigateur qui s\'est ouvert, puis réessayez.</string>
<string name="common_close">Fermer</string>
<string name="common_back">Retour</string>
<string name="common_edit">Modifier</string>
-2
View File
@@ -922,7 +922,6 @@
<string name="setup_reset_settings_session_running">सेटिंग रीसेट करने से पहले सेशन रोकें।</string>
<string name="setup_reset_settings_partial">सेटिंग रीसेट हुईं, पर सभी नहीं। विवरण लॉग में हैं।</string>
<string name="setup_offline">ऑफ़लाइन मोड</string>
<string name="setup_offline_auto">स्वचालित ऑफ़लाइन मोड</string>
<string name="setup_sign_in_first">पहले Steam में साइन इन करें</string>
<string name="setup_launcher">लॉन्चर</string>
<string name="setup_language">भाषा</string>
@@ -2715,7 +2714,6 @@
<string name="stores_login_error_ssl">साइन-इन पेज से कनेक्शन सुरक्षित नहीं है।</string>
<string name="stores_login_error_verification">साइन-इन सत्यापित नहीं हो सका। फिर कोशिश करें।</string>
<string name="stores_login_error_generic">साइन-इन विफल रहा। फिर कोशिश करें।</string>
<string name="stores_login_continue_in_browser">%1$s को एक और चरण चाहिए। खुले हुए ब्राउज़र में इसे पूरा करें, फिर दोबारा कोशिश करें।</string>
<string name="common_close">बंद करें</string>
<string name="common_back">बैक</string>
<string name="common_edit">संपादित करें</string>
-2
View File
@@ -922,7 +922,6 @@
<string name="setup_reset_settings_session_running">A beállítások visszaállítása előtt állítsd le a munkamenetet.</string>
<string name="setup_reset_settings_partial">A beállítások visszaálltak, de nem mindegyik. A részletek a naplókban vannak.</string>
<string name="setup_offline">Offline mód</string>
<string name="setup_offline_auto">Automatikus offline mód</string>
<string name="setup_sign_in_first">Előbb jelentkezzen be a Steambe</string>
<string name="setup_launcher">Indítóalkalmazás</string>
<string name="setup_language">Nyelv</string>
@@ -2715,7 +2714,6 @@
<string name="stores_login_error_ssl">A kapcsolat a bejelentkezési oldalhoz nem biztonságos.</string>
<string name="stores_login_error_verification">A bejelentkezést nem sikerült ellenőrizni. Próbálja újra.</string>
<string name="stores_login_error_generic">A bejelentkezés sikertelen. Próbálja újra.</string>
<string name="stores_login_continue_in_browser">A(z) %1$s még egy lépést kér. Fejezze be a megnyílt böngészőben, majd próbálja újra.</string>
<string name="common_close">Bezárás</string>
<string name="common_back">Vissza</string>
<string name="common_edit">Szerkesztés</string>
-2
View File
@@ -919,7 +919,6 @@
<string name="setup_reset_settings_session_running">Hentikan sesi sebelum menyetel ulang setelan.</string>
<string name="setup_reset_settings_partial">Setelan disetel ulang, tetapi tidak semuanya. Rinciannya ada di log.</string>
<string name="setup_offline">Mode luring</string>
<string name="setup_offline_auto">Mode luring otomatis</string>
<string name="setup_sign_in_first">Masuk ke Steam terlebih dahulu</string>
<string name="setup_launcher">Peluncur</string>
<string name="setup_language">Bahasa</string>
@@ -2690,7 +2689,6 @@
<string name="stores_login_error_ssl">Koneksi ke halaman masuk tidak aman.</string>
<string name="stores_login_error_verification">Proses masuk tidak dapat diverifikasi. Coba lagi.</string>
<string name="stores_login_error_generic">Proses masuk gagal. Coba lagi.</string>
<string name="stores_login_continue_in_browser">%1$s memerlukan satu langkah lagi. Selesaikan di browser yang terbuka, lalu coba lagi.</string>
<string name="common_close">Tutup</string>
<string name="common_back">Kembali</string>
<string name="common_edit">Edit</string>
-2
View File
@@ -917,7 +917,6 @@
<string name="setup_log_export_failed">Impossibile salvare i log di sessione.</string>
<string name="setup_log_delete_failed">Impossibile eliminare i log di sessione.</string>
<string name="setup_offline">Modalità offline</string>
<string name="setup_offline_auto">Modalità offline automatica</string>
<string name="setup_sign_in_first">Accedi prima a Steam</string>
<string name="setup_launcher">Launcher</string>
<string name="setup_language">Lingua</string>
@@ -2729,7 +2728,6 @@
<string name="stores_login_error_ssl">La connessione alla pagina di accesso non è sicura.</string>
<string name="stores_login_error_verification">Impossibile verificare l\'accesso. Riprova.</string>
<string name="stores_login_error_generic">Accesso non riuscito. Riprova.</string>
<string name="stores_login_continue_in_browser">%1$s richiede un altro passaggio. Completalo nel browser che si è aperto, poi riprova.</string>
<string name="common_close">Chiudi</string>
<string name="common_back">Indietro</string>
<string name="common_edit">Modifica</string>
-2
View File
@@ -919,7 +919,6 @@
<string name="setup_reset_settings_session_running">設定をリセットする前にセッションを停止してください。</string>
<string name="setup_reset_settings_partial">設定はリセットされましたが、一部をリセットできませんでした。詳細はログを確認してください。</string>
<string name="setup_offline">オフラインモード</string>
<string name="setup_offline_auto">自動オフラインモード</string>
<string name="setup_sign_in_first">先にSteamにログインしてください</string>
<string name="setup_launcher">ランチャー</string>
<string name="setup_language">言語</string>
@@ -2690,7 +2689,6 @@
<string name="stores_login_error_ssl">ログインページへの接続は安全ではありません。</string>
<string name="stores_login_error_verification">ログインを確認できませんでした。もう一度お試しください。</string>
<string name="stores_login_error_generic">ログインに失敗しました。もう一度お試しください。</string>
<string name="stores_login_continue_in_browser">%1$s で追加の手順が必要です。開いたブラウザーで完了してから、もう一度お試しください。</string>
<string name="common_close">閉じる</string>
<string name="common_back">戻る</string>
<string name="common_edit">編集</string>
-2
View File
@@ -919,7 +919,6 @@
<string name="setup_reset_settings_session_running">설정을 초기화하기 전에 세션을 중지하세요.</string>
<string name="setup_reset_settings_partial">설정이 초기화되었지만 일부는 초기화하지 못했습니다. 자세한 내용은 로그를 확인하세요.</string>
<string name="setup_offline">오프라인 모드</string>
<string name="setup_offline_auto">자동 오프라인 모드</string>
<string name="setup_sign_in_first">먼저 Steam에 로그인하세요</string>
<string name="setup_launcher">런처</string>
<string name="setup_language">언어</string>
@@ -2690,7 +2689,6 @@
<string name="stores_login_error_ssl">로그인 페이지 연결이 안전하지 않습니다.</string>
<string name="stores_login_error_verification">로그인을 확인할 수 없습니다. 다시 시도하세요.</string>
<string name="stores_login_error_generic">로그인에 실패했습니다. 다시 시도하세요.</string>
<string name="stores_login_continue_in_browser">%1$s에서 한 단계가 더 필요합니다. 열린 브라우저에서 완료한 다음 다시 시도하세요.</string>
<string name="common_close">닫기</string>
<string name="common_back">뒤로</string>
<string name="common_edit">편집</string>
-2
View File
@@ -919,7 +919,6 @@
<string name="setup_reset_settings_session_running">Hentikan sesi sebelum menetap semula tetapan.</string>
<string name="setup_reset_settings_partial">Tetapan telah ditetap semula, tetapi bukan semuanya. Butirannya ada dalam log.</string>
<string name="setup_offline">Mod luar talian</string>
<string name="setup_offline_auto">Mod luar talian automatik</string>
<string name="setup_sign_in_first">Log masuk ke Steam dahulu</string>
<string name="setup_launcher">Pelancar</string>
<string name="setup_language">Bahasa</string>
@@ -2690,7 +2689,6 @@
<string name="stores_login_error_ssl">Sambungan ke halaman log masuk tidak selamat.</string>
<string name="stores_login_error_verification">Log masuk tidak dapat disahkan. Cuba lagi.</string>
<string name="stores_login_error_generic">Log masuk gagal. Cuba lagi.</string>
<string name="stores_login_continue_in_browser">%1$s memerlukan satu langkah lagi. Selesaikannya dalam pelayar yang dibuka, kemudian cuba lagi.</string>
<string name="common_close">Tutup</string>
<string name="common_back">Kembali</string>
<string name="common_edit">Sunting</string>
-2
View File
@@ -922,7 +922,6 @@
<string name="setup_reset_settings_session_running">Stopp økten før du tilbakestiller innstillinger.</string>
<string name="setup_reset_settings_partial">Innstillingene ble tilbakestilt, men ikke alle. Detaljene står i loggen.</string>
<string name="setup_offline">Frakoblet modus</string>
<string name="setup_offline_auto">Automatisk frakoblet modus</string>
<string name="setup_sign_in_first">Logg inn på Steam først</string>
<string name="setup_launcher">Launcher</string>
<string name="setup_language">Språk</string>
@@ -2715,7 +2714,6 @@
<string name="stores_login_error_ssl">Tilkoblingen til innloggingssiden er ikke sikker.</string>
<string name="stores_login_error_verification">Innloggingen kunne ikke verifiseres. Prøv igjen.</string>
<string name="stores_login_error_generic">Innlogging mislyktes. Prøv igjen.</string>
<string name="stores_login_continue_in_browser">%1$s trenger ett trinn til. Fullfør det i nettleseren som ble åpnet, og prøv igjen.</string>
<string name="common_close">Lukk</string>
<string name="common_back">Tilbake</string>
<string name="common_edit">Rediger</string>
-2
View File
@@ -922,7 +922,6 @@
<string name="setup_reset_settings_session_running">Stop de sessie voordat je instellingen reset.</string>
<string name="setup_reset_settings_partial">De instellingen zijn gereset, maar niet alles. De details staan in de logs.</string>
<string name="setup_offline">Offlinemodus</string>
<string name="setup_offline_auto">Automatische offlinemodus</string>
<string name="setup_sign_in_first">Meld je eerst aan bij Steam</string>
<string name="setup_launcher">Launcher</string>
<string name="setup_language">Taal</string>
@@ -2715,7 +2714,6 @@
<string name="stores_login_error_ssl">De verbinding met de aanmeldpagina is niet beveiligd.</string>
<string name="stores_login_error_verification">De aanmelding kon niet worden geverifieerd. Probeer het opnieuw.</string>
<string name="stores_login_error_generic">Aanmelden mislukt. Probeer het opnieuw.</string>
<string name="stores_login_continue_in_browser">%1$s vraagt nog één stap. Rond die af in de browser die is geopend en probeer het opnieuw.</string>
<string name="common_close">Sluiten</string>
<string name="common_back">Terug</string>
<string name="common_edit">Bewerken</string>
-2
View File
@@ -928,7 +928,6 @@
<string name="setup_reset_settings_session_running">Zatrzymaj sesję, zanim zresetujesz ustawienia.</string>
<string name="setup_reset_settings_partial">Ustawienia zostały zresetowane, ale nie wszystkie. Szczegóły są w logach.</string>
<string name="setup_offline">Tryb offline</string>
<string name="setup_offline_auto">Automatyczny tryb offline</string>
<string name="setup_sign_in_first">Najpierw zaloguj się do Steam</string>
<string name="setup_launcher">Aplikacja</string>
<string name="setup_language">Język</string>
@@ -2767,7 +2766,6 @@
<string name="stores_login_error_ssl">Połączenie ze stroną logowania nie jest bezpieczne.</string>
<string name="stores_login_error_verification">Nie udało się zweryfikować logowania. Spróbuj ponownie.</string>
<string name="stores_login_error_generic">Logowanie nie powiodło się. Spróbuj ponownie.</string>
<string name="stores_login_continue_in_browser">%1$s wymaga jeszcze jednego kroku. Dokończ go w otwartej przeglądarce, a potem spróbuj ponownie.</string>
<string name="common_close">Zamknij</string>
<string name="common_back">Wstecz</string>
<string name="common_edit">Edytuj</string>
@@ -917,7 +917,6 @@
<string name="setup_log_export_failed">Não foi possível guardar os registos de sessão.</string>
<string name="setup_log_delete_failed">Não foi possível eliminar os registos de sessão.</string>
<string name="setup_offline">Modo offline</string>
<string name="setup_offline_auto">Modo offline automático</string>
<string name="setup_sign_in_first">Inicie sessão no Steam primeiro</string>
<string name="setup_launcher">Iniciador</string>
<string name="setup_language">Idioma</string>
@@ -2743,7 +2742,6 @@
<string name="stores_login_error_ssl">A ligação à página de início de sessão não é segura.</string>
<string name="stores_login_error_verification">Não foi possível verificar o início de sessão. Tente novamente.</string>
<string name="stores_login_error_generic">Falha no início de sessão. Tente novamente.</string>
<string name="stores_login_continue_in_browser">%1$s precisa de mais um passo. Conclua-o no navegador que foi aberto e tente novamente.</string>
<string name="common_close">Fechar</string>
<string name="common_back">Voltar</string>
<string name="common_edit">Editar</string>
-2
View File
@@ -924,7 +924,6 @@
<string name="setup_log_export_failed">Não foi possível salvar os registros de sessão.</string>
<string name="setup_log_delete_failed">Não foi possível excluir os registros de sessão.</string>
<string name="setup_offline">Modo offline</string>
<string name="setup_offline_auto">Modo offline automático</string>
<string name="setup_sign_in_first">Inicie sessão na Steam primeiro</string>
<string name="setup_launcher">Inicializador</string>
<string name="setup_language">Idioma</string>
@@ -2751,7 +2750,6 @@
<string name="stores_login_error_ssl">A conexão com a página de login não é segura.</string>
<string name="stores_login_error_verification">Não foi possível verificar o login. Tente de novo.</string>
<string name="stores_login_error_generic">Falha no login. Tente de novo.</string>
<string name="stores_login_continue_in_browser">%1$s precisa de mais uma etapa. Conclua no navegador que foi aberto e tente novamente.</string>
<string name="common_close">Fechar</string>
<string name="common_back">Voltar</string>
<string name="common_edit">Editar</string>
-2
View File
@@ -925,7 +925,6 @@
<string name="setup_reset_settings_session_running">Oprește sesiunea înainte de a reseta setările.</string>
<string name="setup_reset_settings_partial">Setările au fost resetate, dar nu toate. Detaliile sunt în jurnale.</string>
<string name="setup_offline">Mod offline</string>
<string name="setup_offline_auto">Mod offline automat</string>
<string name="setup_sign_in_first">Autentifică-te mai întâi în Steam</string>
<string name="setup_launcher">Launcher</string>
<string name="setup_language">Limbă</string>
@@ -2741,7 +2740,6 @@
<string name="stores_login_error_ssl">Conexiunea la pagina de autentificare nu este sigură.</string>
<string name="stores_login_error_verification">Autentificarea nu a putut fi verificată. Încearcă din nou.</string>
<string name="stores_login_error_generic">Autentificarea a eșuat. Încearcă din nou.</string>
<string name="stores_login_continue_in_browser">%1$s mai cere un pas. Finalizează-l în browserul care s-a deschis, apoi încearcă din nou.</string>
<string name="common_close">Închide</string>
<string name="common_back">Înapoi</string>
<string name="common_edit">Editează</string>
-2
View File
@@ -928,7 +928,6 @@
<string name="setup_reset_settings_session_running">Остановите сессию перед сбросом настроек.</string>
<string name="setup_reset_settings_partial">Настройки сброшены, но некоторые части сбросить не удалось. Подробности в журналах.</string>
<string name="setup_offline">Автономный режим</string>
<string name="setup_offline_auto">Автоматический автономный режим</string>
<string name="setup_sign_in_first">Сначала войдите в Steam</string>
<string name="setup_launcher">Лаунчер</string>
<string name="setup_language">Язык</string>
@@ -2765,7 +2764,6 @@
<string name="stores_login_error_ssl">Подключение к странице входа не защищено.</string>
<string name="stores_login_error_verification">Не удалось подтвердить вход. Повторите попытку.</string>
<string name="stores_login_error_generic">Ошибка входа. Повторите попытку.</string>
<string name="stores_login_continue_in_browser">%1$s требует ещё один шаг. Завершите его в открывшемся браузере и попробуйте снова.</string>
<string name="common_close">Закрыть</string>
<string name="common_back">Назад</string>
<string name="common_edit">Изменить</string>
-2
View File
@@ -922,7 +922,6 @@
<string name="setup_reset_settings_session_running">Stoppa sessionen innan du återställer inställningar.</string>
<string name="setup_reset_settings_partial">Inställningarna återställdes, men inte alla. Detaljerna finns i loggen.</string>
<string name="setup_offline">Offlineläge</string>
<string name="setup_offline_auto">Automatiskt offlineläge</string>
<string name="setup_sign_in_first">Logga in på Steam först</string>
<string name="setup_launcher">Startprogram</string>
<string name="setup_language">Språk</string>
@@ -2715,7 +2714,6 @@
<string name="stores_login_error_ssl">Anslutningen till inloggningssidan är inte säker.</string>
<string name="stores_login_error_verification">Inloggningen kunde inte verifieras. Försök igen.</string>
<string name="stores_login_error_generic">Inloggningen misslyckades. Försök igen.</string>
<string name="stores_login_continue_in_browser">%1$s behöver ett steg till. Slutför det i webbläsaren som öppnades och försök sedan igen.</string>
<string name="common_close">Stäng</string>
<string name="common_back">Tillbaka</string>
<string name="common_edit">Redigera</string>
-2
View File
@@ -919,7 +919,6 @@
<string name="setup_reset_settings_session_running">หยุดเซสชันก่อนรีเซ็ตการตั้งค่า</string>
<string name="setup_reset_settings_partial">รีเซ็ตการตั้งค่าแล้ว แต่ไม่ทั้งหมด รายละเอียดอยู่ในล็อก</string>
<string name="setup_offline">โหมดออฟไลน์</string>
<string name="setup_offline_auto">โหมดออฟไลน์อัตโนมัติ</string>
<string name="setup_sign_in_first">ลงชื่อเข้าใช้ Steam ก่อน</string>
<string name="setup_launcher">ตัวเปิดแอป</string>
<string name="setup_language">ภาษา</string>
@@ -2690,7 +2689,6 @@
<string name="stores_login_error_ssl">การเชื่อมต่อไปยังหน้าลงชื่อเข้าใช้ไม่ปลอดภัย</string>
<string name="stores_login_error_verification">ไม่สามารถยืนยันการลงชื่อเข้าใช้ได้ ลองใหม่</string>
<string name="stores_login_error_generic">ลงชื่อเข้าใช้ล้มเหลว ลองใหม่</string>
<string name="stores_login_continue_in_browser">%1$s ต้องการอีกหนึ่งขั้นตอน ทำให้เสร็จในเบราว์เซอร์ที่เปิดขึ้น แล้วลองอีกครั้ง</string>
<string name="common_close">ปิด</string>
<string name="common_back">กลับ</string>
<string name="common_edit">แก้ไข</string>
-2
View File
@@ -914,7 +914,6 @@
<string name="setup_log_export_failed">Oturum günlükleri kaydedilemedi.</string>
<string name="setup_log_delete_failed">Oturum günlükleri silinemedi.</string>
<string name="setup_offline">Çevrimdışı mod</string>
<string name="setup_offline_auto">Otomatik çevrimdışı mod</string>
<string name="setup_sign_in_first">Önce Steam\'de oturum açın</string>
<string name="setup_launcher">Başlatıcı</string>
<string name="setup_language">Dil</string>
@@ -2704,7 +2703,6 @@
<string name="stores_login_error_ssl">Oturum açma sayfasına bağlantı güvenli değil.</string>
<string name="stores_login_error_verification">Oturum açma doğrulanamadı. Yeniden deneyin.</string>
<string name="stores_login_error_generic">Oturum açma başarısız oldu. Yeniden deneyin.</string>
<string name="stores_login_continue_in_browser">%1$s bir adım daha istiyor. Açılan tarayıcıda tamamlayın, ardından yeniden deneyin.</string>
<string name="common_close">Kapat</string>
<string name="common_back">Geri</string>
<string name="common_edit">Düzenle</string>
-2
View File
@@ -928,7 +928,6 @@
<string name="setup_reset_settings_session_running">Зупиніть сеанс перед скиданням налаштувань.</string>
<string name="setup_reset_settings_partial">Налаштування скинуто, але не всі. Подробиці в журналах.</string>
<string name="setup_offline">Офлайн-режим</string>
<string name="setup_offline_auto">Автоматичний офлайн-режим</string>
<string name="setup_sign_in_first">Спершу увійдіть у Steam</string>
<string name="setup_launcher">Лаунчер</string>
<string name="setup_language">Мова</string>
@@ -2767,7 +2766,6 @@
<string name="stores_login_error_ssl">З’єднання зі сторінкою входу не захищене.</string>
<string name="stores_login_error_verification">Не вдалося підтвердити вхід. Спробуйте ще раз.</string>
<string name="stores_login_error_generic">Вхід не вдався. Спробуйте ще раз.</string>
<string name="stores_login_continue_in_browser">%1$s потребує ще одного кроку. Завершіть його у відкритому браузері та спробуйте ще раз.</string>
<string name="common_close">Закрити</string>
<string name="common_back">Назад</string>
<string name="common_edit">Редагувати</string>
-2
View File
@@ -919,7 +919,6 @@
<string name="setup_reset_settings_session_running">Dừng phiên trước khi đặt lại thiết lập.</string>
<string name="setup_reset_settings_partial">Đã đặt lại thiết lập, nhưng chưa phải tất cả. Chi tiết có trong log.</string>
<string name="setup_offline">Chế độ ngoại tuyến</string>
<string name="setup_offline_auto">Chế độ ngoại tuyến tự động</string>
<string name="setup_sign_in_first">Đăng nhập Steam trước</string>
<string name="setup_launcher">Launcher</string>
<string name="setup_language">Ngôn ngữ</string>
@@ -2690,7 +2689,6 @@
<string name="stores_login_error_ssl">Kết nối đến trang đăng nhập không an toàn.</string>
<string name="stores_login_error_verification">Không thể xác minh đăng nhập. Hãy thử lại.</string>
<string name="stores_login_error_generic">Đăng nhập thất bại. Hãy thử lại.</string>
<string name="stores_login_continue_in_browser">%1$s cần thêm một bước. Hãy hoàn tất trong trình duyệt vừa mở, rồi thử lại.</string>
<string name="common_close">Đóng</string>
<string name="common_back">Quay lại</string>
<string name="common_edit">Sửa</string>
@@ -919,7 +919,6 @@
<string name="setup_reset_settings_session_running">请先停止会话再重置设置。</string>
<string name="setup_reset_settings_partial">设置已重置,但部分内容未能重置。详情请查看日志。</string>
<string name="setup_offline">离线模式</string>
<string name="setup_offline_auto">自动离线模式</string>
<string name="setup_sign_in_first">请先登录 Steam</string>
<string name="setup_launcher">启动器</string>
<string name="setup_language">语言</string>
@@ -2764,7 +2763,6 @@
<string name="stores_login_error_ssl">与登录页面的连接不安全。</string>
<string name="stores_login_error_verification">无法验证登录。请重试。</string>
<string name="stores_login_error_generic">登录失败。请重试。</string>
<string name="stores_login_continue_in_browser">%1$s 还需要一个步骤。请在已打开的浏览器中完成,然后重试。</string>
<string name="common_close">关闭</string>
<string name="common_back">返回</string>
<string name="common_edit">编辑</string>
@@ -918,7 +918,6 @@
<string name="setup_reset_settings_session_running">請先停止會話再重設設定。</string>
<string name="setup_reset_settings_partial">設定已重設,但部分項目未能重設。詳情請查看記錄。</string>
<string name="setup_offline">離線模式</string>
<string name="setup_offline_auto">自動離線模式</string>
<string name="setup_sign_in_first">請先登入 Steam</string>
<string name="setup_launcher">啟動器</string>
<string name="setup_language">語言</string>
@@ -2687,7 +2686,6 @@
<string name="stores_login_error_ssl">與登入頁面的連線不安全。</string>
<string name="stores_login_error_verification">無法驗證登入,請再試一次。</string>
<string name="stores_login_error_generic">登入失敗,請再試一次。</string>
<string name="stores_login_continue_in_browser">%1$s 還需要一個步驟。請在已開啟的瀏覽器中完成,然後再試一次。</string>
<string name="common_close">關閉</string>
<string name="common_back">返回</string>
<string name="common_edit">編輯</string>
@@ -918,7 +918,6 @@
<string name="setup_reset_settings_session_running">請先停止工作階段再重設設定。</string>
<string name="setup_reset_settings_partial">設定已重設,但部分項目無法重設。詳細資訊請查看日誌。</string>
<string name="setup_offline">離線模式</string>
<string name="setup_offline_auto">自動離線模式</string>
<string name="setup_sign_in_first">請先登入 Steam</string>
<string name="setup_launcher">啟動器</string>
<string name="setup_language">語言</string>
@@ -2687,7 +2686,6 @@
<string name="stores_login_error_ssl">與登入頁面的連線不安全。</string>
<string name="stores_login_error_verification">無法驗證登入。請再試一次。</string>
<string name="stores_login_error_generic">登入失敗。請再試一次。</string>
<string name="stores_login_continue_in_browser">%1$s 還需要一個步驟。請在已開啟的瀏覽器中完成,然後再試一次。</string>
<string name="common_close">關閉</string>
<string name="common_back">返回</string>
<string name="common_edit">編輯</string>
+1 -4
View File
@@ -383,7 +383,6 @@
<string name="mode_return_after_game">Return to DroidDeck after a game</string>
<string name="mode_return_after_game_hint">When a game you started from DroidDeck or another launcher closes, Steam exits cleanly (cloud saves finish first) and you go back there. Off: stay in Steam.</string>
<string name="mode_shader_precache">Shader pre-caching</string>
<string name="mode_valve_proton_on_demand">Valve Proton only when needed</string>
<string name="mode_shader_precache_hint">Steam downloads shaders prebuilt for your games and processes them in the background, so games stutter less. Off saves data, storage and battery; games build shaders as they play instead. The same setting as Steam’s Downloads > Shader Pre-Caching. Applies next session.</string>
<string name="mode_steam_repair">Repair Steam client</string>
<string name="mode_steam_repair_hint">Downloads the Steam client again the next time Steam starts. Use it if Steam stays on its loading screen. Games, sign-in and settings are kept.</string>
@@ -673,7 +672,7 @@
<string name="perf_fastpath_needs_seccomp">Needs proot\'s seccomp filter.</string>
<string name="perf_fastpath_hint">Faster file lookups and less stutter. Turn off if a program can\'t find its files.</string>
<string name="perf_cursor_composite">Draw the cursor inside gamescope</string>
<string name="perf_cursor_composite_hint">Gamescope paints the pointer itself instead of handing it to Android. Applies next session.</string>
<string name="perf_cursor_composite_hint">Gamescope paints the pointer itself instead of handing it to Android. Turn on for a controller-driven cursor. Off is faster on a phone. Applies next session.</string>
<string name="perf_identity">Session identity</string>
<string name="perf_hostname">Host name</string>
<string name="perf_hostname_hint">The name Steam sees for this device. Blank restores %1$s.</string>
@@ -1004,7 +1003,6 @@
<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_offline_auto">Auto offline mode</string>
<string name="setup_sign_in_first">Sign in to Steam first</string>
<string name="setup_launcher">Launcher</string>
<string name="setup_language">Language</string>
@@ -3036,7 +3034,6 @@
<string name="stores_login_error_ssl">The connection to the sign-in page is not secure.</string>
<string name="stores_login_error_verification">The sign-in could not be verified. Try again.</string>
<string name="stores_login_error_generic">Sign-in failed. Try again.</string>
<string name="stores_login_continue_in_browser">%1$s needs one more step. Finish it in the browser that opened, then try again.</string>
<string name="common_close">Close</string>
<string name="common_back">Back</string>
<string name="common_edit">Edit</string>
@@ -1,85 +0,0 @@
package com.droiddeck.launcher
import android.content.Intent
import com.droiddeck.launcher.core.SteamIntegration
import com.droiddeck.launcher.frontend.GameRequest
import com.droiddeck.launcher.session.LaunchCoordinator
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNull
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
import org.robolectric.util.ReflectionHelpers
/**
* A replacement activity intent invalidates everything this activity has not dispatched yet: a
* resolved but unhandled game link, and an accepted launch that is still waiting for its session.
*/
@RunWith(RobolectricTestRunner::class)
@Config(sdk = [28], manifest = Config.NONE)
class FrontEndIntentSupersedeTest {
private lateinit var activity: FrontEndActivity
private lateinit var coordinator: LaunchCoordinator<Intent, GameRequest>
@Before
fun setUp() {
activity = Robolectric.buildActivity(FrontEndActivity::class.java).get()
coordinator = ReflectionHelpers.getField(activity, "launchCoordinator")
}
@Test
fun aReplacementIntentDropsAResolvedPendingLink() {
val owner = Intent(activity, FrontEndActivity::class.java)
val ticket = coordinator.beginLink(owner)
assertTrue(coordinator.resolve(ticket, GameRequest(id = "app")))
supersede()
assertFalse(coordinator.hasPending())
assertNull(coordinator.pendingLink())
}
@Test
fun aReplacementIntentInvalidatesAnAcceptedLaunch() {
val ticket = coordinator.beginLaunch()
assertTrue(coordinator.isCurrent(ticket))
supersede()
assertFalse(coordinator.isCurrent(ticket))
assertNull(shadowOf(activity).nextStartedActivity)
}
@Test
fun anActionSetupIntentSupersedesTheGameLinkItReplaced() {
val owner = Intent(activity, FrontEndActivity::class.java)
val ticket = coordinator.beginLink(owner)
assertTrue(coordinator.resolve(ticket, GameRequest(id = "app")))
deliver(Intent(activity, FrontEndActivity::class.java).setAction(SteamIntegration.ACTION_SETUP))
assertFalse(coordinator.hasPending())
assertFalse(coordinator.isCurrent(ticket))
assertNull(shadowOf(activity).nextStartedActivity)
}
private fun supersede() {
ReflectionHelpers.callInstanceMethod<Void>(activity, "supersedeUncommittedLaunch")
}
/** onNewIntent() is protected, which is exactly how the platform delivers a replacement intent. */
private fun deliver(intent: Intent) {
val method = FrontEndActivity::class.java.getDeclaredMethod("onNewIntent", Intent::class.java)
method.isAccessible = true
try {
method.invoke(activity, intent)
} finally {
method.isAccessible = false
}
}
}
@@ -1,18 +0,0 @@
package com.droiddeck.launcher
import org.junit.Assert.assertTrue
import org.junit.Test
import java.io.File
class SessionRelaunchTest {
// recreate() keeps the window, and Compose content set on it afterwards never recomposes (#2668):
// a session relaunched that way kept its loading screen up over a running desktop.
@Test fun sessionAndLauncherActivitiesNeverRecreateThemselves() {
listOf("SessionActivity.kt", "FrontEndActivity.kt").forEach { name ->
val code = File("src/main/java/com/droiddeck/launcher/$name").readLines()
.map { it.substringBefore("//") }
val calls = code.withIndex().filter { (_, line) -> Regex("""\brecreate\(\)""").containsMatchIn(line) }
assertTrue("$name calls recreate() at line(s) ${calls.map { it.index + 1 }}", calls.isEmpty())
}
}
}
@@ -11,10 +11,4 @@ class DeviceSupportTest {
// A PowerVR HAL without usable DRM access also reaches this unavailable case.
assertFalse(DeviceSupport.graphicsAvailable(adreno = false, powerVrReady = false))
}
@Test fun bridgeServesEveryNonAdrenoWithoutASystemDriverRoute() {
assertTrue(DeviceSupport.bridgeUsable(adreno = false, systemDriverReady = false))
assertFalse(DeviceSupport.bridgeUsable(adreno = true, systemDriverReady = false))
assertFalse(DeviceSupport.bridgeUsable(adreno = false, systemDriverReady = true))
}
}
@@ -3,7 +3,6 @@ package com.droiddeck.launcher.frontend
import com.droiddeck.launcher.assumeFilePermissionsEnforced
import android.os.Environment
import com.droiddeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.stores.StoreInstallRoot
import java.io.File
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
@@ -93,38 +92,6 @@ class AddedExesTest {
}
}
@Test fun reselectingTheCurrentExeKeepsItWhenTheRankingChanges() {
val storage = tmp.newFolder("Ranked")
exe(File(storage, "Example/Example.exe"))
exe(File(storage, "Example/Other.exe"))
SessionPrefs.setAddedGamesDirs(app, emptyList())
SessionPrefs.setGameStorage(app, storage.path, "Card")
val folder = File(storage, "Example")
val current = AddedGames.scan(app).single { it.folder == folder }.exe
val other = listOf("Example.exe", "Other.exe").map { File(folder, it) }.single { it.path != current.path }
val existing = AddedGames.addExe(app, current)
assertTrue(existing is AddedGames.AddResult.Existing)
assertEquals(current.path, SessionPrefs.addedGameExe(app, folder.path))
File(folder, "MicrosoftGame.config").writeText("<Executable Name=\"${other.name}\" />")
assertEquals(other.path, AddedGames.rank(folder).exes.first().path)
assertEquals(current.path, AddedGames.scan(app).single { it.folder == folder }.exe.path)
}
@Test fun reselectingASteamInstallsExeThroughAnAliasStoresTheReachablePath() {
val storage = tmp.newFolder("Aliased")
val pick = exe(File(storage, "steamapps/common/Example/Example.exe"))
File(storage, "steamapps/appmanifest_123.acf").writeText("\"installdir\" \"Example\"")
SessionPrefs.setAddedGamesDirs(app, emptyList())
SessionPrefs.setGameStorage(app, storage.path, "Card")
val alias = File(tmp.newFolder("Links"), "Example.exe")
java.nio.file.Files.createSymbolicLink(alias.toPath(), pick.toPath())
assertTrue(AddedGames.addExe(app, alias) is AddedGames.AddResult.Existing)
assertEquals(pick.path, AddedExes.list(app).single { it.folder == pick.parentFile!!.path }.exe)
assertEquals(pick.path, SessionPrefs.addedGameExe(app, pick.parentFile!!.path))
assertEquals(pick.path, AddedGames.scan(app).single { it.folder == pick.parentFile }.exe.path)
AddedExes.drop(app, pick.parentFile!!.path)
}
@Test fun anotherExeInTheSameGameSwitchesItsExe() {
noGamesFolders()
val first = onStorage("Games2/Hades/Hades.exe")
@@ -330,39 +297,6 @@ class AddedExesTest {
assertEquals(listOf(other.path), AddedGames.scan(app).map { it.exe.path })
}
private fun routeEveryGameTo(steamApp: Int) {
val config = File(SessionPrefs.activeSteamRoot(app), "userdata/123/config").apply { mkdirs() }
val routes = org.json.JSONObject()
AddedGames.scan(app).forEach { routes.put(it.appId.toString(), steamApp) }
File(config, ".droiddeck-routes.json").writeText(routes.toString())
}
@Test fun anotherProgramOfASteamInstallIsNotRoutedToTheSteamApp() {
noGamesFolders()
val main = onStorage("Games2/The Binding of Isaac Rebirth/isaac-ng.exe")
val launcher = onStorage("Games2/The Binding of Isaac Rebirth/REPENTOGONLauncher.exe")
AddedExes.put(app, AddedExes.Entry(main.parent!!, launcher.path))
routeEveryGameTo(250900)
val game = AddedGames.scan(app).single()
assertEquals(launcher.path, game.exe.path)
assertEquals(main.path, game.candidates.first().path)
assertNull(game.steamAppId)
assertTrue(!game.steamProgram)
assertTrue(File(AddedGames.writeListing(app, listOf(game), emptyList()).path).readText().contains("\"route\":false"))
}
@Test fun theSteamAppsOwnProgramStillRoutesToTheSteamApp() {
noGamesFolders()
val main = onStorage("Games2/The Binding of Isaac Rebirth/isaac-ng.exe")
onStorage("Games2/The Binding of Isaac Rebirth/REPENTOGONLauncher.exe")
AddedExes.put(app, AddedExes.Entry(main.parent!!, main.path))
routeEveryGameTo(250900)
val game = AddedGames.scan(app).single()
assertEquals(250900, game.steamAppId)
assertTrue(game.steamProgram)
assertTrue(!File(AddedGames.writeListing(app, listOf(game), emptyList()).path).readText().contains("route"))
}
@Test fun aDifferentGameWithANumberedNameIsNotTakenAsAnotherBuild() {
noGamesFolders()
val held = onStorage("Games2/id/Doom/Doom.exe")
@@ -462,15 +396,6 @@ class AddedExesTest {
assertEquals("$clash-2", guests.last())
}
@Test fun aFolderNamedStoresIsNotBoundOverTheInternalStoreRoot() {
noGamesFolders()
val stores = File(tmp.newFolder("card"), "Stores").apply { exe(File(this, "One/One.exe")) }
val result = AddedGames.addFolder(app, stores)
val guest = SessionPrefs.gameFolderBinds(app).single().second
assertTrue(guest != StoreInstallRoot.INTERNAL_GUEST && guest.startsWith("${AddedGames.GUEST_DIR}/Stores-"))
assertEquals("$guest/One/One.exe", result.added.single().guestExe)
}
@Test fun aRemovedSingleExeGameStaysOffUntilPickedAgain() {
noGamesFolders()
val pick = onStorage("Download/Celeste/Celeste.exe")
@@ -47,11 +47,6 @@ class AddedGamesSteamEditsTest {
.writeText(JSONObject().put("games", JSONObject().put(appId.toString(), game)).toString())
}
private fun legacyAdoption(exe: File, seen: Int) {
context.getSharedPreferences("session", Context.MODE_PRIVATE).edit()
.putString("addedExe:${folder.path}", exe.path).putInt("addedExeSeen:${folder.path}", seen).commit()
}
private fun scanned() = AddedGames.scan(context).single { it.folder == folder }
@Test fun aTargetChangedInSteamBecomesTheAppsChoiceOnce() {
@@ -73,65 +68,6 @@ class AddedGamesSteamEditsTest {
assertEquals(main.path, SessionPrefs.addedGameExe(context, folder.path))
}
@Test fun aTargetChosenInSteamKeepsTheSteamAppsRouteBeforeAndAfterItIsAdopted() {
val first = scanned()
val routes = File(LinuxRuntime.rootDir(context), "root/.local/share/Steam/userdata/123/config/.droiddeck-routes.json")
routes.writeText(JSONObject().put(first.appId.toString(), 250900).toString())
assertEquals(250900, scanned().steamAppId)
record(first.appId, "/root/Games/PC/Example/Example.exe", "/root/Games/PC/Example/bin/Other.exe", 1)
val adopted = scanned()
assertEquals(other, adopted.exe)
assertEquals(250900, adopted.steamAppId)
assertTrue(adopted.steamProgram)
val later = scanned()
assertEquals(other, later.exe)
assertEquals(250900, later.steamAppId)
assertTrue(later.steamProgram)
}
@Test fun aTargetAdoptedBeforeTheMarkerExistedKeepsTheSteamAppsRoute() {
val first = scanned()
val routes = File(LinuxRuntime.rootDir(context), "root/.local/share/Steam/userdata/123/config/.droiddeck-routes.json")
routes.writeText(JSONObject().put(first.appId.toString(), 250900).toString())
record(first.appId, "/root/Games/PC/Example/Example.exe", "/root/Games/PC/Example/bin/Other.exe", 1)
legacyAdoption(other, 1)
assertNull(SessionPrefs.addedGameAdopted(context, folder.path, "Exe"))
val legacy = scanned()
assertEquals(other, legacy.exe)
assertEquals(250900, legacy.steamAppId)
assertTrue(legacy.steamProgram)
assertEquals(other.path, SessionPrefs.addedGameAdopted(context, folder.path, "Exe"))
}
@Test fun aProgramPickedInDroidDeckThatSteamNeverEditedStaysOutOfTheRoute() {
val first = scanned()
val routes = File(LinuxRuntime.rootDir(context), "root/.local/share/Steam/userdata/123/config/.droiddeck-routes.json")
routes.writeText(JSONObject().put(first.appId.toString(), 250900).toString())
record(first.appId, "/root/Games/PC/Example/Example.exe", "/root/Games/PC/Example/Example.exe", 1)
legacyAdoption(other, 1)
val picked = scanned()
assertEquals(other, picked.exe)
assertNull(picked.steamAppId)
assertTrue(!picked.steamProgram)
}
@Test fun aProgramChosenInDroidDeckAfterASteamEditLeavesTheSteamAppsRoute() {
val first = scanned()
val routes = File(LinuxRuntime.rootDir(context), "root/.local/share/Steam/userdata/123/config/.droiddeck-routes.json")
routes.writeText(JSONObject().put(first.appId.toString(), 250900).toString())
record(first.appId, "/root/Games/PC/Example/Example.exe", "/root/Games/PC/Example/bin/Other.exe", 1)
assertEquals(other, scanned().exe)
val third = File(folder, "Third.exe").apply { writeBytes(ByteArray(4)) }
SessionPrefs.setAddedGameExe(context, folder.path, third.path)
val chosen = scanned()
assertEquals(third, chosen.exe)
assertNull(chosen.steamAppId)
assertTrue(!chosen.steamProgram)
}
@Test fun theListingTellsTheSessionWhichSteamEditTheAppHasTaken() {
val first = scanned()
record(first.appId, "/root/Games/PC/Example/Example.exe", "/root/Games/PC/Example/bin/Other.exe", 3)
Loaded 100 of 248 files, more files were not shown because too many files have changed in this diff. Show more