Compare commits

...
Author SHA1 Message Date
The412Banner 4f3b73a5c0 refactor(input): share HeldInput across uinput devices with a source bit each 2026-11-20 04:43:08 +00:00
The412Banner 869d730996 fix(input): count uinput key holds across devices and drop late clients 2026-11-20 04:26:20 +00:00
The412Banner 0591a9d506 refactor(input): track held uinput keys and buttons with HeldInput 2026-11-16 18:23:21 +00:00
The412Banner 740b9d8322 fix(input): uinput keyboards and mice drive the Desktop session 2026-11-16 18:13:00 +00:00
Kurt Himebauch f0557302ac feat(xbox): Xbox sign-in in the same frame as the other stores (#2718)
feat(xbox): give the Xbox sign-in the same frame as the other stores and log why its helper could not start
2026-11-16 11:48:31 -05:00
LunaDL a8c1a9ff4d Feat: Add new button for integer scalling, adds tolerancy and rename (#2690)
* Add integer scaling mode

* Fix integer scaling view-space input bounds

* Improve integer scaling tolerance

* Add Fit and Auto scaling toggle to session drawer

* Translate Fit and Integer scaling labels

* Clarify integer scaling cropping hint

* Update integer scaling hint across translations

* Fix integer scaling settings and translations

* Fix controller input for integer scaling

* Complete integer scaling hint translations

* Fix integer scaling hint translations

* Restore XML declaration quote style

* Use double quotes in XML declarations

* Add missing norugeuingz translatisn

* fix: include math.h for roundf integer scaling

* fix: link math library in Vulkan caller tests

* Fix integer scaling translations

* Fix Italian integer scaling string

* Fix Italian scaling hint apostrophe
2026-11-16 11:47:04 -05:00
ASEbrahimandASEbrahim 37a816c212 Update MaliBridge to v0.5.5.4 (#2704)
Co-authored-by: ASEbrahim <264076441+ASEbrahim@users.noreply.github.com>
2026-11-16 11:34:58 -05:00
Kurt Himebauch 1ab090405e ci: reclaim root-owned workspace files before checkout on self-hosted runners (#2713) 2026-11-16 10:01:59 -05:00
Kurt Himebauch dc98b6b96a feat: target Android 14 so Play Protect installs DroidDeck without a warning (#2683)
* fix(proot): ship proot in the APK and run it from the native library directory

* fix(native): start rootfs programs through an APK-shipped exec loader where data files may not be executed

* fix(audio): start PulseAudio through the system linker where data files may not be executed

* feat: target Android 14 (SDK 34) so Play Protect installs DroidDeck without a warning

* fix: ask for all-files access on Android 11+, reject unloadable ELFs before exec, keep checking the proot pack

* fix: hand host scripts to the kernel, skip startup launch while all-files Settings is open

* fix: run proot from its add-on pack through Android's linker, so the APK carries no proot

* fix: declare high sampling rate sensors for controller gyro at target 34

* fix: offer the rootfs proot fallback only where Android lets proot exec its loader

* test: install the runtime's proot pack in GameFileSync fixtures
2026-11-16 09:35:16 -05:00
MaxsTechReview 6188c9ac0d fix(desktop): let gamescope find its reaper when /usr/games is not on PATH (#2597)
* fix(desktop): let gamescope find its reaper when /usr/games is not on PATH

* test(desktop): keep host directories off the reaper fallback test PATH
2026-11-16 09:33:31 -05:00
Kurt Himebauch 758e7983fa feat(display): black frame insertion on 100 Hz and faster screens (#2653)
* feat(display): black frame insertion on 100 Hz and faster screens

* feat(display): black frame insertion lives in Screen effects

* test(compositor): cover black frame insertion in the render-on-commit harness

* fix(display): keep HDR and pacing intact around black frame insertion

* fix(display): gate black frame insertion on the panel's refresh, not the tick rate

BFI checked the 100 Hz minimum against g_refresh_ns, an average of the time
between handled vsync ticks. BFI presents on every tick, so under load the
ticks run late, the average fell to 95-100 Hz on a 120 Hz panel, and BFI
switched off and on again many times a second (3793 times in one session on
a Retroid Pocket Duo). That showed as uneven flicker.

Use the display mode's refresh (g_output_refresh_mhz) instead, which only
changes when the mode does.

* fix(display): offer black frame insertion for the bottom screen and while it is on

* fix(display): capture a picture, not a black refresh, while black frame insertion strobes

* fix(display): hold black frame insertion off until the last capture ends

* fix(display): keep the game composed while a capture holds black frame insertion

* test(display): a picture hold presents only pictures while black frame insertion runs
2026-11-16 07:33:39 -05:00
85 changed files with 1907 additions and 162 deletions

No files matched your search

+6
View File
@@ -152,6 +152,9 @@ jobs:
runs-on: ${{ fromJSON(needs.components-runner.outputs.labels) }}
timeout-minutes: 40
steps:
- name: Reclaim files a cancelled container build left owned by root
if: runner.environment == 'self-hosted'
run: sudo -n chown -R "$(id -u):$(id -g)" "$GITHUB_WORKSPACE" || echo "::warning::could not reclaim $GITHUB_WORKSPACE"
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
@@ -350,6 +353,9 @@ jobs:
outputs:
variants: ${{ steps.variants.outputs.list }}
steps:
- name: Reclaim files a cancelled container build left owned by root
if: runner.environment == 'self-hosted'
run: sudo -n chown -R "$(id -u):$(id -g)" "$GITHUB_WORKSPACE" || echo "::warning::could not reclaim $GITHUB_WORKSPACE"
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
+1
View File
@@ -114,6 +114,7 @@ DroidDeck is [GPL-3.0](LICENSE). Steam and Proton belong to Valve Corporation. V
- The DroidDeck HUD is [@The412Banner](https://github.com/The412Banner)'s [FusionHUD](https://github.com/The412Banner/FusionHUD) (GPL-3.0 with an attribution term). Its readings match Valve's [MangoHud](https://github.com/flightlessmango/MangoHud) build (MIT), with frame times from gamescope patch 0125.
- The HUD's CPU, GPU load, thermal and battery readers come from [@xXJSONDeruloXx](https://github.com/xXJSONDeruloXx)'s work.
- LSFG frame generation comes from Camille LaVey and the [Eden](https://eden-emu.dev) project, following [lsfg-vk](https://github.com/PancakeTAS/lsfg-vk), ported by [@maxjivi05](https://github.com/maxjivi05). It needs your own copy of [Lossless Scaling](https://store.steampowered.com/app/993090/) and ships none of its shaders.
- Black frame insertion follows the design of [@artzox](https://github.com/artzox)'s [BFI Presenter](https://github.com/artzox/BFI-Presenter) (GPL-3.0): the strobe runs on the display's refresh clock and the game is paced to the lit refresh. Both build on [Blur Busters](https://blurbusters.com)' research on MPRT and motion blur. No BFI Presenter code is used.
- Remote Play decodes through Android's MediaCodec or the [FFmpeg](https://ffmpeg.org) (LGPL-2.1-or-later) in Steam's runtime. Qualcomm low latency settings follow [Moonlight](https://github.com/moonlight-stream/moonlight-android) (GPL-3.0).
- [PipeWire](https://gitlab.freedesktop.org/pipewire/pipewire) (MIT) sockets use the settings in its `module-access.c`, and [WirePlumber](https://gitlab.freedesktop.org/pipewire/wireplumber) (MIT) keeps those clients at full permissions.
+2 -6
View File
@@ -130,7 +130,7 @@ android {
defaultConfig {
applicationId "com.droiddeck.launcher"
minSdkVersion 26
targetSdkVersion 28
targetSdkVersion 34
versionCode 19
versionName "0.7.1"
buildConfigField "String", "BUILD_LABEL", "\"${escapedBuildLabel}\""
@@ -201,10 +201,6 @@ android {
}
}
lint {
disable 'ExpiredTargetSdkVersion'
}
androidResources {
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~:<dir>droiddeck-xbox:<dir>droiddeck-comet:<dir>droiddeck-ubisoft:<dir>droiddeck-rockstar:<dir>droiddeck-dirt:<dir>directaudio:<dir>hybris'
}
@@ -216,7 +212,7 @@ android {
jniLibs {
useLegacyPackaging = true
pickFirsts += ['**/libtermux.so']
excludes += ['**/libproot.so', '**/libproot-loader.so', '**/libopencv_java4.so', '**/libmediapipe_tasks_jni.so']
excludes += ['**/libproot.so', '**/libopencv_java4.so', '**/libmediapipe_tasks_jni.so']
}
}
+25 -5
View File
@@ -36,7 +36,12 @@
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.HIGH_SAMPLING_RATE_SENSORS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
@@ -48,7 +53,8 @@
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.vulkan.version" android:version="0x401000" android:required="true" />
@@ -70,6 +76,7 @@
android:hardwareAccelerated="true"
android:largeHeap="true"
android:extractNativeLibs="true"
android:requestLegacyExternalStorage="true"
android:appCategory="game"
android:isGame="true">
@@ -312,7 +319,11 @@
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|keyboard|keyboardHidden|navigation|uiMode|density"
android:theme="@style/SessionTheme" />
<service android:name=".agent.AgentHostService" android:exported="false" />
<service android:name=".agent.AgentHostService" android:exported="false"
android:foregroundServiceType="specialUse">
<property android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="Keeps the user's on-device assistant running between screens" />
</service>
<service
android:name=".update.UpdateWatch"
android:permission="android.permission.BIND_JOB_SERVICE"
@@ -320,7 +331,11 @@
<service
android:name=".session.SessionService"
android:exported="false"
android:stopWithTask="false" />
android:stopWithTask="false"
android:foregroundServiceType="specialUse">
<property android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="Runs the user's Linux gaming session while its window is in the background" />
</service>
<!-- The compositor's native state is one per process, so the bottom-screen desktop's compositor runs in its own. -->
<service
android:name=".wayland.BottomDesktopCompositorService"
@@ -328,10 +343,15 @@
android:exported="false" />
<service
android:name=".runtime.RuntimeInstallService"
android:exported="false" />
android:exported="false"
android:foregroundServiceType="dataSync" />
<service
android:name=".core.WirelessAdbPairingService"
android:exported="false" />
android:exported="false"
android:foregroundServiceType="specialUse">
<property android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="Waits for the wireless debugging pairing code the user enters" />
</service>
<service
android:name=".stores.download.StoreDownloadService"
android:exported="false"
+6
View File
@@ -40,6 +40,12 @@ add_library(gpuclock SHARED gpuclock/kgsl_clock.c gpuclock/kgsl_busy.c)
add_library(termux SHARED termux/termux.c)
# An executable packaged as a library: the only place a targetSdk 29+ app may execute files from.
add_library(ddexec SHARED ddexec/ddexec.c)
target_compile_options(ddexec PRIVATE -O2 -ffreestanding -fno-builtin -fno-stack-protector -fno-asynchronous-unwind-tables)
target_link_options(ddexec PRIVATE -nostdlib -Wl,-e,_start -Wl,-z,noexecstack -Wl,--no-undefined -Wl,-Bsymbolic
-Wl,-z,max-page-size=16384)
add_library(ddvenc SHARED venc/venc_server.cpp)
target_compile_features(ddvenc PRIVATE cxx_std_17)
target_link_libraries(ddvenc mediandk log)
+274
View File
@@ -0,0 +1,274 @@
// libddexec.so: starts an ELF program from the app's data directory.
//
// usage: libddexec.so <file> <argv0> [args...]
//
// From targetSdk 29, Android refuses execve() of app data files, but still lets the app map them
// executable, and executes the APK's extracted libraries. This executable is one of those libraries:
// it maps <file> (and its PT_INTERP, if it names one) the way the kernel's ELF loader would, builds the
// stack the kernel would have built for "<argv0> [args...]", and jumps to the entry point.
// It is freestanding: no libc, no relocations, so the kernel can run it as a static PIE.
#include <elf.h>
#include <stddef.h>
#include <stdint.h>
#define SYS_faccessat 48
#define SYS_openat 56
#define SYS_close 57
#define SYS_pread64 67
#define SYS_write 64
#define SYS_exit_group 94
#define SYS_munmap 215
#define SYS_mmap 222
#define SYS_mprotect 226
#define AT_FDCWD_ (-100)
#define O_RDONLY_ 0
#define O_CLOEXEC_ 02000000
#define PROT_READ_ 1
#define PROT_WRITE_ 2
#define PROT_EXEC_ 4
#define MAP_PRIVATE_ 0x02
#define MAP_FIXED_ 0x10
#define MAP_ANONYMOUS_ 0x20
#define MAX_PHDRS 64
#define STACK_GAP 65536
static long sys6(long n, long a, long b, long c, long d, long e, long f) {
register long x8 __asm__("x8") = n;
register long x0 __asm__("x0") = a;
register long x1 __asm__("x1") = b;
register long x2 __asm__("x2") = c;
register long x3 __asm__("x3") = d;
register long x4 __asm__("x4") = e;
register long x5 __asm__("x5") = f;
__asm__ volatile("svc #0" : "+r"(x0) : "r"(x8), "r"(x1), "r"(x2), "r"(x3), "r"(x4), "r"(x5) : "memory", "cc");
return x0;
}
static size_t slen(const char *s) {
size_t n = 0;
while (s[n]) n++;
return n;
}
static void out(const char *s) { sys6(SYS_write, 2, (long)s, (long)slen(s), 0, 0, 0); }
static void out_num(long v) {
char buf[24];
int i = (int)sizeof(buf) - 1;
buf[i] = 0;
unsigned long u = v < 0 ? (unsigned long)-v : (unsigned long)v;
do {
buf[--i] = (char)('0' + u % 10);
u /= 10;
} while (u && i > 1);
if (v < 0) buf[--i] = '-';
out(buf + i);
}
__attribute__((noreturn)) static void die(const char *what, const char *path, long err) {
out("libddexec: ");
if (path) {
out(path);
out(": ");
}
out(what);
if (err) {
out(" (");
out_num(err);
out(")");
}
out("\n");
sys6(SYS_exit_group, 127, 0, 0, 0, 0, 0);
__builtin_unreachable();
}
static long xpread(int fd, void *buf, size_t len, long off) {
size_t done = 0;
while (done < len) {
long n = sys6(SYS_pread64, fd, (long)((char *)buf + done), (long)(len - done), off + (long)done, 0, 0);
if (n <= 0) return n < 0 ? n : -1;
done += (size_t)n;
}
return (long)done;
}
struct image {
uintptr_t base;
uintptr_t phdr;
uintptr_t entry;
unsigned long phnum;
unsigned long phent;
char interp[256];
};
static uintptr_t trunc_page(uintptr_t v, uintptr_t page) { return v & ~(page - 1); }
static uintptr_t round_page(uintptr_t v, uintptr_t page) { return (v + page - 1) & ~(page - 1); }
static int prot_of(uint32_t flags) {
return ((flags & PF_R) ? PROT_READ_ : 0) | ((flags & PF_W) ? PROT_WRITE_ : 0) | ((flags & PF_X) ? PROT_EXEC_ : 0);
}
static void map_failed(const char *path, long r) { die("cannot map a segment", path, r); }
static void load(const char *path, struct image *im, uintptr_t page) {
int fd = (int)sys6(SYS_openat, AT_FDCWD_, (long)path, O_RDONLY_ | O_CLOEXEC_, 0, 0, 0);
if (fd < 0) die("cannot open", path, fd);
Elf64_Ehdr eh;
if (xpread(fd, &eh, sizeof(eh), 0) != (long)sizeof(eh)) die("not an ELF file", path, 0);
if (eh.e_ident[EI_MAG0] != ELFMAG0 || eh.e_ident[EI_MAG1] != ELFMAG1 || eh.e_ident[EI_MAG2] != ELFMAG2 ||
eh.e_ident[EI_MAG3] != ELFMAG3 || eh.e_ident[EI_CLASS] != ELFCLASS64 || eh.e_machine != EM_AARCH64 ||
(eh.e_type != ET_EXEC && eh.e_type != ET_DYN) || eh.e_phentsize != sizeof(Elf64_Phdr) ||
eh.e_phnum == 0 || eh.e_phnum > MAX_PHDRS)
die("not a 64-bit ARM ELF program", path, 0);
Elf64_Phdr ph[MAX_PHDRS];
long size = (long)eh.e_phnum * (long)sizeof(Elf64_Phdr);
if (xpread(fd, ph, (size_t)size, (long)eh.e_phoff) != size) die("truncated program headers", path, 0);
uintptr_t lo = UINTPTR_MAX, hi = 0;
for (int i = 0; i < eh.e_phnum; i++) {
if (ph[i].p_type != PT_LOAD) continue;
uintptr_t s = trunc_page(ph[i].p_vaddr, page), e = round_page(ph[i].p_vaddr + ph[i].p_memsz, page);
if (s < lo) lo = s;
if (e > hi) hi = e;
}
if (lo >= hi) die("no loadable segments", path, 0);
uintptr_t bias = 0;
if (eh.e_type == ET_DYN) {
long r = sys6(SYS_mmap, 0, (long)(hi - lo), 0, MAP_PRIVATE_ | MAP_ANONYMOUS_, -1, 0);
if (r < 0 && r > -4096) map_failed(path, r);
bias = (uintptr_t)r - lo;
}
for (int i = 0; i < eh.e_phnum; i++) {
Elf64_Phdr *p = &ph[i];
if (p->p_type != PT_LOAD || p->p_memsz == 0) continue;
int prot = prot_of(p->p_flags);
uintptr_t seg = bias + p->p_vaddr;
uintptr_t start = trunc_page(seg, page);
uintptr_t file_end = seg + p->p_filesz;
uintptr_t mem_end = round_page(seg + p->p_memsz, page);
int zero_tail = p->p_memsz > p->p_filesz && (file_end & (page - 1)) != 0;
if (p->p_filesz > 0) {
uintptr_t len = round_page(file_end, page) - start;
long r = sys6(SYS_mmap, (long)start, (long)len, prot | (zero_tail ? PROT_WRITE_ : 0),
MAP_PRIVATE_ | MAP_FIXED_, fd, (long)trunc_page(p->p_offset, page));
if (r < 0 && r > -4096) map_failed(path, r);
if (zero_tail) {
for (volatile char *z = (volatile char *)file_end; (uintptr_t)z < round_page(file_end, page); z++) *z = 0;
if (!(prot & PROT_WRITE_)) sys6(SYS_mprotect, (long)trunc_page(file_end, page), (long)page, prot, 0, 0, 0);
}
}
uintptr_t anon = p->p_filesz > 0 ? round_page(file_end, page) : start;
if (mem_end > anon) {
long r = sys6(SYS_mmap, (long)anon, (long)(mem_end - anon), prot, MAP_PRIVATE_ | MAP_FIXED_ | MAP_ANONYMOUS_, -1, 0);
if (r < 0 && r > -4096) map_failed(path, r);
}
}
im->base = bias;
im->entry = bias + eh.e_entry;
im->phnum = eh.e_phnum;
im->phent = eh.e_phentsize;
im->phdr = 0;
im->interp[0] = 0;
for (int i = 0; i < eh.e_phnum; i++) {
if (ph[i].p_type == PT_PHDR) im->phdr = bias + ph[i].p_vaddr;
if (ph[i].p_type == PT_INTERP) {
if (ph[i].p_filesz == 0 || ph[i].p_filesz >= sizeof(im->interp)) die("bad PT_INTERP", path, 0);
if (xpread(fd, im->interp, ph[i].p_filesz, (long)ph[i].p_offset) != (long)ph[i].p_filesz)
die("truncated PT_INTERP", path, 0);
im->interp[ph[i].p_filesz] = 0;
}
}
if (!im->phdr) {
for (int i = 0; i < eh.e_phnum; i++) {
Elf64_Phdr *p = &ph[i];
if (p->p_type == PT_LOAD && eh.e_phoff >= p->p_offset && eh.e_phoff < p->p_offset + p->p_filesz) {
im->phdr = bias + p->p_vaddr + (eh.e_phoff - p->p_offset);
break;
}
}
}
if (!im->phdr) die("program headers are not in a loaded segment", path, 0);
sys6(SYS_close, fd, 0, 0, 0, 0, 0);
}
static unsigned long auxv_get(const uintptr_t *auxv, unsigned long type, unsigned long fallback) {
for (; auxv[0] != AT_NULL; auxv += 2)
if (auxv[0] == type) return auxv[1];
return fallback;
}
__attribute__((used, noreturn)) void ddexec_main(uintptr_t *sp) {
long argc = (long)sp[0];
char **argv = (char **)(sp + 1);
char **envp = argv + argc + 1;
long nenv = 0;
while (envp[nenv]) nenv++;
uintptr_t *auxv = (uintptr_t *)(envp + nenv + 1);
long naux = 0;
while (auxv[naux * 2] != AT_NULL) naux++;
if (argc < 3) die("usage: libddexec.so <file> <argv0> [args...]", 0, 0);
uintptr_t page = auxv_get(auxv, AT_PAGESZ, 4096);
const char *path = argv[1];
struct image prog, interp;
load(path, &prog, page);
int has_interp = prog.interp[0] != 0;
if (has_interp) load(prog.interp, &interp, page);
// The new stack: argc, argv, envp and auxv as the kernel lays them out, below the current one.
// The strings stay where the kernel put them.
static const unsigned long replaced[] = {AT_PHDR, AT_PHENT, AT_PHNUM, AT_BASE, AT_ENTRY, AT_EXECFN};
long nreplaced = (long)(sizeof(replaced) / sizeof(replaced[0]));
long new_argc = argc - 2;
long words = 1 + (new_argc + 1) + (nenv + 1) + (naux + nreplaced + 1) * 2;
uintptr_t *nsp = (uintptr_t *)(((uintptr_t)sp - STACK_GAP - (uintptr_t)words * sizeof(uintptr_t)) & ~(uintptr_t)15);
uintptr_t *w = nsp;
*w++ = (uintptr_t)new_argc;
for (long i = 0; i < new_argc; i++) *w++ = (uintptr_t)argv[i + 2];
*w++ = 0;
for (long i = 0; i < nenv; i++) *w++ = (uintptr_t)envp[i];
*w++ = 0;
for (long i = 0; i < naux; i++) {
unsigned long type = auxv[i * 2];
int skip = 0;
for (long r = 0; r < nreplaced; r++)
if (type == replaced[r]) skip = 1;
if (skip) continue;
*w++ = type;
*w++ = auxv[i * 2 + 1];
}
*w++ = AT_PHDR;
*w++ = prog.phdr;
*w++ = AT_PHENT;
*w++ = prog.phent;
*w++ = AT_PHNUM;
*w++ = prog.phnum;
*w++ = AT_BASE;
*w++ = has_interp ? interp.base : 0;
*w++ = AT_ENTRY;
*w++ = prog.entry;
*w++ = AT_EXECFN;
*w++ = (uintptr_t)path;
*w++ = AT_NULL;
*w++ = 0;
uintptr_t entry = has_interp ? interp.entry : prog.entry;
__asm__ volatile("mov sp, %0\n"
"mov x0, #0\n"
"br %1\n"
:
: "r"(nsp), "r"(entry)
: "memory");
__builtin_unreachable();
}
__attribute__((naked, noreturn)) void _start(void) {
__asm__ volatile("mov x0, sp\n"
"and sp, x0, #~15\n"
"bl ddexec_main\n");
}
+115 -11
View File
@@ -438,25 +438,31 @@ __attribute__((constructor)) static void library_init() {
controller_map();
}
__attribute__((visibility("hidden"))) static void
send_vibration(int strong, int weak, uint16_t duration_ms, uint16_t slot) {
if (!fake_vibration_enabled())
return;
int sock = socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
__attribute__((visibility("hidden"))) static int connect_app_socket(const char *name, int flags) {
int sock = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC | flags, 0);
if (sock < 0)
return;
return -1;
struct sockaddr_un addr = {};
addr.sun_family = AF_UNIX;
const char *name = "droiddeck-rumble";
memcpy(addr.sun_path + 1, name, strlen(name));
socklen_t addrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(name);
if (connect(sock, reinterpret_cast<struct sockaddr *>(&addr), addrlen) < 0) {
syscall(SYS_close, sock);
return;
return -1;
}
return sock;
}
__attribute__((visibility("hidden"))) static void
send_vibration(int strong, int weak, uint16_t duration_ms, uint16_t slot) {
if (!fake_vibration_enabled())
return;
int sock = connect_app_socket("droiddeck-rumble", SOCK_NONBLOCK);
if (sock < 0)
return;
uint16_t data[4];
data[0] = static_cast<uint16_t>(strong);
@@ -927,6 +933,7 @@ struct UinputWriter {
std::vector<struct input_event> pending;
uint32_t buttons = 0;
int16_t axes[8] = {};
int desktop = -1;
};
static std::unordered_map<int, std::shared_ptr<UinputWriter>> &uinput_map() {
@@ -963,6 +970,95 @@ __attribute__((visibility("hidden"))) static bool is_gamepad(const UinputDescrip
test_bit(d.evbits, sizeof(d.evbits), EV_ABS) && test_bit(d.absbits, sizeof(d.absbits), ABS_X);
}
static constexpr const char *DESKTOP_INPUT_SOCKET = "droiddeck-uinput";
static constexpr uint32_t DESKTOP_INPUT_MAGIC = 0x4655444b;
static constexpr int DESKTOP_INPUT_SEND_TIMEOUT_MS = 200;
struct DesktopInputHeader {
uint32_t magic;
int32_t abs_x_min, abs_x_max, abs_y_min, abs_y_max;
};
struct DesktopInputEvent {
uint16_t type;
uint16_t code;
int32_t value;
};
static_assert(sizeof(DesktopInputHeader) == 20 && sizeof(DesktopInputEvent) == 8,
"desktop input records must stay ABI-stable");
__attribute__((visibility("hidden"))) static bool has_keyboard_keys(const UinputDescription &d) {
for (int code = KEY_ESC; code < BTN_MISC; code++)
if (test_bit(d.keybits, sizeof(d.keybits), code)) return true;
return false;
}
__attribute__((visibility("hidden"))) static bool is_absolute_pointer(const UinputDescription &d) {
return test_bit(d.evbits, sizeof(d.evbits), EV_ABS) && test_bit(d.absbits, sizeof(d.absbits), ABS_X) &&
test_bit(d.absbits, sizeof(d.absbits), ABS_Y) &&
(test_bit(d.keybits, sizeof(d.keybits), BTN_LEFT) || test_bit(d.keybits, sizeof(d.keybits), BTN_TOUCH)) &&
d.absinfo[ABS_X].maximum > d.absinfo[ABS_X].minimum && d.absinfo[ABS_Y].maximum > d.absinfo[ABS_Y].minimum;
}
__attribute__((visibility("hidden"))) static bool is_desktop_input(const UinputDescription &d) {
return test_bit(d.evbits, sizeof(d.evbits), EV_KEY) &&
(has_keyboard_keys(d) || test_bit(d.keybits, sizeof(d.keybits), BTN_LEFT) || is_absolute_pointer(d));
}
__attribute__((visibility("hidden"))) static bool send_all(int sock, const void *data, size_t size) {
const auto *bytes = static_cast<const uint8_t *>(data);
while (size > 0) {
ssize_t sent = send(sock, bytes, size, MSG_NOSIGNAL);
if (sent < 0 && errno == EINTR) continue;
if (sent <= 0) return false;
bytes += sent;
size -= static_cast<size_t>(sent);
}
return true;
}
__attribute__((visibility("hidden"))) static void close_desktop_input(UinputWriter &w) {
if (w.desktop < 0) return;
syscall(SYS_close, w.desktop);
w.desktop = -1;
}
__attribute__((visibility("hidden"))) static int connect_desktop_input(const UinputDescription &d) {
int sock = connect_app_socket(DESKTOP_INPUT_SOCKET, 0);
if (sock < 0) return -1;
struct timeval timeout = {0, DESKTOP_INPUT_SEND_TIMEOUT_MS * 1000};
setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout));
bool absolute = is_absolute_pointer(d);
DesktopInputHeader header = {DESKTOP_INPUT_MAGIC,
absolute ? d.absinfo[ABS_X].minimum : 0,
absolute ? d.absinfo[ABS_X].maximum : 0,
absolute ? d.absinfo[ABS_Y].minimum : 0,
absolute ? d.absinfo[ABS_Y].maximum : 0};
if (!send_all(sock, &header, sizeof(header))) {
syscall(SYS_close, sock);
return -1;
}
return sock;
}
__attribute__((visibility("hidden"))) static void forward_desktop_input(UinputWriter &w) {
if (w.desktop < 0 || w.pending.empty()) return;
DesktopInputEvent events[64];
size_t count = 0;
for (const struct input_event &ev : w.pending) {
events[count++] = {ev.type, ev.code, ev.value};
if (count == sizeof(events) / sizeof(events[0]) || &ev == &w.pending.back()) {
if (!send_all(w.desktop, events, count * sizeof(events[0]))) {
Logger::log("uinput: \"%s\" lost the desktop compositor: %s\n", w.description.name, strerror(errno));
close_desktop_input(w);
return;
}
count = 0;
}
}
}
__attribute__((visibility("hidden"))) static void unpublish_uinput(UinputWriter &w) {
if (!w.published) return;
__atomic_add_fetch(&w.ring->generation, 1, __ATOMIC_RELEASE);
@@ -1058,6 +1154,7 @@ __attribute__((visibility("hidden"))) static int publish_uinput(UinputWriter &w)
}
__attribute__((visibility("hidden"))) static void flush_uinput(UinputWriter &w) {
forward_desktop_input(w);
if (!w.published || w.pending.empty()) {
w.pending.clear();
return;
@@ -1149,6 +1246,7 @@ ioctl_uinput(UinputWriter &w, ioctl_request_t op, void *argp) {
}
if (number == _IOC_NR(UI_DEV_DESTROY)) {
if (getpid() == w.owner) unpublish_uinput(w);
close_desktop_input(w);
w.created = false;
return 0;
}
@@ -1192,8 +1290,13 @@ ioctl_uinput(UinputWriter &w, ioctl_request_t op, void *argp) {
case _IOC_NR(UI_DEV_CREATE):
w.created = true;
if (!is_gamepad(d)) {
Logger::log("uinput: \"%s\" %04x:%04x is not a gamepad; its events are dropped\n", d.name,
d.id.vendor, d.id.product);
if (is_desktop_input(d)) w.desktop = connect_desktop_input(d);
if (w.desktop >= 0)
Logger::log("uinput: \"%s\" %04x:%04x goes to the desktop compositor\n", d.name, d.id.vendor,
d.id.product);
else
Logger::log("uinput: \"%s\" %04x:%04x is not a gamepad; its events are dropped\n", d.name,
d.id.vendor, d.id.product);
return 0;
}
if (publish_uinput(w) < 0) {
@@ -1221,6 +1324,7 @@ __attribute__((visibility("hidden"))) static void close_uinput(int fd) {
auto it = uinput_map().find(fd);
if (it == uinput_map().end()) return;
if (getpid() == it->second->owner) unpublish_uinput(*it->second);
close_desktop_input(*it->second);
uinput_map().erase(it);
}
+93 -3
View File
@@ -305,6 +305,14 @@ static int g_fallback_armed;
volatile int g_fps_limit;
volatile int g_release_unpaced;
volatile int g_bfi;
volatile int g_bfi_picture_hold;
static int g_bfi_running;
static unsigned g_bfi_phase;
static const char *g_bfi_blocked;
static int g_scene_layer_only;
static struct { unsigned lit, dark, failed; } g_bfi_stats;
volatile int g_hide_shell;
volatile int g_zero_copy;
@@ -2278,6 +2286,10 @@ static void render_scene(void) {
if (hdr_route == 3) { fx_on = 0; framegen = 0; }
struct surface *ahb_only = ahb_layer_only_candidate(w, h);
struct surface *layer_only = ahb_only ? ahb_only : hdr_unimported_fullscreen(&dl, w, h);
g_scene_layer_only = hdr_route == 3 || layer_only;
const int bfi = g_bfi_running && !g_scene_layer_only;
/* The compositor pass BFI needs is route 2; a fullscreen HDR scene on route 0 would lose its HDR there too. */
if (bfi && (hdr_route == 1 || (hdr_route == 0 && hs.n_hdr > 0))) hdr_route = 2;
const int cursor_on = hdr_route == 3 || layer_only ? 0 : add_cursor(&dl, w);
static int cursor_layer_said;
if (layer_only && atomic_load(&g_cursor_composite) && !cursor_layer_said) {
@@ -2328,19 +2340,21 @@ static void render_scene(void) {
rendered = vkp_render(w, h, dl.d, dl.n) == 0;
} else if (hdr_route == 0 || hdr_route == 3) {
const int pass_on = fx_on || framegen;
int li = (g_zero_copy && !framegen && !cardboard && !cursor_on) ? layer_candidate(&dl, w, h) : -1;
int li = (g_zero_copy && !framegen && !bfi && !cardboard && !cursor_on) ? layer_candidate(&dl, w, h) : -1;
int over = li >= 0 ? dl.n - 1 - li : 0;
const int fx_blocks = (li >= 0 && fx_on && over > 0);
if (fx_blocks) { li = -1; over = 0; }
const int ov_blocks = (li >= 0 && over > 0 && !fx_blocks && !sc_layer_overlay_affordable());
if (ov_blocks) { li = -1; over = 0; }
const int blocked = framegen ? 1 : (fx_blocks ? 2 : (ov_blocks ? 3 : 0));
const int blocked = framegen ? 1 : bfi ? 4 : (fx_blocks ? 2 : (ov_blocks ? 3 : 0));
if (g_zero_copy && !cursor_on && blocked != g_zero_copy_paused) {
g_zero_copy_paused = blocked;
if (blocked == 1)
droiddeck_log("framegen", "zero-copy paused: frame generation needs the compositor pass");
else if (blocked == 2)
droiddeck_log("effects", "zero-copy paused: a window above the game needs the compositor pass for the whole scene");
else if (blocked == 4)
droiddeck_log("bfi", "zero-copy paused: black frame insertion needs the compositor pass");
else if (blocked == 3)
droiddeck_log("layer", "zero-copy paused: a window above the game would need a second display layer, "
"which this display cannot compose in hardware - whole scene on the copy path");
@@ -2351,6 +2365,7 @@ static void render_scene(void) {
if (li < 0) ls = layer_only;
if (cardboard) ls = NULL;
if (cursor_on) ls = NULL;
if (bfi) ls = NULL;
if (ls && pass_on && li < 0 && !g_zero_copy_fx_skip_said) {
g_zero_copy_fx_skip_said = 1;
droiddeck_log(framegen ? "framegen" : "effects",
@@ -2392,6 +2407,7 @@ static void render_scene(void) {
: fx_blocks ? "a window is above it and screen effects need the whole scene"
: !g_zero_copy ? "zero-copy presentation is off"
: framegen ? "frame generation needs the compositor pass"
: bfi ? "black frame insertion needs the compositor pass"
: "it is not the one fullscreen window (only that one gets its own display layer)";
}
}
@@ -2434,7 +2450,8 @@ static int on_fallback_timer(void *data) {
}
static int commit_renders_on(void) {
return g_render_on_commit && g_release_unpaced && !atomic_load(&g_stream_on) && !vkp_framegen_active();
return g_render_on_commit && g_release_unpaced && !atomic_load(&g_stream_on) && !vkp_framegen_active() &&
!g_bfi_running;
}
static int render_on_commit(void) {
@@ -2470,6 +2487,61 @@ static void on_commit_idle(void *data) {
render_scene();
}
/* Black frame insertion strobes on the display's refresh tick and paces the game to the lit refresh,
* the design of BFI Presenter by artzox (https://github.com/artzox/BFI-Presenter, GPL-3.0), after Blur Busters'
* research on MPRT and motion blur (https://blurbusters.com). No BFI Presenter code is used. */
/* The panel's refresh from its display mode, not the measured tick rate: BFI's own presents can make ticks run
* late under load, and a measured rate would then dip under the limit and switch BFI off and on many times a
* second. 99 Hz lets panels that report 99.9 Hz for 100 Hz through. */
#define BFI_MIN_REFRESH_MHZ 99000
static const char *bfi_blocked(void) {
if (atomic_load(&g_stream_on)) return "the picture is being streamed";
if (vkp_framegen_active()) return "frame generation is on";
if (vkp_cardboard_active()) return "Cardboard VR is on";
if (vkp_quest_layer_presentation()) return "this headset composes its own layers";
if (g_scene_layer_only) return "the game's frames cannot be imported, so it is shown on its own display layer";
if (atomic_load(&g_output_refresh_mhz) < BFI_MIN_REFRESH_MHZ) return "the screen runs below 100 Hz";
return NULL;
}
static void bfi_update(void) {
const char *why = g_bfi ? bfi_blocked() : NULL;
const int run = g_bfi && !why;
if (g_bfi && why && why != g_bfi_blocked)
droiddeck_log("bfi", "black frame insertion waits: %s", why);
g_bfi_blocked = why;
if (run == g_bfi_running) return;
g_bfi_running = run;
g_bfi_phase = 0;
g_dirty = 1;
if (run) {
const int mhz = atomic_load(&g_output_refresh_mhz);
droiddeck_log("bfi", "black frame insertion on: %.0f Hz screen, a black refresh after every picture, "
"the game is paced to %.0f fps", mhz / 1000.0, mhz / 2000.0);
} else {
/* Lit refreshes advanced the frame deadline without being held to it; a stale one would stall rendering. */
g_scene_due_ns = 0;
droiddeck_log("bfi", "black frame insertion off");
}
}
static void bfi_tick(void) {
/* A capture copies the surface's last buffer: present pictures only, still composed into that surface. */
if (g_bfi_picture_hold) {
g_bfi_phase = 0;
g_bfi_stats.lit++;
render_scene();
} else if ((g_bfi_phase++ & 1) == 0) {
g_bfi_stats.lit++;
render_scene();
} else if (vkp_render_plain(g_scene_w, g_scene_h) == 0) {
g_bfi_stats.dark++;
} else {
g_bfi_stats.failed++;
}
}
static void on_vsync(int64_t frame_time_ns) {
int64_t now = now_ns();
g_perf.ticks++;
@@ -2491,6 +2563,12 @@ static void on_vsync(int64_t frame_time_ns) {
if (vkp_effects_sync()) tick_change = 1;
if (vkp_cardboard_pose_changed()) tick_change = 1;
if (tick_change) g_dirty = 1;
bfi_update();
if (g_bfi_running) {
g_tick_held = 0;
bfi_tick();
return;
}
if (g_tick_held && g_dirty) g_hold_missed_ns = now;
g_tick_held = 0;
if (!tick_change && commit_renders_on() && g_dirty_since_ns && now - g_dirty_since_ns < g_refresh_ns &&
@@ -3540,6 +3618,12 @@ static void deliver_pen(const struct input_msg *m) {
static void key_event(uint32_t evdev, int pressed);
struct wl_resource *droiddeck_ime_target(void);
static void deliver_scene_pointer(int x, int y) {
int w, h;
scene_size(&w, &h);
pointer_event((double)x * w / INPUT_SPACE_W, (double)y * h / INPUT_SPACE_H, 0, 0);
}
static void deliver_key(const struct input_msg *m) {
key_event((uint32_t)m->p1, m->p2);
}
@@ -3690,6 +3774,7 @@ static int on_input_readable(int fd, uint32_t mask, void *data) {
case 11: axis_event(m.p1, m.p2, 0); break;
case 12: axis_event(m.p1, m.p2, 1); break;
case 13: deliver_pen(&m); break;
case 14: deliver_scene_pointer(m.p1, m.p2); break;
case 20: stream_take(); break;
case 21: if (!m.p1) stream_forget_all(); schedule_render(); break;
case 22: schedule_render(); break;
@@ -3862,6 +3947,11 @@ static int on_stats_timer(void *data) {
g_pace.renders, g_pace.commit_renders, (unsigned long long)game, g_pace.reattaches, g_pace.null_attaches, g_pace.distinct,
g_pace.presented, g_pace.replaced, g_pace.undrawn);
}
if (g_bfi_stats.lit || g_bfi_stats.dark || g_bfi_stats.failed) {
droiddeck_log("bfi", "last 10 s: %u pictures, %u black refreshes, %u black refreshes not presented",
g_bfi_stats.lit, g_bfi_stats.dark, g_bfi_stats.failed);
memset(&g_bfi_stats, 0, sizeof(g_bfi_stats));
}
{
const uint64_t seen = g_game_frames;
memset(&g_pace, 0, sizeof(g_pace));
+11 -2
View File
@@ -13,6 +13,7 @@
#include "quest_device.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <sys/system_properties.h>
#include <unistd.h>
@@ -416,7 +417,13 @@ static void update_map(int scene_w, int scene_h) {
if (mode == VKP_MODE_FILL) aspect = sx > sy ? sx : sy;
else if (mode == VKP_MODE_INTEGER) {
float m = sx < sy ? sx : sy;
aspect = m >= 1.0f ? (float)(int)m : m;
float nearest = roundf(m);
if (nearest >= 1.0f && nearest > m &&
nearest - m < 0.15f) {
aspect = nearest;
} else {
aspect = m >= 1.0f ? (float)(int)m : m;
}
} else aspect = sx < sy ? sx : sy;
g_map.kx = g_map.ky = aspect;
g_map.off_x = (float)(g_map.rx + (int)((g_map.rw - scene_w * aspect) * 0.5f));
@@ -1999,7 +2006,9 @@ static int render_impl(int scene_w, int scene_h, const struct vkp_draw *draws, i
1 + vkp_framegen_extra_images(), vkp_framegen_extra_images() ? "s" : "");
destroy_swapchain();
}
const int want_hdr = hf && !hf->tonemap && g_colorspace_ext && !g_swap_hdr_unavailable;
/* A black refresh carries no HDR frame; it keeps the swapchain's colour mode rather than flipping it. */
const int want_hdr = (g_plain_frame && !hf) ? (g_swapchain && g_swap_is_hdr)
: (hf && !hf->tonemap && g_colorspace_ext && !g_swap_hdr_unavailable);
if (g_swapchain && want_hdr != g_swap_is_hdr) {
droiddeck_log("color", want_hdr ? "HDR frames with frame generation: rebuilding the screen swapchain as HDR10"
: hf ? "HDR output switched off: rebuilding the screen swapchain as SDR (frames tone-mapped)"
@@ -42,6 +42,8 @@ extern void droiddeck_wayland_set_output_refresh_rate(int mhz);
extern volatile int g_fps_limit;
extern volatile int g_release_unpaced;
extern volatile int g_render_on_commit;
extern volatile int g_bfi;
extern volatile int g_bfi_picture_hold;
extern volatile int g_hide_shell;
extern volatile int g_zero_copy;
extern volatile unsigned g_zero_copy_last;
@@ -669,6 +671,17 @@ Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetRenderOnCommit(JN
__android_log_print(ANDROID_LOG_INFO, TAG, "render on commit %s", on ? "on" : "off");
}
JNIEXPORT void JNICALL
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetBlackFrameInsertion(JNIEnv *env, jclass clazz, jboolean on) {
g_bfi = on ? 1 : 0;
__android_log_print(ANDROID_LOG_INFO, TAG, "black frame insertion %s", on ? "requested" : "off");
}
JNIEXPORT void JNICALL
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetPictureHold(JNIEnv *env, jclass clazz, jboolean on) {
g_bfi_picture_hold = on ? 1 : 0;
}
JNIEXPORT void JNICALL
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetFpsLimit(JNIEnv *env, jclass clazz, jint fps) {
g_fps_limit = fps > 0 ? fps : 0;
@@ -20,6 +20,7 @@ class App : Application() {
override fun onCreate() {
super.onCreate()
com.droiddeck.launcher.runtime.NativeGuest.init(this)
Thread({ runCatching { EnhancedSessionLogShare.cleanupAbandonedStages(this) } }, "diagnostic-stage-cleanup").start()
com.droiddeck.launcher.ui.Themes.loadGradient(this)
com.droiddeck.launcher.ui.BuildWatermark.install(this)
@@ -82,7 +83,7 @@ class App : Application() {
Thread({
runCatching {
if (com.droiddeck.launcher.runtime.LinuxRuntime.rootDir(app).isDirectory) {
com.droiddeck.launcher.core.AddonPack.PROOT.ensure(app)
if (!com.droiddeck.launcher.runtime.LinuxRuntime.patchedProot(app)) com.droiddeck.launcher.core.AddonPack.PROOT.ensure(app)
com.droiddeck.launcher.core.AddonPack.DIRECTAUDIO.ensure(app)
com.droiddeck.launcher.session.SessionFiles.ensureDirtStandIn(app)
}
@@ -1863,15 +1863,24 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
}
}
if (savedInstanceState == null) ui.post { startSteamAtStartupIfEnabled(cold = true) }
else {
val askAllFiles = Build.VERSION.SDK_INT >= 30 && com.droiddeck.launcher.files.AllFilesAccess.missing() &&
!SessionPrefs.allFilesAsked(this)
if (savedInstanceState == null) {
if (!askAllFiles) ui.post { startSteamAtStartupIfEnabled(cold = true) }
} else {
restoreCompatLaunch(savedInstanceState)
pendingSwitch = savedIntent(savedInstanceState, KEY_PENDING_SWITCH)
savedIntent(savedInstanceState, KEY_SWITCHING_TO)?.let { awaitSessionEnd(it, savedInstanceState.getLong(KEY_SWITCH_DEADLINE)) }
}
val wanted = ArrayList<String>()
if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
if (Build.VERSION.SDK_INT >= 30) {
// From targetSdk 30, shared storage outside the app's own folders is all-files access or nothing.
if (askAllFiles) {
SessionPrefs.setAllFilesAsked(this)
com.droiddeck.launcher.files.AllFilesAccess.open(this)
}
} else if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
wanted.add(Manifest.permission.WRITE_EXTERNAL_STORAGE)
}
if (SessionPrefs.micEnabled(this) && !SessionPrefs.micAsked(this)
@@ -500,6 +500,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
private var drawerGameProfileId by mutableStateOf<Long?>(null)
private var drawerGameProfileSelectionMade = false
private var fpsLimit by mutableStateOf(SessionState.fpsLimit)
private var blackFrameInsertion by mutableStateOf(false)
private fun noSteamSession(): Boolean = (SessionState.mode == SessionService.MODE_RUN &&
SessionState.program in setOf(
@@ -849,6 +850,11 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
}
SteamControllerBle.listener = { uiHandler.post { updatePadMotion(); refreshControls() } }
steamController = SteamControllerBle(this, inputRouter).also { it.start() }
if (Build.VERSION.SDK_INT >= 31 && checkSelfPermission(BLUETOOTH_CONNECT) != android.content.pm.PackageManager.PERMISSION_GRANTED &&
!SessionPrefs.bluetoothAsked(this)) {
SessionPrefs.setBluetoothAsked(this)
requestPermissions(arrayOf(BLUETOOTH_CONNECT), REQUEST_BLUETOOTH)
}
padMotion = com.droiddeck.launcher.input.PadMotion(this) {
@Suppress("DEPRECATION")
(if (Build.VERSION.SDK_INT >= 30) display else windowManager.defaultDisplay)?.rotation ?: android.view.Surface.ROTATION_0
@@ -1441,6 +1447,12 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
onHudReset = { hudConfig = DroidDeckHudConfig.reset(this@SessionActivity); hud.applyConfig() },
onHudOrderReset = { hudConfig = DroidDeckHudConfig.clearOrder(this@SessionActivity); hud.applyConfig() },
onHudExport = { exportHudDiagnostics() },
integerScaling = integerScaling,
onIntegerScaling = { enabled ->
SessionPrefs.setIntegerScaling(this@SessionActivity, enabled)
integerScaling = enabled
applyGameAlignment()
},
onUpscaler = { m ->
val target = effectsEditorTarget ?: screenEffectsTarget
val activeProfileId =
@@ -1588,6 +1600,13 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
fpsLimit = fps
applyOutputPacing()
},
blackFrameInsertion = blackFrameInsertion,
blackFrameInsertionAvailable = blackFrameInsertion || blackFrameInsertionAvailable(),
onBlackFrameInsertion = { on ->
SessionPrefs.setBlackFrameInsertion(this@SessionActivity, on)
blackFrameInsertion = on
CompositorHost.setBlackFrameInsertion(on, refreshHz(), outputFpsLimit())
},
onFrameGenPick = { mode ->
val appId = frameGenTargetGameId()
@@ -2402,6 +2421,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
picturePosition = SessionPrefs.picturePosition(this)
integerScaling = SessionPrefs.integerScaling(this)
hudOn = SessionPrefs.hudEnabled(this)
blackFrameInsertion = SessionPrefs.blackFrameInsertion(this)
hudConfig = DroidDeckHudConfig.load(this)
hudColor = SessionPrefs.hudColor(this)
hudOpacity = SessionPrefs.hudOpacity(this)
@@ -2871,6 +2891,17 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
return if (capped > 1f) capped else 60f
}
private fun blackFrameInsertionAvailable(): Boolean {
// Glasses that present the game run at their own rate, uncapped, as refreshHz() reads them.
glassesScreen?.display?.let { glasses ->
return (glasses.supportedModes?.maxOfOrNull { it.refreshRate } ?: 0f) >= PerfMode.BFI_MIN_REFRESH_HZ
}
val display = bottomGame?.takeIf { bottomOutputActive }?.display
?: if (Build.VERSION.SDK_INT >= 30) display else @Suppress("DEPRECATION") windowManager.defaultDisplay
val peak = display?.supportedModes?.maxOfOrNull { it.refreshRate } ?: 0f
return minOf(peak, PerfMode.peakRefreshCap(this)) >= PerfMode.BFI_MIN_REFRESH_HZ
}
private fun mirrorRefreshLimit(): Int =
GlassesRendering.mirrorRefreshLimit(glassesSettings, glasses, glassesScreen != null)
@@ -4194,19 +4225,35 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
onFrame(null)
return
}
try {
android.view.PixelCopy.request(source, bitmap, { result ->
if (result != android.view.PixelCopy.SUCCESS) {
bitmap.recycle()
onFrame(null)
} else onFrame(bitmap)
}, uiHandler)
} catch (_: IllegalArgumentException) {
bitmap.recycle()
onFrame(null)
withPictureFrame { done ->
try {
android.view.PixelCopy.request(source, bitmap, { result ->
done()
if (result != android.view.PixelCopy.SUCCESS) {
bitmap.recycle()
onFrame(null)
} else onFrame(bitmap)
}, uiHandler)
} catch (_: IllegalArgumentException) {
done()
bitmap.recycle()
onFrame(null)
}
}
}
/** PixelCopy reads the last queued buffer, which black frame insertion makes black every other refresh. */
private fun withPictureFrame(copy: (done: () -> Unit) -> Unit) {
if (!CompositorHost.holdPicture()) return copy {}
uiHandler.postDelayed({
var released = false
copy {
if (!released) CompositorHost.releasePicture()
released = true
}
}, BFI_PICTURE_SETTLE_MS)
}
private fun tapSteamButton() {
if (SessionState.mode == SessionService.MODE_STEAM) padBridge?.triggerSteamMenu()
}
@@ -5311,17 +5358,21 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
val left = surfaceAt[0] - overlayAt[0]
val top = surfaceAt[1] - overlayAt[1]
val bounds = android.graphics.Rect(left, top, left + width, top + height)
try {
android.view.PixelCopy.request(surfaceView, bitmap, { result ->
if (result == android.view.PixelCopy.SUCCESS && !isDestroyed) {
pausedFrame = com.droiddeck.launcher.ui.PausedFrame(bitmap.asImageBitmap(), bounds)
pausedFrameWanted = false
} else {
bitmap.recycle()
}
}, uiHandler)
} catch (_: IllegalArgumentException) {
bitmap.recycle()
withPictureFrame { done ->
try {
android.view.PixelCopy.request(surfaceView, bitmap, { result ->
done()
if (result == android.view.PixelCopy.SUCCESS && !isDestroyed) {
pausedFrame = com.droiddeck.launcher.ui.PausedFrame(bitmap.asImageBitmap(), bounds)
pausedFrameWanted = false
} else {
bitmap.recycle()
}
}, uiHandler)
} catch (_: IllegalArgumentException) {
done()
bitmap.recycle()
}
}
}
@@ -6314,8 +6365,17 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
finish()
}
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
if (requestCode != REQUEST_BLUETOOTH || grantResults.firstOrNull() != android.content.pm.PackageManager.PERMISSION_GRANTED) return
steamController?.stop()
steamController = SteamControllerBle(this, inputRouter).also { it.start() }
}
companion object {
const val EXTRA_RETURN_HOME = "returnHome"
private const val BLUETOOTH_CONNECT = "android.permission.BLUETOOTH_CONNECT"
private const val REQUEST_BLUETOOTH = 31
const val EXTRA_LINK_TASK = "linkTask"
const val EXTRA_STEAMVR = "steamVr"
const val EXTRA_PLAYED_GAME = "com.droiddeck.launcher.PLAYED_GAME"
@@ -6323,6 +6383,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
private const val LEAVE_TIMEOUT_MS = 1_500L
private const val TEXT_FIELD_TAP_MS = 1_000L
private const val PAUSED_FRAME_MAX_EDGE = 1920f
private const val BFI_PICTURE_SETTLE_MS = 50L
private const val PAUSED_FRAME_REDRAW_MS = 150L
private const val BOTTOM_RECOVERY_MS = 1_000L
private const val BOTTOM_RECOVERY_TRIES = 3
@@ -40,7 +40,11 @@ object AgentProcesses {
val now = SystemClock.elapsedRealtime()
val uptimeTicks = now * HZ / 1000
val elapsed = (now - lastAt).coerceAtLeast(1)
fun isProot(pid: Int) = args[pid].orEmpty().substringBefore(' ').endsWith("proot.so") || args[pid].orEmpty().substringBefore(' ').endsWith("/proot")
fun isProot(pid: Int): Boolean {
val argv = args[pid].orEmpty().split(' ')
val program = if (argv.first().endsWith("/linker64")) argv.getOrElse(1) { "" } else argv.first()
return program.endsWith("proot.so") || program.endsWith("/proot")
}
fun ancestors(pid: Int) = generateSequence(stats[pid]?.ppid) { stats[it]?.ppid }.takeWhile { it > 1 }.take(64)
val out = stats.values.filter { s ->
!isProot(s.pid) && args[s.pid].orEmpty().isNotEmpty() && ancestors(s.pid).any { isProot(it) }
@@ -168,7 +168,7 @@ public class PulseAudioComponent extends SessionPart {
env.add("HOME=" + workingDir);
env.add("TMPDIR=" + workingDir);
String command = workingDir.getAbsolutePath() + "/libpulseaudio.so"
String command = String.join(" ", HostProcess.dataExecutable(workingDir.getAbsolutePath() + "/libpulseaudio.so"))
+ " --system=false --disable-shm=true --fail=false"
+ " -n --file=default.pa --daemonize=false --use-pid-file=false --exit-idle-time=-1"
+ " --log-level=info";
@@ -259,7 +259,7 @@ public class PulseAudioComponent extends SessionPart {
try {
File modules = new File(workingDir, "modules/arm64");
ArrayList<String> cmd = new ArrayList<>();
cmd.add(pactl.getAbsolutePath());
cmd.addAll(HostProcess.dataExecutable(pactl.getAbsolutePath()));
java.util.Collections.addAll(cmd, args);
ProcessBuilder builder = new ProcessBuilder(cmd);
builder.directory(workingDir);
@@ -316,8 +316,9 @@ public class PulseAudioComponent extends SessionPart {
java.lang.Process process = null;
try {
File modules = new File(workingDir, "modules/arm64");
ProcessBuilder builder = new ProcessBuilder(
pactl.getAbsolutePath(), "suspend-" + kind, name, Boolean.toString(suspended));
ArrayList<String> argv = new ArrayList<>(HostProcess.dataExecutable(pactl.getAbsolutePath()));
argv.addAll(java.util.Arrays.asList("suspend-" + kind, name, Boolean.toString(suspended)));
ProcessBuilder builder = new ProcessBuilder(argv);
builder.directory(workingDir);
builder.redirectErrorStream(true);
builder.redirectOutput(new File("/dev/null"));
@@ -6,6 +6,12 @@ import java.util.function.Consumer
object HostProcess {
private const val TAG = "HostProcess"
private const val LINKER = "/system/bin/linker64"
/** Android 10+ refuses to execute app data files for targetSdk 29+; its linker still loads them. */
@JvmStatic
fun dataExecutable(path: String): List<String> =
if (android.os.Build.VERSION.SDK_INT >= 29) listOf(LINKER, path) else listOf(path)
@JvmStatic
fun start(command: String, env: Array<String>?, dir: File?, onExit: Consumer<Int>?, onLine: Consumer<String>?): Int =
@@ -384,7 +384,7 @@ object BwrapSpawner {
val program = plan.argv.firstOrNull()?.takeIf { it.startsWith("/") }?.let(::host)?.canonicalFile
?.takeIf { it.isFile && isStaticElf(it) } ?: return null
if (!linkMounts(plan)) return null
return (listOf(program.path) + plan.argv.drop(1)) to plan.env
return (NativeGuest.execPrefix(program.path) + listOf(program.path) + plan.argv.drop(1)) to plan.env
}
val loader = SANDBOX_LOADERS.map(::host).firstOrNull { it.isFile }?.canonicalFile ?: return null
val libc = SANDBOX_LIBCS.map(::host).firstOrNull { it.isFile }?.canonicalFile ?: return null
@@ -411,13 +411,14 @@ object BwrapSpawner {
plan.env.map { (k, v) -> "$k=$v" } + plan.argv
val env = linkedMapOf(
"DDNATV_ROOT" to sandbox,
"DDNATV_EXEC" to NativeGuest.execLoader.orEmpty(),
"DDNATV_LINK_ROOT" to rootfs.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 },
"LD_PRELOAD" to hook.path,
).filterValues { it.isNotEmpty() }
return (NativeGuest.simulator(rootfs)?.let { it + launch } ?: launch) to env
return (NativeGuest.simulator(rootfs)?.let { it + launch } ?: (NativeGuest.execPrefix(loader.path) + launch)) to env
}
private val runpathDirs = java.util.concurrent.ConcurrentHashMap<String, List<String>>()
@@ -542,7 +543,7 @@ object BwrapSpawner {
.also { b -> b.environment().apply { clear(); putAll(native.second) } }
} else {
val cmd = LinuxRuntime.prootPrefix(context, plan.root, plan.cwd)
if (verbose != null) { cmd.add(1, "-v"); cmd.add(2, verbose.toString()) }
if (verbose != null) { cmd.add("-v"); cmd.add(verbose.toString()) }
plan.binds.forEach { cmd.add("-b"); cmd.add(it.spec) }
val envTool = hasEnvTool(plan)
if (envTool) {
@@ -95,10 +95,13 @@ class DeviceControlsComponent(context: Context, root: File, private val activity
permissionNotified = false
context.contentResolver.registerContentObserver(Settings.System.CONTENT_URI, true, observer)
requests.startWatching()
context.registerReceiver(volumeSteps, IntentFilter().apply {
val volumeFilter = IntentFilter().apply {
addAction(VOLUME_CHANGED_ACTION)
addAction(STREAM_MUTE_CHANGED_ACTION)
}, null, handler)
}
if (android.os.Build.VERSION.SDK_INT >= 33)
context.registerReceiver(volumeSteps, volumeFilter, null, handler, Context.RECEIVER_NOT_EXPORTED)
else context.registerReceiver(volumeSteps, volumeFilter, null, handler)
refresh.run()
}
}
@@ -58,7 +58,7 @@ object GuestCommand {
NativeGuest.processBuilder(context, root, binds, guest).redirectErrorStream(true)
} else {
val cmd = LinuxRuntime.prootPrefix(context, root, "/root", fakeRoot)
if (linkDir != null) cmd.add(1, "--link2symlink")
if (linkDir != null) cmd.add("--link2symlink")
binds.forEach { cmd.add("-b"); cmd.add(it) }
cmd += guest
ProcessBuilder(cmd).directory(root).redirectErrorStream(true).also { b ->
@@ -106,13 +106,15 @@ class LinuxNetworkLinkComponent(
synchronized(lock) { writeNetworkState(currentProperties, currentCapabilities) }
}
}
appContext.registerReceiver(receiver, IntentFilter().apply {
val wifiFilter = IntentFilter().apply {
addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)
addAction(WifiManager.RSSI_CHANGED_ACTION)
addAction(WifiManager.WIFI_STATE_CHANGED_ACTION)
addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION)
addAction(LocationManager.MODE_CHANGED_ACTION)
})
}
if (android.os.Build.VERSION.SDK_INT >= 33) appContext.registerReceiver(receiver, wifiFilter, Context.RECEIVER_NOT_EXPORTED)
else appContext.registerReceiver(receiver, wifiFilter)
wifiReceiver = receiver
scanRequestStamp = File(rootDir, "etc/droiddeck-wifi-scan-request").lastModified()
scanHandler.post(scanRequests)
@@ -2,6 +2,7 @@ package com.droiddeck.launcher.runtime;
import com.droiddeck.launcher.core.AddonPack;
import android.content.Context;
import android.os.Build;
import android.os.Process;
import android.system.ErrnoException;
import android.system.Os;
@@ -77,7 +78,18 @@ public final class LinuxRuntime {
}
private static boolean rootfsProotReady(Context context) {
return rootfsProot(context).isFile() && rootfsLoader(context).isFile();
return Build.VERSION.SDK_INT < 29 && rootfsProot(context).isFile() && rootfsLoader(context).isFile();
}
/** proot execs its loader, and targetSdk 29+ may exec only the APK's libraries, which hold the pack's matching loader. */
public static boolean stockProotAllowed(Context context) {
return Build.VERSION.SDK_INT < 29 && SessionPrefs.allowStockProot(context);
}
/** Android 10+ refuses to execute files from app data for targetSdk 29+, but executes the APK's extracted libraries. */
private static File bundledLoader(Context context) {
File file = new File(context.getApplicationInfo().nativeLibraryDir, "libproot-loader.so");
return file.isFile() ? file : null;
}
public static boolean patchedProot(Context context) {
@@ -86,22 +98,21 @@ public final class LinuxRuntime {
public static File prootBinary(Context context) {
if (AddonPack.PROOT.installed(context)) return AddonPack.PROOT.file(context, "libproot.so");
if (SessionPrefs.allowStockProot(context)) return rootfsProot(context);
if (stockProotAllowed(context)) return rootfsProot(context);
return AddonPack.PROOT.file(context, "libproot.so");
}
public static File prootLoader(Context context) {
if (AddonPack.PROOT.installed(context)) return AddonPack.PROOT.file(context, "libproot-loader.so");
if (SessionPrefs.allowStockProot(context)) return rootfsLoader(context);
return AddonPack.PROOT.file(context, "libproot-loader.so");
File bundled = bundledLoader(context);
if (AddonPack.PROOT.installed(context)) return bundled != null ? bundled : AddonPack.PROOT.file(context, "libproot-loader.so");
if (stockProotAllowed(context)) return rootfsLoader(context);
return bundled != null ? bundled : AddonPack.PROOT.file(context, "libproot-loader.so");
}
public static String prootSource(Context context) {
File bin = prootBinary(context);
if (!bin.isFile()) return PROOT_MISSING;
if (AddonPack.PROOT.installed(context)
&& bin.getPath().equals(AddonPack.PROOT.file(context, "libproot.so").getPath())) return PROOT_PACK;
return PROOT_ROOTFS;
return patchedProot(context) && !bin.equals(rootfsProot(context)) ? PROOT_PACK : PROOT_ROOTFS;
}
public static String prootLibraryPath(Context context) {
@@ -183,13 +194,13 @@ public final class LinuxRuntime {
public static List<String> rootPrefix(Context context, File root, String cwd) {
List<String> cmd = prootPrefix(context, root, cwd, true);
cmd.add(1, "--link2symlink");
cmd.add("--link2symlink");
return cmd;
}
public static List<String> prootPrefix(Context context, File root, String cwd, boolean fakeRoot) {
List<String> cmd = new ArrayList<>();
cmd.add(prootBinary(context).getPath());
cmd.addAll(com.droiddeck.launcher.core.HostProcess.dataExecutable(prootBinary(context).getPath()));
cmd.add("--kill-on-exit");
cmd.add("--kernel-release=" + guestUtsname(SessionPrefs.guestHostname(context)));
int uid = Process.myUid();
@@ -384,7 +384,7 @@ public final class LinuxRuntimeInstaller {
String downloading = context.getString(R.string.rtinst_downloading);
if (listener != null) listener.onProgress(Step.DOWNLOADING, downloading, 0);
if (!LinuxRuntime.patchedProot(context) && !AddonPack.PROOT.await(context, () -> true, packProgress(listener, downloading))
&& !SessionPrefs.allowStockProot(context))
&& !LinuxRuntime.stockProotAllowed(context))
return fail("Cannot download proot", AddonPack.PROOT.getFailure());
if (!AddonPack.DIRECTAUDIO.await(context, () -> true, packProgress(listener, downloading)))
return fail("Cannot download DirectAudio", AddonPack.DIRECTAUDIO.getFailure());
@@ -50,6 +50,21 @@ object NativeGuest {
fun hook(root: File): File = File(root, HOOK)
/**
* libddexec.so, which starts the rootfs loader on Android 10+, where a targetSdk 29+ app may not
* execute its data files; null where the kernel still starts them directly.
*/
@Volatile var execLoader: String? = null
private set
/** What starts the program at [path] from the host: nothing before it, or [execLoader] and the path. */
fun execPrefix(path: String): List<String> = execLoader?.let { listOf(it, path) }.orEmpty()
fun init(context: Context) {
execLoader = File(context.applicationInfo.nativeLibraryDir, "libddexec.so")
.takeIf { android.os.Build.VERSION.SDK_INT >= 29 && it.isFile }?.path
}
fun loader(root: File): File? =
listOf("usr/lib/ld-linux-aarch64.so.1", "lib/ld-linux-aarch64.so.1").map { File(root, it) }.firstOrNull { it.exists() }
@@ -60,9 +75,10 @@ object NativeGuest {
/** Environment every native process starts with; a guest `env -i` is re-seeded by the hook. */
fun environment(root: File, preload: List<String> = emptyList()): Map<String, String> = linkedMapOf(
"DDNATV_ROOT" to root.path,
"DDNATV_EXEC" to execLoader.orEmpty(),
"LD_LIBRARY_PATH" to libraryPath(root),
"LD_PRELOAD" to (preload.map { File(root, it.removePrefix("/")).path } + hook(root).path).joinToString(":"),
)
).filterValues { it.isNotEmpty() }
/**
* The host command line for the guest program at [program] (an absolute guest path to a real
@@ -72,7 +88,7 @@ object NativeGuest {
val loader = checkNotNull(loader(root)) { "no glibc loader in ${root.path}" }
val host = File(root, program.removePrefix("/"))
val launch = listOf(loader.path, "--argv0", host.name, host.path) + args
return simulator(root)?.let { it + launch } ?: launch
return simulator(root)?.let { it + launch } ?: (execPrefix(loader.path) + launch)
}
/** The environment of the session process: the hook's root, the mounts proot used to make, the preload list. */
@@ -80,6 +96,7 @@ object NativeGuest {
val preload = preloadList(root)
return linkedMapOf(
"DDNATV_ROOT" to root.path,
"DDNATV_EXEC" to execLoader.orEmpty(),
"DDNATV_HOSTNAME" to hostname.orEmpty(),
"DDNATV_BINDS" to binds.joinToString("|") { if (it.contains(':')) it else "$it:$it" },
"DDNATV_PRELOAD" to preload.joinToString(":"),
@@ -0,0 +1,130 @@
package com.droiddeck.launcher.session
import com.droiddeck.launcher.input.HeldInput
import com.droiddeck.launcher.input.InputSpace
class DesktopUinputDevice(
private val absX: IntRange?,
private val absY: IntRange?,
private val sink: Sink,
private val keys: HeldInput,
private val buttons: HeldInput,
private val source: Int,
) {
interface Sink {
fun key(code: Int, down: Boolean)
fun button(code: Int, down: Boolean)
fun motion(dx: Int, dy: Int)
fun position(x: Int, y: Int)
fun wheel(vertical120: Int, horizontal120: Int)
}
private var dx = 0
private var dy = 0
private var x = -1
private var y = -1
private var moved = false
private var wheel = 0
private var hwheel = 0
private var wheelHiRes = 0
private var hwheelHiRes = 0
private var sawWheelHiRes = false
private var sawHwheelHiRes = false
fun event(type: Int, code: Int, value: Int) {
when (type) {
EV_SYN -> if (code == SYN_REPORT) report()
EV_KEY -> if (value != KEY_REPEAT) key(code, value != 0)
EV_REL -> relative(code, value)
EV_ABS -> absolute(code, value)
}
}
fun release() {
flushMotion()
keys.release(source)
buttons.release(source)
}
private fun key(code: Int, down: Boolean) {
val button = when {
code in BTN_LEFT..BTN_TASK -> code
code == BTN_TOUCH && absX != null -> BTN_LEFT
else -> null
}
if (button != null) {
flushMotion()
buttons.set(source, button, down)
return
}
if (code !in KEY_ESC until BTN_MISC && code !in KEY_OK..KEY_MAX) return
flushMotion()
keys.set(source, code, down)
}
private fun relative(code: Int, value: Int) {
when (code) {
REL_X -> dx += value
REL_Y -> dy += value
REL_WHEEL -> wheel += value
REL_HWHEEL -> hwheel += value
REL_WHEEL_HI_RES -> { wheelHiRes += value; sawWheelHiRes = true }
REL_HWHEEL_HI_RES -> { hwheelHiRes += value; sawHwheelHiRes = true }
}
}
private fun absolute(code: Int, value: Int) {
when (code) {
ABS_X -> absX?.let { x = scale(value, it, InputSpace.WIDTH); moved = true }
ABS_Y -> absY?.let { y = scale(value, it, InputSpace.HEIGHT); moved = true }
}
}
private fun report() {
flushMotion()
val vertical = if (sawWheelHiRes) -wheelHiRes else -wheel * WHEEL_UNITS
val horizontal = if (sawHwheelHiRes) hwheelHiRes else hwheel * WHEEL_UNITS
wheel = 0
hwheel = 0
wheelHiRes = 0
hwheelHiRes = 0
if (vertical != 0 || horizontal != 0) sink.wheel(vertical, horizontal)
}
private fun flushMotion() {
if (dx != 0 || dy != 0) sink.motion(dx, dy)
dx = 0
dy = 0
if (moved && x >= 0 && y >= 0) sink.position(x, y)
moved = false
}
companion object {
const val EV_SYN = 0x00
const val EV_KEY = 0x01
const val EV_REL = 0x02
const val EV_ABS = 0x03
const val SYN_REPORT = 0
const val KEY_REPEAT = 2
const val KEY_ESC = 1
const val BTN_MISC = 0x100
const val BTN_LEFT = 0x110
const val BTN_TASK = 0x117
const val BTN_TOUCH = 0x14a
const val KEY_OK = 0x160
const val KEY_MAX = 0x2ff
const val REL_X = 0x00
const val REL_Y = 0x01
const val REL_HWHEEL = 0x06
const val REL_WHEEL = 0x08
const val REL_WHEEL_HI_RES = 0x0b
const val REL_HWHEEL_HI_RES = 0x0c
const val ABS_X = 0x00
const val ABS_Y = 0x01
const val WHEEL_UNITS = 120
private fun scale(value: Int, range: IntRange, size: Int): Int =
((value.toLong() - range.first) * (size - 1) / (range.last.toLong() - range.first))
.toInt().coerceIn(0, size - 1)
}
}
@@ -11,6 +11,7 @@ import android.view.Display
object PerfMode {
private const val TAG = "PerfMode"
const val BFI_MIN_REFRESH_HZ = 100f
fun apply(a: Activity, fpsLimit: Int = 0, refreshLimit: Int = 0): String {
val parts = ArrayList<String>(2)
@@ -85,6 +85,12 @@ object SessionPrefs {
prefs(context).edit().putBoolean("launcherFullscreen", on).apply()
}
fun blackFrameInsertion(context: Context): Boolean = prefs(context).getBoolean("blackFrameInsertion", false)
fun setBlackFrameInsertion(context: Context, on: Boolean) {
prefs(context).edit().putBoolean("blackFrameInsertion", on).apply()
}
fun animationsEnabled(context: Context): Boolean = prefs(context).getBoolean("animations", true)
fun setAnimationsEnabled(context: Context, on: Boolean) {
@@ -701,6 +707,18 @@ object SessionPrefs {
fun micAsked(context: Context): Boolean = prefs(context).getBoolean("micAsked", false)
fun allFilesAsked(context: Context): Boolean = prefs(context).getBoolean("allFilesAsked", false)
fun setAllFilesAsked(context: Context) {
prefs(context).edit().putBoolean("allFilesAsked", true).apply()
}
fun bluetoothAsked(context: Context): Boolean = prefs(context).getBoolean("bluetoothAsked", false)
fun setBluetoothAsked(context: Context) {
prefs(context).edit().putBoolean("bluetoothAsked", true).apply()
}
fun setMicAsked(context: Context) {
prefs(context).edit().putBoolean("micAsked", true).apply()
}
@@ -540,7 +540,7 @@ class SessionService : Service() {
}
}
if (!LinuxRuntime.patchedProot(this)) {
if (SessionPrefs.allowStockProot(this)) {
if (LinuxRuntime.stockProotAllowed(this)) {
Log.w(TAG, "proot: patched proot missing; droiddeck-stock-proot allows the rootfs copy")
} else {
val message = getString(R.string.session_proot_missing)
@@ -1228,6 +1228,7 @@ class SessionService : Service() {
binds.addAll(gpuStats.binds())
}
if (controllersOn) components.add(RumbleComponent().also { it.attach(this) })
if (SessionState.mode == MODE_DESKTOP) components.add(UinputDesktopComponent().also { it.attach(this) })
val home = File(LinuxRuntime.rootDir(this), "root")
File(home, "Storage").mkdirs()
binds.add(Environment.getExternalStorageDirectory().path + ":/root/Storage")
@@ -24,7 +24,7 @@ object SettingsReset {
"directAudio", "mic", "wifiDiscovery", "clientCpusOverride", "clientCpus", "gameCpus",
"noXalia", "fastSync", "fsyncFirst", "syncFallback", "prootNoSeccomp", "prootFastPath", "nativeUserland", "cursorComposite",
"guestHostname", "fexPreset", "forceSsbs", "logs", "gameDebugLogsEnabled", "enhancedDiagnosticsNext", "storageDiagnostics", "buildWatermark",
"upscaler", "upscaleSharpness", "screenEffects", "textureAnisotropy", "textureLodBias",
"upscaler", "upscaleSharpness", "screenEffects", "blackFrameInsertion", "textureAnisotropy", "textureLodBias",
"steamDownloadsInBackground", "steam_offline", "bootMovie", "bootMovieSound", "bootMovieVolume", "bootMovieSeconds", "skipBootMovie",
"bootMovieApplyNext", "bootMovieSteamSeen", "bootMovieShuffle",
"questDefaultsV1", "telemetryAuto", "telemetryOff", "statsStrip", "statsHud", "bottomHud", "bottomStripMetrics", "bottomStripTabs", "statsDash", "statsSpeedUnit",
@@ -0,0 +1,115 @@
package com.droiddeck.launcher.session
import android.net.LocalServerSocket
import android.net.LocalSocket
import android.util.Log
import com.droiddeck.launcher.core.SessionPart
import com.droiddeck.launcher.input.HeldInput
import com.droiddeck.launcher.wayland.WaylandCompositor
import java.io.BufferedInputStream
import java.io.DataInputStream
import java.io.EOFException
import java.io.InputStream
import java.nio.ByteBuffer
import java.nio.ByteOrder
class UinputDesktopComponent : SessionPart() {
@Volatile private var server: LocalServerSocket? = null
private val clients = HashMap<LocalSocket, Int>()
private val keys = HeldInput(CompositorSink::key)
private val buttons = HeldInput(CompositorSink::button)
override fun start() {
val s = try { LocalServerSocket(NAME) } catch (e: Exception) { Log.w(TAG, "uinput: no listener ($e)"); return }
server = s
Thread({
while (server === s) {
val client = try { s.accept() } catch (e: Exception) { break }
if (runCatching { client.peerCredentials.uid }.getOrNull() !in setOf(android.os.Process.myUid(), 0)) {
runCatching { client.close() }
continue
}
val source = synchronized(clients) {
if (server !== s) 0
else Integer.lowestOneBit(clients.values.fold(0, Int::or).inv()).also { if (it != 0) clients[client] = it }
}
if (source == 0) {
runCatching { client.close() }
continue
}
Thread({ serve(client, source) }, "uinput-device").apply { isDaemon = true; start() }
}
}, "uinput-desktop").apply { isDaemon = true; start() }
Log.i(TAG, "uinput: listening on @$NAME")
}
override fun stop() {
val s = server
server = null
runCatching { s?.close() }
synchronized(clients) {
clients.keys.forEach { runCatching { it.close() } }
clients.clear()
}
}
private fun serve(client: LocalSocket, source: Int) {
try {
read(client.inputStream, CompositorSink, keys, buttons, source)
} catch (e: Exception) {
Log.w(TAG, "uinput: device stream ended ($e)")
} finally {
synchronized(clients) { clients.remove(client) }
runCatching { client.close() }
}
}
internal object CompositorSink : DesktopUinputDevice.Sink {
override fun key(code: Int, down: Boolean) = WaylandCompositor.nativeSendKey(code, if (down) 1 else 0)
override fun button(code: Int, down: Boolean) =
WaylandCompositor.nativeSendSceneInput(WaylandCompositor.SCENE_BUTTON, code, if (down) 1 else 0)
override fun motion(dx: Int, dy: Int) = WaylandCompositor.sendPointerDelta(dx, dy)
override fun position(x: Int, y: Int) =
WaylandCompositor.nativeSendSceneInput(WaylandCompositor.SCENE_POINTER_SCALED, x, y)
override fun wheel(vertical120: Int, horizontal120: Int) =
WaylandCompositor.nativeSendSceneInput(WaylandCompositor.SCENE_AXIS, vertical120, horizontal120)
}
companion object {
private const val TAG = "SessionService"
const val NAME = "droiddeck-uinput"
const val MAGIC = 0x4655444b
const val HEADER_BYTES = 20
const val EVENT_BYTES = 8
internal fun read(stream: InputStream, sink: DesktopUinputDevice.Sink, keys: HeldInput, buttons: HeldInput, source: Int) {
val input = DataInputStream(BufferedInputStream(stream))
val header = ByteArray(HEADER_BYTES)
input.readFully(header)
val h = ByteBuffer.wrap(header).order(ByteOrder.LITTLE_ENDIAN)
if (h.int != MAGIC) return
val xMin = h.int
val xMax = h.int
val yMin = h.int
val yMax = h.int
val device = DesktopUinputDevice(
if (xMax > xMin) xMin..xMax else null,
if (yMax > yMin) yMin..yMax else null,
sink,
keys,
buttons,
source,
)
val event = ByteArray(EVENT_BYTES)
val e = ByteBuffer.wrap(event).order(ByteOrder.LITTLE_ENDIAN)
try {
while (true) {
try { input.readFully(event) } catch (end: EOFException) { return }
device.event(e.getShort(0).toInt() and 0xFFFF, e.getShort(2).toInt() and 0xFFFF, e.getInt(4))
}
} finally {
device.release()
}
}
}
}
@@ -1,18 +1,27 @@
package com.droiddeck.launcher.stores.xbox
import android.annotation.SuppressLint
import android.content.Intent
import android.graphics.Color
import android.net.Uri
import android.os.Bundle
import android.util.Log
import android.util.TypedValue
import android.view.Gravity
import android.view.View
import android.view.ViewGroup
import android.webkit.CookieManager
import android.webkit.WebResourceRequest
import android.webkit.WebView
import android.webkit.WebViewClient
import android.widget.Button
import android.widget.FrameLayout
import android.widget.ImageButton
import android.widget.LinearLayout
import android.widget.ProgressBar
import android.widget.TextView
import androidx.activity.ComponentActivity
import com.droiddeck.launcher.R
import androidx.webkit.WebViewCompat
import androidx.webkit.WebViewFeature
import com.droiddeck.launcher.core.AddonPack
@@ -24,8 +33,10 @@ import org.json.JSONObject
import java.util.concurrent.TimeUnit
class XboxLoginActivity : ComponentActivity() {
private lateinit var host: LinearLayout
private lateinit var host: FrameLayout
private lateinit var status: TextView
private lateinit var retry: Button
private lateinit var progressBar: ProgressBar
private var view: WebView? = null
@Volatile private var child: Xodus.Child? = null
@Volatile private var session = 0L
@@ -37,11 +48,7 @@ class XboxLoginActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
requestedOrientation = com.droiddeck.launcher.core.AppUiPrefs.orientation(this)
host = LinearLayout(this).apply { orientation = LinearLayout.VERTICAL; setBackgroundColor(Color.BLACK) }
status = TextView(this).apply { setTextColor(Color.WHITE); text = "Preparing Microsoft sign-in…"; setPadding(24, 16, 24, 16) }
host.addView(status)
host.addView(Button(this).apply { text = getString(com.droiddeck.launcher.R.string.stores_login_close); setOnClickListener { finish() } })
setContentView(host)
setContentView(buildChrome())
if (android.os.Build.VERSION.SDK_INT < 28 || !WebViewFeature.isFeatureSupported(WebViewFeature.WEB_MESSAGE_LISTENER) ||
!WebViewFeature.isFeatureSupported(WebViewFeature.DOCUMENT_START_SCRIPT)) {
status.text = "Update Android System WebView to sign in to Xbox."
@@ -148,15 +155,60 @@ class XboxLoginActivity : ComponentActivity() {
val failed = step
val reason = failure(e)
logStep("failed while $failed: $reason")
if (e is java.io.IOException) logStep("I/O detail: ${e.message.orEmpty().take(300)}")
runOnUiThread {
disposeView()
val details = if (codes.isEmpty()) "" else "\nDetails: ${codes.joinToString(", ")}"
status.text = "Microsoft sign-in did not complete.\nFailed while $failed: $reason$details\nClose this window and try again."
status.text = "Microsoft sign-in did not complete.\nFailed while $failed: $reason$details"
retry.visibility = View.VISIBLE
}
}
}, "xbox-login").start()
}
private fun dp(value: Int): Int = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, value.toFloat(), resources.displayMetrics).toInt()
/** The other stores' sign-in frame: a title bar with close, a load bar, and a centered status. */
private fun buildChrome(): View {
val root = LinearLayout(this).apply { orientation = LinearLayout.VERTICAL; setBackgroundColor(BACKGROUND) }
val bar = LinearLayout(this).apply {
orientation = LinearLayout.HORIZONTAL; gravity = Gravity.CENTER_VERTICAL; setBackgroundColor(BAR)
layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dp(48))
}
bar.addView(TextView(this).apply {
text = getString(R.string.stores_login_title, Store.XBOX.label)
setTextColor(TEXT); textSize = 16f; setPadding(dp(16), 0, dp(8), 0)
layoutParams = LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f)
})
bar.addView(ImageButton(this).apply {
setImageResource(android.R.drawable.ic_menu_close_clear_cancel); setBackgroundColor(Color.TRANSPARENT)
contentDescription = getString(R.string.stores_login_close); layoutParams = LinearLayout.LayoutParams(dp(48), dp(48))
setOnClickListener { finish() }
})
progressBar = ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal).apply {
max = 100; visibility = View.GONE
layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dp(3))
}
host = FrameLayout(this).apply {
setBackgroundColor(BACKGROUND)
layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1f)
}
val panel = LinearLayout(this).apply {
orientation = LinearLayout.VERTICAL; gravity = Gravity.CENTER; setBackgroundColor(BACKGROUND)
setPadding(dp(24), dp(24), dp(24), dp(24))
}
status = TextView(this).apply { setTextColor(TEXT); textSize = 15f; gravity = Gravity.CENTER; text = "Preparing Microsoft sign-in…" }
retry = Button(this).apply {
text = getString(R.string.stores_login_retry); visibility = View.GONE
setOnClickListener { startActivity(Intent(intent)); finish() }
}
panel.addView(status)
panel.addView(retry, LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT).apply { topMargin = dp(16) })
host.addView(panel, FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT))
root.addView(bar); root.addView(progressBar); root.addView(host)
return root
}
private fun show(text: String) = runOnUiThread { if (!closed && view == null) status.text = text }
private fun progress(name: String, text: String) { step = name; show(text) }
@@ -191,7 +243,6 @@ class XboxLoginActivity : ComponentActivity() {
override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean = !trusted(request.url.toString())
override fun onPageFinished(view: WebView, url: String) {
if (!trusted(url)) { finish(); return }
status.text = "Microsoft sign-in"
val uri = Uri.parse(url)
if (uri.host == "login.live.com" && uri.path == "/ppsecure/post.srf") {
view.evaluateJavascript("JSON.stringify(globalThis.ServerData ?? null)") { raw ->
@@ -203,7 +254,14 @@ class XboxLoginActivity : ComponentActivity() {
}
}
}
host.addView(web, LinearLayout.LayoutParams(-1, 0, 1f))
web.setBackgroundColor(BACKGROUND)
web.webChromeClient = object : android.webkit.WebChromeClient() {
override fun onProgressChanged(view: WebView?, newProgress: Int) {
progressBar.progress = newProgress
progressBar.visibility = if (newProgress in 1..99) View.VISIBLE else View.GONE
}
}
host.addView(web, FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT))
val headers = frame.getJSONObject("headers")
val values = headers.keys().asSequence().associateWith { key ->
require(key in allowedHeaders)
@@ -212,7 +270,11 @@ class XboxLoginActivity : ComponentActivity() {
web.loadUrl(frame.getString("url"), values)
}
private fun disposeView() { view?.let { host.removeView(it); it.stopLoading(); it.destroy() }; view = null }
private fun disposeView() {
view?.let { host.removeView(it); it.stopLoading(); it.destroy() }
view = null
if (::progressBar.isInitialized) progressBar.visibility = View.GONE
}
override fun onDestroy() {
closed = true
val current = child; child = null
@@ -225,6 +287,9 @@ class XboxLoginActivity : ComponentActivity() {
companion object {
private const val TAG = "XboxLogin"
private const val BACKGROUND = 0xFF0A0B0D.toInt()
private const val BAR = 0xFF121417.toInt()
private const val TEXT = 0xFFF2F4F7.toInt()
internal fun failure(e: Exception): String {
val message = e.message.orEmpty()
@@ -251,7 +251,7 @@ fun ModeSheetRows(s: ModeSettings, a: ModeSettingsActions, tab: String, extras:
stringResource(R.string.display_integer_scaling_hint),
listOf(
false to stringResource(R.string.display_scaling_fit),
true to stringResource(R.string.display_scaling_auto),
true to stringResource(R.string.display_scaling_integer),
),
enabled, onPick = a.onIntegerScaling,
)
@@ -244,6 +244,8 @@ class DrawerActions(
val fexPreset: String,
val upscaler: Int = 0,
val upscaleSharpness: Int = 75,
val integerScaling: Boolean = false,
val onIntegerScaling: (Boolean) -> Unit = {},
val effects: ScreenEffects = ScreenEffects.OFF,
val screenEffectsTarget: String = "auto",
val screenEffectsTargets: List<Pair<String, String>> = emptyList(),
@@ -275,6 +277,9 @@ class DrawerActions(
val onFrameGenReset: () -> Unit = {},
val fpsLimit: Int = 0,
val onFpsLimit: (Int) -> Unit = {},
val blackFrameInsertion: Boolean = false,
val blackFrameInsertionAvailable: Boolean = false,
val onBlackFrameInsertion: (Boolean) -> Unit = {},
val onImportLossless: () -> Unit,
val onKeyboard: () -> Unit,
val onHardwareKeyboard: () -> Unit,
@@ -615,6 +620,16 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont
onChange = { a.onFpsLimit(if (it <= SessionPrefs.FPS_LIMIT_OFF) 0 else it) })
}
SettingsGroup(stringResource(R.string.display_image_scaling)) {
if (a.steam) SettingsRow(stringResource(R.string.display_integer_scaling), null) {
PadTextButton(
onClick = { a.onIntegerScaling(!a.integerScaling) }
) {
Text(stringResource(
if (a.integerScaling) R.string.display_scaling_integer
else R.string.display_scaling_fit
))
}
}
ChoiceRow(host, "upscaler", stringResource(R.string.display_filter), null,
SessionPrefs.upscalerChoices(LocalContext.current), a.upscaler,
note = stringResource(R.string.display_filter_note),
@@ -1112,6 +1127,9 @@ private fun ScreenEffectsGroup(
ToggleRow(host, "crt", stringResource(R.string.drawer_crt), null, e.crt, chipModifier = track("crt")) { a.onEffects(e.copy(crt = it)) }
ToggleRow(host, "ntsc", stringResource(R.string.drawer_ntsc), null, e.ntsc, chipModifier = track("ntsc")) { a.onEffects(e.copy(ntsc = it)) }
ToggleRow(host, "fake-hdr", stringResource(R.string.drawer_fake_hdr), null, e.hdr, chipModifier = track("fake-hdr")) { a.onEffects(e.copy(hdr = it)) }
if (a.blackFrameInsertionAvailable) ToggleRow(host, "bfi", stringResource(R.string.drawer_bfi),
stringResource(R.string.drawer_bfi_note), a.blackFrameInsertion,
chipModifier = track("bfi"), onChange = a.onBlackFrameInsertion)
}
val source = remember { MutableInteractionSource() }
val hot = source.collectIsFocusedAsState().value || source.collectIsHoveredAsState().value
@@ -53,6 +53,8 @@ object CompositorHost {
WaylandCompositor.nativeSetClockControl(java.io.File(context.filesDir, "${com.droiddeck.launcher.runtime.LinuxRuntime.DIR}/tmp/.bl-clock").path)
ownVsyncThread = SessionPrefs.vsyncThread(context)
WaylandCompositor.nativeSetRenderOnCommit(SessionPrefs.renderOnCommit(context))
blackFrameInsertion = SessionPrefs.blackFrameInsertion(context)
WaylandCompositor.nativeSetBlackFrameInsertion(blackFrameInsertion)
pace(refreshHz, fpsLimit)
if (!SessionState.running) WaylandCompositor.nativeSetOutputSize(outputWidth, outputHeight)
if (started) {
@@ -72,9 +74,12 @@ object CompositorHost {
return true
}
private var blackFrameInsertion = false
private var pictureHolds = 0
private fun pace(refreshHz: Float, fpsLimit: Int) {
WaylandCompositor.nativeSetFpsLimit(fpsLimit)
WaylandCompositor.nativeSetLayerFrameRate(if (fpsLimit > 0) fpsLimit.toFloat() else refreshHz)
WaylandCompositor.nativeSetLayerFrameRate(if (fpsLimit > 0 && !blackFrameInsertion) fpsLimit.toFloat() else refreshHz)
WaylandCompositor.nativeSetOutputRefreshRate(refreshHz)
SessionState.refreshHz = refreshHz
}
@@ -84,6 +89,27 @@ object CompositorHost {
if (started) pace(refreshHz, fpsLimit)
}
@Synchronized
fun setBlackFrameInsertion(on: Boolean, refreshHz: Float, fpsLimit: Int) {
blackFrameInsertion = on
WaylandCompositor.nativeSetBlackFrameInsertion(on)
if (started) pace(refreshHz, fpsLimit)
}
/** Presents only pictures until the matching release; false when nothing is strobing. */
@Synchronized
fun holdPicture(): Boolean {
if (!started || !blackFrameInsertion) return false
if (pictureHolds++ == 0) WaylandCompositor.nativeSetPictureHold(true)
return true
}
@Synchronized
fun releasePicture() {
if (pictureHolds == 0) return
if (--pictureHolds == 0) WaylandCompositor.nativeSetPictureHold(false)
}
@Synchronized
fun resize(surface: Surface, rearm: () -> Unit) {
if (!started) return
@@ -321,6 +321,10 @@ public final class WaylandCompositor {
public static native void nativeSetFpsLimit(int fps);
public static native void nativeSetBlackFrameInsertion(boolean on);
public static native void nativeSetPictureHold(boolean on);
public static native void nativeSetRenderOnCommit(boolean on);
public static native void nativeSetGpuTurbo(boolean on);
@@ -329,7 +333,8 @@ public final class WaylandCompositor {
public static native void nativeSendSceneInput(int type, int a, int b);
public static final int SCENE_BUTTON = 3, SCENE_WHEEL = 4, SCENE_POINTER_DELTA = 6, SCENE_AXIS = 11, SCENE_AXIS_FINGER = 12;
public static final int SCENE_BUTTON = 3, SCENE_WHEEL = 4, SCENE_POINTER_DELTA = 6, SCENE_AXIS = 11, SCENE_AXIS_FINGER = 12,
SCENE_POINTER_SCALED = 14;
public static final int WHEEL_STEP_UNITS = 120, POINTER_DELTA_SCALE = 256;
public static final int FG_ENGINE_LSFG = 0, FG_ENGINE_DDFG = 1;
+5 -1
View File
@@ -683,6 +683,8 @@
<string name="drawer_page_display">العرض</string>
<string name="drawer_frame_limit">حد الإطارات</string>
<string name="drawer_frame_limit_note">يحدّ هذه اللعبة. تنتقل الشاشة إلى معدل تحديث يقبل القسمة على الحد إن وُجد، وقد تبدو الحدود الأخرى غير منتظمة. تستخدم ألعاب Steam حد الإطارات في Steam ضمن قائمة الوصول السريع.</string>
<string name="drawer_bfi">إدراج إطار أسود</string>
<string name="drawer_bfi_note">حركة أوضح: يتبع كل إطار تحديث أسود. يتطلب 100 هرتز أو أكثر؛ تعمل اللعبة بنصف معدل التحديث وتبدو أغمق. يتوقف أثناء تشغيل توليد الإطارات.</string>
<string name="drawer_page_effects">المؤثرات</string>
<string name="drawer_page_controls">عناصر التحكم</string>
<string name="drawer_page_components">المكوّنات</string>
@@ -4269,5 +4271,7 @@
<string name="exit_hint_back">اضغط زر الرجوع مرة أخرى للخروج</string>
<string name="display_integer_scaling">تحجيم صحيح بالأعداد الصحيحة</string>
<string name="display_integer_scaling_hint">يستخدم أكبر معامل تحجيم صحيح يناسب الشاشة. إذا كان المصدر كبيرًا جدًا، يتم تصغير الصورة كاملة لتجنب الاقتصاص. يتم ضبط الدقة بشكل منفصل.</string>
<string name="display_integer_scaling_hint">يستخدم أكبر معامل تكبير صحيح يناسب الشاشة. قد يقص الحواف. إذا كان المصدر أكبر من الناتج، فإن التحجيم الكسري يعرض الصورة كاملة. يتم ضبط الدقة بشكل منفصل.</string>
<string name="display_scaling_integer">عدد صحيح</string>
<string name="display_scaling_fit">ملاءمة</string>
</resources>
+5 -1
View File
@@ -677,6 +677,8 @@
<string name="drawer_page_display">Pantalla</string>
<string name="drawer_frame_limit">Límite de fotogramas</string>
<string name="drawer_frame_limit_note">Limita este juego. La pantalla cambia a una frecuencia de actualización que sea múltiplo exacto del límite cuando la hay; otros límites pueden verse irregulares. Los juegos de Steam usan el Límite de fotogramas de Steam en el menú Quick Access.</string>
<string name="drawer_bfi">Inserción de cuadros negros</string>
<string name="drawer_bfi_note">Movimiento más nítido: cada cuadro va seguido de un refresco negro. Requiere 100 Hz o más; el juego corre a la mitad de la frecuencia y se ve más oscuro. Se apaga con la generación de cuadros.</string>
<string name="drawer_page_effects">Efectos</string>
<string name="drawer_page_controls">Controles</string>
<string name="drawer_page_components">Componentes</string>
@@ -4120,5 +4122,7 @@
<string name="exit_hint_back">Presiona atrás una vez más para salir</string>
<string name="display_integer_scaling">Escalado de píxeles enteros</string>
<string name="display_integer_scaling_hint">Usa el mayor factor de escala entero que quepa. Si la imagen de origen es demasiado grande, ajusta la imagen completa para evitar recortes. La resolución se configura por separado.</string>
<string name="display_integer_scaling_hint">Usa la mayor escala entera que cabe. Puede recortar los bordes. Si la imagen original supera el tamaño de salida, el escalado fraccional muestra la imagen completa. La resolución se configura por separado.</string>
<string name="display_scaling_integer">Entero</string>
<string name="display_scaling_fit">Ajustar</string>
</resources>
+5 -1
View File
@@ -675,6 +675,8 @@
<string name="drawer_page_display">Екран</string>
<string name="drawer_frame_limit">Ограничение на кадрите</string>
<string name="drawer_frame_limit_note">Ограничава тази игра. Екранът преминава към честота на опресняване, която се дели точно на ограничението, ако има такава; другите ограничения може да изглеждат неравномерни. Игрите в Steam използват Frame Limit на Steam в менюто Quick Access.</string>
<string name="drawer_bfi">Вмъкване на черни кадри</string>
<string name="drawer_bfi_note">По-ясно движение: след всеки кадър следва черно опресняване. Нужни са 100 Hz или повече; играта върви на половината честота и изглежда по-тъмна. Изключено при генериране на кадри.</string>
<string name="drawer_page_effects">Ефекти</string>
<string name="drawer_page_controls">Контроли</string>
<string name="drawer_page_components">Компоненти</string>
@@ -4109,5 +4111,7 @@
<string name="exit_hint_back">Натиснете отново „Назад“, за да излезете</string>
<string name="display_integer_scaling">Целочислено мащабиране</string>
<string name="display_integer_scaling_hint">Използва най-големия цял коефициент на мащабиране, който се побира. Ако източникът е твърде голям, побира цялото изображение, за да избегне изрязване. Разделителната способност се настройва отделно.</string>
<string name="display_integer_scaling_hint">Използва най-големия цял коефициент на мащабиране, който се побира. Възможно е изрязване на краищата. Ако източникът е по-голям от изхода, дробното мащабиране показва цялото изображение. Разделителната способност се настройва отделно.</string>
<string name="display_scaling_integer">Цяло число</string>
<string name="display_scaling_fit">Побиране</string>
</resources>
+5 -1
View File
@@ -679,6 +679,8 @@
<string name="drawer_page_display">Displej</string>
<string name="drawer_frame_limit">Limit snímků</string>
<string name="drawer_frame_limit_note">Omezí tuto hru. Displej se přepne na obnovovací frekvenci, kterou limit beze zbytku dělí, pokud nějakou má; jiné limity mohou působit nerovnoměrně. Hry ze Steamu používají Limit snímků Steamu v nabídce Rychlý přístup.</string>
<string name="drawer_bfi">Vkládání černých snímků</string>
<string name="drawer_bfi_note">Ostřejší pohyb: po každém snímku následuje černé obnovení. Vyžaduje 100 Hz a více; hra běží na polovině obnovovací frekvence a je tmavší. Vypnuto při generování snímků.</string>
<string name="drawer_page_effects">Efekty</string>
<string name="drawer_page_controls">Ovládání</string>
<string name="drawer_page_components">Komponenty</string>
@@ -4189,5 +4191,7 @@
<string name="exit_hint_back">Stiskněte znovu zpět pro ukončení</string>
<string name="display_integer_scaling">Celočíselné škálování</string>
<string name="display_integer_scaling_hint">Použije největší celočíselný násobek měřítka, který se vejde. Pokud je zdroj příliš velký, přizpůsobí celý obraz, aby nedošlo k oříznutí. Rozlišení se nastavuje samostatně.</string>
<string name="display_integer_scaling_hint">Použije největší celočíselné měřítko, které se vejde. Může oříznout okraje. Pokud je zdroj větší než výstup, zlomkové měřítko zobrazí celý obraz. Rozlišení se nastavuje samostatně.</string>
<string name="display_scaling_integer">Celé číslo</string>
<string name="display_scaling_fit">Přizpůsobit</string>
</resources>
+5 -1
View File
@@ -675,6 +675,8 @@
<string name="drawer_page_display">Skærm</string>
<string name="drawer_frame_limit">Billedgrænse</string>
<string name="drawer_frame_limit_note">Begrænser dette spil. Skærmen skifter til en opdateringshastighed, som grænsen går lige op i, når den har en; andre grænser kan virke ujævne. Steam-spil bruger Steams Frame Limit i Hurtig adgang-menuen.</string>
<string name="drawer_bfi">Indsættelse af sorte billeder</string>
<string name="drawer_bfi_note">Skarpere bevægelse: hvert billede efterfølges af en sort opdatering. Kræver 100 Hz eller mere; spillet kører ved halv opdateringshastighed og ser mørkere ud. Slået fra under billedgenerering.</string>
<string name="drawer_page_effects">Effekter</string>
<string name="drawer_page_controls">Kontroller</string>
<string name="drawer_page_components">Komponenter</string>
@@ -4109,5 +4111,7 @@
<string name="exit_hint_back">Tryk tilbage igen for at afslutte</string>
<string name="display_integer_scaling">Heltalsskalering</string>
<string name="display_integer_scaling_hint">Bruger den største hele skaleringsfaktor, der kan være der. Hvis kilden er for stor, tilpasses hele billedet for at undgå beskæring. Opløsningen indstilles separat.</string>
<string name="display_integer_scaling_hint">Bruger den største hele skalering, der kan være på skærmen. Kan beskære kanterne. Hvis kilden er større end outputtet, viser brøkbaseret skalering hele billedet. Opløsningen indstilles separat.</string>
<string name="display_scaling_integer">Heltal</string>
<string name="display_scaling_fit">Tilpas</string>
</resources>
+5 -1
View File
@@ -675,6 +675,8 @@
<string name="drawer_page_display">Anzeige</string>
<string name="drawer_frame_limit">Bildratenlimit</string>
<string name="drawer_frame_limit_note">Begrenzt dieses Spiel. Der Bildschirm wechselt zu einer Bildwiederholrate, die durch das Limit glatt teilbar ist, sofern vorhanden; andere Limits können ungleichmäßig wirken. Steam-Spiele nutzen das Bildratenlimit von Steam im Schnellzugriffsmenü.</string>
<string name="drawer_bfi">Schwarzbild-Einfügung</string>
<string name="drawer_bfi_note">Schärfere Bewegung: Auf jedes Bild folgt ein schwarzer Refresh. Braucht 100 Hz oder mehr; das Spiel läuft mit halber Bildwiederholrate und wirkt dunkler. Aus, solange Frame Generation läuft.</string>
<string name="drawer_page_effects">Effekte</string>
<string name="drawer_page_controls">Steuerung</string>
<string name="drawer_page_components">Komponenten</string>
@@ -4109,5 +4111,7 @@
<string name="exit_hint_back">Noch einmal zurück drücken zum Beenden</string>
<string name="display_integer_scaling">Ganzzahlige Skalierung</string>
<string name="display_integer_scaling_hint">Verwendet den größten ganzzahligen Skalierungsfaktor, der passt. Ist die Quelle zu groß, wird das gesamte Bild eingepasst, um Beschneidung zu vermeiden. Die Auflösung wird separat eingestellt.</string>
<string name="display_integer_scaling_hint">Verwendet die größte passende ganzzahlige Skalierung. Bildschirmränder können abgeschnitten werden. Ist die Quelle größer als die Ausgabe, zeigt eine gebrochene Skalierung das vollständige Bild. Die Auflösung wird separat eingestellt.</string>
<string name="display_scaling_integer">Ganzzahlig</string>
<string name="display_scaling_fit">Anpassen</string>
</resources>
+5 -1
View File
@@ -675,6 +675,8 @@
<string name="drawer_page_display">Οθόνη</string>
<string name="drawer_frame_limit">Όριο καρέ</string>
<string name="drawer_frame_limit_note">Περιορίζει αυτό το παιχνίδι. Η οθόνη αλλάζει σε ρυθμό ανανέωσης που διαιρείται ακριβώς με το όριο, αν υπάρχει· άλλα όρια μπορεί να φαίνονται ανομοιόμορφα. Τα παιχνίδια Steam χρησιμοποιούν το Frame Limit του Steam στο μενού Quick Access.</string>
<string name="drawer_bfi">Εισαγωγή μαύρων καρέ</string>
<string name="drawer_bfi_note">Πιο καθαρή κίνηση: κάθε καρέ ακολουθείται από μαύρη ανανέωση. Απαιτεί 100 Hz ή περισσότερα· το παιχνίδι τρέχει στον μισό ρυθμό ανανέωσης και φαίνεται πιο σκοτεινό. Ανενεργό όσο λειτουργεί η δημιουργία καρέ.</string>
<string name="drawer_page_effects">Εφέ</string>
<string name="drawer_page_controls">Χειριστήρια</string>
<string name="drawer_page_components">Στοιχεία</string>
@@ -4109,5 +4111,7 @@
<string name="exit_hint_back">Πατήστε ξανά πίσω για έξοδο</string>
<string name="display_integer_scaling">Ακέραια κλιμάκωση</string>
<string name="display_integer_scaling_hint">Χρησιμοποιεί τον μεγαλύτερο ακέραιο συντελεστή κλιμάκωσης που χωράει. Αν η πηγή είναι πολύ μεγάλη, προσαρμόζει ολόκληρη την εικόνα ώστε να αποφευχθεί η περικοπή. Η ανάλυση ρυθμίζεται ξεχωριστά.</string>
<string name="display_integer_scaling_hint">Χρησιμοποιεί τη μεγαλύτερη ακέραια κλίμακα που χωράει. Ενδέχεται να περικοπούν οι άκρες. Αν η πηγή είναι μεγαλύτερη από την έξοδο, η κλασματική κλιμάκωση εμφανίζει ολόκληρη την εικόνα. Η ανάλυση ρυθμίζεται ξεχωριστά.</string>
<string name="display_scaling_integer">Ακέραιος</string>
<string name="display_scaling_fit">Προσαρμογή</string>
</resources>
+5 -1
View File
@@ -677,6 +677,8 @@
<string name="drawer_page_display">Pantalla</string>
<string name="drawer_frame_limit">Límite de fotogramas</string>
<string name="drawer_frame_limit_note">Limita este juego. La pantalla cambia a una frecuencia de actualización que sea múltiplo exacto del límite cuando la hay; otros límites pueden verse irregulares. Los juegos de Steam usan el Límite de fotogramas de Steam en el menú Quick Access.</string>
<string name="drawer_bfi">Inserción de fotogramas negros</string>
<string name="drawer_bfi_note">Movimiento más nítido: cada fotograma va seguido de un refresco negro. Requiere 100 Hz o más; el juego va a la mitad de la frecuencia y se ve más oscuro. Desactivado con la generación de fotogramas.</string>
<string name="drawer_page_effects">Efectos</string>
<string name="drawer_page_controls">Controles</string>
<string name="drawer_page_components">Componentes</string>
@@ -4149,5 +4151,7 @@
<string name="exit_hint_back">Pulsa atrás una vez más para salir</string>
<string name="display_integer_scaling">Escalado de píxeles enteros</string>
<string name="display_integer_scaling_hint">Usa el mayor factor de escala entero que quepa. Si la imagen de origen es demasiado grande, ajusta la imagen completa para evitar recortes. La resolución se configura por separado.</string>
<string name="display_integer_scaling_hint">Usa la mayor escala entera que cabe. Puede recortar los bordes. Si la imagen original supera el tamaño de salida, el escalado fraccional muestra la imagen completa. La resolución se configura por separado.</string>
<string name="display_scaling_integer">Entero</string>
<string name="display_scaling_fit">Ajustar</string>
</resources>
+5 -1
View File
@@ -675,6 +675,8 @@
<string name="drawer_page_display">Näyttö</string>
<string name="drawer_frame_limit">Kuvanopeusraja</string>
<string name="drawer_frame_limit_note">Rajoittaa tätä peliä. Näyttö vaihtaa virkistystaajuuteen, joka on rajan tasakerrannainen, jos sellainen on; muut rajat voivat näyttää epätasaisilta. Steam-pelit käyttävät Steamin Frame Limit -asetusta Pikavalikossa.</string>
<string name="drawer_bfi">Mustien kuvien lisäys</string>
<string name="drawer_bfi_note">Terävämpi liike: jokaista kuvaa seuraa musta päivitys. Vaatii vähintään 100 Hz; peli pyörii puolella virkistystaajuudesta ja näyttää tummemmalta. Pois päältä kuvien generoinnin aikana.</string>
<string name="drawer_page_effects">Tehosteet</string>
<string name="drawer_page_controls">Ohjaimet</string>
<string name="drawer_page_components">Komponentit</string>
@@ -4109,5 +4111,7 @@
<string name="exit_hint_back">Paina takaisin vielä kerran poistuaksesi</string>
<string name="display_integer_scaling">Kokonaislukuskaalaus</string>
<string name="display_integer_scaling_hint">Käyttää suurinta mahtuvaa kokonaislukukerrointa. Jos lähdekuva on liian suuri, koko kuva sovitetaan rajauksen välttämiseksi. Tarkkuus määritetään erikseen.</string>
<string name="display_integer_scaling_hint">Käyttää suurinta kokonaislukukerrointa, joka mahtuu näyttöön. Reunat voivat rajautua. Jos lähde on tulostetta suurempi, murto-osaskaalaus näyttää koko kuvan. Resoluutio määritetään erikseen.</string>
<string name="display_scaling_integer">Kokonaisluku</string>
<string name="display_scaling_fit">Sovita</string>
</resources>
+5 -1
View File
@@ -677,6 +677,8 @@
<string name="drawer_page_display">Affichage</string>
<string name="drawer_frame_limit">Limite d\'images</string>
<string name="drawer_frame_limit_note">Limite ce jeu. L\'écran passe à une fréquence de rafraîchissement multiple de la limite lorsqu\'il en propose une ; les autres limites peuvent paraître irrégulières. Les jeux Steam utilisent la limite d\'images de Steam dans le menu d\'accès rapide.</string>
<string name="drawer_bfi">Insertion d\'images noires</string>
<string name="drawer_bfi_note">Mouvement plus net : chaque image est suivie d\'un rafraîchissement noir. Nécessite 100 Hz ou plus ; le jeu tourne à la moitié de la fréquence et paraît plus sombre. Désactivé avec la génération d\'images.</string>
<string name="drawer_page_effects">Effets</string>
<string name="drawer_page_controls">Contrôles</string>
<string name="drawer_page_components">Composants</string>
@@ -4148,5 +4150,7 @@
<string name="exit_hint_back">Appuyez à nouveau sur retour pour quitter</string>
<string name="display_integer_scaling">Mise à l’échelle entière</string>
<string name="display_integer_scaling_hint">Utilise le plus grand facteur d’échelle entier possible. Si la source est trop grande, l’image entière est ajustée pour éviter le recadrage. La résolution se règle séparément.</string>
<string name="display_integer_scaling_hint">Utilise le plus grand facteur d’échelle entier adapté. Les bords peuvent être rognés. Si la source est plus grande que la sortie, la mise à l’échelle fractionnaire affiche l’image entière. La résolution se règle séparément.</string>
<string name="display_scaling_integer">Entier</string>
<string name="display_scaling_fit">Ajuster</string>
</resources>
+5 -1
View File
@@ -675,6 +675,8 @@
<string name="drawer_page_display">डिस्प्ले</string>
<string name="drawer_frame_limit">फ़्रेम सीमा</string>
<string name="drawer_frame_limit_note">इस गेम को सीमित करता है। अगर डिस्प्ले में ऐसा रिफ़्रेश रेट है जिसे सीमा बराबर भाग देती है, तो वह उस पर चला जाता है; दूसरी सीमाएं असमान लग सकती हैं। Steam गेम, Quick Access मेनू में Steam की Frame Limit इस्तेमाल करते हैं।</string>
<string name="drawer_bfi">ब्लैक फ़्रेम इंसर्शन</string>
<string name="drawer_bfi_note">ज़्यादा साफ़ मोशन: हर फ़्रेम के बाद एक काला रिफ़्रेश आता है। 100 Hz या ज़्यादा चाहिए; गेम आधे रिफ़्रेश रेट पर चलता है और गहरा दिखता है। फ़्रेम जनरेशन चालू होने पर बंद रहता है।</string>
<string name="drawer_page_effects">इफ़ेक्ट</string>
<string name="drawer_page_controls">कंट्रोल</string>
<string name="drawer_page_components">कॉम्पोनेंट</string>
@@ -4109,5 +4111,7 @@
<string name="exit_hint_back">बाहर निकलने के लिए फिर से बैक दबाएँ</string>
<string name="display_integer_scaling">पूर्णांक स्केलिंग</string>
<string name="display_integer_scaling_hint">फिट होने वाले सबसे बड़े पूर्णांक स्केल का उपयोग करता है। स्रोत बहुत बड़ा होने पर काटने से बचाने के लिए पूरी छवि को फिट करता है। रिज़ॉल्यूशन अलग से सेट किया जाता है।</string>
<string name="display_integer_scaling_hint">स्क्रीन में समाने वाला सबसे बड़ा पूर्णांक स्केल उपयोग करता है। किनारे कट सकते हैं। यदि स्रोत आउटपुट से बड़ा है, तो भिन्नात्मक स्केलिंग पूरी छवि दिखाती है। रिज़ॉल्यूशन अलग से सेट होता है।</string>
<string name="display_scaling_integer">पूर्णांक</string>
<string name="display_scaling_fit">फ़िट</string>
</resources>
+5 -1
View File
@@ -675,6 +675,8 @@
<string name="drawer_page_display">Kijelző</string>
<string name="drawer_frame_limit">Képkockakorlát</string>
<string name="drawer_frame_limit_note">Korlátozza ezt a játékot. A kijelző olyan frissítési frekvenciára vált, amelyet a korlát egyenletesen oszt, ha van ilyen; más korlátok egyenetlennek tűnhetnek. A Steam-játékok a Steam képkockakorlátját használják a Gyors hozzáférés menüben.</string>
<string name="drawer_bfi">Fekete képkocka beszúrása</string>
<string name="drawer_bfi_note">Élesebb mozgás: minden képkockát fekete frissítés követ. Legalább 100 Hz kell; a játék a frissítési frekvencia felével fut és sötétebb. Képkocka-generálás közben ki van kapcsolva.</string>
<string name="drawer_page_effects">Effektek</string>
<string name="drawer_page_controls">Vezérlők</string>
<string name="drawer_page_components">Összetevők</string>
@@ -4109,5 +4111,7 @@
<string name="exit_hint_back">Nyomd meg még egyszer a visszát a kilépéshez</string>
<string name="display_integer_scaling">Egész számú méretezés</string>
<string name="display_integer_scaling_hint">A legnagyobb elférő egész számú méretezési tényezőt használja. Ha a forrás túl nagy, a teljes képet hozzáigazítja a levágás elkerüléséhez. A felbontás külön állítható.</string>
<string name="display_integer_scaling_hint">A legnagyobb elférő egész számú méretezést használja. A szélek levágódhatnak. Ha a forrás nagyobb a kimenetnél, a tört méretezés a teljes képet jeleníti meg. A felbontás külön állítható.</string>
<string name="display_scaling_integer">Egész szám</string>
<string name="display_scaling_fit">Igazítás</string>
</resources>
+5 -1
View File
@@ -673,6 +673,8 @@
<string name="drawer_page_display">Tampilan</string>
<string name="drawer_frame_limit">Batas frame</string>
<string name="drawer_frame_limit_note">Membatasi gim ini. Layar beralih ke refresh rate yang habis dibagi batas tersebut jika ada; batas lain bisa terlihat tidak rata. Gim Steam menggunakan Frame Limit milik Steam di menu Quick Access.</string>
<string name="drawer_bfi">Penyisipan bingkai hitam</string>
<string name="drawer_bfi_note">Gerakan lebih tajam: setiap bingkai diikuti refresh hitam. Butuh 100 Hz atau lebih; game berjalan di setengah refresh rate dan terlihat lebih gelap. Mati saat pembuatan bingkai aktif.</string>
<string name="drawer_page_effects">Efek</string>
<string name="drawer_page_controls">Kontrol</string>
<string name="drawer_page_components">Komponen</string>
@@ -4079,5 +4081,7 @@
<string name="exit_hint_back">Tekan kembali sekali lagi untuk keluar</string>
<string name="display_integer_scaling">Penskalaan bilangan bulat</string>
<string name="display_integer_scaling_hint">Menggunakan faktor skala bilangan bulat terbesar yang muat. Jika sumber terlalu besar, seluruh gambar disesuaikan agar tidak terpotong. Resolusi diatur secara terpisah.</string>
<string name="display_integer_scaling_hint">Menggunakan skala bilangan bulat terbesar yang muat. Tepi layar mungkin terpotong. Jika sumber lebih besar daripada keluaran, penskalaan pecahan menampilkan seluruh gambar. Resolusi diatur secara terpisah.</string>
<string name="display_scaling_integer">Bilangan bulat</string>
<string name="display_scaling_fit">Sesuaikan</string>
</resources>
+5 -1
View File
@@ -677,6 +677,8 @@
<string name="drawer_page_display">Schermo</string>
<string name="drawer_frame_limit">Limite frame</string>
<string name="drawer_frame_limit_note">Limita questo gioco. Lo schermo passa a una frequenza di aggiornamento divisibile per il limite, se disponibile; altri limiti possono risultare irregolari. I giochi Steam usano il Limite frame di Steam nel menu di accesso rapido.</string>
<string name="drawer_bfi">Inserimento di fotogrammi neri</string>
<string name="drawer_bfi_note">Movimento più nitido: ogni fotogramma è seguito da un refresh nero. Richiede almeno 100 Hz; il gioco gira a metà della frequenza e appare più scuro. Disattivato con la generazione di fotogrammi.</string>
<string name="drawer_page_effects">Effetti</string>
<string name="drawer_page_controls">Controlli</string>
<string name="drawer_page_components">Componenti</string>
@@ -4148,5 +4150,7 @@
<string name="exit_hint_back">Premi di nuovo indietro per uscire</string>
<string name="display_integer_scaling">Ridimensionamento intero</string>
<string name="display_integer_scaling_hint">Usa il più grande fattore di scala intero che entra nello schermo. Se la sorgente è troppo grande, adatta l’intera immagine per evitare ritagli. La risoluzione si configura separatamente.</string>
<string name="display_integer_scaling_hint">Usa il massimo fattore di scala intero che entra nello schermo. I bordi potrebbero essere tagliati. Se la sorgente è più grande dell\'output, la scalatura frazionaria mostra l\'intera immagine. La risoluzione si configura separatamente.</string>
<string name="display_scaling_integer">Intero</string>
<string name="display_scaling_fit">Adatta</string>
</resources>
+7 -3
View File
@@ -357,7 +357,7 @@
<string name="mode_return_after_game">ゲーム終了後にDroidDeckへ戻る</string>
<string name="mode_return_after_game_hint">DroidDeckや他のランチャーから起動したゲームを閉じると、Steamが正しく終了し(クラウドセーブの同期を先に完了)、起動元に戻ります。オフ:Steamに留まります。</string>
<string name="mode_shader_precache">シェーダーの事前キャッシュ</string>
<string name="mode_shader_precache_hint">Steamがゲーム用にビルド済みのシェーダーをダウンロードしてバックグラウンドで処理するため、ゲームのカクつきが減ります。オフにするとデータ通信量、ストレージ、バッテリーを節約できますが、ゲームはプレイ中にシェーダーをビルドします。Steamの「ダウンロード」>「シェーダーの事前キャッシュ」と同じ設定です。次回のセッションから適用されます。</string>
<string name="mode_shader_precache_hint">Steamがゲーム用にビルド済みのシェーダーをダウンロードしてバックグラウンドで処理するため、ゲームのカクつきが減ります。オフにするとデータ通信量、ストレージ、バッテリーを節約できますが、ゲームはプレイ中にシェーダーをビルドします。Steamの「ダウンロード」&gt;「シェーダーの事前キャッシュ」と同じ設定です。次回のセッションから適用されます。</string>
<string name="mode_steam_repair">Steamクライアントを修復</string>
<string name="mode_steam_repair_hint">次回Steamの起動時にSteamクライアントを再ダウンロードします。Steamが読み込み画面のまま進まない場合に使用してください。ゲーム、ログイン情報、設定は保持されます。</string>
<string name="mode_steam_repair_queued">次回Steamの起動時にSteamクライアントを再ダウンロードします。</string>
@@ -673,6 +673,8 @@
<string name="drawer_page_display">表示</string>
<string name="drawer_frame_limit">フレームレート制限</string>
<string name="drawer_frame_limit_note">このゲームのフレームレートを制限します。上限で割り切れるリフレッシュレートがあれば画面はそれに切り替わり、それ以外の上限では表示が不均一になることがあります。SteamゲームではクイックアクセスメニューにあるSteamのフレームレート制限を使用します。</string>
<string name="drawer_bfi">黒フレーム挿入</string>
<string name="drawer_bfi_note">動きがくっきり: 各フレームの後に黒いリフレッシュが入ります。100 Hz 以上が必要で、ゲームはリフレッシュレートの半分で動作し、画面は暗くなります。フレーム生成中はオフです。</string>
<string name="drawer_page_effects">エフェクト</string>
<string name="drawer_page_controls">コントロール</string>
<string name="drawer_page_components">コンポーネント</string>
@@ -4079,5 +4081,7 @@
<string name="exit_hint_back">もう一度戻るを押すと終了します</string>
<string name="display_integer_scaling">整数スケーリング</string>
<string name="display_integer_scaling_hint">収まる最大の整数倍率を使用します。元の画像が大きすぎる場合は、切り抜きを避けるため画像全体を収めます。解像度は別途設定します。</string>
</resources>
<string name="display_integer_scaling_hint">画面に収まる最大の整数倍率を使用します。画面の端が切れる場合があります。元画像が出力より大きい場合、小数倍率で画像全体を表示します。解像度は別途設定します。</string>
<string name="display_scaling_integer">整数</string>
<string name="display_scaling_fit">画面に合わせる</string>
</resources>
+5 -1
View File
@@ -673,6 +673,8 @@
<string name="drawer_page_display">디스플레이</string>
<string name="drawer_frame_limit">프레임 제한</string>
<string name="drawer_frame_limit_note">이 게임의 프레임을 제한합니다. 제한값으로 나누어떨어지는 주사율이 있으면 디스플레이가 그 주사율로 전환되며, 그 밖의 제한값은 고르지 않게 보일 수 있습니다. Steam 게임은 빠른 액세스 메뉴의 Steam 프레임 제한을 사용합니다.</string>
<string name="drawer_bfi">블랙 프레임 삽입</string>
<string name="drawer_bfi_note">더 선명한 움직임: 매 프레임 뒤에 검은 화면 갱신이 들어갑니다. 100Hz 이상이 필요하며 게임은 주사율의 절반으로 실행되고 더 어둡게 보입니다. 프레임 생성 중에는 꺼집니다.</string>
<string name="drawer_page_effects">효과</string>
<string name="drawer_page_controls">컨트롤</string>
<string name="drawer_page_components">구성 요소</string>
@@ -4079,5 +4081,7 @@
<string name="exit_hint_back">한 번 더 뒤로를 누르면 종료됩니다</string>
<string name="display_integer_scaling">정수 배율 조정</string>
<string name="display_integer_scaling_hint">화면에 맞는 가장 큰 정수 배율을 사용합니다. 원본이 너무 크면 잘림을 방지하기 위해 전체 이미지를 맞춥니다. 해상도는 별도로 설정합니다.</string>
<string name="display_integer_scaling_hint">화면에 맞는 가장 큰 정수 배율을 사용합니다. 화면 가장자리가 잘릴 수 있습니다. 원본이 출력보다 크면 소수 배율로 전체 이미지를 표시합니다. 해상도는 별도로 설정합니다.</string>
<string name="display_scaling_integer">정수</string>
<string name="display_scaling_fit">화면에 맞춤</string>
</resources>
+5 -1
View File
@@ -673,6 +673,8 @@
<string name="drawer_page_display">Paparan</string>
<string name="drawer_frame_limit">Had bingkai</string>
<string name="drawer_frame_limit_note">Mengehadkan permainan ini. Paparan bertukar kepada kadar segar semula yang boleh dibahagi sama rata dengan had jika ada; had lain mungkin kelihatan tidak sekata. Permainan Steam menggunakan Frame Limit Steam dalam menu Akses Pantas.</string>
<string name="drawer_bfi">Sisipan bingkai hitam</string>
<string name="drawer_bfi_note">Gerakan lebih tajam: setiap bingkai diikuti segar semula hitam. Perlu 100 Hz atau lebih; permainan berjalan pada separuh kadar segar semula dan kelihatan lebih gelap. Dimatikan semasa penjanaan bingkai.</string>
<string name="drawer_page_effects">Kesan</string>
<string name="drawer_page_controls">Kawalan</string>
<string name="drawer_page_components">Komponen</string>
@@ -4079,5 +4081,7 @@
<string name="exit_hint_back">Tekan kembali sekali lagi untuk keluar</string>
<string name="display_integer_scaling">Penskalaan integer</string>
<string name="display_integer_scaling_hint">Menggunakan faktor skala integer terbesar yang muat. Jika sumber terlalu besar, keseluruhan imej disesuaikan untuk mengelakkan pemotongan. Resolusi ditetapkan secara berasingan.</string>
<string name="display_integer_scaling_hint">Menggunakan skala nombor bulat terbesar yang muat. Tepi skrin mungkin terpotong. Jika sumber lebih besar daripada output, penskalaan pecahan memaparkan keseluruhan imej. Resolusi ditetapkan secara berasingan.</string>
<string name="display_scaling_integer">Integer</string>
<string name="display_scaling_fit">Muat</string>
</resources>
+5 -2
View File
@@ -675,6 +675,8 @@
<string name="drawer_page_display">Skjerm</string>
<string name="drawer_frame_limit">Bildefrekvensgrense</string>
<string name="drawer_frame_limit_note">Begrenser dette spillet. Skjermen bytter til en oppdateringsfrekvens som grensen går opp i når det finnes en; andre grenser kan se ujevne ut. Steam-spill bruker Steams Frame Limit i Hurtigmenyen.</string>
<string name="drawer_bfi">Innsetting av svarte bilder</string>
<string name="drawer_bfi_note">Skarpere bevegelse: hvert bilde etterfølges av en svart oppdatering. Krever 100 Hz eller mer; spillet kjører på halv oppdateringsfrekvens og ser mørkere ut. Av mens bildegenerering er på.</string>
<string name="drawer_page_effects">Effekter</string>
<string name="drawer_page_controls">Kontroller</string>
<string name="drawer_page_components">Komponenter</string>
@@ -4107,7 +4109,8 @@
<string name="hud_readings_shown">Vist</string>
<string name="hud_readings_count">%1$d av %2$d</string>
<string name="exit_hint_back">Trykk tilbake én gang til for å avslutte</string>
<string name="display_integer_scaling">Heltallsskalering</string>
<string name="display_integer_scaling_hint">Bruker den største hele skaleringsfaktoren som får plass. Hvis kilden er for stor, tilpasses hele bildet for å unngå beskjæring. Oppløsningen stilles inn separat.</string>
<string name="display_integer_scaling_hint">Bruker den største heltallsskalaen som får plass. Kan beskjære skjermkantene. Hvis kilden er større enn utdataene, viser brøkbasert skalering hele bildet. Oppløsningen stilles inn separat.</string>
<string name="display_scaling_integer">Heltall</string>
<string name="display_scaling_fit">Tilpass</string>
</resources>
+5 -1
View File
@@ -675,6 +675,8 @@
<string name="drawer_page_display">Scherm</string>
<string name="drawer_frame_limit">Framelimiet</string>
<string name="drawer_frame_limit_note">Begrenst deze game. Het scherm schakelt over naar een vernieuwingsfrequentie die precies deelbaar is door de limiet, als die er is; andere limieten kunnen ongelijkmatig ogen. Steam-games gebruiken de framelimiet van Steam in het Snelmenu.</string>
<string name="drawer_bfi">Zwarte frames invoegen</string>
<string name="drawer_bfi_note">Scherpere beweging: na elk frame volgt een zwarte verversing. Vereist 100 Hz of meer; de game draait op de helft van de verversingssnelheid en oogt donkerder. Uit zolang framegeneratie aanstaat.</string>
<string name="drawer_page_effects">Effecten</string>
<string name="drawer_page_controls">Bediening</string>
<string name="drawer_page_components">Componenten</string>
@@ -4109,5 +4111,7 @@
<string name="exit_hint_back">Druk nog één keer op terug om af te sluiten</string>
<string name="display_integer_scaling">Gehele-getallenschaal</string>
<string name="display_integer_scaling_hint">Gebruikt de grootste gehele schaalfactor die past. Als de bron te groot is, wordt de volledige afbeelding passend gemaakt om bijsnijden te voorkomen. De resolutie wordt apart ingesteld.</string>
<string name="display_integer_scaling_hint">Gebruikt de grootste passende gehele schaalfactor. Schermranden kunnen worden afgesneden. Als de bron groter is dan de uitvoer, toont fractionele schaling de volledige afbeelding. De resolutie wordt apart ingesteld.</string>
<string name="display_scaling_integer">Geheel getal</string>
<string name="display_scaling_fit">Passend</string>
</resources>
+5 -1
View File
@@ -679,6 +679,8 @@
<string name="drawer_page_display">Wyświetlacz</string>
<string name="drawer_frame_limit">Limit klatek</string>
<string name="drawer_frame_limit_note">Ogranicza tę grę. Wyświetlacz przełącza się na częstotliwość odświeżania podzielną przez limit, jeśli taka jest; inne limity mogą wyglądać nierówno. Gry Steam używają limitu klatek Steam w menu szybkiego dostępu.</string>
<string name="drawer_bfi">Wstawianie czarnych klatek</string>
<string name="drawer_bfi_note">Ostrzejszy ruch: po każdej klatce następuje czarne odświeżenie. Wymaga 100 Hz lub więcej; gra działa z połową częstotliwości odświeżania i jest ciemniejsza. Wyłączone przy generowaniu klatek.</string>
<string name="drawer_page_effects">Efekty</string>
<string name="drawer_page_controls">Sterowanie</string>
<string name="drawer_page_components">Komponenty</string>
@@ -4189,5 +4191,7 @@
<string name="exit_hint_back">Naciśnij wstecz jeszcze raz, aby wyjść</string>
<string name="display_integer_scaling">Skalowanie całkowite</string>
<string name="display_integer_scaling_hint">Używa największego całkowitego współczynnika skalowania, który się mieści. Jeśli źródło jest zbyt duże, dopasowuje cały obraz, aby uniknąć przycinania. Rozdzielczość ustawia się osobno.</string>
<string name="display_integer_scaling_hint">Używa największej całkowitej skali, która się mieści. Krawędzie ekranu mogą zostać przycięte. Jeśli źródło jest większe niż wynik, skalowanie ułamkowe wyświetla cały obraz. Rozdzielczość ustawia się osobno.</string>
<string name="display_scaling_integer">Liczba całkowita</string>
<string name="display_scaling_fit">Dopasuj</string>
</resources>
+5 -1
View File
@@ -677,6 +677,8 @@
<string name="drawer_page_display">Ecrã</string>
<string name="drawer_frame_limit">Limite de fotogramas</string>
<string name="drawer_frame_limit_note">Limita este jogo. O ecrã muda para uma taxa de atualização que o limite divida de forma exata, quando existe; outros limites podem parecer irregulares. Os jogos Steam utilizam o Limite de fotogramas do Steam no Menu de acesso rápido.</string>
<string name="drawer_bfi">Inserção de fotogramas pretos</string>
<string name="drawer_bfi_note">Movimento mais nítido: cada fotograma é seguido de uma atualização preta. Requer 100 Hz ou mais; o jogo corre a metade da taxa de atualização e fica mais escuro. Desligado com a geração de fotogramas.</string>
<string name="drawer_page_effects">Efeitos</string>
<string name="drawer_page_controls">Controlos</string>
<string name="drawer_page_components">Componentes</string>
@@ -4148,5 +4150,7 @@
<string name="exit_hint_back">Prima novamente o botão Voltar para sair</string>
<string name="display_integer_scaling">Escala por números inteiros</string>
<string name="display_integer_scaling_hint">Utiliza o maior fator de escala inteiro que couber. Se a imagem de origem for demasiado grande, ajusta a imagem completa para evitar cortes. A resolução é configurada separadamente.</string>
<string name="display_integer_scaling_hint">Usa a maior escala inteira que cabe. Pode cortar as margens do ecrã. Se a origem for maior do que a saída, a escala fracionária apresenta a imagem completa. A resolução é configurada separadamente.</string>
<string name="display_scaling_integer">Inteiro</string>
<string name="display_scaling_fit">Ajustar</string>
</resources>
+5 -1
View File
@@ -677,6 +677,8 @@
<string name="drawer_page_display">Tela</string>
<string name="drawer_frame_limit">Limite de quadros</string>
<string name="drawer_frame_limit_note">Limita este jogo. A tela muda para uma taxa de atualização que o limite divida por igual, quando houver; outros limites podem parecer irregulares. Jogos da Steam usam o Limite de quadros da Steam no menu de Acesso rápido.</string>
<string name="drawer_bfi">Inserção de quadros pretos</string>
<string name="drawer_bfi_note">Movimento mais nítido: cada quadro é seguido por uma atualização preta. Requer 100 Hz ou mais; o jogo roda na metade da taxa de atualização e fica mais escuro. Desligado com a geração de quadros.</string>
<string name="drawer_page_effects">Efeitos</string>
<string name="drawer_page_controls">Controles</string>
<string name="drawer_page_components">Componentes</string>
@@ -4156,5 +4158,7 @@
<string name="exit_hint_back">Pressione o botão Voltar novamente para sair</string>
<string name="display_integer_scaling">Escala por números inteiros</string>
<string name="display_integer_scaling_hint">Usa o maior fator de escala inteiro que couber. Se a imagem de origem for grande demais, ajusta a imagem completa para evitar cortes. A resolução é configurada separadamente.</string>
<string name="display_integer_scaling_hint">Usa a maior escala inteira que cabe. Pode cortar as bordas da tela. Se a origem for maior que a saída, a escala fracionária exibe a imagem completa. A resolução é configurada separadamente.</string>
<string name="display_scaling_integer">Inteiro</string>
<string name="display_scaling_fit">Ajustar</string>
</resources>
+5 -1
View File
@@ -677,6 +677,8 @@
<string name="drawer_page_display">Afișaj</string>
<string name="drawer_frame_limit">Limită de cadre</string>
<string name="drawer_frame_limit_note">Limitează acest joc. Afișajul trece la o rată de reîmprospătare pe care limita o împarte exact, dacă există; alte limite pot părea neuniforme. Jocurile Steam folosesc Limita de cadre a Steam din meniul Acces rapid.</string>
<string name="drawer_bfi">Inserare de cadre negre</string>
<string name="drawer_bfi_note">Mișcare mai clară: fiecare cadru este urmat de o reîmprospătare neagră. Necesită 100 Hz sau mai mult; jocul rulează la jumătate din rată și pare mai întunecat. Oprit cât timp generarea de cadre e activă.</string>
<string name="drawer_page_effects">Efecte</string>
<string name="drawer_page_controls">Comenzi</string>
<string name="drawer_page_components">Componente</string>
@@ -4149,5 +4151,7 @@
<string name="exit_hint_back">Apasă din nou înapoi pentru a ieși</string>
<string name="display_integer_scaling">Scalare cu numere întregi</string>
<string name="display_integer_scaling_hint">Folosește cel mai mare factor întreg de scalare care încape. Dacă sursa este prea mare, adaptează întreaga imagine pentru a evita decuparea. Rezoluția se configurează separat.</string>
<string name="display_integer_scaling_hint">Folosește cea mai mare scară întreagă care încape. Marginile ecranului pot fi decupate. Dacă sursa este mai mare decât ieșirea, scalarea fracționară afișează imaginea completă. Rezoluția se configurează separat.</string>
<string name="display_scaling_integer">Număr întreg</string>
<string name="display_scaling_fit">Potrivire</string>
</resources>
+5 -1
View File
@@ -679,6 +679,8 @@
<string name="drawer_page_display">Экран</string>
<string name="drawer_frame_limit">Ограничение кадров</string>
<string name="drawer_frame_limit_note">Ограничивает эту игру. Экран переключается на частоту обновления, которая делится на ограничение без остатка, если такая есть; при других ограничениях движение может быть неровным. Игры Steam используют ограничение кадров Steam в меню быстрого доступа.</string>
<string name="drawer_bfi">Вставка чёрных кадров</string>
<string name="drawer_bfi_note">Более чёткое движение: после каждого кадра идёт чёрное обновление. Нужно 100 Гц или больше; игра работает на половине частоты обновления и выглядит темнее. Отключено при генерации кадров.</string>
<string name="drawer_page_effects">Эффекты</string>
<string name="drawer_page_controls">Управление</string>
<string name="drawer_page_components">Компоненты</string>
@@ -4189,5 +4191,7 @@
<string name="exit_hint_back">Нажмите «Назад» ещё раз, чтобы выйти</string>
<string name="display_integer_scaling">Целочисленное масштабирование</string>
<string name="display_integer_scaling_hint">Использует наибольший целочисленный коэффициент масштабирования, который помещается. Если исходное изображение слишком велико, оно уменьшается целиком, чтобы избежать обрезки. Разрешение настраивается отдельно.</string>
<string name="display_integer_scaling_hint">Использует наибольший целочисленный масштаб, который помещается на экране. Края могут обрезаться. Если исходное изображение больше выходного, дробное масштабирование показывает его целиком. Разрешение настраивается отдельно.</string>
<string name="display_scaling_integer">Целое число</string>
<string name="display_scaling_fit">По размеру</string>
</resources>
+5 -1
View File
@@ -675,6 +675,8 @@
<string name="drawer_page_display">Skärm</string>
<string name="drawer_frame_limit">Bildgräns</string>
<string name="drawer_frame_limit_note">Begränsar det här spelet. Skärmen byter till en uppdateringsfrekvens som gränsen delar jämnt när en sådan finns; andra gränser kan se ojämna ut. Steam-spel använder Steams Frame Limit i snabbåtkomstmenyn.</string>
<string name="drawer_bfi">Infogning av svarta bilder</string>
<string name="drawer_bfi_note">Skarpare rörelser: varje bild följs av en svart uppdatering. Kräver 100 Hz eller mer; spelet körs på halva uppdateringsfrekvensen och ser mörkare ut. Av medan bildgenerering är på.</string>
<string name="drawer_page_effects">Effekter</string>
<string name="drawer_page_controls">Kontroller</string>
<string name="drawer_page_components">Komponenter</string>
@@ -4109,5 +4111,7 @@
<string name="exit_hint_back">Tryck tillbaka igen för att avsluta</string>
<string name="display_integer_scaling">Heltalsskalning</string>
<string name="display_integer_scaling_hint">Använder den största hela skalningsfaktorn som får plats. Om källbilden är för stor anpassas hela bilden för att undvika beskärning. Upplösningen ställs in separat.</string>
<string name="display_integer_scaling_hint">Använder den största heltalsskalningen som får plats. Kan beskära skärmkanterna. Om källan är större än utdata visar bråkskalning hela bilden. Upplösningen ställs in separat.</string>
<string name="display_scaling_integer">Heltal</string>
<string name="display_scaling_fit">Anpassa</string>
</resources>
+7 -3
View File
@@ -357,7 +357,7 @@
<string name="mode_return_after_game">กลับไปที่ DroidDeck หลังเล่นเกม</string>
<string name="mode_return_after_game_hint">เมื่อเกมที่คุณเริ่มจาก DroidDeck หรือตัวเปิดเกมอื่นปิดลง Steam จะออกอย่างเรียบร้อย (บันทึกบนคลาวด์เสร็จก่อน) แล้วคุณจะกลับไปที่นั่น ปิด: อยู่ใน Steam ต่อ</string>
<string name="mode_shader_precache">แคชเชเดอร์ล่วงหน้า</string>
<string name="mode_shader_precache_hint">Steam จะดาวน์โหลดเชเดอร์ที่สร้างไว้แล้วสำหรับเกมของคุณและประมวลผลในเบื้องหลัง เกมจึงกระตุกน้อยลง การปิดช่วยประหยัดข้อมูล พื้นที่จัดเก็บ และแบตเตอรี่ โดยเกมจะสร้างเชเดอร์ระหว่างเล่นแทน เป็นการตั้งค่าเดียวกับ Downloads > Shader Pre-Caching ของ Steam มีผลในเซสชันถัดไป</string>
<string name="mode_shader_precache_hint">Steam จะดาวน์โหลดเชเดอร์ที่สร้างไว้แล้วสำหรับเกมของคุณและประมวลผลในเบื้องหลัง เกมจึงกระตุกน้อยลง การปิดช่วยประหยัดข้อมูล พื้นที่จัดเก็บ และแบตเตอรี่ โดยเกมจะสร้างเชเดอร์ระหว่างเล่นแทน เป็นการตั้งค่าเดียวกับ Downloads &gt; Shader Pre-Caching ของ Steam มีผลในเซสชันถัดไป</string>
<string name="mode_steam_repair">ซ่อมแซมไคลเอนต์ Steam</string>
<string name="mode_steam_repair_hint">ดาวน์โหลดไคลเอนต์ Steam ใหม่อีกครั้งในครั้งถัดไปที่ Steam เริ่มทำงาน ใช้เมื่อ Steam ค้างอยู่ที่หน้าจอโหลด เกม การลงชื่อเข้าใช้ และการตั้งค่ายังคงอยู่</string>
<string name="mode_steam_repair_queued">ไคลเอนต์ Steam จะถูกดาวน์โหลดใหม่อีกครั้งในครั้งถัดไปที่ Steam เริ่มทำงาน</string>
@@ -673,6 +673,8 @@
<string name="drawer_page_display">หน้าจอ</string>
<string name="drawer_frame_limit">จำกัดเฟรม</string>
<string name="drawer_frame_limit_note">จำกัดเฟรมเรตของเกมนี้ หน้าจอจะเปลี่ยนไปใช้อัตรารีเฟรชที่หารด้วยค่าที่จำกัดได้ลงตัวหากมี ค่าอื่นอาจดูไม่สม่ำเสมอ เกม Steam ใช้ Frame Limit ของ Steam ในเมนู Quick Access</string>
<string name="drawer_bfi">แทรกเฟรมสีดำ</string>
<string name="drawer_bfi_note">ภาพเคลื่อนไหวคมขึ้น: ทุกเฟรมตามด้วยการรีเฟรชสีดำ ต้องใช้ 100 Hz ขึ้นไป เกมจะทำงานที่ครึ่งหนึ่งของรีเฟรชเรตและดูมืดลง ปิดอยู่ขณะเปิดการสร้างเฟรม</string>
<string name="drawer_page_effects">เอฟเฟกต์</string>
<string name="drawer_page_controls">การควบคุม</string>
<string name="drawer_page_components">คอมโพเนนต์</string>
@@ -4079,5 +4081,7 @@
<string name="exit_hint_back">กดกลับอีกครั้งเพื่อออก</string>
<string name="display_integer_scaling">การปรับขนาดจำนวนเต็ม</string>
<string name="display_integer_scaling_hint">ใช้ตัวคูณการปรับขนาดจำนวนเต็มที่ใหญ่ที่สุดที่พอดี หากภาพต้นฉบับใหญ่เกินไป จะปรับภาพทั้งหมดให้พอดีเพื่อหลีกเลี่ยงการตัดภาพ โดยตั้งค่าความละเอียดแยกต่างหาก</string>
</resources>
<string name="display_integer_scaling_hint">ใช้ตัวคูณจำนวนเต็มที่ใหญ่ที่สุดที่พอดีกับหน้าจอ ขอบภาพอาจถูกตัด หากภาพต้นฉบับใหญ่กว่าภาพขาออก การปรับขนาดแบบเศษส่วนจะแสดงภาพทั้งหมด โดยตั้งค่าความละเอียดแยกต่างหาก</string>
<string name="display_scaling_integer">จำนวนเต็ม</string>
<string name="display_scaling_fit">พอดีหน้าจอ</string>
</resources>
+5 -1
View File
@@ -675,6 +675,8 @@
<string name="drawer_page_display">Ekran</string>
<string name="drawer_frame_limit">Kare sınırı</string>
<string name="drawer_frame_limit_note">Bu oyunu sınırlar. Ekran, varsa sınırın tam böldüğü bir yenileme hızına geçer; diğer sınırlar düzensiz görünebilir. Steam oyunları Hızlı erişim menüsündeki Steam\'in Kare Sınırı ayarını kullanır.</string>
<string name="drawer_bfi">Siyah kare ekleme</string>
<string name="drawer_bfi_note">Daha net hareket: her kareyi siyah bir yenileme izler. 100 Hz veya üzeri gerekir; oyun yenileme hızının yarısında çalışır ve daha koyu görünür. Kare üretimi açıkken kapalıdır.</string>
<string name="drawer_page_effects">Efektler</string>
<string name="drawer_page_controls">Kontroller</string>
<string name="drawer_page_components">Bileşenler</string>
@@ -4109,5 +4111,7 @@
<string name="exit_hint_back">Çıkmak için bir kez daha geri basın</string>
<string name="display_integer_scaling">Tam sayı ölçeklendirme</string>
<string name="display_integer_scaling_hint">Sığan en büyük tam sayı ölçekleme katsayısını kullanır. Kaynak çok büyükse kırpmayı önlemek için görüntünün tamamını sığdırır. Çözünürlük ayrı ayarlanır.</string>
<string name="display_integer_scaling_hint">Ekrana sığan en büyük tam sayı ölçeğini kullanır. Ekran kenarları kırpılabilir. Kaynak görüntü çıktıdan büyükse kesirli ölçekleme görüntünün tamamını gösterir. Çözünürlük ayrı ayarlanır.</string>
<string name="display_scaling_integer">Tam sayı</string>
<string name="display_scaling_fit">Sığdır</string>
</resources>
+5 -1
View File
@@ -679,6 +679,8 @@
<string name="drawer_page_display">Екран</string>
<string name="drawer_frame_limit">Обмеження кадрів</string>
<string name="drawer_frame_limit_note">Обмежує цю гру. Екран перемикається на частоту оновлення, яка ділиться на обмеження без залишку, якщо така є; інші обмеження можуть виглядати нерівно. Ігри Steam використовують обмеження кадрів Steam у меню швидкого доступу.</string>
<string name="drawer_bfi">Вставлення чорних кадрів</string>
<string name="drawer_bfi_note">Чіткіший рух: після кожного кадру йде чорне оновлення. Потрібно 100 Гц або більше; гра працює на половині частоти оновлення й виглядає темнішою. Вимкнено під час генерації кадрів.</string>
<string name="drawer_page_effects">Ефекти</string>
<string name="drawer_page_controls">Керування</string>
<string name="drawer_page_components">Компоненти</string>
@@ -4189,5 +4191,7 @@
<string name="exit_hint_back">Натисніть «Назад» ще раз, щоб вийти</string>
<string name="display_integer_scaling">Цілочисельне масштабування</string>
<string name="display_integer_scaling_hint">Використовує найбільший цілий коефіцієнт масштабування, який поміщається. Якщо вихідне зображення завелике, воно вміщується повністю без обрізання. Роздільна здатність налаштовується окремо.</string>
<string name="display_integer_scaling_hint">Використовує найбільший цілий масштаб, що вміщується. Краї екрана можуть обрізатися. Якщо джерело більше за вихідне зображення, дробове масштабування показує його повністю. Роздільна здатність налаштовується окремо.</string>
<string name="display_scaling_integer">Ціле число</string>
<string name="display_scaling_fit">За розміром</string>
</resources>
+5 -1
View File
@@ -673,6 +673,8 @@
<string name="drawer_page_display">Hiển thị</string>
<string name="drawer_frame_limit">Giới hạn khung hình</string>
<string name="drawer_frame_limit_note">Giới hạn game này. Màn hình chuyển sang tần số quét chia hết cho mức giới hạn nếu có; các mức khác có thể trông không đều. Game Steam dùng Frame Limit của Steam trong menu Quick Access.</string>
<string name="drawer_bfi">Chèn khung hình đen</string>
<string name="drawer_bfi_note">Chuyển động sắc nét hơn: mỗi khung hình được theo sau bởi một lần làm mới màu đen. Cần 100 Hz trở lên; trò chơi chạy ở một nửa tần số quét và trông tối hơn. Tắt khi bật tạo khung hình.</string>
<string name="drawer_page_effects">Hiệu ứng</string>
<string name="drawer_page_controls">Điều khiển</string>
<string name="drawer_page_components">Thành phần</string>
@@ -4079,5 +4081,7 @@
<string name="exit_hint_back">Nhấn lại để thoát</string>
<string name="display_integer_scaling">Tỷ lệ nguyên</string>
<string name="display_integer_scaling_hint">Sử dụng hệ số tỷ lệ nguyên lớn nhất có thể vừa màn hình. Nếu nguồn quá lớn, toàn bộ hình ảnh sẽ được thu vừa để tránh bị cắt. Độ phân giải được thiết lập riêng.</string>
<string name="display_integer_scaling_hint">Dùng tỷ lệ nguyên lớn nhất vừa với màn hình. Có thể cắt mép màn hình. Nếu ảnh nguồn lớn hơn đầu ra, tỷ lệ phân số sẽ hiển thị toàn bộ ảnh. Độ phân giải được thiết lập riêng.</string>
<string name="display_scaling_integer">Số nguyên</string>
<string name="display_scaling_fit">Vừa màn hình</string>
</resources>
+7 -3
View File
@@ -357,7 +357,7 @@
<string name="mode_return_after_game">游戏结束后返回 DroidDeck</string>
<string name="mode_return_after_game_hint">从 DroidDeck 或其他启动器启动的游戏关闭后,Steam 会正常退出(先完成云存档同步),并返回启动位置。关闭:留在 Steam 中。</string>
<string name="mode_shader_precache">着色器预缓存</string>
<string name="mode_shader_precache_hint">Steam 会为你的游戏下载预编译的着色器并在后台处理,以减少游戏卡顿。关闭可节省流量、存储空间和电量;游戏会改为在运行时编译着色器。与 Steam 的“下载”>“着色器预缓存”为同一设置。下次会话时生效。</string>
<string name="mode_shader_precache_hint">Steam 会为你的游戏下载预编译的着色器并在后台处理,以减少游戏卡顿。关闭可节省流量、存储空间和电量;游戏会改为在运行时编译着色器。与 Steam 的“下载”&gt;“着色器预缓存”为同一设置。下次会话时生效。</string>
<string name="mode_steam_repair">修复 Steam 客户端</string>
<string name="mode_steam_repair_hint">下次启动 Steam 时重新下载 Steam 客户端。如果 Steam 一直停在加载画面,请使用此项。游戏、登录信息和设置都会保留。</string>
<string name="mode_steam_repair_queued">下次启动 Steam 时将重新下载 Steam 客户端。</string>
@@ -673,6 +673,8 @@
<string name="drawer_page_display">显示</string>
<string name="drawer_frame_limit">帧率限制</string>
<string name="drawer_frame_limit_note">限制此游戏的帧率。如有能被上限整除的刷新率,显示屏会切换到该刷新率;其他上限可能导致画面不均匀。Steam 游戏请使用快捷访问菜单中的 Steam 帧率限制。</string>
<string name="drawer_bfi">黑帧插入</string>
<string name="drawer_bfi_note">动态更清晰:每帧之后插入一次黑色刷新。需要 100 Hz 或更高;游戏以一半刷新率运行,画面更暗。开启帧生成时不可用。</string>
<string name="drawer_page_effects">画面效果</string>
<string name="drawer_page_controls">控制</string>
<string name="drawer_page_components">组件</string>
@@ -4079,5 +4081,7 @@
<string name="exit_hint_back">再按一次返回键退出</string>
<string name="display_integer_scaling">整数缩放</string>
<string name="display_integer_scaling_hint">使用能够容纳的最大整数缩放倍数。如果源图像过大,则缩放整张图像以避免裁切。分辨率单独设置。</string>
</resources>
<string name="display_integer_scaling_hint">使用屏幕可容纳的最大整数倍缩放,可能会裁切屏幕边缘。如果源图像大于输出尺寸,分数缩放会显示完整图像。分辨率需单独设置。</string>
<string name="display_scaling_integer">整数</string>
<string name="display_scaling_fit">适应</string>
</resources>
+7 -3
View File
@@ -357,7 +357,7 @@
<string name="mode_return_after_game">遊戲結束後返回 DroidDeck</string>
<string name="mode_return_after_game_hint">從 DroidDeck 或其他啟動器啟動的遊戲關閉後,Steam 會正常退出(先完成雲端存檔同步),並返回啟動位置。關閉:留在 Steam 中。</string>
<string name="mode_shader_precache">著色器預先快取</string>
<string name="mode_shader_precache_hint">Steam 會為你的遊戲下載預先編譯的著色器並在背景處理,讓遊戲較不卡頓。關閉可節省流動數據用量、儲存空間和電量;遊戲則會改為在執行時編譯著色器。與 Steam 的「下載」>「著色器預先快取」為同一個設定。下次工作階段生效。</string>
<string name="mode_shader_precache_hint">Steam 會為你的遊戲下載預先編譯的著色器並在背景處理,讓遊戲較不卡頓。關閉可節省流動數據用量、儲存空間和電量;遊戲則會改為在執行時編譯著色器。與 Steam 的「下載」&gt;「著色器預先快取」為同一個設定。下次工作階段生效。</string>
<string name="mode_steam_repair">修復 Steam 用戶端</string>
<string name="mode_steam_repair_hint">下次啟動 Steam 時重新下載 Steam 用戶端。如果 Steam 一直停留在載入畫面,請使用此功能。遊戲、登入資料和設定都會保留。</string>
<string name="mode_steam_repair_queued">下次啟動 Steam 時會重新下載 Steam 用戶端。</string>
@@ -673,6 +673,8 @@
<string name="drawer_page_display">顯示</string>
<string name="drawer_frame_limit">幀率限制</string>
<string name="drawer_frame_limit_note">限制此遊戲的幀率。若有能被此上限整除的螢幕更新率,顯示器會切換至該更新率;其他上限可能看起來不平順。Steam 遊戲請使用快速存取選單中 Steam 的幀率限制。</string>
<string name="drawer_bfi">黑幀插入</string>
<string name="drawer_bfi_note">動態更清晰:每幀之後插入一次黑色更新。需要 100 Hz 或更高;遊戲以一半更新率運行,畫面較暗。開啟幀生成時不可用。</string>
<string name="drawer_page_effects">效果</string>
<string name="drawer_page_controls">控制</string>
<string name="drawer_page_components">組件</string>
@@ -4079,5 +4081,7 @@
<string name="exit_hint_back">再按一次返回鍵退出</string>
<string name="display_integer_scaling">整數縮放</string>
<string name="display_integer_scaling_hint">使用可容納的最大整數縮放倍數。如果來源圖像太大,便縮放整張圖像以避免裁切。解像度會另外設定。</string>
</resources>
<string name="display_integer_scaling_hint">使用螢幕可容納的最大整數倍縮放,可能會裁切螢幕邊緣。如果來源圖像大於輸出尺寸,分數縮放會顯示完整圖像。解像度需另外設定。</string>
<string name="display_scaling_integer">整數</string>
<string name="display_scaling_fit">配合畫面</string>
</resources>
+7 -3
View File
@@ -357,7 +357,7 @@
<string name="mode_return_after_game">遊戲結束後返回 DroidDeck</string>
<string name="mode_return_after_game_hint">從 DroidDeck 或其他啟動器啟動的遊戲關閉後,Steam 會正常退出(先完成雲端存檔同步),並返回啟動位置。關閉:留在 Steam 中。</string>
<string name="mode_shader_precache">著色器預先快取</string>
<string name="mode_shader_precache_hint">Steam 會為你的遊戲下載預先編譯的著色器並在背景處理,讓遊戲較不卡頓。關閉可節省數據用量、儲存空間和電量;遊戲則會改為在執行時編譯著色器。與 Steam 的「下載」>「著色器預先快取」為同一個設定。下次工作階段生效。</string>
<string name="mode_shader_precache_hint">Steam 會為你的遊戲下載預先編譯的著色器並在背景處理,讓遊戲較不卡頓。關閉可節省數據用量、儲存空間和電量;遊戲則會改為在執行時編譯著色器。與 Steam 的「下載」&gt;「著色器預先快取」為同一個設定。下次工作階段生效。</string>
<string name="mode_steam_repair">修復 Steam 用戶端</string>
<string name="mode_steam_repair_hint">下次啟動 Steam 時重新下載 Steam 用戶端。如果 Steam 一直停在載入畫面,請使用此功能。遊戲、登入狀態和設定都會保留。</string>
<string name="mode_steam_repair_queued">下次啟動 Steam 時會重新下載 Steam 用戶端。</string>
@@ -673,6 +673,8 @@
<string name="drawer_page_display">顯示</string>
<string name="drawer_frame_limit">影格率限制</string>
<string name="drawer_frame_limit_note">限制此遊戲的影格率。若有能被此上限整除的螢幕更新率,顯示器會切換至該更新率;其他上限可能看起來不平順。Steam 遊戲請使用快速存取選單中 Steam 的影格率限制。</string>
<string name="drawer_bfi">黑幀插入</string>
<string name="drawer_bfi_note">動態更清晰:每幀之後插入一次黑色更新。需要 100 Hz 或更高;遊戲以一半更新率執行,畫面較暗。開啟幀生成時不可用。</string>
<string name="drawer_page_effects">效果</string>
<string name="drawer_page_controls">控制</string>
<string name="drawer_page_components">元件</string>
@@ -4079,5 +4081,7 @@
<string name="exit_hint_back">再按一次返回鍵退出</string>
<string name="display_integer_scaling">整數縮放</string>
<string name="display_integer_scaling_hint">使用可容納的最大整數縮放倍數。如果來源影像太大,會縮放整張影像以避免裁切。解析度會另外設定。</string>
</resources>
<string name="display_integer_scaling_hint">使用螢幕可容納的最大整數倍縮放,可能會裁切螢幕邊緣。如果來源圖像大於輸出尺寸,分數縮放會顯示完整圖像。解析度需另外設定。</string>
<string name="display_scaling_integer">整數</string>
<string name="display_scaling_fit">符合畫面</string>
</resources>
+4 -2
View File
@@ -703,6 +703,8 @@
<string name="drawer_page_display">Display</string>
<string name="drawer_frame_limit">Frame limit</string>
<string name="drawer_frame_limit_note">Caps this game. The display switches to a refresh rate the cap divides evenly when it has one; other caps can look uneven. Steam games use Steam\'s Frame Limit in the Quick Access menu.</string>
<string name="drawer_bfi">Black frame insertion</string>
<string name="drawer_bfi_note">Sharper motion: a black refresh follows every frame. Needs 100 Hz or more; the game runs at half the refresh rate and looks dimmer. Off while frame generation is on.</string>
<string name="drawer_page_effects">Effects</string>
<string name="drawer_page_controls">Controls</string>
<string name="drawer_page_components">Components</string>
@@ -2661,9 +2663,8 @@
<string name="display_stretch">Stretch to display</string>
<string name="display_image_scaling">Image scaling</string>
<string name="display_integer_scaling">Integer scaling</string>
<string name="display_integer_scaling_hint">Uses the largest whole-number scale that fits. If the source is too large, fits the full image to avoid cropping. Resolution is configured separately.</string>
<string name="display_integer_scaling_hint">Uses the largest whole-number scale that fits. May crop screen edges. If the source is larger than the output, fractional scaling fits the full image. Resolution is configured separately.</string>
<string name="display_scaling_fit">Fit</string>
<string name="display_scaling_auto">Auto</string>
<string name="display_filter">Scaling filter</string>
<string name="display_filter_hint">Shared by Steam and Desktop.</string>
<string name="display_filter_live">Applies live. Shared by Steam and Desktop.</string>
@@ -4203,4 +4204,5 @@
<string name="hud_readings_shown">Shown</string>
<string name="hud_readings_count">%1$d of %2$d</string>
<string name="exit_hint_back">Press back once more to exit</string>
<string name="display_scaling_integer">Integer</string>
</resources>
@@ -1,5 +1,6 @@
package com.droiddeck.launcher.frontend
import com.droiddeck.launcher.core.AddonPack
import com.droiddeck.launcher.runtime.LinuxRuntime
import com.droiddeck.launcher.session.SessionPrefs
import org.junit.Assert.*
@@ -16,9 +17,10 @@ class GameFileSyncTest {
@Test fun syncUsesFreshInstalledManifestsAndStopsWhenDisabled() {
val context = RuntimeEnvironment.getApplication()
val root = LinuxRuntime.rootDir(context)
listOf("usr/bin/gamescope", LinuxRuntime.SESSION_SCRIPT.removePrefix("/"), "opt/android-host/proot", "opt/android-host/loader").forEach { path ->
listOf("usr/bin/gamescope", LinuxRuntime.SESSION_SCRIPT.removePrefix("/")).forEach { path ->
File(root, path).apply { parentFile!!.mkdirs(); writeText("") }
}
AddonPack.PROOT.file(context, AddonPack.COMPLETE).apply { parentFile!!.mkdirs(); writeText("") }
SessionPrefs.setGameStorage(context, SessionPrefs.GAME_STORAGE_OFF, "")
SessionPrefs.setAddedGamesDirs(context, emptyList())
val steamapps = File(root, "root/.local/share/Steam/steamapps").apply { mkdirs() }
@@ -51,9 +53,10 @@ class GameFileSyncTest {
@Test fun libraryNotCreatedYetOnPresentStorageIsEmptyNotUnavailable() {
val context = RuntimeEnvironment.getApplication()
val root = LinuxRuntime.rootDir(context)
listOf("usr/bin/gamescope", LinuxRuntime.SESSION_SCRIPT.removePrefix("/"), "opt/android-host/proot", "opt/android-host/loader").forEach { path ->
listOf("usr/bin/gamescope", LinuxRuntime.SESSION_SCRIPT.removePrefix("/")).forEach { path ->
File(root, path).apply { parentFile!!.mkdirs(); writeText("") }
}
AddonPack.PROOT.file(context, AddonPack.COMPLETE).apply { parentFile!!.mkdirs(); writeText("") }
SessionPrefs.setAddedGamesDirs(context, emptyList())
File(root, "root/.local/share/Steam/steamapps").mkdirs()
val volume = File(context.filesDir, "card").apply { mkdirs() }
@@ -80,9 +83,10 @@ class GameFileSyncTest {
@Test fun previousAutomaticLibraryNotCreatedYetKeepsSyncingButRemovedDriveStops() {
val context = RuntimeEnvironment.getApplication()
val root = LinuxRuntime.rootDir(context)
listOf("usr/bin/gamescope", LinuxRuntime.SESSION_SCRIPT.removePrefix("/"), "opt/android-host/proot", "opt/android-host/loader").forEach { path ->
listOf("usr/bin/gamescope", LinuxRuntime.SESSION_SCRIPT.removePrefix("/")).forEach { path ->
File(root, path).apply { parentFile!!.mkdirs(); writeText("") }
}
AddonPack.PROOT.file(context, AddonPack.COMPLETE).apply { parentFile!!.mkdirs(); writeText("") }
SessionPrefs.setAddedGamesDirs(context, emptyList())
SessionPrefs.setGameStorage(context, "", "")
File(root, "root/.local/share/Steam/steamapps").mkdirs()
@@ -0,0 +1,152 @@
package com.droiddeck.launcher.session
import com.droiddeck.launcher.input.HeldInput
import com.droiddeck.launcher.input.InputSpace
import com.droiddeck.launcher.session.DesktopUinputDevice.Companion.ABS_X
import com.droiddeck.launcher.session.DesktopUinputDevice.Companion.ABS_Y
import com.droiddeck.launcher.session.DesktopUinputDevice.Companion.BTN_LEFT
import com.droiddeck.launcher.session.DesktopUinputDevice.Companion.BTN_TOUCH
import com.droiddeck.launcher.session.DesktopUinputDevice.Companion.EV_ABS
import com.droiddeck.launcher.session.DesktopUinputDevice.Companion.EV_KEY
import com.droiddeck.launcher.session.DesktopUinputDevice.Companion.EV_REL
import com.droiddeck.launcher.session.DesktopUinputDevice.Companion.EV_SYN
import com.droiddeck.launcher.session.DesktopUinputDevice.Companion.REL_HWHEEL
import com.droiddeck.launcher.session.DesktopUinputDevice.Companion.REL_WHEEL
import com.droiddeck.launcher.session.DesktopUinputDevice.Companion.REL_WHEEL_HI_RES
import com.droiddeck.launcher.session.DesktopUinputDevice.Companion.REL_X
import com.droiddeck.launcher.session.DesktopUinputDevice.Companion.REL_Y
import com.droiddeck.launcher.session.DesktopUinputDevice.Companion.SYN_REPORT
import org.junit.Assert.assertEquals
import org.junit.Test
import java.io.ByteArrayInputStream
import java.nio.ByteBuffer
import java.nio.ByteOrder
class UinputDesktopComponentTest {
private class Recorder : DesktopUinputDevice.Sink {
val calls = ArrayList<String>()
override fun key(code: Int, down: Boolean) { calls.add("key $code $down") }
override fun button(code: Int, down: Boolean) { calls.add("button $code $down") }
override fun motion(dx: Int, dy: Int) { calls.add("motion $dx $dy") }
override fun position(x: Int, y: Int) { calls.add("position $x $y") }
override fun wheel(vertical120: Int, horizontal120: Int) { calls.add("wheel $vertical120 $horizontal120") }
}
private fun stream(xMin: Int, xMax: Int, yMin: Int, yMax: Int, vararg events: IntArray, magic: Int = UinputDesktopComponent.MAGIC): ByteArrayInputStream {
val b = ByteBuffer.allocate(UinputDesktopComponent.HEADER_BYTES + events.size * UinputDesktopComponent.EVENT_BYTES)
.order(ByteOrder.LITTLE_ENDIAN)
b.putInt(magic).putInt(xMin).putInt(xMax).putInt(yMin).putInt(yMax)
events.forEach { b.putShort(it[0].toShort()).putShort(it[1].toShort()).putInt(it[2]) }
return ByteArrayInputStream(b.array())
}
private fun read(stream: ByteArrayInputStream, r: Recorder) =
UinputDesktopComponent.read(stream, r, HeldInput(r::key), HeldInput(r::button), 1)
private fun ev(type: Int, code: Int, value: Int) = intArrayOf(type, code, value)
private val syn = ev(EV_SYN, SYN_REPORT, 0)
@Test fun keyboardKeysReachTheCompositorAndRepeatsAreLeftToIt() {
val r = Recorder()
read(stream(0, 0, 0, 0, ev(EV_KEY, 30, 1), syn, ev(EV_KEY, 30, 2), syn, ev(EV_KEY, 30, 0), syn), r)
assertEquals(listOf("key 30 true", "key 30 false"), r.calls)
}
@Test fun relativeMouseMovesBeforeItClicksAndScrollsInWaylandDirection() {
val r = Recorder()
read(stream(0, 0, 0, 0,
ev(EV_REL, REL_X, 5), ev(EV_REL, REL_Y, -3), ev(EV_REL, REL_X, 2), ev(EV_KEY, BTN_LEFT, 1), syn,
ev(EV_KEY, BTN_LEFT, 0), syn,
ev(EV_REL, REL_WHEEL, 1), ev(EV_REL, REL_HWHEEL, -1), syn), r)
assertEquals(listOf("motion 7 -3", "button $BTN_LEFT true", "button $BTN_LEFT false", "wheel -120 -120"), r.calls)
}
@Test fun highResolutionWheelIsNotCountedTwice() {
val r = Recorder()
read(stream(0, 0, 0, 0,
ev(EV_REL, REL_WHEEL_HI_RES, 60), syn,
ev(EV_REL, REL_WHEEL_HI_RES, 60), ev(EV_REL, REL_WHEEL, 1), syn), r)
assertEquals(listOf("wheel -60 0", "wheel -60 0"), r.calls)
}
@Test fun absoluteMouseScalesItsRangeToTheInputSpace() {
val r = Recorder()
read(stream(0, 19200, 0, 12000,
ev(EV_ABS, ABS_X, 0), ev(EV_ABS, ABS_Y, 0), syn,
ev(EV_ABS, ABS_X, 19200), ev(EV_ABS, ABS_Y, 12000), ev(EV_KEY, BTN_TOUCH, 1), syn,
ev(EV_ABS, ABS_X, 40000), syn), r)
assertEquals(listOf("position 0 0", "position ${InputSpace.WIDTH - 1} ${InputSpace.HEIGHT - 1}",
"button $BTN_LEFT true", "position ${InputSpace.WIDTH - 1} ${InputSpace.HEIGHT - 1}",
"button $BTN_LEFT false"), r.calls)
}
@Test fun absoluteAxesAndTouchAreIgnoredWithoutAPointerRange() {
val r = Recorder()
read(stream(0, 0, 0, 0, ev(EV_ABS, ABS_X, 100), ev(EV_ABS, ABS_Y, 100), ev(EV_KEY, BTN_TOUCH, 1), syn), r)
assertEquals(emptyList<String>(), r.calls)
}
@Test fun gamepadButtonsAreNotTurnedIntoKeys() {
val r = Recorder()
read(stream(0, 0, 0, 0, ev(EV_KEY, 0x130, 1), ev(EV_KEY, 0x13c, 1), syn), r)
assertEquals(emptyList<String>(), r.calls)
}
@Test fun aClosedDeviceReleasesWhatItHeld() {
val r = Recorder()
read(stream(0, 0, 0, 0, ev(EV_KEY, 42, 1), ev(EV_KEY, 0x111, 1), syn), r)
assertEquals(listOf("key 42 true", "button 273 true", "key 42 false", "button 273 false"), r.calls)
}
@Test fun aKeyOrButtonHeldByTwoDevicesIsReleasedOnlyWhenBothLetGo() {
val r = Recorder()
val keys = HeldInput(r::key)
val buttons = HeldInput(r::button)
val keyboard = DesktopUinputDevice(null, null, r, keys, buttons, 1)
val mouse = DesktopUinputDevice(null, null, r, keys, buttons, 2)
keyboard.event(EV_KEY, 42, 1)
mouse.event(EV_KEY, 42, 1)
keyboard.event(EV_KEY, BTN_LEFT, 1)
mouse.event(EV_KEY, BTN_LEFT, 1)
keyboard.event(EV_KEY, 42, 0)
keyboard.release()
assertEquals(listOf("key 42 true", "button $BTN_LEFT true"), r.calls)
mouse.release()
assertEquals(listOf("key 42 true", "button $BTN_LEFT true", "key 42 false", "button $BTN_LEFT false"), r.calls)
}
@Test fun sharedHoldsPassASingleDeviceThroughUnchanged() {
val direct = Recorder()
val shared = Recorder()
val events = arrayOf(ev(EV_KEY, 30, 1), syn, ev(EV_KEY, 30, 0), ev(EV_REL, REL_X, 4), ev(EV_KEY, BTN_LEFT, 1), syn,
ev(EV_KEY, BTN_LEFT, 0), ev(EV_REL, REL_WHEEL, 1), syn, ev(EV_KEY, 42, 1), syn)
read(stream(0, 0, 0, 0, *events), direct)
val keys = HeldInput(shared::key)
val buttons = HeldInput(shared::button)
DesktopUinputDevice(null, null, Recorder(), keys, buttons, 1).event(EV_KEY, 50, 1)
UinputDesktopComponent.read(stream(0, 0, 0, 0, *events), shared, keys, buttons, 2)
assertEquals(listOf("key 50 true") + direct.calls, shared.calls)
}
@Test fun sharedHoldsDropReleasesNothingHeld() {
val r = Recorder()
val keys = HeldInput(r::key)
val buttons = HeldInput(r::button)
val keyboard = DesktopUinputDevice(null, null, r, keys, buttons, 1)
val mouse = DesktopUinputDevice(null, null, r, keys, buttons, 2)
keyboard.event(EV_KEY, 30, 0)
mouse.event(EV_KEY, BTN_LEFT, 0)
keyboard.event(EV_KEY, 30, 1)
mouse.event(EV_KEY, 30, 0)
mouse.release()
keyboard.event(EV_KEY, 30, 0)
keyboard.event(EV_KEY, 30, 0)
assertEquals(listOf("key 30 true", "key 30 false"), r.calls)
}
@Test fun aStreamWithoutTheHeaderIsIgnored() {
val r = Recorder()
read(stream(0, 0, 0, 0, ev(EV_KEY, 30, 1), syn, magic = 0x1234), r)
assertEquals(emptyList<String>(), r.calls)
}
}
+4 -4
View File
@@ -3,15 +3,15 @@
MaliBridge by ASEbrahim: https://github.com/ASEbrahim/MaliBridge
(GPL-3.0-or-later with the additional terms in NOTICE here, copied unchanged from the project).
DroidDeck builds MaliBridge from the `external/MaliBridge` submodule, pinned at 48477fe
(v0.5.4) and not modified. Its Vulkan ICD runs inside the Linux runtime and forwards each call
DroidDeck builds MaliBridge from the `external/MaliBridge` submodule, pinned at 64a3f22
(v0.5.5.4) and not modified. Its Vulkan ICD runs inside the Linux runtime and forwards each call
over a Unix socket to its server, which runs in the app on the phone's own Vulkan driver.
DroidDeck uses it only on a GPU without Adreno's KGSL; an Adreno keeps Turnip.
The DroidDeck side of the bridge (the Setup switches, the server's start and session wiring, the
Mali render node stand-in, the compositor's AHardwareBuffer import off Adreno, the Steam web helper
layout, the socket wait and the DXVK choice for older Vulkan drivers) is Ahmad Sayed Alsayed
Ebrahim's (ASEbrahim) work from https://github.com/ASEbrahim/DroidDeck, kept under their name in
layout, the socket wait and the DXVK choice for older Vulkan drivers) is ASEbrahim's work
from https://github.com/ASEbrahim/DroidDeck, kept under their name in
this repository's history.
MaliBridge's own credits, in its README, include:
+8
View File
@@ -42,6 +42,14 @@ export BL_DESKTOP_GPU_CHILD=1
export MESA_LOADER_DRIVER_OVERRIDE=zink GALLIUM_DRIVER=zink LIBGL_KOPPER_DRI2=true
[ -n "${DROIDDECK_GLTHREAD:-}" ] && export mesa_glthread=$DROIDDECK_GLTHREAD
export APPIMAGE_EXTRACT_AND_RUN=1
if ! command -v gamescopereaper >/dev/null 2>&1; then
for dir in /usr/games /usr/local/games /usr/bin; do
if [ -x "$dir/gamescopereaper" ]; then
export PATH=${PATH:+$PATH:}$dir
break
fi
done
fi
if [ "$window" = 1 ]; then
export BL_GPU_CHILD_WSI=${MESA_VK_WSI_DEBUG:-}
SDL_VIDEODRIVER=wayland MESA_VK_WSI_DEBUG=sw gamescope "${args[@]}" -- /usr/local/bin/droiddeck-gpu-window "$@"
+1
View File
@@ -38,6 +38,7 @@
#include <shadow.h>
#include <pthread.h>
#include <sys/wait.h>
#include <elf.h>
#include <sys/sendfile.h>
#include <sys/mman.h>
#include <sched.h>
+12 -1
View File
@@ -96,6 +96,7 @@ static char **prepare_ddnatv_env(char *const envp[], const char *real_exe) {
int has_binds = 0;
int has_hostname = 0;
int has_link_root = 0;
int has_exec_loader = 0;
int has_preload_list = 0;
const char *preload_value = NULL;
while (envp && envp[count]) {
@@ -125,6 +126,7 @@ static char **prepare_ddnatv_env(char *const envp[], const char *real_exe) {
else if (strncmp(e, "DDNATV_PRELOAD=", 15) == 0) has_preload_list = 1;
else if (strncmp(e, "DDNATV_HOSTNAME=", 16) == 0) has_hostname = 1;
else if (strncmp(e, "DDNATV_LINK_ROOT=", 17) == 0) has_link_root = 1;
else if (strncmp(e, "DDNATV_EXEC=", 12) == 0) has_exec_loader = 1;
else if (strncmp(e, "DPKG_DEB_THREADS_MAX=", 21) == 0) has_threads_max = 1;
else if (strncmp(e, "DEBIAN_FRONTEND=", 16) == 0) has_frontend = 1;
else if (strncmp(e, "DEBCONF_FRONTEND=", 17) == 0) has_debconf_frontend = 1;
@@ -136,7 +138,7 @@ static char **prepare_ddnatv_env(char *const envp[], const char *real_exe) {
count++;
}
char **new_env = calloc(count + 24, sizeof(char *));
char **new_env = calloc(count + 25, sizeof(char *));
int dst = 0;
for (int i = 0; i < count; i++) {
if (has_preload && envp[i][0] == 'L' && strncmp(envp[i], "LD_PRELOAD=", 11) == 0) {
@@ -223,6 +225,15 @@ static char **prepare_ddnatv_env(char *const envp[], const char *real_exe) {
new_env[dst++] = str;
}
}
if (!has_exec_loader && g_exec_loader[0] != '\0') {
size_t len = strlen(g_exec_loader);
char *str = malloc(12 + len + 1);
if (str) {
memcpy(str, "DDNATV_EXEC=", 12);
memcpy(str + 12, g_exec_loader, len + 1);
new_env[dst++] = str;
}
}
if (!has_link_root && g_link_root_len) {
char *str = malloc(17 + g_link_root_len + 1);
if (str) {
+106 -4
View File
@@ -135,12 +135,103 @@ static int in_exec_rehearsal(void) {
pthread_equal(pthread_self(), g_exec_rehearsal_thread);
}
// Android's own programs, and the app's extracted libraries, may still be executed directly.
static int exec_directly(const char *path) {
static const char *const prefixes[] = {"/system/", "/vendor/", "/apex/", "/product/", "/odm/", "/system_ext/", "/data/app/"};
if (g_exec_loader[0] == '\0' || !path || path[0] != '/' || strcmp(path, g_exec_loader) == 0) return 1;
for (size_t i = 0; i < sizeof(prefixes) / sizeof(prefixes[0]); i++)
if (strncmp(path, prefixes[i], strlen(prefixes[i])) == 0) return 1;
return 0;
}
// ENOENT when the program names a dynamic linker that is not there (a glibc program's
// "/lib/ld-linux-aarch64.so.1" on Android), as the kernel answers: callers try another way.
static int exec_interp_missing(int fd) {
Elf64_Ehdr eh;
if (syscall(SYS_pread64, fd, &eh, sizeof(eh), 0) != (long)sizeof(eh) || eh.e_ident[EI_CLASS] != ELFCLASS64 ||
eh.e_machine != EM_AARCH64 || (eh.e_type != ET_EXEC && eh.e_type != ET_DYN) ||
eh.e_phentsize != sizeof(Elf64_Phdr) || eh.e_phnum == 0 || eh.e_phnum > 64)
return ENOEXEC;
for (int i = 0; i < eh.e_phnum; i++) {
Elf64_Phdr ph;
if (syscall(SYS_pread64, fd, &ph, sizeof(ph), (long)(eh.e_phoff + (Elf64_Off)i * sizeof(ph))) != (long)sizeof(ph))
return ENOEXEC;
if (ph.p_type != PT_INTERP) continue;
char interp[PATH_MAX];
if (ph.p_filesz == 0 || ph.p_filesz >= sizeof(interp) ||
syscall(SYS_pread64, fd, interp, ph.p_filesz, (long)ph.p_offset) != (long)ph.p_filesz)
return ENOEXEC;
interp[ph.p_filesz] = 0;
int ifd = (int)syscall(SYS_openat, AT_FDCWD, interp, O_RDONLY | O_CLOEXEC | O_NONBLOCK);
if (ifd < 0) return errno;
syscall(SYS_close, ifd);
return 0;
}
return 0;
}
// The errors execve() itself would give for [path], which the loader cannot report once it runs:
// a shell walking $PATH moves on at ENOENT and EACCES, and runs a file without "#!" as a script at
// ENOEXEC.
static int exec_preflight(const char *path) {
int fd = (int)syscall(SYS_openat, AT_FDCWD, path, O_RDONLY | O_CLOEXEC | O_NONBLOCK);
if (fd < 0) return errno;
struct stat st;
int err = 0;
unsigned char magic[4];
if (syscall(SYS_fstat, fd, &st) != 0) err = errno;
else if (!S_ISREG(st.st_mode)) err = EACCES;
else if (syscall(SYS_faccessat, AT_FDCWD, path, X_OK, 0) != 0) err = EACCES;
else if (syscall(SYS_read, fd, magic, 2) == 2 && magic[0] == '#' && magic[1] == '!') err = -1;
else if (syscall(SYS_pread64, fd, magic, sizeof(magic), 0) != (long)sizeof(magic) ||
magic[0] != 0x7f || magic[1] != 'E' || magic[2] != 'L' || magic[3] != 'F') err = ENOEXEC;
else err = exec_interp_missing(fd);
syscall(SYS_close, fd);
return err;
}
// "libddexec.so <path> <argv...>"; NULL when [path] is executed directly, as a "#!" script the
// kernel hands to its interpreter is. *err is set when the exec would fail.
static char **loader_argv(const char *path, char *const argv[], int *err) {
*err = 0;
if (exec_directly(path)) return NULL;
int preflight = exec_preflight(path);
if (preflight == -1) return NULL;
*err = preflight;
if (*err) return NULL;
int argc = 0;
while (argv && argv[argc]) argc++;
char **out = (char **)malloc(sizeof(char *) * (size_t)(argc + 4));
if (!out) {
*err = ENOMEM;
return NULL;
}
out[0] = g_exec_loader;
out[1] = (char *)path;
int n = 2;
if (argc == 0) out[n++] = (char *)path;
for (int i = 0; i < argc; i++) out[n++] = argv[i];
out[n] = NULL;
return out;
}
static int run_execve(orig_execve_f_type f, const char *path, char *const argv[], char *const envp[]) {
if (in_exec_rehearsal()) {
errno = 0;
return 0;
}
return f(path, argv, envp);
int err;
char **via = loader_argv(path, argv, &err);
if (err) {
errno = err;
return -1;
}
if (!via) return f(path, argv, envp);
int ret = f(g_exec_loader, via, envp);
int saved_errno = errno;
free(via);
errno = saved_errno;
return ret;
}
// ldconfig does nothing in The native userland (its cache is for paths that ld.so opens without the hook), but the
@@ -701,6 +792,17 @@ static orig_posix_spawn_f_type real_posix_spawn(void) {
return orig_posix_spawn;
}
static int run_spawn(orig_posix_spawn_f_type f, pid_t *pid, const char *path, const posix_spawn_file_actions_t *file_actions,
const posix_spawnattr_t *attrp, char *const argv[], char *const envp[]) {
int err;
char **via = loader_argv(path, argv, &err);
if (err) return err;
if (!via) return f(pid, path, file_actions, attrp, argv, envp);
int ret = f(pid, g_exec_loader, file_actions, attrp, via, envp);
free(via);
return ret;
}
static int ddnatv_posix_spawn(pid_t *pid, const char *path,
const posix_spawn_file_actions_t *file_actions,
const posix_spawnattr_t *attrp,
@@ -856,10 +958,10 @@ static int ddnatv_posix_spawn(pid_t *pid, const char *path,
ret = ENOMEM;
} else {
if (orig_posix_spawn) {
ret = orig_posix_spawn(pid, ld_so, file_actions, attrp, new_argv, new_envp);
ret = run_spawn(orig_posix_spawn, pid, ld_so, file_actions, attrp, new_argv, new_envp);
if (ret == EACCES && chmod(ld_so, 0755) == 0) {
// ld.so without its exec bit (an unusual restore): fix it once and retry
ret = orig_posix_spawn(pid, ld_so, file_actions, attrp, new_argv, new_envp);
ret = run_spawn(orig_posix_spawn, pid, ld_so, file_actions, attrp, new_argv, new_envp);
}
}
free(new_argv);
@@ -867,7 +969,7 @@ static int ddnatv_posix_spawn(pid_t *pid, const char *path,
} else {
if (in_root && probe.is_elf && !probe.is_dynamic) prepare_static_program(elf_target);
if (orig_posix_spawn) {
ret = orig_posix_spawn(pid, target, file_actions, attrp, argv, new_envp);
ret = run_spawn(orig_posix_spawn, pid, target, file_actions, attrp, argv, new_envp);
}
}
+25 -2
View File
@@ -11,10 +11,28 @@
static char g_ddnatv_root[PATH_MAX] = {0};
static size_t g_ddnatv_root_len = 0;
// The path the kernel reports for [path] (/proc/self/fd, getcwd(), realpath()): for a targetSdk 30+
// app, Android's own /data/user/0 is a link to /data/data, so the app's paths are not what the kernel
// gives back for them. Into out, or path itself when it cannot be resolved; returns out's length.
static size_t ddnatv_kernel_path(const char *path, size_t len, char *out, size_t outsz) {
static char *(*libc_realpath)(const char *, char *) = NULL;
if (!libc_realpath) libc_realpath = (char *(*)(const char *, char *))dlsym(RTLD_NEXT, "realpath");
char given[PATH_MAX];
if (len >= sizeof(given)) len = sizeof(given) - 1;
memcpy(given, path, len);
given[len] = '\0';
char resolved[PATH_MAX];
const char *use = (libc_realpath && libc_realpath(given, resolved)) ? resolved : given;
size_t n = strlen(use);
if (n >= outsz) n = outsz - 1;
memcpy(out, use, n);
out[n] = '\0';
return n;
}
static void ddnatv_set_root(const char *root, size_t len) {
if (!root) len = 0;
if (len > sizeof(g_ddnatv_root) - 1) len = sizeof(g_ddnatv_root) - 1;
if (len > 0) memcpy(g_ddnatv_root, root, len);
if (len > 0) len = ddnatv_kernel_path(root, len, g_ddnatv_root, sizeof(g_ddnatv_root));
g_ddnatv_root[len] = '\0';
g_ddnatv_root_len = len;
}
@@ -61,6 +79,11 @@ static void ddnatv_load_binds(const char *spec) {
if (colon) *colon = '\0';
if (src[0] != '/' || dst[0] != '/' || strcmp(dst, "/") == 0) continue;
struct ddnatv_bind *b = &g_binds[g_nbinds++];
char kernel_src[PATH_MAX];
if (strcmp(src, dst) != 0) {
ddnatv_kernel_path(src, strlen(src), kernel_src, sizeof(kernel_src));
src = kernel_src;
}
b->src = strdup(src);
b->dst = strdup(dst);
b->src_len = strlen(src);
+7 -2
View File
@@ -7,6 +7,9 @@
#ifndef DDNATV_HOST_TEST
static char g_real_exe[PATH_MAX] = {0};
// DDNATV_EXEC: the app's libddexec.so. A targetSdk 29+ app may not execve() its data files; this
// executable maps one and starts it as the kernel would ("libddexec.so <file> <argv0> [args...]").
static char g_exec_loader[PATH_MAX] = {0};
// DDNATV_PRELOAD: guest paths of libraries every program loads before the hook (what
// /etc/ld.so.preload does for programs run by the rootfs's own ld.so), and the same as host paths.
static char *g_preload_guest = NULL;
@@ -34,12 +37,14 @@ static void init_ddnatv_hook(void) {
}
}
ddnatv_load_binds(getenv("DDNATV_BINDS"));
const char *exec_loader = getenv("DDNATV_EXEC");
if (exec_loader && exec_loader[0] == '/' && strlen(exec_loader) < sizeof(g_exec_loader))
ddnatv_copy_cstr(g_exec_loader, sizeof(g_exec_loader), exec_loader);
const char *hostname = getenv("DDNATV_HOSTNAME");
if (hostname && hostname[0] && strlen(hostname) < sizeof(g_hostname)) ddnatv_copy_cstr(g_hostname, sizeof(g_hostname), hostname);
const char *link_root = getenv("DDNATV_LINK_ROOT");
if (link_root && link_root[0] == '/' && strlen(link_root) < sizeof(g_link_root)) {
ddnatv_copy_cstr(g_link_root, sizeof(g_link_root), link_root);
g_link_root_len = strlen(g_link_root);
g_link_root_len = ddnatv_kernel_path(link_root, strlen(link_root), g_link_root, sizeof(g_link_root));
while (g_link_root_len > 1 && g_link_root[g_link_root_len - 1] == '/') g_link_root[--g_link_root_len] = 0;
}
const char *preload = getenv("DDNATV_PRELOAD");
+2 -2
View File
@@ -3,8 +3,8 @@
Built by `tools/proot/build.sh` with the NDK on top of termux/proot `4dba3afb` (Termux's
5.1.107-70 package, the proot the Linux runtime ships at `opt/android-host/proot`; every
`file.c:line` site in that binary matches this commit). talloc is linked in statically from
Samba's release tarball, so the apk carries one self-contained `libproot.so` plus
`libproot-loader.so`, and `LinuxRuntime` prefers them over the runtime's copy.
Samba's release tarball, so the proot add-on pack carries one self-contained `libproot.so`, which
Android's linker runs from app data, and the apk carries `libproot-loader.so`, which proot execs.
Ported from WinNative (`feature/proot-enhancements`, e7af0f24):
+7 -2
View File
@@ -17,8 +17,10 @@ PACKED = {'assets/linuxfs/usr/local/lib/droiddeck-xbox/': 'xbox', 'assets/linuxf
'assets/linuxfs/usr/local/lib/droiddeck-ubisoft/': 'ubisoft', 'assets/linuxfs/usr/local/lib/droiddeck-rockstar/': 'rockstar',
'assets/linuxfs/usr/local/lib/droiddeck-dirt/': 'dirt',
'assets/directaudio/': 'directaudio', 'assets/hybris/': 'powervr'}
PACKED_FILES = {'lib/arm64-v8a/libproot.so': ('proot', 'libproot.so'),
'lib/arm64-v8a/libproot-loader.so': ('proot', 'libproot-loader.so')}
# DrWeb flags proot itself as Tool.Linux.Proot; the app runs the pack's copy through Android's linker.
PACKED_FILES = {'lib/arm64-v8a/libproot.so': ('proot', 'libproot.so')}
# The loader is execve'd, which targetSdk 29+ allows only from the APK's native library directory.
PROOT_LOADER = {'lib/arm64-v8a/libproot-loader.so': 'libproot-loader.so'}
PACKED_LIBRARIES = ['lib/arm64-v8a/libopencv_java4.so', 'lib/arm64-v8a/libmediapipe_tasks_jni.so']
PACK_NAMES = ['proot', 'directaudio', 'tracking', 'xbox', 'comet', 'butler', 'powervr', 'ubisoft', 'rockstar', 'dirt']
SOURCE_PATHS = ['app/build.gradle', 'app/src/main/cpp/fakeinput_steam.cpp', 'app/src/main/assets/pulseaudio.tzst',
@@ -227,6 +229,9 @@ def check_apk(apk, root=ROOT):
data = verify(root)
packs = {name: pack_digests(root, name) for name in PACK_NAMES
if name not in ('ubisoft', 'rockstar', 'dirt') or (root / PACKS / (name + '.tar.zst')).is_file()}
for name, rel in PROOT_LOADER.items():
if packs['proot'].get(rel) != data['outputs'][name]['sha256']:
raise ValueError('Add-on pack proot is missing or has a stale ' + rel)
with ZipFile(apk) as package:
names = set(package.namelist())
for name in sorted(names):
@@ -0,0 +1,163 @@
import os
from pathlib import Path
import shutil
import socket
import struct
import subprocess
import sys
import tempfile
import threading
import unittest
SOURCE = Path(__file__).resolve().parents[2] / "app/src/main/cpp/fakeinput_steam.cpp"
MAGIC = 0x4655444B
EV_SYN, EV_KEY, EV_REL, EV_ABS = 0, 1, 2, 3
KEY_A, BTN_LEFT, REL_X = 30, 0x110, 0
PROGRAM = r"""
#include <fcntl.h>
#include <linux/uinput.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <unistd.h>
static int emit(int fd, int type, int code, int value) {
struct input_event ev;
memset(&ev, 0, sizeof(ev));
ev.type = type;
ev.code = code;
ev.value = value;
return write(fd, &ev, sizeof(ev)) == sizeof(ev) ? 0 : -1;
}
static int make(const char *name, const int *evs, const int *keys, const int *abses, int max) {
int fd = open("/dev/uinput", O_WRONLY | O_NONBLOCK);
if (fd < 0) return -1;
for (; *evs >= 0; evs++) ioctl(fd, UI_SET_EVBIT, *evs);
for (; *keys >= 0; keys++) ioctl(fd, UI_SET_KEYBIT, *keys);
for (; *abses >= 0; abses++) {
struct uinput_abs_setup abs;
memset(&abs, 0, sizeof(abs));
abs.code = *abses;
abs.absinfo.maximum = max;
ioctl(fd, UI_SET_ABSBIT, *abses);
ioctl(fd, UI_ABS_SETUP, &abs);
}
struct uinput_setup setup;
memset(&setup, 0, sizeof(setup));
setup.id.bustype = BUS_USB;
setup.id.vendor = 0x1209;
strncpy(setup.name, name, sizeof(setup.name) - 1);
if (ioctl(fd, UI_DEV_SETUP, &setup) < 0 || ioctl(fd, UI_DEV_CREATE) < 0) return -1;
return fd;
}
int main(void) {
static const int none[] = {-1};
static const int key_ev[] = {EV_KEY, -1}, rel_ev[] = {EV_KEY, EV_REL, -1}, abs_ev[] = {EV_KEY, EV_ABS, -1};
static const int abs_only[] = {EV_ABS, -1}, pad_ev[] = {EV_KEY, EV_ABS, -1};
static const int keyboard[] = {KEY_A, KEY_LEFTSHIFT, -1}, mouse[] = {BTN_LEFT, BTN_RIGHT, -1};
static const int pad_keys[] = {BTN_SOUTH, BTN_EAST, -1}, xy[] = {ABS_X, ABS_Y, -1}, xyz[] = {ABS_X, ABS_Y, ABS_Z, -1};
int kbd = make("test Keyboard", key_ev, keyboard, none, 0);
if (kbd < 0 || emit(kbd, EV_KEY, KEY_A, 1) || emit(kbd, EV_SYN, SYN_REPORT, 0)) return 1;
close(kbd);
int rel = make("test Mouse", rel_ev, mouse, none, 0);
if (rel < 0 || emit(rel, EV_REL, REL_X, 7) || emit(rel, EV_KEY, BTN_LEFT, 1) || emit(rel, EV_SYN, SYN_REPORT, 0)) return 2;
ioctl(rel, UI_DEV_DESTROY);
close(rel);
int abs = make("test Mouse (Absolute)", abs_ev, mouse, xy, 19200);
if (abs < 0 || emit(abs, EV_ABS, ABS_X, 9600) || emit(abs, EV_SYN, SYN_REPORT, 0)) return 3;
close(abs);
int sensor = make("test Motion Sensors", abs_only, none, xyz, 32767);
if (sensor < 0 || emit(sensor, EV_ABS, ABS_X, 5) || emit(sensor, EV_SYN, SYN_REPORT, 0)) return 4;
close(sensor);
int pad = make("test Gamepad", pad_ev, pad_keys, xy, 32767);
if (pad < 0 || emit(pad, EV_KEY, BTN_SOUTH, 1) || emit(pad, EV_SYN, SYN_REPORT, 0)) return 5;
char ring[4096];
snprintf(ring, sizeof(ring), "%s/.uinput-event16", getenv("FAKE_EVDEV_DIR"));
if (access(ring, F_OK) != 0) return 6;
snprintf(ring, sizeof(ring), "%s/.uinput-event17", getenv("FAKE_EVDEV_DIR"));
if (access(ring, F_OK) == 0) return 7;
close(pad);
return 0;
}
"""
@unittest.skipUnless(sys.platform == "linux" and shutil.which("g++") and shutil.which("gcc"), "needs Linux, gcc and g++")
class FakeinputDesktopUinputTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.tmp = Path(tempfile.mkdtemp())
cls.addClassCleanup(shutil.rmtree, cls.tmp, True)
cls.library = cls.tmp / "libfakeinput.so"
subprocess.run(["g++", "-shared", "-fPIC", "-O2", "-Wno-attributes", "-pthread", "-std=c++17",
"-static-libstdc++", "-static-libgcc", "-Wl,--exclude-libs,ALL", "-o", str(cls.library),
str(SOURCE), "-ldl"], check=True)
cls.program = cls.tmp / "program"
(cls.tmp / "program.c").write_text(PROGRAM)
subprocess.run(["gcc", "-o", str(cls.program), str(cls.tmp / "program.c")], check=True)
def run_program(self):
hooks = Path(tempfile.mkdtemp(dir=self.tmp))
env = dict(os.environ, LD_PRELOAD=str(self.library), FAKE_EVDEV_DIR=str(hooks), FAKE_EVDEV_UINPUT="1")
run = subprocess.run([str(self.program)], env=env, capture_output=True, timeout=10)
self.assertEqual(run.returncode, 0, run.stderr)
def devices(self):
server = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
self.addCleanup(server.close)
try:
server.bind("\0droiddeck-uinput")
except OSError:
self.skipTest("the desktop input socket name is taken on this machine")
server.listen(16)
server.settimeout(5)
got = []
def accept():
while True:
try:
client, _ = server.accept()
except OSError:
return
with client:
data = b""
while chunk := client.recv(4096):
data += chunk
got.append(data)
reader = threading.Thread(target=accept, daemon=True)
reader.start()
self.run_program()
server.settimeout(0.5)
reader.join(10)
return got
@staticmethod
def decode(data):
header = struct.unpack_from("<Iiiii", data)
events = [struct.unpack_from("<HHi", data, 20 + i * 8) for i in range((len(data) - 20) // 8)]
return header, events
def test_keyboard_and_mice_reach_the_app_while_sensors_and_gamepads_do_not(self):
got = self.devices()
self.assertEqual(len(got), 3)
decoded = [self.decode(d) for d in got]
self.assertEqual(decoded[0], ((MAGIC, 0, 0, 0, 0), [(EV_KEY, KEY_A, 1), (EV_SYN, 0, 0)]))
self.assertEqual(decoded[1], ((MAGIC, 0, 0, 0, 0), [(EV_REL, REL_X, 7), (EV_KEY, BTN_LEFT, 1), (EV_SYN, 0, 0)]))
self.assertEqual(decoded[2], ((MAGIC, 0, 19200, 0, 19200), [(EV_ABS, 0, 9600), (EV_SYN, 0, 0)]))
def test_without_the_app_listening_devices_still_work(self):
self.run_program()
if __name__ == "__main__":
unittest.main()
+48
View File
@@ -1,6 +1,7 @@
import json
import os
from pathlib import Path
import shutil
import subprocess
import sys
import tempfile
@@ -100,3 +101,50 @@ class DesktopGamescopeBackendTest(unittest.TestCase):
self.assertEqual(64, result.returncode)
self.assertIn("unsupported gamescope backend: drm", result.stderr)
self.assertIsNone(capture)
class DesktopGamescopeReaperTest(unittest.TestCase):
def launch(self, reaper_on_path):
with tempfile.TemporaryDirectory() as directory:
root = Path(directory)
bin_dir = root / "bin"
games = root / "games"
bin_dir.mkdir()
games.mkdir()
capture = root / "path.txt"
gamescope = bin_dir / "gamescope"
gamescope.write_text(
"#!/bin/sh\n"
"printf '%s\\n' \"$PATH\" > \"$GAMESCOPE_CAPTURE\"\n"
"command -v gamescopereaper >> \"$GAMESCOPE_CAPTURE\" || exit 3\n"
)
gamescope.chmod(0o755)
reaper = (bin_dir if reaper_on_path else games) / "gamescopereaper"
reaper.write_text("#!/bin/sh\n")
reaper.chmod(0o755)
date = bin_dir / "date"
date.write_text(f"#!/bin/sh\nexec {shutil.which('date')} \"$@\"\n")
date.chmod(0o755)
script = root / "droiddeck-gpu"
source = DESKTOP_GPU.read_text()
self.assertIn("for dir in /usr/games ", source)
script.write_text(source.replace("for dir in /usr/games ", f"for dir in {games} ", 1))
start_path = str(bin_dir)
env = {"PATH": start_path, "HOME": directory, "GAMESCOPE_CAPTURE": str(capture),
"WAYLAND_DISPLAY": "desktop-0", "BL_DESKTOP_GPU_WINDOW": "0"}
result = subprocess.run(["/bin/bash", str(script), "demo"], env=env, text=True,
capture_output=True, timeout=5)
lines = capture.read_text().splitlines() if capture.exists() else []
return result, start_path, lines, str(reaper)
def test_reaper_outside_path_is_added_for_gamescope(self):
result, start_path, lines, reaper = self.launch(reaper_on_path=False)
self.assertEqual(0, result.returncode, result.stdout + result.stderr)
self.assertEqual(start_path + os.pathsep + str(Path(reaper).parent), lines[0])
self.assertEqual(reaper, lines[1])
def test_path_with_reaper_is_left_as_it_is(self):
result, start_path, lines, reaper = self.launch(reaper_on_path=True)
self.assertEqual(0, result.returncode, result.stdout + result.stderr)
self.assertEqual(start_path, lines[0])
self.assertEqual(reaper, lines[1])
+1 -1
View File
@@ -13,7 +13,7 @@ SOURCE = ROOT / 'app/src/main/cpp/waylandcomp/src/compositor.c'
def extract_function(source, name):
match = re.search(r'^(?:static )?(?:void|int|uint32_t) ' + re.escape(name) + r'\([^;]*?\) \{',
match = re.search(r'^(?:static )?(?:void |int |uint32_t |const char \*)' + re.escape(name) + r'\([^;]*?\) \{',
source, re.MULTILINE)
if match is None:
raise AssertionError(f'Missing compositor function: {name}')
+66 -1
View File
@@ -51,6 +51,19 @@ static int vkp_cardboard_pose_changed(void) { return pose_changes; }
static void render_scene(void) { renders++; g_dirty = 0; g_dirty_since_ns = 0; g_rendered_tick_ns = g_tick_vsync_ns; g_tick_held = 0; }
static int on_fallback_timer(void *data) { return 0; }
static void on_commit_idle(void *data);
volatile int g_bfi;
volatile int g_bfi_picture_hold;
static int g_bfi_running, g_scene_layer_only, cardboard, quest, blacks;
static unsigned g_bfi_phase;
static const char *g_bfi_blocked;
static struct { unsigned lit, dark, failed; } g_bfi_stats;
static int g_scene_w, g_scene_h;
#define BFI_MIN_REFRESH_MHZ 99000
static atomic_int g_output_refresh_mhz = 144000;
static int vkp_cardboard_active(void) { return cardboard; }
static int vkp_quest_layer_presentation(void) { return quest; }
static int vkp_render_plain(int w, int h) { blacks++; return 0; }
static void droiddeck_log(const char *tag, const char *fmt, ...) {}
'''
CHECKS = r'''
@@ -186,6 +199,57 @@ int main(void) {
assert(renders - r0 == c + 1);
}
/* black frame insertion alternates the scene and black on every tick, and arrivals draw nothing */
{
const int idles_before = idles_added;
const int b0 = blacks;
g_bfi = 1;
r0 = renders;
for (int i = 0; i < 10; i++) {
arrive(1 * ms);
tick(t += refresh);
}
assert(g_bfi_running == 1 && idles_added == idles_before);
assert(renders - r0 == 5 && blacks - b0 == 5 && g_bfi_stats.lit == 5 && g_bfi_stats.dark == 5);
/* a capture's picture hold presents only pictures and keeps BFI composing the scene */
g_bfi_picture_hold = 1;
r0 = renders;
const int hb = blacks;
for (int i = 0; i < 4; i++) tick(t += refresh);
assert(g_bfi_running == 1 && renders - r0 == 4 && blacks == hb);
g_bfi_picture_hold = 0;
r0 = renders;
for (int i = 0; i < 4; i++) tick(t += refresh);
assert(renders - r0 == 2 && blacks - hb == 2);
/* frame generation, a slow screen or a layer-only game make it wait and the tick draws as before */
framegen = 1;
tick(t += refresh);
assert(g_bfi_running == 0 && g_bfi_blocked != NULL);
framegen = 0;
tick(t += refresh);
assert(g_bfi_running == 1);
g_output_refresh_mhz = 60000;
tick(t += refresh);
assert(g_bfi_running == 0);
g_output_refresh_mhz = 144000;
tick(t += refresh);
assert(g_bfi_running == 1);
/* late ticks under load do not switch it off while the panel runs fast */
g_refresh_ns = 16666667;
tick(t += refresh);
assert(g_bfi_running == 1);
g_refresh_ns = refresh;
g_scene_layer_only = 1;
tick(t += refresh);
assert(g_bfi_running == 0);
g_scene_layer_only = 0;
g_bfi = 0;
tick(t += refresh);
assert(g_bfi_running == 0 && g_bfi_blocked == NULL);
}
/* without screen ticks the fallback timer still draws */
clock_ns += 200000000LL;
schedule_render();
@@ -206,7 +270,8 @@ class RenderOnCommitTest(unittest.TestCase):
render = extract_function(source, 'render_scene')
self.assertIn('g_rendered_tick_ns = g_tick_vsync_ns;', render)
self.assertIn('g_tick_held = 0;', render)
functions = ('scene_held_for_limit', 'commit_renders_on', 'render_on_commit', 'schedule_render', 'scene_waits_for_game', 'on_commit_idle', 'on_vsync')
functions = ('scene_held_for_limit', 'commit_renders_on', 'render_on_commit', 'schedule_render', 'scene_waits_for_game', 'on_commit_idle',
'bfi_blocked', 'bfi_update', 'bfi_tick', 'on_vsync')
harness = PREAMBLE + '\n'.join(extract_function(source, name) for name in functions) + CHECKS
with tempfile.TemporaryDirectory(prefix='droiddeck-render-on-commit-') as folder:
path = Path(folder)
+15
View File
@@ -59,6 +59,8 @@ class RuntimeInputsTest(unittest.TestCase):
proot = {}
for name, (pack, rel) in runtime.PACKED_FILES.items():
proot[rel] = (self.root / runtime.outputs(self.root)[name]).read_bytes()
for name, rel in runtime.PROOT_LOADER.items():
proot[rel] = (self.root / runtime.outputs(self.root)[name]).read_bytes()
self.pack('proot', proot)
self.pack('butler', {'butler': b'butler', '7z.so': b'7z', 'libc7zip.so': b'c7zip', 'version': b'15.32.0'})
for prefix, name in runtime.PACKED.items():
@@ -84,6 +86,19 @@ class RuntimeInputsTest(unittest.TestCase):
with self.assertRaisesRegex(ValueError, 'proot pack provides'):
runtime.check_apk(apk, self.root)
def test_a_stale_proot_loader_in_the_pack_is_rejected(self):
apk = self.current_apk(self.root / 'current.apk')
loader = (self.root / 'app/src/main/jniLibs/arm64-v8a/libproot-loader.so').read_bytes()
self.pack('proot', {'libproot.so': (self.root / 'app/src/main/jniLibs/arm64-v8a/libproot.so').read_bytes(),
'libproot-loader.so': loader + b'older'})
with self.assertRaisesRegex(ValueError, 'proot is missing or has a stale libproot-loader.so'):
runtime.check_apk(apk, self.root)
def test_only_the_proot_loader_ships_in_the_apk(self):
self.assertFalse(self.in_apk('lib/arm64-v8a/libproot.so'))
self.assertTrue(self.in_apk('lib/arm64-v8a/libproot-loader.so'))
runtime.check_apk(self.current_apk(self.root / 'current.apk'), self.root)
def test_missing_proot_cannot_be_attested(self):
(self.root / 'app/src/main/jniLibs/arm64-v8a/libproot.so').unlink()
with self.assertRaisesRegex(ValueError, 'libproot.so'):
+1 -1
View File
@@ -90,7 +90,7 @@ int __android_log_print(int, const char *, const char *, ...);
built = subprocess.run([cc, '-std=c11', '-Wall', '-Wextra', '-Werror',
'-Wno-unused-parameter', '-Wno-missing-field-initializers', '-UNDEBUG',
'-I', str(tmp), '-idirafter', str(headers), '-I', str(SOURCE.parent),
str(probe), '-pthread', '-o', str(cls.binary)],
str(probe), '-pthread', '-lm', '-o', str(cls.binary)],
capture_output=True, text=True)
if built.returncode:
raise AssertionError(built.stdout + built.stderr)