diff --git a/README.md b/README.md index 444107fa32..7154309b06 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Help, Preview builds and device reports are on [Discord](https://discord.gg/JRGA ## Build -Needs Docker, Java 17, the Android SDK and NDK, Rust via rustup, GitHub CLI, Python 3 and `zstd`. +Needs Docker, Java 17, the Android SDK and NDK, Rust via rustup, Go, a host C compiler, the x86_64 and i686 MinGW-w64 compilers (i686 with DWARF-2 exceptions, as Debian and Ubuntu ship it; SJLJ builds such as Homebrew's cannot link Rust's `i686-pc-windows-gnu`), GitHub CLI, Python 3 and `zstd`. On x86_64 Linux, Docker also needs an arm64 binfmt handler (`docker run --privileged --rm tonistiigi/binfmt --install arm64`). ```bash tools/build_local.sh diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0b4ea04725..aff5658bbe 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -4,6 +4,9 @@ + + + diff --git a/app/src/main/cpp/shaders/smaa.frag b/app/src/main/cpp/shaders/smaa.frag index e6095db9ad..55160fdcff 100644 --- a/app/src/main/cpp/shaders/smaa.frag +++ b/app/src/main/cpp/shaders/smaa.frag @@ -85,17 +85,16 @@ void main() { float crossingPattern = smoothstep(threshold, threshold * 2.5, crossingContrast); float areaWeight = 0.38 * crossingPattern * clamp(span / 4.0, 0.0, 1.0); float diagonalContrast = max(abs(nw - se), abs(ne - sw)); - float cornerFactor = 1.0 - 0.18 * smoothstep(threshold, threshold * 3.0, diagonalContrast); + float cornerFactor = 1.0 - 0.35 * smoothstep(threshold, threshold * 3.0, diagonalContrast); float baseWeight = areaWeight * endpointArea * edgeConfidence * cornerFactor; - float diagonalStrength = abs(abs(nw - se) - abs(ne - sw)); + float diagonalStrength = min(vertical, horizontal); float diagonalPattern = smoothstep(threshold, threshold * 2.5, diagonalStrength); - float diagonalFallback = 0.16 * diagonalPattern * edgeConfidence * cornerFactor; + float diagonalContinuity = smoothstep(1.0, 3.0, span); + float diagonalFallback = 0.16 * diagonalPattern * edgeConfidence + * cornerFactor * diagonalContinuity * crossingPattern; - float weight = clamp( - baseWeight <= 0.0001 ? diagonalFallback : baseWeight, - 0.0, 0.42 - ); + float weight = clamp(max(baseWeight, diagonalFallback), 0.0, 0.42); vec3 across = texture(InputTexture, uv + normal * px).rgb; outColor = vec4(mix(center.rgb, across, weight), center.a); } diff --git a/app/src/main/cpp/shaders/smaa_frag.h b/app/src/main/cpp/shaders/smaa_frag.h index ea8bb4d56a..1467b4efc0 100644 --- a/app/src/main/cpp/shaders/smaa_frag.h +++ b/app/src/main/cpp/shaders/smaa_frag.h @@ -2,7 +2,7 @@ #include static const uint32_t smaa_code[] = { - 0x07230203u, 0x00010000u, 0x0008000bu, 0x00000254u, 0x00000000u, 0x00020011u, 0x00000001u, 0x0006000bu, + 0x07230203u, 0x00010000u, 0x0008000bu, 0x00000251u, 0x00000000u, 0x00020011u, 0x00000001u, 0x0006000bu, 0x00000001u, 0x4c534c47u, 0x6474732eu, 0x3035342eu, 0x00000000u, 0x0003000eu, 0x00000000u, 0x00000001u, 0x0007000fu, 0x00000004u, 0x00000004u, 0x6e69616du, 0x00000000u, 0x00000072u, 0x000000f6u, 0x00030010u, 0x00000004u, 0x00000007u, 0x00030003u, 0x00000002u, 0x000001c2u, 0x00040005u, 0x00000004u, 0x6e69616du, @@ -53,391 +53,391 @@ static const uint32_t smaa_code[] = { 0x00000200u, 0x67616964u, 0x6c616e6fu, 0x746e6f43u, 0x74736172u, 0x00000000u, 0x00060005u, 0x0000020au, 0x6e726f63u, 0x61467265u, 0x726f7463u, 0x00000000u, 0x00050005u, 0x00000214u, 0x65736162u, 0x67696557u, 0x00007468u, 0x00070005u, 0x0000021cu, 0x67616964u, 0x6c616e6fu, 0x65727453u, 0x6874676eu, 0x00000000u, - 0x00060005u, 0x00000227u, 0x67616964u, 0x6c616e6fu, 0x74746150u, 0x006e7265u, 0x00070005u, 0x0000022du, - 0x67616964u, 0x6c616e6fu, 0x6c6c6146u, 0x6b636162u, 0x00000000u, 0x00040005u, 0x00000235u, 0x67696577u, - 0x00007468u, 0x00040005u, 0x0000023eu, 0x6f726361u, 0x00007373u, 0x00040047u, 0x00000025u, 0x00000021u, - 0x00000000u, 0x00040047u, 0x00000025u, 0x00000022u, 0x00000000u, 0x00030047u, 0x00000064u, 0x00000002u, - 0x00050048u, 0x00000064u, 0x00000000u, 0x00000023u, 0x00000000u, 0x00050048u, 0x00000064u, 0x00000001u, - 0x00000023u, 0x00000010u, 0x00050048u, 0x00000064u, 0x00000002u, 0x00000023u, 0x00000018u, 0x00050048u, - 0x00000064u, 0x00000003u, 0x00000023u, 0x0000001cu, 0x00040047u, 0x00000072u, 0x0000001eu, 0x00000000u, - 0x00040047u, 0x000000f6u, 0x0000001eu, 0x00000000u, 0x00020013u, 0x00000002u, 0x00030021u, 0x00000003u, - 0x00000002u, 0x00030016u, 0x00000006u, 0x00000020u, 0x00040017u, 0x00000007u, 0x00000006u, 0x00000003u, - 0x00040020u, 0x00000008u, 0x00000007u, 0x00000007u, 0x00040021u, 0x00000009u, 0x00000006u, 0x00000008u, - 0x00040017u, 0x0000000du, 0x00000006u, 0x00000002u, 0x00040020u, 0x0000000eu, 0x00000007u, 0x0000000du, - 0x00050021u, 0x0000000fu, 0x00000006u, 0x0000000eu, 0x0000000eu, 0x0004002bu, 0x00000006u, 0x00000019u, - 0x3e59b3d0u, 0x0004002bu, 0x00000006u, 0x0000001au, 0x3f371759u, 0x0004002bu, 0x00000006u, 0x0000001bu, - 0x3d93dd98u, 0x0006002cu, 0x00000007u, 0x0000001cu, 0x00000019u, 0x0000001au, 0x0000001bu, 0x00040020u, - 0x00000020u, 0x00000007u, 0x00000006u, 0x00090019u, 0x00000022u, 0x00000006u, 0x00000001u, 0x00000000u, - 0x00000000u, 0x00000000u, 0x00000001u, 0x00000000u, 0x0003001bu, 0x00000023u, 0x00000022u, 0x00040020u, - 0x00000024u, 0x00000000u, 0x00000023u, 0x0004003bu, 0x00000024u, 0x00000025u, 0x00000000u, 0x00040015u, - 0x00000028u, 0x00000020u, 0x00000000u, 0x0004002bu, 0x00000028u, 0x00000029u, 0x00000000u, 0x0004002bu, - 0x00000006u, 0x0000002cu, 0x00000000u, 0x00040017u, 0x0000002fu, 0x00000006u, 0x00000004u, 0x0004002bu, - 0x00000028u, 0x00000048u, 0x00000001u, 0x0004002bu, 0x00000006u, 0x00000063u, 0x3f800000u, 0x0006001eu, - 0x00000064u, 0x0000002fu, 0x0000000du, 0x00000006u, 0x00000006u, 0x00040020u, 0x00000065u, 0x00000009u, - 0x00000064u, 0x0004003bu, 0x00000065u, 0x00000066u, 0x00000009u, 0x00040015u, 0x00000067u, 0x00000020u, - 0x00000001u, 0x0004002bu, 0x00000067u, 0x00000068u, 0x00000001u, 0x00040020u, 0x00000069u, 0x00000009u, - 0x0000000du, 0x0005002cu, 0x0000000du, 0x0000006cu, 0x00000063u, 0x00000063u, 0x00040020u, 0x00000071u, - 0x00000001u, 0x0000000du, 0x0004003bu, 0x00000071u, 0x00000072u, 0x00000001u, 0x0004002bu, 0x00000006u, - 0x00000075u, 0x3f000000u, 0x00040020u, 0x0000007bu, 0x00000007u, 0x0000002fu, 0x0004002bu, 0x00000006u, - 0x000000deu, 0x3d3851ecu, 0x0004002bu, 0x00000006u, 0x000000e0u, 0x3da3d70au, 0x00020014u, 0x000000f1u, - 0x00040020u, 0x000000f5u, 0x00000003u, 0x0000002fu, 0x0004003bu, 0x000000f5u, 0x000000f6u, 0x00000003u, - 0x00040020u, 0x000000f9u, 0x00000007u, 0x000000f1u, 0x0004002bu, 0x00000006u, 0x00000113u, 0xbf800000u, - 0x00040020u, 0x0000011fu, 0x00000007u, 0x00000067u, 0x0004002bu, 0x00000067u, 0x00000127u, 0x00000006u, - 0x0004002bu, 0x00000006u, 0x00000161u, 0x3f266666u, 0x0004002bu, 0x00000006u, 0x00000182u, 0x40200000u, - 0x0004002bu, 0x00000006u, 0x000001cau, 0x3d6147aeu, 0x0004002bu, 0x00000006u, 0x000001f8u, 0x3ec28f5cu, - 0x0004002bu, 0x00000006u, 0x000001fcu, 0x40800000u, 0x0004002bu, 0x00000006u, 0x0000020bu, 0x3e3851ecu, - 0x0004002bu, 0x00000006u, 0x0000020eu, 0x40400000u, 0x0004002bu, 0x00000006u, 0x0000022eu, 0x3e23d70au, - 0x0004002bu, 0x00000006u, 0x00000237u, 0x38d1b717u, 0x0004002bu, 0x00000006u, 0x0000023cu, 0x3ed70a3du, - 0x0004002bu, 0x00000028u, 0x0000024du, 0x00000003u, 0x00050036u, 0x00000002u, 0x00000004u, 0x00000000u, - 0x00000003u, 0x000200f8u, 0x00000005u, 0x0004003bu, 0x0000000eu, 0x00000062u, 0x00000007u, 0x0004003bu, - 0x0000000eu, 0x00000070u, 0x00000007u, 0x0004003bu, 0x0000007bu, 0x0000007cu, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x00000080u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x00000081u, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x00000085u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x0000008du, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x00000090u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x00000098u, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x0000009bu, 0x00000007u, 0x0004003bu, 0x00000008u, 0x000000a3u, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x000000a6u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x000000aeu, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x000000b1u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000000b6u, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x000000bbu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000000c0u, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x000000c5u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000000cfu, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x000000d9u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000000ddu, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x000000e3u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000000e7u, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x000000ebu, 0x00000007u, 0x0004003bu, 0x000000f9u, 0x000000fau, 0x00000007u, 0x0004003bu, - 0x0000000eu, 0x000000feu, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x00000100u, 0x00000007u, 0x0004003bu, - 0x0000000eu, 0x0000010bu, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x0000010du, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x0000011du, 0x00000007u, 0x0004003bu, 0x00000020u, 0x0000011eu, 0x00000007u, 0x0004003bu, - 0x0000011fu, 0x00000120u, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x00000129u, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x0000012eu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x00000130u, 0x00000007u, 0x0004003bu, - 0x0000000eu, 0x00000136u, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x00000137u, 0x00000007u, 0x0004003bu, - 0x0000000eu, 0x0000013eu, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x0000013fu, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x00000143u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x00000145u, 0x00000007u, 0x0004003bu, - 0x0000000eu, 0x0000014bu, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x0000014cu, 0x00000007u, 0x0004003bu, - 0x0000000eu, 0x00000153u, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x00000154u, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x0000017bu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x0000017fu, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x00000186u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x00000192u, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x00000195u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x000001a0u, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x000001a3u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x000001aeu, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x000001b1u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x000001bbu, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x000001beu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000001c7u, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x000001ceu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000001d0u, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x000001ddu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000001dfu, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x000001ecu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000001f1u, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x000001f7u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x00000200u, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x0000020au, 0x00000007u, 0x0004003bu, 0x00000020u, 0x00000214u, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x0000021cu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x00000227u, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x0000022du, 0x00000007u, 0x0004003bu, 0x00000020u, 0x00000235u, 0x00000007u, 0x0004003bu, - 0x00000008u, 0x0000023eu, 0x00000007u, 0x00050041u, 0x00000069u, 0x0000006au, 0x00000066u, 0x00000068u, - 0x0004003du, 0x0000000du, 0x0000006bu, 0x0000006au, 0x0007000cu, 0x0000000du, 0x0000006du, 0x00000001u, - 0x00000028u, 0x0000006bu, 0x0000006cu, 0x00050050u, 0x0000000du, 0x0000006eu, 0x00000063u, 0x00000063u, - 0x00050088u, 0x0000000du, 0x0000006fu, 0x0000006eu, 0x0000006du, 0x0003003eu, 0x00000062u, 0x0000006fu, - 0x0004003du, 0x0000000du, 0x00000073u, 0x00000072u, 0x0004003du, 0x0000000du, 0x00000074u, 0x00000062u, - 0x0005008eu, 0x0000000du, 0x00000076u, 0x00000074u, 0x00000075u, 0x0004003du, 0x0000000du, 0x00000077u, - 0x00000062u, 0x0005008eu, 0x0000000du, 0x00000078u, 0x00000077u, 0x00000075u, 0x00050083u, 0x0000000du, - 0x00000079u, 0x0000006cu, 0x00000078u, 0x0008000cu, 0x0000000du, 0x0000007au, 0x00000001u, 0x0000002bu, - 0x00000073u, 0x00000076u, 0x00000079u, 0x0003003eu, 0x00000070u, 0x0000007au, 0x0004003du, 0x00000023u, - 0x0000007du, 0x00000025u, 0x0004003du, 0x0000000du, 0x0000007eu, 0x00000070u, 0x00050057u, 0x0000002fu, - 0x0000007fu, 0x0000007du, 0x0000007eu, 0x0003003eu, 0x0000007cu, 0x0000007fu, 0x0004003du, 0x0000002fu, - 0x00000082u, 0x0000007cu, 0x0008004fu, 0x00000007u, 0x00000083u, 0x00000082u, 0x00000082u, 0x00000000u, - 0x00000001u, 0x00000002u, 0x0003003eu, 0x00000081u, 0x00000083u, 0x00050039u, 0x00000006u, 0x00000084u, - 0x0000000bu, 0x00000081u, 0x0003003eu, 0x00000080u, 0x00000084u, 0x0004003du, 0x00000023u, 0x00000086u, - 0x00000025u, 0x0004003du, 0x0000000du, 0x00000087u, 0x00000070u, 0x00050041u, 0x00000020u, 0x00000088u, - 0x00000062u, 0x00000029u, 0x0004003du, 0x00000006u, 0x00000089u, 0x00000088u, 0x00050050u, 0x0000000du, - 0x0000008au, 0x00000089u, 0x0000002cu, 0x00050083u, 0x0000000du, 0x0000008bu, 0x00000087u, 0x0000008au, - 0x00050057u, 0x0000002fu, 0x0000008cu, 0x00000086u, 0x0000008bu, 0x0008004fu, 0x00000007u, 0x0000008eu, - 0x0000008cu, 0x0000008cu, 0x00000000u, 0x00000001u, 0x00000002u, 0x0003003eu, 0x0000008du, 0x0000008eu, - 0x00050039u, 0x00000006u, 0x0000008fu, 0x0000000bu, 0x0000008du, 0x0003003eu, 0x00000085u, 0x0000008fu, - 0x0004003du, 0x00000023u, 0x00000091u, 0x00000025u, 0x0004003du, 0x0000000du, 0x00000092u, 0x00000070u, - 0x00050041u, 0x00000020u, 0x00000093u, 0x00000062u, 0x00000029u, 0x0004003du, 0x00000006u, 0x00000094u, - 0x00000093u, 0x00050050u, 0x0000000du, 0x00000095u, 0x00000094u, 0x0000002cu, 0x00050081u, 0x0000000du, - 0x00000096u, 0x00000092u, 0x00000095u, 0x00050057u, 0x0000002fu, 0x00000097u, 0x00000091u, 0x00000096u, - 0x0008004fu, 0x00000007u, 0x00000099u, 0x00000097u, 0x00000097u, 0x00000000u, 0x00000001u, 0x00000002u, - 0x0003003eu, 0x00000098u, 0x00000099u, 0x00050039u, 0x00000006u, 0x0000009au, 0x0000000bu, 0x00000098u, - 0x0003003eu, 0x00000090u, 0x0000009au, 0x0004003du, 0x00000023u, 0x0000009cu, 0x00000025u, 0x0004003du, - 0x0000000du, 0x0000009du, 0x00000070u, 0x00050041u, 0x00000020u, 0x0000009eu, 0x00000062u, 0x00000048u, - 0x0004003du, 0x00000006u, 0x0000009fu, 0x0000009eu, 0x00050050u, 0x0000000du, 0x000000a0u, 0x0000002cu, - 0x0000009fu, 0x00050083u, 0x0000000du, 0x000000a1u, 0x0000009du, 0x000000a0u, 0x00050057u, 0x0000002fu, - 0x000000a2u, 0x0000009cu, 0x000000a1u, 0x0008004fu, 0x00000007u, 0x000000a4u, 0x000000a2u, 0x000000a2u, - 0x00000000u, 0x00000001u, 0x00000002u, 0x0003003eu, 0x000000a3u, 0x000000a4u, 0x00050039u, 0x00000006u, - 0x000000a5u, 0x0000000bu, 0x000000a3u, 0x0003003eu, 0x0000009bu, 0x000000a5u, 0x0004003du, 0x00000023u, - 0x000000a7u, 0x00000025u, 0x0004003du, 0x0000000du, 0x000000a8u, 0x00000070u, 0x00050041u, 0x00000020u, - 0x000000a9u, 0x00000062u, 0x00000048u, 0x0004003du, 0x00000006u, 0x000000aau, 0x000000a9u, 0x00050050u, - 0x0000000du, 0x000000abu, 0x0000002cu, 0x000000aau, 0x00050081u, 0x0000000du, 0x000000acu, 0x000000a8u, - 0x000000abu, 0x00050057u, 0x0000002fu, 0x000000adu, 0x000000a7u, 0x000000acu, 0x0008004fu, 0x00000007u, - 0x000000afu, 0x000000adu, 0x000000adu, 0x00000000u, 0x00000001u, 0x00000002u, 0x0003003eu, 0x000000aeu, - 0x000000afu, 0x00050039u, 0x00000006u, 0x000000b0u, 0x0000000bu, 0x000000aeu, 0x0003003eu, 0x000000a6u, - 0x000000b0u, 0x0004003du, 0x00000006u, 0x000000b2u, 0x00000080u, 0x0004003du, 0x00000006u, 0x000000b3u, - 0x00000085u, 0x00050083u, 0x00000006u, 0x000000b4u, 0x000000b2u, 0x000000b3u, 0x0006000cu, 0x00000006u, - 0x000000b5u, 0x00000001u, 0x00000004u, 0x000000b4u, 0x0003003eu, 0x000000b1u, 0x000000b5u, 0x0004003du, - 0x00000006u, 0x000000b7u, 0x00000080u, 0x0004003du, 0x00000006u, 0x000000b8u, 0x00000090u, 0x00050083u, - 0x00000006u, 0x000000b9u, 0x000000b7u, 0x000000b8u, 0x0006000cu, 0x00000006u, 0x000000bau, 0x00000001u, - 0x00000004u, 0x000000b9u, 0x0003003eu, 0x000000b6u, 0x000000bau, 0x0004003du, 0x00000006u, 0x000000bcu, - 0x00000080u, 0x0004003du, 0x00000006u, 0x000000bdu, 0x0000009bu, 0x00050083u, 0x00000006u, 0x000000beu, - 0x000000bcu, 0x000000bdu, 0x0006000cu, 0x00000006u, 0x000000bfu, 0x00000001u, 0x00000004u, 0x000000beu, - 0x0003003eu, 0x000000bbu, 0x000000bfu, 0x0004003du, 0x00000006u, 0x000000c1u, 0x00000080u, 0x0004003du, - 0x00000006u, 0x000000c2u, 0x000000a6u, 0x00050083u, 0x00000006u, 0x000000c3u, 0x000000c1u, 0x000000c2u, - 0x0006000cu, 0x00000006u, 0x000000c4u, 0x00000001u, 0x00000004u, 0x000000c3u, 0x0003003eu, 0x000000c0u, - 0x000000c4u, 0x0004003du, 0x00000006u, 0x000000c6u, 0x00000080u, 0x0004003du, 0x00000006u, 0x000000c7u, - 0x00000085u, 0x0004003du, 0x00000006u, 0x000000c8u, 0x00000090u, 0x0007000cu, 0x00000006u, 0x000000c9u, - 0x00000001u, 0x00000025u, 0x000000c7u, 0x000000c8u, 0x0004003du, 0x00000006u, 0x000000cau, 0x0000009bu, - 0x0004003du, 0x00000006u, 0x000000cbu, 0x000000a6u, 0x0007000cu, 0x00000006u, 0x000000ccu, 0x00000001u, - 0x00000025u, 0x000000cau, 0x000000cbu, 0x0007000cu, 0x00000006u, 0x000000cdu, 0x00000001u, 0x00000025u, - 0x000000c9u, 0x000000ccu, 0x0007000cu, 0x00000006u, 0x000000ceu, 0x00000001u, 0x00000025u, 0x000000c6u, - 0x000000cdu, 0x0003003eu, 0x000000c5u, 0x000000ceu, 0x0004003du, 0x00000006u, 0x000000d0u, 0x00000080u, - 0x0004003du, 0x00000006u, 0x000000d1u, 0x00000085u, 0x0004003du, 0x00000006u, 0x000000d2u, 0x00000090u, - 0x0007000cu, 0x00000006u, 0x000000d3u, 0x00000001u, 0x00000028u, 0x000000d1u, 0x000000d2u, 0x0004003du, - 0x00000006u, 0x000000d4u, 0x0000009bu, 0x0004003du, 0x00000006u, 0x000000d5u, 0x000000a6u, 0x0007000cu, - 0x00000006u, 0x000000d6u, 0x00000001u, 0x00000028u, 0x000000d4u, 0x000000d5u, 0x0007000cu, 0x00000006u, - 0x000000d7u, 0x00000001u, 0x00000028u, 0x000000d3u, 0x000000d6u, 0x0007000cu, 0x00000006u, 0x000000d8u, - 0x00000001u, 0x00000028u, 0x000000d0u, 0x000000d7u, 0x0003003eu, 0x000000cfu, 0x000000d8u, 0x0004003du, - 0x00000006u, 0x000000dau, 0x000000cfu, 0x0004003du, 0x00000006u, 0x000000dbu, 0x000000c5u, 0x00050083u, - 0x00000006u, 0x000000dcu, 0x000000dau, 0x000000dbu, 0x0003003eu, 0x000000d9u, 0x000000dcu, 0x0004003du, - 0x00000006u, 0x000000dfu, 0x000000d9u, 0x00050085u, 0x00000006u, 0x000000e1u, 0x000000dfu, 0x000000e0u, - 0x0007000cu, 0x00000006u, 0x000000e2u, 0x00000001u, 0x00000028u, 0x000000deu, 0x000000e1u, 0x0003003eu, - 0x000000ddu, 0x000000e2u, 0x0004003du, 0x00000006u, 0x000000e4u, 0x000000b1u, 0x0004003du, 0x00000006u, - 0x000000e5u, 0x000000b6u, 0x0007000cu, 0x00000006u, 0x000000e6u, 0x00000001u, 0x00000028u, 0x000000e4u, - 0x000000e5u, 0x0003003eu, 0x000000e3u, 0x000000e6u, 0x0004003du, 0x00000006u, 0x000000e8u, 0x000000bbu, - 0x0004003du, 0x00000006u, 0x000000e9u, 0x000000c0u, 0x0007000cu, 0x00000006u, 0x000000eau, 0x00000001u, - 0x00000028u, 0x000000e8u, 0x000000e9u, 0x0003003eu, 0x000000e7u, 0x000000eau, 0x0004003du, 0x00000006u, - 0x000000ecu, 0x000000e3u, 0x0004003du, 0x00000006u, 0x000000edu, 0x000000e7u, 0x0007000cu, 0x00000006u, - 0x000000eeu, 0x00000001u, 0x00000028u, 0x000000ecu, 0x000000edu, 0x0003003eu, 0x000000ebu, 0x000000eeu, - 0x0004003du, 0x00000006u, 0x000000efu, 0x000000ebu, 0x0004003du, 0x00000006u, 0x000000f0u, 0x000000ddu, - 0x000500bcu, 0x000000f1u, 0x000000f2u, 0x000000efu, 0x000000f0u, 0x000300f7u, 0x000000f4u, 0x00000000u, - 0x000400fau, 0x000000f2u, 0x000000f3u, 0x000000f4u, 0x000200f8u, 0x000000f3u, 0x0004003du, 0x0000002fu, - 0x000000f7u, 0x0000007cu, 0x0003003eu, 0x000000f6u, 0x000000f7u, 0x000100fdu, 0x000200f8u, 0x000000f4u, - 0x0004003du, 0x00000006u, 0x000000fbu, 0x000000e3u, 0x0004003du, 0x00000006u, 0x000000fcu, 0x000000e7u, - 0x000500beu, 0x000000f1u, 0x000000fdu, 0x000000fbu, 0x000000fcu, 0x0003003eu, 0x000000fau, 0x000000fdu, - 0x0004003du, 0x000000f1u, 0x000000ffu, 0x000000fau, 0x000300f7u, 0x00000102u, 0x00000000u, 0x000400fau, - 0x000000ffu, 0x00000101u, 0x00000106u, 0x000200f8u, 0x00000101u, 0x00050041u, 0x00000020u, 0x00000103u, - 0x00000062u, 0x00000048u, 0x0004003du, 0x00000006u, 0x00000104u, 0x00000103u, 0x00050050u, 0x0000000du, - 0x00000105u, 0x0000002cu, 0x00000104u, 0x0003003eu, 0x00000100u, 0x00000105u, 0x000200f9u, 0x00000102u, - 0x000200f8u, 0x00000106u, 0x00050041u, 0x00000020u, 0x00000107u, 0x00000062u, 0x00000029u, 0x0004003du, - 0x00000006u, 0x00000108u, 0x00000107u, 0x00050050u, 0x0000000du, 0x00000109u, 0x00000108u, 0x0000002cu, - 0x0003003eu, 0x00000100u, 0x00000109u, 0x000200f9u, 0x00000102u, 0x000200f8u, 0x00000102u, 0x0004003du, - 0x0000000du, 0x0000010au, 0x00000100u, 0x0003003eu, 0x000000feu, 0x0000010au, 0x0004003du, 0x000000f1u, - 0x0000010cu, 0x000000fau, 0x000300f7u, 0x0000010fu, 0x00000000u, 0x000400fau, 0x0000010cu, 0x0000010eu, - 0x00000116u, 0x000200f8u, 0x0000010eu, 0x0004003du, 0x00000006u, 0x00000110u, 0x000000b1u, 0x0004003du, - 0x00000006u, 0x00000111u, 0x000000b6u, 0x000500beu, 0x000000f1u, 0x00000112u, 0x00000110u, 0x00000111u, - 0x000600a9u, 0x00000006u, 0x00000114u, 0x00000112u, 0x00000113u, 0x00000063u, 0x00050050u, 0x0000000du, - 0x00000115u, 0x00000114u, 0x0000002cu, 0x0003003eu, 0x0000010du, 0x00000115u, 0x000200f9u, 0x0000010fu, - 0x000200f8u, 0x00000116u, 0x0004003du, 0x00000006u, 0x00000117u, 0x000000bbu, 0x0004003du, 0x00000006u, - 0x00000118u, 0x000000c0u, 0x000500beu, 0x000000f1u, 0x00000119u, 0x00000117u, 0x00000118u, 0x000600a9u, - 0x00000006u, 0x0000011au, 0x00000119u, 0x00000113u, 0x00000063u, 0x00050050u, 0x0000000du, 0x0000011bu, - 0x0000002cu, 0x0000011au, 0x0003003eu, 0x0000010du, 0x0000011bu, 0x000200f9u, 0x0000010fu, 0x000200f8u, - 0x0000010fu, 0x0004003du, 0x0000000du, 0x0000011cu, 0x0000010du, 0x0003003eu, 0x0000010bu, 0x0000011cu, - 0x0003003eu, 0x0000011du, 0x0000002cu, 0x0003003eu, 0x0000011eu, 0x0000002cu, 0x0003003eu, 0x00000120u, - 0x00000068u, 0x000200f9u, 0x00000121u, 0x000200f8u, 0x00000121u, 0x000400f6u, 0x00000123u, 0x00000124u, - 0x00000000u, 0x000200f9u, 0x00000125u, 0x000200f8u, 0x00000125u, 0x0004003du, 0x00000067u, 0x00000126u, - 0x00000120u, 0x000500b3u, 0x000000f1u, 0x00000128u, 0x00000126u, 0x00000127u, 0x000400fau, 0x00000128u, - 0x00000122u, 0x00000123u, 0x000200f8u, 0x00000122u, 0x0004003du, 0x0000000du, 0x0000012au, 0x000000feu, - 0x0004003du, 0x00000067u, 0x0000012bu, 0x00000120u, 0x0004006fu, 0x00000006u, 0x0000012cu, 0x0000012bu, - 0x0005008eu, 0x0000000du, 0x0000012du, 0x0000012au, 0x0000012cu, 0x0003003eu, 0x00000129u, 0x0000012du, - 0x0004003du, 0x000000f1u, 0x0000012fu, 0x000000fau, 0x000300f7u, 0x00000132u, 0x00000000u, 0x000400fau, - 0x0000012fu, 0x00000131u, 0x0000013au, 0x000200f8u, 0x00000131u, 0x0004003du, 0x0000000du, 0x00000133u, - 0x00000070u, 0x0004003du, 0x0000000du, 0x00000134u, 0x00000129u, 0x00050083u, 0x0000000du, 0x00000135u, - 0x00000133u, 0x00000134u, 0x0003003eu, 0x00000136u, 0x00000135u, 0x0004003du, 0x0000000du, 0x00000138u, - 0x00000062u, 0x0003003eu, 0x00000137u, 0x00000138u, 0x00060039u, 0x00000006u, 0x00000139u, 0x00000012u, - 0x00000136u, 0x00000137u, 0x0003003eu, 0x00000130u, 0x00000139u, 0x000200f9u, 0x00000132u, 0x000200f8u, - 0x0000013au, 0x0004003du, 0x0000000du, 0x0000013bu, 0x00000070u, 0x0004003du, 0x0000000du, 0x0000013cu, - 0x00000129u, 0x00050083u, 0x0000000du, 0x0000013du, 0x0000013bu, 0x0000013cu, 0x0003003eu, 0x0000013eu, - 0x0000013du, 0x0004003du, 0x0000000du, 0x00000140u, 0x00000062u, 0x0003003eu, 0x0000013fu, 0x00000140u, - 0x00060039u, 0x00000006u, 0x00000141u, 0x00000016u, 0x0000013eu, 0x0000013fu, 0x0003003eu, 0x00000130u, - 0x00000141u, 0x000200f9u, 0x00000132u, 0x000200f8u, 0x00000132u, 0x0004003du, 0x00000006u, 0x00000142u, - 0x00000130u, 0x0003003eu, 0x0000012eu, 0x00000142u, 0x0004003du, 0x000000f1u, 0x00000144u, 0x000000fau, - 0x000300f7u, 0x00000147u, 0x00000000u, 0x000400fau, 0x00000144u, 0x00000146u, 0x0000014fu, 0x000200f8u, - 0x00000146u, 0x0004003du, 0x0000000du, 0x00000148u, 0x00000070u, 0x0004003du, 0x0000000du, 0x00000149u, - 0x00000129u, 0x00050081u, 0x0000000du, 0x0000014au, 0x00000148u, 0x00000149u, 0x0003003eu, 0x0000014bu, - 0x0000014au, 0x0004003du, 0x0000000du, 0x0000014du, 0x00000062u, 0x0003003eu, 0x0000014cu, 0x0000014du, - 0x00060039u, 0x00000006u, 0x0000014eu, 0x00000012u, 0x0000014bu, 0x0000014cu, 0x0003003eu, 0x00000145u, - 0x0000014eu, 0x000200f9u, 0x00000147u, 0x000200f8u, 0x0000014fu, 0x0004003du, 0x0000000du, 0x00000150u, - 0x00000070u, 0x0004003du, 0x0000000du, 0x00000151u, 0x00000129u, 0x00050081u, 0x0000000du, 0x00000152u, - 0x00000150u, 0x00000151u, 0x0003003eu, 0x00000153u, 0x00000152u, 0x0004003du, 0x0000000du, 0x00000155u, - 0x00000062u, 0x0003003eu, 0x00000154u, 0x00000155u, 0x00060039u, 0x00000006u, 0x00000156u, 0x00000016u, - 0x00000153u, 0x00000154u, 0x0003003eu, 0x00000145u, 0x00000156u, 0x000200f9u, 0x00000147u, 0x000200f8u, - 0x00000147u, 0x0004003du, 0x00000006u, 0x00000157u, 0x00000145u, 0x0003003eu, 0x00000143u, 0x00000157u, - 0x0004003du, 0x00000006u, 0x00000158u, 0x0000011du, 0x0004003du, 0x00000067u, 0x00000159u, 0x00000120u, - 0x00050082u, 0x00000067u, 0x0000015au, 0x00000159u, 0x00000068u, 0x0004006fu, 0x00000006u, 0x0000015bu, - 0x0000015au, 0x000500b4u, 0x000000f1u, 0x0000015cu, 0x00000158u, 0x0000015bu, 0x000300f7u, 0x0000015eu, - 0x00000000u, 0x000400fau, 0x0000015cu, 0x0000015du, 0x0000015eu, 0x000200f8u, 0x0000015du, 0x0004003du, - 0x00000006u, 0x0000015fu, 0x0000012eu, 0x0004003du, 0x00000006u, 0x00000160u, 0x000000ddu, 0x00050085u, - 0x00000006u, 0x00000162u, 0x00000160u, 0x00000161u, 0x000500bau, 0x000000f1u, 0x00000163u, 0x0000015fu, - 0x00000162u, 0x000200f9u, 0x0000015eu, 0x000200f8u, 0x0000015eu, 0x000700f5u, 0x000000f1u, 0x00000164u, - 0x0000015cu, 0x00000147u, 0x00000163u, 0x0000015du, 0x000300f7u, 0x00000166u, 0x00000000u, 0x000400fau, - 0x00000164u, 0x00000165u, 0x00000166u, 0x000200f8u, 0x00000165u, 0x0004003du, 0x00000067u, 0x00000167u, - 0x00000120u, 0x0004006fu, 0x00000006u, 0x00000168u, 0x00000167u, 0x0003003eu, 0x0000011du, 0x00000168u, - 0x000200f9u, 0x00000166u, 0x000200f8u, 0x00000166u, 0x0004003du, 0x00000006u, 0x00000169u, 0x0000011eu, - 0x0004003du, 0x00000067u, 0x0000016au, 0x00000120u, 0x00050082u, 0x00000067u, 0x0000016bu, 0x0000016au, - 0x00000068u, 0x0004006fu, 0x00000006u, 0x0000016cu, 0x0000016bu, 0x000500b4u, 0x000000f1u, 0x0000016du, - 0x00000169u, 0x0000016cu, 0x000300f7u, 0x0000016fu, 0x00000000u, 0x000400fau, 0x0000016du, 0x0000016eu, - 0x0000016fu, 0x000200f8u, 0x0000016eu, 0x0004003du, 0x00000006u, 0x00000170u, 0x00000143u, 0x0004003du, - 0x00000006u, 0x00000171u, 0x000000ddu, 0x00050085u, 0x00000006u, 0x00000172u, 0x00000171u, 0x00000161u, - 0x000500bau, 0x000000f1u, 0x00000173u, 0x00000170u, 0x00000172u, 0x000200f9u, 0x0000016fu, 0x000200f8u, - 0x0000016fu, 0x000700f5u, 0x000000f1u, 0x00000174u, 0x0000016du, 0x00000166u, 0x00000173u, 0x0000016eu, - 0x000300f7u, 0x00000176u, 0x00000000u, 0x000400fau, 0x00000174u, 0x00000175u, 0x00000176u, 0x000200f8u, - 0x00000175u, 0x0004003du, 0x00000067u, 0x00000177u, 0x00000120u, 0x0004006fu, 0x00000006u, 0x00000178u, - 0x00000177u, 0x0003003eu, 0x0000011eu, 0x00000178u, 0x000200f9u, 0x00000176u, 0x000200f8u, 0x00000176u, - 0x000200f9u, 0x00000124u, 0x000200f8u, 0x00000124u, 0x0004003du, 0x00000067u, 0x00000179u, 0x00000120u, - 0x00050080u, 0x00000067u, 0x0000017au, 0x00000179u, 0x00000068u, 0x0003003eu, 0x00000120u, 0x0000017au, - 0x000200f9u, 0x00000121u, 0x000200f8u, 0x00000123u, 0x0004003du, 0x00000006u, 0x0000017cu, 0x0000011du, - 0x0004003du, 0x00000006u, 0x0000017du, 0x0000011eu, 0x00050081u, 0x00000006u, 0x0000017eu, 0x0000017cu, - 0x0000017du, 0x0003003eu, 0x0000017bu, 0x0000017eu, 0x0004003du, 0x00000006u, 0x00000180u, 0x000000ddu, - 0x0004003du, 0x00000006u, 0x00000181u, 0x000000ddu, 0x00050085u, 0x00000006u, 0x00000183u, 0x00000181u, - 0x00000182u, 0x0004003du, 0x00000006u, 0x00000184u, 0x000000ebu, 0x0008000cu, 0x00000006u, 0x00000185u, - 0x00000001u, 0x00000031u, 0x00000180u, 0x00000183u, 0x00000184u, 0x0003003eu, 0x0000017fu, 0x00000185u, - 0x0004003du, 0x00000023u, 0x00000187u, 0x00000025u, 0x0004003du, 0x0000000du, 0x00000188u, 0x00000070u, - 0x00050041u, 0x00000020u, 0x00000189u, 0x00000062u, 0x00000029u, 0x0004003du, 0x00000006u, 0x0000018au, - 0x00000189u, 0x0004007fu, 0x00000006u, 0x0000018bu, 0x0000018au, 0x00050041u, 0x00000020u, 0x0000018cu, - 0x00000062u, 0x00000048u, 0x0004003du, 0x00000006u, 0x0000018du, 0x0000018cu, 0x0004007fu, 0x00000006u, - 0x0000018eu, 0x0000018du, 0x00050050u, 0x0000000du, 0x0000018fu, 0x0000018bu, 0x0000018eu, 0x00050081u, - 0x0000000du, 0x00000190u, 0x00000188u, 0x0000018fu, 0x00050057u, 0x0000002fu, 0x00000191u, 0x00000187u, - 0x00000190u, 0x0008004fu, 0x00000007u, 0x00000193u, 0x00000191u, 0x00000191u, 0x00000000u, 0x00000001u, - 0x00000002u, 0x0003003eu, 0x00000192u, 0x00000193u, 0x00050039u, 0x00000006u, 0x00000194u, 0x0000000bu, - 0x00000192u, 0x0003003eu, 0x00000186u, 0x00000194u, 0x0004003du, 0x00000023u, 0x00000196u, 0x00000025u, - 0x0004003du, 0x0000000du, 0x00000197u, 0x00000070u, 0x00050041u, 0x00000020u, 0x00000198u, 0x00000062u, - 0x00000029u, 0x0004003du, 0x00000006u, 0x00000199u, 0x00000198u, 0x00050041u, 0x00000020u, 0x0000019au, - 0x00000062u, 0x00000048u, 0x0004003du, 0x00000006u, 0x0000019bu, 0x0000019au, 0x0004007fu, 0x00000006u, - 0x0000019cu, 0x0000019bu, 0x00050050u, 0x0000000du, 0x0000019du, 0x00000199u, 0x0000019cu, 0x00050081u, - 0x0000000du, 0x0000019eu, 0x00000197u, 0x0000019du, 0x00050057u, 0x0000002fu, 0x0000019fu, 0x00000196u, - 0x0000019eu, 0x0008004fu, 0x00000007u, 0x000001a1u, 0x0000019fu, 0x0000019fu, 0x00000000u, 0x00000001u, - 0x00000002u, 0x0003003eu, 0x000001a0u, 0x000001a1u, 0x00050039u, 0x00000006u, 0x000001a2u, 0x0000000bu, - 0x000001a0u, 0x0003003eu, 0x00000195u, 0x000001a2u, 0x0004003du, 0x00000023u, 0x000001a4u, 0x00000025u, - 0x0004003du, 0x0000000du, 0x000001a5u, 0x00000070u, 0x00050041u, 0x00000020u, 0x000001a6u, 0x00000062u, - 0x00000029u, 0x0004003du, 0x00000006u, 0x000001a7u, 0x000001a6u, 0x0004007fu, 0x00000006u, 0x000001a8u, - 0x000001a7u, 0x00050041u, 0x00000020u, 0x000001a9u, 0x00000062u, 0x00000048u, 0x0004003du, 0x00000006u, - 0x000001aau, 0x000001a9u, 0x00050050u, 0x0000000du, 0x000001abu, 0x000001a8u, 0x000001aau, 0x00050081u, - 0x0000000du, 0x000001acu, 0x000001a5u, 0x000001abu, 0x00050057u, 0x0000002fu, 0x000001adu, 0x000001a4u, - 0x000001acu, 0x0008004fu, 0x00000007u, 0x000001afu, 0x000001adu, 0x000001adu, 0x00000000u, 0x00000001u, - 0x00000002u, 0x0003003eu, 0x000001aeu, 0x000001afu, 0x00050039u, 0x00000006u, 0x000001b0u, 0x0000000bu, - 0x000001aeu, 0x0003003eu, 0x000001a3u, 0x000001b0u, 0x0004003du, 0x00000023u, 0x000001b2u, 0x00000025u, - 0x0004003du, 0x0000000du, 0x000001b3u, 0x00000070u, 0x00050041u, 0x00000020u, 0x000001b4u, 0x00000062u, - 0x00000029u, 0x0004003du, 0x00000006u, 0x000001b5u, 0x000001b4u, 0x00050041u, 0x00000020u, 0x000001b6u, - 0x00000062u, 0x00000048u, 0x0004003du, 0x00000006u, 0x000001b7u, 0x000001b6u, 0x00050050u, 0x0000000du, - 0x000001b8u, 0x000001b5u, 0x000001b7u, 0x00050081u, 0x0000000du, 0x000001b9u, 0x000001b3u, 0x000001b8u, - 0x00050057u, 0x0000002fu, 0x000001bau, 0x000001b2u, 0x000001b9u, 0x0008004fu, 0x00000007u, 0x000001bcu, - 0x000001bau, 0x000001bau, 0x00000000u, 0x00000001u, 0x00000002u, 0x0003003eu, 0x000001bbu, 0x000001bcu, - 0x00050039u, 0x00000006u, 0x000001bdu, 0x0000000bu, 0x000001bbu, 0x0003003eu, 0x000001b1u, 0x000001bdu, - 0x0004003du, 0x00000006u, 0x000001bfu, 0x0000011du, 0x0004003du, 0x00000006u, 0x000001c0u, 0x0000011eu, - 0x00050083u, 0x00000006u, 0x000001c1u, 0x000001bfu, 0x000001c0u, 0x0006000cu, 0x00000006u, 0x000001c2u, - 0x00000001u, 0x00000004u, 0x000001c1u, 0x0004003du, 0x00000006u, 0x000001c3u, 0x0000017bu, 0x0007000cu, - 0x00000006u, 0x000001c4u, 0x00000001u, 0x00000028u, 0x000001c3u, 0x00000063u, 0x00050088u, 0x00000006u, - 0x000001c5u, 0x000001c2u, 0x000001c4u, 0x0008000cu, 0x00000006u, 0x000001c6u, 0x00000001u, 0x0000002bu, - 0x000001c5u, 0x0000002cu, 0x00000063u, 0x0003003eu, 0x000001beu, 0x000001c6u, 0x0004003du, 0x00000006u, - 0x000001c8u, 0x000001beu, 0x0004003du, 0x00000006u, 0x000001c9u, 0x0000017bu, 0x00050085u, 0x00000006u, - 0x000001cbu, 0x000001c9u, 0x000001cau, 0x00050081u, 0x00000006u, 0x000001ccu, 0x00000063u, 0x000001cbu, - 0x00050088u, 0x00000006u, 0x000001cdu, 0x000001c8u, 0x000001ccu, 0x0003003eu, 0x000001c7u, 0x000001cdu, - 0x0004003du, 0x000000f1u, 0x000001cfu, 0x000000fau, 0x000300f7u, 0x000001d2u, 0x00000000u, 0x000400fau, - 0x000001cfu, 0x000001d1u, 0x000001d7u, 0x000200f8u, 0x000001d1u, 0x0004003du, 0x00000006u, 0x000001d3u, - 0x00000186u, 0x0004003du, 0x00000006u, 0x000001d4u, 0x00000195u, 0x00050083u, 0x00000006u, 0x000001d5u, - 0x000001d3u, 0x000001d4u, 0x0006000cu, 0x00000006u, 0x000001d6u, 0x00000001u, 0x00000004u, 0x000001d5u, - 0x0003003eu, 0x000001d0u, 0x000001d6u, 0x000200f9u, 0x000001d2u, 0x000200f8u, 0x000001d7u, 0x0004003du, - 0x00000006u, 0x000001d8u, 0x00000186u, 0x0004003du, 0x00000006u, 0x000001d9u, 0x000001a3u, 0x00050083u, - 0x00000006u, 0x000001dau, 0x000001d8u, 0x000001d9u, 0x0006000cu, 0x00000006u, 0x000001dbu, 0x00000001u, - 0x00000004u, 0x000001dau, 0x0003003eu, 0x000001d0u, 0x000001dbu, 0x000200f9u, 0x000001d2u, 0x000200f8u, - 0x000001d2u, 0x0004003du, 0x00000006u, 0x000001dcu, 0x000001d0u, 0x0003003eu, 0x000001ceu, 0x000001dcu, - 0x0004003du, 0x000000f1u, 0x000001deu, 0x000000fau, 0x000300f7u, 0x000001e1u, 0x00000000u, 0x000400fau, - 0x000001deu, 0x000001e0u, 0x000001e6u, 0x000200f8u, 0x000001e0u, 0x0004003du, 0x00000006u, 0x000001e2u, - 0x000001a3u, 0x0004003du, 0x00000006u, 0x000001e3u, 0x000001b1u, 0x00050083u, 0x00000006u, 0x000001e4u, - 0x000001e2u, 0x000001e3u, 0x0006000cu, 0x00000006u, 0x000001e5u, 0x00000001u, 0x00000004u, 0x000001e4u, - 0x0003003eu, 0x000001dfu, 0x000001e5u, 0x000200f9u, 0x000001e1u, 0x000200f8u, 0x000001e6u, 0x0004003du, - 0x00000006u, 0x000001e7u, 0x00000195u, 0x0004003du, 0x00000006u, 0x000001e8u, 0x000001b1u, 0x00050083u, - 0x00000006u, 0x000001e9u, 0x000001e7u, 0x000001e8u, 0x0006000cu, 0x00000006u, 0x000001eau, 0x00000001u, - 0x00000004u, 0x000001e9u, 0x0003003eu, 0x000001dfu, 0x000001eau, 0x000200f9u, 0x000001e1u, 0x000200f8u, - 0x000001e1u, 0x0004003du, 0x00000006u, 0x000001ebu, 0x000001dfu, 0x0003003eu, 0x000001ddu, 0x000001ebu, - 0x0004003du, 0x00000006u, 0x000001edu, 0x000001ceu, 0x0004003du, 0x00000006u, 0x000001eeu, 0x000001ddu, - 0x00050083u, 0x00000006u, 0x000001efu, 0x000001edu, 0x000001eeu, 0x0006000cu, 0x00000006u, 0x000001f0u, - 0x00000001u, 0x00000004u, 0x000001efu, 0x0003003eu, 0x000001ecu, 0x000001f0u, 0x0004003du, 0x00000006u, - 0x000001f2u, 0x000000ddu, 0x0004003du, 0x00000006u, 0x000001f3u, 0x000000ddu, 0x00050085u, 0x00000006u, - 0x000001f4u, 0x000001f3u, 0x00000182u, 0x0004003du, 0x00000006u, 0x000001f5u, 0x000001ecu, 0x0008000cu, - 0x00000006u, 0x000001f6u, 0x00000001u, 0x00000031u, 0x000001f2u, 0x000001f4u, 0x000001f5u, 0x0003003eu, - 0x000001f1u, 0x000001f6u, 0x0004003du, 0x00000006u, 0x000001f9u, 0x000001f1u, 0x00050085u, 0x00000006u, - 0x000001fau, 0x000001f8u, 0x000001f9u, 0x0004003du, 0x00000006u, 0x000001fbu, 0x0000017bu, 0x00050088u, - 0x00000006u, 0x000001fdu, 0x000001fbu, 0x000001fcu, 0x0008000cu, 0x00000006u, 0x000001feu, 0x00000001u, - 0x0000002bu, 0x000001fdu, 0x0000002cu, 0x00000063u, 0x00050085u, 0x00000006u, 0x000001ffu, 0x000001fau, - 0x000001feu, 0x0003003eu, 0x000001f7u, 0x000001ffu, 0x0004003du, 0x00000006u, 0x00000201u, 0x00000186u, - 0x0004003du, 0x00000006u, 0x00000202u, 0x000001b1u, 0x00050083u, 0x00000006u, 0x00000203u, 0x00000201u, - 0x00000202u, 0x0006000cu, 0x00000006u, 0x00000204u, 0x00000001u, 0x00000004u, 0x00000203u, 0x0004003du, - 0x00000006u, 0x00000205u, 0x00000195u, 0x0004003du, 0x00000006u, 0x00000206u, 0x000001a3u, 0x00050083u, - 0x00000006u, 0x00000207u, 0x00000205u, 0x00000206u, 0x0006000cu, 0x00000006u, 0x00000208u, 0x00000001u, - 0x00000004u, 0x00000207u, 0x0007000cu, 0x00000006u, 0x00000209u, 0x00000001u, 0x00000028u, 0x00000204u, - 0x00000208u, 0x0003003eu, 0x00000200u, 0x00000209u, 0x0004003du, 0x00000006u, 0x0000020cu, 0x000000ddu, - 0x0004003du, 0x00000006u, 0x0000020du, 0x000000ddu, 0x00050085u, 0x00000006u, 0x0000020fu, 0x0000020du, - 0x0000020eu, 0x0004003du, 0x00000006u, 0x00000210u, 0x00000200u, 0x0008000cu, 0x00000006u, 0x00000211u, - 0x00000001u, 0x00000031u, 0x0000020cu, 0x0000020fu, 0x00000210u, 0x00050085u, 0x00000006u, 0x00000212u, - 0x0000020bu, 0x00000211u, 0x00050083u, 0x00000006u, 0x00000213u, 0x00000063u, 0x00000212u, 0x0003003eu, - 0x0000020au, 0x00000213u, 0x0004003du, 0x00000006u, 0x00000215u, 0x000001f7u, 0x0004003du, 0x00000006u, - 0x00000216u, 0x000001c7u, 0x00050085u, 0x00000006u, 0x00000217u, 0x00000215u, 0x00000216u, 0x0004003du, - 0x00000006u, 0x00000218u, 0x0000017fu, 0x00050085u, 0x00000006u, 0x00000219u, 0x00000217u, 0x00000218u, - 0x0004003du, 0x00000006u, 0x0000021au, 0x0000020au, 0x00050085u, 0x00000006u, 0x0000021bu, 0x00000219u, - 0x0000021au, 0x0003003eu, 0x00000214u, 0x0000021bu, 0x0004003du, 0x00000006u, 0x0000021du, 0x00000186u, - 0x0004003du, 0x00000006u, 0x0000021eu, 0x000001b1u, 0x00050083u, 0x00000006u, 0x0000021fu, 0x0000021du, - 0x0000021eu, 0x0006000cu, 0x00000006u, 0x00000220u, 0x00000001u, 0x00000004u, 0x0000021fu, 0x0004003du, - 0x00000006u, 0x00000221u, 0x00000195u, 0x0004003du, 0x00000006u, 0x00000222u, 0x000001a3u, 0x00050083u, - 0x00000006u, 0x00000223u, 0x00000221u, 0x00000222u, 0x0006000cu, 0x00000006u, 0x00000224u, 0x00000001u, - 0x00000004u, 0x00000223u, 0x00050083u, 0x00000006u, 0x00000225u, 0x00000220u, 0x00000224u, 0x0006000cu, - 0x00000006u, 0x00000226u, 0x00000001u, 0x00000004u, 0x00000225u, 0x0003003eu, 0x0000021cu, 0x00000226u, - 0x0004003du, 0x00000006u, 0x00000228u, 0x000000ddu, 0x0004003du, 0x00000006u, 0x00000229u, 0x000000ddu, - 0x00050085u, 0x00000006u, 0x0000022au, 0x00000229u, 0x00000182u, 0x0004003du, 0x00000006u, 0x0000022bu, - 0x0000021cu, 0x0008000cu, 0x00000006u, 0x0000022cu, 0x00000001u, 0x00000031u, 0x00000228u, 0x0000022au, - 0x0000022bu, 0x0003003eu, 0x00000227u, 0x0000022cu, 0x0004003du, 0x00000006u, 0x0000022fu, 0x00000227u, - 0x00050085u, 0x00000006u, 0x00000230u, 0x0000022eu, 0x0000022fu, 0x0004003du, 0x00000006u, 0x00000231u, - 0x0000017fu, 0x00050085u, 0x00000006u, 0x00000232u, 0x00000230u, 0x00000231u, 0x0004003du, 0x00000006u, - 0x00000233u, 0x0000020au, 0x00050085u, 0x00000006u, 0x00000234u, 0x00000232u, 0x00000233u, 0x0003003eu, - 0x0000022du, 0x00000234u, 0x0004003du, 0x00000006u, 0x00000236u, 0x00000214u, 0x000500bcu, 0x000000f1u, - 0x00000238u, 0x00000236u, 0x00000237u, 0x0004003du, 0x00000006u, 0x00000239u, 0x0000022du, 0x0004003du, - 0x00000006u, 0x0000023au, 0x00000214u, 0x000600a9u, 0x00000006u, 0x0000023bu, 0x00000238u, 0x00000239u, - 0x0000023au, 0x0008000cu, 0x00000006u, 0x0000023du, 0x00000001u, 0x0000002bu, 0x0000023bu, 0x0000002cu, - 0x0000023cu, 0x0003003eu, 0x00000235u, 0x0000023du, 0x0004003du, 0x00000023u, 0x0000023fu, 0x00000025u, - 0x0004003du, 0x0000000du, 0x00000240u, 0x00000070u, 0x0004003du, 0x0000000du, 0x00000241u, 0x0000010bu, - 0x0004003du, 0x0000000du, 0x00000242u, 0x00000062u, 0x00050085u, 0x0000000du, 0x00000243u, 0x00000241u, - 0x00000242u, 0x00050081u, 0x0000000du, 0x00000244u, 0x00000240u, 0x00000243u, 0x00050057u, 0x0000002fu, - 0x00000245u, 0x0000023fu, 0x00000244u, 0x0008004fu, 0x00000007u, 0x00000246u, 0x00000245u, 0x00000245u, - 0x00000000u, 0x00000001u, 0x00000002u, 0x0003003eu, 0x0000023eu, 0x00000246u, 0x0004003du, 0x0000002fu, - 0x00000247u, 0x0000007cu, 0x0008004fu, 0x00000007u, 0x00000248u, 0x00000247u, 0x00000247u, 0x00000000u, - 0x00000001u, 0x00000002u, 0x0004003du, 0x00000007u, 0x00000249u, 0x0000023eu, 0x0004003du, 0x00000006u, - 0x0000024au, 0x00000235u, 0x00060050u, 0x00000007u, 0x0000024bu, 0x0000024au, 0x0000024au, 0x0000024au, - 0x0008000cu, 0x00000007u, 0x0000024cu, 0x00000001u, 0x0000002eu, 0x00000248u, 0x00000249u, 0x0000024bu, - 0x00050041u, 0x00000020u, 0x0000024eu, 0x0000007cu, 0x0000024du, 0x0004003du, 0x00000006u, 0x0000024fu, - 0x0000024eu, 0x00050051u, 0x00000006u, 0x00000250u, 0x0000024cu, 0x00000000u, 0x00050051u, 0x00000006u, - 0x00000251u, 0x0000024cu, 0x00000001u, 0x00050051u, 0x00000006u, 0x00000252u, 0x0000024cu, 0x00000002u, - 0x00070050u, 0x0000002fu, 0x00000253u, 0x00000250u, 0x00000251u, 0x00000252u, 0x0000024fu, 0x0003003eu, - 0x000000f6u, 0x00000253u, 0x000100fdu, 0x00010038u, 0x00050036u, 0x00000006u, 0x0000000bu, 0x00000000u, - 0x00000009u, 0x00030037u, 0x00000008u, 0x0000000au, 0x000200f8u, 0x0000000cu, 0x0004003du, 0x00000007u, - 0x00000018u, 0x0000000au, 0x00050094u, 0x00000006u, 0x0000001du, 0x00000018u, 0x0000001cu, 0x000200feu, - 0x0000001du, 0x00010038u, 0x00050036u, 0x00000006u, 0x00000012u, 0x00000000u, 0x0000000fu, 0x00030037u, - 0x0000000eu, 0x00000010u, 0x00030037u, 0x0000000eu, 0x00000011u, 0x000200f8u, 0x00000013u, 0x0004003bu, - 0x00000020u, 0x00000021u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x00000031u, 0x00000007u, 0x0004003bu, - 0x00000020u, 0x00000034u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x0000003cu, 0x00000007u, 0x0004003du, - 0x00000023u, 0x00000026u, 0x00000025u, 0x0004003du, 0x0000000du, 0x00000027u, 0x00000010u, 0x00050041u, - 0x00000020u, 0x0000002au, 0x00000011u, 0x00000029u, 0x0004003du, 0x00000006u, 0x0000002bu, 0x0000002au, - 0x00050050u, 0x0000000du, 0x0000002du, 0x0000002bu, 0x0000002cu, 0x00050083u, 0x0000000du, 0x0000002eu, - 0x00000027u, 0x0000002du, 0x00050057u, 0x0000002fu, 0x00000030u, 0x00000026u, 0x0000002eu, 0x0008004fu, - 0x00000007u, 0x00000032u, 0x00000030u, 0x00000030u, 0x00000000u, 0x00000001u, 0x00000002u, 0x0003003eu, - 0x00000031u, 0x00000032u, 0x00050039u, 0x00000006u, 0x00000033u, 0x0000000bu, 0x00000031u, 0x0003003eu, - 0x00000021u, 0x00000033u, 0x0004003du, 0x00000023u, 0x00000035u, 0x00000025u, 0x0004003du, 0x0000000du, - 0x00000036u, 0x00000010u, 0x00050041u, 0x00000020u, 0x00000037u, 0x00000011u, 0x00000029u, 0x0004003du, - 0x00000006u, 0x00000038u, 0x00000037u, 0x00050050u, 0x0000000du, 0x00000039u, 0x00000038u, 0x0000002cu, - 0x00050081u, 0x0000000du, 0x0000003au, 0x00000036u, 0x00000039u, 0x00050057u, 0x0000002fu, 0x0000003bu, - 0x00000035u, 0x0000003au, 0x0008004fu, 0x00000007u, 0x0000003du, 0x0000003bu, 0x0000003bu, 0x00000000u, - 0x00000001u, 0x00000002u, 0x0003003eu, 0x0000003cu, 0x0000003du, 0x00050039u, 0x00000006u, 0x0000003eu, - 0x0000000bu, 0x0000003cu, 0x0003003eu, 0x00000034u, 0x0000003eu, 0x0004003du, 0x00000006u, 0x0000003fu, - 0x00000021u, 0x0004003du, 0x00000006u, 0x00000040u, 0x00000034u, 0x00050083u, 0x00000006u, 0x00000041u, - 0x0000003fu, 0x00000040u, 0x0006000cu, 0x00000006u, 0x00000042u, 0x00000001u, 0x00000004u, 0x00000041u, - 0x000200feu, 0x00000042u, 0x00010038u, 0x00050036u, 0x00000006u, 0x00000016u, 0x00000000u, 0x0000000fu, - 0x00030037u, 0x0000000eu, 0x00000014u, 0x00030037u, 0x0000000eu, 0x00000015u, 0x000200f8u, 0x00000017u, - 0x0004003bu, 0x00000020u, 0x00000045u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x0000004eu, 0x00000007u, - 0x0004003bu, 0x00000020u, 0x00000051u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x00000059u, 0x00000007u, - 0x0004003du, 0x00000023u, 0x00000046u, 0x00000025u, 0x0004003du, 0x0000000du, 0x00000047u, 0x00000014u, - 0x00050041u, 0x00000020u, 0x00000049u, 0x00000015u, 0x00000048u, 0x0004003du, 0x00000006u, 0x0000004au, - 0x00000049u, 0x00050050u, 0x0000000du, 0x0000004bu, 0x0000002cu, 0x0000004au, 0x00050083u, 0x0000000du, - 0x0000004cu, 0x00000047u, 0x0000004bu, 0x00050057u, 0x0000002fu, 0x0000004du, 0x00000046u, 0x0000004cu, - 0x0008004fu, 0x00000007u, 0x0000004fu, 0x0000004du, 0x0000004du, 0x00000000u, 0x00000001u, 0x00000002u, - 0x0003003eu, 0x0000004eu, 0x0000004fu, 0x00050039u, 0x00000006u, 0x00000050u, 0x0000000bu, 0x0000004eu, - 0x0003003eu, 0x00000045u, 0x00000050u, 0x0004003du, 0x00000023u, 0x00000052u, 0x00000025u, 0x0004003du, - 0x0000000du, 0x00000053u, 0x00000014u, 0x00050041u, 0x00000020u, 0x00000054u, 0x00000015u, 0x00000048u, - 0x0004003du, 0x00000006u, 0x00000055u, 0x00000054u, 0x00050050u, 0x0000000du, 0x00000056u, 0x0000002cu, - 0x00000055u, 0x00050081u, 0x0000000du, 0x00000057u, 0x00000053u, 0x00000056u, 0x00050057u, 0x0000002fu, - 0x00000058u, 0x00000052u, 0x00000057u, 0x0008004fu, 0x00000007u, 0x0000005au, 0x00000058u, 0x00000058u, - 0x00000000u, 0x00000001u, 0x00000002u, 0x0003003eu, 0x00000059u, 0x0000005au, 0x00050039u, 0x00000006u, - 0x0000005bu, 0x0000000bu, 0x00000059u, 0x0003003eu, 0x00000051u, 0x0000005bu, 0x0004003du, 0x00000006u, - 0x0000005cu, 0x00000045u, 0x0004003du, 0x00000006u, 0x0000005du, 0x00000051u, 0x00050083u, 0x00000006u, - 0x0000005eu, 0x0000005cu, 0x0000005du, 0x0006000cu, 0x00000006u, 0x0000005fu, 0x00000001u, 0x00000004u, - 0x0000005eu, 0x000200feu, 0x0000005fu, 0x00010038u, + 0x00060005u, 0x00000220u, 0x67616964u, 0x6c616e6fu, 0x74746150u, 0x006e7265u, 0x00070005u, 0x00000226u, + 0x67616964u, 0x6c616e6fu, 0x746e6f43u, 0x69756e69u, 0x00007974u, 0x00070005u, 0x00000229u, 0x67616964u, + 0x6c616e6fu, 0x6c6c6146u, 0x6b636162u, 0x00000000u, 0x00040005u, 0x00000235u, 0x67696577u, 0x00007468u, + 0x00040005u, 0x0000023bu, 0x6f726361u, 0x00007373u, 0x00040047u, 0x00000025u, 0x00000021u, 0x00000000u, + 0x00040047u, 0x00000025u, 0x00000022u, 0x00000000u, 0x00030047u, 0x00000064u, 0x00000002u, 0x00050048u, + 0x00000064u, 0x00000000u, 0x00000023u, 0x00000000u, 0x00050048u, 0x00000064u, 0x00000001u, 0x00000023u, + 0x00000010u, 0x00050048u, 0x00000064u, 0x00000002u, 0x00000023u, 0x00000018u, 0x00050048u, 0x00000064u, + 0x00000003u, 0x00000023u, 0x0000001cu, 0x00040047u, 0x00000072u, 0x0000001eu, 0x00000000u, 0x00040047u, + 0x000000f6u, 0x0000001eu, 0x00000000u, 0x00020013u, 0x00000002u, 0x00030021u, 0x00000003u, 0x00000002u, + 0x00030016u, 0x00000006u, 0x00000020u, 0x00040017u, 0x00000007u, 0x00000006u, 0x00000003u, 0x00040020u, + 0x00000008u, 0x00000007u, 0x00000007u, 0x00040021u, 0x00000009u, 0x00000006u, 0x00000008u, 0x00040017u, + 0x0000000du, 0x00000006u, 0x00000002u, 0x00040020u, 0x0000000eu, 0x00000007u, 0x0000000du, 0x00050021u, + 0x0000000fu, 0x00000006u, 0x0000000eu, 0x0000000eu, 0x0004002bu, 0x00000006u, 0x00000019u, 0x3e59b3d0u, + 0x0004002bu, 0x00000006u, 0x0000001au, 0x3f371759u, 0x0004002bu, 0x00000006u, 0x0000001bu, 0x3d93dd98u, + 0x0006002cu, 0x00000007u, 0x0000001cu, 0x00000019u, 0x0000001au, 0x0000001bu, 0x00040020u, 0x00000020u, + 0x00000007u, 0x00000006u, 0x00090019u, 0x00000022u, 0x00000006u, 0x00000001u, 0x00000000u, 0x00000000u, + 0x00000000u, 0x00000001u, 0x00000000u, 0x0003001bu, 0x00000023u, 0x00000022u, 0x00040020u, 0x00000024u, + 0x00000000u, 0x00000023u, 0x0004003bu, 0x00000024u, 0x00000025u, 0x00000000u, 0x00040015u, 0x00000028u, + 0x00000020u, 0x00000000u, 0x0004002bu, 0x00000028u, 0x00000029u, 0x00000000u, 0x0004002bu, 0x00000006u, + 0x0000002cu, 0x00000000u, 0x00040017u, 0x0000002fu, 0x00000006u, 0x00000004u, 0x0004002bu, 0x00000028u, + 0x00000048u, 0x00000001u, 0x0004002bu, 0x00000006u, 0x00000063u, 0x3f800000u, 0x0006001eu, 0x00000064u, + 0x0000002fu, 0x0000000du, 0x00000006u, 0x00000006u, 0x00040020u, 0x00000065u, 0x00000009u, 0x00000064u, + 0x0004003bu, 0x00000065u, 0x00000066u, 0x00000009u, 0x00040015u, 0x00000067u, 0x00000020u, 0x00000001u, + 0x0004002bu, 0x00000067u, 0x00000068u, 0x00000001u, 0x00040020u, 0x00000069u, 0x00000009u, 0x0000000du, + 0x0005002cu, 0x0000000du, 0x0000006cu, 0x00000063u, 0x00000063u, 0x00040020u, 0x00000071u, 0x00000001u, + 0x0000000du, 0x0004003bu, 0x00000071u, 0x00000072u, 0x00000001u, 0x0004002bu, 0x00000006u, 0x00000075u, + 0x3f000000u, 0x00040020u, 0x0000007bu, 0x00000007u, 0x0000002fu, 0x0004002bu, 0x00000006u, 0x000000deu, + 0x3d3851ecu, 0x0004002bu, 0x00000006u, 0x000000e0u, 0x3da3d70au, 0x00020014u, 0x000000f1u, 0x00040020u, + 0x000000f5u, 0x00000003u, 0x0000002fu, 0x0004003bu, 0x000000f5u, 0x000000f6u, 0x00000003u, 0x00040020u, + 0x000000f9u, 0x00000007u, 0x000000f1u, 0x0004002bu, 0x00000006u, 0x00000113u, 0xbf800000u, 0x00040020u, + 0x0000011fu, 0x00000007u, 0x00000067u, 0x0004002bu, 0x00000067u, 0x00000127u, 0x00000006u, 0x0004002bu, + 0x00000006u, 0x00000161u, 0x3f266666u, 0x0004002bu, 0x00000006u, 0x00000182u, 0x40200000u, 0x0004002bu, + 0x00000006u, 0x000001cau, 0x3d6147aeu, 0x0004002bu, 0x00000006u, 0x000001f8u, 0x3ec28f5cu, 0x0004002bu, + 0x00000006u, 0x000001fcu, 0x40800000u, 0x0004002bu, 0x00000006u, 0x0000020bu, 0x3eb33333u, 0x0004002bu, + 0x00000006u, 0x0000020eu, 0x40400000u, 0x0004002bu, 0x00000006u, 0x0000022au, 0x3e23d70au, 0x0004002bu, + 0x00000006u, 0x00000239u, 0x3ed70a3du, 0x0004002bu, 0x00000028u, 0x0000024au, 0x00000003u, 0x00050036u, + 0x00000002u, 0x00000004u, 0x00000000u, 0x00000003u, 0x000200f8u, 0x00000005u, 0x0004003bu, 0x0000000eu, + 0x00000062u, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x00000070u, 0x00000007u, 0x0004003bu, 0x0000007bu, + 0x0000007cu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x00000080u, 0x00000007u, 0x0004003bu, 0x00000008u, + 0x00000081u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x00000085u, 0x00000007u, 0x0004003bu, 0x00000008u, + 0x0000008du, 0x00000007u, 0x0004003bu, 0x00000020u, 0x00000090u, 0x00000007u, 0x0004003bu, 0x00000008u, + 0x00000098u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x0000009bu, 0x00000007u, 0x0004003bu, 0x00000008u, + 0x000000a3u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000000a6u, 0x00000007u, 0x0004003bu, 0x00000008u, + 0x000000aeu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000000b1u, 0x00000007u, 0x0004003bu, 0x00000020u, + 0x000000b6u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000000bbu, 0x00000007u, 0x0004003bu, 0x00000020u, + 0x000000c0u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000000c5u, 0x00000007u, 0x0004003bu, 0x00000020u, + 0x000000cfu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000000d9u, 0x00000007u, 0x0004003bu, 0x00000020u, + 0x000000ddu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000000e3u, 0x00000007u, 0x0004003bu, 0x00000020u, + 0x000000e7u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000000ebu, 0x00000007u, 0x0004003bu, 0x000000f9u, + 0x000000fau, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x000000feu, 0x00000007u, 0x0004003bu, 0x0000000eu, + 0x00000100u, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x0000010bu, 0x00000007u, 0x0004003bu, 0x0000000eu, + 0x0000010du, 0x00000007u, 0x0004003bu, 0x00000020u, 0x0000011du, 0x00000007u, 0x0004003bu, 0x00000020u, + 0x0000011eu, 0x00000007u, 0x0004003bu, 0x0000011fu, 0x00000120u, 0x00000007u, 0x0004003bu, 0x0000000eu, + 0x00000129u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x0000012eu, 0x00000007u, 0x0004003bu, 0x00000020u, + 0x00000130u, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x00000136u, 0x00000007u, 0x0004003bu, 0x0000000eu, + 0x00000137u, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x0000013eu, 0x00000007u, 0x0004003bu, 0x0000000eu, + 0x0000013fu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x00000143u, 0x00000007u, 0x0004003bu, 0x00000020u, + 0x00000145u, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x0000014bu, 0x00000007u, 0x0004003bu, 0x0000000eu, + 0x0000014cu, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x00000153u, 0x00000007u, 0x0004003bu, 0x0000000eu, + 0x00000154u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x0000017bu, 0x00000007u, 0x0004003bu, 0x00000020u, + 0x0000017fu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x00000186u, 0x00000007u, 0x0004003bu, 0x00000008u, + 0x00000192u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x00000195u, 0x00000007u, 0x0004003bu, 0x00000008u, + 0x000001a0u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000001a3u, 0x00000007u, 0x0004003bu, 0x00000008u, + 0x000001aeu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000001b1u, 0x00000007u, 0x0004003bu, 0x00000008u, + 0x000001bbu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000001beu, 0x00000007u, 0x0004003bu, 0x00000020u, + 0x000001c7u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000001ceu, 0x00000007u, 0x0004003bu, 0x00000020u, + 0x000001d0u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000001ddu, 0x00000007u, 0x0004003bu, 0x00000020u, + 0x000001dfu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000001ecu, 0x00000007u, 0x0004003bu, 0x00000020u, + 0x000001f1u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000001f7u, 0x00000007u, 0x0004003bu, 0x00000020u, + 0x00000200u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x0000020au, 0x00000007u, 0x0004003bu, 0x00000020u, + 0x00000214u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x0000021cu, 0x00000007u, 0x0004003bu, 0x00000020u, + 0x00000220u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x00000226u, 0x00000007u, 0x0004003bu, 0x00000020u, + 0x00000229u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x00000235u, 0x00000007u, 0x0004003bu, 0x00000008u, + 0x0000023bu, 0x00000007u, 0x00050041u, 0x00000069u, 0x0000006au, 0x00000066u, 0x00000068u, 0x0004003du, + 0x0000000du, 0x0000006bu, 0x0000006au, 0x0007000cu, 0x0000000du, 0x0000006du, 0x00000001u, 0x00000028u, + 0x0000006bu, 0x0000006cu, 0x00050050u, 0x0000000du, 0x0000006eu, 0x00000063u, 0x00000063u, 0x00050088u, + 0x0000000du, 0x0000006fu, 0x0000006eu, 0x0000006du, 0x0003003eu, 0x00000062u, 0x0000006fu, 0x0004003du, + 0x0000000du, 0x00000073u, 0x00000072u, 0x0004003du, 0x0000000du, 0x00000074u, 0x00000062u, 0x0005008eu, + 0x0000000du, 0x00000076u, 0x00000074u, 0x00000075u, 0x0004003du, 0x0000000du, 0x00000077u, 0x00000062u, + 0x0005008eu, 0x0000000du, 0x00000078u, 0x00000077u, 0x00000075u, 0x00050083u, 0x0000000du, 0x00000079u, + 0x0000006cu, 0x00000078u, 0x0008000cu, 0x0000000du, 0x0000007au, 0x00000001u, 0x0000002bu, 0x00000073u, + 0x00000076u, 0x00000079u, 0x0003003eu, 0x00000070u, 0x0000007au, 0x0004003du, 0x00000023u, 0x0000007du, + 0x00000025u, 0x0004003du, 0x0000000du, 0x0000007eu, 0x00000070u, 0x00050057u, 0x0000002fu, 0x0000007fu, + 0x0000007du, 0x0000007eu, 0x0003003eu, 0x0000007cu, 0x0000007fu, 0x0004003du, 0x0000002fu, 0x00000082u, + 0x0000007cu, 0x0008004fu, 0x00000007u, 0x00000083u, 0x00000082u, 0x00000082u, 0x00000000u, 0x00000001u, + 0x00000002u, 0x0003003eu, 0x00000081u, 0x00000083u, 0x00050039u, 0x00000006u, 0x00000084u, 0x0000000bu, + 0x00000081u, 0x0003003eu, 0x00000080u, 0x00000084u, 0x0004003du, 0x00000023u, 0x00000086u, 0x00000025u, + 0x0004003du, 0x0000000du, 0x00000087u, 0x00000070u, 0x00050041u, 0x00000020u, 0x00000088u, 0x00000062u, + 0x00000029u, 0x0004003du, 0x00000006u, 0x00000089u, 0x00000088u, 0x00050050u, 0x0000000du, 0x0000008au, + 0x00000089u, 0x0000002cu, 0x00050083u, 0x0000000du, 0x0000008bu, 0x00000087u, 0x0000008au, 0x00050057u, + 0x0000002fu, 0x0000008cu, 0x00000086u, 0x0000008bu, 0x0008004fu, 0x00000007u, 0x0000008eu, 0x0000008cu, + 0x0000008cu, 0x00000000u, 0x00000001u, 0x00000002u, 0x0003003eu, 0x0000008du, 0x0000008eu, 0x00050039u, + 0x00000006u, 0x0000008fu, 0x0000000bu, 0x0000008du, 0x0003003eu, 0x00000085u, 0x0000008fu, 0x0004003du, + 0x00000023u, 0x00000091u, 0x00000025u, 0x0004003du, 0x0000000du, 0x00000092u, 0x00000070u, 0x00050041u, + 0x00000020u, 0x00000093u, 0x00000062u, 0x00000029u, 0x0004003du, 0x00000006u, 0x00000094u, 0x00000093u, + 0x00050050u, 0x0000000du, 0x00000095u, 0x00000094u, 0x0000002cu, 0x00050081u, 0x0000000du, 0x00000096u, + 0x00000092u, 0x00000095u, 0x00050057u, 0x0000002fu, 0x00000097u, 0x00000091u, 0x00000096u, 0x0008004fu, + 0x00000007u, 0x00000099u, 0x00000097u, 0x00000097u, 0x00000000u, 0x00000001u, 0x00000002u, 0x0003003eu, + 0x00000098u, 0x00000099u, 0x00050039u, 0x00000006u, 0x0000009au, 0x0000000bu, 0x00000098u, 0x0003003eu, + 0x00000090u, 0x0000009au, 0x0004003du, 0x00000023u, 0x0000009cu, 0x00000025u, 0x0004003du, 0x0000000du, + 0x0000009du, 0x00000070u, 0x00050041u, 0x00000020u, 0x0000009eu, 0x00000062u, 0x00000048u, 0x0004003du, + 0x00000006u, 0x0000009fu, 0x0000009eu, 0x00050050u, 0x0000000du, 0x000000a0u, 0x0000002cu, 0x0000009fu, + 0x00050083u, 0x0000000du, 0x000000a1u, 0x0000009du, 0x000000a0u, 0x00050057u, 0x0000002fu, 0x000000a2u, + 0x0000009cu, 0x000000a1u, 0x0008004fu, 0x00000007u, 0x000000a4u, 0x000000a2u, 0x000000a2u, 0x00000000u, + 0x00000001u, 0x00000002u, 0x0003003eu, 0x000000a3u, 0x000000a4u, 0x00050039u, 0x00000006u, 0x000000a5u, + 0x0000000bu, 0x000000a3u, 0x0003003eu, 0x0000009bu, 0x000000a5u, 0x0004003du, 0x00000023u, 0x000000a7u, + 0x00000025u, 0x0004003du, 0x0000000du, 0x000000a8u, 0x00000070u, 0x00050041u, 0x00000020u, 0x000000a9u, + 0x00000062u, 0x00000048u, 0x0004003du, 0x00000006u, 0x000000aau, 0x000000a9u, 0x00050050u, 0x0000000du, + 0x000000abu, 0x0000002cu, 0x000000aau, 0x00050081u, 0x0000000du, 0x000000acu, 0x000000a8u, 0x000000abu, + 0x00050057u, 0x0000002fu, 0x000000adu, 0x000000a7u, 0x000000acu, 0x0008004fu, 0x00000007u, 0x000000afu, + 0x000000adu, 0x000000adu, 0x00000000u, 0x00000001u, 0x00000002u, 0x0003003eu, 0x000000aeu, 0x000000afu, + 0x00050039u, 0x00000006u, 0x000000b0u, 0x0000000bu, 0x000000aeu, 0x0003003eu, 0x000000a6u, 0x000000b0u, + 0x0004003du, 0x00000006u, 0x000000b2u, 0x00000080u, 0x0004003du, 0x00000006u, 0x000000b3u, 0x00000085u, + 0x00050083u, 0x00000006u, 0x000000b4u, 0x000000b2u, 0x000000b3u, 0x0006000cu, 0x00000006u, 0x000000b5u, + 0x00000001u, 0x00000004u, 0x000000b4u, 0x0003003eu, 0x000000b1u, 0x000000b5u, 0x0004003du, 0x00000006u, + 0x000000b7u, 0x00000080u, 0x0004003du, 0x00000006u, 0x000000b8u, 0x00000090u, 0x00050083u, 0x00000006u, + 0x000000b9u, 0x000000b7u, 0x000000b8u, 0x0006000cu, 0x00000006u, 0x000000bau, 0x00000001u, 0x00000004u, + 0x000000b9u, 0x0003003eu, 0x000000b6u, 0x000000bau, 0x0004003du, 0x00000006u, 0x000000bcu, 0x00000080u, + 0x0004003du, 0x00000006u, 0x000000bdu, 0x0000009bu, 0x00050083u, 0x00000006u, 0x000000beu, 0x000000bcu, + 0x000000bdu, 0x0006000cu, 0x00000006u, 0x000000bfu, 0x00000001u, 0x00000004u, 0x000000beu, 0x0003003eu, + 0x000000bbu, 0x000000bfu, 0x0004003du, 0x00000006u, 0x000000c1u, 0x00000080u, 0x0004003du, 0x00000006u, + 0x000000c2u, 0x000000a6u, 0x00050083u, 0x00000006u, 0x000000c3u, 0x000000c1u, 0x000000c2u, 0x0006000cu, + 0x00000006u, 0x000000c4u, 0x00000001u, 0x00000004u, 0x000000c3u, 0x0003003eu, 0x000000c0u, 0x000000c4u, + 0x0004003du, 0x00000006u, 0x000000c6u, 0x00000080u, 0x0004003du, 0x00000006u, 0x000000c7u, 0x00000085u, + 0x0004003du, 0x00000006u, 0x000000c8u, 0x00000090u, 0x0007000cu, 0x00000006u, 0x000000c9u, 0x00000001u, + 0x00000025u, 0x000000c7u, 0x000000c8u, 0x0004003du, 0x00000006u, 0x000000cau, 0x0000009bu, 0x0004003du, + 0x00000006u, 0x000000cbu, 0x000000a6u, 0x0007000cu, 0x00000006u, 0x000000ccu, 0x00000001u, 0x00000025u, + 0x000000cau, 0x000000cbu, 0x0007000cu, 0x00000006u, 0x000000cdu, 0x00000001u, 0x00000025u, 0x000000c9u, + 0x000000ccu, 0x0007000cu, 0x00000006u, 0x000000ceu, 0x00000001u, 0x00000025u, 0x000000c6u, 0x000000cdu, + 0x0003003eu, 0x000000c5u, 0x000000ceu, 0x0004003du, 0x00000006u, 0x000000d0u, 0x00000080u, 0x0004003du, + 0x00000006u, 0x000000d1u, 0x00000085u, 0x0004003du, 0x00000006u, 0x000000d2u, 0x00000090u, 0x0007000cu, + 0x00000006u, 0x000000d3u, 0x00000001u, 0x00000028u, 0x000000d1u, 0x000000d2u, 0x0004003du, 0x00000006u, + 0x000000d4u, 0x0000009bu, 0x0004003du, 0x00000006u, 0x000000d5u, 0x000000a6u, 0x0007000cu, 0x00000006u, + 0x000000d6u, 0x00000001u, 0x00000028u, 0x000000d4u, 0x000000d5u, 0x0007000cu, 0x00000006u, 0x000000d7u, + 0x00000001u, 0x00000028u, 0x000000d3u, 0x000000d6u, 0x0007000cu, 0x00000006u, 0x000000d8u, 0x00000001u, + 0x00000028u, 0x000000d0u, 0x000000d7u, 0x0003003eu, 0x000000cfu, 0x000000d8u, 0x0004003du, 0x00000006u, + 0x000000dau, 0x000000cfu, 0x0004003du, 0x00000006u, 0x000000dbu, 0x000000c5u, 0x00050083u, 0x00000006u, + 0x000000dcu, 0x000000dau, 0x000000dbu, 0x0003003eu, 0x000000d9u, 0x000000dcu, 0x0004003du, 0x00000006u, + 0x000000dfu, 0x000000d9u, 0x00050085u, 0x00000006u, 0x000000e1u, 0x000000dfu, 0x000000e0u, 0x0007000cu, + 0x00000006u, 0x000000e2u, 0x00000001u, 0x00000028u, 0x000000deu, 0x000000e1u, 0x0003003eu, 0x000000ddu, + 0x000000e2u, 0x0004003du, 0x00000006u, 0x000000e4u, 0x000000b1u, 0x0004003du, 0x00000006u, 0x000000e5u, + 0x000000b6u, 0x0007000cu, 0x00000006u, 0x000000e6u, 0x00000001u, 0x00000028u, 0x000000e4u, 0x000000e5u, + 0x0003003eu, 0x000000e3u, 0x000000e6u, 0x0004003du, 0x00000006u, 0x000000e8u, 0x000000bbu, 0x0004003du, + 0x00000006u, 0x000000e9u, 0x000000c0u, 0x0007000cu, 0x00000006u, 0x000000eau, 0x00000001u, 0x00000028u, + 0x000000e8u, 0x000000e9u, 0x0003003eu, 0x000000e7u, 0x000000eau, 0x0004003du, 0x00000006u, 0x000000ecu, + 0x000000e3u, 0x0004003du, 0x00000006u, 0x000000edu, 0x000000e7u, 0x0007000cu, 0x00000006u, 0x000000eeu, + 0x00000001u, 0x00000028u, 0x000000ecu, 0x000000edu, 0x0003003eu, 0x000000ebu, 0x000000eeu, 0x0004003du, + 0x00000006u, 0x000000efu, 0x000000ebu, 0x0004003du, 0x00000006u, 0x000000f0u, 0x000000ddu, 0x000500bcu, + 0x000000f1u, 0x000000f2u, 0x000000efu, 0x000000f0u, 0x000300f7u, 0x000000f4u, 0x00000000u, 0x000400fau, + 0x000000f2u, 0x000000f3u, 0x000000f4u, 0x000200f8u, 0x000000f3u, 0x0004003du, 0x0000002fu, 0x000000f7u, + 0x0000007cu, 0x0003003eu, 0x000000f6u, 0x000000f7u, 0x000100fdu, 0x000200f8u, 0x000000f4u, 0x0004003du, + 0x00000006u, 0x000000fbu, 0x000000e3u, 0x0004003du, 0x00000006u, 0x000000fcu, 0x000000e7u, 0x000500beu, + 0x000000f1u, 0x000000fdu, 0x000000fbu, 0x000000fcu, 0x0003003eu, 0x000000fau, 0x000000fdu, 0x0004003du, + 0x000000f1u, 0x000000ffu, 0x000000fau, 0x000300f7u, 0x00000102u, 0x00000000u, 0x000400fau, 0x000000ffu, + 0x00000101u, 0x00000106u, 0x000200f8u, 0x00000101u, 0x00050041u, 0x00000020u, 0x00000103u, 0x00000062u, + 0x00000048u, 0x0004003du, 0x00000006u, 0x00000104u, 0x00000103u, 0x00050050u, 0x0000000du, 0x00000105u, + 0x0000002cu, 0x00000104u, 0x0003003eu, 0x00000100u, 0x00000105u, 0x000200f9u, 0x00000102u, 0x000200f8u, + 0x00000106u, 0x00050041u, 0x00000020u, 0x00000107u, 0x00000062u, 0x00000029u, 0x0004003du, 0x00000006u, + 0x00000108u, 0x00000107u, 0x00050050u, 0x0000000du, 0x00000109u, 0x00000108u, 0x0000002cu, 0x0003003eu, + 0x00000100u, 0x00000109u, 0x000200f9u, 0x00000102u, 0x000200f8u, 0x00000102u, 0x0004003du, 0x0000000du, + 0x0000010au, 0x00000100u, 0x0003003eu, 0x000000feu, 0x0000010au, 0x0004003du, 0x000000f1u, 0x0000010cu, + 0x000000fau, 0x000300f7u, 0x0000010fu, 0x00000000u, 0x000400fau, 0x0000010cu, 0x0000010eu, 0x00000116u, + 0x000200f8u, 0x0000010eu, 0x0004003du, 0x00000006u, 0x00000110u, 0x000000b1u, 0x0004003du, 0x00000006u, + 0x00000111u, 0x000000b6u, 0x000500beu, 0x000000f1u, 0x00000112u, 0x00000110u, 0x00000111u, 0x000600a9u, + 0x00000006u, 0x00000114u, 0x00000112u, 0x00000113u, 0x00000063u, 0x00050050u, 0x0000000du, 0x00000115u, + 0x00000114u, 0x0000002cu, 0x0003003eu, 0x0000010du, 0x00000115u, 0x000200f9u, 0x0000010fu, 0x000200f8u, + 0x00000116u, 0x0004003du, 0x00000006u, 0x00000117u, 0x000000bbu, 0x0004003du, 0x00000006u, 0x00000118u, + 0x000000c0u, 0x000500beu, 0x000000f1u, 0x00000119u, 0x00000117u, 0x00000118u, 0x000600a9u, 0x00000006u, + 0x0000011au, 0x00000119u, 0x00000113u, 0x00000063u, 0x00050050u, 0x0000000du, 0x0000011bu, 0x0000002cu, + 0x0000011au, 0x0003003eu, 0x0000010du, 0x0000011bu, 0x000200f9u, 0x0000010fu, 0x000200f8u, 0x0000010fu, + 0x0004003du, 0x0000000du, 0x0000011cu, 0x0000010du, 0x0003003eu, 0x0000010bu, 0x0000011cu, 0x0003003eu, + 0x0000011du, 0x0000002cu, 0x0003003eu, 0x0000011eu, 0x0000002cu, 0x0003003eu, 0x00000120u, 0x00000068u, + 0x000200f9u, 0x00000121u, 0x000200f8u, 0x00000121u, 0x000400f6u, 0x00000123u, 0x00000124u, 0x00000000u, + 0x000200f9u, 0x00000125u, 0x000200f8u, 0x00000125u, 0x0004003du, 0x00000067u, 0x00000126u, 0x00000120u, + 0x000500b3u, 0x000000f1u, 0x00000128u, 0x00000126u, 0x00000127u, 0x000400fau, 0x00000128u, 0x00000122u, + 0x00000123u, 0x000200f8u, 0x00000122u, 0x0004003du, 0x0000000du, 0x0000012au, 0x000000feu, 0x0004003du, + 0x00000067u, 0x0000012bu, 0x00000120u, 0x0004006fu, 0x00000006u, 0x0000012cu, 0x0000012bu, 0x0005008eu, + 0x0000000du, 0x0000012du, 0x0000012au, 0x0000012cu, 0x0003003eu, 0x00000129u, 0x0000012du, 0x0004003du, + 0x000000f1u, 0x0000012fu, 0x000000fau, 0x000300f7u, 0x00000132u, 0x00000000u, 0x000400fau, 0x0000012fu, + 0x00000131u, 0x0000013au, 0x000200f8u, 0x00000131u, 0x0004003du, 0x0000000du, 0x00000133u, 0x00000070u, + 0x0004003du, 0x0000000du, 0x00000134u, 0x00000129u, 0x00050083u, 0x0000000du, 0x00000135u, 0x00000133u, + 0x00000134u, 0x0003003eu, 0x00000136u, 0x00000135u, 0x0004003du, 0x0000000du, 0x00000138u, 0x00000062u, + 0x0003003eu, 0x00000137u, 0x00000138u, 0x00060039u, 0x00000006u, 0x00000139u, 0x00000012u, 0x00000136u, + 0x00000137u, 0x0003003eu, 0x00000130u, 0x00000139u, 0x000200f9u, 0x00000132u, 0x000200f8u, 0x0000013au, + 0x0004003du, 0x0000000du, 0x0000013bu, 0x00000070u, 0x0004003du, 0x0000000du, 0x0000013cu, 0x00000129u, + 0x00050083u, 0x0000000du, 0x0000013du, 0x0000013bu, 0x0000013cu, 0x0003003eu, 0x0000013eu, 0x0000013du, + 0x0004003du, 0x0000000du, 0x00000140u, 0x00000062u, 0x0003003eu, 0x0000013fu, 0x00000140u, 0x00060039u, + 0x00000006u, 0x00000141u, 0x00000016u, 0x0000013eu, 0x0000013fu, 0x0003003eu, 0x00000130u, 0x00000141u, + 0x000200f9u, 0x00000132u, 0x000200f8u, 0x00000132u, 0x0004003du, 0x00000006u, 0x00000142u, 0x00000130u, + 0x0003003eu, 0x0000012eu, 0x00000142u, 0x0004003du, 0x000000f1u, 0x00000144u, 0x000000fau, 0x000300f7u, + 0x00000147u, 0x00000000u, 0x000400fau, 0x00000144u, 0x00000146u, 0x0000014fu, 0x000200f8u, 0x00000146u, + 0x0004003du, 0x0000000du, 0x00000148u, 0x00000070u, 0x0004003du, 0x0000000du, 0x00000149u, 0x00000129u, + 0x00050081u, 0x0000000du, 0x0000014au, 0x00000148u, 0x00000149u, 0x0003003eu, 0x0000014bu, 0x0000014au, + 0x0004003du, 0x0000000du, 0x0000014du, 0x00000062u, 0x0003003eu, 0x0000014cu, 0x0000014du, 0x00060039u, + 0x00000006u, 0x0000014eu, 0x00000012u, 0x0000014bu, 0x0000014cu, 0x0003003eu, 0x00000145u, 0x0000014eu, + 0x000200f9u, 0x00000147u, 0x000200f8u, 0x0000014fu, 0x0004003du, 0x0000000du, 0x00000150u, 0x00000070u, + 0x0004003du, 0x0000000du, 0x00000151u, 0x00000129u, 0x00050081u, 0x0000000du, 0x00000152u, 0x00000150u, + 0x00000151u, 0x0003003eu, 0x00000153u, 0x00000152u, 0x0004003du, 0x0000000du, 0x00000155u, 0x00000062u, + 0x0003003eu, 0x00000154u, 0x00000155u, 0x00060039u, 0x00000006u, 0x00000156u, 0x00000016u, 0x00000153u, + 0x00000154u, 0x0003003eu, 0x00000145u, 0x00000156u, 0x000200f9u, 0x00000147u, 0x000200f8u, 0x00000147u, + 0x0004003du, 0x00000006u, 0x00000157u, 0x00000145u, 0x0003003eu, 0x00000143u, 0x00000157u, 0x0004003du, + 0x00000006u, 0x00000158u, 0x0000011du, 0x0004003du, 0x00000067u, 0x00000159u, 0x00000120u, 0x00050082u, + 0x00000067u, 0x0000015au, 0x00000159u, 0x00000068u, 0x0004006fu, 0x00000006u, 0x0000015bu, 0x0000015au, + 0x000500b4u, 0x000000f1u, 0x0000015cu, 0x00000158u, 0x0000015bu, 0x000300f7u, 0x0000015eu, 0x00000000u, + 0x000400fau, 0x0000015cu, 0x0000015du, 0x0000015eu, 0x000200f8u, 0x0000015du, 0x0004003du, 0x00000006u, + 0x0000015fu, 0x0000012eu, 0x0004003du, 0x00000006u, 0x00000160u, 0x000000ddu, 0x00050085u, 0x00000006u, + 0x00000162u, 0x00000160u, 0x00000161u, 0x000500bau, 0x000000f1u, 0x00000163u, 0x0000015fu, 0x00000162u, + 0x000200f9u, 0x0000015eu, 0x000200f8u, 0x0000015eu, 0x000700f5u, 0x000000f1u, 0x00000164u, 0x0000015cu, + 0x00000147u, 0x00000163u, 0x0000015du, 0x000300f7u, 0x00000166u, 0x00000000u, 0x000400fau, 0x00000164u, + 0x00000165u, 0x00000166u, 0x000200f8u, 0x00000165u, 0x0004003du, 0x00000067u, 0x00000167u, 0x00000120u, + 0x0004006fu, 0x00000006u, 0x00000168u, 0x00000167u, 0x0003003eu, 0x0000011du, 0x00000168u, 0x000200f9u, + 0x00000166u, 0x000200f8u, 0x00000166u, 0x0004003du, 0x00000006u, 0x00000169u, 0x0000011eu, 0x0004003du, + 0x00000067u, 0x0000016au, 0x00000120u, 0x00050082u, 0x00000067u, 0x0000016bu, 0x0000016au, 0x00000068u, + 0x0004006fu, 0x00000006u, 0x0000016cu, 0x0000016bu, 0x000500b4u, 0x000000f1u, 0x0000016du, 0x00000169u, + 0x0000016cu, 0x000300f7u, 0x0000016fu, 0x00000000u, 0x000400fau, 0x0000016du, 0x0000016eu, 0x0000016fu, + 0x000200f8u, 0x0000016eu, 0x0004003du, 0x00000006u, 0x00000170u, 0x00000143u, 0x0004003du, 0x00000006u, + 0x00000171u, 0x000000ddu, 0x00050085u, 0x00000006u, 0x00000172u, 0x00000171u, 0x00000161u, 0x000500bau, + 0x000000f1u, 0x00000173u, 0x00000170u, 0x00000172u, 0x000200f9u, 0x0000016fu, 0x000200f8u, 0x0000016fu, + 0x000700f5u, 0x000000f1u, 0x00000174u, 0x0000016du, 0x00000166u, 0x00000173u, 0x0000016eu, 0x000300f7u, + 0x00000176u, 0x00000000u, 0x000400fau, 0x00000174u, 0x00000175u, 0x00000176u, 0x000200f8u, 0x00000175u, + 0x0004003du, 0x00000067u, 0x00000177u, 0x00000120u, 0x0004006fu, 0x00000006u, 0x00000178u, 0x00000177u, + 0x0003003eu, 0x0000011eu, 0x00000178u, 0x000200f9u, 0x00000176u, 0x000200f8u, 0x00000176u, 0x000200f9u, + 0x00000124u, 0x000200f8u, 0x00000124u, 0x0004003du, 0x00000067u, 0x00000179u, 0x00000120u, 0x00050080u, + 0x00000067u, 0x0000017au, 0x00000179u, 0x00000068u, 0x0003003eu, 0x00000120u, 0x0000017au, 0x000200f9u, + 0x00000121u, 0x000200f8u, 0x00000123u, 0x0004003du, 0x00000006u, 0x0000017cu, 0x0000011du, 0x0004003du, + 0x00000006u, 0x0000017du, 0x0000011eu, 0x00050081u, 0x00000006u, 0x0000017eu, 0x0000017cu, 0x0000017du, + 0x0003003eu, 0x0000017bu, 0x0000017eu, 0x0004003du, 0x00000006u, 0x00000180u, 0x000000ddu, 0x0004003du, + 0x00000006u, 0x00000181u, 0x000000ddu, 0x00050085u, 0x00000006u, 0x00000183u, 0x00000181u, 0x00000182u, + 0x0004003du, 0x00000006u, 0x00000184u, 0x000000ebu, 0x0008000cu, 0x00000006u, 0x00000185u, 0x00000001u, + 0x00000031u, 0x00000180u, 0x00000183u, 0x00000184u, 0x0003003eu, 0x0000017fu, 0x00000185u, 0x0004003du, + 0x00000023u, 0x00000187u, 0x00000025u, 0x0004003du, 0x0000000du, 0x00000188u, 0x00000070u, 0x00050041u, + 0x00000020u, 0x00000189u, 0x00000062u, 0x00000029u, 0x0004003du, 0x00000006u, 0x0000018au, 0x00000189u, + 0x0004007fu, 0x00000006u, 0x0000018bu, 0x0000018au, 0x00050041u, 0x00000020u, 0x0000018cu, 0x00000062u, + 0x00000048u, 0x0004003du, 0x00000006u, 0x0000018du, 0x0000018cu, 0x0004007fu, 0x00000006u, 0x0000018eu, + 0x0000018du, 0x00050050u, 0x0000000du, 0x0000018fu, 0x0000018bu, 0x0000018eu, 0x00050081u, 0x0000000du, + 0x00000190u, 0x00000188u, 0x0000018fu, 0x00050057u, 0x0000002fu, 0x00000191u, 0x00000187u, 0x00000190u, + 0x0008004fu, 0x00000007u, 0x00000193u, 0x00000191u, 0x00000191u, 0x00000000u, 0x00000001u, 0x00000002u, + 0x0003003eu, 0x00000192u, 0x00000193u, 0x00050039u, 0x00000006u, 0x00000194u, 0x0000000bu, 0x00000192u, + 0x0003003eu, 0x00000186u, 0x00000194u, 0x0004003du, 0x00000023u, 0x00000196u, 0x00000025u, 0x0004003du, + 0x0000000du, 0x00000197u, 0x00000070u, 0x00050041u, 0x00000020u, 0x00000198u, 0x00000062u, 0x00000029u, + 0x0004003du, 0x00000006u, 0x00000199u, 0x00000198u, 0x00050041u, 0x00000020u, 0x0000019au, 0x00000062u, + 0x00000048u, 0x0004003du, 0x00000006u, 0x0000019bu, 0x0000019au, 0x0004007fu, 0x00000006u, 0x0000019cu, + 0x0000019bu, 0x00050050u, 0x0000000du, 0x0000019du, 0x00000199u, 0x0000019cu, 0x00050081u, 0x0000000du, + 0x0000019eu, 0x00000197u, 0x0000019du, 0x00050057u, 0x0000002fu, 0x0000019fu, 0x00000196u, 0x0000019eu, + 0x0008004fu, 0x00000007u, 0x000001a1u, 0x0000019fu, 0x0000019fu, 0x00000000u, 0x00000001u, 0x00000002u, + 0x0003003eu, 0x000001a0u, 0x000001a1u, 0x00050039u, 0x00000006u, 0x000001a2u, 0x0000000bu, 0x000001a0u, + 0x0003003eu, 0x00000195u, 0x000001a2u, 0x0004003du, 0x00000023u, 0x000001a4u, 0x00000025u, 0x0004003du, + 0x0000000du, 0x000001a5u, 0x00000070u, 0x00050041u, 0x00000020u, 0x000001a6u, 0x00000062u, 0x00000029u, + 0x0004003du, 0x00000006u, 0x000001a7u, 0x000001a6u, 0x0004007fu, 0x00000006u, 0x000001a8u, 0x000001a7u, + 0x00050041u, 0x00000020u, 0x000001a9u, 0x00000062u, 0x00000048u, 0x0004003du, 0x00000006u, 0x000001aau, + 0x000001a9u, 0x00050050u, 0x0000000du, 0x000001abu, 0x000001a8u, 0x000001aau, 0x00050081u, 0x0000000du, + 0x000001acu, 0x000001a5u, 0x000001abu, 0x00050057u, 0x0000002fu, 0x000001adu, 0x000001a4u, 0x000001acu, + 0x0008004fu, 0x00000007u, 0x000001afu, 0x000001adu, 0x000001adu, 0x00000000u, 0x00000001u, 0x00000002u, + 0x0003003eu, 0x000001aeu, 0x000001afu, 0x00050039u, 0x00000006u, 0x000001b0u, 0x0000000bu, 0x000001aeu, + 0x0003003eu, 0x000001a3u, 0x000001b0u, 0x0004003du, 0x00000023u, 0x000001b2u, 0x00000025u, 0x0004003du, + 0x0000000du, 0x000001b3u, 0x00000070u, 0x00050041u, 0x00000020u, 0x000001b4u, 0x00000062u, 0x00000029u, + 0x0004003du, 0x00000006u, 0x000001b5u, 0x000001b4u, 0x00050041u, 0x00000020u, 0x000001b6u, 0x00000062u, + 0x00000048u, 0x0004003du, 0x00000006u, 0x000001b7u, 0x000001b6u, 0x00050050u, 0x0000000du, 0x000001b8u, + 0x000001b5u, 0x000001b7u, 0x00050081u, 0x0000000du, 0x000001b9u, 0x000001b3u, 0x000001b8u, 0x00050057u, + 0x0000002fu, 0x000001bau, 0x000001b2u, 0x000001b9u, 0x0008004fu, 0x00000007u, 0x000001bcu, 0x000001bau, + 0x000001bau, 0x00000000u, 0x00000001u, 0x00000002u, 0x0003003eu, 0x000001bbu, 0x000001bcu, 0x00050039u, + 0x00000006u, 0x000001bdu, 0x0000000bu, 0x000001bbu, 0x0003003eu, 0x000001b1u, 0x000001bdu, 0x0004003du, + 0x00000006u, 0x000001bfu, 0x0000011du, 0x0004003du, 0x00000006u, 0x000001c0u, 0x0000011eu, 0x00050083u, + 0x00000006u, 0x000001c1u, 0x000001bfu, 0x000001c0u, 0x0006000cu, 0x00000006u, 0x000001c2u, 0x00000001u, + 0x00000004u, 0x000001c1u, 0x0004003du, 0x00000006u, 0x000001c3u, 0x0000017bu, 0x0007000cu, 0x00000006u, + 0x000001c4u, 0x00000001u, 0x00000028u, 0x000001c3u, 0x00000063u, 0x00050088u, 0x00000006u, 0x000001c5u, + 0x000001c2u, 0x000001c4u, 0x0008000cu, 0x00000006u, 0x000001c6u, 0x00000001u, 0x0000002bu, 0x000001c5u, + 0x0000002cu, 0x00000063u, 0x0003003eu, 0x000001beu, 0x000001c6u, 0x0004003du, 0x00000006u, 0x000001c8u, + 0x000001beu, 0x0004003du, 0x00000006u, 0x000001c9u, 0x0000017bu, 0x00050085u, 0x00000006u, 0x000001cbu, + 0x000001c9u, 0x000001cau, 0x00050081u, 0x00000006u, 0x000001ccu, 0x00000063u, 0x000001cbu, 0x00050088u, + 0x00000006u, 0x000001cdu, 0x000001c8u, 0x000001ccu, 0x0003003eu, 0x000001c7u, 0x000001cdu, 0x0004003du, + 0x000000f1u, 0x000001cfu, 0x000000fau, 0x000300f7u, 0x000001d2u, 0x00000000u, 0x000400fau, 0x000001cfu, + 0x000001d1u, 0x000001d7u, 0x000200f8u, 0x000001d1u, 0x0004003du, 0x00000006u, 0x000001d3u, 0x00000186u, + 0x0004003du, 0x00000006u, 0x000001d4u, 0x00000195u, 0x00050083u, 0x00000006u, 0x000001d5u, 0x000001d3u, + 0x000001d4u, 0x0006000cu, 0x00000006u, 0x000001d6u, 0x00000001u, 0x00000004u, 0x000001d5u, 0x0003003eu, + 0x000001d0u, 0x000001d6u, 0x000200f9u, 0x000001d2u, 0x000200f8u, 0x000001d7u, 0x0004003du, 0x00000006u, + 0x000001d8u, 0x00000186u, 0x0004003du, 0x00000006u, 0x000001d9u, 0x000001a3u, 0x00050083u, 0x00000006u, + 0x000001dau, 0x000001d8u, 0x000001d9u, 0x0006000cu, 0x00000006u, 0x000001dbu, 0x00000001u, 0x00000004u, + 0x000001dau, 0x0003003eu, 0x000001d0u, 0x000001dbu, 0x000200f9u, 0x000001d2u, 0x000200f8u, 0x000001d2u, + 0x0004003du, 0x00000006u, 0x000001dcu, 0x000001d0u, 0x0003003eu, 0x000001ceu, 0x000001dcu, 0x0004003du, + 0x000000f1u, 0x000001deu, 0x000000fau, 0x000300f7u, 0x000001e1u, 0x00000000u, 0x000400fau, 0x000001deu, + 0x000001e0u, 0x000001e6u, 0x000200f8u, 0x000001e0u, 0x0004003du, 0x00000006u, 0x000001e2u, 0x000001a3u, + 0x0004003du, 0x00000006u, 0x000001e3u, 0x000001b1u, 0x00050083u, 0x00000006u, 0x000001e4u, 0x000001e2u, + 0x000001e3u, 0x0006000cu, 0x00000006u, 0x000001e5u, 0x00000001u, 0x00000004u, 0x000001e4u, 0x0003003eu, + 0x000001dfu, 0x000001e5u, 0x000200f9u, 0x000001e1u, 0x000200f8u, 0x000001e6u, 0x0004003du, 0x00000006u, + 0x000001e7u, 0x00000195u, 0x0004003du, 0x00000006u, 0x000001e8u, 0x000001b1u, 0x00050083u, 0x00000006u, + 0x000001e9u, 0x000001e7u, 0x000001e8u, 0x0006000cu, 0x00000006u, 0x000001eau, 0x00000001u, 0x00000004u, + 0x000001e9u, 0x0003003eu, 0x000001dfu, 0x000001eau, 0x000200f9u, 0x000001e1u, 0x000200f8u, 0x000001e1u, + 0x0004003du, 0x00000006u, 0x000001ebu, 0x000001dfu, 0x0003003eu, 0x000001ddu, 0x000001ebu, 0x0004003du, + 0x00000006u, 0x000001edu, 0x000001ceu, 0x0004003du, 0x00000006u, 0x000001eeu, 0x000001ddu, 0x00050083u, + 0x00000006u, 0x000001efu, 0x000001edu, 0x000001eeu, 0x0006000cu, 0x00000006u, 0x000001f0u, 0x00000001u, + 0x00000004u, 0x000001efu, 0x0003003eu, 0x000001ecu, 0x000001f0u, 0x0004003du, 0x00000006u, 0x000001f2u, + 0x000000ddu, 0x0004003du, 0x00000006u, 0x000001f3u, 0x000000ddu, 0x00050085u, 0x00000006u, 0x000001f4u, + 0x000001f3u, 0x00000182u, 0x0004003du, 0x00000006u, 0x000001f5u, 0x000001ecu, 0x0008000cu, 0x00000006u, + 0x000001f6u, 0x00000001u, 0x00000031u, 0x000001f2u, 0x000001f4u, 0x000001f5u, 0x0003003eu, 0x000001f1u, + 0x000001f6u, 0x0004003du, 0x00000006u, 0x000001f9u, 0x000001f1u, 0x00050085u, 0x00000006u, 0x000001fau, + 0x000001f8u, 0x000001f9u, 0x0004003du, 0x00000006u, 0x000001fbu, 0x0000017bu, 0x00050088u, 0x00000006u, + 0x000001fdu, 0x000001fbu, 0x000001fcu, 0x0008000cu, 0x00000006u, 0x000001feu, 0x00000001u, 0x0000002bu, + 0x000001fdu, 0x0000002cu, 0x00000063u, 0x00050085u, 0x00000006u, 0x000001ffu, 0x000001fau, 0x000001feu, + 0x0003003eu, 0x000001f7u, 0x000001ffu, 0x0004003du, 0x00000006u, 0x00000201u, 0x00000186u, 0x0004003du, + 0x00000006u, 0x00000202u, 0x000001b1u, 0x00050083u, 0x00000006u, 0x00000203u, 0x00000201u, 0x00000202u, + 0x0006000cu, 0x00000006u, 0x00000204u, 0x00000001u, 0x00000004u, 0x00000203u, 0x0004003du, 0x00000006u, + 0x00000205u, 0x00000195u, 0x0004003du, 0x00000006u, 0x00000206u, 0x000001a3u, 0x00050083u, 0x00000006u, + 0x00000207u, 0x00000205u, 0x00000206u, 0x0006000cu, 0x00000006u, 0x00000208u, 0x00000001u, 0x00000004u, + 0x00000207u, 0x0007000cu, 0x00000006u, 0x00000209u, 0x00000001u, 0x00000028u, 0x00000204u, 0x00000208u, + 0x0003003eu, 0x00000200u, 0x00000209u, 0x0004003du, 0x00000006u, 0x0000020cu, 0x000000ddu, 0x0004003du, + 0x00000006u, 0x0000020du, 0x000000ddu, 0x00050085u, 0x00000006u, 0x0000020fu, 0x0000020du, 0x0000020eu, + 0x0004003du, 0x00000006u, 0x00000210u, 0x00000200u, 0x0008000cu, 0x00000006u, 0x00000211u, 0x00000001u, + 0x00000031u, 0x0000020cu, 0x0000020fu, 0x00000210u, 0x00050085u, 0x00000006u, 0x00000212u, 0x0000020bu, + 0x00000211u, 0x00050083u, 0x00000006u, 0x00000213u, 0x00000063u, 0x00000212u, 0x0003003eu, 0x0000020au, + 0x00000213u, 0x0004003du, 0x00000006u, 0x00000215u, 0x000001f7u, 0x0004003du, 0x00000006u, 0x00000216u, + 0x000001c7u, 0x00050085u, 0x00000006u, 0x00000217u, 0x00000215u, 0x00000216u, 0x0004003du, 0x00000006u, + 0x00000218u, 0x0000017fu, 0x00050085u, 0x00000006u, 0x00000219u, 0x00000217u, 0x00000218u, 0x0004003du, + 0x00000006u, 0x0000021au, 0x0000020au, 0x00050085u, 0x00000006u, 0x0000021bu, 0x00000219u, 0x0000021au, + 0x0003003eu, 0x00000214u, 0x0000021bu, 0x0004003du, 0x00000006u, 0x0000021du, 0x000000e3u, 0x0004003du, + 0x00000006u, 0x0000021eu, 0x000000e7u, 0x0007000cu, 0x00000006u, 0x0000021fu, 0x00000001u, 0x00000025u, + 0x0000021du, 0x0000021eu, 0x0003003eu, 0x0000021cu, 0x0000021fu, 0x0004003du, 0x00000006u, 0x00000221u, + 0x000000ddu, 0x0004003du, 0x00000006u, 0x00000222u, 0x000000ddu, 0x00050085u, 0x00000006u, 0x00000223u, + 0x00000222u, 0x00000182u, 0x0004003du, 0x00000006u, 0x00000224u, 0x0000021cu, 0x0008000cu, 0x00000006u, + 0x00000225u, 0x00000001u, 0x00000031u, 0x00000221u, 0x00000223u, 0x00000224u, 0x0003003eu, 0x00000220u, + 0x00000225u, 0x0004003du, 0x00000006u, 0x00000227u, 0x0000017bu, 0x0008000cu, 0x00000006u, 0x00000228u, + 0x00000001u, 0x00000031u, 0x00000063u, 0x0000020eu, 0x00000227u, 0x0003003eu, 0x00000226u, 0x00000228u, + 0x0004003du, 0x00000006u, 0x0000022bu, 0x00000220u, 0x00050085u, 0x00000006u, 0x0000022cu, 0x0000022au, + 0x0000022bu, 0x0004003du, 0x00000006u, 0x0000022du, 0x0000017fu, 0x00050085u, 0x00000006u, 0x0000022eu, + 0x0000022cu, 0x0000022du, 0x0004003du, 0x00000006u, 0x0000022fu, 0x0000020au, 0x00050085u, 0x00000006u, + 0x00000230u, 0x0000022eu, 0x0000022fu, 0x0004003du, 0x00000006u, 0x00000231u, 0x00000226u, 0x00050085u, + 0x00000006u, 0x00000232u, 0x00000230u, 0x00000231u, 0x0004003du, 0x00000006u, 0x00000233u, 0x000001f1u, + 0x00050085u, 0x00000006u, 0x00000234u, 0x00000232u, 0x00000233u, 0x0003003eu, 0x00000229u, 0x00000234u, + 0x0004003du, 0x00000006u, 0x00000236u, 0x00000214u, 0x0004003du, 0x00000006u, 0x00000237u, 0x00000229u, + 0x0007000cu, 0x00000006u, 0x00000238u, 0x00000001u, 0x00000028u, 0x00000236u, 0x00000237u, 0x0008000cu, + 0x00000006u, 0x0000023au, 0x00000001u, 0x0000002bu, 0x00000238u, 0x0000002cu, 0x00000239u, 0x0003003eu, + 0x00000235u, 0x0000023au, 0x0004003du, 0x00000023u, 0x0000023cu, 0x00000025u, 0x0004003du, 0x0000000du, + 0x0000023du, 0x00000070u, 0x0004003du, 0x0000000du, 0x0000023eu, 0x0000010bu, 0x0004003du, 0x0000000du, + 0x0000023fu, 0x00000062u, 0x00050085u, 0x0000000du, 0x00000240u, 0x0000023eu, 0x0000023fu, 0x00050081u, + 0x0000000du, 0x00000241u, 0x0000023du, 0x00000240u, 0x00050057u, 0x0000002fu, 0x00000242u, 0x0000023cu, + 0x00000241u, 0x0008004fu, 0x00000007u, 0x00000243u, 0x00000242u, 0x00000242u, 0x00000000u, 0x00000001u, + 0x00000002u, 0x0003003eu, 0x0000023bu, 0x00000243u, 0x0004003du, 0x0000002fu, 0x00000244u, 0x0000007cu, + 0x0008004fu, 0x00000007u, 0x00000245u, 0x00000244u, 0x00000244u, 0x00000000u, 0x00000001u, 0x00000002u, + 0x0004003du, 0x00000007u, 0x00000246u, 0x0000023bu, 0x0004003du, 0x00000006u, 0x00000247u, 0x00000235u, + 0x00060050u, 0x00000007u, 0x00000248u, 0x00000247u, 0x00000247u, 0x00000247u, 0x0008000cu, 0x00000007u, + 0x00000249u, 0x00000001u, 0x0000002eu, 0x00000245u, 0x00000246u, 0x00000248u, 0x00050041u, 0x00000020u, + 0x0000024bu, 0x0000007cu, 0x0000024au, 0x0004003du, 0x00000006u, 0x0000024cu, 0x0000024bu, 0x00050051u, + 0x00000006u, 0x0000024du, 0x00000249u, 0x00000000u, 0x00050051u, 0x00000006u, 0x0000024eu, 0x00000249u, + 0x00000001u, 0x00050051u, 0x00000006u, 0x0000024fu, 0x00000249u, 0x00000002u, 0x00070050u, 0x0000002fu, + 0x00000250u, 0x0000024du, 0x0000024eu, 0x0000024fu, 0x0000024cu, 0x0003003eu, 0x000000f6u, 0x00000250u, + 0x000100fdu, 0x00010038u, 0x00050036u, 0x00000006u, 0x0000000bu, 0x00000000u, 0x00000009u, 0x00030037u, + 0x00000008u, 0x0000000au, 0x000200f8u, 0x0000000cu, 0x0004003du, 0x00000007u, 0x00000018u, 0x0000000au, + 0x00050094u, 0x00000006u, 0x0000001du, 0x00000018u, 0x0000001cu, 0x000200feu, 0x0000001du, 0x00010038u, + 0x00050036u, 0x00000006u, 0x00000012u, 0x00000000u, 0x0000000fu, 0x00030037u, 0x0000000eu, 0x00000010u, + 0x00030037u, 0x0000000eu, 0x00000011u, 0x000200f8u, 0x00000013u, 0x0004003bu, 0x00000020u, 0x00000021u, + 0x00000007u, 0x0004003bu, 0x00000008u, 0x00000031u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x00000034u, + 0x00000007u, 0x0004003bu, 0x00000008u, 0x0000003cu, 0x00000007u, 0x0004003du, 0x00000023u, 0x00000026u, + 0x00000025u, 0x0004003du, 0x0000000du, 0x00000027u, 0x00000010u, 0x00050041u, 0x00000020u, 0x0000002au, + 0x00000011u, 0x00000029u, 0x0004003du, 0x00000006u, 0x0000002bu, 0x0000002au, 0x00050050u, 0x0000000du, + 0x0000002du, 0x0000002bu, 0x0000002cu, 0x00050083u, 0x0000000du, 0x0000002eu, 0x00000027u, 0x0000002du, + 0x00050057u, 0x0000002fu, 0x00000030u, 0x00000026u, 0x0000002eu, 0x0008004fu, 0x00000007u, 0x00000032u, + 0x00000030u, 0x00000030u, 0x00000000u, 0x00000001u, 0x00000002u, 0x0003003eu, 0x00000031u, 0x00000032u, + 0x00050039u, 0x00000006u, 0x00000033u, 0x0000000bu, 0x00000031u, 0x0003003eu, 0x00000021u, 0x00000033u, + 0x0004003du, 0x00000023u, 0x00000035u, 0x00000025u, 0x0004003du, 0x0000000du, 0x00000036u, 0x00000010u, + 0x00050041u, 0x00000020u, 0x00000037u, 0x00000011u, 0x00000029u, 0x0004003du, 0x00000006u, 0x00000038u, + 0x00000037u, 0x00050050u, 0x0000000du, 0x00000039u, 0x00000038u, 0x0000002cu, 0x00050081u, 0x0000000du, + 0x0000003au, 0x00000036u, 0x00000039u, 0x00050057u, 0x0000002fu, 0x0000003bu, 0x00000035u, 0x0000003au, + 0x0008004fu, 0x00000007u, 0x0000003du, 0x0000003bu, 0x0000003bu, 0x00000000u, 0x00000001u, 0x00000002u, + 0x0003003eu, 0x0000003cu, 0x0000003du, 0x00050039u, 0x00000006u, 0x0000003eu, 0x0000000bu, 0x0000003cu, + 0x0003003eu, 0x00000034u, 0x0000003eu, 0x0004003du, 0x00000006u, 0x0000003fu, 0x00000021u, 0x0004003du, + 0x00000006u, 0x00000040u, 0x00000034u, 0x00050083u, 0x00000006u, 0x00000041u, 0x0000003fu, 0x00000040u, + 0x0006000cu, 0x00000006u, 0x00000042u, 0x00000001u, 0x00000004u, 0x00000041u, 0x000200feu, 0x00000042u, + 0x00010038u, 0x00050036u, 0x00000006u, 0x00000016u, 0x00000000u, 0x0000000fu, 0x00030037u, 0x0000000eu, + 0x00000014u, 0x00030037u, 0x0000000eu, 0x00000015u, 0x000200f8u, 0x00000017u, 0x0004003bu, 0x00000020u, + 0x00000045u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x0000004eu, 0x00000007u, 0x0004003bu, 0x00000020u, + 0x00000051u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x00000059u, 0x00000007u, 0x0004003du, 0x00000023u, + 0x00000046u, 0x00000025u, 0x0004003du, 0x0000000du, 0x00000047u, 0x00000014u, 0x00050041u, 0x00000020u, + 0x00000049u, 0x00000015u, 0x00000048u, 0x0004003du, 0x00000006u, 0x0000004au, 0x00000049u, 0x00050050u, + 0x0000000du, 0x0000004bu, 0x0000002cu, 0x0000004au, 0x00050083u, 0x0000000du, 0x0000004cu, 0x00000047u, + 0x0000004bu, 0x00050057u, 0x0000002fu, 0x0000004du, 0x00000046u, 0x0000004cu, 0x0008004fu, 0x00000007u, + 0x0000004fu, 0x0000004du, 0x0000004du, 0x00000000u, 0x00000001u, 0x00000002u, 0x0003003eu, 0x0000004eu, + 0x0000004fu, 0x00050039u, 0x00000006u, 0x00000050u, 0x0000000bu, 0x0000004eu, 0x0003003eu, 0x00000045u, + 0x00000050u, 0x0004003du, 0x00000023u, 0x00000052u, 0x00000025u, 0x0004003du, 0x0000000du, 0x00000053u, + 0x00000014u, 0x00050041u, 0x00000020u, 0x00000054u, 0x00000015u, 0x00000048u, 0x0004003du, 0x00000006u, + 0x00000055u, 0x00000054u, 0x00050050u, 0x0000000du, 0x00000056u, 0x0000002cu, 0x00000055u, 0x00050081u, + 0x0000000du, 0x00000057u, 0x00000053u, 0x00000056u, 0x00050057u, 0x0000002fu, 0x00000058u, 0x00000052u, + 0x00000057u, 0x0008004fu, 0x00000007u, 0x0000005au, 0x00000058u, 0x00000058u, 0x00000000u, 0x00000001u, + 0x00000002u, 0x0003003eu, 0x00000059u, 0x0000005au, 0x00050039u, 0x00000006u, 0x0000005bu, 0x0000000bu, + 0x00000059u, 0x0003003eu, 0x00000051u, 0x0000005bu, 0x0004003du, 0x00000006u, 0x0000005cu, 0x00000045u, + 0x0004003du, 0x00000006u, 0x0000005du, 0x00000051u, 0x00050083u, 0x00000006u, 0x0000005eu, 0x0000005cu, + 0x0000005du, 0x0006000cu, 0x00000006u, 0x0000005fu, 0x00000001u, 0x00000004u, 0x0000005eu, 0x000200feu, + 0x0000005fu, 0x00010038u, }; diff --git a/app/src/main/cpp/waylandcomp/src/effects_chain.c b/app/src/main/cpp/waylandcomp/src/effects_chain.c index 141a536229..385a46b322 100644 --- a/app/src/main/cpp/waylandcomp/src/effects_chain.c +++ b/app/src/main/cpp/waylandcomp/src/effects_chain.c @@ -155,6 +155,10 @@ int vkp_effects_upscaling(void) { return spatial_mode(g_cur.scaling) && g_cur.scaling != 6; } +int vkp_effects_sharpening(void) { + return vkp_effects_upscaling() || cas_active(&g_cur); +} + int vkp_effects_postprocessing(void) { vkp_effects_sync(); return effect_count(&g_cur) > 0; diff --git a/app/src/main/cpp/waylandcomp/src/effects_chain.h b/app/src/main/cpp/waylandcomp/src/effects_chain.h index 25f00225fc..bb1ca5ae1f 100644 --- a/app/src/main/cpp/waylandcomp/src/effects_chain.h +++ b/app/src/main/cpp/waylandcomp/src/effects_chain.h @@ -11,6 +11,7 @@ int vkp_effects_sync(void); int vkp_effects_active(void); int vkp_effects_upscaling(void); +int vkp_effects_sharpening(void); int vkp_effects_postprocessing(void); VkFilter vkp_effects_blit_filter(void); diff --git a/app/src/main/cpp/waylandcomp/src/vk_present.c b/app/src/main/cpp/waylandcomp/src/vk_present.c index 8c595d1711..53ddadaeb0 100644 --- a/app/src/main/cpp/waylandcomp/src/vk_present.c +++ b/app/src/main/cpp/waylandcomp/src/vk_present.c @@ -2179,7 +2179,7 @@ static int render_impl(int scene_w, int scene_h, const struct vkp_draw *draws, i VkImageLayout result_layout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; if (fx) { int mapped_w = (int)(scene_w * g_map.kx + 0.5f), mapped_h = (int)(scene_h * g_map.ky + 0.5f); - if (fg) { mapped_w = scene_w; mapped_h = scene_h; } + if (fg && !vkp_effects_sharpening()) { mapped_w = scene_w; mapped_h = scene_h; } vkp_effects_set_formats(scene_fmt, scene_fmt); result = vkp_effects_run(cmd, scene_img, input_w, input_h, mapped_w, mapped_h, &rw, &rh); effects_overlay_draws(cmd, result, rw, rh, scene_w, scene_h, diff --git a/app/src/main/java/com/droiddeck/launcher/App.kt b/app/src/main/java/com/droiddeck/launcher/App.kt index d13dd65403..1a45ab8512 100644 --- a/app/src/main/java/com/droiddeck/launcher/App.kt +++ b/app/src/main/java/com/droiddeck/launcher/App.kt @@ -45,15 +45,15 @@ class App : Application() { CrashHandler.install(this) com.droiddeck.launcher.input.ShortcutsRelay.Holder.install(this) com.droiddeck.launcher.agent.AgentHost.refresh(this) - com.droiddeck.launcher.agent.AgentTab.load(this) - com.droiddeck.launcher.ui.DeveloperTools.load(this) com.droiddeck.launcher.ui.NavTabs.load(this) + com.droiddeck.launcher.ui.DeveloperTools.load(this) com.droiddeck.launcher.ui.AgentPet.install(this) if (com.droiddeck.launcher.agent.AgentTab.visible) com.droiddeck.launcher.lab.LabNotice.openOnInstall = "agent" com.droiddeck.launcher.lab.LabNotice.started(this) com.droiddeck.launcher.session.QuestExperimental.initialize(this) com.droiddeck.launcher.session.SessionPrefs.applyNtsyncDefault(this) com.droiddeck.launcher.session.SessionPrefs.settleGpuDriverMode(this) + com.droiddeck.launcher.session.SessionPrefs.settleStoresTabOrder(this, com.droiddeck.launcher.stores.Store.entries.map { it.id }) com.droiddeck.launcher.update.AppUpdates.init(this) com.droiddeck.launcher.update.UpdateWatch.sync(this, com.droiddeck.launcher.update.AppUpdates.follow(this, null)) com.droiddeck.launcher.core.DownloadSource.init(this) diff --git a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt index 9b2db303c4..711790c010 100644 --- a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt @@ -208,8 +208,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet private var animationsEnabled by mutableStateOf(true) private var lowStorageWarning by mutableStateOf(true) private var launcherIcon by mutableStateOf(LauncherIcon.DARK) - private var gameStoresEnabled by mutableStateOf(true) - private var soundtracksEnabled by mutableStateOf(true) private var soundtracksIngame by mutableStateOf(false) private var soundtracks by mutableStateOf>(emptyList()) private var soundtracksLoaded by mutableStateOf(false) @@ -937,7 +935,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet val soundtrackId = com.droiddeck.launcher.frontend.SoundtrackShortcuts.read(request) if (soundtrackId != null) { soundtrackLaunch = true - navRequest = if (SessionPrefs.soundtracksEnabled(this)) "sound:$soundtrackId" else "app:$soundtrackId" + navRequest = if ("soundtracks" !in com.droiddeck.launcher.ui.NavTabs.hidden) "sound:$soundtrackId" else "app:$soundtrackId" request.data = null request.action = Intent.ACTION_MAIN return @@ -1245,8 +1243,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet lowStorageWarning = SessionPrefs.lowStorageWarning(this) LauncherIcon.repair(this, intent?.component) launcherIcon = LauncherIcon.current(this) - gameStoresEnabled = SessionPrefs.gameStoresEnabled(this) - soundtracksEnabled = SessionPrefs.soundtracksEnabled(this) soundtracksIngame = SessionPrefs.soundtracksIngame(this) gameStoresSpeedTier = SessionPrefs.gameStoresSpeedTier(this) storesShowMature = SessionPrefs.storesShowMature(this) @@ -1259,6 +1255,8 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet androidx.compose.runtime.LaunchedEffect(prootPack) { if (prootPack == com.droiddeck.launcher.core.AddonPack.State.Ready && installed == null) refresh() } + val appsTabShown = "android-apps" !in com.droiddeck.launcher.ui.NavTabs.hidden + androidx.compose.runtime.LaunchedEffect(appsTabShown) { if (appsTabShown && androidApps.isEmpty()) refreshAndroidApps() } DroidDeckTheme(theme, appScale = appScale) { com.droiddeck.launcher.ui.FocusGlideHost(androidx.compose.ui.Modifier.fillMaxSize().exposeTestTags()) { if (decky.deckyPendingZip != null) com.droiddeck.launcher.ui.DeckyZipWarningDialog( @@ -1342,8 +1340,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet animationsEnabled = animationsEnabled, lowStorageWarning = lowStorageWarning, launcherIcon = launcherIcon, - gameStoresEnabled = gameStoresEnabled, - soundtracksEnabled = soundtracksEnabled, + soundtracksEnabled = "soundtracks" !in com.droiddeck.launcher.ui.NavTabs.hidden, soundtracksIngame = soundtracksIngame, soundtracks = soundtracks, soundtracksLoaded = soundtracksLoaded, @@ -1619,8 +1616,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet offline = OfflineMode.enabled(this) }, onPageBack = { showPerformance = false; showComponents = false; showMapping = false }, - onGameStoresEnabled = { on -> SessionPrefs.setGameStoresEnabled(this, on); gameStoresEnabled = on }, - onSoundtracksEnabled = { on -> SessionPrefs.setSoundtracksEnabled(this, on); soundtracksEnabled = on }, onSoundtracksIngame = { on -> SessionPrefs.setSoundtracksIngame(this, on) soundtracksIngame = on @@ -2211,13 +2206,13 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet } private fun refreshAndroidApps() { - if (!homeAppSelected) { + if (!homeAppSelected && "android-apps" in com.droiddeck.launcher.ui.NavTabs.hidden) { ++androidAppsListing androidApps = emptyList() return } val seq = ++androidAppsListing - HomePins.refresh(this) + if (homeAppSelected) HomePins.refresh(this) Thread({ val apps = runCatching { HomeApp.launchableApps(this) }.getOrDefault(emptyList()) ui.post { if (seq == androidAppsListing) androidApps = apps } @@ -3312,7 +3307,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet com.droiddeck.launcher.core.AppLanguage.setChosen(this, com.droiddeck.launcher.core.AppLanguage.SYSTEM) if (!ok) android.widget.Toast.makeText(this, R.string.setup_reset_settings_partial, android.widget.Toast.LENGTH_LONG).show() com.droiddeck.launcher.ui.Motion.refresh(this) - com.droiddeck.launcher.agent.AgentTab.load(this) com.droiddeck.launcher.ui.DeveloperTools.load(this) com.droiddeck.launcher.ui.NavTabs.load(this) if (!switchLauncherIcon(LauncherIcon.DARK)) recreate() diff --git a/app/src/main/java/com/droiddeck/launcher/agent/AgentHarness.kt b/app/src/main/java/com/droiddeck/launcher/agent/AgentHarness.kt index 669a1c5503..1db8009699 100644 --- a/app/src/main/java/com/droiddeck/launcher/agent/AgentHarness.kt +++ b/app/src/main/java/com/droiddeck/launcher/agent/AgentHarness.kt @@ -20,13 +20,18 @@ interface AgentHarness { /** A guest command that signs in through $BROWSER. */ val signIn: List /** - * Where the user makes an API key, for a CLI whose own sign-in is a terminal prompt: [signIn] - * then only opens this page, and the key is pasted into DroidDeck and saved by [saveKey]. + * APIs the CLI reaches with a key pasted into DroidDeck, for a CLI whose own sign-in is a terminal + * prompt; empty when it signs in through [signIn]. */ - val keyPage: String? get() = null - /** Whether a key from [keyPage] is saved under [rootfs]. */ - fun hasKey(rootfs: File): Boolean = false - fun saveKey(rootfs: File, key: String) {} + val providers: List get() = emptyList() + /** Ids of the [providers] with a key saved under [rootfs]. */ + fun keys(rootfs: File): Set = emptySet() + /** + * Saves [key] for [provider]. A [Provider.custom] one also takes the [endpoint] it is served from, and + * [get] fetches a URL from the userland, with the key as a bearer token when it is not null. + */ + fun saveKey(rootfs: File, provider: Provider, key: String, endpoint: String? = null, get: (String, String?) -> String = { url, _ -> error("Cannot reach $url") }) {} + fun removeKey(rootfs: File, provider: Provider) {} /** Whether the CLI has models that need no account; [useFree] then counts as signed in. */ val free: Boolean get() = false fun useFree(rootfs: File) {} @@ -57,6 +62,9 @@ interface AgentHarness { data class Model(val id: String, val label: String) + /** An API reached with a key; [keyPage] is where the key is made, and a [custom] one is any OpenAI-compatible server. */ + data class Provider(val id: String, val name: String, val keyPage: String? = null, val custom: Boolean = false) + data class Options(val model: String? = null, val plan: Boolean = false, val brief: String? = null, val effort: String? = null) companion object { @@ -412,31 +420,117 @@ object OpenCode : AgentHarness { override val instructions = "root/.config/opencode/AGENTS.md" override val install = "curl -fsSL https://opencode.ai/install | bash -s -- --no-modify-path" private const val AUTH = "root/.local/share/opencode/auth.json" + private const val CONFIG = "root/.config/opencode/opencode.json" private const val FREE = "root/.config/opencode/.droiddeck-free" private const val MODELS = "root/.cache/droiddeck/opencode-models" + /** The provider id DroidDeck gives a server the user names, in opencode's config and auth. */ + private const val CUSTOM = "droiddeck" // `opencode models` lists only what the saved keys reach, so the check that runs it keeps the model list current. override val signedIn = listOf("sh", "-c", "mkdir -p /${MODELS.substringBeforeLast('/')}; $binary models --verbose > /$MODELS.$$ 2>/dev/null && mv -f /$MODELS.$$ /$MODELS; rm -f /$MODELS.$$; " + - "grep -q '\"type\"' /$AUTH 2>/dev/null || [ -e /$FREE ]") - override val keyPage = "https://opencode.ai/auth" - override val signIn = listOf("/root/.local/bin/android-open", keyPage) + "grep -q '\"type\"' /$AUTH 2>/dev/null || [ -e /$FREE ] || grep -q '\"$CUSTOM\"' /$CONFIG 2>/dev/null") + // Ids are opencode's own (models.dev), so a saved key is what `opencode auth login` would save for that provider. + override val providers = listOf( + AgentHarness.Provider("opencode", "OpenCode Zen", "https://opencode.ai/auth"), + AgentHarness.Provider("ollama-cloud", "Ollama Cloud", "https://ollama.com/settings/keys"), + AgentHarness.Provider("openrouter", "OpenRouter", "https://openrouter.ai/settings/keys"), + AgentHarness.Provider("openai", "OpenAI", "https://platform.openai.com/api-keys"), + AgentHarness.Provider("anthropic", "Anthropic", "https://console.anthropic.com/settings/keys"), + AgentHarness.Provider("google", "Gemini", "https://aistudio.google.com/apikey"), + AgentHarness.Provider(CUSTOM, "Other server", custom = true), + ) + override val signIn = listOf("/root/.local/bin/android-open", providers.first().keyPage!!) override val free = true override val plans = true override val efforts = listOf("low", "medium", "high") - override fun hasKey(rootfs: File) = runCatching { JSONObject(File(rootfs, AUTH).readText()).has("opencode") }.getOrDefault(false) + override fun keys(rootfs: File): Set { + val auth = runCatching { JSONObject(File(rootfs, AUTH).readText()) }.getOrNull() + val custom = runCatching { JSONObject(File(rootfs, CONFIG).readText()).optJSONObject("provider")?.has(CUSTOM) }.getOrNull() == true + return providers.filter { auth?.has(it.id) == true || (it.custom && custom) }.map { it.id }.toSet() + } - /** The key opencode's own `auth login` would save for OpenCode Zen. */ - override fun saveKey(rootfs: File, key: String) { - val file = File(rootfs, AUTH) - // An auth.json that cannot be read holds other providers' sign-ins too, so it is never replaced. - val auth = if (file.exists()) JSONObject(file.readText()) else JSONObject() - auth.put("opencode", JSONObject().put("type", "api").put("key", key.trim())) + /** + * Saves the key as opencode's own `auth login` would. A custom server also gets a provider in + * opencode's config with the models its `/models` lists, since opencode does not list them itself. + */ + override fun saveKey(rootfs: File, provider: AgentHarness.Provider, key: String, endpoint: String?, get: (String, String?) -> String) { + val token = key.trim().takeIf { it.isNotEmpty() } + // Both files are read before either is written, so one that cannot be read changes nothing. + val authFile = File(rootfs, AUTH) + val auth = readJson(authFile) + if (token != null) auth.put(provider.id, JSONObject().put("type", "api").put("key", token)) else auth.remove(provider.id) + if (!provider.custom) return writeJson(authFile, auth, private = true) + val base = endpoint(endpoint ?: "") + val configFile = File(rootfs, CONFIG) + val before = configFile.takeIf { it.exists() }?.readText() + val config = readJson(configFile) + val models = modelIds(get("$base/models", token)) + check(models.isNotEmpty()) { "No models at $base" } + if (!config.has("\$schema")) config.put("\$schema", "https://opencode.ai/config.json") + val all = config.optJSONObject("provider") ?: JSONObject().also { config.put("provider", it) } + all.put(CUSTOM, JSONObject() + .put("npm", "@ai-sdk/openai-compatible") + .put("name", runCatching { java.net.URI(base).host }.getOrNull() ?: provider.name) + .put("options", JSONObject().put("baseURL", base)) + .put("models", JSONObject().apply { models.forEach { put(it, JSONObject().put("name", it)) } })) + writeJson(configFile, config) + try { + writeJson(authFile, auth, private = true) + } catch (e: Exception) { + val undone = runCatching { + if (before != null) writeFile(configFile, before) else java.nio.file.Files.deleteIfExists(configFile.toPath()) + } + // First, since the setup row shows two lines of the message. + undone.exceptionOrNull()?.let { throw IllegalStateException("The server config could not be put back (${it.message}): ${e.message}", e) } + throw e + } + } + + override fun removeKey(rootfs: File, provider: AgentHarness.Provider) { + if (File(rootfs, AUTH).exists()) editJson(File(rootfs, AUTH), private = true) { it.remove(provider.id) } + if (provider.custom && File(rootfs, CONFIG).exists()) editJson(File(rootfs, CONFIG)) { it.optJSONObject("provider")?.remove(CUSTOM) } + } + + /** A server address as typed, made into the OpenAI-compatible base URL opencode calls. */ + @VisibleForTesting + internal fun endpoint(typed: String): String { + val url = typed.trim().trimEnd('/').let { if ("://" in it) it else "http://$it" } + require(url.substringAfter("://").isNotEmpty()) { "No server address" } + return if (url.substringAfter("://").contains('/')) url else "$url/v1" + } + + @VisibleForTesting + internal fun modelIds(body: String): List { + // The userland can print its own warnings ahead of the response. + val json = body.substring(body.indexOf('{').coerceAtLeast(0), body.lastIndexOf('}') + 1) + val data = runCatching { JSONObject(json).optJSONArray("data") }.getOrNull() ?: return emptyList() + return (0 until data.length()).mapNotNull { data.optJSONObject(it)?.optString("id")?.takeIf { id -> id.isNotEmpty() } }.distinct() + } + + // A file that cannot be read holds the user's other providers too, so it is never replaced. + private fun readJson(file: File) = if (file.exists()) JSONObject(file.readText()) else JSONObject() + + private fun editJson(file: File, private: Boolean = false, edit: (JSONObject) -> Unit) = + writeJson(file, readJson(file).also(edit), private) + + /** Writes beside [file] and moves it into place, so a write that stops partway leaves the old file. */ + private fun writeJson(file: File, json: JSONObject, private: Boolean = false) = writeFile(file, json.toString(2) + "\n", private) + + private fun writeFile(file: File, text: String, private: Boolean = false) { file.parentFile?.mkdirs() - file.writeText(auth.toString(2) + "\n") - file.setReadable(false, false) - file.setReadable(true, true) + val temp = File(file.parentFile, ".${file.name}.tmp") + try { + temp.writeText(text) + if (private) { + temp.setReadable(false, false) + temp.setReadable(true, true) + } + java.nio.file.Files.move(temp.toPath(), file.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING, java.nio.file.StandardCopyOption.ATOMIC_MOVE) + } finally { + temp.delete() + } } override fun useFree(rootfs: File) { @@ -473,7 +567,8 @@ object OpenCode : AgentHarness { runCatching { JSONObject(json.toString()) }.getOrNull()?.takeIf { it.optString("status") != "deprecated" }?.let { o -> val provider = o.optString("providerID") val label = o.optString("name").ifEmpty { current } - models += AgentHarness.Model(current, if (provider.isEmpty() || provider == "opencode") label else "$label · $provider") + val source = if (provider == "opencode" || provider == CUSTOM) "" else providers.firstOrNull { it.id == provider }?.name ?: provider + models += AgentHarness.Model(current, if (source.isEmpty()) label else "$label · $source") o.optJSONObject("limit")?.optLong("context")?.takeIf { it > 0 }?.let { windows[current] = it } } id = null diff --git a/app/src/main/java/com/droiddeck/launcher/agent/AgentSetup.kt b/app/src/main/java/com/droiddeck/launcher/agent/AgentSetup.kt index a4107fa287..e917e36605 100644 --- a/app/src/main/java/com/droiddeck/launcher/agent/AgentSetup.kt +++ b/app/src/main/java/com/droiddeck/launcher/agent/AgentSetup.kt @@ -27,25 +27,52 @@ object AgentSetup { val detail = mutableStateMapOf() var runtimeInstalled by mutableStateOf(true) private set - /** The harness has a key from its [AgentHarness.keyPage] saved; signed in without one means its free models. */ - var keySaved by mutableStateOf(false) + /** Ids of the harness's [AgentHarness.providers] with a key saved; signed in without one means its free models. */ + var keys by mutableStateOf(emptySet()) private set + /** The provider and custom server picked in the key field, kept while a save is checked. */ + var provider by mutableStateOf(null) + var server by mutableStateOf("") /** Saves a pasted key for a harness that signs in with one, then checks the sign-in again. */ - fun saveKey(context: Context, key: String) = signInLocally(context) { harness, root -> harness.saveKey(root, key) } + fun saveKey(context: Context, provider: AgentHarness.Provider, key: String, endpoint: String? = null) = signInLocally(context) { harness, root -> + harness.saveKey(root, provider, key, endpoint) { url, token -> fetch(context.applicationContext, url, token) } + } + + fun removeKey(context: Context, provider: AgentHarness.Provider) = signInLocally(context) { harness, root -> harness.removeKey(root, provider) } + + /** A GET from the userland, which reaches the LAN servers the app's own cleartext policy does not. */ + private fun fetch(app: Context, url: String, token: String?): String { + // The key goes in on stdin, so it is never in a command line. + val process = AgentHost.guest(app, listOf("curl", "-fsSL", "--max-time", "20", "-H", "@-", url), connectAdb = false).start() + process.outputStream.bufferedWriter().use { if (token != null) it.write("Authorization: Bearer $token\n") } + val output = process.inputStream.bufferedReader().readText() + check(process.waitFor(30, TimeUnit.SECONDS) && process.exitValue() == 0) { output.trim().lines().lastOrNull()?.takeIf { it.isNotEmpty() } ?: "Cannot reach $url" } + return output + } fun useFree(context: Context) = signInLocally(context) { harness, root -> harness.useFree(root) } + private val signInLock = Any() + private fun signInLocally(context: Context, write: (AgentHarness, File) -> Unit) { val app = context.applicationContext val harness = AgentHost.harness set(Step.SIGN_IN, Status.WORKING) Thread({ - val result = runCatching { write(harness, LinuxRuntime.rootDir(app)) } + // Each write reads the files the one before it left, including across a save's model request. + val result = synchronized(signInLock) { runCatching { write(harness, LinuxRuntime.rootDir(app)) } } main.post { - status[Step.SIGN_IN] = Status.UNKNOWN - result.exceptionOrNull()?.let { detail[Step.SIGN_IN] = it.message ?: "failed" } - check(app) + // A failure stays on the row with the key field open, since the next check would clear it. + val error = result.exceptionOrNull() + if (error != null) { + status[Step.SIGN_IN] = Status.FAILED + detail[Step.SIGN_IN] = error.message ?: "failed" + } else { + status[Step.SIGN_IN] = Status.UNKNOWN + detail.remove(Step.SIGN_IN) + check(app) + } } }, "agent-sign-in").start() } @@ -75,7 +102,7 @@ object AgentSetup { if (!runtimeInstalled) return AgentHost.refresh(app) val harness = AgentHost.harness - keySaved = harness.hasKey(LinuxRuntime.rootDir(app)) + keys = harness.keys(LinuxRuntime.rootDir(app)) val probes = mutableListOf>>() for (step in Step.entries) if (status[step] != Status.WORKING) { when (step) { @@ -102,10 +129,15 @@ object AgentSetup { fun runsAsRoot(step: Step) = step == Step.INSTALL /** Runs [step]'s action. [CONNECTION] is the app's own pairing flow, so the caller opens it. */ - fun run(context: Context, step: Step) { + fun run(context: Context, step: Step) = run(context, step, null) + + /** Opens the page where a provider's key is made, as the sign-in of a harness that takes pasted keys. */ + fun openKeyPage(context: Context, page: String) = run(context, Step.SIGN_IN, listOf("/root/.local/bin/android-open", page)) + + private fun run(context: Context, step: Step, override: List?) { val app = context.applicationContext val harness = AgentHost.harness - val command = when (step) { + val command = override ?: when (step) { Step.CONNECTION -> return Step.INSTALL -> { listOf("sh", "-c", "set -e; export DEBIAN_FRONTEND=noninteractive; " + diff --git a/app/src/main/java/com/droiddeck/launcher/agent/AgentTab.kt b/app/src/main/java/com/droiddeck/launcher/agent/AgentTab.kt index b779288f3e..7f7ee12ab4 100644 --- a/app/src/main/java/com/droiddeck/launcher/agent/AgentTab.kt +++ b/app/src/main/java/com/droiddeck/launcher/agent/AgentTab.kt @@ -1,23 +1,9 @@ package com.droiddeck.launcher.agent -import android.content.Context -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.setValue -import com.droiddeck.launcher.session.SessionPrefs +import com.droiddeck.launcher.ui.NavTabs object AgentTab { - var shown by mutableStateOf(false) - private set + val shown: Boolean get() = "agent" !in NavTabs.hidden val visible: Boolean get() = shown && AgentHost.available - - fun load(context: Context) { - shown = SessionPrefs.agentTab(context) - } - - fun set(context: Context, show: Boolean) { - shown = show - SessionPrefs.setAgentTab(context, show) - } } diff --git a/app/src/main/java/com/droiddeck/launcher/core/WirelessAdbFix.kt b/app/src/main/java/com/droiddeck/launcher/core/WirelessAdbFix.kt index 784b39d748..5c8b32f7ba 100644 --- a/app/src/main/java/com/droiddeck/launcher/core/WirelessAdbFix.kt +++ b/app/src/main/java/com/droiddeck/launcher/core/WirelessAdbFix.kt @@ -235,6 +235,17 @@ object WirelessAdbFix { fun hasSavedPairing(context: Context): Boolean = savedConnection(context.applicationContext) != null + fun savedPairingIsLocal(context: Context): Boolean = savedConnection(context.applicationContext)?.host + ?.let { host -> + // Unlike isLocalAddress, an address that cannot be matched to this device's own counts as remote. + runCatching { + val address = InetAddress.getByName(host) + address.isLoopbackAddress || NetworkInterface.getNetworkInterfaces().toList().any { network -> + network.inetAddresses.toList().any { it.address.contentEquals(address.address) } + } + }.getOrDefault(false) + } == true + fun clearCachedApps(context: Context) { shell(context, "am kill-all") } diff --git a/app/src/main/java/com/droiddeck/launcher/files/FileManagerScreen.kt b/app/src/main/java/com/droiddeck/launcher/files/FileManagerScreen.kt index 4da772b1e8..9945083226 100644 --- a/app/src/main/java/com/droiddeck/launcher/files/FileManagerScreen.kt +++ b/app/src/main/java/com/droiddeck/launcher/files/FileManagerScreen.kt @@ -40,12 +40,10 @@ import androidx.compose.material.icons.filled.ContentPaste import androidx.compose.material.icons.filled.CreateNewFolder import androidx.compose.material.icons.filled.Delete import androidx.compose.material.icons.filled.Folder -import androidx.compose.material.icons.filled.GridView import androidx.compose.material.icons.filled.SdStorage import androidx.compose.material.icons.filled.Search import androidx.compose.material.icons.filled.Sort import androidx.compose.material.icons.filled.Star -import androidx.compose.material.icons.filled.ViewList import androidx.compose.material.icons.filled.StarBorder import androidx.compose.material.icons.filled.Storage import androidx.compose.material.icons.filled.Smartphone @@ -727,11 +725,15 @@ fun FileManagerScreen( modifier = Modifier .fillMaxWidth() .background(MaterialTheme.colorScheme.surfaceContainer) - .then(if (compactToolbar) Modifier.horizontalScroll(rememberScrollState()) else Modifier) .padding(horizontal = 8.dp, vertical = 6.dp), ) { - IconButton(onClick = { requestNavigation(FileManagerNavigation.UP) }, enabled = canGoUp && !cancellingNavigation, modifier = Modifier.focusGlide(CircleShape)) { - Icon(Icons.Filled.ArrowBack, stringResource(R.string.fm_back), tint = MaterialTheme.colorScheme.primary) + val upEnabled = canGoUp && !cancellingNavigation + IconButton(onClick = { requestNavigation(FileManagerNavigation.UP) }, enabled = upEnabled, modifier = Modifier.focusGlide(CircleShape)) { + Icon( + Icons.Filled.ArrowBack, + stringResource(R.string.fm_back), + tint = if (upEnabled) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onSurface.copy(alpha = 0.38f), + ) } val currentDriveLabel = stringResource(describeLocation(currentDir).driveLabel) @@ -794,113 +796,119 @@ fun FileManagerScreen( Spacer(Modifier.width(4.dp)) - if (showFavorites) { - Text( - text = stringResource(R.string.fm_favorites), - color = MaterialTheme.colorScheme.primary, - fontSize = 13.sp, - fontWeight = FontWeight.SemiBold, - maxLines = 1, - overflow = TextOverflow.Ellipsis, - modifier = if (compactToolbar) Modifier.widthIn(max = 140.dp) else Modifier.weight(1f), - ) - } else if (LocalConfiguration.current.orientation == Configuration.ORIENTATION_PORTRAIT) { - if (!compactToolbar) Spacer(Modifier.weight(1f)) - } else { - Text( - text = currentDir.name.ifBlank { currentDir.absolutePath }, - color = MaterialTheme.colorScheme.onSurface, - fontSize = 14.sp, - fontWeight = FontWeight.SemiBold, - maxLines = 1, - overflow = TextOverflow.Ellipsis, - modifier = if (compactToolbar) Modifier.widthIn(max = 140.dp) else Modifier.weight(1f), - ) - } - - if (launchDir != null) { - IconButton(onClick = { requestNavigation(FileManagerNavigation.RETURN_TO_START) }, enabled = !cancellingNavigation, modifier = Modifier.focusGlide(CircleShape)) { - Icon(Icons.AutoMirrored.Filled.KeyboardReturn, stringResource(R.string.fm_return_to_start), tint = MaterialTheme.colorScheme.primary) - } - if (LocalConfiguration.current.screenWidthDp >= 700) Spacer(Modifier.width(56.dp)) - } - - if (!showFavorites) { - if (!pickMode) { - OutlinedButton( - onClick = { showNewFolderDialog = true }, - border = BorderStroke(1.dp, MaterialTheme.colorScheme.primary.copy(alpha = 0.6f)), - contentPadding = PaddingValues(horizontal = 10.dp, vertical = 2.dp), - modifier = Modifier.height(32.dp).focusGlide(CircleShape), - ) { - Icon(Icons.Filled.CreateNewFolder, null, tint = MaterialTheme.colorScheme.primary, modifier = Modifier.size(16.dp)) - Spacer(Modifier.width(5.dp)) - Text(stringResource(R.string.fm_new_folder), color = MaterialTheme.colorScheme.onBackground, fontSize = 12.sp) - } - } - IconButton(onClick = { - gridView = !gridView - browsePrefs.edit().putBoolean("fmGridView", gridView).apply() - }, modifier = Modifier.focusGlide(CircleShape)) { - Icon( - if (gridView) Icons.Filled.ViewList else Icons.Filled.GridView, - if (gridView) stringResource(R.string.fm_list_view) else stringResource(R.string.fm_grid_view), - tint = MaterialTheme.colorScheme.onSurfaceVariant, + Row( + verticalAlignment = Alignment.CenterVertically, + modifier = Modifier + .weight(1f) + .then(if (compactToolbar) Modifier.horizontalScroll(rememberScrollState()) else Modifier), + ) { + if (showFavorites) { + Text( + text = stringResource(R.string.fm_favorites), + color = MaterialTheme.colorScheme.primary, + fontSize = 13.sp, + fontWeight = FontWeight.SemiBold, + maxLines = 1, + overflow = TextOverflow.Ellipsis, + modifier = if (compactToolbar) Modifier.widthIn(max = 140.dp) else Modifier.weight(1f), + ) + } else if (LocalConfiguration.current.orientation == Configuration.ORIENTATION_PORTRAIT) { + if (!compactToolbar) Spacer(Modifier.weight(1f)) + } else { + Text( + text = currentDir.name.ifBlank { currentDir.absolutePath }, + color = MaterialTheme.colorScheme.onSurface, + fontSize = 14.sp, + fontWeight = FontWeight.SemiBold, + maxLines = 1, + overflow = TextOverflow.Ellipsis, + modifier = if (compactToolbar) Modifier.widthIn(max = 140.dp) else Modifier.weight(1f), ) } - IconButton(onClick = { showSearch = !showSearch; if (!showSearch) searchQuery = "" }, modifier = Modifier.focusGlide(CircleShape)) { - Icon(Icons.Filled.Search, stringResource(R.string.fm_search), tint = MaterialTheme.colorScheme.onSurfaceVariant) - } - Box { - IconButton(onClick = { showSortMenu = true }, modifier = Modifier.focusGlide(CircleShape)) { - Icon(Icons.Filled.Sort, stringResource(R.string.fm_sort), tint = MaterialTheme.colorScheme.onSurfaceVariant) - } - DropdownMenu(expanded = showSortMenu, onDismissRequest = { showSortMenu = false }) { - listOf("name" to stringResource(R.string.fm_sort_name), "date" to stringResource(R.string.fm_sort_date), "size" to stringResource(R.string.fm_prop_size)) - .forEach { (key, label) -> - DropdownMenuItem( - text = { - Text(if (sortBy == key) "$label ${if (sortDesc) "↓" else "↑"}" else label) - }, - onClick = { - if (sortBy == key) sortDesc = !sortDesc else { sortBy = key; sortDesc = false } - browsePrefs.edit().putString("fmSortBy", sortBy) - .putBoolean("fmSortDesc", sortDesc).apply() - showSortMenu = false - loadDirectory(currentDir, resetScroll = false) - }, - modifier = Modifier.focusGlide(), - ) - } - HorizontalDivider(color = MaterialTheme.colorScheme.outline) - DropdownMenuItem( - text = { Text(if (compactRows) stringResource(R.string.fm_rows_comfortable) else stringResource(R.string.fm_rows_compact)) }, - onClick = { - compactRows = !compactRows - browsePrefs.edit().putBoolean("fmCompactRows", compactRows).apply() - showSortMenu = false - }, - modifier = Modifier.focusGlide(), - ) - DropdownMenuItem( - text = { Text(if (showHidden) stringResource(R.string.fm_hide_hidden) else stringResource(R.string.fm_show_hidden)) }, - onClick = { - showHidden = !showHidden - browsePrefs.edit().putBoolean("fmShowHidden", showHidden).apply() - showSortMenu = false - loadDirectory(currentDir, resetScroll = false) - }, - modifier = Modifier.focusGlide(), - ) - } - } - } - IconButton(onClick = { showFavorites = !showFavorites }, modifier = Modifier.focusGlide(CircleShape)) { - if (showFavorites) { - Icon(Icons.Filled.Star, stringResource(R.string.fm_hide_favorites), tint = MaterialTheme.colorScheme.primary) - } else { - Icon(Icons.Filled.StarBorder, stringResource(R.string.fm_show_favorites), tint = MaterialTheme.colorScheme.onSurfaceVariant) + if (launchDir != null) { + IconButton(onClick = { requestNavigation(FileManagerNavigation.RETURN_TO_START) }, enabled = !cancellingNavigation, modifier = Modifier.focusGlide(CircleShape)) { + Icon(Icons.AutoMirrored.Filled.KeyboardReturn, stringResource(R.string.fm_return_to_start), tint = MaterialTheme.colorScheme.primary) + } + if (LocalConfiguration.current.screenWidthDp >= 700) Spacer(Modifier.width(56.dp)) + } + + if (!showFavorites) { + if (!pickMode) { + OutlinedButton( + onClick = { showNewFolderDialog = true }, + border = BorderStroke(1.dp, MaterialTheme.colorScheme.primary.copy(alpha = 0.6f)), + contentPadding = PaddingValues(horizontal = 10.dp, vertical = 2.dp), + modifier = Modifier.height(32.dp).focusGlide(CircleShape), + ) { + Icon(Icons.Filled.CreateNewFolder, null, tint = MaterialTheme.colorScheme.primary, modifier = Modifier.size(16.dp)) + Spacer(Modifier.width(5.dp)) + Text(stringResource(R.string.fm_new_folder), color = MaterialTheme.colorScheme.onBackground, fontSize = 12.sp) + } + } + IconButton(onClick = { showSearch = !showSearch; if (!showSearch) searchQuery = "" }, modifier = Modifier.focusGlide(CircleShape)) { + Icon(Icons.Filled.Search, stringResource(R.string.fm_search), tint = MaterialTheme.colorScheme.onSurfaceVariant) + } + Box { + IconButton(onClick = { showSortMenu = true }, modifier = Modifier.focusGlide(CircleShape)) { + Icon(Icons.Filled.Sort, stringResource(R.string.fm_sort), tint = MaterialTheme.colorScheme.onSurfaceVariant) + } + DropdownMenu(expanded = showSortMenu, onDismissRequest = { showSortMenu = false }) { + listOf("name" to stringResource(R.string.fm_sort_name), "date" to stringResource(R.string.fm_sort_date), "size" to stringResource(R.string.fm_prop_size)) + .forEach { (key, label) -> + DropdownMenuItem( + text = { + Text(if (sortBy == key) "$label ${if (sortDesc) "↓" else "↑"}" else label) + }, + onClick = { + if (sortBy == key) sortDesc = !sortDesc else { sortBy = key; sortDesc = false } + browsePrefs.edit().putString("fmSortBy", sortBy) + .putBoolean("fmSortDesc", sortDesc).apply() + showSortMenu = false + loadDirectory(currentDir, resetScroll = false) + }, + modifier = Modifier.focusGlide(), + ) + } + HorizontalDivider(color = MaterialTheme.colorScheme.outline) + DropdownMenuItem( + text = { Text(if (gridView) stringResource(R.string.fm_list_view) else stringResource(R.string.fm_grid_view)) }, + onClick = { + gridView = !gridView + browsePrefs.edit().putBoolean("fmGridView", gridView).apply() + showSortMenu = false + }, + modifier = Modifier.focusGlide(), + ) + DropdownMenuItem( + text = { Text(if (compactRows) stringResource(R.string.fm_rows_comfortable) else stringResource(R.string.fm_rows_compact)) }, + onClick = { + compactRows = !compactRows + browsePrefs.edit().putBoolean("fmCompactRows", compactRows).apply() + showSortMenu = false + }, + modifier = Modifier.focusGlide(), + ) + DropdownMenuItem( + text = { Text(if (showHidden) stringResource(R.string.fm_hide_hidden) else stringResource(R.string.fm_show_hidden)) }, + onClick = { + showHidden = !showHidden + browsePrefs.edit().putBoolean("fmShowHidden", showHidden).apply() + showSortMenu = false + loadDirectory(currentDir, resetScroll = false) + }, + modifier = Modifier.focusGlide(), + ) + } + } + } + + IconButton(onClick = { showFavorites = !showFavorites }, modifier = Modifier.focusGlide(CircleShape)) { + if (showFavorites) { + Icon(Icons.Filled.Star, stringResource(R.string.fm_hide_favorites), tint = MaterialTheme.colorScheme.primary) + } else { + Icon(Icons.Filled.StarBorder, stringResource(R.string.fm_show_favorites), tint = MaterialTheme.colorScheme.onSurfaceVariant) + } } } if (!pickMode && onExit != null) { diff --git a/app/src/main/java/com/droiddeck/launcher/session/GameEnvironmentStore.kt b/app/src/main/java/com/droiddeck/launcher/session/GameEnvironmentStore.kt index e00b1912fa..d4bdce833e 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/GameEnvironmentStore.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/GameEnvironmentStore.kt @@ -2,6 +2,7 @@ package com.droiddeck.launcher.session import android.content.Context import android.util.AtomicFile +import android.util.Log import com.droiddeck.launcher.core.GameEnvironment import com.droiddeck.launcher.core.TextureFiltering import com.droiddeck.launcher.runtime.LinuxRuntime @@ -9,6 +10,7 @@ import org.json.JSONObject import java.io.File object GameEnvironmentStore { + private const val TAG = "GameEnvironmentStore" private const val SETTINGS = "game-environment.json" private const val GUEST_FILE = "root/.config/droiddeck/game-environment.json" const val DXVK_CONFIG = "dxvkConfig" @@ -19,7 +21,16 @@ object GameEnvironmentStore { fun read(context: Context): GameEnvironment.Config { val file = AtomicFile(File(context.filesDir, SETTINGS)) val bytes = try { file.readFully() } catch (_: java.io.FileNotFoundException) { return GameEnvironment.Config() } - return decode(JSONObject(bytes.toString(Charsets.UTF_8))) + return try { + decode(JSONObject(bytes.toString(Charsets.UTF_8))) + } catch (error: Exception) { + if (error !is org.json.JSONException && error !is IllegalArgumentException) throw error + val aside = File(context.filesDir, "$SETTINGS.unreadable") + Log.w(TAG, "game environment settings are unreadable, set aside as ${aside.name}", error) + aside.delete() + file.baseFile.renameTo(aside) + GameEnvironment.Config() + } } fun decode(json: JSONObject): GameEnvironment.Config { diff --git a/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt b/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt index f05e2fbca7..a56bdb9b70 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt @@ -203,18 +203,6 @@ object SessionPrefs { prefs(context).edit().putBoolean("androidTextFieldKeyboard", on).apply() } - fun gameStoresEnabled(context: Context): Boolean = prefs(context).getBoolean("gameStoresEnabled", true) - - fun setGameStoresEnabled(context: Context, on: Boolean) { - prefs(context).edit().putBoolean("gameStoresEnabled", on).apply() - } - - fun soundtracksEnabled(context: Context): Boolean = prefs(context).getBoolean("soundtracksEnabled", true) - - fun setSoundtracksEnabled(context: Context, on: Boolean) { - prefs(context).edit().putBoolean("soundtracksEnabled", on).apply() - } - fun soundtracksIngame(context: Context): Boolean = prefs(context).getBoolean("soundtracksIngame", false) fun setSoundtracksIngame(context: Context, on: Boolean) { @@ -273,14 +261,8 @@ object SessionPrefs { prefs(context).edit().putBoolean("railLabels", show).apply() } - fun agentTab(context: Context): Boolean = prefs(context).getBoolean("agentTab", false) - - fun setAgentTab(context: Context, show: Boolean) { - prefs(context).edit().putBoolean("agentTab", show).apply() - } - fun developerTools(context: Context): Boolean = - prefs(context).getBoolean("developerTools", agentTab(context) || com.droiddeck.launcher.agent.AgentAccess.commandsEnabled(context)) + prefs(context).getBoolean("developerTools", com.droiddeck.launcher.agent.AgentAccess.commandsEnabled(context)) fun setDeveloperTools(context: Context, on: Boolean) { prefs(context).edit().putBoolean("developerTools", on).apply() @@ -324,8 +306,29 @@ object SessionPrefs { prefs(context).edit().putStringSet("libraryFavorites", keys.toSet()).apply() } + fun storesTabOrderCustomized(context: Context): Boolean = + prefs(context).getBoolean("storesTabOrderCustomized", false) + + fun setStoresTabOrderCustomized(context: Context, customized: Boolean) { + prefs(context).edit().putBoolean("storesTabOrderCustomized", customized).apply() + } + fun storesTabOrder(context: Context): List = idList(prefs(context).getString("storesTabOrder", null)) + private val LEGACY_STORES_TAB_ORDER = listOf("gog", "epic", "amazon", "xbox", "itch", "gamejolt", "battlenet", "ubisoft", "ea", "rockstar") + + /** + * Forgets an order the user never arranged, so the Stores tabs and Library pills follow whatever the default is now. + * Earlier versions saved the default of their day, which is why a saved order alone does not mean the user chose it. + */ + fun settleStoresTabOrder(context: Context, defaults: List) { + if (storesTabOrderCustomized(context)) return + val saved = storesTabOrder(context) + if (saved.isEmpty()) return + if (saved == LEGACY_STORES_TAB_ORDER || saved == defaults) prefs(context).edit().remove("storesTabOrder").apply() + else setStoresTabOrderCustomized(context, true) + } + fun setStoresTabOrder(context: Context, order: List) { prefs(context).edit().putString("storesTabOrder", order.joinToString(",")).apply() } @@ -342,13 +345,35 @@ object SessionPrefs { prefs(context).edit().putString("navTabOrder", order.joinToString(",")).apply() } - fun navTabShelved(context: Context): Set = idList(prefs(context).getString("navTabShelved", "soundtracks,agent,storage,sync")).toSet() + fun navTabShelved(context: Context): Set? = prefs(context).getString("navTabShelved", null)?.let { idList(it).toSet() } fun setNavTabShelved(context: Context, keys: Set) { prefs(context).edit().putString("navTabShelved", keys.joinToString(",")).apply() } - fun navTabHidden(context: Context): Set = idList(prefs(context).getString("navTabHidden", null)).toSet() + fun navTabHidden(context: Context): Set? = prefs(context).getString("navTabHidden", null)?.let { idList(it).toSet() } + + fun navTabLayoutVersion(context: Context): Int = prefs(context).getInt("navTabLayout", 0) + + class LegacyTabSwitches(val touched: Boolean, val stores: Boolean, val soundtracks: Boolean, val agent: Boolean) + + fun legacyTabSwitches(context: Context): LegacyTabSwitches { + val p = prefs(context) + val keys = listOf("navTabOrder", "navTabShelved", "navTabHidden", "gameStoresEnabled", "soundtracksEnabled", "agentTab") + return LegacyTabSwitches( + touched = keys.any { p.contains(it) }, + stores = p.getBoolean("gameStoresEnabled", true), + soundtracks = p.getBoolean("soundtracksEnabled", true), + agent = p.getBoolean("agentTab", false) && p.getBoolean("developerTools", true), + ) + } + + fun finishTabSwitchMigration(context: Context, version: Int) { + val p = prefs(context) + val e = p.edit() + if (!p.contains("developerTools") && p.getBoolean("agentTab", false)) e.putBoolean("developerTools", true) + e.remove("gameStoresEnabled").remove("soundtracksEnabled").remove("agentTab").putInt("navTabLayout", version).apply() + } fun setNavTabHidden(context: Context, keys: Set) { prefs(context).edit().putString("navTabHidden", keys.joinToString(",")).apply() @@ -1526,7 +1551,7 @@ object SessionPrefs { } val upscalerChoices = listOf( - 0 to "Linear", 2 to "Nearest", 4 to "AMD FSR 1", 3 to "Snapdragon GSR", + 2 to "Nearest", 0 to "Linear", 4 to "AMD FSR 1", 3 to "Snapdragon GSR", 8 to "Snapdragon GSR (quality)", 7 to "NVIDIA NIS", 6 to "Sharpen only", ) @@ -1541,12 +1566,12 @@ object SessionPrefs { fun canonicalUpscaler(mode: Int): Int = when (mode) { 1 -> 0 5 -> 4 - else -> mode.takeIf { m -> upscalerChoices.any { it.first == m } } ?: 0 + else -> mode.takeIf { m -> upscalerChoices.any { it.first == m } } ?: 2 } fun upscalerHasSharpness(mode: Int): Boolean = canonicalUpscaler(mode) in 3..8 - fun upscaler(context: Context): Int = canonicalUpscaler(prefs(context).getInt("upscaler", 0)) + fun upscaler(context: Context): Int = canonicalUpscaler(prefs(context).getInt("upscaler", 2)) fun setUpscaler(context: Context, mode: Int) { prefs(context).edit().putInt("upscaler", canonicalUpscaler(mode)).apply() diff --git a/app/src/main/java/com/droiddeck/launcher/session/SettingsReset.kt b/app/src/main/java/com/droiddeck/launcher/session/SettingsReset.kt index 0cd971422a..0a08067990 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/SettingsReset.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/SettingsReset.kt @@ -14,11 +14,11 @@ object SettingsReset { internal val SESSION_KEYS = setOf( "orientation", "launcherFullscreen", "animations", "lowStorageWarning", "theme", "runSteamAtStartup", "startupSession", "addedGamesArt", "dualScreenMode", "dualScreenSessionMode", "dualScreenLauncher", "dualScreenSessionControls", "androidTextFieldKeyboard", - "gameStoresEnabled", "soundtracksEnabled", "soundtracksIngame", "gameStoresSpeedTier", "gameStoresParallel", "storesOpenTab", "storesShowMature", + "soundtracksIngame", "gameStoresSpeedTier", "gameStoresParallel", "storesOpenTab", "storesShowMature", "storesInstallLanguage", "hud", "hudDeck", "hudFps", "hudBattery", "hudGraph", "hudColor", "hudOpacity", "__KEEP_droidDeckHud__", "__KEEP_droidDeckHudPos__", "backHold", "backActionsInverted", "backDoubleTapMs", "touch", "pen", "penButton", "osc", "shape", "steamController", "gamepadLeft", "gamepadRight", "pipAutoEnter", "unfoldedControls", "unfoldedControlsWithController", - "stretch16x9", "picturePosition", "integerScaling", "railLabels", "agentTab", "navTabOrder", "navTabShelved", "navTabHidden", "pcKeyboardSize", "pcKeyboardOpacity", "pcKeyboardHiddenKeys", + "stretch16x9", "picturePosition", "integerScaling", "railLabels", "developerTools", "navTabOrder", "navTabShelved", "navTabHidden", "pcKeyboardSize", "pcKeyboardOpacity", "pcKeyboardHiddenKeys", "gpuDriverMode", "androidDriver", "linuxDriver", "linuxDriver.steam", "linuxDriver.desktop", "tuSysmem", "glThread", "noGlError", "zinkLazy", "mangoapp", "gpuClockPin", "gamescopeRealtime", "paceCores", "ramCapMb", "vramCapMb", "zramClient", "zramIdle", "directAudio", "mic", "wifiDiscovery", "clientCpusOverride", "clientCpus", "gameCpus", diff --git a/app/src/main/java/com/droiddeck/launcher/stores/Store.kt b/app/src/main/java/com/droiddeck/launcher/stores/Store.kt index b48530fbea..67b439943d 100644 --- a/app/src/main/java/com/droiddeck/launcher/stores/Store.kt +++ b/app/src/main/java/com/droiddeck/launcher/stores/Store.kt @@ -1,16 +1,16 @@ package com.droiddeck.launcher.stores enum class Store(val id: String, val label: String, val shortLabel: String) { - GOG("gog", "GOG", "GOG"), EPIC("epic", "Epic Games", "Epic"), - AMAZON("amazon", "Amazon Games", "Amazon"), - XBOX("xbox", "Xbox", "Xbox"), - ITCH("itch", "Itch.io", "Itch.io"), - GAMEJOLT("gamejolt", "Game Jolt", "Game Jolt"), - BATTLENET("battlenet", "Battle.net", "Battle.net"), - UBISOFT("ubisoft", "Ubisoft Connect", "Ubisoft"), EA("ea", "EA", "EA"), - ROCKSTAR("rockstar", "Rockstar Games", "Rockstar"); + XBOX("xbox", "Xbox", "Xbox"), + GOG("gog", "GOG", "GOG"), + ROCKSTAR("rockstar", "Rockstar Games", "Rockstar"), + ITCH("itch", "Itch.io", "Itch.io"), + UBISOFT("ubisoft", "Ubisoft Connect", "Ubisoft"), + AMAZON("amazon", "Amazon Games", "Amazon"), + BATTLENET("battlenet", "Battle.net", "Battle.net"), + GAMEJOLT("gamejolt", "Game Jolt", "Game Jolt"); val folder: String get() = if (this == ITCH) "itch" else shortLabel diff --git a/app/src/main/java/com/droiddeck/launcher/stores/StoreLaunchRequests.kt b/app/src/main/java/com/droiddeck/launcher/stores/StoreLaunchRequests.kt index c4af9891d0..af4ea74964 100644 --- a/app/src/main/java/com/droiddeck/launcher/stores/StoreLaunchRequests.kt +++ b/app/src/main/java/com/droiddeck/launcher/stores/StoreLaunchRequests.kt @@ -58,7 +58,11 @@ object StoreLaunchRequests { } "xbox-renew" -> JSONObject().put("ok", com.droiddeck.launcher.stores.xbox.XboxRuntime.renew(app, request.optString("id"), request.optString("lease"))) "xbox-prepare" -> runCatching { com.droiddeck.launcher.stores.xbox.XboxRuntime.prepare(app, request.getString("id")) } - .getOrElse { JSONObject().put("ok", false).put("reason", "Xbox account service is unavailable. Sign in again and retry.") } + .getOrElse { + StoresState.logLine("Xbox: launch prepare failed (${it.javaClass.simpleName}: ${it.message})") + val reason = (it as? IllegalStateException)?.message ?: "Xbox account service is unavailable. Sign in again and retry." + JSONObject().put("ok", false).put("reason", reason) + } "ea-prepare" -> runCatching { lastLaunched = Store.EA to request.optString("id"); com.droiddeck.launcher.stores.ea.EaLaunch.prepare(app, request) } .getOrElse { JSONObject().put("ok", false).put("reason", "error-" + it.javaClass.simpleName) } "ea-exited" -> { diff --git a/app/src/main/java/com/droiddeck/launcher/stores/StoreSizes.kt b/app/src/main/java/com/droiddeck/launcher/stores/StoreSizes.kt index 21969dfbe7..8a47c06806 100644 --- a/app/src/main/java/com/droiddeck/launcher/stores/StoreSizes.kt +++ b/app/src/main/java/com/droiddeck/launcher/stores/StoreSizes.kt @@ -27,13 +27,20 @@ object StoreSizes { fun size(item: CatalogItem): Long = known[item.key] ?: item.sizeBytes + private val NO_REMOTE_SIZE = setOf(Store.GOG, Store.XBOX, Store.BATTLENET, Store.UBISOFT, Store.ROCKSTAR) + private val settled = mutableStateMapOf() + + // A size that can still arrive this session: not known yet, the store can report one, and no lookup came back empty. + fun coming(item: CatalogItem): Boolean = + item.accessible && item.sizeBytes <= 0 && item.store !in NO_REMOTE_SIZE && !known.containsKey(item.key) && settled[item.key] != true + private val caches = ConcurrentHashMap() private fun cache(context: Context, store: Store) = caches.getOrPut(store) { SizeCache.forStore(context.applicationContext.filesDir, store) } fun request(context: Context, item: CatalogItem) { if (!item.accessible || item.sizeBytes > 0 || item.store == Store.GOG || known.containsKey(item.key)) return - resolve(context, item).thenAccept { bytes -> - if (bytes != null) StoresState.post { known[item.key] = bytes } + resolve(context, item).whenComplete { bytes, _ -> + StoresState.post { if (bytes != null && bytes > 0) known[item.key] = bytes else settled[item.key] = true } } } diff --git a/app/src/main/java/com/droiddeck/launcher/stores/xbox/XboxLaunchViews.kt b/app/src/main/java/com/droiddeck/launcher/stores/xbox/XboxLaunchViews.kt index 9316ab27ef..c18bb9bb2e 100644 --- a/app/src/main/java/com/droiddeck/launcher/stores/xbox/XboxLaunchViews.kt +++ b/app/src/main/java/com/droiddeck/launcher/stores/xbox/XboxLaunchViews.kt @@ -18,7 +18,8 @@ internal class XboxLaunchViews { parent.listFiles()?.filter { it.name.startsWith("launch-") }?.forEach(::remove) recovered.add(parent.path) } - return Files.createTempDirectory(parent.toPath(), "launch-").toFile() + // The guest binds the files directory by the path Android reports, not its canonical one. + return File(files, "xbox-runtime/views/" + Files.createTempDirectory(parent.toPath(), "launch-").fileName) } companion object { diff --git a/app/src/main/java/com/droiddeck/launcher/ui/AgentPage.kt b/app/src/main/java/com/droiddeck/launcher/ui/AgentPage.kt index 0a02ebf9ba..32c48765bc 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/AgentPage.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/AgentPage.kt @@ -19,9 +19,11 @@ import androidx.compose.foundation.border import androidx.compose.foundation.clickable import androidx.compose.foundation.gestures.awaitEachGesture import androidx.compose.foundation.gestures.awaitFirstDown +import androidx.compose.foundation.gestures.waitForUpOrCancellation import androidx.compose.foundation.horizontalScroll import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.BoxWithConstraints import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.WindowInsets @@ -55,6 +57,7 @@ import androidx.compose.material.icons.outlined.Build import androidx.compose.material.icons.outlined.Close import androidx.compose.material.icons.outlined.ExpandMore import androidx.compose.material.icons.outlined.History +import androidx.compose.material.icons.outlined.Lock import androidx.compose.material.icons.outlined.Memory import androidx.compose.material.icons.outlined.MoreHoriz import androidx.compose.material.icons.outlined.Pets @@ -95,6 +98,7 @@ import androidx.compose.ui.input.key.onPreviewKeyEvent import androidx.compose.ui.input.nestedscroll.NestedScrollConnection import androidx.compose.ui.input.nestedscroll.NestedScrollSource import androidx.compose.ui.input.nestedscroll.nestedScroll +import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.input.pointer.PointerEventPass import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.layout.onGloballyPositioned @@ -292,7 +296,8 @@ private fun AgentPageContent( awaitEachGesture { awaitFirstDown(requireUnconsumed = false, pass = PointerEventPass.Initial) if (panel == AgentPanel.MODEL || panel == AgentPanel.USAGE) panel = AgentPanel.NONE - if (composer.focused) focusManager.clearFocus() + // Forced: the unforced path walks the focus chain and throws ("ActiveParent with no focused child") when a tap lands while focus is moving. + if (composer.focused) focusManager.clearFocus(force = true) } }, list, following = !readingBack, onRevise = { composer.open() }, onSent = toLatest, @@ -304,7 +309,7 @@ private fun AgentPageContent( } } androidx.compose.animation.AnimatedVisibility(!hidden, enter = expandVertically() + fadeIn(), exit = shrinkVertically() + fadeOut()) { - AgentComposer(composer, draft, visible, inlineControls, onPanel = { panel = it }, onSent = toLatest) + AgentComposer(composer, draft, visible && started, inlineControls, onPanel = { panel = it }, onSent = toLatest) } } } @@ -703,9 +708,23 @@ private fun AgentEditor(composer: ComposerState, draftState: MutableState voice.finish(send) + voice.finishing -> Unit + else -> send() + } + } val working = AgentHost.state == AgentHost.State.WORKING if (draft.startsWith("/") && !draft.contains(' ')) { val matches = (LOCAL_COMMANDS + CLI_COMMANDS).filter { it.startsWith(draft) && it != draft } @@ -725,23 +744,35 @@ private fun AgentEditor(composer: ComposerState, draftState: MutableState Unit = { modifier -> Box(modifier.padding(start = 8.dp, top = 10.dp, bottom = 10.dp)) { if (draft.isEmpty()) Text( - stringResource(if (working) R.string.agent_hint_working else R.string.agent_hint), fontSize = 16.sp, + stringResource( + when { + voice.listening && !voice.locked -> R.string.agent_voice_hold + voice.listening -> R.string.agent_voice_listening + working -> R.string.agent_hint_working + else -> R.string.agent_hint + }, + ), + fontSize = 16.sp, color = pal.onSurfaceVariant, maxLines = 1, overflow = TextOverflow.Ellipsis, ) BasicTextField( - draft, { draft = it }, + draft, { + draft = it + if (voice.listening) voice.stop() + }, Modifier.fillMaxWidth().focusRequester(field).onFocusChanged { focused = it.isFocused composer.focused = it.isFocused @@ -750,50 +781,132 @@ private fun AgentEditor(composer: ComposerState, draftState: MutableState Unit = { if (working) RoundButton(Icons.Outlined.Stop, stringResource(R.string.agent_stop), pal.error.copy(alpha = 0.22f), colors.error, "agent-stop") { AgentHost.stop(context) } val canSend = draft.isNotBlank() || AgentAttachments.pending.isNotEmpty() // An empty message has nothing to send, so the button there dictates one instead. - if ((!canSend || voice.listening) && voiceAvailable) VoiceButton(voice) { voice.start(draft) } - else RoundButton( + if ((!canSend || voice.listening) && !voice.finishing) VoiceButton(voice, onStart = { voice.start(draft) }, onSend = send, onSetup = { voiceSetup = true }) + if (voice.finishing || (voice.listening && voice.locked) || (canSend && !voice.listening)) RoundButton( Icons.AutoMirrored.Outlined.Send, stringResource(if (working) R.string.agent_queue else R.string.agent_send), - if (canSend) pal.primary else pal.surfaceVariant, if (canSend) pal.onPrimary else pal.onSurfaceVariant, "agent-send", enabled = canSend, - ) { - voice.stop() - send() + pal.primary, pal.onPrimary, "agent-send", enabled = !voice.finishing, + ) { sendNow() } + } + if (stacked) Column { + text(Modifier.fillMaxWidth()) + Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth()) { + if (attach) AttachButton() + if (AgentAttachments.gameFrame != null) GameFrameButton() + Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.weight(1f).height(42.dp)) { if (controls != null && !focused) controls() } + actions() } + } else Row(verticalAlignment = Alignment.Bottom) { + if (attach) AttachButton() + if (AgentAttachments.gameFrame != null) GameFrameButton() + text(Modifier.weight(1f)) + if (controls != null && !focused) Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.height(42.dp)) { controls() } + actions() } } } +/** + * Held, it listens until let go and then sends; slid up, it keeps listening hands-free; slid left, it puts the text back. + * A tap or a controller press also listens hands-free. + */ @Composable -private fun VoiceButton(voice: AgentVoice, onStart: () -> Unit) { +private fun VoiceButton(voice: AgentVoice, onStart: () -> Unit, onSend: () -> Unit, onSetup: () -> Unit) { val context = LocalContext.current val pal = LocalPalette.current - val ask = if (LocalActivityResultRegistryOwner.current != null) rememberLauncherForActivityResult(ActivityResultContracts.RequestPermission()) { granted -> - if (granted) onStart() else android.widget.Toast.makeText(context, R.string.agent_voice_denied, android.widget.Toast.LENGTH_SHORT).show() - } else null - RoundButton( - if (voice.listening) Icons.Outlined.MicOff else Icons.Outlined.Mic, stringResource(if (voice.listening) R.string.agent_voice_stop else R.string.agent_voice), - if (voice.listening) pal.primary else pal.surfaceVariant, if (voice.listening) pal.onPrimary else pal.onBackground, "agent-voice", - ) { + val start by rememberUpdatedState(onStart) + val send by rememberUpdatedState(onSend) + val setup by rememberUpdatedState(onSetup) + val handsFree = { + start() + if (voice.listening) voice.locked = true + } + val toggle = { when { voice.listening -> voice.finish() - context.checkSelfPermission(android.Manifest.permission.RECORD_AUDIO) == android.content.pm.PackageManager.PERMISSION_GRANTED -> onStart() - ask != null -> ask.launch(android.Manifest.permission.RECORD_AUDIO) - else -> android.widget.Toast.makeText(context, R.string.agent_voice_denied, android.widget.Toast.LENGTH_SHORT).show() + !voiceReady(context) -> setup() + else -> handsFree() } } + val density = LocalDensity.current + val lockPx = with(density) { 56.dp.toPx() } + val cancelPx = with(density) { 72.dp.toPx() } + var drag by remember { mutableStateOf(Offset.Zero) } + val holding = voice.listening && !voice.locked + val icon = when { + voice.locked -> Icons.Outlined.MicOff + holding && -drag.x > cancelPx / 2 && -drag.x > -drag.y -> Icons.Outlined.Close + holding && -drag.y > lockPx / 2 -> Icons.Outlined.Lock + else -> Icons.Outlined.Mic + } + val scale = if (holding) 1.12f + 0.12f * voice.level else 1f + Box( + contentAlignment = Alignment.Center, + modifier = Modifier.padding(start = 6.dp).size(42.dp).graphicsLayer { + scaleX = scale + scaleY = scale + }.clip(CircleShape).background(if (voice.listening) pal.primary else pal.surfaceVariant) + .pointerInput(voice) { + awaitEachGesture { + val down = awaitFirstDown(pass = PointerEventPass.Initial) + down.consume() + if (voice.listening || !voiceReady(context)) { + waitForUpOrCancellation(PointerEventPass.Initial)?.let { + it.consume() + toggle() + } + return@awaitEachGesture + } + start() + var resolved = !voice.listening + try { + while (!resolved) { + val change = awaitPointerEvent(PointerEventPass.Initial).changes.firstOrNull { it.id == down.id } ?: break + // Compose ends a cancelled touch stream with a lift that arrives already consumed; that is not a release. + if (!change.pressed && change.isConsumed) break + change.consume() + drag = change.position - down.position + when { + !voice.listening -> resolved = true + drag.y < -lockPx -> { + voice.locked = true + resolved = true + } + drag.x < -cancelPx -> { + voice.cancel() + resolved = true + } + !change.pressed -> { + val tap = change.uptimeMillis - down.uptimeMillis < viewConfiguration.longPressTimeoutMillis / 2 && + drag.getDistance() < viewConfiguration.touchSlop + if (tap) voice.locked = true else voice.finish(send) + resolved = true + } + } + } + } finally { + drag = Offset.Zero + if (!resolved && voice.listening && !voice.locked) voice.finish() + } + } + } + .clickable(onClick = toggle).testTag("agent-voice"), + ) { + Icon( + icon, stringResource(if (voice.listening) R.string.agent_voice_stop else R.string.agent_voice), + tint = if (voice.listening) pal.onPrimary else pal.onBackground, modifier = Modifier.size(21.dp), + ) + } } /** Attaches what the running game shows, taken from its own surface so nothing drawn over it is in the picture. */ diff --git a/app/src/main/java/com/droiddeck/launcher/ui/AgentPanels.kt b/app/src/main/java/com/droiddeck/launcher/ui/AgentPanels.kt index 3fc46e09b1..1029db97ea 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/AgentPanels.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/AgentPanels.kt @@ -50,6 +50,11 @@ import androidx.compose.material3.Icon import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.ui.graphics.SolidColor import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.input.ImeAction +import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.ime +import androidx.compose.foundation.relocation.bringIntoViewRequester +import androidx.compose.ui.text.input.KeyboardType import androidx.compose.runtime.rememberCoroutineScope import kotlinx.coroutines.launch import com.droiddeck.launcher.agent.AgentTools @@ -416,14 +421,23 @@ private fun ToolsRow(title: String, detail: String, action: @Composable () -> Un } @Composable +@OptIn(androidx.compose.foundation.ExperimentalFoundationApi::class) internal fun ToolsField(value: String, onValue: (String) -> Unit, hint: String, tag: String) { - val colors = MaterialTheme.colorScheme - val pal = LocalPalette.current - Box(Modifier.fillMaxWidth().clip(Shape12).background(pal.surfaceVariant).padding(horizontal = 12.dp, vertical = 10.dp)) { - if (value.isEmpty()) Text(hint, fontSize = 14.sp, color = pal.onSurfaceVariant, maxLines = 1) - BasicTextField( - value, onValue, singleLine = true, textStyle = TextStyle(fontSize = 14.sp, fontFamily = FontFamily.Monospace, color = colors.onSurface), - cursorBrush = SolidColor(pal.primary), modifier = Modifier.fillMaxWidth().testTag(tag), - ) - } + // The launcher's pane focus group sends a Compose text field's focus back to the last tile it remembers, + // so these fields use the EditText the rest of the launcher types into. + val view = remember { androidx.compose.foundation.relocation.BringIntoViewRequester() } + var focused by remember { mutableStateOf(false) } + val window = androidx.compose.ui.platform.LocalView.current + // An EditText's focus does not scroll its Compose parent, so the field follows the keyboard as it opens. + val keyboard = WindowInsets.ime.getBottom(androidx.compose.ui.platform.LocalDensity.current) + LaunchedEffect(focused, keyboard) { if (focused) view.bringIntoView() } + AdbTextField( + value = value, onValueChange = onValue, label = hint, keyboardType = KeyboardType.Text, imeAction = ImeAction.Done, + modifier = Modifier.bringIntoViewRequester(view).testTag(tag), placeholder = hint, compact = true, showLabel = false, + onFocusChange = { focused = it }, + onDone = { + (window.context.getSystemService(android.content.Context.INPUT_METHOD_SERVICE) as? android.view.inputmethod.InputMethodManager) + ?.hideSoftInputFromWindow(window.windowToken, 0) + }, + ) } diff --git a/app/src/main/java/com/droiddeck/launcher/ui/AgentSetupView.kt b/app/src/main/java/com/droiddeck/launcher/ui/AgentSetupView.kt index 653e8eedb6..00d7880937 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/AgentSetupView.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/AgentSetupView.kt @@ -4,6 +4,8 @@ import androidx.compose.foundation.background import androidx.compose.foundation.border import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.ExperimentalLayoutApi +import androidx.compose.foundation.layout.FlowRow import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding @@ -97,21 +99,21 @@ internal fun AgentSetupView(modifier: Modifier, onDone: () -> Unit = {}) { steps.forEachIndexed { index, step -> val status = AgentSetup.status[step] ?: Status.UNKNOWN val harness = AgentHost.harness - // A harness that signs in with a pasted key: the sign-in opens its key page and this field takes the key. - val keyed = step == Step.SIGN_IN && harness.keyPage != null + // A harness that signs in with pasted keys: this row picks the provider and takes its key. + val keyed = step == Step.SIGN_IN && harness.providers.isNotEmpty() var keyOpen by rememberSaveable(harness.id) { mutableStateOf(false) } val (title, hint) = labels(step, harness.name, keyed) val lab = AgentHost.lab?.takeIf { it.prepare && it.running } val detail = when { step == Step.PREPARE && lab != null -> stringResource(R.string.agent_prepare_progress, lab.permille / 10, clock(lab.etaSeconds.toLong().coerceAtLeast(0))) - keyed && status == Status.DONE && !AgentSetup.keySaved -> stringResource(R.string.agent_step_free_models) + keyed && status == Status.DONE && AgentSetup.detail[step] == null -> + harness.providers.filter { it.id in AgentSetup.keys }.joinToString(" · ") { it.name }.ifEmpty { stringResource(R.string.agent_step_free_models) } else -> AgentSetup.detail[step] ?: hint } // Shown while the sign-in is pending, so it is still there after a trip to the browser for the key. val pending = (status == Status.TODO || status == Status.FAILED) && AgentSetup.status[Step.INSTALL] == Status.DONE val showKey = keyed && (keyOpen || pending) && status != Status.WORKING - var key by remember(harness.id) { mutableStateOf("") } CheckRow( when (status) { Status.DONE -> CheckState.OK @@ -122,33 +124,17 @@ internal fun AgentSetupView(modifier: Modifier, onDone: () -> Unit = {}) { ) { val blocked = (step in setOf(Step.SIGN_IN, Step.GITHUB, Step.BUILD_TOOLS) && AgentSetup.status[Step.INSTALL] != Status.DONE) || (step == Step.PREPARE && AgentSetup.status[Step.BUILD_TOOLS] != Status.DONE) - val openKey = { - keyOpen = true - AgentSetup.run(context, step) - } - if ((status == Status.TODO || status == Status.FAILED) && !blocked) { + if (keyed) { + if (pending && harness.free) SecondaryButton(stringResource(R.string.agent_action_free), compact = true) { AgentSetup.useFree(context) } + else if (status == Status.DONE) SecondaryButton(stringResource(if (keyOpen) R.string.common_hide else R.string.agent_action_add_key), compact = true) { keyOpen = !keyOpen } + } else if ((status == Status.TODO || status == Status.FAILED) && !blocked) { val label = stringResource(if (status == Status.FAILED) R.string.agent_setup_retry else action(step)) - val run = { if (step == Step.CONNECTION) pair(context) else if (keyed) openKey() else AgentSetup.run(context, step) } - Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) { - if (keyed && harness.free) SecondaryButton(stringResource(R.string.agent_action_free), compact = true) { AgentSetup.useFree(context) } - if (step.required) PrimaryButton(label, compact = true, onClick = run) else SecondaryButton(label, compact = true, onClick = run) - } - } else if (keyed && status == Status.DONE && !AgentSetup.keySaved && !keyOpen) { - SecondaryButton(stringResource(R.string.agent_action_add_key), compact = true, onClick = openKey) + val run = { if (step == Step.CONNECTION) pair(context) else AgentSetup.run(context, step) } + if (step.required) PrimaryButton(label, compact = true, onClick = run) else SecondaryButton(label, compact = true, onClick = run) } } if (showKey) { - Row( - verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp), - modifier = Modifier.fillMaxWidth().padding(start = 56.dp, end = 14.dp, bottom = 10.dp), - ) { - Box(Modifier.weight(1f)) { ToolsField(key, { key = it.trim() }, stringResource(R.string.agent_key_hint), "agent-key") } - PrimaryButton(stringResource(R.string.agent_key_save), enabled = key.isNotBlank(), compact = true) { - keyOpen = false - AgentSetup.saveKey(context, key) - key = "" - } - } + KeyPanel(harness) { keyOpen = false } if (index < steps.lastIndex) Box(Modifier.fillMaxWidth().height(1.dp).background(pal.line)) } } @@ -167,6 +153,47 @@ internal fun AgentSetupView(modifier: Modifier, onDone: () -> Unit = {}) { } } +/** Picks one of [harness]'s providers and saves its key, or a custom server's address. */ +@OptIn(ExperimentalLayoutApi::class) +@Composable +private fun KeyPanel(harness: AgentHarness, onSaved: () -> Unit) { + val context = LocalContext.current + val provider = harness.providers.firstOrNull { it.id == AgentSetup.provider } ?: harness.providers.first() + var key by remember(harness.id, provider.id) { mutableStateOf("") } + val saved = provider.id in AgentSetup.keys + Column( + verticalArrangement = Arrangement.spacedBy(10.dp), + modifier = Modifier.fillMaxWidth().padding(start = 56.dp, end = 14.dp, bottom = 12.dp), + ) { + FlowRow(horizontalArrangement = Arrangement.spacedBy(8.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) { + for (option in harness.providers) { + val name = if (option.id in AgentSetup.keys) "${option.name} ✓" else option.name + if (option == provider) PrimaryButton(name, compact = true) {} else SecondaryButton(name, compact = true) { AgentSetup.provider = option.id } + } + } + if (provider.custom) ToolsField(AgentSetup.server, { AgentSetup.server = it.trim() }, stringResource(R.string.agent_key_server_hint), "agent-key-server") + Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp)) { + Box(Modifier.weight(1f)) { + ToolsField( + key, { key = it.trim() }, + if (provider.custom) stringResource(R.string.agent_key_optional_hint) else stringResource(R.string.agent_key_hint, provider.name), + "agent-key", + ) + } + provider.keyPage?.let { page -> SecondaryButton(stringResource(R.string.agent_key_get), compact = true) { AgentSetup.openKeyPage(context, page) } } + if (saved) SecondaryButton(stringResource(R.string.agent_storage_remove), compact = true) { AgentSetup.removeKey(context, provider) } + PrimaryButton( + stringResource(R.string.agent_key_save), compact = true, + enabled = if (provider.custom) AgentSetup.server.isNotBlank() else key.isNotBlank(), + ) { + AgentSetup.saveKey(context, provider, key, AgentSetup.server.takeIf { provider.custom }) + key = "" + onSaved() + } + } + } +} + @Composable private fun StorageCard() { val context = LocalContext.current diff --git a/app/src/main/java/com/droiddeck/launcher/ui/AgentVoice.kt b/app/src/main/java/com/droiddeck/launcher/ui/AgentVoice.kt index a6d78e599e..95ce56e58e 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/AgentVoice.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/AgentVoice.kt @@ -1,44 +1,93 @@ package com.droiddeck.launcher.ui +import android.content.ComponentName import android.content.Context import android.content.Intent +import android.content.ServiceConnection +import android.os.Build +import android.os.IBinder import android.os.Bundle +import android.os.Handler +import android.os.Looper import android.speech.RecognitionListener +import android.speech.RecognitionService import android.speech.RecognizerIntent import android.speech.SpeechRecognizer import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableFloatStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.setValue -/** Dictation into the Agent editor: what is heard so far follows the text already typed, until the user edits the draft. */ +/** + * Dictation into the Agent editor: what is heard so far follows the text already typed, until the user edits the draft. + * Listening carries on across pauses until [finish], which can send once the last words are written. + */ internal class AgentVoice(private val context: Context, private val draft: () -> String, private val onText: (String) -> Unit) { var listening by mutableStateOf(false) private set + /** Whether listening goes on without the button held. */ + var locked by mutableStateOf(false) + /** How loud the speech is, from 0 to 1. */ + var level by mutableFloatStateOf(0f) + private set + /** Set when the speech service could not open the microphone, which a fresh install of Speech Services by Google cannot until allowed. */ + var serviceMicBlocked by mutableStateOf(false) private var recognizer: SpeechRecognizer? = null + private var typed = "" private var base = "" private var written = "" + /** Set between [finish] and the final result, while a send may still be waiting on the last words. */ + var finishing by mutableStateOf(false) + private set + private var then: (() -> Unit)? = null + private val main = Handler(Looper.getMainLooper()) fun start(typed: String) { stop() - val speech = runCatching { SpeechRecognizer.createSpeechRecognizer(context) }.getOrNull() ?: return + val service = component(context) + val speech = runCatching { SpeechRecognizer.createSpeechRecognizer(context, service) }.getOrNull() ?: return recognizer = speech - base = typed.trimEnd().let { if (it.isEmpty()) it else "$it " } + if (service != null && !isDefault(context)) lend(service) + this.typed = typed + base = continued(typed) written = typed + finishing = false + listening = true speech.setRecognitionListener(object : RecognitionListener { - override fun onReadyForSpeech(params: Bundle?) { listening = true } + override fun onReadyForSpeech(params: Bundle?) {} override fun onBeginningOfSpeech() {} - override fun onRmsChanged(rmsdB: Float) {} + override fun onRmsChanged(rmsdB: Float) { if (recognizer === speech) level = ((rmsdB + 2f) / 12f).coerceIn(0f, 1f) } override fun onBufferReceived(buffer: ByteArray?) {} - override fun onEndOfSpeech() {} - override fun onError(error: Int) { if (recognizer === speech) stop() } + override fun onEndOfSpeech() { level = 0f } + override fun onError(error: Int) { + if (recognizer !== speech) return + // The recognizer gives up on a pause; the user is still talking until they let go or stop. + if (!finishing && (error == SpeechRecognizer.ERROR_NO_MATCH || error == SpeechRecognizer.ERROR_SPEECH_TIMEOUT)) { + base = continued(written) + relisten(speech) + } else { + done() + if (error == SpeechRecognizer.ERROR_AUDIO || error == SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS) serviceMicBlocked = true + } + } override fun onResults(results: Bundle?) { if (recognizer !== speech) return heard(results) - stop() + if (recognizer !== speech) return + if (finishing) done() else { + base = continued(written) + relisten(speech) + } } override fun onPartialResults(partialResults: Bundle?) { if (recognizer === speech) heard(partialResults) } override fun onEvent(eventType: Int, params: Bundle?) {} }) + listen(speech) + } + + private fun continued(text: String) = text.trimEnd().let { if (it.isEmpty()) it else "$it " } + + private fun listen(speech: SpeechRecognizer) { val intent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH) .putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM) .putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true) @@ -46,22 +95,71 @@ internal class AgentVoice(private val context: Context, private val draft: () -> runCatching { speech.startListening(intent) }.onFailure { stop() } } + private fun relisten(speech: SpeechRecognizer) { + main.post { if (recognizer === speech && !finishing) listen(speech) } + } + private fun heard(results: Bundle?) { val spoken = results?.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION)?.firstOrNull()?.takeIf { it.isNotBlank() } ?: return - if (draft() != written) return stop() + if (draft() != written) return if (finishing) done() else stop() written = base + spoken onText(written) } - /** Ends listening but keeps the recognizer until its final result arrives. */ - fun finish() { + /** Ends listening but keeps the recognizer until its final result arrives, then runs [then]. */ + fun finish(then: (() -> Unit)? = null) { val speech = recognizer ?: return + finishing = true + this.then = then listening = false - runCatching { speech.stopListening() }.onFailure { stop() } + locked = false + level = 0f + runCatching { speech.stopListening() }.onFailure { done() } + // Some recognizers never answer a stop with nothing heard. + main.postDelayed({ if (recognizer === speech) done() }, FINAL_RESULT_TIMEOUT_MS) + } + + private fun done() { + val next = then + stop() + next?.invoke() + } + + /** Stops listening, but a send already waiting on the last words goes ahead with what was heard. */ + fun settle() { + if (finishing) done() else stop() + } + + /** Stops and puts back the text typed before listening began. */ + fun cancel() { + val restore = draft() == written + stop() + if (restore) onText(typed) + } + + private var lent: ServiceConnection? = null + + // Android passes the microphone only to the default speech service on its own; any other one records silence unless + // the app in front binds it with its own capabilities for as long as it listens. + private fun lend(service: ComponentName) { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) return + val connection = object : ServiceConnection { + override fun onServiceConnected(name: ComponentName?, binder: IBinder?) {} + override fun onServiceDisconnected(name: ComponentName?) {} + } + val intent = Intent(RecognitionService.SERVICE_INTERFACE).setComponent(service) + if (runCatching { context.bindService(intent, connection, Context.BIND_AUTO_CREATE or Context.BIND_INCLUDE_CAPABILITIES) }.getOrDefault(false)) lent = connection + else runCatching { context.unbindService(connection) } } fun stop() { + lent?.let { runCatching { context.unbindService(it) } } + lent = null + then = null + finishing = false listening = false + locked = false + level = 0f val speech = recognizer ?: return recognizer = null runCatching { speech.cancel() } @@ -69,6 +167,38 @@ internal class AgentVoice(private val context: Context, private val draft: () -> } companion object { + private const val FINAL_RESULT_TIMEOUT_MS = 3000L + fun available(context: Context) = SpeechRecognizer.isRecognitionAvailable(context) + + /** The package that turns speech into text, if one is installed. */ + fun service(context: Context): String? = component(context)?.packageName + + const val DEFAULT_SETTING = "voice_recognition_service" + + private fun chosen(context: Context) = android.provider.Settings.Secure.getString(context.contentResolver, DEFAULT_SETTING) + ?.takeIf { it.isNotBlank() }?.let(ComponentName::unflattenFromString) + + private fun installed(context: Context) = context.packageManager.queryIntentServices(Intent(RecognitionService.SERVICE_INTERFACE), 0) + .map { ComponentName(it.serviceInfo.packageName, it.serviceInfo.name) } + + // Installing a speech service does not always make it the system's choice, and without one Android refuses to listen. + fun component(context: Context): ComponentName? { + val chosen = chosen(context) + val installed = installed(context) + return installed.firstOrNull { it == chosen } ?: installed.firstOrNull() + } + + /** + * Whether the installed service is the system's chosen one. Android only passes DroidDeck's right to the microphone on to that one; + * any other service hears silence once DroidDeck is in front. + */ + fun isDefault(context: Context): Boolean { + val chosen = chosen(context) ?: return false + return chosen in installed(context) + } + + fun serviceHears(context: Context, service: String) = + context.packageManager.checkPermission(android.Manifest.permission.RECORD_AUDIO, service) == android.content.pm.PackageManager.PERMISSION_GRANTED } } diff --git a/app/src/main/java/com/droiddeck/launcher/ui/AgentVoiceSetup.kt b/app/src/main/java/com/droiddeck/launcher/ui/AgentVoiceSetup.kt new file mode 100644 index 0000000000..66be2e4ccf --- /dev/null +++ b/app/src/main/java/com/droiddeck/launcher/ui/AgentVoiceSetup.kt @@ -0,0 +1,160 @@ +package com.droiddeck.launcher.ui + +import android.Manifest +import android.app.Activity +import android.content.Context +import android.content.ContextWrapper +import android.content.Intent +import android.content.pm.PackageManager +import android.net.Uri +import android.provider.Settings +import androidx.activity.compose.LocalActivityResultRegistryOwner +import androidx.activity.compose.rememberLauncherForActivityResult +import androidx.activity.result.contract.ActivityResultContracts +import androidx.compose.foundation.background +import androidx.compose.foundation.border +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Box +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.layout.size +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.outlined.Close +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.DisposableEffect +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableIntStateOf +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.platform.LocalLifecycleOwner +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.lifecycle.Lifecycle +import androidx.lifecycle.LifecycleEventObserver +import com.droiddeck.launcher.R +import com.droiddeck.launcher.core.WirelessAdbFix + +private const val SPEECH_SERVICES = "com.google.android.tts" + +/** Whether the mic can turn speech into text: a speech service is installed, and it and DroidDeck may both use the microphone. */ +internal fun voiceReady(context: Context): Boolean { + val service = AgentVoice.service(context) ?: return false + return appHears(context) && AgentVoice.serviceHears(context, service) +} + +/** Runs [command] over the saved Wireless debugging pairing off the main thread, then [done] on it with whether it worked. */ +private fun adb(context: Context, command: String, done: (Boolean) -> Unit) { + val app = context.applicationContext + Thread({ + // The pairing can be with another device, where the grant would land instead of here. + val ok = runCatching { WirelessAdbFix.savedPairingIsLocal(app) }.getOrDefault(false) && runCatching { WirelessAdbFix.shell(app, command) }.isSuccess + android.os.Handler(android.os.Looper.getMainLooper()).post { done(ok) } + }, "agent-voice-setup").start() +} + +private fun appHears(context: Context) = context.checkSelfPermission(Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED + +/** Opens [intent] over DroidDeck when it can, so Back comes straight back to the setup. */ +private fun open(context: Context, intent: Intent): Boolean { + var base = context + while (base !is Activity && base is ContextWrapper) base = base.baseContext + return runCatching { + if (base is Activity) base.startActivity(intent) else context.startActivity(intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)) + }.isSuccess +} + +private fun openAppInfo(context: Context, pkg: String) { + open(context, Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.fromParts("package", pkg, null))) +} + +private fun openStore(context: Context) { + if (!open(context, Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=$SPEECH_SERVICES")))) { + open(context, Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=$SPEECH_SERVICES"))) + } +} + +/** What talking to the agent still needs, each step one button away, checked again whenever DroidDeck comes back. */ +@Composable +internal fun AgentVoiceSetup(onReady: () -> Unit, onClose: () -> Unit) { + val context = LocalContext.current + val colors = MaterialTheme.colorScheme + val pal = LocalPalette.current + var checks by remember { mutableIntStateOf(0) } + val owner = LocalLifecycleOwner.current + DisposableEffect(owner) { + val observer = LifecycleEventObserver { _, event -> if (event == Lifecycle.Event.ON_RESUME) checks++ } + owner.lifecycle.addObserver(observer) + onDispose { owner.lifecycle.removeObserver(observer) } + } + val service = remember(checks) { AgentVoice.service(context) } + val appMic = remember(checks) { appHears(context) } + val serviceMic = remember(checks, service) { service != null && AgentVoice.serviceHears(context, service) } + val paired = remember(checks) { WirelessAdbFix.hasSavedPairing(context) } + var working by remember { mutableStateOf(false) } + val shown = remember { booleanArrayOf(true) } + DisposableEffect(Unit) { onDispose { shown[0] = false } } + // A saved pairing does not mean Wireless debugging is on now, so a refusal falls back to doing it by hand. + val viaAdb: (String, () -> Unit) -> Unit = { command, byHand -> + working = true + adb(context, command) { ok -> + working = false + checks++ + if (!ok && shown[0]) byHand() + } + } + LaunchedEffect(service, appMic, serviceMic) { if (service != null && appMic && serviceMic) onReady() } + val ask = if (LocalActivityResultRegistryOwner.current != null) rememberLauncherForActivityResult(ActivityResultContracts.RequestPermission()) { granted -> + // Android stops asking after the user refuses twice; the switch is then only in App info. + if (granted) checks++ else openAppInfo(context, context.packageName) + } else null + Column( + Modifier.fillMaxWidth().padding(top = 8.dp).clip(Shape14).background(colors.surface).border(1.dp, pal.line, Shape14).testTag("agent-voice-setup"), + ) { + Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(start = 14.dp, end = 6.dp, top = 6.dp)) { + Text( + stringResource(R.string.agent_voice_setup), fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground, + modifier = Modifier.weight(1f), + ) + Box(contentAlignment = Alignment.Center, modifier = Modifier.size(36.dp).clip(CircleShape).clickable(onClick = onClose)) { + Icon(Icons.Outlined.Close, stringResource(R.string.agent_voice_setup_close), tint = pal.onSurfaceVariant, modifier = Modifier.size(18.dp)) + } + } + CheckRow( + if (service != null) CheckState.OK else CheckState.WARN, stringResource(R.string.agent_voice_setup_service), + if (service == null) stringResource(R.string.agent_voice_setup_service_detail) else null, + action = if (service == null) ({ SecondaryButton(stringResource(R.string.setup_install), compact = true) { openStore(context) } }) else null, + ) + CheckRow( + if (appMic) CheckState.OK else CheckState.WARN, stringResource(R.string.agent_voice_setup_app_mic), null, + action = if (!appMic) ({ + SecondaryButton(stringResource(R.string.libraries_access_allow), compact = true) { + if (ask != null) ask.launch(Manifest.permission.RECORD_AUDIO) else openAppInfo(context, context.packageName) + } + }) else null, + ) + CheckRow( + if (serviceMic) CheckState.OK else CheckState.WARN, stringResource(R.string.agent_voice_setup_service_mic), + if (service != null && !serviceMic && !paired) stringResource(R.string.agent_voice_setup_service_mic_detail) else null, divider = false, + action = if (service != null && !serviceMic) ({ + SecondaryButton(stringResource(R.string.libraries_access_allow), enabled = !working, compact = true) { + if (paired) viaAdb("pm grant $service ${Manifest.permission.RECORD_AUDIO}") { openAppInfo(context, service) } else openAppInfo(context, service) + } + }) else null, + ) + } +} diff --git a/app/src/main/java/com/droiddeck/launcher/ui/CardDetailHost.kt b/app/src/main/java/com/droiddeck/launcher/ui/CardDetailHost.kt index 2a50f3c35b..29410a2725 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/CardDetailHost.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/CardDetailHost.kt @@ -26,6 +26,7 @@ import androidx.compose.ui.focus.onFocusChanged import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.luminance import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.layout.onGloballyPositioned @@ -76,6 +77,7 @@ internal fun CardDetailHost( var leaving by remember { mutableStateOf(false) } var from by remember { mutableStateOf(null) } var art by remember { mutableStateOf(null) } + var hero by remember { mutableStateOf(null) } var viewportAt by remember { mutableStateOf(Offset.Zero) } var viewportH by remember { mutableStateOf(0) } LaunchedEffect(open) { @@ -83,6 +85,7 @@ internal fun CardDetailHost( val mark = StoresMotion.takeCard(open) from = mark?.let { Origin(it.bounds.translate(-viewportAt), it.corner) } art = mark?.art + hero = mark?.hero StoresMotion.heroLands = mark != null leaving = false shown = open @@ -152,7 +155,12 @@ internal fun CardDetailHost( }, ) } - PageFlood(origin, leaving, painter, onto = { StoresMotion.heroAt }, ontoCorner = 16.dp) { body() } + val light = androidx.compose.material3.MaterialTheme.colorScheme.background.luminance() > 0.5f + val heroPainter = hero?.takeIf { it != art }?.let { url -> + coil.compose.rememberAsyncImagePainter(remember(url) { coil.request.ImageRequest.Builder(ctx).data(url).size(1280, 720).placeholderMemoryCacheKey(url).build() }) + } ?: painter + val look = HeroLook(rememberArtBrightness(hero ?: art), light, androidx.compose.material3.MaterialTheme.colorScheme.background) + PageFlood(origin, leaving, painter, onto = { StoresMotion.heroAt }, ontoCorner = 0.dp, ontoLook = look, ontoArt = heroPainter) { body() } } } } diff --git a/app/src/main/java/com/droiddeck/launcher/ui/DualScreenPanel.kt b/app/src/main/java/com/droiddeck/launcher/ui/DualScreenPanel.kt index df4e4a8d1b..3ea7950600 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/DualScreenPanel.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/DualScreenPanel.kt @@ -1,5 +1,7 @@ package com.droiddeck.launcher.ui +import androidx.compose.material.icons.automirrored.outlined.ArrowBack +import androidx.compose.material.icons.Icons import android.app.ActivityOptions import android.content.Context import android.content.Intent @@ -363,7 +365,8 @@ internal fun DualPanelContent(model: DualPanelModel) { private fun PanelTile(key: String, current: Boolean, badge: Boolean, count: Int, modifier: Modifier, onClick: () -> Unit) { val colors = MaterialTheme.colorScheme val pal = LocalPalette.current - val (label, icon) = railLabelIcon(key) + val (label, base) = railLabelIcon(key) + val icon = if (key == NavTabs.MORE && MoreTabs.inside) Icons.AutoMirrored.Outlined.ArrowBack else base val shape = RoundedCornerShape(18.dp) Box( modifier.fillMaxSize().clip(shape) @@ -373,7 +376,7 @@ private fun PanelTile(key: String, current: Boolean, badge: Boolean, count: Int, contentAlignment = Alignment.Center, ) { Column(horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp)) { - Icon(icon, contentDescription = null, tint = if (current) pal.signal else colors.onSurfaceVariant, modifier = Modifier.size(34.dp)) + androidx.compose.animation.Crossfade(icon, animationSpec = Motion.tw(220), label = "panelIcon") { Icon(it, contentDescription = null, tint = if (current) pal.signal else colors.onSurfaceVariant, modifier = Modifier.size(34.dp)) } Text(stringResource(label), fontSize = 15.sp, fontWeight = FontWeight.SemiBold, color = if (current) pal.signal else colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.padding(horizontal = 6.dp)) diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndContent.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndContent.kt index 7b1654e1c3..191956c170 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndContent.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndContent.kt @@ -298,7 +298,7 @@ private fun Content( AgentPage(modifier.padding(horizontal = padH).padding(top = padV)) return } - if (selected == "android-apps" && s.isHomeApp) { + if (selected == "android-apps") { AndroidAppsPage(s, a, modifier, onAndroidAppClick) return } diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndGames.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndGames.kt index 45ef20fe8d..a276eb91e5 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndGames.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndGames.kt @@ -1,5 +1,6 @@ package com.droiddeck.launcher.ui +import androidx.compose.material.icons.outlined.Sync import androidx.compose.ui.platform.testTag import com.droiddeck.launcher.R import androidx.compose.ui.res.stringResource @@ -41,11 +42,12 @@ import androidx.compose.runtime.getValue @Composable -internal fun GameFileFolderActions(s: FrontEndState, a: FrontEndActions) { +internal fun GameFileFolderActions(s: FrontEndState, a: FrontEndActions, labeled: Boolean = false) { if (s.shortcutPicker) return var open by remember { androidx.compose.runtime.mutableStateOf(false) } Box { - SecondaryButton(stringResource(R.string.game_frontend_files), compact = true) { open = !open } + if (labeled) SecondaryButton(stringResource(R.string.game_frontend_files), compact = true) { open = !open } + else HeaderIconButton(stringResource(R.string.game_frontend_files), androidx.compose.material.icons.Icons.Outlined.Sync, "frontend-files", Modifier.downToFirstTile()) { open = !open } AnchoredMenu(open, onDismiss = { open = false }, title = s.gameSyncFolder ?: stringResource(R.string.game_frontend_files)) { first -> MenuItem(stringResource(R.string.game_file_sync), checked = false, focusRequester = first) { open = false; a.onSyncGameFiles() diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndRail.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndRail.kt index 390403e3c3..c35f3d10df 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndRail.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndRail.kt @@ -55,6 +55,7 @@ import androidx.compose.material.icons.outlined.DesktopWindows import androidx.compose.material.icons.outlined.Layers import androidx.compose.material.icons.outlined.LocalMall import androidx.compose.material.icons.outlined.MoreHoriz +import androidx.compose.material.icons.automirrored.outlined.ArrowBack import androidx.compose.material.icons.outlined.SportsEsports import androidx.compose.material.icons.outlined.Storefront import androidx.compose.material.icons.outlined.SystemUpdate @@ -235,7 +236,8 @@ private fun NavigationItems( val setupNeedsAttention = setupNeedsAttention(s) val downloadsAt = if ("downloads" in NavTabs.more(s)) NavTabs.MORE else "downloads" for (key in navigationKeys(s)) { - val (label, icon) = railLabelIcon(key) + val (label, base) = railLabelIcon(key) + val icon = if (key == NavTabs.MORE && MoreTabs.inside) Icons.AutoMirrored.Outlined.ArrowBack else base key(key) { RailItem(stringResource(label), icon, key, shown == key, compact, iconOnly, height, width, badge = railBadge(s, key, setupNeedsAttention), @@ -297,9 +299,9 @@ private fun RailItem( .selectable(selected = current, interactionSource = src, indication = LocalIndication.current, role = Role.Tab, onClick = onClick) .then(if (iconOnly) Modifier.semantics { contentDescription = label } else Modifier), ) { - if (iconOnly) Icon(icon, contentDescription = null, tint = fg, modifier = Modifier.size(22.dp)) + if (iconOnly) androidx.compose.animation.Crossfade(icon, animationSpec = Motion.tw(220), label = "railIcon") { Icon(it, contentDescription = null, tint = fg, modifier = Modifier.size(22.dp)) } else Column(horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(3.dp)) { - Icon(icon, contentDescription = null, tint = fg, modifier = Modifier.size(if (height < 56.dp) 20.dp else 22.dp)) + androidx.compose.animation.Crossfade(icon, animationSpec = Motion.tw(220), label = "railIcon") { Icon(it, contentDescription = null, tint = fg, modifier = Modifier.size(if (height < 56.dp) 20.dp else 22.dp)) } FitText(label, maxSize = 12.sp, modifier = Modifier.padding(horizontal = 4.dp), fontWeight = FontWeight.SemiBold, color = fg) } if (badge) Box( diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt index 0475e69d3c..ef414c4eb0 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt @@ -181,7 +181,6 @@ class FrontEndState( val animationsEnabled: Boolean = true, val lowStorageWarning: Boolean = true, val launcherIcon: String = com.droiddeck.launcher.LauncherIcon.DARK, - val gameStoresEnabled: Boolean = true, val soundtracksEnabled: Boolean = true, val soundtracksIngame: Boolean = false, val soundtracks: List = emptyList(), @@ -290,8 +289,6 @@ class FrontEndActions( val onDownloadMirror: (String) -> Unit = {}, val onDownloadPrefix: (String) -> Unit = {}, val onDownloadProxy: (String) -> Unit = {}, - val onGameStoresEnabled: (Boolean) -> Unit = {}, - val onSoundtracksEnabled: (Boolean) -> Unit = {}, val onSoundtracksIngame: (Boolean) -> Unit = {}, val onSoundtrackAdded: (java.io.File) -> Unit = {}, val onSoundtracksChanged: () -> Unit = {}, @@ -594,7 +591,6 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com BackHandler(enabled = !processSettingsPageVisible && backToMore) { selected = NavTabs.MORE } - LaunchedEffect(s.isHomeApp) { if (!s.isHomeApp && selected == "android-apps") selected = "steam" } LaunchedEffect(s.soundtracksEnabled) { if (!s.soundtracksEnabled && (selected == "soundtracks" || selected.startsWith("sound:"))) selected = "games" } @@ -616,6 +612,7 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com else -> s.pageKey ?: selected } val railSelection = if (openTab in NavTabs.more(s)) NavTabs.MORE else openTab + androidx.compose.runtime.SideEffect { MoreTabs.inside = railSelection == NavTabs.MORE && openTab != NavTabs.MORE } val railSelectionNow = androidx.compose.runtime.rememberUpdatedState(railSelection) var railPicks by remember { mutableStateOf(0) } val showRailPage: (String, Boolean) -> Unit = { key, focusContent -> @@ -757,11 +754,11 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com onRailSelect(key) }, a) CompositionLocalProvider(LocalShowSection provides { key -> selected = key }) { - val agentKeyboardOpen = railSelection == "agent" && WindowInsets.ime.getBottom(androidx.compose.ui.platform.LocalDensity.current) > 0 + val agentKeyboardOpen = openTab == "agent" && WindowInsets.ime.getBottom(androidx.compose.ui.platform.LocalDensity.current) > 0 LauncherLayout( bottomNavigation && !s.dualScreen, pal.line, Modifier.fillMaxSize().onGloballyPositioned { screenAt = it.positionInRoot() } - .then(if (railSelection == "agent") Modifier.imePadding() else Modifier) + .then(if (openTab == "agent") Modifier.imePadding() else Modifier) .then(if (s.dualScreen) Modifier.onKeyEvent { event -> val step = dualPageStep(event.nativeKeyEvent) ?: return@onKeyEvent false if (event.type == KeyEventType.KeyDown && !processSettingsPageVisible) { diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndSetup.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndSetup.kt index a70d411f40..9f457566bb 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndSetup.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndSetup.kt @@ -236,12 +236,10 @@ internal fun SetupPanel( ), ) { PageHeader(stringResource(R.string.setup_title)) { - Box(Modifier.weight(1f)) { SheetChips(tabs, tab, chipFocus, onPick = pick) } - if (!searching) SearchIcon(stringResource(R.string.settings_search)) { searching = true } - } - if (searching) { - androidx.activity.compose.BackHandler { searching = false; query = "" } - SettingsSearchField(query, { query = it }) { searching = false; query = "" } + SettingsPillSearch( + Modifier.weight(1f), searching, query, { query = it }, + onOpen = { searching = true }, onClose = { searching = false; query = "" }, + ) { SheetChips(tabs, tab, chipFocus, onPick = pick) } } val listing = searching && query.isNotBlank() val fixed = tab == CONTROLLER_TAB && !listing diff --git a/app/src/main/java/com/droiddeck/launcher/ui/GameDetail.kt b/app/src/main/java/com/droiddeck/launcher/ui/GameDetail.kt index a1fe8dc9a4..f6c6227ea5 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/GameDetail.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/GameDetail.kt @@ -1,5 +1,6 @@ package com.droiddeck.launcher.ui +import androidx.compose.foundation.horizontalScroll import androidx.compose.foundation.LocalIndication import androidx.compose.ui.semantics.Role import androidx.compose.runtime.CompositionLocalProvider @@ -216,7 +217,6 @@ internal fun GameDetail( } val art: Any? = game?.hero ?: item?.imageUrl ?: installed?.sidecar?.hero ?: installed?.sidecar?.cover val artModel: Any? = if (art is String) cardArtRequest(art, item?.tallImageUrl) else art - val inSteam = !s.shortcutPicker && source != Library.SOURCE_STEAM && (game != null || installed != null) && !(game?.library == Library.XBOX_CLOUD && installed == null) val inset = LocalDetailInset.current GameBackdrop(artModel, art ?: game?.art, hueOf(title), fadeTop = inset.top < 8.dp, onArtPlaced = { StoresMotion.heroAt = it }) { Column(Modifier.fillMaxWidth().padding(horizontal = inset.horizontal).padding(top = inset.top).onFocusChanged { inPage = it.hasFocus }.bumpers(onPrevious = { cycle(-1) }, onNext = { cycle(1) })) { @@ -236,8 +236,9 @@ internal fun GameDetail( } val header: @Composable () -> Unit = { Column(verticalArrangement = Arrangement.spacedBy(8.dp)) { - GameStatusLine(source, game, item, installed, download?.location ?: failed?.location, inSteam) + Spacer(Modifier.height(if (narrow) 8.dp else 20.dp)) GameTitle(title, game?.logo ?: item?.logoUrl, if (narrow) 30.sp else 40.sp) + GameStatusLine(source, game, item, installed, download?.location ?: failed?.location) if (!failed?.error.isNullOrBlank()) Text( failed!!.error!!, fontSize = 13.sp, lineHeight = 17.sp, fontWeight = FontWeight.Medium, color = MaterialTheme.colorScheme.error, maxLines = 3, overflow = TextOverflow.Ellipsis, @@ -296,16 +297,16 @@ internal fun SourceBadge(source: String) { } @Composable -private fun GameStatusLine(source: String, game: Library.SteamGame?, item: CatalogItem?, installed: InstalledStoreGame?, downloadAt: String?, inSteam: Boolean) { +private fun GameStatusLine(source: String, game: Library.SteamGame?, item: CatalogItem?, installed: InstalledStoreGame?, downloadAt: String?) { val ctx = LocalContext.current val colors = MaterialTheme.colorScheme val pal = LocalPalette.current val folder = installed?.folder ?: game?.gameFiles val passName = item?.includedWith.orEmpty() val state = when { - installed != null -> listOf(stringResource(R.string.stores_eyebrow_installed), StoreInstallRoot.labelFor(ctx, installed.folder)) + installed != null -> listOf(StoreInstallRoot.labelFor(ctx, installed.folder)) game?.library == Library.XBOX_CLOUD -> listOf(libraryLabel(game)) - game != null -> listOf(stringResource(R.string.stores_eyebrow_installed), libraryLabel(game)) + game != null -> listOf(libraryLabel(game)) !downloadAt.isNullOrBlank() -> listOf(stringResource(R.string.stores_eyebrow_library), downloadAt) item?.owned == true -> listOf(stringResource(R.string.stores_eyebrow_library)) item?.subscription == true -> listOf(passName.ifBlank { stringResource(R.string.stores_game_pass) }) @@ -314,19 +315,26 @@ private fun GameStatusLine(source: String, game: Library.SteamGame?, item: Catal else -> listOf(stringResource(R.string.stores_eyebrow_store)) } val size = if (folder != null && (installed != null || game != null)) diskSize(installed, folder) else catalogSize(item).takeIf { it > 0 } - val line = (state + listOfNotNull(size?.let { formatBytes(it) })).filter { it.isNotBlank() }.joinToString(" · ").replaceFirstChar { it.uppercase() } - val muted = colors.onBackground.copy(alpha = 0.78f) - Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp)) { + val where = state.filter { it.isNotBlank() }.joinToString(" · ").replaceFirstChar { it.uppercase() } + Row( + verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp), + modifier = Modifier.horizontalScroll(androidx.compose.foundation.rememberScrollState()), + ) { SourceBadge(source) - Text(line, fontSize = 12.sp, color = muted, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f, fill = false)) - if (inSteam) { - Text("·", fontSize = 12.sp, color = muted.copy(alpha = 0.5f)) - Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(5.dp)) { - Icon(Icons.Outlined.VideogameAsset, contentDescription = null, tint = muted, modifier = Modifier.size(15.dp)) - Text(stringResource(R.string.stores_in_steam_label), fontSize = 12.sp, color = muted, maxLines = 1) - Icon(Icons.Filled.Check, contentDescription = null, tint = pal.good, modifier = Modifier.size(14.dp)) - } - } + if (where.isNotBlank()) StatusChip(where) + if (size != null) StatusChip(formatBytes(size)) + } +} + +@Composable +private fun StatusChip(text: String, icon: androidx.compose.ui.graphics.vector.ImageVector? = null, tint: Color? = null) { + val colors = MaterialTheme.colorScheme + Row( + verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp), + modifier = Modifier.glass(CircleShape, 0.06f).padding(horizontal = 10.dp, vertical = 4.dp), + ) { + if (icon != null) Icon(icon, contentDescription = null, tint = tint ?: colors.onBackground.copy(alpha = 0.85f), modifier = Modifier.size(13.dp)) + Text(text, fontSize = 11.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground.copy(alpha = 0.9f), maxLines = 1) } } @@ -384,7 +392,7 @@ private fun GameTitle(title: String, logo: Any?, titleSize: TextUnit) { if (logo != null && !failed) AsyncImage( model = logo, contentDescription = title, contentScale = ContentScale.Fit, alignment = Alignment.CenterStart, onError = { failed = true }, - modifier = Modifier.padding(vertical = 4.dp).height((titleSize.value * 1.5f).dp).widthIn(max = (titleSize.value * 7f).dp).clip(RoundedCornerShape(10.dp)).testTag("game-logo"), + modifier = Modifier.padding(vertical = 4.dp).height((titleSize.value * 2.3f).dp).widthIn(max = (titleSize.value * 10f).dp).clip(RoundedCornerShape(10.dp)).testTag("game-logo"), ) else Text( title, fontSize = titleSize, lineHeight = titleSize * 1.12f, fontWeight = FontWeight.Black, color = MaterialTheme.colorScheme.onBackground, maxLines = 2, overflow = TextOverflow.Ellipsis, @@ -1055,6 +1063,15 @@ internal fun diskSize(installed: InstalledStoreGame?, folder: File): Long? { internal object FolderSizes { val known = androidx.compose.runtime.mutableStateMapOf() private val asked = java.util.Collections.synchronizedSet(HashSet()) + private var saved: android.content.SharedPreferences? = null + + // The last walk of each folder shows at once after a restart; a fresh walk still replaces it. + fun load(context: android.content.Context) { + if (saved != null) return + val p = context.applicationContext.getSharedPreferences("folder_sizes", android.content.Context.MODE_PRIVATE) + saved = p + p.all.forEach { (path, bytes) -> if (bytes is Long && path !in known) known[path] = bytes } + } fun request(folder: File) { if (!asked.add(folder.path)) return @@ -1069,7 +1086,10 @@ internal object FolderSizes { override fun visitFileFailed(file: java.nio.file.Path, exc: java.io.IOException): java.nio.file.FileVisitResult = java.nio.file.FileVisitResult.CONTINUE }) }.isSuccess - if (walked) StoresState.post { known[folder.path] = total } else asked.remove(folder.path) + if (walked) { + saved?.edit()?.putLong(folder.path, total)?.apply() + StoresState.post { known[folder.path] = total } + } else asked.remove(folder.path) }, "folder-size").start() } } diff --git a/app/src/main/java/com/droiddeck/launcher/ui/GameGlass.kt b/app/src/main/java/com/droiddeck/launcher/ui/GameGlass.kt index e5fd8845bd..39c6b07768 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/GameGlass.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/GameGlass.kt @@ -1,5 +1,6 @@ package com.droiddeck.launcher.ui +import androidx.compose.animation.core.animateFloat import androidx.compose.foundation.background import androidx.compose.foundation.border import androidx.compose.foundation.layout.Box @@ -117,7 +118,7 @@ private fun ambientRequest(ctx: android.content.Context, model: Any?): ImageRequ private const val AmbientPixels = 6 @Composable -private fun rememberArtBrightness(model: Any?): Float { +internal fun rememberArtBrightness(model: Any?): Float { val ctx = LocalContext.current val data = (model as? ImageRequest)?.data ?: model val brightness by produceState(0.3f, data) { @@ -170,6 +171,10 @@ internal fun GameBackdrop( }, ) { DisposableEffect(art == null) { onDispose { if (art == null) onArtPlaced(null) } } + if (art == null) androidx.compose.runtime.SideEffect { + StoresMotion.heroFadeTop = fadeTop + StoresMotion.heroDrift = { 0f } + } Box( Modifier.matchParentSize() .graphicsLayer { compositingStrategy = CompositingStrategy.Offscreen } @@ -189,8 +194,9 @@ internal fun GameBackdrop( private fun ArtLayer(model: Any?, sample: Any?, fadeTop: Boolean, blur: androidx.compose.ui.unit.Dp, onPlaced: (androidx.compose.ui.geometry.Rect?) -> Unit) { val colors = MaterialTheme.colorScheme val light = colors.background.luminance() > 0.5f - val pale = ((rememberArtBrightness(sample) - 0.28f) / 0.5f).coerceIn(0f, 1f) - val dim = if (light) 1f else 1f - 0.4f * pale + val look = HeroLook(rememberArtBrightness(sample), light, colors.background) + val dim = look.dim + val pale = look.pale val artFilter = remember(dim) { ColorFilter.colorMatrix(ColorMatrix(floatArrayOf(dim, 0f, 0f, 0f, 0f, 0f, dim, 0f, 0f, 0f, 0f, 0f, dim, 0f, 0f, 0f, 0f, 0f, 1f, 0f))) } BoxWithConstraints(Modifier.fillMaxWidth()) { val height = (maxWidth * 0.4f).coerceIn(ArtMin, ArtMax) @@ -206,24 +212,37 @@ private fun ArtLayer(model: Any?, sample: Any?, fadeTop: Boolean, blur: androidx if (fadeTop) drawRect(Brush.verticalGradient(0f to Color.Transparent, (24.dp.toPx() / size.height) to Color.Black), blendMode = BlendMode.DstIn) }, ) { + // A slow push-in and drift, centred where the crop leans, that starts from rest so a card flight lands on the same frame. + val drift = if (Motion.scale == 0f) null else androidx.compose.animation.core.rememberInfiniteTransition(label = "heroDrift").animateFloat( + 0f, 1f, + androidx.compose.animation.core.infiniteRepeatable( + androidx.compose.animation.core.tween(18_000, easing = androidx.compose.animation.core.EaseInOutSine), + androidx.compose.animation.core.RepeatMode.Reverse, + ), + label = "heroDriftT", + ) + androidx.compose.runtime.SideEffect { + StoresMotion.heroFadeTop = fadeTop + StoresMotion.heroDrift = { drift?.value ?: 0f } + } AsyncImage( model = model, contentDescription = null, contentScale = ContentScale.Crop, alignment = BiasAlignment(0.45f, -0.35f), colorFilter = artFilter, - modifier = Modifier.matchParentSize().then(if (blur > 0.dp) Modifier.blur(blur) else Modifier), + modifier = Modifier.matchParentSize() + .graphicsLayer { + val t = drift?.value ?: 0f + val zoom = HeroDrift.zoom(t) + scaleX = zoom + scaleY = zoom + translationX = size.width * HeroDrift.DX * t + translationY = size.height * HeroDrift.DY * t + transformOrigin = androidx.compose.ui.graphics.TransformOrigin(HeroDrift.PX, HeroDrift.PY) + } + .then(if (blur > 0.dp) Modifier.blur(blur) else Modifier), ) Box( - Modifier.matchParentSize().drawBehind { - drawRect(colors.background.copy(alpha = if (light) 0.1f else 0.12f + 0.3f * pale)) - drawRect( - Brush.radialGradient( - 0f to colors.background.copy(alpha = if (light) 0.5f else 0.66f), - 0.55f to colors.background.copy(alpha = if (light) 0.2f else 0.3f), - 1f to Color.Transparent, - center = Offset(size.width * 0.22f, size.height * 0.55f), radius = size.width * 0.55f, - ), - ) - }, + Modifier.matchParentSize().drawBehind { with(look) { shade(size, 1f) } }, ) } } @@ -265,3 +284,29 @@ internal fun Modifier.glass(shape: Shape, lift: Float = 0f): Modifier { } .border(1.dp, rim, shape) } + +internal class HeroLook(brightness: Float, val light: Boolean, val background: Color) { + val pale = ((brightness - 0.28f) / 0.5f).coerceIn(0f, 1f) + val dim = if (light) 1f else 1f - 0.4f * pale + + fun androidx.compose.ui.graphics.drawscope.DrawScope.shade(size: androidx.compose.ui.geometry.Size, strength: Float) { + drawRect(background.copy(alpha = (if (light) 0.1f else 0.12f + 0.3f * pale) * strength), size = size) + drawRect( + Brush.radialGradient( + 0f to background.copy(alpha = (if (light) 0.5f else 0.66f) * strength), + 0.55f to background.copy(alpha = (if (light) 0.2f else 0.3f) * strength), + 1f to Color.Transparent, + center = Offset(size.width * 0.22f, size.height * 0.55f), radius = size.width * 0.55f, + ), + size = size, + ) + } +} + +internal object HeroDrift { + const val PX = 0.72f + const val PY = 0.33f + const val DX = -0.04f + const val DY = 0.03f + fun zoom(t: Float) = 1f + 0.16f * t +} diff --git a/app/src/main/java/com/droiddeck/launcher/ui/LibraryAccounts.kt b/app/src/main/java/com/droiddeck/launcher/ui/LibraryAccounts.kt new file mode 100644 index 0000000000..2b10c7902e --- /dev/null +++ b/app/src/main/java/com/droiddeck/launcher/ui/LibraryAccounts.kt @@ -0,0 +1,171 @@ +package com.droiddeck.launcher.ui + +import androidx.compose.foundation.LocalIndication +import androidx.compose.foundation.background +import androidx.compose.foundation.basicMarquee +import androidx.compose.foundation.clickable +import androidx.compose.foundation.hoverable +import androidx.compose.foundation.interaction.MutableInteractionSource +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.heightIn +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Add +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.focus.FocusRequester +import androidx.compose.ui.focus.focusRequester +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.layout.LayoutCoordinates +import androidx.compose.ui.layout.boundsInRoot +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.semantics.Role +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import com.droiddeck.launcher.R +import com.droiddeck.launcher.stores.Store +import com.droiddeck.launcher.stores.StoresState + +@Composable +internal fun StoreAccountsButton() { + val ctx = LocalContext.current + val colors = MaterialTheme.colorScheme + val pal = LocalPalette.current + val placed = remember { arrayOfNulls(1) } + var itchKey by remember { mutableStateOf(false) } + val home = { placed[0]?.takeIf { it.isAttached }?.boundsInRoot() } + if (itchKey) ItchKeyDialog { itchKey = false } + val src = remember { MutableInteractionSource() } + val hot = rememberHot(src) + val label = stringResource(R.string.library_accounts) + val open = { + placed[0]?.takeIf { it.isAttached }?.boundsInRoot()?.let { at -> + Steps.ask(StepAsk( + anchor = at, side = StepSide.Left, accent = pal.signal, items = storesWithSignIn().size + 1, pillCorner = 20.dp, maxWidth = 380.dp, + handle = { Icon(Icons.Filled.Add, null, tint = pal.signal, modifier = Modifier.size(20.dp)) }, + ) { + StoreAccountsStep(onSignIn = { store, row -> + Steps.fold() + when { + store == Store.ITCH -> itchKey = true + row == null || Motion.scale == 0f || StoresMotion.signIn != null -> StoresState.signIn(ctx, store) + else -> { + val accent = storePalette(pal, store).signal + StoresMotion.signIn = SignInFlood(store, row, accent, sourceColours(store.id).dot, home = home()) + } + } + }) + }) + } + Unit + } + Box(Modifier.onGloballyPositioned { placed[0] = it }) { + Box( + contentAlignment = Alignment.Center, + modifier = Modifier.paneItem("libchip:accounts").testTag("library-accounts").size(40.dp).clip(CircleShape) + .background(colors.surface) + .glideBorder(hot, CircleShape, pal.signal, pal.line) + .hoverable(src) + .clickable(interactionSource = src, indication = LocalIndication.current, role = Role.Button, onClickLabel = label, onClick = open) + .controllerConfirm(onClick = open), + ) { Icon(Icons.Filled.Add, label, tint = if (hot) colors.onBackground else colors.onSurfaceVariant, modifier = Modifier.size(20.dp)) } + } +} + +private fun storesWithSignIn(): List = Store.entries.filter { StoresState.backend(it) != null } + +@Composable +private fun StepOutScope.StoreAccountsStep(onSignIn: (Store, androidx.compose.ui.geometry.Rect?) -> Unit) { + val ctx = LocalContext.current + val colors = MaterialTheme.colorScheme + var leaving by remember { mutableStateOf(null) } + LaunchedEffect(leaving) { if (leaving != null) focusSoon { first } } + val out = leaving + if (out == null) { + StepTitle(stringResource(R.string.library_accounts)) + Column(Modifier.fillMaxWidth().heightIn(max = (maxHeight - 72.dp).coerceAtLeast(120.dp)).verticalScroll(rememberScrollState())) { + storesWithSignIn().forEachIndexed { i, store -> + val name = StoresState.accounts[store] + val at = remember { arrayOfNulls(1) } + StoreTheme(store) { + AccountRow( + store, name, + modifier = Modifier.stepItem(1 + i).then(if (i == 0) Modifier.focusRequester(first) else Modifier) + .onGloballyPositioned { at[0] = it }, + enabled = open, + ) { if (name != null) leaving = store else onSignIn(store, at[0]?.takeIf { it.isAttached }?.boundsInRoot()) } + } + } + } + } else { + StepTitle(stringResource(R.string.stores_signout_title, out.label)) + Text(stringResource(R.string.stores_signout_note), fontSize = 13.sp, color = colors.onSurfaceVariant, modifier = Modifier.stepItem(1).padding(start = 4.dp, bottom = 12.dp)) + Row(horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End), modifier = Modifier.fillMaxWidth().stepItem(2)) { + StepChoice(stringResource(R.string.stores_signout_stay), enabled = open, modifier = Modifier.focusRequester(first)) { leaving = null } + StepChoice(stringResource(R.string.stores_signout_go), danger = true, enabled = open) { + Steps.fold() + StoresState.signOut(ctx, out) + } + } + } +} + +@OptIn(androidx.compose.foundation.ExperimentalFoundationApi::class) +@Composable +private fun AccountRow(store: Store, account: String?, modifier: Modifier, enabled: Boolean, onClick: () -> Unit) { + val colors = MaterialTheme.colorScheme + val pal = LocalPalette.current + val src = remember { MutableInteractionSource() } + val hot = rememberHot(src) + val shape = RoundedCornerShape(20.dp) + val signedIn = account != null + val accent = pal.signal + Row( + verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp), + modifier = modifier.fillMaxWidth().heightIn(min = 44.dp).clip(shape) + .background(if (hot) accent.copy(alpha = 0.16f) else Color.Transparent) + .glideBorder(hot, shape, accent, Color.Transparent) + .hoverable(src) + .clickable(interactionSource = src, indication = LocalIndication.current, enabled = enabled, role = Role.Button, onClick = onClick) + .controllerConfirm(enabled = enabled, onClick = onClick) + .testTag("account-${store.id}") + .padding(horizontal = 16.dp), + ) { + Box(Modifier.size(10.dp).background(sourceColours(store.id).dot.copy(alpha = if (signedIn) 1f else 0.45f), CircleShape)) + Row(Modifier.weight(1f), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) { + Text(store.label, fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground, maxLines = 1, softWrap = false) + if (account != null) Text( + account, fontSize = 13.sp, color = colors.onSurfaceVariant, maxLines = 1, softWrap = false, + modifier = Modifier.weight(1f, fill = false).basicMarquee(iterations = Int.MAX_VALUE, initialDelayMillis = 1_200), + ) + } + Text( + stringResource(if (signedIn) R.string.library_account_sign_out else R.string.library_account_sign_in), + fontSize = 13.sp, fontWeight = FontWeight.SemiBold, color = if (signedIn) (if (hot) colors.error else colors.onSurfaceVariant) else if (hot) accent else colors.onBackground, maxLines = 1, + ) + } +} diff --git a/app/src/main/java/com/droiddeck/launcher/ui/LibraryPage.kt b/app/src/main/java/com/droiddeck/launcher/ui/LibraryPage.kt index d4210f326b..64e949b2cd 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/LibraryPage.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/LibraryPage.kt @@ -226,10 +226,11 @@ internal fun LibraryPage(s: FrontEndState, a: FrontEndActions, selected: String, val inputMode = androidx.compose.ui.platform.LocalInputModeManager.current LaunchedEffect(Unit) { StoresState.refresh(ctx) } remember { LibraryDisplay.load(ctx) } + remember { FolderSizes.load(ctx) } remember { LibraryFavorites.load(ctx) } val soundMode = selected == "soundtracks" || selected.startsWith("sound:") val favorites = if (soundMode) emptySet() else LibraryFavorites.keys - val stores = s.gameStoresEnabled && !s.shortcutPicker && !soundMode + val stores = !s.shortcutPicker && !soundMode val signedIn = Store.entries.filter { StoresState.isSignedIn(it) } LaunchedEffect(stores, signedIn) { if (stores) signedIn.forEach { StoresState.loadLibrary(ctx, it) } } val owned = if (stores) signedIn.associateWith { StoresState.library[it].orEmpty() } else emptyMap() @@ -345,7 +346,13 @@ internal fun LibraryPage(s: FrontEndState, a: FrontEndActions, selected: String, } var sizesWaited by remember(sizeSort) { mutableStateOf(false) } LaunchedEffect(sizeSort) { if (sizeSort) { kotlinx.coroutines.delay(8_000); sizesWaited = true } } - val sizesPending = sizeSort && !sizesWaited && candidates.any { sizeOf(it) == null } + fun sizeComing(e: LibraryEntry): Boolean = when { + e.storeKey != null && e.storeKey in installedStore -> true + e.game?.gameFiles != null -> true + e.item != null -> StoreSizes.coming(e.item) + else -> false + } + val sizesPending = sizeSort && !sizesWaited && candidates.any { sizeOf(it) == null && sizeComing(it) } val sorted = sortGames( candidates, sort, title = { it.title }, releaseDate = { it.item?.releaseDate.orEmpty() }, lastPlayed = { e -> entryTime(e.game?.lastPlayed, e.storeKey?.let { lastPlayed[it] }) }, @@ -467,7 +474,10 @@ private fun LibraryEmpty(s: FrontEndState, a: FrontEndActions, modifier: Modifie Rise(0) { PageHeader(stringResource(R.string.rail_games)) { if (s.steamGamesX64) ClientTag() - if (!s.shortcutPicker) AddGameButton { GamesDialogState.adding = true } + if (!s.shortcutPicker) { + AddGameButton { GamesDialogState.adding = true } + StoreAccountsButton() + } } } Rise(1) { Note(stringResource(if (s.shortcutPicker && s.shortcutLibraryScanning) R.string.game_shortcut_scanning else R.string.games_empty)) } @@ -476,7 +486,7 @@ private fun LibraryEmpty(s: FrontEndState, a: FrontEndActions, modifier: Modifie PrimaryButton(stringResource(R.string.games_play_steam), enabled = !s.busy, main = true, icon = Icons.Filled.PlayArrow, modifier = Modifier.padding(top = 12.dp).testTag("play-steam"), onClick = a.onPlay) } } - Box(Modifier.padding(top = 12.dp)) { GameFileFolderActions(s, a) } + Box(Modifier.padding(top = 12.dp)) { GameFileFolderActions(s, a, labeled = true) } } } @@ -545,7 +555,7 @@ private fun LibraryGrid( Rise(0) { LibraryHeader(s, a, total, searchCleared, source == Store.XBOX.id, showUninstalled, onShowUninstalled, collections = Store.byId(source)?.takeIf { it == Store.ITCH || it == Store.GAMEJOLT }, soundMode = soundMode, onAddSoundtrack = onAddSoundtrack, onCollections = onCollections) } } item(key = "filters", span = { GridItemSpan(maxLineSpan) }) { - Rise(1) { LibraryFilters(sources, source, onSource) } + Rise(1) { LibraryFilters(sources, source, onSource, accounts = !soundMode && !s.shortcutPicker) } } for ((store, line) in syncing) item(key = "sync-${store.id}", span = { GridItemSpan(maxLineSpan) }) { Column(verticalArrangement = Arrangement.spacedBy(4.dp), modifier = Modifier.fillMaxWidth()) { @@ -655,7 +665,7 @@ private fun LibraryHeader( } }, ) { - if (soundMode) HeaderIconButton(stringResource(R.string.soundtracks_saved), Icons.Filled.BookmarkBorder, "collections", onCollections) + if (soundMode) HeaderIconButton(stringResource(R.string.soundtracks_saved), Icons.Filled.BookmarkBorder, "collections", onClick = onCollections) DisplayButton() if (!soundMode && (showUninstalled != null || xbox)) LibraryFilterButton(showUninstalled, onShowUninstalled, xbox) if (collections != null) CollectionsButton(collections) @@ -668,14 +678,14 @@ private fun LibraryHeader( } @Composable -private fun LibraryFilters(sources: List, source: String, onSource: (String) -> Unit) { - if (sources.size < 2) return +private fun LibraryFilters(sources: List, source: String, onSource: (String) -> Unit, accounts: Boolean) { + if (sources.size < 2 && !accounts) return Row( horizontalArrangement = Arrangement.spacedBy(8.dp), verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(top = 4.dp, bottom = 2.dp).horizontalScroll(rememberScrollState()), ) { - SourceFilterChip(LIBRARY_ALL, stringResource(R.string.stores_tab_all), source == LIBRARY_ALL, dot = null) { onSource(LIBRARY_ALL) } - for (src in sources) { + if (sources.size >= 2) SourceFilterChip(LIBRARY_ALL, stringResource(R.string.stores_tab_all), source == LIBRARY_ALL, dot = null) { onSource(LIBRARY_ALL) } + if (sources.size >= 2) for (src in sources) { val store = Store.byId(src) val dot = when { store != null -> sourceColours(src).dot.copy(alpha = if (StoresState.isSignedIn(store) && StoresState.expired[store] != true) 1f else 0.35f) @@ -693,6 +703,7 @@ private fun LibraryFilters(sources: List, source: String, onSource: (Str source == src, dot, ) { onSource(src) } } + if (accounts) StoreAccountsButton() } } @@ -739,7 +750,9 @@ private fun LibraryTile(e: LibraryEntry, capsule: Boolean, first: Boolean, navig RequestSize(e) val open = { val art = if (capsule) tall else wide - placed[0]?.takeIf { it.isAttached }?.let { StoresMotion.markCard(CardMark(e.key, it.boundsInRoot(), corner, (art as? java.io.File)?.path ?: art as? String)) } + placed[0]?.takeIf { it.isAttached }?.let { + StoresMotion.markCard(CardMark(e.key, it.boundsInRoot(), corner, (art as? java.io.File)?.path ?: art as? String, (wide as? java.io.File)?.path ?: wide as? String)) + } onOpen(e.key) } Column( @@ -914,14 +927,14 @@ private fun LibraryRow(e: LibraryEntry, first: Boolean, navigation: Modifier, ch } @Composable -internal fun HeaderIconButton(description: String, icon: androidx.compose.ui.graphics.vector.ImageVector, key: String, onClick: () -> Unit) { +internal fun HeaderIconButton(description: String, icon: androidx.compose.ui.graphics.vector.ImageVector, key: String, modifier: Modifier = Modifier, onClick: () -> Unit) { val colors = MaterialTheme.colorScheme val pal = LocalPalette.current val src = remember { MutableInteractionSource() } val hot = rememberHot(src) Box( contentAlignment = Alignment.Center, - modifier = Modifier.paneItem("btn:$key").size(32.dp).clip(CircleShape).background(if (hot) pal.signal.copy(alpha = 0.14f) else Color.Transparent) + modifier = modifier.paneItem("btn:$key").size(32.dp).clip(CircleShape).background(if (hot) pal.signal.copy(alpha = 0.14f) else Color.Transparent) .glideBorder(hot, CircleShape, pal.signal) .hoverable(src).clickable(interactionSource = src, indication = LocalIndication.current, role = Role.Button, onClick = onClick) .controllerConfirm(onClick = onClick) diff --git a/app/src/main/java/com/droiddeck/launcher/ui/NavTabs.kt b/app/src/main/java/com/droiddeck/launcher/ui/NavTabs.kt index 98679b67e8..f7f4319d29 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/NavTabs.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/NavTabs.kt @@ -5,7 +5,6 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.setValue import com.droiddeck.launcher.agent.AgentHost -import com.droiddeck.launcher.agent.AgentTab import com.droiddeck.launcher.session.SessionPrefs internal enum class TabPlace { BAR, MORE, HIDDEN } @@ -26,9 +25,13 @@ internal object DeveloperTools { internal object NavTabs { const val MORE = "more" - val FEATURES = setOf("stores", "soundtracks", "agent") - val ALL = listOf("steam", "games", "soundtracks", "stores", "downloads", "desktop", "agent", "components", "android-apps", "storage", "sync", "setup", "updates") - private val SHELVED_WHEN_NEW = setOf("storage", "sync") + val ALL = listOf("steam", "desktop", "games", "downloads", "setup", "updates", "stores", "soundtracks", "components", "storage", "sync", "android-apps", "agent") + val DEFAULT_SHELVED = setOf("stores", "soundtracks", "components", "storage", "sync", "android-apps", "agent") + val DEFAULT_HIDDEN = setOf("android-apps", "agent") + private val SHELVED_WHEN_NEW = setOf("storage", "sync", "android-apps", "agent") + private val OLD_ORDER = listOf("steam", "games", "soundtracks", "stores", "downloads", "desktop", "agent", "components", "android-apps", "storage", "sync", "setup", "updates") + private val OLD_SHELVED = setOf("soundtracks", "agent", "storage", "sync") + private const val LAYOUT_VERSION = 2 var order by mutableStateOf(ALL) private set @@ -38,11 +41,41 @@ internal object NavTabs { private set fun load(context: Context) { + migrate(context) val saved = SessionPrefs.navTabOrder(context) order = arrange(saved) - shelved = SessionPrefs.navTabShelved(context).intersect(ALL.toSet()) + + shelved = (SessionPrefs.navTabShelved(context) ?: DEFAULT_SHELVED).intersect(ALL.toSet()) + if (saved.isEmpty()) emptySet() else SHELVED_WHEN_NEW - saved.toSet() - hidden = SessionPrefs.navTabHidden(context).intersect(ALL.toSet()) - FEATURES - "setup" + hidden = (SessionPrefs.navTabHidden(context) ?: DEFAULT_HIDDEN).intersect(ALL.toSet()) - "setup" + } + + fun reset(context: Context) { + order = ALL + shelved = DEFAULT_SHELVED + hidden = DEFAULT_HIDDEN + SessionPrefs.setNavTabOrder(context, order) + SessionPrefs.setNavTabShelved(context, shelved) + SessionPrefs.setNavTabHidden(context, hidden) + } + + fun isDefault(): Boolean = order == ALL && shelved == DEFAULT_SHELVED && hidden == DEFAULT_HIDDEN + + // Before layout 2, switches for game stores, soundtracks and the agent tab, and the home-screen requirement for Apps, + // decided which tabs existed. A layout someone had already touched keeps showing what it showed then. + private fun migrate(context: Context) { + if (SessionPrefs.navTabLayoutVersion(context) >= LAYOUT_VERSION) return + val legacy = SessionPrefs.legacyTabSwitches(context) + if (legacy.touched) { + if (SessionPrefs.navTabOrder(context).isEmpty()) SessionPrefs.setNavTabOrder(context, OLD_ORDER) + if (SessionPrefs.navTabShelved(context) == null) SessionPrefs.setNavTabShelved(context, OLD_SHELVED) + val hide = (SessionPrefs.navTabHidden(context) ?: emptySet()).toMutableSet() + if (!legacy.stores) hide += setOf("stores", "downloads") + if (!legacy.soundtracks) hide += "soundtracks" + if (!legacy.agent) hide += "agent" + if (!com.droiddeck.launcher.HomeApp.isHomeScreenEnabled(context) || !com.droiddeck.launcher.HomeApp.isDefault(context)) hide += "android-apps" + SessionPrefs.setNavTabHidden(context, hide) + } + SessionPrefs.finishTabSwitchMigration(context, LAYOUT_VERSION) } fun arrange(saved: List): List { @@ -57,26 +90,18 @@ internal object NavTabs { } fun available(s: FrontEndState, key: String): Boolean = when (key) { - "android-apps" -> s.isHomeApp - "agent" -> AgentHost.available && DeveloperTools.on + "agent" -> AgentHost.available else -> true } fun hideable(key: String) = key != "setup" fun place(s: FrontEndState, key: String): TabPlace = when { - featureOff(s, key) || key in hidden -> TabPlace.HIDDEN + key in hidden -> TabPlace.HIDDEN key in shelved -> TabPlace.MORE else -> TabPlace.BAR } - private fun featureOff(s: FrontEndState, key: String) = when (key) { - "stores", "downloads" -> !s.gameStoresEnabled - "soundtracks" -> !s.soundtracksEnabled - "agent" -> !AgentTab.shown - else -> false - } - fun listed(s: FrontEndState) = order.filter { available(s, it) } fun more(s: FrontEndState) = listed(s).filter { place(s, it) == TabPlace.MORE } @@ -87,7 +112,7 @@ internal object NavTabs { } fun setHidden(context: Context, key: String, hide: Boolean) { - hidden = if (hide && hideable(key) && key !in FEATURES) hidden + key else hidden - key + hidden = if (hide && hideable(key)) hidden + key else hidden - key SessionPrefs.setNavTabHidden(context, hidden) } diff --git a/app/src/main/java/com/droiddeck/launcher/ui/PageFlood.kt b/app/src/main/java/com/droiddeck/launcher/ui/PageFlood.kt index e0e95343d7..12834b1edf 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/PageFlood.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/PageFlood.kt @@ -1,5 +1,6 @@ package com.droiddeck.launcher.ui +import androidx.compose.ui.graphics.drawscope.withTransform import android.os.SystemClock import androidx.compose.animation.core.Animatable import androidx.compose.animation.core.spring @@ -84,6 +85,8 @@ internal fun PageFlood( sinks: Boolean = false, onto: (() -> Rect?)? = null, ontoCorner: androidx.compose.ui.unit.Dp = 0.dp, + ontoLook: HeroLook? = null, + ontoArt: Painter? = null, content: @Composable () -> Unit, ) { val pal = LocalPalette.current @@ -108,12 +111,16 @@ internal fun PageFlood( kotlinx.coroutines.withTimeoutOrNull(300) { snapshotFlow { get() }.first { it != null } } }?.translate(-at)?.takeIf { it.height > 1f && it.overlaps(Rect(Offset.Zero, size)) } if (target != null) { + // A tile with no picture yet would cover the card with a blank box, so wait briefly for the art. + if (!leaving) kotlinx.coroutines.withTimeoutOrNull(250) { + snapshotFlow { art.ready() && (ontoArt == null || ontoArt.ready()) }.first { it } + } coroutineScope { if (!leaving) { val runs = edges.map { launch { it.animateTo(1f, Motion.sp(0.85f, 320f)) } } - snapshotFlow { edges.all { it.value >= 0.9f } }.first { it } - launch { shown.animateTo(1f, Motion.tw(240)) } - launch { delay(Motion.ms(140).toLong()); tile.animateTo(0f, Motion.tw(220)) } + snapshotFlow { edges.all { it.value >= 0.985f } }.first { it } + launch { shown.animateTo(1f, Motion.tw(220)) } + launch { delay(Motion.ms(120).toLong()); tile.animateTo(0f, Motion.tw(200)) } runs.forEach { it.join() } } else { launch { shown.animateTo(0f, Motion.tw(160)) } @@ -164,15 +171,16 @@ internal fun PageFlood( val rise = if (onto != null) 0f else 1f Box(Modifier.fillMaxSize().graphicsLayer { alpha = shown.value; translationY = (1f - shown.value) * 14.dp.toPx() * rise }) { content() } val onCorner = with(density) { ontoCorner.toPx() } - Canvas(Modifier.fillMaxSize()) { - if (tile.value > 0.01f) drawTile(from, edges.map { it.value }, pal.surface, pal.line2, tile.value, art, target, onCorner) + Canvas(Modifier.fillMaxSize().graphicsLayer { compositingStrategy = androidx.compose.ui.graphics.CompositingStrategy.Offscreen }) { + val live = target?.let { landed -> onto?.invoke()?.translate(-at)?.takeIf { it.height > 1f } ?: landed } + if (tile.value > 0.01f && (live == null || art.ready())) drawTile(from, edges.map { it.value }, pal.surface, pal.line2, tile.value, art, live, onCorner, ontoLook, ontoArt) } } } private fun DrawScope.drawTile( from: Origin, v: List, fill: Color, line: Color, alpha: Float, art: Painter? = null, - to: Rect? = null, toCorner: Float = 0f, + to: Rect? = null, toCorner: Float = 0f, look: HeroLook? = null, toArt: Painter? = null, ) { val (l, t, r, b) = v val mean = v.sumOf { it.coerceIn(0f, 1f).toDouble() }.toFloat() / 4f @@ -194,8 +202,12 @@ private fun DrawScope.drawTile( val h = (bottom - top).coerceAtLeast(0f) val corner = if (to != null) lerp(from.corner, toCorner, mean).coerceAtMost(minOf(w, h) / 2f) else lerp(from.corner * (1f - mean), minOf(w, h) * 0.42f, sin(PI * mean).toFloat().coerceAtLeast(0f)) - drawRoundRect(fill, Offset(left, top), Size(w, h), CornerRadius(corner), alpha = alpha) val pic = art?.intrinsicSize?.takeIf { it.isSpecified && it.width > 0f && it.height > 0f } + if (to != null && art != null && pic != null && w > 0f && h > 0f) { + drawHeroTile(art, toArt ?: art, left, top, w, h, corner, mean, alpha, fill, look, StoresMotion.heroDrift() * mean, StoresMotion.heroFadeTop) + return + } + drawRoundRect(fill, Offset(left, top), Size(w, h), CornerRadius(corner), alpha = alpha) if (art != null && pic != null && w > 0f && h > 0f) { val k = maxOf(w / pic.width, h / pic.height) val dw = pic.width * k @@ -207,3 +219,53 @@ private fun DrawScope.drawTile( val edge = (1f - mean * 3f).coerceIn(0f, 1f) if (edge > 0f) drawRoundRect(line, Offset(left, top), Size(w, h), CornerRadius(corner), alpha = alpha * edge, style = Stroke(1.dp.toPx())) } + +// Morphs the card's fitted art into the detail hero as GameBackdrop's ArtLayer draws it: cropped toward the upper right, +// dimmed, faded in from the left and out at the bottom, so the hand-off to the real hero has nothing to jump. +private fun DrawScope.drawHeroTile( + card: Painter, hero: Painter, left: Float, top: Float, w: Float, h: Float, corner: Float, t: Float, alpha: Float, fill: Color, look: HeroLook?, + drift: Float, fadeTop: Boolean, +) { + val shape = Path().apply { addRoundRect(RoundRect(left, top, left + w, top + h, CornerRadius(corner))) } + drawContext.canvas.saveLayer(Rect(left, top, left + w, top + h), androidx.compose.ui.graphics.Paint()) + clipPath(shape) { + drawRect(fill, Offset(left, top), Size(w, h), alpha = alpha * (1f - t)) + val swap = if (hero === card) 1f else if (!hero.ready()) 0f else ((t - 0.15f) / 0.6f).coerceIn(0f, 1f) + if (hero !== card) drawCropped(card, left, top, w, h, 0f, 0f, alpha * (1f - swap)) + withTransform({ + translate(w * HeroDrift.DX * drift, h * HeroDrift.DY * drift) + scale(HeroDrift.zoom(drift), HeroDrift.zoom(drift), Offset(left + w * HeroDrift.PX, top + h * HeroDrift.PY)) + clipRect(left, top, left + w, top + h) + }) { drawCropped(hero, left, top, w, h, lerp(0f, 0.45f, t), lerp(0f, -0.35f, t), alpha * swap) } + if (look != null) { + if (look.dim < 1f) drawRect(Color.Black, Offset(left, top), Size(w, h), alpha = alpha * (1f - look.dim) * t) + translate(left, top) { with(look) { shade(Size(w, h), t * alpha) } } + } + val keep = Color.Black + val gone = Color.Black.copy(alpha = 1f - t) + drawRect( + androidx.compose.ui.graphics.Brush.horizontalGradient(0.08f to gone, 0.55f to keep, startX = left, endX = left + w), + Offset(left, top), Size(w, h), blendMode = androidx.compose.ui.graphics.BlendMode.DstIn, + ) + drawRect( + androidx.compose.ui.graphics.Brush.verticalGradient(0.55f to keep, 1f to gone, startY = top, endY = top + h), + Offset(left, top), Size(w, h), blendMode = androidx.compose.ui.graphics.BlendMode.DstIn, + ) + if (fadeTop && h > 0f) drawRect( + androidx.compose.ui.graphics.Brush.verticalGradient(0f to gone, (24.dp.toPx() / h).coerceAtMost(1f) to keep, startY = top, endY = top + h), + Offset(left, top), Size(w, h), blendMode = androidx.compose.ui.graphics.BlendMode.DstIn, + ) + } + drawContext.canvas.restore() +} + +private fun DrawScope.drawCropped(art: Painter, left: Float, top: Float, w: Float, h: Float, bx: Float, by: Float, alpha: Float) { + if (alpha <= 0.001f) return + val pic = art.intrinsicSize.takeIf { it.isSpecified && it.width > 0f && it.height > 0f } ?: return + val k = maxOf(w / pic.width, h / pic.height) + val dw = pic.width * k + val dh = pic.height * k + translate(left + (w - dw) / 2f * (1f + bx), top + (h - dh) / 2f * (1f + by)) { with(art) { draw(Size(dw, dh), alpha = alpha) } } +} + +private fun Painter?.ready(): Boolean = this == null || intrinsicSize.let { it.isSpecified && it.width > 0f && it.height > 0f } diff --git a/app/src/main/java/com/droiddeck/launcher/ui/RailSettingsPages.kt b/app/src/main/java/com/droiddeck/launcher/ui/RailSettingsPages.kt index 23ed5c2043..debc0f86b4 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/RailSettingsPages.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/RailSettingsPages.kt @@ -39,12 +39,16 @@ import androidx.compose.ui.focus.onFocusChanged import androidx.compose.foundation.focusGroup import androidx.compose.runtime.LaunchedEffect import androidx.compose.ui.platform.testTag +import androidx.compose.ui.layout.onGloballyPositioned +import androidx.compose.ui.layout.boundsInRoot import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp import com.droiddeck.launcher.R internal object MoreTabs { var editing by mutableStateOf(false) + var inside by mutableStateOf(false) val button = FocusRequester() } @@ -71,6 +75,36 @@ internal fun SyncTabPage(s: FrontEndState, modifier: Modifier) { } } +@Composable +private fun ResetTabsRow() { + val ctx = androidx.compose.ui.platform.LocalContext.current + val colors = MaterialTheme.colorScheme + val pal = LocalPalette.current + val title = stringResource(R.string.tabs_reset_title) + val body = stringResource(R.string.tabs_reset_body) + val keep = stringResource(R.string.common_cancel) + val reset = stringResource(R.string.tabs_reset) + var at by remember { mutableStateOf(null) } + Box(Modifier.padding(top = 12.dp)) { SettingsRow(stringResource(R.string.tabs_reset_title), stringResource(R.string.tabs_reset_hint)) { + Box(Modifier.onGloballyPositioned { at = it.boundsInRoot() }) { + SecondaryButton(reset, modifier = Modifier.testTag("tabs-reset")) { + val from = at ?: run { NavTabs.reset(ctx); return@SecondaryButton } + Steps.ask(StepAsk( + anchor = from, side = StepSide.Left, accent = pal.signal, items = 3, pillCorner = 20.dp, maxWidth = 360.dp, + handle = { androidx.compose.material3.Text(reset, fontSize = 13.sp, color = pal.signal) }, + ) { + StepTitle(title) + androidx.compose.material3.Text(body, fontSize = 13.sp, color = colors.onSurfaceVariant, modifier = Modifier.stepItem(1).padding(start = 4.dp, bottom = 12.dp)) + androidx.compose.foundation.layout.Row(horizontalArrangement = androidx.compose.foundation.layout.Arrangement.spacedBy(8.dp, Alignment.End), modifier = Modifier.stepItem(2)) { + StepChoice(keep, enabled = open, modifier = Modifier.focusRequester(first)) { Steps.fold() } + StepChoice(reset, enabled = open) { Steps.fold(); NavTabs.reset(ctx) } + } + }) + } + } + } } +} + @OptIn(androidx.compose.ui.ExperimentalComposeUiApi::class) @Composable internal fun EditTabsSheet(s: FrontEndState, a: FrontEndActions) { @@ -123,6 +157,7 @@ internal fun EditTabsSheet(s: FrontEndState, a: FrontEndActions) { } Column(Modifier.weight(1f).verticalScroll(rememberScrollState())) { TabsSettingsGroup(rememberMenuHost(), s, a) + if (!NavTabs.isDefault()) ResetTabsRow() } } } diff --git a/app/src/main/java/com/droiddeck/launcher/ui/SessionDrawerPage.kt b/app/src/main/java/com/droiddeck/launcher/ui/SessionDrawerPage.kt index 2cf218001e..cb438903b7 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/SessionDrawerPage.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/SessionDrawerPage.kt @@ -14,7 +14,7 @@ internal enum class SessionDrawerPage(val firstControl: String) { } internal fun sessionDrawerPages( - hasSecondScreen: Boolean, hasGlasses: Boolean = false, hasAgent: Boolean = com.droiddeck.launcher.agent.AgentHost.installed && com.droiddeck.launcher.agent.AgentTab.shown && DeveloperTools.on, + hasSecondScreen: Boolean, hasGlasses: Boolean = false, hasAgent: Boolean = com.droiddeck.launcher.agent.AgentHost.installed && com.droiddeck.launcher.agent.AgentTab.shown, ): List = SessionDrawerPage.entries.filter { (hasSecondScreen || it != SessionDrawerPage.SECOND_SCREEN) && (hasGlasses || it != SessionDrawerPage.GLASSES) && diff --git a/app/src/main/java/com/droiddeck/launcher/ui/SettingsSearch.kt b/app/src/main/java/com/droiddeck/launcher/ui/SettingsSearch.kt index 0119977b9b..f2adebd9bf 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/SettingsSearch.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/SettingsSearch.kt @@ -1,5 +1,20 @@ package com.droiddeck.launcher.ui +import androidx.compose.ui.unit.lerp +import androidx.compose.ui.graphics.graphicsLayer +import androidx.compose.ui.focus.focusRequester +import androidx.compose.ui.focus.focusProperties +import androidx.compose.ui.focus.FocusRequester +import androidx.compose.runtime.setValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.getValue +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.layout.BoxWithConstraints +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.focusGroup +import androidx.compose.animation.core.animateFloatAsState +import androidx.activity.compose.BackHandler import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row @@ -18,19 +33,56 @@ import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.unit.dp import com.droiddeck.launcher.R +import androidx.compose.ui.input.pointer.PointerEventPass +import androidx.compose.ui.input.pointer.pointerInput +import androidx.compose.ui.semantics.clearAndSetSemantics +// Grows out of the search button over the section pills, with the same spring as the other page searches. +@OptIn(androidx.compose.ui.ExperimentalComposeUiApi::class) @Composable -internal fun SettingsSearchField(query: String, onQuery: (String) -> Unit, onClose: () -> Unit) { - Row( - verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp), - modifier = Modifier.fillMaxWidth().padding(bottom = 8.dp), - ) { - AdbTextField( - value = query, onValueChange = onQuery, label = "", keyboardType = KeyboardType.Text, imeAction = ImeAction.Search, - placeholder = stringResource(R.string.settings_search), compact = true, showLabel = false, focusOnShow = true, - modifier = Modifier.weight(1f), - ) - SmallIconButton(Icons.Filled.Close, stringResource(R.string.settings_search_clear), tint = MaterialTheme.colorScheme.onSurfaceVariant, onClick = onClose) +internal fun SettingsPillSearch( + modifier: Modifier, searching: Boolean, query: String, onQuery: (String) -> Unit, + onOpen: () -> Unit, onClose: () -> Unit, pills: @Composable () -> Unit, +) { + val colors = MaterialTheme.colorScheme + val open by animateFloatAsState(if (searching) 1f else 0f, Motion.sp(0.75f, 420f), label = "settingsSearch") + val icon = remember { FocusRequester() } + var toIcon by remember { mutableStateOf(false) } + var focusOnOpen by remember { mutableStateOf(false) } + val close = { toIcon = true; focusOnOpen = false; onClose() } + BackHandler(enabled = searching) { close() } + LaunchedEffect(toIcon, searching, open <= 0.01f) { + if (searching) toIcon = false + else if (toIcon && open <= 0.01f) { focusSoon { icon }; toIcon = false } + } + BoxWithConstraints(modifier, contentAlignment = Alignment.CenterEnd) { + val full = maxWidth + Box( + Modifier.fillMaxWidth().padding(end = 52.dp) + .graphicsLayer { alpha = 1f - open; translationX = -24.dp.toPx() * open } + .focusProperties { enter = { if (searching) FocusRequester.Cancel else FocusRequester.Default } } + .focusGroup() + .then(if (searching) Modifier.clearAndSetSemantics {} else Modifier) + .then(if (searching) Modifier.pointerInput(Unit) { + awaitPointerEventScope { while (true) awaitPointerEvent(PointerEventPass.Initial).changes.forEach { it.consume() } } + } else Modifier), + ) { pills() } + if (searching || open > 0.01f) { + val w = lerp(44.dp, (full - 40.dp).coerceIn(44.dp, 640.dp), open) + Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(4.dp)) { + Box(Modifier.width(w).graphicsLayer { alpha = (open * 1.6f).coerceAtMost(1f) }) { + AdbTextField( + value = query, onValueChange = onQuery, label = "", keyboardType = KeyboardType.Text, imeAction = ImeAction.Search, + placeholder = stringResource(R.string.settings_search), compact = true, showLabel = false, focusOnShow = focusOnOpen, + clearFocus = !searching, + onFocusChange = { focused -> if (!focused && query.isEmpty() && searching) { focusOnOpen = false; onClose() } }, + ) + } + SmallIconButton(Icons.Filled.Close, stringResource(R.string.settings_search_clear), tint = colors.onSurfaceVariant) { close() } + } + } else { + Box(Modifier.focusRequester(icon)) { SearchIcon(stringResource(R.string.settings_search)) { focusOnOpen = true; onOpen() } } + } } } diff --git a/app/src/main/java/com/droiddeck/launcher/ui/StoresMotion.kt b/app/src/main/java/com/droiddeck/launcher/ui/StoresMotion.kt index d1d1e3ba48..66fcc94965 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/StoresMotion.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/StoresMotion.kt @@ -129,6 +129,8 @@ internal object StoresMotion { val dots = HashMap() var heroAt by mutableStateOf(null) + var heroFadeTop = false + var heroDrift: () -> Float = { 0f } var heroLands by mutableStateOf(false) @@ -143,7 +145,7 @@ internal object StoresMotion { fun takeCard(key: String): CardMark? = card?.takeIf { it.key == key && SystemClock.uptimeMillis() - cardAt < 1_000 }.also { card = null } } -internal class CardMark(val key: String, val bounds: Rect, val corner: Float, val art: String?) +internal class CardMark(val key: String, val bounds: Rect, val corner: Float, val art: String?, val hero: String? = art) internal class StepAsk( val anchor: Rect, @@ -157,7 +159,7 @@ internal class StepAsk( val content: @Composable StepOutScope.() -> Unit, ) -internal class SignInFlood(val store: Store, val from: Rect, val start: Color, val color: Color) { +internal class SignInFlood(val store: Store, val from: Rect, val start: Color, val color: Color, val home: Rect? = null) { var away by mutableStateOf(false) var drainTo by mutableStateOf(null) } @@ -335,7 +337,10 @@ internal fun DownloadFlights() { val from = StoresMotion.takeInstall() ?: focusAnchor(glide, origin) if (from != null) StoresMotion.fly(from) else StoresMotion.landed++ } - Box(Modifier.fillMaxSize().onGloballyPositioned { origin = it.positionInRoot() }) { FlightLayer(origin) } + Box(Modifier.fillMaxSize().onGloballyPositioned { origin = it.positionInRoot() }) { + FlightLayer(origin) + SignInFloodLayer(origin) + } } internal fun focusAnchor(glide: FocusGlide?, origin: Offset): Rect? { diff --git a/app/src/main/java/com/droiddeck/launcher/ui/StoresPage.kt b/app/src/main/java/com/droiddeck/launcher/ui/StoresPage.kt index bc27308a4a..e1602f8663 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/StoresPage.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/StoresPage.kt @@ -155,22 +155,24 @@ internal fun StoresPage(s: FrontEndState, a: FrontEndActions, modifier: Modifier val padH = if (narrow) 14.dp else 22.dp val tabs = remember { androidx.compose.runtime.mutableStateListOf().apply { + SessionPrefs.settleStoresTabOrder(ctx, Store.entries.map { it.id }) addAll(arrangeStoreTabs(SessionPrefs.storesTabOrder(ctx), SessionPrefs.storesTabHidden(ctx))) } } var chip by rememberSaveable { mutableStateOf(tabs.firstOrNull { it.shown }?.store?.id ?: Store.GOG.id) } var arranging by remember { mutableStateOf(false) } val shownStores = tabs.filter { it.shown }.map { it.store } - fun commitTabs() { + fun commitTabs(markCustomized: Boolean = false) { SessionPrefs.setStoresTabOrder(ctx, tabs.map { it.store.id }) SessionPrefs.setStoresTabHidden(ctx, tabs.filterNot { it.shown }.map { it.store.id }.toSet()) + if (markCustomized) SessionPrefs.setStoresTabOrderCustomized(ctx, true) } fun shiftTab(store: Store, delta: Int) { val from = tabs.indexOfFirst { it.store == store } val to = from + delta if (from < 0 || to !in tabs.indices) return tabs.add(to, tabs.removeAt(from)) - commitTabs() + commitTabs(markCustomized = true) } fun moveTab(store: Store, to: Int) { val from = tabs.indexOfFirst { it.store == store } @@ -178,7 +180,7 @@ internal fun StoresPage(s: FrontEndState, a: FrontEndActions, modifier: Modifier val target = to.coerceIn(0, tabs.lastIndex) if (target == from) return tabs.add(target, tabs.removeAt(from)) - commitTabs() + commitTabs(markCustomized = true) } fun toggleTab(store: Store) { val i = tabs.indexOfFirst { it.store == store } @@ -398,7 +400,6 @@ internal fun StoresPage(s: FrontEndState, a: FrontEndActions, modifier: Modifier ) } } - SignInFloodLayer(hostAt) } androidx.compose.runtime.DisposableEffect(Unit) { val page = Any(); StoresMotion.hosting(page); onDispose { StoresMotion.release(page) } } } @@ -458,14 +459,14 @@ internal fun InstallWhere(item: CatalogItem) { } @Composable -private fun SignInFloodLayer(hostAt: Offset) { +internal fun SignInFloodLayer(hostAt: Offset) { val f = StoresMotion.signIn ?: return val ctx = LocalContext.current val lifecycle = androidx.compose.ui.platform.LocalLifecycleOwner.current.lifecycle val density = androidx.compose.ui.platform.LocalDensity.current key(f) { var paused by remember { mutableStateOf(false) } - fun back() { if (f.drainTo == null) f.drainTo = if (StoresState.isSignedIn(f.store)) StoresMotion.dots[f.store] ?: f.from else f.from } + fun back() { if (f.drainTo == null) f.drainTo = f.home ?: if (StoresState.isSignedIn(f.store)) StoresMotion.dots[f.store] ?: f.from else f.from } androidx.compose.runtime.DisposableEffect(lifecycle) { val obs = androidx.lifecycle.LifecycleEventObserver { _, e -> if (e == androidx.lifecycle.Lifecycle.Event.ON_PAUSE && f.away) paused = true @@ -1278,7 +1279,7 @@ private fun GameCard( val placed = remember { arrayOfNulls(1) } val corner = with(androidx.compose.ui.platform.LocalDensity.current) { 10.dp.toPx() } val open = { - placed[0]?.takeIf { it.isAttached }?.let { StoresMotion.markCard(CardMark(item.key, it.boundsInRoot(), corner, item.imageUrl ?: item.tallImageUrl)) } + placed[0]?.takeIf { it.isAttached }?.let { StoresMotion.markCard(CardMark(item.key, it.boundsInRoot(), corner, item.imageUrl ?: item.tallImageUrl, item.imageUrl ?: item.tallImageUrl)) } onOpen(item.key) } val screen = with(androidx.compose.ui.platform.LocalDensity.current) { androidx.compose.ui.platform.LocalConfiguration.current.screenHeightDp.dp.toPx() } diff --git a/app/src/main/java/com/droiddeck/launcher/ui/TabsSettings.kt b/app/src/main/java/com/droiddeck/launcher/ui/TabsSettings.kt index 475c400b16..6d4605785a 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/TabsSettings.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/TabsSettings.kt @@ -55,7 +55,6 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.compose.ui.zIndex import com.droiddeck.launcher.R -import com.droiddeck.launcher.agent.AgentTab import kotlin.math.roundToInt private const val MORE_LINE = "|more|" @@ -93,11 +92,6 @@ internal fun TabsSettingsGroup(host: MenuHost, s: FrontEndState, a: FrontEndActi NavTabs.rearrange(ctx, state, next.subList(0, split), next.subList(split + 1, next.size)) } fun setShown(key: String, show: Boolean) { - when (key) { - "stores" -> if (show != s.gameStoresEnabled) a.onGameStoresEnabled(show) - "soundtracks" -> if (show != s.soundtracksEnabled) a.onSoundtracksEnabled(show) - "agent" -> if (show != AgentTab.shown) AgentTab.set(ctx, show) - } NavTabs.setHidden(ctx, key, !show) } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f9fca47711..ed9fdd3820 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1238,6 +1238,15 @@ Add Dictate Stop dictating + Slide up to lock · left to cancel + Listening… + Set up talking to the agent + Close + Speech service + Speech Services by Google turns your voice into text + Microphone for DroidDeck + Microphone for the speech service + Permissions › Microphone › Allow DroidDeck needs the microphone to dictate Attach what the game shows Could not capture the game @@ -1372,10 +1381,13 @@ Sign in Free models Add key - Paste your API key from opencode.ai/auth + Paste your %1$s key + API key, if the server needs one + Server address, like 192.168.1.20:11434 + Get key Save - Free models, or a Zen key from opencode.ai/auth - Free models · add a Zen key for the rest + Free models, or a key from your provider + Free models · add a key for more PR #%1$d Not built for this copy of DroidDeck Updated %1$s @@ -4254,4 +4266,11 @@ Double-tap the top-right corner, for devices without a Back button Open the session menu Settings need you + Store accounts + Sign in + Sign out + Reset + Reset tabs + Steam, Desktop, Library, Downloads, Settings and Updates on the bar, the rest under More. + Your tab order and what sits under More or is hidden go back to the defaults. diff --git a/app/src/test/java/com/droiddeck/launcher/agent/OpenCodeTest.kt b/app/src/test/java/com/droiddeck/launcher/agent/OpenCodeTest.kt index f34e2ad07c..d05f5f09f3 100644 --- a/app/src/test/java/com/droiddeck/launcher/agent/OpenCodeTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/agent/OpenCodeTest.kt @@ -120,18 +120,25 @@ class OpenCodeTest { assertNull(OpenCode.usage(root, session)) } + private fun provider(id: String) = OpenCode.providers.first { it.id == id } + @Test fun aSavedKeyKeepsOtherProvidersAndFreeIsItsOwnMark() { val root = Files.createTempDirectory("rootfs").toFile() - assertFalse(OpenCode.hasKey(root)) + assertEquals(emptySet(), OpenCode.keys(root)) val auth = File(root, "root/.local/share/opencode/auth.json").apply { parentFile!!.mkdirs() } - auth.writeText("""{"openai":{"type":"oauth","refresh":"r"}}""") - assertFalse(OpenCode.hasKey(root)) - OpenCode.saveKey(root, " sk-zen \n") + auth.writeText("""{"openai-codex":{"type":"oauth","refresh":"r"}}""") + assertEquals(emptySet(), OpenCode.keys(root)) + OpenCode.saveKey(root, provider("opencode"), " sk-zen \n") + OpenCode.saveKey(root, provider("ollama-cloud"), "ol-key") val saved = JSONObject(auth.readText()) - assertEquals("r", saved.getJSONObject("openai").getString("refresh")) + assertEquals("r", saved.getJSONObject("openai-codex").getString("refresh")) assertEquals("sk-zen", saved.getJSONObject("opencode").getString("key")) - assertEquals("api", saved.getJSONObject("opencode").getString("type")) - assertTrue(OpenCode.hasKey(root)) + assertEquals("api", saved.getJSONObject("ollama-cloud").getString("type")) + assertEquals("ol-key", saved.getJSONObject("ollama-cloud").getString("key")) + assertEquals(setOf("opencode", "ollama-cloud"), OpenCode.keys(root)) + OpenCode.removeKey(root, provider("opencode")) + assertEquals(setOf("ollama-cloud"), OpenCode.keys(root)) + assertTrue(JSONObject(auth.readText()).has("openai-codex")) OpenCode.useFree(root) assertTrue(File(root, "root/.config/opencode/.droiddeck-free").exists()) } @@ -140,15 +147,96 @@ class OpenCodeTest { val root = Files.createTempDirectory("rootfs").toFile() val auth = File(root, "root/.local/share/opencode/auth.json").apply { parentFile!!.mkdirs() } auth.writeText("{not json") - assertTrue(runCatching { OpenCode.saveKey(root, "sk-zen") }.isFailure) + assertTrue(runCatching { OpenCode.saveKey(root, provider("opencode"), "sk-zen") }.isFailure) assertEquals("{not json", auth.readText()) - assertFalse(OpenCode.hasKey(root)) + assertEquals(emptySet(), OpenCode.keys(root)) + val config = File(root, "root/.config/opencode/opencode.json").apply { parentFile!!.mkdirs() } + config.writeText("""{"provider":{"droiddeck":{"options":{"baseURL":"http://a/v1"}}}}""") + assertTrue(runCatching { OpenCode.saveKey(root, provider("droiddeck"), "k", "b:1") { _, _ -> """{"data":[{"id":"m"}]}""" } }.isFailure) + assertEquals("""{"provider":{"droiddeck":{"options":{"baseURL":"http://a/v1"}}}}""", config.readText()) + assertEquals(setOf("droiddeck"), OpenCode.keys(root)) } - @Test fun signInIsTheKeyOrTheFreeMark() { + @Test fun aCustomServerBecomesAProviderWithTheModelsItLists() { + val root = Files.createTempDirectory("rootfs").toFile() + val config = File(root, "root/.config/opencode/opencode.json").apply { parentFile!!.mkdirs() } + config.writeText("""{"theme":"tokyonight","provider":{"mine":{"npm":"x"}}}""") + val asked = mutableListOf>() + OpenCode.saveKey(root, provider("droiddeck"), "", "192.168.1.20:11434/") { url, key -> + asked += url to key + """{"object":"list","data":[{"id":"qwen3:8b"},{"id":"gpt-oss:20b"},{"id":"qwen3:8b"}]}""" + } + assertEquals(listOf("http://192.168.1.20:11434/v1/models" to null), asked) + val saved = JSONObject(config.readText()) + assertEquals("tokyonight", saved.getString("theme")) + assertTrue(saved.getJSONObject("provider").has("mine")) + val custom = saved.getJSONObject("provider").getJSONObject("droiddeck") + assertEquals("@ai-sdk/openai-compatible", custom.getString("npm")) + assertEquals("192.168.1.20", custom.getString("name")) + assertEquals("http://192.168.1.20:11434/v1", custom.getJSONObject("options").getString("baseURL")) + assertEquals(setOf("qwen3:8b", "gpt-oss:20b"), custom.getJSONObject("models").keys().asSequence().toSet()) + assertEquals(setOf("droiddeck"), OpenCode.keys(root)) + assertFalse(JSONObject(File(root, "root/.local/share/opencode/auth.json").readText()).has("droiddeck")) + + OpenCode.saveKey(root, provider("droiddeck"), "sk-lan", "https://llm.example/api/v1") { url, key -> asked += url to key; """{"data":[{"id":"m"}]}""" } + assertEquals("https://llm.example/api/v1/models" to "sk-lan", asked.last()) + assertEquals("sk-lan", JSONObject(File(root, "root/.local/share/opencode/auth.json").readText()).getJSONObject("droiddeck").getString("key")) + + OpenCode.removeKey(root, provider("droiddeck")) + assertEquals(emptySet(), OpenCode.keys(root)) + assertTrue(JSONObject(config.readText()).getJSONObject("provider").has("mine")) + } + + @Test fun modelIdsSkipWhatTheUserlandPrintsFirst() { + assertEquals(listOf("m"), OpenCode.modelIds("proot warning: can't sanitize binding \"/proc/self/fd/1\"\n{\"data\":[{\"id\":\"m\"}]}\n")) + assertEquals(emptyList(), OpenCode.modelIds("curl: (7) Failed to connect")) + } + + @Test fun aFailedKeyWritePutsTheServerConfigBack() { + val root = Files.createTempDirectory("rootfs").toFile() + val config = File(root, "root/.config/opencode/opencode.json").apply { parentFile!!.mkdirs() } + val previous = """{"provider":{"droiddeck":{"options":{"baseURL":"http://a/v1"}}}}""" + config.writeText(previous) + // A folder where the key file's temporary copy goes makes that write fail after the config is written. + File(root, "root/.local/share/opencode/.auth.json.tmp").mkdirs() + assertTrue(runCatching { OpenCode.saveKey(root, provider("droiddeck"), "k", "b:1") { _, _ -> """{"data":[{"id":"m"}]}""" } }.isFailure) + assertEquals(previous, config.readText()) + assertFalse(File(root, "root/.config/opencode/.opencode.json.tmp").exists()) + + config.delete() + File(root, "root/.local/share/opencode/.auth.json.tmp").mkdirs() + assertTrue(runCatching { OpenCode.saveKey(root, provider("droiddeck"), "k", "b:1") { _, _ -> """{"data":[{"id":"m"}]}""" } }.isFailure) + assertFalse(config.exists()) + } + + @Test fun aServerWithoutModelsIsNotSaved() { + val root = Files.createTempDirectory("rootfs").toFile() + val error = runCatching { OpenCode.saveKey(root, provider("droiddeck"), "", "localhost:1234") { _, _ -> """{"data":[]}""" } }.exceptionOrNull() + assertEquals("No models at http://localhost:1234/v1", error?.message) + assertFalse(File(root, "root/.config/opencode/opencode.json").exists()) + } + + @Test fun providerModelsAreLabelledWithTheProvider() { + val (models, _) = OpenCode.listModels(""" + ollama-cloud/gpt-oss:120b + { + "providerID": "ollama-cloud", + "name": "gpt-oss:120b" + } + droiddeck/qwen3:8b + { + "providerID": "droiddeck", + "name": "qwen3:8b" + } + """.trimIndent()) + assertEquals(listOf(AgentHarness.Model("ollama-cloud/gpt-oss:120b", "gpt-oss:120b · Ollama Cloud"), AgentHarness.Model("droiddeck/qwen3:8b", "qwen3:8b")), models) + } + + @Test fun signInIsAKeyTheFreeMarkOrACustomServer() { val probe = OpenCode.signedIn.last() assertTrue(probe.contains("/root/.local/share/opencode/auth.json")) assertTrue(probe.contains("[ -e /root/.config/opencode/.droiddeck-free ]")) + assertTrue(probe.contains("grep -q '\"droiddeck\"' /root/.config/opencode/opencode.json")) assertTrue(probe.contains("models --verbose > /root/.cache/droiddeck/opencode-models.$$")) assertEquals(listOf("/root/.local/bin/android-open", "https://opencode.ai/auth"), OpenCode.signIn) } diff --git a/app/src/test/java/com/droiddeck/launcher/session/GameEnvironmentStoreTest.kt b/app/src/test/java/com/droiddeck/launcher/session/GameEnvironmentStoreTest.kt index 3cae943151..273d91d1d9 100644 --- a/app/src/test/java/com/droiddeck/launcher/session/GameEnvironmentStoreTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/session/GameEnvironmentStoreTest.kt @@ -323,4 +323,19 @@ class GameEnvironmentStoreTest { assertEquals(mapOf("DD_SYNC" to "1", "DXVK_HUD" to "fps"), config.shared) assertEquals(mapOf("DD_FSYNC_FIRST" to "1", "DD_SYNC_FALLBACK" to "1"), config.games["440"]) } + + @Test fun unreadableSettingsAreSetAsideAndSessionsStillStart() { + val settings = File(context.filesDir, "game-environment.json") + val aside = File(context.filesDir, "game-environment.json.unreadable") + aside.delete() + for (broken in listOf("", """{"version":1,"shared":{"bad name":"1"}}""")) { + settings.writeText(broken) + assertEquals(GameEnvironment.Config(), GameEnvironmentStore.read(context)) + assertFalse(settings.exists()) + assertEquals(broken, aside.readText()) + } + GameEnvironmentStore.publish(context) + assertEquals(1, JSONObject(guest.readText()).getInt("version")) + aside.delete() + } } diff --git a/app/src/test/java/com/droiddeck/launcher/session/SessionDisplayTest.kt b/app/src/test/java/com/droiddeck/launcher/session/SessionDisplayTest.kt index 7f3eec4092..1835b6b85d 100644 --- a/app/src/test/java/com/droiddeck/launcher/session/SessionDisplayTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/session/SessionDisplayTest.kt @@ -178,7 +178,7 @@ class SessionDisplayTest { @Test fun removedFilterAliasesRetainTheirEquivalentBehavior() { assertEquals(0, SessionPrefs.canonicalUpscaler(1)) assertEquals(4, SessionPrefs.canonicalUpscaler(5)) - assertEquals(0, SessionPrefs.canonicalUpscaler(99)) + assertEquals(2, SessionPrefs.canonicalUpscaler(99)) assertFalse(SessionPrefs.upscalerHasSharpness(0)) assertFalse(SessionPrefs.upscalerHasSharpness(1)) assertFalse(SessionPrefs.upscalerHasSharpness(2)) diff --git a/app/src/test/java/com/droiddeck/launcher/session/StoresTabOrderTest.kt b/app/src/test/java/com/droiddeck/launcher/session/StoresTabOrderTest.kt new file mode 100644 index 0000000000..23e340d3b4 --- /dev/null +++ b/app/src/test/java/com/droiddeck/launcher/session/StoresTabOrderTest.kt @@ -0,0 +1,45 @@ +package com.droiddeck.launcher.session + +import com.droiddeck.launcher.stores.Store +import com.droiddeck.launcher.stores.arrangeStoreTabs +import org.junit.Assert.assertEquals +import org.junit.Assert.assertFalse +import org.junit.Assert.assertTrue +import org.junit.Test +import org.junit.runner.RunWith +import org.robolectric.RobolectricTestRunner +import org.robolectric.RuntimeEnvironment +import org.robolectric.annotation.Config + +@RunWith(RobolectricTestRunner::class) +@Config(sdk = [33]) +class StoresTabOrderTest { + private val app get() = RuntimeEnvironment.getApplication() + private val defaults = Store.entries.map { it.id } + private fun shown() = arrangeStoreTabs(SessionPrefs.storesTabOrder(app), emptySet()).map { it.store.id } + + @Test + fun anOldDefaultOrderMovesToTheCurrentOne() { + SessionPrefs.setStoresTabOrder(app, listOf("gog", "epic", "amazon", "xbox", "itch", "gamejolt", "battlenet", "ubisoft", "ea", "rockstar")) + SessionPrefs.settleStoresTabOrder(app, defaults) + assertEquals(defaults, shown()) + assertFalse(SessionPrefs.storesTabOrderCustomized(app)) + } + + @Test + fun aSavedCurrentDefaultIsNotMistakenForTheUsersOwn() { + SessionPrefs.setStoresTabOrder(app, defaults) + repeat(2) { SessionPrefs.settleStoresTabOrder(app, defaults) } + assertFalse(SessionPrefs.storesTabOrderCustomized(app)) + assertTrue(SessionPrefs.storesTabOrder(app).isEmpty()) + } + + @Test + fun anArrangedOrderIsKept() { + val mine = defaults.reversed() + SessionPrefs.setStoresTabOrder(app, mine) + SessionPrefs.settleStoresTabOrder(app, defaults) + assertTrue(SessionPrefs.storesTabOrderCustomized(app)) + assertEquals(mine, shown()) + } +} diff --git a/app/src/test/java/com/droiddeck/launcher/stores/xbox/XboxLaunchViewsTest.kt b/app/src/test/java/com/droiddeck/launcher/stores/xbox/XboxLaunchViewsTest.kt index f14d294c01..145cb45e66 100644 --- a/app/src/test/java/com/droiddeck/launcher/stores/xbox/XboxLaunchViewsTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/stores/xbox/XboxLaunchViewsTest.kt @@ -50,4 +50,15 @@ class XboxLaunchViewsTest { assertEquals("preserve", evidence.readText()) } finally { root.deleteRecursively() } } + + @Test fun viewsKeepTheFilesPathTheGuestBinds() { + val root = Files.createTempDirectory("xbox-view-alias").toFile() + try { + val real = root.resolve("data/data/app/files").apply { mkdirs() } + val alias = root.resolve("user0").also { Files.createSymbolicLink(it.toPath(), real.parentFile!!.toPath()) }.resolve("files") + val view = XboxLaunchViews().create(alias) + assertEquals(alias.resolve("xbox-runtime/views").path, view.parentFile!!.path) + assertTrue(real.resolve("xbox-runtime/views").resolve(view.name).isDirectory) + } finally { root.deleteRecursively() } + } } diff --git a/app/src/test/java/com/droiddeck/launcher/ui/NavTabsTest.kt b/app/src/test/java/com/droiddeck/launcher/ui/NavTabsTest.kt index cfccd63168..1736382512 100644 --- a/app/src/test/java/com/droiddeck/launcher/ui/NavTabsTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/ui/NavTabsTest.kt @@ -37,29 +37,60 @@ class NavTabsTest { @Before @After fun reset() { ctx.getSharedPreferences("session", Context.MODE_PRIVATE).edit().clear().commit() NavTabs.load(ctx) - com.droiddeck.launcher.agent.AgentTab.load(ctx) } - @Test fun musicStartsInMore() { - assertEquals(listOf("steam", "games", "stores", "downloads", "desktop", "components", "setup", "updates", NavTabs.MORE), navigationKeys(state())) - assertEquals(listOf("soundtracks", "storage", "sync"), NavTabs.more(state())) - assertEquals(setOf("soundtracks", "agent", "storage", "sync"), NavTabs.shelved) + @Test fun aFreshInstallShowsTheDefaultBarMoreAndHiddenTabs() { + assertEquals(listOf("steam", "desktop", "games", "downloads", "setup", "updates", NavTabs.MORE), navigationKeys(state())) + assertEquals(listOf("stores", "soundtracks", "components", "storage", "sync"), NavTabs.more(state())) + assertEquals(TabPlace.HIDDEN, NavTabs.place(state(), "android-apps")) + assertEquals(TabPlace.HIDDEN, NavTabs.place(state(), "agent")) assertFalse(com.droiddeck.launcher.agent.AgentTab.shown) + assertTrue(NavTabs.isDefault()) } @Test fun showingMusicOnceKeepsItShownAfterReload() { place("soundtracks", TabPlace.BAR) NavTabs.load(ctx) - assertEquals(listOf("steam", "games", "soundtracks", "stores", "downloads", "desktop", "components", "setup", "updates", NavTabs.MORE), navigationKeys(state())) + assertEquals(listOf("steam", "desktop", "games", "downloads", "setup", "updates", "soundtracks", NavTabs.MORE), navigationKeys(state())) } @Test fun shelvedTabsLeaveTheBarAndAddMoreAtTheEnd() { - place("stores", TabPlace.MORE) - place("components", TabPlace.MORE) + place("desktop", TabPlace.MORE) val s = state() - assertEquals(listOf("components", "soundtracks", "stores", "storage", "sync"), NavTabs.more(s)) + assertEquals(listOf("desktop", "stores", "soundtracks", "components", "storage", "sync"), NavTabs.more(s)) assertEquals(NavTabs.MORE, navigationKeys(s).last()) - assertFalse("stores" in navigationKeys(s)) + assertFalse("desktop" in navigationKeys(s)) + } + + @Test fun appsAndTheDevHarnessCanBeShownWithoutHomeScreenOrDeveloperTools() { + place("android-apps", TabPlace.MORE) + assertTrue("android-apps" in NavTabs.more(state())) + place("agent", TabPlace.BAR) + assertTrue(com.droiddeck.launcher.agent.AgentTab.shown) + } + + @Test fun resettingPutsBackTheDefaultLayout() { + place("stores", TabPlace.BAR) + place("updates", TabPlace.HIDDEN) + moveTab("downloads", -1) + assertFalse(NavTabs.isDefault()) + NavTabs.reset(ctx) + NavTabs.load(ctx) + assertTrue(NavTabs.isDefault()) + assertEquals(listOf("steam", "desktop", "games", "downloads", "setup", "updates", NavTabs.MORE), navigationKeys(state())) + } + + @Test fun anOldLayoutKeepsWhatItsSwitchesShowed() { + ctx.getSharedPreferences("session", Context.MODE_PRIVATE).edit().clear() + .putBoolean("gameStoresEnabled", false).putBoolean("soundtracksEnabled", false).commit() + NavTabs.load(ctx) + val s = state() + assertEquals(listOf("steam", "games", "desktop", "components", "setup", "updates", NavTabs.MORE), navigationKeys(s)) + assertEquals(listOf("storage", "sync"), NavTabs.more(s)) + listOf("stores", "downloads", "soundtracks", "android-apps", "agent").forEach { assertEquals(it, TabPlace.HIDDEN, NavTabs.place(s, it)) } + val prefs = ctx.getSharedPreferences("session", Context.MODE_PRIVATE) + assertFalse(prefs.contains("gameStoresEnabled")) + assertFalse(prefs.contains("soundtracksEnabled")) } @Test fun hiddenTabsAreNowhereAndSetupCannotBeHidden() { @@ -71,23 +102,26 @@ class NavTabsTest { assertTrue("setup" in navigationKeys(s)) } - @Test fun disabledStoresFeatureReadsAsHidden() { - assertEquals(TabPlace.HIDDEN, NavTabs.place(state(storesOn = false), "stores")) - assertEquals(TabPlace.HIDDEN, NavTabs.place(state(storesOn = false), "downloads")) + @Test fun storesAndMusicHideLikeAnyOtherTab() { + place("stores", TabPlace.HIDDEN) + place("soundtracks", TabPlace.HIDDEN) + assertEquals(TabPlace.HIDDEN, NavTabs.place(state(), "stores")) + assertEquals(TabPlace.MORE, NavTabs.place(state(), "components")) + assertEquals(TabPlace.BAR, NavTabs.place(state(), "downloads")) + assertEquals(listOf("components", "storage", "sync"), NavTabs.more(state())) } @Test fun movingSwapsWithTheNextVisibleTabAndPersists() { - place("soundtracks", TabPlace.BAR) - moveTab("stores", -1) - assertEquals(listOf("steam", "games", "stores", "soundtracks"), navigationKeys(state()).take(4)) + moveTab("games", -1) + assertEquals(listOf("steam", "games", "desktop", "downloads"), navigationKeys(state()).take(4)) NavTabs.load(ctx) - assertEquals(listOf("steam", "games", "stores", "soundtracks"), navigationKeys(state()).take(4)) + assertEquals(listOf("steam", "games", "desktop", "downloads"), navigationKeys(state()).take(4)) } @Test fun tabsMissingFromASavedOrderSlotInAfterTheirDefaultNeighbour() { - assertEquals(listOf("updates", "steam", "games", "soundtracks", "stores", "downloads", "desktop", "agent", "components", "android-apps", "storage", "sync", "setup"), + assertEquals(listOf("updates", "stores", "soundtracks", "components", "storage", "sync", "android-apps", "agent", "steam", "desktop", "games", "downloads", "setup"), NavTabs.arrange(listOf("updates", "steam"))) - assertEquals(listOf("games", "soundtracks", "steam", "setup", "stores", "downloads", "desktop", "agent", "components", "android-apps", "storage", "sync", "updates"), + assertEquals(listOf("games", "downloads", "steam", "setup", "stores", "soundtracks", "desktop", "components", "storage", "sync", "android-apps", "agent", "updates"), NavTabs.arrange(listOf("games", "steam", "setup", "stores", "desktop", "components", "android-apps", "updates", "bogus"))) } @@ -172,7 +206,7 @@ class NavTabsTest { compose.setContent { DroidDeckTheme { FrontEndScreen(state(), actions(), page = null) } } compose.mainClock.advanceTimeBy(2_000) compose.onNode(hasText(ctx.getString(com.droiddeck.launcher.R.string.content_page_gone))).assertDoesNotExist() - compose.onNode(hasTestTag("rail-games") and androidx.compose.ui.test.isSelected()).assertExists() + compose.onNode(hasTestTag("rail-desktop") and androidx.compose.ui.test.isSelected()).assertExists() } @Test fun setupListMovesATabAcrossTheMoreLineWithTheControllerAndHidesWithItsSwitch() { @@ -216,11 +250,11 @@ class NavTabsTest { private fun hasParentTag(tag: String) = androidx.compose.ui.test.hasAnyAncestor(hasTestTag(tag)) - private fun state(storesOn: Boolean = true, downloads: Int = 0, setupReady: Boolean = true) = FrontEndState( + private fun state(downloads: Int = 0, setupReady: Boolean = true) = FrontEndState( installed = "r9", ready = setupReady, available = null, busy = false, stage = "", percent = -1, desktopInstalled = true, offlineAccount = null, offline = false, frameGenLabel = "", romsDir = null, logsEnabled = false, steamGames = emptyList(), emulators = emptyList(), running = null, - gameStoresEnabled = storesOn, storeDownloadsActive = downloads, + storeDownloadsActive = downloads, ) private fun actions() = FrontEndActions( diff --git a/app/src/test/java/com/droiddeck/launcher/ui/PortraitLayoutTest.kt b/app/src/test/java/com/droiddeck/launcher/ui/PortraitLayoutTest.kt index 25ba697759..1f6a4b7073 100644 --- a/app/src/test/java/com/droiddeck/launcher/ui/PortraitLayoutTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/ui/PortraitLayoutTest.kt @@ -75,6 +75,11 @@ class PortraitLayoutTest { } @Test fun narrowBottomBarScrollsToEveryDestinationWithAppsAndResumeVisible() { + val ctx = androidx.test.core.app.ApplicationProvider.getApplicationContext() + NavTabs.reset(ctx) + NavTabs.setHidden(ctx, "android-apps", false) + val all = NavTabs.listed(stateWithAppsAndSession).filter { NavTabs.place(stateWithAppsAndSession, it) != TabPlace.HIDDEN } + NavTabs.rearrange(ctx, stateWithAppsAndSession, all, emptyList()) val selected = mutableStateOf("steam") compose.setContent { DroidDeckTheme { @@ -82,7 +87,7 @@ class PortraitLayoutTest { } } compose.mainClock.advanceTimeBy(1_000) - for (key in listOf("games", "stores", "desktop", "components", "android-apps", "setup", "updates", "steam")) { + for (key in all.drop(1) + all.first()) { compose.onNodeWithTag("rail-$key").performScrollTo() compose.mainClock.advanceTimeBy(1_000) compose.onNodeWithTag("rail-$key").assertIsDisplayed().performClick() @@ -91,6 +96,7 @@ class PortraitLayoutTest { compose.onNodeWithTag("rail-$key").assertIsSelected().assertHeightIsAtLeast(48.dp).assertWidthIsAtLeast(48.dp) } compose.onNodeWithContentDescription("Resume Steam").assertIsDisplayed() + NavTabs.reset(ctx) } @Test fun bottomBarFollowsSidebarLabelsSetting() { diff --git a/tools/components/preloads.lock.json b/tools/components/preloads.lock.json index fdb5640b21..37e2319dad 100644 --- a/tools/components/preloads.lock.json +++ b/tools/components/preloads.lock.json @@ -1,121 +1,168 @@ { - "archive_sha256": "cb6487a94f25a3068fd07958174eb5b5e14f709655ff4ef0a8cdbd99138513b2", - "arm64_recipe": "1c92a1b0669277de3e78e9f292634affb5b5a19d5ea49d3ad8610c1dc638c2fb", + "archive_sha256": "2d1f53c795615e7066a47ad26c791397d830bb8b028e9c89f9f809eaeebd3fae", + "arm64_recipe": "d89e4bbf9533840a44d77c52a392cdce242822b1e80293ea4de26d2f06a09698", "groups": { "arm64": { - "@runner": "84f825635599f81ed33f62c5fc4c73f66044d1468b060d65f83855eb9c8bfe77", + "@runner": "37a91043149e9747985b419002d87ff4df41ec6def4169e0ef16711d7261dbf2", "app/src/main/cpp/adrenotools/src/hook/kgsl.h": "396c56761034a4ed783543ee3312c6ec64d63b2a1cf7eecf1939c23251f25adf", - "app/src/main/cpp/fakeinput_steam.cpp": "3d11e859ca58a42a9da92a3fc589d404df790e151f7e18ea6114645750e70ef5", - "app/src/main/cpp/venc/venc_proto.h": "2242ddbc8981d14a33bac70264bb3e7f701fd1c3ebb988e17bbb2b19b6b808f7", + "app/src/main/cpp/fakeinput_steam.cpp": "e1377f9d7cd8539a9a327e2851b04c8e05e931f8b5ee554fa4f36d4b17f96718", + "app/src/main/cpp/venc/venc_proto.h": "57636af2644b36ea101cd09de42c423e864a612160561239ceda77ce888d5370", "tools/linuxfs/clipboard/clipboard.c": "96291c2bbc040c83caabf059ab3e95a9ed90d6a768c759d7cb4c0b64706bddfa", - "tools/linuxfs/preload/binfmt.c": "0933cc49cb53f0aa1206e2eae516d38dc3337e74174be07e10619c42aa56792b", - "tools/linuxfs/preload/dircache.c": "8e7f19ea4a1198783d53a3f357326c6177da157b0cc7e0d22e1670963e1c26e7", - "tools/linuxfs/preload/drm.c": "e0eabab0d8ed9e841918e827bf87168efa7f2dfb8404169e9bed3ab5eda2836c", - "tools/linuxfs/preload/fsync.c": "795c114c2a05d3f250d07145d04c5658091699da3b96290da36348ccadfb0c09", - "tools/linuxfs/preload/inputudev.c": "2648248d3d235a582eb8459709e0a85de537c03ac10c5040fbfb50d9846c68eb", - "tools/linuxfs/preload/kgslid.c": "88a7875fd5289930204d155d92ac9d15492cd06db16ed87aa9c95af37f3e7089", - "tools/linuxfs/preload/kgslpoll.c": "f0d853d919a52487c04cbda5fb3fa22269da54b7f4ee2f7dd3b5bd9909418670", - "tools/linuxfs/preload/links.c": "b7bbcf9112393b152f358fe6f8dc9a1955f0c8532e1eddf016a971415cd13c64", - "tools/linuxfs/preload/lock.c": "f71b3fd40e6a2b74908d3cdc601e8748699ae9c7a89b542d2445b999015ffd66", - "tools/linuxfs/preload/net.c": "335853c8ea0e9a8ebbc5a5500dc4bded9c34c4310a6ab8aa46b07d5ce1c2b55e", - "tools/linuxfs/preload/netif.c": "cc26d50b8d4639d8dd4697811bbf85c9d9f31761f9504a4af42473de3cb22b3c", - "tools/linuxfs/preload/noexec.c": "1855aeaeda3d506329bd9af1107580c74d1f56787c411b2e01c0a8a9d4059c7b", - "tools/linuxfs/preload/ntsync.c": "0614c48af0c062bfcb4c30141efe1b792b340767a67d2fe92ee9877d2ba16e0d", - "tools/linuxfs/preload/opens.c": "92ae4aea16aa457a898dedf4a70eb332d80d3b1e77f3a60bace7715a4317399e", - "tools/linuxfs/preload/pathcache.c": "eb0d4b5238fe6c8891e805d90bd837e466754100c978fad2d0ff717116b9b8a3", - "tools/linuxfs/preload/perms.c": "f600619c4ca130f69001ed7ad7bd74a3dc215b14c61479c45bb770f916d244b9", - "tools/linuxfs/preload/pulseguard.c": "57674ea40283e53a27bc78362de1ba41ee972d172ea38b1f818b1d6eed0abe65", + "tools/linuxfs/preload/binfmt.c": "45e820cdd75f2bd42710d98a4d5fee7398b667c9793ee94d8b8b7c4f29f4380c", + "tools/linuxfs/preload/clockpause.c": "5c8cbe1303e3b5fce97b000a952ab15691c0b56dc874e4a963f0e7888ce3f2c7", + "tools/linuxfs/preload/descriptor.c": "673b1cd0a5cd287a572e67aa60c2c36d1bc90ccac4f73ad0a783d4d2e2e5df07", + "tools/linuxfs/preload/dircache.c": "09d3dee98e49ef85b8e8112acb6a2b3d8b980eac80f07b3c82785e567f0606a6", + "tools/linuxfs/preload/drm.c": "9c9b9deab902276ee23a08a98730b2c6adbf7ea6d61e1e73d2a2e7c7016b1335", + "tools/linuxfs/preload/fsync.c": "f2f5fd3197d536d9396dd3d69837f6a2b0b4ff9aaffdb6f55b200408aaf5793d", + "tools/linuxfs/preload/inputudev.c": "76d7f720cd9531d8d38c2977956bf764b0db6055cb56aa35493476a244d9a22e", + "tools/linuxfs/preload/kgslid.c": "1a9639606ece49c5aff74baa5b9ef0921ec5dbc321d19d3f59184e4456f324a4", + "tools/linuxfs/preload/kgslpoll.c": "d03c09e0c82f76716dcc1f3ca77e718c60929bedf221ea5dae8ab43f5ab3e3f3", + "tools/linuxfs/preload/links.c": "c5761d450e070de912fbc9c71562d3fbf54775b484ea0fa57ded2e0c0771f7cf", + "tools/linuxfs/preload/lock.c": "1fcfefe28ef49ccd73f13b69ceb576492101cd1ddb88f08e0c73646ddeb327f2", + "tools/linuxfs/preload/net.c": "0645013df15656573d484bf6f8e6d8657beb228c779ae1143c0874e12559bf3e", + "tools/linuxfs/preload/netif.c": "cf6568ce8ffea44f24a8443160d86e4efddcdb964c908532935cbc4c4570ca91", + "tools/linuxfs/preload/noexec.c": "12f5245a893f9044558270cb03cfb7020546bfe3e90a9264b33d3f818dd30433", + "tools/linuxfs/preload/ntsync.c": "acffede0324fc89ac91f8181c2df23e6f39459a4db678a44ce9e65e0f282418c", + "tools/linuxfs/preload/oomadj.c": "d84d552a24ec3467e7ba5cf92a384521dfbcf1fc9a97e899b7b18d20bf1b45d5", + "tools/linuxfs/preload/opens.c": "2ba8f056ae0f2ab87a3d58ca0926b09af67deb1e24048506117bc26601e249c6", + "tools/linuxfs/preload/owner.c": "746d0a1834d0e19f7d9adfad72a6080a1104610f98c1d61e14d2c3a91a9eb04d", + "tools/linuxfs/preload/pathcache.c": "7d8287736f8f1988738d233c002ff6e00127c98034fcd35c2bb63a84c04b85a3", + "tools/linuxfs/preload/perms.c": "5ffa0ce5ff8269fc567dc5581bec380dcf2c90b9fb178c8dbae747e61430608f", + "tools/linuxfs/preload/pulseguard.c": "a91a0d5c745ea32ad52d57010a8b3cf7171bc4a3d2f73b870c64a6a62b233b56", "tools/linuxfs/preload/quest_kgsl.c": "59d9b8416be6a1c680f1d1e4c2427d2cbb7b415344261adb357d9d211ec95cfe", - "tools/linuxfs/preload/robust.c": "9eb6c0ed50e0f48a8cfb86bd92587f471354bdf2531b9177f4b3ab83bdfed39a", - "tools/linuxfs/preload/rptouch.c": "0e3f8bf2f9a41324361f38fa4da8d2d47593c9555f0cabf8228767397846c7c3", - "tools/linuxfs/preload/space.c": "118389bcc89dfa2b4230b80915e21d2d4331c4cff1f5a58265f85e6ecb5c29d2", - "tools/linuxfs/preload/storage.c": "08a8b46c3588f3160bb8608489768010ec36d5ccdb2b25a431ec9d6fcd413a6e", - "tools/linuxfs/preload/sysv.c": "49774ee5e2e39b84dcfadf63abdc741b3df236cb11783744a1280adee36965e8", + "tools/linuxfs/preload/robust.c": "02cd25316912c79897e2c5a1ed44b059b815d36bc62ba8d4691f718eeae92947", + "tools/linuxfs/preload/rptouch.c": "fc6db7e4b9432a7361e805a9a2dd134f9f3ec4ffba7927ab4b2c7b6bd2a22644", + "tools/linuxfs/preload/space.c": "9258ec8a8f8d87f2629b753d1838a09000110d936103284a04134b8cbed024d3", + "tools/linuxfs/preload/storage.c": "5c0dc4e5901e8cc32cdf241e38e3d5dcd3dae8b8ca94579f633754c8eadd617b", + "tools/linuxfs/preload/subreaper.c": "6f3830c0368a768bd0d367fa94345e6e4725875acc9662cf3690f1c5f28bf71c", + "tools/linuxfs/preload/sysv.c": "893dfad1db964eb1f79af94978b4af8b87279b85c30a4d589b5844cded476ed3", "tools/linuxfs/preload/tracefs.c": "be3f8a2f032b56e6e08a931e77a9386aea4bb93421a482271e06386ec0c469b6", - "tools/linuxfs/preload/tracer.c": "f34e5377c891b0a8d00489245d66f96bc352df4cd90f47a951dcadae980af4c1", - "tools/linuxfs/preload/udevmon.c": "2045dfb883cfb6e2016c359a3dc3af17f3b8f383f6dd0d5dfee407ef0d344852", - "tools/linuxfs/preload/usr2.c": "6ae704380b45a9b3a74c4fe2b3ce4482470dae59ced26cf0aee64f4b4dcc11f9", - "tools/linuxfs/preload/venc.c": "24c3c46fe49d28adfc8c977e52c9cc407f534b26f56d94b3425b8bb01803dba8", + "tools/linuxfs/preload/tracer.c": "4b5481ea91a475bb6ac16a7ba63e371f0a850a17adac5399302a610c0a57ec0a", + "tools/linuxfs/preload/udevmon.c": "4d5f07f2521af702b3f2adda3c93a39873f87c0946de007bca8b1fe6699596fa", + "tools/linuxfs/preload/usr2.c": "4b4044da1ddf07d12bafeb893c257679e26a5ea2f58e6cc0d715f27b931e7b1e", + "tools/linuxfs/preload/vdec.c": "a7b2d0754067493cde1929846f7b2c9692c4dde96ee273a92c81ac65470fac50", + "tools/linuxfs/preload/venc.c": "7fda60f013736d98dab734a9344e0f1d527dc3d976a71f5ccd4a0bc17d9f346f", + "tools/linuxfs/preload/venus.c": "d4af5c3532d4c7d9891b75cd5a137252e791beafe319b9fd976be123f7b80403", "tools/linuxfs/preload/vmwrite.c": "1a3ea2ec4354e0716c17f7db537b19ab82bcd524f2aece2fa5dec89b076a2188", - "tools/linuxfs/preload/webhelper.c": "a8213a7a96b407459c83fb93365cfe58fd05964e7bb262b8061c1c0792a6aac8", - "tools/linuxfs/preload/writewatch.c": "61e395d1caa184d329dead0e36c4e92cb1069b1154ac36581f37406c1c242240", - "tools/linuxfs/preload/xmode.c": "9a09995bf52d40b07f16828bcc545b59b8fb1ba60d9cb09f14f7f31dba1e65a6", - "tools/linuxfs/preload/zram.c": "12bcf07459728d4a7ede6fa0fea8deb330f7c5d0f0dd61e610e81b9efecd4262", + "tools/linuxfs/preload/webhelper.c": "bec759f908fb7c52238a7b72d3888aac6187aaec2378c190749ab8a5f7f1d81a", + "tools/linuxfs/preload/writewatch.c": "285ed7e627dc9349dd3ae45e8c1ffeaf4c56970b9eac5046754e348b4587dd6b", + "tools/linuxfs/preload/xmode.c": "3b6e36b29795544fdc0299822049b1890a7612578051d2a8982485c263dcf259", + "tools/linuxfs/preload/zram.c": "60b8c9fbd96adcc2026e48c651948d592f06017ff679e4775b1752be26525a2e", "tools/linuxfs/ssbs/ssbs_adapter.c": "9e4e0fe637f7b8f91f12d8151f02e8d31bcb4294be2b2c62d3cd3ce76f200306", + "tools/nativeguest/LICENSE": "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30", + "tools/nativeguest/app-seccomp-dump.c": "b5bfb92de5d64fa286b5a1cf3f4f71687817fc093cf698c65ffb2a5c575ce809", + "tools/nativeguest/build-gosys.sh": "34877be3fdbf7cf74f1dc19fbe708d428b135e65caf92a8ad0cbc7772ad699c7", + "tools/nativeguest/build.sh": "5aad4e82e293a2b47f461434dd6b024360d3b4356dadabc28b2fcc08220103be", + "tools/nativeguest/ddnatv-hook.c": "65451173bedbc332668f25b6589ca54d0a4c2d7edfaeb48f69ce00632b5d968b", + "tools/nativeguest/gosys/gosys.c": "a7808741af5fcaede7260f743b482612a7b2a818e207514bab667d06ca82f4d4", + "tools/nativeguest/gosys/gosys.ld": "dd4de106e3f9429a9373f8ed512537ed5b4927efc368ce3b8364776be435fb80", + "tools/nativeguest/gosys/gosys_abi.h": "8c246268e0645a7148bc2ad9f0c1d6147e0a3bc0c7625956be9afc018c58ada0", + "tools/nativeguest/hook/env.c": "ed84ca5c1f9704eba140263123f0b1876d1e2daee7b92d444f06edab3246f327", + "tools/nativeguest/hook/exec.c": "69111bf9a9ebaf56f59825c99fa16078f53ba708e8816e2c9bd02aff909149f5", + "tools/nativeguest/hook/exec_probe.c": "539ba604469d0a7fcc1677709bc56386ac92de4ba07fe80fda10f4cd85bf6d1a", + "tools/nativeguest/hook/fileops.c": "10bde17100bc2d7ed44f8921b16472309bb108b6f77371aaa3036d0737867706", + "tools/nativeguest/hook/files.c": "be6affd0bdf55e4759b5ba5edbbd280b47bae74013d790c0132474e8aca9abeb", + "tools/nativeguest/hook/go_programs.c": "418340c66a1d9fd5b492fff8b22d929ca3b4ef672ba73968c0d0ca5a4e9f3937", + "tools/nativeguest/hook/hardlinks.c": "eae44472aaefb9c24854610acfe16b221081a8bdc39bc63f8c957292ddced6ed", + "tools/nativeguest/hook/identity.c": "89f1632f00b141c568e8dbc0226039d3f6d9bd0752ff337e343cac2cb3a60705", + "tools/nativeguest/hook/net.c": "ec62f2bf9bb1eb15b7947d577a6cdde67dcce21bdaf217fd74c00ceb78e4f471", + "tools/nativeguest/hook/paths.c": "7d3098f944c6c13621eb4295df3ecb06350fc61381e4b92070764d66d8c85354", + "tools/nativeguest/hook/posix_shm.c": "0bb3782c538723051d51d147d35a9f5b37872b2a6ffa49d3059264539533d0f7", + "tools/nativeguest/hook/privileged.c": "d1acc6faca83f9b7a1a4d5a07fe19d73d139f8f9f3ec6215347c6ec7088f1819", + "tools/nativeguest/hook/setup.c": "2a3baa4ecc9fe39ff96e920a5e49e8b94fe432c63cc3fecd8badf40003a67ffc", + "tools/nativeguest/hook/signals.c": "b9e3646c3376150d64afff81a1e3f40a7ef5662de6b2b01d15f1bb8f2c5ecdf9", + "tools/nativeguest/hook/sockets.c": "6e221ca047351e67b2a0a4611d9782b60f7f309309b83a46406cf371becc2f40", + "tools/nativeguest/hook/static_programs.c": "f53db68d18240d1bbf92cf7ecabfb207861bbf563785516be3325bc9c511e629", + "tools/nativeguest/hook/syscalls.c": "1e6e7e44e2a49ac768aaf55661748a4ce703c06bab6dbe1ce25c5de80f416053", + "tools/nativeguest/hook/sysv_shm.c": "1ef54c48aa25d827494502c913423612f270767a6343435fbc5868ad927b5ed1", + "tools/nativeguest/seccomp-sim.c": "261d8ef8364f05a45acc43767eab22057357f056558b69835a0198d5bae3d9b8", "tools/proot/fastpath/audit.c": "bfe347a2ddaceef40a78d7d590e4e679724ee4c82f3f1f1e3c7017a18ad536d4", - "tools/proot/fastpath/fastpath.c": "4cd07b25ba14f6faa6bac5091ae323ded6b646dbb34b9e5a92ea6385e4d37cb5", - "tools/quest/kgsl_compat.c": "111afffda7a6df2469610f6c342ae086b1a97a559c586efc4a28015b86efd6bd", + "tools/proot/fastpath/fastpath.c": "8fe165886b0462b912507636592462599f4657b4c2c56723968b8f95981dd05e", + "tools/proot/fastpath/svc-cache.h": "bf0b4669ff3d5b72354cc0fdb62d1c2637b545db2096d782a1f713ae9cfbdc89", + "tools/proot/fastpath/svc-dispatch.h": "18dbd595a181ac9d7c0e2eb9ef4321cd9e3ea24e7506beac71cd9e9923d327e5", + "tools/proot/fastpath/svc-patch.h": "9c1d05485a4f79e71b4a49e73e6d2fa37473de20db93acdc7fbfe04c6156fb96", + "tools/proot/fastpath/svc-publish.h": "1c4491e8b22d15319619c1d61707f614fa2b152afd5d02ad197c3da9a2f26e62", + "tools/proot/fastpath/svc-stack.h": "2545db824775ea4673e0272cf7c16f64c87e92db4853f6874cf2c3451cba474b", + "tools/quest/kgsl_compat.c": "92cf5b3da0b3704c20d9e1307bb5abc0530717b9a2e2fd7c8db876a85dc333a1", "tools/quest/kgsl_compat.h": "2e9e0eb647530a35277954b7e61a22ee958067fe46056a608fb32f40f273f1bf" }, "x86": { - "@runner": "84f825635599f81ed33f62c5fc4c73f66044d1468b060d65f83855eb9c8bfe77", + "@runner": "37a91043149e9747985b419002d87ff4df41ec6def4169e0ef16711d7261dbf2", "app/src/main/cpp/adrenotools/src/hook/kgsl.h": "396c56761034a4ed783543ee3312c6ec64d63b2a1cf7eecf1939c23251f25adf", - "app/src/main/cpp/fakeinput_steam.cpp": "3d11e859ca58a42a9da92a3fc589d404df790e151f7e18ea6114645750e70ef5", - "app/src/main/cpp/venc/venc_proto.h": "2242ddbc8981d14a33bac70264bb3e7f701fd1c3ebb988e17bbb2b19b6b808f7", - "tools/linuxfs/build-x86-preloads.sh": "d0820252809881db89db5a17427e74b9aa4964aae70623cb7f4b474e90c7a23b", + "app/src/main/cpp/fakeinput_steam.cpp": "e1377f9d7cd8539a9a327e2851b04c8e05e931f8b5ee554fa4f36d4b17f96718", + "app/src/main/cpp/venc/venc_proto.h": "57636af2644b36ea101cd09de42c423e864a612160561239ceda77ce888d5370", + "tools/linuxfs/build-x86-preloads.sh": "cf283b41c9a39b61bb628035a405cc8d33bd8085056ea482f80253a3ddd6ab8b", "tools/linuxfs/debian-image.env": "1c79dea4314c784042a5c59208765c8401771098f293185d61a157d89edf6e52", "tools/linuxfs/fex/faultreport.c": "573bf780f32f7256dc2fbf40fe850d67e67c354509fdedcac3ff7f1a261daac3", - "tools/linuxfs/fex/vulkanpin.c": "f2693ac2be8d15f7881115e61b1c6b3fe4aeec8f603584c6fce5b0f046563d51", - "tools/linuxfs/fex/webkitinput.c": "693ffd6c8c8c97e87156444ad2255c84dbf22cd0053d135fb8d9be094b5534d1", - "tools/linuxfs/preload/binfmt.c": "0933cc49cb53f0aa1206e2eae516d38dc3337e74174be07e10619c42aa56792b", - "tools/linuxfs/preload/dircache.c": "8e7f19ea4a1198783d53a3f357326c6177da157b0cc7e0d22e1670963e1c26e7", - "tools/linuxfs/preload/drm.c": "e0eabab0d8ed9e841918e827bf87168efa7f2dfb8404169e9bed3ab5eda2836c", - "tools/linuxfs/preload/fsync.c": "795c114c2a05d3f250d07145d04c5658091699da3b96290da36348ccadfb0c09", - "tools/linuxfs/preload/inputudev.c": "2648248d3d235a582eb8459709e0a85de537c03ac10c5040fbfb50d9846c68eb", - "tools/linuxfs/preload/kgslid.c": "88a7875fd5289930204d155d92ac9d15492cd06db16ed87aa9c95af37f3e7089", - "tools/linuxfs/preload/kgslpoll.c": "f0d853d919a52487c04cbda5fb3fa22269da54b7f4ee2f7dd3b5bd9909418670", - "tools/linuxfs/preload/links.c": "b7bbcf9112393b152f358fe6f8dc9a1955f0c8532e1eddf016a971415cd13c64", - "tools/linuxfs/preload/lock.c": "f71b3fd40e6a2b74908d3cdc601e8748699ae9c7a89b542d2445b999015ffd66", - "tools/linuxfs/preload/net.c": "335853c8ea0e9a8ebbc5a5500dc4bded9c34c4310a6ab8aa46b07d5ce1c2b55e", - "tools/linuxfs/preload/netif.c": "cc26d50b8d4639d8dd4697811bbf85c9d9f31761f9504a4af42473de3cb22b3c", - "tools/linuxfs/preload/noexec.c": "1855aeaeda3d506329bd9af1107580c74d1f56787c411b2e01c0a8a9d4059c7b", - "tools/linuxfs/preload/ntsync.c": "0614c48af0c062bfcb4c30141efe1b792b340767a67d2fe92ee9877d2ba16e0d", - "tools/linuxfs/preload/opens.c": "92ae4aea16aa457a898dedf4a70eb332d80d3b1e77f3a60bace7715a4317399e", - "tools/linuxfs/preload/pathcache.c": "eb0d4b5238fe6c8891e805d90bd837e466754100c978fad2d0ff717116b9b8a3", - "tools/linuxfs/preload/perms.c": "f600619c4ca130f69001ed7ad7bd74a3dc215b14c61479c45bb770f916d244b9", - "tools/linuxfs/preload/pulseguard.c": "57674ea40283e53a27bc78362de1ba41ee972d172ea38b1f818b1d6eed0abe65", + "tools/linuxfs/fex/vulkanpin.c": "c530e265486fd106705fac906848871c9bce6acef2718a9c2d5dbb5bd7650227", + "tools/linuxfs/fex/webkitinput.c": "5356a003aa30686218f403ad4ea67f792ac84dc434f289032292f234908d5c48", + "tools/linuxfs/preload/binfmt.c": "45e820cdd75f2bd42710d98a4d5fee7398b667c9793ee94d8b8b7c4f29f4380c", + "tools/linuxfs/preload/clockpause.c": "5c8cbe1303e3b5fce97b000a952ab15691c0b56dc874e4a963f0e7888ce3f2c7", + "tools/linuxfs/preload/descriptor.c": "673b1cd0a5cd287a572e67aa60c2c36d1bc90ccac4f73ad0a783d4d2e2e5df07", + "tools/linuxfs/preload/dircache.c": "09d3dee98e49ef85b8e8112acb6a2b3d8b980eac80f07b3c82785e567f0606a6", + "tools/linuxfs/preload/drm.c": "9c9b9deab902276ee23a08a98730b2c6adbf7ea6d61e1e73d2a2e7c7016b1335", + "tools/linuxfs/preload/fsync.c": "f2f5fd3197d536d9396dd3d69837f6a2b0b4ff9aaffdb6f55b200408aaf5793d", + "tools/linuxfs/preload/inputudev.c": "76d7f720cd9531d8d38c2977956bf764b0db6055cb56aa35493476a244d9a22e", + "tools/linuxfs/preload/kgslid.c": "1a9639606ece49c5aff74baa5b9ef0921ec5dbc321d19d3f59184e4456f324a4", + "tools/linuxfs/preload/kgslpoll.c": "d03c09e0c82f76716dcc1f3ca77e718c60929bedf221ea5dae8ab43f5ab3e3f3", + "tools/linuxfs/preload/links.c": "c5761d450e070de912fbc9c71562d3fbf54775b484ea0fa57ded2e0c0771f7cf", + "tools/linuxfs/preload/lock.c": "1fcfefe28ef49ccd73f13b69ceb576492101cd1ddb88f08e0c73646ddeb327f2", + "tools/linuxfs/preload/net.c": "0645013df15656573d484bf6f8e6d8657beb228c779ae1143c0874e12559bf3e", + "tools/linuxfs/preload/netif.c": "cf6568ce8ffea44f24a8443160d86e4efddcdb964c908532935cbc4c4570ca91", + "tools/linuxfs/preload/noexec.c": "12f5245a893f9044558270cb03cfb7020546bfe3e90a9264b33d3f818dd30433", + "tools/linuxfs/preload/ntsync.c": "acffede0324fc89ac91f8181c2df23e6f39459a4db678a44ce9e65e0f282418c", + "tools/linuxfs/preload/oomadj.c": "d84d552a24ec3467e7ba5cf92a384521dfbcf1fc9a97e899b7b18d20bf1b45d5", + "tools/linuxfs/preload/opens.c": "2ba8f056ae0f2ab87a3d58ca0926b09af67deb1e24048506117bc26601e249c6", + "tools/linuxfs/preload/owner.c": "746d0a1834d0e19f7d9adfad72a6080a1104610f98c1d61e14d2c3a91a9eb04d", + "tools/linuxfs/preload/pathcache.c": "7d8287736f8f1988738d233c002ff6e00127c98034fcd35c2bb63a84c04b85a3", + "tools/linuxfs/preload/perms.c": "5ffa0ce5ff8269fc567dc5581bec380dcf2c90b9fb178c8dbae747e61430608f", + "tools/linuxfs/preload/pulseguard.c": "a91a0d5c745ea32ad52d57010a8b3cf7171bc4a3d2f73b870c64a6a62b233b56", "tools/linuxfs/preload/quest_kgsl.c": "59d9b8416be6a1c680f1d1e4c2427d2cbb7b415344261adb357d9d211ec95cfe", - "tools/linuxfs/preload/robust.c": "9eb6c0ed50e0f48a8cfb86bd92587f471354bdf2531b9177f4b3ab83bdfed39a", - "tools/linuxfs/preload/rptouch.c": "0e3f8bf2f9a41324361f38fa4da8d2d47593c9555f0cabf8228767397846c7c3", - "tools/linuxfs/preload/space.c": "118389bcc89dfa2b4230b80915e21d2d4331c4cff1f5a58265f85e6ecb5c29d2", - "tools/linuxfs/preload/storage.c": "08a8b46c3588f3160bb8608489768010ec36d5ccdb2b25a431ec9d6fcd413a6e", - "tools/linuxfs/preload/sysv.c": "49774ee5e2e39b84dcfadf63abdc741b3df236cb11783744a1280adee36965e8", + "tools/linuxfs/preload/robust.c": "02cd25316912c79897e2c5a1ed44b059b815d36bc62ba8d4691f718eeae92947", + "tools/linuxfs/preload/rptouch.c": "fc6db7e4b9432a7361e805a9a2dd134f9f3ec4ffba7927ab4b2c7b6bd2a22644", + "tools/linuxfs/preload/space.c": "9258ec8a8f8d87f2629b753d1838a09000110d936103284a04134b8cbed024d3", + "tools/linuxfs/preload/storage.c": "5c0dc4e5901e8cc32cdf241e38e3d5dcd3dae8b8ca94579f633754c8eadd617b", + "tools/linuxfs/preload/subreaper.c": "6f3830c0368a768bd0d367fa94345e6e4725875acc9662cf3690f1c5f28bf71c", + "tools/linuxfs/preload/sysv.c": "893dfad1db964eb1f79af94978b4af8b87279b85c30a4d589b5844cded476ed3", "tools/linuxfs/preload/tracefs.c": "be3f8a2f032b56e6e08a931e77a9386aea4bb93421a482271e06386ec0c469b6", - "tools/linuxfs/preload/tracer.c": "f34e5377c891b0a8d00489245d66f96bc352df4cd90f47a951dcadae980af4c1", - "tools/linuxfs/preload/udevmon.c": "2045dfb883cfb6e2016c359a3dc3af17f3b8f383f6dd0d5dfee407ef0d344852", - "tools/linuxfs/preload/usr2.c": "6ae704380b45a9b3a74c4fe2b3ce4482470dae59ced26cf0aee64f4b4dcc11f9", - "tools/linuxfs/preload/venc.c": "24c3c46fe49d28adfc8c977e52c9cc407f534b26f56d94b3425b8bb01803dba8", + "tools/linuxfs/preload/tracer.c": "4b5481ea91a475bb6ac16a7ba63e371f0a850a17adac5399302a610c0a57ec0a", + "tools/linuxfs/preload/udevmon.c": "4d5f07f2521af702b3f2adda3c93a39873f87c0946de007bca8b1fe6699596fa", + "tools/linuxfs/preload/usr2.c": "4b4044da1ddf07d12bafeb893c257679e26a5ea2f58e6cc0d715f27b931e7b1e", + "tools/linuxfs/preload/vdec.c": "a7b2d0754067493cde1929846f7b2c9692c4dde96ee273a92c81ac65470fac50", + "tools/linuxfs/preload/venc.c": "7fda60f013736d98dab734a9344e0f1d527dc3d976a71f5ccd4a0bc17d9f346f", + "tools/linuxfs/preload/venus.c": "d4af5c3532d4c7d9891b75cd5a137252e791beafe319b9fd976be123f7b80403", "tools/linuxfs/preload/vmwrite.c": "1a3ea2ec4354e0716c17f7db537b19ab82bcd524f2aece2fa5dec89b076a2188", - "tools/linuxfs/preload/webhelper.c": "a8213a7a96b407459c83fb93365cfe58fd05964e7bb262b8061c1c0792a6aac8", - "tools/linuxfs/preload/writewatch.c": "61e395d1caa184d329dead0e36c4e92cb1069b1154ac36581f37406c1c242240", - "tools/linuxfs/preload/xmode.c": "9a09995bf52d40b07f16828bcc545b59b8fb1ba60d9cb09f14f7f31dba1e65a6", - "tools/linuxfs/preload/zram.c": "12bcf07459728d4a7ede6fa0fea8deb330f7c5d0f0dd61e610e81b9efecd4262", - "tools/quest/kgsl_compat.c": "111afffda7a6df2469610f6c342ae086b1a97a559c586efc4a28015b86efd6bd", + "tools/linuxfs/preload/webhelper.c": "bec759f908fb7c52238a7b72d3888aac6187aaec2378c190749ab8a5f7f1d81a", + "tools/linuxfs/preload/writewatch.c": "285ed7e627dc9349dd3ae45e8c1ffeaf4c56970b9eac5046754e348b4587dd6b", + "tools/linuxfs/preload/xmode.c": "3b6e36b29795544fdc0299822049b1890a7612578051d2a8982485c263dcf259", + "tools/linuxfs/preload/zram.c": "60b8c9fbd96adcc2026e48c651948d592f06017ff679e4775b1752be26525a2e", + "tools/quest/kgsl_compat.c": "92cf5b3da0b3704c20d9e1307bb5abc0530717b9a2e2fd7c8db876a85dc333a1", "tools/quest/kgsl_compat.h": "2e9e0eb647530a35277954b7e61a22ee958067fe46056a608fb32f40f273f1bf" } }, "origin": { - "artifact": 12520502054, - "artifact_sha256": "b7e800a1884a516ec52b050b7f904f9881427bca4579f660b909fd18f15e49ff", - "commit": "b76f13f7acc0af0cc00369dde61fb88e40529e6d", - "run": 39992155294, - "url": "https://github.com/Droid-Deck/DroidDeck/actions/runs/39992155294" + "artifact": 14400591108, + "artifact_sha256": "974023be39cb1b7a168efb38369d1adfe2a51f0e1d7b9b535b50c8692a24f870", + "commit": "c8b291b9dbdeae137236a56ad66f08b1f3370a8a", + "run": 44240744255, + "url": "https://github.com/Droid-Deck/DroidDeck/actions/runs/44240744255" }, "outputs": { - "i386/libddsession.so": "5343cdb704217ddc81ee593e67d5987363dc7b5ac78bd4bd36000219e5063268", - "i386/libfakeinput.so": "188d88dfb13b6e2f2df948e7b8b4d9ec604770f55d1ea5b6b9e21ad56a74ce5e", + "i386/libddsession.so": "da5562f924faf98144b569ee3ed113be7dcee59deef24abc84be56fd4ba9ccd3", + "i386/libfakeinput.so": "99f6328a3a380672680969a54cd2e9996edf25c287fa5a00e2db54264da8d898", "i386/libfaultreport.so": "95f9ef60f04a13ee60cfbd4d2d2efb60a7063b722e646c78c9dc27162292877b", "libddaudit.so": "6c6abe89baf5d7309babee0c3372a4b00c2b689e2a63de38c5e9a660626509b5", - "libddfastpath.so": "0e1f151b5c1c5ea9dd380ad58d09f8fe7ba3ae037d0991cb3eef6899e9d5ec83", - "libddsession.so": "29d4b5ea46dba941107e02c0ee544244b137a339cada43bff65c350f2ef2755a", - "libfakeinput.so": "5f6dc3aea05de2dc1fbe0bbfac2ce4d11e3d47f761c6b06c8badb15fe1904392", + "libddfastpath.so": "9cdf153a8f9d4e150123dd5bac8ff678a0b84c1318e036c1d928b542821103b6", + "libddnatv-hook.so": "8ed3de674273734ae239408a315ab7813e1e5bb606ed126b9e45eec0e84fe399", + "libddsession.so": "da6c3a919bd6f48f5abfdab383c45be71fb20b684c6defec4fbbbb450b8e2d59", + "libfakeinput.so": "46b671065c0a811fc10d46dcf8dc4b58fce110079c8d919d2e1072c3b02eca02", "libssbs.so": "c288ed0da26c2481aff270d1cdafe1205061c4a300c2c46ae1b53c6e0c94f44b", "usr/local/bin/droiddeck-clipboard": "ec50e8f67fdf76372927189b0fdb670f9b70fd3484f2fe3e833bc8f9fdc44205", - "x86_64/libddsession.so": "61d19f06aebab6a789f8c99f687af9903376bfc853e46b70c48a2ce5e497accc", - "x86_64/libfakeinput.so": "8663dd2086bf8ae53069a480dd9ae4619109d32f0947a29e2ce38f07a21ae2e6", + "x86_64/libddsession.so": "1438bc246fb0fec985ef71fccbe4acdc067b1ae4b97befdc8f01fdd79c99b151", + "x86_64/libfakeinput.so": "74ef688919a0f757d2c022b7a18d64e7c4819301e79e0aa8572d8e0ef8318e49", "x86_64/libfaultreport.so": "bb0dc9165d0d764473e552508650edd586df16d620fc5b16b8b1c5740a28ce22", "x86_64/libvulkan-thunk.so": "74f01b652d7e8179561a096a552328b68da640cc4bad3981edd38e6afbf90243", - "x86_64/libwebkitinput.so": "9b07380a7b017397b9c56bb7bb1161e046b0c6a647fc413888904606b0def6d0" + "x86_64/libwebkitinput.so": "d0ba6886642595132d1ec9abb8d9f4cc7e1bc4c750b4a5d53d2f089334a6b4e3" }, "toolchain": { "arm64": "Ubuntu 24.04 GCC cross compiler; exact build commands pinned by arm64_recipe", diff --git a/tools/linuxfs/overlay/usr/local/bin/droiddeck-battlenet b/tools/linuxfs/overlay/usr/local/bin/droiddeck-battlenet index 1944635308..066f9c572e 100755 --- a/tools/linuxfs/overlay/usr/local/bin/droiddeck-battlenet +++ b/tools/linuxfs/overlay/usr/local/bin/droiddeck-battlenet @@ -321,6 +321,15 @@ def install_path(root, library): return letter.upper() + ":\\" + path[len(target):].strip("/").replace("/", "\\") +def keeps_open(root): + try: + with open(os.path.join(drive_c(root), *CONFIG), encoding="utf-8-sig") as f: + client = json.load(f).get("Client") + except (OSError, ValueError, AttributeError): + return False + return isinstance(client, dict) and LAUNCH_BEHAVIOR[0] in client and client[LAUNCH_BEHAVIOR[0]] != LAUNCH_BEHAVIOR[1] + + def write_config(root, library=None): path = os.path.join(drive_c(root), *CONFIG) key, value = LAUNCH_BEHAVIOR @@ -338,7 +347,7 @@ def write_config(root, library=None): return None client = config["Client"] changes = [] - if client.get(key) != value: + if key not in client: client[key] = value changes.append("launch") if client.get("HardwareAcceleration") != "false": @@ -875,6 +884,9 @@ class Tidy: self.game_since = self.game_since if self.game_since is not None else now if own and not self.closed_for_game and now - self.game_since >= self.settle: self.closed_for_game, self.agent_seen, self.agent_lost = True, False, None + if keeps_open(steam_root()): + say("Battle.net is set to stay open as a game launches: left open") + return False if any(is_client(argv) for _, argv in own) and any(shares_sign_in(argv) for argv in games): say("Battle.net stayed open beside a game signing in with its token: left open") return False diff --git a/tools/linuxfs/overlay/usr/local/bin/droiddeck-xbox b/tools/linuxfs/overlay/usr/local/bin/droiddeck-xbox index 2b97aa3c9e..f15e0b694a 100755 --- a/tools/linuxfs/overlay/usr/local/bin/droiddeck-xbox +++ b/tools/linuxfs/overlay/usr/local/bin/droiddeck-xbox @@ -390,7 +390,7 @@ def launch(command, env): raise RuntimeError('No Xbox account channel; start the game from DroidDeck') reply = store['ask'](Path(launch_dir) / 'stores', {'op': 'xbox-prepare', 'id': sidecar['id']}, timeout=190) if not reply or not reply.get('ok'): - raise RuntimeError('Xbox account service is unavailable; sign in again and retry') + raise RuntimeError((reply or {}).get('reason') or 'Xbox account service is unavailable; sign in again and retry') stopped = threading.Event() close = lambda: None try: diff --git a/tools/tests/test_battlenet.py b/tools/tests/test_battlenet.py index cc92c78cc4..ece44f60d6 100644 --- a/tools/tests/test_battlenet.py +++ b/tools/tests/test_battlenet.py @@ -180,7 +180,7 @@ class ConfigAndMenuTest(Temp): self.assertEqual(config["Client"]["Streaming"]["StreamingEnabled"], "false") self.assertEqual(config["Client"]["GameLaunchWindowBehavior"], "2") self.assertIsNone(BNET["write_config"](root)) - path.write_text('{"Client": {"HardwareAcceleration": "false", "GameLaunchWindowBehavior": "0"}, "Games": {"osi": {}}}') + path.write_text('{"Client": {"HardwareAcceleration": "false"}, "Games": {"osi": {}}}') self.assertEqual(BNET["write_config"](root), "launch 32-bit") config = json.loads(path.read_text()) self.assertEqual(config, {"Client": {"HardwareAcceleration": "false", "GameLaunchWindowBehavior": "2"}, @@ -189,6 +189,29 @@ class ConfigAndMenuTest(Temp): self.assertEqual(BNET["write_config"](root), "acceleration 32-bit") self.assertEqual(json.loads(path.read_text())["Client"]["HardwareAcceleration"], "false") + def test_a_launch_behavior_the_player_chose_is_kept(self): + root = str(self.tmp) + path = self.config_path() + path.parent.mkdir(parents=True) + for behavior in ("0", "1"): + with self.subTest(behavior): + path.write_text('{"Client": {"HardwareAcceleration": "false", "GameLaunchWindowBehavior": "%s"}, ' + '"Games": {"s1": {"Run64Bit": "false", "Run64BitSet": "true"}}}' % behavior) + self.assertIsNone(BNET["write_config"](root)) + self.assertEqual(json.loads(path.read_text())["Client"]["GameLaunchWindowBehavior"], behavior) + self.assertTrue(BNET["keeps_open"](root)) + + def test_only_a_launch_behavior_other_than_exit_keeps_battle_net_open(self): + root = str(self.tmp) + self.assertFalse(BNET["keeps_open"](root)) + path = self.config_path() + path.parent.mkdir(parents=True) + for text in ("{not json", "[1, 2]", '{"Client": "x"}', '{"Client": {}}', + '{"Client": {"GameLaunchWindowBehavior": "2"}}'): + with self.subTest(text): + path.write_text(text) + self.assertFalse(BNET["keeps_open"](root)) + def test_starcraft_starts_its_32_bit_client_until_a_player_picks_one(self): root = str(self.tmp) BNET["write_config"](root) @@ -656,6 +679,7 @@ class TidyTest(unittest.TestCase): "say": lambda message: None, "stop": lambda found, wait=0: self.stopped.append(sorted(pid for pid, _ in found)), "notify": lambda title, body, icon=None: self.notified.append(title), + "keeps_open": lambda root: False, }) patcher.start() self.addCleanup(patcher.stop) @@ -672,6 +696,14 @@ class TidyTest(unittest.TestCase): self.assertEqual(self.stopped, [[1, 2, 3]]) self.assertEqual(self.notified, []) + def test_battle_net_the_player_set_to_stay_open_is_left_open(self): + up = [self.CLIENT, self.PAGE, self.AGENT, self.WINE] + tidy = BNET["Tidy"](settle=20, gone=30) + with mock.patch.dict(BNET, {"keeps_open": lambda root: True}): + closed = self.run_tidy(tidy, [(0, up), (5, up + [self.GAME]), (25, up + [self.GAME]), (60, up + [self.GAME])]) + self.assertEqual(closed, [False, False, False, False]) + self.assertEqual(self.stopped, []) + def test_battle_net_beside_a_game_signing_in_with_its_token_is_left_open(self): d4 = (6, ["C:\\Program Files (x86)\\Diablo IV\\Diablo IV.exe", "-nostreamline", "-sso", "-launch", "-uid", "fenris"]) up = [self.CLIENT, self.PAGE, self.AGENT] diff --git a/tools/tests/test_effects_source_resolution.py b/tools/tests/test_effects_source_resolution.py index 043f392129..aae6052cec 100644 --- a/tools/tests/test_effects_source_resolution.py +++ b/tools/tests/test_effects_source_resolution.py @@ -33,7 +33,9 @@ class EffectsSourceResolutionTest(unittest.TestCase): 'static void effects_overlay_draws(', 'static int render_impl(', 'static int pass_begin_impl(')) functions = (re.search(r'static int spatial_mode\([^\n]+', effects).group() + '\n' + + re.search(r'static int cas_active\([^\n]+', effects).group() + '\n' + function(effects, 'int vkp_effects_upscaling(') + + function(effects, 'int vkp_effects_sharpening(') + function(effects, 'int vkp_effects_postprocessing(') + functions) image = source[source.index('struct vkp_image {'):source.index('\n};', source.index('struct vkp_image {')) + 3] draw = header[header.index('struct vkp_draw {'):header.index('\n};', header.index('struct vkp_draw {')) + 3] @@ -101,6 +103,9 @@ class EffectsSourceResolutionTest(unittest.TestCase): def test_postprocessing_keeps_foreground_inside_the_effect_chain(self): self.check_case('postprocessing') + def test_frame_generation_keeps_upscaling_and_sharpening_at_panel_size(self): + self.check_case('framegen-sharpening') + TYPES = r''' #include @@ -192,7 +197,8 @@ static struct vkp_img_slot g_hdrscene, g_fgscene; static struct { int active, rw, rh; VkImage result; } g_pass; static struct { int64_t present_ns, present_max_ns; unsigned presents; } g_perf; static int effects_active = 1, framegen, cardboard; -static struct { int scaling; } g_cur = {4}; +struct fx_settings { int scaling, cas_on, cas_pct; }; +static struct fx_settings g_cur = {4}; static int copy_count, effects_count, screen_count, hdr_count, fail_scene, fail_effects, postprocessing; static int copied_w, copied_h, target_w, target_h; static int effects_w, effects_h, output_w, output_h, logical_w, logical_h; @@ -276,7 +282,7 @@ static struct vkp_draw fullscreen(void) { } static void reset(void) { copy_count = effects_count = screen_count = hdr_count = barrier_count = 0; - effects_active = 1; g_cur.scaling = 4; + effects_active = 1; g_cur = (struct fx_settings){4}; framegen = cardboard = fail_scene = fail_effects = postprocessing = g_plain_frame = 0; g_pass.active = 0; g_extent = (VkExtent2D){1920, 1080}; image.w = 1280; image.h = 720; @@ -552,6 +558,25 @@ static void check_allocation(void) { assert(recorded_blits[1].dstOffsets[1].x == 1920 && recorded_blits[1].dstOffsets[1].y == 1080); assert(target_w == 1920 && target_h == 1080); } +static void check_framegen_output(int scaling, int cas, int grading, int panel) { + reset(); framegen = 1; postprocessing = grading; + g_cur = (struct fx_settings){scaling, cas, cas ? 60 : 0}; + g_extent = (VkExtent2D){2880, 1620}; + struct vkp_draw draw = fullscreen(); + run_path(0, &draw, 1, NULL); + assert(effects_count == 1); + assert(output_w == (panel ? 2880 : 1920) && output_h == (panel ? 1620 : 1080)); +} +static void check_framegen_sharpening(void) { + check_framegen_output(4, 0, 0, 1); + check_framegen_output(3, 0, 0, 1); + check_framegen_output(8, 0, 0, 1); + check_framegen_output(0, 1, 1, 1); + check_framegen_output(1, 1, 1, 1); + check_framegen_output(0, 0, 1, 0); + check_framegen_output(6, 0, 0, 0); + check_framegen_output(2, 0, 1, 0); +} int main(int argc, char **argv) { assert(argc == 2); reset(); if (!strcmp(argv[1], "helper")) check_helper(); @@ -567,6 +592,7 @@ int main(int argc, char **argv) { else if (!strcmp(argv[1], "effect-failure")) check_effect_failure(); else if (!strcmp(argv[1], "overlay-barriers")) check_overlay_barriers(); else if (!strcmp(argv[1], "postprocessing")) check_postprocessing(); + else if (!strcmp(argv[1], "framegen-sharpening")) check_framegen_sharpening(); else assert(0); puts("PASS"); } diff --git a/tools/tests/vk_terminal_callers_test.c b/tools/tests/vk_terminal_callers_test.c index c5857a7710..2398608bd2 100644 --- a/tools/tests/vk_terminal_callers_test.c +++ b/tools/tests/vk_terminal_callers_test.c @@ -72,6 +72,7 @@ PFN_vkGetInstanceProcAddr vk_loader_gipa(void) { return NULL; } void vkp_effects_bind_device(VkDevice d, VkPhysicalDevice p, const VkPhysicalDeviceMemoryProperties *m) {} int vkp_effects_active(void) { return 0; } int vkp_effects_upscaling(void) { return 0; } +int vkp_effects_sharpening(void) { return 0; } int vkp_effects_postprocessing(void) { return 0; } VkFilter vkp_effects_blit_filter(void) { return VK_FILTER_NEAREST; } void vkp_effects_set_formats(VkFormat a, VkFormat b) {} diff --git a/tools/xbox/build-local.sh b/tools/xbox/build-local.sh index 979c95b12b..c833a403d0 100755 --- a/tools/xbox/build-local.sh +++ b/tools/xbox/build-local.sh @@ -10,6 +10,12 @@ build=' bash tools/xbox/build.sh ' if [[ $(uname -m) = x86_64 ]]; then + binfmt_magics=$(cat /proc/sys/fs/binfmt_misc/* 2>/dev/null || true) + if [[ $(uname -s) = Linux && $binfmt_magics != *'magic 7f454c460201010000000000000000000200b700'* ]]; then + echo "The Xbox backend tests re-execute their arm64 binaries, which needs an aarch64 binfmt handler on the host." >&2 + echo "Register one with: docker run --privileged --rm tonistiigi/binfmt --install arm64" >&2 + exit 1 + fi cache=${DROIDDECK_XBOX_CACHE:-"${HOME}/.cache/droiddeck-xbox-cross"} platform=linux/amd64 image=droiddeck-xbox-cross:$(shasum -a 256 "$repo/tools/xbox/cross.Dockerfile" | cut -c1-12) @@ -28,4 +34,5 @@ fi mkdir -p "$cache" docker run --rm --platform "$platform" -v "$repo:/src" -v "$cache:/work" -w /src \ -e CARGO_HOME=/work/cargo -e RUSTUP_HOME=/work/rustup -e XBOX_BUILD_DIR=/work/build "$image" \ - bash -lc "set -euo pipefail$build" + bash -lc "set -euo pipefail + trap 'chown -R $(id -u):$(id -g) /work /src/app/src/main/assets/linuxfs 2>/dev/null || true' EXIT$build" diff --git a/tools/xbox/build.sh b/tools/xbox/build.sh index 99bee8c76b..85cdbd3c62 100755 --- a/tools/xbox/build.sh +++ b/tools/xbox/build.sh @@ -16,7 +16,9 @@ cargo build --locked --release --no-default-features --target aarch64-unknown-li if [[ $(uname -m) = aarch64 || -n ${CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER:-} ]]; then cargo test --locked --release --no-default-features --target aarch64-unknown-linux-gnu -p xodus-cli cargo test --locked --release --no-default-features --target aarch64-unknown-linux-gnu -p xodus credential_ - cargo test --locked --release --no-default-features --target aarch64-unknown-linux-gnu -p msixvc streaming_ + msixvc_env=() + [[ $(uname -m) = aarch64 ]] || msixvc_env=(RUST_TEST_THREADS=1) + env "${msixvc_env[@]}" cargo test --locked --release --no-default-features --target aarch64-unknown-linux-gnu -p msixvc streaming_ fi for binary in xodus-cli xodus-service; do install -m755 "$CARGO_TARGET_DIR/aarch64-unknown-linux-gnu/release/$binary" "$out/$binary"