mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 12:28:40 +00:00
chore: merge main into feat/bt-controller-trinket
This commit is contained in:
commit
1099b82044
220 files changed
+7947
-1680
No files matched your search
@@ -25,7 +25,7 @@ jobs:
|
||||
validate:
|
||||
name: Validate source and build result
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 5
|
||||
timeout-minutes: 70
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
|
||||
@@ -152,6 +152,9 @@ jobs:
|
||||
runs-on: ${{ fromJSON(needs.components-runner.outputs.labels) }}
|
||||
timeout-minutes: 40
|
||||
steps:
|
||||
- name: Reclaim files a cancelled container build left owned by root
|
||||
if: runner.environment == 'self-hosted'
|
||||
run: sudo -n chown -R "$(id -u):$(id -g)" "$GITHUB_WORKSPACE" || echo "::warning::could not reclaim $GITHUB_WORKSPACE"
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
|
||||
@@ -350,6 +353,9 @@ jobs:
|
||||
outputs:
|
||||
variants: ${{ steps.variants.outputs.list }}
|
||||
steps:
|
||||
- name: Reclaim files a cancelled container build left owned by root
|
||||
if: runner.environment == 'self-hosted'
|
||||
run: sudo -n chown -R "$(id -u):$(id -g)" "$GITHUB_WORKSPACE" || echo "::warning::could not reclaim $GITHUB_WORKSPACE"
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
|
||||
|
||||
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
@@ -70,7 +70,7 @@ DroidDeck is [GPL-3.0](LICENSE). Steam and Proton belong to Valve Corporation. V
|
||||
|
||||
- Runtime, shim, input and controller work build on WinNative and Bannerlator by maxjivi05.
|
||||
- mmap ring buffer controller input by ribbit384 ([WinNative #345](https://github.com/WinNative-Emu/WinNative/pull/345)).
|
||||
- [FEX](https://github.com/FEX-Emu/FEX) (MIT) runs x86 code. DroidDeck's build puts the platform name under `AT_PLATFORM` so [sharun](https://github.com/VHSgunzo/sharun) AppImages by VHSgunzo (MIT) start through its [userland-execve](https://crates.io/crates/userland-execve) loader (MIT). FEX's code disk cache was checked in its source.
|
||||
- [FEX](https://github.com/FEX-Emu/FEX) (MIT) runs x86 code. DroidDeck's build puts the platform name under `AT_PLATFORM` so [sharun](https://github.com/VHSgunzo/sharun) AppImages by VHSgunzo (MIT) start through its [userland-execve](https://crates.io/crates/userland-execve) loader (MIT), and its GL thunk hands X errors to the program's own error handler. FEX's code disk cache was checked in its source.
|
||||
- x86 AppImages, and arm64 ones whose runtime can't unpack on Android, are unpacked with [uruntime](https://github.com/VHSgunzo/uruntime) by VHSgunzo (MIT), shipped unmodified with its licence.
|
||||
- x86 programs linking OpenSSL 3 use the copy in the [Steam Linux Runtime 4.0](https://gitlab.steamos.cloud/steamrt/steamrt). x86 Linux games get the `/etc/asound.conf` that [pressure-vessel](https://gitlab.steamos.cloud/steamrt/steam-runtime-tools) writes.
|
||||
- `WriteProcessMemory` hooks fall back to `/proc/<pid>/mem` the way [Wine](https://gitlab.winehq.org/wine/wine)'s `server/ptrace.c` did before Wine 11.
|
||||
@@ -97,6 +97,7 @@ DroidDeck is [GPL-3.0](LICENSE). Steam and Proton belong to Valve Corporation. V
|
||||
- Battle.net is by [@kayakyakr](https://github.com/kayakyakr). It runs Blizzard's own client in Proton (downloaded from Blizzard, not included) and shows key art from the [Battle.net Shop](https://shop.battle.net). Without Steam, its games see the pad as an Xbox 360 controller via `PROTON_SPOOF_STEAMINPUT_VIDPID` in [Proton](https://github.com/ValveSoftware/wine)'s `dlls/winebus.sys`.
|
||||
- The EA store follows the EA app's protocols as documented by [ArmchairDevelopers](https://github.com/ArmchairDevelopers)' [Maxima](https://github.com/ArmchairDevelopers/Maxima) (GPL-3.0): sign-in, the GraphQL queries (included verbatim, since EA matches them by hash), build archives, online activation licences and the LSX game endpoint. The code is DroidDeck's own.
|
||||
- Battle.net installs drive Blizzard's Agent the way [@barncastle](https://github.com/barncastle)'s [Battle.Net-Installer](https://github.com/barncastle/Battle.Net-Installer) does, with requests from [wowdev.wiki](https://wowdev.wiki/Agent). Read without taking code: [@mubaraknumann](https://github.com/mubaraknumann)'s [unifideck](https://github.com/mubaraknumann/unifideck), [@djmittens](https://github.com/djmittens)'s [neo-mittens](https://github.com/djmittens/neo-mittens) `bnetswitch`, [@BCD1210](https://github.com/BCD1210)'s [soju](https://github.com/BCD1210/soju) and [Lutris](https://github.com/lutris/lutris)'s `product.db` reader.
|
||||
- The Rockstar launcher service looks for launcher pipe names in the executables beside the game, since [CitizenFX](https://github.com/citizenfx/fivem)'s `ros-patches-five` shows GTA V opening `GTAVLauncher_Pipe` and [@pingod](https://github.com/pingod)'s [rdr2-linux-launcher](https://github.com/pingod/rdr2-linux-launcher) notes that Rockstar's protected executables resolve such strings only at run time. Read without taking code.
|
||||
- World of Warcraft addon imports replace an addon's folder from a temporary copy, as [WowUp](https://github.com/WowUp/WowUp) does, and read flavour folders the way [WoWDeck](https://github.com/sigboe/wowdeck) does. No code from either is used.
|
||||
- The World of Warcraft addon Download window searches [WoWInterface](https://www.wowinterface.com) through its MMOUI API. [CurseForge](https://www.curseforge.com/wow) opens in the user's browser, with no API and no key.
|
||||
- The Xbox store runs [@domsvoboda](https://github.com/domsvoboda)'s [nexus-backend](https://github.com/domsvoboda/nexus-backend) 0.2.15 (GPL-3.0, a fork of [Xodus](https://github.com/xodus-gaming/xodus)), and Xbox games load the Windows modules of his [nexus-runtime](https://github.com/domsvoboda/nexus-runtime) (LGPL-2.1-or-later), including the C++ [nexus-xgameruntime](https://github.com/domsvoboda/nexus-xgameruntime) and `wintypes.dll`. Content licensing sends delegation-compact device tickets in the licensing wire form, as nexus-backend's Store license path (commit `27c335e`) does. Minecraft's GameInput setup was checked against [@Wyze3306](https://github.com/Wyze3306)'s [BedrockOnLinux](https://github.com/Wyze3306/BedrockOnLinux) (MIT).
|
||||
|
||||
@@ -161,6 +161,7 @@
|
||||
<category android:name="android.intent.category.CAR_LAUNCHER" />
|
||||
<data android:scheme="droiddeck" android:host="game" />
|
||||
<data android:scheme="droiddeck" android:host="soundtrack" />
|
||||
<data android:scheme="droiddeck" android:host="settings" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.CREATE_SHORTCUT" />
|
||||
@@ -309,6 +310,15 @@
|
||||
android:resizeableActivity="true"
|
||||
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|keyboard|keyboardHidden|navigation|uiMode|density" />
|
||||
|
||||
<activity
|
||||
android:name=".session.KeepTopActivity"
|
||||
android:exported="false"
|
||||
android:excludeFromRecents="true"
|
||||
android:noHistory="true"
|
||||
android:taskAffinity="${applicationId}.keeptop"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
|
||||
android:resizeableActivity="true"
|
||||
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|keyboard|keyboardHidden|navigation|uiMode|density" />
|
||||
<activity
|
||||
android:name=".ui.SessionTypingActivity"
|
||||
android:exported="false"
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
#version 450
|
||||
|
||||
layout(location = 0) in vec2 fragTexCoord;
|
||||
layout(location = 0) out vec4 outColor;
|
||||
layout(set = 0, binding = 0) uniform sampler2D InputTexture;
|
||||
layout(push_constant) uniform Constants {
|
||||
vec4 ndc;
|
||||
vec2 resolution;
|
||||
float extra;
|
||||
float pad;
|
||||
} pc;
|
||||
|
||||
float luma(vec3 c) {
|
||||
return dot(c, vec3(0.2126, 0.7152, 0.0722));
|
||||
}
|
||||
|
||||
float edgeVertical(vec2 uv, vec2 px) {
|
||||
float a = luma(texture(InputTexture, uv - vec2(px.x, 0.0)).rgb);
|
||||
float b = luma(texture(InputTexture, uv + vec2(px.x, 0.0)).rgb);
|
||||
return abs(a - b);
|
||||
}
|
||||
|
||||
float edgeHorizontal(vec2 uv, vec2 px) {
|
||||
float a = luma(texture(InputTexture, uv - vec2(0.0, px.y)).rgb);
|
||||
float b = luma(texture(InputTexture, uv + vec2(0.0, px.y)).rgb);
|
||||
return abs(a - b);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 px = 1.0 / max(pc.resolution, vec2(1.0));
|
||||
vec2 uv = clamp(fragTexCoord, px * 0.5, vec2(1.0) - px * 0.5);
|
||||
vec4 center = texture(InputTexture, uv);
|
||||
|
||||
float lc = luma(center.rgb);
|
||||
float ll = luma(texture(InputTexture, uv - vec2(px.x, 0.0)).rgb);
|
||||
float lr = luma(texture(InputTexture, uv + vec2(px.x, 0.0)).rgb);
|
||||
float lu = luma(texture(InputTexture, uv - vec2(0.0, px.y)).rgb);
|
||||
float ld = luma(texture(InputTexture, uv + vec2(0.0, px.y)).rgb);
|
||||
|
||||
float dL = abs(lc - ll);
|
||||
float dR = abs(lc - lr);
|
||||
float dU = abs(lc - lu);
|
||||
float dD = abs(lc - ld);
|
||||
float localMin = min(lc, min(min(ll, lr), min(lu, ld)));
|
||||
float localMax = max(lc, max(max(ll, lr), max(lu, ld)));
|
||||
float localContrast = localMax - localMin;
|
||||
float threshold = max(0.045, localContrast * 0.08);
|
||||
|
||||
float vertical = max(dL, dR);
|
||||
float horizontal = max(dU, dD);
|
||||
float strongest = max(vertical, horizontal);
|
||||
if (strongest <= threshold) {
|
||||
outColor = center;
|
||||
return;
|
||||
}
|
||||
|
||||
bool verticalEdge = vertical >= horizontal;
|
||||
vec2 tangent = verticalEdge ? vec2(0.0, px.y) : vec2(px.x, 0.0);
|
||||
vec2 normal = verticalEdge
|
||||
? vec2(dL >= dR ? -1.0 : 1.0, 0.0)
|
||||
: vec2(0.0, dU >= dD ? -1.0 : 1.0);
|
||||
|
||||
float negativeRun = 0.0;
|
||||
float positiveRun = 0.0;
|
||||
for (int i = 1; i <= 6; ++i) {
|
||||
vec2 offset = tangent * float(i);
|
||||
float edgeN = verticalEdge ? edgeVertical(uv - offset, px) : edgeHorizontal(uv - offset, px);
|
||||
float edgeP = verticalEdge ? edgeVertical(uv + offset, px) : edgeHorizontal(uv + offset, px);
|
||||
if (negativeRun == float(i - 1) && edgeN > threshold * 0.65) negativeRun = float(i);
|
||||
if (positiveRun == float(i - 1) && edgeP > threshold * 0.65) positiveRun = float(i);
|
||||
}
|
||||
|
||||
float span = negativeRun + positiveRun;
|
||||
float edgeConfidence = smoothstep(threshold, threshold * 2.5, strongest);
|
||||
|
||||
float nw = luma(texture(InputTexture, uv + vec2(-px.x, -px.y)).rgb);
|
||||
float ne = luma(texture(InputTexture, uv + vec2(px.x, -px.y)).rgb);
|
||||
float sw = luma(texture(InputTexture, uv + vec2(-px.x, px.y)).rgb);
|
||||
float se = luma(texture(InputTexture, uv + vec2(px.x, px.y)).rgb);
|
||||
float endpointPattern = clamp(abs(negativeRun - positiveRun) / max(span, 1.0), 0.0, 1.0);
|
||||
float endpointArea = endpointPattern / (1.0 + span * 0.055);
|
||||
float crossingA = verticalEdge ? abs(nw - ne) : abs(nw - sw);
|
||||
float crossingB = verticalEdge ? abs(sw - se) : abs(ne - se);
|
||||
float crossingContrast = abs(crossingA - crossingB);
|
||||
float crossingPattern = smoothstep(threshold, threshold * 2.5, crossingContrast);
|
||||
float areaWeight = 0.38 * crossingPattern * clamp(span / 4.0, 0.0, 1.0);
|
||||
float diagonalContrast = max(abs(nw - se), abs(ne - sw));
|
||||
float cornerFactor = 1.0 - 0.18 * smoothstep(threshold, threshold * 3.0, diagonalContrast);
|
||||
float baseWeight = areaWeight * endpointArea * edgeConfidence * cornerFactor;
|
||||
|
||||
float diagonalStrength = abs(abs(nw - se) - abs(ne - sw));
|
||||
float diagonalPattern = smoothstep(threshold, threshold * 2.5, diagonalStrength);
|
||||
float diagonalFallback = 0.16 * diagonalPattern * edgeConfidence * cornerFactor;
|
||||
|
||||
float weight = clamp(
|
||||
baseWeight <= 0.0001 ? diagonalFallback : baseWeight,
|
||||
0.0, 0.42
|
||||
);
|
||||
vec3 across = texture(InputTexture, uv + normal * px).rgb;
|
||||
outColor = vec4(mix(center.rgb, across, weight), center.a);
|
||||
}
|
||||
@@ -0,0 +1,443 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
static const uint32_t smaa_code[] = {
|
||||
0x07230203u, 0x00010000u, 0x0008000bu, 0x00000254u, 0x00000000u, 0x00020011u, 0x00000001u, 0x0006000bu,
|
||||
0x00000001u, 0x4c534c47u, 0x6474732eu, 0x3035342eu, 0x00000000u, 0x0003000eu, 0x00000000u, 0x00000001u,
|
||||
0x0007000fu, 0x00000004u, 0x00000004u, 0x6e69616du, 0x00000000u, 0x00000072u, 0x000000f6u, 0x00030010u,
|
||||
0x00000004u, 0x00000007u, 0x00030003u, 0x00000002u, 0x000001c2u, 0x00040005u, 0x00000004u, 0x6e69616du,
|
||||
0x00000000u, 0x00050005u, 0x0000000bu, 0x616d756cu, 0x33667628u, 0x0000003bu, 0x00030005u, 0x0000000au,
|
||||
0x00000063u, 0x00080005u, 0x00000012u, 0x65676465u, 0x74726556u, 0x6c616369u, 0x32667628u, 0x3266763bu,
|
||||
0x0000003bu, 0x00030005u, 0x00000010u, 0x00007675u, 0x00030005u, 0x00000011u, 0x00007870u, 0x00080005u,
|
||||
0x00000016u, 0x65676465u, 0x69726f48u, 0x746e6f7au, 0x76286c61u, 0x763b3266u, 0x003b3266u, 0x00030005u,
|
||||
0x00000014u, 0x00007675u, 0x00030005u, 0x00000015u, 0x00007870u, 0x00030005u, 0x00000021u, 0x00000061u,
|
||||
0x00060005u, 0x00000025u, 0x75706e49u, 0x78655474u, 0x65727574u, 0x00000000u, 0x00040005u, 0x00000031u,
|
||||
0x61726170u, 0x0000006du, 0x00030005u, 0x00000034u, 0x00000062u, 0x00040005u, 0x0000003cu, 0x61726170u,
|
||||
0x0000006du, 0x00030005u, 0x00000045u, 0x00000061u, 0x00040005u, 0x0000004eu, 0x61726170u, 0x0000006du,
|
||||
0x00030005u, 0x00000051u, 0x00000062u, 0x00040005u, 0x00000059u, 0x61726170u, 0x0000006du, 0x00030005u,
|
||||
0x00000062u, 0x00007870u, 0x00050005u, 0x00000064u, 0x736e6f43u, 0x746e6174u, 0x00000073u, 0x00040006u,
|
||||
0x00000064u, 0x00000000u, 0x0063646eu, 0x00060006u, 0x00000064u, 0x00000001u, 0x6f736572u, 0x6974756cu,
|
||||
0x00006e6fu, 0x00050006u, 0x00000064u, 0x00000002u, 0x72747865u, 0x00000061u, 0x00040006u, 0x00000064u,
|
||||
0x00000003u, 0x00646170u, 0x00030005u, 0x00000066u, 0x00006370u, 0x00030005u, 0x00000070u, 0x00007675u,
|
||||
0x00060005u, 0x00000072u, 0x67617266u, 0x43786554u, 0x64726f6fu, 0x00000000u, 0x00040005u, 0x0000007cu,
|
||||
0x746e6563u, 0x00007265u, 0x00030005u, 0x00000080u, 0x0000636cu, 0x00040005u, 0x00000081u, 0x61726170u,
|
||||
0x0000006du, 0x00030005u, 0x00000085u, 0x00006c6cu, 0x00040005u, 0x0000008du, 0x61726170u, 0x0000006du,
|
||||
0x00030005u, 0x00000090u, 0x0000726cu, 0x00040005u, 0x00000098u, 0x61726170u, 0x0000006du, 0x00030005u,
|
||||
0x0000009bu, 0x0000756cu, 0x00040005u, 0x000000a3u, 0x61726170u, 0x0000006du, 0x00030005u, 0x000000a6u,
|
||||
0x0000646cu, 0x00040005u, 0x000000aeu, 0x61726170u, 0x0000006du, 0x00030005u, 0x000000b1u, 0x00004c64u,
|
||||
0x00030005u, 0x000000b6u, 0x00005264u, 0x00030005u, 0x000000bbu, 0x00005564u, 0x00030005u, 0x000000c0u,
|
||||
0x00004464u, 0x00050005u, 0x000000c5u, 0x61636f6cu, 0x6e694d6cu, 0x00000000u, 0x00050005u, 0x000000cfu,
|
||||
0x61636f6cu, 0x78614d6cu, 0x00000000u, 0x00060005u, 0x000000d9u, 0x61636f6cu, 0x6e6f436cu, 0x73617274u,
|
||||
0x00000074u, 0x00050005u, 0x000000ddu, 0x65726874u, 0x6c6f6873u, 0x00000064u, 0x00050005u, 0x000000e3u,
|
||||
0x74726576u, 0x6c616369u, 0x00000000u, 0x00050005u, 0x000000e7u, 0x69726f68u, 0x746e6f7au, 0x00006c61u,
|
||||
0x00050005u, 0x000000ebu, 0x6f727473u, 0x7365676eu, 0x00000074u, 0x00050005u, 0x000000f6u, 0x4374756fu,
|
||||
0x726f6c6fu, 0x00000000u, 0x00060005u, 0x000000fau, 0x74726576u, 0x6c616369u, 0x65676445u, 0x00000000u,
|
||||
0x00040005u, 0x000000feu, 0x676e6174u, 0x00746e65u, 0x00040005u, 0x0000010bu, 0x6d726f6eu, 0x00006c61u,
|
||||
0x00050005u, 0x0000011du, 0x6167656eu, 0x65766974u, 0x006e7552u, 0x00050005u, 0x0000011eu, 0x69736f70u,
|
||||
0x65766974u, 0x006e7552u, 0x00030005u, 0x00000120u, 0x00000069u, 0x00040005u, 0x00000129u, 0x7366666fu,
|
||||
0x00007465u, 0x00040005u, 0x0000012eu, 0x65676465u, 0x0000004eu, 0x00040005u, 0x00000136u, 0x61726170u,
|
||||
0x0000006du, 0x00040005u, 0x00000137u, 0x61726170u, 0x0000006du, 0x00040005u, 0x0000013eu, 0x61726170u,
|
||||
0x0000006du, 0x00040005u, 0x0000013fu, 0x61726170u, 0x0000006du, 0x00040005u, 0x00000143u, 0x65676465u,
|
||||
0x00000050u, 0x00040005u, 0x0000014bu, 0x61726170u, 0x0000006du, 0x00040005u, 0x0000014cu, 0x61726170u,
|
||||
0x0000006du, 0x00040005u, 0x00000153u, 0x61726170u, 0x0000006du, 0x00040005u, 0x00000154u, 0x61726170u,
|
||||
0x0000006du, 0x00040005u, 0x0000017bu, 0x6e617073u, 0x00000000u, 0x00060005u, 0x0000017fu, 0x65676465u,
|
||||
0x666e6f43u, 0x6e656469u, 0x00006563u, 0x00030005u, 0x00000186u, 0x0000776eu, 0x00040005u, 0x00000192u,
|
||||
0x61726170u, 0x0000006du, 0x00030005u, 0x00000195u, 0x0000656eu, 0x00040005u, 0x000001a0u, 0x61726170u,
|
||||
0x0000006du, 0x00030005u, 0x000001a3u, 0x00007773u, 0x00040005u, 0x000001aeu, 0x61726170u, 0x0000006du,
|
||||
0x00030005u, 0x000001b1u, 0x00006573u, 0x00040005u, 0x000001bbu, 0x61726170u, 0x0000006du, 0x00060005u,
|
||||
0x000001beu, 0x70646e65u, 0x746e696fu, 0x74746150u, 0x006e7265u, 0x00060005u, 0x000001c7u, 0x70646e65u,
|
||||
0x746e696fu, 0x61657241u, 0x00000000u, 0x00050005u, 0x000001ceu, 0x736f7263u, 0x676e6973u, 0x00000041u,
|
||||
0x00050005u, 0x000001ddu, 0x736f7263u, 0x676e6973u, 0x00000042u, 0x00070005u, 0x000001ecu, 0x736f7263u,
|
||||
0x676e6973u, 0x746e6f43u, 0x74736172u, 0x00000000u, 0x00060005u, 0x000001f1u, 0x736f7263u, 0x676e6973u,
|
||||
0x74746150u, 0x006e7265u, 0x00050005u, 0x000001f7u, 0x61657261u, 0x67696557u, 0x00007468u, 0x00070005u,
|
||||
0x00000200u, 0x67616964u, 0x6c616e6fu, 0x746e6f43u, 0x74736172u, 0x00000000u, 0x00060005u, 0x0000020au,
|
||||
0x6e726f63u, 0x61467265u, 0x726f7463u, 0x00000000u, 0x00050005u, 0x00000214u, 0x65736162u, 0x67696557u,
|
||||
0x00007468u, 0x00070005u, 0x0000021cu, 0x67616964u, 0x6c616e6fu, 0x65727453u, 0x6874676eu, 0x00000000u,
|
||||
0x00060005u, 0x00000227u, 0x67616964u, 0x6c616e6fu, 0x74746150u, 0x006e7265u, 0x00070005u, 0x0000022du,
|
||||
0x67616964u, 0x6c616e6fu, 0x6c6c6146u, 0x6b636162u, 0x00000000u, 0x00040005u, 0x00000235u, 0x67696577u,
|
||||
0x00007468u, 0x00040005u, 0x0000023eu, 0x6f726361u, 0x00007373u, 0x00040047u, 0x00000025u, 0x00000021u,
|
||||
0x00000000u, 0x00040047u, 0x00000025u, 0x00000022u, 0x00000000u, 0x00030047u, 0x00000064u, 0x00000002u,
|
||||
0x00050048u, 0x00000064u, 0x00000000u, 0x00000023u, 0x00000000u, 0x00050048u, 0x00000064u, 0x00000001u,
|
||||
0x00000023u, 0x00000010u, 0x00050048u, 0x00000064u, 0x00000002u, 0x00000023u, 0x00000018u, 0x00050048u,
|
||||
0x00000064u, 0x00000003u, 0x00000023u, 0x0000001cu, 0x00040047u, 0x00000072u, 0x0000001eu, 0x00000000u,
|
||||
0x00040047u, 0x000000f6u, 0x0000001eu, 0x00000000u, 0x00020013u, 0x00000002u, 0x00030021u, 0x00000003u,
|
||||
0x00000002u, 0x00030016u, 0x00000006u, 0x00000020u, 0x00040017u, 0x00000007u, 0x00000006u, 0x00000003u,
|
||||
0x00040020u, 0x00000008u, 0x00000007u, 0x00000007u, 0x00040021u, 0x00000009u, 0x00000006u, 0x00000008u,
|
||||
0x00040017u, 0x0000000du, 0x00000006u, 0x00000002u, 0x00040020u, 0x0000000eu, 0x00000007u, 0x0000000du,
|
||||
0x00050021u, 0x0000000fu, 0x00000006u, 0x0000000eu, 0x0000000eu, 0x0004002bu, 0x00000006u, 0x00000019u,
|
||||
0x3e59b3d0u, 0x0004002bu, 0x00000006u, 0x0000001au, 0x3f371759u, 0x0004002bu, 0x00000006u, 0x0000001bu,
|
||||
0x3d93dd98u, 0x0006002cu, 0x00000007u, 0x0000001cu, 0x00000019u, 0x0000001au, 0x0000001bu, 0x00040020u,
|
||||
0x00000020u, 0x00000007u, 0x00000006u, 0x00090019u, 0x00000022u, 0x00000006u, 0x00000001u, 0x00000000u,
|
||||
0x00000000u, 0x00000000u, 0x00000001u, 0x00000000u, 0x0003001bu, 0x00000023u, 0x00000022u, 0x00040020u,
|
||||
0x00000024u, 0x00000000u, 0x00000023u, 0x0004003bu, 0x00000024u, 0x00000025u, 0x00000000u, 0x00040015u,
|
||||
0x00000028u, 0x00000020u, 0x00000000u, 0x0004002bu, 0x00000028u, 0x00000029u, 0x00000000u, 0x0004002bu,
|
||||
0x00000006u, 0x0000002cu, 0x00000000u, 0x00040017u, 0x0000002fu, 0x00000006u, 0x00000004u, 0x0004002bu,
|
||||
0x00000028u, 0x00000048u, 0x00000001u, 0x0004002bu, 0x00000006u, 0x00000063u, 0x3f800000u, 0x0006001eu,
|
||||
0x00000064u, 0x0000002fu, 0x0000000du, 0x00000006u, 0x00000006u, 0x00040020u, 0x00000065u, 0x00000009u,
|
||||
0x00000064u, 0x0004003bu, 0x00000065u, 0x00000066u, 0x00000009u, 0x00040015u, 0x00000067u, 0x00000020u,
|
||||
0x00000001u, 0x0004002bu, 0x00000067u, 0x00000068u, 0x00000001u, 0x00040020u, 0x00000069u, 0x00000009u,
|
||||
0x0000000du, 0x0005002cu, 0x0000000du, 0x0000006cu, 0x00000063u, 0x00000063u, 0x00040020u, 0x00000071u,
|
||||
0x00000001u, 0x0000000du, 0x0004003bu, 0x00000071u, 0x00000072u, 0x00000001u, 0x0004002bu, 0x00000006u,
|
||||
0x00000075u, 0x3f000000u, 0x00040020u, 0x0000007bu, 0x00000007u, 0x0000002fu, 0x0004002bu, 0x00000006u,
|
||||
0x000000deu, 0x3d3851ecu, 0x0004002bu, 0x00000006u, 0x000000e0u, 0x3da3d70au, 0x00020014u, 0x000000f1u,
|
||||
0x00040020u, 0x000000f5u, 0x00000003u, 0x0000002fu, 0x0004003bu, 0x000000f5u, 0x000000f6u, 0x00000003u,
|
||||
0x00040020u, 0x000000f9u, 0x00000007u, 0x000000f1u, 0x0004002bu, 0x00000006u, 0x00000113u, 0xbf800000u,
|
||||
0x00040020u, 0x0000011fu, 0x00000007u, 0x00000067u, 0x0004002bu, 0x00000067u, 0x00000127u, 0x00000006u,
|
||||
0x0004002bu, 0x00000006u, 0x00000161u, 0x3f266666u, 0x0004002bu, 0x00000006u, 0x00000182u, 0x40200000u,
|
||||
0x0004002bu, 0x00000006u, 0x000001cau, 0x3d6147aeu, 0x0004002bu, 0x00000006u, 0x000001f8u, 0x3ec28f5cu,
|
||||
0x0004002bu, 0x00000006u, 0x000001fcu, 0x40800000u, 0x0004002bu, 0x00000006u, 0x0000020bu, 0x3e3851ecu,
|
||||
0x0004002bu, 0x00000006u, 0x0000020eu, 0x40400000u, 0x0004002bu, 0x00000006u, 0x0000022eu, 0x3e23d70au,
|
||||
0x0004002bu, 0x00000006u, 0x00000237u, 0x38d1b717u, 0x0004002bu, 0x00000006u, 0x0000023cu, 0x3ed70a3du,
|
||||
0x0004002bu, 0x00000028u, 0x0000024du, 0x00000003u, 0x00050036u, 0x00000002u, 0x00000004u, 0x00000000u,
|
||||
0x00000003u, 0x000200f8u, 0x00000005u, 0x0004003bu, 0x0000000eu, 0x00000062u, 0x00000007u, 0x0004003bu,
|
||||
0x0000000eu, 0x00000070u, 0x00000007u, 0x0004003bu, 0x0000007bu, 0x0000007cu, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x00000080u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x00000081u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x00000085u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x0000008du, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x00000090u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x00000098u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x0000009bu, 0x00000007u, 0x0004003bu, 0x00000008u, 0x000000a3u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000000a6u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x000000aeu, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000000b1u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000000b6u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000000bbu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000000c0u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000000c5u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000000cfu, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000000d9u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000000ddu, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000000e3u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000000e7u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000000ebu, 0x00000007u, 0x0004003bu, 0x000000f9u, 0x000000fau, 0x00000007u, 0x0004003bu,
|
||||
0x0000000eu, 0x000000feu, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x00000100u, 0x00000007u, 0x0004003bu,
|
||||
0x0000000eu, 0x0000010bu, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x0000010du, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x0000011du, 0x00000007u, 0x0004003bu, 0x00000020u, 0x0000011eu, 0x00000007u, 0x0004003bu,
|
||||
0x0000011fu, 0x00000120u, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x00000129u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x0000012eu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x00000130u, 0x00000007u, 0x0004003bu,
|
||||
0x0000000eu, 0x00000136u, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x00000137u, 0x00000007u, 0x0004003bu,
|
||||
0x0000000eu, 0x0000013eu, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x0000013fu, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x00000143u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x00000145u, 0x00000007u, 0x0004003bu,
|
||||
0x0000000eu, 0x0000014bu, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x0000014cu, 0x00000007u, 0x0004003bu,
|
||||
0x0000000eu, 0x00000153u, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x00000154u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x0000017bu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x0000017fu, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x00000186u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x00000192u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x00000195u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x000001a0u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000001a3u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x000001aeu, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000001b1u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x000001bbu, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000001beu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000001c7u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000001ceu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000001d0u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000001ddu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000001dfu, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000001ecu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000001f1u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000001f7u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x00000200u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x0000020au, 0x00000007u, 0x0004003bu, 0x00000020u, 0x00000214u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x0000021cu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x00000227u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x0000022du, 0x00000007u, 0x0004003bu, 0x00000020u, 0x00000235u, 0x00000007u, 0x0004003bu,
|
||||
0x00000008u, 0x0000023eu, 0x00000007u, 0x00050041u, 0x00000069u, 0x0000006au, 0x00000066u, 0x00000068u,
|
||||
0x0004003du, 0x0000000du, 0x0000006bu, 0x0000006au, 0x0007000cu, 0x0000000du, 0x0000006du, 0x00000001u,
|
||||
0x00000028u, 0x0000006bu, 0x0000006cu, 0x00050050u, 0x0000000du, 0x0000006eu, 0x00000063u, 0x00000063u,
|
||||
0x00050088u, 0x0000000du, 0x0000006fu, 0x0000006eu, 0x0000006du, 0x0003003eu, 0x00000062u, 0x0000006fu,
|
||||
0x0004003du, 0x0000000du, 0x00000073u, 0x00000072u, 0x0004003du, 0x0000000du, 0x00000074u, 0x00000062u,
|
||||
0x0005008eu, 0x0000000du, 0x00000076u, 0x00000074u, 0x00000075u, 0x0004003du, 0x0000000du, 0x00000077u,
|
||||
0x00000062u, 0x0005008eu, 0x0000000du, 0x00000078u, 0x00000077u, 0x00000075u, 0x00050083u, 0x0000000du,
|
||||
0x00000079u, 0x0000006cu, 0x00000078u, 0x0008000cu, 0x0000000du, 0x0000007au, 0x00000001u, 0x0000002bu,
|
||||
0x00000073u, 0x00000076u, 0x00000079u, 0x0003003eu, 0x00000070u, 0x0000007au, 0x0004003du, 0x00000023u,
|
||||
0x0000007du, 0x00000025u, 0x0004003du, 0x0000000du, 0x0000007eu, 0x00000070u, 0x00050057u, 0x0000002fu,
|
||||
0x0000007fu, 0x0000007du, 0x0000007eu, 0x0003003eu, 0x0000007cu, 0x0000007fu, 0x0004003du, 0x0000002fu,
|
||||
0x00000082u, 0x0000007cu, 0x0008004fu, 0x00000007u, 0x00000083u, 0x00000082u, 0x00000082u, 0x00000000u,
|
||||
0x00000001u, 0x00000002u, 0x0003003eu, 0x00000081u, 0x00000083u, 0x00050039u, 0x00000006u, 0x00000084u,
|
||||
0x0000000bu, 0x00000081u, 0x0003003eu, 0x00000080u, 0x00000084u, 0x0004003du, 0x00000023u, 0x00000086u,
|
||||
0x00000025u, 0x0004003du, 0x0000000du, 0x00000087u, 0x00000070u, 0x00050041u, 0x00000020u, 0x00000088u,
|
||||
0x00000062u, 0x00000029u, 0x0004003du, 0x00000006u, 0x00000089u, 0x00000088u, 0x00050050u, 0x0000000du,
|
||||
0x0000008au, 0x00000089u, 0x0000002cu, 0x00050083u, 0x0000000du, 0x0000008bu, 0x00000087u, 0x0000008au,
|
||||
0x00050057u, 0x0000002fu, 0x0000008cu, 0x00000086u, 0x0000008bu, 0x0008004fu, 0x00000007u, 0x0000008eu,
|
||||
0x0000008cu, 0x0000008cu, 0x00000000u, 0x00000001u, 0x00000002u, 0x0003003eu, 0x0000008du, 0x0000008eu,
|
||||
0x00050039u, 0x00000006u, 0x0000008fu, 0x0000000bu, 0x0000008du, 0x0003003eu, 0x00000085u, 0x0000008fu,
|
||||
0x0004003du, 0x00000023u, 0x00000091u, 0x00000025u, 0x0004003du, 0x0000000du, 0x00000092u, 0x00000070u,
|
||||
0x00050041u, 0x00000020u, 0x00000093u, 0x00000062u, 0x00000029u, 0x0004003du, 0x00000006u, 0x00000094u,
|
||||
0x00000093u, 0x00050050u, 0x0000000du, 0x00000095u, 0x00000094u, 0x0000002cu, 0x00050081u, 0x0000000du,
|
||||
0x00000096u, 0x00000092u, 0x00000095u, 0x00050057u, 0x0000002fu, 0x00000097u, 0x00000091u, 0x00000096u,
|
||||
0x0008004fu, 0x00000007u, 0x00000099u, 0x00000097u, 0x00000097u, 0x00000000u, 0x00000001u, 0x00000002u,
|
||||
0x0003003eu, 0x00000098u, 0x00000099u, 0x00050039u, 0x00000006u, 0x0000009au, 0x0000000bu, 0x00000098u,
|
||||
0x0003003eu, 0x00000090u, 0x0000009au, 0x0004003du, 0x00000023u, 0x0000009cu, 0x00000025u, 0x0004003du,
|
||||
0x0000000du, 0x0000009du, 0x00000070u, 0x00050041u, 0x00000020u, 0x0000009eu, 0x00000062u, 0x00000048u,
|
||||
0x0004003du, 0x00000006u, 0x0000009fu, 0x0000009eu, 0x00050050u, 0x0000000du, 0x000000a0u, 0x0000002cu,
|
||||
0x0000009fu, 0x00050083u, 0x0000000du, 0x000000a1u, 0x0000009du, 0x000000a0u, 0x00050057u, 0x0000002fu,
|
||||
0x000000a2u, 0x0000009cu, 0x000000a1u, 0x0008004fu, 0x00000007u, 0x000000a4u, 0x000000a2u, 0x000000a2u,
|
||||
0x00000000u, 0x00000001u, 0x00000002u, 0x0003003eu, 0x000000a3u, 0x000000a4u, 0x00050039u, 0x00000006u,
|
||||
0x000000a5u, 0x0000000bu, 0x000000a3u, 0x0003003eu, 0x0000009bu, 0x000000a5u, 0x0004003du, 0x00000023u,
|
||||
0x000000a7u, 0x00000025u, 0x0004003du, 0x0000000du, 0x000000a8u, 0x00000070u, 0x00050041u, 0x00000020u,
|
||||
0x000000a9u, 0x00000062u, 0x00000048u, 0x0004003du, 0x00000006u, 0x000000aau, 0x000000a9u, 0x00050050u,
|
||||
0x0000000du, 0x000000abu, 0x0000002cu, 0x000000aau, 0x00050081u, 0x0000000du, 0x000000acu, 0x000000a8u,
|
||||
0x000000abu, 0x00050057u, 0x0000002fu, 0x000000adu, 0x000000a7u, 0x000000acu, 0x0008004fu, 0x00000007u,
|
||||
0x000000afu, 0x000000adu, 0x000000adu, 0x00000000u, 0x00000001u, 0x00000002u, 0x0003003eu, 0x000000aeu,
|
||||
0x000000afu, 0x00050039u, 0x00000006u, 0x000000b0u, 0x0000000bu, 0x000000aeu, 0x0003003eu, 0x000000a6u,
|
||||
0x000000b0u, 0x0004003du, 0x00000006u, 0x000000b2u, 0x00000080u, 0x0004003du, 0x00000006u, 0x000000b3u,
|
||||
0x00000085u, 0x00050083u, 0x00000006u, 0x000000b4u, 0x000000b2u, 0x000000b3u, 0x0006000cu, 0x00000006u,
|
||||
0x000000b5u, 0x00000001u, 0x00000004u, 0x000000b4u, 0x0003003eu, 0x000000b1u, 0x000000b5u, 0x0004003du,
|
||||
0x00000006u, 0x000000b7u, 0x00000080u, 0x0004003du, 0x00000006u, 0x000000b8u, 0x00000090u, 0x00050083u,
|
||||
0x00000006u, 0x000000b9u, 0x000000b7u, 0x000000b8u, 0x0006000cu, 0x00000006u, 0x000000bau, 0x00000001u,
|
||||
0x00000004u, 0x000000b9u, 0x0003003eu, 0x000000b6u, 0x000000bau, 0x0004003du, 0x00000006u, 0x000000bcu,
|
||||
0x00000080u, 0x0004003du, 0x00000006u, 0x000000bdu, 0x0000009bu, 0x00050083u, 0x00000006u, 0x000000beu,
|
||||
0x000000bcu, 0x000000bdu, 0x0006000cu, 0x00000006u, 0x000000bfu, 0x00000001u, 0x00000004u, 0x000000beu,
|
||||
0x0003003eu, 0x000000bbu, 0x000000bfu, 0x0004003du, 0x00000006u, 0x000000c1u, 0x00000080u, 0x0004003du,
|
||||
0x00000006u, 0x000000c2u, 0x000000a6u, 0x00050083u, 0x00000006u, 0x000000c3u, 0x000000c1u, 0x000000c2u,
|
||||
0x0006000cu, 0x00000006u, 0x000000c4u, 0x00000001u, 0x00000004u, 0x000000c3u, 0x0003003eu, 0x000000c0u,
|
||||
0x000000c4u, 0x0004003du, 0x00000006u, 0x000000c6u, 0x00000080u, 0x0004003du, 0x00000006u, 0x000000c7u,
|
||||
0x00000085u, 0x0004003du, 0x00000006u, 0x000000c8u, 0x00000090u, 0x0007000cu, 0x00000006u, 0x000000c9u,
|
||||
0x00000001u, 0x00000025u, 0x000000c7u, 0x000000c8u, 0x0004003du, 0x00000006u, 0x000000cau, 0x0000009bu,
|
||||
0x0004003du, 0x00000006u, 0x000000cbu, 0x000000a6u, 0x0007000cu, 0x00000006u, 0x000000ccu, 0x00000001u,
|
||||
0x00000025u, 0x000000cau, 0x000000cbu, 0x0007000cu, 0x00000006u, 0x000000cdu, 0x00000001u, 0x00000025u,
|
||||
0x000000c9u, 0x000000ccu, 0x0007000cu, 0x00000006u, 0x000000ceu, 0x00000001u, 0x00000025u, 0x000000c6u,
|
||||
0x000000cdu, 0x0003003eu, 0x000000c5u, 0x000000ceu, 0x0004003du, 0x00000006u, 0x000000d0u, 0x00000080u,
|
||||
0x0004003du, 0x00000006u, 0x000000d1u, 0x00000085u, 0x0004003du, 0x00000006u, 0x000000d2u, 0x00000090u,
|
||||
0x0007000cu, 0x00000006u, 0x000000d3u, 0x00000001u, 0x00000028u, 0x000000d1u, 0x000000d2u, 0x0004003du,
|
||||
0x00000006u, 0x000000d4u, 0x0000009bu, 0x0004003du, 0x00000006u, 0x000000d5u, 0x000000a6u, 0x0007000cu,
|
||||
0x00000006u, 0x000000d6u, 0x00000001u, 0x00000028u, 0x000000d4u, 0x000000d5u, 0x0007000cu, 0x00000006u,
|
||||
0x000000d7u, 0x00000001u, 0x00000028u, 0x000000d3u, 0x000000d6u, 0x0007000cu, 0x00000006u, 0x000000d8u,
|
||||
0x00000001u, 0x00000028u, 0x000000d0u, 0x000000d7u, 0x0003003eu, 0x000000cfu, 0x000000d8u, 0x0004003du,
|
||||
0x00000006u, 0x000000dau, 0x000000cfu, 0x0004003du, 0x00000006u, 0x000000dbu, 0x000000c5u, 0x00050083u,
|
||||
0x00000006u, 0x000000dcu, 0x000000dau, 0x000000dbu, 0x0003003eu, 0x000000d9u, 0x000000dcu, 0x0004003du,
|
||||
0x00000006u, 0x000000dfu, 0x000000d9u, 0x00050085u, 0x00000006u, 0x000000e1u, 0x000000dfu, 0x000000e0u,
|
||||
0x0007000cu, 0x00000006u, 0x000000e2u, 0x00000001u, 0x00000028u, 0x000000deu, 0x000000e1u, 0x0003003eu,
|
||||
0x000000ddu, 0x000000e2u, 0x0004003du, 0x00000006u, 0x000000e4u, 0x000000b1u, 0x0004003du, 0x00000006u,
|
||||
0x000000e5u, 0x000000b6u, 0x0007000cu, 0x00000006u, 0x000000e6u, 0x00000001u, 0x00000028u, 0x000000e4u,
|
||||
0x000000e5u, 0x0003003eu, 0x000000e3u, 0x000000e6u, 0x0004003du, 0x00000006u, 0x000000e8u, 0x000000bbu,
|
||||
0x0004003du, 0x00000006u, 0x000000e9u, 0x000000c0u, 0x0007000cu, 0x00000006u, 0x000000eau, 0x00000001u,
|
||||
0x00000028u, 0x000000e8u, 0x000000e9u, 0x0003003eu, 0x000000e7u, 0x000000eau, 0x0004003du, 0x00000006u,
|
||||
0x000000ecu, 0x000000e3u, 0x0004003du, 0x00000006u, 0x000000edu, 0x000000e7u, 0x0007000cu, 0x00000006u,
|
||||
0x000000eeu, 0x00000001u, 0x00000028u, 0x000000ecu, 0x000000edu, 0x0003003eu, 0x000000ebu, 0x000000eeu,
|
||||
0x0004003du, 0x00000006u, 0x000000efu, 0x000000ebu, 0x0004003du, 0x00000006u, 0x000000f0u, 0x000000ddu,
|
||||
0x000500bcu, 0x000000f1u, 0x000000f2u, 0x000000efu, 0x000000f0u, 0x000300f7u, 0x000000f4u, 0x00000000u,
|
||||
0x000400fau, 0x000000f2u, 0x000000f3u, 0x000000f4u, 0x000200f8u, 0x000000f3u, 0x0004003du, 0x0000002fu,
|
||||
0x000000f7u, 0x0000007cu, 0x0003003eu, 0x000000f6u, 0x000000f7u, 0x000100fdu, 0x000200f8u, 0x000000f4u,
|
||||
0x0004003du, 0x00000006u, 0x000000fbu, 0x000000e3u, 0x0004003du, 0x00000006u, 0x000000fcu, 0x000000e7u,
|
||||
0x000500beu, 0x000000f1u, 0x000000fdu, 0x000000fbu, 0x000000fcu, 0x0003003eu, 0x000000fau, 0x000000fdu,
|
||||
0x0004003du, 0x000000f1u, 0x000000ffu, 0x000000fau, 0x000300f7u, 0x00000102u, 0x00000000u, 0x000400fau,
|
||||
0x000000ffu, 0x00000101u, 0x00000106u, 0x000200f8u, 0x00000101u, 0x00050041u, 0x00000020u, 0x00000103u,
|
||||
0x00000062u, 0x00000048u, 0x0004003du, 0x00000006u, 0x00000104u, 0x00000103u, 0x00050050u, 0x0000000du,
|
||||
0x00000105u, 0x0000002cu, 0x00000104u, 0x0003003eu, 0x00000100u, 0x00000105u, 0x000200f9u, 0x00000102u,
|
||||
0x000200f8u, 0x00000106u, 0x00050041u, 0x00000020u, 0x00000107u, 0x00000062u, 0x00000029u, 0x0004003du,
|
||||
0x00000006u, 0x00000108u, 0x00000107u, 0x00050050u, 0x0000000du, 0x00000109u, 0x00000108u, 0x0000002cu,
|
||||
0x0003003eu, 0x00000100u, 0x00000109u, 0x000200f9u, 0x00000102u, 0x000200f8u, 0x00000102u, 0x0004003du,
|
||||
0x0000000du, 0x0000010au, 0x00000100u, 0x0003003eu, 0x000000feu, 0x0000010au, 0x0004003du, 0x000000f1u,
|
||||
0x0000010cu, 0x000000fau, 0x000300f7u, 0x0000010fu, 0x00000000u, 0x000400fau, 0x0000010cu, 0x0000010eu,
|
||||
0x00000116u, 0x000200f8u, 0x0000010eu, 0x0004003du, 0x00000006u, 0x00000110u, 0x000000b1u, 0x0004003du,
|
||||
0x00000006u, 0x00000111u, 0x000000b6u, 0x000500beu, 0x000000f1u, 0x00000112u, 0x00000110u, 0x00000111u,
|
||||
0x000600a9u, 0x00000006u, 0x00000114u, 0x00000112u, 0x00000113u, 0x00000063u, 0x00050050u, 0x0000000du,
|
||||
0x00000115u, 0x00000114u, 0x0000002cu, 0x0003003eu, 0x0000010du, 0x00000115u, 0x000200f9u, 0x0000010fu,
|
||||
0x000200f8u, 0x00000116u, 0x0004003du, 0x00000006u, 0x00000117u, 0x000000bbu, 0x0004003du, 0x00000006u,
|
||||
0x00000118u, 0x000000c0u, 0x000500beu, 0x000000f1u, 0x00000119u, 0x00000117u, 0x00000118u, 0x000600a9u,
|
||||
0x00000006u, 0x0000011au, 0x00000119u, 0x00000113u, 0x00000063u, 0x00050050u, 0x0000000du, 0x0000011bu,
|
||||
0x0000002cu, 0x0000011au, 0x0003003eu, 0x0000010du, 0x0000011bu, 0x000200f9u, 0x0000010fu, 0x000200f8u,
|
||||
0x0000010fu, 0x0004003du, 0x0000000du, 0x0000011cu, 0x0000010du, 0x0003003eu, 0x0000010bu, 0x0000011cu,
|
||||
0x0003003eu, 0x0000011du, 0x0000002cu, 0x0003003eu, 0x0000011eu, 0x0000002cu, 0x0003003eu, 0x00000120u,
|
||||
0x00000068u, 0x000200f9u, 0x00000121u, 0x000200f8u, 0x00000121u, 0x000400f6u, 0x00000123u, 0x00000124u,
|
||||
0x00000000u, 0x000200f9u, 0x00000125u, 0x000200f8u, 0x00000125u, 0x0004003du, 0x00000067u, 0x00000126u,
|
||||
0x00000120u, 0x000500b3u, 0x000000f1u, 0x00000128u, 0x00000126u, 0x00000127u, 0x000400fau, 0x00000128u,
|
||||
0x00000122u, 0x00000123u, 0x000200f8u, 0x00000122u, 0x0004003du, 0x0000000du, 0x0000012au, 0x000000feu,
|
||||
0x0004003du, 0x00000067u, 0x0000012bu, 0x00000120u, 0x0004006fu, 0x00000006u, 0x0000012cu, 0x0000012bu,
|
||||
0x0005008eu, 0x0000000du, 0x0000012du, 0x0000012au, 0x0000012cu, 0x0003003eu, 0x00000129u, 0x0000012du,
|
||||
0x0004003du, 0x000000f1u, 0x0000012fu, 0x000000fau, 0x000300f7u, 0x00000132u, 0x00000000u, 0x000400fau,
|
||||
0x0000012fu, 0x00000131u, 0x0000013au, 0x000200f8u, 0x00000131u, 0x0004003du, 0x0000000du, 0x00000133u,
|
||||
0x00000070u, 0x0004003du, 0x0000000du, 0x00000134u, 0x00000129u, 0x00050083u, 0x0000000du, 0x00000135u,
|
||||
0x00000133u, 0x00000134u, 0x0003003eu, 0x00000136u, 0x00000135u, 0x0004003du, 0x0000000du, 0x00000138u,
|
||||
0x00000062u, 0x0003003eu, 0x00000137u, 0x00000138u, 0x00060039u, 0x00000006u, 0x00000139u, 0x00000012u,
|
||||
0x00000136u, 0x00000137u, 0x0003003eu, 0x00000130u, 0x00000139u, 0x000200f9u, 0x00000132u, 0x000200f8u,
|
||||
0x0000013au, 0x0004003du, 0x0000000du, 0x0000013bu, 0x00000070u, 0x0004003du, 0x0000000du, 0x0000013cu,
|
||||
0x00000129u, 0x00050083u, 0x0000000du, 0x0000013du, 0x0000013bu, 0x0000013cu, 0x0003003eu, 0x0000013eu,
|
||||
0x0000013du, 0x0004003du, 0x0000000du, 0x00000140u, 0x00000062u, 0x0003003eu, 0x0000013fu, 0x00000140u,
|
||||
0x00060039u, 0x00000006u, 0x00000141u, 0x00000016u, 0x0000013eu, 0x0000013fu, 0x0003003eu, 0x00000130u,
|
||||
0x00000141u, 0x000200f9u, 0x00000132u, 0x000200f8u, 0x00000132u, 0x0004003du, 0x00000006u, 0x00000142u,
|
||||
0x00000130u, 0x0003003eu, 0x0000012eu, 0x00000142u, 0x0004003du, 0x000000f1u, 0x00000144u, 0x000000fau,
|
||||
0x000300f7u, 0x00000147u, 0x00000000u, 0x000400fau, 0x00000144u, 0x00000146u, 0x0000014fu, 0x000200f8u,
|
||||
0x00000146u, 0x0004003du, 0x0000000du, 0x00000148u, 0x00000070u, 0x0004003du, 0x0000000du, 0x00000149u,
|
||||
0x00000129u, 0x00050081u, 0x0000000du, 0x0000014au, 0x00000148u, 0x00000149u, 0x0003003eu, 0x0000014bu,
|
||||
0x0000014au, 0x0004003du, 0x0000000du, 0x0000014du, 0x00000062u, 0x0003003eu, 0x0000014cu, 0x0000014du,
|
||||
0x00060039u, 0x00000006u, 0x0000014eu, 0x00000012u, 0x0000014bu, 0x0000014cu, 0x0003003eu, 0x00000145u,
|
||||
0x0000014eu, 0x000200f9u, 0x00000147u, 0x000200f8u, 0x0000014fu, 0x0004003du, 0x0000000du, 0x00000150u,
|
||||
0x00000070u, 0x0004003du, 0x0000000du, 0x00000151u, 0x00000129u, 0x00050081u, 0x0000000du, 0x00000152u,
|
||||
0x00000150u, 0x00000151u, 0x0003003eu, 0x00000153u, 0x00000152u, 0x0004003du, 0x0000000du, 0x00000155u,
|
||||
0x00000062u, 0x0003003eu, 0x00000154u, 0x00000155u, 0x00060039u, 0x00000006u, 0x00000156u, 0x00000016u,
|
||||
0x00000153u, 0x00000154u, 0x0003003eu, 0x00000145u, 0x00000156u, 0x000200f9u, 0x00000147u, 0x000200f8u,
|
||||
0x00000147u, 0x0004003du, 0x00000006u, 0x00000157u, 0x00000145u, 0x0003003eu, 0x00000143u, 0x00000157u,
|
||||
0x0004003du, 0x00000006u, 0x00000158u, 0x0000011du, 0x0004003du, 0x00000067u, 0x00000159u, 0x00000120u,
|
||||
0x00050082u, 0x00000067u, 0x0000015au, 0x00000159u, 0x00000068u, 0x0004006fu, 0x00000006u, 0x0000015bu,
|
||||
0x0000015au, 0x000500b4u, 0x000000f1u, 0x0000015cu, 0x00000158u, 0x0000015bu, 0x000300f7u, 0x0000015eu,
|
||||
0x00000000u, 0x000400fau, 0x0000015cu, 0x0000015du, 0x0000015eu, 0x000200f8u, 0x0000015du, 0x0004003du,
|
||||
0x00000006u, 0x0000015fu, 0x0000012eu, 0x0004003du, 0x00000006u, 0x00000160u, 0x000000ddu, 0x00050085u,
|
||||
0x00000006u, 0x00000162u, 0x00000160u, 0x00000161u, 0x000500bau, 0x000000f1u, 0x00000163u, 0x0000015fu,
|
||||
0x00000162u, 0x000200f9u, 0x0000015eu, 0x000200f8u, 0x0000015eu, 0x000700f5u, 0x000000f1u, 0x00000164u,
|
||||
0x0000015cu, 0x00000147u, 0x00000163u, 0x0000015du, 0x000300f7u, 0x00000166u, 0x00000000u, 0x000400fau,
|
||||
0x00000164u, 0x00000165u, 0x00000166u, 0x000200f8u, 0x00000165u, 0x0004003du, 0x00000067u, 0x00000167u,
|
||||
0x00000120u, 0x0004006fu, 0x00000006u, 0x00000168u, 0x00000167u, 0x0003003eu, 0x0000011du, 0x00000168u,
|
||||
0x000200f9u, 0x00000166u, 0x000200f8u, 0x00000166u, 0x0004003du, 0x00000006u, 0x00000169u, 0x0000011eu,
|
||||
0x0004003du, 0x00000067u, 0x0000016au, 0x00000120u, 0x00050082u, 0x00000067u, 0x0000016bu, 0x0000016au,
|
||||
0x00000068u, 0x0004006fu, 0x00000006u, 0x0000016cu, 0x0000016bu, 0x000500b4u, 0x000000f1u, 0x0000016du,
|
||||
0x00000169u, 0x0000016cu, 0x000300f7u, 0x0000016fu, 0x00000000u, 0x000400fau, 0x0000016du, 0x0000016eu,
|
||||
0x0000016fu, 0x000200f8u, 0x0000016eu, 0x0004003du, 0x00000006u, 0x00000170u, 0x00000143u, 0x0004003du,
|
||||
0x00000006u, 0x00000171u, 0x000000ddu, 0x00050085u, 0x00000006u, 0x00000172u, 0x00000171u, 0x00000161u,
|
||||
0x000500bau, 0x000000f1u, 0x00000173u, 0x00000170u, 0x00000172u, 0x000200f9u, 0x0000016fu, 0x000200f8u,
|
||||
0x0000016fu, 0x000700f5u, 0x000000f1u, 0x00000174u, 0x0000016du, 0x00000166u, 0x00000173u, 0x0000016eu,
|
||||
0x000300f7u, 0x00000176u, 0x00000000u, 0x000400fau, 0x00000174u, 0x00000175u, 0x00000176u, 0x000200f8u,
|
||||
0x00000175u, 0x0004003du, 0x00000067u, 0x00000177u, 0x00000120u, 0x0004006fu, 0x00000006u, 0x00000178u,
|
||||
0x00000177u, 0x0003003eu, 0x0000011eu, 0x00000178u, 0x000200f9u, 0x00000176u, 0x000200f8u, 0x00000176u,
|
||||
0x000200f9u, 0x00000124u, 0x000200f8u, 0x00000124u, 0x0004003du, 0x00000067u, 0x00000179u, 0x00000120u,
|
||||
0x00050080u, 0x00000067u, 0x0000017au, 0x00000179u, 0x00000068u, 0x0003003eu, 0x00000120u, 0x0000017au,
|
||||
0x000200f9u, 0x00000121u, 0x000200f8u, 0x00000123u, 0x0004003du, 0x00000006u, 0x0000017cu, 0x0000011du,
|
||||
0x0004003du, 0x00000006u, 0x0000017du, 0x0000011eu, 0x00050081u, 0x00000006u, 0x0000017eu, 0x0000017cu,
|
||||
0x0000017du, 0x0003003eu, 0x0000017bu, 0x0000017eu, 0x0004003du, 0x00000006u, 0x00000180u, 0x000000ddu,
|
||||
0x0004003du, 0x00000006u, 0x00000181u, 0x000000ddu, 0x00050085u, 0x00000006u, 0x00000183u, 0x00000181u,
|
||||
0x00000182u, 0x0004003du, 0x00000006u, 0x00000184u, 0x000000ebu, 0x0008000cu, 0x00000006u, 0x00000185u,
|
||||
0x00000001u, 0x00000031u, 0x00000180u, 0x00000183u, 0x00000184u, 0x0003003eu, 0x0000017fu, 0x00000185u,
|
||||
0x0004003du, 0x00000023u, 0x00000187u, 0x00000025u, 0x0004003du, 0x0000000du, 0x00000188u, 0x00000070u,
|
||||
0x00050041u, 0x00000020u, 0x00000189u, 0x00000062u, 0x00000029u, 0x0004003du, 0x00000006u, 0x0000018au,
|
||||
0x00000189u, 0x0004007fu, 0x00000006u, 0x0000018bu, 0x0000018au, 0x00050041u, 0x00000020u, 0x0000018cu,
|
||||
0x00000062u, 0x00000048u, 0x0004003du, 0x00000006u, 0x0000018du, 0x0000018cu, 0x0004007fu, 0x00000006u,
|
||||
0x0000018eu, 0x0000018du, 0x00050050u, 0x0000000du, 0x0000018fu, 0x0000018bu, 0x0000018eu, 0x00050081u,
|
||||
0x0000000du, 0x00000190u, 0x00000188u, 0x0000018fu, 0x00050057u, 0x0000002fu, 0x00000191u, 0x00000187u,
|
||||
0x00000190u, 0x0008004fu, 0x00000007u, 0x00000193u, 0x00000191u, 0x00000191u, 0x00000000u, 0x00000001u,
|
||||
0x00000002u, 0x0003003eu, 0x00000192u, 0x00000193u, 0x00050039u, 0x00000006u, 0x00000194u, 0x0000000bu,
|
||||
0x00000192u, 0x0003003eu, 0x00000186u, 0x00000194u, 0x0004003du, 0x00000023u, 0x00000196u, 0x00000025u,
|
||||
0x0004003du, 0x0000000du, 0x00000197u, 0x00000070u, 0x00050041u, 0x00000020u, 0x00000198u, 0x00000062u,
|
||||
0x00000029u, 0x0004003du, 0x00000006u, 0x00000199u, 0x00000198u, 0x00050041u, 0x00000020u, 0x0000019au,
|
||||
0x00000062u, 0x00000048u, 0x0004003du, 0x00000006u, 0x0000019bu, 0x0000019au, 0x0004007fu, 0x00000006u,
|
||||
0x0000019cu, 0x0000019bu, 0x00050050u, 0x0000000du, 0x0000019du, 0x00000199u, 0x0000019cu, 0x00050081u,
|
||||
0x0000000du, 0x0000019eu, 0x00000197u, 0x0000019du, 0x00050057u, 0x0000002fu, 0x0000019fu, 0x00000196u,
|
||||
0x0000019eu, 0x0008004fu, 0x00000007u, 0x000001a1u, 0x0000019fu, 0x0000019fu, 0x00000000u, 0x00000001u,
|
||||
0x00000002u, 0x0003003eu, 0x000001a0u, 0x000001a1u, 0x00050039u, 0x00000006u, 0x000001a2u, 0x0000000bu,
|
||||
0x000001a0u, 0x0003003eu, 0x00000195u, 0x000001a2u, 0x0004003du, 0x00000023u, 0x000001a4u, 0x00000025u,
|
||||
0x0004003du, 0x0000000du, 0x000001a5u, 0x00000070u, 0x00050041u, 0x00000020u, 0x000001a6u, 0x00000062u,
|
||||
0x00000029u, 0x0004003du, 0x00000006u, 0x000001a7u, 0x000001a6u, 0x0004007fu, 0x00000006u, 0x000001a8u,
|
||||
0x000001a7u, 0x00050041u, 0x00000020u, 0x000001a9u, 0x00000062u, 0x00000048u, 0x0004003du, 0x00000006u,
|
||||
0x000001aau, 0x000001a9u, 0x00050050u, 0x0000000du, 0x000001abu, 0x000001a8u, 0x000001aau, 0x00050081u,
|
||||
0x0000000du, 0x000001acu, 0x000001a5u, 0x000001abu, 0x00050057u, 0x0000002fu, 0x000001adu, 0x000001a4u,
|
||||
0x000001acu, 0x0008004fu, 0x00000007u, 0x000001afu, 0x000001adu, 0x000001adu, 0x00000000u, 0x00000001u,
|
||||
0x00000002u, 0x0003003eu, 0x000001aeu, 0x000001afu, 0x00050039u, 0x00000006u, 0x000001b0u, 0x0000000bu,
|
||||
0x000001aeu, 0x0003003eu, 0x000001a3u, 0x000001b0u, 0x0004003du, 0x00000023u, 0x000001b2u, 0x00000025u,
|
||||
0x0004003du, 0x0000000du, 0x000001b3u, 0x00000070u, 0x00050041u, 0x00000020u, 0x000001b4u, 0x00000062u,
|
||||
0x00000029u, 0x0004003du, 0x00000006u, 0x000001b5u, 0x000001b4u, 0x00050041u, 0x00000020u, 0x000001b6u,
|
||||
0x00000062u, 0x00000048u, 0x0004003du, 0x00000006u, 0x000001b7u, 0x000001b6u, 0x00050050u, 0x0000000du,
|
||||
0x000001b8u, 0x000001b5u, 0x000001b7u, 0x00050081u, 0x0000000du, 0x000001b9u, 0x000001b3u, 0x000001b8u,
|
||||
0x00050057u, 0x0000002fu, 0x000001bau, 0x000001b2u, 0x000001b9u, 0x0008004fu, 0x00000007u, 0x000001bcu,
|
||||
0x000001bau, 0x000001bau, 0x00000000u, 0x00000001u, 0x00000002u, 0x0003003eu, 0x000001bbu, 0x000001bcu,
|
||||
0x00050039u, 0x00000006u, 0x000001bdu, 0x0000000bu, 0x000001bbu, 0x0003003eu, 0x000001b1u, 0x000001bdu,
|
||||
0x0004003du, 0x00000006u, 0x000001bfu, 0x0000011du, 0x0004003du, 0x00000006u, 0x000001c0u, 0x0000011eu,
|
||||
0x00050083u, 0x00000006u, 0x000001c1u, 0x000001bfu, 0x000001c0u, 0x0006000cu, 0x00000006u, 0x000001c2u,
|
||||
0x00000001u, 0x00000004u, 0x000001c1u, 0x0004003du, 0x00000006u, 0x000001c3u, 0x0000017bu, 0x0007000cu,
|
||||
0x00000006u, 0x000001c4u, 0x00000001u, 0x00000028u, 0x000001c3u, 0x00000063u, 0x00050088u, 0x00000006u,
|
||||
0x000001c5u, 0x000001c2u, 0x000001c4u, 0x0008000cu, 0x00000006u, 0x000001c6u, 0x00000001u, 0x0000002bu,
|
||||
0x000001c5u, 0x0000002cu, 0x00000063u, 0x0003003eu, 0x000001beu, 0x000001c6u, 0x0004003du, 0x00000006u,
|
||||
0x000001c8u, 0x000001beu, 0x0004003du, 0x00000006u, 0x000001c9u, 0x0000017bu, 0x00050085u, 0x00000006u,
|
||||
0x000001cbu, 0x000001c9u, 0x000001cau, 0x00050081u, 0x00000006u, 0x000001ccu, 0x00000063u, 0x000001cbu,
|
||||
0x00050088u, 0x00000006u, 0x000001cdu, 0x000001c8u, 0x000001ccu, 0x0003003eu, 0x000001c7u, 0x000001cdu,
|
||||
0x0004003du, 0x000000f1u, 0x000001cfu, 0x000000fau, 0x000300f7u, 0x000001d2u, 0x00000000u, 0x000400fau,
|
||||
0x000001cfu, 0x000001d1u, 0x000001d7u, 0x000200f8u, 0x000001d1u, 0x0004003du, 0x00000006u, 0x000001d3u,
|
||||
0x00000186u, 0x0004003du, 0x00000006u, 0x000001d4u, 0x00000195u, 0x00050083u, 0x00000006u, 0x000001d5u,
|
||||
0x000001d3u, 0x000001d4u, 0x0006000cu, 0x00000006u, 0x000001d6u, 0x00000001u, 0x00000004u, 0x000001d5u,
|
||||
0x0003003eu, 0x000001d0u, 0x000001d6u, 0x000200f9u, 0x000001d2u, 0x000200f8u, 0x000001d7u, 0x0004003du,
|
||||
0x00000006u, 0x000001d8u, 0x00000186u, 0x0004003du, 0x00000006u, 0x000001d9u, 0x000001a3u, 0x00050083u,
|
||||
0x00000006u, 0x000001dau, 0x000001d8u, 0x000001d9u, 0x0006000cu, 0x00000006u, 0x000001dbu, 0x00000001u,
|
||||
0x00000004u, 0x000001dau, 0x0003003eu, 0x000001d0u, 0x000001dbu, 0x000200f9u, 0x000001d2u, 0x000200f8u,
|
||||
0x000001d2u, 0x0004003du, 0x00000006u, 0x000001dcu, 0x000001d0u, 0x0003003eu, 0x000001ceu, 0x000001dcu,
|
||||
0x0004003du, 0x000000f1u, 0x000001deu, 0x000000fau, 0x000300f7u, 0x000001e1u, 0x00000000u, 0x000400fau,
|
||||
0x000001deu, 0x000001e0u, 0x000001e6u, 0x000200f8u, 0x000001e0u, 0x0004003du, 0x00000006u, 0x000001e2u,
|
||||
0x000001a3u, 0x0004003du, 0x00000006u, 0x000001e3u, 0x000001b1u, 0x00050083u, 0x00000006u, 0x000001e4u,
|
||||
0x000001e2u, 0x000001e3u, 0x0006000cu, 0x00000006u, 0x000001e5u, 0x00000001u, 0x00000004u, 0x000001e4u,
|
||||
0x0003003eu, 0x000001dfu, 0x000001e5u, 0x000200f9u, 0x000001e1u, 0x000200f8u, 0x000001e6u, 0x0004003du,
|
||||
0x00000006u, 0x000001e7u, 0x00000195u, 0x0004003du, 0x00000006u, 0x000001e8u, 0x000001b1u, 0x00050083u,
|
||||
0x00000006u, 0x000001e9u, 0x000001e7u, 0x000001e8u, 0x0006000cu, 0x00000006u, 0x000001eau, 0x00000001u,
|
||||
0x00000004u, 0x000001e9u, 0x0003003eu, 0x000001dfu, 0x000001eau, 0x000200f9u, 0x000001e1u, 0x000200f8u,
|
||||
0x000001e1u, 0x0004003du, 0x00000006u, 0x000001ebu, 0x000001dfu, 0x0003003eu, 0x000001ddu, 0x000001ebu,
|
||||
0x0004003du, 0x00000006u, 0x000001edu, 0x000001ceu, 0x0004003du, 0x00000006u, 0x000001eeu, 0x000001ddu,
|
||||
0x00050083u, 0x00000006u, 0x000001efu, 0x000001edu, 0x000001eeu, 0x0006000cu, 0x00000006u, 0x000001f0u,
|
||||
0x00000001u, 0x00000004u, 0x000001efu, 0x0003003eu, 0x000001ecu, 0x000001f0u, 0x0004003du, 0x00000006u,
|
||||
0x000001f2u, 0x000000ddu, 0x0004003du, 0x00000006u, 0x000001f3u, 0x000000ddu, 0x00050085u, 0x00000006u,
|
||||
0x000001f4u, 0x000001f3u, 0x00000182u, 0x0004003du, 0x00000006u, 0x000001f5u, 0x000001ecu, 0x0008000cu,
|
||||
0x00000006u, 0x000001f6u, 0x00000001u, 0x00000031u, 0x000001f2u, 0x000001f4u, 0x000001f5u, 0x0003003eu,
|
||||
0x000001f1u, 0x000001f6u, 0x0004003du, 0x00000006u, 0x000001f9u, 0x000001f1u, 0x00050085u, 0x00000006u,
|
||||
0x000001fau, 0x000001f8u, 0x000001f9u, 0x0004003du, 0x00000006u, 0x000001fbu, 0x0000017bu, 0x00050088u,
|
||||
0x00000006u, 0x000001fdu, 0x000001fbu, 0x000001fcu, 0x0008000cu, 0x00000006u, 0x000001feu, 0x00000001u,
|
||||
0x0000002bu, 0x000001fdu, 0x0000002cu, 0x00000063u, 0x00050085u, 0x00000006u, 0x000001ffu, 0x000001fau,
|
||||
0x000001feu, 0x0003003eu, 0x000001f7u, 0x000001ffu, 0x0004003du, 0x00000006u, 0x00000201u, 0x00000186u,
|
||||
0x0004003du, 0x00000006u, 0x00000202u, 0x000001b1u, 0x00050083u, 0x00000006u, 0x00000203u, 0x00000201u,
|
||||
0x00000202u, 0x0006000cu, 0x00000006u, 0x00000204u, 0x00000001u, 0x00000004u, 0x00000203u, 0x0004003du,
|
||||
0x00000006u, 0x00000205u, 0x00000195u, 0x0004003du, 0x00000006u, 0x00000206u, 0x000001a3u, 0x00050083u,
|
||||
0x00000006u, 0x00000207u, 0x00000205u, 0x00000206u, 0x0006000cu, 0x00000006u, 0x00000208u, 0x00000001u,
|
||||
0x00000004u, 0x00000207u, 0x0007000cu, 0x00000006u, 0x00000209u, 0x00000001u, 0x00000028u, 0x00000204u,
|
||||
0x00000208u, 0x0003003eu, 0x00000200u, 0x00000209u, 0x0004003du, 0x00000006u, 0x0000020cu, 0x000000ddu,
|
||||
0x0004003du, 0x00000006u, 0x0000020du, 0x000000ddu, 0x00050085u, 0x00000006u, 0x0000020fu, 0x0000020du,
|
||||
0x0000020eu, 0x0004003du, 0x00000006u, 0x00000210u, 0x00000200u, 0x0008000cu, 0x00000006u, 0x00000211u,
|
||||
0x00000001u, 0x00000031u, 0x0000020cu, 0x0000020fu, 0x00000210u, 0x00050085u, 0x00000006u, 0x00000212u,
|
||||
0x0000020bu, 0x00000211u, 0x00050083u, 0x00000006u, 0x00000213u, 0x00000063u, 0x00000212u, 0x0003003eu,
|
||||
0x0000020au, 0x00000213u, 0x0004003du, 0x00000006u, 0x00000215u, 0x000001f7u, 0x0004003du, 0x00000006u,
|
||||
0x00000216u, 0x000001c7u, 0x00050085u, 0x00000006u, 0x00000217u, 0x00000215u, 0x00000216u, 0x0004003du,
|
||||
0x00000006u, 0x00000218u, 0x0000017fu, 0x00050085u, 0x00000006u, 0x00000219u, 0x00000217u, 0x00000218u,
|
||||
0x0004003du, 0x00000006u, 0x0000021au, 0x0000020au, 0x00050085u, 0x00000006u, 0x0000021bu, 0x00000219u,
|
||||
0x0000021au, 0x0003003eu, 0x00000214u, 0x0000021bu, 0x0004003du, 0x00000006u, 0x0000021du, 0x00000186u,
|
||||
0x0004003du, 0x00000006u, 0x0000021eu, 0x000001b1u, 0x00050083u, 0x00000006u, 0x0000021fu, 0x0000021du,
|
||||
0x0000021eu, 0x0006000cu, 0x00000006u, 0x00000220u, 0x00000001u, 0x00000004u, 0x0000021fu, 0x0004003du,
|
||||
0x00000006u, 0x00000221u, 0x00000195u, 0x0004003du, 0x00000006u, 0x00000222u, 0x000001a3u, 0x00050083u,
|
||||
0x00000006u, 0x00000223u, 0x00000221u, 0x00000222u, 0x0006000cu, 0x00000006u, 0x00000224u, 0x00000001u,
|
||||
0x00000004u, 0x00000223u, 0x00050083u, 0x00000006u, 0x00000225u, 0x00000220u, 0x00000224u, 0x0006000cu,
|
||||
0x00000006u, 0x00000226u, 0x00000001u, 0x00000004u, 0x00000225u, 0x0003003eu, 0x0000021cu, 0x00000226u,
|
||||
0x0004003du, 0x00000006u, 0x00000228u, 0x000000ddu, 0x0004003du, 0x00000006u, 0x00000229u, 0x000000ddu,
|
||||
0x00050085u, 0x00000006u, 0x0000022au, 0x00000229u, 0x00000182u, 0x0004003du, 0x00000006u, 0x0000022bu,
|
||||
0x0000021cu, 0x0008000cu, 0x00000006u, 0x0000022cu, 0x00000001u, 0x00000031u, 0x00000228u, 0x0000022au,
|
||||
0x0000022bu, 0x0003003eu, 0x00000227u, 0x0000022cu, 0x0004003du, 0x00000006u, 0x0000022fu, 0x00000227u,
|
||||
0x00050085u, 0x00000006u, 0x00000230u, 0x0000022eu, 0x0000022fu, 0x0004003du, 0x00000006u, 0x00000231u,
|
||||
0x0000017fu, 0x00050085u, 0x00000006u, 0x00000232u, 0x00000230u, 0x00000231u, 0x0004003du, 0x00000006u,
|
||||
0x00000233u, 0x0000020au, 0x00050085u, 0x00000006u, 0x00000234u, 0x00000232u, 0x00000233u, 0x0003003eu,
|
||||
0x0000022du, 0x00000234u, 0x0004003du, 0x00000006u, 0x00000236u, 0x00000214u, 0x000500bcu, 0x000000f1u,
|
||||
0x00000238u, 0x00000236u, 0x00000237u, 0x0004003du, 0x00000006u, 0x00000239u, 0x0000022du, 0x0004003du,
|
||||
0x00000006u, 0x0000023au, 0x00000214u, 0x000600a9u, 0x00000006u, 0x0000023bu, 0x00000238u, 0x00000239u,
|
||||
0x0000023au, 0x0008000cu, 0x00000006u, 0x0000023du, 0x00000001u, 0x0000002bu, 0x0000023bu, 0x0000002cu,
|
||||
0x0000023cu, 0x0003003eu, 0x00000235u, 0x0000023du, 0x0004003du, 0x00000023u, 0x0000023fu, 0x00000025u,
|
||||
0x0004003du, 0x0000000du, 0x00000240u, 0x00000070u, 0x0004003du, 0x0000000du, 0x00000241u, 0x0000010bu,
|
||||
0x0004003du, 0x0000000du, 0x00000242u, 0x00000062u, 0x00050085u, 0x0000000du, 0x00000243u, 0x00000241u,
|
||||
0x00000242u, 0x00050081u, 0x0000000du, 0x00000244u, 0x00000240u, 0x00000243u, 0x00050057u, 0x0000002fu,
|
||||
0x00000245u, 0x0000023fu, 0x00000244u, 0x0008004fu, 0x00000007u, 0x00000246u, 0x00000245u, 0x00000245u,
|
||||
0x00000000u, 0x00000001u, 0x00000002u, 0x0003003eu, 0x0000023eu, 0x00000246u, 0x0004003du, 0x0000002fu,
|
||||
0x00000247u, 0x0000007cu, 0x0008004fu, 0x00000007u, 0x00000248u, 0x00000247u, 0x00000247u, 0x00000000u,
|
||||
0x00000001u, 0x00000002u, 0x0004003du, 0x00000007u, 0x00000249u, 0x0000023eu, 0x0004003du, 0x00000006u,
|
||||
0x0000024au, 0x00000235u, 0x00060050u, 0x00000007u, 0x0000024bu, 0x0000024au, 0x0000024au, 0x0000024au,
|
||||
0x0008000cu, 0x00000007u, 0x0000024cu, 0x00000001u, 0x0000002eu, 0x00000248u, 0x00000249u, 0x0000024bu,
|
||||
0x00050041u, 0x00000020u, 0x0000024eu, 0x0000007cu, 0x0000024du, 0x0004003du, 0x00000006u, 0x0000024fu,
|
||||
0x0000024eu, 0x00050051u, 0x00000006u, 0x00000250u, 0x0000024cu, 0x00000000u, 0x00050051u, 0x00000006u,
|
||||
0x00000251u, 0x0000024cu, 0x00000001u, 0x00050051u, 0x00000006u, 0x00000252u, 0x0000024cu, 0x00000002u,
|
||||
0x00070050u, 0x0000002fu, 0x00000253u, 0x00000250u, 0x00000251u, 0x00000252u, 0x0000024fu, 0x0003003eu,
|
||||
0x000000f6u, 0x00000253u, 0x000100fdu, 0x00010038u, 0x00050036u, 0x00000006u, 0x0000000bu, 0x00000000u,
|
||||
0x00000009u, 0x00030037u, 0x00000008u, 0x0000000au, 0x000200f8u, 0x0000000cu, 0x0004003du, 0x00000007u,
|
||||
0x00000018u, 0x0000000au, 0x00050094u, 0x00000006u, 0x0000001du, 0x00000018u, 0x0000001cu, 0x000200feu,
|
||||
0x0000001du, 0x00010038u, 0x00050036u, 0x00000006u, 0x00000012u, 0x00000000u, 0x0000000fu, 0x00030037u,
|
||||
0x0000000eu, 0x00000010u, 0x00030037u, 0x0000000eu, 0x00000011u, 0x000200f8u, 0x00000013u, 0x0004003bu,
|
||||
0x00000020u, 0x00000021u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x00000031u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x00000034u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x0000003cu, 0x00000007u, 0x0004003du,
|
||||
0x00000023u, 0x00000026u, 0x00000025u, 0x0004003du, 0x0000000du, 0x00000027u, 0x00000010u, 0x00050041u,
|
||||
0x00000020u, 0x0000002au, 0x00000011u, 0x00000029u, 0x0004003du, 0x00000006u, 0x0000002bu, 0x0000002au,
|
||||
0x00050050u, 0x0000000du, 0x0000002du, 0x0000002bu, 0x0000002cu, 0x00050083u, 0x0000000du, 0x0000002eu,
|
||||
0x00000027u, 0x0000002du, 0x00050057u, 0x0000002fu, 0x00000030u, 0x00000026u, 0x0000002eu, 0x0008004fu,
|
||||
0x00000007u, 0x00000032u, 0x00000030u, 0x00000030u, 0x00000000u, 0x00000001u, 0x00000002u, 0x0003003eu,
|
||||
0x00000031u, 0x00000032u, 0x00050039u, 0x00000006u, 0x00000033u, 0x0000000bu, 0x00000031u, 0x0003003eu,
|
||||
0x00000021u, 0x00000033u, 0x0004003du, 0x00000023u, 0x00000035u, 0x00000025u, 0x0004003du, 0x0000000du,
|
||||
0x00000036u, 0x00000010u, 0x00050041u, 0x00000020u, 0x00000037u, 0x00000011u, 0x00000029u, 0x0004003du,
|
||||
0x00000006u, 0x00000038u, 0x00000037u, 0x00050050u, 0x0000000du, 0x00000039u, 0x00000038u, 0x0000002cu,
|
||||
0x00050081u, 0x0000000du, 0x0000003au, 0x00000036u, 0x00000039u, 0x00050057u, 0x0000002fu, 0x0000003bu,
|
||||
0x00000035u, 0x0000003au, 0x0008004fu, 0x00000007u, 0x0000003du, 0x0000003bu, 0x0000003bu, 0x00000000u,
|
||||
0x00000001u, 0x00000002u, 0x0003003eu, 0x0000003cu, 0x0000003du, 0x00050039u, 0x00000006u, 0x0000003eu,
|
||||
0x0000000bu, 0x0000003cu, 0x0003003eu, 0x00000034u, 0x0000003eu, 0x0004003du, 0x00000006u, 0x0000003fu,
|
||||
0x00000021u, 0x0004003du, 0x00000006u, 0x00000040u, 0x00000034u, 0x00050083u, 0x00000006u, 0x00000041u,
|
||||
0x0000003fu, 0x00000040u, 0x0006000cu, 0x00000006u, 0x00000042u, 0x00000001u, 0x00000004u, 0x00000041u,
|
||||
0x000200feu, 0x00000042u, 0x00010038u, 0x00050036u, 0x00000006u, 0x00000016u, 0x00000000u, 0x0000000fu,
|
||||
0x00030037u, 0x0000000eu, 0x00000014u, 0x00030037u, 0x0000000eu, 0x00000015u, 0x000200f8u, 0x00000017u,
|
||||
0x0004003bu, 0x00000020u, 0x00000045u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x0000004eu, 0x00000007u,
|
||||
0x0004003bu, 0x00000020u, 0x00000051u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x00000059u, 0x00000007u,
|
||||
0x0004003du, 0x00000023u, 0x00000046u, 0x00000025u, 0x0004003du, 0x0000000du, 0x00000047u, 0x00000014u,
|
||||
0x00050041u, 0x00000020u, 0x00000049u, 0x00000015u, 0x00000048u, 0x0004003du, 0x00000006u, 0x0000004au,
|
||||
0x00000049u, 0x00050050u, 0x0000000du, 0x0000004bu, 0x0000002cu, 0x0000004au, 0x00050083u, 0x0000000du,
|
||||
0x0000004cu, 0x00000047u, 0x0000004bu, 0x00050057u, 0x0000002fu, 0x0000004du, 0x00000046u, 0x0000004cu,
|
||||
0x0008004fu, 0x00000007u, 0x0000004fu, 0x0000004du, 0x0000004du, 0x00000000u, 0x00000001u, 0x00000002u,
|
||||
0x0003003eu, 0x0000004eu, 0x0000004fu, 0x00050039u, 0x00000006u, 0x00000050u, 0x0000000bu, 0x0000004eu,
|
||||
0x0003003eu, 0x00000045u, 0x00000050u, 0x0004003du, 0x00000023u, 0x00000052u, 0x00000025u, 0x0004003du,
|
||||
0x0000000du, 0x00000053u, 0x00000014u, 0x00050041u, 0x00000020u, 0x00000054u, 0x00000015u, 0x00000048u,
|
||||
0x0004003du, 0x00000006u, 0x00000055u, 0x00000054u, 0x00050050u, 0x0000000du, 0x00000056u, 0x0000002cu,
|
||||
0x00000055u, 0x00050081u, 0x0000000du, 0x00000057u, 0x00000053u, 0x00000056u, 0x00050057u, 0x0000002fu,
|
||||
0x00000058u, 0x00000052u, 0x00000057u, 0x0008004fu, 0x00000007u, 0x0000005au, 0x00000058u, 0x00000058u,
|
||||
0x00000000u, 0x00000001u, 0x00000002u, 0x0003003eu, 0x00000059u, 0x0000005au, 0x00050039u, 0x00000006u,
|
||||
0x0000005bu, 0x0000000bu, 0x00000059u, 0x0003003eu, 0x00000051u, 0x0000005bu, 0x0004003du, 0x00000006u,
|
||||
0x0000005cu, 0x00000045u, 0x0004003du, 0x00000006u, 0x0000005du, 0x00000051u, 0x00050083u, 0x00000006u,
|
||||
0x0000005eu, 0x0000005cu, 0x0000005du, 0x0006000cu, 0x00000006u, 0x0000005fu, 0x00000001u, 0x00000004u,
|
||||
0x0000005eu, 0x000200feu, 0x0000005fu, 0x00010038u,
|
||||
};
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "cas_frag.h"
|
||||
#include "color_frag.h"
|
||||
#include "fxaa_frag.h"
|
||||
#include "smaa_frag.h"
|
||||
#include "toon_frag.h"
|
||||
#include "hdr_frag.h"
|
||||
#include "ntsc_frag.h"
|
||||
@@ -41,7 +42,7 @@ struct fx_settings {
|
||||
int color_on;
|
||||
float brightness, contrast, gamma, saturation;
|
||||
float b_raw, c_raw, s_raw;
|
||||
int fxaa, toon, crt, ntsc;
|
||||
int aa_mode, toon, crt, ntsc;
|
||||
char look[48];
|
||||
};
|
||||
|
||||
@@ -78,7 +79,7 @@ void vkp_effects_set_deband(int enabled, int pct) {
|
||||
}
|
||||
static float clampf(float v, float lo, float hi) { return v < lo ? lo : v > hi ? hi : v; }
|
||||
void vkp_effects_set_screen(float brightness, float contrast, float gamma, float saturation,
|
||||
int fxaa, int toon, int crt, int ntsc) {
|
||||
int aa_mode, int toon, int crt, int ntsc) {
|
||||
int on = !(brightness == 0.0f && contrast == 0.0f && gamma == 1.0f && saturation == 100.0f);
|
||||
set_begin();
|
||||
g_set.color_on = on;
|
||||
@@ -87,7 +88,8 @@ void vkp_effects_set_screen(float brightness, float contrast, float gamma, float
|
||||
g_set.contrast = clampf(contrast / 100.0f, 0.0f, 2.0f);
|
||||
g_set.saturation = clampf(saturation / 100.0f, 0.0f, 2.0f);
|
||||
g_set.gamma = clampf(gamma, 0.1f, 5.0f);
|
||||
g_set.fxaa = fxaa ? 1 : 0; g_set.toon = toon ? 1 : 0; g_set.crt = crt ? 1 : 0; g_set.ntsc = ntsc ? 1 : 0;
|
||||
g_set.aa_mode = (aa_mode >= 0 && aa_mode <= 2) ? aa_mode : 0;
|
||||
g_set.toon = toon ? 1 : 0; g_set.crt = crt ? 1 : 0; g_set.ntsc = ntsc ? 1 : 0;
|
||||
set_end();
|
||||
}
|
||||
void vkp_effects_set_look(const char *name) {
|
||||
@@ -103,7 +105,7 @@ static const char *scaling_name(int m) {
|
||||
static int spatial_mode(int m) { return m >= 3 && m <= 8; }
|
||||
static int cas_active(const struct fx_settings *s) { return s->cas_on && s->cas_pct > 0; }
|
||||
static int effect_count(const struct fx_settings *s) {
|
||||
return s->fxaa + s->toon + s->color_on + cas_active(s) + s->hdr_on + s->ntsc + s->crt + s->deband_on;
|
||||
return (s->aa_mode != 0) + s->toon + s->color_on + cas_active(s) + s->hdr_on + s->ntsc + s->crt + s->deband_on;
|
||||
}
|
||||
|
||||
static void log_settings(const struct fx_settings *s) {
|
||||
@@ -121,7 +123,8 @@ static void log_settings(const struct fx_settings *s) {
|
||||
if (s->color_on)
|
||||
n += snprintf(line + n, sizeof(line) - n, ", colour b=%+.0f c=%+.0f g=%.2f s=%.0f%%",
|
||||
s->b_raw, s->c_raw, s->gamma, s->s_raw);
|
||||
if (s->fxaa) n += snprintf(line + n, sizeof(line) - n, ", FXAA on");
|
||||
if (s->aa_mode == 1) n += snprintf(line + n, sizeof(line) - n, ", FXAA on");
|
||||
else if (s->aa_mode == 2) n += snprintf(line + n, sizeof(line) - n, ", SMAA on");
|
||||
if (s->toon) n += snprintf(line + n, sizeof(line) - n, ", Toon on");
|
||||
if (s->hdr_on) n += snprintf(line + n, sizeof(line) - n, ", HDR on");
|
||||
if (s->ntsc) n += snprintf(line + n, sizeof(line) - n, ", NTSC on");
|
||||
@@ -202,7 +205,7 @@ static VkDescriptorSetLayout g_dsl;
|
||||
static VkPipelineLayout g_pl;
|
||||
static VkDescriptorPool g_dpool;
|
||||
static VkSampler g_sampler;
|
||||
enum { P_SGSR, P_SGSR_HQ, P_NIS, P_EASU, P_RCAS, P_CAS, P_COLOR, P_FXAA, P_TOON, P_HDR, P_NTSC, P_CRT, P_DEBAND, P_COUNT };
|
||||
enum { P_SGSR, P_SGSR_HQ, P_NIS, P_EASU, P_RCAS, P_CAS, P_COLOR, P_FXAA, P_SMAA, P_TOON, P_HDR, P_NTSC, P_CRT, P_DEBAND, P_COUNT };
|
||||
static VkPipeline g_pipe[P_COUNT];
|
||||
static struct fx_target g_t[2], g_mid;
|
||||
|
||||
@@ -438,6 +441,7 @@ static int objects_ensure(void) {
|
||||
MK(P_CAS, cas_code, "cas");
|
||||
MK(P_COLOR, color_code, "color");
|
||||
MK(P_FXAA, fxaa_code, "fxaa");
|
||||
MK(P_SMAA, smaa_code, "smaa");
|
||||
MK(P_TOON, toon_code, "toon");
|
||||
MK(P_HDR, hdr_code, "hdr");
|
||||
MK(P_NTSC, ntsc_code, "ntsc");
|
||||
@@ -446,7 +450,7 @@ static int objects_ensure(void) {
|
||||
#undef MK
|
||||
g_vk.DestroyShaderModule(g_dev, vert, NULL);
|
||||
g_ready = 1;
|
||||
droiddeck_log("effects", "chain ready: 13 passes (SGSR, SGSR HQ, NIS, FSR EASU+RCAS, CAS, colour, FXAA, Toon, HDR, NTSC, CRT, deband) on %s", vkp_gpu_name());
|
||||
droiddeck_log("effects", "chain ready: 14 pipelines (SGSR, SGSR HQ, NIS, FSR EASU+RCAS, CAS, colour, FXAA, SMAA, Toon, HDR, NTSC, CRT, deband) on %s", vkp_gpu_name());
|
||||
return 0;
|
||||
fail:
|
||||
objects_destroy();
|
||||
@@ -567,9 +571,10 @@ VkImage vkp_effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int sce
|
||||
cur = NULL; cur_ds = g_scene.ds;
|
||||
}
|
||||
|
||||
enum { FX_FXAA, FX_TOON, FX_COLOR, FX_CAS, FX_HDR, FX_NTSC, FX_CRT, FX_DEBAND };
|
||||
enum { FX_FXAA, FX_SMAA, FX_TOON, FX_COLOR, FX_CAS, FX_HDR, FX_NTSC, FX_CRT, FX_DEBAND };
|
||||
int order[8], n = 0;
|
||||
if (s->fxaa) order[n++] = FX_FXAA;
|
||||
if (s->aa_mode == 1) order[n++] = FX_FXAA;
|
||||
else if (s->aa_mode == 2) order[n++] = FX_SMAA;
|
||||
if (s->toon) order[n++] = FX_TOON;
|
||||
if (s->color_on) order[n++] = FX_COLOR;
|
||||
if (cas_active(s)) order[n++] = FX_CAS;
|
||||
@@ -584,6 +589,7 @@ VkImage vkp_effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int sce
|
||||
pr.res[0] = (float)cw; pr.res[1] = (float)ch;
|
||||
switch (order[i]) {
|
||||
case FX_FXAA: pass(cmd, g_pipe[P_FXAA], dst, cur_ds, &pr, sizeof(pr)); break;
|
||||
case FX_SMAA: pass(cmd, g_pipe[P_SMAA], dst, cur_ds, &pr, sizeof(pr)); break;
|
||||
case FX_TOON: pass(cmd, g_pipe[P_TOON], dst, cur_ds, &pr, sizeof(pr)); break;
|
||||
case FX_COLOR: {
|
||||
struct pc_color pc = {0};
|
||||
|
||||
@@ -30,7 +30,7 @@ void vkp_effects_set_cas(int enabled, int pct);
|
||||
void vkp_effects_set_hdr(int enabled);
|
||||
void vkp_effects_set_deband(int enabled, int pct);
|
||||
void vkp_effects_set_screen(float brightness, float contrast, float gamma, float saturation,
|
||||
int fxaa, int toon, int crt, int ntsc);
|
||||
int aa_mode, int toon, int crt, int ntsc);
|
||||
void vkp_effects_set_look(const char *name);
|
||||
|
||||
#endif
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "quest_device.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <sys/system_properties.h>
|
||||
#include <unistd.h>
|
||||
@@ -416,7 +417,13 @@ static void update_map(int scene_w, int scene_h) {
|
||||
if (mode == VKP_MODE_FILL) aspect = sx > sy ? sx : sy;
|
||||
else if (mode == VKP_MODE_INTEGER) {
|
||||
float m = sx < sy ? sx : sy;
|
||||
aspect = m >= 1.0f ? (float)(int)m : m;
|
||||
float nearest = roundf(m);
|
||||
if (nearest >= 1.0f && nearest > m &&
|
||||
nearest - m < 0.15f) {
|
||||
aspect = nearest;
|
||||
} else {
|
||||
aspect = m >= 1.0f ? (float)(int)m : m;
|
||||
}
|
||||
} else aspect = sx < sy ? sx : sy;
|
||||
g_map.kx = g_map.ky = aspect;
|
||||
g_map.off_x = (float)(g_map.rx + (int)((g_map.rw - scene_w * aspect) * 0.5f));
|
||||
|
||||
@@ -497,8 +497,8 @@ Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetDeband(JNIEnv *en
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetScreenEffects(JNIEnv *env, jclass clazz, jfloat brightness,
|
||||
jfloat contrast, jfloat gamma, jfloat saturation, jboolean fxaa, jboolean toon, jboolean crt, jboolean ntsc) {
|
||||
vkp_effects_set_screen(brightness, contrast, gamma, saturation, fxaa ? 1 : 0, toon ? 1 : 0, crt ? 1 : 0, ntsc ? 1 : 0);
|
||||
jfloat contrast, jfloat gamma, jfloat saturation, jint aa_mode, jboolean toon, jboolean crt, jboolean ntsc) {
|
||||
vkp_effects_set_screen(brightness, contrast, gamma, saturation, aa_mode, toon ? 1 : 0, crt ? 1 : 0, ntsc ? 1 : 0);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
|
||||
@@ -43,8 +43,10 @@ class App : Application() {
|
||||
if (process == "$packageName:vr_recovery" || process == "$packageName:rgb_diagnostic" ||
|
||||
process == "$packageName:shortcuts_sync" || process == "$packageName:bottom_desktop") return
|
||||
CrashHandler.install(this)
|
||||
com.droiddeck.launcher.input.ShortcutsRelay.Holder.install(this)
|
||||
com.droiddeck.launcher.agent.AgentHost.refresh(this)
|
||||
com.droiddeck.launcher.agent.AgentTab.load(this)
|
||||
com.droiddeck.launcher.ui.DeveloperTools.load(this)
|
||||
com.droiddeck.launcher.ui.NavTabs.load(this)
|
||||
com.droiddeck.launcher.ui.AgentPet.install(this)
|
||||
if (com.droiddeck.launcher.agent.AgentTab.visible) com.droiddeck.launcher.lab.LabNotice.openOnInstall = "agent"
|
||||
|
||||
@@ -911,6 +911,16 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
|
||||
private fun readGameIntent(request: Intent) {
|
||||
request.getStringExtra(com.droiddeck.launcher.stores.download.StoreDownloadService.EXTRA_NAV)?.let { navRequest = it; request.removeExtra(com.droiddeck.launcher.stores.download.StoreDownloadService.EXTRA_NAV) }
|
||||
request.data?.takeIf { it.scheme == "droiddeck" && it.host == "settings" }?.let { uri ->
|
||||
val section = uri.pathSegments.firstOrNull()
|
||||
navRequest = if (section in setOf("storage", "sync", "downloads")) section
|
||||
else "settings:" + (com.droiddeck.launcher.ui.SettingsSection.of(section) ?: com.droiddeck.launcher.ui.SettingsSection.OVERVIEW).key
|
||||
request.data = null
|
||||
gameLinkReading = false
|
||||
pendingGameLink = null
|
||||
syncDualPanel()
|
||||
return
|
||||
}
|
||||
if (navRequest == com.droiddeck.launcher.core.AppUiPrefs.HOME_PAGE_APPS) {
|
||||
homeAppSelected = HomeApp.isHomeScreenEnabled(this) && HomeApp.isDefault(this)
|
||||
if (!homeAppSelected) navRequest = null
|
||||
@@ -1493,6 +1503,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
},
|
||||
onSaveExport = { sg, layout -> exportSaves(sg.name, layout) { GameSaves.game(sg) } },
|
||||
onPerformance = { refreshCores(); showComponents = false; showMapping = false; showPerformance = true },
|
||||
performancePanel = { PerformanceHost(embedded = true) },
|
||||
onRoms = { showRoms = true },
|
||||
onFiles = { startActivity(Intent(this, com.droiddeck.launcher.files.FileManagerActivity::class.java)) },
|
||||
onBrowseFiles = { dir ->
|
||||
@@ -2704,7 +2715,8 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun PerformanceHost() {
|
||||
private fun PerformanceHost(embedded: Boolean = false) {
|
||||
if (embedded) androidx.compose.runtime.LaunchedEffect(Unit) { refreshCores() }
|
||||
PerformancePage(
|
||||
cores = CpuCores.all.map { c -> CoreRow(c, "cpu$c" + (CpuCores.maxGhz(c)?.let { String.format(java.util.Locale.US, " · %.1f GHz", it) } ?: "")) },
|
||||
clientOverride = clientOverride, clientCores = clientCores, gameCores = gameCores, paceCores = paceCores,
|
||||
@@ -2750,6 +2762,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
SessionPrefs.setGameCpus(this, CpuCores.format(gameCores))
|
||||
},
|
||||
onDismiss = { showPerformance = false },
|
||||
embedded = embedded,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -3300,6 +3313,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
if (!ok) android.widget.Toast.makeText(this, R.string.setup_reset_settings_partial, android.widget.Toast.LENGTH_LONG).show()
|
||||
com.droiddeck.launcher.ui.Motion.refresh(this)
|
||||
com.droiddeck.launcher.agent.AgentTab.load(this)
|
||||
com.droiddeck.launcher.ui.DeveloperTools.load(this)
|
||||
com.droiddeck.launcher.ui.NavTabs.load(this)
|
||||
if (!switchLauncherIcon(LauncherIcon.DARK)) recreate()
|
||||
}
|
||||
|
||||
@@ -191,6 +191,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private var unfoldedPanel by mutableStateOf<OnScreenControls?>(null)
|
||||
private var unfoldedColumn: android.widget.LinearLayout? = null
|
||||
private var unfoldedDeckSurface: com.droiddeck.launcher.ui.InputSurfaceView? = null
|
||||
private var swappedInputSurface: com.droiddeck.launcher.ui.InputSurfaceView? = null
|
||||
private var unfoldedDeckPanel by mutableStateOf<com.droiddeck.launcher.input.DeckPanel?>(null)
|
||||
private var deckPanelLayouts: Map<com.droiddeck.launcher.input.DeckPanel, com.droiddeck.launcher.input.SavedInputLayout?> = emptyMap()
|
||||
private lateinit var sessionRoot: FrameLayout
|
||||
@@ -200,6 +201,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
@Volatile private var inputUsesLocalActions = false
|
||||
private var inputUsesPointer = false
|
||||
private var inputProfile = InputProfile.defaults(InputProfile.GAME)
|
||||
private var stockInputProfile = InputProfile.defaults(InputProfile.GAME)
|
||||
private val inputMotion = InputMotion { inputRouter }
|
||||
private val heldKeys = HeldInput { code, down -> WaylandCompositor.nativeSendKey(code, if (down) 1 else 0) }
|
||||
private val heldButtons = HeldInput(::sendSceneButton)
|
||||
@@ -500,6 +502,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private var drawerGameProfileId by mutableStateOf<Long?>(null)
|
||||
private var drawerGameProfileSelectionMade = false
|
||||
private var fpsLimit by mutableStateOf(SessionState.fpsLimit)
|
||||
private var cornerTap by mutableStateOf(false)
|
||||
private fun fpsLimitKey(): String? = if (SessionState.running) SessionPrefs.fpsLimitKey(SessionState.mode, SessionState.gameId)
|
||||
else SessionPrefs.fpsLimitKey(intent.getStringExtra(SessionService.EXTRA_MODE), intent.getStringExtra(SessionService.EXTRA_GAME_ID))
|
||||
private var blackFrameInsertion by mutableStateOf(false)
|
||||
|
||||
private fun noSteamSession(): Boolean = (SessionState.mode == SessionService.MODE_RUN &&
|
||||
@@ -539,6 +544,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private var lastMouseY = Float.NaN
|
||||
private var padType by mutableStateOf(SessionPrefs.CONTROLLER_DECK)
|
||||
private var pcKeyboardOpen by mutableStateOf(false)
|
||||
private var fieldKeyboardOnPrimary = false
|
||||
private var pendingFieldKeyboard = false
|
||||
private var fieldKeyboardImeShown = false
|
||||
private var achievementsInFront by mutableStateOf<AchievementsInFront?>(null)
|
||||
private var achievementsOpen by mutableStateOf(false)
|
||||
private var hudOn by mutableStateOf(true)
|
||||
@@ -656,11 +664,13 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
override fun onDisplayAdded(displayId: Int) {
|
||||
notifyActivityDisplayStateChanged(displayId)
|
||||
refreshSecondScreenDisplays()
|
||||
updateBottomGame()
|
||||
}
|
||||
override fun onDisplayRemoved(displayId: Int) {
|
||||
if (refreshActivityDisplayId() && started) {
|
||||
SessionService.setActivityDisplay(this@SessionActivity, sessionActivityDisplayId)
|
||||
}
|
||||
updateBottomGame()
|
||||
refreshSecondScreenDisplays()
|
||||
}
|
||||
override fun onDisplayChanged(displayId: Int) {
|
||||
@@ -788,9 +798,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
com.droiddeck.launcher.gpu.SteamVrHealth.begin(this, SessionState.sessionId)
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||
if (!SessionState.running) {
|
||||
SessionState.fpsLimit = 0
|
||||
fpsLimit = 0
|
||||
SessionState.fpsLimit = SessionPrefs.savedFpsLimit(this, fpsLimitKey())
|
||||
}
|
||||
fpsLimit = SessionState.fpsLimit
|
||||
cornerTap = SessionPrefs.drawerCornerTap(this)
|
||||
applyOutputPacing()
|
||||
if (!SessionState.running) {
|
||||
SessionState.followScreen = followChoice()
|
||||
@@ -872,10 +883,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
root.addView(controls)
|
||||
}
|
||||
keyboard = KeyboardHost(this).also { host ->
|
||||
host.onImeChanged = { updateDesktopKeyboardButton() }
|
||||
host.onImeChanged = ::onPrimaryImeChanged
|
||||
root.addView(host)
|
||||
}
|
||||
desktopKeyboardButton = com.droiddeck.launcher.input.DesktopKeyboardButton(this) { keyboard?.show() }
|
||||
desktopKeyboardButton = com.droiddeck.launcher.input.DesktopKeyboardButton(this) { showPrimaryKeyboard() }
|
||||
.also { root.addView(it) }
|
||||
touchpad = TouchpadGestures(PointerGestures.slop(this), pointerListener)
|
||||
directTouchHold = DirectTouchHold(PointerGestures.slop(this), pointerListener, directTouchSink)
|
||||
@@ -893,6 +904,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
drawnRect()?.let { forwardTouch(event, it) }
|
||||
}
|
||||
override fun rightClick(x: Float, y: Float) {
|
||||
if (!screenTapsClick) return
|
||||
pointerListener.onLongPress()
|
||||
pointerListener.onButton(PointerGestures.BTN_RIGHT, true, x, y)
|
||||
surfaceView.postDelayed({ pointerListener.onButton(PointerGestures.BTN_RIGHT, false, x, y) }, 50L)
|
||||
@@ -1090,6 +1102,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
if (AgentGuest.keyboardDismissals != keyboardDismissalsSeen[0]) {
|
||||
keyboardDismissalsSeen[0] = AgentGuest.keyboardDismissals
|
||||
secondScreenPresentation?.closeFieldKeyboard()
|
||||
dismissFieldKeyboard()
|
||||
}
|
||||
}
|
||||
androidx.compose.runtime.LaunchedEffect(picturePosition, integerScaling, SessionState.running, pipUi, cardboard.enabled) { applyGameAlignment() }
|
||||
@@ -1130,6 +1143,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
drawerPage = com.droiddeck.launcher.ui.SessionDrawerPage.GLASSES
|
||||
drawerOpen = true
|
||||
}
|
||||
if (!drawerOpen && !pcKeyboardOpen && !loading.visible) {
|
||||
com.droiddeck.launcher.ui.DrawerEntryHint(SessionState.mode == SessionService.MODE_STEAM, backActionsInverted) { drawerOpen = true }
|
||||
if (cornerTap) com.droiddeck.launcher.ui.DrawerCornerTap { drawerOpen = true }
|
||||
}
|
||||
if (loading.visible) LoadingOverlay(
|
||||
loading.step, loading.percent, loading.elapsed, loading.hint, loading.ended,
|
||||
topic = loading.topic, readable = loading.readable,
|
||||
@@ -1312,7 +1329,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
if (pcKeyboardOpen) com.droiddeck.launcher.ui.PcKeyboard(
|
||||
sendKey = { code, down -> if (CompositorHost.isStarted) sendGuestKey(code, down, 32) },
|
||||
onAndroidKeyboard = { pcKeyboardOpen = false; keyboard?.toggle() },
|
||||
onAndroidKeyboard = { pcKeyboardOpen = false; togglePrimaryKeyboard() },
|
||||
onClose = { pcKeyboardOpen = false },
|
||||
)
|
||||
if (!drawerDocked) SessionMenu(
|
||||
@@ -1436,6 +1453,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
secondScreenNone = !bottomOutputActive && !dockDrawer(),
|
||||
gameOnBottom = bottomOutputActive,
|
||||
gameSwapAvailable = bottomSwapAvailable,
|
||||
gameSwapBuiltIn = !::displayManager.isInitialized || displayManager.getDisplay(selectedSecondScreenDisplay)
|
||||
?.let(com.droiddeck.launcher.input.DualScreen::builtIn) ?: true,
|
||||
onGameOnBottom = { on -> drawerOpen = false; putGameOnBottom(on) },
|
||||
dashboardAvailable = bottomPages().isNotEmpty(),
|
||||
desktopAvailable = com.droiddeck.launcher.session.BottomDesktop.available(),
|
||||
@@ -1447,6 +1466,12 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
onHudReset = { hudConfig = DroidDeckHudConfig.reset(this@SessionActivity); hud.applyConfig() },
|
||||
onHudOrderReset = { hudConfig = DroidDeckHudConfig.clearOrder(this@SessionActivity); hud.applyConfig() },
|
||||
onHudExport = { exportHudDiagnostics() },
|
||||
integerScaling = integerScaling,
|
||||
onIntegerScaling = { enabled ->
|
||||
SessionPrefs.setIntegerScaling(this@SessionActivity, enabled)
|
||||
integerScaling = enabled
|
||||
applyGameAlignment()
|
||||
},
|
||||
onUpscaler = { m ->
|
||||
val target = effectsEditorTarget ?: screenEffectsTarget
|
||||
val activeProfileId =
|
||||
@@ -1592,8 +1617,11 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
onFpsLimit = { fps ->
|
||||
SessionState.fpsLimit = fps
|
||||
fpsLimit = fps
|
||||
SessionPrefs.saveFpsLimit(this@SessionActivity, fpsLimitKey(), fps)
|
||||
applyOutputPacing()
|
||||
},
|
||||
cornerTap = cornerTap,
|
||||
onCornerTap = { on -> SessionPrefs.setDrawerCornerTap(this@SessionActivity, on); cornerTap = on },
|
||||
blackFrameInsertion = blackFrameInsertion,
|
||||
blackFrameInsertionAvailable = blackFrameInsertion || blackFrameInsertionAvailable(),
|
||||
onBlackFrameInsertion = { on ->
|
||||
@@ -1623,7 +1651,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
pickLossless.launch(InAppFilePicker.buildIntent(
|
||||
this@SessionActivity, listOf("dll"), getString(R.string.lsfg_pick_title)))
|
||||
},
|
||||
onKeyboard = { drawerOpen = false; pcKeyboardOpen = false; keyboard?.toggle() },
|
||||
onKeyboard = { drawerOpen = false; pcKeyboardOpen = false; togglePrimaryKeyboard() },
|
||||
onHardwareKeyboard = ::togglePcKeyboard,
|
||||
wowChatShown = com.droiddeck.launcher.ui.WowChat.isWow(AgentGuest.gameProgram),
|
||||
wowChat = wowChat.remembered,
|
||||
@@ -1854,7 +1882,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
val all = com.droiddeck.launcher.input.VrControllers.Emulate.entries
|
||||
com.droiddeck.launcher.input.VrControllers.setEmulate(this, all[(pads.emulate.ordinal + 1) % all.size])
|
||||
}) else null,
|
||||
onKeyboard = { keyboard?.toggle() },
|
||||
onKeyboard = { togglePrimaryKeyboard() },
|
||||
onSessionMenu = { drawerOpen = true },
|
||||
onStopSteamVr = if (vr) ({ steamVrAction("stop") }) else null,
|
||||
brightness = glasses.brightness,
|
||||
@@ -1895,12 +1923,44 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
|
||||
private fun togglePcKeyboard() {
|
||||
drawerOpen = false
|
||||
keyboard?.hide()
|
||||
hidePrimaryKeyboard()
|
||||
onScreenControls?.releaseAll()
|
||||
bottomInputControls?.releaseAll()
|
||||
pcKeyboardOpen = !pcKeyboardOpen
|
||||
}
|
||||
|
||||
private fun showPrimaryKeyboard() {
|
||||
pendingFieldKeyboard = false
|
||||
fieldKeyboardOnPrimary = false
|
||||
keyboard?.show()
|
||||
}
|
||||
|
||||
private fun togglePrimaryKeyboard() {
|
||||
pendingFieldKeyboard = false
|
||||
fieldKeyboardOnPrimary = false
|
||||
keyboard?.toggle()
|
||||
}
|
||||
|
||||
private fun hidePrimaryKeyboard() {
|
||||
pendingFieldKeyboard = false
|
||||
fieldKeyboardOnPrimary = false
|
||||
keyboard?.hide()
|
||||
}
|
||||
|
||||
private fun onPrimaryImeChanged(visible: Boolean) {
|
||||
if (visible) fieldKeyboardImeShown = true
|
||||
else if (fieldKeyboardImeShown) {
|
||||
fieldKeyboardImeShown = false
|
||||
fieldKeyboardOnPrimary = false
|
||||
}
|
||||
updateDesktopKeyboardButton()
|
||||
}
|
||||
|
||||
private fun dismissFieldKeyboard() {
|
||||
pendingFieldKeyboard = false
|
||||
if (fieldKeyboardOnPrimary) hidePrimaryKeyboard()
|
||||
}
|
||||
|
||||
private fun updateControllerPrefs(change: () -> Unit) {
|
||||
change()
|
||||
controllerSettings = ControllerPrefs.read(this)
|
||||
@@ -2878,7 +2938,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
val display = if (Build.VERSION.SDK_INT >= 30) display else windowManager.defaultDisplay
|
||||
val wanted = window.attributes.preferredDisplayModeId
|
||||
val requested = display?.supportedModes?.firstOrNull { wanted != 0 && it.modeId == wanted }?.refreshRate
|
||||
val running = display?.refreshRate?.takeIf { it > 1f }
|
||||
// Display.refreshRate reports a per-app frame rate override (Game Mode FPS) instead of the panel's mode.
|
||||
val running = display?.mode?.refreshRate?.takeIf { it > 1f }
|
||||
val hz = listOfNotNull(requested, running).minOrNull() ?: 60f
|
||||
val mirrorCap = mirrorRefreshLimit().takeIf { it > 0 }?.toFloat() ?: Float.POSITIVE_INFINITY
|
||||
val capped = minOf(hz, PerfMode.peakRefreshCap(this), mirrorCap)
|
||||
@@ -3132,6 +3193,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
|
||||
private fun onSessionEnded(status: Int) {
|
||||
ended = true
|
||||
uiHandler.removeCallbacks(guardWhenRunning)
|
||||
com.droiddeck.launcher.session.KeepTopActivity.release()
|
||||
++steamVrRequestGeneration
|
||||
if (isInPictureInPictureMode) {
|
||||
runOnUiThread { finish() }
|
||||
@@ -3650,7 +3713,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
val target = com.droiddeck.launcher.input.DualScreen.sessionDisplay(this, displayManager, shownOnDisplayId) ?: return false
|
||||
return try {
|
||||
val presentation = secondScreenPresentation ?: secondScreenPresentation(target).also {
|
||||
selectedSecondScreenDisplay = target.displayId
|
||||
secondScreenPresentation = it
|
||||
}
|
||||
if (!presentation.isShowing) presentation.show()
|
||||
@@ -4009,16 +4071,23 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
val candidates = SecondScreenDisplays.available(displayManager, primaryId)
|
||||
.filter { glassesScreen == null || it.id != glasses.displayId }
|
||||
val oldIds = secondScreenDisplays.map { it.id }.toSet()
|
||||
val oldSelectedDisplay = selectedSecondScreenDisplay
|
||||
secondScreenDisplays = candidates
|
||||
reconcileDock(primaryId)
|
||||
bottomSwapAvailable = bottomGame != null || bottomGameDisplay() != null
|
||||
val newIds = candidates.map { it.id }.toSet()
|
||||
if (secondScreenMode != SecondScreenMode.NONE && oldIds.isNotEmpty() && selectedSecondScreenDisplay !in newIds) {
|
||||
bottomSwapAvailable = bottomGame != null
|
||||
closeSecondScreen(reset = true)
|
||||
SessionState.secondScreenAutoOpened = false
|
||||
return
|
||||
}
|
||||
if (selectedSecondScreenDisplay !in newIds) selectedSecondScreenDisplay = candidates.firstOrNull()?.id ?: -1
|
||||
selectedSecondScreenDisplay = SecondScreenDisplays.selection(selectedSecondScreenDisplay, candidates.map { it.id }, gameOnBottom) {
|
||||
SessionState.secondScreenDisplay = it
|
||||
}
|
||||
if (selectedSecondScreenDisplay != oldSelectedDisplay) {
|
||||
updateBottomGame()
|
||||
}
|
||||
bottomSwapAvailable = bottomGame != null || bottomGameDisplay() != null
|
||||
if (secondScreenMode != SecondScreenMode.NONE && candidates.isEmpty()) {
|
||||
closeSecondScreen(reset = true)
|
||||
SessionState.secondScreenAutoOpened = false
|
||||
@@ -4040,12 +4109,22 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
|
||||
private fun openDualScreenControls() {
|
||||
if (SessionState.secondScreenAutoOpened || secondScreenMode != SecondScreenMode.NONE || pipUi) return
|
||||
if (gameOnBottom && selectedSecondScreenDisplay >= 0 && secondScreenDisplays.none { it.id == selectedSecondScreenDisplay }) return
|
||||
if (!SessionPrefs.dualScreenSessionControls(this)) return
|
||||
val target = com.droiddeck.launcher.input.DualScreen.sessionDisplay(this, displayManager, shownOnDisplayId) ?: return
|
||||
if (secondScreenDisplays.none { it.id == target.displayId }) return
|
||||
val gameDisplay = bottomGame?.display?.displayId
|
||||
?: if (SessionState.gameOnBottom) bottomGameDisplay()?.displayId else null
|
||||
SessionState.secondScreenAutoOpened = true
|
||||
selectedSecondScreenDisplay = target.displayId
|
||||
selectSecondScreenMode(openingPanel())
|
||||
if (gameDisplay != null && gameDisplay != target.displayId && secondScreenDisplays.any { it.id == gameDisplay }) {
|
||||
panelMode(openingPanel())
|
||||
} else {
|
||||
val selectionChanged = selectedSecondScreenDisplay != target.displayId
|
||||
selectedSecondScreenDisplay = target.displayId
|
||||
SessionState.secondScreenDisplay = target.displayId
|
||||
if (selectionChanged) updateBottomGame()
|
||||
selectSecondScreenMode(openingPanel())
|
||||
}
|
||||
automaticPanel = secondScreenMode != SecondScreenMode.NONE
|
||||
dualControlsProvisional = ::loading.isInitialized && loading.visible
|
||||
}
|
||||
@@ -4071,6 +4150,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
if (secondScreenDisplays.none { it.id == displayId }) return
|
||||
selectedSecondScreenDisplay = displayId
|
||||
SessionState.secondScreenDisplay = displayId
|
||||
updateBottomGame()
|
||||
if (secondScreenMode != SecondScreenMode.NONE) showSecondScreen(secondScreenMode)
|
||||
}
|
||||
|
||||
@@ -4089,6 +4169,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
return
|
||||
}
|
||||
if (selectedSecondScreenDisplay !in secondScreenDisplays.map { it.id }) {
|
||||
if (gameOnBottom && selectedSecondScreenDisplay >= 0) {
|
||||
panelMode(mode)
|
||||
return
|
||||
}
|
||||
selectedSecondScreenDisplay = secondScreenDisplays.first().id
|
||||
}
|
||||
showSecondScreen(mode)
|
||||
@@ -4167,7 +4251,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
)
|
||||
}
|
||||
},
|
||||
onSwap = if (bottomSwapAvailable && com.droiddeck.launcher.input.DualScreen.builtIn(target)) ({ putGameOnBottom(true) }) else null,
|
||||
onSwap = if (bottomSwapAvailable) ({ putGameOnBottom(true) }) else null,
|
||||
onDeckPanel = ::selectDeckPanel,
|
||||
dashboard = if (bottomPages().isEmpty()) null else ({
|
||||
DroidDeckTheme {
|
||||
@@ -4271,6 +4355,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
val library = com.droiddeck.launcher.input.InputLibraries.read(this)
|
||||
val desktop = loadingMode() == SessionService.MODE_DESKTOP
|
||||
inputProfile = library.compileActive(desktop, secondScreenMode.panel(this))
|
||||
stockInputProfile = library.compileStock(desktop, secondScreenMode.panel(this))
|
||||
primaryInputLayout = library.activeLayout(desktop, InputRole.PRIMARY)
|
||||
adaptiveSticks = primaryInputLayout?.adaptiveSticks
|
||||
quickButtons = primaryInputLayout?.takeIf { it.editable }?.let { l -> l.quickButtons.associateWith { it !in l.style.hidden } }.orEmpty()
|
||||
@@ -4410,6 +4495,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
if (!started) return null
|
||||
if (secondScreenPresentation?.showsKeyboard != true && dockDrawer()) {
|
||||
val target = com.droiddeck.launcher.input.DualScreen.sessionDisplay(this, displayManager, shownOnDisplayId) ?: return null
|
||||
if (gameOnBottom && selectedSecondScreenDisplay != target.displayId) return null
|
||||
if (drawerOpen || drawerPinned) drawerOpen = false
|
||||
typingReturnMode = secondScreenMode
|
||||
selectedSecondScreenDisplay = target.displayId
|
||||
@@ -4419,16 +4505,37 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
|
||||
private fun openBottomKeyboard() {
|
||||
val presentation = bottomKeyboardPresentation() ?: return
|
||||
val presentation = bottomKeyboardPresentation()
|
||||
if (presentation == null) {
|
||||
if (keyboardBelongsOnPrimary()) {
|
||||
pendingFieldKeyboard = true
|
||||
retryFieldKeyboard(hasWindowFocus())
|
||||
}
|
||||
return
|
||||
}
|
||||
pendingFieldKeyboard = false
|
||||
if (fieldKeyboardOnPrimary) hidePrimaryKeyboard()
|
||||
presentation.requestKeyboard(forField = true)
|
||||
com.droiddeck.launcher.ui.SessionTyping.focusDisplay(this, presentation.display.displayId)
|
||||
}
|
||||
|
||||
private fun keyboardBelongsOnPrimary() = SecondScreenDisplays.keyboardOnPrimary(gameOnBottom, selectedSecondScreenDisplay,
|
||||
secondScreenDisplays.map { it.id }, taken = com.droiddeck.launcher.input.DualScreen::taken)
|
||||
|
||||
private fun retryFieldKeyboard(hasFocus: Boolean) {
|
||||
if (!pendingFieldKeyboard || !hasFocus || !resumed || pipUi) return
|
||||
pendingFieldKeyboard = false
|
||||
if (!keyboardBelongsOnPrimary()) return
|
||||
fieldKeyboardOnPrimary = true
|
||||
fieldKeyboardImeShown = keyboard?.hideMeansDismissal == true
|
||||
keyboard?.show()
|
||||
}
|
||||
|
||||
private fun onGameTextField(focused: Boolean) {
|
||||
if (!focused || !com.droiddeck.launcher.ui.WowChat.isWow(AgentGuest.gameProgram)) wowChat.chatClosed()
|
||||
else if (resumed && !pipUi && !pcKeyboardOpen &&
|
||||
resources.configuration.hardKeyboardHidden != android.content.res.Configuration.HARDKEYBOARDHIDDEN_NO) {
|
||||
keyboard?.takeIf { it.shown }?.hide()
|
||||
hidePrimaryKeyboard()
|
||||
wowChat.chatOpened()
|
||||
}
|
||||
}
|
||||
@@ -4515,9 +4622,13 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
|
||||
private fun updateKeyboardRoute() {
|
||||
AgentGuest.routeKeyboard(this, SessionState.mode == SessionService.MODE_STEAM &&
|
||||
(secondScreenPresentation?.showsKeyboard == true || dockDrawer()) &&
|
||||
SessionPrefs.androidTextFieldKeyboard(this))
|
||||
AgentGuest.routeKeyboard(this, SecondScreenDisplays.routeKeyboard(
|
||||
SessionState.mode == SessionService.MODE_STEAM,
|
||||
SessionPrefs.androidTextFieldKeyboard(this),
|
||||
secondScreenPresentation?.showsKeyboard == true,
|
||||
dockDrawer(),
|
||||
SecondScreenDisplays.keyboardOnPrimary(gameOnBottom, selectedSecondScreenDisplay,
|
||||
secondScreenDisplays.map { it.id }, resumed && !pipUi, com.droiddeck.launcher.input.DualScreen::taken)))
|
||||
}
|
||||
|
||||
private fun dropDockedDrawer() {
|
||||
@@ -4728,6 +4839,12 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private var lockedSwipeY = 0f
|
||||
private var dismissTouch = false
|
||||
private var sessionTouchDown = false
|
||||
private var screenTapsClick = true
|
||||
|
||||
private fun onScreenMouseButtonShown(): Boolean = listOfNotNull(
|
||||
onScreenControls?.inputSurface, bottomInputControls?.inputSurface, unfoldedPanel?.inputSurface, unfoldedDeckSurface,
|
||||
secondScreenPresentation?.controlsView, swappedInputSurface,
|
||||
).any { it.isShown && inputProfile.showsMouseButton(it.inputRole, it.shownElements, stockInputProfile) }
|
||||
|
||||
override fun onTouchEvent(event: MotionEvent): Boolean {
|
||||
val pen = PenStream.penIndex(event)
|
||||
@@ -4760,6 +4877,11 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
val snapshot = fingerTouchSnapshot(uiBlocking)
|
||||
val route = com.droiddeck.launcher.input.TouchRouter.decide(snapshot)
|
||||
if (event.actionMasked == MotionEvent.ACTION_DOWN) {
|
||||
screenTapsClick = !onScreenMouseButtonShown()
|
||||
if (::touchpad.isInitialized) touchpad.clicks = screenTapsClick
|
||||
if (::scrollTouch.isInitialized) scrollTouch.clicks = screenTapsClick
|
||||
}
|
||||
if (route != touchRoute) {
|
||||
Log.i(TAG, "touch route $touchRoute -> $route (mode=$routedTouchMode steamUi=${SessionState.steamUi} scrollLayer=$scrollTouchGesture)")
|
||||
touchRoute = route
|
||||
@@ -4909,6 +5031,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
if (event.actionMasked == MotionEvent.ACTION_UP || event.actionMasked == MotionEvent.ACTION_CANCEL) ignoreGameTouch = false
|
||||
return true
|
||||
}
|
||||
// With an on-screen mouse button the press comes from the button, so the pointer has to be there before
|
||||
// the two-finger gesture buffer holds the touch-down.
|
||||
if (SessionState.mode == SessionService.MODE_DESKTOP && !screenTapsClick && !pointerLocked &&
|
||||
event.actionMasked == MotionEvent.ACTION_DOWN) movePointer(event.x, event.y)
|
||||
if (SessionState.mode == SessionService.MODE_DESKTOP && twoFingerGestures.onTouch(event)) return true
|
||||
return forwardTouch(event, rect)
|
||||
}
|
||||
@@ -4943,7 +5069,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
}
|
||||
}
|
||||
directTouchHold.onTouch(event)
|
||||
if (screenTapsClick) directTouchHold.onTouch(event)
|
||||
else if (!pointerLocked && (event.actionMasked == MotionEvent.ACTION_DOWN || event.actionMasked == MotionEvent.ACTION_MOVE))
|
||||
movePointer(event.x, event.y)
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -5399,6 +5527,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
|
||||
private fun showPipUi(show: Boolean) {
|
||||
pipUi = show
|
||||
updateKeyboardRoute()
|
||||
if (!show) retryFieldKeyboard(hasWindowFocus())
|
||||
if (show) {
|
||||
if (::hud.isInitialized) hud.setHidden(true)
|
||||
drawerOpen = false
|
||||
@@ -5418,7 +5548,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
guestKeysDown.toList().forEach { sendGuestKey(it, false) }
|
||||
heldKeys.clear()
|
||||
heldButtons.clear()
|
||||
keyboard?.hide()
|
||||
hidePrimaryKeyboard()
|
||||
sessionClipboard.stop()
|
||||
padMotion?.stop()
|
||||
cursorVisible = false
|
||||
@@ -5459,7 +5589,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
|
||||
override fun startActivityForResult(intent: Intent, requestCode: Int, options: Bundle?) {
|
||||
if (::pip.isInitialized && (requestCode >= 0 || intent.component?.packageName == packageName ||
|
||||
if (::pip.isInitialized && intent.component?.className != com.droiddeck.launcher.session.KeepTopActivity::class.java.name &&
|
||||
(requestCode >= 0 || intent.component?.packageName == packageName ||
|
||||
intent.action in setOf(Intent.ACTION_CHOOSER, Intent.ACTION_SEND, Intent.ACTION_OPEN_DOCUMENT,
|
||||
Intent.ACTION_GET_CONTENT, "android.settings.PICTURE_IN_PICTURE_SETTINGS"))) pip.background()
|
||||
super.startActivityForResult(intent, requestCode, options)
|
||||
@@ -5491,6 +5622,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
if (lightPause.stopped()) departureCleanup()
|
||||
if (runtimeRemovalBlocked) { super.onStop(); return }
|
||||
started = false
|
||||
if (::hud.isInitialized) hud.setBackgrounded(true)
|
||||
@@ -5534,6 +5666,12 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
uiHandler.removeCallbacks(lightPauseCheck)
|
||||
when (lightPause.resumed(com.droiddeck.launcher.session.KeepTopActivity.bounces)) {
|
||||
com.droiddeck.launcher.session.LightPause.Resume.LIGHT -> return
|
||||
com.droiddeck.launcher.session.LightPause.Resume.CLEANUP_FIRST -> departureCleanup()
|
||||
com.droiddeck.launcher.session.LightPause.Resume.NORMAL -> Unit
|
||||
}
|
||||
drawerGameInventoryRevision++
|
||||
com.droiddeck.launcher.input.SystemKeyCapture.attach(this, { hasWindowFocus() && !appUiOwnsPointer() && CompositorHost.isStarted }) { event ->
|
||||
com.droiddeck.launcher.input.GuestKeys.send(event) { code, down -> sendGuestKey(code, down, 8) }
|
||||
@@ -5561,6 +5699,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
onScreenControls?.reload()
|
||||
controllerSettings = ControllerPrefs.read(this)
|
||||
resumed = true
|
||||
updateKeyboardRoute()
|
||||
retryFieldKeyboard(hasWindowFocus())
|
||||
updateDesktopKeyboardButton()
|
||||
com.droiddeck.launcher.input.HomeButtonShortcuts.attach(this,
|
||||
enabled = {
|
||||
@@ -5597,10 +5737,63 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
SessionPrefs.sessionPrefs(this).registerOnSharedPreferenceChangeListener(cardboardPrefListener)
|
||||
}
|
||||
|
||||
private var memoryPressureAt = 0L
|
||||
private var focusBounce = false
|
||||
private val lightPause = com.droiddeck.launcher.session.LightPause()
|
||||
private val lightPauseCheck = Runnable { if (lightPause.timedOut()) departureCleanup() }
|
||||
private var topResumed = false
|
||||
private val guardWhenRunning = object : Runnable {
|
||||
override fun run() {
|
||||
if (!topResumed || isFinishing) return
|
||||
if (SessionState.running) guardOtherDisplays() else uiHandler.postDelayed(this, 2_000)
|
||||
}
|
||||
}
|
||||
|
||||
// RUNNING_LOW and RUNNING_CRITICAL are not delivered from API 34, so the guard also goes up
|
||||
// as soon as a running session is on top.
|
||||
override fun onTrimMemory(level: Int) {
|
||||
super.onTrimMemory(level)
|
||||
if (!com.droiddeck.launcher.session.TopUnderPressure.isPressure(level)) return
|
||||
memoryPressureAt = android.os.SystemClock.elapsedRealtime()
|
||||
guardOtherDisplays()
|
||||
}
|
||||
|
||||
override fun onTopResumedActivityChanged(isTopResumedActivity: Boolean) {
|
||||
super.onTopResumedActivityChanged(isTopResumedActivity)
|
||||
topResumed = isTopResumedActivity
|
||||
uiHandler.removeCallbacks(guardWhenRunning)
|
||||
if (isTopResumedActivity) uiHandler.post(guardWhenRunning)
|
||||
else if (com.droiddeck.launcher.session.TopUnderPressure.shouldReclaim(
|
||||
android.os.SystemClock.elapsedRealtime(), memoryPressureAt, SessionState.running, isFinishing)) guardOtherDisplays()
|
||||
}
|
||||
|
||||
private fun guardOtherDisplays() {
|
||||
if (!SessionState.running || isFinishing) return
|
||||
val wasResumed = lifecycle.currentState.isAtLeast(androidx.lifecycle.Lifecycle.State.RESUMED)
|
||||
val bounced = com.droiddeck.launcher.session.KeepTopActivity.guardOtherDisplays(this, display?.displayId ?: android.view.Display.DEFAULT_DISPLAY)
|
||||
if (com.droiddeck.launcher.session.KeepTopActivity.hasPendingStarts()) {
|
||||
uiHandler.removeCallbacks(guardWhenRunning)
|
||||
uiHandler.postDelayed(guardWhenRunning, com.droiddeck.launcher.session.KeepTopActivity.RETRY_MS)
|
||||
}
|
||||
if (!bounced) return
|
||||
if (!wasResumed) return
|
||||
focusBounce = true
|
||||
uiHandler.postDelayed({ focusBounce = false }, 500)
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
if (focusBounce) {
|
||||
focusBounce = false
|
||||
lightPause.paused(com.droiddeck.launcher.session.KeepTopActivity.bounces)
|
||||
uiHandler.postDelayed(lightPauseCheck, 200)
|
||||
} else departureCleanup()
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
private fun departureCleanup() {
|
||||
com.droiddeck.launcher.input.SystemKeyCapture.detach(this)
|
||||
com.droiddeck.launcher.input.HomeButtonShortcuts.detach(this)
|
||||
if (runtimeRemovalBlocked) { super.onPause(); return }
|
||||
if (runtimeRemovalBlocked) return
|
||||
physicalShortcuts.clear()
|
||||
backQamInput.cancel()
|
||||
mouseBackInput.cancel()
|
||||
@@ -5634,14 +5827,16 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
if (::scrollTouch.isInitialized) scrollTouch.cancel()
|
||||
if (::padMouse.isInitialized) padMouse.reset()
|
||||
resumed = false
|
||||
updateKeyboardRoute()
|
||||
updatePointerCapture()
|
||||
updatePadMotion()
|
||||
keyboard?.takeIf { it.shown }?.hide()
|
||||
val pendingKeyboard = pendingFieldKeyboard
|
||||
hidePrimaryKeyboard()
|
||||
pendingFieldKeyboard = pendingKeyboard
|
||||
SessionPrefs.sessionPrefs(this).unregisterOnSharedPreferenceChangeListener(cardboardPrefListener)
|
||||
SessionPrefs.sessionPrefs(this).unregisterOnSharedPreferenceChangeListener(screenEffectsProfilePrefListener)
|
||||
ControllerPrefs.prefs(this).unregisterOnSharedPreferenceChangeListener(shortcutPrefListener)
|
||||
updateHeadTracker()
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
private fun steamVrAction(action: String) {
|
||||
@@ -5882,9 +6077,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
|
||||
private fun bottomGameDisplay(): Display? {
|
||||
if (!::displayManager.isInitialized) return null
|
||||
return com.droiddeck.launcher.input.DualScreen.sessionDisplay(this, displayManager, shownOnDisplayId)
|
||||
?.takeIf { it.isValid && com.droiddeck.launcher.input.DualScreen.builtIn(it) }
|
||||
if (!::displayManager.isInitialized || SessionPrefs.dualScreenSessionMode(this) == com.droiddeck.launcher.input.DualScreen.MODE_OFF) return null
|
||||
return com.droiddeck.launcher.input.DualScreen.selectedSessionDisplay(
|
||||
this, displayManager, shownOnDisplayId, selectedSecondScreenDisplay,
|
||||
)
|
||||
}
|
||||
|
||||
private fun putGameOnBottom(on: Boolean) {
|
||||
@@ -6010,7 +6206,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
tabs = tabs,
|
||||
)
|
||||
val keyboardExtra = com.droiddeck.launcher.ui.BarExtra(getString(R.string.second_show_keyboard), icon = R.drawable.ic_bottom_keyboard) {
|
||||
keyboard?.toggle()
|
||||
togglePrimaryKeyboard()
|
||||
}
|
||||
val profileLayout = secondaryInputLayout
|
||||
androidx.compose.foundation.layout.Box(
|
||||
@@ -6038,8 +6234,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
androidx.compose.runtime.key(profileLayout) {
|
||||
androidx.compose.ui.viewinterop.AndroidView(
|
||||
factory = { context -> com.droiddeck.launcher.ui.InputSurfaceView(context, padBridge, profileLayout?.elements.orEmpty(),
|
||||
surfaceStyle = profileLayout?.style ?: com.droiddeck.launcher.input.InputSurfaceStyle()) },
|
||||
surfaceStyle = profileLayout?.style ?: com.droiddeck.launcher.input.InputSurfaceStyle()).also { swappedInputSurface = it } },
|
||||
modifier = Modifier.fillMaxWidth().weight(1f),
|
||||
onRelease = { if (swappedInputSurface === it) swappedInputSurface = null },
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -6206,6 +6403,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
releaseHeldGuestInput()
|
||||
}
|
||||
if (hasFocus && !pipUi) {
|
||||
retryFieldKeyboard(true)
|
||||
goFullscreen()
|
||||
refreshClipboard()
|
||||
}
|
||||
@@ -6250,6 +6448,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
uiHandler.removeCallbacks(guardWhenRunning)
|
||||
com.droiddeck.launcher.session.KeepTopActivity.release()
|
||||
synchronized(frameGenGlobalLock) {
|
||||
frameGenActivityActive = false
|
||||
frameGenRequests.incrementAndGet()
|
||||
|
||||
@@ -19,6 +19,17 @@ interface AgentHarness {
|
||||
val signedIn: List<String>
|
||||
/** A guest command that signs in through $BROWSER. */
|
||||
val signIn: List<String>
|
||||
/**
|
||||
* Where the user makes an API key, for a CLI whose own sign-in is a terminal prompt: [signIn]
|
||||
* then only opens this page, and the key is pasted into DroidDeck and saved by [saveKey].
|
||||
*/
|
||||
val keyPage: String? get() = null
|
||||
/** Whether a key from [keyPage] is saved under [rootfs]. */
|
||||
fun hasKey(rootfs: File): Boolean = false
|
||||
fun saveKey(rootfs: File, key: String) {}
|
||||
/** Whether the CLI has models that need no account; [useFree] then counts as signed in. */
|
||||
val free: Boolean get() = false
|
||||
fun useFree(rootfs: File) {}
|
||||
/** Whether [Options.plan] means anything to this CLI. */
|
||||
val plans: Boolean
|
||||
/** Reasoning effort levels the CLI accepts, lowest first; empty when it has none. */
|
||||
@@ -49,7 +60,7 @@ interface AgentHarness {
|
||||
data class Options(val model: String? = null, val plan: Boolean = false, val brief: String? = null, val effort: String? = null)
|
||||
|
||||
companion object {
|
||||
val all: List<AgentHarness> = listOf(ClaudeCode, Codex)
|
||||
val all: List<AgentHarness> = listOf(ClaudeCode, Codex, OpenCode)
|
||||
fun byId(id: String?): AgentHarness = all.firstOrNull { it.id == id } ?: ClaudeCode
|
||||
}
|
||||
}
|
||||
@@ -392,6 +403,184 @@ object Codex : AgentHarness {
|
||||
}
|
||||
}
|
||||
|
||||
/** OpenCode: `opencode run --format json`, resumed by session id. */
|
||||
object OpenCode : AgentHarness {
|
||||
override val id = "opencode"
|
||||
override val name = "OpenCode"
|
||||
override val binary = "/root/.opencode/bin/opencode"
|
||||
override val skills = "root/.config/opencode/skills"
|
||||
override val instructions = "root/.config/opencode/AGENTS.md"
|
||||
override val install = "curl -fsSL https://opencode.ai/install | bash -s -- --no-modify-path"
|
||||
private const val AUTH = "root/.local/share/opencode/auth.json"
|
||||
private const val FREE = "root/.config/opencode/.droiddeck-free"
|
||||
private const val MODELS = "root/.cache/droiddeck/opencode-models"
|
||||
|
||||
// `opencode models` lists only what the saved keys reach, so the check that runs it keeps the model list current.
|
||||
override val signedIn = listOf("sh", "-c",
|
||||
"mkdir -p /${MODELS.substringBeforeLast('/')}; $binary models --verbose > /$MODELS.$$ 2>/dev/null && mv -f /$MODELS.$$ /$MODELS; rm -f /$MODELS.$$; " +
|
||||
"grep -q '\"type\"' /$AUTH 2>/dev/null || [ -e /$FREE ]")
|
||||
override val keyPage = "https://opencode.ai/auth"
|
||||
override val signIn = listOf("/root/.local/bin/android-open", keyPage)
|
||||
override val free = true
|
||||
override val plans = true
|
||||
override val efforts = listOf("low", "medium", "high")
|
||||
|
||||
override fun hasKey(rootfs: File) = runCatching { JSONObject(File(rootfs, AUTH).readText()).has("opencode") }.getOrDefault(false)
|
||||
|
||||
/** The key opencode's own `auth login` would save for OpenCode Zen. */
|
||||
override fun saveKey(rootfs: File, key: String) {
|
||||
val file = File(rootfs, AUTH)
|
||||
// An auth.json that cannot be read holds other providers' sign-ins too, so it is never replaced.
|
||||
val auth = if (file.exists()) JSONObject(file.readText()) else JSONObject()
|
||||
auth.put("opencode", JSONObject().put("type", "api").put("key", key.trim()))
|
||||
file.parentFile?.mkdirs()
|
||||
file.writeText(auth.toString(2) + "\n")
|
||||
file.setReadable(false, false)
|
||||
file.setReadable(true, true)
|
||||
}
|
||||
|
||||
override fun useFree(rootfs: File) {
|
||||
File(rootfs, FREE).apply { parentFile?.mkdirs() }.writeText("Free OpenCode Zen models, chosen in DroidDeck's agent setup.\n")
|
||||
}
|
||||
|
||||
private class Listed(val modified: Long, val models: List<AgentHarness.Model>, val windows: Map<String, Long>)
|
||||
@Volatile private var listed: Listed? = null
|
||||
|
||||
private fun listed(rootfs: File): Listed? {
|
||||
val file = File(rootfs, MODELS)
|
||||
val modified = file.lastModified().takeIf { it > 0 } ?: return null
|
||||
listed?.takeIf { it.modified == modified }?.let { return it }
|
||||
return runCatching { listModels(file.readText()) }.getOrNull()?.let { (models, windows) -> Listed(modified, models, windows) }?.also { listed = it }
|
||||
}
|
||||
|
||||
override fun models(rootfs: File) = listed(rootfs)?.models.orEmpty()
|
||||
|
||||
/** `opencode models --verbose` prints each model's id on a line of its own, then its details as JSON. */
|
||||
@VisibleForTesting
|
||||
internal fun listModels(output: String): Pair<List<AgentHarness.Model>, Map<String, Long>> {
|
||||
val models = mutableListOf<AgentHarness.Model>()
|
||||
val windows = mutableMapOf<String, Long>()
|
||||
var id: String? = null
|
||||
val json = StringBuilder()
|
||||
for (line in output.lineSequence()) {
|
||||
val current = id
|
||||
if (current == null) {
|
||||
if (MODEL_ID.matches(line)) id = line.trim()
|
||||
continue
|
||||
}
|
||||
json.appendLine(line)
|
||||
if (line != "}") continue
|
||||
runCatching { JSONObject(json.toString()) }.getOrNull()?.takeIf { it.optString("status") != "deprecated" }?.let { o ->
|
||||
val provider = o.optString("providerID")
|
||||
val label = o.optString("name").ifEmpty { current }
|
||||
models += AgentHarness.Model(current, if (provider.isEmpty() || provider == "opencode") label else "$label · $provider")
|
||||
o.optJSONObject("limit")?.optLong("context")?.takeIf { it > 0 }?.let { windows[current] = it }
|
||||
}
|
||||
id = null
|
||||
json.clear()
|
||||
}
|
||||
return models to windows
|
||||
}
|
||||
|
||||
private val MODEL_ID = Regex("""^[\w.-]+/\S+$""")
|
||||
|
||||
private class Spent(var cost: Double = 0.0, var input: Long = 0, var output: Long = 0)
|
||||
private val spent = Spent()
|
||||
@Volatile private var model: String? = null
|
||||
|
||||
override fun turn(message: String, conversation: String?, options: AgentHarness.Options): List<String> {
|
||||
synchronized(spent) { spent.cost = 0.0; spent.input = 0; spent.output = 0 }
|
||||
model = options.model
|
||||
// DroidDeck runs the agent unattended; --auto approves all the agent does not deny itself, and plan mode denies edits.
|
||||
return buildList {
|
||||
addAll(listOf(binary, "run", "--format", "json", "--auto", "--thinking"))
|
||||
if (conversation != null) addAll(listOf("-s", conversation))
|
||||
if (options.plan) addAll(listOf("--agent", "plan"))
|
||||
options.model?.let { addAll(listOf("-m", it)) }
|
||||
options.effort?.let { addAll(listOf("--variant", it)) }
|
||||
add("--")
|
||||
// opencode run has no system prompt option, so a new conversation starts with the brief.
|
||||
add(if (conversation == null && options.brief != null) "${options.brief}\n\n$message" else message)
|
||||
}
|
||||
}
|
||||
|
||||
override fun usage(rootfs: File, conversation: String?): AgentEvent? {
|
||||
val id = model ?: return null
|
||||
return listed(rootfs)?.windows?.get(id)?.let { AgentEvent(window = it) }
|
||||
}
|
||||
|
||||
override fun parse(line: String): AgentEvent? {
|
||||
val o = runCatching { JSONObject(line) }.getOrNull() ?: return null
|
||||
val conversation = o.optString("sessionID").takeIf { it.isNotEmpty() }
|
||||
val part = o.optJSONObject("part")
|
||||
return when (o.optString("type")) {
|
||||
"text" -> AgentEvent(conversation, text(part) { AgentHost.Entry.Said(it) })
|
||||
"reasoning" -> AgentEvent(conversation, text(part) { AgentHost.Entry.Thought(it) })
|
||||
"tool_use" -> AgentEvent(conversation, part?.let { tool(it) }.orEmpty())
|
||||
"step_finish" -> {
|
||||
val tokens = part?.optJSONObject("tokens")
|
||||
val cache = tokens?.optJSONObject("cache")
|
||||
val total = synchronized(spent) {
|
||||
spent.cost += part?.optDouble("cost", 0.0) ?: 0.0
|
||||
spent.input += (tokens?.optLong("input") ?: 0) + (cache?.optLong("read") ?: 0) + (cache?.optLong("write") ?: 0)
|
||||
spent.output += (tokens?.optLong("output") ?: 0) + (tokens?.optLong("reasoning") ?: 0)
|
||||
AgentHost.Usage(0, spent.cost, spent.input, spent.output)
|
||||
}
|
||||
val context = tokens?.optLong("total")?.takeIf { it > 0 }
|
||||
// A step that ends to run tools is followed by another; any other reason ends the turn.
|
||||
if (part?.optString("reason") == "tool-calls") AgentEvent(conversation, context = context)
|
||||
else AgentEvent(conversation, listOf(AgentHost.Entry.Finished(null)), context = context, usage = total)
|
||||
}
|
||||
"error" -> {
|
||||
val error = o.optJSONObject("error")
|
||||
val message = error?.optJSONObject("data")?.optString("message")?.takeIf { it.isNotEmpty() }
|
||||
?: error?.optString("message")?.takeIf { it.isNotEmpty() } ?: error?.optString("name")?.takeIf { it.isNotEmpty() } ?: "error"
|
||||
AgentEvent(conversation, listOf(AgentHost.Entry.Finished(message)))
|
||||
}
|
||||
else -> conversation?.let { AgentEvent(it) }
|
||||
}
|
||||
}
|
||||
|
||||
private fun text(part: JSONObject?, entry: (String) -> AgentHost.Entry) =
|
||||
part?.optString("text")?.trim()?.takeIf { it.isNotEmpty() }?.let { listOf(entry(it)) }.orEmpty()
|
||||
|
||||
private fun tool(part: JSONObject): List<AgentHost.Entry> {
|
||||
val id = part.optString("callID").ifEmpty { part.optString("id") }
|
||||
val state = part.optJSONObject("state") ?: JSONObject()
|
||||
val input = state.optJSONObject("input") ?: JSONObject()
|
||||
val path = input.optString("filePath")
|
||||
val (name, detail, full) = when (val tool = part.optString("tool")) {
|
||||
"bash" -> Triple("Bash", firstLine(input.optString("command")), input.optString("command"))
|
||||
"edit" -> Triple("Edit", path, path + "\n" + lineDiff(input.optString("oldString"), input.optString("newString")))
|
||||
"write" -> Triple("Write", path, path + "\n" + lineDiff("", input.optString("content")))
|
||||
"todowrite" -> Triple("TodoWrite", "", todos(input.optJSONArray("todos")))
|
||||
else -> Triple(tool.replaceFirstChar { it.uppercase() }.ifEmpty { "Tool" }, detail(input), input.toString(2))
|
||||
}
|
||||
val used = AgentHost.Entry.Used(id, name, detail, full)
|
||||
return when (state.optString("status")) {
|
||||
"completed" -> {
|
||||
val exit = state.optJSONObject("metadata")?.opt("exit")
|
||||
listOf(used, AgentHost.Entry.Result(id, state.optString("output"), exit is Number && exit.toInt() != 0))
|
||||
}
|
||||
"error" -> listOf(used, AgentHost.Entry.Result(id, state.optString("error"), true))
|
||||
else -> listOf(used)
|
||||
}
|
||||
}
|
||||
|
||||
private fun detail(input: JSONObject): String {
|
||||
for (key in listOf("filePath", "path", "pattern", "url", "query", "description", "prompt", "command")) {
|
||||
input.optString(key).takeIf { it.isNotEmpty() }?.let { return firstLine(it) }
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
private fun todos(list: JSONArray?) = (0 until (list?.length() ?: 0)).mapNotNull { i ->
|
||||
val todo = list?.optJSONObject(i) ?: return@mapNotNull null
|
||||
val mark = when (todo.optString("status")) { "completed" -> "[x]"; "in_progress" -> "[~]"; else -> "[ ]" }
|
||||
"$mark ${todo.optString("content")}"
|
||||
}.joinToString("\n")
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
internal fun firstLine(text: String) = text.lineSequence().first().take(160)
|
||||
|
||||
|
||||
@@ -27,6 +27,28 @@ object AgentSetup {
|
||||
val detail = mutableStateMapOf<Step, String>()
|
||||
var runtimeInstalled by mutableStateOf(true)
|
||||
private set
|
||||
/** The harness has a key from its [AgentHarness.keyPage] saved; signed in without one means its free models. */
|
||||
var keySaved by mutableStateOf(false)
|
||||
private set
|
||||
|
||||
/** Saves a pasted key for a harness that signs in with one, then checks the sign-in again. */
|
||||
fun saveKey(context: Context, key: String) = signInLocally(context) { harness, root -> harness.saveKey(root, key) }
|
||||
|
||||
fun useFree(context: Context) = signInLocally(context) { harness, root -> harness.useFree(root) }
|
||||
|
||||
private fun signInLocally(context: Context, write: (AgentHarness, File) -> Unit) {
|
||||
val app = context.applicationContext
|
||||
val harness = AgentHost.harness
|
||||
set(Step.SIGN_IN, Status.WORKING)
|
||||
Thread({
|
||||
val result = runCatching { write(harness, LinuxRuntime.rootDir(app)) }
|
||||
main.post {
|
||||
status[Step.SIGN_IN] = Status.UNKNOWN
|
||||
result.exceptionOrNull()?.let { detail[Step.SIGN_IN] = it.message ?: "failed" }
|
||||
check(app)
|
||||
}
|
||||
}, "agent-sign-in").start()
|
||||
}
|
||||
|
||||
val ready: Boolean get() = Step.entries.filter { it.required }.all { status[it] == Status.DONE }
|
||||
|
||||
@@ -53,6 +75,7 @@ object AgentSetup {
|
||||
if (!runtimeInstalled) return
|
||||
AgentHost.refresh(app)
|
||||
val harness = AgentHost.harness
|
||||
keySaved = harness.hasKey(LinuxRuntime.rootDir(app))
|
||||
val probes = mutableListOf<Pair<Step, List<String>>>()
|
||||
for (step in Step.entries) if (status[step] != Status.WORKING) {
|
||||
when (step) {
|
||||
|
||||
@@ -16,13 +16,14 @@ import java.nio.file.attribute.BasicFileAttributes
|
||||
|
||||
/**
|
||||
* What the agent adds to the Linux userland, measured and removable piece by piece. Sign-ins
|
||||
* (~/.claude, ~/.codex, gh's config) are left alone, so removing a CLI and installing it again
|
||||
* does not sign out.
|
||||
* (~/.claude, ~/.codex, ~/.local/share/opencode, gh's config) are left alone, so removing a CLI
|
||||
* and installing it again does not sign out.
|
||||
*/
|
||||
object AgentStorage {
|
||||
enum class Item(val paths: List<String>) {
|
||||
CLAUDE_CODE(listOf("/root/.local/share/claude", "/root/.local/bin/claude", "/root/cc")),
|
||||
CODEX(listOf("/root/.local/bin/codex", "/root/.local/bin/codex-code-mode-host")),
|
||||
OPENCODE(listOf("/root/.opencode")),
|
||||
BUILD_TOOLS(listOf("/root/android-sdk", "/root/aapt2", "/root/x86root", "/root/.gradle")),
|
||||
SOURCE(listOf("/root/DroidDeck")),
|
||||
CACHES(listOf("/root/.cache", "/root/.npm")),
|
||||
|
||||
@@ -7,7 +7,7 @@ import androidx.compose.runtime.setValue
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
|
||||
object AgentTab {
|
||||
var shown by mutableStateOf(true)
|
||||
var shown by mutableStateOf(false)
|
||||
private set
|
||||
|
||||
val visible: Boolean get() = shown && AgentHost.available
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.droiddeck.launcher.core
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Process
|
||||
import android.util.Log
|
||||
import java.io.BufferedWriter
|
||||
@@ -113,7 +114,17 @@ object SessionLogCapture {
|
||||
}
|
||||
}
|
||||
|
||||
fun dumpMemoryPressure(target: File) {
|
||||
internal const val LMKD_COMMAND = "logcat -d -b main,events -v threadtime -s lowmemorykiller:D killinfo:I" +
|
||||
" | grep -v -E 'pgskip|zoneinfo_parse|polling check|thrashing:' | tail -n 120"
|
||||
|
||||
private fun lowMemoryKiller(context: Context?): String = when {
|
||||
context == null -> "(not captured)\n"
|
||||
!WirelessAdbFix.hasSavedPairing(context) -> "(not captured: pair DroidDeck with Wireless debugging in Settings > Diagnostics)\n"
|
||||
else -> runCatching { WirelessAdbFix.shell(context, LMKD_COMMAND) }
|
||||
.fold({ it.ifBlank { "(no lmkd lines in the log)\n" } }, { "(not captured: ${it.message})\n" })
|
||||
}
|
||||
|
||||
fun dumpMemoryPressure(target: File, context: Context? = null) {
|
||||
var temporary: File? = null
|
||||
try {
|
||||
val staged = File.createTempFile(target.name, ".part", target.parentFile).also { temporary = it }
|
||||
@@ -150,7 +161,8 @@ object SessionLogCapture {
|
||||
body.isNotEmpty() -> body
|
||||
else -> "(no readable events were returned)\n"
|
||||
} +
|
||||
"\n/proc/pressure/memory:\n$pressure\n/proc/meminfo:\n$meminfo\n/sys/class/kgsl/kgsl/page_alloc:\n$gpu"
|
||||
"\n/proc/pressure/memory:\n$pressure\n/proc/meminfo:\n$meminfo\n/sys/class/kgsl/kgsl/page_alloc:\n$gpu" +
|
||||
"\nAndroid's low memory killer (lmkd), read over Wireless debugging:\n${lowMemoryKiller(context)}"
|
||||
)
|
||||
Files.move(
|
||||
staged.toPath(), target.toPath(),
|
||||
|
||||
@@ -37,7 +37,7 @@ object SteamIntegration {
|
||||
locationOn = WifiDiscovery.locationEnabled(context),
|
||||
brightness = Settings.System.canWrite(context),
|
||||
home = HomeApp.isDefault(context),
|
||||
shortcuts = shortcutsEnabled(context),
|
||||
shortcuts = shortcutsEnabled(context) && shortcutsCurrent(context),
|
||||
shortcutsRestricted = restrictedSettings(context),
|
||||
suggested = !SessionPrefs.sessionPrefs(context).getBoolean("steam_integration_seen", false),
|
||||
)
|
||||
@@ -61,6 +61,10 @@ object SteamIntegration {
|
||||
return enabled.split(':').any { ComponentName.unflattenFromString(it.trim()) == shortcutsComponent }
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
fun shortcutsCurrent(context: Context): Boolean =
|
||||
runCatching { context.packageManager.getPackageInfo(Relay.PACKAGE, 0).versionCode }.getOrDefault(0) >= Relay.VERSION
|
||||
|
||||
fun shortcutsListed(context: Context): Boolean =
|
||||
context.getSystemService(android.view.accessibility.AccessibilityManager::class.java)
|
||||
?.installedAccessibilityServiceList.orEmpty()
|
||||
|
||||
@@ -335,7 +335,10 @@ object AddedGames {
|
||||
val path = canonical(exe)
|
||||
val owner = ownerFolder(app, exe)
|
||||
if (owner != null && owner.path !in SessionPrefs.removedAddedGames(app)) {
|
||||
single(app, owner.path)?.takeIf { canonical(it.exe) == path }?.let { return AddResult.Existing(it) }
|
||||
single(app, owner.path)?.takeIf { canonical(it.exe) == path }?.let {
|
||||
if (guestPath(app, exe) != null) AddedExes.put(app, AddedExes.Entry(owner.path, exe.path))
|
||||
return AddResult.Existing(it)
|
||||
}
|
||||
}
|
||||
if (guestPath(app, exe) == null) {
|
||||
(owner ?: exe.parentFile)?.takeIf { guestPath(app, it) == null }?.let { bindFolder(app, it) }
|
||||
@@ -344,7 +347,7 @@ object AddedGames {
|
||||
val folder = owner ?: exe.parentFile ?: return AddResult.NotFound
|
||||
SessionPrefs.setAddedGameRemoved(app, folder.path, false)
|
||||
SessionPrefs.setAddedGameExe(app, folder.path, exe.path)
|
||||
if (owner == null) AddedExes.put(app, AddedExes.Entry(folder.path, exe.path))
|
||||
AddedExes.put(app, AddedExes.Entry(folder.path, exe.path))
|
||||
val game = single(app, folder.path) ?: return AddResult.NotFound
|
||||
AddedGamesPublisher.later(app) { com.droiddeck.launcher.stores.SteamLiveShortcuts.sync(app, listOf(game)) { true } }
|
||||
Log.i(TAG, "added ${game.name} from its exe")
|
||||
|
||||
@@ -16,30 +16,36 @@ data class ScreenEffects(
|
||||
val hdr: Boolean = false,
|
||||
val deband: Boolean = false,
|
||||
val debandStrength: Int = 100,
|
||||
val fxaa: Boolean = false,
|
||||
val aaMode: Int = AA_OFF,
|
||||
val toon: Boolean = false,
|
||||
val crt: Boolean = false,
|
||||
val ntsc: Boolean = false,
|
||||
) {
|
||||
val fxaa: Boolean get() = aaMode == AA_FXAA
|
||||
val smaa: Boolean get() = aaMode == AA_SMAA
|
||||
val effectiveCas: Int get() = if (cas) casLevel else 0
|
||||
|
||||
val any: Boolean get() = brightness != 0 || contrast != 0 || abs(gamma - 1f) > 0.005f || saturation != 100 ||
|
||||
effectiveCas > 0 || hdr || deband || fxaa || toon || crt || ntsc
|
||||
effectiveCas > 0 || hdr || deband || aaMode != AA_OFF || toon || crt || ntsc
|
||||
|
||||
fun push(upscaler: Int) {
|
||||
WaylandCompositor.nativeSetCas(cas, casLevel)
|
||||
WaylandCompositor.nativeSetHdr(hdr)
|
||||
WaylandCompositor.nativeSetDeband(deband, debandStrength)
|
||||
WaylandCompositor.nativeSetScreenEffects(brightness.toFloat(), contrast.toFloat(), gamma, saturation.toFloat(), fxaa, toon, crt, ntsc)
|
||||
WaylandCompositor.nativeSetScreenEffects(brightness.toFloat(), contrast.toFloat(), gamma, saturation.toFloat(), aaMode, toon, crt, ntsc)
|
||||
WaylandCompositor.nativeSetLookName(ScreenEffectLooks.match(this, upscaler)?.name)
|
||||
}
|
||||
|
||||
fun encode(): JSONObject = JSONObject()
|
||||
.put("brightness", brightness).put("contrast", contrast).put("gamma", gamma.toDouble()).put("saturation", saturation)
|
||||
.put("cas", cas).put("casLevel", casLevel).put("hdr", hdr).put("deband", deband).put("debandStrength", debandStrength)
|
||||
.put("fxaa", fxaa).put("toon", toon).put("crt", crt).put("ntsc", ntsc)
|
||||
.put("aaMode", aaMode).put("fxaa", fxaa).put("toon", toon).put("crt", crt).put("ntsc", ntsc)
|
||||
|
||||
companion object {
|
||||
const val AA_OFF = 0
|
||||
const val AA_FXAA = 1
|
||||
const val AA_SMAA = 2
|
||||
|
||||
val OFF = ScreenEffects()
|
||||
|
||||
fun decode(json: JSONObject): ScreenEffects = ScreenEffects(
|
||||
@@ -52,7 +58,7 @@ data class ScreenEffects(
|
||||
hdr = json.optBoolean("hdr", false),
|
||||
deband = json.optBoolean("deband", false),
|
||||
debandStrength = json.optInt("debandStrength", 100).coerceIn(0, 200),
|
||||
fxaa = json.optBoolean("fxaa", false),
|
||||
aaMode = json.optInt("aaMode", if (json.optBoolean("fxaa", false)) AA_FXAA else AA_OFF).coerceIn(AA_OFF, AA_SMAA),
|
||||
toon = json.optBoolean("toon", false),
|
||||
crt = json.optBoolean("crt", false),
|
||||
ntsc = json.optBoolean("ntsc", false),
|
||||
@@ -79,13 +85,13 @@ object ScreenEffectLooks {
|
||||
desc = "Sharpening with a touch of contrast - the everyday one.", label = R.string.look_game_clarity, descRes = R.string.look_game_clarity_desc),
|
||||
Look("Vivid", ScreenEffects(brightness = 3, contrast = 10, gamma = 0.98f, saturation = 145, cas = true, casLevel = 30, deband = true),
|
||||
desc = "Colour pushed hard. Deband on so skies don't stripe.", label = R.string.look_vivid, descRes = R.string.look_vivid_desc),
|
||||
Look("Cinematic", ScreenEffects(brightness = -4, contrast = 22, gamma = 1.10f, saturation = 88, cas = true, casLevel = 20, fxaa = true, deband = true),
|
||||
Look("Cinematic", ScreenEffects(brightness = -4, contrast = 22, gamma = 1.10f, saturation = 88, cas = true, casLevel = 20, aaMode = ScreenEffects.AA_FXAA, deband = true),
|
||||
desc = "Deeper contrast, cooler colour, edges smoothed.", label = R.string.look_cinematic, descRes = R.string.look_cinematic_desc),
|
||||
Look("Competitive", ScreenEffects(brightness = 16, contrast = 18, gamma = 0.92f, saturation = 82, cas = true, casLevel = 75),
|
||||
desc = "Shadows lifted and heavy sharpening - spot people first.", label = R.string.look_competitive, descRes = R.string.look_competitive_desc),
|
||||
Look("Adaptive Sharpen", ScreenEffects(cas = true, casLevel = 85),
|
||||
desc = "Sharpening only, colour untouched.", label = R.string.look_adaptive_sharpen, descRes = R.string.look_adaptive_sharpen_desc),
|
||||
Look("Filmic", ScreenEffects(brightness = -2, contrast = 16, gamma = 1.14f, saturation = 92, cas = true, casLevel = 15, fxaa = true, deband = true),
|
||||
Look("Filmic", ScreenEffects(brightness = -2, contrast = 16, gamma = 1.14f, saturation = 92, cas = true, casLevel = 15, aaMode = ScreenEffects.AA_FXAA, deband = true),
|
||||
desc = "Film-like curve, slightly muted.", label = R.string.look_filmic, descRes = R.string.look_filmic_desc),
|
||||
Look("Arcade", ScreenEffects(brightness = 6, contrast = 20, gamma = 0.95f, saturation = 170, cas = true, casLevel = 45, deband = true),
|
||||
desc = "Loud and punchy.", label = R.string.look_arcade, descRes = R.string.look_arcade_desc),
|
||||
@@ -103,7 +109,7 @@ object ScreenEffectLooks {
|
||||
val t = l.effects
|
||||
t.brightness == e.brightness && t.contrast == e.contrast && abs(t.gamma - e.gamma) < 0.005f &&
|
||||
t.saturation == e.saturation && t.effectiveCas == e.effectiveCas &&
|
||||
t.fxaa == e.fxaa && t.crt == e.crt && t.toon == e.toon && t.ntsc == e.ntsc && t.deband == e.deband &&
|
||||
t.aaMode == e.aaMode && t.crt == e.crt && t.toon == e.toon && t.ntsc == e.ntsc && t.deband == e.deband &&
|
||||
(l.scalingMode == null || l.scalingMode == upscaler)
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import com.droiddeck.launcher.session.SessionPrefs
|
||||
|
||||
internal object DroidDeckHudConfig {
|
||||
val DEFAULTS: Map<String, String> = linkedMapOf(
|
||||
"hudSize" to "minimal", "hudLocked" to "1", "hudSnap" to "1", "hudScale" to "100", "hudDock" to "none", "hudOpacity" to "80", "hudColor" to "mid",
|
||||
"hudSize" to "minimal", "hudLocked" to "1", "hudHold" to "collapse", "hudSnap" to "1", "hudScale" to "100", "hudDock" to "none", "hudOpacity" to "80", "hudColor" to "mid",
|
||||
"hudOutline" to "40", "hudOutlineAccent" to "1",
|
||||
"showGpuModel" to "1", "showGPULoad" to "1", "showCPUUsage" to "1", "showCPULoad" to "1",
|
||||
"showPerCore" to "1", "showTemp" to "1", "showBatteryTemp" to "1", "showGpuTemp" to "0",
|
||||
@@ -18,6 +18,8 @@ internal object DroidDeckHudConfig {
|
||||
"tempUnit" to "c", "tempBands" to "1", "tempAuto" to "1", "tempRedCpu" to "90", "tempRedGpu" to "90", "tempRedBat" to "48",
|
||||
)
|
||||
|
||||
const val HOLD_LOCKS = "lock"
|
||||
|
||||
private val NOT_READINGS = setOf("showCPULoad", "showRenderer", "fpsDecimal")
|
||||
|
||||
/** Orders saved before the GPU switch was named after the alias the HUD actually reads. */
|
||||
|
||||
@@ -119,6 +119,7 @@ class DroidDeckHudHost(context: Context) {
|
||||
}
|
||||
hud.setOnSizeCycledListener { size -> DroidDeckHudConfig.set(context, "hudSize", size); onConfigChanged?.invoke() }
|
||||
hud.setOnDockChangedListener { token -> setDock(hud, DroidDeckHudDock.from(token)) }
|
||||
hud.setOnHoldListener { rawX, rawY -> collapseAt(hud, rawX, rawY) }
|
||||
hud.setOnScaledListener { percent ->
|
||||
DroidDeckHudConfig.set(context, "hudScale", percent.toString())
|
||||
onConfigChanged?.invoke()
|
||||
@@ -291,7 +292,7 @@ class DroidDeckHudHost(context: Context) {
|
||||
DroidDeckHudDock.RIGHT -> (maxX - hud.x) / hud.width
|
||||
DroidDeckHudDock.TOP -> hud.y / hud.height
|
||||
DroidDeckHudDock.BOTTOM -> (maxY - hud.y) / hud.height
|
||||
DroidDeckHudDock.NONE -> 0f
|
||||
DroidDeckHudDock.NONE, DroidDeckHudDock.FLOAT -> 0f
|
||||
}
|
||||
if (pulled >= 1f) { setDock(hud, DroidDeckHudDock.NONE); return }
|
||||
wantX = hud.x; wantY = hud.y
|
||||
@@ -375,12 +376,30 @@ class DroidDeckHudHost(context: Context) {
|
||||
hud.scaleX = s; hud.scaleY = s
|
||||
}
|
||||
|
||||
private fun setDock(hud: DroidDeckHudView, edge: DroidDeckHudDock) {
|
||||
private fun setDock(hud: DroidDeckHudView, edge: DroidDeckHudDock, center: Pair<Float, Float>? = null) {
|
||||
if (edge == hud.dock) return
|
||||
animateDock(hud, edge) { commitDock(hud, edge) }
|
||||
animateDock(hud, edge, center) { commitDock(hud, edge) }
|
||||
}
|
||||
|
||||
private fun collapseAt(hud: DroidDeckHudView, rawX: Float, rawY: Float) {
|
||||
if (hud.dock != DroidDeckHudDock.NONE) return
|
||||
val p = hud.parent as? View ?: return
|
||||
val at = IntArray(2).also { p.getLocationOnScreen(it) }
|
||||
val x = rawX - at[0]
|
||||
val y = rawY - at[1]
|
||||
val edge = if (snaps) nearestEdge(x, y, p.width.toFloat(), p.height.toFloat()) else DroidDeckHudDock.FLOAT
|
||||
setDock(hud, edge, Pair(x, y))
|
||||
}
|
||||
|
||||
private fun nearestEdge(x: Float, y: Float, width: Float, height: Float): DroidDeckHudDock = mapOf(
|
||||
DroidDeckHudDock.LEFT to x,
|
||||
DroidDeckHudDock.RIGHT to width - x,
|
||||
DroidDeckHudDock.TOP to y,
|
||||
DroidDeckHudDock.BOTTOM to height - y,
|
||||
).minByOrNull { it.value }!!.key
|
||||
|
||||
private fun commitDock(hud: DroidDeckHudView, edge: DroidDeckHudDock) {
|
||||
snapping = false
|
||||
val tabX = hud.x; val tabY = hud.y
|
||||
if (edge != DroidDeckHudDock.NONE) {
|
||||
val p = hud.parent as? View
|
||||
@@ -407,12 +426,17 @@ class DroidDeckHudHost(context: Context) {
|
||||
SessionPrefs.setDroidDeckHudPosition(context, wantX, wantY)
|
||||
}
|
||||
|
||||
private fun animateDock(hud: DroidDeckHudView, edge: DroidDeckHudDock, commit: () -> Unit) {
|
||||
private fun animateDock(hud: DroidDeckHudView, edge: DroidDeckHudDock, center: Pair<Float, Float>?, commit: () -> Unit) {
|
||||
stopMotion(hud)
|
||||
previewFade?.cancel(); previewFade = null
|
||||
snapping = false
|
||||
hud.alpha = 1f
|
||||
val p = hud.parent as? View
|
||||
if (edge != DroidDeckHudDock.NONE && center != null) {
|
||||
val (tabW, tabH) = hud.dockTabSize()
|
||||
wantX = center.first - tabW / 2f
|
||||
wantY = center.second - tabH / 2f
|
||||
}
|
||||
if (Motion.scale == 0f || p == null || !hud.isLaidOut || hud.width <= 0) {
|
||||
hud.scaleX = 1f; hud.scaleY = 1f
|
||||
hud.setDockPreview(DroidDeckHudDock.NONE, 0f)
|
||||
@@ -424,11 +448,14 @@ class DroidDeckHudHost(context: Context) {
|
||||
hud.pivotX = 0f; hud.pivotY = 0f
|
||||
hud.x = left; hud.y = top
|
||||
val (tabW, tabH) = hud.dockTabSize()
|
||||
wantX = left + (shownW - tabW) / 2f
|
||||
wantY = top + (shownH - tabH) / 2f
|
||||
if (center == null) {
|
||||
wantX = left + (shownW - tabW) / 2f
|
||||
wantY = top + (shownH - tabH) / 2f
|
||||
}
|
||||
val (tabX, tabY) = settled(p, edge, tabW, tabH)
|
||||
val sx = tabW / hud.width; val sy = tabH / hud.height
|
||||
val from = hud.dockPreviewBlend
|
||||
snapping = true
|
||||
hud.animate().x(tabX).y(tabY).scaleX(sx).scaleY(sy).setDuration(Motion.ms(220).toLong()).setInterpolator(EASE)
|
||||
.setUpdateListener { hud.setDockPreview(edge, from + (1f - from) * it.animatedFraction) }
|
||||
.withEndAction {
|
||||
@@ -473,7 +500,7 @@ class DroidDeckHudHost(context: Context) {
|
||||
DroidDeckHudDock.RIGHT -> x = maxX
|
||||
DroidDeckHudDock.TOP -> y = 0f
|
||||
DroidDeckHudDock.BOTTOM -> y = maxY
|
||||
DroidDeckHudDock.NONE -> {}
|
||||
DroidDeckHudDock.NONE, DroidDeckHudDock.FLOAT -> {}
|
||||
}
|
||||
return Pair(x, y)
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ enum class DroidDeckHudSize(val token: String, val label: String) {
|
||||
}
|
||||
|
||||
enum class DroidDeckHudDock(val token: String) {
|
||||
NONE("none"), LEFT("left"), RIGHT("right"), TOP("top"), BOTTOM("bottom");
|
||||
NONE("none"), LEFT("left"), RIGHT("right"), TOP("top"), BOTTOM("bottom"), FLOAT("float");
|
||||
|
||||
companion object {
|
||||
fun from(token: String?): DroidDeckHudDock = values().firstOrNull { it.token == token } ?: NONE
|
||||
|
||||
@@ -191,6 +191,8 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
private var onMovedListener: BiConsumer<Float, Float>? = null
|
||||
private var onSizeCycledListener: Consumer<String>? = null
|
||||
private var onLockChangedListener: Consumer<Boolean>? = null
|
||||
private var onHoldListener: BiConsumer<Float, Float>? = null
|
||||
fun setOnHoldListener(l: BiConsumer<Float, Float>?) { onHoldListener = l }
|
||||
fun setOnMovedListener(l: BiConsumer<Float, Float>?) { onMovedListener = l }
|
||||
fun setOnSizeCycledListener(l: Consumer<String>?) { onSizeCycledListener = l }
|
||||
fun setOnLockChangedListener(l: Consumer<Boolean>?) { onLockChangedListener = l }
|
||||
@@ -209,6 +211,7 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
override fun onDragged(rawX: Float, rawY: Float) { onDraggedListener?.accept(rawX, rawY) }
|
||||
override fun onFlung(velocityX: Float, velocityY: Float) { onFlungListener?.accept(velocityX, velocityY) }
|
||||
override fun onLockChanged(locked: Boolean) { onLockChangedListener?.accept(locked) }
|
||||
override fun onHold(rawX: Float, rawY: Float) { onHoldListener?.accept(rawX, rawY) }
|
||||
override fun onPinch(factor: Float) {
|
||||
val next = (scale * factor).coerceIn(MIN_SCALE, MAX_SCALE)
|
||||
if (next == scale) return
|
||||
@@ -224,6 +227,7 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
private var tabStartX = 0f
|
||||
private var tabStartY = 0f
|
||||
private var tabDragging = false
|
||||
private var tabPressed = false
|
||||
private var onTabDraggedListener: BiConsumer<Float, Float>? = null
|
||||
private var onTabDroppedListener: Runnable? = null
|
||||
private var onTabDragCancelledListener: Runnable? = null
|
||||
@@ -237,19 +241,24 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
tabDownRawX = event.rawX; tabDownRawY = event.rawY
|
||||
tabStartX = x; tabStartY = y
|
||||
tabDragging = false
|
||||
tabPressed = true
|
||||
}
|
||||
MotionEvent.ACTION_MOVE -> {
|
||||
MotionEvent.ACTION_MOVE -> if (tabPressed) {
|
||||
val dx = event.rawX - tabDownRawX; val dy = event.rawY - tabDownRawY
|
||||
if (!tabDragging && dx * dx + dy * dy > touchSlop * touchSlop) tabDragging = true
|
||||
if (tabDragging) onTabDraggedListener?.accept(tabStartX + dx, tabStartY + dy)
|
||||
}
|
||||
MotionEvent.ACTION_UP -> {
|
||||
MotionEvent.ACTION_UP -> if (tabPressed) {
|
||||
tabPressed = false
|
||||
if (tabDragging) { tabDragging = false; onTabDroppedListener?.run() }
|
||||
else onDockChangedListener?.accept(DroidDeckHudDock.NONE.token)
|
||||
}
|
||||
MotionEvent.ACTION_CANCEL -> if (tabDragging) {
|
||||
tabDragging = false
|
||||
onTabDragCancelledListener?.run()
|
||||
MotionEvent.ACTION_CANCEL -> {
|
||||
tabPressed = false
|
||||
if (tabDragging) {
|
||||
tabDragging = false
|
||||
onTabDragCancelledListener?.run()
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
@@ -341,6 +350,7 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
showSession = switchOn("showSession")
|
||||
tempDisplay = HudMetrics.TempDisplay.from(cfg)
|
||||
lockController.setLocked(cfg.get("hudLocked", "1") == "1")
|
||||
lockController.setHoldLocks(cfg.get("hudHold", "collapse") == DroidDeckHudConfig.HOLD_LOCKS)
|
||||
dock = DroidDeckHudDock.from(cfg.get("hudDock", "none"))
|
||||
|
||||
colorIntensity = when (cfg.get("hudColor", "vivid")) {
|
||||
@@ -591,7 +601,7 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
DroidDeckHudDock.RIGHT -> intArrayOf(1, 2)
|
||||
DroidDeckHudDock.TOP -> intArrayOf(0, 1)
|
||||
DroidDeckHudDock.BOTTOM -> intArrayOf(2, 3)
|
||||
DroidDeckHudDock.NONE -> intArrayOf()
|
||||
DroidDeckHudDock.NONE, DroidDeckHudDock.FLOAT -> intArrayOf()
|
||||
}
|
||||
for (corner in edge) { round[corner * 2] = 0f; round[corner * 2 + 1] = 0f }
|
||||
tabPath.rewind()
|
||||
|
||||
@@ -36,6 +36,7 @@ public class HudLockController {
|
||||
default void onDragged(float rawX, float rawY) {}
|
||||
default void onFlung(float velocityX, float velocityY) {}
|
||||
void onLockChanged(boolean locked);
|
||||
default void onHold(float rawX, float rawY) {}
|
||||
default void onPinch(float factor) {}
|
||||
default void onPinchEnd() {}
|
||||
}
|
||||
@@ -53,6 +54,7 @@ public class HudLockController {
|
||||
private final android.view.VelocityTracker velocity = android.view.VelocityTracker.obtain();
|
||||
|
||||
private boolean locked = false;
|
||||
private boolean holdLocks = false;
|
||||
|
||||
private float downRawX, downRawY, startX, startY;
|
||||
private boolean dragging = false;
|
||||
@@ -80,6 +82,8 @@ public class HudLockController {
|
||||
|
||||
public void setLocked(boolean locked) { this.locked = locked; }
|
||||
|
||||
public void setHoldLocks(boolean holdLocks) { this.holdLocks = holdLocks; }
|
||||
|
||||
public boolean isLocked() { return locked; }
|
||||
|
||||
public boolean isDragging() { return dragging; }
|
||||
@@ -119,6 +123,10 @@ public class HudLockController {
|
||||
|
||||
@Override
|
||||
public void onLongPress(MotionEvent e) {
|
||||
if (!holdLocks) {
|
||||
cb.onHold(e.getRawX(), e.getRawY());
|
||||
return;
|
||||
}
|
||||
locked = !locked;
|
||||
cb.onLockChanged(locked);
|
||||
flash(locked, HOLD_TOGGLE_MS);
|
||||
|
||||
@@ -82,6 +82,12 @@ object DualScreen {
|
||||
fun sessionDisplay(context: Context, displayManager: DisplayManager, primaryDisplayId: Int): Display? =
|
||||
display(context, displayManager, primaryDisplayId, SessionPrefs.dualScreenSessionMode(context))
|
||||
|
||||
fun selectedSessionDisplay(context: Context, displayManager: DisplayManager, primaryDisplayId: Int, selectedDisplayId: Int): Display? =
|
||||
displayManager.getDisplay(selectedDisplayId)?.takeIf {
|
||||
SessionPrefs.dualScreenSessionMode(context) != MODE_OFF && it.isValid && it.displayId != primaryDisplayId &&
|
||||
(it.flags and Display.FLAG_PRESENTATION) != 0 && !taken(it.displayId)
|
||||
}
|
||||
|
||||
fun display(context: Context, displayManager: DisplayManager, primaryDisplayId: Int, mode: String = SessionPrefs.dualScreenMode(context)): Display? =
|
||||
when (mode) {
|
||||
MODE_OFF -> null
|
||||
|
||||
@@ -97,6 +97,16 @@ data class InputLibrary(
|
||||
fun compileActive(isDesktop: Boolean, panel: String? = null): InputProfile = compileParts(activeId(isDesktop), InputRole.entries.associateWith {
|
||||
preset(if (it == InputRole.SECONDARY) panelPart(isDesktop, panel).bindings else activePart(isDesktop, it).bindings)
|
||||
})
|
||||
fun compileStock(isDesktop: Boolean, panel: String? = null): InputProfile {
|
||||
val defaults = InputProfile.defaults(profile(activeId(isDesktop)).base)
|
||||
val stock = InputStockLayouts.presets(InputStockLayouts.layouts())
|
||||
return compileParts(defaults.id, InputRole.entries.associateWith { role ->
|
||||
val part = if (role == InputRole.SECONDARY) panelPart(isDesktop, panel) else activePart(isDesktop, role)
|
||||
val origin = layouts.firstOrNull { it.id == part.layout }?.origin ?: part.layout
|
||||
stock.firstOrNull { it.id == part.bindings || (origin != null && it.layoutId == origin) }
|
||||
?: SavedInputBindings(part.bindings, "", role == InputRole.PHYSICAL, part.layout, defaults.bindings[role].orEmpty())
|
||||
})
|
||||
}
|
||||
|
||||
fun saveSelection(isDesktop: Boolean, name: String, id: String = newInputId()): InputLibrary {
|
||||
val current = profile(activeId(isDesktop))
|
||||
|
||||
@@ -53,6 +53,16 @@ data class InputProfile(
|
||||
fun elementClickAction(role: InputRole, element: InputSurfaceElement): InputAction = clicks[role]?.get(element.id)
|
||||
?: defaultElementClick(element, elementAction(role, element.id, element.control)) { action(role, it) }
|
||||
|
||||
fun showsMouseButton(role: InputRole, shown: List<InputSurfaceElement>, stock: InputProfile): Boolean = shown.any { element ->
|
||||
val action = elementAction(role, element.id, element.control).takeIf {
|
||||
elements[role]?.get(element.id) != stock.elements[role]?.get(element.id) || it != stock.elementAction(role, element.id, element.control)
|
||||
}
|
||||
val click = elementClickAction(role, element).takeIf {
|
||||
clicks[role]?.get(element.id) != stock.clicks[role]?.get(element.id) || it != stock.elementClickAction(role, element)
|
||||
}
|
||||
listOfNotNull(action, click).any { it is InputAction.MouseButton && it.validFor(element.control) }
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val GAME = "game"
|
||||
const val DESKTOP = "desktop"
|
||||
|
||||
@@ -26,6 +26,8 @@ class KeyboardHost(
|
||||
var imeShowing = false
|
||||
private set
|
||||
var onImeChanged: ((Boolean) -> Unit)? = null
|
||||
val hideMeansDismissal: Boolean
|
||||
get() = Build.VERSION.SDK_INT < Build.VERSION_CODES.R || (shown && imeShowing)
|
||||
|
||||
init {
|
||||
isFocusable = false
|
||||
|
||||
@@ -176,7 +176,7 @@ internal class LegacyGamepadLayout(private val context: Context, private val wid
|
||||
}
|
||||
|
||||
|
||||
fun elements(): List<InputSurfaceElement> {
|
||||
fun elements(previousStickGeometry: Boolean = false): List<InputSurfaceElement> {
|
||||
fit = fitScale()
|
||||
controls.forEach { it.radius = scaled(it.radiusDp) }
|
||||
placeAuto(width.toFloat(), height.toFloat())
|
||||
@@ -189,7 +189,7 @@ internal class LegacyGamepadLayout(private val context: Context, private val wid
|
||||
}.map { c ->
|
||||
InputSurfaceElement(requireNotNull(InputControl.fromId(c.id)), (c.cx - c.halfW) / width, (c.cy - c.halfH) / height,
|
||||
2 * c.halfW / width, 2 * c.halfH / height, floating = settings.adaptiveSticks, hideWhenIdle = c.stick >= 0 && settings.adaptiveSticks,
|
||||
buttonShape = if (c.id in shoulderIds) InputButtonShape.PILL else InputButtonShape.CIRCLE).let(::widenStick).bounded()
|
||||
buttonShape = if (c.id in shoulderIds) InputButtonShape.PILL else InputButtonShape.CIRCLE).let { if (previousStickGeometry) widenStickPreviously(it) else widenStick(it) }.bounded()
|
||||
}.toMutableList()
|
||||
if (settings.keyboardButton) result += keyboard()
|
||||
return result
|
||||
@@ -315,7 +315,7 @@ internal class LegacyGamepadLayout(private val context: Context, private val wid
|
||||
return e.copy(x = (cx - radius) / width, y = (cy - radius) / height, width = 2 * radius / width, height = 2 * radius / height)
|
||||
}
|
||||
|
||||
private fun widenStick(e: InputSurfaceElement): InputSurfaceElement {
|
||||
private fun widenStickPreviously(e: InputSurfaceElement): InputSurfaceElement {
|
||||
val extra = e.width * (STICK_REACH - 1f)
|
||||
return when (e.control) {
|
||||
InputControl.LS -> (e.x - extra).coerceAtLeast(0f).let { x -> e.copy(x = x, width = e.x + e.width - x) }
|
||||
@@ -323,6 +323,16 @@ internal class LegacyGamepadLayout(private val context: Context, private val wid
|
||||
else -> e
|
||||
}
|
||||
}
|
||||
|
||||
private fun widenStick(e: InputSurfaceElement): InputSurfaceElement {
|
||||
val extra = e.width * (STICK_REACH - 1f)
|
||||
val width = e.width + extra
|
||||
return when (e.control) {
|
||||
InputControl.LS -> e.copy(x = (e.x - extra).coerceIn(0f, (1f - width).coerceAtLeast(0f)), width = width)
|
||||
InputControl.RS -> e.copy(x = e.x.coerceIn(0f, (1f - width).coerceAtLeast(0f)), width = width)
|
||||
else -> e
|
||||
}
|
||||
}
|
||||
private companion object {
|
||||
const val MIN_FACE_MM = 9.5f
|
||||
const val FULL_SIZE_HEIGHT_MM = 85f
|
||||
|
||||
@@ -32,6 +32,7 @@ class OnScreenControls(context: Context, pad: PadBridge?, val dock: OnScreenLayo
|
||||
var isPinnedOnly = false
|
||||
private set
|
||||
val hasPinned get() = layout?.elements?.any { it.alwaysShown } == true
|
||||
val inputSurface: com.droiddeck.launcher.ui.InputSurfaceView get() = surface
|
||||
var onTouchMiss: ((MotionEvent) -> Unit)?
|
||||
get() = surface.onTouchMiss
|
||||
set(value) { surface.onTouchMiss = value }
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.graphics.Rect
|
||||
import kotlin.math.abs
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
object OnScreenLayout {
|
||||
data class Dock(val portrait: Boolean, val grips: Boolean, val left: InputControl = InputControl.LS, val right: InputControl = InputControl.RS) {
|
||||
@@ -41,6 +42,14 @@ object OnScreenLayout {
|
||||
return stored.mapNotNull { byId[it.id] } + placed.filter { p -> stored.none { it.id == p.id } }
|
||||
}
|
||||
|
||||
fun editorElements(context: Context, layout: SavedInputLayout, width: Int, height: Int, edited: Boolean = false): List<InputSurfaceElement> =
|
||||
elements(context, if (edited && width > 0 && height > 0) layout.copy(aspect = width.toFloat() / height) else layout, width, height, Rect())
|
||||
|
||||
fun editorFrame(layout: SavedInputLayout, displayed: List<InputSurfaceElement>): List<InputSurfaceElement> {
|
||||
val byId = displayed.associateBy { it.id }
|
||||
return layout.elements.map { byId[it.id] ?: it }
|
||||
}
|
||||
|
||||
fun fit(elements: List<InputSurfaceElement>, referenceWidth: Float, referenceHeight: Float, width: Int, height: Int, safe: Rect): List<InputSurfaceElement> {
|
||||
val w = width.toFloat()
|
||||
val h = height.toFloat()
|
||||
@@ -77,8 +86,11 @@ object OnScreenLayout {
|
||||
if (gamepad.any { it.id.startsWith("legacy:") }) {
|
||||
val named = layout.id.removePrefix("migrated.layout.").takeIf { it != layout.id }?.split('x')?.mapNotNull { it.toIntOrNull() }
|
||||
?.takeIf { it.size == 2 && it.all { size -> size > 0 } }?.let { it[0] to it[1] }
|
||||
for ((w, h) in listOfNotNull(named, width to height, long to short, short to long).distinct()) {
|
||||
if (matches(gamepad, LegacyGamepadLayout(display, w, h, scale = layout.scale).elements())) return (w.toFloat() to h.toFloat()) to true
|
||||
val aspectSize = layout.aspect.takeIf { layout.id == InputLibraries.OVERLAY && it > 0f }
|
||||
?.let { (it * height).roundToInt().coerceAtLeast(1) to height }
|
||||
for ((w, h) in listOfNotNull(named, width to height, aspectSize, long to short, short to long).distinct()) {
|
||||
val generator = LegacyGamepadLayout(display, w, h, scale = layout.scale)
|
||||
if (matches(gamepad, generator.elements()) || matches(gamepad, generator.elements(previousStickGeometry = true))) return (w.toFloat() to h.toFloat()) to true
|
||||
}
|
||||
}
|
||||
val aspect = layout.aspect.takeIf { it > 0f } ?: (long.toFloat() / short)
|
||||
|
||||
@@ -12,6 +12,8 @@ import com.droiddeck.launcher.session.SessionState;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicIntegerArray;
|
||||
|
||||
public final class PadBridge {
|
||||
@@ -56,6 +58,7 @@ public final class PadBridge {
|
||||
private final FakeInputWriter[] playerWriters = new FakeInputWriter[SLOTS];
|
||||
private final PadState[] playerStates = new PadState[SLOTS];
|
||||
private final float[][] rawSticks = new float[SLOTS][4];
|
||||
private final Map<Integer, Boolean> rightStickLayouts = new HashMap<>();
|
||||
private final boolean[][] keyTriggers = new boolean[SLOTS][2];
|
||||
private final int[] retainedSticks = new int[SLOTS];
|
||||
private final PadState effectiveState = new PadState();
|
||||
@@ -240,6 +243,7 @@ public final class PadBridge {
|
||||
clearBackQamWrites();
|
||||
releaseBackPaddles();
|
||||
activeControllerId = NO_CONTROLLER;
|
||||
rightStickLayouts.clear();
|
||||
for (int slot = 0; slot < SLOTS; slot++) {
|
||||
owners[slot] = NO_CONTROLLER;
|
||||
partners[slot] = NO_CONTROLLER;
|
||||
@@ -525,20 +529,23 @@ public final class PadBridge {
|
||||
float lx = event.getAxisValue(MotionEvent.AXIS_X);
|
||||
float ly = event.getAxisValue(MotionEvent.AXIS_Y);
|
||||
boolean wired = wiredXboxLayout(device, event.getSource());
|
||||
float rx = event.getAxisValue(wired ? MotionEvent.AXIS_RX : MotionEvent.AXIS_Z);
|
||||
float ry = event.getAxisValue(wired ? MotionEvent.AXIS_RY : MotionEvent.AXIS_RZ);
|
||||
boolean rxRyStick = rightStickUsesRxRy(event, device, rightStickLayouts);
|
||||
float rx = event.getAxisValue(rxRyStick ? MotionEvent.AXIS_RX : MotionEvent.AXIS_Z);
|
||||
float ry = event.getAxisValue(rxRyStick ? MotionEvent.AXIS_RY : MotionEvent.AXIS_RZ);
|
||||
retainStick(slot, JoyCon.LEFT, lx, ly);
|
||||
retainStick(slot, JoyCon.RIGHT, rx, ry);
|
||||
projectSticks(slot);
|
||||
int source = event.getSource();
|
||||
float lt = 0f;
|
||||
float rt = 0f;
|
||||
if (wired || hasAxis(device, source, MotionEvent.AXIS_LTRIGGER, MotionEvent.AXIS_BRAKE)) {
|
||||
lt = axisTrigger(leftTrigger(event, wired), keyTriggers[slot], 0);
|
||||
boolean signedLeft = signedZTriggers(event, device, wired, rxRyStick, true);
|
||||
boolean signedRight = signedZTriggers(event, device, wired, rxRyStick, false);
|
||||
if (signedLeft || hasAxis(device, source, MotionEvent.AXIS_LTRIGGER, MotionEvent.AXIS_BRAKE)) {
|
||||
lt = axisTrigger(triggerValue(event, device, wired, rxRyStick, true), keyTriggers[slot], 0);
|
||||
pad.leftTrigger = lt;
|
||||
}
|
||||
if (wired || hasAxis(device, source, MotionEvent.AXIS_RTRIGGER, MotionEvent.AXIS_GAS)) {
|
||||
rt = axisTrigger(rightTrigger(event, wired), keyTriggers[slot], 1);
|
||||
if (signedRight || hasAxis(device, source, MotionEvent.AXIS_RTRIGGER, MotionEvent.AXIS_GAS)) {
|
||||
rt = axisTrigger(triggerValue(event, device, wired, rxRyStick, false), keyTriggers[slot], 1);
|
||||
pad.rightTrigger = rt;
|
||||
}
|
||||
if (hasAxis(device, source, MotionEvent.AXIS_HAT_X)) {
|
||||
@@ -596,6 +603,92 @@ public final class PadBridge {
|
||||
return false;
|
||||
}
|
||||
|
||||
static boolean rightStickUsesRxRy(MotionEvent event, InputDevice device, Map<Integer, Boolean> layouts) {
|
||||
int source = event.getSource();
|
||||
if (wiredXboxLayout(device, source)) return true;
|
||||
boolean hasRxRy = hasAxis(device, source, MotionEvent.AXIS_RX)
|
||||
&& hasAxis(device, source, MotionEvent.AXIS_RY);
|
||||
boolean hasZRz = hasAxis(device, source, MotionEvent.AXIS_Z)
|
||||
&& hasAxis(device, source, MotionEvent.AXIS_RZ);
|
||||
if (!hasRxRy) return false;
|
||||
if (!hasZRz) return true;
|
||||
Boolean cached = layouts.get(event.getDeviceId());
|
||||
if (cached != null) return cached;
|
||||
boolean rxRyEvidence = atMinimum(device, source, event, MotionEvent.AXIS_Z, MotionEvent.AXIS_RZ)
|
||||
&& nearCentre(device, source, event, MotionEvent.AXIS_RX, MotionEvent.AXIS_RY);
|
||||
boolean zRzEvidence = atMinimum(device, source, event, MotionEvent.AXIS_RX, MotionEvent.AXIS_RY)
|
||||
&& nearCentre(device, source, event, MotionEvent.AXIS_Z, MotionEvent.AXIS_RZ);
|
||||
if (rxRyEvidence == zRzEvidence) return false;
|
||||
boolean useRxRy = rxRyEvidence;
|
||||
layouts.put(event.getDeviceId(), useRxRy);
|
||||
return useRxRy;
|
||||
}
|
||||
|
||||
static boolean signedZTriggers(MotionEvent event, InputDevice device, boolean wired, boolean rxRyStick, boolean left) {
|
||||
if (wired) return true;
|
||||
if (!rxRyStick) return false;
|
||||
int source = event.getSource();
|
||||
int signedAxis = left ? MotionEvent.AXIS_Z : MotionEvent.AXIS_RZ;
|
||||
int dedicatedAxis = left ? MotionEvent.AXIS_LTRIGGER : MotionEvent.AXIS_RTRIGGER;
|
||||
int alternateAxis = left ? MotionEvent.AXIS_BRAKE : MotionEvent.AXIS_GAS;
|
||||
return hasAxis(device, source, signedAxis)
|
||||
&& !hasAxis(device, source, dedicatedAxis, alternateAxis);
|
||||
}
|
||||
|
||||
static float triggerValue(MotionEvent event, InputDevice device, boolean wired, boolean rxRyStick, boolean left) {
|
||||
if (signedZTriggers(event, device, wired, rxRyStick, left)) {
|
||||
int axis = left ? MotionEvent.AXIS_Z : MotionEvent.AXIS_RZ;
|
||||
float value = event.getAxisValue(axis);
|
||||
if (!wired && device != null) {
|
||||
InputDevice.MotionRange range = device.getMotionRange(axis, event.getSource());
|
||||
if (range != null && range.getMax() > range.getMin()) {
|
||||
return Math.max(0f, Math.min(1f,
|
||||
(value - range.getMin()) / (range.getMax() - range.getMin())));
|
||||
}
|
||||
}
|
||||
return Math.max(0f, Math.min(1f, (value + 1f) / 2f));
|
||||
}
|
||||
int source = event.getSource();
|
||||
int axis = left ? MotionEvent.AXIS_LTRIGGER : MotionEvent.AXIS_RTRIGGER;
|
||||
int alternate = left ? MotionEvent.AXIS_BRAKE : MotionEvent.AXIS_GAS;
|
||||
if (device == null) {
|
||||
float value = event.getAxisValue(axis);
|
||||
return value != 0f ? value : event.getAxisValue(alternate);
|
||||
}
|
||||
if (hasAxis(device, source, axis)) {
|
||||
float value = event.getAxisValue(axis);
|
||||
return value != 0f ? value : event.getAxisValue(alternate);
|
||||
}
|
||||
if (hasAxis(device, source, alternate)) return event.getAxisValue(alternate);
|
||||
return 0f;
|
||||
}
|
||||
|
||||
private static float restDistance(InputDevice device, int source, MotionEvent event, int xAxis, int yAxis) {
|
||||
return (restDistance(device.getMotionRange(xAxis, source), event.getAxisValue(xAxis))
|
||||
+ restDistance(device.getMotionRange(yAxis, source), event.getAxisValue(yAxis))) / 2f;
|
||||
}
|
||||
|
||||
private static float restDistance(InputDevice.MotionRange range, float value) {
|
||||
float span = range.getMax() - range.getMin();
|
||||
if (span <= 0f) return 1f;
|
||||
return Math.abs(value - (range.getMin() + range.getMax()) / 2f) / span;
|
||||
}
|
||||
|
||||
private static boolean atMinimum(InputDevice device, int source, MotionEvent event, int xAxis, int yAxis) {
|
||||
return atMinimum(device.getMotionRange(xAxis, source), event.getAxisValue(xAxis))
|
||||
&& atMinimum(device.getMotionRange(yAxis, source), event.getAxisValue(yAxis));
|
||||
}
|
||||
|
||||
private static boolean atMinimum(InputDevice.MotionRange range, float value) {
|
||||
float span = range.getMax() - range.getMin();
|
||||
return value - range.getMin() <= span * 0.02f;
|
||||
}
|
||||
|
||||
private static boolean nearCentre(InputDevice device, int source, MotionEvent event, int xAxis, int yAxis) {
|
||||
return restDistance(device.getMotionRange(xAxis, source), event.getAxisValue(xAxis)) <= 0.1f
|
||||
&& restDistance(device.getMotionRange(yAxis, source), event.getAxisValue(yAxis)) <= 0.1f;
|
||||
}
|
||||
|
||||
public interface TouchRoute {
|
||||
boolean active();
|
||||
|
||||
@@ -1182,16 +1275,4 @@ public final class PadBridge {
|
||||
&& device.getMotionRange(MotionEvent.AXIS_RZ, source) != null;
|
||||
}
|
||||
|
||||
public static float leftTrigger(MotionEvent event, boolean wired) {
|
||||
if (wired) return Math.max(0f, Math.min(1f, (event.getAxisValue(MotionEvent.AXIS_Z) + 1f) / 2f));
|
||||
float value = event.getAxisValue(MotionEvent.AXIS_LTRIGGER);
|
||||
return value != 0f ? value : event.getAxisValue(MotionEvent.AXIS_BRAKE);
|
||||
}
|
||||
|
||||
public static float rightTrigger(MotionEvent event, boolean wired) {
|
||||
if (wired) return Math.max(0f, Math.min(1f, (event.getAxisValue(MotionEvent.AXIS_RZ) + 1f) / 2f));
|
||||
float value = event.getAxisValue(MotionEvent.AXIS_RTRIGGER);
|
||||
return value != 0f ? value : event.getAxisValue(MotionEvent.AXIS_GAS);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,6 +42,7 @@ class PadMouse(private val listener: Listener, private val clock: () -> Long = S
|
||||
private val total = Sticks()
|
||||
private val triggerAxes = HashMap<Int, Boolean>()
|
||||
private val wiredLayout = HashMap<Int, Boolean>()
|
||||
private val rightStickLayouts = HashMap<Int, Boolean>()
|
||||
private val down = HashMap<Int, MutableSet<Int>>()
|
||||
private val sent = HashMap<Int, IntArray>()
|
||||
private val held = LinkedHashMap<Int, Int>()
|
||||
@@ -87,14 +88,21 @@ class PadMouse(private val listener: Listener, private val clock: () -> Long = S
|
||||
fun onMotion(event: MotionEvent): Boolean {
|
||||
if (event.actionMasked != MotionEvent.ACTION_MOVE) return true
|
||||
val sticks = physical.getOrPut(event.deviceId) { Sticks() }
|
||||
val wired = wiredLayout.getOrPut(event.deviceId) { PadBridge.wiredXboxLayout(event) }
|
||||
val device = event.device
|
||||
val wired = wiredLayout.getOrPut(event.deviceId) { PadBridge.wiredXboxLayout(device, event.source) }
|
||||
val rxRyStick = PadBridge.rightStickUsesRxRy(event, device, rightStickLayouts)
|
||||
sticks.leftX = event.getAxisValue(MotionEvent.AXIS_X)
|
||||
sticks.leftY = event.getAxisValue(MotionEvent.AXIS_Y)
|
||||
sticks.rightX = scrollAxis(event, if (wired) MotionEvent.AXIS_RX else MotionEvent.AXIS_Z)
|
||||
sticks.rightY = scrollAxis(event, if (wired) MotionEvent.AXIS_RY else MotionEvent.AXIS_RZ)
|
||||
if (hasTriggerAxes(event)) {
|
||||
sticks.leftTrigger = PadBridge.leftTrigger(event, wired)
|
||||
sticks.rightTrigger = PadBridge.rightTrigger(event, wired)
|
||||
sticks.rightX = scrollAxis(event, if (rxRyStick) MotionEvent.AXIS_RX else MotionEvent.AXIS_Z)
|
||||
sticks.rightY = scrollAxis(event, if (rxRyStick) MotionEvent.AXIS_RY else MotionEvent.AXIS_RZ)
|
||||
val signedLeft = PadBridge.signedZTriggers(event, device, wired, rxRyStick, true)
|
||||
val signedRight = PadBridge.signedZTriggers(event, device, wired, rxRyStick, false)
|
||||
val analogTriggers = hasTriggerAxes(event)
|
||||
if (analogTriggers || signedLeft) {
|
||||
sticks.leftTrigger = PadBridge.triggerValue(event, device, wired, rxRyStick, true)
|
||||
}
|
||||
if (analogTriggers || signedRight) {
|
||||
sticks.rightTrigger = PadBridge.triggerValue(event, device, wired, rxRyStick, false)
|
||||
}
|
||||
val hatX = event.getAxisValue(MotionEvent.AXIS_HAT_X)
|
||||
val hatY = event.getAxisValue(MotionEvent.AXIS_HAT_Y)
|
||||
@@ -129,6 +137,7 @@ class PadMouse(private val listener: Listener, private val clock: () -> Long = S
|
||||
physical.clear()
|
||||
triggerAxes.clear()
|
||||
wiredLayout.clear()
|
||||
rightStickLayouts.clear()
|
||||
touch.clear()
|
||||
down.clear()
|
||||
sent.clear()
|
||||
@@ -207,6 +216,7 @@ class PadMouse(private val listener: Listener, private val clock: () -> Long = S
|
||||
private fun hasTriggerAxes(event: android.view.InputEvent): Boolean = triggerAxes.getOrPut(event.deviceId) {
|
||||
val device = event.device ?: return@getOrPut true
|
||||
device.getMotionRange(MotionEvent.AXIS_LTRIGGER) != null || device.getMotionRange(MotionEvent.AXIS_BRAKE) != null ||
|
||||
device.getMotionRange(MotionEvent.AXIS_RTRIGGER) != null || device.getMotionRange(MotionEvent.AXIS_GAS) != null ||
|
||||
(event is MotionEvent && wiredLayout.getOrPut(event.deviceId) { PadBridge.wiredXboxLayout(event) })
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ class ScrollTouchGestures(
|
||||
private var flingY = 0f
|
||||
private var flingAt = 0L
|
||||
private var flinging = false
|
||||
var clicks = true
|
||||
|
||||
private val longPress = Runnable {
|
||||
held = true
|
||||
@@ -86,7 +87,7 @@ class ScrollTouchGestures(
|
||||
lastY = startY
|
||||
tracker = VelocityTracker.obtain().also { it.addMovement(event) }
|
||||
listener.onMove(startX, startY)
|
||||
handler.postDelayed(longPress, TouchTiming.HOLD_MS)
|
||||
if (clicks) handler.postDelayed(longPress, TouchTiming.HOLD_MS)
|
||||
}
|
||||
MotionEvent.ACTION_MOVE -> {
|
||||
val index = event.findPointerIndex(pointerId).takeIf { it >= 0 } ?: return true
|
||||
@@ -153,6 +154,7 @@ class ScrollTouchGestures(
|
||||
|
||||
private fun click(button: Int) {
|
||||
releaseClick()
|
||||
if (!clicks) return
|
||||
listener.onButton(button, true)
|
||||
clicked = button
|
||||
handler.postDelayed(clickUp, TouchTiming.CLICK_MS)
|
||||
|
||||
@@ -40,6 +40,18 @@ enum class SecondScreenMode(val id: String, @StringRes val label: Int, val bindi
|
||||
data class SecondScreenDisplay(val id: Int, val label: String)
|
||||
|
||||
object SecondScreenDisplays {
|
||||
fun selection(selected: Int, available: List<Int>, gameRequested: Boolean): Int =
|
||||
if (selected in available || gameRequested && selected >= 0) selected else available.firstOrNull() ?: -1
|
||||
|
||||
fun selection(selected: Int, available: List<Int>, gameRequested: Boolean, save: (Int) -> Unit): Int =
|
||||
selection(selected, available, gameRequested).also { if (it != selected) save(it) }
|
||||
|
||||
fun keyboardOnPrimary(gameRequested: Boolean, selected: Int, available: List<Int>, visible: Boolean = true, taken: (Int) -> Boolean): Boolean =
|
||||
visible && gameRequested && selected >= 0 && (selected !in available || taken(selected))
|
||||
|
||||
fun routeKeyboard(steam: Boolean, enabled: Boolean, panel: Boolean, dock: Boolean, primaryFallback: Boolean): Boolean =
|
||||
steam && enabled && (panel || dock || primaryFallback)
|
||||
|
||||
fun available(displayManager: DisplayManager, primaryDisplayId: Int = Display.DEFAULT_DISPLAY): List<SecondScreenDisplay> =
|
||||
displayManager.getDisplays(DisplayManager.DISPLAY_CATEGORY_PRESENTATION)
|
||||
.asSequence()
|
||||
|
||||
@@ -178,4 +178,56 @@ class ShortcutsRelay : Service(), InputManager.InputDeviceListener {
|
||||
private companion object {
|
||||
const val KEY_TIMEOUT_MS = 200L
|
||||
}
|
||||
|
||||
// Frontends such as Cocoon treat a running player process as an open game, so the relay runs only while a screen is started.
|
||||
object Holder : android.app.Application.ActivityLifecycleCallbacks, android.content.ServiceConnection {
|
||||
private const val RELEASE_MS = 1_000L
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
private var app: android.app.Application? = null
|
||||
private var started = 0
|
||||
private var bound = false
|
||||
private val release = Runnable { unbind() }
|
||||
|
||||
fun install(application: android.app.Application) {
|
||||
app?.unregisterActivityLifecycleCallbacks(this)
|
||||
handler.removeCallbacks(release)
|
||||
started = 0
|
||||
bound = false
|
||||
app = application
|
||||
application.registerActivityLifecycleCallbacks(this)
|
||||
}
|
||||
|
||||
override fun onActivityStarted(activity: android.app.Activity) {
|
||||
started++
|
||||
handler.removeCallbacks(release)
|
||||
if (!bound) bind()
|
||||
}
|
||||
|
||||
override fun onActivityStopped(activity: android.app.Activity) {
|
||||
started = (started - 1).coerceAtLeast(0)
|
||||
if (started == 0) handler.postDelayed(release, RELEASE_MS)
|
||||
}
|
||||
|
||||
private fun bind() {
|
||||
val context = app ?: return
|
||||
if (runCatching { context.packageManager.getPackageInfo(Relay.PACKAGE, 0) }.isFailure) return
|
||||
bound = runCatching {
|
||||
context.bindService(Intent(context, ShortcutsRelay::class.java), this, Context.BIND_AUTO_CREATE)
|
||||
}.getOrDefault(false)
|
||||
}
|
||||
|
||||
private fun unbind() {
|
||||
if (!bound) return
|
||||
bound = false
|
||||
runCatching { app?.unbindService(this) }
|
||||
}
|
||||
|
||||
override fun onServiceConnected(name: android.content.ComponentName?, service: IBinder?) = Unit
|
||||
override fun onServiceDisconnected(name: android.content.ComponentName?) = Unit
|
||||
override fun onActivityCreated(activity: android.app.Activity, savedInstanceState: android.os.Bundle?) = Unit
|
||||
override fun onActivityResumed(activity: android.app.Activity) = Unit
|
||||
override fun onActivityPaused(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
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,11 @@ class TouchpadGestures(
|
||||
var bounds: android.graphics.RectF = android.graphics.RectF(0f, 0f, 1f, 1f)
|
||||
var sensitivity = 1.15f
|
||||
var desktop = false
|
||||
var clicks = true
|
||||
set(value) {
|
||||
if (field != value) lastTapAt = 0L
|
||||
field = value
|
||||
}
|
||||
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
private var lastX = 0f
|
||||
@@ -50,12 +55,17 @@ class TouchpadGestures(
|
||||
held = true
|
||||
dragging = true
|
||||
listener.onLongPress()
|
||||
listener.onButton(PointerGestures.BTN_LEFT, true, x, y)
|
||||
press(PointerGestures.BTN_LEFT)
|
||||
}
|
||||
private val clickUp = Runnable { releaseClick() }
|
||||
|
||||
private fun press(button: Int) {
|
||||
if (clicks) listener.onButton(button, true, x, y)
|
||||
}
|
||||
|
||||
private fun click(button: Int) {
|
||||
releaseClick()
|
||||
if (!clicks) return
|
||||
listener.onButton(button, true, x, y)
|
||||
clicked = button
|
||||
handler.postDelayed(clickUp, TouchTiming.CLICK_MS)
|
||||
@@ -108,12 +118,12 @@ class TouchpadGestures(
|
||||
travelled = 0f; held = false; twoFingers = false; scrolled = false; secondWasTap = false
|
||||
fingers = 1; pinching = false
|
||||
anchorId = event.getPointerId(0); moverId = -1; holdDrag = false; scrollLocked = false
|
||||
if (event.eventTime - lastTapAt < TouchTiming.DOUBLE_TAP_MS) {
|
||||
if (clicks && event.eventTime - lastTapAt < TouchTiming.DOUBLE_TAP_MS) {
|
||||
dragging = true
|
||||
listener.onButton(PointerGestures.BTN_LEFT, true, x, y)
|
||||
press(PointerGestures.BTN_LEFT)
|
||||
} else {
|
||||
dragging = false
|
||||
handler.postDelayed(longPress, TouchTiming.HOLD_MS)
|
||||
if (clicks) handler.postDelayed(longPress, TouchTiming.HOLD_MS)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -153,7 +163,7 @@ class TouchpadGestures(
|
||||
secondWasTap = false
|
||||
if (!dragging) {
|
||||
dragging = true
|
||||
listener.onButton(PointerGestures.BTN_LEFT, true, x, y)
|
||||
press(PointerGestures.BTN_LEFT)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,12 +218,15 @@ object BwrapSpawner {
|
||||
private fun runtimeLib(rootfs: String, name: String): File? =
|
||||
LIB_DIRS.map { File(rootfs, "$it/$name") }.firstOrNull { it.exists() }
|
||||
|
||||
private fun gpu(rootfs: String, root: File, env: MutableMap<String, String>): List<Bind>? {
|
||||
internal fun gpu(
|
||||
rootfs: String, root: File, env: MutableMap<String, String>,
|
||||
kgslAvailable: Boolean = File("/dev/kgsl-3d0").exists(),
|
||||
): List<Bind>? {
|
||||
env["VKBRIDGE_SOCKET"]?.let { sock -> if (File(sock).exists()) return bridgeGpu(rootfs, root, env, sock) }
|
||||
val driver = runtimeLib(rootfs, "libvulkan_freedreno.so")
|
||||
if (driver == null || !File("/dev/kgsl-3d0").exists()) return null
|
||||
if (driver == null || !kgslAvailable) return null
|
||||
if (env.containsKey("VK_ICD_FILENAMES") || env.containsKey("VK_DRIVER_FILES")) return null
|
||||
if (env["BL_DESKTOP"] == "1" && env["GAMESCOPE_WAYLAND_DISPLAY"] == null) return null
|
||||
if (env["LIBGL_ALWAYS_SOFTWARE"] == "1" && env["GAMESCOPE_WAYLAND_DISPLAY"] == null) return null
|
||||
val binds = arrayListOf(Bind(driver.canonicalPath, "$GPU_DIR/libvulkan_freedreno.so"))
|
||||
for (name in GPU_LIBS) {
|
||||
val f = runtimeLib(rootfs, name) ?: continue
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.ActivityOptions
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.hardware.display.DisplayManager
|
||||
import android.os.Bundle
|
||||
import android.os.SystemClock
|
||||
import android.util.Log
|
||||
import android.view.Display
|
||||
import android.view.WindowManager
|
||||
|
||||
// While a session runs, sits invisibly on top of every other display until it ends, so
|
||||
// that display's home launcher is not its top activity. lmkd kills the launcher first; restarted as a
|
||||
// top activity it takes focus from the session, which then drops to adj 50 and is killed next.
|
||||
class KeepTopActivity : Activity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
@Suppress("DEPRECATION") overridePendingTransition(0, 0)
|
||||
if (intent.getBooleanExtra(EXTRA_BOUNCE, false)) {
|
||||
bounces++
|
||||
finish()
|
||||
return
|
||||
}
|
||||
if (intent.getIntExtra(EXTRA_GENERATION, -1) != generation) {
|
||||
finishAndRemoveTask()
|
||||
return
|
||||
}
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE or WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE)
|
||||
val id = display?.displayId ?: Display.INVALID_DISPLAY
|
||||
starting.remove(id)
|
||||
guards[id]?.takeIf { it !== this && !it.isFinishing }?.finishAndRemoveTask()
|
||||
guards[id] = this
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
guards.values.remove(this)
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "KeepTop"
|
||||
private const val EXTRA_BOUNCE = "bounce"
|
||||
private const val EXTRA_GENERATION = "generation"
|
||||
private var generation = 0
|
||||
var bounces = 0
|
||||
private set
|
||||
private val guards = HashMap<Int, KeepTopActivity>()
|
||||
private const val START_TIMEOUT_MS = 2_000L
|
||||
private val starting = HashMap<Int, Long>()
|
||||
|
||||
fun guardOtherDisplays(context: Context, sessionDisplay: Int): Boolean {
|
||||
val displays = context.getSystemService(DisplayManager::class.java)?.displays ?: return false
|
||||
var started = false
|
||||
for (display in displays) {
|
||||
val id = display.displayId
|
||||
if (id == sessionDisplay || display.state != Display.STATE_ON || guards[id]?.isFinishing == false ||
|
||||
starting[id]?.let { SystemClock.elapsedRealtime() - it < START_TIMEOUT_MS } == true) continue
|
||||
runCatching {
|
||||
launch(context, id, bounce = false)
|
||||
starting[id] = SystemClock.elapsedRealtime()
|
||||
started = true
|
||||
Log.i(TAG, "guarding display $id from a home launcher restart")
|
||||
}.onFailure { Log.w(TAG, "could not guard display $id", it) }
|
||||
}
|
||||
if (!started) return false
|
||||
return runCatching { launch(context, sessionDisplay, bounce = true) }
|
||||
.onFailure { Log.w(TAG, "could not return focus to display $sessionDisplay", it) }.isSuccess
|
||||
}
|
||||
|
||||
fun hasPendingStarts() = starting.isNotEmpty()
|
||||
|
||||
const val RETRY_MS = START_TIMEOUT_MS + 250
|
||||
|
||||
fun release() {
|
||||
generation++
|
||||
guards.values.toList().forEach { it.finishAndRemoveTask() }
|
||||
guards.clear()
|
||||
starting.clear()
|
||||
}
|
||||
|
||||
private fun launch(context: Context, displayId: Int, bounce: Boolean) {
|
||||
val intent = Intent(context, KeepTopActivity::class.java)
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_MULTIPLE_TASK or Intent.FLAG_ACTIVITY_NO_ANIMATION)
|
||||
.putExtra(EXTRA_BOUNCE, bounce)
|
||||
.putExtra(EXTRA_GENERATION, generation)
|
||||
context.startActivity(intent, ActivityOptions.makeBasic().setLaunchDisplayId(displayId).toBundle())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
// Tracks a pause that skipped the session's departure cleanup for the keep-top focus bounce.
|
||||
internal class LightPause {
|
||||
private var pending = false
|
||||
private var bouncesAtPause = 0
|
||||
|
||||
fun paused(bounces: Int) {
|
||||
pending = true
|
||||
bouncesAtPause = bounces
|
||||
}
|
||||
|
||||
// The bounce resumes the session within tens of milliseconds; still paused at the timeout means
|
||||
// something else holds the pause.
|
||||
fun timedOut(): Boolean = take()
|
||||
|
||||
fun stopped(): Boolean = take()
|
||||
|
||||
fun resumed(bounces: Int): Resume {
|
||||
if (!pending) return Resume.NORMAL
|
||||
pending = false
|
||||
return if (bounces != bouncesAtPause) Resume.LIGHT else Resume.CLEANUP_FIRST
|
||||
}
|
||||
|
||||
private fun take(): Boolean {
|
||||
val was = pending
|
||||
pending = false
|
||||
return was
|
||||
}
|
||||
|
||||
enum class Resume { NORMAL, LIGHT, CLEANUP_FIRST }
|
||||
}
|
||||
@@ -544,6 +544,7 @@ object SessionArtifacts {
|
||||
"session died of a crash, the entry is in there unless the device rebooted.\n" +
|
||||
(if (newest) exitReasons(context) else "")
|
||||
)
|
||||
restartNote(File(dir, "device.txt").lastModified(), bootedAt())?.let { recoveryNote.appendText(it) }
|
||||
if (newest && lastExitForMemory(context)) killedForMemory = true
|
||||
}
|
||||
if (recoveryPreviouslyAttempted && !runtimeCaptured.exists() &&
|
||||
@@ -597,7 +598,7 @@ object SessionArtifacts {
|
||||
}
|
||||
val memoryLog = File(dir, "memory-pressure.log")
|
||||
if (newest && !memoryLog.exists()) {
|
||||
SessionLogCapture.dumpMemoryPressure(memoryLog)
|
||||
SessionLogCapture.dumpMemoryPressure(memoryLog, context)
|
||||
}
|
||||
if (stopWhenSessionStarts && SessionState.running) {
|
||||
record.failed = true
|
||||
@@ -686,5 +687,21 @@ object SessionArtifacts {
|
||||
return gone.size
|
||||
}
|
||||
|
||||
private fun bootedAt(): Long = System.currentTimeMillis() - android.os.SystemClock.elapsedRealtime()
|
||||
|
||||
internal fun restartNote(sessionStartedAt: Long, bootedAt: Long): String? {
|
||||
if (sessionStartedAt <= 0L) return null
|
||||
val stamp = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US)
|
||||
return if (bootedAt > sessionStartedAt + BOOT_CLOCK_SLACK_MS) {
|
||||
"The device itself probably restarted after this session began (estimated boot ${stamp.format(Date(bootedAt))}, from the clock and uptime, so a clock change can fake it):\n" +
|
||||
"if so, the whole system went down and crash.log is the new boot's buffer and says nothing about the session.\n"
|
||||
} else {
|
||||
"The device does not appear to have restarted since this session began (estimated boot ${stamp.format(Date(bootedAt))}, from the clock and uptime):\n" +
|
||||
"only this app's processes ended, so crash.log and the exit records cover the end.\n"
|
||||
}
|
||||
}
|
||||
|
||||
private const val BOOT_CLOCK_SLACK_MS = 60_000L
|
||||
|
||||
private fun now(): String = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US).format(Date())
|
||||
}
|
||||
@@ -273,12 +273,45 @@ object SessionPrefs {
|
||||
prefs(context).edit().putBoolean("railLabels", show).apply()
|
||||
}
|
||||
|
||||
fun agentTab(context: Context): Boolean = prefs(context).getBoolean("agentTab", true)
|
||||
fun agentTab(context: Context): Boolean = prefs(context).getBoolean("agentTab", false)
|
||||
|
||||
fun setAgentTab(context: Context, show: Boolean) {
|
||||
prefs(context).edit().putBoolean("agentTab", show).apply()
|
||||
}
|
||||
|
||||
fun developerTools(context: Context): Boolean =
|
||||
prefs(context).getBoolean("developerTools", agentTab(context) || com.droiddeck.launcher.agent.AgentAccess.commandsEnabled(context))
|
||||
|
||||
fun setDeveloperTools(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("developerTools", on).apply()
|
||||
}
|
||||
|
||||
fun fpsLimitKey(mode: String?, game: String?): String? = when (mode) {
|
||||
SessionService.MODE_RUN -> game?.trim()?.takeIf(com.droiddeck.launcher.frontend.GameLaunchLink::validId)?.let { "fpsLimit.game.$it" }
|
||||
SessionService.MODE_DESKTOP -> "fpsLimit.desktop"
|
||||
else -> null
|
||||
}
|
||||
|
||||
fun savedFpsLimit(context: Context, key: String?): Int = key?.let { prefs(context).getInt(it, 0) } ?: 0
|
||||
|
||||
fun saveFpsLimit(context: Context, key: String?, fps: Int) {
|
||||
key ?: return
|
||||
prefs(context).edit().apply { if (fps > 0) putInt(key, fps) else remove(key) }.apply()
|
||||
}
|
||||
|
||||
fun drawerCornerTap(context: Context): Boolean =
|
||||
prefs(context).getBoolean("drawerCornerTap", android.os.Build.MANUFACTURER.equals("Oculus", true) || android.os.Build.MANUFACTURER.equals("Meta", true))
|
||||
|
||||
fun setDrawerCornerTap(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("drawerCornerTap", on).apply()
|
||||
}
|
||||
|
||||
fun drawerHintShown(context: Context): Int = prefs(context).getInt("drawerHintShown", 0)
|
||||
|
||||
fun countDrawerHint(context: Context) {
|
||||
prefs(context).edit().putInt("drawerHintShown", drawerHintShown(context) + 1).apply()
|
||||
}
|
||||
|
||||
fun libraryShowUninstalled(context: Context): Boolean = prefs(context).getBoolean("libraryShowUninstalled", false)
|
||||
|
||||
fun setLibraryShowUninstalled(context: Context, show: Boolean) {
|
||||
@@ -309,7 +342,7 @@ object SessionPrefs {
|
||||
prefs(context).edit().putString("navTabOrder", order.joinToString(",")).apply()
|
||||
}
|
||||
|
||||
fun navTabShelved(context: Context): Set<String> = idList(prefs(context).getString("navTabShelved", "soundtracks,agent")).toSet()
|
||||
fun navTabShelved(context: Context): Set<String> = idList(prefs(context).getString("navTabShelved", "soundtracks,agent,storage,sync")).toSet()
|
||||
|
||||
fun setNavTabShelved(context: Context, keys: Set<String>) {
|
||||
prefs(context).edit().putString("navTabShelved", keys.joinToString(",")).apply()
|
||||
|
||||
@@ -411,6 +411,7 @@ class SessionService : Service() {
|
||||
?.takeIf(GameLaunchLink::validId)
|
||||
?: steamUrlGameId
|
||||
SessionState.gameId = resolvedGameId
|
||||
SessionState.fpsLimit = SessionPrefs.savedFpsLimit(this, SessionPrefs.fpsLimitKey(SessionState.mode, resolvedGameId))
|
||||
SessionPrefs.setActiveScreenEffectsProfile(
|
||||
this,
|
||||
SessionPrefs.screenEffectsProfileId(SessionState.mode, resolvedGameId, SessionState.program),
|
||||
@@ -1428,6 +1429,28 @@ class SessionService : Service() {
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "steam library: the list could not be written; the card alone this session", e)
|
||||
}
|
||||
if (SessionState.mode == MODE_DESKTOP) {
|
||||
try {
|
||||
val listing = File(filesDir, "session/desktop-volumes.json").apply { parentFile?.mkdirs() }
|
||||
val volumes = org.json.JSONArray()
|
||||
var room = if (ProotFastPath.enabled(this)) {
|
||||
ProotFastPath.MAX_BINDS - LinuxRuntime.binds(this, sessionRoot, runtimeDir, Environment.getExternalStorageDirectory(), binds).size
|
||||
} else Int.MAX_VALUE
|
||||
for (root in com.droiddeck.launcher.files.StorageRoots.list(this)) {
|
||||
if (!root.removable || !root.readable) continue
|
||||
val path = root.dir.absolutePath
|
||||
if (':' in path || '|' in path || room <= 0) continue
|
||||
binds.add(path)
|
||||
room--
|
||||
volumes.put(org.json.JSONObject().put("path", path).put("label", root.label))
|
||||
}
|
||||
listing.writeText(volumes.toString())
|
||||
val envAt = guest.indexOf(LinuxRuntime.SESSION_SCRIPT).takeIf { it >= 0 } ?: guest.size
|
||||
guest.add(envAt, "BL_DESKTOP_VOLUMES=" + listing.path)
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "desktop volumes: the list could not be written", e)
|
||||
}
|
||||
}
|
||||
return binds
|
||||
}
|
||||
|
||||
@@ -2325,7 +2348,8 @@ class SessionService : Service() {
|
||||
override fun onTaskRemoved(rootIntent: Intent?) {
|
||||
if (rootIntent?.component?.className in setOf(
|
||||
com.droiddeck.launcher.ui.DualScreenActivity::class.java.name,
|
||||
com.droiddeck.launcher.ui.SessionTypingActivity::class.java.name)) return
|
||||
com.droiddeck.launcher.ui.SessionTypingActivity::class.java.name,
|
||||
KeepTopActivity::class.java.name)) return
|
||||
if (pipTask || xrActivityVisible) {
|
||||
Log.i(TAG, "panel task dismissed - retaining the session under its active surface policy")
|
||||
activityVisible = false
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import android.content.ComponentCallbacks2
|
||||
|
||||
internal object TopUnderPressure {
|
||||
const val WINDOW_MS = 5_000L
|
||||
|
||||
fun isPressure(level: Int) =
|
||||
level == ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL || level == ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW
|
||||
|
||||
fun shouldReclaim(nowMs: Long, pressureAtMs: Long, sessionRunning: Boolean, finishing: Boolean) =
|
||||
sessionRunning && !finishing && pressureAtMs > 0 && nowMs - pressureAtMs in 0..WINDOW_MS
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.droiddeck.launcher.stores
|
||||
|
||||
import android.content.Context
|
||||
import java.io.File
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
|
||||
internal object StoreLibraryCache {
|
||||
private fun file(context: Context, store: Store) = File(context.filesDir, "store-library/${store.id}.json")
|
||||
|
||||
fun load(context: Context, store: Store): List<CatalogItem>? {
|
||||
val f = file(context, store)
|
||||
if (!f.isFile) return null
|
||||
return runCatching { decode(store, f.readText()) }.getOrNull()
|
||||
}
|
||||
|
||||
private val locks = Store.entries.associateWith { Any() }
|
||||
|
||||
fun save(context: Context, store: Store, items: List<CatalogItem>, current: () -> Boolean) = synchronized(locks.getValue(store)) {
|
||||
if (!current()) return@synchronized
|
||||
val f = file(context, store)
|
||||
runCatching {
|
||||
f.parentFile?.mkdirs()
|
||||
val tmp = File(f.parentFile, f.name + ".tmp")
|
||||
tmp.writeText(encode(items))
|
||||
if (!tmp.renameTo(f)) { f.delete(); tmp.renameTo(f) }
|
||||
}
|
||||
}
|
||||
|
||||
fun clear(context: Context, store: Store) = synchronized(locks.getValue(store)) {
|
||||
file(context, store).delete()
|
||||
}
|
||||
|
||||
internal fun encode(items: List<CatalogItem>): String {
|
||||
val out = JSONArray()
|
||||
items.forEach { i ->
|
||||
out.put(JSONObject()
|
||||
.put("id", i.id).put("title", i.title)
|
||||
.put("image", i.imageUrl ?: "").put("tall", i.tallImageUrl ?: "").put("logo", i.logoUrl ?: "")
|
||||
.put("tags", i.tags).put("free", i.isFree).put("hasPrice", i.hasPrice)
|
||||
.put("finalPrice", i.finalPrice).put("originalPrice", i.originalPrice).put("discount", i.discountPercent)
|
||||
.put("url", i.storeUrl).put("developer", i.developer).put("publisher", i.publisher)
|
||||
.put("releaseDate", i.releaseDate).put("description", i.description)
|
||||
.put("owned", i.owned).put("size", i.sizeBytes).put("extra", JSONObject(i.extra))
|
||||
.put("mature", i.mature).put("subscription", i.subscription).put("includedWith", i.includedWith))
|
||||
}
|
||||
return out.toString()
|
||||
}
|
||||
|
||||
internal fun decode(store: Store, text: String): List<CatalogItem> {
|
||||
val raw = JSONArray(text)
|
||||
return (0 until raw.length()).mapNotNull { n ->
|
||||
val o = raw.optJSONObject(n) ?: return@mapNotNull null
|
||||
val extra = o.optJSONObject("extra")
|
||||
val map = HashMap<String, String>()
|
||||
extra?.keys()?.forEach { k -> map[k] = extra.optString(k) }
|
||||
CatalogItem(
|
||||
store = store, id = o.optString("id"), title = o.optString("title"),
|
||||
imageUrl = o.optString("image").ifBlank { null }, tallImageUrl = o.optString("tall").ifBlank { null },
|
||||
logoUrl = o.optString("logo").ifBlank { null },
|
||||
tags = o.optString("tags"), isFree = o.optBoolean("free"), hasPrice = o.optBoolean("hasPrice"),
|
||||
finalPrice = o.optString("finalPrice"), originalPrice = o.optString("originalPrice"), discountPercent = o.optInt("discount"),
|
||||
storeUrl = o.optString("url"), developer = o.optString("developer"), publisher = o.optString("publisher"),
|
||||
releaseDate = o.optString("releaseDate"), description = o.optString("description"),
|
||||
owned = o.optBoolean("owned"), sizeBytes = o.optLong("size"), extra = map,
|
||||
mature = o.optBoolean("mature"), subscription = o.optBoolean("subscription"), includedWith = o.optString("includedWith"),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -202,6 +202,7 @@ object StoresState {
|
||||
backend?.signOut(app)
|
||||
if (store == Store.GOG) com.droiddeck.launcher.stores.gog.GogComet.replaceAccount { StoreAccounts.clear(app, store) }
|
||||
else if (store != Store.XBOX || backend == null) StoreAccounts.clear(app, store)
|
||||
StoreLibraryCache.clear(app, store)
|
||||
if (store == Store.GAMEJOLT) {
|
||||
com.droiddeck.launcher.stores.gamejolt.GameJoltCollections.clear()
|
||||
com.droiddeck.launcher.stores.gamejolt.GameJoltUpdates.clear(app)
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.droiddeck.launcher.stores.StoreFront
|
||||
import com.droiddeck.launcher.stores.StoreInstallRoot
|
||||
import com.droiddeck.launcher.stores.StoreLoginActivity
|
||||
import com.droiddeck.launcher.stores.StoreShelves
|
||||
import com.droiddeck.launcher.stores.StoreLibraryCache
|
||||
import com.droiddeck.launcher.stores.StoresState
|
||||
import com.droiddeck.launcher.stores.WebCookies
|
||||
import com.droiddeck.launcher.stores.download.DownloadEntry
|
||||
@@ -163,7 +164,16 @@ object RockstarLibrary {
|
||||
post(gen) { StoresState.status.remove(Store.ROCKSTAR); StoresState.problems[Store.ROCKSTAR] = app.getString(R.string.stores_sync_sign_in) }
|
||||
return
|
||||
}
|
||||
if (StoresState.library[Store.ROCKSTAR].isNullOrEmpty()) post(gen) { StoresState.status[Store.ROCKSTAR] = app.getString(R.string.stores_sync_game_list) }
|
||||
val cached = StoreLibraryCache.load(app, Store.ROCKSTAR)
|
||||
post(gen) {
|
||||
if (StoresState.library[Store.ROCKSTAR] == null) {
|
||||
if (cached != null) {
|
||||
StoresState.library[Store.ROCKSTAR] = cached
|
||||
StoresState.shelves[Store.ROCKSTAR]?.let { StoresState.shelves[Store.ROCKSTAR] = StoreFront.markOwned(it, cached, RockstarCatalog::sameGame) }
|
||||
}
|
||||
else StoresState.status[Store.ROCKSTAR] = app.getString(R.string.stores_sync_game_list)
|
||||
}
|
||||
}
|
||||
val account = RockstarApps.fetch(t.ticket) { StoresState.logLine(it) }
|
||||
val games = games(account)
|
||||
owned(account).filter { o -> games.none { it.id == o.id } }.takeIf { it.isNotEmpty() }?.let { elsewhere ->
|
||||
@@ -175,6 +185,7 @@ object RockstarLibrary {
|
||||
StoresState.library[Store.ROCKSTAR] = games
|
||||
StoresState.shelves[Store.ROCKSTAR]?.let { StoresState.shelves[Store.ROCKSTAR] = StoreFront.markOwned(it, games, RockstarCatalog::sameGame) }
|
||||
}
|
||||
StoreLibraryCache.save(app, Store.ROCKSTAR, games) { generation.get() == gen }
|
||||
StoresState.logLine("Rockstar: ${games.size} owned games")
|
||||
} catch (e: Exception) {
|
||||
StoresState.logLine("Rockstar: library sync failed: ${e.javaClass.simpleName} ${e.message.orEmpty().take(300)}")
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.droiddeck.launcher.stores.StoreInstallRoot
|
||||
import com.droiddeck.launcher.stores.download.DownloadEntry
|
||||
import com.droiddeck.launcher.stores.download.DownloadQueue
|
||||
import com.droiddeck.launcher.stores.StoreLoginActivity
|
||||
import com.droiddeck.launcher.stores.StoreLibraryCache
|
||||
import com.droiddeck.launcher.stores.StoresState
|
||||
import com.droiddeck.launcher.stores.WebCookies
|
||||
import org.json.JSONObject
|
||||
@@ -206,7 +207,16 @@ object UbisoftLibrary {
|
||||
post(gen) { StoresState.status.remove(Store.UBISOFT); StoresState.problems[Store.UBISOFT] = app.getString(R.string.stores_sync_sign_in) }
|
||||
return
|
||||
}
|
||||
if (StoresState.library[Store.UBISOFT].isNullOrEmpty()) post(gen) { StoresState.status[Store.UBISOFT] = app.getString(R.string.stores_sync_game_list) }
|
||||
val cached = StoreLibraryCache.load(app, Store.UBISOFT)
|
||||
post(gen) {
|
||||
if (StoresState.library[Store.UBISOFT] == null) {
|
||||
if (cached != null) {
|
||||
StoresState.library[Store.UBISOFT] = cached
|
||||
StoresState.shelves[Store.UBISOFT]?.let { StoresState.shelves[Store.UBISOFT] = StoreFront.markOwned(it, cached, UbisoftStore::sameGame) }
|
||||
}
|
||||
else StoresState.status[Store.UBISOFT] = app.getString(R.string.stores_sync_game_list)
|
||||
}
|
||||
}
|
||||
val all = ArrayList<CatalogItem>()
|
||||
var offset = 0
|
||||
while (true) {
|
||||
@@ -241,6 +251,7 @@ object UbisoftLibrary {
|
||||
StoresState.library[Store.UBISOFT] = games
|
||||
StoresState.shelves[Store.UBISOFT]?.let { StoresState.shelves[Store.UBISOFT] = StoreFront.markOwned(it, games, UbisoftStore::sameGame) }
|
||||
}
|
||||
StoreLibraryCache.save(app, Store.UBISOFT, games) { generation.get() == gen }
|
||||
StoresState.logLine("Ubisoft: ${games.size} owned games")
|
||||
} catch (e: Exception) {
|
||||
StoresState.logLine("Ubisoft: library sync failed: ${e.javaClass.simpleName} ${e.message.orEmpty().take(200)}")
|
||||
|
||||
@@ -1,18 +1,27 @@
|
||||
package com.droiddeck.launcher.stores.xbox
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.util.TypedValue
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.webkit.CookieManager
|
||||
import android.webkit.WebResourceRequest
|
||||
import android.webkit.WebView
|
||||
import android.webkit.WebViewClient
|
||||
import android.widget.Button
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.ImageButton
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.ProgressBar
|
||||
import android.widget.TextView
|
||||
import androidx.activity.ComponentActivity
|
||||
import com.droiddeck.launcher.R
|
||||
import androidx.webkit.WebViewCompat
|
||||
import androidx.webkit.WebViewFeature
|
||||
import com.droiddeck.launcher.core.AddonPack
|
||||
@@ -24,8 +33,10 @@ import org.json.JSONObject
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
class XboxLoginActivity : ComponentActivity() {
|
||||
private lateinit var host: LinearLayout
|
||||
private lateinit var host: FrameLayout
|
||||
private lateinit var status: TextView
|
||||
private lateinit var retry: Button
|
||||
private lateinit var progressBar: ProgressBar
|
||||
private var view: WebView? = null
|
||||
@Volatile private var child: Xodus.Child? = null
|
||||
@Volatile private var session = 0L
|
||||
@@ -37,11 +48,7 @@ class XboxLoginActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
requestedOrientation = com.droiddeck.launcher.core.AppUiPrefs.orientation(this)
|
||||
host = LinearLayout(this).apply { orientation = LinearLayout.VERTICAL; setBackgroundColor(Color.BLACK) }
|
||||
status = TextView(this).apply { setTextColor(Color.WHITE); text = "Preparing Microsoft sign-in…"; setPadding(24, 16, 24, 16) }
|
||||
host.addView(status)
|
||||
host.addView(Button(this).apply { text = getString(com.droiddeck.launcher.R.string.stores_login_close); setOnClickListener { finish() } })
|
||||
setContentView(host)
|
||||
setContentView(buildChrome())
|
||||
if (android.os.Build.VERSION.SDK_INT < 28 || !WebViewFeature.isFeatureSupported(WebViewFeature.WEB_MESSAGE_LISTENER) ||
|
||||
!WebViewFeature.isFeatureSupported(WebViewFeature.DOCUMENT_START_SCRIPT)) {
|
||||
status.text = "Update Android System WebView to sign in to Xbox."
|
||||
@@ -148,15 +155,60 @@ class XboxLoginActivity : ComponentActivity() {
|
||||
val failed = step
|
||||
val reason = failure(e)
|
||||
logStep("failed while $failed: $reason")
|
||||
if (e is java.io.IOException) logStep("I/O detail: ${e.message.orEmpty().take(300)}")
|
||||
runOnUiThread {
|
||||
disposeView()
|
||||
val details = if (codes.isEmpty()) "" else "\nDetails: ${codes.joinToString(", ")}"
|
||||
status.text = "Microsoft sign-in did not complete.\nFailed while $failed: $reason$details\nClose this window and try again."
|
||||
status.text = "Microsoft sign-in did not complete.\nFailed while $failed: $reason$details"
|
||||
retry.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
}, "xbox-login").start()
|
||||
}
|
||||
|
||||
private fun dp(value: Int): Int = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, value.toFloat(), resources.displayMetrics).toInt()
|
||||
|
||||
/** The other stores' sign-in frame: a title bar with close, a load bar, and a centered status. */
|
||||
private fun buildChrome(): View {
|
||||
val root = LinearLayout(this).apply { orientation = LinearLayout.VERTICAL; setBackgroundColor(BACKGROUND) }
|
||||
val bar = LinearLayout(this).apply {
|
||||
orientation = LinearLayout.HORIZONTAL; gravity = Gravity.CENTER_VERTICAL; setBackgroundColor(BAR)
|
||||
layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dp(48))
|
||||
}
|
||||
bar.addView(TextView(this).apply {
|
||||
text = getString(R.string.stores_login_title, Store.XBOX.label)
|
||||
setTextColor(TEXT); textSize = 16f; setPadding(dp(16), 0, dp(8), 0)
|
||||
layoutParams = LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f)
|
||||
})
|
||||
bar.addView(ImageButton(this).apply {
|
||||
setImageResource(android.R.drawable.ic_menu_close_clear_cancel); setBackgroundColor(Color.TRANSPARENT)
|
||||
contentDescription = getString(R.string.stores_login_close); layoutParams = LinearLayout.LayoutParams(dp(48), dp(48))
|
||||
setOnClickListener { finish() }
|
||||
})
|
||||
progressBar = ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal).apply {
|
||||
max = 100; visibility = View.GONE
|
||||
layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dp(3))
|
||||
}
|
||||
host = FrameLayout(this).apply {
|
||||
setBackgroundColor(BACKGROUND)
|
||||
layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1f)
|
||||
}
|
||||
val panel = LinearLayout(this).apply {
|
||||
orientation = LinearLayout.VERTICAL; gravity = Gravity.CENTER; setBackgroundColor(BACKGROUND)
|
||||
setPadding(dp(24), dp(24), dp(24), dp(24))
|
||||
}
|
||||
status = TextView(this).apply { setTextColor(TEXT); textSize = 15f; gravity = Gravity.CENTER; text = "Preparing Microsoft sign-in…" }
|
||||
retry = Button(this).apply {
|
||||
text = getString(R.string.stores_login_retry); visibility = View.GONE
|
||||
setOnClickListener { startActivity(Intent(intent)); finish() }
|
||||
}
|
||||
panel.addView(status)
|
||||
panel.addView(retry, LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT).apply { topMargin = dp(16) })
|
||||
host.addView(panel, FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT))
|
||||
root.addView(bar); root.addView(progressBar); root.addView(host)
|
||||
return root
|
||||
}
|
||||
|
||||
private fun show(text: String) = runOnUiThread { if (!closed && view == null) status.text = text }
|
||||
|
||||
private fun progress(name: String, text: String) { step = name; show(text) }
|
||||
@@ -191,7 +243,6 @@ class XboxLoginActivity : ComponentActivity() {
|
||||
override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean = !trusted(request.url.toString())
|
||||
override fun onPageFinished(view: WebView, url: String) {
|
||||
if (!trusted(url)) { finish(); return }
|
||||
status.text = "Microsoft sign-in"
|
||||
val uri = Uri.parse(url)
|
||||
if (uri.host == "login.live.com" && uri.path == "/ppsecure/post.srf") {
|
||||
view.evaluateJavascript("JSON.stringify(globalThis.ServerData ?? null)") { raw ->
|
||||
@@ -203,7 +254,14 @@ class XboxLoginActivity : ComponentActivity() {
|
||||
}
|
||||
}
|
||||
}
|
||||
host.addView(web, LinearLayout.LayoutParams(-1, 0, 1f))
|
||||
web.setBackgroundColor(BACKGROUND)
|
||||
web.webChromeClient = object : android.webkit.WebChromeClient() {
|
||||
override fun onProgressChanged(view: WebView?, newProgress: Int) {
|
||||
progressBar.progress = newProgress
|
||||
progressBar.visibility = if (newProgress in 1..99) View.VISIBLE else View.GONE
|
||||
}
|
||||
}
|
||||
host.addView(web, FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT))
|
||||
val headers = frame.getJSONObject("headers")
|
||||
val values = headers.keys().asSequence().associateWith { key ->
|
||||
require(key in allowedHeaders)
|
||||
@@ -212,7 +270,11 @@ class XboxLoginActivity : ComponentActivity() {
|
||||
web.loadUrl(frame.getString("url"), values)
|
||||
}
|
||||
|
||||
private fun disposeView() { view?.let { host.removeView(it); it.stopLoading(); it.destroy() }; view = null }
|
||||
private fun disposeView() {
|
||||
view?.let { host.removeView(it); it.stopLoading(); it.destroy() }
|
||||
view = null
|
||||
if (::progressBar.isInitialized) progressBar.visibility = View.GONE
|
||||
}
|
||||
override fun onDestroy() {
|
||||
closed = true
|
||||
val current = child; child = null
|
||||
@@ -225,6 +287,9 @@ class XboxLoginActivity : ComponentActivity() {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "XboxLogin"
|
||||
private const val BACKGROUND = 0xFF0A0B0D.toInt()
|
||||
private const val BAR = 0xFF121417.toInt()
|
||||
private const val TEXT = 0xFFF2F4F7.toInt()
|
||||
|
||||
internal fun failure(e: Exception): String {
|
||||
val message = e.message.orEmpty()
|
||||
|
||||
@@ -50,7 +50,7 @@ import androidx.compose.material.icons.outlined.Mic
|
||||
import androidx.compose.material.icons.outlined.Add
|
||||
import androidx.compose.material.icons.outlined.ArrowDownward
|
||||
import androidx.compose.material.icons.outlined.AttachFile
|
||||
import androidx.compose.material.icons.outlined.AutoAwesome
|
||||
import androidx.compose.material.icons.outlined.Terminal
|
||||
import androidx.compose.material.icons.outlined.Build
|
||||
import androidx.compose.material.icons.outlined.Close
|
||||
import androidx.compose.material.icons.outlined.ExpandMore
|
||||
@@ -451,7 +451,7 @@ private fun AgentConversation(modifier: Modifier, list: LazyListState, following
|
||||
}
|
||||
if (AgentHost.entries.isEmpty() && !working) {
|
||||
Column(modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center) {
|
||||
Icon(Icons.Outlined.AutoAwesome, null, tint = pal.primary, modifier = Modifier.size(40.dp))
|
||||
Icon(Icons.Outlined.Terminal, null, tint = pal.primary, modifier = Modifier.size(40.dp))
|
||||
Text(stringResource(R.string.agent_empty), fontSize = 15.sp, color = pal.onSurfaceVariant,
|
||||
textAlign = TextAlign.Center, modifier = Modifier.widthIn(max = 460.dp).padding(top = 12.dp))
|
||||
}
|
||||
|
||||
@@ -416,7 +416,7 @@ private fun ToolsRow(title: String, detail: String, action: @Composable () -> Un
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ToolsField(value: String, onValue: (String) -> Unit, hint: String, tag: String) {
|
||||
internal fun ToolsField(value: String, onValue: (String) -> Unit, hint: String, tag: String) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
Box(Modifier.fillMaxWidth().clip(Shape12).background(pal.surfaceVariant).padding(horizontal = 12.dp, vertical = 10.dp)) {
|
||||
|
||||
@@ -96,27 +96,61 @@ internal fun AgentSetupView(modifier: Modifier, onDone: () -> Unit = {}) {
|
||||
) {
|
||||
steps.forEachIndexed { index, step ->
|
||||
val status = AgentSetup.status[step] ?: Status.UNKNOWN
|
||||
val (title, hint) = labels(step, AgentHost.harness.name)
|
||||
val harness = AgentHost.harness
|
||||
// A harness that signs in with a pasted key: the sign-in opens its key page and this field takes the key.
|
||||
val keyed = step == Step.SIGN_IN && harness.keyPage != null
|
||||
var keyOpen by rememberSaveable(harness.id) { mutableStateOf(false) }
|
||||
val (title, hint) = labels(step, harness.name, keyed)
|
||||
val lab = AgentHost.lab?.takeIf { it.prepare && it.running }
|
||||
val detail = if (step == Step.PREPARE && lab != null)
|
||||
stringResource(R.string.agent_prepare_progress, lab.permille / 10, clock(lab.etaSeconds.toLong().coerceAtLeast(0)))
|
||||
else AgentSetup.detail[step] ?: hint
|
||||
val detail = when {
|
||||
step == Step.PREPARE && lab != null ->
|
||||
stringResource(R.string.agent_prepare_progress, lab.permille / 10, clock(lab.etaSeconds.toLong().coerceAtLeast(0)))
|
||||
keyed && status == Status.DONE && !AgentSetup.keySaved -> stringResource(R.string.agent_step_free_models)
|
||||
else -> AgentSetup.detail[step] ?: hint
|
||||
}
|
||||
// Shown while the sign-in is pending, so it is still there after a trip to the browser for the key.
|
||||
val pending = (status == Status.TODO || status == Status.FAILED) && AgentSetup.status[Step.INSTALL] == Status.DONE
|
||||
val showKey = keyed && (keyOpen || pending) && status != Status.WORKING
|
||||
var key by remember(harness.id) { mutableStateOf("") }
|
||||
CheckRow(
|
||||
when (status) {
|
||||
Status.DONE -> CheckState.OK
|
||||
Status.WORKING, Status.UNKNOWN -> CheckState.BUSY
|
||||
Status.TODO, Status.FAILED -> CheckState.WARN
|
||||
},
|
||||
title, detail, divider = index < steps.lastIndex,
|
||||
title, detail, divider = index < steps.lastIndex && !showKey,
|
||||
) {
|
||||
val blocked = (step in setOf(Step.SIGN_IN, Step.GITHUB, Step.BUILD_TOOLS) && AgentSetup.status[Step.INSTALL] != Status.DONE) ||
|
||||
(step == Step.PREPARE && AgentSetup.status[Step.BUILD_TOOLS] != Status.DONE)
|
||||
val openKey = {
|
||||
keyOpen = true
|
||||
AgentSetup.run(context, step)
|
||||
}
|
||||
if ((status == Status.TODO || status == Status.FAILED) && !blocked) {
|
||||
val label = stringResource(if (status == Status.FAILED) R.string.agent_setup_retry else action(step))
|
||||
val run = { if (step == Step.CONNECTION) pair(context) else AgentSetup.run(context, step) }
|
||||
if (step.required) PrimaryButton(label, compact = true, onClick = run) else SecondaryButton(label, compact = true, onClick = run)
|
||||
val run = { if (step == Step.CONNECTION) pair(context) else if (keyed) openKey() else AgentSetup.run(context, step) }
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
if (keyed && harness.free) SecondaryButton(stringResource(R.string.agent_action_free), compact = true) { AgentSetup.useFree(context) }
|
||||
if (step.required) PrimaryButton(label, compact = true, onClick = run) else SecondaryButton(label, compact = true, onClick = run)
|
||||
}
|
||||
} else if (keyed && status == Status.DONE && !AgentSetup.keySaved && !keyOpen) {
|
||||
SecondaryButton(stringResource(R.string.agent_action_add_key), compact = true, onClick = openKey)
|
||||
}
|
||||
}
|
||||
if (showKey) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp),
|
||||
modifier = Modifier.fillMaxWidth().padding(start = 56.dp, end = 14.dp, bottom = 10.dp),
|
||||
) {
|
||||
Box(Modifier.weight(1f)) { ToolsField(key, { key = it.trim() }, stringResource(R.string.agent_key_hint), "agent-key") }
|
||||
PrimaryButton(stringResource(R.string.agent_key_save), enabled = key.isNotBlank(), compact = true) {
|
||||
keyOpen = false
|
||||
AgentSetup.saveKey(context, key)
|
||||
key = ""
|
||||
}
|
||||
}
|
||||
if (index < steps.lastIndex) Box(Modifier.fillMaxWidth().height(1.dp).background(pal.line))
|
||||
}
|
||||
}
|
||||
}
|
||||
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(horizontal = 2.dp)) {
|
||||
@@ -183,6 +217,7 @@ private fun StorageCard() {
|
||||
private fun storageTitle(item: AgentStorage.Item) = when (item) {
|
||||
AgentStorage.Item.CLAUDE_CODE -> R.string.agent_storage_claude
|
||||
AgentStorage.Item.CODEX -> R.string.agent_storage_codex
|
||||
AgentStorage.Item.OPENCODE -> R.string.agent_storage_opencode
|
||||
AgentStorage.Item.BUILD_TOOLS -> R.string.agent_step_build
|
||||
AgentStorage.Item.SOURCE -> R.string.agent_storage_source
|
||||
AgentStorage.Item.CACHES -> R.string.agent_storage_caches
|
||||
@@ -195,10 +230,10 @@ private fun storageWarning(item: AgentStorage.Item) = when (item) {
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun labels(step: Step, harness: String): Pair<String, String> = when (step) {
|
||||
private fun labels(step: Step, harness: String, keyed: Boolean = false): Pair<String, String> = when (step) {
|
||||
Step.CONNECTION -> stringResource(R.string.agent_step_connection) to stringResource(R.string.agent_step_connection_hint)
|
||||
Step.INSTALL -> stringResource(R.string.agent_step_install, harness) to stringResource(R.string.agent_step_install_hint)
|
||||
Step.SIGN_IN -> stringResource(R.string.agent_step_sign_in, harness) to stringResource(R.string.agent_step_sign_in_hint)
|
||||
Step.SIGN_IN -> stringResource(R.string.agent_step_sign_in, harness) to stringResource(if (keyed) R.string.agent_step_sign_in_key_hint else R.string.agent_step_sign_in_hint)
|
||||
Step.GITHUB -> stringResource(R.string.agent_step_github) to stringResource(R.string.agent_step_github_hint)
|
||||
Step.BUILD_TOOLS -> stringResource(R.string.agent_step_build) to stringResource(R.string.agent_step_build_hint)
|
||||
Step.PREPARE -> stringResource(R.string.agent_step_prepare) to stringResource(R.string.agent_step_prepare_hint)
|
||||
|
||||
@@ -156,7 +156,10 @@ internal fun DesktopPage(s: FrontEndState, a: FrontEndActions, modifier: Modifie
|
||||
},
|
||||
rows = { tab ->
|
||||
if (tab == SheetTab.FILES) DesktopFiles(s, a)
|
||||
else a.modeSheet(mode, tab, SheetExtras())
|
||||
else a.modeSheet(mode, tab, SheetExtras(
|
||||
performance = { PerformanceLink(a, "desktop", SheetTab.SESSION) },
|
||||
drivers = { summary -> DriversLink(a, summary, "desktop", stringResource(R.string.hop_from_play)) },
|
||||
))
|
||||
},
|
||||
)
|
||||
if (adding && !s.busy) AddAppDialog(s.ready, onDismiss = { adding = false }) { request, label -> UserAppsState.add(ctx, request, label) }
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.expandVertically
|
||||
import androidx.compose.animation.fadeIn
|
||||
import androidx.compose.animation.fadeOut
|
||||
import androidx.compose.animation.shrinkVertically
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Settings
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.ui.layout.onGloballyPositioned
|
||||
import androidx.compose.ui.layout.positionInRoot
|
||||
import androidx.compose.ui.layout.boundsInRoot
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.droiddeck.launcher.R
|
||||
|
||||
internal object DownloadsNav {
|
||||
var showSettings = false
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun DownloadsPage(s: FrontEndState, a: FrontEndActions, modifier: Modifier) {
|
||||
val pal = LocalPalette.current
|
||||
val live = androidx.compose.runtime.rememberUpdatedState(s)
|
||||
var gearAt by androidx.compose.runtime.remember { androidx.compose.runtime.mutableStateOf<androidx.compose.ui.geometry.Rect?>(null) }
|
||||
val openSettings = { gearAt?.let { StoresMotion.ask(downloadsSettingsStep(it, live, a, pal.signal)) } }
|
||||
androidx.compose.runtime.LaunchedEffect(gearAt != null) {
|
||||
if (gearAt != null && DownloadsNav.showSettings) { DownloadsNav.showSettings = false; openSettings() }
|
||||
}
|
||||
var hostAt by androidx.compose.runtime.remember { androidx.compose.runtime.mutableStateOf(androidx.compose.ui.geometry.Offset.Zero) }
|
||||
androidx.compose.runtime.DisposableEffect(Unit) { val page = Any(); StoresMotion.hosting(page); onDispose { StoresMotion.release(page) } }
|
||||
androidx.activity.compose.BackHandler(enabled = StoresMotion.stepOpen) { StoresMotion.fold() }
|
||||
androidx.compose.foundation.layout.Box(androidx.compose.ui.Modifier.fillMaxSize().onGloballyPositioned { hostAt = it.positionInRoot() }) {
|
||||
Column(modifier.verticalScroll(rememberScrollState()).padding(bottom = 24.dp)) {
|
||||
PageHeader(stringResource(R.string.stores_tab_downloads)) {
|
||||
Spacer(Modifier.weight(1f))
|
||||
androidx.compose.foundation.layout.Box(Modifier.onGloballyPositioned { gearAt = it.boundsInRoot() }) {
|
||||
SmallIconButton(Icons.Filled.Settings, stringResource(R.string.downloads_settings), tint = MaterialTheme.colorScheme.onSurfaceVariant) {
|
||||
openSettings()
|
||||
}
|
||||
}
|
||||
}
|
||||
StoresDownloadsPane(s, a)
|
||||
}
|
||||
StoresMotion.step?.let { ask ->
|
||||
androidx.compose.runtime.key(ask) {
|
||||
StepOut(
|
||||
open = StoresMotion.stepOpen, pill = ask.anchor.translate(-hostAt), preferredSide = ask.side, accent = ask.accent,
|
||||
onDismiss = { StoresMotion.fold() }, onClosed = { StoresMotion.closed(ask) },
|
||||
pillCorner = ask.pillCorner, maxWidth = ask.maxWidth, items = ask.items, handle = ask.handle, content = ask.content,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.fadeIn
|
||||
import androidx.compose.animation.fadeOut
|
||||
import androidx.compose.animation.slideInHorizontally
|
||||
import androidx.compose.animation.slideOutHorizontally
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.gestures.detectTapGestures
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.displayCutout
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.widthIn
|
||||
import androidx.compose.foundation.layout.windowInsetsPadding
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.filled.KeyboardArrowLeft
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.input.pointer.pointerInput
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.Role
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import kotlinx.coroutines.delay
|
||||
|
||||
private const val HINT_SESSIONS = 3
|
||||
private const val HINT_MS = 6_000L
|
||||
private var hintedSession: Any? = null
|
||||
|
||||
@Composable
|
||||
internal fun DrawerEntryHint(steam: Boolean, inverted: Boolean, onOpen: () -> Unit) {
|
||||
val context = LocalContext.current
|
||||
var shown by remember { mutableStateOf(false) }
|
||||
LaunchedEffect(Unit) {
|
||||
val session = com.droiddeck.launcher.session.SessionState.sessionId
|
||||
if (hintedSession == session || SessionPrefs.drawerHintShown(context) >= HINT_SESSIONS) return@LaunchedEffect
|
||||
hintedSession = session
|
||||
SessionPrefs.countDrawerHint(context)
|
||||
shown = true
|
||||
delay(HINT_MS)
|
||||
shown = false
|
||||
}
|
||||
Box(Modifier.fillMaxSize().windowInsetsPadding(WindowInsets.displayCutout), contentAlignment = Alignment.CenterEnd) {
|
||||
AnimatedVisibility(shown, enter = slideInHorizontally { it } + fadeIn(), exit = slideOutHorizontally { it } + fadeOut()) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp),
|
||||
modifier = Modifier
|
||||
.clip(RoundedCornerShape(topStart = 14.dp, bottomStart = 14.dp))
|
||||
.background(Color(0xE6101216))
|
||||
.clickable(role = Role.Button, onClickLabel = stringResource(R.string.drawer_handle)) { shown = false; onOpen() }
|
||||
.padding(start = 10.dp, end = 14.dp, top = 10.dp, bottom = 10.dp)
|
||||
.widthIn(max = 260.dp)
|
||||
.testTag("drawer-hint"),
|
||||
) {
|
||||
Icon(Icons.AutoMirrored.Filled.KeyboardArrowLeft, null, tint = Color.White, modifier = Modifier.size(20.dp))
|
||||
val bound = remember {
|
||||
com.droiddeck.launcher.input.PhysicalShortcuts.read(context)
|
||||
.filter { it.action == com.droiddeck.launcher.input.PhysicalShortcuts.Action.DROIDDECK }
|
||||
.map { it.button.label }.distinct().joinToString(" / ")
|
||||
}
|
||||
Text(
|
||||
if (bound.isNotEmpty()) stringResource(R.string.drawer_hint_button, bound)
|
||||
else stringResource(if (!steam) R.string.drawer_hint else if (inverted) R.string.drawer_hint_steam_inverted else R.string.drawer_hint_steam),
|
||||
fontSize = 13.sp, fontWeight = FontWeight.SemiBold, color = Color.White,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun DrawerCornerTap(onOpen: () -> Unit) {
|
||||
Box(Modifier.fillMaxSize().windowInsetsPadding(WindowInsets.displayCutout), contentAlignment = Alignment.TopEnd) {
|
||||
Box(
|
||||
Modifier.size(64.dp).testTag("drawer-corner")
|
||||
.pointerInput(Unit) { detectTapGestures(onDoubleTap = { onOpen() }) },
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,11 @@ internal fun DroidDeckHudSettings(host: MenuHost, a: DrawerActions, track: (Stri
|
||||
DroidDeckHudSize.STRIP to stringResource(R.string.hud_size_strip),
|
||||
),
|
||||
size, chipModifier = track("hud-size")) { a.onHudSetting("hudSize", it.token) }
|
||||
ChoiceRow(host, "hud-hold", stringResource(R.string.hud_hold), null,
|
||||
listOf("collapse" to stringResource(R.string.hud_hold_collapse),
|
||||
DroidDeckHudConfig.HOLD_LOCKS to stringResource(R.string.hud_hold_lock)),
|
||||
if (cfg["hudHold"] == DroidDeckHudConfig.HOLD_LOCKS) DroidDeckHudConfig.HOLD_LOCKS else "collapse",
|
||||
chipModifier = track("hud-hold")) { a.onHudSetting("hudHold", it) }
|
||||
ToggleRow(host, "hud-locked", stringResource(R.string.hud_locked), stringResource(R.string.hud_locked_hint), on("hudLocked"),
|
||||
chipModifier = track("hud-locked")) { a.onHudSetting("hudLocked", flag(it)) }
|
||||
ToggleRow(host, "hud-snap", stringResource(R.string.hud_snap), stringResource(R.string.hud_snap_hint), on("hudSnap"),
|
||||
|
||||
@@ -465,7 +465,7 @@ internal fun BoxWithConstraintsScope.DropSheet(
|
||||
var handleSize by remember { mutableStateOf(androidx.compose.ui.unit.IntSize.Zero) }
|
||||
val lipH = 32.dp + state.pull.value.dp
|
||||
val drop = { if (!state.open && enabled) state.open = true }
|
||||
val settingsLabel = stringResource(R.string.drawer_page_settings)
|
||||
val settingsLabel = stringResource(R.string.sheet_lip)
|
||||
Box(
|
||||
contentAlignment = Alignment.BottomCenter,
|
||||
modifier = Modifier
|
||||
|
||||
@@ -251,6 +251,18 @@ private fun Content(
|
||||
}
|
||||
return
|
||||
}
|
||||
if (selected == "downloads") {
|
||||
DownloadsPage(s, a, modifier.padding(horizontal = padH).padding(top = padV))
|
||||
return
|
||||
}
|
||||
if (selected == "storage") {
|
||||
StorageTabPage(s, a, modifier.padding(horizontal = padH).padding(top = padV))
|
||||
return
|
||||
}
|
||||
if (selected == "sync") {
|
||||
SyncTabPage(s, modifier.padding(horizontal = padH).padding(top = padV))
|
||||
return
|
||||
}
|
||||
if (selected == "updates") {
|
||||
UpdatesPage(s, a, modifier.padding(horizontal = padH).padding(top = padV))
|
||||
return
|
||||
@@ -280,7 +292,10 @@ private fun Content(
|
||||
return
|
||||
}
|
||||
if (selected == NavTabs.MORE) {
|
||||
MorePage(s, a, onSelect, modifier.padding(horizontal = padH).padding(top = padV))
|
||||
Box(modifier) {
|
||||
MorePage(s, a, onSelect, Modifier.padding(horizontal = padH).padding(top = padV))
|
||||
EditTabsSheet(s, a)
|
||||
}
|
||||
return
|
||||
}
|
||||
if (selected == "agent") {
|
||||
|
||||
@@ -47,7 +47,10 @@ import androidx.compose.foundation.relocation.bringIntoViewRequester
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.Apps
|
||||
import androidx.compose.material.icons.outlined.AutoAwesome
|
||||
import androidx.compose.material.icons.outlined.Download
|
||||
import androidx.compose.material.icons.outlined.SdStorage
|
||||
import androidx.compose.material.icons.outlined.Sync
|
||||
import androidx.compose.material.icons.outlined.Terminal
|
||||
import androidx.compose.material.icons.outlined.DesktopWindows
|
||||
import androidx.compose.material.icons.outlined.Layers
|
||||
import androidx.compose.material.icons.outlined.LocalMall
|
||||
@@ -196,29 +199,33 @@ internal fun railLabelIcon(key: String): Pair<Int, ImageVector> = when (key) {
|
||||
"games" -> R.string.rail_games to Icons.Outlined.VideoLibrary
|
||||
"soundtracks" -> R.string.rail_music to SoundtrackIcon
|
||||
"stores" -> R.string.rail_stores to Icons.Outlined.LocalMall
|
||||
"downloads" -> R.string.stores_tab_downloads to Icons.Outlined.Download
|
||||
"desktop" -> R.string.rail_desktop to Icons.Outlined.DesktopWindows
|
||||
"components" -> R.string.rail_components to Icons.Outlined.Layers
|
||||
"agent" -> R.string.rail_agent to Icons.Outlined.AutoAwesome
|
||||
"agent" -> R.string.rail_agent to Icons.Outlined.Terminal
|
||||
"android-apps" -> R.string.rail_apps to Icons.Outlined.Apps
|
||||
"setup" -> R.string.rail_setup to Icons.Outlined.Tune
|
||||
"trinkets" -> R.string.rail_trinkets to Icons.Outlined.Toys
|
||||
"storage" -> R.string.rail_storage to Icons.Outlined.SdStorage
|
||||
"sync" -> R.string.rail_sync to Icons.Outlined.Sync
|
||||
NavTabs.MORE -> R.string.rail_more to Icons.Outlined.MoreHoriz
|
||||
else -> R.string.rail_updates to Icons.Outlined.SystemUpdate
|
||||
}
|
||||
|
||||
internal fun setupNeedsAttention(s: FrontEndState): Boolean = !s.ready || (s.available != null && s.available != s.installed) ||
|
||||
PhantomProcessLimit.blocksSteam(s.phantomProcessStatus) || com.droiddeck.launcher.sync.Syncthing.needsAttention
|
||||
PhantomProcessLimit.blocksSteam(s.phantomProcessStatus)
|
||||
|
||||
internal fun railBadge(s: FrontEndState, key: String, setupNeedsAttention: Boolean = setupNeedsAttention(s)): Boolean = when (key) {
|
||||
"setup" -> setupNeedsAttention
|
||||
"sync" -> com.droiddeck.launcher.sync.Syncthing.needsAttention
|
||||
"updates" -> s.updates.hasUpdate
|
||||
NavTabs.MORE -> NavTabs.more(s).any { it != NavTabs.MORE && railBadge(s, it, setupNeedsAttention) }
|
||||
else -> false
|
||||
}
|
||||
|
||||
internal fun railCount(s: FrontEndState, key: String): Int = when (key) {
|
||||
"stores" -> s.storeDownloadsActive
|
||||
NavTabs.MORE -> if ("stores" in NavTabs.more(s)) s.storeDownloadsActive else 0
|
||||
"downloads" -> s.storeDownloadsActive
|
||||
NavTabs.MORE -> if ("downloads" in NavTabs.more(s)) s.storeDownloadsActive else 0
|
||||
else -> 0
|
||||
}
|
||||
|
||||
@@ -228,13 +235,15 @@ private fun NavigationItems(
|
||||
place: (String) -> Modifier, onSelect: (String) -> Unit, onFocusSelect: (String) -> Unit,
|
||||
) {
|
||||
val setupNeedsAttention = setupNeedsAttention(s)
|
||||
val downloadsAt = if ("downloads" in NavTabs.more(s)) NavTabs.MORE else "downloads"
|
||||
for (key in navigationKeys(s)) {
|
||||
val (label, icon) = railLabelIcon(key)
|
||||
key(key) {
|
||||
RailItem(stringResource(label), icon, key, shown == key, compact, iconOnly, height, width,
|
||||
badge = railBadge(s, key, setupNeedsAttention),
|
||||
count = railCount(s, key),
|
||||
place = place, onFocus = { onFocusSelect(key) }) { onSelect(key) }
|
||||
place = { k -> if (k == downloadsAt) place(k).onGloballyPositioned { StoresMotion.downloadsChip = it.boundsInRoot() } else place(k) },
|
||||
onFocus = { onFocusSelect(key) }) { onSelect(key) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.ui.input.pointer.pointerInput
|
||||
import java.io.File
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import com.droiddeck.launcher.R
|
||||
@@ -246,6 +247,7 @@ class FrontEndActions(
|
||||
val onAddonDelete: (com.droiddeck.launcher.runtime.WowAddons.Target, String) -> Unit = { _, _ -> },
|
||||
val onSaveExport: (Library.SteamGame, com.droiddeck.launcher.session.GameSaves.Layout) -> Unit = { _, _ -> },
|
||||
val onPerformance: () -> Unit,
|
||||
val performancePanel: @Composable () -> Unit = {},
|
||||
val onRoms: () -> Unit,
|
||||
val onFiles: () -> Unit,
|
||||
val onBrowseFiles: (File) -> Unit = {},
|
||||
@@ -455,16 +457,26 @@ fun FrontEndScreen(s: FrontEndState, a: FrontEndActions, page: (@Composable () -
|
||||
val frontFocus = remember { FrontFocus() }
|
||||
val textInput = androidx.compose.ui.platform.LocalTextInputService.current
|
||||
val bottomTextInput = remember(textInput) { textInput?.let { androidx.compose.ui.text.input.TextInputService(BottomScreenTextInput(it)) } }
|
||||
androidx.compose.foundation.layout.BoxWithConstraints(Modifier.fillMaxSize()) {
|
||||
androidx.compose.foundation.layout.BoxWithConstraints(Modifier.fillMaxSize().pointerInput(Unit) {
|
||||
awaitPointerEventScope {
|
||||
while (true) {
|
||||
val e = awaitPointerEvent(androidx.compose.ui.input.pointer.PointerEventPass.Initial)
|
||||
e.changes.firstOrNull { it.pressed && !it.previousPressed }?.let { StoresMotion.touched(it.position) }
|
||||
}
|
||||
}
|
||||
}) {
|
||||
CompositionLocalProvider(
|
||||
LocalFrontFocus provides frontFocus,
|
||||
LocalNarrowPane provides (maxWidth < NarrowPaneWidth),
|
||||
androidx.compose.ui.platform.LocalTextInputService provides (if (s.dualScreen) bottomTextInput else textInput),
|
||||
LocalBottomTyping provides s.dualScreen,
|
||||
) { FrontEndScreenBody(s, a, page, frontFocus) }
|
||||
DownloadFlights()
|
||||
}
|
||||
}
|
||||
|
||||
private val SETTINGS_NAV = SettingsSection.entries.map { "settings:${it.key}" }.toSet() + "settings"
|
||||
|
||||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Composable () -> Unit)?, frontFocus: FrontFocus) {
|
||||
@@ -475,11 +487,12 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
|
||||
LaunchedEffect(s.navigate) {
|
||||
val target = s.navigate ?: return@LaunchedEffect
|
||||
when (target) {
|
||||
"stores:downloads" -> { com.droiddeck.launcher.stores.StoresState.openDownloads = true; selected = "stores" }
|
||||
"stores:downloads" -> selected = "downloads"
|
||||
"components" -> a.onComponents(true)
|
||||
"setup:launcher" -> { SetupTabs.openLauncher = true; selected = "setup" }
|
||||
com.droiddeck.launcher.sync.SyncthingService.NAV -> com.droiddeck.launcher.sync.Syncthing.requestOpen()
|
||||
"setup:integration" -> { SetupTabs.openOverview = true; selected = "setup" }
|
||||
in SETTINGS_NAV -> { SetupTabs.openSection = SettingsSection.of(target.removePrefix("settings:")) ?: SettingsSection.OVERVIEW; selected = "setup" }
|
||||
com.droiddeck.launcher.core.AppUiPrefs.HOME_PAGE_APPS -> {
|
||||
// Home lands on the apps page itself, so a page open over the rail (Components, Performance) closes first.
|
||||
if (s.pageKey != null) a.onPageBack()
|
||||
@@ -595,7 +608,7 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
|
||||
|
||||
val openTab = when {
|
||||
Hops.origin != null && s.pageKey == Hops.origin?.page -> Hops.origin!!.dest
|
||||
s.pageKey == "performance" -> "steam"
|
||||
s.pageKey == "performance" -> "setup"
|
||||
s.pageKey == "controller-mapping" -> "setup"
|
||||
selected.startsWith("app:") -> "games"
|
||||
selected.startsWith("sound:") -> "soundtracks"
|
||||
@@ -616,10 +629,29 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
|
||||
}
|
||||
}
|
||||
LaunchedEffect(com.droiddeck.launcher.storage.StorageState.openRequests) {
|
||||
if (com.droiddeck.launcher.storage.StorageState.openPending) showRailPage("setup", true)
|
||||
if (com.droiddeck.launcher.storage.StorageState.openPending) {
|
||||
com.droiddeck.launcher.storage.StorageState.openPending = false
|
||||
showRailPage("storage", true)
|
||||
}
|
||||
}
|
||||
LaunchedEffect(com.droiddeck.launcher.sync.Syncthing.openRequests) {
|
||||
if (com.droiddeck.launcher.sync.Syncthing.openPending) showRailPage("setup", true)
|
||||
if (com.droiddeck.launcher.sync.Syncthing.openPending) {
|
||||
com.droiddeck.launcher.sync.Syncthing.openPending = false
|
||||
showRailPage("sync", true)
|
||||
}
|
||||
}
|
||||
LaunchedEffect(com.droiddeck.launcher.stores.StoresState.openDownloads) {
|
||||
if (com.droiddeck.launcher.stores.StoresState.openDownloads) {
|
||||
com.droiddeck.launcher.stores.StoresState.openDownloads = false
|
||||
showRailPage("downloads", true)
|
||||
}
|
||||
}
|
||||
LaunchedEffect(RailRequest.key) {
|
||||
RailRequest.key?.let { showRailPage(it, true) }
|
||||
RailRequest.key = null
|
||||
}
|
||||
LaunchedEffect(SetupTabs.openSection) {
|
||||
if (SetupTabs.openSection != null && (railSelection != "setup" || s.pageKey != null)) showRailPage("setup", true)
|
||||
}
|
||||
val onRailFocus: (String) -> Unit = { key ->
|
||||
if (key != railSelection) showRailPage(key, false)
|
||||
|
||||
@@ -86,16 +86,19 @@ import com.droiddeck.launcher.R
|
||||
|
||||
internal enum class CheckState { OK, WARN, BUSY }
|
||||
|
||||
private const val STORAGE_TAB = 3
|
||||
private const val LAUNCHER_TAB = 2
|
||||
private val OVERVIEW_TAB = SettingsSection.OVERVIEW.ordinal
|
||||
private val PERFORMANCE_TAB = SettingsSection.PERFORMANCE.ordinal
|
||||
private val CONTROLLER_TAB = SettingsSection.CONTROLLER.ordinal
|
||||
private val GLASSES_TAB = SettingsSection.GLASSES.ordinal
|
||||
private val LAUNCHER_TAB = SettingsSection.LAUNCHER.ordinal
|
||||
private val DEVELOPER_TAB = SettingsSection.DEVELOPER.ordinal
|
||||
|
||||
internal object SetupTabs {
|
||||
var openLauncher = false
|
||||
var focusTabs = false
|
||||
var openOverview = false
|
||||
var openSection by mutableStateOf<SettingsSection?>(null)
|
||||
}
|
||||
private const val GLASSES_TAB = 6
|
||||
private const val SYNC_TAB = 4
|
||||
|
||||
@Composable
|
||||
internal fun CheckRow(state: CheckState, title: String, detail: String?, divider: Boolean = true, action: (@Composable () -> Unit)? = null) {
|
||||
@@ -193,40 +196,28 @@ internal fun SetupPanel(
|
||||
onDismiss = { editDownloadProxy = false },
|
||||
onSave = { a.onDownloadProxy(it); editDownloadProxy = false },
|
||||
)
|
||||
val tabs = listOf(stringResource(R.string.setup_tab_overview), stringResource(R.string.setup_tab_controller), stringResource(R.string.setup_tab_launcher), stringResource(R.string.setup_tab_storage), stringResource(R.string.setup_tab_sync), stringResource(R.string.setup_tab_diagnostics), stringResource(R.string.setup_tab_glasses))
|
||||
var tab by rememberSaveable { mutableStateOf(if (SetupTabs.openLauncher) LAUNCHER_TAB else 0) }
|
||||
val tabs = SettingsSection.entries.map { stringResource(it.title) }
|
||||
var tab by rememberSaveable { mutableStateOf(SetupTabs.openSection?.ordinal ?: if (SetupTabs.openLauncher) LAUNCHER_TAB else OVERVIEW_TAB) }
|
||||
var query by rememberSaveable { mutableStateOf("") }
|
||||
var searching by rememberSaveable { mutableStateOf(false) }
|
||||
var logsRefresh by remember { mutableStateOf(0) }
|
||||
var deleteSessionLogs by remember { mutableStateOf<java.io.File?>(null) }
|
||||
SetupTabs.openLauncher = false
|
||||
if (SetupTabs.openOverview) { tab = 0; SetupTabs.openOverview = false }
|
||||
if (SetupTabs.openOverview) { tab = OVERVIEW_TAB; SetupTabs.openOverview = false }
|
||||
LaunchedEffect(SetupTabs.openSection) {
|
||||
SetupTabs.openSection?.let { tab = it.ordinal; searching = false; query = "" }
|
||||
SetupTabs.openSection = null
|
||||
}
|
||||
val chipFocus = remember { List(tabs.size) { FocusRequester() } }
|
||||
var tabTurned by remember { mutableStateOf(false) }
|
||||
val pick: (Int) -> Unit = { i -> tab = i; tabTurned = true; if (i == 5) logsRefresh++ }
|
||||
val pick: (Int) -> Unit = { i -> tab = i; tabTurned = true; searching = false; query = ""; if (i == DEVELOPER_TAB) logsRefresh++ }
|
||||
val inputModeManager = LocalInputModeManager.current
|
||||
LaunchedEffect(com.droiddeck.launcher.storage.StorageState.openRequests) {
|
||||
if (com.droiddeck.launcher.storage.StorageState.openPending) {
|
||||
com.droiddeck.launcher.storage.StorageState.openPending = false
|
||||
tab = STORAGE_TAB
|
||||
}
|
||||
}
|
||||
LaunchedEffect(Unit) {
|
||||
while (true) {
|
||||
kotlinx.coroutines.delay(2_000)
|
||||
a.onRefreshPhantomStatus()
|
||||
}
|
||||
}
|
||||
LaunchedEffect(com.droiddeck.launcher.sync.Syncthing.openRequests) {
|
||||
if (com.droiddeck.launcher.sync.Syncthing.openPending) {
|
||||
com.droiddeck.launcher.sync.Syncthing.openPending = false
|
||||
tab = SYNC_TAB
|
||||
}
|
||||
}
|
||||
var syncAdvanced by rememberSaveable { mutableStateOf(false) }
|
||||
if (syncAdvanced) {
|
||||
androidx.activity.compose.BackHandler { syncAdvanced = false }
|
||||
SyncAdvancedPage(host) { syncAdvanced = false }
|
||||
return
|
||||
}
|
||||
LaunchedEffect(tab) {
|
||||
if (tabTurned && inputModeManager.inputMode == InputMode.Keyboard) {
|
||||
androidx.compose.runtime.withFrameNanos { }
|
||||
@@ -246,10 +237,18 @@ internal fun SetupPanel(
|
||||
) {
|
||||
PageHeader(stringResource(R.string.setup_title)) {
|
||||
Box(Modifier.weight(1f)) { SheetChips(tabs, tab, chipFocus, onPick = pick) }
|
||||
if (!searching) SearchIcon(stringResource(R.string.settings_search)) { searching = true }
|
||||
}
|
||||
Column(modifier = Modifier.weight(1f).fillMaxWidth().then(if (tab == 1) Modifier else Modifier.verticalScroll(rememberScrollState())).padding(bottom = if (tab == 1) 0.dp else 24.dp)) {
|
||||
when (tab) {
|
||||
0 -> {
|
||||
if (searching) {
|
||||
androidx.activity.compose.BackHandler { searching = false; query = "" }
|
||||
SettingsSearchField(query, { query = it }) { searching = false; query = "" }
|
||||
}
|
||||
val listing = searching && query.isNotBlank()
|
||||
val fixed = tab == CONTROLLER_TAB && !listing
|
||||
Column(modifier = Modifier.weight(1f).fillMaxWidth().then(if (fixed) Modifier else Modifier.verticalScroll(rememberScrollState())).padding(bottom = if (fixed) 0.dp else 24.dp)) {
|
||||
if (listing) SettingsSearchResults(query) { section -> pick(section.ordinal) }
|
||||
else when (tab) {
|
||||
OVERVIEW_TAB -> {
|
||||
// Setup's "Safe mode" row, under the GPU row while the bridge is on and can be used here.
|
||||
val bridgeModeRow = !s.adreno && s.vkBridge && com.droiddeck.launcher.core.DeviceSupport.bridgeUsable()
|
||||
val gpuCheck: @Composable (Boolean) -> Unit = { divider ->
|
||||
@@ -413,12 +412,16 @@ internal fun SetupPanel(
|
||||
SettingsGroup(stringResource(R.string.setup_runtime)) { runtimeCheck(false) }
|
||||
SteamIntegrationGroup(s.integration, s.integrationFocus, a.onIntegration, a.onIntegrationAppInfo, a.onIntegrationLocation)
|
||||
}
|
||||
1 -> {
|
||||
PERFORMANCE_TAB -> {
|
||||
a.performancePanel()
|
||||
MemoryGroup(s, a, host, onPairWirelessDebugging)
|
||||
}
|
||||
CONTROLLER_TAB -> {
|
||||
val controller = s.controller
|
||||
if (controller != null && a.controller != null) InputSettingsPage(onBack = { pick(0) }, embedded = true)
|
||||
if (controller != null && a.controller != null) InputSettingsPage(onBack = { pick(OVERVIEW_TAB) }, embedded = true)
|
||||
if (s.controller == null || a.controller == null) Note(stringResource(R.string.setup_controller_unavailable))
|
||||
}
|
||||
2 -> {
|
||||
LAUNCHER_TAB -> {
|
||||
val look: @Composable () -> Unit = {
|
||||
SettingsGroup(stringResource(R.string.setup_group_look)) {
|
||||
SettingsRow(stringResource(R.string.setup_theme), stringResource(R.string.setup_theme_hint)) {
|
||||
@@ -461,7 +464,6 @@ internal fun SetupPanel(
|
||||
LanguageRow(host, s.language, a.onLanguage)
|
||||
if (s.soundtracksEnabled) ToggleRow(host, "soundtracks-ingame", stringResource(R.string.setup_soundtracks_ingame), stringResource(R.string.setup_soundtracks_ingame_hint), s.soundtracksIngame, onChange = a.onSoundtracksIngame)
|
||||
}
|
||||
TabsSettingsGroup(host, s, a)
|
||||
}
|
||||
val device: @Composable () -> Unit = {
|
||||
SettingsGroup(stringResource(R.string.setup_group_device)) {
|
||||
@@ -588,12 +590,16 @@ internal fun SetupPanel(
|
||||
} else Column { look(); device(); art(); download() }
|
||||
}
|
||||
}
|
||||
STORAGE_TAB -> StoragePanel(s, a)
|
||||
SYNC_TAB -> SyncPanel(host, runtimeOk) { syncAdvanced = true }
|
||||
5 -> {
|
||||
SettingsGroup(stringResource(R.string.setup_tab_diagnostics)) {
|
||||
DEVELOPER_TAB -> {
|
||||
val devContext = LocalContext.current
|
||||
SettingsGroup(stringResource(R.string.dev_tools_title)) {
|
||||
ToggleRow(host, "developer-tools", stringResource(R.string.dev_tools_title), stringResource(R.string.dev_tools_hint), DeveloperTools.on) {
|
||||
DeveloperTools.set(devContext, it)
|
||||
}
|
||||
}
|
||||
SettingsGroup(stringResource(R.string.dev_group_logs)) {
|
||||
ToggleRow(host, "logs", stringResource(R.string.setup_logs), stringResource(R.string.setup_logs_hint), s.logsEnabled) { a.onLogs() }
|
||||
ToggleRow(
|
||||
if (DeveloperTools.on) ToggleRow(
|
||||
host, "enhanced-diagnostics", stringResource(R.string.setup_enhanced_diagnostics),
|
||||
stringResource(R.string.setup_enhanced_diagnostics_hint), s.enhancedDiagnosticsArmed,
|
||||
) { a.onEnhancedDiagnostics() }
|
||||
@@ -603,9 +609,9 @@ internal fun SetupPanel(
|
||||
s.gameDebugLogsEnabled,
|
||||
enabled = s.logsEnabled,
|
||||
) { a.onGameDebugLogs() }
|
||||
ToggleRow(host, "vacdiag", stringResource(R.string.setup_vac_diag), stringResource(R.string.setup_vac_diag_hint), s.vacDiagnostics) { a.onVacDiagnostics() }
|
||||
ToggleRow(host, "agent-commands", stringResource(R.string.setup_agent_commands), null, s.agentCommands) { a.onAgentCommands() }
|
||||
if (com.droiddeck.launcher.agent.AgentHost.available) {
|
||||
if (DeveloperTools.on) ToggleRow(host, "vacdiag", stringResource(R.string.setup_vac_diag), stringResource(R.string.setup_vac_diag_hint), s.vacDiagnostics) { a.onVacDiagnostics() }
|
||||
if (DeveloperTools.on) ToggleRow(host, "agent-commands", stringResource(R.string.setup_agent_commands), null, s.agentCommands) { a.onAgentCommands() }
|
||||
if (DeveloperTools.on && com.droiddeck.launcher.agent.AgentHost.available) {
|
||||
val agentContext = androidx.compose.ui.platform.LocalContext.current
|
||||
ToggleRow(host, "agent-pet", stringResource(R.string.setup_agent_pet), stringResource(R.string.setup_agent_pet_hint), AgentPet.enabled) {
|
||||
AgentPet.set(agentContext, it)
|
||||
@@ -615,8 +621,8 @@ internal fun SetupPanel(
|
||||
stringResource(R.string.setup_agent_pet_allow), onClick = { AgentPet.requestFloating(agentContext) },
|
||||
)
|
||||
}
|
||||
ToggleRow(host, "graphics-logs", stringResource(R.string.setup_graphics_logs), stringResource(R.string.setup_graphics_logs_hint), s.graphicsLogs) { a.onGraphicsLogs() }
|
||||
if (!s.adreno && com.droiddeck.launcher.session.SessionPrefs.steamGpuCompositingAllowed()) ToggleRow(host, "steam-gpu-drawing", stringResource(R.string.setup_steam_gpu_drawing), stringResource(R.string.setup_steam_gpu_drawing_hint), s.steamGpuDrawing) { a.onSteamGpuDrawing() }
|
||||
if (DeveloperTools.on) ToggleRow(host, "graphics-logs", stringResource(R.string.setup_graphics_logs), stringResource(R.string.setup_graphics_logs_hint), s.graphicsLogs) { a.onGraphicsLogs() }
|
||||
if (DeveloperTools.on && !s.adreno && com.droiddeck.launcher.session.SessionPrefs.steamGpuCompositingAllowed()) ToggleRow(host, "steam-gpu-drawing", stringResource(R.string.setup_steam_gpu_drawing), stringResource(R.string.setup_steam_gpu_drawing_hint), s.steamGpuDrawing) { a.onSteamGpuDrawing() }
|
||||
ActionRow(stringResource(R.string.setup_latest_logs), stringResource(R.string.drawer_logs_hint), stringResource(R.string.drawer_share_logs), a.onShareLogs,
|
||||
progress = com.droiddeck.launcher.session.SessionLogShare.progress)
|
||||
androidx.compose.material3.HorizontalDivider()
|
||||
@@ -661,38 +667,6 @@ internal fun SetupPanel(
|
||||
ActionRow(stringResource(R.string.setup_reset_settings), stringResource(R.string.setup_reset_settings_hint),
|
||||
stringResource(R.string.setup_reset_settings_button), a.onResetSettings)
|
||||
}
|
||||
SettingsGroup(stringResource(R.string.setup_group_memory)) {
|
||||
ToggleRow(
|
||||
host, "clear-cached-apps", stringResource(R.string.setup_clear_cached),
|
||||
stringResource(if (s.adbPaired) R.string.setup_clear_cached_hint else R.string.setup_clear_cached_unpaired),
|
||||
s.clearCachedApps, enabled = s.adbPaired || s.clearCachedApps,
|
||||
) { a.onClearCachedApps(it) }
|
||||
ChoiceRow(
|
||||
host, "background-app-limit", stringResource(R.string.setup_bg_limit),
|
||||
stringResource(if (s.adbPaired) R.string.setup_bg_limit_hint else R.string.setup_clear_cached_unpaired),
|
||||
listOf(
|
||||
com.droiddeck.launcher.core.BackgroundAppLimit.OFF to stringResource(R.string.game_env_off),
|
||||
4 to stringResource(R.string.setup_bg_limit_4),
|
||||
1 to stringResource(R.string.setup_bg_limit_1),
|
||||
0 to stringResource(R.string.setup_bg_limit_0),
|
||||
),
|
||||
s.backgroundAppLimit, enabled = s.adbPaired || s.backgroundAppLimit != com.droiddeck.launcher.core.BackgroundAppLimit.OFF,
|
||||
onPick = a.onBackgroundAppLimit,
|
||||
)
|
||||
ChoiceRow(
|
||||
host, "memory-hud", stringResource(R.string.setup_memory_hud), stringResource(R.string.setup_memory_hud_hint),
|
||||
listOf(
|
||||
com.droiddeck.launcher.session.SessionPrefs.MEMORY_HUD_OFF to stringResource(R.string.game_env_off),
|
||||
com.droiddeck.launcher.session.SessionPrefs.MEMORY_HUD_SIMPLE to stringResource(R.string.setup_memory_hud_simple),
|
||||
com.droiddeck.launcher.session.SessionPrefs.MEMORY_HUD_ADVANCED to stringResource(R.string.setup_memory_hud_advanced),
|
||||
),
|
||||
s.memoryHud, onPick = a.onMemoryHud,
|
||||
)
|
||||
if (!s.adbPaired) ActionRow(
|
||||
stringResource(R.string.setup_adb_pair), stringResource(R.string.setup_adb_pair_hint),
|
||||
stringResource(R.string.setup_adb_pair_button), onPairWirelessDebugging,
|
||||
)
|
||||
}
|
||||
}
|
||||
GLASSES_TAB -> GlassesSetupPanel()
|
||||
}
|
||||
@@ -715,6 +689,42 @@ internal fun SetupPanel(
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun MemoryGroup(s: FrontEndState, a: FrontEndActions, host: MenuHost, onPairWirelessDebugging: () -> Unit) {
|
||||
SettingsGroup(stringResource(R.string.setup_group_background_apps)) {
|
||||
ToggleRow(
|
||||
host, "clear-cached-apps", stringResource(R.string.setup_clear_cached),
|
||||
stringResource(if (s.adbPaired) R.string.setup_clear_cached_hint else R.string.setup_clear_cached_unpaired),
|
||||
s.clearCachedApps, enabled = s.adbPaired || s.clearCachedApps,
|
||||
) { a.onClearCachedApps(it) }
|
||||
ChoiceRow(
|
||||
host, "background-app-limit", stringResource(R.string.setup_bg_limit),
|
||||
stringResource(if (s.adbPaired) R.string.setup_bg_limit_hint else R.string.setup_clear_cached_unpaired),
|
||||
listOf(
|
||||
com.droiddeck.launcher.core.BackgroundAppLimit.OFF to stringResource(R.string.game_env_off),
|
||||
4 to stringResource(R.string.setup_bg_limit_4),
|
||||
1 to stringResource(R.string.setup_bg_limit_1),
|
||||
0 to stringResource(R.string.setup_bg_limit_0),
|
||||
),
|
||||
s.backgroundAppLimit, enabled = s.adbPaired || s.backgroundAppLimit != com.droiddeck.launcher.core.BackgroundAppLimit.OFF,
|
||||
onPick = a.onBackgroundAppLimit,
|
||||
)
|
||||
ChoiceRow(
|
||||
host, "memory-hud", stringResource(R.string.setup_memory_hud), stringResource(R.string.setup_memory_hud_hint),
|
||||
listOf(
|
||||
com.droiddeck.launcher.session.SessionPrefs.MEMORY_HUD_OFF to stringResource(R.string.game_env_off),
|
||||
com.droiddeck.launcher.session.SessionPrefs.MEMORY_HUD_SIMPLE to stringResource(R.string.setup_memory_hud_simple),
|
||||
com.droiddeck.launcher.session.SessionPrefs.MEMORY_HUD_ADVANCED to stringResource(R.string.setup_memory_hud_advanced),
|
||||
),
|
||||
s.memoryHud, onPick = a.onMemoryHud,
|
||||
)
|
||||
if (!s.adbPaired) ActionRow(
|
||||
stringResource(R.string.setup_adb_pair), stringResource(R.string.setup_adb_pair_hint),
|
||||
stringResource(R.string.setup_adb_pair_button), onPairWirelessDebugging,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun ReadinessCard(
|
||||
passing: Int, total: Int, line: String, open: Boolean, onDetails: () -> Unit, title: String? = null, ready: Boolean = passing == total,
|
||||
|
||||
@@ -59,7 +59,7 @@ import com.droiddeck.launcher.input.*
|
||||
import com.droiddeck.launcher.session.SessionState
|
||||
|
||||
private data class SurfaceSnapshot(val elements: List<InputSurfaceElement>, val actions: Map<String, InputAction>,
|
||||
val clicks: Map<String, InputAction>, val scale: Float)
|
||||
val clicks: Map<String, InputAction>, val scale: Float, val aspect: Float)
|
||||
|
||||
private class GamepadScaler(private val context: android.content.Context, private val width: Int, private val height: Int) {
|
||||
private fun generator(scale: Float) = LegacyGamepadLayout(context, width, height, scale = scale)
|
||||
@@ -83,6 +83,7 @@ private class SurfaceDraft(val layout: SavedInputLayout, val preset: SavedInputB
|
||||
var clickProperties by mutableStateOf(false)
|
||||
var history by mutableStateOf<List<SurfaceSnapshot>>(emptyList())
|
||||
var layoutScale by mutableFloatStateOf(layout.scale)
|
||||
var aspect by mutableFloatStateOf(layout.aspect)
|
||||
private var scaleBase by mutableStateOf<Triple<List<InputSurfaceElement>, List<InputSurfaceElement>, Float>?>(null)
|
||||
private var scaleValue by mutableIntStateOf(100)
|
||||
private val rescales get() = gamepad != null && elements.any { it.id in gamepad.ids }
|
||||
@@ -94,9 +95,14 @@ private class SurfaceDraft(val layout: SavedInputLayout, val preset: SavedInputB
|
||||
val positioned get() = (if (rescales) gamepad!!.reset(elements) else defaults?.let { elements.withPositionsOf(it) })
|
||||
?.takeIf { it != elements || rescales && layoutScale != 1f }
|
||||
val element get() = elements.firstOrNull { it.id == selected }
|
||||
val dirty get() = elements != layout.elements || actions != preset.elements || clicks != preset.clicks || layoutScale != layout.scale
|
||||
fun checkpoint() { history = (history + SurfaceSnapshot(elements, actions, clicks, layoutScale)).takeLast(40) }
|
||||
fun undo() { history.lastOrNull()?.let { elements = it.elements; actions = it.actions; clicks = it.clicks; layoutScale = it.scale; history = history.dropLast(1) } }
|
||||
val dirty get() = elements != layout.elements || actions != preset.elements || clicks != preset.clicks || layoutScale != layout.scale || aspect != layout.aspect
|
||||
fun checkpoint() { history = (history + SurfaceSnapshot(elements, actions, clicks, layoutScale, aspect)).takeLast(40) }
|
||||
fun undo() { history.lastOrNull()?.let { elements = it.elements; actions = it.actions; clicks = it.clicks; layoutScale = it.scale; aspect = it.aspect; history = history.dropLast(1) } }
|
||||
fun beginEdit(displayed: List<InputSurfaceElement>, aspect: Float) {
|
||||
checkpoint()
|
||||
elements = OnScreenLayout.editorFrame(layout.copy(elements = elements), displayed)
|
||||
this.aspect = aspect
|
||||
}
|
||||
fun scaleAll(percent: Int) {
|
||||
val base = scaleBase?.takeIf { it.second == elements } ?: Triple(elements, elements, if (rescales) layoutScale else 0f).also { checkpoint() }
|
||||
val factor = percent / 100f
|
||||
@@ -112,10 +118,6 @@ private class SurfaceDraft(val layout: SavedInputLayout, val preset: SavedInputB
|
||||
fun clickAction(e: InputSurfaceElement) = preset.copy(elements = actions, clicks = clicks).clickAction(e)
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
private fun displayAspect(display: Display): Float? = android.util.DisplayMetrics().also(display::getRealMetrics)
|
||||
.takeIf { it.widthPixels > 0 && it.heightPixels > 0 }?.let { (it.widthPixels.toFloat() / it.heightPixels).coerceIn(.05f, 20f) }
|
||||
|
||||
@Composable
|
||||
fun InputSurfaceDialog(profile: String, onDismiss: () -> Unit, onChanged: () -> Unit,
|
||||
role: InputRole = InputRole.SECONDARY, layoutId: String? = null, bindingsId: String? = null) {
|
||||
@@ -153,7 +155,7 @@ fun InputSurfaceDialog(profile: String, onDismiss: () -> Unit, onChanged: () ->
|
||||
InputLibraries.update(context) { latest ->
|
||||
val l = latest.layouts.first { it.id == savedLayout.id }
|
||||
val p = latest.preset(savedBindings.id)
|
||||
latest.withLayout(l.copy(elements = draft.elements, aspect = target?.let(::displayAspect) ?: l.aspect, scale = draft.layoutScale)).withPreset(p.copy(elements = draft.actions.filterKeys { id -> draft.elements.any { it.id == id } },
|
||||
latest.withLayout(l.copy(elements = draft.elements, aspect = draft.aspect, scale = draft.layoutScale)).withPreset(p.copy(elements = draft.actions.filterKeys { id -> draft.elements.any { it.id == id } },
|
||||
clicks = draft.clicks.filterKeys { id -> draft.elements.any { it.id == id && it.hasClick } }))
|
||||
}
|
||||
}.onSuccess { onChanged(); onDismiss() }.onFailure { failure = it.message ?: context.getString(R.string.input_save_failed) }
|
||||
@@ -253,10 +255,10 @@ private fun SurfaceCanvas(draft: SurfaceDraft, transparent: Boolean = false) {
|
||||
AndroidView(factory = { InputSurfaceEditorView(it) }, modifier = Modifier.fillMaxSize().testTag("input-layout-canvas"),
|
||||
update = { view ->
|
||||
view.setBackgroundColor(if (transparent) android.graphics.Color.TRANSPARENT else android.graphics.Color.rgb(10, 11, 13))
|
||||
view.style = draft.layout.style.copy(hidden = emptySet()); view.elements = draft.elements; view.selected = draft.selected; view.snap = draft.snap
|
||||
view.style = draft.layout.style.copy(hidden = emptySet()); view.sourceLayout = draft.layout; view.aspect = draft.aspect; view.elements = draft.elements; view.selected = draft.selected; view.snap = draft.snap
|
||||
view.isEnabled = !draft.properties && !draft.adding
|
||||
view.onSelect = { if (!draft.properties) draft.selected = it }
|
||||
view.onBeginEdit = draft::checkpoint
|
||||
view.onBeginEdit = draft::beginEdit
|
||||
view.onChange = { e -> if (!draft.properties) draft.elements = draft.elements.map { if (it.id == e.id) e else it } }
|
||||
|
||||
})
|
||||
|
||||
@@ -9,6 +9,8 @@ import android.view.HapticFeedbackConstants
|
||||
import android.view.MotionEvent
|
||||
import android.view.ViewConfiguration
|
||||
import android.widget.FrameLayout
|
||||
import com.droiddeck.launcher.input.OnScreenLayout
|
||||
import com.droiddeck.launcher.input.SavedInputLayout
|
||||
import com.droiddeck.launcher.input.InputSurfaceElement
|
||||
import com.droiddeck.launcher.input.InputSurfaceStyle
|
||||
import com.droiddeck.launcher.input.snapSurfaceElement
|
||||
@@ -16,7 +18,11 @@ import kotlin.math.abs
|
||||
|
||||
internal class InputSurfaceEditorView(context: Context) : FrameLayout(context) {
|
||||
var elements: List<InputSurfaceElement> = emptyList()
|
||||
set(value) { field = value; preview.updateCustomLayout(value); invalidate() }
|
||||
set(value) { field = value; refreshElements(); invalidate() }
|
||||
var aspect = 1f
|
||||
set(value) { field = value; refreshElements(); invalidate() }
|
||||
var sourceLayout: SavedInputLayout? = null
|
||||
set(value) { field = value; refreshElements(); invalidate() }
|
||||
var style = InputSurfaceStyle()
|
||||
set(value) { field = value; preview.updateStyle(value) }
|
||||
var snap = true
|
||||
@@ -26,7 +32,7 @@ internal class InputSurfaceEditorView(context: Context) : FrameLayout(context) {
|
||||
var selected: String? = null
|
||||
set(value) { field = value; invalidate() }
|
||||
var onSelect: (String?) -> Unit = {}
|
||||
var onBeginEdit: () -> Unit = {}
|
||||
var onBeginEdit: (List<InputSurfaceElement>, Float) -> Unit = { _, _ -> }
|
||||
var onChange: (InputSurfaceElement) -> Unit = {}
|
||||
private val preview = InputSurfaceView(context)
|
||||
private val paint = Paint(Paint.ANTI_ALIAS_FLAG).apply { color = Color.rgb(26, 159, 255); strokeWidth = 2 * resources.displayMetrics.density }
|
||||
@@ -37,17 +43,31 @@ internal class InputSurfaceEditorView(context: Context) : FrameLayout(context) {
|
||||
private var corner = 0
|
||||
private var dragging = false
|
||||
|
||||
private var visibleElements: List<InputSurfaceElement> = emptyList()
|
||||
|
||||
init {
|
||||
setBackgroundColor(Color.rgb(10, 11, 13))
|
||||
addView(preview, LayoutParams(-1, -1))
|
||||
}
|
||||
|
||||
private fun refreshElements() {
|
||||
visibleElements = sourceLayout?.let { layout ->
|
||||
OnScreenLayout.editorElements(context, layout.copy(elements = elements, aspect = aspect), width, height)
|
||||
} ?: elements
|
||||
preview.updateCustomLayout(visibleElements)
|
||||
}
|
||||
|
||||
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
|
||||
super.onSizeChanged(w, h, oldw, oldh)
|
||||
refreshElements()
|
||||
}
|
||||
|
||||
override fun dispatchDraw(canvas: Canvas) {
|
||||
super.dispatchDraw(canvas)
|
||||
paint.style = Paint.Style.STROKE
|
||||
guideX?.let { canvas.drawLine(width * it, 0f, width * it, height.toFloat(), paint) }
|
||||
guideY?.let { canvas.drawLine(0f, height * it, width.toFloat(), height * it, paint) }
|
||||
val e = elements.firstOrNull { it.id == selected } ?: return
|
||||
val e = visibleElements.firstOrNull { it.id == selected } ?: return
|
||||
val l = width * e.x; val t = height * e.y; val r = l + width * e.width; val b = t + height * e.height
|
||||
paint.style = Paint.Style.STROKE; canvas.drawRect(l, t, r, b, paint)
|
||||
paint.style = Paint.Style.FILL
|
||||
@@ -65,7 +85,7 @@ internal class InputSurfaceEditorView(context: Context) : FrameLayout(context) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
clearGuides()
|
||||
downX = event.x; downY = event.y; dragging = false; corner = 0
|
||||
val current = elements.firstOrNull { it.id == selected }
|
||||
val current = visibleElements.firstOrNull { it.id == selected }
|
||||
if (current != null) {
|
||||
val left = width * current.x; val top = height * current.y
|
||||
val right = left + width * current.width; val bottom = top + height * current.height
|
||||
@@ -73,7 +93,7 @@ internal class InputSurfaceEditorView(context: Context) : FrameLayout(context) {
|
||||
val vertical = if (abs(downY - top) < radius) 4 else if (abs(downY - bottom) < radius) 8 else 0
|
||||
if (horizontal != 0 && vertical != 0) corner = horizontal or vertical
|
||||
}
|
||||
original = if (corner != 0) current else elements.asReversed().firstOrNull {
|
||||
original = if (corner != 0) current else visibleElements.asReversed().firstOrNull {
|
||||
downX / width in it.x..(it.x + it.width) && downY / height in it.y..(it.y + it.height)
|
||||
}
|
||||
selected = original?.id; onSelect(selected)
|
||||
@@ -81,7 +101,7 @@ internal class InputSurfaceEditorView(context: Context) : FrameLayout(context) {
|
||||
MotionEvent.ACTION_MOVE -> {
|
||||
val e = original ?: return true
|
||||
if (!dragging && abs(event.x - downX) + abs(event.y - downY) > ViewConfiguration.get(context).scaledTouchSlop) {
|
||||
dragging = true; onBeginEdit()
|
||||
dragging = true; onBeginEdit(visibleElements, width.toFloat() / height)
|
||||
}
|
||||
if (!dragging) return true
|
||||
val dx = (event.x - downX) / width; val dy = (event.y - downY) / height
|
||||
@@ -93,7 +113,7 @@ internal class InputSurfaceEditorView(context: Context) : FrameLayout(context) {
|
||||
val bottom = if (corner and 8 != 0) (e.y + e.height + dy).coerceIn(top + .03f, 1f) else e.y + e.height
|
||||
e.copy(x = left, y = top, width = right - left, height = bottom - top).bounded()
|
||||
}
|
||||
val aligned = if (snap) snapSurfaceElement(next, elements.filter { it.id != e.id }, 9 * resources.displayMetrics.density / width,
|
||||
val aligned = if (snap) snapSurfaceElement(next, visibleElements.filter { it.id != e.id }, 9 * resources.displayMetrics.density / width,
|
||||
9 * resources.displayMetrics.density / height, corner) else null
|
||||
if (aligned != null && (aligned.x != null && aligned.x != guideX || aligned.y != null && aligned.y != guideY)) performHapticFeedback(HapticFeedbackConstants.CLOCK_TICK)
|
||||
guideX = aligned?.x; guideY = aligned?.y
|
||||
|
||||
@@ -48,7 +48,7 @@ class InputSurfaceView(
|
||||
context: Context,
|
||||
private val pad: PadBridge? = null,
|
||||
private var customLayout: List<InputSurfaceElement> = emptyList(),
|
||||
private val inputRole: InputRole = InputRole.SECONDARY,
|
||||
val inputRole: InputRole = InputRole.SECONDARY,
|
||||
private var surfaceStyle: InputSurfaceStyle = InputSurfaceStyle(),
|
||||
private val haptics: Boolean = inputRole != InputRole.PRIMARY,
|
||||
) : FrameLayout(context) {
|
||||
@@ -59,6 +59,7 @@ class InputSurfaceView(
|
||||
private var requestedLayout = customLayout
|
||||
init { customLayout = surfaceStyle.shown(customLayout); addView(content, LayoutParams(-1, -1)); renderCustom(pad) }
|
||||
|
||||
val shownElements: List<InputSurfaceElement> get() = customLayout
|
||||
var onTouchMiss: ((MotionEvent) -> Unit)? = null
|
||||
private var forwardedPointers = 0
|
||||
|
||||
|
||||
@@ -322,7 +322,7 @@ internal fun LiftHero(
|
||||
|
||||
val touchOnly = inputMode.inputMode == InputMode.Touch
|
||||
val lipFocus = remember { FocusRequester() }
|
||||
val settingsLabel = stringResource(R.string.drawer_page_settings)
|
||||
val settingsLabel = stringResource(R.string.sheet_lip)
|
||||
var lipFocused by remember { mutableStateOf(false) }
|
||||
val lipWanted = !open && (!shown || lipBack) && (playFocused || playHovered || touchOnly || lipFocused) && drop?.let { it.open || it.shown } != true
|
||||
LaunchedEffect(lipWanted) {
|
||||
@@ -666,7 +666,7 @@ internal fun Handle(height: Dp, above: Boolean = false) {
|
||||
.drawBorderSidesAndFoot(pal.line, 12.dp, flip = above)
|
||||
.padding(start = 14.dp, end = 10.dp),
|
||||
) {
|
||||
Text(stringResource(R.string.drawer_page_settings), fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = colors.onSurfaceVariant, maxLines = 1)
|
||||
Text(stringResource(R.string.sheet_lip), fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = colors.onSurfaceVariant, maxLines = 1)
|
||||
Icon(
|
||||
if (above) Icons.Filled.KeyboardArrowDown else Icons.Filled.KeyboardArrowUp, null, tint = colors.onSurfaceVariant,
|
||||
modifier = Modifier.size(16.dp).graphicsLayer { translationY = if (still) 0f else (if (above) 3.dp else -3.dp).toPx() * lift },
|
||||
|
||||
@@ -213,6 +213,14 @@ class SheetExtras(
|
||||
fun ModeSheetRows(s: ModeSettings, a: ModeSettingsActions, tab: String, extras: SheetExtras = SheetExtras()) {
|
||||
val steam = s.mode == SessionService.MODE_STEAM
|
||||
val host = rememberMenuHost()
|
||||
Text(
|
||||
stringResource(when (s.mode) {
|
||||
SessionService.MODE_STEAM -> R.string.sheet_scope_steam
|
||||
SessionService.MODE_DESKTOP -> R.string.sheet_scope_desktop
|
||||
else -> R.string.sheet_scope_other
|
||||
}),
|
||||
fontSize = 12.sp, color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.padding(start = 4.dp, top = 2.dp, bottom = 4.dp),
|
||||
)
|
||||
if (tab == SheetTab.DISPLAY) {
|
||||
val context = LocalContext.current
|
||||
val portraitWindow = SessionPrefs.portrait(context)
|
||||
@@ -251,7 +259,7 @@ fun ModeSheetRows(s: ModeSettings, a: ModeSettingsActions, tab: String, extras:
|
||||
stringResource(R.string.display_integer_scaling_hint),
|
||||
listOf(
|
||||
false to stringResource(R.string.display_scaling_fit),
|
||||
true to stringResource(R.string.display_scaling_auto),
|
||||
true to stringResource(R.string.display_scaling_integer),
|
||||
),
|
||||
enabled, onPick = a.onIntegerScaling,
|
||||
)
|
||||
|
||||
@@ -28,6 +28,7 @@ import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.Role
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
@@ -43,10 +44,9 @@ internal fun MorePage(s: FrontEndState, a: FrontEndActions, onSelect: (String) -
|
||||
Column(modifier.verticalScroll(rememberScrollState())) {
|
||||
PageHeader(stringResource(R.string.rail_more)) {
|
||||
Spacer(Modifier.weight(1f))
|
||||
SecondaryButton(stringResource(R.string.more_edit_tabs), compact = true) {
|
||||
SetupTabs.openLauncher = true
|
||||
SetupTabs.focusTabs = true
|
||||
onSelect("setup")
|
||||
SecondaryButton(stringResource(R.string.more_edit_tabs), compact = true,
|
||||
modifier = Modifier.focusRequester(MoreTabs.button).testTag("more-edit-tabs")) {
|
||||
MoreTabs.editing = true
|
||||
}
|
||||
}
|
||||
BoxWithConstraints(Modifier.fillMaxWidth()) {
|
||||
|
||||
@@ -10,10 +10,25 @@ import com.droiddeck.launcher.session.SessionPrefs
|
||||
|
||||
internal enum class TabPlace { BAR, MORE, HIDDEN }
|
||||
|
||||
internal object DeveloperTools {
|
||||
var on by mutableStateOf(false)
|
||||
private set
|
||||
|
||||
fun load(context: Context) {
|
||||
on = SessionPrefs.developerTools(context)
|
||||
}
|
||||
|
||||
fun set(context: Context, enabled: Boolean) {
|
||||
on = enabled
|
||||
SessionPrefs.setDeveloperTools(context, enabled)
|
||||
}
|
||||
}
|
||||
|
||||
internal object NavTabs {
|
||||
const val MORE = "more"
|
||||
val FEATURES = setOf("stores", "soundtracks", "agent")
|
||||
val ALL = listOf("steam", "games", "soundtracks", "stores", "desktop", "agent", "components", "android-apps", "setup", "updates", "trinkets")
|
||||
val ALL = listOf("steam", "games", "soundtracks", "stores", "downloads", "desktop", "agent", "components", "android-apps", "storage", "sync", "setup", "updates", "trinkets")
|
||||
private val SHELVED_WHEN_NEW = setOf("storage", "sync")
|
||||
|
||||
var order by mutableStateOf(ALL)
|
||||
private set
|
||||
@@ -23,8 +38,10 @@ internal object NavTabs {
|
||||
private set
|
||||
|
||||
fun load(context: Context) {
|
||||
order = arrange(SessionPrefs.navTabOrder(context))
|
||||
shelved = SessionPrefs.navTabShelved(context).intersect(ALL.toSet())
|
||||
val saved = SessionPrefs.navTabOrder(context)
|
||||
order = arrange(saved)
|
||||
shelved = SessionPrefs.navTabShelved(context).intersect(ALL.toSet()) +
|
||||
if (saved.isEmpty()) emptySet() else SHELVED_WHEN_NEW - saved.toSet()
|
||||
hidden = SessionPrefs.navTabHidden(context).intersect(ALL.toSet()) - FEATURES - "setup"
|
||||
}
|
||||
|
||||
@@ -41,7 +58,7 @@ internal object NavTabs {
|
||||
|
||||
fun available(s: FrontEndState, key: String): Boolean = when (key) {
|
||||
"android-apps" -> s.isHomeApp
|
||||
"agent" -> AgentHost.available
|
||||
"agent" -> AgentHost.available && DeveloperTools.on
|
||||
else -> true
|
||||
}
|
||||
|
||||
@@ -54,7 +71,7 @@ internal object NavTabs {
|
||||
}
|
||||
|
||||
private fun featureOff(s: FrontEndState, key: String) = when (key) {
|
||||
"stores" -> !s.gameStoresEnabled
|
||||
"stores", "downloads" -> !s.gameStoresEnabled
|
||||
"soundtracks" -> !s.soundtracksEnabled
|
||||
"agent" -> !AgentTab.shown
|
||||
else -> false
|
||||
|
||||
@@ -83,15 +83,12 @@ fun PerformancePage(
|
||||
onClientCore: (Int, Boolean) -> Unit,
|
||||
onGameCore: (Int, Boolean) -> Unit,
|
||||
onDismiss: () -> Unit,
|
||||
embedded: Boolean = false,
|
||||
) {
|
||||
val host = rememberMenuHost()
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val coreItems = cores.map { it.core to it.label }
|
||||
SettingsPage(
|
||||
host, title = stringResource(R.string.perf_title),
|
||||
lede = stringResource(R.string.perf_lede),
|
||||
onBack = onDismiss,
|
||||
) {
|
||||
val body: @Composable () -> Unit = {
|
||||
SettingsGroup(stringResource(R.string.perf_client_cores_group)) {
|
||||
ToggleRow(
|
||||
host, "override", stringResource(R.string.perf_override),
|
||||
@@ -252,4 +249,12 @@ fun PerformancePage(
|
||||
}
|
||||
}
|
||||
}
|
||||
if (embedded) Column {
|
||||
Text(stringResource(R.string.perf_lede), fontSize = 13.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(horizontal = 4.dp, vertical = 6.dp))
|
||||
body()
|
||||
} else SettingsPage(
|
||||
host, title = stringResource(R.string.perf_title),
|
||||
lede = stringResource(R.string.perf_lede),
|
||||
onBack = onDismiss,
|
||||
) { body() }
|
||||
}
|
||||
@@ -41,6 +41,7 @@ import com.droiddeck.launcher.core.PhantomProcessLimit
|
||||
import com.droiddeck.launcher.core.PhantomProcessStatus
|
||||
import com.droiddeck.launcher.core.WirelessAdbPairingService
|
||||
import com.droiddeck.launcher.core.WirelessAdbPairingService.Stage
|
||||
import com.droiddeck.launcher.session.QuestExperimental
|
||||
|
||||
@Composable
|
||||
fun PhantomProcessGatePage(
|
||||
@@ -63,6 +64,7 @@ fun PhantomProcessGatePage(
|
||||
}
|
||||
}
|
||||
val hasToggle = PhantomProcessLimit.hasDeveloperToggle()
|
||||
val sideQuest = QuestExperimental.isSupported()
|
||||
|
||||
BoxWithConstraints(Modifier.fillMaxWidth()) {
|
||||
val compact = maxWidth < 620.dp && maxHeight < 500.dp
|
||||
@@ -78,12 +80,13 @@ fun PhantomProcessGatePage(
|
||||
BoxWithConstraints(Modifier.fillMaxWidth()) {
|
||||
val wide = maxWidth >= 620.dp
|
||||
val fix: @Composable ColumnScope.() -> Unit = {
|
||||
FixGroup(hasToggle, stage, environment, compact, applyingSavedPairing, onOpenDeveloperOptions, onFixWithWirelessDebugging,
|
||||
if (sideQuest) SideQuestGroup(compact, onCopyCommand)
|
||||
else FixGroup(hasToggle, stage, environment, compact, applyingSavedPairing, onOpenDeveloperOptions, onFixWithWirelessDebugging,
|
||||
onOpenNotificationSettings, onCancel = { WirelessAdbPairingService.cancel(context) })
|
||||
}
|
||||
val side: @Composable ColumnScope.() -> Unit = {
|
||||
StatusGroup(status, compact)
|
||||
OtherWays(hasToggle, compact, onOpenDeveloperOptions, onFixWithWirelessDebugging, onEnterAddressManually, onCopyCommand)
|
||||
if (!sideQuest) OtherWays(hasToggle, compact, onOpenDeveloperOptions, onFixWithWirelessDebugging, onEnterAddressManually, onCopyCommand)
|
||||
}
|
||||
if (wide) {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(14.dp), modifier = Modifier.widthIn(max = 900.dp).fillMaxWidth()) {
|
||||
@@ -246,16 +249,35 @@ private fun OtherWays(
|
||||
Body(stringResource(R.string.gate_manual_hint))
|
||||
SecondaryButton(stringResource(R.string.gate_enter_manually), compact = true, onClick = onEnterAddressManually)
|
||||
Body(stringResource(R.string.gate_from_computer))
|
||||
Text(
|
||||
PhantomProcessLimit.adbCommand(),
|
||||
style = MaterialTheme.typography.bodySmall.copy(fontFamily = FontFamily.Monospace, fontSize = 11.sp),
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
AdbCommand()
|
||||
SecondaryButton(stringResource(R.string.gate_copy_command), compact = true, onClick = onCopyCommand)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun SideQuestGroup(compact: Boolean, onCopyCommand: () -> Unit) {
|
||||
SettingsGroup(stringResource(R.string.gate_sidequest), compact = compact) {
|
||||
Column(
|
||||
modifier = Modifier.fillMaxWidth().padding(if (compact) 10.dp else 14.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
Body(stringResource(R.string.gate_sidequest_steps))
|
||||
AdbCommand()
|
||||
PrimaryButton(stringResource(R.string.gate_copy_command), compact = compact, onClick = onCopyCommand)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun AdbCommand() {
|
||||
Text(
|
||||
PhantomProcessLimit.adbCommand(),
|
||||
style = MaterialTheme.typography.bodySmall.copy(fontFamily = FontFamily.Monospace, fontSize = 11.sp),
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun Body(text: String, modifier: Modifier = Modifier, error: Boolean = false, warn: Boolean = false) {
|
||||
Text(
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.fadeIn
|
||||
import androidx.compose.animation.fadeOut
|
||||
import androidx.compose.animation.slideInHorizontally
|
||||
import androidx.compose.animation.slideOutHorizontally
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.BoxWithConstraints
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Close
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.focus.FocusRequester
|
||||
import androidx.compose.ui.focus.focusProperties
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.focus.onFocusChanged
|
||||
import androidx.compose.foundation.focusGroup
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.droiddeck.launcher.R
|
||||
|
||||
internal object MoreTabs {
|
||||
var editing by mutableStateOf(false)
|
||||
val button = FocusRequester()
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun StorageTabPage(s: FrontEndState, a: FrontEndActions, modifier: Modifier) {
|
||||
Column(modifier.verticalScroll(rememberScrollState()).padding(bottom = 24.dp)) {
|
||||
PageHeader(stringResource(R.string.rail_storage))
|
||||
StoragePanel(s, a)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun SyncTabPage(s: FrontEndState, modifier: Modifier) {
|
||||
val host = rememberMenuHost()
|
||||
var advanced by rememberSaveable { mutableStateOf(false) }
|
||||
if (advanced) {
|
||||
BackHandler { advanced = false }
|
||||
Box(modifier) { SyncAdvancedPage(host) { advanced = false } }
|
||||
return
|
||||
}
|
||||
Column(modifier.verticalScroll(rememberScrollState()).padding(bottom = 24.dp)) {
|
||||
PageHeader(stringResource(R.string.rail_sync))
|
||||
SyncPanel(host, s.ready && !s.busy && !s.removalPending) { advanced = true }
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(androidx.compose.ui.ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
internal fun EditTabsSheet(s: FrontEndState, a: FrontEndActions) {
|
||||
val pal = LocalPalette.current
|
||||
BackHandler(enabled = MoreTabs.editing) { MoreTabs.editing = false }
|
||||
androidx.compose.runtime.DisposableEffect(Unit) { onDispose { MoreTabs.editing = false } }
|
||||
var wasOpen by remember { mutableStateOf(false) }
|
||||
val closeInput = androidx.compose.ui.platform.LocalInputModeManager.current
|
||||
LaunchedEffect(MoreTabs.editing) {
|
||||
if (MoreTabs.editing) wasOpen = true
|
||||
else if (wasOpen && closeInput.inputMode == androidx.compose.ui.input.InputMode.Keyboard) focusSoon { MoreTabs.button }
|
||||
}
|
||||
Box(Modifier.fillMaxSize()) {
|
||||
AnimatedVisibility(MoreTabs.editing, enter = fadeIn(), exit = fadeOut()) {
|
||||
Box(
|
||||
Modifier.fillMaxSize().background(Color.Black.copy(alpha = 0.45f))
|
||||
.focusProperties { canFocus = false }
|
||||
.clickable(interactionSource = remember { MutableInteractionSource() }, indication = null) { MoreTabs.editing = false },
|
||||
)
|
||||
}
|
||||
BoxWithConstraints(Modifier.fillMaxSize(), contentAlignment = Alignment.CenterEnd) {
|
||||
val width = minOf(560.dp, maxWidth * 0.92f)
|
||||
AnimatedVisibility(MoreTabs.editing, enter = slideInHorizontally { it } + fadeIn(), exit = slideOutHorizontally { it } + fadeOut()) {
|
||||
val inside = remember { FocusRequester() }
|
||||
var holds by remember { mutableStateOf(false) }
|
||||
val openInput = androidx.compose.ui.platform.LocalInputModeManager.current
|
||||
// The launcher only takes focus in controller mode, so opening by touch switches to it like startup does.
|
||||
LaunchedEffect(Unit) {
|
||||
repeat(60) {
|
||||
androidx.compose.runtime.withFrameNanos { }
|
||||
if (holds || !MoreTabs.editing) return@LaunchedEffect
|
||||
if (openInput.inputMode != androidx.compose.ui.input.InputMode.Keyboard) openInput.requestInputMode(androidx.compose.ui.input.InputMode.Keyboard)
|
||||
runCatching { inside.requestFocus() }
|
||||
}
|
||||
}
|
||||
Column(
|
||||
Modifier.width(width).fillMaxHeight()
|
||||
.onFocusChanged { holds = it.hasFocus }
|
||||
.focusRequester(inside)
|
||||
.focusProperties { exit = { if (MoreTabs.editing) FocusRequester.Cancel else FocusRequester.Default } }
|
||||
.focusGroup()
|
||||
.background(MaterialTheme.colorScheme.background)
|
||||
.border(1.dp, pal.line).padding(horizontal = 18.dp, vertical = 16.dp).testTag("edit-tabs-sheet"),
|
||||
) {
|
||||
PageHeader(stringResource(R.string.more_edit_tabs)) {
|
||||
Spacer(Modifier.weight(1f))
|
||||
SmallIconButton(Icons.Filled.Close, stringResource(R.string.common_close), tint = MaterialTheme.colorScheme.onSurfaceVariant) {
|
||||
MoreTabs.editing = false
|
||||
}
|
||||
}
|
||||
Column(Modifier.weight(1f).verticalScroll(rememberScrollState())) {
|
||||
TabsSettingsGroup(rememberMenuHost(), s, a)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,8 @@ class SecondScreenPresentation(
|
||||
private var imeSeen = false
|
||||
private var fieldKeyboard = false
|
||||
private var terminalPanel: SessionTerminalPanel? = null
|
||||
private var controlsView: InputSurfaceView? = null
|
||||
var controlsView: InputSurfaceView? = null
|
||||
private set
|
||||
private var created = false
|
||||
|
||||
init {
|
||||
|
||||
@@ -14,7 +14,7 @@ internal enum class SessionDrawerPage(val firstControl: String) {
|
||||
}
|
||||
|
||||
internal fun sessionDrawerPages(
|
||||
hasSecondScreen: Boolean, hasGlasses: Boolean = false, hasAgent: Boolean = com.droiddeck.launcher.agent.AgentHost.installed && com.droiddeck.launcher.agent.AgentTab.shown,
|
||||
hasSecondScreen: Boolean, hasGlasses: Boolean = false, hasAgent: Boolean = com.droiddeck.launcher.agent.AgentHost.installed && com.droiddeck.launcher.agent.AgentTab.shown && DeveloperTools.on,
|
||||
): List<SessionDrawerPage> =
|
||||
SessionDrawerPage.entries.filter {
|
||||
(hasSecondScreen || it != SessionDrawerPage.SECOND_SCREEN) && (hasGlasses || it != SessionDrawerPage.GLASSES) &&
|
||||
|
||||
@@ -77,6 +77,7 @@ import androidx.compose.ui.text.PlatformTextStyle
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.style.LineHeightStyle
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.platform.testTag
|
||||
|
||||
|
||||
@Composable
|
||||
@@ -223,6 +224,9 @@ fun LoadingOverlay(
|
||||
modifier = Modifier.align(Alignment.BottomCenter).padding(start = 120.dp, end = 120.dp, bottom = 28.dp),
|
||||
)
|
||||
if (!ended && onCancel != null) CancelHint(onCancel, Modifier.align(Alignment.BottomEnd).padding(end = 16.dp, bottom = 16.dp))
|
||||
if (!ended && onShareLogs != null) androidx.compose.material3.TextButton(
|
||||
onClick = onShareLogs, modifier = Modifier.align(Alignment.BottomStart).padding(start = 16.dp, bottom = 12.dp).testTag("loading-report"),
|
||||
) { Text(stringResource(R.string.report_problem), fontSize = 13.sp, color = colors.onSurfaceVariant) }
|
||||
if (flood != null) FloodGather(flood, ball, onFlooded)
|
||||
}
|
||||
}
|
||||
@@ -242,7 +246,7 @@ private fun EndedActions(onRetry: (() -> Unit)?, onRepair: (() -> Unit)?, onShar
|
||||
if (onRepair != null) SecondaryButton(stringResource(R.string.store_try_again), modifier = claim(), onClick = onRetry)
|
||||
else PrimaryButton(stringResource(R.string.store_try_again), modifier = claim(), onClick = onRetry)
|
||||
}
|
||||
if (onShareLogs != null) SecondaryButton(stringResource(R.string.drawer_share_logs), modifier = claim(),
|
||||
if (onShareLogs != null) SecondaryButton(stringResource(R.string.report_problem), modifier = claim(),
|
||||
progress = com.droiddeck.launcher.session.SessionLogShare.progress, onClick = onShareLogs)
|
||||
if (onClose != null) SecondaryButton(stringResource(R.string.mode_back), modifier = claim(), onClick = onClose)
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@ import androidx.compose.material.icons.outlined.PowerSettingsNew
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
import androidx.compose.material.icons.outlined.DesktopWindows
|
||||
import androidx.compose.material.icons.outlined.Layers
|
||||
import androidx.compose.material.icons.outlined.AutoAwesome
|
||||
import androidx.compose.material.icons.outlined.ScreenShare
|
||||
import androidx.compose.material.icons.outlined.Pause
|
||||
import androidx.compose.material.icons.outlined.PictureInPictureAlt
|
||||
@@ -186,7 +185,7 @@ private val SessionDrawerPage.icon get() = when (this) {
|
||||
SessionDrawerPage.VR -> VrHeadsetIcon
|
||||
SessionDrawerPage.EFFECTS -> Icons.Outlined.AutoFixHigh
|
||||
SessionDrawerPage.GAMES -> Icons.Outlined.Layers
|
||||
SessionDrawerPage.AGENT -> Icons.Outlined.AutoAwesome
|
||||
SessionDrawerPage.AGENT -> Icons.Outlined.Terminal
|
||||
SessionDrawerPage.SESSION -> Icons.Outlined.Settings
|
||||
}
|
||||
|
||||
@@ -244,6 +243,8 @@ class DrawerActions(
|
||||
val fexPreset: String,
|
||||
val upscaler: Int = 0,
|
||||
val upscaleSharpness: Int = 75,
|
||||
val integerScaling: Boolean = false,
|
||||
val onIntegerScaling: (Boolean) -> Unit = {},
|
||||
val effects: ScreenEffects = ScreenEffects.OFF,
|
||||
val screenEffectsTarget: String = "auto",
|
||||
val screenEffectsTargets: List<Pair<String, String>> = emptyList(),
|
||||
@@ -260,6 +261,7 @@ class DrawerActions(
|
||||
val secondScreenNone: Boolean = true,
|
||||
val gameOnBottom: Boolean = false,
|
||||
val gameSwapAvailable: Boolean = false,
|
||||
val gameSwapBuiltIn: Boolean = true,
|
||||
val onGameOnBottom: (Boolean) -> Unit = {},
|
||||
val dashboardAvailable: Boolean = false,
|
||||
val desktopAvailable: Boolean = false,
|
||||
@@ -275,6 +277,8 @@ class DrawerActions(
|
||||
val onFrameGenReset: () -> Unit = {},
|
||||
val fpsLimit: Int = 0,
|
||||
val onFpsLimit: (Int) -> Unit = {},
|
||||
val cornerTap: Boolean = false,
|
||||
val onCornerTap: (Boolean) -> Unit = {},
|
||||
val blackFrameInsertion: Boolean = false,
|
||||
val blackFrameInsertionAvailable: Boolean = false,
|
||||
val onBlackFrameInsertion: (Boolean) -> Unit = {},
|
||||
@@ -616,8 +620,26 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont
|
||||
format = { if (it <= SessionPrefs.FPS_LIMIT_OFF) offLabel else it.toString() },
|
||||
modifier = focus.track(page, "fps-limit"),
|
||||
onChange = { a.onFpsLimit(if (it <= SessionPrefs.FPS_LIMIT_OFF) 0 else it) })
|
||||
if (a.steam && !a.direct && a.onQam != null) SettingsRow(
|
||||
stringResource(R.string.drawer_frame_limit), stringResource(R.string.drawer_frame_limit_steam_hint),
|
||||
) {
|
||||
DrawerOutlineButton(stringResource(R.string.drawer_open_steam_qam), modifier = focus.track(page, "fps-limit-steam")) {
|
||||
host.open = null
|
||||
a.onQam?.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
SettingsGroup(stringResource(R.string.display_image_scaling)) {
|
||||
if (a.steam) SettingsRow(stringResource(R.string.display_integer_scaling), null) {
|
||||
PadTextButton(
|
||||
onClick = { a.onIntegerScaling(!a.integerScaling) }
|
||||
) {
|
||||
Text(stringResource(
|
||||
if (a.integerScaling) R.string.display_scaling_integer
|
||||
else R.string.display_scaling_fit
|
||||
))
|
||||
}
|
||||
}
|
||||
ChoiceRow(host, "upscaler", stringResource(R.string.display_filter), null,
|
||||
SessionPrefs.upscalerChoices(LocalContext.current), a.upscaler,
|
||||
note = stringResource(R.string.display_filter_note),
|
||||
@@ -716,6 +738,9 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont
|
||||
SessionPrefs.BACK_DOUBLE_TAP_MS_OPTIONS.map { it to stringResource(R.string.back_tap_ms, it) },
|
||||
a.backDoubleTapMs, chipModifier = focus.track(page, "back-double-tap"), onPick = a.onBackDoubleTapMs)
|
||||
PhysicalShortcutRows(modifierFor = { focus.track(page, "physical-shortcut-${it.name}") })
|
||||
ToggleRow(host, "corner-tap", stringResource(R.string.drawer_corner_tap),
|
||||
stringResource(R.string.drawer_corner_tap_hint), a.cornerTap,
|
||||
chipModifier = focus.track(page, "corner-tap"), onChange = a.onCornerTap)
|
||||
}
|
||||
SettingsGroup(stringResource(R.string.drawer_latency)) {
|
||||
ToggleRow(host, "low-latency", stringResource(R.string.drawer_low_latency),
|
||||
@@ -808,6 +833,15 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont
|
||||
}
|
||||
SessionDrawerPage.AGENT -> Unit
|
||||
SessionDrawerPage.SESSION -> {
|
||||
SettingsGroup(stringResource(R.string.drawer_support)) {
|
||||
SettingsRow(stringResource(R.string.report_problem), stringResource(R.string.report_problem_hint)) {
|
||||
DrawerOutlineButton(stringResource(R.string.drawer_share_logs), modifier = focus.track(page, "share-logs"),
|
||||
progress = com.droiddeck.launcher.session.SessionLogShare.progress) {
|
||||
host.open = null
|
||||
a.onShareLogs()
|
||||
}
|
||||
}
|
||||
}
|
||||
if (a.isHomeApp) SettingsGroup(stringResource(R.string.drawer_android_apps)) {
|
||||
SettingsRow(stringResource(R.string.drawer_launch_app), null) {
|
||||
DrawerOutlineButton(if (androidAppsExpanded) stringResource(R.string.common_hide) else stringResource(R.string.common_show), modifier = focus.track(page, "apps")) {
|
||||
@@ -862,15 +896,6 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont
|
||||
onChange = a.onSteamDownloadsInBackground,
|
||||
)
|
||||
}
|
||||
SettingsGroup(stringResource(R.string.drawer_support)) {
|
||||
SettingsRow(stringResource(R.string.drawer_logs), stringResource(R.string.drawer_logs_hint)) {
|
||||
DrawerOutlineButton(stringResource(R.string.drawer_share_logs), modifier = focus.track(page, "share-logs"),
|
||||
progress = com.droiddeck.launcher.session.SessionLogShare.progress) {
|
||||
host.open = null
|
||||
a.onShareLogs()
|
||||
}
|
||||
}
|
||||
}
|
||||
if (a.pipSupported) SettingsGroup(stringResource(R.string.pip_title)) {
|
||||
ToggleRow(host, "pip-auto", stringResource(R.string.pip_auto), null,
|
||||
a.pipAutoEnter, onChange = a.onPipAutoEnter)
|
||||
@@ -1110,7 +1135,24 @@ private fun ScreenEffectsGroup(
|
||||
a.onEffects(picked.effects)
|
||||
}
|
||||
}
|
||||
ToggleRow(host, "fxaa", stringResource(R.string.drawer_fxaa), null, e.fxaa, chipModifier = track("fxaa")) { a.onEffects(e.copy(fxaa = it)) }
|
||||
ChoiceRow(host, "antialiasing", stringResource(R.string.drawer_antialiasing), null,
|
||||
listOf(
|
||||
"off" to stringResource(R.string.frame_gen_off),
|
||||
"fxaa" to stringResource(R.string.drawer_fxaa),
|
||||
"smaa" to stringResource(R.string.drawer_smaa),
|
||||
),
|
||||
when (e.aaMode) {
|
||||
ScreenEffects.AA_FXAA -> "fxaa"
|
||||
ScreenEffects.AA_SMAA -> "smaa"
|
||||
else -> "off"
|
||||
}, chipModifier = track("antialiasing")) { mode ->
|
||||
val aaMode = when (mode) {
|
||||
"fxaa" -> ScreenEffects.AA_FXAA
|
||||
"smaa" -> ScreenEffects.AA_SMAA
|
||||
else -> ScreenEffects.AA_OFF
|
||||
}
|
||||
a.onEffects(e.copy(aaMode = aaMode))
|
||||
}
|
||||
ToggleRow(host, "toon", stringResource(R.string.drawer_toon), null, e.toon, chipModifier = track("toon")) { a.onEffects(e.copy(toon = it)) }
|
||||
ToggleRow(host, "crt", stringResource(R.string.drawer_crt), null, e.crt, chipModifier = track("crt")) { a.onEffects(e.copy(crt = it)) }
|
||||
ToggleRow(host, "ntsc", stringResource(R.string.drawer_ntsc), null, e.ntsc, chipModifier = track("ntsc")) { a.onEffects(e.copy(ntsc = it)) }
|
||||
@@ -1274,7 +1316,8 @@ private fun SecondScreenGroup(host: MenuHost, a: DrawerActions, track: (String)
|
||||
}
|
||||
if (a.gameSwapAvailable || a.gameOnBottom) SettingsGroup(stringResource(R.string.swap_game_screen_group)) {
|
||||
ChoiceRow(host, "game-screen", stringResource(R.string.swap_game_screen), null,
|
||||
listOf(false to stringResource(R.string.swap_game_screen_top), true to stringResource(R.string.swap_game_screen_bottom)),
|
||||
if (a.gameSwapBuiltIn) listOf(false to stringResource(R.string.swap_game_screen_top), true to stringResource(R.string.swap_game_screen_bottom))
|
||||
else listOf(false to stringResource(R.string.main_primary), true to stringResource(R.string.main_secondary)),
|
||||
a.gameOnBottom, chipModifier = track("game-screen"), onPick = a.onGameOnBottom)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import android.content.Context
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.setValue
|
||||
import com.droiddeck.launcher.R
|
||||
|
||||
internal enum class SettingsSection(val key: String, @StringRes val title: Int) {
|
||||
OVERVIEW("overview", R.string.setup_tab_overview),
|
||||
PERFORMANCE("performance", R.string.setup_tab_performance),
|
||||
CONTROLLER("controller", R.string.setup_tab_controller),
|
||||
GLASSES("glasses", R.string.setup_tab_glasses),
|
||||
LAUNCHER("launcher", R.string.setup_tab_launcher),
|
||||
DEVELOPER("developer", R.string.setup_tab_diagnostics);
|
||||
|
||||
companion object {
|
||||
fun of(key: String?): SettingsSection? = entries.firstOrNull { it.key == key }
|
||||
}
|
||||
}
|
||||
|
||||
internal object RailRequest {
|
||||
var key by androidx.compose.runtime.mutableStateOf<String?>(null)
|
||||
}
|
||||
|
||||
internal enum class SettingsPlace(@StringRes val title: Int) {
|
||||
SETTINGS(R.string.settings_place_settings),
|
||||
TAB(R.string.settings_place_tab),
|
||||
DRAWER(R.string.settings_place_drawer),
|
||||
SHEET(R.string.settings_place_sheet),
|
||||
STEAM_QAM(R.string.settings_place_steam_qam),
|
||||
}
|
||||
|
||||
internal class SettingsEntry(
|
||||
val place: SettingsPlace,
|
||||
@StringRes val title: Int,
|
||||
@StringRes val group: Int? = null,
|
||||
val section: SettingsSection? = null,
|
||||
val words: List<String> = emptyList(),
|
||||
val developer: Boolean = false,
|
||||
val tab: String? = null,
|
||||
) {
|
||||
val within: Int? get() = section?.title ?: tab?.let { railLabelIcon(it).first } ?: group
|
||||
|
||||
fun path(context: Context): List<String> =
|
||||
listOfNotNull(context.getString(place.title), within?.let(context::getString), context.getString(title))
|
||||
|
||||
fun matches(context: Context, query: String): Boolean {
|
||||
val q = query.trim().lowercase()
|
||||
if (q.isEmpty()) return false
|
||||
val text = (path(context) + words).joinToString(" ").lowercase()
|
||||
return q.split(Regex("\\s+")).all { it in text }
|
||||
}
|
||||
}
|
||||
|
||||
internal object SettingsIndex {
|
||||
private fun s(section: SettingsSection, @StringRes title: Int, vararg words: String) =
|
||||
SettingsEntry(SettingsPlace.SETTINGS, title, section = section, words = words.toList())
|
||||
|
||||
private fun d(@StringRes group: Int, @StringRes title: Int, vararg words: String) =
|
||||
SettingsEntry(SettingsPlace.DRAWER, title, group = group, words = words.toList())
|
||||
|
||||
private fun sh(@StringRes group: Int, @StringRes title: Int, vararg words: String) =
|
||||
SettingsEntry(SettingsPlace.SHEET, title, group = group, words = words.toList())
|
||||
|
||||
val entries: List<SettingsEntry> = listOf(
|
||||
s(SettingsSection.OVERVIEW, R.string.setup_runtime, "ubuntu", "linux", "repair", "update"),
|
||||
s(SettingsSection.OVERVIEW, R.string.setup_limit, "phantom", "process", "killed", "background"),
|
||||
s(SettingsSection.OVERVIEW, R.string.setup_account, "steam", "login", "sign in"),
|
||||
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_override, "steam client cores", "cpu"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_game_cores, "cpu", "pin", "cores", "affinity"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_pace_cores, "cpu"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_glthread, "opengl", "gl"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_zink),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_noglerror),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_gsrealtime, "gamescope"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_gpuclock, "gpu", "clock", "max"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_ram_cap, "ram", "memory"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_vram_cap, "vram", "memory"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_zram_idle, "zram", "swap", "memory"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_zram_client, "zram", "swap", "memory"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.setup_clear_cached, "memory", "ram", "crash", "sleep", "killed"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.setup_bg_limit, "memory", "ram", "background apps"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.setup_memory_hud, "memory", "ram", "overlay"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_sysmem),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_xalia),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_esync, "esync", "sync", "wine"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_fsync, "fsync", "sync", "wine"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_fastsync, "ntsync", "sync", "wine"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_seccomp, "proot"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_fastpath, "proot"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_native_userland, "proot"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_cursor_composite, "mouse", "cursor"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_hostname, "name"),
|
||||
|
||||
s(SettingsSection.CONTROLLER, R.string.setup_tab_controller, "gamepad", "buttons", "mapping", "profile", "remap"),
|
||||
SettingsEntry(SettingsPlace.TAB, R.string.rail_storage, tab = "storage", words = listOf("sd card", "space", "uninstall", "disk")),
|
||||
SettingsEntry(SettingsPlace.TAB, R.string.rail_sync, tab = "sync", words = listOf("syncthing", "saves")),
|
||||
s(SettingsSection.GLASSES, R.string.setup_tab_glasses, "xreal", "viture", "vr", "ar"),
|
||||
|
||||
s(SettingsSection.LAUNCHER, R.string.setup_theme, "color", "dark"),
|
||||
s(SettingsSection.LAUNCHER, R.string.setup_app_scale, "size", "zoom"),
|
||||
s(SettingsSection.LAUNCHER, R.string.setup_launcher_icon),
|
||||
s(SettingsSection.LAUNCHER, R.string.setup_animations),
|
||||
s(SettingsSection.LAUNCHER, R.string.setup_rail_labels, "sidebar"),
|
||||
s(SettingsSection.LAUNCHER, R.string.setup_language, "translate"),
|
||||
SettingsEntry(SettingsPlace.TAB, R.string.setup_stores_speed, tab = "downloads", words = listOf("download", "speed", "bandwidth", "slow")),
|
||||
SettingsEntry(SettingsPlace.TAB, R.string.stores_parallel, tab = "downloads", words = listOf("download", "parallel", "queue", "at once")),
|
||||
SettingsEntry(SettingsPlace.TAB, R.string.setup_group_tabs, tab = NavTabs.MORE, words = listOf("tabs", "hide", "reorder", "agent", "stores", "edit tabs")),
|
||||
s(SettingsSection.LAUNCHER, R.string.setup_home, "home screen", "launcher"),
|
||||
s(SettingsSection.LAUNCHER, R.string.setup_launcher_orientation, "rotate", "portrait"),
|
||||
s(SettingsSection.LAUNCHER, R.string.setup_session_orientation, "rotate", "portrait"),
|
||||
s(SettingsSection.LAUNCHER, R.string.setup_fullscreen),
|
||||
s(SettingsSection.LAUNCHER, R.string.setup_dual_screen_launcher, "thor", "second screen", "bottom screen"),
|
||||
s(SettingsSection.LAUNCHER, R.string.setup_low_storage_warning),
|
||||
s(SettingsSection.LAUNCHER, R.string.mode_sgdb_key, "artwork", "steamgriddb"),
|
||||
s(SettingsSection.LAUNCHER, R.string.setup_download_source, "mirror", "china"),
|
||||
s(SettingsSection.LAUNCHER, R.string.setup_download_proxy),
|
||||
|
||||
s(SettingsSection.DEVELOPER, R.string.setup_latest_logs, "logs", "log", "bug", "report", "crash", "zip"),
|
||||
s(SettingsSection.DEVELOPER, R.string.setup_logs, "logs"),
|
||||
s(SettingsSection.DEVELOPER, R.string.setup_game_debug_logs, "logs", "wine", "proton"),
|
||||
SettingsEntry(SettingsPlace.SETTINGS, R.string.setup_enhanced_diagnostics, section = SettingsSection.DEVELOPER, words = listOf("logs"), developer = true),
|
||||
s(SettingsSection.DEVELOPER, R.string.setup_reset_settings, "default"),
|
||||
s(SettingsSection.DEVELOPER, R.string.dev_tools_title, "agent", "ai", "claude", "codex"),
|
||||
SettingsEntry(SettingsPlace.SETTINGS, R.string.setup_graphics_logs, section = SettingsSection.DEVELOPER, words = listOf("logs", "gpu"), developer = true),
|
||||
|
||||
d(R.string.drawer_page_display, R.string.drawer_frame_limit, "fps", "cap", "limit", "non-steam", "desktop"),
|
||||
d(R.string.drawer_page_display, R.string.frame_gen_title, "lsfg", "lossless", "fps"),
|
||||
d(R.string.drawer_page_display, R.string.display_filter, "upscale", "fsr", "sharpness"),
|
||||
d(R.string.drawer_hud, R.string.drawer_hud, "fps", "counter", "overlay", "performance"),
|
||||
d(R.string.drawer_page_controller, R.string.input_touchscreen, "touch", "mouse", "direct", "touchpad", "click"),
|
||||
d(R.string.drawer_page_controller, R.string.mode_osc, "on-screen", "controls", "touch controls", "buttons"),
|
||||
d(R.string.drawer_page_controller, R.string.osc_steam_layout, "touch layout", "edit layout", "on-screen"),
|
||||
d(R.string.drawer_page_controller, R.string.drawer_pc_keyboard, "keyboard", "typing"),
|
||||
d(R.string.mode_session, R.string.report_problem, "logs", "log", "bug", "crash", "share", "zip"),
|
||||
d(R.string.mode_session, R.string.mode_suspend, "sleep", "background", "native", "resume"),
|
||||
|
||||
SettingsEntry(SettingsPlace.STEAM_QAM, R.string.drawer_frame_limit, R.string.perf_title, words = listOf("fps", "cap", "limit", "steam games")),
|
||||
SettingsEntry(SettingsPlace.STEAM_QAM, R.string.perf_title, words = listOf("performance overlay", "fps", "counter", "tdp")),
|
||||
|
||||
sh(R.string.drawer_page_display, R.string.display_session, "resolution", "scaling", "hdr", "refresh"),
|
||||
sh(R.string.drawer_page_display, R.string.sheet_graphics_drivers, "turnip", "driver", "gpu", "adreno", "mali"),
|
||||
sh(R.string.mode_tab_steam, R.string.setup_offline, "offline", "steam"),
|
||||
sh(R.string.mode_audio, R.string.mode_mic, "microphone", "voice"),
|
||||
sh(R.string.mode_session, R.string.mode_suspend, "sleep", "background"),
|
||||
sh(R.string.stores_tab_library, R.string.stores_tab_library, "second library", "sd card", "steam library"),
|
||||
)
|
||||
|
||||
fun search(context: Context, query: String): List<SettingsEntry> =
|
||||
entries.filter { (!it.developer || DeveloperTools.on) && it.matches(context, query) }
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Close
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.input.ImeAction
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.droiddeck.launcher.R
|
||||
|
||||
@Composable
|
||||
internal fun SettingsSearchField(query: String, onQuery: (String) -> Unit, onClose: () -> Unit) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp),
|
||||
modifier = Modifier.fillMaxWidth().padding(bottom = 8.dp),
|
||||
) {
|
||||
AdbTextField(
|
||||
value = query, onValueChange = onQuery, label = "", keyboardType = KeyboardType.Text, imeAction = ImeAction.Search,
|
||||
placeholder = stringResource(R.string.settings_search), compact = true, showLabel = false, focusOnShow = true,
|
||||
modifier = Modifier.weight(1f),
|
||||
)
|
||||
SmallIconButton(Icons.Filled.Close, stringResource(R.string.settings_search_clear), tint = MaterialTheme.colorScheme.onSurfaceVariant, onClick = onClose)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun SettingsSearchResults(query: String, onOpen: (SettingsSection) -> Unit) {
|
||||
val ctx = LocalContext.current
|
||||
val found = remember(query) { SettingsIndex.search(ctx, query) }
|
||||
if (found.isEmpty()) {
|
||||
Note(stringResource(R.string.settings_search_none, query.trim()))
|
||||
return
|
||||
}
|
||||
Column {
|
||||
found.groupBy { it.place }.forEach { (place, entries) ->
|
||||
SettingsGroup(stringResource(place.title)) {
|
||||
entries.forEach { entry ->
|
||||
val within = entry.within?.let { stringResource(it) }
|
||||
val title = stringResource(entry.title)
|
||||
val section = entry.section
|
||||
val tab = entry.tab
|
||||
if (section != null) {
|
||||
ActionRow(title, within, stringResource(R.string.store_open), onClick = { onOpen(section) })
|
||||
} else if (tab != null) {
|
||||
ActionRow(title, within, stringResource(R.string.store_open), onClick = {
|
||||
if (tab == NavTabs.MORE) MoreTabs.editing = true
|
||||
if (tab == "downloads") DownloadsNav.showSettings = true
|
||||
RailRequest.key = tab
|
||||
})
|
||||
} else {
|
||||
SettingsRow(title, entry.path(ctx).dropLast(1).joinToString(" › ")) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loaded 100 of 220 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user