Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
078a2d18dd |
No files matched your search
@@ -7,7 +7,7 @@
|
||||
|
||||
DroidDeck brings the SteamOS experience to Android: Steam Gaming Mode, full Linux desktop, integration with GOG, Epic Games, Xbox, and other storefronts, Steam VR, and more!
|
||||
|
||||
<p align="center"><b>100% open source. No ads. No Subscriptions. No telemetry. No proprietary components. No source withheld.</b></p>
|
||||
<p align="center"><b>100% open source. No ads. No telemetry. No proprietary components. No source withheld.</b></p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/Droid-Deck/DroidDeck/releases/download/0.7.1/DroidDeck-0.7.1.apk"><img src="https://img.shields.io/badge/Download-DroidDeck%200.7.1%20APK-3DDC84?style=for-the-badge&logo=android&logoColor=white" alt="Download DroidDeck 0.7.1"></a>
|
||||
@@ -23,7 +23,7 @@ DroidDeck brings the SteamOS experience to Android: Steam Gaming Mode, full Linu
|
||||
<a href="https://trendshift.io/repositories/267852"><img src="https://trendshift.io/api/badge/trendshift/repositories/267852/daily?language=Kotlin" alt="Droid-Deck%2FDroidDeck | Trendshift" width="250" height="55"></a>
|
||||
</p>
|
||||
|
||||
<p align="center"><a href="https://www.youtube.com/watch?v=ruaTSm_7a2c"><img src="docs/media/droiddeck-showcase.gif" width="60%" alt="A table of handhelds and phones all running DroidDeck, one waking to the Steam menu, the AYN Thor's bottom screen used as a touchpad, and scrolling around Steam on a phone before swiping to the home screen. Footage from Cyber Dopamine's video, linked."></a></p>
|
||||
<p align="center"><img src="docs/media/steam-to-desktop.gif" width="100%" alt="On a Retroid Pocket Duo: Play Steam from the DroidDeck launcher, open Pac-Man in Steam Big Picture and play it, exit the game, then Switch to Desktop from the Power menu"></p>
|
||||
|
||||
> The official website is [droid-deck.dev](https://droid-deck.dev). Only download DroidDeck from this repository's [Releases](https://github.com/Droid-Deck/DroidDeck/releases).
|
||||
|
||||
@@ -57,6 +57,9 @@ The APK lands in `app/build/outputs/apk/release/`. Install it with `tools/deploy
|
||||
|
||||
On Windows, see `tools/run_windows.ps1` and `tools/prepare_windows_runtime.py`.
|
||||
|
||||
## Limits
|
||||
|
||||
Compatibility and performance vary by device. Desktop compositing is software rendered, and Firefox sandboxing is reduced under proot.
|
||||
|
||||
## Credits and licence
|
||||
|
||||
|
||||
@@ -132,8 +132,8 @@ android {
|
||||
applicationId "com.droiddeck.launcher"
|
||||
minSdkVersion 26
|
||||
targetSdkVersion 34
|
||||
versionCode 20
|
||||
versionName "0.7.11"
|
||||
versionCode 19
|
||||
versionName "0.7.1"
|
||||
buildConfigField "String", "BUILD_LABEL", "\"${escapedBuildLabel}\""
|
||||
buildConfigField "String", "SOURCE_COMMIT", "\"${sourceCommit}\""
|
||||
buildConfigField "int", "PR_NUMBER", "${prNumber}"
|
||||
|
||||
@@ -58,59 +58,6 @@
|
||||
|
||||
#define EXPORT extern "C" __attribute__((visibility("default")))
|
||||
|
||||
struct SymbolSlot {
|
||||
std::atomic<void *> fn{nullptr};
|
||||
std::atomic<bool> resolved{false};
|
||||
};
|
||||
|
||||
template <typename Fn> static Fn resolved_symbol(SymbolSlot &slot, void *handle, const char *name) {
|
||||
if (!slot.resolved.load(std::memory_order_acquire)) {
|
||||
slot.fn.store(dlsym(handle, name), std::memory_order_relaxed);
|
||||
slot.resolved.store(true, std::memory_order_release);
|
||||
}
|
||||
return reinterpret_cast<Fn>(slot.fn.load(std::memory_order_relaxed));
|
||||
}
|
||||
|
||||
enum class Next : size_t {
|
||||
open,
|
||||
openat,
|
||||
close,
|
||||
write,
|
||||
ioctl,
|
||||
poll,
|
||||
ppoll,
|
||||
select,
|
||||
stat,
|
||||
stat64,
|
||||
fstat,
|
||||
fstat64,
|
||||
xstat,
|
||||
xstat64,
|
||||
fxstat,
|
||||
fxstat64,
|
||||
statx,
|
||||
statfs,
|
||||
fstatfs,
|
||||
access,
|
||||
faccessat,
|
||||
opendir,
|
||||
scandir,
|
||||
inotify_add_watch,
|
||||
count
|
||||
};
|
||||
|
||||
static const char *const next_names[] = {"open", "openat", "close", "write", "ioctl", "poll", "ppoll", "select", "stat", "stat64", "fstat", "fstat64", "__xstat", "__xstat64", "__fxstat", "__fxstat64", "statx", "statfs", "fstatfs", "access", "faccessat", "opendir", "scandir", "inotify_add_watch"};
|
||||
static_assert(sizeof(next_names) / sizeof(next_names[0]) == static_cast<size_t>(Next::count), "next_names");
|
||||
static SymbolSlot next_slots[static_cast<size_t>(Next::count)];
|
||||
|
||||
template <typename Fn> static Fn next_symbol(Next which) {
|
||||
return resolved_symbol<Fn>(next_slots[static_cast<size_t>(which)], RTLD_NEXT, next_names[static_cast<size_t>(which)]);
|
||||
}
|
||||
|
||||
static void resolve_next_symbols() {
|
||||
for (size_t i = 0; i < static_cast<size_t>(Next::count); i++) next_symbol<void *>(static_cast<Next>(i));
|
||||
}
|
||||
|
||||
#ifdef __GLIBC__
|
||||
typedef unsigned long ioctl_request_t;
|
||||
#else
|
||||
@@ -495,7 +442,6 @@ void log(const char *message, ...) {
|
||||
}
|
||||
|
||||
__attribute__((constructor)) static void library_init() {
|
||||
resolve_next_symbols();
|
||||
config();
|
||||
controller_mutex();
|
||||
controller_map();
|
||||
@@ -787,7 +733,7 @@ open_fake_input_ring(const char *event, int flags) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
const auto my_open = next_symbol<int (*)(const char *, int, ...)>(Next::open);
|
||||
static auto my_open = reinterpret_cast<int (*)(const char *, int, ...)>(dlsym(RTLD_NEXT, "open"));
|
||||
|
||||
int fd = my_open(ring_path.c_str(), O_RDWR | (flags & (O_NONBLOCK | O_CLOEXEC)));
|
||||
if (fd < 0)
|
||||
@@ -1054,7 +1000,7 @@ __attribute__((visibility("hidden"))) static void unpublish_uinput(UinputWriter
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) static int claim_uinput_node(int *fd_out) {
|
||||
const auto my_open = next_symbol<int (*)(const char *, int, ...)>(Next::open);
|
||||
static auto my_open = reinterpret_cast<int (*)(const char *, int, ...)>(dlsym(RTLD_NEXT, "open"));
|
||||
for (int node = UINPUT_EVENT_BASE; node < UINPUT_EVENT_LIMIT; node++) {
|
||||
std::string path = uinput_ring_path(node);
|
||||
int fd = my_open(path.c_str(), O_RDWR | O_CREAT | O_EXCL | O_CLOEXEC, 0644);
|
||||
@@ -1081,7 +1027,7 @@ __attribute__((visibility("hidden"))) static int claim_uinput_node(int *fd_out)
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) static int publish_uinput(UinputWriter &w) {
|
||||
const auto my_open = next_symbol<int (*)(const char *, int, ...)>(Next::open);
|
||||
static auto my_open = reinterpret_cast<int (*)(const char *, int, ...)>(dlsym(RTLD_NEXT, "open"));
|
||||
int fd = -1;
|
||||
int node = claim_uinput_node(&fd);
|
||||
if (node < 0) return -1;
|
||||
@@ -1494,7 +1440,7 @@ __attribute__((visibility("hidden"))) static const uint8_t *ring_blocks() {
|
||||
std::lock_guard<std::mutex> guard(lock);
|
||||
if ((mapped = block.load(std::memory_order_acquire))) return mapped;
|
||||
tries.fetch_add(1, std::memory_order_relaxed);
|
||||
const auto my_open = next_symbol<int (*)(const char *, int, ...)>(Next::open);
|
||||
static auto my_open = reinterpret_cast<int (*)(const char *, int, ...)>(dlsym(RTLD_NEXT, "open"));
|
||||
std::string path = get_ring_path_for_slot(0);
|
||||
int fd = path.empty() ? -1 : my_open(path.c_str(), O_RDONLY | O_CLOEXEC);
|
||||
if (fd < 0) return nullptr;
|
||||
@@ -1847,7 +1793,7 @@ __attribute__((visibility("hidden"))) static void *sony_report_thread(void *arg)
|
||||
|
||||
__attribute__((visibility("hidden"))) static int open_deck_hidraw(int flags, uint8_t sony = 0) {
|
||||
const char *path = sony == 4 ? DS4_HIDRAW_PATH : sony == 5 ? DUALSENSE_HIDRAW_PATH : DECK_HIDRAW_PATH;
|
||||
const auto my_open = next_symbol<int (*)(const char *, int, ...)>(Next::open);
|
||||
static auto my_open = reinterpret_cast<int (*)(const char *, int, ...)>(dlsym(RTLD_NEXT, "open"));
|
||||
if (!process_reads_pads()) {
|
||||
Logger::log("deck: %s refused: not the Steam client\n", path);
|
||||
errno = ENOENT;
|
||||
@@ -2056,7 +2002,7 @@ __attribute__((visibility("hidden"))) static void *triton_pad_thread(void *arg)
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) static int open_triton_hidraw(int flags, bool emulated) {
|
||||
const auto my_open = next_symbol<int (*)(const char *, int, ...)>(Next::open);
|
||||
static auto my_open = reinterpret_cast<int (*)(const char *, int, ...)>(dlsym(RTLD_NEXT, "open"));
|
||||
if (!process_reads_pads()) {
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
@@ -2175,7 +2121,7 @@ __attribute__((visibility("hidden"))) static TouchRingFile *touch_ring() {
|
||||
std::call_once(once, [] {
|
||||
const char *path = getenv("FAKE_TOUCHCTL_RING");
|
||||
if (!path || !*path || !fake_deck_enabled()) return;
|
||||
const auto my_open = next_symbol<int (*)(const char *, int, ...)>(Next::open);
|
||||
static auto my_open = reinterpret_cast<int (*)(const char *, int, ...)>(dlsym(RTLD_NEXT, "open"));
|
||||
int fd = my_open(path, O_RDWR | O_CLOEXEC);
|
||||
if (fd < 0) {
|
||||
Logger::log("touch: %s not openable (%s)\n", path, strerror(errno));
|
||||
@@ -2392,8 +2338,7 @@ __attribute__((visibility("hidden"))) static int inject_uevent(const char *actio
|
||||
const char *subsystem, const char *devname,
|
||||
unsigned major, unsigned minor) {
|
||||
using inject_fn = int (*)(const char *, const char *, const char *, const char *, unsigned, unsigned);
|
||||
static SymbolSlot inject_slot;
|
||||
const auto inject = resolved_symbol<inject_fn>(inject_slot, RTLD_DEFAULT, "dd_udevmon_inject");
|
||||
static auto inject = reinterpret_cast<inject_fn>(dlsym(RTLD_DEFAULT, "dd_udevmon_inject"));
|
||||
return inject ? inject(action, devpath, subsystem, devname, major, minor) : -1;
|
||||
}
|
||||
|
||||
@@ -2551,7 +2496,7 @@ __attribute__((visibility("hidden"))) static void note_deck_sysfs(const char *ho
|
||||
}
|
||||
|
||||
EXPORT int fstatfs(int fd, struct statfs *buf) {
|
||||
const auto real = next_symbol<int (*)(int, struct statfs *)>(Next::fstatfs);
|
||||
static auto real = reinterpret_cast<int (*)(int, struct statfs *)>(dlsym(RTLD_NEXT, "fstatfs"));
|
||||
int result = real(fd, buf);
|
||||
if (fake_deck_enabled() && is_deck_sysfs_fd(fd)) {
|
||||
note_deck_sysfs("fstatfs", result);
|
||||
@@ -2561,7 +2506,7 @@ EXPORT int fstatfs(int fd, struct statfs *buf) {
|
||||
}
|
||||
|
||||
EXPORT int statfs(const char *path, struct statfs *buf) {
|
||||
const auto real = next_symbol<int (*)(const char *, struct statfs *)>(Next::statfs);
|
||||
static auto real = reinterpret_cast<int (*)(const char *, struct statfs *)>(dlsym(RTLD_NEXT, "statfs"));
|
||||
int result = real(path, buf);
|
||||
if (fake_deck_enabled() && is_deck_sysfs_path(path)) {
|
||||
note_deck_sysfs(path, result);
|
||||
@@ -2610,7 +2555,7 @@ __attribute__((visibility("hidden"))) static int deck_imu_mode_change(const uint
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) static void publish_imu_mode(const DeckHidraw &deck, int mode) {
|
||||
const auto my_open = next_symbol<int (*)(const char *, int, ...)>(Next::open);
|
||||
static auto my_open = reinterpret_cast<int (*)(const char *, int, ...)>(dlsym(RTLD_NEXT, "open"));
|
||||
if (deck.mapping_size < FAKE_INPUT_RING_SIZE + DECK_IMU_BLOCK_SIZE) return;
|
||||
std::string path = get_ring_path_for_slot(0);
|
||||
int fd = path.empty() ? -1 : my_open(path.c_str(), O_WRONLY | O_CLOEXEC);
|
||||
@@ -3119,7 +3064,7 @@ static int real_fstat(int fd, struct stat *buf);
|
||||
|
||||
__attribute__((visibility("hidden"))) static bool deck_mount_id_from_fdinfo(
|
||||
int dirfd, const char *path, int flags, struct statx *buf) {
|
||||
const auto real_openat = next_symbol<decltype(&::openat)>(Next::openat);
|
||||
static auto real_openat = reinterpret_cast<decltype(&::openat)>(dlsym(RTLD_NEXT, "openat"));
|
||||
int target;
|
||||
if (!path || !*path) {
|
||||
if (!(flags & AT_EMPTY_PATH)) return false;
|
||||
@@ -3157,7 +3102,7 @@ __attribute__((visibility("hidden"))) static bool deck_mount_id_from_fdinfo(
|
||||
}
|
||||
|
||||
EXPORT int statx(int dirfd, const char *path, int flags, unsigned mask, struct statx *buf) {
|
||||
const auto real = next_symbol<decltype(&::statx)>(Next::statx);
|
||||
static auto real = reinterpret_cast<decltype(&::statx)>(dlsym(RTLD_NEXT, "statx"));
|
||||
int result = real(dirfd, path, flags, mask, buf);
|
||||
int saved_errno = errno;
|
||||
constexpr unsigned unique_mount_id = 0x4000;
|
||||
@@ -3178,7 +3123,7 @@ EXPORT int statx(int dirfd, const char *path, int flags, unsigned mask, struct s
|
||||
#endif
|
||||
|
||||
EXPORT DIR *opendir(const char *name) {
|
||||
const auto real = next_symbol<DIR *(*)(const char *)>(Next::opendir);
|
||||
static auto real = reinterpret_cast<DIR *(*)(const char *)>(dlsym(RTLD_NEXT, "opendir"));
|
||||
DIR *dir = real(name);
|
||||
if (!dir) {
|
||||
note_sys_failure(AT_FDCWD, name);
|
||||
@@ -3208,7 +3153,7 @@ EXPORT int open(const char *pathname, int flags, ...) {
|
||||
|
||||
va_end(va);
|
||||
|
||||
const auto my_open = next_symbol<int (*)(const char *, int, ...)>(Next::open);
|
||||
static auto my_open = reinterpret_cast<int (*)(const char *, int, ...)>(dlsym(RTLD_NEXT, "open"));
|
||||
|
||||
if (fake_uinput_enabled() && is_uinput_path(pathname)) return open_uinput(flags);
|
||||
if (is_deck_hidraw_path(pathname)) return open_deck_hidraw(flags);
|
||||
@@ -3286,7 +3231,7 @@ EXPORT int openat(int dirfd, const char *pathname, int flags, ...) {
|
||||
|
||||
va_end(va);
|
||||
|
||||
const auto my_openat = next_symbol<int (*)(int, const char *, int, ...)>(Next::openat);
|
||||
static auto my_openat = reinterpret_cast<int (*)(int, const char *, int, ...)>(dlsym(RTLD_NEXT, "openat"));
|
||||
|
||||
if (fake_uinput_enabled() && is_uinput_path(pathname)) return open_uinput(flags);
|
||||
if (is_deck_hidraw_path(pathname)) return open_deck_hidraw(flags);
|
||||
@@ -3445,10 +3390,10 @@ static int fake_stat_fd(int fd, S *buf, Real real) {
|
||||
}
|
||||
|
||||
static int real_stat(const char *pathname, struct stat *statbuf) {
|
||||
const auto fn = next_symbol<int (*)(const char *, struct stat *)>(Next::stat);
|
||||
static auto fn = reinterpret_cast<int (*)(const char *, struct stat *)>(dlsym(RTLD_NEXT, "stat"));
|
||||
if (fn) return fn(pathname, statbuf);
|
||||
#ifdef _STAT_VER
|
||||
const auto xfn = next_symbol<int (*)(int, const char *, struct stat *)>(Next::xstat);
|
||||
static auto xfn = reinterpret_cast<int (*)(int, const char *, struct stat *)>(dlsym(RTLD_NEXT, "__xstat"));
|
||||
if (xfn) return xfn(_STAT_VER, pathname, statbuf);
|
||||
#endif
|
||||
errno = ENOSYS;
|
||||
@@ -3456,10 +3401,10 @@ static int real_stat(const char *pathname, struct stat *statbuf) {
|
||||
}
|
||||
|
||||
static int real_fstat(int fd, struct stat *buf) {
|
||||
const auto fn = next_symbol<int (*)(int, struct stat *)>(Next::fstat);
|
||||
static auto fn = reinterpret_cast<int (*)(int, struct stat *)>(dlsym(RTLD_NEXT, "fstat"));
|
||||
if (fn) return fn(fd, buf);
|
||||
#ifdef _STAT_VER
|
||||
const auto xfn = next_symbol<int (*)(int, int, struct stat *)>(Next::fxstat);
|
||||
static auto xfn = reinterpret_cast<int (*)(int, int, struct stat *)>(dlsym(RTLD_NEXT, "__fxstat"));
|
||||
if (xfn) return xfn(_STAT_VER, fd, buf);
|
||||
#endif
|
||||
errno = ENOSYS;
|
||||
@@ -3475,7 +3420,7 @@ EXPORT int fstat(int fd, struct stat *buf) {
|
||||
}
|
||||
|
||||
EXPORT int access(const char *pathname, int mode) {
|
||||
const auto my_access = next_symbol<decltype(&::access)>(Next::access);
|
||||
static auto my_access = reinterpret_cast<decltype(&::access)>(dlsym(RTLD_NEXT, "access"));
|
||||
if (fake_uinput_enabled() && is_uinput_path(pathname)) return 0;
|
||||
if (is_deck_hidraw_path(pathname) && process_reads_pads()) return 0;
|
||||
if ((is_triton_hidraw_path(pathname) || is_triton_pad_path(pathname) || sony_pad_path(pathname)) &&
|
||||
@@ -3516,7 +3461,7 @@ EXPORT int access(const char *pathname, int mode) {
|
||||
}
|
||||
|
||||
EXPORT int faccessat(int dirfd, const char *pathname, int mode, int flags) {
|
||||
const auto my_faccessat = next_symbol<decltype(&::faccessat)>(Next::faccessat);
|
||||
static auto my_faccessat = reinterpret_cast<decltype(&::faccessat)>(dlsym(RTLD_NEXT, "faccessat"));
|
||||
if (fake_uinput_enabled() && is_uinput_path(pathname)) return 0;
|
||||
if (is_deck_hidraw_path(pathname) && process_reads_pads()) return 0;
|
||||
if ((is_triton_hidraw_path(pathname) || is_triton_pad_path(pathname) || sony_pad_path(pathname)) &&
|
||||
@@ -3560,7 +3505,7 @@ EXPORT int scandir(const char *dirp, struct dirent ***namelist,
|
||||
int (*filter)(const struct dirent *),
|
||||
int (*compar)(const struct dirent **,
|
||||
const struct dirent **)) {
|
||||
const auto my_scandir = next_symbol<decltype(&::scandir)>(Next::scandir);
|
||||
static auto my_scandir = reinterpret_cast<decltype(&::scandir)>(dlsym(RTLD_NEXT, "scandir"));
|
||||
|
||||
if (dirp) {
|
||||
if (!strcmp(dirp, "/dev/input")) {
|
||||
@@ -3574,7 +3519,7 @@ EXPORT int scandir(const char *dirp, struct dirent ***namelist,
|
||||
}
|
||||
|
||||
EXPORT int inotify_add_watch(int fd, const char *pathname, uint32_t mask) {
|
||||
const auto my_inotify_add_watch = next_symbol<decltype(&::inotify_add_watch)>(Next::inotify_add_watch);
|
||||
static auto my_inotify_add_watch = reinterpret_cast<decltype(&::inotify_add_watch)>(dlsym(RTLD_NEXT, "inotify_add_watch"));
|
||||
|
||||
char *fake_path = nullptr;
|
||||
if (pathname) {
|
||||
@@ -3713,7 +3658,7 @@ static bool wait_snapshot(std::shared_ptr<FakeController> fake,
|
||||
|
||||
static int forward_ioctl(int fd, ioctl_request_t op, void *argp) {
|
||||
using ioctl_fn = int (*)(int, ioctl_request_t, ...);
|
||||
const auto next = next_symbol<ioctl_fn>(Next::ioctl);
|
||||
static const auto next = reinterpret_cast<ioctl_fn>(dlsym(RTLD_NEXT, "ioctl"));
|
||||
return next ? next(fd, op, argp) : static_cast<int>(syscall(SYS_ioctl, fd, op, argp));
|
||||
}
|
||||
|
||||
@@ -3952,7 +3897,7 @@ EXPORT int ioctl(int fd, ioctl_request_t op, ...) {
|
||||
}
|
||||
|
||||
EXPORT int close(int fd) {
|
||||
const auto my_close = next_symbol<decltype(&::close)>(Next::close);
|
||||
static auto my_close = reinterpret_cast<decltype(&::close)>(dlsym(RTLD_NEXT, "close"));
|
||||
|
||||
if (!watched(fd)) return my_close(fd);
|
||||
close_uinput(fd);
|
||||
@@ -4140,7 +4085,7 @@ EXPORT ssize_t readv(int fd, const struct iovec *iov, int iovcnt) {
|
||||
}
|
||||
|
||||
EXPORT ssize_t write(int fd, const void *buf, size_t count) {
|
||||
const auto my_write = next_symbol<decltype(&::write)>(Next::write);
|
||||
static auto my_write = reinterpret_cast<decltype(&::write)>(dlsym(RTLD_NEXT, "write"));
|
||||
|
||||
if (!watched(fd)) return my_write(fd, buf, count);
|
||||
std::unique_lock<std::recursive_mutex> guard(controller_mutex());
|
||||
@@ -4215,8 +4160,8 @@ EXPORT ssize_t writev(int fd, const struct iovec *iov, int iovcnt) {
|
||||
|
||||
static int poll_fake(struct pollfd *fds, nfds_t nfds, int timeout,
|
||||
const sigset_t *sigmask) {
|
||||
const auto my_poll = next_symbol<decltype(&::poll)>(Next::poll);
|
||||
const auto my_ppoll = next_symbol<decltype(&::ppoll)>(Next::ppoll);
|
||||
static auto my_poll = reinterpret_cast<decltype(&::poll)>(dlsym(RTLD_NEXT, "poll"));
|
||||
static auto my_ppoll = reinterpret_cast<decltype(&::ppoll)>(dlsym(RTLD_NEXT, "ppoll"));
|
||||
|
||||
nfds_t first = 0;
|
||||
while (first < nfds && !watched(fds[first].fd)) first++;
|
||||
@@ -4320,7 +4265,7 @@ EXPORT int poll(struct pollfd *fds, nfds_t nfds, int timeout) {
|
||||
|
||||
EXPORT int ppoll(struct pollfd *fds, nfds_t nfds,
|
||||
const struct timespec *timeout, const sigset_t *sigmask) {
|
||||
const auto my_ppoll = next_symbol<decltype(&::ppoll)>(Next::ppoll);
|
||||
static auto my_ppoll = reinterpret_cast<decltype(&::ppoll)>(dlsym(RTLD_NEXT, "ppoll"));
|
||||
if (timeout && (timeout->tv_sec < 0 || timeout->tv_nsec < 0 || timeout->tv_nsec >= 1000000000L)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
@@ -4347,7 +4292,7 @@ EXPORT int ppoll(struct pollfd *fds, nfds_t nfds,
|
||||
|
||||
EXPORT int select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *exceptfds, struct timeval *timeout) {
|
||||
const auto my_select = next_symbol<decltype(&::select)>(Next::select);
|
||||
static auto my_select = reinterpret_cast<decltype(&::select)>(dlsym(RTLD_NEXT, "select"));
|
||||
|
||||
fd_set original_readfds;
|
||||
fd_set original_writefds;
|
||||
@@ -4509,10 +4454,10 @@ EXPORT int openat64(int dirfd, const char *pathname, int flags, ...) {
|
||||
}
|
||||
|
||||
static int real_stat64(const char *pathname, struct stat64 *statbuf) {
|
||||
const auto fn = next_symbol<int (*)(const char *, struct stat64 *)>(Next::stat64);
|
||||
static auto fn = reinterpret_cast<int (*)(const char *, struct stat64 *)>(dlsym(RTLD_NEXT, "stat64"));
|
||||
if (fn) return fn(pathname, statbuf);
|
||||
#ifdef _STAT_VER
|
||||
const auto xfn = next_symbol<int (*)(int, const char *, struct stat64 *)>(Next::xstat64);
|
||||
static auto xfn = reinterpret_cast<int (*)(int, const char *, struct stat64 *)>(dlsym(RTLD_NEXT, "__xstat64"));
|
||||
if (xfn) return xfn(_STAT_VER, pathname, statbuf);
|
||||
#endif
|
||||
errno = ENOSYS;
|
||||
@@ -4520,10 +4465,10 @@ static int real_stat64(const char *pathname, struct stat64 *statbuf) {
|
||||
}
|
||||
|
||||
static int real_fstat64(int fd, struct stat64 *buf) {
|
||||
const auto fn = next_symbol<int (*)(int, struct stat64 *)>(Next::fstat64);
|
||||
static auto fn = reinterpret_cast<int (*)(int, struct stat64 *)>(dlsym(RTLD_NEXT, "fstat64"));
|
||||
if (fn) return fn(fd, buf);
|
||||
#ifdef _STAT_VER
|
||||
const auto xfn = next_symbol<int (*)(int, int, struct stat64 *)>(Next::fxstat64);
|
||||
static auto xfn = reinterpret_cast<int (*)(int, int, struct stat64 *)>(dlsym(RTLD_NEXT, "__fxstat64"));
|
||||
if (xfn) return xfn(_STAT_VER, fd, buf);
|
||||
#endif
|
||||
errno = ENOSYS;
|
||||
@@ -4539,27 +4484,27 @@ EXPORT int fstat64(int fd, struct stat64 *buf) {
|
||||
}
|
||||
|
||||
EXPORT int __xstat(int version, const char *pathname, struct stat *statbuf) {
|
||||
const auto real = next_symbol<int (*)(int, const char *, struct stat *)>(Next::xstat);
|
||||
static auto real = reinterpret_cast<int (*)(int, const char *, struct stat *)>(dlsym(RTLD_NEXT, "__xstat"));
|
||||
if (!real) return stat(pathname, statbuf);
|
||||
return fake_stat_path(pathname, statbuf, [version, real](const char *path, struct stat *buf) { return real(version, path, buf); });
|
||||
return fake_stat_path(pathname, statbuf, [version](const char *path, struct stat *buf) { return real(version, path, buf); });
|
||||
}
|
||||
|
||||
EXPORT int __xstat64(int version, const char *pathname, struct stat64 *statbuf) {
|
||||
const auto real = next_symbol<int (*)(int, const char *, struct stat64 *)>(Next::xstat64);
|
||||
static auto real = reinterpret_cast<int (*)(int, const char *, struct stat64 *)>(dlsym(RTLD_NEXT, "__xstat64"));
|
||||
if (!real) return stat64(pathname, statbuf);
|
||||
return fake_stat_path(pathname, statbuf, [version, real](const char *path, struct stat64 *buf) { return real(version, path, buf); });
|
||||
return fake_stat_path(pathname, statbuf, [version](const char *path, struct stat64 *buf) { return real(version, path, buf); });
|
||||
}
|
||||
|
||||
EXPORT int __fxstat(int version, int fd, struct stat *buf) {
|
||||
const auto real = next_symbol<int (*)(int, int, struct stat *)>(Next::fxstat);
|
||||
static auto real = reinterpret_cast<int (*)(int, int, struct stat *)>(dlsym(RTLD_NEXT, "__fxstat"));
|
||||
if (!real) return fstat(fd, buf);
|
||||
return fake_stat_fd(fd, buf, [version, real](int f, struct stat *b) { return real(version, f, b); });
|
||||
return fake_stat_fd(fd, buf, [version](int f, struct stat *b) { return real(version, f, b); });
|
||||
}
|
||||
|
||||
EXPORT int __fxstat64(int version, int fd, struct stat64 *buf) {
|
||||
const auto real = next_symbol<int (*)(int, int, struct stat64 *)>(Next::fxstat64);
|
||||
static auto real = reinterpret_cast<int (*)(int, int, struct stat64 *)>(dlsym(RTLD_NEXT, "__fxstat64"));
|
||||
if (!real) return fstat64(fd, buf);
|
||||
return fake_stat_fd(fd, buf, [version, real](int f, struct stat64 *b) { return real(version, f, b); });
|
||||
return fake_stat_fd(fd, buf, [version](int f, struct stat64 *b) { return real(version, f, b); });
|
||||
}
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
@@ -4573,37 +4518,18 @@ static const char *const interposed_names[] = {
|
||||
};
|
||||
|
||||
static dlsym_fn next_dlsym() {
|
||||
static std::atomic<dlsym_fn> fn{nullptr};
|
||||
static std::atomic<bool> resolved{false};
|
||||
if (!resolved.load(std::memory_order_acquire)) {
|
||||
static const dlsym_fn fn = [] {
|
||||
#ifdef __x86_64__
|
||||
const char *base = "GLIBC_2.2.5";
|
||||
#else
|
||||
const char *base = "GLIBC_2.0";
|
||||
#endif
|
||||
dlsym_fn found{};
|
||||
for (const char *version : {base, "GLIBC_2.34"}) {
|
||||
if ((found = reinterpret_cast<dlsym_fn>(dlvsym(RTLD_NEXT, "dlsym", version)))) break;
|
||||
if (auto found = reinterpret_cast<dlsym_fn>(dlvsym(RTLD_NEXT, "dlsym", version))) return found;
|
||||
}
|
||||
fn.store(found, std::memory_order_relaxed);
|
||||
resolved.store(true, std::memory_order_release);
|
||||
}
|
||||
return fn.load(std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
static void *libc_handle() {
|
||||
static std::atomic<void *> handle{nullptr};
|
||||
static std::atomic<bool> resolved{false};
|
||||
if (!resolved.load(std::memory_order_acquire)) {
|
||||
handle.store(dlopen(LIBC_SO, RTLD_LAZY | RTLD_NOLOAD), std::memory_order_relaxed);
|
||||
resolved.store(true, std::memory_order_release);
|
||||
}
|
||||
return handle.load(std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
__attribute__((constructor)) static void resolve_dlsym_targets() {
|
||||
next_dlsym();
|
||||
libc_handle();
|
||||
return dlsym_fn{};
|
||||
}();
|
||||
return fn;
|
||||
}
|
||||
|
||||
static void *global_dlsym(void *, const char *name) { return next_dlsym()(RTLD_DEFAULT, name); }
|
||||
@@ -4621,7 +4547,8 @@ extern "C" __attribute__((visibility("hidden"), used)) void *fakeinput_dlsym_tar
|
||||
dlsym_fn next = next_dlsym();
|
||||
if (!next) return reinterpret_cast<void *>(missing_dlsym);
|
||||
if (handle == RTLD_DEFAULT || handle == RTLD_NEXT || name == nullptr) return reinterpret_cast<void *>(next);
|
||||
if (handle != libc_handle() || !interposed(name)) return reinterpret_cast<void *>(next);
|
||||
static void *const libc = dlopen(LIBC_SO, RTLD_LAZY | RTLD_NOLOAD);
|
||||
if (handle != libc || !interposed(name)) return reinterpret_cast<void *>(next);
|
||||
return reinterpret_cast<void *>(global_dlsym);
|
||||
}
|
||||
|
||||
|
||||
@@ -143,7 +143,6 @@ object SessionFiles {
|
||||
"usr/local/bin/droiddeck-proton-extra" to "usr/local/bin/droiddeck-proton-extra",
|
||||
"usr/local/bin/droiddeck-netmanager" to "usr/local/bin/droiddeck-netmanager",
|
||||
"usr/local/bin/droiddeck-login1" to "usr/local/bin/droiddeck-login1",
|
||||
"usr/local/bin/droiddeck-documents" to "usr/local/bin/droiddeck-documents",
|
||||
"usr/local/bin/droiddeck-steam-launch" to "usr/local/bin/droiddeck-steam-launch",
|
||||
"usr/local/bin/droiddeck-desktop-games" to "usr/local/bin/droiddeck-desktop-games",
|
||||
"usr/local/bin/droiddeck-desktop-programs" to "usr/local/bin/droiddeck-desktop-programs",
|
||||
|
||||
@@ -114,8 +114,11 @@ object BattleNetInstall {
|
||||
internal const val UPDATE_FOLDER = "updateFolder"
|
||||
internal const val STALLED = "stalled"
|
||||
|
||||
internal fun registered(context: Context, id: String): BattleNet.Game? =
|
||||
runCatching { BattleNet.games(context).firstOrNull { it.uid == id } }.getOrNull()
|
||||
|
||||
internal fun installUid(context: Context, game: InstalledStoreGame): String =
|
||||
runCatching { BattleNet.games(context).firstOrNull { it.uid == game.sidecar.id }?.installUid }.getOrNull() ?: game.sidecar.id
|
||||
registered(context, game.sidecar.id)?.installUid ?: game.sidecar.id
|
||||
|
||||
fun uninstall(context: Context, game: InstalledStoreGame): Boolean {
|
||||
if (product(game.sidecar.id) == null || !BattleNet.installed(context)) return false
|
||||
@@ -243,6 +246,7 @@ internal class BattleNetInstaller(
|
||||
private val ended = java.util.concurrent.CountDownLatch(1)
|
||||
private var before = 0L
|
||||
private var kept = -1L
|
||||
@Volatile private var registered: BattleNet.Game? = null
|
||||
|
||||
override fun run(handle: DownloadQueue.JobHandle): String? {
|
||||
started.set(true)
|
||||
@@ -259,12 +263,17 @@ internal class BattleNetInstaller(
|
||||
if (!BattleNet.installed(app)) throw IllegalStateException(app.getString(R.string.bnet_dl_client_first))
|
||||
val title = BattleNet.title(item.id)
|
||||
val product = title?.product ?: throw IllegalStateException(app.getString(R.string.bnet_dl_failed, item.id))
|
||||
val uid = item.extra[BattleNetInstall.INSTALL_UID] ?: title.uid
|
||||
if (!update) folder.mkdirs()
|
||||
val guest = AddedGames.guestPath(app, folder) ?: throw IllegalStateException(app.getString(R.string.bnet_dl_failed, folder.path))
|
||||
val (country, region) = BattleNetInstall.country(Locale.getDefault())
|
||||
val args = if (update) listOf("agent-update", uid)
|
||||
else listOf("agent-install", uid, product, guest, BattleNetInstall.localeTag(app), country, region)
|
||||
val registered = (if (update) null else BattleNetInstall.registered(app, title.uid)).also { this.registered = it }
|
||||
val updating = update || registered != null
|
||||
val target = registered?.folder ?: folder
|
||||
val uid = registered?.installUid ?: item.extra[BattleNetInstall.INSTALL_UID] ?: title.uid
|
||||
val args = if (updating) listOf("agent-update", uid)
|
||||
else {
|
||||
folder.mkdirs()
|
||||
val guest = AddedGames.guestPath(app, folder) ?: throw IllegalStateException(app.getString(R.string.bnet_dl_failed, folder.path))
|
||||
val (country, region) = BattleNetInstall.country(Locale.getDefault())
|
||||
listOf("agent-install", uid, product, guest, BattleNetInstall.localeTag(app), country, region)
|
||||
}
|
||||
var done: JSONObject? = null
|
||||
var reason: String? = null
|
||||
val code = BattleNetInstall.run(app, args, cancelled) { line ->
|
||||
@@ -280,13 +289,13 @@ internal class BattleNetInstaller(
|
||||
}
|
||||
if (cancelled.get()) return null
|
||||
if (done == null) throw IllegalStateException(BattleNetInstall.failure(app, reason, code))
|
||||
handle.log("Battle.net: ${item.title} ${if (update) "updated" else "installed"} ${done?.optString("version").orEmpty()}".trimEnd())
|
||||
handle.log("Battle.net: ${item.title} ${if (updating) "updated" else "installed"} ${done?.optString("version").orEmpty()}".trimEnd())
|
||||
StoresState.post {
|
||||
BattleNetInstall.updates.remove(item.id)
|
||||
StoresState.notifyLibraryChanged(app)
|
||||
}
|
||||
BattleNetInstall.check(item.id, folder, force = true)
|
||||
return folder.absolutePath
|
||||
BattleNetInstall.check(item.id, target, force = true)
|
||||
return target.absolutePath
|
||||
}
|
||||
|
||||
private fun progress(handle: DownloadQueue.JobHandle, status: JSONObject) {
|
||||
@@ -308,9 +317,14 @@ internal class BattleNetInstaller(
|
||||
val uid = item.extra[BattleNetInstall.INSTALL_UID] ?: BattleNet.title(item.id)?.uid ?: return
|
||||
Thread({
|
||||
if (started.get() && !ended.await(END_WAIT_S, TimeUnit.SECONDS)) Log.w("BattleNetInstall", "the cancelled install of $uid is still stopping")
|
||||
val gone = BattleNetInstall.agentUninstall(app, uid)
|
||||
val existing = registered
|
||||
val gone = existing == null && BattleNetInstall.agentUninstall(app, uid)
|
||||
if (folder.isDirectory && (gone || folder.list().isNullOrEmpty())) com.droiddeck.launcher.core.FileUtils.delete(folder)
|
||||
Log.i("BattleNetInstall", "cancelled install of $uid: ${if (gone) "removed" else "left for Battle.net to remove"}")
|
||||
Log.i("BattleNetInstall", "cancelled install of $uid: " + when {
|
||||
existing != null -> "Battle.net already had it in ${existing.folder}"
|
||||
gone -> "removed"
|
||||
else -> "left for Battle.net to remove"
|
||||
})
|
||||
}, "battlenet-cancel").start()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,6 +291,25 @@ class BattleNetTest {
|
||||
.map { Triple(it.uid, it.path, it.product) })
|
||||
}
|
||||
|
||||
@Test fun aTitleBattleNetAlreadyInstalledIsFoundWithItsOwnUidAndFolder() {
|
||||
val pfx = File(BattleNet.prefix(context), "pfx").apply { mkdirs() }
|
||||
val wow = File(pfx, "drive_c/Games/World of Warcraft").apply { mkdirs() }
|
||||
File(pfx, "drive_c/Games/StarCraft").mkdirs()
|
||||
val db = File(pfx, "drive_c/ProgramData/Battle.net/Agent/product.db").apply { parentFile!!.mkdirs() }
|
||||
db.writeBytes(message(
|
||||
field(1, message(field(1, "wowf_live"), field(2, "wowf"), field(3, message(field(1, "C:/Games/World of Warcraft"))))),
|
||||
field(1, message(field(1, "s1"), field(2, "s1"), field(3, message(field(1, "C:/Games/StarCraft"))),
|
||||
field(4, message(field(1, message(varintField(1, 0))))))),
|
||||
))
|
||||
val forever = com.droiddeck.launcher.stores.battlenet.BattleNetInstall.registered(context, "wow_forever")!!
|
||||
assertEquals("wowf_live", forever.installUid)
|
||||
assertEquals(wow, forever.folder)
|
||||
assertNull(com.droiddeck.launcher.stores.battlenet.BattleNetInstall.registered(context, "s1"))
|
||||
assertNull(com.droiddeck.launcher.stores.battlenet.BattleNetInstall.registered(context, "wow"))
|
||||
db.delete()
|
||||
assertNull(com.droiddeck.launcher.stores.battlenet.BattleNetInstall.registered(context, "wow_forever"))
|
||||
}
|
||||
|
||||
@Test fun aGameKeepsTheFolderItWasListedWithWhenAnotherVersionComesOrGoes() {
|
||||
val root = File(context.filesDir, "World of Warcraft").apply { mkdirs() }
|
||||
val retailDir = File(root, "_retail_").apply { mkdirs() }
|
||||
|
||||
@@ -61,11 +61,9 @@ class BwrapSpawnerTest {
|
||||
"DDNATV_ROOT" to rootfs, "DDNATV_BINDS" to "/dev:/dev", "HOME" to "/root",
|
||||
"SPA_PLUGIN_DIR" to "/usr/local/lib/droiddeck-pipewire/lib/spa-0.2",
|
||||
"LD_PRELOAD" to "/run/droiddeck-preload/libddsession.so:$rootfs/usr/local/lib/libddsession.so:$rootfs/usr/lib/libddnatv-hook.so",
|
||||
"DROIDDECK_FDS" to "droiddeck-fds-1",
|
||||
)
|
||||
BwrapSpawner.withoutRootfsSettings(env, rootfs)
|
||||
assertEquals(mapOf("HOME" to "/root", "LD_PRELOAD" to "/run/droiddeck-preload/libddsession.so",
|
||||
"DROIDDECK_FDS" to "droiddeck-fds-1"), env)
|
||||
assertEquals(mapOf("HOME" to "/root", "LD_PRELOAD" to "/run/droiddeck-preload/libddsession.so"), env)
|
||||
val onlySession = mutableMapOf("LD_PRELOAD" to "$rootfs/usr/lib/libddnatv-hook.so")
|
||||
BwrapSpawner.withoutRootfsSettings(onlySession, rootfs)
|
||||
assertTrue(onlySession.isEmpty())
|
||||
|
||||
|
Before Width: | Height: | Size: 4.1 MiB |
|
After Width: | Height: | Size: 9.0 MiB |
@@ -1,239 +0,0 @@
|
||||
# DroidDeck 0.7.11
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/Droid-Deck/DroidDeck/releases/download/0.7.11/DroidDeck-0.7.11.apk"><img src="https://img.shields.io/badge/Download-DroidDeck%200.7.11%20APK-3DDC84?style=for-the-badge&logo=android&logoColor=white" alt="Download DroidDeck 0.7.11"></a>
|
||||
<a href="https://discord.gg/JRGAvawjsm"><img src="https://img.shields.io/badge/Discord-Join%20us-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Join the DroidDeck Discord"></a>
|
||||
</p>
|
||||
|
||||
|
||||
**DroidDeck is 100% open source. No ads. No subscriptions. No telemetry. No proprietary components. No source withheld.**
|
||||
|
||||
Since 0.7.1: **42 contributors** | **467 pull requests** | **111 of them from 39 outside contributors**. We are so grateful for you all!
|
||||
|
||||
0.7.11 is the convenience store release. **EA, Ubisoft Connect and Rockstar Games** join the Stores tab, with no launchers to install and cloud saves for EA and Ubisoft. Steam, games, the desktop and the Terminal now **run directly on Android with no proot**, which cuts CPU overhead and gives much better 1% lows. **Zero-copy presentation** sends frames straight to the display and brings real HDR. Games on a memory card start about 4X faster. Around those sit a rebuilt Library, a tab bar you can rearrange, Settings with search, a smoother first run, and many smaller conveniences. The details are below.
|
||||
|
||||
### Features
|
||||
|
||||
- **A new foundation.** 0.7.11 reworks the stack that runs your games, from how Linux runs on Android to how frames reach the screen:
|
||||
- **No proot by default.** Steam, Proton games, the desktop and the Terminal run directly on Android, with lower CPU overhead and much better 1% lows. (@xXJSONDeruloXx, @maxjivi05, @K11MCH1, [#2300](https://github.com/Droid-Deck/DroidDeck/pull/2300), [#2522](https://github.com/Droid-Deck/DroidDeck/pull/2522), [#2560](https://github.com/Droid-Deck/DroidDeck/pull/2560), [#3041](https://github.com/Droid-Deck/DroidDeck/pull/3041))
|
||||
- **Zero-copy presentation** With DD-Turnip v0.9.0 or newer, frames reach the display without an extra copy: improving frametimes, frame pacing, and drastically reducing cases of dropped frames. (@maxjivi05, [#2905](https://github.com/Droid-Deck/DroidDeck/pull/2905))
|
||||
- **DroidDeck-Bionic**, a new test build that runs the game itself on Android’s own libc, with lower memory use, better compatibility and, in some games, better performance. (@The412Banner, [#3037](https://github.com/Droid-Deck/DroidDeck/pull/3037))
|
||||
|
||||
<p align="center"><img src="media/0.7.11/new-foundation.png" width="85%" alt="Four charts. Native execution without proot: process launches 4.2 times faster, tar 3.6, recursive listing 2.6, find 2.4, Python stat walk 1.4 and a CPU-only hash 1.1, with Steam starting in 8.7 s instead of 11 to 14 s on a Retroid Pocket Duo. SD card game starts: cold session start plus launch for eight games fell from 37, 122, 19, 65, 177, 192, 50 and 174 seconds on 0.7.1 to 35, 19, 18, 34, 26, 23, 26 and 24 seconds on 0.7.11, an average of 104 s down to 26 s. Zero-copy presentation: compositor work per frame down from 8.25, 3.3 and 4 ms to 1.25, 0.18 and 0.22 ms on three handhelds, and missed refreshes from 229 to 3 in 60 s on one. DroidDeck-Bionic: D3D8 up 50.3%, OpenGL up 17.5%, D3D7 up 10.4%, Vulkan up 3.3%, D3D11 down 1.3%, D3D10 down 1.4%, D3D9 down 3.5% and D3D12 down 7.5%, with about 400 MB less RAM"></p>
|
||||
|
||||
- Added **EA, Ubisoft Connect and Rockstar Games** stores: sign in, browse, download and launch without their launchers. EA and Ubisoft get cloud saves. (@xXJSONDeruloXx, @K11MCH1, @maxjivi05, [#2259](https://github.com/Droid-Deck/DroidDeck/pull/2259), [#2527](https://github.com/Droid-Deck/DroidDeck/pull/2527), [#2521](https://github.com/Droid-Deck/DroidDeck/pull/2521), [#2438](https://github.com/Droid-Deck/DroidDeck/pull/2438), [#2440](https://github.com/Droid-Deck/DroidDeck/pull/2440), [#2486](https://github.com/Droid-Deck/DroidDeck/pull/2486), [#2322](https://github.com/Droid-Deck/DroidDeck/pull/2322), [#2436](https://github.com/Droid-Deck/DroidDeck/pull/2436), [#2450](https://github.com/Droid-Deck/DroidDeck/pull/2450), [#2460](https://github.com/Droid-Deck/DroidDeck/pull/2460), [#2865](https://github.com/Droid-Deck/DroidDeck/pull/2865), [#2824](https://github.com/Droid-Deck/DroidDeck/pull/2824), [#2537](https://github.com/Droid-Deck/DroidDeck/pull/2537), [#2547](https://github.com/Droid-Deck/DroidDeck/pull/2547), [#2590](https://github.com/Droid-Deck/DroidDeck/pull/2590))
|
||||
|
||||
<p align="center"><img src="media/0.7.11/new-stores.gif" width="60%" alt="Touching through the Library’s store chips from left to right: Rockstar with GTA III, San Andreas and Vice City, EA with Battlefield, Dead Space, GRID Legends, Mass Effect, Need for Speed Heat and skate., then Ubisoft with five Assassin’s Creed titles, Immortals Fenyx Rising and Splinter Cell"></p>
|
||||
|
||||
- Added **black frame insertion** for screens of 100 Hz and up: the game runs at half the refresh rate, for example 60 fps on 120 Hz. (@xXJSONDeruloXx, [#2653](https://github.com/Droid-Deck/DroidDeck/pull/2653))
|
||||
|
||||
- **Controller-specific on-screen controls**: kits for the Steam Deck, Steam Controller, Xbox 360, DualShock 4 and DualSense, restyled after the real pads. The editor restores deleted controls, moves and resizes the D-pad as one control and allows sizes above 100%. Layouts keep separate portrait and landscape edits, and the floating overlays get switches for rear buttons and trackpads. (@xXJSONDeruloXx, @maxjivi05, [#2966](https://github.com/Droid-Deck/DroidDeck/pull/2966), [#2988](https://github.com/Droid-Deck/DroidDeck/pull/2988), [#2996](https://github.com/Droid-Deck/DroidDeck/pull/2996), [#3013](https://github.com/Droid-Deck/DroidDeck/pull/3013), [#3019](https://github.com/Droid-Deck/DroidDeck/pull/3019))
|
||||
|
||||
<p align="center"><img src="media/0.7.11/controller-kits.png" width="60%" alt="The portrait on-screen controls for four of the kits: Steam, Xbox 360, DualShock 4 and DualSense, each with its shoulder buttons, D-pad, face buttons, sticks and a bottom row of menu buttons"></p>
|
||||
|
||||
<p align="center"><img src="media/0.7.11/steam-deck-buttons.jpg" width="50%" alt="Steam’s game mode with the restyled Steam Deck on-screen controls: shoulder buttons, a D-pad, A B X Y, rear buttons, trackpads, sticks and the Steam, keyboard and menu buttons along the bottom"></p>
|
||||
|
||||
- Added a **CurseForge source** to the addon browser. DroidDeck installs the CurseForge app, updates addons per game and no longer reads whole files to list them. (@maxjivi05, [#3028](https://github.com/Droid-Deck/DroidDeck/pull/3028), [#2986](https://github.com/Droid-Deck/DroidDeck/pull/2986), [#3042](https://github.com/Droid-Deck/DroidDeck/pull/3042), [#3056](https://github.com/Droid-Deck/DroidDeck/pull/3056), [#3057](https://github.com/Droid-Deck/DroidDeck/pull/3057), [#3060](https://github.com/Droid-Deck/DroidDeck/pull/3060), [#3081](https://github.com/Droid-Deck/DroidDeck/pull/3081))
|
||||
|
||||
<p align="center"><img src="media/0.7.11/curseforge-addons.jpg" width="50%" alt="The addon browser on the CurseForge source, sorted by Popular: Questie, Auctionator, Details! Damage Meter, DBM and others, each with an Install button"></p>
|
||||
|
||||
- The **file manager has a plain text editor**, and the **Updates icon shows the build you’re on**: stable, Preview, a test build or a local build. (@Dantalian-dev, @xXJSONDeruloXx, [#2980](https://github.com/Droid-Deck/DroidDeck/pull/2980), [#3064](https://github.com/Droid-Deck/DroidDeck/pull/3064))
|
||||
|
||||
- **Frontends can launch any DroidDeck game** with Steam IDs, `steam://` and `droiddeck://` links, Daijisho templates, `.url` shortcuts, store game files or `.exe` paths, and store games export as `.epic`, `.gog`, `.xbox` and similar files. (@xXJSONDeruloXx, [#2872](https://github.com/Droid-Deck/DroidDeck/pull/2872))
|
||||
|
||||
- The **Storage manager names every prefix and store game** and can select and remove them, instead of one large “Kept” total, and launcher prefixes and Linux system caches can be removed too. (@xXJSONDeruloXx, [#2565](https://github.com/Droid-Deck/DroidDeck/pull/2565), [#2867](https://github.com/Droid-Deck/DroidDeck/pull/2867))
|
||||
|
||||
- The **Updates tab lists every kept Preview build**, so you can go back to an earlier one, links each build to its pull request and commit, and flags stale test builds. (@xXJSONDeruloXx, [#2624](https://github.com/Droid-Deck/DroidDeck/pull/2624))
|
||||
|
||||
- Components > Proton lists **DroidDeck-Proton prerelease builds under Experimental**, each with Install now, and removes them once they become a stable release. **Install from file** takes zip, 7z and tar archives, for everyone. (@maxjivi05, @FryMcNugget, [#2831](https://github.com/Droid-Deck/DroidDeck/pull/2831), [#2864](https://github.com/Droid-Deck/DroidDeck/pull/2864), [#2889](https://github.com/Droid-Deck/DroidDeck/pull/2889))
|
||||
|
||||
<p align="center"><img src="media/0.7.11/proton-experimental.jpg" width="50%" alt="Components page with DroidDeck-Proton 11-12.8 selected and an Experimental builds section offering a DroidDeck-Bionic 12.8 r34 test build with Install now and an Install from file button"></p>
|
||||
|
||||
- **Steam picks up game folders found in an added library** without pressing Install on each game, and a Games folder that is not a Steam library yet is offered as one. (@maxjivi05, @xXJSONDeruloXx, [#2317](https://github.com/Droid-Deck/DroidDeck/pull/2317), [#2432](https://github.com/Droid-Deck/DroidDeck/pull/2432))
|
||||
|
||||
- Added **per-game frame generation and screen effects**: pick DD-FG 2x, 3x, 4x, Lossless Scaling or none for each game, from the Library or the in-game menu, with a default for the rest. Upscaling and sharpening stay at full screen size with frame generation on. (@EnzoDLofi, @xXJSONDeruloXx, [#2473](https://github.com/Droid-Deck/DroidDeck/pull/2473), [#2472](https://github.com/Droid-Deck/DroidDeck/pull/2472), [#2728](https://github.com/Droid-Deck/DroidDeck/pull/2728))
|
||||
|
||||
- Added **integer scaling** for pixel art and 2D games, and **SMAA** anti-aliasing. Nearest is the new default filter; a filter you already picked stays. (@EnzoDLofi, [#2620](https://github.com/Droid-Deck/DroidDeck/pull/2620), [#2690](https://github.com/Droid-Deck/DroidDeck/pull/2690), [#2708](https://github.com/Droid-Deck/DroidDeck/pull/2708), [#2760](https://github.com/Droid-Deck/DroidDeck/pull/2760))
|
||||
|
||||
- A **pen works as a mouse**: hover moves the pointer, the tip clicks and the side button right-clicks. (@alien2003, [#2625](https://github.com/Droid-Deck/DroidDeck/pull/2625))
|
||||
|
||||
- Added **head tracking for XREAL One, One Pro, One Pro+ and Aura** glasses, with One Pro+ tracking corrected. (@mhaye20, @informalTechCode, [#2532](https://github.com/Droid-Deck/DroidDeck/pull/2532), [#2680](https://github.com/Droid-Deck/DroidDeck/pull/2680))
|
||||
|
||||
- DroidDeck’s **virtual pads reach programs outside Steam**, such as Firefox, Chromium and SDL games. (@kingokksa, [#1593](https://github.com/Droid-Deck/DroidDeck/pull/1593))
|
||||
|
||||
- Added **On-Device Lab builds** for contributors: build and run your own DroidDeck build on the device from the **Dev Harness** tab, which stays hidden until you show it in Edit tabs. (@xXJSONDeruloXx, @KeegantheVeganat0r, @SlicelessBread, @FryMcNugget, [#2375](https://github.com/Droid-Deck/DroidDeck/pull/2375), [#2494](https://github.com/Droid-Deck/DroidDeck/pull/2494), [#2512](https://github.com/Droid-Deck/DroidDeck/pull/2512), [#2667](https://github.com/Droid-Deck/DroidDeck/pull/2667), [#2550](https://github.com/Droid-Deck/DroidDeck/pull/2550), [#2744](https://github.com/Droid-Deck/DroidDeck/pull/2744), [#2862](https://github.com/Droid-Deck/DroidDeck/pull/2862))
|
||||
|
||||
- **Also new:** a **Game resolution** choice for games started without Steam; **per-game Steam Input** choices: Steam’s default, on or off; **Steam Remote Play** with the controller set to Steam Deck or Steam Controller mode and with touch controls; rounded ends on the game page’s **LB and RB keys**; **icon packs**, per-app icons and an Appearance panel on the Apps page; a **Home button** choice, **three presses of Back to exit the launcher** and an optional **Hide launcher from Recents while idle**; **Shuffle** and **Skip boot movie** switches; the game can move to a **clip-on second screen** that reports as an external display; **Quest headsets** get steps for turning off the child-process limit with SideQuest; a **Clear** key in the bottom-screen terminal, which keeps its shell when another app covers that screen; Steam’s first-run defaults show the **battery percentage**, download rates in bytes and the library sorted by recent (@xXJSONDeruloXx, @vinegh4, @2-Shar, @measlesbagel, @DeathKhan, @kingokksa, @maxjivi05, [#2520](https://github.com/Droid-Deck/DroidDeck/pull/2520), [#2407](https://github.com/Droid-Deck/DroidDeck/pull/2407), [#2033](https://github.com/Droid-Deck/DroidDeck/pull/2033), [#2856](https://github.com/Droid-Deck/DroidDeck/pull/2856), [#2207](https://github.com/Droid-Deck/DroidDeck/pull/2207), [#2493](https://github.com/Droid-Deck/DroidDeck/pull/2493), [#1599](https://github.com/Droid-Deck/DroidDeck/pull/1599), [#2579](https://github.com/Droid-Deck/DroidDeck/pull/2579), [#2462](https://github.com/Droid-Deck/DroidDeck/pull/2462), [#2577](https://github.com/Droid-Deck/DroidDeck/pull/2577), [#2350](https://github.com/Droid-Deck/DroidDeck/pull/2350), [#2306](https://github.com/Droid-Deck/DroidDeck/pull/2306), [#2368](https://github.com/Droid-Deck/DroidDeck/pull/2368), [#2366](https://github.com/Droid-Deck/DroidDeck/pull/2366), [#2599](https://github.com/Droid-Deck/DroidDeck/pull/2599))
|
||||
|
||||
### Design and organization
|
||||
|
||||
DroidDeck is easier to find your way around: tabs you arrange yourself, a Library that puts installed games first, and one home for every setting.
|
||||
|
||||
- **One editor to show, hide and reorder** the launcher tabs, the Library’s stores and the in-game menu pages. **Edit tabs** reorders with drag handles and shelves tabs under **More** or hides them, **Manage stores** does the same for store chips, Favorites and Hidden, and the in-game menu gets **Arrange pages** and its own **More** tab. On a controller, grab a row with Y and move it with the D-pad. The in-game menu can also be **resized**, and the width is kept. (@xXJSONDeruloXx, @FX192, [#2569](https://github.com/Droid-Deck/DroidDeck/pull/2569), [#2627](https://github.com/Droid-Deck/DroidDeck/pull/2627), [#2791](https://github.com/Droid-Deck/DroidDeck/pull/2791), [#2798](https://github.com/Droid-Deck/DroidDeck/pull/2798), [#2809](https://github.com/Droid-Deck/DroidDeck/pull/2809), [#2811](https://github.com/Droid-Deck/DroidDeck/pull/2811), [#2812](https://github.com/Droid-Deck/DroidDeck/pull/2812), [#2558](https://github.com/Droid-Deck/DroidDeck/pull/2558), [#2894](https://github.com/Droid-Deck/DroidDeck/pull/2894), [#2897](https://github.com/Droid-Deck/DroidDeck/pull/2897), [#2920](https://github.com/Droid-Deck/DroidDeck/pull/2920), [#2989](https://github.com/Droid-Deck/DroidDeck/pull/2989), [#3084](https://github.com/Droid-Deck/DroidDeck/pull/3084), [#3080](https://github.com/Droid-Deck/DroidDeck/pull/3080))
|
||||
|
||||
<p align="center"><img src="media/0.7.11/edit-tabs.jpg" width="19%" alt="The launcher’s Edit tabs sheet in portrait, with a drag handle and a switch for Steam, Desktop, Library, Downloads, Settings, Updates and Stores, then a More divider above Boot movies, Decky, Apps and Syncthing"> <img src="media/0.7.11/manage-stores.jpg" width="38%" alt="The Library’s Manage stores sheet with a drag handle and a switch for Favorites, Battle.net, Xbox, Rockstar Games, EA, Ubisoft Connect and itch.io, with a Grab Y hint on the Xbox row being moved"> <img src="media/0.7.11/session-menu-arrange.jpg" width="38%" alt="The widened in-game menu showing Arrange pages with Performance HUD, Effects, Games and Session above a More divider and VR below it"></p>
|
||||
|
||||
- **The Library is rebuilt.** Installed games come first, and games you own but haven’t installed fold into one **Not installed** row linked to their store. It gets the Stores tab’s chips and toolbar and a **Custom games** tab. (@xXJSONDeruloXx, @FX192, [#2894](https://github.com/Droid-Deck/DroidDeck/pull/2894), [#2897](https://github.com/Droid-Deck/DroidDeck/pull/2897), [#2920](https://github.com/Droid-Deck/DroidDeck/pull/2920))
|
||||
|
||||
<p align="center"><img src="media/0.7.11/library-installed.jpg" width="50%" alt="The Library with store chips (All, Steam, Epic, EA, Xbox, GOG, Rockstar, itch.io), a toolbar, an Installed row of Steam, EA, Ubisoft and GOG games with their sizes, and a Not installed row of 746 games below"></p>
|
||||
|
||||
- **Settings are rebuilt.** Setup is now **Settings**, Performance has its own page, every setting has one home, and search finds settings by everyday words such as fps, logs or ram. Storage, Syncthing and Downloads are tabs of their own. (@xXJSONDeruloXx, [#2569](https://github.com/Droid-Deck/DroidDeck/pull/2569), [#2627](https://github.com/Droid-Deck/DroidDeck/pull/2627), [#2791](https://github.com/Droid-Deck/DroidDeck/pull/2791), [#2798](https://github.com/Droid-Deck/DroidDeck/pull/2798), [#2809](https://github.com/Droid-Deck/DroidDeck/pull/2809), [#2811](https://github.com/Droid-Deck/DroidDeck/pull/2811), [#2812](https://github.com/Droid-Deck/DroidDeck/pull/2812), [#2558](https://github.com/Droid-Deck/DroidDeck/pull/2558))
|
||||
|
||||
- Added **Favorites** with a heart on the game page, a **Hidden** tab synced with Steam, and a **Soundtracks tab with a music player** with favorites, collections and Android’s media controls. (@FX192, [#2613](https://github.com/Droid-Deck/DroidDeck/pull/2613), [#2803](https://github.com/Droid-Deck/DroidDeck/pull/2803), [#2389](https://github.com/Droid-Deck/DroidDeck/pull/2389), [#2835](https://github.com/Droid-Deck/DroidDeck/pull/2835))
|
||||
|
||||
- **Decky and Boot movies get their own tabs**, shelved under More. Decky has Installed, **Store** and From ZIP pages; the store lists plugins by downloads with search, checks each download’s SHA-256 and updates what you have installed. (@xXJSONDeruloXx, [#3068](https://github.com/Droid-Deck/DroidDeck/pull/3068))
|
||||
|
||||
<p align="center"><img src="media/0.7.11/more-tab.jpg" width="45%" alt="The More page with Storage, Syncthing, Decky, Boot movies, Music and Dev Harness, and the Updates tab’s L icon for a local build on the rail"> <img src="media/0.7.11/decky-store.jpg" width="45%" alt="Decky’s Store page with a plugin search box and SteamGridDB and CSS Loader, each with an Install button"></p>
|
||||
|
||||
- **One screen picker for the bottom screen**: a dropdown next to X switches between the DroidDeck menu and the panels, replacing the D button and the Second screen tab. Every panel gets the swap button, and the menu’s tabs get Steam Deck style icons. (@xXJSONDeruloXx, [#2912](https://github.com/Droid-Deck/DroidDeck/pull/2912), [#2900](https://github.com/Droid-Deck/DroidDeck/pull/2900))
|
||||
|
||||
<p align="center"><img src="media/0.7.11/screen-picker.jpg" width="40%" alt="The bottom-screen picker open on a Dashboard, listing DroidDeck menu, Keyboard + trackpad, Terminal, Profile controls and Dashboard"></p>
|
||||
|
||||
- **The in-game menu works better on a dual-screen handheld.** It is now a bottom-screen mode, and a docked menu is touch only so the controller stays with the game, unless you turn on **Physical controls can use bottom screen**. **Dual screen sessions** can be set from the Display page, and Pause shows its screen at once, with a real last frame under Zero-copy. (@xXJSONDeruloXx, [#3001](https://github.com/Droid-Deck/DroidDeck/pull/3001), [#3080](https://github.com/Droid-Deck/DroidDeck/pull/3080))
|
||||
|
||||
- Added the **True black** theme for OLED screens with a highlight color you pick, and a **Custom theme** where you set every color. Inner gamer works with launcher animations off. (@DeathKhan, @EnzoDLofi, [#2541](https://github.com/Droid-Deck/DroidDeck/pull/2541), [#2542](https://github.com/Droid-Deck/DroidDeck/pull/2542), [#2850](https://github.com/Droid-Deck/DroidDeck/pull/2850))
|
||||
|
||||
- The **DroidDeck HUD** gets a switch and row order for every reading, an **estimated battery runtime** and a **long press to collapse or expand**, and locking is optional. **Hold the GPU at its top clock** can be switched from the in-game menu and applies right away, and a new switch shows the HUD only while a game runs. (@kingokksa, @EnzoDLofi, @xXJSONDeruloXx, @maxjivi05, [#2454](https://github.com/Droid-Deck/DroidDeck/pull/2454), [#2573](https://github.com/Droid-Deck/DroidDeck/pull/2573), [#2723](https://github.com/Droid-Deck/DroidDeck/pull/2723), [#2882](https://github.com/Droid-Deck/DroidDeck/pull/2882), [#2970](https://github.com/Droid-Deck/DroidDeck/pull/2970))
|
||||
|
||||
- **Launcher controller and gesture settings:** LT and RT step between main tabs on every layout, a light **haptic tick** follows controller navigation, and **Swipe between pages** can be turned off, with edge swipes in landscape left to Android. (@2-Shar, @xXJSONDeruloXx, [#3035](https://github.com/Droid-Deck/DroidDeck/pull/3035), [#3039](https://github.com/Droid-Deck/DroidDeck/pull/3039), [#2993](https://github.com/Droid-Deck/DroidDeck/pull/2993), [#2924](https://github.com/Droid-Deck/DroidDeck/pull/2924))
|
||||
|
||||
- **A smoother first run.** The runtime, DroidDeck-Proton and Steam’s package cache download in the background, one setup card and a progress chip show every step, and the first Play no longer waits on Steam, which already has its client update applied. Bluetooth is asked from the setup card, and Steam starts with big art and the bouncing logo screensaver. (@xXJSONDeruloXx, [#3091](https://github.com/Droid-Deck/DroidDeck/pull/3091), [#3114](https://github.com/Droid-Deck/DroidDeck/pull/3114), [#3087](https://github.com/Droid-Deck/DroidDeck/pull/3087), [#3152](https://github.com/Droid-Deck/DroidDeck/pull/3152))
|
||||
|
||||
### Improvements
|
||||
|
||||
- **Much faster games on a memory card.** DroidDeck no longer walks every game folder on the card at each session start and launch. A cold session start that took 7 to 170 s on 0.7.1 now takes 7 to 9 s, and across eight games cold start plus launch fell from an average of 104 s to 25 s. Steam’s file checks on the card are answered from a cache, so a 3,800-file install went from 261 s to 183.5 s. Reserving space, verifying and installing no longer drop to a slow path after one unsupported call. (@maxjivi05, [#2533](https://github.com/Droid-Deck/DroidDeck/pull/2533), [#2881](https://github.com/Droid-Deck/DroidDeck/pull/2881), [#2553](https://github.com/Droid-Deck/DroidDeck/pull/2553), [#2509](https://github.com/Droid-Deck/DroidDeck/pull/2509), [#2379](https://github.com/Droid-Deck/DroidDeck/pull/2379), [#2504](https://github.com/Droid-Deck/DroidDeck/pull/2504))
|
||||
|
||||
<p align="center"><img src="media/0.7.11/sd-card-game-start.png" width="45%" alt="Bar chart of a cold session start plus game launch from the SD card for eight games, average of two runs: 37, 122, 19, 65, 177, 192, 50 and 174 seconds on 0.7.1, 35, 19, 18, 34, 26, 23, 26 and 24 seconds on 0.7.11"> <img src="media/0.7.11/sd-card-install-steps.png" width="45%" alt="Bar chart of SD card library steps before and after: reserving space 68.9 to 27.5 seconds, commit 150.9 to 104.0, whole install 261.0 to 183.5, move from internal to card 156.8 to 121.7, reserving space for a second program 33.9 to 12.5, and uninstall 12.3 to 9.2"></p>
|
||||
|
||||
- **Memory is managed automatically.** Sessions reclaim memory from what Android actually reports, react to a fast fall on large-RAM devices before Android kills the session, and no longer compress Steam after every game start. This fixes sessions killed with gigabytes free, such as a 15 GB AYN Thor Max with 5.3 GB available, and 5 to 10 s freezes every 30 s on 11 to 12 GB devices. The four manual memory settings under Performance are removed. (@maxjivi05, @xXJSONDeruloXx, [#2853](https://github.com/Droid-Deck/DroidDeck/pull/2853), [#2382](https://github.com/Droid-Deck/DroidDeck/pull/2382), [#2754](https://github.com/Droid-Deck/DroidDeck/pull/2754), [#2335](https://github.com/Droid-Deck/DroidDeck/pull/2335), [#2347](https://github.com/Droid-Deck/DroidDeck/pull/2347), [#2758](https://github.com/Droid-Deck/DroidDeck/pull/2758))
|
||||
- **Steam’s shader pre-caching is on by default**, so games get Valve’s prebuilt shaders and stutter less on first play. (@xXJSONDeruloXx, [#2888](https://github.com/Droid-Deck/DroidDeck/pull/2888))
|
||||
- **Landscape and portrait resolutions are set separately**, each able to follow the other, and an **Avoid notch** switch in Steam’s Display options keeps the picture out of the camera cutout. (@FX192, @The412Banner, [#2990](https://github.com/Droid-Deck/DroidDeck/pull/2990), [#2983](https://github.com/Droid-Deck/DroidDeck/pull/2983), [#3124](https://github.com/Droid-Deck/DroidDeck/pull/3124))
|
||||
|
||||
<p align="center"><img src="media/0.7.11/display-resolutions.jpg" width="50%" alt="Steam Settings > Display with a Landscape resolution of 1280×720 and a Portrait resolution that follows landscape at 720×1280"></p>
|
||||
|
||||
- **Play Protect installs DroidDeck without a warning**: the app targets Android 14, and the shortcut accessibility service moved into an optional companion. (@xXJSONDeruloXx, [#2683](https://github.com/Droid-Deck/DroidDeck/pull/2683), [#2654](https://github.com/Droid-Deck/DroidDeck/pull/2654), [#2764](https://github.com/Droid-Deck/DroidDeck/pull/2764), [#2774](https://github.com/Droid-Deck/DroidDeck/pull/2774))
|
||||
- **Cooler steady games:** a game holding 30 fps or more for 3 s moves off the fastest cores, and the busiest game threads get a boost on every Snapdragon 8 Elite phone, not only the Odin 3. (@xXJSONDeruloXx, @Tapuuk, @xlulx, [#2572](https://github.com/Droid-Deck/DroidDeck/pull/2572), [#2608](https://github.com/Droid-Deck/DroidDeck/pull/2608), [#2914](https://github.com/Droid-Deck/DroidDeck/pull/2914))
|
||||
- **Turnip system-memory rendering** now reaches games and apps, not only the Steam client, and Steam’s interface uses GPU compositing where the driver supports it. (@maxjivi05, [#2338](https://github.com/Droid-Deck/DroidDeck/pull/2338), [#2660](https://github.com/Droid-Deck/DroidDeck/pull/2660))
|
||||
- **Mali:** MaliBridge 0.5.5.4, with the RE6 benchmark at about 25 fps on a Galaxy Tab S10+ and fewer hangs; DXVK runs on Mali GPUs without dual-source blending; and the x86-64 Steam client starts on Venus. (@ASEbrahim, @maxjivi05, [#2704](https://github.com/Droid-Deck/DroidDeck/pull/2704), [#2293](https://github.com/Droid-Deck/DroidDeck/pull/2293), [#2601](https://github.com/Droid-Deck/DroidDeck/pull/2601))
|
||||
- **Programs that need no proot.** Without proot, AppImages, Electron and Chromium apps, Flatpaks, Go programs, scripts without a shebang line and package updates that set file capabilities start as they do with proot, and x86 programs under FEX see the session’s identity, Unix sockets, locales and GL libraries. FEX follows the latest release, and Plasma and Firefox draw on the system PowerVR driver. (@maxjivi05, @The412Banner, @JMLambo, [#3096](https://github.com/Droid-Deck/DroidDeck/pull/3096), [#3097](https://github.com/Droid-Deck/DroidDeck/pull/3097), [#3098](https://github.com/Droid-Deck/DroidDeck/pull/3098), [#3099](https://github.com/Droid-Deck/DroidDeck/pull/3099), [#3103](https://github.com/Droid-Deck/DroidDeck/pull/3103), [#3104](https://github.com/Droid-Deck/DroidDeck/pull/3104), [#3106](https://github.com/Droid-Deck/DroidDeck/pull/3106), [#3108](https://github.com/Droid-Deck/DroidDeck/pull/3108), [#3112](https://github.com/Droid-Deck/DroidDeck/pull/3112), [#3120](https://github.com/Droid-Deck/DroidDeck/pull/3120), [#3121](https://github.com/Droid-Deck/DroidDeck/pull/3121), [#3147](https://github.com/Droid-Deck/DroidDeck/pull/3147), [#3151](https://github.com/Droid-Deck/DroidDeck/pull/3151), [#3154](https://github.com/Droid-Deck/DroidDeck/pull/3154), [#3155](https://github.com/Droid-Deck/DroidDeck/pull/3155), [#3157](https://github.com/Droid-Deck/DroidDeck/pull/3157), [#3158](https://github.com/Droid-Deck/DroidDeck/pull/3158), [#3159](https://github.com/Droid-Deck/DroidDeck/pull/3159), [#3161](https://github.com/Droid-Deck/DroidDeck/pull/3161), [#3162](https://github.com/Droid-Deck/DroidDeck/pull/3162), [#3171](https://github.com/Droid-Deck/DroidDeck/pull/3171), [#3077](https://github.com/Droid-Deck/DroidDeck/pull/3077), [#3059](https://github.com/Droid-Deck/DroidDeck/pull/3059), [#3054](https://github.com/Droid-Deck/DroidDeck/pull/3054), [#3055](https://github.com/Droid-Deck/DroidDeck/pull/3055), [#3074](https://github.com/Droid-Deck/DroidDeck/pull/3074), [#3094](https://github.com/Droid-Deck/DroidDeck/pull/3094), [#3105](https://github.com/Droid-Deck/DroidDeck/pull/3105), [#3110](https://github.com/Droid-Deck/DroidDeck/pull/3110), [#3070](https://github.com/Droid-Deck/DroidDeck/pull/3070), [#3052](https://github.com/Droid-Deck/DroidDeck/pull/3052), [#3040](https://github.com/Droid-Deck/DroidDeck/pull/3040), [#3020](https://github.com/Droid-Deck/DroidDeck/pull/3020), [#3026](https://github.com/Droid-Deck/DroidDeck/pull/3026), [#2836](https://github.com/Droid-Deck/DroidDeck/pull/2836), [#2839](https://github.com/Droid-Deck/DroidDeck/pull/2839))
|
||||
- **A first launch with nothing to unpack:** setup applies Steam’s client update itself, so the first Steam start skips about 30 s of unpacking and its restart, and a failed package claim now fails the install instead of leaving it half done. (@xXJSONDeruloXx, [#3152](https://github.com/Droid-Deck/DroidDeck/pull/3152), [#3145](https://github.com/Droid-Deck/DroidDeck/pull/3145), [#3149](https://github.com/Droid-Deck/DroidDeck/pull/3149))
|
||||
- **Pressing Play on a launcher-run game** shows Starting until it launches, instead of sitting on Play for 12 to 24 s. (@maxjivi05, [#2586](https://github.com/Droid-Deck/DroidDeck/pull/2586))
|
||||
- **A session that fails to start says why**, and stopping a session while it starts undoes the start-up work. (@Tapuuk, [#2841](https://github.com/Droid-Deck/DroidDeck/pull/2841), [#2840](https://github.com/Droid-Deck/DroidDeck/pull/2840))
|
||||
- **Battle.net** keeps the launch behavior you chose, shows its own reason when it refuses a game folder, lists its games under the runtime path, and a download that stops moving ends with Retry. (@xXJSONDeruloXx, @visail, @maxjivi05, [#2750](https://github.com/Droid-Deck/DroidDeck/pull/2750), [#1661](https://github.com/Droid-Deck/DroidDeck/pull/1661), [#2602](https://github.com/Droid-Deck/DroidDeck/pull/2602), [#3188](https://github.com/Droid-Deck/DroidDeck/pull/3188))
|
||||
- **On-screen stick knobs redraw at about 30 fps** instead of on every move, and **Gamescope draws its cursor by default**. (@Tapuuk, @xXJSONDeruloXx, [#2842](https://github.com/Droid-Deck/DroidDeck/pull/2842), [#3187](https://github.com/Droid-Deck/DroidDeck/pull/3187))
|
||||
- **The agent’s setup install retries** on transient source errors and no longer accepts a held-back package. (@xXJSONDeruloXx, [#2904](https://github.com/Droid-Deck/DroidDeck/pull/2904))
|
||||
- **Translations** cover the missing strings, including the input settings, in every language. (@kingokksa, [#2556](https://github.com/Droid-Deck/DroidDeck/pull/2556))
|
||||
- **Clearer logs** for bug reports: runtime install failures, GPU driver lines, GOG cloud sync failures, device restarts, guest start steps, errors from Windows programs started from the desktop, GPU clock holds, and RPCS3’s own log in Share logs. (@maxjivi05, @The412Banner, @xXJSONDeruloXx, [#2591](https://github.com/Droid-Deck/DroidDeck/pull/2591), [#2593](https://github.com/Droid-Deck/DroidDeck/pull/2593), [#2596](https://github.com/Droid-Deck/DroidDeck/pull/2596), [#2752](https://github.com/Droid-Deck/DroidDeck/pull/2752), [#2502](https://github.com/Droid-Deck/DroidDeck/pull/2502), [#2695](https://github.com/Droid-Deck/DroidDeck/pull/2695), [#2343](https://github.com/Droid-Deck/DroidDeck/pull/2343), [#2893](https://github.com/Droid-Deck/DroidDeck/pull/2893), [#3130](https://github.com/Droid-Deck/DroidDeck/pull/3130))
|
||||
- Building and testing: local builds work on x86_64 Linux, source builds start on storage without hard links, test tools for pens and two-screen phones, preview renders of the Library and in-game menu, and steadier CI. (@xXJSONDeruloXx, @maxjivi05, @alien2003, @Tapuuk, [#2807](https://github.com/Droid-Deck/DroidDeck/pull/2807), [#2639](https://github.com/Droid-Deck/DroidDeck/pull/2639), [#2628](https://github.com/Droid-Deck/DroidDeck/pull/2628), [#2844](https://github.com/Droid-Deck/DroidDeck/pull/2844), [#2469](https://github.com/Droid-Deck/DroidDeck/pull/2469), [#2483](https://github.com/Droid-Deck/DroidDeck/pull/2483), [#2672](https://github.com/Droid-Deck/DroidDeck/pull/2672), [#2635](https://github.com/Droid-Deck/DroidDeck/pull/2635), [#2908](https://github.com/Droid-Deck/DroidDeck/pull/2908), [#2899](https://github.com/Droid-Deck/DroidDeck/pull/2899), [#2938](https://github.com/Droid-Deck/DroidDeck/pull/2938))
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed **games failing to start since 0.7.1** in ARM64 prefixes, such as Unreal Engine games asking for the Visual C++ arm64 redistributable and Red Dead Redemption 2 missing `vulkan-1.dll`. (@xXJSONDeruloXx, @maxjivi05, [#2442](https://github.com/Droid-Deck/DroidDeck/pull/2442), [#2647](https://github.com/Droid-Deck/DroidDeck/pull/2647))
|
||||
- Fixed **Windows games on Android shared storage** crashing at launch, and 32-bit games such as Spore, Terraria and Borderlands 2 hanging at launch after that fix. (@maxjivi05, @xXJSONDeruloXx, [#2594](https://github.com/Droid-Deck/DroidDeck/pull/2594), [#2706](https://github.com/Droid-Deck/DroidDeck/pull/2706))
|
||||
- Fixed **digital triggers** on handhelds such as the AYN Thor no longer responding since 0.7.0, **right sticks reported on other axes** never reaching the game, and the app closing when a controller disconnects mid-press. (@maxjivi05, [#2291](https://github.com/Droid-Deck/DroidDeck/pull/2291), [#2333](https://github.com/Droid-Deck/DroidDeck/pull/2333), [#2369](https://github.com/Droid-Deck/DroidDeck/pull/2369))
|
||||
- Fixed **driver picks on non-Adreno and smaller Adreno GPUs**: Auto no longer gives Adreno 710, 720 and 722 a display driver that finds no GPU, gives Xclipse 540 a working driver pair instead of a black Steam at about 1 fps, never loads an Adreno-only driver elsewhere, lets Auto-installed display drivers fall back to the system driver, and handles the Mali bridge switch correctly. (@maxjivi05, @unixenon, @The412Banner, [#2356](https://github.com/Droid-Deck/DroidDeck/pull/2356), [#2337](https://github.com/Droid-Deck/DroidDeck/pull/2337), [#2588](https://github.com/Droid-Deck/DroidDeck/pull/2588), [#2406](https://github.com/Droid-Deck/DroidDeck/pull/2406), [#2684](https://github.com/Droid-Deck/DroidDeck/pull/2684), [#2977](https://github.com/Droid-Deck/DroidDeck/pull/2977))
|
||||
- Fixed **Steam flickering on the Mali bridge** and **stalling on Venus** with a Dimensity 9300. (@rainleee, @The412Banner, @xXJSONDeruloXx, [#2506](https://github.com/Droid-Deck/DroidDeck/pull/2506), [#2721](https://github.com/Droid-Deck/DroidDeck/pull/2721), [#2441](https://github.com/Droid-Deck/DroidDeck/pull/2441))
|
||||
- Fixed **Epic’s Install** failing for everyone after Epic stopped publishing its Linux launcher download, and Epic now says which launcher installs a third-party game. (@maxjivi05, [#2281](https://github.com/Droid-Deck/DroidDeck/pull/2281), [#2344](https://github.com/Droid-Deck/DroidDeck/pull/2344))
|
||||
- Fixed **Game Pass downloads and launches** failing with HTTP 401, and Xbox games reporting the account service unavailable. (@maxjivi05, @Zeratullo, [#2598](https://github.com/Droid-Deck/DroidDeck/pull/2598), [#2751](https://github.com/Droid-Deck/DroidDeck/pull/2751))
|
||||
- Fixed **Xbox games that use PlayFab Game Saves**, such as Forza Horizon 6, stopping at “Initialization Failed”, and **older Xbox games** not installing: they now install through Windows Update or from their content boxes, with Nexus backend 0.2.15 and DLC mounting. Xbox sign-in also looks like the other stores’. (@l4nr3, @xXJSONDeruloXx, @The412Banner, [#2662](https://github.com/Droid-Deck/DroidDeck/pull/2662), [#2718](https://github.com/Droid-Deck/DroidDeck/pull/2718), [#2825](https://github.com/Droid-Deck/DroidDeck/pull/2825), [#2851](https://github.com/Droid-Deck/DroidDeck/pull/2851), [#2696](https://github.com/Droid-Deck/DroidDeck/pull/2696))
|
||||
- Fixed **game-specific crashes**: Death Stranding running out of memory on 39-bit kernels, Godot games with Sentry or UI Automation crashing, Final Fantasy VII Rebirth and Kingdom Come: Deliverance II at the D3D12 level they need, a game’s own DLL overrides replacing DroidDeck’s, and Call of Duty: Black Ops II starting through Steam. (@KeegantheVeganat0r, @Kobtul, @maxjivi05, @xXJSONDeruloXx, @Drik0, [#2641](https://github.com/Droid-Deck/DroidDeck/pull/2641), [#2644](https://github.com/Droid-Deck/DroidDeck/pull/2644), [#2605](https://github.com/Droid-Deck/DroidDeck/pull/2605), [#2595](https://github.com/Droid-Deck/DroidDeck/pull/2595), [#2289](https://github.com/Droid-Deck/DroidDeck/pull/2289), [#2787](https://github.com/Droid-Deck/DroidDeck/pull/2787), [#2332](https://github.com/Droid-Deck/DroidDeck/pull/2332), [#2892](https://github.com/Droid-Deck/DroidDeck/pull/2892))
|
||||
- Fixed **the Desktop session**: it draws again and Sunshine can capture it, Windows games started from Steam no longer close after a second, Flatpak apps get the GPU and working file dialogs, and removable drives show in Dolphin. (@xXJSONDeruloXx, @maxjivi05, [#2780](https://github.com/Droid-Deck/DroidDeck/pull/2780), [#2446](https://github.com/Droid-Deck/DroidDeck/pull/2446), [#2597](https://github.com/Droid-Deck/DroidDeck/pull/2597), [#2699](https://github.com/Droid-Deck/DroidDeck/pull/2699), [#2671](https://github.com/Droid-Deck/DroidDeck/pull/2671), [#3190](https://github.com/Droid-Deck/DroidDeck/pull/3190))
|
||||
- Fixed **audio not coming back** after a long sleep, and **the HUD and game clocks** reading wrong after sleep and wake. (@maxjivi05, @xXJSONDeruloXx, [#2396](https://github.com/Droid-Deck/DroidDeck/pull/2396), [#2821](https://github.com/Droid-Deck/DroidDeck/pull/2821), [#2393](https://github.com/Droid-Deck/DroidDeck/pull/2393), [#2552](https://github.com/Droid-Deck/DroidDeck/pull/2552))
|
||||
- Fixed **Epic games that check for Epic’s launcher**, such as GTA V, quitting at start (they now also get the Rockstar SDK they need), and the **itch.io browse grid** staying empty on the default filters. (@K11MCH1, @FX192, [#2932](https://github.com/Droid-Deck/DroidDeck/pull/2932), [#2918](https://github.com/Droid-Deck/DroidDeck/pull/2918))
|
||||
- Fixed **other apps reaching DroidDeck’s private folders** through the system folder picker. (@Tapuuk, [#2846](https://github.com/Droid-Deck/DroidDeck/pull/2846))
|
||||
- Fixed **input and controls**: the on-screen controls editor drawing layouts squashed and overlapping, and saving a Steam touch layout for a game with no touch config; touch stopping after overlapping touches, taps clicking while an on-screen mouse button shows, and System Back turning into a right-click; a USB mouse in REDMAGIC cast mode stopping at the screen edge, held keys dropping when pointer capture ends, and rumble that kept going after a crash; controller navigation on the Apps page, B closing the page behind the on-screen keyboard, and the file manager toolbar after a drive change; a DualShock or DualSense picked mid-session not reattaching to Steam; SDL 3 games and apps that reload libudev crashing on the virtual pads, hardware Escape reaching Back late, and the nested mouse not moving with touch Disabled; launcher focus ring and navigation glitches, including the game page’s main action and tabs (@maxjivi05, @kingokksa, @OmarAlTaki1, @KvFxKaido, @zdennisz, @Tapuuk, @DeathKhan, @Dantalian-dev, @xXJSONDeruloXx, @Necomer0920, @0use-TE, @The412Banner, @xlulx, @2-Shar, [#2339](https://github.com/Droid-Deck/DroidDeck/pull/2339), [#2783](https://github.com/Droid-Deck/DroidDeck/pull/2783), [#2580](https://github.com/Droid-Deck/DroidDeck/pull/2580), [#2528](https://github.com/Droid-Deck/DroidDeck/pull/2528), [#2465](https://github.com/Droid-Deck/DroidDeck/pull/2465), [#2323](https://github.com/Droid-Deck/DroidDeck/pull/2323), [#2298](https://github.com/Droid-Deck/DroidDeck/pull/2298), [#2666](https://github.com/Droid-Deck/DroidDeck/pull/2666), [#2779](https://github.com/Droid-Deck/DroidDeck/pull/2779), [#2614](https://github.com/Droid-Deck/DroidDeck/pull/2614), [#2492](https://github.com/Droid-Deck/DroidDeck/pull/2492), [#2499](https://github.com/Droid-Deck/DroidDeck/pull/2499), [#2534](https://github.com/Droid-Deck/DroidDeck/pull/2534), [#2544](https://github.com/Droid-Deck/DroidDeck/pull/2544), [#2545](https://github.com/Droid-Deck/DroidDeck/pull/2545), [#2543](https://github.com/Droid-Deck/DroidDeck/pull/2543), [#2498](https://github.com/Droid-Deck/DroidDeck/pull/2498), [#2564](https://github.com/Droid-Deck/DroidDeck/pull/2564), [#2567](https://github.com/Droid-Deck/DroidDeck/pull/2567), [#2963](https://github.com/Droid-Deck/DroidDeck/pull/2963), [#2915](https://github.com/Droid-Deck/DroidDeck/pull/2915), [#3180](https://github.com/Droid-Deck/DroidDeck/pull/3180), [#2976](https://github.com/Droid-Deck/DroidDeck/pull/2976), [#2902](https://github.com/Droid-Deck/DroidDeck/pull/2902), [#3008](https://github.com/Droid-Deck/DroidDeck/pull/3008), [#2961](https://github.com/Droid-Deck/DroidDeck/pull/2961), [#3036](https://github.com/Droid-Deck/DroidDeck/pull/3036), [#3039](https://github.com/Droid-Deck/DroidDeck/pull/3039), [#2906](https://github.com/Droid-Deck/DroidDeck/pull/2906), [#2909](https://github.com/Droid-Deck/DroidDeck/pull/2909), [#3082](https://github.com/Droid-Deck/DroidDeck/pull/3082), [#2994](https://github.com/Droid-Deck/DroidDeck/pull/2994), [#2973](https://github.com/Droid-Deck/DroidDeck/pull/2973), [#2929](https://github.com/Droid-Deck/DroidDeck/pull/2929), [#3017](https://github.com/Droid-Deck/DroidDeck/pull/3017))
|
||||
- Fixed **Steam, stores and the Library**: x86-64 Steam store shortcuts that closed within a second, x86-64 Linux games missing libraries under FEX, and 32-bit games such as Left 4 Dead 2 aborting; Steam coming back empty after aborting a black-screen game, and an OpenGL game going black after a level; Return to DroidDeck ending the session at Steam’s install-script step, and Steam’s saved scaling mode not applying; Steam’s frame limits following Game Mode’s FPS override instead of the screen; cloud saves missing for a Steam game launched as an added game; GOG installs hanging on Finishing for games with thousands of files; GOG space checks and cloud saves, an Epic sign-in loop, EA touchup retries, Xbox bundles, and Battle.net games vanishing after a native session; Steam-install and Add game picker oddities, plus a warning when game storage is FAT32; launch requests now handled one at a time, and FEX or AppImage extraction hanging at start-up; Remote Play failing to connect with the virtual pads present, and fullscreen streams cropped to a corner (@maxjivi05, @xXJSONDeruloXx, @The412Banner, @KvFxKaido, @moronigranja, @zdennisz, @visail, @guohaomin1995-dev, [#2336](https://github.com/Droid-Deck/DroidDeck/pull/2336), [#2334](https://github.com/Droid-Deck/DroidDeck/pull/2334), [#2484](https://github.com/Droid-Deck/DroidDeck/pull/2484), [#2592](https://github.com/Droid-Deck/DroidDeck/pull/2592), [#2426](https://github.com/Droid-Deck/DroidDeck/pull/2426), [#2600](https://github.com/Droid-Deck/DroidDeck/pull/2600), [#2562](https://github.com/Droid-Deck/DroidDeck/pull/2562), [#2732](https://github.com/Droid-Deck/DroidDeck/pull/2732), [#2681](https://github.com/Droid-Deck/DroidDeck/pull/2681), [#2717](https://github.com/Droid-Deck/DroidDeck/pull/2717), [#2463](https://github.com/Droid-Deck/DroidDeck/pull/2463), [#2367](https://github.com/Droid-Deck/DroidDeck/pull/2367), [#2419](https://github.com/Droid-Deck/DroidDeck/pull/2419), [#2720](https://github.com/Droid-Deck/DroidDeck/pull/2720), [#3025](https://github.com/Droid-Deck/DroidDeck/pull/3025), [#2421](https://github.com/Droid-Deck/DroidDeck/pull/2421), [#2505](https://github.com/Droid-Deck/DroidDeck/pull/2505), [#3172](https://github.com/Droid-Deck/DroidDeck/pull/3172), [#3175](https://github.com/Droid-Deck/DroidDeck/pull/3175), [#3003](https://github.com/Droid-Deck/DroidDeck/pull/3003), [#3029](https://github.com/Droid-Deck/DroidDeck/pull/3029), [#3148](https://github.com/Droid-Deck/DroidDeck/pull/3148), [#3075](https://github.com/Droid-Deck/DroidDeck/pull/3075), [#2742](https://github.com/Droid-Deck/DroidDeck/pull/2742), [#2411](https://github.com/Droid-Deck/DroidDeck/pull/2411), [#2818](https://github.com/Droid-Deck/DroidDeck/pull/2818), [#3177](https://github.com/Droid-Deck/DroidDeck/pull/3177), [#3123](https://github.com/Droid-Deck/DroidDeck/pull/3123), [#2883](https://github.com/Droid-Deck/DroidDeck/pull/2883), [#3044](https://github.com/Droid-Deck/DroidDeck/pull/3044), [#3070](https://github.com/Droid-Deck/DroidDeck/pull/3070), [#2651](https://github.com/Droid-Deck/DroidDeck/pull/2651), [#2946](https://github.com/Droid-Deck/DroidDeck/pull/2946), [#2968](https://github.com/Droid-Deck/DroidDeck/pull/2968), [#3095](https://github.com/Droid-Deck/DroidDeck/pull/3095))
|
||||
- Fixed **display and drivers**: broken pictures on GPUs such as the Adreno 710 whose driver lists no buffer layouts; display and Steam window sizes after Steam resizes the game screen; the Mali bridge switch, Zink on Mali-G610 and shaders the phone’s compiler rejected (@The412Banner, @xXJSONDeruloXx, @LarzVader, @maxjivi05, [#2927](https://github.com/Droid-Deck/DroidDeck/pull/2927), [#2738](https://github.com/Droid-Deck/DroidDeck/pull/2738), [#3124](https://github.com/Droid-Deck/DroidDeck/pull/3124), [#2985](https://github.com/Droid-Deck/DroidDeck/pull/2985), [#3076](https://github.com/Droid-Deck/DroidDeck/pull/3076), [#3164](https://github.com/Droid-Deck/DroidDeck/pull/3164), [#3102](https://github.com/Droid-Deck/DroidDeck/pull/3102), [#3101](https://github.com/Droid-Deck/DroidDeck/pull/3101), [#2587](https://github.com/Droid-Deck/DroidDeck/pull/2587))
|
||||
- Fixed **a few more things**: a session freezing while a program waits for a browser sign-in, and picture-in-picture leaving no way back; the bottom screen ignoring touch during a game, and launching a running game again asking Steam twice; the app closing when opening Game environment from the second screen; the Stores tab moving under More, apps opening on the wrong screen, and the launcher freezing after a language change; game starts for Hades II, Dragon’s Dogma 2, Dragon Quest Monsters 4, Mount & Blade: Warband, Don’t Starve Together and Europa Universalis IV; x86 Steam stopping at Installing update under FEX, Battle.net unable to repair ProgramData folders a stale Windows owner locked, Windows programs reading the wrong CPU cache sizes, RetroArch’s packaged assets and cores, and non-Adreno graphics logs turning on Wine debug tracing; the desktop panel layout and KDE language packs; Decky Loader’s menu, Electron Node helpers, a Bluetooth controller that fails to disconnect closing the app, and per-game Turnip debug settings. Dual screen sessions also gets **On, game on second screen**, for a phone driving a monitor or TV (@maxjivi05, @xXJSONDeruloXx, @albert-carreras, @The412Banner, @xlulx, @Tapuuk, @zdennisz, @coffeemeist3r, [#2615](https://github.com/Droid-Deck/DroidDeck/pull/2615), [#2559](https://github.com/Droid-Deck/DroidDeck/pull/2559), [#2910](https://github.com/Droid-Deck/DroidDeck/pull/2910), [#2937](https://github.com/Droid-Deck/DroidDeck/pull/2937), [#2919](https://github.com/Droid-Deck/DroidDeck/pull/2919), [#2940](https://github.com/Droid-Deck/DroidDeck/pull/2940), [#2452](https://github.com/Droid-Deck/DroidDeck/pull/2452), [#3115](https://github.com/Droid-Deck/DroidDeck/pull/3115), [#3093](https://github.com/Droid-Deck/DroidDeck/pull/3093), [#3163](https://github.com/Droid-Deck/DroidDeck/pull/3163), [#2855](https://github.com/Droid-Deck/DroidDeck/pull/2855), [#3011](https://github.com/Droid-Deck/DroidDeck/pull/3011), [#2847](https://github.com/Droid-Deck/DroidDeck/pull/2847), [#3092](https://github.com/Droid-Deck/DroidDeck/pull/3092), [#2998](https://github.com/Droid-Deck/DroidDeck/pull/2998), [#3173](https://github.com/Droid-Deck/DroidDeck/pull/3173), [#2845](https://github.com/Droid-Deck/DroidDeck/pull/2845), [#2481](https://github.com/Droid-Deck/DroidDeck/pull/2481), [#2418](https://github.com/Droid-Deck/DroidDeck/pull/2418), [#2670](https://github.com/Droid-Deck/DroidDeck/pull/2670), [#2254](https://github.com/Droid-Deck/DroidDeck/pull/2254), [#2327](https://github.com/Droid-Deck/DroidDeck/pull/2327), [#2703](https://github.com/Droid-Deck/DroidDeck/pull/2703), [#2549](https://github.com/Droid-Deck/DroidDeck/pull/2549), [#2808](https://github.com/Droid-Deck/DroidDeck/pull/2808), [#2781](https://github.com/Droid-Deck/DroidDeck/pull/2781), [#2178](https://github.com/Droid-Deck/DroidDeck/pull/2178), [#2197](https://github.com/Droid-Deck/DroidDeck/pull/2197), [#3193](https://github.com/Droid-Deck/DroidDeck/pull/3193), [#3194](https://github.com/Droid-Deck/DroidDeck/pull/3194), [#2705](https://github.com/Droid-Deck/DroidDeck/pull/2705), [#2451](https://github.com/Droid-Deck/DroidDeck/pull/2451), [#2730](https://github.com/Droid-Deck/DroidDeck/pull/2730))
|
||||
|
||||
### DroidDeck-Proton and drivers
|
||||
|
||||
These ship outside the app and reach you through Components. DroidDeck 0.7.1 had DroidDeck-Proton 11-12.3 and DD-Turnip v0.5.0; 0.7.11 brings DroidDeck-Proton 11-14.1 and DD-Turnip v0.9.1.
|
||||
|
||||
- **Faster game starts, most of all from a memory card** (DroidDeck-Proton 11-12.5 to 11-12.7). Closing an event no longer stops every other thread while wineserver answers, events come back ready to wait on, closed private events are reused, and file lookups skip extended-attribute queries and folder scans a memory card can’t answer. World of Warcraft’s start fell from 111 s to 60 s. (@maxjivi05, [Proton#17](https://github.com/Droid-Deck/DroidDeck-Proton/pull/17), [Proton#19](https://github.com/Droid-Deck/DroidDeck-Proton/pull/19), [Proton#26](https://github.com/Droid-Deck/DroidDeck-Proton/pull/26))
|
||||
- Fixed **games that debug a copy of themselves**, such as Metal Gear Solid V: Ground Zeroes, stuck on the same breakpoint at start, and **old Steam DRM games failing with error 55**. (@xXJSONDeruloXx, [Proton#16](https://github.com/Droid-Deck/DroidDeck-Proton/pull/16), [Proton#12](https://github.com/Droid-Deck/DroidDeck-Proton/pull/12))
|
||||
- Fixed **intro videos that never end**, such as Burnout Paradise Remastered waiting forever on the last frame of its first intro. (@K11MCH1, [Proton#13](https://github.com/Droid-Deck/DroidDeck-Proton/pull/13), [Proton#14](https://github.com/Droid-Deck/DroidDeck-Proton/pull/14))
|
||||
- **DroidDeck-Proton 11-14.1 moves to GE-Proton11-14**, Valve’s Wine from 21 November and FEX-2611-68, with DXVK v3.1.1, VKD3D-Proton v3.1 and about 25 video playback fixes. Games that use D3D8 or 32-bit DirectDraw stay on wined3d, as in 11-12, unless you set `PROTON_DXVK_D3D8=1` or `PROTON_USE_D7VK=1`.
|
||||
- Fixed **games freezing after a thread is stopped mid-wait**, such as the Forza Horizon 6 loading screen, **Crash Bandicoot N. Sane Trilogy** closing seconds after its title screen, **Death Stranding Director’s Cut** crashing when a graphics setting is applied, **Call of Duty: Black Ops III** crashing about 20 seconds after start, and hooking libraries that couldn’t patch relocated 32-bit DLLs. (@l4nr3, @66sam, @KeegantheVeganat0r, @FryMcNugget, @maxjivi05, [Proton#30](https://github.com/Droid-Deck/DroidDeck-Proton/pull/30), [Proton#24](https://github.com/Droid-Deck/DroidDeck-Proton/pull/24), [Proton#31](https://github.com/Droid-Deck/DroidDeck-Proton/pull/31), [Proton#34](https://github.com/Droid-Deck/DroidDeck-Proton/pull/34), [Proton#40](https://github.com/Droid-Deck/DroidDeck-Proton/pull/40))
|
||||
- **DD-Turnip v0.6.0 to v0.9.1** follow Mesa main (more than 1,300 upstream commits). The GPU can clock down again when there is little to draw, so it runs cooler and saves battery, and game frames can go straight to the compositor’s display buffers for Zero-copy presentation. (@xXJSONDeruloXx, @maxjivi05, [Drivers#22](https://github.com/Droid-Deck/Drivers/pull/22), [Drivers#26](https://github.com/Droid-Deck/Drivers/pull/26), [Drivers#20](https://github.com/Droid-Deck/Drivers/pull/20), [Drivers#27](https://github.com/Droid-Deck/Drivers/pull/27))
|
||||
- **DD-Turnip-Emu**, the Android driver packaged for emulators, is now published with every DD-Turnip release. (@maxjivi05, [Drivers#31](https://github.com/Droid-Deck/Drivers/pull/31))
|
||||
- Fixed **invisible game menus after a descriptor pool reset**, such as the Scaleform UI in Detroit: Become Human on Adreno 840, and made **subgroup shuffles** cost one step instead of one per thread. (@l4nr3, [Drivers#12](https://github.com/Droid-Deck/Drivers/pull/12), [Drivers#10](https://github.com/Droid-Deck/Drivers/pull/10))
|
||||
|
||||
### Community
|
||||
|
||||
DroidDeck is built in the open by the people who use it. These are everyone whose code is in 0.7.11:
|
||||
|
||||
| Contributor | Pull requests |
|
||||
|---|---|
|
||||
| @xXJSONDeruloXx | 192: stores, run without proot, tabs and Settings, Library, screen picker, first run, Decky store and more |
|
||||
| @maxjivi05 | 141: zero-copy and HDR, memory card speed, memory management, CurseForge, on-screen controls, drivers and more |
|
||||
| @The412Banner | 23: DroidDeck-Bionic, Xbox backend, AppImages and Flatpaks without proot, Mali bridge |
|
||||
| @DeathKhan | 12: True black theme, Apps page, Home button |
|
||||
| @Tapuuk | 10: 8 Elite thread boost, start-up errors, HUD, CI |
|
||||
| @KeegantheVeganat0r | 9: Lab builds, Death Stranding fix |
|
||||
| @EnzoDLofi | 9: per-game frame generation, integer scaling, SMAA, Custom theme |
|
||||
| @2-Shar | 9: LT and RT tab stepping, page swipes, focus ring |
|
||||
| @FX192 | 8: Soundtracks, Favorites, Hidden tab, Manage stores, resolutions |
|
||||
| @kingokksa | 5: virtual pads outside Steam, HUD, translations |
|
||||
| @K11MCH1 | 4: Ubisoft launches, Epic launcher check |
|
||||
| @zdennisz | 4: held keys, FAT32 warning |
|
||||
| @alien2003 | 3: pen as a mouse, pen test tool, two-screen screenshots |
|
||||
| @Dantalian-dev | 3: file manager toolbar and Back, plain text editor |
|
||||
| @FryMcNugget | 3: Proton from a .zip, Lab build memory |
|
||||
| @xlulx | 3: SM8750P thread hints, nested mouse with touch disabled, native shader compilers for three games |
|
||||
| @JMLambo | 2: Plasma and Firefox on the system PowerVR driver |
|
||||
| @KvFxKaido | 2: Back gesture with controllers that bring a mouse, Xbox bundle packaging files |
|
||||
| @LarzVader | 2: Zink on Mali-G610, Mali layer map growth |
|
||||
| @visail | 2: Battle.net folder errors, launch request coordinator |
|
||||
| @0use-TE | 1: hardware Escape before Back |
|
||||
| @albert-carreras | 1: Dragon Quest Monsters 4 |
|
||||
| @ASEbrahim | 1: MaliBridge 0.5.5.4 |
|
||||
| @coffeemeist3r | 1: Mesa sampler fix |
|
||||
| @Drik0 | 1: per-game DLL overrides |
|
||||
| @guohaomin1995-dev | 1: arm64 Steam update progress in every language |
|
||||
| @informalTechCode | 1: XREAL One Pro+ tracking |
|
||||
| @JanPokorny | 1: Dev Harness focus fix |
|
||||
| @Kobtul | 1: Godot games with Sentry |
|
||||
| @l4nr3 | 1: Xbox PlayFab Game Saves |
|
||||
| @measlesbagel | 1: icon packs |
|
||||
| @mhaye20 | 1: XREAL One and Aura head tracking |
|
||||
| @moronigranja | 1: Steam target whose file is gone |
|
||||
| @Necomer0920 | 1: SDL 3 games and the virtual pads’ udev devices |
|
||||
| @OmarAlTaki1 | 1: USB mouse in cast mode |
|
||||
| @pablogonz12 | 1: payload shebangs |
|
||||
| @rainleee | 1: Mali bridge flicker |
|
||||
| @SlicelessBread | 1: Lab builds on 8 GB devices |
|
||||
| @unixenon | 1: Mali (Venus) switch after restart |
|
||||
| @vinegh4 | 1: Remote Play controllers |
|
||||
| @Zeratullo | 1: Xbox launch folder |
|
||||
| @66sam | 1: Crash Bandicoot fix in DroidDeck-Proton |
|
||||
|
||||
### New contributors
|
||||
|
||||
- @vinegh4 made their first contribution in [#2033](https://github.com/Droid-Deck/DroidDeck/pull/2033).
|
||||
- @measlesbagel made their first contribution in [#2207](https://github.com/Droid-Deck/DroidDeck/pull/2207).
|
||||
- @Drik0 made their first contribution in [#2332](https://github.com/Droid-Deck/DroidDeck/pull/2332).
|
||||
- @DeathKhan made their first contribution in [#2492](https://github.com/Droid-Deck/DroidDeck/pull/2492).
|
||||
- @rainleee made their first contribution in [#2506](https://github.com/Droid-Deck/DroidDeck/pull/2506).
|
||||
- @zdennisz made their first contribution in [#2524](https://github.com/Droid-Deck/DroidDeck/pull/2524).
|
||||
- @mhaye20 made their first contribution in [#2532](https://github.com/Droid-Deck/DroidDeck/pull/2532).
|
||||
- @Tapuuk made their first contribution in [#2607](https://github.com/Droid-Deck/DroidDeck/pull/2607).
|
||||
- @alien2003 made their first contribution in [#2625](https://github.com/Droid-Deck/DroidDeck/pull/2625).
|
||||
- @guohaomin1995-dev made their first contribution in [#2651](https://github.com/Droid-Deck/DroidDeck/pull/2651).
|
||||
- @KvFxKaido made their first contribution in [#2666](https://github.com/Droid-Deck/DroidDeck/pull/2666).
|
||||
- @SlicelessBread made their first contribution in [#2667](https://github.com/Droid-Deck/DroidDeck/pull/2667).
|
||||
- @unixenon made their first contribution in [#2684](https://github.com/Droid-Deck/DroidDeck/pull/2684).
|
||||
- @Zeratullo made their first contribution in [#2751](https://github.com/Droid-Deck/DroidDeck/pull/2751).
|
||||
- @JanPokorny made their first contribution in [#2769](https://github.com/Droid-Deck/DroidDeck/pull/2769).
|
||||
- @JMLambo made their first contribution in [#2836](https://github.com/Droid-Deck/DroidDeck/pull/2836).
|
||||
- @albert-carreras made their first contribution in [#2847](https://github.com/Droid-Deck/DroidDeck/pull/2847).
|
||||
- @2-Shar made their first contribution in [#2856](https://github.com/Droid-Deck/DroidDeck/pull/2856).
|
||||
- @FryMcNugget made their first contribution in [#2864](https://github.com/Droid-Deck/DroidDeck/pull/2864).
|
||||
- @xlulx made their first contribution in [#2914](https://github.com/Droid-Deck/DroidDeck/pull/2914).
|
||||
- @Necomer0920 made their first contribution in [#2915](https://github.com/Droid-Deck/DroidDeck/pull/2915).
|
||||
- @pablogonz12 made their first contribution in [#2930](https://github.com/Droid-Deck/DroidDeck/pull/2930).
|
||||
- @0use-TE made their first contribution in [#2976](https://github.com/Droid-Deck/DroidDeck/pull/2976).
|
||||
- @LarzVader made their first contribution in [#3101](https://github.com/Droid-Deck/DroidDeck/pull/3101).
|
||||
- @66sam made their first contribution in [Proton#24](https://github.com/Droid-Deck/DroidDeck-Proton/pull/24).
|
||||
|
||||
[Full changelog](https://github.com/Droid-Deck/DroidDeck/compare/0.7.1...0.7.11)
|
||||
|
Before Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 139 KiB |
|
Before Width: | Height: | Size: 132 KiB |
|
Before Width: | Height: | Size: 160 KiB |
|
Before Width: | Height: | Size: 140 KiB |
|
Before Width: | Height: | Size: 125 KiB |
|
Before Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 255 KiB |
|
Before Width: | Height: | Size: 157 KiB |
|
Before Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 142 KiB |
|
Before Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 87 KiB |
|
Before Width: | Height: | Size: 141 KiB |
|
Before Width: | Height: | Size: 69 KiB |
|
Before Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 73 KiB |
|
Before Width: | Height: | Size: 109 KiB |
@@ -3,16 +3,13 @@ import base64
|
||||
import fcntl
|
||||
import json
|
||||
import os
|
||||
import secrets
|
||||
import signal
|
||||
import socket
|
||||
import struct
|
||||
import subprocess
|
||||
import sys
|
||||
import threading
|
||||
|
||||
SOCKET_FILE = "/etc/droiddeck/bwrap-socket"
|
||||
MAX_FORWARDED_FDS = 253
|
||||
|
||||
|
||||
def socket_name():
|
||||
@@ -97,7 +94,6 @@ class Spec:
|
||||
self.json_fds = []
|
||||
self.keep_fds = []
|
||||
self.lock_files = []
|
||||
self.lock_fds = []
|
||||
self.command = []
|
||||
self.argv0 = None
|
||||
self.env_tool = None
|
||||
@@ -367,7 +363,6 @@ def hold_locks(s):
|
||||
sys.stderr.write("bwrap: Can't lock file %s: %s\n" % (path, e.strerror))
|
||||
sys.exit(1)
|
||||
os.set_inheritable(fd, True)
|
||||
s.lock_fds.append(fd)
|
||||
|
||||
|
||||
def report_pid(s, pid):
|
||||
@@ -384,28 +379,8 @@ def report_pid(s, pid):
|
||||
pass
|
||||
|
||||
|
||||
def bind_flatpak_info(s):
|
||||
if not s.env.get("DDNATV_ROOT"):
|
||||
return
|
||||
for op in s.ops:
|
||||
if op["t"] != "file" or op["dest"] != "/.flatpak-info":
|
||||
continue
|
||||
try:
|
||||
fd = os.memfd_create("flatpak-info", 0)
|
||||
except (AttributeError, OSError):
|
||||
return
|
||||
data = memoryview(op["data"])
|
||||
while data:
|
||||
data = data[os.write(fd, data):]
|
||||
os.lseek(fd, 0, os.SEEK_SET)
|
||||
entry = "/proc/%d/fd/%d:/.flatpak-info" % (os.getpid(), fd)
|
||||
binds = s.env.get("DDNATV_BINDS")
|
||||
s.env["DDNATV_BINDS"] = binds + "|" + entry if binds else entry
|
||||
|
||||
|
||||
def run_here(s):
|
||||
report_pid(s, os.getpid())
|
||||
bind_flatpak_info(s)
|
||||
for fd in s.json_fds:
|
||||
os.close(fd)
|
||||
if s.cwd:
|
||||
@@ -435,53 +410,7 @@ def recv_exact(sock, n):
|
||||
return buf
|
||||
|
||||
|
||||
def inherited_fds(s):
|
||||
own = set(s.info_fds + s.json_fds + s.keep_fds + s.lock_fds)
|
||||
fds = []
|
||||
for name in os.listdir("/proc/self/fd"):
|
||||
fd = int(name)
|
||||
if fd <= 2 or fd in own:
|
||||
continue
|
||||
try:
|
||||
if os.get_inheritable(fd):
|
||||
fds.append(fd)
|
||||
except OSError:
|
||||
pass
|
||||
return sorted(fds)
|
||||
|
||||
|
||||
def hand_over(listener, fds):
|
||||
try:
|
||||
conn, _ = listener.accept()
|
||||
except OSError:
|
||||
return
|
||||
finally:
|
||||
listener.close()
|
||||
with conn:
|
||||
creds = conn.getsockopt(socket.SOL_SOCKET, socket.SO_PEERCRED, struct.calcsize("3i"))
|
||||
if struct.unpack("3i", creds)[1] != os.getuid():
|
||||
return
|
||||
conn.sendmsg([",".join(map(str, fds)).encode()],
|
||||
[(socket.SOL_SOCKET, socket.SCM_RIGHTS, struct.pack("%di" % len(fds), *fds))])
|
||||
|
||||
|
||||
def offer_fds(s):
|
||||
fds = inherited_fds(s)
|
||||
if not fds:
|
||||
return
|
||||
if len(fds) > MAX_FORWARDED_FDS:
|
||||
sys.stderr.write("bwrap: Too many inherited file descriptors: %d\n" % len(fds))
|
||||
sys.exit(1)
|
||||
name = "droiddeck-fds-" + secrets.token_hex(16)
|
||||
listener = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
listener.bind("\0" + name)
|
||||
listener.listen(1)
|
||||
s.env["DROIDDECK_FDS"] = name
|
||||
threading.Thread(target=hand_over, args=(listener, fds), daemon=True).start()
|
||||
|
||||
|
||||
def run_by_app(s):
|
||||
offer_fds(s)
|
||||
ops = []
|
||||
for op in s.ops:
|
||||
op = dict(op)
|
||||
|
||||
@@ -1,199 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
import configparser
|
||||
import os
|
||||
import stat
|
||||
import sys
|
||||
|
||||
import gi
|
||||
|
||||
gi.require_version("Gio", "2.0")
|
||||
from gi.repository import Gio, GLib
|
||||
|
||||
NAME = "org.freedesktop.portal.Documents"
|
||||
PATH = "/org/freedesktop/portal/documents"
|
||||
VERSION = 5
|
||||
PROC = sys.argv[1] if len(sys.argv) > 1 else "/proc"
|
||||
AS_NEEDED_BY_APP = 1 << 2
|
||||
DIRECTORY = 1 << 3
|
||||
FAILED = "org.freedesktop.portal.Error.Failed"
|
||||
NOT_FOUND = "org.freedesktop.portal.Error.NotFound"
|
||||
NOT_ALLOWED = "org.freedesktop.portal.Error.NotAllowed"
|
||||
INVALID = "org.freedesktop.portal.Error.InvalidArgument"
|
||||
INTROSPECTION = """
|
||||
<node>
|
||||
<interface name="org.freedesktop.portal.Documents">
|
||||
<method name="GetMountPoint"><arg type="ay" direction="out"/></method>
|
||||
<method name="Add">
|
||||
<arg type="h" direction="in"/><arg type="b" direction="in"/><arg type="b" direction="in"/>
|
||||
<arg type="s" direction="out"/>
|
||||
</method>
|
||||
<method name="AddNamed">
|
||||
<arg type="h" direction="in"/><arg type="ay" direction="in"/><arg type="b" direction="in"/>
|
||||
<arg type="b" direction="in"/><arg type="s" direction="out"/>
|
||||
</method>
|
||||
<method name="AddFull">
|
||||
<arg type="ah" direction="in"/><arg type="u" direction="in"/><arg type="s" direction="in"/>
|
||||
<arg type="as" direction="in"/><arg type="as" direction="out"/><arg type="a{sv}" direction="out"/>
|
||||
</method>
|
||||
<method name="AddNamedFull">
|
||||
<arg type="h" direction="in"/><arg type="ay" direction="in"/><arg type="u" direction="in"/>
|
||||
<arg type="s" direction="in"/><arg type="as" direction="in"/><arg type="s" direction="out"/>
|
||||
<arg type="a{sv}" direction="out"/>
|
||||
</method>
|
||||
<method name="GrantPermissions">
|
||||
<arg type="s" direction="in"/><arg type="s" direction="in"/><arg type="as" direction="in"/>
|
||||
</method>
|
||||
<method name="RevokePermissions">
|
||||
<arg type="s" direction="in"/><arg type="s" direction="in"/><arg type="as" direction="in"/>
|
||||
</method>
|
||||
<method name="Delete"><arg type="s" direction="in"/></method>
|
||||
<method name="Lookup"><arg type="ay" direction="in"/><arg type="s" direction="out"/></method>
|
||||
<method name="Info">
|
||||
<arg type="s" direction="in"/><arg type="ay" direction="out"/><arg type="a{sas}" direction="out"/>
|
||||
</method>
|
||||
<method name="List"><arg type="s" direction="in"/><arg type="a{say}" direction="out"/></method>
|
||||
<method name="GetHostPaths"><arg type="as" direction="in"/><arg type="a{say}" direction="out"/></method>
|
||||
<property name="version" type="u" access="read"/>
|
||||
</interface>
|
||||
</node>
|
||||
"""
|
||||
|
||||
|
||||
def passed_fds(invocation, handles):
|
||||
fd_list = invocation.get_message().get_unix_fd_list()
|
||||
fds = fd_list.peek_fds() if fd_list else []
|
||||
return [fds[h] if 0 <= h < len(fds) else -1 for h in handles]
|
||||
|
||||
|
||||
def usable(fd, flags):
|
||||
try:
|
||||
mode = os.fstat(fd).st_mode
|
||||
except OSError:
|
||||
return False
|
||||
return stat.S_ISDIR(mode) if flags & DIRECTORY else stat.S_ISREG(mode)
|
||||
|
||||
|
||||
def app_name(pid):
|
||||
info = configparser.ConfigParser(interpolation=None)
|
||||
try:
|
||||
with open(os.path.join(PROC, pid, "root/.flatpak-info")) as f:
|
||||
info.read_file(f)
|
||||
except (OSError, UnicodeDecodeError, configparser.Error):
|
||||
return None
|
||||
return info.get("Application", "name", fallback=None)
|
||||
|
||||
|
||||
def root_of(pid):
|
||||
try:
|
||||
return os.stat(os.path.join(PROC, str(pid), "root", "."))
|
||||
except OSError:
|
||||
return None
|
||||
|
||||
|
||||
def app_pids(app_id):
|
||||
roots = {pid: root_of(pid) for pid in os.listdir(PROC) if pid.isdigit() and app_name(pid) == app_id}
|
||||
own = root_of(os.getpid())
|
||||
apart = [pid for pid, root in roots.items() if not (own and root and os.path.samestat(own, root))]
|
||||
return apart or list(roots)
|
||||
|
||||
|
||||
def access_mode(permissions):
|
||||
mode = os.R_OK if "read" in permissions else 0
|
||||
return mode | os.W_OK if "write" in permissions else mode
|
||||
|
||||
|
||||
def under(path, prefix):
|
||||
return path == prefix or path.startswith(prefix.rstrip("/") + "/")
|
||||
|
||||
|
||||
def spellings(path):
|
||||
root = os.environ.get("DDNATV_ROOT", "").rstrip("/")
|
||||
if root and under(path, root):
|
||||
path = path[len(root):] or "/"
|
||||
names = [path]
|
||||
for bind in filter(None, os.environ.get("DDNATV_BINDS", "").split("|")):
|
||||
host, _, guest = bind.partition(":")
|
||||
if host and guest and under(path, guest):
|
||||
name = host + path[len(guest.rstrip("/")):]
|
||||
if not (root and under(name, root)) and name not in names:
|
||||
names.append(name)
|
||||
return names
|
||||
|
||||
|
||||
def same_file(path, picked):
|
||||
try:
|
||||
return os.path.samestat(os.stat(path), picked)
|
||||
except OSError:
|
||||
return False
|
||||
|
||||
|
||||
def app_reaches(app_id, path, picked, permissions):
|
||||
if not app_id:
|
||||
return True
|
||||
mode = access_mode(permissions) or os.F_OK
|
||||
roots = [os.path.join(PROC, pid, "root") for pid in app_pids(app_id)]
|
||||
return any(same_file(root + name, picked) and os.access(root + name, mode)
|
||||
for root in roots for name in spellings(path))
|
||||
|
||||
|
||||
def fd_path(fd):
|
||||
try:
|
||||
path = os.readlink("/proc/self/fd/%d" % fd)
|
||||
except OSError:
|
||||
return None
|
||||
return path if path.startswith("/") else None
|
||||
|
||||
|
||||
def reachable_in_place(invocation, flags, handles, directories, app_id, permissions):
|
||||
if not flags & AS_NEEDED_BY_APP:
|
||||
invocation.return_dbus_error(NOT_ALLOWED, "Documents can only be shared in place")
|
||||
return False
|
||||
fds = passed_fds(invocation, handles)
|
||||
if not all(fd >= 0 and usable(fd, DIRECTORY if directories else flags) for fd in fds):
|
||||
invocation.return_dbus_error(INVALID, "Invalid fd passed")
|
||||
return False
|
||||
if not all(fd_path(fd) and app_reaches(app_id, fd_path(fd), os.fstat(fd), permissions) for fd in fds):
|
||||
invocation.return_dbus_error(NOT_ALLOWED, "The application can't reach this location without the document store")
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def on_call(connection, sender, path, interface, method, params, invocation):
|
||||
args = params.unpack()
|
||||
if method == "AddFull":
|
||||
handles, flags = args[0], args[1]
|
||||
if reachable_in_place(invocation, flags, handles, False, args[2], args[3]):
|
||||
invocation.return_value(GLib.Variant("(asa{sv})", ([""] * len(handles), {})))
|
||||
elif method == "AddNamedFull":
|
||||
if reachable_in_place(invocation, args[2], [args[0]], True, args[3], args[4]):
|
||||
invocation.return_value(GLib.Variant("(sa{sv})", ("", {})))
|
||||
elif method == "Lookup":
|
||||
invocation.return_value(GLib.Variant("(s)", ("",)))
|
||||
elif method == "List":
|
||||
invocation.return_value(GLib.Variant("(a{say})", ({},)))
|
||||
elif method == "GetHostPaths":
|
||||
invocation.return_value(GLib.Variant("(a{say})", ({},)))
|
||||
elif method in ("Add", "AddNamed"):
|
||||
invocation.return_dbus_error(NOT_ALLOWED, "Documents can only be shared in place")
|
||||
elif method in ("GrantPermissions", "RevokePermissions", "Delete", "Info"):
|
||||
invocation.return_dbus_error(NOT_FOUND, "Invalid document id")
|
||||
else:
|
||||
invocation.return_dbus_error(FAILED, "No document store mount")
|
||||
|
||||
|
||||
def on_get(connection, sender, path, interface, prop):
|
||||
return GLib.Variant("u", VERSION) if prop == "version" else None
|
||||
|
||||
|
||||
def main():
|
||||
loop = GLib.MainLoop()
|
||||
info = Gio.DBusNodeInfo.new_for_xml(INTROSPECTION).interfaces[0]
|
||||
bus = Gio.bus_get_sync(Gio.BusType.SESSION, None)
|
||||
bus.register_object(PATH, info, on_call, on_get, None)
|
||||
Gio.bus_own_name_on_connection(bus, NAME, Gio.BusNameOwnerFlags.DO_NOT_QUEUE, None, lambda *_: loop.quit())
|
||||
loop.run()
|
||||
return 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
import fcntl
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
@@ -7,8 +6,6 @@ import platform
|
||||
import re
|
||||
import runpy
|
||||
import signal
|
||||
import stat
|
||||
import struct
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
@@ -1049,9 +1046,6 @@ WINE_DLL_DIRS = ("/lib/wine/i386-windows", "/lib/wine/x86_64-windows", "/lib/win
|
||||
|
||||
|
||||
FOREIGN_SUFFIX = ".foreign-arch"
|
||||
WINE_SD = "user.wine.sd"
|
||||
SHARED_DATA = "pfx/drive_c/ProgramData"
|
||||
MACHINE_ID = "/etc/machine-id"
|
||||
PE = runpy.run_path(str(Path(__file__).resolve().parent / "droiddeck-wine-pe"))
|
||||
pe_machine = PE["pe_machine"]
|
||||
|
||||
@@ -1150,124 +1144,6 @@ def repair_foreign_system_dlls(prefix, proton, env=None):
|
||||
return repaired
|
||||
|
||||
|
||||
def wine_user_sid():
|
||||
try:
|
||||
with open(MACHINE_ID, "rb") as handle:
|
||||
text = handle.read(16)
|
||||
except OSError:
|
||||
return (21, 0, 0, 0, 1000)
|
||||
if len(text) != 16:
|
||||
return (21, 0, 0, 0, 1000)
|
||||
sign, digits = re.match(rb"\s*([+-]?)(?:0[xX])?([0-9a-fA-F]*)", text).groups()
|
||||
machine = int(digits, 16) if digits else 0
|
||||
if sign == b"-":
|
||||
machine = -machine % (1 << 64)
|
||||
return (21, machine >> 32, machine & 0xffffffff, os.getuid(), 1000)
|
||||
|
||||
|
||||
def wine_sd_owner(path):
|
||||
try:
|
||||
data = os.getxattr(path, WINE_SD, follow_symlinks=False)
|
||||
except OSError:
|
||||
return None
|
||||
if len(data) < 22:
|
||||
return None
|
||||
sid = data[22:22 + struct.unpack_from("<I", data, 6)[0]]
|
||||
if len(sid) < 8 or len(sid) < 8 + 4 * sid[1]:
|
||||
return None
|
||||
return sid[0], int.from_bytes(sid[2:8], "big"), struct.unpack_from("<%dI" % sid[1], sid, 8)
|
||||
|
||||
|
||||
def is_stale_owner(owner, user):
|
||||
if owner is None:
|
||||
return False
|
||||
revision, authority, subs = owner
|
||||
return revision == 1 and authority == 5 and len(subs) == 5 and subs[0] == 21 and subs[4] == 1000 \
|
||||
and subs != user
|
||||
|
||||
|
||||
def heal_wine_entry(path, is_dir, user):
|
||||
try:
|
||||
mode = stat.S_IMODE(os.lstat(path).st_mode)
|
||||
except OSError:
|
||||
return None, False
|
||||
readable = mode
|
||||
if not mode & stat.S_IRUSR:
|
||||
readable = mode | stat.S_IRUSR
|
||||
try:
|
||||
os.chmod(path, readable)
|
||||
except OSError:
|
||||
return None, False
|
||||
final = mode
|
||||
stale = is_stale_owner(wine_sd_owner(path), user)
|
||||
cleared = False
|
||||
if stale and (not mode & stat.S_IRUSR or is_dir and not mode & stat.S_IXUSR):
|
||||
final = mode | (stat.S_IRWXU if is_dir else stat.S_IRUSR | stat.S_IWUSR)
|
||||
try:
|
||||
if stale:
|
||||
os.chmod(path, final | stat.S_IWUSR)
|
||||
try:
|
||||
os.removexattr(path, WINE_SD, follow_symlinks=False)
|
||||
cleared = True
|
||||
except OSError:
|
||||
pass
|
||||
if not final & stat.S_IWUSR:
|
||||
os.chmod(path, final)
|
||||
elif final != readable:
|
||||
os.chmod(path, final)
|
||||
except OSError:
|
||||
return None, cleared
|
||||
return (mode, final), cleared
|
||||
|
||||
|
||||
def heal_shared_data(prefix):
|
||||
root = Path(prefix) / SHARED_DATA
|
||||
if root.is_symlink() or not root.is_dir():
|
||||
return [], []
|
||||
try:
|
||||
lock = os.open(root.parent.parent, os.O_RDONLY | os.O_DIRECTORY)
|
||||
except OSError:
|
||||
return [], []
|
||||
try:
|
||||
fcntl.flock(lock, fcntl.LOCK_EX)
|
||||
return heal_shared_data_locked(root)
|
||||
finally:
|
||||
os.close(lock)
|
||||
|
||||
|
||||
def heal_shared_data_locked(root):
|
||||
user = wine_user_sid()
|
||||
unlocked = []
|
||||
cleared = []
|
||||
pending = [(str(root), True)]
|
||||
while pending:
|
||||
path, is_dir = pending.pop()
|
||||
modes, was_cleared = heal_wine_entry(path, is_dir, user)
|
||||
name = os.path.relpath(path, root)
|
||||
if was_cleared:
|
||||
cleared.append(name)
|
||||
if modes is None:
|
||||
continue
|
||||
mode, final = modes
|
||||
if final != mode:
|
||||
unlocked.append(name)
|
||||
if not is_dir or final & (stat.S_IRUSR | stat.S_IXUSR) != stat.S_IRUSR | stat.S_IXUSR:
|
||||
continue
|
||||
try:
|
||||
with os.scandir(path) as entries:
|
||||
for entry in entries:
|
||||
try:
|
||||
if entry.is_dir(follow_symlinks=False):
|
||||
pending.append((entry.path, True))
|
||||
elif entry.is_file(follow_symlinks=False):
|
||||
pending.append((entry.path, False))
|
||||
except OSError:
|
||||
continue
|
||||
except OSError:
|
||||
continue
|
||||
return sorted(unlocked), sorted(cleared)
|
||||
|
||||
|
||||
def is_wine_dll_link(path):
|
||||
try:
|
||||
return os.path.islink(path) and os.path.dirname(os.readlink(path)).endswith(WINE_DLL_DIRS)
|
||||
@@ -1530,13 +1406,9 @@ def game_logs(command, env, app_id, now=None):
|
||||
except OSError as error:
|
||||
print("droiddeck-game-env: no game log folder (%s)" % error, file=sys.stderr)
|
||||
return env
|
||||
proton_log = env.get("PROTON_LOG", "")
|
||||
asked = proton_log not in ("", "0")
|
||||
result = dict(env)
|
||||
if not asked:
|
||||
result.setdefault("WINEDEBUG", "-all,err+all")
|
||||
result.update({
|
||||
"PROTON_LOG": proton_log if asked else "1",
|
||||
"PROTON_LOG": "1",
|
||||
"PROTON_LOG_DIR": str(folder),
|
||||
"DXVK_LOG_PATH": str(folder),
|
||||
"DXVK_LOG_LEVEL": env.get("DXVK_LOG_LEVEL", "info"),
|
||||
@@ -1614,14 +1486,6 @@ def main():
|
||||
except OSError as error:
|
||||
restored = fixed = []
|
||||
print("droiddeck-game-env: prefix system DLL check skipped (%s)" % error, file=sys.stderr)
|
||||
try:
|
||||
unlocked, cleared = heal_shared_data(prefix_path)
|
||||
except OSError as error:
|
||||
unlocked = cleared = []
|
||||
print("droiddeck-game-env: ProgramData owner check skipped (%s)" % error, file=sys.stderr)
|
||||
if cleared:
|
||||
print("droiddeck-game-env: cleared %d stale Windows owners in ProgramData; unlocked: %s"
|
||||
% (len(cleared), ", ".join(unlocked) or "none"), file=sys.stderr)
|
||||
if restored:
|
||||
print("droiddeck-game-env: restored system DLLs this Proton's own programs do not load: %s" % ", ".join(restored),
|
||||
file=sys.stderr)
|
||||
|
||||
@@ -66,14 +66,6 @@ ensure_machine_id() {
|
||||
} 2>/dev/null
|
||||
ensure_machine_id
|
||||
|
||||
write_document_store_service() {
|
||||
[ -x /usr/local/bin/droiddeck-documents ] || return 0
|
||||
mkdir -p /usr/local/share/dbus-1/services &&
|
||||
printf '[D-BUS Service]\nName=org.freedesktop.portal.Documents\nExec=/usr/local/bin/droiddeck-documents\n' \
|
||||
> /usr/local/share/dbus-1/services/org.freedesktop.portal.Documents.service
|
||||
} 2>/dev/null
|
||||
write_document_store_service
|
||||
|
||||
write_system_bus_config() {
|
||||
mkdir -p /run/dbus /usr/local/share/droiddeck
|
||||
cat > /usr/local/share/droiddeck/system-bus.conf <<'BUSCONF'
|
||||
|
||||
@@ -213,8 +213,7 @@ int open(const char *pathname, int flags, ...) {
|
||||
int status_fd = open_proc_status(pathname, flags);
|
||||
if (status_fd != -2) return status_fd;
|
||||
char buf[PATH_MAX];
|
||||
const char *target = proc_root_host(pathname, buf, sizeof(buf), !(flags & O_NOFOLLOW), !(flags & O_NOFOLLOW));
|
||||
if (!target) target = ((flags & O_NOFOLLOW) ? rewrite_path : rewrite_path_follow)(pathname, buf, sizeof(buf));
|
||||
const char *target = ((flags & O_NOFOLLOW) ? rewrite_path : rewrite_path_follow)(pathname, buf, sizeof(buf));
|
||||
if (open_needs_mode(flags)) {
|
||||
va_list args;
|
||||
va_start(args, flags);
|
||||
@@ -222,12 +221,9 @@ int open(const char *pathname, int flags, ...) {
|
||||
va_end(args);
|
||||
int fd = orig_open(target, flags, mode);
|
||||
if (fd < 0 && (flags & O_CREAT) && refused_in_repaired_dir(AT_FDCWD, target)) fd = orig_open(target, flags, mode);
|
||||
forget_proc_root_fd(fd);
|
||||
return fd;
|
||||
}
|
||||
int fd = orig_open(target, flags);
|
||||
remember_proc_root_fd(fd, pathname);
|
||||
return fd;
|
||||
return orig_open(target, flags);
|
||||
}
|
||||
|
||||
// Hook openat
|
||||
@@ -247,8 +243,7 @@ int openat(int dirfd, const char *pathname, int flags, ...) {
|
||||
int status_fd = (pathname && pathname[0] == '/') ? open_proc_status(pathname, flags) : open_proc_status_at(dirfd, pathname, flags);
|
||||
if (status_fd != -2) return status_fd;
|
||||
char buf[PATH_MAX];
|
||||
const char *target = proc_root_host(pathname, buf, sizeof(buf), !(flags & O_NOFOLLOW), !(flags & O_NOFOLLOW));
|
||||
if (!target) target = (pathname && pathname[0] == '/') ? ((flags & O_NOFOLLOW) ? rewrite_path : rewrite_path_follow)(pathname, buf, sizeof(buf)) : pathname;
|
||||
const char *target = (pathname && pathname[0] == '/') ? ((flags & O_NOFOLLOW) ? rewrite_path : rewrite_path_follow)(pathname, buf, sizeof(buf)) : pathname;
|
||||
if (open_needs_mode(flags)) {
|
||||
va_list args;
|
||||
va_start(args, flags);
|
||||
@@ -256,12 +251,9 @@ int openat(int dirfd, const char *pathname, int flags, ...) {
|
||||
va_end(args);
|
||||
int fd = orig_openat(dirfd, target, flags, mode);
|
||||
if (fd < 0 && (flags & O_CREAT) && refused_in_repaired_dir(dirfd, target)) fd = orig_openat(dirfd, target, flags, mode);
|
||||
forget_proc_root_fd(fd);
|
||||
return fd;
|
||||
}
|
||||
int fd = orig_openat(dirfd, target, flags);
|
||||
remember_proc_root_fd(fd, pathname);
|
||||
return fd;
|
||||
return orig_openat(dirfd, target, flags);
|
||||
}
|
||||
|
||||
// Hook creat
|
||||
|
||||
@@ -244,7 +244,6 @@ int close(int fd) {
|
||||
if (g_kept_fd_count > 0 && is_kept_fd(fd)) return 0;
|
||||
clear_dns_redirect(fd);
|
||||
set_chosen_port_fd(fd, 0);
|
||||
forget_proc_root_fd(fd);
|
||||
return orig_close ? orig_close(fd) : -1;
|
||||
}
|
||||
|
||||
@@ -255,9 +254,7 @@ int dup2(int oldfd, int newfd) {
|
||||
clear_dns_redirect(newfd);
|
||||
set_chosen_port_fd(newfd, is_chosen_port_fd(oldfd));
|
||||
}
|
||||
int ret = orig_dup2 ? orig_dup2(oldfd, newfd) : -1;
|
||||
if (ret >= 0) copy_proc_root_fd(oldfd, ret);
|
||||
return ret;
|
||||
return orig_dup2 ? orig_dup2(oldfd, newfd) : -1;
|
||||
}
|
||||
|
||||
int dup3(int oldfd, int newfd, int flags) {
|
||||
@@ -267,9 +264,7 @@ int dup3(int oldfd, int newfd, int flags) {
|
||||
clear_dns_redirect(newfd);
|
||||
set_chosen_port_fd(newfd, is_chosen_port_fd(oldfd));
|
||||
}
|
||||
int ret = orig_dup3 ? orig_dup3(oldfd, newfd, flags) : -1;
|
||||
if (ret >= 0) copy_proc_root_fd(oldfd, ret);
|
||||
return ret;
|
||||
return orig_dup3 ? orig_dup3(oldfd, newfd, flags) : -1;
|
||||
}
|
||||
|
||||
static int get_dns_redirect(int fd, struct sockaddr_storage *orig, socklen_t *orig_len) {
|
||||
|
||||
@@ -171,11 +171,6 @@ static int is_android_host_path(const char *path) {
|
||||
}
|
||||
|
||||
static const char *rewrite_path_in_root(const char *path, char *buffer, size_t bufsize);
|
||||
#ifndef DDNATV_HOST_TEST
|
||||
static const char *proc_root_host(const char *path, char *buf, size_t size, int bare, int follow);
|
||||
static const char *rewrite_path_follow(const char *path, char *buffer, size_t bufsize);
|
||||
static const char *proc_root_at(int dirfd, const char *rel, char *buf, size_t size);
|
||||
#endif
|
||||
|
||||
#if defined(__aarch64__)
|
||||
static long raw_readlinkat(int dirfd, const char *path, char *buf, size_t size) {
|
||||
@@ -376,13 +371,6 @@ static const char *rewrite_path_in_root(const char *path, char *buffer, size_t b
|
||||
return buffer;
|
||||
}
|
||||
|
||||
#ifndef DDNATV_HOST_TEST
|
||||
if (path[1] == 'p' && strncmp(path, "/proc/", 6) == 0 && path[6] >= '1' && path[6] <= '9') {
|
||||
const char *other = proc_root_host(path, buffer, bufsize, 0, 0);
|
||||
if (other) return other;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < g_nbinds; i++) {
|
||||
const struct ddnatv_bind *b = &g_binds[i];
|
||||
if (path[1] == b->dst[1] && is_path_prefix(path, b->dst, b->dst_len)) {
|
||||
@@ -851,10 +839,6 @@ static const char *map_parent_walk(int dirfd, const char *rel, char *buf, size_t
|
||||
static const char *map_at(int dirfd, const char *rel, char *buf, size_t size) {
|
||||
#if defined(__aarch64__)
|
||||
if (!rel || rel[0] == '\0' || rel[0] == '/') return NULL;
|
||||
#ifndef DDNATV_HOST_TEST
|
||||
const char *other = proc_root_at(dirfd, rel, buf, size);
|
||||
if (other) return other;
|
||||
#endif
|
||||
if (strstr(rel, "..")) {
|
||||
const char *walked = map_parent_walk(dirfd, rel, buf, size);
|
||||
if (walked || dirfd == AT_FDCWD) return walked;
|
||||
|
||||
@@ -446,7 +446,6 @@ static int close_range_part(unsigned int first, unsigned int last, void *flags)
|
||||
}
|
||||
|
||||
int close_range(unsigned int first, unsigned int last, int flags) {
|
||||
if (!(flags & CLOSE_RANGE_CLOEXEC)) forget_proc_root_range(first, last);
|
||||
// Close-on-exec only (CLOSE_RANGE_CLOEXEC) leaves the translator's files open
|
||||
if (g_kept_fd_count > 0 && !(flags & CLOSE_RANGE_CLOEXEC)) {
|
||||
return for_each_range_without(first, last, g_kept_fds, g_kept_fd_count, close_range_part, &flags);
|
||||
|
||||
@@ -136,95 +136,7 @@ static void init_ddnatv_hook(void) {
|
||||
// time it was read.
|
||||
static void compact_loader_args(int argc, char **argv);
|
||||
|
||||
#define DDNATV_MAX_FORWARDED_FDS 253
|
||||
|
||||
static int forwarded_targets(char *text, int *targets, int max) {
|
||||
int count = 0;
|
||||
for (char *p = text; *p && count < max;) {
|
||||
char *end;
|
||||
long fd = strtol(p, &end, 10);
|
||||
if (end == p) break;
|
||||
targets[count++] = fd >= 0 && fd <= INT_MAX ? (int)fd : -1;
|
||||
p = *end == ',' ? end + 1 : end;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static int is_forwarded_target(int fd, const int *targets, int wanted) {
|
||||
for (int i = 0; i < wanted; i++) {
|
||||
if (targets[i] == fd) return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void adopt_forwarded_fds(void) {
|
||||
const char *name = getenv("DROIDDECK_FDS");
|
||||
if (!name) return;
|
||||
struct sockaddr_un addr;
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sun_family = AF_UNIX;
|
||||
size_t len = strlen(name);
|
||||
int usable = len > 0 && len + 1 <= sizeof(addr.sun_path);
|
||||
if (usable) memcpy(addr.sun_path + 1, name, len);
|
||||
unsetenv("DROIDDECK_FDS");
|
||||
if (!usable) return;
|
||||
int sock = (int)syscall(SYS_socket, AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
|
||||
if (sock < 0) return;
|
||||
static char text[4096];
|
||||
static int got[DDNATV_MAX_FORWARDED_FDS];
|
||||
int count = 0;
|
||||
int truncated = 0;
|
||||
ssize_t n = -1;
|
||||
socklen_t addr_len = (socklen_t)(offsetof(struct sockaddr_un, sun_path) + 1 + len);
|
||||
if (syscall(SYS_connect, sock, &addr, addr_len) == 0) {
|
||||
static union {
|
||||
struct cmsghdr header;
|
||||
char buf[CMSG_SPACE(sizeof(got))];
|
||||
} control;
|
||||
struct iovec iov = {text, sizeof(text) - 1};
|
||||
struct msghdr msg;
|
||||
memset(&msg, 0, sizeof(msg));
|
||||
msg.msg_iov = &iov;
|
||||
msg.msg_iovlen = 1;
|
||||
msg.msg_control = control.buf;
|
||||
msg.msg_controllen = sizeof(control.buf);
|
||||
do {
|
||||
n = syscall(SYS_recvmsg, sock, &msg, MSG_CMSG_CLOEXEC);
|
||||
} while (n < 0 && errno == EINTR);
|
||||
truncated = n >= 0 && (msg.msg_flags & (MSG_CTRUNC | MSG_TRUNC)) != 0;
|
||||
for (struct cmsghdr *c = n >= 0 ? CMSG_FIRSTHDR(&msg) : NULL; c; c = CMSG_NXTHDR(&msg, c)) {
|
||||
if (c->cmsg_level != SOL_SOCKET || c->cmsg_type != SCM_RIGHTS) continue;
|
||||
size_t k = (c->cmsg_len - CMSG_LEN(0)) / sizeof(int);
|
||||
for (size_t i = 0; i < k && count < DDNATV_MAX_FORWARDED_FDS; i++) {
|
||||
memcpy(&got[count++], CMSG_DATA(c) + i * sizeof(int), sizeof(int));
|
||||
}
|
||||
}
|
||||
}
|
||||
syscall(SYS_close, sock);
|
||||
text[n > 0 ? n : 0] = '\0';
|
||||
static int targets[DDNATV_MAX_FORWARDED_FDS];
|
||||
int wanted = truncated ? 0 : forwarded_targets(text, targets, DDNATV_MAX_FORWARDED_FDS);
|
||||
if (wanted != count) wanted = 0;
|
||||
static int parked[DDNATV_MAX_FORWARDED_FDS];
|
||||
int n_parked = 0;
|
||||
for (int i = 0; i < count; i++) {
|
||||
int fd = got[i];
|
||||
while (fd >= 0 && is_forwarded_target(fd, targets, wanted) && n_parked < DDNATV_MAX_FORWARDED_FDS) {
|
||||
parked[n_parked++] = fd;
|
||||
fd = (int)syscall(SYS_fcntl, fd, F_DUPFD_CLOEXEC, 3);
|
||||
}
|
||||
got[i] = is_forwarded_target(fd, targets, wanted) ? -1 : fd;
|
||||
}
|
||||
for (int i = 0; i < n_parked; i++) syscall(SYS_close, parked[i]);
|
||||
for (int i = 0; i < count; i++) {
|
||||
if (got[i] < 0) continue;
|
||||
if (i < wanted && targets[i] > 2) syscall(SYS_dup3, got[i], targets[i], 0);
|
||||
syscall(SYS_close, got[i]);
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((constructor(103))) static void init_ddnatv_hook_early(int argc, char **argv) {
|
||||
adopt_forwarded_fds();
|
||||
init_ddnatv_hook();
|
||||
compact_loader_args(argc, argv);
|
||||
// The kernel names the process after what it executed, the rootfs ld.so: process monitors, and
|
||||
@@ -368,200 +280,6 @@ static int proc_env_value(pid_t pid, const char *key, char *out, size_t outsz) {
|
||||
return found;
|
||||
}
|
||||
|
||||
static pid_t proc_root_pid(const char *path, const char **rest) {
|
||||
if (!path || strncmp(path, "/proc/", 6) != 0 || path[6] < '1' || path[6] > '9') return 0;
|
||||
const char *p = path + 6;
|
||||
long pid = 0;
|
||||
while (*p >= '0' && *p <= '9') {
|
||||
pid = pid * 10 + (*p++ - '0');
|
||||
if (pid > 0x3fffffff) return 0;
|
||||
}
|
||||
if (strncmp(p, "/root", 5) != 0 || (p[5] != '\0' && p[5] != '/')) return 0;
|
||||
*rest = p + 5;
|
||||
return (pid_t)pid;
|
||||
}
|
||||
|
||||
static int proc_view_of(pid_t pid, char **root, char **binds) {
|
||||
char path[64];
|
||||
snprintf(path, sizeof(path), "/proc/%d/environ", (int)pid);
|
||||
size_t used;
|
||||
int whole;
|
||||
*root = NULL;
|
||||
*binds = NULL;
|
||||
char *env = read_proc_file(path, &used, &whole);
|
||||
if (!env) return 0;
|
||||
for (char *e = env; e < env + used; e += strlen(e) + 1) {
|
||||
if (!*root && strncmp(e, "DDNATV_ROOT=", 12) == 0 && e[12] == '/') *root = strdup(e + 12);
|
||||
else if (!*binds && strncmp(e, "DDNATV_BINDS=", 13) == 0) *binds = strdup(e + 13);
|
||||
}
|
||||
free(env);
|
||||
if (*root) return 1;
|
||||
free(*binds);
|
||||
*binds = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *proc_view_path(const char *root, char *binds, const char *guest, char *buf, size_t size) {
|
||||
const char *best_src = NULL, *best_dst = NULL;
|
||||
size_t best_len = 0;
|
||||
char *save = NULL;
|
||||
for (char *entry = binds ? strtok_r(binds, "|", &save) : NULL; entry; entry = strtok_r(NULL, "|", &save)) {
|
||||
char *colon = strchr(entry, ':');
|
||||
const char *dst = colon ? colon + 1 : entry;
|
||||
if (colon) *colon = '\0';
|
||||
size_t len = strlen(dst);
|
||||
while (len > 1 && dst[len - 1] == '/') len--;
|
||||
if (entry[0] != '/' || dst[0] != '/' || len < 2 || len <= best_len || !is_path_prefix(guest, dst, len)) continue;
|
||||
best_src = entry;
|
||||
best_dst = dst;
|
||||
best_len = len;
|
||||
}
|
||||
if (best_src && strncmp(best_src, best_dst, best_len) == 0 && best_src[best_len] == '\0') {
|
||||
ddnatv_copy_cstr(buf, size, guest);
|
||||
} else if (best_src) {
|
||||
size_t n = strncmp(best_src, "/proc/", 6) == 0 && best_src[6] >= '0' && best_src[6] <= '9'
|
||||
? ddnatv_copy_cstr(buf, size, best_src)
|
||||
: ddnatv_kernel_path(best_src, strlen(best_src), buf, size);
|
||||
ddnatv_append(buf, size, n, guest + best_len, strlen(guest + best_len));
|
||||
} else if (is_android_host_path(guest)) {
|
||||
ddnatv_copy_cstr(buf, size, guest);
|
||||
} else {
|
||||
size_t n = ddnatv_copy_cstr(buf, size, root);
|
||||
if (guest[1]) ddnatv_append(buf, size, n, guest, strlen(guest));
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
static const char *proc_view_host(const char *root, const char *binds, const char *guest, char *buf, size_t size) {
|
||||
char *copy = binds ? strdup(binds) : NULL;
|
||||
proc_view_path(root, copy, guest, buf, size);
|
||||
free(copy);
|
||||
return buf;
|
||||
}
|
||||
|
||||
static const char *proc_root_host(const char *path, char *buf, size_t size, int bare, int follow) {
|
||||
const char *rest = NULL;
|
||||
pid_t pid = proc_root_pid(path, &rest);
|
||||
if (pid <= 0 || (!bare && rest[0] == '\0')) return NULL;
|
||||
char *root, *binds;
|
||||
if (!proc_view_of(pid, &root, &binds)) return NULL;
|
||||
size_t root_len = strlen(root);
|
||||
while (root_len > 1 && root[root_len - 1] == '/') root_len--;
|
||||
char root_k[PATH_MAX], guest[PATH_MAX];
|
||||
ddnatv_kernel_path(root, root_len, root_k, sizeof(root_k));
|
||||
ddnatv_copy_cstr(guest, sizeof(guest), rest[0] ? rest : "/");
|
||||
normalize_path(guest);
|
||||
if (strcmp(root_k, g_ddnatv_root) == 0 && strcmp(binds ? binds : "", g_binds_raw ? g_binds_raw : "") == 0) {
|
||||
const char *own = (follow ? rewrite_path_follow : rewrite_path_in_root)(guest, buf, size);
|
||||
if (own != buf) ddnatv_copy_cstr(buf, size, own);
|
||||
} else {
|
||||
proc_view_host(root_k, binds, guest, buf, size);
|
||||
#if defined(__aarch64__)
|
||||
for (int depth = 0; follow && depth < 8 && strncmp(buf, "/proc/", 6) != 0; depth++) {
|
||||
char target[PATH_MAX];
|
||||
long n = raw_readlinkat(AT_FDCWD, buf, target, sizeof(target) - 1);
|
||||
if (n <= 0) break;
|
||||
target[n] = '\0';
|
||||
char joined[PATH_MAX];
|
||||
if (target[0] == '/') {
|
||||
ddnatv_copy_cstr(joined, sizeof(joined), target);
|
||||
} else {
|
||||
const char *slash = strrchr(guest, '/');
|
||||
size_t used = ddnatv_append(joined, sizeof(joined), 0, guest, slash ? (size_t)(slash - guest) : 0);
|
||||
used = ddnatv_append(joined, sizeof(joined), used, "/", 1);
|
||||
ddnatv_append(joined, sizeof(joined), used, target, strlen(target));
|
||||
}
|
||||
normalize_path(joined);
|
||||
ddnatv_copy_cstr(guest, sizeof(guest), joined);
|
||||
proc_view_host(root_k, binds, guest, buf, size);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
free(root);
|
||||
free(binds);
|
||||
return buf;
|
||||
}
|
||||
|
||||
struct ddnatv_proc_root_fd {
|
||||
int fd;
|
||||
pid_t pid;
|
||||
unsigned long dev, ino;
|
||||
};
|
||||
static struct ddnatv_proc_root_fd g_proc_root_fds[32];
|
||||
static int g_n_proc_root_fds = 0;
|
||||
static pthread_mutex_t g_proc_root_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
static void forget_proc_root_range(unsigned int first, unsigned int last) {
|
||||
if (__atomic_load_n(&g_n_proc_root_fds, __ATOMIC_ACQUIRE) == 0) return;
|
||||
pthread_mutex_lock(&g_proc_root_mutex);
|
||||
for (int i = 0; i < g_n_proc_root_fds;) {
|
||||
unsigned int fd = (unsigned int)g_proc_root_fds[i].fd;
|
||||
if (fd >= first && fd <= last) g_proc_root_fds[i] = g_proc_root_fds[--g_n_proc_root_fds];
|
||||
else i++;
|
||||
}
|
||||
pthread_mutex_unlock(&g_proc_root_mutex);
|
||||
}
|
||||
|
||||
static void forget_proc_root_fd(int fd) {
|
||||
if (fd >= 0) forget_proc_root_range((unsigned int)fd, (unsigned int)fd);
|
||||
}
|
||||
|
||||
static void store_proc_root_fd(struct ddnatv_proc_root_fd entry) {
|
||||
pthread_mutex_lock(&g_proc_root_mutex);
|
||||
int slot = 0;
|
||||
while (slot < g_n_proc_root_fds && g_proc_root_fds[slot].fd != entry.fd) slot++;
|
||||
if (slot == g_n_proc_root_fds && slot == (int)(sizeof(g_proc_root_fds) / sizeof(g_proc_root_fds[0]))) slot = 0;
|
||||
g_proc_root_fds[slot] = entry;
|
||||
if (slot == g_n_proc_root_fds) __atomic_store_n(&g_n_proc_root_fds, g_n_proc_root_fds + 1, __ATOMIC_RELEASE);
|
||||
pthread_mutex_unlock(&g_proc_root_mutex);
|
||||
}
|
||||
|
||||
static void copy_proc_root_fd(int oldfd, int newfd) {
|
||||
if (newfd < 0 || oldfd == newfd) return;
|
||||
forget_proc_root_fd(newfd);
|
||||
if (oldfd < 0 || __atomic_load_n(&g_n_proc_root_fds, __ATOMIC_ACQUIRE) == 0) return;
|
||||
struct ddnatv_proc_root_fd entry = {-1, 0, 0, 0};
|
||||
pthread_mutex_lock(&g_proc_root_mutex);
|
||||
for (int i = 0; i < g_n_proc_root_fds; i++) {
|
||||
if (g_proc_root_fds[i].fd == oldfd) entry = g_proc_root_fds[i];
|
||||
}
|
||||
pthread_mutex_unlock(&g_proc_root_mutex);
|
||||
if (entry.fd < 0) return;
|
||||
entry.fd = newfd;
|
||||
store_proc_root_fd(entry);
|
||||
}
|
||||
|
||||
static void remember_proc_root_fd(int fd, const char *path) {
|
||||
const char *rest = NULL;
|
||||
pid_t pid = proc_root_pid(path, &rest);
|
||||
struct stat st;
|
||||
if (fd < 0) return;
|
||||
if (pid <= 0 || rest[strspn(rest, "/")] != '\0' || syscall(SYS_fstat, fd, &st) != 0 || !S_ISDIR(st.st_mode)) {
|
||||
forget_proc_root_fd(fd);
|
||||
return;
|
||||
}
|
||||
store_proc_root_fd((struct ddnatv_proc_root_fd){fd, pid, (unsigned long)st.st_dev, (unsigned long)st.st_ino});
|
||||
}
|
||||
|
||||
static const char *proc_root_at(int dirfd, const char *rel, char *buf, size_t size) {
|
||||
if (dirfd < 0 || __atomic_load_n(&g_n_proc_root_fds, __ATOMIC_ACQUIRE) == 0) return NULL;
|
||||
pid_t pid = 0;
|
||||
unsigned long dev = 0, ino = 0;
|
||||
pthread_mutex_lock(&g_proc_root_mutex);
|
||||
for (int i = 0; i < g_n_proc_root_fds; i++) {
|
||||
if (g_proc_root_fds[i].fd != dirfd) continue;
|
||||
pid = g_proc_root_fds[i].pid;
|
||||
dev = g_proc_root_fds[i].dev;
|
||||
ino = g_proc_root_fds[i].ino;
|
||||
break;
|
||||
}
|
||||
pthread_mutex_unlock(&g_proc_root_mutex);
|
||||
struct stat st;
|
||||
if (pid <= 0 || syscall(SYS_fstat, dirfd, &st) != 0 || (unsigned long)st.st_dev != dev || (unsigned long)st.st_ino != ino) return NULL;
|
||||
if (snprintf(buf, size, "/proc/%d/root/%s", (int)pid, rel) >= (int)size) return NULL;
|
||||
return buf;
|
||||
}
|
||||
|
||||
static int is_loader_option(const char *arg) {
|
||||
return strcmp(arg, "--preload") == 0 || strcmp(arg, "--library-path") == 0 || strcmp(arg, "--argv0") == 0;
|
||||
}
|
||||
@@ -757,10 +475,6 @@ static const char *rewrite_path_follow(const char *path, char *buffer, size_t bu
|
||||
if (!path) return NULL;
|
||||
if (path[0] != '/') return rewrite_path(path, buffer, bufsize);
|
||||
init_ddnatv_hook();
|
||||
if (path[1] == 'p' && strncmp(path, "/proc/", 6) == 0 && path[6] >= '1' && path[6] <= '9') {
|
||||
const char *other = proc_root_host(path, buffer, bufsize, 0, 1);
|
||||
if (other) return other;
|
||||
}
|
||||
int moved = 0;
|
||||
for (int i = 0; i < g_nbinds; i++) {
|
||||
const struct ddnatv_bind *b = &g_binds[i];
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
BWRAP = Path(__file__).resolve().parents[1] / "linuxfs/overlay/usr/local/bin/droiddeck-bwrap"
|
||||
|
||||
PROBE = """
|
||||
import json, os
|
||||
print(json.dumps({"pid": os.getpid(), "binds": os.environ.get("DDNATV_BINDS")}))
|
||||
"""
|
||||
|
||||
INFO = b"[Application]\nname=org.example.App\n\n[Instance]\ninstance-id=42\n"
|
||||
|
||||
|
||||
class BwrapFlatpakInfoInPlaceTest(unittest.TestCase):
|
||||
def run_shim(self, env):
|
||||
read, write = os.pipe()
|
||||
os.write(write, INFO)
|
||||
os.close(write)
|
||||
self.addCleanup(os.close, read)
|
||||
full = {k: v for k, v in os.environ.items() if not k.startswith("DDNATV_")}
|
||||
full.update(env)
|
||||
out = subprocess.run([sys.executable, str(BWRAP), "--ro-bind-data", str(read), "/.flatpak-info", "--",
|
||||
sys.executable, "-c", PROBE], env=full, pass_fds=(read,), capture_output=True,
|
||||
text=True, timeout=30)
|
||||
self.assertEqual(0, out.returncode, out.stderr)
|
||||
return json.loads(out.stdout)
|
||||
|
||||
def file_bind(self, binds, pid):
|
||||
entries = [e for e in (binds or "").split("|") if e.endswith(":/.flatpak-info")]
|
||||
self.assertEqual(1, len(entries))
|
||||
src = entries[0][:-len(":/.flatpak-info")]
|
||||
self.assertTrue(src.startswith("/proc/%d/fd/" % pid), src)
|
||||
return src
|
||||
|
||||
def test_a_native_program_run_in_place_sees_its_flatpak_info(self):
|
||||
got = self.run_shim({"DDNATV_ROOT": "/data/rootfs"})
|
||||
self.file_bind(got["binds"], got["pid"])
|
||||
self.assertEqual(1, len(got["binds"].split("|")))
|
||||
|
||||
def test_the_session_binds_are_kept_in_front(self):
|
||||
got = self.run_shim({"DDNATV_ROOT": "/data/rootfs", "DDNATV_BINDS": "/proc:/proc|/sdcard:/media/sdcard"})
|
||||
self.file_bind(got["binds"], got["pid"])
|
||||
self.assertEqual(["/proc:/proc", "/sdcard:/media/sdcard"], got["binds"].split("|")[:2])
|
||||
|
||||
def test_the_bound_file_holds_the_data_and_outlives_exec(self):
|
||||
script = (
|
||||
"import os, sys; b = os.environ['DDNATV_BINDS'].split('|')[-1].split(':')[0]; "
|
||||
"sys.stdout.write(open(b.replace('/proc/%d/' % os.getpid(), '/proc/self/')).read())"
|
||||
)
|
||||
read, write = os.pipe()
|
||||
os.write(write, INFO)
|
||||
os.close(write)
|
||||
self.addCleanup(os.close, read)
|
||||
env = {k: v for k, v in os.environ.items() if not k.startswith("DDNATV_")}
|
||||
env["DDNATV_ROOT"] = "/data/rootfs"
|
||||
out = subprocess.run([sys.executable, str(BWRAP), "--ro-bind-data", str(read), "/.flatpak-info", "--",
|
||||
sys.executable, "-c", script], env=env, pass_fds=(read,), capture_output=True,
|
||||
timeout=30)
|
||||
self.assertEqual(0, out.returncode, out.stderr)
|
||||
self.assertEqual(INFO, out.stdout)
|
||||
|
||||
def test_without_the_native_hook_nothing_is_added(self):
|
||||
got = self.run_shim({})
|
||||
self.assertIsNone(got["binds"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -1,226 +0,0 @@
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import resource
|
||||
import secrets
|
||||
import socket
|
||||
import struct
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import threading
|
||||
import unittest
|
||||
|
||||
from tools.tests.test_usr2_preload import runner
|
||||
|
||||
BWRAP = Path(__file__).resolve().parents[1] / "linuxfs/overlay/usr/local/bin/droiddeck-bwrap"
|
||||
HOOK_BUILD = Path(__file__).resolve().parents[1] / "nativeguest/build.sh"
|
||||
|
||||
PROBE = r"""
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
printf("env\t%s\n", getenv("DROIDDECK_FDS") ? "set" : "-");
|
||||
for (int i = 1; i < argc; i++) {
|
||||
int fd = atoi(argv[i]);
|
||||
char buf[64];
|
||||
int flags = fcntl(fd, F_GETFD);
|
||||
ssize_t n = flags < 0 ? -1 : read(fd, buf, sizeof(buf) - 1);
|
||||
buf[n > 0 ? n : 0] = 0;
|
||||
printf("%d\t%s\t%s\n", fd, n > 0 ? buf : "-", flags < 0 ? "closed" : flags & FD_CLOEXEC ? "cloexec" : "kept");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
def pipe_holding(data):
|
||||
read, write = os.pipe()
|
||||
os.write(write, data)
|
||||
os.close(write)
|
||||
return read
|
||||
|
||||
|
||||
def serve(listener, fds, targets):
|
||||
conn, _ = listener.accept()
|
||||
with conn, listener:
|
||||
conn.sendmsg([",".join(map(str, targets)).encode()],
|
||||
[(socket.SOL_SOCKET, socket.SCM_RIGHTS, struct.pack("%di" % len(fds), *fds))])
|
||||
|
||||
|
||||
class FakeApp:
|
||||
def __init__(self, test, launch):
|
||||
self.name = "droiddeck-test-" + secrets.token_hex(8)
|
||||
self.listener = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
self.listener.bind("\0" + self.name)
|
||||
self.listener.listen(1)
|
||||
self.launch = launch
|
||||
self.request = None
|
||||
self.thread = threading.Thread(target=self.run, daemon=True)
|
||||
self.thread.start()
|
||||
test.addCleanup(self.listener.close)
|
||||
|
||||
def run(self):
|
||||
conn, _ = self.listener.accept()
|
||||
with conn:
|
||||
head = conn.recv(5, socket.MSG_WAITALL)
|
||||
body = conn.recv(struct.unpack(">I", head[1:])[0], socket.MSG_WAITALL)
|
||||
self.request = json.loads(body)
|
||||
output, status = self.launch(self.request)
|
||||
for kind, payload in ((b"O", output), (b"X", str(status).encode())):
|
||||
conn.sendall(kind + struct.pack(">I", len(payload)) + payload)
|
||||
|
||||
|
||||
def fetch(name):
|
||||
with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as conn:
|
||||
conn.connect("\0" + name)
|
||||
text, fds, _, _ = socket.recv_fds(conn, 1024, 16)
|
||||
try:
|
||||
return text.decode(), [os.read(fd, 64) for fd in fds]
|
||||
finally:
|
||||
for fd in fds:
|
||||
os.close(fd)
|
||||
|
||||
|
||||
class BwrapForwardsFdsTest(unittest.TestCase):
|
||||
def run_shim(self, launch, extra, pass_fds):
|
||||
app = FakeApp(self, launch)
|
||||
env = {k: v for k, v in os.environ.items() if not k.startswith("DDNATV_")}
|
||||
env["DROIDDECK_BWRAP_SOCKET"] = app.name
|
||||
work = tempfile.TemporaryDirectory()
|
||||
self.addCleanup(work.cleanup)
|
||||
out = subprocess.run([sys.executable, str(BWRAP), "--bind", work.name, "/mnt/elsewhere", *extra, "--",
|
||||
"/nonexistent/program"], env=env, pass_fds=pass_fds, capture_output=True, timeout=30)
|
||||
self.assertEqual(0, out.returncode, out.stderr)
|
||||
return app.request, out.stdout
|
||||
|
||||
def test_inherited_fds_are_offered_to_the_sandboxed_program(self):
|
||||
forwarded = pipe_holding(b"dbus peer")
|
||||
sync = pipe_holding(b"sync")
|
||||
self.addCleanup(os.close, forwarded)
|
||||
self.addCleanup(os.close, sync)
|
||||
got = {}
|
||||
|
||||
def launch(request):
|
||||
got.update(zip(("targets", "data"), fetch(request["env"]["DROIDDECK_FDS"])))
|
||||
return b"", 0
|
||||
|
||||
request, _ = self.run_shim(launch, ["--sync-fd", str(sync)], (forwarded, sync))
|
||||
self.assertEqual(str(forwarded), got["targets"])
|
||||
self.assertEqual([b"dbus peer"], got["data"])
|
||||
|
||||
def test_the_offer_is_taken_once(self):
|
||||
forwarded = pipe_holding(b"once")
|
||||
self.addCleanup(os.close, forwarded)
|
||||
second = []
|
||||
|
||||
def launch(request):
|
||||
fetch(request["env"]["DROIDDECK_FDS"])
|
||||
with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as conn:
|
||||
try:
|
||||
conn.connect("\0" + request["env"]["DROIDDECK_FDS"])
|
||||
second.append("connected")
|
||||
except OSError:
|
||||
second.append("refused")
|
||||
return b"", 0
|
||||
|
||||
self.run_shim(launch, [], (forwarded,))
|
||||
self.assertEqual(["refused"], second)
|
||||
|
||||
def test_more_descriptors_than_can_be_passed_stop_the_launch(self):
|
||||
fds = [pipe_holding(b"x") for _ in range(254)]
|
||||
for fd in fds:
|
||||
self.addCleanup(os.close, fd)
|
||||
app = FakeApp(self, lambda request: (b"", 0))
|
||||
env = {k: v for k, v in os.environ.items() if not k.startswith("DDNATV_")}
|
||||
env["DROIDDECK_BWRAP_SOCKET"] = app.name
|
||||
work = tempfile.TemporaryDirectory()
|
||||
self.addCleanup(work.cleanup)
|
||||
out = subprocess.run([sys.executable, str(BWRAP), "--bind", work.name, "/mnt/elsewhere", "--",
|
||||
"/nonexistent/program"], env=env, pass_fds=fds, capture_output=True, timeout=30)
|
||||
self.assertNotEqual(0, out.returncode)
|
||||
self.assertIn(b"Too many inherited file descriptors", out.stderr)
|
||||
self.assertIsNone(app.request)
|
||||
|
||||
def test_nothing_is_offered_without_inherited_fds(self):
|
||||
request, _ = self.run_shim(lambda request: (b"", 0), [], ())
|
||||
self.assertNotIn("DROIDDECK_FDS", request["env"])
|
||||
|
||||
|
||||
class NativeHookAdoptsFdsTest(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.cc, cls.prefix = runner()
|
||||
if cls.cc is None:
|
||||
raise unittest.SkipTest("no aarch64 compiler and runner")
|
||||
cls.tmp = tempfile.TemporaryDirectory()
|
||||
tmp = Path(cls.tmp.name)
|
||||
cls.hook = tmp / "hook.so"
|
||||
subprocess.run(["bash", str(HOOK_BUILD), str(cls.hook), cls.cc], check=True, capture_output=True)
|
||||
(tmp / "probe.c").write_text(PROBE)
|
||||
subprocess.run([cls.cc, "-O1", "-o", str(tmp / "probe"), str(tmp / "probe.c")], check=True)
|
||||
cls.probe_path = tmp / "probe"
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
cls.tmp.cleanup()
|
||||
|
||||
def offer(self, fds, targets):
|
||||
name = "droiddeck-test-" + secrets.token_hex(8)
|
||||
listener = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
listener.bind("\0" + name)
|
||||
listener.listen(1)
|
||||
listener.settimeout(60)
|
||||
threading.Thread(target=serve, args=(listener, fds, targets), daemon=True).start()
|
||||
self.addCleanup(listener.close)
|
||||
return name
|
||||
|
||||
def run_probe(self, name, *wanted, fd_limit=None):
|
||||
hook_env = {"DROIDDECK_FDS": name, "LD_PRELOAD": str(self.hook)}
|
||||
env = {k: v for k, v in os.environ.items() if k != "LD_PRELOAD" and not k.startswith("DDNATV_")}
|
||||
if self.prefix:
|
||||
cmd = list(self.prefix) + [arg for key, value in hook_env.items() for arg in ("-E", f"{key}={value}")]
|
||||
else:
|
||||
cmd = []
|
||||
env.update(hook_env)
|
||||
limit = (lambda: resource.setrlimit(resource.RLIMIT_NOFILE, (fd_limit, fd_limit))) if fd_limit else None
|
||||
out = subprocess.run(cmd + [str(self.probe_path), *map(str, wanted)], env=env, capture_output=True,
|
||||
text=True, timeout=120, preexec_fn=limit)
|
||||
self.assertEqual(0, out.returncode, out.stderr)
|
||||
return {line.split("\t")[0]: line.split("\t")[1:] for line in out.stdout.splitlines()}
|
||||
|
||||
def held(self, *data):
|
||||
fds = [pipe_holding(d) for d in data]
|
||||
for fd in fds:
|
||||
self.addCleanup(os.close, fd)
|
||||
return fds
|
||||
|
||||
def test_forwarded_fds_land_on_their_numbers_and_stay_inheritable(self):
|
||||
fds = self.held(b"peer", b"sync")
|
||||
got = self.run_probe(self.offer(fds, [22, 5]), 22, 5)
|
||||
self.assertEqual(["peer", "kept"], got["22"])
|
||||
self.assertEqual(["sync", "kept"], got["5"])
|
||||
self.assertEqual(["-"], got["env"])
|
||||
|
||||
def test_targets_that_overlap_the_received_numbers_are_not_mixed_up(self):
|
||||
fds = self.held(b"first", b"second")
|
||||
got = self.run_probe(self.offer(fds, [4, 3]), 4, 3)
|
||||
self.assertEqual("first", got["4"][0])
|
||||
self.assertEqual("second", got["3"][0])
|
||||
|
||||
def test_a_target_at_the_descriptor_limit_is_installed(self):
|
||||
fds = self.held(b"edge")
|
||||
got = self.run_probe(self.offer(fds, [255]), 255, fd_limit=256)
|
||||
self.assertEqual(["edge", "kept"], got["255"])
|
||||
|
||||
def test_a_missing_offer_changes_nothing(self):
|
||||
got = self.run_probe("droiddeck-test-gone-" + secrets.token_hex(4), 22)
|
||||
self.assertEqual(["-", "closed"], got["22"])
|
||||
self.assertEqual(["-"], got["env"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -1,205 +0,0 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import tempfile
|
||||
import time
|
||||
import unittest
|
||||
|
||||
try:
|
||||
import gi
|
||||
gi.require_version("Gio", "2.0")
|
||||
from gi.repository import Gio, GLib
|
||||
except ImportError:
|
||||
Gio = GLib = None
|
||||
|
||||
SCRIPT = Path(__file__).resolve().parents[1] / "linuxfs/overlay/usr/local/bin/droiddeck-documents"
|
||||
NAME = "org.freedesktop.portal.Documents"
|
||||
PATH = "/org/freedesktop/portal/documents"
|
||||
REUSE_EXISTING = 1
|
||||
PERSISTENT = 2
|
||||
AS_NEEDED_BY_APP = 4
|
||||
DIRECTORY = 8
|
||||
|
||||
|
||||
@unittest.skipUnless(Gio and os.environ.get("DBUS_SESSION_BUS_ADDRESS"), "requires dbus-run-session and PyGObject")
|
||||
class DocumentStoreTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.directory = tempfile.TemporaryDirectory()
|
||||
self.dir = Path(self.directory.name)
|
||||
self.file = self.dir / "picked.iso"
|
||||
self.file.write_text("data")
|
||||
self.proc = self.dir / "proc"
|
||||
self.sandbox = self.dir / "sandbox"
|
||||
(self.proc / "1234").mkdir(parents=True)
|
||||
(self.sandbox / self.dir.relative_to("/")).mkdir(parents=True)
|
||||
(self.sandbox / ".flatpak-info").write_text("[Application]\nname=org.example.App\n")
|
||||
(self.proc / "1234/root").symlink_to(self.sandbox)
|
||||
self.visible = self.share(self.file)
|
||||
self.saves = self.dir / "saves"
|
||||
self.saves.mkdir()
|
||||
(self.sandbox / self.saves.relative_to("/")).symlink_to(self.saves)
|
||||
self.bus = Gio.DBusConnection.new_for_address_sync(
|
||||
os.environ["DBUS_SESSION_BUS_ADDRESS"],
|
||||
Gio.DBusConnectionFlags.AUTHENTICATION_CLIENT | Gio.DBusConnectionFlags.MESSAGE_BUS_CONNECTION,
|
||||
None, None)
|
||||
self.alias = self.dir / "alias"
|
||||
self.shared = self.dir / "shared"
|
||||
self.alias.mkdir()
|
||||
(self.alias / "game.iso").write_text("data")
|
||||
self.share(self.alias / "game.iso", self.shared / "game.iso")
|
||||
(self.alias / "inside.iso").write_text("data")
|
||||
self.share(self.alias / "inside.iso")
|
||||
(self.alias / "private.iso").write_text("data")
|
||||
(self.dir / "rootfs").mkdir()
|
||||
self.share(self.alias / "private.iso", self.dir / "rootfs/alias/private.iso")
|
||||
env = dict(os.environ, DDNATV_ROOT=str(self.dir / "rootfs"),
|
||||
DDNATV_BINDS="%s:%s|%s/rootfs/alias:%s" % (self.shared, self.alias, self.dir, self.alias))
|
||||
self.process = subprocess.Popen(["/usr/bin/python3", str(SCRIPT), str(self.proc)], stdout=subprocess.DEVNULL,
|
||||
env=env)
|
||||
self.session = self.dir / "session"
|
||||
(self.session / self.dir.relative_to("/")).mkdir(parents=True)
|
||||
(self.dir / "hidden.iso").write_text("data")
|
||||
os.link(self.dir / "hidden.iso", self.session / self.dir.relative_to("/") / "hidden.iso")
|
||||
(self.session / ".flatpak-info").write_text("[Application]\nname=org.example.App\n")
|
||||
for pid in (self.process.pid, 99):
|
||||
(self.proc / str(pid)).mkdir()
|
||||
(self.proc / str(pid) / "root").symlink_to(self.session)
|
||||
deadline = time.monotonic() + 10
|
||||
while not self.owned():
|
||||
self.assertIsNone(self.process.poll())
|
||||
self.assertLess(time.monotonic(), deadline)
|
||||
time.sleep(0.05)
|
||||
|
||||
def share(self, source, name=None):
|
||||
seen = self.sandbox / (name or source).relative_to("/")
|
||||
seen.parent.mkdir(parents=True, exist_ok=True)
|
||||
os.link(source, seen)
|
||||
return seen
|
||||
|
||||
def tearDown(self):
|
||||
self.process.terminate()
|
||||
self.process.wait(timeout=5)
|
||||
self.bus.close_sync(None)
|
||||
self.directory.cleanup()
|
||||
|
||||
def owned(self):
|
||||
reply = self.bus.call_sync("org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus",
|
||||
"NameHasOwner", GLib.Variant("(s)", (NAME,)), None,
|
||||
Gio.DBusCallFlags.NONE, -1, None)
|
||||
return reply.unpack()[0]
|
||||
|
||||
def call(self, method, signature, args, paths=()):
|
||||
fds = Gio.UnixFDList.new()
|
||||
opened = [os.open(p, os.O_PATH | os.O_CLOEXEC) for p in paths]
|
||||
try:
|
||||
for fd in opened:
|
||||
fds.append(fd)
|
||||
reply, _ = self.bus.call_with_unix_fd_list_sync(
|
||||
NAME, PATH, NAME, method, GLib.Variant(signature, args), None, Gio.DBusCallFlags.NONE, -1,
|
||||
fds, None)
|
||||
return reply.unpack()
|
||||
finally:
|
||||
for fd in opened:
|
||||
os.close(fd)
|
||||
|
||||
def error_of(self, *args, **kwargs):
|
||||
with self.assertRaises(GLib.Error) as caught:
|
||||
self.call(*args, **kwargs)
|
||||
return Gio.DBusError.get_remote_error(caught.exception)
|
||||
|
||||
def test_a_picked_file_is_handed_back_in_place(self):
|
||||
got = self.call("AddFull", "(ahusas)", ([0], REUSE_EXISTING | PERSISTENT | AS_NEEDED_BY_APP, "org.example.App",
|
||||
["read", "write"]), [self.file])
|
||||
self.assertEqual(([""], {}), got)
|
||||
|
||||
def test_a_saved_file_name_is_handed_back_in_place(self):
|
||||
got = self.call("AddNamedFull", "(hayusas)", (0, b"new.txt\0", AS_NEEDED_BY_APP, "org.example.App", ["read"]),
|
||||
[self.saves])
|
||||
self.assertEqual(("", {}), got)
|
||||
|
||||
def test_a_picked_folder_needs_the_directory_flag(self):
|
||||
flags = REUSE_EXISTING | AS_NEEDED_BY_APP
|
||||
self.assertEqual(([""], {}), self.call("AddFull", "(ahusas)", ([0], flags | DIRECTORY, "", []), [self.dir]))
|
||||
self.assertEqual("org.freedesktop.portal.Error.InvalidArgument",
|
||||
self.error_of("AddFull", "(ahusas)", ([0], flags, "", []), [self.dir]))
|
||||
self.assertEqual("org.freedesktop.portal.Error.InvalidArgument",
|
||||
self.error_of("AddFull", "(ahusas)", ([0], flags | DIRECTORY, "", []), [self.file]))
|
||||
|
||||
def test_a_file_the_application_cannot_reach_is_refused(self):
|
||||
flags = REUSE_EXISTING | PERSISTENT | AS_NEEDED_BY_APP
|
||||
hidden = self.dir / "hidden.iso"
|
||||
self.assertTrue((self.proc / "99/root" / hidden.relative_to("/")).exists())
|
||||
self.assertEqual("org.freedesktop.portal.Error.NotAllowed",
|
||||
self.error_of("AddFull", "(ahusas)", ([0], flags, "org.example.App", ["read"]), [hidden]))
|
||||
self.assertEqual("org.freedesktop.portal.Error.NotAllowed",
|
||||
self.error_of("AddFull", "(ahusas)", ([0], flags, "org.example.Other", ["read"]), [self.file]))
|
||||
self.assertEqual(([""], {}), self.call("AddFull", "(ahusas)", ([0], flags, "", ["read"]), [hidden]))
|
||||
|
||||
def test_a_file_seen_through_a_bound_folder_is_found_under_its_host_name(self):
|
||||
flags = REUSE_EXISTING | PERSISTENT | AS_NEEDED_BY_APP
|
||||
self.assertEqual(([""], {}), self.call("AddFull", "(ahusas)", ([0], flags, "org.example.App", ["read"]),
|
||||
[self.alias / "game.iso"]))
|
||||
self.assertEqual(([""], {}), self.call("AddFull", "(ahusas)", ([0], flags, "org.example.App", ["read"]),
|
||||
[self.alias / "inside.iso"]))
|
||||
self.assertEqual("org.freedesktop.portal.Error.NotAllowed",
|
||||
self.error_of("AddFull", "(ahusas)", ([0], flags, "org.example.App", ["read"]),
|
||||
[self.alias / "private.iso"]))
|
||||
(self.sandbox / self.shared.relative_to("/") / "game.iso").unlink()
|
||||
self.assertEqual("org.freedesktop.portal.Error.NotAllowed",
|
||||
self.error_of("AddFull", "(ahusas)", ([0], flags, "org.example.App", ["read"]),
|
||||
[self.alias / "game.iso"]))
|
||||
|
||||
def test_a_file_inside_the_root_filesystem_is_judged_by_its_own_name(self):
|
||||
flags = REUSE_EXISTING | PERSISTENT | AS_NEEDED_BY_APP
|
||||
home = self.dir / "rootfs/home.iso"
|
||||
home.write_text("data")
|
||||
self.share(home)
|
||||
self.assertEqual("org.freedesktop.portal.Error.NotAllowed",
|
||||
self.error_of("AddFull", "(ahusas)", ([0], flags, "org.example.App", ["read"]), [home]))
|
||||
os.link(home, self.sandbox / "home.iso")
|
||||
self.assertEqual(([""], {}), self.call("AddFull", "(ahusas)", ([0], flags, "org.example.App", ["read"]), [home]))
|
||||
|
||||
def test_a_different_file_at_the_same_name_is_refused(self):
|
||||
flags = REUSE_EXISTING | PERSISTENT | AS_NEEDED_BY_APP
|
||||
other = self.dir / "other.iso"
|
||||
other.write_text("data")
|
||||
(self.sandbox / other.relative_to("/")).write_text("data")
|
||||
self.assertEqual("org.freedesktop.portal.Error.NotAllowed",
|
||||
self.error_of("AddFull", "(ahusas)", ([0], flags, "org.example.App", ["read"]), [other]))
|
||||
|
||||
@unittest.skipIf(os.getuid() == 0, "root reads every file")
|
||||
def test_a_location_the_application_cannot_use_as_asked_is_refused(self):
|
||||
flags = REUSE_EXISTING | PERSISTENT | AS_NEEDED_BY_APP
|
||||
self.visible.chmod(0)
|
||||
self.assertEqual("org.freedesktop.portal.Error.NotAllowed",
|
||||
self.error_of("AddFull", "(ahusas)", ([0], flags, "org.example.App", ["read"]), [self.file]))
|
||||
self.saves.chmod(0o500)
|
||||
try:
|
||||
self.assertEqual("org.freedesktop.portal.Error.NotAllowed",
|
||||
self.error_of("AddNamedFull", "(hayusas)",
|
||||
(0, b"new.txt\0", AS_NEEDED_BY_APP, "org.example.App", ["read", "write"]),
|
||||
[self.saves]))
|
||||
finally:
|
||||
self.saves.chmod(0o700)
|
||||
|
||||
def test_documents_that_would_need_the_store_mount_are_refused(self):
|
||||
self.assertEqual("org.freedesktop.portal.Error.NotAllowed",
|
||||
self.error_of("AddFull", "(ahusas)", ([0], REUSE_EXISTING, "", []), [self.file]))
|
||||
self.assertEqual("org.freedesktop.portal.Error.NotAllowed",
|
||||
self.error_of("Add", "(hbb)", (0, True, False), [self.file]))
|
||||
self.assertEqual("org.freedesktop.portal.Error.Failed", self.error_of("GetMountPoint", "()", ()))
|
||||
|
||||
def test_a_missing_descriptor_is_refused(self):
|
||||
self.assertEqual("org.freedesktop.portal.Error.InvalidArgument",
|
||||
self.error_of("AddFull", "(ahusas)", ([3], AS_NEEDED_BY_APP, "", []), [self.file]))
|
||||
|
||||
def test_no_documents_are_listed(self):
|
||||
self.assertEqual(("",), self.call("Lookup", "(ay)", (str(self.file).encode() + b"\0",)))
|
||||
self.assertEqual(({},), self.call("List", "(s)", ("org.example.App",)))
|
||||
version = self.bus.call_sync(NAME, PATH, "org.freedesktop.DBus.Properties", "Get",
|
||||
GLib.Variant("(ss)", (NAME, "version")), None, Gio.DBusCallFlags.NONE, -1, None)
|
||||
self.assertEqual(5, version.unpack()[0])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -1,80 +0,0 @@
|
||||
from pathlib import Path
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
SOURCE = Path(__file__).resolve().parents[2] / "app/src/main/cpp/fakeinput_steam.cpp"
|
||||
|
||||
LIBRARY = r"""
|
||||
#include <stdatomic.h>
|
||||
#include <sys/statfs.h>
|
||||
#include <unistd.h>
|
||||
|
||||
extern _Atomic int loading;
|
||||
|
||||
__attribute__((constructor)) static void start(void) {
|
||||
struct statfs buf;
|
||||
atomic_store_explicit(&loading, 1, memory_order_release);
|
||||
usleep(300000);
|
||||
statfs("/", &buf);
|
||||
}
|
||||
"""
|
||||
|
||||
PROGRAM = r"""
|
||||
#define _GNU_SOURCE
|
||||
#include <dlfcn.h>
|
||||
#include <pthread.h>
|
||||
#include <sched.h>
|
||||
#include <stdatomic.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/statfs.h>
|
||||
|
||||
_Atomic int loading;
|
||||
|
||||
static void *load(void *path) {
|
||||
return dlopen(path, RTLD_NOW);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
pthread_t loader;
|
||||
struct statfs buf;
|
||||
pthread_create(&loader, NULL, load, argv[1]);
|
||||
while (!atomic_load_explicit(&loading, memory_order_acquire)) sched_yield();
|
||||
statfs("/", &buf);
|
||||
void *handle = NULL;
|
||||
pthread_join(loader, &handle);
|
||||
puts(handle ? "ok" : dlerror());
|
||||
return 0;
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
@unittest.skipUnless(sys.platform == "linux" and shutil.which("gcc") and shutil.which("g++"),
|
||||
"needs Linux, gcc and g++")
|
||||
class FakeinputLoaderLockTest(unittest.TestCase):
|
||||
def test_a_first_hooked_call_while_another_thread_loads_a_library_does_not_deadlock(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
path = Path(tmp)
|
||||
(path / "program.c").write_text(PROGRAM)
|
||||
(path / "library.c").write_text(LIBRARY)
|
||||
subprocess.run(["gcc", "-rdynamic", "-pthread", "-o", str(path / "program"), str(path / "program.c"),
|
||||
"-ldl"], check=True)
|
||||
subprocess.run(["gcc", "-shared", "-fPIC", "-o", str(path / "library.so"), str(path / "library.c")],
|
||||
check=True)
|
||||
subprocess.run(["g++", "-shared", "-fPIC", "-O2", "-Wno-attributes", "-pthread",
|
||||
"-std=c++17", "-static-libstdc++", "-static-libgcc",
|
||||
"-Wl,--exclude-libs,ALL", "-o", str(path / "libfakeinput.so"),
|
||||
str(SOURCE), "-ldl"], check=True)
|
||||
for _ in range(5):
|
||||
result = subprocess.run([str(path / "program"), str(path / "library.so")],
|
||||
env=dict(os.environ, LD_PRELOAD=str(path / "libfakeinput.so")),
|
||||
capture_output=True, text=True, timeout=20)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
self.assertEqual(result.stdout, "ok\n")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -1,5 +1,4 @@
|
||||
import contextlib
|
||||
import fcntl
|
||||
import hashlib
|
||||
import io
|
||||
import json
|
||||
@@ -8,11 +7,9 @@ import shutil
|
||||
from pathlib import Path
|
||||
import runpy
|
||||
import shlex
|
||||
import struct
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import threading
|
||||
from unittest import mock
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
@@ -2199,53 +2196,6 @@ class GameEnvironmentTest(unittest.TestCase):
|
||||
named = game_logs(command, on, None, now=0)
|
||||
self.assertTrue(Path(named["PROTON_LOG_DIR"]).name.endswith("-Hades"))
|
||||
|
||||
def test_graphics_logs_trace_wine_only_when_asked(self):
|
||||
game_logs = MODULE["game_logs"]
|
||||
command = ["/proton", "waitforexitandrun", "/games/Hades/Hades.exe"]
|
||||
with tempfile.TemporaryDirectory() as tmp, mock.patch("subprocess.Popen"):
|
||||
on = {"DD_GAME_LOGS": "1", "DD_DEBUG_DIR": tmp}
|
||||
for given in ({}, {"PROTON_LOG": "0"}, {"PROTON_LOG": ""}):
|
||||
with self.subTest(given=given):
|
||||
result = game_logs(command, {**on, **given}, "42", now=0)
|
||||
self.assertEqual(result["PROTON_LOG"], "1")
|
||||
self.assertEqual(result["WINEDEBUG"], "-all,err+all")
|
||||
own = game_logs(command, {**on, "WINEDEBUG": "+relay"}, "42", now=0)
|
||||
self.assertEqual(own["WINEDEBUG"], "+relay")
|
||||
for value in ("1", "+relay"):
|
||||
with self.subTest(proton_log=value):
|
||||
user = game_logs(command, {**on, "PROTON_LOG": value}, "42", now=0)
|
||||
self.assertEqual(user["PROTON_LOG"], value)
|
||||
self.assertNotIn("WINEDEBUG", user)
|
||||
config = {"version": 1, "gameDebugLogs": True}
|
||||
debug = game_logs(command, MODULE["apply_game_debug_logs"](on, config, tmp), "42", now=0)
|
||||
self.assertEqual(debug["PROTON_LOG"], "1")
|
||||
self.assertEqual(debug["WINEDEBUG"], MODULE["game_debug_channels"]())
|
||||
|
||||
def test_game_debug_switch_controls_wine_traces_with_graphics_logs_on(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
home = Path(tmp)
|
||||
config_path = home / ".config/droiddeck/game-environment.json"
|
||||
config_path.parent.mkdir(parents=True)
|
||||
probe = home / "proton"
|
||||
probe.write_text("#!" + sys.executable + "\nimport json, os\n"
|
||||
"print(json.dumps({k: os.environ.get(k) for k in ('PROTON_LOG', 'WINEDEBUG')}))\n")
|
||||
probe.chmod(0o755)
|
||||
env = {**os.environ, "HOME": tmp, "STEAM_COMPAT_DATA_PATH": str(home / "compatdata/599140"),
|
||||
"DD_DEBUG_DIR": tmp, "DD_GAME_LOGS": "1"}
|
||||
for name in ("PROTON_LOG", "WINEDEBUG"):
|
||||
env.pop(name, None)
|
||||
for enabled in (True, False, True):
|
||||
with self.subTest(enabled=enabled):
|
||||
config_path.write_text(json.dumps({"version": 1, "gameDebugLogs": enabled}))
|
||||
result = json.loads(subprocess.run(
|
||||
[sys.executable, str(BIN / "droiddeck-game-env"), str(probe), "waitforexitandrun", "game.exe"],
|
||||
env=env, text=True, capture_output=True, check=True).stdout)
|
||||
self.assertEqual(result["PROTON_LOG"], "1")
|
||||
if enabled:
|
||||
self.assertIn("+seh", result["WINEDEBUG"].split(","))
|
||||
else:
|
||||
self.assertEqual(result["WINEDEBUG"], "-all,err+all")
|
||||
|
||||
def test_rapid_game_launches_keep_separate_diagnostics(self):
|
||||
with tempfile.TemporaryDirectory() as tmp, mock.patch("subprocess.Popen"):
|
||||
env = {"DD_GAME_LOGS": "1", "DD_DEBUG_DIR": tmp}
|
||||
@@ -3777,161 +3727,6 @@ class ForeignSystemDllTest(unittest.TestCase):
|
||||
self.assertEqual([], self.run_repair(Path(tmp) / "missing", proton))
|
||||
|
||||
|
||||
class SharedDataHealTest(unittest.TestCase):
|
||||
CURRENT = (21, 0x1234abcd, 0x5678ef01, os.getuid(), 1000)
|
||||
STALE = (21, 0x0badf00d, 0x0ddba11, 10122, 1000)
|
||||
|
||||
def setUp(self):
|
||||
self.globals = MODULE["heal_shared_data"].__globals__
|
||||
self.old_machine_id = self.globals["MACHINE_ID"]
|
||||
self.tmp = tempfile.TemporaryDirectory()
|
||||
self.addCleanup(self.cleanup)
|
||||
machine_id = Path(self.tmp.name) / "machine-id"
|
||||
machine_id.write_text("1234abcd5678ef01%s\n" % ("0" * 16))
|
||||
self.globals["MACHINE_ID"] = str(machine_id)
|
||||
self.compat = Path(self.tmp.name) / "compat"
|
||||
self.root = self.compat / "pfx/drive_c/ProgramData"
|
||||
self.root.mkdir(parents=True)
|
||||
probe = self.root / "probe"
|
||||
probe.write_text("")
|
||||
try:
|
||||
os.setxattr(probe, "user.wine.sd", b"x")
|
||||
except OSError:
|
||||
self.skipTest("needs user xattrs")
|
||||
probe.unlink()
|
||||
|
||||
def cleanup(self):
|
||||
self.globals["MACHINE_ID"] = self.old_machine_id
|
||||
for folder, dirs, files in os.walk(self.tmp.name):
|
||||
for name in dirs + files:
|
||||
path = os.path.join(folder, name)
|
||||
if not os.path.islink(path):
|
||||
os.chmod(path, 0o700)
|
||||
self.tmp.cleanup()
|
||||
|
||||
def own(self, path, subs, authority=5):
|
||||
sid = bytes([1, len(subs)]) + authority.to_bytes(6, "big") + struct.pack("<%dI" % len(subs), *subs)
|
||||
header = struct.pack("<BBHIIII", 1, 0, 0x8004, len(sid), 0, 0, 0)
|
||||
os.setxattr(path, "user.wine.sd", b"\x01\x00" + header + sid, follow_symlinks=False)
|
||||
|
||||
def heal(self):
|
||||
return MODULE["heal_shared_data"](str(self.compat))
|
||||
|
||||
def mode(self, path):
|
||||
return path.stat().st_mode & 0o777
|
||||
|
||||
def test_entries_a_stale_owner_locked_are_unlocked_and_every_stale_owner_is_cleared(self):
|
||||
agent = self.root / "Vendor/Agent"
|
||||
(agent / "Logs").mkdir(parents=True)
|
||||
(agent / "Agent.dat").write_text("1")
|
||||
(agent / "Tools.exe").write_text("x")
|
||||
(agent / "Icons").mkdir()
|
||||
for path in (agent.parent, agent, agent / "Logs", agent / "Agent.dat", agent / "Tools.exe", agent / "Icons"):
|
||||
self.own(path, self.STALE)
|
||||
(agent / "Tools.exe").chmod(0o550)
|
||||
(agent / "Icons").chmod(0o500)
|
||||
(agent / "Agent.dat").chmod(0)
|
||||
(agent / "Logs").chmod(0)
|
||||
agent.chmod(0)
|
||||
self.assertEqual((["Vendor/Agent", "Vendor/Agent/Agent.dat", "Vendor/Agent/Logs"],
|
||||
["Vendor", "Vendor/Agent", "Vendor/Agent/Agent.dat", "Vendor/Agent/Icons",
|
||||
"Vendor/Agent/Logs", "Vendor/Agent/Tools.exe"]), self.heal())
|
||||
self.assertEqual(0o500, self.mode(agent / "Icons"))
|
||||
self.assertEqual(0o700, self.mode(agent))
|
||||
self.assertEqual(0o700, self.mode(agent / "Logs"))
|
||||
self.assertEqual(0o600, self.mode(agent / "Agent.dat"))
|
||||
self.assertEqual(0o550, self.mode(agent / "Tools.exe"))
|
||||
self.assertEqual("1", (agent / "Agent.dat").read_text())
|
||||
(agent / "Logs/new").mkdir()
|
||||
for path in (agent.parent, agent, agent / "Logs", agent / "Agent.dat", agent / "Tools.exe", agent / "Icons"):
|
||||
self.assertNotIn("user.wine.sd", os.listxattr(path))
|
||||
self.assertEqual(([], []), self.heal())
|
||||
|
||||
def test_current_and_well_known_owners_untagged_entries_and_links_are_left_alone(self):
|
||||
mine = self.root / "Mine"
|
||||
mine.mkdir(mode=0o755)
|
||||
self.own(mine, self.CURRENT)
|
||||
(mine / "settings.ini").write_text("x")
|
||||
self.own(mine / "settings.ini", self.CURRENT)
|
||||
(mine / "settings.ini").chmod(0o444)
|
||||
denied = self.root / "Denied"
|
||||
denied.mkdir()
|
||||
self.own(denied, self.CURRENT)
|
||||
denied.chmod(0)
|
||||
admins = self.root / "Admins"
|
||||
admins.mkdir()
|
||||
self.own(admins, (32, 544))
|
||||
admins.chmod(0o500)
|
||||
plain = self.root / "Plain"
|
||||
plain.mkdir()
|
||||
plain.chmod(0)
|
||||
outside = Path(self.tmp.name) / "outside"
|
||||
outside.mkdir()
|
||||
self.own(outside, self.STALE)
|
||||
outside.chmod(0o500)
|
||||
(self.root / "Link").symlink_to(outside)
|
||||
self.assertEqual(([], []), self.heal())
|
||||
self.assertEqual(0o755, self.mode(mine))
|
||||
self.assertEqual(0o444, self.mode(mine / "settings.ini"))
|
||||
self.assertEqual(0, self.mode(denied))
|
||||
self.assertEqual(0o500, self.mode(admins))
|
||||
self.assertEqual(0, self.mode(plain))
|
||||
self.assertEqual(0o500, self.mode(outside))
|
||||
for path in (mine, mine / "settings.ini", admins, outside):
|
||||
self.assertIn("user.wine.sd", os.listxattr(path))
|
||||
|
||||
def test_a_locked_program_data_folder_is_healed_before_its_entries(self):
|
||||
(self.root / "Vendor").mkdir()
|
||||
self.own(self.root / "Vendor", self.STALE)
|
||||
(self.root / "Vendor").chmod(0)
|
||||
self.own(self.root, self.STALE)
|
||||
self.root.chmod(0)
|
||||
self.assertEqual(([".", "Vendor"], [".", "Vendor"]), self.heal())
|
||||
self.assertEqual(0o700, self.mode(self.root))
|
||||
self.assertEqual(0o700, self.mode(self.root / "Vendor"))
|
||||
|
||||
def test_a_heal_waits_while_another_launch_heals_the_same_prefix(self):
|
||||
(self.root / "Vendor").mkdir()
|
||||
self.own(self.root / "Vendor", self.STALE)
|
||||
(self.root / "Vendor").chmod(0)
|
||||
results = []
|
||||
lock = os.open(self.compat / "pfx", os.O_RDONLY | os.O_DIRECTORY)
|
||||
try:
|
||||
fcntl.flock(lock, fcntl.LOCK_EX)
|
||||
worker = threading.Thread(target=lambda: results.append(self.heal()))
|
||||
worker.start()
|
||||
worker.join(0.3)
|
||||
self.assertTrue(worker.is_alive())
|
||||
self.assertEqual(0, self.mode(self.root / "Vendor"))
|
||||
finally:
|
||||
os.close(lock)
|
||||
worker.join(10)
|
||||
self.assertEqual([(["Vendor"], ["Vendor"])], results)
|
||||
|
||||
def test_user_sid_follows_wine_for_a_missing_or_short_machine_id(self):
|
||||
sid = MODULE["wine_user_sid"]
|
||||
self.assertEqual(self.CURRENT, sid())
|
||||
self.globals["MACHINE_ID"] = str(Path(self.tmp.name) / "missing")
|
||||
self.assertEqual((21, 0, 0, 0, 1000), sid())
|
||||
short = Path(self.tmp.name) / "short"
|
||||
short.write_text("1234\n")
|
||||
self.globals["MACHINE_ID"] = str(short)
|
||||
self.assertEqual((21, 0, 0, 0, 1000), sid())
|
||||
binary = Path(self.tmp.name) / "binary"
|
||||
binary.write_bytes(b"\xff\xfe" + b"0" * 15)
|
||||
self.globals["MACHINE_ID"] = str(binary)
|
||||
self.assertEqual((21, 0, 0, os.getuid(), 1000), sid())
|
||||
signed = Path(self.tmp.name) / "signed"
|
||||
signed.write_text("+234abcd5678ef01\n")
|
||||
self.globals["MACHINE_ID"] = str(signed)
|
||||
self.assertEqual((21, 0x234abcd, 0x5678ef01, os.getuid(), 1000), sid())
|
||||
signed.write_text("-000000000000001\n")
|
||||
self.assertEqual((21, 0xffffffff, 0xffffffff, os.getuid(), 1000), sid())
|
||||
|
||||
def test_prefix_without_shared_data_is_skipped(self):
|
||||
self.assertEqual(([], []), MODULE["heal_shared_data"](str(Path(self.tmp.name) / "missing")))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
|
||||
@@ -1,229 +0,0 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
from tools.tests.test_usr2_preload import runner
|
||||
|
||||
HOOK_BUILD = Path(__file__).resolve().parents[1] / "nativeguest/build.sh"
|
||||
|
||||
PROBE = r"""
|
||||
#define _GNU_SOURCE
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static void show(const char *what, int fd) {
|
||||
printf("%s\t", what);
|
||||
if (fd < 0) {
|
||||
printf("-\n");
|
||||
return;
|
||||
}
|
||||
unsigned char buf[256];
|
||||
ssize_t n;
|
||||
int any = 0;
|
||||
while ((n = read(fd, buf, sizeof(buf))) > 0) {
|
||||
for (ssize_t i = 0; i < n; i++) printf("%02x", buf[i]);
|
||||
any = 1;
|
||||
}
|
||||
printf("%s\n", any ? "" : "-");
|
||||
close(fd);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (strncmp(argv[i], "at:", 3) == 0) {
|
||||
char *name = strrchr(argv[i], '/');
|
||||
*name++ = 0;
|
||||
int root = open(argv[i] + 3, O_RDONLY | O_DIRECTORY | O_CLOEXEC);
|
||||
int fd = root >= 0 ? openat(root, name, O_RDONLY | O_CLOEXEC) : -1;
|
||||
name[-1] = '/';
|
||||
show(argv[i], fd);
|
||||
if (root >= 0) close(root);
|
||||
} else if (strncmp(argv[i], "dup:", 4) == 0) {
|
||||
char *name = strrchr(argv[i], '/');
|
||||
*name++ = 0;
|
||||
int root = open(argv[i] + 4, O_RDONLY | O_DIRECTORY | O_CLOEXEC);
|
||||
int copy = root >= 0 ? dup2(root, 50) : -1;
|
||||
if (root >= 0) close(root);
|
||||
int fd = copy >= 0 ? openat(copy, name, O_RDONLY | O_CLOEXEC) : -1;
|
||||
name[-1] = '/';
|
||||
show(argv[i], fd);
|
||||
if (copy >= 0) close(copy);
|
||||
} else if (strncmp(argv[i], "nfat:", 5) == 0 || strncmp(argv[i], "link:", 5) == 0) {
|
||||
char *name = strrchr(argv[i], '/');
|
||||
*name++ = 0;
|
||||
int how = argv[i][0] == 'l' ? O_PATH : O_RDONLY | O_DIRECTORY;
|
||||
int root = open(argv[i] + 5, how | O_NOFOLLOW | O_CLOEXEC);
|
||||
int fd = root >= 0 ? openat(root, name, O_RDONLY | O_CLOEXEC) : -1;
|
||||
name[-1] = '/';
|
||||
show(argv[i], fd);
|
||||
if (root >= 0) close(root);
|
||||
} else if (strncmp(argv[i], "nofollow:", 9) == 0) {
|
||||
int fd = open(argv[i] + 9, O_RDONLY | O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC);
|
||||
printf("%s\t%s\n", argv[i], fd >= 0 ? "6f70656e" : "-");
|
||||
if (fd >= 0) close(fd);
|
||||
} else {
|
||||
show(argv[i], open(argv[i], O_RDONLY | O_CLOEXEC));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
"""
|
||||
|
||||
SLEEPER = r"""
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
int main(int argc, char **argv) {
|
||||
if (argc > 1) open(argv[1], O_RDONLY);
|
||||
puts("ready");
|
||||
fflush(stdout);
|
||||
sleep(60);
|
||||
return 0;
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
class NativeHookProcRootTest(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.cc, cls.prefix = runner()
|
||||
if cls.cc is None:
|
||||
raise unittest.SkipTest("no aarch64 compiler and runner")
|
||||
cls.tmp = tempfile.TemporaryDirectory()
|
||||
tmp = Path(cls.tmp.name)
|
||||
cls.hook = tmp / "hook.so"
|
||||
subprocess.run(["bash", str(HOOK_BUILD), str(cls.hook), cls.cc], check=True, capture_output=True)
|
||||
for name, source in (("probe", PROBE), ("sleeper", SLEEPER)):
|
||||
(tmp / f"{name}.c").write_text(source)
|
||||
subprocess.run([cls.cc, "-O1", "-o", str(tmp / name), str(tmp / f"{name}.c")], check=True)
|
||||
cls.session = tmp / "session"
|
||||
(cls.session / "etc").mkdir(parents=True)
|
||||
(cls.session / "etc/os-release").write_text("session")
|
||||
cls.sandbox = tmp / "sandbox"
|
||||
(cls.sandbox / "etc").mkdir(parents=True)
|
||||
(cls.sandbox / "etc/os-release").write_text("sandbox")
|
||||
(cls.sandbox / ".flatpak-info").write_text("app")
|
||||
cls.app = tmp / "app"
|
||||
cls.app.mkdir()
|
||||
(cls.app / "manifest.json").write_text("bound")
|
||||
cls.view = tmp / "view"
|
||||
(cls.app / "link").symlink_to(cls.view / "manifest.json")
|
||||
cls.info = tmp / "proxy-info"
|
||||
cls.info.write_text("proxy")
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
cls.tmp.cleanup()
|
||||
|
||||
def start(self, env, opened=None):
|
||||
full = {k: v for k, v in os.environ.items() if k not in ("LD_PRELOAD",) and not k.startswith("DDNATV_")}
|
||||
full.update(env)
|
||||
cmd = list(self.prefix) + [str(Path(self.tmp.name) / "sleeper")] + ([str(opened)] if opened else [])
|
||||
child = subprocess.Popen(cmd, env=full, stdout=subprocess.PIPE, text=True)
|
||||
self.addCleanup(child.stdout.close)
|
||||
self.addCleanup(child.wait)
|
||||
self.addCleanup(child.kill)
|
||||
self.assertEqual("ready", child.stdout.readline().strip())
|
||||
return child.pid
|
||||
|
||||
def probe(self, *paths, binds="/proc:/proc"):
|
||||
hook_env = {"DDNATV_ROOT": str(self.session), "LD_PRELOAD": str(self.hook), "DDNATV_BINDS": binds}
|
||||
env = {k: v for k, v in os.environ.items() if k != "LD_PRELOAD" and not k.startswith("DDNATV_")}
|
||||
if self.prefix:
|
||||
cmd = list(self.prefix) + [arg for key, value in hook_env.items() for arg in ("-E", f"{key}={value}")]
|
||||
else:
|
||||
cmd = []
|
||||
env.update(hook_env)
|
||||
out = subprocess.run(cmd + [str(Path(self.tmp.name) / "probe"), *paths], env=env, capture_output=True,
|
||||
text=True, timeout=120)
|
||||
self.assertEqual(out.returncode, 0, out.stderr)
|
||||
return {name: value if value == "-" else bytes.fromhex(value).decode()
|
||||
for name, value in (line.split("\t") for line in out.stdout.splitlines())}
|
||||
|
||||
def sandboxed(self):
|
||||
return self.start({"DDNATV_ROOT": str(self.sandbox), "DDNATV_BINDS": f"/proc:/proc|{self.app}:/app"})
|
||||
|
||||
def test_a_sandbox_root_shows_its_own_flatpak_info(self):
|
||||
pid = self.sandboxed()
|
||||
at, path = f"at:/proc/{pid}/root/.flatpak-info", f"/proc/{pid}/root/.flatpak-info"
|
||||
got = self.probe(at, path)
|
||||
self.assertEqual("app", got[at])
|
||||
self.assertEqual("app", got[path])
|
||||
|
||||
def test_a_sandbox_root_shows_its_files_and_mounts(self):
|
||||
pid = self.sandboxed()
|
||||
paths = (f"/proc/{pid}/root/etc/os-release", f"/proc/{pid}/root/app/manifest.json",
|
||||
f"at:/proc/{pid}/root/etc/os-release")
|
||||
got = self.probe(*paths)
|
||||
self.assertEqual(["sandbox", "bound", "sandbox"], [got[p] for p in paths])
|
||||
|
||||
def test_a_program_in_the_session_with_a_bound_flatpak_info_shows_it(self):
|
||||
pid = self.start({"DDNATV_ROOT": str(self.session), "DDNATV_BINDS": f"/proc:/proc|{self.info}:/.flatpak-info"})
|
||||
at, path = f"at:/proc/{pid}/root/.flatpak-info", f"/proc/{pid}/root/.flatpak-info"
|
||||
got = self.probe(at, path)
|
||||
self.assertEqual("proxy", got[at])
|
||||
self.assertEqual("proxy", got[path])
|
||||
|
||||
def test_a_file_bound_from_an_open_descriptor_is_read(self):
|
||||
holder = self.start({}, opened=self.info)
|
||||
fd = next(n for n in os.listdir(f"/proc/{holder}/fd") if os.path.realpath(f"/proc/{holder}/fd/{n}") == str(self.info))
|
||||
pid = self.start({"DDNATV_ROOT": str(self.session),
|
||||
"DDNATV_BINDS": f"/proc:/proc|/proc/{holder}/fd/{fd}:/.flatpak-info"})
|
||||
at = f"at:/proc/{pid}/root/.flatpak-info"
|
||||
self.assertEqual("proxy", self.probe(at)[at])
|
||||
|
||||
def test_a_program_in_the_same_session_is_not_a_flatpak(self):
|
||||
pid = self.start({"DDNATV_ROOT": str(self.session), "DDNATV_BINDS": "/proc:/proc"})
|
||||
at, path, etc = (f"at:/proc/{pid}/root/.flatpak-info", f"/proc/{pid}/root/.flatpak-info",
|
||||
f"/proc/{pid}/root/etc/os-release")
|
||||
got = self.probe(at, path, etc)
|
||||
self.assertEqual("-", got[at])
|
||||
self.assertEqual("-", got[path])
|
||||
self.assertEqual("session", got[etc])
|
||||
|
||||
def test_a_program_without_the_hook_is_looked_at_as_the_kernel_shows_it(self):
|
||||
pid = self.start({})
|
||||
path, at = f"/proc/{pid}/root{self.sandbox}/etc/os-release", f"at:/proc/{pid}/root/.flatpak-info"
|
||||
got = self.probe(path, at)
|
||||
self.assertEqual("sandbox", got[path])
|
||||
self.assertEqual(Path("/.flatpak-info").read_text() if Path("/.flatpak-info").exists() else "-", got[at])
|
||||
|
||||
def test_a_link_is_followed_in_the_sandbox_view(self):
|
||||
pid = self.start({"DDNATV_ROOT": str(self.sandbox),
|
||||
"DDNATV_BINDS": f"/proc:/proc|{self.app}:/app|{self.app}:{self.view}"})
|
||||
path = f"/proc/{pid}/root/app/link"
|
||||
self.assertEqual("bound", self.probe(path)[path])
|
||||
|
||||
def test_a_duplicated_root_descriptor_keeps_the_sandbox_view(self):
|
||||
pid = self.sandboxed()
|
||||
dup = f"dup:/proc/{pid}/root/.flatpak-info"
|
||||
self.assertEqual("app", self.probe(dup)[dup])
|
||||
|
||||
def test_a_bare_root_is_not_followed_with_nofollow(self):
|
||||
pid = self.sandboxed()
|
||||
bare, below = f"nofollow:/proc/{pid}/root", f"nofollow:/proc/{pid}/root/etc"
|
||||
got = self.probe(bare, below)
|
||||
self.assertEqual("-", got[bare])
|
||||
self.assertEqual("open", got[below])
|
||||
|
||||
def test_a_root_with_a_trailing_slash_keeps_the_sandbox_view_with_nofollow(self):
|
||||
pid = self.sandboxed()
|
||||
path = f"nfat:/proc/{pid}/root//.flatpak-info"
|
||||
self.assertEqual("app", self.probe(path)[path])
|
||||
|
||||
def test_a_descriptor_for_the_root_link_itself_is_not_a_directory(self):
|
||||
pid = self.sandboxed()
|
||||
path = f"link:/proc/{pid}/root/.flatpak-info"
|
||||
self.assertEqual("-", self.probe(path)[path])
|
||||
|
||||
def test_a_sandbox_cannot_be_climbed_out_of(self):
|
||||
pid = self.sandboxed()
|
||||
path = f"/proc/{pid}/root/../../etc/os-release"
|
||||
self.assertEqual("sandbox", self.probe(path)[path])
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||