mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-06 04:55:44 +00:00
Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3716455994 | ||
|
|
6be30d07b4 | ||
|
|
5a18f69c7e | ||
|
|
68af03ac74 | ||
|
|
d8bb4a8751 | ||
|
|
312069603a | ||
|
|
3988f52480 | ||
|
|
59eaa0eb06 | ||
|
|
811e285834 | ||
|
|
2221b1a984 | ||
|
|
f75cb387eb | ||
|
|
18d735b4c4 | ||
|
|
7138f95c90 | ||
|
|
8b3cc7eb15 |
No files matched your search
@@ -113,7 +113,7 @@ DroidDeck is [GPL-3.0](LICENSE). Steam and Proton belong to Valve Corporation. V
|
||||
- Steam audio goes through [@The412Banner](https://github.com/The412Banner)'s [DirectAudio](https://github.com/The412Banner/directaudio) PulseAudio sink (LGPL-2.1-or-later), built from `tools/directaudio/sink`.
|
||||
- The DroidDeck HUD is [@The412Banner](https://github.com/The412Banner)'s [FusionHUD](https://github.com/The412Banner/FusionHUD) (GPL-3.0 with an attribution term). Its readings match Valve's [MangoHud](https://github.com/flightlessmango/MangoHud) build (MIT), with frame times from gamescope patch 0125.
|
||||
- The HUD's CPU, GPU load, thermal and battery readers come from [@xXJSONDeruloXx](https://github.com/xXJSONDeruloXx)'s work.
|
||||
- LSFG frame generation comes from Camille LaVey and the [Eden](https://eden-emu.dev) project, following [lsfg-vk](https://github.com/PancakeTAS/lsfg-vk), ported by [@maxjivi05](https://github.com/maxjivi05). It needs your own copy of [Lossless Scaling](https://store.steampowered.com/app/993090/) and ships none of its shaders.
|
||||
- LSFG frame generation comes from Camille LaVey and the [Eden](https://eden-emu.dev) project, following [lsfg-vk](https://github.com/PancakeTAS/lsfg-vk), ported by [@maxjivi05](https://github.com/maxjivi05). It requires [Lossless Scaling](https://store.steampowered.com/app/993090/) installed through Steam and ships none of its shaders.
|
||||
- Black frame insertion follows the design of [@artzox](https://github.com/artzox)'s [BFI Presenter](https://github.com/artzox/BFI-Presenter) (GPL-3.0): the strobe runs on the display's refresh clock and the game is paced to the lit refresh. Both build on [Blur Busters](https://blurbusters.com)' research on MPRT and motion blur. No BFI Presenter code is used.
|
||||
- Remote Play decodes through Android's MediaCodec or the [FFmpeg](https://ffmpeg.org) (LGPL-2.1-or-later) in Steam's runtime. Qualcomm low latency settings follow [Moonlight](https://github.com/moonlight-stream/moonlight-android) (GPL-3.0).
|
||||
- [PipeWire](https://gitlab.freedesktop.org/pipewire/pipewire) (MIT) sockets use the settings in its `module-access.c`, and [WirePlumber](https://gitlab.freedesktop.org/pipewire/wireplumber) (MIT) keeps those clients at full permissions.
|
||||
|
||||
@@ -59,7 +59,7 @@ internal fun sampleState(
|
||||
internal val sampleActions: FrontEndActions = FrontEndActions(
|
||||
onPlay = {}, onPlayDesktopUi = {}, onSteamGame = {}, onDesktop = {}, onEmulator = {}, onRom = {}, onResume = {},
|
||||
onSteamSettings = {}, onDesktopSettings = {}, onInstallPackage = {}, onRemovePackage = {}, onRuntime = {},
|
||||
onFrameGenPick = {}, onImportLossless = {}, onProtons = {}, onComponents = {}, onPerformance = {}, onRoms = {},
|
||||
onFrameGenPick = {}, onProtons = {}, onComponents = {}, onPerformance = {}, onRoms = {},
|
||||
onFiles = {}, onLogs = {}, onOffline = {},
|
||||
onSetPhantomProcessLimit = { _, _ -> },
|
||||
)
|
||||
@@ -82,7 +82,7 @@ internal fun sampleDrawerActions(
|
||||
secondScreenDisplays = listOfNotNull(secondScreen?.let { SecondScreenDisplay(2, "Built-in · 1240×1080") }),
|
||||
selectedSecondScreenDisplay = if (secondScreen != null) 2 else -1, onSecondScreenDisplay = {},
|
||||
gameSwapAvailable = secondScreen != null, dashboardAvailable = secondScreen != null,
|
||||
onImportLossless = {}, onKeyboard = {}, onHardwareKeyboard = {},
|
||||
onKeyboard = {}, onHardwareKeyboard = {},
|
||||
onSteamMenu = if (steam) ({}) else null, onQam = if (steam) ({}) else null,
|
||||
onLaunchAndroidApp = { _, _ -> }, onBackground = {}, onShareLogs = {}, onStop = {}, onClose = {},
|
||||
)
|
||||
@@ -28,6 +28,19 @@ float_code() {
|
||||
[ "$result" = ok ]
|
||||
}
|
||||
|
||||
# git pushes through gh's sign-in and commits as the signed-in account, with its no-reply address.
|
||||
configure_git() {
|
||||
gh auth setup-git || return 1
|
||||
[ -n "$(git config --global user.name)" ] && [ -n "$(git config --global user.email)" ] && return 0
|
||||
local user id login name
|
||||
user=$(gh api user -q '"\(.id) \(.login) \(.name // .login)"') || return 1
|
||||
read -r id login name <<<"$user"
|
||||
[ -n "$id" ] && [ -n "$login" ] || return 1
|
||||
[ -n "$(git config --global user.name)" ] || git config --global user.name "${name:-$login}"
|
||||
[ -n "$(git config --global user.email)" ] || git config --global user.email "$id+$login@users.noreply.github.com"
|
||||
}
|
||||
if [ "${1:-}" = --git ]; then configure_git; exit; fi
|
||||
|
||||
coproc GH { BROWSER=true gh auth login --hostname github.com --git-protocol https --web 2>&1; }
|
||||
gh_pid=$GH_PID
|
||||
exec {ghout}<&"${GH[0]}" {ghin}>&"${GH[1]}"
|
||||
@@ -48,5 +61,9 @@ while IFS= read -r line <&"$ghout"; do
|
||||
done
|
||||
wait "$gh_pid"
|
||||
status=$?
|
||||
if [ $status = 0 ] && ! configure_git; then
|
||||
echo "Signed in, but git could not be set up: run dd-gh-login --git"
|
||||
status=1
|
||||
fi
|
||||
[ -n "$shown" ] && [ -n "$inbox" ] && [ -d "$inbox" ] && : > "$inbox/device-code"
|
||||
exit $status
|
||||
@@ -42,6 +42,11 @@ add_library(droiddeckwayland SHARED
|
||||
src/hudframes.c
|
||||
src/hudframes_jni.c
|
||||
)
|
||||
option(DROIDDECK_FRAME_ACQUIRE_PROBE "Build opt-in signaled producer acquire protocol support" ON)
|
||||
if (DROIDDECK_FRAME_ACQUIRE_PROBE)
|
||||
target_sources(droiddeckwayland PRIVATE generated/droiddeck-frame-acquire-v1-protocol.c)
|
||||
target_compile_definitions(droiddeckwayland PRIVATE DROIDDECK_FRAME_ACQUIRE_PROBE=1)
|
||||
endif()
|
||||
target_compile_options(droiddeckwayland PRIVATE
|
||||
$<$<COMPILE_LANGUAGE:C>:-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers>)
|
||||
target_include_directories(droiddeckwayland PRIVATE
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/* Generated by wayland-scanner 1.22.0 */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "wayland-util.h"
|
||||
|
||||
#ifndef __has_attribute
|
||||
# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
|
||||
#endif
|
||||
|
||||
#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4)
|
||||
#define WL_PRIVATE __attribute__ ((visibility("hidden")))
|
||||
#else
|
||||
#define WL_PRIVATE
|
||||
#endif
|
||||
|
||||
extern const struct wl_interface wl_buffer_interface;
|
||||
extern const struct wl_interface wl_surface_interface;
|
||||
|
||||
static const struct wl_interface *droiddeck_frame_acquire_v1_types[] = {
|
||||
&wl_surface_interface,
|
||||
&wl_buffer_interface,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const struct wl_message droiddeck_frame_acquire_v1_requests[] = {
|
||||
{ "destroy", "", droiddeck_frame_acquire_v1_types + 0 },
|
||||
{ "set_acquire_fence", "ooh", droiddeck_frame_acquire_v1_types + 0 },
|
||||
};
|
||||
|
||||
WL_PRIVATE const struct wl_interface droiddeck_frame_acquire_v1_interface = {
|
||||
"droiddeck_frame_acquire_v1", 1,
|
||||
2, droiddeck_frame_acquire_v1_requests,
|
||||
0, NULL,
|
||||
};
|
||||
@@ -0,0 +1,128 @@
|
||||
/* Generated by wayland-scanner 1.22.0 */
|
||||
|
||||
#ifndef DROIDDECK_FRAME_ACQUIRE_V1_SERVER_PROTOCOL_H
|
||||
#define DROIDDECK_FRAME_ACQUIRE_V1_SERVER_PROTOCOL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "wayland-server.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct wl_client;
|
||||
struct wl_resource;
|
||||
|
||||
/**
|
||||
* @page page_droiddeck_frame_acquire_v1 The droiddeck_frame_acquire_v1 protocol
|
||||
* @section page_ifaces_droiddeck_frame_acquire_v1 Interfaces
|
||||
* - @subpage page_iface_droiddeck_frame_acquire_v1 - DroidDeck producer write completion for a single Wayland attachment
|
||||
*/
|
||||
struct droiddeck_frame_acquire_v1;
|
||||
struct wl_buffer;
|
||||
struct wl_surface;
|
||||
|
||||
#ifndef DROIDDECK_FRAME_ACQUIRE_V1_INTERFACE
|
||||
#define DROIDDECK_FRAME_ACQUIRE_V1_INTERFACE
|
||||
/**
|
||||
* @page page_iface_droiddeck_frame_acquire_v1 droiddeck_frame_acquire_v1
|
||||
* @section page_iface_droiddeck_frame_acquire_v1_desc Description
|
||||
*
|
||||
* Optional explicit acquire sideband independent of DRM syncobj and buffer
|
||||
* allocation. Binding does not opt the client out of ordinary wl_buffer
|
||||
* release or existing synchronization protocols. The server advertises it
|
||||
* only when it implements all semantics for the selected display path.
|
||||
* @section page_iface_droiddeck_frame_acquire_v1_api API
|
||||
* See @ref iface_droiddeck_frame_acquire_v1.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_droiddeck_frame_acquire_v1 The droiddeck_frame_acquire_v1 interface
|
||||
*
|
||||
* Optional explicit acquire sideband independent of DRM syncobj and buffer
|
||||
* allocation. Binding does not opt the client out of ordinary wl_buffer
|
||||
* release or existing synchronization protocols. The server advertises it
|
||||
* only when it implements all semantics for the selected display path.
|
||||
*/
|
||||
extern const struct wl_interface droiddeck_frame_acquire_v1_interface;
|
||||
#endif
|
||||
|
||||
#ifndef DROIDDECK_FRAME_ACQUIRE_V1_ERROR_ENUM
|
||||
#define DROIDDECK_FRAME_ACQUIRE_V1_ERROR_ENUM
|
||||
enum droiddeck_frame_acquire_v1_error {
|
||||
/**
|
||||
* not the same client's pending DMA-BUF attachment
|
||||
*/
|
||||
DROIDDECK_FRAME_ACQUIRE_V1_ERROR_INVALID_ATTACHMENT = 0,
|
||||
/**
|
||||
* that attachment already has an acquire fence
|
||||
*/
|
||||
DROIDDECK_FRAME_ACQUIRE_V1_ERROR_DUPLICATE_FENCE = 1,
|
||||
/**
|
||||
* not a real successfully signaled Linux sync_file
|
||||
*/
|
||||
DROIDDECK_FRAME_ACQUIRE_V1_ERROR_INVALID_FENCE = 2,
|
||||
/**
|
||||
* not the paired test peer
|
||||
*/
|
||||
DROIDDECK_FRAME_ACQUIRE_V1_ERROR_UNAUTHORIZED_PEER = 3,
|
||||
};
|
||||
#endif /* DROIDDECK_FRAME_ACQUIRE_V1_ERROR_ENUM */
|
||||
|
||||
/**
|
||||
* @ingroup iface_droiddeck_frame_acquire_v1
|
||||
* @struct droiddeck_frame_acquire_v1_interface
|
||||
*/
|
||||
struct droiddeck_frame_acquire_v1_interface {
|
||||
/**
|
||||
*/
|
||||
void (*destroy)(struct wl_client *client,
|
||||
struct wl_resource *resource);
|
||||
/**
|
||||
* set a one-shot kernel sync_file for the pending attachment
|
||||
*
|
||||
* After wl_surface.attach of a non-null buffer, and before its
|
||||
* next wl_surface.commit, send the producer's final writer fence
|
||||
* for that exact attachment. This outer probe requires that fence
|
||||
* to have already successfully signaled. The fence must be a real
|
||||
* Linux sync_file, not a dma-buf, eventfd, or Vulkan OPAQUE_FD.
|
||||
* The server consumes its received descriptor once for that
|
||||
* attachment; the caller closes its local FD after marshalling.
|
||||
*
|
||||
* The receiver validates the matching pending surface and buffer
|
||||
* and validates the descriptor. A duplicate, invalid, pending or
|
||||
* mismatched request is a protocol error; it is never downgraded
|
||||
* to implicit sync. Another attach (even the same wl_buffer),
|
||||
* detach, surface/resource loss or supersession makes the old
|
||||
* proof inapplicable. Metadata-only commits may amend
|
||||
* receiver-side still-pending state but cannot introduce or re-use
|
||||
* a fence themselves. If no request was made, the receiver keeps
|
||||
* its established safe path. If a valid fence has been accepted
|
||||
* and later the layer is ineligible, the buffer must not be
|
||||
* copied/read before that fence is satisfied or imported as the
|
||||
* source dependency. Transport never implies readiness on missed
|
||||
* deadlines and never changes release/retirement requirements.
|
||||
* @param fence producer's native acquire sync_file
|
||||
*/
|
||||
void (*set_acquire_fence)(struct wl_client *client,
|
||||
struct wl_resource *resource,
|
||||
struct wl_resource *surface,
|
||||
struct wl_resource *buffer,
|
||||
int32_t fence);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup iface_droiddeck_frame_acquire_v1
|
||||
*/
|
||||
#define DROIDDECK_FRAME_ACQUIRE_V1_DESTROY_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_droiddeck_frame_acquire_v1
|
||||
*/
|
||||
#define DROIDDECK_FRAME_ACQUIRE_V1_SET_ACQUIRE_FENCE_SINCE_VERSION 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="droiddeck_frame_acquire_v1">
|
||||
<interface name="droiddeck_frame_acquire_v1" version="1">
|
||||
<description summary="DroidDeck producer write completion for a single Wayland attachment">
|
||||
Optional explicit acquire sideband independent of DRM syncobj and buffer
|
||||
allocation. Binding does not opt the client out of ordinary wl_buffer
|
||||
release or existing synchronization protocols. The server advertises it
|
||||
only when it implements all semantics for the selected display path and
|
||||
only to the test fixture's app-authorized Gamescope worker.
|
||||
</description>
|
||||
<request name="destroy" type="destructor"/>
|
||||
<enum name="error">
|
||||
<entry name="invalid_attachment" value="0" summary="not the same client's pending DMA-BUF attachment"/>
|
||||
<entry name="duplicate_fence" value="1" summary="that attachment already has an acquire fence"/>
|
||||
<entry name="invalid_fence" value="2" summary="not a real successfully signaled Linux sync_file"/>
|
||||
<entry name="unauthorized_peer" value="3" summary="not the paired test peer"/>
|
||||
</enum>
|
||||
<request name="set_acquire_fence">
|
||||
<description summary="set a one-shot kernel sync_file for the pending attachment">
|
||||
After wl_surface.attach of a non-null buffer, and before its next
|
||||
wl_surface.commit, send the producer's final writer fence for that
|
||||
exact attachment. This outer probe requires that fence to have already
|
||||
successfully signaled. The fence must be a real Linux sync_file, not a
|
||||
dma-buf, eventfd, or Vulkan OPAQUE_FD. The server consumes its received
|
||||
descriptor once for that attachment; the caller closes its local FD
|
||||
after marshalling.
|
||||
|
||||
The receiver validates the matching pending surface and buffer and
|
||||
validates the descriptor. A duplicate, invalid, pending or mismatched
|
||||
request is a protocol error; it is never downgraded to implicit sync. Another attach (even the same
|
||||
wl_buffer), detach, surface/resource loss or supersession makes the
|
||||
old proof inapplicable. Metadata-only commits may amend receiver-side
|
||||
still-pending state but cannot introduce or re-use a fence themselves.
|
||||
If no request was made, the receiver keeps its established safe path.
|
||||
If a valid fence has been accepted and later the layer is ineligible,
|
||||
the buffer must not be copied/read before that fence is satisfied or
|
||||
imported as the source dependency. Transport never implies readiness
|
||||
on missed deadlines and never changes release/retirement requirements.
|
||||
</description>
|
||||
<arg name="surface" type="object" interface="wl_surface"/>
|
||||
<arg name="buffer" type="object" interface="wl_buffer"/>
|
||||
<arg name="fence" type="fd" summary="producer's native acquire sync_file"/>
|
||||
</request>
|
||||
</interface>
|
||||
</protocol>
|
||||
@@ -54,6 +54,7 @@ static struct wl_list g_clients;
|
||||
static uint64_t g_next_id = 1;
|
||||
static struct wl_event_loop *g_loop;
|
||||
static unsigned g_stat_zero_copy;
|
||||
static unsigned g_stat_producer_fence;
|
||||
static int g_export_failed_logged, g_import_failed_logged;
|
||||
static int g_advertised;
|
||||
static int g_mode_sent = -1;
|
||||
@@ -201,31 +202,47 @@ int ahb_swapchain_present(struct dmabuf_buffer *b, struct surface *s, int scene_
|
||||
struct ahb_buf *ab = b ? *droiddeck_dmabuf_ahb_slot(b) : NULL;
|
||||
if (!ab) return -1;
|
||||
int dmabuf_fd = droiddeck_dmabuf_fd(b);
|
||||
int acquire = -1;
|
||||
struct droiddeck_dma_buf_sync_file exp = {.flags = DROIDDECK_DMA_BUF_SYNC_READ, .fd = -1};
|
||||
if (dmabuf_fd >= 0 && ioctl(dmabuf_fd, DROIDDECK_DMA_BUF_IOCTL_EXPORT_SYNC_FILE, &exp) == 0 && exp.fd >= 0) {
|
||||
acquire = exp.fd;
|
||||
} else {
|
||||
if (!g_export_failed_logged) {
|
||||
g_export_failed_logged = 1;
|
||||
droiddeck_log("layer", "zero-copy: no acquire fence from the game's dma-buf (%s): %s",
|
||||
dmabuf_fd >= 0 ? strerror(errno) : "no dma-buf fd",
|
||||
draw ? "its frames are copied instead" : "it cannot be copied, so each frame is waited for on the CPU");
|
||||
int acquire = droiddeck_surface_dup_acquire(s, b);
|
||||
if (acquire == -2) return -1;
|
||||
#ifdef DROIDDECK_FRAME_ACQUIRE_PROBE
|
||||
const int explicit_acquire = acquire >= 0;
|
||||
#endif
|
||||
if (acquire < 0) {
|
||||
struct droiddeck_dma_buf_sync_file exp = {.flags = DROIDDECK_DMA_BUF_SYNC_READ, .fd = -1};
|
||||
if (dmabuf_fd >= 0 && ioctl(dmabuf_fd, DROIDDECK_DMA_BUF_IOCTL_EXPORT_SYNC_FILE, &exp) == 0 && exp.fd >= 0) {
|
||||
acquire = exp.fd;
|
||||
} else {
|
||||
if (!g_export_failed_logged) {
|
||||
g_export_failed_logged = 1;
|
||||
droiddeck_log("layer", "zero-copy: no acquire fence from the game's dma-buf (%s): %s",
|
||||
dmabuf_fd >= 0 ? strerror(errno) : "no dma-buf fd",
|
||||
draw ? "its frames are copied instead" : "it cannot be copied, so each frame is waited for on the CPU");
|
||||
}
|
||||
if (dmabuf_fd >= 0) {
|
||||
struct pollfd p = {.fd = dmabuf_fd, .events = POLLIN};
|
||||
int r;
|
||||
do { r = poll(&p, 1, 100); } while (r < 0 && errno == EINTR);
|
||||
}
|
||||
if (draw) return -1;
|
||||
}
|
||||
if (dmabuf_fd >= 0) {
|
||||
struct pollfd p = {.fd = dmabuf_fd, .events = POLLIN};
|
||||
int r;
|
||||
do { r = poll(&p, 1, 100); } while (r < 0 && errno == EINTR);
|
||||
}
|
||||
if (draw) return -1;
|
||||
}
|
||||
int r = sc_layer_present_ahb(ab->ahb, ab->w, ab->h, acquire, (void *)(uintptr_t)ab->id, scene_w, scene_h, draw,
|
||||
s ? droiddeck_surface_color(s) : NULL, ab->format);
|
||||
if (r < 0) return -1;
|
||||
if (r == 1) return 0;
|
||||
#ifdef DROIDDECK_FRAME_ACQUIRE_PROBE
|
||||
static int explicit_logged;
|
||||
if (explicit_acquire && !explicit_logged) {
|
||||
explicit_logged = 1;
|
||||
droiddeck_log("layer", "probe: SurfaceControl accepted a verified producer acquire fence");
|
||||
}
|
||||
#endif
|
||||
if (!ab->on_layer) {
|
||||
ab->on_layer = 1;
|
||||
g_stat_zero_copy++;
|
||||
#ifdef DROIDDECK_FRAME_ACQUIRE_PROBE
|
||||
if (explicit_acquire) g_stat_producer_fence++;
|
||||
#endif
|
||||
g_last_zero_copy_ns = now_ns();
|
||||
}
|
||||
if (s && g_announced != s) {
|
||||
@@ -265,6 +282,12 @@ unsigned ahb_swapchain_stats_take(void) {
|
||||
return n;
|
||||
}
|
||||
|
||||
unsigned ahb_swapchain_producer_fence_stats_take(void) {
|
||||
unsigned n = g_stat_producer_fence;
|
||||
g_stat_producer_fence = 0;
|
||||
return n;
|
||||
}
|
||||
|
||||
int ahb_swapchain_advertised(void) { return g_advertised; }
|
||||
|
||||
uint32_t ahb_swapchain_ahb_format(const struct dmabuf_buffer *b) {
|
||||
|
||||
@@ -20,7 +20,9 @@ int ahb_swapchain_present(struct dmabuf_buffer *b, struct surface *s, int scene_
|
||||
int ahb_swapchain_defer_release(struct dmabuf_buffer *b, struct wl_resource *buffer, struct surface *s, int paced);
|
||||
void ahb_swapchain_surface_gone(struct surface *s);
|
||||
unsigned ahb_swapchain_stats_take(void);
|
||||
unsigned ahb_swapchain_producer_fence_stats_take(void);
|
||||
int ahb_swapchain_advertised(void);
|
||||
int droiddeck_surface_dup_acquire(const struct surface *s, const struct dmabuf_buffer *b);
|
||||
uint32_t ahb_swapchain_ahb_format(const struct dmabuf_buffer *b);
|
||||
|
||||
void ahb_swapchain_layer_released(void *token, int release_fd);
|
||||
|
||||
@@ -24,6 +24,14 @@
|
||||
#include "linux-dmabuf-v1-server-protocol.h"
|
||||
#include "sc_layer.h"
|
||||
#include "ahb_swapchain.h"
|
||||
#include "frame_acquire.h"
|
||||
#ifdef DROIDDECK_FRAME_ACQUIRE_PROBE
|
||||
#include "droiddeck-frame-acquire-v1-server-protocol.h"
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/sysmacros.h>
|
||||
#include <sys/stat.h>
|
||||
#include "frame_worker_peer.h"
|
||||
#endif
|
||||
#include "display_buffers.h"
|
||||
#include "viewporter-server-protocol.h"
|
||||
#include "droiddeck-desktop-v1-server-protocol.h"
|
||||
@@ -211,6 +219,7 @@ struct surface {
|
||||
struct wl_list link;
|
||||
|
||||
struct wl_resource *pending_buffer;
|
||||
struct dd_frame_acquire pending_frame_acquire, frame_acquire;
|
||||
struct wl_listener pending_buffer_destroy;
|
||||
int pending_attach;
|
||||
int pending_src_set, pending_dst_set;
|
||||
@@ -827,6 +836,7 @@ static void unmap_toplevel(struct surface *s) {
|
||||
}
|
||||
|
||||
static void drop_dmabuf(struct surface *s, int paced) {
|
||||
dd_frame_acquire_clear(&s->frame_acquire);
|
||||
if (s->dmabuf) {
|
||||
wl_list_remove(&s->dmabuf_destroy.link);
|
||||
if (buffer_shown_elsewhere(s->dmabuf, s)) {
|
||||
@@ -842,18 +852,21 @@ static void drop_dmabuf(struct surface *s, int paced) {
|
||||
|
||||
static void on_dmabuf_destroyed(struct wl_listener *l, void *data) {
|
||||
struct surface *s = wl_container_of(l, s, dmabuf_destroy);
|
||||
dd_frame_acquire_clear(&s->frame_acquire);
|
||||
wl_list_remove(&s->dmabuf_destroy.link);
|
||||
s->dmabuf = NULL;
|
||||
}
|
||||
|
||||
static void on_pending_buffer_destroyed(struct wl_listener *l, void *data) {
|
||||
struct surface *s = wl_container_of(l, s, pending_buffer_destroy);
|
||||
dd_frame_acquire_clear(&s->pending_frame_acquire);
|
||||
wl_list_remove(&s->pending_buffer_destroy.link);
|
||||
wl_list_init(&s->pending_buffer_destroy.link);
|
||||
s->pending_buffer = NULL;
|
||||
}
|
||||
|
||||
struct surface_state {
|
||||
struct dd_frame_acquire frame_acquire;
|
||||
struct wl_resource *buffer;
|
||||
struct wl_listener buffer_destroy;
|
||||
int attach;
|
||||
@@ -866,6 +879,7 @@ struct surface_state {
|
||||
|
||||
static void on_state_buffer_destroyed(struct wl_listener *l, void *data) {
|
||||
struct surface_state *st = wl_container_of(l, st, buffer_destroy);
|
||||
dd_frame_acquire_clear(&st->frame_acquire);
|
||||
wl_list_remove(&st->buffer_destroy.link);
|
||||
wl_list_init(&st->buffer_destroy.link);
|
||||
st->buffer = NULL;
|
||||
@@ -874,6 +888,8 @@ static void on_state_buffer_destroyed(struct wl_listener *l, void *data) {
|
||||
|
||||
static void surface_state_take(struct surface *s, struct surface_state *st) {
|
||||
st->attach = s->pending_attach;
|
||||
st->frame_acquire = s->pending_frame_acquire;
|
||||
s->pending_frame_acquire.fd_plus_one = 0;
|
||||
st->buffer = s->pending_buffer;
|
||||
wl_list_init(&st->buffer_destroy.link);
|
||||
if (st->buffer) {
|
||||
@@ -1186,6 +1202,7 @@ static void surface_attach(struct wl_client *c, struct wl_resource *r,
|
||||
if (s->pending_buffer) wl_list_remove(&s->pending_buffer_destroy.link);
|
||||
wl_list_init(&s->pending_buffer_destroy.link);
|
||||
s->pending_buffer = buffer;
|
||||
dd_frame_acquire_clear(&s->pending_frame_acquire);
|
||||
s->pending_attach = 1;
|
||||
if (buffer) {
|
||||
s->pending_buffer_destroy.notify = on_pending_buffer_destroyed;
|
||||
@@ -1451,6 +1468,7 @@ static void surface_state_apply(struct surface *s, struct surface_state *st) {
|
||||
|
||||
surface_drop_idle(s);
|
||||
buf_trace_attach(buffer);
|
||||
dd_frame_acquire_clear(&s->frame_acquire);
|
||||
if (s->role == ROLE_CURSOR) {
|
||||
if (!buffer) {
|
||||
cursor_publish_hidden();
|
||||
@@ -1462,6 +1480,8 @@ static void surface_state_apply(struct surface *s, struct surface_state *st) {
|
||||
if (buffer) surface_hold_idle(s, buffer);
|
||||
} else if (db) {
|
||||
take_dmabuf(s, db, buffer);
|
||||
s->frame_acquire = st->frame_acquire;
|
||||
st->frame_acquire.fd_plus_one = 0;
|
||||
} else if (shm) {
|
||||
drop_dmabuf(s, 1);
|
||||
take_shm(s, shm, buffer);
|
||||
@@ -1474,6 +1494,7 @@ static void surface_state_apply(struct surface *s, struct surface_state *st) {
|
||||
if (buffer) send_buffer_release(buffer);
|
||||
}
|
||||
}
|
||||
dd_frame_acquire_clear(&st->frame_acquire);
|
||||
pending_releases_apply(s);
|
||||
|
||||
wl_list_for_each(child, &s->children, child_link) {
|
||||
@@ -1538,6 +1559,7 @@ static void settle_unwaited(void) {
|
||||
}
|
||||
|
||||
static void surface_state_discard(struct surface_state *st) {
|
||||
dd_frame_acquire_clear(&st->frame_acquire);
|
||||
struct wl_resource *cb, *tmp;
|
||||
wl_list_remove(&st->buffer_destroy.link);
|
||||
wl_resource_for_each_safe(cb, tmp, &st->frames) wl_resource_destroy(cb);
|
||||
@@ -1549,6 +1571,8 @@ static void surface_state_merge(struct surface_state *older, struct surface_stat
|
||||
if (older->attach && !newer->attach) {
|
||||
newer->attach = 1;
|
||||
newer->buffer = older->buffer;
|
||||
newer->frame_acquire = older->frame_acquire;
|
||||
older->frame_acquire.fd_plus_one = 0;
|
||||
wl_list_remove(&older->buffer_destroy.link);
|
||||
wl_list_init(&older->buffer_destroy.link);
|
||||
if (newer->buffer) {
|
||||
@@ -1700,6 +1724,210 @@ static const struct wl_surface_interface surface_impl = {
|
||||
.offset = surface_offset,
|
||||
};
|
||||
|
||||
int droiddeck_surface_dup_acquire(const struct surface *s, const struct dmabuf_buffer *b) {
|
||||
return s && s->dmabuf && s->dmabuf_buf == b ? dd_frame_acquire_dup(&s->frame_acquire) : -1;
|
||||
}
|
||||
|
||||
#ifdef DROIDDECK_FRAME_ACQUIRE_PROBE
|
||||
// Private signed fixture: only the app-owned worker decision may issue a grant.
|
||||
static pthread_mutex_t frame_worker_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
static char frame_worker_file[PATH_MAX];
|
||||
static struct dd_worker_grant frame_worker_grant;
|
||||
static int frame_worker_pidfd = -1;
|
||||
static bool frame_worker_map_reported;
|
||||
|
||||
static enum dd_worker_stat_result frame_worker_starttime(pid_t pid, uint64_t *out) {
|
||||
char proc[64], line[4096];
|
||||
snprintf(proc, sizeof(proc), "/proc/%d/stat", pid);
|
||||
FILE *f = fopen(proc, "re");
|
||||
if (!f) return dd_worker_open_failure(errno);
|
||||
// Proc writes one bounded line; truncation is a read failure, not invisibility.
|
||||
bool read = fgets(line, sizeof(line), f) != NULL && strchr(line, '\n') != NULL;
|
||||
fclose(f);
|
||||
return read ? dd_worker_parse_start(line, out) : DD_WORKER_STAT_READ;
|
||||
}
|
||||
|
||||
void droiddeck_frame_worker_revoke(int owner, int pid) {
|
||||
pthread_mutex_lock(&frame_worker_lock);
|
||||
if (frame_worker_grant.owner == (uint32_t)owner &&
|
||||
(!pid || frame_worker_grant.pid == (uint32_t)pid)) {
|
||||
if (frame_worker_pidfd >= 0) close(frame_worker_pidfd);
|
||||
frame_worker_pidfd = -1;
|
||||
frame_worker_grant = (struct dd_worker_grant){0};
|
||||
}
|
||||
pthread_mutex_unlock(&frame_worker_lock);
|
||||
}
|
||||
|
||||
int droiddeck_frame_worker_grant(int owner, pid_t pid, uint64_t expires, const char *path,
|
||||
uint64_t expected_dev, uint64_t expected_ino, uint64_t receipt) {
|
||||
struct stat st;
|
||||
if (owner <= 0 || pid <= 1 || !receipt || !path ||
|
||||
strlen(path) >= sizeof(frame_worker_file) || lstat(path, &st) < 0 || !S_ISREG(st.st_mode) ||
|
||||
(uint64_t)st.st_dev != expected_dev || (uint64_t)st.st_ino != expected_ino ||
|
||||
st.st_uid != getuid()) {
|
||||
droiddeck_log("probe", "worker_admission=NATIVE_FILE");
|
||||
return 0;
|
||||
}
|
||||
int pidfd = syscall(__NR_pidfd_open, pid, 0);
|
||||
if (pidfd < 0) {
|
||||
droiddeck_log("probe", "worker_admission=NATIVE_PIDFD");
|
||||
return 0; // No fallback to a recyclable PID.
|
||||
}
|
||||
struct pollfd alive = {.fd = pidfd, .events = POLLIN};
|
||||
uint64_t raw_start = 0;
|
||||
enum dd_worker_stat_result stat = frame_worker_starttime(pid, &raw_start);
|
||||
switch (stat) {
|
||||
case DD_WORKER_STAT_OK:
|
||||
if (raw_start != receipt) droiddeck_log("probe", "worker_admission=NATIVE_STAT_MISMATCH");
|
||||
break;
|
||||
case DD_WORKER_STAT_DENIED: droiddeck_log("probe", "worker_admission=NATIVE_STAT_OPEN_DENIED"); break;
|
||||
case DD_WORKER_STAT_HIDDEN: droiddeck_log("probe", "worker_admission=NATIVE_STAT_OPEN_HIDDEN"); break;
|
||||
case DD_WORKER_STAT_OPEN: droiddeck_log("probe", "worker_admission=NATIVE_STAT_OPEN_OTHER"); break;
|
||||
case DD_WORKER_STAT_READ: droiddeck_log("probe", "worker_admission=NATIVE_STAT_READ"); break;
|
||||
case DD_WORKER_STAT_PARSE: droiddeck_log("probe", "worker_admission=NATIVE_STAT_PARSE"); break;
|
||||
case DD_WORKER_STAT_ZERO: droiddeck_log("probe", "worker_admission=NATIVE_STAT_ZERO"); break;
|
||||
}
|
||||
if (!dd_worker_receipt_allows_reserve(stat, raw_start, receipt)) { close(pidfd); return 0; }
|
||||
if (poll(&alive, 1, 0) != 0) {
|
||||
droiddeck_log("probe", "worker_admission=NATIVE_PIDFD_NOT_LIVE");
|
||||
close(pidfd);
|
||||
return 0;
|
||||
}
|
||||
pthread_mutex_lock(&frame_worker_lock);
|
||||
if (frame_worker_pidfd < 0) {
|
||||
strcpy(frame_worker_file, path);
|
||||
frame_worker_grant = (struct dd_worker_grant){
|
||||
.owner = owner, .uid = getuid(), .pid = pid, .start_ticks = receipt, .expires = expires,
|
||||
.dev_major = major(st.st_dev), .dev_minor = minor(st.st_dev), .ino = st.st_ino,
|
||||
.canonical_file = frame_worker_file, .app_launch_verified = true, .final_go = true,
|
||||
};
|
||||
frame_worker_map_reported = false;
|
||||
frame_worker_pidfd = pidfd;
|
||||
pidfd = -1;
|
||||
}
|
||||
pthread_mutex_unlock(&frame_worker_lock);
|
||||
if (pidfd >= 0) {
|
||||
droiddeck_log("probe", "worker_admission=NATIVE_ALREADY_RESERVED");
|
||||
close(pidfd);
|
||||
return 0;
|
||||
}
|
||||
droiddeck_log("probe", "frame acquire reserved one app-verified worker");
|
||||
return 1;
|
||||
}
|
||||
|
||||
static bool frame_worker_verified_exec_locked(const struct dd_worker_grant *g, uint64_t now) {
|
||||
char proc[64], line[PATH_MAX + 128];
|
||||
const char *failure = "worker_admission=MAP_STARTTIME";
|
||||
uint64_t raw_start = 0;
|
||||
if (frame_worker_starttime(g->pid, &raw_start) != DD_WORKER_STAT_OK || raw_start != g->start_ticks)
|
||||
goto reject;
|
||||
snprintf(proc, sizeof(proc), "/proc/%u/maps", g->pid);
|
||||
FILE *f = fopen(proc, "re");
|
||||
failure = "worker_admission=MAP_OPEN";
|
||||
if (!f) goto reject;
|
||||
bool matched = false;
|
||||
size_t budget = 2 * 1024 * 1024;
|
||||
while (budget && fgets(line, sizeof(line), f)) {
|
||||
size_t n = strlen(line);
|
||||
if (!n || line[n - 1] != '\n' || n > budget) break;
|
||||
budget -= n;
|
||||
if (dd_worker_grant_matches(g, g->owner, g->uid, g->pid, raw_start, now, line)) {
|
||||
matched = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
if (matched) return true;
|
||||
failure = "worker_admission=MAP_IDENTITY";
|
||||
reject:
|
||||
if (!frame_worker_map_reported) {
|
||||
frame_worker_map_reported = true;
|
||||
droiddeck_log("probe", "%s", failure);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static int frame_acquire_peer_allowed(const struct wl_client *client, bool verify_exec, bool bind) {
|
||||
pid_t pid = 0;
|
||||
uid_t uid = (uid_t)-1;
|
||||
wl_client_get_credentials(client, &pid, &uid, NULL);
|
||||
struct timespec t;
|
||||
if (clock_gettime(CLOCK_BOOTTIME, &t) < 0) return 0;
|
||||
uint64_t now = (uint64_t)t.tv_sec * 1000 + (uint64_t)t.tv_nsec / 1000000;
|
||||
pthread_mutex_lock(&frame_worker_lock);
|
||||
const struct dd_worker_grant *g = &frame_worker_grant;
|
||||
struct pollfd alive = {.fd = frame_worker_pidfd, .events = POLLIN};
|
||||
bool allowed = frame_worker_pidfd >= 0 && uid == getuid() && pid > 1 &&
|
||||
g->pid == (uint32_t)pid && g->uid == uid && now < g->expires &&
|
||||
poll(&alive, 1, 0) == 0 && (!verify_exec ||
|
||||
(frame_worker_verified_exec_locked(g, now) && poll(&alive, 1, 0) == 0));
|
||||
// The short startup authorization may not be renewed by registry enumeration.
|
||||
// Only an authenticated bind activates the grant for the lifetime of this live,
|
||||
// unreplaced worker; session teardown revokes it independently of process exit.
|
||||
if (allowed && bind) frame_worker_grant.expires = UINT64_MAX;
|
||||
pthread_mutex_unlock(&frame_worker_lock);
|
||||
return allowed;
|
||||
}
|
||||
|
||||
static bool frame_acquire_global_filter(const struct wl_client *client, const struct wl_global *global, void *data) {
|
||||
return wl_global_get_interface(global) != &droiddeck_frame_acquire_v1_interface ||
|
||||
frame_acquire_peer_allowed(client, true, false);
|
||||
}
|
||||
|
||||
static void frame_acquire_destroy(struct wl_client *client, struct wl_resource *resource) {
|
||||
wl_resource_destroy(resource);
|
||||
}
|
||||
|
||||
static void frame_acquire_set(struct wl_client *client, struct wl_resource *resource,
|
||||
struct wl_resource *surface, struct wl_resource *buffer, int32_t fd) {
|
||||
if (!frame_acquire_peer_allowed(client, false, false)) {
|
||||
close(fd);
|
||||
wl_resource_post_error(resource, DROIDDECK_FRAME_ACQUIRE_V1_ERROR_UNAUTHORIZED_PEER,
|
||||
"paired capture peer is not authorized");
|
||||
return;
|
||||
}
|
||||
struct surface *s = NULL;
|
||||
if (surface && buffer && wl_resource_get_client(surface) == client &&
|
||||
wl_resource_get_client(buffer) == client &&
|
||||
wl_resource_instance_of(surface, &wl_surface_interface, &surface_impl) &&
|
||||
get_dmabuf(buffer))
|
||||
s = wl_resource_get_user_data(surface);
|
||||
if (!s || !s->pending_attach || s->pending_buffer != buffer) {
|
||||
close(fd);
|
||||
wl_resource_post_error(resource, DROIDDECK_FRAME_ACQUIRE_V1_ERROR_INVALID_ATTACHMENT,
|
||||
"fence does not match pending DMA-BUF attachment");
|
||||
return;
|
||||
}
|
||||
enum dd_frame_acquire_result result = dd_frame_acquire_set(&s->pending_frame_acquire, fd);
|
||||
if (result == DD_ACQUIRE_DUPLICATE)
|
||||
wl_resource_post_error(resource, DROIDDECK_FRAME_ACQUIRE_V1_ERROR_DUPLICATE_FENCE,
|
||||
"pending attachment already has a fence");
|
||||
else if (result == DD_ACQUIRE_INVALID)
|
||||
wl_resource_post_error(resource, DROIDDECK_FRAME_ACQUIRE_V1_ERROR_INVALID_FENCE,
|
||||
"expected an already signaled Linux sync_file");
|
||||
}
|
||||
|
||||
static const struct droiddeck_frame_acquire_v1_interface frame_acquire_impl = {
|
||||
.destroy = frame_acquire_destroy,
|
||||
.set_acquire_fence = frame_acquire_set,
|
||||
};
|
||||
|
||||
static void bind_frame_acquire(struct wl_client *client, void *data, uint32_t version, uint32_t id) {
|
||||
if (!frame_acquire_peer_allowed(client, true, true)) {
|
||||
wl_client_post_implementation_error(client, "paired capture peer is not authorized");
|
||||
return;
|
||||
}
|
||||
struct wl_resource *resource =
|
||||
wl_resource_create(client, &droiddeck_frame_acquire_v1_interface, 1, id);
|
||||
if (!resource) {
|
||||
wl_client_post_no_memory(client);
|
||||
return;
|
||||
}
|
||||
wl_resource_set_implementation(resource, &frame_acquire_impl, NULL, NULL);
|
||||
droiddeck_log("probe", "frame acquire bound to app-issued worker and exact executable map");
|
||||
}
|
||||
#endif
|
||||
|
||||
static void detach_from_parent(struct surface *s) {
|
||||
if (!s->parent) return;
|
||||
wl_list_remove(&s->child_link);
|
||||
@@ -1709,6 +1937,7 @@ static void detach_from_parent(struct surface *s) {
|
||||
|
||||
static void surface_resource_destroy(struct wl_resource *r) {
|
||||
struct surface *s = wl_resource_get_user_data(r);
|
||||
dd_frame_acquire_clear(&s->pending_frame_acquire);
|
||||
struct surface *child, *tmp;
|
||||
struct wl_resource *cb, *cbtmp;
|
||||
|
||||
@@ -4804,6 +5033,7 @@ static int on_stats_timer(void *data) {
|
||||
struct surface *s;
|
||||
wl_list_for_each(s, &g_toplevels, toplevel_link) windows++;
|
||||
unsigned zero_copy = ahb_swapchain_stats_take();
|
||||
unsigned verified = ahb_swapchain_producer_fence_stats_take();
|
||||
unsigned layer_frames = sc_layer_frames_take();
|
||||
g_zero_copy_last = zero_copy;
|
||||
unsigned generated = vkp_framegen_stats_take();
|
||||
@@ -4812,7 +5042,8 @@ static int on_stats_timer(void *data) {
|
||||
int off = 0;
|
||||
if (g_zero_copy || zero_copy) off += snprintf(extra + off, sizeof(extra) - (size_t)off, " | %u zero-copy frames", zero_copy);
|
||||
if (layer_frames) off += snprintf(extra + off, sizeof(extra) - (size_t)off, " | %u layer frames", layer_frames);
|
||||
if (generated) snprintf(extra + off, sizeof(extra) - (size_t)off, " | %u generated frames", generated);
|
||||
if (generated) off += snprintf(extra + off, sizeof(extra) - (size_t)off, " | %u generated frames", generated);
|
||||
if (verified) snprintf(extra + off, sizeof(extra) - (size_t)off, " | %u verified acquire frames", verified);
|
||||
droiddeck_log("stats", "last 10 s: %u frames on screen (%.1f fps) | %u GPU frames from games | %u window redraws | %d windows open%s",
|
||||
g_stat_frames + generated, (g_stat_frames + generated) / 10.0, g_stat_dmabuf, g_stat_shm, windows, extra);
|
||||
}
|
||||
@@ -5013,6 +5244,12 @@ int droiddeck_wayland_run(void) {
|
||||
wl_global_create(display, &zwp_relative_pointer_manager_v1_interface, 1, NULL, bind_relative_pointer_manager);
|
||||
droiddeck_ext_init(display);
|
||||
ahb_swapchain_init(display);
|
||||
#ifdef DROIDDECK_FRAME_ACQUIRE_PROBE
|
||||
if (ahb_swapchain_advertised()) {
|
||||
wl_display_set_global_filter(display, frame_acquire_global_filter, NULL);
|
||||
wl_global_create(display, &droiddeck_frame_acquire_v1_interface, 1, NULL, bind_frame_acquire);
|
||||
}
|
||||
#endif
|
||||
display_buffers_init(display);
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
#ifndef DD_FRAME_ACQUIRE_H
|
||||
#define DD_FRAME_ACQUIRE_H
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <linux/sync_file.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* A zero-initialized slot owns no descriptor. Only an already successful
|
||||
* sync_file can enter this slot; display-side release ownership is separate. */
|
||||
struct dd_frame_acquire { int fd_plus_one; };
|
||||
enum dd_frame_acquire_result { DD_ACQUIRE_OK, DD_ACQUIRE_DUPLICATE, DD_ACQUIRE_INVALID };
|
||||
|
||||
static inline void dd_frame_acquire_clear(struct dd_frame_acquire *f) {
|
||||
if (f->fd_plus_one) close(f->fd_plus_one - 1);
|
||||
f->fd_plus_one = 0;
|
||||
}
|
||||
|
||||
static inline enum dd_frame_acquire_result
|
||||
dd_frame_acquire_set(struct dd_frame_acquire *f, int fd) {
|
||||
enum dd_frame_acquire_result result;
|
||||
struct sync_file_info info = {0};
|
||||
if (f->fd_plus_one) result = DD_ACQUIRE_DUPLICATE;
|
||||
else if (fd < 0 || fd == INT_MAX || ioctl(fd, SYNC_IOC_FILE_INFO, &info) != 0 ||
|
||||
info.status != 1 || info.num_fences == 0) result = DD_ACQUIRE_INVALID;
|
||||
else {
|
||||
f->fd_plus_one = fd + 1;
|
||||
return DD_ACQUIRE_OK;
|
||||
}
|
||||
if (fd >= 0) close(fd);
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline int dd_frame_acquire_dup(const struct dd_frame_acquire *f) {
|
||||
if (!f->fd_plus_one) return -1; /* Legacy: no explicit attachment proof. */
|
||||
int fd = fcntl(f->fd_plus_one - 1, F_DUPFD_CLOEXEC, 0);
|
||||
return fd < 0 ? -2 : fd; /* Do not re-enter the legacy direct path. */
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,81 @@
|
||||
#ifndef DD_WORKER_PEER_H
|
||||
#define DD_WORKER_PEER_H
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Model of one app-issued, session-bound authorization record. No callers,
|
||||
* property access, proc traversal, or authorization is installed by this file. */
|
||||
struct dd_worker_grant {
|
||||
uint32_t owner, uid, pid, dev_major, dev_minor;
|
||||
uint64_t start_ticks, ino, expires;
|
||||
const char *canonical_file;
|
||||
bool app_launch_verified, final_go;
|
||||
};
|
||||
|
||||
enum dd_worker_stat_result {
|
||||
DD_WORKER_STAT_OK, DD_WORKER_STAT_DENIED, DD_WORKER_STAT_HIDDEN, DD_WORKER_STAT_OPEN,
|
||||
DD_WORKER_STAT_READ, DD_WORKER_STAT_PARSE, DD_WORKER_STAT_ZERO,
|
||||
};
|
||||
|
||||
static inline enum dd_worker_stat_result dd_worker_parse_start(const char *line, uint64_t *out) {
|
||||
const char *p = strrchr(line, ')');
|
||||
if (!p || p[1] != ' ' || !p[2] || p[3] != ' ') return DD_WORKER_STAT_PARSE;
|
||||
p += 2;
|
||||
// State is field 3. The starttime (22) is always followed by vsize (23).
|
||||
for (int field = 3; field < 22; ++field) {
|
||||
p = strchr(p, ' ');
|
||||
if (!p) return DD_WORKER_STAT_PARSE;
|
||||
while (*p == ' ') ++p;
|
||||
}
|
||||
char *end;
|
||||
if (*p < '0' || *p > '9') return DD_WORKER_STAT_PARSE;
|
||||
errno = 0;
|
||||
uint64_t value = strtoull(p, &end, 10);
|
||||
if (errno || end == p || *end != ' ') return DD_WORKER_STAT_PARSE;
|
||||
if (!value) return DD_WORKER_STAT_ZERO;
|
||||
*out = value;
|
||||
return DD_WORKER_STAT_OK;
|
||||
}
|
||||
|
||||
static inline enum dd_worker_stat_result dd_worker_open_failure(int error) {
|
||||
if (error == EACCES || error == EPERM) return DD_WORKER_STAT_DENIED;
|
||||
if (error == ENOENT || error == ESRCH) return DD_WORKER_STAT_HIDDEN;
|
||||
return DD_WORKER_STAT_OPEN;
|
||||
}
|
||||
|
||||
static inline bool dd_worker_receipt_allows_reserve(enum dd_worker_stat_result stat,
|
||||
uint64_t raw, uint64_t receipt) {
|
||||
if (!receipt) return false;
|
||||
if (stat == DD_WORKER_STAT_OK) return raw == receipt;
|
||||
// Only a visibility denial can defer the broker-side stat check, not any
|
||||
// bad read, malformed record, mismatched timestamp, or other open error.
|
||||
return stat == DD_WORKER_STAT_DENIED || stat == DD_WORKER_STAT_HIDDEN;
|
||||
}
|
||||
|
||||
static inline bool dd_worker_map_matches(const struct dd_worker_grant *g, const char *line) {
|
||||
unsigned major, minor;
|
||||
uint64_t lo, hi, off, ino;
|
||||
int prefix = 0;
|
||||
char mode[5];
|
||||
if (!g->canonical_file || !*g->canonical_file ||
|
||||
sscanf(line, "%" SCNx64 "-%" SCNx64 " %4s %" SCNx64 " %x:%x %" SCNu64 " %n",
|
||||
&lo,&hi,mode,&off,&major,&minor,&ino,&prefix)!=7 ||
|
||||
prefix <= 0 || hi <= lo || strlen(mode)!=4 || mode[2]!='x' ||
|
||||
major!=g->dev_major || minor!=g->dev_minor || !ino || ino!=g->ino)
|
||||
return false;
|
||||
size_t path_len=strcspn(line+prefix,"\r\n");
|
||||
return strlen(g->canonical_file)==path_len && !memcmp(line+prefix,g->canonical_file,path_len);
|
||||
}
|
||||
|
||||
static inline bool dd_worker_grant_matches(const struct dd_worker_grant *g, uint32_t owner,
|
||||
uint32_t uid, uint32_t pid, uint64_t start, uint64_t now, const char *executable_map) {
|
||||
return g && g->app_launch_verified && g->final_go && owner && owner==g->owner &&
|
||||
uid==g->uid && pid>1 && pid==g->pid && start && start==g->start_ticks &&
|
||||
now<g->expires && executable_map && dd_worker_map_matches(g,executable_map);
|
||||
}
|
||||
#endif
|
||||
@@ -916,3 +916,42 @@ JNIEXPORT jint JNICALL
|
||||
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeStreamFrames(JNIEnv *env, jclass clazz) {
|
||||
return (jint)droiddeck_stream_frames();
|
||||
}
|
||||
|
||||
|
||||
#ifdef DROIDDECK_FRAME_ACQUIRE_PROBE
|
||||
extern int droiddeck_frame_worker_grant(int owner, pid_t pid, uint64_t expires, const char *path,
|
||||
uint64_t dev, uint64_t ino, uint64_t receipt);
|
||||
extern void droiddeck_frame_worker_revoke(int owner, int pid);
|
||||
#endif
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_com_droiddeck_launcher_wayland_WaylandCompositor_frameWorkerProbeEnabled(JNIEnv *env, jclass c) {
|
||||
#ifdef DROIDDECK_FRAME_ACQUIRE_PROBE
|
||||
return JNI_TRUE;
|
||||
#else
|
||||
return JNI_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_com_droiddeck_launcher_wayland_WaylandCompositor_frameWorkerProbeGrant(JNIEnv *env, jclass c,
|
||||
jint owner, jint pid, jlong expires, jstring path, jlong dev, jlong ino, jlong start_ticks) {
|
||||
#ifdef DROIDDECK_FRAME_ACQUIRE_PROBE
|
||||
if (!path || expires <= 0 || ino <= 0 || start_ticks <= 0) return JNI_FALSE;
|
||||
const char *name = (*env)->GetStringUTFChars(env, path, NULL);
|
||||
if (!name) return JNI_FALSE;
|
||||
int granted = droiddeck_frame_worker_grant(owner, pid, (uint64_t)expires, name, (uint64_t)dev, (uint64_t)ino, (uint64_t)start_ticks);
|
||||
(*env)->ReleaseStringUTFChars(env, path, name);
|
||||
return granted ? JNI_TRUE : JNI_FALSE;
|
||||
#else
|
||||
return JNI_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_droiddeck_launcher_wayland_WaylandCompositor_frameWorkerProbeRevoke(JNIEnv *env, jclass c,
|
||||
jint owner, jint pid) {
|
||||
#ifdef DROIDDECK_FRAME_ACQUIRE_PROBE
|
||||
droiddeck_frame_worker_revoke(owner, pid);
|
||||
#endif
|
||||
}
|
||||
@@ -80,6 +80,7 @@ class App : Application() {
|
||||
com.droiddeck.launcher.stores.StoresState.register(com.droiddeck.launcher.stores.xbox.XboxBackend)
|
||||
com.droiddeck.launcher.sync.Syncthing.init(this)
|
||||
com.droiddeck.launcher.stores.StoresState.register(com.droiddeck.launcher.stores.battlenet.BattleNetBackend)
|
||||
com.droiddeck.launcher.stores.StoresState.register(com.droiddeck.launcher.stores.nexon.NexonBackend)
|
||||
com.droiddeck.launcher.stores.StoresState.register(com.droiddeck.launcher.stores.ubisoft.UbisoftBackend)
|
||||
com.droiddeck.launcher.stores.ea.EaBackend.app = this
|
||||
com.droiddeck.launcher.stores.StoresState.register(com.droiddeck.launcher.stores.ea.EaBackend)
|
||||
|
||||
@@ -167,7 +167,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
private var pkgPercent by PackageOperation.percent
|
||||
private var desktopInstalled by mutableStateOf(false)
|
||||
private var desktopPresent by mutableStateOf(false)
|
||||
private var battleNetInstalled by mutableStateOf(false)
|
||||
private var clientsInstalled by mutableStateOf(emptySet<com.droiddeck.launcher.stores.Store>())
|
||||
private var offlineAccount by mutableStateOf<String?>(null)
|
||||
private var offline by mutableStateOf(false)
|
||||
private var offlineAuto by mutableStateOf(true)
|
||||
@@ -304,9 +304,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
protons.installExperimental { progress -> com.droiddeck.launcher.session.ExperimentalProtons.installFromFile(this, zip, progress) }
|
||||
}
|
||||
}
|
||||
private val pickLossless = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { r ->
|
||||
if (r.resultCode == RESULT_OK) InAppFilePicker.pickedFile(r.data)?.let { importLossless(it) }
|
||||
}
|
||||
private val pickSaveZip = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { r ->
|
||||
val then = onSavePicked.also { onSavePicked = null } ?: return@registerForActivityResult
|
||||
if (r.resultCode == RESULT_OK) InAppFilePicker.pickedFile(r.data)?.let(then)
|
||||
@@ -517,17 +514,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
bootMovieCustomName = com.droiddeck.launcher.session.BootMovie.customName(this)
|
||||
}
|
||||
|
||||
private fun importLossless(dll: File) {
|
||||
Thread({
|
||||
val message = Lossless.message(this, Lossless.import(this, dll))
|
||||
val state = Lossless.state(this)
|
||||
ui.post {
|
||||
lossless = state
|
||||
android.widget.Toast.makeText(this, message, android.widget.Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}, "lossless-import").start()
|
||||
}
|
||||
|
||||
private fun importSaves(name: String, game: () -> GameSaves.Game) {
|
||||
if (SessionState.running) {
|
||||
android.widget.Toast.makeText(this, R.string.main_saves_close_session, android.widget.Toast.LENGTH_LONG).show()
|
||||
@@ -625,6 +611,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
private var appScale by mutableStateOf(com.droiddeck.launcher.core.AppUiPrefs.DEFAULT_SCALE)
|
||||
private var hdrOn by mutableStateOf(false)
|
||||
private var zeroCopyOn by mutableStateOf(true)
|
||||
private var producerAcquireFences by mutableStateOf(false)
|
||||
private var upscaler by mutableStateOf(0)
|
||||
private var upscaleSharpness by mutableStateOf(75)
|
||||
private var hdrReason by mutableStateOf<String?>(null)
|
||||
@@ -1100,6 +1087,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
} else {
|
||||
putExtra(SessionService.EXTRA_STEAM_URL,
|
||||
com.droiddeck.launcher.frontend.GameLaunchLink.steamUrl(game.gameIdString))
|
||||
putExtra(SessionService.EXTRA_FRONTEND_STEAM_GAME, true)
|
||||
}
|
||||
}
|
||||
.playing(game), steamSession = true)
|
||||
@@ -1482,7 +1470,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
packageStage = pkgStage,
|
||||
packagePercent = pkgPercent,
|
||||
sessionRunning = SessionState.running,
|
||||
battleNetInstalled = battleNetInstalled,
|
||||
clientsInstalled = clientsInstalled,
|
||||
backActionsInverted = backActionsInverted,
|
||||
buildLabel = BuildConfig.BUILD_LABEL,
|
||||
oscMode = oscMode,
|
||||
@@ -1612,7 +1600,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
.putExtra(SessionService.EXTRA_PROGRAM, app.program)
|
||||
.putExtra(SessionService.EXTRA_PROGRAM_ARGS, app.args.toTypedArray()))
|
||||
},
|
||||
onBattleNet = { openBattleNet() },
|
||||
onClient = { openClient(it) },
|
||||
onFlatpakApp = { id, name ->
|
||||
Library.flatpakNames[id] = name
|
||||
startActivity(Intent(this, SessionActivity::class.java)
|
||||
@@ -1658,9 +1646,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
FrameGen.set(this, mode)
|
||||
frameGenLabel = FrameGen.label(this)
|
||||
},
|
||||
onImportLossless = {
|
||||
pickLossless.launch(InAppFilePicker.buildIntent(this, listOf("dll"), getString(R.string.lsfg_pick_title)))
|
||||
},
|
||||
onProtons = { openProtons() },
|
||||
onComponents = { focusContent -> openComponents(focusContent) },
|
||||
onGameComponents = { game -> openComponents(gameKey = game.profileKey) },
|
||||
@@ -2103,6 +2088,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
// A restarted launcher starts before the old one stops, so each clears the hooks only if they are still its own.
|
||||
private val libraryHook: () -> Unit = { refreshAddedGames(); refresh() }
|
||||
private val battleNetHook: (List<String>) -> Unit = { args -> openBattleNet(args) }
|
||||
private val nexonHook: (List<String>) -> Unit = { openNexon() }
|
||||
|
||||
private fun startSteamAtStartupIfEnabled(cold: Boolean = false) {
|
||||
if (soundtrackLaunch || intent.getBooleanExtra(EXTRA_RESTARTED, false)) return
|
||||
@@ -2391,7 +2377,8 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
refreshWifiDiscovery()
|
||||
com.droiddeck.launcher.stores.StoresState.refresh(this)
|
||||
com.droiddeck.launcher.stores.StoresState.libraryListener = libraryHook
|
||||
com.droiddeck.launcher.stores.battlenet.BattleNetClient.opener = battleNetHook
|
||||
com.droiddeck.launcher.runtime.BattleNet.CLIENT.opener = battleNetHook
|
||||
com.droiddeck.launcher.runtime.Nexon.CLIENT.opener = nexonHook
|
||||
com.droiddeck.launcher.ui.Motion.refresh(this)
|
||||
com.droiddeck.launcher.ui.QuitFlood.take()?.let { c ->
|
||||
returning = ReturningFlood(c, com.droiddeck.launcher.ui.LaunchOrigin.takeReturn())
|
||||
@@ -2535,7 +2522,8 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
HomeWidgets.stopListening(this)
|
||||
ui.removeCallbacks(mediaRefresh)
|
||||
if (com.droiddeck.launcher.stores.StoresState.libraryListener === libraryHook) com.droiddeck.launcher.stores.StoresState.libraryListener = null
|
||||
if (com.droiddeck.launcher.stores.battlenet.BattleNetClient.opener === battleNetHook) com.droiddeck.launcher.stores.battlenet.BattleNetClient.opener = null
|
||||
if (com.droiddeck.launcher.runtime.BattleNet.CLIENT.opener === battleNetHook) com.droiddeck.launcher.runtime.BattleNet.CLIENT.opener = null
|
||||
if (com.droiddeck.launcher.runtime.Nexon.CLIENT.opener === nexonHook) com.droiddeck.launcher.runtime.Nexon.CLIENT.opener = null
|
||||
displayManager.unregisterDisplayListener(secondScreenDisplayListener)
|
||||
com.droiddeck.launcher.input.DualScreen.unwatchTaken(bottomScreenListener)
|
||||
getSystemService(android.hardware.input.InputManager::class.java)?.unregisterInputDeviceListener(secondScreenTouchListener)
|
||||
@@ -2808,6 +2796,20 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
desktopPresent = DesktopCatalog.desktopPresent(this)
|
||||
}
|
||||
|
||||
private fun openClient(store: com.droiddeck.launcher.stores.Store) {
|
||||
if (store == com.droiddeck.launcher.stores.Store.NEXON) openNexon() else openBattleNet()
|
||||
}
|
||||
|
||||
private fun openNexon() {
|
||||
val app = applicationContext
|
||||
val ticket = beginUiLaunch()
|
||||
Thread({
|
||||
val entry = com.droiddeck.launcher.runtime.Nexon.entry(app)
|
||||
if (entry == null) com.droiddeck.launcher.stores.SetupDownload.openOrFetch(app, com.droiddeck.launcher.runtime.Nexon.CLIENT)
|
||||
else ui.post { if (!isDestroyed && launchCoordinator.isCurrent(ticket)) launchWithoutSteam(entry, false, ticket = ticket) }
|
||||
}, "nexon-open").start()
|
||||
}
|
||||
|
||||
private fun openBattleNet(args: List<String> = emptyList()) {
|
||||
if (pkgStage != null) {
|
||||
android.widget.Toast.makeText(this, R.string.main_wait_install_game, android.widget.Toast.LENGTH_SHORT).show()
|
||||
@@ -2921,6 +2923,10 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
mode = mode, resolution = resolution, resolutionPortrait = resolutionPortrait,
|
||||
panelSize = com.droiddeck.launcher.session.SessionDisplay.panelSize(this),
|
||||
hdr = hdrOn, hdrReason = hdrReason, hdrDisplay = hdrDisplay, zeroCopy = zeroCopyOn,
|
||||
producerAcquireFences = producerAcquireFences.takeIf {
|
||||
mode == SessionService.MODE_STEAM &&
|
||||
com.droiddeck.launcher.runtime.FrameAcquireWorkerProbe.available(this)
|
||||
},
|
||||
upscaler = upscaler, upscaleSharpness = upscaleSharpness,
|
||||
gpuDrivers = drivers.summary(),
|
||||
touchMode = touchMode,
|
||||
@@ -2985,6 +2991,10 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
SessionPrefs.prefMode(SessionState.mode) == SessionPrefs.prefMode(mode))
|
||||
com.droiddeck.launcher.wayland.WaylandCompositor.nativeSetZeroCopy(on)
|
||||
},
|
||||
onProducerAcquireFences = {
|
||||
SessionPrefs.setProducerAcquireFences(this, it)
|
||||
producerAcquireFences = it
|
||||
},
|
||||
onGpuDrivers = { openComponents(focusContent = true, tab = com.droiddeck.launcher.ui.GPU_TAB) },
|
||||
onUpscaler = { m -> SessionPrefs.setUpscaler(this, m); upscaler = m },
|
||||
onUpscaleSharpness = { pct -> SessionPrefs.setUpscaleSharpness(this, pct); upscaleSharpness = pct },
|
||||
@@ -3346,6 +3356,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
loadBootMovie()
|
||||
hdrOn = SessionPrefs.hdr(this, mode)
|
||||
zeroCopyOn = SessionPrefs.zeroCopy(this, mode)
|
||||
producerAcquireFences = SessionPrefs.producerAcquireFences(this)
|
||||
upscaler = SessionPrefs.upscaler(this)
|
||||
upscaleSharpness = SessionPrefs.upscaleSharpness(this)
|
||||
hdrReason = com.droiddeck.launcher.wayland.HdrSupport.blocked(this)
|
||||
@@ -3489,7 +3500,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
addedGamesArt = SessionPrefs.addedGamesArt(this)
|
||||
desktopInstalled = DesktopCatalog.desktopInstalled(this)
|
||||
desktopPresent = DesktopCatalog.desktopPresent(this)
|
||||
battleNetInstalled = com.droiddeck.launcher.runtime.BattleNet.installed(this)
|
||||
clientsInstalled = com.droiddeck.launcher.runtime.WindowsClient.all.filter { it.installed(this) }.mapTo(mutableSetOf()) { it.store }
|
||||
offlineAccount = OfflineMode.account(this)
|
||||
offline = OfflineMode.enabled(this)
|
||||
offlineAuto = OfflineMode.auto(this)
|
||||
|
||||
@@ -230,6 +230,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
private var unfoldedPanel by mutableStateOf<OnScreenControls?>(null)
|
||||
private var unfoldedColumn: android.widget.LinearLayout? = null
|
||||
private var unfoldedKeys: View? = null
|
||||
private var unfoldedDeckSurface: com.droiddeck.launcher.ui.InputSurfaceView? = null
|
||||
private var swappedInputSurface: com.droiddeck.launcher.ui.InputSurfaceView? = null
|
||||
private var unfoldedDeckPanel by mutableStateOf<com.droiddeck.launcher.input.DeckPanel?>(null)
|
||||
@@ -717,9 +718,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private var drawerTextureAnisotropy by mutableStateOf<Int?>(null)
|
||||
private var drawerTextureLodBias by mutableStateOf<String?>(null)
|
||||
private var lossless by mutableStateOf(Lossless.State.NONE)
|
||||
private val pickLossless = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { r ->
|
||||
if (r.resultCode == RESULT_OK) InAppFilePicker.pickedFile(r.data)?.let { importLossless(it) }
|
||||
}
|
||||
private var frameGen by mutableStateOf(FrameGen.Mode.OFF)
|
||||
private var frameGenActiveGameId by mutableStateOf<Long?>(null)
|
||||
private var frameGenActiveGameName by mutableStateOf<String?>(null)
|
||||
@@ -1605,10 +1603,14 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
|
||||
/** The VR keyboard's keys go straight to the game, past the menu and pad handling a real key passes through. */
|
||||
private val xrKeys by lazy {
|
||||
com.droiddeck.launcher.input.KeyboardHost(this) { event ->
|
||||
CompositorHost.isStarted && (event.action != KeyEvent.ACTION_DOWN || event.repeatCount == 0) &&
|
||||
com.droiddeck.launcher.input.GuestKeys.send(event) { code, pressed -> sendGuestKey(code, pressed, 16) }
|
||||
}
|
||||
KeyboardHost(
|
||||
this,
|
||||
sendKeyEvent = { event ->
|
||||
CompositorHost.isStarted && (event.action != KeyEvent.ACTION_DOWN || event.repeatCount == 0) &&
|
||||
com.droiddeck.launcher.input.GuestKeys.send(event) { code, pressed -> sendGuestKey(code, pressed, 16) }
|
||||
},
|
||||
sendText = { text -> if (CompositorHost.isStarted) WaylandCompositor.textInputCommit(text) },
|
||||
)
|
||||
}
|
||||
|
||||
@androidx.compose.runtime.Composable
|
||||
@@ -1898,10 +1900,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
readPrefs()
|
||||
applyFrameGen(force = true)
|
||||
},
|
||||
onImportLossless = {
|
||||
pickLossless.launch(InAppFilePicker.buildIntent(
|
||||
this@SessionActivity, listOf("dll"), getString(R.string.lsfg_pick_title)))
|
||||
},
|
||||
onKeyboard = { drawerOpen = false; pcKeyboardOpen = false; togglePrimaryKeyboard() },
|
||||
onHardwareKeyboard = ::togglePcKeyboard,
|
||||
wowChatShown = com.droiddeck.launcher.ui.WowChat.isWow(AgentGuest.gameProgram),
|
||||
@@ -2052,6 +2050,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
},
|
||||
unfoldedControls = unfoldedControls,
|
||||
onUnfoldedControls = ::chooseUnfoldedControls,
|
||||
deckPanel = unfoldedDeckPanel,
|
||||
onDeckPanel = ::selectDeckPanel,
|
||||
adaptiveSticks = adaptiveSticks.takeIf {
|
||||
unfoldedPanel != null || oscMode != SessionPrefs.OSC_NEVER && oscMode != SessionPrefs.OSC_STEAM_QAM && !steamTouchInUse
|
||||
},
|
||||
@@ -3115,6 +3115,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
intent.getStringArrayExtra(SessionService.EXTRA_PROGRAM_ARGS),
|
||||
intent.getStringExtra(SessionService.EXTRA_GAME_ID),
|
||||
sessionActivityDisplayId,
|
||||
frontendSteamGame = intent.getBooleanExtra(SessionService.EXTRA_FRONTEND_STEAM_GAME, false),
|
||||
)
|
||||
intent.getStringExtra(EXTRA_PLAYED_GAME)?.let { com.droiddeck.launcher.frontend.Library.recordPlayed(this, it) }
|
||||
}
|
||||
@@ -3583,19 +3584,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}, "lossless-sync").start()
|
||||
}
|
||||
|
||||
private fun importLossless(dll: File) {
|
||||
Thread({
|
||||
val result = Lossless.import(this, dll)
|
||||
val message = Lossless.message(this, result)
|
||||
val state = Lossless.state(this)
|
||||
runOnUiThread {
|
||||
lossless = state
|
||||
Toast.makeText(this, message, Toast.LENGTH_LONG).show()
|
||||
applyFrameGen(force = result == Lossless.ImportResult.UPDATED)
|
||||
}
|
||||
}, "lossless-import").start()
|
||||
}
|
||||
|
||||
|
||||
private fun watchSession() {
|
||||
val handler = Handler(Looper.getMainLooper())
|
||||
@@ -4073,7 +4061,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
steamTouchControls?.let { takes(it, it::takesTouchAt) } == true ||
|
||||
unfoldedPanel?.let { takes(it, it::takesTouchAt) } == true ||
|
||||
unfoldedDeckSurface?.let { takes(it, it::takesTouchAt) } == true ||
|
||||
unfoldedColumn?.getChildAt(0)?.let { takes(it) { _, _ -> true } } == true
|
||||
unfoldedKeys?.let { takes(it) { _, _ -> true } } == true
|
||||
}
|
||||
|
||||
override fun dispatchTouchEvent(event: MotionEvent): Boolean {
|
||||
@@ -5117,12 +5105,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
val width = rootContentWidth()
|
||||
val height = rootContentHeight()
|
||||
val wanted = controlsBelowWanted()
|
||||
val tabRow = unfoldedColumn?.getChildAt(0)?.height?.let {
|
||||
it - (com.droiddeck.launcher.ui.BAR_HEIGHT.value * resources.displayMetrics.density + 0.5f).toInt()
|
||||
} ?: 0
|
||||
val outputAspect = if (!wanted || SessionState.followScreen) 0f
|
||||
else outputSize().let { it.first.toFloat() / it.second.coerceAtLeast(1) }
|
||||
val gameHeight = if (wanted) com.droiddeck.launcher.session.SessionDisplay.unfoldedGameHeight(width, height, tabRow, outputAspect)
|
||||
val gameHeight = if (wanted) com.droiddeck.launcher.session.SessionDisplay.unfoldedGameHeight(width, height, aspect = outputAspect)
|
||||
else FrameLayout.LayoutParams.MATCH_PARENT
|
||||
val params = surfaceView.layoutParams as FrameLayout.LayoutParams
|
||||
if (params.height != gameHeight) {
|
||||
@@ -5139,6 +5124,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
if (panel != null && (!wanted || panel.dock != dock)) {
|
||||
sessionRoot.removeView(unfoldedColumn)
|
||||
unfoldedColumn = null
|
||||
unfoldedKeys = null
|
||||
unfoldedDeckSurface = null
|
||||
unfoldedDeckPanel = null
|
||||
unfoldedPanel = null
|
||||
@@ -5150,13 +5136,14 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
panel = OnScreenControls(this, padBridge, dock).also { it.updateLayout(primaryInputLayout) }
|
||||
val column = android.widget.LinearLayout(this).apply {
|
||||
orientation = android.widget.LinearLayout.VERTICAL
|
||||
addView(unfoldedBar().apply {
|
||||
addOnLayoutChangeListener { _, _, top, _, bottom, _, oldTop, _, oldBottom ->
|
||||
if (bottom - top != oldBottom - oldTop) post { applyUnfoldedControls() }
|
||||
}
|
||||
}, android.widget.LinearLayout.LayoutParams(android.widget.LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
android.widget.LinearLayout.LayoutParams.WRAP_CONTENT))
|
||||
addView(panel, android.widget.LinearLayout.LayoutParams(android.widget.LinearLayout.LayoutParams.MATCH_PARENT, 0, 1f))
|
||||
unfoldedKeys = com.droiddeck.launcher.ui.padKeysView(
|
||||
this@SessionActivity, SessionState.mode == SessionService.MODE_STEAM,
|
||||
{ releasePads(); drawerOpen = true }, ::tapSteamButton, ::tapQam,
|
||||
).also {
|
||||
addView(it, android.widget.LinearLayout.LayoutParams(android.widget.LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
android.widget.LinearLayout.LayoutParams.WRAP_CONTENT))
|
||||
}
|
||||
}
|
||||
sessionRoot.addView(column, sessionRoot.indexOfChild(surfaceView) + 1)
|
||||
unfoldedColumn = column
|
||||
@@ -5167,13 +5154,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
unfoldedColumn?.layoutParams = FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, height - gameHeight, Gravity.BOTTOM)
|
||||
}
|
||||
|
||||
private fun unfoldedBar(): View = com.droiddeck.launcher.ui.bottomScreenBarView(this) {
|
||||
val deck = unfoldedDeckPanel
|
||||
com.droiddeck.launcher.ui.sessionBarModel(getString(if (deck != null) R.string.second_mode_deck_controls else R.string.deck_tab_gamepad),
|
||||
{ chooseUnfoldedControls(false) }, { drawerOpen = true }, ::tapSteamButton, ::tapQam,
|
||||
tabs = deck?.let { com.droiddeck.launcher.ui.deckPanelTabs(this, it, ::selectDeckPanel) })
|
||||
}
|
||||
|
||||
private fun showUnfoldedDeckPanel() {
|
||||
val column = unfoldedColumn
|
||||
val panel = unfoldedPanel
|
||||
@@ -5189,7 +5169,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
panel.visibility = View.GONE
|
||||
unfoldedDeckSurface = com.droiddeck.launcher.ui.InputSurfaceView(this, padBridge, layout.elements, InputRole.PRIMARY, layout.style, haptics = true).also {
|
||||
it.tag = layout
|
||||
column.addView(it, android.widget.LinearLayout.LayoutParams(android.widget.LinearLayout.LayoutParams.MATCH_PARENT, 0, 1f))
|
||||
column.addView(it, column.indexOfChild(panel) + 1, android.widget.LinearLayout.LayoutParams(android.widget.LinearLayout.LayoutParams.MATCH_PARENT, 0, 1f))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,9 @@ object AgentHost {
|
||||
"Never kill by a command-line pattern (pkill -f, pgrep -f piped to kill): your own command line holds the user's message, so the pattern matches you. " +
|
||||
"Files the user attaches are listed at the end of their message, under /root/.cache/droiddeck/attachments. " +
|
||||
"To have the user pick between options, end your reply with a fenced code block whose language is choices, one short option per line, " +
|
||||
"and end your turn: DroidDeck shows them as buttons and sends the one picked as the next message."
|
||||
"and end your turn: DroidDeck shows them as buttons and sends the one picked as the next message. " +
|
||||
"To show the user an image (a screenshot, a mockup, a chart), put  on a line of its own: " +
|
||||
"DroidDeck draws the file in the chat."
|
||||
|
||||
val entries = mutableStateListOf<Entry>()
|
||||
val queue = mutableStateListOf<Queued>()
|
||||
|
||||
@@ -226,7 +226,18 @@ object AgentSetup {
|
||||
/** The whole output of a step's last run; the card shows only its last line. */
|
||||
fun logFile(app: Context, step: Step) = File(app.filesDir, "agent/setup-${step.name.lowercase()}.log")
|
||||
|
||||
fun buildToolsInstalled(app: Context) = AgentHost.guestFileExists(app, "/root/aapt2/aapt2") && AgentHost.guestFileExists(app, "$CHECKOUT/.git")
|
||||
/**
|
||||
* An install set up before setup wrote the Gradle init script gets the step again, but only
|
||||
* once the checkout's setup writes it: the step runs that script, and an older one never would.
|
||||
*/
|
||||
fun buildToolsInstalled(app: Context) = AgentHost.guestFileExists(app, "/root/aapt2/aapt2") && AgentHost.guestFileExists(app, "$CHECKOUT/.git") &&
|
||||
(AgentHost.guestFileExists(app, GRADLE_INIT) || !setupWritesGradleInit(app))
|
||||
|
||||
private const val GRADLE_INIT = "/root/.gradle/init.d/droiddeck-device.gradle"
|
||||
|
||||
private fun setupWritesGradleInit(app: Context) = runCatching {
|
||||
File(LinuxRuntime.rootDir(app), "$CHECKOUT/tools/agent/setup".removePrefix("/")).readText().contains(GRADLE_INIT.substringAfterLast('/'))
|
||||
}.getOrDefault(false)
|
||||
|
||||
/** dd-lab-build compiled this install's commit, so a Lab build compiles only what changed. */
|
||||
private fun prepared(app: Context) = runCatching {
|
||||
|
||||
@@ -11,7 +11,7 @@ object GameRemoval {
|
||||
enum class Kind { STORE, SHORTCUT, LAUNCHER }
|
||||
|
||||
fun kind(game: Library.SteamGame): Kind = when {
|
||||
game.library == Library.EPIC_LAUNCHER || game.library == Library.BATTLENET_LAUNCHER -> Kind.LAUNCHER
|
||||
game.library == Library.EPIC_LAUNCHER || com.droiddeck.launcher.runtime.WindowsClient.byLibrary(game.library) != null -> Kind.LAUNCHER
|
||||
game.library == Library.ADDED && game.source == Library.ADDED -> Kind.SHORTCUT
|
||||
else -> Kind.STORE
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ object Library {
|
||||
const val EPIC_LAUNCHER = "epic-launcher"
|
||||
const val EPIC_LAUNCHER_NAME = "Epic Games Launcher"
|
||||
const val BATTLENET_LAUNCHER = "battlenet-launcher"
|
||||
const val NEXON_LAUNCHER = "nexon-launcher"
|
||||
const val XBOX_CLOUD = "xbox-cloud"
|
||||
const val SOURCE_STEAM = "steam"
|
||||
const val SOURCE_COLLECTION = "collection"
|
||||
|
||||
@@ -111,7 +111,7 @@ object FrameGen {
|
||||
if (status != LsfgNative.STATUS_OK || cachePath == null) {
|
||||
WaylandCompositor.nativeSetFrameGenArmed(false, 0, 0)
|
||||
val problem = context.getString(
|
||||
if (status == LsfgNative.STATUS_NOT_INSTALLED) R.string.lsfg_problem_missing else R.string.lsfg_problem_failed,
|
||||
if (status == LsfgNative.STATUS_NOT_INSTALLED) R.string.lsfg_needs_steam else R.string.lsfg_problem_failed,
|
||||
)
|
||||
Log.w(TAG, "$problem (status $status)")
|
||||
return problem
|
||||
|
||||
@@ -2,22 +2,16 @@ package com.droiddeck.launcher.gpu
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import com.droiddeck.launcher.session.GameStorage
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import java.io.File
|
||||
import java.security.DigestOutputStream
|
||||
import java.security.MessageDigest
|
||||
|
||||
object Lossless {
|
||||
enum class Source { NONE, STEAM, IMPORT }
|
||||
|
||||
enum class ImportResult { UPDATED, UNCHANGED, NOT_OWNED, INVALID, FAILED }
|
||||
|
||||
data class State(val owned: Boolean, val ready: Boolean, val source: Source) {
|
||||
data class State(val owned: Boolean, val ready: Boolean) {
|
||||
companion object {
|
||||
val NONE = State(owned = false, ready = false, source = Source.NONE)
|
||||
val NONE = State(owned = false, ready = false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,15 +20,13 @@ object Lossless {
|
||||
private const val KEY_OWNED = "owned"
|
||||
private const val KEY_ID = "id"
|
||||
private const val KEY_SOURCE = "source"
|
||||
private const val SOURCE_STEAM = "STEAM"
|
||||
private const val KEY_STEAM_STAMP = "steamStamp"
|
||||
private const val STEAM_MANIFEST = "steamapps/appmanifest_993090.acf"
|
||||
private const val STEAM_DLL = "steamapps/common/Lossless Scaling/Lossless.dll"
|
||||
private const val UNCHANGED = -1
|
||||
|
||||
fun state(context: Context): State {
|
||||
val source = prefs(context).getString(KEY_SOURCE, null)
|
||||
?.let { name -> Source.entries.firstOrNull { it.name == name } } ?: Source.NONE
|
||||
return State(owned(context), cacheFile(context)?.isFile == true, source)
|
||||
}
|
||||
fun state(context: Context) = State(owned(context), cacheFile(context)?.isFile == true)
|
||||
|
||||
fun owned(context: Context): Boolean {
|
||||
if (prefs(context).getBoolean(KEY_OWNED, false)) return true
|
||||
@@ -43,61 +35,46 @@ object Lossless {
|
||||
return true
|
||||
}
|
||||
|
||||
fun cacheFile(context: Context): File? = prefs(context).getString(KEY_ID, null)?.let { cacheFor(context, it) }
|
||||
fun cacheFile(context: Context): File? = steamCacheId(context)?.let { cacheFor(context, it) }
|
||||
|
||||
private fun steamCacheId(context: Context): String? = prefs(context).let {
|
||||
if (it.getString(KEY_SOURCE, null) == SOURCE_STEAM) it.getString(KEY_ID, null) else null
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun sync(context: Context): Int {
|
||||
val settings = prefs(context)
|
||||
if (steamCacheId(context) == null && settings.contains(KEY_ID)) {
|
||||
settings.edit().remove(KEY_ID).remove(KEY_SOURCE).remove(KEY_STEAM_STAMP).apply()
|
||||
}
|
||||
val steam = steamDll(context)
|
||||
if (steam != null) {
|
||||
markOwned(context)
|
||||
val stamp = "${steam.length()}:${steam.lastModified()}"
|
||||
if (stamp != prefs(context).getString(KEY_STEAM_STAMP, null)) {
|
||||
val status = adopt(context, steam, Source.STEAM)
|
||||
if (stamp != settings.getString(KEY_STEAM_STAMP, null)) {
|
||||
val status = adoptSteamDll(context, steam)
|
||||
if (status != LsfgNative.STATUS_OK && status != UNCHANGED) {
|
||||
Log.w(TAG, "Steam copy $steam not taken: ${statusName(status)}")
|
||||
}
|
||||
prefs(context).edit().putString(KEY_STEAM_STAMP, stamp).apply()
|
||||
settings.edit().putString(KEY_STEAM_STAMP, stamp).apply()
|
||||
}
|
||||
}
|
||||
return ensureBuilt(context)
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun import(context: Context, dll: File): ImportResult {
|
||||
if (!owned(context)) return ImportResult.NOT_OWNED
|
||||
return when (adopt(context, dll, Source.IMPORT)) {
|
||||
UNCHANGED -> ImportResult.UNCHANGED
|
||||
LsfgNative.STATUS_OK -> ImportResult.UPDATED
|
||||
LsfgNative.STATUS_UNREADABLE_FILE, LsfgNative.STATUS_NOT_PORTABLE_EXECUTABLE,
|
||||
LsfgNative.STATUS_MISSING_SHADERS -> ImportResult.INVALID
|
||||
else -> ImportResult.FAILED
|
||||
}
|
||||
}
|
||||
|
||||
fun message(context: Context, result: ImportResult): String = context.getString(
|
||||
when (result) {
|
||||
ImportResult.UPDATED -> R.string.lsfg_imported
|
||||
ImportResult.UNCHANGED -> R.string.lsfg_import_unchanged
|
||||
ImportResult.NOT_OWNED -> R.string.lsfg_import_not_owned
|
||||
ImportResult.INVALID -> R.string.lsfg_import_invalid
|
||||
ImportResult.FAILED -> R.string.lsfg_import_failed
|
||||
},
|
||||
)
|
||||
|
||||
private fun ensureBuilt(context: Context): Int {
|
||||
val id = prefs(context).getString(KEY_ID, null) ?: return LsfgNative.STATUS_NOT_INSTALLED
|
||||
val cache = cacheFor(context, id)
|
||||
val cache = cacheFile(context) ?: return LsfgNative.STATUS_NOT_INSTALLED
|
||||
if (usable(cache)) return LsfgNative.STATUS_OK
|
||||
val dll = storedDll(context)
|
||||
if (!dll.isFile) return LsfgNative.STATUS_NOT_INSTALLED
|
||||
return build(dll, cache)
|
||||
}
|
||||
|
||||
private fun adopt(context: Context, source: File, from: Source): Int {
|
||||
private fun adoptSteamDll(context: Context, source: File): Int {
|
||||
val staged = File(dir(context).apply { mkdirs() }, "Lossless.dll.staged")
|
||||
try {
|
||||
val id = copyHashing(source, staged)
|
||||
if (id == prefs(context).getString(KEY_ID, null) && usable(cacheFor(context, id))) return UNCHANGED
|
||||
if (id == steamCacheId(context) && usable(cacheFor(context, id))) return UNCHANGED
|
||||
val cache = cacheFor(context, id)
|
||||
var status = LsfgNative.nativeValidateDll(staged.path)
|
||||
if (status == LsfgNative.STATUS_OK) status = build(staged, cache)
|
||||
@@ -109,9 +86,9 @@ object Lossless {
|
||||
cache.delete()
|
||||
return LsfgNative.STATUS_CACHE_UNUSABLE
|
||||
}
|
||||
prefs(context).edit().putString(KEY_ID, id).putString(KEY_SOURCE, from.name).apply()
|
||||
prefs(context).edit().putString(KEY_ID, id).putString(KEY_SOURCE, SOURCE_STEAM).apply()
|
||||
removeStale(context, id)
|
||||
Log.i(TAG, "Lossless.dll from $source ($from) ready as $id")
|
||||
Log.i(TAG, "Steam Lossless.dll from $source ready as $id")
|
||||
return LsfgNative.STATUS_OK
|
||||
} catch (e: java.io.IOException) {
|
||||
Log.w(TAG, "could not copy $source", e)
|
||||
@@ -158,9 +135,13 @@ object Lossless {
|
||||
GameStorage.effective(context)?.path?.let(::File),
|
||||
GameStorage.x64CardLibrary(context),
|
||||
) + com.droiddeck.launcher.frontend.AddedGames.roots(context).map { it.host }
|
||||
return libraries.map { File(it, STEAM_DLL) }.filter { it.isFile }.maxByOrNull { it.lastModified() }
|
||||
return installedSteamDll(libraries)
|
||||
}
|
||||
|
||||
internal fun installedSteamDll(libraries: List<File>): File? =
|
||||
libraries.asSequence().filter { File(it, STEAM_MANIFEST).isFile }
|
||||
.map { File(it, STEAM_DLL) }.filter { it.isFile }.maxByOrNull { it.lastModified() }
|
||||
|
||||
private fun markOwned(context: Context) {
|
||||
if (!prefs(context).getBoolean(KEY_OWNED, false)) prefs(context).edit().putBoolean(KEY_OWNED, true).apply()
|
||||
}
|
||||
|
||||
@@ -46,7 +46,14 @@ internal class ControllerPortraitGeometry(
|
||||
}
|
||||
row(shoulders, top + pad + buttonHeight / 2f, buttonHeight, 4f * unit)
|
||||
var bodyTop = top + pad + buttonHeight + gap
|
||||
if (presented.any { it.control in REAR && isStock(it) }) {
|
||||
if (presented.any { it.control in REAR && isStock(it) } && docked) {
|
||||
val chipHeight = 36f * unit
|
||||
val cell = (w - 2f * pad - 5f * gap) / 6f
|
||||
listOf(0, 1, 4, 5).zip(REAR).forEach { (index, control) ->
|
||||
put(control, Box(safe.left + pad + cell / 2f + index * (cell + gap), bodyTop + chipHeight / 2f, cell, chipHeight))
|
||||
}
|
||||
bodyTop += chipHeight + gap
|
||||
} else if (presented.any { it.control in REAR && isStock(it) }) {
|
||||
val rearHeight = min(56f * unit, (panel - bodyTop + top) * .12f).coerceAtLeast(buttonHeight)
|
||||
row(REAR, bodyTop + rearHeight / 2f, rearHeight, gap)
|
||||
bodyTop += rearHeight + gap
|
||||
|
||||
@@ -36,6 +36,13 @@ object OnScreenLayout {
|
||||
fun elements(context: Context, saved: SavedInputLayout?, width: Int, height: Int, safe: Rect,
|
||||
buttonsOnly: Boolean = false, dock: Dock? = null, rearButtons: Boolean? = null,
|
||||
trackpads: Boolean? = null): List<InputSurfaceElement> {
|
||||
val placed = placeElements(context, saved, width, height, safe, buttonsOnly, dock, rearButtons, trackpads)
|
||||
// Below the game a stick covers nothing, so it keeps its base in view instead of appearing only under the thumb.
|
||||
return if (dock == null) placed else placed.map { if (it.kind == InputElementKind.STICK) it.copy(hideWhenIdle = false) else it }
|
||||
}
|
||||
|
||||
private fun placeElements(context: Context, saved: SavedInputLayout?, width: Int, height: Int, safe: Rect,
|
||||
buttonsOnly: Boolean, dock: Dock?, rearButtons: Boolean?, trackpads: Boolean?): List<InputSurfaceElement> {
|
||||
if (saved == null) return emptyList()
|
||||
if (width <= 0 || height <= 0) return saved.elements
|
||||
val layout = oriented(saved, dock?.portrait ?: (height > width))
|
||||
|
||||
@@ -128,36 +128,20 @@ object BattleNet {
|
||||
return Art(first("p.jpg", BLIZZARD_COVER, OLD_BLIZZARD_COVER), first(BLIZZARD, OLD_BLIZZARD, "header.jpg"))
|
||||
}
|
||||
|
||||
fun prefix(context: Context) = File(LinuxRuntime.rootDir(context), "root/.local/share/Steam/steamapps/compatdata/$APP_ID")
|
||||
val CLIENT = WindowsClient(
|
||||
com.droiddeck.launcher.stores.Store.BATTLENET, APP_ID,
|
||||
"https://downloader.battle.net/download/getInstallerForGame?os=win&gameProgram=BATTLENET_APP&version=Live",
|
||||
"root/.cache/droiddeck/battlenet/Battle.net-Setup.exe",
|
||||
"Program Files (x86)/Battle.net/Battle.net Launcher.exe",
|
||||
"Program Files (x86)/Battle.net/Battle.net.exe",
|
||||
com.droiddeck.launcher.frontend.Library.BATTLENET_LAUNCHER, com.droiddeck.launcher.R.string.bnet_name,
|
||||
)
|
||||
|
||||
fun prefix(context: Context) = CLIENT.prefix(context)
|
||||
|
||||
fun client(context: Context) = File(prefix(context), "pfx/drive_c/Program Files (x86)/Battle.net/Battle.net.exe")
|
||||
|
||||
fun installed(context: Context) = File(prefix(context), "pfx/drive_c/Program Files (x86)/Battle.net/Battle.net Launcher.exe").isFile
|
||||
|
||||
fun profile(context: Context): Pair<String, String>? =
|
||||
(APP_ID.toString() to context.getString(com.droiddeck.launcher.R.string.bnet_name)).takeIf { installed(context) }
|
||||
|
||||
fun icon(context: Context): File? {
|
||||
val out = File(context.filesDir, "battlenet-art/launcher/icon.png")
|
||||
if (out.isFile) return out
|
||||
val exe = client(context).takeIf { it.isFile } ?: return null
|
||||
val bitmap = runCatching { com.droiddeck.launcher.files.PeIconExtractor.extract(exe) }.getOrNull() ?: return null
|
||||
return runCatching {
|
||||
out.parentFile?.mkdirs()
|
||||
val tmp = File(out.path + ".tmp")
|
||||
tmp.outputStream().use { check(bitmap.compress(android.graphics.Bitmap.CompressFormat.PNG, 100, it)) }
|
||||
check(tmp.renameTo(out))
|
||||
out
|
||||
}.getOrNull()
|
||||
}
|
||||
|
||||
fun launcherEntry(installed: Boolean, art: File? = null): com.droiddeck.launcher.frontend.Library.SteamGame? =
|
||||
if (!installed) null
|
||||
else com.droiddeck.launcher.frontend.Library.SteamGame(
|
||||
appId = APP_ID.toInt(), name = com.droiddeck.launcher.stores.Store.BATTLENET.label, art = art,
|
||||
library = com.droiddeck.launcher.frontend.Library.BATTLENET_LAUNCHER, gameId = APP_ID,
|
||||
source = com.droiddeck.launcher.stores.Store.BATTLENET.id,
|
||||
)
|
||||
fun installed(context: Context) = CLIENT.installed(context)
|
||||
|
||||
internal fun title(uid: String): Title? {
|
||||
val id = uid.lowercase()
|
||||
|
||||
@@ -0,0 +1,271 @@
|
||||
package com.droiddeck.launcher.runtime
|
||||
|
||||
import android.content.Context
|
||||
import android.os.SystemClock
|
||||
import android.system.Os
|
||||
import android.system.OsConstants
|
||||
import android.util.Log
|
||||
import com.droiddeck.launcher.wayland.WaylandCompositor
|
||||
import java.io.File
|
||||
import java.io.InputStream
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.LinkOption.NOFOLLOW_LINKS
|
||||
import java.security.MessageDigest
|
||||
|
||||
/** One app-issued Steam session and one attested Gamescope worker. This is not an
|
||||
* isolation boundary against arbitrary code already running as the Android app UID. */
|
||||
internal object FrameAcquireWorkerProbe {
|
||||
private const val SESSION_SCRIPT = "/usr/local/bin/droiddeck-session"
|
||||
private const val PATH = "/usr/local/bin/gamescope"
|
||||
private const val CAPABILITY = "linuxfs/usr/local/share/droiddeck/gamescope-producer-acquire-v1"
|
||||
internal const val GAMESCOPE_ENABLE = "GAMESCOPE_DROIDDECK_PRODUCER_ACQUIRE=1"
|
||||
internal const val GAME_ENABLE = "DROIDDECK_GAME_DROIDDECK_GAME_FRAME_ACQUIRE=1"
|
||||
private const val MAX_BINARY_BYTES = 32L * 1024L * 1024L
|
||||
internal const val RECEIPT_TAG = 0x44445046
|
||||
internal const val RECEIPT_BYTES = Int.SIZE_BYTES + Long.SIZE_BYTES
|
||||
private const val TTL_MS = 90_000L
|
||||
|
||||
internal data class Ticket(
|
||||
val owner: Int, val root: File, val configuredRoot: File, val binary: File,
|
||||
val expected: ByteArray, val expires: Long, val steamGameUrl: String?,
|
||||
)
|
||||
internal data class Qualified(val ticket: Ticket, val dev: Long, val ino: Long, val mtime: Long, val ctime: Long)
|
||||
private var intent: Ticket? = null
|
||||
private var nativeOwner = 0
|
||||
private var nativePid = 0
|
||||
|
||||
private enum class Stage { ARM, MATCH, PUBLISH }
|
||||
private enum class Reason {
|
||||
ENABLED, MATCH_ACK, MATCH_OWNER, MATCH_EXPIRED, MATCH_PATH, MATCH_ROOT,
|
||||
MATCH_ARGV, MATCH_FILE, MATCH_DIGEST, QUALIFIED, PUBLISH_TICKET, PUBLISH_RESTAT,
|
||||
PUBLISH_NATIVE, PUBLISH_RECEIPT, RESERVED
|
||||
}
|
||||
private val reported = mutableSetOf<Stage>()
|
||||
@Synchronized private fun breadcrumb(stage: Stage, reason: Reason) {
|
||||
if (reported.add(stage)) Log.i("FrameAcquireWorkerProbe", "worker_admission=" + reason.name)
|
||||
}
|
||||
|
||||
internal fun validEnvironment(agentEnvironment: List<String>, customEnvironment: List<String>): Boolean {
|
||||
// AgentEnv supplies a replacement PATH whenever any executable override is staged.
|
||||
// Custom env is user-editable, including names not known to this build; it is not a trust root.
|
||||
return agentEnvironment.isEmpty() && customEnvironment.isEmpty()
|
||||
}
|
||||
|
||||
fun available(context: Context): Boolean =
|
||||
android.os.Build.VERSION.SDK_INT >= 30 && com.droiddeck.launcher.core.DeviceSupport.adreno() &&
|
||||
runCatching { context.assets.open(CAPABILITY).use { it.readBytes().decodeToString() } }
|
||||
.getOrNull() == "droiddeck-producer-acquire-v1\n"
|
||||
|
||||
private fun digest(input: InputStream, maxBytes: Long): ByteArray {
|
||||
val out = MessageDigest.getInstance("SHA-256")
|
||||
val buffer = ByteArray(64 * 1024)
|
||||
var size = 0L
|
||||
while (true) {
|
||||
val n = input.read(buffer)
|
||||
if (n == -1) break
|
||||
require(n > 0)
|
||||
size += n
|
||||
require(size <= maxBytes)
|
||||
out.update(buffer, 0, n)
|
||||
}
|
||||
require(size > 0)
|
||||
return out.digest()
|
||||
}
|
||||
|
||||
// Compute asset identity outside SessionService's stop lock and before a worker
|
||||
// exists. The resulting ticket still has to be assigned to that exact owner.
|
||||
private const val STEAM_RUN_PREFIX = "steam://rungameid/"
|
||||
|
||||
internal fun permittedLaunch(url: String?, frontendGame: Boolean): Boolean =
|
||||
if (url == null) !frontendGame else frontendGame && url.startsWith(STEAM_RUN_PREFIX) &&
|
||||
com.droiddeck.launcher.frontend.GameLaunchLink.validId(url.removePrefix(STEAM_RUN_PREFIX))
|
||||
|
||||
internal fun prepare(context: Context, steamGameUrl: String?, frontendGame: Boolean): Ticket? {
|
||||
if (!permittedLaunch(steamGameUrl, frontendGame) ||
|
||||
!available(context) || !WaylandCompositor.frameWorkerProbeEnabled()) return null
|
||||
return runCatching {
|
||||
val configuredRoot = LinuxRuntime.rootDir(context).absoluteFile
|
||||
val root = configuredRoot.canonicalFile
|
||||
val file = File(root.path + PATH)
|
||||
require(file.canonicalFile == file && Files.isRegularFile(file.toPath(), NOFOLLOW_LINKS))
|
||||
val script = File(root.path + SESSION_SCRIPT)
|
||||
require(exactSteamScript(SESSION_SCRIPT, root, configuredRoot))
|
||||
val stagedScript = script.inputStream().use { digest(it, 1024L * 1024L) }
|
||||
val signedScript = context.assets.open("linuxfs" + SESSION_SCRIPT).use { digest(it, 1024L * 1024L) }
|
||||
require(MessageDigest.isEqual(stagedScript, signedScript))
|
||||
val expected = context.assets.open("linuxfs" + PATH).use { digest(it, MAX_BINARY_BYTES) }
|
||||
Ticket(0, root, configuredRoot, file, expected, SystemClock.elapsedRealtime() + TTL_MS, steamGameUrl)
|
||||
}.getOrNull()
|
||||
}
|
||||
|
||||
@Synchronized fun arm(owner: Int, prepared: Ticket): Boolean {
|
||||
if (owner <= 0 || SystemClock.elapsedRealtime() >= prepared.expires) return false
|
||||
reported.clear()
|
||||
intent = prepared.copy(owner = owner)
|
||||
breadcrumb(Stage.ARM, Reason.ENABLED)
|
||||
return true
|
||||
}
|
||||
|
||||
/** Native shebang handling can give Bash the staged host filename as its $0. */
|
||||
internal fun exactSteamScript(token: String, root: File, configuredRoot: File): Boolean {
|
||||
if (token != SESSION_SCRIPT && token != root.path + SESSION_SCRIPT &&
|
||||
token != configuredRoot.path + SESSION_SCRIPT) return false
|
||||
return runCatching {
|
||||
val expected = File(root.path + SESSION_SCRIPT)
|
||||
val supplied = if (token == SESSION_SCRIPT) expected else File(token)
|
||||
// Reject symlinks within the authorized root, including a symlink replacing the script.
|
||||
// Android's configured root itself may be an alias of its app-issued canonical root.
|
||||
require(configuredRoot.canonicalFile == root && expected.canonicalFile == expected &&
|
||||
supplied.canonicalFile == expected &&
|
||||
Files.isRegularFile(expected.toPath(), NOFOLLOW_LINKS) &&
|
||||
Files.isRegularFile(supplied.toPath(), NOFOLLOW_LINKS))
|
||||
Files.isSameFile(supplied.toPath(), expected.toPath())
|
||||
}.getOrDefault(false)
|
||||
}
|
||||
|
||||
internal fun exactGamescopeArgs(
|
||||
argv: List<String>, steamGameUrl: String? = null, script: (String) -> Boolean,
|
||||
): Boolean {
|
||||
if (argv.firstOrNull() !in listOf("gamescope", PATH)) return false
|
||||
val delimiter = argv.indexOf("--")
|
||||
val tailSize = if (steamGameUrl == null) 3 else 4
|
||||
if (delimiter < 4 || argv.size != delimiter + tailSize || argv[delimiter + 2] != "steam" ||
|
||||
!script(argv[delimiter + 1]) ||
|
||||
(steamGameUrl != null && (!permittedLaunch(steamGameUrl, true) || argv.last() != steamGameUrl))) return false
|
||||
val opts = argv.subList(1, delimiter)
|
||||
if (opts.take(4) != listOf("--backend", "wayland", "--expose-wayland", "-f")) return false
|
||||
val dimensions = setOf("-W", "-H", "-w", "-h")
|
||||
val seen = mutableSetOf<String>()
|
||||
var i = 4
|
||||
while (i < opts.size) {
|
||||
val option = opts[i++]
|
||||
if (!seen.add(option)) return false
|
||||
when (option) {
|
||||
"-e", "--hdr-enabled", "--mangoapp" -> Unit
|
||||
"-S" -> if (opts.getOrNull(i++) != "stretch") return false
|
||||
"--default-touch-mode" -> if (opts.getOrNull(i++) != "4") return false
|
||||
"-W", "-H", "-w", "-h", "-r", "--xwayland-count" -> {
|
||||
val value = opts.getOrNull(i++) ?: return false
|
||||
if (value.length !in 1..6 || value.any { it !in '0'..'9' } ||
|
||||
value.toIntOrNull()?.let { it > 0 } != true) return false
|
||||
}
|
||||
else -> return false
|
||||
}
|
||||
}
|
||||
return seen.containsAll(dimensions)
|
||||
}
|
||||
|
||||
fun match(owner: Int, root: File, file: String, argv: List<String>, ack: Boolean): Qualified? {
|
||||
val t = synchronized(this) { intent } ?: return null
|
||||
// Startup's --version worker and unrelated workers must not consume the one diagnostic.
|
||||
val candidate = "--version" !in argv && (file.substringAfterLast('/') == "gamescope" ||
|
||||
argv.firstOrNull()?.substringAfterLast('/') == "gamescope")
|
||||
val rejection = when {
|
||||
!ack -> Reason.MATCH_ACK
|
||||
t.owner != owner -> Reason.MATCH_OWNER
|
||||
SystemClock.elapsedRealtime() >= t.expires -> Reason.MATCH_EXPIRED
|
||||
file != PATH -> Reason.MATCH_PATH
|
||||
runCatching { root.canonicalFile }.getOrNull() != t.root -> Reason.MATCH_ROOT
|
||||
!exactGamescopeArgs(argv, t.steamGameUrl) { exactSteamScript(it, t.root, t.configuredRoot) } -> Reason.MATCH_ARGV
|
||||
else -> null
|
||||
}
|
||||
if (rejection != null) {
|
||||
if (candidate) breadcrumb(Stage.MATCH, rejection)
|
||||
return null
|
||||
}
|
||||
// Hash an actual descriptor rather than two pathname opens. Check both the
|
||||
// descriptor and pathname identity; a race or substituted executable denies the grant.
|
||||
val qualified = runCatching {
|
||||
require(t.binary.canonicalFile == t.binary)
|
||||
val before = Os.lstat(t.binary.path)
|
||||
require(OsConstants.S_ISREG(before.st_mode) && before.st_size in 1..MAX_BINARY_BYTES)
|
||||
val fd = Os.open(t.binary.path, OsConstants.O_RDONLY or OsConstants.O_NOFOLLOW or OsConstants.O_CLOEXEC, 0)
|
||||
val sum = try {
|
||||
require(stillSame(before, Os.fstat(fd)))
|
||||
android.os.ParcelFileDescriptor.AutoCloseInputStream(android.os.ParcelFileDescriptor.dup(fd)).use {
|
||||
digest(it, MAX_BINARY_BYTES)
|
||||
}.also { require(stillSame(before, Os.fstat(fd))) }
|
||||
} finally {
|
||||
Os.close(fd)
|
||||
}
|
||||
val after = Os.lstat(t.binary.path)
|
||||
require(stillSame(before, after))
|
||||
if (!MessageDigest.isEqual(sum, t.expected)) {
|
||||
breadcrumb(Stage.MATCH, Reason.MATCH_DIGEST)
|
||||
return null
|
||||
}
|
||||
Qualified(t, after.st_dev, after.st_ino, after.st_mtime, after.st_ctime)
|
||||
}.getOrNull()
|
||||
breadcrumb(Stage.MATCH, if (qualified == null) Reason.MATCH_FILE else Reason.QUALIFIED)
|
||||
return qualified
|
||||
}
|
||||
|
||||
private fun stillSame(a: android.system.StructStat, b: android.system.StructStat): Boolean =
|
||||
a.st_dev == b.st_dev && a.st_ino == b.st_ino && a.st_size == b.st_size &&
|
||||
a.st_mtime == b.st_mtime && a.st_ctime == b.st_ctime &&
|
||||
OsConstants.S_ISREG(b.st_mode)
|
||||
|
||||
internal fun validReceipt(pid: Int, workerPid: Int, ticks: Long, bytes: Int): Long =
|
||||
if (pid > 1 && pid == workerPid && ticks > 0 && bytes == RECEIPT_BYTES) ticks else 0L
|
||||
|
||||
internal fun parseSelfStat(stat: String, pid: Int): Long {
|
||||
if (pid <= 1 || !stat.startsWith("$pid (")) return 0L
|
||||
val comm = stat.lastIndexOf(')')
|
||||
if (comm < 3 || stat.getOrNull(comm + 1) != ' ') return 0L
|
||||
val fields = stat.substring(comm + 2).split(' ').filter { it.isNotEmpty() }
|
||||
if (fields.firstOrNull()?.length != 1 || fields.size < 21) return 0L
|
||||
val value = fields[19] // field 22 from field 3 (the single-character task state).
|
||||
return value.takeIf { it.isNotEmpty() && it.all { ch -> ch in '0'..'9' } }
|
||||
?.toLongOrNull()?.takeIf { it > 0 } ?: 0L
|
||||
}
|
||||
|
||||
internal fun selfStartTicks(pid: Int): Long = runCatching {
|
||||
File("/proc/self/stat").inputStream().use { input ->
|
||||
val bytes = ByteArray(4096)
|
||||
var used = 0
|
||||
while (used < bytes.size) {
|
||||
val n = input.read(bytes, used, bytes.size - used)
|
||||
if (n < 0) break
|
||||
if (n == 0) return@runCatching 0L
|
||||
used += n
|
||||
}
|
||||
if (used == bytes.size || used == 0 || bytes[used-1] != '\n'.code.toByte()) 0L
|
||||
else parseSelfStat(String(bytes, 0, used, Charsets.US_ASCII), pid)
|
||||
}
|
||||
}.getOrDefault(0L)
|
||||
|
||||
/** Runs just before the final GO byte. Failure never changes ordinary launch. */
|
||||
@Synchronized fun publish(q: Qualified, pid: Int, startTicks: Long) {
|
||||
val t = q.ticket
|
||||
if (intent !== t || pid <= 1 || SystemClock.elapsedRealtime() >= t.expires) {
|
||||
if (intent === t) breadcrumb(Stage.PUBLISH, Reason.PUBLISH_TICKET)
|
||||
return
|
||||
}
|
||||
intent = null // At most one candidate per explicitly armed session.
|
||||
if (startTicks <= 0L) {
|
||||
breadcrumb(Stage.PUBLISH, Reason.PUBLISH_RECEIPT)
|
||||
return
|
||||
}
|
||||
val status = runCatching {
|
||||
val st = Os.lstat(t.binary.path)
|
||||
require(OsConstants.S_ISREG(st.st_mode) && st.st_dev == q.dev && st.st_ino == q.ino &&
|
||||
st.st_mtime == q.mtime && st.st_ctime == q.ctime)
|
||||
if (WaylandCompositor.frameWorkerProbeGrant(t.owner, pid, t.expires, t.binary.path, st.st_dev, st.st_ino, startTicks)) {
|
||||
nativeOwner = t.owner
|
||||
nativePid = pid
|
||||
Reason.RESERVED
|
||||
} else Reason.PUBLISH_NATIVE
|
||||
}.getOrDefault(Reason.PUBLISH_RESTAT)
|
||||
breadcrumb(Stage.PUBLISH, status)
|
||||
}
|
||||
|
||||
@Synchronized fun revoke(owner: Int, pid: Int = 0) {
|
||||
if (owner <= 0) return
|
||||
if (pid == 0 && intent?.owner == owner) intent = null
|
||||
if (nativeOwner == owner && (pid == 0 || pid == nativePid)) {
|
||||
WaylandCompositor.frameWorkerProbeRevoke(owner, pid)
|
||||
nativeOwner = 0
|
||||
nativePid = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,16 @@ open class GuestWorker : Service() {
|
||||
val fillBinderFd = data.readInt() != 0
|
||||
val go = data.readFileDescriptor()
|
||||
val nice = data.readInt()
|
||||
reply?.writeInt(Process.myPid())
|
||||
val pid = Process.myPid()
|
||||
reply?.writeInt(pid)
|
||||
// Optional fixed-size receipt, on the exact local, non-exported worker's Binder.
|
||||
// Nothing in the guest socket request populates these fields.
|
||||
if (reply != null &&
|
||||
Binder.getCallingUid() == Process.myUid() &&
|
||||
data.dataAvail() == Int.SIZE_BYTES && data.readInt() == FrameAcquireWorkerProbe.RECEIPT_TAG) {
|
||||
reply.writeInt(pid)
|
||||
reply.writeLong(FrameAcquireWorkerProbe.selfStartTicks(pid))
|
||||
}
|
||||
Handler(Looper.getMainLooper()).post {
|
||||
// The app writes a byte once it has the reply and has taken the launch on: an exec
|
||||
// before then would end this process with the reply undelivered, and with none (the
|
||||
@@ -395,9 +404,10 @@ object GuestWorkers {
|
||||
private set
|
||||
|
||||
/** Whether the session runs its programs in workers: the native userland, and not turned off. */
|
||||
fun enabled(context: Context): Boolean =
|
||||
android.os.Build.VERSION.SDK_INT >= 30 && com.droiddeck.launcher.session.SessionPrefs.childProcessHandoff(context) &&
|
||||
NativeGuest.enabled(context)
|
||||
fun enabled(context: Context): Boolean = handoffAllowed(context) && NativeGuest.enabled(context)
|
||||
|
||||
private fun handoffAllowed(context: Context): Boolean =
|
||||
android.os.Build.VERSION.SDK_INT >= 30 && com.droiddeck.launcher.session.SessionPrefs.childProcessHandoff(context)
|
||||
|
||||
/** How the running session's root was started: in a worker (true) or counted (false); null with none running. */
|
||||
@Volatile var sessionRootUncounted: Boolean? = null
|
||||
@@ -408,7 +418,7 @@ object GuestWorkers {
|
||||
* the next one would start.
|
||||
*/
|
||||
fun limitHandled(context: Context): Boolean =
|
||||
sessionRootUncounted ?: (NativeGuest.sessionMode != false && enabled(context))
|
||||
sessionRootUncounted ?: (NativeGuest.sessionMode != false && handoffAllowed(context) && NativeGuest.nextSession(context))
|
||||
|
||||
/** Whether pid is a program running in one of the workers. */
|
||||
fun runsInWorker(pid: Int): Boolean = pid > 0 && synchronized(slots) { slots.any { it != null && it.started && it.pid == pid } }
|
||||
@@ -436,7 +446,8 @@ object GuestWorkers {
|
||||
private fun start(context: Context, argv: List<String>, env: List<String>, fds: List<ParcelFileDescriptor>, targets: IntArray,
|
||||
guest: Boolean, onExit: (Int) -> Unit, commit: (Int) -> Boolean = { true },
|
||||
confirmed: () -> Boolean = { true }, owner: Int = session,
|
||||
nice: Int = Process.getThreadPriority(Process.myTid())): Int {
|
||||
nice: Int = Process.getThreadPriority(Process.myTid()),
|
||||
testWorker: FrameAcquireWorkerProbe.Qualified? = null): Int {
|
||||
val app = context.applicationContext
|
||||
if (guest && owner <= stopped) {
|
||||
Log.w(TAG, (if (owner == 0) "a request naming no session" else "session $owner is stopping") +
|
||||
@@ -472,13 +483,21 @@ object GuestWorkers {
|
||||
data.writeInt(if (guest) 0 else 1)
|
||||
data.writeFileDescriptor(go[0].fileDescriptor)
|
||||
data.writeInt(nice)
|
||||
slot.service!!.transact(GuestWorker.RUN, data, reply, 0)
|
||||
val service = checkNotNull(slot.service)
|
||||
if (testWorker != null) data.writeInt(FrameAcquireWorkerProbe.RECEIPT_TAG)
|
||||
check(service.transact(GuestWorker.RUN, data, reply, 0))
|
||||
// The worker has its own copy: with ours closed (and the request's, which holds one too),
|
||||
// a worker that gave up leaves no reader
|
||||
data.recycle()
|
||||
data = null
|
||||
go[0].close()
|
||||
val pid = reply.readInt()
|
||||
val startTicks = if (testWorker != null) {
|
||||
val size = reply.dataAvail()
|
||||
if (size == FrameAcquireWorkerProbe.RECEIPT_BYTES)
|
||||
FrameAcquireWorkerProbe.validReceipt(pid, reply.readInt(), reply.readLong(), size)
|
||||
else 0L
|
||||
} else 0L
|
||||
// Once a session's teardown has begun (stopGuests), none of its programs may start: it
|
||||
// would not find them.
|
||||
val stopping = { guest && owner <= stopped }
|
||||
@@ -507,7 +526,12 @@ object GuestWorkers {
|
||||
// launching slot), or never.
|
||||
val answered = Os.poll(arrayOf(answer), ANSWER_TIMEOUT_MS) > 0 && Os.read(go[1].fileDescriptor, ByteArray(1), 0, 1) == 1
|
||||
val accepted = answered && synchronized(authorizing) {
|
||||
!stopping() && confirmed() && Os.write(go[1].fileDescriptor, byteArrayOf(1), 0, 1) == 1
|
||||
if (stopping() || !confirmed()) false
|
||||
else {
|
||||
if (testWorker != null) FrameAcquireWorkerProbe.publish(testWorker, pid,
|
||||
if (slot.service === service) startTicks else 0L)
|
||||
Os.write(go[1].fileDescriptor, byteArrayOf(1), 0, 1) == 1
|
||||
}
|
||||
}
|
||||
val endedRunning = synchronized(slots) {
|
||||
slot.launching = false
|
||||
@@ -684,6 +708,7 @@ object GuestWorkers {
|
||||
}
|
||||
}
|
||||
context?.let { app -> drained.forEach { release(app, it) } }
|
||||
FrameAcquireWorkerProbe.revoke(of)
|
||||
val pids = guestPids(of)
|
||||
if (pids.isEmpty()) return
|
||||
pids.forEach { Process.sendSignal(it, OsConstants.SIGTERM) }
|
||||
@@ -901,16 +926,19 @@ object GuestWorkers {
|
||||
val owner = request.optInt("session", 0).coerceAtLeast(0)
|
||||
// The sender is the forked child (or droiddeck-spawn): its priority is the one the program would inherit
|
||||
val nice = runCatching { Process.getThreadPriority(client.peerCredentials.pid) }.getOrDefault(Process.THREAD_PRIORITY_DEFAULT)
|
||||
val testWorker = FrameAcquireWorkerProbe.match(owner, root, file, argv, ack)
|
||||
val pid = start(app, command, env.map { (k, v) -> "$k=$v" }, programFds, targets, true, owner = owner, nice = nice, onExit = { code ->
|
||||
if (testWorker != null && worker > 1) FrameAcquireWorkerProbe.revoke(owner, worker)
|
||||
status = code
|
||||
if (table != null && slot >= 0) reportExit(table, slot, code, parent, child, worker)
|
||||
exited.countDown()
|
||||
}, confirmed = {
|
||||
!ack || runCatching {
|
||||
val confirmed = !ack || runCatching {
|
||||
out.write("ok\n".toByteArray())
|
||||
out.flush()
|
||||
confirmedToHook = true
|
||||
}.isSuccess
|
||||
confirmed
|
||||
}, commit = { started ->
|
||||
worker = started
|
||||
if (!ack) return@start true
|
||||
@@ -929,7 +957,8 @@ object GuestWorkers {
|
||||
}
|
||||
ended && line.toString() == "go"
|
||||
}.getOrDefault(false)
|
||||
})
|
||||
}, testWorker = testWorker)
|
||||
if (pid <= 0 && testWorker != null && worker > 1) FrameAcquireWorkerProbe.revoke(owner, worker)
|
||||
handedOver = true
|
||||
programFds.filter { it !== table }.forEach { runCatching { it.close() } }
|
||||
if (pid <= 0) table?.let { runCatching { it.close() } }
|
||||
|
||||
@@ -24,6 +24,16 @@ object NativeGuest {
|
||||
fun enabled(context: Context): Boolean =
|
||||
SessionPrefs.nativeUserland(context) && available(LinuxRuntime.rootDir(context))
|
||||
|
||||
/**
|
||||
* Whether the next session will start natively. The session stages the hook from the APK before
|
||||
* it starts, so only the setting and the rootfs's loader decide, and a runtime still to be
|
||||
* installed will have one.
|
||||
*/
|
||||
fun nextSession(context: Context): Boolean =
|
||||
SessionPrefs.nativeUserland(context) && willRun(LinuxRuntime.rootDir(context), LinuxRuntime.isInstalled(context))
|
||||
|
||||
internal fun willRun(root: File, installed: Boolean): Boolean = !installed || loader(root) != null
|
||||
|
||||
/** The mode the running session started in; null between sessions. */
|
||||
@Volatile var sessionMode: Boolean? = null
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.droiddeck.launcher.runtime
|
||||
|
||||
import android.content.Context
|
||||
import com.droiddeck.launcher.frontend.Library
|
||||
import com.droiddeck.launcher.session.NoSteamLaunch
|
||||
import com.droiddeck.launcher.stores.Store
|
||||
|
||||
object Nexon {
|
||||
const val APP_ID = 2201491781L
|
||||
|
||||
internal const val SETUP = "setup"
|
||||
|
||||
val CLIENT = WindowsClient(
|
||||
Store.NEXON, APP_ID,
|
||||
"https://download.nxfs.nexon.com/download-launcher?file=NexonLauncherSetup.exe",
|
||||
"root/.cache/droiddeck/nexon/NexonLauncherSetup.exe",
|
||||
"Program Files (x86)/Nexon/Nexon Launcher/nexon_launcher.exe",
|
||||
"Program Files (x86)/Nexon/Nexon Launcher/nexon_launcher.exe",
|
||||
Library.NEXON_LAUNCHER, com.droiddeck.launcher.R.string.nexon_name,
|
||||
)
|
||||
|
||||
fun entry(context: Context): Library.SteamGame? = when {
|
||||
CLIENT.installed(context) -> CLIENT.launcherEntry(true)
|
||||
WindowsClient.setupReady(CLIENT.setup(context)) -> Library.SteamGame(
|
||||
appId = APP_ID.toInt(), name = Store.NEXON.label, art = null, library = Library.NEXON_LAUNCHER,
|
||||
gameId = APP_ID, source = Store.NEXON.id, storeId = SETUP,
|
||||
)
|
||||
else -> null
|
||||
}
|
||||
|
||||
fun command(game: Library.SteamGame): NoSteamLaunch.Command {
|
||||
val exe = if (game.storeId == SETUP) CLIENT.guestSetup else CLIENT.guestLauncher
|
||||
return NoSteamLaunch.Command(
|
||||
NoSteamLaunch.PROTON_RUN,
|
||||
listOf("--app", APP_ID.toString(), "--dir", exe.substringBeforeLast('/'), "--", exe),
|
||||
game.name,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.droiddeck.launcher.runtime
|
||||
|
||||
import android.content.Context
|
||||
import com.droiddeck.launcher.frontend.Library
|
||||
import com.droiddeck.launcher.stores.Store
|
||||
import java.io.File
|
||||
|
||||
class WindowsClient(
|
||||
val store: Store,
|
||||
val appId: Long,
|
||||
val installerUrl: String,
|
||||
private val setupPath: String,
|
||||
private val launcherPath: String,
|
||||
private val iconPath: String,
|
||||
val library: String,
|
||||
val nameRes: Int,
|
||||
) {
|
||||
val downloadId: String get() = "${store.id}-client"
|
||||
val downloadKey: String get() = "${store.id}:$downloadId"
|
||||
|
||||
@Volatile var opener: ((List<String>) -> Unit)? = null
|
||||
|
||||
fun prefix(context: Context) = File(LinuxRuntime.rootDir(context), "$COMPATDATA/$appId")
|
||||
|
||||
fun launcher(context: Context) = File(prefix(context), "pfx/drive_c/$launcherPath")
|
||||
|
||||
fun installed(context: Context) = launcher(context).isFile
|
||||
|
||||
fun setup(context: Context) = File(LinuxRuntime.rootDir(context), setupPath)
|
||||
|
||||
private val guestPrefix: String get() = "/$COMPATDATA/$appId"
|
||||
|
||||
val guestLauncher: String get() = "$guestPrefix/pfx/drive_c/$launcherPath"
|
||||
|
||||
val guestSetup: String get() = "/$setupPath"
|
||||
|
||||
fun profile(context: Context): Pair<String, String>? =
|
||||
(appId.toString() to context.getString(nameRes)).takeIf { installed(context) }
|
||||
|
||||
fun launcherEntry(installed: Boolean): Library.SteamGame? =
|
||||
if (!installed) null
|
||||
else Library.SteamGame(appId = appId.toInt(), name = store.label, art = null, library = library, gameId = appId, source = store.id)
|
||||
|
||||
fun icon(context: Context): File? {
|
||||
val out = File(context.filesDir, "${store.id}-art/launcher/icon.png")
|
||||
if (out.isFile) return out
|
||||
val exe = File(prefix(context), "pfx/drive_c/$iconPath").takeIf { it.isFile } ?: return null
|
||||
val bitmap = runCatching { com.droiddeck.launcher.files.PeIconExtractor.extract(exe) }.getOrNull() ?: return null
|
||||
return runCatching {
|
||||
out.parentFile?.mkdirs()
|
||||
val tmp = File(out.path + ".tmp")
|
||||
tmp.outputStream().use { check(bitmap.compress(android.graphics.Bitmap.CompressFormat.PNG, 100, it)) }
|
||||
check(tmp.renameTo(out))
|
||||
out
|
||||
}.getOrNull()
|
||||
}
|
||||
|
||||
fun open(args: List<String> = emptyList()) {
|
||||
com.droiddeck.launcher.stores.StoresState.post { opener?.invoke(args) }
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val COMPATDATA = "root/.local/share/Steam/steamapps/compatdata"
|
||||
internal const val MIN_SETUP = 1L shl 20
|
||||
|
||||
val all: List<WindowsClient> get() = listOf(BattleNet.CLIENT, Nexon.CLIENT)
|
||||
|
||||
fun byLibrary(library: String): WindowsClient? = all.firstOrNull { it.library == library }
|
||||
|
||||
fun byStore(store: Store?): WindowsClient? = all.firstOrNull { it.store == store }
|
||||
|
||||
fun setupReady(file: File): Boolean = runCatching {
|
||||
file.length() >= MIN_SETUP && file.inputStream().use { input ->
|
||||
val head = ByteArray(2)
|
||||
input.read(head) == 2 && head[0] == 'M'.code.toByte() && head[1] == 'Z'.code.toByte()
|
||||
}
|
||||
}.getOrDefault(false)
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ object NoSteamLaunch {
|
||||
|
||||
fun scope(game: Library.SteamGame): String? = when {
|
||||
game.library == Library.EPIC_LAUNCHER -> EpicClient.shortcutAppId.toString()
|
||||
game.library == Library.BATTLENET_LAUNCHER -> com.droiddeck.launcher.runtime.BattleNet.APP_ID.toString()
|
||||
com.droiddeck.launcher.runtime.WindowsClient.byLibrary(game.library) != null -> com.droiddeck.launcher.runtime.WindowsClient.byLibrary(game.library)?.appId?.toString()
|
||||
game.library == Library.ADDED || game.appId > 0 -> game.profileKey
|
||||
else -> null
|
||||
}?.takeIf { it.isNotEmpty() && GameEnvironment.validScope(it) }
|
||||
@@ -56,6 +56,7 @@ object NoSteamLaunch {
|
||||
|
||||
fun command(game: Library.SteamGame, added: AddedGames.Game?): Command? = when {
|
||||
game.library == Library.EPIC_LAUNCHER -> Command(EPIC, listOf("run"), game.name)
|
||||
game.library == Library.NEXON_LAUNCHER -> com.droiddeck.launcher.runtime.Nexon.command(game)
|
||||
viaBattleNet(game) ->
|
||||
game.storeId?.let(com.droiddeck.launcher.runtime.BattleNet::title)?.let { Command(BATTLENET, listOf("launch", it.code), game.name) }
|
||||
game.library == Library.ADDED -> added?.let { a -> a.steamAppId?.let { Command(PROTON_RUN, listOf("--app", it.toString()), a.name) } ?: addedCommand(a) }
|
||||
|
||||
@@ -1874,6 +1874,13 @@ object SessionPrefs {
|
||||
prefs(context).edit().putBoolean(hdrKey(mode), on).apply()
|
||||
}
|
||||
|
||||
/** Restart-scoped opt-in; not inferred from Zero-copy (which defaults on). */
|
||||
fun producerAcquireFences(context: Context): Boolean = prefs(context).getBoolean("producerAcquireFences", false)
|
||||
|
||||
fun setProducerAcquireFences(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("producerAcquireFences", on).apply()
|
||||
}
|
||||
|
||||
fun zeroCopy(context: Context, mode: String): Boolean = prefs(context).getBoolean("zeroCopy.${prefMode(mode)}", true)
|
||||
|
||||
fun setZeroCopy(context: Context, mode: String, on: Boolean) {
|
||||
|
||||
@@ -394,8 +394,10 @@ class SessionService : Service() {
|
||||
SessionState.program = intent?.getStringExtra(EXTRA_PROGRAM)
|
||||
SessionState.programArgs = intent?.getStringArrayExtra(EXTRA_PROGRAM_ARGS)?.toList().orEmpty()
|
||||
SessionState.steamUi = intent?.getStringExtra(EXTRA_STEAM_UI)
|
||||
SessionState.steamUrl = intent?.getStringExtra(EXTRA_STEAM_URL)
|
||||
val steamUrlGameId = SessionState.steamUrl
|
||||
val launchSteamUrl = intent?.getStringExtra(EXTRA_STEAM_URL)
|
||||
val frontendSteamGame = intent?.getBooleanExtra(EXTRA_FRONTEND_STEAM_GAME, false) == true
|
||||
SessionState.steamUrl = launchSteamUrl
|
||||
val steamUrlGameId = launchSteamUrl
|
||||
?.let { url ->
|
||||
when {
|
||||
url.startsWith(GAME_URL_PREFIX) ->
|
||||
@@ -447,7 +449,7 @@ class SessionService : Service() {
|
||||
Thread({
|
||||
OrphanReaper.reap("session starting")
|
||||
ProtonExtras.awaitReplacement(120_000)
|
||||
runSession(gen)
|
||||
runSession(gen, launchSteamUrl, frontendSteamGame)
|
||||
}, "session-start").start()
|
||||
return START_NOT_STICKY
|
||||
}
|
||||
@@ -500,7 +502,7 @@ class SessionService : Service() {
|
||||
}
|
||||
|
||||
|
||||
private fun runSession(gen: Int) {
|
||||
private fun runSession(gen: Int, launchSteamUrl: String?, frontendSteamGame: Boolean) {
|
||||
SessionPrefs.ensurePowerVrAutoDriversAfterGpuQuery(this)
|
||||
if (!com.droiddeck.launcher.core.DeviceSupport.adreno()) {
|
||||
com.droiddeck.launcher.gpu.VulkanInfo.query()["api"]?.let { SessionPrefs.setHostVulkanApi(this, it) }
|
||||
@@ -555,9 +557,10 @@ class SessionService : Service() {
|
||||
return
|
||||
}
|
||||
}
|
||||
val agentEnvironment = runCatching { com.droiddeck.launcher.agent.AgentEnv.beginSession(this) }
|
||||
val nextAgentEnvironment = runCatching { com.droiddeck.launcher.agent.AgentEnv.beginSession(this) }
|
||||
.onFailure { Log.w(TAG, "agent environment skipped", it) }
|
||||
.getOrDefault(emptyList())
|
||||
val agentEnvironment = nextAgentEnvironment.getOrDefault(emptyList())
|
||||
val customEnvironment = extraEnv()
|
||||
try {
|
||||
if (systemVulkan) {
|
||||
SystemVulkanDriver.prepare(this)
|
||||
@@ -623,7 +626,7 @@ class SessionService : Service() {
|
||||
.onFailure { Log.w(TAG, "forced components", it) }
|
||||
}
|
||||
try {
|
||||
SessionEvents.step("client-environment") { addClientEnvironment(guest, steamHere, agentEnvironment) }
|
||||
SessionEvents.step("client-environment") { addClientEnvironment(guest, steamHere, agentEnvironment, customEnvironment) }
|
||||
} catch (e: IllegalStateException) {
|
||||
Log.e(TAG, "Could not resolve the selected Linux Vulkan driver", e)
|
||||
failSession(gen, "VULKAN_DRIVER_UNAVAILABLE", e.message ?: "Selected Linux Vulkan driver is unavailable", -1)
|
||||
@@ -708,15 +711,28 @@ class SessionService : Service() {
|
||||
// this session's worker number: the shared field may be a newer session's by the time it is used
|
||||
var ownWorkers = 0
|
||||
if (com.droiddeck.launcher.runtime.GuestWorkers.enabled(this)) {
|
||||
val fenceWorker = com.droiddeck.launcher.runtime.FrameAcquireWorkerProbe
|
||||
val preparedFence = if (steamHere && !systemVulkan && !VenusComponent.wanted(this) &&
|
||||
SessionPrefs.zeroCopy(this, MODE_STEAM) && SessionPrefs.producerAcquireFences(this) &&
|
||||
nextAgentEnvironment.isSuccess && fenceWorker.validEnvironment(agentEnvironment, customEnvironment)
|
||||
) fenceWorker.prepare(this, launchSteamUrl, frontendSteamGame) else null
|
||||
var fenceArmed = false
|
||||
// Under the lock a stop takes its number with: a stop either comes first (and this session
|
||||
// starts no workers) or owns them
|
||||
ownWorkers = synchronized(stopLock) {
|
||||
if (gen != sessionGen || !SessionState.running) 0
|
||||
else com.droiddeck.launcher.runtime.GuestWorkers.serve(this).also { guestWorkerSession = it }
|
||||
else com.droiddeck.launcher.runtime.GuestWorkers.serve(this).also {
|
||||
guestWorkerSession = it
|
||||
if (preparedFence != null) fenceArmed = fenceWorker.arm(it, preparedFence)
|
||||
}
|
||||
}
|
||||
if (ownWorkers > 0) {
|
||||
guest.add("DD_SPAWN=" + com.droiddeck.launcher.runtime.GuestWorkers.socketName(this))
|
||||
guest.add("DD_SPAWN_SESSION=$ownWorkers")
|
||||
if (fenceArmed) {
|
||||
guest.add(fenceWorker.GAMESCOPE_ENABLE)
|
||||
guest.add(fenceWorker.GAME_ENABLE)
|
||||
}
|
||||
}
|
||||
}
|
||||
// Proton builds up to 11.12 report X11 text fields under this name.
|
||||
@@ -738,7 +754,7 @@ class SessionService : Service() {
|
||||
val desktopGuest = ArrayList(guest)
|
||||
guest.add(LinuxRuntime.SESSION_SCRIPT)
|
||||
guest.add(SessionState.mode)
|
||||
if (SessionState.mode == MODE_STEAM) SessionState.steamUrl?.takeIf { it.startsWith("steam://") }?.let {
|
||||
if (SessionState.mode == MODE_STEAM) launchSteamUrl?.takeIf { it.startsWith("steam://") }?.let {
|
||||
guest.add(it)
|
||||
Log.i(TAG, "steam: handing the client $it")
|
||||
}
|
||||
@@ -1017,7 +1033,8 @@ class SessionService : Service() {
|
||||
return com.droiddeck.launcher.input.GesturePrefs.read(this, game).relativeMouseMode
|
||||
}
|
||||
|
||||
private fun addClientEnvironment(guest: MutableList<String>, steamHere: Boolean, agentEnvironment: List<String>) {
|
||||
private fun addClientEnvironment(guest: MutableList<String>, steamHere: Boolean,
|
||||
agentEnvironment: List<String>, customEnvironment: List<String>) {
|
||||
guest.add("/usr/bin/env")
|
||||
guest.add("-i")
|
||||
guest.add("DROIDDECK_BWRAP_SOCKET=" + com.droiddeck.launcher.runtime.BwrapSpawner.socket(this))
|
||||
@@ -1135,7 +1152,7 @@ class SessionService : Service() {
|
||||
guest.add("DD_ZRAM=1")
|
||||
}
|
||||
guest.add("AUDIO_DIRECT_DECAY=0")
|
||||
val extra = extraEnv() + agentEnvironment
|
||||
val extra = customEnvironment + agentEnvironment
|
||||
guest.addAll(TurnipEnvironment.gameEnvironment(tuOverride, tuDriver, SessionPrefs.tuSysmem(this), extra))
|
||||
if (extra.none { it.startsWith("MESA_NO_ERROR=") }) guest.add("${GAME_PREFIX}MESA_NO_ERROR=")
|
||||
extra.forEach { guest.add(it) }
|
||||
@@ -2755,6 +2772,9 @@ class SessionService : Service() {
|
||||
const val EXTRA_PROGRAM_ARGS = "programArgs"
|
||||
const val EXTRA_STEAM_UI = "steamUi"
|
||||
const val EXTRA_STEAM_URL = "steamUrl"
|
||||
// Set by the first-party Library play action on the private SessionActivity/Service path.
|
||||
// Never copied from an exported intent or Agent command.
|
||||
internal const val EXTRA_FRONTEND_STEAM_GAME = "com.droiddeck.launcher.FRONTEND_STEAM_GAME"
|
||||
const val EXTRA_GAME_ID = "gameId"
|
||||
|
||||
fun start(
|
||||
@@ -2762,6 +2782,7 @@ class SessionService : Service() {
|
||||
steamUi: String? = null, steamUrl: String? = null, programArgs: Array<String>? = null,
|
||||
gameId: String? = null,
|
||||
displayId: Int = Display.DEFAULT_DISPLAY,
|
||||
frontendSteamGame: Boolean = false,
|
||||
) {
|
||||
SteamClientPrefetch.cancel()
|
||||
SessionState.activityDisplayId = displayId
|
||||
@@ -2772,6 +2793,7 @@ class SessionService : Service() {
|
||||
if (programArgs != null) intent.putExtra(EXTRA_PROGRAM_ARGS, programArgs)
|
||||
if (steamUi != null) intent.putExtra(EXTRA_STEAM_UI, steamUi)
|
||||
if (steamUrl != null) intent.putExtra(EXTRA_STEAM_URL, steamUrl)
|
||||
if (frontendSteamGame) intent.putExtra(EXTRA_FRONTEND_STEAM_GAME, true)
|
||||
if (gameId != null) intent.putExtra(EXTRA_GAME_ID, gameId)
|
||||
if (Build.VERSION.SDK_INT >= 26) context.startForegroundService(intent)
|
||||
else context.startService(intent)
|
||||
|
||||
@@ -20,7 +20,7 @@ object SettingsReset {
|
||||
"gamepadLeft", "gamepadRight", "pipAutoEnter", "unfoldedControls", "unfoldedControlsWithController",
|
||||
"stretch16x9", "avoidNotch", "picturePosition", "integerScaling", "railLabels", "developerTools", "navTabOrder", "navTabShelved", "navTabHidden", "drawerPageOrder", "drawerPageHidden", "drawerSections", "pcKeyboardSize", "pcKeyboardOpacity", "pcKeyboardHiddenKeys",
|
||||
"gpuDriverMode", "androidDriver", "linuxDriver", "linuxDriver.steam", "linuxDriver.desktop",
|
||||
"tuSysmem", "glThread", "noGlError", "zinkLazy", "mangoapp", "gpuClockPin", "gamescopeRealtime", "paceCores",
|
||||
"tuSysmem", "glThread", "noGlError", "zinkLazy", "mangoapp", "gpuClockPin", "gamescopeRealtime", "producerAcquireFences", "paceCores",
|
||||
"directAudio", "mic", "wifiDiscovery", "clientCpusOverride", "clientCpus", "gameCpus",
|
||||
"noXalia", "fastSync", "fsyncFirst", "syncFallback", "prootNoSeccomp", "prootFastPath", "nativeUserland", "cursorComposite", "mountSharedStorage",
|
||||
"guestHostname", "fexPreset", "forceSsbs", "logs", "gameDebugLogsEnabled", "enhancedDiagnosticsNext", "storageDiagnostics", "buildWatermark",
|
||||
|
||||
@@ -291,6 +291,7 @@ object StorageScan {
|
||||
folders.forEach { (id, path) -> if (id !in live && path !in removedFolders && File(path).exists()) live[id] = File(path).name }
|
||||
val launchers = mapOf(
|
||||
com.droiddeck.launcher.runtime.BattleNet.APP_ID to com.droiddeck.launcher.stores.Store.BATTLENET.label,
|
||||
com.droiddeck.launcher.runtime.Nexon.APP_ID to com.droiddeck.launcher.stores.Store.NEXON.label,
|
||||
com.droiddeck.launcher.stores.ubisoft.UbisoftConnect.APP_ID to com.droiddeck.launcher.stores.Store.UBISOFT.label,
|
||||
com.droiddeck.launcher.stores.epic.EpicClient.shortcutAppId to Library.EPIC_LAUNCHER_NAME,
|
||||
)
|
||||
|
||||
@@ -113,7 +113,7 @@ object CloudSaves {
|
||||
}
|
||||
Store.UBISOFT -> UBISOFT_TEMPLATE
|
||||
Store.EA -> eaRules(context, id) ?: return null
|
||||
Store.AMAZON, Store.ITCH, Store.GAMEJOLT, Store.XBOX, Store.BATTLENET, Store.ROCKSTAR, Store.STEAM -> ""
|
||||
Store.AMAZON, Store.ITCH, Store.GAMEJOLT, Store.XBOX, Store.BATTLENET, Store.NEXON, Store.ROCKSTAR, Store.STEAM -> ""
|
||||
} ?: return null
|
||||
p.edit()
|
||||
.putString("cloud_template_$id", fetched.ifEmpty { TEMPLATE_NONE })
|
||||
@@ -181,7 +181,7 @@ object CloudSaves {
|
||||
Store.EPIC -> CloudSavePaths.epic(template, pfx, folder, EpicCredentialStore.load(context)?.accountId.orEmpty(), id)
|
||||
Store.EA -> if (sidecar.extra["masterTitleId"].isNullOrEmpty()) null
|
||||
else EaSaveRules.parse(template)?.base()?.let(EaSaveRules::template)?.let { CloudSavePaths.gog(it, pfx, folder) }
|
||||
Store.AMAZON, Store.ITCH, Store.GAMEJOLT, Store.XBOX, Store.BATTLENET, Store.UBISOFT, Store.ROCKSTAR, Store.STEAM -> null
|
||||
Store.AMAZON, Store.ITCH, Store.GAMEJOLT, Store.XBOX, Store.BATTLENET, Store.NEXON, Store.UBISOFT, Store.ROCKSTAR, Store.STEAM -> null
|
||||
}
|
||||
return dir to (if (dir == null) "unresolved" else "ok")
|
||||
}
|
||||
@@ -221,7 +221,7 @@ object CloudSaves {
|
||||
if (rules == null || base == null || token == null || uid.isEmpty() || master.isEmpty()) null
|
||||
else EaCloud(token, uid, EaCloud.keys(master, sidecar?.extra?.get("multiplayerId").orEmpty()), base, rules, saveFolder(context, store, id).first)
|
||||
}
|
||||
Store.AMAZON, Store.ITCH, Store.GAMEJOLT, Store.XBOX, Store.BATTLENET, Store.ROCKSTAR, Store.STEAM -> null
|
||||
Store.AMAZON, Store.ITCH, Store.GAMEJOLT, Store.XBOX, Store.BATTLENET, Store.NEXON, Store.ROCKSTAR, Store.STEAM -> null
|
||||
}
|
||||
|
||||
private fun signedIn(context: Context, store: Store): Boolean = when (store) {
|
||||
|
||||
@@ -16,7 +16,7 @@ internal object LoginFlows {
|
||||
Store.UBISOFT -> ubisoftFlow(browserUserAgent)
|
||||
Store.EA -> eaFlow(browserUserAgent)
|
||||
Store.ROCKSTAR -> rockstarFlow(browserUserAgent)
|
||||
Store.ITCH, Store.XBOX, Store.BATTLENET, Store.STEAM -> null
|
||||
Store.ITCH, Store.XBOX, Store.BATTLENET, Store.NEXON, Store.STEAM -> null
|
||||
}
|
||||
|
||||
@Volatile var epicFlow: () -> StoreLoginActivity.Flow? = { null }
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.droiddeck.launcher.stores
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import com.droiddeck.launcher.runtime.WindowsClient
|
||||
import com.droiddeck.launcher.stores.download.DownloadEntry
|
||||
import com.droiddeck.launcher.stores.download.DownloadQueue
|
||||
import com.droiddeck.launcher.stores.download.DownloadStage
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
import java.io.IOException
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
|
||||
internal class SetupDownload(private val app: Context, private val client: WindowsClient) : DownloadQueue.DownloadJob {
|
||||
private val cancelled = AtomicBoolean(false)
|
||||
@Volatile private var connection: HttpURLConnection? = null
|
||||
|
||||
override fun run(handle: DownloadQueue.JobHandle): String? {
|
||||
handle.stage(DownloadStage.DOWNLOAD)
|
||||
if (!LinuxRuntime.isInstalled(app)) throw IllegalStateException(app.getString(R.string.epic_client_no_runtime))
|
||||
val file = client.setup(app)
|
||||
val partial = File(file.path + ".part")
|
||||
file.parentFile?.mkdirs()
|
||||
var attempt = 0
|
||||
while (!cancelled.get()) {
|
||||
try {
|
||||
fetch(partial, handle)
|
||||
if (cancelled.get()) break
|
||||
if (!WindowsClient.setupReady(partial)) throw IOException("not a Windows program")
|
||||
if (!partial.renameTo(file)) throw IOException("could not keep the installer")
|
||||
Log.i(TAG, "${client.store.label}'s installer downloaded")
|
||||
client.open()
|
||||
StoresState.post { StoresState.notifyLibraryChanged(app) }
|
||||
return file.absolutePath
|
||||
} catch (e: IOException) {
|
||||
partial.delete()
|
||||
if (cancelled.get()) break
|
||||
attempt++
|
||||
handle.log("${client.store.label} installer attempt $attempt: ${e.message ?: e.javaClass.simpleName}")
|
||||
if (attempt >= ATTEMPTS) throw IllegalStateException(app.getString(R.string.epic_client_download_failed, e.message ?: e.javaClass.simpleName))
|
||||
val until = System.currentTimeMillis() + (2_000L shl (attempt - 1))
|
||||
while (System.currentTimeMillis() < until && !cancelled.get()) Thread.sleep(100)
|
||||
}
|
||||
}
|
||||
partial.delete()
|
||||
return null
|
||||
}
|
||||
|
||||
private fun fetch(partial: File, handle: DownloadQueue.JobHandle) {
|
||||
val conn = (URL(client.installerUrl).openConnection() as HttpURLConnection).apply {
|
||||
connectTimeout = 20_000
|
||||
readTimeout = 30_000
|
||||
instanceFollowRedirects = true
|
||||
setRequestProperty("User-Agent", "DroidDeck")
|
||||
}
|
||||
connection = conn
|
||||
try {
|
||||
if (conn.responseCode != 200) throw IOException("HTTP ${conn.responseCode}")
|
||||
if (conn.url.protocol != "https") throw IOException("not served over HTTPS")
|
||||
val total = conn.contentLengthLong
|
||||
var done = 0L
|
||||
conn.inputStream.use { input ->
|
||||
FileOutputStream(partial).use { out ->
|
||||
val buf = ByteArray(64 * 1024)
|
||||
while (!cancelled.get()) {
|
||||
val n = input.read(buf)
|
||||
if (n < 0) break
|
||||
out.write(buf, 0, n)
|
||||
done += n
|
||||
handle.progress(done, total)
|
||||
}
|
||||
out.fd.sync()
|
||||
}
|
||||
}
|
||||
if (!cancelled.get() && total > 0 && done != total) throw IOException("the download ended early")
|
||||
} finally {
|
||||
connection = null
|
||||
runCatching { conn.disconnect() }
|
||||
}
|
||||
}
|
||||
|
||||
override fun cancel(deleteFiles: Boolean) {
|
||||
cancelled.set(true)
|
||||
runCatching { connection?.disconnect() }
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "SetupDownload"
|
||||
private const val ATTEMPTS = 4
|
||||
|
||||
fun openOrFetch(app: Context, client: WindowsClient) {
|
||||
if (client.installed(app) || WindowsClient.setupReady(client.setup(app))) {
|
||||
client.open()
|
||||
return
|
||||
}
|
||||
StoresState.post {
|
||||
if (DownloadQueue.isActive(client.downloadKey)) return@post
|
||||
val entry = DownloadEntry(
|
||||
client.store, client.downloadId, app.getString(client.nameRes),
|
||||
location = StoreInstallRoot.labelFor(app, client.setup(app)),
|
||||
)
|
||||
DownloadQueue.enqueue(app, entry) { SetupDownload(app, client) }
|
||||
StoresState.openDownloads = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ enum class Store(val id: String, val label: String, val shortLabel: String) {
|
||||
AMAZON("amazon", "Amazon Games", "Amazon"),
|
||||
BATTLENET("battlenet", "Battle.net", "Battle.net"),
|
||||
GAMEJOLT("gamejolt", "Game Jolt", "Game Jolt"),
|
||||
NEXON("nexon", "Nexon", "Nexon"),
|
||||
STEAM("steamstore", "Steam", "Steam");
|
||||
|
||||
val folder: String get() = if (this == ITCH) "itch" else shortLabel
|
||||
|
||||
@@ -90,7 +90,7 @@ object StoreAccounts {
|
||||
fun signedInAs(context: Context, store: Store): String? {
|
||||
val json = read(context, store) ?: return if (isUnavailable(store)) store.label else null
|
||||
if (store == Store.XBOX) return json.optString("username").takeIf { it.isNotBlank() }
|
||||
if (store == Store.BATTLENET || store == Store.STEAM) return json.optString("display_name").takeIf { it.isNotBlank() }
|
||||
if (store == Store.BATTLENET || store == Store.NEXON || store == Store.STEAM) return json.optString("display_name").takeIf { it.isNotBlank() }
|
||||
if (json.optString("access_token", "").isEmpty()) return null
|
||||
return json.optString("display_name", "").ifEmpty { json.optString("username", "") }.ifEmpty { store.label }
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ object StoreInstallRoot {
|
||||
fun isFinished(folder: File): Boolean = StoreGameSidecar.read(folder)?.isInstalled == true
|
||||
|
||||
fun unfinished(context: Context): List<Unfinished> = roots(context).flatMap { root ->
|
||||
Store.entries.filter { it != Store.BATTLENET && it != Store.STEAM }.flatMap { store ->
|
||||
Store.entries.filter { it != Store.BATTLENET && it != Store.NEXON && it != Store.STEAM }.flatMap { store ->
|
||||
storeDir(root, store).listFiles { f -> f.isDirectory }.orEmpty().mapNotNull { folder ->
|
||||
val sidecar = StoreGameSidecar.read(folder)
|
||||
when {
|
||||
|
||||
@@ -27,7 +27,7 @@ object StoreSizes {
|
||||
|
||||
fun size(item: CatalogItem): Long = known[item.key] ?: item.sizeBytes
|
||||
|
||||
private val NO_REMOTE_SIZE = setOf(Store.GOG, Store.XBOX, Store.BATTLENET, Store.UBISOFT, Store.ROCKSTAR)
|
||||
private val NO_REMOTE_SIZE = setOf(Store.GOG, Store.XBOX, Store.BATTLENET, Store.NEXON, Store.UBISOFT, Store.ROCKSTAR)
|
||||
private val settled = mutableStateMapOf<String, Boolean>()
|
||||
|
||||
// A size that can still arrive this session: not known yet, the store can report one, and no lookup came back empty.
|
||||
@@ -63,7 +63,7 @@ object StoreSizes {
|
||||
Store.AMAZON -> AmazonPrefs.get(app).edit().putLong("size_${item.id}", it).apply()
|
||||
Store.ITCH, Store.GAMEJOLT -> {}
|
||||
Store.EA -> com.droiddeck.launcher.stores.ea.EaPrefs.get(app).edit().putLong("size_${item.id}", it).apply()
|
||||
Store.GOG, Store.XBOX, Store.BATTLENET, Store.UBISOFT, Store.ROCKSTAR, Store.STEAM -> {}
|
||||
Store.GOG, Store.XBOX, Store.BATTLENET, Store.NEXON, Store.UBISOFT, Store.ROCKSTAR, Store.STEAM -> {}
|
||||
}
|
||||
}
|
||||
}, pool).exceptionally { error ->
|
||||
@@ -139,7 +139,7 @@ object StoreSizes {
|
||||
AmazonManifest.parse(bytes).totalInstallSize
|
||||
}
|
||||
Store.EA -> com.droiddeck.launcher.stores.ea.EaSizes.size(context, item)
|
||||
Store.GOG, Store.XBOX, Store.BATTLENET, Store.UBISOFT, Store.ROCKSTAR -> 0L
|
||||
Store.GOG, Store.XBOX, Store.BATTLENET, Store.NEXON, Store.UBISOFT, Store.ROCKSTAR -> 0L
|
||||
Store.ITCH -> com.droiddeck.launcher.stores.itch.ItchLibrary.size(context, item)
|
||||
Store.GAMEJOLT -> com.droiddeck.launcher.stores.gamejolt.GameJoltBuilds.size(context, item)
|
||||
Store.STEAM -> com.droiddeck.launcher.stores.steam.SteamStore.plannedBytes(context, item)
|
||||
|
||||
@@ -14,9 +14,14 @@ internal object WebCookies {
|
||||
}
|
||||
}
|
||||
|
||||
fun scopes(url: String, paths: List<String>): List<String> {
|
||||
val segments = runCatching { java.net.URI(url).path }.getOrNull().orEmpty().split('/').filter { it.isNotEmpty() }
|
||||
return (paths + segments.indices.map { i -> "/" + segments.take(i + 1).joinToString("/") }).distinct()
|
||||
}
|
||||
|
||||
fun expire(urls: List<String>, domain: String, paths: List<String>, done: (Int) -> Unit) {
|
||||
val cookies = CookieManager.getInstance()
|
||||
val lines = urls.flatMap { url -> expired(cookies.getCookie(url), domain, paths, Uri.parse(url).host).map { url to it } }
|
||||
val lines = urls.flatMap { url -> expired(cookies.getCookie(url), domain, scopes(url, paths), Uri.parse(url).host).map { url to it } }
|
||||
if (lines.isEmpty()) {
|
||||
done(0)
|
||||
return
|
||||
|
||||
@@ -3,10 +3,8 @@ package com.droiddeck.launcher.stores.battlenet
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import android.util.Log
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.frontend.AddedGames
|
||||
import com.droiddeck.launcher.runtime.BattleNet
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import com.droiddeck.launcher.session.GameStorage
|
||||
import com.droiddeck.launcher.stores.CatalogItem
|
||||
import com.droiddeck.launcher.stores.InstalledStoreGame
|
||||
@@ -15,45 +13,22 @@ import com.droiddeck.launcher.stores.StoreAccounts
|
||||
import com.droiddeck.launcher.stores.StoreBackend
|
||||
import com.droiddeck.launcher.stores.StoreGameSidecar
|
||||
import com.droiddeck.launcher.stores.StoreInstallRoot
|
||||
import com.droiddeck.launcher.stores.SetupDownload
|
||||
import com.droiddeck.launcher.stores.StoreShelves
|
||||
import com.droiddeck.launcher.stores.StoresState
|
||||
import com.droiddeck.launcher.stores.download.DownloadEntry
|
||||
import com.droiddeck.launcher.stores.download.DownloadQueue
|
||||
import com.droiddeck.launcher.stores.download.DownloadStage
|
||||
import org.json.JSONObject
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
import java.io.IOException
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
|
||||
object BattleNetClient {
|
||||
private const val TAG = "BattleNetClient"
|
||||
const val DOWNLOAD_ID = "battlenet-client"
|
||||
const val DOWNLOAD_KEY = "battlenet:$DOWNLOAD_ID"
|
||||
const val REQUEST = "battlenet-request"
|
||||
internal const val INSTALLER_URL = "https://downloader.battle.net/download/getInstallerForGame?os=win&gameProgram=BATTLENET_APP&version=Live"
|
||||
private const val SETUP = "root/.cache/droiddeck/battlenet/Battle.net-Setup.exe"
|
||||
private const val CONFIG = "pfx/drive_c/users/steamuser/AppData/Roaming/Battle.net/Battle.net.config"
|
||||
internal const val MIN_SETUP = 1L shl 20
|
||||
private val work = Executors.newSingleThreadExecutor { r -> Thread(r, "battlenet-client") }
|
||||
|
||||
private val sequence = AtomicLong()
|
||||
|
||||
@Volatile var opener: ((List<String>) -> Unit)? = null
|
||||
|
||||
fun setup(context: Context): File = File(LinuxRuntime.rootDir(context), SETUP)
|
||||
|
||||
internal fun setupReady(file: File): Boolean = runCatching {
|
||||
file.length() >= MIN_SETUP && file.inputStream().use { input ->
|
||||
val head = ByteArray(2)
|
||||
input.read(head) == 2 && head[0] == 'M'.code.toByte() && head[1] == 'Z'.code.toByte()
|
||||
}
|
||||
}.getOrDefault(false)
|
||||
|
||||
internal fun account(config: String?): String? {
|
||||
val client = runCatching { JSONObject(config ?: return null).optJSONObject("Client") }.getOrNull() ?: return null
|
||||
if (client.optString("AutoLogin") != "true") return null
|
||||
@@ -85,19 +60,7 @@ object BattleNetClient {
|
||||
fun signIn(context: Context) {
|
||||
val app = context.applicationContext
|
||||
work.execute {
|
||||
if (BattleNet.installed(app) || setupReady(setup(app))) {
|
||||
open(emptyList())
|
||||
return@execute
|
||||
}
|
||||
StoresState.post {
|
||||
if (DownloadQueue.isActive(DOWNLOAD_KEY)) return@post
|
||||
val entry = DownloadEntry(
|
||||
Store.BATTLENET, DOWNLOAD_ID, app.getString(R.string.bnet_name),
|
||||
location = StoreInstallRoot.labelFor(app, setup(app)),
|
||||
)
|
||||
DownloadQueue.enqueue(app, entry) { SetupDownload(app) }
|
||||
StoresState.openDownloads = true
|
||||
}
|
||||
SetupDownload.openOrFetch(app, BattleNet.CLIENT)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,9 +90,7 @@ object BattleNetClient {
|
||||
sessionRoot.listFiles { file -> file.name == REQUEST || file.name.startsWith("$REQUEST.") }?.forEach { it.delete() }
|
||||
}
|
||||
|
||||
fun open(args: List<String>) {
|
||||
StoresState.post { opener?.invoke(args) }
|
||||
}
|
||||
fun open(args: List<String>) = BattleNet.CLIENT.open(args)
|
||||
|
||||
fun library(context: Context, root: File? = preferred(context)): List<String> =
|
||||
root?.let { AddedGames.guestPath(context, StoreInstallRoot.storeDir(it, Store.BATTLENET)) }?.let { listOf("--library", it) }.orEmpty()
|
||||
@@ -144,12 +105,6 @@ object BattleNetClient {
|
||||
val app = context.applicationContext
|
||||
work.execute { open(library(app, root) + listOf("install-game", uid)) }
|
||||
}
|
||||
|
||||
internal fun downloaded(context: Context) {
|
||||
Log.i(TAG, "Battle.net's installer downloaded from Blizzard")
|
||||
open(emptyList())
|
||||
StoresState.post { StoresState.notifyLibraryChanged(context) }
|
||||
}
|
||||
}
|
||||
|
||||
object BattleNetBackend : StoreBackend {
|
||||
@@ -225,79 +180,3 @@ object BattleNetBackend : StoreBackend {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
internal class SetupDownload(private val app: Context) : DownloadQueue.DownloadJob {
|
||||
private val cancelled = AtomicBoolean(false)
|
||||
@Volatile private var connection: HttpURLConnection? = null
|
||||
|
||||
override fun run(handle: DownloadQueue.JobHandle): String? {
|
||||
handle.stage(DownloadStage.DOWNLOAD)
|
||||
if (!LinuxRuntime.isInstalled(app)) throw IllegalStateException(app.getString(R.string.epic_client_no_runtime))
|
||||
val file = BattleNetClient.setup(app)
|
||||
val partial = File(file.path + ".part")
|
||||
file.parentFile?.mkdirs()
|
||||
var attempt = 0
|
||||
while (!cancelled.get()) {
|
||||
try {
|
||||
fetch(partial, handle)
|
||||
if (cancelled.get()) break
|
||||
if (!BattleNetClient.setupReady(partial)) throw IOException("not a Windows program")
|
||||
if (!partial.renameTo(file)) throw IOException("could not keep the installer")
|
||||
BattleNetClient.downloaded(app)
|
||||
return file.absolutePath
|
||||
} catch (e: IOException) {
|
||||
partial.delete()
|
||||
if (cancelled.get()) break
|
||||
attempt++
|
||||
handle.log("Battle.net installer attempt $attempt: ${e.message ?: e.javaClass.simpleName}")
|
||||
if (attempt >= ATTEMPTS) throw IllegalStateException(app.getString(R.string.epic_client_download_failed, e.message ?: e.javaClass.simpleName))
|
||||
val until = System.currentTimeMillis() + (2_000L shl (attempt - 1))
|
||||
while (System.currentTimeMillis() < until && !cancelled.get()) Thread.sleep(100)
|
||||
}
|
||||
}
|
||||
partial.delete()
|
||||
return null
|
||||
}
|
||||
|
||||
private fun fetch(partial: File, handle: DownloadQueue.JobHandle) {
|
||||
val conn = (URL(BattleNetClient.INSTALLER_URL).openConnection() as HttpURLConnection).apply {
|
||||
connectTimeout = 20_000
|
||||
readTimeout = 30_000
|
||||
instanceFollowRedirects = true
|
||||
setRequestProperty("User-Agent", "DroidDeck")
|
||||
}
|
||||
connection = conn
|
||||
try {
|
||||
if (conn.responseCode != 200) throw IOException("HTTP ${conn.responseCode}")
|
||||
if (conn.url.protocol != "https") throw IOException("not served over HTTPS")
|
||||
val total = conn.contentLengthLong
|
||||
var done = 0L
|
||||
conn.inputStream.use { input ->
|
||||
FileOutputStream(partial).use { out ->
|
||||
val buf = ByteArray(64 * 1024)
|
||||
while (!cancelled.get()) {
|
||||
val n = input.read(buf)
|
||||
if (n < 0) break
|
||||
out.write(buf, 0, n)
|
||||
done += n
|
||||
handle.progress(done, total)
|
||||
}
|
||||
out.fd.sync()
|
||||
}
|
||||
}
|
||||
if (!cancelled.get() && total > 0 && done != total) throw IOException("the download ended early")
|
||||
} finally {
|
||||
connection = null
|
||||
runCatching { conn.disconnect() }
|
||||
}
|
||||
}
|
||||
|
||||
override fun cancel(deleteFiles: Boolean) {
|
||||
cancelled.set(true)
|
||||
runCatching { connection?.disconnect() }
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val ATTEMPTS = 4
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,7 @@ object EaBackend : StoreBackend {
|
||||
signOuts.incrementAndGet()
|
||||
StoresState.post { StoresState.shelves.remove(store) }
|
||||
EaUpdates.available.clear()
|
||||
runCatching { WebCookies.expire(EaLogin.SIGN_IN_URLS, ".ea.com", listOf("/")) {} }
|
||||
EaLogin.forget {}
|
||||
}
|
||||
|
||||
override fun syncLibrary(context: Context, force: Boolean) {
|
||||
@@ -100,9 +100,7 @@ internal class EaLogin(private val pending: EaAuth.Pending, override val userAge
|
||||
|
||||
override fun isRedirect(url: String): Boolean = url.startsWith("qrc:", ignoreCase = true)
|
||||
|
||||
override fun forgetSignIn(done: () -> Unit) {
|
||||
runCatching { WebCookies.expire(SIGN_IN_URLS, ".ea.com", listOf("/")) { done() } }.onFailure { done() }
|
||||
}
|
||||
override fun forgetSignIn(done: () -> Unit) = forget(done)
|
||||
|
||||
override fun finish(activity: StoreLoginActivity, view: WebView, url: String): String? {
|
||||
val code = EaAuth.redirectValue(url, "code") ?: return activity.getString(R.string.stores_login_error_verification)
|
||||
@@ -116,7 +114,11 @@ internal class EaLogin(private val pending: EaAuth.Pending, override val userAge
|
||||
}
|
||||
|
||||
companion object {
|
||||
val SIGN_IN_URLS = listOf("https://accounts.ea.com", "https://signin.ea.com", "https://www.ea.com")
|
||||
val SIGN_IN_URLS = listOf(EaAuth.AUTH_URL, "https://signin.ea.com/p/juno/login", "https://www.ea.com")
|
||||
|
||||
fun forget(done: () -> Unit) {
|
||||
runCatching { WebCookies.expire(SIGN_IN_URLS, ".ea.com", listOf("/")) { done() } }.onFailure { done() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.droiddeck.launcher.stores.nexon
|
||||
|
||||
import android.content.Context
|
||||
import com.droiddeck.launcher.runtime.Nexon
|
||||
import com.droiddeck.launcher.stores.CatalogItem
|
||||
import com.droiddeck.launcher.stores.InstalledStoreGame
|
||||
import com.droiddeck.launcher.stores.SetupDownload
|
||||
import com.droiddeck.launcher.stores.Store
|
||||
import com.droiddeck.launcher.stores.StoreAccounts
|
||||
import com.droiddeck.launcher.stores.StoreBackend
|
||||
import com.droiddeck.launcher.stores.StoreShelves
|
||||
import com.droiddeck.launcher.stores.StoresState
|
||||
import org.json.JSONObject
|
||||
import java.io.File
|
||||
|
||||
object NexonBackend : StoreBackend {
|
||||
override val store: Store = Store.NEXON
|
||||
|
||||
override fun signIn(context: Context) {
|
||||
val app = context.applicationContext
|
||||
Thread({
|
||||
StoreAccounts.write(app, store, JSONObject().put("display_name", store.label))
|
||||
StoresState.refresh(app)
|
||||
SetupDownload.openOrFetch(app, Nexon.CLIENT)
|
||||
}, "nexon-sign-in").start()
|
||||
}
|
||||
|
||||
override fun signOut(context: Context) {
|
||||
StoreAccounts.clear(context, store)
|
||||
StoresState.post { StoresState.shelves.remove(store); StoresState.found.remove(store) }
|
||||
}
|
||||
|
||||
override fun syncLibrary(context: Context, force: Boolean) {
|
||||
StoresState.post { StoresState.library[store] = emptyList() }
|
||||
}
|
||||
|
||||
override fun loadShelves(context: Context, force: Boolean) {
|
||||
StoresState.post { StoresState.shelves[store] = StoreShelves() }
|
||||
}
|
||||
|
||||
override fun install(context: Context, item: CatalogItem, root: File) = Nexon.CLIENT.open()
|
||||
|
||||
override fun uninstall(context: Context, game: InstalledStoreGame) = Nexon.CLIENT.open()
|
||||
}
|
||||
@@ -106,7 +106,7 @@ private fun PanelContent(
|
||||
onChange(settings.copy(frameGen = it))
|
||||
}
|
||||
Text("Native engine (experimental): Google's WebRTC and DroidDeck's own compositor, so DroidDeck frame generation " +
|
||||
"(DDFG) or LSFG can add frames. LSFG uses the Lossless.dll DroidDeck already uses for games. Screen effects " +
|
||||
"(DDFG) or LSFG can add frames. LSFG requires Lossless Scaling installed through Steam. Screen effects " +
|
||||
"apply to the web engine.", style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
modifier = Modifier.padding(start = 8.dp, bottom = 6.dp))
|
||||
}
|
||||
|
||||
@@ -623,11 +623,11 @@ class XboxNativePlayerActivity : ComponentActivity() {
|
||||
XboxMenuEntry((if (current.frameGen == mode) "✓ " else "") + fgName(mode), when (mode) {
|
||||
XboxNativeVideo.FG_DDFG -> "DroidDeck's own frame generation (DDFG); doubles the shown frame rate"
|
||||
XboxNativeVideo.FG_LSFG, XboxNativeVideo.FG_LSFG3, XboxNativeVideo.FG_LSFG4 ->
|
||||
"Lossless Scaling frame generation (the Lossless.dll DroidDeck uses for games); the frame-rate target caps the output"
|
||||
"Lossless Scaling frame generation from the Steam installation; the frame-rate target caps the output"
|
||||
else -> "Show the stream's own frames only"
|
||||
}, choices[i]) { current = current.copy(frameGen = mode); setFrameGen(mode) }
|
||||
}
|
||||
if (!lsfg) androidx.compose.material3.Text("LSFG appears here once DroidDeck has the Lossless.dll (frame generation settings).",
|
||||
if (!lsfg) androidx.compose.material3.Text("LSFG appears here once Lossless Scaling is installed through Steam.",
|
||||
style = androidx.compose.material3.MaterialTheme.typography.bodySmall, color = cs.onSurfaceVariant,
|
||||
modifier = androidx.compose.ui.Modifier.padding(horizontal = 16.dp, vertical = 8.dp))
|
||||
if (current.zeroCopy) androidx.compose.material3.Text(
|
||||
|
||||
@@ -78,7 +78,7 @@ internal fun AgentEntry(
|
||||
is Entry.Said -> {
|
||||
val reply = remember(entry.text) { choices(entry.text) }
|
||||
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
if (reply.text.isNotBlank()) SelectionContainer { AgentMarkdown(reply.text, Modifier.widthIn(max = 760.dp).padding(horizontal = 4.dp)) }
|
||||
if (reply.text.isNotBlank()) SelectionContainer { AgentReply(reply.text, Modifier.widthIn(max = 760.dp).padding(horizontal = 4.dp)) }
|
||||
if (reply.options.isNotEmpty()) AgentChoices(reply.options, answerable, onSent)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,106 @@ import org.commonmark.ext.gfm.tables.TableRow
|
||||
import org.commonmark.node.AbstractVisitor
|
||||
import org.commonmark.node.CustomNode
|
||||
import org.commonmark.node.Node
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.heightIn
|
||||
import androidx.compose.foundation.layout.widthIn
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import coil.compose.AsyncImage
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import java.io.File
|
||||
|
||||
/** Part of an agent's reply: Markdown text, or an image the agent named on a line of its own. */
|
||||
internal sealed interface ReplyPart {
|
||||
data class Prose(val text: String) : ReplyPart
|
||||
data class Picture(val alt: String, val path: String) : ReplyPart
|
||||
}
|
||||
|
||||
private val PICTURE_LINE = Regex("""^\s*!\[([^\]]*)]\(\s*(?:<(?:file://)?(/[^>]*)>|(?:file://)?(/[^)<>]*?))\s*\)\s*$""")
|
||||
private val FENCE = Regex("""^ {0,3}(`{3,}|~{3,})(.*)$""")
|
||||
|
||||
/** Splits [text] at lines that hold only an image of a local absolute path, outside code fences. */
|
||||
internal fun replyParts(text: String): List<ReplyPart> {
|
||||
val parts = mutableListOf<ReplyPart>()
|
||||
val prose = StringBuilder()
|
||||
fun flush() {
|
||||
if (prose.isNotBlank()) parts += ReplyPart.Prose(prose.toString().trimEnd('\n'))
|
||||
prose.clear()
|
||||
}
|
||||
var fence: String? = null
|
||||
for (line in text.lines()) {
|
||||
val marker = FENCE.matchEntire(line)
|
||||
val picture = if (fence == null) PICTURE_LINE.matchEntire(line) else null
|
||||
val open = fence
|
||||
when {
|
||||
picture != null -> {
|
||||
flush()
|
||||
val path = picture.groupValues[2].ifEmpty { picture.groupValues[3] }
|
||||
parts += ReplyPart.Picture(picture.groupValues[1].trim(), path.trim())
|
||||
continue
|
||||
}
|
||||
marker == null -> Unit
|
||||
open == null -> fence = marker.groupValues[1]
|
||||
marker.groupValues[1].let { it[0] == open[0] && it.length >= open.length } && marker.groupValues[2].isBlank() -> fence = null
|
||||
}
|
||||
prose.append(line).append('\n')
|
||||
}
|
||||
flush()
|
||||
return parts
|
||||
}
|
||||
|
||||
/**
|
||||
* Where the app reads a file the agent named by its guest path: the app's own folders and shared
|
||||
* storage are bound at the same paths in the guest, everything else lives in the rootfs.
|
||||
*/
|
||||
internal fun agentHostFile(context: Context, guestPath: String): File {
|
||||
val app = context.applicationContext
|
||||
val same = listOfNotNull(app.filesDir.path, app.cacheDir.path, LinuxRuntime.sharedStorage(app)?.path)
|
||||
return if (same.any { guestPath == it || guestPath.startsWith("$it/") }) File(guestPath)
|
||||
else File(LinuxRuntime.rootDir(app), guestPath.removePrefix("/"))
|
||||
}
|
||||
|
||||
/** An agent's reply, with the images it names shown in place. */
|
||||
@Composable
|
||||
internal fun AgentReply(text: String, modifier: Modifier) {
|
||||
val parts = remember(text) { replyParts(text) }
|
||||
if (parts.size == 1 && parts[0] is ReplyPart.Prose) {
|
||||
AgentMarkdown(text, modifier)
|
||||
return
|
||||
}
|
||||
Column(modifier, verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
parts.forEach { part ->
|
||||
when (part) {
|
||||
is ReplyPart.Prose -> AgentMarkdown(part.text, Modifier)
|
||||
is ReplyPart.Picture -> AgentPicture(part)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun AgentPicture(picture: ReplyPart.Picture) {
|
||||
val context = LocalContext.current
|
||||
val file = remember(picture.path) { agentHostFile(context, picture.path) }
|
||||
var full by remember(picture.path) { mutableStateOf(false) }
|
||||
if (!file.isFile) {
|
||||
Text(stringResource(R.string.agent_image_missing, picture.alt.ifBlank { picture.path }), color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
return
|
||||
}
|
||||
AsyncImage(
|
||||
model = file, contentDescription = picture.alt.ifBlank { file.name }, contentScale = ContentScale.Fit,
|
||||
modifier = Modifier.widthIn(max = 560.dp).then(if (full) Modifier else Modifier.heightIn(max = 420.dp))
|
||||
.clip(Shape12).clickable { full = !full },
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun AgentMarkdown(text: String, modifier: Modifier) {
|
||||
|
||||
@@ -532,7 +532,7 @@ private fun AgentLive() {
|
||||
val pal = LocalPalette.current
|
||||
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
if (AgentHost.liveThinking.isNotBlank()) AgentThought(AgentHost.liveThinking, live = true)
|
||||
if (AgentHost.live.isNotBlank()) AgentMarkdown(AgentHost.live, Modifier.widthIn(max = 760.dp).padding(horizontal = 4.dp))
|
||||
if (AgentHost.live.isNotBlank()) AgentReply(AgentHost.live, Modifier.widthIn(max = 760.dp).padding(horizontal = 4.dp))
|
||||
val running = AgentHost.running()
|
||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp), modifier = Modifier.padding(4.dp)) {
|
||||
CircularProgressIndicator(Modifier.size(14.dp), strokeWidth = 2.dp, color = pal.primary)
|
||||
|
||||
@@ -338,6 +338,24 @@ internal fun sessionBarModel(
|
||||
internal fun deckPanelTabs(context: Context, selected: DeckPanel, onSelect: (DeckPanel) -> Unit) =
|
||||
BarTabs(DeckPanel.entries.map { context.getString(it.label) }, selected.ordinal) { onSelect(DeckPanel.entries[it]) }
|
||||
|
||||
internal fun padKeysView(
|
||||
context: Context, steam: Boolean, onMenu: () -> Unit, onSteam: () -> Unit, onQam: () -> Unit,
|
||||
): ComposeView = ComposeView(context).apply {
|
||||
setContent { DroidDeckTheme { PadKeys(steam, onMenu, onSteam, onQam) } }
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun PadKeys(steam: Boolean, onMenu: () -> Unit, onSteam: () -> Unit, onQam: () -> Unit) {
|
||||
Row(
|
||||
Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 8.dp),
|
||||
horizontalArrangement = if (steam) Arrangement.SpaceBetween else Arrangement.Center,
|
||||
) {
|
||||
if (steam) BarActions(null, false, onSteam, null)
|
||||
BarActions(onMenu, false, null, null)
|
||||
if (steam) BarActions(null, false, null, onQam)
|
||||
}
|
||||
}
|
||||
|
||||
internal fun bottomScreenBarView(context: Context, model: () -> BottomBarModel): ComposeView = ComposeView(context).apply {
|
||||
setContent { DroidDeckTheme { BottomScreenBar(model()) } }
|
||||
}
|
||||
@@ -199,7 +199,6 @@ internal fun SessionDrawerPreview(secondScreens: List<SecondScreenDisplay>) {
|
||||
secondScreenDisplays = secondScreens,
|
||||
selectedSecondScreenDisplay = secondScreens.firstOrNull()?.id ?: -1,
|
||||
onSecondScreenDisplay = {},
|
||||
onImportLossless = {},
|
||||
onKeyboard = {}, onHardwareKeyboard = {},
|
||||
onSteamMenu = if (steam) ({}) else null,
|
||||
onQam = if (steam) ({}) else null,
|
||||
|
||||
@@ -24,18 +24,13 @@ internal fun FrameGenMenu(
|
||||
mode: FrameGen.Mode,
|
||||
lossless: Lossless.State,
|
||||
onPick: (FrameGen.Mode) -> Unit,
|
||||
onImportLossless: () -> Unit,
|
||||
gameProfileId: String? = null,
|
||||
hasGameOverride: Boolean = false,
|
||||
onResetGame: () -> Unit = {},
|
||||
focusModifier: Modifier = Modifier,
|
||||
legacyButtons: Boolean = false,
|
||||
) {
|
||||
val need = when {
|
||||
lossless.ready -> null
|
||||
lossless.owned -> stringResource(R.string.lsfg_needs_install)
|
||||
else -> stringResource(R.string.lsfg_needs_steam)
|
||||
}
|
||||
val need = stringResource(R.string.lsfg_needs_steam)
|
||||
val selectedEngine = mode.engine.takeIf { it != FrameGen.ENGINE_OFF }
|
||||
val offLabel = FrameGen.label(LocalContext.current, FrameGen.Mode.OFF)
|
||||
val colors = MaterialTheme.colorScheme
|
||||
@@ -70,7 +65,7 @@ internal fun FrameGenMenu(
|
||||
}
|
||||
if (selectedEngine == FrameGen.ENGINE_LSFG && !lossless.ready) {
|
||||
Text(
|
||||
need.orEmpty(),
|
||||
need,
|
||||
color = colors.onSurfaceVariant,
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
modifier = Modifier.padding(top = 6.dp),
|
||||
@@ -87,21 +82,6 @@ internal fun FrameGenMenu(
|
||||
Text(stringResource(R.string.comp_game_use_general) + if (hasGameOverride) "" else " ✓")
|
||||
}
|
||||
}
|
||||
if (lossless.owned) {
|
||||
val using = when (lossless.source) {
|
||||
Lossless.Source.STEAM -> stringResource(R.string.lsfg_using_steam)
|
||||
Lossless.Source.IMPORT -> stringResource(R.string.lsfg_using_import)
|
||||
Lossless.Source.NONE -> null
|
||||
}
|
||||
OutlinedButton(
|
||||
onClick = onImportLossless,
|
||||
modifier = Modifier.fillMaxWidth().padding(top = 6.dp)
|
||||
.controllerConfirm(onClick = onImportLossless),
|
||||
contentPadding = PaddingValues(horizontal = 12.dp, vertical = 8.dp),
|
||||
) {
|
||||
Text(stringResource(R.string.lsfg_import) + (using?.let { " · $it" } ?: ""))
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -200,7 +180,7 @@ internal fun FrameGenMenu(
|
||||
}
|
||||
|
||||
if (selectedEngine == FrameGen.ENGINE_LSFG && !lossless.ready) {
|
||||
Text(need.orEmpty(), color = colors.onSurfaceVariant,
|
||||
Text(need, color = colors.onSurfaceVariant,
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
modifier = Modifier.padding(top = 6.dp))
|
||||
}
|
||||
@@ -217,20 +197,5 @@ internal fun FrameGenMenu(
|
||||
}
|
||||
}
|
||||
|
||||
if (lossless.owned) {
|
||||
val using = when (lossless.source) {
|
||||
Lossless.Source.STEAM -> stringResource(R.string.lsfg_using_steam)
|
||||
Lossless.Source.IMPORT -> stringResource(R.string.lsfg_using_import)
|
||||
Lossless.Source.NONE -> null
|
||||
}
|
||||
OutlinedButton(
|
||||
onClick = onImportLossless,
|
||||
modifier = Modifier.fillMaxWidth().padding(top = 8.dp)
|
||||
.controllerConfirm(onClick = onImportLossless),
|
||||
contentPadding = PaddingValues(horizontal = 12.dp, vertical = 8.dp),
|
||||
) {
|
||||
Text(stringResource(R.string.lsfg_import) + (using?.let { " · $it" } ?: ""))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -158,7 +158,7 @@ class FrontEndState(
|
||||
val packageStage: String? = null,
|
||||
val packagePercent: Int = -1,
|
||||
val sessionRunning: Boolean = false,
|
||||
val battleNetInstalled: Boolean = false,
|
||||
val clientsInstalled: Set<com.droiddeck.launcher.stores.Store> = emptySet(),
|
||||
val removalPending: Boolean = false,
|
||||
val runtimeActionsBlocked: Boolean = false,
|
||||
val backActionsInverted: Boolean = false,
|
||||
@@ -231,7 +231,7 @@ class FrontEndActions(
|
||||
val onEmulator: (Library.Emulator) -> Unit,
|
||||
val onFlatpakApp: (String, String) -> Unit = { _, _ -> },
|
||||
val onUserApp: (com.droiddeck.launcher.runtime.UserApps.App) -> Unit = {},
|
||||
val onBattleNet: () -> Unit = {},
|
||||
val onClient: (com.droiddeck.launcher.stores.Store) -> Unit = {},
|
||||
val onRom: (Library.Rom) -> Unit,
|
||||
val onResume: () -> Unit,
|
||||
val onSteamSettings: () -> Unit,
|
||||
@@ -246,7 +246,6 @@ class FrontEndActions(
|
||||
val onVkBridgeSafe: (Boolean) -> Unit = {},
|
||||
val onBridgeProtonDxvk: (Boolean) -> Unit = {},
|
||||
val onFrameGenPick: (FrameGen.Mode) -> Unit,
|
||||
val onImportLossless: () -> Unit,
|
||||
val onProtons: () -> Unit,
|
||||
val onComponents: (focusContent: Boolean) -> Unit,
|
||||
val onGameComponents: (Library.SteamGame) -> Unit = { onComponents(true) },
|
||||
|
||||
@@ -860,7 +860,7 @@ internal fun ReadinessCard(
|
||||
|
||||
@Composable
|
||||
private fun FrameGenMenu(s: FrontEndState, a: FrontEndActions, host: MenuHost) {
|
||||
FrameGenMenu(s.frameGen, s.lossless, a.onFrameGenPick, a.onImportLossless, legacyButtons = true)
|
||||
FrameGenMenu(s.frameGen, s.lossless, a.onFrameGenPick, legacyButtons = true)
|
||||
}
|
||||
|
||||
@Composable
|
||||
@@ -901,7 +901,6 @@ internal fun LaunchSettings(s: FrontEndState, a: FrontEndActions, host: MenuHost
|
||||
gameFrameGenOverride = true
|
||||
}
|
||||
},
|
||||
onImportLossless = a.onImportLossless,
|
||||
legacyButtons = true,
|
||||
gameProfileId = frameGenProfileKey,
|
||||
hasGameOverride = gameFrameGenOverride,
|
||||
|
||||
@@ -415,6 +415,10 @@ private fun GameTabBar(
|
||||
if (bumpers) TabBarBumper("LB", stringResource(R.string.widgets_prev_tab), leading = true) { onSelect((selected + tabs.size - 1) % tabs.size) }
|
||||
androidx.compose.foundation.layout.BoxWithConstraints(Modifier.weight(1f).clip(if (bumpers) RoundedCornerShape(BumperFlat) else CircleShape).onSizeChanged { viewport = it.width }) {
|
||||
val share = maxWidth / tabs.size.coerceAtLeast(1)
|
||||
if (tabsAsMenu(maxWidth, tabs.size)) {
|
||||
TabMenu(tabs, selected, onSelect, focus = focusRequesters)
|
||||
return@BoxWithConstraints
|
||||
}
|
||||
Box(Modifier.horizontalScroll(scroll)) {
|
||||
spans.getOrNull(selected)?.takeIf { tabHeight > 0 }?.let { span ->
|
||||
TabHighlight(span, tabHeight, flatStart = bumpers && selected == 0, flatEnd = bumpers && selected == tabs.lastIndex)
|
||||
@@ -593,7 +597,7 @@ internal fun GameActions(
|
||||
SecondaryButton(stringResource(R.string.bnet_update)) { BattleNetInstall.update(ctx, installed) }
|
||||
}
|
||||
}
|
||||
SecondaryButton(stringResource(R.string.bnet_open)) { a.onBattleNet() }
|
||||
SecondaryButton(stringResource(R.string.bnet_open)) { a.onClient(Store.BATTLENET) }
|
||||
}
|
||||
if (game != null && !compactMenu) {
|
||||
HideButton(hideKey(game), game)
|
||||
|
||||
@@ -102,7 +102,7 @@ internal fun GameEnvironmentEditor(byPad: Boolean, initialScope: String = "", on
|
||||
runCatching {
|
||||
withContext(Dispatchers.IO) {
|
||||
GameEnvironmentStore.read(context) to Library.steamGames(context).map { it.appId.toString() to it.name } +
|
||||
listOfNotNull(com.droiddeck.launcher.runtime.BattleNet.profile(context))
|
||||
com.droiddeck.launcher.runtime.WindowsClient.all.mapNotNull { it.profile(context) }
|
||||
}
|
||||
}.onSuccess { (settings, installed) -> config = settings; games = installed }
|
||||
.onFailure { error = true }
|
||||
|
||||
@@ -888,10 +888,11 @@ private fun LibraryHeader(
|
||||
clearSearchFocus = searchCleared, inlineWhenStacked = true,
|
||||
lead = soundLead,
|
||||
) {
|
||||
if (!soundMode && !s.shortcutPicker && source == Store.BATTLENET.id) {
|
||||
val client = if (!soundMode && !s.shortcutPicker) com.droiddeck.launcher.runtime.WindowsClient.byStore(Store.byId(source)) else null
|
||||
if (client != null) {
|
||||
SecondaryButton(
|
||||
stringResource(R.string.bnet_open), enabled = !s.busy && DevPreview.library == LibraryPreview.OFF,
|
||||
compact = true, modifier = Modifier.testTag("library-battlenet-open"), onClick = a.onBattleNet,
|
||||
clientOpenLabel(client), enabled = !s.busy && DevPreview.library == LibraryPreview.OFF,
|
||||
compact = true, modifier = Modifier.testTag("library-${client.store.id}-open"), onClick = { a.onClient(client.store) },
|
||||
)
|
||||
}
|
||||
if (soundMode) HeaderIconButton(stringResource(R.string.soundtracks_saved), Icons.Filled.BookmarkBorder, "collections", onClick = onCollections)
|
||||
|
||||
@@ -711,6 +711,10 @@ internal fun SheetChips(
|
||||
Modifier.fillMaxWidth().onFocusChanged { within = it.hasFocus },
|
||||
contentAlignment = Alignment.CenterStart,
|
||||
) {
|
||||
if (tabsAsMenu(maxWidth, labels.size)) {
|
||||
TabMenu(labels, selected, onPick, focus = chips)
|
||||
return@BoxWithConstraints
|
||||
}
|
||||
val equal = !width.isSpecified && maxWidth / labels.size.coerceAtLeast(1) >= 96.dp
|
||||
val least = if (width.isSpecified) maxOf(width, 64.dp) else 64.dp
|
||||
val scroll = rememberScrollState()
|
||||
|
||||
@@ -62,6 +62,7 @@ class ModeSettings(
|
||||
val hdrReason: String?,
|
||||
val hdrDisplay: Boolean = true,
|
||||
val zeroCopy: Boolean = true,
|
||||
val producerAcquireFences: Boolean? = null,
|
||||
val gpuDrivers: String? = null,
|
||||
val upscaler: Int = 0,
|
||||
val upscaleSharpness: Int = 75,
|
||||
@@ -125,6 +126,7 @@ class ModeSettingsActions(
|
||||
val onResolutionPortrait: (String) -> Unit = {},
|
||||
val onHdr: (Boolean) -> Unit,
|
||||
val onZeroCopy: (Boolean) -> Unit = {},
|
||||
val onProducerAcquireFences: (Boolean) -> Unit = {},
|
||||
val onGpuDrivers: () -> Unit = {},
|
||||
val onUpscaler: (Int) -> Unit = {},
|
||||
val onUpscaleSharpness: (Int) -> Unit = {},
|
||||
@@ -284,6 +286,11 @@ fun ModeSheetRows(s: ModeSettings, a: ModeSettingsActions, tab: String, extras:
|
||||
stringResource(R.string.display_avoid_notch_hint), checked = enabled, onChange = a.onAvoidNotch)
|
||||
}
|
||||
ToggleRow(host, "zero-copy", stringResource(R.string.display_zero_copy), null, checked = s.zeroCopy, onChange = a.onZeroCopy)
|
||||
s.producerAcquireFences?.let { enabled ->
|
||||
ToggleRow(host, "producer-acquire-fences", stringResource(R.string.producer_acquire_fences),
|
||||
stringResource(R.string.producer_acquire_fences_summary), checked = enabled,
|
||||
onChange = a.onProducerAcquireFences)
|
||||
}
|
||||
}
|
||||
SettingsGroup(stringResource(R.string.display_image_scaling)) {
|
||||
s.integerScaling?.let { enabled ->
|
||||
|
||||
@@ -22,7 +22,12 @@ internal enum class SessionDrawerPage(val firstControl: String) {
|
||||
}
|
||||
|
||||
internal object DrawerPages {
|
||||
var order by mutableStateOf(SessionDrawerPage.entries.toList())
|
||||
private val defaultOrder = SessionDrawerPage.entries.toMutableList().apply {
|
||||
remove(SessionDrawerPage.VR)
|
||||
add(indexOf(SessionDrawerPage.MORE) + 1, SessionDrawerPage.VR)
|
||||
}.toList()
|
||||
|
||||
var order by mutableStateOf(defaultOrder)
|
||||
private set
|
||||
var hidden by mutableStateOf(emptySet<SessionDrawerPage>())
|
||||
private set
|
||||
@@ -39,6 +44,7 @@ internal object DrawerPages {
|
||||
}
|
||||
|
||||
fun arrange(saved: List<String>): List<SessionDrawerPage> {
|
||||
if (saved.isEmpty()) return defaultOrder
|
||||
val all = SessionDrawerPage.entries
|
||||
val out = saved.mapNotNull { name -> all.firstOrNull { it.name == name } }.distinct().toMutableList()
|
||||
for (page in all.filterNot { it in out }) {
|
||||
@@ -62,14 +68,14 @@ internal object DrawerPages {
|
||||
}
|
||||
|
||||
fun reset(context: Context) {
|
||||
order = SessionDrawerPage.entries.toList()
|
||||
order = defaultOrder
|
||||
hidden = emptySet()
|
||||
if (DevPreview.drawer != null) return
|
||||
SessionPrefs.setDrawerPageOrder(context, order.map { it.name })
|
||||
SessionPrefs.setDrawerPageHidden(context, emptySet())
|
||||
}
|
||||
|
||||
fun isDefault() = order == SessionDrawerPage.entries.toList() && hidden.isEmpty()
|
||||
fun isDefault() = order == defaultOrder && hidden.isEmpty()
|
||||
}
|
||||
|
||||
internal fun offeredDrawerPages(
|
||||
|
||||
@@ -316,7 +316,6 @@ class DrawerActions(
|
||||
val hdr: Boolean = false,
|
||||
val hdrAvailable: Boolean = false,
|
||||
val onHdr: (Boolean) -> Unit = {},
|
||||
val onImportLossless: () -> Unit,
|
||||
val onKeyboard: () -> Unit,
|
||||
val onHardwareKeyboard: () -> Unit,
|
||||
val wowChatShown: Boolean = false,
|
||||
@@ -391,6 +390,8 @@ class DrawerActions(
|
||||
val quickButtons: Map<com.droiddeck.launcher.input.InputCommand, Boolean> = emptyMap(),
|
||||
val onQuickButton: (com.droiddeck.launcher.input.InputCommand, Boolean) -> Unit = { _, _ -> },
|
||||
val onUnfoldedControls: (Boolean) -> Unit = {},
|
||||
val deckPanel: com.droiddeck.launcher.input.DeckPanel? = null,
|
||||
val onDeckPanel: (com.droiddeck.launcher.input.DeckPanel) -> Unit = {},
|
||||
val unfoldedControlsWithController: Boolean = false,
|
||||
val onUnfoldedControlsWithController: (Boolean) -> Unit = {},
|
||||
val onShareLogs: () -> Unit,
|
||||
@@ -769,6 +770,11 @@ private fun DrawerControllerPage(host: MenuHost, a: DrawerActions, padConnected:
|
||||
if (a.steam && a.unfoldedControls != null) ToggleRow(host, "unfolded-controls", stringResource(R.string.unfolded_controls),
|
||||
stringResource(R.string.unfolded_controls_hint), a.unfoldedControls,
|
||||
chipModifier = track("unfolded-controls"), onChange = a.onUnfoldedControls)
|
||||
a.deckPanel?.let { panel ->
|
||||
ChoiceRow(host, "deck-panel", stringResource(R.string.ctrl_layout), null,
|
||||
com.droiddeck.launcher.input.DeckPanel.entries.map { it to stringResource(it.label) }, panel,
|
||||
chipModifier = track("deck-panel"), onPick = a.onDeckPanel)
|
||||
}
|
||||
if (a.steam && a.unfoldedControls == true) ToggleRow(host, "unfolded-controls-with-controller",
|
||||
stringResource(R.string.unfolded_controls_with_controller),
|
||||
stringResource(R.string.unfolded_controls_with_controller_hint), a.unfoldedControlsWithController,
|
||||
@@ -906,7 +912,7 @@ private fun DrawerFrameGenPage(host: MenuHost, a: DrawerActions, track: (String)
|
||||
SettingsGroup(stringResource(R.string.frame_gen_title), compact = true, key = "frame-generation", detail = summary(fgLabel, scope)) {
|
||||
SettingsRow(stringResource(R.string.frame_gen_title), scope, stacked = true, tightControlSpacing = true) {
|
||||
FrameGenMenu(
|
||||
a.frameGen, a.lossless, a.onFrameGenPick, a.onImportLossless,
|
||||
a.frameGen, a.lossless, a.onFrameGenPick,
|
||||
gameProfileId = a.frameGenTargetGameId,
|
||||
hasGameOverride = a.hasGameOverride,
|
||||
onResetGame = a.onFrameGenReset,
|
||||
|
||||
@@ -212,7 +212,8 @@ internal fun TabStrip(
|
||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp), modifier = modifier) {
|
||||
if (bumpers) BumperKey("LB", stringResource(R.string.widgets_prev_tab)) { onSelect((selected + tabs.size - 1) % tabs.size) }
|
||||
// Centred, the bumpers sit at the edges and the tabs in the middle, as in the bottom bar.
|
||||
Box(if (centered) Modifier.weight(1f) else Modifier.weight(1f, fill = false), contentAlignment = Alignment.Center) { Row(
|
||||
Box(if (centered) Modifier.weight(1f) else Modifier.weight(1f, fill = false), contentAlignment = Alignment.Center) { androidx.compose.foundation.layout.BoxWithConstraints {
|
||||
if (tabsAsMenu(maxWidth, tabs.size)) TabMenu(tabs, selected, onSelect, focus = focusRequesters) else Row(
|
||||
modifier = Modifier.clip(shape).background(colors.surfaceVariant).border(1.dp, pal.line2, shape)
|
||||
.horizontalScroll(scroll).selectableGroup().padding(3.dp),
|
||||
) {
|
||||
@@ -239,7 +240,7 @@ internal fun TabStrip(
|
||||
.padding(horizontal = tabPadding, vertical = if (compact) 6.dp else 12.dp),
|
||||
)
|
||||
}
|
||||
} }
|
||||
} } }
|
||||
if (bumpers) BumperKey("RB", stringResource(R.string.widgets_next_tab)) { onSelect((selected + 1) % tabs.size) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,10 +31,6 @@ internal fun FrameGenGroup(s: FrontEndState, a: FrontEndActions) {
|
||||
a.onFrameGenPick(mode)
|
||||
host.open = null
|
||||
},
|
||||
onImportLossless = {
|
||||
a.onImportLossless()
|
||||
host.open = null
|
||||
},
|
||||
focusModifier = Modifier.focusRequester(firstItemFocus),
|
||||
legacyButtons = true,
|
||||
)
|
||||
|
||||
@@ -82,17 +82,25 @@ import kotlinx.coroutines.withContext
|
||||
private const val WALL_MIN_GAMES = 4
|
||||
private const val WALL_DISTINCT = 40
|
||||
|
||||
private const val IDLE_FRAME_NS = 30_000_000L
|
||||
internal val IdleFrames = IdleFrameGate()
|
||||
|
||||
internal object IdleFrames {
|
||||
private var shown = 0L
|
||||
internal class IdleFrameGate {
|
||||
private var next = Long.MIN_VALUE
|
||||
private var shown = Long.MIN_VALUE
|
||||
|
||||
fun due(nanos: Long): Boolean {
|
||||
if (nanos == shown) return true
|
||||
if (nanos - shown < IDLE_FRAME_NS) return false
|
||||
// Allow sub-ms vsync jitter; carry the phase on panels whose refresh isn't a multiple of 60.
|
||||
if (nanos + VSYNC_TOLERANCE_NS < next) return false
|
||||
next = if (next == Long.MIN_VALUE || nanos - next >= FRAME_NS) nanos + FRAME_NS else next + FRAME_NS
|
||||
shown = nanos
|
||||
return true
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val FRAME_NS = 1_000_000_000L / 60
|
||||
const val VSYNC_TOLERANCE_NS = 500_000L
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
||||
@@ -36,6 +36,7 @@ internal fun sourceColours(source: String): SourceColours = when (source) {
|
||||
Store.ITCH.id -> SourceColours(Color(0xFF3A1A1E), Color(0xFFFFB3B3), Color(0xFFFF5C5C))
|
||||
Store.GAMEJOLT.id -> SourceColours(Color(0xFF232E00), Color(0xFFE3FF66), Color(0xFFCCFF00))
|
||||
Store.BATTLENET.id -> SourceColours(Color(0xFF0A2440), Color(0xFF9DD1FF), Color(0xFF148EFF))
|
||||
Store.NEXON.id -> SourceColours(Color(0xFF06303A), Color(0xFF9BE7F2), Color(0xFF00B4C8))
|
||||
Store.UBISOFT.id -> SourceColours(Color(0xFF0B1E44), Color(0xFFA8C6FF), Color(0xFF2E7DFF))
|
||||
Store.EA.id -> SourceColours(Color(0xFF3A0E12), Color(0xFFFF9A9A), Color(0xFFFF4747))
|
||||
Store.ROCKSTAR.id -> SourceColours(Color(0xFF3A2A06), Color(0xFFFFD780), Color(0xFFFCAF17))
|
||||
@@ -56,6 +57,7 @@ internal fun sourceLabel(source: String): String = when (source) {
|
||||
Store.ITCH.id -> Store.ITCH.label
|
||||
Store.GAMEJOLT.id -> Store.GAMEJOLT.label
|
||||
Store.BATTLENET.id -> Store.BATTLENET.label
|
||||
Store.NEXON.id -> Store.NEXON.label
|
||||
Store.UBISOFT.id -> Store.UBISOFT.shortLabel
|
||||
Store.EA.id -> Store.EA.label
|
||||
Store.ROCKSTAR.id -> Store.ROCKSTAR.shortLabel
|
||||
|
||||
@@ -223,7 +223,7 @@ private fun FinishedRow(d: DownloadEntry, s: FrontEndState, a: FrontEndActions,
|
||||
ArtStrip(d.cover, d.name) {
|
||||
StripLabel(d.name, d.store.id, stringResource(if (d.state == DownloadState.INSTALLED) R.string.stores_installed_chip else R.string.stores_dl_cancelled), Color.White.copy(alpha = 0.72f))
|
||||
if (d.state == DownloadState.INSTALLED) Box(Modifier.bloomIn(bloom, GATHER_HOLD_MS + 150)) {
|
||||
RoundAction(Icons.Filled.PlayArrow, stringResource(R.string.stores_play), primary = true) { if (d.key == EpicClient.DOWNLOAD_KEY) a.onEpicLauncher() else if (d.key == com.droiddeck.launcher.stores.battlenet.BattleNetClient.DOWNLOAD_KEY) a.onBattleNet() else launchStoreGame(d.store, d.id, s, a) }
|
||||
RoundAction(Icons.Filled.PlayArrow, stringResource(R.string.stores_play), primary = true) { if (d.key == EpicClient.DOWNLOAD_KEY) a.onEpicLauncher() else if (com.droiddeck.launcher.runtime.WindowsClient.all.any { it.downloadKey == d.key }) a.onClient(d.store) else launchStoreGame(d.store, d.id, s, a) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -381,7 +381,7 @@ private fun DownloadCard(d: DownloadEntry, s: FrontEndState, a: FrontEndActions)
|
||||
CancelAction { DownloadQueue.clear(ctx, d.key) }
|
||||
}
|
||||
DownloadState.INSTALLED -> Box(Modifier.bloomIn(true, 420)) {
|
||||
RoundAction(Icons.Filled.PlayArrow, stringResource(R.string.stores_play), primary = true) { if (d.key == EpicClient.DOWNLOAD_KEY) a.onEpicLauncher() else if (d.key == com.droiddeck.launcher.stores.battlenet.BattleNetClient.DOWNLOAD_KEY) a.onBattleNet() else launchStoreGame(d.store, d.id, s, a) }
|
||||
RoundAction(Icons.Filled.PlayArrow, stringResource(R.string.stores_play), primary = true) { if (d.key == EpicClient.DOWNLOAD_KEY) a.onEpicLauncher() else if (com.droiddeck.launcher.runtime.WindowsClient.all.any { it.downloadKey == d.key }) a.onClient(d.store) else launchStoreGame(d.store, d.id, s, a) }
|
||||
}
|
||||
DownloadState.CANCELLED -> {}
|
||||
}
|
||||
|
||||
@@ -470,7 +470,21 @@ private fun StoreChips(
|
||||
val tabScroll = rememberScrollState()
|
||||
Box(Modifier.fillMaxWidth()) {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(gap), verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth()) {
|
||||
Box(Modifier.weight(1f).edgeFade(tabScroll).horizontalScroll(tabScroll)) {
|
||||
val shown = tabs.filter { it.shown }.map { it.store }
|
||||
androidx.compose.foundation.layout.BoxWithConstraints(Modifier.weight(1f)) {
|
||||
if (tabsAsMenu(maxWidth, shown.size)) TabMenu(
|
||||
shown.map { it.shortLabel }, shown.indexOfFirst { it.id == selected }, { onStore(shown[it]) },
|
||||
chipModifier = shown.fold(Modifier as Modifier) { m, st -> key(st) { m.paneItem("storechip:${st.id}") } },
|
||||
descriptions = shown.map { st ->
|
||||
val signedIn = StoresState.isSignedIn(st) && StoresState.expired[st] != true
|
||||
st.label + if (signedIn || !StoresState.accountsLoaded) "" else " " + stringResource(R.string.stores_chip_signed_out)
|
||||
},
|
||||
leading = { i, inList ->
|
||||
val signedIn = StoresState.isSignedIn(shown[i]) && StoresState.expired[shown[i]] != true
|
||||
if (inList) Box(Modifier.size(12.dp).background(sourceColours(shown[i].id).dot.copy(alpha = if (signedIn) 1f else 0.35f), CircleShape))
|
||||
else StoreDot(shown[i], signedIn)
|
||||
},
|
||||
) else Box(Modifier.edgeFade(tabScroll).horizontalScroll(tabScroll)) {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(gap), verticalAlignment = Alignment.CenterVertically, modifier = Modifier.focusGroup()) {
|
||||
for (tab in tabs) {
|
||||
val store = tab.store
|
||||
@@ -492,6 +506,7 @@ private fun StoreChips(
|
||||
}
|
||||
ChipGlide(keys.indexOf(highlighted), bounds[highlighted], tint, visible = fillShown)
|
||||
}
|
||||
}
|
||||
var cogAt by remember { mutableStateOf<Rect?>(null) }
|
||||
Box(Modifier.onGloballyPositioned { cogAt = it.boundsInRoot() }) {
|
||||
IconChip(Icons.Filled.Settings, stringResource(R.string.stores_settings)) { onSettings(cogAt) }
|
||||
@@ -803,7 +818,7 @@ private fun ProfileStrip(store: Store, owned: Int, loaded: Boolean, s: FrontEndS
|
||||
}
|
||||
}
|
||||
if (store == Store.EPIC) EpicLauncherRow(s, a)
|
||||
if (store == Store.BATTLENET) BattleNetLauncherRow(s, a)
|
||||
com.droiddeck.launcher.runtime.WindowsClient.byStore(store)?.let { ClientLauncherRow(it, s, a) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -830,22 +845,23 @@ private fun OwnedLink(label: String, onClick: () -> Unit) {
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun BattleNetLauncherRow(s: FrontEndState, a: FrontEndActions) {
|
||||
private fun ClientLauncherRow(client: com.droiddeck.launcher.runtime.WindowsClient, s: FrontEndState, a: FrontEndActions) {
|
||||
val ctx = LocalContext.current
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
val title = stringResource(R.string.bnet_name)
|
||||
val title = stringResource(client.nameRes)
|
||||
val installed = client.store in s.clientsInstalled
|
||||
Box(Modifier.fillMaxWidth().height(1.dp).background(pal.line))
|
||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp), modifier = Modifier.fillMaxWidth().testTag("stores-battlenet-launcher")) {
|
||||
val icon by androidx.compose.runtime.produceState<java.io.File?>(null, s.battleNetInstalled) {
|
||||
value = if (!s.battleNetInstalled) null
|
||||
else kotlinx.coroutines.withContext(kotlinx.coroutines.Dispatchers.IO) { com.droiddeck.launcher.runtime.BattleNet.icon(ctx) }
|
||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp), modifier = Modifier.fillMaxWidth().testTag("stores-${client.store.id}-launcher")) {
|
||||
val icon by androidx.compose.runtime.produceState<java.io.File?>(null, installed) {
|
||||
value = if (!installed) null
|
||||
else kotlinx.coroutines.withContext(kotlinx.coroutines.Dispatchers.IO) { client.icon(ctx) }
|
||||
}
|
||||
if (icon != null) AsyncImage(model = icon, contentDescription = null, contentScale = ContentScale.Fit, modifier = Modifier.size(36.dp).clip(RoundedCornerShape(8.dp)))
|
||||
Text(title, fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f))
|
||||
Actions {
|
||||
SecondaryButton(stringResource(R.string.bnet_open), enabled = !s.busy, compact = true) { a.onBattleNet() }
|
||||
val entry = remember(s.battleNetInstalled) { com.droiddeck.launcher.runtime.BattleNet.launcherEntry(s.battleNetInstalled) }
|
||||
SecondaryButton(clientOpenLabel(client), enabled = !s.busy, compact = true) { a.onClient(client.store) }
|
||||
val entry = remember(installed) { client.launcherEntry(installed) }
|
||||
val scope = entry?.let { com.droiddeck.launcher.session.NoSteamLaunch.scope(it) }
|
||||
if (entry != null && scope != null) {
|
||||
val host = rememberMenuHost()
|
||||
@@ -861,6 +877,11 @@ private fun BattleNetLauncherRow(s: FrontEndState, a: FrontEndActions) {
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun clientOpenLabel(client: com.droiddeck.launcher.runtime.WindowsClient): String =
|
||||
if (client.store == Store.BATTLENET) stringResource(R.string.bnet_open)
|
||||
else stringResource(R.string.content_open_named, stringResource(client.nameRes))
|
||||
|
||||
@Composable
|
||||
private fun EpicLauncherRow(s: FrontEndState, a: FrontEndActions) {
|
||||
val ctx = LocalContext.current
|
||||
@@ -1028,6 +1049,7 @@ internal fun storePalette(base: Palette, store: Store?): Palette {
|
||||
Store.ITCH -> Color(0xFFFF5C5C) to Color(0xFFD93B3B)
|
||||
Store.GAMEJOLT -> Color(0xFFCCFF00) to Color(0xFFA3CC00)
|
||||
Store.BATTLENET -> Color(0xFF148EFF) to Color(0xFF0B6BD3)
|
||||
Store.NEXON -> Color(0xFF00B4C8) to Color(0xFF008C9E)
|
||||
Store.UBISOFT -> Color(0xFF2E7DFF) to Color(0xFF1A5BD6)
|
||||
Store.EA -> Color(0xFFFF4747) to Color(0xFFE03030)
|
||||
Store.ROCKSTAR -> Color(0xFFFCAF17) to Color(0xFFD98E00)
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.foundation.LocalIndication
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.hoverable
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
import androidx.compose.foundation.interaction.collectIsFocusedAsState
|
||||
import androidx.compose.foundation.interaction.collectIsHoveredAsState
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.ExpandLess
|
||||
import androidx.compose.material.icons.outlined.ExpandMore
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.focus.FocusRequester
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.semantics.Role
|
||||
import androidx.compose.ui.semantics.contentDescription
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
|
||||
private val TAB_MENU_BELOW = 600.dp
|
||||
private val TAB_MIN_WIDTH = 96.dp
|
||||
|
||||
/** Whether [count] tabs in [width] become a [TabMenu]: on a narrow page, when they would not fit side by side. */
|
||||
internal fun tabsAsMenu(width: Dp, count: Int): Boolean =
|
||||
count > 2 && width < TAB_MENU_BELOW && width / count < TAB_MIN_WIDTH
|
||||
|
||||
/**
|
||||
* Tabs as one chip naming the shown tab, which opens the list of them, as the second screen's
|
||||
* picker does. Each of [focus] lands on the chip, so callers that focus a tab still reach it.
|
||||
*/
|
||||
@Composable
|
||||
internal fun TabMenu(
|
||||
labels: List<String>, selected: Int, onPick: (Int) -> Unit,
|
||||
modifier: Modifier = Modifier, focus: List<FocusRequester>? = null,
|
||||
chipModifier: Modifier = Modifier, descriptions: List<String>? = null,
|
||||
leading: (@Composable (index: Int, inList: Boolean) -> Unit)? = null,
|
||||
) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
var open by remember { mutableStateOf(false) }
|
||||
val source = remember { MutableInteractionSource() }
|
||||
val hot = source.collectIsFocusedAsState().value || source.collectIsHoveredAsState().value
|
||||
val shape = RoundedCornerShape(22.dp)
|
||||
val label = labels.getOrNull(selected).orEmpty()
|
||||
val description = descriptions?.getOrNull(selected) ?: label
|
||||
val toggle = { open = !open }
|
||||
Box(modifier) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||
modifier = focus.orEmpty().fold(chipModifier.height(44.dp)) { m, r -> m.focusRequester(r) }
|
||||
.testTag("tab-menu")
|
||||
.semantics { contentDescription = description }
|
||||
.clip(shape).background(if (hot || open) pal.signal.copy(alpha = 0.14f) else colors.surfaceVariant)
|
||||
.glideBorder(hot || open, shape, pal.signal, pal.line2)
|
||||
.hoverable(source)
|
||||
.clickable(role = Role.Button, interactionSource = source, indication = LocalIndication.current, onClick = toggle)
|
||||
.controllerConfirm(onClick = toggle)
|
||||
.padding(start = 14.dp, end = 10.dp),
|
||||
) {
|
||||
if (selected in labels.indices) leading?.invoke(selected, false)
|
||||
Text(label, fontSize = 14.sp, fontWeight = FontWeight.Bold, color = colors.onBackground, maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f, fill = false))
|
||||
Icon(if (open) Icons.Outlined.ExpandLess else Icons.Outlined.ExpandMore, contentDescription = null,
|
||||
tint = colors.onSurfaceVariant, modifier = Modifier.size(20.dp))
|
||||
}
|
||||
AnchoredMenu(open, { open = false }, compact = true, minWidth = 200.dp) { first ->
|
||||
labels.forEachIndexed { i, item ->
|
||||
MenuItem(
|
||||
item, checked = i == selected,
|
||||
leading = leading?.let { { it(i, true) } },
|
||||
focusRequester = first.takeIf { i == selected || (i == 0 && selected !in labels.indices) },
|
||||
modifier = Modifier.testTag("tab-menu:$i")
|
||||
.then(descriptions?.getOrNull(i)?.let { d -> Modifier.semantics { contentDescription = d } } ?: Modifier),
|
||||
) { open = false; onPick(i) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@ import androidx.compose.animation.fadeIn
|
||||
import androidx.compose.animation.fadeOut
|
||||
import androidx.compose.animation.shrinkVertically
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.basicMarquee
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.hoverable
|
||||
@@ -25,6 +24,9 @@ import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.heightIn
|
||||
import androidx.compose.foundation.layout.RowScope
|
||||
import androidx.compose.foundation.selection.selectable
|
||||
import androidx.compose.foundation.selection.selectableGroup
|
||||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
@@ -44,6 +46,7 @@ import androidx.compose.material.icons.outlined.Science
|
||||
import androidx.compose.material.icons.outlined.SwapHoriz
|
||||
import androidx.compose.material.icons.outlined.Sync
|
||||
import androidx.compose.material.icons.outlined.Verified
|
||||
import androidx.compose.material.icons.outlined.WarningAmber
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.ui.draw.alpha
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
@@ -109,50 +112,37 @@ internal fun UpdatesPage(s: FrontEndState, a: FrontEndActions, modifier: Modifie
|
||||
val me = remember { AppUpdates.installed() }
|
||||
val colors = MaterialTheme.colorScheme
|
||||
Column(modifier = modifier) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp),
|
||||
modifier = Modifier.fillMaxWidth().padding(bottom = 10.dp),
|
||||
) {
|
||||
Text(
|
||||
stringResource(R.string.upd_build, me.version, s.buildLabel), fontSize = 12.5.sp, color = colors.onSurfaceVariant,
|
||||
maxLines = 1, modifier = Modifier.weight(1f)
|
||||
.basicMarquee(iterations = Int.MAX_VALUE, initialDelayMillis = 700, velocity = 40.dp),
|
||||
)
|
||||
val checked = u.catalog?.checkedAt?.takeIf { it > 0 }
|
||||
if (!LocalNarrowPane.current) Text(
|
||||
if (u.checking) stringResource(R.string.common_checking) else if (checked != null) stringResource(R.string.upd_checked, ago(checked).replaceFirstChar { it.lowercase() }) else stringResource(R.string.upd_not_checked),
|
||||
fontSize = 13.sp, color = colors.onSurfaceVariant,
|
||||
)
|
||||
val clipboard = LocalClipboardManager.current
|
||||
val context = LocalContext.current
|
||||
val details = buildDetails(me, s.buildLabel)
|
||||
ToolIcon(Icons.Outlined.ContentCopy, stringResource(R.string.upd_copy_build)) {
|
||||
clipboard.setText(AnnotatedString(details))
|
||||
android.widget.Toast.makeText(context, context.getString(R.string.upd_copied), android.widget.Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
ToolIcon(Icons.Outlined.Refresh, stringResource(R.string.store_check_updates), busy = u.checking, enabled = !u.checking && u.stage == null, onClick = ua.onCheck)
|
||||
}
|
||||
BoxWithConstraints(Modifier.weight(1f).fillMaxWidth()) {
|
||||
val stacked = LocalNarrowPane.current || maxWidth < 600.dp
|
||||
Column(modifier = Modifier.fillMaxSize().verticalScroll(rememberScrollState()).padding(bottom = 16.dp)) {
|
||||
SectionLabel(stringResource(R.string.upd_installed_label))
|
||||
InstalledCard(s, u, me)
|
||||
CheckRow(u, ua)
|
||||
SectionLabel(stringResource(R.string.upd_channel))
|
||||
if (stacked) {
|
||||
ChannelPicker(u, ua)
|
||||
Box(Modifier.height(14.dp))
|
||||
StatusPanel(s, u, ua, me)
|
||||
Box(Modifier.height(18.dp))
|
||||
ChannelLabel()
|
||||
ChannelPicker(u, ua, s.sessionRunning)
|
||||
} else {
|
||||
ChannelLabel()
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(18.dp)) {
|
||||
Box(Modifier.weight(1f)) { ChannelPicker(u, ua, s.sessionRunning) }
|
||||
Box(Modifier.weight(1f)) { ChannelPicker(u, ua) }
|
||||
Box(Modifier.weight(1.15f)) { StatusPanel(s, u, ua, me) }
|
||||
}
|
||||
}
|
||||
Box(Modifier.padding(top = 18.dp)) {
|
||||
ToggleRow(
|
||||
host, "build-watermark", stringResource(R.string.setup_build_watermark),
|
||||
stringResource(R.string.setup_build_watermark_hint), s.buildWatermark,
|
||||
) { a.onBuildWatermark() }
|
||||
}
|
||||
SectionLabel(stringResource(R.string.upd_testers), top = 22.dp)
|
||||
ToggleRow(
|
||||
host, "build-watermark", stringResource(R.string.setup_build_watermark),
|
||||
stringResource(R.string.setup_build_watermark_hint), s.buildWatermark,
|
||||
) { a.onBuildWatermark() }
|
||||
val context = LocalContext.current
|
||||
val agentReady = com.droiddeck.launcher.agent.AgentHost.installed &&
|
||||
(com.droiddeck.launcher.agent.AgentSetup.ready || com.droiddeck.launcher.agent.AgentSetup.completed(context))
|
||||
LabBuilds(s.sessionRunning, onRebuild = if (agentReady) { info ->
|
||||
com.droiddeck.launcher.agent.AgentHost.send(context, context.getString(R.string.agent_rebuild_lab, info.label))
|
||||
context.startActivity(android.content.Intent(context, com.droiddeck.launcher.FrontEndActivity::class.java)
|
||||
.putExtra(com.droiddeck.launcher.stores.download.StoreDownloadService.EXTRA_NAV, "agent")
|
||||
.addFlags(android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP or android.content.Intent.FLAG_ACTIVITY_REORDER_TO_FRONT))
|
||||
} else null)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -169,6 +159,112 @@ internal fun UpdatesPage(s: FrontEndState, a: FrontEndActions, modifier: Modifie
|
||||
)
|
||||
}
|
||||
|
||||
private val TEST_TINT = Color(0xFF9B6CFF)
|
||||
|
||||
@Composable
|
||||
private fun SectionLabel(text: String, top: androidx.compose.ui.unit.Dp = 4.dp) {
|
||||
Text(
|
||||
text, fontSize = 12.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 1.5.sp,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.padding(start = 2.dp, top = top, bottom = 10.dp),
|
||||
)
|
||||
}
|
||||
|
||||
/** What is installed: which kind of build, its version and versionCode, and its commit, as the first thing on the page. */
|
||||
@Composable
|
||||
private fun InstalledCard(s: FrontEndState, u: UpdatesState, me: AppUpdates.Installed) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
val catalog = u.catalog
|
||||
val lab = com.droiddeck.launcher.lab.LabOverlay.active
|
||||
val basePr = if (me.pr > 0) me.pr else Regex("""\bpr(\d+)\b""").find(s.buildLabel)?.groupValues?.get(1)?.toIntOrNull() ?: 0
|
||||
val kind = when {
|
||||
lab != null -> stringResource(R.string.upd_kind_lab)
|
||||
me.pr > 0 -> stringResource(R.string.upd_kind_test)
|
||||
catalog?.stable?.let { AppUpdates.isRunning(it, me) } == true -> stringResource(R.string.upd_stable)
|
||||
catalog?.preview?.let { AppUpdates.isRunning(it, me) } == true -> stringResource(R.string.upd_preview)
|
||||
else -> null
|
||||
}
|
||||
val tint = if (lab != null || me.pr > 0) TEST_TINT else pal.signal
|
||||
val title = when {
|
||||
lab != null -> lab.label
|
||||
me.pr > 0 -> stringResource(R.string.upd_pr, me.pr)
|
||||
else -> stringResource(R.string.upd_droiddeck_version, me.version)
|
||||
}
|
||||
val subtitle = when {
|
||||
lab != null && basePr > 0 -> stringResource(R.string.upd_lab_on_pr, basePr)
|
||||
lab != null -> stringResource(R.string.upd_lab_on_version, me.version)
|
||||
me.pr > 0 -> catalog?.tests?.firstOrNull { it.pr == me.pr }?.title?.takeIf { it.isNotBlank() }?.let(::changeTitle)
|
||||
else -> null
|
||||
}
|
||||
val built = lab?.built?.takeIf { it > 0 } ?: me.committedAt
|
||||
val meta = listOfNotNull(
|
||||
me.version.takeIf { lab != null || me.pr > 0 },
|
||||
stringResource(R.string.upd_version_code, me.versionCode),
|
||||
me.commit.take(7).takeIf { it.length == 7 },
|
||||
built.takeIf { it > 0 }?.let { stringResource(R.string.upd_built_ago, ago(it).replaceFirstChar { c -> c.lowercase() }) },
|
||||
).joinToString(" · ")
|
||||
val clipboard = LocalClipboardManager.current
|
||||
val context = LocalContext.current
|
||||
val details = buildDetails(me, s.buildLabel)
|
||||
Row(
|
||||
verticalAlignment = Alignment.Top, horizontalArrangement = Arrangement.spacedBy(12.dp),
|
||||
modifier = Modifier.fillMaxWidth().clip(Shape16).background(colors.surface).border(1.dp, pal.line, Shape16).padding(start = 18.dp, end = 12.dp, top = 14.dp, bottom = 16.dp),
|
||||
) {
|
||||
Column(Modifier.weight(1f).padding(top = 2.dp)) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
if (kind != null) Text(
|
||||
kind.uppercase(), fontSize = 10.5.sp, fontWeight = FontWeight.Bold, letterSpacing = 0.6.sp, color = tint, maxLines = 1,
|
||||
modifier = Modifier.clip(CircleShape).background(tint.copy(alpha = 0.16f)).padding(horizontal = 8.dp, vertical = 3.dp),
|
||||
)
|
||||
Text(title, fontSize = 20.sp, fontWeight = FontWeight.Bold, color = colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
}
|
||||
if (subtitle != null) Text(subtitle, fontSize = 14.sp, fontWeight = FontWeight.Medium, color = colors.onBackground, maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis, modifier = Modifier.padding(top = 6.dp))
|
||||
Text(meta, fontSize = 12.5.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(top = 4.dp))
|
||||
}
|
||||
ToolIcon(Icons.Outlined.ContentCopy, stringResource(R.string.upd_copy_build)) {
|
||||
clipboard.setText(AnnotatedString(details))
|
||||
android.widget.Toast.makeText(context, context.getString(R.string.upd_copied), android.widget.Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun CheckRow(u: UpdatesState, ua: UpdatesActions) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
val src = remember { MutableInteractionSource() }
|
||||
val hot = rememberHot(src)
|
||||
val enabled = !u.checking && u.stage == null
|
||||
val checked = u.catalog?.checkedAt?.takeIf { it > 0 }
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier.fillMaxWidth().padding(top = 6.dp, bottom = 14.dp),
|
||||
) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp),
|
||||
modifier = Modifier.offset(x = (-6).dp).paneItem("updates:check").heightIn(min = 40.dp).clip(Shape12)
|
||||
.background(if (hot) pal.signal.copy(alpha = 0.14f) else Color.Transparent)
|
||||
.glideBorder(hot, Shape12, pal.signal)
|
||||
.hoverable(src).clickable(interactionSource = src, indication = null, enabled = enabled, role = Role.Button, onClick = ua.onCheck)
|
||||
.controllerConfirm(enabled = enabled, onClick = ua.onCheck)
|
||||
.padding(horizontal = 6.dp),
|
||||
) {
|
||||
if (u.checking) androidx.compose.material3.CircularProgressIndicator(Modifier.size(16.dp), color = pal.signal, strokeWidth = 2.dp)
|
||||
else Icon(Icons.Outlined.Refresh, contentDescription = null, tint = pal.signal.copy(alpha = if (enabled) 1f else 0.5f), modifier = Modifier.size(18.dp))
|
||||
Text(
|
||||
if (u.checking) stringResource(R.string.common_checking) else stringResource(R.string.upd_check_now),
|
||||
fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = pal.signal.copy(alpha = if (enabled || u.checking) 1f else 0.5f),
|
||||
)
|
||||
}
|
||||
Box(Modifier.weight(1f))
|
||||
Text(
|
||||
if (checked != null) stringResource(R.string.upd_checked, ago(checked).replaceFirstChar { it.lowercase() }) else stringResource(R.string.upd_not_checked),
|
||||
fontSize = 12.5.sp, color = colors.onSurfaceVariant, maxLines = 1,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun StatusPanel(s: FrontEndState, u: UpdatesState, ua: UpdatesActions, me: AppUpdates.Installed) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
@@ -201,12 +297,18 @@ private fun StatusPanel(s: FrontEndState, u: UpdatesState, ua: UpdatesActions, m
|
||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(7.dp)) {
|
||||
Box(Modifier.size(7.dp).clip(CircleShape).background(look.tint))
|
||||
Text(look.status, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, color = look.tint)
|
||||
if (offered) Text(stringResource(R.string.upd_dot_ago, ago(release!!.publishedAt)), fontSize = 13.sp, color = colors.onSurfaceVariant)
|
||||
}
|
||||
Text(look.headline, fontSize = 22.sp, fontWeight = FontWeight.Bold, color = colors.onBackground, modifier = Modifier.padding(top = 4.dp))
|
||||
if (offered) {
|
||||
ReleaseNotes(changeTitle(release!!.title.ifBlank { release.tag }), release.summary, release.tag)
|
||||
ReleaseFacts(release)
|
||||
val size = release!!.apk?.size?.takeIf { it > 0 }?.let { megabytes(it) }
|
||||
Text(
|
||||
listOfNotNull(stringResource(R.string.upd_released_ago, ago(release.publishedAt)), size).joinToString(" · "),
|
||||
fontSize = 12.5.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(top = 2.dp),
|
||||
)
|
||||
val older = (release.committedAt.takeIf { it > 0 } ?: release.publishedAt).let { it > 0 && me.committedAt > 0 && it < me.committedAt }
|
||||
if (offer == Offer.SWITCH && older) OlderNote(me.committedAt)
|
||||
val title = changeTitle(release.title.ifBlank { release.tag })
|
||||
ReleaseNotes(title.takeUnless { it == look.headline || (release.version != null && it.endsWith(release.version)) }, release.summary, release.tag)
|
||||
}
|
||||
if (release != null && u.follow.channel == Channel.TEST && catalog != null) {
|
||||
androidx.compose.runtime.LaunchedEffect(release.tag, release.commit, release.apk?.sha256) { ua.onSeen(release) }
|
||||
@@ -228,8 +330,10 @@ private fun StatusPanel(s: FrontEndState, u: UpdatesState, ua: UpdatesActions, m
|
||||
else LinearProgressIndicator(modifier = Modifier.fillMaxWidth().height(6.dp).clip(CircleShape))
|
||||
}
|
||||
offered && installBlock != null -> Unit
|
||||
offer == Offer.UPDATE -> PrimaryButton(stringResource(R.string.upd_update_button, button), enabled = installable, main = true) { ua.onInstall(release!!) }
|
||||
offer == Offer.SWITCH -> PrimaryButton(stringResource(R.string.upd_install_button, button), enabled = installable, main = true) { ua.onInstall(release!!) }
|
||||
offer == Offer.UPDATE -> PrimaryButton(stringResource(R.string.upd_update_button, button), enabled = installable, main = true, fill = true,
|
||||
modifier = Modifier.fillMaxWidth()) { ua.onInstall(release!!) }
|
||||
offer == Offer.SWITCH -> PrimaryButton(stringResource(R.string.upd_switch_to_button, channelTitle(u.follow), button), enabled = installable, main = true,
|
||||
fill = true, modifier = Modifier.fillMaxWidth()) { ua.onInstall(release!!) }
|
||||
offer == Offer.AHEAD && u.follow.channel == Channel.STABLE && installBlock == null ->
|
||||
SecondaryButton(stringResource(R.string.upd_install_anyway, release?.version.orEmpty()), enabled = installable) { ua.onInstall(release!!) }
|
||||
offer == Offer.GONE -> PrimaryButton(stringResource(R.string.upd_follow_preview), main = true) { ua.onFollow(Follow(Channel.NIGHTLY)) }
|
||||
@@ -238,25 +342,53 @@ private fun StatusPanel(s: FrontEndState, u: UpdatesState, ua: UpdatesActions, m
|
||||
if (s.sessionRunning && (offered || offer == Offer.AHEAD)) {
|
||||
Text(stringResource(R.string.upd_stop_session), fontSize = 12.5.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(top = 8.dp))
|
||||
}
|
||||
if (offered) ReleaseFacts(release!!)
|
||||
if (u.follow.channel == Channel.NIGHTLY) {
|
||||
PreviewHistory(catalog, me, s, u, ua)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** A switch that installs a build made before the installed one; Android keeps the app's data across it. */
|
||||
@Composable
|
||||
private fun ReleaseNotes(title: String, notes: String, key: String) {
|
||||
private fun OlderNote(installedAt: Long) {
|
||||
val context = LocalContext.current
|
||||
val date = android.text.format.DateUtils.formatDateTime(context, installedAt,
|
||||
android.text.format.DateUtils.FORMAT_SHOW_DATE or android.text.format.DateUtils.FORMAT_ABBREV_MONTH)
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp),
|
||||
modifier = Modifier.padding(top = 12.dp).fillMaxWidth().clip(Shape12).background(AttentionAmber.copy(alpha = 0.12f))
|
||||
.padding(horizontal = 12.dp, vertical = 10.dp),
|
||||
) {
|
||||
Icon(Icons.Outlined.WarningAmber, contentDescription = null, tint = AttentionAmber, modifier = Modifier.size(20.dp))
|
||||
Column {
|
||||
Text(stringResource(R.string.upd_older_than_installed, date), fontSize = 13.sp, fontWeight = FontWeight.SemiBold, color = AttentionAmber)
|
||||
Text(stringResource(R.string.upd_data_stays), fontSize = 12.5.sp, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun channelTitle(f: Follow) = when (f.channel) {
|
||||
Channel.STABLE -> stringResource(R.string.upd_stable)
|
||||
Channel.NIGHTLY -> stringResource(R.string.upd_preview)
|
||||
Channel.TEST -> stringResource(R.string.upd_pr, f.pr)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ReleaseNotes(title: String?, notes: String, key: String) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
var open by rememberSaveable(key) { mutableStateOf(false) }
|
||||
var cut by remember(key) { mutableStateOf(false) }
|
||||
Text(
|
||||
if (title != null) Text(
|
||||
title, fontSize = 15.sp, color = colors.onBackground, maxLines = if (open) Int.MAX_VALUE else 2, overflow = TextOverflow.Ellipsis,
|
||||
onTextLayout = { if (it.hasVisualOverflow) cut = true }, modifier = Modifier.padding(top = 10.dp),
|
||||
)
|
||||
if (notes.isNotBlank()) Text(
|
||||
notes, fontSize = 13.5.sp, color = colors.onSurfaceVariant, maxLines = if (open) Int.MAX_VALUE else 1, overflow = TextOverflow.Ellipsis,
|
||||
onTextLayout = { if (it.hasVisualOverflow) cut = true }, modifier = Modifier.padding(top = 4.dp),
|
||||
notes, fontSize = 13.5.sp, color = colors.onSurfaceVariant, maxLines = if (open) Int.MAX_VALUE else if (title == null) 3 else 1,
|
||||
overflow = TextOverflow.Ellipsis, onTextLayout = { if (it.hasVisualOverflow) cut = true },
|
||||
modifier = Modifier.padding(top = if (title == null) 10.dp else 4.dp),
|
||||
)
|
||||
if (cut || open) {
|
||||
val src = remember { MutableInteractionSource() }
|
||||
@@ -287,47 +419,76 @@ private fun changeTitle(t: String): String =
|
||||
private fun megabytes(bytes: Long) = stringResource(R.string.upd_mb, ((bytes + 524_288) / 1_048_576).toInt())
|
||||
|
||||
@Composable
|
||||
private fun ChannelLabel() {
|
||||
Text(
|
||||
stringResource(R.string.upd_channel), fontSize = 12.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 1.5.sp,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.padding(start = 2.dp, top = 2.dp, bottom = 10.dp),
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ChannelPicker(u: UpdatesState, ua: UpdatesActions, sessionRunning: Boolean) {
|
||||
private fun ChannelPicker(u: UpdatesState, ua: UpdatesActions) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
val catalog = u.catalog
|
||||
val tests = catalog?.tests.orEmpty()
|
||||
val me = remember { AppUpdates.installed() }
|
||||
val ready = tests.count { AppUpdates.installable(it, me) }
|
||||
var showTests by rememberSaveable { mutableStateOf(false) }
|
||||
val listing = (showTests || u.follow.channel == Channel.TEST) && tests.isNotEmpty()
|
||||
val shown = if (listing || showTests) Channel.TEST else u.follow.channel
|
||||
Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
ChannelCard(
|
||||
Icons.Outlined.Verified, stringResource(R.string.upd_stable), stringResource(R.string.upd_stable_hint),
|
||||
catalog?.stable?.let { stringResource(R.string.upd_version_ago, it.version ?: it.tag, ago(it.publishedAt)) }, u.follow.channel == Channel.STABLE,
|
||||
) { ua.onFollow(Follow(Channel.STABLE)) }
|
||||
ChannelCard(
|
||||
Icons.Outlined.Bolt, stringResource(R.string.upd_preview), stringResource(R.string.upd_preview_hint),
|
||||
catalog?.preview?.let { ago(it.publishedAt) }, u.follow.channel == Channel.NIGHTLY,
|
||||
) { ua.onFollow(Follow(Channel.NIGHTLY)) }
|
||||
ChannelCard(
|
||||
Icons.Outlined.Science, stringResource(R.string.upd_tests), stringResource(R.string.upd_tests_hint),
|
||||
if (tests.isEmpty()) stringResource(R.string.upd_tests_none) else pluralStringResource(R.plurals.upd_tests_count, ready, ready),
|
||||
u.follow.channel == Channel.TEST, enabled = tests.isNotEmpty() || u.follow.channel == Channel.TEST,
|
||||
) { showTests = !showTests }
|
||||
AnimatedVisibility((showTests || u.follow.channel == Channel.TEST) && tests.isNotEmpty(), enter = expandVertically(Motion.sp(1f)) + fadeIn(Motion.sp(1f)), exit = shrinkVertically(Motion.sp(1f)) + fadeOut(Motion.sp(1f))) {
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.spacedBy(4.dp),
|
||||
modifier = Modifier.fillMaxWidth().clip(CircleShape).background(colors.surface).border(1.dp, pal.line, CircleShape)
|
||||
.padding(4.dp).selectableGroup(),
|
||||
) {
|
||||
ChannelSegment(Icons.Outlined.Verified, stringResource(R.string.upd_stable), null, shown == Channel.STABLE) {
|
||||
showTests = false; ua.onFollow(Follow(Channel.STABLE))
|
||||
}
|
||||
ChannelSegment(Icons.Outlined.Bolt, stringResource(R.string.upd_preview), null, shown == Channel.NIGHTLY) {
|
||||
showTests = false; ua.onFollow(Follow(Channel.NIGHTLY))
|
||||
}
|
||||
ChannelSegment(
|
||||
Icons.Outlined.Science, stringResource(R.string.upd_tests_short), ready.takeIf { it > 0 }?.toString(),
|
||||
shown == Channel.TEST, enabled = tests.isNotEmpty() || u.follow.channel == Channel.TEST,
|
||||
) { showTests = !showTests }
|
||||
}
|
||||
val hint = when {
|
||||
listing || u.follow.channel == Channel.TEST -> stringResource(R.string.upd_tests_hint)
|
||||
u.follow.channel == Channel.NIGHTLY -> stringResource(R.string.upd_preview_hint) +
|
||||
(catalog?.preview?.let { " · " + stringResource(R.string.upd_latest_ago, ago(it.publishedAt)) } ?: "")
|
||||
else -> stringResource(R.string.upd_stable_hint) +
|
||||
(catalog?.stable?.let { " · " + stringResource(R.string.upd_version_ago, it.version ?: it.tag, ago(it.publishedAt)) } ?: "")
|
||||
}
|
||||
Text(hint, fontSize = 12.5.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(horizontal = 4.dp))
|
||||
if (tests.isEmpty() && catalog != null && showTests) Text(stringResource(R.string.upd_tests_none), fontSize = 12.5.sp, color = colors.onSurfaceVariant)
|
||||
AnimatedVisibility(listing, enter = expandVertically(Motion.sp(1f)) + fadeIn(Motion.sp(1f)), exit = shrinkVertically(Motion.sp(1f)) + fadeOut(Motion.sp(1f))) {
|
||||
TestList(tests, me, u, ua)
|
||||
}
|
||||
val context = androidx.compose.ui.platform.LocalContext.current
|
||||
val agentReady = com.droiddeck.launcher.agent.AgentHost.installed &&
|
||||
(com.droiddeck.launcher.agent.AgentSetup.ready || com.droiddeck.launcher.agent.AgentSetup.completed(context))
|
||||
LabBuilds(sessionRunning, onRebuild = if (agentReady) { info ->
|
||||
com.droiddeck.launcher.agent.AgentHost.send(context, context.getString(R.string.agent_rebuild_lab, info.label))
|
||||
context.startActivity(android.content.Intent(context, com.droiddeck.launcher.FrontEndActivity::class.java)
|
||||
.putExtra(com.droiddeck.launcher.stores.download.StoreDownloadService.EXTRA_NAV, "agent")
|
||||
.addFlags(android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP or android.content.Intent.FLAG_ACTIVITY_REORDER_TO_FRONT))
|
||||
} else null)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun RowScope.ChannelSegment(
|
||||
icon: ImageVector, title: String, badge: String?, selected: Boolean,
|
||||
enabled: Boolean = true, onClick: () -> Unit,
|
||||
) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
val src = remember { MutableInteractionSource() }
|
||||
val hot = rememberHot(src)
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp, Alignment.CenterHorizontally),
|
||||
modifier = Modifier.weight(1f).heightIn(min = 44.dp).paneItem("channel:$title")
|
||||
.clip(CircleShape)
|
||||
.background(if (selected) pal.signal.copy(alpha = 0.16f) else if (hot) pal.signal.copy(alpha = 0.10f) else Color.Transparent)
|
||||
.glideBorder(hot, CircleShape, pal.signal, if (selected) pal.signal else Color.Transparent)
|
||||
.alpha(if (enabled) 1f else 0.5f)
|
||||
.hoverable(src)
|
||||
.selectable(selected = selected, interactionSource = src, indication = null, enabled = enabled, role = Role.RadioButton, onClick = onClick)
|
||||
.controllerConfirm(enabled = enabled, onClick = onClick)
|
||||
.padding(horizontal = 6.dp),
|
||||
) {
|
||||
Icon(icon, contentDescription = null, tint = if (selected) pal.signal else colors.onSurfaceVariant, modifier = Modifier.size(18.dp))
|
||||
Text(title, fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = if (selected) colors.onBackground else colors.onSurfaceVariant,
|
||||
maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f, fill = false))
|
||||
if (badge != null) Text(
|
||||
badge, fontSize = 11.sp, fontWeight = FontWeight.Bold, color = colors.onSurfaceVariant,
|
||||
modifier = Modifier.clip(CircleShape).background(colors.surfaceVariant).padding(horizontal = 6.dp, vertical = 1.dp),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -542,41 +703,6 @@ private fun TestList(tests: List<Release>, me: AppUpdates.Installed, u: UpdatesS
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ChannelCard(
|
||||
icon: ImageVector, title: String, hint: String, latest: String?, selected: Boolean,
|
||||
enabled: Boolean = true, onClick: () -> Unit,
|
||||
) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
val src = remember { MutableInteractionSource() }
|
||||
val hot = rememberHot(src)
|
||||
val fill = if (hot) pal.signal.copy(alpha = 0.14f) else Color.Transparent
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(14.dp),
|
||||
modifier = Modifier.fillMaxWidth().paneItem("channel:$title")
|
||||
.clip(Shape14).background(colors.surface).background(fill).glideBorder(hot, Shape14, pal.signal, pal.line)
|
||||
.alpha(if (enabled) 1f else 0.55f)
|
||||
.hoverable(src)
|
||||
.clickable(interactionSource = src, indication = null, enabled = enabled, role = Role.RadioButton, onClick = onClick)
|
||||
.controllerConfirm(enabled = enabled, onClick = onClick)
|
||||
.padding(horizontal = 14.dp, vertical = 10.dp),
|
||||
) {
|
||||
Box(contentAlignment = Alignment.Center, modifier = Modifier.size(38.dp).clip(Shape12).background(if (selected) pal.signal.copy(alpha = 0.18f) else colors.surfaceVariant)) {
|
||||
Icon(icon, contentDescription = null, tint = if (selected) pal.signal else colors.onSurfaceVariant, modifier = Modifier.size(22.dp))
|
||||
}
|
||||
Column(modifier = Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(2.dp)) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
Text(title, fontSize = 16.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground)
|
||||
if (latest != null) Text(latest, fontSize = 12.sp, fontWeight = FontWeight.Medium, color = if (selected) pal.signal else colors.onSurfaceVariant, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
}
|
||||
Text(hint, fontSize = 12.5.sp, color = colors.onSurfaceVariant, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
}
|
||||
RadioDot(selected)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun RadioDot(selected: Boolean, size: androidx.compose.ui.unit.Dp = 22.dp) {
|
||||
val pal = LocalPalette.current
|
||||
|
||||
@@ -9,6 +9,10 @@ public final class WaylandCompositor {
|
||||
|
||||
private WaylandCompositor() {}
|
||||
|
||||
public static native boolean frameWorkerProbeEnabled();
|
||||
public static native boolean frameWorkerProbeGrant(int owner, int pid, long expires, String path, long dev, long ino, long startTicks);
|
||||
public static native void frameWorkerProbeRevoke(int owner, int pid);
|
||||
|
||||
private static volatile Runnable firstFrameListener;
|
||||
|
||||
public static void setFirstFrameListener(Runnable r) { firstFrameListener = r; }
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG تكيّفي %1$d</string>
|
||||
<string name="lsfg_needs_steam">يتطلب Lossless Scaling على Steam</string>
|
||||
<string name="lsfg_needs_install">ثبّت Lossless Scaling في Steam أو استورد Lossless.dll</string>
|
||||
<string name="lsfg_import">استيراد Lossless.dll…</string>
|
||||
<string name="lsfg_using_steam">يتم استخدام النسخة الموجودة في Steam</string>
|
||||
<string name="lsfg_using_import">يتم استخدام نسخة مستوردة</string>
|
||||
<string name="lsfg_pick_title">اختر Lossless.dll</string>
|
||||
<string name="lsfg_imported">تم استيراد Lossless.dll</string>
|
||||
<string name="lsfg_import_unchanged">ملف Lossless.dll هذا قيد الاستخدام بالفعل</string>
|
||||
<string name="lsfg_import_not_owned">حساب Steam هذا لا يملك Lossless Scaling</string>
|
||||
<string name="lsfg_import_invalid">هذا الملف ليس Lossless.dll الخاص بـ Lossless Scaling</string>
|
||||
<string name="lsfg_import_failed">تعذّر تجهيز LSFG من ملف Lossless.dll هذا</string>
|
||||
<string name="lsfg_problem_missing">يتطلب LSFG برنامج Lossless Scaling من Steam أو ملف Lossless.dll مستوردًا</string>
|
||||
<string name="lsfg_problem_failed">تعذّر على LSFG تجهيز أدوات التظليل من Lossless.dll</string>
|
||||
<string name="hud_fg_unsupported">%1$s: غير مدعوم</string>
|
||||
<string name="hud_fg_failed">%1$s: فشل المحرك</string>
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG adaptativo %1$d</string>
|
||||
<string name="lsfg_needs_steam">Requiere Lossless Scaling en Steam</string>
|
||||
<string name="lsfg_needs_install">Instala Lossless Scaling en Steam o importa Lossless.dll</string>
|
||||
<string name="lsfg_import">Importar Lossless.dll…</string>
|
||||
<string name="lsfg_using_steam">Usando la copia de Steam</string>
|
||||
<string name="lsfg_using_import">Usando una copia importada</string>
|
||||
<string name="lsfg_pick_title">Elegir Lossless.dll</string>
|
||||
<string name="lsfg_imported">Lossless.dll importado</string>
|
||||
<string name="lsfg_import_unchanged">Este Lossless.dll ya está en uso</string>
|
||||
<string name="lsfg_import_not_owned">Lossless Scaling no está en esta cuenta de Steam</string>
|
||||
<string name="lsfg_import_invalid">Este archivo no es el Lossless.dll de Lossless Scaling</string>
|
||||
<string name="lsfg_import_failed">No se pudo preparar LSFG con este Lossless.dll</string>
|
||||
<string name="lsfg_problem_missing">LSFG necesita Lossless Scaling de Steam o un Lossless.dll importado</string>
|
||||
<string name="lsfg_problem_failed">LSFG no pudo preparar sus shaders desde Lossless.dll</string>
|
||||
<string name="hud_fg_unsupported">%1$s: no compatible</string>
|
||||
<string name="hud_fg_failed">%1$s: falló el motor</string>
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG Адаптивно %1$d</string>
|
||||
<string name="lsfg_needs_steam">Изисква Lossless Scaling в Steam</string>
|
||||
<string name="lsfg_needs_install">Инсталирайте Lossless Scaling в Steam или импортирайте Lossless.dll</string>
|
||||
<string name="lsfg_import">Импортиране на Lossless.dll…</string>
|
||||
<string name="lsfg_using_steam">Използва се копието от Steam</string>
|
||||
<string name="lsfg_using_import">Използва се импортирано копие</string>
|
||||
<string name="lsfg_pick_title">Изберете Lossless.dll</string>
|
||||
<string name="lsfg_imported">Lossless.dll е импортиран</string>
|
||||
<string name="lsfg_import_unchanged">Този Lossless.dll вече се използва</string>
|
||||
<string name="lsfg_import_not_owned">Lossless Scaling не е закупен за този акаунт в Steam</string>
|
||||
<string name="lsfg_import_invalid">Този файл не е Lossless.dll на Lossless Scaling</string>
|
||||
<string name="lsfg_import_failed">LSFG не можа да се подготви от този Lossless.dll</string>
|
||||
<string name="lsfg_problem_missing">LSFG изисква Lossless Scaling от Steam или импортиран Lossless.dll</string>
|
||||
<string name="lsfg_problem_failed">LSFG не можа да подготви шейдърите си от Lossless.dll</string>
|
||||
<string name="hud_fg_unsupported">%1$s: не се поддържа</string>
|
||||
<string name="hud_fg_failed">%1$s: грешка в двигателя</string>
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG Adaptivní %1$d</string>
|
||||
<string name="lsfg_needs_steam">Vyžaduje Lossless Scaling na Steamu</string>
|
||||
<string name="lsfg_needs_install">Nainstalujte Lossless Scaling ve Steamu nebo naimportujte Lossless.dll</string>
|
||||
<string name="lsfg_import">Importovat Lossless.dll…</string>
|
||||
<string name="lsfg_using_steam">Používá se kopie ze Steamu</string>
|
||||
<string name="lsfg_using_import">Používá se importovaná kopie</string>
|
||||
<string name="lsfg_pick_title">Vyberte Lossless.dll</string>
|
||||
<string name="lsfg_imported">Lossless.dll byl importován</string>
|
||||
<string name="lsfg_import_unchanged">Tento Lossless.dll se už používá</string>
|
||||
<string name="lsfg_import_not_owned">Tento účet Steamu nevlastní Lossless Scaling</string>
|
||||
<string name="lsfg_import_invalid">Tento soubor není Lossless.dll aplikace Lossless Scaling</string>
|
||||
<string name="lsfg_import_failed">Z tohoto souboru Lossless.dll se nepodařilo připravit LSFG</string>
|
||||
<string name="lsfg_problem_missing">LSFG vyžaduje Lossless Scaling ze Steamu nebo importovaný Lossless.dll</string>
|
||||
<string name="lsfg_problem_failed">LSFG se nepodařilo připravit shadery z Lossless.dll</string>
|
||||
<string name="hud_fg_unsupported">%1$s: nepodporováno</string>
|
||||
<string name="hud_fg_failed">%1$s: chyba enginu</string>
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG Adaptiv %1$d</string>
|
||||
<string name="lsfg_needs_steam">Kræver Lossless Scaling på Steam</string>
|
||||
<string name="lsfg_needs_install">Installer Lossless Scaling via Steam, eller importer Lossless.dll</string>
|
||||
<string name="lsfg_import">Importer Lossless.dll…</string>
|
||||
<string name="lsfg_using_steam">Bruger kopien fra Steam</string>
|
||||
<string name="lsfg_using_import">Bruger en importeret kopi</string>
|
||||
<string name="lsfg_pick_title">Vælg Lossless.dll</string>
|
||||
<string name="lsfg_imported">Lossless.dll importeret</string>
|
||||
<string name="lsfg_import_unchanged">Denne Lossless.dll er allerede i brug</string>
|
||||
<string name="lsfg_import_not_owned">Lossless Scaling ejes ikke på denne Steam-konto</string>
|
||||
<string name="lsfg_import_invalid">Denne fil er ikke Lossless Scalings Lossless.dll</string>
|
||||
<string name="lsfg_import_failed">Kunne ikke forberede LSFG fra denne Lossless.dll</string>
|
||||
<string name="lsfg_problem_missing">LSFG kræver Lossless Scaling fra Steam eller en importeret Lossless.dll</string>
|
||||
<string name="lsfg_problem_failed">LSFG kunne ikke forberede sine shadere fra Lossless.dll</string>
|
||||
<string name="hud_fg_unsupported">%1$s: ikke understøttet</string>
|
||||
<string name="hud_fg_failed">%1$s: motoren fejlede</string>
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG Adaptiv %1$d</string>
|
||||
<string name="lsfg_needs_steam">Benötigt Lossless Scaling auf Steam</string>
|
||||
<string name="lsfg_needs_install">Installiere Lossless Scaling in Steam oder importiere Lossless.dll</string>
|
||||
<string name="lsfg_import">Lossless.dll importieren…</string>
|
||||
<string name="lsfg_using_steam">Kopie aus Steam wird verwendet</string>
|
||||
<string name="lsfg_using_import">Importierte Kopie wird verwendet</string>
|
||||
<string name="lsfg_pick_title">Lossless.dll auswählen</string>
|
||||
<string name="lsfg_imported">Lossless.dll importiert</string>
|
||||
<string name="lsfg_import_unchanged">Diese Lossless.dll wird bereits verwendet</string>
|
||||
<string name="lsfg_import_not_owned">Dieses Steam-Konto besitzt Lossless Scaling nicht</string>
|
||||
<string name="lsfg_import_invalid">Diese Datei ist nicht die Lossless.dll von Lossless Scaling</string>
|
||||
<string name="lsfg_import_failed">LSFG konnte aus dieser Lossless.dll nicht vorbereitet werden</string>
|
||||
<string name="lsfg_problem_missing">LSFG benötigt Lossless Scaling aus Steam oder eine importierte Lossless.dll</string>
|
||||
<string name="lsfg_problem_failed">LSFG konnte seine Shader nicht aus Lossless.dll vorbereiten</string>
|
||||
<string name="hud_fg_unsupported">%1$s: nicht unterstützt</string>
|
||||
<string name="hud_fg_failed">%1$s: Engine-Fehler</string>
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG προσαρμοστικό %1$d</string>
|
||||
<string name="lsfg_needs_steam">Απαιτεί το Lossless Scaling στο Steam</string>
|
||||
<string name="lsfg_needs_install">Εγκαταστήστε το Lossless Scaling στο Steam ή εισαγάγετε το Lossless.dll</string>
|
||||
<string name="lsfg_import">Εισαγωγή Lossless.dll…</string>
|
||||
<string name="lsfg_using_steam">Χρήση του αντιγράφου από το Steam</string>
|
||||
<string name="lsfg_using_import">Χρήση ενός εισαγμένου αντιγράφου</string>
|
||||
<string name="lsfg_pick_title">Επιλογή Lossless.dll</string>
|
||||
<string name="lsfg_imported">Το Lossless.dll εισήχθη</string>
|
||||
<string name="lsfg_import_unchanged">Αυτό το Lossless.dll χρησιμοποιείται ήδη</string>
|
||||
<string name="lsfg_import_not_owned">Αυτός ο λογαριασμός Steam δεν κατέχει το Lossless Scaling</string>
|
||||
<string name="lsfg_import_invalid">Αυτό το αρχείο δεν είναι το Lossless.dll του Lossless Scaling</string>
|
||||
<string name="lsfg_import_failed">Δεν ήταν δυνατή η προετοιμασία του LSFG από αυτό το Lossless.dll</string>
|
||||
<string name="lsfg_problem_missing">Το LSFG απαιτεί το Lossless Scaling από το Steam ή ένα εισαγμένο Lossless.dll</string>
|
||||
<string name="lsfg_problem_failed">Το LSFG δεν μπόρεσε να προετοιμάσει τα shaders του από το Lossless.dll</string>
|
||||
<string name="hud_fg_unsupported">%1$s: μη υποστηριζόμενο</string>
|
||||
<string name="hud_fg_failed">%1$s: αποτυχία μηχανής</string>
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG adaptativo %1$d</string>
|
||||
<string name="lsfg_needs_steam">Requiere Lossless Scaling en Steam</string>
|
||||
<string name="lsfg_needs_install">Instala Lossless Scaling en Steam o importa Lossless.dll</string>
|
||||
<string name="lsfg_import">Importar Lossless.dll…</string>
|
||||
<string name="lsfg_using_steam">Usando la copia de Steam</string>
|
||||
<string name="lsfg_using_import">Usando una copia importada</string>
|
||||
<string name="lsfg_pick_title">Elegir Lossless.dll</string>
|
||||
<string name="lsfg_imported">Lossless.dll importado</string>
|
||||
<string name="lsfg_import_unchanged">Este Lossless.dll ya está en uso</string>
|
||||
<string name="lsfg_import_not_owned">Lossless Scaling no está en esta cuenta de Steam</string>
|
||||
<string name="lsfg_import_invalid">Este archivo no es el Lossless.dll de Lossless Scaling</string>
|
||||
<string name="lsfg_import_failed">No se pudo preparar LSFG con este Lossless.dll</string>
|
||||
<string name="lsfg_problem_missing">LSFG necesita Lossless Scaling de Steam o un Lossless.dll importado</string>
|
||||
<string name="lsfg_problem_failed">LSFG no pudo preparar sus shaders desde Lossless.dll</string>
|
||||
<string name="hud_fg_unsupported">%1$s: no compatible</string>
|
||||
<string name="hud_fg_failed">%1$s: falló el motor</string>
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG Mukautuva %1$d</string>
|
||||
<string name="lsfg_needs_steam">Vaatii Lossless Scalingin Steamista</string>
|
||||
<string name="lsfg_needs_install">Asenna Lossless Scaling Steamista tai tuo Lossless.dll</string>
|
||||
<string name="lsfg_import">Tuo Lossless.dll…</string>
|
||||
<string name="lsfg_using_steam">Käytössä on Steamin kopio</string>
|
||||
<string name="lsfg_using_import">Käytössä on tuotu kopio</string>
|
||||
<string name="lsfg_pick_title">Valitse Lossless.dll</string>
|
||||
<string name="lsfg_imported">Lossless.dll tuotu</string>
|
||||
<string name="lsfg_import_unchanged">Tämä Lossless.dll on jo käytössä</string>
|
||||
<string name="lsfg_import_not_owned">Lossless Scaling ei ole tämän Steam-tilin omistuksessa</string>
|
||||
<string name="lsfg_import_invalid">Tämä tiedosto ei ole Lossless Scalingin Lossless.dll</string>
|
||||
<string name="lsfg_import_failed">LSFG:n valmistelu tästä Lossless.dll-tiedostosta epäonnistui</string>
|
||||
<string name="lsfg_problem_missing">LSFG tarvitsee Lossless Scalingin Steamista tai tuodun Lossless.dll-tiedoston</string>
|
||||
<string name="lsfg_problem_failed">LSFG ei pystynyt valmistelemaan sävyttimiään Lossless.dll-tiedostosta</string>
|
||||
<string name="hud_fg_unsupported">%1$s: ei tuettu</string>
|
||||
<string name="hud_fg_failed">%1$s: moottori epäonnistui</string>
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG Adaptatif %1$d</string>
|
||||
<string name="lsfg_needs_steam">Nécessite Lossless Scaling sur Steam</string>
|
||||
<string name="lsfg_needs_install">Installez Lossless Scaling sur Steam ou importez Lossless.dll</string>
|
||||
<string name="lsfg_import">Importer Lossless.dll…</string>
|
||||
<string name="lsfg_using_steam">Utilise la version sur Steam</string>
|
||||
<string name="lsfg_using_import">Utilise la version importée</string>
|
||||
<string name="lsfg_pick_title">Sélectionner le fichier Lossless.dll</string>
|
||||
<string name="lsfg_imported">Lossless.dll importé</string>
|
||||
<string name="lsfg_import_unchanged">Ce Lossless.dll est déjà utilisé</string>
|
||||
<string name="lsfg_import_not_owned">Ce compte Steam ne possède pas Lossless Scaling</string>
|
||||
<string name="lsfg_import_invalid">Ce fichier n\'est pas le Lossless.dll de Lossless Scaling</string>
|
||||
<string name="lsfg_import_failed">Impossible de préparer LSFG à partir de ce Lossless.dll</string>
|
||||
<string name="lsfg_problem_missing">LSFG nécessite Lossless Scaling depuis Steam, ou un fichier Lossless.dll importé</string>
|
||||
<string name="lsfg_problem_failed">LSFG ne peut pas préparer ses shaders à partir de ce Lossless.dll</string>
|
||||
<string name="hud_fg_unsupported">%1$s : non pris en charge</string>
|
||||
<string name="hud_fg_failed">%1$s : échec du moteur</string>
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG एडैप्टिव %1$d</string>
|
||||
<string name="lsfg_needs_steam">Steam पर Lossless Scaling की ज़रूरत है</string>
|
||||
<string name="lsfg_needs_install">Steam में Lossless Scaling इंस्टॉल करें या Lossless.dll इंपोर्ट करें</string>
|
||||
<string name="lsfg_import">Lossless.dll इंपोर्ट करें…</string>
|
||||
<string name="lsfg_using_steam">Steam वाली कॉपी का उपयोग हो रहा है</string>
|
||||
<string name="lsfg_using_import">इंपोर्ट की गई कॉपी का उपयोग हो रहा है</string>
|
||||
<string name="lsfg_pick_title">Lossless.dll चुनें</string>
|
||||
<string name="lsfg_imported">Lossless.dll इंपोर्ट हो गई</string>
|
||||
<string name="lsfg_import_unchanged">यह Lossless.dll पहले से उपयोग में है</string>
|
||||
<string name="lsfg_import_not_owned">इस Steam खाते में Lossless Scaling नहीं है</string>
|
||||
<string name="lsfg_import_invalid">यह फ़ाइल Lossless Scaling की Lossless.dll नहीं है</string>
|
||||
<string name="lsfg_import_failed">इस Lossless.dll से LSFG तैयार नहीं हो सका</string>
|
||||
<string name="lsfg_problem_missing">LSFG को Steam से Lossless Scaling या इंपोर्ट की गई Lossless.dll चाहिए</string>
|
||||
<string name="lsfg_problem_failed">LSFG अपने शेडर Lossless.dll से तैयार नहीं कर सका</string>
|
||||
<string name="hud_fg_unsupported">%1$s: असमर्थित</string>
|
||||
<string name="hud_fg_failed">%1$s: इंजन विफल</string>
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG adaptív %1$d</string>
|
||||
<string name="lsfg_needs_steam">A Lossless Scaling szükséges a Steamen</string>
|
||||
<string name="lsfg_needs_install">Telepítse a Lossless Scalinget a Steamen, vagy importálja a Lossless.dll fájlt</string>
|
||||
<string name="lsfg_import">Lossless.dll importálása…</string>
|
||||
<string name="lsfg_using_steam">A Steamről származó másolat használatban</string>
|
||||
<string name="lsfg_using_import">Egy importált másolat használatban</string>
|
||||
<string name="lsfg_pick_title">Válassza ki a Lossless.dll fájlt</string>
|
||||
<string name="lsfg_imported">A Lossless.dll importálva</string>
|
||||
<string name="lsfg_import_unchanged">Ez a Lossless.dll már használatban van</string>
|
||||
<string name="lsfg_import_not_owned">A Lossless Scaling nincs a tulajdonában ezen a Steam-fiókon</string>
|
||||
<string name="lsfg_import_invalid">Ez a fájl nem a Lossless Scaling Lossless.dll fájlja</string>
|
||||
<string name="lsfg_import_failed">Nem sikerült előkészíteni az LSFG-t ebből a Lossless.dll fájlból</string>
|
||||
<string name="lsfg_problem_missing">Az LSFG-hez szükséges a Lossless Scaling a Steamről vagy egy importált Lossless.dll</string>
|
||||
<string name="lsfg_problem_failed">Az LSFG nem tudta előkészíteni a shadereket a Lossless.dll fájlból</string>
|
||||
<string name="hud_fg_unsupported">%1$s: nem támogatott</string>
|
||||
<string name="hud_fg_failed">%1$s: a motor hibát jelzett</string>
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG Adaptif %1$d</string>
|
||||
<string name="lsfg_needs_steam">Memerlukan Lossless Scaling di Steam</string>
|
||||
<string name="lsfg_needs_install">Instal Lossless Scaling di Steam atau impor Lossless.dll</string>
|
||||
<string name="lsfg_import">Impor Lossless.dll…</string>
|
||||
<string name="lsfg_using_steam">Menggunakan salinan dari Steam</string>
|
||||
<string name="lsfg_using_import">Menggunakan salinan yang diimpor</string>
|
||||
<string name="lsfg_pick_title">Pilih Lossless.dll</string>
|
||||
<string name="lsfg_imported">Lossless.dll diimpor</string>
|
||||
<string name="lsfg_import_unchanged">Lossless.dll ini sudah digunakan</string>
|
||||
<string name="lsfg_import_not_owned">Lossless Scaling tidak dimiliki di akun Steam ini</string>
|
||||
<string name="lsfg_import_invalid">File ini bukan Lossless.dll milik Lossless Scaling</string>
|
||||
<string name="lsfg_import_failed">Tidak dapat menyiapkan LSFG dari Lossless.dll ini</string>
|
||||
<string name="lsfg_problem_missing">LSFG memerlukan Lossless Scaling dari Steam atau Lossless.dll yang diimpor</string>
|
||||
<string name="lsfg_problem_failed">LSFG tidak dapat menyiapkan shader-nya dari Lossless.dll</string>
|
||||
<string name="hud_fg_unsupported">%1$s: tidak didukung</string>
|
||||
<string name="hud_fg_failed">%1$s: mesin gagal</string>
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG adattivo %1$d</string>
|
||||
<string name="lsfg_needs_steam">Richiede Lossless Scaling su Steam</string>
|
||||
<string name="lsfg_needs_install">Installa Lossless Scaling in Steam o importa Lossless.dll</string>
|
||||
<string name="lsfg_import">Importa Lossless.dll…</string>
|
||||
<string name="lsfg_using_steam">In uso la copia di Steam</string>
|
||||
<string name="lsfg_using_import">In uso una copia importata</string>
|
||||
<string name="lsfg_pick_title">Scegli Lossless.dll</string>
|
||||
<string name="lsfg_imported">Lossless.dll importato</string>
|
||||
<string name="lsfg_import_unchanged">Questo Lossless.dll è già in uso</string>
|
||||
<string name="lsfg_import_not_owned">Questo account Steam non possiede Lossless Scaling</string>
|
||||
<string name="lsfg_import_invalid">Questo file non è il Lossless.dll di Lossless Scaling</string>
|
||||
<string name="lsfg_import_failed">Impossibile preparare LSFG da questo Lossless.dll</string>
|
||||
<string name="lsfg_problem_missing">LSFG richiede Lossless Scaling da Steam o un Lossless.dll importato</string>
|
||||
<string name="lsfg_problem_failed">LSFG non è riuscito a preparare gli shader da Lossless.dll</string>
|
||||
<string name="hud_fg_unsupported">%1$s: non supportato</string>
|
||||
<string name="hud_fg_failed">%1$s: errore del motore</string>
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG アダプティブ %1$d</string>
|
||||
<string name="lsfg_needs_steam">Steam版のLossless Scalingが必要です</string>
|
||||
<string name="lsfg_needs_install">SteamでLossless Scalingをインストールするか、Lossless.dllをインポートしてください</string>
|
||||
<string name="lsfg_import">Lossless.dllをインポート…</string>
|
||||
<string name="lsfg_using_steam">Steam版を使用中</string>
|
||||
<string name="lsfg_using_import">インポート版を使用中</string>
|
||||
<string name="lsfg_pick_title">Lossless.dllファイルを選択</string>
|
||||
<string name="lsfg_imported">Lossless.dllをインポートしました</string>
|
||||
<string name="lsfg_import_unchanged">このLossless.dllはすでに使用されています</string>
|
||||
<string name="lsfg_import_not_owned">このSteamアカウントはLossless Scalingを所有していません</string>
|
||||
<string name="lsfg_import_invalid">このファイルはLossless ScalingのLossless.dllではありません</string>
|
||||
<string name="lsfg_import_failed">このLossless.dllからLSFGを準備できませんでした</string>
|
||||
<string name="lsfg_problem_missing">LSFGにはSteam版のLossless Scaling、またはインポートされたLossless.dllファイルが必要です</string>
|
||||
<string name="lsfg_problem_failed">LSFGはこのLossless.dllからシェーダーを準備できませんでした</string>
|
||||
<string name="hud_fg_unsupported">%1$s:サポート外</string>
|
||||
<string name="hud_fg_failed">%1$s:エンジンエラー</string>
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG 적응형 %1$d</string>
|
||||
<string name="lsfg_needs_steam">Steam에서 Lossless Scaling이 필요합니다</string>
|
||||
<string name="lsfg_needs_install">Steam에서 Lossless Scaling을 설치하거나 Lossless.dll을 가져오세요</string>
|
||||
<string name="lsfg_import">Lossless.dll 가져오기…</string>
|
||||
<string name="lsfg_using_steam">Steam 버전 사용 중</string>
|
||||
<string name="lsfg_using_import">가져온 버전 사용 중</string>
|
||||
<string name="lsfg_pick_title">Lossless.dll 파일 선택</string>
|
||||
<string name="lsfg_imported">Lossless.dll을 가져왔습니다</string>
|
||||
<string name="lsfg_import_unchanged">이 Lossless.dll은 이미 사용 중입니다</string>
|
||||
<string name="lsfg_import_not_owned">이 Steam 계정에는 Lossless Scaling이 없습니다</string>
|
||||
<string name="lsfg_import_invalid">이 파일은 Lossless Scaling의 Lossless.dll이 아닙니다</string>
|
||||
<string name="lsfg_import_failed">이 Lossless.dll에서 LSFG를 준비할 수 없습니다</string>
|
||||
<string name="lsfg_problem_missing">LSFG에는 Steam의 Lossless Scaling 또는 가져온 Lossless.dll 파일이 필요합니다</string>
|
||||
<string name="lsfg_problem_failed">LSFG가 이 Lossless.dll에서 셰이더를 준비할 수 없습니다</string>
|
||||
<string name="hud_fg_unsupported">%1$s: 지원되지 않음</string>
|
||||
<string name="hud_fg_failed">%1$s: 엔진 실패</string>
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG Adaptif %1$d</string>
|
||||
<string name="lsfg_needs_steam">Memerlukan Lossless Scaling pada Steam</string>
|
||||
<string name="lsfg_needs_install">Pasang Lossless Scaling dalam Steam atau import Lossless.dll</string>
|
||||
<string name="lsfg_import">Import Lossless.dll…</string>
|
||||
<string name="lsfg_using_steam">Menggunakan salinan daripada Steam</string>
|
||||
<string name="lsfg_using_import">Menggunakan salinan yang diimport</string>
|
||||
<string name="lsfg_pick_title">Pilih Lossless.dll</string>
|
||||
<string name="lsfg_imported">Lossless.dll diimport</string>
|
||||
<string name="lsfg_import_unchanged">Lossless.dll ini sudah digunakan</string>
|
||||
<string name="lsfg_import_not_owned">Lossless Scaling tidak dimiliki pada akaun Steam ini</string>
|
||||
<string name="lsfg_import_invalid">Fail ini bukan Lossless.dll milik Lossless Scaling</string>
|
||||
<string name="lsfg_import_failed">Tidak dapat menyediakan LSFG daripada Lossless.dll ini</string>
|
||||
<string name="lsfg_problem_missing">LSFG memerlukan Lossless Scaling daripada Steam atau Lossless.dll yang diimport</string>
|
||||
<string name="lsfg_problem_failed">LSFG tidak dapat menyediakan shadernya daripada Lossless.dll</string>
|
||||
<string name="hud_fg_unsupported">%1$s: tidak disokong</string>
|
||||
<string name="hud_fg_failed">%1$s: enjin gagal</string>
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG Adaptiv %1$d</string>
|
||||
<string name="lsfg_needs_steam">Krever Lossless Scaling på Steam</string>
|
||||
<string name="lsfg_needs_install">Installer Lossless Scaling via Steam, eller importer Lossless.dll</string>
|
||||
<string name="lsfg_import">Importer Lossless.dll…</string>
|
||||
<string name="lsfg_using_steam">Bruker kopien fra Steam</string>
|
||||
<string name="lsfg_using_import">Bruker en importert kopi</string>
|
||||
<string name="lsfg_pick_title">Velg Lossless.dll</string>
|
||||
<string name="lsfg_imported">Lossless.dll importert</string>
|
||||
<string name="lsfg_import_unchanged">Denne Lossless.dll-filen er allerede i bruk</string>
|
||||
<string name="lsfg_import_not_owned">Lossless Scaling eies ikke av denne Steam-kontoen</string>
|
||||
<string name="lsfg_import_invalid">Denne filen er ikke Lossless Scalings Lossless.dll</string>
|
||||
<string name="lsfg_import_failed">Kunne ikke forberede LSFG fra denne Lossless.dll-filen</string>
|
||||
<string name="lsfg_problem_missing">LSFG krever Lossless Scaling fra Steam eller en importert Lossless.dll</string>
|
||||
<string name="lsfg_problem_failed">LSFG kunne ikke forberede shaderne sine fra Lossless.dll</string>
|
||||
<string name="hud_fg_unsupported">%1$s: ikke støttet</string>
|
||||
<string name="hud_fg_failed">%1$s: motoren feilet</string>
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG adaptief %1$d</string>
|
||||
<string name="lsfg_needs_steam">Vereist Lossless Scaling op Steam</string>
|
||||
<string name="lsfg_needs_install">Installeer Lossless Scaling in Steam of importeer Lossless.dll</string>
|
||||
<string name="lsfg_import">Lossless.dll importeren…</string>
|
||||
<string name="lsfg_using_steam">De kopie uit Steam wordt gebruikt</string>
|
||||
<string name="lsfg_using_import">Een geïmporteerde kopie wordt gebruikt</string>
|
||||
<string name="lsfg_pick_title">Kies Lossless.dll</string>
|
||||
<string name="lsfg_imported">Lossless.dll geïmporteerd</string>
|
||||
<string name="lsfg_import_unchanged">Deze Lossless.dll wordt al gebruikt</string>
|
||||
<string name="lsfg_import_not_owned">Lossless Scaling staat niet op dit Steam-account</string>
|
||||
<string name="lsfg_import_invalid">Dit bestand is niet de Lossless.dll van Lossless Scaling</string>
|
||||
<string name="lsfg_import_failed">Kan LSFG niet voorbereiden met deze Lossless.dll</string>
|
||||
<string name="lsfg_problem_missing">LSFG vereist Lossless Scaling uit Steam of een geïmporteerde Lossless.dll</string>
|
||||
<string name="lsfg_problem_failed">LSFG kan zijn shaders niet voorbereiden uit Lossless.dll</string>
|
||||
<string name="hud_fg_unsupported">%1$s: niet ondersteund</string>
|
||||
<string name="hud_fg_failed">%1$s: engine mislukt</string>
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG adaptacyjne %1$d</string>
|
||||
<string name="lsfg_needs_steam">Wymaga Lossless Scaling ze Steam</string>
|
||||
<string name="lsfg_needs_install">Zainstaluj Lossless Scaling w Steam lub zaimportuj Lossless.dll</string>
|
||||
<string name="lsfg_import">Importuj Lossless.dll…</string>
|
||||
<string name="lsfg_using_steam">Używana jest kopia ze Steam</string>
|
||||
<string name="lsfg_using_import">Używana jest zaimportowana kopia</string>
|
||||
<string name="lsfg_pick_title">Wybierz Lossless.dll</string>
|
||||
<string name="lsfg_imported">Zaimportowano Lossless.dll</string>
|
||||
<string name="lsfg_import_unchanged">Ten plik Lossless.dll jest już używany</string>
|
||||
<string name="lsfg_import_not_owned">To konto Steam nie ma Lossless Scaling</string>
|
||||
<string name="lsfg_import_invalid">Ten plik to nie Lossless.dll z Lossless Scaling</string>
|
||||
<string name="lsfg_import_failed">Nie udało się przygotować LSFG z tego pliku Lossless.dll</string>
|
||||
<string name="lsfg_problem_missing">LSFG wymaga Lossless Scaling ze Steam lub zaimportowanego pliku Lossless.dll</string>
|
||||
<string name="lsfg_problem_failed">Nie udało się przygotować shaderów LSFG z pliku Lossless.dll</string>
|
||||
<string name="hud_fg_unsupported">%1$s: nieobsługiwane</string>
|
||||
<string name="hud_fg_failed">%1$s: błąd silnika</string>
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG Adaptativo %1$d</string>
|
||||
<string name="lsfg_needs_steam">Requer o Lossless Scaling no Steam</string>
|
||||
<string name="lsfg_needs_install">Instale o Lossless Scaling no Steam ou importe o Lossless.dll</string>
|
||||
<string name="lsfg_import">Importar Lossless.dll…</string>
|
||||
<string name="lsfg_using_steam">A utilizar a cópia do Steam</string>
|
||||
<string name="lsfg_using_import">A utilizar uma cópia importada</string>
|
||||
<string name="lsfg_pick_title">Escolher Lossless.dll</string>
|
||||
<string name="lsfg_imported">Lossless.dll importado</string>
|
||||
<string name="lsfg_import_unchanged">Este Lossless.dll já está a ser utilizado</string>
|
||||
<string name="lsfg_import_not_owned">Esta conta Steam não possui o Lossless Scaling</string>
|
||||
<string name="lsfg_import_invalid">Este ficheiro não é o Lossless.dll do Lossless Scaling</string>
|
||||
<string name="lsfg_import_failed">Não foi possível preparar o LSFG a partir deste Lossless.dll</string>
|
||||
<string name="lsfg_problem_missing">O LSFG requer o Lossless Scaling do Steam ou um Lossless.dll importado</string>
|
||||
<string name="lsfg_problem_failed">O LSFG não conseguiu preparar os shaders a partir do Lossless.dll</string>
|
||||
<string name="hud_fg_unsupported">%1$s: não suportado</string>
|
||||
<string name="hud_fg_failed">%1$s: falha do motor</string>
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG Adaptativo %1$d</string>
|
||||
<string name="lsfg_needs_steam">Requer o Lossless Scaling na Steam</string>
|
||||
<string name="lsfg_needs_install">Instale o Lossless Scaling na Steam ou importe o Lossless.dll</string>
|
||||
<string name="lsfg_import">Importar Lossless.dll…</string>
|
||||
<string name="lsfg_using_steam">Usando a cópia da Steam</string>
|
||||
<string name="lsfg_using_import">Usando uma cópia importada</string>
|
||||
<string name="lsfg_pick_title">Escolha o Lossless.dll</string>
|
||||
<string name="lsfg_imported">Lossless.dll importado</string>
|
||||
<string name="lsfg_import_unchanged">Este Lossless.dll já está em uso</string>
|
||||
<string name="lsfg_import_not_owned">Esta conta Steam não tem o Lossless Scaling</string>
|
||||
<string name="lsfg_import_invalid">Este arquivo não é o Lossless.dll do Lossless Scaling</string>
|
||||
<string name="lsfg_import_failed">Não foi possível preparar o LSFG com este Lossless.dll</string>
|
||||
<string name="lsfg_problem_missing">O LSFG requer o Lossless Scaling da Steam ou um Lossless.dll importado</string>
|
||||
<string name="lsfg_problem_failed">O LSFG não conseguiu preparar os shaders a partir do Lossless.dll</string>
|
||||
<string name="hud_fg_unsupported">%1$s: sem suporte</string>
|
||||
<string name="hud_fg_failed">%1$s: falha no mecanismo</string>
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG Adaptiv %1$d</string>
|
||||
<string name="lsfg_needs_steam">Necesită Lossless Scaling pe Steam</string>
|
||||
<string name="lsfg_needs_install">Instalează Lossless Scaling în Steam sau importă Lossless.dll</string>
|
||||
<string name="lsfg_import">Importă Lossless.dll…</string>
|
||||
<string name="lsfg_using_steam">Se folosește copia din Steam</string>
|
||||
<string name="lsfg_using_import">Se folosește o copie importată</string>
|
||||
<string name="lsfg_pick_title">Alege Lossless.dll</string>
|
||||
<string name="lsfg_imported">Lossless.dll importat</string>
|
||||
<string name="lsfg_import_unchanged">Acest Lossless.dll este deja în uz</string>
|
||||
<string name="lsfg_import_not_owned">Lossless Scaling nu este deținut pe acest cont Steam</string>
|
||||
<string name="lsfg_import_invalid">Acest fișier nu este Lossless.dll al Lossless Scaling</string>
|
||||
<string name="lsfg_import_failed">Nu s-a putut pregăti LSFG din acest Lossless.dll</string>
|
||||
<string name="lsfg_problem_missing">LSFG are nevoie de Lossless Scaling din Steam sau de un Lossless.dll importat</string>
|
||||
<string name="lsfg_problem_failed">LSFG nu a putut pregăti shaderele din Lossless.dll</string>
|
||||
<string name="hud_fg_unsupported">%1$s: neacceptat</string>
|
||||
<string name="hud_fg_failed">%1$s: motor eșuat</string>
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG Адаптивный %1$d</string>
|
||||
<string name="lsfg_needs_steam">Требуется Lossless Scaling из Steam</string>
|
||||
<string name="lsfg_needs_install">Установите Lossless Scaling в Steam или импортируйте Lossless.dll</string>
|
||||
<string name="lsfg_import">Импорт Lossless.dll…</string>
|
||||
<string name="lsfg_using_steam">Используется копия из Steam</string>
|
||||
<string name="lsfg_using_import">Используется импортированная копия</string>
|
||||
<string name="lsfg_pick_title">Выберите файл Lossless.dll</string>
|
||||
<string name="lsfg_imported">Lossless.dll импортирован</string>
|
||||
<string name="lsfg_import_unchanged">Этот Lossless.dll уже используется</string>
|
||||
<string name="lsfg_import_not_owned">В этой учетной записи Steam нет Lossless Scaling</string>
|
||||
<string name="lsfg_import_invalid">Этот файл не является Lossless.dll от Lossless Scaling</string>
|
||||
<string name="lsfg_import_failed">Не удалось подготовить LSFG из этого Lossless.dll</string>
|
||||
<string name="lsfg_problem_missing">Для LSFG требуется Lossless Scaling из Steam или импортированный файл Lossless.dll</string>
|
||||
<string name="lsfg_problem_failed">LSFG не удалось подготовить шейдеры из Lossless.dll</string>
|
||||
<string name="hud_fg_unsupported">%1$s: не поддерживается</string>
|
||||
<string name="hud_fg_failed">%1$s: сбой движка</string>
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG adaptiv %1$d</string>
|
||||
<string name="lsfg_needs_steam">Kräver Lossless Scaling på Steam</string>
|
||||
<string name="lsfg_needs_install">Installera Lossless Scaling i Steam eller importera Lossless.dll</string>
|
||||
<string name="lsfg_import">Importera Lossless.dll…</string>
|
||||
<string name="lsfg_using_steam">Använder kopian från Steam</string>
|
||||
<string name="lsfg_using_import">Använder en importerad kopia</string>
|
||||
<string name="lsfg_pick_title">Välj Lossless.dll</string>
|
||||
<string name="lsfg_imported">Lossless.dll har importerats</string>
|
||||
<string name="lsfg_import_unchanged">Den här Lossless.dll används redan</string>
|
||||
<string name="lsfg_import_not_owned">Lossless Scaling ägs inte på det här Steam-kontot</string>
|
||||
<string name="lsfg_import_invalid">Filen är inte Lossless.dll från Lossless Scaling</string>
|
||||
<string name="lsfg_import_failed">Kunde inte förbereda LSFG från den här Lossless.dll</string>
|
||||
<string name="lsfg_problem_missing">LSFG kräver Lossless Scaling från Steam eller en importerad Lossless.dll</string>
|
||||
<string name="lsfg_problem_failed">LSFG kunde inte förbereda sina shaders från Lossless.dll</string>
|
||||
<string name="hud_fg_unsupported">%1$s: stöds inte</string>
|
||||
<string name="hud_fg_failed">%1$s: motorn misslyckades</string>
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG แบบปรับอัตโนมัติ %1$d</string>
|
||||
<string name="lsfg_needs_steam">ต้องมี Lossless Scaling บน Steam</string>
|
||||
<string name="lsfg_needs_install">ติดตั้ง Lossless Scaling ใน Steam หรือนำเข้า Lossless.dll</string>
|
||||
<string name="lsfg_import">นำเข้า Lossless.dll…</string>
|
||||
<string name="lsfg_using_steam">ใช้ชุดที่มาจาก Steam</string>
|
||||
<string name="lsfg_using_import">ใช้ชุดที่นำเข้ามา</string>
|
||||
<string name="lsfg_pick_title">เลือก Lossless.dll</string>
|
||||
<string name="lsfg_imported">นำเข้า Lossless.dll แล้ว</string>
|
||||
<string name="lsfg_import_unchanged">Lossless.dll นี้ถูกใช้งานอยู่แล้ว</string>
|
||||
<string name="lsfg_import_not_owned">บัญชี Steam นี้ไม่ได้เป็นเจ้าของ Lossless Scaling</string>
|
||||
<string name="lsfg_import_invalid">ไฟล์นี้ไม่ใช่ Lossless.dll ของ Lossless Scaling</string>
|
||||
<string name="lsfg_import_failed">ไม่สามารถเตรียม LSFG จาก Lossless.dll นี้ได้</string>
|
||||
<string name="lsfg_problem_missing">LSFG ต้องใช้ Lossless Scaling จาก Steam หรือ Lossless.dll ที่นำเข้ามา</string>
|
||||
<string name="lsfg_problem_failed">LSFG ไม่สามารถเตรียมเชดเดอร์จาก Lossless.dll ได้</string>
|
||||
<string name="hud_fg_unsupported">%1$s: ไม่รองรับ</string>
|
||||
<string name="hud_fg_failed">%1$s: เอนจินล้มเหลว</string>
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG Uyarlanabilir %1$d</string>
|
||||
<string name="lsfg_needs_steam">Steam\'de Lossless Scaling gerekli</string>
|
||||
<string name="lsfg_needs_install">Lossless Scaling\'i Steam\'den yükleyin veya Lossless.dll dosyasını içe aktarın</string>
|
||||
<string name="lsfg_import">Lossless.dll içe aktar…</string>
|
||||
<string name="lsfg_using_steam">Steam\'deki kopya kullanılıyor</string>
|
||||
<string name="lsfg_using_import">İçe aktarılan kopya kullanılıyor</string>
|
||||
<string name="lsfg_pick_title">Lossless.dll seçin</string>
|
||||
<string name="lsfg_imported">Lossless.dll içe aktarıldı</string>
|
||||
<string name="lsfg_import_unchanged">Bu Lossless.dll zaten kullanılıyor</string>
|
||||
<string name="lsfg_import_not_owned">Bu Steam hesabı Lossless Scaling\'e sahip değil</string>
|
||||
<string name="lsfg_import_invalid">Bu dosya Lossless Scaling\'in Lossless.dll dosyası değil</string>
|
||||
<string name="lsfg_import_failed">Bu Lossless.dll ile LSFG hazırlanamadı</string>
|
||||
<string name="lsfg_problem_missing">LSFG için Steam\'den Lossless Scaling veya içe aktarılmış bir Lossless.dll gerekir</string>
|
||||
<string name="lsfg_problem_failed">LSFG, gölgelendiricilerini Lossless.dll dosyasından hazırlayamadı</string>
|
||||
<string name="hud_fg_unsupported">%1$s: desteklenmiyor</string>
|
||||
<string name="hud_fg_failed">%1$s: motor hatası</string>
|
||||
|
||||
@@ -55,17 +55,6 @@
|
||||
<string name="frame_gen_lsfg">LSFG %1$d×</string>
|
||||
<string name="frame_gen_lsfg_adaptive">LSFG адаптивний %1$d</string>
|
||||
<string name="lsfg_needs_steam">Потрібен Lossless Scaling зі Steam</string>
|
||||
<string name="lsfg_needs_install">Установіть Lossless Scaling у Steam або імпортуйте Lossless.dll</string>
|
||||
<string name="lsfg_import">Імпортувати Lossless.dll…</string>
|
||||
<string name="lsfg_using_steam">Використовується копія зі Steam</string>
|
||||
<string name="lsfg_using_import">Використовується імпортована копія</string>
|
||||
<string name="lsfg_pick_title">Виберіть Lossless.dll</string>
|
||||
<string name="lsfg_imported">Lossless.dll імпортовано</string>
|
||||
<string name="lsfg_import_unchanged">Цей Lossless.dll уже використовується</string>
|
||||
<string name="lsfg_import_not_owned">У цьому обліковому записі Steam немає Lossless Scaling</string>
|
||||
<string name="lsfg_import_invalid">Цей файл не є Lossless.dll від Lossless Scaling</string>
|
||||
<string name="lsfg_import_failed">Не вдалося підготувати LSFG із цього Lossless.dll</string>
|
||||
<string name="lsfg_problem_missing">Для LSFG потрібен Lossless Scaling зі Steam або імпортований Lossless.dll</string>
|
||||
<string name="lsfg_problem_failed">LSFG не вдалося підготувати шейдери з Lossless.dll</string>
|
||||
<string name="hud_fg_unsupported">%1$s: не підтримується</string>
|
||||
<string name="hud_fg_failed">%1$s: збій рушія</string>
|
||||
|
||||
Loaded 100 of 150 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user