Compare commits

..
Author SHA1 Message Date
The412Banner 17b578b7cf fix: Samsung boost retries a failed connection with reasons, and "not needed" when the game keeps up
- Samsung clocks: a failed connection is tried 4 times a session (again after 5, 15 and 30 s) and
  again at the next game, instead of staying off until the app restarts. Each failed try is in
  boost.log with the step it was on and the error ("failed while reading the service's level table
  (EOFException)", "the service did not connect within 3 s ..."). The summary lists every failed try.
  Only a phone without Samsung's firmware library is not asked again.
- The socket from a failed try is closed.
- Check the boost: when the game kept up without the boost for more than half of the boost's turns,
  the verdict is "not needed for this game" instead of a percentage that reads as a loss.
2026-11-01 17:05:34 +00:00
The412Banner 0d82557957 feat: Performance boost switch for any phone, with Samsung clock floors and a boost report
Settings > Performance > Boost gets two switches.

Performance boost: the game's busiest threads are named to Android's
performance hint service (ADPF), which moves them to the fastest cores
while the game falls behind (GameThreadHints, so far Odin 3 only). Now on
any Android 12+ phone; on by default only on the Odin 3, where it was
measured. On a Samsung phone it also holds Samsung's CPU, GPU and memory
bus clock floors through the performance service in Samsung's firmware
(SamsungPerf, no Samsung library in the app), renewed every 500 ms since
Samsung holds a request for at most a second. Both let go when the game
keeps up, the phone is too hot or battery saver is on.

boost.log in each session's logs: whether each part came on and can be
seen working (threads on the fastest cores, raised minimum clocks), a
status line every 30 s of play that says why the boost is off when it is,
and a summary.

Check the boost: the boost is on and paused in one-minute windows in the
order on, paused, paused, on (so a phone warming up favours neither side),
the first minute of play and 5 s after each switch are not counted, and
the summary ends with a verdict. No verdict when heat or battery saver
held the boost back for more than a quarter of its turns.
2026-11-01 01:31:15 +00:00
MaxsTechReview bfa61b5139 fix: "DroidDeck isn't responding" on dual-screen handhelds after the bottom screen sits idle (#1917)
The bottom-screen panel handed focus back to the main screen only when it opened or was touched within the last second. When the panel became the active screen later, the paused launcher kept no focused window, so controller input waited until Android reported the app as not responding. The panel now hands focus back whenever it becomes the active screen or gains window focus, unless bottom-screen typing is open or an app the launcher opened is in front.
2026-10-31 20:40:57 -04:00
MaxsTechReview 0a07926ef3 docs: DroidDeck 0.6.9 release notes (#1904)
* docs: DroidDeck 0.6.9 release notes

* docs: explain the banking app fix in the 0.6.9 notes

* docs: banking app line in the 0.6.9 summary

* docs: dual-screen line in the 0.6.9 summary

* docs: move the dual-screen line into the 0.6.9 intro

* Update release notes for version 0.6.9

Reformatted the release notes for clarity and improved readability.

* docs: add #1888 and #1896 to the 0.6.9 notes

* docs: add #1903 to the 0.6.9 notes
2026-10-31 13:58:57 -04:00
Kurt Himebauch b63feb5eaa fix: three-finger tap opens the keyboard in touchpad mode (#1903) 2026-10-31 13:55:03 -04:00
MaxsTechReview d691bcf832 chore: bump version to 0.6.9 (17) (#1902) 2026-10-31 13:54:30 -04:00
K11MCH1 583f34fc55 fix: stop importing games as Spacewar (480) and follow a changed Steam app id (#1896) 2026-10-31 13:36:43 -04:00
K11MCH1 88719f25d2 Games: launch options for Steam games in the Edit screen, shared with Steam's Properties (#1888) 2026-10-31 13:36:39 -04:00
MaxsTechReview ac132a23e2 fix: dual-screen update prompt survives a bottom-screen tap, home launcher stays out of Recents, Quest panel opens landscape (#1893)
* fix: dual-screen launcher keeps the update prompt on screen and stays out of Recents as home; Quest panel opens landscape

Outside screens the launcher opens (the update prompt, Settings, pickers) now hold the top screen when the bottom screen is touched, so a bottom-screen tap no longer buries the Android install prompt and leaves updates stuck waiting for confirmation (DD-368).

When DroidDeck is the home app its launcher task is excluded from Recents, so it can no longer be swiped closed; a running game session is still listed (DD-377).

The launcher declares a 1024x640 dp default panel size so Meta Quest opens it landscape again after the orientation manifest change in #1606 (DD-360).

* fix: Recents exclusion follows the top DroidDeck activity and only undoes its own change

The launcher task is hidden from Recents only while FrontEndActivity is on top, DroidDeck is home and no session runs; the file manager and a running session show it again, the check repeats when the launcher pauses, and tasks hidden by someone else are left alone.

* fix: Recents ownership survives process death and never claims a task someone else excluded
2026-10-31 09:21:49 -04:00
MaxsTechReview 85dd8beae1 zRAM: compress Battle.net with the Steam client while one of its games runs (#1882) 2026-10-31 08:10:57 -04:00
79 changed files with 2228 additions and 345 deletions

No files matched your search

+2 -2
View File
@@ -134,8 +134,8 @@ android {
applicationId "com.droiddeck.launcher"
minSdkVersion 26
targetSdkVersion 28
versionCode 16
versionName "0.6.7"
versionCode 17
versionName "0.6.9"
buildConfigField "String", "BUILD_LABEL", "\"${escapedBuildLabel}\""
buildConfigField "String", "SOURCE_COMMIT", "\"${sourceCommit}\""
buildConfigField "int", "PR_NUMBER", "${prNumber}"
+1
View File
@@ -105,6 +105,7 @@
android:exported="true"
android:screenOrientation="user"
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|density|keyboard|keyboardHidden|navigation">
<layout android:defaultWidth="1024dp" android:defaultHeight="640dp" />
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
+8 -40
View File
@@ -6,7 +6,6 @@
#include "blend_vert.h"
#include "blend_frag.h"
#include "rotate_vert.h"
struct pc_blend { float dst[4]; float src[4]; };
@@ -16,11 +15,11 @@ static VkSampler g_sampler;
static VkDescriptorSetLayout g_dsl;
static VkPipelineLayout g_pl;
static VkDescriptorPool g_dpool;
static VkShaderModule g_vert, g_frag, g_rot_vert;
static VkShaderModule g_vert, g_frag;
static unsigned g_frame = 1;
#define NFMT 4
static struct { VkFormat fmt; VkRenderPass rp; VkPipeline pipe, rot; } g_out[NFMT];
static struct { VkFormat fmt; VkRenderPass rp; VkPipeline pipe; } g_out[NFMT];
#define NSRC 32
static struct { VkImage img; VkImageView view; VkDescriptorSet ds; unsigned frame; } g_src[NSRC];
@@ -86,10 +85,10 @@ static VkRenderPass make_rp(VkFormat fmt) {
return rp;
}
static VkPipeline make_pipe(VkRenderPass rp, VkShaderModule vert, int blend) {
static VkPipeline make_pipe(VkRenderPass rp) {
VkPipelineShaderStageCreateInfo st[2] = {
{.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, .stage = VK_SHADER_STAGE_VERTEX_BIT,
.module = vert, .pName = "main"},
.module = g_vert, .pName = "main"},
{.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, .stage = VK_SHADER_STAGE_FRAGMENT_BIT,
.module = g_frag, .pName = "main"}};
VkPipelineVertexInputStateCreateInfo vi = {.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO};
@@ -106,12 +105,11 @@ static VkPipeline make_pipe(VkRenderPass rp, VkShaderModule vert, int blend) {
VkPipelineMultisampleStateCreateInfo ms = {.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO,
.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT};
VkPipelineColorBlendAttachmentState ba = {
.blendEnable = blend ? VK_TRUE : VK_FALSE, .srcColorBlendFactor = VK_BLEND_FACTOR_ONE,
.blendEnable = VK_TRUE, .srcColorBlendFactor = VK_BLEND_FACTOR_ONE,
.dstColorBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA, .colorBlendOp = VK_BLEND_OP_ADD,
.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE, .dstAlphaBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA,
.alphaBlendOp = VK_BLEND_OP_ADD,
.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT |
(blend ? 0 : VK_COLOR_COMPONENT_A_BIT)};
.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT};
VkPipelineColorBlendStateCreateInfo cb = {.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO,
.attachmentCount = 1, .pAttachments = &ba};
VkGraphicsPipelineCreateInfo pi = {.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO, .stageCount = 2,
@@ -127,12 +125,11 @@ static VkPipeline make_pipe(VkRenderPass rp, VkShaderModule vert, int blend) {
static void objects_destroy(void) {
if (g_vert) g_vk.DestroyShaderModule(g_dev, g_vert, NULL);
if (g_frag) g_vk.DestroyShaderModule(g_dev, g_frag, NULL);
if (g_rot_vert) g_vk.DestroyShaderModule(g_dev, g_rot_vert, NULL);
if (g_dpool) g_vk.DestroyDescriptorPool(g_dev, g_dpool, NULL);
if (g_pl) g_vk.DestroyPipelineLayout(g_dev, g_pl, NULL);
if (g_dsl) g_vk.DestroyDescriptorSetLayout(g_dev, g_dsl, NULL);
if (g_sampler) g_vk.DestroySampler(g_dev, g_sampler, NULL);
g_vert = g_frag = g_rot_vert = VK_NULL_HANDLE; g_dpool = VK_NULL_HANDLE; g_pl = VK_NULL_HANDLE;
g_vert = g_frag = VK_NULL_HANDLE; g_dpool = VK_NULL_HANDLE; g_pl = VK_NULL_HANDLE;
g_dsl = VK_NULL_HANDLE; g_sampler = VK_NULL_HANDLE;
}
@@ -162,7 +159,6 @@ static int objects_ensure(void) {
if (g_vk.CreateDescriptorPool(g_dev, &dpi, NULL, &g_dpool) != VK_SUCCESS) goto fail;
if (!(g_vert = shader(blend_vert_code, sizeof(blend_vert_code)))) goto fail;
if (!(g_frag = shader(blend_frag_code, sizeof(blend_frag_code)))) goto fail;
if (!(g_rot_vert = shader(rotate_vert_code, sizeof(rotate_vert_code)))) goto fail;
g_ready = 1;
droiddeck_log("gpu", "alpha composition ready on %s: translucent surfaces are blended over what is under them",
vkp_gpu_name());
@@ -179,7 +175,7 @@ static int out_slot(VkFormat fmt) {
for (i = 0; i < NFMT && g_out[i].pipe; i++) if (g_out[i].fmt == fmt) return i;
if (i == NFMT) return -1;
VkRenderPass rp = make_rp(fmt);
VkPipeline pipe = rp ? make_pipe(rp, g_vert, 1) : VK_NULL_HANDLE;
VkPipeline pipe = rp ? make_pipe(rp) : VK_NULL_HANDLE;
if (!pipe) {
if (rp) g_vk.DestroyRenderPass(g_dev, rp, NULL);
return -1;
@@ -307,31 +303,3 @@ int blendp_draw(VkCommandBuffer cmd, VkImage src, VkFormat src_fmt, int src_w, i
if (!src_general) src_layout(cmd, src, sampled, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
return 0;
}
int blendp_rotate(VkCommandBuffer cmd, VkImage src, VkFormat src_fmt, int src_w, int src_h,
VkImage dst, VkFormat dst_fmt, int dst_w, int dst_h, int degrees) {
if (!src || !dst || src_w <= 0 || src_h <= 0 || dst_w <= 0 || dst_h <= 0 || objects_ensure() != 0) return -1;
if (degrees != 90 && degrees != 270) return -1;
int slot = out_slot(dst_fmt);
if (slot < 0) return -1;
if (!g_out[slot].rot && !(g_out[slot].rot = make_pipe(g_out[slot].rp, g_rot_vert, 0))) return -1;
VkDescriptorSet ds = src_ensure(src, src_fmt, VK_IMAGE_LAYOUT_GENERAL);
if (!ds) return -1;
VkFramebuffer fb = dst_ensure(dst, dst_fmt, dst_w, dst_h, g_out[slot].rp);
if (!fb) return -1;
struct pc_blend pc = {.dst = {-1.0f, -1.0f, 1.0f, 1.0f}};
if (degrees == 90) { pc.src[0] = 0.0f; pc.src[1] = 1.0f; pc.src[2] = 1.0f; pc.src[3] = 0.0f; }
else { pc.src[0] = 1.0f; pc.src[1] = 0.0f; pc.src[2] = 0.0f; pc.src[3] = 1.0f; }
VkRenderPassBeginInfo rpi = {.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, .renderPass = g_out[slot].rp,
.framebuffer = fb, .renderArea = {{0, 0}, {(uint32_t)dst_w, (uint32_t)dst_h}}};
VkViewport vp = {0, 0, (float)dst_w, (float)dst_h, 0, 1};
g_vk.CmdBeginRenderPass(cmd, &rpi, VK_SUBPASS_CONTENTS_INLINE);
g_vk.CmdSetViewport(cmd, 0, 1, &vp);
g_vk.CmdSetScissor(cmd, 0, 1, &rpi.renderArea);
g_vk.CmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, g_out[slot].rot);
g_vk.CmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, g_pl, 0, 1, &ds, 0, NULL);
g_vk.CmdPushConstants(cmd, g_pl, VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(pc), &pc);
g_vk.CmdDraw(cmd, 4, 1, 0, 0);
g_vk.CmdEndRenderPass(cmd);
return 0;
}
@@ -10,7 +10,4 @@ void blendp_begin_frame(void);
int blendp_draw(VkCommandBuffer cmd, VkImage src, VkFormat src_fmt, int src_w, int src_h, int src_general,
VkImage dst, VkFormat dst_fmt, int dst_w, int dst_h, const VkImageBlit *blit);
int blendp_rotate(VkCommandBuffer cmd, VkImage src, VkFormat src_fmt, int src_w, int src_h,
VkImage dst, VkFormat dst_fmt, int dst_w, int dst_h, int degrees);
#endif
@@ -1,9 +0,0 @@
#version 450
layout(push_constant) uniform PC { vec4 dst; vec4 src; } pc;
layout(location = 0) out vec2 uv;
void main() {
vec2 t = vec2(gl_VertexIndex & 1, gl_VertexIndex >> 1);
gl_Position = vec4(mix(pc.dst.xy, pc.dst.zw, t), 0.0, 1.0);
uv = mix(pc.src.xy, pc.src.zw, t.yx);
}
@@ -1,55 +0,0 @@
#pragma once
const uint32_t rotate_vert_code[] = {
0x07230203,0x00010000,0x0008000b,0x0000003b,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0008000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000c,0x0000001b,0x00000031,
0x00030003,0x00000002,0x000001c2,0x00040005,0x00000004,0x6e69616d,0x00000000,0x00030005,
0x00000009,0x00000074,0x00060005,0x0000000c,0x565f6c67,0x65747265,0x646e4978,0x00007865,
0x00060005,0x00000019,0x505f6c67,0x65567265,0x78657472,0x00000000,0x00060006,0x00000019,
0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00070006,0x00000019,0x00000001,0x505f6c67,
0x746e696f,0x657a6953,0x00000000,0x00070006,0x00000019,0x00000002,0x435f6c67,0x4470696c,
0x61747369,0x0065636e,0x00070006,0x00000019,0x00000003,0x435f6c67,0x446c6c75,0x61747369,
0x0065636e,0x00030005,0x0000001b,0x00000000,0x00030005,0x0000001d,0x00004350,0x00040006,
0x0000001d,0x00000000,0x00747364,0x00040006,0x0000001d,0x00000001,0x00637273,0x00030005,
0x0000001f,0x00006370,0x00030005,0x00000031,0x00007675,0x00040047,0x0000000c,0x0000000b,
0x0000002a,0x00030047,0x00000019,0x00000002,0x00050048,0x00000019,0x00000000,0x0000000b,
0x00000000,0x00050048,0x00000019,0x00000001,0x0000000b,0x00000001,0x00050048,0x00000019,
0x00000002,0x0000000b,0x00000003,0x00050048,0x00000019,0x00000003,0x0000000b,0x00000004,
0x00030047,0x0000001d,0x00000002,0x00050048,0x0000001d,0x00000000,0x00000023,0x00000000,
0x00050048,0x0000001d,0x00000001,0x00000023,0x00000010,0x00040047,0x00000031,0x0000001e,
0x00000000,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,
0x00000020,0x00040017,0x00000007,0x00000006,0x00000002,0x00040020,0x00000008,0x00000007,
0x00000007,0x00040015,0x0000000a,0x00000020,0x00000001,0x00040020,0x0000000b,0x00000001,
0x0000000a,0x0004003b,0x0000000b,0x0000000c,0x00000001,0x0004002b,0x0000000a,0x0000000e,
0x00000001,0x00040017,0x00000015,0x00000006,0x00000004,0x00040015,0x00000016,0x00000020,
0x00000000,0x0004002b,0x00000016,0x00000017,0x00000001,0x0004001c,0x00000018,0x00000006,
0x00000017,0x0006001e,0x00000019,0x00000015,0x00000006,0x00000018,0x00000018,0x00040020,
0x0000001a,0x00000003,0x00000019,0x0004003b,0x0000001a,0x0000001b,0x00000003,0x0004002b,
0x0000000a,0x0000001c,0x00000000,0x0004001e,0x0000001d,0x00000015,0x00000015,0x00040020,
0x0000001e,0x00000009,0x0000001d,0x0004003b,0x0000001e,0x0000001f,0x00000009,0x00040020,
0x00000020,0x00000009,0x00000015,0x0004002b,0x00000006,0x00000029,0x00000000,0x0004002b,
0x00000006,0x0000002a,0x3f800000,0x00040020,0x0000002e,0x00000003,0x00000015,0x00040020,
0x00000030,0x00000003,0x00000007,0x0004003b,0x00000030,0x00000031,0x00000003,0x00050036,
0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b,0x00000008,
0x00000009,0x00000007,0x0004003d,0x0000000a,0x0000000d,0x0000000c,0x000500c7,0x0000000a,
0x0000000f,0x0000000d,0x0000000e,0x0004006f,0x00000006,0x00000010,0x0000000f,0x0004003d,
0x0000000a,0x00000011,0x0000000c,0x000500c3,0x0000000a,0x00000012,0x00000011,0x0000000e,
0x0004006f,0x00000006,0x00000013,0x00000012,0x00050050,0x00000007,0x00000014,0x00000010,
0x00000013,0x0003003e,0x00000009,0x00000014,0x00050041,0x00000020,0x00000021,0x0000001f,
0x0000001c,0x0004003d,0x00000015,0x00000022,0x00000021,0x0007004f,0x00000007,0x00000023,
0x00000022,0x00000022,0x00000000,0x00000001,0x00050041,0x00000020,0x00000024,0x0000001f,
0x0000001c,0x0004003d,0x00000015,0x00000025,0x00000024,0x0007004f,0x00000007,0x00000026,
0x00000025,0x00000025,0x00000002,0x00000003,0x0004003d,0x00000007,0x00000027,0x00000009,
0x0008000c,0x00000007,0x00000028,0x00000001,0x0000002e,0x00000023,0x00000026,0x00000027,
0x00050051,0x00000006,0x0000002b,0x00000028,0x00000000,0x00050051,0x00000006,0x0000002c,
0x00000028,0x00000001,0x00070050,0x00000015,0x0000002d,0x0000002b,0x0000002c,0x00000029,
0x0000002a,0x00050041,0x0000002e,0x0000002f,0x0000001b,0x0000001c,0x0003003e,0x0000002f,
0x0000002d,0x00050041,0x00000020,0x00000032,0x0000001f,0x0000000e,0x0004003d,0x00000015,
0x00000033,0x00000032,0x0007004f,0x00000007,0x00000034,0x00000033,0x00000033,0x00000000,
0x00000001,0x00050041,0x00000020,0x00000035,0x0000001f,0x0000000e,0x0004003d,0x00000015,
0x00000036,0x00000035,0x0007004f,0x00000007,0x00000037,0x00000036,0x00000036,0x00000002,
0x00000003,0x0004003d,0x00000007,0x00000038,0x00000009,0x0007004f,0x00000007,0x00000039,
0x00000038,0x00000038,0x00000001,0x00000000,0x0008000c,0x00000007,0x0000003a,0x00000001,
0x0000002e,0x00000034,0x00000037,0x00000039,0x0003003e,0x00000031,0x0000003a,0x000100fd,
0x00010038
};
+23 -107
View File
@@ -116,8 +116,7 @@ static VkResult timed_wait(VkFence fence, uint64_t timeout) {
static struct { VkImage img; VkDeviceMemory mem; int w, h; } g_scene;
struct vkp_img_slot { VkImage img; VkDeviceMemory mem; int w, h; VkFormat fmt; };
static struct vkp_img_slot g_mixed, g_hdrscene, g_fgscene, g_land;
static int g_prerot, g_prerot_failed;
static struct vkp_img_slot g_mixed, g_hdrscene, g_fgscene;
#define HDR_FMT VK_FORMAT_A2B10G10R10_UNORM_PACK32
#define FG_HDR_FMT VK_FORMAT_R16G16B16A16_SFLOAT
@@ -662,20 +661,6 @@ static void log_surface_formats(const VkSurfaceFormatKHR *f, uint32_t n) {
hdr_n ? hdr : "none", hdr_cut ? " (+more)" : "");
}
struct vkp_img_slot;
static int ensure_img(struct vkp_img_slot *s, int w, int h, VkFormat fmt, VkImageUsageFlags usage, const char *what);
static int prerotate_degrees(const VkSurfaceCapabilitiesKHR *caps) {
if (g_prerot_failed) return 0;
char v[PROP_VALUE_MAX] = "";
__system_property_get("debug.droiddeck.prerotate", v);
if (v[0] == '0') return 0;
if (!(caps->supportedTransforms & caps->currentTransform)) return 0;
if (caps->currentTransform == VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR) return 90;
if (caps->currentTransform == VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR) return 270;
return 0;
}
static int swap_init_locked(void) {
VkAndroidSurfaceCreateInfoKHR aci = {
@@ -748,18 +733,11 @@ static int swap_init_locked(void) {
VkSurfaceTransformFlagBitsKHR pretrans =
(caps.supportedTransforms & VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR)
? VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR : caps.currentTransform;
g_prerot = prerotate_degrees(&caps);
VkExtent2D image_extent = g_extent;
if (g_prerot) {
pretrans = caps.currentTransform;
image_extent.width = g_extent.height;
image_extent.height = g_extent.width;
}
VkSwapchainCreateInfoKHR sci = {
.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR, .surface = g_surface,
.minImageCount = want, .imageFormat = chosen.format, .imageColorSpace = chosen.colorSpace,
.imageExtent = image_extent, .imageArrayLayers = 1,
.imageExtent = g_extent, .imageArrayLayers = 1,
.imageUsage = VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE, .preTransform = pretrans,
.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR,
@@ -776,17 +754,6 @@ static int swap_init_locked(void) {
g_swap_fmt = sdr_choice.format;
cr = g_vk.CreateSwapchainKHR(g_dev, &sci, NULL, &g_swapchain);
}
if (cr != VK_SUCCESS && g_prerot) {
droiddeck_log("gpu", "the driver refused a swapchain turned for the panel (%s): the display rotates the "
"picture instead", vk_result_name(cr));
g_prerot = 0;
g_prerot_failed = 1;
g_swapchain = VK_NULL_HANDLE;
sci.preTransform = (caps.supportedTransforms & VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR)
? VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR : caps.currentTransform;
sci.imageExtent = g_extent;
cr = g_vk.CreateSwapchainKHR(g_dev, &sci, NULL, &g_swapchain);
}
if (cr != VK_SUCCESS) {
g_swapchain = VK_NULL_HANDLE;
SWLOGE("present: vkCreateSwapchainKHR failed (%d)", (int)cr);
@@ -795,18 +762,6 @@ static int swap_init_locked(void) {
g_vk.GetSwapchainImagesKHR(g_dev, g_swapchain, &g_nimg, NULL);
g_images = calloc(g_nimg, sizeof(VkImage));
g_vk.GetSwapchainImagesKHR(g_dev, g_swapchain, &g_nimg, g_images);
if (g_prerot && ensure_img(&g_land, (int)g_extent.width, (int)g_extent.height, g_swap_fmt,
VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
"panel rotation") != 0) {
g_prerot_failed = 1;
droiddeck_log("gpu", "the panel-rotation image could not be made: the display rotates the picture instead");
destroy_swapchain();
return -1;
}
if (g_prerot)
droiddeck_log("gpu", "the panel is mounted at %d degrees: frames are turned on the GPU before they are shown, "
"so the display hardware can show the game layer directly", g_prerot);
droiddeck_log("gpu", "screen output %ux%u, %u buffers, vsync%s", g_extent.width, g_extent.height, g_nimg,
g_swap_extra ? " (frame generation: several presents per frame)" : "");
@@ -1390,53 +1345,6 @@ static const char *vk_result_name(VkResult r) {
}
static VkImage out_image(uint32_t img) {
return g_prerot ? g_land.img : g_images[img];
}
static void finish_out_image(VkCommandBuffer cmd, uint32_t img) {
VkImageSubresourceRange range = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1};
if (!g_prerot) {
VkImageMemoryBarrier b_present = {
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
.newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .image = g_images[img],
.subresourceRange = range, .srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT};
g_vk.CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT,
0, 0, NULL, 0, NULL, 1, &b_present);
return;
}
VkImageMemoryBarrier pre[2] = {
{.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
.newLayout = VK_IMAGE_LAYOUT_GENERAL, .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .image = g_land.img, .subresourceRange = range,
.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,
.dstAccessMask = VK_ACCESS_SHADER_READ_BIT},
{.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .oldLayout = VK_IMAGE_LAYOUT_UNDEFINED,
.newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .image = g_images[img], .subresourceRange = range,
.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT}};
g_vk.CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TRANSFER_BIT | VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
VK_PIPELINE_STAGE_TRANSFER_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT,
0, 0, NULL, 0, NULL, 2, pre);
VkClearColorValue black = {.float32 = {0.0f, 0.0f, 0.0f, 1.0f}};
g_vk.CmdClearColorImage(cmd, g_images[img], VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &black, 1, &range);
if (blendp_rotate(cmd, g_land.img, g_swap_fmt, (int)g_extent.width, (int)g_extent.height, g_images[img],
g_swap_fmt, (int)g_extent.height, (int)g_extent.width, g_prerot) != 0 && !g_prerot_failed) {
g_prerot_failed = 1;
droiddeck_log("gpu", "the panel-rotation pass could not be built on this driver: the display rotates the "
"picture from the next frame");
g_surface_checked_ns = 0;
}
VkImageMemoryBarrier b_present = {
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
.newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .image = g_images[img], .subresourceRange = range,
.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT};
g_vk.CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TRANSFER_BIT | VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, 0, 0, NULL, 0, NULL, 1, &b_present);
}
static void record_screen_blit(VkCommandBuffer cmd, VkImage src, int src_w, int src_h,
int scene_w, int scene_h, uint32_t img, VkFilter filter, int cardboard) {
VkImageSubresourceRange range = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1};
@@ -1462,7 +1370,7 @@ static void record_screen_blit(VkCommandBuffer cmd, VkImage src, int src_w, int
{.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .oldLayout = VK_IMAGE_LAYOUT_UNDEFINED,
.newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.image = out_image(img), .subresourceRange = range, .dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT},
.image = g_images[img], .subresourceRange = range, .dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT},
{.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .oldLayout = VK_IMAGE_LAYOUT_GENERAL,
.newLayout = VK_IMAGE_LAYOUT_GENERAL,
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
@@ -1479,9 +1387,9 @@ static void record_screen_blit(VkCommandBuffer cmd, VkImage src, int src_w, int
.srcOffsets = {{0, 0, 0}, {src_w, src_h, 1}},
.dstSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1},
.dstOffsets = {{0, 0, 0}, {src_w, src_h, 1}}};
if (!have_blit || !record_bars_clear(cmd, out_image(img), &blit)) {
if (!have_blit || !record_bars_clear(cmd, g_images[img], &blit)) {
VkClearColorValue black = {.float32 = {0.0f, 0.0f, 0.0f, 1.0f}};
g_vk.CmdClearColorImage(cmd, out_image(img), VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &black, 1, &range);
g_vk.CmdClearColorImage(cmd, g_images[img], VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &black, 1, &range);
}
VkMemoryBarrier mb = {.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER,
.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT,
@@ -1489,9 +1397,15 @@ static void record_screen_blit(VkCommandBuffer cmd, VkImage src, int src_w, int
g_vk.CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
0, 1, &mb, 0, NULL, 0, NULL);
if (have_blit)
g_vk.CmdBlitImage(cmd, src, VK_IMAGE_LAYOUT_GENERAL, out_image(img),
g_vk.CmdBlitImage(cmd, src, VK_IMAGE_LAYOUT_GENERAL, g_images[img],
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &blit, filter);
finish_out_image(cmd, img);
VkImageMemoryBarrier b_present = {
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
.newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .image = g_images[img],
.subresourceRange = range, .srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT};
g_vk.CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT,
0, 0, NULL, 0, NULL, 1, &b_present);
}
static int acquire_image(int k, int first, uint32_t *img, VkResult *ar_out) {
@@ -1525,10 +1439,6 @@ int vkp_render_plain(int scene_w, int scene_h) {
static void check_surface_changed(void) {
if (!g_swapchain || !g_surface || g_dev_state != 1) return;
if (g_prerot && g_prerot_failed) {
destroy_swapchain();
return;
}
const int64_t now = perf_now();
if (now - g_surface_checked_ns < 100000000LL) return;
g_surface_checked_ns = now;
@@ -1702,7 +1612,7 @@ static int render_impl(int scene_w, int scene_h, const struct vkp_draw *draws, i
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .oldLayout = VK_IMAGE_LAYOUT_UNDEFINED,
.newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.image = pass ? scene_img : out_image(img), .subresourceRange = range,
.image = pass ? scene_img : g_images[img], .subresourceRange = range,
.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT};
for (int i = 0; i < n; i++) {
struct vkp_image *im = draws[i].img;
@@ -1726,11 +1636,11 @@ static int render_impl(int scene_w, int scene_h, const struct vkp_draw *draws, i
}
}
g_vk.CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_HOST_BIT | VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT |
((pass || g_prerot) ? VK_PIPELINE_STAGE_ALL_COMMANDS_BIT : 0),
(pass ? VK_PIPELINE_STAGE_ALL_COMMANDS_BIT : 0),
VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, NULL, 0, NULL, (uint32_t)nb, bars);
free(bars);
VkImage target = pass ? scene_img : out_image(img);
VkImage target = pass ? scene_img : g_images[img];
int covered = 0;
VkImageBlit cover_blit;
if (!(hf && pass)) {
@@ -1777,7 +1687,13 @@ static int render_impl(int scene_w, int scene_h, const struct vkp_draw *draws, i
VkImage result = scene_img;
int rw = scene_w, rh = scene_h;
if (!pass) {
finish_out_image(cmd, img);
VkImageMemoryBarrier b_present = {
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
.newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .image = g_images[img],
.subresourceRange = range, .srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT};
g_vk.CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT,
0, 0, NULL, 0, NULL, 1, &b_present);
} else {
VkImageLayout result_layout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
if (fx) {
@@ -18,6 +18,7 @@ class App : Application() {
super.onCreate()
com.droiddeck.launcher.ui.Themes.loadGradient(this)
com.droiddeck.launcher.ui.BuildWatermark.install(this)
HomeApp.trackRecents(this)
// Helper processes must not initialize the main USB provider or guest graphics context.
val process = if (android.os.Build.VERSION.SDK_INT >= 28) Application.getProcessName()
else (getSystemService(ACTIVITY_SERVICE) as android.app.ActivityManager)
@@ -171,6 +171,8 @@ class FrontEndActivity : ComponentActivity() {
private var zramClient by mutableStateOf(true)
private var vramCapMb by mutableStateOf(0)
private var gpuClockPin by mutableStateOf(false)
private var performanceBoost by mutableStateOf(false)
private var boostCheck by mutableStateOf(false)
private var prootNoSeccomp by mutableStateOf(false)
private var prootFastPath by mutableStateOf(true)
private var cursorComposite by mutableStateOf(false)
@@ -1574,6 +1576,22 @@ class FrontEndActivity : ComponentActivity() {
startSession(Intent(this, SessionActivity::class.java).putExtra(SessionActivity.EXTRA_STEAMVR, steamVr), steamSession = true)
}
@Suppress("OVERRIDE_DEPRECATION")
override fun startActivityForResult(intent: Intent, requestCode: Int, options: Bundle?) {
val outside = com.droiddeck.launcher.ui.DualScreenPanel.shownOn >= 0 &&
com.droiddeck.launcher.ui.DualScreenPanel.opensOutside(packageName, intent.component?.packageName ?: intent.`package` ?: intent.resolveActivity(packageManager)?.packageName)
if (outside) {
com.droiddeck.launcher.ui.DualScreenPanel.yieldTo(taskId, true)
window.decorView.postDelayed({ if (hasWindowFocus()) com.droiddeck.launcher.ui.DualScreenPanel.yieldTo(taskId, false) }, 1500)
}
try {
super.startActivityForResult(intent, requestCode, options)
} catch (e: RuntimeException) {
if (outside) com.droiddeck.launcher.ui.DualScreenPanel.yieldTo(taskId, false)
throw e
}
}
override fun onWindowFocusChanged(hasFocus: Boolean) {
super.onWindowFocusChanged(hasFocus)
if (hasFocus) {
@@ -2226,6 +2244,7 @@ class FrontEndActivity : ComponentActivity() {
fsyncFirst = fsyncFirst,
gamescopeRealtime = gamescopeRealtime,
gpuClockPin = gpuClockPin,
performanceBoost = performanceBoost, boostCheck = boostCheck,
ramCapMb = ramCapMb, vramCapMb = vramCapMb, zramClient = zramClient,
deviceRamMb = (android.app.ActivityManager.MemoryInfo()
.also((getSystemService(ACTIVITY_SERVICE) as android.app.ActivityManager)::getMemoryInfo).totalMem / (1024 * 1024)).toInt(),
@@ -2243,6 +2262,8 @@ class FrontEndActivity : ComponentActivity() {
onFsyncFirst = { on -> SessionPrefs.setFsyncFirst(this, on); fsyncFirst = on },
onGamescopeRealtime = { on -> SessionPrefs.setGamescopeRealtime(this, on); gamescopeRealtime = on },
onGpuClockPin = { on -> SessionPrefs.setGpuClockPin(this, on); gpuClockPin = on },
onPerformanceBoost = { on -> SessionPrefs.setPerformanceBoost(this, on); performanceBoost = on },
onBoostCheck = { on -> SessionPrefs.setBoostCheck(this, on); boostCheck = on },
onRamCapMb = { mb -> SessionPrefs.setRamCapMb(this, mb); ramCapMb = mb },
onZramClient = { on -> SessionPrefs.setZramClient(this, on); zramClient = on },
onVramCapMb = { mb -> SessionPrefs.setVramCapMb(this, mb); vramCapMb = mb },
@@ -2459,6 +2480,8 @@ class FrontEndActivity : ComponentActivity() {
zramClient = SessionPrefs.zramClient(this)
vramCapMb = SessionPrefs.vramCapMb(this)
gpuClockPin = SessionPrefs.gpuClockPin(this)
performanceBoost = SessionPrefs.performanceBoost(this)
boostCheck = SessionPrefs.boostCheck(this)
prootNoSeccomp = SessionPrefs.prootNoSeccomp(this)
prootFastPath = SessionPrefs.prootFastPath(this)
cursorComposite = SessionPrefs.cursorComposite(this)
@@ -147,6 +147,52 @@ object HomeApp {
.getShortcutIconDrawable(info, context.resources.displayMetrics.densityDpi)?.toBitmap(px, px)
}.getOrNull()
fun trackRecents(app: android.app.Application) {
app.registerActivityLifecycleCallbacks(object : android.app.Application.ActivityLifecycleCallbacks {
override fun onActivityCreated(activity: android.app.Activity, savedInstanceState: android.os.Bundle?) = Unit
override fun onActivityStarted(activity: android.app.Activity) = Unit
override fun onActivityResumed(activity: android.app.Activity) = syncRecents(activity)
override fun onActivityPaused(activity: android.app.Activity) { if (activity is FrontEndActivity) syncRecents(activity) }
override fun onActivityStopped(activity: android.app.Activity) = Unit
override fun onActivitySaveInstanceState(activity: android.app.Activity, outState: android.os.Bundle) = Unit
override fun onActivityDestroyed(activity: android.app.Activity) = Unit
})
}
private fun syncRecents(activity: android.app.Activity) =
keepOutOfRecents(activity, activity is FrontEndActivity && !SessionState.running && isDefault(activity))
internal enum class RecentsStep { HIDE, SHOW, FORGET, NONE }
internal fun recentsStep(hidden: Boolean, owned: Boolean, excluded: Boolean): RecentsStep = when {
hidden && !excluded -> RecentsStep.HIDE
!hidden && owned && excluded -> RecentsStep.SHOW
!hidden && owned -> RecentsStep.FORGET
else -> RecentsStep.NONE
}
fun keepOutOfRecents(activity: android.app.Activity, hidden: Boolean) {
val prefs = activity.getSharedPreferences("home-recents", Context.MODE_PRIVATE)
val owned = prefs.getStringSet("tasks", null).orEmpty()
val id = activity.taskId.toString()
if (!hidden && id !in owned) return
runCatching {
@Suppress("DEPRECATION")
fun idOf(task: android.app.ActivityManager.AppTask) =
if (Build.VERSION.SDK_INT >= 29) task.taskInfo.taskId else task.taskInfo.persistentId
val tasks = activity.getSystemService(android.app.ActivityManager::class.java).appTasks
val task = tasks.firstOrNull { idOf(it) == activity.taskId } ?: return
val excluded = task.taskInfo.baseIntent.flags and Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS != 0
val step = recentsStep(hidden, id in owned, excluded)
if (step == RecentsStep.NONE) return
if (step != RecentsStep.FORGET) task.setExcludeFromRecents(step == RecentsStep.HIDE)
val live = tasks.map { idOf(it).toString() }.toSet()
val next = owned.filter { it in live && it != id }.toMutableSet()
if (step == RecentsStep.HIDE) next += id
prefs.edit().putStringSet("tasks", next).apply()
}
}
fun startShortcut(context: Context, info: ShortcutInfo) {
val task = generateSequence(context) { (it as? android.content.ContextWrapper)?.baseContext }
.filterIsInstance<android.app.Activity>().firstOrNull()?.taskId
@@ -2836,6 +2836,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
override fun onWheel(steps: Int) { sendSceneWheel(steps) }
override fun onScroll(dx: Float, dy: Float) = fingerScroll(dx, dy)
override fun onScrollEnd() = fingerScrollEnd()
override fun onThreeFingerTap(): Boolean {
uiHandler.post { togglePcKeyboard() }
return true
}
override fun onZoom(steps: Int) {
WaylandCompositor.nativeSendKey(KEY_LEFTCTRL, 1)
sendSceneWheel(steps)
@@ -287,14 +287,17 @@ object AddedGameArt {
var sgdbDown = false
var changed = false
for (game in games) {
if (forgetOtherAppsArt(context, game)) changed = true
val cache = cacheDir(context, game)
val start = missing(context, game)
val again = refetch(cache) intersect start
if (again.isEmpty()) File(cache, REFETCH).delete()
val full = Slot.COVER in start
val allowed = if (full) Slot.values().toSet() else EXTRAS
val allowed = if (full) Slot.values().toSet() else EXTRAS + again
var need = start intersect allowed
if (need.isEmpty() || (need == setOf(Slot.ICON) && sgdbKey.isEmpty())) continue
val cache = cacheDir(context, game)
val tried = File(cache, EXTRAS_TRIED)
if (!full && tried.isFile && tried.lastModified() >= keyChangedAt && System.currentTimeMillis() - tried.lastModified() < RETRY_AFTER_MS) continue
if (!full && again.isEmpty() && tried.isFile && tried.lastModified() >= keyChangedAt && System.currentTimeMillis() - tried.lastModified() < RETRY_AFTER_MS) continue
cache.mkdirs()
if (Slot.LOGO in need && game.source != Library.ADDED && runCatching { sources.storeLogo(game) }.getOrDefault(false)) {
changed = true
@@ -324,11 +327,42 @@ object AddedGameArt {
asked = false
}
}
if ((missing(context, game) intersect EXTRAS).isEmpty()) tried.delete() else if (asked) tried.writeText("")
val left = missing(context, game)
if (again.isNotEmpty()) keepRefetch(cache, again intersect left)
if ((left intersect EXTRAS).isEmpty()) tried.delete() else if (asked) tried.writeText("")
}
return changed
}
internal const val REFETCH = "refetch"
private fun refetch(cache: File): Set<Slot> =
runCatching { File(cache, REFETCH).readText() }.getOrDefault("").split(',').mapNotNull { key -> Slot.values().firstOrNull { it.key == key } }.toSet()
private fun keepRefetch(cache: File, slots: Set<Slot>) {
if (slots.isEmpty()) File(cache, REFETCH).delete() else File(cache, REFETCH).writeText(slots.joinToString(",") { it.key })
}
internal fun forgetOtherAppsArt(context: Context, game: AddedGames.Game): Boolean {
val cache = cacheDir(context, game)
val recorded = SteamMatch.get(context, game.folder.path)?.takeIf { it.appId != null }
val legacy = runCatching { File(cache, "steam-appid").readText().trim().toInt() }.getOrNull()?.takeIf { it > 0 }
val before = recorded?.appId ?: legacy ?: return false
val identity = runCatching { GameIdentifier.identify(game.exe) }.getOrNull()
val now = identity?.appId
val fromFiles = recorded?.certainty == SteamMatch.Certainty.FILES || before == GameIdentifier.SPACEWAR
if (now == before || (now == null && !fromFiles)) return false
SteamMatch.put(context, game.folder.path,
if (identity != null && now != null) SteamMatch.Match(now, SteamMatch.Certainty.FILES, identity.source.name.lowercase(), System.currentTimeMillis())
else SteamMatch.Match(null, SteamMatch.Certainty.NONE, "", 0))
val dropped = Slot.values().filter { File(cache, SteamGridDb.cacheName(it)).delete() }.toSet()
Slot.values().forEach { File(cache, SteamGridDb.cacheName(it) + ".src").delete() }
listOf("sgdb-id", "steam-appid", EXTRAS_TRIED).forEach { File(cache, it).delete() }
keepRefetch(cache, refetch(cache) + dropped)
Log.i(TAG, "${game.name}: its files no longer name Steam app $before; its art is fetched again")
return dropped.isNotEmpty()
}
internal fun steamMatch(context: Context, game: AddedGames.Game, search: (String) -> Int?): SteamMatch.Match {
if (game.source == Store.BATTLENET.id) {
val id = game.storeId?.let(BattleNet::title)?.steam
@@ -5,6 +5,7 @@ import java.io.File
object GameIdentifier {
private const val MAX_PARENT_DEPTH = 6
internal const val SPACEWAR = 480
enum class Source { STEAM_APPID_TXT, STEAM_MANIFEST_ACF, STEAM_EMU_INI, GOG_INFO, PE_VERSION, FILENAME, NONE }
enum class Confidence { HIGH, MEDIUM, LOW }
@@ -92,7 +93,7 @@ object GameIdentifier {
for (candidate in arrayOf(File(dir, "steam_appid.txt"), File(dir, "steam_settings/steam_appid.txt"))) {
val id = readSmallTextFile(candidate)?.removePrefix("\uFEFF")?.trim()
?.takeWhile { it.isDigit() }?.toIntOrNull()
if (id != null && id > 0) return id
if (id != null && id > 0 && id != SPACEWAR) return id
}
return null
}
@@ -111,7 +112,7 @@ object GameIdentifier {
for (f in candidates) {
val text = readSmallTextFile(f) ?: continue
val id = re.find(text)?.groupValues?.getOrNull(1)?.toIntOrNull()
if (id != null && id > 0) return id
if (id != null && id > 0 && id != SPACEWAR) return id
}
return null
}
@@ -133,7 +134,8 @@ object GameIdentifier {
val match = manifests.firstOrNull { m ->
val text = readSmallTextFile(m) ?: return@firstOrNull false
val installdir = vdfValue(text, "installdir")
gameFolder != null && installdir != null && installdir.equals(gameFolder, ignoreCase = true)
gameFolder != null && installdir != null && installdir.equals(gameFolder, ignoreCase = true) &&
vdfValue(text, "appid")?.toIntOrNull() != SPACEWAR
} ?: return null
val text = readSmallTextFile(match) ?: return null
@@ -0,0 +1,162 @@
package com.droiddeck.launcher.frontend
import android.content.Context
import android.util.Log
import com.droiddeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.session.SessionService
import com.droiddeck.launcher.session.SessionState
import com.droiddeck.launcher.stores.SteamLiveShortcuts
import java.io.File
import java.nio.file.Files
import java.nio.file.StandardCopyOption
object SteamLaunchOptions {
private const val TAG = "SteamLaunchOptions"
private val STEAM = listOf("UserLocalConfigStore", "Software", "Valve", "Steam")
fun current(context: Context, appId: Int): String =
SteamLiveShortcuts.launchOptions(context, appId.toLong()) ?: steam(SessionPrefs.activeSteamRoot(context), appId).orEmpty()
enum class Saved { YES, NO, DESKTOP }
fun set(context: Context, appId: Int, options: String, shown: String): Saved {
val value = options.trim()
if (SessionState.running && SessionState.mode == SessionService.MODE_DESKTOP) return Saved.DESKTOP
if (SessionState.running && SessionState.mode == SessionService.MODE_STEAM) {
val live = SteamLiveShortcuts.launchOptions(context, appId.toLong()) ?: return Saved.NO
if (live.trim() != shown.trim()) return Saved.NO
return if (SteamLiveShortcuts.setLaunchOptions(context, appId.toLong(), value)) Saved.YES else Saved.NO
}
val home = SessionPrefs.activeSteamRoot(context)
if (steam(home, appId).orEmpty().trim() != shown.trim()) return Saved.NO
return if (write(home, appId, value)) Saved.YES else Saved.NO
}
internal fun steam(steamHome: File, appId: Int): String? {
val config = AddedGames.accountConfig(steamHome) ?: return null
val text = runCatching { File(config, "localconfig.vdf").readText() }.getOrNull() ?: return null
return launchOptions(text, appId)
}
internal fun write(steamHome: File, appId: Int, options: String): Boolean {
val config = AddedGames.accountConfig(steamHome)?.let { File(it, "localconfig.vdf") } ?: return false
val text = runCatching { config.readText() }.getOrNull() ?: return false
val updated = withLaunchOptions(text, appId, options) ?: return false
if (updated == text) return true
val staged = File(config.parentFile, config.name + ".staged")
return try {
staged.writeText(updated)
if (config.readText() != text) {
staged.delete()
return false
}
Files.move(staged.toPath(), config.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE)
true
} catch (e: Exception) {
staged.delete()
Log.w(TAG, "could not write launch options to ${config.path}", e)
false
}
}
internal fun launchOptions(text: String, appId: Int): String? {
val app = section(text, STEAM + "apps" + appId.toString()) ?: return null
return entries(text, app.valueStart, app.end).firstOrNull { !it.section && it.key.equals("LaunchOptions", true) }
?.let { unescape(text.substring(it.valueStart + 1, it.end)) }
}
internal fun withLaunchOptions(text: String, appId: Int, options: String): String? {
val newline = if (text.contains("\r\n")) "\r\n" else "\n"
var updated = text
var path = STEAM
for (key in listOf("apps", appId.toString())) {
updated = withSection(updated, section(updated, path) ?: return null, key, newline) ?: return null
path = path + key
}
val app = section(updated, path) ?: return null
val value = "\"" + escape(options) + "\""
entries(updated, app.valueStart, app.end).firstOrNull { !it.section && it.key.equals("LaunchOptions", true) }?.let {
return updated.replaceRange(it.valueStart, it.end + 1, value)
}
val lineStart = closingLine(updated, app) ?: return null
val indent = updated.substring(lineStart, app.end) + "\t"
return updated.substring(0, lineStart) + indent + "\"LaunchOptions\"\t\t" + value + newline + updated.substring(lineStart)
}
private class Entry(val key: String, val valueStart: Int, val end: Int, val section: Boolean)
private fun section(text: String, path: List<String>): Entry? {
var found: Entry? = null
for (key in path) {
found = entries(text, found?.valueStart ?: -1, found?.end ?: text.length)
.firstOrNull { it.section && it.key.equals(key, true) } ?: return null
}
return found
}
private fun entries(text: String, open: Int, close: Int): List<Entry> {
val found = ArrayList<Entry>()
var key: String? = null
var i = open + 1
while (i < close) {
when {
text[i] == '"' -> {
val end = stringEnd(text, i) ?: return found
if (key == null) key = unescape(text.substring(i + 1, end)) else { found += Entry(key, i, end, false); key = null }
i = end + 1
}
text[i] == '{' -> {
val end = sectionEnd(text, i) ?: return found
key?.let { found += Entry(it, i, end, true) }
key = null
i = end + 1
}
text.startsWith("//", i) -> i = text.indexOf('\n', i).let { if (it < 0) close else it }
else -> i++
}
}
return found
}
private fun stringEnd(text: String, open: Int): Int? {
var i = open + 1
while (i < text.length) {
when (text[i]) {
'\\' -> i += 2
'"' -> return i
else -> i++
}
}
return null
}
private fun sectionEnd(text: String, open: Int): Int? {
var depth = 0
var i = open
while (i < text.length) {
when (text[i]) {
'"' -> i = stringEnd(text, i) ?: return null
'{' -> depth++
'}' -> if (--depth == 0) return i
}
i++
}
return null
}
private fun withSection(text: String, parent: Entry, key: String, newline: String): String? {
if (entries(text, parent.valueStart, parent.end).any { it.section && it.key.equals(key, true) }) return text
val lineStart = closingLine(text, parent) ?: return null
val indent = text.substring(lineStart, parent.end) + "\t"
return text.substring(0, lineStart) + "$indent\"$key\"$newline$indent{$newline$indent}$newline" + text.substring(lineStart)
}
private fun closingLine(text: String, section: Entry): Int? {
val lineStart = text.lastIndexOf('\n', section.end - 1) + 1
return lineStart.takeIf { lineStart > section.valueStart && text.substring(lineStart, section.end).all { it == '\t' || it == ' ' } }
}
private fun escape(value: String) = value.replace("\\", "\\\\").replace("\"", "\\\"")
private fun unescape(value: String) = value.replace(Regex("\\\\(.)"), "$1")
}
@@ -45,15 +45,15 @@ object SteamMatch {
identity?.appId?.let { id ->
return Match(id, Certainty.FILES, identity.source.name.lowercase(), now).also { put(context, key, it) }
}
val known = get(context, key)
val known = get(context, key)?.takeUnless { it.appId == GameIdentifier.SPACEWAR }
if (known != null && known.certainty == Certainty.NAME) return known
if (known != null && known.certainty == Certainty.NONE && now - known.checkedAt < RETRY_AFTER_MS) return known
legacy?.takeIf { it.isFile }?.let { runCatching { it.readText().trim().toInt() }.getOrNull() }?.takeIf { it > 0 }?.let { id ->
legacy?.takeIf { it.isFile }?.let { runCatching { it.readText().trim().toInt() }.getOrNull() }?.takeIf { it > 0 && it != GameIdentifier.SPACEWAR }?.let { id ->
return Match(id, Certainty.NAME, "store search", now).also { put(context, key, it) }
}
if (search == null) return known?.takeIf { it.certainty != Certainty.FILES } ?: Match(null, Certainty.NONE, "", 0)
val id = runCatching { search(name) }.getOrNull()
val match = if (id != null && id > 0) Match(id, Certainty.NAME, "store search", now) else Match(null, Certainty.NONE, "", now)
val match = if (id != null && id > 0 && id != GameIdentifier.SPACEWAR) Match(id, Certainty.NAME, "store search", now) else Match(null, Certainty.NONE, "", now)
put(context, key, match)
return match
}
@@ -11,6 +11,7 @@ class PointerGestures {
fun onScroll(dx: Float, dy: Float) {}
fun onScrollEnd() {}
fun onZoom(steps: Int) {}
fun onThreeFingerTap(): Boolean = false
}
companion object {
@@ -240,7 +240,8 @@ class TouchpadGestures(
}
if (desktop && scrolled && event.pointerCount == 2) listener.onScrollEnd()
if (fingers >= 3) {
if (event.pointerCount == 2 && secondWasTap && !scrolled && event.eventTime - downAt < TouchTiming.TAP_MS * 2)
if (event.pointerCount == 2 && secondWasTap && !scrolled && event.eventTime - downAt < TouchTiming.TAP_MS * 2 &&
!listener.onThreeFingerTap())
click(PointerGestures.BTN_MIDDLE)
if (event.pointerCount == 2) secondWasTap = false
} else if (twoFingers && secondWasTap && event.eventTime - secondDownAt < TouchTiming.TAP_MS && !scrolled) {
@@ -0,0 +1,485 @@
package com.droiddeck.launcher.session
import android.content.Context
import android.os.BatteryManager
import android.os.Build
import android.os.PowerManager
import android.util.Log
import com.droiddeck.launcher.core.CpuCores
import com.droiddeck.launcher.wayland.WaylandCompositor
import java.io.File
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale
import kotlin.math.abs
import kotlin.math.roundToInt
/**
* What the Performance boost did in a session, in boost.log in the session folder and in the app log:
* whether each part (GameThreadHints, SamsungPerf) came on and can be seen working, a status line
* every [STATUS_S] seconds of play with why a part is off, and a summary with a verdict when the
* session ends. Play is time the game presents frames.
*
* With "Check the boost" on, the boost is on and paused in [WINDOW_S]-second windows of play in the
* order on, paused, paused, on, so the frame rate with and without it is compared over the same
* stretch of game, and a steady change such as the phone warming up favours neither side. The first
* [WARMUP_S] seconds of play (loading, shader compiles) and the first [SETTLE_S] seconds after each
* switch are not counted. Seconds the boost should be on but is held back for heat or battery saver
* are counted as [Side.heldBack]; too many and there is no verdict. Seconds it is off because the
* game keeps up without it are counted as [Side.idle]; if that is most of its turns, the boost is
* not needed for the game.
*/
object BoostReport {
private const val TAG = "BoostReport"
private const val STATUS_S = 30
internal const val WARMUP_S = 60
internal const val WINDOW_S = 60
internal const val SETTLE_S = 5
internal const val CHECK_MIN_S = 120 // counted seconds on each side before there is a verdict
internal const val TOO_HOT = "too hot"
internal const val BATTERY_SAVER = "battery saver"
internal const val KEEPS_UP = "game keeps up"
private const val CONFIRM_S = 2 // held this long before the clocks are compared
private const val SAMPLES = 5
private const val SAMPLE_MS = 200L
private const val RAISED = 1.1
private val THERMAL = listOf("none", "light", "moderate", "severe", "critical", "emergency", "shutdown")
private val GPU_MIN_FILES = listOf(
"/sys/class/kgsl/kgsl-3d0/devfreq/min_freq",
"/sys/class/kgsl/kgsl-3d0/min_clock_mhz",
"/sys/kernel/gpu/gpu_min_clock",
)
/** True while Check the boost has the boost paused; GameThreadHints and SamsungPerf let go meanwhile. */
@Volatile var paused = false
private set
/** Seconds of play on one side of a comparison. */
internal class Side {
val fps = ArrayList<Int>()
val milliamps = ArrayList<Int>()
var hottest = 0
/** Seconds the boost should have been on but was held back for heat or battery saver. */
var heldBack = 0
/** Seconds the boost could have been on but was off because the game kept up without it. */
var idle = 0
val seconds get() = fps.size
val average get() = if (fps.isEmpty()) 0.0 else fps.average()
/** The frame rate of the slowest 5 % of seconds. */
val low get() = if (fps.isEmpty()) 0 else fps.sorted()[fps.size / 20]
val draw get() = if (milliamps.isEmpty()) null else milliamps.average()
fun add(f: Int, ma: Int?, thermal: Int, held: Boolean = false, idle: Boolean = false) {
fps.add(f)
ma?.let { milliamps.add(it) }
hottest = maxOf(hottest, thermal)
if (held) heldBack++
if (idle) this.idle++
}
}
/** The CPU a thread last ran on: field 39 of /proc/<tid>/stat. */
internal fun processorOf(stat: String): Int? =
stat.substringAfterLast(')').trim().split(' ').getOrNull(36)?.toIntOrNull()
/** Each core's class by top speed: 2 the fastest, 0 the slowest, 1 between. */
internal fun tiers(maxGhz: Map<Int, Double>): Map<Int, Int> {
val top = maxGhz.values.maxOrNull() ?: return emptyMap()
val bottom = maxGhz.values.minOrNull() ?: top
return maxGhz.mapValues { (_, ghz) -> if (ghz >= top) 2 else if (ghz <= bottom) 0 else 1 }
}
internal fun minutesForVerdict(): Int {
val counted = IntArray(2)
var played = 0
while (counted.any { it < CHECK_MIN_S }) {
val (pause, at) = checkWindow(++played) ?: continue
if (at >= SETTLE_S) counted[if (pause) 1 else 0]++
}
return (played + 59) / 60
}
/**
* Where second [played] of play falls in the check: null in the warm-up, else whether the boost is
* paused and the seconds since it last switched. One window on, then two paused, two on, and so on.
*/
internal fun checkWindow(played: Int): Pair<Boolean, Int>? {
if (played <= WARMUP_S) return null
val n = played - WARMUP_S - 1
if (n < WINDOW_S) return false to n
val m = n - WINDOW_S
return (m / (2 * WINDOW_S) % 2 == 0) to m % (2 * WINDOW_S)
}
/** Why neither part boosts now, from what each says (Samsung's only where the phone has its service). */
internal fun offReasons(cores: String?, samsung: String?): String =
listOfNotNull(cores, samsung).distinct().joinToString().ifEmpty { "no reason given" }
/** Seconds a part was off, by reason, most first. */
internal fun offTimes(off: Map<String, Int>): String =
off.entries.sortedByDescending { it.value }.joinToString { "${clock(it.value)} ${it.key}" }
/** From Check the boost: whether the boost made the game faster where it matters. */
internal fun verdict(on: Side, off: Side): String {
if (on.seconds > 0 && on.heldBack * 4 > on.seconds) {
return "can't tell: the phone was too hot or saving battery for ${share(on.heldBack, on.seconds)} of the time " +
"the boost should have been on, so it was off then; try again with the phone cool and not charging"
}
if (on.seconds < CHECK_MIN_S || off.seconds < CHECK_MIN_S) {
return "too short to tell: play at least ${minutesForVerdict()} minutes with Check the boost on"
}
if (off.average < 1) return "unclear: the game showed no frames while the boost was paused"
if (on.idle * 2 > on.seconds) {
return "not needed for this game: it kept up without the boost for ${share(on.idle, on.seconds)} of the boost's turns, " +
"so the boost was seldom on (${"%.1f".format(Locale.US, on.average)} fps in its turns, ${"%.1f".format(Locale.US, off.average)} fps paused)"
}
val gain = on.average / off.average - 1
val lowGain = if (off.low > 0) on.low.toDouble() / off.low - 1 else 0.0
val onDraw = on.draw
val offDraw = off.draw
val cost = if (onDraw != null && offDraw != null && offDraw > 0) ", for ${percent(onDraw / offDraw - 1)} battery draw" else ""
val numbers = "${percent(gain)} fps on average, ${percent(lowGain)} in the slowest moments$cost"
return when {
gain >= 0.05 || lowGain >= 0.10 -> "worth keeping: $numbers"
gain <= 0.02 && lowGain <= 0.05 -> "not worth keeping for this game: $numbers"
else -> "unclear, a small gain: $numbers"
}
}
private fun percent(x: Double) = (if (x >= 0) "+" else "") + (x * 100).roundToInt() + " %"
private class Run(val file: File, val check: Boolean) {
var started = false
var played = 0
var lastFrames = -1L
val boosted = Side()
val unboosted = Side()
val checkOn = Side()
val checkOff = Side()
val recent = ArrayList<Int>()
var coresBoosted = 0
val onTier = IntArray(3)
val recentTier = IntArray(3)
var samsungHeld = 0
val coresOff = LinkedHashMap<String, Int>()
val samsungOff = LinkedHashMap<String, Int>()
var heldFor = 0
var cpuBefore = emptyMap<String, Long>()
var gpuBefore: Long? = null
var cpuRaised: Map<String, Pair<Long, Long>>? = null
var gpuRaised = false
var clocks: String? = null
var fallen = false
var drops = 0
var batteryStart: Int? = null
var batteryEnd: Int? = null
var firstFrameMs = 0L
var lastFrameMs = 0L
var charging = false
var hottest = 0
val samsungTries = SamsungPerf.tries
var samsungFailures = 0
}
private val letGoCounts = LinkedHashMap<String, Int>()
private var run: Run? = null
private var worker: Thread? = null
/** SamsungPerf let go of its floors, and why. */
fun letGo(why: String) {
synchronized(letGoCounts) { letGoCounts[why] = (letGoCounts[why] ?: 0) + 1 }
}
/** At a session's start, after the boost's parts. The line is for the log. */
@Synchronized
fun start(context: Context, dir: File): String {
stop()
synchronized(letGoCounts) { letGoCounts.clear() }
if (!SessionPrefs.performanceBoost(context)) return "boost report: off"
val r = Run(File(dir, "boost.log"), SessionPrefs.boostCheck(context))
run = r
val soc = if (Build.VERSION.SDK_INT >= 31) ", ${Build.SOC_MANUFACTURER} ${Build.SOC_MODEL}" else ""
line(r, "Performance boost report: ${Build.MANUFACTURER} ${Build.MODEL}, Android ${Build.VERSION.RELEASE}$soc; " +
"Check the boost ${if (r.check) "on" else "off"}. Play is time the game shows frames.")
val app = context.applicationContext
worker = Thread({ watch(app, r) }, "boost-report").apply { isDaemon = true; start() }
return "boost report: ${r.file}"
}
/** At a session's end: the summary. */
@Synchronized
fun stop() {
val r = run ?: return
run = null
worker?.let { it.interrupt(); it.join(2000) }
worker = null
paused = false
runCatching { summary(r) }.onFailure { Log.w(TAG, "summary", it) }
}
private fun line(r: Run, text: String) {
Log.i(TAG, text)
val clock = SimpleDateFormat("HH:mm:ss", Locale.US).format(Date())
runCatching { r.file.appendText("$clock $text\n") }
}
private fun watch(context: Context, r: Run) {
val pm = context.getSystemService(PowerManager::class.java)
val bm = context.getSystemService(BatteryManager::class.java)
val tiers = tiers(CpuCores.all.associateWith { CpuCores.maxGhz(it) ?: 0.0 })
val gpuFile = GPU_MIN_FILES.map(::File).firstOrNull { readLong(it) != null }
try {
while (!Thread.currentThread().isInterrupted) {
Thread.sleep(1000)
second(r, pm, bm, tiers, gpuFile)
}
} catch (_: InterruptedException) {
} catch (t: Throwable) {
Log.w(TAG, "stopped", t)
} finally {
paused = false
}
}
private fun second(r: Run, pm: PowerManager, bm: BatteryManager?, tiers: Map<Int, Int>, gpuFile: File?) {
val frames = WaylandCompositor.gameFrameCount()
val fps = if (r.lastFrames < 0) 0 else (frames - r.lastFrames).toInt()
r.lastFrames = frames
watchClocks(r, gpuFile)
val failed = r.samsungTries.failed
while (r.samsungFailures < failed.size) {
val n = ++r.samsungFailures
line(r, "Samsung clocks: try $n of ${SamsungPerf.TRIES} to connect failed: ${failed[n - 1]}; ${SamsungPerf.retryNote(n)}")
}
if (fps < 1) return
if (!r.started) {
r.started = true
r.batteryStart = battery(bm)
r.firstFrameMs = System.currentTimeMillis()
line(r, "the game shows frames; fastest cores: ${GameThreadHints.startLine.removePrefix("game thread hints: ")}; " +
"Samsung clocks: ${SamsungPerf.state}")
if (r.check) line(r, "check: starts after the first $WARMUP_S s of play, so loading is not counted")
}
r.played++
val thermal = if (Build.VERSION.SDK_INT >= 29) pm.currentThermalStatus else 0
r.hottest = maxOf(r.hottest, thermal)
val ma = milliamps(bm)
if (bm?.isCharging == true) r.charging = true
r.batteryEnd = battery(bm)
r.lastFrameMs = System.currentTimeMillis()
val threads = GameThreadHints.boostedThreads
val samsung = SamsungPerf.holding
(if (samsung || threads.isNotEmpty()) r.boosted else r.unboosted).add(fps, ma, thermal)
if (samsung) r.samsungHeld++
// A part switching on or off can be read between its two fields, with no reason yet: not counted.
val coresWhy = GameThreadHints.offWhy
val samsungWhy = SamsungPerf.offWhy.takeIf { SamsungPerf.connected }
if (threads.isEmpty() && coresWhy != null) r.coresOff[coresWhy] = (r.coresOff[coresWhy] ?: 0) + 1
if (!samsung && samsungWhy != null) r.samsungOff[samsungWhy] = (r.samsungOff[samsungWhy] ?: 0) + 1
val off = if (samsung || threads.isNotEmpty()) null else offReasons(coresWhy, samsungWhy)
val reasons = listOfNotNull(coresWhy, samsungWhy)
val held = off != null && reasons.any { it == TOO_HOT || it == BATTERY_SAVER }
val idle = off != null && !held && reasons.any { it == KEEPS_UP }
val window = if (r.check) checkWindow(r.played) else null
if (window != null) {
val (pause, at) = window
if (at == 0) {
paused = pause
val span = if (r.played <= WARMUP_S + WINDOW_S) WINDOW_S else 2 * WINDOW_S
line(r, "check: boost ${if (pause) "paused" else "on"} for $span s")
}
if (at >= SETTLE_S) (if (pause) r.checkOff else r.checkOn).add(fps, ma, thermal, held && !pause, idle && !pause)
}
if (threads.isNotEmpty()) {
r.coresBoosted++
for (tid in threads) {
val tier = readText(File("/proc/$tid/stat"))?.let(::processorOf)?.let { tiers[it] } ?: continue
r.onTier[tier]++
r.recentTier[tier]++
}
}
r.recent.add(fps)
if (r.played % STATUS_S == 0) {
status(r, threads.size, samsung, off, thermal, bm, ma)
r.recent.clear()
r.recentTier.fill(0)
}
}
/** Whether Samsung's floors show in the kernel's minimum speeds, and whether they stay there. */
private fun watchClocks(r: Run, gpuFile: File?) {
if (!SamsungPerf.holding) {
r.heldFor = 0
r.fallen = false
r.cpuBefore = cpuMins()
r.gpuBefore = gpuFile?.let(::readLong)
return
}
r.heldFor++
if (r.heldFor == CONFIRM_S && r.clocks == null) {
val (now, gpuNow) = peakMins(gpuFile)
val raised = now.filter { (policy, khz) -> r.cpuBefore[policy]?.let { khz > it * RAISED } == true }
r.cpuRaised = raised.mapValues { (policy, khz) -> r.cpuBefore.getValue(policy) to khz }
val cpu = when {
now.isEmpty() -> "the CPU's minimum speed can't be read on this phone"
raised.isEmpty() -> "the CPU's minimum speed did not change (${mhz(now)})"
else -> "CPU minimum speed raised: " + r.cpuRaised!!.entries.joinToString { (policy, ba) ->
"$policy ${ba.first / 1000} -> ${ba.second / 1000} MHz"
}
}
val gpuThen = r.gpuBefore
r.gpuRaised = gpuNow != null && gpuThen != null && gpuNow > gpuThen * RAISED
val gpu = when {
gpuNow == null || gpuThen == null -> "the GPU's minimum speed can't be read on this phone"
r.gpuRaised -> "GPU minimum raised $gpuThen -> $gpuNow (${gpuFile?.path})"
else -> "the GPU's minimum speed did not change ($gpuNow, ${gpuFile?.path})"
}
r.clocks = "$cpu; $gpu; the memory bus can't be seen from an app"
line(r, "Samsung clocks held: library answered ${SamsungPerf.lastResults}; ${r.clocks}")
}
val raised = r.cpuRaised
if (r.heldFor > CONFIRM_S && !raised.isNullOrEmpty()) {
val now = cpuMins()
val fell = raised.any { (policy, ba) -> now[policy]?.let { it < (ba.first + ba.second) / 2 } == true }
if (fell && !r.fallen) {
r.drops++
line(r, "Samsung clocks let go early: the CPU minimum speed fell back (${mhz(now)}) while DroidDeck still asks for it")
} else if (!fell && r.fallen) {
line(r, "Samsung clocks: the CPU minimum speed is back up (${mhz(now)})")
}
r.fallen = fell
}
}
private fun status(r: Run, threads: Int, samsung: Boolean, off: String?, thermal: Int, bm: BatteryManager?, ma: Int?) {
val state = when {
paused -> "paused for the check"
off == null -> "on"
else -> "off now: $off"
}
val checks = r.recentTier.sum()
val cores = if (threads == 0) "no threads" + because(GameThreadHints.offWhy) else "$threads threads" +
if (checks > 0) ", on the fastest cores ${r.recentTier[2] * 100 / checks} % of checks" else ""
val battery = battery(bm)?.let { "$it %" + (ma?.let { m -> ", $m mA" } ?: "") + if (bm?.isCharging == true) ", charging" else "" } ?: "unknown"
line(r, "status: boost $state; fastest cores: $cores; Samsung clocks: ${if (samsung) "held" else "not held" + because(SamsungPerf.offWhy)}; " +
"CPU minimum ${mhz(cpuMins())}; game ${r.recent.average().roundToInt()} fps, slowest second ${r.recent.minOrNull() ?: 0}; " +
"heat ${THERMAL.getOrElse(thermal) { "$thermal" }}; battery $battery")
}
private fun summary(r: Run) {
if (!r.started) {
line(r, "summary: the game never showed frames, nothing to report")
return
}
val all = Side().apply { (r.boosted.fps + r.unboosted.fps).forEach { add(it, null, 0) } }
line(r, "summary: ${clock(r.played)} of play")
val checks = r.onTier.sum()
line(r, "fastest cores: ${GameThreadHints.startLine.removePrefix("game thread hints: ")}; boosted ${share(r.coresBoosted, r.played)} of play" +
(if (checks > 0) "; boosted threads were on the fastest cores in ${share(r.onTier[2], checks)} of checks, " +
"middle ${share(r.onTier[1], checks)}, slowest ${share(r.onTier[0], checks)}" else "") +
(if (GameThreadHints.refused > 0) "; Android refused a hint session ${GameThreadHints.refused} times" else "") +
(if (r.coresOff.isNotEmpty()) "; off ${offTimes(r.coresOff)}" else ""))
val counts = synchronized(letGoCounts) { letGoCounts.entries.joinToString { "${it.value}x ${it.key}" } }
line(r, "Samsung clocks: ${SamsungPerf.state}; held ${share(r.samsungHeld, r.played)} of play; " +
"${r.clocks ?: "never held long enough to look at the clocks"}; let go early ${r.drops} times" +
(if (counts.isNotEmpty()) "; DroidDeck let go: $counts" else "") +
(if (r.samsungOff.isNotEmpty()) "; off ${offTimes(r.samsungOff)}" else ""))
val failed = r.samsungTries.failed
if (failed.isNotEmpty()) {
line(r, "Samsung clocks: ${failed.size} of ${SamsungPerf.TRIES} tries to connect failed: " +
failed.mapIndexed { i, why -> "${i + 1}) $why" }.joinToString("; ") +
if (SamsungPerf.connected) "; connected after that" else "")
}
line(r, "game: ${all.average.roundToInt()} fps average, slowest 5 % of seconds ${all.low}; " +
"boosted ${r.boosted.average.roundToInt()} fps for ${clock(r.boosted.seconds)}, not boosted ${r.unboosted.average.roundToInt()} fps for ${clock(r.unboosted.seconds)} " +
"(not a fair comparison: the boost runs when the game falls behind)")
val start = r.batteryStart
val end = r.batteryEnd
val spanS = ((r.lastFrameMs - r.firstFrameMs) / 1000).toInt()
val battery = when {
r.charging -> "charging, not measured"
start == null || end == null -> "unknown"
else -> "$start % -> $end % over ${clock(spanS)}" + if (spanS >= 300) ", ${(start - end) * 3600 / spanS} % an hour" else ""
}
line(r, "heat: hottest ${THERMAL.getOrElse(r.hottest) { "${r.hottest}" }}; battery: $battery")
if (r.check) {
line(r, "check: counted ${clock(r.checkOn.seconds)} with the boost on and ${clock(r.checkOff.seconds)} paused (first $WARMUP_S s of play and first $SETTLE_S s after each switch skipped)")
line(r, "check, boost on: ${side(r.checkOn)}")
line(r, "check, paused: ${side(r.checkOff)}")
line(r, "verdict: ${verdict(r.checkOn, r.checkOff)}")
} else {
line(r, "verdict: ${working(r)}. Turn on Check the boost for one game to see whether it is worth keeping.")
}
}
private fun working(r: Run): String {
val start = GameThreadHints.startLine
val cores = when {
start != "game thread hints: watching" -> "fastest cores not on (${start.removePrefix("game thread hints: ")})"
r.coresBoosted == 0 && GameThreadHints.refused > 0 -> "fastest cores refused by Android"
r.coresBoosted == 0 -> "fastest cores never on (${mostly(r.coresOff, r.played)})"
else -> "fastest cores working"
}
val samsung = when {
SamsungPerf.state.startsWith("not available") -> "Samsung clocks not available on this phone"
!SamsungPerf.connected && r.samsungTries.failed.isNotEmpty() ->
"Samsung clocks could not connect (${r.samsungTries.failed.last()})"
r.samsungHeld == 0 -> "Samsung clocks never on (${mostly(r.samsungOff, r.played)})"
r.drops > 0 -> "Samsung clocks working, but Samsung let go early ${r.drops} times"
r.cpuRaised.isNullOrEmpty() && !r.gpuRaised -> "Samsung clocks asked for, but the phone shows no raised speed"
else -> "Samsung clocks working and stayed on"
}
return "$cores; $samsung"
}
private fun because(why: String?) = why?.let { " ($it)" } ?: ""
/** The reason a part was off longest, and for how long. */
private fun mostly(off: Map<String, Int>, played: Int) =
off.maxByOrNull { it.value }?.let { "${it.key} ${clock(it.value)} of ${clock(played)}" } ?: "no reason given"
private fun side(s: Side) = "${"%.1f".format(Locale.US, s.average)} fps, slowest 5 % ${s.low}" +
(s.draw?.let { ", battery ${it.roundToInt()} mA" } ?: "") + ", hottest ${THERMAL.getOrElse(s.hottest) { "${s.hottest}" }}" +
(if (s.heldBack > 0) ", held back for heat or battery saver ${share(s.heldBack, s.seconds)}" else "") +
(if (s.idle > 0) ", off because the game kept up ${share(s.idle, s.seconds)}" else "")
private fun share(part: Int, whole: Int) = if (whole == 0) "0 %" else "${part * 100 / whole} %"
private fun clock(seconds: Int) = "%d:%02d".format(seconds / 60, seconds % 60)
private fun mhz(mins: Map<String, Long>) = if (mins.isEmpty()) "unknown" else mins.values.joinToString("/") { "${it / 1000}" } + " MHz"
/** The highest CPU and GPU minimums over [SAMPLES] readings [SAMPLE_MS] apart, so a floor between two renewals is still seen. */
private fun peakMins(gpuFile: File?): Pair<Map<String, Long>, Long?> {
val cpu = LinkedHashMap<String, Long>()
var gpu: Long? = null
repeat(SAMPLES) { i ->
if (i > 0) Thread.sleep(SAMPLE_MS)
cpuMins().forEach { (policy, khz) -> cpu[policy] = maxOf(cpu[policy] ?: 0L, khz) }
gpuFile?.let(::readLong)?.let { g -> gpu = maxOf(gpu ?: 0L, g) }
}
return cpu to gpu
}
/** Each CPU policy's minimum speed in kHz, as the kernel holds it now. */
private fun cpuMins(): Map<String, Long> =
File("/sys/devices/system/cpu/cpufreq").listFiles { f -> f.name.startsWith("policy") }.orEmpty()
.sortedBy { it.name.removePrefix("policy").toIntOrNull() ?: 0 }
.mapNotNull { p -> readLong(File(p, "scaling_min_freq"))?.let { p.name to it } }
.toMap()
private fun battery(bm: BatteryManager?): Int? =
bm?.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)?.takeIf { it in 0..100 }
private fun milliamps(bm: BatteryManager?): Int? {
val raw = bm?.getLongProperty(BatteryManager.BATTERY_PROPERTY_CURRENT_NOW) ?: return null
if (raw == 0L || raw == Long.MIN_VALUE) return null
return (abs(BatteryComponent.toMicroamps(raw)) / 1000).toInt()
}
private fun readText(f: File): String? = try { f.readText() } catch (_: Exception) { null }
private fun readLong(f: File): Long? = readText(f)?.trim()?.toLongOrNull()
}
@@ -36,6 +36,9 @@ import kotlin.math.abs
* under 90 fps against 2-7% unboosted. A game with no frames (Factorio's benchmark, a loading screen)
* or one falling behind the panel is boosted; one holding pace keeps what it has for [PACE_LEAVE_S]
* seconds and is then let go.
*
* Part of the Performance boost switch, on by default only where it was measured ([measuredHere]).
* Another phone's HAL may boost differently, or not at all.
*/
object GameThreadHints {
private const val TAG = "GameThreadHints"
@@ -46,21 +49,38 @@ object GameThreadHints {
private const val LEAVE = 0.15 // a capped game's main thread idles to ~30% on a prime core; under 0.3 it hopped back and forth
private const val MAX_THREADS = 2 // one per prime core; a third would be sped up in place instead
private const val TOP_PROCESSES = 3
private const val PACE_WINDOW_S = 3
private const val PACE_LEAVE_S = 10
internal const val PACE_WINDOW_S = 3
internal const val PACE_LEAVE_S = 10
private const val PACE_TOLERANCE = 0.08
/** Busy, but not the game: the app itself and the Steam client, whose UI would otherwise hold the prime cores. */
private val NOT_GAMES = setOf("steam", "steamwebhelper")
/** The Odin 3 (CQ8725S), where the boost was measured. */
val measuredHere: Boolean get() = Build.VERSION.SDK_INT >= 31 && Build.SOC_MODEL == "CQ8725S"
private var worker: Thread? = null
/** For BoostReport: the last start line, the threads boosted now, why none is, and hint sessions refused. */
@Volatile internal var startLine = "game thread hints: off"
@Volatile internal var boostedThreads = emptySet<Int>()
@Volatile internal var offWhy: String? = null
@Volatile internal var refused = 0
/** At a session's start. The line is for the log. */
@Synchronized
fun start(context: Context): String {
if (!SessionPrefs.gameThreadHints(context)) return "game thread hints: off"
// Measured on the Odin 3 (CQ8725S) only; another HAL may boost differently, or not at all.
if (Build.VERSION.SDK_INT < 31 || Build.SOC_MODEL != "CQ8725S") return "game thread hints: Odin 3 only"
offWhy = "starting"
return begin(context).also {
startLine = it
if (it != "game thread hints: watching") offWhy = it.removePrefix("game thread hints: ")
}
}
private fun begin(context: Context): String {
refused = 0
if (!SessionPrefs.performanceBoost(context)) return "game thread hints: off"
if (Build.VERSION.SDK_INT < 31) return "game thread hints: needs Android 12"
val hm = context.getSystemService(PerformanceHintManager::class.java)
?: return "game thread hints: no PerformanceHintManager"
val pm = context.getSystemService(PowerManager::class.java)
@@ -92,10 +112,16 @@ object GameThreadHints {
val fps = (frames.last() - frames.first()).toDouble() / (frames.size - 1).coerceAtLeast(1)
val paced = frames.size > PACE_WINDOW_S && holdsPace(fps, SessionState.refreshHz.toDouble())
pacedFor = if (paced) pacedFor + 1 else 0
// Not SEVERE: the Odin 3 reports it once its skin reaches 50 C, a couple of minutes into any game.
val spare = pm.isPowerSaveMode || pm.currentThermalStatus >= PowerManager.THERMAL_STATUS_CRITICAL
val spare = when {
BoostReport.paused -> "check pause"
pm.isPowerSaveMode -> BoostReport.BATTERY_SAVER
// Not SEVERE: the Odin 3 reports it once its skin reaches 50 C, a couple of minutes into any game.
pm.currentThermalStatus >= PowerManager.THERMAL_STATUS_CRITICAL -> BoostReport.TOO_HOT
pacedFor >= PACE_LEAVE_S -> BoostReport.KEEPS_UP
else -> null
}
val next = when {
spare || pacedFor >= PACE_LEAVE_S -> emptySet()
spare != null -> emptySet()
paced -> pick(boosted, busy.filterKeys { it in boosted })
else -> pick(boosted, busy)
}
@@ -103,10 +129,12 @@ object GameThreadHints {
session = update(hm, session, next)
// No session means a thread exited in between: tried again next second.
boosted = if (session == null) emptySet() else next
boostedThreads = boosted
Log.i(TAG, (if (session == null && next.isNotEmpty()) "no session for " else "boosting ") +
next.joinToString { "${readName("/proc/$it/comm")}/$it ${((busy[it] ?: 0.0) * 100).toInt()}%" }.ifEmpty { "nothing" } +
" (game ${fps.toInt()} fps${if (paced) ", holding pace" else ""})")
}
offWhy = offReason(spare, boosted, paced, next)
}
session?.reportActualWorkDuration(TARGET_NS * 3 / 2)
Thread.sleep(REPORT_MS)
@@ -116,17 +144,28 @@ object GameThreadHints {
Log.w(TAG, "stopped", t)
} finally {
session?.close()
boostedThreads = emptySet()
}
}
/** Why no thread is boosted, for the log; null while one is. [spare] is why the boost is held back, if it is. */
internal fun offReason(spare: String?, boosted: Set<Int>, paced: Boolean, next: Set<Int>): String? = when {
spare != null -> spare
boosted.isNotEmpty() -> null
paced -> BoostReport.KEEPS_UP
next.isEmpty() -> "no thread busy enough"
else -> "Android refused the hint"
}
/** A new session over [tids] in place of [session]; null for none. The set changes seldom, so no setThreads. */
private fun update(hm: PerformanceHintManager, session: PerformanceHintManager.Session?, tids: Set<Int>): PerformanceHintManager.Session? {
session?.close()
if (tids.isEmpty()) return null
return try {
hm.createHintSession(tids.toIntArray(), TARGET_NS)
hm.createHintSession(tids.toIntArray(), TARGET_NS).also { if (it == null) refused++ }
} catch (t: RuntimeException) {
Log.w(TAG, "createHintSession", t)
refused++
null
}
}
@@ -0,0 +1,313 @@
package com.droiddeck.launcher.session
import android.content.Context
import android.net.LocalServerSocket
import android.net.LocalSocket
import android.os.Build
import android.os.IBinder
import android.os.Parcel
import android.os.PowerManager
import android.system.Os
import android.system.OsConstants
import android.system.StructPollfd
import android.util.Log
import com.droiddeck.launcher.wayland.WaylandCompositor
import com.samsung.sdk.sperf.Boost
import java.io.DataInputStream
import java.io.DataOutputStream
import java.io.InputStream
import java.lang.reflect.InvocationTargetException
import java.util.concurrent.CopyOnWriteArrayList
import kotlin.random.Random
/**
* Samsung's CPU, GPU and memory-bus clock floors, from the performance service in Samsung's firmware.
* DroidDeck talks to it directly, the way Samsung's Galaxy Performance SDK 1.0.0 does, so the SDK is
* not needed: the binder service [SERVICE] sends the phone's level table over a local socket, and the
* firmware library [LIBRARY] ([Boost]) holds a level. Other phones have neither, and nothing happens.
*
* The floors are those of the SDK's CPU, GPU and bus presets (the middle of five levels, at least four
* cores online), asked for with a timeout of at most [HOLD_MS], so Samsung lets go on its own if the
* app dies. Samsung may hold a request for less than asked (1 s on an SM8850 Galaxy Z Fold), so they
* are renewed every [renewMs].
*
* A phone without the firmware library is not asked again until the app restarts. Where the library
* is there, a failed connection is tried again [TRIES] times a session, each failure with its reason
* in [Tries.failed], and again at the next session.
*/
object SamsungPerf {
private const val TAG = "SamsungPerf"
private const val LIBRARY = "perfsdk.performance.samsung"
private const val SERVICE = "perfsdkservice"
private const val DESCRIPTOR = "com.samsung.android.perfsdkservice.IPerfSDKService"
private const val CALL_INIT = IBinder.FIRST_CALL_TRANSACTION // initPerfSDK(socket name): Int
private const val CALL_PACKAGE = IBinder.FIRST_CALL_TRANSACTION + 1 // getAllowedPkgName(): String
private const val ASK_LEVELS = 10
private const val SOCKET_TIMEOUT_MS = 3000
// Boost.requestBoost types
internal const val CPU_MIN = 0
internal const val GPU_MIN = 2
internal const val BUS_MIN = 4
internal const val CPU_CORES_MIN = 6
private const val LEVEL = 2
private const val CORES = 4
internal const val HOLD_MS = 5000
private const val SEEN_HOLD_MS = 1000
internal const val TRIES = 4
private val RETRY_S = intArrayOf(5, 15, 30)
/** Half the hold, and no later than half the shortest hold Samsung has been seen to use. */
internal fun renewMs(holdMs: Int): Long = (minOf(holdMs, SEEN_HOLD_MS) / 2).coerceAtLeast(100).toLong()
/** The floors the phone offers, five values each from low to high, and the longest timeout (≤ 0: none). */
internal class Levels(val cpu: IntArray, val gpu: IntArray, val bus: IntArray, val maxTimeoutMs: Int)
/** The service's answer to [ASK_LEVELS] in little-endian ints: the floors, then the ceilings, unused here. */
internal fun readLevels(stream: InputStream): Levels {
val input = DataInputStream(stream)
fun next() = Integer.reverseBytes(input.readInt())
fun five() = IntArray(5) { next() }
repeat(3) { next() }
val timeout = next()
val levels = Levels(five(), five(), five(), timeout)
repeat(3 + 1 + 15) { next() } // level counts, the ceilings' timeout, CPU, GPU and bus ceilings
return levels
}
/** One Boost.requestBoost call. */
internal data class Floor(val type: Int, val value: Int, val timeoutMs: Int)
internal fun floors(levels: Levels): List<Floor> {
val timeout = if (levels.maxTimeoutMs > 0) minOf(HOLD_MS, levels.maxTimeoutMs) else HOLD_MS
return listOf(
Floor(CPU_MIN, levels.cpu[LEVEL], timeout),
Floor(CPU_CORES_MIN, CORES, timeout),
Floor(GPU_MIN, levels.gpu[LEVEL], timeout),
Floor(BUS_MIN, levels.bus[LEVEL], timeout),
).filter { it.value > 0 }
}
/** One session's tries to connect: why each failed, and whether all [TRIES] did. */
internal class Tries {
val failed = CopyOnWriteArrayList<String>()
@Volatile var gaveUp = false
}
/** What the log says after try [n] failed. */
internal fun retryNote(n: Int): String =
if (n < TRIES) "trying again in ${RETRY_S[n - 1]} s" else "no more tries until the next game"
/** A failed try's reason: the step it was on and what went wrong there. */
internal fun failure(step: String, t: Throwable): String {
val cause = (t as? InvocationTargetException)?.targetException ?: t
return "failed while $step (${cause.javaClass.simpleName}${cause.message?.takeIf { it.isNotBlank() }?.let { ": $it" } ?: ""})"
}
private val connectLock = Any()
@Volatile private var floors: List<Floor>? = null
@Volatile private var unavailable: String? = null
private var socket: LocalSocket? = null // kept open for the process's life, as the SDK does
@Volatile internal var tries = Tries()
private class Failed(val why: String) : Exception(why)
/** Null where there is no Samsung service (the reason in [unavailable]) or this try failed (the reason in [t]). */
private fun connect(t: Tries): List<Floor>? = synchronized(connectLock) { connectLocked(t) }
private fun connectLocked(t: Tries): List<Floor>? {
floors?.let { return it }
if (unavailable != null) return null
try {
System.loadLibrary(LIBRARY)
} catch (_: UnsatisfiedLinkError) {
unavailable = "no Samsung performance library"
offWhy = unavailable
Log.i(TAG, "not available: $unavailable")
return null
}
var step = "looking up Samsung's performance service"
var client: LocalSocket? = null
try {
val service = Class.forName("android.os.ServiceManager").getMethod("getService", String::class.java)
.invoke(null, SERVICE) as IBinder? ?: throw Failed("Samsung's performance service ($SERVICE) is not running")
val name = "PERFSDK_SOC_" + Random.nextInt(36 * 36 * 36 * 36 * 36).toString(36).padStart(5, '0')
step = "opening a socket for the service"
val server = LocalServerSocket(name) // the service connects to it; Closeable only from Android 10
val accepted = try {
step = "asking the service to connect"
val init = call(service, CALL_INIT, { writeString(name) }, { readInt() })
step = "asking the service for the package name"
val pkg = call(service, CALL_PACKAGE, {}, { readString() })
if (!pkg.isNullOrEmpty()) Boost.setPkgName(pkg)
Log.i(TAG, "service: init $init, package $pkg")
step = "waiting for the service to connect"
val poll = StructPollfd().apply { fd = server.fileDescriptor; events = OsConstants.POLLIN.toShort() }
if (Os.poll(arrayOf(poll), SOCKET_TIMEOUT_MS) < 1) {
throw Failed("the service did not connect within ${SOCKET_TIMEOUT_MS / 1000} s (it answered $init, package ${pkg ?: "none"})")
}
server.accept()
} finally {
server.close()
}
client = accepted
step = "reading the service's level table"
accepted.soTimeout = SOCKET_TIMEOUT_MS
DataOutputStream(accepted.outputStream).apply { writeInt(Integer.reverseBytes(ASK_LEVELS)); flush() }
val levels = readLevels(accepted.inputStream)
Log.i(TAG, "levels: cpu ${levels.cpu.joinToString()} / gpu ${levels.gpu.joinToString()} / " +
"bus ${levels.bus.joinToString()}, max ${levels.maxTimeoutMs} ms")
val found = floors(levels)
if (found.isEmpty()) {
throw Failed("the level table has no usable floors (cpu ${levels.cpu.joinToString()} / gpu ${levels.gpu.joinToString()} / bus ${levels.bus.joinToString()})")
}
socket = accepted
client = null
floors = found
return found
} catch (e: Throwable) {
val why = (e as? Failed)?.why ?: failure(step, e)
t.failed.add(why)
offWhy = "could not connect"
Log.w(TAG, "try ${t.failed.size} of $TRIES failed: $why", e.takeIf { it !is Failed })
return null
} finally {
client?.let { runCatching { it.close() } }
}
}
private fun <T> call(service: IBinder, code: Int, write: Parcel.() -> Unit, read: Parcel.() -> T): T {
val data = Parcel.obtain()
val reply = Parcel.obtain()
try {
data.writeInterfaceToken(DESCRIPTOR)
data.write()
if (!service.transact(code, data, reply, 0)) throw Failed("the service does not take call $code")
reply.readException()
return reply.read()
} finally {
reply.recycle()
data.recycle()
}
}
private var worker: Thread? = null
/** For BoostReport: whether the floors are held now, why not, and what the library answered when they were asked for. */
@Volatile internal var holding = false
@Volatile internal var offWhy: String? = null
@Volatile internal var lastResults = emptyList<Int>()
internal val connected get() = floors != null
/** For BoostReport. */
internal val state: String
get() = unavailable?.let { "not available: $it" }
?: floors?.let { f ->
val hold = f.minOf { it.timeoutMs }
"connected, floors " + f.joinToString { "${TYPE_NAMES[it.type]} ${it.value}" } +
", asked for $hold ms at a time, renewed every ${renewMs(hold)} ms"
}
?: tries.let { t ->
when {
t.gaveUp -> "could not connect in $TRIES tries (last: ${t.failed.lastOrNull()})"
t.failed.isNotEmpty() -> "connecting, try ${t.failed.size + 1} of $TRIES"
else -> "connecting"
}
}
internal fun floorValue(type: Int): Int? = floors?.firstOrNull { it.type == type }?.value
private val TYPE_NAMES = mapOf(CPU_MIN to "CPU", GPU_MIN to "GPU", BUS_MIN to "bus", CPU_CORES_MIN to "cores")
/** At a session's start. The line is for the log. */
@Synchronized
fun start(context: Context): String {
if (!SessionPrefs.performanceBoost(context)) return "samsung boost: off"
unavailable?.let { return "samsung boost: $it" }
val app = context.applicationContext
worker?.interrupt()
offWhy = "starting"
val t = Tries()
tries = t
worker = Thread({ run(app, t) }, "samsung-boost").apply { isDaemon = true; start() }
return "samsung boost: watching"
}
/** At a session's end. */
@Synchronized
fun stop() {
worker?.interrupt()
worker = null
}
private fun run(context: Context, t: Tries) {
var boosting = false
try {
var found = connect(t)
while (found == null && unavailable == null && t.failed.size < TRIES) {
Thread.sleep(RETRY_S[t.failed.size - 1] * 1000L)
found = connect(t)
}
if (found == null) {
if (unavailable == null) {
t.gaveUp = true
offWhy = "could not connect in $TRIES tries"
}
return
}
val floors: List<Floor> = found
val renew = renewMs(floors.minOf { it.timeoutMs })
val pm = context.getSystemService(PowerManager::class.java)
val frames = ArrayDeque<Long>()
var pacedFor = 0
while (!Thread.currentThread().isInterrupted) {
frames.addLast(WaylandCompositor.gameFrameCount())
if (frames.size > GameThreadHints.PACE_WINDOW_S + 1) frames.removeFirst()
val fps = (frames.last() - frames.first()).toDouble() / (frames.size - 1).coerceAtLeast(1)
val paced = frames.size > GameThreadHints.PACE_WINDOW_S && GameThreadHints.holdsPace(fps, SessionState.refreshHz.toDouble())
pacedFor = if (paced) pacedFor + 1 else 0
val hot = Build.VERSION.SDK_INT >= 29 && pm.currentThermalStatus >= PowerManager.THERMAL_STATUS_SEVERE
val why = when {
BoostReport.paused -> "check pause"
fps < 1 -> "no frames"
pm.isPowerSaveMode -> BoostReport.BATTERY_SAVER
hot -> BoostReport.TOO_HOT
pacedFor >= GameThreadHints.PACE_LEAVE_S -> BoostReport.KEEPS_UP
else -> null
}
offWhy = why
val want = why == null
if (want) {
val results = request(floors)
holding = true
if (!boosting) {
lastResults = results
Log.i(TAG, "boosting (game ${fps.toInt()} fps, results $results)")
}
} else if (boosting) {
holding = false // first, so BoostReport does not read the release as Samsung letting go
Boost.releaseBoost()
BoostReport.letGo(why!!)
Log.i(TAG, "let go ($why, game ${fps.toInt()} fps)")
}
boosting = want
var slept = 0L
while (slept + renew < 1000) {
Thread.sleep(renew)
slept += renew
if (boosting) request(floors)
}
Thread.sleep(1000 - slept)
}
} catch (_: InterruptedException) {
} catch (e: Throwable) {
Log.w(TAG, "stopped", e)
} finally {
if (boosting) runCatching { Boost.releaseBoost() }
holding = false
}
}
private fun request(floors: List<Floor>) = floors.map { Boost.requestBoost(it.type, it.value, it.timeoutMs) }
}
@@ -615,8 +615,22 @@ object SessionPrefs {
prefs(context).edit().putBoolean("gpuClockPin", on).apply()
}
/** Whether the game's busiest threads are named to the power HAL for a boost (GameThreadHints). */
fun gameThreadHints(context: Context): Boolean = prefs(context).getBoolean("gameThreadHints", true)
/**
* The performance boost: the game's busiest threads named to the power HAL (GameThreadHints) and,
* on a Samsung phone, Samsung's clock floors (SamsungPerf).
*/
fun performanceBoost(context: Context): Boolean = prefs(context).getBoolean("performanceBoost", GameThreadHints.measuredHere)
fun setPerformanceBoost(context: Context, on: Boolean) {
prefs(context).edit().putBoolean("performanceBoost", on).apply()
}
/** Check the boost: BoostReport pauses the boost every other minute of play and compares. */
fun boostCheck(context: Context): Boolean = prefs(context).getBoolean("boostCheck", false)
fun setBoostCheck(context: Context, on: Boolean) {
prefs(context).edit().putBoolean("boostCheck", on).apply()
}
fun prootNoSeccomp(context: Context): Boolean = prefs(context).getBoolean("prootNoSeccomp", false)
@@ -499,6 +499,8 @@ class SessionService : Service() {
Log.i(TAG, GpuClockPin.start(this))
Log.i(TAG, GameThreadHints.start(this))
Log.i(TAG, SamsungPerf.start(this))
Log.i(TAG, BoostReport.start(this, sessionDir))
val size = SessionState.outputSize
val guest = ArrayList<String>()
@@ -1810,7 +1812,9 @@ class SessionService : Service() {
SessionState.program == NoSteamLaunch.BATTLENET
SessionState.stopRequested = false
GpuClockPin.stop(this)
BoostReport.stop()
GameThreadHints.stop()
SamsungPerf.stop()
suspendOperationPending = false
freezePending = false
launchWatcher?.stopWatching()
@@ -1890,7 +1894,9 @@ class SessionService : Service() {
override fun onDestroy() {
stopSession(0)
BoostReport.stop()
GameThreadHints.stop() // also when the session never got as far as running
SamsungPerf.stop()
if (screenReceiverRegistered) {
unregisterReceiver(screenReceiver)
screenReceiverRegistered = false
@@ -19,7 +19,7 @@ object SettingsReset {
"gamepadLeft", "gamepadRight", "pipAutoEnter", "unfoldedControls", "unfoldedControlsWithController",
"stretch16x9", "picturePosition", "railLabels",
"gpuDriverMode", "androidDriver", "linuxDriver", "linuxDriver.steam", "linuxDriver.desktop",
"tuSysmem", "glThread", "noGlError", "zinkLazy", "mangoapp", "gpuClockPin", "gamescopeRealtime", "ramCapMb", "vramCapMb", "zramClient",
"tuSysmem", "glThread", "noGlError", "zinkLazy", "mangoapp", "gpuClockPin", "performanceBoost", "boostCheck", "gamescopeRealtime", "ramCapMb", "vramCapMb", "zramClient",
"directAudio", "mic", "wifiDiscovery", "clientCpusOverride", "clientCpus", "gameCpus",
"noXalia", "fastSync", "fsyncFirst", "syncFallback", "prootNoSeccomp", "prootFastPath", "cursorComposite",
"guestHostname", "fexPreset", "forceSsbs", "logs", "gameDebugLogsEnabled", "storageDiagnostics",
@@ -92,6 +92,28 @@ object SteamLiveShortcuts {
if (evaluate(context, js) != null) Log.i(TAG, "live shortcuts: updated $id")
}
fun launchOptions(context: Context, appId: Long): String? {
if (!clientRunning()) return null
val js = """
new Promise(done => {
let handle = null, answer;
const finish = d => { clearTimeout(timer); try { handle?.unregister(); } catch (e) {} done(d); };
const timer = setTimeout(() => finish(null), 4000);
handle = SteamClient.Apps.RegisterForAppDetails(${appId and 0xFFFFFFFFL}, d => { answer = d; if (handle) finish(d); });
if (answer !== undefined) finish(answer);
}).then(d => typeof d?.strLaunchOptions === 'string' ? d.strLaunchOptions : null)
""".trimIndent()
return evaluate(context, js)
}
fun setLaunchOptions(context: Context, appId: Long, options: String): Boolean {
if (!clientRunning()) return false
val id = appId and 0xFFFFFFFFL
val done = evaluate(context, "(async () => { SteamClient.Apps.SetAppLaunchOptions($id, ${JSONObject.quote(options)}); return 1; })()") != null
if (done) Log.i(TAG, "live: launch options for $id")
return done
}
fun setArt(context: Context, appId: Long, assetType: Int?, file: java.io.File?, iconPath: String? = null) {
if (!clientRunning()) return
val id = appId and 0xFFFFFFFFL
@@ -68,6 +68,7 @@ import com.droiddeck.launcher.frontend.AddedGames
import com.droiddeck.launcher.frontend.LogoPosition
import com.droiddeck.launcher.frontend.SteamGameArt
import com.droiddeck.launcher.frontend.SteamGridDb
import com.droiddeck.launcher.frontend.SteamLaunchOptions
import com.droiddeck.launcher.session.SessionPrefs
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
@@ -191,7 +192,7 @@ internal fun SteamGameArtEditor(
game: com.droiddeck.launcher.frontend.Library.SteamGame, onClose: () -> Unit, onChanged: () -> Unit,
) {
val target = remember(game.appId) { ArtTarget.of(game) }
ArtOnlyEditor(game.name, target, game, { SteamGameArt.describe(it, game) }, onClose, onChanged)
ArtOnlyEditor(game.name, target, game, { SteamGameArt.describe(it, game) }, onClose, onChanged, launchAppId = game.appId)
}
@Composable
@@ -207,18 +208,25 @@ internal fun StoreGameArtEditor(folder: String, name: String, onClose: () -> Uni
@Composable
private fun ArtOnlyEditor(
name: String, target: ArtTarget?, refresh: Any?, describe: (Context) -> List<AddedGameArt.SlotState>,
onClose: () -> Unit, onChanged: () -> Unit,
onClose: () -> Unit, onChanged: () -> Unit, launchAppId: Int? = null,
) {
val app = LocalContext.current.applicationContext
val colors = MaterialTheme.colorScheme
val scope = rememberCoroutineScope()
val shown = rememberShown(onClose)
val close = { shown.targetState = false }
var version by remember { mutableIntStateOf(0) }
var arts by remember { mutableStateOf<List<AddedGameArt.SlotState>>(emptyList()) }
var artSlot by remember { mutableStateOf<AddedGameArt.Slot?>(null) }
var logoOpen by remember { mutableStateOf(false) }
var launchOptions by remember { mutableStateOf<String?>(null) }
var launchVersion by remember { mutableIntStateOf(0) }
var editingLaunch by remember { mutableStateOf<String?>(null) }
var launchSaving by remember { mutableStateOf(false) }
var launchError by remember { mutableStateOf<Int?>(null) }
val position = rememberLogoPosition(target, version)
LaunchedEffect(version, refresh) { if (target != null) arts = withContext(Dispatchers.IO) { describe(app) } }
LaunchedEffect(launchAppId, launchVersion) { if (launchAppId != null) launchOptions = withContext(Dispatchers.IO) { SteamLaunchOptions.current(app, launchAppId) } }
val first = remember { FocusRequester() }
LaunchedEffect(Unit) { focusWithinFrames({ false }) { first } }
AppDialog(shown, close, "artEditor", wide = false, maxWidth = 460.dp) {
@@ -228,10 +236,19 @@ private fun ArtOnlyEditor(
verticalArrangement = Arrangement.spacedBy(6.dp),
modifier = Modifier.fillMaxWidth().heightIn(max = maxHeight).verticalScroll(rememberScrollState()),
) {
Text(stringResource(R.string.edit_artwork), fontSize = 12.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(start = 4.dp, top = 2.dp))
if (launchAppId != null) {
FieldRow(stringResource(R.string.edit_launch_options), focus = first, onClick = { if (!launchSaving) launchOptions?.let { editingLaunch = it } }) {
val options = launchOptions
if (options == null || launchSaving) Loading() else ValueText(options.ifEmpty { "—" }, muted = options.isEmpty())
}
val error = launchError
if (error != null) Text(stringResource(error), fontSize = 12.sp, color = colors.error, modifier = Modifier.padding(start = 4.dp))
else Text(stringResource(R.string.edit_launch_options_steam_hint), fontSize = 12.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(start = 4.dp))
}
Text(stringResource(R.string.edit_artwork), fontSize = 12.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(start = 4.dp, top = if (launchAppId != null) 8.dp else 2.dp))
for (slot in AddedGameArt.Slot.values()) key(slot) {
val state = arts.firstOrNull { it.slot == slot }
FieldRow(slot.label(), focus = if (slot == AddedGameArt.Slot.COVER) first else null, onClick = { if (target != null) artSlot = slot }) {
FieldRow(slot.label(), focus = if (slot == AddedGameArt.Slot.COVER && launchAppId == null) first else null, onClick = { if (target != null) artSlot = slot }) {
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp)) {
SlotThumb(slot, state?.file)
if (state != null) ValueText(artSourceLabel(state.source), muted = true) else Loading()
@@ -241,6 +258,27 @@ private fun ArtOnlyEditor(
PickerRow(Icons.Outlined.Tune, stringResource(R.string.art_adjust_logo), logoPositionSummary(position?.value), enabled = target != null && position != null) { logoOpen = true }
}
}
val before = editingLaunch
if (before != null && launchAppId != null) TextEntryDialog(stringResource(R.string.edit_launch_options), before, onDismiss = { editingLaunch = null }) { value ->
if (launchSaving || value == before.trim()) return@TextEntryDialog
launchSaving = true
scope.launch {
try {
val saved = withContext(Dispatchers.IO) { SteamLaunchOptions.set(app, launchAppId, value, before) }
launchError = when (saved) {
SteamLaunchOptions.Saved.YES -> null
SteamLaunchOptions.Saved.DESKTOP -> R.string.edit_launch_options_desktop
SteamLaunchOptions.Saved.NO -> R.string.edit_launch_options_not_saved
}
if (saved == SteamLaunchOptions.Saved.YES) launchOptions = value else {
launchOptions = null
launchVersion++
}
} finally {
launchSaving = false
}
}
}
val chosen = target ?: return
artSlot?.let { slot ->
ArtChooserDialog(chosen, slot, arts.firstOrNull { it.slot == slot }, onBack = { artSlot = null }, onCloseAll = { artSlot = null; close() }) { version++; onChanged() }
@@ -155,6 +155,8 @@ object DualScreenPanel {
if (ownerTask == task) ownerYielded = app
}
fun opensOutside(own: String, target: String?): Boolean = target != null && target != own
fun ownerPaused(task: Int, paused: Boolean) {
if (ownerTask == task) ownerPaused = paused
}
@@ -164,18 +166,13 @@ object DualScreenPanel {
return ownerTask.takeIf { it >= 0 }
}
internal fun tookFocus(fresh: Boolean, touchedAt: Long, now: Long): Boolean =
fresh || now - touchedAt in 0..TOUCH_FOCUS_MS
private const val TOUCH_FOCUS_MS = 1000L
internal fun returnFocus(context: Context, fromPanel: Boolean = false) {
val task = focusTask(fromPanel) ?: return
runCatching { (context.getSystemService(Context.ACTIVITY_SERVICE) as android.app.ActivityManager).moveTaskToFront(task, 0) }
}
internal fun reclaimFocus(context: Context) {
val task = focusTask(false) ?: return
val task = focusTask(true) ?: return
val manager = context.getSystemService(Context.ACTIVITY_SERVICE) as android.app.ActivityManager
runCatching {
manager.appTasks.firstOrNull {
@@ -243,21 +240,16 @@ class DualScreenActivity : ComponentActivity() {
}
private var topResumed = false
private var fresh = true
private var touchedAt = Long.MIN_VALUE
override fun onTopResumedActivityChanged(isTopResumedActivity: Boolean) {
super.onTopResumedActivityChanged(isTopResumedActivity)
topResumed = isTopResumedActivity
val took = DualScreenPanel.tookFocus(fresh, touchedAt, android.os.SystemClock.uptimeMillis())
fresh = false
if (isTopResumedActivity && !DualScreenPanel.typingShown) DualScreenPanel.returnFocus(this, fromPanel = took)
if (isTopResumedActivity && !DualScreenPanel.typingShown) DualScreenPanel.returnFocus(this, fromPanel = true)
}
override fun dispatchTouchEvent(event: android.view.MotionEvent): Boolean {
if (event.actionMasked == android.view.MotionEvent.ACTION_DOWN) {
touchedAt = event.downTime
if (topResumed && !DualScreenPanel.typingShown) DualScreenPanel.returnFocus(this, fromPanel = true)
if (event.actionMasked == android.view.MotionEvent.ACTION_DOWN && topResumed && !DualScreenPanel.typingShown) {
DualScreenPanel.returnFocus(this, fromPanel = true)
}
return super.dispatchTouchEvent(event)
}
@@ -46,6 +46,8 @@ fun PerformancePage(
fsyncFirst: Boolean,
gamescopeRealtime: Boolean,
gpuClockPin: Boolean,
performanceBoost: Boolean,
boostCheck: Boolean,
ramCapMb: Int,
zramClient: Boolean,
vramCapMb: Int,
@@ -67,6 +69,8 @@ fun PerformancePage(
onFsyncFirst: (Boolean) -> Unit,
onGamescopeRealtime: (Boolean) -> Unit,
onGpuClockPin: (Boolean) -> Unit,
onPerformanceBoost: (Boolean) -> Unit,
onBoostCheck: (Boolean) -> Unit,
onRamCapMb: (Int) -> Unit,
onZramClient: (Boolean) -> Unit,
onVramCapMb: (Int) -> Unit,
@@ -126,6 +130,18 @@ fun PerformancePage(
gamescopeRealtime, onChange = onGamescopeRealtime,
)
}
SettingsGroup(stringResource(R.string.perf_boost_group)) {
ToggleRow(
host, "boost", stringResource(R.string.perf_boost),
stringResource(R.string.perf_boost_hint),
performanceBoost, onChange = onPerformanceBoost,
)
ToggleRow(
host, "boostcheck", stringResource(R.string.perf_boost_check),
stringResource(R.string.perf_boost_check_hint),
boostCheck, enabled = performanceBoost, onChange = onBoostCheck,
)
}
SettingsGroup(stringResource(R.string.perf_gpu)) {
ToggleRow(
host, "gpuclock", stringResource(R.string.perf_gpuclock),
@@ -0,0 +1,20 @@
package com.samsung.sdk.sperf;
/**
* Entry points of libperfsdk.performance.samsung.so, the performance library in Samsung's firmware.
* The library binds them by this class name, so the name has to stay. Used by
* com.droiddeck.launcher.session.SamsungPerf; on other phones the library is missing.
*/
public final class Boost {
private Boost() {
}
/** Holds a resource (CPU_MIN, GPU_MIN...) at a value from the service's level table. */
public static native int requestBoost(int type, int value, int timeoutMs);
/** Lets go of everything this app holds. */
public static native int releaseBoost();
/** The package name the service gives out; the library refuses requests until it is set. */
public static native int setPkgName(String name);
}
+3
View File
@@ -2473,6 +2473,9 @@
<string name="edit_target">الهدف</string>
<string name="edit_start_in">بدء التشغيل في</string>
<string name="edit_launch_options">خيارات التشغيل</string>
<string name="edit_launch_options_steam_hint">مشتركة مع خصائص Steam: أي تغيير في أحدهما يظهر في كليهما.</string>
<string name="edit_launch_options_not_saved">تعذّر حفظ خيارات التشغيل في Steam. حاول مرة أخرى.</string>
<string name="edit_launch_options_desktop">قد يكون Steam مفتوحًا في جلسة سطح المكتب. غيّر خيارات التشغيل من خصائصه، أو أغلق الجلسة أولًا.</string>
<string name="edit_artwork">الصور الفنية</string>
<string name="edit_other_exe">ملف exe آخر…</string>
<string name="edit_remove">إزالة</string>
@@ -2422,6 +2422,9 @@
<string name="edit_target">Destino</string>
<string name="edit_start_in">Iniciar en</string>
<string name="edit_launch_options">Opciones de lanzamiento</string>
<string name="edit_launch_options_steam_hint">Se comparten con las Propiedades de Steam: un cambio en cualquiera de los dos se ve en ambos.</string>
<string name="edit_launch_options_not_saved">No se pudieron guardar las opciones de lanzamiento en Steam. Inténtalo de nuevo.</string>
<string name="edit_launch_options_desktop">Es posible que Steam esté abierto en la sesión de escritorio. Cambia las opciones de lanzamiento en sus Propiedades o cierra primero la sesión.</string>
<string name="edit_artwork">Ilustraciones</string>
<string name="edit_other_exe">Otro exe…</string>
<string name="edit_remove">Quitar</string>
+3
View File
@@ -2381,6 +2381,9 @@
<string name="edit_target">Цел</string>
<string name="edit_start_in">Старт в</string>
<string name="edit_launch_options">Настройки за стартиране</string>
<string name="edit_launch_options_steam_hint">Общи са със „Свойства“ в Steam: промяна на едното място се вижда и на двете.</string>
<string name="edit_launch_options_not_saved">Настройките за стартиране не можаха да бъдат запазени в Steam. Опитайте отново.</string>
<string name="edit_launch_options_desktop">Steam може да е отворен в сесията на работния плот. Променете настройките за стартиране в неговите „Свойства“ или първо затворете сесията.</string>
<string name="edit_artwork">Визия</string>
<string name="edit_other_exe">Друг exe…</string>
<string name="edit_remove">Премахни</string>
+3
View File
@@ -2427,6 +2427,9 @@
<string name="edit_target">Cíl</string>
<string name="edit_start_in">Spustit v</string>
<string name="edit_launch_options">Možnosti spuštění</string>
<string name="edit_launch_options_steam_hint">Sdíleno s Vlastnostmi ve Steamu: změna na jednom místě se projeví na obou.</string>
<string name="edit_launch_options_not_saved">Možnosti spuštění se nepodařilo uložit do Steamu. Zkuste to znovu.</string>
<string name="edit_launch_options_desktop">Steam může být otevřený v relaci Plochy. Změňte možnosti spuštění v jeho Vlastnostech, nebo nejdřív relaci ukončete.</string>
<string name="edit_artwork">Grafika</string>
<string name="edit_other_exe">Jiný exe…</string>
<string name="edit_remove">Odstranit</string>
+3
View File
@@ -2381,6 +2381,9 @@
<string name="edit_target">Mål</string>
<string name="edit_start_in">Start i</string>
<string name="edit_launch_options">Startindstillinger</string>
<string name="edit_launch_options_steam_hint">Delt med Egenskaber i Steam: en ændring det ene sted vises begge steder.</string>
<string name="edit_launch_options_not_saved">Startindstillingerne kunne ikke gemmes i Steam. Prøv igen.</string>
<string name="edit_launch_options_desktop">Steam kan være åben i skrivebordssessionen. Skift startindstillingerne under dens Egenskaber, eller luk sessionen først.</string>
<string name="edit_artwork">Grafik</string>
<string name="edit_other_exe">Anden exe…</string>
<string name="edit_remove">Fjern</string>
+3
View File
@@ -2370,6 +2370,9 @@
<string name="edit_target">Ziel</string>
<string name="edit_start_in">Ausführen in</string>
<string name="edit_launch_options">Startoptionen</string>
<string name="edit_launch_options_steam_hint">Gemeinsam mit den Eigenschaften in Steam: Eine Änderung an einer Stelle gilt für beide.</string>
<string name="edit_launch_options_not_saved">Die Startoptionen konnten nicht in Steam gespeichert werden. Versuche es erneut.</string>
<string name="edit_launch_options_desktop">Steam ist eventuell in der Desktop-Sitzung geöffnet. Ändere die Startoptionen dort in den Eigenschaften oder beende zuerst die Sitzung.</string>
<string name="edit_artwork">Grafiken</string>
<string name="edit_other_exe">Andere EXE…</string>
<string name="edit_remove">Entfernen</string>
+3
View File
@@ -2381,6 +2381,9 @@
<string name="edit_target">Προορισμός</string>
<string name="edit_start_in">Εκκίνηση σε</string>
<string name="edit_launch_options">Επιλογές εκκίνησης</string>
<string name="edit_launch_options_steam_hint">Κοινές με τις Ιδιότητες του Steam: μια αλλαγή στο ένα σημείο εμφανίζεται και στα δύο.</string>
<string name="edit_launch_options_not_saved">Δεν ήταν δυνατή η αποθήκευση των επιλογών εκκίνησης στο Steam. Δοκιμάστε ξανά.</string>
<string name="edit_launch_options_desktop">Το Steam μπορεί να είναι ανοιχτό στη συνεδρία επιφάνειας εργασίας. Αλλάξτε τις επιλογές εκκίνησης από τις Ιδιότητές του ή κλείστε πρώτα τη συνεδρία.</string>
<string name="edit_artwork">Γραφικά</string>
<string name="edit_other_exe">Άλλο exe…</string>
<string name="edit_remove">Κατάργηση</string>
+3
View File
@@ -2401,6 +2401,9 @@
<string name="edit_target">Destino</string>
<string name="edit_start_in">Iniciar en</string>
<string name="edit_launch_options">Opciones de lanzamiento</string>
<string name="edit_launch_options_steam_hint">Se comparten con las Propiedades de Steam: un cambio en cualquiera de los dos se ve en ambos.</string>
<string name="edit_launch_options_not_saved">No se pudieron guardar las opciones de lanzamiento en Steam. Inténtalo de nuevo.</string>
<string name="edit_launch_options_desktop">Puede que Steam esté abierto en la sesión de escritorio. Cambia las opciones de lanzamiento en sus Propiedades o cierra antes la sesión.</string>
<string name="edit_artwork">Ilustraciones</string>
<string name="edit_other_exe">Otro exe…</string>
<string name="edit_remove">Quitar</string>
+3
View File
@@ -2381,6 +2381,9 @@
<string name="edit_target">Kohde</string>
<string name="edit_start_in">Käynnistyskansio</string>
<string name="edit_launch_options">Käynnistysasetukset</string>
<string name="edit_launch_options_steam_hint">Jaettu Steamin Ominaisuuksien kanssa: muutos jommassakummassa näkyy molemmissa.</string>
<string name="edit_launch_options_not_saved">Käynnistysasetuksia ei voitu tallentaa Steamiin. Yritä uudelleen.</string>
<string name="edit_launch_options_desktop">Steam voi olla auki työpöytäistunnossa. Muuta käynnistysasetuksia sen Ominaisuuksista tai sulje istunto ensin.</string>
<string name="edit_artwork">Kuvitus</string>
<string name="edit_other_exe">Toinen exe…</string>
<string name="edit_remove">Poista</string>
+3
View File
@@ -2401,6 +2401,9 @@
<string name="edit_target">Cible</string>
<string name="edit_start_in">Démarrer dans</string>
<string name="edit_launch_options">Options de lancement</string>
<string name="edit_launch_options_steam_hint">Partagées avec les Propriétés de Steam : une modification d’un côté apparaît des deux.</string>
<string name="edit_launch_options_not_saved">Impossible d’enregistrer les options de lancement dans Steam. Réessayez.</string>
<string name="edit_launch_options_desktop">Steam est peut-être ouvert dans la session Bureau. Modifiez les options de lancement dans ses Propriétés, ou fermez d’abord la session.</string>
<string name="edit_artwork">Illustrations</string>
<string name="edit_other_exe">Autre exe…</string>
<string name="edit_remove">Retirer</string>
+3
View File
@@ -2381,6 +2381,9 @@
<string name="edit_target">टार्गेट</string>
<string name="edit_start_in">यहां शुरू करें</string>
<string name="edit_launch_options">लॉन्च विकल्प</string>
<string name="edit_launch_options_steam_hint">Steam की Properties के साथ साझा: किसी एक जगह किया गया बदलाव दोनों में दिखता है।</string>
<string name="edit_launch_options_not_saved">लॉन्च विकल्प Steam में सहेजे नहीं जा सके। फिर से कोशिश करें।</string>
<string name="edit_launch_options_desktop">Steam डेस्कटॉप सेशन में खुला हो सकता है। लॉन्च विकल्प उसकी Properties में बदलें, या पहले सेशन बंद करें।</string>
<string name="edit_artwork">आर्टवर्क</string>
<string name="edit_other_exe">दूसरा exe…</string>
<string name="edit_remove">हटाएं</string>
+3
View File
@@ -2381,6 +2381,9 @@
<string name="edit_target">Cél</string>
<string name="edit_start_in">Indítás innen</string>
<string name="edit_launch_options">Indítási beállítások</string>
<string name="edit_launch_options_steam_hint">Közös a Steam Tulajdonságaival: az egyik helyen végzett módosítás mindkettőben megjelenik.</string>
<string name="edit_launch_options_not_saved">Az indítási beállításokat nem sikerült menteni a Steambe. Próbáld újra.</string>
<string name="edit_launch_options_desktop">Lehet, hogy a Steam nyitva van az asztali munkamenetben. Módosítsd az indítási beállításokat a Tulajdonságaiban, vagy előbb zárd be a munkamenetet.</string>
<string name="edit_artwork">Illusztráció</string>
<string name="edit_other_exe">Másik exe…</string>
<string name="edit_remove">Eltávolítás</string>
+3
View File
@@ -2358,6 +2358,9 @@
<string name="edit_target">Target</string>
<string name="edit_start_in">Mulai di</string>
<string name="edit_launch_options">Opsi peluncuran</string>
<string name="edit_launch_options_steam_hint">Dibagikan dengan Properti Steam: perubahan di salah satunya muncul di keduanya.</string>
<string name="edit_launch_options_not_saved">Tidak dapat menyimpan opsi peluncuran ke Steam. Coba lagi.</string>
<string name="edit_launch_options_desktop">Steam mungkin terbuka di sesi desktop. Ubah opsi peluncuran di Properti Steam, atau tutup sesinya terlebih dahulu.</string>
<string name="edit_artwork">Artwork</string>
<string name="edit_other_exe">Exe lain…</string>
<string name="edit_remove">Hapus</string>
+3
View File
@@ -2393,6 +2393,9 @@
<string name="edit_target">Destinazione</string>
<string name="edit_start_in">Avvia in</string>
<string name="edit_launch_options">Opzioni di avvio</string>
<string name="edit_launch_options_steam_hint">Condivise con le Proprietà di Steam: una modifica in uno dei due punti compare in entrambi.</string>
<string name="edit_launch_options_not_saved">Impossibile salvare le opzioni di avvio in Steam. Riprova.</string>
<string name="edit_launch_options_desktop">Steam potrebbe essere aperto nella sessione desktop. Cambia le opzioni di avvio nelle sue Proprietà o chiudi prima la sessione.</string>
<string name="edit_artwork">Illustrazioni</string>
<string name="edit_other_exe">Altro exe…</string>
<string name="edit_remove">Rimuovi</string>
+3
View File
@@ -2325,6 +2325,9 @@
<string name="edit_target">ターゲット</string>
<string name="edit_start_in">開始フォルダ</string>
<string name="edit_launch_options">起動オプション</string>
<string name="edit_launch_options_steam_hint">Steam のプロパティと共通です。どちらかで変更すると両方に反映されます。</string>
<string name="edit_launch_options_not_saved">起動オプションを Steam に保存できませんでした。もう一度お試しください。</string>
<string name="edit_launch_options_desktop">デスクトップのセッションで Steam が開いている可能性があります。Steam のプロパティで起動オプションを変更するか、先にセッションを終了してください。</string>
<string name="edit_artwork">アートワーク</string>
<string name="edit_other_exe">別の exe…</string>
<string name="edit_remove">削除</string>
+3
View File
@@ -2358,6 +2358,9 @@
<string name="edit_target">대상</string>
<string name="edit_start_in">시작 위치</string>
<string name="edit_launch_options">실행 옵션</string>
<string name="edit_launch_options_steam_hint">Steam 속성과 공유됩니다. 어느 한쪽에서 바꾸면 양쪽에 모두 반영됩니다.</string>
<string name="edit_launch_options_not_saved">실행 옵션을 Steam에 저장하지 못했습니다. 다시 시도하세요.</string>
<string name="edit_launch_options_desktop">데스크톱 세션에서 Steam이 열려 있을 수 있습니다. Steam 속성에서 실행 옵션을 바꾸거나 먼저 세션을 닫으세요.</string>
<string name="edit_artwork">아트워크</string>
<string name="edit_other_exe">다른 exe…</string>
<string name="edit_remove">제거</string>
+3
View File
@@ -2358,6 +2358,9 @@
<string name="edit_target">Sasaran</string>
<string name="edit_start_in">Mula dalam</string>
<string name="edit_launch_options">Pilihan pelancaran</string>
<string name="edit_launch_options_steam_hint">Dikongsi dengan Properties dalam Steam: perubahan di salah satu tempat dipaparkan di kedua-duanya.</string>
<string name="edit_launch_options_not_saved">Tidak dapat menyimpan pilihan pelancaran ke Steam. Cuba lagi.</string>
<string name="edit_launch_options_desktop">Steam mungkin terbuka dalam sesi desktop. Tukar pilihan pelancaran dalam Properties Steam, atau tutup sesi itu dahulu.</string>
<string name="edit_artwork">Seni</string>
<string name="edit_other_exe">Exe lain…</string>
<string name="edit_remove">Alih keluar</string>
+3
View File
@@ -2381,6 +2381,9 @@
<string name="edit_target">Mål</string>
<string name="edit_start_in">Start i</string>
<string name="edit_launch_options">Startalternativer</string>
<string name="edit_launch_options_steam_hint">Delt med Egenskaper i Steam: en endring det ene stedet vises begge steder.</string>
<string name="edit_launch_options_not_saved">Kunne ikke lagre startalternativene i Steam. Prøv igjen.</string>
<string name="edit_launch_options_desktop">Steam kan være åpent i skrivebordssesjonen. Endre startalternativene under Egenskaper der, eller lukk sesjonen først.</string>
<string name="edit_artwork">Grafikk</string>
<string name="edit_other_exe">Annen exe…</string>
<string name="edit_remove">Fjern</string>
+3
View File
@@ -2381,6 +2381,9 @@
<string name="edit_target">Doel</string>
<string name="edit_start_in">Beginnen in</string>
<string name="edit_launch_options">Opstartopties</string>
<string name="edit_launch_options_steam_hint">Gedeeld met de Eigenschappen in Steam: een wijziging op de ene plek is op beide te zien.</string>
<string name="edit_launch_options_not_saved">De opstartopties konden niet in Steam worden opgeslagen. Probeer het opnieuw.</string>
<string name="edit_launch_options_desktop">Steam is misschien geopend in de desktopsessie. Wijzig de opstartopties daar in de Eigenschappen, of sluit eerst de sessie.</string>
<string name="edit_artwork">Artwork</string>
<string name="edit_other_exe">Andere exe…</string>
<string name="edit_remove">Verwijderen</string>
+3
View File
@@ -2427,6 +2427,9 @@
<string name="edit_target">Element docelowy</string>
<string name="edit_start_in">Uruchom w</string>
<string name="edit_launch_options">Opcje uruchamiania</string>
<string name="edit_launch_options_steam_hint">Wspólne z Właściwościami w Steam: zmiana w jednym miejscu jest widoczna w obu.</string>
<string name="edit_launch_options_not_saved">Nie udało się zapisać opcji uruchamiania w Steam. Spróbuj ponownie.</string>
<string name="edit_launch_options_desktop">Steam może być otwarty w sesji pulpitu. Zmień opcje uruchamiania w jego Właściwościach albo najpierw zamknij sesję.</string>
<string name="edit_artwork">Grafika</string>
<string name="edit_other_exe">Inny plik exe…</string>
<string name="edit_remove">Usuń</string>
@@ -2393,6 +2393,9 @@
<string name="edit_target">Destino</string>
<string name="edit_start_in">Iniciar em</string>
<string name="edit_launch_options">Opções de arranque</string>
<string name="edit_launch_options_steam_hint">Partilhadas com as Propriedades do Steam: uma alteração num dos locais aparece em ambos.</string>
<string name="edit_launch_options_not_saved">Não foi possível guardar as opções de arranque no Steam. Tenta novamente.</string>
<string name="edit_launch_options_desktop">O Steam pode estar aberto na sessão do ambiente de trabalho. Altera as opções de arranque nas Propriedades dele, ou fecha primeiro a sessão.</string>
<string name="edit_artwork">Imagens</string>
<string name="edit_other_exe">Outro exe…</string>
<string name="edit_remove">Remover</string>
+3
View File
@@ -2393,6 +2393,9 @@
<string name="edit_target">Destino</string>
<string name="edit_start_in">Iniciar em</string>
<string name="edit_launch_options">Opções de inicialização</string>
<string name="edit_launch_options_steam_hint">Compartilhadas com as Propriedades da Steam: uma alteração em um dos lugares aparece nos dois.</string>
<string name="edit_launch_options_not_saved">Não foi possível salvar as opções de inicialização na Steam. Tente novamente.</string>
<string name="edit_launch_options_desktop">A Steam pode estar aberta na sessão da área de trabalho. Altere as opções de inicialização nas Propriedades dela ou feche a sessão primeiro.</string>
<string name="edit_artwork">Artes</string>
<string name="edit_other_exe">Outro exe…</string>
<string name="edit_remove">Remover</string>
+3
View File
@@ -2404,6 +2404,9 @@
<string name="edit_target">Țintă</string>
<string name="edit_start_in">Pornește în</string>
<string name="edit_launch_options">Opțiuni de lansare</string>
<string name="edit_launch_options_steam_hint">Comune cu Proprietățile din Steam: o modificare într-unul dintre locuri apare în ambele.</string>
<string name="edit_launch_options_not_saved">Opțiunile de lansare nu au putut fi salvate în Steam. Încearcă din nou.</string>
<string name="edit_launch_options_desktop">Steam poate fi deschis în sesiunea desktop. Schimbă opțiunile de lansare din Proprietățile lui sau închide mai întâi sesiunea.</string>
<string name="edit_artwork">Grafică</string>
<string name="edit_other_exe">Alt exe…</string>
<string name="edit_remove">Elimină</string>
+3
View File
@@ -2424,6 +2424,9 @@
<string name="edit_target">Объект</string>
<string name="edit_start_in">Рабочая папка</string>
<string name="edit_launch_options">Параметры запуска</string>
<string name="edit_launch_options_steam_hint">Общие со «Свойствами» Steam: изменение в одном месте видно в обоих.</string>
<string name="edit_launch_options_not_saved">Не удалось сохранить параметры запуска в Steam. Попробуйте ещё раз.</string>
<string name="edit_launch_options_desktop">Steam может быть открыт в сессии рабочего стола. Измените параметры запуска в его «Свойствах» или сначала закройте сессию.</string>
<string name="edit_artwork">Обложки</string>
<string name="edit_other_exe">Другой exe…</string>
<string name="edit_remove">Убрать</string>
+3
View File
@@ -2381,6 +2381,9 @@
<string name="edit_target">Mål</string>
<string name="edit_start_in">Starta i</string>
<string name="edit_launch_options">Startalternativ</string>
<string name="edit_launch_options_steam_hint">Delas med Egenskaper i Steam: en ändring på det ena stället syns på båda.</string>
<string name="edit_launch_options_not_saved">Det gick inte att spara startalternativen i Steam. Försök igen.</string>
<string name="edit_launch_options_desktop">Steam kan vara öppet i skrivbordssessionen. Ändra startalternativen under Egenskaper där, eller stäng sessionen först.</string>
<string name="edit_artwork">Bildmaterial</string>
<string name="edit_other_exe">Annan exe…</string>
<string name="edit_remove">Ta bort</string>
+3
View File
@@ -2358,6 +2358,9 @@
<string name="edit_target">เป้าหมาย</string>
<string name="edit_start_in">เริ่มที่</string>
<string name="edit_launch_options">ตัวเลือกการเปิด</string>
<string name="edit_launch_options_steam_hint">ใช้ร่วมกับคุณสมบัติใน Steam: เปลี่ยนที่ใดที่หนึ่งก็จะแสดงในทั้งสองที่</string>
<string name="edit_launch_options_not_saved">บันทึกตัวเลือกการเปิดลงใน Steam ไม่ได้ ลองอีกครั้ง</string>
<string name="edit_launch_options_desktop">Steam อาจเปิดอยู่ในเซสชันเดสก์ท็อป เปลี่ยนตัวเลือกการเปิดในคุณสมบัติของ Steam หรือปิดเซสชันก่อน</string>
<string name="edit_artwork">ภาพปก</string>
<string name="edit_other_exe">exe อื่น…</string>
<string name="edit_remove">ลบ</string>
+3
View File
@@ -2370,6 +2370,9 @@
<string name="edit_target">Hedef</string>
<string name="edit_start_in">Başlangıç yeri</string>
<string name="edit_launch_options">Başlatma seçenekleri</string>
<string name="edit_launch_options_steam_hint">Steam Özellikleri ile ortaktır: birinde yapılan değişiklik ikisinde de görünür.</string>
<string name="edit_launch_options_not_saved">Başlatma seçenekleri Steam\'e kaydedilemedi. Tekrar deneyin.</string>
<string name="edit_launch_options_desktop">Steam masaüstü oturumunda açık olabilir. Başlatma seçeneklerini Steam Özellikleri\'nden değiştirin veya önce oturumu kapatın.</string>
<string name="edit_artwork">Görsel</string>
<string name="edit_other_exe">Diğer exe…</string>
<string name="edit_remove">Kaldır</string>
+3
View File
@@ -2427,6 +2427,9 @@
<string name="edit_target">Ціль</string>
<string name="edit_start_in">Робоча папка</string>
<string name="edit_launch_options">Параметри запуску</string>
<string name="edit_launch_options_steam_hint">Спільні з «Властивостями» Steam: зміна в одному місці видна в обох.</string>
<string name="edit_launch_options_not_saved">Не вдалося зберегти параметри запуску в Steam. Спробуйте ще раз.</string>
<string name="edit_launch_options_desktop">Steam може бути відкритий у сеансі робочого столу. Змініть параметри запуску в його «Властивостях» або спершу закрийте сеанс.</string>
<string name="edit_artwork">Графіка</string>
<string name="edit_other_exe">Інший exe…</string>
<string name="edit_remove">Вилучити</string>
+3
View File
@@ -2358,6 +2358,9 @@
<string name="edit_target">Đích</string>
<string name="edit_start_in">Khởi chạy trong</string>
<string name="edit_launch_options">Tùy chọn khởi chạy</string>
<string name="edit_launch_options_steam_hint">Dùng chung với Thuộc tính của Steam: thay đổi ở một nơi sẽ hiện ở cả hai.</string>
<string name="edit_launch_options_not_saved">Không thể lưu tùy chọn khởi chạy vào Steam. Hãy thử lại.</string>
<string name="edit_launch_options_desktop">Steam có thể đang mở trong phiên desktop. Hãy đổi tùy chọn khởi chạy trong Thuộc tính của Steam, hoặc đóng phiên trước.</string>
<string name="edit_artwork">Hình ảnh</string>
<string name="edit_other_exe">Exe khác…</string>
<string name="edit_remove">Xóa</string>
@@ -2400,6 +2400,9 @@
<string name="edit_target">目标</string>
<string name="edit_start_in">起始位置</string>
<string name="edit_launch_options">启动选项</string>
<string name="edit_launch_options_steam_hint">与 Steam 的“属性”共用:在任一处更改,两处都会更新。</string>
<string name="edit_launch_options_not_saved">无法将启动选项保存到 Steam。请重试。</string>
<string name="edit_launch_options_desktop">Steam 可能正在桌面会话中运行。请在 Steam 的“属性”中更改启动选项,或先关闭该会话。</string>
<string name="edit_artwork">美术图</string>
<string name="edit_other_exe">其他 exe…</string>
<string name="edit_remove">移除</string>
@@ -2326,6 +2326,9 @@
<string name="edit_target">目標</string>
<string name="edit_start_in">開始位置</string>
<string name="edit_launch_options">啟動選項</string>
<string name="edit_launch_options_steam_hint">與 Steam 的「內容」共用:在任一處更改,兩處都會更新。</string>
<string name="edit_launch_options_not_saved">無法將啟動選項儲存到 Steam。請再試一次。</string>
<string name="edit_launch_options_desktop">Steam 可能正在桌面會話中執行。請在 Steam 的「內容」中更改啟動選項,或先關閉該會話。</string>
<string name="edit_artwork">圖片</string>
<string name="edit_other_exe">其他 exe…</string>
<string name="edit_remove">移除</string>
@@ -2326,6 +2326,9 @@
<string name="edit_target">目標</string>
<string name="edit_start_in">開始位置</string>
<string name="edit_launch_options">啟動選項</string>
<string name="edit_launch_options_steam_hint">與 Steam 的「內容」共用:在任一處變更,兩處都會更新。</string>
<string name="edit_launch_options_not_saved">無法將啟動選項儲存至 Steam。請再試一次。</string>
<string name="edit_launch_options_desktop">Steam 可能正在桌面工作階段中執行。請在 Steam 的「內容」中變更啟動選項,或先關閉該工作階段。</string>
<string name="edit_artwork">圖片</string>
<string name="edit_other_exe">其他 exe…</string>
<string name="edit_remove">移除</string>
+8
View File
@@ -597,6 +597,11 @@
<string name="perf_noglerror_hint">Turns off per-call GL validation.</string>
<string name="perf_gsrealtime">gamescope: realtime GPU queue</string>
<string name="perf_gsrealtime_hint">Prioritizes the compositor\'s GPU work. Can smooth frame pacing at some cost to games.</string>
<string name="perf_boost_group">Boost</string>
<string name="perf_boost">Performance boost</string>
<string name="perf_boost_hint">Asks the phone to run the game\'s busiest threads on its fastest cores while the game falls behind. Lets go when the game keeps up, the phone is hot or battery saver is on. Android 12 or newer. Samsung phones also raise their CPU, GPU and memory clocks. More battery use and heat. What it did is in boost.log in the session\'s logs.</string>
<string name="perf_boost_check">Check the boost</string>
<string name="perf_boost_check_hint">For testing: during a game the boost takes turns on and paused (one minute on, then two paused, two on, and so on), and boost.log ends with a fair comparison and a verdict. The first minute is not counted. Play at least 7 minutes, then turn this off. A phone that gets too hot gives no verdict. A game that runs well without the boost is marked as not needing it.</string>
<string name="perf_gpu">GPU</string>
<string name="perf_memory">Memory</string>
<string name="perf_cap_off">Off</string>
@@ -2508,6 +2513,9 @@
<string name="edit_target">Target</string>
<string name="edit_start_in">Start in</string>
<string name="edit_launch_options">Launch options</string>
<string name="edit_launch_options_steam_hint">Shared with Steam\'s Properties: a change in either one shows in both.</string>
<string name="edit_launch_options_not_saved">Could not save the launch options to Steam. Try again.</string>
<string name="edit_launch_options_desktop">Steam may be open in the desktop session. Change the launch options in its Properties, or close the session first.</string>
<string name="edit_artwork">Artwork</string>
<string name="edit_other_exe">Other exe…</string>
<string name="edit_remove">Remove</string>
@@ -0,0 +1,22 @@
package com.droiddeck.launcher
import com.droiddeck.launcher.HomeApp.RecentsStep
import org.junit.Assert.assertEquals
import org.junit.Test
class HomeRecentsTest {
@Test fun theLauncherHidesAVisibleTaskAndTakesItOver() {
assertEquals(RecentsStep.HIDE, HomeApp.recentsStep(hidden = true, owned = false, excluded = false))
}
@Test fun aTaskSomeoneElseExcludedIsNeverClaimedOrShown() {
assertEquals(RecentsStep.NONE, HomeApp.recentsStep(hidden = true, owned = false, excluded = true))
assertEquals(RecentsStep.NONE, HomeApp.recentsStep(hidden = false, owned = false, excluded = true))
}
@Test fun onlyATaskTheLauncherHidItselfIsShownAgain() {
assertEquals(RecentsStep.SHOW, HomeApp.recentsStep(hidden = false, owned = true, excluded = true))
assertEquals(RecentsStep.FORGET, HomeApp.recentsStep(hidden = false, owned = true, excluded = false))
assertEquals(RecentsStep.NONE, HomeApp.recentsStep(hidden = true, owned = true, excluded = true))
}
}
@@ -154,6 +154,98 @@ class AddedGameArtFillTest {
assertFalse(File(AddedGameArt.cacheDir(app, second), AddedGameArt.EXTRAS_TRIED).exists())
}
private fun steamFrom(asked: MutableList<String>, bytes: Byte, search: Int? = null, slotsAsked: MutableList<Set<Slot>> = ArrayList()) = AddedGameArt.Sources(
storeLogo = { false },
steamSearch = { if (search == null) fail("searched although the game names its appid"); search },
steam = { id, cache, slots ->
asked += id
slotsAsked += slots
slots.forEach { File(cache, steamNames.getValue(it)).writeBytes(byteArrayOf(bytes)) }
slots.isNotEmpty()
},
sgdbGame = { _, _, _ -> null },
sgdb = { _, _, _, _ -> false },
)
@Test fun artOfTheAppTheFilesNamedBeforeIsFetchedAgain() {
val g = game("Peak", 0x8100000AL, cover = false)
File(g.folder, "steam_appid.txt").writeText("1029210")
val asked = ArrayList<String>()
assertTrue(AddedGameArt.fetchMissing(app, listOf(g), "", steamFrom(asked, 1)))
File(g.folder, "steam_appid.txt").writeText("3527290")
assertTrue(AddedGameArt.fetchMissing(app, listOf(g), "", steamFrom(asked, 2)))
assertEquals(listOf("1029210", "3527290"), asked)
assertArrayEquals(byteArrayOf(2), File(AddedGameArt.cacheDir(app, g), "p.jpg").readBytes())
assertFalse(AddedGameArt.fetchMissing(app, listOf(g), "", steamFrom(asked, 3)))
assertEquals(2, asked.size)
}
@Test fun aPictureTheUserChoseOutlivesTheChange() {
val g = game("Peak", 0x8100000BL, cover = false)
File(g.folder, "steam_appid.txt").writeText("1029210")
AddedGameArt.fetchMissing(app, listOf(g), "", steamFrom(ArrayList(), 1))
val picked = File(tmp.root, "mine.jpg").apply { writeBytes(byteArrayOf(7)) }
assertTrue(AddedGameArt.store(AddedGameArt.cacheDir(app, g), Slot.COVER, AddedGameArt.Option(AddedGameArt.FILE, picked.path, picked.path)))
File(g.folder, "steam_appid.txt").writeText("3527290")
val asked = ArrayList<String>()
val slots = ArrayList<Set<Slot>>()
AddedGameArt.fetchMissing(app, listOf(g), "", steamFrom(asked, 2, slotsAsked = slots))
assertArrayEquals(byteArrayOf(7), AddedGameArt.resolve(app, g).portrait!!.readBytes())
assertEquals(listOf("3527290"), asked)
assertEquals(listOf(setOf(Slot.WIDE, Slot.BACKGROUND, Slot.LOGO)), slots)
val cache = AddedGameArt.cacheDir(app, g)
assertArrayEquals(byteArrayOf(2), File(cache, "header.jpg").readBytes())
assertArrayEquals(byteArrayOf(2), File(cache, "hero.jpg").readBytes())
assertFalse(File(cache, AddedGameArt.REFETCH).exists())
}
private fun olderBuildsArt(g: AddedGames.Game, marker: String): File = AddedGameArt.cacheDir(app, g).apply {
mkdirs()
File(this, "steam-appid").writeText(marker)
steamNames.values.forEach { File(this, it).writeBytes(byteArrayOf(1)) }
}
@Test fun anOlderBuildsSpacewarMarkerGoesWithItsArt() {
val g = game("Peak", 0x8100000DL, cover = false)
File(g.folder, "steam_appid.txt").writeText("480")
val cache = olderBuildsArt(g, "480")
val asked = ArrayList<String>()
assertTrue(AddedGameArt.fetchMissing(app, listOf(g), "", steamFrom(asked, 2, search = 3527290)))
assertEquals(listOf("3527290"), asked)
assertArrayEquals(byteArrayOf(2), File(cache, "p.jpg").readBytes())
assertFalse(File(cache, "steam-appid").exists())
}
@Test fun anOlderBuildsMatchStaysWhileTheFilesNameNoApp() {
val g = game("Hades", 0x8100000EL, cover = false)
File(g.folder, "steam_appid.txt").delete()
val cache = olderBuildsArt(g, "1145360")
assertFalse(AddedGameArt.fetchMissing(app, listOf(g), "", steamFrom(ArrayList(), 2)))
assertEquals("1145360", File(cache, "steam-appid").readText())
assertArrayEquals(byteArrayOf(1), File(cache, "p.jpg").readBytes())
}
@Test fun anOlderBuildsMatchGivesWayToTheAppTheFilesName() {
val g = game("Peak", 0x8100000FL, cover = false)
File(g.folder, "steam_appid.txt").writeText("3527290")
val cache = olderBuildsArt(g, "1029210")
val asked = ArrayList<String>()
assertTrue(AddedGameArt.fetchMissing(app, listOf(g), "", steamFrom(asked, 2)))
assertEquals(listOf("3527290"), asked)
assertArrayEquals(byteArrayOf(2), File(cache, "p.jpg").readBytes())
assertFalse(File(cache, "steam-appid").exists())
}
@Test fun filesThatStopNamingAnAppFallBackToTheGamesName() {
val g = game("Peak", 0x8100000CL, cover = false)
File(g.folder, "steam_appid.txt").writeText("1029210")
val asked = ArrayList<String>()
AddedGameArt.fetchMissing(app, listOf(g), "", steamFrom(asked, 1))
File(g.folder, "steam_appid.txt").writeText("480")
assertTrue(AddedGameArt.fetchMissing(app, listOf(g), "", steamFrom(asked, 2, search = 3527290)))
assertEquals(listOf("1029210", "3527290"), asked)
}
@Test fun nothingIsFetchedWhenArtIsOff() {
SessionPrefs.setAddedGamesArt(app, false)
val calls = Calls()
@@ -66,6 +66,29 @@ class AddedGameArtLookupTest {
assertEquals(SteamMatch.Certainty.NAME, match.certainty)
}
@Test fun anEarlierBuildsSpacewarLookupIsNotAMatch() {
val dir = tmp.newFolder("Peak")
val exe = File(dir, "PEAK.exe").apply { writeText("x") }
val legacy = File(tmp.newFolder(), "steam-appid").apply { writeText("480") }
assertEquals(3527290, SteamMatch.resolve(app, dir.path, exe, "PEAK", legacy = legacy) { 3527290 }.appId)
}
@Test fun aSavedSpacewarMatchIsNotAMatch() {
val dir = tmp.newFolder("Peak")
val exe = File(dir, "PEAK.exe").apply { writeText("x") }
SteamMatch.put(app, dir.path, SteamMatch.Match(480, SteamMatch.Certainty.NAME, "store search", System.currentTimeMillis()))
assertNull(SteamMatch.resolve(app, dir.path, exe, "PEAK").appId)
assertEquals(3527290, SteamMatch.resolve(app, dir.path, exe, "PEAK") { 3527290 }.appId)
}
@Test fun aStoreSearchAnsweringSpacewarIsNoMatch() {
val dir = tmp.newFolder("Spacewar Fan Remake")
val exe = File(dir, "game.exe").apply { writeText("x") }
val match = SteamMatch.resolve(app, dir.path, exe, "Spacewar Fan Remake") { 480 }
assertNull(match.appId)
assertEquals(SteamMatch.Certainty.NONE, match.certainty)
}
@Test fun aStoreResultIsTakenOnlyWhenItsNameMatches() {
assertNull(AddedGameArt.pickStoreResult("My Obscure Game", listOf("10" to "Totally Different", "11" to "Another One")))
assertEquals("20", AddedGameArt.pickStoreResult("Hades", listOf("19" to "Hades II Soundtrack Bundle Extra", "20" to "Hades")))
@@ -31,8 +31,25 @@ class GameIdentifierTest {
fun steamAppIdTxt_inSteamSettingsSubdir_isFound() {
val dir = tmp.newFolder("Game")
File(dir, "steam_settings").mkdirs()
File(dir, "steam_settings/steam_appid.txt").writeText("480")
assertEquals(480, GameIdentifier.identify(exeIn(dir)).appId)
File(dir, "steam_settings/steam_appid.txt").writeText("3527290")
assertEquals(3527290, GameIdentifier.identify(exeIn(dir)).appId)
}
@Test
fun spacewarAppId_namesNoGame() {
val dir = tmp.newFolder("PEAK")
File(dir, "steam_appid.txt").writeText("480")
File(dir, "steam_emu.ini").writeText("[Settings]\nAppId=480\n")
assertNull(GameIdentifier.identify(exeIn(dir)).appId)
}
@Test
fun spacewarAppId_fallsThroughToTheGamesOwnId() {
val dir = tmp.newFolder("PEAK")
File(dir, "steam_appid.txt").writeText("480")
File(dir, "steam_settings").mkdirs()
File(dir, "steam_settings/steam_appid.txt").writeText("3527290")
assertEquals(3527290, GameIdentifier.identify(exeIn(dir)).appId)
}
@Test
@@ -44,6 +61,30 @@ class GameIdentifierTest {
assertEquals(GameIdentifier.Source.STEAM_EMU_INI, id.source)
}
@Test
fun spacewarManifest_namesNoGame() {
val steamapps = tmp.newFolder("steamapps")
File(steamapps, "appmanifest_480.acf").writeText(""""AppState" { "appid" "480" "name" "Spacewar" "installdir" "PEAK" }""")
val game = File(steamapps, "common/PEAK").apply { mkdirs() }
File(game, "steam_appid.txt").writeText("3527290")
val id = GameIdentifier.identify(exeIn(game, "PEAK.exe"))
assertEquals(3527290, id.appId)
assertEquals(GameIdentifier.Source.STEAM_APPID_TXT, id.source)
assertTrue(id.name != "Spacewar")
}
@Test
fun spacewarManifest_leavesTheGamesOwnManifestForTheSameFolder() {
val steamapps = tmp.newFolder("steamapps")
File(steamapps, "appmanifest_480.acf").writeText(""""AppState" { "appid" "480" "name" "Spacewar" "installdir" "PEAK" }""")
File(steamapps, "appmanifest_3527290.acf").writeText(""""AppState" { "appid" "3527290" "name" "PEAK" "installdir" "PEAK" }""")
val game = File(steamapps, "common/PEAK").apply { mkdirs() }
val id = GameIdentifier.identify(exeIn(game, "PEAK.exe"))
assertEquals(3527290, id.appId)
assertEquals("PEAK", id.name)
assertEquals(GameIdentifier.Source.STEAM_MANIFEST_ACF, id.source)
}
@Test
fun steamManifestAcf_matchedByInstalldir_givesAppIdAndName() {
val steamapps = tmp.newFolder("steamapps")
@@ -0,0 +1,163 @@
package com.droiddeck.launcher.frontend
import com.droiddeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.session.SessionService
import com.droiddeck.launcher.session.SessionState
import java.io.File
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TemporaryFolder
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import org.robolectric.RuntimeEnvironment
import org.robolectric.annotation.Config
@RunWith(RobolectricTestRunner::class)
@Config(sdk = [33])
class SteamLaunchOptionsTest {
@get:Rule val tmp = TemporaryFolder()
private fun config(apps: String) = listOf(
"\"UserLocalConfigStore\"", "{", "\t\"Software\"", "\t{", "\t\t\"Valve\"", "\t\t{", "\t\t\t\"Steam\"", "\t\t\t{",
apps, "\t\t\t}", "\t\t}", "\t}", "\t\"WebStorage\"", "\t{", "\t\t\"x\"\t\t\"1\"", "\t}", "}", "",
).joinToString("\n")
private fun apps(vararg lines: String) = (listOf("\t\t\t\t\"apps\"", "\t\t\t\t{") + lines + "\t\t\t\t}").joinToString("\n")
private val sparking = arrayOf(
"\t\t\t\t\t\"1790600\"", "\t\t\t\t\t{", "\t\t\t\t\t\t\"LastPlayed\"\t\t\"1761897600\"", "\t\t\t\t\t\t\"LaunchOptions\"\t\t\"-dx11\"", "\t\t\t\t\t}",
)
@Test fun replacesTheOptionsSteamHas() {
val text = config(apps(*sparking))
val updated = SteamLaunchOptions.withLaunchOptions(text, 1790600, "-dx12")!!
assertEquals(text.replace("\"-dx11\"", "\"-dx12\""), updated)
assertEquals("-dx12", SteamLaunchOptions.launchOptions(updated, 1790600))
}
@Test fun addsOptionsToAGameThatHasNone() {
val text = config(apps("\t\t\t\t\t\"1790600\"", "\t\t\t\t\t{", "\t\t\t\t\t\t\"LastPlayed\"\t\t\"1761897600\"", "\t\t\t\t\t}"))
assertEquals(config(apps(*sparking)).replace("-dx11", "-vulkan"), SteamLaunchOptions.withLaunchOptions(text, 1790600, "-vulkan"))
}
@Test fun addsTheGameAndTheAppsSectionWhenSteamHasNeither() {
val updated = SteamLaunchOptions.withLaunchOptions(config("\t\t\t\t\"language\"\t\t\"english\""), 1790600, "-dx11")!!
assertEquals(
config(
"\t\t\t\t\"language\"\t\t\"english\"\n" +
apps("\t\t\t\t\t\"1790600\"", "\t\t\t\t\t{", "\t\t\t\t\t\t\"LaunchOptions\"\t\t\"-dx11\"", "\t\t\t\t\t}"),
),
updated,
)
assertEquals("-dx11", SteamLaunchOptions.launchOptions(updated, 1790600))
}
@Test fun quotesAndBackslashesAreEscapedAndReadBack() {
val options = "PROTON_LOG=1 %command% -path \"C:\\Games\\DB\""
val updated = SteamLaunchOptions.withLaunchOptions(config(apps(*sparking)), 1790600, options)!!
assertEquals(true, updated.contains("\"PROTON_LOG=1 %command% -path \\\"C:\\\\Games\\\\DB\\\"\""))
assertEquals(options, SteamLaunchOptions.launchOptions(updated, 1790600))
}
@Test fun emptyOptionsClearSteams() {
val updated = SteamLaunchOptions.withLaunchOptions(config(apps(*sparking)), 1790600, "")!!
assertEquals("", SteamLaunchOptions.launchOptions(updated, 1790600))
}
@Test fun windowsLineEndsAreKept() {
val text = config("\t\t\t\t\"language\"\t\t\"english\"").replace("\n", "\r\n")
val updated = SteamLaunchOptions.withLaunchOptions(text, 1790600, "-dx11")!!
assertEquals(false, updated.replace("\r\n", "").contains('\n'))
assertEquals("-dx11", SteamLaunchOptions.launchOptions(updated, 1790600))
}
@Test fun onlyTheGamesOwnSectionChanges() {
val other = arrayOf(
"\t\t\t\t\t\"7\"", "\t\t\t\t\t{", "\t\t\t\t\t\t\"1790600\"", "\t\t\t\t\t\t{", "\t\t\t\t\t\t\t\"LaunchOptions\"\t\t\"keep\"", "\t\t\t\t\t\t}", "\t\t\t\t\t}",
)
val updated = SteamLaunchOptions.withLaunchOptions(config(apps(*other, *sparking)), 1790600, "-dx12")!!
assertEquals(true, updated.contains("\"keep\""))
assertEquals("-dx12", SteamLaunchOptions.launchOptions(updated, 1790600))
assertNull(SteamLaunchOptions.launchOptions(config(apps(*other)), 1790600))
}
@Test fun otherFilesAreLeftAlone() {
assertNull(SteamLaunchOptions.withLaunchOptions("\"InstallConfigStore\"\n{\n}\n", 1790600, "-dx11"))
assertNull(SteamLaunchOptions.withLaunchOptions("", 1790600, "-dx11"))
assertNull(SteamLaunchOptions.launchOptions("", 1790600))
}
private fun steamHome(home: File = tmp.newFolder("Steam")): File = home.also {
File(home, "config").mkdirs()
File(home, "config/loginusers.vdf").writeText(
"\"users\"\n{\n\t\"76561198021239924\"\n\t{\n\t\t\"AccountName\"\t\t\"a\"\n\t\t\"MostRecent\"\t\t\"1\"\n\t}\n}\n")
}
private fun localConfig(home: File, account: String) = File(home, "userdata/$account/config/localconfig.vdf").apply { parentFile!!.mkdirs() }
@Test fun aChangeGoesToTheSignedInAccountOnly() {
val home = steamHome()
val signedIn = localConfig(home, "60974196").apply { writeText(config(apps(*sparking))) }
val other = localConfig(home, "123").apply { writeText(config("\t\t\t\t\"language\"\t\t\"english\"")) }
val untouched = other.readText()
assertTrue(SteamLaunchOptions.write(home, 1790600, "-dx12"))
assertEquals("-dx12", SteamLaunchOptions.launchOptions(signedIn.readText(), 1790600))
assertEquals(untouched, other.readText())
assertFalse(File(signedIn.parentFile, "localconfig.vdf.staged").exists())
}
@Test fun whatSteamWroteLastIsWhatTheGameHas() {
val home = steamHome()
val config = localConfig(home, "60974196").apply { writeText(config(apps(*sparking))) }
assertTrue(SteamLaunchOptions.write(home, 1790600, "-dx12"))
config.writeText(SteamLaunchOptions.withLaunchOptions(config.readText(), 1790600, "-vulkan")!!)
assertEquals("-vulkan", SteamLaunchOptions.steam(home, 1790600))
assertNull(SteamLaunchOptions.steam(home, 400))
}
private val app get() = RuntimeEnvironment.getApplication()
private val written = ArrayList<File>()
private fun sessionConfig(): File {
val home = steamHome(SessionPrefs.activeSteamRoot(app))
return localConfig(home, "60974196").apply { writeText(config(apps(*sparking))) }
.also { written += it; written += File(home, "config/loginusers.vdf") }
}
@After fun noSession() {
SessionState.running = false
SessionState.mode = SessionService.MODE_STEAM
written.forEach { it.delete() }
}
@Test fun aValueChangedInSteamSinceItWasShownIsNotOverwritten() {
val config = sessionConfig()
assertEquals(SteamLaunchOptions.Saved.NO, SteamLaunchOptions.set(app, 1790600, "-dx12", shown = "-vulkan"))
assertEquals("-dx11", SteamLaunchOptions.launchOptions(config.readText(), 1790600))
assertEquals(SteamLaunchOptions.Saved.YES, SteamLaunchOptions.set(app, 1790600, "-dx12", shown = "-dx11"))
assertEquals("-dx12", SteamLaunchOptions.launchOptions(config.readText(), 1790600))
}
@Test fun aDesktopSessionLeavesTheFileToItsClient() {
val config = sessionConfig()
val before = config.readText()
SessionState.running = true
SessionState.mode = SessionService.MODE_DESKTOP
assertEquals(SteamLaunchOptions.Saved.DESKTOP, SteamLaunchOptions.set(app, 1790600, "-dx12", shown = "-dx11"))
assertEquals(before, config.readText())
}
@Test fun nothingIsWrittenWithoutASignedInAccountsConfig() {
assertFalse(SteamLaunchOptions.write(tmp.newFolder("NoSteam"), 1790600, "-dx11"))
val home = steamHome()
assertFalse(SteamLaunchOptions.write(home, 1790600, "-dx11"))
localConfig(home, "60974196").writeText("\"InstallConfigStore\"\n{\n}\n")
assertFalse(SteamLaunchOptions.write(home, 1790600, "-dx11"))
}
}
@@ -33,7 +33,9 @@ class TouchpadGesturesTest {
override fun onScroll(dx: Float, dy: Float) { events += "scroll" }
override fun onScrollEnd() { events += "scroll end" }
override fun onZoom(steps: Int) { events += "zoom $steps" }
override fun onThreeFingerTap(): Boolean { events += "three tap"; return claimThreeTap }
}
private var claimThreeTap = false
@Before fun setUp() {
touchpad = TouchpadGestures(SLOP, listener)
@@ -50,7 +52,18 @@ class TouchpadGesturesTest {
assertEquals(listOf("left down", "left up"), events)
}
@Test fun threeFingerTapClicksTheMiddleButton() {
@Test fun threeFingerTapClicksTheMiddleButtonWhenUnclaimed() {
threeFingerTap()
assertEquals(listOf("three tap", "middle down", "middle up"), events)
}
@Test fun claimedThreeFingerTapSkipsTheMiddleButton() {
claimThreeTap = true
threeFingerTap()
assertEquals(listOf("three tap"), events)
}
private fun threeFingerTap() {
touch(MotionEvent.ACTION_DOWN, 0, 1 to (400f to 300f))
advance(10)
touch(MotionEvent.ACTION_POINTER_DOWN, 1, 1 to (400f to 300f), 2 to (600f to 310f))
@@ -61,7 +74,6 @@ class TouchpadGesturesTest {
touch(MotionEvent.ACTION_POINTER_UP, 1, 1 to (400f to 300f), 2 to (600f to 310f))
touch(MotionEvent.ACTION_UP, 0, 1 to (400f to 300f))
advance(100)
assertEquals(listOf("middle down", "middle up"), events)
}
@Test fun desktopTwoFingerSlideScrollsSmoothlyAndStops() {
@@ -0,0 +1,120 @@
package com.droiddeck.launcher.session
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Test
class BoostReportTest {
private fun side(fps: Int, seconds: Int = 200, milliamps: Int? = null, slow: Int = fps) =
BoostReport.Side().apply { repeat(seconds) { add(if (it < seconds / 10) slow else fps, milliamps, 0) } }
@Test fun `the CPU a thread ran on is field 39 of its stat, even with spaces in its name`() {
val fields = (3..52).map { if (it == 39) "7" else "0" }
assertEquals(7, BoostReport.processorOf("1234 (Main Thread) " + fields.joinToString(" ")))
assertNull(BoostReport.processorOf("1234 (short) S 1"))
}
@Test fun `cores are sorted into fastest, middle and slowest by top speed`() {
val tiers = BoostReport.tiers(mapOf(0 to 2.0, 1 to 2.0, 2 to 3.2, 3 to 3.2, 4 to 4.3))
assertEquals(mapOf(0 to 0, 1 to 0, 2 to 1, 3 to 1, 4 to 2), tiers)
assertEquals(mapOf(0 to 2, 1 to 2), BoostReport.tiers(mapOf(0 to 2.0, 1 to 2.0)))
}
@Test fun `the slowest 5 percent is the frame rate of the slowest seconds`() {
val s = BoostReport.Side().apply { (1..100).forEach { add(it, null, 0) } }
assertEquals(6, s.low)
assertEquals(50.5, s.average, 1e-9)
}
@Test fun `a clear gain is worth keeping`() {
val v = BoostReport.verdict(side(60, milliamps = 1200), side(50, milliamps = 1000))
assertTrue(v, v.startsWith("worth keeping: +20 % fps on average"))
assertTrue(v, v.endsWith("for +20 % battery draw"))
}
@Test fun `better slowest moments alone are worth keeping`() {
val v = BoostReport.verdict(side(50, slow = 40), side(50, slow = 30))
assertTrue(v, v.startsWith("worth keeping: +2 % fps on average, +33 % in the slowest moments"))
}
@Test fun `no gain is not worth keeping`() {
assertTrue(BoostReport.verdict(side(50), side(50)).startsWith("not worth keeping"))
assertTrue(BoostReport.verdict(side(45), side(50)).startsWith("not worth keeping"))
}
@Test fun `a small gain is unclear`() {
assertTrue(BoostReport.verdict(side(52), side(50)).startsWith("unclear, a small gain"))
}
@Test fun `a short check gives no verdict`() {
val v = BoostReport.verdict(side(60, seconds = 100), side(50))
assertEquals("too short to tell: play at least ${BoostReport.minutesForVerdict()} minutes with Check the boost on", v)
}
@Test fun `the switch's hint asks for as many minutes as the verdict needs`() {
assertEquals(7, BoostReport.minutesForVerdict())
}
@Test fun `the check starts after the first minute of play, then goes on, paused, paused, on`() {
(1..60).forEach { assertNull(BoostReport.checkWindow(it)) }
assertEquals(false to 0, BoostReport.checkWindow(61))
assertEquals(false to 59, BoostReport.checkWindow(120))
assertEquals(true to 0, BoostReport.checkWindow(121))
assertEquals(true to 119, BoostReport.checkWindow(240))
assertEquals(false to 0, BoostReport.checkWindow(241))
assertEquals(false to 119, BoostReport.checkWindow(360))
assertEquals(true to 0, BoostReport.checkWindow(361))
}
@Test fun `a game slowing down steadily as the phone warms favours neither side`() {
val on = BoostReport.Side()
val off = BoostReport.Side()
for (s in 1..BoostReport.WARMUP_S + 8 * BoostReport.WINDOW_S) {
val (pause, at) = BoostReport.checkWindow(s) ?: continue
if (at >= BoostReport.SETTLE_S) (if (pause) off else on).add(150 - s / 6, null, 0)
}
assertEquals(on.average, off.average, 0.5)
assertTrue(BoostReport.verdict(on, off).startsWith("not worth keeping"))
}
@Test fun `no verdict when heat held the boost back for more than a quarter of its turns`() {
val on = BoostReport.Side().apply { repeat(200) { add(80, null, 4, held = it < 60) } }
val v = BoostReport.verdict(on, side(60))
assertTrue(v, v.startsWith("can't tell: the phone was too hot or saving battery for 30 % of the time"))
assertTrue(BoostReport.verdict(BoostReport.Side().apply { repeat(200) { add(80, null, 4, held = it < 40) } }, side(60))
.startsWith("worth keeping"))
}
@Test fun `a game that keeps up without the boost does not need it`() {
val on = BoostReport.Side().apply { repeat(200) { add(58, null, 0, idle = it >= 12) } }
val v = BoostReport.verdict(on, side(59))
assertTrue(v, v.startsWith("not needed for this game: it kept up without the boost for 94 % of the boost's turns"))
assertTrue(v, v.endsWith("(58.0 fps in its turns, 59.0 fps paused)"))
val busy = BoostReport.Side().apply { repeat(200) { add(41, null, 0, idle = it < 96) } }
assertTrue(BoostReport.verdict(busy, side(40)).startsWith("unclear, a small gain"))
val short = BoostReport.Side().apply { repeat(100) { add(58, null, 0, idle = true) } }
assertTrue(BoostReport.verdict(short, side(59)).startsWith("too short to tell"))
}
@Test fun `the status names why the boost is off, once for a reason both parts give`() {
assertEquals("too hot", BoostReport.offReasons("too hot", "too hot"))
assertEquals("game keeps up, too hot", BoostReport.offReasons("game keeps up", "too hot"))
assertEquals("battery saver", BoostReport.offReasons("battery saver", null))
assertEquals("no reason given", BoostReport.offReasons(null, null))
}
@Test fun `the summary gives how long each reason kept a part off, longest first`() {
assertEquals("7:40 too hot, 0:20 game keeps up", BoostReport.offTimes(linkedMapOf("game keeps up" to 20, "too hot" to 460)))
assertEquals("", BoostReport.offTimes(emptyMap()))
}
@Test fun `the minutes asked for give both sides enough counted seconds`() {
val seconds = IntArray(2)
for (s in 1..BoostReport.minutesForVerdict() * 60) {
val (pause, at) = BoostReport.checkWindow(s) ?: continue
if (at >= BoostReport.SETTLE_S) seconds[if (pause) 1 else 0]++
}
assertTrue(seconds.joinToString(), seconds.all { it >= BoostReport.CHECK_MIN_S })
}
}
@@ -24,6 +24,14 @@ class GameThreadHintsTest {
assertEquals(setOf(2), GameThreadHints.pick(setOf(1, 2), mapOf(2 to 0.7)))
}
@Test fun `the log is told why no thread is boosted`() {
assertEquals("too hot", GameThreadHints.offReason("too hot", emptySet(), false, emptySet()))
assertEquals(null, GameThreadHints.offReason(null, setOf(1), true, setOf(1)))
assertEquals("game keeps up", GameThreadHints.offReason(null, emptySet(), true, emptySet()))
assertEquals("no thread busy enough", GameThreadHints.offReason(null, emptySet(), false, emptySet()))
assertEquals("Android refused the hint", GameThreadHints.offReason(null, emptySet(), false, setOf(1)))
}
@Test fun `a game at the panel's rate or a fraction of it holds pace`() {
assertTrue(GameThreadHints.holdsPace(119.0, 120.0))
assertTrue(GameThreadHints.holdsPace(60.5, 120.0))
@@ -0,0 +1,87 @@
package com.droiddeck.launcher.session
import com.droiddeck.launcher.session.SamsungPerf.Floor
import org.junit.Assert.assertArrayEquals
import org.junit.Assert.assertEquals
import org.junit.Test
import java.io.ByteArrayInputStream
import java.io.EOFException
import java.lang.reflect.InvocationTargetException
import java.nio.ByteBuffer
import java.nio.ByteOrder
class SamsungPerfTest {
private val cpu = intArrayOf(300000, 691200, 1190400, 1555200, 2016000)
private val gpu = intArrayOf(220000, 350000, 490000, 600000, 680000)
private val bus = intArrayOf(547000, 1017000, 1555000, 2092000, 3196000)
/** A level table as Samsung's service sends it: 38 little-endian ints. */
private fun table(maxTimeoutMs: Int, cpu: IntArray = this.cpu, gpu: IntArray = this.gpu, bus: IntArray = this.bus): ByteArray {
val ints = intArrayOf(0, 0, 0, maxTimeoutMs) + cpu + gpu + bus + intArrayOf(5, 5, 5, maxTimeoutMs) + IntArray(15) { 3_000_000 }
return ByteBuffer.allocate(ints.size * 4).order(ByteOrder.LITTLE_ENDIAN).apply { ints.forEach { putInt(it) } }.array()
}
@Test fun `the floors are read from the table, and nothing past it`() {
val stream = ByteArrayInputStream(table(10000) + byteArrayOf(7))
val levels = SamsungPerf.readLevels(stream)
assertArrayEquals(cpu, levels.cpu)
assertArrayEquals(gpu, levels.gpu)
assertArrayEquals(bus, levels.bus)
assertEquals(10000, levels.maxTimeoutMs)
assertEquals(1, stream.available())
}
@Test fun `the middle level of each floor is held, with four cores online`() {
val floors = SamsungPerf.floors(SamsungPerf.readLevels(ByteArrayInputStream(table(-1))))
val hold = SamsungPerf.HOLD_MS
assertEquals(
listOf(
Floor(SamsungPerf.CPU_MIN, 1190400, hold),
Floor(SamsungPerf.CPU_CORES_MIN, 4, hold),
Floor(SamsungPerf.GPU_MIN, 490000, hold),
Floor(SamsungPerf.BUS_MIN, 1555000, hold),
),
floors,
)
}
@Test fun `a shorter limit from the phone shortens the hold`() {
val floors = SamsungPerf.floors(SamsungPerf.readLevels(ByteArrayInputStream(table(3000))))
assertEquals(setOf(3000), floors.map { it.timeoutMs }.toSet())
}
@Test fun `a resource the phone does not offer is left alone`() {
val floors = SamsungPerf.floors(SamsungPerf.readLevels(ByteArrayInputStream(table(-1, gpu = IntArray(5) { -1 }))))
assertEquals(listOf(SamsungPerf.CPU_MIN, SamsungPerf.CPU_CORES_MIN, SamsungPerf.BUS_MIN), floors.map { it.type })
}
@Test fun `the floors are renewed before Samsung's one-second hold runs out`() {
assertEquals(500L, SamsungPerf.renewMs(SamsungPerf.HOLD_MS))
assertEquals(500L, SamsungPerf.renewMs(1000))
assertEquals(150L, SamsungPerf.renewMs(300))
assertEquals(100L, SamsungPerf.renewMs(50))
}
@Test fun `a failed connection is tried again a few times, then at the next game`() {
assertEquals(4, SamsungPerf.TRIES)
assertEquals("trying again in 5 s", SamsungPerf.retryNote(1))
assertEquals("trying again in 15 s", SamsungPerf.retryNote(2))
assertEquals("trying again in 30 s", SamsungPerf.retryNote(3))
assertEquals("no more tries until the next game", SamsungPerf.retryNote(4))
}
@Test fun `a failed try names the step it was on and the error`() {
assertEquals(
"failed while reading the service's level table (EOFException)",
SamsungPerf.failure("reading the service's level table", EOFException()),
)
assertEquals(
"failed while looking up Samsung's performance service (SecurityException: not allowed)",
SamsungPerf.failure("looking up Samsung's performance service", InvocationTargetException(SecurityException("not allowed"))),
)
}
@Test(expected = EOFException::class) fun `a short answer is refused`() {
SamsungPerf.readLevels(ByteArrayInputStream(table(-1).copyOf(100)))
}
}
@@ -52,6 +52,22 @@ class DualScreenPanelOwnerTest {
assertEquals(10, DualScreenPanel.focusTask(fromPanel = true))
}
@Test fun aScreenFromAnotherAppKeepsTheTopScreenAfterABottomScreenTouch() {
DualScreenPanel.show(app, 2, 10)
assertTrue(DualScreenPanel.opensOutside("com.droiddeck.launcher", "com.android.packageinstaller"))
DualScreenPanel.yieldTo(10, true)
DualScreenPanel.ownerPaused(10, true)
assertNull(DualScreenPanel.focusTask(fromPanel = true))
DualScreenPanel.ownerPaused(10, false)
DualScreenPanel.yieldTo(10, false)
assertEquals(10, DualScreenPanel.focusTask(fromPanel = true))
}
@Test fun droidDecksOwnScreensAndUnresolvedIntentsDoNotYield() {
assertFalse(DualScreenPanel.opensOutside("com.droiddeck.launcher", "com.droiddeck.launcher"))
assertFalse(DualScreenPanel.opensOutside("com.droiddeck.launcher", null))
}
@Test fun anotherTasksPauseDoesNotStopThePanelReturningFocus() {
DualScreenPanel.show(app, 2, 10)
DualScreenPanel.ownerPaused(11, true)
@@ -65,13 +81,4 @@ class DualScreenPanelOwnerTest {
DualScreenPanel.show(app, 2, 10)
assertEquals(10, DualScreenPanel.focusTask(fromPanel = false))
}
@Test fun thePanelTookFocusWhenItJustOpenedOrWasJustTouched() {
assertTrue(DualScreenPanel.tookFocus(fresh = true, touchedAt = Long.MIN_VALUE, now = 5_000L))
assertTrue(DualScreenPanel.tookFocus(fresh = false, touchedAt = 4_700L, now = 5_000L))
assertTrue(DualScreenPanel.tookFocus(fresh = false, touchedAt = 5_000L, now = 5_000L))
assertFalse(DualScreenPanel.tookFocus(fresh = false, touchedAt = 3_500L, now = 5_000L))
assertFalse(DualScreenPanel.tookFocus(fresh = false, touchedAt = Long.MIN_VALUE, now = 5_000L))
assertFalse(DualScreenPanel.tookFocus(fresh = false, touchedAt = 6_000L, now = 5_000L))
}
}
+10 -1
View File
@@ -7,7 +7,9 @@ importer as Added Games. Existing Steam manifests are preserved.
`droiddeck-steam-games watch` runs beside the client. It identifies a game by an
existing manifest's install directory, a `steam_appid.txt` beside the game or selected
executable, or a unique normalized title from Steam's store search with an explicit
country. Matching also accepts the terminal Windows Edition and INTERGRADE suffixes;
country. A `steam_appid.txt` naming 480 (Spacewar, the Steamworks SDK sample that Steam
emulators and multiplayer fixes use in place of the game) identifies nothing; the
launcher's artwork matching ignores it too. Matching also accepts the terminal Windows Edition and INTERGRADE suffixes;
multiple matches still remain unresolved. Artwork's fuzzy matching is deliberately not
used for identity. Ambiguous or unresolved titles remain non-Steam games.
@@ -42,6 +44,13 @@ the earlier importer are migrated, with the matching source symlink still presen
registration fails, the game remains a shortcut. Once Steam takes over an install,
manage it in Steam; forgetting an Added Games folder only removes its shortcuts.
An import is undone (its symlink and manifest, never the folder) when the folder was
imported as Spacewar, or when a snapshot of the folder's current files names another app.
The folder is then imported as that app if the account owns it, else it is a shortcut
again. A failed title lookup undoes nothing. The launcher likewise drops artwork it
fetched for the app the files named before and fetches it again; pictures the user chose
are kept.
The account's `.droiddeck-routes.json` maps shortcut IDs to real Steam app IDs so the
Android launcher uses the same title and Proton prefix as Steam. Other accounts do not
inherit those routes. Managed shortcuts are replaced; user-created shortcuts and
+86
View File
@@ -0,0 +1,86 @@
# DroidDeck 0.6.9
<p align="center"><a href="https://discord.gg/JRGAvawjsm"><img src="https://img.shields.io/badge/Discord-Join%20the%20community-5865F2?logo=discord&logoColor=white" alt="Join the DroidDeck Discord"></a></p>
<!-- Maintainer check: Steam, Proton downloads and the games themselves come from Valve and the stores and are not part of DroidDeck; the intro below only claims DroidDeck's own code and the packs it builds. -->
**DroidDeck is 100% open source. No ads. No telemetry. No source withheld.**
Since 0.6.7, **5 people** sent **60 pull requests**. 30% of the pull requests came from the community. Thank you to everyone who sent code, translations, device testing and bug reports. This is a bug fix release: most of it fixes what you reported after 0.6.7.
Fittingly for 0.6.9, the top and bottom screens on the Pocket Duo and AYN Thor have finally stopped fighting for dominance and learned to work together.
**0.6.9 in 30 seconds**
- **Dual-screen handhelds** like the Retroid Pocket Duo and AYN Thor no longer show “DroidDeck isn’t responding”, no longer jump back over other apps, and keep the bottom-screen panel you picked
- **Steam stops restarting at every start** to import added games, and asks first
- **Steam’s UI runs at the full refresh rate again**, with the heat fix kept, and a session left in picture-in-picture drops to **30 fps** to save battery
- **Cutscenes play again** with DroidDeck-Proton, and the **x86-64 Steam client** starts again on the Ubuntu runtime
- **Windows components survive runtime updates**, and the **Linux runtime updates by itself**
- **Xbox games run from their own folder** again, so Doom 64 and Unity games start
- **Banking apps** open again: Android listed DroidDeck’s optional Home button accessibility service even while it was off, which some banking apps block. It never reads your screen
- New: **controller button shortcuts**, **launch options for Steam games** in DroidDeck, a **frame limit for games started without Steam**, and a **DroidDeck HUD** you can pinch to resize and dock as an FPS tab
### Features
- Added **controller button shortcuts**: physical buttons can open Steam, Quick Access or DroidDeck’s menus, set per controller, with a reset. Buttons you leave unassigned work as before. Find them in Setup > Controller > Button mapping. (@jmarti326, [#1202](https://github.com/Droid-Deck/DroidDeck/pull/1202))
<img src="media/0.6.9/controller-shortcuts.jpg" width="50%" alt="Button mapping on a Retroid Pocket Duo with the new Physical button shortcuts group: Steam menu, Open Quick Access Menu and DroidDeck menu, each set to Default">
- Added **launch options for Steam games** to a game’s Edit screen (the pencil on its page), so you can set options such as `-dx11` without opening Steam. They are the same launch options as in Steam’s Properties: a change in either one shows in both. (@K11MCH1, [#1888](https://github.com/Droid-Deck/DroidDeck/pull/1888))
- Added a **Frame limit** for games started without Steam, on the Display page of the session drawer: Off, 30, 40, 45, 60, 90 or 120 fps. It applies live and lasts for the session. Steam games keep Steam’s own Frame Limit. (@xXJSONDeruloXx, [#1813](https://github.com/Droid-Deck/DroidDeck/pull/1813))
- The HUD is now **DroidDeck HUD**. **Pinch with two fingers to resize it** from 50% to 200%, and **drag it past a screen edge to dock it as a small FPS tab**. (@xXJSONDeruloXx, [#1868](https://github.com/Droid-Deck/DroidDeck/pull/1868))
- **x86_64 Flatpak apps run through FEX**. The r2modman bundle starts and loads its list of 334 games on a RedMagic Astra 2, and Flathub installs fall back to an app’s x86_64 build when it has no ARM one. A bundle built for an architecture DroidDeck cannot run is refused with a clear message before it downloads. (@maxjivi05, [#1875](https://github.com/Droid-Deck/DroidDeck/pull/1875), [#1873](https://github.com/Droid-Deck/DroidDeck/pull/1873))
- The **Linux runtime updates by itself** when a new one is out, never during a game or desktop session. (@maxjivi05, [#1787](https://github.com/Droid-Deck/DroidDeck/pull/1787))
- **itch.io updates download as patches** for games with butler builds, instead of the whole game again. (@FX192, [#1829](https://github.com/Droid-Deck/DroidDeck/pull/1829))
- The desktop’s fastfetch shows the **DroidDeck mark** as its logo. (@xXJSONDeruloXx, [#1778](https://github.com/Droid-Deck/DroidDeck/pull/1778))
### Improvements
- **.NET games start faster**: they keep the FEX preset’s multiblock setting, so Stardew Valley starts in **45 s instead of 85 s** on the Retroid Pocket Duo. (@maxjivi05, [#1880](https://github.com/Droid-Deck/DroidDeck/pull/1880))
- On low-memory devices, **Battle.net is compressed with the Steam client** while one of its games runs. Battle.net.exe alone used 345 MB on the Retroid Pocket Duo. (@maxjivi05, [#1882](https://github.com/Droid-Deck/DroidDeck/pull/1882))
- Steam’s **Sleep after** timers start every session as Disabled, since Android decides when the device sleeps. New Steam installs start with **shader pre-caching off**. (@xXJSONDeruloXx, [#1848](https://github.com/Droid-Deck/DroidDeck/pull/1848), [#1861](https://github.com/Droid-Deck/DroidDeck/pull/1861))
- The Library starts with **portrait covers** on new installs, and the Steam home drops its “Runtime installs on first Play” chip. Your saved layout is kept. (@xXJSONDeruloXx, [#1857](https://github.com/Droid-Deck/DroidDeck/pull/1857), [#1854](https://github.com/Droid-Deck/DroidDeck/pull/1854))
- A **USB drive that is mounted but unreadable**, as on some Samsung phones, now explains itself and opens the All files access page, from the side rail too. (@maxjivi05, [#1872](https://github.com/Droid-Deck/DroidDeck/pull/1872))
- **Translations:** every string added since the last pass is in all 32 languages. (@maxjivi05, [#1855](https://github.com/Droid-Deck/DroidDeck/pull/1855))
- **Building and testing DroidDeck:** test and local builds show a faint PR, commit and title watermark, and the required-check tests match the CI gate. (@xXJSONDeruloXx, @maxjivi05, [#1863](https://github.com/Droid-Deck/DroidDeck/pull/1863), [#1864](https://github.com/Droid-Deck/DroidDeck/pull/1864), [#1866](https://github.com/Droid-Deck/DroidDeck/pull/1866), [#1874](https://github.com/Droid-Deck/DroidDeck/pull/1874))
### Fixed
- Fixed **“DroidDeck isn’t responding” on dual-screen handhelds** when input reached the bottom screen or the bottom screen took focus, which stopped controller navigation and RB/LB on the Stores tab. Seen on the AYN Thor and Retroid Pocket Duo. (@maxjivi05, [#1806](https://github.com/Droid-Deck/DroidDeck/pull/1806), [#1871](https://github.com/Droid-Deck/DroidDeck/pull/1871))
- Fixed **dual-screen handhelds** taking over other apps: DroidDeck no longer jumps back over apps opened from outside it, such as iisu, an app sent to the Primary screen stays in front, the update install prompt survives a bottom-screen tap, and the home launcher stays out of Recents. (@maxjivi05, @xXJSONDeruloXx, [#1828](https://github.com/Droid-Deck/DroidDeck/pull/1828), [#1797](https://github.com/Droid-Deck/DroidDeck/pull/1797), [#1893](https://github.com/Droid-Deck/DroidDeck/pull/1893))
- Fixed the **bottom screen**: it keeps the panel you picked, such as Trackpad or Terminal, across games, keeps DroidDeck’s controls up while a game loads, keeps the manual second-screen option when Dual screen is Off, and the Stop button no longer wraps letter by letter on the AYN Thor. (@maxjivi05, @xXJSONDeruloXx, [#1803](https://github.com/Droid-Deck/DroidDeck/pull/1803), [#1840](https://github.com/Droid-Deck/DroidDeck/pull/1840), [#1777](https://github.com/Droid-Deck/DroidDeck/pull/1777), [#1805](https://github.com/Droid-Deck/DroidDeck/pull/1805))
- Fixed the **AYN Odin 2, Odin 2 Mini and Odin 2 Portal** losing their side rail and Back menu: Automatic dual screen now needs a real second touchscreen. On Meta Quest the launcher opens as a landscape window. (@maxjivi05, [#1801](https://github.com/Droid-Deck/DroidDeck/pull/1801), [#1893](https://github.com/Droid-Deck/DroidDeck/pull/1893))
- Fixed **games launched from a frontend** such as Cocoon or iisu sitting on the home screen instead of starting. (@maxjivi05, @xXJSONDeruloXx, [#1789](https://github.com/Droid-Deck/DroidDeck/pull/1789), [#1844](https://github.com/Droid-Deck/DroidDeck/pull/1844))
- Fixed **Steam restarting within seconds of every start** to import added games, which cut off game shortcuts. DroidDeck now asks with Restart now or Later. (@maxjivi05, [#1795](https://github.com/Droid-Deck/DroidDeck/pull/1795))
- Fixed **Steam’s UI lag and heat** since 0.6.7 while keeping it at the panel’s full refresh rate, and a session left in **picture-in-picture** now draws at 30 fps, which saved about 1 W on a RedMagic Astra 2. (@maxjivi05, [#1809](https://github.com/Droid-Deck/DroidDeck/pull/1809), [#1841](https://github.com/Droid-Deck/DroidDeck/pull/1841), [#1842](https://github.com/Droid-Deck/DroidDeck/pull/1842))
- Fixed the **performance HUD** turning itself on: it is off by default again, and your own choice is kept. (@maxjivi05, [#1807](https://github.com/Droid-Deck/DroidDeck/pull/1807))
- Fixed **cutscenes and in-game videos** with DroidDeck-Proton: Resident Evil Revelations no longer waits forever on a loading screen and Kingdom Hearts HD 1.5+2.5 no longer crashes at cutscenes. (@maxjivi05, [#1823](https://github.com/Droid-Deck/DroidDeck/pull/1823))
- Fixed the **Ubuntu runtime** without the desktop installed: the x86-64 Steam client starts again and survives its first self-update, ARMSX2, melonDS and Cemu start, and Steam’s Browse buttons, smart-card and speech support and GPU info in Steam work. (@maxjivi05, [#1825](https://github.com/Droid-Deck/DroidDeck/pull/1825), [#1793](https://github.com/Droid-Deck/DroidDeck/pull/1793), [#1802](https://github.com/Droid-Deck/DroidDeck/pull/1802))
- Fixed **Windows components** (DirectX, Visual C++, XAudio, PhysX and more) disappearing after a runtime update. Lost ones are downloaded again, missing parts of bundles are reinstalled, and a launch waits for the restore. (@maxjivi05, [#1786](https://github.com/Droid-Deck/DroidDeck/pull/1786), [#1788](https://github.com/Droid-Deck/DroidDeck/pull/1788))
- Fixed **Xbox games** running from the drive root: Doom 64, Unity games and AI: The Somnium Files start again. (@maxjivi05, [#1804](https://github.com/Droid-Deck/DroidDeck/pull/1804))
- Fixed **Battle.net**: games install to Android storage, microSD cards and USB SSDs without the “logging on as an administrator” error, and its windows scale to screens above 1080p instead of opening tiny. (@maxjivi05, [#1791](https://github.com/Droid-Deck/DroidDeck/pull/1791), [#1832](https://github.com/Droid-Deck/DroidDeck/pull/1832))
- Fixed **Mortal Kombat 11** and other games with a launch-option picker being closed while the picker was open. (@maxjivi05, [#1869](https://github.com/Droid-Deck/DroidDeck/pull/1869))
- Fixed a **three-finger tap pasting clipboard text** in touchpad mode, the default for desktop sessions and Steam’s desktop UI. It now opens the keyboard there too, as in every other touch mode. (@xXJSONDeruloXx, [#1903](https://github.com/Droid-Deck/DroidDeck/pull/1903))
- Fixed **DirectAudio crackling** on devices where Android refuses low-latency output, such as the AYN Thor. (@maxjivi05, [#1862](https://github.com/Droid-Deck/DroidDeck/pull/1862))
- Fixed **banking apps** such as UBS refusing to open while DroidDeck 0.6.7 was installed. Nothing was wrong with your device or your accounts. 0.6.7 added an optional **accessibility service for Home button shortcuts** (Setup > Steam integration > Home button shortcuts), which lets you hold Home for Steam Guide chords. It only listens for button presses, and it cannot see your screen or read anything in other apps. Even when you never turned it on, Android listed it as installed, and some banking apps block any app outside the Play Store that has an accessibility service able to read button presses, to be safe. DroidDeck now only lists the service while you have it turned on in Android’s Accessibility settings, so banking apps open normally. If you use Home button shortcuts, the service stays on and those banking apps will still see it, because that is how accessibility services work. (@maxjivi05, [#1824](https://github.com/Droid-Deck/DroidDeck/pull/1824))
- Fixed **added games showing up as Spacewar**: a game whose `steam_appid.txt` says 480, as Steam emulators and multiplayer fixes write it, such as PEAK, is no longer imported into Steam as Spacewar. An earlier import is undone, your game folder is left untouched, and a game whose Steam app ID changes follows it, with its art fetched again. (@K11MCH1, [#1896](https://github.com/Droid-Deck/DroidDeck/pull/1896))
- Fixed **folders of games on game storage**, such as Rance 01, showing as one combined game, and adding a game changing another game’s exe. (@maxjivi05, [#1810](https://github.com/Droid-Deck/DroidDeck/pull/1810), [#1822](https://github.com/Droid-Deck/DroidDeck/pull/1822))
- Fixed **Linux games on an NTFS USB drive** closing after about 14 seconds on their first start. (@maxjivi05, [#1850](https://github.com/Droid-Deck/DroidDeck/pull/1850))
- Fixed **itch.io games** whose download is an archive inside an archive, such as Voices of the Void. (@maxjivi05, [#1800](https://github.com/Droid-Deck/DroidDeck/pull/1800))
- Fixed the **Steam and desktop clock** staying on GMT instead of the Android time zone, and **Teardown** dropping to 30 fps under a Steam frame limit. (@maxjivi05, [#1790](https://github.com/Droid-Deck/DroidDeck/pull/1790))
- Fixed Steam’s **Add a Non-Steam Game > Browse** button in the desktop session when another app holds port 8080 and Decky is on. (@maxjivi05, [#1798](https://github.com/Droid-Deck/DroidDeck/pull/1798))
- Fixed **desktop video wallpapers** racing ahead after DroidDeck comes back from the background, and the Library’s Filter, Sort, Display and Collections menus being cut off in portrait. (@maxjivi05, [#1833](https://github.com/Droid-Deck/DroidDeck/pull/1833), [#1827](https://github.com/Droid-Deck/DroidDeck/pull/1827))
### Community
DroidDeck is built in the open by the people who use it. These are everyone whose code is in 0.6.9:
| Contributor | Pull requests |
|---|---|
| @maxjivi05 | 42: dual screens, Steam restarts and refresh rate, Ubuntu runtime, Windows components, Xbox, Battle.net, Flatpak through FEX and more |
| @xXJSONDeruloXx | 14: DroidDeck HUD, frame limit without Steam, frontend launches, touchpad keyboard tap, Steam defaults, Library covers and more |
| @K11MCH1 | 2: launch options for Steam games, Spacewar imports |
| @jmarti326 | [#1202](https://github.com/Droid-Deck/DroidDeck/pull/1202): controller button shortcuts |
| @FX192 | [#1829](https://github.com/Droid-Deck/DroidDeck/pull/1829): itch.io patch updates |
[Full changelog](https://github.com/Droid-Deck/DroidDeck/compare/0.6.7...0.6.9)
Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

@@ -540,7 +540,7 @@ case $mode in
fi
if [ "${BL_ZRAM:-0}" = 1 ]; then
step "zRAM compression: on"
[ "${BL_ZRAM_CLIENT:-1}" = 1 ] || step "zRAM: Steam and the hidden Epic Games Launcher are not compressed while games run (turned off in Performance)"
[ "${BL_ZRAM_CLIENT:-1}" = 1 ] || step "zRAM: Steam, the hidden Epic Games Launcher and Battle.net are not compressed while games run (turned off in Performance)"
_bl_ram_cap=0
case ${BL_RAM_CAP_MB:-} in
''|0) ;;
@@ -550,7 +550,7 @@ case $mode in
(
bl_zram_scan() {
_bl_game=0 _bl_pids=() _bl_others=() _bl_apps=
local _d _c _args _name _a _id _fex
local _d _c _args _name _a _id _fex _lower _bnet=() _bnet_game=0
for _d in /proc/[0-9]*; do
[ "${_d##*/}" != "$BASHPID" ] || continue
_args=()
@@ -575,14 +575,34 @@ case $mode in
;;
steam|steamwebhelper) _bl_pids+=("${_d##*/}") ;;
*)
_lower=${_name,,}
if [ "$_fex" = 1 ] && grep -qz '^DROIDDECK_EPIC_HIDDEN=1$' "$_d/environ" 2>/dev/null; then
_bl_pids+=("${_d##*/}")
elif [[ $_lower == [a-z]:[\\/]'program files (x86)'[\\/]battle.net[\\/]* ||
$_lower == [a-z]:[\\/]programdata[\\/]battle.net[\\/]* ]]; then
_bnet+=("${_d##*/}")
else
_bl_others+=("${_d##*/}")
if [[ $_lower == [a-z]:[\\/]* ]]; then
case ${_lower##*[\\/]} in
agent.exe|conhost.exe|explorer.exe|lsass.exe|plugplay.exe|rpcss.exe|services.exe|start.exe|\
steam.exe|svchost.exe|tabtip.exe|winedevice.exe|rundll32.exe|wineboot.exe|winemenubuilder.exe) ;;
*)
for _a in "${_args[@]:1}"; do
[ "${_a,,}" = -uid ] && _bnet_game=1
done
;;
esac
fi
fi
;;
esac
done
if [ "$_bnet_game" = 1 ]; then
_bl_pids+=("${_bnet[@]}")
else
_bl_others+=("${_bnet[@]}")
fi
}
bl_zram_usage() {
local _p _k _v _u _rss=0 _swap=0
@@ -20,6 +20,7 @@ LIBRARY = "/mnt/droiddeck-sd"
LEGACY_LIBRARY = "/mnt/bannerlator-sd"
PARKED = ".droiddeck-parked"
BASE_ID = 76561197960265728
SPACEWAR = 480
def read_json(path, default):
@@ -86,14 +87,14 @@ def identify(game):
folder = Path(game["folder"])
steamapps = folder.parent.parent
for library in ([steamapps] if folder.parent.name == "common" and steamapps.name == "steamapps" else []) + [folder.parent / WINNATIVE]:
matches = manifest_ids(library, folder.name)
matches = [appid for appid in manifest_ids(library, folder.name) if appid != SPACEWAR]
if matches:
return matches[0] if len(matches) == 1 else None
ids = set()
for parent in {folder, Path(game["exe"]).parent}:
try:
appid = int((parent / "steam_appid.txt").read_text().strip())
if 0 < appid < 0x80000000:
if 0 < appid < 0x80000000 and appid != SPACEWAR:
ids.add(appid)
except (OSError, ValueError):
pass
@@ -107,7 +108,7 @@ def identify(game):
ids = {int(item["id"]) for item in items
if key(item.get("name", "")) == key(game["name"]) and key(game["name"])}
if ids:
return next(iter(ids)) if len(ids) == 1 else None
return next(iter(ids)) if len(ids) == 1 and SPACEWAR not in ids else None
return None
except (OSError, ValueError, KeyError):
return None
@@ -423,20 +424,20 @@ def seed_install(steam_root, game, appid):
return True
def release(steam_root, game):
"""Undoes an import made before store games were skipped. Only our symlink and manifest go;
the store's folder stays where it is."""
def release(steam_root, game, stale, reason):
"""Undoes the imports of the game's folder as the Steam apps [stale] picks. Only our symlink and
manifest go; the folder stays where it is."""
steamapps = Path(steam_root) / "steamapps"
sources = {game.get("folder", ""), legacy_path(game.get("folder", ""))}
for target in sorted((steamapps / "common").glob("DroidDeck-*")):
appid = target.name.removeprefix("DroidDeck-")
if not (appid.isdigit() and target.is_symlink() and os.readlink(target) in sources):
if not (appid.isdigit() and target.is_symlink() and os.readlink(target) in sources and stale(int(appid))):
continue
for manifest in (steamapps / f"appmanifest_{appid}.acf", steamapps / PARKED / f"appmanifest_{appid}.acf"):
if manifest.is_file() and ours(manifest, appid):
manifest.unlink()
target.unlink()
print(f"droiddeck-steam-games: {game.get('name', appid)} came from {game['store']}; it is a shortcut again, not Steam app {appid}")
print(f"droiddeck-steam-games: {game.get('name', appid)} {reason}; it is no longer Steam app {appid}")
def route(steam_root, acct, games):
@@ -457,7 +458,7 @@ def route(steam_root, acct, games):
for game in games:
if store_game(game):
try:
release(steam_root, game)
release(steam_root, game, lambda old: True, f"came from {game['store']}")
except OSError as error:
print(f"droiddeck-steam-games: store import not undone ({error})")
shortcuts.append(game)
@@ -469,9 +470,14 @@ def route(steam_root, acct, games):
appid = candidates.get(folder, candidates.get(legacy_path(folder)))
stamp = source_stamp(game)
recorded = sources.get(folder, sources.get(legacy_path(folder)))
confirmed = (isinstance(appid, int) and 0 < appid < 0x80000000
and owned.get(str(appid)) is True and stamp is not None
and recorded in (stamp, [stamp[0], legacy_path(stamp[1])] + stamp[2:]))
current = stamp is not None and recorded in (stamp, [stamp[0], legacy_path(stamp[1])] + stamp[2:])
named = isinstance(appid, int) and 0 < appid < 0x80000000 and appid != SPACEWAR
try:
release(steam_root, game, lambda old: old == SPACEWAR or (current and named and old != appid),
"names another Steam app now")
except OSError as error:
print(f"droiddeck-steam-games: earlier import not undone ({error})")
confirmed = named and current and owned.get(str(appid)) is True
if confirmed:
try:
if seed_install(steam_root, game, appid):
@@ -480,7 +486,7 @@ def route(steam_root, acct, games):
print(f"droiddeck-steam-games: {game.get('name', appid)} stays a shortcut this session: it could not be linked as Steam app {appid}")
except OSError as error:
print(f"droiddeck-steam-games: import unavailable ({error})")
elif isinstance(appid, int) and 0 < appid < 0x80000000 and seeded(steamapps, game, appid):
elif named and seeded(steamapps, game, appid):
routes[str(game["appid"])] = appid
continue
shortcuts.append(game)
+35
View File
@@ -43,6 +43,41 @@ class ClientZramFocusTest(unittest.TestCase):
self.assertEqual('', result.stderr)
self.assertEqual('5000010 5000011 5000012|5000013 5000014 5000015|1| 413150', result.stdout.strip())
def scan_fake(self, tasks):
with tempfile.TemporaryDirectory() as tmp:
for pid, argv in tasks:
self.write_cmd(Path(tmp), pid, argv)
source = function_source('bl_zram_scan').replace('/proc/[0-9]*', tmp + '/[0-9]*')
return run_bash(source + '\nbl_zram_scan\necho "${_bl_pids[*]}|${_bl_others[*]}|$_bl_game"')
def test_battlenet_is_compressed_with_the_client_while_one_of_its_games_runs(self):
launcher = [
(6000010, ['/s/steamrtarm64/steam', '-gamepadui']),
(6000011, ['/s/reaper', 'SteamLaunch', 'AppId=2899116412', '--', 'droiddeck-battlenet']),
(6000012, ['C:\\Program Files (x86)\\Battle.net\\Battle.net.exe', '--exec=launch S1']),
(6000013, ['C:\\Program Files (x86)\\Battle.net\\Battle.net.15511\\Battle.net Helper.exe', '--type=renderer']),
(6000014, ['C:\\ProgramData\\Battle.net\\Agent\\Agent.9324\\Agent.exe', '--internalclienttools']),
(6000015, ['C:\\windows\\system32\\services.exe']),
(6000016, ['C:\\windows\\system32\\winedevice.exe', '-uid']),
]
game = [(6000017, ['S:\\Games\\StarCraft\\x86\\StarCraft.exe', '-launch', '-uid', 's1'])]
before = self.scan_fake(launcher)
during = self.scan_fake(launcher + game)
for result in (before, during):
self.assertEqual(0, result.returncode, result.stderr)
self.assertEqual('', result.stderr)
self.assertEqual('6000010|6000015 6000016 6000012 6000013 6000014|1', before.stdout.strip())
self.assertEqual('6000010 6000012 6000013 6000014|6000015 6000016 6000017|1', during.stdout.strip())
def test_a_game_without_a_battlenet_uid_leaves_battlenet_alone(self):
result = self.scan_fake([
(6000020, ['C:\\Program Files (x86)\\Battle.net\\Battle.net.exe']),
(6000021, ['D:\\Games\\Other\\Game.exe', '-windowed']),
(6000022, ['/usr/bin/wine', 'game.exe', '-uid']),
])
self.assertEqual(0, result.returncode, result.stderr)
self.assertEqual('|6000021 6000022 6000020|0', result.stdout.strip())
def test_refocus_restarts_the_delay_and_game_exit_restores_a_packed_client(self):
source = SCRIPT.read_text()
start = source.index(' if [ "$_bl_game" = 1 ] && bl_game_focused; then')
-59
View File
@@ -1,59 +0,0 @@
from pathlib import Path
import re
import shutil
import subprocess
import tempfile
import unittest
ROOT = Path(__file__).resolve().parents[2]
SRC = ROOT / 'app' / 'src' / 'main' / 'cpp' / 'waylandcomp' / 'src'
def spirv_words(header):
return re.findall(r'0x[0-9a-fA-F]{8}', header)
@unittest.skipUnless(shutil.which('glslangValidator'), 'needs glslangValidator')
class RotateShaderTest(unittest.TestCase):
def test_committed_spirv_matches_the_glsl(self):
with tempfile.TemporaryDirectory() as folder:
out = Path(folder) / 'rotate_vert.h'
subprocess.run(['glslangValidator', '-V', '--vn', 'rotate_vert_code', '-o', str(out),
str(SRC / 'rotate.vert')], check=True, capture_output=True)
self.assertEqual(spirv_words(out.read_text()), spirv_words((SRC / 'rotate_vert.h').read_text()))
def test_push_constants_match_the_blend_pass(self):
rotate = (SRC / 'rotate.vert').read_text()
blend = (SRC / 'blend.vert').read_text()
pattern = r'uniform PC \{[^}]*\}'
self.assertEqual(re.search(pattern, blend).group(0), re.search(pattern, rotate).group(0))
class PanelRotationSourceTest(unittest.TestCase):
def setUp(self):
self.present = (SRC / 'vk_present.c').read_text()
def function(self, name):
start = self.present.index(name)
return self.present[start:self.present.index('\n}\n', start)]
def test_only_the_final_pass_touches_swapchain_images_while_rotating(self):
for name in ('static void record_screen_blit(', 'static int render_impl('):
self.assertNotIn('g_images[img]', self.function(name), name)
def test_rotation_is_limited_to_quarter_turns_and_can_be_switched_off(self):
body = self.function('static int prerotate_degrees(')
self.assertIn('debug.droiddeck.prerotate', body)
self.assertIn('ROTATE_90_BIT_KHR) return 90', body)
self.assertIn('ROTATE_270_BIT_KHR) return 270', body)
self.assertNotIn('ROTATE_180', body)
self.assertIn('if (g_prerot_failed) return 0;', body)
def test_a_refused_rotated_swapchain_falls_back_to_the_display_rotating(self):
body = self.function('static int swap_init_locked(void) {')
self.assertIn('cr != VK_SUCCESS && g_prerot', body)
self.assertIn('sci.imageExtent = g_extent;', body)
if __name__ == '__main__':
unittest.main()
+70
View File
@@ -391,6 +391,61 @@ class ImportsTest(unittest.TestCase):
with patch.object(imports.urllib.request, 'urlopen', side_effect=AssertionError):
self.assertEqual(42, imports.identify(self.game))
def test_spacewar_appid_names_no_game(self):
(self.folder / 'steam_appid.txt').write_text('480\n')
with patch.object(imports.urllib.request, 'urlopen', side_effect=OSError):
self.assertIsNone(imports.identify(self.game))
def import_as(self, appid):
self.assertTrue(imports.seed_install(self.steam, self.game, appid))
self.assertTrue((self.steam / f'steamapps/appmanifest_{appid}.acf').is_file())
def snapshot_names(self, appid, owned):
imports.save_json(self.acct / 'config' / imports.STATE,
dict(account='123', owned={str(appid): owned},
candidates={str(self.folder): appid},
sources={str(self.folder): imports.source_stamp(self.game)}))
def assert_not_imported_as(self, appid):
self.assertFalse((self.steam / f'steamapps/appmanifest_{appid}.acf').exists())
self.assertFalse(os.path.lexists(self.steam / f'steamapps/common/DroidDeck-{appid}'))
def test_spacewar_import_is_released_and_never_made_again(self):
self.import_as(480)
self.snapshot_names(480, owned=True)
with patch('builtins.print'):
self.assertEqual(([self.game], {}), imports.route(self.steam, self.acct, [self.game]))
self.assert_not_imported_as(480)
self.assertEqual(b'game', self.exe.read_bytes())
def test_import_follows_the_app_the_files_name_now(self):
self.snapshot()
imports.route(self.steam, self.acct, [self.game])
self.snapshot_names(43, owned=True)
with patch('builtins.print'):
self.assertEqual(([], {str(self.game['appid']): 43}), imports.route(self.steam, self.acct, [self.game]))
self.assert_not_imported_as(42)
self.assertEqual(self.folder, (self.steam / 'steamapps/common/DroidDeck-43').resolve())
def test_unowned_new_appid_leaves_a_shortcut(self):
self.snapshot()
imports.route(self.steam, self.acct, [self.game])
self.snapshot_names(43, owned=False)
with patch('builtins.print'):
self.assertEqual(([self.game], {}), imports.route(self.steam, self.acct, [self.game]))
self.assert_not_imported_as(42)
self.assert_not_imported_as(43)
def test_import_stays_while_the_new_identity_is_unknown(self):
self.snapshot()
imports.route(self.steam, self.acct, [self.game])
for candidates in ({}, {str(self.folder): 43}):
imports.save_json(self.acct / 'config' / imports.STATE,
dict(account='123', owned={'43': True}, candidates=candidates,
sources={str(self.folder): ['stale']}))
imports.route(self.steam, self.acct, [self.game])
self.assertTrue((self.steam / 'steamapps/appmanifest_42.acf').is_file())
def test_manifest_identity_uses_install_directory(self):
folder = self.root / 'second/steamapps/common/Custom Name'
folder.mkdir(parents=True)
@@ -399,6 +454,21 @@ class ImportsTest(unittest.TestCase):
with patch.object(imports.urllib.request, 'urlopen', side_effect=AssertionError):
self.assertEqual(42, imports.identify(game))
def test_a_spacewar_manifest_names_no_game(self):
folder = self.root / 'second/steamapps/common/PEAK'
folder.mkdir(parents=True)
(folder.parent.parent / 'appmanifest_480.acf').write_text('"AppState" { "installdir" "PEAK" }')
(folder / 'steam_appid.txt').write_text('3527290\n')
game = dict(self.game, folder=str(folder), exe=str(folder / 'PEAK.exe'))
with patch.object(imports.urllib.request, 'urlopen', side_effect=AssertionError):
self.assertEqual(3527290, imports.identify(game))
def test_a_store_search_answering_spacewar_names_no_game(self):
with patch.object(imports.urllib.request, 'urlopen') as request:
request.return_value.__enter__.return_value.read.return_value = json.dumps(
{'items': [{'id': 480, 'name': 'Spacewar'}]}).encode()
self.assertIsNone(imports.identify(dict(self.game, name='Spacewar')))
def test_store_requires_unique_exact_title(self):
cases = [([{'id': 42, 'name': 'Example Deluxe'}], None),
([{'id': 42, 'name': 'Example'}, {'id': 43, 'name': 'Example'}], None),