mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-06 21:15:43 +00:00
Compare commits
70
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d549085da | ||
|
|
d1cc4f5fa3 | ||
|
|
93709144b9 | ||
|
|
63b7499450 | ||
|
|
ea0f796bcd | ||
|
|
c85e82683b | ||
|
|
8290837584 | ||
|
|
88d44b0dc6 | ||
|
|
73fac3723f | ||
|
|
2469653f86 | ||
|
|
1596e2966d | ||
|
|
20c7cf8b7c | ||
|
|
16ea8d9168 | ||
|
|
cbf152bb3a | ||
|
|
423f600d4b | ||
|
|
3b0c0d3496 | ||
|
|
565bd7c6b1 | ||
|
|
6a2ac13efe | ||
|
|
caae385924 | ||
|
|
c54cadacde | ||
|
|
6da10cf986 | ||
|
|
b37bc316bb | ||
|
|
eaa64597e0 | ||
|
|
9d7821f120 | ||
|
|
c72316f5a7 | ||
|
|
b0f459607d | ||
|
|
374aa6d68c | ||
|
|
68940c862b | ||
|
|
6a6bab812f | ||
|
|
0b7d7aa634 | ||
|
|
b63a72affb | ||
|
|
b9f149b3c9 | ||
|
|
8d34be4b0d | ||
|
|
e595792dd7 | ||
|
|
8a27ea841c | ||
|
|
872c5e1834 | ||
|
|
2d25fb91c5 | ||
|
|
56213d74b3 | ||
|
|
68954badee | ||
|
|
b99cbb6bab | ||
|
|
9c6fafec4c | ||
|
|
f06c37e279 | ||
|
|
c89ac81869 | ||
|
|
b941bb1224 | ||
|
|
91dfc849f4 | ||
|
|
34fffd6cdd | ||
|
|
102c9aa546 | ||
|
|
bf2f2404ae | ||
|
|
593538582c | ||
|
|
1f9064ad59 | ||
|
|
5bad82d736 | ||
|
|
5b17639831 | ||
|
|
dea32f3418 | ||
|
|
85678d927a | ||
|
|
e0315e5b66 | ||
|
|
668e02fa17 | ||
|
|
3c4d349a47 | ||
|
|
fdcef6c3e5 | ||
|
|
56ac92de85 | ||
|
|
26dcce168a | ||
|
|
431f253db1 | ||
|
|
0ad153ec35 | ||
|
|
8e7cf7f683 | ||
|
|
7e1d6a3688 | ||
|
|
2f192fddee | ||
|
|
f94d5179c3 | ||
|
|
d6d47d379f | ||
|
|
59071d78db | ||
|
|
6b3e476917 | ||
|
|
5637eed4bd |
No files matched your search
@@ -307,6 +307,9 @@ jobs:
|
||||
aarch64-linux-gnu-gcc -O2 -Wall -o "$D/usr/local/bin/droiddeck-glprobe" tools/venus/glprobe.c -ldl
|
||||
aarch64-linux-gnu-strip --strip-unneeded "$D/usr/local/bin/droiddeck-glprobe"
|
||||
|
||||
- name: Build the LSE atomics emulator for ARMv8.0 CPUs
|
||||
run: bash tools/linuxfs/lse-emu/build.sh app/src/main/assets/linuxfs
|
||||
|
||||
- name: Check the preloads
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
- Helper scripts (`tools/linuxfs/overlay`, `tools/linuxfs/desktop`) are staged on every Gradle build, so editing them needs no `build_local.sh`. After preloads or other runtime components change, the fast loop warns and reuses the old binaries; run `tools/build_local.sh` when those matter. "Missing or changed runtime input" means the prepared files themselves changed: run `tools/build_local.sh` once. Do not revert scripts or copy `app/build` between checkouts; `tools/seed_worktree.sh` seeds a new worktree from the main checkout.
|
||||
- Every build defaults to the NDK in `tools/ci/toolchains.env`, as CI does. CI runs `testReleaseUnitTest` in the `Unit tests` workflow, beside Build APK; when a test fails only in CI, run the release variant locally.
|
||||
- Run the tests that cover what you changed, including unchanged tests of code you edited: `./gradlew -PskipRust=true :app:testDebugUnitTest --tests '<class>'` and `python3 -m unittest discover -s tools/tests -p 'test_<area>*.py'`. The full Python suite takes about 9 minutes, and some preload tests fail on any host without zram/ntsync. Leave full runs to CI.
|
||||
- For UI screenshots without a device, run `./gradlew -PskipRust=true :app:testDebugUnitTest --tests '*PreviewRenderTest'` and read `app/build/preview-renders/{handheld,portrait}/`. Add cases per `docs/compose-previews.md`. Check portrait, not just landscape.
|
||||
- For UI screenshots without a device, run `./gradlew -PskipRust=true :app:testDebugUnitTest --tests '*PreviewRenderTest'` and read `app/build/preview-renders/{handheld,portrait,tall}/`. Add cases per `docs/compose-previews.md`. Check portrait and the 21:9 tall size, not just landscape.
|
||||
- After changing `SettingsIndex`, regenerate the doc: `UPDATE_SETTINGS_MAP=1 ./gradlew -PskipRust=true :app:testDebugUnitTest --tests '*SettingsMapTest*'`.
|
||||
- Compile errors in code you didn't touch, after switching branches, are usually stale incremental state. Rebuild once before you change anything.
|
||||
|
||||
|
||||
@@ -68,6 +68,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), and its GL thunk hands X errors to the program's own error handler. FEX's code disk cache was checked in its source. The fix for host stack left behind when a program leaves a signal handler without returning follows the approach suggested in [FEX-Emu/FEX#2487](https://github.com/FEX-Emu/FEX/issues/2487). The host stack fix for system calls that end a block is a backport of Ryan Houdek's [FEX-Emu/FEX#6122](https://github.com/FEX-Emu/FEX/pull/6122).
|
||||
- Anti-cheat support under FEX is the work of [StonkGuy](https://github.com/StonkGuy): the x86-64 ptrace, seccomp and `/proc` emulation from his [FEX fork](https://github.com/StonkGuy/FEX) (`eac-2611` branch, MIT) is carried as build patch 0021 with his authorship, patches 0022 to 0029 build on it, and his `eac-tests` regression suite verifies them.
|
||||
- x86-64 programs on Wayland reach the GPU through FEX's Wayland client, wayland-egl and EGL thunks. The guest `wl_list` and `wl_array` helpers follow [libwayland](https://gitlab.freedesktop.org/wayland/wayland)'s `src/wayland-util.c` (MIT). The EGL extension table comes from the [Khronos EGL registry](https://github.com/KhronosGroup/EGL-Registry) (Apache-2.0) and Mesa's `egl_other.xml` (MIT).
|
||||
- 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.
|
||||
- DwarFS AppImages are unpacked without proot by `dwarfsextract` from [DwarFS](https://github.com/mhx/dwarfs) by Marcus Holland-Moritz (MIT), the release binary uruntime embeds, taken out of its self-extracting wrapper and shipped with its licence.
|
||||
@@ -156,6 +157,13 @@ DroidDeck is [GPL-3.0](LICENSE). Steam and Proton belong to Valve Corporation. V
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Setup and tools</b></summary>
|
||||
|
||||
- The wireless debugging pairing keypad was inspired by Ryan Retro’s Handheld Toolkit.
|
||||
|
||||
</details>
|
||||
|
||||
## Star history
|
||||
|
||||
<a href="https://www.star-history.com/#Droid-Deck/DroidDeck&Date">
|
||||
|
||||
@@ -108,6 +108,34 @@ private fun BottomPanelBar() = PreviewHost {
|
||||
@DroidDeckPreviews @Composable private fun SessionMenuDockedDisplayPreview() = DockedMenu(SessionDrawerPage.DISPLAY)
|
||||
@DroidDeckPreviews @Composable private fun BottomPanelBarPreview() = BottomPanelBar()
|
||||
|
||||
/** Controller settings as the launcher opens them: profiles, what they are used for, and touch control size. */
|
||||
@Composable
|
||||
private fun ControllerSettings() = PreviewHost { InputSettingsPage(onBack = {}) }
|
||||
|
||||
/** Buttons and sticks: the controller drawing with A picked, and what it does. */
|
||||
@Composable
|
||||
private fun ControllerButtons() = PreviewHost {
|
||||
val context = androidx.compose.ui.platform.LocalContext.current
|
||||
val library = androidx.compose.runtime.remember { com.droiddeck.launcher.input.InputLibraries.read(context) }
|
||||
InputButtonsPane(library.profile(com.droiddeck.launcher.input.InputProfile.GAME).binding(com.droiddeck.launcher.input.InputRole.PHYSICAL),
|
||||
profileLabel(context, library.profile(com.droiddeck.launcher.input.InputProfile.GAME)), null, {}, {})
|
||||
}
|
||||
|
||||
/** The on-screen layout editor with the D-pad's down arm picked, its panel docked away from it. */
|
||||
@Composable
|
||||
private fun LayoutEditorSelected() = PreviewHost {
|
||||
val context = androidx.compose.ui.platform.LocalContext.current
|
||||
val library = androidx.compose.runtime.remember { com.droiddeck.launcher.input.InputLibraries.read(context) }
|
||||
val game = library.profile(com.droiddeck.launcher.input.InputProfile.GAME)
|
||||
InputSurfaceDialog(game.id, {}, {}, role = com.droiddeck.launcher.input.InputRole.PRIMARY,
|
||||
layoutId = game.parts.getValue(com.droiddeck.launcher.input.InputRole.PRIMARY).layout,
|
||||
bindingsId = game.binding(com.droiddeck.launcher.input.InputRole.PRIMARY), initialSelection = "legacy:down")
|
||||
}
|
||||
|
||||
@DroidDeckPreviews @Composable private fun LayoutEditorSelectedPreview() = LayoutEditorSelected()
|
||||
@DroidDeckPreviews @Composable private fun ControllerSettingsPreview() = ControllerSettings()
|
||||
@DroidDeckPreviews @Composable private fun ControllerButtonsPreview() = ControllerButtons()
|
||||
|
||||
/** The Library and Stores tabs read store accounts, which load on a background thread. */
|
||||
private val storesLoaded = { com.droiddeck.launcher.stores.StoresState.accountsLoaded }
|
||||
|
||||
@@ -133,4 +161,7 @@ internal val previewCases: List<PreviewCase> = listOf(
|
||||
PreviewCase("session-menu-docked") { DockedMenu(SessionDrawerPage.CONTROLLER) },
|
||||
PreviewCase("session-menu-docked-display") { DockedMenu(SessionDrawerPage.DISPLAY) },
|
||||
PreviewCase("bottom-panel-bar") { BottomPanelBar() },
|
||||
PreviewCase("controller-settings") { ControllerSettings() },
|
||||
PreviewCase("controller-buttons") { ControllerButtons() },
|
||||
PreviewCase("layout-editor-selected") { LayoutEditorSelected() },
|
||||
)
|
||||
@@ -66,7 +66,7 @@ internal val sampleActions: FrontEndActions = FrontEndActions(
|
||||
|
||||
/** The in-game menu's actions with settled sample values; its switches do nothing. */
|
||||
internal fun sampleDrawerActions(
|
||||
steam: Boolean = true, desktop: Boolean = false, secondScreen: SecondScreenMode? = null,
|
||||
steam: Boolean = true, desktop: Boolean = false, secondScreen: SecondScreenMode? = null, inputGame: Pair<String, String>? = null,
|
||||
): DrawerActions = DrawerActions(
|
||||
steam = steam, desktop = desktop, title = if (!steam && !desktop) "Hades" else null,
|
||||
isHomeApp = false, androidApps = emptyList(),
|
||||
@@ -76,7 +76,7 @@ internal fun sampleDrawerActions(
|
||||
oscMode = SessionPrefs.OSC_AUTO, onOsc = {},
|
||||
suspendPolicy = SessionPrefs.SUSPEND_MANUAL, onSuspendPolicy = {},
|
||||
backActionsInverted = false, onBackActionsInverted = {},
|
||||
touchMode = SessionPrefs.TOUCH_AUTO, onTouch = {}, touchAuto = "Auto (direct)",
|
||||
touchMode = SessionPrefs.TOUCH_AUTO, onTouch = {}, touchAuto = "direct",
|
||||
fexPreset = "", onFexPreset = {},
|
||||
secondScreenMode = secondScreen ?: SecondScreenMode.NONE, onSecondScreenMode = {}, secondScreenNone = secondScreen == null,
|
||||
secondScreenDisplays = listOfNotNull(secondScreen?.let { SecondScreenDisplay(2, "Built-in · 1240×1080") }),
|
||||
@@ -85,4 +85,5 @@ internal fun sampleDrawerActions(
|
||||
onKeyboard = {}, onHardwareKeyboard = {},
|
||||
onSteamMenu = if (steam) ({}) else null, onQam = if (steam) ({}) else null,
|
||||
onLaunchAndroidApp = { _, _ -> }, onBackground = {}, onShareLogs = {}, onStop = {}, onClose = {},
|
||||
inputGame = inputGame, onEditLayout = {},
|
||||
)
|
||||
@@ -329,16 +329,28 @@ static constexpr int kWatchedFds = 1 << 16;
|
||||
static constexpr int kWatchedBits = sizeof(unsigned long) * 8;
|
||||
static std::atomic<unsigned long> watched_fds[kWatchedFds / kWatchedBits];
|
||||
static std::atomic<bool> watched_beyond{false};
|
||||
static std::atomic<int> watched_count{0};
|
||||
|
||||
static void watch_fd(int fd) {
|
||||
if (fd < 0) return;
|
||||
if (fd >= kWatchedFds) watched_beyond.store(true, std::memory_order_release);
|
||||
else watched_fds[fd / kWatchedBits].fetch_or(1UL << (fd % kWatchedBits), std::memory_order_release);
|
||||
if (fd >= kWatchedFds) {
|
||||
watched_beyond.store(true, std::memory_order_release);
|
||||
return;
|
||||
}
|
||||
const unsigned long bit = 1UL << (fd % kWatchedBits);
|
||||
if (!(watched_fds[fd / kWatchedBits].fetch_or(bit, std::memory_order_acq_rel) & bit))
|
||||
watched_count.fetch_add(1, std::memory_order_acq_rel);
|
||||
}
|
||||
|
||||
static void unwatch_fd(int fd) {
|
||||
if (fd >= 0 && fd < kWatchedFds)
|
||||
watched_fds[fd / kWatchedBits].fetch_and(~(1UL << (fd % kWatchedBits)), std::memory_order_release);
|
||||
if (fd < 0 || fd >= kWatchedFds) return;
|
||||
const unsigned long bit = 1UL << (fd % kWatchedBits);
|
||||
if (watched_fds[fd / kWatchedBits].fetch_and(~bit, std::memory_order_acq_rel) & bit)
|
||||
watched_count.fetch_sub(1, std::memory_order_acq_rel);
|
||||
}
|
||||
|
||||
static bool any_watched() {
|
||||
return watched_count.load(std::memory_order_acquire) > 0 || watched_beyond.load(std::memory_order_acquire);
|
||||
}
|
||||
|
||||
static bool watched(int fd) {
|
||||
@@ -4269,7 +4281,7 @@ static int poll_fake(struct pollfd *fds, nfds_t nfds, int timeout,
|
||||
const auto my_poll = next_symbol<decltype(&::poll)>(Next::poll);
|
||||
const auto my_ppoll = next_symbol<decltype(&::ppoll)>(Next::ppoll);
|
||||
|
||||
nfds_t first = 0;
|
||||
nfds_t first = any_watched() ? 0 : nfds;
|
||||
while (first < nfds && !watched(fds[first].fd)) first++;
|
||||
bool has_fake_fds = false;
|
||||
std::vector<struct pollfd> real_fds;
|
||||
@@ -4372,12 +4384,12 @@ EXPORT int poll(struct pollfd *fds, nfds_t nfds, int timeout) {
|
||||
EXPORT int ppoll(struct pollfd *fds, nfds_t nfds,
|
||||
const struct timespec *timeout, const sigset_t *sigmask) {
|
||||
const auto my_ppoll = next_symbol<decltype(&::ppoll)>(Next::ppoll);
|
||||
if (timeout && (timeout->tv_sec < 0 || timeout->tv_nsec < 0 || timeout->tv_nsec >= 1000000000L)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
for (nfds_t i = 0; i < nfds; ++i) {
|
||||
for (nfds_t i = 0; any_watched() && i < nfds; ++i) {
|
||||
if (!is_fake_input_fd(fds[i].fd)) continue;
|
||||
if (timeout && (timeout->tv_sec < 0 || timeout->tv_nsec < 0 || timeout->tv_nsec >= 1000000000L)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (!sigmask)
|
||||
return poll_fake(fds, nfds, static_cast<int>(timespec_to_ms(timeout)), nullptr);
|
||||
sigset_t all_signals, original_mask;
|
||||
@@ -4410,6 +4422,8 @@ EXPORT int __ppoll_chk(struct pollfd *fds, nfds_t nfds, const struct timespec *t
|
||||
EXPORT int select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *exceptfds, struct timeval *timeout) {
|
||||
const auto my_select = next_symbol<decltype(&::select)>(Next::select);
|
||||
if (!any_watched())
|
||||
return my_select ? my_select(nfds, readfds, writefds, exceptfds, timeout) : -1;
|
||||
|
||||
fd_set original_readfds;
|
||||
fd_set original_writefds;
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -124,3 +124,33 @@ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
SMAA (Enhanced Subpixel Morphological Antialiasing)
|
||||
---------------------------------------------------
|
||||
SMAA.hlsl and the lookup tables in smaa_tables.h are from the authors' reference
|
||||
implementation (github.com/iryoku/smaa).
|
||||
|
||||
Copyright (C) 2013 Jorge Jimenez (jorge@iryoku.com)
|
||||
Copyright (C) 2013 Jose I. Echevarria (joseignacioechevarria@gmail.com)
|
||||
Copyright (C) 2013 Belen Masia (bmasia@unizar.es)
|
||||
Copyright (C) 2013 Fernando Navarro (fernandn@microsoft.com)
|
||||
Copyright (C) 2013 Diego Gutierrez (diegog@unizar.es)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software. As clarification, there is no
|
||||
requirement that the copyright notice and permission be included in binary
|
||||
distributions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -1,4 +1,5 @@
|
||||
#version 450
|
||||
#extension GL_GOOGLE_include_directive : require
|
||||
|
||||
layout(location = 0) in vec2 fragTexCoord;
|
||||
layout(location = 0) out vec4 outColor;
|
||||
@@ -6,25 +7,16 @@ layout(set = 0, binding = 0) uniform sampler2D InputTexture;
|
||||
layout(set = 1, binding = 0) uniform sampler2D WeightTexture;
|
||||
layout(push_constant) uniform Constants {
|
||||
vec4 ndc;
|
||||
vec2 resolution;
|
||||
float extra;
|
||||
float pad;
|
||||
vec4 metrics; // 1/width, 1/height, width, height
|
||||
} pc;
|
||||
|
||||
#define SMAA_RT_METRICS pc.metrics
|
||||
#define SMAA_GLSL_4
|
||||
#define SMAA_PRESET_HIGH
|
||||
#include "SMAA.hlsl"
|
||||
|
||||
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);
|
||||
vec4 weights = texture(WeightTexture, uv);
|
||||
float weight = clamp(weights.r, 0.0, 0.42);
|
||||
|
||||
if (weight <= 0.001) {
|
||||
outColor = center;
|
||||
return;
|
||||
}
|
||||
|
||||
vec2 normal = weights.gb * 2.0 - 1.0;
|
||||
vec2 acrossUv = clamp(uv + normal * px, px * 0.5, vec2(1.0) - px * 0.5);
|
||||
vec3 across = texture(InputTexture, acrossUv).rgb;
|
||||
outColor = vec4(mix(center.rgb, across, weight), center.a);
|
||||
vec4 offset;
|
||||
SMAANeighborhoodBlendingVS(fragTexCoord, offset);
|
||||
outColor = SMAANeighborhoodBlendingPS(fragTexCoord, offset, InputTexture, WeightTexture);
|
||||
}
|
||||
@@ -1,88 +1,204 @@
|
||||
// 1116.3.0
|
||||
// 1116.6.0
|
||||
#pragma once
|
||||
const uint32_t smaa_blend_code[] = {
|
||||
0x07230203,0x00010000,0x0008000b,0x0000006b,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
0x07230203,0x00010000,0x0008000b,0x000000f8,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
|
||||
0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x0000001a,0x00000041,0x00030010,
|
||||
0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005,0x00000004,0x6e69616d,
|
||||
0x00000000,0x00030005,0x00000009,0x00007870,0x00050005,0x0000000c,0x736e6f43,0x746e6174,
|
||||
0x00000073,0x00040006,0x0000000c,0x00000000,0x0063646e,0x00060006,0x0000000c,0x00000001,
|
||||
0x6f736572,0x6974756c,0x00006e6f,0x00050006,0x0000000c,0x00000002,0x72747865,0x00000061,
|
||||
0x00040006,0x0000000c,0x00000003,0x00646170,0x00030005,0x0000000e,0x00006370,0x00030005,
|
||||
0x00000018,0x00007675,0x00060005,0x0000001a,0x67617266,0x43786554,0x64726f6f,0x00000000,
|
||||
0x00040005,0x00000024,0x746e6563,0x00007265,0x00060005,0x00000028,0x75706e49,0x78655474,
|
||||
0x65727574,0x00000000,0x00040005,0x0000002c,0x67696577,0x00737468,0x00060005,0x0000002d,
|
||||
0x67696557,0x65547468,0x72757478,0x00000065,0x00040005,0x00000032,0x67696577,0x00007468,
|
||||
0x00050005,0x00000041,0x4374756f,0x726f6c6f,0x00000000,0x00040005,0x00000044,0x6d726f6e,
|
||||
0x00006c61,0x00050005,0x0000004b,0x6f726361,0x76557373,0x00000000,0x00040005,0x00000059,
|
||||
0x6f726361,0x00007373,0x00030047,0x0000000c,0x00000002,0x00050048,0x0000000c,0x00000000,
|
||||
0x00000023,0x00000000,0x00050048,0x0000000c,0x00000001,0x00000023,0x00000010,0x00050048,
|
||||
0x0000000c,0x00000002,0x00000023,0x00000018,0x00050048,0x0000000c,0x00000003,0x00000023,
|
||||
0x0000001c,0x00040047,0x0000001a,0x0000001e,0x00000000,0x00040047,0x00000028,0x00000021,
|
||||
0x00000000,0x00040047,0x00000028,0x00000022,0x00000000,0x00040047,0x0000002d,0x00000021,
|
||||
0x00000000,0x00040047,0x0000002d,0x00000022,0x00000001,0x00040047,0x00000041,0x0000001e,
|
||||
0x00000000,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,
|
||||
0x00000020,0x00040017,0x00000007,0x00000006,0x00000002,0x00040020,0x00000008,0x00000007,
|
||||
0x00000007,0x0004002b,0x00000006,0x0000000a,0x3f800000,0x00040017,0x0000000b,0x00000006,
|
||||
0x00000004,0x0006001e,0x0000000c,0x0000000b,0x00000007,0x00000006,0x00000006,0x00040020,
|
||||
0x0000000d,0x00000009,0x0000000c,0x0004003b,0x0000000d,0x0000000e,0x00000009,0x00040015,
|
||||
0x0000000f,0x00000020,0x00000001,0x0004002b,0x0000000f,0x00000010,0x00000001,0x00040020,
|
||||
0x00000011,0x00000009,0x00000007,0x0005002c,0x00000007,0x00000014,0x0000000a,0x0000000a,
|
||||
0x00040020,0x00000019,0x00000001,0x00000007,0x0004003b,0x00000019,0x0000001a,0x00000001,
|
||||
0x0004002b,0x00000006,0x0000001d,0x3f000000,0x00040020,0x00000023,0x00000007,0x0000000b,
|
||||
0x00090019,0x00000025,0x00000006,0x00000001,0x00000000,0x00000000,0x00000000,0x00000001,
|
||||
0x00000000,0x0003001b,0x00000026,0x00000025,0x00040020,0x00000027,0x00000000,0x00000026,
|
||||
0x0004003b,0x00000027,0x00000028,0x00000000,0x0004003b,0x00000027,0x0000002d,0x00000000,
|
||||
0x00040020,0x00000031,0x00000007,0x00000006,0x00040015,0x00000033,0x00000020,0x00000000,
|
||||
0x0004002b,0x00000033,0x00000034,0x00000000,0x0004002b,0x00000006,0x00000037,0x00000000,
|
||||
0x0004002b,0x00000006,0x00000038,0x3ed70a3d,0x0004002b,0x00000006,0x0000003b,0x3a83126f,
|
||||
0x00020014,0x0000003c,0x00040020,0x00000040,0x00000003,0x0000000b,0x0004003b,0x00000040,
|
||||
0x00000041,0x00000003,0x0004002b,0x00000006,0x00000047,0x40000000,0x00040017,0x00000057,
|
||||
0x00000006,0x00000003,0x00040020,0x00000058,0x00000007,0x00000057,0x0004002b,0x00000033,
|
||||
0x00000064,0x00000003,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,
|
||||
0x00000005,0x0004003b,0x00000008,0x00000009,0x00000007,0x0004003b,0x00000008,0x00000018,
|
||||
0x00000007,0x0004003b,0x00000023,0x00000024,0x00000007,0x0004003b,0x00000023,0x0000002c,
|
||||
0x00000007,0x0004003b,0x00000031,0x00000032,0x00000007,0x0004003b,0x00000008,0x00000044,
|
||||
0x00000007,0x0004003b,0x00000008,0x0000004b,0x00000007,0x0004003b,0x00000058,0x00000059,
|
||||
0x00000007,0x00050041,0x00000011,0x00000012,0x0000000e,0x00000010,0x0004003d,0x00000007,
|
||||
0x00000013,0x00000012,0x0007000c,0x00000007,0x00000015,0x00000001,0x00000028,0x00000013,
|
||||
0x00000014,0x00050050,0x00000007,0x00000016,0x0000000a,0x0000000a,0x00050088,0x00000007,
|
||||
0x00000017,0x00000016,0x00000015,0x0003003e,0x00000009,0x00000017,0x0004003d,0x00000007,
|
||||
0x0000001b,0x0000001a,0x0004003d,0x00000007,0x0000001c,0x00000009,0x0005008e,0x00000007,
|
||||
0x0000001e,0x0000001c,0x0000001d,0x0004003d,0x00000007,0x0000001f,0x00000009,0x0005008e,
|
||||
0x00000007,0x00000020,0x0000001f,0x0000001d,0x00050083,0x00000007,0x00000021,0x00000014,
|
||||
0x00000020,0x0008000c,0x00000007,0x00000022,0x00000001,0x0000002b,0x0000001b,0x0000001e,
|
||||
0x00000021,0x0003003e,0x00000018,0x00000022,0x0004003d,0x00000026,0x00000029,0x00000028,
|
||||
0x0004003d,0x00000007,0x0000002a,0x00000018,0x00050057,0x0000000b,0x0000002b,0x00000029,
|
||||
0x0000002a,0x0003003e,0x00000024,0x0000002b,0x0004003d,0x00000026,0x0000002e,0x0000002d,
|
||||
0x0004003d,0x00000007,0x0000002f,0x00000018,0x00050057,0x0000000b,0x00000030,0x0000002e,
|
||||
0x0000002f,0x0003003e,0x0000002c,0x00000030,0x00050041,0x00000031,0x00000035,0x0000002c,
|
||||
0x00000034,0x0004003d,0x00000006,0x00000036,0x00000035,0x0008000c,0x00000006,0x00000039,
|
||||
0x00000001,0x0000002b,0x00000036,0x00000037,0x00000038,0x0003003e,0x00000032,0x00000039,
|
||||
0x0004003d,0x00000006,0x0000003a,0x00000032,0x000500bc,0x0000003c,0x0000003d,0x0000003a,
|
||||
0x0000003b,0x000300f7,0x0000003f,0x00000000,0x000400fa,0x0000003d,0x0000003e,0x0000003f,
|
||||
0x000200f8,0x0000003e,0x0004003d,0x0000000b,0x00000042,0x00000024,0x0003003e,0x00000041,
|
||||
0x00000042,0x000100fd,0x000200f8,0x0000003f,0x0004003d,0x0000000b,0x00000045,0x0000002c,
|
||||
0x0007004f,0x00000007,0x00000046,0x00000045,0x00000045,0x00000001,0x00000002,0x0005008e,
|
||||
0x00000007,0x00000048,0x00000046,0x00000047,0x00050050,0x00000007,0x00000049,0x0000000a,
|
||||
0x0000000a,0x00050083,0x00000007,0x0000004a,0x00000048,0x00000049,0x0003003e,0x00000044,
|
||||
0x0000004a,0x0004003d,0x00000007,0x0000004c,0x00000018,0x0004003d,0x00000007,0x0000004d,
|
||||
0x00000044,0x0004003d,0x00000007,0x0000004e,0x00000009,0x00050085,0x00000007,0x0000004f,
|
||||
0x0000004d,0x0000004e,0x00050081,0x00000007,0x00000050,0x0000004c,0x0000004f,0x0004003d,
|
||||
0x00000007,0x00000051,0x00000009,0x0005008e,0x00000007,0x00000052,0x00000051,0x0000001d,
|
||||
0x0004003d,0x00000007,0x00000053,0x00000009,0x0005008e,0x00000007,0x00000054,0x00000053,
|
||||
0x0000001d,0x00050083,0x00000007,0x00000055,0x00000014,0x00000054,0x0008000c,0x00000007,
|
||||
0x00000056,0x00000001,0x0000002b,0x00000050,0x00000052,0x00000055,0x0003003e,0x0000004b,
|
||||
0x00000056,0x0004003d,0x00000026,0x0000005a,0x00000028,0x0004003d,0x00000007,0x0000005b,
|
||||
0x0000004b,0x00050057,0x0000000b,0x0000005c,0x0000005a,0x0000005b,0x0008004f,0x00000057,
|
||||
0x0000005d,0x0000005c,0x0000005c,0x00000000,0x00000001,0x00000002,0x0003003e,0x00000059,
|
||||
0x0000005d,0x0004003d,0x0000000b,0x0000005e,0x00000024,0x0008004f,0x00000057,0x0000005f,
|
||||
0x0000005e,0x0000005e,0x00000000,0x00000001,0x00000002,0x0004003d,0x00000057,0x00000060,
|
||||
0x00000059,0x0004003d,0x00000006,0x00000061,0x00000032,0x00060050,0x00000057,0x00000062,
|
||||
0x00000061,0x00000061,0x00000061,0x0008000c,0x00000057,0x00000063,0x00000001,0x0000002e,
|
||||
0x0000005f,0x00000060,0x00000062,0x00050041,0x00000031,0x00000065,0x00000024,0x00000064,
|
||||
0x0004003d,0x00000006,0x00000066,0x00000065,0x00050051,0x00000006,0x00000067,0x00000063,
|
||||
0x00000000,0x00050051,0x00000006,0x00000068,0x00000063,0x00000001,0x00050051,0x00000006,
|
||||
0x00000069,0x00000063,0x00000002,0x00070050,0x0000000b,0x0000006a,0x00000067,0x00000068,
|
||||
0x00000069,0x00000066,0x0003003e,0x00000041,0x0000006a,0x000100fd,0x00010038
|
||||
0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x000000e8,0x000000f0,0x00030010,
|
||||
0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x000a0004,0x475f4c47,0x4c474f4f,
|
||||
0x70635f45,0x74735f70,0x5f656c79,0x656e696c,0x7269645f,0x69746365,0x00006576,0x00080004,
|
||||
0x475f4c47,0x4c474f4f,0x6e695f45,0x64756c63,0x69645f65,0x74636572,0x00657669,0x00040005,
|
||||
0x00000004,0x6e69616d,0x00000000,0x00080005,0x00000010,0x41414d53,0x63766f4d,0x32627628,
|
||||
0x3266763b,0x3266763b,0x0000003b,0x00040005,0x0000000d,0x646e6f63,0x00000000,0x00050005,
|
||||
0x0000000e,0x69726176,0x656c6261,0x00000000,0x00040005,0x0000000f,0x756c6176,0x00000065,
|
||||
0x00080005,0x0000001a,0x41414d53,0x63766f4d,0x34627628,0x3466763b,0x3466763b,0x0000003b,
|
||||
0x00040005,0x00000017,0x646e6f63,0x00000000,0x00050005,0x00000018,0x69726176,0x656c6261,
|
||||
0x00000000,0x00040005,0x00000019,0x756c6176,0x00000065,0x000b0005,0x0000001f,0x41414d53,
|
||||
0x6769654e,0x726f6268,0x646f6f68,0x6e656c42,0x676e6964,0x76285356,0x763b3266,0x003b3466,
|
||||
0x00050005,0x0000001d,0x63786574,0x64726f6f,0x00000000,0x00040005,0x0000001e,0x7366666f,
|
||||
0x00007465,0x000d0005,0x00000029,0x41414d53,0x6769654e,0x726f6268,0x646f6f68,0x6e656c42,
|
||||
0x676e6964,0x76285350,0x763b3266,0x733b3466,0x733b3132,0x003b3132,0x00050005,0x00000025,
|
||||
0x63786574,0x64726f6f,0x00000000,0x00040005,0x00000026,0x7366666f,0x00007465,0x00050005,
|
||||
0x00000027,0x6f6c6f63,0x78655472,0x00000000,0x00050005,0x00000028,0x6e656c62,0x78655464,
|
||||
0x00000000,0x00040005,0x0000003e,0x61726170,0x0000006d,0x00040005,0x00000041,0x61726170,
|
||||
0x0000006d,0x00040005,0x00000044,0x61726170,0x0000006d,0x00040005,0x0000004d,0x61726170,
|
||||
0x0000006d,0x00040005,0x00000050,0x61726170,0x0000006d,0x00040005,0x00000053,0x61726170,
|
||||
0x0000006d,0x00050005,0x0000005e,0x736e6f43,0x746e6174,0x00000073,0x00040006,0x0000005e,
|
||||
0x00000000,0x0063646e,0x00050006,0x0000005e,0x00000001,0x7274656d,0x00736369,0x00030005,
|
||||
0x00000060,0x00006370,0x00030005,0x0000006d,0x00000061,0x00040005,0x00000089,0x6f6c6f63,
|
||||
0x00000072,0x00030005,0x00000090,0x00000068,0x00060005,0x0000009c,0x6e656c62,0x676e6964,
|
||||
0x7366664f,0x00007465,0x00060005,0x000000a2,0x6e656c62,0x676e6964,0x67696557,0x00007468,
|
||||
0x00040005,0x000000ac,0x61726170,0x0000006d,0x00040005,0x000000ad,0x61726170,0x0000006d,
|
||||
0x00040005,0x000000af,0x61726170,0x0000006d,0x00040005,0x000000b4,0x61726170,0x0000006d,
|
||||
0x00040005,0x000000b5,0x61726170,0x0000006d,0x00040005,0x000000b7,0x61726170,0x0000006d,
|
||||
0x00060005,0x000000c2,0x6e656c62,0x676e6964,0x726f6f43,0x00000064,0x00040005,0x000000d3,
|
||||
0x6f6c6f63,0x00000072,0x00060005,0x000000e8,0x67617266,0x43786554,0x64726f6f,0x00000000,
|
||||
0x00040005,0x000000e9,0x7366666f,0x00007465,0x00040005,0x000000ea,0x61726170,0x0000006d,
|
||||
0x00040005,0x000000ec,0x61726170,0x0000006d,0x00050005,0x000000f0,0x4374756f,0x726f6c6f,
|
||||
0x00000000,0x00060005,0x000000f1,0x75706e49,0x78655474,0x65727574,0x00000000,0x00060005,
|
||||
0x000000f2,0x67696557,0x65547468,0x72757478,0x00000065,0x00040005,0x000000f3,0x61726170,
|
||||
0x0000006d,0x00040005,0x000000f5,0x61726170,0x0000006d,0x00030047,0x0000005e,0x00000002,
|
||||
0x00050048,0x0000005e,0x00000000,0x00000023,0x00000000,0x00050048,0x0000005e,0x00000001,
|
||||
0x00000023,0x00000010,0x00040047,0x000000e8,0x0000001e,0x00000000,0x00040047,0x000000f0,
|
||||
0x0000001e,0x00000000,0x00040047,0x000000f1,0x00000021,0x00000000,0x00040047,0x000000f1,
|
||||
0x00000022,0x00000000,0x00040047,0x000000f2,0x00000021,0x00000000,0x00040047,0x000000f2,
|
||||
0x00000022,0x00000001,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00020014,
|
||||
0x00000006,0x00040017,0x00000007,0x00000006,0x00000002,0x00040020,0x00000008,0x00000007,
|
||||
0x00000007,0x00030016,0x00000009,0x00000020,0x00040017,0x0000000a,0x00000009,0x00000002,
|
||||
0x00040020,0x0000000b,0x00000007,0x0000000a,0x00060021,0x0000000c,0x00000002,0x00000008,
|
||||
0x0000000b,0x0000000b,0x00040017,0x00000012,0x00000006,0x00000004,0x00040020,0x00000013,
|
||||
0x00000007,0x00000012,0x00040017,0x00000014,0x00000009,0x00000004,0x00040020,0x00000015,
|
||||
0x00000007,0x00000014,0x00060021,0x00000016,0x00000002,0x00000013,0x00000015,0x00000015,
|
||||
0x00050021,0x0000001c,0x00000002,0x0000000b,0x00000015,0x00090019,0x00000021,0x00000009,
|
||||
0x00000001,0x00000000,0x00000000,0x00000000,0x00000001,0x00000000,0x0003001b,0x00000022,
|
||||
0x00000021,0x00040020,0x00000023,0x00000000,0x00000022,0x00070021,0x00000024,0x00000014,
|
||||
0x0000000b,0x00000015,0x00000023,0x00000023,0x00040015,0x0000002b,0x00000020,0x00000000,
|
||||
0x0004002b,0x0000002b,0x0000002c,0x00000000,0x00040020,0x0000002d,0x00000007,0x00000006,
|
||||
0x00040020,0x00000032,0x00000007,0x00000009,0x0004002b,0x0000002b,0x00000036,0x00000001,
|
||||
0x0004002b,0x0000002b,0x00000058,0x00000002,0x0004002b,0x0000002b,0x0000005b,0x00000003,
|
||||
0x0004001e,0x0000005e,0x00000014,0x00000014,0x00040020,0x0000005f,0x00000009,0x0000005e,
|
||||
0x0004003b,0x0000005f,0x00000060,0x00000009,0x00040015,0x00000061,0x00000020,0x00000001,
|
||||
0x0004002b,0x00000061,0x00000062,0x00000001,0x00040020,0x00000063,0x00000009,0x00000014,
|
||||
0x0004002b,0x00000009,0x00000067,0x3f800000,0x0004002b,0x00000009,0x00000068,0x00000000,
|
||||
0x0007002c,0x00000014,0x00000069,0x00000067,0x00000068,0x00000068,0x00000067,0x0007002c,
|
||||
0x00000014,0x00000083,0x00000067,0x00000067,0x00000067,0x00000067,0x0004002b,0x00000009,
|
||||
0x00000085,0x3727c5ac,0x0005002c,0x0000000a,0x000000bd,0x00000067,0x00000067,0x00040020,
|
||||
0x000000e7,0x00000001,0x0000000a,0x0004003b,0x000000e7,0x000000e8,0x00000001,0x00040020,
|
||||
0x000000ef,0x00000003,0x00000014,0x0004003b,0x000000ef,0x000000f0,0x00000003,0x0004003b,
|
||||
0x00000023,0x000000f1,0x00000000,0x0004003b,0x00000023,0x000000f2,0x00000000,0x00050036,
|
||||
0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b,0x00000015,
|
||||
0x000000e9,0x00000007,0x0004003b,0x0000000b,0x000000ea,0x00000007,0x0004003b,0x00000015,
|
||||
0x000000ec,0x00000007,0x0004003b,0x0000000b,0x000000f3,0x00000007,0x0004003b,0x00000015,
|
||||
0x000000f5,0x00000007,0x0004003d,0x0000000a,0x000000eb,0x000000e8,0x0003003e,0x000000ea,
|
||||
0x000000eb,0x00060039,0x00000002,0x000000ed,0x0000001f,0x000000ea,0x000000ec,0x0004003d,
|
||||
0x00000014,0x000000ee,0x000000ec,0x0003003e,0x000000e9,0x000000ee,0x0004003d,0x0000000a,
|
||||
0x000000f4,0x000000e8,0x0003003e,0x000000f3,0x000000f4,0x0004003d,0x00000014,0x000000f6,
|
||||
0x000000e9,0x0003003e,0x000000f5,0x000000f6,0x00080039,0x00000014,0x000000f7,0x00000029,
|
||||
0x000000f3,0x000000f5,0x000000f1,0x000000f2,0x0003003e,0x000000f0,0x000000f7,0x000100fd,
|
||||
0x00010038,0x00050036,0x00000002,0x00000010,0x00000000,0x0000000c,0x00030037,0x00000008,
|
||||
0x0000000d,0x00030037,0x0000000b,0x0000000e,0x00030037,0x0000000b,0x0000000f,0x000200f8,
|
||||
0x00000011,0x00050041,0x0000002d,0x0000002e,0x0000000d,0x0000002c,0x0004003d,0x00000006,
|
||||
0x0000002f,0x0000002e,0x000300f7,0x00000031,0x00000000,0x000400fa,0x0000002f,0x00000030,
|
||||
0x00000031,0x000200f8,0x00000030,0x00050041,0x00000032,0x00000033,0x0000000f,0x0000002c,
|
||||
0x0004003d,0x00000009,0x00000034,0x00000033,0x00050041,0x00000032,0x00000035,0x0000000e,
|
||||
0x0000002c,0x0003003e,0x00000035,0x00000034,0x000200f9,0x00000031,0x000200f8,0x00000031,
|
||||
0x00050041,0x0000002d,0x00000037,0x0000000d,0x00000036,0x0004003d,0x00000006,0x00000038,
|
||||
0x00000037,0x000300f7,0x0000003a,0x00000000,0x000400fa,0x00000038,0x00000039,0x0000003a,
|
||||
0x000200f8,0x00000039,0x00050041,0x00000032,0x0000003b,0x0000000f,0x00000036,0x0004003d,
|
||||
0x00000009,0x0000003c,0x0000003b,0x00050041,0x00000032,0x0000003d,0x0000000e,0x00000036,
|
||||
0x0003003e,0x0000003d,0x0000003c,0x000200f9,0x0000003a,0x000200f8,0x0000003a,0x000100fd,
|
||||
0x00010038,0x00050036,0x00000002,0x0000001a,0x00000000,0x00000016,0x00030037,0x00000013,
|
||||
0x00000017,0x00030037,0x00000015,0x00000018,0x00030037,0x00000015,0x00000019,0x000200f8,
|
||||
0x0000001b,0x0004003b,0x00000008,0x0000003e,0x00000007,0x0004003b,0x0000000b,0x00000041,
|
||||
0x00000007,0x0004003b,0x0000000b,0x00000044,0x00000007,0x0004003b,0x00000008,0x0000004d,
|
||||
0x00000007,0x0004003b,0x0000000b,0x00000050,0x00000007,0x0004003b,0x0000000b,0x00000053,
|
||||
0x00000007,0x0004003d,0x00000012,0x0000003f,0x00000017,0x0007004f,0x00000007,0x00000040,
|
||||
0x0000003f,0x0000003f,0x00000000,0x00000001,0x0003003e,0x0000003e,0x00000040,0x0004003d,
|
||||
0x00000014,0x00000042,0x00000018,0x0007004f,0x0000000a,0x00000043,0x00000042,0x00000042,
|
||||
0x00000000,0x00000001,0x0003003e,0x00000041,0x00000043,0x0004003d,0x00000014,0x00000045,
|
||||
0x00000019,0x0007004f,0x0000000a,0x00000046,0x00000045,0x00000045,0x00000000,0x00000001,
|
||||
0x0003003e,0x00000044,0x00000046,0x00070039,0x00000002,0x00000047,0x00000010,0x0000003e,
|
||||
0x00000041,0x00000044,0x0004003d,0x0000000a,0x00000048,0x00000041,0x00050041,0x00000032,
|
||||
0x00000049,0x00000018,0x0000002c,0x00050051,0x00000009,0x0000004a,0x00000048,0x00000000,
|
||||
0x0003003e,0x00000049,0x0000004a,0x00050041,0x00000032,0x0000004b,0x00000018,0x00000036,
|
||||
0x00050051,0x00000009,0x0000004c,0x00000048,0x00000001,0x0003003e,0x0000004b,0x0000004c,
|
||||
0x0004003d,0x00000012,0x0000004e,0x00000017,0x0007004f,0x00000007,0x0000004f,0x0000004e,
|
||||
0x0000004e,0x00000002,0x00000003,0x0003003e,0x0000004d,0x0000004f,0x0004003d,0x00000014,
|
||||
0x00000051,0x00000018,0x0007004f,0x0000000a,0x00000052,0x00000051,0x00000051,0x00000002,
|
||||
0x00000003,0x0003003e,0x00000050,0x00000052,0x0004003d,0x00000014,0x00000054,0x00000019,
|
||||
0x0007004f,0x0000000a,0x00000055,0x00000054,0x00000054,0x00000002,0x00000003,0x0003003e,
|
||||
0x00000053,0x00000055,0x00070039,0x00000002,0x00000056,0x00000010,0x0000004d,0x00000050,
|
||||
0x00000053,0x0004003d,0x0000000a,0x00000057,0x00000050,0x00050041,0x00000032,0x00000059,
|
||||
0x00000018,0x00000058,0x00050051,0x00000009,0x0000005a,0x00000057,0x00000000,0x0003003e,
|
||||
0x00000059,0x0000005a,0x00050041,0x00000032,0x0000005c,0x00000018,0x0000005b,0x00050051,
|
||||
0x00000009,0x0000005d,0x00000057,0x00000001,0x0003003e,0x0000005c,0x0000005d,0x000100fd,
|
||||
0x00010038,0x00050036,0x00000002,0x0000001f,0x00000000,0x0000001c,0x00030037,0x0000000b,
|
||||
0x0000001d,0x00030037,0x00000015,0x0000001e,0x000200f8,0x00000020,0x00050041,0x00000063,
|
||||
0x00000064,0x00000060,0x00000062,0x0004003d,0x00000014,0x00000065,0x00000064,0x0009004f,
|
||||
0x00000014,0x00000066,0x00000065,0x00000065,0x00000000,0x00000001,0x00000000,0x00000001,
|
||||
0x0004003d,0x0000000a,0x0000006a,0x0000001d,0x0009004f,0x00000014,0x0000006b,0x0000006a,
|
||||
0x0000006a,0x00000000,0x00000001,0x00000000,0x00000001,0x0008000c,0x00000014,0x0000006c,
|
||||
0x00000001,0x00000032,0x00000066,0x00000069,0x0000006b,0x0003003e,0x0000001e,0x0000006c,
|
||||
0x000100fd,0x00010038,0x00050036,0x00000014,0x00000029,0x00000000,0x00000024,0x00030037,
|
||||
0x0000000b,0x00000025,0x00030037,0x00000015,0x00000026,0x00030037,0x00000023,0x00000027,
|
||||
0x00030037,0x00000023,0x00000028,0x000200f8,0x0000002a,0x0004003b,0x00000015,0x0000006d,
|
||||
0x00000007,0x0004003b,0x00000015,0x00000089,0x00000007,0x0004003b,0x0000002d,0x00000090,
|
||||
0x00000007,0x0004003b,0x00000015,0x0000009c,0x00000007,0x0004003b,0x0000000b,0x000000a2,
|
||||
0x00000007,0x0004003b,0x00000013,0x000000ac,0x00000007,0x0004003b,0x00000015,0x000000ad,
|
||||
0x00000007,0x0004003b,0x00000015,0x000000af,0x00000007,0x0004003b,0x00000008,0x000000b4,
|
||||
0x00000007,0x0004003b,0x0000000b,0x000000b5,0x00000007,0x0004003b,0x0000000b,0x000000b7,
|
||||
0x00000007,0x0004003b,0x00000015,0x000000c2,0x00000007,0x0004003b,0x00000015,0x000000d3,
|
||||
0x00000007,0x0004003d,0x00000022,0x0000006e,0x00000028,0x0004003d,0x00000014,0x0000006f,
|
||||
0x00000026,0x0007004f,0x0000000a,0x00000070,0x0000006f,0x0000006f,0x00000000,0x00000001,
|
||||
0x00050057,0x00000014,0x00000071,0x0000006e,0x00000070,0x00050051,0x00000009,0x00000072,
|
||||
0x00000071,0x00000003,0x00050041,0x00000032,0x00000073,0x0000006d,0x0000002c,0x0003003e,
|
||||
0x00000073,0x00000072,0x0004003d,0x00000022,0x00000074,0x00000028,0x0004003d,0x00000014,
|
||||
0x00000075,0x00000026,0x0007004f,0x0000000a,0x00000076,0x00000075,0x00000075,0x00000002,
|
||||
0x00000003,0x00050057,0x00000014,0x00000077,0x00000074,0x00000076,0x00050051,0x00000009,
|
||||
0x00000078,0x00000077,0x00000001,0x00050041,0x00000032,0x00000079,0x0000006d,0x00000036,
|
||||
0x0003003e,0x00000079,0x00000078,0x0004003d,0x00000022,0x0000007a,0x00000028,0x0004003d,
|
||||
0x0000000a,0x0000007b,0x00000025,0x00050057,0x00000014,0x0000007c,0x0000007a,0x0000007b,
|
||||
0x0007004f,0x0000000a,0x0000007d,0x0000007c,0x0000007c,0x00000000,0x00000002,0x00050041,
|
||||
0x00000032,0x0000007e,0x0000006d,0x0000005b,0x00050051,0x00000009,0x0000007f,0x0000007d,
|
||||
0x00000000,0x0003003e,0x0000007e,0x0000007f,0x00050041,0x00000032,0x00000080,0x0000006d,
|
||||
0x00000058,0x00050051,0x00000009,0x00000081,0x0000007d,0x00000001,0x0003003e,0x00000080,
|
||||
0x00000081,0x0004003d,0x00000014,0x00000082,0x0000006d,0x00050094,0x00000009,0x00000084,
|
||||
0x00000082,0x00000083,0x000500b8,0x00000006,0x00000086,0x00000084,0x00000085,0x000300f7,
|
||||
0x00000088,0x00000000,0x000400fa,0x00000086,0x00000087,0x0000008f,0x000200f8,0x00000087,
|
||||
0x0004003d,0x00000022,0x0000008a,0x00000027,0x0004003d,0x0000000a,0x0000008b,0x00000025,
|
||||
0x00070058,0x00000014,0x0000008c,0x0000008a,0x0000008b,0x00000002,0x00000068,0x0003003e,
|
||||
0x00000089,0x0000008c,0x0004003d,0x00000014,0x0000008d,0x00000089,0x000200fe,0x0000008d,
|
||||
0x000200f8,0x0000008f,0x00050041,0x00000032,0x00000091,0x0000006d,0x0000002c,0x0004003d,
|
||||
0x00000009,0x00000092,0x00000091,0x00050041,0x00000032,0x00000093,0x0000006d,0x00000058,
|
||||
0x0004003d,0x00000009,0x00000094,0x00000093,0x0007000c,0x00000009,0x00000095,0x00000001,
|
||||
0x00000028,0x00000092,0x00000094,0x00050041,0x00000032,0x00000096,0x0000006d,0x00000036,
|
||||
0x0004003d,0x00000009,0x00000097,0x00000096,0x00050041,0x00000032,0x00000098,0x0000006d,
|
||||
0x0000005b,0x0004003d,0x00000009,0x00000099,0x00000098,0x0007000c,0x00000009,0x0000009a,
|
||||
0x00000001,0x00000028,0x00000097,0x00000099,0x000500ba,0x00000006,0x0000009b,0x00000095,
|
||||
0x0000009a,0x0003003e,0x00000090,0x0000009b,0x00050041,0x00000032,0x0000009d,0x0000006d,
|
||||
0x00000036,0x0004003d,0x00000009,0x0000009e,0x0000009d,0x00050041,0x00000032,0x0000009f,
|
||||
0x0000006d,0x0000005b,0x0004003d,0x00000009,0x000000a0,0x0000009f,0x00070050,0x00000014,
|
||||
0x000000a1,0x00000068,0x0000009e,0x00000068,0x000000a0,0x0003003e,0x0000009c,0x000000a1,
|
||||
0x0004003d,0x00000014,0x000000a3,0x0000006d,0x0007004f,0x0000000a,0x000000a4,0x000000a3,
|
||||
0x000000a3,0x00000001,0x00000003,0x0003003e,0x000000a2,0x000000a4,0x0004003d,0x00000006,
|
||||
0x000000a5,0x00000090,0x00070050,0x00000012,0x000000a6,0x000000a5,0x000000a5,0x000000a5,
|
||||
0x000000a5,0x00050041,0x00000032,0x000000a7,0x0000006d,0x0000002c,0x0004003d,0x00000009,
|
||||
0x000000a8,0x000000a7,0x00050041,0x00000032,0x000000a9,0x0000006d,0x00000058,0x0004003d,
|
||||
0x00000009,0x000000aa,0x000000a9,0x00070050,0x00000014,0x000000ab,0x000000a8,0x00000068,
|
||||
0x000000aa,0x00000068,0x0003003e,0x000000ac,0x000000a6,0x0004003d,0x00000014,0x000000ae,
|
||||
0x0000009c,0x0003003e,0x000000ad,0x000000ae,0x0003003e,0x000000af,0x000000ab,0x00070039,
|
||||
0x00000002,0x000000b0,0x0000001a,0x000000ac,0x000000ad,0x000000af,0x0004003d,0x00000014,
|
||||
0x000000b1,0x000000ad,0x0003003e,0x0000009c,0x000000b1,0x0004003d,0x00000006,0x000000b2,
|
||||
0x00000090,0x00050050,0x00000007,0x000000b3,0x000000b2,0x000000b2,0x0003003e,0x000000b4,
|
||||
0x000000b3,0x0004003d,0x0000000a,0x000000b6,0x000000a2,0x0003003e,0x000000b5,0x000000b6,
|
||||
0x0004003d,0x00000014,0x000000b8,0x0000006d,0x0007004f,0x0000000a,0x000000b9,0x000000b8,
|
||||
0x000000b8,0x00000000,0x00000002,0x0003003e,0x000000b7,0x000000b9,0x00070039,0x00000002,
|
||||
0x000000ba,0x00000010,0x000000b4,0x000000b5,0x000000b7,0x0004003d,0x0000000a,0x000000bb,
|
||||
0x000000b5,0x0003003e,0x000000a2,0x000000bb,0x0004003d,0x0000000a,0x000000bc,0x000000a2,
|
||||
0x00050094,0x00000009,0x000000be,0x000000bc,0x000000bd,0x0004003d,0x0000000a,0x000000bf,
|
||||
0x000000a2,0x00050050,0x0000000a,0x000000c0,0x000000be,0x000000be,0x00050088,0x0000000a,
|
||||
0x000000c1,0x000000bf,0x000000c0,0x0003003e,0x000000a2,0x000000c1,0x0004003d,0x00000014,
|
||||
0x000000c3,0x0000009c,0x00050041,0x00000063,0x000000c4,0x00000060,0x00000062,0x0004003d,
|
||||
0x00000014,0x000000c5,0x000000c4,0x0007004f,0x0000000a,0x000000c6,0x000000c5,0x000000c5,
|
||||
0x00000000,0x00000001,0x00050041,0x00000063,0x000000c7,0x00000060,0x00000062,0x0004003d,
|
||||
0x00000014,0x000000c8,0x000000c7,0x0007004f,0x0000000a,0x000000c9,0x000000c8,0x000000c8,
|
||||
0x00000000,0x00000001,0x0004007f,0x0000000a,0x000000ca,0x000000c9,0x00050051,0x00000009,
|
||||
0x000000cb,0x000000c6,0x00000000,0x00050051,0x00000009,0x000000cc,0x000000c6,0x00000001,
|
||||
0x00050051,0x00000009,0x000000cd,0x000000ca,0x00000000,0x00050051,0x00000009,0x000000ce,
|
||||
0x000000ca,0x00000001,0x00070050,0x00000014,0x000000cf,0x000000cb,0x000000cc,0x000000cd,
|
||||
0x000000ce,0x0004003d,0x0000000a,0x000000d0,0x00000025,0x0009004f,0x00000014,0x000000d1,
|
||||
0x000000d0,0x000000d0,0x00000000,0x00000001,0x00000000,0x00000001,0x0008000c,0x00000014,
|
||||
0x000000d2,0x00000001,0x00000032,0x000000c3,0x000000cf,0x000000d1,0x0003003e,0x000000c2,
|
||||
0x000000d2,0x00050041,0x00000032,0x000000d4,0x000000a2,0x0000002c,0x0004003d,0x00000009,
|
||||
0x000000d5,0x000000d4,0x0004003d,0x00000022,0x000000d6,0x00000027,0x0004003d,0x00000014,
|
||||
0x000000d7,0x000000c2,0x0007004f,0x0000000a,0x000000d8,0x000000d7,0x000000d7,0x00000000,
|
||||
0x00000001,0x00070058,0x00000014,0x000000d9,0x000000d6,0x000000d8,0x00000002,0x00000068,
|
||||
0x0005008e,0x00000014,0x000000da,0x000000d9,0x000000d5,0x0003003e,0x000000d3,0x000000da,
|
||||
0x00050041,0x00000032,0x000000db,0x000000a2,0x00000036,0x0004003d,0x00000009,0x000000dc,
|
||||
0x000000db,0x0004003d,0x00000022,0x000000dd,0x00000027,0x0004003d,0x00000014,0x000000de,
|
||||
0x000000c2,0x0007004f,0x0000000a,0x000000df,0x000000de,0x000000de,0x00000002,0x00000003,
|
||||
0x00070058,0x00000014,0x000000e0,0x000000dd,0x000000df,0x00000002,0x00000068,0x0005008e,
|
||||
0x00000014,0x000000e1,0x000000e0,0x000000dc,0x0004003d,0x00000014,0x000000e2,0x000000d3,
|
||||
0x00050081,0x00000014,0x000000e3,0x000000e2,0x000000e1,0x0003003e,0x000000d3,0x000000e3,
|
||||
0x0004003d,0x00000014,0x000000e4,0x000000d3,0x000200fe,0x000000e4,0x000200f8,0x00000088,
|
||||
0x000100ff,0x00010038
|
||||
};
|
||||
@@ -1,29 +1,21 @@
|
||||
#version 450
|
||||
#extension GL_GOOGLE_include_directive : require
|
||||
|
||||
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;
|
||||
vec4 metrics; // 1/width, 1/height, width, height
|
||||
} pc;
|
||||
|
||||
float luma(vec3 c) {
|
||||
return dot(c, vec3(0.2126, 0.7152, 0.0722));
|
||||
}
|
||||
#define SMAA_RT_METRICS pc.metrics
|
||||
#define SMAA_GLSL_4
|
||||
#define SMAA_PRESET_HIGH
|
||||
#include "SMAA.hlsl"
|
||||
|
||||
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);
|
||||
float center = luma(texture(InputTexture, uv).rgb);
|
||||
float left = luma(texture(InputTexture, uv - vec2(px.x, 0.0)).rgb);
|
||||
float right = luma(texture(InputTexture, uv + vec2(px.x, 0.0)).rgb);
|
||||
float up = luma(texture(InputTexture, uv - vec2(0.0, px.y)).rgb);
|
||||
float down = luma(texture(InputTexture, uv + vec2(0.0, px.y)).rgb);
|
||||
|
||||
// Store directional edge strengths for the weight pass.
|
||||
outColor = vec4(abs(center - left), abs(center - right),
|
||||
abs(center - up), abs(center - down));
|
||||
vec4 offset[3];
|
||||
SMAAEdgeDetectionVS(fragTexCoord, offset);
|
||||
outColor = vec4(SMAALumaEdgeDetectionPS(fragTexCoord, offset, InputTexture), 0.0, 0.0);
|
||||
}
|
||||
@@ -1,102 +1,185 @@
|
||||
// 1116.3.0
|
||||
// 1116.6.0
|
||||
#pragma once
|
||||
const uint32_t smaa_edge_code[] = {
|
||||
0x07230203,0x00010000,0x0008000b,0x00000080,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
0x07230203,0x00010000,0x0008000b,0x000000eb,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
|
||||
0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000028,0x0000006e,0x00030010,
|
||||
0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005,0x00000004,0x6e69616d,
|
||||
0x00000000,0x00050005,0x0000000b,0x616d756c,0x33667628,0x0000003b,0x00030005,0x0000000a,
|
||||
0x00000063,0x00030005,0x00000017,0x00007870,0x00050005,0x0000001a,0x736e6f43,0x746e6174,
|
||||
0x00000073,0x00040006,0x0000001a,0x00000000,0x0063646e,0x00060006,0x0000001a,0x00000001,
|
||||
0x6f736572,0x6974756c,0x00006e6f,0x00050006,0x0000001a,0x00000002,0x72747865,0x00000061,
|
||||
0x00040006,0x0000001a,0x00000003,0x00646170,0x00030005,0x0000001c,0x00006370,0x00030005,
|
||||
0x00000026,0x00007675,0x00060005,0x00000028,0x67617266,0x43786554,0x64726f6f,0x00000000,
|
||||
0x00040005,0x00000032,0x746e6563,0x00007265,0x00060005,0x00000036,0x75706e49,0x78655474,
|
||||
0x65727574,0x00000000,0x00040005,0x0000003a,0x61726170,0x0000006d,0x00040005,0x0000003d,
|
||||
0x7466656c,0x00000000,0x00040005,0x00000048,0x61726170,0x0000006d,0x00040005,0x0000004b,
|
||||
0x68676972,0x00000074,0x00040005,0x00000053,0x61726170,0x0000006d,0x00030005,0x00000056,
|
||||
0x00007075,0x00040005,0x0000005f,0x61726170,0x0000006d,0x00040005,0x00000062,0x6e776f64,
|
||||
0x00000000,0x00040005,0x0000006a,0x61726170,0x0000006d,0x00050005,0x0000006e,0x4374756f,
|
||||
0x726f6c6f,0x00000000,0x00030047,0x0000001a,0x00000002,0x00050048,0x0000001a,0x00000000,
|
||||
0x00000023,0x00000000,0x00050048,0x0000001a,0x00000001,0x00000023,0x00000010,0x00050048,
|
||||
0x0000001a,0x00000002,0x00000023,0x00000018,0x00050048,0x0000001a,0x00000003,0x00000023,
|
||||
0x0000001c,0x00040047,0x00000028,0x0000001e,0x00000000,0x00040047,0x00000036,0x00000021,
|
||||
0x00000000,0x00040047,0x00000036,0x00000022,0x00000000,0x00040047,0x0000006e,0x0000001e,
|
||||
0x00000000,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,
|
||||
0x00000020,0x00040017,0x00000007,0x00000006,0x00000003,0x00040020,0x00000008,0x00000007,
|
||||
0x00000007,0x00040021,0x00000009,0x00000006,0x00000008,0x0004002b,0x00000006,0x0000000e,
|
||||
0x3e59b3d0,0x0004002b,0x00000006,0x0000000f,0x3f371759,0x0004002b,0x00000006,0x00000010,
|
||||
0x3d93dd98,0x0006002c,0x00000007,0x00000011,0x0000000e,0x0000000f,0x00000010,0x00040017,
|
||||
0x00000015,0x00000006,0x00000002,0x00040020,0x00000016,0x00000007,0x00000015,0x0004002b,
|
||||
0x00000006,0x00000018,0x3f800000,0x00040017,0x00000019,0x00000006,0x00000004,0x0006001e,
|
||||
0x0000001a,0x00000019,0x00000015,0x00000006,0x00000006,0x00040020,0x0000001b,0x00000009,
|
||||
0x0000001a,0x0004003b,0x0000001b,0x0000001c,0x00000009,0x00040015,0x0000001d,0x00000020,
|
||||
0x00000001,0x0004002b,0x0000001d,0x0000001e,0x00000001,0x00040020,0x0000001f,0x00000009,
|
||||
0x00000015,0x0005002c,0x00000015,0x00000022,0x00000018,0x00000018,0x00040020,0x00000027,
|
||||
0x00000001,0x00000015,0x0004003b,0x00000027,0x00000028,0x00000001,0x0004002b,0x00000006,
|
||||
0x0000002b,0x3f000000,0x00040020,0x00000031,0x00000007,0x00000006,0x00090019,0x00000033,
|
||||
0x00000006,0x00000001,0x00000000,0x00000000,0x00000000,0x00000001,0x00000000,0x0003001b,
|
||||
0x00000034,0x00000033,0x00040020,0x00000035,0x00000000,0x00000034,0x0004003b,0x00000035,
|
||||
0x00000036,0x00000000,0x00040015,0x00000040,0x00000020,0x00000000,0x0004002b,0x00000040,
|
||||
0x00000041,0x00000000,0x0004002b,0x00000006,0x00000044,0x00000000,0x0004002b,0x00000040,
|
||||
0x00000059,0x00000001,0x00040020,0x0000006d,0x00000003,0x00000019,0x0004003b,0x0000006d,
|
||||
0x0000006e,0x00000003,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,
|
||||
0x00000005,0x0004003b,0x00000016,0x00000017,0x00000007,0x0004003b,0x00000016,0x00000026,
|
||||
0x00000007,0x0004003b,0x00000031,0x00000032,0x00000007,0x0004003b,0x00000008,0x0000003a,
|
||||
0x00000007,0x0004003b,0x00000031,0x0000003d,0x00000007,0x0004003b,0x00000008,0x00000048,
|
||||
0x00000007,0x0004003b,0x00000031,0x0000004b,0x00000007,0x0004003b,0x00000008,0x00000053,
|
||||
0x00000007,0x0004003b,0x00000031,0x00000056,0x00000007,0x0004003b,0x00000008,0x0000005f,
|
||||
0x00000007,0x0004003b,0x00000031,0x00000062,0x00000007,0x0004003b,0x00000008,0x0000006a,
|
||||
0x00000007,0x00050041,0x0000001f,0x00000020,0x0000001c,0x0000001e,0x0004003d,0x00000015,
|
||||
0x00000021,0x00000020,0x0007000c,0x00000015,0x00000023,0x00000001,0x00000028,0x00000021,
|
||||
0x00000022,0x00050050,0x00000015,0x00000024,0x00000018,0x00000018,0x00050088,0x00000015,
|
||||
0x00000025,0x00000024,0x00000023,0x0003003e,0x00000017,0x00000025,0x0004003d,0x00000015,
|
||||
0x00000029,0x00000028,0x0004003d,0x00000015,0x0000002a,0x00000017,0x0005008e,0x00000015,
|
||||
0x0000002c,0x0000002a,0x0000002b,0x0004003d,0x00000015,0x0000002d,0x00000017,0x0005008e,
|
||||
0x00000015,0x0000002e,0x0000002d,0x0000002b,0x00050083,0x00000015,0x0000002f,0x00000022,
|
||||
0x0000002e,0x0008000c,0x00000015,0x00000030,0x00000001,0x0000002b,0x00000029,0x0000002c,
|
||||
0x0000002f,0x0003003e,0x00000026,0x00000030,0x0004003d,0x00000034,0x00000037,0x00000036,
|
||||
0x0004003d,0x00000015,0x00000038,0x00000026,0x00050057,0x00000019,0x00000039,0x00000037,
|
||||
0x00000038,0x0008004f,0x00000007,0x0000003b,0x00000039,0x00000039,0x00000000,0x00000001,
|
||||
0x00000002,0x0003003e,0x0000003a,0x0000003b,0x00050039,0x00000006,0x0000003c,0x0000000b,
|
||||
0x0000003a,0x0003003e,0x00000032,0x0000003c,0x0004003d,0x00000034,0x0000003e,0x00000036,
|
||||
0x0004003d,0x00000015,0x0000003f,0x00000026,0x00050041,0x00000031,0x00000042,0x00000017,
|
||||
0x00000041,0x0004003d,0x00000006,0x00000043,0x00000042,0x00050050,0x00000015,0x00000045,
|
||||
0x00000043,0x00000044,0x00050083,0x00000015,0x00000046,0x0000003f,0x00000045,0x00050057,
|
||||
0x00000019,0x00000047,0x0000003e,0x00000046,0x0008004f,0x00000007,0x00000049,0x00000047,
|
||||
0x00000047,0x00000000,0x00000001,0x00000002,0x0003003e,0x00000048,0x00000049,0x00050039,
|
||||
0x00000006,0x0000004a,0x0000000b,0x00000048,0x0003003e,0x0000003d,0x0000004a,0x0004003d,
|
||||
0x00000034,0x0000004c,0x00000036,0x0004003d,0x00000015,0x0000004d,0x00000026,0x00050041,
|
||||
0x00000031,0x0000004e,0x00000017,0x00000041,0x0004003d,0x00000006,0x0000004f,0x0000004e,
|
||||
0x00050050,0x00000015,0x00000050,0x0000004f,0x00000044,0x00050081,0x00000015,0x00000051,
|
||||
0x0000004d,0x00000050,0x00050057,0x00000019,0x00000052,0x0000004c,0x00000051,0x0008004f,
|
||||
0x00000007,0x00000054,0x00000052,0x00000052,0x00000000,0x00000001,0x00000002,0x0003003e,
|
||||
0x00000053,0x00000054,0x00050039,0x00000006,0x00000055,0x0000000b,0x00000053,0x0003003e,
|
||||
0x0000004b,0x00000055,0x0004003d,0x00000034,0x00000057,0x00000036,0x0004003d,0x00000015,
|
||||
0x00000058,0x00000026,0x00050041,0x00000031,0x0000005a,0x00000017,0x00000059,0x0004003d,
|
||||
0x00000006,0x0000005b,0x0000005a,0x00050050,0x00000015,0x0000005c,0x00000044,0x0000005b,
|
||||
0x00050083,0x00000015,0x0000005d,0x00000058,0x0000005c,0x00050057,0x00000019,0x0000005e,
|
||||
0x00000057,0x0000005d,0x0008004f,0x00000007,0x00000060,0x0000005e,0x0000005e,0x00000000,
|
||||
0x00000001,0x00000002,0x0003003e,0x0000005f,0x00000060,0x00050039,0x00000006,0x00000061,
|
||||
0x0000000b,0x0000005f,0x0003003e,0x00000056,0x00000061,0x0004003d,0x00000034,0x00000063,
|
||||
0x00000036,0x0004003d,0x00000015,0x00000064,0x00000026,0x00050041,0x00000031,0x00000065,
|
||||
0x00000017,0x00000059,0x0004003d,0x00000006,0x00000066,0x00000065,0x00050050,0x00000015,
|
||||
0x00000067,0x00000044,0x00000066,0x00050081,0x00000015,0x00000068,0x00000064,0x00000067,
|
||||
0x00050057,0x00000019,0x00000069,0x00000063,0x00000068,0x0008004f,0x00000007,0x0000006b,
|
||||
0x00000069,0x00000069,0x00000000,0x00000001,0x00000002,0x0003003e,0x0000006a,0x0000006b,
|
||||
0x00050039,0x00000006,0x0000006c,0x0000000b,0x0000006a,0x0003003e,0x00000062,0x0000006c,
|
||||
0x0004003d,0x00000006,0x0000006f,0x00000032,0x0004003d,0x00000006,0x00000070,0x0000003d,
|
||||
0x00050083,0x00000006,0x00000071,0x0000006f,0x00000070,0x0006000c,0x00000006,0x00000072,
|
||||
0x00000001,0x00000004,0x00000071,0x0004003d,0x00000006,0x00000073,0x00000032,0x0004003d,
|
||||
0x00000006,0x00000074,0x0000004b,0x00050083,0x00000006,0x00000075,0x00000073,0x00000074,
|
||||
0x0006000c,0x00000006,0x00000076,0x00000001,0x00000004,0x00000075,0x0004003d,0x00000006,
|
||||
0x00000077,0x00000032,0x0004003d,0x00000006,0x00000078,0x00000056,0x00050083,0x00000006,
|
||||
0x00000079,0x00000077,0x00000078,0x0006000c,0x00000006,0x0000007a,0x00000001,0x00000004,
|
||||
0x00000079,0x0004003d,0x00000006,0x0000007b,0x00000032,0x0004003d,0x00000006,0x0000007c,
|
||||
0x00000062,0x00050083,0x00000006,0x0000007d,0x0000007b,0x0000007c,0x0006000c,0x00000006,
|
||||
0x0000007e,0x00000001,0x00000004,0x0000007d,0x00070050,0x00000019,0x0000007f,0x00000072,
|
||||
0x00000076,0x0000007a,0x0000007e,0x0003003e,0x0000006e,0x0000007f,0x000100fd,0x00010038,
|
||||
0x00050036,0x00000006,0x0000000b,0x00000000,0x00000009,0x00030037,0x00000008,0x0000000a,
|
||||
0x000200f8,0x0000000c,0x0004003d,0x00000007,0x0000000d,0x0000000a,0x00050094,0x00000006,
|
||||
0x00000012,0x0000000d,0x00000011,0x000200fe,0x00000012,0x00010038
|
||||
0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x000000d9,0x000000e1,0x00030010,
|
||||
0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x000a0004,0x475f4c47,0x4c474f4f,
|
||||
0x70635f45,0x74735f70,0x5f656c79,0x656e696c,0x7269645f,0x69746365,0x00006576,0x00080004,
|
||||
0x475f4c47,0x4c474f4f,0x6e695f45,0x64756c63,0x69645f65,0x74636572,0x00657669,0x00040005,
|
||||
0x00000004,0x6e69616d,0x00000000,0x000a0005,0x00000011,0x41414d53,0x65676445,0x65746544,
|
||||
0x6f697463,0x2853566e,0x3b326676,0x5b346676,0x003b5d33,0x00050005,0x0000000f,0x63786574,
|
||||
0x64726f6f,0x00000000,0x00040005,0x00000010,0x7366666f,0x00007465,0x000c0005,0x0000001a,
|
||||
0x41414d53,0x616d754c,0x65676445,0x65746544,0x6f697463,0x2853506e,0x3b326676,0x5b346676,
|
||||
0x733b5d33,0x003b3132,0x00050005,0x00000017,0x63786574,0x64726f6f,0x00000000,0x00040005,
|
||||
0x00000018,0x7366666f,0x00007465,0x00050005,0x00000019,0x6f6c6f63,0x78655472,0x00000000,
|
||||
0x00050005,0x0000001e,0x736e6f43,0x746e6174,0x00000073,0x00040006,0x0000001e,0x00000000,
|
||||
0x0063646e,0x00050006,0x0000001e,0x00000001,0x7274656d,0x00736369,0x00030005,0x00000020,
|
||||
0x00006370,0x00050005,0x00000041,0x65726874,0x6c6f6873,0x00000064,0x00040005,0x00000046,
|
||||
0x67696577,0x00737468,0x00030005,0x0000004c,0x0000004c,0x00040005,0x00000053,0x66656c4c,
|
||||
0x00000074,0x00040005,0x0000005c,0x706f744c,0x00000000,0x00040005,0x00000065,0x746c6564,
|
||||
0x00000061,0x00040005,0x00000073,0x65676465,0x00000073,0x00040005,0x00000080,0x6769724c,
|
||||
0x00007468,0x00040005,0x00000089,0x746f624c,0x006d6f74,0x00050005,0x0000009e,0x4478616d,
|
||||
0x61746c65,0x00000000,0x00050005,0x000000a4,0x66656c4c,0x66656c74,0x00000074,0x00040005,
|
||||
0x000000ad,0x706f744c,0x00706f74,0x00050005,0x000000c6,0x616e6966,0x6c65446c,0x00006174,
|
||||
0x00060005,0x000000d9,0x67617266,0x43786554,0x64726f6f,0x00000000,0x00040005,0x000000da,
|
||||
0x7366666f,0x00007465,0x00040005,0x000000db,0x61726170,0x0000006d,0x00040005,0x000000dd,
|
||||
0x61726170,0x0000006d,0x00050005,0x000000e1,0x4374756f,0x726f6c6f,0x00000000,0x00060005,
|
||||
0x000000e2,0x75706e49,0x78655474,0x65727574,0x00000000,0x00040005,0x000000e3,0x61726170,
|
||||
0x0000006d,0x00040005,0x000000e5,0x61726170,0x0000006d,0x00030047,0x0000001e,0x00000002,
|
||||
0x00050048,0x0000001e,0x00000000,0x00000023,0x00000000,0x00050048,0x0000001e,0x00000001,
|
||||
0x00000023,0x00000010,0x00040047,0x000000d9,0x0000001e,0x00000000,0x00040047,0x000000e1,
|
||||
0x0000001e,0x00000000,0x00040047,0x000000e2,0x00000021,0x00000000,0x00040047,0x000000e2,
|
||||
0x00000022,0x00000000,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,
|
||||
0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000002,0x00040020,0x00000008,
|
||||
0x00000007,0x00000007,0x00040017,0x00000009,0x00000006,0x00000004,0x00040015,0x0000000a,
|
||||
0x00000020,0x00000000,0x0004002b,0x0000000a,0x0000000b,0x00000003,0x0004001c,0x0000000c,
|
||||
0x00000009,0x0000000b,0x00040020,0x0000000d,0x00000007,0x0000000c,0x00050021,0x0000000e,
|
||||
0x00000002,0x00000008,0x0000000d,0x00090019,0x00000013,0x00000006,0x00000001,0x00000000,
|
||||
0x00000000,0x00000000,0x00000001,0x00000000,0x0003001b,0x00000014,0x00000013,0x00040020,
|
||||
0x00000015,0x00000000,0x00000014,0x00060021,0x00000016,0x00000007,0x00000008,0x0000000d,
|
||||
0x00000015,0x00040015,0x0000001c,0x00000020,0x00000001,0x0004002b,0x0000001c,0x0000001d,
|
||||
0x00000000,0x0004001e,0x0000001e,0x00000009,0x00000009,0x00040020,0x0000001f,0x00000009,
|
||||
0x0000001e,0x0004003b,0x0000001f,0x00000020,0x00000009,0x0004002b,0x0000001c,0x00000021,
|
||||
0x00000001,0x00040020,0x00000022,0x00000009,0x00000009,0x0004002b,0x00000006,0x00000026,
|
||||
0xbf800000,0x0004002b,0x00000006,0x00000027,0x00000000,0x0007002c,0x00000009,0x00000028,
|
||||
0x00000026,0x00000027,0x00000027,0x00000026,0x00040020,0x0000002c,0x00000007,0x00000009,
|
||||
0x0004002b,0x00000006,0x00000031,0x3f800000,0x0007002c,0x00000009,0x00000032,0x00000031,
|
||||
0x00000027,0x00000027,0x00000031,0x0004002b,0x0000001c,0x00000037,0x00000002,0x0004002b,
|
||||
0x00000006,0x0000003b,0xc0000000,0x0007002c,0x00000009,0x0000003c,0x0000003b,0x00000027,
|
||||
0x00000027,0x0000003b,0x0004002b,0x00000006,0x00000042,0x3dcccccd,0x0005002c,0x00000007,
|
||||
0x00000043,0x00000042,0x00000042,0x00040017,0x00000044,0x00000006,0x00000003,0x00040020,
|
||||
0x00000045,0x00000007,0x00000044,0x0004002b,0x00000006,0x00000047,0x3e59b3d0,0x0004002b,
|
||||
0x00000006,0x00000048,0x3f371759,0x0004002b,0x00000006,0x00000049,0x3d93dd98,0x0006002c,
|
||||
0x00000044,0x0000004a,0x00000047,0x00000048,0x00000049,0x00040020,0x0000004b,0x00000007,
|
||||
0x00000006,0x0004002b,0x0000000a,0x0000006d,0x00000000,0x0004002b,0x0000000a,0x00000070,
|
||||
0x00000001,0x0005002c,0x00000007,0x00000079,0x00000031,0x00000031,0x00020014,0x0000007b,
|
||||
0x0004002b,0x0000000a,0x00000099,0x00000002,0x0004002b,0x00000006,0x000000cd,0x40000000,
|
||||
0x00040020,0x000000d8,0x00000001,0x00000007,0x0004003b,0x000000d8,0x000000d9,0x00000001,
|
||||
0x00040020,0x000000e0,0x00000003,0x00000009,0x0004003b,0x000000e0,0x000000e1,0x00000003,
|
||||
0x0004003b,0x00000015,0x000000e2,0x00000000,0x00050036,0x00000002,0x00000004,0x00000000,
|
||||
0x00000003,0x000200f8,0x00000005,0x0004003b,0x0000000d,0x000000da,0x00000007,0x0004003b,
|
||||
0x00000008,0x000000db,0x00000007,0x0004003b,0x0000000d,0x000000dd,0x00000007,0x0004003b,
|
||||
0x00000008,0x000000e3,0x00000007,0x0004003b,0x0000000d,0x000000e5,0x00000007,0x0004003d,
|
||||
0x00000007,0x000000dc,0x000000d9,0x0003003e,0x000000db,0x000000dc,0x00060039,0x00000002,
|
||||
0x000000de,0x00000011,0x000000db,0x000000dd,0x0004003d,0x0000000c,0x000000df,0x000000dd,
|
||||
0x0003003e,0x000000da,0x000000df,0x0004003d,0x00000007,0x000000e4,0x000000d9,0x0003003e,
|
||||
0x000000e3,0x000000e4,0x0004003d,0x0000000c,0x000000e6,0x000000da,0x0003003e,0x000000e5,
|
||||
0x000000e6,0x00070039,0x00000007,0x000000e7,0x0000001a,0x000000e3,0x000000e5,0x000000e2,
|
||||
0x00050051,0x00000006,0x000000e8,0x000000e7,0x00000000,0x00050051,0x00000006,0x000000e9,
|
||||
0x000000e7,0x00000001,0x00070050,0x00000009,0x000000ea,0x000000e8,0x000000e9,0x00000027,
|
||||
0x00000027,0x0003003e,0x000000e1,0x000000ea,0x000100fd,0x00010038,0x00050036,0x00000002,
|
||||
0x00000011,0x00000000,0x0000000e,0x00030037,0x00000008,0x0000000f,0x00030037,0x0000000d,
|
||||
0x00000010,0x000200f8,0x00000012,0x00050041,0x00000022,0x00000023,0x00000020,0x00000021,
|
||||
0x0004003d,0x00000009,0x00000024,0x00000023,0x0009004f,0x00000009,0x00000025,0x00000024,
|
||||
0x00000024,0x00000000,0x00000001,0x00000000,0x00000001,0x0004003d,0x00000007,0x00000029,
|
||||
0x0000000f,0x0009004f,0x00000009,0x0000002a,0x00000029,0x00000029,0x00000000,0x00000001,
|
||||
0x00000000,0x00000001,0x0008000c,0x00000009,0x0000002b,0x00000001,0x00000032,0x00000025,
|
||||
0x00000028,0x0000002a,0x00050041,0x0000002c,0x0000002d,0x00000010,0x0000001d,0x0003003e,
|
||||
0x0000002d,0x0000002b,0x00050041,0x00000022,0x0000002e,0x00000020,0x00000021,0x0004003d,
|
||||
0x00000009,0x0000002f,0x0000002e,0x0009004f,0x00000009,0x00000030,0x0000002f,0x0000002f,
|
||||
0x00000000,0x00000001,0x00000000,0x00000001,0x0004003d,0x00000007,0x00000033,0x0000000f,
|
||||
0x0009004f,0x00000009,0x00000034,0x00000033,0x00000033,0x00000000,0x00000001,0x00000000,
|
||||
0x00000001,0x0008000c,0x00000009,0x00000035,0x00000001,0x00000032,0x00000030,0x00000032,
|
||||
0x00000034,0x00050041,0x0000002c,0x00000036,0x00000010,0x00000021,0x0003003e,0x00000036,
|
||||
0x00000035,0x00050041,0x00000022,0x00000038,0x00000020,0x00000021,0x0004003d,0x00000009,
|
||||
0x00000039,0x00000038,0x0009004f,0x00000009,0x0000003a,0x00000039,0x00000039,0x00000000,
|
||||
0x00000001,0x00000000,0x00000001,0x0004003d,0x00000007,0x0000003d,0x0000000f,0x0009004f,
|
||||
0x00000009,0x0000003e,0x0000003d,0x0000003d,0x00000000,0x00000001,0x00000000,0x00000001,
|
||||
0x0008000c,0x00000009,0x0000003f,0x00000001,0x00000032,0x0000003a,0x0000003c,0x0000003e,
|
||||
0x00050041,0x0000002c,0x00000040,0x00000010,0x00000037,0x0003003e,0x00000040,0x0000003f,
|
||||
0x000100fd,0x00010038,0x00050036,0x00000007,0x0000001a,0x00000000,0x00000016,0x00030037,
|
||||
0x00000008,0x00000017,0x00030037,0x0000000d,0x00000018,0x00030037,0x00000015,0x00000019,
|
||||
0x000200f8,0x0000001b,0x0004003b,0x00000008,0x00000041,0x00000007,0x0004003b,0x00000045,
|
||||
0x00000046,0x00000007,0x0004003b,0x0000004b,0x0000004c,0x00000007,0x0004003b,0x0000004b,
|
||||
0x00000053,0x00000007,0x0004003b,0x0000004b,0x0000005c,0x00000007,0x0004003b,0x0000002c,
|
||||
0x00000065,0x00000007,0x0004003b,0x00000008,0x00000073,0x00000007,0x0004003b,0x0000004b,
|
||||
0x00000080,0x00000007,0x0004003b,0x0000004b,0x00000089,0x00000007,0x0004003b,0x00000008,
|
||||
0x0000009e,0x00000007,0x0004003b,0x0000004b,0x000000a4,0x00000007,0x0004003b,0x0000004b,
|
||||
0x000000ad,0x00000007,0x0004003b,0x0000004b,0x000000c6,0x00000007,0x0003003e,0x00000041,
|
||||
0x00000043,0x0003003e,0x00000046,0x0000004a,0x0004003d,0x00000014,0x0000004d,0x00000019,
|
||||
0x0004003d,0x00000007,0x0000004e,0x00000017,0x00050057,0x00000009,0x0000004f,0x0000004d,
|
||||
0x0000004e,0x0008004f,0x00000044,0x00000050,0x0000004f,0x0000004f,0x00000000,0x00000001,
|
||||
0x00000002,0x0004003d,0x00000044,0x00000051,0x00000046,0x00050094,0x00000006,0x00000052,
|
||||
0x00000050,0x00000051,0x0003003e,0x0000004c,0x00000052,0x0004003d,0x00000014,0x00000054,
|
||||
0x00000019,0x00050041,0x0000002c,0x00000055,0x00000018,0x0000001d,0x0004003d,0x00000009,
|
||||
0x00000056,0x00000055,0x0007004f,0x00000007,0x00000057,0x00000056,0x00000056,0x00000000,
|
||||
0x00000001,0x00050057,0x00000009,0x00000058,0x00000054,0x00000057,0x0008004f,0x00000044,
|
||||
0x00000059,0x00000058,0x00000058,0x00000000,0x00000001,0x00000002,0x0004003d,0x00000044,
|
||||
0x0000005a,0x00000046,0x00050094,0x00000006,0x0000005b,0x00000059,0x0000005a,0x0003003e,
|
||||
0x00000053,0x0000005b,0x0004003d,0x00000014,0x0000005d,0x00000019,0x00050041,0x0000002c,
|
||||
0x0000005e,0x00000018,0x0000001d,0x0004003d,0x00000009,0x0000005f,0x0000005e,0x0007004f,
|
||||
0x00000007,0x00000060,0x0000005f,0x0000005f,0x00000002,0x00000003,0x00050057,0x00000009,
|
||||
0x00000061,0x0000005d,0x00000060,0x0008004f,0x00000044,0x00000062,0x00000061,0x00000061,
|
||||
0x00000000,0x00000001,0x00000002,0x0004003d,0x00000044,0x00000063,0x00000046,0x00050094,
|
||||
0x00000006,0x00000064,0x00000062,0x00000063,0x0003003e,0x0000005c,0x00000064,0x0004003d,
|
||||
0x00000006,0x00000066,0x0000004c,0x0004003d,0x00000006,0x00000067,0x00000053,0x0004003d,
|
||||
0x00000006,0x00000068,0x0000005c,0x00050050,0x00000007,0x00000069,0x00000067,0x00000068,
|
||||
0x00050050,0x00000007,0x0000006a,0x00000066,0x00000066,0x00050083,0x00000007,0x0000006b,
|
||||
0x0000006a,0x00000069,0x0006000c,0x00000007,0x0000006c,0x00000001,0x00000004,0x0000006b,
|
||||
0x00050041,0x0000004b,0x0000006e,0x00000065,0x0000006d,0x00050051,0x00000006,0x0000006f,
|
||||
0x0000006c,0x00000000,0x0003003e,0x0000006e,0x0000006f,0x00050041,0x0000004b,0x00000071,
|
||||
0x00000065,0x00000070,0x00050051,0x00000006,0x00000072,0x0000006c,0x00000001,0x0003003e,
|
||||
0x00000071,0x00000072,0x0004003d,0x00000007,0x00000074,0x00000041,0x0004003d,0x00000009,
|
||||
0x00000075,0x00000065,0x0007004f,0x00000007,0x00000076,0x00000075,0x00000075,0x00000000,
|
||||
0x00000001,0x0007000c,0x00000007,0x00000077,0x00000001,0x00000030,0x00000074,0x00000076,
|
||||
0x0003003e,0x00000073,0x00000077,0x0004003d,0x00000007,0x00000078,0x00000073,0x00050094,
|
||||
0x00000006,0x0000007a,0x00000078,0x00000079,0x000500b4,0x0000007b,0x0000007c,0x0000007a,
|
||||
0x00000027,0x000300f7,0x0000007e,0x00000000,0x000400fa,0x0000007c,0x0000007d,0x0000007e,
|
||||
0x000200f8,0x0000007d,0x000100fc,0x000200f8,0x0000007e,0x0004003d,0x00000014,0x00000081,
|
||||
0x00000019,0x00050041,0x0000002c,0x00000082,0x00000018,0x00000021,0x0004003d,0x00000009,
|
||||
0x00000083,0x00000082,0x0007004f,0x00000007,0x00000084,0x00000083,0x00000083,0x00000000,
|
||||
0x00000001,0x00050057,0x00000009,0x00000085,0x00000081,0x00000084,0x0008004f,0x00000044,
|
||||
0x00000086,0x00000085,0x00000085,0x00000000,0x00000001,0x00000002,0x0004003d,0x00000044,
|
||||
0x00000087,0x00000046,0x00050094,0x00000006,0x00000088,0x00000086,0x00000087,0x0003003e,
|
||||
0x00000080,0x00000088,0x0004003d,0x00000014,0x0000008a,0x00000019,0x00050041,0x0000002c,
|
||||
0x0000008b,0x00000018,0x00000021,0x0004003d,0x00000009,0x0000008c,0x0000008b,0x0007004f,
|
||||
0x00000007,0x0000008d,0x0000008c,0x0000008c,0x00000002,0x00000003,0x00050057,0x00000009,
|
||||
0x0000008e,0x0000008a,0x0000008d,0x0008004f,0x00000044,0x0000008f,0x0000008e,0x0000008e,
|
||||
0x00000000,0x00000001,0x00000002,0x0004003d,0x00000044,0x00000090,0x00000046,0x00050094,
|
||||
0x00000006,0x00000091,0x0000008f,0x00000090,0x0003003e,0x00000089,0x00000091,0x0004003d,
|
||||
0x00000006,0x00000092,0x0000004c,0x0004003d,0x00000006,0x00000093,0x00000080,0x0004003d,
|
||||
0x00000006,0x00000094,0x00000089,0x00050050,0x00000007,0x00000095,0x00000093,0x00000094,
|
||||
0x00050050,0x00000007,0x00000096,0x00000092,0x00000092,0x00050083,0x00000007,0x00000097,
|
||||
0x00000096,0x00000095,0x0006000c,0x00000007,0x00000098,0x00000001,0x00000004,0x00000097,
|
||||
0x00050041,0x0000004b,0x0000009a,0x00000065,0x00000099,0x00050051,0x00000006,0x0000009b,
|
||||
0x00000098,0x00000000,0x0003003e,0x0000009a,0x0000009b,0x00050041,0x0000004b,0x0000009c,
|
||||
0x00000065,0x0000000b,0x00050051,0x00000006,0x0000009d,0x00000098,0x00000001,0x0003003e,
|
||||
0x0000009c,0x0000009d,0x0004003d,0x00000009,0x0000009f,0x00000065,0x0007004f,0x00000007,
|
||||
0x000000a0,0x0000009f,0x0000009f,0x00000000,0x00000001,0x0004003d,0x00000009,0x000000a1,
|
||||
0x00000065,0x0007004f,0x00000007,0x000000a2,0x000000a1,0x000000a1,0x00000002,0x00000003,
|
||||
0x0007000c,0x00000007,0x000000a3,0x00000001,0x00000028,0x000000a0,0x000000a2,0x0003003e,
|
||||
0x0000009e,0x000000a3,0x0004003d,0x00000014,0x000000a5,0x00000019,0x00050041,0x0000002c,
|
||||
0x000000a6,0x00000018,0x00000037,0x0004003d,0x00000009,0x000000a7,0x000000a6,0x0007004f,
|
||||
0x00000007,0x000000a8,0x000000a7,0x000000a7,0x00000000,0x00000001,0x00050057,0x00000009,
|
||||
0x000000a9,0x000000a5,0x000000a8,0x0008004f,0x00000044,0x000000aa,0x000000a9,0x000000a9,
|
||||
0x00000000,0x00000001,0x00000002,0x0004003d,0x00000044,0x000000ab,0x00000046,0x00050094,
|
||||
0x00000006,0x000000ac,0x000000aa,0x000000ab,0x0003003e,0x000000a4,0x000000ac,0x0004003d,
|
||||
0x00000014,0x000000ae,0x00000019,0x00050041,0x0000002c,0x000000af,0x00000018,0x00000037,
|
||||
0x0004003d,0x00000009,0x000000b0,0x000000af,0x0007004f,0x00000007,0x000000b1,0x000000b0,
|
||||
0x000000b0,0x00000002,0x00000003,0x00050057,0x00000009,0x000000b2,0x000000ae,0x000000b1,
|
||||
0x0008004f,0x00000044,0x000000b3,0x000000b2,0x000000b2,0x00000000,0x00000001,0x00000002,
|
||||
0x0004003d,0x00000044,0x000000b4,0x00000046,0x00050094,0x00000006,0x000000b5,0x000000b3,
|
||||
0x000000b4,0x0003003e,0x000000ad,0x000000b5,0x0004003d,0x00000006,0x000000b6,0x00000053,
|
||||
0x0004003d,0x00000006,0x000000b7,0x0000005c,0x00050050,0x00000007,0x000000b8,0x000000b6,
|
||||
0x000000b7,0x0004003d,0x00000006,0x000000b9,0x000000a4,0x0004003d,0x00000006,0x000000ba,
|
||||
0x000000ad,0x00050050,0x00000007,0x000000bb,0x000000b9,0x000000ba,0x00050083,0x00000007,
|
||||
0x000000bc,0x000000b8,0x000000bb,0x0006000c,0x00000007,0x000000bd,0x00000001,0x00000004,
|
||||
0x000000bc,0x00050041,0x0000004b,0x000000be,0x00000065,0x00000099,0x00050051,0x00000006,
|
||||
0x000000bf,0x000000bd,0x00000000,0x0003003e,0x000000be,0x000000bf,0x00050041,0x0000004b,
|
||||
0x000000c0,0x00000065,0x0000000b,0x00050051,0x00000006,0x000000c1,0x000000bd,0x00000001,
|
||||
0x0003003e,0x000000c0,0x000000c1,0x0004003d,0x00000007,0x000000c2,0x0000009e,0x0004003d,
|
||||
0x00000009,0x000000c3,0x00000065,0x0007004f,0x00000007,0x000000c4,0x000000c3,0x000000c3,
|
||||
0x00000002,0x00000003,0x0007000c,0x00000007,0x000000c5,0x00000001,0x00000028,0x000000c2,
|
||||
0x000000c4,0x0003003e,0x0000009e,0x000000c5,0x00050041,0x0000004b,0x000000c7,0x0000009e,
|
||||
0x0000006d,0x0004003d,0x00000006,0x000000c8,0x000000c7,0x00050041,0x0000004b,0x000000c9,
|
||||
0x0000009e,0x00000070,0x0004003d,0x00000006,0x000000ca,0x000000c9,0x0007000c,0x00000006,
|
||||
0x000000cb,0x00000001,0x00000028,0x000000c8,0x000000ca,0x0003003e,0x000000c6,0x000000cb,
|
||||
0x0004003d,0x00000006,0x000000cc,0x000000c6,0x0004003d,0x00000009,0x000000ce,0x00000065,
|
||||
0x0007004f,0x00000007,0x000000cf,0x000000ce,0x000000ce,0x00000000,0x00000001,0x0005008e,
|
||||
0x00000007,0x000000d0,0x000000cf,0x000000cd,0x00050050,0x00000007,0x000000d1,0x000000cc,
|
||||
0x000000cc,0x0007000c,0x00000007,0x000000d2,0x00000001,0x00000030,0x000000d1,0x000000d0,
|
||||
0x0004003d,0x00000007,0x000000d3,0x00000073,0x00050085,0x00000007,0x000000d4,0x000000d3,
|
||||
0x000000d2,0x0003003e,0x00000073,0x000000d4,0x0004003d,0x00000007,0x000000d5,0x00000073,
|
||||
0x000200fe,0x000000d5,0x00010038
|
||||
};
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,153 +1,25 @@
|
||||
#version 450
|
||||
#extension GL_GOOGLE_include_directive : require
|
||||
|
||||
layout(location = 0) in vec2 fragTexCoord;
|
||||
layout(location = 0) out vec4 outColor;
|
||||
layout(set = 0, binding = 0) uniform sampler2D EdgeTexture;
|
||||
layout(set = 1, binding = 0) uniform sampler2D AreaTexture;
|
||||
layout(set = 2, binding = 0) uniform sampler2D SearchTexture;
|
||||
layout(push_constant) uniform Constants {
|
||||
vec4 ndc;
|
||||
vec2 resolution;
|
||||
float extra;
|
||||
float pad;
|
||||
vec4 metrics; // 1/width, 1/height, width, height
|
||||
} pc;
|
||||
|
||||
vec4 edgeAt(vec2 uv, vec2 px) {
|
||||
vec2 edgeUV = clamp(uv, px * 0.5, vec2(1.0) - px * 0.5);
|
||||
vec4 e = textureLod(EdgeTexture, edgeUV, 0.0);
|
||||
e.a = edgeUV.y >= 1.0 - px.y ? 0.0 : e.a;
|
||||
return e;
|
||||
}
|
||||
|
||||
float verticalEdge(vec2 uv, vec2 px) {
|
||||
vec4 e = edgeAt(uv, px);
|
||||
return max(e.r, e.g);
|
||||
}
|
||||
|
||||
float horizontalEdge(vec2 uv, vec2 px) {
|
||||
vec4 e = edgeAt(uv, px);
|
||||
return max(e.b, e.a);
|
||||
}
|
||||
|
||||
float measureRun(vec2 origin, vec2 texel, vec2 tangent,
|
||||
bool verticalLine, float limit, bool positive) {
|
||||
float run = 0.0;
|
||||
for (int i = 1; i <= 6; ++i) {
|
||||
vec2 probe = origin + tangent * float(i) * (positive ? 1.0 : -1.0);
|
||||
ivec2 index = ivec2(floor(probe * pc.resolution));
|
||||
ivec2 size = ivec2(pc.resolution);
|
||||
if (any(lessThan(index, ivec2(0))) ||
|
||||
any(greaterThanEqual(index, size))) {
|
||||
break;
|
||||
}
|
||||
float edge = verticalLine
|
||||
? verticalEdge(probe, texel)
|
||||
: horizontalEdge(probe, texel);
|
||||
if (edge <= limit * 0.65) {
|
||||
break;
|
||||
}
|
||||
run = float(i);
|
||||
}
|
||||
return run;
|
||||
}
|
||||
#define SMAA_RT_METRICS pc.metrics
|
||||
#define SMAA_GLSL_4
|
||||
#define SMAA_PRESET_HIGH
|
||||
#include "SMAA.hlsl"
|
||||
|
||||
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 e = edgeAt(uv, px);
|
||||
|
||||
float dL = e.r;
|
||||
float dR = e.g;
|
||||
float dU = e.b;
|
||||
float dD = e.a;
|
||||
float vertical = max(dL, dR);
|
||||
float horizontal = max(dU, dD);
|
||||
float strongest = max(vertical, horizontal);
|
||||
float threshold = max(0.045, strongest * 0.12);
|
||||
|
||||
if (strongest <= threshold) {
|
||||
outColor = vec4(0.0, 0.5, 0.5, 0.0);
|
||||
return;
|
||||
}
|
||||
|
||||
bool verticalLine;
|
||||
float negativeRun = 0.0;
|
||||
float positiveRun = 0.0;
|
||||
bool runsMeasured = false;
|
||||
|
||||
if (vertical > horizontal) {
|
||||
verticalLine = true;
|
||||
} else if (horizontal > vertical) {
|
||||
verticalLine = false;
|
||||
} else {
|
||||
float vNeg = measureRun(uv, px, vec2(0.0, px.y), true, threshold, false);
|
||||
float vPos = measureRun(uv, px, vec2(0.0, px.y), true, threshold, true);
|
||||
float hNeg = measureRun(uv, px, vec2(px.x, 0.0), false, threshold, false);
|
||||
float hPos = measureRun(uv, px, vec2(px.x, 0.0), false, threshold, true);
|
||||
verticalLine = (vNeg + vPos) >= (hNeg + hPos);
|
||||
negativeRun = verticalLine ? vNeg : hNeg;
|
||||
positiveRun = verticalLine ? vPos : hPos;
|
||||
runsMeasured = true;
|
||||
}
|
||||
|
||||
vec2 tangent = verticalLine ? vec2(0.0, px.y) : vec2(px.x, 0.0);
|
||||
vec2 normal = verticalLine
|
||||
? vec2(dL >= dR ? -1.0 : 1.0, 0.0)
|
||||
: vec2(0.0, dU >= dD ? -1.0 : 1.0);
|
||||
|
||||
if (!runsMeasured) {
|
||||
negativeRun = measureRun(uv, px, tangent, verticalLine, threshold, false);
|
||||
positiveRun = measureRun(uv, px, tangent, verticalLine, threshold, true);
|
||||
}
|
||||
|
||||
float span = negativeRun + positiveRun;
|
||||
float edgeConfidence = smoothstep(threshold, threshold * 2.5, strongest);
|
||||
|
||||
vec4 nw = edgeAt(uv + vec2(-px.x, -px.y), px);
|
||||
vec4 ne = edgeAt(uv + vec2(px.x, -px.y), px);
|
||||
vec4 sw = edgeAt(uv + vec2(-px.x, px.y), px);
|
||||
vec4 se = edgeAt(uv + vec2(px.x, px.y), px);
|
||||
|
||||
float runEndpointPattern = clamp(
|
||||
abs(negativeRun - positiveRun) / max(span, 1.0), 0.0, 1.0);
|
||||
float crossingA = verticalLine
|
||||
? abs(nw.a - ne.a)
|
||||
: abs(nw.g - sw.g);
|
||||
float crossingB = verticalLine
|
||||
? abs(sw.b - se.b)
|
||||
: abs(ne.r - se.r);
|
||||
float crossingContrast = abs(crossingA - crossingB);
|
||||
float crossingPattern = smoothstep(threshold, threshold * 2.5, crossingContrast);
|
||||
vec4 edgeMin = min(min(nw, ne), min(sw, se));
|
||||
vec4 edgeMax = max(max(nw, ne), max(sw, se));
|
||||
float edgeVariation = max(
|
||||
max(edgeMax.r - edgeMin.r, edgeMax.g - edgeMin.g),
|
||||
max(edgeMax.b - edgeMin.b, edgeMax.a - edgeMin.a));
|
||||
float balancedCrossing = edgeVariation > 0.01
|
||||
? smoothstep(threshold, threshold * 2.5, min(crossingA, crossingB))
|
||||
: 0.0;
|
||||
float endpointPattern = runEndpointPattern > 0.01
|
||||
? max(runEndpointPattern, balancedCrossing)
|
||||
: runEndpointPattern;
|
||||
float endpointArea = endpointPattern / (1.0 + span * 0.055);
|
||||
float areaWeight = 0.38 * crossingPattern * clamp(span / 4.0, 0.0, 1.0);
|
||||
float diagonalContrast = max(
|
||||
max(max(abs(nw.r - se.r), abs(nw.g - se.g)),
|
||||
max(abs(nw.b - se.b), abs(nw.a - se.a))),
|
||||
max(max(abs(ne.r - sw.r), abs(ne.g - sw.g)),
|
||||
max(abs(ne.b - sw.b), abs(ne.a - sw.a))));
|
||||
float cornerFactor = 1.0 - 0.35 * smoothstep(threshold, threshold * 3.0, diagonalContrast);
|
||||
float baseWeight = areaWeight * endpointArea * edgeConfidence * cornerFactor;
|
||||
|
||||
float diagonalStrength = min(vertical, horizontal);
|
||||
float diagonalPattern = smoothstep(threshold, threshold * 2.5, diagonalStrength);
|
||||
float diagonalContinuity = smoothstep(1.0, 3.0, span);
|
||||
float shortDiagonalFallback =
|
||||
(span > 0.0 && span <= 1.0 && crossingContrast <= threshold && diagonalStrength > threshold)
|
||||
? 1.0 : 0.0;
|
||||
float diagonalFallback = 0.16 * diagonalPattern * edgeConfidence
|
||||
* cornerFactor * max(
|
||||
diagonalContinuity * max(crossingPattern, balancedCrossing),
|
||||
shortDiagonalFallback);
|
||||
|
||||
float weight = clamp(max(baseWeight, diagonalFallback), 0.0, 0.42);
|
||||
outColor = vec4(weight, normal.x * 0.5 + 0.5, normal.y * 0.5 + 0.5, 1.0);
|
||||
vec2 pixcoord;
|
||||
vec4 offset[3];
|
||||
SMAABlendingWeightCalculationVS(fragTexCoord, pixcoord, offset);
|
||||
outColor = SMAABlendingWeightCalculationPS(fragTexCoord, pixcoord, offset, EdgeTexture,
|
||||
AreaTexture, SearchTexture, vec4(0.0));
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -22,6 +22,7 @@
|
||||
#include "smaa_edge_frag.h"
|
||||
#include "smaa_weights_frag.h"
|
||||
#include "smaa_blend_frag.h"
|
||||
#include "smaa_tables.h"
|
||||
#include "toon_frag.h"
|
||||
#include "toon_color_frag.h"
|
||||
#include "hdr_frag.h"
|
||||
@@ -196,6 +197,7 @@ struct pc_sgsr { float ndc[4]; float vp[4]; float edge; };
|
||||
struct pc_easu { float ndc[4]; uint32_t con0[4], con1[4], con2[4], con3[4]; float outW, outH; };
|
||||
struct pc_rcas { float ndc[4]; uint32_t con[4]; float outW, outH; };
|
||||
struct pc_res { float ndc[4]; float res[2]; float extra; float pad; };
|
||||
struct pc_smaa { float ndc[4]; float metrics[4]; };
|
||||
struct pc_color { float ndc[4]; float b, c, g, s; };
|
||||
struct pc_toon_color {
|
||||
float ndc[4]; float res[2]; float b, c, g, s;
|
||||
@@ -230,7 +232,7 @@ static VkDevice g_dev;
|
||||
static VkPhysicalDevice g_pd;
|
||||
static VkPhysicalDeviceMemoryProperties g_mp;
|
||||
static int g_ready;
|
||||
static VkRenderPass g_rp, g_smaa_rp;
|
||||
static VkRenderPass g_rp, g_smaa_edge_rp, g_smaa_weights_rp;
|
||||
static VkDescriptorSetLayout g_dsl;
|
||||
static VkPipelineLayout g_pl;
|
||||
static VkDescriptorPool g_dpool;
|
||||
@@ -247,7 +249,9 @@ static int g_context;
|
||||
#define g_t (g_contexts[g_context].targets)
|
||||
#define g_mid (g_contexts[g_context].mid)
|
||||
#define g_nissrc (g_contexts[g_context].nissrc)
|
||||
static struct fx_target g_smaa_edges, g_smaa_weights;
|
||||
static struct fx_target g_smaa_edges, g_smaa_weights, g_smaa_area, g_smaa_search;
|
||||
static VkBuffer g_smaa_buf;
|
||||
static VkDeviceMemory g_smaa_mem;
|
||||
/* Half set: NIS = nis_luma prepass (scene rgb + luma in alpha, scene size) into g_nissrc, then
|
||||
* nis3 gathers its luma from that alpha, its coefficient banks (nis_coef.h) in a uniform buffer
|
||||
* at descriptor set 1 (g_pl_nis = {g_dsl, g_coef_dsl}, same push-constant range as g_pl).
|
||||
@@ -311,6 +315,7 @@ static void target_destroy(struct fx_target *t) {
|
||||
#define FX_TARGET_USAGE (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | \
|
||||
VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT)
|
||||
#define FX_SCRATCH_USAGE (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT)
|
||||
#define SMAA_EDGE_FORMAT VK_FORMAT_R8G8_UNORM
|
||||
|
||||
static int target_ensure_format(struct fx_target *t, int w, int h,
|
||||
VkImageUsageFlags usage, const char *what,
|
||||
@@ -318,8 +323,9 @@ static int target_ensure_format(struct fx_target *t, int w, int h,
|
||||
if (t->img && t->w == w && t->h == h) return 0;
|
||||
target_destroy(t);
|
||||
VkImageCreateInfo ii = {.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
|
||||
.flags = VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT, .imageType = VK_IMAGE_TYPE_2D,
|
||||
.format = format, .extent = {(uint32_t)w, (uint32_t)h, 1}, .mipLevels = 1,
|
||||
/* SMAA's own images need no views in other formats, and the GPU is faster without the flag. */
|
||||
.flags = render_pass == g_rp ? VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT : 0,
|
||||
.imageType = VK_IMAGE_TYPE_2D, .format = format, .extent = {(uint32_t)w, (uint32_t)h, 1}, .mipLevels = 1,
|
||||
.arrayLayers = 1, .samples = VK_SAMPLE_COUNT_1_BIT, .tiling = VK_IMAGE_TILING_OPTIMAL,
|
||||
.usage = usage,
|
||||
.sharingMode = VK_SHARING_MODE_EXCLUSIVE, .initialLayout = VK_IMAGE_LAYOUT_UNDEFINED};
|
||||
@@ -337,12 +343,16 @@ static int target_ensure_format(struct fx_target *t, int w, int h,
|
||||
(unsigned long long)req.size, (int)r);
|
||||
target_destroy(t); return -1;
|
||||
}
|
||||
g_vk.BindImageMemory(g_dev, t->img, t->mem, 0);
|
||||
r = g_vk.BindImageMemory(g_dev, t->img, t->mem, 0);
|
||||
if (r != VK_SUCCESS) {
|
||||
droiddeck_log("error", "effects: %s image %dx%d: vkBindImageMemory %d", what, w, h, (int)r);
|
||||
target_destroy(t); return -1;
|
||||
}
|
||||
if (!(t->view = make_view(t->img, format))) { target_destroy(t); return -1; }
|
||||
VkFramebufferCreateInfo fi = {.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, .renderPass = render_pass,
|
||||
.attachmentCount = 1, .pAttachments = &t->view, .width = (uint32_t)w,
|
||||
.height = (uint32_t)h, .layers = 1};
|
||||
if (g_vk.CreateFramebuffer(g_dev, &fi, NULL, &t->fb) != VK_SUCCESS) { target_destroy(t); return -1; }
|
||||
if (render_pass && g_vk.CreateFramebuffer(g_dev, &fi, NULL, &t->fb) != VK_SUCCESS) { target_destroy(t); return -1; }
|
||||
if (!(t->ds = alloc_ds(t->view))) { target_destroy(t); return -1; }
|
||||
t->w = w; t->h = h;
|
||||
return 0;
|
||||
@@ -461,6 +471,22 @@ static VkPipeline post_pipeline_for_renderpass(VkShaderModule vert,
|
||||
return p;
|
||||
}
|
||||
|
||||
/* The mapped memory of a new host-visible buffer. On failure: NULL, and the caller frees what there is. */
|
||||
static void *host_buffer(VkDeviceSize size, VkBufferUsageFlags usage, VkBuffer *buf, VkDeviceMemory *mem) {
|
||||
VkBufferCreateInfo bci = {.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, .size = size,
|
||||
.usage = usage, .sharingMode = VK_SHARING_MODE_EXCLUSIVE};
|
||||
if (g_vk.CreateBuffer(g_dev, &bci, NULL, buf) != VK_SUCCESS) return NULL;
|
||||
VkMemoryRequirements req;
|
||||
g_vk.GetBufferMemoryRequirements(g_dev, *buf, &req);
|
||||
int idx = memtype(req.memoryTypeBits, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT);
|
||||
if (idx < 0) return NULL;
|
||||
VkMemoryAllocateInfo mai = {.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, .allocationSize = req.size, .memoryTypeIndex = (uint32_t)idx};
|
||||
if (g_vk.AllocateMemory(g_dev, &mai, NULL, mem) != VK_SUCCESS) return NULL;
|
||||
if (g_vk.BindBufferMemory(g_dev, *buf, *mem, 0) != VK_SUCCESS) return NULL;
|
||||
void *p = NULL;
|
||||
return g_vk.MapMemory(g_dev, *mem, 0, size, 0, &p) == VK_SUCCESS ? p : NULL;
|
||||
}
|
||||
|
||||
static void coef_destroy(void) {
|
||||
if (g_coef_pool) g_vk.DestroyDescriptorPool(g_dev, g_coef_pool, NULL); /* frees g_coef_ds */
|
||||
if (g_coef_buf) g_vk.DestroyBuffer(g_dev, g_coef_buf, NULL);
|
||||
@@ -482,18 +508,8 @@ static int coef_create(void) {
|
||||
VkPipelineLayoutCreateInfo pli = {.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, .setLayoutCount = 2, .pSetLayouts = sets,
|
||||
.pushConstantRangeCount = 1, .pPushConstantRanges = &pcr};
|
||||
if (g_vk.CreatePipelineLayout(g_dev, &pli, NULL, &g_pl_nis) != VK_SUCCESS) goto fail;
|
||||
VkBufferCreateInfo bci = {.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, .size = 4096,
|
||||
.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, .sharingMode = VK_SHARING_MODE_EXCLUSIVE};
|
||||
if (g_vk.CreateBuffer(g_dev, &bci, NULL, &g_coef_buf) != VK_SUCCESS) goto fail;
|
||||
VkMemoryRequirements req;
|
||||
g_vk.GetBufferMemoryRequirements(g_dev, g_coef_buf, &req);
|
||||
int idx = memtype(req.memoryTypeBits, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT);
|
||||
if (idx < 0) goto fail;
|
||||
VkMemoryAllocateInfo mai = {.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, .allocationSize = req.size, .memoryTypeIndex = (uint32_t)idx};
|
||||
if (g_vk.AllocateMemory(g_dev, &mai, NULL, &g_coef_mem) != VK_SUCCESS) goto fail;
|
||||
if (g_vk.BindBufferMemory(g_dev, g_coef_buf, g_coef_mem, 0) != VK_SUCCESS) goto fail;
|
||||
void *p = NULL;
|
||||
if (g_vk.MapMemory(g_dev, g_coef_mem, 0, 4096, 0, &p) != VK_SUCCESS || !p) goto fail;
|
||||
void *p = host_buffer(4096, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, &g_coef_buf, &g_coef_mem);
|
||||
if (!p) goto fail;
|
||||
memcpy(p, kNisCoefScale, sizeof(kNisCoefScale));
|
||||
memcpy((char *)p + sizeof(kNisCoefScale), kNisCoefUsm, sizeof(kNisCoefUsm));
|
||||
g_vk.UnmapMemory(g_dev, g_coef_mem);
|
||||
@@ -513,6 +529,29 @@ fail:
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void smaa_tables_destroy(void) {
|
||||
target_destroy(&g_smaa_area); target_destroy(&g_smaa_search);
|
||||
if (g_smaa_buf) g_vk.DestroyBuffer(g_dev, g_smaa_buf, NULL);
|
||||
if (g_smaa_mem) g_vk.FreeMemory(g_dev, g_smaa_mem, NULL);
|
||||
g_smaa_buf = VK_NULL_HANDLE; g_smaa_mem = VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
static int smaa_tables_ensure(void) {
|
||||
if (g_smaa_buf) return 0;
|
||||
const VkImageUsageFlags usage = VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT;
|
||||
unsigned char *p = NULL;
|
||||
if (target_ensure_format(&g_smaa_area, SMAA_AREA_W, SMAA_AREA_H, usage, "SMAA area table",
|
||||
VK_FORMAT_R8G8_UNORM, VK_NULL_HANDLE) == 0 &&
|
||||
target_ensure_format(&g_smaa_search, SMAA_SEARCH_W, SMAA_SEARCH_H, usage, "SMAA search table",
|
||||
VK_FORMAT_R8_UNORM, VK_NULL_HANDLE) == 0)
|
||||
p = host_buffer(sizeof(kSmaaArea) + sizeof(kSmaaSearch), VK_BUFFER_USAGE_TRANSFER_SRC_BIT, &g_smaa_buf, &g_smaa_mem);
|
||||
if (!p) { smaa_tables_destroy(); return -1; }
|
||||
memcpy(p, kSmaaArea, sizeof(kSmaaArea));
|
||||
memcpy(p + sizeof(kSmaaArea), kSmaaSearch, sizeof(kSmaaSearch));
|
||||
g_vk.UnmapMemory(g_dev, g_smaa_mem);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* nis_luma keeps luma in the target's alpha: only formats with at least 8 alpha bits (not the
|
||||
* 2-bit alpha of the 10-bit HDR composition format) can hold it. */
|
||||
static int fx_alpha_holds_luma(VkFormat f) {
|
||||
@@ -540,16 +579,19 @@ static void objects_destroy(void) {
|
||||
}
|
||||
g_context = saved;
|
||||
target_destroy(&g_smaa_edges); target_destroy(&g_smaa_weights);
|
||||
smaa_tables_destroy();
|
||||
for (int i = 0; i < P_COUNT; i++) { if (g_pipe[i]) g_vk.DestroyPipeline(g_dev, g_pipe[i], NULL); g_pipe[i] = VK_NULL_HANDLE; }
|
||||
if (g_dpool) g_vk.DestroyDescriptorPool(g_dev, g_dpool, NULL);
|
||||
if (g_pl) g_vk.DestroyPipelineLayout(g_dev, g_pl, NULL);
|
||||
coef_destroy();
|
||||
if (g_dsl) g_vk.DestroyDescriptorSetLayout(g_dev, g_dsl, NULL);
|
||||
if (g_sampler) g_vk.DestroySampler(g_dev, g_sampler, NULL);
|
||||
if (g_smaa_rp) g_vk.DestroyRenderPass(g_dev, g_smaa_rp, NULL);
|
||||
if (g_smaa_edge_rp) g_vk.DestroyRenderPass(g_dev, g_smaa_edge_rp, NULL);
|
||||
if (g_smaa_weights_rp) g_vk.DestroyRenderPass(g_dev, g_smaa_weights_rp, NULL);
|
||||
if (g_rp) g_vk.DestroyRenderPass(g_dev, g_rp, NULL);
|
||||
g_dpool = VK_NULL_HANDLE; g_pl = VK_NULL_HANDLE; g_dsl = VK_NULL_HANDLE;
|
||||
g_sampler = VK_NULL_HANDLE; g_rp = VK_NULL_HANDLE; g_smaa_rp = VK_NULL_HANDLE;
|
||||
g_sampler = VK_NULL_HANDLE; g_rp = VK_NULL_HANDLE;
|
||||
g_smaa_edge_rp = VK_NULL_HANDLE; g_smaa_weights_rp = VK_NULL_HANDLE;
|
||||
g_nis_fast = 0; g_nis_attempted = 0; g_upscale_half = 0;
|
||||
g_ready = 0;
|
||||
}
|
||||
@@ -603,9 +645,12 @@ static int objects_ensure(void) {
|
||||
|
||||
VkAttachmentDescription smaa_att = att;
|
||||
smaa_att.format = FX_FORMAT;
|
||||
smaa_att.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; /* SMAA.hlsl discards pixels without an edge */
|
||||
VkRenderPassCreateInfo smaa_rci = rci;
|
||||
smaa_rci.pAttachments = &smaa_att;
|
||||
if (g_vk.CreateRenderPass(g_dev, &smaa_rci, NULL, &g_smaa_rp) != VK_SUCCESS) goto fail;
|
||||
if (g_vk.CreateRenderPass(g_dev, &smaa_rci, NULL, &g_smaa_weights_rp) != VK_SUCCESS) goto fail;
|
||||
smaa_att.format = SMAA_EDGE_FORMAT;
|
||||
if (g_vk.CreateRenderPass(g_dev, &smaa_rci, NULL, &g_smaa_edge_rp) != VK_SUCCESS) goto fail;
|
||||
|
||||
VkSamplerCreateInfo sci = {.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO, .magFilter = VK_FILTER_LINEAR,
|
||||
.minFilter = VK_FILTER_LINEAR, .mipmapMode = VK_SAMPLER_MIPMAP_MODE_NEAREST,
|
||||
@@ -619,13 +664,13 @@ static int objects_ensure(void) {
|
||||
VkDescriptorSetLayoutCreateInfo dli = {.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO, .bindingCount = 1, .pBindings = &b};
|
||||
if (g_vk.CreateDescriptorSetLayout(g_dev, &dli, NULL, &g_dsl) != VK_SUCCESS) goto fail;
|
||||
VkPushConstantRange pcr = {.stageFlags = VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT, .offset = 0, .size = PC_MAX_SIZE};
|
||||
VkDescriptorSetLayout set_layouts[2] = {g_dsl, g_dsl};
|
||||
VkPipelineLayoutCreateInfo pli = {.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, .setLayoutCount = 2, .pSetLayouts = set_layouts,
|
||||
VkDescriptorSetLayout set_layouts[3] = {g_dsl, g_dsl, g_dsl};
|
||||
VkPipelineLayoutCreateInfo pli = {.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, .setLayoutCount = 3, .pSetLayouts = set_layouts,
|
||||
.pushConstantRangeCount = 1, .pPushConstantRanges = &pcr};
|
||||
if (g_vk.CreatePipelineLayout(g_dev, &pli, NULL, &g_pl) != VK_SUCCESS) goto fail;
|
||||
VkDescriptorPoolSize ps = {VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, FX_CONTEXTS * 5 + 2};
|
||||
VkDescriptorPoolSize ps = {VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, FX_CONTEXTS * 5 + 4};
|
||||
VkDescriptorPoolCreateInfo dpi = {.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
|
||||
.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, .maxSets = FX_CONTEXTS * 5 + 2,
|
||||
.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, .maxSets = FX_CONTEXTS * 5 + 4,
|
||||
.poolSizeCount = 1, .pPoolSizes = &ps};
|
||||
if (g_vk.CreateDescriptorPool(g_dev, &dpi, NULL, &g_dpool) != VK_SUCCESS) goto fail;
|
||||
|
||||
@@ -712,8 +757,8 @@ static int pipelines_ensure(int spatial, const struct fx_settings *s) {
|
||||
if (s->color_on && !(s->toon && g_fx_fmt == FX_FORMAT)) MK(1, P_COLOR, color_code, "color");
|
||||
if (s->aa_mode == 1 || s->aa_mode == 2) MK(1, P_FXAA, fxaa_code, "fxaa");
|
||||
if (s->aa_mode == 2) {
|
||||
MKL(1, P_SMAA_EDGE, smaa_edge_code, "smaa_edge", g_smaa_rp, g_pl);
|
||||
MKL(1, P_SMAA_WEIGHTS, smaa_weights_code, "smaa_weights", g_smaa_rp, g_pl);
|
||||
MKL(1, P_SMAA_EDGE, smaa_edge_code, "smaa_edge", g_smaa_edge_rp, g_pl);
|
||||
MKL(1, P_SMAA_WEIGHTS, smaa_weights_code, "smaa_weights", g_smaa_weights_rp, g_pl);
|
||||
MK(1, P_SMAA_BLEND, smaa_blend_code, "smaa_blend");
|
||||
}
|
||||
if (s->toon && s->color_on && g_fx_fmt == FX_FORMAT) MK(1, P_TOON_COLOR, toon_color_code, "toon_color");
|
||||
@@ -742,14 +787,32 @@ static void barrier(VkCommandBuffer cmd, VkImage img, VkImageLayout from, VkImag
|
||||
g_vk.CmdPipelineBarrier(cmd, src_stage, dst_stage, 0, 0, NULL, 0, NULL, 1, &b);
|
||||
}
|
||||
|
||||
static void pass_renderpass(VkCommandBuffer cmd, VkRenderPass render_pass,
|
||||
VkPipeline p, struct fx_target *dst, VkDescriptorSet src,
|
||||
const void *pc, uint32_t pcsz) {
|
||||
/* The tables are copied into place in every frame: a recorded frame can be dropped before it is submitted. */
|
||||
static void smaa_tables_copy(VkCommandBuffer cmd) {
|
||||
const VkBufferImageCopy area = {.imageSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1},
|
||||
.imageExtent = {SMAA_AREA_W, SMAA_AREA_ROWS, 1}};
|
||||
const VkBufferImageCopy search = {.bufferOffset = sizeof(kSmaaArea), .imageSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1},
|
||||
.imageExtent = {SMAA_SEARCH_W, SMAA_SEARCH_H, 1}};
|
||||
const struct { VkImage img; const VkBufferImageCopy *copy; } t[2] = {{g_smaa_area.img, &area}, {g_smaa_search.img, &search}};
|
||||
for (int i = 0; i < 2; i++) {
|
||||
barrier(cmd, t[i].img, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
|
||||
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, 0, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_WRITE_BIT);
|
||||
g_vk.CmdCopyBufferToImage(cmd, g_smaa_buf, t[i].img, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, t[i].copy);
|
||||
barrier(cmd, t[i].img, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
|
||||
VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_WRITE_BIT,
|
||||
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, VK_ACCESS_SHADER_READ_BIT);
|
||||
}
|
||||
}
|
||||
|
||||
static void pass_sets(VkCommandBuffer cmd, VkRenderPass render_pass, VkPipeline p, struct fx_target *dst,
|
||||
const VkDescriptorSet *src, uint32_t count, const void *pc, uint32_t pcsz) {
|
||||
const VkClearValue clear = {0};
|
||||
VkRenderPassBeginInfo rpi = {.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, .renderPass = render_pass, .framebuffer = dst->fb,
|
||||
.renderArea = {{0, 0}, {(uint32_t)dst->w, (uint32_t)dst->h}}};
|
||||
.renderArea = {{0, 0}, {(uint32_t)dst->w, (uint32_t)dst->h}},
|
||||
.clearValueCount = 1, .pClearValues = &clear};
|
||||
g_vk.CmdBeginRenderPass(cmd, &rpi, VK_SUBPASS_CONTENTS_INLINE);
|
||||
g_vk.CmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, p);
|
||||
g_vk.CmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, g_pl, 0, 1, &src, 0, NULL);
|
||||
g_vk.CmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, g_pl, 0, count, src, 0, NULL);
|
||||
if (g_nis_fast && p == g_pipe[P_NIS] && g_coef_ds) /* nis3: coefficient banks at set 1 */
|
||||
g_vk.CmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, g_pl_nis, 1, 1, &g_coef_ds, 0, NULL);
|
||||
g_vk.CmdPushConstants(cmd, g_pl, VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT, 0, pcsz, pc);
|
||||
@@ -759,21 +822,7 @@ static void pass_renderpass(VkCommandBuffer cmd, VkRenderPass render_pass,
|
||||
|
||||
static void pass(VkCommandBuffer cmd, VkPipeline p, struct fx_target *dst,
|
||||
VkDescriptorSet src, const void *pc, uint32_t pcsz) {
|
||||
pass_renderpass(cmd, g_rp, p, dst, src, pc, pcsz);
|
||||
}
|
||||
|
||||
static void pass_dual(VkCommandBuffer cmd, VkPipeline p, struct fx_target *dst,
|
||||
VkDescriptorSet src, VkDescriptorSet second,
|
||||
const void *pc, uint32_t pcsz) {
|
||||
VkRenderPassBeginInfo rpi = {.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, .renderPass = g_rp, .framebuffer = dst->fb,
|
||||
.renderArea = {{0, 0}, {(uint32_t)dst->w, (uint32_t)dst->h}}};
|
||||
VkDescriptorSet sets[2] = {src, second};
|
||||
g_vk.CmdBeginRenderPass(cmd, &rpi, VK_SUBPASS_CONTENTS_INLINE);
|
||||
g_vk.CmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, p);
|
||||
g_vk.CmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, g_pl, 0, 2, sets, 0, NULL);
|
||||
g_vk.CmdPushConstants(cmd, g_pl, VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT, 0, pcsz, pc);
|
||||
g_vk.CmdDraw(cmd, 4, 1, 0, 0);
|
||||
g_vk.CmdEndRenderPass(cmd);
|
||||
pass_sets(cmd, g_rp, p, dst, &src, 1, pc, pcsz);
|
||||
}
|
||||
|
||||
static const float FULL_NDC[4] = {-1.0f, -1.0f, 1.0f, 1.0f};
|
||||
@@ -785,6 +834,12 @@ struct fx_source_state {
|
||||
VkAccessFlags access;
|
||||
};
|
||||
|
||||
/* NIS here is the SDR implementation and is documented for <=2x upscales: other outputs run FSR instead. */
|
||||
static int nis_falls_back(int scene_w, int scene_h, int cw, int ch) {
|
||||
return g_scene_is_pq || cw < scene_w || ch < scene_h || (double)cw > (double)scene_w * 2.0 ||
|
||||
(double)ch > (double)scene_h * 2.0;
|
||||
}
|
||||
|
||||
static VkImage effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int scene_h,
|
||||
int out_w, int out_h, int *res_w, int *res_h,
|
||||
VkImageLayout input_layout, const struct fx_settings *frozen,
|
||||
@@ -810,11 +865,7 @@ static VkImage effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int
|
||||
const int upscaling = cw > scene_w || ch > scene_h;
|
||||
int spatial = 0;
|
||||
if (spatial_mode(s->scaling) && (s->scaling == 6 || upscaling)) spatial = s->scaling;
|
||||
/* NIS here is the SDR implementation and is documented for <=2x upscales. */
|
||||
const int nis_fallback = spatial == 7 &&
|
||||
(g_scene_is_pq || cw < scene_w || ch < scene_h ||
|
||||
(double)cw > (double)scene_w * 2.0 ||
|
||||
(double)ch > (double)scene_h * 2.0);
|
||||
const int nis_fallback = spatial == 7 && nis_falls_back(scene_w, scene_h, cw, ch);
|
||||
static int last_nis_fallback = 0;
|
||||
const int was_nis_fallback =
|
||||
__atomic_exchange_n(&last_nis_fallback, nis_fallback, __ATOMIC_RELAXED);
|
||||
@@ -839,9 +890,10 @@ static VkImage effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int
|
||||
target_ensure(&g_mid, cw, ch, FX_SCRATCH_USAGE, "EASU") == 0)) {
|
||||
if (s->aa_mode == 2 &&
|
||||
(target_ensure_format(&g_smaa_edges, cw, ch, FX_SCRATCH_USAGE,
|
||||
"SMAA edges", FX_FORMAT, g_smaa_rp) != 0 ||
|
||||
"SMAA edges", SMAA_EDGE_FORMAT, g_smaa_edge_rp) != 0 ||
|
||||
target_ensure_format(&g_smaa_weights, cw, ch, FX_SCRATCH_USAGE,
|
||||
"SMAA weights", FX_FORMAT, g_smaa_rp) != 0)) {
|
||||
"SMAA weights", FX_FORMAT, g_smaa_weights_rp) != 0 ||
|
||||
smaa_tables_ensure() != 0)) {
|
||||
droiddeck_log("error", "effects: SMAA scratch allocation failed; falling back to FXAA");
|
||||
snapshot.aa_mode = 1;
|
||||
s = &snapshot;
|
||||
@@ -969,14 +1021,17 @@ static VkImage effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int
|
||||
switch (order[i]) {
|
||||
case FX_FXAA: pass(cmd, g_pipe[P_FXAA], dst, cur_ds, &pr, sizeof(pr)); break;
|
||||
case FX_FXAA_TOON: pass(cmd, g_pipe[P_FXAA_TOON], dst, cur_ds, &pr, sizeof(pr)); break;
|
||||
case FX_SMAA:
|
||||
pass_renderpass(cmd, g_smaa_rp, g_pipe[P_SMAA_EDGE],
|
||||
&g_smaa_edges, cur_ds, &pr, sizeof(pr));
|
||||
pass_renderpass(cmd, g_smaa_rp, g_pipe[P_SMAA_WEIGHTS],
|
||||
&g_smaa_weights, g_smaa_edges.ds, &pr, sizeof(pr));
|
||||
pass_dual(cmd, g_pipe[P_SMAA_BLEND], dst, cur_ds,
|
||||
g_smaa_weights.ds, &pr, sizeof(pr));
|
||||
case FX_SMAA: {
|
||||
struct pc_smaa pc = {.metrics = {1.0f / (float)cw, 1.0f / (float)ch, (float)cw, (float)ch}};
|
||||
const VkDescriptorSet weigh[3] = {g_smaa_edges.ds, g_smaa_area.ds, g_smaa_search.ds};
|
||||
const VkDescriptorSet blend[2] = {cur_ds, g_smaa_weights.ds};
|
||||
SET_NDC(pc);
|
||||
smaa_tables_copy(cmd);
|
||||
pass_sets(cmd, g_smaa_edge_rp, g_pipe[P_SMAA_EDGE], &g_smaa_edges, &cur_ds, 1, &pc, sizeof(pc));
|
||||
pass_sets(cmd, g_smaa_weights_rp, g_pipe[P_SMAA_WEIGHTS], &g_smaa_weights, weigh, 3, &pc, sizeof(pc));
|
||||
pass_sets(cmd, g_rp, g_pipe[P_SMAA_BLEND], dst, blend, 2, &pc, sizeof(pc));
|
||||
break;
|
||||
}
|
||||
case FX_TOON: pass(cmd, g_pipe[P_TOON], dst, cur_ds, &pr, sizeof(pr)); break;
|
||||
case FX_TOON_COLOR: {
|
||||
struct pc_toon_color pc = {0};
|
||||
@@ -1037,13 +1092,23 @@ VkImage vkp_effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int sce
|
||||
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, NULL, NULL);
|
||||
}
|
||||
|
||||
int vkp_effects_prepare_generated(void) {
|
||||
int vkp_effects_prepare_generated(int in_w, int in_h, int out_w, int out_h) {
|
||||
vkp_effects_sync();
|
||||
pthread_mutex_lock(&g_lock);
|
||||
g_generated_settings = g_cur;
|
||||
pthread_mutex_unlock(&g_lock);
|
||||
return spatial_mode(g_generated_settings.scaling) && g_generated_settings.scaling != 6 &&
|
||||
effect_count(&g_generated_settings) == 0;
|
||||
int spatial = g_generated_settings.scaling;
|
||||
if (!spatial_mode(spatial) || spatial == 6 || effect_count(&g_generated_settings) != 0) return 0;
|
||||
/* Build the spatial filter's pipelines now, before frame generation records commands that sample the
|
||||
* chain's views: one failing later in the same pass would tear the chain down (chain_failed) under a
|
||||
* recorded command buffer. Build only what effects_run will use for this output, as it decides it:
|
||||
* NIS on an output it hands to FSR builds FSR, so a NIS that cannot build here costs nothing. */
|
||||
int cw = out_w > FX_MAX_DIM ? FX_MAX_DIM : out_w < 1 ? 1 : out_w;
|
||||
int ch = out_h > FX_MAX_DIM ? FX_MAX_DIM : out_h < 1 ? 1 : out_h;
|
||||
if (cw <= in_w && ch <= in_h) return 1; /* clamped, it no longer upscales: effects_run builds no filter */
|
||||
if (spatial == 7 && nis_falls_back(in_w, in_h, cw, ch)) spatial = 4;
|
||||
if (objects_ensure() != 0 || pipelines_ensure(spatial, &g_generated_settings) != 0) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
VkImage vkp_effects_run_before_generated(VkCommandBuffer cmd, VkImage scene, int w, int h,
|
||||
|
||||
@@ -18,7 +18,7 @@ VkFilter vkp_effects_blit_filter(void);
|
||||
|
||||
VkImage vkp_effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int scene_h,
|
||||
int out_w, int out_h, int *res_w, int *res_h);
|
||||
int vkp_effects_prepare_generated(void);
|
||||
int vkp_effects_prepare_generated(int in_w, int in_h, int out_w, int out_h);
|
||||
void vkp_effects_release_generated_sources(void);
|
||||
VkImage vkp_effects_run_before_generated(VkCommandBuffer cmd, VkImage scene, int w, int h,
|
||||
int *res_w, int *res_h);
|
||||
|
||||
@@ -113,6 +113,7 @@ static int g_layer_path;
|
||||
static int g_out_gens;
|
||||
static int64_t g_out_planned[VKP_FG_MAX_GENERATIONS + 1];
|
||||
static int64_t g_completion_issue;
|
||||
static int g_paced_route = 1;
|
||||
|
||||
void vkp_framegen_set_pacer(int on) {
|
||||
if (atomic_exchange(&g_pacer_on, on ? 1 : 0) != (on ? 1 : 0)) {
|
||||
@@ -178,6 +179,17 @@ void vkp_framegen_set_layer_timing(int layer) {
|
||||
fge_set_layer_timing(layer);
|
||||
}
|
||||
|
||||
void vkp_framegen_set_paced_route(int composed) {
|
||||
composed = composed != 0;
|
||||
if (composed == g_paced_route) return;
|
||||
g_paced_route = composed;
|
||||
if (atomic_load(&g_pacer_on)) {
|
||||
fge_pacer_reset();
|
||||
FGLOG("ZeroPacer %s", composed ? "times the layer's frames again (composed route)"
|
||||
: "waits: the direct route presents the real frame on its own timing");
|
||||
}
|
||||
}
|
||||
|
||||
void vkp_framegen_set_tuning(float flow_scale, float refresh_hz) {
|
||||
if (flow_scale < 0.25f) flow_scale = 0.25f;
|
||||
if (flow_scale > 1.0f) flow_scale = 1.0f;
|
||||
@@ -517,7 +529,7 @@ int vkp_framegen_run(VkCommandBuffer cmd, VkImage scene, VkImageView scene_view,
|
||||
}
|
||||
}
|
||||
fge_set_phases(NULL, 0);
|
||||
if (kind == VKP_FG_ENGINE_ZEROFG && pacer_wanted() && g_layer_path) {
|
||||
if (kind == VKP_FG_ENGINE_ZEROFG && pacer_wanted() && g_layer_path && g_paced_route) {
|
||||
int64_t vsync = 0, period = 0;
|
||||
sc_layer_timeline(&vsync, &period);
|
||||
int64_t planned[VKP_FG_MAX_GENERATIONS + 1];
|
||||
|
||||
@@ -30,6 +30,9 @@ int vkp_framegen_extra_images(void);
|
||||
void vkp_framegen_set_layer_timing(int layer);
|
||||
/* ZeroFG's pacer (include/zerofg/inline_pacer.h) times the layer's frames instead of the layer's own spacing. */
|
||||
void vkp_framegen_set_pacer(int on);
|
||||
/* 1 when the layer pass presents the real frame itself after its generated frames (the composed route): only
|
||||
* then can the pacer time the whole group. The direct route keeps the layer's own timing. */
|
||||
void vkp_framegen_set_paced_route(int composed);
|
||||
/* Reset pacing history when a planned real-frame pair is aborted before presentation. */
|
||||
void vkp_framegen_pacer_abort(void);
|
||||
/* Refresh planned for output k of the last run (k == gens: its real frame; 0: use layer timing). */
|
||||
|
||||
@@ -55,6 +55,15 @@ VkImage g_current = VK_NULL_HANDLE;
|
||||
VkImageView g_current_view = VK_NULL_HANDLE;
|
||||
uint64_t g_current_sequence = 0;
|
||||
bool g_pair_pending = false;
|
||||
// The interpolator keeps per-pair work and the prepared Real by sequence. A pass dropped after recording
|
||||
// Interpolate never ran on the GPU, so the next pair's A gets a fresh identity no record has seen: nothing the
|
||||
// dropped pass would have prepared is reused, nor its flow start. The identity is stable for the whole pair, so
|
||||
// its phases still share their work (and ReallyZero sees one pair, not a first picture per phase).
|
||||
bool g_interpolate_uncommitted = false;
|
||||
bool g_record_stale = false;
|
||||
uint64_t g_pair_anonymous = 0; // the recovery pair's A identity, 0 for an ordinary pair
|
||||
uint64_t g_anonymous_count = 0;
|
||||
constexpr uint64_t kAnonymousSequence = 1ull << 63; // above any frame sequence the compositor hands out
|
||||
|
||||
// Pacing. The compositor presents a pair's generated frames and its real frame back to back in FIFO,
|
||||
// so they reach the panel on consecutive refreshes right after the tick that drew them.
|
||||
@@ -475,6 +484,9 @@ int zfg_prepare(uint32_t width, uint32_t height, VkFormat format) {
|
||||
return 0;
|
||||
}
|
||||
if (g_width == width && g_height == height && g_format == format && g_history) return 1;
|
||||
// ReallyZero's Resize accepts 64..16384 per side: refuse this frame only, before touching the
|
||||
// engine's state, so a supported size later still generates.
|
||||
if (width < 64 || height < 64 || width > 16384 || height > 16384) return 0;
|
||||
if (g_DeviceWaitIdle) g_DeviceWaitIdle(g_device);
|
||||
destroy_history();
|
||||
const zerofg::Status resized = g_interpolator->Resize(width, height, format, format);
|
||||
@@ -540,6 +552,8 @@ void zfg_process(VkCommandBuffer cmd, VkImage source, VkImageView source_view,
|
||||
g_current_view = source_view;
|
||||
g_current_sequence = sequence;
|
||||
g_pair_pending = true;
|
||||
g_pair_anonymous = g_record_stale ? (kAnonymousSequence | ++g_anonymous_count) : 0;
|
||||
g_record_stale = false;
|
||||
}
|
||||
|
||||
void zfg_generate(VkCommandBuffer cmd, uint32_t index, uint32_t count,
|
||||
@@ -564,6 +578,8 @@ void zfg_generate(VkCommandBuffer cmd, uint32_t index, uint32_t count,
|
||||
result.width = width; result.height = height;
|
||||
result.usage = VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT |
|
||||
VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT;
|
||||
if (g_pair_anonymous) previous.sequence = g_pair_anonymous;
|
||||
g_interpolate_uncommitted = true;
|
||||
|
||||
const zerofg::Status status =
|
||||
g_interpolator->Interpolate(cmd, index, previous, current, phase, result);
|
||||
@@ -579,6 +595,7 @@ void zfg_generate(VkCommandBuffer cmd, uint32_t index, uint32_t count,
|
||||
}
|
||||
|
||||
void zfg_commit_history_update(void) {
|
||||
g_interpolate_uncommitted = false;
|
||||
if (!g_history_recorded_pending) return;
|
||||
g_history_layout_defined = true;
|
||||
g_history_valid = true;
|
||||
@@ -589,10 +606,15 @@ void zfg_commit_history_update(void) {
|
||||
void zfg_discard_history_update(void) {
|
||||
g_history_recorded_pending = false;
|
||||
g_history_recorded_sequence = 0;
|
||||
if (g_interpolate_uncommitted) g_record_stale = true;
|
||||
g_interpolate_uncommitted = false;
|
||||
g_pair_pending = false;
|
||||
}
|
||||
|
||||
void zfg_forget_targets(void) {
|
||||
g_pair_pending = false;
|
||||
if (g_interpolate_uncommitted) g_record_stale = true;
|
||||
g_interpolate_uncommitted = false;
|
||||
g_history_recorded_pending = false;
|
||||
g_history_recorded_sequence = 0;
|
||||
g_history_valid = false;
|
||||
|
||||
@@ -1138,6 +1138,7 @@ int sc_layer_present_generated(const struct vkp_draw *draws, int n_draws, const
|
||||
if (vkp_update_map(scene_w, scene_h) != 0) return -1;
|
||||
const int deep = hf && !hf->tonemap;
|
||||
if (hf) composed = 1;
|
||||
vkp_framegen_set_paced_route(composed);
|
||||
if (hf && hf->tonemap) color = NULL;
|
||||
int n = vkp_pass_begin_generate(scene_w, scene_h, draws, n_draws, hf, &rw, &rh);
|
||||
if (n < 0) return -1;
|
||||
|
||||
@@ -2769,8 +2769,8 @@ static int render_impl(int scene_w, int scene_h, const struct vkp_draw *draws, i
|
||||
const int upscale_w = (int)(scene_w * g_map.kx + 0.5f);
|
||||
const int upscale_h = (int)(scene_h * g_map.ky + 0.5f);
|
||||
const int post_upscale = fx && fg && !hf && !cb && vkp_effects_upscaling() &&
|
||||
vkp_effects_prepare_generated() &&
|
||||
(upscale_w > input_w || upscale_h > input_h);
|
||||
(upscale_w > input_w || upscale_h > input_h) &&
|
||||
vkp_effects_prepare_generated(input_w, input_h, upscale_w, upscale_h);
|
||||
if (post_upscale) {
|
||||
static int last_input_w, last_input_h, last_output_w, last_output_h;
|
||||
if (input_w != last_input_w || input_h != last_input_h ||
|
||||
@@ -3545,7 +3545,8 @@ static int pass_begin_impl(int scene_w, int scene_h, const struct vkp_draw *draw
|
||||
|
||||
int mapped_w = (int)(scene_w * g_map.kx + 0.5f), mapped_h = (int)(scene_h * g_map.ky + 0.5f);
|
||||
g_pass.post_upscale = generate && !hf && vkp_effects_active() && vkp_effects_upscaling() &&
|
||||
vkp_effects_prepare_generated() && (mapped_w > input_w || mapped_h > input_h);
|
||||
(mapped_w > input_w || mapped_h > input_h) &&
|
||||
vkp_effects_prepare_generated(input_w, input_h, mapped_w, mapped_h);
|
||||
if (g_pass.post_upscale) {
|
||||
static int last_input_w, last_input_h, last_output_w, last_output_h;
|
||||
if (input_w != last_input_w || input_h != last_input_h || mapped_w != last_output_w || mapped_h != last_output_h) {
|
||||
|
||||
@@ -52,6 +52,7 @@ import com.droiddeck.launcher.ui.ComponentsPage
|
||||
import com.droiddeck.launcher.session.GameSaves
|
||||
import com.droiddeck.launcher.session.SessionLogShare
|
||||
import com.droiddeck.launcher.session.SessionPaths
|
||||
import com.droiddeck.launcher.session.FullscreenMode
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import com.droiddeck.launcher.session.SteamRepair
|
||||
import com.droiddeck.launcher.session.LaunchCoordinator
|
||||
@@ -190,9 +191,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
private var gamescopeRealtime by mutableStateOf(false)
|
||||
private var paceCores by mutableStateOf(true)
|
||||
private var gpuClockPin by mutableStateOf(false)
|
||||
private var prootNoSeccomp by mutableStateOf(false)
|
||||
private var prootFastPath by mutableStateOf(true)
|
||||
private var nativeUserland by mutableStateOf(true)
|
||||
private var desktopAsUser by mutableStateOf(false)
|
||||
private var cursorComposite by mutableStateOf(true)
|
||||
private var guestHostname by mutableStateOf(SessionPrefs.DEFAULT_GUEST_HOSTNAME)
|
||||
@@ -208,7 +206,8 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
private var orientation by mutableStateOf(android.content.pm.ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE)
|
||||
private var launcherOrientation by mutableStateOf(android.content.pm.ActivityInfo.SCREEN_ORIENTATION_USER)
|
||||
private var homePage by mutableStateOf(com.droiddeck.launcher.core.AppUiPrefs.HOME_PAGE_STEAM)
|
||||
private var launcherFullscreen by mutableStateOf(true)
|
||||
private var launcherFullscreenMode by mutableStateOf(FullscreenMode.ALWAYS)
|
||||
private var sessionFullscreenMode by mutableStateOf(FullscreenMode.ALWAYS)
|
||||
private var launcherFrost by mutableStateOf(false)
|
||||
private var frostWallpaper by mutableStateOf(true)
|
||||
private var frostCards by mutableStateOf(true)
|
||||
@@ -1366,8 +1365,12 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
orientation = SessionPrefs.orientation(this)
|
||||
launcherOrientation = com.droiddeck.launcher.core.AppUiPrefs.orientation(this)
|
||||
requestedOrientation = launcherOrientation
|
||||
launcherFullscreenMode = SessionPrefs.launcherFullscreenMode(this)
|
||||
sessionFullscreenMode = SessionPrefs.sessionFullscreenMode(this)
|
||||
applyLauncherFullscreen()
|
||||
homePage = com.droiddeck.launcher.core.AppUiPrefs.homePage(this)
|
||||
launcherFullscreen = SessionPrefs.launcherFullscreen(this)
|
||||
launcherFullscreenMode = SessionPrefs.launcherFullscreenMode(this)
|
||||
sessionFullscreenMode = SessionPrefs.sessionFullscreenMode(this)
|
||||
launcherFrost = SessionPrefs.launcherFrost(this)
|
||||
frostWallpaper = SessionPrefs.frostWallpaper(this)
|
||||
frostCards = SessionPrefs.frostCards(this)
|
||||
@@ -1482,7 +1485,8 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
orientation = orientation,
|
||||
launcherOrientation = launcherOrientation,
|
||||
homePage = homePage,
|
||||
launcherFullscreen = launcherFullscreen,
|
||||
launcherFullscreenMode = launcherFullscreenMode,
|
||||
sessionFullscreenMode = sessionFullscreenMode,
|
||||
launcherFrost = launcherFrost,
|
||||
frostWallpaper = frostWallpaper,
|
||||
frostCards = frostCards,
|
||||
@@ -1758,13 +1762,14 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
}
|
||||
}, "delete-session-logs").start()
|
||||
},
|
||||
onClearLogs = {
|
||||
onClearLogs = { done ->
|
||||
Thread({
|
||||
val cleared = runCatching { SessionArtifacts.clearAll(this) }.getOrDefault(0)
|
||||
ui.post {
|
||||
android.widget.Toast.makeText(this,
|
||||
if (cleared == 0) getString(R.string.main_no_logs_to_clear) else resources.getQuantityString(R.plurals.main_logs_cleared, cleared, cleared),
|
||||
android.widget.Toast.LENGTH_SHORT).show()
|
||||
done()
|
||||
}
|
||||
}, "clear-logs").start()
|
||||
},
|
||||
@@ -1816,11 +1821,15 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
homePage = value
|
||||
},
|
||||
onControllerHaptics = { on -> SessionPrefs.setControllerHaptics(this, on); controllerHaptics = on },
|
||||
onLauncherFullscreen = { on ->
|
||||
SessionPrefs.setLauncherFullscreen(this, on)
|
||||
launcherFullscreen = on
|
||||
onLauncherFullscreenMode = { mode ->
|
||||
SessionPrefs.setLauncherFullscreenMode(this, mode)
|
||||
launcherFullscreenMode = mode
|
||||
applyLauncherFullscreen()
|
||||
},
|
||||
onSessionFullscreenMode = { mode ->
|
||||
SessionPrefs.setSessionFullscreenMode(this, mode)
|
||||
sessionFullscreenMode = mode
|
||||
},
|
||||
onLauncherFrost = { on ->
|
||||
SessionPrefs.setLauncherFrost(this, on)
|
||||
launcherFrost = on
|
||||
@@ -2152,7 +2161,13 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
private fun frostShown(): Boolean =
|
||||
launcherFrost && frostWallpaper && frost.prepared && frost.available && theme != com.droiddeck.launcher.ui.Themes.TRUE_BLACK
|
||||
|
||||
private fun applyLauncherFullscreen() {
|
||||
override fun onConfigurationChanged(newConfig: android.content.res.Configuration) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
applyLauncherFullscreen(newConfig)
|
||||
}
|
||||
|
||||
private fun applyLauncherFullscreen(config: android.content.res.Configuration = resources.configuration) {
|
||||
val launcherFullscreen = launcherFullscreenMode.hidesSystemBars(config.orientation)
|
||||
@Suppress("DEPRECATION")
|
||||
window.decorView.systemUiVisibility = if (launcherFullscreen) {
|
||||
(View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
||||
@@ -3107,7 +3122,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
fsyncFirst = fsyncFirst,
|
||||
gamescopeRealtime = gamescopeRealtime,
|
||||
gpuClockPin = gpuClockPin,
|
||||
prootNoSeccomp = prootNoSeccomp, prootFastPath = prootFastPath, nativeUserland = nativeUserland, desktopAsUser = desktopAsUser, cursorComposite = cursorComposite,
|
||||
nativeDesktopAvailable = com.droiddeck.launcher.runtime.NativeGuest.nextSession(this), desktopAsUser = desktopAsUser, cursorComposite = cursorComposite,
|
||||
guestHostname = guestHostname, phantomWarning = phantomWarning,
|
||||
onClientOverride = { on -> SessionPrefs.setClientCpusOverride(this, on); clientOverride = on },
|
||||
onPaceCores = { on -> SessionPrefs.setPaceCores(this, on); paceCores = on },
|
||||
@@ -3121,9 +3136,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
onFsyncFirst = { on -> SessionPrefs.setFsyncFirst(this, on); fsyncFirst = on },
|
||||
onGamescopeRealtime = { on -> SessionPrefs.setGamescopeRealtime(this, on); gamescopeRealtime = on },
|
||||
onGpuClockPin = { on -> SessionPrefs.setGpuClockPin(this, on); gpuClockPin = on },
|
||||
onProotNoSeccomp = { on -> SessionPrefs.setProotNoSeccomp(this, on); prootNoSeccomp = on },
|
||||
onProotFastPath = { on -> SessionPrefs.setProotFastPath(this, on); prootFastPath = on },
|
||||
onNativeUserland = { on -> SessionPrefs.setNativeUserland(this, on); nativeUserland = on },
|
||||
onDesktopAsUser = { on -> SessionPrefs.setDesktopAsUser(this, on); desktopAsUser = on },
|
||||
onCursorComposite = { on -> SessionPrefs.setCursorComposite(this, on); cursorComposite = on },
|
||||
onGuestHostname = { name -> SessionPrefs.setGuestHostname(this, name) },
|
||||
@@ -3446,9 +3458,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
gamescopeRealtime = SessionPrefs.gamescopeRealtime(this)
|
||||
paceCores = SessionPrefs.paceCores(this)
|
||||
gpuClockPin = SessionPrefs.gpuClockPin(this)
|
||||
prootNoSeccomp = SessionPrefs.prootNoSeccomp(this)
|
||||
prootFastPath = SessionPrefs.prootFastPath(this)
|
||||
nativeUserland = SessionPrefs.nativeUserland(this)
|
||||
desktopAsUser = SessionPrefs.desktopAsUser(this)
|
||||
cursorComposite = SessionPrefs.cursorComposite(this)
|
||||
guestHostname = SessionPrefs.guestHostname(this)
|
||||
|
||||
@@ -45,6 +45,7 @@ internal class ProtonMenu(
|
||||
var experimentalReleases by Operation.experimentalReleases
|
||||
companion object {
|
||||
const val EXPERIMENTAL = "experimental"
|
||||
private val REMEMBERED = setOf(ProtonExtras.OWN, ProtonExtras.ANTICHEAT)
|
||||
}
|
||||
@VisibleForTesting internal var latestCheck: (Boolean) -> Boolean = { force -> ProtonExtras.checkLatest(activity, force) }
|
||||
@VisibleForTesting internal var experimentalRefresh: () -> List<ExperimentalProtons.Release>? = { ExperimentalProtons.refresh(activity) }
|
||||
@@ -66,7 +67,7 @@ internal class ProtonMenu(
|
||||
ui.post { protonStage = label; protonPercent = value }
|
||||
}
|
||||
}.getOrElse { it.message ?: it.javaClass.simpleName }
|
||||
if (problem == null && !automatic && tool.id == ProtonExtras.OWN) ProtonExtras.setDeclined(activity, false)
|
||||
if (problem == null && !automatic && tool.id in REMEMBERED) ProtonExtras.setDeclined(activity, false, tool.id)
|
||||
if (tool.id == ProtonExtras.OWN) {
|
||||
if (problem == null) Onboarding.finish(Onboarding.Step.PROTON) else Onboarding.fail(Onboarding.Step.PROTON, problem)
|
||||
Onboarding.recheck(activity)
|
||||
@@ -96,7 +97,7 @@ internal class ProtonMenu(
|
||||
protonPercent = -1
|
||||
Thread({
|
||||
if (older) ProtonExtras.removeOlder(activity, tool) else ProtonExtras.remove(activity, tool, dir)
|
||||
if (tool.id == ProtonExtras.OWN && ProtonExtras.installedAll(activity, tool).isEmpty()) ProtonExtras.setDeclined(activity, true)
|
||||
if (tool.id in REMEMBERED && ProtonExtras.installedAll(activity, tool).isEmpty()) ProtonExtras.setDeclined(activity, true, tool.id)
|
||||
ui.post {
|
||||
protonBusyId = null
|
||||
protonStage = null
|
||||
@@ -158,7 +159,7 @@ internal class ProtonMenu(
|
||||
refreshExperimental()
|
||||
protonRows = ProtonExtras.offered(activity).map {
|
||||
val all = ProtonExtras.installedAll(activity, it)
|
||||
ProtonRow(it.id, it.name, all.lastOrNull(), ProtonExtras.queued(activity, it), all, ProtonExtras.update(activity, it))
|
||||
ProtonRow(it.id, if (it.label != 0) activity.getString(it.label) else it.name, all.lastOrNull(), ProtonExtras.queued(activity, it), all, ProtonExtras.update(activity, it))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@ import com.droiddeck.launcher.input.InputProfiles
|
||||
import com.droiddeck.launcher.input.InputProfile
|
||||
import com.droiddeck.launcher.input.InputAction
|
||||
import com.droiddeck.launcher.input.InputRole
|
||||
import com.droiddeck.launcher.input.boundedInputGameKey
|
||||
import com.droiddeck.launcher.input.InputControl
|
||||
import com.droiddeck.launcher.input.InputMotion
|
||||
import com.droiddeck.launcher.input.HeldInput
|
||||
@@ -100,6 +101,12 @@ import com.droiddeck.launcher.input.SteamControllerBle
|
||||
import com.droiddeck.launcher.input.DirectTouchHold
|
||||
import com.droiddeck.launcher.input.GestureTouchStreamGate
|
||||
import com.droiddeck.launcher.input.PenRouter
|
||||
import com.droiddeck.launcher.input.AirTrigger
|
||||
import com.droiddeck.launcher.input.AirTriggerButtons
|
||||
import com.droiddeck.launcher.input.AirTriggerInput
|
||||
import com.droiddeck.launcher.input.AirTriggerPrefs
|
||||
import com.droiddeck.launcher.input.AirTriggerSetup
|
||||
import com.droiddeck.launcher.input.RedMagicAirTriggers
|
||||
import com.droiddeck.launcher.input.PenStream
|
||||
import com.droiddeck.launcher.input.PointerGestures
|
||||
import com.droiddeck.launcher.input.PointerSpace
|
||||
@@ -122,6 +129,7 @@ import com.droiddeck.launcher.session.GpuClockPin
|
||||
import com.droiddeck.launcher.session.GameProfileFollowState
|
||||
import com.droiddeck.launcher.session.GameProfileInventoryCache
|
||||
import com.droiddeck.launcher.session.GameProfileRefreshState
|
||||
import com.droiddeck.launcher.session.FullscreenMode
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import com.droiddeck.launcher.session.SessionEvents
|
||||
import com.droiddeck.launcher.session.SessionArtifacts
|
||||
@@ -241,7 +249,13 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private lateinit var sessionRoot: FrameLayout
|
||||
private var inputRouter: InputRouter? = null
|
||||
private var physicalInputBindings: com.droiddeck.launcher.input.PhysicalInputBindings? = null
|
||||
private var airTriggerInput: AirTriggerInput? = null
|
||||
private var airTriggersOpen = false
|
||||
private var airTriggerMenu by mutableStateOf<com.droiddeck.launcher.ui.AirTriggerMenu?>(null)
|
||||
private var airTriggerGlow: com.droiddeck.launcher.ui.AirTriggerGlow? = null
|
||||
private var inputSettingsOpen by mutableStateOf(false)
|
||||
/** Which editor the input window shows; none means the full controller settings. */
|
||||
private var inputEditor by mutableStateOf<com.droiddeck.launcher.ui.InputEditorTarget?>(null)
|
||||
@Volatile private var inputUsesLocalActions = false
|
||||
private var inputUsesPointer = false
|
||||
private var inputProfile = InputProfile.defaults(InputProfile.GAME)
|
||||
@@ -633,6 +647,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private var drawerControllerActive by mutableStateOf(false)
|
||||
private var backHold by mutableStateOf(true)
|
||||
private var dockedMenuController by mutableStateOf(false)
|
||||
private var sessionFullscreenMode by mutableStateOf(FullscreenMode.ALWAYS)
|
||||
private var sessionOrientation by mutableStateOf(android.content.pm.ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE)
|
||||
private var dualScreenSessionMode by mutableStateOf(com.droiddeck.launcher.input.DualScreen.MODE_AUTO)
|
||||
private var backActionsInverted by mutableStateOf(false)
|
||||
@@ -661,6 +676,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private var effects by mutableStateOf(ScreenEffects.OFF)
|
||||
private var observedScreenEffectsProfileId by mutableStateOf<String?>(null)
|
||||
private var screenEffectsTarget by mutableStateOf(SCREEN_EFFECTS_TARGET_AUTO)
|
||||
private var screenEffectsProfileRevision by mutableIntStateOf(0)
|
||||
private var cardboard by mutableStateOf(Cardboard.OFF)
|
||||
private var headTracker: HeadTracker? = null
|
||||
private var steamVrStatus by mutableStateOf<SteamVr.Status?>(null)
|
||||
@@ -865,6 +881,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
if (savedInstanceState == null) SessionState.inputForAllGames = false
|
||||
com.droiddeck.launcher.session.xr.XrPanels.setMenuHost(this)
|
||||
AgentGuest.readyListener = agentReadyListener
|
||||
com.droiddeck.launcher.agent.AgentAttachments.gameFrame = gameFrame
|
||||
@@ -929,7 +946,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
applyFollowChoice()
|
||||
applyFollowOrientation(resources.configuration)
|
||||
goFullscreen()
|
||||
sessionFullscreenMode = SessionPrefs.sessionFullscreenMode(this)
|
||||
applySessionFullscreen()
|
||||
volumeControlStream = android.media.AudioManager.STREAM_MUSIC
|
||||
displayManager = getSystemService(DISPLAY_SERVICE) as DisplayManager
|
||||
refreshSecondScreenDisplays()
|
||||
@@ -973,6 +991,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
bridge.setBuiltinPad(SessionState.mode != SessionService.MODE_STEAM || SessionPrefs.builtinPad(this))
|
||||
padBridge = bridge
|
||||
inputRouter = InputRouter(inputOutput).also { bridge.setInputRouter(it); DeckControls.setRouter(it); physicalInputBindings = com.droiddeck.launcher.input.PhysicalInputBindings(it) }
|
||||
if (RedMagicAirTriggers.supported(this)) {
|
||||
airTriggerInput = AirTriggerInput(bridge, ::holdOnScreen, ::airTriggerTouched)
|
||||
RedMagicAirTriggers.restore(this)
|
||||
}
|
||||
refreshInputProfile()
|
||||
bridge.setOnChordInput(backQamInput::onChordInput)
|
||||
SessionState.padBridge = bridge
|
||||
@@ -1098,6 +1120,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
override fun onResolvePointerIcon(event: MotionEvent, pointerIndex: Int): android.view.PointerIcon? =
|
||||
if (platformPointerShown == true) super.onResolvePointerIcon(event, pointerIndex) else null
|
||||
}.apply { addView(sessionOverlay) })
|
||||
if (airTriggerInput != null) airTriggerGlow = com.droiddeck.launcher.ui.AirTriggerGlow(this).also { root.addView(it) }
|
||||
setContentView(root)
|
||||
glassesScope.launch { Glasses.state.collect {
|
||||
glasses = it
|
||||
@@ -1166,7 +1189,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
if (pipUi) return
|
||||
when {
|
||||
::loading.isInitialized && loading.ended -> finish()
|
||||
inputSettingsOpen -> inputSettingsOpen = false
|
||||
inputSettingsOpen -> closeInputEditor()
|
||||
dockedTouchOnly || backTaps.pending -> backTaps.tap()
|
||||
drawerOpen -> drawerOpen = false
|
||||
achievementsOpen -> closeAchievements()
|
||||
@@ -1368,7 +1391,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
if (nextGame != null) gameStarts++
|
||||
gestureGame = nextGame
|
||||
refreshGestureConfig()
|
||||
val inputChanges = inputGameKey() != SessionState.inputGame
|
||||
if (inputChanges) releasePads()
|
||||
restoreGamePanel(nextGame)
|
||||
if (inputGameKey() != SessionState.inputGame) refreshInputProfile()
|
||||
}
|
||||
if (
|
||||
SessionState.mode == SessionService.MODE_STEAM &&
|
||||
@@ -1382,6 +1408,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
LaunchedEffect(drawerOpen, menuOwnsController, pcKeyboardOpen, achievementsOpen, gestureSettingsOpen, inputSettingsOpen, pipUi, SessionState.suspended, resumed, appTextFocus) {
|
||||
updateOnScreenControls()
|
||||
refreshAirTriggers()
|
||||
padBridge?.setInputEnabled(resumed && !menuOwnsController && !pcKeyboardOpen && !achievementsOpen && !gestureSettingsOpen && !inputSettingsOpen && !pipUi && !appTextFocus && !SessionState.suspended)
|
||||
if (!drawerOpen && backTapOpenedDrawer) {
|
||||
backTaps.cancel()
|
||||
@@ -1397,18 +1424,23 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
}
|
||||
com.droiddeck.launcher.ui.GestureFeedback(recognizedGesture)
|
||||
if (inputSettingsOpen) com.droiddeck.launcher.ui.InputSettingsDialog(
|
||||
onBack = { inputSettingsOpen = false; secondScreenPresentation?.refreshControls() },
|
||||
onChanged = {
|
||||
controllerSettings = ControllerPrefs.read(this@SessionActivity)
|
||||
oscMode = SessionPrefs.oscMode(this@SessionActivity, SessionState.mode == SessionService.MODE_STEAM)
|
||||
padBridge?.setStickDeadZone(ControllerPrefs.deadZone(this@SessionActivity))
|
||||
joyConVr?.refresh()
|
||||
onScreenControls?.reload()
|
||||
refreshInputProfile()
|
||||
refreshControls()
|
||||
},
|
||||
)
|
||||
val inputChanged = {
|
||||
controllerSettings = ControllerPrefs.read(this@SessionActivity)
|
||||
applyOnScreenOpacity()
|
||||
oscMode = SessionPrefs.oscMode(this@SessionActivity, SessionState.mode == SessionService.MODE_STEAM)
|
||||
padBridge?.setStickDeadZone(ControllerPrefs.deadZone(this@SessionActivity))
|
||||
joyConVr?.refresh()
|
||||
onScreenControls?.reload()
|
||||
refreshInputProfile()
|
||||
refreshControls()
|
||||
}
|
||||
if (inputSettingsOpen) when (val target = inputEditor) {
|
||||
null -> com.droiddeck.launcher.ui.InputSettingsDialog(
|
||||
onBack = { inputSettingsOpen = false; secondScreenPresentation?.refreshControls() },
|
||||
onChanged = inputChanged,
|
||||
)
|
||||
else -> com.droiddeck.launcher.ui.InputEditorWindow(target, onDismiss = { closeInputEditor() }, onChanged = inputChanged)
|
||||
}
|
||||
LaunchedEffect(Unit) {
|
||||
val root = LinuxRuntime.rootDir(this@SessionActivity)
|
||||
while (true) {
|
||||
@@ -1641,8 +1673,11 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
effects = effects,
|
||||
screenEffectsTarget = screenEffectsTarget,
|
||||
screenEffectsTargets = screenEffectsTargetOptions(),
|
||||
screenEffectsCanDelete = screenEffectsProfileIdForTarget(screenEffectsTarget)?.let {
|
||||
SessionPrefs.hasScreenEffectsOverride(this@SessionActivity, it)
|
||||
screenEffectsCanDelete = screenEffectsProfileRevision.let {
|
||||
screenEffectsProfileIdForTarget(screenEffectsTarget)?.let {
|
||||
SessionPrefs.hasScreenEffectsOverride(this@SessionActivity, it) ||
|
||||
SessionPrefs.hasScreenEffectsUpscalerOverride(this@SessionActivity, it)
|
||||
}
|
||||
} == true,
|
||||
cardboard = cardboard,
|
||||
cardboardSensor = hasRotationSensor,
|
||||
@@ -1748,6 +1783,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
} else {
|
||||
val profileId = screenEffectsProfileIdForTarget(target)
|
||||
SessionPrefs.setScreenEffectsUpscaler(this@SessionActivity, profileId, m)
|
||||
screenEffectsProfileRevision++
|
||||
|
||||
if (target == screenEffectsTarget) {
|
||||
upscaler = m
|
||||
@@ -1783,6 +1819,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
} else {
|
||||
val profileId = screenEffectsProfileIdForTarget(target)
|
||||
SessionPrefs.setScreenEffectsUpscaler(this@SessionActivity, profileId, m)
|
||||
screenEffectsProfileRevision++
|
||||
if (target == screenEffectsTarget) {
|
||||
upscaler = m
|
||||
if (screenEffectsUpscalerTargetAppliesToLiveOutput(target)) {
|
||||
@@ -1829,7 +1866,22 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
val profileId = screenEffectsProfileIdForTarget(editorTarget)
|
||||
SessionPrefs.setScreenEffects(this@SessionActivity, profileId, e)
|
||||
effects = e
|
||||
if (screenEffectsTargetAppliesToLiveOutput(editorTarget)) e.push(upscaler)
|
||||
if (screenEffectsTargetAppliesToLiveOutput(editorTarget)) {
|
||||
val upscalerAppliesToLiveOutput =
|
||||
screenEffectsUpscalerTargetAppliesToLiveOutput(editorTarget)
|
||||
val liveUpscaler = if (upscalerAppliesToLiveOutput) {
|
||||
SessionPrefs.screenEffectsUpscaler(
|
||||
this@SessionActivity,
|
||||
screenEffectsProfileIdForTarget(editorTarget)
|
||||
)
|
||||
} else {
|
||||
SessionPrefs.screenEffectsUpscaler(
|
||||
this@SessionActivity,
|
||||
currentScreenEffectsProfileId()
|
||||
)
|
||||
}
|
||||
e.push(liveUpscaler)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1886,7 +1938,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
onBlackFrameInsertion = { on ->
|
||||
SessionPrefs.setBlackFrameInsertion(this@SessionActivity, on)
|
||||
blackFrameInsertion = on
|
||||
CompositorHost.setBlackFrameInsertion(on, refreshHz(), compositorFpsLimit())
|
||||
CompositorHost.setBlackFrameInsertion(on, refreshHz(), compositorFpsLimit(), outputFpsLimit())
|
||||
},
|
||||
hdr = hdrWanted,
|
||||
hdrAvailable = hdrAvailable,
|
||||
@@ -1915,6 +1967,27 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
wowChat = wowChat.remembered,
|
||||
onWowChat = wowChat::choose,
|
||||
controller = controllerSettings,
|
||||
airTriggers = airTriggerMenu,
|
||||
onAirTriggers = { on -> AirTriggerPrefs.setEnabled(this@SessionActivity, on); refreshAirTriggers() },
|
||||
onAirTriggerButton = { trigger, id ->
|
||||
AirTriggerPrefs.setButton(this@SessionActivity, primaryInputLayout?.id.orEmpty(), trigger, id)
|
||||
refreshAirTriggers()
|
||||
},
|
||||
onAirTriggerAction = { trigger, action ->
|
||||
AirTriggerPrefs.setAction(this@SessionActivity, primaryInputLayout?.id.orEmpty(), trigger, action)
|
||||
refreshAirTriggers()
|
||||
},
|
||||
onAirTriggerRate = { trigger, rate ->
|
||||
AirTriggerPrefs.setRate(this@SessionActivity, primaryInputLayout?.id.orEmpty(), trigger, rate)
|
||||
refreshAirTriggers()
|
||||
},
|
||||
onAirTriggerVibration = { on -> AirTriggerPrefs.setVibration(this@SessionActivity, on); refreshAirTriggers() },
|
||||
onAirTriggerScreenLight = { on -> AirTriggerPrefs.setScreenLight(this@SessionActivity, on); refreshAirTriggers() },
|
||||
onAirTriggerLed = { led ->
|
||||
AirTriggerPrefs.setLed(this@SessionActivity, led)
|
||||
if (airTriggersOpen) RedMagicAirTriggers.open(this@SessionActivity)
|
||||
refreshAirTriggers()
|
||||
},
|
||||
onControllerSize = { percent -> updateControllerPrefs { ControllerPrefs.setSize(this@SessionActivity, percent) } },
|
||||
onControllerOpacity = { percent ->
|
||||
ControllerPrefs.setOnScreenOpacity(this@SessionActivity, percent)
|
||||
@@ -1986,10 +2059,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
if (v == SessionPrefs.OSC_STEAM_TOUCH && com.droiddeck.launcher.input.SteamTouchDevice.current == null)
|
||||
Toast.makeText(this@SessionActivity, R.string.osc_style_next_session, Toast.LENGTH_LONG).show()
|
||||
},
|
||||
onEditSteamTouch = if (steamTouchAvailable && oscMode == SessionPrefs.OSC_STEAM_TOUCH && onScreenButtonsVisible) ({
|
||||
drawerOpen = false
|
||||
steamTouchControls?.startEditing()
|
||||
}) else null,
|
||||
onSuspendPolicy = { policy ->
|
||||
SessionPrefs.setSuspendPolicy(this@SessionActivity, SessionState.mode, policy)
|
||||
suspendPolicy = policy
|
||||
@@ -2001,8 +2070,16 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
SessionService.suspendPolicyChanged(this@SessionActivity)
|
||||
},
|
||||
onTouch = { v -> SessionPrefs.setTouchMode(this@SessionActivity, v); readPrefs() },
|
||||
onInputSettings = { leaveImmersiveForDialog(); releasePads(); drawerOpen = false; inputSettingsOpen = true },
|
||||
onInputSettings = { leaveImmersiveForDialog(); releasePads(); drawerOpen = false; inputEditor = null; inputSettingsOpen = true },
|
||||
onInputSelection = { releasePads(); refreshInputProfile() },
|
||||
inputGame = inputGameKey()?.let { it to inputGameName() },
|
||||
onEditButtons = { openInputEditor(InputRole.PHYSICAL) },
|
||||
onEditLayout = when {
|
||||
oscMode == SessionPrefs.OSC_NEVER -> null
|
||||
steamTouchAvailable && oscMode == SessionPrefs.OSC_STEAM_TOUCH && SessionState.mode == SessionService.MODE_STEAM ->
|
||||
if (onScreenButtonsVisible) ({ drawerOpen = false; steamTouchControls?.startEditing() }) else null
|
||||
else -> ({ openInputEditor(InputRole.PRIMARY) })
|
||||
},
|
||||
onGestureSettings = { leaveImmersiveForDialog(); drawerOpen = false; gestureSettingsOpen = true },
|
||||
touchActive = drawerTouchMode(),
|
||||
directHoldBehavior = directHoldBehavior,
|
||||
@@ -2045,6 +2122,12 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
onPause = ::pauseNow,
|
||||
paused = SessionState.suspended || SessionState.manualPause,
|
||||
onResume = { SessionService.resume(this@SessionActivity) },
|
||||
fullscreenMode = sessionFullscreenMode,
|
||||
onFullscreenMode = { mode ->
|
||||
SessionPrefs.setSessionFullscreenMode(this@SessionActivity, mode)
|
||||
sessionFullscreenMode = mode
|
||||
applySessionFullscreen()
|
||||
},
|
||||
orientation = sessionOrientation,
|
||||
onOrientation = { value ->
|
||||
when (SessionState.mode) {
|
||||
@@ -2648,10 +2731,21 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
val targetUpscaler = SessionPrefs.screenEffectsUpscaler(this, profileId)
|
||||
effects = targetEffects
|
||||
upscaler = targetUpscaler
|
||||
val upscalerAppliesToLiveOutput = screenEffectsUpscalerTargetAppliesToLiveOutput(target)
|
||||
val liveUpscaler = if (upscalerAppliesToLiveOutput) {
|
||||
targetUpscaler
|
||||
} else {
|
||||
SessionPrefs.screenEffectsUpscaler(this, currentScreenEffectsProfileId())
|
||||
}
|
||||
if (upscalerAppliesToLiveOutput) {
|
||||
WaylandCompositor.nativeSetUpscaler(liveUpscaler)
|
||||
}
|
||||
if (screenEffectsTargetAppliesToLiveOutput(target)) {
|
||||
WaylandCompositor.nativeSetUpscaler(targetUpscaler)
|
||||
WaylandCompositor.nativeSetLookName(ScreenEffectLooks.match(targetEffects, targetUpscaler)?.name)
|
||||
targetEffects.push(targetUpscaler)
|
||||
WaylandCompositor.nativeSetLookName(ScreenEffectLooks.match(targetEffects, liveUpscaler)?.name)
|
||||
targetEffects.push(liveUpscaler)
|
||||
} else if (upscalerAppliesToLiveOutput) {
|
||||
val liveEffects = SessionPrefs.screenEffects(this, currentScreenEffectsProfileId())
|
||||
WaylandCompositor.nativeSetLookName(ScreenEffectLooks.match(liveEffects, liveUpscaler)?.name)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2664,6 +2758,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private fun resetScreenEffectsTarget(target: String) {
|
||||
if (target != screenEffectsTarget) return
|
||||
SessionPrefs.resetScreenEffectsProfile(this, screenEffectsProfileIdForTarget(target))
|
||||
screenEffectsProfileRevision++
|
||||
syncScreenEffectsTarget(target)
|
||||
}
|
||||
|
||||
@@ -2671,6 +2766,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
if (target != screenEffectsTarget) return
|
||||
val profileId = screenEffectsProfileIdForTarget(target) ?: return
|
||||
SessionPrefs.deleteScreenEffectsProfile(this, profileId)
|
||||
screenEffectsProfileRevision++
|
||||
syncScreenEffectsTarget(target)
|
||||
}
|
||||
|
||||
@@ -3123,7 +3219,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
CompositorHost.startOrAttach(
|
||||
this, holder.surface, runtimeDir.path,
|
||||
driverId?.let { turnip.driverPath(it) }, driverId?.let { turnip.libraryName(it) },
|
||||
applicationInfo.nativeLibraryDir, size.first, size.second, refreshHz(holder), compositorFpsLimit(),
|
||||
applicationInfo.nativeLibraryDir, size.first, size.second, refreshHz(holder), compositorFpsLimit(), outputFpsLimit(),
|
||||
)
|
||||
onOutputAttached(holder)
|
||||
if (SessionState.running && size != previous) {
|
||||
@@ -3238,6 +3334,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
|
||||
override fun onConfigurationChanged(newConfig: android.content.res.Configuration) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
if (!pipUi && !isInPictureInPictureMode) applySessionFullscreen(newConfig)
|
||||
picturePosition = SessionPrefs.picturePosition(this, picturePortrait(newConfig))
|
||||
if (refreshActivityDisplayId() && started) {
|
||||
SessionService.setActivityDisplay(this, sessionActivityDisplayId)
|
||||
@@ -3398,7 +3495,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
)
|
||||
val hz = refreshHz()
|
||||
val changed = kotlin.math.abs(SessionState.refreshHz - hz) > 0.1f
|
||||
CompositorHost.updatePacing(hz, compositorFpsLimit())
|
||||
CompositorHost.updatePacing(hz, compositorFpsLimit(), outputFpsLimit())
|
||||
pushCardboard(activeCardboard)
|
||||
if (changed && ::surfaceView.isInitialized) applyFrameGen()
|
||||
}
|
||||
@@ -3646,6 +3743,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
|
||||
private fun onSessionEnded(status: Int) {
|
||||
ended = true
|
||||
runOnUiThread { refreshAirTriggers() }
|
||||
++steamVrRequestGeneration
|
||||
if (isInPictureInPictureMode) {
|
||||
runOnUiThread { finish() }
|
||||
@@ -3703,6 +3801,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private fun releasePads(keepBackTap: Boolean = false) {
|
||||
inputMotion.stop()
|
||||
physicalInputBindings?.release()
|
||||
airTriggerInput?.release()
|
||||
com.droiddeck.launcher.input.HomeButtonShortcuts.cancel(this)
|
||||
backQamInput.cancel(keepTap = keepBackTap)
|
||||
padBridge?.releaseAll()
|
||||
@@ -3779,7 +3878,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
presentationFaultHint()?.let { return it }
|
||||
if (log == null || !log.isFile) return null
|
||||
return try {
|
||||
var enosys = 0
|
||||
var fexMissing = false
|
||||
val size = log.length()
|
||||
val text = java.io.RandomAccessFile(log, "r").use { f ->
|
||||
@@ -3790,7 +3888,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
String(bytes, Charsets.ISO_8859_1)
|
||||
}
|
||||
text.lineSequence().forEach { line ->
|
||||
if (line.contains("Function not implemented")) enosys++
|
||||
if (line.contains(FEX_MISSING)) fexMissing = true
|
||||
}
|
||||
val steamSetup = com.droiddeck.launcher.session.SteamClientSetupFailure.find(text.lineSequence())
|
||||
@@ -3812,9 +3909,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
} else if (fexMissing) {
|
||||
val what = com.droiddeck.launcher.frontend.Library.nameForProgram(SessionState.program) ?: getString(R.string.session_end_program)
|
||||
EndHint(getString(R.string.session_end_fex_missing, what), evenOnSuccess = true)
|
||||
} else if (enosys >= 8) {
|
||||
EndHint(resources.getQuantityString(R.plurals.session_hint_enosys, enosys, enosys,
|
||||
getString(R.string.perf_title), getString(R.string.perf_seccomp), getString(R.string.perf_xalia)))
|
||||
} else null
|
||||
} catch (e: Exception) {
|
||||
null
|
||||
@@ -3835,6 +3929,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
return dispatchSessionKeyEvent(normalized, orderedImeKey)
|
||||
}
|
||||
|
||||
private fun physicalInputAccepted() = resumed && !menuOwnsController && !pcKeyboardOpen && !achievementsOpen &&
|
||||
!inputSettingsOpen && !gestureSettingsOpen && !SessionState.suspended && !loading.visible
|
||||
|
||||
private fun dispatchSessionKeyEvent(event: KeyEvent, orderedImeKey: Boolean): Boolean {
|
||||
if (com.droiddeck.launcher.ui.AgentPet.handleBack(this, event)) return true
|
||||
when (event.keyCode) {
|
||||
@@ -3854,10 +3951,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
}
|
||||
if (penStream.holdsKey(event) || (penSettings.mode != SessionPrefs.PEN_TOUCH && PenStream.isPenKey(event))) return penStream.onKey(event)
|
||||
if (airTriggerInput?.onKey(event) { physicalInputAccepted() && !pipUi && !appTextFocus } == true) return true
|
||||
if (appTextFocus) return super.dispatchKeyEvent(event)
|
||||
if (!pipUi) {
|
||||
if (physicalInputBindings?.onKey(event, resumed && !menuOwnsController && !pcKeyboardOpen && !achievementsOpen &&
|
||||
!inputSettingsOpen && !gestureSettingsOpen && !SessionState.suspended && !loading.visible) == true) return true
|
||||
if (physicalInputBindings?.onKey(event, physicalInputAccepted()) == true) return true
|
||||
if (physicalShortcuts.onKey(
|
||||
event,
|
||||
enabled = resumed && SessionState.running && !SessionState.suspended &&
|
||||
@@ -4717,6 +4814,53 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
if (SessionState.mode == SessionService.MODE_RUN) SessionState.gameId?.takeIf { it.isNotBlank() }?.let { "game:$it" } ?: gestureGame
|
||||
else gestureGame
|
||||
|
||||
private fun inputGameKey(): String? = bottomGameKey()?.let(::boundedInputGameKey)
|
||||
|
||||
/** Opens the effective controls. Fork a per-game part only when the editor saves an actual change. */
|
||||
private fun openInputEditor(role: InputRole) {
|
||||
val desktop = loadingMode() == SessionService.MODE_DESKTOP
|
||||
val game = inputGameKey()?.takeUnless { SessionState.inputForAllGames }
|
||||
val name = inputGameName()
|
||||
val opened = runCatching {
|
||||
val library = com.droiddeck.launcher.input.InputLibraries.read(this)
|
||||
val part = library.activePart(desktop, role, game)
|
||||
val layout = part.layout?.let { id -> library.layouts.first { it.id == id } }
|
||||
if (role != InputRole.PHYSICAL && layout?.editable != true) null
|
||||
else com.droiddeck.launcher.ui.InputEditorTarget(
|
||||
role, library.activeId(desktop, game), part.bindings, part.layout,
|
||||
scope = if (game != null) name else getString(R.string.flow_shared_defaults_of,
|
||||
com.droiddeck.launcher.ui.profileLabel(this, library.profile(library.activeId(desktop, null)))),
|
||||
gameEdit = game?.let { com.droiddeck.launcher.ui.GameInputEdit(desktop, it, name, role) },
|
||||
wasInherited = game != null && library.games[game]?.parts?.containsKey(role) != true,
|
||||
)
|
||||
}.onFailure { Toast.makeText(this, it.message ?: getString(R.string.input_save_failed), Toast.LENGTH_LONG).show() }.getOrNull()
|
||||
leaveImmersiveForDialog(); releasePads(); drawerOpen = false
|
||||
inputEditor = opened
|
||||
inputSettingsOpen = true
|
||||
}
|
||||
|
||||
private fun closeInputEditor() {
|
||||
val target = inputEditor
|
||||
inputSettingsOpen = false
|
||||
inputEditor = null
|
||||
val edit = target?.takeIf { it.wasInherited }?.gameEdit
|
||||
if (edit != null) runCatching {
|
||||
val library = com.droiddeck.launcher.input.InputLibraries.read(this)
|
||||
if (library.games[edit.game]?.parts?.containsKey(edit.role) == true &&
|
||||
library.gameChanges(edit.desktop, edit.game, edit.role) == 0)
|
||||
com.droiddeck.launcher.input.InputLibraries.update(this) { it.resetGame(edit.game, edit.role) }
|
||||
}
|
||||
releasePads()
|
||||
refreshInputProfile()
|
||||
secondScreenPresentation?.refreshControls()
|
||||
}
|
||||
|
||||
private fun inputGameName(): String = when (SessionState.mode) {
|
||||
SessionService.MODE_RUN -> com.droiddeck.launcher.frontend.Library.nameForProgram(SessionState.program)
|
||||
SessionService.MODE_STEAM -> frameGenActiveGameName
|
||||
else -> null
|
||||
}?.takeIf { it.isNotBlank() }?.take(80) ?: getString(R.string.session_title_game)
|
||||
|
||||
private fun settleDualScreenControls() {
|
||||
if (!dualControlsProvisional || pipUi || !started || (::loading.isInitialized && loading.visible)) return
|
||||
dualControlsProvisional = false
|
||||
@@ -5066,13 +5210,15 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private fun refreshInputProfile() {
|
||||
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)
|
||||
val game = inputGameKey()
|
||||
SessionState.inputGame = game
|
||||
inputProfile = library.compileActive(desktop, secondScreenMode.panel(this), game)
|
||||
stockInputProfile = library.compileStock(desktop, secondScreenMode.panel(this), game)
|
||||
primaryInputLayout = library.activeLayout(desktop, InputRole.PRIMARY, game)
|
||||
adaptiveSticks = primaryInputLayout?.adaptiveSticks
|
||||
quickButtons = primaryInputLayout?.takeIf { it.editable }?.let { l -> l.quickButtons.associateWith { it !in l.style.hidden } }.orEmpty()
|
||||
secondaryInputLayout = library.panelLayout(desktop, secondScreenMode.panel(this))
|
||||
deckPanelLayouts = com.droiddeck.launcher.input.DeckPanel.entries.associateWith { library.panelLayout(desktop, it.bindings) }
|
||||
secondaryInputLayout = library.panelLayout(desktop, secondScreenMode.panel(this), game)
|
||||
deckPanelLayouts = com.droiddeck.launcher.input.DeckPanel.entries.associateWith { library.panelLayout(desktop, it.bindings, game) }
|
||||
inputUsesLocalActions = InputControl.padControls.any { inputProfile.action(InputRole.PHYSICAL, it) !is InputAction.Native }
|
||||
inputUsesPointer = inputProfile.bindings.values.any { bindings ->
|
||||
bindings.values.any { it is InputAction.Pointer || it is InputAction.MouseButton || it is InputAction.Scroll }
|
||||
@@ -5082,6 +5228,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
|| inputProfile.keys.any { it.action is InputAction.MouseButton }
|
||||
physicalInputBindings?.configure(inputProfile.keys)
|
||||
padBridge?.setInputProfile(inputProfile)
|
||||
refreshAirTriggers()
|
||||
DeckControls.refresh()
|
||||
onScreenControls?.updateLayout(primaryInputLayout)
|
||||
bottomInputControls?.updateLayout(primaryInputLayout)
|
||||
@@ -5092,6 +5239,32 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
secondScreenPresentation?.refreshControls()
|
||||
}
|
||||
|
||||
private fun refreshAirTriggers() {
|
||||
val input = airTriggerInput ?: return
|
||||
val layout = primaryInputLayout
|
||||
val layoutId = layout?.id.orEmpty()
|
||||
val enabled = AirTriggerPrefs.enabled(this)
|
||||
val chosen = AirTrigger.entries.associateWith {
|
||||
AirTriggerSetup(AirTriggerButtons.resolve(layout, it, AirTriggerPrefs.button(this, layoutId, it)),
|
||||
AirTriggerPrefs.action(this, layoutId, it), AirTriggerPrefs.rate(this, layoutId, it))
|
||||
}
|
||||
val active = enabled && resumed && !ended && !SessionState.suspended
|
||||
input.configure(if (active) chosen else emptyMap())
|
||||
if (active != airTriggersOpen) {
|
||||
airTriggersOpen = active
|
||||
if (active) RedMagicAirTriggers.open(this) else RedMagicAirTriggers.restore(this)
|
||||
}
|
||||
airTriggerMenu = com.droiddeck.launcher.ui.AirTriggerMenu(enabled, chosen.mapValues { it.value.element.id },
|
||||
AirTriggerButtons.options(layout).map { it.id to it.name }, AirTriggerPrefs.vibration(this), AirTriggerPrefs.screenLight(this),
|
||||
AirTriggerPrefs.led(this), chosen.mapValues { it.value.action }, chosen.mapValues { it.value.rate })
|
||||
}
|
||||
|
||||
private fun airTriggerTouched(trigger: AirTrigger, down: Boolean) {
|
||||
RedMagicAirTriggers.light(if (down) trigger.pressLight else trigger.releaseLight)
|
||||
if (down && AirTriggerPrefs.vibration(this)) com.droiddeck.launcher.ui.ControllerHaptics.click(this)
|
||||
airTriggerGlow?.show(trigger, down && AirTriggerPrefs.screenLight(this))
|
||||
}
|
||||
|
||||
private fun tapQam() {
|
||||
if (SessionState.mode == SessionService.MODE_STEAM) padBridge?.triggerQam()
|
||||
}
|
||||
@@ -5548,10 +5721,20 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private var sessionTouchDown = false
|
||||
private var screenTapsClick = true
|
||||
|
||||
private fun onScreenLeftMouseButtonShown(): Boolean = listOfNotNull(
|
||||
private fun inputSurfaces() = listOfNotNull(
|
||||
onScreenControls?.inputSurface, bottomInputControls?.inputSurface, unfoldedPanel?.inputSurface, unfoldedDeckSurface,
|
||||
secondScreenPresentation?.controlsView, swappedInputSurface,
|
||||
).any { it.isShown && inputProfile.showsLeftMouseButton(it.inputRole, it.shownElements, stockInputProfile) }
|
||||
)
|
||||
|
||||
private fun onScreenLeftMouseButtonShown(): Boolean =
|
||||
inputSurfaces().any { it.isShown && inputProfile.showsLeftMouseButton(it.inputRole, it.shownElements, stockInputProfile) }
|
||||
|
||||
private fun holdOnScreen(elementId: String, trigger: AirTrigger, held: Boolean, cancelled: Boolean): Boolean {
|
||||
val surfaces = inputSurfaces().filter { it.inputRole == InputRole.PRIMARY }
|
||||
if (held) return surfaces.any { it.isShown && it.hold(elementId, trigger.ordinal, true) }
|
||||
surfaces.forEach { it.hold(elementId, trigger.ordinal, false, cancelled) }
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onTouchEvent(event: MotionEvent): Boolean = inSurfaceSpace(event) { handleTouch(event) }
|
||||
|
||||
@@ -6556,6 +6739,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
uiHandler.removeCallbacks(questSteamVrRequest)
|
||||
if (com.droiddeck.launcher.session.QuestExperimental.isSupported()) uiHandler.post(questSteamVrRequest)
|
||||
if (runtimeRemovalBlocked) return
|
||||
sessionFullscreenMode = SessionPrefs.sessionFullscreenMode(this)
|
||||
if (!pipUi && !isInPictureInPictureMode) applySessionFullscreen()
|
||||
if (!SessionState.suspended) pausedFrame = null
|
||||
com.droiddeck.launcher.ui.Motion.refresh(this)
|
||||
refreshHomeApp()
|
||||
@@ -6669,6 +6854,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
if (::scrollTouch.isInitialized) scrollTouch.cancel()
|
||||
if (::padMouse.isInitialized) padMouse.reset()
|
||||
resumed = false
|
||||
refreshAirTriggers()
|
||||
boostGpuClock(false)
|
||||
updateKeyboardRoute()
|
||||
updatePointerCapture()
|
||||
@@ -7262,10 +7448,13 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
if (!hasFocus) {
|
||||
cancelTouchGestures()
|
||||
releaseHeldGuestInput()
|
||||
airTriggerInput?.release()
|
||||
}
|
||||
// Game Space clears the distribute state when the launcher or Game Space itself comes to the front.
|
||||
if (hasFocus && airTriggersOpen) RedMagicAirTriggers.open(this)
|
||||
if (hasFocus && !pipUi) {
|
||||
retryFieldKeyboard(true)
|
||||
goFullscreen()
|
||||
applySessionFullscreen()
|
||||
refreshClipboard()
|
||||
}
|
||||
updatePointerCapture()
|
||||
@@ -7275,19 +7464,24 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
if (resumed) sessionClipboard.refresh()
|
||||
}
|
||||
|
||||
private fun goFullscreen() {
|
||||
private fun applySessionFullscreen(config: android.content.res.Configuration = resources.configuration) {
|
||||
val fullscreen = sessionFullscreenMode.hidesSystemBars(config.orientation)
|
||||
if (fullscreen) window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
|
||||
else window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
|
||||
@Suppress("DEPRECATION")
|
||||
window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
||||
window.decorView.systemUiVisibility = if (fullscreen) (View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
||||
or View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION)
|
||||
or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) else View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
window.attributes = window.attributes.apply {
|
||||
layoutInDisplayCutoutMode = if (Build.VERSION.SDK_INT >= 30)
|
||||
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS
|
||||
else WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
|
||||
layoutInDisplayCutoutMode = when {
|
||||
!fullscreen -> WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT
|
||||
Build.VERSION.SDK_INT >= 30 -> WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS
|
||||
else -> WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7350,6 +7544,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
inputMotion.stop()
|
||||
padBridge?.setInputEnabled(false)
|
||||
physicalInputBindings?.close()
|
||||
airTriggerInput?.close()
|
||||
airTriggerInput = null
|
||||
if (airTriggersOpen) RedMagicAirTriggers.restore(this)
|
||||
padBridge?.stop()
|
||||
DeckControls.clearRouter(inputRouter)
|
||||
inputRouter = null
|
||||
|
||||
@@ -23,7 +23,7 @@ object AgentAccess {
|
||||
fun requireCommands(context: Context) {
|
||||
if (!commandsAllowed(context)) throw AgentException(
|
||||
"AGENT_COMMANDS_DISABLED",
|
||||
"Debugging tools are off: turn on Setup > Developer > Debugging tools on the device",
|
||||
"droiddeckctl is off: turn on Setup > Developer > droiddeckctl on the device",
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -571,7 +571,6 @@ object AgentHost {
|
||||
remove("LD_PRELOAD"); remove("LD_AUDIT"); remove("LD_LIBRARY_PATH")
|
||||
put("PROOT_LOADER", LinuxRuntime.prootLoader(app).path)
|
||||
put("PROOT_TMP_DIR", LinuxRuntime.prootTempDir(app).path)
|
||||
if (SessionPrefs.prootNoSeccomp(app)) put("PROOT_NO_SECCOMP", "1")
|
||||
LinuxRuntime.prootLibraryPath(app).takeIf { it.isNotEmpty() }?.let { put("LD_LIBRARY_PATH", it) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,6 @@ object AgentNative {
|
||||
fun run(context: Context, request: JSONObject, timeoutMs: Long): JSONObject {
|
||||
val root = LinuxRuntime.rootDir(context)
|
||||
com.droiddeck.launcher.session.SessionFiles.stage(context, root)
|
||||
// with the setting off, staging leaves the rootfs as proot wants it
|
||||
if (!com.droiddeck.launcher.session.SessionPrefs.nativeUserland(context)) NativeGuest.prepare(context, root)
|
||||
if (!NativeGuest.available(root)) throw AgentException("NATIVE_UNAVAILABLE", "The rootfs has no native hook or glibc loader yet; start a session once")
|
||||
val argvJson = request.optJSONArray("argv") ?: throw AgentException("INVALID_REQUEST", "argv is required")
|
||||
val argv = (0 until argvJson.length()).map { argvJson.getString(it) }
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.droiddeck.launcher.core
|
||||
|
||||
import java.io.File
|
||||
|
||||
object CpuFeatures {
|
||||
internal fun lacksAtomics(cpuInfo: String): Boolean {
|
||||
val cores = cpuInfo.lineSequence()
|
||||
.filter { it.substringBefore(':').trim() == "Features" }
|
||||
.map { it.substringAfter(':').trim().split(Regex("\\s+")) }
|
||||
.toList()
|
||||
return cores.isNotEmpty() && cores.any { "atomics" !in it }
|
||||
}
|
||||
|
||||
val lacksAtomics: Boolean by lazy {
|
||||
runCatching { lacksAtomics(File("/proc/cpuinfo").readText()) }.getOrDefault(false)
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ import java.io.File
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
import java.util.TimeZone
|
||||
|
||||
object DeviceReport {
|
||||
private const val TAG = "DeviceReport"
|
||||
@@ -36,6 +37,10 @@ object DeviceReport {
|
||||
.map { it.substringAfter(':').trim().split(Regex("\\s+")).filter(String::isNotEmpty).joinToString(" ") }
|
||||
.filter(String::isNotEmpty).distinct().joinToString(" | ").ifEmpty { "not reported" }
|
||||
|
||||
internal fun buildDate(millis: Long): String? = millis.takeIf { it > 0 }?.let {
|
||||
SimpleDateFormat("yyyy-MM-dd HH:mm 'UTC'", Locale.US).apply { timeZone = TimeZone.getTimeZone("UTC") }.format(Date(it))
|
||||
}
|
||||
|
||||
fun write(context: Context, target: File, mode: String) {
|
||||
try {
|
||||
target.writeText(build(context, mode))
|
||||
@@ -129,6 +134,7 @@ object DeviceReport {
|
||||
k("Android", "${Build.VERSION.RELEASE} (API ${Build.VERSION.SDK_INT})")
|
||||
k("Security patch", Build.VERSION.SECURITY_PATCH)
|
||||
k("Build", Build.DISPLAY)
|
||||
k("Build date", buildDate(Build.TIME))
|
||||
k("Fingerprint", Build.FINGERPRINT)
|
||||
k("Kernel", System.getProperty("os.version"))
|
||||
k("ABIs", Build.SUPPORTED_ABIS.joinToString(", "))
|
||||
@@ -186,6 +192,7 @@ object DeviceReport {
|
||||
val fs = StatFs(Environment.getExternalStorageDirectory().path)
|
||||
k("Shared storage free", FileUtils.sizeToString(fs.availableBlocksLong * fs.blockSizeLong))
|
||||
}
|
||||
k("All files access", runCatching { com.droiddeck.launcher.files.AllFilesAccess.state() }.getOrNull())
|
||||
|
||||
h("GPU")
|
||||
k("KGSL gpu_model", readSys("/sys/class/kgsl/kgsl-3d0/gpu_model"))
|
||||
@@ -284,9 +291,12 @@ object DeviceReport {
|
||||
k("Linux x86 (FEX)", if (com.droiddeck.launcher.runtime.LinuxFex.ready(context)) "ready" else "not set up")
|
||||
k("gamescope realtime", SessionPrefs.gamescopeRealtime(context))
|
||||
k("pace cores", SessionPrefs.paceCores(context))
|
||||
k("proot without seccomp", SessionPrefs.prootNoSeccomp(context))
|
||||
k("native userland (no proot)", SessionPrefs.nativeUserland(context))
|
||||
k("proot fast path", SessionPrefs.prootFastPath(context))
|
||||
k("guest runtime policy", "native preferred with PRoot fallback")
|
||||
k("guest runtime", when (com.droiddeck.launcher.runtime.NativeGuest.sessionMode) {
|
||||
true -> "native"
|
||||
false -> "PRoot"
|
||||
null -> if (com.droiddeck.launcher.runtime.NativeGuest.enabled(context)) "native available" else "native unavailable"
|
||||
})
|
||||
k("proot binary", LinuxRuntime.prootSource(context) + " " + LinuxRuntime.prootBinary(context).path)
|
||||
k("proot fast path (eligible)", com.droiddeck.launcher.runtime.ProotFastPath.enabled(context))
|
||||
k("Guest host name", SessionPrefs.guestHostname(context))
|
||||
|
||||
@@ -119,7 +119,7 @@ object WirelessAdbFix {
|
||||
* socket table, and mDNS often advertises nothing, so the ephemeral range Linux gives adbd is
|
||||
* scanned on loopback (closed ports refuse at once) and the open ports are tried with our key.
|
||||
*/
|
||||
private fun loopbackAdbPort(app: Context): Int? {
|
||||
private fun loopbackAdbPort(app: Context, exclude: Int? = null): Int? {
|
||||
val open = java.util.concurrent.ConcurrentLinkedQueue<Int>()
|
||||
val workers = 32
|
||||
val range = EPHEMERAL_PORTS
|
||||
@@ -127,7 +127,7 @@ object WirelessAdbFix {
|
||||
Thread {
|
||||
var port = range.first + worker
|
||||
while (port <= range.last) {
|
||||
if (answers(LOOPBACK, port, 150)) open += port
|
||||
if (port != exclude && answers(LOOPBACK, port, 150)) open += port
|
||||
port += workers
|
||||
}
|
||||
}.apply { start() }
|
||||
@@ -162,8 +162,28 @@ object WirelessAdbFix {
|
||||
}.getOrDefault(address is Inet4Address)
|
||||
|
||||
fun localConnectPort(context: Context): Int? =
|
||||
tlsPortProperty()
|
||||
?: findConnectPort(context, LOOPBACK)
|
||||
discoverConnectPort(context, LOOPBACK)
|
||||
|
||||
private fun discoverConnectPort(context: Context, host: String, exclude: Int? = null): Int? =
|
||||
chooseConnectPort(host, exclude,
|
||||
property = ::tlsPortProperty,
|
||||
advertised = { acceptable -> findConnectPort(context, host, accept = acceptable) },
|
||||
answers = { port -> answers(host, port) },
|
||||
// Some local devices never advertise their connect port. Try only
|
||||
// loopback and require the app's existing paired key to authenticate.
|
||||
authenticatedLocal = { loopbackAdbPort(context.applicationContext, exclude) },
|
||||
)
|
||||
|
||||
internal fun chooseConnectPort(
|
||||
host: String, exclude: Int?,
|
||||
property: () -> Int?, advertised: ((Int) -> Boolean) -> Int?,
|
||||
answers: (Int) -> Boolean, authenticatedLocal: () -> Int?,
|
||||
): Int? {
|
||||
val local = host == LOOPBACK
|
||||
val acceptable: (Int) -> Boolean = { port -> port != exclude && (!local || answers(port)) }
|
||||
val propertyPort = if (local) property()?.takeIf(acceptable) else null
|
||||
return propertyPort ?: advertised(acceptable) ?: if (local) authenticatedLocal() else null
|
||||
}
|
||||
|
||||
private fun tlsPortProperty(): Int? = runCatching {
|
||||
Class.forName("android.os.SystemProperties").getMethod("get", String::class.java)
|
||||
@@ -301,14 +321,14 @@ object WirelessAdbFix {
|
||||
if (cachedPort != null) {
|
||||
val cachedResult = runCatching { action(appContext, saved.host, cachedPort) }
|
||||
if (cachedResult.isSuccess) return
|
||||
val discoveredPort = findConnectPort(appContext, saved.host)
|
||||
val discoveredPort = discoverConnectPort(appContext, saved.host, exclude = cachedPort)
|
||||
if (discoveredPort != null && discoveredPort != cachedPort) {
|
||||
action(appContext, saved.host, discoveredPort)
|
||||
} else {
|
||||
cachedResult.getOrThrow()
|
||||
}
|
||||
} else {
|
||||
val discoveredPort = findConnectPort(appContext, saved.host)
|
||||
val discoveredPort = discoverConnectPort(appContext, saved.host)
|
||||
?: error(appContext.getString(R.string.adbfix_enter_address))
|
||||
action(appContext, saved.host, discoveredPort)
|
||||
}
|
||||
|
||||
@@ -4,20 +4,23 @@ import android.app.Notification
|
||||
import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
import android.app.PendingIntent
|
||||
import android.app.RemoteInput
|
||||
import android.app.Service
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.net.nsd.NsdManager
|
||||
import android.net.nsd.NsdServiceInfo
|
||||
import android.os.Build
|
||||
import android.os.Handler
|
||||
import android.os.IBinder
|
||||
import android.os.Looper
|
||||
import android.util.TypedValue
|
||||
import android.widget.RemoteViews
|
||||
import com.droiddeck.launcher.FrontEndActivity
|
||||
import com.droiddeck.launcher.R
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import java.util.UUID
|
||||
|
||||
class WirelessAdbPairingService : Service() {
|
||||
override fun attachBaseContext(newBase: android.content.Context) =
|
||||
@@ -37,6 +40,8 @@ class WirelessAdbPairingService : Service() {
|
||||
private var discovery: NsdManager.DiscoveryListener? = null
|
||||
private var pairingHost: String? = null
|
||||
private var pairingPort: Int? = null
|
||||
private val keypad = WirelessPairingKeypad()
|
||||
private var keypadToken = UUID.randomUUID().toString()
|
||||
@Volatile private var working = false
|
||||
@Volatile private var limitEnabled = false
|
||||
@Volatile private var session = 0
|
||||
@@ -46,13 +51,21 @@ class WirelessAdbPairingService : Service() {
|
||||
|
||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||
when (intent?.action) {
|
||||
ACTION_CODE -> {
|
||||
val code = RemoteInput.getResultsFromIntent(intent)?.getCharSequence(KEY_CODE)
|
||||
?.filter(Char::isDigit)?.toString().orEmpty()
|
||||
onCode(code)
|
||||
ACTION_KEYPAD -> {
|
||||
if (intent.data?.host == keypadToken && current.value is Stage.CodeNeeded && !working) {
|
||||
val key = intent.data?.lastPathSegment?.toIntOrNull()
|
||||
if (key == WirelessPairingKeypad.SUBMIT) {
|
||||
if (keypad.ready && pairingPort != null) onCode(keypad.digits)
|
||||
} else if (key != null && keypad.press(key)) {
|
||||
show(current.value, quietUpdate = true)
|
||||
}
|
||||
} else if (current.value == Stage.Idle) {
|
||||
stopSelf(startId)
|
||||
}
|
||||
}
|
||||
ACTION_CANCEL -> finish(Stage.Idle)
|
||||
else -> begin(intent?.getBooleanExtra(EXTRA_ENABLE_LIMIT, false) == true)
|
||||
null -> begin(intent?.getBooleanExtra(EXTRA_ENABLE_LIMIT, false) == true)
|
||||
else -> if (discovery == null && !working) stopSelf(startId)
|
||||
}
|
||||
return START_NOT_STICKY
|
||||
}
|
||||
@@ -60,11 +73,13 @@ class WirelessAdbPairingService : Service() {
|
||||
private fun begin(enableLimit: Boolean) {
|
||||
if (working) return
|
||||
session++
|
||||
resetKeypad()
|
||||
limitEnabled = enableLimit
|
||||
pairingHost = null
|
||||
pairingPort = null
|
||||
working = false
|
||||
publish(Stage.Waiting)
|
||||
getSystemService(NotificationManager::class.java)?.cancel(KEYPAD_NOTIFICATION_ID)
|
||||
startForeground(NOTIFICATION_ID, notification(Stage.Waiting))
|
||||
startDiscovery()
|
||||
main.removeCallbacks(timeout)
|
||||
@@ -101,9 +116,13 @@ class WirelessAdbPairingService : Service() {
|
||||
if (!WirelessAdbFix.isLocalAddress(address)) return
|
||||
main.post {
|
||||
if (owner != session || working || current.value == Stage.Done) return@post
|
||||
val endpointChanged = pairingHost != address.hostAddress || pairingPort != serviceInfo.port
|
||||
pairingHost = address.hostAddress
|
||||
pairingPort = serviceInfo.port
|
||||
if (current.value !is Stage.CodeNeeded) show(Stage.CodeNeeded())
|
||||
if (endpointChanged) {
|
||||
resetKeypad()
|
||||
show(Stage.CodeNeeded())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,11 +136,12 @@ class WirelessAdbPairingService : Service() {
|
||||
show(Stage.Waiting)
|
||||
return
|
||||
}
|
||||
if (code.length != 6) {
|
||||
if (code.length != WirelessPairingKeypad.LENGTH) {
|
||||
show(Stage.CodeNeeded(getString(R.string.adbpair_six_digits)))
|
||||
return
|
||||
}
|
||||
working = true
|
||||
resetKeypad()
|
||||
val owner = session
|
||||
val enable = limitEnabled
|
||||
show(Stage.Working(getString(R.string.adbpair_pairing)))
|
||||
@@ -155,17 +175,34 @@ class WirelessAdbPairingService : Service() {
|
||||
}, "wireless-adb-pairing").start()
|
||||
}
|
||||
|
||||
private fun show(stage: Stage) {
|
||||
private fun show(stage: Stage, quietUpdate: Boolean = false) {
|
||||
publish(stage)
|
||||
getSystemService(NotificationManager::class.java)?.notify(NOTIFICATION_ID, notification(stage))
|
||||
val manager = getSystemService(NotificationManager::class.java) ?: return
|
||||
if (stage is Stage.CodeNeeded) {
|
||||
// A new high-priority notification can pop over Settings. Updating the
|
||||
// quiet foreground-service notification can leave the keypad in the shade.
|
||||
// End any previous indeterminate progress even if this is a code retry.
|
||||
if (!quietUpdate) manager.notify(NOTIFICATION_ID, notification(stage, foregroundCodeEntry = true))
|
||||
manager.notify(KEYPAD_NOTIFICATION_ID, notification(stage, quietUpdate))
|
||||
} else {
|
||||
manager.cancel(KEYPAD_NOTIFICATION_ID)
|
||||
manager.notify(NOTIFICATION_ID, notification(stage, quietUpdate))
|
||||
}
|
||||
}
|
||||
|
||||
private fun resetKeypad() {
|
||||
keypad.clear()
|
||||
keypadToken = UUID.randomUUID().toString()
|
||||
}
|
||||
|
||||
private fun finish(stage: Stage) {
|
||||
session++
|
||||
resetKeypad()
|
||||
main.removeCallbacks(timeout)
|
||||
stopDiscovery()
|
||||
publish(stage)
|
||||
val manager = getSystemService(NotificationManager::class.java)
|
||||
manager?.cancel(KEYPAD_NOTIFICATION_ID)
|
||||
if (stage is Stage.Done || stage is Stage.Failed) {
|
||||
manager?.notify(NOTIFICATION_ID, notification(stage))
|
||||
stopForeground(STOP_FOREGROUND_DETACH)
|
||||
@@ -183,13 +220,16 @@ class WirelessAdbPairingService : Service() {
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
getSystemService(NotificationManager::class.java)?.cancel(KEYPAD_NOTIFICATION_ID)
|
||||
main.removeCallbacks(timeout)
|
||||
stopDiscovery()
|
||||
if (current.value.let { it is Stage.Waiting || it is Stage.CodeNeeded || it is Stage.Working }) publish(Stage.Idle)
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
private fun notification(stage: Stage): Notification {
|
||||
private fun notification(
|
||||
stage: Stage, quietUpdate: Boolean = false, foregroundCodeEntry: Boolean = false,
|
||||
): Notification {
|
||||
val manager = getSystemService(NotificationManager::class.java)
|
||||
manager?.createNotificationChannel(NotificationChannel(CHANNEL_ID, getString(R.string.adbpair_channel_name),
|
||||
NotificationManager.IMPORTANCE_HIGH).apply {
|
||||
@@ -205,7 +245,7 @@ class WirelessAdbPairingService : Service() {
|
||||
PendingIntent.FLAG_IMMUTABLE)
|
||||
val cancel = PendingIntent.getService(this, 1,
|
||||
Intent(this, WirelessAdbPairingService::class.java).setAction(ACTION_CANCEL), PendingIntent.FLAG_IMMUTABLE)
|
||||
val quiet = stage == Stage.Waiting || stage == Stage.Idle || stage is Stage.Working
|
||||
val quiet = foregroundCodeEntry || stage == Stage.Waiting || stage == Stage.Idle || stage is Stage.Working
|
||||
val builder = Notification.Builder(this, if (quiet) PROGRESS_CHANNEL_ID else CHANNEL_ID)
|
||||
.setSmallIcon(R.drawable.ic_stat_session)
|
||||
.setContentIntent(open)
|
||||
@@ -220,19 +260,31 @@ class WirelessAdbPairingService : Service() {
|
||||
.setOnlyAlertOnce(true)
|
||||
.addAction(Notification.Action.Builder(null, getString(R.string.common_cancel), cancel).build())
|
||||
is Stage.CodeNeeded -> {
|
||||
val reply = PendingIntent.getService(this, 2,
|
||||
Intent(this, WirelessAdbPairingService::class.java).setAction(ACTION_CODE),
|
||||
if (Build.VERSION.SDK_INT >= 31) PendingIntent.FLAG_MUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
|
||||
else PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
val input = RemoteInput.Builder(KEY_CODE).setLabel(getString(R.string.adbpair_code_label)).build()
|
||||
val text = stage.error ?: getString(R.string.adbpair_code_hint)
|
||||
builder
|
||||
.setContentTitle(getString(if (stage.error == null) R.string.adbpair_title_code else R.string.adbpair_title_retry))
|
||||
.setContentText(text)
|
||||
.setStyle(Notification.BigTextStyle().bigText(text))
|
||||
.setContentTitle(getString(if (foregroundCodeEntry) R.string.adbpair_title_pair
|
||||
else if (stage.error == null) R.string.adbpair_title_code else R.string.adbpair_title_retry))
|
||||
.setContentIntent(null)
|
||||
.setVisibility(Notification.VISIBILITY_SECRET)
|
||||
.setLocalOnly(true)
|
||||
.setOngoing(true)
|
||||
.addAction(Notification.Action.Builder(null, getString(R.string.adbpair_enter_code), reply).addRemoteInput(input).build())
|
||||
.addAction(Notification.Action.Builder(null, getString(R.string.common_cancel), cancel).build())
|
||||
.setOnlyAlertOnce(foregroundCodeEntry || quietUpdate)
|
||||
if (!foregroundCodeEntry) {
|
||||
// Keep the keypad separate from status/install notifications. Android owns
|
||||
// the heads-up timeout; the drawer remains usable without expanding a group.
|
||||
builder.setGroup(KEYPAD_GROUP)
|
||||
.addAction(Notification.Action.Builder(null, getString(R.string.common_cancel), cancel).build())
|
||||
if (stage.error != null && pairingPort == null) {
|
||||
builder.setContentText(stage.error)
|
||||
.setStyle(Notification.BigTextStyle().bigText(stage.error))
|
||||
} else {
|
||||
builder.setStyle(Notification.DecoratedCustomViewStyle())
|
||||
.setCustomBigContentView(pairingKeypad())
|
||||
.setCustomHeadsUpContentView(pairingKeypad(keyHeightDp = 24))
|
||||
if (Build.VERSION.SDK_INT >= 31) {
|
||||
builder.setCustomContentView(pairingKeypad(keyHeightDp = 21))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is Stage.Working -> builder
|
||||
.setContentTitle(getString(R.string.adbpair_title_working))
|
||||
@@ -254,14 +306,39 @@ class WirelessAdbPairingService : Service() {
|
||||
return builder.build()
|
||||
}
|
||||
|
||||
private fun pairingKeypad(keyHeightDp: Int? = null): RemoteViews = RemoteViews(packageName, R.layout.wireless_pairing_keypad).apply {
|
||||
val ids = intArrayOf(R.id.pair_key_0, R.id.pair_key_1, R.id.pair_key_2, R.id.pair_key_3, R.id.pair_key_4,
|
||||
R.id.pair_key_5, R.id.pair_key_6, R.id.pair_key_7, R.id.pair_key_8, R.id.pair_key_9,
|
||||
R.id.pair_key_delete, R.id.pair_key_submit)
|
||||
ids.forEachIndexed { key, id ->
|
||||
if (keyHeightDp != null && Build.VERSION.SDK_INT >= 31) {
|
||||
// Fit both rows inside the system template's heads-up or collapsed height.
|
||||
setViewLayoutHeight(id, keyHeightDp.toFloat(), TypedValue.COMPLEX_UNIT_DIP)
|
||||
setViewLayoutMargin(id, RemoteViews.MARGIN_TOP, 1f, TypedValue.COMPLEX_UNIT_DIP)
|
||||
setViewLayoutMargin(id, RemoteViews.MARGIN_BOTTOM, 1f, TypedValue.COMPLEX_UNIT_DIP)
|
||||
setTextViewTextSize(id, TypedValue.COMPLEX_UNIT_SP, if (keyHeightDp < 24) 14f else 15f)
|
||||
}
|
||||
val intent = Intent(this@WirelessAdbPairingService, WirelessAdbPairingService::class.java)
|
||||
.setAction(ACTION_KEYPAD)
|
||||
.setData(Uri.Builder().scheme("droiddeck-pairing").authority(keypadToken).appendPath(key.toString()).build())
|
||||
val press = PendingIntent.getService(this@WirelessAdbPairingService, key, intent, PendingIntent.FLAG_IMMUTABLE)
|
||||
setOnClickPendingIntent(id, press)
|
||||
}
|
||||
setTextViewText(R.id.pair_key_code, keypad.display)
|
||||
setContentDescription(R.id.pair_key_code, getString(R.string.adbpair_keypad_entered, keypad.digits.length))
|
||||
setBoolean(R.id.pair_key_delete, "setEnabled", keypad.digits.isNotEmpty())
|
||||
setBoolean(R.id.pair_key_submit, "setEnabled", keypad.ready && pairingPort != null)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val CHANNEL_ID = "wireless-adb-pairing"
|
||||
private const val PROGRESS_CHANNEL_ID = "wireless-adb-pairing-progress"
|
||||
private const val NOTIFICATION_ID = 3
|
||||
private const val KEYPAD_NOTIFICATION_ID = 3403
|
||||
private const val KEYPAD_GROUP = "wireless-adb-keypad"
|
||||
private const val PAIRING_TYPE = "_adb-tls-pairing._tcp"
|
||||
private const val ACTION_CODE = "com.droiddeck.launcher.action.WIRELESS_ADB_CODE"
|
||||
private const val ACTION_KEYPAD = "com.droiddeck.launcher.action.WIRELESS_ADB_KEYPAD"
|
||||
private const val ACTION_CANCEL = "com.droiddeck.launcher.action.WIRELESS_ADB_CANCEL"
|
||||
private const val KEY_CODE = "code"
|
||||
private const val EXTRA_ENABLE_LIMIT = "enable_limit"
|
||||
private const val TIMEOUT_MS = 5 * 60_000L
|
||||
|
||||
@@ -288,7 +365,7 @@ class WirelessAdbPairingService : Service() {
|
||||
fun notificationsEnabled(context: Context): Boolean =
|
||||
context.getSystemService(NotificationManager::class.java)?.areNotificationsEnabled() != false && !channelBlocked(context)
|
||||
|
||||
/** The code is typed into a notification on this channel; a channel the user switched off leaves pairing with nothing to type into. */
|
||||
/** Pairing needs this notification channel to show the keypad over Android Settings. */
|
||||
fun channelBlocked(context: Context): Boolean =
|
||||
context.getSystemService(NotificationManager::class.java)?.getNotificationChannel(CHANNEL_ID)?.importance == NotificationManager.IMPORTANCE_NONE
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.droiddeck.launcher.core
|
||||
|
||||
internal class WirelessPairingKeypad {
|
||||
var digits = ""
|
||||
private set
|
||||
val ready: Boolean get() = digits.length == LENGTH
|
||||
val display: String get() = digits.padEnd(LENGTH, '–')
|
||||
|
||||
fun press(key: Int): Boolean {
|
||||
val next = when {
|
||||
key == DELETE -> digits.dropLast(1)
|
||||
key in 0..9 && !ready -> digits + key
|
||||
else -> digits
|
||||
}
|
||||
if (next == digits) return false
|
||||
digits = next
|
||||
return true
|
||||
}
|
||||
|
||||
fun clear() {
|
||||
digits = ""
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val LENGTH = 6
|
||||
const val DELETE = 10
|
||||
const val SUBMIT = 11
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,15 @@ object AllFilesAccess {
|
||||
fun missing(sdk: Int = Build.VERSION.SDK_INT, granted: () -> Boolean = { Environment.isExternalStorageManager() }): Boolean =
|
||||
sdk >= Build.VERSION_CODES.R && !granted()
|
||||
|
||||
fun state(sdk: Int = Build.VERSION.SDK_INT, granted: () -> Boolean = { Environment.isExternalStorageManager() }): String = when {
|
||||
sdk < Build.VERSION_CODES.R -> "not needed"
|
||||
granted() -> "granted"
|
||||
else -> "missing"
|
||||
}
|
||||
|
||||
fun mayHideFilesIn(path: String, sdk: Int = Build.VERSION.SDK_INT, granted: () -> Boolean = { Environment.isExternalStorageManager() }): Boolean =
|
||||
covers(path) && missing(sdk, granted)
|
||||
|
||||
/** Whether reading [path] takes all-files access: shared storage, outside the per-app folders directly under a volume's root, which Android always lets the app use. */
|
||||
fun covers(path: String): Boolean {
|
||||
val inside = VOLUME.matchEntire(path)?.groupValues?.get(2) ?: return false
|
||||
|
||||
@@ -154,6 +154,15 @@ object ControllerPrefs {
|
||||
prefs(context).edit().putBoolean("snap", on).apply()
|
||||
}
|
||||
|
||||
/** Layout editor grid cells across the width: 0 (no grid), or one of [editorGrids]. */
|
||||
val editorGrids = listOf(0, 50, 25)
|
||||
|
||||
fun editorGrid(context: Context): Int = prefs(context).getInt("editorGrid", 0).takeIf { it in editorGrids } ?: 0
|
||||
|
||||
fun setEditorGrid(context: Context, cells: Int) {
|
||||
prefs(context).edit().putInt("editorGrid", cells.takeIf { it in editorGrids } ?: 0).apply()
|
||||
}
|
||||
|
||||
fun layout(context: Context, width: Int, height: Int): Map<String, Pair<Float, Float>> {
|
||||
val raw = prefs(context).getString("layout.${width}x$height", null) ?: return emptyMap()
|
||||
return raw.split(';').mapNotNull { entry ->
|
||||
|
||||
@@ -29,12 +29,24 @@ internal object InputLayoutFile {
|
||||
)
|
||||
private val CODES: Map<String, Int> = NAMES.entries.associate { (code, name) -> name to code }
|
||||
|
||||
/** Whether [parse] keeps a binding with this name. */
|
||||
internal fun knows(binding: String) = binding in CODES
|
||||
|
||||
/** Winlator lays out every .icp for a landscape screen, whichever way the device is held when it is read or written. */
|
||||
internal fun landscape(width: Int, height: Int) = if (height > width) height to width else width to height
|
||||
|
||||
/** Marks a DroidDeck export of a layout that has only a portrait arrangement; Winlator ignores unknown fields. */
|
||||
private const val PORTRAIT = "droiddeckPortrait"
|
||||
|
||||
fun fileName(layout: SavedInputLayout) = layout.name.replace(Regex("[^A-Za-z0-9 _.-]"), "_").trim().ifEmpty { "droiddeck-layout" } + ".icp"
|
||||
|
||||
fun export(layout: SavedInputLayout, bindings: SavedInputBindings?, width: Int, height: Int): String? {
|
||||
fun export(layout: SavedInputLayout, bindings: SavedInputBindings?, screenWidth: Int, screenHeight: Int): String? {
|
||||
val portraitOnly = layout.aspect > 0f && layout.aspect < 1f && (layout.rotated.isEmpty() || layout.rotatedAspect <= 1f)
|
||||
val arrangement = if (layout.aspect > 0f && layout.aspect < 1f && !portraitOnly) layout.rotated else layout.elements
|
||||
val (width, height) = landscape(screenWidth, screenHeight).let { (w, h) -> if (portraitOnly) h to w else w to h }
|
||||
val snap = width.coerceAtLeast(1) / 100f
|
||||
val elements = JSONArray()
|
||||
for (e in layout.elements) {
|
||||
for (e in arrangement) {
|
||||
val action = bindings?.action(e) ?: InputAction.Disabled
|
||||
val directional = e.kind == InputElementKind.DPAD || e.kind == InputElementKind.STICK
|
||||
val codes = when {
|
||||
@@ -69,7 +81,8 @@ internal object InputLayoutFile {
|
||||
.apply { if (e.opacity < 1f) put("opacity", e.opacity.toDouble()) })
|
||||
}
|
||||
if (elements.length() == 0) return null
|
||||
return JSONObject().put("id", 0).put("name", layout.name).put("cursorSpeed", 1.5).put("elements", elements).toString()
|
||||
return JSONObject().put("id", 0).put("name", layout.name).put("cursorSpeed", 1.5).put("elements", elements)
|
||||
.apply { if (portraitOnly) put(PORTRAIT, true) }.toString()
|
||||
}
|
||||
|
||||
fun parse(raw: String, width: Int, density: Float): List<LegacyScreenKey>? {
|
||||
@@ -106,13 +119,16 @@ internal object InputLayoutFile {
|
||||
text = element.optString("text").trim().take(24),
|
||||
opacity = element.optDouble("opacity", 1.0).toFloat().takeIf { it.isFinite() }?.coerceIn(.2f, 1f) ?: 1f,
|
||||
shape = shape, toggle = element.optBoolean("toggleSwitch"))
|
||||
// Preserve main's import behavior: accept the first 64 usable controls.
|
||||
if (keys.size == 64) break
|
||||
}
|
||||
return keys
|
||||
}
|
||||
|
||||
fun import(context: Context, raw: String, fallbackName: String, screen: InputLayoutScreen, style: InputSurfaceStyle,
|
||||
width: Int, height: Int, density: Float, id: String = newInputId()): Pair<SavedInputLayout, SavedInputBindings>? {
|
||||
screenWidth: Int, screenHeight: Int, density: Float, id: String = newInputId()): Pair<SavedInputLayout, SavedInputBindings>? {
|
||||
val portrait = runCatching { JSONObject(raw).optBoolean(PORTRAIT) }.getOrDefault(false)
|
||||
val (width, height) = landscape(screenWidth, screenHeight).let { (w, h) -> if (portrait) h to w else w to h }
|
||||
val keys = parse(raw, width, density)?.takeIf { it.isNotEmpty() } ?: return null
|
||||
val converted = runCatching { LegacyScreenKeyMigration.convert(context, keys, width, height, density) }.getOrNull() ?: return null
|
||||
val name = runCatching { JSONObject(raw).optString("name") }.getOrNull().orEmpty().trim().take(80).ifEmpty { fallbackName.trim().take(80) }
|
||||
|
||||
@@ -10,7 +10,8 @@ import org.json.JSONObject
|
||||
import java.util.UUID
|
||||
|
||||
object InputLibraries {
|
||||
private const val VERSION = 14
|
||||
// 15 and 16 belong to the reverted controller redesign; see redesignVersions.
|
||||
private const val VERSION = 17
|
||||
private val redesignVersions = 15..16
|
||||
private const val KIT_DPAD = "kit:dpad"
|
||||
private const val KEYBOARD = "builtin:keyboard"
|
||||
@@ -371,8 +372,14 @@ object InputLibraries {
|
||||
selection.parts.forEach { (role, id) -> parts.put(role.name, id) }
|
||||
selections.put(mode, JSONObject().put("profile", selection.profile).put("parts", parts).put("profileSelected", selection.profileSelected))
|
||||
}
|
||||
val games = JSONObject()
|
||||
for ((key, game) in library.games) {
|
||||
val parts = JSONObject()
|
||||
game.parts.forEach { (role, part) -> parts.put(role.name, JSONObject().put("bindings", part.bindings).put("layout", part.layout)) }
|
||||
games.put(key, JSONObject().put("name", game.name).put("profile", game.profile ?: JSONObject.NULL).put("parts", parts))
|
||||
}
|
||||
return JSONObject().put("selections", selections).put("version", VERSION).put("selected", library.selected).put("steam", library.steam).put("desktop", library.desktop)
|
||||
.put("profiles", profiles).put("layouts", layouts).put("bindings", bindings).toString()
|
||||
.put("profiles", profiles).put("layouts", layouts).put("bindings", bindings).put("games", games).toString()
|
||||
}
|
||||
|
||||
internal fun decode(raw: String, context: Context? = null): InputLibrary? = runCatching {
|
||||
@@ -422,7 +429,17 @@ object InputLibraries {
|
||||
value.optBoolean("profileSelected", profile != InputProfiles.AUTO || parts.length() == 0))
|
||||
}
|
||||
}.orEmpty()
|
||||
val library = InputLibrary(profiles, layouts, bindings, doc.getString("selected"), doc.getString("steam"), doc.getString("desktop"), selections)
|
||||
val games = doc.optJSONObject("games")?.let { saved ->
|
||||
require(saved.length() <= 512)
|
||||
saved.keys().asSequence().associateWith { key ->
|
||||
val game = saved.getJSONObject(key)
|
||||
val parts = game.getJSONObject("parts")
|
||||
GameInput(game.getString("name"), game.optionalString("profile"), parts.keys().asSequence().associate { role ->
|
||||
val part = parts.getJSONObject(role); InputRole.valueOf(role) to InputPart(part.getString("bindings"), part.optionalString("layout"))
|
||||
})
|
||||
}
|
||||
}.orEmpty()
|
||||
val library = InputLibrary(profiles, layouts, bindings, doc.getString("selected"), doc.getString("steam"), doc.getString("desktop"), selections, games)
|
||||
(if (restore) restoreGamepads(requireNotNull(context), library, generated) else library).validate()
|
||||
}.getOrNull()
|
||||
|
||||
|
||||
@@ -1,7 +1,17 @@
|
||||
package com.droiddeck.launcher.input
|
||||
|
||||
import java.security.MessageDigest
|
||||
import java.util.UUID
|
||||
|
||||
private const val MAX_INPUT_GAME_KEY_LENGTH = 128
|
||||
|
||||
/** Keep existing keys intact; long ad-hoc launch paths have no stable short game ID. */
|
||||
internal fun boundedInputGameKey(key: String): String {
|
||||
if (key.length <= MAX_INPUT_GAME_KEY_LENGTH || !key.startsWith("program:")) return key
|
||||
val digest = MessageDigest.getInstance("SHA-256").digest(key.toByteArray(Charsets.UTF_8))
|
||||
return "program-sha256:" + digest.joinToString("") { "%02x".format(it.toInt() and 0xff) }
|
||||
}
|
||||
|
||||
enum class InputLayoutTemplate { CUSTOM, OVERLAY, DECK, TRACKPAD }
|
||||
|
||||
enum class InputLayoutScreen { MAIN, SECONDARY, BOTH;
|
||||
@@ -69,11 +79,15 @@ data class SavedInputProfile(val id: String, val name: String, val base: String,
|
||||
fun binding(role: InputRole) = parts.getValue(role).bindings
|
||||
}
|
||||
|
||||
/** One game's own controls: a profile it always uses, and parts copied from that profile and then changed for it alone. */
|
||||
data class GameInput(val name: String, val profile: String? = null, val parts: Map<InputRole, InputPart> = emptyMap())
|
||||
|
||||
data class InputLibrary(
|
||||
val profiles: List<SavedInputProfile>, val layouts: List<SavedInputLayout>, val bindings: List<SavedInputBindings>,
|
||||
val selected: String = InputProfiles.AUTO,
|
||||
val steam: String = InputProfile.GAME, val desktop: String = InputProfile.DESKTOP,
|
||||
val selections: Map<String, InputSelection> = emptyMap(),
|
||||
val games: Map<String, GameInput> = emptyMap(),
|
||||
) {
|
||||
fun profile(id: String) = profiles.first { it.id == id }
|
||||
fun preset(id: String) = bindings.first { it.id == id }
|
||||
@@ -81,31 +95,42 @@ data class InputLibrary(
|
||||
?.let { id -> layouts.firstOrNull { it.id == id } }
|
||||
private fun mode(isDesktop: Boolean) = if (isDesktop) InputProfile.DESKTOP else InputProfile.GAME
|
||||
fun selection(isDesktop: Boolean) = selections[mode(isDesktop)] ?: InputSelection(selected)
|
||||
fun activeId(isDesktop: Boolean): String {
|
||||
fun defaultId(isDesktop: Boolean) = if (isDesktop) desktop else steam
|
||||
fun activeId(isDesktop: Boolean, game: String? = null): String {
|
||||
games[game]?.profile?.let { return it }
|
||||
val id = selection(isDesktop).profile
|
||||
return if (id == InputProfiles.AUTO) { if (isDesktop) desktop else steam } else id
|
||||
return if (id == InputProfiles.AUTO) defaultId(isDesktop) else id
|
||||
}
|
||||
fun selectProfile(isDesktop: Boolean, id: String) = copy(selections = selections + (mode(isDesktop) to InputSelection(id, profileSelected = true)))
|
||||
fun selectPart(isDesktop: Boolean, role: InputRole, bindingsId: String): InputLibrary {
|
||||
require(!isGameOwnedBindings(bindingsId)) { "Game-owned mappings cannot be used as shared mappings" }
|
||||
val previous = selection(isDesktop)
|
||||
return copy(selections = selections + (mode(isDesktop) to previous.copy(parts = previous.parts + (role to bindingsId))))
|
||||
}
|
||||
fun activePart(isDesktop: Boolean, role: InputRole): InputPart {
|
||||
val binding = selection(isDesktop).parts[role]?.let(::preset)
|
||||
return if (binding != null) InputPart(binding.id, binding.layoutId) else profile(activeId(isDesktop)).parts.getValue(role)
|
||||
fun activePart(isDesktop: Boolean, role: InputRole, game: String? = null): InputPart {
|
||||
games[game]?.parts?.get(role)?.let { return it }
|
||||
val binding = selection(isDesktop).parts[role]?.takeIf { games[game]?.profile == null }?.let(::preset)
|
||||
return if (binding != null) InputPart(binding.id, binding.layoutId) else profile(activeId(isDesktop, game)).parts.getValue(role)
|
||||
}
|
||||
fun activeLayout(isDesktop: Boolean, role: InputRole) = activePart(isDesktop, role).layout?.let { id -> layouts.first { it.id == id } }
|
||||
fun panelPart(isDesktop: Boolean, panel: String?): InputPart =
|
||||
panel?.let { id -> bindings.firstOrNull { it.id == id } }?.let { InputPart(it.id, it.layoutId) } ?: activePart(isDesktop, InputRole.SECONDARY)
|
||||
fun panelLayout(isDesktop: Boolean, panel: String?) = panelPart(isDesktop, panel).layout?.let { id -> layouts.firstOrNull { it.id == id } }
|
||||
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)
|
||||
/** The part the game would use without its own copy, including the live shared mix when unpinned. */
|
||||
fun inheritedGamePart(isDesktop: Boolean, role: InputRole, game: String): InputPart {
|
||||
val current = games[game] ?: return activePart(isDesktop, role)
|
||||
return copy(games = games + (game to current.copy(parts = current.parts - role))).activePart(isDesktop, role, game)
|
||||
}
|
||||
fun activeLayout(isDesktop: Boolean, role: InputRole, game: String? = null) =
|
||||
activePart(isDesktop, role, game).layout?.let { id -> layouts.first { it.id == id } }
|
||||
fun panelPart(isDesktop: Boolean, panel: String?, game: String? = null): InputPart =
|
||||
panel?.let { id -> bindings.firstOrNull { it.id == id } }?.let { InputPart(it.id, it.layoutId) } ?: activePart(isDesktop, InputRole.SECONDARY, game)
|
||||
fun panelLayout(isDesktop: Boolean, panel: String?, game: String? = null) =
|
||||
panelPart(isDesktop, panel, game).layout?.let { id -> layouts.firstOrNull { it.id == id } }
|
||||
fun compileActive(isDesktop: Boolean, panel: String? = null, game: String? = null): InputProfile = compileParts(activeId(isDesktop, game), InputRole.entries.associateWith {
|
||||
preset(if (it == InputRole.SECONDARY) panelPart(isDesktop, panel, game).bindings else activePart(isDesktop, it, game).bindings)
|
||||
})
|
||||
fun compileStock(isDesktop: Boolean, panel: String? = null): InputProfile {
|
||||
val defaults = InputProfile.defaults(profile(activeId(isDesktop)).base)
|
||||
fun compileStock(isDesktop: Boolean, panel: String? = null, game: String? = null): InputProfile {
|
||||
val defaults = InputProfile.defaults(profile(activeId(isDesktop, game)).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 part = if (role == InputRole.SECONDARY) panelPart(isDesktop, panel, game) else activePart(isDesktop, role, game)
|
||||
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())
|
||||
@@ -133,9 +158,80 @@ data class InputLibrary(
|
||||
parts.mapValues { it.value.clicks }.filterValues { it.isNotEmpty() })
|
||||
}
|
||||
|
||||
fun isGameOwnedBindings(id: String) = games.values.any { game -> game.parts.values.any { it.bindings == id } }
|
||||
fun usersOfBindings(id: String) = profiles.filter { p -> p.parts.values.any { it.bindings == id } }
|
||||
fun selectedBindings(id: String) = selections.values.any { id in it.parts.values }
|
||||
fun selectedBindings(id: String) = selections.values.any { id in it.parts.values } || games.values.any { g -> g.parts.values.any { it.bindings == id } }
|
||||
fun usersOfLayout(id: String) = profiles.filter { p -> p.parts.values.any { it.layout == id } }
|
||||
/** Game-owned editable copies are not reusable shared defaults; built-in layouts can still be used by both. */
|
||||
fun isGameOwnedLayout(id: String) = layouts.any { it.id == id && it.editable } && gamesUsingLayout(id)
|
||||
|
||||
fun sharedLayouts(role: InputRole): List<SavedInputLayout> {
|
||||
val gameLayouts = games.values.flatMap { it.parts.values }.mapNotNull { it.layout }.toSet()
|
||||
return layouts.filter { it.supports(role) && !(it.editable && it.id in gameLayouts) }
|
||||
}
|
||||
|
||||
private fun gamesUsingLayout(id: String) = games.values.any { g -> g.parts.values.any { it.layout == id } }
|
||||
|
||||
/** Gives [game] its own copy of the part it uses for [role], so edits made for it leave the profile alone. */
|
||||
fun withGamePart(isDesktop: Boolean, game: String, name: String, role: InputRole,
|
||||
bindingsId: String = newInputId(), layoutId: String = newInputId()): InputLibrary {
|
||||
val current = games[game] ?: GameInput(inputName(name))
|
||||
if (role in current.parts) return this
|
||||
val source = activePart(isDesktop, role, game)
|
||||
val label = (current.name + " / " + role.name.lowercase()).take(80)
|
||||
val sourceLayout = source.layout?.let { id -> layouts.first { it.id == id } }
|
||||
val copiedLayout = sourceLayout?.takeIf { it.editable }?.derived(layoutId, label)
|
||||
val copied = preset(source.bindings).copy(id = bindingsId, name = label, layoutId = copiedLayout?.id ?: preset(source.bindings).layoutId)
|
||||
val part = InputPart(copied.id, copiedLayout?.id ?: source.layout)
|
||||
return (if (copiedLayout == null) this else withLayout(copiedLayout)).withPreset(copied)
|
||||
.copy(games = games + (game to current.copy(parts = current.parts + (role to part))))
|
||||
}
|
||||
|
||||
fun withGameProfile(game: String, name: String, profile: String?): InputLibrary {
|
||||
require(profile == null || profiles.any { it.id == profile })
|
||||
val current = games[game] ?: GameInput(inputName(name))
|
||||
val next = current.copy(profile = profile)
|
||||
return copy(games = if (next.profile == null && next.parts.isEmpty()) games - game else games + (game to next))
|
||||
}
|
||||
|
||||
/** Drops [game]'s own controls (one part, or all of them) and the copies nothing else uses. */
|
||||
fun resetGame(game: String, role: InputRole? = null): InputLibrary {
|
||||
val current = games[game] ?: return this
|
||||
val dropped = if (role == null) current.parts.values.toList() else listOfNotNull(current.parts[role])
|
||||
val remaining = if (role == null) null else current.copy(parts = current.parts - role).takeIf { it.profile != null || it.parts.isNotEmpty() }
|
||||
var result = copy(games = if (remaining == null) games - game else games + (game to remaining))
|
||||
for (part in dropped) {
|
||||
if (result.usersOfBindings(part.bindings).isEmpty() && !result.selectedBindings(part.bindings))
|
||||
result = result.copy(bindings = result.bindings.filterNot { it.id == part.bindings })
|
||||
val layout = part.layout ?: continue
|
||||
if (result.usersOfLayout(layout).isEmpty() && !result.gamesUsingLayout(layout) && result.layouts.first { it.id == layout }.editable &&
|
||||
result.bindings.none { it.layoutId == layout })
|
||||
result = result.copy(layouts = result.layouts.filterNot { it.id == layout })
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
/** How many controls [game]'s own parts set differently from the profile it would otherwise use. */
|
||||
fun gameChanges(isDesktop: Boolean, game: String, only: InputRole? = null): Int {
|
||||
val current = games[game] ?: return 0
|
||||
return current.parts.entries.filter { only == null || it.key == only }.sumOf { (role, part) ->
|
||||
val base = inheritedGamePart(isDesktop, role, game)
|
||||
val mine = preset(part.bindings)
|
||||
val theirs = preset(base.bindings)
|
||||
val controls = (mine.controls.keys + theirs.controls.keys).count { (mine.controls[it] ?: InputAction.Native()) != (theirs.controls[it] ?: InputAction.Native()) }
|
||||
val keys = (mine.keys.toSet() - theirs.keys.toSet()).size + (theirs.keys.toSet() - mine.keys.toSet()).size
|
||||
val layout = part.layout?.let { id -> layouts.firstOrNull { it.id == id } }
|
||||
val baseLayout = base.layout?.let { id -> layouts.firstOrNull { it.id == id } }
|
||||
val elements = layout?.elements.orEmpty().count { e ->
|
||||
val before = baseLayout?.elements?.firstOrNull { it.id == e.id }
|
||||
before == null || before != e || mine.action(e) != theirs.action(e) || (e.hasClick && mine.clickAction(e) != theirs.clickAction(e))
|
||||
} + if (layout == null) 0 else baseLayout?.elements.orEmpty().count { e -> layout.elements.none { it.id == e.id } }
|
||||
val styled = if (layout != null && layout.id != baseLayout?.id && (baseLayout == null || layout.style != baseLayout.style ||
|
||||
layout.scale != baseLayout.scale || layout.aspect != baseLayout.aspect || layout.rotated != baseLayout.rotated ||
|
||||
layout.rotatedAspect != baseLayout.rotatedAspect || layout.rotatedScale != baseLayout.rotatedScale)) 1 else 0
|
||||
controls + keys + styled + if (layout?.id == baseLayout?.id) 0 else elements
|
||||
}
|
||||
}
|
||||
fun withProfile(value: SavedInputProfile) = copy(profiles = profiles.filterNot { it.id == value.id } + value)
|
||||
fun withPreset(value: SavedInputBindings) = copy(bindings = bindings.filterNot { it.id == value.id } + value)
|
||||
fun withLayout(value: SavedInputLayout) = copy(layouts = layouts.filterNot { it.id == value.id } + value,
|
||||
@@ -164,6 +260,7 @@ data class InputLibrary(
|
||||
}
|
||||
|
||||
fun useLayout(profileId: String, role: InputRole, layoutId: String, shared: Boolean): InputLibrary {
|
||||
require(!isGameOwnedLayout(layoutId)) { "A game-owned layout cannot be used as a shared layout" }
|
||||
val source = layouts.first { it.id == layoutId }
|
||||
require(source.supports(role))
|
||||
val target = profile(profileId)
|
||||
@@ -186,12 +283,14 @@ data class InputLibrary(
|
||||
}
|
||||
|
||||
fun chooseBindings(profileId: String, role: InputRole, id: String): InputLibrary {
|
||||
require(!isGameOwnedBindings(id)) { "Game-owned mappings cannot be used as shared mappings" }
|
||||
val profile = profile(profileId)
|
||||
require(preset(id).compatible(layout(profileId, role)))
|
||||
return withProfile(profile.copy(parts = profile.parts + (role to profile.parts.getValue(role).copy(bindings = id))))
|
||||
}
|
||||
|
||||
fun chooseLayout(profileId: String, role: InputRole, id: String): InputLibrary {
|
||||
require(!isGameOwnedLayout(id)) { "A game-owned layout cannot be used as a shared layout" }
|
||||
val layout = layouts.first { it.id == id }
|
||||
require(layout.supports(role))
|
||||
val profile = profile(profileId)
|
||||
@@ -212,11 +311,12 @@ data class InputLibrary(
|
||||
require(id != InputProfile.GAME && id != InputProfile.DESKTOP)
|
||||
return copy(profiles = profiles.filterNot { it.id == id }, selected = selected.takeUnless { it == id } ?: InputProfiles.AUTO,
|
||||
steam = steam.takeUnless { it == id } ?: InputProfile.GAME, desktop = desktop.takeUnless { it == id } ?: InputProfile.DESKTOP,
|
||||
selections = selections.mapValues { (_, selection) -> if (selection.profile == id) selection.copy(profile = InputProfiles.AUTO) else selection })
|
||||
selections = selections.mapValues { (_, selection) -> if (selection.profile == id) selection.copy(profile = InputProfiles.AUTO) else selection },
|
||||
games = games.mapValues { (_, game) -> if (game.profile == id) game.copy(profile = null) else game }.filterValues { it.profile != null || it.parts.isNotEmpty() })
|
||||
}
|
||||
|
||||
fun removeLayout(id: String): InputLibrary {
|
||||
require(usersOfLayout(id).isEmpty() && bindings.none { it.layoutId == id && selectedBindings(it.id) } && layouts.first { it.id == id }.editable)
|
||||
require(usersOfLayout(id).isEmpty() && !gamesUsingLayout(id) && bindings.none { it.layoutId == id && selectedBindings(it.id) } && layouts.first { it.id == id }.editable)
|
||||
return copy(layouts = layouts.filterNot { it.id == id }, bindings = bindings.filterNot { it.layoutId == id })
|
||||
}
|
||||
|
||||
@@ -292,6 +392,20 @@ data class InputLibrary(
|
||||
require(binding.compatible(layout) && (layout == null || layout.supports(role)))
|
||||
}
|
||||
}
|
||||
require(games.size <= 512)
|
||||
for ((key, game) in games) {
|
||||
require(key.isNotBlank() && key.length <= MAX_INPUT_GAME_KEY_LENGTH)
|
||||
inputName(game.name)
|
||||
require(game.profile == null || profiles.any { it.id == game.profile })
|
||||
require(game.profile != null || game.parts.isNotEmpty())
|
||||
for ((role, part) in game.parts) {
|
||||
val binding = preset(part.bindings)
|
||||
require(binding.physical == (role == InputRole.PHYSICAL))
|
||||
val layout = part.layout?.let { id -> layouts.first { it.id == id } }
|
||||
require(if (role == InputRole.PHYSICAL) layout == null else layout?.supports(role) == true)
|
||||
require(binding.compatible(layout))
|
||||
}
|
||||
}
|
||||
for (p in profiles) {
|
||||
inputName(p.name); require(p.base == InputProfile.GAME || p.base == InputProfile.DESKTOP)
|
||||
require(p.parts.keys == InputRole.entries.toSet())
|
||||
|
||||
@@ -0,0 +1,324 @@
|
||||
package com.droiddeck.launcher.input
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Handler
|
||||
import android.os.IBinder
|
||||
import android.os.Looper
|
||||
import android.os.Parcel
|
||||
import android.provider.Settings
|
||||
import android.util.Log
|
||||
import android.view.InputDevice
|
||||
import android.view.KeyEvent
|
||||
import java.util.EnumMap
|
||||
import java.util.EnumSet
|
||||
import java.util.concurrent.Executor
|
||||
import java.util.concurrent.LinkedBlockingQueue
|
||||
import java.util.concurrent.ThreadPoolExecutor
|
||||
import java.util.concurrent.TimeUnit
|
||||
import org.json.JSONObject
|
||||
|
||||
enum class AirTrigger(val keyCode: Int, val control: InputControl, val pressLight: Int, val releaseLight: Int) {
|
||||
LEFT(KeyEvent.KEYCODE_F7, InputControl.LT, 106, 107), RIGHT(KeyEvent.KEYCODE_F8, InputControl.RT, 108, 109);
|
||||
|
||||
companion object {
|
||||
private const val DEVICE_PREFIX = "nubia_tgk"
|
||||
|
||||
internal fun isTriggerDevice(device: InputDevice?): Boolean {
|
||||
if (device == null) return false
|
||||
if (device.name.startsWith(DEVICE_PREFIX)) return true
|
||||
// Some RedMagic firmware merges the trigger sensors with an unnamed built-in keyboard.
|
||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q &&
|
||||
device.name.isEmpty() && !device.isVirtual && !device.isExternal &&
|
||||
device.supportsSource(InputDevice.SOURCE_KEYBOARD) &&
|
||||
device.hasKeys(LEFT.keyCode, RIGHT.keyCode).all { it }
|
||||
}
|
||||
|
||||
internal fun of(keyCode: Int, device: InputDevice?): AirTrigger? =
|
||||
entries.firstOrNull { it.keyCode == keyCode }?.takeIf { isTriggerDevice(device) }
|
||||
}
|
||||
}
|
||||
|
||||
/** Game Space's single tap holds the button while the trigger is touched; its long press latches it until the next touch. */
|
||||
enum class AirTriggerAction { TAP, LATCH, RAPID }
|
||||
|
||||
/** Game Space's rapid fire counts for its low, normal and high click frequency. */
|
||||
enum class RapidFireRate(val clicksPerSecond: Int) { LOW(2), NORMAL(5), HIGH(10) }
|
||||
|
||||
/** Game Space's touch atmosphere lamp cases, by their name in RedMagic's shoulder light settings. */
|
||||
enum class AirTriggerLed(val effect: String, val fallback: String) {
|
||||
OFF("close", "02000000"), STEADY("steady", "02101000"), PULSE("pulse", "02102000")
|
||||
}
|
||||
|
||||
data class AirTriggerSetup(
|
||||
val element: InputSurfaceElement,
|
||||
val action: AirTriggerAction = AirTriggerAction.TAP,
|
||||
val rate: RapidFireRate = RapidFireRate.NORMAL,
|
||||
) {
|
||||
/** Long press and rapid fire decide when the button is let go, so they press a toggle button as a plain one. */
|
||||
internal val target get() = if (action != AirTriggerAction.TAP && element.toggle) element.copy(toggle = false) else element
|
||||
}
|
||||
|
||||
object AirTriggerButtons {
|
||||
fun options(layout: SavedInputLayout?): List<InputSurfaceElement> {
|
||||
val placed = layout?.let { (it.elements + it.rotated).distinctBy { element -> element.id } }.orEmpty()
|
||||
.filter { it.kind == InputElementKind.BUTTON || it.kind == InputElementKind.TRIGGER }
|
||||
return placed + AirTrigger.entries.filter { trigger -> placed.none { it.control == trigger.control } }
|
||||
.map { InputSurfaceElement(it.control, 0f, 0f, 0f, 0f) }
|
||||
}
|
||||
|
||||
fun resolve(layout: SavedInputLayout?, trigger: AirTrigger, chosen: String?): InputSurfaceElement {
|
||||
val options = options(layout)
|
||||
return chosen?.let { id -> options.firstOrNull { it.id == id } } ?: options.first { it.control == trigger.control }
|
||||
}
|
||||
}
|
||||
|
||||
object AirTriggerPrefs {
|
||||
private const val FILE = "redmagic-air-triggers"
|
||||
private const val ENABLED = "enabled"
|
||||
private const val VIBRATION = "vibration"
|
||||
private const val SCREEN_LIGHT = "screen-light"
|
||||
private const val LED = "led"
|
||||
internal const val OWNED = "distribute-owned"
|
||||
|
||||
fun prefs(context: Context): SharedPreferences = context.getSharedPreferences(FILE, Context.MODE_PRIVATE)
|
||||
fun enabled(context: Context) = prefs(context).getBoolean(ENABLED, false)
|
||||
fun setEnabled(context: Context, on: Boolean) = prefs(context).edit().putBoolean(ENABLED, on).apply()
|
||||
fun button(context: Context, layoutId: String, trigger: AirTrigger): String? = prefs(context).getString(key(layoutId, trigger), null)
|
||||
fun setButton(context: Context, layoutId: String, trigger: AirTrigger, elementId: String) =
|
||||
prefs(context).edit().putString(key(layoutId, trigger), elementId).apply()
|
||||
fun action(context: Context, layoutId: String, trigger: AirTrigger) = read(context, key(layoutId, trigger, "action"), AirTriggerAction.TAP)
|
||||
fun setAction(context: Context, layoutId: String, trigger: AirTrigger, action: AirTriggerAction) =
|
||||
prefs(context).edit().putString(key(layoutId, trigger, "action"), action.name).apply()
|
||||
fun rate(context: Context, layoutId: String, trigger: AirTrigger) = read(context, key(layoutId, trigger, "rate"), RapidFireRate.NORMAL)
|
||||
fun setRate(context: Context, layoutId: String, trigger: AirTrigger, rate: RapidFireRate) =
|
||||
prefs(context).edit().putString(key(layoutId, trigger, "rate"), rate.name).apply()
|
||||
fun vibration(context: Context) = prefs(context).getBoolean(VIBRATION, false)
|
||||
fun setVibration(context: Context, on: Boolean) = prefs(context).edit().putBoolean(VIBRATION, on).apply()
|
||||
fun screenLight(context: Context) = prefs(context).getBoolean(SCREEN_LIGHT, false)
|
||||
fun setScreenLight(context: Context, on: Boolean) = prefs(context).edit().putBoolean(SCREEN_LIGHT, on).apply()
|
||||
fun led(context: Context) = read(context, LED, AirTriggerLed.STEADY)
|
||||
fun setLed(context: Context, led: AirTriggerLed) = prefs(context).edit().putString(LED, led.name).apply()
|
||||
|
||||
private inline fun <reified E : Enum<E>> read(context: Context, key: String, default: E): E =
|
||||
prefs(context).getString(key, null)?.let { name -> enumValues<E>().firstOrNull { it.name == name } } ?: default
|
||||
|
||||
private fun key(layoutId: String, trigger: AirTrigger, setting: String? = null) =
|
||||
listOfNotNull(trigger.name.lowercase(), setting).joinToString("-") + ".$layoutId"
|
||||
}
|
||||
|
||||
/** Game Space's exported provider switches the triggers to plain F7/F8 keys without its panel, and needs no permission. */
|
||||
object RedMagicAirTriggers {
|
||||
private const val TAG = "AirTriggers"
|
||||
private const val AUTHORITY = "cn.nubia.tgk.data.TgkDataProvider"
|
||||
private val URI = Uri.parse("content://$AUTHORITY")
|
||||
private const val OPEN = "openTouchGameKeyDistribute"
|
||||
private const val CLOSE = "closeTouchGameKeyDistribute"
|
||||
private const val SHOULDER_LIGHT_ON = 110
|
||||
private const val SHOULDER_LIGHT_OFF = 111
|
||||
private const val SHOULDER_SETTINGS = "lighting_shoulder_config_json"
|
||||
private val REAPPLY_MS = longArrayOf(1_000, 5_000)
|
||||
internal var worker: Executor = ThreadPoolExecutor(0, 1, 10, TimeUnit.SECONDS, LinkedBlockingQueue()) { Thread(it, "air-triggers") }
|
||||
internal var lights: TriggerLights = ColorfulLights
|
||||
private val main = Handler(Looper.getMainLooper())
|
||||
private var reapply: Runnable? = null
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
fun supported(context: Context) = context.packageManager.resolveContentProvider(AUTHORITY, 0) != null &&
|
||||
InputDevice.getDeviceIds().any { AirTrigger.isTriggerDevice(InputDevice.getDevice(it)) }
|
||||
|
||||
/** Call on the main thread. */
|
||||
fun open(context: Context) {
|
||||
val app = context.applicationContext
|
||||
cancelReapply()
|
||||
worker.execute { apply(app) }
|
||||
// Game Space runs its own trigger setup for the app that comes to the front, which switches the trigger keys and lights off again.
|
||||
val again = Runnable { worker.execute { apply(app) } }
|
||||
reapply = again
|
||||
REAPPLY_MS.forEach { main.postDelayed(again, it) }
|
||||
}
|
||||
|
||||
private fun apply(app: Context) {
|
||||
val prefs = AirTriggerPrefs.prefs(app)
|
||||
if (!prefs.getBoolean(AirTriggerPrefs.OWNED, false) && Settings.Global.getInt(app.contentResolver, OPEN, 0) != 1)
|
||||
prefs.edit().putBoolean(AirTriggerPrefs.OWNED, true).commit()
|
||||
call(app, OPEN)
|
||||
if (!prefs.getBoolean(AirTriggerPrefs.OWNED, false)) return
|
||||
lights.request(SHOULDER_LIGHT_ON)
|
||||
// The light service drops every trigger light until an effect is set, which Game Space only does from its own view.
|
||||
lights.setEffect(shoulderEffect(Settings.Global.getString(app.contentResolver, SHOULDER_SETTINGS), AirTriggerPrefs.led(app)))
|
||||
// Entering the scene turns the lights off; the release actions show the idle light picked in RedMagic's lighting settings.
|
||||
AirTrigger.entries.forEach { lights.request(it.releaseLight) }
|
||||
}
|
||||
|
||||
/** The code RedMagic's shoulder light settings give the effect, such as "02101000" for steady. */
|
||||
internal fun shoulderEffect(settings: String?, led: AirTriggerLed): String = settings
|
||||
?.let { runCatching { JSONObject(it).optJSONObject("shoulder_effects")?.optString(led.effect) }.getOrNull() }
|
||||
?.takeIf { it.length == 8 } ?: led.fallback
|
||||
|
||||
/** Closes only what this app opened, so a distribute another app turned on stays on. Call on the main thread. */
|
||||
fun restore(context: Context) {
|
||||
val app = context.applicationContext
|
||||
cancelReapply()
|
||||
worker.execute {
|
||||
val prefs = AirTriggerPrefs.prefs(app)
|
||||
if (!prefs.getBoolean(AirTriggerPrefs.OWNED, false)) return@execute
|
||||
lights.request(SHOULDER_LIGHT_OFF)
|
||||
if (call(app, CLOSE)) prefs.edit().remove(AirTriggerPrefs.OWNED).commit()
|
||||
}
|
||||
}
|
||||
|
||||
fun light(code: Int) = worker.execute { lights.request(code) }
|
||||
|
||||
private fun cancelReapply() {
|
||||
reapply?.let(main::removeCallbacks)
|
||||
reapply = null
|
||||
}
|
||||
|
||||
private fun call(context: Context, method: String) = runCatching { context.contentResolver.call(URI, method, null, null) != null }
|
||||
.onFailure { Log.w(TAG, "$method failed", it) }.getOrDefault(false)
|
||||
}
|
||||
|
||||
internal interface TriggerLights {
|
||||
fun request(action: Int)
|
||||
fun setEffect(effect: String)
|
||||
}
|
||||
|
||||
private object ColorfulLights : TriggerLights {
|
||||
private const val TAG = "AirTriggers"
|
||||
private const val SERVICE = "ColorfulLightService"
|
||||
private const val INTERFACE = "com.zte.hardware.IColorfulLightManager"
|
||||
// IColorfulLightManager transaction codes; its ColorfulLightManager wrapper is a blocked hidden API.
|
||||
private const val REQUEST_LIGHT = IBinder.FIRST_CALL_TRANSACTION
|
||||
private const val SET_SHOULDER_EFFECT = IBinder.FIRST_CALL_TRANSACTION + 2
|
||||
private val binder: IBinder? by lazy {
|
||||
runCatching { Class.forName("android.os.ServiceManager").getMethod("getService", String::class.java).invoke(null, SERVICE) as IBinder? }
|
||||
.getOrNull()?.takeIf { runCatching { it.interfaceDescriptor }.getOrNull() == INTERFACE }
|
||||
}
|
||||
|
||||
override fun request(action: Int) = transact(REQUEST_LIGHT) { writeInt(action) }
|
||||
override fun setEffect(effect: String) = transact(SET_SHOULDER_EFFECT) { writeString(effect) }
|
||||
|
||||
private fun transact(code: Int, write: Parcel.() -> Unit) {
|
||||
val binder = binder ?: return
|
||||
val data = Parcel.obtain()
|
||||
val reply = Parcel.obtain()
|
||||
try {
|
||||
data.writeInterfaceToken(INTERFACE)
|
||||
data.write()
|
||||
binder.transact(code, data, reply, 0)
|
||||
reply.readException()
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "light call $code failed", e)
|
||||
} finally {
|
||||
data.recycle()
|
||||
reply.recycle()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Presses the chosen button on screen when it is shown, so it animates and keeps one toggle state; otherwise uses a source of its own. */
|
||||
class AirTriggerInput(
|
||||
private val pad: PadBridge,
|
||||
private val onScreen: (elementId: String, trigger: AirTrigger, held: Boolean, cancelled: Boolean) -> Boolean = { _, _, _, _ -> false },
|
||||
private val touched: (AirTrigger, Boolean) -> Unit = { _, _ -> },
|
||||
private val handler: Handler = Handler(Looper.getMainLooper()),
|
||||
) {
|
||||
private val sources = EnumMap<AirTrigger, InputSurfaceSource>(AirTrigger::class.java)
|
||||
private val setups = EnumMap<AirTrigger, AirTriggerSetup>(AirTrigger::class.java)
|
||||
private val held = EnumSet.noneOf(AirTrigger::class.java)
|
||||
private val pressed = EnumSet.noneOf(AirTrigger::class.java)
|
||||
private val heldOnScreen = EnumMap<AirTrigger, String>(AirTrigger::class.java)
|
||||
private val timers = EnumMap<AirTrigger, Runnable>(AirTrigger::class.java)
|
||||
|
||||
fun configure(setups: Map<AirTrigger, AirTriggerSetup>) {
|
||||
for (trigger in AirTrigger.entries) {
|
||||
val setup = setups[trigger]
|
||||
if (this.setups[trigger] == setup) continue
|
||||
stop(trigger)
|
||||
if (sources[trigger]?.element != setup?.target) {
|
||||
pressed.remove(trigger)
|
||||
heldOnScreen.remove(trigger)?.let { onScreen(it, trigger, false, true) }
|
||||
sources.remove(trigger)?.close()
|
||||
if (setup != null) sources[trigger] = InputSurfaceSource(pad, InputRole.PRIMARY, setup.target)
|
||||
} else if (trigger in pressed) unpress(trigger, cancelled = true)
|
||||
if (setup != null) this.setups[trigger] = setup else this.setups.remove(trigger)
|
||||
}
|
||||
}
|
||||
|
||||
fun onKey(event: KeyEvent, enabled: () -> Boolean): Boolean {
|
||||
if (event.keyCode != AirTrigger.LEFT.keyCode && event.keyCode != AirTrigger.RIGHT.keyCode) return false
|
||||
val trigger = AirTrigger.of(event.keyCode, event.device) ?: return false
|
||||
return onKey(trigger, event.action, event.repeatCount, event.action == KeyEvent.ACTION_DOWN && enabled())
|
||||
}
|
||||
|
||||
fun onKey(trigger: AirTrigger, action: Int, repeatCount: Int, enabled: Boolean): Boolean {
|
||||
val source = sources[trigger]
|
||||
when (action) {
|
||||
KeyEvent.ACTION_DOWN -> if (source != null && enabled && repeatCount == 0 && held.add(trigger)) {
|
||||
touched(trigger, true)
|
||||
val setup = setups[trigger]
|
||||
if (setup?.action == AirTriggerAction.LATCH && trigger in pressed) unpress(trigger, cancelled = false)
|
||||
else if (trigger !in pressed) {
|
||||
press(trigger, source)
|
||||
if (setup?.action == AirTriggerAction.RAPID) rapid(trigger, 500L / setup.rate.clicksPerSecond)
|
||||
}
|
||||
}
|
||||
KeyEvent.ACTION_UP -> if (held.remove(trigger)) {
|
||||
touched(trigger, false)
|
||||
if (setups[trigger]?.action != AirTriggerAction.LATCH) {
|
||||
stop(trigger)
|
||||
if (trigger in pressed) unpress(trigger, cancelled = false)
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
return source != null
|
||||
}
|
||||
|
||||
private fun rapid(trigger: AirTrigger, halfPeriod: Long) {
|
||||
val tick = object : Runnable {
|
||||
override fun run() {
|
||||
if (trigger in pressed) unpress(trigger, cancelled = false) else sources[trigger]?.let { press(trigger, it) }
|
||||
handler.postDelayed(this, halfPeriod)
|
||||
}
|
||||
}
|
||||
timers[trigger] = tick
|
||||
handler.postDelayed(tick, halfPeriod)
|
||||
}
|
||||
|
||||
private fun stop(trigger: AirTrigger) {
|
||||
timers.remove(trigger)?.let(handler::removeCallbacks)
|
||||
}
|
||||
|
||||
private fun press(trigger: AirTrigger, source: InputSurfaceSource) {
|
||||
pressed += trigger
|
||||
if (source.element == setups[trigger]?.element && onScreen(source.element.id, trigger, true, false)) {
|
||||
heldOnScreen[trigger] = source.element.id
|
||||
// The router counts held keys, so a toggle latched while its button was hidden is released before the button takes over.
|
||||
if (source.latched) source.release()
|
||||
} else source.update(1f)
|
||||
}
|
||||
|
||||
private fun unpress(trigger: AirTrigger, cancelled: Boolean) {
|
||||
pressed -= trigger
|
||||
heldOnScreen.remove(trigger)?.let { onScreen(it, trigger, false, cancelled) }
|
||||
?: sources[trigger]?.let { if (cancelled) it.cancel() else it.update(0f) }
|
||||
}
|
||||
|
||||
fun release() {
|
||||
AirTrigger.entries.forEach(::stop)
|
||||
held.toList().forEach { held.remove(it); touched(it, false) }
|
||||
pressed.toList().forEach { unpress(it, cancelled = true) }
|
||||
sources.values.forEach { it.release() }
|
||||
}
|
||||
|
||||
fun close() {
|
||||
release()
|
||||
sources.values.forEach { it.close() }
|
||||
sources.clear()
|
||||
setups.clear()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
package com.droiddeck.launcher.input
|
||||
|
||||
import org.json.JSONObject
|
||||
import java.net.URLEncoder
|
||||
|
||||
/**
|
||||
* Winlator's input-control profiles (`.icp`): a list of touch elements centred at fractions of the screen, sized in
|
||||
* hundredths of the screen width times their scale, each sending keyboard keys, mouse buttons or gamepad controls.
|
||||
*/
|
||||
object WinlatorLayouts {
|
||||
private const val BASE = "https://raw.githubusercontent.com/brunodev85/winlator/main/input_controls/"
|
||||
const val INDEX_URL = BASE + "index.txt"
|
||||
/** The smallest control side, as [InputSurfaceElement.bounded] allows. */
|
||||
private const val MIN_SIZE = .03f
|
||||
|
||||
fun fileUrl(name: String) = BASE + URLEncoder.encode(name, "UTF-8").replace("+", "%20")
|
||||
|
||||
/** The profile file names a community index lists. */
|
||||
fun parseIndex(text: String): List<String> = text.lineSequence().map { it.trim() }
|
||||
.filter { it.endsWith(".icp", ignoreCase = true) && it.length <= 128 && '/' !in it && '\\' !in it }.distinct().take(500).toList()
|
||||
|
||||
fun isIcp(raw: String) = runCatching { JSONObject(raw).let { it.has("elements") && it.optJSONArray("elements") != null && it.has("cursorSpeed") } }.getOrDefault(false)
|
||||
|
||||
/**
|
||||
* Whether a file uses something only this converter keeps: mouse or gamepad bindings, older key names, trackpads or key ranges.
|
||||
* DroidDeck's own exports send only keys, so they keep importing through [InputLayoutFile] with the sizes they were saved with.
|
||||
*/
|
||||
fun needsConversion(raw: String): Boolean = runCatching {
|
||||
val elements = JSONObject(raw).getJSONArray("elements")
|
||||
val bound = (0 until elements.length()).mapNotNull { i ->
|
||||
elements.optJSONObject(i)?.let { e -> e.optString("type") to e.optJSONArray("bindings")?.let { a -> (0 until a.length()).map { a.optString(it) } }.orEmpty() }
|
||||
}.filter { (type, bindings) -> type in setOf("TRACKPAD", "RANGE_BUTTON") || bindings.any { it.isNotBlank() && it != "NONE" } }
|
||||
// Keep existing key-only files on the compatible importer, including
|
||||
// layouts exceeding the legacy 64-control cap.
|
||||
bound.any { (type, bindings) ->
|
||||
type in setOf("TRACKPAD", "RANGE_BUTTON") || bindings.any { it.isNotBlank() && it != "NONE" && !InputLayoutFile.knows(it) }
|
||||
}
|
||||
}.getOrDefault(false)
|
||||
|
||||
private val keys: Map<String, Int> = mapOf(
|
||||
"ESC" to 1, "1" to 2, "2" to 3, "3" to 4, "4" to 5, "5" to 6, "6" to 7, "7" to 8, "8" to 9, "9" to 10, "0" to 11,
|
||||
"MINUS" to 12, "EQUAL" to 13, "BKSP" to 14, "TAB" to 15, "Q" to 16, "W" to 17, "E" to 18, "R" to 19, "T" to 20, "Y" to 21,
|
||||
"U" to 22, "I" to 23, "O" to 24, "P" to 25, "BRACKET_LEFT" to 26, "BRACKET_RIGHT" to 27, "ENTER" to 28, "CTRL_L" to 29,
|
||||
"A" to 30, "S" to 31, "D" to 32, "F" to 33, "G" to 34, "H" to 35, "J" to 36, "K" to 37, "L" to 38, "SEMICOLON" to 39,
|
||||
"APOSTROPHE" to 40, "GRAVE" to 41, "SHIFT_L" to 42, "BACKSLASH" to 43, "Z" to 44, "X" to 45, "C" to 46, "V" to 47,
|
||||
"B" to 48, "N" to 49, "M" to 50, "COMMA" to 51, "PERIOD" to 52, "SLASH" to 53, "SHIFT_R" to 54, "KP_MULTIPLY" to 55,
|
||||
"ALT_L" to 56, "SPACE" to 57, "CAPS_LOCK" to 58, "F1" to 59, "F2" to 60, "F3" to 61, "F4" to 62, "F5" to 63, "F6" to 64,
|
||||
"F7" to 65, "F8" to 66, "F9" to 67, "F10" to 68, "NUM_LOCK" to 69, "SCROLL_LOCK" to 70, "KP_7" to 71, "KP_8" to 72,
|
||||
"KP_9" to 73, "KP_SUBTRACT" to 74, "KP_4" to 75, "KP_5" to 76, "KP_6" to 77, "KP_ADD" to 78, "KP_1" to 79, "KP_2" to 80,
|
||||
"KP_3" to 81, "KP_0" to 82, "KP_DEL" to 83, "F11" to 87, "F12" to 88, "KP_ENTER" to 96, "CTRL_R" to 97, "KP_DIVIDE" to 98,
|
||||
"PRTSCN" to 99, "ALT_R" to 100, "HOME" to 102, "UP" to 103, "PG_UP" to 104, "PRIOR" to 104, "LEFT" to 105, "RIGHT" to 106,
|
||||
"END" to 107, "DOWN" to 108, "PG_DOWN" to 109, "NEXT" to 109, "INSERT" to 110, "DEL" to 111,
|
||||
// Older profiles name the left modifiers without a side.
|
||||
"SHIFT" to 42, "CTRL" to 29, "ALT" to 56,
|
||||
)
|
||||
|
||||
private val gamepad: Map<String, InputControl> = mapOf(
|
||||
"A" to InputControl.A, "B" to InputControl.B, "X" to InputControl.X, "Y" to InputControl.Y,
|
||||
"L1" to InputControl.LB, "R1" to InputControl.RB, "L2" to InputControl.LT, "R2" to InputControl.RT,
|
||||
"L3" to InputControl.L3, "R3" to InputControl.R3, "SELECT" to InputControl.SELECT, "START" to InputControl.START,
|
||||
)
|
||||
|
||||
private val dpad = mapOf("UP" to InputControl.UP, "RIGHT" to InputControl.RIGHT, "DOWN" to InputControl.DOWN, "LEFT" to InputControl.LEFT)
|
||||
|
||||
private val ranges = mapOf(
|
||||
"FROM_A_TO_Z" to ('A'..'Z').map { it.toString() }, "FROM_0_TO_9" to (listOf("0") + ('1'..'9').map { it.toString() }),
|
||||
"FROM_F1_TO_F12" to (1..12).map { "F$it" }, "FROM_NP0_TO_NP9" to (0..9).map { "KP_$it" },
|
||||
)
|
||||
|
||||
private fun key(binding: String) = keys[binding.removePrefix("KEY_")]?.takeIf { binding.startsWith("KEY_") }
|
||||
|
||||
/** What one button binding does here, or null when it has no button equivalent. */
|
||||
internal fun buttonAction(binding: String): InputAction? = when {
|
||||
binding.startsWith("KEY_") -> key(binding)?.let { InputAction.Keys(listOf(it)) }
|
||||
binding == "MOUSE_LEFT_BUTTON" -> InputAction.MouseButton(272)
|
||||
binding == "MOUSE_RIGHT_BUTTON" -> InputAction.MouseButton(273)
|
||||
binding == "MOUSE_MIDDLE_BUTTON" -> InputAction.MouseButton(274)
|
||||
binding.startsWith("GAMEPAD_BUTTON_") -> gamepad[binding.removePrefix("GAMEPAD_BUTTON_")]?.let { InputAction.Native(it) }
|
||||
binding.startsWith("GAMEPAD_DPAD_") -> dpad[binding.removePrefix("GAMEPAD_DPAD_")]?.let { InputAction.Native(it) }
|
||||
else -> null
|
||||
}
|
||||
|
||||
/** What four direction bindings (up, right, down, left) do on a stick, D-pad or trackpad. */
|
||||
private fun directionAction(bindings: List<String>, kind: InputElementKind): InputAction {
|
||||
val all = bindings.take(4)
|
||||
return when {
|
||||
all.any { it.startsWith("GAMEPAD_LEFT_THUMB") } -> if (kind == InputElementKind.DPAD) InputAction.Native() else InputAction.Native(InputControl.LS)
|
||||
all.any { it.startsWith("GAMEPAD_RIGHT_THUMB") } -> if (kind == InputElementKind.DPAD) InputAction.Native() else InputAction.Native(InputControl.RS)
|
||||
all.any { it.startsWith("GAMEPAD_DPAD") } -> if (kind == InputElementKind.DPAD) InputAction.Native() else InputAction.Native(InputControl.LS)
|
||||
all.any { it.startsWith("MOUSE_MOVE") } -> InputAction.Pointer()
|
||||
all.any { it.startsWith("KEY_") } -> all.map { key(it) ?: 0 }.let { InputAction.Directions(it[0], it[1], it[2], it[3]) }
|
||||
else -> InputAction.Disabled
|
||||
}
|
||||
}
|
||||
|
||||
private fun label(binding: String): String = when {
|
||||
binding.startsWith("KEY_") -> binding.removePrefix("KEY_").replace('_', ' ')
|
||||
binding.startsWith("MOUSE_") -> binding.removePrefix("MOUSE_").removeSuffix("_BUTTON").replace('_', ' ')
|
||||
binding.startsWith("GAMEPAD_BUTTON_") -> binding.removePrefix("GAMEPAD_BUTTON_")
|
||||
binding.startsWith("GAMEPAD_DPAD_") -> binding.removePrefix("GAMEPAD_")
|
||||
else -> binding.replace('_', ' ')
|
||||
}.lowercase().replaceFirstChar { it.uppercase() }.take(80)
|
||||
|
||||
/** Converts an `.icp` file for a [width]×[height] screen into a layout and the actions of its controls. */
|
||||
fun import(raw: String, fallbackName: String, screen: InputLayoutScreen, screenWidth: Int, screenHeight: Int,
|
||||
id: String = newInputId(), bindingsId: String = newInputId()): Pair<SavedInputLayout, SavedInputBindings>? = runCatching {
|
||||
require(raw.length <= 1_000_000)
|
||||
val (width, height) = InputLayoutFile.landscape(screenWidth, screenHeight)
|
||||
val doc = JSONObject(raw)
|
||||
val source = doc.getJSONArray("elements")
|
||||
val aspect = (width.coerceAtLeast(1).toFloat() / height.coerceAtLeast(1)).coerceIn(.05f, 20f)
|
||||
val elements = mutableListOf<InputSurfaceElement>()
|
||||
val actions = mutableMapOf<String, InputAction>()
|
||||
fun placeRect(kind: InputElementKind, name: String, x: Float, y: Float, w: Float, h: Float, action: InputAction,
|
||||
shape: InputButtonShape = InputButtonShape.ROUNDED, toggle: Boolean = false) {
|
||||
// Too many controls fails the import instead of leaving some out.
|
||||
require(elements.size < 64)
|
||||
val element = InputSurfaceElement(kind.control, x, y, w, h, newInputId(), kind, name.ifBlank { "?" }.take(80),
|
||||
toggle = toggle && (kind == InputElementKind.BUTTON || kind == InputElementKind.TRIGGER), buttonShape = shape).bounded()
|
||||
elements += element
|
||||
actions[element.id] = action.takeIf { it.validFor(element) } ?: InputAction.Disabled
|
||||
}
|
||||
fun place(kind: InputElementKind, name: String, cx: Float, cy: Float, halfW: Float, halfH: Float, action: InputAction,
|
||||
shape: InputButtonShape = InputButtonShape.ROUNDED, toggle: Boolean = false) {
|
||||
val w = halfW * .01f; val h = halfH * .01f * aspect
|
||||
placeRect(kind, name, cx - w, cy - h, 2 * w, 2 * h, action, shape, toggle)
|
||||
}
|
||||
for (i in 0 until source.length()) {
|
||||
val e = source.optJSONObject(i) ?: continue
|
||||
val bindings = e.optJSONArray("bindings")?.let { a -> (0 until a.length()).map { a.optString(it) } }.orEmpty()
|
||||
val scale = e.optDouble("scale", 1.0).toFloat().coerceIn(.2f, 5f)
|
||||
val cx = e.optDouble("x", .5).toFloat(); val cy = e.optDouble("y", .5).toFloat()
|
||||
val text = e.optString("text").trim()
|
||||
val shape = when (e.optString("shape")) { "CIRCLE" -> InputButtonShape.CIRCLE; "RECT", "SQUARE" -> InputButtonShape.RECTANGLE; else -> InputButtonShape.ROUNDED }
|
||||
when (e.optString("type")) {
|
||||
"BUTTON" -> {
|
||||
val bound = bindings.filter { it != "NONE" && it.isNotBlank() }
|
||||
val binding = bound.firstOrNull() ?: continue
|
||||
// A button presses every bound slot at once, so several keys make one chord.
|
||||
val chord = bound.mapNotNull(::key).distinct().take(8)
|
||||
val action = if (bound.size > 1 && chord.size == bound.size) InputAction.Keys(chord)
|
||||
else buttonAction(binding) ?: InputAction.Disabled
|
||||
val trigger = action is InputAction.Native && (action.target == InputControl.LT || action.target == InputControl.RT)
|
||||
val (hw, hh) = when (e.optString("shape")) { "RECT", "ROUND_RECT" -> 4f to 2f; "SQUARE" -> 2.5f to 2.5f; else -> 3f to 3f }
|
||||
place(if (trigger) InputElementKind.TRIGGER else InputElementKind.BUTTON, text.ifEmpty { if (chord.size > 1 && chord.size == bound.size) bound.joinToString("+") { label(it) }.take(80) else label(binding) }, cx, cy, hw * scale, hh * scale,
|
||||
action, shape, e.optBoolean("toggleSwitch"))
|
||||
}
|
||||
"D_PAD" -> place(InputElementKind.DPAD, text.ifEmpty { "D-pad" }, cx, cy, 7 * scale, 7 * scale, directionAction(bindings, InputElementKind.DPAD))
|
||||
"STICK" -> place(InputElementKind.STICK, text.ifEmpty { "Stick" }, cx, cy, 6 * scale, 6 * scale, directionAction(bindings, InputElementKind.STICK))
|
||||
// Key directions stay keys; a trackpad sending gamepad sticks has no trackpad equivalent here, so it moves the pointer.
|
||||
"TRACKPAD" -> place(InputElementKind.TRACKPAD, text.ifEmpty { "Trackpad" }, cx, cy, 6 * scale, 6 * scale,
|
||||
directionAction(bindings, InputElementKind.TRACKPAD).takeIf { it is InputAction.Directions || it is InputAction.Pointer } ?: InputAction.Pointer())
|
||||
"RANGE_BUTTON" -> {
|
||||
// Winlator scrolls a window of [bindings.size] keys through the range; every key gets its own button here,
|
||||
// in rows (or columns) as long as that window.
|
||||
val range = ranges[e.optString("range", "FROM_A_TO_Z")] ?: continue
|
||||
val across = bindings.size.coerceIn(1, range.size)
|
||||
val vertical = e.optInt("orientation", 0) == 1
|
||||
// Cells are never smaller than the smallest control, and a block bigger than the screen shrinks to fit it,
|
||||
// so the keys never overlap; then the whole block moves onto the screen.
|
||||
val lines = (range.size + across - 1) / across
|
||||
val cols = if (vertical) lines else across
|
||||
val rows = if (vertical) across else lines
|
||||
val cellW = maxOf(4 * scale * .01f, MIN_SIZE).coerceAtMost(1f / cols)
|
||||
val cellH = maxOf(4 * scale * .01f * aspect, MIN_SIZE).coerceAtMost(1f / rows)
|
||||
val blockW = cols * cellW; val blockH = rows * cellH
|
||||
val left = (if (vertical) cx - cellW / 2 else cx - blockW / 2).coerceIn(0f, (1f - blockW).coerceAtLeast(0f))
|
||||
val top = (if (vertical) cy - blockH / 2 else cy - cellH / 2).coerceIn(0f, (1f - blockH).coerceAtLeast(0f))
|
||||
for ((n, name) in range.withIndex()) {
|
||||
val code = keys[name] ?: continue
|
||||
val col = if (vertical) n / across else n % across
|
||||
val row = if (vertical) n % across else n / across
|
||||
placeRect(InputElementKind.BUTTON, label("KEY_$name"), left + col * cellW, top + row * cellH, cellW, cellH,
|
||||
InputAction.Keys(listOf(code)), shape)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
require(elements.isNotEmpty())
|
||||
val name = doc.optString("name").trim().take(80).ifEmpty { fallbackName.trim().take(80) }.ifEmpty { "Winlator" }
|
||||
val layout = SavedInputLayout(id, name, elements, screen = screen, aspect = aspect)
|
||||
layout to SavedInputBindings(bindingsId, name, false, id, elements = actions)
|
||||
}.getOrNull()
|
||||
}
|
||||
@@ -288,12 +288,26 @@ object BwrapSpawner {
|
||||
}
|
||||
|
||||
private fun preload(session: List<Bind>, rootfs: String, env: MutableMap<String, String>): List<Bind> {
|
||||
val libs = FileUtils.readString(File(rootfs, "etc/ld.so.preload"))?.lines()
|
||||
?.map { it.trim() }?.filter { it.startsWith("/") && File(rootfs + it).isFile } ?: return emptyList()
|
||||
if (libs.isEmpty()) return emptyList()
|
||||
val configured = FileUtils.readString(File(rootfs, "etc/ld.so.preload"))?.lines()
|
||||
?.map { it.trim() }?.filter { it.startsWith("/") && File(rootfs + it).isFile } ?: emptyList()
|
||||
val lseDisabled = env["LSE_EMU"] == "0"
|
||||
val libs = configured.filterNot { lseDisabled && it.endsWith("/liblse_emu.so") }
|
||||
val inherited = env["LD_PRELOAD"]?.split(Regex("[\\s:]+"))
|
||||
?.filter { it.isNotEmpty() && !(lseDisabled && it.substringAfterLast('/') == "liblse_emu.so") }
|
||||
?: emptyList()
|
||||
if (libs.isEmpty()) {
|
||||
if (lseDisabled) {
|
||||
if (inherited.isEmpty()) env.remove("LD_PRELOAD")
|
||||
else env["LD_PRELOAD"] = inherited.joinToString(":")
|
||||
}
|
||||
return emptyList()
|
||||
}
|
||||
val binds = ArrayList<Bind>()
|
||||
val paths = libs.map { lib -> "$PRELOAD_DIR/${lib.substringAfterLast('/')}".also { binds.add(Bind(rootfs + lib, it)) } }
|
||||
env["LD_PRELOAD"] = (paths + listOfNotNull(env["LD_PRELOAD"]?.takeIf { it.isNotBlank() })).joinToString(":")
|
||||
env["LD_PRELOAD"] = (paths + inherited).joinToString(":")
|
||||
if (libs.any { it.endsWith("/liblse_emu.so") }) {
|
||||
env.putIfAbsent("LSE_EMU", "1")
|
||||
}
|
||||
File(rootfs, NET_LINK).takeIf { it.isFile }?.let { binds.add(Bind(it.path, "/$NET_LINK")) }
|
||||
env["FAKE_EVDEV_DIR"]?.let { File(it).parent }?.let { dev ->
|
||||
binds.addAll(bindsFor(session, rootfs, dev, dev))
|
||||
@@ -563,12 +577,15 @@ object BwrapSpawner {
|
||||
|
||||
private fun run(context: Context, plan: Plan, client: LocalSocket, out: DataOutputStream, id: Int) {
|
||||
val verbose = plan.env["DROIDDECK_PROOT_VERBOSE"]?.toIntOrNull()
|
||||
val native = if (NativeGuest.forSession(context)) nativeLaunch(context, plan) else null
|
||||
val nativeSession = NativeGuest.forSession(context)
|
||||
val native = if (nativeSession) nativeLaunch(context, plan) else null
|
||||
val builder = if (native != null) {
|
||||
ProcessBuilder(native.first).redirectErrorStream(true)
|
||||
.directory(File(hostPath(plan.binds, plan.root.path, plan.cwd)).takeIf { it.isDirectory } ?: plan.root)
|
||||
.also { b -> b.environment().apply { clear(); putAll(native.second) } }
|
||||
} else {
|
||||
val reason = if (nativeSession) "sandbox native launch unavailable" else "parent guest uses PRoot"
|
||||
Log.i(TAG, "Flatpak: using PRoot ($reason)")
|
||||
val cmd = LinuxRuntime.prootPrefix(context, plan.root, plan.cwd)
|
||||
if (verbose != null) { cmd.add("-v"); cmd.add(verbose.toString()) }
|
||||
plan.binds.forEach { cmd.add("-b"); cmd.add(it.spec) }
|
||||
@@ -585,7 +602,6 @@ object BwrapSpawner {
|
||||
putAll(prootEnvironment(plan, envTool))
|
||||
put("PROOT_LOADER", LinuxRuntime.prootLoader(context).path)
|
||||
put("PROOT_TMP_DIR", LinuxRuntime.prootTempDir(context).path)
|
||||
if (SessionPrefs.prootNoSeccomp(context)) put("PROOT_NO_SECCOMP", "1")
|
||||
LinuxRuntime.prootLibraryPath(context).takeIf { it.isNotEmpty() }?.let { put("LD_LIBRARY_PATH", it) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.droiddeck.launcher.core.HostProcess
|
||||
import com.droiddeck.launcher.session.OrphanReaper
|
||||
import com.droiddeck.launcher.session.SessionFiles
|
||||
import com.droiddeck.launcher.session.SessionPaths
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import java.io.File
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
|
||||
@@ -67,7 +66,6 @@ object GuestCommand {
|
||||
put("PROOT_LOADER", LinuxRuntime.prootLoader(context).path)
|
||||
put("PROOT_TMP_DIR", LinuxRuntime.prootTempDir(context).path)
|
||||
if (linkDir != null) put("PROOT_L2S_DIR", linkDir.path)
|
||||
if (SessionPrefs.prootNoSeccomp(context)) put("PROOT_NO_SECCOMP", "1")
|
||||
fastPathKey?.let { ProotFastPath.hostEnv(it).let { (k, v) -> put(k, v) } }
|
||||
LinuxRuntime.prootLibraryPath(context).takeIf { it.isNotEmpty() }?.let { put("LD_LIBRARY_PATH", it) }
|
||||
}
|
||||
|
||||
@@ -22,15 +22,15 @@ object NativeGuest {
|
||||
}
|
||||
|
||||
fun enabled(context: Context): Boolean =
|
||||
SessionPrefs.nativeUserland(context) && available(LinuxRuntime.rootDir(context))
|
||||
available(LinuxRuntime.rootDir(context))
|
||||
|
||||
/**
|
||||
* Whether the next session will start natively. The session stages the hook from the APK before
|
||||
* it starts, so only the setting and the rootfs's loader decide, and a runtime still to be
|
||||
* it starts, so the rootfs's loader decides, and a runtime still to be
|
||||
* installed will have one.
|
||||
*/
|
||||
fun nextSession(context: Context): Boolean =
|
||||
SessionPrefs.nativeUserland(context) && willRun(LinuxRuntime.rootDir(context), LinuxRuntime.isInstalled(context))
|
||||
willRun(LinuxRuntime.rootDir(context), LinuxRuntime.isInstalled(context))
|
||||
|
||||
internal fun willRun(root: File, installed: Boolean): Boolean = !installed || loader(root) != null
|
||||
|
||||
@@ -39,7 +39,7 @@ object NativeGuest {
|
||||
|
||||
/**
|
||||
* Whether a session's helpers (root commands, Flatpak sandboxes, installers) run natively: the
|
||||
* session's own mode while one runs, as the setting can change under it and the rootfs is only
|
||||
* session's own mode while one runs, as the rootfs is only
|
||||
* prepared for native programs at a session's start.
|
||||
*/
|
||||
fun forSession(context: Context): Boolean = sessionMode ?: enabled(context)
|
||||
@@ -104,8 +104,11 @@ object NativeGuest {
|
||||
private fun hostProgram(root: File, program: String): File = File(root, program.removePrefix("/"))
|
||||
|
||||
/** The environment of the session process: the hook's root, the mounts proot used to make, the preload list. */
|
||||
fun sessionEnvironment(root: File, binds: List<String>, program: String, hostname: String? = null): Map<String, String> {
|
||||
val preload = preloadList(root)
|
||||
fun sessionEnvironment(
|
||||
root: File, binds: List<String>, program: String, hostname: String? = null, lseEmu: String? = null,
|
||||
): Map<String, String> {
|
||||
val preload = preloadList(root).filterNot { lseEmu == "0" && it.substringAfterLast('/') == "liblse_emu.so" }
|
||||
val lse = lseEmu ?: "1".takeIf { preload.any { it.substringAfterLast('/') == "liblse_emu.so" } }
|
||||
return linkedMapOf(
|
||||
"DDNATV_ROOT" to root.path,
|
||||
"DDNATV_EXEC" to execLoader.orEmpty(),
|
||||
@@ -113,6 +116,7 @@ object NativeGuest {
|
||||
"DDNATV_HOSTNAME" to hostname.orEmpty(),
|
||||
"DDNATV_BINDS" to binds.joinToString("|") { if (it.contains(':')) it else "$it:$it" },
|
||||
"DDNATV_PRELOAD" to preload.joinToString(":"),
|
||||
"LSE_EMU" to lse.orEmpty(),
|
||||
"LD_PRELOAD" to (preload.map { File(root, it.removePrefix("/")).path } + hook(root).path).joinToString(":"),
|
||||
).filterValues { it.isNotEmpty() }
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.droiddeck.launcher.runtime
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.util.Log
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import java.io.File
|
||||
import java.security.MessageDigest
|
||||
|
||||
@@ -12,17 +11,14 @@ object ProotFastPath {
|
||||
const val LIBRARY = "/usr/local/lib/libddfastpath.so"
|
||||
const val MAX_BINDS = 256
|
||||
|
||||
fun allows(preference: Boolean, noSeccomp: Boolean, source: String, nativeUserland: Boolean = false): Boolean =
|
||||
preference && !noSeccomp && !nativeUserland && source == LinuxRuntime.PROOT_PACK
|
||||
internal fun allows(source: String, native: Boolean): Boolean =
|
||||
!native && source == LinuxRuntime.PROOT_PACK
|
||||
|
||||
fun enabled(context: Context): Boolean {
|
||||
val preference = SessionPrefs.prootFastPath(context)
|
||||
val noSeccomp = SessionPrefs.prootNoSeccomp(context)
|
||||
val nativeUserland = SessionPrefs.nativeUserland(context)
|
||||
fun enabled(context: Context, native: Boolean = NativeGuest.forSession(context)): Boolean {
|
||||
if (native) return false
|
||||
val source = LinuxRuntime.prootSource(context)
|
||||
val on = allows(preference, noSeccomp, source, nativeUserland)
|
||||
if (preference && !noSeccomp && !nativeUserland && !on)
|
||||
Log.i(TAG, "proot: fast path off - binary is $source, not the patched proot")
|
||||
val on = allows(source, native)
|
||||
if (!on) Log.i(TAG, "proot: fast path off - binary is $source, not the patched proot")
|
||||
return on
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import android.os.Process
|
||||
import android.util.Log
|
||||
import com.droiddeck.launcher.core.HostProcess
|
||||
import com.droiddeck.launcher.session.OrphanReaper
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import org.json.JSONObject
|
||||
import java.io.DataInputStream
|
||||
import java.io.DataOutputStream
|
||||
@@ -128,7 +127,6 @@ object RootSpawner {
|
||||
clear()
|
||||
put("PROOT_LOADER", LinuxRuntime.prootLoader(context).path)
|
||||
put("PROOT_TMP_DIR", LinuxRuntime.prootTempDir(context).path)
|
||||
if (SessionPrefs.prootNoSeccomp(context)) put("PROOT_NO_SECCOMP", "1")
|
||||
LinuxRuntime.prootLibraryPath(context).takeIf { it.isNotEmpty() }?.let { put("LD_LIBRARY_PATH", it) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,7 +343,8 @@ object BottomDesktop {
|
||||
LinuxRuntime.commandWithBinds(context, current.root, binds, guest)
|
||||
}
|
||||
val environment = if (current.nativeUserland) {
|
||||
com.droiddeck.launcher.runtime.NativeGuest.sessionEnvironment(current.root, binds, guest.first(), SessionPrefs.guestHostname(context))
|
||||
val lseEmu = current.guest.lastOrNull { it.startsWith("LSE_EMU=") }?.substringAfter('=')
|
||||
com.droiddeck.launcher.runtime.NativeGuest.sessionEnvironment(current.root, binds, guest.first(), SessionPrefs.guestHostname(context), lseEmu)
|
||||
.map { (k, v) -> "$k=$v" }.toTypedArray()
|
||||
} else current.hostEnvironment
|
||||
val line = command.joinToString(" ") { it.replace("\\", "\\\\").replace(" ", "\\ ") }
|
||||
|
||||
@@ -268,7 +268,7 @@ internal object EnhancedSessionLogShare {
|
||||
val out = outputDirectory.apply { deleteRecursively(); mkdirs() }
|
||||
val redactionLearningComplete = LogRedactor.learnFromRuntime(LinuxRuntime.rootDir(context))
|
||||
val discovery = collect(context, folder, limits.maxDiscoveredFiles, legacy = true)
|
||||
val candidates = discovery.candidates.filter { it.linePrefix == null }
|
||||
val candidates = discovery.candidates.filter { it.linePrefix == null }.sortedBy(::sharePriority)
|
||||
if (candidates.isEmpty()) {
|
||||
out.deleteRecursively()
|
||||
return null
|
||||
@@ -697,15 +697,6 @@ internal object EnhancedSessionLogShare {
|
||||
Category.GAMES, "DROIDDECK_DIAGNOSTICS event=game_",
|
||||
)
|
||||
}
|
||||
if (SessionPaths.current()?.canonicalFile == folder.canonicalFile && !File(folder, "steam").exists()) {
|
||||
val steam = File(SessionPrefs.activeSteamRoot(context), "logs")
|
||||
val scan = directFiles(steam, remaining(maxFiles, out.size))
|
||||
truncated = truncated || scan.truncated
|
||||
partial = partial || scan.partial
|
||||
scan.files.forEach {
|
||||
add(it, steam, "${folder.name}/steam/${it.name}", "live-steam")
|
||||
}
|
||||
}
|
||||
val logs = LinuxRuntime.logDir(context)
|
||||
for ((name, root) in listOf(SessionLogShare.STORES_DIR to File(logs, SessionLogShare.STORES_DIR), SessionPaths.TOOLS_DIR to File(logs, SessionPaths.TOOLS_DIR))) {
|
||||
val scan = directFiles(root, STORE_LOG_SCAN)
|
||||
@@ -742,9 +733,24 @@ internal object EnhancedSessionLogShare {
|
||||
if (relative == EnhancedDiagnostics.MANIFEST_FILE) return@forEach
|
||||
add(file, folder, "${folder.name}/$relative", "session")
|
||||
}
|
||||
if (SessionPaths.current()?.canonicalFile == folder.canonicalFile && !File(folder, "steam").exists()) {
|
||||
val steam = File(SessionPrefs.activeSteamRoot(context), "logs")
|
||||
val scan = directFiles(steam, remaining(maxFiles, out.size))
|
||||
truncated = truncated || scan.truncated
|
||||
partial = partial || scan.partial
|
||||
scan.files.forEach {
|
||||
add(it, steam, "${folder.name}/steam/${it.name}", "live-steam")
|
||||
}
|
||||
}
|
||||
return CollectionResult(out.values.toList(), truncated, partial)
|
||||
}
|
||||
|
||||
private fun sharePriority(candidate: Candidate): Int = when {
|
||||
candidate.origin == "session-critical" -> 0
|
||||
candidate.origin == "session" && candidate.category == Category.GAMES -> 1
|
||||
else -> 2
|
||||
}
|
||||
|
||||
private fun remaining(maxFiles: Int, found: Int): Int = (maxFiles - found + 1).coerceAtLeast(0)
|
||||
|
||||
private fun walk(root: File, limit: Int): ScanResult {
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.annotation.StringRes
|
||||
import com.droiddeck.launcher.R
|
||||
|
||||
enum class FullscreenMode(@StringRes val label: Int) {
|
||||
ALWAYS(R.string.widgets_on),
|
||||
LANDSCAPE_ONLY(R.string.setup_fullscreen_landscape_only),
|
||||
OFF(R.string.widgets_off);
|
||||
|
||||
fun hidesSystemBars(orientation: Int): Boolean =
|
||||
this == ALWAYS || (this == LANDSCAPE_ONLY && orientation == Configuration.ORIENTATION_LANDSCAPE)
|
||||
|
||||
companion object {
|
||||
fun fromStored(value: String?): FullscreenMode? = entries.firstOrNull { it.name == value }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import android.content.Context
|
||||
import com.droiddeck.launcher.input.InputLibraries
|
||||
import com.droiddeck.launcher.core.GameEnvironment
|
||||
|
||||
object GameProfileManager {
|
||||
@@ -23,6 +24,14 @@ object GameProfileManager {
|
||||
clear("texture filtering") { SessionPrefs.clearGameTextureFiltering(context, scope) }
|
||||
clear("Windows components") { WinComponents.setPicks(context, scope, emptyList()) }
|
||||
clear("bottom screen") { SessionPrefs.clearGameBottomScreen(context, scope) }
|
||||
clear("controls") {
|
||||
val keys = listOf(scope, "game:$scope")
|
||||
if (InputLibraries.read(context).games.keys.any { it in keys }) {
|
||||
InputLibraries.update(context) { library ->
|
||||
keys.fold(library) { current, key -> current.resetGame(key) }
|
||||
}
|
||||
}
|
||||
}
|
||||
clear("guides") {
|
||||
SteamGuides.clear(context, scope)
|
||||
GuideLibrary.clear(context, scope)
|
||||
|
||||
@@ -9,6 +9,8 @@ import com.droiddeck.launcher.core.Downloader
|
||||
import com.droiddeck.launcher.core.FileUtils
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import com.droiddeck.launcher.runtime.NativeGuest
|
||||
import com.droiddeck.launcher.storage.SteamStorage
|
||||
import com.droiddeck.launcher.stores.steam.SteamClient
|
||||
import java.io.File
|
||||
import java.util.Locale
|
||||
import org.json.JSONArray
|
||||
@@ -34,7 +36,9 @@ object ProtonExtras {
|
||||
private var replacing = false
|
||||
|
||||
class Tool(val id: String, val name: String, val prefix: String, val repo: String, val assetPattern: Regex,
|
||||
val prereleases: Boolean = false)
|
||||
val prereleases: Boolean = false, val x86_64: Boolean = false, val label: Int = 0) {
|
||||
val arch: String get() = if (x86_64) "x86-64" else "ARM64"
|
||||
}
|
||||
|
||||
internal data class Asset(val tag: String, val name: String, val url: String, val sha512: String?, val size: Long,
|
||||
val sha256: String? = null, val releaseName: String = tag)
|
||||
@@ -42,11 +46,13 @@ object ProtonExtras {
|
||||
|
||||
const val OWN = "droiddeck"
|
||||
const val BIONIC = "bionic"
|
||||
const val ANTICHEAT = "anticheat"
|
||||
|
||||
val tools = listOf(
|
||||
Tool("ge", "GE-Proton", "GE-Proton", "GloriousEggroll/proton-ge-custom", Regex("aarch64\\.tar\\.(gz|xz)$")),
|
||||
Tool("cachyos", "proton-cachyos", "proton-cachyos", "CachyOS/proton-cachyos", Regex("arm64\\.tar\\.(gz|xz)$")),
|
||||
Tool("droiddeck", "DroidDeck-Proton", "DroidDeck-Proton", "Droid-Deck/DroidDeck-Proton", Regex("^DroidDeck-Proton-.*aarch64\\.tar\\.(gz|xz)$")),
|
||||
Tool(ANTICHEAT, "DroidDeck-Proton x86-64", "DroidDeck-Proton", "Droid-Deck/DroidDeck-Proton", Regex("^DroidDeck-Proton-.*x86_64\\.tar\\.(gz|xz)$"), x86_64 = true, label = R.string.pextra_anticheat),
|
||||
// Bionic (Android libc) Proton started outside the Linux userland; test builds are prereleases. No-proot only.
|
||||
Tool(BIONIC, "DroidDeck-Bionic", "DroidDeck-Bionic", "Droid-Deck/DroidDeck-Proton", Regex("^DroidDeck-Bionic-.*aarch64\\.tar\\.(gz|xz)$"), prereleases = true),
|
||||
)
|
||||
@@ -66,11 +72,14 @@ object ProtonExtras {
|
||||
|
||||
internal fun installedIn(dir: File, tool: Tool): List<String> =
|
||||
dir.listFiles()
|
||||
?.filter { it.isDirectory && it.name.startsWith(tool.prefix) && usable(it) }
|
||||
?.filter { it.isDirectory && it.name.startsWith(tool.prefix) && x86_64Build(it) == tool.x86_64 && usable(it) }
|
||||
?.map { it.name }
|
||||
?.sortedWith { a, b -> compareVersions(a, b) }
|
||||
?: emptyList()
|
||||
|
||||
internal fun x86_64Build(dir: File): Boolean =
|
||||
File(dir, "files/lib/wine/x86_64-unix").isDirectory && !File(dir, "files/bin-arm64").isDirectory
|
||||
|
||||
private fun usable(dir: File): Boolean {
|
||||
val manifest = runCatching { File(dir, "toolmanifest.vdf").readText() }.getOrNull() ?: return false
|
||||
val command = Regex("\\\"commandline\\\"\\s+\\\"/?([^\\\" ]+)").find(manifest)?.groupValues?.getOrNull(1) ?: return false
|
||||
@@ -108,15 +117,31 @@ object ProtonExtras {
|
||||
|
||||
fun update(context: Context, tool: Tool): String? = updateFor(installedTags(context, tool), cachedLatest(context, tool))
|
||||
|
||||
fun missing(context: Context, tool: Tool): String? =
|
||||
if (tool.id == OWN && !declined(context) && installedAll(context, tool).isEmpty()) cachedLatest(context, tool) else null
|
||||
fun missing(context: Context, tool: Tool): String? = missing(context, tool) { antiCheatRuntimeInstalled(context) }
|
||||
|
||||
internal fun missing(context: Context, tool: Tool, antiCheat: () -> Boolean): String? = when {
|
||||
declined(context, tool.id) || installedAll(context, tool).isNotEmpty() -> null
|
||||
tool.id == OWN || tool.id == ANTICHEAT && antiCheat() -> cachedLatest(context, tool)
|
||||
else -> null
|
||||
}
|
||||
|
||||
private fun antiCheatRuntimeInstalled(context: Context): Boolean =
|
||||
antiCheatRuntimeIn(listOf("arm64", SteamClient.X86_64).flatMap { arch ->
|
||||
runCatching { SteamClient.libraries(context, arch).map { it.host } }.getOrDefault(emptyList())
|
||||
} + listOfNotNull(GameStorage.effective(context)?.let { File(it.path) }, GameStorage.x64CardLibrary(context)))
|
||||
|
||||
internal fun antiCheatRuntimeIn(libraries: List<File>): Boolean = libraries.any { library ->
|
||||
ANTICHEAT_RUNTIMES.any { File(library, "steamapps/appmanifest_$it.acf").isFile }
|
||||
}
|
||||
|
||||
private val ANTICHEAT_RUNTIMES = listOf(SteamStorage.EAC_RUNTIME, SteamStorage.BATTLEYE_RUNTIME)
|
||||
|
||||
private fun choices(context: Context) = context.getSharedPreferences("proton-auto-updates", Context.MODE_PRIVATE)
|
||||
|
||||
fun declined(context: Context): Boolean = choices(context).getBoolean("$OWN.declined", false)
|
||||
fun declined(context: Context, id: String = OWN): Boolean = choices(context).getBoolean("$id.declined", false)
|
||||
|
||||
fun setDeclined(context: Context, declined: Boolean) {
|
||||
choices(context).edit().putBoolean("$OWN.declined", declined).apply()
|
||||
fun setDeclined(context: Context, declined: Boolean, id: String = OWN) {
|
||||
choices(context).edit().putBoolean("$id.declined", declined).apply()
|
||||
}
|
||||
|
||||
fun cachedLatest(context: Context, tool: Tool): String? =
|
||||
@@ -220,8 +245,8 @@ object ProtonExtras {
|
||||
if (runCatching { ComponentsManager.carryOver(context, old, newest) }.onFailure { Log.w(TAG, "components of $old", it) }.isFailure) continue
|
||||
if (runCatching { keepUserSettings(context, old, newest) }.onFailure { Log.w(TAG, "user settings of $old", it) }.isFailure) continue
|
||||
if (runCatching { ProtonDefault.moveGames(context, setOf(old), newest) }.onFailure { Log.w(TAG, "per-game picks of $old", it) }.isFailure) continue
|
||||
// DroidDeck-Bionic only: the guest finds no default for a deleted Bionic build and falls back to DroidDeck-Proton
|
||||
if (tool.id == BIONIC && runCatching { ProtonDefault.moveDefault(context, setOf(old), newest) }.onFailure { Log.w(TAG, "default pick of $old", it) }.isFailure) continue
|
||||
// DroidDeck-Bionic and the x86-64 build: the guest finds no default for a deleted build and falls back to DroidDeck-Proton
|
||||
if ((tool.id == BIONIC || tool.id == ANTICHEAT) && runCatching { ProtonDefault.moveDefault(context, setOf(old), newest) }.onFailure { Log.w(TAG, "default pick of $old", it) }.isFailure) continue
|
||||
if (deleteTool(context, old)) ComponentsManager.forgetProton(context, old)
|
||||
else Log.w(TAG, "could not remove $old")
|
||||
}
|
||||
@@ -288,7 +313,7 @@ object ProtonExtras {
|
||||
}
|
||||
|
||||
private fun prefetchNow(context: Context, tool: Tool, onProgress: (String, Int) -> Unit): String? {
|
||||
val asset = releases(tool)?.let { pickAsset(tool, it) } ?: return context.getString(R.string.pextra_no_release, tool.name)
|
||||
val asset = releases(tool)?.let { pickAsset(tool, it) } ?: return context.getString(R.string.pextra_no_release, tool.name, tool.arch)
|
||||
val downloads = File(context.filesDir, "proton-downloads").apply { mkdirs() }
|
||||
val archive = File(downloads, "${tool.id}-${asset.name}")
|
||||
if (asset.size > 0 && archive.length() > asset.size) archive.delete()
|
||||
@@ -305,7 +330,7 @@ object ProtonExtras {
|
||||
if (SessionState.running) return context.getString(R.string.pextra_stop_session)
|
||||
if (!LinuxRuntime.isInstalled(context)) return context.getString(R.string.user_apps_runtime_required)
|
||||
|
||||
val asset = releases(tool)?.let { pickAsset(tool, it) } ?: return context.getString(R.string.pextra_no_release, tool.name)
|
||||
val asset = releases(tool)?.let { pickAsset(tool, it) } ?: return context.getString(R.string.pextra_no_release, tool.name, tool.arch)
|
||||
val downloads = File(context.filesDir, "proton-downloads").apply { mkdirs() }
|
||||
val archive = File(downloads, "${tool.id}-${asset.name}")
|
||||
if (asset.size > 0 && archive.length() > asset.size) archive.delete()
|
||||
@@ -374,7 +399,7 @@ object ProtonExtras {
|
||||
archive.delete()
|
||||
unqueue(context, tool)
|
||||
record(context, tool, placed, asset.tag)
|
||||
if (tool.id == OWN || tool.id == BIONIC) replaceOlder(context, tool)
|
||||
if (tool.id == OWN || tool.id == BIONIC || tool.id == ANTICHEAT) replaceOlder(context, tool)
|
||||
if (EsyncPacks.enabled(context)) {
|
||||
onProgress(context.getString(R.string.esync_fetching), -1)
|
||||
try {
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.content.Context
|
||||
import android.os.Environment
|
||||
import android.util.Log
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.core.CpuFeatures
|
||||
import com.droiddeck.launcher.core.FileUtils
|
||||
import com.droiddeck.launcher.runtime.BwrapSpawner
|
||||
import com.droiddeck.launcher.runtime.DesktopCatalog
|
||||
@@ -22,6 +23,10 @@ object SessionFiles {
|
||||
private const val NO_PAD_SWITCH = "Download/droiddeck-no-pad"
|
||||
const val DIRECTAUDIO_DIR = "usr/local/lib/directaudio"
|
||||
private const val STAGED_LEDGER = "usr/local/.droiddeck-staged"
|
||||
internal const val LSE_EMU = "usr/local/lib/droiddeck-lse/liblse_emu.so"
|
||||
|
||||
internal fun lsePreload(lacksAtomics: Boolean, staged: Boolean, lseEmu: String? = null): String =
|
||||
if (lacksAtomics && staged && lseEmu != "0") "/$LSE_EMU\n" else ""
|
||||
private const val IME_MANIFEST = "usr/local/share/droiddeck/ime-files.json"
|
||||
private const val IME_DEFAULT_MODE = 420
|
||||
val DIRECTAUDIO_SETS = arrayOf("linux-wine11", "linux-wine11-systhread")
|
||||
@@ -102,10 +107,23 @@ object SessionFiles {
|
||||
}
|
||||
|
||||
private val STAGE_LOCK = Any()
|
||||
@Volatile private var activeSessionLseEmu: String? = null
|
||||
|
||||
fun stage(context: Context, root: File, startsSession: Boolean = false) = synchronized(STAGE_LOCK) { stageNow(context, root, startsSession) }
|
||||
fun stage(context: Context, root: File, startsSession: Boolean = false) =
|
||||
stage(context, root, startsSession, lseEmu = null)
|
||||
|
||||
private fun stageNow(context: Context, root: File, startsSession: Boolean) {
|
||||
fun stage(context: Context, root: File, startsSession: Boolean, lseEmu: String?) =
|
||||
synchronized(STAGE_LOCK) {
|
||||
val selection = if (startsSession) {
|
||||
activeSessionLseEmu = lseEmu
|
||||
lseEmu
|
||||
} else {
|
||||
lseEmu ?: activeSessionLseEmu
|
||||
}
|
||||
stageNow(context, root, startsSession, selection)
|
||||
}
|
||||
|
||||
private fun stageNow(context: Context, root: File, startsSession: Boolean, lseEmu: String?) {
|
||||
if (DesktopCatalog.desktopInstalled(root) && !DesktopCatalog.desktopFromPack(root)) try { DesktopCatalog.cleanLegacy(context) }
|
||||
catch (e: Exception) { Log.w(TAG, "LXQt cleanup will retry next session", e) }
|
||||
GameEnvironmentStore.publish(context)
|
||||
@@ -281,6 +299,7 @@ object SessionFiles {
|
||||
"usr/local/lib/droiddeck-pipewire.tzst" to "usr/local/lib/droiddeck-pipewire.tzst",
|
||||
"usr/local/share/licenses/dwarfs/LICENSE" to "usr/local/share/licenses/dwarfs/LICENSE",
|
||||
"usr/local/share/licenses/uruntime/LICENSE" to "usr/local/share/licenses/uruntime/LICENSE",
|
||||
LSE_EMU to LSE_EMU,
|
||||
) + mangoapp + xclipse.map { it to it } + maliCompat + msitools.map { it to it } + vr + gpuLoad + fexPreloads).filter { (asset, _) ->
|
||||
val dir = asset.substringBeforeLast('/')
|
||||
runCatching { context.assets.list("linuxfs/$dir")?.contains(asset.substringAfterLast('/')) == true }.getOrDefault(false)
|
||||
@@ -343,20 +362,22 @@ object SessionFiles {
|
||||
stageImeFiles(context, root, ledger)
|
||||
ledger.save()
|
||||
for (old in arrayOf("aarch64-unix", "aarch64-windows", "i386-windows")) File(root, "$DIRECTAUDIO_DIR/lib/wine/$old").deleteRecursively()
|
||||
val preload = StringBuilder("/usr/local/lib/libddsession.so\n")
|
||||
val preload = StringBuilder(lsePreload(CpuFeatures.lacksAtomics, File(root, LSE_EMU).isFile, lseEmu))
|
||||
preload.append("/usr/local/lib/libddsession.so\n")
|
||||
if (!File(Environment.getExternalStorageDirectory(), NO_PAD_SWITCH).exists()) {
|
||||
preload.append("/usr/local/lib/libfakeinput.so\n")
|
||||
}
|
||||
val nativeUserland = SessionPrefs.nativeUserland(context)
|
||||
if (nativeUserland) com.droiddeck.launcher.runtime.NativeGuest.prepare(context, root)
|
||||
if (ProotFastPath.enabled(context)) {
|
||||
com.droiddeck.launcher.runtime.NativeGuest.prepare(context, root)
|
||||
val native = com.droiddeck.launcher.runtime.NativeGuest.available(root)
|
||||
val nativePreload = preload.toString()
|
||||
if (ProotFastPath.enabled(context, native)) {
|
||||
val library = com.droiddeck.launcher.agent.AgentEnv.fastPathLibrary(context)
|
||||
preload.append(library + "\n")
|
||||
if (startsSession && library != ProotFastPath.LIBRARY) Log.i(TAG, "fast path preload: $library (debugging override)")
|
||||
}
|
||||
val etc = File(root, "etc").apply { mkdirs() }
|
||||
File(etc, "droiddeck").mkdirs()
|
||||
FileUtils.writeString(File(etc, "droiddeck/native-preload"), preload.toString())
|
||||
FileUtils.writeString(File(etc, "droiddeck/native-preload"), nativePreload)
|
||||
val staged = File(etc, "ld.so.preload.staged")
|
||||
if (!FileUtils.writeString(staged, preload.toString())
|
||||
|| !staged.renameTo(File(etc, "ld.so.preload"))) {
|
||||
|
||||
@@ -112,10 +112,21 @@ object SessionPrefs {
|
||||
else -> false
|
||||
}
|
||||
|
||||
fun launcherFullscreen(context: Context): Boolean = prefs(context).getBoolean("launcherFullscreen", true)
|
||||
fun launcherFullscreenMode(context: Context): FullscreenMode {
|
||||
val preferences = prefs(context)
|
||||
return FullscreenMode.fromStored(preferences.getString("launcherFullscreenMode", null))
|
||||
?: if (preferences.getBoolean("launcherFullscreen", true)) FullscreenMode.ALWAYS else FullscreenMode.OFF
|
||||
}
|
||||
|
||||
fun setLauncherFullscreen(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("launcherFullscreen", on).apply()
|
||||
fun setLauncherFullscreenMode(context: Context, mode: FullscreenMode) {
|
||||
prefs(context).edit().putString("launcherFullscreenMode", mode.name).apply()
|
||||
}
|
||||
|
||||
fun sessionFullscreenMode(context: Context): FullscreenMode =
|
||||
FullscreenMode.fromStored(prefs(context).getString("sessionFullscreenMode", null)) ?: FullscreenMode.ALWAYS
|
||||
|
||||
fun setSessionFullscreenMode(context: Context, mode: FullscreenMode) {
|
||||
prefs(context).edit().putString("sessionFullscreenMode", mode.name).apply()
|
||||
}
|
||||
|
||||
fun launcherFrost(context: Context): Boolean = prefs(context).getBoolean("launcherFrost", false)
|
||||
@@ -837,6 +848,7 @@ object SessionPrefs {
|
||||
prefs(context).edit().putString("osc", mode).apply()
|
||||
}
|
||||
|
||||
|
||||
fun oscRearButtons(context: Context): Boolean = prefs(context).getBoolean("oscRearButtons", false)
|
||||
fun setOscRearButtons(context: Context, shown: Boolean) { prefs(context).edit().putBoolean("oscRearButtons", shown).apply() }
|
||||
|
||||
@@ -1170,21 +1182,9 @@ object SessionPrefs {
|
||||
prefs(context).edit().putBoolean("mountSharedStorage", on).apply()
|
||||
}
|
||||
|
||||
fun prootNoSeccomp(context: Context): Boolean = prefs(context).getBoolean("prootNoSeccomp", false)
|
||||
|
||||
fun setProotNoSeccomp(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("prootNoSeccomp", on).apply()
|
||||
}
|
||||
|
||||
fun nativeUserland(context: Context): Boolean = prefs(context).getBoolean("nativeUserland", true)
|
||||
|
||||
/** The session's long-lived programs run in worker processes Android does not count (GuestWorkers). */
|
||||
fun childProcessHandoff(context: Context): Boolean = prefs(context).getBoolean("childProcessHandoff", true)
|
||||
|
||||
fun setNativeUserland(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("nativeUserland", on).apply()
|
||||
}
|
||||
|
||||
/** Whether the Plasma desktop, and so its apps and shells, runs as an ordinary user instead of root (native userland only). */
|
||||
fun desktopAsUser(context: Context): Boolean = prefs(context).getBoolean("desktopAsUser", false)
|
||||
|
||||
@@ -1192,12 +1192,6 @@ object SessionPrefs {
|
||||
prefs(context).edit().putBoolean("desktopAsUser", on).apply()
|
||||
}
|
||||
|
||||
fun prootFastPath(context: Context): Boolean = prefs(context).getBoolean("prootFastPath", true)
|
||||
|
||||
fun setProotFastPath(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("prootFastPath", on).apply()
|
||||
}
|
||||
|
||||
fun cursorComposite(context: Context): Boolean = prefs(context).getBoolean("cursorComposite", true)
|
||||
|
||||
fun setCursorComposite(context: Context, on: Boolean) {
|
||||
@@ -1912,6 +1906,9 @@ object SessionPrefs {
|
||||
return if (pip && mirrorRefreshLimit <= 0 && (limit <= 0 || limit > PIP_FPS)) PIP_FPS else limit
|
||||
}
|
||||
|
||||
fun layerFrameRate(ownLimit: Int, refreshHz: Float, blackFrameInsertion: Boolean): Float =
|
||||
if (ownLimit > 0 && !blackFrameInsertion) ownLimit.toFloat() else refreshHz
|
||||
|
||||
/** The per-app rate Android holds this window to (Game Mode's FPS override), or 0 when the panel's rate applies. */
|
||||
fun hostFrameCap(overrideHz: Float, panelHz: Float): Int =
|
||||
if (overrideHz > 1f && panelHz - overrideHz > 1f) Math.round(overrideHz) else 0
|
||||
@@ -2011,24 +2008,84 @@ object SessionPrefs {
|
||||
sessionPrefs.edit().putString(SCREEN_EFFECTS_PROFILES_KEY, profiles.toString()).apply()
|
||||
}
|
||||
|
||||
private const val GAME_UPSCALER_OVERRIDES_KEY = "upscaler.gameOverrides"
|
||||
|
||||
private fun gameUpscalerOverrides(context: Context): JSONObject = runCatching {
|
||||
JSONObject(prefs(context).getString(GAME_UPSCALER_OVERRIDES_KEY, null) ?: "{}")
|
||||
}.getOrDefault(JSONObject())
|
||||
|
||||
private fun legacyScreenEffectsUpscaler(context: Context, profileId: String): Int? =
|
||||
runCatching {
|
||||
val profiles = JSONObject(prefs(context).getString(SCREEN_EFFECTS_PROFILES_KEY, null) ?: "{}")
|
||||
val profile = profiles.optJSONObject(profileId)
|
||||
if (profile?.has(SCREEN_EFFECTS_PROFILE_UPSCALER_KEY) == true) {
|
||||
profile.optInt(SCREEN_EFFECTS_PROFILE_UPSCALER_KEY, -1).takeIf { it >= 0 }
|
||||
} else null
|
||||
}.getOrNull()?.let(::canonicalUpscaler)
|
||||
|
||||
private fun clearLegacyScreenEffectsUpscaler(context: Context, profileId: String) {
|
||||
val sessionPrefs = prefs(context)
|
||||
val profiles = runCatching {
|
||||
JSONObject(sessionPrefs.getString(SCREEN_EFFECTS_PROFILES_KEY, null) ?: "{}")
|
||||
}.getOrNull() ?: return
|
||||
val profile = profiles.optJSONObject(profileId) ?: return
|
||||
if (!profile.has(SCREEN_EFFECTS_PROFILE_UPSCALER_KEY)) return
|
||||
profile.remove(SCREEN_EFFECTS_PROFILE_UPSCALER_KEY)
|
||||
if (profile.length() == 0) profiles.remove(profileId)
|
||||
sessionPrefs.edit().apply {
|
||||
if (profiles.length() == 0) remove(SCREEN_EFFECTS_PROFILES_KEY)
|
||||
else putString(SCREEN_EFFECTS_PROFILES_KEY, profiles.toString())
|
||||
}.apply()
|
||||
}
|
||||
|
||||
fun hasGameUpscalerOverride(context: Context, gameId: String): Boolean {
|
||||
if (gameId.isBlank()) return false
|
||||
val stored = gameUpscalerOverrides(context)
|
||||
return (stored.has(gameId) && stored.optInt(gameId, -1) >= 0) ||
|
||||
legacyScreenEffectsUpscaler(context, "game:$gameId") != null
|
||||
}
|
||||
|
||||
fun setGameUpscaler(context: Context, gameId: String, mode: Int) {
|
||||
if (gameId.isBlank()) return
|
||||
val overrides = gameUpscalerOverrides(context)
|
||||
overrides.put(gameId, canonicalUpscaler(mode))
|
||||
prefs(context).edit().putString(GAME_UPSCALER_OVERRIDES_KEY, overrides.toString()).apply()
|
||||
clearLegacyScreenEffectsUpscaler(context, "game:$gameId")
|
||||
}
|
||||
|
||||
fun clearGameUpscaler(context: Context, gameId: String) {
|
||||
if (gameId.isBlank()) return
|
||||
val sessionPrefs = prefs(context)
|
||||
val overrides = gameUpscalerOverrides(context)
|
||||
if (overrides.has(gameId)) {
|
||||
overrides.remove(gameId)
|
||||
sessionPrefs.edit().apply {
|
||||
if (overrides.length() == 0) remove(GAME_UPSCALER_OVERRIDES_KEY)
|
||||
else putString(GAME_UPSCALER_OVERRIDES_KEY, overrides.toString())
|
||||
}.apply()
|
||||
}
|
||||
clearLegacyScreenEffectsUpscaler(context, "game:$gameId")
|
||||
}
|
||||
|
||||
fun hasScreenEffectsUpscalerOverride(context: Context, profileId: String?): Boolean {
|
||||
if (profileId.isNullOrBlank()) return false
|
||||
return runCatching {
|
||||
val profiles = JSONObject(prefs(context).getString(SCREEN_EFFECTS_PROFILES_KEY, null) ?: "{}")
|
||||
profiles.optJSONObject(profileId)?.has(SCREEN_EFFECTS_PROFILE_UPSCALER_KEY) == true
|
||||
}.getOrDefault(false)
|
||||
if (profileId.startsWith("game:")) {
|
||||
return hasGameUpscalerOverride(context, profileId.removePrefix("game:"))
|
||||
}
|
||||
return legacyScreenEffectsUpscaler(context, profileId) != null
|
||||
}
|
||||
|
||||
fun screenEffectsUpscaler(context: Context, profileId: String?): Int {
|
||||
if (profileId.isNullOrBlank()) return upscaler(context)
|
||||
val stored = runCatching {
|
||||
val profiles = JSONObject(prefs(context).getString(SCREEN_EFFECTS_PROFILES_KEY, null) ?: "{}")
|
||||
val profile = profiles.optJSONObject(profileId)
|
||||
if (profile?.has(SCREEN_EFFECTS_PROFILE_UPSCALER_KEY) == true) {
|
||||
profile.optInt(SCREEN_EFFECTS_PROFILE_UPSCALER_KEY, -1)
|
||||
} else -1
|
||||
}.getOrDefault(-1)
|
||||
return if (stored >= 0) canonicalUpscaler(stored) else upscaler(context)
|
||||
if (profileId.startsWith("game:")) {
|
||||
val gameId = profileId.removePrefix("game:")
|
||||
val overrides = gameUpscalerOverrides(context)
|
||||
if (overrides.has(gameId)) {
|
||||
val stored = overrides.optInt(gameId, -1)
|
||||
if (stored >= 0) return canonicalUpscaler(stored)
|
||||
}
|
||||
}
|
||||
return legacyScreenEffectsUpscaler(context, profileId) ?: upscaler(context)
|
||||
}
|
||||
|
||||
fun setScreenEffectsUpscaler(context: Context, profileId: String?, mode: Int) {
|
||||
@@ -2036,6 +2093,10 @@ object SessionPrefs {
|
||||
setUpscaler(context, mode)
|
||||
return
|
||||
}
|
||||
if (profileId.startsWith("game:")) {
|
||||
setGameUpscaler(context, profileId.removePrefix("game:"), mode)
|
||||
return
|
||||
}
|
||||
val sessionPrefs = prefs(context)
|
||||
val profiles = runCatching {
|
||||
JSONObject(sessionPrefs.getString(SCREEN_EFFECTS_PROFILES_KEY, null) ?: "{}")
|
||||
@@ -2072,6 +2133,7 @@ object SessionPrefs {
|
||||
val profiles = runCatching {
|
||||
JSONObject(sessionPrefs.getString(SCREEN_EFFECTS_PROFILES_KEY, null) ?: "{}")
|
||||
}.getOrElse { JSONObject() }
|
||||
if (profileId.startsWith("game:")) clearGameUpscaler(context, profileId.removePrefix("game:"))
|
||||
if (!profiles.has(profileId)) return
|
||||
profiles.remove(profileId)
|
||||
sessionPrefs.edit().apply {
|
||||
|
||||
@@ -47,6 +47,7 @@ import com.droiddeck.launcher.input.SteamControllerBle
|
||||
import com.droiddeck.launcher.runtime.BwrapSpawner
|
||||
import com.droiddeck.launcher.runtime.LinuxNetworkLinkComponent
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import com.droiddeck.launcher.runtime.NativeGuest
|
||||
import com.droiddeck.launcher.runtime.ProotFastPath
|
||||
import com.droiddeck.launcher.runtime.UserApps
|
||||
import com.droiddeck.launcher.wayland.WaylandCompositor
|
||||
@@ -566,6 +567,7 @@ class SessionService : Service() {
|
||||
.onFailure { Log.w(TAG, "agent environment skipped", it) }
|
||||
val agentEnvironment = nextAgentEnvironment.getOrDefault(emptyList())
|
||||
val customEnvironment = extraEnv()
|
||||
val lseEmu = (customEnvironment + agentEnvironment).lastOrNull { it.startsWith("LSE_EMU=") }?.substringAfter('=')
|
||||
try {
|
||||
if (systemVulkan) {
|
||||
SystemVulkanDriver.prepare(this)
|
||||
@@ -575,7 +577,7 @@ class SessionService : Service() {
|
||||
}
|
||||
pruneSystemVulkanRuntime()
|
||||
}
|
||||
SessionFiles.stage(this, root, startsSession = true)
|
||||
SessionFiles.stage(this, root, startsSession = true, lseEmu = lseEmu)
|
||||
} catch (error: Exception) {
|
||||
Log.e(TAG, "Could not prepare the session graphics runtime", error)
|
||||
failSession(gen, "GRAPHICS_RUNTIME_FAILED", getString(R.string.session_graphics_runtime_failed), -1)
|
||||
@@ -783,12 +785,13 @@ class SessionService : Service() {
|
||||
SessionEvents.step("shm-clear") { FileUtils.clear(File(LinuxRuntime.liveDir(this), "shm")) }
|
||||
|
||||
val sharedStorage = LinuxRuntime.sharedStorage(this)
|
||||
val binds = sessionBinds(controllersOn, fakeInputDir, sessionDir, guest, sessionRoot, runtimeDir, sharedStorage)
|
||||
val nativeUserland = com.droiddeck.launcher.runtime.NativeGuest.enabled(this)
|
||||
val nativeUserland = NativeGuest.enabled(this)
|
||||
val fastPath = ProotFastPath.enabled(this, nativeUserland)
|
||||
val binds = sessionBinds(controllersOn, fakeInputDir, sessionDir, guest, sessionRoot, runtimeDir, sharedStorage, fastPath)
|
||||
synchronized(stopLock) {
|
||||
if (gen == sessionGen && SessionState.running) com.droiddeck.launcher.runtime.NativeGuest.sessionMode = nativeUserland
|
||||
}
|
||||
val fastPathKey = if (ProotFastPath.enabled(this)) {
|
||||
val fastPathKey = if (fastPath) {
|
||||
val prootBinds = LinuxRuntime.binds(
|
||||
this, sessionRoot, runtimeDir, sharedStorage, binds,
|
||||
)
|
||||
@@ -809,16 +812,14 @@ class SessionService : Service() {
|
||||
LinuxRuntime.rememberSessionBinds(sessionBindSpecs)
|
||||
com.droiddeck.launcher.runtime.NativeGuest.command(root, guest.first(), guest.drop(1))
|
||||
} else {
|
||||
val reason = if (NativeGuest.loader(root) == null) "missing glibc loader" else "missing native hook"
|
||||
Log.i(TAG, "guest runtime: using PRoot ($reason)")
|
||||
LinuxRuntime.command(this, sessionRoot, runtimeDir, sharedStorage, binds, guest)
|
||||
}
|
||||
|
||||
val prootEnv = HostEnvironment()
|
||||
prootEnv["PROOT_LOADER"] = LinuxRuntime.prootLoader(this).path
|
||||
prootEnv["PROOT_TMP_DIR"] = LinuxRuntime.prootTempDir(this).path
|
||||
if (SessionPrefs.prootNoSeccomp(this)) {
|
||||
prootEnv["PROOT_NO_SECCOMP"] = "1"
|
||||
if (!nativeUserland) Log.i(TAG, "proot: seccomp acceleration off by request")
|
||||
}
|
||||
fastPathKey?.let { ProotFastPath.hostEnv(it).let { (k, v) -> prootEnv[k] = v } }
|
||||
for (key in listOf("PROOT_PROFILE", "PROOT_PROFILE_SLOW_US")) {
|
||||
guest.lastOrNull { it.startsWith("$key=") }?.substringAfter('=')?.let { prootEnv[key] = it }
|
||||
@@ -830,7 +831,7 @@ class SessionService : Service() {
|
||||
if (drives > 0) Log.i(TAG, "$drives Wine drive links given their guest paths back")
|
||||
val hostEnv = if (nativeUserland) HostEnvironment().also { env ->
|
||||
Log.i(TAG, "native userland: no proot (${sessionBindSpecs.size} mounts)")
|
||||
com.droiddeck.launcher.runtime.NativeGuest.sessionEnvironment(root, sessionBindSpecs, guest.first(), SessionPrefs.guestHostname(this))
|
||||
com.droiddeck.launcher.runtime.NativeGuest.sessionEnvironment(root, sessionBindSpecs, guest.first(), SessionPrefs.guestHostname(this), lseEmu)
|
||||
.forEach { (k, v) -> env[k] = v }
|
||||
} else prootEnv
|
||||
|
||||
@@ -1312,6 +1313,7 @@ class SessionService : Service() {
|
||||
sessionRoot: File,
|
||||
runtimeDir: File,
|
||||
sharedStorage: File?,
|
||||
fastPath: Boolean,
|
||||
): ArrayList<String> {
|
||||
val binds = ArrayList<String>()
|
||||
if (controllersOn) binds.add(fakeInputDir.path + ":/dev/input")
|
||||
@@ -1355,10 +1357,17 @@ class SessionService : Service() {
|
||||
if (controllersOn) components.add(RumbleComponent().also { it.attach(this) })
|
||||
val home = File(LinuxRuntime.rootDir(this), "root")
|
||||
File(home, "Storage").mkdirs()
|
||||
val addedExeFolders = com.droiddeck.launcher.frontend.AddedExes.list(this).map { File(it.folder) }.distinctBy { it.path }
|
||||
val addedGameRoots = com.droiddeck.launcher.frontend.AddedGames.roots(this)
|
||||
val addedFolders = (addedExeFolders + addedGameRoots.map { it.host }).distinctBy { it.path }
|
||||
for (folder in addedFolders) {
|
||||
if (com.droiddeck.launcher.files.AllFilesAccess.mayHideFilesIn(folder.path))
|
||||
Log.w(TAG, "added games: Android may hide .exe files in $folder because All files access is missing")
|
||||
}
|
||||
if (sharedStorage != null) {
|
||||
binds.add(sharedStorage.path + ":/root/Storage")
|
||||
} else {
|
||||
for (folder in com.droiddeck.launcher.frontend.AddedExes.list(this).map { File(it.folder) }.distinctBy { it.path }) {
|
||||
for (folder in addedExeFolders) {
|
||||
val guest = com.droiddeck.launcher.frontend.AddedGames.guestPath(this, folder) ?: continue
|
||||
if (!guest.startsWith("/root/Storage/") || !folder.isDirectory) continue
|
||||
File(LinuxRuntime.rootDir(this), guest.removePrefix("/")).mkdirs()
|
||||
@@ -1409,7 +1418,7 @@ class SessionService : Service() {
|
||||
Log.w(TAG, "storage diagnostics: selected library could not be identified; metadata snapshot only")
|
||||
}
|
||||
}
|
||||
for (root in com.droiddeck.launcher.frontend.AddedGames.roots(this)) {
|
||||
for (root in addedGameRoots) {
|
||||
if (root.host.isDirectory && root.host.canRead()) {
|
||||
File(LinuxRuntime.rootDir(this), root.guest.removePrefix("/")).mkdirs()
|
||||
binds.add(root.host.path + ":" + root.guest)
|
||||
@@ -1438,7 +1447,7 @@ class SessionService : Service() {
|
||||
if (storageDiagnosticLibrary != null && library != null) libraries.add(SecondaryLibrary.CARD_GUESTS[0] to library.label)
|
||||
val gamesLibraries = GameStorage.gamesFolderLibraries(this)
|
||||
if (gamesLibraries.isNotEmpty()) {
|
||||
var room = if (ProotFastPath.enabled(this)) {
|
||||
var room = if (fastPath) {
|
||||
ProotFastPath.MAX_BINDS - LinuxRuntime.binds(this, sessionRoot, runtimeDir, sharedStorage, binds).size
|
||||
} else Int.MAX_VALUE
|
||||
for (games in gamesLibraries) {
|
||||
@@ -1480,7 +1489,7 @@ class SessionService : Service() {
|
||||
continue
|
||||
}
|
||||
try {
|
||||
val room = if (ProotFastPath.enabled(this)) {
|
||||
val room = if (fastPath) {
|
||||
ProotFastPath.MAX_BINDS - LinuxRuntime.binds(this, sessionRoot, runtimeDir, sharedStorage, binds).size
|
||||
} else Int.MAX_VALUE
|
||||
val content = SecondaryLibrary.contentPath(entry.host)
|
||||
@@ -1509,7 +1518,7 @@ class SessionService : Service() {
|
||||
if (problem != null) {
|
||||
Log.w(TAG, "x86-64 steam library: $problem")
|
||||
} else try {
|
||||
val room = if (ProotFastPath.enabled(this)) {
|
||||
val room = if (fastPath) {
|
||||
ProotFastPath.MAX_BINDS - LinuxRuntime.binds(this, sessionRoot, runtimeDir, sharedStorage, binds).size
|
||||
} else Int.MAX_VALUE
|
||||
val extra = SecondaryLibrary.binds(filesDir, x64, listOf(GameStorage.X64_CARD_GUEST)).drop(1)
|
||||
@@ -1531,7 +1540,7 @@ class SessionService : Service() {
|
||||
continue
|
||||
}
|
||||
try {
|
||||
val room = if (ProotFastPath.enabled(this)) {
|
||||
val room = if (fastPath) {
|
||||
ProotFastPath.MAX_BINDS - LinuxRuntime.binds(this, sessionRoot, runtimeDir, sharedStorage, binds).size
|
||||
} else Int.MAX_VALUE
|
||||
val extra = SecondaryLibrary.binds(filesDir, entry.x64Host, listOf(entry.x64Guest)).drop(1)
|
||||
@@ -1567,7 +1576,7 @@ class SessionService : Service() {
|
||||
try {
|
||||
val listing = File(filesDir, "session/desktop-volumes.json").apply { parentFile?.mkdirs() }
|
||||
val volumes = org.json.JSONArray()
|
||||
var room = if (ProotFastPath.enabled(this)) {
|
||||
var room = if (fastPath) {
|
||||
ProotFastPath.MAX_BINDS - LinuxRuntime.binds(this, sessionRoot, runtimeDir, sharedStorage, binds).size
|
||||
} else Int.MAX_VALUE
|
||||
for (root in com.droiddeck.launcher.files.StorageRoots.list(this)) {
|
||||
|
||||
@@ -138,6 +138,10 @@ object SessionState {
|
||||
@Volatile var secondScreenMode = com.droiddeck.launcher.input.SecondScreenMode.NONE
|
||||
@Volatile var bottomMenu = false
|
||||
@Volatile var secondScreenDisplay = -1
|
||||
/** The game whose own controls apply now, keyed like its other per-game session settings. */
|
||||
@Volatile var inputGame: String? = null
|
||||
/** Whether control edits made in a game go to the shared profile; every session starts with edits for the game alone. */
|
||||
@Volatile var inputForAllGames = false
|
||||
@Volatile var secondScreenAutoOpened = false
|
||||
@Volatile var secondScreenProvisional = false
|
||||
@Volatile var secondScreenAutomatic = false
|
||||
|
||||
@@ -12,7 +12,7 @@ object SettingsReset {
|
||||
private const val TAG = "SettingsReset"
|
||||
|
||||
internal val SESSION_KEYS = setOf(
|
||||
"orientation", "launcherFullscreen", "launcherFrost", "frostWallpaper", "frostCards", "frostTransparency", "frostCardTransparency", "controllerHaptics", "animations", "lowStorageWarning", "theme", "runSteamAtStartup", "startupSession", "addedGamesArt",
|
||||
"orientation", "launcherFullscreen", "launcherFullscreenMode", "sessionFullscreenMode", "launcherFrost", "frostWallpaper", "frostCards", "frostTransparency", "frostCardTransparency", "controllerHaptics", "animations", "lowStorageWarning", "theme", "runSteamAtStartup", "startupSession", "addedGamesArt",
|
||||
"drawerWidthDp", "dualScreenMode", "dualScreenSessionMode", "dualScreenLauncher", "dualScreenSessionControls", "androidTextFieldKeyboard",
|
||||
"soundtracksIngame", "gameStoresSpeedTier", "gameStoresParallel", "storesOpenTab", "storesShowMature",
|
||||
"storesInstallLanguage",
|
||||
|
||||
@@ -8,7 +8,6 @@ import androidx.compose.runtime.setValue
|
||||
import com.droiddeck.launcher.core.AddonPack
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import com.droiddeck.launcher.session.SessionEvents
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import com.droiddeck.launcher.session.SessionState
|
||||
import com.droiddeck.launcher.stores.Store
|
||||
import com.droiddeck.launcher.stores.AchievementNotifications
|
||||
@@ -149,7 +148,6 @@ object GogComet {
|
||||
remove("LD_PRELOAD"); remove("LD_AUDIT"); remove("LD_LIBRARY_PATH")
|
||||
put("PROOT_LOADER", LinuxRuntime.prootLoader(context).path)
|
||||
put("PROOT_TMP_DIR", LinuxRuntime.prootTempDir(context).path)
|
||||
if (SessionPrefs.prootNoSeccomp(context)) put("PROOT_NO_SECCOMP", "1")
|
||||
LinuxRuntime.prootLibraryPath(context).takeIf { it.isNotEmpty() }?.let { put("LD_LIBRARY_PATH", it) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.droiddeck.launcher.core.AddonPack
|
||||
import com.droiddeck.launcher.runtime.LinuxNetworkLinkComponent
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import com.droiddeck.launcher.runtime.ProotFastPath
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import com.droiddeck.launcher.stores.StoreInstallRoot
|
||||
import org.json.JSONObject
|
||||
import java.io.Closeable
|
||||
@@ -107,7 +106,6 @@ internal object Xodus {
|
||||
remove("LD_PRELOAD"); remove("LD_AUDIT"); remove("LD_LIBRARY_PATH")
|
||||
put("PROOT_LOADER", LinuxRuntime.prootLoader(app).path)
|
||||
put("PROOT_TMP_DIR", LinuxRuntime.prootTempDir(app).path)
|
||||
if (SessionPrefs.prootNoSeccomp(app)) put("PROOT_NO_SECCOMP", "1")
|
||||
fastPathKey?.let { ProotFastPath.hostEnv(it).let { (key, value) -> put(key, value) } }
|
||||
LinuxRuntime.prootLibraryPath(app).takeIf { it.isNotEmpty() }?.let { put("LD_LIBRARY_PATH", it) }
|
||||
}
|
||||
|
||||
@@ -67,13 +67,18 @@ import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
@Composable
|
||||
private fun agentPanelFrame(): Modifier =
|
||||
Modifier.fillMaxWidth().clip(Shape14).background(MaterialTheme.colorScheme.surface)
|
||||
.border(1.dp, LocalPalette.current.line, Shape14).padding(horizontal = 14.dp, vertical = 10.dp)
|
||||
|
||||
/** The model, reasoning effort, permissions and plan mode for the next turns; a conversation keeps going with whatever is chosen. */
|
||||
@Composable
|
||||
internal fun AgentModelPicker() {
|
||||
val context = LocalContext.current
|
||||
val pal = LocalPalette.current
|
||||
val models = remember(AgentHost.harness) { AgentHost.models(context) }
|
||||
Column(Modifier.fillMaxWidth().padding(bottom = 10.dp), verticalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
Column(agentPanelFrame(), verticalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier.horizontalScroll(rememberScrollState())) {
|
||||
val choices = listOf(AgentHarness.Model("", stringResource(R.string.agent_model_default))) + models
|
||||
for (choice in choices) {
|
||||
@@ -269,12 +274,8 @@ internal fun AgentProcessList(modifier: Modifier) {
|
||||
@Composable
|
||||
internal fun AgentUsage() {
|
||||
val context = LocalContext.current
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
Column(
|
||||
Modifier.fillMaxWidth().clip(Shape14).background(colors.surface).border(1.dp, pal.line, Shape14).padding(horizontal = 14.dp, vertical = 10.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
Column(agentPanelFrame(), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
if (AgentHost.window > 0) UsageRow(
|
||||
stringResource(R.string.agent_usage_context),
|
||||
stringResource(R.string.agent_usage_of, tokens(AgentHost.context), tokens(AgentHost.window)),
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Color
|
||||
import android.graphics.LinearGradient
|
||||
import android.graphics.Paint
|
||||
import android.graphics.Shader
|
||||
import android.view.View
|
||||
import android.widget.FrameLayout
|
||||
import com.droiddeck.launcher.input.AirTrigger
|
||||
import java.util.EnumMap
|
||||
import java.util.EnumSet
|
||||
|
||||
@SuppressLint("ViewConstructor")
|
||||
class AirTriggerGlow(context: Context) : View(context) {
|
||||
private val lit = EnumSet.noneOf(AirTrigger::class.java)
|
||||
private val density = resources.displayMetrics.density
|
||||
private val paints = EnumMap<AirTrigger, Paint>(AirTrigger::class.java)
|
||||
|
||||
init {
|
||||
isClickable = false
|
||||
isFocusable = false
|
||||
importantForAccessibility = IMPORTANT_FOR_ACCESSIBILITY_NO
|
||||
layoutParams = FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)
|
||||
val top = TOP_DP * density
|
||||
for ((trigger, look) in mapOf(AirTrigger.LEFT to LEFT, AirTrigger.RIGHT to RIGHT)) {
|
||||
val (color, fade) = look
|
||||
paints[trigger] = Paint().apply {
|
||||
shader = LinearGradient(0f, top, 0f, top + HEIGHT_DP * density,
|
||||
fade.map { Color.argb(it, Color.red(color), Color.green(color), Color.blue(color)) }.toIntArray(),
|
||||
STOPS, Shader.TileMode.CLAMP)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun show(trigger: AirTrigger, on: Boolean) {
|
||||
if (if (on) lit.add(trigger) else lit.remove(trigger)) invalidate()
|
||||
}
|
||||
|
||||
override fun onDraw(canvas: Canvas) {
|
||||
val width = WIDTH_DP * density
|
||||
val margin = SIDE_DP * density
|
||||
val top = TOP_DP * density
|
||||
for (trigger in lit) {
|
||||
val left = if (trigger == AirTrigger.LEFT) margin else this.width - margin - width
|
||||
canvas.drawRect(left, top, left + width, top + HEIGHT_DP * density, paints.getValue(trigger))
|
||||
}
|
||||
}
|
||||
|
||||
private companion object {
|
||||
// Game Space's tgk_*_top_pressed images and their landscape placement on a 2688 x 1216 RedMagic screen.
|
||||
const val WIDTH_DP = 78f
|
||||
const val HEIGHT_DP = 33f
|
||||
const val SIDE_DP = 37f
|
||||
const val TOP_DP = 2f
|
||||
val STOPS = floatArrayOf(0f, 0.04f, 0.05f, 0.2f, 0.4f, 0.6f, 0.8f, 1f)
|
||||
val LEFT = Color.rgb(230, 23, 57) to listOf(255, 255, 150, 102, 55, 36, 18, 0)
|
||||
val RIGHT = Color.rgb(23, 91, 230) to listOf(255, 255, 151, 94, 41, 27, 14, 0)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.input.*
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
private fun fetchText(url: String): String? = runCatching {
|
||||
(URL(url).openConnection() as HttpURLConnection).run {
|
||||
connectTimeout = 10_000; readTimeout = 15_000
|
||||
try {
|
||||
if (responseCode != 200) return@run null
|
||||
inputStream.use { stream ->
|
||||
val bytes = java.io.ByteArrayOutputStream()
|
||||
val buffer = ByteArray(8192)
|
||||
while (bytes.size() <= 1_000_000) {
|
||||
val read = stream.read(buffer)
|
||||
if (read < 0) break
|
||||
bytes.write(buffer, 0, read)
|
||||
}
|
||||
bytes.takeIf { it.size() <= 1_000_000 }?.toString(Charsets.UTF_8.name())
|
||||
}
|
||||
} finally { disconnect() }
|
||||
}
|
||||
}.getOrNull()
|
||||
|
||||
/** Shared Winlator layouts: the list, a preview of one as it would sit on this screen, and Use. */
|
||||
@Composable
|
||||
internal fun CommunityLayouts(role: InputRole, onUse: (Pair<SavedInputLayout, SavedInputBindings>) -> Unit) {
|
||||
val context = LocalContext.current
|
||||
val scope = rememberCoroutineScope()
|
||||
var names by remember { mutableStateOf<List<String>?>(null) }
|
||||
var failed by remember { mutableStateOf(false) }
|
||||
var attempt by remember { mutableIntStateOf(0) }
|
||||
val previews = remember { mutableStateMapOf<String, Pair<SavedInputLayout, SavedInputBindings>?>() }
|
||||
val broken = remember { mutableStateMapOf<String, Boolean>() }
|
||||
var loading by remember { mutableStateOf<String?>(null) }
|
||||
LaunchedEffect(attempt) {
|
||||
failed = false
|
||||
val text = withContext(Dispatchers.IO) { fetchText(WinlatorLayouts.INDEX_URL) }
|
||||
names = text?.let(WinlatorLayouts::parseIndex)
|
||||
failed = names.isNullOrEmpty()
|
||||
}
|
||||
Text(stringResource(R.string.flow_community_hint), Modifier.padding(14.dp), style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
SettingsGroup(stringResource(R.string.flow_community)) {
|
||||
val list = names
|
||||
when {
|
||||
failed -> ActionRow(stringResource(R.string.flow_community_failed), null, stringResource(R.string.input_capture_retry), { attempt++ })
|
||||
list == null -> Text(stringResource(R.string.flow_loading), Modifier.padding(16.dp), color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
else -> for (file in list) {
|
||||
val title = file.removeSuffix(".icp").removeSuffix(".ICP")
|
||||
val preview = previews[file]
|
||||
SettingsRow(title, if (broken[file] == true) stringResource(R.string.flow_community_failed) else null) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
preview?.let { InputLayoutThumbnail(it.first, role) }
|
||||
if (preview == null) SecondaryButton(stringResource(if (loading == file) R.string.flow_loading else R.string.flow_preview),
|
||||
enabled = loading == null, compact = true, modifier = Modifier.testTag("community-preview-$title")) {
|
||||
loading = file
|
||||
scope.launch {
|
||||
val metrics = inputDisplayMetrics(context, role)
|
||||
val raw = withContext(Dispatchers.IO) { fetchText(WinlatorLayouts.fileUrl(file)) }
|
||||
previews[file] = raw?.let {
|
||||
WinlatorLayouts.import(it, title, if (role == InputRole.PRIMARY) InputLayoutScreen.MAIN else InputLayoutScreen.SECONDARY,
|
||||
metrics.widthPixels, metrics.heightPixels)
|
||||
}
|
||||
broken[file] = previews[file] == null
|
||||
loading = null
|
||||
}
|
||||
}
|
||||
else PrimaryButton(stringResource(R.string.flow_use), compact = true, modifier = Modifier.testTag("community-use-$title")) { onUse(preview) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,11 @@ object ControllerHaptics {
|
||||
tick(context)
|
||||
}
|
||||
|
||||
fun tick(context: Context) {
|
||||
fun tick(context: Context) = vibrate(context, VibrationEffect.EFFECT_TICK, 10)
|
||||
|
||||
fun click(context: Context) = vibrate(context, VibrationEffect.EFFECT_CLICK, 20)
|
||||
|
||||
private fun vibrate(context: Context, predefined: Int, fallbackMs: Long) {
|
||||
val vibrator = if (Build.VERSION.SDK_INT >= 31) {
|
||||
context.getSystemService(VibratorManager::class.java)?.defaultVibrator
|
||||
} else {
|
||||
@@ -32,11 +36,11 @@ object ControllerHaptics {
|
||||
} ?: return
|
||||
if (!vibrator.hasVibrator()) return
|
||||
if (Build.VERSION.SDK_INT >= 29) {
|
||||
vibrator.vibrate(VibrationEffect.createPredefined(VibrationEffect.EFFECT_TICK))
|
||||
vibrator.vibrate(VibrationEffect.createPredefined(predefined))
|
||||
} else if (Build.VERSION.SDK_INT >= 26) {
|
||||
vibrator.vibrate(VibrationEffect.createOneShot(10, VibrationEffect.DEFAULT_AMPLITUDE))
|
||||
vibrator.vibrate(VibrationEffect.createOneShot(fallbackMs, VibrationEffect.DEFAULT_AMPLITUDE))
|
||||
} else {
|
||||
@Suppress("DEPRECATION") vibrator.vibrate(10)
|
||||
@Suppress("DEPRECATION") vibrator.vibrate(fallbackMs)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
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.foundation.relocation.BringIntoViewRequester
|
||||
import androidx.compose.foundation.relocation.bringIntoViewRequester
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.layout.onGloballyPositioned
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.input.*
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
|
||||
/** The library as it is saved now, re-read whenever something else saves it. */
|
||||
@Composable
|
||||
internal fun rememberInputLibrary(): State<InputLibrary> {
|
||||
val context = LocalContext.current
|
||||
val library = remember { mutableStateOf(InputLibraries.read(context)) }
|
||||
DisposableEffect(context) {
|
||||
val preferences = context.getSharedPreferences("input-profiles", Context.MODE_PRIVATE)
|
||||
val listener = SharedPreferences.OnSharedPreferenceChangeListener { _, key -> if (key == "library") library.value = InputLibraries.read(context) }
|
||||
preferences.registerOnSharedPreferenceChangeListener(listener)
|
||||
onDispose { preferences.unregisterOnSharedPreferenceChangeListener(listener) }
|
||||
}
|
||||
return library
|
||||
}
|
||||
|
||||
/** A profile's name as players see it: the two built-in profiles keep their stored names in data but read as the standard ones. */
|
||||
internal fun profileLabel(context: Context, profile: SavedInputProfile): String = when {
|
||||
profile.id == InputProfile.GAME && profile.name == "Game" -> context.getString(R.string.flow_profile_game)
|
||||
profile.id == InputProfile.DESKTOP && profile.name == "Desktop" -> context.getString(R.string.flow_profile_desktop)
|
||||
else -> profile.name
|
||||
}
|
||||
|
||||
/** The session menu's Controls section: which profile applies, whether changes are for this game, and the two editors. */
|
||||
@Composable
|
||||
internal fun DrawerControlsGroup(host: MenuHost, a: DrawerActions, track: (String) -> Modifier) {
|
||||
val context = LocalContext.current
|
||||
val library by rememberInputLibrary()
|
||||
var forAll by remember { mutableStateOf(com.droiddeck.launcher.session.SessionState.inputForAllGames) }
|
||||
var failure by remember { mutableStateOf<String?>(null) }
|
||||
val game = a.inputGame
|
||||
var clearing by remember(game?.first) { mutableStateOf(false) }
|
||||
val gameScope = game != null && !forAll
|
||||
fun update(role: InputRole? = null, change: (InputLibrary) -> InputLibrary) {
|
||||
runCatching { InputLibraries.update(context, change) }.onSuccess { a.onInputSelection(role) }
|
||||
.onFailure { failure = it.message ?: context.getString(R.string.input_save_failed) }
|
||||
}
|
||||
val gameKey = game?.first
|
||||
val scopeKey = gameKey.takeIf { gameScope }
|
||||
val active = library.profile(library.activeId(a.desktop, scopeKey))
|
||||
val changes = scopeKey?.let { library.gameChanges(a.desktop, it) } ?: 0
|
||||
val own = gameKey?.let { library.games[it] }
|
||||
val named = library.profiles.map { it.id to profileLabel(context, it) }
|
||||
val mixedId = quickMixedChoiceId(library)
|
||||
val sharedMixed = library.selection(a.desktop).parts.isNotEmpty()
|
||||
val activeLabel = profileLabel(context, active)
|
||||
val sharedLabel = profileLabel(context, library.profile(library.activeId(a.desktop)))
|
||||
val sharedSummary = if (sharedMixed) stringResource(R.string.input_quick_mixed, sharedLabel) else sharedLabel
|
||||
// The per-game choice follows or pins a whole profile; the live mix belongs to shared defaults.
|
||||
val profiles = if (gameScope) listOf(InputProfiles.AUTO to stringResource(R.string.flow_shared_defaults_of, sharedSummary)) + named
|
||||
else listOf(InputProfiles.AUTO to stringResource(R.string.flow_default_profile, profileLabel(context, library.profile(library.defaultId(a.desktop))))) +
|
||||
named + if (sharedMixed) listOf(mixedId to sharedSummary) else emptyList()
|
||||
val selected = if (gameScope) own?.profile ?: InputProfiles.AUTO else if (sharedMixed) mixedId else library.selection(a.desktop).profile
|
||||
val detail = listOfNotNull(if (gameScope && own?.profile != null) activeLabel else sharedSummary,
|
||||
if (changes > 0 && game != null) stringResource(R.string.flow_game_changes, changes) else null).joinToString(" · ")
|
||||
SettingsGroup(stringResource(R.string.flow_controls), key = "controller-input", detail = detail) {
|
||||
if (game != null) ChoiceRow(host, "input-scope", stringResource(R.string.flow_apply_to), null,
|
||||
listOf(false to game.second, true to stringResource(R.string.flow_shared_defaults)), forAll, chipModifier = track("input-scope")) {
|
||||
forAll = it; com.droiddeck.launcher.session.SessionState.inputForAllGames = it
|
||||
}
|
||||
ChoiceRow(host, "input-profile", stringResource(R.string.input_profile), null, profiles, selected, chipModifier = track("input-profile")) { id ->
|
||||
if (gameScope && game != null) update { it.withGameProfile(game.first, game.second, id.takeUnless { it == InputProfiles.AUTO }) }
|
||||
else if (id != mixedId) update { it.selectProfile(a.desktop, id) }
|
||||
}
|
||||
if (!gameScope) SharedInputRoleMix(host, a.desktop, library, track, ::update, inWindow = true)
|
||||
val physical = if (gameScope && gameKey != null && own?.parts?.containsKey(InputRole.PHYSICAL) == true)
|
||||
stringResource(R.string.flow_game_changes, library.gameChanges(a.desktop, gameKey, InputRole.PHYSICAL))
|
||||
else profileLabel(context, active)
|
||||
ActionRow(stringResource(R.string.flow_buttons), physical, stringResource(R.string.flow_remap), a.onEditButtons,
|
||||
modifier = track("input-buttons").testTag("input-edit-buttons"))
|
||||
a.onEditLayout?.let { edit ->
|
||||
val layoutName = if (a.oscMode == SessionPrefs.OSC_STEAM_TOUCH && a.steam) stringResource(R.string.osc_steam_layout)
|
||||
else library.activeLayout(a.desktop, InputRole.PRIMARY, scopeKey)?.name?.let { name ->
|
||||
val configuration = androidx.compose.ui.platform.LocalConfiguration.current
|
||||
name + " · " + stringResource(if (configuration.screenHeightDp > configuration.screenWidthDp) R.string.flow_portrait else R.string.flow_landscape)
|
||||
}
|
||||
ActionRow(stringResource(R.string.flow_layout), layoutName, stringResource(R.string.touch_edit_layout), edit,
|
||||
modifier = track("input-layout").testTag("input-edit-layout"))
|
||||
}
|
||||
if (game != null && own != null) {
|
||||
if (clearing) {
|
||||
DrawerInputPrompt(
|
||||
title = stringResource(R.string.flow_clear_title, game.second),
|
||||
button = stringResource(R.string.common_restore),
|
||||
onConfirm = { clearing = false; update { it.resetGame(game.first) } },
|
||||
onCancel = { clearing = false },
|
||||
confirmModifier = track("input-game-reset-confirm").testTag("input-game-reset-confirm"),
|
||||
cancelModifier = track("input-game-reset-cancel").testTag("input-game-reset-cancel"),
|
||||
) { Text(stringResource(R.string.flow_clear_body, game.second)) }
|
||||
} else {
|
||||
ActionRow(stringResource(R.string.flow_clear_overrides), stringResource(R.string.flow_clear_overrides_hint, game.second),
|
||||
stringResource(R.string.common_restore), { clearing = true }, modifier = track("input-game-reset").testTag("input-game-reset"))
|
||||
}
|
||||
}
|
||||
ActionRow(stringResource(R.string.flow_all_settings), null, stringResource(R.string.ctrl_edit), a.onInputSettings,
|
||||
modifier = track("input-settings").testTag("input-profile-edit"))
|
||||
failure?.let { message ->
|
||||
DrawerInputPrompt(stringResource(R.string.input_save_failed), stringResource(R.string.common_ok),
|
||||
onConfirm = { failure = null }, confirmModifier = track("input-save-error-ok")) {
|
||||
Text(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** A docked drawer can live in a presentation window; it cannot host a platform dialog. */
|
||||
@OptIn(androidx.compose.foundation.ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
internal fun DrawerInputPrompt(
|
||||
title: String,
|
||||
button: String,
|
||||
onConfirm: () -> Unit,
|
||||
onCancel: (() -> Unit)? = null,
|
||||
enabled: Boolean = true,
|
||||
confirmModifier: Modifier = Modifier,
|
||||
cancelModifier: Modifier = Modifier,
|
||||
content: @Composable () -> Unit,
|
||||
) {
|
||||
val reveal = remember { BringIntoViewRequester() }
|
||||
var positioned by remember { mutableStateOf(false) }
|
||||
LaunchedEffect(positioned) { if (positioned) reveal.bringIntoView() }
|
||||
Surface(modifier = Modifier.fillMaxWidth().padding(vertical = 6.dp)
|
||||
.bringIntoViewRequester(reveal).onGloballyPositioned { positioned = true },
|
||||
shape = MaterialTheme.shapes.medium, tonalElevation = 3.dp) {
|
||||
Column(Modifier.padding(12.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
Text(title, style = MaterialTheme.typography.titleSmall)
|
||||
content()
|
||||
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End) {
|
||||
onCancel?.let { cancel ->
|
||||
PadTextButton(onClick = cancel, modifier = cancelModifier) { Text(stringResource(R.string.common_cancel)) }
|
||||
}
|
||||
PadTextButton(onClick = onConfirm, modifier = confirmModifier, enabled = enabled) { Text(button) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88,6 +88,7 @@ import com.droiddeck.launcher.input.SecondScreenDisplay
|
||||
import com.droiddeck.launcher.core.DownloadSource
|
||||
import com.droiddeck.launcher.core.PhantomProcessLimit
|
||||
import com.droiddeck.launcher.core.PhantomProcessStatus
|
||||
import com.droiddeck.launcher.session.FullscreenMode
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import kotlin.math.roundToInt
|
||||
import kotlinx.coroutines.withTimeoutOrNull
|
||||
@@ -176,7 +177,8 @@ class FrontEndState(
|
||||
val orientation: Int = android.content.pm.ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE,
|
||||
val launcherOrientation: Int = android.content.pm.ActivityInfo.SCREEN_ORIENTATION_USER,
|
||||
val homePage: String = com.droiddeck.launcher.core.AppUiPrefs.HOME_PAGE_STEAM,
|
||||
val launcherFullscreen: Boolean = true,
|
||||
val launcherFullscreenMode: FullscreenMode = FullscreenMode.ALWAYS,
|
||||
val sessionFullscreenMode: FullscreenMode = FullscreenMode.ALWAYS,
|
||||
val launcherFrost: Boolean = false,
|
||||
val frostWallpaper: Boolean = true,
|
||||
val frostCards: Boolean = true,
|
||||
@@ -276,7 +278,7 @@ class FrontEndActions(
|
||||
val onShareSessionLog: (File) -> Unit = {},
|
||||
val onSaveSessionLog: (File) -> Unit = {},
|
||||
val onDeleteSessionLog: (File, () -> Unit) -> Unit = { _, done -> done() },
|
||||
val onClearLogs: () -> Unit = {},
|
||||
val onClearLogs: (() -> Unit) -> Unit = {},
|
||||
val onResetSettings: () -> Unit = {},
|
||||
val onOffline: () -> Unit,
|
||||
val onOfflineAuto: () -> Unit = {},
|
||||
@@ -288,7 +290,8 @@ class FrontEndActions(
|
||||
val onOrientation: (Int) -> Unit = {},
|
||||
val onLauncherOrientation: (Int) -> Unit = {},
|
||||
val onHomePage: (String) -> Unit = {},
|
||||
val onLauncherFullscreen: (Boolean) -> Unit = {},
|
||||
val onLauncherFullscreenMode: (FullscreenMode) -> Unit = {},
|
||||
val onSessionFullscreenMode: (FullscreenMode) -> Unit = {},
|
||||
val onLauncherFrost: (Boolean) -> Unit = {},
|
||||
val onFrostWallpaper: (Boolean) -> Unit = {},
|
||||
val onFrostCards: (Boolean) -> Unit = {},
|
||||
@@ -711,9 +714,12 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
|
||||
if (anyFocused) return
|
||||
}
|
||||
}
|
||||
val launcherFullscreen = s.launcherFullscreenMode.hidesSystemBars(
|
||||
androidx.compose.ui.platform.LocalConfiguration.current.orientation,
|
||||
)
|
||||
androidx.compose.foundation.layout.BoxWithConstraints(
|
||||
modifier = Modifier.fillMaxSize().background(if (LocalFrost.current != null) Color.Transparent else colors.background)
|
||||
.windowInsetsPadding(if (s.launcherFullscreen) WindowInsets.displayCutout else WindowInsets.systemBars)
|
||||
.windowInsetsPadding(if (launcherFullscreen) WindowInsets.displayCutout else WindowInsets.systemBars)
|
||||
.onFocusChanged { anyFocused = it.hasFocus },
|
||||
) {
|
||||
val bottomNavigation = maxHeight > maxWidth
|
||||
|
||||
@@ -85,6 +85,7 @@ import com.droiddeck.launcher.core.DeviceSupport
|
||||
import com.droiddeck.launcher.core.DownloadSource
|
||||
import com.droiddeck.launcher.core.PhantomProcessLimit
|
||||
import com.droiddeck.launcher.core.PhantomProcessStatus
|
||||
import com.droiddeck.launcher.session.FullscreenMode
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import com.droiddeck.launcher.stores.download.StoreDownloadTier
|
||||
import com.droiddeck.launcher.R
|
||||
@@ -586,11 +587,17 @@ internal fun SetupPanel(
|
||||
SessionPrefs.setOrientation(ctx, "desktop", value)
|
||||
},
|
||||
)
|
||||
ToggleRow(
|
||||
host, "launcher-fullscreen", stringResource(R.string.setup_fullscreen),
|
||||
if (s.launcherFullscreen) stringResource(R.string.setup_fullscreen_on) else stringResource(R.string.setup_fullscreen_off),
|
||||
s.launcherFullscreen,
|
||||
) { a.onLauncherFullscreen(it) }
|
||||
val fullscreenModes = FullscreenMode.entries.map { it to stringResource(it.label) }
|
||||
ChoiceRow(
|
||||
host, "launcher-fullscreen", stringResource(R.string.setup_launcher_fullscreen),
|
||||
stringResource(R.string.setup_fullscreen_on),
|
||||
fullscreenModes, s.launcherFullscreenMode, onPick = a.onLauncherFullscreenMode,
|
||||
)
|
||||
ChoiceRow(
|
||||
host, "session-fullscreen", stringResource(R.string.setup_session_fullscreen),
|
||||
stringResource(R.string.setup_fullscreen_on),
|
||||
fullscreenModes, s.sessionFullscreenMode, onPick = a.onSessionFullscreenMode,
|
||||
)
|
||||
ToggleRow(
|
||||
host, "page-swipe", stringResource(R.string.setup_page_swipe),
|
||||
stringResource(R.string.setup_page_swipe_hint), PageSwipe.on,
|
||||
@@ -678,89 +685,102 @@ internal fun SetupPanel(
|
||||
}
|
||||
}
|
||||
DEVELOPER_TAB -> {
|
||||
val devContext = LocalContext.current
|
||||
var manageLogs by rememberSaveable { mutableStateOf(false) }
|
||||
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)
|
||||
ToggleRow(host, "developer-tools", stringResource(R.string.dev_tools_show), stringResource(R.string.dev_tools_hint), DeveloperTools.on, sideBySide = true) {
|
||||
DeveloperTools.set(ctx, it)
|
||||
}
|
||||
if (DeveloperTools.on) ToggleRow(host, "agent-commands", stringResource(R.string.setup_agent_commands), stringResource(R.string.setup_agent_commands_hint), s.agentCommands, sideBySide = true) { a.onAgentCommands() }
|
||||
if (DeveloperTools.on && com.droiddeck.launcher.agent.AgentHost.available) {
|
||||
ToggleRow(host, "agent-pet", stringResource(R.string.rail_agent), stringResource(R.string.dev_harness_overlay_hint), AgentPet.enabled, sideBySide = true) {
|
||||
AgentPet.set(ctx, it)
|
||||
}
|
||||
if (AgentPet.enabled && !AgentPet.allowed && AgentPet.usesOverlayWindows(com.droiddeck.launcher.session.QuestExperimental.isSupported())) ActionRow(
|
||||
stringResource(R.string.setup_agent_pet_float), stringResource(R.string.setup_agent_pet_float_hint),
|
||||
stringResource(R.string.setup_agent_pet_allow), onClick = { AgentPet.requestFloating(ctx) }, sideBySide = true,
|
||||
)
|
||||
}
|
||||
if (DeveloperTools.on) ActionRow(
|
||||
stringResource(R.string.dev_ui_zoo), stringResource(R.string.dev_ui_zoo_hint), stringResource(R.string.dev_ui_zoo_open),
|
||||
onClick = { DevPreview.zoo = true }, modifier = Modifier.testTag("dev-ui-zoo"),
|
||||
)
|
||||
if (DeveloperTools.on) ToggleRow(
|
||||
host, "preview-shortcuts", stringResource(R.string.dev_preview_shortcuts), stringResource(R.string.dev_preview_shortcuts_hint),
|
||||
DevPreview.shortcuts,
|
||||
) { DevPreview.setShortcuts(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() }
|
||||
if (DeveloperTools.on) SettingsGroup(stringResource(R.string.dev_group_previews)) {
|
||||
ActionRow(
|
||||
stringResource(R.string.dev_ui_zoo), stringResource(R.string.dev_ui_zoo_hint), stringResource(R.string.dev_ui_zoo_open),
|
||||
onClick = { DevPreview.zoo = true }, modifier = Modifier.testTag("dev-ui-zoo"), sideBySide = true,
|
||||
)
|
||||
ToggleRow(
|
||||
host, "preview-shortcuts", stringResource(R.string.dev_preview_shortcuts), stringResource(R.string.dev_preview_shortcuts_hint),
|
||||
DevPreview.shortcuts, sideBySide = true,
|
||||
) { DevPreview.setShortcuts(ctx, it) }
|
||||
}
|
||||
SettingsGroup(stringResource(R.string.dev_group_diagnostics)) {
|
||||
ToggleRow(host, "logs", stringResource(R.string.setup_logs), stringResource(R.string.setup_logs_hint), s.logsEnabled, sideBySide = true) { a.onLogs() }
|
||||
if (DeveloperTools.on) ToggleRow(
|
||||
host, "enhanced-diagnostics", stringResource(R.string.setup_enhanced_diagnostics),
|
||||
stringResource(R.string.setup_enhanced_diagnostics_hint), s.enhancedDiagnosticsArmed,
|
||||
stringResource(R.string.setup_enhanced_diagnostics_hint), s.enhancedDiagnosticsArmed, sideBySide = true,
|
||||
) { a.onEnhancedDiagnostics() }
|
||||
ToggleRow(
|
||||
host, "game-debug-logs", stringResource(R.string.setup_game_debug_logs),
|
||||
stringResource(if (s.gameDebugLogsNeedsRestart) R.string.setup_game_debug_logs_restart else R.string.setup_game_debug_logs_hint),
|
||||
s.gameDebugLogsEnabled,
|
||||
enabled = s.logsEnabled,
|
||||
enabled = s.logsEnabled, sideBySide = true,
|
||||
) { a.onGameDebugLogs() }
|
||||
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)
|
||||
}
|
||||
if (AgentPet.enabled && !AgentPet.allowed && AgentPet.usesOverlayWindows(com.droiddeck.launcher.session.QuestExperimental.isSupported())) ActionRow(
|
||||
stringResource(R.string.setup_agent_pet_float), stringResource(R.string.setup_agent_pet_float_hint),
|
||||
stringResource(R.string.setup_agent_pet_allow), onClick = { AgentPet.requestFloating(agentContext) },
|
||||
)
|
||||
}
|
||||
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() }
|
||||
if (DeveloperTools.on) ToggleRow(host, "vacdiag", stringResource(R.string.setup_vac_diag), stringResource(R.string.setup_vac_diag_hint), s.vacDiagnostics, sideBySide = true) { a.onVacDiagnostics() }
|
||||
if (DeveloperTools.on) ToggleRow(host, "graphics-logs", stringResource(R.string.setup_graphics_logs), stringResource(R.string.setup_graphics_logs_hint), s.graphicsLogs, sideBySide = true) { 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, sideBySide = true) { a.onSteamGpuDrawing() }
|
||||
}
|
||||
SettingsGroup(stringResource(R.string.dev_group_log_files)) {
|
||||
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()
|
||||
Text(stringResource(R.string.setup_log_sessions), fontSize = 13.sp, fontWeight = FontWeight.SemiBold,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.padding(horizontal = 14.dp, vertical = 10.dp))
|
||||
Text(stringResource(R.string.setup_log_export_hint), fontSize = 12.sp, color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
modifier = Modifier.padding(start = 14.dp, end = 14.dp, bottom = 8.dp))
|
||||
val sessionLogs = remember(ctx, logsRefresh) { com.droiddeck.launcher.session.SessionLogShare.sessions(ctx).asReversed() }
|
||||
if (sessionLogs.isEmpty()) {
|
||||
Text(stringResource(R.string.setup_log_empty), fontSize = 13.sp, color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
modifier = Modifier.padding(horizontal = 14.dp, vertical = 10.dp))
|
||||
}
|
||||
sessionLogs.forEach { folder ->
|
||||
val active = folder == com.droiddeck.launcher.session.SessionPaths.current()
|
||||
var details by remember(folder) { mutableStateOf<com.droiddeck.launcher.session.SessionLogShare.Details?>(null) }
|
||||
LaunchedEffect(folder, logsRefresh) {
|
||||
details = kotlinx.coroutines.withContext(kotlinx.coroutines.Dispatchers.IO) {
|
||||
com.droiddeck.launcher.session.SessionLogShare.details(folder)
|
||||
}
|
||||
progress = com.droiddeck.launcher.session.SessionLogShare.progress, sideBySide = true)
|
||||
ActionRow(
|
||||
stringResource(R.string.setup_saved_logs), stringResource(R.string.dev_log_manage_hint),
|
||||
stringResource(if (manageLogs) R.string.common_close else R.string.setup_manage),
|
||||
onClick = { manageLogs = !manageLogs }, sideBySide = true,
|
||||
)
|
||||
if (manageLogs) {
|
||||
Text(stringResource(R.string.setup_log_sessions), fontSize = 13.sp, fontWeight = FontWeight.SemiBold,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.padding(horizontal = 14.dp, vertical = 10.dp))
|
||||
Text(stringResource(R.string.setup_log_export_hint), fontSize = 12.sp, color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
modifier = Modifier.padding(start = 14.dp, end = 14.dp, bottom = 8.dp))
|
||||
val sessionLogs = remember(ctx, logsRefresh) { com.droiddeck.launcher.session.SessionLogShare.sessions(ctx).asReversed() }
|
||||
if (sessionLogs.isEmpty()) {
|
||||
Text(stringResource(R.string.setup_log_empty), fontSize = 13.sp, color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
modifier = Modifier.padding(horizontal = 14.dp, vertical = 10.dp))
|
||||
}
|
||||
Column(Modifier.fillMaxWidth().padding(horizontal = 14.dp, vertical = 8.dp)) {
|
||||
Text(folder.name, fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = MaterialTheme.colorScheme.onBackground,
|
||||
maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
details?.let { detail ->
|
||||
Text(
|
||||
stringResource(R.string.setup_log_size_date,
|
||||
android.text.format.Formatter.formatShortFileSize(ctx, detail.sizeBytes),
|
||||
"${android.text.format.DateFormat.getDateFormat(ctx).format(java.util.Date(detail.modifiedAt))} ${android.text.format.DateFormat.getTimeFormat(ctx).format(java.util.Date(detail.modifiedAt))}"),
|
||||
fontSize = 12.sp, color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
sessionLogs.forEach { folder ->
|
||||
val active = folder == com.droiddeck.launcher.session.SessionPaths.current()
|
||||
var details by remember(folder) { mutableStateOf<com.droiddeck.launcher.session.SessionLogShare.Details?>(null) }
|
||||
LaunchedEffect(folder, logsRefresh) {
|
||||
details = kotlinx.coroutines.withContext(kotlinx.coroutines.Dispatchers.IO) {
|
||||
com.droiddeck.launcher.session.SessionLogShare.details(folder)
|
||||
}
|
||||
}
|
||||
if (active) Text(stringResource(R.string.setup_log_current), fontSize = 12.sp, color = MaterialTheme.colorScheme.primary)
|
||||
Row(Modifier.fillMaxWidth().padding(top = 6.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
SecondaryButton(stringResource(R.string.setup_log_share), enabled = com.droiddeck.launcher.session.SessionLogShare.progress == null, compact = true, modifier = Modifier.weight(1f)) { a.onShareSessionLog(folder) }
|
||||
SecondaryButton(stringResource(R.string.setup_log_save), enabled = com.droiddeck.launcher.session.SessionLogShare.progress == null, compact = true, modifier = Modifier.weight(1f)) { a.onSaveSessionLog(folder) }
|
||||
SecondaryButton(stringResource(R.string.setup_log_delete), compact = true, enabled = !active, modifier = Modifier.weight(1f)) { deleteSessionLogs = folder }
|
||||
Column(Modifier.fillMaxWidth().padding(horizontal = 14.dp, vertical = 8.dp)) {
|
||||
Text(folder.name, fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = MaterialTheme.colorScheme.onBackground,
|
||||
maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
details?.let { detail ->
|
||||
Text(
|
||||
stringResource(R.string.setup_log_size_date,
|
||||
android.text.format.Formatter.formatShortFileSize(ctx, detail.sizeBytes),
|
||||
"${android.text.format.DateFormat.getDateFormat(ctx).format(java.util.Date(detail.modifiedAt))} ${android.text.format.DateFormat.getTimeFormat(ctx).format(java.util.Date(detail.modifiedAt))}"),
|
||||
fontSize = 12.sp, color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
}
|
||||
if (active) Text(stringResource(R.string.setup_log_current), fontSize = 12.sp, color = MaterialTheme.colorScheme.primary)
|
||||
Row(Modifier.fillMaxWidth().padding(top = 6.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
SecondaryButton(stringResource(R.string.setup_log_share), enabled = com.droiddeck.launcher.session.SessionLogShare.progress == null, compact = true, modifier = Modifier.weight(1f)) { a.onShareSessionLog(folder) }
|
||||
SecondaryButton(stringResource(R.string.setup_log_save), enabled = com.droiddeck.launcher.session.SessionLogShare.progress == null, compact = true, modifier = Modifier.weight(1f)) { a.onSaveSessionLog(folder) }
|
||||
SecondaryButton(stringResource(R.string.setup_log_delete), compact = true, enabled = !active, modifier = Modifier.weight(1f)) { deleteSessionLogs = folder }
|
||||
}
|
||||
}
|
||||
androidx.compose.material3.HorizontalDivider()
|
||||
}
|
||||
androidx.compose.material3.HorizontalDivider()
|
||||
ActionRow(stringResource(R.string.setup_saved_logs_hint, com.droiddeck.launcher.session.SessionPaths.KEEP_SESSIONS),
|
||||
null, stringResource(R.string.setup_clear_logs),
|
||||
onClick = { a.onClearLogs { logsRefresh++ } }, sideBySide = true)
|
||||
}
|
||||
ActionRow(stringResource(R.string.setup_saved_logs), stringResource(R.string.setup_saved_logs_hint, com.droiddeck.launcher.session.SessionPaths.KEEP_SESSIONS), stringResource(R.string.setup_clear_logs), a.onClearLogs)
|
||||
}
|
||||
SettingsGroup(stringResource(R.string.dev_group_reset)) {
|
||||
ActionRow(stringResource(R.string.setup_reset_settings), stringResource(R.string.setup_reset_settings_hint),
|
||||
stringResource(R.string.setup_reset_settings_button), a.onResetSettings)
|
||||
stringResource(R.string.setup_reset_settings_button), a.onResetSettings, sideBySide = true)
|
||||
}
|
||||
}
|
||||
GLASSES_TAB -> GlassesSetupPanel()
|
||||
@@ -881,6 +901,28 @@ internal fun LaunchSettings(s: FrontEndState, a: FrontEndActions, host: MenuHost
|
||||
com.droiddeck.launcher.gpu.FrameGen.hasGameOverride(context, it)
|
||||
} ?: false)
|
||||
}
|
||||
val scalingFilterChoices = SessionPrefs.upscalerChoices(context)
|
||||
var gameUpscaler by remember(frameGenProfileKey) {
|
||||
mutableStateOf(frameGenProfileKey?.let {
|
||||
SessionPrefs.screenEffectsUpscaler(context, "game:$it")
|
||||
} ?: SessionPrefs.upscaler(context))
|
||||
}
|
||||
var gameUpscalerOverride by remember(frameGenProfileKey) {
|
||||
mutableStateOf(frameGenProfileKey?.let { SessionPrefs.hasGameUpscalerOverride(context, it) } ?: false)
|
||||
}
|
||||
val lifecycleOwner = LocalLifecycleOwner.current
|
||||
DisposableEffect(lifecycleOwner, frameGenProfileKey) {
|
||||
val observer = LifecycleEventObserver { _, event ->
|
||||
if (event == Lifecycle.Event.ON_RESUME) {
|
||||
frameGenProfileKey?.let { key ->
|
||||
gameUpscaler = SessionPrefs.screenEffectsUpscaler(context, "game:$key")
|
||||
gameUpscalerOverride = SessionPrefs.hasGameUpscalerOverride(context, key)
|
||||
}
|
||||
}
|
||||
}
|
||||
lifecycleOwner.lifecycle.addObserver(observer)
|
||||
onDispose { lifecycleOwner.lifecycle.removeObserver(observer) }
|
||||
}
|
||||
var wincompOpen by remember(wincompKey) { mutableStateOf<Boolean?>(null) }
|
||||
val wincompPicks = remember(wincompKey, wincompOpen) { wincompKey?.let { com.droiddeck.launcher.session.WinComponents.picks(context, it) }.orEmpty() }
|
||||
val steamScope = game?.let { com.droiddeck.launcher.session.NoSteamLaunch.scope(it) }
|
||||
@@ -914,6 +956,25 @@ internal fun LaunchSettings(s: FrontEndState, a: FrontEndActions, host: MenuHost
|
||||
},
|
||||
)
|
||||
}
|
||||
val scalingFilterMenuContent: @Composable () -> Unit = {
|
||||
val key = frameGenProfileKey
|
||||
if (key != null) ScalingFilterMenu(
|
||||
mode = gameUpscaler,
|
||||
options = scalingFilterChoices,
|
||||
hasGameOverride = gameUpscalerOverride,
|
||||
onPick = { mode ->
|
||||
SessionPrefs.setGameUpscaler(context, key, mode)
|
||||
gameUpscaler = SessionPrefs.screenEffectsUpscaler(context, "game:$key")
|
||||
gameUpscalerOverride = SessionPrefs.hasGameUpscalerOverride(context, key)
|
||||
},
|
||||
onResetGame = {
|
||||
SessionPrefs.clearGameUpscaler(context, key)
|
||||
gameUpscaler = SessionPrefs.upscaler(context)
|
||||
gameUpscalerOverride = false
|
||||
},
|
||||
gameName = game?.name,
|
||||
)
|
||||
}
|
||||
val cards = if (game?.library == com.droiddeck.launcher.frontend.Library.EPIC_LAUNCHER) listOfNotNull(steamCard) else buildList<@Composable (Modifier) -> Unit> {
|
||||
add { m ->
|
||||
val back = stringResource(R.string.hop_from_games)
|
||||
@@ -938,6 +999,17 @@ internal fun LaunchSettings(s: FrontEndState, a: FrontEndActions, host: MenuHost
|
||||
|
||||
}
|
||||
}
|
||||
if (frameGenProfileKey != null) add { m ->
|
||||
Box(m) {
|
||||
SettingCard(
|
||||
stringResource(R.string.display_filter),
|
||||
scalingFilterChoices.firstOrNull { it.first == gameUpscaler }?.second ?: scalingFilterChoices.first().second,
|
||||
"card:scaling-filter", Modifier.fillMaxSize(),
|
||||
) {
|
||||
host.open = if (host.open == "scaling-filter") null else "scaling-filter"
|
||||
}
|
||||
}
|
||||
}
|
||||
if (controller != null) add { m -> SettingCard(stringResource(R.string.setup_card_controls), stringResource(R.string.setup_card_controls_hint), "card:controls", m, controller.onMapping) }
|
||||
if (steamCard != null) add(steamCard)
|
||||
val cardStore = com.droiddeck.launcher.stores.Store.byId(game?.source.orEmpty())?.takeIf { it == com.droiddeck.launcher.stores.Store.EPIC || it == com.droiddeck.launcher.stores.Store.GOG }
|
||||
@@ -972,6 +1044,11 @@ internal fun LaunchSettings(s: FrontEndState, a: FrontEndActions, host: MenuHost
|
||||
frameGenMenuContent()
|
||||
}
|
||||
}
|
||||
if (host.open == "scaling-filter") {
|
||||
Box(Modifier.fillMaxWidth().padding(top = 4.dp)) {
|
||||
scalingFilterMenuContent()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,32 @@ import androidx.compose.ui.unit.dp
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.input.*
|
||||
|
||||
/** The action being edited, with what each kind of action was set to so switching kinds and back loses nothing. */
|
||||
internal class InputActionDraft(initial: InputAction) {
|
||||
var action by mutableStateOf(initial)
|
||||
private val drafts = mutableMapOf<String, InputAction>()
|
||||
var localType by mutableStateOf(typeOf(initial).takeUnless { it == "native" || it == "disabled" } ?: "keys")
|
||||
private set
|
||||
|
||||
fun switch(type: String, initial: () -> InputAction) {
|
||||
drafts[typeOf(action)] = action
|
||||
action = drafts[type] ?: initial()
|
||||
if (type != "native" && type != "disabled") localType = type
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun typeOf(action: InputAction): String = when (action) {
|
||||
is InputAction.Native -> "native"; InputAction.Disabled -> "disabled"
|
||||
is InputAction.MouseButton -> "mouse"; is InputAction.Command -> "command"
|
||||
is InputAction.Pointer -> "pointer"; is InputAction.Scroll -> "scroll"
|
||||
is InputAction.Directions -> "directions"; is InputAction.Keys -> "keys"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal fun InputAction.validAs(control: InputControl, element: InputSurfaceElement?, click: Boolean) =
|
||||
if (click) validForClick() else if (element != null) validFor(element) else validFor(control)
|
||||
|
||||
@Composable
|
||||
internal fun InputActionEditor(
|
||||
control: InputControl, current: InputAction, title: String, onBack: () -> Unit, onSave: (InputAction) -> Unit,
|
||||
@@ -19,118 +45,114 @@ internal fun InputActionEditor(
|
||||
properties: (@Composable ColumnScope.(InputAction) -> Unit)? = null,
|
||||
click: Boolean = false,
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val host = rememberMenuHost()
|
||||
var draft by remember(current, title) { mutableStateOf(current) }
|
||||
val drafts = remember(current, title) { mutableMapOf<String, InputAction>() }
|
||||
fun typeOf(action: InputAction): String = when (action) {
|
||||
is InputAction.Native -> "native"; InputAction.Disabled -> "disabled"
|
||||
is InputAction.MouseButton -> "mouse"; is InputAction.Command -> "command"
|
||||
is InputAction.Pointer -> "pointer"; is InputAction.Scroll -> "scroll"
|
||||
is InputAction.Directions -> "directions"; is InputAction.Keys -> "keys"
|
||||
}
|
||||
var localType by remember(current, title) { mutableStateOf(typeOf(current).takeUnless { it == "native" || it == "disabled" } ?: "keys") }
|
||||
fun switch(type: String, initial: () -> InputAction) {
|
||||
drafts[typeOf(draft)] = draft
|
||||
draft = drafts[type] ?: initial()
|
||||
if (type != "native" && type != "disabled") localType = type
|
||||
}
|
||||
var keys by remember { mutableStateOf(false) }
|
||||
var direction by remember { mutableStateOf<Int?>(null) }
|
||||
fun valid(action: InputAction) = if (click) action.validForClick() else if (element != null) action.validFor(element) else action.validFor(control)
|
||||
val nativeOptions = remember(control, element, nativeTargets, click) {
|
||||
(listOf(InputAction.Native()) + if (nativeTargets) InputControl.entries.map { InputAction.Native(it) } else emptyList()).filter(::valid)
|
||||
}
|
||||
val route = when (draft) { is InputAction.Native -> 0; InputAction.Disabled -> 2; else -> 1 }
|
||||
val draft = remember(current, title) { InputActionDraft(current) }
|
||||
BackHandler(onBack = onBack)
|
||||
SettingsPage(host, title, onBack, eyebrow = stringResource(R.string.input_properties), lede = detail,
|
||||
action = { PrimaryButton(stringResource(R.string.gesture_save_changes), enabled = valid(draft),
|
||||
modifier = Modifier.testTag("input-action-save")) { onSave(draft) } }) {
|
||||
properties?.invoke(this, draft)
|
||||
action = { PrimaryButton(stringResource(R.string.gesture_save_changes), enabled = draft.action.validAs(control, element, click),
|
||||
modifier = Modifier.testTag("input-action-save")) { onSave(draft.action) } }) {
|
||||
properties?.invoke(this, draft.action)
|
||||
Spacer(Modifier.height(12.dp))
|
||||
SheetChips(listOf(stringResource(R.string.input_route_controller), stringResource(R.string.input_route_local), stringResource(R.string.input_disabled)), route) {
|
||||
when (it) {
|
||||
0 -> switch("native") { nativeOptions.firstOrNull() ?: InputAction.Disabled }
|
||||
2 -> switch("disabled") { InputAction.Disabled }
|
||||
else -> switch(localType) { InputAction.Keys(listOf(28)) }
|
||||
}
|
||||
InputActionFields(host, control, draft, element, nativeTargets, click)
|
||||
}
|
||||
}
|
||||
|
||||
/** Where an action goes (the controller, DroidDeck's own input, or nowhere) and its settings. Edits [draft] in place. */
|
||||
@Composable
|
||||
internal fun InputActionFields(
|
||||
host: MenuHost, control: InputControl, draft: InputActionDraft,
|
||||
element: InputSurfaceElement? = null, nativeTargets: Boolean = true, click: Boolean = false,
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
var keys by remember { mutableStateOf(false) }
|
||||
var direction by remember { mutableStateOf<Int?>(null) }
|
||||
val nativeOptions = remember(control, element, nativeTargets, click) {
|
||||
(listOf(InputAction.Native()) + if (nativeTargets) InputControl.entries.map { InputAction.Native(it) } else emptyList())
|
||||
.filter { it.validAs(control, element, click) }
|
||||
}
|
||||
val route = when (draft.action) { is InputAction.Native -> 0; InputAction.Disabled -> 2; else -> 1 }
|
||||
SheetChips(listOf(stringResource(R.string.flow_route_pad), stringResource(R.string.flow_route_keys), stringResource(R.string.flow_route_none)), route, width = 64.dp) {
|
||||
when (it) {
|
||||
0 -> draft.switch("native") { nativeOptions.firstOrNull() ?: InputAction.Disabled }
|
||||
2 -> draft.switch("disabled") { InputAction.Disabled }
|
||||
else -> draft.switch(draft.localType) { InputAction.Keys(listOf(28)) }
|
||||
}
|
||||
Spacer(Modifier.height(16.dp))
|
||||
when (route) {
|
||||
0 -> SettingsGroup(stringResource(R.string.input_route_controller)) {
|
||||
ChoiceRow(host, "native-target", stringResource(R.string.input_remap_native), stringResource(R.string.input_controller_route_hint),
|
||||
nativeOptions.map { it to (it.target?.label ?: stringResource(if (nativeTargets) R.string.input_native else R.string.input_normal_binding)) },
|
||||
draft as InputAction.Native) { draft = it }
|
||||
}
|
||||
2 -> Text(stringResource(R.string.input_disabled_hint), Modifier.padding(16.dp))
|
||||
else -> {
|
||||
val types = listOf("keys" to stringResource(R.string.input_keys), "mouse" to stringResource(R.string.input_mouse_click),
|
||||
"command" to stringResource(R.string.input_command)) + if (control.dimensions == 2) listOf(
|
||||
"pointer" to stringResource(R.string.input_pointer), "scroll" to stringResource(R.string.input_scroll),
|
||||
"directions" to stringResource(R.string.input_direction_keys)) else emptyList()
|
||||
val type = when (draft) { is InputAction.MouseButton -> "mouse"; is InputAction.Command -> "command";
|
||||
is InputAction.Pointer -> "pointer"; is InputAction.Scroll -> "scroll"; is InputAction.Directions -> "directions"; else -> "keys" }
|
||||
SettingsGroup(stringResource(R.string.input_action)) {
|
||||
ChoiceRow(host, "action-type", stringResource(R.string.input_action), null, types, type) {
|
||||
switch(it) { when (it) { "mouse" -> InputAction.MouseButton(272); "command" -> InputAction.Command(InputCommand.MENU);
|
||||
"pointer" -> InputAction.Pointer(); "scroll" -> InputAction.Scroll();
|
||||
"directions" -> InputAction.Directions(103, 106, 108, 105); else -> InputAction.Keys(listOf(28)) } }
|
||||
}
|
||||
Spacer(Modifier.height(16.dp))
|
||||
when (route) {
|
||||
0 -> SettingsGroup(stringResource(R.string.flow_route_pad)) {
|
||||
ChoiceRow(host, "native-target", stringResource(R.string.flow_acts_as), stringResource(R.string.input_controller_route_hint),
|
||||
nativeOptions.map { it to (it.target?.label ?: if (nativeTargets) stringResource(R.string.flow_as_itself, if (element?.dpadPiece == true) stringResource(R.string.input_element_dpad) else control.label) else stringResource(R.string.input_normal_binding)) },
|
||||
draft.action as InputAction.Native) { draft.action = it }
|
||||
}
|
||||
2 -> Text(stringResource(R.string.input_disabled_hint), Modifier.padding(16.dp))
|
||||
else -> {
|
||||
val types = listOf("keys" to stringResource(R.string.input_keys), "mouse" to stringResource(R.string.input_mouse_click),
|
||||
"command" to stringResource(R.string.input_command)) + if (control.dimensions == 2) listOf(
|
||||
"pointer" to stringResource(R.string.input_pointer), "scroll" to stringResource(R.string.input_scroll),
|
||||
"directions" to stringResource(R.string.input_direction_keys)) else emptyList()
|
||||
val type = when (draft.action) { is InputAction.MouseButton -> "mouse"; is InputAction.Command -> "command";
|
||||
is InputAction.Pointer -> "pointer"; is InputAction.Scroll -> "scroll"; is InputAction.Directions -> "directions"; else -> "keys" }
|
||||
SettingsGroup(stringResource(R.string.input_action)) {
|
||||
ChoiceRow(host, "action-type", stringResource(R.string.input_action), null, types, type) {
|
||||
draft.switch(it) { when (it) { "mouse" -> InputAction.MouseButton(272); "command" -> InputAction.Command(InputCommand.MENU);
|
||||
"pointer" -> InputAction.Pointer(); "scroll" -> InputAction.Scroll();
|
||||
"directions" -> InputAction.Directions(103, 106, 108, 105); else -> InputAction.Keys(listOf(28)) } }
|
||||
}
|
||||
if (!click && draft.action !is InputAction.Pointer && draft.action !is InputAction.Scroll && draft.action !is InputAction.Directions) {
|
||||
val hint = when {
|
||||
control.isTrackpad -> R.string.input_contact_action_hint
|
||||
control.dimensions == 2 -> R.string.input_axis_action_hint
|
||||
control == InputControl.LT || control == InputControl.RT -> R.string.input_trigger_action_hint
|
||||
else -> null
|
||||
}
|
||||
if (!click && draft !is InputAction.Pointer && draft !is InputAction.Scroll && draft !is InputAction.Directions) {
|
||||
val hint = when {
|
||||
control.isTrackpad -> R.string.input_contact_action_hint
|
||||
control.dimensions == 2 -> R.string.input_axis_action_hint
|
||||
control == InputControl.LT || control == InputControl.RT -> R.string.input_trigger_action_hint
|
||||
else -> null
|
||||
}
|
||||
hint?.let { Text(stringResource(it), Modifier.padding(horizontal = 16.dp, vertical = 8.dp),
|
||||
style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant) }
|
||||
hint?.let { Text(stringResource(it), Modifier.padding(horizontal = 16.dp, vertical = 8.dp),
|
||||
style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant) }
|
||||
}
|
||||
when (val action = draft.action) {
|
||||
is InputAction.Keys -> ActionRow(stringResource(R.string.input_keys), actionLabel(action), stringResource(R.string.ctrl_edit), { keys = true })
|
||||
is InputAction.MouseButton -> ChoiceRow(host, "mouse-button", stringResource(R.string.input_mouse_click), null,
|
||||
(272..274).map { it to actionLabel(InputAction.MouseButton(it)) }, action.code) { draft.action = InputAction.MouseButton(it) }
|
||||
is InputAction.Command -> ChoiceRow(host, "command", stringResource(R.string.input_command), null,
|
||||
InputCommand.entries.map { it to commandLabel(it) }, action.command) { draft.action = InputAction.Command(it) }
|
||||
is InputAction.Pointer -> {
|
||||
Text(stringResource(R.string.input_pointer_speed, action.speed.toInt()), Modifier.padding(horizontal = 16.dp, vertical = 8.dp), color = MaterialTheme.colorScheme.onSurface)
|
||||
Slider(action.speed, { draft.action = action.copy(speed = it) }, valueRange = 100f..3000f, modifier = Modifier.padding(horizontal = 16.dp))
|
||||
}
|
||||
when (val action = draft) {
|
||||
is InputAction.Keys -> ActionRow(stringResource(R.string.input_keys), actionLabel(action), stringResource(R.string.ctrl_edit), { keys = true })
|
||||
is InputAction.MouseButton -> ChoiceRow(host, "mouse-button", stringResource(R.string.input_mouse_click), null,
|
||||
(272..274).map { it to actionLabel(InputAction.MouseButton(it)) }, action.code) { draft = InputAction.MouseButton(it) }
|
||||
is InputAction.Command -> ChoiceRow(host, "command", stringResource(R.string.input_command), null,
|
||||
InputCommand.entries.map { it to commandLabel(it) }, action.command) { draft = InputAction.Command(it) }
|
||||
is InputAction.Pointer -> {
|
||||
Text(stringResource(R.string.input_pointer_speed, action.speed.toInt()), Modifier.padding(horizontal = 16.dp, vertical = 8.dp), color = MaterialTheme.colorScheme.onSurface)
|
||||
Slider(action.speed, { draft = action.copy(speed = it) }, valueRange = 100f..3000f, modifier = Modifier.padding(horizontal = 16.dp))
|
||||
is InputAction.Scroll -> {
|
||||
ChoiceRow(host, "scroll-axis", stringResource(R.string.input_scroll_axis), null,
|
||||
listOf(false to stringResource(R.string.input_vertical), true to stringResource(R.string.input_horizontal)), action.horizontal) {
|
||||
draft.action = action.copy(horizontal = it)
|
||||
}
|
||||
is InputAction.Scroll -> {
|
||||
ChoiceRow(host, "scroll-axis", stringResource(R.string.input_scroll_axis), null,
|
||||
listOf(false to stringResource(R.string.input_vertical), true to stringResource(R.string.input_horizontal)), action.horizontal) {
|
||||
draft = action.copy(horizontal = it)
|
||||
}
|
||||
Text(stringResource(R.string.input_scroll_speed, action.speed.toInt()), Modifier.padding(horizontal = 16.dp, vertical = 8.dp), color = MaterialTheme.colorScheme.onSurface)
|
||||
Slider(action.speed, { draft = action.copy(speed = it) }, valueRange = 1f..60f, modifier = Modifier.padding(horizontal = 16.dp))
|
||||
}
|
||||
is InputAction.Directions -> {
|
||||
ToggleRow(host, "direction-diagonals", stringResource(R.string.input_diagonal_keys), stringResource(R.string.input_diagonal_keys_hint), action.diagonals != null) {
|
||||
draft = action.copy(diagonals = if (it) action.diagonals ?: listOf(0, 0, 0, 0) else null)
|
||||
}
|
||||
val codes = listOf(action.up, action.right, action.down, action.left) + action.diagonals.orEmpty()
|
||||
val arrows = listOf("↑", "→", "↓", "←", "↗", "↘", "↙", "↖")
|
||||
codes.forEachIndexed { i, code ->
|
||||
ActionRow(arrows[i], if (code == 0) stringResource(if (i < 4) R.string.input_disabled else R.string.input_diagonal_neighbors) else pcKeyLabel(context, code), stringResource(R.string.ctrl_edit), { direction = i })
|
||||
}
|
||||
}
|
||||
else -> Unit
|
||||
Text(stringResource(R.string.input_scroll_speed, action.speed.toInt()), Modifier.padding(horizontal = 16.dp, vertical = 8.dp), color = MaterialTheme.colorScheme.onSurface)
|
||||
Slider(action.speed, { draft.action = action.copy(speed = it) }, valueRange = 1f..60f, modifier = Modifier.padding(horizontal = 16.dp))
|
||||
}
|
||||
is InputAction.Directions -> {
|
||||
ToggleRow(host, "direction-diagonals", stringResource(R.string.input_diagonal_keys), stringResource(R.string.input_diagonal_keys_hint), action.diagonals != null) {
|
||||
draft.action = action.copy(diagonals = if (it) action.diagonals ?: listOf(0, 0, 0, 0) else null)
|
||||
}
|
||||
val codes = listOf(action.up, action.right, action.down, action.left) + action.diagonals.orEmpty()
|
||||
val arrows = listOf("↑", "→", "↓", "←", "↗", "↘", "↙", "↖")
|
||||
codes.forEachIndexed { i, code ->
|
||||
ActionRow(arrows[i], if (code == 0) stringResource(if (i < 4) R.string.input_disabled else R.string.input_diagonal_neighbors) else pcKeyLabel(context, code), stringResource(R.string.ctrl_edit), { direction = i })
|
||||
}
|
||||
}
|
||||
else -> Unit
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (keys) KeyCombinationPicker(onDismiss = { keys = false }, initial = (draft as? InputAction.Keys)?.codes.orEmpty(),
|
||||
if (keys) KeyCombinationPicker(onDismiss = { keys = false }, initial = (draft.action as? InputAction.Keys)?.codes.orEmpty(),
|
||||
sequence = true, sequenceLimit = 8, title = stringResource(R.string.input_keys), confirm = stringResource(R.string.gesture_save_changes), onAdd = {
|
||||
draft = InputAction.Keys(it.sortedBy { code -> if (code in PC_MODIFIERS) 0 else 1 }); keys = false
|
||||
draft.action = InputAction.Keys(it.sortedBy { code -> if (code in PC_MODIFIERS) 0 else 1 }); keys = false
|
||||
})
|
||||
direction?.let { at ->
|
||||
val action = draft as? InputAction.Directions ?: return@let
|
||||
val action = draft.action as? InputAction.Directions ?: return@let
|
||||
val codes = listOf(action.up, action.right, action.down, action.left) + action.diagonals.orEmpty()
|
||||
KeyCombinationPicker(onDismiss = { direction = null }, initial = listOf(codes[at]).filter { it != 0 }, sequence = true, sequenceLimit = 1, allowEmpty = true,
|
||||
title = stringResource(R.string.input_direction_keys), confirm = stringResource(R.string.gesture_save_changes), onAdd = {
|
||||
val next = codes.toMutableList().also { values -> values[at] = it.firstOrNull() ?: 0 }
|
||||
draft = InputAction.Directions(next[0], next[1], next[2], next[3], if (action.diagonals != null) next.drop(4) else null); direction = null
|
||||
draft.action = InputAction.Directions(next[0], next[1], next[2], next[3], if (action.diagonals != null) next.drop(4) else null); direction = null
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,263 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import android.view.KeyEvent
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.input.key.onPreviewKeyEvent
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.ui.viewinterop.AndroidView
|
||||
import androidx.compose.ui.window.Dialog
|
||||
import androidx.compose.ui.window.DialogProperties
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.input.*
|
||||
|
||||
/** A game edit reads its effective part until a real change needs a private copy. */
|
||||
internal data class GameInputEdit(val desktop: Boolean, val game: String, val name: String, val role: InputRole) {
|
||||
fun part(library: InputLibrary) = library.activePart(desktop, role, game)
|
||||
fun inheritedPart(library: InputLibrary) = library.inheritedGamePart(desktop, role, game)
|
||||
|
||||
fun setPhysicalAction(library: InputLibrary, control: InputControl, action: InputAction): InputLibrary {
|
||||
require(role == InputRole.PHYSICAL)
|
||||
val current = library.preset(part(library).bindings)
|
||||
if ((current.controls[control] ?: InputAction.Native()) == action) return library
|
||||
val base = library.preset(inheritedPart(library).bindings)
|
||||
val next = current.controls + (control to action)
|
||||
if (current.keys == base.keys && (next.keys + base.controls.keys).all {
|
||||
(next[it] ?: InputAction.Native()) == (base.controls[it] ?: InputAction.Native())
|
||||
}) return library.resetGame(game, role)
|
||||
return apply(library) { editable, part ->
|
||||
editable.withPreset(editable.preset(part.bindings).copy(controls = next))
|
||||
}
|
||||
}
|
||||
|
||||
fun apply(library: InputLibrary, change: (InputLibrary, InputPart) -> InputLibrary): InputLibrary {
|
||||
val editable = library.withGamePart(desktop, game, name, role)
|
||||
return change(editable, part(editable))
|
||||
}
|
||||
}
|
||||
|
||||
internal data class InputEditorTarget(
|
||||
val role: InputRole, val profile: String, val bindings: String, val layout: String?,
|
||||
val scope: String, val gameEdit: GameInputEdit? = null, val wasInherited: Boolean = false,
|
||||
)
|
||||
|
||||
@Composable
|
||||
internal fun InputEditorWindow(target: InputEditorTarget, onDismiss: () -> Unit, onChanged: () -> Unit) {
|
||||
if (target.role == InputRole.PHYSICAL) Dialog(onDismissRequest = onDismiss, properties = DialogProperties(usePlatformDefaultWidth = false)) {
|
||||
Surface(Modifier.fillMaxSize().systemBarsPadding().padding(8.dp), color = MaterialTheme.colorScheme.surface, shape = RoundedCornerShape(18.dp)) {
|
||||
val library by rememberInputLibrary()
|
||||
val base = library.profiles.firstOrNull { it.id == target.profile }?.binding(InputRole.PHYSICAL)
|
||||
?.takeIf { it != target.bindings }
|
||||
InputButtonsPane(target.bindings, target.scope, base, onDismiss, onChanged, gameEdit = target.gameEdit)
|
||||
}
|
||||
} else InputSurfaceDialog(target.profile, onDismiss, onChanged, role = target.role, layoutId = target.layout,
|
||||
bindingsId = target.bindings, scope = target.scope, gameEdit = target.gameEdit)
|
||||
}
|
||||
|
||||
private val controllerKeys = mapOf(
|
||||
KeyEvent.KEYCODE_BUTTON_A to InputControl.A, KeyEvent.KEYCODE_BUTTON_B to InputControl.B,
|
||||
KeyEvent.KEYCODE_BUTTON_X to InputControl.X, KeyEvent.KEYCODE_BUTTON_Y to InputControl.Y,
|
||||
KeyEvent.KEYCODE_BUTTON_L1 to InputControl.LB, KeyEvent.KEYCODE_BUTTON_R1 to InputControl.RB,
|
||||
KeyEvent.KEYCODE_BUTTON_L2 to InputControl.LT, KeyEvent.KEYCODE_BUTTON_R2 to InputControl.RT,
|
||||
KeyEvent.KEYCODE_BUTTON_THUMBL to InputControl.L3, KeyEvent.KEYCODE_BUTTON_THUMBR to InputControl.R3,
|
||||
KeyEvent.KEYCODE_BUTTON_SELECT to InputControl.SELECT, KeyEvent.KEYCODE_BUTTON_START to InputControl.START,
|
||||
KeyEvent.KEYCODE_BUTTON_MODE to InputControl.GUIDE,
|
||||
KeyEvent.KEYCODE_DPAD_UP to InputControl.UP, KeyEvent.KEYCODE_DPAD_RIGHT to InputControl.RIGHT,
|
||||
KeyEvent.KEYCODE_DPAD_DOWN to InputControl.DOWN, KeyEvent.KEYCODE_DPAD_LEFT to InputControl.LEFT,
|
||||
)
|
||||
|
||||
/** The control a controller key press stands for, when it is one of the standard gamepad keys. */
|
||||
internal fun controlForKey(keyCode: Int): InputControl? = controllerKeys[keyCode]
|
||||
|
||||
/**
|
||||
* Buttons and sticks: tap a control on a drawing of the controller, or press it, then set what it does. Saves into the
|
||||
* bindings [bindingsId]; [baseId] is the profile's own bindings when these are a game's copy, so a control can go back.
|
||||
*/
|
||||
@Composable
|
||||
internal fun InputButtonsPane(bindingsId: String, scope: String, baseId: String?, onBack: () -> Unit, onChanged: () -> Unit,
|
||||
onMore: (() -> Unit)? = null, gameEdit: GameInputEdit? = null) {
|
||||
val context = LocalContext.current
|
||||
val host = rememberMenuHost()
|
||||
val library by rememberInputLibrary()
|
||||
val activeBindings = gameEdit?.part(library)?.bindings ?: bindingsId
|
||||
val preset = library.bindings.firstOrNull { it.id == activeBindings } ?: return
|
||||
val base = (gameEdit?.inheritedPart(library)?.bindings ?: baseId)
|
||||
?.let { id -> library.bindings.firstOrNull { it.id == id } }
|
||||
var selected by remember { mutableStateOf(InputControl.A) }
|
||||
var capturing by remember { mutableStateOf(false) }
|
||||
var unknownKey by remember { mutableStateOf(false) }
|
||||
var failure by remember { mutableStateOf<String?>(null) }
|
||||
val current = preset.controls[selected] ?: InputAction.Native()
|
||||
val draft = remember(selected) { InputActionDraft(current) }
|
||||
fun save(action: InputAction) {
|
||||
fun change(library: InputLibrary, id: String): InputLibrary {
|
||||
val current = library.preset(id)
|
||||
return library.withPreset(current.copy(controls = current.controls + (selected to action)))
|
||||
}
|
||||
runCatching {
|
||||
InputLibraries.update(context) { latest ->
|
||||
if (gameEdit == null) change(latest, bindingsId)
|
||||
else gameEdit.setPhysicalAction(latest, selected, action)
|
||||
}
|
||||
}
|
||||
.onSuccess { onChanged() }.onFailure { draft.action = current; failure = it.message ?: context.getString(R.string.input_save_failed) }
|
||||
}
|
||||
// Every change applies as it is made, as in the layout editor, so leaving never loses an edit.
|
||||
LaunchedEffect(draft.action) { if (draft.action != current && draft.action.validFor(selected)) save(draft.action) }
|
||||
LaunchedEffect(current) { if (draft.action != current) draft.action = current }
|
||||
val changed = InputControl.entries.filter { c ->
|
||||
(preset.controls[c] ?: InputAction.Native()) != (base?.controls?.get(c) ?: InputAction.Native())
|
||||
}
|
||||
BackHandlerCompat(onBack)
|
||||
BoxWithConstraints(Modifier.fillMaxSize().padding(16.dp).onPreviewKeyEvent { event ->
|
||||
val key = event.nativeKeyEvent
|
||||
if (!capturing || key.keyCode == KeyEvent.KEYCODE_BACK) return@onPreviewKeyEvent false
|
||||
val control = controlForKey(key.keyCode)
|
||||
if (key.action == KeyEvent.ACTION_UP) { capturing = false; unknownKey = control == null; if (control != null) selected = control }
|
||||
true
|
||||
}.testTag("input-buttons")) {
|
||||
val wide = maxWidth > 700.dp
|
||||
val boxWidth = maxWidth
|
||||
val boxHeight = maxHeight
|
||||
var others by remember { mutableStateOf(false) }
|
||||
val header: @Composable () -> Unit = {
|
||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(4.dp)) {
|
||||
Text(stringResource(R.string.flow_buttons), fontSize = if (wide) 22.sp else 19.sp, fontWeight = FontWeight.SemiBold,
|
||||
color = MaterialTheme.colorScheme.onSurface, maxLines = 1)
|
||||
ScopePill(stringResource(R.string.flow_editing, scope))
|
||||
}
|
||||
PrimaryButton(stringResource(R.string.input_editor_done), compact = true, modifier = Modifier.testTag("input-buttons-done"), onClick = onBack)
|
||||
}
|
||||
Text(stringResource(when {
|
||||
capturing -> R.string.flow_press_now
|
||||
unknownKey && onMore != null -> R.string.flow_press_other
|
||||
else -> R.string.flow_buttons_hint
|
||||
}), fontSize = 13.sp, color = if (capturing || unknownKey) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
modifier = Modifier.testTag("input-buttons-hint"))
|
||||
Text(stringResource(R.string.flow_steam_remap_hint), fontSize = 12.sp, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
}
|
||||
val drawing: @Composable (Modifier) -> Unit = { modifier ->
|
||||
Box(modifier.clip(RoundedCornerShape(14.dp)).background(MaterialTheme.colorScheme.background)
|
||||
.border(1.dp, MaterialTheme.colorScheme.outlineVariant, RoundedCornerShape(14.dp))) {
|
||||
ControllerDrawing(selected, Modifier.fillMaxSize()) { selected = it }
|
||||
}
|
||||
}
|
||||
val tools: @Composable () -> Unit = {
|
||||
@OptIn(ExperimentalLayoutApi::class)
|
||||
FlowRow(horizontalArrangement = Arrangement.spacedBy(8.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
SecondaryButton(stringResource(if (capturing) R.string.common_cancel else R.string.flow_press), compact = true,
|
||||
modifier = Modifier.testTag("input-buttons-press")) { capturing = !capturing }
|
||||
if (!wide) SecondaryButton(stringResource(R.string.flow_other_controls) + if (others) " ▾" else " ▸", compact = true,
|
||||
modifier = Modifier.testTag("input-buttons-others")) { others = !others }
|
||||
onMore?.let { SecondaryButton(stringResource(R.string.flow_more_buttons), compact = true, onClick = it) }
|
||||
}
|
||||
if (wide || others) OtherControls(selected, showTitle = wide) { selected = it }
|
||||
}
|
||||
val summary: @Composable () -> Unit = {
|
||||
val summaries = mutableListOf<String>()
|
||||
for (c in changed) summaries += "${c.label} → ${actionLabel(preset.controls[c] ?: InputAction.Native())}"
|
||||
if (summaries.isNotEmpty()) Text(summaries.joinToString(" · "),
|
||||
fontSize = 13.sp, color = MaterialTheme.colorScheme.primary, modifier = Modifier.testTag("input-buttons-changed"))
|
||||
}
|
||||
val panel: @Composable (Modifier) -> Unit = { modifier ->
|
||||
Column(if (wide) modifier.verticalScroll(rememberScrollState()) else modifier) {
|
||||
Text(selected.label, fontSize = 20.sp, fontWeight = FontWeight.SemiBold, color = MaterialTheme.colorScheme.onSurface)
|
||||
Spacer(Modifier.height(12.dp))
|
||||
InputActionFields(host, selected, draft)
|
||||
Spacer(Modifier.height(12.dp))
|
||||
val profileAction = base?.controls?.get(selected) ?: InputAction.Native()
|
||||
if (base != null && current != profileAction) Actions {
|
||||
SecondaryButton(stringResource(R.string.flow_profile_binding, actionLabel(profileAction)),
|
||||
modifier = Modifier.testTag("input-buttons-reset")) { save(profileAction) }
|
||||
}
|
||||
}
|
||||
}
|
||||
if (wide) Row(horizontalArrangement = Arrangement.spacedBy(20.dp)) {
|
||||
// The drawing keeps a fixed share of the height; the controls under it scroll rather than squeezing it.
|
||||
Column(Modifier.weight(1.2f).fillMaxHeight().verticalScroll(rememberScrollState()), verticalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
header(); drawing(Modifier.fillMaxWidth().height((boxHeight * .55f).coerceAtLeast(180.dp))); tools(); summary()
|
||||
}
|
||||
panel(Modifier.weight(1f))
|
||||
}
|
||||
// A narrow screen stacks everything, with the action right under the drawing and the rarer controls folded away.
|
||||
else Column(Modifier.verticalScroll(rememberScrollState()), verticalArrangement = Arrangement.spacedBy(12.dp)) {
|
||||
header(); drawing(Modifier.fillMaxWidth().height(boxWidth * .62f)); tools()
|
||||
CompositionLocalProvider(LocalCompactSettings provides true) { panel(Modifier.fillMaxWidth()) }
|
||||
summary()
|
||||
}
|
||||
}
|
||||
failure?.let { message -> androidx.compose.material3.AlertDialog(onDismissRequest = { failure = null }, title = { Text(stringResource(R.string.input_save_failed)) },
|
||||
text = { Text(message) }, confirmButton = { PadTextButton(onClick = { failure = null }) { Text(stringResource(R.string.common_ok)) } }) }
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun BackHandlerCompat(onBack: () -> Unit) = androidx.activity.compose.BackHandler(onBack = onBack)
|
||||
|
||||
/** What an editor saves into and for which orientation, since portrait and landscape keep their own positions. */
|
||||
@Composable
|
||||
internal fun editingLabel(scope: String, aspect: Float): String = stringResource(R.string.flow_editing,
|
||||
scope + " · " + stringResource(if (aspect > 0f && aspect < 1f) R.string.flow_portrait else R.string.flow_landscape))
|
||||
|
||||
@Composable
|
||||
internal fun ScopePill(text: String) {
|
||||
Text(text, fontSize = 12.sp, fontWeight = FontWeight.SemiBold, color = MaterialTheme.colorScheme.primary,
|
||||
modifier = Modifier.clip(RoundedCornerShape(8.dp)).background(MaterialTheme.colorScheme.primary.copy(alpha = .14f)).padding(horizontal = 8.dp, vertical = 4.dp))
|
||||
}
|
||||
|
||||
/** The standard pad, drawn with the selected virtual controller's art; tapping a control picks it. */
|
||||
@Composable
|
||||
private fun ControllerDrawing(selected: InputControl, modifier: Modifier, onPick: (InputControl) -> Unit) {
|
||||
val context = LocalContext.current
|
||||
val pick by rememberUpdatedState(onPick)
|
||||
val current by rememberUpdatedState(selected)
|
||||
AndroidView(factory = { InputSurfaceEditorView(it).apply { selectOnly = true; setBackgroundColor(android.graphics.Color.TRANSPARENT) } },
|
||||
modifier = modifier.testTag("input-buttons-pad"), update = { view ->
|
||||
view.onSelect = { id ->
|
||||
val control = id?.removePrefix("legacy:")?.let(InputControl::fromId)
|
||||
if (control != null) pick(control) else view.selected = "legacy:${current.id}"
|
||||
}
|
||||
fun place() {
|
||||
if (view.width <= 0 || view.height <= 0) return
|
||||
val stock = LegacyGamepadLayout(context, view.width, view.height).elements().filter { it.id.startsWith("legacy:") }
|
||||
val layout = SavedInputLayout(InputLibraries.OVERLAY, "", stock)
|
||||
view.sourceLayout = layout
|
||||
view.aspect = view.width.toFloat() / view.height
|
||||
view.elements = OnScreenLayout.editorElements(context, layout, view.width, view.height).filter { it.id.startsWith("legacy:") }
|
||||
}
|
||||
view.onResize = { _, _ -> place() }
|
||||
view.selected = "legacy:${selected.id}"
|
||||
if (view.elements.isEmpty()) view.post { place() }
|
||||
})
|
||||
}
|
||||
|
||||
/** Controls the drawing doesn't show: back buttons, Steam and Quick Access, stick clicks and trackpads. */
|
||||
@Composable
|
||||
private fun OtherControls(selected: InputControl, showTitle: Boolean = true, onPick: (InputControl) -> Unit) {
|
||||
val others = listOf(InputControl.L3, InputControl.R3, InputControl.L4, InputControl.R4, InputControl.L5, InputControl.R5,
|
||||
InputControl.GUIDE, InputControl.QAM, InputControl.LEFT_PAD, InputControl.RIGHT_PAD, InputControl.LEFT_CLICK, InputControl.RIGHT_CLICK)
|
||||
if (showTitle) Text(stringResource(R.string.flow_other_controls), fontSize = 12.sp, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
@OptIn(ExperimentalLayoutApi::class)
|
||||
FlowRow(horizontalArrangement = Arrangement.spacedBy(6.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
for (control in others) {
|
||||
if (control == selected) PrimaryButton(control.label, compact = true, modifier = Modifier.testTag("input-other-${control.id}")) { onPick(control) }
|
||||
else SecondaryButton(control.label, compact = true, modifier = Modifier.testTag("input-other-${control.id}")) { onPick(control) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,81 +1,116 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.BorderStroke
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.input.*
|
||||
|
||||
/** The mode sheet's controls: which profile this mode uses, and the way into every controller setting. */
|
||||
@Composable
|
||||
internal fun InputQuickSettings(host: MenuHost, desktop: Boolean, onChanged: (InputRole?) -> Unit = {}, onEdit: () -> Unit = {}, track: (String) -> Modifier = { Modifier }) {
|
||||
val context = LocalContext.current
|
||||
var library by remember { mutableStateOf(InputLibraries.read(context)) }
|
||||
var expanded by remember { mutableStateOf(false) }
|
||||
var naming by remember { mutableStateOf(false) }
|
||||
val library by rememberInputLibrary()
|
||||
var failure by remember { mutableStateOf<String?>(null) }
|
||||
DisposableEffect(context) {
|
||||
val preferences = context.getSharedPreferences("input-profiles", Context.MODE_PRIVATE)
|
||||
val listener = SharedPreferences.OnSharedPreferenceChangeListener { _, key -> if (key == "library") library = InputLibraries.read(context) }
|
||||
preferences.registerOnSharedPreferenceChangeListener(listener)
|
||||
onDispose { preferences.unregisterOnSharedPreferenceChangeListener(listener) }
|
||||
}
|
||||
val fallback = profileLabel(context, library.profile(library.defaultId(desktop)))
|
||||
val selection = library.selection(desktop)
|
||||
val mixedId = quickMixedChoiceId(library)
|
||||
val isMixed = selection.parts.isNotEmpty()
|
||||
val active = profileLabel(context, library.profile(library.activeId(desktop)))
|
||||
val choices = listOf(InputProfiles.AUTO to stringResource(R.string.flow_default_profile, fallback)) +
|
||||
library.profiles.map { it.id to profileLabel(context, it) } +
|
||||
if (isMixed) listOf(mixedId to stringResource(R.string.input_quick_mixed, active)) else emptyList()
|
||||
|
||||
fun update(role: InputRole?, change: (InputLibrary) -> InputLibrary) {
|
||||
runCatching { InputLibraries.update(context, change) }.onSuccess { library = it; onChanged(role) }
|
||||
runCatching { InputLibraries.update(context, change) }.onSuccess { onChanged(role) }
|
||||
.onFailure { failure = it.message ?: context.getString(R.string.input_save_failed) }
|
||||
}
|
||||
val selection = library.selection(desktop)
|
||||
val mixed = selection.parts.isNotEmpty()
|
||||
val active = library.profile(library.activeId(desktop))
|
||||
val profiles = listOf(InputProfiles.AUTO to stringResource(R.string.input_quick_auto, if (desktop) library.profile(library.desktop).name else library.profile(library.steam).name)) +
|
||||
library.profiles.map { it.id to it.name } + if (mixed) listOf("mixed" to stringResource(R.string.input_quick_mixed, active.name)) else emptyList()
|
||||
Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {
|
||||
Row(Modifier.weight(1f).focusRow { expanded = !expanded }.padding(14.dp).testTag("input-profile-expand"),
|
||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
Text(if (expanded) "▾" else "▸", color = MaterialTheme.colorScheme.onSurface)
|
||||
Text(stringResource(R.string.input_profile), style = MaterialTheme.typography.titleMedium, color = MaterialTheme.colorScheme.onSurface)
|
||||
}
|
||||
Box(Modifier.padding(end = 14.dp).widthIn(max = 280.dp)) {
|
||||
ChoiceChip(host, "input-profile", stringResource(R.string.input_profile), profiles, if (mixed) "mixed" else selection.profile,
|
||||
modifier = track("input-profile")) { id -> if (id != "mixed") update(null) { it.selectProfile(desktop, id) } }
|
||||
}
|
||||
}
|
||||
if (expanded) Surface(
|
||||
modifier = Modifier.fillMaxWidth().padding(start = 18.dp, end = 12.dp, bottom = 14.dp).testTag("input-profile-parts"),
|
||||
shape = RoundedCornerShape(12.dp),
|
||||
color = MaterialTheme.colorScheme.primary.copy(alpha = .08f),
|
||||
border = BorderStroke(1.dp, MaterialTheme.colorScheme.primary.copy(alpha = .35f)),
|
||||
) {
|
||||
Column(Modifier.padding(vertical = 6.dp)) {
|
||||
for (role in InputRole.entries) {
|
||||
val options = library.bindings.filter { binding ->
|
||||
if (role == InputRole.PHYSICAL) binding.physical
|
||||
else !binding.physical && library.layouts.any { it.id == binding.layoutId && it.supports(role) }
|
||||
}.map { it.id to it.name }
|
||||
ChoiceRow(host, "input-part-${role.name}", roleLabel(role), null, options, library.activePart(desktop, role).bindings,
|
||||
chipModifier = track("input-part-${role.name}")) { id -> update(role) { it.selectPart(desktop, role, id) } }
|
||||
}
|
||||
if (mixed) SecondaryButton(stringResource(R.string.input_save_combination)) { naming = true }
|
||||
ActionRow(stringResource(R.string.input_settings), null, stringResource(R.string.ctrl_edit), onEdit,
|
||||
modifier = track("input-settings").testTag("input-profile-edit"))
|
||||
}
|
||||
}
|
||||
if (naming) {
|
||||
var name by remember { mutableStateOf("") }
|
||||
AlertDialog(onDismissRequest = { naming = false }, title = { Text(stringResource(R.string.input_save_combination)) },
|
||||
text = { OutlinedTextField(name, { name = it.take(80) }, singleLine = true, label = { Text(stringResource(R.string.input_name)) }) },
|
||||
confirmButton = { PadTextButton(enabled = name.isNotBlank(), onClick = { update(null) { it.saveSelection(desktop, name) }; naming = false }) { Text(stringResource(R.string.gesture_save_changes)) } },
|
||||
dismissButton = { PadTextButton(onClick = { naming = false }) { Text(stringResource(R.string.common_cancel)) } })
|
||||
|
||||
ChoiceRow(host, "input-profile", stringResource(R.string.input_profile), null, choices,
|
||||
if (isMixed) mixedId else selection.profile, chipModifier = track("input-profile")) { id ->
|
||||
if (id != mixedId) update(null) { it.selectProfile(desktop, id) }
|
||||
}
|
||||
SharedInputRoleMix(host, desktop, library, track, ::update)
|
||||
ActionRow(stringResource(R.string.flow_all_settings), null, stringResource(R.string.ctrl_edit), onEdit,
|
||||
modifier = track("input-settings").testTag("input-profile-edit"))
|
||||
failure?.let { message -> AlertDialog(onDismissRequest = { failure = null }, title = { Text(stringResource(R.string.input_save_failed)) },
|
||||
text = { Text(message) }, confirmButton = { PadTextButton(onClick = { failure = null }) { Text(stringResource(R.string.common_ok)) } }) }
|
||||
}
|
||||
|
||||
// This summary is not a selectable profile, even if an imported library uses the nominal ID.
|
||||
internal fun quickMixedChoiceId(library: InputLibrary): String =
|
||||
generateSequence("mixed") { "_$it" }.first { candidate ->
|
||||
candidate != InputProfiles.AUTO && library.profiles.none { it.id == candidate }
|
||||
}
|
||||
|
||||
internal fun quickRoleChoices(library: InputLibrary, role: InputRole): List<Pair<String, String>> {
|
||||
val layoutIds = if (role == InputRole.PHYSICAL) emptySet() else library.sharedLayouts(role).map { it.id }.toSet()
|
||||
return library.bindings.filter { binding ->
|
||||
!library.isGameOwnedBindings(binding.id) && (if (role == InputRole.PHYSICAL) binding.physical
|
||||
else !binding.physical && binding.layoutId?.let { it in layoutIds } == true)
|
||||
}.map { it.id to it.name }
|
||||
}
|
||||
|
||||
/** Mode-local combinations belong to shared defaults, not to a game's pinned profile. */
|
||||
@Composable
|
||||
internal fun SharedInputRoleMix(
|
||||
host: MenuHost,
|
||||
desktop: Boolean,
|
||||
library: InputLibrary,
|
||||
track: (String) -> Modifier,
|
||||
update: (InputRole?, (InputLibrary) -> InputLibrary) -> Unit,
|
||||
inWindow: Boolean = false,
|
||||
) {
|
||||
var expanded by rememberSaveable(desktop) { mutableStateOf(false) }
|
||||
var naming by rememberSaveable(desktop) { mutableStateOf(false) }
|
||||
val mixed = library.selection(desktop).parts.isNotEmpty()
|
||||
ActionRow(stringResource(R.string.input_quick_mix_parts), null,
|
||||
stringResource(if (expanded) R.string.common_hide else R.string.common_show), { expanded = !expanded },
|
||||
modifier = track("input-profile-expand").testTag("input-profile-expand"))
|
||||
if (expanded) {
|
||||
for (role in InputRole.entries) {
|
||||
val tag = "input-part-${role.name}"
|
||||
ChoiceRow(host, tag, roleLabel(role), null, quickRoleChoices(library, role),
|
||||
library.activePart(desktop, role).bindings, chipModifier = track(tag)) { id ->
|
||||
update(role) { it.selectPart(desktop, role, id) }
|
||||
}
|
||||
}
|
||||
if (mixed && !(inWindow && naming)) ActionRow(stringResource(R.string.input_save_combination), null,
|
||||
stringResource(R.string.gesture_save_changes), { naming = true },
|
||||
modifier = track("input-save-combination").testTag("input-save-combination"))
|
||||
if (mixed && inWindow && naming) {
|
||||
var name by rememberSaveable { mutableStateOf("") }
|
||||
DrawerInputPrompt(
|
||||
title = stringResource(R.string.input_save_combination),
|
||||
button = stringResource(R.string.gesture_save_changes),
|
||||
onConfirm = { update(null) { it.saveSelection(desktop, name) }; naming = false },
|
||||
onCancel = { naming = false },
|
||||
enabled = name.isNotBlank(),
|
||||
confirmModifier = track("input-save-combination-confirm").testTag("input-save-combination-confirm"),
|
||||
cancelModifier = track("input-save-combination-cancel").testTag("input-save-combination-cancel"),
|
||||
) {
|
||||
OutlinedTextField(name, { name = it.take(80) }, singleLine = true,
|
||||
label = { Text(stringResource(R.string.input_name)) },
|
||||
modifier = track("input-save-combination-name").testTag("input-save-combination-name"))
|
||||
}
|
||||
}
|
||||
}
|
||||
if (naming && !inWindow) {
|
||||
var name by rememberSaveable { mutableStateOf("") }
|
||||
AlertDialog(
|
||||
onDismissRequest = { naming = false },
|
||||
title = { Text(stringResource(R.string.input_save_combination)) },
|
||||
text = { OutlinedTextField(name, { name = it.take(80) }, singleLine = true,
|
||||
label = { Text(stringResource(R.string.input_name)) }) },
|
||||
confirmButton = { PadTextButton(enabled = name.isNotBlank(), onClick = {
|
||||
update(null) { it.saveSelection(desktop, name) }
|
||||
naming = false
|
||||
}) { Text(stringResource(R.string.gesture_save_changes)) } },
|
||||
dismissButton = { PadTextButton(onClick = { naming = false }) { Text(stringResource(R.string.common_cancel)) } },
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,7 @@ private fun InputSettingsPane(onBack: () -> Unit, onChanged: () -> Unit) {
|
||||
}
|
||||
}
|
||||
|
||||
private enum class InputPage { HOME, PROFILE, SOURCE, LAYOUTS, REUSE }
|
||||
private enum class InputPage { HOME, PROFILE, BUTTONS, SOURCE, LAYOUTS, REUSE }
|
||||
private data class InputBindingEdit(val preset: String, val control: InputControl, val element: InputSurfaceElement? = null, val key: PhysicalInputKey? = null, val click: Boolean = false)
|
||||
private data class InputNameRequest(val title: Int, val initial: String, val sources: List<Pair<String, String>> = emptyList(),
|
||||
val source: String = "", val offerSharing: Boolean = false, val save: (String, String, Boolean) -> Unit)
|
||||
@@ -101,7 +101,6 @@ private fun InputSettingsContent(onBack: () -> Unit, onChanged: () -> Unit, embe
|
||||
var error by remember { mutableStateOf<String?>(null) }
|
||||
val scope = rememberCoroutineScope()
|
||||
val controller = rememberControllerSettings()
|
||||
var oscMode by remember { mutableStateOf(SessionPrefs.oscMode(context)) }
|
||||
fun update(change: (InputLibrary) -> InputLibrary): Boolean = runCatching { InputLibraries.update(context, change) }
|
||||
.onSuccess { library = it; onChanged() }.onFailure { error = it.message ?: context.getString(R.string.input_save_failed) }.isSuccess
|
||||
fun go(next: InputPage) { page = next; host.open = null }
|
||||
@@ -110,7 +109,8 @@ private fun InputSettingsContent(onBack: () -> Unit, onChanged: () -> Unit, embe
|
||||
edit != null -> edit = null
|
||||
page == InputPage.HOME -> onBack()
|
||||
page == InputPage.PROFILE -> go(InputPage.HOME)
|
||||
page == InputPage.SOURCE -> go(InputPage.PROFILE)
|
||||
page == InputPage.SOURCE && role == InputRole.PHYSICAL -> go(InputPage.BUTTONS)
|
||||
page == InputPage.SOURCE || page == InputPage.BUTTONS -> go(InputPage.PROFILE)
|
||||
else -> go(InputPage.SOURCE)
|
||||
}
|
||||
}
|
||||
@@ -124,9 +124,12 @@ private fun InputSettingsContent(onBack: () -> Unit, onChanged: () -> Unit, embe
|
||||
scope.launch {
|
||||
val raw = withContext(Dispatchers.IO) { readLayoutFile(context, uri) }
|
||||
val metrics = inputDisplayMetrics(context, target)
|
||||
val imported = raw?.let { InputLayoutFile.import(context, it, layoutFileName(context, uri) ?: context.getString(R.string.ctrl_layout),
|
||||
if (target == InputRole.PRIMARY) InputLayoutScreen.MAIN else InputLayoutScreen.SECONDARY, layout?.style ?: InputSurfaceStyle(),
|
||||
metrics.widthPixels, metrics.heightPixels, metrics.density) }
|
||||
val screen = if (target == InputRole.PRIMARY) InputLayoutScreen.MAIN else InputLayoutScreen.SECONDARY
|
||||
val name = layoutFileName(context, uri) ?: context.getString(R.string.ctrl_layout)
|
||||
val imported = raw?.let {
|
||||
if (WinlatorLayouts.isIcp(it) && WinlatorLayouts.needsConversion(it)) WinlatorLayouts.import(it, name, screen, metrics.widthPixels, metrics.heightPixels)
|
||||
else InputLayoutFile.import(context, it, name, screen, layout?.style ?: InputSurfaceStyle(), metrics.widthPixels, metrics.heightPixels, metrics.density)
|
||||
}
|
||||
if (imported == null) error = context.getString(R.string.input_layout_import_failed)
|
||||
else if (update { it.withLayout(imported.first).withPreset(imported.second).chooseLayout(profileId, target, imported.first.id) }) go(InputPage.SOURCE)
|
||||
}
|
||||
@@ -144,7 +147,7 @@ private fun InputSettingsContent(onBack: () -> Unit, onChanged: () -> Unit, embe
|
||||
}
|
||||
fun newProfile(copy: Boolean) {
|
||||
naming = InputNameRequest(if (copy) R.string.input_copy_profile else R.string.input_new_profile,
|
||||
if (copy) profile.name else "", library.profiles.map { it.id to it.name }, profileId, offerSharing = true) { name, source, shared ->
|
||||
if (copy) profileLabel(context, profile) else "", library.profiles.map { it.id to profileLabel(context, it) }, profileId, offerSharing = true) { name, source, shared ->
|
||||
val id = newInputId()
|
||||
if (update { it.duplicateProfile(source, name, id, sharePhysical = shared) }) { profileId = id; go(InputPage.PROFILE) }
|
||||
}
|
||||
@@ -172,7 +175,7 @@ private fun InputSettingsContent(onBack: () -> Unit, onChanged: () -> Unit, embe
|
||||
properties = { action -> if (!editing.click) elementProperties?.let { e -> InputElementProperties(e, action) { elementProperties = it } } },
|
||||
onBack = { edit = null }, element = editing.element, nativeTargets = editing.key == null, click = editing.click,
|
||||
detail = if (library.usersOfBindings(b.id).size > 1) stringResource(R.string.input_shared_detail, b.name, library.usersOfBindings(b.id).size)
|
||||
else "${profile.name} · ${roleLabel(role)}", onSave = { action ->
|
||||
else "${profileLabel(context, profile)} · ${roleLabel(role)}", onSave = { action ->
|
||||
if (update { l ->
|
||||
val currentPreset = l.preset(editing.preset)
|
||||
val geometry = if (!editing.click && elementProperties != null && layout != null) l.withLayout(layout.copy(elements = layout.elements.map {
|
||||
@@ -185,45 +188,71 @@ private fun InputSettingsContent(onBack: () -> Unit, onChanged: () -> Unit, embe
|
||||
else -> currentPreset.copy(controls = currentPreset.controls + (editing.control to action))
|
||||
}) }) edit = null
|
||||
})
|
||||
} else if (!surface && page == InputPage.BUTTONS) {
|
||||
InputButtonsPane(profile.binding(InputRole.PHYSICAL), profileLabel(context, profile), null, onBack = ::back, onChanged = { library = InputLibraries.read(context); onChanged() },
|
||||
onMore = { role = InputRole.PHYSICAL; bindingsTab = 2; go(InputPage.SOURCE) })
|
||||
} else if (!surface) key(page, profileId, role) {
|
||||
SettingsPage(host, title = when (page) {
|
||||
InputPage.HOME -> if (embedded) null else stringResource(R.string.setup_controller)
|
||||
InputPage.PROFILE -> profile.name
|
||||
InputPage.PROFILE -> profileLabel(context, profile)
|
||||
InputPage.BUTTONS -> stringResource(R.string.flow_buttons)
|
||||
InputPage.SOURCE -> roleLabel(role)
|
||||
InputPage.LAYOUTS -> stringResource(R.string.input_saved_layouts)
|
||||
InputPage.REUSE -> stringResource(R.string.input_use_settings_from)
|
||||
}, eyebrow = when (page) {
|
||||
InputPage.SOURCE -> profile.name
|
||||
InputPage.LAYOUTS, InputPage.REUSE -> "${profile.name} · ${roleLabel(role)}"
|
||||
InputPage.SOURCE -> profileLabel(context, profile)
|
||||
InputPage.LAYOUTS, InputPage.REUSE -> "${profileLabel(context, profile)} · ${roleLabel(role)}"
|
||||
else -> null
|
||||
},
|
||||
onBack = ::back, showBack = !(embedded && page == InputPage.HOME), compactLayout = true) {
|
||||
when (page) {
|
||||
InputPage.HOME -> {
|
||||
SettingsGroup(stringResource(R.string.input_default_profiles)) {
|
||||
ChoiceRow(host, "auto-desktop", stringResource(R.string.input_desktop_mode), null,
|
||||
library.profiles.map { it.id to it.name }, library.desktop) { id -> update { it.copy(desktop = id) } }
|
||||
ChoiceRow(host, "auto-game", stringResource(R.string.input_game_mode), null,
|
||||
library.profiles.map { it.id to it.name }, library.steam) { id -> update { it.copy(steam = id) } }
|
||||
for (desktop in listOf(true, false)) {
|
||||
val selection = library.selection(desktop)
|
||||
if (selection.profile != InputProfiles.AUTO || selection.parts.isNotEmpty()) InputHint(stringResource(R.string.input_quick_override_hint,
|
||||
stringResource(if (desktop) R.string.input_desktop_mode else R.string.input_game_mode)))
|
||||
}
|
||||
}
|
||||
if (InputLibraries.hasPendingScreenKeyMigration(context)) InputHint(stringResource(R.string.input_import_failed))
|
||||
if (InputLibraries.hasLibraryRecovery(context)) InputHint(stringResource(R.string.input_library_recovered))
|
||||
if (library.profiles.any { it.id.startsWith("migrated.screenkeys.") }) Text(stringResource(R.string.input_imported_keys_hint),
|
||||
Modifier.padding(16.dp), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
SettingsGroup(stringResource(R.string.input_profiles)) {
|
||||
for (p in library.profiles) InputNavigationRow(p.name, when {
|
||||
p.id == library.steam && p.id == library.desktop -> stringResource(R.string.input_default_both)
|
||||
p.id == library.steam -> stringResource(R.string.input_default_game)
|
||||
p.id == library.desktop -> stringResource(R.string.input_default_desktop)
|
||||
else -> null
|
||||
}, Modifier.testTag("input-profile-${p.id}")) { profileId = p.id; go(InputPage.PROFILE) }
|
||||
for (p in library.profiles) {
|
||||
val pinned = library.games.values.count { it.profile == p.id }
|
||||
val inGame = library.activeId(false) == p.id
|
||||
val inDesktop = library.activeId(true) == p.id
|
||||
val uses = listOfNotNull(when {
|
||||
inGame && inDesktop -> stringResource(R.string.flow_in_use_both)
|
||||
inGame -> stringResource(R.string.flow_in_use_game)
|
||||
inDesktop -> stringResource(R.string.flow_in_use_desktop)
|
||||
else -> null
|
||||
}, when {
|
||||
p.id == library.steam && p.id == library.desktop -> stringResource(R.string.input_default_both)
|
||||
p.id == library.steam -> stringResource(R.string.input_default_game)
|
||||
p.id == library.desktop -> stringResource(R.string.input_default_desktop)
|
||||
else -> null
|
||||
}, if (pinned > 0) stringResource(R.string.flow_used_games, pinned) else null)
|
||||
InputNavigationRow(profileLabel(context, p), uses.joinToString(" · ").ifEmpty { null }, Modifier.testTag("input-profile-${p.id}")) { profileId = p.id; go(InputPage.PROFILE) }
|
||||
}
|
||||
for (desktop in listOf(true, false)) {
|
||||
val selection = library.selection(desktop)
|
||||
if (selection.profile != InputProfiles.AUTO || selection.parts.isNotEmpty()) InputHint(stringResource(R.string.flow_mode_override_hint,
|
||||
stringResource(if (desktop) R.string.input_desktop_mode else R.string.input_game_mode)))
|
||||
}
|
||||
PadTextButton(onClick = { newProfile(false) }, modifier = Modifier.padding(8.dp)) { Text(stringResource(R.string.input_new_profile)) }
|
||||
}
|
||||
if (library.games.isNotEmpty()) SettingsGroup(stringResource(R.string.flow_games)) {
|
||||
InputHint(stringResource(R.string.flow_games_hint))
|
||||
for ((key, game) in library.games.entries.sortedBy { it.value.name.lowercase() }) {
|
||||
val pinned = game.profile?.let { id -> library.profiles.firstOrNull { it.id == id }?.let { profileLabel(context, it) } }
|
||||
val changes = library.gameChanges(false, key)
|
||||
ActionRow(game.name, listOfNotNull(pinned, if (changes > 0) stringResource(R.string.flow_changes_count, changes) else null)
|
||||
.joinToString(" · ").ifEmpty { null }, stringResource(R.string.flow_clear), { confirmation = InputConfirmation(context.getString(R.string.flow_clear_title, game.name), context.getString(R.string.flow_clear_body, game.name)) { update { it.resetGame(key) } } },
|
||||
modifier = Modifier.testTag("input-game-$key"))
|
||||
}
|
||||
}
|
||||
SettingsGroup(stringResource(R.string.flow_touch_controls)) {
|
||||
var touch by remember { mutableStateOf(ControllerPrefs.read(context)) }
|
||||
SliderRow(stringResource(R.string.flow_size_overall), null, touch.size, ControllerPrefs.sizes.first()..ControllerPrefs.sizes.last(), step = 5,
|
||||
format = { "$it%" }) { ControllerPrefs.setSize(context, it); touch = ControllerPrefs.read(context); onChanged() }
|
||||
SliderRow(stringResource(R.string.ctrl_opacity), null, touch.onScreenOpacity, ControllerPrefs.onScreenOpacityRange, step = 5,
|
||||
format = { "$it%" }) { ControllerPrefs.setOnScreenOpacity(context, it); touch = ControllerPrefs.read(context); onChanged() }
|
||||
}
|
||||
SettingsGroup(stringResource(R.string.input_device_settings)) {
|
||||
ToggleRow(host, "controller-rumble", stringResource(R.string.ctrl_rumble), null, controller.rumble) { ControllerPrefs.setRumble(context, it); onChanged() }
|
||||
ChoiceRow(host, "controller-dead-zone", stringResource(R.string.ctrl_dead_zone), null, ControllerPrefs.deadZones.map { it to stringResource(R.string.ctrl_percent, it) }, controller.deadZone) { ControllerPrefs.setDeadZone(context, it); onChanged() }
|
||||
@@ -246,22 +275,49 @@ private fun InputSettingsContent(onBack: () -> Unit, onChanged: () -> Unit, embe
|
||||
}
|
||||
}
|
||||
InputPage.PROFILE -> {
|
||||
val uses = when {
|
||||
library.steam == profileId && library.desktop == profileId -> "both"
|
||||
library.steam == profileId -> "game"
|
||||
library.desktop == profileId -> "desktop"
|
||||
else -> "none"
|
||||
}
|
||||
fun applyDefault(l: InputLibrary, pick: String) =
|
||||
l.copy(steam = if (pick == "game" || pick == "both") profileId else if (l.steam == profileId) InputProfile.GAME else l.steam,
|
||||
desktop = if (pick == "desktop" || pick == "both") profileId else if (l.desktop == profileId) InputProfile.DESKTOP else l.desktop)
|
||||
fun usesIn(l: InputLibrary) = when {
|
||||
l.steam == profileId && l.desktop == profileId -> "both"
|
||||
l.steam == profileId -> "game"
|
||||
l.desktop == profileId -> "desktop"
|
||||
else -> "none"
|
||||
}
|
||||
// A built-in profile is the fallback for its own mode, so it can't give that mode up.
|
||||
val defaults = listOf("game" to stringResource(R.string.input_game_mode), "desktop" to stringResource(R.string.input_desktop_mode),
|
||||
"both" to stringResource(R.string.flow_both_modes), "none" to stringResource(R.string.flow_no_mode))
|
||||
.filter { (pick, _) -> pick == uses || usesIn(applyDefault(library, pick)) == pick }
|
||||
SettingsGroup(stringResource(R.string.flow_default_for)) {
|
||||
ChoiceRow(host, "profile-default", stringResource(R.string.flow_default_for), null, defaults, uses) { pick ->
|
||||
update { applyDefault(it, pick) }
|
||||
}
|
||||
}
|
||||
SettingsGroup(stringResource(R.string.input_profile_controls)) {
|
||||
for (r in InputRole.entries) InputNavigationRow(roleLabel(r),
|
||||
if (r == InputRole.PHYSICAL) stringResource(R.string.input_physical_hint) else library.layout(profileId, r)?.name,
|
||||
Modifier.testTag("input-part-${r.name.lowercase()}"), leading = {
|
||||
library.layout(profileId, r)?.let { InputLayoutThumbnail(it, r) }
|
||||
}) { editPart(r) }
|
||||
InputNavigationRow(stringResource(R.string.flow_buttons), stringResource(R.string.input_physical_hint),
|
||||
Modifier.testTag("input-part-physical")) { role = InputRole.PHYSICAL; go(InputPage.BUTTONS) }
|
||||
for (r in listOf(InputRole.PRIMARY, InputRole.SECONDARY)) {
|
||||
InputNavigationRow(if (r == InputRole.PRIMARY) stringResource(R.string.flow_layout) else roleLabel(r), library.layout(profileId, r)?.name,
|
||||
Modifier.testTag("input-part-${r.name.lowercase()}"), leading = {
|
||||
library.layout(profileId, r)?.let { InputLayoutThumbnail(it, r) }
|
||||
}) { editPart(r) }
|
||||
}
|
||||
}
|
||||
Spacer(Modifier.height(16.dp))
|
||||
Actions {
|
||||
SecondaryButton(stringResource(R.string.input_rename)) { rename(R.string.input_rename, profile.name) { name -> update { it.withProfile(profile.copy(name = name)) } } }
|
||||
SecondaryButton(stringResource(R.string.input_copy_profile)) { newProfile(true) }
|
||||
SecondaryButton(stringResource(R.string.input_reset_actions)) {
|
||||
confirmation = InputConfirmation(context.getString(R.string.input_reset_actions), context.getString(R.string.input_reset_profile_detail, profile.name)) { update { it.resetProfile(profileId) } }
|
||||
confirmation = InputConfirmation(context.getString(R.string.input_reset_actions), context.getString(R.string.input_reset_profile_detail, profileLabel(context, profile))) { update { it.resetProfile(profileId) } }
|
||||
}
|
||||
if (profileId !in listOf(InputProfile.GAME, InputProfile.DESKTOP)) SecondaryButton(stringResource(R.string.input_delete)) {
|
||||
confirmation = InputConfirmation(context.getString(R.string.input_delete), context.getString(R.string.input_delete_profile_detail, profile.name)) {
|
||||
confirmation = InputConfirmation(context.getString(R.string.input_delete), context.getString(R.string.input_delete_profile_detail, profileLabel(context, profile))) {
|
||||
if (update { it.removeProfile(profileId) }) { profileId = InputProfile.GAME; go(InputPage.HOME) }
|
||||
}
|
||||
}
|
||||
@@ -276,22 +332,22 @@ private fun InputSettingsContent(onBack: () -> Unit, onChanged: () -> Unit, embe
|
||||
if (PadKit.forOverlay(context, layout).let { kit -> role != InputRole.PRIMARY || kit == null || layout.elements.any { !kit.artwork(it) } }) {
|
||||
InputColorRow(host, layout.style.tint) { color -> update { it.withLayout(layout.copy(style = layout.style.copy(tint = color))) } }
|
||||
}
|
||||
SliderRow(stringResource(R.string.ctrl_opacity), null, layout.style.opacity, 1..100, step = 1,
|
||||
format = { "$it%" }) { opacity -> update { it.withLayout(layout.copy(style = layout.style.copy(opacity = opacity))) } }
|
||||
for (button in layout.quickButtons) ToggleRow(host, "quick-${button.name.lowercase()}", stringResource(quickButtonLabel(button)), null,
|
||||
button !in layout.style.hidden) { on -> update { it.withLayout(layout.withQuickButton(button, on)) } }
|
||||
if (!library.isGameOwnedLayout(layout.id)) {
|
||||
SliderRow(stringResource(R.string.ctrl_opacity), layout.name, layout.style.opacity, 1..100,
|
||||
format = { "$it%" }, modifier = Modifier.testTag("input-layout-opacity")) { opacity ->
|
||||
update { current ->
|
||||
val saved = current.layouts.firstOrNull { it.id == layout.id }
|
||||
if (saved == null || current.isGameOwnedLayout(saved.id)) current
|
||||
else current.withLayout(saved.copy(style = saved.style.copy(opacity = opacity)))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (role == InputRole.SECONDARY) InputHint(stringResource(R.string.input_second_screen_enable))
|
||||
}
|
||||
if (role == InputRole.PRIMARY) SettingsGroup(stringResource(R.string.input_screen_visibility)) {
|
||||
ChoiceRow(host, "controller-osc", stringResource(R.string.mode_osc), stringResource(R.string.input_visibility_shared),
|
||||
listOf(SessionPrefs.OSC_AUTO to stringResource(R.string.common_auto), SessionPrefs.OSC_ALWAYS to stringResource(R.string.common_always),
|
||||
SessionPrefs.OSC_STEAM_TOUCH to stringResource(R.string.osc_steam_touch), SessionPrefs.OSC_STEAM_QAM to stringResource(R.string.mode_osc_qam), SessionPrefs.OSC_NEVER to stringResource(R.string.common_never)),
|
||||
oscMode) { SessionPrefs.setOscMode(context, it); oscMode = it; onChanged() }
|
||||
if (role == InputRole.SECONDARY) InputHint(stringResource(R.string.flow_second_screen_hint))
|
||||
}
|
||||
SettingsGroup(stringResource(R.string.input_assign_actions)) {
|
||||
val users = library.usersOfBindings(preset.id)
|
||||
if (users.size > 1) InputHint(stringResource(R.string.input_shared_with, users.filterNot { it.id == profileId }.joinToString { it.name }))
|
||||
if (users.size > 1) InputHint(stringResource(R.string.input_shared_with, users.filterNot { it.id == profileId }.joinToString { profileLabel(context, it) }))
|
||||
val elements = layout?.takeIf { it.editable }?.elements
|
||||
if (elements != null) {
|
||||
if (elements.isEmpty()) InputHint(stringResource(R.string.input_empty_elements))
|
||||
@@ -324,10 +380,17 @@ private fun InputSettingsContent(onBack: () -> Unit, onChanged: () -> Unit, embe
|
||||
}
|
||||
}
|
||||
InputPage.LAYOUTS -> {
|
||||
InputHint(stringResource(R.string.input_layout_geometry_hint))
|
||||
SettingsGroup(stringResource(R.string.input_saved_layouts)) {
|
||||
var community by remember { mutableStateOf(false) }
|
||||
Box(Modifier.padding(horizontal = 12.dp, vertical = 8.dp)) {
|
||||
SheetChips(listOf(stringResource(R.string.flow_mine), stringResource(R.string.flow_community)), if (community) 1 else 0) { community = it == 1 }
|
||||
}
|
||||
if (community) CommunityLayouts(role) { imported ->
|
||||
if (update { it.withLayout(imported.first).withPreset(imported.second).chooseLayout(profileId, role, imported.first.id) }) go(InputPage.SOURCE)
|
||||
}
|
||||
else InputHint(stringResource(R.string.input_layout_geometry_hint))
|
||||
if (!community) SettingsGroup(stringResource(R.string.input_saved_layouts)) {
|
||||
var showOther by remember { mutableStateOf(false) }
|
||||
val available = library.layouts.filter { it.supports(role) }
|
||||
val available = library.sharedLayouts(role)
|
||||
val other = available.filter { saved -> !saved.id.startsWith("builtin.") && saved.id != layout?.id &&
|
||||
library.usersOfLayout(saved.id).isEmpty() && library.bindings.none { it.layoutId == saved.id && library.selectedBindings(it.id) } }
|
||||
for (saved in available.filter { showOther || it !in other }) {
|
||||
@@ -350,11 +413,12 @@ private fun InputSettingsContent(onBack: () -> Unit, onChanged: () -> Unit, embe
|
||||
}
|
||||
|
||||
}
|
||||
InputPage.BUTTONS -> Unit
|
||||
InputPage.REUSE -> {
|
||||
InputHint(stringResource(R.string.input_reuse_explanation, roleLabel(role)))
|
||||
SettingsGroup(stringResource(R.string.input_profiles)) {
|
||||
for (p in library.profiles.filterNot { it.id == profileId }) InputNavigationRow(p.name, library.layout(p.id, role)?.name) {
|
||||
reuse = InputReuseRequest(p.name, layoutOnly = false) { shared -> if (update { it.usePart(profileId, role, p.id, shared) }) go(InputPage.SOURCE) }
|
||||
for (p in library.profiles.filterNot { it.id == profileId }) InputNavigationRow(profileLabel(context, p), library.layout(p.id, role)?.name) {
|
||||
reuse = InputReuseRequest(profileLabel(context, p), layoutOnly = false) { shared -> if (update { it.usePart(profileId, role, p.id, shared) }) go(InputPage.SOURCE) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,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 aspect: Float)
|
||||
val clicks: Map<String, InputAction>, val scale: Float, val aspect: Float, val hidden: Set<InputCommand>)
|
||||
|
||||
private class GamepadScaler(private val context: android.content.Context, private val width: Int, private val height: Int,
|
||||
private val layout: SavedInputLayout) {
|
||||
@@ -88,6 +88,8 @@ private class SurfaceDraft(val layout: SavedInputLayout, val preset: SavedInputB
|
||||
var toolsX by mutableFloatStateOf(-1f)
|
||||
var toolsY by mutableFloatStateOf(.02f)
|
||||
var snap by mutableStateOf(snap)
|
||||
var grid by mutableIntStateOf(0)
|
||||
var hidden by mutableStateOf(layout.style.hidden)
|
||||
var adding by mutableStateOf(false)
|
||||
var properties by mutableStateOf(false)
|
||||
var clickProperties by mutableStateOf(false)
|
||||
@@ -117,9 +119,11 @@ private class SurfaceDraft(val layout: SavedInputLayout, val preset: SavedInputB
|
||||
return OnScreenLayout.fit(placed, from, 1f, (aspect * 1000).roundToInt().coerceAtLeast(1), 1000, Rect())
|
||||
}
|
||||
val element get() = elements.firstOrNull { it.id == selected } ?: shown.firstOrNull { it.id == selected }
|
||||
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) } }
|
||||
val dirty get() = elements != layout.elements || actions != preset.elements || clicks != preset.clicks || layoutScale != layout.scale ||
|
||||
aspect != layout.aspect || hidden != layout.style.hidden
|
||||
private var lastAssigned: String? = null
|
||||
fun checkpoint() { lastAssigned = null; history = (history + SurfaceSnapshot(elements, actions, clicks, layoutScale, aspect, hidden)).takeLast(40) }
|
||||
fun undo() { lastAssigned = null; history.lastOrNull()?.let { elements = it.elements; actions = it.actions; clicks = it.clicks; layoutScale = it.scale; aspect = it.aspect; hidden = it.hidden; history = history.dropLast(1) } }
|
||||
private fun adoptDisplayedFrame(context: android.content.Context): Boolean {
|
||||
if (canvas.width <= 0 || canvas.height <= 0 || shown.isEmpty() || aspect <= 0f || (aspect < 1f) == (canvasAspect < 1f)) return false
|
||||
val open = toolsExpanded
|
||||
@@ -199,10 +203,45 @@ private class SurfaceDraft(val layout: SavedInputLayout, val preset: SavedInputB
|
||||
}
|
||||
|
||||
fun update(element: InputSurfaceElement) {
|
||||
stored(element.id)
|
||||
val existing = elements.firstOrNull { it.id == element.id }
|
||||
if (existing == element) return
|
||||
if (existing != null) checkpoint() else if (!stored(element.id)) return
|
||||
elements = elements.map { if (it.id == element.id) element else it }
|
||||
}
|
||||
|
||||
/** A D-pad arm is part of one control and can't be copied on its own. */
|
||||
fun canDuplicate(e: InputSurfaceElement): Boolean {
|
||||
if (e.dpadPiece) return false
|
||||
val frame = if (elements.any { it.id == e.id }) elements
|
||||
else OnScreenLayout.editorFrame(layout.copy(elements = elements), shown)
|
||||
return frame.size < 64 && frame.any { it.id == e.id }
|
||||
}
|
||||
|
||||
/** Adds a copy of [id] next to it, doing what the original does, and selects it. */
|
||||
fun duplicate(id: String) {
|
||||
val original = (elements.firstOrNull { it.id == id } ?: shown.firstOrNull { it.id == id })?.takeIf(::canDuplicate) ?: return
|
||||
if (elements.any { it.id == id }) checkpoint() else if (!stored(id)) return
|
||||
val copy = original.copy(id = newInputId(), control = original.kind.control,
|
||||
x = original.x + .03f, y = original.y + .03f).bounded()
|
||||
fun resolved(action: InputAction) = if (action is InputAction.Native && action.target == null && original.kind != InputElementKind.DPAD)
|
||||
InputAction.Native(original.control) else action
|
||||
val action = resolved(action(original)).takeIf { it.validFor(copy) } ?: InputAction.Disabled
|
||||
elements = elements + copy
|
||||
actions = actions + (copy.id to action)
|
||||
if (copy.hasClick) clickAction(original).takeIf { it.validForClick() }?.let { clicks = clicks + (copy.id to it) }
|
||||
selected = copy.id
|
||||
}
|
||||
|
||||
/** Sets what [id] does (or, with [click], what clicking it does), keeping one undo step per control. */
|
||||
fun assign(id: String, action: InputAction, click: Boolean) {
|
||||
val e = elements.firstOrNull { it.id == id } ?: shown.firstOrNull { it.id == id } ?: return
|
||||
if (if (click) clickAction(e) == action else action(e) == action) return
|
||||
val key = "$id/$click"
|
||||
if (lastAssigned != key) { checkpoint(); lastAssigned = key }
|
||||
stored(id)
|
||||
if (click) clicks = clicks + (id to action) else actions = actions + (id to action)
|
||||
}
|
||||
|
||||
fun resetPositions(context: android.content.Context) {
|
||||
val adopted = adoptDisplayedFrame(context)
|
||||
positioned?.let { if (!adopted) checkpoint(); elements = it; if (rescales) layoutScale = 1f }
|
||||
@@ -212,15 +251,16 @@ private class SurfaceDraft(val layout: SavedInputLayout, val preset: SavedInputB
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun InputSurfaceDialog(profile: String, onDismiss: () -> Unit, onChanged: () -> Unit,
|
||||
role: InputRole = InputRole.SECONDARY, layoutId: String? = null, bindingsId: String? = null) {
|
||||
internal fun InputSurfaceDialog(profile: String, onDismiss: () -> Unit, onChanged: () -> Unit,
|
||||
role: InputRole = InputRole.SECONDARY, layoutId: String? = null, bindingsId: String? = null, initialSelection: String? = null,
|
||||
scope: String? = null, gameEdit: GameInputEdit? = null) {
|
||||
val context = LocalContext.current
|
||||
val host = LocalInputActivity.current ?: context.findActivity() as? ComponentActivity
|
||||
val library = remember { InputLibraries.read(context) }
|
||||
val savedLayout = remember { library.layouts.first { it.id == (layoutId ?: library.profile(profile).parts.getValue(role).layout) } }
|
||||
val savedBindings = remember { library.preset(bindingsId ?: library.profile(profile).binding(role)) }
|
||||
val layoutUsers = library.usersOfLayout(savedLayout.id).size
|
||||
val bindingUsers = library.usersOfBindings(savedBindings.id).size
|
||||
val layoutUsers = if (gameEdit == null) library.usersOfLayout(savedLayout.id).size else 1
|
||||
val bindingUsers = if (gameEdit == null) library.usersOfBindings(savedBindings.id).size else 1
|
||||
val draft = remember {
|
||||
val (display, metrics) = InputLibraries.primaryDisplay(context)
|
||||
val gamepad = savedLayout.elements.takeIf { e -> e.any { it.id.startsWith("legacy:") } }?.let {
|
||||
@@ -229,6 +269,7 @@ fun InputSurfaceDialog(profile: String, onDismiss: () -> Unit, onChanged: () ->
|
||||
}
|
||||
val defaults = InputLibraries.defaultPositions(context, library, savedLayout)
|
||||
SurfaceDraft(savedLayout, savedBindings, defaults?.first, defaults?.second ?: 0f, gamepad, ControllerPrefs.snap(context))
|
||||
.also { it.grid = ControllerPrefs.editorGrid(context); it.selected = initialSelection }
|
||||
}
|
||||
val manager = remember { context.getSystemService(DisplayManager::class.java) }
|
||||
var revision by remember { mutableIntStateOf(0) }
|
||||
@@ -245,12 +286,26 @@ fun InputSurfaceDialog(profile: String, onDismiss: () -> Unit, onChanged: () ->
|
||||
val remote = target != null && target.displayId != host?.window?.decorView?.display?.displayId
|
||||
fun leave() { if (draft.dirty) discard = true else onDismiss() }
|
||||
fun save() {
|
||||
if (!draft.dirty) {
|
||||
onDismiss()
|
||||
return
|
||||
}
|
||||
fun change(library: InputLibrary, layoutId: String, bindingsId: String): InputLibrary {
|
||||
val layout = library.layouts.first { it.id == layoutId }
|
||||
check(layout.editable)
|
||||
val bindings = library.preset(bindingsId)
|
||||
return library.withLayout(OnScreenLayout.withFrame(context, layout, draft.elements, draft.aspect, draft.layoutScale)
|
||||
.let { it.copy(style = it.style.copy(hidden = draft.hidden)) }).withPreset(bindings.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 } },
|
||||
))
|
||||
}
|
||||
runCatching {
|
||||
InputLibraries.update(context) { latest ->
|
||||
val l = latest.layouts.first { it.id == savedLayout.id }
|
||||
val p = latest.preset(savedBindings.id)
|
||||
latest.withLayout(OnScreenLayout.withFrame(context, l, draft.elements, draft.aspect, 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 } }))
|
||||
if (gameEdit == null) change(latest, savedLayout.id, savedBindings.id)
|
||||
else gameEdit.apply(latest) { editable, part ->
|
||||
change(editable, requireNotNull(part.layout), part.bindings)
|
||||
}
|
||||
}
|
||||
}.onSuccess { onChanged(); onDismiss() }.onFailure { failure = it.message ?: context.getString(R.string.input_save_failed) }
|
||||
}
|
||||
@@ -323,7 +378,9 @@ fun InputSurfaceDialog(profile: String, onDismiss: () -> Unit, onChanged: () ->
|
||||
}
|
||||
else -> Box(Modifier.fillMaxSize()) {
|
||||
SurfaceCanvas(draft, transparent = host is SessionActivity && role == InputRole.PRIMARY)
|
||||
FloatingSurfaceTools(draft, ::save, ::leave)
|
||||
val selected = draft.element
|
||||
if (selected != null) DockedElementPanel(draft, selected, ::save, scope)
|
||||
else FloatingSurfaceTools(draft, ::save, ::leave, scope)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -356,6 +413,7 @@ private fun SurfaceCanvas(draft: SurfaceDraft, transparent: Boolean = false) {
|
||||
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.sourceLayout = draft.layout.copy(scale = draft.layoutScale); view.aspect = draft.aspect; view.elements = draft.elements; view.selected = draft.selected; view.snap = draft.snap
|
||||
view.isEnabled = !draft.properties && !draft.adding
|
||||
view.grid = if (draft.grid > 0) 1f / draft.grid else 0f
|
||||
view.onSelect = { if (!draft.properties) draft.selected = it }
|
||||
view.onBeginEdit = { e, w, h -> draft.beginEdit(e, w.toFloat() / h, if (draft.hasGamepad) GamepadScaler(view.context, w, h, draft.layout) else null) }
|
||||
view.onResize = { w, h -> draft.canvas = IntSize(w, h) }
|
||||
@@ -366,7 +424,7 @@ private fun SurfaceCanvas(draft: SurfaceDraft, transparent: Boolean = false) {
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun FloatingSurfaceTools(draft: SurfaceDraft, onSave: () -> Unit, onLeave: () -> Unit) {
|
||||
private fun FloatingSurfaceTools(draft: SurfaceDraft, onSave: () -> Unit, onLeave: () -> Unit, scope: String? = null) {
|
||||
BoxWithConstraints(Modifier.fillMaxSize()) {
|
||||
val density = LocalDensity.current
|
||||
val screenWidth = with(density) { maxWidth.toPx() }
|
||||
@@ -400,6 +458,7 @@ private fun FloatingSurfaceTools(draft: SurfaceDraft, onSave: () -> Unit, onLeav
|
||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp)) {
|
||||
Text("⠿", color = MaterialTheme.colorScheme.primary)
|
||||
Text(stringResource(if (draft.toolsExpanded) R.string.input_hide_tools else R.string.input_tools), style = MaterialTheme.typography.titleSmall, maxLines = 1)
|
||||
if (draft.toolsExpanded && scope != null) ScopePill(editingLabel(scope, draft.aspect))
|
||||
}
|
||||
AnimatedVisibility(draft.toolsExpanded, enter = expandVertically(expandFrom = Alignment.Top) + fadeIn(),
|
||||
exit = shrinkVertically(shrinkTowards = Alignment.Top) + fadeOut()) {
|
||||
@@ -415,23 +474,102 @@ private fun FloatingSurfaceTools(draft: SurfaceDraft, onSave: () -> Unit, onLeav
|
||||
}
|
||||
}
|
||||
|
||||
/** The selected control's settings, docked on the side of the screen away from it so it never covers what is being edited. */
|
||||
@OptIn(ExperimentalLayoutApi::class)
|
||||
@Composable
|
||||
private fun DockedElementPanel(draft: SurfaceDraft, element: InputSurfaceElement, onSave: () -> Unit, scope: String? = null) {
|
||||
val context = LocalContext.current
|
||||
val host = rememberMenuHost()
|
||||
val onRight = element.x + element.width / 2 < .5f
|
||||
var click by remember(element.id) { mutableStateOf(false) }
|
||||
val clicking = click && element.hasClick
|
||||
val current = if (clicking) draft.clickAction(element) else draft.action(element)
|
||||
val actionDraft = remember(element.id, clicking) { InputActionDraft(current) }
|
||||
val control = if (clicking) InputControl.A else element.control
|
||||
LaunchedEffect(actionDraft.action) {
|
||||
if (actionDraft.action.validAs(control, element.takeUnless { clicking }, clicking)) draft.assign(element.id, actionDraft.action, clicking)
|
||||
}
|
||||
// Undo, or any other change to the saved action, shows here too.
|
||||
LaunchedEffect(current) { if (actionDraft.action != current) actionDraft.action = current }
|
||||
var appearance by remember(element.id) { mutableStateOf(false) }
|
||||
BoxWithConstraints(Modifier.fillMaxSize()) {
|
||||
// A tall screen has no room beside a control, so the panel spans the half above or below it instead.
|
||||
val tall = maxHeight > maxWidth
|
||||
val below = element.y + element.height / 2 < .5f
|
||||
val placement = when {
|
||||
tall -> Modifier.align(if (below) Alignment.BottomCenter else Alignment.TopCenter).fillMaxWidth().heightIn(max = maxHeight * .46f)
|
||||
else -> Modifier.align(if (onRight) Alignment.CenterEnd else Alignment.CenterStart).width(minOf(380.dp, maxWidth * .48f)).fillMaxHeight()
|
||||
}
|
||||
Surface(placement.padding(8.dp).testTag("input-editor-panel"),
|
||||
shape = RoundedCornerShape(18.dp), color = MaterialTheme.colorScheme.surface, tonalElevation = 6.dp, shadowElevation = 10.dp) {
|
||||
CompositionLocalProvider(LocalCompactSettings provides true, LocalNarrowPane provides false) {
|
||||
Column {
|
||||
Row(Modifier.padding(horizontal = 12.dp, vertical = 8.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(2.dp)) {
|
||||
// The D-pad is picked by one arm but moves and sizes as one control.
|
||||
Text(if (element.dpadPiece) stringResource(R.string.input_element_dpad) else element.name, style = MaterialTheme.typography.titleMedium,
|
||||
maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)
|
||||
scope?.let { ScopePill(editingLabel(it, draft.aspect)) }
|
||||
}
|
||||
SecondaryButton(stringResource(R.string.input_editor_undo), enabled = draft.history.isNotEmpty(), compact = true) { draft.undo() }
|
||||
PrimaryButton(stringResource(R.string.input_editor_done), compact = true, modifier = Modifier.testTag("input-editor-done"), onClick = onSave)
|
||||
}
|
||||
Column(Modifier.weight(1f, fill = false).verticalScroll(rememberScrollState()).padding(horizontal = 12.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
if (element.hasClick) SheetChips(listOf(stringResource(R.string.input_action), stringResource(R.string.input_click_name, element.name)),
|
||||
if (clicking) 1 else 0) { click = it == 1 }
|
||||
InputActionFields(host, control, actionDraft, element.takeUnless { clicking }, click = clicking)
|
||||
SliderRow(stringResource(R.string.flow_size_control), null, draft.scale, draft.scaleRange, step = 5,
|
||||
format = { "$it%" }, modifier = Modifier.testTag("input-editor-scale")) { draft.scaleSelected(context, it) }
|
||||
if (!clicking) {
|
||||
Row(Modifier.fillMaxWidth().focusRow { appearance = !appearance }.padding(horizontal = 10.dp, vertical = 10.dp).testTag("input-editor-appearance"),
|
||||
verticalAlignment = Alignment.CenterVertically) {
|
||||
Text(stringResource(R.string.flow_appearance), fontWeight = androidx.compose.ui.text.font.FontWeight.SemiBold,
|
||||
style = MaterialTheme.typography.bodyMedium, modifier = Modifier.weight(1f))
|
||||
Text(if (appearance) "▾" else "▸", color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
}
|
||||
if (appearance) InputElementProperties(element, actionDraft.action) { draft.update(it) }
|
||||
}
|
||||
}
|
||||
// Kept outside the scroll so a short panel on a tall phone never hides them.
|
||||
FlowRow(Modifier.padding(12.dp), horizontalArrangement = Arrangement.spacedBy(8.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) {
|
||||
SecondaryButton(stringResource(R.string.flow_duplicate), enabled = draft.canDuplicate(element), compact = true,
|
||||
modifier = Modifier.testTag("input-editor-duplicate")) { draft.duplicate(element.id) }
|
||||
SecondaryButton(stringResource(R.string.input_remove_element), compact = true) { draft.remove(element.id) }
|
||||
SecondaryButton(stringResource(R.string.common_close), compact = true) { draft.selected = null }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalLayoutApi::class)
|
||||
@Composable
|
||||
private fun SurfaceToolbar(draft: SurfaceDraft, onSave: () -> Unit, onLeave: () -> Unit) {
|
||||
val context = LocalContext.current
|
||||
val host = rememberMenuHost()
|
||||
FlowRow(Modifier.fillMaxWidth().padding(8.dp), horizontalArrangement = Arrangement.spacedBy(8.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) {
|
||||
SecondaryButton(stringResource(R.string.common_cancel), compact = true, onClick = onLeave)
|
||||
SecondaryButton(stringResource(R.string.input_editor_add), enabled = draft.elements.size < 64, compact = true) { draft.adding = true }
|
||||
SecondaryButton(stringResource(R.string.input_editor_undo), enabled = draft.history.isNotEmpty(), compact = true) { draft.undo() }
|
||||
if (draft.defaults != null) SecondaryButton(stringResource(R.string.input_reset_positions), enabled = draft.positioned != null, compact = true) { draft.resetPositions(context) }
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Checkbox(draft.snap, { draft.snap = it; ControllerPrefs.setSnap(context, it) })
|
||||
Text(stringResource(R.string.ctrl_editor_snap))
|
||||
}
|
||||
PrimaryButton(stringResource(R.string.input_editor_done), compact = true, onClick = onSave)
|
||||
}
|
||||
if (draft.elements.isNotEmpty()) SliderRow(stringResource(R.string.ctrl_size), null, draft.scale, draft.scaleRange, step = 5,
|
||||
if (draft.elements.isNotEmpty()) SliderRow(stringResource(if (draft.element != null) R.string.flow_size_control else R.string.flow_size_layout), null, draft.scale, draft.scaleRange, step = 5,
|
||||
format = { "$it%" }, modifier = Modifier.testTag("input-editor-scale")) { if (draft.element != null) draft.scaleSelected(context, it) else draft.scaleAll(context, it) }
|
||||
// One choice for both kinds of snapping: lining up with other controls, and lining up with other controls or a grid.
|
||||
val snapping = when { draft.grid == 50 -> "fine"; draft.grid == 25 -> "coarse"; draft.snap -> "controls"; else -> "off" }
|
||||
ChoiceRow(host, "editor-snap", stringResource(R.string.ctrl_editor_snap), null, listOf("off" to stringResource(R.string.widgets_off),
|
||||
"controls" to stringResource(R.string.flow_snap_controls), "fine" to stringResource(R.string.flow_grid_fine),
|
||||
"coarse" to stringResource(R.string.flow_grid_coarse)), snapping) { pick ->
|
||||
draft.snap = pick != "off"; ControllerPrefs.setSnap(context, draft.snap)
|
||||
draft.grid = when (pick) { "fine" -> 50; "coarse" -> 25; else -> 0 }; ControllerPrefs.setEditorGrid(context, draft.grid)
|
||||
}
|
||||
for (button in QUICK_BUTTONS.filter { b -> draft.elements.any { it.quickButton == b } }) {
|
||||
ToggleRow(host, "editor-quick-${button.name.lowercase()}", stringResource(quickButtonLabel(button)), null, button !in draft.hidden) { shown ->
|
||||
draft.checkpoint(); draft.hidden = if (shown) draft.hidden - button else draft.hidden + button
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalLayoutApi::class)
|
||||
@@ -445,7 +583,7 @@ private fun SurfaceSelection(draft: SurfaceDraft) {
|
||||
if (e.hasClick) SecondaryButton(stringResource(R.string.input_click_properties), compact = true) { draft.clickProperties = true; draft.properties = true }
|
||||
SecondaryButton(stringResource(R.string.input_remove_element), compact = true) { draft.remove(e.id) }
|
||||
}
|
||||
} ?: Text(stringResource(R.string.input_editor_hint))
|
||||
} ?: Text(stringResource(R.string.flow_editor_hint) + " " + stringResource(if (draft.aspect > 0f && draft.aspect < 1f) R.string.flow_landscape_separate else R.string.flow_portrait_separate))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,12 @@ internal class InputSurfaceEditorView(context: Context) : FrameLayout(context) {
|
||||
set(value) { field = value; updatePreviewStyle() }
|
||||
var snap = true
|
||||
set(value) { field = value; if (!value) clearGuides() }
|
||||
/** Grid spacing as a fraction of the width; 0 for no grid. */
|
||||
var grid = 0f
|
||||
set(value) { field = value; invalidate() }
|
||||
/** Taps select a control; nothing moves. */
|
||||
var selectOnly = false
|
||||
private val gridPaint = Paint().apply { color = Color.argb(40, 255, 255, 255); strokeWidth = 1f }
|
||||
private var guideX: Float? = null
|
||||
private var guideY: Float? = null
|
||||
var selected: String? = null
|
||||
@@ -99,6 +105,13 @@ internal class InputSurfaceEditorView(context: Context) : FrameLayout(context) {
|
||||
}
|
||||
|
||||
override fun dispatchDraw(canvas: Canvas) {
|
||||
if (grid > 0f && !selectOnly && width > 0) {
|
||||
val step = grid * width
|
||||
var x = step
|
||||
while (x < width) { canvas.drawLine(x, 0f, x, height.toFloat(), gridPaint); x += step }
|
||||
var y = step
|
||||
while (y < height) { canvas.drawLine(0f, y, width.toFloat(), y, gridPaint); y += step }
|
||||
}
|
||||
super.dispatchDraw(canvas)
|
||||
paint.style = Paint.Style.STROKE
|
||||
guideX?.let { canvas.drawLine(width * it, 0f, width * it, height.toFloat(), paint) }
|
||||
@@ -107,13 +120,26 @@ internal class InputSurfaceEditorView(context: Context) : FrameLayout(context) {
|
||||
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
|
||||
for (x in listOf(l, r)) for (y in listOf(t, b)) canvas.drawCircle(x, y, radius / 3, paint)
|
||||
if (!selectOnly) for (x in listOf(l, r)) for (y in listOf(t, b)) canvas.drawCircle(x, y, radius / 3, paint)
|
||||
}
|
||||
|
||||
private fun contains(e: InputSurfaceElement, x: Float, y: Float) = x / width in e.x..(e.x + e.width) && y / height in e.y..(e.y + e.height)
|
||||
|
||||
private fun clearGuides() { guideX = null; guideY = null; invalidate() }
|
||||
|
||||
private fun onGrid(e: InputSurfaceElement, corner: Int): InputSurfaceElement {
|
||||
val sx = grid
|
||||
val sy = grid * width / height.coerceAtLeast(1)
|
||||
fun round(value: Float, step: Float) = (Math.round(value / step) * step)
|
||||
if (corner == 0) return e.copy(x = round(e.x, sx).coerceIn(0f, 1f - e.width), y = round(e.y, sy).coerceIn(0f, 1f - e.height))
|
||||
fun Float.within(low: Float, high: Float) = coerceIn(minOf(low, high), maxOf(low, high))
|
||||
val right = if (corner and 2 != 0) round(e.x + e.width, sx).within(e.x + .03f, 1f) else e.x + e.width
|
||||
val bottom = if (corner and 8 != 0) round(e.y + e.height, sy).within(e.y + .03f, 1f) else e.y + e.height
|
||||
val left = if (corner and 1 != 0) round(e.x, sx).within(0f, right - .03f) else e.x
|
||||
val top = if (corner and 4 != 0) round(e.y, sy).within(0f, bottom - .03f) else e.y
|
||||
return e.copy(x = left, y = top, width = right - left, height = bottom - top).bounded()
|
||||
}
|
||||
|
||||
override fun onInterceptTouchEvent(event: MotionEvent) = true
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@@ -124,7 +150,7 @@ internal class InputSurfaceEditorView(context: Context) : FrameLayout(context) {
|
||||
clearGuides()
|
||||
downX = event.x; downY = event.y; dragging = false; corner = 0
|
||||
val current = visibleElements.firstOrNull { it.id == selected }?.let { visibleElements.groupOf(it).frame() }
|
||||
if (current != null) {
|
||||
if (current != null && !selectOnly) {
|
||||
val left = width * current.x; val top = height * current.y
|
||||
val right = left + width * current.width; val bottom = top + height * current.height
|
||||
val horizontal = if (abs(downX - left) < radius) 1 else if (abs(downX - right) < radius) 2 else 0
|
||||
@@ -139,7 +165,7 @@ internal class InputSurfaceEditorView(context: Context) : FrameLayout(context) {
|
||||
selected = touched?.id; onSelect(selected)
|
||||
}
|
||||
MotionEvent.ACTION_MOVE -> {
|
||||
if (original.isEmpty()) return true
|
||||
if (original.isEmpty() || selectOnly) return true
|
||||
val e = original.frame()
|
||||
if (!dragging && abs(event.x - downX) + abs(event.y - downY) > ViewConfiguration.get(context).scaledTouchSlop) {
|
||||
dragging = true; onBeginEdit(visibleElements, width, height)
|
||||
@@ -160,7 +186,7 @@ internal class InputSurfaceEditorView(context: Context) : FrameLayout(context) {
|
||||
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
|
||||
val f = aligned?.element ?: next
|
||||
val f = aligned?.element ?: next.takeIf { grid > 0f }?.let { onGrid(it, corner) } ?: next
|
||||
val sx = f.width / e.width; val sy = f.height / e.height
|
||||
onChange(original.map { it.copy(x = f.x + (it.x - e.x) * sx, y = f.y + (it.y - e.y) * sy, width = it.width * sx, height = it.height * sy) })
|
||||
invalidate()
|
||||
|
||||
@@ -137,7 +137,7 @@ class InputSurfaceView(
|
||||
val views = owners.values.distinct()
|
||||
owners.clear()
|
||||
for (view in views) {
|
||||
if (view is HoldButton) { view.cancel(); continue }
|
||||
if (view is HoldButton) { view.cancelTouches(); continue }
|
||||
val cancel = MotionEvent.obtain(event.downTime, event.eventTime, MotionEvent.ACTION_CANCEL, 0f, 0f, 0)
|
||||
try { view.dispatchTouchEvent(cancel) } finally { cancel.recycle() }
|
||||
}
|
||||
@@ -176,10 +176,23 @@ class InputSurfaceView(
|
||||
val now = android.os.SystemClock.uptimeMillis()
|
||||
val cancel = MotionEvent.obtain(now, now, MotionEvent.ACTION_CANCEL, 0f, 0f, 0)
|
||||
try { cancelOwners(cancel) } finally { cancel.recycle() }
|
||||
customCanvas?.let { canvas -> for (i in 0 until canvas.childCount) (canvas.getChildAt(i) as? HoldButton)?.cancel() }
|
||||
forwardedPointers = 0
|
||||
elementSources.forEach { it.release() }
|
||||
}
|
||||
|
||||
/** Presses a button as a finger would, for input from outside the screen; [holder] tells holds apart. */
|
||||
fun hold(elementId: String, holder: Int, held: Boolean, cancelled: Boolean = false): Boolean {
|
||||
val canvas = customCanvas ?: return false
|
||||
for (i in 0 until canvas.childCount) {
|
||||
val button = canvas.getChildAt(i) as? HoldButton ?: continue
|
||||
if ((button.tag as? InputSurfaceElement)?.id != elementId) continue
|
||||
button.press(-1 - holder, held, cancelled)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
override fun onVisibilityChanged(changedView: View, visibility: Int) {
|
||||
super.onVisibilityChanged(changedView, visibility)
|
||||
if (visibility != VISIBLE) releaseInputs()
|
||||
@@ -482,17 +495,22 @@ class InputSurfaceView(
|
||||
|
||||
fun press(pointer: Int, pressed: Boolean, cancelled: Boolean = false) {
|
||||
if (pressed) pointers.add(pointer) else pointers.remove(pointer)
|
||||
set(pointers.isNotEmpty(), cancelled)
|
||||
set(pointers.isNotEmpty(), cancelled, touch = pointer >= 0)
|
||||
}
|
||||
|
||||
fun cancel() { pointers.clear(); set(false, cancelled = true); source?.release() }
|
||||
|
||||
fun cancelTouches() {
|
||||
pointers.removeAll { it >= 0 }
|
||||
if (pointers.isEmpty()) cancel()
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() { cancel(); super.onDetachedFromWindow() }
|
||||
|
||||
private fun set(pressed: Boolean, cancelled: Boolean = false) {
|
||||
private fun set(pressed: Boolean, cancelled: Boolean = false, touch: Boolean = true) {
|
||||
if (down == pressed) return
|
||||
down = pressed
|
||||
if (pressed) feedback(this, HapticFeedbackConstants.VIRTUAL_KEY)
|
||||
if (pressed && touch) feedback(this, HapticFeedbackConstants.VIRTUAL_KEY)
|
||||
if (!pressed && cancelled) source?.cancel() else source?.update(if (pressed) 1f else 0f)
|
||||
invalidate()
|
||||
if (artwork != null && this in artworkDpad) customCanvas?.invalidate()
|
||||
|
||||
@@ -336,17 +336,20 @@ fun ModeSheetRows(s: ModeSettings, a: ModeSettingsActions, tab: String, extras:
|
||||
note = stringResource(R.string.mode_touch_note),
|
||||
onPick = a.onTouch,
|
||||
)
|
||||
if (steam && s.oscMode != null) ChoiceRow(
|
||||
host, "osc", stringResource(R.string.mode_osc), null,
|
||||
listOf(
|
||||
SessionPrefs.OSC_AUTO to stringResource(R.string.common_auto),
|
||||
SessionPrefs.OSC_ALWAYS to stringResource(R.string.common_always),
|
||||
SessionPrefs.OSC_STEAM_TOUCH to stringResource(R.string.osc_steam_touch),
|
||||
SessionPrefs.OSC_STEAM_QAM to stringResource(R.string.mode_osc_qam),
|
||||
SessionPrefs.OSC_NEVER to stringResource(R.string.common_never),
|
||||
), s.oscMode,
|
||||
note = stringResource(R.string.mode_osc_note), onPick = a.onOsc,
|
||||
)
|
||||
if (steam && s.oscMode != null) {
|
||||
val source = touchSource(s.oscMode)
|
||||
ChoiceRow(
|
||||
host, "osc", stringResource(R.string.flow_touch_controls), null,
|
||||
listOf(TOUCH_STEAM to stringResource(R.string.osc_steam_touch), TOUCH_DROIDDECK to stringResource(R.string.flow_touch_droiddeck),
|
||||
TOUCH_OFF to stringResource(R.string.widgets_off)), source,
|
||||
note = stringResource(R.string.mode_osc_note),
|
||||
) { a.onOsc(touchMode(it)) }
|
||||
if (source == TOUCH_DROIDDECK) ChoiceRow(
|
||||
host, "osc-show", stringResource(R.string.flow_show), null,
|
||||
listOf(SessionPrefs.OSC_AUTO to stringResource(R.string.common_auto), SessionPrefs.OSC_ALWAYS to stringResource(R.string.common_always),
|
||||
SessionPrefs.OSC_STEAM_QAM to stringResource(R.string.flow_show_steam_qam)), s.oscMode, onPick = a.onOsc,
|
||||
)
|
||||
}
|
||||
if (steam && s.steamController != null) ChoiceRow(
|
||||
host, "controller", stringResource(R.string.mode_controller), stringResource(R.string.mode_controller_hint),
|
||||
listOf(
|
||||
|
||||
@@ -46,9 +46,7 @@ fun PerformancePage(
|
||||
fsyncFirst: Boolean,
|
||||
gamescopeRealtime: Boolean,
|
||||
gpuClockPin: Boolean,
|
||||
prootNoSeccomp: Boolean,
|
||||
prootFastPath: Boolean,
|
||||
nativeUserland: Boolean,
|
||||
nativeDesktopAvailable: Boolean,
|
||||
desktopAsUser: Boolean,
|
||||
cursorComposite: Boolean,
|
||||
guestHostname: String,
|
||||
@@ -65,9 +63,6 @@ fun PerformancePage(
|
||||
onFsyncFirst: (Boolean) -> Unit,
|
||||
onGamescopeRealtime: (Boolean) -> Unit,
|
||||
onGpuClockPin: (Boolean) -> Unit,
|
||||
onProotNoSeccomp: (Boolean) -> Unit,
|
||||
onProotFastPath: (Boolean) -> Unit,
|
||||
onNativeUserland: (Boolean) -> Unit,
|
||||
onDesktopAsUser: (Boolean) -> Unit,
|
||||
onCursorComposite: (Boolean) -> Unit,
|
||||
onGuestHostname: (String) -> Unit,
|
||||
@@ -152,26 +147,6 @@ fun PerformancePage(
|
||||
stringResource(R.string.perf_fastsync_hint),
|
||||
fastSync, onChange = onFastSync,
|
||||
)
|
||||
ToggleRow(
|
||||
host, "seccomp", stringResource(R.string.perf_seccomp),
|
||||
stringResource(R.string.perf_seccomp_hint),
|
||||
prootNoSeccomp, onChange = onProotNoSeccomp,
|
||||
)
|
||||
ToggleRow(
|
||||
host, "fastpath", stringResource(R.string.perf_fastpath),
|
||||
when {
|
||||
nativeUserland -> stringResource(R.string.perf_fastpath_needs_proot)
|
||||
prootNoSeccomp -> stringResource(R.string.perf_fastpath_needs_seccomp)
|
||||
else -> stringResource(R.string.perf_fastpath_hint)
|
||||
},
|
||||
prootFastPath && !prootNoSeccomp && !nativeUserland, enabled = !prootNoSeccomp && !nativeUserland,
|
||||
onChange = onProotFastPath,
|
||||
)
|
||||
ToggleRow(
|
||||
host, "nativeuserland", stringResource(R.string.perf_native_userland),
|
||||
stringResource(R.string.perf_native_userland_hint),
|
||||
nativeUserland, onChange = onNativeUserland,
|
||||
)
|
||||
ToggleRow(
|
||||
host, "cursorcomposite", stringResource(R.string.perf_cursor_composite),
|
||||
stringResource(R.string.perf_cursor_composite_hint),
|
||||
@@ -198,8 +173,8 @@ fun PerformancePage(
|
||||
}
|
||||
ToggleRow(
|
||||
host, "desktopasuser", stringResource(R.string.perf_desktop_as_user),
|
||||
stringResource(if (nativeUserland) R.string.perf_desktop_as_user_hint else R.string.perf_desktop_as_user_needs_native),
|
||||
desktopAsUser && nativeUserland, enabled = nativeUserland,
|
||||
stringResource(R.string.perf_desktop_as_user_hint),
|
||||
desktopAsUser && nativeDesktopAvailable, enabled = nativeDesktopAvailable,
|
||||
onChange = onDesktopAsUser,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedButton
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.droiddeck.launcher.R
|
||||
|
||||
@Composable
|
||||
internal fun ScalingFilterMenu(
|
||||
mode: Int,
|
||||
options: List<Pair<Int, String>>,
|
||||
hasGameOverride: Boolean,
|
||||
onPick: (Int) -> Unit,
|
||||
onResetGame: () -> Unit,
|
||||
gameName: String? = null,
|
||||
) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
Column(Modifier.fillMaxWidth().padding(start = 10.dp, end = 10.dp, bottom = 8.dp)) {
|
||||
val selectedLabel = options.firstOrNull { it.first == mode }?.second ?: mode.toString()
|
||||
Text(
|
||||
stringResource(
|
||||
if (hasGameOverride) R.string.display_filter_game_profile else R.string.display_filter_default_profile,
|
||||
if (hasGameOverride) gameName.orEmpty() else selectedLabel,
|
||||
selectedLabel,
|
||||
),
|
||||
color = colors.onSurfaceVariant,
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
modifier = Modifier.padding(bottom = 6.dp),
|
||||
)
|
||||
options.forEachIndexed { index, (option, label) ->
|
||||
val selected = mode == option
|
||||
val pick = { onPick(option) }
|
||||
OutlinedButton(
|
||||
onClick = pick,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
.padding(top = if (index == 0) 0.dp else 6.dp)
|
||||
.controllerConfirm(onClick = pick),
|
||||
contentPadding = PaddingValues(horizontal = 12.dp, vertical = 8.dp),
|
||||
colors = ButtonDefaults.outlinedButtonColors(
|
||||
containerColor = if (selected) colors.primary.copy(alpha = 0.16f) else colors.surface,
|
||||
contentColor = if (selected) colors.primary else colors.onSurface,
|
||||
),
|
||||
) { Text(label) }
|
||||
}
|
||||
Text(
|
||||
stringResource(R.string.display_filter_note),
|
||||
color = colors.onSurfaceVariant,
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
modifier = Modifier.padding(top = 6.dp),
|
||||
)
|
||||
OutlinedButton(
|
||||
onClick = onResetGame,
|
||||
modifier = Modifier.fillMaxWidth().padding(top = 6.dp)
|
||||
.controllerConfirm(onClick = onResetGame),
|
||||
contentPadding = PaddingValues(horizontal = 12.dp, vertical = 8.dp),
|
||||
) {
|
||||
Text(stringResource(R.string.comp_game_use_general) + if (hasGameOverride) "" else " ✓")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -415,7 +415,7 @@ class SecondScreenPresentation(
|
||||
}
|
||||
|
||||
private fun panelLayout(mode: SecondScreenMode) = com.droiddeck.launcher.input.InputLibraries.read(context)
|
||||
.panelLayout(SessionState.mode == SessionService.MODE_DESKTOP, mode.panel(context))
|
||||
.panelLayout(SessionState.mode == SessionService.MODE_DESKTOP, mode.panel(context), SessionState.inputGame)
|
||||
|
||||
private fun bar(mode: SecondScreenMode) {
|
||||
val first = barModel(mode) ?: return
|
||||
|
||||
@@ -116,6 +116,10 @@ import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.droiddeck.launcher.HomeApp
|
||||
import com.droiddeck.launcher.input.AirTrigger
|
||||
import com.droiddeck.launcher.input.AirTriggerAction
|
||||
import com.droiddeck.launcher.input.AirTriggerLed
|
||||
import com.droiddeck.launcher.input.RapidFireRate
|
||||
import com.droiddeck.launcher.input.ControllerPrefs
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.animateColorAsState
|
||||
@@ -173,6 +177,7 @@ import com.droiddeck.launcher.gpu.ScreenEffectLooks
|
||||
import com.droiddeck.launcher.gpu.Cardboard
|
||||
import com.droiddeck.launcher.gpu.SteamVr
|
||||
import com.droiddeck.launcher.gpu.ScreenEffects
|
||||
import com.droiddeck.launcher.session.FullscreenMode
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import com.droiddeck.launcher.session.ComponentsManager
|
||||
import com.droiddeck.launcher.input.PC_KEY_GROUP_IDS
|
||||
@@ -238,6 +243,12 @@ private class DrawerFocus {
|
||||
fun forget(page: SessionDrawerPage) { last.remove(page) }
|
||||
}
|
||||
|
||||
data class AirTriggerMenu(
|
||||
val enabled: Boolean, val selected: Map<AirTrigger, String>, val buttons: List<Pair<String, String>>,
|
||||
val vibration: Boolean = false, val screenLight: Boolean = false, val led: AirTriggerLed = AirTriggerLed.STEADY,
|
||||
val actions: Map<AirTrigger, AirTriggerAction> = emptyMap(), val rates: Map<AirTrigger, RapidFireRate> = emptyMap(),
|
||||
)
|
||||
|
||||
class DrawerActions(
|
||||
val steam: Boolean,
|
||||
val desktop: Boolean,
|
||||
@@ -338,11 +349,18 @@ class DrawerActions(
|
||||
val achievementsTitle: String? = null,
|
||||
val achievementsProgress: Pair<Int, Int>? = null,
|
||||
val onOsc: (String) -> Unit,
|
||||
val onEditSteamTouch: (() -> Unit)? = null,
|
||||
val controller: com.droiddeck.launcher.input.ControllerPrefs.Settings? = null,
|
||||
val onControllerSize: (Int) -> Unit = {},
|
||||
val onControllerOpacity: (Int) -> Unit = {},
|
||||
val onRumble: (Boolean) -> Unit = {},
|
||||
val airTriggers: AirTriggerMenu? = null,
|
||||
val onAirTriggers: (Boolean) -> Unit = {},
|
||||
val onAirTriggerButton: (AirTrigger, String) -> Unit = { _, _ -> },
|
||||
val onAirTriggerAction: (AirTrigger, AirTriggerAction) -> Unit = { _, _ -> },
|
||||
val onAirTriggerRate: (AirTrigger, RapidFireRate) -> Unit = { _, _ -> },
|
||||
val onAirTriggerVibration: (Boolean) -> Unit = {},
|
||||
val onAirTriggerScreenLight: (Boolean) -> Unit = {},
|
||||
val onAirTriggerLed: (AirTriggerLed) -> Unit = {},
|
||||
val onSuspendPolicy: (String) -> Unit,
|
||||
val onSteamDownloadsInBackground: (Boolean) -> Unit = {},
|
||||
val onBackActionsInverted: (Boolean) -> Unit,
|
||||
@@ -357,6 +375,10 @@ class DrawerActions(
|
||||
val onTouch: (String) -> Unit,
|
||||
val onInputSettings: () -> Unit = {},
|
||||
val onInputSelection: (com.droiddeck.launcher.input.InputRole?) -> Unit = {},
|
||||
/** The game in front, as its key and name, when its controls can differ from the profile's. */
|
||||
val inputGame: Pair<String, String>? = null,
|
||||
val onEditButtons: () -> Unit = {},
|
||||
val onEditLayout: (() -> Unit)? = null,
|
||||
val onGestureSettings: () -> Unit = {},
|
||||
val touchActive: String = "",
|
||||
val directHoldBehavior: String = MOUSE_BEHAVIOR_CLICK,
|
||||
@@ -388,6 +410,8 @@ class DrawerActions(
|
||||
val paused: Boolean = false,
|
||||
val orientation: Int = android.content.pm.ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE,
|
||||
val onOrientation: (Int) -> Unit = {},
|
||||
val fullscreenMode: FullscreenMode = FullscreenMode.ALWAYS,
|
||||
val onFullscreenMode: (FullscreenMode) -> Unit = {},
|
||||
val onResume: () -> Unit = {},
|
||||
val onPipAutoEnter: (Boolean) -> Unit = {},
|
||||
val unfoldedControls: Boolean? = null,
|
||||
@@ -456,6 +480,7 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont
|
||||
remember { DrawerSectionState.load(drawerContext) }
|
||||
var appToChooseDisplay by remember { mutableStateOf<HomeApp.LaunchableApp?>(null) }
|
||||
var confirmStop by remember { mutableStateOf(false) }
|
||||
var airTriggersShown by remember { mutableStateOf(false) }
|
||||
var sheetCoords by remember { mutableStateOf<LayoutCoordinates?>(null) }
|
||||
val widthContext = LocalContext.current
|
||||
var savedWidth by remember { mutableStateOf(SessionPrefs.drawerWidthDp(widthContext)) }
|
||||
@@ -467,15 +492,17 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont
|
||||
val focusManager = LocalFocusManager.current
|
||||
// A page kept inside More is one step deeper than the strip: back returns to More before it closes the menu.
|
||||
val insideMore = page in pages.inMore()
|
||||
val airPanel = airTriggersShown && page == SessionDrawerPage.CONTROLLER && a.airTriggers != null
|
||||
BackHandler(enabled = open) {
|
||||
when {
|
||||
host.open != null -> host.open = null
|
||||
airPanel -> airTriggersShown = false
|
||||
insideMore -> onPageChange(SessionDrawerPage.MORE)
|
||||
else -> a.onClose()
|
||||
}
|
||||
}
|
||||
BackHandler(enabled = open && confirmStop) { confirmStop = false }
|
||||
val layerOpen = open && (host.open != null || appToChooseDisplay != null || confirmStop || insideMore)
|
||||
val layerOpen = open && (host.open != null || appToChooseDisplay != null || confirmStop || insideMore || airPanel)
|
||||
LaunchedEffect(layerOpen) { onLayerChange(layerOpen) }
|
||||
var seenBackRequest by remember { mutableStateOf(backRequest) }
|
||||
LaunchedEffect(backRequest) {
|
||||
@@ -485,10 +512,23 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont
|
||||
confirmStop -> confirmStop = false
|
||||
appToChooseDisplay != null -> appToChooseDisplay = null
|
||||
host.open != null -> host.open = null
|
||||
airPanel -> airTriggersShown = false
|
||||
insideMore -> onPageChange(SessionDrawerPage.MORE)
|
||||
}
|
||||
}
|
||||
LaunchedEffect(page) { host.open = null; appToChooseDisplay = null; managing = false }
|
||||
LaunchedEffect(page) { host.open = null; appToChooseDisplay = null; managing = false; airTriggersShown = false }
|
||||
var airPanelFocused by remember { mutableStateOf(airPanel) }
|
||||
LaunchedEffect(airPanel) {
|
||||
val moved = airPanel != airPanelFocused
|
||||
airPanelFocused = airPanel
|
||||
if (!moved || !open || !controllerActive) return@LaunchedEffect
|
||||
val target = if (airPanel) "air-triggers-toggle" else "air-triggers"
|
||||
repeat(24) {
|
||||
androidx.compose.runtime.withFrameNanos { }
|
||||
focus.request(target)
|
||||
if (focus.focused == target) return@LaunchedEffect
|
||||
}
|
||||
}
|
||||
LaunchedEffect(host.open) {
|
||||
if (host.open == "frame-generation") repeat(24) {
|
||||
androidx.compose.runtime.withFrameNanos { }
|
||||
@@ -574,6 +614,7 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont
|
||||
.controllerBack {
|
||||
when {
|
||||
host.open != null -> host.open = null
|
||||
airPanel -> airTriggersShown = false
|
||||
managing -> DrawerPages.heldFrom?.let { held ->
|
||||
DrawerPages.rearrange(drawerContext, held)
|
||||
releaseSignal++
|
||||
@@ -650,7 +691,9 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont
|
||||
host.open = null; onPageChange(pages.strip().step(pages.tabFor(page), 1))
|
||||
}
|
||||
}
|
||||
if (insideMore && !managing) DrawerMoreBack(stringResource(page.title), focus.track(page, "more-back")) { host.open = null; onPageChange(SessionDrawerPage.MORE) }
|
||||
if (insideMore && !managing && !airPanel) DrawerMoreBack(stringResource(page.title), focus.track(page, "more-back")) { host.open = null; onPageChange(SessionDrawerPage.MORE) }
|
||||
if (airPanel && !managing) DrawerMoreBack(stringResource(R.string.air_triggers_title), focus.track(page, "air-triggers-back"),
|
||||
parent = stringResource(page.title)) { host.open = null; airTriggersShown = false }
|
||||
if (managing) ManageDrawerPages(
|
||||
offeredDrawerPages(a.achievementsGame != null),
|
||||
Modifier.weight(1f).fillMaxWidth().padding(top = 8.dp, start = 14.dp, end = 14.dp),
|
||||
@@ -671,7 +714,11 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont
|
||||
CompositionLocalProvider(LocalChipMinWidth provides 96.dp, LocalCompactSettings provides true, LocalDrawerSections provides sections) {
|
||||
DrawerColumns(two = sheetWidth >= DRAWER_TWO_COLUMN_WIDTH && page.inColumns) {
|
||||
when (page) {
|
||||
SessionDrawerPage.CONTROLLER -> DrawerControllerPage(host, a, a.controllerConnected || controllerActive, track)
|
||||
SessionDrawerPage.CONTROLLER -> {
|
||||
val airTriggers = a.airTriggers
|
||||
if (airPanel && airTriggers != null) AirTriggersPanel(host, airTriggers, a, track)
|
||||
else DrawerControllerPage(host, a, a.controllerConnected || controllerActive, track) { host.open = null; airTriggersShown = true }
|
||||
}
|
||||
SessionDrawerPage.HUD -> DrawerPerformancePage(host, a, track)
|
||||
SessionDrawerPage.FRAMEGEN -> DrawerFrameGenPage(host, a, track)
|
||||
SessionDrawerPage.DISPLAY -> DrawerDisplayPage(host, a, track)
|
||||
@@ -731,14 +778,12 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun DrawerControllerPage(host: MenuHost, a: DrawerActions, padConnected: Boolean, track: (String) -> Modifier) {
|
||||
private fun DrawerControllerPage(host: MenuHost, a: DrawerActions, padConnected: Boolean, track: (String) -> Modifier, onAirTriggers: () -> Unit) {
|
||||
val on = stringResource(R.string.widgets_on)
|
||||
val off = stringResource(R.string.widgets_off)
|
||||
val padTag = if (padConnected) stringResource(R.string.drawer_tag_controller) else null
|
||||
val noPadTag = if (padConnected) null else stringResource(R.string.drawer_tag_no_controller)
|
||||
SettingsGroup(stringResource(R.string.drawer_section_input), key = "controller-input") {
|
||||
InputQuickSettings(host, desktop = a.desktop, onChanged = a.onInputSelection, onEdit = a.onInputSettings, track = track)
|
||||
}
|
||||
DrawerControlsGroup(host, a, track)
|
||||
val c = a.controller
|
||||
val padTypes = listOf(SessionPrefs.CONTROLLER_DECK to stringResource(R.string.mode_controller_deck),
|
||||
SessionPrefs.CONTROLLER_STEAM to stringResource(R.string.mode_controller_steam),
|
||||
@@ -746,9 +791,12 @@ private fun DrawerControllerPage(host: MenuHost, a: DrawerActions, padConnected:
|
||||
SessionPrefs.CONTROLLER_DUALSENSE to stringResource(R.string.mode_controller_dualsense),
|
||||
SessionPrefs.CONTROLLER_XBOX360 to stringResource(R.string.mode_controller_x360))
|
||||
val rumbleLabel = stringResource(R.string.ctrl_rumble)
|
||||
if (a.padType != null || c != null) SettingsGroup(
|
||||
val airTriggers = a.airTriggers
|
||||
val airTriggersLabel = stringResource(R.string.air_triggers_title)
|
||||
if (a.padType != null || c != null || airTriggers != null) SettingsGroup(
|
||||
stringResource(R.string.input_device_settings), key = "controller-pad", tag = padTag,
|
||||
detail = summary(a.padType?.let { padTypes.labelOf(it) }, c?.let { "$rumbleLabel ${if (it.rumble) on else off}" }),
|
||||
detail = summary(a.padType?.let { padTypes.labelOf(it) }, c?.let { "$rumbleLabel ${if (it.rumble) on else off}" },
|
||||
airTriggers?.let { "$airTriggersLabel ${if (it.enabled) on else off}" }),
|
||||
) {
|
||||
a.padType?.let { type ->
|
||||
ChoiceRow(host, "pad-type", stringResource(R.string.input_virtual_controller), stringResource(R.string.input_virtual_controller_hint),
|
||||
@@ -757,15 +805,26 @@ private fun DrawerControllerPage(host: MenuHost, a: DrawerActions, padConnected:
|
||||
c?.let {
|
||||
ToggleRow(host, "rumble", rumbleLabel, null, it.rumble, chipModifier = track("rumble"), onChange = a.onRumble)
|
||||
}
|
||||
airTriggers?.let {
|
||||
ActionRow(airTriggersLabel, if (it.enabled) on else off, stringResource(R.string.air_triggers_open), onAirTriggers,
|
||||
modifier = track("air-triggers"))
|
||||
}
|
||||
}
|
||||
val oscChoices = if (a.steam) listOf(SessionPrefs.OSC_AUTO to stringResource(R.string.common_auto), SessionPrefs.OSC_ALWAYS to stringResource(R.string.common_always), SessionPrefs.OSC_STEAM_TOUCH to stringResource(R.string.osc_steam_touch), SessionPrefs.OSC_STEAM_QAM to stringResource(R.string.mode_osc_qam), SessionPrefs.OSC_NEVER to stringResource(R.string.common_never))
|
||||
else listOf(SessionPrefs.OSC_AUTO to stringResource(R.string.common_auto), SessionPrefs.OSC_ALWAYS to stringResource(R.string.common_always), SessionPrefs.OSC_NEVER to stringResource(R.string.common_never))
|
||||
val oscValue = if (!a.steam && a.oscMode == SessionPrefs.OSC_STEAM_TOUCH) SessionPrefs.OSC_AUTO else a.oscMode
|
||||
SettingsGroup(stringResource(R.string.input_screen_visibility), key = "controller-osc", tag = noPadTag,
|
||||
detail = summary(oscChoices.labelOf(oscValue), c?.let { "${it.size}%" })) {
|
||||
ChoiceRow(host, "osc", stringResource(R.string.mode_osc), null, oscChoices, oscValue, chipModifier = track("osc"), onPick = a.onOsc)
|
||||
val source = touchSource(oscValue)
|
||||
val sources = listOfNotNull(if (a.steam) TOUCH_STEAM to stringResource(R.string.osc_steam_touch) else null,
|
||||
TOUCH_DROIDDECK to stringResource(R.string.flow_touch_droiddeck), TOUCH_OFF to stringResource(R.string.widgets_off))
|
||||
val shows = listOfNotNull(SessionPrefs.OSC_AUTO to stringResource(R.string.common_auto), SessionPrefs.OSC_ALWAYS to stringResource(R.string.common_always),
|
||||
if (a.steam) SessionPrefs.OSC_STEAM_QAM to stringResource(R.string.flow_show_steam_qam) else null)
|
||||
SettingsGroup(stringResource(R.string.flow_touch_controls), key = "controller-osc", tag = noPadTag,
|
||||
detail = summary(sources.labelOf(source), if (source == TOUCH_DROIDDECK) shows.labelOf(oscValue) else null, c?.let { "${it.size}%" }, c?.let { "${it.onScreenOpacity}%" })) {
|
||||
ChoiceRow(host, "osc", stringResource(R.string.flow_touch_type), stringResource(R.string.flow_scope_every_game), sources, source, chipModifier = track("osc")) { picked ->
|
||||
if (picked != source) a.onOsc(touchMode(picked))
|
||||
}
|
||||
if (source == TOUCH_DROIDDECK) ChoiceRow(host, "osc-show", stringResource(R.string.flow_show), stringResource(R.string.mode_osc_note), shows, oscValue,
|
||||
chipModifier = track("osc-show"), onPick = a.onOsc)
|
||||
c?.let {
|
||||
SliderRow(stringResource(R.string.ctrl_size), null, it.size, 80..125, step = 5,
|
||||
SliderRow(stringResource(R.string.flow_size_overall), null, it.size, 80..125, step = 5,
|
||||
format = { v -> "$v%" }, modifier = track("controller-size"), onChange = a.onControllerSize)
|
||||
SliderRow(stringResource(R.string.ctrl_opacity), null, it.onScreenOpacity, ControllerPrefs.onScreenOpacityRange, step = 5,
|
||||
format = { v -> "$v%" }, modifier = track("controller-opacity").testTag("controller-opacity"),
|
||||
@@ -786,10 +845,6 @@ private fun DrawerControllerPage(host: MenuHost, a: DrawerActions, padConnected:
|
||||
ToggleRow(host, key, stringResource(quickButtonLabel(button)), null, shown,
|
||||
chipModifier = track(key)) { a.onQuickButton(button, it) }
|
||||
}
|
||||
a.onEditSteamTouch?.let { edit ->
|
||||
ActionRow(stringResource(R.string.osc_steam_layout), stringResource(R.string.osc_steam_layout_hint), stringResource(R.string.ctrl_edit), edit,
|
||||
modifier = track("steam-touch-layout"))
|
||||
}
|
||||
if (a.steam && a.unfoldedControls != null) ToggleRow(host, "unfolded-controls", stringResource(R.string.unfolded_controls),
|
||||
stringResource(R.string.unfolded_controls_hint), a.unfoldedControls,
|
||||
chipModifier = track("unfolded-controls"), onChange = a.onUnfoldedControls)
|
||||
@@ -805,8 +860,8 @@ private fun DrawerControllerPage(host: MenuHost, a: DrawerActions, padConnected:
|
||||
onChange = a.onUnfoldedControlsWithController)
|
||||
}
|
||||
val touchChoices = listOf(SessionPrefs.TOUCH_AUTO to stringResource(R.string.drawer_touch_auto, a.touchAuto), SessionPrefs.TOUCH_PAD to stringResource(R.string.mode_touch_touchpad), SessionPrefs.TOUCH_DIRECT to stringResource(R.string.mode_touch_direct), SessionPrefs.TOUCH_GESTURES to stringResource(R.string.mode_touch_gestures), SessionPrefs.TOUCH_OFF to stringResource(R.string.widgets_off))
|
||||
SettingsGroup(stringResource(R.string.input_touchscreen), key = "controller-touch", tag = noPadTag, detail = touchChoices.labelOf(a.touchMode)) {
|
||||
ChoiceRow(host, "touch", stringResource(R.string.input_touchscreen), stringResource(R.string.input_touchscreen_hint),
|
||||
SettingsGroup(stringResource(R.string.flow_mouse_touch), key = "controller-touch", tag = noPadTag, detail = touchChoices.labelOf(a.touchMode)) {
|
||||
ChoiceRow(host, "touch", stringResource(R.string.input_touchscreen), stringResource(R.string.input_touchscreen_hint) + " " + stringResource(R.string.flow_scope_every_game),
|
||||
touchChoices, a.touchMode, chipModifier = track("touch"), onPick = a.onTouch)
|
||||
if (a.touchActive == SessionPrefs.TOUCH_PAD) RelativeMouseRow(host, a, track("relative-mouse"))
|
||||
if (a.touchActive == SessionPrefs.TOUCH_DIRECT)
|
||||
@@ -816,20 +871,17 @@ private fun DrawerControllerPage(host: MenuHost, a: DrawerActions, padConnected:
|
||||
when (a.touchActive) {
|
||||
SessionPrefs.TOUCH_GESTURES -> ActionRow(stringResource(R.string.gesture_settings), null,
|
||||
stringResource(R.string.ctrl_edit), a.onGestureSettings, modifier = track("gesture-settings"))
|
||||
SessionPrefs.TOUCH_DIRECT -> ChoiceRow(host, "long-press", stringResource(R.string.input_touch_hold), stringResource(R.string.input_touch_hold_hint),
|
||||
SessionPrefs.TOUCH_DIRECT -> ChoiceRow(host, "long-press", stringResource(R.string.input_touch_hold), perGame(a, stringResource(R.string.input_touch_hold_hint)),
|
||||
listOf(MOUSE_BEHAVIOR_NONE to stringResource(R.string.gesture_hold_left),
|
||||
MOUSE_BEHAVIOR_CLICK to stringResource(R.string.gesture_right_click),
|
||||
MOUSE_BEHAVIOR_HOLD to stringResource(R.string.gesture_hold_right)),
|
||||
a.directHoldBehavior, chipModifier = track("long-press"), onPick = a.onDirectHoldBehavior)
|
||||
}
|
||||
}
|
||||
a.pen?.let { PenSettingsGroup(host, it, track = track, onPick = a.onPen) }
|
||||
SettingsGroup(stringResource(R.string.drawer_section_mouse), key = "controller-mouse",
|
||||
detail = "${stringResource(R.string.drawer_evdev_mouse)} ${if (a.evdevMouse) on else off}") {
|
||||
ToggleRow(host, "evdev-mouse", stringResource(R.string.drawer_evdev_mouse), null, a.evdevMouse,
|
||||
chipModifier = track("evdev-mouse"), onChange = a.onEvdevMouse)
|
||||
if (a.touchActive != SessionPrefs.TOUCH_PAD) RelativeMouseRow(host, a, track("relative-mouse"))
|
||||
}
|
||||
a.pen?.let { PenSettingsGroup(host, it, track = track, onPick = a.onPen) }
|
||||
val backOrders = listOf(false to stringResource(SessionPrefs.BACK_MENU_THEN_QAM), true to stringResource(SessionPrefs.BACK_QAM_THEN_MENU))
|
||||
SettingsGroup(stringResource(R.string.shortcuts_title), key = "controller-shortcuts",
|
||||
detail = if (a.steam) summary(backOrders.labelOf(a.backActionsInverted), stringResource(R.string.back_tap_ms, a.backDoubleTapMs)) else null) {
|
||||
@@ -961,6 +1013,10 @@ private fun DrawerDisplayPage(host: MenuHost, a: DrawerActions, track: (String)
|
||||
if (a.gameZoomAvailable) GameZoomRow(a.gameZoom, track, a.onGameZoom)
|
||||
ChoiceRow(host, "orientation", stringResource(R.string.setup_session_orientation), null,
|
||||
orientations, a.orientation, chipModifier = track("orientation"), onPick = a.onOrientation)
|
||||
ChoiceRow(host, "session-fullscreen", stringResource(R.string.setup_session_fullscreen),
|
||||
stringResource(R.string.setup_fullscreen_on),
|
||||
FullscreenMode.entries.map { it to stringResource(it.label) }, a.fullscreenMode,
|
||||
chipModifier = track("session-fullscreen"), onPick = a.onFullscreenMode)
|
||||
if (a.steam) PicturePositionRow(host, a.picturePosition, track("picture-position"), onPick = a.onPicturePosition)
|
||||
}
|
||||
val filters = SessionPrefs.upscalerChoices(LocalContext.current)
|
||||
@@ -1160,6 +1216,23 @@ private fun <T> List<Pair<T, String>>.labelOf(value: T): String? = firstOrNull {
|
||||
|
||||
private fun summary(vararg parts: String?): String = parts.filterNot { it.isNullOrEmpty() }.joinToString(" · ")
|
||||
|
||||
internal const val TOUCH_STEAM = "steam"
|
||||
internal const val TOUCH_DROIDDECK = "droiddeck"
|
||||
internal const val TOUCH_OFF = "off"
|
||||
|
||||
/** Which touch controls a stored mode draws: Steam's, DroidDeck's, or none. How DroidDeck's show is the rest of the mode. */
|
||||
internal fun touchSource(mode: String) = when (mode) {
|
||||
SessionPrefs.OSC_STEAM_TOUCH -> TOUCH_STEAM
|
||||
SessionPrefs.OSC_NEVER -> TOUCH_OFF
|
||||
else -> TOUCH_DROIDDECK
|
||||
}
|
||||
|
||||
internal fun touchMode(source: String) = when (source) {
|
||||
TOUCH_STEAM -> SessionPrefs.OSC_STEAM_TOUCH
|
||||
TOUCH_OFF -> SessionPrefs.OSC_NEVER
|
||||
else -> SessionPrefs.OSC_AUTO
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun DrawerActionButton(text: String, icon: androidx.compose.ui.graphics.vector.ImageVector, modifier: Modifier = Modifier, onClick: () -> Unit) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
@@ -1322,15 +1395,15 @@ private fun DrawerPageTabs(page: SessionDrawerPage, pages: List<SessionDrawerPag
|
||||
|
||||
private const val LOOK_CUSTOM = "custom"
|
||||
|
||||
/** The row above a page kept inside More that goes back to the More list. */
|
||||
/** The row above a page kept inside More, or a panel inside a page, that goes back to where it was opened from. */
|
||||
@Composable
|
||||
private fun DrawerMoreBack(title: String, modifier: Modifier, onBack: () -> Unit) {
|
||||
private fun DrawerMoreBack(title: String, modifier: Modifier, parent: String = stringResource(R.string.drawer_page_more), onBack: () -> Unit) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
val source = remember { MutableInteractionSource() }
|
||||
val hot = source.collectIsFocusedAsState().value || source.collectIsHoveredAsState().value
|
||||
val shape = RoundedCornerShape(12.dp)
|
||||
val label = stringResource(R.string.drawer_more_back, stringResource(R.string.drawer_page_more))
|
||||
val label = stringResource(R.string.drawer_more_back, parent)
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||
modifier = modifier.padding(top = 8.dp, start = 14.dp, end = 14.dp).fillMaxWidth().heightIn(min = 44.dp).clip(shape)
|
||||
@@ -1344,12 +1417,105 @@ private fun DrawerMoreBack(title: String, modifier: Modifier, onBack: () -> Unit
|
||||
.padding(horizontal = 8.dp),
|
||||
) {
|
||||
Icon(Icons.AutoMirrored.Outlined.ArrowBack, null, tint = colors.onSurfaceVariant, modifier = Modifier.size(22.dp))
|
||||
Text(stringResource(R.string.drawer_page_more), fontSize = 13.sp, color = colors.onSurfaceVariant)
|
||||
Text(parent, fontSize = 13.sp, color = colors.onSurfaceVariant)
|
||||
Text("·", fontSize = 13.sp, color = colors.onSurfaceVariant)
|
||||
Text(title, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground, maxLines = 1)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun AirTriggersPanel(host: MenuHost, t: AirTriggerMenu, a: DrawerActions, track: (String) -> Modifier) {
|
||||
CompositionLocalProvider(LocalDrawerSections provides null) { SettingsGroup(stringResource(R.string.air_triggers_title)) {
|
||||
ToggleRow(host, "air-triggers-toggle", stringResource(R.string.air_triggers_use), stringResource(R.string.air_triggers_use_hint), t.enabled,
|
||||
chipModifier = track("air-triggers-toggle"), onChange = a.onAirTriggers)
|
||||
ToggleRow(host, "air-triggers-vibration", stringResource(R.string.air_triggers_vibration), stringResource(R.string.air_triggers_vibration_hint),
|
||||
t.vibration, enabled = t.enabled, chipModifier = track("air-triggers-vibration"), onChange = a.onAirTriggerVibration)
|
||||
ToggleRow(host, "air-triggers-screen-light", stringResource(R.string.air_triggers_screen_light), stringResource(R.string.air_triggers_screen_light_hint),
|
||||
t.screenLight, enabled = t.enabled, chipModifier = track("air-triggers-screen-light"), onChange = a.onAirTriggerScreenLight)
|
||||
val leds = listOf(AirTriggerLed.OFF to R.string.air_triggers_led_off, AirTriggerLed.STEADY to R.string.air_triggers_led_steady,
|
||||
AirTriggerLed.PULSE to R.string.air_triggers_led_pulse).map { (led, text) -> led to stringResource(text) }
|
||||
ChoiceRow(host, "air-triggers-led", stringResource(R.string.air_triggers_led), null, leds, t.led,
|
||||
enabled = t.enabled, chipModifier = track("air-triggers-led"), onPick = a.onAirTriggerLed)
|
||||
for (trigger in AirTrigger.entries) {
|
||||
val key = "air-trigger-${trigger.name.lowercase()}"
|
||||
val left = trigger == AirTrigger.LEFT
|
||||
val label = stringResource(if (left) R.string.air_trigger_left else R.string.air_trigger_right)
|
||||
ChoiceRow(host, key, label, stringResource(R.string.air_trigger_button_hint), t.buttons, t.selected.getValue(trigger),
|
||||
enabled = t.enabled, chipModifier = track(key)) { a.onAirTriggerButton(trigger, it) }
|
||||
AirTriggerActionRow(host, "$key-action", stringResource(if (left) R.string.air_trigger_left_action else R.string.air_trigger_right_action),
|
||||
t.actions[trigger] ?: AirTriggerAction.TAP, t.rates[trigger] ?: RapidFireRate.NORMAL, t.enabled, track("$key-action"),
|
||||
onAction = { a.onAirTriggerAction(trigger, it) }, onRate = { a.onAirTriggerRate(trigger, it) })
|
||||
}
|
||||
} }
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun AirTriggerActionRow(
|
||||
host: MenuHost, key: String, label: String, action: AirTriggerAction, rate: RapidFireRate, enabled: Boolean, chipModifier: Modifier,
|
||||
onAction: (AirTriggerAction) -> Unit, onRate: (RapidFireRate) -> Unit,
|
||||
) {
|
||||
val open = host.open == key
|
||||
var rateOpen by remember { mutableStateOf(false) }
|
||||
LaunchedEffect(open) { if (!open) rateOpen = false }
|
||||
val actions = listOf(AirTriggerAction.TAP to R.string.air_trigger_action_tap, AirTriggerAction.LATCH to R.string.air_trigger_action_hold,
|
||||
AirTriggerAction.RAPID to R.string.air_trigger_action_rapid).map { (value, text) -> value to stringResource(text) }
|
||||
val rates = listOf(R.string.air_trigger_rate_low, R.string.air_trigger_rate_normal, R.string.air_trigger_rate_high).map { stringResource(it) }
|
||||
val rapidLabel = actions.last().second
|
||||
val frequency = stringResource(R.string.air_trigger_rapid_frequency)
|
||||
SettingsRow(label, null, highlighted = open) { Box {
|
||||
ValueChip(actions.first { it.first == action }.second, open, enabled, modifier = chipModifier.testTag("setting-$key")) {
|
||||
host.open = if (open) null else key
|
||||
}
|
||||
AnchoredMenu(open, onDismiss = { if (host.open == key) host.open = null }, title = if (rateOpen) null else label) { first ->
|
||||
val arrowFocus = remember { FocusRequester() }
|
||||
val keyboard = LocalInputModeManager.current.inputMode == InputMode.Keyboard
|
||||
var shown by remember { mutableStateOf(rateOpen) }
|
||||
LaunchedEffect(rateOpen) {
|
||||
if (shown == rateOpen) return@LaunchedEffect
|
||||
shown = rateOpen
|
||||
withFrameNanos { }
|
||||
if (keyboard) runCatching { (if (rateOpen) first else arrowFocus).requestFocus() }
|
||||
}
|
||||
if (rateOpen) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(start = 10.dp)) {
|
||||
Text(rapidLabel.uppercase(), fontSize = 12.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 1.5.sp,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.weight(1f))
|
||||
MenuGlyphButton("✕", stringResource(R.string.common_close), Modifier.testTag("$key-rate-close")) { rateOpen = false }
|
||||
}
|
||||
ValueSlider(rate.ordinal, 0..RapidFireRate.entries.lastIndex, 1, true, frequency, { rates[it] },
|
||||
modifier = Modifier.focusRequester(first).testTag("$key-rate")) { if (it != rate.ordinal) onRate(RapidFireRate.entries[it]) }
|
||||
} else actions.forEachIndexed { index, (value, text) ->
|
||||
val pick = { onAction(value); host.open = null }
|
||||
if (value != AirTriggerAction.RAPID) MenuItem(text, checked = value == action, focusRequester = if (index == 0) first else null, onClick = pick)
|
||||
else Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
MenuItem(text, checked = value == action, modifier = Modifier.weight(1f), onClick = pick)
|
||||
MenuGlyphButton("›", stringResource(R.string.air_trigger_rapid_settings),
|
||||
Modifier.focusRequester(arrowFocus).testTag("$key-rate-open")) { rateOpen = true }
|
||||
}
|
||||
}
|
||||
}
|
||||
} }
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun MenuGlyphButton(glyph: String, description: String, modifier: Modifier = Modifier, onClick: () -> Unit) {
|
||||
val pal = LocalPalette.current
|
||||
val src = remember { MutableInteractionSource() }
|
||||
val hot = src.collectIsFocusedAsState().value || src.collectIsHoveredAsState().value
|
||||
val shape = RoundedCornerShape(8.dp)
|
||||
Box(
|
||||
contentAlignment = Alignment.Center,
|
||||
modifier = modifier.size(40.dp).clip(shape)
|
||||
.background(if (hot) Color.White.copy(alpha = 0.07f) else Color.Transparent)
|
||||
.glideBorder(hot, shape, pal.signal)
|
||||
.hoverable(src).clickable(interactionSource = src, indication = LocalIndication.current, role = Role.Button, onClick = onClick)
|
||||
.controllerConfirm(onClick = onClick)
|
||||
.semantics { contentDescription = description },
|
||||
) {
|
||||
Text(glyph, fontSize = 18.sp, fontWeight = FontWeight.SemiBold, color = MaterialTheme.colorScheme.onBackground)
|
||||
}
|
||||
}
|
||||
|
||||
/** The pages kept inside More, and the way into arranging which pages sit on the strip and which here. */
|
||||
@Composable
|
||||
private fun DrawerMorePage(host: MenuHost, pages: List<SessionDrawerPage>, a: DrawerActions, onOpen: (SessionDrawerPage) -> Unit, onEdit: () -> Unit, track: (String) -> Modifier) {
|
||||
@@ -1697,9 +1863,14 @@ private fun SecondScreenGroup(host: MenuHost, a: DrawerActions, track: (String)
|
||||
}
|
||||
}
|
||||
|
||||
/** Touch gestures are saved per game while one runs, unlike the rest of the touch settings beside them. */
|
||||
@Composable
|
||||
private fun perGame(a: DrawerActions, hint: String?): String? =
|
||||
if (a.inputGame == null) hint else listOfNotNull(hint, stringResource(R.string.flow_scope_this_game)).joinToString(" ")
|
||||
|
||||
@Composable
|
||||
private fun RelativeMouseRow(host: MenuHost, a: DrawerActions, modifier: Modifier) {
|
||||
ChoiceRow(host, "relative-mouse", stringResource(R.string.drawer_relative_mouse), null,
|
||||
ChoiceRow(host, "relative-mouse", stringResource(R.string.drawer_relative_mouse), perGame(a, null),
|
||||
listOf(com.droiddeck.launcher.input.TouchGestureConfig.RELATIVE_MOUSE_AUTO to stringResource(R.string.drawer_relative_mouse_auto),
|
||||
com.droiddeck.launcher.input.TouchGestureConfig.RELATIVE_MOUSE_ON to stringResource(R.string.drawer_relative_mouse_on),
|
||||
com.droiddeck.launcher.input.TouchGestureConfig.RELATIVE_MOUSE_OFF to stringResource(R.string.drawer_relative_mouse_off)),
|
||||
|
||||
@@ -85,9 +85,6 @@ internal object SettingsIndex {
|
||||
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.PERFORMANCE, R.string.perf_desktop_as_user, "root", "user", "sudo", "fakeroot"),
|
||||
@@ -116,7 +113,8 @@ internal object SettingsIndex {
|
||||
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_launcher_fullscreen, "status bar", "navigation bar", "portrait"),
|
||||
s(SettingsSection.LAUNCHER, R.string.setup_session_fullscreen, "status bar", "navigation bar", "portrait"),
|
||||
s(SettingsSection.LAUNCHER, R.string.setup_page_swipe, "gesture"),
|
||||
s(SettingsSection.LAUNCHER, R.string.setup_controller_haptics, "vibration", "rumble"),
|
||||
s(SettingsSection.LAUNCHER, R.string.setup_dual_screen_launcher, "thor", "second screen", "bottom screen"),
|
||||
@@ -130,7 +128,8 @@ internal object SettingsIndex {
|
||||
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"),
|
||||
s(SettingsSection.DEVELOPER, R.string.dev_tools_show, "agent", "ai", "claude", "codex"),
|
||||
SettingsEntry(SettingsPlace.SETTINGS, R.string.setup_agent_commands, section = SettingsSection.DEVELOPER, words = listOf("debugging tools", "cli"), developer = true),
|
||||
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"),
|
||||
@@ -139,8 +138,9 @@ internal object SettingsIndex {
|
||||
d(R.string.drawer_hud, R.string.drawer_hud, "fps", "counter", "overlay", "performance"),
|
||||
d(R.string.drawer_hud, R.string.perf_gpuclock, "gpu", "clock", "max"),
|
||||
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.flow_touch_controls, "on-screen", "controls", "steam touch", "visibility", "opacity", "size"),
|
||||
d(R.string.drawer_page_controller, R.string.flow_layout, "touch layout", "edit layout", "on-screen", "osc"),
|
||||
d(R.string.drawer_page_controller, R.string.flow_buttons, "remap", "mapping", "bindings", "buttons", "per game", "profile"),
|
||||
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"),
|
||||
|
||||
@@ -456,12 +456,13 @@ fun MenuItem(
|
||||
.padding(horizontal = 10.dp, vertical = 9.dp),
|
||||
) {
|
||||
Text("✓", fontSize = 12.sp, color = pal.signal, modifier = Modifier.width(18.dp).alpha(if (checked) 1f else 0f).clearAndSetSemantics {})
|
||||
val ink = if (checked) pal.signal else colors.onBackground
|
||||
if (leading != null) {
|
||||
leading()
|
||||
androidx.compose.runtime.CompositionLocalProvider(androidx.compose.material3.LocalContentColor provides ink) { leading() }
|
||||
Spacer(Modifier.width(8.dp))
|
||||
}
|
||||
Column(modifier = Modifier.weight(1f)) {
|
||||
Text(label, fontSize = 13.5.sp, color = if (checked) pal.signal else colors.onBackground, maxLines = 2, overflow = TextOverflow.Ellipsis)
|
||||
Text(label, fontSize = 13.5.sp, color = ink, maxLines = 2, overflow = TextOverflow.Ellipsis)
|
||||
if (detail != null) Text(detail, fontSize = 12.sp, color = colors.onSurfaceVariant, maxLines = 2, overflow = TextOverflow.Ellipsis)
|
||||
}
|
||||
if (trailing != null) { Spacer(Modifier.width(8.dp)); trailing() }
|
||||
@@ -525,7 +526,7 @@ fun SettingsGroup(title: String, compact: Boolean = false, detail: String? = nul
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun SettingsRow(label: String, hint: String?, highlighted: Boolean = false, hintLines: Int? = null, stacked: Boolean = false, tightControlSpacing: Boolean = false, control: @Composable () -> Unit) {
|
||||
fun SettingsRow(label: String, hint: String?, highlighted: Boolean = false, hintLines: Int? = null, stacked: Boolean = false, tightControlSpacing: Boolean = false, sideBySide: Boolean = false, control: @Composable () -> Unit) {
|
||||
val compact = LocalCompactSettings.current
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
@@ -535,7 +536,7 @@ fun SettingsRow(label: String, hint: String?, highlighted: Boolean = false, hint
|
||||
lineHeight = if (compact) 14.sp else androidx.compose.ui.unit.TextUnit.Unspecified,
|
||||
minLines = hintLines ?: 1, maxLines = hintLines ?: Int.MAX_VALUE, overflow = TextOverflow.Ellipsis)
|
||||
}
|
||||
if (compact && !stacked) Column(
|
||||
if (compact && !stacked && !sideBySide) Column(
|
||||
modifier = Modifier.searchTarget(label).fillMaxWidth().background(bg).padding(horizontal = 10.dp, vertical = 6.dp),
|
||||
) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
@@ -544,7 +545,7 @@ fun SettingsRow(label: String, hint: String?, highlighted: Boolean = false, hint
|
||||
control()
|
||||
}
|
||||
if (hint != null || hintLines != null) hintText(11.sp)
|
||||
} else if (stacked || LocalNarrowPane.current) Column(
|
||||
} else if (stacked || (LocalNarrowPane.current && !sideBySide)) Column(
|
||||
modifier = Modifier.searchTarget(label).fillMaxWidth().background(bg).padding(
|
||||
horizontal = if (compact) 10.dp else 14.dp,
|
||||
vertical = if (tightControlSpacing) 2.dp else if (compact) 6.dp else 12.dp),
|
||||
@@ -612,8 +613,8 @@ fun UncertainMark(description: String) {
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun ToggleRow(host: MenuHost, key: String, label: String, hint: String?, checked: Boolean, enabled: Boolean = true, chipModifier: Modifier = Modifier, onChange: (Boolean) -> Unit) =
|
||||
SettingsRow(label, hint) {
|
||||
fun ToggleRow(host: MenuHost, key: String, label: String, hint: String?, checked: Boolean, enabled: Boolean = true, chipModifier: Modifier = Modifier, sideBySide: Boolean = false, onChange: (Boolean) -> Unit) =
|
||||
SettingsRow(label, hint, sideBySide = sideBySide) {
|
||||
ToggleSwitch(checked, enabled, label, chipModifier.testTag("setting-$key")) { host.open = null; onChange(it) }
|
||||
}
|
||||
|
||||
@@ -773,8 +774,10 @@ fun MultiRow(
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun ActionRow(label: String, hint: String?, button: String, onClick: () -> Unit, progress: Float? = null, modifier: Modifier = Modifier) {
|
||||
SettingsRow(label, hint) { SecondaryButton(button, modifier = modifier, progress = progress, onClick = onClick) }
|
||||
fun ActionRow(label: String, hint: String?, button: String, onClick: () -> Unit, progress: Float? = null, modifier: Modifier = Modifier, sideBySide: Boolean = false) {
|
||||
SettingsRow(label, hint, sideBySide = sideBySide) {
|
||||
SecondaryButton(button, compact = sideBySide, modifier = modifier, progress = progress, onClick = onClick)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
||||
@@ -88,7 +88,9 @@ internal fun TabMenu(
|
||||
.controllerConfirm(onClick = toggle)
|
||||
.padding(start = 14.dp, end = 10.dp),
|
||||
) {
|
||||
if (selected in labels.indices) leading?.invoke(selected, false)
|
||||
if (selected in labels.indices) androidx.compose.runtime.CompositionLocalProvider(androidx.compose.material3.LocalContentColor provides colors.onBackground) {
|
||||
leading?.invoke(selected, false)
|
||||
}
|
||||
Text(label, fontSize = 14.sp, fontWeight = FontWeight.Bold, color = colors.onBackground, maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f, fill = false))
|
||||
Icon(if (open) Icons.Outlined.ExpandLess else Icons.Outlined.ExpandMore, contentDescription = null,
|
||||
|
||||
@@ -67,13 +67,14 @@ object CompositorHost {
|
||||
outputHeight: Int,
|
||||
refreshHz: Float,
|
||||
fpsLimit: Int,
|
||||
layerFpsLimit: Int = fpsLimit,
|
||||
): Boolean {
|
||||
WaylandCompositor.nativeSetClockControl(java.io.File(context.filesDir, "${com.droiddeck.launcher.runtime.LinuxRuntime.DIR}/tmp/.dd-clock").path)
|
||||
ownVsyncThread = SessionPrefs.vsyncThread(context)
|
||||
WaylandCompositor.nativeSetRenderOnCommit(SessionPrefs.renderOnCommit(context))
|
||||
blackFrameInsertion = SessionPrefs.blackFrameInsertion(context)
|
||||
WaylandCompositor.nativeSetBlackFrameInsertion(blackFrameInsertion)
|
||||
pace(refreshHz, fpsLimit)
|
||||
pace(refreshHz, fpsLimit, layerFpsLimit)
|
||||
if (!SessionState.running) WaylandCompositor.nativeSetOutputSize(outputWidth, outputHeight)
|
||||
if (started) {
|
||||
attached = surface
|
||||
@@ -95,23 +96,23 @@ object CompositorHost {
|
||||
private var blackFrameInsertion = false
|
||||
private var pictureHolds = 0
|
||||
|
||||
private fun pace(refreshHz: Float, fpsLimit: Int) {
|
||||
private fun pace(refreshHz: Float, fpsLimit: Int, layerFpsLimit: Int) {
|
||||
WaylandCompositor.nativeSetFpsLimit(fpsLimit)
|
||||
WaylandCompositor.nativeSetLayerFrameRate(if (fpsLimit > 0 && !blackFrameInsertion) fpsLimit.toFloat() else refreshHz)
|
||||
WaylandCompositor.nativeSetLayerFrameRate(SessionPrefs.layerFrameRate(layerFpsLimit, refreshHz, blackFrameInsertion))
|
||||
WaylandCompositor.nativeSetOutputRefreshRate(refreshHz)
|
||||
SessionState.refreshHz = refreshHz
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun updatePacing(refreshHz: Float, fpsLimit: Int) {
|
||||
if (started) pace(refreshHz, fpsLimit)
|
||||
fun updatePacing(refreshHz: Float, fpsLimit: Int, layerFpsLimit: Int = fpsLimit) {
|
||||
if (started) pace(refreshHz, fpsLimit, layerFpsLimit)
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun setBlackFrameInsertion(on: Boolean, refreshHz: Float, fpsLimit: Int) {
|
||||
fun setBlackFrameInsertion(on: Boolean, refreshHz: Float, fpsLimit: Int, layerFpsLimit: Int = fpsLimit) {
|
||||
blackFrameInsertion = on
|
||||
WaylandCompositor.nativeSetBlackFrameInsertion(on)
|
||||
if (started) pace(refreshHz, fpsLimit)
|
||||
if (started) pace(refreshHz, fpsLimit, layerFpsLimit)
|
||||
}
|
||||
|
||||
/** Presents only pictures until the matching release; false when nothing is strobing. */
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_enabled="false" android:color="#AAB6C8" />
|
||||
<item android:color="#F4F7FC" />
|
||||
</selector>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_enabled="false">
|
||||
<shape><corners android:radius="7dp" /><solid android:color="#303845" /></shape>
|
||||
</item>
|
||||
<item android:state_pressed="true">
|
||||
<shape><corners android:radius="7dp" /><solid android:color="#556783" /></shape>
|
||||
</item>
|
||||
<item android:state_focused="true">
|
||||
<shape><corners android:radius="7dp" /><solid android:color="#414E62" /><stroke android:width="2dp" android:color="#A7CCFF" /></shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape><corners android:radius="7dp" /><solid android:color="#414E62" /></shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<corners android:radius="10dp" />
|
||||
<solid android:color="#202630" />
|
||||
</shape>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||
android:orientation="horizontal" android:gravity="center_vertical" android:layoutDirection="ltr"
|
||||
android:background="@drawable/wireless_pairing_panel" android:paddingHorizontal="3dp" android:paddingVertical="1dp">
|
||||
<LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical">
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal">
|
||||
<Button style="@style/DroidDeckPairKey" android:id="@+id/pair_key_1" android:text="1" />
|
||||
<Button style="@style/DroidDeckPairKey" android:id="@+id/pair_key_2" android:text="2" />
|
||||
<Button style="@style/DroidDeckPairKey" android:id="@+id/pair_key_3" android:text="3" />
|
||||
</LinearLayout>
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal">
|
||||
<Button style="@style/DroidDeckPairKey" android:id="@+id/pair_key_7" android:text="7" />
|
||||
<Button style="@style/DroidDeckPairKey" android:id="@+id/pair_key_8" android:text="8" />
|
||||
<Button style="@style/DroidDeckPairKey" android:id="@+id/pair_key_9" android:text="9" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView android:id="@+id/pair_key_code"
|
||||
android:layout_width="76dp" android:layout_height="38dp"
|
||||
android:gravity="center" android:maxLines="1" android:scrollHorizontally="false"
|
||||
android:fontFamily="monospace" android:textStyle="bold"
|
||||
android:includeFontPadding="false" android:textColor="#F4F7FC"
|
||||
android:autoSizeTextType="uniform" android:autoSizeMinTextSize="10sp"
|
||||
android:autoSizeMaxTextSize="17sp" android:autoSizeStepGranularity="1sp" />
|
||||
<LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical">
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal">
|
||||
<Button style="@style/DroidDeckPairKey" android:id="@+id/pair_key_4" android:text="4" />
|
||||
<Button style="@style/DroidDeckPairKey" android:id="@+id/pair_key_5" android:text="5" />
|
||||
<Button style="@style/DroidDeckPairKey" android:id="@+id/pair_key_6" android:text="6" />
|
||||
</LinearLayout>
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal">
|
||||
<Button style="@style/DroidDeckPairKey" android:id="@+id/pair_key_0" android:text="0" />
|
||||
<Button style="@style/DroidDeckPairKey" android:id="@+id/pair_key_delete" android:text="⌫" android:contentDescription="@string/adbpair_keypad_delete" />
|
||||
<Button style="@style/DroidDeckPairKey" android:id="@+id/pair_key_submit" android:text="✓" android:contentDescription="@string/agent_action_pair" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="flow_controls">عناصر التحكم</string>
|
||||
<string name="flow_game_changes">تغييرات هذه اللعبة: %1$d</string>
|
||||
<string name="flow_buttons">تعيينات يد التحكم</string>
|
||||
<string name="flow_layout">تخطيط الشاشة</string>
|
||||
<string name="flow_all_settings">كل إعدادات وحدة التحكم</string>
|
||||
<string name="flow_touch_controls">عناصر التحكم باللمس</string>
|
||||
<string name="flow_touch_type">النوع</string>
|
||||
<string name="flow_show">الإظهار</string>
|
||||
<string name="flow_buttons_hint">انقر زرًا في الرسم أو اضغطه على يد التحكم. تُضبط أزرار الشاشة من تخطيط الشاشة.</string>
|
||||
<string name="flow_press">اضغط زرًا</string>
|
||||
<string name="flow_press_now">اضغط زرًا على وحدة التحكم…</string>
|
||||
<string name="flow_more_buttons">أزرار الجهاز والمفاتيح الإضافية</string>
|
||||
<string name="flow_other_controls">عناصر تحكم أخرى</string>
|
||||
<string name="flow_profile_binding">استخدام الافتراضي المشترك: %1$s</string>
|
||||
<string name="flow_duplicate">تكرار</string>
|
||||
<string name="flow_appearance">الاسم والمظهر</string>
|
||||
<string name="flow_grid_fine">شبكة دقيقة</string>
|
||||
<string name="flow_grid_coarse">شبكة واسعة</string>
|
||||
<string name="flow_games">ألعاب بتخصيصات</string>
|
||||
<string name="flow_games_hint">غيّر عناصر تحكم اللعبة من القائمة أثناء تشغيلها.</string>
|
||||
<string name="flow_default_for">الافتراضي لـ</string>
|
||||
<string name="flow_both_modes">كلا الوضعين</string>
|
||||
<string name="flow_no_mode">لا شيء</string>
|
||||
<string name="flow_used_games">الألعاب المثبِّتة له: %1$d</string>
|
||||
<string name="flow_mine">الخاصة بي</string>
|
||||
<string name="flow_community">المجتمع</string>
|
||||
<string name="flow_community_hint">تخطيطات شاركها لاعبو Winlator. ترسل أزرارها مفاتيح لوحة المفاتيح والماوس.</string>
|
||||
<string name="flow_community_failed">تعذّر تحميل التخطيطات المشتركة. تحقق من الاتصال وحاول مرة أخرى.</string>
|
||||
<string name="flow_preview">معاينة</string>
|
||||
<string name="flow_use">استخدام</string>
|
||||
<string name="flow_loading">جارٍ التحميل…</string>
|
||||
<string name="flow_profile_game">قياسي</string>
|
||||
<string name="flow_profile_desktop">سطح المكتب القياسي</string>
|
||||
<string name="flow_apply_to">تطبيق التغييرات على</string>
|
||||
<string name="flow_route_pad">يد التحكم</string>
|
||||
<string name="flow_route_keys">لوحة المفاتيح والماوس</string>
|
||||
<string name="flow_route_none">لا شيء</string>
|
||||
<string name="flow_acts_as">يعمل كـ</string>
|
||||
<string name="flow_steam_remap_hint">يمكن لـ Steam Input أيضًا إعادة تعيين الأزرار. غيّر الزر هنا أو في Steam، وليس في كليهما.</string>
|
||||
<string name="flow_mouse_touch">الماوس واللمس</string>
|
||||
<string name="flow_editor_hint">اسحب للتحريك، واسحب زاوية لتغيير الحجم. انقر على عنصر لتحديد وظيفته.</string>
|
||||
<string name="flow_snap_controls">إلى عناصر التحكم الأخرى</string>
|
||||
<string name="flow_default_profile">اتباع الافتراضي (%1$s)</string>
|
||||
<string name="flow_size_overall">الحجم العام</string>
|
||||
<string name="flow_size_layout">مقياس التخطيط</string>
|
||||
<string name="flow_size_control">الحجم</string>
|
||||
<string name="flow_as_itself">%1$s (دون تغيير)</string>
|
||||
<string name="flow_show_steam_qam">زرّا Steam وQAM</string>
|
||||
<string name="flow_second_screen_hint">يظهر على الشاشة الثانية عندما تكون قائمة الجلسة فيها على عناصر تحكم الملف الشخصي.</string>
|
||||
<string name="flow_press_other">هذا الزر غير موجود في الرسم. اضبطه من أزرار الجهاز والمفاتيح الإضافية.</string>
|
||||
<string name="flow_in_use_game">مستخدم في وضع الألعاب</string>
|
||||
<string name="flow_in_use_desktop">مستخدم في وضع سطح المكتب</string>
|
||||
<string name="flow_in_use_both">مستخدم في الوضعين</string>
|
||||
<string name="flow_shared_defaults">الإعدادات المشتركة</string>
|
||||
<string name="flow_shared_defaults_of">الإعدادات المشتركة (%1$s)</string>
|
||||
<string name="flow_editing">تعديل: %1$s</string>
|
||||
<string name="flow_clear_overrides">استعادة عناصر تحكم هذه اللعبة إلى الإعدادات المشتركة</string>
|
||||
<string name="flow_clear_overrides_hint">يتأثر %1$s فقط</string>
|
||||
<string name="flow_clear">مسح</string>
|
||||
<string name="flow_portrait">عمودي</string>
|
||||
<string name="flow_landscape">أفقي</string>
|
||||
<string name="flow_landscape_separate">يحتفظ الوضع الأفقي بمواضعه الخاصة.</string>
|
||||
<string name="flow_portrait_separate">يحتفظ الوضع العمودي بمواضعه الخاصة.</string>
|
||||
<string name="flow_clear_title">استعادة الإعدادات المشتركة لـ %1$s؟</string>
|
||||
<string name="flow_clear_body">يمسح هذا إعادة تعيين أزرار %1$s وتخطيطاتها العمودية والأفقية وأي ملف شخصي مثبّت. لن تتغير الإعدادات المشتركة.</string>
|
||||
<string name="flow_changes_count">التغييرات: %1$d</string>
|
||||
<string name="flow_mode_override_hint">يستخدم %1$s ملفًا شخصيًا مختارًا من قائمة الجلسة. اختر اتباع الافتراضي هناك لاستخدام الافتراضي مجددًا.</string>
|
||||
<string name="flow_scope_every_game">ينطبق على كل الألعاب.</string>
|
||||
<string name="flow_scope_this_game">محفوظ لهذه اللعبة فقط.</string>
|
||||
<string name="flow_remap">إعادة تعيين</string>
|
||||
</resources>
|
||||
@@ -21,7 +21,6 @@
|
||||
<string name="input_edit_layout">التحرير على الشاشة</string>
|
||||
<string name="input_saved_layouts">التخطيطات المحفوظة…</string>
|
||||
<string name="input_saved_layouts_hint">اختر تخطيطًا أو أنشئ تخطيطك</string>
|
||||
<string name="input_second_screen_enable">اختر عناصر تحكم ملف التعريف في قائمة جلسة الشاشة الثانوية. يحدد محددا ملف التعريف والشاشة الثانوية في قائمة وحدة التحكم عناصر التحكم المعروضة.</string>
|
||||
<string name="input_assign_actions">إجراءات الأزرار</string>
|
||||
<string name="input_shared_with">مشترك مع %1$s. تُطبَّق التعديلات على تلك الملفات أيضًا.</string>
|
||||
<string name="input_reuse">إعادة استخدام الإعدادات</string>
|
||||
@@ -83,7 +82,6 @@
|
||||
<string name="input_profile">ملف التعريف</string>
|
||||
<string name="input_mouse_gestures">إيماءات لوحة لمس الفأرة</string>
|
||||
<string name="input_mouse_gestures_hint">عند تعيينها لمؤشر الفأرة: اضغط للنقر، واستمر للتمرير بالسحب، ومرّر بإصبعين.</string>
|
||||
<string name="input_quick_override_hint">لدى %1$s تجاوز للقائمة السريعة. اختر تلقائي هناك لاستخدام ملف التعريف الافتراضي والأجزاء الثلاثة المحفوظة.</string>
|
||||
<string name="input_route_local">إدخال DroidDeck</string>
|
||||
<string name="input_axis_action_hint" formatted="false">يُحتجز أثناء تحريك العصا في أي اتجاه: يُضغط فوق 55% ويُحرّر تحت 35%. استخدم مفاتيح الاتجاه لتعيين كل اتجاه على حدة. تُنفَّذ أوامر DroidDeck مرة واحدة لكل انحراف. يُضبط النقر على العصا على حدة.</string>
|
||||
<string name="input_contact_action_hint">يُحتجز أثناء لمس لوحة اللمس؛ ويُحرّر عند رفع إصبعك. تُنفَّذ أوامر DroidDeck مرة واحدة لكل لمسة. يُضبط النقر على اللوحة على حدة.</string>
|
||||
|
||||
@@ -283,7 +283,6 @@
|
||||
<string name="mode_pen_touch">اللمس</string>
|
||||
<string name="mode_pen_button">الزر الجانبي</string>
|
||||
<string name="mode_osc">عناصر التحكم على الشاشة</string>
|
||||
<string name="mode_osc_qam">Steam + QAM</string>
|
||||
<string name="mode_osc_note">يعرض الخيار «تلقائي» عناصر التحكم عند عدم توصيل وحدة تحكم.</string>
|
||||
<string name="osc_steam_touch">لمس Steam (تجريبي)</string>
|
||||
<string name="osc_style_next_session">تبدأ عناصر التحكم باللمس من Steam مع جلسة Steam التالية</string>
|
||||
@@ -891,7 +890,6 @@
|
||||
<string name="setup_game_debug_logs_hint">تضمين بيانات تشخيص Proton وWine والرسومات عند تشغيل اللعبة التالية. قد يقلّل الأداء ويستهلك مساحة تخزين أكبر.</string>
|
||||
<string name="setup_game_debug_logs_restart">أعِد تشغيل هذه الجلسة لحفظ سجلات تصحيح الألعاب</string>
|
||||
<string name="setup_logging_update_failed">تعذّر تحديث التسجيل. تحقّق من المفتاح وحاول مرة أخرى.</string>
|
||||
<string name="setup_agent_commands">أدوات تصحيح الأخطاء</string>
|
||||
<string name="setup_graphics_logs">سجلات رسوميات مفصلة</string>
|
||||
<string name="setup_steam_gpu_drawing">واجهة Steam: الرسم عبر GPU</string>
|
||||
<string name="setup_steam_gpu_drawing_hint">مع زوج مشغّلات Xclipse، ترسم Steam صفحاتها برمجيًا (أظهر الرسم عبر GPU مربعات مشوهة). شغّله للحصول على واجهة Steam أسرع إذا بدت الصورة سليمة على هذا الهاتف.</string>
|
||||
@@ -1337,6 +1335,31 @@
|
||||
<string name="ctrl_size">حجم الأزرار</string>
|
||||
<string name="ctrl_adaptive">عصي تكيّفية</string>
|
||||
<string name="ctrl_rumble">اهتزاز اللعبة</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">فتح</string>
|
||||
<string name="air_triggers_use">استخدام Air Triggers</string>
|
||||
<string name="air_triggers_use_hint">يشغّل أزرار الكتف دون لوحة الأزرار أو العلامات من RedMagic، وتضغط بدلاً من ذلك أزرار تخطيط اللمس.</string>
|
||||
<string name="air_trigger_left">Air Trigger الأيسر</string>
|
||||
<string name="air_trigger_right">Air Trigger الأيمن</string>
|
||||
<string name="air_trigger_button_hint">محفوظ لهذا التخطيط</string>
|
||||
<string name="air_triggers_vibration">الاهتزاز</string>
|
||||
<string name="air_triggers_vibration_hint">يهتز عند لمس Air Trigger</string>
|
||||
<string name="air_triggers_screen_light">تأثير الإضاءة على الشاشة</string>
|
||||
<string name="air_triggers_screen_light_hint">يضيء حافة الشاشة أسفل Air Trigger عند لمسه</string>
|
||||
<string name="air_triggers_led">تأثيرات إضاءة LED عند اللمس</string>
|
||||
<string name="air_triggers_led_off">إيقاف</string>
|
||||
<string name="air_triggers_led_steady">ثابت</string>
|
||||
<string name="air_triggers_led_pulse">نبض</string>
|
||||
<string name="air_trigger_left_action">إجراء Air Trigger الأيسر</string>
|
||||
<string name="air_trigger_right_action">إجراء Air Trigger الأيمن</string>
|
||||
<string name="air_trigger_action_tap">نقرة واحدة</string>
|
||||
<string name="air_trigger_action_hold">ضغط مطوّل</string>
|
||||
<string name="air_trigger_action_rapid">إطلاق سريع</string>
|
||||
<string name="air_trigger_rapid_settings">إعدادات الإطلاق السريع</string>
|
||||
<string name="air_trigger_rapid_frequency">معدل النقر</string>
|
||||
<string name="air_trigger_rate_low">منخفض</string>
|
||||
<string name="air_trigger_rate_normal">عادي</string>
|
||||
<string name="air_trigger_rate_high">مرتفع</string>
|
||||
<string name="ctrl_dead_zone">المنطقة الميتة لعصا التحكم</string>
|
||||
<string name="ctrl_steam_button">زر Steam</string>
|
||||
<string name="ctrl_qam_button">زر QAM</string>
|
||||
@@ -2394,7 +2417,6 @@
|
||||
<string name="adbpair_waiting_text">فعِّل تصحيح الأخطاء اللاسلكي، ثم اضغط على «إقران الجهاز برمز الإقران».</string>
|
||||
<string name="adbpair_waiting_long">فعِّل تصحيح الأخطاء اللاسلكي، ثم اضغط على «إقران الجهاز برمز الإقران». ابقَ في الإعدادات: يُكتب الرمز في هذا الإشعار.</string>
|
||||
<string name="adbpair_code_label">رمز الإقران المكوَّن من 6 أرقام</string>
|
||||
<string name="adbpair_code_hint">اضغط على «إدخال الرمز» وأدخِل الأرقام الستة الظاهرة في الإعدادات.</string>
|
||||
<string name="adbpair_title_code">أدخِل رمز إقران Wi-Fi</string>
|
||||
<string name="adbpair_title_retry">أعِد تجربة الرمز</string>
|
||||
<string name="adbpair_enter_code">إدخال الرمز</string>
|
||||
@@ -2421,7 +2443,8 @@
|
||||
<string name="loadstate_steam_client">جارٍ تنزيل عميل Steam · %1$s</string>
|
||||
<string name="pextra_busy">يوجد تثبيت لأداة توافق قيد التنفيذ بالفعل</string>
|
||||
<string name="pextra_stop_session">أوقِف الجلسة النشطة قبل تثبيت أدوات التوافق</string>
|
||||
<string name="pextra_no_release">تعذّر العثور على إصدار ARM64 لـ %1$s</string>
|
||||
<string name="pextra_no_release">تعذّر العثور على إصدار %2$s لـ %1$s</string>
|
||||
<string name="pextra_anticheat">مكافحة الغش</string>
|
||||
<string name="pextra_no_space">يلزم توفُّر 4 GB على الأقل بالإضافة إلى حجم التنزيل لتثبيت %1$s</string>
|
||||
<string name="pextra_downloading">جارٍ تنزيل %1$s %2$s</string>
|
||||
<string name="pextra_retrying">جارٍ إعادة محاولة التنزيل · المحاولة %1$d من %2$d</string>
|
||||
@@ -4330,4 +4353,6 @@
|
||||
<string name="glasses_shortcut_group">اختصار داخل اللعبة</string>
|
||||
<string name="glasses_show_shortcut">إظهار اختصار النظارات الذكية</string>
|
||||
<string name="glasses_show_shortcut_hint">إظهار زر النظارات الذكية العائم فوق اللعبة.</string>
|
||||
<string name="display_filter_game_profile">استخدام ملف تعريف %1$s: %2$s</string>
|
||||
<string name="display_filter_default_profile">استخدام الملف التعريفي الافتراضي: %1$s</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="flow_controls">Controles</string>
|
||||
<string name="flow_game_changes">Cambios en este juego: %1$d</string>
|
||||
<string name="flow_buttons">Asignaciones del control</string>
|
||||
<string name="flow_layout">Diseño en pantalla</string>
|
||||
<string name="flow_all_settings">Todos los ajustes del control</string>
|
||||
<string name="flow_touch_controls">Controles táctiles</string>
|
||||
<string name="flow_touch_type">Tipo</string>
|
||||
<string name="flow_show">Mostrar</string>
|
||||
<string name="flow_buttons_hint">Toca un botón en el dibujo o presiónalo en tu control. Los botones en pantalla se configuran en Diseño en pantalla.</string>
|
||||
<string name="flow_press">Presionar un botón</string>
|
||||
<string name="flow_press_now">Presiona un botón de tu control…</string>
|
||||
<string name="flow_more_buttons">Botones del dispositivo y teclas extra</string>
|
||||
<string name="flow_other_controls">Otros controles</string>
|
||||
<string name="flow_profile_binding">Usar el valor compartido: %1$s</string>
|
||||
<string name="flow_duplicate">Duplicar</string>
|
||||
<string name="flow_appearance">Nombre y aspecto</string>
|
||||
<string name="flow_grid_fine">Cuadrícula fina</string>
|
||||
<string name="flow_grid_coarse">Cuadrícula gruesa</string>
|
||||
<string name="flow_games">Juegos con ajustes propios</string>
|
||||
<string name="flow_games_hint">Cambia los controles de un juego desde el menú mientras se ejecuta.</string>
|
||||
<string name="flow_default_for">Predeterminado para</string>
|
||||
<string name="flow_both_modes">Ambos modos</string>
|
||||
<string name="flow_no_mode">Ninguno</string>
|
||||
<string name="flow_used_games">Juegos que lo fijan: %1$d</string>
|
||||
<string name="flow_mine">Míos</string>
|
||||
<string name="flow_community">Comunidad</string>
|
||||
<string name="flow_community_hint">Diseños compartidos por jugadores de Winlator. Sus botones envían teclas de teclado y mouse.</string>
|
||||
<string name="flow_community_failed">No se pudieron cargar los diseños compartidos. Revisa la conexión e inténtalo de nuevo.</string>
|
||||
<string name="flow_preview">Vista previa</string>
|
||||
<string name="flow_use">Usar</string>
|
||||
<string name="flow_loading">Cargando…</string>
|
||||
<string name="flow_profile_game">Estándar</string>
|
||||
<string name="flow_profile_desktop">Escritorio estándar</string>
|
||||
<string name="flow_apply_to">Aplicar cambios a</string>
|
||||
<string name="flow_route_pad">Control</string>
|
||||
<string name="flow_route_keys">Teclado y mouse</string>
|
||||
<string name="flow_route_none">Nada</string>
|
||||
<string name="flow_acts_as">Funciona como</string>
|
||||
<string name="flow_steam_remap_hint">Steam Input también puede reasignar botones. Cambia un botón aquí o en Steam, no en ambos.</string>
|
||||
<string name="flow_mouse_touch">Mouse y toque</string>
|
||||
<string name="flow_editor_hint">Arrastra para mover y arrastra una esquina para cambiar el tamaño. Toca un control para elegir qué hace.</string>
|
||||
<string name="flow_snap_controls">A otros controles</string>
|
||||
<string name="flow_default_profile">Seguir el predeterminado (%1$s)</string>
|
||||
<string name="flow_size_overall">Tamaño general</string>
|
||||
<string name="flow_size_layout">Escala del diseño</string>
|
||||
<string name="flow_size_control">Tamaño</string>
|
||||
<string name="flow_as_itself">%1$s (sin cambios)</string>
|
||||
<string name="flow_show_steam_qam">Botones Steam y QAM</string>
|
||||
<string name="flow_second_screen_hint">Se muestra en la segunda pantalla cuando su menú de sesión está en Controles del perfil.</string>
|
||||
<string name="flow_press_other">Ese botón no está en el dibujo. Configúralo en Botones del dispositivo y teclas extra.</string>
|
||||
<string name="flow_in_use_game">En uso en modo Juego</string>
|
||||
<string name="flow_in_use_desktop">En uso en modo Escritorio</string>
|
||||
<string name="flow_in_use_both">En uso en ambos modos</string>
|
||||
<string name="flow_shared_defaults">Valores compartidos</string>
|
||||
<string name="flow_shared_defaults_of">Valores compartidos (%1$s)</string>
|
||||
<string name="flow_editing">Editando: %1$s</string>
|
||||
<string name="flow_clear_overrides">Restaurar los controles de este juego a los valores compartidos</string>
|
||||
<string name="flow_clear_overrides_hint">Solo afecta a %1$s</string>
|
||||
<string name="flow_clear">Borrar</string>
|
||||
<string name="flow_portrait">Vertical</string>
|
||||
<string name="flow_landscape">Horizontal</string>
|
||||
<string name="flow_landscape_separate">El modo horizontal conserva sus propias posiciones.</string>
|
||||
<string name="flow_portrait_separate">El modo vertical conserva sus propias posiciones.</string>
|
||||
<string name="flow_clear_title">¿Restaurar los valores compartidos para %1$s?</string>
|
||||
<string name="flow_clear_body">Esto borra las reasignaciones del control de %1$s, sus diseños vertical y horizontal y cualquier perfil fijado. Los valores compartidos no cambian.</string>
|
||||
<string name="flow_changes_count">Cambios: %1$d</string>
|
||||
<string name="flow_mode_override_hint">%1$s usa un perfil elegido en el menú de la sesión. Elige Seguir el predeterminado ahí para volver a usarlo.</string>
|
||||
<string name="flow_scope_every_game">Se aplica a todos los juegos.</string>
|
||||
<string name="flow_scope_this_game">Se guarda solo para este juego.</string>
|
||||
<string name="flow_remap">Reasignar</string>
|
||||
</resources>
|
||||
@@ -21,7 +21,6 @@
|
||||
<string name="input_edit_layout">Editar en pantalla</string>
|
||||
<string name="input_saved_layouts">Diseños guardados…</string>
|
||||
<string name="input_saved_layouts_hint">Elige un diseño o crea el tuyo</string>
|
||||
<string name="input_second_screen_enable">Elige Controles de perfil en el menú de sesión de la pantalla secundaria. Los selectores de Perfil y Pantalla secundaria del menú del control eligen los controles que se muestran.</string>
|
||||
<string name="input_assign_actions">Acciones de botones</string>
|
||||
<string name="input_shared_with">Compartido con %1$s. Las ediciones también se aplican a esos perfiles.</string>
|
||||
<string name="input_reuse">Reutilizar ajustes</string>
|
||||
@@ -83,7 +82,6 @@
|
||||
<string name="input_profile">Perfil</string>
|
||||
<string name="input_mouse_gestures">Gestos del panel táctil del mouse</string>
|
||||
<string name="input_mouse_gestures_hint">Si se asigna al puntero del mouse: toca para hacer clic, mantén para arrastrar y desplaza con dos dedos.</string>
|
||||
<string name="input_quick_override_hint">%1$s tiene una anulación del menú rápido. Selecciona Auto allí para usar su perfil predeterminado y sus tres partes guardadas.</string>
|
||||
<string name="input_route_local">Entrada de DroidDeck</string>
|
||||
<string name="input_axis_action_hint" formatted="false">Se mantiene mientras la palanca se mueve en cualquier dirección: se presiona por encima del 55 %, se suelta por debajo del 35 %. Usa Teclas de dirección para asignar cada dirección por separado. Los comandos de DroidDeck se ejecutan una vez por desvío. El clic de la palanca se configura aparte.</string>
|
||||
<string name="input_contact_action_hint">Se mantiene mientras se toca el panel táctil; se suelta al levantar el dedo. Los comandos de DroidDeck se ejecutan una vez por toque. El clic del panel se configura aparte.</string>
|
||||
|
||||
@@ -283,7 +283,6 @@
|
||||
<string name="mode_pen_touch">Táctil</string>
|
||||
<string name="mode_pen_button">Botón lateral</string>
|
||||
<string name="mode_osc">Controles en pantalla</string>
|
||||
<string name="mode_osc_qam">Steam + QAM</string>
|
||||
<string name="mode_osc_note">Auto muestra los controles en pantalla cuando no hay ningún control conectado.</string>
|
||||
<string name="osc_steam_touch">Táctil de Steam (beta)</string>
|
||||
<string name="osc_style_next_session">Los controles táctiles de Steam se activan en la próxima sesión de Steam</string>
|
||||
@@ -909,7 +908,6 @@
|
||||
<string name="setup_game_debug_logs_hint">Incluye diagnósticos de Proton, Wine y gráficos en el próximo inicio de un juego. Puede reducir el rendimiento y usar más almacenamiento.</string>
|
||||
<string name="setup_game_debug_logs_restart">Reinicia esta sesión para guardar los registros de depuración de juegos</string>
|
||||
<string name="setup_logging_update_failed">No se pudo actualizar el registro. Revisa el interruptor e inténtalo de nuevo.</string>
|
||||
<string name="setup_agent_commands">Herramientas de depuración</string>
|
||||
<string name="setup_graphics_logs">Registros detallados de gráficos</string>
|
||||
<string name="setup_steam_gpu_drawing">Interfaz de Steam: dibujo con GPU</string>
|
||||
<string name="setup_steam_gpu_drawing_hint">Con el par de controladores Xclipse, Steam dibuja sus páginas por software (el dibujo con GPU mostraba mosaicos con errores). Actívalo para una interfaz de Steam más rápida si se ve bien en este teléfono.</string>
|
||||
@@ -1343,6 +1341,31 @@
|
||||
<string name="ctrl_size">Tamaño de botones</string>
|
||||
<string name="ctrl_adaptive">Sticks adaptables</string>
|
||||
<string name="ctrl_rumble">Vibración en juegos</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Abrir</string>
|
||||
<string name="air_triggers_use">Usar los Air Triggers</string>
|
||||
<string name="air_triggers_use_hint">Activa los gatillos de hombro sin el panel ni los marcadores de RedMagic. En su lugar, presionan botones de la disposición táctil.</string>
|
||||
<string name="air_trigger_left">Air Trigger izquierdo</string>
|
||||
<string name="air_trigger_right">Air Trigger derecho</string>
|
||||
<string name="air_trigger_button_hint">Se guarda para esta disposición</string>
|
||||
<string name="air_triggers_vibration">Vibración</string>
|
||||
<string name="air_triggers_vibration_hint">Vibra al tocar un Air Trigger</string>
|
||||
<string name="air_triggers_screen_light">Efecto de luz en pantalla</string>
|
||||
<string name="air_triggers_screen_light_hint">Ilumina el borde de la pantalla debajo de un Air Trigger al tocarlo</string>
|
||||
<string name="air_triggers_led">Efectos LED de ambiente al tocar</string>
|
||||
<string name="air_triggers_led_off">Apagado</string>
|
||||
<string name="air_triggers_led_steady">Fijo</string>
|
||||
<string name="air_triggers_led_pulse">Pulso</string>
|
||||
<string name="air_trigger_left_action">Acción del Air Trigger izquierdo</string>
|
||||
<string name="air_trigger_right_action">Acción del Air Trigger derecho</string>
|
||||
<string name="air_trigger_action_tap">Toque único</string>
|
||||
<string name="air_trigger_action_hold">Mantener presionado</string>
|
||||
<string name="air_trigger_action_rapid">Disparo rápido</string>
|
||||
<string name="air_trigger_rapid_settings">Configuración de disparo rápido</string>
|
||||
<string name="air_trigger_rapid_frequency">Frecuencia de clics</string>
|
||||
<string name="air_trigger_rate_low">Baja</string>
|
||||
<string name="air_trigger_rate_normal">Normal</string>
|
||||
<string name="air_trigger_rate_high">Alta</string>
|
||||
<string name="ctrl_dead_zone">Zona muerta de la palanca</string>
|
||||
<string name="ctrl_steam_button">Botón Steam</string>
|
||||
<string name="ctrl_qam_button">Botón QAM</string>
|
||||
@@ -2386,7 +2409,6 @@
|
||||
<string name="adbpair_waiting_text">Activa la Depuración inalámbrica y toca “Vincular dispositivo con código de vinculación”.</string>
|
||||
<string name="adbpair_waiting_long">Activa la Depuración inalámbrica y toca “Vincular dispositivo con código de vinculación”. Quédate en Ajustes: el código se ingresa en esta notificación.</string>
|
||||
<string name="adbpair_code_label">Código de vinculación de 6 dígitos</string>
|
||||
<string name="adbpair_code_hint">Toca Ingresar código y escribe los 6 dígitos que muestra Ajustes.</string>
|
||||
<string name="adbpair_title_code">Ingresa el código de vinculación Wi-Fi</string>
|
||||
<string name="adbpair_title_retry">Vuelve a probar el código</string>
|
||||
<string name="adbpair_enter_code">Ingresar código</string>
|
||||
@@ -2413,7 +2435,8 @@
|
||||
<string name="loadstate_steam_client">Descargando el cliente de Steam · %1$s</string>
|
||||
<string name="pextra_busy">Ya se está instalando una herramienta de compatibilidad</string>
|
||||
<string name="pextra_stop_session">Detén la sesión activa antes de instalar herramientas de compatibilidad</string>
|
||||
<string name="pextra_no_release">No se encontró una versión ARM64 de %1$s</string>
|
||||
<string name="pextra_no_release">No se encontró una versión %2$s de %1$s</string>
|
||||
<string name="pextra_anticheat">Antitrampas</string>
|
||||
<string name="pextra_no_space">Para instalar %1$s se necesitan al menos 4 GB libres más el tamaño de la descarga</string>
|
||||
<string name="pextra_downloading">Descargando %1$s %2$s</string>
|
||||
<string name="pextra_retrying">Reintentando la descarga · intento %1$d de %2$d</string>
|
||||
@@ -4208,4 +4231,6 @@
|
||||
<string name="glasses_shortcut_group">Acceso directo en el juego</string>
|
||||
<string name="glasses_show_shortcut">Mostrar acceso directo de Smart Glasses</string>
|
||||
<string name="glasses_show_shortcut_hint">Mostrar el botón flotante de Smart Glasses sobre el juego.</string>
|
||||
<string name="display_filter_game_profile">Usando el perfil %1$s: %2$s</string>
|
||||
<string name="display_filter_default_profile">Usando el perfil predeterminado: %1$s</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="flow_controls">Управление</string>
|
||||
<string name="flow_game_changes">Промени за тази игра: %1$d</string>
|
||||
<string name="flow_buttons">Пренасочвания на контролера</string>
|
||||
<string name="flow_layout">Екранна подредба</string>
|
||||
<string name="flow_all_settings">Всички настройки на контролера</string>
|
||||
<string name="flow_touch_controls">Сензорно управление</string>
|
||||
<string name="flow_touch_type">Тип</string>
|
||||
<string name="flow_show">Показване</string>
|
||||
<string name="flow_buttons_hint">Докоснете бутон на рисунката или го натиснете на контролера. Бутоните на екрана се задават в Подредба на екрана.</string>
|
||||
<string name="flow_press">Натиснете бутон</string>
|
||||
<string name="flow_press_now">Натиснете бутон на контролера…</string>
|
||||
<string name="flow_more_buttons">Бутони на устройството и допълнителни клавиши</string>
|
||||
<string name="flow_other_controls">Други контроли</string>
|
||||
<string name="flow_profile_binding">Общата настройка: %1$s</string>
|
||||
<string name="flow_duplicate">Дублиране</string>
|
||||
<string name="flow_appearance">Име и облик</string>
|
||||
<string name="flow_grid_fine">Ситна мрежа</string>
|
||||
<string name="flow_grid_coarse">Едра мрежа</string>
|
||||
<string name="flow_games">Игри със свои промени</string>
|
||||
<string name="flow_games_hint">Променете управлението на игра от менюто, докато тя работи.</string>
|
||||
<string name="flow_default_for">По подразбиране за</string>
|
||||
<string name="flow_both_modes">И двата режима</string>
|
||||
<string name="flow_no_mode">Нито един</string>
|
||||
<string name="flow_used_games">Игри, които го закачат: %1$d</string>
|
||||
<string name="flow_mine">Мои</string>
|
||||
<string name="flow_community">Общност</string>
|
||||
<string name="flow_community_hint">Подредби, споделени от играчи на Winlator. Бутоните им изпращат клавиши от клавиатура и мишка.</string>
|
||||
<string name="flow_community_failed">Споделените подредби не можаха да се заредят. Проверете връзката и опитайте отново.</string>
|
||||
<string name="flow_preview">Преглед</string>
|
||||
<string name="flow_use">Използване</string>
|
||||
<string name="flow_loading">Зарежда се…</string>
|
||||
<string name="flow_profile_game">Стандартен</string>
|
||||
<string name="flow_profile_desktop">Стандартен работен плот</string>
|
||||
<string name="flow_apply_to">Прилагане на промените към</string>
|
||||
<string name="flow_route_pad">Геймпад</string>
|
||||
<string name="flow_route_keys">Клавиатура и мишка</string>
|
||||
<string name="flow_route_none">Нищо</string>
|
||||
<string name="flow_acts_as">Действа като</string>
|
||||
<string name="flow_steam_remap_hint">Steam Input също може да пренасочва бутоните. Променяйте бутон тук или в Steam, не и на двете места.</string>
|
||||
<string name="flow_mouse_touch">Мишка и докосване</string>
|
||||
<string name="flow_editor_hint">Плъзнете, за да преместите, или плъзнете ъгъл, за да промените размера. Докоснете контрола, за да зададете действието ѝ.</string>
|
||||
<string name="flow_snap_controls">Към другите контроли</string>
|
||||
<string name="flow_default_profile">Следвай по подразбиране (%1$s)</string>
|
||||
<string name="flow_size_overall">Общ размер</string>
|
||||
<string name="flow_size_layout">Мащаб на подредбата</string>
|
||||
<string name="flow_size_control">Размер</string>
|
||||
<string name="flow_as_itself">%1$s (без промяна)</string>
|
||||
<string name="flow_show_steam_qam">Бутоните Steam и QAM</string>
|
||||
<string name="flow_second_screen_hint">Показва се на втория екран, когато менюто на сесията там е на Контроли от профила.</string>
|
||||
<string name="flow_press_other">Този бутон не е на рисунката. Задайте го в Бутони на устройството и допълнителни клавиши.</string>
|
||||
<string name="flow_in_use_game">Използва се в режим Игри</string>
|
||||
<string name="flow_in_use_desktop">Използва се в режим Работен плот</string>
|
||||
<string name="flow_in_use_both">Използва се и в двата режима</string>
|
||||
<string name="flow_shared_defaults">Общи настройки</string>
|
||||
<string name="flow_shared_defaults_of">Общи настройки (%1$s)</string>
|
||||
<string name="flow_editing">Редактиране: %1$s</string>
|
||||
<string name="flow_clear_overrides">Връщане на контролите на тази игра към общите настройки</string>
|
||||
<string name="flow_clear_overrides_hint">Засяга само %1$s</string>
|
||||
<string name="flow_clear">Изчистване</string>
|
||||
<string name="flow_portrait">Портрет</string>
|
||||
<string name="flow_landscape">Пейзаж</string>
|
||||
<string name="flow_landscape_separate">Пейзажният режим пази свои позиции.</string>
|
||||
<string name="flow_portrait_separate">Портретният режим пази свои позиции.</string>
|
||||
<string name="flow_clear_title">Връщане на общите настройки за %1$s?</string>
|
||||
<string name="flow_clear_body">Това изчиства пренасочванията на контролера, портретната и пейзажната подредба и закачения профил за %1$s. Общите настройки няма да се променят.</string>
|
||||
<string name="flow_changes_count">Промени: %1$d</string>
|
||||
<string name="flow_mode_override_hint">%1$s използва профил, избран в менюто на сесията. Изберете Следвай по подразбиране там, за да го върнете.</string>
|
||||
<string name="flow_scope_every_game">Важи за всички игри.</string>
|
||||
<string name="flow_scope_this_game">Запазено само за тази игра.</string>
|
||||
<string name="flow_remap">Пренасочване</string>
|
||||
</resources>
|
||||
@@ -21,7 +21,6 @@
|
||||
<string name="input_edit_layout">Редактиране на екрана</string>
|
||||
<string name="input_saved_layouts">Запазени оформления…</string>
|
||||
<string name="input_saved_layouts_hint">Изберете оформление или създайте свое</string>
|
||||
<string name="input_second_screen_enable">Изберете Управление на профила в менюто на сесията на втория екран. Изборите Профил и Втори екран в менюто на контролера определят кое управление да се показва.</string>
|
||||
<string name="input_assign_actions">Действия на бутоните</string>
|
||||
<string name="input_shared_with">Споделено с %1$s. Промените важат и за тези профили.</string>
|
||||
<string name="input_reuse">Повторно използване на настройки</string>
|
||||
@@ -83,7 +82,6 @@
|
||||
<string name="input_profile">Профил</string>
|
||||
<string name="input_mouse_gestures">Жестове на тъчпада на мишката</string>
|
||||
<string name="input_mouse_gestures_hint">Когато е зададено на показалеца на мишката: докоснете за щракване, задръжте за плъзгане и превъртайте с два пръста.</string>
|
||||
<string name="input_quick_override_hint">%1$s има замяна на бързото меню. Изберете Автоматично, за да използвате профила по подразбиране и трите запазени части.</string>
|
||||
<string name="input_route_local">Вход на DroidDeck</string>
|
||||
<string name="input_axis_action_hint" formatted="false">Задържа се, докато стикът е отместен в която и да е посока: натиска при над 55%, отпуска под 35%. Използвайте Клавиши за посока, за да зададете всяка посока отделно. Командите на DroidDeck се изпълняват веднъж на отклонение. Щракването на стика се настройва отделно.</string>
|
||||
<string name="input_contact_action_hint">Задържа се, докато докосвате тъчпада; отпуска се при вдигане на пръста. Командите на DroidDeck се изпълняват веднъж на докосване. Щракването на тъчпада се настройва отделно.</string>
|
||||
|
||||
@@ -283,7 +283,6 @@
|
||||
<string name="mode_pen_touch">Докосване</string>
|
||||
<string name="mode_pen_button">Страничен бутон</string>
|
||||
<string name="mode_osc">Екранни контроли</string>
|
||||
<string name="mode_osc_qam">Steam + QAM</string>
|
||||
<string name="mode_osc_note">Автоматично показва контролите, когато няма свързан контролер.</string>
|
||||
<string name="osc_steam_touch">Докосване в Steam (бета)</string>
|
||||
<string name="osc_style_next_session">Сензорните контроли на Steam ще стартират от следващата сесия на Steam</string>
|
||||
@@ -879,7 +878,6 @@
|
||||
<string name="setup_game_debug_logs_hint">Включва диагностика на Proton, Wine и графиката при следващото стартиране на игра. Може да намали производителността и да заеме повече място.</string>
|
||||
<string name="setup_game_debug_logs_restart">Рестартирайте тази сесия, за да запазите дневниците за дебъгване на игри</string>
|
||||
<string name="setup_logging_update_failed">Записването в дневник не можа да бъде променено. Проверете превключвателя и опитайте пак.</string>
|
||||
<string name="setup_agent_commands">Инструменти за отстраняване на грешки</string>
|
||||
<string name="setup_graphics_logs">Подробни дневници за графиката</string>
|
||||
<string name="setup_steam_gpu_drawing">Интерфейс на Steam: изрисуване чрез GPU</string>
|
||||
<string name="setup_steam_gpu_drawing_hint">При двойката драйвери Xclipse Steam изрисува страниците си софтуерно (изрисуването чрез GPU даваше разбити плочки). Включи за по-бърз интерфейс на Steam, ако изглежда правилно на този телефон.</string>
|
||||
@@ -1309,6 +1307,31 @@
|
||||
<string name="ctrl_size">Размер на бутоните</string>
|
||||
<string name="ctrl_adaptive">Адаптивни стикове</string>
|
||||
<string name="ctrl_rumble">Вибрация от играта</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Отвори</string>
|
||||
<string name="air_triggers_use">Използвай Air Triggers</string>
|
||||
<string name="air_triggers_use_hint">Включва раменните спусъци без панела и маркерите на RedMagic. Вместо това те натискат бутони от сензорното разположение.</string>
|
||||
<string name="air_trigger_left">Ляв Air Trigger</string>
|
||||
<string name="air_trigger_right">Десен Air Trigger</string>
|
||||
<string name="air_trigger_button_hint">Запазва се за това разположение</string>
|
||||
<string name="air_triggers_vibration">Вибрация</string>
|
||||
<string name="air_triggers_vibration_hint">Вибрира при докосване на Air Trigger</string>
|
||||
<string name="air_triggers_screen_light">Светлинен ефект на екрана</string>
|
||||
<string name="air_triggers_screen_light_hint">Осветява ръба на екрана под Air Trigger при докосване</string>
|
||||
<string name="air_triggers_led">LED ефекти на атмосферата при докосване</string>
|
||||
<string name="air_triggers_led_off">Изключено</string>
|
||||
<string name="air_triggers_led_steady">Постоянно</string>
|
||||
<string name="air_triggers_led_pulse">Пулсиране</string>
|
||||
<string name="air_trigger_left_action">Действие на левия Air Trigger</string>
|
||||
<string name="air_trigger_right_action">Действие на десния Air Trigger</string>
|
||||
<string name="air_trigger_action_tap">Еднократно докосване</string>
|
||||
<string name="air_trigger_action_hold">Продължително натискане</string>
|
||||
<string name="air_trigger_action_rapid">Бърза стрелба</string>
|
||||
<string name="air_trigger_rapid_settings">Настройки за бърза стрелба</string>
|
||||
<string name="air_trigger_rapid_frequency">Честота на щракване</string>
|
||||
<string name="air_trigger_rate_low">Ниска</string>
|
||||
<string name="air_trigger_rate_normal">Нормална</string>
|
||||
<string name="air_trigger_rate_high">Висока</string>
|
||||
<string name="ctrl_dead_zone">Мъртва зона на стика</string>
|
||||
<string name="ctrl_steam_button">Бутон Steam</string>
|
||||
<string name="ctrl_qam_button">Бутон QAM</string>
|
||||
@@ -2290,7 +2313,6 @@
|
||||
<string name="adbpair_waiting_text">Включи безжичното отстраняване на грешки, после докосни „Чифтосване на устройство с код за чифтосване“.</string>
|
||||
<string name="adbpair_waiting_long">Включи безжичното отстраняване на грешки, после докосни „Чифтосване на устройство с код за чифтосване“. Остани в Настройки: кодът ще се появи в това известие.</string>
|
||||
<string name="adbpair_code_label">6-цифрен код за чифтосване</string>
|
||||
<string name="adbpair_code_hint">Докосни „Въвеждане на код“ и напиши 6-те цифри, показани в Настройки.</string>
|
||||
<string name="adbpair_title_code">Въведи кода за чифтосване по Wi-Fi</string>
|
||||
<string name="adbpair_title_retry">Опитай кода отново</string>
|
||||
<string name="adbpair_enter_code">Въвеждане на код</string>
|
||||
@@ -2317,7 +2339,8 @@
|
||||
<string name="loadstate_steam_client">Изтегляне на клиента на Steam · %1$s</string>
|
||||
<string name="pextra_busy">Вече тече инсталация на инструмент за съвместимост</string>
|
||||
<string name="pextra_stop_session">Спри активната сесия, преди да инсталираш инструменти за съвместимост</string>
|
||||
<string name="pextra_no_release">Не беше намерена ARM64 версия на %1$s</string>
|
||||
<string name="pextra_no_release">Не беше намерена %2$s версия на %1$s</string>
|
||||
<string name="pextra_anticheat">Анти-чийт</string>
|
||||
<string name="pextra_no_space">За инсталирането на %1$s са необходими поне 4 GB свободно място плюс размера на изтеглянето</string>
|
||||
<string name="pextra_downloading">Изтегляне на %1$s %2$s</string>
|
||||
<string name="pextra_retrying">Повторен опит за изтегляне · опит %1$d от %2$d</string>
|
||||
@@ -4170,4 +4193,6 @@
|
||||
<string name="glasses_shortcut_group">Пряк път в играта</string>
|
||||
<string name="glasses_show_shortcut">Показване на прекия път за Smart Glasses</string>
|
||||
<string name="glasses_show_shortcut_hint">Показва плаващия бутон за Smart Glasses върху играта.</string>
|
||||
<string name="display_filter_game_profile">Използва се профил %1$s: %2$s</string>
|
||||
<string name="display_filter_default_profile">Използва се профилът по подразбиране: %1$s</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="flow_controls">Ovládání</string>
|
||||
<string name="flow_game_changes">Změny v této hře: %1$d</string>
|
||||
<string name="flow_buttons">Mapování ovladače</string>
|
||||
<string name="flow_layout">Rozložení na obrazovce</string>
|
||||
<string name="flow_all_settings">Všechna nastavení ovladače</string>
|
||||
<string name="flow_touch_controls">Dotykové ovládání</string>
|
||||
<string name="flow_touch_type">Typ</string>
|
||||
<string name="flow_show">Zobrazit</string>
|
||||
<string name="flow_buttons_hint">Klepněte na tlačítko na obrázku nebo ho stiskněte na ovladači. Tlačítka na obrazovce se nastavují v Rozložení na obrazovce.</string>
|
||||
<string name="flow_press">Stisknout tlačítko</string>
|
||||
<string name="flow_press_now">Stiskněte tlačítko na ovladači…</string>
|
||||
<string name="flow_more_buttons">Tlačítka zařízení a další klávesy</string>
|
||||
<string name="flow_other_controls">Další ovládací prvky</string>
|
||||
<string name="flow_profile_binding">Sdílené výchozí: %1$s</string>
|
||||
<string name="flow_duplicate">Duplikovat</string>
|
||||
<string name="flow_appearance">Název a vzhled</string>
|
||||
<string name="flow_grid_fine">Jemná mřížka</string>
|
||||
<string name="flow_grid_coarse">Hrubá mřížka</string>
|
||||
<string name="flow_games">Hry s vlastními úpravami</string>
|
||||
<string name="flow_games_hint">Ovládání hry změníte v nabídce, když hra běží.</string>
|
||||
<string name="flow_default_for">Výchozí pro</string>
|
||||
<string name="flow_both_modes">Oba režimy</string>
|
||||
<string name="flow_no_mode">Žádný</string>
|
||||
<string name="flow_used_games">Hry, které ho připnuly: %1$d</string>
|
||||
<string name="flow_mine">Moje</string>
|
||||
<string name="flow_community">Komunita</string>
|
||||
<string name="flow_community_hint">Rozložení sdílená hráči Winlatoru. Jejich tlačítka posílají klávesy klávesnice a myši.</string>
|
||||
<string name="flow_community_failed">Sdílená rozložení se nepodařilo načíst. Zkontrolujte připojení a zkuste to znovu.</string>
|
||||
<string name="flow_preview">Náhled</string>
|
||||
<string name="flow_use">Použít</string>
|
||||
<string name="flow_loading">Načítání…</string>
|
||||
<string name="flow_profile_game">Standardní</string>
|
||||
<string name="flow_profile_desktop">Standardní plocha</string>
|
||||
<string name="flow_apply_to">Použít změny pro</string>
|
||||
<string name="flow_route_pad">Gamepad</string>
|
||||
<string name="flow_route_keys">Klávesnice a myš</string>
|
||||
<string name="flow_route_none">Nic</string>
|
||||
<string name="flow_acts_as">Funguje jako</string>
|
||||
<string name="flow_steam_remap_hint">Steam Input umí tlačítka také přemapovat. Měňte tlačítko tady, nebo ve Steamu, ne na obou místech.</string>
|
||||
<string name="flow_mouse_touch">Myš a dotyk</string>
|
||||
<string name="flow_editor_hint">Přetažením přesunete, tažením za roh změníte velikost. Klepnutím na ovládací prvek nastavíte, co dělá.</string>
|
||||
<string name="flow_snap_controls">K ostatním prvkům</string>
|
||||
<string name="flow_default_profile">Řídit se výchozím (%1$s)</string>
|
||||
<string name="flow_size_overall">Celková velikost</string>
|
||||
<string name="flow_size_layout">Měřítko rozložení</string>
|
||||
<string name="flow_size_control">Velikost</string>
|
||||
<string name="flow_as_itself">%1$s (beze změny)</string>
|
||||
<string name="flow_show_steam_qam">Tlačítka Steam a QAM</string>
|
||||
<string name="flow_second_screen_hint">Zobrazí se na druhé obrazovce, když je její nabídka relace nastavená na Ovládání profilu.</string>
|
||||
<string name="flow_press_other">Toto tlačítko na obrázku není. Nastavte ho v Tlačítka zařízení a další klávesy.</string>
|
||||
<string name="flow_in_use_game">Používá se v herním režimu</string>
|
||||
<string name="flow_in_use_desktop">Používá se v režimu plochy</string>
|
||||
<string name="flow_in_use_both">Používá se v obou režimech</string>
|
||||
<string name="flow_shared_defaults">Sdílené výchozí</string>
|
||||
<string name="flow_shared_defaults_of">Sdílené výchozí (%1$s)</string>
|
||||
<string name="flow_editing">Úpravy: %1$s</string>
|
||||
<string name="flow_clear_overrides">Obnovit ovládání této hry na sdílené výchozí</string>
|
||||
<string name="flow_clear_overrides_hint">Týká se jen hry %1$s</string>
|
||||
<string name="flow_clear">Vymazat</string>
|
||||
<string name="flow_portrait">Na výšku</string>
|
||||
<string name="flow_landscape">Na šířku</string>
|
||||
<string name="flow_landscape_separate">Režim na šířku má vlastní pozice.</string>
|
||||
<string name="flow_portrait_separate">Režim na výšku má vlastní pozice.</string>
|
||||
<string name="flow_clear_title">Obnovit sdílené výchozí pro %1$s?</string>
|
||||
<string name="flow_clear_body">Vymaže přemapování ovladače, rozložení na výšku i na šířku a připnutý profil hry %1$s. Sdílené výchozí se nezmění.</string>
|
||||
<string name="flow_changes_count">Změny: %1$d</string>
|
||||
<string name="flow_mode_override_hint">%1$s používá profil vybraný v nabídce relace. Výchozí obnovíte volbou Řídit se výchozím.</string>
|
||||
<string name="flow_scope_every_game">Platí pro všechny hry.</string>
|
||||
<string name="flow_scope_this_game">Uloženo jen pro tuto hru.</string>
|
||||
<string name="flow_remap">Přemapovat</string>
|
||||
</resources>
|
||||
@@ -21,7 +21,6 @@
|
||||
<string name="input_edit_layout">Upravit na obrazovce</string>
|
||||
<string name="input_saved_layouts">Uložená rozložení…</string>
|
||||
<string name="input_saved_layouts_hint">Vyberte rozložení nebo si vytvořte vlastní</string>
|
||||
<string name="input_second_screen_enable">V menu relace vedlejší obrazovky vyberte Ovládání profilu. Volby Profil a Vedlejší obrazovka v menu ovladače určují, které ovládání se zobrazí.</string>
|
||||
<string name="input_assign_actions">Akce tlačítek</string>
|
||||
<string name="input_shared_with">Sdíleno s %1$s. Úpravy se projeví i v těchto profilech.</string>
|
||||
<string name="input_reuse">Znovu použít nastavení</string>
|
||||
@@ -83,7 +82,6 @@
|
||||
<string name="input_profile">Profil</string>
|
||||
<string name="input_mouse_gestures">Gesta touchpadu myši</string>
|
||||
<string name="input_mouse_gestures_hint">Při přiřazení k ukazateli myši: klepnutím kliknete, podržením táhnete a dvěma prsty posouváte.</string>
|
||||
<string name="input_quick_override_hint">%1$s má přepsání rychlé nabídky. Vyberte Automaticky, chcete-li použít výchozí profil a všechny tři uložené části.</string>
|
||||
<string name="input_route_local">Vstup DroidDeck</string>
|
||||
<string name="input_axis_action_hint" formatted="false">Drženo, když je páčka vychýlena jakýmkoli směrem: stisk nad 55 %, uvolnění pod 35 %. Pomocí Směrových kláves přiřaďte každý směr zvlášť. Příkazy DroidDeck se spustí jednou za vychýlení. Kliknutí páčky se nastavuje zvlášť.</string>
|
||||
<string name="input_contact_action_hint">Drženo při dotyku touchpadu; uvolněno při zvednutí prstu. Příkazy DroidDeck se spustí jednou za dotyk. Kliknutí touchpadu se nastavuje zvlášť.</string>
|
||||
|
||||
@@ -283,7 +283,6 @@
|
||||
<string name="mode_pen_touch">Dotyk</string>
|
||||
<string name="mode_pen_button">Boční tlačítko</string>
|
||||
<string name="mode_osc">Ovládání na obrazovce</string>
|
||||
<string name="mode_osc_qam">Steam + QAM</string>
|
||||
<string name="mode_osc_note">Automaticky zobrazí ovládání, pokud není připojen žádný ovladač.</string>
|
||||
<string name="osc_steam_touch">Dotykové ovládání Steamu (beta)</string>
|
||||
<string name="osc_style_next_session">Dotykové ovládání Steamu se spustí od příští relace Steamu</string>
|
||||
@@ -885,7 +884,6 @@
|
||||
<string name="setup_game_debug_logs_hint">Při dalším spuštění hry zahrnout diagnostiku Protonu, Wine a grafiky. Může snížit výkon a zabrat více úložiště.</string>
|
||||
<string name="setup_game_debug_logs_restart">Pro ukládání ladicích protokolů her restartujte tuto relaci</string>
|
||||
<string name="setup_logging_update_failed">Protokolování se nepodařilo změnit. Zkontrolujte přepínač a zkuste to znovu.</string>
|
||||
<string name="setup_agent_commands">Nástroje pro ladění</string>
|
||||
<string name="setup_graphics_logs">Podrobné protokoly grafiky</string>
|
||||
<string name="setup_steam_gpu_drawing">Rozhraní Steam: vykreslování na GPU</string>
|
||||
<string name="setup_steam_gpu_drawing_hint">S párem ovladačů Xclipse vykresluje Steam své stránky softwarově (vykreslování na GPU zobrazovalo poškozené dlaždice). Pokud na tomto telefonu vypadá správně, zapněte tuto možnost pro rychlejší rozhraní Steam.</string>
|
||||
@@ -1323,6 +1321,31 @@
|
||||
<string name="ctrl_size">Velikost tlačítek</string>
|
||||
<string name="ctrl_adaptive">Adaptivní páčky</string>
|
||||
<string name="ctrl_rumble">Vibrace ve hře</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Otevřít</string>
|
||||
<string name="air_triggers_use">Používat Air Triggers</string>
|
||||
<string name="air_triggers_use_hint">Zapne ramenní triggery bez panelu a značek RedMagic. Místo toho mačkají tlačítka dotykového rozložení.</string>
|
||||
<string name="air_trigger_left">Levý Air Trigger</string>
|
||||
<string name="air_trigger_right">Pravý Air Trigger</string>
|
||||
<string name="air_trigger_button_hint">Uloženo pro toto rozložení</string>
|
||||
<string name="air_triggers_vibration">Vibrace</string>
|
||||
<string name="air_triggers_vibration_hint">Při dotyku Air Triggeru zavibruje</string>
|
||||
<string name="air_triggers_screen_light">Světelný efekt na obrazovce</string>
|
||||
<string name="air_triggers_screen_light_hint">Při dotyku rozsvítí okraj obrazovky pod Air Triggerem</string>
|
||||
<string name="air_triggers_led">LED efekty atmosféry při dotyku</string>
|
||||
<string name="air_triggers_led_off">Vypnuto</string>
|
||||
<string name="air_triggers_led_steady">Stálé</string>
|
||||
<string name="air_triggers_led_pulse">Pulzování</string>
|
||||
<string name="air_trigger_left_action">Akce levého Air Triggeru</string>
|
||||
<string name="air_trigger_right_action">Akce pravého Air Triggeru</string>
|
||||
<string name="air_trigger_action_tap">Jedno klepnutí</string>
|
||||
<string name="air_trigger_action_hold">Dlouhé stisknutí</string>
|
||||
<string name="air_trigger_action_rapid">Rychlá palba</string>
|
||||
<string name="air_trigger_rapid_settings">Nastavení rychlé palby</string>
|
||||
<string name="air_trigger_rapid_frequency">Frekvence kliknutí</string>
|
||||
<string name="air_trigger_rate_low">Nízká</string>
|
||||
<string name="air_trigger_rate_normal">Normální</string>
|
||||
<string name="air_trigger_rate_high">Vysoká</string>
|
||||
<string name="ctrl_dead_zone">Mrtvá zóna páčky</string>
|
||||
<string name="ctrl_steam_button">Tlačítko Steam</string>
|
||||
<string name="ctrl_qam_button">Tlačítko QAM</string>
|
||||
@@ -2342,7 +2365,6 @@
|
||||
<string name="adbpair_waiting_text">Zapněte bezdrátové ladění a pak klepněte na „Párování zařízení pomocí párovacího kódu“.</string>
|
||||
<string name="adbpair_waiting_long">Zapněte bezdrátové ladění a pak klepněte na „Párování zařízení pomocí párovacího kódu“. Zůstaňte v Nastavení: kód se zobrazí v tomto oznámení.</string>
|
||||
<string name="adbpair_code_label">6místný párovací kód</string>
|
||||
<string name="adbpair_code_hint">Klepněte na Zadat kód a napište 6 číslic zobrazených v Nastavení.</string>
|
||||
<string name="adbpair_title_code">Zadejte párovací kód Wi-Fi</string>
|
||||
<string name="adbpair_title_retry">Zkusit kód znovu</string>
|
||||
<string name="adbpair_enter_code">Zadat kód</string>
|
||||
@@ -2369,7 +2391,8 @@
|
||||
<string name="loadstate_steam_client">Stahování klienta Steam · %1$s</string>
|
||||
<string name="pextra_busy">Instalace nástroje kompatibility už běží</string>
|
||||
<string name="pextra_stop_session">Před instalací nástrojů kompatibility zastavte aktivní relaci</string>
|
||||
<string name="pextra_no_release">Nepodařilo se najít vydání ARM64 pro %1$s</string>
|
||||
<string name="pextra_no_release">Nepodařilo se najít vydání %2$s pro %1$s</string>
|
||||
<string name="pextra_anticheat">Anti-cheat</string>
|
||||
<string name="pextra_no_space">Pro instalaci %1$s je potřeba alespoň 4 GB volného místa navíc k velikosti stahování</string>
|
||||
<string name="pextra_downloading">Stahování %1$s %2$s</string>
|
||||
<string name="pextra_retrying">Opakování stahování · pokus %1$d z %2$d</string>
|
||||
@@ -4250,4 +4273,6 @@
|
||||
<string name="glasses_shortcut_group">Zkratka ve hře</string>
|
||||
<string name="glasses_show_shortcut">Zobrazit zkratku Smart Glasses</string>
|
||||
<string name="glasses_show_shortcut_hint">Zobrazit plovoucí tlačítko Smart Glasses nad hrou.</string>
|
||||
<string name="display_filter_game_profile">Používá se profil %1$s: %2$s</string>
|
||||
<string name="display_filter_default_profile">Používá se výchozí profil: %1$s</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="flow_controls">Styring</string>
|
||||
<string name="flow_game_changes">Ændringer i dette spil: %1$d</string>
|
||||
<string name="flow_buttons">Controller-tildelinger</string>
|
||||
<string name="flow_layout">Skærmlayout</string>
|
||||
<string name="flow_all_settings">Alle controllerindstillinger</string>
|
||||
<string name="flow_touch_controls">Touchstyring</string>
|
||||
<string name="flow_touch_type">Type</string>
|
||||
<string name="flow_show">Vis</string>
|
||||
<string name="flow_buttons_hint">Tryk på en knap på tegningen, eller tryk på den på din controller. Knapper på skærmen indstilles under Layout på skærmen.</string>
|
||||
<string name="flow_press">Tryk på en knap</string>
|
||||
<string name="flow_press_now">Tryk på en knap på din controller…</string>
|
||||
<string name="flow_more_buttons">Enhedsknapper og ekstra taster</string>
|
||||
<string name="flow_other_controls">Andre kontroller</string>
|
||||
<string name="flow_profile_binding">Brug fælles standard: %1$s</string>
|
||||
<string name="flow_duplicate">Dupliker</string>
|
||||
<string name="flow_appearance">Navn og udseende</string>
|
||||
<string name="flow_grid_fine">Fint gitter</string>
|
||||
<string name="flow_grid_coarse">Groft gitter</string>
|
||||
<string name="flow_games">Spil med tilpasninger</string>
|
||||
<string name="flow_games_hint">Skift et spils styring i menuen, mens det kører.</string>
|
||||
<string name="flow_default_for">Standard for</string>
|
||||
<string name="flow_both_modes">Begge tilstande</string>
|
||||
<string name="flow_no_mode">Ingen</string>
|
||||
<string name="flow_used_games">Spil, der har fastgjort den: %1$d</string>
|
||||
<string name="flow_mine">Mine</string>
|
||||
<string name="flow_community">Fællesskab</string>
|
||||
<string name="flow_community_hint">Layouts delt af Winlator-spillere. Deres knapper sender tastatur- og musetaster.</string>
|
||||
<string name="flow_community_failed">Kunne ikke indlæse de delte layouts. Tjek forbindelsen, og prøv igen.</string>
|
||||
<string name="flow_preview">Forhåndsvis</string>
|
||||
<string name="flow_use">Brug</string>
|
||||
<string name="flow_loading">Indlæser…</string>
|
||||
<string name="flow_profile_game">Standard</string>
|
||||
<string name="flow_profile_desktop">Standardskrivebord</string>
|
||||
<string name="flow_apply_to">Anvend ændringer på</string>
|
||||
<string name="flow_route_pad">Gamepad</string>
|
||||
<string name="flow_route_keys">Tastatur og mus</string>
|
||||
<string name="flow_route_none">Intet</string>
|
||||
<string name="flow_acts_as">Virker som</string>
|
||||
<string name="flow_steam_remap_hint">Steam Input kan også omtildele knapper. Skift en knap her eller i Steam, ikke begge steder.</string>
|
||||
<string name="flow_mouse_touch">Mus og berøring</string>
|
||||
<string name="flow_editor_hint">Træk for at flytte, træk i et hjørne for at ændre størrelse. Tryk på en kontrol for at vælge, hvad den gør.</string>
|
||||
<string name="flow_snap_controls">Til andre kontroller</string>
|
||||
<string name="flow_default_profile">Følg standarden (%1$s)</string>
|
||||
<string name="flow_size_overall">Samlet størrelse</string>
|
||||
<string name="flow_size_layout">Layoutskala</string>
|
||||
<string name="flow_size_control">Størrelse</string>
|
||||
<string name="flow_as_itself">%1$s (uændret)</string>
|
||||
<string name="flow_show_steam_qam">Steam- og QAM-knapper</string>
|
||||
<string name="flow_second_screen_hint">Vises på den anden skærm, når dens sessionsmenu er sat til Profilkontroller.</string>
|
||||
<string name="flow_press_other">Den knap er ikke på tegningen. Indstil den under Enhedsknapper og ekstra taster.</string>
|
||||
<string name="flow_in_use_game">I brug i spiltilstand</string>
|
||||
<string name="flow_in_use_desktop">I brug i skrivebordstilstand</string>
|
||||
<string name="flow_in_use_both">I brug i begge tilstande</string>
|
||||
<string name="flow_shared_defaults">Fælles standarder</string>
|
||||
<string name="flow_shared_defaults_of">Fælles standarder (%1$s)</string>
|
||||
<string name="flow_editing">Redigerer: %1$s</string>
|
||||
<string name="flow_clear_overrides">Gendan dette spils kontroller til fælles standarder</string>
|
||||
<string name="flow_clear_overrides_hint">Kun %1$s påvirkes</string>
|
||||
<string name="flow_clear">Ryd</string>
|
||||
<string name="flow_portrait">Stående</string>
|
||||
<string name="flow_landscape">Liggende</string>
|
||||
<string name="flow_landscape_separate">Liggende beholder sine egne placeringer.</string>
|
||||
<string name="flow_portrait_separate">Stående beholder sine egne placeringer.</string>
|
||||
<string name="flow_clear_title">Gendan fælles standarder for %1$s?</string>
|
||||
<string name="flow_clear_body">Dette rydder %1$s’s controller-omtildelinger, stående og liggende layouts og en fastgjort profil. Fælles standarder ændres ikke.</string>
|
||||
<string name="flow_changes_count">Ændringer: %1$d</string>
|
||||
<string name="flow_mode_override_hint">%1$s bruger en profil valgt i sessionsmenuen. Vælg Følg standarden der for at bruge standarden igen.</string>
|
||||
<string name="flow_scope_every_game">Gælder for alle spil.</string>
|
||||
<string name="flow_scope_this_game">Gemt kun for dette spil.</string>
|
||||
<string name="flow_remap">Omtildel</string>
|
||||
</resources>
|
||||
@@ -21,7 +21,6 @@
|
||||
<string name="input_edit_layout">Rediger på skærmen</string>
|
||||
<string name="input_saved_layouts">Gemte layouts…</string>
|
||||
<string name="input_saved_layouts_hint">Vælg et layout, eller opret dit eget</string>
|
||||
<string name="input_second_screen_enable">Vælg Profilbetjening i sekundærskærmens sessionsmenu. Valgene Profil og Sekundær skærm i controllermenuen bestemmer, hvilken betjening der vises.</string>
|
||||
<string name="input_assign_actions">Knaphandlinger</string>
|
||||
<string name="input_shared_with">Delt med %1$s. Ændringer gælder også for disse profiler.</string>
|
||||
<string name="input_reuse">Genbrug indstillinger</string>
|
||||
@@ -83,7 +82,6 @@
|
||||
<string name="input_profile">Profil</string>
|
||||
<string name="input_mouse_gestures">Musetouchpadbevægelser</string>
|
||||
<string name="input_mouse_gestures_hint">Når tildelt musemarkøren: tryk for at klikke, hold for at trække, og rul med to fingre.</string>
|
||||
<string name="input_quick_override_hint">%1$s har en tilsidesættelse af hurtigmenuen. Vælg Auto for at bruge dens standardprofil og alle tre gemte dele.</string>
|
||||
<string name="input_route_local">DroidDeck-input</string>
|
||||
<string name="input_axis_action_hint" formatted="false">Holdes, mens styrepinden flyttes i en vilkårlig retning: tryk over 55 %, slip under 35 %. Brug Retningstaster til at tildele hver retning separat. DroidDeck-kommandoer kører én gang pr. udsving. Stikklikket konfigureres separat.</string>
|
||||
<string name="input_contact_action_hint">Holdes, mens du rører touchpadden; slippes, når du løfter fingeren. DroidDeck-kommandoer kører én gang pr. berøring. Touchpadklikket konfigureres separat.</string>
|
||||
|
||||
@@ -283,7 +283,6 @@
|
||||
<string name="mode_pen_touch">Berøring</string>
|
||||
<string name="mode_pen_button">Sideknap</string>
|
||||
<string name="mode_osc">Kontroller på skærmen</string>
|
||||
<string name="mode_osc_qam">Steam + QAM</string>
|
||||
<string name="mode_osc_note">Auto viser kontrollerne, når ingen controller er tilsluttet.</string>
|
||||
<string name="osc_steam_touch">Steam-berøring (beta)</string>
|
||||
<string name="osc_style_next_session">Steams berøringskontroller starter med næste Steam-session</string>
|
||||
@@ -879,7 +878,6 @@
|
||||
<string name="setup_game_debug_logs_hint">Medtag Proton-, Wine- og grafikdiagnostik ved næste spilstart. Kan reducere ydelsen og bruge mere lagerplads.</string>
|
||||
<string name="setup_game_debug_logs_restart">Genstart denne session for at gemme fejlfindingslogs for spil</string>
|
||||
<string name="setup_logging_update_failed">Kunne ikke opdatere logning. Tjek kontakten, og prøv igen.</string>
|
||||
<string name="setup_agent_commands">Fejlfindingsværktøjer</string>
|
||||
<string name="setup_graphics_logs">Detaljerede grafiklogfiler</string>
|
||||
<string name="setup_steam_gpu_drawing">Steam-brugerflade: GPU-tegning</string>
|
||||
<string name="setup_steam_gpu_drawing_hint">Med Xclipse-driverparret tegner Steam sine sider i software (GPU-tegning gav ødelagte fliser). Slå til for en hurtigere Steam-brugerflade, hvis det ser rigtigt ud på denne telefon.</string>
|
||||
@@ -1309,6 +1307,31 @@
|
||||
<string name="ctrl_size">Knapstørrelse</string>
|
||||
<string name="ctrl_adaptive">Adaptive styrepinde</string>
|
||||
<string name="ctrl_rumble">Spilvibration</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Åbn</string>
|
||||
<string name="air_triggers_use">Brug Air Triggers</string>
|
||||
<string name="air_triggers_use_hint">Tænder skuldertriggerne uden RedMagics triggerpanel eller markører. De trykker i stedet på knapper i touch-layoutet.</string>
|
||||
<string name="air_trigger_left">Venstre Air Trigger</string>
|
||||
<string name="air_trigger_right">Højre Air Trigger</string>
|
||||
<string name="air_trigger_button_hint">Gemt for dette layout</string>
|
||||
<string name="air_triggers_vibration">Vibration</string>
|
||||
<string name="air_triggers_vibration_hint">Vibrerer, når en Air Trigger berøres</string>
|
||||
<string name="air_triggers_screen_light">Lyseffekt på skærmen</string>
|
||||
<string name="air_triggers_screen_light_hint">Lyser skærmkanten op under en Air Trigger, når den berøres</string>
|
||||
<string name="air_triggers_led">LED-stemningseffekter ved berøring</string>
|
||||
<string name="air_triggers_led_off">Fra</string>
|
||||
<string name="air_triggers_led_steady">Konstant</string>
|
||||
<string name="air_triggers_led_pulse">Puls</string>
|
||||
<string name="air_trigger_left_action">Handling for venstre Air Trigger</string>
|
||||
<string name="air_trigger_right_action">Handling for højre Air Trigger</string>
|
||||
<string name="air_trigger_action_tap">Enkelt tryk</string>
|
||||
<string name="air_trigger_action_hold">Langt tryk</string>
|
||||
<string name="air_trigger_action_rapid">Hurtig affyring</string>
|
||||
<string name="air_trigger_rapid_settings">Indstillinger for hurtig affyring</string>
|
||||
<string name="air_trigger_rapid_frequency">Klikfrekvens</string>
|
||||
<string name="air_trigger_rate_low">Lav</string>
|
||||
<string name="air_trigger_rate_normal">Normal</string>
|
||||
<string name="air_trigger_rate_high">Høj</string>
|
||||
<string name="ctrl_dead_zone">Dødzone for styrepind</string>
|
||||
<string name="ctrl_steam_button">Steam-knap</string>
|
||||
<string name="ctrl_qam_button">QAM-knap</string>
|
||||
@@ -2290,7 +2313,6 @@
|
||||
<string name="adbpair_waiting_text">Tænd Trådløs fejlretning, og tryk derefter på „Par enhed med parringskode“.</string>
|
||||
<string name="adbpair_waiting_long">Tænd Trådløs fejlretning, og tryk derefter på „Par enhed med parringskode“. Bliv i Indstillinger: koden vises i denne notifikation.</string>
|
||||
<string name="adbpair_code_label">6-cifret parringskode</string>
|
||||
<string name="adbpair_code_hint">Tryk på Indtast kode, og skriv de 6 cifre, der vises i Indstillinger.</string>
|
||||
<string name="adbpair_title_code">Indtast Wi-Fi-parringskoden</string>
|
||||
<string name="adbpair_title_retry">Forsøg koden igen</string>
|
||||
<string name="adbpair_enter_code">Indtast kode</string>
|
||||
@@ -2317,7 +2339,8 @@
|
||||
<string name="loadstate_steam_client">Downloader Steam-klienten · %1$s</string>
|
||||
<string name="pextra_busy">En installation af et kompatibilitetsværktøj er allerede i gang</string>
|
||||
<string name="pextra_stop_session">Stop den aktive session, før du installerer kompatibilitetsværktøjer</string>
|
||||
<string name="pextra_no_release">Kunne ikke finde en ARM64-udgivelse af %1$s</string>
|
||||
<string name="pextra_no_release">Kunne ikke finde en %2$s-udgivelse af %1$s</string>
|
||||
<string name="pextra_anticheat">Anti-cheat</string>
|
||||
<string name="pextra_no_space">Mindst 4 GB ledig plads plus downloadets størrelse er nødvendig for at installere %1$s</string>
|
||||
<string name="pextra_downloading">Downloader %1$s %2$s</string>
|
||||
<string name="pextra_retrying">Forsøger download igen · forsøg %1$d af %2$d</string>
|
||||
@@ -4170,4 +4193,6 @@
|
||||
<string name="glasses_shortcut_group">Genvej i spillet</string>
|
||||
<string name="glasses_show_shortcut">Vis Smart Glasses-genvej</string>
|
||||
<string name="glasses_show_shortcut_hint">Vis den flydende Smart Glasses-knap oven på spillet.</string>
|
||||
<string name="display_filter_game_profile">Bruger profilen %1$s: %2$s</string>
|
||||
<string name="display_filter_default_profile">Bruger standardprofilen: %1$s</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="flow_controls">Steuerung</string>
|
||||
<string name="flow_game_changes">Änderungen in diesem Spiel: %1$d</string>
|
||||
<string name="flow_buttons">Controller-Belegung</string>
|
||||
<string name="flow_layout">Bildschirm-Layout</string>
|
||||
<string name="flow_all_settings">Alle Controller-Einstellungen</string>
|
||||
<string name="flow_touch_controls">Touch-Steuerung</string>
|
||||
<string name="flow_touch_type">Art</string>
|
||||
<string name="flow_show">Anzeigen</string>
|
||||
<string name="flow_buttons_hint">Tippe auf eine Taste in der Zeichnung oder drücke sie am Controller. Bildschirmtasten stellst du unter Bildschirm-Layout ein.</string>
|
||||
<string name="flow_press">Taste drücken</string>
|
||||
<string name="flow_press_now">Drücke eine Taste auf deinem Controller…</string>
|
||||
<string name="flow_more_buttons">Gerätetasten und Zusatztasten</string>
|
||||
<string name="flow_other_controls">Weitere Steuerelemente</string>
|
||||
<string name="flow_profile_binding">Gemeinsamen Standard nutzen: %1$s</string>
|
||||
<string name="flow_duplicate">Duplizieren</string>
|
||||
<string name="flow_appearance">Name und Aussehen</string>
|
||||
<string name="flow_grid_fine">Feines Raster</string>
|
||||
<string name="flow_grid_coarse">Grobes Raster</string>
|
||||
<string name="flow_games">Spiele mit Anpassungen</string>
|
||||
<string name="flow_games_hint">Ändere die Steuerung eines Spiels im Menü, während es läuft.</string>
|
||||
<string name="flow_default_for">Standard für</string>
|
||||
<string name="flow_both_modes">Beide Modi</string>
|
||||
<string name="flow_no_mode">Keiner</string>
|
||||
<string name="flow_used_games">Festlegende Spiele: %1$d</string>
|
||||
<string name="flow_mine">Meine</string>
|
||||
<string name="flow_community">Community</string>
|
||||
<string name="flow_community_hint">Von Winlator-Spielern geteilte Layouts. Ihre Tasten senden Tastatur- und Maustasten.</string>
|
||||
<string name="flow_community_failed">Die geteilten Layouts konnten nicht geladen werden. Prüfe die Verbindung und versuche es erneut.</string>
|
||||
<string name="flow_preview">Vorschau</string>
|
||||
<string name="flow_use">Verwenden</string>
|
||||
<string name="flow_loading">Wird geladen…</string>
|
||||
<string name="flow_profile_game">Standard</string>
|
||||
<string name="flow_profile_desktop">Standard-Desktop</string>
|
||||
<string name="flow_apply_to">Änderungen anwenden auf</string>
|
||||
<string name="flow_route_pad">Gamepad</string>
|
||||
<string name="flow_route_keys">Tastatur und Maus</string>
|
||||
<string name="flow_route_none">Nichts</string>
|
||||
<string name="flow_acts_as">Wirkt als</string>
|
||||
<string name="flow_steam_remap_hint">Steam Input kann Tasten ebenfalls neu belegen. Ändere eine Taste hier oder in Steam, nicht an beiden Stellen.</string>
|
||||
<string name="flow_mouse_touch">Maus und Touch</string>
|
||||
<string name="flow_editor_hint">Ziehen zum Verschieben, an einer Ecke ziehen zum Skalieren. Tippe auf ein Element, um seine Aktion festzulegen.</string>
|
||||
<string name="flow_snap_controls">An anderen Elementen</string>
|
||||
<string name="flow_default_profile">Standard folgen (%1$s)</string>
|
||||
<string name="flow_size_overall">Gesamtgröße</string>
|
||||
<string name="flow_size_layout">Layout-Skalierung</string>
|
||||
<string name="flow_size_control">Größe</string>
|
||||
<string name="flow_as_itself">%1$s (unverändert)</string>
|
||||
<string name="flow_show_steam_qam">Steam- und QAM-Tasten</string>
|
||||
<string name="flow_second_screen_hint">Wird auf dem zweiten Bildschirm angezeigt, wenn sein Sitzungsmenü auf Profilsteuerung steht.</string>
|
||||
<string name="flow_press_other">Diese Taste ist nicht in der Zeichnung. Lege sie unter Gerätetasten und Zusatztasten fest.</string>
|
||||
<string name="flow_in_use_game">Im Spielmodus aktiv</string>
|
||||
<string name="flow_in_use_desktop">Im Desktopmodus aktiv</string>
|
||||
<string name="flow_in_use_both">In beiden Modi aktiv</string>
|
||||
<string name="flow_shared_defaults">Gemeinsame Standards</string>
|
||||
<string name="flow_shared_defaults_of">Gemeinsame Standards (%1$s)</string>
|
||||
<string name="flow_editing">Bearbeitet: %1$s</string>
|
||||
<string name="flow_clear_overrides">Steuerung dieses Spiels auf gemeinsame Standards zurücksetzen</string>
|
||||
<string name="flow_clear_overrides_hint">Betrifft nur %1$s</string>
|
||||
<string name="flow_clear">Löschen</string>
|
||||
<string name="flow_portrait">Hochformat</string>
|
||||
<string name="flow_landscape">Querformat</string>
|
||||
<string name="flow_landscape_separate">Das Querformat behält eigene Positionen.</string>
|
||||
<string name="flow_portrait_separate">Das Hochformat behält eigene Positionen.</string>
|
||||
<string name="flow_clear_title">Gemeinsame Standards für %1$s wiederherstellen?</string>
|
||||
<string name="flow_clear_body">Löscht die Tastenbelegungen, Hoch- und Querformat-Layouts und ein angeheftetes Profil von %1$s. Die gemeinsamen Standards bleiben unverändert.</string>
|
||||
<string name="flow_changes_count">Änderungen: %1$d</string>
|
||||
<string name="flow_mode_override_hint">%1$s nutzt ein im Sitzungsmenü gewähltes Profil. Wähle dort Standard folgen, um wieder den Standard zu nutzen.</string>
|
||||
<string name="flow_scope_every_game">Gilt für alle Spiele.</string>
|
||||
<string name="flow_scope_this_game">Nur für dieses Spiel gespeichert.</string>
|
||||
<string name="flow_remap">Neu belegen</string>
|
||||
</resources>
|
||||
Loaded 100 of 295 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user