mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-05 20:45:43 +00:00
Compare commits
38
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01b45d0f08 | ||
|
|
0a7d0929b7 | ||
|
|
6dc3d01674 | ||
|
|
df2cfa40b3 | ||
|
|
e101a78791 | ||
|
|
aaa9fb129c | ||
|
|
23d7e639ca | ||
|
|
4ef23ed0e9 | ||
|
|
ff35cce127 | ||
|
|
0951b602b7 | ||
|
|
57055be6fb | ||
|
|
c6743730aa | ||
|
|
780c5658d0 | ||
|
|
a9e8a01bb6 | ||
|
|
861121144c | ||
|
|
d7fcea74b4 | ||
|
|
44b429ca20 | ||
|
|
c91b100bc1 | ||
|
|
90df30f4d7 | ||
|
|
2b6ded9fd4 | ||
|
|
38c2c00c86 | ||
|
|
678057d727 | ||
|
|
ae94009382 | ||
|
|
fd93a35b72 | ||
|
|
12fa3ac343 | ||
|
|
422b339af8 | ||
|
|
1d155b2fe0 | ||
|
|
131a351f3f | ||
|
|
a4c2fa8aec | ||
|
|
fe4f619973 | ||
|
|
9b7ce457a5 | ||
|
|
d2031ba384 | ||
|
|
c833514757 | ||
|
|
97a998a3b9 | ||
|
|
31ee95250c | ||
|
|
689ecc40ad | ||
|
|
3bef9a4200 | ||
|
|
cd1e9dde15 |
No files matched your search
@@ -740,7 +740,8 @@ jobs:
|
||||
echo "version=$(grep -o "org.robolectric:robolectric:[0-9.]*" app/build.gradle | cut -d: -f3)" >> "$GITHUB_OUTPUT"
|
||||
# Robolectric downloads these from Maven Central on first use without retrying, and 429s fail whole test classes.
|
||||
# The cache path sits beside the workspace because runner homes are at different depths from it, and
|
||||
# actions/cache stores paths relative to the workspace. Runners that keep their own ~/.m2 skip the cache.
|
||||
# actions/cache stores paths relative to the workspace. It is passed as an absolute path: the save action rejects
|
||||
# "..". Runners that keep their own ~/.m2 skip the cache.
|
||||
- name: Place Robolectric's Android jars beside the workspace
|
||||
id: robolectric-jars
|
||||
run: |
|
||||
@@ -751,7 +752,9 @@ jobs:
|
||||
echo "cache=false" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
mkdir -p "$jars" "$(dirname "$m2")"
|
||||
ln -sfn "$(cd "$jars" && pwd)" "$m2"
|
||||
jars=$(cd "$jars" && pwd)
|
||||
ln -sfn "$jars" "$m2"
|
||||
echo "path=$jars" >> "$GITHUB_OUTPUT"
|
||||
echo "cache=true" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
- name: Restore Robolectric's Android jars
|
||||
@@ -759,7 +762,7 @@ jobs:
|
||||
if: steps.robolectric-jars.outputs.cache == 'true'
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ../robolectric-jars
|
||||
path: ${{ steps.robolectric-jars.outputs.path }}
|
||||
key: robolectric-android-all-v3-${{ steps.robolectric.outputs.version }}-${{ github.run_id }}
|
||||
restore-keys: robolectric-android-all-v3-${{ steps.robolectric.outputs.version }}-
|
||||
- name: Count the restored Robolectric jars
|
||||
@@ -773,7 +776,16 @@ jobs:
|
||||
run: |
|
||||
set -o pipefail
|
||||
mkdir -p app/build
|
||||
./gradlew testReleaseUnitTest --console=plain --info --stacktrace -Drobolectric.logging=stderr -PndkVersion="$NDK_VERSION" 2>&1 | tee app/build/unit-tests.log
|
||||
# A Maven 429 fails every test class that needs the missing jar. The jars an attempt did get stay for the next.
|
||||
for wait in 60 180 0; do
|
||||
status=0
|
||||
./gradlew testReleaseUnitTest --console=plain --info --stacktrace -Drobolectric.logging=stderr -PndkVersion="$NDK_VERSION" 2>&1 | tee app/build/unit-tests.log || status=$?
|
||||
if [ "$status" = 0 ] || [ "$wait" = 0 ] || ! grep -Eq '^[[:space:]]*(Caused by: org\.gradle\.internal\.resource\.transport\.http\.HttpErrorStatusCodeException: Could not GET .*https://repo\.maven\.apache\.org/.*Received status code 429 from server|Caused by: java\.io\.IOException: Server returned HTTP response code: 429 for URL: https://repo\.maven\.apache\.org/)' app/build/unit-tests.log; then
|
||||
exit "$status"
|
||||
fi
|
||||
echo "::warning::Maven Central answered 429; running the unit tests again in ${wait}s"
|
||||
sleep "$wait"
|
||||
done
|
||||
|
||||
# actions/cache only saves when the job succeeds, so a run whose tests died on a Maven 429 never filled the cache.
|
||||
# Save the complete jars even after a failed test step, when this run added some; a partial download is dropped first.
|
||||
@@ -800,7 +812,7 @@ jobs:
|
||||
if: always() && steps.robolectric-jars-final.outputs.save == 'true'
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: ../robolectric-jars
|
||||
path: ${{ steps.robolectric-jars.outputs.path }}
|
||||
key: robolectric-android-all-v3-${{ steps.robolectric.outputs.version }}-${{ github.run_id }}
|
||||
|
||||
- name: Upload unit test diagnostics
|
||||
|
||||
@@ -4130,6 +4130,17 @@ EXPORT ssize_t read(int fd, void *buf, size_t count) {
|
||||
return read_input(fd, buf, count);
|
||||
}
|
||||
|
||||
extern "C" [[noreturn]] void __chk_fail(void);
|
||||
|
||||
/* Programs built with _FORTIFY_SOURCE (Flatpak runtimes among them) call these instead of read, poll
|
||||
* and ppoll, and glibc's versions go straight to the kernel. */
|
||||
EXPORT ssize_t __read_chk(int fd, void *buf, size_t count, size_t buflen) {
|
||||
static auto next_read_chk = reinterpret_cast<ssize_t (*)(int, void *, size_t, size_t)>(dlsym(RTLD_NEXT, "__read_chk"));
|
||||
if (count > buflen) __chk_fail();
|
||||
if (next_read_chk && !is_fake_input_fd(fd)) return next_read_chk(fd, buf, count, buflen);
|
||||
return read_input(fd, buf, count);
|
||||
}
|
||||
|
||||
EXPORT ssize_t readv(int fd, const struct iovec *iov, int iovcnt) {
|
||||
if (!is_fake_input_fd(fd)) return syscall(SYS_readv, fd, iov, iovcnt);
|
||||
if (iovcnt < 0 || iovcnt > IOV_MAX) {
|
||||
@@ -4378,6 +4389,17 @@ EXPORT int ppoll(struct pollfd *fds, nfds_t nfds,
|
||||
return my_ppoll(fds, nfds, timeout, sigmask);
|
||||
}
|
||||
|
||||
EXPORT int __poll_chk(struct pollfd *fds, nfds_t nfds, int timeout, size_t fdslen) {
|
||||
if (fdslen / sizeof(*fds) < nfds) __chk_fail();
|
||||
return poll(fds, nfds, timeout);
|
||||
}
|
||||
|
||||
EXPORT int __ppoll_chk(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout,
|
||||
const sigset_t *sigmask, size_t fdslen) {
|
||||
if (fdslen / sizeof(*fds) < nfds) __chk_fail();
|
||||
return ppoll(fds, nfds, timeout, sigmask);
|
||||
}
|
||||
|
||||
EXPORT int select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *exceptfds, struct timeval *timeout) {
|
||||
const auto my_select = next_symbol<decltype(&::select)>(Next::select);
|
||||
|
||||
@@ -614,10 +614,13 @@ private:
|
||||
XrSessionBeginInfo begin{XR_TYPE_SESSION_BEGIN_INFO};
|
||||
begin.primaryViewConfigurationType = XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO;
|
||||
check(xrBeginSession(session_, &begin), "xrBeginSession"); running_ = true;
|
||||
// Meta's clock governor scales clocks by the DroidDeck process's overall load and cannot see
|
||||
// SteamVR missing refreshes inside the guest; holding the top level kept it at 72 Hz.
|
||||
if (setPerformance_) {
|
||||
for (auto domain : {XR_PERF_SETTINGS_DOMAIN_CPU_EXT, XR_PERF_SETTINGS_DOMAIN_GPU_EXT}) {
|
||||
XrResult request = setPerformance_(session_, domain, XR_PERF_SETTINGS_LEVEL_SUSTAINED_HIGH_EXT);
|
||||
__android_log_print(ANDROID_LOG_INFO, "DroidDeckXR", "sustained performance domain=%d result=%d", domain, request);
|
||||
XrResult request = setPerformance_(session_, domain, XR_PERF_SETTINGS_LEVEL_BOOST_EXT);
|
||||
if (XR_FAILED(request)) request = setPerformance_(session_, domain, XR_PERF_SETTINGS_LEVEL_SUSTAINED_HIGH_EXT);
|
||||
__android_log_print(ANDROID_LOG_INFO, "DroidDeckXR", "performance domain=%d result=%d", domain, request);
|
||||
}
|
||||
}
|
||||
} else if (state_ == XR_SESSION_STATE_STOPPING) {
|
||||
|
||||
@@ -133,10 +133,10 @@ static void handle_released(uint64_t id, int fd) {
|
||||
if (fd >= 0) {
|
||||
struct droiddeck_dma_buf_sync_file imp = {.flags = DROIDDECK_DMA_BUF_SYNC_READ, .fd = fd};
|
||||
int dmabuf_fd = droiddeck_dmabuf_fd(ab->b);
|
||||
if (!ab->display && dmabuf_fd >= 0 && ioctl(dmabuf_fd, DROIDDECK_DMA_BUF_IOCTL_IMPORT_SYNC_FILE, &imp) == 0) {
|
||||
if (dmabuf_fd >= 0 && ioctl(dmabuf_fd, DROIDDECK_DMA_BUF_IOCTL_IMPORT_SYNC_FILE, &imp) == 0) {
|
||||
close(fd);
|
||||
} else {
|
||||
if (!ab->display && !g_import_failed_logged) {
|
||||
if (!g_import_failed_logged) {
|
||||
g_import_failed_logged = 1;
|
||||
droiddeck_log("layer", "zero-copy: DMA_BUF_IOCTL_IMPORT_SYNC_FILE failed (%s): releases wait for the display's fence here instead",
|
||||
strerror(errno));
|
||||
|
||||
@@ -242,6 +242,10 @@ struct surface {
|
||||
enum surface_role role;
|
||||
struct wl_resource *idle_buffer;
|
||||
struct wl_listener idle_buffer_destroy;
|
||||
struct surface_state *waiting;
|
||||
struct wl_event_source *waiting_source, *waiting_timer;
|
||||
int waiting_fd;
|
||||
int64_t waiting_since_ns;
|
||||
uint32_t *idle_px;
|
||||
int idle_w, idle_h;
|
||||
struct wl_resource *xdg_surface, *xdg_toplevel;
|
||||
@@ -373,6 +377,8 @@ static struct {
|
||||
unsigned copy_scenes;
|
||||
unsigned releases, releases_held;
|
||||
int64_t release_ns, release_max_ns;
|
||||
unsigned commit_waits, commit_wait_limits;
|
||||
int64_t commit_wait_ns, commit_wait_max_ns;
|
||||
} g_perf;
|
||||
|
||||
static void schedule_render(void);
|
||||
@@ -846,6 +852,55 @@ static void on_pending_buffer_destroyed(struct wl_listener *l, void *data) {
|
||||
s->pending_buffer = NULL;
|
||||
}
|
||||
|
||||
struct surface_state {
|
||||
struct wl_resource *buffer;
|
||||
struct wl_listener buffer_destroy;
|
||||
int attach;
|
||||
int src_set, dst_set, opaque_set;
|
||||
float src[4];
|
||||
int dst[2], opaque[4];
|
||||
struct damage_list damage_buf, damage_local;
|
||||
struct wl_list frames, feedback;
|
||||
};
|
||||
|
||||
static void on_state_buffer_destroyed(struct wl_listener *l, void *data) {
|
||||
struct surface_state *st = wl_container_of(l, st, buffer_destroy);
|
||||
wl_list_remove(&st->buffer_destroy.link);
|
||||
wl_list_init(&st->buffer_destroy.link);
|
||||
st->buffer = NULL;
|
||||
st->attach = 0;
|
||||
}
|
||||
|
||||
static void surface_state_take(struct surface *s, struct surface_state *st) {
|
||||
st->attach = s->pending_attach;
|
||||
st->buffer = s->pending_buffer;
|
||||
wl_list_init(&st->buffer_destroy.link);
|
||||
if (st->buffer) {
|
||||
wl_list_remove(&s->pending_buffer_destroy.link);
|
||||
wl_list_init(&s->pending_buffer_destroy.link);
|
||||
st->buffer_destroy.notify = on_state_buffer_destroyed;
|
||||
wl_resource_add_destroy_listener(st->buffer, &st->buffer_destroy);
|
||||
}
|
||||
s->pending_buffer = NULL;
|
||||
s->pending_attach = 0;
|
||||
st->src_set = s->pending_src_set;
|
||||
memcpy(st->src, s->pending_src, sizeof(st->src));
|
||||
st->dst_set = s->pending_dst_set;
|
||||
memcpy(st->dst, s->pending_dst, sizeof(st->dst));
|
||||
st->opaque_set = s->pending_opaque_set;
|
||||
memcpy(st->opaque, s->pending_opaque, sizeof(st->opaque));
|
||||
s->pending_src_set = s->pending_dst_set = s->pending_opaque_set = 0;
|
||||
st->damage_buf = s->pending_damage_buf;
|
||||
st->damage_local = s->pending_damage_local;
|
||||
s->pending_damage_buf.n = s->pending_damage_local.n = 0;
|
||||
wl_list_init(&st->frames);
|
||||
wl_list_insert_list(&st->frames, &s->pending_frames);
|
||||
wl_list_init(&s->pending_frames);
|
||||
wl_list_init(&st->feedback);
|
||||
wl_list_insert_list(&st->feedback, &s->pending_feedback);
|
||||
wl_list_init(&s->pending_feedback);
|
||||
}
|
||||
|
||||
static void fire_frames(struct wl_list *frames) {
|
||||
struct wl_resource *cb, *tmp;
|
||||
uint32_t t;
|
||||
@@ -1363,35 +1418,23 @@ static void surface_drop_idle(struct surface *s) {
|
||||
if (buffer) send_buffer_release(buffer);
|
||||
}
|
||||
|
||||
static void surface_commit(struct wl_client *c, struct wl_resource *r) {
|
||||
struct surface *s = wl_resource_get_user_data(r);
|
||||
static void surface_state_apply(struct surface *s, struct surface_state *st) {
|
||||
struct surface *child;
|
||||
|
||||
if (s->xdg_toplevel && !s->toplevel_committed) {
|
||||
s->toplevel_committed = 1;
|
||||
send_toplevel_configure(s);
|
||||
if (st->src_set) {
|
||||
s->src_set = st->src[2] > 0;
|
||||
memcpy(s->src, st->src, sizeof(s->src));
|
||||
}
|
||||
if (st->dst_set) {
|
||||
s->dst_set = st->dst[0] > 0;
|
||||
memcpy(s->dst, st->dst, sizeof(s->dst));
|
||||
}
|
||||
if (st->opaque_set) memcpy(s->opaque, st->opaque, sizeof(s->opaque));
|
||||
|
||||
if (s->pending_src_set) {
|
||||
s->src_set = s->pending_src[2] > 0;
|
||||
memcpy(s->src, s->pending_src, sizeof(s->src));
|
||||
s->pending_src_set = 0;
|
||||
}
|
||||
if (s->pending_dst_set) {
|
||||
s->dst_set = s->pending_dst[0] > 0;
|
||||
memcpy(s->dst, s->pending_dst, sizeof(s->dst));
|
||||
s->pending_dst_set = 0;
|
||||
}
|
||||
if (s->pending_opaque_set) {
|
||||
memcpy(s->opaque, s->pending_opaque, sizeof(s->opaque));
|
||||
s->pending_opaque_set = 0;
|
||||
}
|
||||
|
||||
s->damage_buf = s->pending_damage_buf;
|
||||
s->damage_local = s->pending_damage_local;
|
||||
s->pending_damage_buf.n = s->pending_damage_local.n = 0;
|
||||
if (s->pending_attach) {
|
||||
struct wl_resource *buffer = s->pending_buffer;
|
||||
s->damage_buf = st->damage_buf;
|
||||
s->damage_local = st->damage_local;
|
||||
if (st->attach) {
|
||||
struct wl_resource *buffer = st->buffer;
|
||||
struct dmabuf_buffer *db = get_dmabuf(buffer);
|
||||
struct wl_shm_buffer *shm = buffer && !db ? wl_shm_buffer_get(buffer) : NULL;
|
||||
uint8_t pixel[4];
|
||||
@@ -1400,12 +1443,10 @@ static void surface_commit(struct wl_client *c, struct wl_resource *r) {
|
||||
if (!buffer) g_pace.null_attaches++;
|
||||
else if (!db) s->last_dmabuf = NULL;
|
||||
|
||||
if (buffer) {
|
||||
wl_list_remove(&s->pending_buffer_destroy.link);
|
||||
wl_list_init(&s->pending_buffer_destroy.link);
|
||||
}
|
||||
s->pending_buffer = NULL;
|
||||
s->pending_attach = 0;
|
||||
wl_list_remove(&st->buffer_destroy.link);
|
||||
wl_list_init(&st->buffer_destroy.link);
|
||||
st->buffer = NULL;
|
||||
st->attach = 0;
|
||||
|
||||
surface_drop_idle(s);
|
||||
buf_trace_attach(buffer);
|
||||
@@ -1442,10 +1483,10 @@ static void surface_commit(struct wl_client *c, struct wl_resource *r) {
|
||||
}
|
||||
}
|
||||
|
||||
wl_list_insert_list(s->frames.prev, &s->pending_frames);
|
||||
wl_list_init(&s->pending_frames);
|
||||
wl_list_insert_list(s->feedback.prev, &s->pending_feedback);
|
||||
wl_list_init(&s->pending_feedback);
|
||||
wl_list_insert_list(s->frames.prev, &st->frames);
|
||||
wl_list_init(&st->frames);
|
||||
wl_list_insert_list(s->feedback.prev, &st->feedback);
|
||||
wl_list_init(&st->feedback);
|
||||
constraints_surface_commit(s);
|
||||
droiddeck_color_commit(s->resource);
|
||||
|
||||
@@ -1455,6 +1496,186 @@ static void surface_commit(struct wl_client *c, struct wl_resource *r) {
|
||||
}
|
||||
schedule_render();
|
||||
}
|
||||
|
||||
#define COMMIT_WAIT_LIMIT_MS 1000
|
||||
|
||||
static struct surface *g_zero_copy_shown, *g_unwaited;
|
||||
|
||||
static int state_unfinished_fd(const struct surface *s, const struct surface_state *st, int *unwaited) {
|
||||
struct dmabuf_buffer *db = st->attach ? get_dmabuf(st->buffer) : NULL;
|
||||
int fd = -1;
|
||||
*unwaited = 0;
|
||||
for (int i = 0; db && fd < 0 && i < db->n_planes; i++) {
|
||||
if (db->fd[i] < 0) continue;
|
||||
struct pollfd p = {.fd = db->fd[i], .events = POLLIN};
|
||||
int r;
|
||||
do { r = poll(&p, 1, 0); } while (r < 0 && errno == EINTR);
|
||||
if (r == 0) fd = db->fd[i];
|
||||
}
|
||||
if (fd >= 0 && s == g_zero_copy_shown && ahb_swapchain_has_ahb(db)) {
|
||||
*unwaited = 1;
|
||||
return -1;
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
|
||||
static void settle_unwaited(void) {
|
||||
struct surface *s = g_unwaited;
|
||||
if (!s) return;
|
||||
g_unwaited = NULL;
|
||||
struct dmabuf_buffer *db = s->dmabuf_buf;
|
||||
const int64_t deadline = now_ns() + 100000000LL;
|
||||
for (int i = 0; db && i < db->n_planes; i++) {
|
||||
if (db->fd[i] < 0) continue;
|
||||
struct pollfd p = {.fd = db->fd[i], .events = POLLIN};
|
||||
for (;;) {
|
||||
const int64_t left = deadline - now_ns();
|
||||
const int r = poll(&p, 1, left > 0 ? (int)((left + 999999) / 1000000) : 0);
|
||||
if (r >= 0 || errno != EINTR || left <= 0) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void surface_state_discard(struct surface_state *st) {
|
||||
struct wl_resource *cb, *tmp;
|
||||
wl_list_remove(&st->buffer_destroy.link);
|
||||
wl_resource_for_each_safe(cb, tmp, &st->frames) wl_resource_destroy(cb);
|
||||
feedback_discard_all(&st->feedback);
|
||||
free(st);
|
||||
}
|
||||
|
||||
static void surface_state_merge(struct surface_state *older, struct surface_state *newer) {
|
||||
if (older->attach && !newer->attach) {
|
||||
newer->attach = 1;
|
||||
newer->buffer = older->buffer;
|
||||
wl_list_remove(&older->buffer_destroy.link);
|
||||
wl_list_init(&older->buffer_destroy.link);
|
||||
if (newer->buffer) {
|
||||
newer->buffer_destroy.notify = on_state_buffer_destroyed;
|
||||
wl_resource_add_destroy_listener(newer->buffer, &newer->buffer_destroy);
|
||||
}
|
||||
wl_list_insert_list(&newer->feedback, &older->feedback);
|
||||
wl_list_init(&older->feedback);
|
||||
} else if (older->attach) {
|
||||
if (older->buffer && older->buffer != newer->buffer) send_buffer_release(older->buffer);
|
||||
g_pace.replaced += feedback_discard_all(&older->feedback);
|
||||
}
|
||||
if (older->src_set && !newer->src_set) {
|
||||
newer->src_set = 1;
|
||||
memcpy(newer->src, older->src, sizeof(newer->src));
|
||||
}
|
||||
if (older->dst_set && !newer->dst_set) {
|
||||
newer->dst_set = 1;
|
||||
memcpy(newer->dst, older->dst, sizeof(newer->dst));
|
||||
}
|
||||
if (older->opaque_set && !newer->opaque_set) {
|
||||
newer->opaque_set = 1;
|
||||
memcpy(newer->opaque, older->opaque, sizeof(newer->opaque));
|
||||
}
|
||||
for (int i = 0; i < older->damage_buf.n; i++)
|
||||
note_damage(&newer->damage_buf, older->damage_buf.r[i][0], older->damage_buf.r[i][1],
|
||||
older->damage_buf.r[i][2], older->damage_buf.r[i][3]);
|
||||
for (int i = 0; i < older->damage_local.n; i++)
|
||||
note_damage(&newer->damage_local, older->damage_local.r[i][0], older->damage_local.r[i][1],
|
||||
older->damage_local.r[i][2], older->damage_local.r[i][3]);
|
||||
wl_list_insert_list(&newer->frames, &older->frames);
|
||||
wl_list_init(&older->frames);
|
||||
surface_state_discard(older);
|
||||
}
|
||||
|
||||
static void surface_wait_stop(struct surface *s) {
|
||||
if (s->waiting_source) wl_event_source_remove(s->waiting_source);
|
||||
if (s->waiting_timer) wl_event_source_remove(s->waiting_timer);
|
||||
if (s->waiting_fd >= 0) close(s->waiting_fd);
|
||||
s->waiting_source = s->waiting_timer = NULL;
|
||||
s->waiting_fd = -1;
|
||||
}
|
||||
|
||||
static void surface_wait_end(struct surface *s, int over_limit) {
|
||||
struct surface_state *st = s->waiting;
|
||||
if (!st) return;
|
||||
surface_wait_stop(s);
|
||||
s->waiting = NULL;
|
||||
const int64_t waited = now_ns() - s->waiting_since_ns;
|
||||
g_perf.commit_waits++;
|
||||
g_perf.commit_wait_ns += waited;
|
||||
if (waited > g_perf.commit_wait_max_ns) g_perf.commit_wait_max_ns = waited;
|
||||
if (over_limit) g_perf.commit_wait_limits++;
|
||||
if (st->attach && g_unwaited == s) g_unwaited = NULL;
|
||||
surface_state_apply(s, st);
|
||||
free(st);
|
||||
}
|
||||
|
||||
static int on_commit_ready(int fd, uint32_t mask, void *data) {
|
||||
surface_wait_end(data, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int on_commit_wait_limit(void *data) {
|
||||
static int said;
|
||||
if (!said) {
|
||||
said = 1;
|
||||
droiddeck_log("compositor", "a client's GPU writes ran past %d ms; its frame is shown as it is", COMMIT_WAIT_LIMIT_MS);
|
||||
}
|
||||
surface_wait_end(data, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int surface_wait_start(struct surface *s, int fd, int timeout_ms) {
|
||||
struct wl_event_loop *loop = wl_display_get_event_loop(g_display);
|
||||
s->waiting_fd = fcntl(fd, F_DUPFD_CLOEXEC, 0);
|
||||
if (s->waiting_fd >= 0) {
|
||||
s->waiting_source = wl_event_loop_add_fd(loop, s->waiting_fd, WL_EVENT_READABLE, on_commit_ready, s);
|
||||
s->waiting_timer = wl_event_loop_add_timer(loop, on_commit_wait_limit, s);
|
||||
}
|
||||
if (!s->waiting_source || !s->waiting_timer ||
|
||||
wl_event_source_timer_update(s->waiting_timer, timeout_ms) != 0) {
|
||||
surface_wait_stop(s);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void surface_commit(struct wl_client *c, struct wl_resource *r) {
|
||||
struct surface *s = wl_resource_get_user_data(r);
|
||||
|
||||
if (s->xdg_toplevel && !s->toplevel_committed) {
|
||||
s->toplevel_committed = 1;
|
||||
send_toplevel_configure(s);
|
||||
}
|
||||
struct surface_state *st = calloc(1, sizeof(*st));
|
||||
if (!st) {
|
||||
struct surface_state now;
|
||||
surface_state_take(s, &now);
|
||||
surface_state_apply(s, &now);
|
||||
return;
|
||||
}
|
||||
surface_state_take(s, st);
|
||||
const int was_waiting = s->waiting != NULL;
|
||||
if (was_waiting) {
|
||||
surface_wait_stop(s);
|
||||
surface_state_merge(s->waiting, st);
|
||||
s->waiting = NULL;
|
||||
}
|
||||
int unwaited;
|
||||
const int fd = state_unfinished_fd(s, st, &unwaited);
|
||||
if (!was_waiting) s->waiting_since_ns = now_ns();
|
||||
const int64_t left_ms = COMMIT_WAIT_LIMIT_MS - (now_ns() - s->waiting_since_ns) / 1000000;
|
||||
if (fd >= 0 && left_ms > 0 && surface_wait_start(s, fd, (int)left_ms) == 0) {
|
||||
s->waiting = st;
|
||||
return;
|
||||
}
|
||||
const int attaches = st->attach;
|
||||
if (was_waiting) {
|
||||
s->waiting = st;
|
||||
surface_wait_end(s, fd >= 0 && left_ms <= 0);
|
||||
} else {
|
||||
surface_state_apply(s, st);
|
||||
free(st);
|
||||
}
|
||||
if (unwaited) g_unwaited = s;
|
||||
else if (attaches && g_unwaited == s) g_unwaited = NULL;
|
||||
}
|
||||
static void surface_set_buffer_transform(struct wl_client *c, struct wl_resource *r, int32_t t) {}
|
||||
static void surface_set_buffer_scale(struct wl_client *c, struct wl_resource *r, int32_t s) {}
|
||||
static void surface_damage_buffer(struct wl_client *c, struct wl_resource *r,
|
||||
@@ -1516,6 +1737,13 @@ static void surface_resource_destroy(struct wl_resource *r) {
|
||||
child->parent = NULL;
|
||||
}
|
||||
if (s->pending_buffer) wl_list_remove(&s->pending_buffer_destroy.link);
|
||||
if (s->waiting) {
|
||||
surface_wait_stop(s);
|
||||
surface_state_discard(s->waiting);
|
||||
s->waiting = NULL;
|
||||
}
|
||||
if (g_zero_copy_shown == s) g_zero_copy_shown = NULL;
|
||||
if (g_unwaited == s) g_unwaited = NULL;
|
||||
pending_releases_forget_surface(s);
|
||||
drop_dmabuf(s, 0);
|
||||
ahb_swapchain_surface_gone(s);
|
||||
@@ -1579,6 +1807,7 @@ static void compositor_create_surface(struct wl_client *c, struct wl_resource *r
|
||||
wl_list_init(&s->child_link);
|
||||
wl_list_init(&s->toplevel_link);
|
||||
wl_list_init(&s->pending_buffer_destroy.link);
|
||||
s->waiting_fd = -1;
|
||||
wl_list_init(&s->idle_buffer_destroy.link);
|
||||
wl_list_insert(&g_surfaces, &s->link);
|
||||
wl_resource_set_implementation(s->resource, &surface_impl, s, surface_resource_destroy);
|
||||
@@ -2502,7 +2731,13 @@ static int64_t scene_next_due(int64_t now, int64_t due, int limit) {
|
||||
|
||||
static void render_scene(void) {
|
||||
g_scene_due_ns = scene_next_due(now_ns(), g_scene_due_ns, g_fps_limit);
|
||||
if (atomic_load(&g_stream_on)) { g_dirty_since_ns = 0; render_stream(); return; }
|
||||
if (atomic_load(&g_stream_on)) {
|
||||
g_dirty_since_ns = 0;
|
||||
g_zero_copy_shown = NULL;
|
||||
settle_unwaited();
|
||||
render_stream();
|
||||
return;
|
||||
}
|
||||
struct draw_list dl = {0};
|
||||
struct surface *s;
|
||||
int w, h;
|
||||
@@ -2576,6 +2811,8 @@ static void render_scene(void) {
|
||||
} else {
|
||||
cursor_hdr_said = 0;
|
||||
}
|
||||
g_zero_copy_shown = NULL;
|
||||
if (hdr_route == 1 || hdr_route == 2) settle_unwaited();
|
||||
if (hdr_route == 1) {
|
||||
static int fell_back;
|
||||
vkp_apply_window_request();
|
||||
@@ -2609,6 +2846,7 @@ static void render_scene(void) {
|
||||
}
|
||||
if (hdr_route == 0 && vkp_quest_layer_presentation() && !framegen && !cardboard && !cursor_on &&
|
||||
!ahb_only) {
|
||||
settle_unwaited();
|
||||
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;
|
||||
@@ -2658,6 +2896,7 @@ static void render_scene(void) {
|
||||
vkp_apply_window_request();
|
||||
int r = -1;
|
||||
const int fg_pass = framegen && fx_on && li >= 0;
|
||||
if (framegen && li >= 0) settle_unwaited();
|
||||
const int generated = (framegen && li >= 0)
|
||||
? sc_layer_present_generated(&dl.d[li], 1, NULL, w, h, fg_pass,
|
||||
ls ? droiddeck_surface_color(ls) : NULL) : 0;
|
||||
@@ -2671,6 +2910,8 @@ static void render_scene(void) {
|
||||
r = generated >= 0 ? 0 : -1;
|
||||
else if (generated >= 0 && !(fx_on && li >= 0) && ls && ls->dmabuf_buf && ahb_swapchain_has_ahb(ls->dmabuf_buf))
|
||||
r = ahb_swapchain_present(ls->dmabuf_buf, ls, w, h, ld);
|
||||
if (r == 0 && !fg_pass) g_zero_copy_shown = ls;
|
||||
else settle_unwaited();
|
||||
if (!fg_pass && generated >= 0 && r != 0 && li >= 0)
|
||||
r = fx_on ? sc_layer_present_pass(&dl.d[li], 1, w, h)
|
||||
: sc_layer_present(dl.d[li].img, w, h, ld, ls ? droiddeck_surface_color(ls) : NULL);
|
||||
@@ -2681,6 +2922,7 @@ static void render_scene(void) {
|
||||
ov = sc_layer_present_overlay(dl.d[li + 1].img, go, dl.d[li + 1].blend) == 0 ? 1 : -1;
|
||||
if (ov <= 0) sc_layer_hide_overlay();
|
||||
if (ov < 0) {
|
||||
settle_unwaited();
|
||||
sc_layer_hide();
|
||||
rendered = vkp_render(w, h, dl.d, dl.n) == 0;
|
||||
copy = 1;
|
||||
@@ -2690,12 +2932,14 @@ static void render_scene(void) {
|
||||
g_scene_queues = sc_layer_queues();
|
||||
}
|
||||
} else {
|
||||
settle_unwaited();
|
||||
sc_layer_hide();
|
||||
rendered = vkp_render(w, h, dl.d, dl.n) == 0;
|
||||
copy = 1;
|
||||
hdr_copy = "its display layer was unavailable this frame";
|
||||
}
|
||||
} else {
|
||||
settle_unwaited();
|
||||
sc_layer_hide();
|
||||
rendered = vkp_render(w, h, dl.d, dl.n) == 0;
|
||||
copy = 1;
|
||||
@@ -4344,11 +4588,12 @@ static int on_stats_timer(void *data) {
|
||||
unsigned aimed_next, aimed_later, aimed_even;
|
||||
sc_layer_aim_take(&aimed_next, &aimed_later, &aimed_even);
|
||||
#define PERF_MS(sum, n) ((n) ? (double)(sum) / 1e6 / (double)(n) : 0.0)
|
||||
if (g_perf.scenes || vp.presents || g_perf.releases || drops)
|
||||
if (g_perf.scenes || vp.presents || g_perf.releases || drops || g_perf.commit_waits)
|
||||
droiddeck_log("perf", "last 10 s: %u ticks, %u scenes, %u on screen (copy %u, zero-copy %u, layer copy %u) | "
|
||||
"render_scene %.2f/%.2f ms | base %u black kept, %u presented | acquire %.2f/%.2f ms | "
|
||||
"present %.2f/%.2f ms (%u) | fence wait %.2f/%.2f ms (%u, %u GPU release waits) | "
|
||||
"release %.2f/%.2f ms (%u, %u held) | %u pool drops | layer frames timed for the next refresh %u, "
|
||||
"release %.2f/%.2f ms (%u, %u held) | commits held for client writes %.2f/%.2f ms (%u, %u past the limit) | "
|
||||
"%u pool drops | layer frames timed for the next refresh %u, "
|
||||
"the one after %u, held to an even step %u",
|
||||
g_perf.ticks, g_perf.scenes, g_stat_frames, g_perf.copy_scenes, zero_copy, layer_frames,
|
||||
PERF_MS(g_perf.scene_ns, g_perf.scenes), (double)g_perf.scene_max_ns / 1e6,
|
||||
@@ -4357,7 +4602,9 @@ static int on_stats_timer(void *data) {
|
||||
PERF_MS(vp.present_ns, vp.presents), (double)vp.present_max_ns / 1e6, vp.presents,
|
||||
PERF_MS(vp.wait_ns, vp.waits), (double)vp.wait_max_ns / 1e6, vp.waits, vp.gpu_release_waits,
|
||||
PERF_MS(g_perf.release_ns, g_perf.releases), (double)g_perf.release_max_ns / 1e6,
|
||||
g_perf.releases, g_perf.releases_held, drops, aimed_next, aimed_later, aimed_even);
|
||||
g_perf.releases, g_perf.releases_held,
|
||||
PERF_MS(g_perf.commit_wait_ns, g_perf.commit_waits), (double)g_perf.commit_wait_max_ns / 1e6,
|
||||
g_perf.commit_waits, g_perf.commit_wait_limits, drops, aimed_next, aimed_later, aimed_even);
|
||||
#undef PERF_MS
|
||||
memset(&g_perf, 0, sizeof(g_perf));
|
||||
}
|
||||
|
||||
@@ -148,6 +148,7 @@ struct slot {
|
||||
uint32_t fmt;
|
||||
int release_fd;
|
||||
int busy;
|
||||
uint64_t generation;
|
||||
};
|
||||
|
||||
struct layer {
|
||||
@@ -175,6 +176,7 @@ struct layer {
|
||||
int votes_rate;
|
||||
float fps_applied;
|
||||
int recreate_pending;
|
||||
int pending_callbacks;
|
||||
|
||||
int32_t ds_applied;
|
||||
|
||||
@@ -222,6 +224,7 @@ struct complete_ctx {
|
||||
ASurfaceControl *sc;
|
||||
int layer;
|
||||
int prev_slot;
|
||||
uint64_t prev_generation;
|
||||
void *prev_token;
|
||||
int retire;
|
||||
};
|
||||
@@ -288,12 +291,16 @@ static void on_complete(void *context, ASurfaceTransactionStats *stats) {
|
||||
pthread_mutex_lock(&g_lock);
|
||||
if (ctx->layer >= 0 && ctx->layer < SC_LAYER_COUNT && ctx->prev_slot >= 0 && ctx->prev_slot < POOL_MAX) {
|
||||
struct slot *s = &g_layers[ctx->layer].slots[ctx->prev_slot];
|
||||
int fd = (stats && ctx->sc) ? api.prevReleaseFence(stats, ctx->sc) : -1;
|
||||
if (s->release_fd >= 0) close(s->release_fd);
|
||||
s->release_fd = fd;
|
||||
s->busy = 0;
|
||||
if (s->generation == ctx->prev_generation) {
|
||||
int fd = (stats && ctx->sc) ? api.prevReleaseFence(stats, ctx->sc) : -1;
|
||||
if (s->release_fd >= 0) close(s->release_fd);
|
||||
s->release_fd = fd;
|
||||
s->busy = 0;
|
||||
}
|
||||
}
|
||||
if (g_pending_cb > 0) g_pending_cb--;
|
||||
if (ctx->layer >= 0 && ctx->layer < SC_LAYER_COUNT && g_layers[ctx->layer].pending_callbacks > 0)
|
||||
g_layers[ctx->layer].pending_callbacks--;
|
||||
pthread_mutex_unlock(&g_lock);
|
||||
if (ctx->prev_token) {
|
||||
int fd = (stats && ctx->sc) ? api.prevReleaseFence(stats, ctx->sc) : -1;
|
||||
@@ -308,9 +315,15 @@ static int add_complete_on(ASurfaceTransaction *tx, struct layer *l, ASurfaceCon
|
||||
struct complete_ctx *ctx = calloc(1, sizeof(*ctx));
|
||||
if (!ctx) return -1;
|
||||
ctx->sc = sc; ctx->layer = (int)(l - g_layers); ctx->prev_slot = prev_slot;
|
||||
if (prev_slot >= 0 && prev_slot < POOL_MAX) {
|
||||
pthread_mutex_lock(&g_lock);
|
||||
ctx->prev_generation = l->slots[prev_slot].generation;
|
||||
pthread_mutex_unlock(&g_lock);
|
||||
}
|
||||
ctx->prev_token = prev_token; ctx->retire = retire;
|
||||
pthread_mutex_lock(&g_lock);
|
||||
g_pending_cb++;
|
||||
l->pending_callbacks++;
|
||||
pthread_mutex_unlock(&g_lock);
|
||||
api.setOnComplete(tx, ctx, on_complete);
|
||||
return 0;
|
||||
@@ -397,12 +410,16 @@ static void retire_sc(struct layer *l) {
|
||||
ASurfaceTransaction *tx = api.txCreate();
|
||||
if (tx) {
|
||||
retire_ops(tx, l->sc);
|
||||
if (add_complete(tx, l, l->cur_slot, l->cur_token, 1) != 0) api.release(l->sc);
|
||||
if (add_complete(tx, l, l->cur_slot, l->cur_token, 1) != 0) {
|
||||
api.txDelete(tx);
|
||||
droiddeck_log("layer", "%s: retirement deferred because its release callback could not be allocated", l->name);
|
||||
return;
|
||||
}
|
||||
api.txApply(tx);
|
||||
api.txDelete(tx);
|
||||
} else {
|
||||
if (l->cur_token) ahb_swapchain_layer_released(l->cur_token, -1);
|
||||
api.release(l->sc);
|
||||
droiddeck_log("layer", "%s: retirement deferred because a transaction could not be allocated", l->name);
|
||||
return;
|
||||
}
|
||||
droiddeck_log("layer", "%s: SurfaceControl retired (window %p)", l->name, (void *)l->win);
|
||||
l->sc = NULL; l->win = NULL;
|
||||
@@ -421,20 +438,28 @@ static void drain_and_free_pools(void) {
|
||||
if (!pending || now_ns() > deadline) break;
|
||||
usleep(2000);
|
||||
}
|
||||
pthread_mutex_lock(&g_lock);
|
||||
for (int i = 0; i < SC_LAYER_COUNT; i++) {
|
||||
struct layer *l = &g_layers[i];
|
||||
pthread_mutex_lock(&g_lock);
|
||||
const int pending = l->pending_callbacks;
|
||||
if (pending || l->sc) {
|
||||
pthread_mutex_unlock(&g_lock);
|
||||
droiddeck_log("layer", "pool drain deferred for %s (%s)", l->name,
|
||||
pending ? "SurfaceControl callbacks are pending" : "SurfaceControl retirement is deferred");
|
||||
continue;
|
||||
}
|
||||
for (int j = 0; j < POOL_MAX; j++) {
|
||||
struct slot *s = &g_layers[i].slots[j];
|
||||
struct slot *s = &l->slots[j];
|
||||
if (s->release_fd >= 0) { struct pollfd p = {.fd = s->release_fd, .events = POLLIN}; poll(&p, 1, 100); close(s->release_fd); }
|
||||
if (s->img) vkp_image_destroy(s->img);
|
||||
if (s->ahb) AHardwareBuffer_release(s->ahb);
|
||||
memset(s, 0, sizeof(*s));
|
||||
s->release_fd = -1;
|
||||
}
|
||||
g_layers[i].first_logged = 0;
|
||||
g_layers[i].logged_w = g_layers[i].logged_h = 0;
|
||||
l->first_logged = 0;
|
||||
l->logged_w = l->logged_h = 0;
|
||||
pthread_mutex_unlock(&g_lock);
|
||||
}
|
||||
pthread_mutex_unlock(&g_lock);
|
||||
}
|
||||
|
||||
static int sniff_modifier(const struct droiddeck_native_handle *h, uint64_t *mod) {
|
||||
@@ -612,7 +637,10 @@ static int take_free_slot(struct layer *l, int w, int h, uint32_t fmt, int *wait
|
||||
if (pending < 0) pending = i;
|
||||
}
|
||||
if (idx < 0) idx = pending;
|
||||
if (idx >= 0) { fd = l->slots[idx].release_fd; l->slots[idx].release_fd = -1; }
|
||||
if (idx >= 0) {
|
||||
fd = l->slots[idx].release_fd; l->slots[idx].release_fd = -1;
|
||||
l->slots[idx].generation++;
|
||||
}
|
||||
pthread_mutex_unlock(&g_lock);
|
||||
if (idx < 0) return -1;
|
||||
if (fd >= 0 && fence_signalled(fd)) { close(fd); fd = -1; }
|
||||
@@ -620,7 +648,8 @@ static int take_free_slot(struct layer *l, int w, int h, uint32_t fmt, int *wait
|
||||
if (s->ahb && (s->w != w || s->h != h || s->fmt != fmt)) {
|
||||
if (fd >= 0) { close(fd); fd = -1; }
|
||||
vkp_image_destroy(s->img); AHardwareBuffer_release(s->ahb);
|
||||
memset(s, 0, sizeof(*s)); s->release_fd = -1;
|
||||
const uint64_t generation = s->generation;
|
||||
memset(s, 0, sizeof(*s)); s->release_fd = -1; s->generation = generation;
|
||||
}
|
||||
if (fd >= 0 && !vkp_can_wait_sync_fd()) {
|
||||
if (fence_wait(fd, 100) == 0) { slot_keep_fence(s, fd); return -1; }
|
||||
@@ -659,7 +688,13 @@ static int ensure_sc(struct layer *l) {
|
||||
if (load_api() != 0) return -1;
|
||||
ANativeWindow *win = vkp_window();
|
||||
if (!win) return -1;
|
||||
if (l->sc && l->win != win) retire_sc(l);
|
||||
if (l->sc && l->win != win) {
|
||||
retire_sc(l);
|
||||
if (l->sc) {
|
||||
droiddeck_log("layer", "%s: keeping the old SurfaceControl until retirement completes", l->name);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (!l->sc) {
|
||||
l->sc = api.createFromWindow(win, l->name);
|
||||
if (!l->sc) { droiddeck_log("error", "layer: ASurfaceControl_createFromWindow(%s) failed", l->name); return -1; }
|
||||
@@ -818,6 +853,7 @@ static ASurfaceControl *swap_sc_begin(struct layer *l) {
|
||||
if (!win || win != l->win) return NULL;
|
||||
ASurfaceControl *fresh = api.createFromWindow(win, l->name);
|
||||
if (!fresh) {
|
||||
l->recreate_pending = 1;
|
||||
droiddeck_log("error", "layer: %s: composition recovery could not create a new SurfaceControl", l->name);
|
||||
return NULL;
|
||||
}
|
||||
@@ -832,24 +868,45 @@ static ASurfaceControl *swap_sc_begin(struct layer *l) {
|
||||
return old;
|
||||
}
|
||||
|
||||
static void rollback_swap_sc(struct layer *l, ASurfaceControl *old, int was_shown,
|
||||
int32_t ds_applied, uint32_t md_applied, float hr_applied) {
|
||||
if (!old) return;
|
||||
ASurfaceControl *fresh = l->sc;
|
||||
l->sc = old;
|
||||
l->shown = was_shown;
|
||||
l->recreate_pending = 1;
|
||||
l->geo_valid = 0;
|
||||
l->fps_applied = -1.0f;
|
||||
l->ds_applied = ds_applied; l->md_applied = md_applied; l->hr_applied = hr_applied;
|
||||
if (fresh) api.release(fresh);
|
||||
}
|
||||
|
||||
static int present_slot(struct layer *l, int idx, const int r[8], const struct droiddeck_color *color,
|
||||
int translucent) {
|
||||
struct slot *s = &l->slots[idx];
|
||||
ASurfaceTransaction *tx = api.txCreate();
|
||||
if (!tx) return -1;
|
||||
const int was_shown = l->shown;
|
||||
const int32_t ds_applied = l->ds_applied;
|
||||
const uint32_t md_applied = l->md_applied;
|
||||
const float hr_applied = l->hr_applied;
|
||||
ASurfaceControl *old = swap_sc_begin(l);
|
||||
if (old) api.setZOrder(tx, l->sc, l->z);
|
||||
api.setBuffer(tx, l->sc, s->ahb, -1);
|
||||
if (api.setEnableBackPressure) api.setEnableBackPressure(tx, l->sc, true);
|
||||
api.setBufferTransparency(tx, l->sc,
|
||||
translucent ? ASC_TRANSPARENCY_TRANSLUCENT : ASC_TRANSPARENCY_OPAQUE);
|
||||
if (!l->shown) api.setVisibility(tx, l->sc, ASC_VISIBILITY_SHOW);
|
||||
if (old) retire_ops(tx, old);
|
||||
if (add_complete_on(tx, l, old ? old : l->sc, l->cur_slot, l->cur_token, old ? 1 : 0) != 0) {
|
||||
api.txDelete(tx);
|
||||
rollback_swap_sc(l, old, was_shown, ds_applied, md_applied, hr_applied);
|
||||
droiddeck_log("layer", "%s: frame transition skipped because its release callback could not be allocated", l->name);
|
||||
return -1;
|
||||
}
|
||||
apply_geometry(tx, l, r);
|
||||
apply_frame_rate(tx, l);
|
||||
apply_colour(tx, l, color);
|
||||
if (!l->shown) api.setVisibility(tx, l->sc, ASC_VISIBILITY_SHOW);
|
||||
if (old) retire_ops(tx, old);
|
||||
if (add_complete_on(tx, l, old ? old : l->sc, l->cur_slot, l->cur_token, old ? 1 : 0) != 0 && old)
|
||||
api.release(old);
|
||||
pthread_mutex_lock(&g_lock);
|
||||
s->busy = 1;
|
||||
pthread_mutex_unlock(&g_lock);
|
||||
@@ -904,23 +961,27 @@ int sc_layer_present_ahb(AHardwareBuffer *ahb, int w, int h, int acquire_fd, voi
|
||||
}
|
||||
ASurfaceTransaction *tx = api.txCreate();
|
||||
if (!tx) goto unavailable;
|
||||
const int was_shown = l->shown;
|
||||
const int32_t ds_applied = l->ds_applied;
|
||||
const uint32_t md_applied = l->md_applied;
|
||||
const float hr_applied = l->hr_applied;
|
||||
ASurfaceControl *old = swap_sc_begin(l);
|
||||
if (old) api.setZOrder(tx, l->sc, l->z);
|
||||
api.setBuffer(tx, l->sc, ahb, acquire_fd);
|
||||
if (api.setEnableBackPressure) api.setEnableBackPressure(tx, l->sc, true);
|
||||
api.setBufferTransparency(tx, l->sc, ASC_TRANSPARENCY_OPAQUE);
|
||||
apply_geometry(tx, l, r);
|
||||
apply_frame_rate(tx, l);
|
||||
apply_colour(tx, l, color);
|
||||
if (!l->shown) api.setVisibility(tx, l->sc, ASC_VISIBILITY_SHOW);
|
||||
if (old) retire_ops(tx, old);
|
||||
if (add_complete_on(tx, l, old ? old : l->sc, l->cur_slot,
|
||||
l->cur_token == token ? NULL : l->cur_token, old ? 1 : 0) != 0) {
|
||||
api.txDelete(tx);
|
||||
if (old) api.release(old);
|
||||
l->ds_applied = -1; l->md_applied = 0; l->hr_applied = -1.0f;
|
||||
rollback_swap_sc(l, old, was_shown, ds_applied, md_applied, hr_applied);
|
||||
droiddeck_log("layer", "zero-copy: frame transition skipped because its release callback could not be allocated");
|
||||
return -1;
|
||||
}
|
||||
apply_geometry(tx, l, r);
|
||||
apply_frame_rate(tx, l);
|
||||
apply_colour(tx, l, color);
|
||||
apply_present_time(tx, 1);
|
||||
api.txApply(tx);
|
||||
api.txDelete(tx);
|
||||
@@ -1167,15 +1228,26 @@ int sc_layer_present_overlay(struct vkp_image *src, const int geo[8], int transl
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void hide_layer(struct layer *l) {
|
||||
if (!l->sc || !l->shown || api.state != 1) return;
|
||||
static int hide_layer(struct layer *l) {
|
||||
if (!l->sc || !l->shown || api.state != 1) return 0;
|
||||
ASurfaceTransaction *tx = api.txCreate();
|
||||
if (!tx) return;
|
||||
replace_with_blank(tx, l);
|
||||
if (!tx) return -1;
|
||||
api.setVisibility(tx, l->sc, ASC_VISIBILITY_HIDE);
|
||||
add_complete(tx, l, l->cur_slot, l->cur_token, 0);
|
||||
if (add_complete(tx, l, l->cur_slot, l->cur_token, 0) != 0) {
|
||||
/*
|
||||
* Keep the current buffer attached when its release callback cannot
|
||||
* be allocated. The hide can still apply without releasing the slot.
|
||||
*/
|
||||
api.txApply(tx);
|
||||
api.txDelete(tx);
|
||||
l->shown = 0;
|
||||
droiddeck_log("layer", "%s: hidden; buffer release deferred because its callback could not be allocated", l->name);
|
||||
return 0;
|
||||
}
|
||||
replace_with_blank(tx, l);
|
||||
api.txApply(tx); api.txDelete(tx);
|
||||
l->shown = 0; l->cur_slot = -1; l->cur_token = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sc_layer_hide(void) {
|
||||
@@ -1183,17 +1255,20 @@ void sc_layer_hide(void) {
|
||||
int said = g_layers[SC_LAYER_GAME].shown || g_layers[SC_LAYER_OVERLAY].sc;
|
||||
if (g_layers[SC_LAYER_OVERLAY].sc) sc_layer_hide_overlay();
|
||||
if (g_layers[SC_LAYER_GAME].shown) hide_layer(&g_layers[SC_LAYER_GAME]);
|
||||
if (said) droiddeck_log("layer", "layers hidden (scene is not a single fullscreen window)");
|
||||
if (said && !g_layers[SC_LAYER_GAME].shown && !g_layers[SC_LAYER_OVERLAY].shown)
|
||||
droiddeck_log("layer", "layers hidden (scene is not a single fullscreen window)");
|
||||
}
|
||||
|
||||
void sc_layer_hide_overlay(void) {
|
||||
layers_init();
|
||||
struct layer *l = &g_layers[SC_LAYER_OVERLAY];
|
||||
if (!l->sc) return;
|
||||
if (l->shown) hide_layer(l);
|
||||
if (l->shown && hide_layer(l) != 0) return;
|
||||
retire_sc(l);
|
||||
droiddeck_log("layer", "%s: gone (nothing is above the game any more)", l->name);
|
||||
if (g_layers[SC_LAYER_GAME].sc) g_layers[SC_LAYER_GAME].recreate_pending = 1;
|
||||
if (!l->sc) {
|
||||
droiddeck_log("layer", "%s: gone (nothing is above the game any more)", l->name);
|
||||
if (g_layers[SC_LAYER_GAME].sc) g_layers[SC_LAYER_GAME].recreate_pending = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sc_layer_window_gone(void) {
|
||||
|
||||
@@ -232,6 +232,16 @@ static VkResult timed_wait(VkFence fence, uint64_t timeout) {
|
||||
return g_dev_state == -2 ? VK_ERROR_DEVICE_LOST : VK_ERROR_UNKNOWN;
|
||||
int64_t t0 = perf_now();
|
||||
VkResult r = g_vk.WaitForFences(g_dev, 1, &fence, VK_TRUE, timeout);
|
||||
if (r == VK_TIMEOUT) {
|
||||
droiddeck_log("gpu", "GPU fence delayed: retaining frame resources until completion");
|
||||
/* A scheduling delay does not invalidate the device. Keep this submission's
|
||||
* resources and call stack alive, as the main render path already does. */
|
||||
do {
|
||||
r = g_vk.WaitForFences(g_dev, 1, &fence, VK_TRUE, UINT64_MAX);
|
||||
} while (r == VK_TIMEOUT);
|
||||
if (r == VK_SUCCESS)
|
||||
droiddeck_log("gpu", "GPU fence completed: continuing presentation");
|
||||
}
|
||||
perf_add(&g_perf.wait_ns, &g_perf.wait_max_ns, &g_perf.waits, perf_now() - t0);
|
||||
if (r != VK_SUCCESS && r != VK_ERROR_DEVICE_LOST)
|
||||
quarantine_pending_work(r, "fence wait");
|
||||
|
||||
@@ -430,21 +430,28 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
|
||||
*/
|
||||
private fun useMaliFallback(missing: String?): String {
|
||||
val oldVulkan = com.droiddeck.launcher.session.VenusComponent.hostVulkanTooOld(activity)
|
||||
val venus = oldVulkan == null && com.droiddeck.launcher.session.VenusComponent.available(activity)
|
||||
val venusByUser = venusExplicit()
|
||||
val venus = MaliAutoRoute.venusStandsIn(
|
||||
com.droiddeck.launcher.session.VenusComponent.available(activity), oldVulkan == null,
|
||||
SessionPrefs.venus(activity), venusByUser, gpu.name,
|
||||
)
|
||||
if (oldVulkan != null) Log.i(TAG, "auto: Mali driver reports Vulkan $oldVulkan; Venus needs 1.2, the bridge stands in")
|
||||
val ownership = MaliAutoRoute.fallbackOwnership(
|
||||
venus,
|
||||
SessionPrefs.vkBridge(activity), bridgeExplicit(),
|
||||
SessionPrefs.venus(activity), venusExplicit(),
|
||||
SessionPrefs.venus(activity), venusByUser,
|
||||
)
|
||||
if (venus && !SessionPrefs.venus(activity)) {
|
||||
SessionPrefs.setVenus(activity, true)
|
||||
if (SessionPrefs.vkBridge(activity) && !bridgeExplicit())
|
||||
SessionPrefs.setVkBridge(activity, false)
|
||||
SessionPrefs.setMaliFallbackByAuto(activity, ownership)
|
||||
} else if (!venus && !SessionPrefs.vkBridge(activity)) {
|
||||
SessionPrefs.setVkBridge(activity, true)
|
||||
SessionPrefs.setMaliFallbackByAuto(activity, ownership)
|
||||
} else if (!venus) {
|
||||
val venusOff = SessionPrefs.venus(activity) && !venusByUser
|
||||
val bridgeOn = !SessionPrefs.vkBridge(activity)
|
||||
if (venusOff) SessionPrefs.clearVenus(activity)
|
||||
if (bridgeOn) SessionPrefs.setVkBridge(activity, true)
|
||||
if (venusOff || bridgeOn || ownership != MaliAutoRoute.NONE) SessionPrefs.setMaliFallbackByAuto(activity, ownership)
|
||||
} else if (ownership != MaliAutoRoute.NONE) {
|
||||
SessionPrefs.setMaliFallbackByAuto(activity, ownership)
|
||||
}
|
||||
@@ -467,7 +474,7 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
|
||||
/** A pair is installed for this Mali: the route Auto switched on in its place goes off again. */
|
||||
private fun endMaliFallback() {
|
||||
when (SessionPrefs.maliFallbackByAuto(activity)) {
|
||||
"venus" -> SessionPrefs.setVenus(activity, false)
|
||||
"venus" -> SessionPrefs.clearVenus(activity)
|
||||
"bridge" -> SessionPrefs.setVkBridge(activity, false)
|
||||
else -> return
|
||||
}
|
||||
|
||||
@@ -1993,11 +1993,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
}
|
||||
}
|
||||
|
||||
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) }
|
||||
}
|
||||
if (savedInstanceState == null) ui.post { startSteamAtStartupIfEnabled(cold = true) }
|
||||
saved?.let { state ->
|
||||
restoreCompatLaunch(state)
|
||||
pendingSwitch = savedIntent(state, KEY_PENDING_SWITCH)
|
||||
@@ -2005,13 +2001,8 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
}
|
||||
|
||||
val wanted = ArrayList<String>()
|
||||
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) {
|
||||
// From Android 11, shared storage outside the app's own folders is all-files access, which the file picker asks for when a shared drive is opened.
|
||||
if (Build.VERSION.SDK_INT < 30 && checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||
wanted.add(Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||
}
|
||||
if (SessionPrefs.micEnabled(this) && !SessionPrefs.micAsked(this)
|
||||
@@ -2020,6 +2011,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
SessionPrefs.setMicAsked(this)
|
||||
}
|
||||
if (wanted.isNotEmpty()) requestPermissions(wanted.toTypedArray(), 1)
|
||||
com.droiddeck.launcher.session.Onboarding.onFirstRunReady = firstRunReady
|
||||
Thread({ com.droiddeck.launcher.stores.StoreAccounts.encryptAll(this) }, "store-credentials").start()
|
||||
if (!SessionState.running) Thread({
|
||||
com.droiddeck.launcher.session.LogMigration.run(this)
|
||||
@@ -2299,7 +2291,22 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
return super.dispatchGenericMotionEvent(event)
|
||||
}
|
||||
|
||||
@Volatile private var inFront = false
|
||||
private var autoSteamPending = false
|
||||
|
||||
/** Runs on the worker thread that finishes setup, so the foreground state is read as setup completes, not when the UI thread gets to it. */
|
||||
private val firstRunReady: () -> Unit = {
|
||||
val front = inFront
|
||||
runOnUiThread { if (front) autoStartSteam() }
|
||||
}
|
||||
|
||||
private fun autoStartSteam() {
|
||||
if (isFinishing || isDestroyed || SessionState.running || !inFront) return
|
||||
if (busy) autoSteamPending = true else playSteam()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
inFront = false
|
||||
stopRightStickScroll()
|
||||
compatLaunchVisible = false
|
||||
if (android.os.Build.VERSION.SDK_INT >= 29) com.droiddeck.launcher.ui.DualScreenPanel.ownerPaused(taskId, true)
|
||||
@@ -2308,6 +2315,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
inFront = true
|
||||
if (!homeChoiceOpen) {
|
||||
HomeApp.releaseUnusedHomeEntry(this)
|
||||
refreshHomeAppState()
|
||||
@@ -2443,6 +2451,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
|
||||
override fun onDestroy() {
|
||||
// The queued launch was saved before this; a restored activity keeps its copy, and this one must not start it too.
|
||||
if (com.droiddeck.launcher.session.Onboarding.onFirstRunReady === firstRunReady) com.droiddeck.launcher.session.Onboarding.onFirstRunReady = null
|
||||
queuedLaunchRunner.destroy()
|
||||
triggerKeys.cancel()
|
||||
launchCoordinator.cancelAll()
|
||||
@@ -3742,6 +3751,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
refresh()
|
||||
com.droiddeck.launcher.agent.AgentHost.refresh(this)
|
||||
if (ok == true && LinuxRuntime.isInstalled(this)) { protons.checkUpdates(); protons.ensureSteamClient() }
|
||||
if (autoSteamPending) { autoSteamPending = false; autoStartSteam() }
|
||||
}
|
||||
}, "runtime-operation").start()
|
||||
}
|
||||
|
||||
@@ -26,6 +26,12 @@ internal object MaliAutoRoute {
|
||||
|
||||
fun userChoice(keyStored: Boolean, owner: String, route: String): Boolean = keyStored && owner != route
|
||||
|
||||
fun venusStandsIn(available: Boolean, hostVulkanOk: Boolean, venusOn: Boolean, venusExplicit: Boolean, gpuName: String): Boolean =
|
||||
available && hostVulkanOk && if (venusExplicit) venusOn else !venusStallsOn(gpuName)
|
||||
|
||||
// Steam's web helper dies on its first window through Venus on these (#2879), so the bridge stands in.
|
||||
fun venusStallsOn(gpuName: String): Boolean = gpuName.contains("G2-Ultra", ignoreCase = true)
|
||||
|
||||
fun shouldEnd(ownsRoute: String, mali: Boolean, installedPair: Boolean): Boolean =
|
||||
mali && installedPair && ownsRoute != NONE
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.droiddeck.launcher
|
||||
|
||||
import com.droiddeck.launcher.gpu.SteamVr
|
||||
|
||||
internal class QuestSteamVrWatch(start: Long) {
|
||||
private var startupDeadline = start + STARTUP_MS
|
||||
private var lastRunning: Long? = null
|
||||
private var graceUntil = start
|
||||
private var wasPaused = false
|
||||
|
||||
// A frozen guest cannot answer the status call, so a status read during a freeze, or one that
|
||||
// started before it, says nothing about SteamVR.
|
||||
fun stopped(now: Long, status: SteamVr.Status, paused: Boolean): Boolean {
|
||||
if (paused) {
|
||||
wasPaused = true
|
||||
return false
|
||||
}
|
||||
if (wasPaused) {
|
||||
wasPaused = false
|
||||
graceUntil = now + RESUME_GRACE_MS
|
||||
}
|
||||
if (status == SteamVr.Status.RUNNING) {
|
||||
lastRunning = now
|
||||
graceUntil = now
|
||||
return false
|
||||
}
|
||||
val deadline = lastRunning?.plus(RUNNING_GRACE_MS) ?: startupDeadline
|
||||
return now >= maxOf(deadline, graceUntil)
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val STARTUP_MS = 30_000L
|
||||
const val RUNNING_GRACE_MS = 5_000L
|
||||
const val RESUME_GRACE_MS = 15_000L
|
||||
}
|
||||
}
|
||||
@@ -52,18 +52,17 @@ class QuestXrActivity : NativeActivity() {
|
||||
if (!closing) leaveXr("SteamVR start failed", sessionAlive())
|
||||
return@Thread
|
||||
}
|
||||
val startupDeadline = SystemClock.elapsedRealtime() + 30_000
|
||||
var lastRunning: Long? = null
|
||||
val watch = QuestSteamVrWatch(SystemClock.elapsedRealtime())
|
||||
while (!closing) {
|
||||
if (!sessionAlive()) {
|
||||
leaveXr("Steam session ended", false)
|
||||
break
|
||||
}
|
||||
steamVrStatus = SteamVr.status(this)
|
||||
val now = SystemClock.elapsedRealtime()
|
||||
if (steamVrStatus == SteamVr.Status.RUNNING) lastRunning = now
|
||||
val deadline = lastRunning?.plus(5_000) ?: startupDeadline
|
||||
if (steamVrStatus != SteamVr.Status.RUNNING && now >= deadline) {
|
||||
val pausedBefore = guestPaused()
|
||||
val status = SteamVr.status(this)
|
||||
val paused = pausedBefore || guestPaused()
|
||||
if (!paused) steamVrStatus = status
|
||||
if (watch.stopped(SystemClock.elapsedRealtime(), status, paused)) {
|
||||
leaveXr("SteamVR stopped or did not finish starting", true)
|
||||
break
|
||||
}
|
||||
@@ -81,6 +80,8 @@ class QuestXrActivity : NativeActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun guestPaused() = SessionState.suspending || SessionState.suspended || SessionState.resuming
|
||||
|
||||
private fun sessionAlive() = SessionState.running && !SessionState.stopRequested &&
|
||||
sessionId != null && SessionState.sessionId == sessionId
|
||||
|
||||
|
||||
@@ -2916,6 +2916,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
val runtimeDir = File(filesDir, ".wayland-rt").apply { mkdirs() }
|
||||
FileUtils.copyAsset(this, "wayland/keymap.xkb", File(runtimeDir, "keymap.xkb"))
|
||||
com.droiddeck.launcher.input.VrControllers.publish(this)
|
||||
com.droiddeck.launcher.session.QuestSteamVrLaunch.publish(this)
|
||||
|
||||
val turnip = TurnipDriver(this)
|
||||
com.droiddeck.launcher.gpu.DriverSetupLog.write(this, "surface.driver-setup")
|
||||
@@ -6371,6 +6372,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
if (CompositorHost.isStarted) applyFrameGen(force = true)
|
||||
applyFollowOrientation(resources.configuration)
|
||||
uiHandler.removeCallbacks(questSteamVrRequest)
|
||||
if (com.droiddeck.launcher.session.QuestExperimental.isSupported()) uiHandler.post(questSteamVrRequest)
|
||||
if (runtimeRemovalBlocked) return
|
||||
if (!SessionState.suspended) pausedFrame = null
|
||||
com.droiddeck.launcher.ui.Motion.refresh(this)
|
||||
@@ -6430,10 +6433,19 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
uiHandler.removeCallbacks(questSteamVrRequest)
|
||||
departureCleanup()
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
private val questSteamVrRequest = object : Runnable {
|
||||
override fun run() {
|
||||
if (com.droiddeck.launcher.session.QuestSteamVrLaunch.takeRequest(this@SessionActivity) &&
|
||||
SessionState.running && SessionState.mode == SessionService.MODE_STEAM) steamVrAction("start")
|
||||
uiHandler.postDelayed(this, 1000)
|
||||
}
|
||||
}
|
||||
|
||||
private fun departureCleanup() {
|
||||
com.droiddeck.launcher.input.SystemKeyCapture.detach(this)
|
||||
com.droiddeck.launcher.input.HomeButtonShortcuts.detach(this)
|
||||
|
||||
@@ -61,7 +61,19 @@ object GameEnvironment {
|
||||
}
|
||||
|
||||
fun effective(config: Config, preset: String, scope: String, forceSsbs: Boolean = false): Map<String, String?> =
|
||||
defaults(preset, forceSsbs) + config.shared + if (scope.isEmpty()) emptyMap() else config.games[scope].orEmpty()
|
||||
defaults(preset, forceSsbs) + config.shared + if (scope.isEmpty()) emptyMap() else knownGames[scope].orEmpty() + config.games[scope].orEmpty()
|
||||
|
||||
/**
|
||||
* What some Steam games need here whatever the shared settings say; the game's own settings still win.
|
||||
* GTA III dies at 0042A703 when a new game starts with FEX's reduced x87 precision, as the Rockstar store copy does.
|
||||
*/
|
||||
val knownGames: Map<String, Map<String, String?>> = mapOf(
|
||||
"12100" to mapOf("FEX_X87REDUCEDPRECISION" to "0"),
|
||||
)
|
||||
|
||||
/** [config] with [knownGames] folded under each game's own settings, for the guest to read. */
|
||||
fun withKnownGames(config: Config): Config =
|
||||
config.copy(games = config.games + knownGames.mapValues { (scope, known) -> known + config.games[scope].orEmpty() })
|
||||
|
||||
fun hasOverride(config: Config, scope: String, name: String): Boolean =
|
||||
scope.isNotEmpty() && config.entries(scope).containsKey(name)
|
||||
@@ -78,7 +90,7 @@ object GameEnvironment {
|
||||
val entries = config.games[scope].orEmpty()
|
||||
if (FexPreset.environmentKeys.none(entries::containsKey)) return null
|
||||
return FexPreset.all.firstOrNull { preset ->
|
||||
val expected = FexPreset.environment(preset.id)
|
||||
val expected = presetFor(scope, preset.id)
|
||||
FexPreset.environmentKeys.all { key -> entries.containsKey(key) && entries[key] == expected[key] }
|
||||
}?.id ?: CUSTOM_FEX_PRESET
|
||||
}
|
||||
@@ -88,12 +100,16 @@ object GameEnvironment {
|
||||
require(preset == null || FexPreset.all.any { it.id == preset })
|
||||
val entries = config.entries(scope).filterKeys { it !in FexPreset.environmentKeys }.toMutableMap()
|
||||
if (preset != null) {
|
||||
val values = FexPreset.environment(preset)
|
||||
val values = presetFor(scope, preset)
|
||||
FexPreset.environmentKeys.forEach { key -> entries[key] = values[key] }
|
||||
}
|
||||
return config.withEntries(scope, entries)
|
||||
}
|
||||
|
||||
/** A FEX preset as a game gets it: picking one never undoes a fix the game is known to need. */
|
||||
private fun presetFor(scope: String, preset: String): Map<String, String?> =
|
||||
FexPreset.environment(preset) + knownGames[scope].orEmpty().filterKeys { it in FexPreset.environmentKeys }
|
||||
|
||||
const val CUSTOM_FEX_PRESET = "__custom__"
|
||||
|
||||
val syncBackends = listOf(SessionPrefs.SYNC_NTSYNC, SessionPrefs.SYNC_FSYNC, SessionPrefs.SYNC_ESYNC, SessionPrefs.SYNC_WINESERVER)
|
||||
|
||||
@@ -8,9 +8,18 @@ import android.os.Environment
|
||||
import android.provider.Settings
|
||||
|
||||
object AllFilesAccess {
|
||||
private val VOLUME = Regex("^(/storage/emulated/\\d+|/storage/[^/]+|/sdcard)(/.*)?$")
|
||||
private val APP_FOLDERS = listOf("/Android/data", "/Android/obb")
|
||||
|
||||
fun missing(sdk: Int = Build.VERSION.SDK_INT, granted: () -> Boolean = { Environment.isExternalStorageManager() }): Boolean =
|
||||
sdk >= Build.VERSION_CODES.R && !granted()
|
||||
|
||||
/** Whether reading [path] takes all-files access: shared storage, outside the per-app folders directly under a volume's root, which Android always lets the app use. */
|
||||
fun covers(path: String): Boolean {
|
||||
val inside = VOLUME.matchEntire(path)?.groupValues?.get(2) ?: return false
|
||||
return APP_FOLDERS.none { inside == it || inside.startsWith("$it/") }
|
||||
}
|
||||
|
||||
fun open(context: Context) {
|
||||
val app = Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION, Uri.parse("package:" + context.packageName))
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
|
||||
@@ -504,13 +504,15 @@ fun FileManagerScreen(
|
||||
}
|
||||
val drives = remember(storageTick) { StorageRoots.list(context) }
|
||||
var accessDrive by remember { mutableStateOf<String?>(null) }
|
||||
var accessWasMissing by remember { mutableStateOf(AllFilesAccess.missing()) }
|
||||
var accessDeclined by remember { mutableStateOf(false) }
|
||||
fun unreadable(drive: StorageRoot) {
|
||||
if (AllFilesAccess.missing()) accessDrive = drive.label
|
||||
else Toast.makeText(context, context.getString(R.string.fm_drive_not_readable, drive.label), Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
accessDrive?.let { label ->
|
||||
OutlinedAlertDialog(
|
||||
onDismissRequest = { accessDrive = null },
|
||||
onDismissRequest = { accessDrive = null; accessDeclined = true },
|
||||
title = { Text(stringResource(R.string.fm_drive_access_title, label)) },
|
||||
text = { Text(stringResource(R.string.fm_drive_access_text)) },
|
||||
confirmButton = {
|
||||
@@ -519,9 +521,17 @@ fun FileManagerScreen(
|
||||
AllFilesAccess.open(context)
|
||||
}, modifier = Modifier.focusGlide(CircleShape)) { Text(stringResource(R.string.upd_open_settings)) }
|
||||
},
|
||||
dismissButton = { TextButton(onClick = { accessDrive = null }, modifier = Modifier.focusGlide(CircleShape)) { Text(stringResource(R.string.common_cancel)) } },
|
||||
dismissButton = { TextButton(onClick = { accessDrive = null; accessDeclined = true }, modifier = Modifier.focusGlide(CircleShape)) { Text(stringResource(R.string.common_cancel)) } },
|
||||
)
|
||||
}
|
||||
LaunchedEffect(currentDir, storageTick) {
|
||||
if (!AllFilesAccess.missing()) {
|
||||
if (accessWasMissing) { accessWasMissing = false; loadDirectory(currentDir, resetScroll = false, record = false) }
|
||||
} else {
|
||||
accessWasMissing = true
|
||||
if (!accessDeclined && accessDrive == null && AllFilesAccess.covers(currentDir.path)) accessDrive = drives.firstOrNull { currentDir.path.startsWith(it.dir.path) }?.label ?: context.getString(R.string.fm_drive_internal)
|
||||
}
|
||||
}
|
||||
val linuxRoot = remember(storageTick) {
|
||||
com.droiddeck.launcher.runtime.LinuxRuntime.rootDir(context).takeIf { File(it, "usr").isDirectory }
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public final class PadBridge {
|
||||
private final PadState[] playerStates = new PadState[SLOTS];
|
||||
private final float[][] rawSticks = new float[SLOTS][4];
|
||||
private final Map<Integer, Boolean> rightStickLayouts = new HashMap<>();
|
||||
private final boolean[][] keyTriggers = new boolean[SLOTS][2];
|
||||
private final TriggerKey[][] keyTriggers = TriggerKey.slots(SLOTS);
|
||||
private final int[] retainedSticks = new int[SLOTS];
|
||||
private final PadState effectiveState = new PadState();
|
||||
private final PadState homeGuideReport = new PadState();
|
||||
@@ -484,7 +484,7 @@ public final class PadBridge {
|
||||
stateFor(slot).clear();
|
||||
retainedSticks[slot] = 0;
|
||||
Arrays.fill(rawSticks[slot], 0f);
|
||||
Arrays.fill(keyTriggers[slot], false);
|
||||
for (TriggerKey key : keyTriggers[slot]) key.reset();
|
||||
}
|
||||
|
||||
private void mutateState(java.util.function.Consumer<PadState> mutation) {
|
||||
@@ -570,26 +570,76 @@ public final class PadBridge {
|
||||
return true;
|
||||
}
|
||||
|
||||
static float keyTrigger(float current, boolean pressed, int repeatCount, boolean analog, boolean[] held, int side) {
|
||||
static final class TriggerKey {
|
||||
static final float RELEASE_FROM_PEAK = 0.05f;
|
||||
boolean held;
|
||||
boolean handoff;
|
||||
boolean axisLive;
|
||||
boolean axisMovedWhilePressed;
|
||||
float peak;
|
||||
float axis;
|
||||
|
||||
static TriggerKey[][] slots(int count) {
|
||||
TriggerKey[][] keys = new TriggerKey[count][2];
|
||||
for (TriggerKey[] pair : keys) {
|
||||
pair[0] = new TriggerKey();
|
||||
pair[1] = new TriggerKey();
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
|
||||
void reset() {
|
||||
held = false;
|
||||
handoff = false;
|
||||
axisLive = false;
|
||||
axisMovedWhilePressed = false;
|
||||
peak = 0f;
|
||||
axis = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
static float keyTrigger(float current, boolean pressed, int repeatCount, boolean analog, TriggerKey[] keys, int side) {
|
||||
TriggerKey key = keys[side];
|
||||
if (repeatCount > 0) return current;
|
||||
if (!analog) {
|
||||
held[side] = pressed;
|
||||
key.held = pressed;
|
||||
return pressed ? 1f : 0f;
|
||||
}
|
||||
if (pressed) {
|
||||
if (current != 0f) return current;
|
||||
held[side] = true;
|
||||
key.axisMovedWhilePressed = false;
|
||||
if (key.axisLive || current != 0f) return current;
|
||||
key.held = true;
|
||||
return 1f;
|
||||
}
|
||||
if (!held[side]) return current;
|
||||
held[side] = false;
|
||||
if (!key.axisMovedWhilePressed) key.axisLive = false;
|
||||
if (key.handoff) {
|
||||
key.handoff = false;
|
||||
return key.axis;
|
||||
}
|
||||
if (!key.held) return current;
|
||||
key.held = false;
|
||||
return 0f;
|
||||
}
|
||||
|
||||
static float axisTrigger(float value, boolean[] held, int side) {
|
||||
if (!held[side]) return value;
|
||||
if (value == 0f) return 1f;
|
||||
held[side] = false;
|
||||
static float axisTrigger(float value, TriggerKey[] keys, int side) {
|
||||
TriggerKey key = keys[side];
|
||||
key.axis = value;
|
||||
if (value != 0f) {
|
||||
key.axisLive = true;
|
||||
key.axisMovedWhilePressed = true;
|
||||
}
|
||||
if (key.held) {
|
||||
if (value == 0f) return 1f;
|
||||
key.held = false;
|
||||
key.handoff = true;
|
||||
key.peak = value;
|
||||
return 1f;
|
||||
}
|
||||
if (key.handoff) {
|
||||
key.peak = Math.max(key.peak, value);
|
||||
if (value > key.peak - TriggerKey.RELEASE_FROM_PEAK) return 1f;
|
||||
key.handoff = false;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
@@ -302,9 +302,9 @@ class LinuxNetworkLinkComponent(
|
||||
val etc = File(rootDir, "etc")
|
||||
replace(File(etc, "resolv.conf"), text)
|
||||
val hosts = File(etc, "hosts")
|
||||
if (!hosts.isFile || !hosts.readText().contains("localhost")) {
|
||||
hosts.writeText("127.0.0.1 localhost\n::1 localhost\n")
|
||||
}
|
||||
val existing = if (hosts.isFile) hosts.readText() else null
|
||||
val wanted = hostsText(existing)
|
||||
if (wanted != existing) replace(hosts, wanted)
|
||||
Log.i(TAG, "resolver: " + servers.joinToString(" "))
|
||||
} catch (e: IOException) {
|
||||
Log.w(TAG, "Could not write the resolver", e)
|
||||
@@ -338,6 +338,42 @@ class LinuxNetworkLinkComponent(
|
||||
companion object {
|
||||
private val WRITES = Any()
|
||||
|
||||
private const val HOSTS_BLOCK_START = "# DroidDeck: Unity telemetry is refused (start)"
|
||||
private const val HOSTS_BLOCK_END = "# DroidDeck: Unity telemetry is refused (end)"
|
||||
|
||||
// Unity 5's player seeds its bundled OpenSSL before its first HTTPS request, and that code jumps
|
||||
// to a bad address under FEX (Windlands, 428370). Refusing these telemetry hosts makes the request
|
||||
// fail before TLS starts; the games run without them.
|
||||
internal val UNITY_TELEMETRY_HOSTS = listOf(
|
||||
"config.uca.cloud.unity3d.com", "api.uca.cloud.unity3d.com", "cdp.cloud.unity3d.com",
|
||||
"stats.unity3d.com", "perf-events.cloud.unity3d.com",
|
||||
)
|
||||
|
||||
internal fun hostsText(existing: String?): String {
|
||||
val kept = mutableListOf<String>()
|
||||
var block: MutableList<String>? = null
|
||||
for (line in existing.orEmpty().lines()) {
|
||||
when {
|
||||
line == HOSTS_BLOCK_START -> {
|
||||
block?.let(kept::addAll)
|
||||
block = mutableListOf()
|
||||
}
|
||||
line == HOSTS_BLOCK_END -> block = null
|
||||
block != null -> block!!.add(line)
|
||||
else -> kept.add(line)
|
||||
}
|
||||
}
|
||||
block?.let(kept::addAll)
|
||||
kept.removeAll { it.isBlank() }
|
||||
return buildString {
|
||||
if (kept.none { it.substringBefore('#').contains("localhost") }) append("127.0.0.1 localhost\n::1 localhost\n")
|
||||
kept.forEach { append(it).append('\n') }
|
||||
append(HOSTS_BLOCK_START).append('\n')
|
||||
append("0.0.0.0 ").append(UNITY_TELEMETRY_HOSTS.joinToString(" ")).append('\n')
|
||||
append(HOSTS_BLOCK_END).append('\n')
|
||||
}
|
||||
}
|
||||
|
||||
internal fun gateways(properties: LinkProperties?, capabilities: NetworkCapabilities?): List<InetAddress> =
|
||||
listOf(Inet4Address::class.java, Inet6Address::class.java).mapNotNull { family ->
|
||||
properties?.routes.orEmpty()
|
||||
|
||||
@@ -112,8 +112,9 @@ object NativeGuest {
|
||||
File(BwrapSpawner.hostPath(binds.map { BwrapSpawner.Bind.parse(it) }, root.path, cwd)).takeIf { it.isDirectory } ?: root
|
||||
|
||||
/** A process for [guest] (argv) started as proot would with [binds], in guest directory [cwd]. */
|
||||
fun processBuilder(context: Context, root: File, binds: List<String>, guest: List<String>, cwd: String = "/root"): ProcessBuilder =
|
||||
ProcessBuilder(command(root, guest.first(), guest.drop(1)))
|
||||
fun processBuilder(context: Context, root: File, binds: List<String>, guest: List<String>, cwd: String = "/root"): ProcessBuilder {
|
||||
if (sessionMode == null) prepare(context, root)
|
||||
return ProcessBuilder(command(root, guest.first(), guest.drop(1)))
|
||||
.directory(workingDirectory(root, binds, cwd))
|
||||
.also { builder ->
|
||||
builder.environment().apply {
|
||||
@@ -121,6 +122,7 @@ object NativeGuest {
|
||||
putAll(sessionEnvironment(root, binds, guest.first(), SessionPrefs.guestHostname(context)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private const val RUNPATH_CONF = "etc/ld.so.conf.d/zz-droiddeck-native.conf"
|
||||
private val SCAN_DIRS = listOf("usr/lib", "usr/local/lib", "opt")
|
||||
@@ -149,6 +151,7 @@ object NativeGuest {
|
||||
}
|
||||
|
||||
/** What a rootfs needs before anything runs in it natively; cheap once done. */
|
||||
@Synchronized
|
||||
fun prepare(context: Context, root: File) {
|
||||
val relinked = relinkAbsoluteSymlinks(context, root)
|
||||
if (relinked > 0) android.util.Log.i(TAG, "native userland: $relinked absolute symlinks made relative")
|
||||
|
||||
@@ -114,7 +114,7 @@ object GameEnvironmentStore {
|
||||
) {
|
||||
publishGameCores(context)
|
||||
val stored = config ?: read(context)
|
||||
val resolved = stored.copy(shared = GameEnvironment.defaults(SessionPrefs.fexPreset(context), SessionPrefs.forceSsbs(context)) + stored.shared)
|
||||
val resolved = GameEnvironment.withKnownGames(stored).copy(shared = GameEnvironment.defaults(SessionPrefs.fexPreset(context), SessionPrefs.forceSsbs(context)) + stored.shared)
|
||||
val json = encode(resolved)
|
||||
val dxvk = TextureFiltering.dxvkOptions(
|
||||
SessionPrefs.textureAnisotropy(context), SessionPrefs.textureLodBias(context),
|
||||
|
||||
@@ -29,6 +29,10 @@ object Onboarding {
|
||||
/** The setup screens belong to the first run; later runtime, Proton and Steam client updates keep the usual Play button. */
|
||||
val firstRun = MutableStateFlow(true)
|
||||
|
||||
/** Called once, when this process finishes the first-run downloads itself; not when everything was already in place. */
|
||||
@Volatile var onFirstRunReady: (() -> Unit)? = null
|
||||
@Volatile private var worked = false
|
||||
|
||||
fun attach(context: Context) {
|
||||
appContext = context.applicationContext
|
||||
val prefs = context.applicationContext.getSharedPreferences(PREFS, Context.MODE_PRIVATE)
|
||||
@@ -52,8 +56,10 @@ object Onboarding {
|
||||
|
||||
private fun markFirstRunDone() {
|
||||
val context = appContext ?: return
|
||||
val live = firstRun.value && worked
|
||||
context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).edit().putBoolean(KEY_FIRST_RUN_DONE, true).apply()
|
||||
firstRun.value = false
|
||||
if (live) onFirstRunReady?.invoke()
|
||||
}
|
||||
|
||||
/** Keeps the process in the foreground, with one notification, while a step downloads and the runtime installer is not already doing so. */
|
||||
@@ -90,6 +96,7 @@ object Onboarding {
|
||||
}
|
||||
|
||||
fun report(step: Step, label: String, percent: Int) {
|
||||
worked = true
|
||||
failed.value = failed.value - step
|
||||
active.value = active.value + (step to Progress(label, percent))
|
||||
keepAlive()
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import android.content.Context
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
* On a Quest, SteamVR has to run inside the immersive activity. A launch from Steam's library happens in the
|
||||
* guest, so the guest's SteamVR helper leaves a request in the shared runtime directory for the session to act on.
|
||||
*/
|
||||
object QuestSteamVrLaunch {
|
||||
private const val DIR = ".wayland-rt/droiddeck-steamvr"
|
||||
private const val MARKER = "quest-immersive"
|
||||
private const val REQUEST = "xr-request"
|
||||
|
||||
fun publish(context: Context) {
|
||||
val dir = File(context.filesDir, DIR)
|
||||
val marker = File(dir, MARKER)
|
||||
if (!QuestExperimental.isSupported()) {
|
||||
marker.delete()
|
||||
return
|
||||
}
|
||||
runCatching {
|
||||
dir.mkdirs()
|
||||
marker.writeText("")
|
||||
}
|
||||
}
|
||||
|
||||
/** A request left by an earlier session must not open the immersive view in this one. */
|
||||
fun clearRequest(context: Context) {
|
||||
File(context.filesDir, "$DIR/$REQUEST").delete()
|
||||
}
|
||||
|
||||
fun takeRequest(context: Context): Boolean =
|
||||
QuestExperimental.isSupported() && File(context.filesDir, "$DIR/$REQUEST").delete()
|
||||
}
|
||||
@@ -35,6 +35,7 @@ object SessionFiles {
|
||||
"usr/local/bin/kwin_wayland_wrapper" to "usr/local/bin/kwin_wayland_wrapper",
|
||||
"usr/lib/firefox/defaults/pref/droiddeck.js" to "usr/lib/firefox/defaults/pref/droiddeck.js",
|
||||
"etc/xdg/autostart/droiddeck-clipboard.desktop" to "etc/xdg/autostart/droiddeck-clipboard.desktop",
|
||||
"usr/share/applications/droiddeck-return-gaming.desktop" to "usr/share/applications/droiddeck-return-gaming.desktop",
|
||||
"etc/xdg/fastfetch/config.jsonc" to "etc/xdg/fastfetch/config.jsonc",
|
||||
)
|
||||
|
||||
|
||||
@@ -960,12 +960,6 @@ 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) {
|
||||
@@ -1235,6 +1229,11 @@ object SessionPrefs {
|
||||
prefs(context).edit().putBoolean("venus", on).apply()
|
||||
}
|
||||
|
||||
/** Venus off with no choice stored, so that Auto turning it off does not read as the user's own choice. */
|
||||
fun clearVenus(context: Context) {
|
||||
prefs(context).edit().remove("venus").apply()
|
||||
}
|
||||
|
||||
fun setVkBridge(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("vkBridge", on).putBoolean("bridgeFellBack", false).apply()
|
||||
}
|
||||
|
||||
@@ -417,6 +417,7 @@ class SessionService : Service() {
|
||||
SessionPrefs.screenEffectsProfileId(SessionState.mode, resolvedGameId, SessionState.program),
|
||||
)
|
||||
com.droiddeck.launcher.stores.battlenet.BattleNetClient.clearRequests(LinuxRuntime.sessionRoot(this))
|
||||
QuestSteamVrLaunch.clearRequest(this)
|
||||
val gen = synchronized(SessionState.startLock) {
|
||||
synchronized(stopLock) {
|
||||
SessionState.steamClientArch = null
|
||||
|
||||
@@ -121,6 +121,8 @@ object StoresState {
|
||||
var unfinished by mutableStateOf<List<StoreInstallRoot.Unfinished>>(emptyList())
|
||||
internal set
|
||||
|
||||
var steamPicking by mutableStateOf<CatalogItem?>(null)
|
||||
|
||||
fun isUnfinished(item: CatalogItem): Boolean = unfinished.any {
|
||||
it.store == item.store && (it.id == item.id || (it.id == null && it.folder.name == StoreInstallRoot.folderName(item.title, item.id)))
|
||||
}
|
||||
|
||||
@@ -212,6 +212,7 @@ object BattleNetInstall {
|
||||
reason == null -> "exit $code"
|
||||
reason == "client" -> return context.getString(R.string.bnet_dl_client_first)
|
||||
reason == STALLED -> return context.getString(R.string.bnet_dl_stalled)
|
||||
reason == "agent 703" || reason?.contains("(error 703)") == true -> return context.getString(R.string.bnet_dl_folder_access)
|
||||
reason.startsWith("agent ") -> context.getString(R.string.bnet_dl_agent_error, reason.removePrefix("agent "))
|
||||
else -> reason.removePrefix("stopped ")
|
||||
}
|
||||
|
||||
@@ -6,9 +6,6 @@ import android.net.Uri
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.frontend.Library
|
||||
import com.droiddeck.launcher.session.SessionService
|
||||
@@ -46,8 +43,6 @@ internal object SteamStore {
|
||||
/** InvalidPassword, AccessDenied, AccountNotFound, Revoked, Expired, AccountLogonDenied. */
|
||||
private val REFUSALS = setOf(5, 15, 18, 26, 27, 63)
|
||||
|
||||
var picking by mutableStateOf<CatalogItem?>(null)
|
||||
|
||||
class Plan(val installDir: String, val downloadBytes: Long, val installBytes: Long, val buildId: String, val linuxBuild: Boolean) {
|
||||
companion object {
|
||||
fun of(json: JSONObject): Plan? {
|
||||
@@ -222,7 +217,7 @@ internal object SteamStore {
|
||||
toast(context, R.string.steam_store_close_steam)
|
||||
return
|
||||
}
|
||||
picking = item
|
||||
StoresState.steamPicking = item
|
||||
}
|
||||
|
||||
fun install(context: Context, item: CatalogItem, target: SteamClient.Target) {
|
||||
|
||||
@@ -94,17 +94,16 @@ internal object XboxManifest {
|
||||
}
|
||||
|
||||
fun executable(folder: File): String {
|
||||
for (path in read(folder).executables) {
|
||||
val listed = read(folder).executables
|
||||
for (path in listed) {
|
||||
require(!path.startsWith('/') && !path.contains(':') && path.split('/').none { it == ".." || it.isEmpty() })
|
||||
var file = folder
|
||||
for (part in path.split('/')) {
|
||||
val matches = file.listFiles().orEmpty().filter { it.name.equals(part, true) }
|
||||
require(matches.size == 1) { "Missing or ambiguous Xbox launch path." }
|
||||
file = matches.single()
|
||||
}
|
||||
val file = path.split('/').fold<String, File?>(folder) { dir, part ->
|
||||
dir?.listFiles().orEmpty().filter { it.name.equals(part, true) }.singleOrNull()
|
||||
} ?: continue
|
||||
require(file.canonicalPath.startsWith(folder.canonicalPath + File.separator))
|
||||
if (file.isFile) return forwarded(folder, file) ?: file.relativeTo(folder).invariantSeparatorsPath
|
||||
}
|
||||
require(listed.isEmpty()) { "Missing or ambiguous Xbox launch path." }
|
||||
error("The Xbox package has no supported PC launch executable.")
|
||||
}
|
||||
|
||||
|
||||
@@ -847,7 +847,7 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
|
||||
com.droiddeck.launcher.stores.StoresState.pendingInstall?.let { item -> StoreTheme(item.store) { InstallWhere(item) } }
|
||||
com.droiddeck.launcher.stores.StoresState.itchPicking?.let { item -> StoreTheme(item.store) { ItchBuildPicker(item) { com.droiddeck.launcher.stores.StoresState.itchPicking = null } } }
|
||||
com.droiddeck.launcher.stores.StoresState.gameJoltPicking?.let { item -> StoreTheme(item.store) { GameJoltBuildPicker(item) { com.droiddeck.launcher.stores.StoresState.gameJoltPicking = null } } }
|
||||
com.droiddeck.launcher.stores.steam.SteamStore.picking?.let { item -> StoreTheme(item.store) { SteamInstallWhereDialog(item) { com.droiddeck.launcher.stores.steam.SteamStore.picking = null } } }
|
||||
com.droiddeck.launcher.stores.StoresState.steamPicking?.let { item -> StoreTheme(item.store) { SteamInstallWhereDialog(item) { com.droiddeck.launcher.stores.StoresState.steamPicking = null } } }
|
||||
StepsLayer(screenAt)
|
||||
UiZooSheet()
|
||||
SessionDrawerPreview(s.secondScreenDisplays)
|
||||
|
||||
@@ -195,6 +195,10 @@ internal fun librarySources(
|
||||
}
|
||||
}
|
||||
|
||||
internal fun alwaysLibraryTabs(signedIn: Collection<Store>, stores: Boolean, soundMode: Boolean): Set<String> =
|
||||
(if (soundMode) emptyList() else signedIn.map { it.librarySource }).toSet() +
|
||||
listOfNotNull(Library.ADDED.takeIf { stores }, Store.BATTLENET.id.takeIf { stores })
|
||||
|
||||
internal object LibraryDisplay {
|
||||
const val DEFAULT_LEVEL = 2
|
||||
val scales = listOf(0.75f, 0.875f, 1f, 1.2f, 1.45f)
|
||||
@@ -374,7 +378,7 @@ internal fun LibraryPage(s: FrontEndState, a: FrontEndActions, selected: String,
|
||||
.map { it.store.id }.toSet()
|
||||
val sources = librarySources(
|
||||
all, storeTabs.map { it.store.id },
|
||||
listOfNotNull(Store.ITCH.id.takeIf { itchSignedIn && !soundMode }, Store.GAMEJOLT.id.takeIf { gameJoltSignedIn && !soundMode }, Library.ADDED.takeIf { stores }, Store.BATTLENET.id.takeIf { stores }).toSet() + signInChips,
|
||||
alwaysLibraryTabs(owned.keys, stores, soundMode) + signInChips,
|
||||
favorites, concealed,
|
||||
offStores = if (soundMode) emptySet() else storeTabs.filterNot { it.shown }.map { it.store.id }.toSet(),
|
||||
places = if (soundMode) DEFAULT_LIBRARY_PLACES else StoreTabsState.libraryPlaces,
|
||||
|
||||
@@ -2658,6 +2658,7 @@
|
||||
<string name="bnet_dl_failed">توقفت أداة التنزيل من Blizzard: %1$s</string>
|
||||
<string name="bnet_dl_stalled">توقفت أداة التنزيل من Blizzard عن التقدم.</string>
|
||||
<string name="bnet_dl_agent_error">خطأ Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">تعذر على Blizzard الوصول إلى مجلد اللعبة (خطأ 703). تحقّق من أذوناته أو اختر مجلدًا مختلفًا.</string>
|
||||
<string name="bnet_update">تحديث</string>
|
||||
<string name="bnet_store">ألعاب Blizzard</string>
|
||||
<string name="stores_resume_install">استئناف التثبيت</string>
|
||||
|
||||
@@ -2650,6 +2650,7 @@
|
||||
<string name="bnet_dl_failed">El descargador de Blizzard se detuvo: %1$s</string>
|
||||
<string name="bnet_dl_stalled">El descargador de Blizzard dejó de avanzar.</string>
|
||||
<string name="bnet_dl_agent_error">Error de Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard no pudo acceder a la carpeta del juego (error 703). Verifica sus permisos o elige otra carpeta.</string>
|
||||
<string name="bnet_update">Actualizar</string>
|
||||
<string name="bnet_store">Juegos de Blizzard</string>
|
||||
<string name="stores_resume_install">Reanudar instalación</string>
|
||||
|
||||
@@ -2554,6 +2554,7 @@
|
||||
<string name="bnet_dl_failed">Програмата за изтегляне на Blizzard спря: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Програмата за изтегляне на Blizzard спря да напредва.</string>
|
||||
<string name="bnet_dl_agent_error">Грешка на Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard не успя да получи достъп до папката на играта (грешка 703). Проверете разрешенията ѝ или изберете друга папка.</string>
|
||||
<string name="bnet_update">Актуализиране</string>
|
||||
<string name="bnet_store">Игри на Blizzard</string>
|
||||
<string name="stores_resume_install">Продължи инсталацията</string>
|
||||
|
||||
@@ -2606,6 +2606,7 @@
|
||||
<string name="bnet_dl_failed">Stahovač Blizzardu se zastavil: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Stahovač Blizzardu přestal postupovat.</string>
|
||||
<string name="bnet_dl_agent_error">Chyba Blizzardu %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard nemohl získat přístup ke složce hry (chyba 703). Zkontrolujte její oprávnění nebo vyberte jinou složku.</string>
|
||||
<string name="bnet_update">Aktualizovat</string>
|
||||
<string name="bnet_store">Hry od Blizzardu</string>
|
||||
<string name="stores_resume_install">Pokračovat v instalaci</string>
|
||||
|
||||
@@ -2554,6 +2554,7 @@
|
||||
<string name="bnet_dl_failed">Blizzards downloader stoppede: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzards downloader holdt op med at gøre fremskridt.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard-fejl %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard kunne ikke få adgang til spilmappen (fejl 703). Kontrollér dens tilladelser, eller vælg en anden mappe.</string>
|
||||
<string name="bnet_update">Opdater</string>
|
||||
<string name="bnet_store">Blizzard-spil</string>
|
||||
<string name="stores_resume_install">Genoptag installation</string>
|
||||
|
||||
@@ -2546,6 +2546,7 @@
|
||||
<string name="bnet_dl_failed">Blizzards Downloader wurde beendet: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzards Downloader kommt nicht mehr voran.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard-Fehler %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard konnte nicht auf den Spielordner zugreifen (Fehler 703). Prüfe die Berechtigungen oder wähle einen anderen Ordner.</string>
|
||||
<string name="bnet_update">Aktualisieren</string>
|
||||
<string name="bnet_store">Blizzard-Spiele</string>
|
||||
<string name="stores_resume_install">Installation fortsetzen</string>
|
||||
|
||||
@@ -2554,6 +2554,7 @@
|
||||
<string name="bnet_dl_failed">Το πρόγραμμα λήψης της Blizzard σταμάτησε: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Το πρόγραμμα λήψης της Blizzard σταμάτησε να προχωρά.</string>
|
||||
<string name="bnet_dl_agent_error">Σφάλμα Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Το Blizzard δεν μπόρεσε να αποκτήσει πρόσβαση στον φάκελο του παιχνιδιού (σφάλμα 703). Ελέγξτε τα δικαιώματά του ή επιλέξτε διαφορετικό φάκελο.</string>
|
||||
<string name="bnet_update">Ενημέρωση</string>
|
||||
<string name="bnet_store">Παιχνίδια της Blizzard</string>
|
||||
<string name="stores_resume_install">Συνέχιση εγκατάστασης</string>
|
||||
|
||||
@@ -2580,6 +2580,7 @@
|
||||
<string name="bnet_dl_failed">El descargador de Blizzard se ha detenido: %1$s</string>
|
||||
<string name="bnet_dl_stalled">El descargador de Blizzard ha dejado de avanzar.</string>
|
||||
<string name="bnet_dl_agent_error">Error de Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard no pudo acceder a la carpeta del juego (error 703). Comprueba sus permisos o elige otra carpeta.</string>
|
||||
<string name="bnet_update">Actualizar</string>
|
||||
<string name="bnet_store">Juegos de Blizzard</string>
|
||||
<string name="stores_resume_install">Reanudar instalación</string>
|
||||
|
||||
@@ -2554,6 +2554,7 @@
|
||||
<string name="bnet_dl_failed">Blizzardin latausohjelma pysähtyi: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzardin latausohjelma lakkasi etenemästä.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard-virhe %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard ei voinut käyttää pelikansiota (virhe 703). Tarkista sen käyttöoikeudet tai valitse toinen kansio.</string>
|
||||
<string name="bnet_update">Päivitä</string>
|
||||
<string name="bnet_store">Blizzardin pelit</string>
|
||||
<string name="stores_resume_install">Jatka asennusta</string>
|
||||
|
||||
@@ -2579,6 +2579,7 @@
|
||||
<string name="bnet_dl_failed">Le téléchargeur de Blizzard s\'est arrêté : %1$s</string>
|
||||
<string name="bnet_dl_stalled">Le téléchargeur de Blizzard n\'avance plus.</string>
|
||||
<string name="bnet_dl_agent_error">Erreur Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard n’a pas pu accéder au dossier du jeu (erreur 703). Vérifiez ses autorisations ou choisissez un autre dossier.</string>
|
||||
<string name="bnet_update">Mettre à jour</string>
|
||||
<string name="bnet_store">Jeux Blizzard</string>
|
||||
<string name="stores_resume_install">Reprendre l\'installation</string>
|
||||
|
||||
@@ -2554,6 +2554,7 @@
|
||||
<string name="bnet_dl_failed">Blizzard का डाउनलोडर रुक गया: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzard का डाउनलोडर आगे नहीं बढ़ रहा।</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard त्रुटि %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard गेम फ़ोल्डर तक नहीं पहुँच सका (त्रुटि 703)। इसकी अनुमतियाँ जाँचें या कोई दूसरा फ़ोल्डर चुनें।</string>
|
||||
<string name="bnet_update">अपडेट करें</string>
|
||||
<string name="bnet_store">Blizzard के गेम</string>
|
||||
<string name="stores_resume_install">इंस्टॉल फिर से शुरू करें</string>
|
||||
|
||||
@@ -2554,6 +2554,7 @@
|
||||
<string name="bnet_dl_failed">A Blizzard letöltője leállt: %1$s</string>
|
||||
<string name="bnet_dl_stalled">A Blizzard letöltője nem halad tovább.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard-hiba: %1$s</string>
|
||||
<string name="bnet_dl_folder_access">A Blizzard nem tudott hozzáférni a játékmappához (703-as hiba). Ellenőrizd a jogosultságait, vagy válassz másik mappát.</string>
|
||||
<string name="bnet_update">Frissítés</string>
|
||||
<string name="bnet_store">Blizzard-játékok</string>
|
||||
<string name="stores_resume_install">Telepítés folytatása</string>
|
||||
|
||||
@@ -2529,6 +2529,7 @@
|
||||
<string name="bnet_dl_failed">Pengunduh Blizzard berhenti: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Pengunduh Blizzard berhenti berjalan.</string>
|
||||
<string name="bnet_dl_agent_error">Kesalahan Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard tidak dapat mengakses folder game (kesalahan 703). Periksa izinnya atau pilih folder lain.</string>
|
||||
<string name="bnet_update">Perbarui</string>
|
||||
<string name="bnet_store">Game Blizzard</string>
|
||||
<string name="stores_resume_install">Lanjutkan instalasi</string>
|
||||
|
||||
@@ -2571,6 +2571,7 @@
|
||||
<string name="bnet_dl_failed">Il downloader di Blizzard si è fermato: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Il downloader di Blizzard ha smesso di avanzare.</string>
|
||||
<string name="bnet_dl_agent_error">Errore Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard non è riuscito ad accedere alla cartella del gioco (errore 703). Controlla i permessi o scegli un\'altra cartella.</string>
|
||||
<string name="bnet_update">Aggiorna</string>
|
||||
<string name="bnet_store">Giochi Blizzard</string>
|
||||
<string name="stores_resume_install">Riprendi installazione</string>
|
||||
|
||||
@@ -2529,6 +2529,7 @@
|
||||
<string name="bnet_dl_failed">Blizzard のダウンローダーが停止しました: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzard のダウンローダーが進まなくなりました。</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard エラー %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard はゲームフォルダーにアクセスできませんでした(エラー 703)。権限を確認するか、別のフォルダーを選択してください。</string>
|
||||
<string name="bnet_update">アップデート</string>
|
||||
<string name="bnet_store">Blizzard のゲーム</string>
|
||||
<string name="stores_resume_install">インストールを再開</string>
|
||||
|
||||
@@ -2529,6 +2529,7 @@
|
||||
<string name="bnet_dl_failed">Blizzard 다운로더가 중지됨: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzard 다운로더가 더 이상 진행되지 않습니다.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard 오류 %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard가 게임 폴더에 액세스할 수 없습니다(오류 703). 권한을 확인하거나 다른 폴더를 선택하세요.</string>
|
||||
<string name="bnet_update">업데이트</string>
|
||||
<string name="bnet_store">Blizzard 게임</string>
|
||||
<string name="stores_resume_install">설치 재개</string>
|
||||
|
||||
@@ -2529,6 +2529,7 @@
|
||||
<string name="bnet_dl_failed">Pemuat turun Blizzard berhenti: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Pemuat turun Blizzard berhenti bergerak.</string>
|
||||
<string name="bnet_dl_agent_error">Ralat Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard tidak dapat mengakses folder permainan (ralat 703). Semak kebenarannya atau pilih folder lain.</string>
|
||||
<string name="bnet_update">Kemas kini</string>
|
||||
<string name="bnet_store">Permainan Blizzard</string>
|
||||
<string name="stores_resume_install">Sambung pemasangan</string>
|
||||
|
||||
@@ -2554,6 +2554,7 @@
|
||||
<string name="bnet_dl_failed">Blizzards nedlaster stoppet: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzards nedlaster sluttet å gjøre fremgang.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard-feil %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard fikk ikke tilgang til spillmappen (feil 703). Sjekk tillatelsene eller velg en annen mappe.</string>
|
||||
<string name="bnet_update">Oppdater</string>
|
||||
<string name="bnet_store">Blizzard-spill</string>
|
||||
<string name="stores_resume_install">Gjenoppta installasjon</string>
|
||||
|
||||
@@ -2554,6 +2554,7 @@
|
||||
<string name="bnet_dl_failed">Blizzards downloader is gestopt: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzards downloader maakt geen voortgang meer.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard-fout %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard kon geen toegang krijgen tot de gamemap (fout 703). Controleer de machtigingen of kies een andere map.</string>
|
||||
<string name="bnet_update">Bijwerken</string>
|
||||
<string name="bnet_store">Blizzard-games</string>
|
||||
<string name="stores_resume_install">Installatie hervatten</string>
|
||||
|
||||
@@ -2606,6 +2606,7 @@
|
||||
<string name="bnet_dl_failed">Program pobierający Blizzarda zatrzymał się: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Program pobierający Blizzarda przestał robić postępy.</string>
|
||||
<string name="bnet_dl_agent_error">Błąd Blizzarda %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard nie mógł uzyskać dostępu do folderu gry (błąd 703). Sprawdź jego uprawnienia lub wybierz inny folder.</string>
|
||||
<string name="bnet_update">Aktualizuj</string>
|
||||
<string name="bnet_store">Gry Blizzarda</string>
|
||||
<string name="stores_resume_install">Wznów instalację</string>
|
||||
|
||||
@@ -2586,6 +2586,7 @@
|
||||
<string name="bnet_dl_failed">O programa de transferência da Blizzard parou: %1$s</string>
|
||||
<string name="bnet_dl_stalled">O programa de transferência da Blizzard deixou de avançar.</string>
|
||||
<string name="bnet_dl_agent_error">Erro da Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">A Blizzard não conseguiu aceder à pasta do jogo (erro 703). Verifica as permissões ou escolhe outra pasta.</string>
|
||||
<string name="bnet_update">Atualizar</string>
|
||||
<string name="bnet_store">Jogos da Blizzard</string>
|
||||
<string name="stores_resume_install">Retomar instalação</string>
|
||||
|
||||
@@ -2596,6 +2596,7 @@
|
||||
<string name="bnet_dl_failed">O downloader da Blizzard parou: %1$s</string>
|
||||
<string name="bnet_dl_stalled">O downloader da Blizzard parou de avançar.</string>
|
||||
<string name="bnet_dl_agent_error">Erro da Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">A Blizzard não conseguiu acessar a pasta do jogo (erro 703). Verifique as permissões ou escolha outra pasta.</string>
|
||||
<string name="bnet_update">Atualizar</string>
|
||||
<string name="bnet_store">Jogos da Blizzard</string>
|
||||
<string name="stores_resume_install">Retomar instalação</string>
|
||||
|
||||
@@ -2580,6 +2580,7 @@
|
||||
<string name="bnet_dl_failed">Programul de descărcare Blizzard s-a oprit: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Programul de descărcare Blizzard nu mai avansează.</string>
|
||||
<string name="bnet_dl_agent_error">Eroare Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard nu a putut accesa folderul jocului (eroare 703). Verifică permisiunile acestuia sau alege un alt folder.</string>
|
||||
<string name="bnet_update">Actualizează</string>
|
||||
<string name="bnet_store">Jocuri Blizzard</string>
|
||||
<string name="stores_resume_install">Reia instalarea</string>
|
||||
|
||||
@@ -2607,6 +2607,7 @@
|
||||
<string name="bnet_dl_failed">Загрузчик Blizzard остановился: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Загрузчик Blizzard перестал продвигаться.</string>
|
||||
<string name="bnet_dl_agent_error">Ошибка Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard не удалось получить доступ к папке игры (ошибка 703). Проверьте права доступа или выберите другую папку.</string>
|
||||
<string name="bnet_update">Обновить</string>
|
||||
<string name="bnet_store">Игры Blizzard</string>
|
||||
<string name="stores_resume_install">Продолжить установку</string>
|
||||
|
||||
@@ -2554,6 +2554,7 @@
|
||||
<string name="bnet_dl_failed">Blizzards nedladdare stoppades: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzards nedladdare slutade göra framsteg.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard-fel %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard kunde inte komma åt spelmappen (fel 703). Kontrollera behörigheterna eller välj en annan mapp.</string>
|
||||
<string name="bnet_update">Uppdatera</string>
|
||||
<string name="bnet_store">Blizzard-spel</string>
|
||||
<string name="stores_resume_install">Återuppta installation</string>
|
||||
|
||||
@@ -2529,6 +2529,7 @@
|
||||
<string name="bnet_dl_failed">ตัวดาวน์โหลดของ Blizzard หยุดทำงาน: %1$s</string>
|
||||
<string name="bnet_dl_stalled">ตัวดาวน์โหลดของ Blizzard ไม่คืบหน้า</string>
|
||||
<string name="bnet_dl_agent_error">ข้อผิดพลาดของ Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard ไม่สามารถเข้าถึงโฟลเดอร์เกมได้ (ข้อผิดพลาด 703) ตรวจสอบสิทธิ์หรือเลือกโฟลเดอร์อื่น</string>
|
||||
<string name="bnet_update">อัปเดต</string>
|
||||
<string name="bnet_store">เกมของ Blizzard</string>
|
||||
<string name="stores_resume_install">ดำเนินการติดตั้งต่อ</string>
|
||||
|
||||
@@ -2546,6 +2546,7 @@
|
||||
<string name="bnet_dl_failed">Blizzard indiricisi durdu: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzard indiricisi ilerlemeyi durdurdu.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard hatası %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard oyun klasörüne erişemedi (hata 703). İzinlerini kontrol edin veya farklı bir klasör seçin.</string>
|
||||
<string name="bnet_update">Güncelle</string>
|
||||
<string name="bnet_store">Blizzard oyunları</string>
|
||||
<string name="stores_resume_install">Yüklemeyi sürdür</string>
|
||||
|
||||
@@ -2606,6 +2606,7 @@
|
||||
<string name="bnet_dl_failed">Завантажувач Blizzard зупинився: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Завантажувач Blizzard перестав просуватися.</string>
|
||||
<string name="bnet_dl_agent_error">Помилка Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard не вдалося отримати доступ до папки гри (помилка 703). Перевірте дозволи або виберіть іншу папку.</string>
|
||||
<string name="bnet_update">Оновити</string>
|
||||
<string name="bnet_store">Ігри Blizzard</string>
|
||||
<string name="stores_resume_install">Продовжити встановлення</string>
|
||||
|
||||
@@ -2529,6 +2529,7 @@
|
||||
<string name="bnet_dl_failed">Trình tải xuống của Blizzard đã dừng: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Trình tải xuống của Blizzard không còn tiến triển.</string>
|
||||
<string name="bnet_dl_agent_error">Lỗi Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard không thể truy cập thư mục trò chơi (lỗi 703). Hãy kiểm tra quyền hoặc chọn một thư mục khác.</string>
|
||||
<string name="bnet_update">Cập nhật</string>
|
||||
<string name="bnet_store">Trò chơi Blizzard</string>
|
||||
<string name="stores_resume_install">Tiếp tục cài</string>
|
||||
|
||||
@@ -2606,6 +2606,7 @@
|
||||
<string name="bnet_dl_failed">暴雪下载器已停止:%1$s</string>
|
||||
<string name="bnet_dl_stalled">暴雪下载器已停止进展。</string>
|
||||
<string name="bnet_dl_agent_error">暴雪错误 %1$s</string>
|
||||
<string name="bnet_dl_folder_access">暴雪无法访问游戏文件夹(错误 703)。请检查其权限或选择其他文件夹。</string>
|
||||
<string name="bnet_update">更新</string>
|
||||
<string name="bnet_store">暴雪游戏</string>
|
||||
<string name="stores_resume_install">继续安装</string>
|
||||
|
||||
@@ -2526,6 +2526,7 @@
|
||||
<string name="bnet_dl_failed">暴雪下載器已停止:%1$s</string>
|
||||
<string name="bnet_dl_stalled">暴雪下載器已停止進展。</string>
|
||||
<string name="bnet_dl_agent_error">暴雪錯誤 %1$s</string>
|
||||
<string name="bnet_dl_folder_access">暴雪無法存取遊戲資料夾(錯誤 703)。請檢查其權限或選擇其他資料夾。</string>
|
||||
<string name="bnet_update">更新</string>
|
||||
<string name="bnet_store">Blizzard 遊戲</string>
|
||||
<string name="stores_resume_install">繼續安裝</string>
|
||||
|
||||
@@ -2526,6 +2526,7 @@
|
||||
<string name="bnet_dl_failed">暴雪下載器已停止:%1$s</string>
|
||||
<string name="bnet_dl_stalled">暴雪下載器已停止進度。</string>
|
||||
<string name="bnet_dl_agent_error">暴雪錯誤 %1$s</string>
|
||||
<string name="bnet_dl_folder_access">暴雪無法存取遊戲資料夾(錯誤 703)。請檢查其權限或選擇其他資料夾。</string>
|
||||
<string name="bnet_update">更新</string>
|
||||
<string name="bnet_store">Blizzard 遊戲</string>
|
||||
<string name="stores_resume_install">繼續安裝</string>
|
||||
|
||||
@@ -2863,6 +2863,7 @@
|
||||
<string name="bnet_dl_failed">Blizzard\'s downloader stopped: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzard\'s downloader stopped making progress.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard error %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard could not access the game folder (error 703). Check its permissions or choose a different folder.</string>
|
||||
<string name="bnet_update">Update</string>
|
||||
<string name="bnet_store">Blizzard games</string>
|
||||
<string name="stores_resume_install">Resume install</string>
|
||||
|
||||
@@ -50,4 +50,28 @@ class MaliAutoRouteTest {
|
||||
assertTrue(MaliAutoRoute.userChoice(true, MaliAutoRoute.VENUS, MaliAutoRoute.BRIDGE))
|
||||
assertFalse(MaliAutoRoute.userChoice(false, MaliAutoRoute.NONE, MaliAutoRoute.BRIDGE))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun venusTheUserSwitchedOffIsNotSwitchedBackOn() {
|
||||
assertFalse(MaliAutoRoute.venusStandsIn(true, true, false, true, "Mali-G715"))
|
||||
assertTrue(MaliAutoRoute.venusStandsIn(true, true, true, true, "Mali-G2-Ultra-NX MC12"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun venusIsAutosStandInOnlyWhereSteamStartsThroughIt() {
|
||||
assertTrue(MaliAutoRoute.venusStandsIn(true, true, false, false, "Mali-G715"))
|
||||
assertFalse(MaliAutoRoute.venusStandsIn(true, true, false, false, "Mali-G2-Ultra-NX MC12"))
|
||||
assertFalse(MaliAutoRoute.venusStandsIn(true, true, true, false, "Mali-G2-Ultra-NX MC16"))
|
||||
assertFalse(MaliAutoRoute.venusStandsIn(false, true, true, true, "Mali-G715"))
|
||||
assertFalse(MaliAutoRoute.venusStandsIn(true, false, true, true, "Mali-G715"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun venusThatAutoTurnedOffIsStillAutosToTurnOn() {
|
||||
// Auto clears the stored key when it moves to the bridge: a stored "off" would read as the user's own choice.
|
||||
val cleared = MaliAutoRoute.userChoice(keyStored = false, owner = MaliAutoRoute.BRIDGE, route = MaliAutoRoute.VENUS)
|
||||
val writtenOff = MaliAutoRoute.userChoice(keyStored = true, owner = MaliAutoRoute.BRIDGE, route = MaliAutoRoute.VENUS)
|
||||
assertTrue(MaliAutoRoute.venusStandsIn(true, true, false, cleared, "Mali-G715"))
|
||||
assertFalse(MaliAutoRoute.venusStandsIn(true, true, false, writtenOff, "Mali-G715"))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.droiddeck.launcher
|
||||
|
||||
import com.droiddeck.launcher.gpu.SteamVr.Status
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class QuestSteamVrWatchTest {
|
||||
@Test
|
||||
fun steamVrThatNeverStartsFailsAfterTheStartupWindow() {
|
||||
val watch = QuestSteamVrWatch(0)
|
||||
assertFalse(watch.stopped(29_999, Status.READY, paused = false))
|
||||
assertTrue(watch.stopped(30_000, Status.READY, paused = false))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun steamVrThatStopsFailsAfterTheRunningGrace() {
|
||||
val watch = QuestSteamVrWatch(0)
|
||||
assertFalse(watch.stopped(10_000, Status.RUNNING, paused = false))
|
||||
assertFalse(watch.stopped(14_999, Status.UNAVAILABLE, paused = false))
|
||||
assertTrue(watch.stopped(15_000, Status.UNAVAILABLE, paused = false))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aFrozenGuestNeverCountsAsStopped() {
|
||||
val watch = QuestSteamVrWatch(0)
|
||||
assertFalse(watch.stopped(10_000, Status.RUNNING, paused = false))
|
||||
for (now in 11_000L..600_000L step 10_000) assertFalse(watch.stopped(now, Status.UNAVAILABLE, paused = true))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aResumedGuestGetsTheFullGraceFromItsFirstAnswerAfterTheFreeze() {
|
||||
val watch = QuestSteamVrWatch(0)
|
||||
watch.stopped(10_000, Status.RUNNING, paused = false)
|
||||
watch.stopped(300_000, Status.UNAVAILABLE, paused = true)
|
||||
assertFalse(watch.stopped(310_000, Status.UNAVAILABLE, paused = false))
|
||||
assertFalse(watch.stopped(324_999, Status.UNAVAILABLE, paused = false))
|
||||
assertTrue(watch.stopped(325_000, Status.UNAVAILABLE, paused = false))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun steamVrAnsweringAfterAResumeKeepsTheSessionOpen() {
|
||||
val watch = QuestSteamVrWatch(0)
|
||||
watch.stopped(10_000, Status.RUNNING, paused = false)
|
||||
watch.stopped(300_000, Status.UNAVAILABLE, paused = true)
|
||||
assertFalse(watch.stopped(312_000, Status.RUNNING, paused = false))
|
||||
assertFalse(watch.stopped(316_999, Status.UNAVAILABLE, paused = false))
|
||||
assertTrue(watch.stopped(317_000, Status.UNAVAILABLE, paused = false))
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,24 @@ class GameEnvironmentTest {
|
||||
assertEquals("1", GameEnvironment.effective(config, "", "43", forceSsbs = true)[GameEnvironment.FORCE_SSBS])
|
||||
}
|
||||
|
||||
@Test fun knownGameFixesBeatSharedSettingsButNotTheGamesOwn() {
|
||||
val shared = GameEnvironment.Config(shared = mapOf("FEX_X87REDUCEDPRECISION" to "1"))
|
||||
assertEquals("0", GameEnvironment.effective(shared, "PERFORMANCE_TSO", "12100")["FEX_X87REDUCEDPRECISION"])
|
||||
assertEquals("1", GameEnvironment.effective(shared, "PERFORMANCE_TSO", "12110")["FEX_X87REDUCEDPRECISION"])
|
||||
val own = shared.withEntries("12100", mapOf("FEX_X87REDUCEDPRECISION" to "1"))
|
||||
assertEquals("1", GameEnvironment.effective(own, "PERFORMANCE_TSO", "12100")["FEX_X87REDUCEDPRECISION"])
|
||||
assertEquals("1", GameEnvironment.withKnownGames(own).games["12100"]?.get("FEX_X87REDUCEDPRECISION"))
|
||||
assertEquals("0", GameEnvironment.withKnownGames(shared).games["12100"]?.get("FEX_X87REDUCEDPRECISION"))
|
||||
}
|
||||
|
||||
@Test fun aGamePresetKeepsTheGamesKnownFix() {
|
||||
val picked = GameEnvironment.withGameFexPreset(GameEnvironment.Config(), "12100", "PERFORMANCE")
|
||||
assertEquals("0", GameEnvironment.effective(picked, "PERFORMANCE_TSO", "12100")["FEX_X87REDUCEDPRECISION"])
|
||||
assertEquals("PERFORMANCE", GameEnvironment.gameFexPreset(picked, "12100"))
|
||||
val other = GameEnvironment.withGameFexPreset(GameEnvironment.Config(), "12110", "PERFORMANCE")
|
||||
assertEquals("1", GameEnvironment.effective(other, "PERFORMANCE_TSO", "12110")["FEX_X87REDUCEDPRECISION"])
|
||||
}
|
||||
|
||||
@Test fun gameOverridesSharedAndPresetWithoutLeakingToOtherGames() {
|
||||
val config = GameEnvironment.Config(
|
||||
shared = mapOf("FEX_MULTIBLOCK" to "0", "VKD3D_FEATURE_LEVEL" to "12_2"),
|
||||
|
||||
@@ -21,4 +21,20 @@ class AllFilesAccessTest {
|
||||
assertTrue(AllFilesAccess.missing(sdk = 35) { false })
|
||||
assertFalse(AllFilesAccess.missing(sdk = 35) { true })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun onlySharedStorageNeedsIt() {
|
||||
assertTrue(AllFilesAccess.covers("/storage/emulated/0"))
|
||||
assertTrue(AllFilesAccess.covers("/storage/1A2B-3C4D/Games"))
|
||||
assertTrue(AllFilesAccess.covers("/sdcard/Download"))
|
||||
assertFalse(AllFilesAccess.covers("/storage/emulated/0/Android/data"))
|
||||
assertFalse(AllFilesAccess.covers("/storage/1A2B-3C4D/Android/obb"))
|
||||
assertTrue(AllFilesAccess.covers("/storage/emulated/0/Android"))
|
||||
assertTrue(AllFilesAccess.covers("/storage/emulated/0/Android/database"))
|
||||
assertTrue(AllFilesAccess.covers("/storage/emulated/0/Download/Android/data"))
|
||||
assertTrue(AllFilesAccess.covers("/storage/1A2B-3C4D/Games/Android/obb/x"))
|
||||
assertFalse(AllFilesAccess.covers("/storage/emulated/0/Android/data/com.droiddeck.launcher/files"))
|
||||
assertFalse(AllFilesAccess.covers("/storage/1A2B-3C4D/Android/obb/com.droiddeck.launcher"))
|
||||
assertFalse(AllFilesAccess.covers("/data/user/0/com.droiddeck.launcher/files"))
|
||||
}
|
||||
}
|
||||
@@ -259,7 +259,7 @@ class PadPartialAxesTest {
|
||||
}
|
||||
|
||||
@Test fun keyTriggerDecision() {
|
||||
val held = BooleanArray(2)
|
||||
val held = PadBridge.TriggerKey.slots(1)[0]
|
||||
assertEquals(1f, PadBridge.keyTrigger(0f, true, 0, false, held, 0))
|
||||
assertEquals(0f, PadBridge.keyTrigger(1f, false, 0, false, held, 0))
|
||||
assertEquals(0.25f, PadBridge.keyTrigger(0.25f, true, 1, false, held, 0))
|
||||
@@ -271,6 +271,64 @@ class PadPartialAxesTest {
|
||||
assertEquals(0f, PadBridge.axisTrigger(0f, held, 1))
|
||||
}
|
||||
|
||||
@Test fun keyBeforeAxisOnAFullPullIsOnePress() {
|
||||
val device = device(MotionEvent.AXIS_GAS)
|
||||
motion(device)
|
||||
key(device, KeyEvent.KEYCODE_BUTTON_R2)
|
||||
assertEquals(1f, pad().rightTrigger)
|
||||
for (value in listOf(0.1f, 0.3f, 0.6f, 1f, 0.98f)) {
|
||||
motion(device, MotionEvent.AXIS_GAS to value)
|
||||
assertEquals(1f, pad().rightTrigger)
|
||||
}
|
||||
motion(device, MotionEvent.AXIS_GAS to 0.7f)
|
||||
assertEquals(0.7f, pad().rightTrigger)
|
||||
key(device, KeyEvent.KEYCODE_BUTTON_R2, KeyEvent.ACTION_UP)
|
||||
assertEquals(0.7f, pad().rightTrigger)
|
||||
motion(device, MotionEvent.AXIS_GAS to 0f)
|
||||
assertEquals(0f, pad().rightTrigger)
|
||||
}
|
||||
|
||||
@Test fun releasingDuringTheHandoffFollowsTheAxis() {
|
||||
val device = device(MotionEvent.AXIS_GAS)
|
||||
motion(device)
|
||||
key(device, KeyEvent.KEYCODE_BUTTON_R2)
|
||||
motion(device, MotionEvent.AXIS_GAS to 0.4f)
|
||||
assertEquals(1f, pad().rightTrigger)
|
||||
key(device, KeyEvent.KEYCODE_BUTTON_R2, KeyEvent.ACTION_UP)
|
||||
assertEquals(0.4f, pad().rightTrigger)
|
||||
}
|
||||
|
||||
@Test fun movingTriggerAxisStaysAnalogWhenItsKeyFiresFirst() {
|
||||
val device = device(MotionEvent.AXIS_GAS)
|
||||
motion(device, MotionEvent.AXIS_GAS to 0.5f)
|
||||
motion(device, MotionEvent.AXIS_GAS to 0f)
|
||||
key(device, KeyEvent.KEYCODE_BUTTON_R2)
|
||||
assertEquals(0f, pad().rightTrigger)
|
||||
motion(device, MotionEvent.AXIS_GAS to 0.1f)
|
||||
assertEquals(0.1f, pad().rightTrigger)
|
||||
motion(device, MotionEvent.AXIS_GAS to 0.35f)
|
||||
assertEquals(0.35f, pad().rightTrigger)
|
||||
key(device, KeyEvent.KEYCODE_BUTTON_R2, KeyEvent.ACTION_UP)
|
||||
motion(device, MotionEvent.AXIS_GAS to 0f)
|
||||
assertEquals(0f, pad().rightTrigger)
|
||||
}
|
||||
|
||||
@Test fun triggerSwitchedToDigitalPressesAgainAfterOneSilentPress() {
|
||||
val device = device(MotionEvent.AXIS_GAS)
|
||||
motion(device, MotionEvent.AXIS_GAS to 0.5f)
|
||||
motion(device, MotionEvent.AXIS_GAS to 0f)
|
||||
key(device, KeyEvent.KEYCODE_BUTTON_R2)
|
||||
motion(device)
|
||||
key(device, KeyEvent.KEYCODE_BUTTON_R2, KeyEvent.ACTION_UP)
|
||||
assertEquals(0f, pad().rightTrigger)
|
||||
key(device, KeyEvent.KEYCODE_BUTTON_R2)
|
||||
assertEquals(1f, pad().rightTrigger)
|
||||
motion(device)
|
||||
assertEquals(1f, pad().rightTrigger)
|
||||
key(device, KeyEvent.KEYCODE_BUTTON_R2, KeyEvent.ACTION_UP)
|
||||
assertEquals(0f, pad().rightTrigger)
|
||||
}
|
||||
|
||||
@Test fun silentTriggerAxesLetTheirKeysPress() {
|
||||
val device = device(MotionEvent.AXIS_LTRIGGER, MotionEvent.AXIS_RTRIGGER)
|
||||
motion(device)
|
||||
@@ -294,11 +352,15 @@ class PadPartialAxesTest {
|
||||
key(device, KeyEvent.KEYCODE_BUTTON_L2)
|
||||
assertEquals(1f, pad().leftTrigger)
|
||||
motion(device, MotionEvent.AXIS_LTRIGGER to 0.4f)
|
||||
assertEquals(0.4f, pad().leftTrigger)
|
||||
assertEquals(1f, pad().leftTrigger)
|
||||
motion(device, MotionEvent.AXIS_LTRIGGER to 0f)
|
||||
assertEquals(0f, pad().leftTrigger)
|
||||
key(device, KeyEvent.KEYCODE_BUTTON_L2, KeyEvent.ACTION_UP)
|
||||
assertEquals(0f, pad().leftTrigger)
|
||||
key(device, KeyEvent.KEYCODE_BUTTON_L2)
|
||||
assertEquals(0f, pad().leftTrigger)
|
||||
motion(device, MotionEvent.AXIS_LTRIGGER to 0.4f)
|
||||
assertEquals(0.4f, pad().leftTrigger)
|
||||
}
|
||||
|
||||
private fun pad(): PadState = requireNotNull(JoyConPadTest.RecordingWriter.pads[0])
|
||||
|
||||
@@ -188,4 +188,57 @@ class LinuxNetworkLinkComponentTest {
|
||||
ReflectionHelpers.callInstanceMethod<Unit>(component, "replace", from(java.io.File::class.java, file), from(String::class.java, "nameserver 8.8.8.8\n"))
|
||||
assertEquals("nameserver 8.8.8.8\n", file.readText())
|
||||
}
|
||||
|
||||
private val telemetryLine = "0.0.0.0 " + LinuxNetworkLinkComponent.UNITY_TELEMETRY_HOSTS.joinToString(" ")
|
||||
|
||||
@Test
|
||||
fun newHostsFileHasLocalhostAndRefusesUnityTelemetry() {
|
||||
val text = LinuxNetworkLinkComponent.hostsText(null)
|
||||
assertTrue(text.startsWith("127.0.0.1 localhost\n::1 localhost\n"))
|
||||
assertTrue(text.contains("$telemetryLine\n"))
|
||||
assertTrue("stats.unity3d.com" in LinuxNetworkLinkComponent.UNITY_TELEMETRY_HOSTS)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hostsKeepsTheUsersLinesAndWritesTheBlockOnce() {
|
||||
val user = "127.0.0.1 localhost\n::1 localhost\n10.0.0.5 nas.lan\n"
|
||||
val once = LinuxNetworkLinkComponent.hostsText(user)
|
||||
assertTrue(once.startsWith(user))
|
||||
assertEquals(once, LinuxNetworkLinkComponent.hostsText(once))
|
||||
assertEquals(1, once.lines().count { it == telemetryLine })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hostsReplacesAnOlderBlockWithTheCurrentList() {
|
||||
val old = "127.0.0.1 localhost\n# DroidDeck: Unity telemetry is refused (start)\n0.0.0.0 old.example\n" +
|
||||
"# DroidDeck: Unity telemetry is refused (end)\n10.0.0.5 nas.lan\n"
|
||||
val text = LinuxNetworkLinkComponent.hostsText(old)
|
||||
assertFalse(text.contains("old.example"))
|
||||
assertTrue(text.contains("10.0.0.5 nas.lan\n"))
|
||||
assertTrue(text.contains("$telemetryLine\n"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hostsKeepsTheUsersLinesAfterAStartMarkerWithoutAnEnd() {
|
||||
val broken = "127.0.0.1 localhost\n# DroidDeck: Unity telemetry is refused (start)\n10.0.0.5 nas.lan\n"
|
||||
val once = LinuxNetworkLinkComponent.hostsText(broken)
|
||||
assertTrue(once.contains("10.0.0.5 nas.lan\n"))
|
||||
assertEquals(1, once.lines().count { it == "# DroidDeck: Unity telemetry is refused (start)" })
|
||||
val twice = LinuxNetworkLinkComponent.hostsText(once)
|
||||
assertTrue(twice.contains("10.0.0.5 nas.lan\n"))
|
||||
assertEquals(once, twice)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hostsDropsAStrayEndMarker() {
|
||||
val text = LinuxNetworkLinkComponent.hostsText("127.0.0.1 localhost\n# DroidDeck: Unity telemetry is refused (end)\n10.0.0.5 nas.lan\n")
|
||||
assertTrue(text.startsWith("127.0.0.1 localhost\n10.0.0.5 nas.lan\n"))
|
||||
assertEquals(1, text.lines().count { it == "# DroidDeck: Unity telemetry is refused (end)" })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hostsAddsLocalhostOnlyWhenItIsMissing() {
|
||||
assertTrue(LinuxNetworkLinkComponent.hostsText("10.0.0.5 nas.lan\n").startsWith("127.0.0.1 localhost\n::1 localhost\n10.0.0.5 nas.lan\n"))
|
||||
assertEquals(1, LinuxNetworkLinkComponent.hostsText("127.0.0.1 localhost\n").lines().count { "localhost" in it })
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.droiddeck.launcher.runtime
|
||||
|
||||
import androidx.test.core.app.ApplicationProvider
|
||||
import java.io.File
|
||||
import java.nio.ByteBuffer
|
||||
import java.nio.ByteOrder
|
||||
import java.nio.file.Files
|
||||
import org.junit.After
|
||||
import org.junit.Assert.assertArrayEquals
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
class NativeGuestPrepareTest {
|
||||
private val svc = 0xd4000001.toInt()
|
||||
private val rseq = 0xd28024a8.toInt()
|
||||
private val enosys = 0x928004a0.toInt()
|
||||
|
||||
private fun unpatchedLoader(): ByteArray {
|
||||
val data = ByteArray(0x200)
|
||||
val b = ByteBuffer.wrap(data).order(ByteOrder.LITTLE_ENDIAN)
|
||||
b.put(0, 0x7f); b.put(1, 'E'.code.toByte()); b.put(2, 'L'.code.toByte()); b.put(3, 'F'.code.toByte())
|
||||
b.put(4, 2); b.put(5, 1)
|
||||
b.putShort(18, 183)
|
||||
b.putLong(32, 64)
|
||||
b.putShort(54, 56); b.putShort(56, 1)
|
||||
b.putInt(64, 1); b.putInt(68, 5)
|
||||
b.putLong(72, 0x100); b.putLong(96, 0x100)
|
||||
b.putInt(0x100, rseq); b.putInt(0x104, svc)
|
||||
return data
|
||||
}
|
||||
|
||||
private fun rootWithUnpatchedLoader(): Pair<File, File> {
|
||||
val root = Files.createTempDirectory("native-prepare").toFile()
|
||||
val loader = File(root, "usr/lib/ld-linux-aarch64.so.1")
|
||||
loader.parentFile!!.mkdirs()
|
||||
loader.writeBytes(unpatchedLoader())
|
||||
return root to loader
|
||||
}
|
||||
|
||||
private fun instructionAfterRseq(loader: File): Int =
|
||||
ByteBuffer.wrap(loader.readBytes()).order(ByteOrder.LITTLE_ENDIAN).getInt(0x104)
|
||||
|
||||
@After
|
||||
fun endSession() {
|
||||
NativeGuest.sessionMode = null
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aProgramStartedOutsideASessionGetsALoaderThatSurvivesSeccomp() {
|
||||
val (root, loader) = rootWithUnpatchedLoader()
|
||||
NativeGuest.sessionMode = null
|
||||
NativeGuest.processBuilder(ApplicationProvider.getApplicationContext(), root, emptyList(), listOf("/usr/bin/true"))
|
||||
assertEquals(enosys, instructionAfterRseq(loader))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aProgramStartedInARunningSessionLeavesTheRootfsAsTheSessionPreparedIt() {
|
||||
val (root, loader) = rootWithUnpatchedLoader()
|
||||
val before = loader.readBytes()
|
||||
NativeGuest.sessionMode = true
|
||||
NativeGuest.processBuilder(ApplicationProvider.getApplicationContext(), root, emptyList(), listOf("/usr/bin/true"))
|
||||
assertArrayEquals(before, loader.readBytes())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun anAlreadyPreparedLoaderIsNotRewritten() {
|
||||
val (root, loader) = rootWithUnpatchedLoader()
|
||||
NativeGuest.processBuilder(ApplicationProvider.getApplicationContext(), root, emptyList(), listOf("/usr/bin/true"))
|
||||
val modified = loader.lastModified()
|
||||
val bytes = loader.readBytes()
|
||||
loader.setLastModified(modified - 10_000)
|
||||
NativeGuest.processBuilder(ApplicationProvider.getApplicationContext(), root, emptyList(), listOf("/usr/bin/true"))
|
||||
assertArrayEquals(bytes, loader.readBytes())
|
||||
assertEquals(modified - 10_000, loader.lastModified())
|
||||
}
|
||||
}
|
||||
@@ -202,11 +202,19 @@ class GameEnvironmentStoreTest {
|
||||
assertEquals("false", published.shared["MESA_SHADER_CACHE_DISABLE"])
|
||||
assertFalse(published.shared.containsKey("VKD3D_FEATURE_LEVEL"))
|
||||
assertFalse(published.shared.containsKey("VKD3D_SHADER_MODEL"))
|
||||
assertEquals(config.games, published.games)
|
||||
assertEquals(config.games + GameEnvironment.knownGames, published.games)
|
||||
assertEquals(config.shared["LITERAL"], published.shared["LITERAL"])
|
||||
assertEquals("", published.shared["EMPTY"])
|
||||
}
|
||||
|
||||
@Test fun aKnownGamesFixReachesTheGuestWithoutBeingSavedAsTheUsersSetting() {
|
||||
GameEnvironmentStore.save(context, GameEnvironment.Config())
|
||||
assertEquals(emptyMap<String, Map<String, String?>>(), GameEnvironmentStore.read(context).games)
|
||||
val published = GameEnvironmentStore.decode(JSONObject(guest.readText()))
|
||||
assertEquals(GameEnvironment.knownGames, published.games)
|
||||
assertEquals("0", published.entries("12100")["FEX_X87REDUCEDPRECISION"])
|
||||
}
|
||||
|
||||
@Test fun publishingPreservesExplicitSharedGraphicsCapabilities() {
|
||||
val config = GameEnvironment.Config(shared = mapOf(
|
||||
"VKD3D_FEATURE_LEVEL" to "12_1", "VKD3D_SHADER_MODEL" to "6_6",
|
||||
@@ -266,7 +274,7 @@ class GameEnvironmentStoreTest {
|
||||
assertEquals(original.entries("43"), saved.entries("43"))
|
||||
assertEquals("PERFORMANCE_TSO", SessionPrefs.fexPreset(context))
|
||||
val published = GameEnvironmentStore.decode(JSONObject(guest.readText()))
|
||||
assertEquals(saved.games, published.games)
|
||||
assertEquals(saved.games + GameEnvironment.knownGames, published.games)
|
||||
assertEquals("0", published.shared["FEX_HALFBARRIERTSOENABLED"])
|
||||
assertEquals("1", published.entries("42")["FEX_HALFBARRIERTSOENABLED"])
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.droiddeck.launcher.stores.steam
|
||||
|
||||
import androidx.compose.runtime.State
|
||||
import androidx.compose.runtime.snapshots.Snapshot
|
||||
import androidx.compose.runtime.snapshots.StateObject
|
||||
import com.droiddeck.launcher.stores.StoresState
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [33], manifest = Config.NONE)
|
||||
class SteamPickingSnapshotTest {
|
||||
@Test
|
||||
fun theInstallPickerIsReadableInASnapshotOpenedBeforeTheSteamEngineStarts() {
|
||||
StoresState.steamPicking = null
|
||||
val snapshot = Snapshot.takeMutableSnapshot()
|
||||
try {
|
||||
thread { SteamStore.hashCode() }.join()
|
||||
assertNull(snapshot.enter { StoresState.steamPicking })
|
||||
} finally {
|
||||
snapshot.dispose()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theSteamEngineHoldsNoComposeState() {
|
||||
val stateFields = SteamStore::class.java.declaredFields.filter {
|
||||
StateObject::class.java.isAssignableFrom(it.type) || State::class.java.isAssignableFrom(it.type)
|
||||
}
|
||||
assertTrue(stateFields.joinToString { it.name }, stateFields.isEmpty())
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,34 @@ class XboxManifestTest {
|
||||
java.io.File(root, "MicrosoftGame.Config").writeText("<Game><ExecutableList><Executable Name=\"bin\\GAME.EXE\" TargetDeviceFamily=\"PC\"/></ExecutableList></Game>")
|
||||
assertEquals("Bin/Game.exe", XboxInstaller.executable(root))
|
||||
}
|
||||
@Test fun aListedExecutableThePackageDoesNotShipFallsThroughToTheNextOne() {
|
||||
val root = temporary.newFolder()
|
||||
java.io.File(root, "bin/x64_dx12").mkdirs()
|
||||
java.io.File(root, "bin/x64_dx12/game.exe").writeText("encrypted")
|
||||
java.io.File(root, "MicrosoftGame.config").writeText("<Game><ExecutableList>" +
|
||||
"<Executable Name=\"bin\\x64\\game.exe\" TargetDeviceFamily=\"PC\"/>" +
|
||||
"<Executable Name=\"Launcher\\start.exe\" TargetDeviceFamily=\"PC\"/>" +
|
||||
"<Executable Name=\"bin\\x64_dx12\\game.exe\" TargetDeviceFamily=\"PC\"/></ExecutableList></Game>")
|
||||
assertEquals("bin/x64_dx12/game.exe", XboxInstaller.executable(root))
|
||||
}
|
||||
@Test fun anAmbiguouslyCasedExecutableFallsThroughToTheNextOne() {
|
||||
val root = temporary.newFolder()
|
||||
java.io.File(root, "Game.exe").writeText("one")
|
||||
java.io.File(root, "GAME.exe").writeText("two")
|
||||
java.io.File(root, "Other.exe").writeText("three")
|
||||
org.junit.Assume.assumeTrue(root.listFiles().orEmpty().count { it.name.equals("game.exe", true) } == 2)
|
||||
java.io.File(root, "MicrosoftGame.config").writeText("<Game><ExecutableList>" +
|
||||
"<Executable Name=\"game.exe\"/><Executable Name=\"Other.exe\"/></ExecutableList></Game>")
|
||||
assertEquals("Other.exe", XboxInstaller.executable(root))
|
||||
}
|
||||
@Test fun aPackageWithNoneOfItsListedExecutablesStillFails() {
|
||||
val root = temporary.newFolder()
|
||||
java.io.File(root, "Unlisted.exe").writeText("encrypted")
|
||||
java.io.File(root, "MicrosoftGame.config").writeText("<Game><ExecutableList>" +
|
||||
"<Executable Name=\"bin\\Game.exe\"/><Executable Name=\"Game.exe\"/></ExecutableList></Game>")
|
||||
val failure = assertThrows(IllegalArgumentException::class.java) { XboxInstaller.executable(root) }
|
||||
assertEquals("Missing or ambiguous Xbox launch path.", failure.message)
|
||||
}
|
||||
@Test fun aLauncherMenuIsSkippedForTheProgramItNames() {
|
||||
val root = temporary.newFolder()
|
||||
java.io.File(root, "EmuMenu").mkdir()
|
||||
|
||||
@@ -9,6 +9,25 @@ import org.junit.Test
|
||||
class XodusDiagnosticsTest {
|
||||
private val rejected = Regex(Xodus.SIGN_IN_REJECTED)
|
||||
|
||||
@Test fun aDeviceLimitReachesTheInstallerWithoutBecomingASignInFailure() {
|
||||
val line = "NEXUS_CONTENT_LICENSE_DIAGNOSTIC_V1 content-device-limit 200"
|
||||
val tail = listOf(line).filter { it.matches(Xodus.reportable) }
|
||||
assertEquals(listOf(line), tail)
|
||||
assertFalse(line.matches(rejected))
|
||||
assertEquals(com.droiddeck.launcher.R.string.stores_xbox_device_group_full, XboxInstaller.licenseRefusal(tail))
|
||||
}
|
||||
|
||||
@Test fun aLaterLicenseSuccessClearsTheDeviceLimitThroughTheDiagnosticFilter() {
|
||||
val stderr = listOf(
|
||||
"NEXUS_CONTENT_LICENSE_DIAGNOSTIC_V1 content-device-limit 200",
|
||||
"NEXUS_CONTENT_LICENSE_DIAGNOSTIC_V1 content-parsed 200",
|
||||
"NEXUS_EXTRACT_DIAGNOSTIC_V1 extract-failed"
|
||||
)
|
||||
val tail = stderr.filter { it.matches(Xodus.reportable) }
|
||||
assertEquals(stderr, tail)
|
||||
assertNull(XboxInstaller.licenseRefusal(tail))
|
||||
}
|
||||
|
||||
@Test fun aContentLicenseRejectionIsRecognised() {
|
||||
assertTrue("Microsoft content licensing rejected sign-in (HTTP 401). Sign in again in Settings.".matches(rejected))
|
||||
}
|
||||
|
||||
@@ -122,6 +122,19 @@ class LibraryEntriesTest {
|
||||
assertEquals(listOf("steam", "xbox", "itch", "gamejolt"), librarySources(entries, listOf("xbox", "itch", "gamejolt"), setOf("itch", "gamejolt")))
|
||||
}
|
||||
|
||||
@Test fun everySignedInStoreKeepsItsTabWhenItsLibraryIsEmptyOrFailedToLoad() {
|
||||
val entries = listOf(LibraryEntry("epic:1", "epic", "Game", null, null, true))
|
||||
val order = listOf("epic", Store.ROCKSTAR.id, "gog")
|
||||
val always = alwaysLibraryTabs(listOf(Store.STEAM, Store.ROCKSTAR), stores = true, soundMode = false)
|
||||
assertEquals(listOf("steam", "epic", "rockstar", "battlenet", "added"), librarySources(entries, order, always))
|
||||
}
|
||||
|
||||
@Test fun signedOutStoresAndSoundtrackModeDoNotGainEmptyTabs() {
|
||||
assertEquals(setOf("added", "battlenet"), alwaysLibraryTabs(emptyList(), stores = true, soundMode = false))
|
||||
assertEquals(setOf("added", "battlenet"), alwaysLibraryTabs(listOf(Store.STEAM, Store.ROCKSTAR), stores = true, soundMode = true))
|
||||
assertEquals(emptySet<String>(), alwaysLibraryTabs(emptyList(), stores = false, soundMode = false))
|
||||
}
|
||||
|
||||
@Test fun gameKeysNameEitherAnAppOrAStoreProduct() {
|
||||
GameRef.parse("app:440").let { assertEquals(440, it.appId); assertNull(it.store) }
|
||||
GameRef.parse("app:-12").let { assertEquals(-12, it.appId) }
|
||||
|
||||
@@ -193,6 +193,15 @@ A Unity game under FEX (`UnityPlayer.dll` for Windows builds under Proton,
|
||||
turns it off: without TSO such games can deadlock or crash (seen with Megabonk
|
||||
and Crab Game). A FEX preset chosen for the game itself still applies.
|
||||
|
||||
An Inno Setup installer added as a game runs with the Stability preset's FEX
|
||||
settings (full TSO, full x87 precision, no multiblock). Under the default
|
||||
Performance + TSO preset the 32-bit setup stub corrupts its own paths and stops
|
||||
with Wine's "Path not fpund." dialog (#1277, #3067). The stub is found by the
|
||||
setup loader's offset-table ID in its resources, or by the `Inno` marker that
|
||||
loaders older than 5.1.5 keep at offset 0x30. GOG installs avoid the stub by
|
||||
extracting natively. A FEX preset chosen for the installer's own entry still
|
||||
applies.
|
||||
|
||||
Games launched through Proton get `vblank_mode=0`, so OpenGL does not wait for
|
||||
each screen refresh. Wine asks for a swap interval of 1 on every OpenGL window, and WineD3D's front-buffer
|
||||
drawing (DirectDraw, Direct3D 1–7) never lowers it, so those games ran at the
|
||||
|
||||
@@ -150,6 +150,19 @@ The SPIR-V version the driver gets:
|
||||
- This is what Dawn ("Disable SPIR-V 1.4 on Android ARM"), ANGLE (`supportsSPIRV14`) and naga
|
||||
(`AVOID_SPIRV_COPY_LOGICAL`) do for a proprietary compiler they cannot trust.
|
||||
|
||||
Geometry shaders:
|
||||
- The Mali-G610's driver (r38p1) crashes compiling Zink's geometry shaders, always at the same
|
||||
place (SIGSEGV at 0x40 in `cmpbe_v2_compile_multiple_shaders`): its shader for `GL_QUADS`, and
|
||||
a GLSL geometry shader that only passes triangles on.
|
||||
- A geometry shader that only passes triangles on, from a plain Vulkan program, does not crash it
|
||||
but draws nothing, in SPIR-V 1.0, 1.3 and 1.6, with and without the layer.
|
||||
- Zink writes them in SPIR-V 1.6 with the Vulkan memory model, which the version cap leaves alone.
|
||||
Lowering them would not help, since the plain shader draws nothing at 1.0 and 1.3 either.
|
||||
- On ARM GPUs the layer reports no `geometryShader` to Zink (engine name `mesa zink`). Mesa then
|
||||
splits quads into triangles itself, and Zink still offers OpenGL 3.2. DXVK keeps the feature: it
|
||||
needs it for D3D10 and 11.
|
||||
- `DROIDDECK_MALI_COMPAT_NO_GS=0` keeps the feature for Zink, `=1` hides it from every application.
|
||||
|
||||
Files:
|
||||
- `layer.c`: loader plumbing, feature and limit reporting, device creation, the hook table.
|
||||
- `pipeline.c`: pipelines, shader modules, viewports.
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Name=Return to Gaming Mode
|
||||
Comment=Log out of the desktop and go back to Steam
|
||||
Exec=dbus-send --session --type=method_call --dest=org.kde.Shutdown /Shutdown org.kde.Shutdown.logout
|
||||
Icon=steamdeck-gaming-return
|
||||
Terminal=false
|
||||
Type=Application
|
||||
StartupNotify=false
|
||||
NoDisplay=true
|
||||
@@ -474,3 +474,13 @@ Short strokes never released it, and taps kept landing at the relative pointer i
|
||||
counts its touch-down warps, and a frame that contains one is left out of the hold decision. Touch drags, mouse motion
|
||||
and mouse warps still count, so a drag on a game that follows the pointer releases the hold and a recentring game is
|
||||
still held. `tools/tests/test_gamescope_pointer_hold_touch_down.py` compiles the rule with the 0133 rule.
|
||||
|
||||
## 0146 rendervulkan: composite only into output images the display has finished scanning out
|
||||
|
||||
The host compositor now releases a zero-copy display buffer as soon as the display latches the next one, and attaches
|
||||
the display's release fence to the buffer's dma-buf instead of waiting for it on the CPU. That wait had held every
|
||||
release back by about one refresh, so a chain of three buffers ran at two thirds of the refresh rate. KGSL Turnip does
|
||||
not wait on fences attached to a dma-buf, so the composite now checks each output image's dma-buf with `poll(POLLOUT)`.
|
||||
It picks the next image that is neither held by the host nor still being scanned out. Only when every free image is
|
||||
still on the display does it wait for one, up to 100 ms. On kernels that cannot attach the fence, the host keeps
|
||||
waiting itself and nothing changes. `tools/gamescope/tests/nested-swapchain.cpp` covers the choice and the busy check.
|
||||
@@ -0,0 +1,106 @@
|
||||
diff --git a/src/output_image_pick.hpp b/src/output_image_pick.hpp
|
||||
new file mode 100644
|
||||
index 0000000..193d9de
|
||||
--- /dev/null
|
||||
+++ b/src/output_image_pick.hpp
|
||||
@@ -0,0 +1,50 @@
|
||||
+#pragma once
|
||||
+#include <cstdint>
|
||||
+#include <poll.h>
|
||||
+
|
||||
+namespace gamescope
|
||||
+{
|
||||
+struct OutputImagePick
|
||||
+{
|
||||
+ uint32_t image;
|
||||
+ bool scanoutPending;
|
||||
+};
|
||||
+
|
||||
+template <typename Held, typename Busy>
|
||||
+inline OutputImagePick PickOutputImage( uint32_t count, uint32_t first, uint32_t last, uint32_t deferred,
|
||||
+ Held &&held, Busy &&busy )
|
||||
+{
|
||||
+ for ( int pass = 0; pass < 2; pass++ )
|
||||
+ {
|
||||
+ for ( uint32_t i = 0; i < count; i++ )
|
||||
+ {
|
||||
+ const uint32_t image = ( first + i ) % count;
|
||||
+ if ( count > 3 && ( image == last || image == deferred ) )
|
||||
+ continue;
|
||||
+ if ( held( image ) )
|
||||
+ continue;
|
||||
+ const bool pending = busy( image );
|
||||
+ if ( pass == 0 && pending )
|
||||
+ continue;
|
||||
+ return { image, pending };
|
||||
+ }
|
||||
+ }
|
||||
+ return { first, busy( first ) };
|
||||
+}
|
||||
+
|
||||
+inline bool DmabufScanoutPending( int fd )
|
||||
+{
|
||||
+ if ( fd < 0 )
|
||||
+ return false;
|
||||
+ pollfd p = { .fd = fd, .events = POLLOUT, .revents = 0 };
|
||||
+ return poll( &p, 1, 0 ) == 0;
|
||||
+}
|
||||
+
|
||||
+inline void WaitDmabufScanout( int fd, int timeoutMs )
|
||||
+{
|
||||
+ if ( fd < 0 )
|
||||
+ return;
|
||||
+ pollfd p = { .fd = fd, .events = POLLOUT, .revents = 0 };
|
||||
+ poll( &p, 1, timeoutMs );
|
||||
+}
|
||||
+}
|
||||
diff --git a/src/rendervulkan.cpp b/src/rendervulkan.cpp
|
||||
index 1d3a80c..3668a10 100644
|
||||
--- a/src/rendervulkan.cpp
|
||||
+++ b/src/rendervulkan.cpp
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "steamcompmgr.hpp"
|
||||
#include "log.hpp"
|
||||
#include "Utils/Process.h"
|
||||
+#include "output_image_pick.hpp"
|
||||
|
||||
#include "cs_composite_blit.h"
|
||||
#include "cs_composite_blur.h"
|
||||
@@ -4297,18 +4298,29 @@ static bool vulkan_output_image_held( uint32_t nImage )
|
||||
return false;
|
||||
}
|
||||
|
||||
+static bool vulkan_output_image_scanout_pending( uint32_t nImage )
|
||||
+{
|
||||
+ for ( const auto &pImage : { g_output.outputImages[ nImage ], g_output.outputImagesPartialOverlay[ nImage ] } )
|
||||
+ {
|
||||
+ if ( pImage != nullptr && pImage->GetBackendFb() != nullptr && gamescope::DmabufScanoutPending( pImage->dmabuf().fd[0] ) )
|
||||
+ return true;
|
||||
+ }
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
static uint32_t vulkan_free_output_image( uint32_t nFirst )
|
||||
{
|
||||
- const uint32_t uCount = g_output.outputImages.size();
|
||||
- for ( uint32_t i = 0; i < uCount; i++ )
|
||||
+ const gamescope::OutputImagePick pick = gamescope::PickOutputImage( g_output.outputImages.size(), nFirst,
|
||||
+ g_output.nLastOutImage, g_output.nDeferredOutImage, vulkan_output_image_held, vulkan_output_image_scanout_pending );
|
||||
+ if ( pick.scanoutPending )
|
||||
{
|
||||
- const uint32_t nImage = ( nFirst + i ) % uCount;
|
||||
- if ( uCount > 3 && ( nImage == g_output.nLastOutImage || nImage == g_output.nDeferredOutImage ) )
|
||||
- continue;
|
||||
- if ( !vulkan_output_image_held( nImage ) )
|
||||
- return nImage;
|
||||
+ for ( const auto &pImage : { g_output.outputImages[ pick.image ], g_output.outputImagesPartialOverlay[ pick.image ] } )
|
||||
+ {
|
||||
+ if ( pImage != nullptr && pImage->GetBackendFb() != nullptr )
|
||||
+ gamescope::WaitDmabufScanout( pImage->dmabuf().fd[0], 100 );
|
||||
+ }
|
||||
}
|
||||
- return nFirst;
|
||||
+ return pick.image;
|
||||
}
|
||||
|
||||
std::optional<uint64_t> vulkan_composite( struct FrameInfo_t *frameInfo, gamescope::Rc<CVulkanTexture> pPipewireTexture, bool partial, gamescope::Rc<CVulkanTexture> pOutputOverride, bool increment, std::unique_ptr<CVulkanCmdBuffer> pInCommandBuffer )
|
||||
@@ -1,3 +1,3 @@
|
||||
GAMESCOPE_REPO=Droid-Deck/DroidDeck-Components
|
||||
GAMESCOPE_TAG=gamescope-3.16.29-1a29c65d
|
||||
GAMESCOPE_SHA256=18620dfedb65860da00003e965cc09784a650ef6ecc9a17056405fe0a1392a02
|
||||
GAMESCOPE_TAG=gamescope-3.16.29-f3a45b31
|
||||
GAMESCOPE_SHA256=3908af87b2ee8a328e9780fc805c6a7bddd11d7405b9992d717b94e16c019313
|
||||
@@ -2,6 +2,9 @@
|
||||
#include "nested_surface_format.hpp"
|
||||
#include "dmabuf_import.hpp"
|
||||
#include "sdl_refresh.hpp"
|
||||
#include "output_image_pick.hpp"
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <cassert>
|
||||
#include <cstdio>
|
||||
|
||||
@@ -152,5 +155,43 @@ int main()
|
||||
assert(DmabufMemoryType(memory, 7, 0, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) == UINT32_MAX);
|
||||
assert(DmabufMemoryType(memory, 7, 4, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
|
||||
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) == UINT32_MAX);
|
||||
|
||||
using gamescope::PickOutputImage;
|
||||
auto none = [](uint32_t) { return false; };
|
||||
auto pick = PickOutputImage(5, 2, 1, 0, none, none);
|
||||
assert(pick.image == 2 && !pick.scanoutPending);
|
||||
auto heldTwo = [](uint32_t i) { return i == 2; };
|
||||
pick = PickOutputImage(5, 2, 1, 0, heldTwo, none);
|
||||
assert(pick.image == 3 && !pick.scanoutPending);
|
||||
auto scanningTwo = [](uint32_t i) { return i == 2; };
|
||||
pick = PickOutputImage(5, 2, 1, 0, none, scanningTwo);
|
||||
assert(pick.image == 3 && !pick.scanoutPending);
|
||||
auto scanningAll = [](uint32_t) { return true; };
|
||||
pick = PickOutputImage(5, 2, 1, 0, heldTwo, scanningAll);
|
||||
assert(pick.image == 3 && pick.scanoutPending);
|
||||
auto heldAll = [](uint32_t) { return true; };
|
||||
auto scanningOne = [](uint32_t i) { return i == 1; };
|
||||
pick = PickOutputImage(5, 2, 1, 0, heldAll, none);
|
||||
assert(pick.image == 2 && !pick.scanoutPending);
|
||||
pick = PickOutputImage(5, 1, 0, 1, heldAll, scanningOne);
|
||||
assert(pick.image == 1 && pick.scanoutPending);
|
||||
pick = PickOutputImage(3, 1, 0, 2, none, none);
|
||||
assert(pick.image == 1 && !pick.scanoutPending);
|
||||
pick = PickOutputImage(3, 1, 0, 2, none, scanningOne);
|
||||
assert(pick.image == 2 && !pick.scanoutPending);
|
||||
|
||||
int fds[2];
|
||||
assert(pipe(fds) == 0);
|
||||
assert(!gamescope::DmabufScanoutPending(fds[1]));
|
||||
assert(!gamescope::DmabufScanoutPending(-1));
|
||||
fcntl(fds[1], F_SETFL, O_NONBLOCK);
|
||||
char block[4096] = {};
|
||||
while (write(fds[1], block, sizeof(block)) > 0) {}
|
||||
assert(gamescope::DmabufScanoutPending(fds[1]));
|
||||
gamescope::WaitDmabufScanout(fds[1], 1);
|
||||
while (read(fds[0], block, sizeof(block)) == sizeof(block) && gamescope::DmabufScanoutPending(fds[1])) {}
|
||||
assert(!gamescope::DmabufScanoutPending(fds[1]));
|
||||
close(fds[0]);
|
||||
close(fds[1]);
|
||||
std::puts("Gamescope presentation and DMA-BUF import tests passed");
|
||||
}
|
||||
@@ -229,12 +229,16 @@ fi
|
||||
if ! /usr/local/bin/droiddeck-pipewire start; then
|
||||
echo "== pipewire: not running; screen capture has no picture"
|
||||
fi
|
||||
return_gaming=/run/droiddeck/return-gaming
|
||||
mkdir -p /run/droiddeck
|
||||
rm -f "$return_gaming"
|
||||
echo "== droiddeck-desktop: Plasma on $WAYLAND_DISPLAY"
|
||||
dbus-run-session -- startplasma-wayland
|
||||
rc=$?
|
||||
/usr/local/bin/droiddeck-pipewire stop
|
||||
echo "== droiddeck-desktop: Plasma ended ($rc)"
|
||||
if [ "$rc" -eq 0 ] && [ -z "${DD_BOTTOM_DESKTOP:-}" ]; then
|
||||
if [ "$rc" -eq 0 ] && [ -z "${DD_BOTTOM_DESKTOP:-}" ] && [ -e "$return_gaming" ]; then
|
||||
rm -f "$return_gaming"
|
||||
/usr/local/bin/droiddeck-steam-launch bigpicture
|
||||
sleep 30
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
[Desktop Entry]
|
||||
Name=Return to Gaming Mode
|
||||
Comment=Log out of the desktop and go back to Steam
|
||||
Exec=sh -c ": > /run/droiddeck/return-gaming; dbus-send --session --print-reply --type=method_call --dest=org.kde.Shutdown /Shutdown org.kde.Shutdown.logout >/dev/null || rm -f /run/droiddeck/return-gaming"
|
||||
Icon=steamdeck-gaming-return
|
||||
Terminal=false
|
||||
Type=Application
|
||||
StartupNotify=false
|
||||
NoDisplay=true
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import base64
|
||||
import ctypes
|
||||
import json
|
||||
import math
|
||||
import re
|
||||
@@ -19,6 +20,7 @@ import urllib.parse
|
||||
from pathlib import Path
|
||||
|
||||
VERSION = 1
|
||||
PR_SET_CHILD_SUBREAPER = 36
|
||||
OUTPUT_CAP = 256 * 1024
|
||||
REQUEST_CAP = 256 * 1024
|
||||
RESPONSE_CAP = 1024 * 1024
|
||||
@@ -1238,7 +1240,17 @@ def answer(agent_dir, path):
|
||||
write_json(agent_dir / "resp" / (rid + ".json"), result)
|
||||
|
||||
|
||||
def stop_adopting_orphans():
|
||||
# libddsession makes every session process a child subreaper. The agent never reaps adopted orphans, so
|
||||
# SteamVR left zombies that its helper's stop counted as still running. The session shell above reaps them.
|
||||
try:
|
||||
ctypes.CDLL(None, use_errno=True).prctl(PR_SET_CHILD_SUBREAPER, 0, 0, 0, 0)
|
||||
except (OSError, AttributeError):
|
||||
pass
|
||||
|
||||
|
||||
def serve(agent_dir, focus=True, poll=0.1):
|
||||
stop_adopting_orphans()
|
||||
(agent_dir / "req").mkdir(parents=True, exist_ok=True)
|
||||
(agent_dir / "resp").mkdir(parents=True, exist_ok=True)
|
||||
can_focus = focus and bool(os.environ.get("DISPLAY"))
|
||||
|
||||
@@ -4,10 +4,12 @@ import http.client
|
||||
import json
|
||||
import math
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import runpy
|
||||
import shutil
|
||||
import signal
|
||||
import stat
|
||||
import subprocess
|
||||
import sys
|
||||
import threading
|
||||
@@ -156,7 +158,13 @@ function watch(path) {
|
||||
save(".json", s);
|
||||
if (/"form"\s*:\s*\{/.test(s)) {
|
||||
var refused = /"error"\s*:\s*(\d+)/.exec(object(s, "game_dir"));
|
||||
if (refused && +refused[1] != 0) throw new Error(+refused[1] == 800 ? "the game folder already holds a game" : "Battle.net refused the game folder (error " + refused[1] + ")");
|
||||
if (refused && +refused[1] != 0) {
|
||||
var code = +refused[1];
|
||||
var reason = "Battle.net refused the game folder (error " + code + ")";
|
||||
if (code == 703) reason = "Battle.net could not access the game folder (error 703)";
|
||||
if (code == 800) reason = "the game folder already holds a game";
|
||||
throw new Error(reason);
|
||||
}
|
||||
} else if (/"error"\s*:\s*[1-9]/.test(s)) break;
|
||||
var state = /"state"\s*:\s*(\d+)/.exec(s.replace(/"extended_status"\s*:\s*\{[^}]*\}/, "")), complete = /"download_complete"\s*:\s*true/.test(s);
|
||||
state = state ? +state[1] : 0;
|
||||
@@ -341,6 +349,58 @@ def install_path(root, library):
|
||||
return letter.upper() + ":\\" + path[len(target):].strip("/").replace("/", "\\")
|
||||
|
||||
|
||||
def _heal_install_permissions(folder):
|
||||
root = Path(folder)
|
||||
if any(path.is_symlink() for path in (root, *root.parents)) or not root.exists():
|
||||
return
|
||||
pending = [root]
|
||||
while pending:
|
||||
path = pending.pop()
|
||||
try:
|
||||
st = path.lstat()
|
||||
except OSError:
|
||||
continue
|
||||
if stat.S_ISLNK(st.st_mode):
|
||||
continue
|
||||
mode = stat.S_IMODE(st.st_mode)
|
||||
wanted = mode | stat.S_IRUSR | stat.S_IWUSR
|
||||
if stat.S_ISDIR(st.st_mode):
|
||||
wanted |= stat.S_IXUSR
|
||||
if wanted != mode:
|
||||
try:
|
||||
os.chmod(path, wanted, follow_symlinks=False)
|
||||
except OSError:
|
||||
continue
|
||||
if stat.S_ISDIR(st.st_mode):
|
||||
try:
|
||||
with os.scandir(path) as entries:
|
||||
for entry in entries:
|
||||
try:
|
||||
if not entry.is_symlink():
|
||||
pending.append(Path(entry.path))
|
||||
except OSError:
|
||||
continue
|
||||
except OSError:
|
||||
continue
|
||||
|
||||
|
||||
def heal_install_folder(folder):
|
||||
folder = Path(folder).absolute()
|
||||
try:
|
||||
if any(path.is_symlink() for path in (folder, *folder.parents)):
|
||||
return
|
||||
_heal_install_permissions(folder)
|
||||
except (OSError, RuntimeError, ValueError):
|
||||
return
|
||||
try:
|
||||
game_env = runpy.run_path(os.path.join(os.path.dirname(os.path.abspath(__file__)), "droiddeck-game-env"))
|
||||
unlocked, cleared = game_env["heal_shared_data_locked"](folder)
|
||||
except (OSError, KeyError, TypeError, ValueError):
|
||||
unlocked, cleared = [], []
|
||||
if cleared:
|
||||
say("cleared %d stale Windows owners in the game folder; unlocked: %s" % (len(cleared), ", ".join(unlocked) or "none"))
|
||||
|
||||
|
||||
def keeps_open(root):
|
||||
try:
|
||||
with open(os.path.join(drive_c(root), *CONFIG), encoding="utf-8-sig") as f:
|
||||
@@ -1550,6 +1610,7 @@ def agent_job(root, action, uid, product="", folder="", locale="enUS", country="
|
||||
stop_leftovers(pfx)
|
||||
if action == "install":
|
||||
windows = install_path(root, folder)
|
||||
heal_install_folder(folder)
|
||||
emit("STATE", "starting")
|
||||
base = os.path.join(CACHE, "agent-%s" % uid)
|
||||
os.makedirs(CACHE, exist_ok=True)
|
||||
@@ -1613,6 +1674,8 @@ def agent_job(root, action, uid, product="", folder="", locale="enUS", country="
|
||||
except OSError:
|
||||
reason = None
|
||||
code = status.get("error")
|
||||
if reason is None and code == 703:
|
||||
reason = "Battle.net could not access the game folder (error 703)"
|
||||
if reason is None and isinstance(code, int) and code > 0:
|
||||
emit("ERROR", "agent %d" % code)
|
||||
say("the %s of %s stopped: Agent error %d" % (action, uid, code))
|
||||
|
||||
@@ -66,6 +66,69 @@ DOTNET_FEX = {
|
||||
"FEX_HALFBARRIERTSOENABLED": "1",
|
||||
"FEX_X87REDUCEDPRECISION": "0",
|
||||
}
|
||||
STABILITY_FEX = dict(DOTNET_FEX, FEX_MULTIBLOCK="0")
|
||||
# Setup loader offset-table IDs, as innoextract's known_setup_loader_versions lists them. Loaders
|
||||
# from 5.1.5 keep the table in a resource; older ones also put "Inno" at file offset 0x30.
|
||||
INNO_LOADER_IDS = (b"rDlPtS", b"nS5W7dT\x83\xaa\x1b\x0fj")
|
||||
INNO_RESOURCE_LIMIT = 4 << 20
|
||||
|
||||
|
||||
def is_inno_setup(path):
|
||||
try:
|
||||
with open(path, "rb") as exe:
|
||||
head = exe.read(4096)
|
||||
if head[:2] != b"MZ":
|
||||
return False
|
||||
if head[0x30:0x34] == b"Inno":
|
||||
return True
|
||||
pe = int.from_bytes(head[0x3C:0x40], "little")
|
||||
if head[pe:pe + 4] != b"PE\0\0" or int.from_bytes(head[pe + 4:pe + 6], "little") != 0x14C:
|
||||
return False
|
||||
count = int.from_bytes(head[pe + 6:pe + 8], "little")
|
||||
table = pe + 24 + int.from_bytes(head[pe + 20:pe + 22], "little")
|
||||
for entry in range(table, table + 40 * count, 40):
|
||||
if head[entry:entry + 8].rstrip(b"\0") == b".rsrc":
|
||||
exe.seek(int.from_bytes(head[entry + 20:entry + 24], "little"))
|
||||
size = int.from_bytes(head[entry + 16:entry + 20], "little")
|
||||
resources = exe.read(min(size, INNO_RESOURCE_LIMIT))
|
||||
return any(marker in resources for marker in INNO_LOADER_IDS)
|
||||
except OSError:
|
||||
pass
|
||||
return False
|
||||
|
||||
|
||||
STORE_LAUNCHER = ".droiddeck-launch.bat"
|
||||
STORE_SIDECAR = ".droiddeck-store.json"
|
||||
|
||||
|
||||
def store_game_exe(exe):
|
||||
if os.path.basename(exe).lower() != STORE_LAUNCHER:
|
||||
return exe
|
||||
folder = os.path.dirname(exe)
|
||||
try:
|
||||
with open(os.path.join(folder, STORE_SIDECAR), encoding="utf-8") as source:
|
||||
sidecar = json.load(source)
|
||||
except (OSError, ValueError):
|
||||
return exe
|
||||
target = sidecar.get("exe") if isinstance(sidecar, dict) else None
|
||||
if not isinstance(target, str) or not target.strip() or "\0" in target:
|
||||
return exe
|
||||
normalized = target.replace("\\", "/")
|
||||
if ":" in normalized or normalized.startswith("/") or ".." in normalized.split("/"):
|
||||
return exe
|
||||
relative = os.path.normpath(normalized)
|
||||
if os.path.isabs(relative) or relative in (".", "..") or relative.startswith(".." + os.sep):
|
||||
return exe
|
||||
candidate = os.path.join(folder, relative)
|
||||
if not os.path.isfile(candidate):
|
||||
return exe
|
||||
root = os.path.realpath(folder)
|
||||
try:
|
||||
if os.path.commonpath((root, os.path.realpath(candidate))) != root:
|
||||
return exe
|
||||
except ValueError:
|
||||
return exe
|
||||
return candidate
|
||||
|
||||
|
||||
def game_files(exe):
|
||||
@@ -89,6 +152,7 @@ def game_files(exe):
|
||||
class Game:
|
||||
|
||||
def __init__(self, exe, args, app_id=""):
|
||||
exe = store_game_exe(exe)
|
||||
self.exe = exe
|
||||
self.args = args
|
||||
self.app_id = app_id
|
||||
@@ -191,6 +255,12 @@ def split_second_x87_fip(game):
|
||||
return {"FEX_JITFEATURES": "enablex87fip"}, [], "Split/Second: FEX x87 FIP emulation on (its SecuROM stops with error 8016 without it)"
|
||||
|
||||
|
||||
@fix
|
||||
def inno_setup_stability(game):
|
||||
if is_inno_setup(game.exe):
|
||||
return STABILITY_FEX, [], "Inno Setup installer: FEX Stability settings (under Performance + TSO the 32-bit setup stub corrupts its own paths)"
|
||||
|
||||
|
||||
@fix
|
||||
def doom_2016_swapchain_images(game):
|
||||
if "doomx64vk.exe" in game.files and game.stem in ("doomx64", "doomx64vk"):
|
||||
@@ -273,7 +343,7 @@ def with_system_settings(text, settings):
|
||||
|
||||
# The game ignores -ini: overrides and deletes a writable Engine.ini after reading it, so this runs at every launch.
|
||||
def dragon_quest_monsters_4_mesh_detail(exe, env):
|
||||
project = Path(exe).stem.split("-", 1)[0]
|
||||
project = Path(store_game_exe(exe)).stem.split("-", 1)[0]
|
||||
if not project.lower().startswith("dragonquestmonsters4"):
|
||||
return
|
||||
prefix = Path(env.get("STEAM_COMPAT_DATA_PATH", "/nonexistent")) / "pfx"
|
||||
@@ -398,7 +468,7 @@ def zomboid_rewrite(node):
|
||||
def project_zomboid_jvm(command):
|
||||
if len(command) <= 2:
|
||||
return
|
||||
exe = Path(command[2])
|
||||
exe = Path(store_game_exe(command[2]))
|
||||
if not exe.stem.lower().startswith("projectzomboid"):
|
||||
return
|
||||
settings = exe.with_suffix(".json")
|
||||
@@ -721,12 +791,15 @@ def apply_config(env, config, app_id, fixes=None):
|
||||
|
||||
|
||||
def render_path_defaults(command, env):
|
||||
if len(command) < 3 or command[1] != "waitforexitandrun" or Path(command[2]).name.lower() != "spintires.exe":
|
||||
if len(command) < 3 or command[1] != "waitforexitandrun":
|
||||
return None
|
||||
exe = Path(store_game_exe(command[2]))
|
||||
if exe.name.lower() != "spintires.exe":
|
||||
return None
|
||||
own = env.get("DXVK_CONFIG", "")
|
||||
if re.search(r"(?:^|;)\s*dxvk\.tilerMode\s*=", own) or env.get("DXVK_CONFIG_FILE"):
|
||||
return None
|
||||
if Path("dxvk.conf").is_file() or Path(command[2]).with_name("dxvk.conf").is_file():
|
||||
if Path("dxvk.conf").is_file() or exe.with_name("dxvk.conf").is_file():
|
||||
return None
|
||||
driver = env.get("VK_DRIVER_FILES", env.get("VK_ICD_FILENAMES", ""))
|
||||
if Path(driver).parent.name != "DD-Turnip_v0.4.0":
|
||||
@@ -1290,7 +1363,7 @@ def dirt_ws2_wanted(command, env):
|
||||
prefix = env.get("STEAM_COMPAT_DATA_PATH", "").rstrip("/")
|
||||
if len(command) < 3 or not prefix or not os.path.isfile(DIRT_WS2):
|
||||
return None
|
||||
game = DIRT_GAMES.get(os.path.splitext(os.path.basename(command[2]))[0].lower())
|
||||
game = DIRT_GAMES.get(os.path.splitext(os.path.basename(store_game_exe(command[2])))[0].lower())
|
||||
if not game or not dirt_telemetry_on(prefix, game) or proton_has_dirt_fix(command[0]):
|
||||
return None
|
||||
return prefix if os.path.lexists(prefix_ws2(prefix)) else None
|
||||
@@ -1347,7 +1420,7 @@ def ego_core_plan(command, env):
|
||||
count = windows_core_count(env)
|
||||
if not count or len(command) < 3:
|
||||
return None
|
||||
folder = Path(command[2]).parent
|
||||
folder = Path(store_game_exe(command[2])).parent
|
||||
path = folder / EGO_RESTRICTIONS
|
||||
try:
|
||||
raw = path.read_bytes()
|
||||
@@ -1676,14 +1749,26 @@ def main():
|
||||
if note:
|
||||
print("droiddeck-game-env: " + note, file=sys.stderr)
|
||||
else:
|
||||
# An installer started with the run verb gets the same Stability settings as one started with
|
||||
# waitforexitandrun; explicit game settings still win over them in apply_config.
|
||||
installer = {}
|
||||
if len(command) > 2 and command[1] == "run" and is_inno_setup(command[2]):
|
||||
installer = dict(STABILITY_FEX)
|
||||
print("droiddeck-game-env: Inno Setup installer: FEX Stability settings", file=sys.stderr)
|
||||
path = Path.home() / ".config/droiddeck/game-environment.json"
|
||||
try:
|
||||
with path.open(encoding="utf-8") as source:
|
||||
config = json.load(source)
|
||||
env = apply_config(env, sync_config(config, app_id), app_id)
|
||||
synced = sync_config(config, app_id)
|
||||
if installer:
|
||||
# A FEX preset chosen for the game itself still wins, as on every other launch path.
|
||||
game = config.get("games", {}).get(app_id, {})
|
||||
synced["games"][app_id].update({k: v for k, v in game.items() if k in STABILITY_FEX})
|
||||
env = apply_config(env, synced, app_id, installer)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
env = dict(env, **installer)
|
||||
except (OSError, ValueError, TypeError, AttributeError):
|
||||
env = dict(env, **installer)
|
||||
print("droiddeck-game-env: invalid configuration; using inherited environment", file=sys.stderr)
|
||||
if waiting:
|
||||
before_debug = env
|
||||
|
||||
@@ -224,15 +224,23 @@ if [ -n "${DD_VK_DRIVER:-}" ]; then
|
||||
unset dd_icd_lib
|
||||
fi
|
||||
dd_webhelper_layout() {
|
||||
local layout
|
||||
if [ -n "${DD_VKBRIDGE_WEBHELPER_ARGS:-}" ]; then
|
||||
printf '%s\n' "$DD_VKBRIDGE_WEBHELPER_ARGS"
|
||||
elif [ -z "${DD_VKBRIDGE_CEF_ANGLE:-}" ]; then
|
||||
echo stock
|
||||
elif [ "$DD_VKBRIDGE_CEF_ANGLE" = vulkan ] && [ "${DD_VKBRIDGE_CEF_VULKAN:-1}" != 0 ]; then
|
||||
echo "--use-gl=angle --use-angle=vulkan +Vulkan +VulkanFromANGLE +DefaultANGLEVulkan"
|
||||
else
|
||||
echo "--use-gl=angle --use-angle=$DD_VKBRIDGE_CEF_ANGLE"
|
||||
return
|
||||
fi
|
||||
if [ -z "${DD_VKBRIDGE_CEF_ANGLE:-}" ]; then
|
||||
echo stock
|
||||
return
|
||||
fi
|
||||
# ANGLE switches must not replace the helper's stable single-process layout.
|
||||
layout="--no-zygote --in-process-gpu -AudioServiceOutOfProcess"
|
||||
if [ "$DD_VKBRIDGE_CEF_ANGLE" = vulkan ] && [ "${DD_VKBRIDGE_CEF_VULKAN:-1}" != 0 ]; then
|
||||
layout="$layout --use-gl=angle --use-angle=vulkan +Vulkan +VulkanFromANGLE +DefaultANGLEVulkan"
|
||||
else
|
||||
layout="$layout --use-gl=angle --use-angle=$DD_VKBRIDGE_CEF_ANGLE"
|
||||
fi
|
||||
printf '%s\n' "$layout"
|
||||
}
|
||||
dd_now_ms() {
|
||||
if [ -n "${EPOCHREALTIME:-}" ]; then
|
||||
@@ -1141,6 +1149,7 @@ case $mode in
|
||||
droiddeck-steam-library "$steam_root" || true
|
||||
step "setting up the ARM64 Proton compatibility tool"
|
||||
steam-compatibility "$steam_root" || true
|
||||
steam-compatibility "$steam_root" --seed-arm64-tools || true
|
||||
if [ -z "${DD_DESKTOP:-}" ] && [ "${DD_STEAM_UI:-}" != desktop ]; then
|
||||
droiddeck-steam-ui-scale "$steam_root" "${DD_WIDTH:-1280}" "${DD_HEIGHT:-720}" || true
|
||||
fi
|
||||
|
||||
@@ -14,7 +14,16 @@ chmod 700 "$state"
|
||||
PKG_URL=https://steamdeck-packages.steamos.cloud/archlinux-deckard-hotfixes/release/0.3.x/deckard-steamvr-rel-r25358740%2B28b72a4f-1-aarch64.pkg.tar.zst
|
||||
PKG_SHA256=90a600775eb3e8856dc475f83166a93a290a0b1f3b4e82a69c8e2a8f06b9ddc9
|
||||
|
||||
running() { pgrep -x vrserver >/dev/null 2>&1; }
|
||||
alive() {
|
||||
for p in $(pgrep -x "$1"); do
|
||||
case "$(awk '/^State:/ { print $2 }' "/proc/$p/status" 2>/dev/null)" in
|
||||
Z|'') ;;
|
||||
*) return 0 ;;
|
||||
esac
|
||||
done
|
||||
return 1
|
||||
}
|
||||
running() { alive vrserver; }
|
||||
installed() { [ -x "$steamvr/bin/linuxarm64/vrstartup" ]; }
|
||||
quest_settings() {
|
||||
backup=$HOME/.local/share/droiddeck/steamvr-quest-settings.json
|
||||
@@ -40,6 +49,19 @@ configure_graphics() {
|
||||
esac
|
||||
}
|
||||
|
||||
# On the guest's three cores Steam's web helpers took CPU time from vrcompositor's frames, so while the Quest view
|
||||
# shows SteamVR they run at a lower priority.
|
||||
steam_ui_priority() {
|
||||
status=0
|
||||
for p in $(pgrep -x steamwebhelper); do
|
||||
for t in /proc/"$p"/task/*; do
|
||||
renice -n "$1" -p "${t##*/}" >/dev/null 2>&1 || [ ! -e "$t" ] || status=1
|
||||
done
|
||||
done
|
||||
[ "$status" = 0 ] || echo "could not set every Steam web helper thread to priority $1" >&2
|
||||
return "$status"
|
||||
}
|
||||
|
||||
unregister() {
|
||||
if grep -qF "\"$steamvr\"" "$HOME/.config/openvr/openvrpaths.vrpath" 2>/dev/null; then
|
||||
rm -f "$HOME/.config/openvr/openvrpaths.vrpath"
|
||||
@@ -50,7 +72,7 @@ unregister() {
|
||||
}
|
||||
|
||||
idle() {
|
||||
[ ! -f "$state/active" ] && ! running && ! pgrep -x vrstartup >/dev/null 2>&1 &&
|
||||
[ ! -f "$state/active" ] && ! running && ! alive vrstartup &&
|
||||
( flock -n 9 ) 9>"$state/start.lock"
|
||||
}
|
||||
|
||||
@@ -61,7 +83,7 @@ stop() {
|
||||
done
|
||||
for p in $(pgrep -f "$steamvr/bin/linuxarm64/vrcompositor-launcher"); do kill "$p" 2>/dev/null; done
|
||||
attempts=0
|
||||
while pgrep -x 'vrserver|vrcompositor' >/dev/null 2>&1; do
|
||||
while alive 'vrserver|vrcompositor'; do
|
||||
attempts=$((attempts + 1))
|
||||
if [ "$attempts" = 10 ]; then
|
||||
for p in $(pgrep -x 'vrserver|vrcompositor'); do kill -KILL "$p" 2>/dev/null; done
|
||||
@@ -69,8 +91,12 @@ stop() {
|
||||
[ "$attempts" -lt 20 ] || { echo 'SteamVR did not stop; preferences remain backed up' >&2; return 1; }
|
||||
sleep 0.1
|
||||
done
|
||||
# A SteamVR process killed while holding the IPC mutex in this file leaves it locked, and the next vrserver
|
||||
# gives up on it ("failed to acquire SysMgrMutex"), so the headset shows an empty void.
|
||||
alive 'vrserver|vrcompositor|vrstartup|vrdashboard|vrwebhelper' || rm -f /dev/shm/u*-ValveIPCSharedObj-SteamVR
|
||||
unregister
|
||||
quest_settings restore
|
||||
steam_ui_priority 0 || :
|
||||
}
|
||||
|
||||
case "${1:-status}" in
|
||||
@@ -81,6 +107,11 @@ launch)
|
||||
"$0" install || exit $?
|
||||
while [ -f "$state/installing" ]; do sleep 1; done
|
||||
fi
|
||||
if [ -f "$state/quest-immersive" ]; then
|
||||
: > "$state/xr-request"
|
||||
echo "asked DroidDeck to open the Quest's immersive view, which starts SteamVR"
|
||||
exit 0
|
||||
fi
|
||||
"$0" start
|
||||
;;
|
||||
status)
|
||||
@@ -122,7 +153,7 @@ start)
|
||||
flock -n 9 || { echo "SteamVR start already in progress"; exit 0; }
|
||||
installed || { echo "SteamVR is not installed (droiddeck-steamvr install)"; exit 1; }
|
||||
[ -f "$driver/bin/linuxarm64/driver_droiddeck.so" ] || { echo "the Cardboard driver is missing from $driver"; exit 1; }
|
||||
if [ -f "$state/active" ] && { running || pgrep -x vrstartup >/dev/null 2>&1; }; then
|
||||
if [ -f "$state/active" ] && { running || alive vrstartup; }; then
|
||||
echo "DroidDeck SteamVR is already running"
|
||||
exit 0
|
||||
fi
|
||||
@@ -215,8 +246,9 @@ JSON
|
||||
export LD_PRELOAD="$layer/libdroiddeck_vr_scheduling.so${LD_PRELOAD:+:$LD_PRELOAD}"
|
||||
if [ "${DROIDDECK_VR_PRESENT:-}" = questwsi ]; then
|
||||
quest_settings apply || exit 1
|
||||
steam_ui_priority 10 || :
|
||||
startup_handed_off=0
|
||||
trap '[ "$startup_handed_off" = 1 ] || quest_settings restore' EXIT
|
||||
trap '[ "$startup_handed_off" = 1 ] || { quest_settings restore; steam_ui_priority 0 || :; }' EXIT
|
||||
cvp=$steamvr/drivers/cv/bin/linuxarm64/libArcturusPerception.so
|
||||
if [ -f "$cvp" ]; then
|
||||
disabled=$cvp.droiddeck-disabled
|
||||
|
||||
@@ -4,7 +4,14 @@ import os
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
OVERRIDES = {'enableLinuxVulkanAsync': True, 'motionSmoothing': False}
|
||||
# SteamVR's arm64 build throttles the compositor to save power and skipped refreshes it had time for.
|
||||
OVERRIDES = {'enableLinuxVulkanAsync': True, 'motionSmoothing': False, 'framesToThrottle': 0, 'powersaveFramesToThrottle': 0}
|
||||
# Backups written before the throttle overrides existed do not record them.
|
||||
ADDED_LATER = {'framesToThrottle', 'powersaveFramesToThrottle'}
|
||||
|
||||
|
||||
def saved_entry(section, key):
|
||||
return [key in section, section.get(key)]
|
||||
|
||||
|
||||
def read(path):
|
||||
@@ -33,6 +40,8 @@ def saved_preferences(path):
|
||||
if not isinstance(backup.get('section'), bool) or not isinstance(backup.get('values'), dict):
|
||||
raise ValueError('invalid backup object')
|
||||
for key in OVERRIDES:
|
||||
if key not in backup['values'] and key in ADDED_LATER:
|
||||
continue
|
||||
entry = backup['values'].get(key)
|
||||
if not isinstance(entry, list) or len(entry) != 2 or not isinstance(entry[0], bool):
|
||||
raise ValueError('invalid saved preference: ' + key)
|
||||
@@ -45,12 +54,16 @@ def saved_preferences(path):
|
||||
def update(operation, settings_path, backup_path):
|
||||
settings = read(settings_path)
|
||||
if operation == 'apply':
|
||||
section = settings.get('steamvr', {})
|
||||
if backup_path.exists():
|
||||
saved_preferences(backup_path)
|
||||
backup = saved_preferences(backup_path)
|
||||
missing = [key for key in OVERRIDES if key not in backup['values']]
|
||||
if missing:
|
||||
backup['values'].update({key: saved_entry(section, key) for key in missing})
|
||||
write(backup_path, backup)
|
||||
else:
|
||||
section = settings.get('steamvr', {})
|
||||
write(backup_path, {'section': 'steamvr' in settings,
|
||||
'values': {key: [key in section, section.get(key)] for key in OVERRIDES}})
|
||||
'values': {key: saved_entry(section, key) for key in OVERRIDES}})
|
||||
settings.setdefault('steamvr', {}).update(OVERRIDES)
|
||||
write(settings_path, settings)
|
||||
elif operation == 'restore':
|
||||
@@ -59,6 +72,8 @@ def update(operation, settings_path, backup_path):
|
||||
backup = saved_preferences(backup_path)
|
||||
section = settings.setdefault('steamvr', {})
|
||||
for key in OVERRIDES:
|
||||
if key not in backup['values']:
|
||||
continue
|
||||
present, value = backup['values'][key]
|
||||
if present:
|
||||
section[key] = value
|
||||
|
||||
@@ -5,6 +5,7 @@ import re
|
||||
import runpy
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
TOOL = "droiddeck-proton-arm64"
|
||||
TOOL_11 = "droiddeck-proton-11-arm64"
|
||||
@@ -26,6 +27,8 @@ SNIPER_APPID = "1628350"
|
||||
SLR4_APPID = "4183110"
|
||||
FEX_DEPENDENCIES = (FEX_APPID, SNIPER_APPID, SLR4_APPID)
|
||||
REQUIRED_TOOLS = (PROTON_ARM64_APPID,) + FEX_DEPENDENCIES
|
||||
ARM64_TOOL_DEPENDENCIES = (("1826330", "Proton EasyAntiCheat Runtime"),
|
||||
("1070560", "Steam Linux Runtime 1.0 (scout)"))
|
||||
# "0" = the app's "Valve Proton only when needed": Valve's ARM64 Proton is fetched only for a title or
|
||||
# default set to a tool built from it, or while no own Proton build is installed.
|
||||
VALVE_PROTON_ENV = "DD_VALVE_PROTON"
|
||||
@@ -1012,10 +1015,15 @@ def manifest_text(appid, name, installdir, bare=False):
|
||||
return text[:-2] + ' "AutoUpdateBehavior" "1"\n}\n' if bare else text
|
||||
|
||||
|
||||
def app_manifest(steam_root, app):
|
||||
def manifest_paths(steam_root, app):
|
||||
for library in libraries(steam_root):
|
||||
yield os.path.join(library, "steamapps", "appmanifest_%s.acf" % app)
|
||||
|
||||
|
||||
def app_manifest(steam_root, app):
|
||||
for path in manifest_paths(steam_root, app):
|
||||
try:
|
||||
with open(os.path.join(library, "steamapps", "appmanifest_%s.acf" % app), encoding="utf-8", errors="replace") as f:
|
||||
with open(path, encoding="utf-8", errors="replace") as f:
|
||||
return tokenize(f.read())
|
||||
except OSError:
|
||||
continue
|
||||
@@ -1030,6 +1038,57 @@ def manifest_flags(tokens):
|
||||
return 0
|
||||
|
||||
|
||||
def installed_manifest(path):
|
||||
try:
|
||||
with open(path, encoding="utf-8", errors="replace") as f:
|
||||
return bool(manifest_flags(tokenize(f.read())) & FULLY_INSTALLED)
|
||||
except OSError:
|
||||
return False
|
||||
|
||||
|
||||
def seed_unavailable_arm64_tools(steam_root):
|
||||
entries = appinfo_entries(os.path.join(steam_root, "appcache", "appinfo.vdf"),
|
||||
[app for app, _ in ARM64_TOOL_DEPENDENCIES])
|
||||
steamapps = os.path.join(steam_root, "steamapps")
|
||||
os.makedirs(steamapps, exist_ok=True)
|
||||
seeded = []
|
||||
for app, display in ARM64_TOOL_DEPENDENCIES:
|
||||
entry = entries.get(app)
|
||||
if entry is not None:
|
||||
if entry["type"] not in ("", "tool"):
|
||||
continue
|
||||
if "arm64" in entry["osarch"] or "aarch64" in entry["osarch"]:
|
||||
continue
|
||||
existing = [p for p in manifest_paths(steam_root, app) if os.path.isfile(p)]
|
||||
if any(installed_manifest(p) for p in existing):
|
||||
continue
|
||||
name = (entry or {}).get("name") or display
|
||||
installdir = (entry or {}).get("installdir") or name
|
||||
path = existing[0] if existing else os.path.join(steamapps, "appmanifest_%s.acf" % app)
|
||||
temporary = None
|
||||
try:
|
||||
with tempfile.NamedTemporaryFile(mode="w", encoding="utf-8",
|
||||
dir=os.path.dirname(path),
|
||||
prefix=".appmanifest_", delete=False) as f:
|
||||
temporary = f.name
|
||||
f.write(manifest_text(app, name, installdir, True))
|
||||
if existing:
|
||||
os.replace(temporary, path)
|
||||
else:
|
||||
os.link(temporary, path)
|
||||
except OSError as e:
|
||||
print("steam-compatibility: could not mark %s installed (%s)" % (app, e))
|
||||
continue
|
||||
finally:
|
||||
if temporary is not None:
|
||||
try:
|
||||
os.unlink(temporary)
|
||||
except OSError:
|
||||
pass
|
||||
seeded.append(app)
|
||||
return seeded
|
||||
|
||||
|
||||
def valve_proton_on_demand():
|
||||
return os.environ.get(VALVE_PROTON_ENV) == "0"
|
||||
|
||||
@@ -1801,6 +1860,11 @@ def main():
|
||||
steam_root = sys.argv[1]
|
||||
if "--valve-proton-needed" in sys.argv[2:]:
|
||||
sys.exit(0 if valve_proton_needed(steam_root) else 1)
|
||||
if "--seed-arm64-tools" in sys.argv[2:]:
|
||||
seeded = seed_unavailable_arm64_tools(steam_root)
|
||||
if seeded:
|
||||
print("steam-compatibility: marked unavailable ARM64 tool(s) installed: %s" % ", ".join(seeded))
|
||||
return
|
||||
if "--x64" in sys.argv[2:]:
|
||||
x64_repoint(steam_root, os.environ.get("DD_COMPAT_TOOL"), "--live" in sys.argv[2:])
|
||||
return
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
"NAME=\"Xbox 360 Controller (%d)\"\n" \
|
||||
"PHYS=\"usb-fakeinput/input%d\"\n"
|
||||
|
||||
#define RING_SDL_ID 0x045e028eu
|
||||
|
||||
#define PARENT_NAME "droiddeck-input"
|
||||
#define PARENT_SYSPATH_FORMAT "/sys/devices/droiddeck%d/" PARENT_NAME "%d"
|
||||
#define EVENT_SYSPATH_FORMAT PARENT_SYSPATH_FORMAT "/event%d"
|
||||
@@ -49,6 +51,8 @@ struct pad {
|
||||
int live;
|
||||
};
|
||||
|
||||
static const char *ring_uevent_format(void);
|
||||
|
||||
static struct pad pads[PAD_MAX];
|
||||
static struct pad parents[PAD_MAX];
|
||||
static int pad_count;
|
||||
@@ -89,7 +93,7 @@ static void discover_pads(void) {
|
||||
snprintf(pad->syspath, sizeof(pad->syspath), EVENT_SYSPATH_FORMAT, (int)slot, (int)slot,
|
||||
(int)slot);
|
||||
snprintf(pad->devnode, sizeof(pad->devnode), "/dev/input/event%ld", slot);
|
||||
snprintf(pad->uevent, sizeof(pad->uevent), PAD_UEVENT_FORMAT, (int)slot, (int)slot);
|
||||
snprintf(pad->uevent, sizeof(pad->uevent), ring_uevent_format(), (int)slot, (int)slot);
|
||||
pad->devnum = makedev(13, EVENT_MINOR_BASE + (unsigned int)slot);
|
||||
pad->node = (int)slot;
|
||||
pad->live = 1;
|
||||
@@ -137,6 +141,68 @@ static int any_virtual_pad(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char *sdl_id_list_text(const char *list) {
|
||||
char *text = NULL;
|
||||
char *grown;
|
||||
size_t length = 0;
|
||||
size_t got;
|
||||
FILE *file;
|
||||
|
||||
if (list[0] != '@') return strdup(list);
|
||||
file = fopen(list + 1, "re");
|
||||
if (file == NULL) return NULL;
|
||||
do {
|
||||
grown = realloc(text, length + 4097);
|
||||
if (grown == NULL) {
|
||||
free(text);
|
||||
fclose(file);
|
||||
return NULL;
|
||||
}
|
||||
text = grown;
|
||||
got = fread(text + length, 1, 4096, file);
|
||||
length += got;
|
||||
} while (got > 0);
|
||||
fclose(file);
|
||||
text[length] = '\0';
|
||||
return text;
|
||||
}
|
||||
|
||||
static int sdl_id_list_entries(const char *list, int *has_ring) {
|
||||
char *text = sdl_id_list_text(list);
|
||||
char *spot = text;
|
||||
uint32_t entry;
|
||||
int entries = 0;
|
||||
|
||||
*has_ring = 0;
|
||||
if (text == NULL) return 0;
|
||||
while ((spot = strstr(spot, "0x")) != NULL) {
|
||||
entry = (uint32_t)(uint16_t)strtol(spot, &spot, 0) << 16;
|
||||
spot = strstr(spot, "0x");
|
||||
if (spot == NULL) break;
|
||||
entry |= (uint16_t)strtol(spot, &spot, 0);
|
||||
entries++;
|
||||
if (entry == RING_SDL_ID) *has_ring = 1;
|
||||
}
|
||||
free(text);
|
||||
return entries;
|
||||
}
|
||||
|
||||
static int sdl_bus_skips_ring_pad(void) {
|
||||
const char *steam_virtual = getenv("FAKE_EVDEV_STEAM_VIRTUAL");
|
||||
const char *except = getenv("SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT");
|
||||
const char *ignore = getenv("SDL_GAMECONTROLLER_IGNORE_DEVICES");
|
||||
int has_ring;
|
||||
|
||||
if (steam_virtual != NULL && atoi(steam_virtual) != 0) return 1;
|
||||
if (except != NULL && sdl_id_list_entries(except, &has_ring) > 0) return !has_ring;
|
||||
return ignore != NULL && sdl_id_list_entries(ignore, &has_ring) > 0 && has_ring;
|
||||
}
|
||||
|
||||
static const char *ring_uevent_format(void) {
|
||||
if (uinput_enabled() && any_virtual_pad()) return PAD_PHYSICAL_UEVENT_FORMAT;
|
||||
return sdl_bus_skips_ring_pad() ? PAD_UEVENT_FORMAT : PAD_PHYSICAL_UEVENT_FORMAT;
|
||||
}
|
||||
|
||||
static void refresh_locked(int node) {
|
||||
struct pad *pad = &pads[node];
|
||||
|
||||
@@ -167,9 +233,7 @@ static void refresh_locked(int node) {
|
||||
} else {
|
||||
snprintf(pad->devnode, sizeof(pad->devnode), "/dev/input/event%d", node);
|
||||
pad->live = 1;
|
||||
if (uinput_enabled())
|
||||
snprintf(pad->uevent, sizeof(pad->uevent),
|
||||
any_virtual_pad() ? PAD_PHYSICAL_UEVENT_FORMAT : PAD_UEVENT_FORMAT, node, node);
|
||||
snprintf(pad->uevent, sizeof(pad->uevent), ring_uevent_format(), node, node);
|
||||
}
|
||||
}
|
||||
sync_parent(node);
|
||||
@@ -441,11 +505,48 @@ static void *next_symbol(const char *name) {
|
||||
char *dd_cached_realpath(const char *path, char *resolved, char *(*real)(const char *, char *))
|
||||
__attribute__((visibility("hidden")));
|
||||
|
||||
static int caller_is_winebus(void *caller) {
|
||||
static int caller_in_library(void *caller, const char *library) {
|
||||
Dl_info info;
|
||||
|
||||
if (dladdr(caller, &info) == 0 || info.dli_fname == NULL) return 0;
|
||||
return strstr(info.dli_fname, "winebus.so") != NULL;
|
||||
return strstr(info.dli_fname, library) != NULL;
|
||||
}
|
||||
|
||||
static int caller_is_winebus(void *caller) { return caller_in_library(caller, "winebus.so"); }
|
||||
|
||||
typedef int (*sdl_rumble_fn)(void *, uint16_t, uint16_t, uint32_t);
|
||||
static _Atomic(sdl_rumble_fn) real_sdl_rumble;
|
||||
static __thread int winebus_sdl_call;
|
||||
|
||||
static int winebus_sdl_rumble(void *joystick, uint16_t low, uint16_t high, uint32_t duration) {
|
||||
sdl_rumble_fn real = atomic_load_explicit(&real_sdl_rumble, memory_order_acquire);
|
||||
int result;
|
||||
|
||||
if (!caller_is_winebus(__builtin_return_address(0))) return real(joystick, low, high, duration);
|
||||
if (low != 0 || high != 0) duration = 0;
|
||||
winebus_sdl_call = 1;
|
||||
result = real(joystick, low, high, duration);
|
||||
winebus_sdl_call = 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
static void *winebus_sdl_rumble_dlsym(void *handle, const char *name) {
|
||||
(void)handle;
|
||||
(void)name;
|
||||
return (void *)winebus_sdl_rumble;
|
||||
}
|
||||
|
||||
static void *sdl_rumble_target(void *handle, void *(*forward)(void *, const char *)) {
|
||||
sdl_rumble_fn expected = NULL;
|
||||
sdl_rumble_fn found;
|
||||
|
||||
if (handle == RTLD_NEXT || handle == RTLD_DEFAULT) return NULL;
|
||||
found = (sdl_rumble_fn)forward(handle, "SDL_JoystickRumble");
|
||||
if (found == NULL) return NULL;
|
||||
atomic_compare_exchange_strong_explicit(&real_sdl_rumble, &expected, found, memory_order_acq_rel,
|
||||
memory_order_acquire);
|
||||
if (atomic_load_explicit(&real_sdl_rumble, memory_order_acquire) != found) return NULL;
|
||||
return (void *)winebus_sdl_rumble_dlsym;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int dd_winebus_rumble_ioctl(int (*real)(int, unsigned long, void *), int fd,
|
||||
@@ -454,7 +555,8 @@ __attribute__((visibility("hidden"))) int dd_winebus_rumble_ioctl(int (*real)(in
|
||||
struct ff_effect *effect = arg;
|
||||
__u16 length;
|
||||
|
||||
if (request != EVIOCSFF || effect == NULL || effect->type != FF_RUMBLE || !caller_is_winebus(caller)) return 0;
|
||||
if (request != EVIOCSFF || effect == NULL || effect->type != FF_RUMBLE) return 0;
|
||||
if (!caller_is_winebus(caller) && !(winebus_sdl_call && caller_in_library(caller, "libSDL"))) return 0;
|
||||
length = effect->replay.length;
|
||||
effect->replay.length = 0;
|
||||
*rc = real(fd, request, arg);
|
||||
@@ -1195,7 +1297,10 @@ static void *own_dlsym(void *handle, const char *name) {
|
||||
__attribute__((visibility("hidden"), used)) void *inputudev_dlsym_target(void *handle, const char *name) {
|
||||
void *forward = real_dlsym();
|
||||
|
||||
(void)handle;
|
||||
if (forward != NULL && name != NULL && strcmp(name, "SDL_JoystickRumble") == 0) {
|
||||
void *rumble = sdl_rumble_target(handle, forward);
|
||||
if (rumble != NULL) return rumble;
|
||||
}
|
||||
if (name != NULL && strncmp(name, "udev_", 5) == 0 && own_udev_symbol(name) != NULL &&
|
||||
!steam_client_process())
|
||||
return (void *)own_dlsym;
|
||||
|
||||
@@ -452,7 +452,8 @@ static int ddnatv_execve(const char *filename, char *const argv[], char *const e
|
||||
char resolved_target[PATH_MAX];
|
||||
|
||||
// Only intercept binaries/scripts within DDNATV_ROOT
|
||||
if ((g_ddnatv_root[0] != '\0' && strncmp(target, g_ddnatv_root, g_ddnatv_root_len) == 0) || is_mapped_guest_path(filename)) {
|
||||
if ((g_ddnatv_root[0] != '\0' && strncmp(target, g_ddnatv_root, g_ddnatv_root_len) == 0) || is_mapped_guest_path(filename) ||
|
||||
is_bound_guest_program(target)) {
|
||||
struct exec_probe probe;
|
||||
const char *elf_target = select_exec_target(target, resolved_target, sizeof(resolved_target), &probe);
|
||||
if (probe.is_elf && !probe.is_dynamic) static_elf = elf_target;
|
||||
@@ -969,7 +970,8 @@ static int ddnatv_posix_spawn(pid_t *pid, const char *path,
|
||||
}
|
||||
|
||||
char *const *orig_ep = envp ? envp : environ;
|
||||
int in_root = (g_ddnatv_root[0] != '\0' && strncmp(target, g_ddnatv_root, g_ddnatv_root_len) == 0) || is_mapped_guest_path(path);
|
||||
int in_root = (g_ddnatv_root[0] != '\0' && strncmp(target, g_ddnatv_root, g_ddnatv_root_len) == 0) || is_mapped_guest_path(path) ||
|
||||
is_bound_guest_program(target);
|
||||
|
||||
struct exec_probe probe;
|
||||
char resolved_target[PATH_MAX];
|
||||
|
||||
@@ -983,6 +983,14 @@ static int is_host_interpreter(const char *interp, const char *rewritten) {
|
||||
return probe.android_interp;
|
||||
}
|
||||
|
||||
static int is_bound_guest_program(const char *path) {
|
||||
if (g_ddnatv_root[0] == '\0' || !is_identity_bound_path(path)) return 0;
|
||||
struct exec_probe probe;
|
||||
probe_exec_file(path, &probe);
|
||||
if (probe.is_elf) return probe.is_dynamic && !probe.android_interp;
|
||||
return probe.n >= 2 && probe.hdr[0] == '#' && probe.hdr[1] == '!';
|
||||
}
|
||||
|
||||
// argv for running `script` with its interpreter: interp [arg] script args... (the script's own
|
||||
// argv[0] is dropped, as the kernel does). free() the result.
|
||||
static char **build_script_argv(const char *interp, const char *interp_arg, const char *script, char *const argv[]) {
|
||||
|
||||
@@ -234,6 +234,13 @@ static int is_mapped_guest_path(const char *path) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int is_identity_bound_path(const char *path) {
|
||||
if (!path || path[0] != '/') return 0;
|
||||
for (int i = 0; i < g_nbinds; i++)
|
||||
if (g_binds[i].identity && is_path_prefix(path, g_binds[i].dst, g_binds[i].dst_len)) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Android's own mounts and files, which must never be redirected into the rootfs.
|
||||
// `path` starts with '/'; a prefix can only match when its second character does.
|
||||
static int is_android_host_path(const char *path) {
|
||||
|
||||
@@ -32,6 +32,7 @@ def source_assets(overlay=OVERLAY):
|
||||
result[desktop / name] = 'assets/linuxfs/usr/local/bin/' + name
|
||||
result[desktop / 'firefox-droiddeck.js'] = 'assets/linuxfs/usr/lib/firefox/defaults/pref/droiddeck.js'
|
||||
result[desktop / 'droiddeck-clipboard.desktop'] = 'assets/linuxfs/etc/xdg/autostart/droiddeck-clipboard.desktop'
|
||||
result[desktop / 'droiddeck-return-gaming.desktop'] = 'assets/linuxfs/usr/share/applications/droiddeck-return-gaming.desktop'
|
||||
result[desktop / 'fastfetch.jsonc'] = 'assets/linuxfs/etc/xdg/fastfetch/config.jsonc'
|
||||
result[overlay.parent.parent / 'mangoapp/mangoapp'] = 'assets/linuxfs/usr/local/bin/mangoapp'
|
||||
return result
|
||||
|
||||
@@ -203,10 +203,17 @@ static void test_handle_map_null_key(void)
|
||||
map_free(&map);
|
||||
}
|
||||
|
||||
static int zink_instance_table;
|
||||
static struct object mock_zink_instance = {&zink_instance_table};
|
||||
static struct object mock_arm = {&instance_table};
|
||||
static struct object mock_zink_arm = {&zink_instance_table}, mock_zink_other = {&zink_instance_table};
|
||||
|
||||
static VkResult VKAPI_CALL mock_create_instance(const VkInstanceCreateInfo *info, const VkAllocationCallbacks *allocator,
|
||||
VkInstance *instance)
|
||||
{
|
||||
*instance = (VkInstance)&mock_instance;
|
||||
const VkApplicationInfo *app = info->pApplicationInfo;
|
||||
bool zink = app && app->pEngineName && !strcmp(app->pEngineName, "mesa zink");
|
||||
*instance = (VkInstance)(zink ? &mock_zink_instance : &mock_instance);
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -223,6 +230,7 @@ static void VKAPI_CALL mock_features(VkPhysicalDevice physical, VkPhysicalDevice
|
||||
{
|
||||
memset(features, 0, sizeof(*features));
|
||||
features->dualSrcBlend = physical == (VkPhysicalDevice)&mock_capable;
|
||||
features->geometryShader = VK_TRUE;
|
||||
}
|
||||
|
||||
static void VKAPI_CALL mock_features2(VkPhysicalDevice physical, VkPhysicalDeviceFeatures2 *features)
|
||||
@@ -234,6 +242,8 @@ static void VKAPI_CALL mock_properties(VkPhysicalDevice physical, VkPhysicalDevi
|
||||
{
|
||||
memset(properties, 0, sizeof(*properties));
|
||||
strcpy(properties->deviceName, "mock");
|
||||
bool arm = physical == (VkPhysicalDevice)&mock_arm || physical == (VkPhysicalDevice)&mock_zink_arm;
|
||||
properties->vendorID = arm ? 0x13b5 : 0;
|
||||
properties->limits.maxFragmentDualSrcAttachments = physical == (VkPhysicalDevice)&mock_capable;
|
||||
}
|
||||
|
||||
@@ -385,6 +395,50 @@ static void destroy_device(VkDevice device)
|
||||
((PFN_vkDestroyDevice)layer_gdpa(device, "vkDestroyDevice"))(device, NULL);
|
||||
}
|
||||
|
||||
static void test_geometry_shader_hidden_from_zink(void)
|
||||
{
|
||||
VkPhysicalDeviceFeatures features;
|
||||
PFN_vkGetPhysicalDeviceFeatures plain_features =
|
||||
(PFN_vkGetPhysicalDeviceFeatures)layer_gipa((VkInstance)&mock_instance, "vkGetPhysicalDeviceFeatures");
|
||||
PFN_vkGetPhysicalDeviceFeatures2 plain_features2 =
|
||||
(PFN_vkGetPhysicalDeviceFeatures2)layer_gipa((VkInstance)&mock_instance, "vkGetPhysicalDeviceFeatures2");
|
||||
VkPhysicalDeviceFeatures2 queried = {.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2};
|
||||
plain_features((VkPhysicalDevice)&mock_lacking, &features);
|
||||
assert(features.geometryShader);
|
||||
plain_features((VkPhysicalDevice)&mock_arm, &features);
|
||||
assert(features.geometryShader);
|
||||
plain_features2((VkPhysicalDevice)&mock_arm, &queried);
|
||||
assert(queried.features.geometryShader);
|
||||
|
||||
VkApplicationInfo app = {.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO, .pEngineName = "mesa zink"};
|
||||
VkLayerInstanceLink link = {NULL, mock_gipa, NULL};
|
||||
VkLayerInstanceCreateInfo loader = {VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO, NULL, VK_LAYER_LINK_INFO, {&link}};
|
||||
VkInstanceCreateInfo info = {.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, .pNext = &loader,
|
||||
.pApplicationInfo = &app};
|
||||
VkInstance zink;
|
||||
assert(((PFN_vkCreateInstance)layer_gipa(NULL, "vkCreateInstance"))(&info, NULL, &zink) == VK_SUCCESS);
|
||||
assert(zink == (VkInstance)&mock_zink_instance);
|
||||
PFN_vkGetPhysicalDeviceFeatures zink_features =
|
||||
(PFN_vkGetPhysicalDeviceFeatures)layer_gipa(zink, "vkGetPhysicalDeviceFeatures");
|
||||
PFN_vkGetPhysicalDeviceFeatures2 zink_features2 =
|
||||
(PFN_vkGetPhysicalDeviceFeatures2)layer_gipa(zink, "vkGetPhysicalDeviceFeatures2");
|
||||
zink_features((VkPhysicalDevice)&mock_zink_arm, &features);
|
||||
assert(!features.geometryShader && features.dualSrcBlend);
|
||||
zink_features2((VkPhysicalDevice)&mock_zink_arm, &queried);
|
||||
assert(!queried.features.geometryShader && queried.features.dualSrcBlend);
|
||||
zink_features((VkPhysicalDevice)&mock_zink_other, &features);
|
||||
assert(features.geometryShader);
|
||||
|
||||
setenv("DROIDDECK_MALI_COMPAT_NO_GS", "0", 1);
|
||||
zink_features((VkPhysicalDevice)&mock_zink_arm, &features);
|
||||
assert(features.geometryShader);
|
||||
setenv("DROIDDECK_MALI_COMPAT_NO_GS", "1", 1);
|
||||
plain_features((VkPhysicalDevice)&mock_lacking, &features);
|
||||
assert(!features.geometryShader);
|
||||
unsetenv("DROIDDECK_MALI_COMPAT_NO_GS");
|
||||
((PFN_vkDestroyInstance)layer_gipa(zink, "vkDestroyInstance"))(zink, NULL);
|
||||
}
|
||||
|
||||
static const VkPipelineColorBlendAttachmentState dual_attachment = {
|
||||
VK_TRUE, VK_BLEND_FACTOR_ONE, VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR, VK_BLEND_OP_ADD,
|
||||
VK_BLEND_FACTOR_SRC1_ALPHA, VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA, VK_BLEND_OP_ADD, 0xf,
|
||||
@@ -575,6 +629,7 @@ int main(int argc, char **argv)
|
||||
setenv("WINEPREFIX", "/nonexistent", 1);
|
||||
unsetenv("DROIDDECK_MALI_COMPAT");
|
||||
unsetenv("DROIDDECK_MALI_COMPAT_TRACE");
|
||||
unsetenv("DROIDDECK_MALI_COMPAT_NO_GS");
|
||||
VkNegotiateLayerInterface negotiate = {LAYER_NEGOTIATE_INTERFACE_STRUCT, NULL, 2, NULL, NULL, NULL};
|
||||
assert(vkNegotiateLoaderLayerInterfaceVersion(&negotiate) == VK_SUCCESS);
|
||||
layer_gipa = negotiate.pfnGetInstanceProcAddr;
|
||||
@@ -587,6 +642,7 @@ int main(int argc, char **argv)
|
||||
PFN_vkCreateInstance create_instance = (PFN_vkCreateInstance)layer_gipa(NULL, "vkCreateInstance");
|
||||
assert(create_instance(&info, NULL, &instance) == VK_SUCCESS);
|
||||
|
||||
test_geometry_shader_hidden_from_zink();
|
||||
test_lacking_device();
|
||||
test_capable_device();
|
||||
test_depth_compare_op();
|
||||
|
||||
@@ -5,6 +5,8 @@ from pathlib import Path
|
||||
import re
|
||||
import runpy
|
||||
import shutil
|
||||
import stat
|
||||
import struct
|
||||
import tempfile
|
||||
import time
|
||||
import unittest
|
||||
@@ -1493,6 +1495,103 @@ class AgentTest(Temp):
|
||||
self.assertIn('var patch = zone == "cn" ? "cn.patch.battlenet.com.cn" : zone + ".patch.battle.net";', script)
|
||||
self.assertIn("+ patch + ':1119/'", script)
|
||||
|
||||
def test_the_driver_maps_game_dir_errors_to_readable_reasons(self):
|
||||
script = BNET["AGENT_SCRIPT"]
|
||||
self.assertIn('if (code == 703) reason = "Battle.net could not access the game folder (error 703)";', script)
|
||||
self.assertIn('if (code == 800) reason = "the game folder already holds a game";', script)
|
||||
|
||||
|
||||
class InstallFolderHealTest(Temp):
|
||||
def test_stale_owners_in_the_install_folder_are_cleared(self):
|
||||
roots, notes = [], []
|
||||
|
||||
def heal(root):
|
||||
roots.append(root)
|
||||
return ["Data"], [".", "Data"]
|
||||
|
||||
with mock.patch.object(BNET["runpy"], "run_path", return_value={"heal_shared_data_locked": heal}), \
|
||||
mock.patch.dict(BNET, {"say": notes.append}):
|
||||
BNET["heal_install_folder"](str(self.tmp / "install"))
|
||||
self.assertEqual(roots, [self.tmp / "install"])
|
||||
self.assertEqual(notes, ["cleared 2 stale Windows owners in the game folder; unlocked: Data"])
|
||||
|
||||
def test_a_folder_that_cannot_be_checked_does_not_stop_the_install(self):
|
||||
for error in (OSError("xattrs"), KeyError("heal_shared_data_locked")):
|
||||
with self.subTest(error=error), mock.patch.object(BNET["runpy"], "run_path", side_effect=error):
|
||||
self.assertIsNone(BNET["heal_install_folder"](str(self.tmp / "install")))
|
||||
|
||||
def test_unreadable_install_folder_entries_are_made_writable(self):
|
||||
folder = self.tmp / "install"
|
||||
data = folder / "Data"
|
||||
data.mkdir(parents=True)
|
||||
blocked = data / "data"
|
||||
blocked.write_bytes(b"x")
|
||||
blocked.chmod(0o400)
|
||||
data.chmod(0o500)
|
||||
folder.chmod(0o500)
|
||||
try:
|
||||
with mock.patch.object(BNET["runpy"], "run_path", return_value={"heal_shared_data_locked": lambda root: ([], [])}):
|
||||
BNET["heal_install_folder"](str(folder))
|
||||
self.assertEqual(stat.S_IMODE(folder.stat().st_mode), 0o700)
|
||||
self.assertEqual(stat.S_IMODE(data.stat().st_mode), 0o700)
|
||||
self.assertEqual(stat.S_IMODE(blocked.stat().st_mode), 0o600)
|
||||
finally:
|
||||
folder.chmod(0o700)
|
||||
data.chmod(0o700)
|
||||
blocked.chmod(0o600)
|
||||
|
||||
def test_unreadable_descendants_are_repaired_before_windows_cleanup(self):
|
||||
folder = self.tmp / "install"
|
||||
data = folder / "Data"
|
||||
data.mkdir(parents=True)
|
||||
blocked = data / "payload"
|
||||
blocked.write_bytes(b"x")
|
||||
sibling = self.write("other/payload", "keep", 0o440)
|
||||
linked = self.write("external/payload", "keep", 0o440)
|
||||
(folder / "link").symlink_to(linked.parent, target_is_directory=True)
|
||||
subs = (21, 0x0badf00d, 0x0ddba11, 10122, 1000)
|
||||
sid = bytes([1, len(subs)]) + (5).to_bytes(6, "big") + struct.pack("<5I", *subs)
|
||||
descriptor = b"\x01\x00" + struct.pack("<BBHIIII", 1, 0, 0x8004, len(sid), 0, 0, 0) + sid
|
||||
try:
|
||||
os.setxattr(blocked, "user.wine.sd", descriptor)
|
||||
except OSError:
|
||||
self.skipTest("needs user xattrs")
|
||||
blocked.chmod(0)
|
||||
data.chmod(0o300)
|
||||
folder.chmod(0o2510)
|
||||
scan = os.scandir
|
||||
|
||||
def checked_scan(path):
|
||||
self.assertEqual(stat.S_IMODE(os.stat(path).st_mode) & 0o700, 0o700)
|
||||
return scan(path)
|
||||
|
||||
try:
|
||||
with mock.patch.object(BNET["os"], "scandir", side_effect=checked_scan):
|
||||
BNET["heal_install_folder"](str(folder))
|
||||
self.assertEqual(stat.S_IMODE(folder.stat().st_mode), 0o2710)
|
||||
self.assertEqual(stat.S_IMODE(data.stat().st_mode), 0o700)
|
||||
self.assertEqual(stat.S_IMODE(blocked.stat().st_mode), 0o600)
|
||||
self.assertNotIn("user.wine.sd", os.listxattr(blocked))
|
||||
self.assertEqual(stat.S_IMODE(sibling.stat().st_mode), 0o440)
|
||||
self.assertEqual(stat.S_IMODE(linked.stat().st_mode), 0o440)
|
||||
finally:
|
||||
folder.chmod(0o700)
|
||||
data.chmod(0o700)
|
||||
blocked.chmod(0o600)
|
||||
|
||||
def test_symlinked_roots_and_ancestors_are_not_repaired(self):
|
||||
target = self.tmp / "external"
|
||||
target.mkdir()
|
||||
payload = self.write("external/install/payload", "keep", 0o400)
|
||||
link = self.tmp / "link"
|
||||
link.symlink_to(target, target_is_directory=True)
|
||||
with mock.patch.object(BNET["runpy"], "run_path") as cleanup:
|
||||
for folder in (link, link / "install"):
|
||||
BNET["heal_install_folder"](str(folder))
|
||||
BNET["_heal_install_permissions"](str(folder))
|
||||
cleanup.assert_not_called()
|
||||
self.assertEqual(stat.S_IMODE(payload.stat().st_mode), 0o400)
|
||||
|
||||
|
||||
class AgentJobTest(Harness):
|
||||
def setUp(self):
|
||||
@@ -1520,6 +1619,7 @@ class AgentJobTest(Harness):
|
||||
"stop_leftovers": lambda pfx: True, "CACHE": str(self.tmp / "cache")})
|
||||
patcher.start()
|
||||
self.addCleanup(patcher.stop)
|
||||
self.child = Child
|
||||
popen = mock.patch.object(BNET["subprocess"], "Popen", Child)
|
||||
popen.start()
|
||||
self.addCleanup(popen.stop)
|
||||
@@ -1547,6 +1647,25 @@ class AgentJobTest(Harness):
|
||||
self.assertEqual([kind for kind, _ in self.lines], ["STATE", "PROGRESS", "DONE"])
|
||||
self.assertEqual(json.loads(self.lines[-1][1]), {"install_dir": "Z:" + folder, "exe": "WarcraftRumble.exe", "version": "16.1.2.119725"})
|
||||
|
||||
def test_an_install_heals_stale_owners_before_it_starts_the_agent(self):
|
||||
self.install()
|
||||
folder = str(self.tmp / "Games/Battle.net/World of Warcraft")
|
||||
self.files = {".json": json.dumps({"state": 1004, "download_complete": True}),
|
||||
".game": json.dumps({"installed": True, "playable": True, "install_dir": "Z:" + folder,
|
||||
"local_version": "1"})}
|
||||
events = []
|
||||
|
||||
class Recording(self.child):
|
||||
def __init__(self, cmd, **kwargs):
|
||||
events.append("popen")
|
||||
super().__init__(cmd, **kwargs)
|
||||
|
||||
with mock.patch.dict(BNET, {"heal_install_folder": lambda path: events.append(("heal", path))}), \
|
||||
mock.patch.object(BNET["subprocess"], "Popen", Recording):
|
||||
code = BNET["agent_job"](self.root, "install", "wow", "wow", folder, "enUS", "USA", "US", poll=0)
|
||||
self.assertEqual(code, 0)
|
||||
self.assertEqual(events, [("heal", folder), "popen"])
|
||||
|
||||
def test_an_install_on_another_volume_is_handed_over_by_its_drive_once_the_prefix_is_stopped(self):
|
||||
self.install()
|
||||
card = self.tmp / "card"
|
||||
@@ -1597,7 +1716,9 @@ class AgentJobTest(Harness):
|
||||
self.install()
|
||||
self.files = {".json": json.dumps({"progress": 1.0}),
|
||||
".game": json.dumps({"installed": True, "playable": True, "install_dir": "Z:/g", "local_version": "2"})}
|
||||
self.assertEqual(BNET["agent_job"](self.root, "update", "gryphon", poll=0), 0)
|
||||
with mock.patch.dict(BNET, {"heal_install_folder": mock.Mock()}) as values:
|
||||
self.assertEqual(BNET["agent_job"](self.root, "update", "gryphon", poll=0), 0)
|
||||
values["heal_install_folder"].assert_not_called()
|
||||
self.assertIn("agent-serve", self.started[0])
|
||||
self.assertEqual(json.loads(self.lines[-1][1])["version"], "2")
|
||||
|
||||
@@ -1748,7 +1869,9 @@ class AgentJobTest(Harness):
|
||||
def test_an_uninstall_is_done_once_the_agent_no_longer_lists_it(self):
|
||||
self.install()
|
||||
self.files = {".json": json.dumps({}), ".game": json.dumps({"installed": False})}
|
||||
self.assertEqual(BNET["agent_job"](self.root, "uninstall", "gryphon", poll=0), 0)
|
||||
with mock.patch.dict(BNET, {"heal_install_folder": mock.Mock()}) as values:
|
||||
self.assertEqual(BNET["agent_job"](self.root, "uninstall", "gryphon", poll=0), 0)
|
||||
values["heal_install_folder"].assert_not_called()
|
||||
self.assertEqual(self.lines[-1], ("DONE", json.dumps({"uninstalled": "gryphon"})))
|
||||
|
||||
def test_a_gamescope_that_cannot_start_is_reported(self):
|
||||
@@ -1784,7 +1907,9 @@ class AgentJobTest(Harness):
|
||||
self.assertEqual(BNET["agent_job"](self.root, "uninstall", "gryphon", poll=0), 1)
|
||||
self.assertEqual(self.lines[-1][0], "ERROR")
|
||||
self.files = {".game": json.dumps({})}
|
||||
self.assertEqual(BNET["agent_job"](self.root, "uninstall", "gryphon", poll=0), 0)
|
||||
with mock.patch.dict(BNET, {"heal_install_folder": mock.Mock()}) as values:
|
||||
self.assertEqual(BNET["agent_job"](self.root, "uninstall", "gryphon", poll=0), 0)
|
||||
values["heal_install_folder"].assert_not_called()
|
||||
self.assertEqual(self.lines[-1], ("DONE", json.dumps({"uninstalled": "gryphon"})))
|
||||
|
||||
def test_without_battle_net_nothing_starts(self):
|
||||
@@ -1796,7 +1921,9 @@ class AgentJobTest(Harness):
|
||||
self.install()
|
||||
self.states = [self.clients() + [(40, self.GAME)], [(40, self.GAME)], []]
|
||||
self.files = {".game": json.dumps({"installed": False})}
|
||||
self.assertEqual(BNET["agent_job"](self.root, "uninstall", "gryphon", poll=0), 0)
|
||||
with mock.patch.dict(BNET, {"heal_install_folder": mock.Mock()}) as values:
|
||||
self.assertEqual(BNET["agent_job"](self.root, "uninstall", "gryphon", poll=0), 0)
|
||||
values["heal_install_folder"].assert_not_called()
|
||||
self.assertEqual(self.lines[0], ("STATE", "waiting"))
|
||||
self.assertEqual(self.lines[1], ("STATE", "starting"))
|
||||
|
||||
|
||||
@@ -24,6 +24,28 @@ class CiChecksTest(unittest.TestCase):
|
||||
gradle = (ROOT / 'app/build.gradle').read_text()
|
||||
self.assertIn("gitValue(['show', '-s', '--format=%ct', '--end-of-options', sourceCommit])", gradle)
|
||||
|
||||
def test_robolectric_cache_saves_and_restores_the_same_absolute_path(self):
|
||||
steps = yaml.safe_load((ROOT / '.github/workflows/build.yml').read_text())['jobs']['build']['steps']
|
||||
caches = [step['with'] for step in steps if step.get('uses', '').startswith('actions/cache')]
|
||||
for cache in caches:
|
||||
for path in cache['path'].split('\n'):
|
||||
self.assertNotIn('..', path.split('/'))
|
||||
robolectric = [cache['path'] for cache in caches if cache['key'].startswith('robolectric-')]
|
||||
self.assertEqual(robolectric, ['${{ steps.robolectric-jars.outputs.path }}'] * 2)
|
||||
|
||||
def test_unit_test_retry_requires_maven_exception(self):
|
||||
steps = yaml.safe_load((ROOT / '.github/workflows/build.yml').read_text())['jobs']['build']['steps']
|
||||
run = next(step['run'] for step in steps if step.get('id') == 'unit-tests')
|
||||
line = next(line for line in run.splitlines() if 'grep -Eq' in line)
|
||||
pattern = shlex.split(line)[shlex.split(line).index('-Eq') + 1]
|
||||
for log, expected in (
|
||||
("Caused by: org.gradle.internal.resource.transport.http.HttpErrorStatusCodeException: Could not GET 'https://repo.maven.apache.org/maven2/a.jar'. Received status code 429 from server: Too Many Requests", 0),
|
||||
("Caused by: java.io.IOException: Server returned HTTP response code: 429 for URL: https://repo.maven.apache.org/maven2/a.jar", 0),
|
||||
("SomeTest > test FAILED: Too Many Requests", 1),
|
||||
("Caused by: java.lang.AssertionError: HTTP 429", 1),
|
||||
):
|
||||
self.assertEqual(subprocess.run(['grep', '-Eq', pattern], input=log, text=True).returncode, expected)
|
||||
|
||||
def test_report_comment_lookup_ignores_human_marker(self):
|
||||
if not shutil.which('jq'):
|
||||
self.skipTest('jq required to execute comment selection')
|
||||
|
||||
Loaded 100 of 125 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user