mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-05 20:45:43 +00:00
Compare commits
1003
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb5272eefc | ||
|
|
8baa16073f | ||
|
|
8178bf5099 | ||
|
|
d4b3de0b07 | ||
|
|
d063741856 | ||
|
|
a97a7d9058 | ||
|
|
3acf5db3f6 | ||
|
|
cffcbaae4a | ||
|
|
3c5e95afa8 | ||
|
|
351d66ed0b | ||
|
|
7d149acb00 | ||
|
|
69c88aa344 | ||
|
+13 |
219548f4b6 | ||
|
|
cf6cf168b0 | ||
|
|
7d21ba2233 | ||
|
|
ae94d9db54 | ||
|
|
45513c90d6 | ||
|
|
f3f3ba1a8a | ||
|
|
97f976ef6c | ||
|
+13 |
83eda433c8 | ||
|
|
e95a4226eb | ||
|
|
26ca374c47 | ||
|
|
64d78aa812 | ||
|
|
522e755b37 | ||
|
|
9c9486400b | ||
|
|
62192203e9 | ||
|
|
d8df18df82 | ||
|
|
953c11ed48 | ||
|
|
c796c7cd48 | ||
|
|
89a0e4d25f | ||
|
|
59a5afa21d | ||
|
|
66529d9026 | ||
|
|
abd89f9954 | ||
|
|
f7ffab1345 | ||
|
|
8886304894 | ||
|
|
0b8d55d434 | ||
|
|
99381a8f3e | ||
|
|
a422698f92 | ||
|
|
dce7e7ece6 | ||
|
|
e3fe63aee6 | ||
|
|
22c85c0cb4 | ||
|
|
a548d381b8 | ||
|
|
9abb21e389 | ||
|
|
4e4cc9d5e3 | ||
|
|
a353b15364 | ||
|
|
86b92c5d0e | ||
|
|
e24e07d0ce | ||
|
|
71da1c90c5 | ||
|
|
cd4a26b5f1 | ||
|
|
66ec776b0b | ||
|
|
2847910f22 | ||
|
|
d21466be6b | ||
|
|
21a78a1eb2 | ||
|
|
5aa245cf39 | ||
|
|
507ddac39d | ||
|
|
ef16de6280 | ||
|
|
d301148881 | ||
|
|
787cec2548 | ||
|
|
0a72690631 | ||
|
|
b539cc1111 | ||
|
|
acf66b2b0e | ||
|
|
892f400145 | ||
|
|
47e4f25346 | ||
|
|
e1ca869d8e | ||
|
|
9eb509b9e1 | ||
|
|
c39a521a28 | ||
|
|
58ab106da8 | ||
|
|
6e49c0c287 | ||
|
|
322040123d | ||
|
|
36a9cbfc13 | ||
|
|
a2486b2afc | ||
|
|
1bd3c64d01 | ||
|
|
7fc61b4c3d | ||
|
|
21e5fdfc63 | ||
|
|
f819988b0d | ||
|
|
39c8a0fe8c | ||
|
|
44331558cc | ||
|
|
d2bab8970d | ||
|
|
eb22557702 | ||
|
|
38d560cef1 | ||
|
|
45a808c80d | ||
|
|
929e049761 | ||
|
|
684f7407de | ||
|
|
00a106e2fa | ||
|
|
91dabdc1e7 | ||
|
|
f635e92498 | ||
|
|
eda1e9b9c6 | ||
|
|
fa9a9446bb | ||
|
|
3e3c4d69e4 | ||
|
|
913806f169 | ||
|
|
7b018e6c42 | ||
|
|
e45d6f7192 | ||
|
|
b3ff93e80f | ||
|
|
c035351b4f | ||
|
|
10cdf97480 | ||
|
|
f614483d01 | ||
|
|
f5eb5e7b81 | ||
|
|
bf99dbbe73 | ||
|
|
46fac69438 | ||
|
|
82f04fb22e | ||
|
|
9796525449 | ||
|
|
9838c83fc2 | ||
|
|
799be037e5 | ||
|
|
d99d728ba5 | ||
|
|
4b17bc9a23 | ||
|
|
4ac78621cc | ||
|
|
079261759e | ||
|
|
3fe03c0a88 | ||
|
|
6211faf6bc | ||
|
|
81e645a917 | ||
|
|
06b09b37bd | ||
|
|
0c3444afbc | ||
|
|
0988cdc43a | ||
|
|
06bd0de4d7 | ||
|
|
3a408058ba | ||
|
|
a074ba994b | ||
|
|
d310e59fce | ||
|
|
0d0465d19e | ||
|
|
83ec5708ed | ||
|
|
4163b31b02 | ||
|
|
02888834d4 | ||
|
|
ec537421ac | ||
|
|
5e23c668f3 | ||
|
|
a12ac8134a | ||
|
|
4562d61139 | ||
|
|
cc5ae4ff0b | ||
|
|
f0c52c273b | ||
|
|
975c76e3e8 | ||
|
|
a394dfd31b | ||
|
|
a2e555f4cc | ||
|
|
31d12a9f6c | ||
|
|
3820445561 | ||
|
|
75d7edd2c3 | ||
|
|
da8fe068d9 | ||
|
|
8f9ce19638 | ||
|
|
b74edb7e8d | ||
|
|
2503d69293 | ||
|
|
5e38e79c96 | ||
|
|
5e5ffee93e | ||
|
|
a7662ae13a | ||
|
|
a249e896f7 | ||
|
|
ca3743520e | ||
|
|
98822fdd27 | ||
|
|
8d0225932c | ||
|
|
40bca96db5 | ||
|
|
a2a9586b54 | ||
|
|
2fe6ba36c4 | ||
|
|
e4c84e6e24 | ||
|
|
10ef8c4bd6 | ||
|
|
8e01cfb2ef | ||
|
|
b25c4ea26b | ||
|
|
cebad5692d | ||
|
|
6b2c8ace09 | ||
|
|
4d1b8421fb | ||
|
|
ced4ac5db8 | ||
|
|
e190f57b53 | ||
|
|
22f02fb6bf | ||
|
|
52c67df4c7 | ||
|
|
de1a734fb5 | ||
|
|
be9939d82c | ||
|
|
e4c375ad0d | ||
|
|
0cafa83ea7 | ||
|
|
435beb7f19 | ||
|
|
78fcb60fd5 | ||
|
|
4995b3553b | ||
|
|
3c2878cc52 | ||
|
|
715032062d | ||
|
|
dde08414fc | ||
|
|
ec24b3a472 | ||
|
|
6455b1dade | ||
|
|
542ad3e060 | ||
|
|
910fb47692 | ||
|
|
3dd14dd625 | ||
|
|
d1b0ac4df1 | ||
|
|
0e225d0c6e | ||
|
|
d9cd0d2cc8 | ||
|
|
eadebc46d5 | ||
|
|
96d7c66535 | ||
|
|
90690d1c5c | ||
|
|
abbcb8e3ad | ||
|
|
fe60b3c279 | ||
|
|
c7455b74ff | ||
|
|
c875ceda4d | ||
|
|
666abd134f | ||
|
|
c115916962 | ||
|
|
0579e688ba | ||
|
|
bc50de3b55 | ||
|
|
6489232598 | ||
|
|
c23c436502 | ||
|
|
fad52ec125 | ||
|
|
d22e458d64 | ||
|
|
1b7cb4179d | ||
|
|
c1c22dfd37 | ||
|
|
0043cefab5 | ||
|
|
41f68ef1a1 | ||
|
|
9743ac3abc | ||
|
|
ca6cfcd193 | ||
|
|
d41424170a | ||
|
|
f4678935c4 | ||
|
|
416eb41d8d | ||
|
|
6e0d456dd7 | ||
|
|
8ac555664a | ||
|
|
4bf4e53ecf | ||
|
|
3d50e6b1ae | ||
|
|
846b20f78a | ||
|
|
a229d196bb | ||
|
|
61bfc04704 | ||
|
|
9b90386e73 | ||
|
|
ddc4c18faf | ||
|
|
fb8361b197 | ||
|
|
a5fd64f9f2 | ||
|
|
e0a7ce4f88 | ||
|
|
b213ae77b4 | ||
|
|
6e5932cb68 | ||
|
|
38e3fa2a33 | ||
|
|
8e1a676f19 | ||
|
|
7c946db440 | ||
|
|
eaf26c8a20 | ||
|
|
0a96767657 | ||
|
|
32054e156e | ||
|
|
fd6d6b7c46 | ||
|
|
c101a451e3 | ||
|
|
a76ba69217 | ||
|
|
d06caf9838 | ||
|
|
134fa167fe | ||
|
|
da42a5d7a7 | ||
|
|
b6c1d3c09c | ||
|
|
a58b0ac3e0 | ||
|
|
e1700ba982 | ||
|
|
736ac7db74 | ||
|
|
6e2966be43 | ||
|
|
679948e792 | ||
|
|
e0fc8362b8 | ||
|
|
9d8ff9615f | ||
|
|
1304809240 | ||
|
|
343a516e1a | ||
|
|
7c08cb58ae | ||
|
|
7e81668de2 | ||
|
|
d231564f8e | ||
|
|
37e89c5b4d | ||
|
|
e070bd72e0 | ||
|
|
9310d19857 | ||
|
|
4454a6d39a | ||
|
|
453f6f5180 | ||
|
|
6d0484941e | ||
|
|
cf47910881 | ||
|
|
4f0f0cf5b1 | ||
|
|
a78d5cb600 | ||
|
|
206c8a8846 | ||
|
|
bf17ce1151 | ||
|
|
ef38c975b9 | ||
|
|
61953c4f7b | ||
|
|
1f13285ab8 | ||
|
|
1bc23ac169 | ||
|
|
50f50b16e0 | ||
|
|
adc86fc7df | ||
|
|
f3fd3a2307 | ||
|
|
1e877fa602 | ||
|
|
906009a33a | ||
|
|
08559a02f8 | ||
|
|
1d93626453 | ||
|
|
9d0989374b | ||
|
|
3278afaa1a | ||
|
|
bf221ffbbd | ||
|
|
c636eea355 | ||
|
|
ffaa906cd1 | ||
|
|
d61af961c1 | ||
|
|
bc01b77752 | ||
|
|
a1b01a04a8 | ||
|
|
b44235c495 | ||
|
|
b80d5db176 | ||
|
|
d3c0d258b7 | ||
|
|
9dcdbf245a | ||
|
|
369e218afb | ||
|
|
119d24bf6b | ||
|
|
2a905510d5 | ||
|
|
da29919b5a | ||
|
|
05608ac4d4 | ||
|
|
135b84a501 | ||
|
|
e7cbba37d1 | ||
|
|
d9bb5e15b0 | ||
|
|
46cdc32cf1 | ||
|
|
387572e733 | ||
|
|
9f46c7a50b | ||
|
|
0607bb0b3a | ||
|
|
b89d87cbde | ||
|
|
06e06b9673 | ||
|
|
b896e7a3b9 | ||
|
|
c91daa9147 | ||
|
|
31ea194f3d | ||
|
|
472bb28c88 | ||
|
|
eaa4a7a047 | ||
|
|
4fa467c800 | ||
|
|
beb96e6f0c | ||
|
|
26cb9e2f03 | ||
|
|
6dc74523c3 | ||
|
|
3858a69867 | ||
|
|
49a5f4aa94 | ||
|
|
4cc9f2a3f3 | ||
|
|
b0d7fc01d8 | ||
|
|
9cc40246a3 | ||
|
|
423cf11919 | ||
|
|
33f7213599 | ||
|
|
6f1fb462ed | ||
|
|
336b8851f7 | ||
|
|
5da3cf673c | ||
|
|
9e54e094fb | ||
|
|
eb9ca4ab6b | ||
|
|
e7b6876877 | ||
|
|
c535f6ef6e | ||
|
|
db2e1d7da2 | ||
|
|
f5e204eb1d | ||
|
|
705a5e7b2a | ||
|
|
e60eae3646 | ||
|
|
b04900b1b2 | ||
|
|
6357543b44 | ||
|
|
67fb338e5d | ||
|
|
ba140c4ab5 | ||
|
|
f5fdbc7941 | ||
|
|
90ae85da4d | ||
|
|
f3600fa618 | ||
|
|
2d8befe1cb | ||
|
|
f982ffcaf7 | ||
|
|
255c64551e | ||
|
|
746f28c1b2 | ||
|
|
2b481ba250 | ||
|
|
49622623de | ||
|
|
69f99ade42 | ||
|
|
c236e9711f | ||
|
|
4c2efb6688 | ||
|
|
7eb2d1cf1a | ||
|
|
b4ff83cf9f | ||
|
|
7b20b70c6b | ||
|
|
86207f9d0e | ||
|
|
eda5ece382 | ||
|
|
3404bbc128 | ||
|
|
b5a431aa3c | ||
|
|
49249f6541 | ||
|
|
5614621d6e | ||
|
|
0816562065 | ||
|
|
39618e6862 | ||
|
|
c66e4ba4b3 | ||
|
|
e4b033861f | ||
|
|
85a07a556c | ||
|
|
8dfc48d58b | ||
|
|
82ebdaa0b5 | ||
|
|
ec016f85bc | ||
|
|
c2c812deaa | ||
|
|
eec3428f78 | ||
|
|
4a5e4b76e3 | ||
|
|
43f952b2fb | ||
|
|
0d86bec34d | ||
|
|
47a6f29ad7 | ||
|
|
84834f180e | ||
|
|
bfd445618a | ||
|
|
eddfd37b93 | ||
|
|
d7341863bf | ||
|
|
2f51be7b5a | ||
|
|
fbc0014d14 | ||
|
|
46df6171fc | ||
|
|
761b62914f | ||
|
|
91b0299f77 | ||
|
|
6d08e59d10 | ||
|
|
83cc0fe585 | ||
|
|
c711c627b8 | ||
|
|
0b34690721 | ||
|
|
b640734db5 | ||
|
|
f8feb63dde | ||
|
|
25a5d3fe5d | ||
|
|
41dd93fd25 | ||
|
|
adf3c9405d | ||
|
|
abf4f57b47 | ||
|
|
c1e36975d4 | ||
|
|
0bfa0915d4 | ||
|
|
4da87672a2 | ||
|
|
3ba0d287e9 | ||
|
|
b4a86cb5bb | ||
|
|
0fa1f2f868 | ||
|
|
71610ddfdb | ||
|
|
5c9e683769 | ||
|
|
32a5e83b88 | ||
|
|
88904c08f7 | ||
|
|
9928bfe780 | ||
|
|
a491dec5c4 | ||
|
|
17ef33ee31 | ||
|
|
06caaee343 | ||
|
|
1c161a76dd | ||
|
|
aa05ab03fa | ||
|
|
43ea3f3181 | ||
|
|
3966b27948 | ||
|
|
7e24327621 | ||
|
|
d025aa3c6d | ||
|
|
325f6893c5 | ||
|
|
466419407d | ||
|
|
cbd4ce6636 | ||
|
|
d4130181e7 | ||
|
|
16a9d0af2a | ||
|
|
e51698e01f | ||
|
|
519091dd86 | ||
|
|
972088f1b3 | ||
|
|
542d31daf0 | ||
|
|
8f9a849c48 | ||
|
|
e8bfe6e520 | ||
|
|
15618f357b | ||
|
|
b74010435a | ||
|
|
0a58a7faee | ||
|
|
0d21e2f913 | ||
|
|
ebb82d2dc9 | ||
|
|
557e346810 | ||
|
|
08b2cf0894 | ||
|
|
4e90e03536 | ||
|
|
11d997dc65 | ||
|
|
454193da9b | ||
|
|
cdd5c99bc7 | ||
|
|
fb1da1c39a | ||
|
|
b29ece82c8 | ||
|
|
1330fe4d6c | ||
|
|
0e1f6f15a1 | ||
|
|
4df0e012fd | ||
|
|
48054a86ab | ||
|
|
38d658abf5 | ||
|
|
5547391cfc | ||
|
|
6782e5a717 | ||
|
|
e1a80c1751 | ||
|
|
05933a5ee3 | ||
|
|
1f29cd92a5 | ||
|
|
4f30356c9b | ||
|
|
baebf50197 | ||
|
|
01674b7c6f | ||
|
|
728bfa2043 | ||
|
|
c4de482b6a | ||
|
|
55697535a1 | ||
|
|
65733c23a1 | ||
|
|
fd51b86060 | ||
|
|
d6e4ab1824 | ||
|
|
566c7d703a | ||
|
|
d7eb3256a5 | ||
|
|
c96f2d1070 | ||
|
|
cc8b743ecb | ||
|
|
45422b739b | ||
|
|
f58bf9b23c | ||
|
|
f0e8ef1274 | ||
|
|
bb6d6fee97 | ||
|
|
d59734e375 | ||
|
|
14db12290e | ||
|
|
1e476539df | ||
|
|
3c8e370744 | ||
|
|
3fcd01f536 | ||
|
|
0e2ee35b49 | ||
|
|
27920711f0 | ||
|
|
d4c16b5b59 | ||
|
|
e392364e30 | ||
|
|
3cdb77fd65 | ||
|
|
a91be68992 | ||
|
|
e16f351540 | ||
|
|
efdab60b22 | ||
|
|
8dc24f244c | ||
|
|
b565c4a6e5 | ||
|
|
a999fbdb38 | ||
|
|
52eee568f5 | ||
|
|
05cebd4a4f | ||
|
|
8cfd54a739 | ||
|
|
8565acf12b | ||
|
|
941a6c3ef9 | ||
|
|
fe84c050ad | ||
|
|
f13c885fec | ||
|
|
8ee1cbe3eb | ||
|
|
6c5d6cda73 | ||
|
|
2725ee4512 | ||
|
|
7cc1c93775 | ||
|
|
38c9b733b5 | ||
|
|
27e5f86793 | ||
|
|
a6331e44ae | ||
|
|
f53b844add | ||
|
|
fb34098006 | ||
|
|
c729f4c8e7 | ||
|
|
9f343278c3 | ||
|
|
6beeb29486 | ||
|
|
ade2e982b6 | ||
|
|
8a61a1898b | ||
|
|
dfa3b12f48 | ||
|
|
93382ff241 | ||
|
|
24b74d8346 | ||
|
|
9ed25d8ae5 | ||
|
|
b4b31d5a08 | ||
|
|
f394906726 | ||
|
|
b50dfa76d1 | ||
|
|
3f81ddff9b | ||
|
|
d1dec8d7a4 | ||
|
|
e60097e5cb | ||
|
|
7c7bf2dcbe | ||
|
|
75593cfd29 | ||
|
|
00d0f8cd2b | ||
|
|
faf4b4e8b5 | ||
|
|
5a61d37c5d | ||
|
|
25079ab819 | ||
|
|
736b7bed5e | ||
|
|
a3f4c911e5 | ||
|
|
caa7682c6f | ||
|
|
e217cbe66d | ||
|
|
4914b2cc69 | ||
|
|
051b9a320e | ||
|
|
6ecd6fa1d0 | ||
|
|
0f4e83eefd | ||
|
|
d62525f5af | ||
|
|
71057fefe1 | ||
|
|
f4d2c37fbd | ||
|
|
ffd9f92d7b | ||
|
|
213d110766 | ||
|
|
1a8c91b49b | ||
|
|
9644a4cc7f | ||
|
|
24c250fdb4 | ||
|
|
d4636afa97 | ||
|
|
32930e704e | ||
|
|
a8b18947a1 | ||
|
|
7c422577b6 | ||
|
|
1cc1ee994d | ||
|
|
d8d375cb9a | ||
|
|
49934ce933 | ||
|
|
221644e8be | ||
|
|
5179b54745 | ||
|
|
448feb30bc | ||
|
|
9d891d4db1 | ||
|
|
240f1194c0 | ||
|
|
7b74eebce2 | ||
|
|
7592684b6f | ||
|
|
7b78e1629b | ||
|
|
30741302fb | ||
|
|
645f7d0bf1 | ||
|
|
124f162ee8 | ||
|
|
3c577fd9dd | ||
|
|
659ff4817f | ||
|
|
626adb62af | ||
|
|
71cb100a40 | ||
|
|
68002f3fa7 | ||
|
|
dae7592788 | ||
|
|
e10f5b4430 | ||
|
|
3e32b75a63 | ||
|
|
435f7a1b03 | ||
|
|
1fd8c50225 | ||
|
|
e797bc5f01 | ||
|
|
0cc3fe6bca | ||
|
|
ab8542e4e5 | ||
|
|
c2bcf20172 | ||
|
|
2341659cea | ||
|
|
b2eaf380dc | ||
|
|
197fc3f163 | ||
|
|
9530e7b394 | ||
|
|
0e0f133496 | ||
|
|
d98c211168 | ||
|
|
614b4d4de4 | ||
|
|
43a19a831a | ||
|
|
0d308af024 | ||
|
|
128f73da8f | ||
|
|
e22a55e949 | ||
|
|
67cb005e6c | ||
|
|
73f76f6799 | ||
|
|
961a060461 | ||
|
|
dadbbf841a | ||
|
|
1ce8280371 | ||
|
|
78bdc0e3b5 | ||
|
|
ce5f2f5513 | ||
|
|
0f2792c7ac | ||
|
|
7185b775d4 | ||
|
|
cda6e89c12 | ||
|
|
5f80898c27 | ||
|
|
85560d6471 | ||
|
|
be6c875277 | ||
|
|
91beced154 | ||
|
|
ebc3da08b4 | ||
|
|
41eb780495 | ||
|
|
65fc2a38a3 | ||
|
|
359d1535ac | ||
|
|
4c3a9f027c | ||
|
|
5a6cc3c76e | ||
|
|
89bd7deceb | ||
|
|
169f2c3e34 | ||
|
|
e6a797695a | ||
|
|
f1a2ecc857 | ||
|
|
36916f6bde | ||
|
|
1b96d13a51 | ||
|
|
cb1d70bb14 | ||
|
|
37af590ca2 | ||
|
|
02f356f8c0 | ||
|
|
5448177814 | ||
|
|
ed6ce0ca41 | ||
|
|
9b440686c5 | ||
|
|
e7b7e9dc43 | ||
|
|
1120040aee | ||
|
|
3506a272da | ||
|
|
b752748b7d | ||
|
|
8990e7d7a4 | ||
|
|
c92a423ba1 | ||
|
|
3b82b3e1f8 | ||
|
|
e985ce1975 | ||
|
|
8496ce3e51 | ||
|
|
47188f40ed | ||
|
|
e186c9bc4c | ||
|
|
7705f3c222 | ||
|
|
5675b4897f | ||
|
|
1c87d92ef7 | ||
|
|
031e64dfe1 | ||
|
|
f590dd9763 | ||
|
|
af7dc40538 | ||
|
|
a28aae6e4a | ||
|
|
c024470cc7 | ||
|
|
16ae5ab84a | ||
|
|
144947305a | ||
|
|
563bc6cad7 | ||
|
|
59cde93821 | ||
|
|
c104e1c276 | ||
|
|
b5da0d0db6 | ||
|
|
5defc3e38b | ||
|
|
6a9f52f932 | ||
|
|
06a8d75769 | ||
|
|
ec12ddd0a8 | ||
|
|
570902d5f3 | ||
|
|
6120069975 | ||
|
|
3e337c9bda | ||
|
|
2869e76406 | ||
|
|
61fdb80823 | ||
|
|
fd180a108a | ||
|
|
4de74c740c | ||
|
|
b7c32c92d2 | ||
|
|
8610ca0928 | ||
|
|
a6b1ad37d0 | ||
|
|
97b13f7488 | ||
|
|
5d5b45a012 | ||
|
|
5ebafaabda | ||
|
|
56627a8aaf | ||
|
|
f59ced4e98 | ||
|
|
296e848718 | ||
|
|
8c63413019 | ||
|
|
2861c6d284 | ||
|
|
69c2d8e566 | ||
|
|
414fddf7b8 | ||
|
|
b5ca6145a6 | ||
|
|
5a5948b071 | ||
|
|
e58b5088b3 | ||
|
|
ecbce4c8d3 | ||
|
|
96bf0a3bf3 | ||
|
|
da7522a3ee | ||
|
|
5605e777ca | ||
|
|
a10e2e1fe8 | ||
|
|
4fb623fa33 | ||
|
|
3b4956d088 | ||
|
|
18deaafc34 | ||
|
|
0c4eede6d2 | ||
|
|
54681f2647 | ||
|
|
5271edd972 | ||
|
|
e4bb9856ef | ||
|
|
e462bbb24a | ||
|
|
d8f3090d9b | ||
|
|
d1af8b0114 | ||
|
|
dae64bbe69 | ||
|
|
8b127bed84 | ||
|
|
67187b1340 | ||
|
|
02cac57438 | ||
|
|
277dcd174c | ||
|
|
3c23ae7310 | ||
|
|
8cb13d40b5 | ||
|
|
c950d31960 | ||
|
|
ae570cd5b7 | ||
|
|
0fd1dc4fce | ||
|
|
f0854e8518 | ||
|
|
ceffd3f759 | ||
|
|
dc1816612c | ||
|
|
1d04a7e0e3 | ||
|
|
1e523c4e93 | ||
|
|
d83f766cf3 | ||
|
|
bb5e1ae63d | ||
|
|
f27a4f6c95 | ||
|
|
d7ff92106a | ||
|
|
34a17acaba | ||
|
|
110aec0b6f | ||
|
|
06502bb49b | ||
|
|
c20a166134 | ||
|
|
162fa8e2de | ||
|
|
ae5614d212 | ||
|
|
b72d8a8bab | ||
|
|
d4cf890d8a | ||
|
|
82e494269d | ||
|
|
c982d65675 | ||
|
|
f4e606fb15 | ||
|
|
9dbdb5e771 | ||
|
|
fa12478fdd | ||
|
|
c3b0d8ef03 | ||
|
|
cbb9a168e6 | ||
|
|
73e2fc58a0 | ||
|
|
500f4c69eb | ||
|
|
911ad29004 | ||
|
|
aa843b5a31 | ||
|
|
f249acc50f | ||
|
|
8cdedbe18a | ||
|
|
0f39d71f95 | ||
|
|
1dc49b527b | ||
|
|
9422608960 | ||
|
|
cc3fec0768 | ||
|
|
de37ddcfb5 | ||
|
|
4c90196890 | ||
|
|
5270574e5a | ||
|
|
30f6ca6ffc | ||
|
|
a8af973726 | ||
|
|
ed1f8dd2b6 | ||
|
|
e8aaae1343 | ||
|
|
ecff3240a6 | ||
|
|
ddd4a0c24d | ||
|
|
019949847a | ||
|
|
4dcbf269d2 | ||
|
|
036317f371 | ||
|
|
ce0da01163 | ||
|
|
75ae619e21 | ||
|
|
3efa5acfa6 | ||
|
|
9369dc3031 | ||
|
|
5d84d3fef7 | ||
|
|
51baf75af1 | ||
|
|
20f2c98d18 | ||
|
|
e3ceae412b | ||
|
|
7e6affed12 | ||
|
|
40fc5463f3 | ||
|
|
039948f4d2 | ||
|
|
bbb95e8a60 | ||
|
|
7763d00b78 | ||
|
|
3452730725 | ||
|
|
e50f61f5d9 | ||
|
|
a7a4308e3c | ||
|
|
e811576e79 | ||
|
|
960abec0ed | ||
|
|
855ab88d6c | ||
|
|
f7ee6e78f0 | ||
|
|
293c58aeba | ||
|
|
95b8a4c3c4 | ||
|
|
b7fd52de79 | ||
|
|
53ce764548 | ||
|
|
157e74907a | ||
|
|
015ac26e07 | ||
|
|
1fe7faaa8d | ||
|
|
2e7f99897d | ||
|
|
d7fa65ad20 | ||
|
|
ae614ce476 | ||
|
|
7d6e1cce2f | ||
|
|
bbf46cad9d | ||
|
|
68c7b4b3c8 | ||
|
|
5d38a6c8c5 | ||
|
|
99a0c44f98 | ||
|
|
1812ba20e2 | ||
|
|
771d3c399c | ||
|
|
af74a4449e | ||
|
|
8c171dd2c7 | ||
|
|
3292ed6f1a | ||
|
|
96bbe0c4cc | ||
|
|
039e14de5a | ||
|
|
a419c8097f | ||
|
|
3fac2e8945 | ||
|
|
c2d6d272a3 | ||
|
|
846630e300 | ||
|
|
cc1f3d256b | ||
|
|
243a760a12 | ||
|
|
4f744fc8fe | ||
|
|
54adf9ad68 | ||
|
|
8b66adb8a5 | ||
|
|
9f0c1fc797 | ||
|
|
4a46e16702 | ||
|
|
608d011b44 | ||
|
|
0d52ba66cd | ||
|
|
431fac1fca | ||
|
|
35006d6031 | ||
|
|
7ae66337ef | ||
|
|
b75e0f9800 | ||
|
|
ee3fd4d6b8 | ||
|
|
0352f4b832 | ||
|
|
7fbfeb2edd | ||
|
|
8db69f073b | ||
|
|
226fa1c1ea | ||
|
|
6f41ae58db | ||
|
|
ae9186392f | ||
|
|
4279ffd887 | ||
|
|
ac058ea112 | ||
|
|
5d42e5e87a | ||
|
|
96ac6967e6 | ||
|
|
0c301f3cec | ||
|
|
d7cadd05d6 | ||
|
|
2f8464b7f5 | ||
|
|
96314749da | ||
|
|
33f06d744f | ||
|
|
d6ca48d80a | ||
|
|
c8b628393b | ||
|
|
e9d4eb1e1b | ||
|
|
89f78a9969 | ||
|
|
94f9935ad4 | ||
|
|
66c7db5a47 | ||
|
|
b959de3d26 | ||
|
|
b802485e31 | ||
|
|
ee20fd60c4 | ||
|
|
52174e2ab0 | ||
|
|
216f3c1d62 | ||
|
|
7e6954304a | ||
|
|
8718ae0aa8 | ||
|
|
615311ecd6 | ||
|
|
3a4ef4f6d6 | ||
|
|
403cfa77ae | ||
|
|
c7998a82d5 | ||
|
|
86bc9f4a64 | ||
|
|
2f4c4624ae | ||
|
|
b83e5f87cf | ||
|
|
b49e2753df | ||
|
|
3c09e1d736 | ||
|
|
0f07dafb36 | ||
|
|
38fdca0b97 | ||
|
|
e8efe2d290 | ||
|
|
a1ae55125a | ||
|
|
706692c1fe | ||
|
|
582f031243 | ||
|
|
9c78373c73 | ||
|
|
e9f3416438 | ||
|
|
ea44a77f8a | ||
|
|
63d7051c4b | ||
|
|
4803c9d221 | ||
|
|
6388edb706 | ||
|
|
0774ade030 | ||
|
|
e5ee766961 | ||
|
|
274f3d0c7a | ||
|
|
21be683768 | ||
|
|
695923aed7 | ||
|
|
649153257d | ||
|
|
cbcd3f8023 | ||
|
|
41c5ce8d4e | ||
|
|
78ce23258b | ||
|
|
3e864fda17 | ||
|
|
0cdb945d9c | ||
|
|
15a113f783 | ||
|
|
67f00d2123 | ||
|
|
d68dcd14e1 | ||
|
|
32994210ab | ||
|
|
cfec8ab88a | ||
|
|
87c44c3218 | ||
|
|
35446df6d5 | ||
|
|
921b38bfb4 | ||
|
|
82bb924d0b | ||
|
|
08a6769bc0 | ||
|
|
dce87061d1 | ||
|
|
f4302e4fa9 | ||
|
|
0436953451 | ||
|
|
7165907ba9 | ||
|
|
e938127c7a | ||
|
|
b5c9d6bc50 | ||
|
|
f7af5091cf | ||
|
|
7ac1786a2e | ||
|
|
19a919e096 | ||
|
|
10f5506829 | ||
|
|
d3c6d54a58 | ||
|
|
6980428f82 | ||
|
|
1a3b16f614 | ||
|
|
e0b9f462ce | ||
|
|
f6f7470385 | ||
|
|
214c708b49 | ||
|
|
d567185fc0 | ||
|
|
24188bda10 | ||
|
|
1a870c5c07 | ||
|
|
fa964802d9 | ||
|
|
793180ce12 | ||
|
|
79e7be470c | ||
|
|
921f156128 | ||
|
|
c771fc67ac | ||
|
|
7f2d2ffa4a | ||
|
|
2d9e1c6d95 | ||
|
|
66dafa6021 | ||
|
|
2df3d054e8 | ||
|
|
c9cfa2126e | ||
|
|
2220578cd1 | ||
|
|
5b18807f0e | ||
|
|
d984a4ba31 | ||
|
|
7dc00d9b23 | ||
|
|
59123f1c89 | ||
|
|
aa1df93a22 | ||
|
|
c99617427a | ||
|
|
54a4677f11 | ||
|
|
edeb388233 | ||
|
|
034d484271 | ||
|
|
ebf5da9840 | ||
|
|
f9c9084584 | ||
|
|
d160f464b6 | ||
|
|
c013252a59 | ||
|
|
7fa71dc5c5 | ||
|
|
a19dfb88a0 | ||
|
|
738cd059a2 | ||
|
|
aaa6a0452f | ||
|
|
0cb18839a2 | ||
|
|
991e1af331 | ||
|
|
c8a278d009 | ||
|
|
39f5478ea9 | ||
|
|
d0b1686a84 | ||
|
|
95bd8ec2fe | ||
|
|
85b5151e1a | ||
|
|
a0be13adba | ||
|
|
a0fb8fd73d | ||
|
|
d3e70b99c0 | ||
|
|
0a0ec6acf5 | ||
|
|
50df100569 | ||
|
|
02489e617c | ||
|
|
2f22050add | ||
|
|
0081c8f7c7 | ||
|
|
12c1036f17 | ||
|
|
7ef7129f7a | ||
|
|
5cb6346017 | ||
|
|
5e599e5445 | ||
|
|
146c07a25e | ||
|
|
44265c3fcd | ||
|
|
90c7574e28 | ||
|
|
e4fbb6f956 | ||
|
|
ad2f9f8aa6 | ||
|
|
9c470950ea | ||
|
|
0ddb0be65a | ||
|
|
cbd3bc95a1 | ||
|
|
f43795714d | ||
|
|
586c9c28b4 | ||
|
|
f79dc2da43 | ||
|
|
3bb485a437 | ||
|
|
8dd0043072 | ||
|
|
4c43fe3502 | ||
|
|
92f7709a76 | ||
|
|
04f40282d2 | ||
|
|
4b1804847f | ||
|
|
4e791d486f | ||
|
|
9a8732fba4 | ||
|
|
adddbb4e50 | ||
|
|
af4df4177d | ||
|
|
fa54c5c5a0 | ||
|
|
768e6c8511 | ||
|
|
eb1b9e0d78 | ||
|
|
2f80d97e17 | ||
|
|
d9246c333e | ||
|
|
164a6e009b | ||
|
|
69aba7d0b7 | ||
|
|
60f393f878 | ||
|
|
a14451b5e9 | ||
|
|
946bbc3023 | ||
|
|
474e75f649 | ||
|
|
3c65fd8d9e | ||
|
|
066011c5fb | ||
|
|
e14fc55030 | ||
|
|
d7b61258ce | ||
|
|
ffd544c42a | ||
|
|
cb99269a6d | ||
|
|
74b9ea9f89 | ||
|
|
aa863662b8 | ||
|
|
118e78ceb2 | ||
|
|
b14cdf50e6 | ||
|
|
39dd9b03f9 | ||
|
|
5d55258383 | ||
|
|
3256809066 | ||
|
|
dfbb1e5b98 | ||
|
|
e9915c44f9 | ||
|
|
a90ba862df | ||
|
|
b6ab624862 | ||
|
|
f66138505f | ||
|
|
dab91bdfac | ||
|
|
101d155855 | ||
|
|
10d7b4905b | ||
|
|
3afad00a84 | ||
|
|
ab8b06bacd | ||
|
|
9cfb96e358 | ||
|
|
2fb79735c3 | ||
|
|
a4e59986a8 | ||
|
|
93b4ec47d1 | ||
|
|
a4b1d12f36 | ||
|
|
217485e021 | ||
|
|
1f41d6d282 | ||
|
|
6876a8d649 | ||
|
|
02c159c5fd | ||
|
|
a1e204c117 | ||
|
|
ece9f7cd46 | ||
|
|
16dab991e0 | ||
|
|
c17975943a | ||
|
|
9d9ee98eaf | ||
|
|
b0bcac6926 | ||
|
|
3b7ad53994 | ||
|
|
0fedfae1e6 | ||
|
|
3fa2a35c12 | ||
|
|
a39859a39e | ||
|
|
d2f4a84314 | ||
|
|
0959eacf39 | ||
|
|
78c4b3b264 | ||
|
|
9f4a841eb6 | ||
|
|
9b034fcbb2 | ||
|
|
81cf964168 | ||
|
|
b5158210a9 | ||
|
|
d1602710a8 | ||
|
|
ec1453831d | ||
|
|
c63af629ac | ||
|
|
916b1d46fc | ||
|
|
7df694fe49 | ||
|
|
071289b56e | ||
|
|
eca355016c | ||
|
|
0053d12407 | ||
|
|
4d6ee985b9 | ||
|
|
94d74d35db | ||
|
|
d6a157578d | ||
|
|
0b9f3106fe | ||
|
|
17c75bf671 | ||
|
|
d6a9c2ed90 | ||
|
|
9931dc13a7 | ||
|
|
4a3d5a7d66 |
No files matched your search
@@ -1,40 +0,0 @@
|
|||||||
name: Build validation
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request_target:
|
|
||||||
branches: [main]
|
|
||||||
types: [opened, synchronize, reopened, edited, ready_for_review]
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
workflow_run:
|
|
||||||
workflows: [Build APK]
|
|
||||||
types: [completed]
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
pr_number:
|
|
||||||
description: Pull request to validate; empty for main
|
|
||||||
required: false
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
actions: read
|
|
||||||
pull-requests: read
|
|
||||||
statuses: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
validate:
|
|
||||||
name: Validate source and build result
|
|
||||||
runs-on: ubuntu-24.04
|
|
||||||
timeout-minutes: 5
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: ${{ github.workflow_sha }}
|
|
||||||
fetch-depth: 0
|
|
||||||
persist-credentials: false
|
|
||||||
- name: Validate source and APK compilation
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
run: |
|
|
||||||
gh auth setup-git
|
|
||||||
python3 tools/release/validate_apk.py
|
|
||||||
@@ -64,7 +64,6 @@ jobs:
|
|||||||
KDE_KWIN_OVERRIDE="$PWD/out/kwin" tools/desktop-kde/build.sh out
|
KDE_KWIN_OVERRIDE="$PWD/out/kwin" tools/desktop-kde/build.sh out
|
||||||
cp out/kwin/desktop-kde.kwin.txt out/
|
cp out/kwin/desktop-kde.kwin.txt out/
|
||||||
echo "size $(stat -c %s out/desktop-kde.tar.zst) sha256 $(cat out/desktop-kde.sha256)"
|
echo "size $(stat -c %s out/desktop-kde.tar.zst) sha256 $(cat out/desktop-kde.sha256)"
|
||||||
echo "language packs $(ls out/desktop-kde-i18n-*.tar.zst | wc -l)"
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: desktop-kde
|
name: desktop-kde
|
||||||
@@ -75,8 +74,6 @@ jobs:
|
|||||||
out/desktop-kde.packages.txt
|
out/desktop-kde.packages.txt
|
||||||
out/desktop-kde.kwin.txt
|
out/desktop-kde.kwin.txt
|
||||||
out/desktop-kde.sha256
|
out/desktop-kde.sha256
|
||||||
out/desktop-kde.i18n.txt
|
|
||||||
out/desktop-kde-i18n-*.tar.zst
|
|
||||||
- name: Publish
|
- name: Publish
|
||||||
if: github.event_name == 'workflow_dispatch' && inputs.tag != ''
|
if: github.event_name == 'workflow_dispatch' && inputs.tag != ''
|
||||||
env:
|
env:
|
||||||
@@ -91,6 +88,5 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
gh release create "$TAG" --latest=false --prerelease=false --title "$TAG" \
|
gh release create "$TAG" --latest=false --prerelease=false --title "$TAG" \
|
||||||
--notes "KDE Plasma desktop package for DroidDeck's Linux runtime ($GITHUB_REPOSITORY tools/desktop-kde, $GITHUB_SHA). size $(stat -c %s out/desktop-kde.tar.zst), sha256 $(cat out/desktop-kde.sha256). desktop-kde.packages.txt lists the signature-checked Arch Linux ARM packages it was built from." \
|
--notes "KDE Plasma desktop package for DroidDeck's Linux runtime ($GITHUB_REPOSITORY tools/desktop-kde, $GITHUB_SHA). size $(stat -c %s out/desktop-kde.tar.zst), sha256 $(cat out/desktop-kde.sha256). desktop-kde.packages.txt lists the signature-checked Arch Linux ARM packages it was built from." \
|
||||||
out/desktop-kde.tar.zst out/desktop-kde.sha256 out/desktop-kde.packages.txt out/desktop-kde.kwin.txt \
|
out/desktop-kde.tar.zst out/desktop-kde.sha256 out/desktop-kde.packages.txt out/desktop-kde.kwin.txt
|
||||||
out/desktop-kde.i18n.txt out/desktop-kde-i18n-*.tar.zst
|
|
||||||
gh release edit "$TAG" --latest=false --prerelease=false
|
gh release edit "$TAG" --latest=false --prerelease=false
|
||||||
+438
-410
@@ -16,263 +16,21 @@ on:
|
|||||||
- 'LICENSE'
|
- 'LICENSE'
|
||||||
- '.gitignore'
|
- '.gitignore'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
|
||||||
rebuild_preloads:
|
|
||||||
description: Rebuild preloads instead of reusing the approved binary snapshot
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
actions: read
|
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: build-${{ github.event.pull_request.number || github.run_id }}
|
group: build-${{ github.event.pull_request.number || github.run_id }}
|
||||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||||
|
|
||||||
|
env:
|
||||||
|
PRELOAD_CACHE_VERSION: v6
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
source:
|
|
||||||
name: Pin source tree
|
|
||||||
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
|
|
||||||
runs-on: ubuntu-24.04
|
|
||||||
timeout-minutes: 5
|
|
||||||
outputs:
|
|
||||||
base-sha: ${{ steps.merge.outputs.base-sha || steps.trusted.outputs.base-sha }}
|
|
||||||
tree-sha: ${{ steps.source.outputs.tree-sha }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
|
|
||||||
fetch-depth: 0
|
|
||||||
persist-credentials: false
|
|
||||||
- name: Pin and merge the APK source
|
|
||||||
id: merge
|
|
||||||
if: github.event_name == 'pull_request'
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
git fetch --no-tags origin main
|
|
||||||
echo "base-sha=$(git rev-parse origin/main)" >> "$GITHUB_OUTPUT"
|
|
||||||
git config user.name "ci"
|
|
||||||
git config user.email "ci@users.noreply.github.com"
|
|
||||||
git merge --no-ff --no-edit origin/main
|
|
||||||
- name: Resolve trusted manifest base
|
|
||||||
id: trusted
|
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
git fetch --no-tags origin main
|
|
||||||
echo "base-sha=$(git rev-parse origin/main)" >> "$GITHUB_OUTPUT"
|
|
||||||
- name: Record pinned source tree
|
|
||||||
id: source
|
|
||||||
run: echo "tree-sha=$(git rev-parse 'HEAD^{tree}')" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
xbox:
|
|
||||||
name: Xbox ARM64 backend
|
|
||||||
needs: source
|
|
||||||
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
|
|
||||||
runs-on: ubuntu-24.04-arm
|
|
||||||
timeout-minutes: 30
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
|
|
||||||
fetch-depth: 0
|
|
||||||
persist-credentials: false
|
|
||||||
- name: Merge the pinned APK base
|
|
||||||
if: github.event_name == 'pull_request'
|
|
||||||
env:
|
|
||||||
BUILD_BASE_SHA: ${{ needs.source.outputs.base-sha }}
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
git fetch --no-tags origin "$BUILD_BASE_SHA"
|
|
||||||
git config user.name "ci"
|
|
||||||
git config user.email "ci@users.noreply.github.com"
|
|
||||||
git merge --no-ff --no-edit FETCH_HEAD
|
|
||||||
- name: Verify pinned source tree
|
|
||||||
env:
|
|
||||||
SOURCE_TREE: ${{ needs.source.outputs.tree-sha }}
|
|
||||||
run: test "$(git rev-parse 'HEAD^{tree}')" = "$SOURCE_TREE"
|
|
||||||
- name: Plan component identities
|
|
||||||
id: plan
|
|
||||||
run: python3 tools/components/prepare.py plan
|
|
||||||
- uses: actions/cache@v4
|
|
||||||
id: xbox-cache
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
app/src/main/assets/linuxfs/usr/local/lib/droiddeck-xbox
|
|
||||||
app/build/xbox/xodus-droiddeck-source.tar.xz
|
|
||||||
app/build/xbox/runtime/*-source.tar.xz
|
|
||||||
key: xbox-v2-${{ steps.plan.outputs.xbox }}
|
|
||||||
- name: Build Xbox backend
|
|
||||||
if: steps.xbox-cache.outputs.cache-hit != 'true'
|
|
||||||
run: python3 tools/components/prepare.py xbox
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: xbox-arm64
|
|
||||||
path: app/src/main/assets/linuxfs/usr/local/lib/droiddeck-xbox
|
|
||||||
retention-days: 14
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: xbox-corresponding-source
|
|
||||||
path: |
|
|
||||||
app/build/xbox/xodus-droiddeck-source.tar.xz
|
|
||||||
app/build/xbox/runtime/*-source.tar.xz
|
|
||||||
if-no-files-found: error
|
|
||||||
retention-days: 14
|
|
||||||
|
|
||||||
components:
|
|
||||||
name: Prepare verified components
|
|
||||||
needs: source
|
|
||||||
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
|
|
||||||
runs-on: ubuntu-24.04
|
|
||||||
timeout-minutes: 40
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
|
|
||||||
fetch-depth: 0
|
|
||||||
persist-credentials: false
|
|
||||||
- name: Merge the pinned APK base
|
|
||||||
if: github.event_name == 'pull_request'
|
|
||||||
env:
|
|
||||||
BUILD_BASE_SHA: ${{ needs.source.outputs.base-sha }}
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
git fetch --no-tags origin "$BUILD_BASE_SHA"
|
|
||||||
git config user.name "ci"
|
|
||||||
git config user.email "ci@users.noreply.github.com"
|
|
||||||
git merge --no-ff --no-edit FETCH_HEAD
|
|
||||||
- name: Verify pinned source tree
|
|
||||||
env:
|
|
||||||
SOURCE_TREE: ${{ needs.source.outputs.tree-sha }}
|
|
||||||
run: test "$(git rev-parse 'HEAD^{tree}')" = "$SOURCE_TREE"
|
|
||||||
- name: Resolve the pinned Android NDK
|
|
||||||
run: bash tools/ci/resolve-ndk.sh
|
|
||||||
|
|
||||||
- name: Plan component identities
|
|
||||||
id: plan
|
|
||||||
run: python3 tools/components/prepare.py plan
|
|
||||||
- name: Cache remaining Linux runtime assets
|
|
||||||
id: preloads
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
app/src/main/assets/linuxfs
|
|
||||||
!app/src/main/assets/linuxfs/usr/local/lib/droiddeck-comet
|
|
||||||
!app/src/main/assets/linuxfs/usr/local/lib/droiddeck-xbox
|
|
||||||
!app/src/main/assets/linuxfs/i386/libblsession.so
|
|
||||||
!app/src/main/assets/linuxfs/i386/libfakeinput.so
|
|
||||||
!app/src/main/assets/linuxfs/i386/libfaultreport.so
|
|
||||||
!app/src/main/assets/linuxfs/libblaudit.so
|
|
||||||
!app/src/main/assets/linuxfs/libblfastpath.so
|
|
||||||
!app/src/main/assets/linuxfs/libblsession.so
|
|
||||||
!app/src/main/assets/linuxfs/libfakeinput.so
|
|
||||||
!app/src/main/assets/linuxfs/libssbs.so
|
|
||||||
!app/src/main/assets/linuxfs/usr/local/bin/droiddeck-clipboard
|
|
||||||
!app/src/main/assets/linuxfs/x86_64/libblsession.so
|
|
||||||
!app/src/main/assets/linuxfs/x86_64/libfakeinput.so
|
|
||||||
!app/src/main/assets/linuxfs/x86_64/libfaultreport.so
|
|
||||||
!app/src/main/assets/linuxfs/x86_64/libvulkan-thunk.so
|
|
||||||
!app/src/main/assets/linuxfs/x86_64/libwebkitinput.so
|
|
||||||
key: runtime-v9-${{ steps.plan.outputs.runtime }}
|
|
||||||
|
|
||||||
- name: Cache PulseAudio 13.0 source
|
|
||||||
id: pa-src
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: pa13
|
|
||||||
key: pulseaudio-src-${{ steps.plan.outputs.pulseaudio-source }}
|
|
||||||
- name: Cache proot
|
|
||||||
id: proot
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
app/src/main/jniLibs/arm64-v8a/libproot.so
|
|
||||||
app/src/main/jniLibs/arm64-v8a/libproot-loader.so
|
|
||||||
key: proot-v2-${{ steps.plan.outputs.proot }}
|
|
||||||
- name: Cache GOG Galaxy companion
|
|
||||||
id: comet
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: app/src/main/assets/linuxfs/usr/local/lib/droiddeck-comet
|
|
||||||
key: comet-v2-${{ steps.plan.outputs.comet }}
|
|
||||||
|
|
||||||
- name: Restore verified preload snapshots
|
|
||||||
id: component-preloads
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
FORCE_PRELOAD_REBUILD: ${{ inputs.rebuild_preloads || 'false' }}
|
|
||||||
COMPONENT_TRUSTED_BASE: ${{ needs.source.outputs.base-sha }}
|
|
||||||
run: python3 tools/components/prepare.py preload-snapshot
|
|
||||||
|
|
||||||
- name: Prepare required Linux build tools once
|
|
||||||
env:
|
|
||||||
COMPONENTS_TO_BUILD: >-
|
|
||||||
${{ steps.preloads.outputs.cache-hit != 'true' && 'runtime' || '' }}
|
|
||||||
${{ steps.component-preloads.outputs.arm64 != 'true' && 'arm64-preloads' || '' }}
|
|
||||||
${{ steps.comet.outputs.cache-hit != 'true' && 'comet' || '' }}
|
|
||||||
run: python3 tools/components/prepare.py tools
|
|
||||||
|
|
||||||
- name: Build changed ARM64 preloads
|
|
||||||
if: steps.component-preloads.outputs.arm64 != 'true'
|
|
||||||
run: python3 tools/components/prepare.py arm64-preloads
|
|
||||||
|
|
||||||
- name: Prepare remaining Linux runtime assets
|
|
||||||
if: steps.preloads.outputs.cache-hit != 'true'
|
|
||||||
run: python3 tools/components/prepare.py runtime
|
|
||||||
|
|
||||||
- name: Fetch the Debian image the preloads build in
|
|
||||||
if: steps.component-preloads.outputs.x86 != 'true'
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
run: python3 tools/components/prepare.py debian-image
|
|
||||||
|
|
||||||
- name: Build the x86 preloads FEX guests load (glibc 2.31)
|
|
||||||
if: steps.component-preloads.outputs.x86 != 'true'
|
|
||||||
run: python3 tools/components/prepare.py x86-preloads
|
|
||||||
|
|
||||||
- name: Bundle the droiddeck-esync packs
|
|
||||||
run: python3 tools/components/prepare.py esync
|
|
||||||
|
|
||||||
- name: Fetch PulseAudio 13.0 source
|
|
||||||
if: steps.pa-src.outputs.cache-hit != 'true'
|
|
||||||
run: python3 tools/components/prepare.py pulseaudio-source
|
|
||||||
|
|
||||||
- name: Fetch DirectAudio (tools/directaudio/release.env)
|
|
||||||
run: python3 tools/components/prepare.py directaudio
|
|
||||||
|
|
||||||
- name: Build the AAudio sink into the audio bundle
|
|
||||||
run: python3 tools/components/prepare.py audio
|
|
||||||
|
|
||||||
- name: Build proot
|
|
||||||
if: steps.proot.outputs.cache-hit != 'true'
|
|
||||||
run: python3 tools/components/prepare.py proot
|
|
||||||
|
|
||||||
- name: Check the preloads
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
bash tools/linuxfs/check-preloads.sh app/src/main/assets/linuxfs
|
|
||||||
|
|
||||||
- name: Build GOG Galaxy companion
|
|
||||||
if: steps.comet.outputs.cache-hit != 'true'
|
|
||||||
run: python3 tools/components/prepare.py comet
|
|
||||||
|
|
||||||
- name: Prepare graphics driver variants
|
|
||||||
run: python3 tools/quest/build-driver.py "$ANDROID_HOME/ndk/$NDK_VERSION"
|
|
||||||
- name: Record and pack prepared components
|
|
||||||
run: python3 tools/components/prepare.py pack
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: prepared-components
|
|
||||||
path: app/build/prepared-components.tar.gz
|
|
||||||
if-no-files-found: error
|
|
||||||
compression-level: 0
|
|
||||||
retention-days: 14
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
needs: [source, components, xbox]
|
name: Build APK
|
||||||
name: Compile APK and Android tests
|
|
||||||
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
|
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
@@ -283,24 +41,18 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
|
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Check human authorship
|
- name: Check co-authors
|
||||||
env:
|
if: github.event_name == 'pull_request'
|
||||||
EVENT_NAME: ${{ github.event_name }}
|
|
||||||
BEFORE: ${{ github.event.before }}
|
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
if [ "$EVENT_NAME" = pull_request ]; then
|
git fetch --no-tags origin main
|
||||||
git fetch --no-tags origin main
|
base=$(git merge-base origin/main HEAD)
|
||||||
base=$(git merge-base origin/main HEAD)
|
messages=$(git log --format=%B "$base..HEAD")
|
||||||
checker="$RUNNER_TEMP/droiddeck-check-authorship.py"
|
messages+=$'\n'"$(jq -r '.pull_request.title, (.pull_request.body // "")' "$GITHUB_EVENT_PATH")"
|
||||||
git show origin/main:tools/release/check_authorship.py > "$checker"
|
if grep -Eiq '^[[:space:]]*Co-authored-by:.*(Claude|Anthropic|OpenAI|ChatGPT|GPT|Copilot|Cursor|Gemini|Codex|Devin|Windsurf|Codeium|Amazon Q|Tabnine|Cody|\[bot\])' <<<"$messages"; then
|
||||||
python3 "$checker" "$base..HEAD" --event "$GITHUB_EVENT_PATH"
|
echo "::error::AI and bot identities cannot be co-authors; remove the Co-authored-by trailer."
|
||||||
elif [ "$EVENT_NAME" = push ] && [ "$BEFORE" != 0000000000000000000000000000000000000000 ]; then
|
exit 1
|
||||||
python3 tools/release/check_authorship.py "$BEFORE..HEAD"
|
|
||||||
else
|
|
||||||
python3 tools/release/check_authorship.py HEAD
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: The packages a signed build ships as
|
- name: The packages a signed build ships as
|
||||||
@@ -334,17 +86,14 @@ jobs:
|
|||||||
|
|
||||||
- name: Merge onto main, or say what conflicts
|
- name: Merge onto main, or say what conflicts
|
||||||
if: github.event_name == 'pull_request'
|
if: github.event_name == 'pull_request'
|
||||||
env:
|
|
||||||
BUILD_BASE_SHA: ${{ needs.source.outputs.base-sha }}
|
|
||||||
run: |
|
run: |
|
||||||
set -uo pipefail
|
set -uo pipefail
|
||||||
git config user.name "ci"
|
git config user.name "ci"
|
||||||
git config user.email "ci@users.noreply.github.com"
|
git config user.email "ci@users.noreply.github.com"
|
||||||
git fetch --no-tags origin main
|
git fetch --no-tags origin main
|
||||||
git fetch --no-tags origin "$BUILD_BASE_SHA"
|
BASE=$(git rev-parse --short origin/main)
|
||||||
BASE=$(git rev-parse --short FETCH_HEAD)
|
|
||||||
HEAD=$(git rev-parse --short HEAD)
|
HEAD=$(git rev-parse --short HEAD)
|
||||||
if git merge --no-ff --no-edit FETCH_HEAD >/tmp/merge.out 2>&1; then
|
if git merge --no-ff --no-edit origin/main >/tmp/merge.out 2>&1; then
|
||||||
{
|
{
|
||||||
echo "### Mergeable"
|
echo "### Mergeable"
|
||||||
echo
|
echo
|
||||||
@@ -391,11 +140,6 @@ jobs:
|
|||||||
echo "::error::the pull request conflicts with main: $(echo $FILES | tr '\n' ' ')"
|
echo "::error::the pull request conflicts with main: $(echo $FILES | tr '\n' ' ')"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
- name: Verify backend and APK source match
|
|
||||||
env:
|
|
||||||
XBOX_SOURCE_TREE: ${{ needs.source.outputs.tree-sha }}
|
|
||||||
run: test "$(git rev-parse 'HEAD^{tree}')" = "$XBOX_SOURCE_TREE"
|
|
||||||
|
|
||||||
- uses: actions/setup-java@v4
|
- uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
@@ -403,11 +147,13 @@ jobs:
|
|||||||
|
|
||||||
- uses: gradle/actions/setup-gradle@v4
|
- uses: gradle/actions/setup-gradle@v4
|
||||||
with:
|
with:
|
||||||
cache-read-only: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }}
|
|
||||||
cache-cleanup: on-success
|
cache-cleanup: on-success
|
||||||
|
|
||||||
- name: Resolve the pinned Android NDK
|
- name: Resolve the runner's NDK
|
||||||
run: bash tools/ci/resolve-ndk.sh
|
run: |
|
||||||
|
NDK="${ANDROID_NDK_LATEST_HOME:-${ANDROID_NDK_HOME:-$ANDROID_NDK_ROOT}}"
|
||||||
|
VERSION=$(sed -n 's/^Pkg.Revision *= *//p' "$NDK/source.properties")
|
||||||
|
echo "NDK_VERSION=$VERSION" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
- name: Set the APK build label
|
- name: Set the APK build label
|
||||||
id: build-label
|
id: build-label
|
||||||
@@ -433,6 +179,253 @@ jobs:
|
|||||||
echo "DROIDDECK_PR_NUMBER=${PR_NUMBER:-0}" >> "$GITHUB_ENV"
|
echo "DROIDDECK_PR_NUMBER=${PR_NUMBER:-0}" >> "$GITHUB_ENV"
|
||||||
echo "Build: \`$label\`" >> "$GITHUB_STEP_SUMMARY"
|
echo "Build: \`$label\`" >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
|
||||||
|
- name: Cache the preloads
|
||||||
|
id: preloads
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: app/src/main/assets/linuxfs
|
||||||
|
key: preloads-${{ env.PRELOAD_CACHE_VERSION }}-${{ hashFiles('app/src/main/cpp/fakeinput_steam.cpp', 'app/src/main/cpp/adrenotools/src/hook/kgsl.h', 'tools/quest/*', 'tools/linuxfs/preload/*.c', 'tools/linuxfs/build-x86-preloads.sh', 'tools/linuxfs/fex/*', 'tools/linuxfs/clipboard/*.c', 'tools/linuxfs/ssbs/*.c', 'tools/proot/fastpath/*.c', 'tools/linuxfs/overlay/usr/local/bin/*', 'tools/linuxfs/overlay/usr/bin/**', 'tools/linuxfs/desktop/*', 'tools/gamescope/release.env', 'tools/wlroots/release.env', 'tools/linuxfs/uruntime.env', 'tools/linuxfs/licenses/*', 'tools/mangoapp/*', 'tools/msitools/**', 'tools/comet/**', 'tools/linuxfs/debian-image.env', 'tools/vr/**') }}
|
||||||
|
|
||||||
|
- name: Build libfakeinput.so and libblsession.so (glibc aarch64)
|
||||||
|
if: steps.preloads.outputs.cache-hit != 'true'
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
sudo apt-get update -qq
|
||||||
|
sudo apt-get install -y -qq gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libvulkan1 mesa-vulkan-drivers >/dev/null
|
||||||
|
D=app/src/main/assets/linuxfs
|
||||||
|
mkdir -p "$D"
|
||||||
|
aarch64-linux-gnu-g++ -shared -fPIC -O2 -Wall -Wno-attributes -Wno-nonnull-compare \
|
||||||
|
-pthread -std=c++17 -static-libstdc++ -static-libgcc -Wl,--exclude-libs,ALL \
|
||||||
|
-o "$D/libfakeinput.so" app/src/main/cpp/fakeinput_steam.cpp -ldl
|
||||||
|
aarch64-linux-gnu-strip --strip-unneeded "$D/libfakeinput.so"
|
||||||
|
aarch64-linux-gnu-gcc -shared -fPIC -O2 -Wall -pthread \
|
||||||
|
-o "$D/libblsession.so" tools/linuxfs/preload/*.c -ldl
|
||||||
|
aarch64-linux-gnu-strip --strip-unneeded "$D/libblsession.so"
|
||||||
|
aarch64-linux-gnu-gcc -shared -fPIC -O2 -Wall -pthread \
|
||||||
|
-o "$D/libblfastpath.so" tools/proot/fastpath/fastpath.c -ldl
|
||||||
|
aarch64-linux-gnu-strip --strip-unneeded "$D/libblfastpath.so"
|
||||||
|
aarch64-linux-gnu-gcc -shared -fPIC -O2 -Wall -nostdlib -ffreestanding -fno-stack-protector \
|
||||||
|
-fno-tree-loop-distribute-patterns -Wl,-z,defs -o "$D/libblaudit.so" tools/proot/fastpath/audit.c
|
||||||
|
aarch64-linux-gnu-strip --strip-unneeded "$D/libblaudit.so"
|
||||||
|
aarch64-linux-gnu-gcc -shared -fPIC -O2 -Wall -pthread \
|
||||||
|
-o "$D/libssbs.so" tools/linuxfs/ssbs/ssbs_adapter.c -ldl
|
||||||
|
aarch64-linux-gnu-strip --strip-unneeded "$D/libssbs.so"
|
||||||
|
mkdir -p "$D/usr/local/bin"
|
||||||
|
aarch64-linux-gnu-gcc -O2 -Wall -Wextra -o "$D/usr/local/bin/droiddeck-clipboard" tools/linuxfs/clipboard/clipboard.c -ldl
|
||||||
|
aarch64-linux-gnu-strip --strip-unneeded "$D/usr/local/bin/droiddeck-clipboard"
|
||||||
|
VK_INCLUDE=$(ls -d "${ANDROID_NDK_LATEST_HOME:-${ANDROID_NDK_HOME:-$ANDROID_NDK_ROOT}}"/toolchains/llvm/prebuilt/*/sysroot/usr/include | head -1) \
|
||||||
|
tools/vr/build.sh --native "$D/usr/local/lib/droiddeck-vr"
|
||||||
|
for script in tools/linuxfs/overlay/usr/local/bin/droiddeck-* tools/linuxfs/overlay/usr/local/bin/steam-compatibility; do
|
||||||
|
install -Dm644 "$script" "$D/usr/local/bin/$(basename "$script")"
|
||||||
|
done
|
||||||
|
for f in tools/linuxfs/overlay/usr/bin/* tools/linuxfs/overlay/usr/bin/steamos-polkit-helpers/*; do
|
||||||
|
[ -f "$f" ] && install -Dm644 "$f" "$D/${f#tools/linuxfs/overlay/}"
|
||||||
|
done
|
||||||
|
if [ -f tools/gamescope/release.env ]; then
|
||||||
|
. tools/gamescope/release.env
|
||||||
|
gh release download "${GAMESCOPE_TAG}" -R "${GAMESCOPE_REPO:-${GITHUB_REPOSITORY}}" -p gamescope.tzst -O gamescope.tzst
|
||||||
|
echo "${GAMESCOPE_SHA256} gamescope.tzst" | sha256sum -c -
|
||||||
|
tar --use-compress-program=unzstd -xf gamescope.tzst -C "$D"
|
||||||
|
test -f "$D/usr/local/bin/gamescope"
|
||||||
|
rm gamescope.tzst
|
||||||
|
fi
|
||||||
|
. tools/linuxfs/uruntime.env
|
||||||
|
curl -fsSL --retry 3 -o uruntime "https://github.com/VHSgunzo/uruntime/releases/download/${URUNTIME_VERSION}/${URUNTIME_ASSET}"
|
||||||
|
echo "${URUNTIME_SHA256} uruntime" | sha256sum -c -
|
||||||
|
install -Dm644 uruntime "$D/usr/local/lib/droiddeck/uruntime"
|
||||||
|
install -Dm644 tools/linuxfs/licenses/uruntime-LICENSE "$D/usr/local/share/licenses/uruntime/LICENSE"
|
||||||
|
rm uruntime
|
||||||
|
M="$D/usr/local/lib/mangoapp"
|
||||||
|
mkdir -p "$M" mango-pkgs
|
||||||
|
grep -v '^#' tools/mangoapp/packages.txt | while read -r sum url; do
|
||||||
|
[ -n "$url" ] || continue
|
||||||
|
curl -fsSL --retry 3 -o mango-pkgs/pkg.tar.zst "$url"
|
||||||
|
echo "$sum mango-pkgs/pkg.tar.zst" | sha256sum -c -
|
||||||
|
tar --use-compress-program=unzstd -xf mango-pkgs/pkg.tar.zst -C mango-pkgs
|
||||||
|
rm mango-pkgs/pkg.tar.zst
|
||||||
|
done
|
||||||
|
install -m644 mango-pkgs/usr/bin/mangoapp "$M/mangoapp"
|
||||||
|
for so in libfmt.so.10 libspdlog.so.1.13 libglfw.so.3 libtraceevent.so.1; do
|
||||||
|
cp -L "mango-pkgs/usr/lib/$so" "$M/$so"
|
||||||
|
done
|
||||||
|
aarch64-linux-gnu-gcc -shared -fPIC -O2 -Wall -Wl,-soname,libtracefs.so.1 \
|
||||||
|
-o "$M/libtracefs.so.1" tools/mangoapp/libtracefs-shim.c
|
||||||
|
aarch64-linux-gnu-strip --strip-unneeded "$M/libtracefs.so.1"
|
||||||
|
install -Dm644 tools/mangoapp/mangoapp "$D/usr/local/bin/mangoapp"
|
||||||
|
rm -rf mango-pkgs
|
||||||
|
ls -l "$M"
|
||||||
|
T="$D/usr/local/lib/droiddeck-msitools"
|
||||||
|
mkdir -p "$T" msi-pkgs
|
||||||
|
grep -v '^#' tools/msitools/packages.txt | while read -r sum url; do
|
||||||
|
[ -n "$url" ] || continue
|
||||||
|
curl -fsSL --retry 3 -o msi-pkgs/pkg.tar.xz "$url"
|
||||||
|
echo "$sum msi-pkgs/pkg.tar.xz" | sha256sum -c -
|
||||||
|
tar -xJf msi-pkgs/pkg.tar.xz -C msi-pkgs
|
||||||
|
rm msi-pkgs/pkg.tar.xz
|
||||||
|
done
|
||||||
|
install -m644 msi-pkgs/usr/bin/msiinfo "$T/msiinfo"
|
||||||
|
install -m644 msi-pkgs/usr/bin/cabextract "$T/cabextract"
|
||||||
|
install -m644 msi-pkgs/usr/lib/7zip/7z "$T/7z"
|
||||||
|
install -m644 msi-pkgs/usr/lib/7zip/7z.so "$T/7z.so"
|
||||||
|
for so in libmsi-1.0.so.0 libgsf-1.so.114 libgcab-1.0.so.0; do
|
||||||
|
cp -L "msi-pkgs/usr/lib/$so" "$T/$so"
|
||||||
|
done
|
||||||
|
for f in NOTICE GPL-2 GPL-3 LGPL-2.1 7zip-License 7zip-unRarLicense; do
|
||||||
|
install -Dm644 "tools/msitools/licenses/$f" "$D/usr/local/share/licenses/droiddeck-msitools/$f"
|
||||||
|
done
|
||||||
|
rm -rf msi-pkgs
|
||||||
|
ls -l "$T"
|
||||||
|
install -Dm644 tools/linuxfs/desktop/droiddeck-desktop "$D/usr/local/bin/droiddeck-desktop"
|
||||||
|
install -Dm644 tools/linuxfs/desktop/droiddeck-gpu "$D/usr/local/bin/droiddeck-gpu"
|
||||||
|
install -Dm644 tools/linuxfs/desktop/droiddeck-desktop-gpu "$D/usr/local/bin/droiddeck-desktop-gpu"
|
||||||
|
install -Dm644 tools/linuxfs/desktop/kwin_wayland_wrapper "$D/usr/local/bin/kwin_wayland_wrapper"
|
||||||
|
install -Dm644 tools/linuxfs/desktop/firefox-droiddeck.js "$D/usr/lib/firefox/defaults/pref/droiddeck.js"
|
||||||
|
ls -lR "$D"
|
||||||
|
|
||||||
|
- name: Fetch the Debian image the preloads build in
|
||||||
|
if: steps.preloads.outputs.cache-hit != 'true'
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
. tools/linuxfs/debian-image.env
|
||||||
|
image=public.ecr.aws/docker/library/debian:bullseye
|
||||||
|
if gh release download "$DEBIAN_IMAGE_TAG" -R "$GITHUB_REPOSITORY" -p "$DEBIAN_IMAGE_ASSET" -O /tmp/debian-image.tar.zst \
|
||||||
|
&& { [ -z "$DEBIAN_IMAGE_SHA256" ] || echo "$DEBIAN_IMAGE_SHA256 /tmp/debian-image.tar.zst" | sha256sum -c -; }; then
|
||||||
|
zstd -dc /tmp/debian-image.tar.zst | docker load
|
||||||
|
rm -f /tmp/debian-image.tar.zst
|
||||||
|
else
|
||||||
|
echo "::warning::the hosted Debian image could not be fetched; pulling from the registry instead"
|
||||||
|
for attempt in 1 2 3 4 5; do
|
||||||
|
docker pull "$image" && break
|
||||||
|
[ "$attempt" -lt 5 ] || { echo "::error::could not pull $image after $attempt attempts"; exit 1; }
|
||||||
|
echo "pull attempt $attempt failed (registry busy?); retrying in $((attempt * 30)) s"
|
||||||
|
sleep $((attempt * 30))
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
docker image ls "$image"
|
||||||
|
|
||||||
|
- name: Build the x86 preloads FEX guests load (glibc 2.31)
|
||||||
|
if: steps.preloads.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
docker run --rm -v "$PWD:/src" -w /src public.ecr.aws/docker/library/debian:bullseye bash -c '
|
||||||
|
set -euo pipefail
|
||||||
|
install_compilers() {
|
||||||
|
apt-get -o Acquire::Check-Valid-Until=false update -qq &&
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends gcc g++ gcc-multilib g++-multilib binutils >/dev/null
|
||||||
|
}
|
||||||
|
printf "deb http://deb.debian.org/debian bullseye main\ndeb http://security.debian.org/debian-security bullseye-security main\n" > /etc/apt/sources.list
|
||||||
|
if ! install_compilers; then
|
||||||
|
printf "deb http://archive.debian.org/debian bullseye main\ndeb http://archive.debian.org/debian-security bullseye-security main\n" > /etc/apt/sources.list
|
||||||
|
install_compilers
|
||||||
|
fi
|
||||||
|
tools/linuxfs/build-x86-preloads.sh app/src/main/assets/linuxfs
|
||||||
|
'
|
||||||
|
sudo chown -R "$(id -u):$(id -g)" app/src/main/assets/linuxfs
|
||||||
|
ls -l app/src/main/assets/linuxfs/x86_64 app/src/main/assets/linuxfs/i386
|
||||||
|
|
||||||
|
- name: Bundle the droiddeck-esync packs
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
if [ -f tools/droiddeck-esync/release.env ]; then
|
||||||
|
. tools/droiddeck-esync/release.env
|
||||||
|
gh release download "$SYNC_BUNDLE_TAG" -R "$SYNC_BUNDLE_REPO" -p "$SYNC_BUNDLE_ASSET" -O sync-bundle.tzst
|
||||||
|
echo "$SYNC_BUNDLE_SHA256 sync-bundle.tzst" | sha256sum -c -
|
||||||
|
mkdir -p app/src/main/assets/droiddeck-esync
|
||||||
|
tar --use-compress-program=unzstd -xf sync-bundle.tzst -C app/src/main/assets/droiddeck-esync
|
||||||
|
rm sync-bundle.tzst
|
||||||
|
gh release download "$SYNC_BUNDLE_TAG" -R "$SYNC_BUNDLE_REPO" -p index.json -O sync-index.json
|
||||||
|
revoked=$(python3 -c 'import json, sys; print(" ".join(p["id"] for p in json.load(open(sys.argv[1]))["packs"] if p.get("revoked") is True))' sync-index.json)
|
||||||
|
for id in $revoked; do
|
||||||
|
if [ -e "app/src/main/assets/droiddeck-esync/packs/$id.tzst" ]; then
|
||||||
|
echo "::warning::$SYNC_BUNDLE_ASSET carries revoked pack $id; it is left out of the APK (point tools/droiddeck-esync/release.env at a newer bundle)"
|
||||||
|
rm -f "app/src/main/assets/droiddeck-esync/packs/$id.tzst"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
rm sync-index.json
|
||||||
|
test -f app/src/main/assets/droiddeck-esync/index.json
|
||||||
|
test -f app/src/main/assets/droiddeck-esync/index.json.sig
|
||||||
|
ls -lR app/src/main/assets/droiddeck-esync
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Cache PulseAudio 13.0 source
|
||||||
|
id: pa-src
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: pa13
|
||||||
|
key: pulseaudio-src-13.0
|
||||||
|
- name: Fetch PulseAudio 13.0 source
|
||||||
|
if: steps.pa-src.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
curl -fsSL -o pa.tar.gz https://github.com/pulseaudio/pulseaudio/archive/refs/tags/v13.0.tar.gz
|
||||||
|
mkdir -p pa13 && tar -xzf pa.tar.gz -C pa13 --strip-components=1 && rm pa.tar.gz
|
||||||
|
- name: Fetch DirectAudio (tools/directaudio/release.env)
|
||||||
|
run: tools/directaudio/fetch.sh "$PWD" "$PWD/sink-out"
|
||||||
|
- name: Build the AAudio sink into the audio bundle
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
export NDK="${ANDROID_NDK_LATEST_HOME:-${ANDROID_NDK_HOME:-$ANDROID_NDK_ROOT}}"
|
||||||
|
tools/aaudio-sink/build.sh "$PWD/pa13" "$PWD/sink-out"
|
||||||
|
rm -rf pa-bundle && mkdir -p pa-bundle
|
||||||
|
tar --use-compress-program=unzstd -xf app/src/main/assets/pulseaudio.tzst -C pa-bundle
|
||||||
|
test ! -f pa-bundle/modules/arm64/module-aaudio-sink.so
|
||||||
|
install -m755 sink-out/module-aaudio-sink.so pa-bundle/modules/arm64/module-aaudio-sink.so
|
||||||
|
install -m755 sink-out/module-directaudio-native-sink.so pa-bundle/modules/arm64/module-directaudio-native-sink.so
|
||||||
|
(cd pa-bundle && tar --use-compress-program='zstd -19' -cf ../pulseaudio.tzst .)
|
||||||
|
mkdir -p app/build/prepared-assets
|
||||||
|
mv pulseaudio.tzst app/build/prepared-assets/pulseaudio.tzst
|
||||||
|
tar --use-compress-program=unzstd -tf app/build/prepared-assets/pulseaudio.tzst | grep -c '\.so$'
|
||||||
|
rm -rf pa-bundle sink-out
|
||||||
|
- name: Cache proot
|
||||||
|
id: proot
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
app/src/main/jniLibs/arm64-v8a/libproot.so
|
||||||
|
app/src/main/jniLibs/arm64-v8a/libproot-loader.so
|
||||||
|
key: proot-${{ env.NDK_VERSION }}-${{ hashFiles('tools/proot/**') }}
|
||||||
|
- name: Build proot
|
||||||
|
if: steps.proot.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
export NDK="${ANDROID_NDK_LATEST_HOME:-${ANDROID_NDK_HOME:-$ANDROID_NDK_ROOT}}"
|
||||||
|
tools/proot/build.sh app/src/main/jniLibs/arm64-v8a
|
||||||
|
|
||||||
|
- name: Check the preloads
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
bash tools/linuxfs/check-preloads.sh app/src/main/assets/linuxfs
|
||||||
|
|
||||||
|
- name: Check Quest tracking IPC
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
NDK="${ANDROID_NDK_LATEST_HOME:-${ANDROID_NDK_HOME:-$ANDROID_NDK_ROOT}}"
|
||||||
|
VK_INCLUDE=$(ls -d "$NDK"/toolchains/llvm/prebuilt/*/sysroot/usr/include | head -1)
|
||||||
|
mkdir -p build/vr/include
|
||||||
|
cp -R "$VK_INCLUDE/vulkan" build/vr/include/
|
||||||
|
if [ -d "$VK_INCLUDE/vk_video" ]; then cp -R "$VK_INCLUDE/vk_video" build/vr/include/; fi
|
||||||
|
g++ -std=c++17 -Wall -Wextra -Werror -pthread tools/vr/tests/test_xr_tracking.cpp -o /tmp/test-xr-tracking
|
||||||
|
/tmp/test-xr-tracking
|
||||||
|
g++ -std=c++17 -Wall -Wextra -Werror tools/vr/tests/test_xr_touch.cpp -o /tmp/test-xr-touch
|
||||||
|
/tmp/test-xr-touch
|
||||||
|
g++ -std=c++17 -Wall -Wextra -Werror -pthread tools/vr/tests/test_xr_vsync.cpp -o /tmp/test-xr-vsync
|
||||||
|
/tmp/test-xr-vsync
|
||||||
|
g++ -std=c++17 -Wall -Wextra -Werror -pthread tools/vr/tests/test_xr_frames.cpp -o /tmp/test-xr-frames
|
||||||
|
/tmp/test-xr-frames
|
||||||
|
cc -Itools/vr/third_party/wayland -c tools/vr/src/wayland_client_stub.c -o /tmp/test-wayland-stub.o
|
||||||
|
cc -Itools/vr/third_party/wayland -c app/src/main/cpp/waylandcomp/generated/xdg-shell-protocol.c -o /tmp/test-xdg-shell.o
|
||||||
|
g++ -std=c++17 -Wall -Wextra -Werror -Wno-unused-parameter -Wno-missing-field-initializers -pthread -Ibuild/vr/include \
|
||||||
|
-Itools/vr/third_party/wayland -Iapp/src/main/cpp/waylandcomp/generated \
|
||||||
|
tools/vr/tests/test_presenter_shutdown.cpp tools/vr/src/presenter.cpp /tmp/test-wayland-stub.o /tmp/test-xdg-shell.o \
|
||||||
|
-ldl -o /tmp/test-presenter-shutdown
|
||||||
|
timeout 10 /tmp/test-presenter-shutdown
|
||||||
|
|
||||||
- name: Rust toolchain for the store engines (aarch64-linux-android)
|
- name: Rust toolchain for the store engines (aarch64-linux-android)
|
||||||
id: rust
|
id: rust
|
||||||
run: |
|
run: |
|
||||||
@@ -450,10 +443,9 @@ jobs:
|
|||||||
~/.cargo/git/db
|
~/.cargo/git/db
|
||||||
~/.cargo/bin/cargo-ndk
|
~/.cargo/bin/cargo-ndk
|
||||||
app/src/main/rust/stores/target
|
app/src/main/rust/stores/target
|
||||||
key: stores-v2-${{ runner.os }}-${{ runner.arch }}-${{ env.NDK_VERSION }}-${{ steps.rust.outputs.rustc }}-${{ hashFiles('app/src/main/rust/stores/Cargo.lock') }}-${{ hashFiles('app/src/main/rust/stores/amazon/**', 'tools/stores/**', 'app/src/main/rust/stores/src/**', 'app/src/main/rust/stores/Cargo.toml', 'app/src/main/rust/stores/build.rs', 'app/src/main/rust/stores/.cargo/**', 'app/build.gradle') }}
|
key: stores-${{ steps.rust.outputs.rustc }}-${{ hashFiles('app/src/main/rust/stores/Cargo.lock') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
stores-v2-${{ runner.os }}-${{ runner.arch }}-${{ env.NDK_VERSION }}-${{ steps.rust.outputs.rustc }}-${{ hashFiles('app/src/main/rust/stores/Cargo.lock') }}-
|
stores-${{ steps.rust.outputs.rustc }}-
|
||||||
stores-v2-${{ runner.os }}-${{ runner.arch }}-${{ env.NDK_VERSION }}-${{ steps.rust.outputs.rustc }}-
|
|
||||||
|
|
||||||
- name: cargo-ndk
|
- name: cargo-ndk
|
||||||
run: |
|
run: |
|
||||||
@@ -471,28 +463,12 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
cxx-${{ env.NDK_VERSION }}-
|
cxx-${{ env.NDK_VERSION }}-
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
- name: Build GOG Galaxy companion
|
||||||
with:
|
if: steps.preloads.outputs.cache-hit != 'true'
|
||||||
name: prepared-components
|
run: |
|
||||||
path: app/build
|
rustup toolchain install 1.90.0 --profile minimal
|
||||||
- name: Verify and unpack prepared components
|
rustup target add --toolchain 1.90.0 aarch64-unknown-linux-gnu
|
||||||
env:
|
RUSTUP_TOOLCHAIN=1.90.0 bash tools/comet/build.sh
|
||||||
SOURCE_TREE: ${{ needs.source.outputs.tree-sha }}
|
|
||||||
run: python3 tools/components/prepare.py unpack --tree "$SOURCE_TREE"
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: xbox-arm64
|
|
||||||
path: app/src/main/assets/linuxfs/usr/local/lib/droiddeck-xbox
|
|
||||||
|
|
||||||
- name: Cache checksum-pinned pack inputs
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ~/.cache/droiddeck-pack-inputs
|
|
||||||
key: pack-inputs-v1-${{ hashFiles('tools/packs/build.sh', 'tools/packs/fetch-verified.sh', 'tools/packs/tracking/release.env') }}
|
|
||||||
restore-keys: pack-inputs-v1-
|
|
||||||
- name: Build the add-on packs
|
|
||||||
run: bash tools/packs/build.sh app/build/packs
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
id: build
|
id: build
|
||||||
@@ -501,6 +477,7 @@ jobs:
|
|||||||
SGDB_API_KEY: ${{ secrets.SGDB_API_KEY }}
|
SGDB_API_KEY: ${{ secrets.SGDB_API_KEY }}
|
||||||
run: |
|
run: |
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
python3 tools/quest/build-driver.py "$ANDROID_HOME/ndk/$NDK_VERSION"
|
||||||
python3 tools/release/runtime_inputs.py record
|
python3 tools/release/runtime_inputs.py record
|
||||||
./gradlew assembleRelease --console=plain -PndkVersion="$NDK_VERSION" 2>&1 | tee /tmp/build.log
|
./gradlew assembleRelease --console=plain -PndkVersion="$NDK_VERSION" 2>&1 | tee /tmp/build.log
|
||||||
python3 tools/release/check_session_assets.py app/build/outputs/apk/release/app-release.apk
|
python3 tools/release/check_session_assets.py app/build/outputs/apk/release/app-release.apk
|
||||||
@@ -523,13 +500,6 @@ jobs:
|
|||||||
cd app/src/main/rust/stores
|
cd app/src/main/rust/stores
|
||||||
cargo test --locked 2>&1 | tail -60
|
cargo test --locked 2>&1 | tail -60
|
||||||
|
|
||||||
- name: Amazon engine host tests
|
|
||||||
timeout-minutes: 10
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
export CARGO_TARGET_DIR="$PWD/app/src/main/rust/stores/target"
|
|
||||||
cargo test --manifest-path app/src/main/rust/stores/amazon/Cargo.toml --locked
|
|
||||||
|
|
||||||
- name: Upload the regenerated Cargo.lock
|
- name: Upload the regenerated Cargo.lock
|
||||||
if: failure()
|
if: failure()
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
@@ -538,11 +508,11 @@ jobs:
|
|||||||
path: app/src/main/rust/stores/Cargo.lock
|
path: app/src/main/rust/stores/Cargo.lock
|
||||||
if-no-files-found: ignore
|
if-no-files-found: ignore
|
||||||
|
|
||||||
|
- name: Steam import and game environment tests
|
||||||
|
run: python3 -m unittest discover -s tools/tests -p 'test_*.py'
|
||||||
|
|
||||||
- name: Unit tests
|
- name: Unit tests
|
||||||
id: unit-tests
|
id: unit-tests
|
||||||
env:
|
|
||||||
DROIDDECK_BUILD_LABEL: ${{ steps.build-label.outputs.label }}
|
|
||||||
SGDB_API_KEY: ${{ secrets.SGDB_API_KEY }}
|
|
||||||
run: |
|
run: |
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
mkdir -p app/build
|
mkdir -p app/build
|
||||||
@@ -598,14 +568,6 @@ jobs:
|
|||||||
retention-days: 30
|
retention-days: 30
|
||||||
compression-level: 0
|
compression-level: 0
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: droiddeck-packs
|
|
||||||
path: app/build/packs/*.tar.zst
|
|
||||||
if-no-files-found: error
|
|
||||||
retention-days: 30
|
|
||||||
compression-level: 0
|
|
||||||
|
|
||||||
- name: Report on the pull request
|
- name: Report on the pull request
|
||||||
if: always() && github.event_name == 'pull_request'
|
if: always() && github.event_name == 'pull_request'
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
@@ -618,84 +580,86 @@ jobs:
|
|||||||
TEST_DIAGNOSTICS_URL: ${{ steps.unit-test-diagnostics.outputs.artifact-url }}
|
TEST_DIAGNOSTICS_URL: ${{ steps.unit-test-diagnostics.outputs.artifact-url }}
|
||||||
APK_OUTCOME: ${{ steps.apk-upload.outcome }}
|
APK_OUTCOME: ${{ steps.apk-upload.outcome }}
|
||||||
SAME_REPO: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
|
SAME_REPO: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
|
||||||
run: bash tools/release/report-build.sh
|
|
||||||
|
|
||||||
python-tests:
|
|
||||||
name: Python and native regression tests
|
|
||||||
needs: source
|
|
||||||
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
|
|
||||||
runs-on: ubuntu-24.04
|
|
||||||
timeout-minutes: 15
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
|
|
||||||
fetch-depth: 0
|
|
||||||
persist-credentials: false
|
|
||||||
- name: Merge the pinned APK base
|
|
||||||
if: github.event_name == 'pull_request'
|
|
||||||
env:
|
|
||||||
BUILD_BASE_SHA: ${{ needs.source.outputs.base-sha }}
|
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -uo pipefail
|
||||||
git fetch --no-tags origin "$BUILD_BASE_SHA"
|
MARK="<!-- droiddeck-pr-build -->"
|
||||||
git config user.name "ci"
|
{
|
||||||
git config user.email "ci@users.noreply.github.com"
|
echo "$MARK"
|
||||||
git merge --no-ff --no-edit FETCH_HEAD
|
echo "## Build of this pull request"
|
||||||
- name: Verify backend and test source match
|
echo
|
||||||
env:
|
[ -f /tmp/pr-merge.md ] && cat /tmp/pr-merge.md
|
||||||
XBOX_SOURCE_TREE: ${{ needs.source.outputs.tree-sha }}
|
echo
|
||||||
run: test "$(git rev-parse 'HEAD^{tree}')" = "$XBOX_SOURCE_TREE"
|
case "$BUILD_OUTCOME:$UNIT_TEST_OUTCOME:$APK_OUTCOME" in
|
||||||
- name: Install Python test dependencies
|
success:success:success)
|
||||||
timeout-minutes: 7
|
echo "### Build passed"
|
||||||
run: bash tools/ci/install-ubuntu-packages.sh python3-yaml gcc-aarch64-linux-gnu libc6-dev-arm64-cross qemu-user libvulkan-dev mesa-vulkan-drivers
|
echo
|
||||||
- name: Resolve the pinned Android NDK
|
echo "The \`droiddeck-apk\` artifact is [on this run]($RUN_URL), signed with the public test key."
|
||||||
run: bash tools/ci/resolve-ndk.sh
|
echo
|
||||||
|
if [ "$SAME_REPO" = true ]; then
|
||||||
- name: Check Quest tracking IPC
|
echo "A release-signed tester build that installs over Stable or Preview is being published now and will appear in DroidDeck's **Test builds** list. Label the PR \`no-test-build\` to skip that."
|
||||||
run: |
|
else
|
||||||
set -euo pipefail
|
echo "**Maintainer:** add the \`publish-test\` label to publish a release-signed tester build that installs over Stable or Preview and appears in DroidDeck's **Test builds** list. The label is removed automatically after publishing."
|
||||||
NDK="${ANDROID_NDK_LATEST_HOME:-${ANDROID_NDK_HOME:-$ANDROID_NDK_ROOT}}"
|
fi
|
||||||
VK_INCLUDE=$(ls -d "$NDK"/toolchains/llvm/prebuilt/*/sysroot/usr/include | head -1)
|
echo
|
||||||
mkdir -p build/vr/include
|
echo "Fallback: [open **PR Release Publish**]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/workflows/pr-release-publish.yml) on \`main\` and enter PR \`$PR\`."
|
||||||
cp -R "$VK_INCLUDE/vulkan" build/vr/include/
|
;;
|
||||||
if [ -d "$VK_INCLUDE/vk_video" ]; then cp -R "$VK_INCLUDE/vk_video" build/vr/include/; fi
|
success:success:*)
|
||||||
g++ -std=c++17 -Wall -Wextra -Werror -pthread tools/vr/tests/test_xr_tracking.cpp -o /tmp/test-xr-tracking
|
echo "### APK publication incomplete"
|
||||||
/tmp/test-xr-tracking
|
echo
|
||||||
g++ -std=c++17 -Wall -Wextra -Werror tools/vr/tests/test_xr_touch.cpp -o /tmp/test-xr-touch
|
echo "Compilation and unit tests passed, but APK publication did not complete. See [the run]($RUN_URL)."
|
||||||
/tmp/test-xr-touch
|
;;
|
||||||
g++ -std=c++17 -Wall -Wextra -Werror tools/vr/tests/test_pad_controller_config.cpp -o /tmp/test-pad-controller-config
|
success:failure:*)
|
||||||
/tmp/test-pad-controller-config
|
echo "### ERROR: Unit tests failed"
|
||||||
g++ -std=c++17 -Wall -Wextra -Werror -pthread tools/vr/tests/test_xr_vsync.cpp -o /tmp/test-xr-vsync
|
echo
|
||||||
/tmp/test-xr-vsync
|
echo "The APK compiled, but unit tests failed. No installable artifact was published."
|
||||||
g++ -std=c++17 -Wall -Wextra -Werror -pthread tools/vr/tests/test_xr_frames.cpp -o /tmp/test-xr-frames
|
echo
|
||||||
/tmp/test-xr-frames
|
if [ -n "$TEST_DIAGNOSTICS_URL" ]; then
|
||||||
cc -Itools/vr/third_party/wayland -c tools/vr/src/wayland_client_stub.c -o /tmp/test-wayland-stub.o
|
echo "The [unit-test-results]($TEST_DIAGNOSTICS_URL) artifact contains the test log and any generated reports."
|
||||||
cc -Itools/vr/third_party/wayland -c app/src/main/cpp/waylandcomp/generated/xdg-shell-protocol.c -o /tmp/test-xdg-shell.o
|
else
|
||||||
g++ -std=c++17 -Wall -Wextra -Werror -Wno-unused-parameter -Wno-missing-field-initializers -pthread -Ibuild/vr/include \
|
echo "The test diagnostics upload did not complete. See [the test log]($RUN_URL)."
|
||||||
-Itools/vr/third_party/wayland -Iapp/src/main/cpp/waylandcomp/generated \
|
fi
|
||||||
tools/vr/tests/test_presenter_shutdown.cpp tools/vr/src/presenter.cpp /tmp/test-wayland-stub.o /tmp/test-xdg-shell.o \
|
;;
|
||||||
-ldl -o /tmp/test-presenter-shutdown
|
success:*)
|
||||||
timeout 10 /tmp/test-presenter-shutdown
|
echo "### Build incomplete"
|
||||||
|
echo
|
||||||
- name: Steam import and game environment tests
|
echo "The APK compiled, but unit tests did not complete successfully. See [the run]($RUN_URL)."
|
||||||
run: python3 -m unittest discover -s tools/tests -p 'test_*.py'
|
;;
|
||||||
|
failure:*)
|
||||||
checks:
|
echo "### ERROR: Build failed"
|
||||||
name: Compile and test APK
|
echo
|
||||||
needs: [build, python-tests]
|
echo "The compiler's errors ([full log]($RUN_URL)):"
|
||||||
if: ${{ always() && (github.event_name != 'pull_request' || !github.event.pull_request.draft) }}
|
echo
|
||||||
runs-on: ubuntu-24.04
|
echo '```'
|
||||||
timeout-minutes: 5
|
{ grep -E '^e: |^w: .*error|error:|CMake Error|fatal error|ninja: error|FAILED|What went wrong|Execution failed for task|Unresolved reference|Type mismatch|Unresolved' /tmp/build.log 2>/dev/null \
|
||||||
steps:
|
| sed -e 's#file:///home/runner/work/[^/]*/[^/]*/##' -e 's#/home/runner/work/[^/]*/[^/]*/##' \
|
||||||
- name: Require compilation and every test job
|
| grep -v '^w: ' | awk '!seen[$0]++' | head -80; } || true
|
||||||
env:
|
echo '```'
|
||||||
BUILD_RESULT: ${{ needs.build.result }}
|
echo
|
||||||
PYTHON_RESULT: ${{ needs.python-tests.result }}
|
echo "<details><summary>What went wrong (Gradle)</summary>"
|
||||||
run: test "$BUILD_RESULT" = success && test "$PYTHON_RESULT" = success
|
echo
|
||||||
|
echo '```'
|
||||||
|
awk '/^\* What went wrong/{p=1} /^\* Try:/{p=0} p{print}' /tmp/build.log 2>/dev/null | head -60
|
||||||
|
echo '```'
|
||||||
|
echo "</details>"
|
||||||
|
;;
|
||||||
|
skipped:*|cancelled:*)
|
||||||
|
echo "### Not built"
|
||||||
|
echo
|
||||||
|
echo "The build did not run (see above, or [the run]($RUN_URL))."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
echo
|
||||||
|
} > /tmp/pr-report.md
|
||||||
|
cat /tmp/pr-report.md >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
ID=$(gh api "repos/${GITHUB_REPOSITORY}/issues/${PR}/comments" --paginate --jq ".[] | select(.body | startswith(\"$MARK\")) | .id" | head -1 || true)
|
||||||
|
if [ -n "$ID" ]; then
|
||||||
|
gh api -X PATCH "repos/${GITHUB_REPOSITORY}/issues/comments/${ID}" -F body=@/tmp/pr-report.md >/dev/null
|
||||||
|
else
|
||||||
|
gh api -X POST "repos/${GITHUB_REPOSITORY}/issues/${PR}/comments" -F body=@/tmp/pr-report.md >/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
sign:
|
sign:
|
||||||
needs: [build, checks]
|
needs: build
|
||||||
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
|
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
@@ -706,17 +670,8 @@ jobs:
|
|||||||
variants: ${{ needs.build.outputs.variants }}
|
variants: ${{ needs.build.outputs.variants }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
packs:
|
|
||||||
needs: [build, checks]
|
|
||||||
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
actions: read
|
|
||||||
uses: ./.github/workflows/publish-packs.yml
|
|
||||||
secrets: inherit
|
|
||||||
|
|
||||||
announce:
|
announce:
|
||||||
needs: [build, sign, packs]
|
needs: [build, sign]
|
||||||
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
|
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
@@ -727,10 +682,6 @@ jobs:
|
|||||||
CI_REPO: Droid-Deck/DroidDeck-CI
|
CI_REPO: Droid-Deck/DroidDeck-CI
|
||||||
KEEP: 10
|
KEEP: 10
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: ${{ github.sha }}
|
|
||||||
persist-credentials: false
|
|
||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
pattern: droiddeck-signed-*
|
pattern: droiddeck-signed-*
|
||||||
@@ -748,13 +699,72 @@ jobs:
|
|||||||
- name: Describe the change
|
- name: Describe the change
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
run: bash tools/release/describe-build.sh
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
pr=$(gh api "repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/pulls" \
|
||||||
|
--jq '[.[] | select(.merged_at != null and .base.ref == "main")] | first // empty')
|
||||||
|
if [ -n "$pr" ]; then
|
||||||
|
number=$(jq -r .number <<<"$pr")
|
||||||
|
title=$(jq -r .title <<<"$pr")
|
||||||
|
merged=$(jq -r '.merged_at[:10]' <<<"$pr")
|
||||||
|
summary=$(jq -r '.body // ""' <<<"$pr" | tr -d '\r' | { grep -v '^🤖' || true; } |
|
||||||
|
awk '!p && /^#/ { next } NF { p = 1; print; next } p { exit }' | head -n 6 | cut -c1-400)
|
||||||
|
{
|
||||||
|
echo "**Merged to main** - [PR #$number]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/pull/$number): $title (merged $merged)"
|
||||||
|
if [ -n "$summary" ]; then
|
||||||
|
echo
|
||||||
|
echo "$summary"
|
||||||
|
fi
|
||||||
|
} > notes-head.md
|
||||||
|
else
|
||||||
|
subject=$(gh api "repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA" --jq '.commit.message | split("\n")[0]')
|
||||||
|
echo "**Pushed to main** without a PR - $subject" > notes-head.md
|
||||||
|
fi
|
||||||
|
cat notes-head.md
|
||||||
|
|
||||||
- name: Publish to DroidDeck-CI
|
- name: Publish to DroidDeck-CI
|
||||||
id: publish
|
id: publish
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ steps.ci-token.outputs.token }}
|
GH_TOKEN: ${{ steps.ci-token.outputs.token }}
|
||||||
run: bash tools/release/publish-ci.sh
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
tag=main-${GITHUB_SHA::7}
|
||||||
|
cat signed/SHA256SUMS-*.txt > signed/SHA256SUMS.txt
|
||||||
|
rm signed/SHA256SUMS-*.txt
|
||||||
|
notes="$(cat notes-head.md)
|
||||||
|
|
||||||
|
Signed build of $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/commit/$GITHUB_SHA - in main, not yet in a DroidDeck release; for testing.
|
||||||
|
Commit: $GITHUB_SHA
|
||||||
|
VersionCode: $(sed -n 's/^ *versionCode \([0-9][0-9]*\)$/\1/p' app/build.gradle)
|
||||||
|
Each apk installs over a DroidDeck release and keeps its data. \`standard\` is the normal app; the others are the same app under another package name, installed beside it.
|
||||||
|
|
||||||
|
SHA-256:
|
||||||
|
\`\`\`
|
||||||
|
$(cat signed/SHA256SUMS.txt)
|
||||||
|
\`\`\`"
|
||||||
|
gh release delete "$tag" -R "$CI_REPO" --yes --cleanup-tag 2>/dev/null || true
|
||||||
|
gh release create "$tag" -R "$CI_REPO" --target main --prerelease \
|
||||||
|
--title "main ${GITHUB_SHA::7}" --notes "$notes" signed/*
|
||||||
|
gh release list -R "$CI_REPO" -L 200 --json tagName,publishedAt \
|
||||||
|
--jq '[.[] | select(.tagName | startswith("main-"))] | sort_by(.publishedAt) | reverse | .['"$KEEP"':][] | .tagName' |
|
||||||
|
while IFS= read -r old; do
|
||||||
|
if [ "$old" = "$tag" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if ! gh release delete "$old" -R "$CI_REPO" --yes --cleanup-tag 2>/dev/null; then
|
||||||
|
if gh release view "$old" -R "$CI_REPO" >/dev/null 2>&1; then
|
||||||
|
echo "::error::Could not delete old release $old"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
published=$(gh release view "$tag" -R "$CI_REPO" --json tagName,assets)
|
||||||
|
jq -e --arg tag "$tag" '.tagName == $tag and (.assets | length) > 0' <<< "$published" >/dev/null
|
||||||
|
url="$GITHUB_SERVER_URL/$CI_REPO/releases/tag/$tag"
|
||||||
|
apk=$(cd signed && ls DroidDeck-*.apk | awk 'length(a) == 0 || length($0) < length(a) { a = $0 } END { print a }')
|
||||||
|
echo "release=$url" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "apk=$GITHUB_SERVER_URL/$CI_REPO/releases/download/$tag/$apk" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "Published $url"
|
||||||
|
|
||||||
- name: Post the Preview build to Discord
|
- name: Post the Preview build to Discord
|
||||||
env:
|
env:
|
||||||
@@ -762,8 +772,26 @@ jobs:
|
|||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
RELEASE: ${{ steps.publish.outputs.release }}
|
RELEASE: ${{ steps.publish.outputs.release }}
|
||||||
APK: ${{ steps.publish.outputs.apk }}
|
APK: ${{ steps.publish.outputs.apk }}
|
||||||
run: bash tools/release/announce-preview.sh
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
if [ -z "$WEBHOOK" ]; then
|
||||||
|
echo "::notice::No DISCORD_BUILDS_WEBHOOK secret; nothing posted"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
commit=$(gh api "repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA")
|
||||||
|
subject=$(jq -r '.commit.message | split("\n")[0]' <<<"$commit")
|
||||||
|
title=$(jq -r '.commit.message | split("\n") | map(select(length > 0)) | .[1] // ""' <<<"$commit")
|
||||||
|
pr=$(sed -n 's/^Merge pull request #\([0-9]*\).*/\1/p' <<<"$subject")
|
||||||
|
if [ -n "$pr" ]; then
|
||||||
|
what="[#$pr]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/pull/$pr): ${title:-$subject}"
|
||||||
|
else
|
||||||
|
what="[\`${GITHUB_SHA::7}\`]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/commit/$GITHUB_SHA): $subject"
|
||||||
|
fi
|
||||||
|
get=$(printf 'Download: [standard APK](<%s>) · [all variants](<%s>)' "$APK" "$RELEASE")
|
||||||
|
content=$(printf '**New signed Preview build** `main-%s`\n%s\nIn the app: **Updates → Preview**\n%s' "${GITHUB_SHA::7}" "$what" "$get")
|
||||||
|
jq -n --arg content "$content" '{content: $content, allowed_mentions: {parse: []}}' |
|
||||||
|
curl -fsS -H 'Content-Type: application/json' -d @- "$WEBHOOK" -o /dev/null
|
||||||
|
echo "Posted: $content"
|
||||||
|
|
||||||
catalog:
|
catalog:
|
||||||
needs: announce
|
needs: announce
|
||||||
|
|||||||
@@ -176,27 +176,6 @@ jobs:
|
|||||||
pattern: droiddeck-pr-signed-*
|
pattern: droiddeck-pr-signed-*
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
path: signed
|
path: signed
|
||||||
- name: The add-on packs main has not published
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
RUN: ${{ needs.authorize.outputs.run_id }}
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
gh run download "$RUN" -R "$GITHUB_REPOSITORY" -n droiddeck-packs -D packs
|
|
||||||
mkdir -p pr-packs
|
|
||||||
for file in packs/*.tar.zst; do
|
|
||||||
name=$(basename "$file" .tar.zst)
|
|
||||||
sha=$(sha256sum "$file" | cut -d' ' -f1)
|
|
||||||
tag="pack-$name-${sha:0:16}"
|
|
||||||
digest=$({ gh api "repos/Droid-Deck/DroidDeck-Components/releases/tags/$tag" 2>/dev/null || echo '{}'; } |
|
|
||||||
jq -r --arg n "$name.tar.zst" '.assets // [] | .[] | select(.name == $n) | .digest // empty')
|
|
||||||
if [ "$digest" = "sha256:$sha" ]; then
|
|
||||||
echo "$name: served from DroidDeck-Components $tag"
|
|
||||||
else
|
|
||||||
cp "$file" "pr-packs/$tag.tar.zst"
|
|
||||||
echo "$name: attached to the PR release as $tag.tar.zst"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
- name: Describe the change
|
- name: Describe the change
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
@@ -254,7 +233,6 @@ jobs:
|
|||||||
first=true
|
first=true
|
||||||
fi
|
fi
|
||||||
echo "first=$first" >> "$GITHUB_OUTPUT"
|
echo "first=$first" >> "$GITHUB_OUTPUT"
|
||||||
cp pr-packs/* signed/ 2>/dev/null || true
|
|
||||||
gh release upload "$tag" signed/* -R "$repo" --clobber
|
gh release upload "$tag" signed/* -R "$repo" --clobber
|
||||||
gh release edit "$tag" -R "$repo" --title "PR #$PR_NUMBER" --notes "$notes" --prerelease
|
gh release edit "$tag" -R "$repo" --title "PR #$PR_NUMBER" --notes "$notes" --prerelease
|
||||||
keep=$(cd signed && ls | jq -R . | jq -sc .)
|
keep=$(cd signed && ls | jq -R . | jq -sc .)
|
||||||
|
|||||||
@@ -1,83 +0,0 @@
|
|||||||
name: Publish add-on packs
|
|
||||||
|
|
||||||
# The add-on packs (tools/packs/build.sh) a Build APK run made, published to DroidDeck-Components under
|
|
||||||
# content-addressed tags (pack-<name>-<first 16 hex of sha256>). The APK from that run pins each pack's
|
|
||||||
# SHA-256 and downloads it from that tag. A tag is created once and never replaced.
|
|
||||||
# Only main and release builds publish here; a PR test build attaches the packs main has not published
|
|
||||||
# to its pr-N release on DroidDeck-CI (pr-release-publish.yml), which is deleted when the PR closes.
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
run_id:
|
|
||||||
description: The Build APK run whose packs to publish; empty for the calling run's own
|
|
||||||
type: string
|
|
||||||
default: ''
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
actions: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
publish:
|
|
||||||
name: publish add-on packs
|
|
||||||
runs-on: ubuntu-24.04
|
|
||||||
timeout-minutes: 15
|
|
||||||
concurrency:
|
|
||||||
group: publish-packs
|
|
||||||
cancel-in-progress: false
|
|
||||||
steps:
|
|
||||||
- name: The packs (this run's build)
|
|
||||||
if: inputs.run_id == ''
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: droiddeck-packs
|
|
||||||
path: packs
|
|
||||||
|
|
||||||
- name: The packs (another Build APK run)
|
|
||||||
if: inputs.run_id != ''
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
RUN: ${{ inputs.run_id }}
|
|
||||||
run: gh run download "$RUN" -R "$GITHUB_REPOSITORY" -n droiddeck-packs -D packs
|
|
||||||
|
|
||||||
- uses: actions/create-github-app-token@v2
|
|
||||||
id: components-token
|
|
||||||
with:
|
|
||||||
app-id: ${{ vars.DROIDDECK_CI_APP_ID }}
|
|
||||||
private-key: ${{ secrets.DROIDDECK_CI_APP_KEY }}
|
|
||||||
owner: Droid-Deck
|
|
||||||
repositories: DroidDeck-Components
|
|
||||||
|
|
||||||
- name: Publish
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ steps.components-token.outputs.token }}
|
|
||||||
REPO: Droid-Deck/DroidDeck-Components
|
|
||||||
BUILD_RUN: ${{ inputs.run_id || github.run_id }}
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
published_digest() {
|
|
||||||
{ gh api "repos/$REPO/releases/tags/$1" 2>/dev/null || echo '{}'; } |
|
|
||||||
jq -r --arg n "$2" '.assets // [] | .[] | select(.name == $n) | .digest // empty'
|
|
||||||
}
|
|
||||||
commit=$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/$BUILD_RUN" --jq .head_sha 2>/dev/null || echo "$GITHUB_SHA")
|
|
||||||
for name in proot directaudio tracking xbox comet amazon; do
|
|
||||||
file="packs/$name.tar.zst"
|
|
||||||
[ -f "$file" ] || { echo "::error::$name.tar.zst is missing from Build APK run $BUILD_RUN"; exit 1; }
|
|
||||||
sha=$(sha256sum "$file" | cut -d' ' -f1)
|
|
||||||
tag="pack-$name-${sha:0:16}"
|
|
||||||
digest=$(published_digest "$tag" "$name.tar.zst")
|
|
||||||
if [ -z "$digest" ]; then
|
|
||||||
notes="DroidDeck add-on pack \`$name\`, built by [Build APK run $BUILD_RUN]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$BUILD_RUN) from \`$commit\` with tools/packs/build.sh and published by [run $GITHUB_RUN_ID]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID).
|
|
||||||
|
|
||||||
Size: $(stat -c %s "$file") bytes. SHA-256: $sha. APKs built in the same run pin this digest."
|
|
||||||
gh release create "$tag" -R "$REPO" --title "$tag" --notes "$notes" --latest=false "$file" \
|
|
||||||
|| echo "::warning::creating $tag failed; checking whether another run published it"
|
|
||||||
digest=$(published_digest "$tag" "$name.tar.zst")
|
|
||||||
fi
|
|
||||||
if [ "$digest" != "sha256:$sha" ]; then
|
|
||||||
echo "::error::$tag holds ${digest:-nothing} for $name.tar.zst, not sha256:$sha"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "- \`$name\`: [$tag]($GITHUB_SERVER_URL/$REPO/releases/tag/$tag) \`$sha\`" >> "$GITHUB_STEP_SUMMARY"
|
|
||||||
done
|
|
||||||
@@ -63,19 +63,9 @@ jobs:
|
|||||||
artifact: droiddeck-release
|
artifact: droiddeck-release
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
packs:
|
|
||||||
needs: find
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
actions: read
|
|
||||||
uses: ./.github/workflows/publish-packs.yml
|
|
||||||
with:
|
|
||||||
run_id: ${{ needs.find.outputs.run_id }}
|
|
||||||
secrets: inherit
|
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
name: publish the release
|
name: publish the release
|
||||||
needs: [find, sign, packs]
|
needs: [find, sign]
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
permissions:
|
permissions:
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ app/src/main/jniLibs/arm64-v8a/.proot-outputs
|
|||||||
app/src/main/jniLibs/arm64-v8a/libproot-loader.so
|
app/src/main/jniLibs/arm64-v8a/libproot-loader.so
|
||||||
app/src/main/jniLibs/arm64-v8a/libdirectaudiorelay.so
|
app/src/main/jniLibs/arm64-v8a/libdirectaudiorelay.so
|
||||||
app/src/main/rust/stores/target/
|
app/src/main/rust/stores/target/
|
||||||
app/src/main/rust/amazon/target/
|
|
||||||
app/src/main/assets/droiddeck-esync/
|
app/src/main/assets/droiddeck-esync/
|
||||||
|
|
||||||
.kotlin/
|
.kotlin/
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ On Android 14 and newer, before Steam launches, you must turn on **Disable child
|
|||||||
|
|
||||||
## Smart glasses
|
## Smart glasses
|
||||||
|
|
||||||
Use **Setup → Smart glasses** for app-wide virtual-screen settings across DroidDeck menus, launchers, desktop sessions, and games. Supported VITURE, RayNeo, XREAL, and Rokid connections provide 3DoF; Luma Ultra adds optional experimental 6DoF and stereo-assisted hand/Joy-Con tracking. Model support and SDK requirements differ: see the [smart-glasses support matrix](docs/smart-glasses-support.md) for supported devices, controls, setup, and limitations.
|
Use **Setup → Smart glasses** for app-wide virtual-screen settings across DroidDeck menus, launchers, desktop sessions, and games. Supported VITURE, RayNeo, and XREAL connections provide 3DoF; Luma Ultra adds optional experimental 6DoF and stereo-assisted hand/Joy-Con tracking. Model support and SDK requirements differ: see the [smart-glasses support matrix](docs/smart-glasses-support.md) for supported devices, controls, setup, and limitations.
|
||||||
|
|
||||||
## Community
|
## Community
|
||||||
|
|
||||||
@@ -47,12 +47,10 @@ Compatibility and performance vary by device; hardware validation is limited. De
|
|||||||
|
|
||||||
## Credits and licence
|
## Credits and licence
|
||||||
|
|
||||||
GPL-3.0. Runtime, shim, input, and controller work build on WinNative and Bannerlator (maxjivi05). Epic Games and GOG support build on [Phobos’s](https://github.com/phobos665) adaptation of [Legendary](https://github.com/legendary-gl/legendary) and [gogdl](https://github.com/Heroic-Games-Launcher/heroic-gogdl), respectively. The registry entries a GOG game's install script (`goggame-<id>.script`) sets are read the way [Heroic Games Launcher](https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher)'s GOG setup (GPL-3.0) reads them. LSFG frame generation is from the work of Camille LaVey and the [Eden](https://eden-emu.dev) emulator project, following [lsfg-vk](https://github.com/PancakeTAS/lsfg-vk), ported to WinNative and DroidDeck by [@maxjivi05](https://github.com/maxjivi05); it needs your own copy of [Lossless Scaling](https://store.steampowered.com/app/993090/) and ships none of its shaders. x86 AppImages, and any whose own runtime cannot unpack them, are unpacked with [uruntime](https://github.com/VHSgunzo/uruntime) by VHSgunzo (MIT), shipped unmodified with its licence, which also starts the arm64 emulator AppImages whose own runtime cannot run its extractor on Android. The Steam client's audio goes through [@The412Banner](https://github.com/The412Banner)'s [DirectAudio](https://github.com/The412Banner/directaudio) PulseAudio sink (LGPL-2.1-or-later), built from `tools/directaudio/sink` with its request size kept to its ring so clients are not asked to queue 100 ms ahead. mmap ring-buffer controller input was developed by ribbit384 ([WinNative #345](https://github.com/WinNative-Emu/WinNative/pull/345)). Why the x86-64 Steam client refused the arm64 client's sign-in was checked by reading Steam's saved token with the `ConnectCache` format from [deadlock-api-ingest](https://github.com/deadlock-api/deadlock-api-ingest). x86 programs that link OpenSSL 3 under FEX use the copy in the [Steam Linux Runtime 4.0](https://gitlab.steamos.cloud/steamrt/steamrt) platform. Hooks written with `WriteProcessMemory` into code [FEX](https://github.com/FEX-Emu/FEX) has translated go through `/proc/<pid>/mem` again when the kernel refuses `process_vm_writev`, as [Wine](https://gitlab.winehq.org/wine/wine)'s `server/ptrace.c` wrote them before Wine 11. x86 Linux games under FEX get the same `/etc/asound.conf` that [pressure-vessel](https://gitlab.steamos.cloud/steamrt/steam-runtime-tools) writes into the Steam Linux Runtime, so ALSA plays through PulseAudio. Games render with [Mesa](https://gitlab.freedesktop.org/mesa/mesa) Turnip's own per-render-pass choice between tile memory and system memory, while the Steam client keeps `TU_DEBUG=sysmem`; [FEX](https://github.com/FEX-Emu/FEX)'s code disk cache was checked in its source and is already on through Proton. The proot fast path picks the guest name of a host file bound under several names in the order [PRoot](https://github.com/proot-me/proot)'s `path/binding.c` (GPL-2.0-or-later) sorts its bindings, so links and `/proc/self/fd` read back as they do through proot. The session's [PipeWire](https://gitlab.freedesktop.org/pipewire/pipewire) (MIT) opens its sockets with the per-socket access settings documented in its `module-access.c`, and [WirePlumber](https://gitlab.freedesktop.org/pipewire/wireplumber) (MIT) keeps those clients at full permissions through its `access.rules`. Wine write watches use the userfaultfd support in [Proton](https://github.com/ValveSoftware/wine)'s `dlls/ntdll/unix/virtual.c` (LGPL-2.1-or-later): libblsession gives it the arm64 syscall number and answers its `PAGEMAP_SCAN` from `/proc/self/pagemap` where Android refuses the ioctl. Wine on arm64 sets a thread's full context by raising `SIGUSR2` from `syscall_dispatcher_return_slowpath` in [Wine](https://gitlab.winehq.org/wine/wine)'s `dlls/ntdll/unix/signal_arm64.c` (LGPL-2.1-or-later); libblsession runs that handler in place on a frame laid out as the [Linux](https://github.com/torvalds/linux) kernel's `arch/arm64/kernel/signal.c` builds it and returns through `rt_sigreturn`, so proot does not stop the thread for it. Wine's process list reads each process's memory counters from `/proc/<pid>/status` in `fill_vm_counters` ([Wine](https://gitlab.winehq.org/wine/wine) `dlls/ntdll/unix/process.c`, LGPL-2.1-or-later), so libblsession gives those reads the kernel's file instead of a copy with `TracerPid` cleared. droiddeck-ntsync is checked against the object, wait and error semantics documented for the [Linux](https://github.com/torvalds/linux) ntsync driver in `Documentation/userspace-api/ntsync.rst` (GPL-2.0). See [LICENSE](LICENSE). Steam and Proton belong to Valve Corporation; this project is not affiliated with Valve.
|
GPL-3.0. Runtime, shim, input, and controller work build on WinNative and Bannerlator (maxjivi05). Epic Games and GOG support build on [Phobos’s](https://github.com/phobos665) adaptation of [Legendary](https://github.com/legendary-gl/legendary) and [gogdl](https://github.com/Heroic-Games-Launcher/heroic-gogdl), respectively. LSFG frame generation is from the work of Camille LaVey and the [Eden](https://eden-emu.dev) emulator project, following [lsfg-vk](https://github.com/PancakeTAS/lsfg-vk), ported to WinNative and DroidDeck by [@maxjivi05](https://github.com/maxjivi05); it needs your own copy of [Lossless Scaling](https://store.steampowered.com/app/993090/) and ships none of its shaders. x86 AppImages, and any whose own runtime cannot unpack them, are unpacked with [uruntime](https://github.com/VHSgunzo/uruntime) by VHSgunzo (MIT), shipped unmodified with its licence. mmap ring-buffer controller input was developed by ribbit384 ([WinNative #345](https://github.com/WinNative-Emu/WinNative/pull/345)). See [LICENSE](LICENSE). Steam and Proton belong to Valve Corporation; this project is not affiliated with Valve.
|
||||||
|
|
||||||
XR glasses support builds on WinNative's VITURE glasses work. VITURE protocol details were checked against [XRLinuxDriver](https://github.com/wheaney/XRLinuxDriver) by [@wheaney](https://github.com/wheaney), including the VITURE protocol header it ships, [ar-drivers-rs](https://github.com/badicsalex/ar-drivers-rs) by [@badicsalex](https://github.com/badicsalex) and the [go-macos/iokit VITURE package](https://pkg.go.dev/github.com/go-macos/iokit/viture); the optional VITURE SDK belongs to VITURE and is not included. RayNeo support adapts [@informalTechCode](https://github.com/informalTechCode)'s [RayNeo-Air-Series-3DoF-Scaffold](https://github.com/informalTechCode/RayNeo-Air-Series-3DoF-Scaffold) (Apache-2.0) and references [@verncat](https://github.com/verncat)'s [RayNeo-Air-3S-Pro-OpenVR](https://github.com/verncat/RayNeo-Air-3S-Pro-OpenVR) (MIT) and [Monado](https://gitlab.freedesktop.org/monado/monado) (BSL-1.0); see [docs/third-party/rayneo](docs/third-party/rayneo/README.md). XREAL 1S support references [XRLinuxDriver](https://github.com/wheaney/XRLinuxDriver) and [xrealOneDeviceKit](https://github.com/wheaney/xrealOneDeviceKit) by @wheaney, [xreal_one_driver](https://github.com/rohitsangwan01/xreal_one_driver) by [@rohitsangwan01](https://github.com/rohitsangwan01) (MIT) and [xr-tools](https://github.com/0xcaff/xr-tools) by [@0xcaff](https://github.com/0xcaff). Rokid support follows the Rokid protocol notes in [ar-drivers-rs](https://github.com/badicsalex/ar-drivers-rs) and @badicsalex's [Void Computing write-ups](https://voidcomputing.hu/blog/worse-better-prettier/), and [Monado](https://gitlab.freedesktop.org/monado/monado)'s Rokid driver. The REDMAGIC glasses-display findings draw on [@mekhontsev](https://github.com/mekhontsev)'s [MagicDesk investigation](https://github.com/mekhontsev/magicdesk/blob/main/docs/xr-resolution-fix.md) and [@Coding-BR](https://github.com/Coding-BR)'s [decompiled Nubia kernel](https://github.com/Coding-BR/android_kernel_nubia_sm8850_qwjujube). VITURE, RayNeo, XREAL, Rokid and REDMAGIC are trademarks of their owners; this project is not affiliated with them.
|
XR glasses support builds on WinNative's VITURE glasses work. VITURE protocol details were checked against [XRLinuxDriver](https://github.com/wheaney/XRLinuxDriver) by [@wheaney](https://github.com/wheaney), including the VITURE protocol header it ships, [ar-drivers-rs](https://github.com/badicsalex/ar-drivers-rs) by [@badicsalex](https://github.com/badicsalex) and the [go-macos/iokit VITURE package](https://pkg.go.dev/github.com/go-macos/iokit/viture); the optional VITURE SDK belongs to VITURE and is not included. RayNeo support adapts [@informalTechCode](https://github.com/informalTechCode)'s [RayNeo-Air-Series-3DoF-Scaffold](https://github.com/informalTechCode/RayNeo-Air-Series-3DoF-Scaffold) (Apache-2.0) and references [@verncat](https://github.com/verncat)'s [RayNeo-Air-3S-Pro-OpenVR](https://github.com/verncat/RayNeo-Air-3S-Pro-OpenVR) (MIT) and [Monado](https://gitlab.freedesktop.org/monado/monado) (BSL-1.0); see [docs/third-party/rayneo](docs/third-party/rayneo/README.md). XREAL 1S support references [XRLinuxDriver](https://github.com/wheaney/XRLinuxDriver) and [xrealOneDeviceKit](https://github.com/wheaney/xrealOneDeviceKit) by @wheaney, [xreal_one_driver](https://github.com/rohitsangwan01/xreal_one_driver) by [@rohitsangwan01](https://github.com/rohitsangwan01) (MIT) and [xr-tools](https://github.com/0xcaff/xr-tools) by [@0xcaff](https://github.com/0xcaff). The REDMAGIC glasses-display findings draw on [@mekhontsev](https://github.com/mekhontsev)'s [MagicDesk investigation](https://github.com/mekhontsev/magicdesk/blob/main/docs/xr-resolution-fix.md) and [@Coding-BR](https://github.com/Coding-BR)'s [decompiled Nubia kernel](https://github.com/Coding-BR/android_kernel_nubia_sm8850_qwjujube). VITURE, RayNeo, XREAL and REDMAGIC are trademarks of their owners; this project is not affiliated with them.
|
||||||
|
|
||||||
Joy-Con VR controllers port the arm model of Google's [Google VR SDK for Unity](https://github.com/googlevr/gvr-unity-sdk) (Apache-2.0), adapt the hand skeleton of Valve's [OpenVR](https://github.com/ValveSoftware/openvr) `handskeletonsimulation` sample (BSD-3-Clause), which follows Moshi Turner's hand simulation in [Monado](https://gitlab.freedesktop.org/monado/monado), and use the Index controller offsets from Monado's `vive_poses.c` (BSL-1.0). Joy-Con behaviour was researched in Linux's [hid-nintendo](https://github.com/torvalds/linux/blob/master/drivers/hid/hid-nintendo.c) driver by Daniel J. Ogorchock, [@dekuNukem](https://github.com/dekuNukem)'s [Nintendo_Switch_Reverse_Engineering](https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering), [SDL](https://github.com/libsdl-org/SDL) and the Android Open Source Project, and checked against [ALVR](https://github.com/alvr-org/ALVR), [OpenComposite](https://gitlab.com/znixian/OpenOVR), [PSMoveSteamVRBridge](https://github.com/HipsterSloth/PSMoveSteamVRBridge), [@F8LEFT](https://github.com/F8LEFT)'s [JoyConVr](https://github.com/F8LEFT/JoyConVr), [@krnelpan1c](https://github.com/krnelpan1c)'s [Daydream-Controller-SteamVR](https://github.com/krnelpan1c/Daydream-Controller-SteamVR), [@yoyobuae](https://github.com/yoyobuae)'s [joyconvr](https://github.com/yoyobuae/joyconvr), [Moonlight](https://github.com/moonlight-stream/moonlight-android) and [Dolphin](https://github.com/dolphin-emu/dolphin); see [docs/third-party/joycon](docs/third-party/joycon/README.md). Nintendo Switch and Joy-Con are trademarks of Nintendo; this project is not affiliated with Nintendo.
|
Joy-Con VR controllers port the arm model of Google's [Google VR SDK for Unity](https://github.com/googlevr/gvr-unity-sdk) (Apache-2.0), adapt the hand skeleton of Valve's [OpenVR](https://github.com/ValveSoftware/openvr) `handskeletonsimulation` sample (BSD-3-Clause), which follows Moshi Turner's hand simulation in [Monado](https://gitlab.freedesktop.org/monado/monado), and use the Index controller offsets from Monado's `vive_poses.c` (BSL-1.0). Joy-Con behaviour was researched in Linux's [hid-nintendo](https://github.com/torvalds/linux/blob/master/drivers/hid/hid-nintendo.c) driver by Daniel J. Ogorchock, [@dekuNukem](https://github.com/dekuNukem)'s [Nintendo_Switch_Reverse_Engineering](https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering), [SDL](https://github.com/libsdl-org/SDL) and the Android Open Source Project, and checked against [ALVR](https://github.com/alvr-org/ALVR), [OpenComposite](https://gitlab.com/znixian/OpenOVR), [PSMoveSteamVRBridge](https://github.com/HipsterSloth/PSMoveSteamVRBridge), [@F8LEFT](https://github.com/F8LEFT)'s [JoyConVr](https://github.com/F8LEFT/JoyConVr), [@krnelpan1c](https://github.com/krnelpan1c)'s [Daydream-Controller-SteamVR](https://github.com/krnelpan1c/Daydream-Controller-SteamVR), [@yoyobuae](https://github.com/yoyobuae)'s [joyconvr](https://github.com/yoyobuae/joyconvr), [Moonlight](https://github.com/moonlight-stream/moonlight-android) and [Dolphin](https://github.com/dolphin-emu/dolphin); see [docs/third-party/joycon](docs/third-party/joycon/README.md). Nintendo Switch and Joy-Con are trademarks of Nintendo; this project is not affiliated with Nintendo.
|
||||||
|
|
||||||
Camera hand tracking runs Google's [MediaPipe](https://github.com/google-ai-edge/mediapipe) Tasks Vision library with its Pose Landmarker (Lite) model, BlazePose GHUM 3D, and its Hand Landmarker model (all Apache-2.0), on frames from AndroidX [CameraX](https://developer.android.com/jetpack/androidx/releases/camera) (Apache-2.0); MediaPipe's usage reports are switched off. The design was checked against [@F8LEFT](https://github.com/F8LEFT)'s [JoyConVr](https://github.com/F8LEFT/JoyConVr) camera app (MIT), and the short Joy-Con movements follow the accelerometer mode of the [Google VR SDK for Unity](https://github.com/googlevr/gvr-unity-sdk)'s arm model, Eric Foxlin's zero-velocity updates and Frosio, Pedersini and Borghese's accelerometer autocalibration, and the camera and Joy-Con are joined by a Kalman filter (R. E. Kalman, 1960). Bare camera hands take their gestures after [ALVR](https://github.com/alvr-org/ALVR)'s `hand_gestures.rs` (MIT) and Meta Quest's menu pinch, with distances checked on photos from the [HaGRID](https://github.com/hukenovs/hagrid) gesture set (CC BY-SA 4.0, not included), fit the palm with Horn's quaternion method (1987) and smooth it with the 1€ filter (Casiez, Roussel and Vogel, 2012); the white glove model follows Valve's OpenVR render model reference and Index controller poses, is meshed with surface nets (Gibson, 1998; Mikola Lysenko) and blends and shades it with Inigo Quilez's smooth minimum and distance-field ambient occlusion, porting his polygon distance (MIT); see [docs/third-party/handtracking](docs/third-party/handtracking/README.md).
|
Camera hand tracking runs Google's [MediaPipe](https://github.com/google-ai-edge/mediapipe) Tasks Vision library with its Pose Landmarker (Lite) model, BlazePose GHUM 3D, and its Hand Landmarker model (all Apache-2.0), on frames from AndroidX [CameraX](https://developer.android.com/jetpack/androidx/releases/camera) (Apache-2.0); MediaPipe's usage reports are switched off. The design was checked against [@F8LEFT](https://github.com/F8LEFT)'s [JoyConVr](https://github.com/F8LEFT/JoyConVr) camera app (MIT), and the short Joy-Con movements follow the accelerometer mode of the [Google VR SDK for Unity](https://github.com/googlevr/gvr-unity-sdk)'s arm model, Eric Foxlin's zero-velocity updates and Frosio, Pedersini and Borghese's accelerometer autocalibration, and the camera and Joy-Con are joined by a Kalman filter (R. E. Kalman, 1960). Bare camera hands take their gestures after [ALVR](https://github.com/alvr-org/ALVR)'s `hand_gestures.rs` (MIT) and Meta Quest's menu pinch, with distances checked on photos from the [HaGRID](https://github.com/hukenovs/hagrid) gesture set (CC BY-SA 4.0, not included), fit the palm with Horn's quaternion method (1987) and smooth it with the 1€ filter (Casiez, Roussel and Vogel, 2012); the white glove model follows Valve's OpenVR render model reference and Index controller poses, is meshed with surface nets (Gibson, 1998; Mikola Lysenko) and blends and shades it with Inigo Quilez's smooth minimum and distance-field ambient occlusion, porting his polygon distance (MIT); see [docs/third-party/handtracking](docs/third-party/handtracking/README.md).
|
||||||
|
|
||||||
The Store installs and runs apps with [Flatpak](https://github.com/flatpak/flatpak) (LGPL-2.1). Its sandbox goes through DroidDeck's own bubblewrap shim, which follows how Flatpak hands bwrap its environment. Chromium and Electron apps from Flathub start their browser processes through [zypak](https://github.com/refi64/zypak) by [@refi64](https://github.com/refi64) (BSD-3-Clause); its source was read to see that it always spawns them through Flatpak's spawn portal, which is why DroidDeck starts them directly without Chromium's sandbox instead.
|
|
||||||
+20
-42
@@ -80,27 +80,10 @@ def sourceCommit = providers.environmentVariable('DROIDDECK_SOURCE_COMMIT').getO
|
|||||||
def prNumber = (providers.environmentVariable('DROIDDECK_PR_NUMBER').getOrNull() ?: '0').with { it.isInteger() ? it : '0' }
|
def prNumber = (providers.environmentVariable('DROIDDECK_PR_NUMBER').getOrNull() ?: '0').with { it.isInteger() ? it : '0' }
|
||||||
def ciBuild = providers.environmentVariable('GITHUB_ACTIONS').getOrNull() == 'true'
|
def ciBuild = providers.environmentVariable('GITHUB_ACTIONS').getOrNull() == 'true'
|
||||||
def releaseSigner = rootProject.file('keystore/release-signer.sha256').text.trim()
|
def releaseSigner = rootProject.file('keystore/release-signer.sha256').text.trim()
|
||||||
def commitTime = (gitValue(['show', '-s', '--format=%ct', '--end-of-options', sourceCommit]) ?: '0').with { it.isLong() ? it : '0' }
|
def commitTime = (gitValue(['show', '-s', '--format=%ct', 'HEAD']) ?: '0').with { it.isLong() ? it : '0' }
|
||||||
def desktopKde = rootProject.file('tools/desktop-kde/release.env').readLines()
|
def desktopKde = rootProject.file('tools/desktop-kde/release.env').readLines()
|
||||||
.findAll { it.contains('=') && !it.startsWith('#') }
|
.findAll { it.contains('=') && !it.startsWith('#') }
|
||||||
.collectEntries { def kv = it.split('=', 2); [(kv[0].trim()): kv[1].trim()] }
|
.collectEntries { def kv = it.split('=', 2); [(kv[0].trim()): kv[1].trim()] }
|
||||||
def trackingPack = rootProject.file('tools/packs/tracking/release.env').readLines()
|
|
||||||
.findAll { it.contains('=') && !it.startsWith('#') }
|
|
||||||
.collectEntries { def kv = it.split('=', 2); [(kv[0].trim()): kv[1].trim()] }
|
|
||||||
def addonPacks = ['proot', 'directaudio', 'tracking', 'xbox', 'comet', 'amazon'].collectEntries { name ->
|
|
||||||
def pack = file("build/packs/${name}.tar.zst")
|
|
||||||
if (!pack.isFile()) {
|
|
||||||
if (ciBuild) throw new GradleException("Add-on pack ${pack} is missing: run tools/packs/build.sh app/build/packs")
|
|
||||||
return [(name): [sha256: '', size: 0L]]
|
|
||||||
}
|
|
||||||
def digest = java.security.MessageDigest.getInstance('SHA-256')
|
|
||||||
pack.withInputStream { input ->
|
|
||||||
byte[] buffer = new byte[1 << 20]
|
|
||||||
int n
|
|
||||||
while ((n = input.read(buffer)) > 0) digest.update(buffer, 0, n)
|
|
||||||
}
|
|
||||||
[(name): [sha256: digest.digest().encodeHex().toString(), size: pack.length()]]
|
|
||||||
}
|
|
||||||
def desktopRemovalSources = new groovy.json.JsonSlurper().parse(file('src/main/assets/desktop-removal/sources.json'))
|
def desktopRemovalSources = new groovy.json.JsonSlurper().parse(file('src/main/assets/desktop-removal/sources.json'))
|
||||||
if (desktopRemovalSources.archives[desktopKde.DESKTOP_KDE_TAG] != desktopKde.DESKTOP_KDE_SHA256) {
|
if (desktopRemovalSources.archives[desktopKde.DESKTOP_KDE_TAG] != desktopKde.DESKTOP_KDE_SHA256) {
|
||||||
throw new GradleException('Desktop removal inventories do not match the pinned archive')
|
throw new GradleException('Desktop removal inventories do not match the pinned archive')
|
||||||
@@ -122,8 +105,8 @@ android {
|
|||||||
applicationId "com.droiddeck.launcher"
|
applicationId "com.droiddeck.launcher"
|
||||||
minSdkVersion 26
|
minSdkVersion 26
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 15
|
versionCode 14
|
||||||
versionName "0.6.0"
|
versionName "0.5.0"
|
||||||
buildConfigField "String", "BUILD_LABEL", "\"${escapedBuildLabel}\""
|
buildConfigField "String", "BUILD_LABEL", "\"${escapedBuildLabel}\""
|
||||||
buildConfigField "String", "SOURCE_COMMIT", "\"${sourceCommit}\""
|
buildConfigField "String", "SOURCE_COMMIT", "\"${sourceCommit}\""
|
||||||
buildConfigField "int", "PR_NUMBER", "${prNumber}"
|
buildConfigField "int", "PR_NUMBER", "${prNumber}"
|
||||||
@@ -136,10 +119,6 @@ android {
|
|||||||
buildConfigField "String", "DESKTOP_KDE_URL", "\"https://github.com/${desktopKde.DESKTOP_KDE_REPO}/releases/download/${desktopKde.DESKTOP_KDE_TAG}/desktop-kde.tar.zst\""
|
buildConfigField "String", "DESKTOP_KDE_URL", "\"https://github.com/${desktopKde.DESKTOP_KDE_REPO}/releases/download/${desktopKde.DESKTOP_KDE_TAG}/desktop-kde.tar.zst\""
|
||||||
buildConfigField "String", "DESKTOP_KDE_SHA256", "\"${desktopKde.DESKTOP_KDE_SHA256}\""
|
buildConfigField "String", "DESKTOP_KDE_SHA256", "\"${desktopKde.DESKTOP_KDE_SHA256}\""
|
||||||
buildConfigField "long", "DESKTOP_KDE_SIZE", "${desktopKde.DESKTOP_KDE_SIZE}L"
|
buildConfigField "long", "DESKTOP_KDE_SIZE", "${desktopKde.DESKTOP_KDE_SIZE}L"
|
||||||
addonPacks.each { name, pack ->
|
|
||||||
buildConfigField "String", "PACK_${name.toUpperCase()}_SHA256", "\"${pack.sha256}\""
|
|
||||||
buildConfigField "long", "PACK_${name.toUpperCase()}_SIZE", "${pack.size}L"
|
|
||||||
}
|
|
||||||
|
|
||||||
ndk {
|
ndk {
|
||||||
abiFilters 'arm64-v8a'
|
abiFilters 'arm64-v8a'
|
||||||
@@ -193,11 +172,6 @@ android {
|
|||||||
disable 'ExpiredTargetSdkVersion'
|
disable 'ExpiredTargetSdkVersion'
|
||||||
}
|
}
|
||||||
|
|
||||||
androidResources {
|
|
||||||
// aapt's default ignore list, plus the trees shipped as add-on packs (tools/packs).
|
|
||||||
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~:<dir>droiddeck-xbox:<dir>droiddeck-comet:<dir>directaudio'
|
|
||||||
}
|
|
||||||
|
|
||||||
packagingOptions {
|
packagingOptions {
|
||||||
resources {
|
resources {
|
||||||
excludes += ['META-INF/versions/9/OSGI-INF/MANIFEST.MF']
|
excludes += ['META-INF/versions/9/OSGI-INF/MANIFEST.MF']
|
||||||
@@ -205,8 +179,6 @@ android {
|
|||||||
jniLibs {
|
jniLibs {
|
||||||
useLegacyPackaging = true
|
useLegacyPackaging = true
|
||||||
pickFirsts += ['**/libtermux.so']
|
pickFirsts += ['**/libtermux.so']
|
||||||
// Shipped in the proot and tracking packs (tools/packs) and run or loaded from there.
|
|
||||||
excludes += ['**/libproot.so', '**/libproot-loader.so', '**/libopencv_java4.so', '**/libmediapipe_tasks_jni.so']
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,12 +192,6 @@ android {
|
|||||||
unitTests.returnDefaultValues = true
|
unitTests.returnDefaultValues = true
|
||||||
unitTests.includeAndroidResources = true
|
unitTests.includeAndroidResources = true
|
||||||
unitTests.all {
|
unitTests.all {
|
||||||
if (ciBuild) {
|
|
||||||
outputs.upToDateWhen { false }
|
|
||||||
outputs.doNotCacheIf('CI executes the test suite on every run') { true }
|
|
||||||
}
|
|
||||||
// Robolectric keeps a sandbox per SDK level the tests ask for; seven no longer fit in Gradle's default 512 MB.
|
|
||||||
maxHeapSize = '2g'
|
|
||||||
def logTarget = providers.systemProperty('robolectric.logging').orNull
|
def logTarget = providers.systemProperty('robolectric.logging').orNull
|
||||||
if (logTarget != null) systemProperty 'robolectric.logging', logTarget
|
if (logTarget != null) systemProperty 'robolectric.logging', logTarget
|
||||||
}
|
}
|
||||||
@@ -296,7 +262,6 @@ def buildRustStores = tasks.register('buildRustStores', Exec) {
|
|||||||
inputs.dir(rustCrateDir.dir('src'))
|
inputs.dir(rustCrateDir.dir('src'))
|
||||||
inputs.files(rustCrateDir.file('Cargo.toml'), rustCrateDir.file('Cargo.lock'))
|
inputs.files(rustCrateDir.file('Cargo.toml'), rustCrateDir.file('Cargo.lock'))
|
||||||
inputs.property('ndkVersion', android.ndkVersion)
|
inputs.property('ndkVersion', android.ndkVersion)
|
||||||
inputs.property('storeFeatures', 'gog,epic')
|
|
||||||
if (!skipRust) inputs.property('rustToolchain', providers.exec {
|
if (!skipRust) inputs.property('rustToolchain', providers.exec {
|
||||||
environment 'PATH', "${System.getProperty('user.home')}/.cargo/bin${File.pathSeparator}${System.getenv('PATH')}"
|
environment 'PATH', "${System.getProperty('user.home')}/.cargo/bin${File.pathSeparator}${System.getenv('PATH')}"
|
||||||
commandLine 'rustup', 'run', 'stable', 'rustc', '-Vv'
|
commandLine 'rustup', 'run', 'stable', 'rustc', '-Vv'
|
||||||
@@ -312,13 +277,27 @@ def buildRustStores = tasks.register('buildRustStores', Exec) {
|
|||||||
}.standardOutput.asText.get().trim()
|
}.standardOutput.asText.get().trim()
|
||||||
commandLine 'rustup', 'run', 'stable', 'cargo', 'ndk', '--target', 'arm64-v8a', '--platform', '26',
|
commandLine 'rustup', 'run', 'stable', 'cargo', 'ndk', '--target', 'arm64-v8a', '--platform', '26',
|
||||||
'--output-dir', rustJniLibsDir.get().asFile.absolutePath,
|
'--output-dir', rustJniLibsDir.get().asFile.absolutePath,
|
||||||
'build', '--release', '--locked', '--no-default-features', '--features', 'gog,epic'
|
'build', '--release', '--locked'
|
||||||
}
|
}
|
||||||
if (!skipRust) android.sourceSets.main.jniLibs.srcDir(rustJniLibsDir)
|
if (!skipRust) android.sourceSets.main.jniLibs.srcDir(rustJniLibsDir)
|
||||||
tasks.named('preBuild').configure { dependsOn(buildRustStores) }
|
tasks.named('preBuild').configure { dependsOn(buildRustStores) }
|
||||||
|
|
||||||
|
def verifyHandModel = tasks.register('verifyHandModel') {
|
||||||
|
def models = ['hand_landmarker.task': 'fbc2a30080c3c557093b5ddfc334698132eb341044ccee322ccf8bcf3607cde1',
|
||||||
|
'hand_landmarker_lite.task': '173c0f47ecee7e935bd4a1e93aa580756b4180c1307c07d709313e82c28672c8']
|
||||||
|
.collectEntries { name, hash -> [(file("src/main/assets/models/$name")): hash] }
|
||||||
|
inputs.files(models.keySet())
|
||||||
|
doLast {
|
||||||
|
models.each { model, expected ->
|
||||||
|
def actual = java.security.MessageDigest.getInstance('SHA-256').digest(model.bytes).encodeHex().toString()
|
||||||
|
if (actual != expected) throw new GradleException("Hand Landmarker model checksum mismatch: ${model.name}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tasks.named('preBuild').configure { dependsOn(verifyHandModel) }
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "org.opencv:opencv:${trackingPack.OPENCV_VERSION}"
|
implementation 'org.opencv:opencv:4.13.0'
|
||||||
implementation 'org.khronos.openxr:openxr_loader_for_android:1.1.49'
|
implementation 'org.khronos.openxr:openxr_loader_for_android:1.1.49'
|
||||||
implementation 'com.github.luben:zstd-jni:1.5.7-4@aar'
|
implementation 'com.github.luben:zstd-jni:1.5.7-4@aar'
|
||||||
implementation 'org.apache.commons:commons-compress:1.27.1'
|
implementation 'org.apache.commons:commons-compress:1.27.1'
|
||||||
@@ -337,8 +316,7 @@ dependencies {
|
|||||||
implementation 'com.termux.termux-app:terminal-view:0.118.0'
|
implementation 'com.termux.termux-app:terminal-view:0.118.0'
|
||||||
implementation 'androidx.camera:camera-camera2:1.4.2'
|
implementation 'androidx.camera:camera-camera2:1.4.2'
|
||||||
implementation 'androidx.camera:camera-lifecycle:1.4.2'
|
implementation 'androidx.camera:camera-lifecycle:1.4.2'
|
||||||
implementation 'androidx.webkit:webkit:1.12.1'
|
implementation('com.google.mediapipe:tasks-vision:1.0.0') {
|
||||||
implementation("com.google.mediapipe:tasks-vision:${trackingPack.MEDIAPIPE_VERSION}") {
|
|
||||||
exclude group: 'com.google.auto.value', module: 'auto-value'
|
exclude group: 'com.google.auto.value', module: 'auto-value'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,10 +61,15 @@
|
|||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".FrontEndActivity"
|
android:name=".MainActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:screenOrientation="sensorLandscape"
|
android:screenOrientation="sensorLandscape"
|
||||||
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|density|keyboard|keyboardHidden|navigation">
|
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|density|keyboard|keyboardHidden|navigation">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
<category android:name="android.intent.category.CAR_LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
@@ -83,31 +88,6 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity-alias
|
|
||||||
android:name=".MainActivity"
|
|
||||||
android:targetActivity=".FrontEndActivity"
|
|
||||||
android:icon="@mipmap/ic_launcher"
|
|
||||||
android:exported="true">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
|
||||||
<category android:name="android.intent.category.CAR_LAUNCHER" />
|
|
||||||
</intent-filter>
|
|
||||||
</activity-alias>
|
|
||||||
|
|
||||||
<activity-alias
|
|
||||||
android:name=".LauncherLight"
|
|
||||||
android:targetActivity=".FrontEndActivity"
|
|
||||||
android:icon="@mipmap/ic_launcher_light"
|
|
||||||
android:enabled="false"
|
|
||||||
android:exported="true">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
|
||||||
<category android:name="android.intent.category.CAR_LAUNCHER" />
|
|
||||||
</intent-filter>
|
|
||||||
</activity-alias>
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".HomeActivity"
|
android:name=".HomeActivity"
|
||||||
android:enabled="false"
|
android:enabled="false"
|
||||||
@@ -147,10 +127,6 @@
|
|||||||
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|density"
|
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|density"
|
||||||
android:theme="@style/AppTheme" />
|
android:theme="@style/AppTheme" />
|
||||||
|
|
||||||
<activity android:name=".stores.xbox.XboxLoginActivity" android:exported="false"
|
|
||||||
android:process=":xboxlogin" android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|density"
|
|
||||||
android:theme="@style/AppTheme" />
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".stores.StoreLoginActivity"
|
android:name=".stores.StoreLoginActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
@@ -177,6 +153,15 @@
|
|||||||
android:resizeableActivity="true"
|
android:resizeableActivity="true"
|
||||||
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|keyboard|keyboardHidden|navigation|uiMode|density" />
|
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|keyboard|keyboardHidden|navigation|uiMode|density" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".ui.SecondScreenActivity"
|
||||||
|
android:exported="false"
|
||||||
|
android:excludeFromRecents="true"
|
||||||
|
android:theme="@style/SessionTheme"
|
||||||
|
android:screenOrientation="sensorLandscape"
|
||||||
|
android:resizeableActivity="true"
|
||||||
|
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|keyboard|keyboardHidden|navigation|uiMode|density" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".gpu.SteamVrRestartActivity"
|
android:name=".gpu.SteamVrRestartActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2026 Holger Bartnick
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
File renamed without changes.
Binary file not shown.
File renamed without changes.
File renamed without changes.
@@ -11,23 +11,23 @@ add_subdirectory(adrenotools)
|
|||||||
# DXVK's DXBC->SPIR-V translator is zlib licensed (vendored under thirdparty/dxbc).
|
# DXVK's DXBC->SPIR-V translator is zlib licensed (vendored under thirdparty/dxbc).
|
||||||
add_subdirectory(thirdparty/dxbc)
|
add_subdirectory(thirdparty/dxbc)
|
||||||
|
|
||||||
set(DDFG_UPSTREAM "v0.3.0")
|
set(WINFG_UPSTREAM "v0.3.0")
|
||||||
set(DDFG_CHAIN_SRC
|
set(WINFG_CHAIN_SRC
|
||||||
framegen/ddfg/framegen.cpp
|
framegen/winfg/framegen.cpp
|
||||||
framegen/ddfg/framegen.hpp
|
framegen/winfg/framegen.hpp
|
||||||
framegen/ddfg/record_impl.inc
|
framegen/winfg/record_impl.inc
|
||||||
framegen/ddfg/config.hpp
|
framegen/winfg/config.hpp
|
||||||
framegen/ddfg/embedded_shaders.hpp
|
framegen/winfg/embedded_shaders.hpp
|
||||||
framegen/ddfg/ddfg_engine.cpp
|
framegen/winfg/winfg_engine.cpp
|
||||||
)
|
)
|
||||||
set(DDFG_HASH_INPUT "")
|
set(WINFG_HASH_INPUT "")
|
||||||
foreach(f ${DDFG_CHAIN_SRC})
|
foreach(f ${WINFG_CHAIN_SRC})
|
||||||
file(SHA256 "${CMAKE_CURRENT_SOURCE_DIR}/${f}" _h)
|
file(SHA256 "${CMAKE_CURRENT_SOURCE_DIR}/${f}" _h)
|
||||||
string(APPEND DDFG_HASH_INPUT "${_h}")
|
string(APPEND WINFG_HASH_INPUT "${_h}")
|
||||||
endforeach()
|
endforeach()
|
||||||
string(SHA256 DDFG_CHAIN_HASH_FULL "${DDFG_HASH_INPUT}")
|
string(SHA256 WINFG_CHAIN_HASH_FULL "${WINFG_HASH_INPUT}")
|
||||||
string(SUBSTRING "${DDFG_CHAIN_HASH_FULL}" 0 12 DDFG_CHAIN_HASH)
|
string(SUBSTRING "${WINFG_CHAIN_HASH_FULL}" 0 12 WINFG_CHAIN_HASH)
|
||||||
message(STATUS "dd-fg chain: win-fg ${DDFG_UPSTREAM} (src ${DDFG_CHAIN_HASH})")
|
message(STATUS "win-fg chain: ${WINFG_UPSTREAM} (src ${WINFG_CHAIN_HASH})")
|
||||||
|
|
||||||
add_subdirectory(waylandcomp)
|
add_subdirectory(waylandcomp)
|
||||||
add_subdirectory(questxr)
|
add_subdirectory(questxr)
|
||||||
@@ -39,10 +39,6 @@ target_link_libraries(deviceinfo dl)
|
|||||||
|
|
||||||
add_library(termux SHARED termux/termux.c)
|
add_library(termux SHARED termux/termux.c)
|
||||||
|
|
||||||
add_library(ddvenc SHARED venc/venc_server.cpp)
|
|
||||||
target_compile_features(ddvenc PRIVATE cxx_std_17)
|
|
||||||
target_link_libraries(ddvenc mediandk log)
|
|
||||||
|
|
||||||
# The optional proprietary SDK is supplied locally; its headers/libraries are not vendored.
|
# The optional proprietary SDK is supplied locally; its headers/libraries are not vendored.
|
||||||
if(DROIDDECK_VITURE_SDK_DIR)
|
if(DROIDDECK_VITURE_SDK_DIR)
|
||||||
add_library(droiddeck_viture SHARED viture/sdk_bridge.cpp)
|
add_library(droiddeck_viture SHARED viture/sdk_bridge.cpp)
|
||||||
|
|||||||
@@ -21,9 +21,6 @@
|
|||||||
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#ifdef __GLIBC__
|
|
||||||
#include <gnu/lib-names.h>
|
|
||||||
#endif
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
#include <linux/joystick.h>
|
#include <linux/joystick.h>
|
||||||
@@ -1184,9 +1181,8 @@ struct TritonSharedData {
|
|||||||
uint32_t input_length;
|
uint32_t input_length;
|
||||||
uint8_t input[64];
|
uint8_t input[64];
|
||||||
uint64_t output_seq;
|
uint64_t output_seq;
|
||||||
uint16_t output_feature;
|
uint32_t output_feature;
|
||||||
uint16_t output_length;
|
uint32_t output_length;
|
||||||
uint32_t output_ack;
|
|
||||||
uint8_t output[64];
|
uint8_t output[64];
|
||||||
uint64_t get_request;
|
uint64_t get_request;
|
||||||
uint64_t get_reply;
|
uint64_t get_reply;
|
||||||
@@ -1203,8 +1199,6 @@ static_assert(offsetof(TritonSharedData, report_id) == 16, "Triton report ID off
|
|||||||
static_assert(offsetof(TritonSharedData, input) == 24, "Triton input offset");
|
static_assert(offsetof(TritonSharedData, input) == 24, "Triton input offset");
|
||||||
static_assert(offsetof(TritonSharedData, output_seq) == 88, "Triton output sequence offset");
|
static_assert(offsetof(TritonSharedData, output_seq) == 88, "Triton output sequence offset");
|
||||||
static_assert(offsetof(TritonSharedData, output_feature) == 96, "Triton output feature offset");
|
static_assert(offsetof(TritonSharedData, output_feature) == 96, "Triton output feature offset");
|
||||||
static_assert(offsetof(TritonSharedData, output_length) == 98, "Triton output length offset");
|
|
||||||
static_assert(offsetof(TritonSharedData, output_ack) == 100, "Triton output ack offset");
|
|
||||||
static_assert(offsetof(TritonSharedData, output) == 104, "Triton output offset");
|
static_assert(offsetof(TritonSharedData, output) == 104, "Triton output offset");
|
||||||
static_assert(offsetof(TritonSharedData, get_request) == 168, "Triton feature request offset");
|
static_assert(offsetof(TritonSharedData, get_request) == 168, "Triton feature request offset");
|
||||||
static_assert(offsetof(TritonSharedData, get_reply) == 176, "Triton feature reply offset");
|
static_assert(offsetof(TritonSharedData, get_reply) == 176, "Triton feature reply offset");
|
||||||
@@ -1222,8 +1216,6 @@ static constexpr int TRITON_REPORT_ID_BYTES = 1;
|
|||||||
static constexpr int TRITON_STATE_BYTES = 45;
|
static constexpr int TRITON_STATE_BYTES = 45;
|
||||||
static constexpr int TRITON_REPORT_INTERVAL_US = 4000;
|
static constexpr int TRITON_REPORT_INTERVAL_US = 4000;
|
||||||
static constexpr int TRITON_FEATURE_TIMEOUT_MS = 500;
|
static constexpr int TRITON_FEATURE_TIMEOUT_MS = 500;
|
||||||
// The app clears output_length once it has taken a report; a writer waits this long for that before overwriting.
|
|
||||||
static constexpr int TRITON_OUTPUT_TIMEOUT_MS = 50;
|
|
||||||
static constexpr const char *TRITON_NAME = "Steam Controller";
|
static constexpr const char *TRITON_NAME = "Steam Controller";
|
||||||
static constexpr const char *TRITON_SERIAL = "DROIDDECKSC01";
|
static constexpr const char *TRITON_SERIAL = "DROIDDECKSC01";
|
||||||
static const uint8_t kTritonReportDescriptor[] = {
|
static const uint8_t kTritonReportDescriptor[] = {
|
||||||
@@ -2579,21 +2571,11 @@ __attribute__((visibility("hidden"))) static void triton_queue_output(DeckHidraw
|
|||||||
if (!data || !size || size > 64 || triton.mapping_size < TRITON_SHARED_OFFSET + TRITON_SHARED_BLOCK_SIZE) return;
|
if (!data || !size || size > 64 || triton.mapping_size < TRITON_SHARED_OFFSET + TRITON_SHARED_BLOCK_SIZE) return;
|
||||||
auto *shared = reinterpret_cast<TritonSharedData *>(reinterpret_cast<uint8_t *>(triton.ring) + TRITON_SHARED_OFFSET);
|
auto *shared = reinterpret_cast<TritonSharedData *>(reinterpret_cast<uint8_t *>(triton.ring) + TRITON_SHARED_OFFSET);
|
||||||
if (__atomic_load_n(&shared->magic, __ATOMIC_ACQUIRE) != TRITON_SHARED_MAGIC) return;
|
if (__atomic_load_n(&shared->magic, __ATOMIC_ACQUIRE) != TRITON_SHARED_MAGIC) return;
|
||||||
static std::mutex one_at_a_time;
|
|
||||||
std::lock_guard<std::mutex> guard(one_at_a_time);
|
|
||||||
for (int waited = 0;
|
|
||||||
static_cast<uint32_t>(__atomic_load_n(&shared->output_seq, __ATOMIC_ACQUIRE)) !=
|
|
||||||
__atomic_load_n(&shared->output_ack, __ATOMIC_ACQUIRE) &&
|
|
||||||
__atomic_load_n(&shared->connected, __ATOMIC_ACQUIRE) != 0 && waited < TRITON_OUTPUT_TIMEOUT_MS * 4;
|
|
||||||
waited++) {
|
|
||||||
struct timespec interval = {0, 250 * 1000L};
|
|
||||||
nanosleep(&interval, nullptr);
|
|
||||||
}
|
|
||||||
uint64_t seq = __atomic_load_n(&shared->output_seq, __ATOMIC_RELAXED);
|
uint64_t seq = __atomic_load_n(&shared->output_seq, __ATOMIC_RELAXED);
|
||||||
if (seq & 1) seq++;
|
if (seq & 1) seq++;
|
||||||
__atomic_store_n(&shared->output_seq, seq + 1, __ATOMIC_RELEASE);
|
__atomic_store_n(&shared->output_seq, seq + 1, __ATOMIC_RELEASE);
|
||||||
shared->output_feature = feature ? 1 : 0;
|
shared->output_feature = feature ? 1 : 0;
|
||||||
shared->output_length = static_cast<uint16_t>(size);
|
shared->output_length = static_cast<uint32_t>(size);
|
||||||
memcpy(shared->output, data, size);
|
memcpy(shared->output, data, size);
|
||||||
if (size < sizeof(shared->output)) memset(shared->output + size, 0, sizeof(shared->output) - size);
|
if (size < sizeof(shared->output)) memset(shared->output + size, 0, sizeof(shared->output) - size);
|
||||||
__atomic_thread_fence(__ATOMIC_RELEASE);
|
__atomic_thread_fence(__ATOMIC_RELEASE);
|
||||||
@@ -2650,38 +2632,6 @@ __attribute__((visibility("hidden"))) static int triton_get_feature(DeckHidraw &
|
|||||||
static constexpr uint32_t TRITON_HWID = 72;
|
static constexpr uint32_t TRITON_HWID = 72;
|
||||||
static constexpr uint32_t TRITON_FW_TIMESTAMP = 0x6AC686B3;
|
static constexpr uint32_t TRITON_FW_TIMESTAMP = 0x6AC686B3;
|
||||||
|
|
||||||
// Steam compares the controller's firmware with TRITON_FW_TS in its bundled hardwareupdater.cfg (and blocks
|
|
||||||
// with a required update below MUST_UPDATE_TRITON_FW_TS), so the emulated pad reports at least the build
|
|
||||||
// Steam ships.
|
|
||||||
static uint32_t triton_fw_timestamp() {
|
|
||||||
static const uint32_t timestamp = [] {
|
|
||||||
std::vector<std::string> roots;
|
|
||||||
char exe[PATH_MAX];
|
|
||||||
ssize_t n = readlink("/proc/self/exe", exe, sizeof(exe) - 1);
|
|
||||||
if (n > 0) {
|
|
||||||
std::string path(exe, static_cast<size_t>(n));
|
|
||||||
size_t bin = path.rfind('/');
|
|
||||||
size_t root = bin == std::string::npos || bin == 0 ? std::string::npos : path.rfind('/', bin - 1);
|
|
||||||
if (bin != std::string::npos && bin > 0) roots.push_back(path.substr(0, bin));
|
|
||||||
if (root != std::string::npos) roots.push_back(path.substr(0, root));
|
|
||||||
}
|
|
||||||
if (const char *home = getenv("HOME")) roots.push_back(std::string(home) + "/.local/share/Steam");
|
|
||||||
uint32_t newest = TRITON_FW_TIMESTAMP;
|
|
||||||
for (const std::string &root : roots) {
|
|
||||||
std::ifstream cfg(root + "/bin/hardwareupdater/hardwareupdater.cfg");
|
|
||||||
std::string line;
|
|
||||||
while (std::getline(cfg, line)) {
|
|
||||||
if (line.rfind("TRITON_FW_TS:", 0) != 0) continue;
|
|
||||||
uint32_t shipped = static_cast<uint32_t>(strtoul(line.c_str() + 13, nullptr, 16));
|
|
||||||
if (shipped > newest) newest = shipped;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (newest != TRITON_FW_TIMESTAMP) Logger::log("triton: reporting firmware %08x, the build Steam ships\n", newest);
|
|
||||||
return newest;
|
|
||||||
}();
|
|
||||||
return timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__((visibility("hidden"))) static int triton_pad_feature(DeckHidraw &triton, uint8_t *buf, size_t size, bool set) {
|
__attribute__((visibility("hidden"))) static int triton_pad_feature(DeckHidraw &triton, uint8_t *buf, size_t size, bool set) {
|
||||||
if (!buf || size < 2) {
|
if (!buf || size < 2) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
@@ -2702,7 +2652,7 @@ __attribute__((visibility("hidden"))) static int triton_pad_feature(DeckHidraw &
|
|||||||
switch (triton.pending_feature) {
|
switch (triton.pending_feature) {
|
||||||
case DECK_GET_ATTRIBUTES_VALUES: {
|
case DECK_GET_ATTRIBUTES_VALUES: {
|
||||||
static const uint8_t kIds[] = {0x01, 0x02, 0x04, 0x09, 0x0a, 0x0b};
|
static const uint8_t kIds[] = {0x01, 0x02, 0x04, 0x09, 0x0a, 0x0b};
|
||||||
const uint32_t values[] = {static_cast<uint32_t>(TRITON_WIRED_PRODUCT), 0, triton_fw_timestamp(), TRITON_HWID, 0, 4000};
|
const uint32_t values[] = {static_cast<uint32_t>(TRITON_WIRED_PRODUCT), 0, TRITON_FW_TIMESTAMP, TRITON_HWID, 0, 4000};
|
||||||
reply[2] = sizeof(kIds) * 5;
|
reply[2] = sizeof(kIds) * 5;
|
||||||
for (size_t i = 0; i < sizeof(kIds); i++) {
|
for (size_t i = 0; i < sizeof(kIds); i++) {
|
||||||
reply[3 + i * 5] = kIds[i];
|
reply[3 + i * 5] = kIds[i];
|
||||||
@@ -3627,21 +3577,7 @@ EXPORT int close(int fd) {
|
|||||||
static constexpr int kMaxRingWaitMs = 2;
|
static constexpr int kMaxRingWaitMs = 2;
|
||||||
static constexpr int kLowLatencyRingWaitUs = 250;
|
static constexpr int kLowLatencyRingWaitUs = 250;
|
||||||
|
|
||||||
static ssize_t copy_input_events(void *buf, const struct input_event *events, size_t count) {
|
EXPORT ssize_t read(int fd, void *buf, size_t count) {
|
||||||
size_t bytes = count * sizeof(struct input_event);
|
|
||||||
struct iovec local = {const_cast<struct input_event *>(events), bytes};
|
|
||||||
struct iovec remote = {buf, bytes};
|
|
||||||
ssize_t copied = syscall(SYS_process_vm_writev, getpid(), &local, 1, &remote, 1, 0);
|
|
||||||
if (copied < 0) return -1;
|
|
||||||
if (copied != static_cast<ssize_t>(bytes)) {
|
|
||||||
errno = EFAULT;
|
|
||||||
copied -= copied % sizeof(struct input_event);
|
|
||||||
if (!copied) return -1;
|
|
||||||
}
|
|
||||||
return copied;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ssize_t read_input(int fd, void *buf, size_t count) {
|
|
||||||
if (!watched(fd)) return syscall(SYS_read, fd, buf, count);
|
if (!watched(fd)) return syscall(SYS_read, fd, buf, count);
|
||||||
std::unique_lock<std::recursive_mutex> guard(controller_mutex());
|
std::unique_lock<std::recursive_mutex> guard(controller_mutex());
|
||||||
auto controller = controller_map().find(fd);
|
auto controller = controller_map().find(fd);
|
||||||
@@ -3686,44 +3622,42 @@ static ssize_t read_input(int fd, void *buf, size_t count) {
|
|||||||
if (events == 0) break;
|
if (events == 0) break;
|
||||||
const uint8_t *ring_events = reinterpret_cast<const uint8_t *>(fake.ring) +
|
const uint8_t *ring_events = reinterpret_cast<const uint8_t *>(fake.ring) +
|
||||||
FAKE_INPUT_RING_HEADER_SIZE;
|
FAKE_INPUT_RING_HEADER_SIZE;
|
||||||
std::vector<struct input_event> input_events(events);
|
|
||||||
for (size_t i = 0; i < events; ++i) {
|
for (size_t i = 0; i < events; ++i) {
|
||||||
size_t index = (fake.read_seq + i) % FAKE_INPUT_RING_CAPACITY;
|
size_t index = (fake.read_seq + i) % FAKE_INPUT_RING_CAPACITY;
|
||||||
RingEvent stored;
|
RingEvent stored;
|
||||||
memcpy(&stored, ring_events + index * FAKE_INPUT_EVENT_SIZE, FAKE_INPUT_EVENT_SIZE);
|
memcpy(&stored, ring_events + index * FAKE_INPUT_EVENT_SIZE, FAKE_INPUT_EVENT_SIZE);
|
||||||
struct input_event &ev = input_events[i];
|
struct input_event ev = {};
|
||||||
ev.time.tv_sec = stored.sec;
|
ev.time.tv_sec = stored.sec;
|
||||||
ev.time.tv_usec = stored.usec;
|
ev.time.tv_usec = stored.usec;
|
||||||
ev.type = stored.type;
|
ev.type = stored.type;
|
||||||
ev.code = stored.code;
|
ev.code = stored.code;
|
||||||
ev.value = stored.value;
|
ev.value = stored.value;
|
||||||
if (ev.type == EV_ABS) ev.code = presented_abs_code(fake, ev.code);
|
if (ev.type == EV_ABS) ev.code = presented_abs_code(fake, ev.code);
|
||||||
|
memcpy(static_cast<uint8_t *>(buf) + i * sizeof(ev), &ev, sizeof(ev));
|
||||||
}
|
}
|
||||||
__atomic_thread_fence(__ATOMIC_ACQUIRE);
|
__atomic_thread_fence(__ATOMIC_ACQUIRE);
|
||||||
if (snap.sequence != __atomic_load_n(&fake.ring->snapshot_seq, __ATOMIC_RELAXED))
|
if (snap.sequence != __atomic_load_n(&fake.ring->snapshot_seq, __ATOMIC_RELAXED))
|
||||||
continue;
|
continue;
|
||||||
ssize_t copied = copy_input_events(buf, input_events.data(), events);
|
fake.read_seq += events;
|
||||||
if (copied > 0) fake.read_seq += copied / sizeof(struct input_event);
|
return static_cast<ssize_t>(events * sizeof(struct input_event));
|
||||||
return copied;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t events = std::min(requested, fake.keyframe_remaining);
|
size_t events = std::min(requested, fake.keyframe_remaining);
|
||||||
struct input_event input_events[kNeutralEventCount] = {};
|
|
||||||
struct timeval now = {};
|
struct timeval now = {};
|
||||||
gettimeofday(&now, nullptr);
|
gettimeofday(&now, nullptr);
|
||||||
for (size_t i = 0; i < events; ++i) {
|
for (size_t i = 0; i < events; ++i) {
|
||||||
size_t index = kNeutralEventCount - fake.keyframe_remaining + i;
|
size_t index = kNeutralEventCount - fake.keyframe_remaining;
|
||||||
struct input_event &ev = input_events[i];
|
struct input_event ev = {};
|
||||||
ev.time = now;
|
ev.time = now;
|
||||||
ev.type = kNeutralEvents[index].type;
|
ev.type = kNeutralEvents[index].type;
|
||||||
ev.code = kNeutralEvents[index].code;
|
ev.code = kNeutralEvents[index].code;
|
||||||
ev.value = keyframe_value(fake, ev.type, ev.code);
|
ev.value = keyframe_value(fake, ev.type, ev.code);
|
||||||
if (ev.type == EV_ABS) ev.code = presented_abs_code(fake, ev.code);
|
if (ev.type == EV_ABS) ev.code = presented_abs_code(fake, ev.code);
|
||||||
|
memcpy(static_cast<uint8_t *>(buf) + i * sizeof(ev), &ev, sizeof(ev));
|
||||||
|
--fake.keyframe_remaining;
|
||||||
}
|
}
|
||||||
ssize_t copied = copy_input_events(buf, input_events, events);
|
return static_cast<ssize_t>(events * sizeof(struct input_event));
|
||||||
if (copied > 0) fake.keyframe_remaining -= copied / sizeof(struct input_event);
|
|
||||||
return copied;
|
|
||||||
}
|
}
|
||||||
if (nonblock) {
|
if (nonblock) {
|
||||||
errno = EAGAIN;
|
errno = EAGAIN;
|
||||||
@@ -3739,52 +3673,6 @@ static ssize_t read_input(int fd, void *buf, size_t count) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT ssize_t read(int fd, void *buf, size_t count) {
|
|
||||||
return read_input(fd, buf, count);
|
|
||||||
}
|
|
||||||
|
|
||||||
EXPORT ssize_t readv(int fd, const struct iovec *iov, int iovcnt) {
|
|
||||||
if (!is_fake_input_fd(fd)) return syscall(SYS_readv, fd, iov, iovcnt);
|
|
||||||
if (iovcnt < 0 || iovcnt > IOV_MAX) {
|
|
||||||
errno = EINVAL;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (iovcnt && !iov) {
|
|
||||||
errno = EFAULT;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
std::vector<struct iovec> copied_iov(static_cast<size_t>(iovcnt));
|
|
||||||
if (iovcnt) {
|
|
||||||
size_t bytes = copied_iov.size() * sizeof(struct iovec);
|
|
||||||
struct iovec local = {copied_iov.data(), bytes};
|
|
||||||
struct iovec remote = {const_cast<struct iovec *>(iov), bytes};
|
|
||||||
ssize_t copied = syscall(SYS_process_vm_readv, getpid(), &local, 1, &remote, 1, 0);
|
|
||||||
if (copied != static_cast<ssize_t>(bytes)) {
|
|
||||||
errno = EFAULT;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
iov = copied_iov.data();
|
|
||||||
size_t size = 0;
|
|
||||||
for (int i = 0; i < iovcnt; ++i) {
|
|
||||||
if (iov[i].iov_len > static_cast<size_t>(SSIZE_MAX) - size) {
|
|
||||||
errno = EINVAL;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
size += iov[i].iov_len;
|
|
||||||
}
|
|
||||||
|
|
||||||
ssize_t total = 0;
|
|
||||||
for (int i = 0; i < iovcnt; ++i) {
|
|
||||||
if (!iov[i].iov_len) continue;
|
|
||||||
ssize_t got = read_input(fd, iov[i].iov_base, iov[i].iov_len);
|
|
||||||
if (got < 0) return total ? total : -1;
|
|
||||||
total += got;
|
|
||||||
if (static_cast<size_t>(got) != iov[i].iov_len) break;
|
|
||||||
}
|
|
||||||
return total;
|
|
||||||
}
|
|
||||||
|
|
||||||
EXPORT ssize_t write(int fd, const void *buf, size_t count) {
|
EXPORT ssize_t write(int fd, const void *buf, size_t count) {
|
||||||
static auto my_write = reinterpret_cast<decltype(&::write)>(dlsym(RTLD_NEXT, "write"));
|
static auto my_write = reinterpret_cast<decltype(&::write)>(dlsym(RTLD_NEXT, "write"));
|
||||||
|
|
||||||
@@ -4215,92 +4103,4 @@ EXPORT int __fxstat64(int version, int fd, struct stat64 *buf) {
|
|||||||
if (!real) return fstat64(fd, buf);
|
if (!real) return fstat64(fd, buf);
|
||||||
return fake_stat_fd(fd, buf, [version](int f, struct stat64 *b) { return real(version, f, b); });
|
return fake_stat_fd(fd, buf, [version](int f, struct stat64 *b) { return real(version, f, b); });
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__x86_64__) || defined(__i386__)
|
|
||||||
using dlsym_fn = void *(*)(void *, const char *);
|
|
||||||
|
|
||||||
static const char *const interposed_names[] = {
|
|
||||||
"open", "open64", "openat", "openat64", "close", "read", "readv", "write", "writev", "ioctl",
|
|
||||||
"poll", "ppoll", "select", "stat", "stat64", "fstat", "fstat64", "__xstat", "__xstat64",
|
|
||||||
"__fxstat", "__fxstat64", "statx", "statfs", "statfs64", "fstatfs", "fstatfs64", "access",
|
|
||||||
"faccessat", "opendir", "scandir", "inotify_add_watch",
|
|
||||||
};
|
|
||||||
|
|
||||||
static dlsym_fn next_dlsym() {
|
|
||||||
static const dlsym_fn fn = [] {
|
|
||||||
#ifdef __x86_64__
|
|
||||||
const char *base = "GLIBC_2.2.5";
|
|
||||||
#else
|
|
||||||
const char *base = "GLIBC_2.0";
|
|
||||||
#endif
|
|
||||||
for (const char *version : {base, "GLIBC_2.34"}) {
|
|
||||||
if (auto found = reinterpret_cast<dlsym_fn>(dlvsym(RTLD_NEXT, "dlsym", version))) return found;
|
|
||||||
}
|
|
||||||
return dlsym_fn{};
|
|
||||||
}();
|
|
||||||
return fn;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void *global_dlsym(void *, const char *name) { return next_dlsym()(RTLD_DEFAULT, name); }
|
|
||||||
|
|
||||||
static void *missing_dlsym(void *, const char *) { return nullptr; }
|
|
||||||
|
|
||||||
static bool interposed(const char *name) {
|
|
||||||
for (const char *interposed_name : interposed_names) {
|
|
||||||
if (strcmp(interposed_name, name) == 0) return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" __attribute__((visibility("hidden"), used)) void *fakeinput_dlsym_target(void *handle, const char *name) {
|
|
||||||
dlsym_fn next = next_dlsym();
|
|
||||||
if (!next) return reinterpret_cast<void *>(missing_dlsym);
|
|
||||||
if (handle == RTLD_DEFAULT || handle == RTLD_NEXT || name == nullptr) return reinterpret_cast<void *>(next);
|
|
||||||
static void *const libc = dlopen(LIBC_SO, RTLD_LAZY | RTLD_NOLOAD);
|
|
||||||
if (handle != libc || !interposed(name)) return reinterpret_cast<void *>(next);
|
|
||||||
return reinterpret_cast<void *>(global_dlsym);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __x86_64__
|
|
||||||
__asm__(".text\n"
|
|
||||||
".globl dlsym\n"
|
|
||||||
".type dlsym, @function\n"
|
|
||||||
"dlsym:\n"
|
|
||||||
".cfi_startproc\n"
|
|
||||||
"pushq %rdi\n"
|
|
||||||
".cfi_adjust_cfa_offset 8\n"
|
|
||||||
"pushq %rsi\n"
|
|
||||||
".cfi_adjust_cfa_offset 8\n"
|
|
||||||
"subq $8, %rsp\n"
|
|
||||||
".cfi_adjust_cfa_offset 8\n"
|
|
||||||
"call fakeinput_dlsym_target\n"
|
|
||||||
"addq $8, %rsp\n"
|
|
||||||
".cfi_adjust_cfa_offset -8\n"
|
|
||||||
"popq %rsi\n"
|
|
||||||
".cfi_adjust_cfa_offset -8\n"
|
|
||||||
"popq %rdi\n"
|
|
||||||
".cfi_adjust_cfa_offset -8\n"
|
|
||||||
"jmp *%rax\n"
|
|
||||||
".cfi_endproc\n"
|
|
||||||
".size dlsym, .-dlsym\n");
|
|
||||||
#else
|
|
||||||
__asm__(".text\n"
|
|
||||||
".globl dlsym\n"
|
|
||||||
".type dlsym, @function\n"
|
|
||||||
"dlsym:\n"
|
|
||||||
".cfi_startproc\n"
|
|
||||||
"subl $12, %esp\n"
|
|
||||||
".cfi_adjust_cfa_offset 12\n"
|
|
||||||
"movl 20(%esp), %eax\n"
|
|
||||||
"movl %eax, 4(%esp)\n"
|
|
||||||
"movl 16(%esp), %eax\n"
|
|
||||||
"movl %eax, (%esp)\n"
|
|
||||||
"call fakeinput_dlsym_target\n"
|
|
||||||
"addl $12, %esp\n"
|
|
||||||
".cfi_adjust_cfa_offset -12\n"
|
|
||||||
"jmp *%eax\n"
|
|
||||||
".cfi_endproc\n"
|
|
||||||
".size dlsym, .-dlsym\n");
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
@@ -131,7 +131,7 @@ struct VkTable {
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace lsfg { class Engine; }
|
namespace lsfg { class Engine; }
|
||||||
namespace ddfg { class Engine; }
|
namespace winfg { class Engine; }
|
||||||
|
|
||||||
static constexpr uint32_t MAX_FRAMES_IN_FLIGHT = 2;
|
static constexpr uint32_t MAX_FRAMES_IN_FLIGHT = 2;
|
||||||
|
|
||||||
@@ -280,7 +280,7 @@ public:
|
|||||||
static constexpr int32_t kFgCaptureGame = -1;
|
static constexpr int32_t kFgCaptureGame = -1;
|
||||||
void setFrameGenTuning(float flowScale, float refreshHz, int32_t captureHeight = 0);
|
void setFrameGenTuning(float flowScale, float refreshHz, int32_t captureHeight = 0);
|
||||||
void setFrameGenEngine(int kind);
|
void setFrameGenEngine(int kind);
|
||||||
void setDdFgTuning(int model, int perfPreset);
|
void setWinFgTuning(int model, int perfPreset);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct WinTex {
|
struct WinTex {
|
||||||
@@ -468,12 +468,12 @@ private:
|
|||||||
uint64_t fgSourceFrames_ = 0;
|
uint64_t fgSourceFrames_ = 0;
|
||||||
std::string lsfgCachePath_;
|
std::string lsfgCachePath_;
|
||||||
bool lsfgEngineTried_ = false;
|
bool lsfgEngineTried_ = false;
|
||||||
std::unique_ptr<ddfg::Engine> ddfgEngine_;
|
std::unique_ptr<winfg::Engine> winfgEngine_;
|
||||||
bool ddfgEngineTried_ = false;
|
bool winfgEngineTried_ = false;
|
||||||
std::atomic<int> fgEngineKind_{0};
|
std::atomic<int> fgEngineKind_{0};
|
||||||
std::atomic<int> fgModel_{4};
|
std::atomic<int> fgModel_{4};
|
||||||
std::atomic<int> fgPerfPreset_{1};
|
std::atomic<int> fgPerfPreset_{1};
|
||||||
bool ensureDdFgEngine();
|
bool ensureWinFgEngine();
|
||||||
bool fgCapsOk() const;
|
bool fgCapsOk() const;
|
||||||
|
|
||||||
uint32_t syncSlot(uint32_t k) const { return currentFrame * kMaxPresentsPerFrame + k; }
|
uint32_t syncSlot(uint32_t k) const { return currentFrame * kMaxPresentsPerFrame + k; }
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include "vk_dispatch.hpp"
|
|
||||||
struct VkTable;
|
|
||||||
bool ddfgVkdInit(const VkTable& table, ddfg::DeviceDispatch& dd, ddfg::InstanceDispatch& id);
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#if defined(__ANDROID__)
|
|
||||||
#include <android/log.h>
|
|
||||||
#define DDFG_LOGI(...) __android_log_print(ANDROID_LOG_INFO, "dd-fg", __VA_ARGS__)
|
|
||||||
#define DDFG_LOGE(...) __android_log_print(ANDROID_LOG_ERROR, "dd-fg", __VA_ARGS__)
|
|
||||||
#else
|
|
||||||
#include <cstdio>
|
|
||||||
#define DDFG_LOGI(...) do { std::fprintf(stderr, "[dd-fg] " __VA_ARGS__); std::fprintf(stderr, "\n"); } while(0)
|
|
||||||
#define DDFG_LOGE(...) do { std::fprintf(stderr, "[dd-fg][E] " __VA_ARGS__); std::fprintf(stderr, "\n"); } while(0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DDFG_LOGD(cond, ...) do { if (cond) DDFG_LOGI(__VA_ARGS__); } while(0)
|
|
||||||
File renamed without changes.
File renamed without changes.
+36
-36
@@ -6,7 +6,7 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
namespace ddfg {
|
namespace winfg {
|
||||||
|
|
||||||
struct Config {
|
struct Config {
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
@@ -213,48 +213,48 @@ static inline void apply_toml(Config& c, const std::string& path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline std::string conf_path() {
|
static inline std::string conf_path() {
|
||||||
if (const char* p = std::getenv("DD_FG_CONF")) return p;
|
if (const char* p = std::getenv("WIN_FG_CONF")) return p;
|
||||||
const char* home = std::getenv("HOME");
|
const char* home = std::getenv("HOME");
|
||||||
return home ? std::string(home) + "/.config/dd-fg/conf.toml" : std::string();
|
return home ? std::string(home) + "/.config/win-fg/conf.toml" : std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline std::string capture_root(const Config& c) {
|
static inline std::string capture_root(const Config& c) {
|
||||||
if (!c.capDir.empty()) return c.capDir;
|
if (!c.capDir.empty()) return c.capDir;
|
||||||
if (const char* home = std::getenv("HOME")) return std::string(home) + "/.cache/ddfg-capture";
|
if (const char* home = std::getenv("HOME")) return std::string(home) + "/.cache/winfg-capture";
|
||||||
return std::string("/tmp/ddfg-capture");
|
return std::string("/tmp/winfg-capture");
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline Config load_config() {
|
static inline Config load_config() {
|
||||||
Config c;
|
Config c;
|
||||||
c.enabled = envi("DD_FG_ENABLE", 0) != 0;
|
c.enabled = envi("WIN_FG_ENABLE", 0) != 0;
|
||||||
if (const char* d = std::getenv("DD_FG_DEBUG")) c.debug = parse_bool(d, c.debug);
|
if (const char* d = std::getenv("WIN_FG_DEBUG")) c.debug = parse_bool(d, c.debug);
|
||||||
if (const char* pc = std::getenv("DD_FG_PACING")) c.pacing = parse_bool(pc, c.pacing);
|
if (const char* pc = std::getenv("WIN_FG_PACING")) c.pacing = parse_bool(pc, c.pacing);
|
||||||
c.model = envi("DD_FG_MODEL", c.model);
|
c.model = envi("WIN_FG_MODEL", c.model);
|
||||||
c.multiplier = envi("DD_FG_MULT", c.multiplier);
|
c.multiplier = envi("WIN_FG_MULT", c.multiplier);
|
||||||
c.extraImages = envi("DD_FG_EXTRA_IMAGES", c.extraImages);
|
c.extraImages = envi("WIN_FG_EXTRA_IMAGES", c.extraImages);
|
||||||
c.perfPreset = envi("DD_FG_PERF_PRESET", c.perfPreset);
|
c.perfPreset = envi("WIN_FG_PERF_PRESET", c.perfPreset);
|
||||||
if (const char* g = std::getenv("DD_FG_GM")) c.gmMode = parse_tristate(g, c.gmMode);
|
if (const char* g = std::getenv("WIN_FG_GM")) c.gmMode = parse_tristate(g, c.gmMode);
|
||||||
if (const char* r = std::getenv("DD_FG_FLOWREG")) c.frMode = parse_tristate(r, c.frMode);
|
if (const char* r = std::getenv("WIN_FG_FLOWREG")) c.frMode = parse_tristate(r, c.frMode);
|
||||||
c.frIters = envi("DD_FG_FR_ITERS", c.frIters);
|
c.frIters = envi("WIN_FG_FR_ITERS", c.frIters);
|
||||||
c.frLambda = envf("DD_FG_FR_LAMBDA", c.frLambda);
|
c.frLambda = envf("WIN_FG_FR_LAMBDA", c.frLambda);
|
||||||
c.frDt = envf("DD_FG_FR_DT", c.frDt);
|
c.frDt = envf("WIN_FG_FR_DT", c.frDt);
|
||||||
c.frEdge = envf("DD_FG_FR_EDGE", c.frEdge);
|
c.frEdge = envf("WIN_FG_FR_EDGE", c.frEdge);
|
||||||
c.frEps = envf("DD_FG_FR_EPS", c.frEps);
|
c.frEps = envf("WIN_FG_FR_EPS", c.frEps);
|
||||||
c.flowScale = envf("DD_FG_FLOWSCALE", c.flowScale);
|
c.flowScale = envf("WIN_FG_FLOWSCALE", c.flowScale);
|
||||||
c.beta = envf("DD_FG_BETA", c.beta);
|
c.beta = envf("WIN_FG_BETA", c.beta);
|
||||||
c.lambda = envf("DD_FG_LAMBDA", c.lambda);
|
c.lambda = envf("WIN_FG_LAMBDA", c.lambda);
|
||||||
c.epsilon = envf("DD_FG_EPSILON", c.epsilon);
|
c.epsilon = envf("WIN_FG_EPSILON", c.epsilon);
|
||||||
c.photoScale = envf("DD_FG_PHOTOSCALE", c.photoScale);
|
c.photoScale = envf("WIN_FG_PHOTOSCALE", c.photoScale);
|
||||||
if (const char* cc = std::getenv("DD_FG_CAPTURE")) c.capture = parse_bool(cc, c.capture);
|
if (const char* cc = std::getenv("WIN_FG_CAPTURE")) c.capture = parse_bool(cc, c.capture);
|
||||||
c.captureW = envi("DD_FG_CAPTURE_W", c.captureW);
|
c.captureW = envi("WIN_FG_CAPTURE_W", c.captureW);
|
||||||
c.captureH = envi("DD_FG_CAPTURE_H", c.captureH);
|
c.captureH = envi("WIN_FG_CAPTURE_H", c.captureH);
|
||||||
if (const char* cm = std::getenv("DD_FG_CAPTURE_MODE")) c.capMode = parse_capmode(cm, c.capMode);
|
if (const char* cm = std::getenv("WIN_FG_CAPTURE_MODE")) c.capMode = parse_capmode(cm, c.capMode);
|
||||||
c.capPatches = envi("DD_FG_CAPTURE_PATCHES", c.capPatches);
|
c.capPatches = envi("WIN_FG_CAPTURE_PATCHES", c.capPatches);
|
||||||
c.capPatchSize = envi("DD_FG_CAPTURE_PATCH", c.capPatchSize);
|
c.capPatchSize = envi("WIN_FG_CAPTURE_PATCH", c.capPatchSize);
|
||||||
c.capMotion = envf("DD_FG_CAPTURE_MOTION", c.capMotion);
|
c.capMotion = envf("WIN_FG_CAPTURE_MOTION", c.capMotion);
|
||||||
c.capShardMB = envi("DD_FG_CAPTURE_SHARD_MB", c.capShardMB);
|
c.capShardMB = envi("WIN_FG_CAPTURE_SHARD_MB", c.capShardMB);
|
||||||
if (const char* cd = std::getenv("DD_FG_CAPTURE_DIR")) c.capDir = cd;
|
if (const char* cd = std::getenv("WIN_FG_CAPTURE_DIR")) c.capDir = cd;
|
||||||
if (const char* h = std::getenv("DD_FG_HUD_RECT")) {
|
if (const char* h = std::getenv("WIN_FG_HUD_RECT")) {
|
||||||
float r[4] = {0,0,0,0}; int n = 0;
|
float r[4] = {0,0,0,0}; int n = 0;
|
||||||
std::string s = h; size_t start = 0;
|
std::string s = h; size_t start = 0;
|
||||||
for (; n < 4; ++n) {
|
for (; n < 4; ++n) {
|
||||||
@@ -266,8 +266,8 @@ static inline Config load_config() {
|
|||||||
c.hudX0 = r[0]; c.hudY0 = r[1]; c.hudX1 = r[2]; c.hudY1 = r[3];
|
c.hudX0 = r[0]; c.hudY0 = r[1]; c.hudX1 = r[2]; c.hudY1 = r[3];
|
||||||
}
|
}
|
||||||
const char* home = std::getenv("HOME");
|
const char* home = std::getenv("HOME");
|
||||||
if (home) apply_toml(c, std::string(home) + "/.config/dd-fg/conf.toml");
|
if (home) apply_toml(c, std::string(home) + "/.config/win-fg/conf.toml");
|
||||||
if (const char* p = std::getenv("DD_FG_CONF")) apply_toml(c, p);
|
if (const char* p = std::getenv("WIN_FG_CONF")) apply_toml(c, p);
|
||||||
c.sanitize();
|
c.sanitize();
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
+5
-5
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
namespace ddfg { namespace embedded {
|
namespace winfg { namespace embedded {
|
||||||
static const uint32_t OF3_LUMA_SPV[] = {0x07230203u,0x00010300u,0x0008000bu,0x00000054u,0x00000000u,0x00020011u,0x00000001u,0x00020011u,0x00000032u,0x0006000bu,0x00000001u,0x4c534c47u,0x6474732eu,0x3035342eu,0x00000000u,0x0003000eu,0x00000000u,0x00000001u,0x0006000fu,0x00000005u,0x00000004u,0x6e69616du,0x00000000u,0x0000000du,0x00060010u,0x00000004u,0x00000011u,0x00000010u,0x00000010u,0x00000001u,0x00030003u,0x00000002u,0x000001c2u,0x00040005u,0x00000004u,0x6e69616du,0x00000000u,0x00030005u,0x00000009u,0x00646967u,0x00080005u,0x0000000du,0x475f6c67u,0x61626f6cu,0x766e496cu,0x7461636fu,0x496e6f69u,0x00000044u,0x00030005u,0x00000012u,0x006d6964u,0x00040005u,0x00000016u,0x74734475u,0x00000000u,0x00030005u,0x00000030u,0x00007675u,0x00030005u,0x0000003bu,0x00626772u,0x00040005u,0x0000003fu,0x63725375u,0x00000000u,0x00030005u,0x00000047u,0x00005966u,0x00040047u,0x0000000du,0x0000000bu,0x0000001cu,0x00030047u,0x00000016u,0x00000019u,0x00040047u,0x00000016u,0x00000021u,0x00000030u,0x00040047u,0x00000016u,0x00000022u,0x00000000u,0x00040047u,0x0000003fu,0x00000021u,0x00000020u,0x00040047u,0x0000003fu,0x00000022u,0x00000000u,0x00040047u,0x00000053u,0x0000000bu,0x00000019u,0x00020013u,0x00000002u,0x00030021u,0x00000003u,0x00000002u,0x00040015u,0x00000006u,0x00000020u,0x00000001u,0x00040017u,0x00000007u,0x00000006u,0x00000002u,0x00040020u,0x00000008u,0x00000007u,0x00000007u,0x00040015u,0x0000000au,0x00000020u,0x00000000u,0x00040017u,0x0000000bu,0x0000000au,0x00000003u,0x00040020u,0x0000000cu,0x00000001u,0x0000000bu,0x0004003bu,0x0000000cu,0x0000000du,0x00000001u,0x00040017u,0x0000000eu,0x0000000au,0x00000002u,0x00030016u,0x00000013u,0x00000020u,0x00090019u,0x00000014u,0x00000013u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000002u,0x00000003u,0x00040020u,0x00000015u,0x00000000u,0x00000014u,0x0004003bu,0x00000015u,0x00000016u,0x00000000u,0x00020014u,0x00000019u,0x0004002bu,0x0000000au,0x0000001au,0x00000000u,0x00040020u,0x0000001bu,0x00000007u,0x00000006u,0x0004002bu,0x0000000au,0x00000024u,0x00000001u,0x00040017u,0x0000002eu,0x00000013u,0x00000002u,0x00040020u,0x0000002fu,0x00000007u,0x0000002eu,0x0004002bu,0x00000013u,0x00000033u,0x3f000000u,0x00040017u,0x00000039u,0x00000013u,0x00000003u,0x00040020u,0x0000003au,0x00000007u,0x00000039u,0x00090019u,0x0000003cu,0x00000013u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000001u,0x00000000u,0x0003001bu,0x0000003du,0x0000003cu,0x00040020u,0x0000003eu,0x00000000u,0x0000003du,0x0004003bu,0x0000003eu,0x0000003fu,0x00000000u,0x0004002bu,0x00000013u,0x00000042u,0x00000000u,0x00040017u,0x00000043u,0x00000013u,0x00000004u,0x00040020u,0x00000046u,0x00000007u,0x00000013u,0x0004002bu,0x00000013u,0x00000049u,0x3e59b3d0u,0x0004002bu,0x00000013u,0x0000004au,0x3f371759u,0x0004002bu,0x00000013u,0x0000004bu,0x3d93dd98u,0x0006002cu,0x00000039u,0x0000004cu,0x00000049u,0x0000004au,0x0000004bu,0x0004002bu,0x0000000au,0x00000052u,0x00000010u,0x0006002cu,0x0000000bu,0x00000053u,0x00000052u,0x00000052u,0x00000024u,0x00050036u,0x00000002u,0x00000004u,0x00000000u,0x00000003u,0x000200f8u,0x00000005u,0x0004003bu,0x00000008u,0x00000009u,0x00000007u,0x0004003bu,0x00000008u,0x00000012u,0x00000007u,0x0004003bu,0x0000002fu,0x00000030u,0x00000007u,0x0004003bu,0x0000003au,0x0000003bu,0x00000007u,0x0004003bu,0x00000046u,0x00000047u,0x00000007u,0x0004003du,0x0000000bu,0x0000000fu,0x0000000du,0x0007004fu,0x0000000eu,0x00000010u,0x0000000fu,0x0000000fu,0x00000000u,0x00000001u,0x0004007cu,0x00000007u,0x00000011u,0x00000010u,0x0003003eu,0x00000009u,0x00000011u,0x0004003du,0x00000014u,0x00000017u,0x00000016u,0x00040068u,0x00000007u,0x00000018u,0x00000017u,0x0003003eu,0x00000012u,0x00000018u,0x00050041u,0x0000001bu,0x0000001cu,0x00000009u,0x0000001au,0x0004003du,0x00000006u,0x0000001du,0x0000001cu,0x00050041u,0x0000001bu,0x0000001eu,0x00000012u,0x0000001au,0x0004003du,0x00000006u,0x0000001fu,0x0000001eu,0x000500afu,0x00000019u,0x00000020u,0x0000001du,0x0000001fu,0x000400a8u,0x00000019u,0x00000021u,0x00000020u,0x000300f7u,0x00000023u,0x00000000u,0x000400fau,0x00000021u,0x00000022u,0x00000023u,0x000200f8u,0x00000022u,0x00050041u,0x0000001bu,0x00000025u,0x00000009u,0x00000024u,0x0004003du,0x00000006u,0x00000026u,0x00000025u,0x00050041u,0x0000001bu,0x00000027u,0x00000012u,0x00000024u,0x0004003du,0x00000006u,0x00000028u,0x00000027u,0x000500afu,0x00000019u,0x00000029u,0x00000026u,0x00000028u,0x000200f9u,0x00000023u,0x000200f8u,0x00000023u,0x000700f5u,0x00000019u,0x0000002au,0x00000020u,0x00000005u,0x00000029u,0x00000022u,0x000300f7u,0x0000002cu,0x00000000u,0x000400fau,0x0000002au,0x0000002bu,0x0000002cu,0x000200f8u,0x0000002bu,0x000100fdu,0x000200f8u,0x0000002cu,0x0004003du,0x00000007u,0x00000031u,0x00000009u,0x0004006fu,0x0000002eu,0x00000032u,0x00000031u,0x00050050u,0x0000002eu,0x00000034u,0x00000033u,0x00000033u,0x00050081u,0x0000002eu,0x00000035u,0x00000032u,0x00000034u,0x0004003du,0x00000007u,0x00000036u,0x00000012u,0x0004006fu,0x0000002eu,0x00000037u,0x00000036u,0x00050088u,0x0000002eu,0x00000038u,0x0Line truncated
|
static const uint32_t OF3_LUMA_SPV[] = {0x07230203u,0x00010300u,0x0008000bu,0x00000054u,0x00000000u,0x00020011u,0x00000001u,0x00020011u,0x00000032u,0x0006000bu,0x00000001u,0x4c534c47u,0x6474732eu,0x3035342eu,0x00000000u,0x0003000eu,0x00000000u,0x00000001u,0x0006000fu,0x00000005u,0x00000004u,0x6e69616du,0x00000000u,0x0000000du,0x00060010u,0x00000004u,0x00000011u,0x00000010u,0x00000010u,0x00000001u,0x00030003u,0x00000002u,0x000001c2u,0x00040005u,0x00000004u,0x6e69616du,0x00000000u,0x00030005u,0x00000009u,0x00646967u,0x00080005u,0x0000000du,0x475f6c67u,0x61626f6cu,0x766e496cu,0x7461636fu,0x496e6f69u,0x00000044u,0x00030005u,0x00000012u,0x006d6964u,0x00040005u,0x00000016u,0x74734475u,0x00000000u,0x00030005u,0x00000030u,0x00007675u,0x00030005u,0x0000003bu,0x00626772u,0x00040005u,0x0000003fu,0x63725375u,0x00000000u,0x00030005u,0x00000047u,0x00005966u,0x00040047u,0x0000000du,0x0000000bu,0x0000001cu,0x00030047u,0x00000016u,0x00000019u,0x00040047u,0x00000016u,0x00000021u,0x00000030u,0x00040047u,0x00000016u,0x00000022u,0x00000000u,0x00040047u,0x0000003fu,0x00000021u,0x00000020u,0x00040047u,0x0000003fu,0x00000022u,0x00000000u,0x00040047u,0x00000053u,0x0000000bu,0x00000019u,0x00020013u,0x00000002u,0x00030021u,0x00000003u,0x00000002u,0x00040015u,0x00000006u,0x00000020u,0x00000001u,0x00040017u,0x00000007u,0x00000006u,0x00000002u,0x00040020u,0x00000008u,0x00000007u,0x00000007u,0x00040015u,0x0000000au,0x00000020u,0x00000000u,0x00040017u,0x0000000bu,0x0000000au,0x00000003u,0x00040020u,0x0000000cu,0x00000001u,0x0000000bu,0x0004003bu,0x0000000cu,0x0000000du,0x00000001u,0x00040017u,0x0000000eu,0x0000000au,0x00000002u,0x00030016u,0x00000013u,0x00000020u,0x00090019u,0x00000014u,0x00000013u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000002u,0x00000003u,0x00040020u,0x00000015u,0x00000000u,0x00000014u,0x0004003bu,0x00000015u,0x00000016u,0x00000000u,0x00020014u,0x00000019u,0x0004002bu,0x0000000au,0x0000001au,0x00000000u,0x00040020u,0x0000001bu,0x00000007u,0x00000006u,0x0004002bu,0x0000000au,0x00000024u,0x00000001u,0x00040017u,0x0000002eu,0x00000013u,0x00000002u,0x00040020u,0x0000002fu,0x00000007u,0x0000002eu,0x0004002bu,0x00000013u,0x00000033u,0x3f000000u,0x00040017u,0x00000039u,0x00000013u,0x00000003u,0x00040020u,0x0000003au,0x00000007u,0x00000039u,0x00090019u,0x0000003cu,0x00000013u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000001u,0x00000000u,0x0003001bu,0x0000003du,0x0000003cu,0x00040020u,0x0000003eu,0x00000000u,0x0000003du,0x0004003bu,0x0000003eu,0x0000003fu,0x00000000u,0x0004002bu,0x00000013u,0x00000042u,0x00000000u,0x00040017u,0x00000043u,0x00000013u,0x00000004u,0x00040020u,0x00000046u,0x00000007u,0x00000013u,0x0004002bu,0x00000013u,0x00000049u,0x3e59b3d0u,0x0004002bu,0x00000013u,0x0000004au,0x3f371759u,0x0004002bu,0x00000013u,0x0000004bu,0x3d93dd98u,0x0006002cu,0x00000039u,0x0000004cu,0x00000049u,0x0000004au,0x0000004bu,0x0004002bu,0x0000000au,0x00000052u,0x00000010u,0x0006002cu,0x0000000bu,0x00000053u,0x00000052u,0x00000052u,0x00000024u,0x00050036u,0x00000002u,0x00000004u,0x00000000u,0x00000003u,0x000200f8u,0x00000005u,0x0004003bu,0x00000008u,0x00000009u,0x00000007u,0x0004003bu,0x00000008u,0x00000012u,0x00000007u,0x0004003bu,0x0000002fu,0x00000030u,0x00000007u,0x0004003bu,0x0000003au,0x0000003bu,0x00000007u,0x0004003bu,0x00000046u,0x00000047u,0x00000007u,0x0004003du,0x0000000bu,0x0000000fu,0x0000000du,0x0007004fu,0x0000000eu,0x00000010u,0x0000000fu,0x0000000fu,0x00000000u,0x00000001u,0x0004007cu,0x00000007u,0x00000011u,0x00000010u,0x0003003eu,0x00000009u,0x00000011u,0x0004003du,0x00000014u,0x00000017u,0x00000016u,0x00040068u,0x00000007u,0x00000018u,0x00000017u,0x0003003eu,0x00000012u,0x00000018u,0x00050041u,0x0000001bu,0x0000001cu,0x00000009u,0x0000001au,0x0004003du,0x00000006u,0x0000001du,0x0000001cu,0x00050041u,0x0000001bu,0x0000001eu,0x00000012u,0x0000001au,0x0004003du,0x00000006u,0x0000001fu,0x0000001eu,0x000500afu,0x00000019u,0x00000020u,0x0000001du,0x0000001fu,0x000400a8u,0x00000019u,0x00000021u,0x00000020u,0x000300f7u,0x00000023u,0x00000000u,0x000400fau,0x00000021u,0x00000022u,0x00000023u,0x000200f8u,0x00000022u,0x00050041u,0x0000001bu,0x00000025u,0x00000009u,0x00000024u,0x0004003du,0x00000006u,0x00000026u,0x00000025u,0x00050041u,0x0000001bu,0x00000027u,0x00000012u,0x00000024u,0x0004003du,0x00000006u,0x00000028u,0x00000027u,0x000500afu,0x00000019u,0x00000029u,0x00000026u,0x00000028u,0x000200f9u,0x00000023u,0x000200f8u,0x00000023u,0x000700f5u,0x00000019u,0x0000002au,0x00000020u,0x00000005u,0x00000029u,0x00000022u,0x000300f7u,0x0000002cu,0x00000000u,0x000400fau,0x0000002au,0x0000002bu,0x0000002cu,0x000200f8u,0x0000002bu,0x000100fdu,0x000200f8u,0x0000002cu,0x0004003du,0x00000007u,0x00000031u,0x00000009u,0x0004006fu,0x0000002eu,0x00000032u,0x00000031u,0x00050050u,0x0000002eu,0x00000034u,0x00000033u,0x00000033u,0x00050081u,0x0000002eu,0x00000035u,0x00000032u,0x00000034u,0x0004003du,0x00000007u,0x00000036u,0x00000012u,0x0004006fu,0x0000002eu,0x00000037u,0x00000036u,0x00050088u,0x0000002eu,0x00000038u,0x0Line truncated
|
||||||
static const size_t OF3_LUMA_LEN = 481;
|
static const size_t OF3_LUMA_LEN = 481;
|
||||||
static const uint32_t OF3_DOWNSAMPLE_SPV[] = {0x07230203u,0x00010300u,0x0008000bu,0x0000008au,0x00000000u,0x00020011u,0x00000001u,0x00020011u,0x00000032u,0x0006000bu,0x00000001u,0x4c534c47u,0x6474732eu,0x3035342eu,0x00000000u,0x0003000eu,0x00000000u,0x00000001u,0x0006000fu,0x00000005u,0x00000004u,0x6e69616du,0x00000000u,0x0000000du,0x00060010u,0x00000004u,0x00000011u,0x00000010u,0x00000010u,0x00000001u,0x00030003u,0x00000002u,0x000001c2u,0x00040005u,0x00000004u,0x6e69616du,0x00000000u,0x00030005u,0x00000009u,0x00646967u,0x00080005u,0x0000000du,0x475f6c67u,0x61626f6cu,0x766e496cu,0x7461636fu,0x496e6f69u,0x00000044u,0x00030005u,0x00000012u,0x006d6964u,0x00040005u,0x00000016u,0x74734475u,0x00000000u,0x00040005u,0x00000030u,0x44637273u,0x00006d69u,0x00040005u,0x00000034u,0x63725375u,0x00000000u,0x00040005u,0x0000003au,0x65736162u,0x00000000u,0x00030005u,0x00000044u,0x00000068u,0x00030005u,0x0000004au,0x00000061u,0x00030005u,0x00000059u,0x00000062u,0x00030005u,0x00000065u,0x00000063u,0x00030005u,0x00000071u,0x00000064u,0x00040047u,0x0000000du,0x0000000bu,0x0000001cu,0x00030047u,0x00000016u,0x00000019u,0x00040047u,0x00000016u,0x00000021u,0x00000030u,0x00040047u,0x00000016u,0x00000022u,0x00000000u,0x00040047u,0x00000034u,0x00000021u,0x00000020u,0x00040047u,0x00000034u,0x00000022u,0x00000000u,0x00040047u,0x00000089u,0x0000000bu,0x00000019u,0x00020013u,0x00000002u,0x00030021u,0x00000003u,0x00000002u,0x00040015u,0x00000006u,0x00000020u,0x00000001u,0x00040017u,0x00000007u,0x00000006u,0x00000002u,0x00040020u,0x00000008u,0x00000007u,0x00000007u,0x00040015u,0x0000000au,0x00000020u,0x00000000u,0x00040017u,0x0000000bu,0x0000000au,0x00000003u,0x00040020u,0x0000000cu,0x00000001u,0x0000000bu,0x0004003bu,0x0000000cu,0x0000000du,0x00000001u,0x00040017u,0x0000000eu,0x0000000au,0x00000002u,0x00030016u,0x00000013u,0x00000020u,0x00090019u,0x00000014u,0x00000013u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000002u,0x00000003u,0x00040020u,0x00000015u,0x00000000u,0x00000014u,0x0004003bu,0x00000015u,0x00000016u,0x00000000u,0x00020014u,0x00000019u,0x0004002bu,0x0000000au,0x0000001au,0x00000000u,0x00040020u,0x0000001bu,0x00000007u,0x00000006u,0x0004002bu,0x0000000au,0x00000024u,0x00000001u,0x00040017u,0x0000002eu,0x00000013u,0x00000002u,0x00040020u,0x0000002fu,0x00000007u,0x0000002eu,0x00090019u,0x00000031u,0x00000013u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000001u,0x00000000u,0x0003001bu,0x00000032u,0x00000031u,0x00040020u,0x00000033u,0x00000000u,0x00000032u,0x0004003bu,0x00000033u,0x00000034u,0x00000000u,0x0004002bu,0x00000006u,0x00000036u,0x00000000u,0x0004002bu,0x00000013u,0x0000003du,0x40000000u,0x0004002bu,0x00000013u,0x0000003fu,0x3f800000u,0x0004002bu,0x00000013u,0x00000045u,0x3f000000u,0x00040020u,0x00000049u,0x00000007u,0x00000013u,0x0004002bu,0x00000013u,0x00000055u,0x00000000u,0x00040017u,0x00000056u,0x00000013u,0x00000004u,0x0004002bu,0x00000013u,0x00000085u,0x3e800000u,0x0004002bu,0x0000000au,0x00000088u,0x00000010u,0x0006002cu,0x0000000bu,0x00000089u,0x00000088u,0x00000088u,0x00000024u,0x00050036u,0x00000002u,0x00000004u,0x00000000u,0x00000003u,0x000200f8u,0x00000005u,0x0004003bu,0x00000008u,0x00000009u,0x00000007u,0x0004003bu,0x00000008u,0x00000012u,0x00000007u,0x0004003bu,0x0000002fu,0x00000030u,0x00000007u,0x0004003bu,0x0000002fu,0x0000003au,0x00000007u,0x0004003bu,0x0000002fu,0x00000044u,0x00000007u,0x0004003bu,0x00000049u,0x0000004au,0x00000007u,0x0004003bu,0x00000049u,0x00000059u,0x00000007u,0x0004003bu,0x00000049u,0x00000065u,0x00000007u,0x0004003bu,0x00000049u,0x00000071u,0x00000007u,0x0004003du,0x0000000bu,0x0000000fu,0x0000000du,0x0007004fu,0x0000000eu,0x00000010u,0x0000000fu,0x0000000fu,0x00000000u,0x00000001u,0x0004007cu,0x00000007u,0x00000011u,0x00000010u,0x0003003eu,0x00000009u,0x00000011u,0x0004003du,0x00000014u,0x00000017u,0x00000016u,0x00040068u,0x00000007u,0x00000018u,0x00000017u,0x0003003eu,0x00000012u,0x00000018u,0x00050041u,0x0000001bu,0x0000001cu,0x00000009u,0x0000001au,0x0004003du,0x00000006u,0x0000001du,0x0000001cu,0x00050041u,0x0000001bu,0x0000001eu,0x00000012u,0x0000001au,0x0004003du,0x00000006u,0x0000001fu,0x0000001eu,0x000500afu,0x00000019u,0x00000020u,0x0000001du,0x0000001fu,0x000400a8u,0x00000019u,0x00000021u,0x00000020u,0x000300f7u,0x00000023u,0x00000000u,0x000400fau,0x00000021u,0x00000022u,0x00000023u,0x000200f8u,0x00000022u,0x00050041u,0x0000001bu,0x00000025u,0x00000009u,0x00000024u,0x0004003du,0x00000006u,0x00000026u,0x00000025u,0x00050041u,0x0000001bu,0x00000027u,0x00000012u,0x00000024u,0x0004003du,0x00000006u,0x00000028u,0x00000027u,0x000500afu,0x00000019u,0x00000029u,0x00000026u,0x00000028u,0x000200f9u,0x00000023u,0x000200f8u,0x00000023u,0x000700f5u,0x00000019u,0x0000002au,0x00000020u,0x00000005u,0x00000029u,0x00000022u,0x000300f7u,0x0000002cu,0x00000000u,0x000400fau,0x0000002au,0x0000002bu,0x0000002cu,0x000200f8u,0x0000002bu,0x000100fdu,0x000200f8u,0x0000002cu,0x0004003du,0x00000032u,0x00000035u,0x00000034u,0x00040064u,0x00000031u,0x00000037u,0x00000035u,0x0005006Line truncated
|
static const uint32_t OF3_DOWNSAMPLE_SPV[] = {0x07230203u,0x00010300u,0x0008000bu,0x0000008au,0x00000000u,0x00020011u,0x00000001u,0x00020011u,0x00000032u,0x0006000bu,0x00000001u,0x4c534c47u,0x6474732eu,0x3035342eu,0x00000000u,0x0003000eu,0x00000000u,0x00000001u,0x0006000fu,0x00000005u,0x00000004u,0x6e69616du,0x00000000u,0x0000000du,0x00060010u,0x00000004u,0x00000011u,0x00000010u,0x00000010u,0x00000001u,0x00030003u,0x00000002u,0x000001c2u,0x00040005u,0x00000004u,0x6e69616du,0x00000000u,0x00030005u,0x00000009u,0x00646967u,0x00080005u,0x0000000du,0x475f6c67u,0x61626f6cu,0x766e496cu,0x7461636fu,0x496e6f69u,0x00000044u,0x00030005u,0x00000012u,0x006d6964u,0x00040005u,0x00000016u,0x74734475u,0x00000000u,0x00040005u,0x00000030u,0x44637273u,0x00006d69u,0x00040005u,0x00000034u,0x63725375u,0x00000000u,0x00040005u,0x0000003au,0x65736162u,0x00000000u,0x00030005u,0x00000044u,0x00000068u,0x00030005u,0x0000004au,0x00000061u,0x00030005u,0x00000059u,0x00000062u,0x00030005u,0x00000065u,0x00000063u,0x00030005u,0x00000071u,0x00000064u,0x00040047u,0x0000000du,0x0000000bu,0x0000001cu,0x00030047u,0x00000016u,0x00000019u,0x00040047u,0x00000016u,0x00000021u,0x00000030u,0x00040047u,0x00000016u,0x00000022u,0x00000000u,0x00040047u,0x00000034u,0x00000021u,0x00000020u,0x00040047u,0x00000034u,0x00000022u,0x00000000u,0x00040047u,0x00000089u,0x0000000bu,0x00000019u,0x00020013u,0x00000002u,0x00030021u,0x00000003u,0x00000002u,0x00040015u,0x00000006u,0x00000020u,0x00000001u,0x00040017u,0x00000007u,0x00000006u,0x00000002u,0x00040020u,0x00000008u,0x00000007u,0x00000007u,0x00040015u,0x0000000au,0x00000020u,0x00000000u,0x00040017u,0x0000000bu,0x0000000au,0x00000003u,0x00040020u,0x0000000cu,0x00000001u,0x0000000bu,0x0004003bu,0x0000000cu,0x0000000du,0x00000001u,0x00040017u,0x0000000eu,0x0000000au,0x00000002u,0x00030016u,0x00000013u,0x00000020u,0x00090019u,0x00000014u,0x00000013u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000002u,0x00000003u,0x00040020u,0x00000015u,0x00000000u,0x00000014u,0x0004003bu,0x00000015u,0x00000016u,0x00000000u,0x00020014u,0x00000019u,0x0004002bu,0x0000000au,0x0000001au,0x00000000u,0x00040020u,0x0000001bu,0x00000007u,0x00000006u,0x0004002bu,0x0000000au,0x00000024u,0x00000001u,0x00040017u,0x0000002eu,0x00000013u,0x00000002u,0x00040020u,0x0000002fu,0x00000007u,0x0000002eu,0x00090019u,0x00000031u,0x00000013u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000001u,0x00000000u,0x0003001bu,0x00000032u,0x00000031u,0x00040020u,0x00000033u,0x00000000u,0x00000032u,0x0004003bu,0x00000033u,0x00000034u,0x00000000u,0x0004002bu,0x00000006u,0x00000036u,0x00000000u,0x0004002bu,0x00000013u,0x0000003du,0x40000000u,0x0004002bu,0x00000013u,0x0000003fu,0x3f800000u,0x0004002bu,0x00000013u,0x00000045u,0x3f000000u,0x00040020u,0x00000049u,0x00000007u,0x00000013u,0x0004002bu,0x00000013u,0x00000055u,0x00000000u,0x00040017u,0x00000056u,0x00000013u,0x00000004u,0x0004002bu,0x00000013u,0x00000085u,0x3e800000u,0x0004002bu,0x0000000au,0x00000088u,0x00000010u,0x0006002cu,0x0000000bu,0x00000089u,0x00000088u,0x00000088u,0x00000024u,0x00050036u,0x00000002u,0x00000004u,0x00000000u,0x00000003u,0x000200f8u,0x00000005u,0x0004003bu,0x00000008u,0x00000009u,0x00000007u,0x0004003bu,0x00000008u,0x00000012u,0x00000007u,0x0004003bu,0x0000002fu,0x00000030u,0x00000007u,0x0004003bu,0x0000002fu,0x0000003au,0x00000007u,0x0004003bu,0x0000002fu,0x00000044u,0x00000007u,0x0004003bu,0x00000049u,0x0000004au,0x00000007u,0x0004003bu,0x00000049u,0x00000059u,0x00000007u,0x0004003bu,0x00000049u,0x00000065u,0x00000007u,0x0004003bu,0x00000049u,0x00000071u,0x00000007u,0x0004003du,0x0000000bu,0x0000000fu,0x0000000du,0x0007004fu,0x0000000eu,0x00000010u,0x0000000fu,0x0000000fu,0x00000000u,0x00000001u,0x0004007cu,0x00000007u,0x00000011u,0x00000010u,0x0003003eu,0x00000009u,0x00000011u,0x0004003du,0x00000014u,0x00000017u,0x00000016u,0x00040068u,0x00000007u,0x00000018u,0x00000017u,0x0003003eu,0x00000012u,0x00000018u,0x00050041u,0x0000001bu,0x0000001cu,0x00000009u,0x0000001au,0x0004003du,0x00000006u,0x0000001du,0x0000001cu,0x00050041u,0x0000001bu,0x0000001eu,0x00000012u,0x0000001au,0x0004003du,0x00000006u,0x0000001fu,0x0000001eu,0x000500afu,0x00000019u,0x00000020u,0x0000001du,0x0000001fu,0x000400a8u,0x00000019u,0x00000021u,0x00000020u,0x000300f7u,0x00000023u,0x00000000u,0x000400fau,0x00000021u,0x00000022u,0x00000023u,0x000200f8u,0x00000022u,0x00050041u,0x0000001bu,0x00000025u,0x00000009u,0x00000024u,0x0004003du,0x00000006u,0x00000026u,0x00000025u,0x00050041u,0x0000001bu,0x00000027u,0x00000012u,0x00000024u,0x0004003du,0x00000006u,0x00000028u,0x00000027u,0x000500afu,0x00000019u,0x00000029u,0x00000026u,0x00000028u,0x000200f9u,0x00000023u,0x000200f8u,0x00000023u,0x000700f5u,0x00000019u,0x0000002au,0x00000020u,0x00000005u,0x00000029u,0x00000022u,0x000300f7u,0x0000002cu,0x00000000u,0x000400fau,0x0000002au,0x0000002bu,0x0000002cu,0x000200f8u,0x0000002bu,0x000100fdu,0x000200f8u,0x0000002cu,0x0004003du,0x00000032u,0x00000035u,0x00000034u,0x00040064u,0x00000031u,0x00000037u,0x00000035u,0x0005006Line truncated
|
||||||
@@ -20,10 +20,10 @@ static const uint32_t OF3_GM_PREWARP_SPV[] = {0x07230203u,0x00010300u,0x0008000b
|
|||||||
static const size_t OF3_GM_PREWARP_LEN = 706;
|
static const size_t OF3_GM_PREWARP_LEN = 706;
|
||||||
static const uint32_t OF3_FLOWREG_SPV[] = {0x07230203u,0x00010300u,0x0008000bu,0x00000144u,0x00000000u,0x00020011u,0x00000001u,0x00020011u,0x00000032u,0x0006000bu,0x00000001u,0x4c534c47u,0x6474732eu,0x3035342eu,0x00000000u,0x0003000eu,0x00000000u,0x00000001u,0x0006000fu,0x00000005u,0x00000004u,0x6e69616du,0x00000000u,0x00000037u,0x00060010u,0x00000004u,0x00000011u,0x00000010u,0x00000010u,0x00000001u,0x00030003u,0x00000002u,0x000001c2u,0x00040005u,0x00000004u,0x6e69616du,0x00000000u,0x00060005u,0x0000000eu,0x63746566u,0x76285568u,0x763b3269u,0x003b3269u,0x00030005u,0x0000000cu,0x00000070u,0x00030005u,0x0000000du,0x006d6964u,0x00060005u,0x00000013u,0x63746566u,0x76284c68u,0x763b3269u,0x003b3269u,0x00030005u,0x00000011u,0x00000070u,0x00030005u,0x00000012u,0x006d6964u,0x00040005u,0x00000018u,0x6f6c4675u,0x006e4977u,0x00040005u,0x00000026u,0x6d754c75u,0x00000061u,0x00030005u,0x00000034u,0x00646967u,0x00080005u,0x00000037u,0x475f6c67u,0x61626f6cu,0x766e496cu,0x7461636fu,0x496e6f69u,0x00000044u,0x00030005u,0x0000003cu,0x006d6964u,0x00030005u,0x00000055u,0x00007464u,0x00030005u,0x00000056u,0x00000055u,0x00050006u,0x00000056u,0x00000000u,0x61726170u,0x0000736du,0x00030005u,0x00000058u,0x00000000u,0x00040005u,0x0000005cu,0x626d616cu,0x00006164u,0x00050005u,0x0000005fu,0x65676465u,0x68706c41u,0x00000061u,0x00040005u,0x00000063u,0x54737065u,0x00000056u,0x00030005u,0x00000068u,0x00004375u,0x00040005u,0x00000069u,0x61726170u,0x0000006du,0x00040005u,0x0000006bu,0x61726170u,0x0000006du,0x00030005u,0x0000006eu,0x00004c75u,0x00040005u,0x00000073u,0x61726170u,0x0000006du,0x00040005u,0x00000074u,0x61726170u,0x0000006du,0x00030005u,0x00000077u,0x00005275u,0x00040005u,0x0000007bu,0x61726170u,0x0000006du,0x00040005u,0x0000007cu,0x61726170u,0x0000006du,0x00030005u,0x0000007fu,0x00005575u,0x00040005u,0x00000083u,0x61726170u,0x0000006du,0x00040005u,0x00000084u,0x61726170u,0x0000006du,0x00030005u,0x00000087u,0x00004475u,0x00040005u,0x0000008bu,0x61726170u,0x0000006du,0x00040005u,0x0000008cu,0x61726170u,0x0000006du,0x00040005u,0x0000008fu,0x6d69646cu,0x00000000u,0x00030005u,0x00000093u,0x00004c6cu,0x00040005u,0x00000096u,0x61726170u,0x0000006du,0x00040005u,0x00000097u,0x61726170u,0x0000006du,0x00030005u,0x0000009au,0x0000526cu,0x00040005u,0x0000009du,0x61726170u,0x0000006du,0x00040005u,0x0000009eu,0x61726170u,0x0000006du,0x00030005u,0x000000a1u,0x0000556cu,0x00040005u,0x000000a4u,0x61726170u,0x0000006du,0x00040005u,0x000000a5u,0x61726170u,0x0000006du,0x00030005u,0x000000a8u,0x0000446cu,0x00040005u,0x000000abu,0x61726170u,0x0000006du,0x00040005u,0x000000acu,0x61726170u,0x0000006du,0x00040005u,0x000000afu,0x67616d67u,0x00000000u,0x00030005u,0x000000bbu,0x00000067u,0x00030005u,0x000000c4u,0x00004c64u,0x00030005u,0x000000c8u,0x00005264u,0x00030005u,0x000000ccu,0x00005564u,0x00030005u,0x000000d0u,0x00004464u,0x00030005u,0x000000d4u,0x00003265u,0x00030005u,0x000000d8u,0x00004c77u,0x00030005u,0x000000e1u,0x00005277u,0x00030005u,0x000000eau,0x00005577u,0x00030005u,0x000000f3u,0x00004477u,0x00040005u,0x000000fcu,0x576d7573u,0x00000000u,0x00040005u,0x00000104u,0x576d7573u,0x00000055u,0x00040005u,0x00000114u,0x66694475u,0x00000066u,0x00030005u,0x00000120u,0x00003066u,0x00050005u,0x00000121u,0x6f6c4675u,0x73624f77u,0x00000000u,0x00040005u,0x0000012au,0x74656874u,0x00000061u,0x00030005u,0x0000012eu,0x00000072u,0x00040005u,0x00000132u,0x77654e75u,0x00000000u,0x00050005u,0x0000013eu,0x6f6c4675u,0x74754f77u,0x00000000u,0x00040047u,0x00000018u,0x00000021u,0x00000020u,0x00040047u,0x00000018u,0x00000022u,0x00000000u,0x00040047u,0x00000026u,0x00000021u,0x00000022u,0x00040047u,0x00000026u,0x00000022u,0x00000000u,0x00040047u,0x00000037u,0x0000000bu,0x0000001cu,0x00030047u,0x00000056u,0x00000002u,0x00050048u,0x00000056u,0x00000000u,0x00000023u,0x00000000u,0x00040047u,0x00000058u,0x00000021u,0x00000000u,0x00040047u,0x00000058u,0x00000022u,0x00000000u,0x00040047u,0x00000121u,0x00000021u,0x00000021u,0x00040047u,0x00000121u,0x00000022u,0x00000000u,0x00030047u,0x0000013eu,0x00000019u,0x00040047u,0x0000013eu,0x00000021u,0x00000030u,0x00040047u,0x0000013eu,0x00000022u,0x00000000u,0x00040047u,0x00000143u,0x0000000bu,0x00000019u,0x00020013u,0x00000002u,0x00030021u,0x00000003u,0x00000002u,0x00040015u,0x00000006u,0x00000020u,0x00000001u,0x00040017u,0x00000007u,0x00000006u,0x00000002u,0x00040020u,0x00000008u,0x00000007u,0x00000007u,0x00030016u,0x00000009u,0x00000020u,0x00040017u,0x0000000au,0x00000009u,0x00000004u,0x00050021u,0x0000000bu,0x0000000au,0x00000008u,0x00000008u,0x00050021u,0x00000010u,0x00000009u,0x00000008u,0x00000008u,0x00090019u,0x00000015u,0x00000009u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000001u,0x00000000u,0x0003001bu,0x00000016u,0x00000015u,0x00040020u,0x00000017u,0x00000000u,0x00000016u,0x0004003bu,0x00000017u,0x00000018u,0x00000000u,0x0004002bu,0x00000006u,0x0000001bu,0x00000000u,0x0005002cu,0x00000007u,0x0000001cu,0x0000001bu,0x0000001bu,0x0004002bu,0x00000006u,0x0000001eu,0x00000001u,0x0004003bu,0x00000017u,0x00000026u,0x00000000u,Line truncated
|
static const uint32_t OF3_FLOWREG_SPV[] = {0x07230203u,0x00010300u,0x0008000bu,0x00000144u,0x00000000u,0x00020011u,0x00000001u,0x00020011u,0x00000032u,0x0006000bu,0x00000001u,0x4c534c47u,0x6474732eu,0x3035342eu,0x00000000u,0x0003000eu,0x00000000u,0x00000001u,0x0006000fu,0x00000005u,0x00000004u,0x6e69616du,0x00000000u,0x00000037u,0x00060010u,0x00000004u,0x00000011u,0x00000010u,0x00000010u,0x00000001u,0x00030003u,0x00000002u,0x000001c2u,0x00040005u,0x00000004u,0x6e69616du,0x00000000u,0x00060005u,0x0000000eu,0x63746566u,0x76285568u,0x763b3269u,0x003b3269u,0x00030005u,0x0000000cu,0x00000070u,0x00030005u,0x0000000du,0x006d6964u,0x00060005u,0x00000013u,0x63746566u,0x76284c68u,0x763b3269u,0x003b3269u,0x00030005u,0x00000011u,0x00000070u,0x00030005u,0x00000012u,0x006d6964u,0x00040005u,0x00000018u,0x6f6c4675u,0x006e4977u,0x00040005u,0x00000026u,0x6d754c75u,0x00000061u,0x00030005u,0x00000034u,0x00646967u,0x00080005u,0x00000037u,0x475f6c67u,0x61626f6cu,0x766e496cu,0x7461636fu,0x496e6f69u,0x00000044u,0x00030005u,0x0000003cu,0x006d6964u,0x00030005u,0x00000055u,0x00007464u,0x00030005u,0x00000056u,0x00000055u,0x00050006u,0x00000056u,0x00000000u,0x61726170u,0x0000736du,0x00030005u,0x00000058u,0x00000000u,0x00040005u,0x0000005cu,0x626d616cu,0x00006164u,0x00050005u,0x0000005fu,0x65676465u,0x68706c41u,0x00000061u,0x00040005u,0x00000063u,0x54737065u,0x00000056u,0x00030005u,0x00000068u,0x00004375u,0x00040005u,0x00000069u,0x61726170u,0x0000006du,0x00040005u,0x0000006bu,0x61726170u,0x0000006du,0x00030005u,0x0000006eu,0x00004c75u,0x00040005u,0x00000073u,0x61726170u,0x0000006du,0x00040005u,0x00000074u,0x61726170u,0x0000006du,0x00030005u,0x00000077u,0x00005275u,0x00040005u,0x0000007bu,0x61726170u,0x0000006du,0x00040005u,0x0000007cu,0x61726170u,0x0000006du,0x00030005u,0x0000007fu,0x00005575u,0x00040005u,0x00000083u,0x61726170u,0x0000006du,0x00040005u,0x00000084u,0x61726170u,0x0000006du,0x00030005u,0x00000087u,0x00004475u,0x00040005u,0x0000008bu,0x61726170u,0x0000006du,0x00040005u,0x0000008cu,0x61726170u,0x0000006du,0x00040005u,0x0000008fu,0x6d69646cu,0x00000000u,0x00030005u,0x00000093u,0x00004c6cu,0x00040005u,0x00000096u,0x61726170u,0x0000006du,0x00040005u,0x00000097u,0x61726170u,0x0000006du,0x00030005u,0x0000009au,0x0000526cu,0x00040005u,0x0000009du,0x61726170u,0x0000006du,0x00040005u,0x0000009eu,0x61726170u,0x0000006du,0x00030005u,0x000000a1u,0x0000556cu,0x00040005u,0x000000a4u,0x61726170u,0x0000006du,0x00040005u,0x000000a5u,0x61726170u,0x0000006du,0x00030005u,0x000000a8u,0x0000446cu,0x00040005u,0x000000abu,0x61726170u,0x0000006du,0x00040005u,0x000000acu,0x61726170u,0x0000006du,0x00040005u,0x000000afu,0x67616d67u,0x00000000u,0x00030005u,0x000000bbu,0x00000067u,0x00030005u,0x000000c4u,0x00004c64u,0x00030005u,0x000000c8u,0x00005264u,0x00030005u,0x000000ccu,0x00005564u,0x00030005u,0x000000d0u,0x00004464u,0x00030005u,0x000000d4u,0x00003265u,0x00030005u,0x000000d8u,0x00004c77u,0x00030005u,0x000000e1u,0x00005277u,0x00030005u,0x000000eau,0x00005577u,0x00030005u,0x000000f3u,0x00004477u,0x00040005u,0x000000fcu,0x576d7573u,0x00000000u,0x00040005u,0x00000104u,0x576d7573u,0x00000055u,0x00040005u,0x00000114u,0x66694475u,0x00000066u,0x00030005u,0x00000120u,0x00003066u,0x00050005u,0x00000121u,0x6f6c4675u,0x73624f77u,0x00000000u,0x00040005u,0x0000012au,0x74656874u,0x00000061u,0x00030005u,0x0000012eu,0x00000072u,0x00040005u,0x00000132u,0x77654e75u,0x00000000u,0x00050005u,0x0000013eu,0x6f6c4675u,0x74754f77u,0x00000000u,0x00040047u,0x00000018u,0x00000021u,0x00000020u,0x00040047u,0x00000018u,0x00000022u,0x00000000u,0x00040047u,0x00000026u,0x00000021u,0x00000022u,0x00040047u,0x00000026u,0x00000022u,0x00000000u,0x00040047u,0x00000037u,0x0000000bu,0x0000001cu,0x00030047u,0x00000056u,0x00000002u,0x00050048u,0x00000056u,0x00000000u,0x00000023u,0x00000000u,0x00040047u,0x00000058u,0x00000021u,0x00000000u,0x00040047u,0x00000058u,0x00000022u,0x00000000u,0x00040047u,0x00000121u,0x00000021u,0x00000021u,0x00040047u,0x00000121u,0x00000022u,0x00000000u,0x00030047u,0x0000013eu,0x00000019u,0x00040047u,0x0000013eu,0x00000021u,0x00000030u,0x00040047u,0x0000013eu,0x00000022u,0x00000000u,0x00040047u,0x00000143u,0x0000000bu,0x00000019u,0x00020013u,0x00000002u,0x00030021u,0x00000003u,0x00000002u,0x00040015u,0x00000006u,0x00000020u,0x00000001u,0x00040017u,0x00000007u,0x00000006u,0x00000002u,0x00040020u,0x00000008u,0x00000007u,0x00000007u,0x00030016u,0x00000009u,0x00000020u,0x00040017u,0x0000000au,0x00000009u,0x00000004u,0x00050021u,0x0000000bu,0x0000000au,0x00000008u,0x00000008u,0x00050021u,0x00000010u,0x00000009u,0x00000008u,0x00000008u,0x00090019u,0x00000015u,0x00000009u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000001u,0x00000000u,0x0003001bu,0x00000016u,0x00000015u,0x00040020u,0x00000017u,0x00000000u,0x00000016u,0x0004003bu,0x00000017u,0x00000018u,0x00000000u,0x0004002bu,0x00000006u,0x0000001bu,0x00000000u,0x0005002cu,0x00000007u,0x0000001cu,0x0000001bu,0x0000001bu,0x0004002bu,0x00000006u,0x0000001eu,0x00000001u,0x0004003bu,0x00000017u,0x00000026u,0x00000000u,Line truncated
|
||||||
static const size_t OF3_FLOWREG_LEN = 1936;
|
static const size_t OF3_FLOWREG_LEN = 1936;
|
||||||
static const uint32_t DDFG_SYNTH_SPV[] = {0x07230203u,0x00010300u,0x0008000bu,0x00000208u,0x00000000u,0x00020011u,0x00000001u,0x00020011u,0x00000032u,0x0006000bu,0x00000001u,0x4c534c47u,0x6474732eu,0x3035342eu,0x00000000u,0x0003000eu,0x00000000u,0x00000001u,0x0006000fu,0x00000005u,0x00000004u,0x6e69616du,0x00000000u,0x0000001cu,0x00060010u,0x00000004u,0x00000011u,0x00000010u,0x00000010u,0x00000001u,0x00030003u,0x00000002u,0x000001c2u,0x00040005u,0x00000004u,0x6e69616du,0x00000000u,0x00050005u,0x0000000bu,0x616d756cu,0x33667628u,0x0000003bu,0x00030005u,0x0000000au,0x00000063u,0x00030005u,0x00000018u,0x00646967u,0x00080005u,0x0000001cu,0x475f6c67u,0x61626f6cu,0x766e496cu,0x7461636fu,0x496e6f69u,0x00000044u,0x00030005u,0x00000021u,0x006d6964u,0x00040005u,0x00000024u,0x74754f75u,0x00000000u,0x00040005u,0x0000003eu,0x44766e69u,0x00006d69u,0x00030005u,0x00000044u,0x00007675u,0x00030005u,0x0000004du,0x00000055u,0x00060006u,0x0000004du,0x00000000u,0x776f6c66u,0x6c616353u,0x00000065u,0x00050006u,0x0000004du,0x00000001u,0x68706c61u,0x00000061u,0x00050006u,0x0000004du,0x00000002u,0x61746562u,0x00000000u,0x00050006u,0x0000004du,0x00000003u,0x626d616cu,0x00006164u,0x00050006u,0x0000004du,0x00000004u,0x69737065u,0x006e6f6cu,0x00060006u,0x0000004du,0x00000005u,0x746f6870u,0x6163536fu,0x0000656cu,0x00050006u,0x0000004du,0x00000006u,0x30646170u,0x00000000u,0x00050006u,0x0000004du,0x00000007u,0x31646170u,0x00000000u,0x00050006u,0x0000004du,0x00000008u,0x52647568u,0x00746365u,0x00030005u,0x0000004fu,0x00000000u,0x00040005u,0x0000008cu,0x72754375u,0x00000072u,0x00030005u,0x00000098u,0x00676264u,0x00030005u,0x0000009fu,0x00007366u,0x00040005u,0x000000a9u,0x64774273u,0x00000000u,0x00050005u,0x000000aau,0x6f6c4675u,0x64774277u,0x00000000u,0x00040005u,0x000000aeu,0x64774673u,0x00000000u,0x00050005u,0x000000afu,0x6f6c4675u,0x64774677u,0x00000000u,0x00030005u,0x000000b3u,0x00313046u,0x00030005u,0x000000bau,0x00303146u,0x00040005u,0x000000c1u,0x31306663u,0x00000000u,0x00040005u,0x000000c5u,0x30316663u,0x00000000u,0x00030005u,0x000000c9u,0x0031306du,0x00030005u,0x000000d5u,0x0030316du,0x00030005u,0x000000e0u,0x00004170u,0x00030005u,0x000000e8u,0x00004270u,0x00030005u,0x000000f0u,0x00003043u,0x00040005u,0x000000f1u,0x65725075u,0x00000076u,0x00030005u,0x000000f6u,0x00003143u,0x00030005u,0x000000fbu,0x00004165u,0x00040005u,0x000000fcu,0x61726170u,0x0000006du,0x00040005u,0x0000010cu,0x61726170u,0x0000006du,0x00030005u,0x00000111u,0x00004265u,0x00040005u,0x00000112u,0x61726170u,0x0000006du,0x00040005u,0x00000122u,0x61726170u,0x0000006du,0x00040005u,0x00000127u,0x76556266u,0x00000000u,0x00040005u,0x0000012bu,0x65526266u,0x00646973u,0x00040005u,0x00000138u,0x736e6f63u,0x00747369u,0x00030005u,0x00000149u,0x0000305au,0x00030005u,0x00000157u,0x0000315au,0x00040005u,0x00000163u,0x30756174u,0x00000000u,0x00040005u,0x00000167u,0x31756174u,0x00000000u,0x00040005u,0x0000016au,0x78616d7au,0x00000000u,0x00030005u,0x0000016eu,0x00003057u,0x00030005u,0x00000179u,0x00003157u,0x00040005u,0x00000183u,0x6d757357u,0x00000000u,0x00040005u,0x00000187u,0x70726177u,0x00006465u,0x00050005u,0x000001a0u,0x736f7263u,0x64616673u,0x00000065u,0x00050005u,0x000001adu,0x746f6870u,0x7272456fu,0x00000000u,0x00050005u,0x000001b1u,0x746f6870u,0x7572546fu,0x00007473u,0x00040005u,0x000001b7u,0x73757274u,0x00000074u,0x00040005u,0x000001c3u,0x76657270u,0x00000043u,0x00040005u,0x000001c8u,0x72727563u,0x00000043u,0x00050005u,0x000001cdu,0x746e6f63u,0x44746e65u,0x00666669u,0x00050005u,0x000001d2u,0x72746e75u,0x65747375u,0x00000064u,0x00040005u,0x000001d7u,0x44676962u,0x00666669u,0x00050005u,0x000001dcu,0x70616e73u,0x75436f54u,0x00007272u,0x00040005u,0x000001e5u,0x6374756fu,0x00000000u,0x00030005u,0x000001eeu,0x0067616du,0x00030005u,0x000001f2u,0x0000006eu,0x00030005u,0x000001f6u,0x00746173u,0x00040047u,0x0000001cu,0x0000000bu,0x0000001cu,0x00030047u,0x00000024u,0x00000019u,0x00040047u,0x00000024u,0x00000021u,0x00000030u,0x00040047u,0x00000024u,0x00000022u,0x00000000u,0x00030047u,0x0000004du,0x00000002u,0x00050048u,0x0000004du,0x00000000u,0x00000023u,0x00000000u,0x00050048u,0x0000004du,0x00000001u,0x00000023u,0x00000004u,0x00050048u,0x0000004du,0x00000002u,0x00000023u,0x00000008u,0x00050048u,0x0000004du,0x00000003u,0x00000023u,0x0000000cu,0x00050048u,0x0000004du,0x00000004u,0x00000023u,0x00000010u,0x00050048u,0x0000004du,0x00000005u,0x00000023u,0x00000014u,0x00050048u,0x0000004du,0x00000006u,0x00000023u,0x00000018u,0x00050048u,0x0000004du,0x00000007u,0x00000023u,0x0000001cu,0x00050048u,0x0000004du,0x00000008u,0x00000023u,0x00000020u,0x00040047u,0x0000004fu,0x00000021u,0x00000000u,0x00040047u,0x0000004fu,0x00000022u,0x00000000u,0x00040047u,0x0000008cu,0x00000021u,0x00000021u,0x00040047u,0x0000008cu,0x00000022u,0x00000000u,0x00040047u,0x000000aau,0x00000021u,0x00000023u,0x00040047u,0x000000aau,0x00000022u,0x00000000u,0x00040047u,0x000000afu,0x00000021u,0x00000022u,0x00040047u,0x000000afu,0x00000022u,0x00000000u,0x00040047u,0x000000f1u,0x00000021u,0x00000020u,0x00040047u,0x000000f1u,0Line truncated
|
static const uint32_t WFG_SYNTH_SPV[] = {0x07230203u,0x00010300u,0x0008000bu,0x00000208u,0x00000000u,0x00020011u,0x00000001u,0x00020011u,0x00000032u,0x0006000bu,0x00000001u,0x4c534c47u,0x6474732eu,0x3035342eu,0x00000000u,0x0003000eu,0x00000000u,0x00000001u,0x0006000fu,0x00000005u,0x00000004u,0x6e69616du,0x00000000u,0x0000001cu,0x00060010u,0x00000004u,0x00000011u,0x00000010u,0x00000010u,0x00000001u,0x00030003u,0x00000002u,0x000001c2u,0x00040005u,0x00000004u,0x6e69616du,0x00000000u,0x00050005u,0x0000000bu,0x616d756cu,0x33667628u,0x0000003bu,0x00030005u,0x0000000au,0x00000063u,0x00030005u,0x00000018u,0x00646967u,0x00080005u,0x0000001cu,0x475f6c67u,0x61626f6cu,0x766e496cu,0x7461636fu,0x496e6f69u,0x00000044u,0x00030005u,0x00000021u,0x006d6964u,0x00040005u,0x00000024u,0x74754f75u,0x00000000u,0x00040005u,0x0000003eu,0x44766e69u,0x00006d69u,0x00030005u,0x00000044u,0x00007675u,0x00030005u,0x0000004du,0x00000055u,0x00060006u,0x0000004du,0x00000000u,0x776f6c66u,0x6c616353u,0x00000065u,0x00050006u,0x0000004du,0x00000001u,0x68706c61u,0x00000061u,0x00050006u,0x0000004du,0x00000002u,0x61746562u,0x00000000u,0x00050006u,0x0000004du,0x00000003u,0x626d616cu,0x00006164u,0x00050006u,0x0000004du,0x00000004u,0x69737065u,0x006e6f6cu,0x00060006u,0x0000004du,0x00000005u,0x746f6870u,0x6163536fu,0x0000656cu,0x00050006u,0x0000004du,0x00000006u,0x30646170u,0x00000000u,0x00050006u,0x0000004du,0x00000007u,0x31646170u,0x00000000u,0x00050006u,0x0000004du,0x00000008u,0x52647568u,0x00746365u,0x00030005u,0x0000004fu,0x00000000u,0x00040005u,0x0000008cu,0x72754375u,0x00000072u,0x00030005u,0x00000098u,0x00676264u,0x00030005u,0x0000009fu,0x00007366u,0x00040005u,0x000000a9u,0x64774273u,0x00000000u,0x00050005u,0x000000aau,0x6f6c4675u,0x64774277u,0x00000000u,0x00040005u,0x000000aeu,0x64774673u,0x00000000u,0x00050005u,0x000000afu,0x6f6c4675u,0x64774677u,0x00000000u,0x00030005u,0x000000b3u,0x00313046u,0x00030005u,0x000000bau,0x00303146u,0x00040005u,0x000000c1u,0x31306663u,0x00000000u,0x00040005u,0x000000c5u,0x30316663u,0x00000000u,0x00030005u,0x000000c9u,0x0031306du,0x00030005u,0x000000d5u,0x0030316du,0x00030005u,0x000000e0u,0x00004170u,0x00030005u,0x000000e8u,0x00004270u,0x00030005u,0x000000f0u,0x00003043u,0x00040005u,0x000000f1u,0x65725075u,0x00000076u,0x00030005u,0x000000f6u,0x00003143u,0x00030005u,0x000000fbu,0x00004165u,0x00040005u,0x000000fcu,0x61726170u,0x0000006du,0x00040005u,0x0000010cu,0x61726170u,0x0000006du,0x00030005u,0x00000111u,0x00004265u,0x00040005u,0x00000112u,0x61726170u,0x0000006du,0x00040005u,0x00000122u,0x61726170u,0x0000006du,0x00040005u,0x00000127u,0x76556266u,0x00000000u,0x00040005u,0x0000012bu,0x65526266u,0x00646973u,0x00040005u,0x00000138u,0x736e6f63u,0x00747369u,0x00030005u,0x00000149u,0x0000305au,0x00030005u,0x00000157u,0x0000315au,0x00040005u,0x00000163u,0x30756174u,0x00000000u,0x00040005u,0x00000167u,0x31756174u,0x00000000u,0x00040005u,0x0000016au,0x78616d7au,0x00000000u,0x00030005u,0x0000016eu,0x00003057u,0x00030005u,0x00000179u,0x00003157u,0x00040005u,0x00000183u,0x6d757357u,0x00000000u,0x00040005u,0x00000187u,0x70726177u,0x00006465u,0x00050005u,0x000001a0u,0x736f7263u,0x64616673u,0x00000065u,0x00050005u,0x000001adu,0x746f6870u,0x7272456fu,0x00000000u,0x00050005u,0x000001b1u,0x746f6870u,0x7572546fu,0x00007473u,0x00040005u,0x000001b7u,0x73757274u,0x00000074u,0x00040005u,0x000001c3u,0x76657270u,0x00000043u,0x00040005u,0x000001c8u,0x72727563u,0x00000043u,0x00050005u,0x000001cdu,0x746e6f63u,0x44746e65u,0x00666669u,0x00050005u,0x000001d2u,0x72746e75u,0x65747375u,0x00000064u,0x00040005u,0x000001d7u,0x44676962u,0x00666669u,0x00050005u,0x000001dcu,0x70616e73u,0x75436f54u,0x00007272u,0x00040005u,0x000001e5u,0x6374756fu,0x00000000u,0x00030005u,0x000001eeu,0x0067616du,0x00030005u,0x000001f2u,0x0000006eu,0x00030005u,0x000001f6u,0x00746173u,0x00040047u,0x0000001cu,0x0000000bu,0x0000001cu,0x00030047u,0x00000024u,0x00000019u,0x00040047u,0x00000024u,0x00000021u,0x00000030u,0x00040047u,0x00000024u,0x00000022u,0x00000000u,0x00030047u,0x0000004du,0x00000002u,0x00050048u,0x0000004du,0x00000000u,0x00000023u,0x00000000u,0x00050048u,0x0000004du,0x00000001u,0x00000023u,0x00000004u,0x00050048u,0x0000004du,0x00000002u,0x00000023u,0x00000008u,0x00050048u,0x0000004du,0x00000003u,0x00000023u,0x0000000cu,0x00050048u,0x0000004du,0x00000004u,0x00000023u,0x00000010u,0x00050048u,0x0000004du,0x00000005u,0x00000023u,0x00000014u,0x00050048u,0x0000004du,0x00000006u,0x00000023u,0x00000018u,0x00050048u,0x0000004du,0x00000007u,0x00000023u,0x0000001cu,0x00050048u,0x0000004du,0x00000008u,0x00000023u,0x00000020u,0x00040047u,0x0000004fu,0x00000021u,0x00000000u,0x00040047u,0x0000004fu,0x00000022u,0x00000000u,0x00040047u,0x0000008cu,0x00000021u,0x00000021u,0x00040047u,0x0000008cu,0x00000022u,0x00000000u,0x00040047u,0x000000aau,0x00000021u,0x00000023u,0x00040047u,0x000000aau,0x00000022u,0x00000000u,0x00040047u,0x000000afu,0x00000021u,0x00000022u,0x00040047u,0x000000afu,0x00000022u,0x00000000u,0x00040047u,0x000000f1u,0x00000021u,0x00000020u,0x00040047u,0x000000f1u,0xLine truncated
|
||||||
static const size_t DDFG_SYNTH_LEN = 3082;
|
static const size_t WFG_SYNTH_LEN = 3082;
|
||||||
struct Blob { const uint32_t* code; size_t words; };
|
struct Blob { const uint32_t* code; size_t words; };
|
||||||
enum Shader { OF3_LUMA, OF3_DOWNSAMPLE, OF3_FLOW, OF3_EXPAND, OF3_FLOW_M4, OF3_EXPAND_M4, OF3_GM_REDUCE, OF3_GM_PREWARP, OF3_FLOWREG, DDFG_SYNTH, SHADER_COUNT };
|
enum Shader { OF3_LUMA, OF3_DOWNSAMPLE, OF3_FLOW, OF3_EXPAND, OF3_FLOW_M4, OF3_EXPAND_M4, OF3_GM_REDUCE, OF3_GM_PREWARP, OF3_FLOWREG, WFG_SYNTH, SHADER_COUNT };
|
||||||
static inline Blob blob(Shader s) {
|
static inline Blob blob(Shader s) {
|
||||||
switch (s) {
|
switch (s) {
|
||||||
case OF3_LUMA: return { OF3_LUMA_SPV, OF3_LUMA_LEN };
|
case OF3_LUMA: return { OF3_LUMA_SPV, OF3_LUMA_LEN };
|
||||||
@@ -35,7 +35,7 @@ static inline Blob blob(Shader s) {
|
|||||||
case OF3_GM_REDUCE: return { OF3_GM_REDUCE_SPV, OF3_GM_REDUCE_LEN };
|
case OF3_GM_REDUCE: return { OF3_GM_REDUCE_SPV, OF3_GM_REDUCE_LEN };
|
||||||
case OF3_GM_PREWARP: return { OF3_GM_PREWARP_SPV, OF3_GM_PREWARP_LEN };
|
case OF3_GM_PREWARP: return { OF3_GM_PREWARP_SPV, OF3_GM_PREWARP_LEN };
|
||||||
case OF3_FLOWREG: return { OF3_FLOWREG_SPV, OF3_FLOWREG_LEN };
|
case OF3_FLOWREG: return { OF3_FLOWREG_SPV, OF3_FLOWREG_LEN };
|
||||||
case DDFG_SYNTH: return { DDFG_SYNTH_SPV, DDFG_SYNTH_LEN };
|
case WFG_SYNTH: return { WFG_SYNTH_SPV, WFG_SYNTH_LEN };
|
||||||
default: return { nullptr, 0 };
|
default: return { nullptr, 0 };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+6
-6
@@ -4,9 +4,9 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
namespace ddfg {
|
namespace winfg {
|
||||||
|
|
||||||
#define VKOK(x) do { if ((x) != VK_SUCCESS) { DDFG_LOGE("vk fail: %s", #x); return false; } } while (0)
|
#define VKOK(x) do { if ((x) != VK_SUCCESS) { WFG_LOGE("vk fail: %s", #x); return false; } } while (0)
|
||||||
|
|
||||||
uint32_t FrameGen::findMemType(uint32_t bits, VkMemoryPropertyFlags props) const {
|
uint32_t FrameGen::findMemType(uint32_t bits, VkMemoryPropertyFlags props) const {
|
||||||
for (uint32_t i = 0; i < memProps_.memoryTypeCount; ++i)
|
for (uint32_t i = 0; i < memProps_.memoryTypeCount; ++i)
|
||||||
@@ -153,9 +153,9 @@ bool FrameGen::init(const DeviceDispatch* dd, const InstanceDispatch* id,
|
|||||||
if (!makePipe(pGmReduce_, embedded::OF3_GM_REDUCE, unused)) return false;
|
if (!makePipe(pGmReduce_, embedded::OF3_GM_REDUCE, unused)) return false;
|
||||||
if (!makePipe(pGmPrewarp_, embedded::OF3_GM_PREWARP, unused)) return false;
|
if (!makePipe(pGmPrewarp_, embedded::OF3_GM_PREWARP, unused)) return false;
|
||||||
if (!makePipe(pFlowReg_, embedded::OF3_FLOWREG, unused)) return false;
|
if (!makePipe(pFlowReg_, embedded::OF3_FLOWREG, unused)) return false;
|
||||||
if (!makePipe(pSynth_, embedded::DDFG_SYNTH, unused)) return false;
|
if (!makePipe(pSynth_, embedded::WFG_SYNTH, unused)) return false;
|
||||||
if (!makeGmBuffers()) { DDFG_LOGE("framegen: GM SSBO alloc failed - C1 disabled"); }
|
if (!makeGmBuffers()) { WFG_LOGE("framegen: GM SSBO alloc failed - C1 disabled"); }
|
||||||
DDFG_LOGI("framegen init ok (queueFamily=%u, 10 pipelines, model=%d, C1 gm=%d, C2 flow_reg=%d iters=%d)",
|
WFG_LOGI("framegen init ok (queueFamily=%u, 10 pipelines, model=%d, C1 gm=%d, C2 flow_reg=%d iters=%d)",
|
||||||
queueFamily_, cfg_.model, cfg_.gmMode, cfg_.frMode, cfg_.frIters);
|
queueFamily_, cfg_.model, cfg_.gmMode, cfg_.frMode, cfg_.frIters);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -194,7 +194,7 @@ bool FrameGen::onResize(VkExtent2D extent, VkFormat , bool force) {
|
|||||||
if (!makeImage(flowRegA_, levelExtent(extent, flowFinest_), VK_FORMAT_R16G16B16A16_SFLOAT, regUsage)) return false;
|
if (!makeImage(flowRegA_, levelExtent(extent, flowFinest_), VK_FORMAT_R16G16B16A16_SFLOAT, regUsage)) return false;
|
||||||
if (!makeImage(flowRegB_, levelExtent(extent, flowFinest_), VK_FORMAT_R16G16B16A16_SFLOAT, regUsage)) return false;
|
if (!makeImage(flowRegB_, levelExtent(extent, flowFinest_), VK_FORMAT_R16G16B16A16_SFLOAT, regUsage)) return false;
|
||||||
ready_ = true;
|
ready_ = true;
|
||||||
DDFG_LOGI("framegen resized to %ux%u (%d pyramid levels, kFlowFinest=%d perf_preset=%d)",
|
WFG_LOGI("framegen resized to %ux%u (%d pyramid levels, kFlowFinest=%d perf_preset=%d)",
|
||||||
extent.width, extent.height, kLevels, flowFinest_, cfg_.perfPreset);
|
extent.width, extent.height, kLevels, flowFinest_, cfg_.perfPreset);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
+2
-4
@@ -3,7 +3,7 @@
|
|||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace ddfg {
|
namespace winfg {
|
||||||
|
|
||||||
class FrameGen {
|
class FrameGen {
|
||||||
public:
|
public:
|
||||||
@@ -12,8 +12,7 @@ public:
|
|||||||
void configure(const Config& c);
|
void configure(const Config& c);
|
||||||
bool onResize(VkExtent2D extent, VkFormat colorFormat, bool force = false);
|
bool onResize(VkExtent2D extent, VkFormat colorFormat, bool force = false);
|
||||||
void record(VkCommandBuffer cmd, VkImageView prevView, VkImageView currView,
|
void record(VkCommandBuffer cmd, VkImageView prevView, VkImageView currView,
|
||||||
VkImageView outView, float alpha, uint32_t gmSlot = 0,
|
VkImageView outView, float alpha, uint32_t gmSlot = 0);
|
||||||
uint32_t synthSlot = 0, bool reuseFlow = false);
|
|
||||||
void destroy();
|
void destroy();
|
||||||
bool valid() const { return device_ != VK_NULL_HANDLE && ready_; }
|
bool valid() const { return device_ != VK_NULL_HANDLE && ready_; }
|
||||||
const Config& config() const { return cfg_; }
|
const Config& config() const { return cfg_; }
|
||||||
@@ -26,7 +25,6 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
static constexpr int kGmSlots = 3;
|
static constexpr int kGmSlots = 3;
|
||||||
static constexpr int kSynthSlots = 3;
|
|
||||||
static constexpr int kGmLevel = 3;
|
static constexpr int kGmLevel = 3;
|
||||||
static constexpr int kGmThreads = 512;
|
static constexpr int kGmThreads = 512;
|
||||||
static constexpr int kGmStride = 32;
|
static constexpr int kGmStride = 32;
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
#if defined(__ANDROID__)
|
||||||
|
#include <android/log.h>
|
||||||
|
#define WFG_LOGI(...) __android_log_print(ANDROID_LOG_INFO, "win-fg", __VA_ARGS__)
|
||||||
|
#define WFG_LOGE(...) __android_log_print(ANDROID_LOG_ERROR, "win-fg", __VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#include <cstdio>
|
||||||
|
#define WFG_LOGI(...) do { std::fprintf(stderr, "[win-fg] " __VA_ARGS__); std::fprintf(stderr, "\n"); } while(0)
|
||||||
|
#define WFG_LOGE(...) do { std::fprintf(stderr, "[win-fg][E] " __VA_ARGS__); std::fprintf(stderr, "\n"); } while(0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define WFG_LOGD(cond, ...) do { if (cond) WFG_LOGI(__VA_ARGS__); } while(0)
|
||||||
+144
-161
@@ -1,34 +1,31 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct ScratchState {
|
struct ScratchState {
|
||||||
VkBuffer synthUbo[ddfg::FrameGen::kSynthSlots]{};
|
VkBuffer synthUbo = VK_NULL_HANDLE; VkDeviceMemory synthUboMem = VK_NULL_HANDLE; void* synthUboPtr = nullptr;
|
||||||
VkDeviceMemory synthUboMem[ddfg::FrameGen::kSynthSlots]{};
|
|
||||||
void* synthUboPtr[ddfg::FrameGen::kSynthSlots]{};
|
|
||||||
std::vector<VkBuffer> flowUbo; std::vector<VkDeviceMemory> flowUboMem; std::vector<void*> flowUboPtr;
|
std::vector<VkBuffer> flowUbo; std::vector<VkDeviceMemory> flowUboMem; std::vector<void*> flowUboPtr;
|
||||||
VkBuffer expandUbo = VK_NULL_HANDLE; VkDeviceMemory expandUboMem = VK_NULL_HANDLE; void* expandUboPtr = nullptr;
|
VkBuffer expandUbo = VK_NULL_HANDLE; VkDeviceMemory expandUboMem = VK_NULL_HANDLE; void* expandUboPtr = nullptr;
|
||||||
VkBuffer flowRegUbo = VK_NULL_HANDLE; VkDeviceMemory flowRegUboMem = VK_NULL_HANDLE; void* flowRegUboPtr = nullptr;
|
VkBuffer flowRegUbo = VK_NULL_HANDLE; VkDeviceMemory flowRegUboMem = VK_NULL_HANDLE; void* flowRegUboPtr = nullptr;
|
||||||
VkBuffer gmUbo[ddfg::FrameGen::kGmSlots]{};
|
VkBuffer gmUbo[winfg::FrameGen::kGmSlots]{};
|
||||||
VkDeviceMemory gmUboMem[ddfg::FrameGen::kGmSlots]{};
|
VkDeviceMemory gmUboMem[winfg::FrameGen::kGmSlots]{};
|
||||||
void* gmUboPtr[ddfg::FrameGen::kGmSlots]{};
|
void* gmUboPtr[winfg::FrameGen::kGmSlots]{};
|
||||||
VkDescriptorSet sLumaCurr = VK_NULL_HANDLE, sLumaPrev = VK_NULL_HANDLE;
|
VkDescriptorSet sLumaCurr = VK_NULL_HANDLE, sLumaPrev = VK_NULL_HANDLE;
|
||||||
std::vector<VkDescriptorSet> sDownA, sDownB, sFlow;
|
std::vector<VkDescriptorSet> sDownA, sDownB, sFlow;
|
||||||
VkDescriptorSet sExpand[ddfg::FrameGen::kGmSlots]{};
|
VkDescriptorSet sExpand[winfg::FrameGen::kGmSlots]{};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
VkDescriptorSet sFlowReg0 = VK_NULL_HANDLE, sFlowRegAB = VK_NULL_HANDLE, sFlowRegBA = VK_NULL_HANDLE;
|
VkDescriptorSet sFlowReg0 = VK_NULL_HANDLE, sFlowRegAB = VK_NULL_HANDLE, sFlowRegBA = VK_NULL_HANDLE;
|
||||||
VkDescriptorSet sSynth[ddfg::FrameGen::kSynthSlots]{};
|
VkDescriptorSet sSynth = VK_NULL_HANDLE;
|
||||||
VkDescriptorSet sGmReduce[ddfg::FrameGen::kGmSlots]{};
|
VkDescriptorSet sGmReduce[winfg::FrameGen::kGmSlots]{};
|
||||||
std::vector<VkDescriptorSet> sGmPrewarp[ddfg::FrameGen::kGmSlots];
|
std::vector<VkDescriptorSet> sGmPrewarp[winfg::FrameGen::kGmSlots];
|
||||||
VkExtent2D builtFor{0,0};
|
VkExtent2D builtFor{0,0};
|
||||||
bool built = false;
|
bool built = false;
|
||||||
bool flowInited = false;
|
bool flowInited = false;
|
||||||
bool flowReady = false;
|
|
||||||
};
|
};
|
||||||
ScratchState g_scratch;
|
ScratchState g_scratch;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool makeUbo(const ddfg::DeviceDispatch* dd, VkDevice dev,
|
static bool makeUbo(const winfg::DeviceDispatch* dd, VkDevice dev,
|
||||||
const VkPhysicalDeviceMemoryProperties& mp,
|
const VkPhysicalDeviceMemoryProperties& mp,
|
||||||
VkDeviceSize size, VkBuffer& buf, VkDeviceMemory& mem, void*& ptr) {
|
VkDeviceSize size, VkBuffer& buf, VkDeviceMemory& mem, void*& ptr) {
|
||||||
VkBufferCreateInfo bi{VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO};
|
VkBufferCreateInfo bi{VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO};
|
||||||
@@ -44,21 +41,21 @@ static bool makeUbo(const ddfg::DeviceDispatch* dd, VkDevice dev,
|
|||||||
return dd->MapMemory(dev, mem, 0, size, 0, &ptr) == VK_SUCCESS;
|
return dd->MapMemory(dev, mem, 0, size, 0, &ptr) == VK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VkDescriptorSet allocSet(const ddfg::DeviceDispatch* dd, VkDevice dev,
|
static VkDescriptorSet allocSet(const winfg::DeviceDispatch* dd, VkDevice dev,
|
||||||
VkDescriptorPool pool, VkDescriptorSetLayout layout) {
|
VkDescriptorPool pool, VkDescriptorSetLayout layout) {
|
||||||
VkDescriptorSetAllocateInfo ai{VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO};
|
VkDescriptorSetAllocateInfo ai{VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO};
|
||||||
ai.descriptorPool = pool; ai.descriptorSetCount = 1; ai.pSetLayouts = &layout;
|
ai.descriptorPool = pool; ai.descriptorSetCount = 1; ai.pSetLayouts = &layout;
|
||||||
VkDescriptorSet s = VK_NULL_HANDLE; dd->AllocateDescriptorSets(dev, &ai, &s); return s;
|
VkDescriptorSet s = VK_NULL_HANDLE; dd->AllocateDescriptorSets(dev, &ai, &s); return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wImg(const ddfg::DeviceDispatch* dd, VkDevice dev, VkDescriptorSet set, uint32_t binding,
|
static void wImg(const winfg::DeviceDispatch* dd, VkDevice dev, VkDescriptorSet set, uint32_t binding,
|
||||||
VkDescriptorType type, VkImageView view, VkSampler samp, VkImageLayout layout) {
|
VkDescriptorType type, VkImageView view, VkSampler samp, VkImageLayout layout) {
|
||||||
VkDescriptorImageInfo ii{}; ii.imageView = view; ii.sampler = samp; ii.imageLayout = layout;
|
VkDescriptorImageInfo ii{}; ii.imageView = view; ii.sampler = samp; ii.imageLayout = layout;
|
||||||
VkWriteDescriptorSet w{VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET};
|
VkWriteDescriptorSet w{VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET};
|
||||||
w.dstSet = set; w.dstBinding = binding; w.descriptorCount = 1; w.descriptorType = type; w.pImageInfo = ⅈ
|
w.dstSet = set; w.dstBinding = binding; w.descriptorCount = 1; w.descriptorType = type; w.pImageInfo = ⅈ
|
||||||
dd->UpdateDescriptorSets(dev, 1, &w, 0, nullptr);
|
dd->UpdateDescriptorSets(dev, 1, &w, 0, nullptr);
|
||||||
}
|
}
|
||||||
static void wUbo(const ddfg::DeviceDispatch* dd, VkDevice dev, VkDescriptorSet set, uint32_t binding,
|
static void wUbo(const winfg::DeviceDispatch* dd, VkDevice dev, VkDescriptorSet set, uint32_t binding,
|
||||||
VkBuffer buf, VkDeviceSize range) {
|
VkBuffer buf, VkDeviceSize range) {
|
||||||
VkDescriptorBufferInfo bi{}; bi.buffer = buf; bi.range = range;
|
VkDescriptorBufferInfo bi{}; bi.buffer = buf; bi.range = range;
|
||||||
VkWriteDescriptorSet w{VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET};
|
VkWriteDescriptorSet w{VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET};
|
||||||
@@ -66,7 +63,7 @@ static void wUbo(const ddfg::DeviceDispatch* dd, VkDevice dev, VkDescriptorSet s
|
|||||||
w.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; w.pBufferInfo = &bi;
|
w.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; w.pBufferInfo = &bi;
|
||||||
dd->UpdateDescriptorSets(dev, 1, &w, 0, nullptr);
|
dd->UpdateDescriptorSets(dev, 1, &w, 0, nullptr);
|
||||||
}
|
}
|
||||||
static void wSsbo(const ddfg::DeviceDispatch* dd, VkDevice dev, VkDescriptorSet set, uint32_t binding,
|
static void wSsbo(const winfg::DeviceDispatch* dd, VkDevice dev, VkDescriptorSet set, uint32_t binding,
|
||||||
VkBuffer buf, VkDeviceSize range) {
|
VkBuffer buf, VkDeviceSize range) {
|
||||||
VkDescriptorBufferInfo bi{}; bi.buffer = buf; bi.range = range;
|
VkDescriptorBufferInfo bi{}; bi.buffer = buf; bi.range = range;
|
||||||
VkWriteDescriptorSet w{VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET};
|
VkWriteDescriptorSet w{VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET};
|
||||||
@@ -120,7 +117,7 @@ static void mulAff(const double A[3][3], const double B[3][3], double out[3][3])
|
|||||||
out[2][0]=0.0; out[2][1]=0.0; out[2][2]=1.0;
|
out[2][0]=0.0; out[2][1]=0.0; out[2][2]=1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ddfg {
|
namespace winfg {
|
||||||
|
|
||||||
static bool ensureScratch(FrameGen* fg, const DeviceDispatch* dd, VkDevice dev,
|
static bool ensureScratch(FrameGen* fg, const DeviceDispatch* dd, VkDevice dev,
|
||||||
const VkPhysicalDeviceMemoryProperties& mp, VkDescriptorPool pool,
|
const VkPhysicalDeviceMemoryProperties& mp, VkDescriptorPool pool,
|
||||||
@@ -143,7 +140,7 @@ static void destroyScratch(const DeviceDispatch* dd, VkDevice dev, VkDescriptorP
|
|||||||
b = VK_NULL_HANDLE; m = VK_NULL_HANDLE; p = nullptr;
|
b = VK_NULL_HANDLE; m = VK_NULL_HANDLE; p = nullptr;
|
||||||
};
|
};
|
||||||
auto& S = g_scratch;
|
auto& S = g_scratch;
|
||||||
for (int s = 0; s < FrameGen::kSynthSlots; ++s) freeUbo(S.synthUbo[s], S.synthUboMem[s], S.synthUboPtr[s]);
|
freeUbo(S.synthUbo, S.synthUboMem, S.synthUboPtr);
|
||||||
freeUbo(S.expandUbo, S.expandUboMem, S.expandUboPtr);
|
freeUbo(S.expandUbo, S.expandUboMem, S.expandUboPtr);
|
||||||
freeUbo(S.flowRegUbo, S.flowRegUboMem, S.flowRegUboPtr);
|
freeUbo(S.flowRegUbo, S.flowRegUboMem, S.flowRegUboPtr);
|
||||||
for (size_t i = 0; i < S.flowUbo.size(); ++i) freeUbo(S.flowUbo[i], S.flowUboMem[i], S.flowUboPtr[i]);
|
for (size_t i = 0; i < S.flowUbo.size(); ++i) freeUbo(S.flowUbo[i], S.flowUboMem[i], S.flowUboPtr[i]);
|
||||||
@@ -157,7 +154,7 @@ void FrameGen::configure(const Config& c) {
|
|||||||
int want = flowFinestForPreset(cfg_.perfPreset);
|
int want = flowFinestForPreset(cfg_.perfPreset);
|
||||||
const int maxFinest = kLevels - 2;
|
const int maxFinest = kLevels - 2;
|
||||||
if (want > maxFinest) {
|
if (want > maxFinest) {
|
||||||
DDFG_LOGE("perf-preset=%d wants kFlowFinest=%d but only %d pyramid levels exist "
|
WFG_LOGE("perf-preset=%d wants kFlowFinest=%d but only %d pyramid levels exist "
|
||||||
"(need >=2 solved) - clamping to %d", cfg_.perfPreset, want, kLevels, maxFinest);
|
"(need >=2 solved) - clamping to %d", cfg_.perfPreset, want, kLevels, maxFinest);
|
||||||
want = maxFinest;
|
want = maxFinest;
|
||||||
}
|
}
|
||||||
@@ -166,7 +163,7 @@ void FrameGen::configure(const Config& c) {
|
|||||||
const int prevFinest = flowFinest_;
|
const int prevFinest = flowFinest_;
|
||||||
flowFinest_ = want;
|
flowFinest_ = want;
|
||||||
const bool live = (flowFinest_ != prevFinest) && ready_;
|
const bool live = (flowFinest_ != prevFinest) && ready_;
|
||||||
DDFG_LOGI("perf-preset=%d -> kFlowFinest=%d (was %d) live-rebuild=%d ready=%d",
|
WFG_LOGI("perf-preset=%d -> kFlowFinest=%d (was %d) live-rebuild=%d ready=%d",
|
||||||
cfg_.perfPreset, flowFinest_, prevFinest, live ? 1 : 0, ready_ ? 1 : 0);
|
cfg_.perfPreset, flowFinest_, prevFinest, live ? 1 : 0, ready_ ? 1 : 0);
|
||||||
|
|
||||||
if (!live) return;
|
if (!live) return;
|
||||||
@@ -177,12 +174,12 @@ void FrameGen::configure(const Config& c) {
|
|||||||
dd_->DeviceWaitIdle(device_);
|
dd_->DeviceWaitIdle(device_);
|
||||||
destroyScratch(dd_, device_, descPool_);
|
destroyScratch(dd_, device_, descPool_);
|
||||||
if (!onResize(extent_, VK_FORMAT_UNDEFINED, true))
|
if (!onResize(extent_, VK_FORMAT_UNDEFINED, true))
|
||||||
DDFG_LOGE("perf-preset live rebuild: onResize FAILED at %ux%u - FG disabled until next resize",
|
WFG_LOGE("perf-preset live rebuild: onResize FAILED at %ux%u - FG disabled until next resize",
|
||||||
extent_.width, extent_.height);
|
extent_.width, extent_.height);
|
||||||
for (int i = 0; i < 6; ++i) gmRun_[i] = 0.0;
|
for (int i = 0; i < 6; ++i) gmRun_[i] = 0.0;
|
||||||
for (int s = 0; s < kGmSlots; ++s) { gmSlotValid_[s] = false; for (int i = 0; i < 6; ++i) gmLinAt_[s][i] = 0.0; }
|
for (int s = 0; s < kGmSlots; ++s) { gmSlotValid_[s] = false; for (int i = 0; i < 6; ++i) gmLinAt_[s][i] = 0.0; }
|
||||||
gmHaveEst_ = false; gmEngaged_ = false; gmStableCount_ = 0; gmLastTransPx_ = 0.0f;
|
gmHaveEst_ = false; gmEngaged_ = false; gmStableCount_ = 0; gmLastTransPx_ = 0.0f;
|
||||||
DDFG_LOGI("perf-preset live rebuild DONE (kFlowFinest=%d, flow predictor reset)", flowFinest_);
|
WFG_LOGI("perf-preset live rebuild DONE (kFlowFinest=%d, flow predictor reset)", flowFinest_);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FrameGen::updateGlobalMotion(uint32_t gmSlot, VkExtent2D fullExtent) {
|
bool FrameGen::updateGlobalMotion(uint32_t gmSlot, VkExtent2D fullExtent) {
|
||||||
@@ -252,10 +249,9 @@ bool FrameGen::updateGlobalMotion(uint32_t gmSlot, VkExtent2D fullExtent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView currView,
|
void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView currView,
|
||||||
VkImageView outView, float alpha, uint32_t gmSlot, uint32_t synthSlot, bool reuseFlow) {
|
VkImageView outView, float alpha, uint32_t gmSlot) {
|
||||||
if (!valid()) return;
|
if (!valid()) return;
|
||||||
if (gmSlot >= (uint32_t)kGmSlots) gmSlot = 0;
|
if (gmSlot >= (uint32_t)kGmSlots) gmSlot = 0;
|
||||||
if (synthSlot >= (uint32_t)kSynthSlots) synthSlot = 0;
|
|
||||||
const bool m4 = (cfg_.model == 4);
|
const bool m4 = (cfg_.model == 4);
|
||||||
const Pipe& flowP = m4 ? pFlowM4_ : pFlow_;
|
const Pipe& flowP = m4 ? pFlowM4_ : pFlow_;
|
||||||
const Pipe& expandP = m4 ? pExpandM4_ : pExpand_;
|
const Pipe& expandP = m4 ? pExpandM4_ : pExpand_;
|
||||||
@@ -267,42 +263,35 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur
|
|||||||
pFlowReg_, flowRegA_, flowRegB_, gmSsbo_, kLevels, cfg_);
|
pFlowReg_, flowRegA_, flowRegB_, gmSsbo_, kLevels, cfg_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Every generation of one real frame is recorded into the same command buffer, so the flow
|
bool gmEngaged = updateGlobalMotion(gmSlot, extent_);
|
||||||
// between prev and curr is computed once and each generation gets its own synth UBO and set.
|
if (g_scratch.gmUboPtr[gmSlot]) {
|
||||||
if (reuseFlow && !g_scratch.flowReady) return;
|
GMUBO g{};
|
||||||
if (!reuseFlow) {
|
g.lin[0]=(float)gmRun_[0]; g.lin[1]=(float)gmRun_[1]; g.lin[2]=(float)gmRun_[2]; g.lin[3]=(float)gmRun_[3];
|
||||||
bool gmEngaged = updateGlobalMotion(gmSlot, extent_);
|
g.linT[0]=(float)gmRun_[4]; g.linT[1]=(float)gmRun_[5]; g.linT[2]=gmEngaged?1.0f:0.0f; g.linT[3]=0.0f;
|
||||||
if (g_scratch.gmUboPtr[gmSlot]) {
|
if (gmEngaged) {
|
||||||
GMUBO g{};
|
g.app[0]=(float)gmRun_[0]; g.app[1]=(float)gmRun_[1]; g.app[2]=(float)gmRun_[2]; g.app[3]=(float)gmRun_[3];
|
||||||
g.lin[0]=(float)gmRun_[0]; g.lin[1]=(float)gmRun_[1]; g.lin[2]=(float)gmRun_[2]; g.lin[3]=(float)gmRun_[3];
|
g.appT[0]=(float)gmRun_[4]; g.appT[1]=(float)gmRun_[5];
|
||||||
g.linT[0]=(float)gmRun_[4]; g.linT[1]=(float)gmRun_[5]; g.linT[2]=gmEngaged?1.0f:0.0f; g.linT[3]=0.0f;
|
|
||||||
if (gmEngaged) {
|
|
||||||
g.app[0]=(float)gmRun_[0]; g.app[1]=(float)gmRun_[1]; g.app[2]=(float)gmRun_[2]; g.app[3]=(float)gmRun_[3];
|
|
||||||
g.appT[0]=(float)gmRun_[4]; g.appT[1]=(float)gmRun_[5];
|
|
||||||
}
|
|
||||||
std::memcpy(g_scratch.gmUboPtr[gmSlot], &g, sizeof(g));
|
|
||||||
}
|
}
|
||||||
{
|
std::memcpy(g_scratch.gmUboPtr[gmSlot], &g, sizeof(g));
|
||||||
static int lastEng = -1;
|
}
|
||||||
if (gmEngaged != (lastEng == 1) || (gmFrames_ % 300ull) == 0) {
|
{
|
||||||
DDFG_LOGI("C1 global-motion: engaged=%d mode=%d stable=%d transPx=%.1f (model=%d)",
|
static int lastEng = -1;
|
||||||
gmEngaged ? 1 : 0, cfg_.gmMode, gmStableCount_, gmLastTransPx_, cfg_.model);
|
if (gmEngaged != (lastEng == 1) || (gmFrames_ % 300ull) == 0) {
|
||||||
lastEng = gmEngaged ? 1 : 0;
|
WFG_LOGI("C1 global-motion: engaged=%d mode=%d stable=%d transPx=%.1f (model=%d)",
|
||||||
}
|
gmEngaged ? 1 : 0, cfg_.gmMode, gmStableCount_, gmLastTransPx_, cfg_.model);
|
||||||
|
lastEng = gmEngaged ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
wImg(dd_, device_, g_scratch.sLumaCurr, 32, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, currView, linear_, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
|
|
||||||
wImg(dd_, device_, g_scratch.sLumaPrev, 32, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, prevView, linear_, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SynthUBO su{cfg_.flowScale, alpha, cfg_.beta, cfg_.lambda, cfg_.epsilon, cfg_.photoScale, 0, 0,
|
SynthUBO su{cfg_.flowScale, alpha, cfg_.beta, cfg_.lambda, cfg_.epsilon, cfg_.photoScale, 0, 0,
|
||||||
cfg_.hudX0, cfg_.hudY0, cfg_.hudX1, cfg_.hudY1};
|
cfg_.hudX0, cfg_.hudY0, cfg_.hudX1, cfg_.hudY1};
|
||||||
if (g_scratch.synthUboPtr[synthSlot]) std::memcpy(g_scratch.synthUboPtr[synthSlot], &su, sizeof(su));
|
if (g_scratch.synthUboPtr) std::memcpy(g_scratch.synthUboPtr, &su, sizeof(su));
|
||||||
|
|
||||||
const VkDescriptorSet synthSet = g_scratch.sSynth[synthSlot];
|
wImg(dd_, device_, g_scratch.sLumaCurr, 32, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, currView, linear_, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
|
||||||
wImg(dd_, device_, synthSet, 32, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, prevView, linear_, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
|
wImg(dd_, device_, g_scratch.sLumaPrev, 32, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, prevView, linear_, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
|
||||||
wImg(dd_, device_, synthSet, 33, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, currView, linear_, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
|
wImg(dd_, device_, g_scratch.sSynth, 32, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, prevView, linear_, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
|
||||||
wImg(dd_, device_, synthSet, 48, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, outView, VK_NULL_HANDLE, VK_IMAGE_LAYOUT_GENERAL);
|
wImg(dd_, device_, g_scratch.sSynth, 33, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, currView, linear_, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
|
||||||
|
wImg(dd_, device_, g_scratch.sSynth, 48, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, outView, VK_NULL_HANDLE, VK_IMAGE_LAYOUT_GENERAL);
|
||||||
|
|
||||||
auto disp = [&](const Pipe& p, VkDescriptorSet set, VkExtent2D e) {
|
auto disp = [&](const Pipe& p, VkDescriptorSet set, VkExtent2D e) {
|
||||||
dd_->CmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, p.pipeline);
|
dd_->CmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, p.pipeline);
|
||||||
@@ -311,109 +300,106 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur
|
|||||||
};
|
};
|
||||||
auto bar = [&](FrameGen::Img& i){ barrier(cmd, i.image, VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_GENERAL); };
|
auto bar = [&](FrameGen::Img& i){ barrier(cmd, i.image, VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_GENERAL); };
|
||||||
|
|
||||||
if (!reuseFlow) {
|
for (auto& i : pyrA_) barrier(cmd, i.image, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_GENERAL);
|
||||||
for (auto& i : pyrA_) barrier(cmd, i.image, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_GENERAL);
|
for (auto& i : pyrB_) barrier(cmd, i.image, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_GENERAL);
|
||||||
for (auto& i : pyrB_) barrier(cmd, i.image, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_GENERAL);
|
for (int l = flowFinest_; l < kLevels; ++l) barrier(cmd, pyrAs_[l].image, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_GENERAL);
|
||||||
for (int l = flowFinest_; l < kLevels; ++l) barrier(cmd, pyrAs_[l].image, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_GENERAL);
|
barrier(cmd, flowExpA_.image, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_GENERAL);
|
||||||
barrier(cmd, flowExpA_.image, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_GENERAL);
|
barrier(cmd, flowExpB_.image, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_GENERAL);
|
||||||
barrier(cmd, flowExpB_.image, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_GENERAL);
|
barrier(cmd, flowRegA_.image, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_GENERAL);
|
||||||
barrier(cmd, flowRegA_.image, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_GENERAL);
|
barrier(cmd, flowRegB_.image, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_GENERAL);
|
||||||
barrier(cmd, flowRegB_.image, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_GENERAL);
|
{
|
||||||
{
|
VkClearColorValue zero{};
|
||||||
VkClearColorValue zero{};
|
VkImageSubresourceRange rng{VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1};
|
||||||
VkImageSubresourceRange rng{VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1};
|
|
||||||
for (int l = flowFinest_; l < kLevels; ++l) {
|
|
||||||
VkImageMemoryBarrier b{VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER};
|
|
||||||
b.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; b.newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
|
|
||||||
b.srcAccessMask = 0; b.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
|
|
||||||
b.image = flowLvl_[l].image; b.subresourceRange = rng;
|
|
||||||
b.srcQueueFamilyIndex = b.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
|
||||||
dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &b);
|
|
||||||
dd_->CmdClearColorImage(cmd, flowLvl_[l].image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &zero, 1, &rng);
|
|
||||||
b.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; b.newLayout = VK_IMAGE_LAYOUT_GENERAL;
|
|
||||||
b.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; b.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
|
|
||||||
dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, 0, nullptr, 1, &b);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
disp(pLuma_, g_scratch.sLumaCurr, levelExtent(extent_, 0));
|
|
||||||
disp(pLuma_, g_scratch.sLumaPrev, levelExtent(extent_, 0));
|
|
||||||
bar(pyrA_[0]); bar(pyrB_[0]);
|
|
||||||
for (int l = 1; l < kLevels; ++l) {
|
|
||||||
disp(pDown_, g_scratch.sDownA[l - 1], levelExtent(extent_, l));
|
|
||||||
disp(pDown_, g_scratch.sDownB[l - 1], levelExtent(extent_, l));
|
|
||||||
bar(pyrA_[l]); bar(pyrB_[l]);
|
|
||||||
}
|
|
||||||
if (gmBuffersReady_ && g_scratch.sGmReduce[gmSlot]) {
|
|
||||||
dd_->CmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, pGmReduce_.pipeline);
|
|
||||||
dd_->CmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, pGmReduce_.layout, 0, 1, &g_scratch.sGmReduce[gmSlot], 0, nullptr);
|
|
||||||
dd_->CmdDispatch(cmd, (uint32_t)(kGmThreads / 64), 1, 1);
|
|
||||||
VkMemoryBarrier mb{VK_STRUCTURE_TYPE_MEMORY_BARRIER};
|
|
||||||
mb.srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT; mb.dstAccessMask = VK_ACCESS_HOST_READ_BIT;
|
|
||||||
dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_HOST_BIT,
|
|
||||||
0, 1, &mb, 0, nullptr, 0, nullptr);
|
|
||||||
}
|
|
||||||
for (int l = flowFinest_; l < kLevels; ++l) {
|
for (int l = flowFinest_; l < kLevels; ++l) {
|
||||||
disp(pGmPrewarp_, g_scratch.sGmPrewarp[gmSlot][l], levelExtent(extent_, l));
|
VkImageMemoryBarrier b{VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER};
|
||||||
bar(pyrAs_[l]);
|
b.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; b.newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
|
||||||
|
b.srcAccessMask = 0; b.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
|
||||||
|
b.image = flowLvl_[l].image; b.subresourceRange = rng;
|
||||||
|
b.srcQueueFamilyIndex = b.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
||||||
|
dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &b);
|
||||||
|
dd_->CmdClearColorImage(cmd, flowLvl_[l].image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &zero, 1, &rng);
|
||||||
|
b.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; b.newLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||||
|
b.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; b.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
|
||||||
|
dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, 0, nullptr, 1, &b);
|
||||||
}
|
}
|
||||||
for (int l = kLevels - 1; l >= flowFinest_; --l) {
|
|
||||||
disp(flowP, g_scratch.sFlow[l], levelExtent(extent_, l));
|
|
||||||
bar(flowLvl_[l]);
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool frEngaged = (cfg_.frMode != 2) && (cfg_.frIters > 0);
|
|
||||||
if (frEngaged) {
|
|
||||||
const int F = flowFinest_;
|
|
||||||
const VkExtent2D fe = levelExtent(extent_, F);
|
|
||||||
if (g_scratch.flowRegUboPtr) {
|
|
||||||
FlowRegUBO fu{cfg_.frDt, cfg_.frLambda, cfg_.frEdge, cfg_.frEps};
|
|
||||||
std::memcpy(g_scratch.flowRegUboPtr, &fu, sizeof(fu));
|
|
||||||
}
|
|
||||||
FrameGen::Img* last = nullptr;
|
|
||||||
for (int it = 0; it < cfg_.frIters; ++it) {
|
|
||||||
VkDescriptorSet set; FrameGen::Img* outImg;
|
|
||||||
if (it == 0) { set = g_scratch.sFlowReg0; outImg = &flowRegA_; }
|
|
||||||
else if (it % 2 == 1) { set = g_scratch.sFlowRegAB; outImg = &flowRegB_; }
|
|
||||||
else { set = g_scratch.sFlowRegBA; outImg = &flowRegA_; }
|
|
||||||
dd_->CmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, pFlowReg_.pipeline);
|
|
||||||
dd_->CmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, pFlowReg_.layout, 0, 1, &set, 0, nullptr);
|
|
||||||
dd_->CmdDispatch(cmd, (fe.width + 15) / 16, (fe.height + 15) / 16, 1);
|
|
||||||
bar(*outImg);
|
|
||||||
last = outImg;
|
|
||||||
}
|
|
||||||
VkMemoryBarrier mb{VK_STRUCTURE_TYPE_MEMORY_BARRIER};
|
|
||||||
mb.srcAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
|
|
||||||
mb.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT | VK_ACCESS_TRANSFER_WRITE_BIT;
|
|
||||||
dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
|
|
||||||
0, 1, &mb, 0, nullptr, 0, nullptr);
|
|
||||||
VkImageCopy region{};
|
|
||||||
region.srcSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1};
|
|
||||||
region.dstSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1};
|
|
||||||
region.extent = {fe.width, fe.height, 1};
|
|
||||||
dd_->CmdCopyImage(cmd, last->image, VK_IMAGE_LAYOUT_GENERAL,
|
|
||||||
flowLvl_[F].image, VK_IMAGE_LAYOUT_GENERAL, 1, ®ion);
|
|
||||||
VkMemoryBarrier mb2{VK_STRUCTURE_TYPE_MEMORY_BARRIER};
|
|
||||||
mb2.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
|
|
||||||
mb2.dstAccessMask = VK_ACCESS_SHADER_READ_BIT;
|
|
||||||
dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
|
||||||
0, 1, &mb2, 0, nullptr, 0, nullptr);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
static int lastFr = -1;
|
|
||||||
int fe = frEngaged ? 1 : 0;
|
|
||||||
if (fe != lastFr || (gmFrames_ % 300ull) == 0) {
|
|
||||||
DDFG_LOGI("C2 flow-reg: engaged=%d mode=%d iters=%d lambda=%.2f dt=%.2f edge=%.1f eps=%.3f (model=%d)",
|
|
||||||
fe, cfg_.frMode, cfg_.frIters, cfg_.frLambda, cfg_.frDt, cfg_.frEdge, cfg_.frEps, cfg_.model);
|
|
||||||
lastFr = fe;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
disp(expandP, g_scratch.sExpand[gmSlot], levelExtent(extent_, 0));
|
|
||||||
bar(flowExpA_); bar(flowExpB_);
|
|
||||||
g_scratch.flowReady = true;
|
|
||||||
}
|
}
|
||||||
disp(pSynth_, synthSet, levelExtent(extent_, 0));
|
|
||||||
|
disp(pLuma_, g_scratch.sLumaCurr, levelExtent(extent_, 0));
|
||||||
|
disp(pLuma_, g_scratch.sLumaPrev, levelExtent(extent_, 0));
|
||||||
|
bar(pyrA_[0]); bar(pyrB_[0]);
|
||||||
|
for (int l = 1; l < kLevels; ++l) {
|
||||||
|
disp(pDown_, g_scratch.sDownA[l - 1], levelExtent(extent_, l));
|
||||||
|
disp(pDown_, g_scratch.sDownB[l - 1], levelExtent(extent_, l));
|
||||||
|
bar(pyrA_[l]); bar(pyrB_[l]);
|
||||||
|
}
|
||||||
|
if (gmBuffersReady_ && g_scratch.sGmReduce[gmSlot]) {
|
||||||
|
dd_->CmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, pGmReduce_.pipeline);
|
||||||
|
dd_->CmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, pGmReduce_.layout, 0, 1, &g_scratch.sGmReduce[gmSlot], 0, nullptr);
|
||||||
|
dd_->CmdDispatch(cmd, (uint32_t)(kGmThreads / 64), 1, 1);
|
||||||
|
VkMemoryBarrier mb{VK_STRUCTURE_TYPE_MEMORY_BARRIER};
|
||||||
|
mb.srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT; mb.dstAccessMask = VK_ACCESS_HOST_READ_BIT;
|
||||||
|
dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_HOST_BIT,
|
||||||
|
0, 1, &mb, 0, nullptr, 0, nullptr);
|
||||||
|
}
|
||||||
|
for (int l = flowFinest_; l < kLevels; ++l) {
|
||||||
|
disp(pGmPrewarp_, g_scratch.sGmPrewarp[gmSlot][l], levelExtent(extent_, l));
|
||||||
|
bar(pyrAs_[l]);
|
||||||
|
}
|
||||||
|
for (int l = kLevels - 1; l >= flowFinest_; --l) {
|
||||||
|
disp(flowP, g_scratch.sFlow[l], levelExtent(extent_, l));
|
||||||
|
bar(flowLvl_[l]);
|
||||||
|
}
|
||||||
|
|
||||||
|
const bool frEngaged = (cfg_.frMode != 2) && (cfg_.frIters > 0);
|
||||||
|
if (frEngaged) {
|
||||||
|
const int F = flowFinest_;
|
||||||
|
const VkExtent2D fe = levelExtent(extent_, F);
|
||||||
|
if (g_scratch.flowRegUboPtr) {
|
||||||
|
FlowRegUBO fu{cfg_.frDt, cfg_.frLambda, cfg_.frEdge, cfg_.frEps};
|
||||||
|
std::memcpy(g_scratch.flowRegUboPtr, &fu, sizeof(fu));
|
||||||
|
}
|
||||||
|
FrameGen::Img* last = nullptr;
|
||||||
|
for (int it = 0; it < cfg_.frIters; ++it) {
|
||||||
|
VkDescriptorSet set; FrameGen::Img* outImg;
|
||||||
|
if (it == 0) { set = g_scratch.sFlowReg0; outImg = &flowRegA_; }
|
||||||
|
else if (it % 2 == 1) { set = g_scratch.sFlowRegAB; outImg = &flowRegB_; }
|
||||||
|
else { set = g_scratch.sFlowRegBA; outImg = &flowRegA_; }
|
||||||
|
dd_->CmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, pFlowReg_.pipeline);
|
||||||
|
dd_->CmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, pFlowReg_.layout, 0, 1, &set, 0, nullptr);
|
||||||
|
dd_->CmdDispatch(cmd, (fe.width + 15) / 16, (fe.height + 15) / 16, 1);
|
||||||
|
bar(*outImg);
|
||||||
|
last = outImg;
|
||||||
|
}
|
||||||
|
VkMemoryBarrier mb{VK_STRUCTURE_TYPE_MEMORY_BARRIER};
|
||||||
|
mb.srcAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
|
||||||
|
mb.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT | VK_ACCESS_TRANSFER_WRITE_BIT;
|
||||||
|
dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
|
||||||
|
0, 1, &mb, 0, nullptr, 0, nullptr);
|
||||||
|
VkImageCopy region{};
|
||||||
|
region.srcSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1};
|
||||||
|
region.dstSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1};
|
||||||
|
region.extent = {fe.width, fe.height, 1};
|
||||||
|
dd_->CmdCopyImage(cmd, last->image, VK_IMAGE_LAYOUT_GENERAL,
|
||||||
|
flowLvl_[F].image, VK_IMAGE_LAYOUT_GENERAL, 1, ®ion);
|
||||||
|
VkMemoryBarrier mb2{VK_STRUCTURE_TYPE_MEMORY_BARRIER};
|
||||||
|
mb2.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
|
||||||
|
mb2.dstAccessMask = VK_ACCESS_SHADER_READ_BIT;
|
||||||
|
dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||||
|
0, 1, &mb2, 0, nullptr, 0, nullptr);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
static int lastFr = -1;
|
||||||
|
int fe = frEngaged ? 1 : 0;
|
||||||
|
if (fe != lastFr || (gmFrames_ % 300ull) == 0) {
|
||||||
|
WFG_LOGI("C2 flow-reg: engaged=%d mode=%d iters=%d lambda=%.2f dt=%.2f edge=%.1f eps=%.3f (model=%d)",
|
||||||
|
fe, cfg_.frMode, cfg_.frIters, cfg_.frLambda, cfg_.frDt, cfg_.frEdge, cfg_.frEps, cfg_.model);
|
||||||
|
lastFr = fe;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
disp(expandP, g_scratch.sExpand[gmSlot], levelExtent(extent_, 0));
|
||||||
|
bar(flowExpA_); bar(flowExpB_);
|
||||||
|
disp(pSynth_, g_scratch.sSynth, levelExtent(extent_, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ensureScratch(FrameGen* fg, const DeviceDispatch* dd, VkDevice dev,
|
static bool ensureScratch(FrameGen* fg, const DeviceDispatch* dd, VkDevice dev,
|
||||||
@@ -432,8 +418,7 @@ static bool ensureScratch(FrameGen* fg, const DeviceDispatch* dd, VkDevice dev,
|
|||||||
S = ScratchState{};
|
S = ScratchState{};
|
||||||
const auto GEN = VK_IMAGE_LAYOUT_GENERAL;
|
const auto GEN = VK_IMAGE_LAYOUT_GENERAL;
|
||||||
|
|
||||||
for (int s = 0; s < FrameGen::kSynthSlots; ++s)
|
makeUbo(dd, dev, mp, sizeof(SynthUBO), S.synthUbo, S.synthUboMem, S.synthUboPtr);
|
||||||
makeUbo(dd, dev, mp, sizeof(SynthUBO), S.synthUbo[s], S.synthUboMem[s], S.synthUboPtr[s]);
|
|
||||||
makeUbo(dd, dev, mp, sizeof(FlowUBO), S.expandUbo, S.expandUboMem, S.expandUboPtr);
|
makeUbo(dd, dev, mp, sizeof(FlowUBO), S.expandUbo, S.expandUboMem, S.expandUboPtr);
|
||||||
if (S.expandUboPtr) { FlowUBO u{cfg.flowScale, 0, 0.6f, 1.6f}; std::memcpy(S.expandUboPtr, &u, sizeof(u)); }
|
if (S.expandUboPtr) { FlowUBO u{cfg.flowScale, 0, 0.6f, 1.6f}; std::memcpy(S.expandUboPtr, &u, sizeof(u)); }
|
||||||
makeUbo(dd, dev, mp, sizeof(FlowRegUBO), S.flowRegUbo, S.flowRegUboMem, S.flowRegUboPtr);
|
makeUbo(dd, dev, mp, sizeof(FlowRegUBO), S.flowRegUbo, S.flowRegUboMem, S.flowRegUboPtr);
|
||||||
@@ -524,12 +509,10 @@ static bool ensureScratch(FrameGen* fg, const DeviceDispatch* dd, VkDevice dev,
|
|||||||
wImg(dd, dev, S.sFlowRegBA, 48, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, flowRegA.view, VK_NULL_HANDLE, GEN);
|
wImg(dd, dev, S.sFlowRegBA, 48, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, flowRegA.view, VK_NULL_HANDLE, GEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int s = 0; s < FrameGen::kSynthSlots; ++s) {
|
S.sSynth = allocSet(dd, dev, pool, pSynth.setLayout);
|
||||||
S.sSynth[s] = allocSet(dd, dev, pool, pSynth.setLayout);
|
wUbo(dd, dev, S.sSynth, 0, S.synthUbo, sizeof(SynthUBO));
|
||||||
wUbo(dd, dev, S.sSynth[s], 0, S.synthUbo[s], sizeof(SynthUBO));
|
wImg(dd, dev, S.sSynth, 34, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, expA.view, samp, GEN);
|
||||||
wImg(dd, dev, S.sSynth[s], 34, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, expA.view, samp, GEN);
|
wImg(dd, dev, S.sSynth, 35, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, expB.view, samp, GEN);
|
||||||
wImg(dd, dev, S.sSynth[s], 35, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, expB.view, samp, GEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
S.builtFor = ext; S.built = true;
|
S.builtFor = ext; S.built = true;
|
||||||
return true;
|
return true;
|
||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
#include <vulkan/vk_layer.h>
|
#include <vulkan/vk_layer.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
namespace ddfg {
|
namespace winfg {
|
||||||
|
|
||||||
static inline void* dispatch_key(void* handle) { return *reinterpret_cast<void**>(handle); }
|
static inline void* dispatch_key(void* handle) { return *reinterpret_cast<void**>(handle); }
|
||||||
|
|
||||||
+10
-13
@@ -1,10 +1,10 @@
|
|||||||
#include "ddfg_engine.h"
|
#include "winfg_engine.h"
|
||||||
#include "ddfg_vkd.h"
|
#include "winfg_vkd.h"
|
||||||
#include "log.hpp"
|
#include "log.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
namespace ddfg {
|
namespace winfg {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
float alphaFor(uint32_t k, uint32_t n) {
|
float alphaFor(uint32_t k, uint32_t n) {
|
||||||
@@ -31,18 +31,18 @@ Engine::~Engine() { destroyRing(); fg_.destroy(); }
|
|||||||
|
|
||||||
bool Engine::init(const VkTable& table, VkPhysicalDevice phys, VkDevice dev,
|
bool Engine::init(const VkTable& table, VkPhysicalDevice phys, VkDevice dev,
|
||||||
uint32_t queueFamily, VkQueue queue) {
|
uint32_t queueFamily, VkQueue queue) {
|
||||||
if (!ddfgVkdInit(table, dd_, id_)) {
|
if (!winfgVkdInit(table, dd_, id_)) {
|
||||||
DDFG_LOGE("native: dispatch incomplete; frame generation unavailable");
|
WFG_LOGE("native: dispatch incomplete; frame generation unavailable");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
phys_ = phys; dev_ = dev; qf_ = queueFamily; queue_ = queue;
|
phys_ = phys; dev_ = dev; qf_ = queueFamily; queue_ = queue;
|
||||||
id_.GetPhysicalDeviceMemoryProperties(phys_, &memProps_);
|
id_.GetPhysicalDeviceMemoryProperties(phys_, &memProps_);
|
||||||
if (!fg_.init(&dd_, &id_, phys_, dev_, qf_, queue_)) {
|
if (!fg_.init(&dd_, &id_, phys_, dev_, qf_, queue_)) {
|
||||||
DDFG_LOGE("native: FrameGen::init failed");
|
WFG_LOGE("native: FrameGen::init failed");
|
||||||
unavailable_ = true;
|
unavailable_ = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
DDFG_LOGI("native: chain ready (10 pipelines, embedded shaders)");
|
WFG_LOGI("native: chain ready (10 pipelines, embedded shaders)");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ bool Engine::prepare(uint32_t w, uint32_t h, VkFormat fmt) {
|
|||||||
|
|
||||||
|
|
||||||
if (!fg_.onResize(VkExtent2D{w, h}, fmt, false)) {
|
if (!fg_.onResize(VkExtent2D{w, h}, fmt, false)) {
|
||||||
DDFG_LOGE("native: onResize %ux%u failed; frame generation unavailable", w, h);
|
WFG_LOGE("native: onResize %ux%u failed; frame generation unavailable", w, h);
|
||||||
unavailable_ = true;
|
unavailable_ = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -71,13 +71,11 @@ bool Engine::prepare(uint32_t w, uint32_t h, VkFormat fmt) {
|
|||||||
}
|
}
|
||||||
builtW_ = w; builtH_ = h; builtFmt_ = fmt;
|
builtW_ = w; builtH_ = h; builtFmt_ = fmt;
|
||||||
history_ = 0; curr_ = 0; frames_ = 0;
|
history_ = 0; curr_ = 0; frames_ = 0;
|
||||||
DDFG_LOGI("native: built %ux%u fmt=%d model=%d preset=%d flow=%.2f",
|
WFG_LOGI("native: built %ux%u fmt=%d model=%d preset=%d flow=%.2f",
|
||||||
w, h, (int)fmt, cfg_.model, cfg_.perfPreset, (double)cfg_.flowScale);
|
w, h, (int)fmt, cfg_.model, cfg_.perfPreset, (double)cfg_.flowScale);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static_assert(kMaxGenerations <= (uint32_t)FrameGen::kSynthSlots, "each generation needs its own synth slot");
|
|
||||||
|
|
||||||
uint32_t Engine::plan(uint32_t capacity) const {
|
uint32_t Engine::plan(uint32_t capacity) const {
|
||||||
if (!valid() || history_ < 2) return 0;
|
if (!valid() || history_ < 2) return 0;
|
||||||
const uint32_t want = (uint32_t)std::max(cfg_.multiplier - 1, 0);
|
const uint32_t want = (uint32_t)std::max(cfg_.multiplier - 1, 0);
|
||||||
@@ -133,8 +131,7 @@ void Engine::generateInto(VkCommandBuffer cmd, uint32_t generation, uint32_t cou
|
|||||||
dd_.CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TRANSFER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
dd_.CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TRANSFER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||||
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, 0, nullptr, 1, &toWrite);
|
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, 0, nullptr, 1, &toWrite);
|
||||||
|
|
||||||
fg_.record(cmd, prev.view, curr.view, targetView, alphaFor(generation, count), gmSlot_,
|
fg_.record(cmd, prev.view, curr.view, targetView, alphaFor(generation, count), gmSlot_);
|
||||||
generation, generation > 0);
|
|
||||||
if (generation + 1 == count) gmSlot_ = (gmSlot_ + 1) % (uint32_t)FrameGen::kGmSlots;
|
if (generation + 1 == count) gmSlot_ = (gmSlot_ + 1) % (uint32_t)FrameGen::kGmSlots;
|
||||||
|
|
||||||
(void)w; (void)h;
|
(void)w; (void)h;
|
||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
struct VkTable;
|
struct VkTable;
|
||||||
|
|
||||||
namespace ddfg {
|
namespace winfg {
|
||||||
|
|
||||||
constexpr uint32_t kMaxGenerations = 3;
|
constexpr uint32_t kMaxGenerations = 3;
|
||||||
|
|
||||||
+3
-3
@@ -1,14 +1,14 @@
|
|||||||
#include "ddfg_vkd.h"
|
#include "winfg_vkd.h"
|
||||||
#include "../VulkanRendererContext.h"
|
#include "../VulkanRendererContext.h"
|
||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
|
|
||||||
bool ddfgVkdInit(const VkTable& table, ddfg::DeviceDispatch& dd, ddfg::InstanceDispatch& id) {
|
bool winfgVkdInit(const VkTable& table, winfg::DeviceDispatch& dd, winfg::InstanceDispatch& id) {
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
#define COPY(dst, fn) \
|
#define COPY(dst, fn) \
|
||||||
do { \
|
do { \
|
||||||
dst.fn = table.fn; \
|
dst.fn = table.fn; \
|
||||||
if (!dst.fn) { \
|
if (!dst.fn) { \
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "DdFgVkd", \
|
__android_log_print(ANDROID_LOG_ERROR, "WinFgVkd", \
|
||||||
"entry point vk" #fn " did not resolve"); \
|
"entry point vk" #fn " did not resolve"); \
|
||||||
ok = false; \
|
ok = false; \
|
||||||
} \
|
} \
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "vk_dispatch.hpp"
|
||||||
|
struct VkTable;
|
||||||
|
bool winfgVkdInit(const VkTable& table, winfg::DeviceDispatch& dd, winfg::InstanceDispatch& id);
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
#include <errno.h>
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#include <stdatomic.h>
|
#include <stdatomic.h>
|
||||||
#include <sys/syscall.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_com_droiddeck_launcher_input_FakeInputWriter_nativeStoreFence(JNIEnv *env, jclass clazz) {
|
Java_com_droiddeck_launcher_input_FakeInputWriter_nativeStoreFence(JNIEnv *env, jclass clazz) {
|
||||||
@@ -10,10 +7,3 @@ Java_com_droiddeck_launcher_input_FakeInputWriter_nativeStoreFence(JNIEnv *env,
|
|||||||
(void)clazz;
|
(void)clazz;
|
||||||
atomic_thread_fence(memory_order_release);
|
atomic_thread_fence(memory_order_release);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL
|
|
||||||
Java_com_droiddeck_launcher_session_ThreadSignals_tgkill(JNIEnv *env, jclass clazz, jint tgid, jint tid, jint signal) {
|
|
||||||
(void)env;
|
|
||||||
(void)clazz;
|
|
||||||
return syscall(SYS_tgkill, tgid, tid, signal) == 0 ? 0 : errno;
|
|
||||||
}
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
#ifndef DROIDDECK_VENC_PROTO_H
|
|
||||||
#define DROIDDECK_VENC_PROTO_H
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
/* SOCK_SEQPACKET between the guest's Remote Play hooks and the app: the emulated /dev/video-enc0 and
|
|
||||||
* MediaCodec encoder, and remote touches. A config carries the buffer memfds (inputs first) as SCM_RIGHTS;
|
|
||||||
* every frame gets one reply, touches get none. */
|
|
||||||
|
|
||||||
#define VENC_MAX_BUFFERS 16
|
|
||||||
|
|
||||||
enum venc_msg { VENC_CONFIG = 1, VENC_FRAME = 2, VENC_DONE = 3, VENC_BITRATE = 4, VENC_TOUCH = 5 };
|
|
||||||
enum venc_touch_action { VENC_TOUCH_DOWN = 0, VENC_TOUCH_MOVE = 1, VENC_TOUCH_UP = 2 };
|
|
||||||
enum venc_codec { VENC_H264 = 0, VENC_HEVC = 1 };
|
|
||||||
|
|
||||||
struct venc_config {
|
|
||||||
uint32_t type;
|
|
||||||
uint32_t codec;
|
|
||||||
uint32_t width, height, stride, rows;
|
|
||||||
uint32_t fps_num, fps_den;
|
|
||||||
uint32_t bitrate, peak_bitrate, vbr;
|
|
||||||
uint32_t gop;
|
|
||||||
int32_t profile, level;
|
|
||||||
uint32_t inputs, outputs;
|
|
||||||
uint32_t input_size, output_size;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct venc_frame {
|
|
||||||
uint32_t type;
|
|
||||||
uint32_t input, output;
|
|
||||||
uint32_t bytes;
|
|
||||||
uint32_t keyframe;
|
|
||||||
int64_t pts_us;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct venc_done {
|
|
||||||
uint32_t type;
|
|
||||||
int32_t status;
|
|
||||||
uint32_t bytes;
|
|
||||||
uint32_t keyframe;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct venc_bitrate {
|
|
||||||
uint32_t type;
|
|
||||||
uint32_t bitrate;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Remote Play's touch-as-mouse turned back into a touch; x and y are fractions of the screen in 1/65535. */
|
|
||||||
struct venc_touch {
|
|
||||||
uint32_t type;
|
|
||||||
uint32_t action;
|
|
||||||
uint32_t x, y;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,346 +0,0 @@
|
|||||||
#include <android/log.h>
|
|
||||||
#include <dlfcn.h>
|
|
||||||
#include <jni.h>
|
|
||||||
#include <media/NdkMediaCodec.h>
|
|
||||||
#include <media/NdkMediaFormat.h>
|
|
||||||
#include <sys/mman.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/un.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <atomic>
|
|
||||||
#include <cerrno>
|
|
||||||
#include <cstring>
|
|
||||||
#include <string>
|
|
||||||
#include <thread>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "venc_proto.h"
|
|
||||||
|
|
||||||
#define LOG(...) __android_log_print(ANDROID_LOG_INFO, "DroidDeckVenc", __VA_ARGS__)
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
struct Mapping {
|
|
||||||
uint8_t *data = nullptr;
|
|
||||||
size_t size = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr int32_t kColorFormatYuv420SemiPlanar = 21;
|
|
||||||
constexpr uint32_t kBufferFlagKeyFrame = 1;
|
|
||||||
constexpr uint32_t kBufferFlagCodecConfig = 2;
|
|
||||||
constexpr int kTouchWidth = 1920, kTouchHeight = 1080; // InputSpace.kt
|
|
||||||
constexpr int kRemoteTouchId = 31; // the compositor's last touch slot (MAX_TOUCH_POINTS 32)
|
|
||||||
|
|
||||||
int32_t avc_profile(int32_t v4l2) {
|
|
||||||
switch (v4l2) {
|
|
||||||
case 0: return 1;
|
|
||||||
case 1: return 0x10000;
|
|
||||||
case 2: return 2;
|
|
||||||
case 3: return 4;
|
|
||||||
case 4: return 8;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Session {
|
|
||||||
public:
|
|
||||||
explicit Session(int fd) : fd_(fd) {}
|
|
||||||
~Session() {
|
|
||||||
release();
|
|
||||||
close(fd_);
|
|
||||||
}
|
|
||||||
|
|
||||||
void run() {
|
|
||||||
for (;;) {
|
|
||||||
uint8_t buf[256];
|
|
||||||
int fds[VENC_MAX_BUFFERS * 2];
|
|
||||||
int nfds = 0;
|
|
||||||
ssize_t n = receive(buf, sizeof buf, fds, &nfds);
|
|
||||||
if (n <= 0) return;
|
|
||||||
uint32_t type;
|
|
||||||
memcpy(&type, buf, sizeof type);
|
|
||||||
if (type == VENC_CONFIG && n == (ssize_t)sizeof(venc_config)) {
|
|
||||||
venc_config c;
|
|
||||||
memcpy(&c, buf, sizeof c);
|
|
||||||
bool ok = configure(c, fds, nfds);
|
|
||||||
for (int i = 0; i < nfds; i++) close(fds[i]);
|
|
||||||
reply(ok ? 0 : -1, 0, false);
|
|
||||||
} else if (type == VENC_FRAME && n == (ssize_t)sizeof(venc_frame)) {
|
|
||||||
venc_frame f;
|
|
||||||
memcpy(&f, buf, sizeof f);
|
|
||||||
uint32_t bytes = 0;
|
|
||||||
bool key = false;
|
|
||||||
bool ok = encode(f, &bytes, &key);
|
|
||||||
reply(ok ? 0 : -1, bytes, key);
|
|
||||||
} else if (type == VENC_TOUCH && n == (ssize_t)sizeof(venc_touch)) {
|
|
||||||
venc_touch t;
|
|
||||||
memcpy(&t, buf, sizeof t);
|
|
||||||
touch(t);
|
|
||||||
for (int i = 0; i < nfds; i++) close(fds[i]);
|
|
||||||
} else if (type == VENC_BITRATE && n == (ssize_t)sizeof(venc_bitrate)) {
|
|
||||||
venc_bitrate b;
|
|
||||||
memcpy(&b, buf, sizeof b);
|
|
||||||
set_bitrate(b.bitrate);
|
|
||||||
for (int i = 0; i < nfds; i++) close(fds[i]);
|
|
||||||
} else {
|
|
||||||
LOG("unexpected message %u of %zd bytes; closing", type, n);
|
|
||||||
for (int i = 0; i < nfds; i++) close(fds[i]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
ssize_t receive(uint8_t *buf, size_t len, int *fds, int *nfds) {
|
|
||||||
char control[CMSG_SPACE(sizeof(int) * VENC_MAX_BUFFERS * 2)];
|
|
||||||
iovec iov = {buf, len};
|
|
||||||
msghdr m = {};
|
|
||||||
m.msg_iov = &iov;
|
|
||||||
m.msg_iovlen = 1;
|
|
||||||
m.msg_control = control;
|
|
||||||
m.msg_controllen = sizeof control;
|
|
||||||
ssize_t n = recvmsg(fd_, &m, MSG_CMSG_CLOEXEC);
|
|
||||||
for (cmsghdr *c = CMSG_FIRSTHDR(&m); n > 0 && c; c = CMSG_NXTHDR(&m, c)) {
|
|
||||||
if (c->cmsg_level != SOL_SOCKET || c->cmsg_type != SCM_RIGHTS) continue;
|
|
||||||
int count = (int)((c->cmsg_len - CMSG_LEN(0)) / sizeof(int));
|
|
||||||
memcpy(fds, CMSG_DATA(c), sizeof(int) * std::min(count, VENC_MAX_BUFFERS * 2));
|
|
||||||
*nfds = std::min(count, VENC_MAX_BUFFERS * 2);
|
|
||||||
}
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
void reply(int32_t status, uint32_t bytes, bool key) {
|
|
||||||
venc_done d = {VENC_DONE, status, bytes, key ? 1u : 0u};
|
|
||||||
send(fd_, &d, sizeof d, MSG_NOSIGNAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void release() {
|
|
||||||
if (codec_) {
|
|
||||||
AMediaCodec_stop(codec_);
|
|
||||||
AMediaCodec_delete(codec_);
|
|
||||||
codec_ = nullptr;
|
|
||||||
}
|
|
||||||
for (auto &m : inputs_) munmap(m.data, m.size);
|
|
||||||
for (auto &m : outputs_) munmap(m.data, m.size);
|
|
||||||
inputs_.clear();
|
|
||||||
outputs_.clear();
|
|
||||||
header_.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
AMediaCodec *create(const venc_config &c, bool with_profile) {
|
|
||||||
const char *mime = c.codec == VENC_HEVC ? "video/hevc" : "video/avc";
|
|
||||||
AMediaCodec *codec = AMediaCodec_createEncoderByType(mime);
|
|
||||||
if (!codec) return nullptr;
|
|
||||||
float fps = c.fps_num ? (float)c.fps_den / (float)c.fps_num : 60.0f;
|
|
||||||
AMediaFormat *f = AMediaFormat_new();
|
|
||||||
AMediaFormat_setString(f, AMEDIAFORMAT_KEY_MIME, mime);
|
|
||||||
AMediaFormat_setInt32(f, AMEDIAFORMAT_KEY_WIDTH, (int32_t)c.width);
|
|
||||||
AMediaFormat_setInt32(f, AMEDIAFORMAT_KEY_HEIGHT, (int32_t)c.height);
|
|
||||||
AMediaFormat_setInt32(f, AMEDIAFORMAT_KEY_COLOR_FORMAT, kColorFormatYuv420SemiPlanar);
|
|
||||||
AMediaFormat_setInt32(f, AMEDIAFORMAT_KEY_BIT_RATE, (int32_t)std::max(c.bitrate, 500000u));
|
|
||||||
AMediaFormat_setInt32(f, "bitrate-mode", c.vbr ? 1 : 2);
|
|
||||||
AMediaFormat_setFloat(f, AMEDIAFORMAT_KEY_FRAME_RATE, fps);
|
|
||||||
AMediaFormat_setFloat(f, "operating-rate", fps);
|
|
||||||
AMediaFormat_setInt32(f, "priority", 0);
|
|
||||||
AMediaFormat_setInt32(f, "latency", 1);
|
|
||||||
AMediaFormat_setInt32(f, "max-bframes", 0);
|
|
||||||
AMediaFormat_setInt32(f, "prepend-sps-pps-to-idr-frames", 1);
|
|
||||||
float gop_seconds = c.gop && c.gop < 0xffff ? (float)c.gop / fps : 3600.0f;
|
|
||||||
AMediaFormat_setFloat(f, AMEDIAFORMAT_KEY_I_FRAME_INTERVAL, std::max(gop_seconds, 0.1f));
|
|
||||||
if (with_profile) {
|
|
||||||
int32_t profile = c.codec == VENC_HEVC ? (c.profile == 2 ? 2 : 1) : avc_profile(c.profile);
|
|
||||||
if (profile) AMediaFormat_setInt32(f, "profile", profile);
|
|
||||||
}
|
|
||||||
media_status_t s = AMediaCodec_configure(codec, f, nullptr, nullptr, AMEDIACODEC_CONFIGURE_FLAG_ENCODE);
|
|
||||||
AMediaFormat_delete(f);
|
|
||||||
if (s == AMEDIA_OK) s = AMediaCodec_start(codec);
|
|
||||||
if (s != AMEDIA_OK) {
|
|
||||||
AMediaCodec_delete(codec);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
return codec;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool configure(const venc_config &c, const int *fds, int nfds) {
|
|
||||||
release();
|
|
||||||
if (c.inputs + c.outputs != (uint32_t)nfds || c.width < 64 || c.height < 64 || c.stride < c.width ||
|
|
||||||
c.rows < c.height || (uint64_t)c.stride * c.rows * 3 / 2 > c.input_size) {
|
|
||||||
LOG("bad config: %u+%u buffers for %d fds, %ux%u stride %u", c.inputs, c.outputs, nfds, c.width, c.height,
|
|
||||||
c.stride);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (int i = 0; i < nfds; i++) {
|
|
||||||
bool input = (uint32_t)i < c.inputs;
|
|
||||||
size_t size = input ? c.input_size : c.output_size;
|
|
||||||
void *p = mmap(nullptr, size, input ? PROT_READ : PROT_READ | PROT_WRITE, MAP_SHARED, fds[i], 0);
|
|
||||||
if (p == MAP_FAILED) {
|
|
||||||
LOG("could not map buffer %d: %s", i, strerror(errno));
|
|
||||||
release();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
(input ? inputs_ : outputs_).push_back({(uint8_t *)p, size});
|
|
||||||
}
|
|
||||||
codec_ = create(c, true);
|
|
||||||
if (!codec_) codec_ = create(c, false);
|
|
||||||
if (!codec_) {
|
|
||||||
LOG("no %s encoder for %ux%u", c.codec == VENC_HEVC ? "HEVC" : "H.264", c.width, c.height);
|
|
||||||
release();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
config_ = c;
|
|
||||||
dst_stride_ = (int32_t)c.width;
|
|
||||||
dst_rows_ = (int32_t)c.height;
|
|
||||||
using InputFormat = AMediaFormat *(*)(AMediaCodec *);
|
|
||||||
static auto input_format = (InputFormat)dlsym(RTLD_DEFAULT, "AMediaCodec_getInputFormat");
|
|
||||||
if (AMediaFormat *in = input_format ? input_format(codec_) : nullptr) {
|
|
||||||
int32_t v;
|
|
||||||
if (AMediaFormat_getInt32(in, "stride", &v) && v >= (int32_t)c.width) dst_stride_ = v;
|
|
||||||
if (AMediaFormat_getInt32(in, "slice-height", &v) && v >= (int32_t)c.height) dst_rows_ = v;
|
|
||||||
AMediaFormat_delete(in);
|
|
||||||
}
|
|
||||||
LOG("%s %ux%u at %.2f fps, %u kbit/s %s, input stride %d rows %d", c.codec == VENC_HEVC ? "HEVC" : "H.264",
|
|
||||||
c.width, c.height, c.fps_num ? (double)c.fps_den / c.fps_num : 0.0, c.bitrate / 1000,
|
|
||||||
c.vbr ? "VBR" : "CBR", dst_stride_, dst_rows_);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void touch(const venc_touch &t) {
|
|
||||||
using SendTouch = void (*)(int, int, int, int);
|
|
||||||
static SendTouch send_touch = [] {
|
|
||||||
void *wayland = dlopen("libdroiddeckwayland.so", RTLD_NOW | RTLD_NOLOAD);
|
|
||||||
auto fn = wayland ? (SendTouch)dlsym(wayland, "droiddeck_wayland_send_touch") : nullptr;
|
|
||||||
if (!fn) LOG("remote touch unavailable: %s", dlerror());
|
|
||||||
return fn;
|
|
||||||
}();
|
|
||||||
if (!send_touch || t.action > VENC_TOUCH_UP) return;
|
|
||||||
int x = (int)((uint64_t)std::min(t.x, 65535u) * (kTouchWidth - 1) / 65535);
|
|
||||||
int y = (int)((uint64_t)std::min(t.y, 65535u) * (kTouchHeight - 1) / 65535);
|
|
||||||
send_touch((int)t.action, kRemoteTouchId, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_bitrate(uint32_t bitrate) {
|
|
||||||
if (!codec_) return;
|
|
||||||
AMediaFormat *p = AMediaFormat_new();
|
|
||||||
AMediaFormat_setInt32(p, "video-bitrate", (int32_t)std::max(bitrate, 500000u));
|
|
||||||
AMediaCodec_setParameters(codec_, p);
|
|
||||||
AMediaFormat_delete(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool encode(const venc_frame &f, uint32_t *bytes, bool *key) {
|
|
||||||
if (!codec_ || f.input >= inputs_.size() || f.output >= outputs_.size()) return false;
|
|
||||||
if (f.keyframe) {
|
|
||||||
AMediaFormat *p = AMediaFormat_new();
|
|
||||||
AMediaFormat_setInt32(p, "request-sync", 0);
|
|
||||||
AMediaCodec_setParameters(codec_, p);
|
|
||||||
AMediaFormat_delete(p);
|
|
||||||
}
|
|
||||||
ssize_t in = AMediaCodec_dequeueInputBuffer(codec_, 100000);
|
|
||||||
if (in < 0) return false;
|
|
||||||
size_t capacity = 0;
|
|
||||||
uint8_t *dst = AMediaCodec_getInputBuffer(codec_, (size_t)in, &capacity);
|
|
||||||
size_t need = (size_t)dst_stride_ * dst_rows_ + (size_t)dst_stride_ * ((config_.height + 1) / 2);
|
|
||||||
if (!dst || capacity < need) return false;
|
|
||||||
const uint8_t *src = inputs_[f.input].data;
|
|
||||||
for (uint32_t y = 0; y < config_.height; y++)
|
|
||||||
memcpy(dst + (size_t)y * dst_stride_, src + (size_t)y * config_.stride, config_.width);
|
|
||||||
const uint8_t *src_uv = src + (size_t)config_.stride * config_.rows;
|
|
||||||
uint8_t *dst_uv = dst + (size_t)dst_stride_ * dst_rows_;
|
|
||||||
for (uint32_t y = 0; y < (config_.height + 1) / 2; y++)
|
|
||||||
memcpy(dst_uv + (size_t)y * dst_stride_, src_uv + (size_t)y * config_.stride, config_.width);
|
|
||||||
if (AMediaCodec_queueInputBuffer(codec_, (size_t)in, 0, need, (uint64_t)std::max<int64_t>(f.pts_us, 0), 0) !=
|
|
||||||
AMEDIA_OK)
|
|
||||||
return false;
|
|
||||||
Mapping &out = outputs_[f.output];
|
|
||||||
for (int tries = 0; tries < 20; tries++) {
|
|
||||||
AMediaCodecBufferInfo info;
|
|
||||||
ssize_t o = AMediaCodec_dequeueOutputBuffer(codec_, &info, 20000);
|
|
||||||
if (o == AMEDIACODEC_INFO_TRY_AGAIN_LATER || o == AMEDIACODEC_INFO_OUTPUT_FORMAT_CHANGED ||
|
|
||||||
o == AMEDIACODEC_INFO_OUTPUT_BUFFERS_CHANGED)
|
|
||||||
continue;
|
|
||||||
if (o < 0) return false;
|
|
||||||
size_t size = 0;
|
|
||||||
uint8_t *data = AMediaCodec_getOutputBuffer(codec_, (size_t)o, &size);
|
|
||||||
const uint8_t *payload = data ? data + info.offset : nullptr;
|
|
||||||
size_t length = data ? (size_t)info.size : 0;
|
|
||||||
if (info.flags & kBufferFlagCodecConfig) {
|
|
||||||
header_.assign(payload, payload + length);
|
|
||||||
AMediaCodec_releaseOutputBuffer(codec_, (size_t)o, false);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
*key = (info.flags & kBufferFlagKeyFrame) != 0;
|
|
||||||
bool prepend = *key && !header_.empty() &&
|
|
||||||
(length < header_.size() || memcmp(payload, header_.data(), header_.size()) != 0);
|
|
||||||
size_t total = length + (prepend ? header_.size() : 0);
|
|
||||||
bool fits = payload && total <= out.size;
|
|
||||||
if (fits) {
|
|
||||||
if (prepend) memcpy(out.data, header_.data(), header_.size());
|
|
||||||
memcpy(out.data + (prepend ? header_.size() : 0), payload, length);
|
|
||||||
*bytes = (uint32_t)total;
|
|
||||||
}
|
|
||||||
AMediaCodec_releaseOutputBuffer(codec_, (size_t)o, false);
|
|
||||||
return fits;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int fd_;
|
|
||||||
AMediaCodec *codec_ = nullptr;
|
|
||||||
venc_config config_ = {};
|
|
||||||
int32_t dst_stride_ = 0, dst_rows_ = 0;
|
|
||||||
std::vector<Mapping> inputs_, outputs_;
|
|
||||||
std::vector<uint8_t> header_;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::atomic<int> g_listener{-1};
|
|
||||||
|
|
||||||
void serve(int listener) {
|
|
||||||
for (;;) {
|
|
||||||
int fd = accept4(listener, nullptr, nullptr, SOCK_CLOEXEC);
|
|
||||||
if (fd < 0) {
|
|
||||||
if (errno == EINTR) continue;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
std::thread([fd] {
|
|
||||||
Session s(fd);
|
|
||||||
s.run();
|
|
||||||
}).detach();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
extern "C" JNIEXPORT jboolean JNICALL
|
|
||||||
Java_com_droiddeck_launcher_session_VideoEncodeBridge_nativeStart(JNIEnv *env, jobject, jstring jpath) {
|
|
||||||
if (g_listener.load() >= 0) return JNI_TRUE;
|
|
||||||
const char *path = env->GetStringUTFChars(jpath, nullptr);
|
|
||||||
sockaddr_un addr = {};
|
|
||||||
addr.sun_family = AF_UNIX;
|
|
||||||
bool fits = strlen(path) < sizeof addr.sun_path;
|
|
||||||
if (fits) strcpy(addr.sun_path, path);
|
|
||||||
int fd = fits ? socket(AF_UNIX, SOCK_SEQPACKET | SOCK_CLOEXEC, 0) : -1;
|
|
||||||
if (fd >= 0) {
|
|
||||||
unlink(path);
|
|
||||||
if (bind(fd, (sockaddr *)&addr, sizeof addr) != 0 || listen(fd, 4) != 0) {
|
|
||||||
LOG("could not listen on %s: %s", path, strerror(errno));
|
|
||||||
close(fd);
|
|
||||||
fd = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
env->ReleaseStringUTFChars(jpath, path);
|
|
||||||
if (fd < 0) return JNI_FALSE;
|
|
||||||
g_listener.store(fd);
|
|
||||||
std::thread(serve, fd).detach();
|
|
||||||
return JNI_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
|
||||||
Java_com_droiddeck_launcher_session_VideoEncodeBridge_nativeStop(JNIEnv *, jobject) {
|
|
||||||
int fd = g_listener.exchange(-1);
|
|
||||||
if (fd >= 0) {
|
|
||||||
shutdown(fd, SHUT_RDWR);
|
|
||||||
close(fd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -8,7 +8,6 @@ add_library(droiddeckwayland SHARED
|
|||||||
src/sc_layer.c
|
src/sc_layer.c
|
||||||
src/ahb_swapchain.c
|
src/ahb_swapchain.c
|
||||||
src/waylandcomp_jni.c
|
src/waylandcomp_jni.c
|
||||||
src/gpu_clock_pin.c
|
|
||||||
src/droiddeck_ext.c
|
src/droiddeck_ext.c
|
||||||
src/wl_dmabuf.c
|
src/wl_dmabuf.c
|
||||||
src/wl_clipboard.c
|
src/wl_clipboard.c
|
||||||
@@ -44,10 +43,10 @@ target_include_directories(droiddeckwayland PRIVATE
|
|||||||
)
|
)
|
||||||
|
|
||||||
set(DROIDDECK_FRAMEGEN_LSFG_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../framegen/lsfg)
|
set(DROIDDECK_FRAMEGEN_LSFG_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../framegen/lsfg)
|
||||||
set(DROIDDECK_FRAMEGEN_DDFG_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../framegen/ddfg)
|
set(DROIDDECK_FRAMEGEN_WINFG_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../framegen/winfg)
|
||||||
if (TARGET dxbc AND EXISTS ${DROIDDECK_FRAMEGEN_LSFG_DIR}/lsfg_engine.cpp
|
if (TARGET dxbc AND EXISTS ${DROIDDECK_FRAMEGEN_LSFG_DIR}/lsfg_engine.cpp
|
||||||
AND EXISTS ${DROIDDECK_FRAMEGEN_DDFG_DIR}/ddfg_engine.cpp)
|
AND EXISTS ${DROIDDECK_FRAMEGEN_WINFG_DIR}/winfg_engine.cpp)
|
||||||
message(STATUS "droiddeckwayland: frame-generation engines built in (LSFG Native, DD-FG Native)")
|
message(STATUS "droiddeckwayland: frame-generation engines built in (LSFG Native, Win-FG Native)")
|
||||||
target_sources(droiddeckwayland PRIVATE
|
target_sources(droiddeckwayland PRIVATE
|
||||||
src/framegen_engine.cpp
|
src/framegen_engine.cpp
|
||||||
${DROIDDECK_FRAMEGEN_LSFG_DIR}/lsfg_probe.cpp
|
${DROIDDECK_FRAMEGEN_LSFG_DIR}/lsfg_probe.cpp
|
||||||
@@ -67,9 +66,9 @@ if (TARGET dxbc AND EXISTS ${DROIDDECK_FRAMEGEN_LSFG_DIR}/lsfg_engine.cpp
|
|||||||
${DROIDDECK_FRAMEGEN_LSFG_DIR}/lsfg_engine.cpp
|
${DROIDDECK_FRAMEGEN_LSFG_DIR}/lsfg_engine.cpp
|
||||||
${DROIDDECK_FRAMEGEN_LSFG_DIR}/lsfg_governor.cpp
|
${DROIDDECK_FRAMEGEN_LSFG_DIR}/lsfg_governor.cpp
|
||||||
${DROIDDECK_FRAMEGEN_LSFG_DIR}/lsfg_jni.cpp
|
${DROIDDECK_FRAMEGEN_LSFG_DIR}/lsfg_jni.cpp
|
||||||
${DROIDDECK_FRAMEGEN_DDFG_DIR}/framegen.cpp
|
${DROIDDECK_FRAMEGEN_WINFG_DIR}/framegen.cpp
|
||||||
${DROIDDECK_FRAMEGEN_DDFG_DIR}/ddfg_vkd.cpp
|
${DROIDDECK_FRAMEGEN_WINFG_DIR}/winfg_vkd.cpp
|
||||||
${DROIDDECK_FRAMEGEN_DDFG_DIR}/ddfg_engine.cpp
|
${DROIDDECK_FRAMEGEN_WINFG_DIR}/winfg_engine.cpp
|
||||||
)
|
)
|
||||||
target_include_directories(droiddeckwayland PRIVATE
|
target_include_directories(droiddeckwayland PRIVATE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||||
@@ -78,8 +77,8 @@ if (TARGET dxbc AND EXISTS ${DROIDDECK_FRAMEGEN_LSFG_DIR}/lsfg_engine.cpp
|
|||||||
target_compile_options(droiddeckwayland PRIVATE
|
target_compile_options(droiddeckwayland PRIVATE
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:-std=c++17 -fvisibility=hidden>)
|
$<$<COMPILE_LANGUAGE:CXX>:-std=c++17 -fvisibility=hidden>)
|
||||||
target_compile_definitions(droiddeckwayland PRIVATE
|
target_compile_definitions(droiddeckwayland PRIVATE
|
||||||
DDFG_UPSTREAM="${DDFG_UPSTREAM}"
|
WINFG_UPSTREAM="${WINFG_UPSTREAM}"
|
||||||
DDFG_CHAIN_HASH="${DDFG_CHAIN_HASH}"
|
WINFG_CHAIN_HASH="${WINFG_CHAIN_HASH}"
|
||||||
)
|
)
|
||||||
target_link_libraries(droiddeckwayland dxbc atomic)
|
target_link_libraries(droiddeckwayland dxbc atomic)
|
||||||
else()
|
else()
|
||||||
|
|||||||
@@ -218,8 +218,6 @@ struct surface {
|
|||||||
enum surface_role role;
|
enum surface_role role;
|
||||||
struct wl_resource *idle_buffer;
|
struct wl_resource *idle_buffer;
|
||||||
struct wl_listener idle_buffer_destroy;
|
struct wl_listener idle_buffer_destroy;
|
||||||
uint32_t *idle_px;
|
|
||||||
int idle_w, idle_h;
|
|
||||||
struct wl_resource *xdg_surface, *xdg_toplevel;
|
struct wl_resource *xdg_surface, *xdg_toplevel;
|
||||||
struct wl_resource *viewport;
|
struct wl_resource *viewport;
|
||||||
|
|
||||||
@@ -901,30 +899,8 @@ static void cursor_publish_buffer(struct surface *s, struct wl_resource *buffer)
|
|||||||
g_cursor_shown = s;
|
g_cursor_shown = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void surface_forget_idle_px(struct surface *s) {
|
|
||||||
free(s->idle_px);
|
|
||||||
s->idle_px = NULL;
|
|
||||||
s->idle_w = s->idle_h = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void on_idle_buffer_destroyed(struct wl_listener *l, void *data) {
|
static void on_idle_buffer_destroyed(struct wl_listener *l, void *data) {
|
||||||
struct surface *s = wl_container_of(l, s, idle_buffer_destroy);
|
struct surface *s = wl_container_of(l, s, idle_buffer_destroy);
|
||||||
struct wl_shm_buffer *shm = wl_shm_buffer_get(s->idle_buffer);
|
|
||||||
if (shm) {
|
|
||||||
int32_t w = wl_shm_buffer_get_width(shm), h = wl_shm_buffer_get_height(shm);
|
|
||||||
int32_t stride = wl_shm_buffer_get_stride(shm);
|
|
||||||
uint32_t *px = w > 0 && h > 0 && (int64_t)w * h <= CURSOR_MAX_PX && (int64_t)stride >= (int64_t)w * 4
|
|
||||||
? realloc(s->idle_px, (size_t)w * h * 4) : NULL;
|
|
||||||
if (px) {
|
|
||||||
wl_shm_buffer_begin_access(shm);
|
|
||||||
const uint8_t *src = wl_shm_buffer_get_data(shm);
|
|
||||||
for (int y = 0; y < h; y++) memcpy(&px[(size_t)y * w], src + (size_t)y * stride, (size_t)w * 4);
|
|
||||||
wl_shm_buffer_end_access(shm);
|
|
||||||
s->idle_px = px;
|
|
||||||
s->idle_w = w;
|
|
||||||
s->idle_h = h;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
wl_list_remove(&s->idle_buffer_destroy.link);
|
wl_list_remove(&s->idle_buffer_destroy.link);
|
||||||
wl_list_init(&s->idle_buffer_destroy.link);
|
wl_list_init(&s->idle_buffer_destroy.link);
|
||||||
s->idle_buffer = NULL;
|
s->idle_buffer = NULL;
|
||||||
@@ -951,7 +927,6 @@ static struct wl_resource *surface_take_idle(struct surface *s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void surface_drop_idle(struct surface *s) {
|
static void surface_drop_idle(struct surface *s) {
|
||||||
surface_forget_idle_px(s);
|
|
||||||
struct wl_resource *buffer = surface_take_idle(s);
|
struct wl_resource *buffer = surface_take_idle(s);
|
||||||
if (buffer) wl_buffer_send_release(buffer);
|
if (buffer) wl_buffer_send_release(buffer);
|
||||||
}
|
}
|
||||||
@@ -1080,7 +1055,6 @@ static void surface_resource_destroy(struct wl_resource *r) {
|
|||||||
if (g_cursor_surface == s) { g_cursor_surface = NULL; cursor_publish_hidden(); }
|
if (g_cursor_surface == s) { g_cursor_surface = NULL; cursor_publish_hidden(); }
|
||||||
if (g_cursor_shown == s) g_cursor_shown = NULL;
|
if (g_cursor_shown == s) g_cursor_shown = NULL;
|
||||||
surface_take_idle(s);
|
surface_take_idle(s);
|
||||||
surface_forget_idle_px(s);
|
|
||||||
if (g_grab == s) g_grab = NULL;
|
if (g_grab == s) g_grab = NULL;
|
||||||
if (g_key_target == s) g_key_target = NULL;
|
if (g_key_target == s) g_key_target = NULL;
|
||||||
if (g_ime_click == s) g_ime_click = NULL;
|
if (g_ime_click == s) g_ime_click = NULL;
|
||||||
@@ -2068,9 +2042,6 @@ static void pointer_set_cursor(struct wl_client *c, struct wl_resource *r, uint3
|
|||||||
wl_buffer_send_release(buffer);
|
wl_buffer_send_release(buffer);
|
||||||
} else if (g_cursor_shown == s) {
|
} else if (g_cursor_shown == s) {
|
||||||
cursor_publish_shown();
|
cursor_publish_shown();
|
||||||
} else if (s->idle_px) {
|
|
||||||
cursor_publish_pixels((const uint8_t *)s->idle_px, s->idle_w, s->idle_h, (size_t)s->idle_w * 4, hx, hy);
|
|
||||||
g_cursor_shown = s;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void pointer_release(struct wl_client *c, struct wl_resource *r) { wl_resource_destroy(r); }
|
static void pointer_release(struct wl_client *c, struct wl_resource *r) { wl_resource_destroy(r); }
|
||||||
@@ -2622,11 +2593,7 @@ static void pointer_input(double x, double y, int relative, uint32_t button, int
|
|||||||
uint32_t t = now_ms();
|
uint32_t t = now_ms();
|
||||||
|
|
||||||
pointer_focus(target->resource, fx, fy);
|
pointer_focus(target->resource, fx, fy);
|
||||||
// A button-only input must not replay a cached absolute position. A game
|
if (!(k && k->is_lock))
|
||||||
// may have warped its cursor since the last motion (before taking lock,
|
|
||||||
// or while releasing it), so that replay can become an unintended pan.
|
|
||||||
// Absolute touch events still carry their position, including on clicks.
|
|
||||||
if (!(k && k->is_lock) && (!relative || dx != 0 || dy != 0))
|
|
||||||
for_each_pointer_of(client, sp) wl_pointer_send_motion(sp->ptr, t, fx, fy);
|
for_each_pointer_of(client, sp) wl_pointer_send_motion(sp->ptr, t, fx, fy);
|
||||||
send_relative_motion(client, dx, dy);
|
send_relative_motion(client, dx, dy);
|
||||||
for_each_pointer_of(client, sp) {
|
for_each_pointer_of(client, sp) {
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ static int64_t now_ns(void) {
|
|||||||
|
|
||||||
|
|
||||||
void vkp_framegen_set_engine(int kind) {
|
void vkp_framegen_set_engine(int kind) {
|
||||||
if (kind != VKP_FG_ENGINE_LSFG && kind != VKP_FG_ENGINE_DDFG) kind = VKP_FG_ENGINE_LSFG;
|
if (kind != VKP_FG_ENGINE_LSFG && kind != VKP_FG_ENGINE_WINFG) kind = VKP_FG_ENGINE_LSFG;
|
||||||
atomic_store(&g_kind, kind);
|
atomic_store(&g_kind, kind);
|
||||||
atomic_store(&g_failed_kind, -1);
|
atomic_store(&g_failed_kind, -1);
|
||||||
atomic_store(&g_cfg_dirty, 1);
|
atomic_store(&g_cfg_dirty, 1);
|
||||||
@@ -125,7 +125,7 @@ void vkp_framegen_set_tuning(float flow_scale, float refresh_hz) {
|
|||||||
atomic_store(&g_cfg_dirty, 1);
|
atomic_store(&g_cfg_dirty, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void vkp_framegen_set_ddfg_tuning(int model, int perf_preset) {
|
void vkp_framegen_set_winfg_tuning(int model, int perf_preset) {
|
||||||
atomic_store(&g_model, model == 3 ? 3 : 4);
|
atomic_store(&g_model, model == 3 ? 3 : 4);
|
||||||
atomic_store(&g_preset, perf_preset < 0 ? 0 : perf_preset > 2 ? 2 : perf_preset);
|
atomic_store(&g_preset, perf_preset < 0 ? 0 : perf_preset > 2 ? 2 : perf_preset);
|
||||||
atomic_store(&g_cfg_dirty, 1);
|
atomic_store(&g_cfg_dirty, 1);
|
||||||
@@ -180,9 +180,9 @@ void vkp_framegen_device_ready(VkDevice dev, VkQueue queue, uint32_t qfam, int f
|
|||||||
g_vk.GetPhysicalDeviceMemoryProperties(g_pd, &g_memprops);
|
g_vk.GetPhysicalDeviceMemoryProperties(g_pd, &g_memprops);
|
||||||
fge_device_ready(g_gipa, g_inst, g_pd, dev, queue, qfam, features_enabled);
|
fge_device_ready(g_gipa, g_inst, g_pd, dev, queue, qfam, features_enabled);
|
||||||
g_dev_ready = vk.CreateImage && vk.CreateImageView && vk.CmdPipelineBarrier;
|
g_dev_ready = vk.CreateImage && vk.CreateImageView && vk.CmdPipelineBarrier;
|
||||||
FGLOG("engines ready on the compositor's device: LSFG Native %s (%s), DD-FG Native %s",
|
FGLOG("engines ready on the compositor's device: LSFG Native %s (%s), Win-FG Native %s",
|
||||||
fge_caps_ok(VKP_FG_ENGINE_LSFG) ? "available" : "unavailable", fge_caps_reason(),
|
fge_caps_ok(VKP_FG_ENGINE_LSFG) ? "available" : "unavailable", fge_caps_reason(),
|
||||||
fge_caps_ok(VKP_FG_ENGINE_DDFG) ? "available" : "unavailable");
|
fge_caps_ok(VKP_FG_ENGINE_WINFG) ? "available" : "unavailable");
|
||||||
}
|
}
|
||||||
|
|
||||||
void vkp_framegen_device_lost(void) { g_dev_lost = 1; }
|
void vkp_framegen_device_lost(void) { g_dev_lost = 1; }
|
||||||
@@ -238,7 +238,7 @@ static int ensure_ring(uint32_t w, uint32_t h, VkFormat fmt, uint32_t n) {
|
|||||||
}
|
}
|
||||||
g_ring_w = w; g_ring_h = h; g_ring_fmt = fmt;
|
g_ring_w = w; g_ring_h = h; g_ring_fmt = fmt;
|
||||||
LOGD("framegen: generation ring %ux%u x%u", w, h, n);
|
LOGD("framegen: generation ring %ux%u x%u", w, h, n);
|
||||||
return 2;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -350,7 +350,6 @@ int vkp_framegen_run(VkCommandBuffer cmd, VkImage scene, VkImageView scene_view,
|
|||||||
fge_configure((uint32_t)mult, (uint32_t)atomic_load(&g_target), flow, hz,
|
fge_configure((uint32_t)mult, (uint32_t)atomic_load(&g_target), flow, hz,
|
||||||
atomic_load(&g_model), atomic_load(&g_preset));
|
atomic_load(&g_model), atomic_load(&g_preset));
|
||||||
}
|
}
|
||||||
const int size_changed = g_built_w != (uint32_t)w || g_built_h != (uint32_t)h || g_built_fmt != fmt;
|
|
||||||
if (!fge_prepare((uint32_t)w, (uint32_t)h, fmt)) {
|
if (!fge_prepare((uint32_t)w, (uint32_t)h, fmt)) {
|
||||||
if (fmt != VK_FORMAT_R8G8B8A8_UNORM && fge_unavailable()) {
|
if (fmt != VK_FORMAT_R8G8B8A8_UNORM && fge_unavailable()) {
|
||||||
refuse_format(fmt, kind, w, h, "build its chain");
|
refuse_format(fmt, kind, w, h, "build its chain");
|
||||||
@@ -362,25 +361,17 @@ int vkp_framegen_run(VkCommandBuffer cmd, VkImage scene, VkImageView scene_view,
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (size_changed) {
|
if (g_built_w != (uint32_t)w || g_built_h != (uint32_t)h || g_built_fmt != fmt) {
|
||||||
g_built_w = (uint32_t)w; g_built_h = (uint32_t)h; g_built_fmt = fmt;
|
g_built_w = (uint32_t)w; g_built_h = (uint32_t)h; g_built_fmt = fmt;
|
||||||
g_generating_logged = 0;
|
g_generating_logged = 0;
|
||||||
}
|
}
|
||||||
uint32_t want = (uint32_t)(mult - 1);
|
uint32_t want = (uint32_t)(mult - 1);
|
||||||
const int ring = ensure_ring((uint32_t)w, (uint32_t)h, fmt, want);
|
if (!ensure_ring((uint32_t)w, (uint32_t)h, fmt, want)) {
|
||||||
if (!ring) {
|
|
||||||
if (fmt != VK_FORMAT_R8G8B8A8_UNORM) { refuse_format(fmt, kind, w, h, "make its generation ring"); return 0; }
|
if (fmt != VK_FORMAT_R8G8B8A8_UNORM) { refuse_format(fmt, kind, w, h, "make its generation ring"); return 0; }
|
||||||
FGLOG("no memory for the generation ring (%dx%d x%u); frame generation stays off", w, h, want);
|
FGLOG("no memory for the generation ring (%dx%d x%u); frame generation stays off", w, h, want);
|
||||||
mark_failed(kind);
|
mark_failed(kind);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* The ring and the engine's images are new on this frame. Dispatching into them now
|
|
||||||
* null-dereferenced Turnip (vkp_framegen_run, first Steam frame, 2560x1440 to the panel).
|
|
||||||
* Show this frame as it is; generation starts once the size has settled. */
|
|
||||||
if (size_changed || ring == 2) {
|
|
||||||
FGLOG("frame generation catches up at %dx%d; this frame is shown as it is", w, h);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The pacer's source rate must be the game's, not this loop's: a loop slowed by its own
|
/* The pacer's source rate must be the game's, not this loop's: a loop slowed by its own
|
||||||
* generations would otherwise read as a slower game and justify even more generations. */
|
* generations would otherwise read as a slower game and justify even more generations. */
|
||||||
|
|||||||
@@ -6,14 +6,14 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
|
|
||||||
enum { VKP_FG_ENGINE_LSFG = 0, VKP_FG_ENGINE_DDFG = 1 };
|
enum { VKP_FG_ENGINE_LSFG = 0, VKP_FG_ENGINE_WINFG = 1 };
|
||||||
#define VKP_FG_MAX_GENERATIONS 3
|
#define VKP_FG_MAX_GENERATIONS 3
|
||||||
|
|
||||||
void vkp_framegen_set_engine(int kind);
|
void vkp_framegen_set_engine(int kind);
|
||||||
void vkp_framegen_set_armed(int armed, int multiplier, int target_fps);
|
void vkp_framegen_set_armed(int armed, int multiplier, int target_fps);
|
||||||
void vkp_framegen_set_lsfg_cache_path(const char *path);
|
void vkp_framegen_set_lsfg_cache_path(const char *path);
|
||||||
void vkp_framegen_set_tuning(float flow_scale, float refresh_hz);
|
void vkp_framegen_set_tuning(float flow_scale, float refresh_hz);
|
||||||
void vkp_framegen_set_ddfg_tuning(int model, int perf_preset);
|
void vkp_framegen_set_winfg_tuning(int model, int perf_preset);
|
||||||
int vkp_framegen_problem(void);
|
int vkp_framegen_problem(void);
|
||||||
const char *vkp_framegen_caps_reason(void);
|
const char *vkp_framegen_caps_reason(void);
|
||||||
void vkp_framegen_stats(float out[6]);
|
void vkp_framegen_stats(float out[6]);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#include "lsfg/lsfg_engine.h"
|
#include "lsfg/lsfg_engine.h"
|
||||||
#include "lsfg/lsfg_probe.h"
|
#include "lsfg/lsfg_probe.h"
|
||||||
#include "lsfg/lsfg_vkd.h"
|
#include "lsfg/lsfg_vkd.h"
|
||||||
#include "ddfg/ddfg_engine.h"
|
#include "winfg/winfg_engine.h"
|
||||||
|
|
||||||
#define ELOG(...) __android_log_print(ANDROID_LOG_INFO, "DroidDeckWayland", "framegen: " __VA_ARGS__)
|
#define ELOG(...) __android_log_print(ANDROID_LOG_INFO, "DroidDeckWayland", "framegen: " __VA_ARGS__)
|
||||||
#define ELOGE(...) __android_log_print(ANDROID_LOG_ERROR, "DroidDeckWayland", "framegen: " __VA_ARGS__)
|
#define ELOGE(...) __android_log_print(ANDROID_LOG_ERROR, "DroidDeckWayland", "framegen: " __VA_ARGS__)
|
||||||
@@ -30,7 +30,7 @@ uint32_t g_qfam = 0;
|
|||||||
bool g_probed = false, g_ready = false;
|
bool g_probed = false, g_ready = false;
|
||||||
|
|
||||||
std::unique_ptr<lsfg::Engine> g_lsfg;
|
std::unique_ptr<lsfg::Engine> g_lsfg;
|
||||||
std::unique_ptr<ddfg::Engine> g_ddfg;
|
std::unique_ptr<winfg::Engine> g_winfg;
|
||||||
int g_kind = -1;
|
int g_kind = -1;
|
||||||
char g_build[96] = "";
|
char g_build[96] = "";
|
||||||
|
|
||||||
@@ -143,15 +143,15 @@ int fge_start(int kind, const char *cache_path) {
|
|||||||
fge_stop();
|
fge_stop();
|
||||||
if (!g_ready) return -1;
|
if (!g_ready) return -1;
|
||||||
if (kind == 1) {
|
if (kind == 1) {
|
||||||
auto e = std::make_unique<ddfg::Engine>();
|
auto e = std::make_unique<winfg::Engine>();
|
||||||
if (!e->init(g_table, g_pd, g_dev, g_qfam, g_queue)) {
|
if (!e->init(g_table, g_pd, g_dev, g_qfam, g_queue)) {
|
||||||
ELOGE("ddfg-native: engine init failed");
|
ELOGE("winfg-native: engine init failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
g_ddfg = std::move(e);
|
g_winfg = std::move(e);
|
||||||
g_kind = 1;
|
g_kind = 1;
|
||||||
#if defined(DDFG_UPSTREAM) && defined(DDFG_CHAIN_HASH)
|
#if defined(WINFG_UPSTREAM) && defined(WINFG_CHAIN_HASH)
|
||||||
std::snprintf(g_build, sizeof(g_build), "chain %s, src %s", DDFG_UPSTREAM, DDFG_CHAIN_HASH);
|
std::snprintf(g_build, sizeof(g_build), "chain %s, src %s", WINFG_UPSTREAM, WINFG_CHAIN_HASH);
|
||||||
#else
|
#else
|
||||||
std::snprintf(g_build, sizeof(g_build), "embedded chain");
|
std::snprintf(g_build, sizeof(g_build), "embedded chain");
|
||||||
#endif
|
#endif
|
||||||
@@ -176,46 +176,46 @@ int fge_start(int kind, const char *cache_path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void fge_stop(void) {
|
void fge_stop(void) {
|
||||||
if ((g_lsfg || g_ddfg) && g_table.DeviceWaitIdle && g_dev) g_table.DeviceWaitIdle(g_dev);
|
if ((g_lsfg || g_winfg) && g_table.DeviceWaitIdle && g_dev) g_table.DeviceWaitIdle(g_dev);
|
||||||
g_lsfg.reset();
|
g_lsfg.reset();
|
||||||
g_ddfg.reset();
|
g_winfg.reset();
|
||||||
g_kind = -1;
|
g_kind = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fge_unavailable(void) {
|
int fge_unavailable(void) {
|
||||||
if (g_kind == 1) return g_ddfg && g_ddfg->unavailable() ? 1 : 0;
|
if (g_kind == 1) return g_winfg && g_winfg->unavailable() ? 1 : 0;
|
||||||
return g_lsfg && g_lsfg->unavailable() ? 1 : 0;
|
return g_lsfg && g_lsfg->unavailable() ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fge_configure(uint32_t multiplier, uint32_t target_fps, float flow_scale, float refresh_hz,
|
void fge_configure(uint32_t multiplier, uint32_t target_fps, float flow_scale, float refresh_hz,
|
||||||
int model, int perf_preset) {
|
int model, int perf_preset) {
|
||||||
if (multiplier < 2) multiplier = 2;
|
if (multiplier < 2) multiplier = 2;
|
||||||
if (g_kind == 1 && g_ddfg) g_ddfg->configure(multiplier, model, perf_preset, flow_scale);
|
if (g_kind == 1 && g_winfg) g_winfg->configure(multiplier, model, perf_preset, flow_scale);
|
||||||
else if (g_lsfg) g_lsfg->configure(multiplier, target_fps, flow_scale, refresh_hz);
|
else if (g_lsfg) g_lsfg->configure(multiplier, target_fps, flow_scale, refresh_hz);
|
||||||
}
|
}
|
||||||
|
|
||||||
int fge_prepare(uint32_t w, uint32_t h, VkFormat fmt) {
|
int fge_prepare(uint32_t w, uint32_t h, VkFormat fmt) {
|
||||||
if (g_kind == 1) return g_ddfg && g_ddfg->prepare(w, h, fmt) ? 1 : 0;
|
if (g_kind == 1) return g_winfg && g_winfg->prepare(w, h, fmt) ? 1 : 0;
|
||||||
if (!g_lsfg) return 0;
|
if (!g_lsfg) return 0;
|
||||||
g_lsfg->setGuestExtent(w, h);
|
g_lsfg->setGuestExtent(w, h);
|
||||||
return g_lsfg->prepare(w, h, fmt) ? 1 : 0;
|
return g_lsfg->prepare(w, h, fmt) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t fge_plan(uint32_t capacity, uint64_t source_frames, float presented_rate) {
|
uint32_t fge_plan(uint32_t capacity, uint64_t source_frames, float presented_rate) {
|
||||||
if (g_kind == 1) return g_ddfg ? g_ddfg->plan(capacity) : 0;
|
if (g_kind == 1) return g_winfg ? g_winfg->plan(capacity) : 0;
|
||||||
if (!g_lsfg) return 0;
|
if (!g_lsfg) return 0;
|
||||||
g_lsfg->setPresentedRate(presented_rate);
|
g_lsfg->setPresentedRate(presented_rate);
|
||||||
return g_lsfg->plan(capacity, source_frames);
|
return g_lsfg->plan(capacity, source_frames);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fge_process(VkCommandBuffer cmd, VkImage source, uint32_t w, uint32_t h, uint32_t gens) {
|
void fge_process(VkCommandBuffer cmd, VkImage source, uint32_t w, uint32_t h, uint32_t gens) {
|
||||||
if (g_kind == 1) { if (g_ddfg) g_ddfg->process(cmd, source, w, h, gens); return; }
|
if (g_kind == 1) { if (g_winfg) g_winfg->process(cmd, source, w, h, gens); return; }
|
||||||
if (g_lsfg) g_lsfg->process(cmd, source, w, h, gens);
|
if (g_lsfg) g_lsfg->process(cmd, source, w, h, gens);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fge_generate(VkCommandBuffer cmd, uint32_t g, uint32_t count, VkImage img, VkImageView view,
|
void fge_generate(VkCommandBuffer cmd, uint32_t g, uint32_t count, VkImage img, VkImageView view,
|
||||||
uint32_t w, uint32_t h) {
|
uint32_t w, uint32_t h) {
|
||||||
if (g_kind == 1) { if (g_ddfg) g_ddfg->generateInto(cmd, g, count, img, view, w, h); return; }
|
if (g_kind == 1) { if (g_winfg) g_winfg->generateInto(cmd, g, count, img, view, w, h); return; }
|
||||||
if (g_lsfg) g_lsfg->generateInto(cmd, g, g, img, view, w, h);
|
if (g_lsfg) g_lsfg->generateInto(cmd, g, g, img, view, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,7 +232,7 @@ void fge_telemetry(float *accepted, float *source_rate, float *thermal) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *fge_engine_name(int kind) { return kind == 1 ? "DD-FG Native" : "LSFG Native"; }
|
const char *fge_engine_name(int kind) { return kind == 1 ? "Win-FG Native" : "LSFG Native"; }
|
||||||
const char *fge_build_info(void) { return g_build; }
|
const char *fge_build_info(void) { return g_build; }
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -34,5 +34,5 @@ void fge_forget_targets(void) {}
|
|||||||
void fge_telemetry(float *accepted, float *source_rate, float *thermal) {
|
void fge_telemetry(float *accepted, float *source_rate, float *thermal) {
|
||||||
*accepted = 0.0f; *source_rate = 0.0f; *thermal = -1.0f;
|
*accepted = 0.0f; *source_rate = 0.0f; *thermal = -1.0f;
|
||||||
}
|
}
|
||||||
const char *fge_engine_name(int kind) { return kind == 1 ? "DD-FG Native" : "LSFG Native"; }
|
const char *fge_engine_name(int kind) { return kind == 1 ? "Win-FG Native" : "LSFG Native"; }
|
||||||
const char *fge_build_info(void) { return "stub"; }
|
const char *fge_build_info(void) { return "stub"; }
|
||||||
@@ -31,10 +31,10 @@ Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetFrameGenTuning(JN
|
|||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetDdFgTuning(JNIEnv *env, jclass clazz,
|
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetWinFgTuning(JNIEnv *env, jclass clazz,
|
||||||
jint model, jint perfPreset) {
|
jint model, jint perfPreset) {
|
||||||
(void)env; (void)clazz;
|
(void)env; (void)clazz;
|
||||||
vkp_framegen_set_ddfg_tuning((int)model, (int)perfPreset);
|
vkp_framegen_set_winfg_tuning((int)model, (int)perfPreset);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL
|
JNIEXPORT jint JNICALL
|
||||||
|
|||||||
@@ -1,170 +0,0 @@
|
|||||||
#include "gpu_clock_pin.h"
|
|
||||||
|
|
||||||
#include <android/log.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <pthread.h>
|
|
||||||
#include <stdatomic.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <sys/mman.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include "../../adrenotools/src/hook/kgsl.h"
|
|
||||||
|
|
||||||
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
|
|
||||||
static pthread_t worker;
|
|
||||||
static bool joinable;
|
|
||||||
static atomic_bool running;
|
|
||||||
|
|
||||||
struct pin {
|
|
||||||
int fd;
|
|
||||||
unsigned int context;
|
|
||||||
unsigned int memory;
|
|
||||||
unsigned int timestamp;
|
|
||||||
unsigned long gpuaddr;
|
|
||||||
uint32_t nop;
|
|
||||||
void *commands;
|
|
||||||
size_t size;
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct pin pin = { .fd = -1 };
|
|
||||||
|
|
||||||
static void release_pin(void) {
|
|
||||||
if (pin.context) {
|
|
||||||
struct kgsl_drawctxt_destroy destroy = { .drawctxt_id = pin.context };
|
|
||||||
ioctl(pin.fd, IOCTL_KGSL_DRAWCTXT_DESTROY, &destroy);
|
|
||||||
}
|
|
||||||
if (pin.commands) munmap(pin.commands, pin.size);
|
|
||||||
if (pin.memory) {
|
|
||||||
struct kgsl_gpumem_free_id free_memory = { .id = pin.memory };
|
|
||||||
ioctl(pin.fd, IOCTL_KGSL_GPUMEM_FREE_ID, &free_memory);
|
|
||||||
}
|
|
||||||
if (pin.fd >= 0) close(pin.fd);
|
|
||||||
pin = (struct pin) { .fd = -1 };
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool submit_pin(void) {
|
|
||||||
struct kgsl_command_object object = {
|
|
||||||
.gpuaddr = pin.gpuaddr,
|
|
||||||
.size = 2 * sizeof(uint32_t),
|
|
||||||
.flags = KGSL_CMDLIST_IB,
|
|
||||||
.id = pin.memory,
|
|
||||||
};
|
|
||||||
struct kgsl_gpu_command command = {
|
|
||||||
.flags = KGSL_CMDBATCH_PWR_CONSTRAINT,
|
|
||||||
.cmdlist = (uintptr_t)&object,
|
|
||||||
.cmdsize = sizeof(object),
|
|
||||||
.numcmds = 1,
|
|
||||||
.context_id = pin.context,
|
|
||||||
};
|
|
||||||
if (ioctl(pin.fd, IOCTL_KGSL_GPU_COMMAND, &command) < 0) return false;
|
|
||||||
pin.timestamp = command.timestamp;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool prepare_pin(void) {
|
|
||||||
pin.fd = open("/dev/kgsl-3d0", O_RDWR | O_CLOEXEC);
|
|
||||||
if (pin.fd < 0) return false;
|
|
||||||
struct kgsl_devinfo info = {0};
|
|
||||||
struct kgsl_device_getproperty device_info = {
|
|
||||||
.type = KGSL_PROP_DEVICE_INFO, .value = &info, .sizebytes = sizeof(info),
|
|
||||||
};
|
|
||||||
if (ioctl(pin.fd, IOCTL_KGSL_DEVICE_GETPROPERTY, &device_info) < 0) return false;
|
|
||||||
unsigned int core = info.chip_id >> 24;
|
|
||||||
if (!core) core = info.gpu_id / 100;
|
|
||||||
if (core < 3) { errno = ENODEV; return false; }
|
|
||||||
pin.nop = core >= 5 ? 0x70100001 : 0xc0001000;
|
|
||||||
struct kgsl_drawctxt_create context = {
|
|
||||||
.flags = KGSL_CONTEXT_NO_GMEM_ALLOC | KGSL_CONTEXT_PREAMBLE | KGSL_CONTEXT_PWR_CONSTRAINT,
|
|
||||||
};
|
|
||||||
if (ioctl(pin.fd, IOCTL_KGSL_DRAWCTXT_CREATE, &context) < 0) return false;
|
|
||||||
pin.context = context.drawctxt_id;
|
|
||||||
struct kgsl_device_constraint_pwrlevel level = { .level = KGSL_CONSTRAINT_PWR_MAX };
|
|
||||||
struct kgsl_device_constraint constraint = {
|
|
||||||
.type = KGSL_CONSTRAINT_PWRLEVEL,
|
|
||||||
.context_id = pin.context,
|
|
||||||
.data = &level,
|
|
||||||
.size = sizeof(level),
|
|
||||||
};
|
|
||||||
struct kgsl_device_getproperty property = {
|
|
||||||
.type = KGSL_PROP_PWR_CONSTRAINT,
|
|
||||||
.value = &constraint,
|
|
||||||
.sizebytes = sizeof(constraint),
|
|
||||||
};
|
|
||||||
if (ioctl(pin.fd, IOCTL_KGSL_SETPROPERTY, &property) < 0) return false;
|
|
||||||
struct kgsl_gpumem_alloc_id memory = { .size = 4096 };
|
|
||||||
if (ioctl(pin.fd, IOCTL_KGSL_GPUMEM_ALLOC_ID, &memory) < 0) return false;
|
|
||||||
pin.memory = memory.id;
|
|
||||||
pin.gpuaddr = memory.gpuaddr;
|
|
||||||
pin.size = memory.mmapsize;
|
|
||||||
void *commands = mmap(NULL, pin.size, PROT_READ | PROT_WRITE, MAP_SHARED, pin.fd,
|
|
||||||
(off_t)pin.memory << 12);
|
|
||||||
if (commands == MAP_FAILED) return false;
|
|
||||||
pin.commands = commands;
|
|
||||||
// A3xx/A4xx use type-3 CP_NOP; newer cores use type-7 with zero odd-parity bits.
|
|
||||||
uint32_t *words = commands;
|
|
||||||
words[0] = pin.nop;
|
|
||||||
words[1] = 0;
|
|
||||||
struct kgsl_gpumem_sync_cache sync = { .id = pin.memory, .op = KGSL_GPUMEM_CACHE_CLEAN };
|
|
||||||
if (ioctl(pin.fd, IOCTL_KGSL_GPUMEM_SYNC_CACHE, &sync) < 0) return false;
|
|
||||||
return submit_pin();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void *hold_pin(void *unused) {
|
|
||||||
(void)unused;
|
|
||||||
while (atomic_load(&running)) {
|
|
||||||
struct kgsl_device_waittimestamp_ctxtid wait = {
|
|
||||||
.context_id = pin.context,
|
|
||||||
.timestamp = pin.timestamp,
|
|
||||||
.timeout = 100,
|
|
||||||
};
|
|
||||||
if (ioctl(pin.fd, IOCTL_KGSL_DEVICE_WAITTIMESTAMP_CTXTID, &wait) < 0) {
|
|
||||||
if (errno == EINTR || errno == ETIMEDOUT) continue;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// Constraints expire after idle_timer (normally 80 ms); renew with a NOP, keeping devfreq alive.
|
|
||||||
usleep(25000);
|
|
||||||
if (atomic_load(&running) && !submit_pin()) break;
|
|
||||||
}
|
|
||||||
if (atomic_exchange(&running, false))
|
|
||||||
__android_log_print(ANDROID_LOG_WARN, "GpuClockPin", "constraint stopped: %s", strerror(errno));
|
|
||||||
release_pin();
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool gpu_clock_pin_set(bool on) {
|
|
||||||
pthread_mutex_lock(&lock);
|
|
||||||
if (joinable) {
|
|
||||||
if (on && atomic_load(&running)) {
|
|
||||||
pthread_mutex_unlock(&lock);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
atomic_store(&running, false);
|
|
||||||
pthread_join(worker, NULL);
|
|
||||||
joinable = false;
|
|
||||||
}
|
|
||||||
bool ok = true;
|
|
||||||
if (on) {
|
|
||||||
ok = prepare_pin();
|
|
||||||
if (ok) {
|
|
||||||
atomic_store(&running, true);
|
|
||||||
int error = pthread_create(&worker, NULL, hold_pin, NULL);
|
|
||||||
if (error) {
|
|
||||||
atomic_store(&running, false);
|
|
||||||
errno = error;
|
|
||||||
ok = false;
|
|
||||||
} else {
|
|
||||||
joinable = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!ok) {
|
|
||||||
int error = errno;
|
|
||||||
release_pin();
|
|
||||||
errno = error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pthread_mutex_unlock(&lock);
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
bool gpu_clock_pin_set(bool on);
|
|
||||||
@@ -1626,10 +1626,6 @@ 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;
|
VkImageLayout result_layout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
|
||||||
if (fx) {
|
if (fx) {
|
||||||
int mapped_w = (int)(scene_w * g_map.kx + 0.5f), mapped_h = (int)(scene_h * g_map.ky + 0.5f);
|
int mapped_w = (int)(scene_w * g_map.kx + 0.5f), mapped_h = (int)(scene_h * g_map.ky + 0.5f);
|
||||||
/* Frame generation samples every output pixel. Upscaling first made it interpolate
|
|
||||||
* the whole panel (3200x1440 on a 1440p phone) and rebuild on Steam's first frame.
|
|
||||||
* Grade at the game's size instead; the screen blit still scales to the panel. */
|
|
||||||
if (fg) { mapped_w = scene_w; mapped_h = scene_h; }
|
|
||||||
vkp_effects_set_formats(scene_fmt, scene_fmt);
|
vkp_effects_set_formats(scene_fmt, scene_fmt);
|
||||||
result = vkp_effects_run(cmd, scene_img, scene_w, scene_h, mapped_w, mapped_h, &rw, &rh);
|
result = vkp_effects_run(cmd, scene_img, scene_w, scene_h, mapped_w, mapped_h, &rw, &rh);
|
||||||
result_layout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
|
result_layout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
#include "effects_chain.h"
|
#include "effects_chain.h"
|
||||||
#include "cardboard.h"
|
#include "cardboard.h"
|
||||||
#include "droiddeck_color.h"
|
#include "droiddeck_color.h"
|
||||||
#include "gpu_clock_pin.h"
|
|
||||||
|
|
||||||
extern int droiddeck_wayland_run(void);
|
extern int droiddeck_wayland_run(void);
|
||||||
extern void droiddeck_wayland_set_scale_mode(int mode, int alignment);
|
extern void droiddeck_wayland_set_scale_mode(int mode, int alignment);
|
||||||
@@ -635,14 +634,8 @@ Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeTextInputDelete(JNIE
|
|||||||
extern void adrenotools_set_turbo(bool turbo);
|
extern void adrenotools_set_turbo(bool turbo);
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetGpuTurbo(JNIEnv *env, jclass clazz, jboolean on) {
|
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetGpuTurbo(JNIEnv *env, jclass clazz, jboolean on) {
|
||||||
(void)clazz;
|
(void)env; (void)clazz;
|
||||||
if (!gpu_clock_pin_set(on == JNI_TRUE)) {
|
adrenotools_set_turbo(on == JNI_TRUE);
|
||||||
int saved_errno = errno;
|
|
||||||
jclass error = (*env)->FindClass(env, "java/lang/IllegalStateException");
|
|
||||||
if (error) (*env)->ThrowNew(env, error, strerror(saved_errno));
|
|
||||||
}
|
|
||||||
// Clear a legacy global pin when recovering its marker after an app upgrade or crash.
|
|
||||||
if (on != JNI_TRUE) adrenotools_set_turbo(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL
|
JNIEXPORT jint JNICALL
|
||||||
|
|||||||
@@ -16,23 +16,16 @@ class App : Application() {
|
|||||||
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
com.droiddeck.launcher.ui.Themes.loadGradient(this)
|
|
||||||
// Helper processes must not initialize the main USB provider or guest graphics context.
|
// Helper processes must not initialize the main USB provider or guest graphics context.
|
||||||
val process = if (android.os.Build.VERSION.SDK_INT >= 28) Application.getProcessName()
|
val process = if (android.os.Build.VERSION.SDK_INT >= 28) Application.getProcessName()
|
||||||
else (getSystemService(ACTIVITY_SERVICE) as android.app.ActivityManager)
|
else (getSystemService(ACTIVITY_SERVICE) as android.app.ActivityManager)
|
||||||
.runningAppProcesses?.firstOrNull { it.pid == android.os.Process.myPid() }?.processName
|
.runningAppProcesses?.firstOrNull { it.pid == android.os.Process.myPid() }?.processName
|
||||||
if (process == "$packageName:xboxlogin") {
|
|
||||||
if (android.os.Build.VERSION.SDK_INT >= 28) android.webkit.WebView.setDataDirectorySuffix("xbox")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (process == "$packageName:vr_recovery" || process == "$packageName:rgb_diagnostic") return
|
if (process == "$packageName:vr_recovery" || process == "$packageName:rgb_diagnostic") return
|
||||||
CrashHandler.install(this)
|
CrashHandler.install(this)
|
||||||
com.droiddeck.launcher.session.QuestExperimental.initialize(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.settleGpuDriverMode(this)
|
||||||
com.droiddeck.launcher.update.AppUpdates.init(this)
|
com.droiddeck.launcher.update.AppUpdates.init(this)
|
||||||
com.droiddeck.launcher.core.DownloadSource.init(this)
|
com.droiddeck.launcher.core.DownloadSource.init(this)
|
||||||
prefetchAddonPacks()
|
|
||||||
GpuClockPin.clearLeftover(this)
|
GpuClockPin.clearLeftover(this)
|
||||||
com.droiddeck.launcher.glasses.Glasses.init(this)
|
com.droiddeck.launcher.glasses.Glasses.init(this)
|
||||||
com.droiddeck.launcher.glasses.GlassesMenuMirror.initialize(this)
|
com.droiddeck.launcher.glasses.GlassesMenuMirror.initialize(this)
|
||||||
@@ -42,24 +35,5 @@ class App : Application() {
|
|||||||
com.droiddeck.launcher.stores.StoresState.register(com.droiddeck.launcher.stores.gog.GogBackend)
|
com.droiddeck.launcher.stores.StoresState.register(com.droiddeck.launcher.stores.gog.GogBackend)
|
||||||
com.droiddeck.launcher.stores.StoresState.register(com.droiddeck.launcher.stores.epic.EpicBackend)
|
com.droiddeck.launcher.stores.StoresState.register(com.droiddeck.launcher.stores.epic.EpicBackend)
|
||||||
com.droiddeck.launcher.stores.StoresState.register(com.droiddeck.launcher.stores.amazon.AmazonBackend)
|
com.droiddeck.launcher.stores.StoresState.register(com.droiddeck.launcher.stores.amazon.AmazonBackend)
|
||||||
com.droiddeck.launcher.stores.StoresState.register(com.droiddeck.launcher.stores.itch.ItchBackend)
|
|
||||||
com.droiddeck.launcher.stores.StoresState.register(com.droiddeck.launcher.stores.xbox.XboxBackend)
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Fetches the packs an existing setup already relies on, so the first use after an update does not wait. */
|
|
||||||
private fun prefetchAddonPacks() {
|
|
||||||
val app = this
|
|
||||||
Thread({
|
|
||||||
runCatching {
|
|
||||||
if (com.droiddeck.launcher.runtime.LinuxRuntime.rootDir(app).isDirectory) {
|
|
||||||
com.droiddeck.launcher.core.AddonPack.PROOT.ensure(app)
|
|
||||||
com.droiddeck.launcher.core.AddonPack.DIRECTAUDIO.ensure(app)
|
|
||||||
}
|
|
||||||
if (com.droiddeck.launcher.stores.gog.GogComet.enabled(app)) com.droiddeck.launcher.core.AddonPack.COMET.ensure(app)
|
|
||||||
if (com.droiddeck.launcher.stores.StoreAccounts.signedInAs(app, com.droiddeck.launcher.stores.Store.XBOX) != null)
|
|
||||||
com.droiddeck.launcher.core.AddonPack.XBOX.ensure(app)
|
|
||||||
com.droiddeck.launcher.handtracking.HandTracking.load(app)
|
|
||||||
}.onFailure { android.util.Log.w("App", "add-on pack prefetch failed", it) }
|
|
||||||
}, "addon-packs").start()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,46 +11,29 @@ import java.io.File
|
|||||||
|
|
||||||
internal class DeckyMenu(private val activity: android.app.Activity, private val ui: android.os.Handler) {
|
internal class DeckyMenu(private val activity: android.app.Activity, private val ui: android.os.Handler) {
|
||||||
var deckyInstalled by mutableStateOf<String?>(null)
|
var deckyInstalled by mutableStateOf<String?>(null)
|
||||||
var deckyLatest by mutableStateOf<DeckyManager.Release?>(null)
|
var deckyReleases by mutableStateOf<List<DeckyManager.Release>>(emptyList())
|
||||||
var deckyBranch by mutableIntStateOf(DeckyManager.BRANCH_STABLE)
|
|
||||||
private var deckyChannels = DeckyManager.ReleaseChannels(emptyList(), emptyList())
|
|
||||||
var deckyChecking by mutableStateOf(false)
|
var deckyChecking by mutableStateOf(false)
|
||||||
var deckyStage by mutableStateOf<String?>(null)
|
var deckyStage by mutableStateOf<String?>(null)
|
||||||
var deckyPercent by mutableIntStateOf(-1)
|
var deckyPercent by mutableIntStateOf(-1)
|
||||||
var deckyDownloadingBinary by mutableStateOf(false)
|
var deckyDownloadingBinary by mutableStateOf(false)
|
||||||
var deckySupervisor by mutableStateOf(false)
|
var deckySupervisor by mutableStateOf(false)
|
||||||
var deckyPendingZip by mutableStateOf<File?>(null)
|
|
||||||
var deckyReleaseRequest = 0
|
var deckyReleaseRequest = 0
|
||||||
|
|
||||||
fun refreshDecky() {
|
fun refreshDecky() {
|
||||||
val request = ++deckyReleaseRequest
|
val request = ++deckyReleaseRequest
|
||||||
deckyBranch = DeckyManager.branch(activity)
|
|
||||||
deckyChecking = true
|
deckyChecking = true
|
||||||
Thread({
|
Thread({
|
||||||
val channels = runCatching { DeckyManager.releaseChannels(activity) }
|
val channels = runCatching { DeckyManager.releaseChannels(activity) }
|
||||||
.getOrElse { DeckyManager.ReleaseChannels(emptyList(), emptyList()) }
|
.getOrElse { DeckyManager.ReleaseChannels(emptyList(), emptyList(), emptyList()) }
|
||||||
ui.post {
|
ui.post {
|
||||||
if (request == deckyReleaseRequest) {
|
if (request == deckyReleaseRequest) {
|
||||||
deckyChannels = channels
|
deckyReleases = channels.newest
|
||||||
deckyLatest = DeckyManager.latest(channels, deckyBranch)
|
|
||||||
deckyChecking = false
|
deckyChecking = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, "decky-releases").start()
|
}, "decky-releases").start()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun switchDeckyBranch(branch: Int) {
|
|
||||||
if (branch == deckyBranch || deckyStage != null || SessionState.running) return
|
|
||||||
val saved = runCatching { DeckyManager.setBranch(activity, branch) }
|
|
||||||
if (saved.isFailure) {
|
|
||||||
android.widget.Toast.makeText(activity, R.string.decky_channel_failed, android.widget.Toast.LENGTH_LONG).show()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
deckyBranch = branch
|
|
||||||
deckyLatest = DeckyManager.latest(deckyChannels, branch)
|
|
||||||
refreshDecky()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun installDecky(release: DeckyManager.Release) {
|
fun installDecky(release: DeckyManager.Release) {
|
||||||
if (deckyStage != null || SessionState.running) return
|
if (deckyStage != null || SessionState.running) return
|
||||||
deckyStage = activity.getString(R.string.store_starting); deckyPercent = -1
|
deckyStage = activity.getString(R.string.store_starting); deckyPercent = -1
|
||||||
@@ -66,17 +49,6 @@ internal class DeckyMenu(private val activity: android.app.Activity, private val
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun importPluginZip(archive: File) {
|
fun importPluginZip(archive: File) {
|
||||||
if (deckyStage != null || SessionState.running || deckyInstalled == null) return
|
|
||||||
deckyPendingZip = archive
|
|
||||||
}
|
|
||||||
|
|
||||||
fun cancelPluginZip() {
|
|
||||||
deckyPendingZip = null
|
|
||||||
}
|
|
||||||
|
|
||||||
fun confirmPluginZip() {
|
|
||||||
val archive = deckyPendingZip ?: return
|
|
||||||
deckyPendingZip = null
|
|
||||||
if (deckyStage != null || SessionState.running || deckyInstalled == null) return
|
if (deckyStage != null || SessionState.running || deckyInstalled == null) return
|
||||||
deckyStage = activity.getString(R.string.decky_plugin_starting); deckyPercent = -1
|
deckyStage = activity.getString(R.string.decky_plugin_starting); deckyPercent = -1
|
||||||
Thread({
|
Thread({
|
||||||
|
|||||||
@@ -55,8 +55,6 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
|
|||||||
private set
|
private set
|
||||||
private var runtimePending by mutableStateOf(false)
|
private var runtimePending by mutableStateOf(false)
|
||||||
private var sessionRunning by mutableStateOf(false)
|
private var sessionRunning by mutableStateOf(false)
|
||||||
var tpUbwcMode: String by mutableStateOf(SessionPrefs.TP_UBWC_AUTO)
|
|
||||||
private set
|
|
||||||
|
|
||||||
val uiMode: String get() = when (mode) {
|
val uiMode: String get() = when (mode) {
|
||||||
SessionPrefs.GPU_DRIVERS_AUTO -> GPU_MODE_AUTO
|
SessionPrefs.GPU_DRIVERS_AUTO -> GPU_MODE_AUTO
|
||||||
@@ -75,16 +73,8 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
|
|||||||
mode = uiMode, display = displaySlot(), runtime = runtimeSlot(),
|
mode = uiMode, display = displaySlot(), runtime = runtimeSlot(),
|
||||||
canRestart = !sessionRunning,
|
canRestart = !sessionRunning,
|
||||||
checkedAt = TurnipReleases.cached(activity)?.checkedAt ?: 0L,
|
checkedAt = TurnipReleases.cached(activity)?.checkedAt ?: 0L,
|
||||||
tpUbwcMode = tpUbwcMode.takeIf { gpu.model == 740 },
|
|
||||||
tpUbwcRestartRequired = com.droiddeck.launcher.gpu.TpUbwcHint.restartRequired(activity),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
fun chooseTpUbwcMode(mode: String) {
|
|
||||||
if (gpu.model != 740) return
|
|
||||||
SessionPrefs.setTpUbwcMode(activity, mode)
|
|
||||||
tpUbwcMode = mode
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun slotSource(chosenDefault: Boolean, defaultLabel: Int): String = activity.getString(when {
|
private fun slotSource(chosenDefault: Boolean, defaultLabel: Int): String = activity.getString(when {
|
||||||
uiMode == GPU_MODE_AUTO -> R.string.gpu_src_auto
|
uiMode == GPU_MODE_AUTO -> R.string.gpu_src_auto
|
||||||
uiMode == GPU_MODE_PAIR && pairRows.any { it.active } -> R.string.gpu_src_pair
|
uiMode == GPU_MODE_PAIR && pairRows.any { it.active } -> R.string.gpu_src_pair
|
||||||
@@ -134,7 +124,6 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
|
|||||||
var androidSelected by mutableStateOf("")
|
var androidSelected by mutableStateOf("")
|
||||||
|
|
||||||
fun refreshDrivers() {
|
fun refreshDrivers() {
|
||||||
tpUbwcMode = SessionPrefs.tpUbwcMode(activity)
|
|
||||||
val lm = LinuxVulkanDriverManager(activity)
|
val lm = LinuxVulkanDriverManager(activity)
|
||||||
fun origin(id: String) = if (TurnipReleases.isDownloaded(activity, id)) DriverRow.DOWNLOADED else DriverRow.IMPORTED
|
fun origin(id: String) = if (TurnipReleases.isDownloaded(activity, id)) DriverRow.DOWNLOADED else DriverRow.IMPORTED
|
||||||
val bundles = DriverBundle.all(activity)
|
val bundles = DriverBundle.all(activity)
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class HomeActivity : Activity() {
|
|||||||
.setAction(SessionService.ACTION_HOME_GUIDE)
|
.setAction(SessionService.ACTION_HOME_GUIDE)
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
||||||
} else {
|
} else {
|
||||||
Intent(this, FrontEndActivity::class.java)
|
Intent(this, MainActivity::class.java)
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
||||||
}
|
}
|
||||||
startActivity(destination)
|
startActivity(destination)
|
||||||
|
|||||||
@@ -1,48 +0,0 @@
|
|||||||
package com.droiddeck.launcher
|
|
||||||
|
|
||||||
import android.content.ComponentName
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.pm.PackageManager
|
|
||||||
|
|
||||||
object LauncherIcon {
|
|
||||||
const val DARK = "dark"
|
|
||||||
const val LIGHT = "light"
|
|
||||||
|
|
||||||
private val aliases = linkedMapOf(DARK to "com.droiddeck.launcher.MainActivity", LIGHT to "com.droiddeck.launcher.LauncherLight")
|
|
||||||
|
|
||||||
val options: List<Pair<String, Int>> = listOf(
|
|
||||||
DARK to R.string.setup_launcher_icon_dark,
|
|
||||||
LIGHT to R.string.setup_launcher_icon_light,
|
|
||||||
)
|
|
||||||
|
|
||||||
private fun component(context: Context, style: String) =
|
|
||||||
ComponentName(context, aliases.getValue(style))
|
|
||||||
|
|
||||||
private fun enabled(context: Context, style: String): Boolean =
|
|
||||||
when (context.packageManager.getComponentEnabledSetting(component(context, style))) {
|
|
||||||
PackageManager.COMPONENT_ENABLED_STATE_ENABLED -> true
|
|
||||||
PackageManager.COMPONENT_ENABLED_STATE_DEFAULT -> style == DARK
|
|
||||||
else -> false
|
|
||||||
}
|
|
||||||
|
|
||||||
fun current(context: Context): String = aliases.keys.firstOrNull { enabled(context, it) } ?: DARK
|
|
||||||
|
|
||||||
fun activity(context: Context): ComponentName = component(context, current(context))
|
|
||||||
|
|
||||||
fun repair(context: Context, launchedFrom: ComponentName?) {
|
|
||||||
if (!enabled(context, DARK) || !enabled(context, LIGHT) || launchedFrom == component(context, DARK)) return
|
|
||||||
context.packageManager.setComponentEnabledSetting(component(context, DARK),
|
|
||||||
PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun set(context: Context, style: String) {
|
|
||||||
if (style !in aliases || style == current(context)) return
|
|
||||||
val pm = context.packageManager
|
|
||||||
pm.setComponentEnabledSetting(component(context, style),
|
|
||||||
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP)
|
|
||||||
aliases.keys.filter { it != style }.forEach {
|
|
||||||
pm.setComponentEnabledSetting(component(context, it),
|
|
||||||
PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+26
-130
@@ -80,7 +80,7 @@ import com.droiddeck.launcher.session.GameStorage
|
|||||||
import com.droiddeck.launcher.input.SecondScreenDisplay
|
import com.droiddeck.launcher.input.SecondScreenDisplay
|
||||||
import com.droiddeck.launcher.input.SecondScreenDisplays
|
import com.droiddeck.launcher.input.SecondScreenDisplays
|
||||||
|
|
||||||
class FrontEndActivity : ComponentActivity() {
|
class MainActivity : ComponentActivity() {
|
||||||
override fun attachBaseContext(newBase: android.content.Context) {
|
override fun attachBaseContext(newBase: android.content.Context) {
|
||||||
super.attachBaseContext(newBase)
|
super.attachBaseContext(newBase)
|
||||||
com.droiddeck.launcher.core.AppLanguage.applyTo(this, newBase)
|
com.droiddeck.launcher.core.AppLanguage.applyTo(this, newBase)
|
||||||
@@ -109,7 +109,6 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
private var frameGenLabel by mutableStateOf("")
|
private var frameGenLabel by mutableStateOf("")
|
||||||
private var lossless by mutableStateOf(Lossless.State.NONE)
|
private var lossless by mutableStateOf(Lossless.State.NONE)
|
||||||
private var showRemove by mutableStateOf(false)
|
private var showRemove by mutableStateOf(false)
|
||||||
private var showRuntimeActions by mutableStateOf<LinuxRuntimeInstaller.Release?>(null)
|
|
||||||
private var pendingSwitch by mutableStateOf<Intent?>(null)
|
private var pendingSwitch by mutableStateOf<Intent?>(null)
|
||||||
private var switchingTo: Intent? = null
|
private var switchingTo: Intent? = null
|
||||||
private var switchPoll: Runnable? = null
|
private var switchPoll: Runnable? = null
|
||||||
@@ -119,14 +118,11 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
private var showNonAdreno by mutableStateOf<LinuxRuntimeInstaller.Release?>(null)
|
private var showNonAdreno by mutableStateOf<LinuxRuntimeInstaller.Release?>(null)
|
||||||
private var glThread by mutableStateOf(true)
|
private var glThread by mutableStateOf(true)
|
||||||
private var noGlError by mutableStateOf(true)
|
private var noGlError by mutableStateOf(true)
|
||||||
private var returnAfterGame by mutableStateOf(true)
|
|
||||||
private var shaderPrecache by mutableStateOf(true)
|
|
||||||
private var steamRepairQueued by mutableStateOf(false)
|
private var steamRepairQueued by mutableStateOf(false)
|
||||||
private var mangoapp by mutableStateOf(true)
|
private var mangoapp by mutableStateOf(true)
|
||||||
private var steamController by mutableStateOf(SessionPrefs.CONTROLLER_DECK)
|
private var steamController by mutableStateOf(SessionPrefs.CONTROLLER_DECK)
|
||||||
private var showComponents by mutableStateOf(false)
|
private var showComponents by mutableStateOf(false)
|
||||||
private var focusComponentsContent by mutableStateOf(true)
|
private var focusComponentsContent by mutableStateOf(true)
|
||||||
private var componentsGameKey by mutableStateOf<String?>(null)
|
|
||||||
private var showMapping by mutableStateOf(false)
|
private var showMapping by mutableStateOf(false)
|
||||||
private var saveBusy: String? = null
|
private var saveBusy: String? = null
|
||||||
private var onSavePicked: ((File) -> Unit)? = null
|
private var onSavePicked: ((File) -> Unit)? = null
|
||||||
@@ -155,7 +151,6 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
private var gpuClockPin by mutableStateOf(false)
|
private var gpuClockPin by mutableStateOf(false)
|
||||||
private var prootNoSeccomp by mutableStateOf(false)
|
private var prootNoSeccomp by mutableStateOf(false)
|
||||||
private var prootFastPath by mutableStateOf(true)
|
private var prootFastPath by mutableStateOf(true)
|
||||||
private var cursorComposite by mutableStateOf(false)
|
|
||||||
private var guestHostname by mutableStateOf(SessionPrefs.DEFAULT_GUEST_HOSTNAME)
|
private var guestHostname by mutableStateOf(SessionPrefs.DEFAULT_GUEST_HOSTNAME)
|
||||||
private var phantomWarning by mutableStateOf<String?>(null)
|
private var phantomWarning by mutableStateOf<String?>(null)
|
||||||
private var phantomProcessStatus by mutableStateOf(PhantomProcessStatus.NOT_APPLICABLE)
|
private var phantomProcessStatus by mutableStateOf(PhantomProcessStatus.NOT_APPLICABLE)
|
||||||
@@ -169,7 +164,6 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
private var downloadMirror by mutableStateOf("")
|
private var downloadMirror by mutableStateOf("")
|
||||||
private var downloadPrefix by mutableStateOf("")
|
private var downloadPrefix by mutableStateOf("")
|
||||||
private var animationsEnabled by mutableStateOf(true)
|
private var animationsEnabled by mutableStateOf(true)
|
||||||
private var launcherIcon by mutableStateOf(LauncherIcon.DARK)
|
|
||||||
private var gameStoresEnabled by mutableStateOf(true)
|
private var gameStoresEnabled by mutableStateOf(true)
|
||||||
private var gameStoresSpeedTier by mutableStateOf("fast")
|
private var gameStoresSpeedTier by mutableStateOf("fast")
|
||||||
private var storesOpenTab by mutableStateOf(SessionPrefs.STORES_OPEN_LIBRARY)
|
private var storesOpenTab by mutableStateOf(SessionPrefs.STORES_OPEN_LIBRARY)
|
||||||
@@ -394,6 +388,8 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
private var touchMode by mutableStateOf(SessionPrefs.TOUCH_AUTO)
|
private var touchMode by mutableStateOf(SessionPrefs.TOUCH_AUTO)
|
||||||
private var suspendPolicy by mutableStateOf(SessionPrefs.SUSPEND_MANUAL)
|
private var suspendPolicy by mutableStateOf(SessionPrefs.SUSPEND_MANUAL)
|
||||||
private var steamDownloadsInBackground by mutableStateOf(false)
|
private var steamDownloadsInBackground by mutableStateOf(false)
|
||||||
|
private var zramCompression by mutableStateOf(false)
|
||||||
|
private var zramSupported by mutableStateOf<Boolean?>(null)
|
||||||
private var oscMode by mutableStateOf(SessionPrefs.OSC_AUTO)
|
private var oscMode by mutableStateOf(SessionPrefs.OSC_AUTO)
|
||||||
private var backActionsInverted by mutableStateOf(false)
|
private var backActionsInverted by mutableStateOf(false)
|
||||||
private var gameStorage by mutableStateOf("")
|
private var gameStorage by mutableStateOf("")
|
||||||
@@ -488,20 +484,6 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
pickSaveDir.launch(InAppFilePicker.buildDirIntent(this, getString(R.string.game_file_folder), gameSyncFolder))
|
pickSaveDir.launch(InAppFilePicker.buildDirIntent(this, getString(R.string.game_file_folder), gameSyncFolder))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun switchLauncherIcon(style: String): Boolean {
|
|
||||||
val before = LauncherIcon.current(this)
|
|
||||||
LauncherIcon.set(this, style)
|
|
||||||
launcherIcon = LauncherIcon.current(this)
|
|
||||||
if (launcherIcon == before) return false
|
|
||||||
// Android finishes activities started through the alias that was just disabled.
|
|
||||||
startActivity(Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER)
|
|
||||||
.setComponent(LauncherIcon.activity(this))
|
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_MULTIPLE_TASK)
|
|
||||||
.putExtra(com.droiddeck.launcher.stores.download.StoreDownloadService.EXTRA_NAV, "setup:launcher"))
|
|
||||||
finishAndRemoveTask()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun readGameIntent(request: Intent) {
|
private fun readGameIntent(request: Intent) {
|
||||||
request.getStringExtra(com.droiddeck.launcher.stores.download.StoreDownloadService.EXTRA_NAV)?.let { navRequest = it; request.removeExtra(com.droiddeck.launcher.stores.download.StoreDownloadService.EXTRA_NAV) }
|
request.getStringExtra(com.droiddeck.launcher.stores.download.StoreDownloadService.EXTRA_NAV)?.let { navRequest = it; request.removeExtra(com.droiddeck.launcher.stores.download.StoreDownloadService.EXTRA_NAV) }
|
||||||
shortcutPicker = request.action == Intent.ACTION_CREATE_SHORTCUT
|
shortcutPicker = request.action == Intent.ACTION_CREATE_SHORTCUT
|
||||||
@@ -699,7 +681,7 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
else {
|
else {
|
||||||
switchPoll = null
|
switchPoll = null
|
||||||
switchingTo = null
|
switchingTo = null
|
||||||
android.widget.Toast.makeText(this@FrontEndActivity, R.string.game_link_session_busy, android.widget.Toast.LENGTH_LONG).show()
|
android.widget.Toast.makeText(this@MainActivity, R.string.game_link_session_busy, android.widget.Toast.LENGTH_LONG).show()
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -757,8 +739,6 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
downloadPrefix = DownloadSource.custom(this)
|
downloadPrefix = DownloadSource.custom(this)
|
||||||
DownloadSource.probe()
|
DownloadSource.probe()
|
||||||
animationsEnabled = SessionPrefs.animationsEnabled(this)
|
animationsEnabled = SessionPrefs.animationsEnabled(this)
|
||||||
LauncherIcon.repair(this, intent?.component)
|
|
||||||
launcherIcon = LauncherIcon.current(this)
|
|
||||||
gameStoresEnabled = SessionPrefs.gameStoresEnabled(this)
|
gameStoresEnabled = SessionPrefs.gameStoresEnabled(this)
|
||||||
gameStoresSpeedTier = SessionPrefs.gameStoresSpeedTier(this)
|
gameStoresSpeedTier = SessionPrefs.gameStoresSpeedTier(this)
|
||||||
storesOpenTab = SessionPrefs.storesOpenTab(this)
|
storesOpenTab = SessionPrefs.storesOpenTab(this)
|
||||||
@@ -770,9 +750,6 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
setContent {
|
setContent {
|
||||||
DroidDeckTheme(theme, appScale = appScale) {
|
DroidDeckTheme(theme, appScale = appScale) {
|
||||||
com.droiddeck.launcher.ui.FocusGlideHost(androidx.compose.ui.Modifier.fillMaxSize().exposeTestTags()) {
|
com.droiddeck.launcher.ui.FocusGlideHost(androidx.compose.ui.Modifier.fillMaxSize().exposeTestTags()) {
|
||||||
if (decky.deckyPendingZip != null) com.droiddeck.launcher.ui.DeckyZipWarningDialog(
|
|
||||||
onConfirm = { decky.confirmPluginZip() }, onCancel = { decky.cancelPluginZip() },
|
|
||||||
)
|
|
||||||
val page: (@Composable () -> Unit)? = when {
|
val page: (@Composable () -> Unit)? = when {
|
||||||
showPerformance -> { { PerformanceHost() } }
|
showPerformance -> { { PerformanceHost() } }
|
||||||
showComponents -> { { ComponentsHost() } }
|
showComponents -> { { ComponentsHost() } }
|
||||||
@@ -822,7 +799,6 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
downloadMirror = downloadMirror,
|
downloadMirror = downloadMirror,
|
||||||
downloadPrefix = downloadPrefix,
|
downloadPrefix = downloadPrefix,
|
||||||
animationsEnabled = animationsEnabled,
|
animationsEnabled = animationsEnabled,
|
||||||
launcherIcon = launcherIcon,
|
|
||||||
gameStoresEnabled = gameStoresEnabled,
|
gameStoresEnabled = gameStoresEnabled,
|
||||||
gameStoresSpeedTier = gameStoresSpeedTier,
|
gameStoresSpeedTier = gameStoresSpeedTier,
|
||||||
storesOpenTab = storesOpenTab,
|
storesOpenTab = storesOpenTab,
|
||||||
@@ -866,7 +842,6 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
},
|
},
|
||||||
onSteamGameArtChanged = { appId -> refreshSteamGameArt(appId) },
|
onSteamGameArtChanged = { appId -> refreshSteamGameArt(appId) },
|
||||||
onAddedGameRemoved = { folder, appId, name -> removeAddedGame(folder, appId, name) },
|
onAddedGameRemoved = { folder, appId, name -> removeAddedGame(folder, appId, name) },
|
||||||
onGameRemoved = { g -> removeGame(g) },
|
|
||||||
onAddedGamesArt = { on -> SessionPrefs.setAddedGamesArt(this, on); addedGamesArt = on; if (on) refreshAddedGames() },
|
onAddedGamesArt = { on -> SessionPrefs.setAddedGamesArt(this, on); addedGamesArt = on; if (on) refreshAddedGames() },
|
||||||
onSgdbKey = { key ->
|
onSgdbKey = { key ->
|
||||||
Thread({
|
Thread({
|
||||||
@@ -928,7 +903,6 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
},
|
},
|
||||||
onProtons = { openProtons() },
|
onProtons = { openProtons() },
|
||||||
onComponents = { focusContent -> openComponents(focusContent) },
|
onComponents = { focusContent -> openComponents(focusContent) },
|
||||||
onGameComponents = { game -> openComponents(gameKey = game.profileKey) },
|
|
||||||
onComponentsTab = { tab -> openComponents(focusContent = true, tab = tab) },
|
onComponentsTab = { tab -> openComponents(focusContent = true, tab = tab) },
|
||||||
onSaveImport = { sg -> importSaves(sg.name) { GameSaves.game(sg) } },
|
onSaveImport = { sg -> importSaves(sg.name) { GameSaves.game(sg) } },
|
||||||
onSaveExport = { sg, layout -> exportSaves(sg.name, layout) { GameSaves.game(sg) } },
|
onSaveExport = { sg, layout -> exportSaves(sg.name, layout) { GameSaves.game(sg) } },
|
||||||
@@ -978,7 +952,6 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
onPageBack = { showPerformance = false; showComponents = false; showMapping = false },
|
onPageBack = { showPerformance = false; showComponents = false; showMapping = false },
|
||||||
onGameStoresEnabled = { on -> SessionPrefs.setGameStoresEnabled(this, on); gameStoresEnabled = on },
|
onGameStoresEnabled = { on -> SessionPrefs.setGameStoresEnabled(this, on); gameStoresEnabled = on },
|
||||||
onTheme = { id -> SessionPrefs.setTheme(this, id); theme = id },
|
onTheme = { id -> SessionPrefs.setTheme(this, id); theme = id },
|
||||||
onLauncherIcon = { style -> switchLauncherIcon(style) },
|
|
||||||
onLanguage = { tag ->
|
onLanguage = { tag ->
|
||||||
if (tag != com.droiddeck.launcher.core.AppLanguage.chosen(this)) {
|
if (tag != com.droiddeck.launcher.core.AppLanguage.chosen(this)) {
|
||||||
com.droiddeck.launcher.core.AppLanguage.setChosen(this, tag)
|
com.droiddeck.launcher.core.AppLanguage.setChosen(this, tag)
|
||||||
@@ -1038,7 +1011,7 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
onWirelessAdbPair = { host, port, code, complete ->
|
onWirelessAdbPair = { host, port, code, complete ->
|
||||||
Thread({
|
Thread({
|
||||||
val result = runCatching {
|
val result = runCatching {
|
||||||
kotlinx.coroutines.runBlocking { WirelessAdbFix.pair(this@FrontEndActivity, host, port, code) }
|
kotlinx.coroutines.runBlocking { WirelessAdbFix.pair(this@MainActivity, host, port, code) }
|
||||||
}
|
}
|
||||||
val error = result.exceptionOrNull()?.let { it.localizedMessage ?: getString(R.string.main_wadb_pair_failed) }
|
val error = result.exceptionOrNull()?.let { it.localizedMessage ?: getString(R.string.main_wadb_pair_failed) }
|
||||||
ui.post { complete(error) }
|
ui.post { complete(error) }
|
||||||
@@ -1046,13 +1019,13 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
},
|
},
|
||||||
onFindWirelessAdbPort = { host, complete ->
|
onFindWirelessAdbPort = { host, complete ->
|
||||||
Thread({
|
Thread({
|
||||||
val port = WirelessAdbFix.findConnectPort(this@FrontEndActivity, host)
|
val port = WirelessAdbFix.findConnectPort(this@MainActivity, host)
|
||||||
ui.post { complete(port) }
|
ui.post { complete(port) }
|
||||||
}, "wireless-adb-discovery").start()
|
}, "wireless-adb-discovery").start()
|
||||||
},
|
},
|
||||||
onWirelessAdbApply = { host, port, enabled, complete ->
|
onWirelessAdbApply = { host, port, enabled, complete ->
|
||||||
Thread({
|
Thread({
|
||||||
val result = runCatching { WirelessAdbFix.setChildProcessLimit(this@FrontEndActivity, host, port, enabled) }
|
val result = runCatching { WirelessAdbFix.setChildProcessLimit(this@MainActivity, host, port, enabled) }
|
||||||
val error = result.exceptionOrNull()?.let { it.localizedMessage ?: getString(R.string.main_wadb_command_failed) }
|
val error = result.exceptionOrNull()?.let { it.localizedMessage ?: getString(R.string.main_wadb_command_failed) }
|
||||||
ui.post {
|
ui.post {
|
||||||
if (error == null) refreshPhantomStatus()
|
if (error == null) refreshPhantomStatus()
|
||||||
@@ -1062,7 +1035,7 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
},
|
},
|
||||||
onSetPhantomProcessLimit = { enabled, complete ->
|
onSetPhantomProcessLimit = { enabled, complete ->
|
||||||
Thread({
|
Thread({
|
||||||
val result = runCatching { WirelessAdbFix.setUsingSavedPairing(this@FrontEndActivity, enabled) }
|
val result = runCatching { WirelessAdbFix.setUsingSavedPairing(this@MainActivity, enabled) }
|
||||||
val error = result.exceptionOrNull()?.let { it.localizedMessage ?: getString(R.string.main_wadb_unavailable) }
|
val error = result.exceptionOrNull()?.let { it.localizedMessage ?: getString(R.string.main_wadb_unavailable) }
|
||||||
ui.post {
|
ui.post {
|
||||||
if (error == null) refreshPhantomStatus()
|
if (error == null) refreshPhantomStatus()
|
||||||
@@ -1118,7 +1091,7 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
showNonAdreno?.let { release ->
|
showNonAdreno?.let { release ->
|
||||||
ConfirmDialog(
|
ConfirmDialog(
|
||||||
title = androidx.compose.ui.res.stringResource(R.string.main_non_adreno_title),
|
title = androidx.compose.ui.res.stringResource(R.string.main_non_adreno_title),
|
||||||
text = androidx.compose.ui.res.stringResource(R.string.main_non_adreno_text, com.droiddeck.launcher.core.DeviceSupport.gpuName(this@FrontEndActivity), release.size / 1e6),
|
text = androidx.compose.ui.res.stringResource(R.string.main_non_adreno_text, com.droiddeck.launcher.core.DeviceSupport.gpuName(this@MainActivity), release.size / 1e6),
|
||||||
confirm = androidx.compose.ui.res.stringResource(R.string.main_install_anyway),
|
confirm = androidx.compose.ui.res.stringResource(R.string.main_install_anyway),
|
||||||
onConfirm = { showNonAdreno = null; install(release) },
|
onConfirm = { showNonAdreno = null; install(release) },
|
||||||
onDismiss = { showNonAdreno = null },
|
onDismiss = { showNonAdreno = null },
|
||||||
@@ -1133,13 +1106,6 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
onDismiss = { pendingSwitch = null },
|
onDismiss = { pendingSwitch = null },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
showRuntimeActions?.let { release ->
|
|
||||||
com.droiddeck.launcher.ui.RuntimeActionsDialog(
|
|
||||||
onRepair = { showRuntimeActions = null; if (!runtimeChangesBlocked()) install(release) },
|
|
||||||
onRemove = { showRuntimeActions = null; showRemove = true },
|
|
||||||
onDismiss = { showRuntimeActions = null },
|
|
||||||
)
|
|
||||||
}
|
|
||||||
if (showRemove) ConfirmDialog(
|
if (showRemove) ConfirmDialog(
|
||||||
title = androidx.compose.ui.res.stringResource(R.string.main_remove_runtime_title),
|
title = androidx.compose.ui.res.stringResource(R.string.main_remove_runtime_title),
|
||||||
text = androidx.compose.ui.res.stringResource(R.string.main_remove_runtime_text),
|
text = androidx.compose.ui.res.stringResource(R.string.main_remove_runtime_text),
|
||||||
@@ -1296,7 +1262,6 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
syncLossless()
|
syncLossless()
|
||||||
updates.onResume()
|
updates.onResume()
|
||||||
drivers.checkOnOpen()
|
drivers.checkOnOpen()
|
||||||
resumeInterruptedPackages()
|
|
||||||
protons.checkUpdates()
|
protons.checkUpdates()
|
||||||
if (!SessionState.running) Thread({
|
if (!SessionState.running) Thread({
|
||||||
val applied = runCatching { ComponentsManager.applyQueued(this) }.getOrDefault(emptyList())
|
val applied = runCatching { ComponentsManager.applyQueued(this) }.getOrDefault(emptyList())
|
||||||
@@ -1441,9 +1406,8 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun openComponents(focusContent: Boolean = true, tab: String? = null, gameKey: String? = null) {
|
private fun openComponents(focusContent: Boolean = true, tab: String? = null) {
|
||||||
focusComponentsContent = focusContent
|
focusComponentsContent = focusContent
|
||||||
componentsGameKey = gameKey
|
|
||||||
if (tab != null) components.compComp = tab
|
if (tab != null) components.compComp = tab
|
||||||
showPerformance = false
|
showPerformance = false
|
||||||
showMapping = false
|
showMapping = false
|
||||||
@@ -1492,7 +1456,6 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
onImport = { pickComponent.launch(InAppFilePicker.buildIntent(this, WCP_EXT, getString(R.string.comp_pick_wcp))) },
|
onImport = { pickComponent.launch(InAppFilePicker.buildIntent(this, WCP_EXT, getString(R.string.comp_pick_wcp))) },
|
||||||
onBack = { if (!com.droiddeck.launcher.ui.Hops.back { showComponents = false }) showComponents = false },
|
onBack = { if (!com.droiddeck.launcher.ui.Hops.back { showComponents = false }) showComponents = false },
|
||||||
games = steamGames,
|
games = steamGames,
|
||||||
initialGameKey = componentsGameKey,
|
|
||||||
generalFexPreset = fexPreset,
|
generalFexPreset = fexPreset,
|
||||||
onGeneralFexPreset = { id -> SessionPrefs.setFexPreset(this, id); fexPreset = id },
|
onGeneralFexPreset = { id -> SessionPrefs.setFexPreset(this, id); fexPreset = id },
|
||||||
gpu = drivers.state(),
|
gpu = drivers.state(),
|
||||||
@@ -1511,7 +1474,6 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
onRestoreBundled = { TurnipDriver(this).restoreBundled(); drivers.refreshDrivers() },
|
onRestoreBundled = { TurnipDriver(this).restoreBundled(); drivers.refreshDrivers() },
|
||||||
onMode = { m -> drivers.chooseMode(m) },
|
onMode = { m -> drivers.chooseMode(m) },
|
||||||
onRestart = { drivers.restartApp() },
|
onRestart = { drivers.restartApp() },
|
||||||
onTpUbwcMode = { drivers.chooseTpUbwcMode(it) },
|
|
||||||
),
|
),
|
||||||
protons = com.droiddeck.launcher.ui.ProtonsState(
|
protons = com.droiddeck.launcher.ui.ProtonsState(
|
||||||
rows = protons.protonRows, busyId = protons.protonBusyId, stage = protons.protonStage, percent = protons.protonPercent,
|
rows = protons.protonRows, busyId = protons.protonBusyId, stage = protons.protonStage, percent = protons.protonPercent,
|
||||||
@@ -1553,27 +1515,6 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
.putExtra(SessionService.EXTRA_PROGRAM, path))
|
.putExtra(SessionService.EXTRA_PROGRAM, path))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun resumeInterruptedPackages() {
|
|
||||||
if (runtimeChangesBlocked()) return
|
|
||||||
val first = DesktopCatalog.interrupted(this).firstOrNull()
|
|
||||||
if (first == null) {
|
|
||||||
Thread({ DesktopCatalog.pruneDownloads(this) }, "prune-pkg").start()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
pkgId = first.id; pkgStage = getString(R.string.deskpkg_installing, first.name); pkgPercent = -1
|
|
||||||
Thread({
|
|
||||||
val problem = DesktopCatalog.resumeInterrupted(this) { stage, percent ->
|
|
||||||
ui.post { pkgStage = stage; pkgPercent = percent }
|
|
||||||
}
|
|
||||||
ui.post {
|
|
||||||
pkgStage = null; pkgId = null
|
|
||||||
if (problem != null) android.widget.Toast.makeText(this, getString(R.string.main_pkg_problem, first.name, problem), android.widget.Toast.LENGTH_LONG).show()
|
|
||||||
refreshPackages()
|
|
||||||
refresh()
|
|
||||||
}
|
|
||||||
}, "resume-pkg").start()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun installPackage(id: String) {
|
private fun installPackage(id: String) {
|
||||||
val entry = catalog?.firstOrNull { it.id == id } ?: return
|
val entry = catalog?.firstOrNull { it.id == id } ?: return
|
||||||
if (busy || LinuxRuntimeInstaller.isBusy() || pkgStage != null || SessionState.running) return
|
if (busy || LinuxRuntimeInstaller.isBusy() || pkgStage != null || SessionState.running) return
|
||||||
@@ -1618,11 +1559,12 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
touchMode = touchMode,
|
touchMode = touchMode,
|
||||||
suspendPolicy = suspendPolicy,
|
suspendPolicy = suspendPolicy,
|
||||||
steamDownloadsInBackground = steamDownloadsInBackground,
|
steamDownloadsInBackground = steamDownloadsInBackground,
|
||||||
|
zramCompression = if (mode == SessionService.MODE_STEAM) zramCompression else null,
|
||||||
|
zramSupported = zramSupported,
|
||||||
pipSupported = com.droiddeck.launcher.session.SessionPipController.supported(this),
|
pipSupported = com.droiddeck.launcher.session.SessionPipController.supported(this),
|
||||||
pipAutoEnter = pipAutoEnter,
|
pipAutoEnter = pipAutoEnter,
|
||||||
unfoldedControls = if (mode == SessionService.MODE_STEAM &&
|
unfoldedControls = if (mode == SessionService.MODE_STEAM &&
|
||||||
com.droiddeck.launcher.session.SessionDisplay.foldable(this)) unfoldedControls else null,
|
com.droiddeck.launcher.session.SessionDisplay.foldable(this)) unfoldedControls else null,
|
||||||
unfoldedControlsWithController = unfoldedControlsWithController,
|
|
||||||
oscMode = if (mode == SessionService.MODE_STEAM) oscMode else null,
|
oscMode = if (mode == SessionService.MODE_STEAM) oscMode else null,
|
||||||
backActionsInverted = backActionsInverted,
|
backActionsInverted = backActionsInverted,
|
||||||
directAudio = if (mode == SessionService.MODE_STEAM) directAudio else null,
|
directAudio = if (mode == SessionService.MODE_STEAM) directAudio else null,
|
||||||
@@ -1636,8 +1578,6 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
forceSsbs = forceSsbs,
|
forceSsbs = forceSsbs,
|
||||||
syncBackend = if (mode == SessionService.MODE_STEAM) SessionPrefs.syncBackendOf(fastSync, fsyncFirst, syncFallback) else null,
|
syncBackend = if (mode == SessionService.MODE_STEAM) SessionPrefs.syncBackendOf(fastSync, fsyncFirst, syncFallback) else null,
|
||||||
steamClientArch = if (mode == SessionService.MODE_STEAM) steamClientArch else null,
|
steamClientArch = if (mode == SessionService.MODE_STEAM) steamClientArch else null,
|
||||||
returnAfterGame = if (mode == SessionService.MODE_STEAM) returnAfterGame else null,
|
|
||||||
shaderPrecache = if (mode == SessionService.MODE_STEAM) shaderPrecache else null,
|
|
||||||
steamRepairQueued = steamRepairQueued,
|
steamRepairQueued = steamRepairQueued,
|
||||||
mangoapp = mangoapp,
|
mangoapp = mangoapp,
|
||||||
steamController = if (mode == SessionService.MODE_STEAM) steamController else null,
|
steamController = if (mode == SessionService.MODE_STEAM) steamController else null,
|
||||||
@@ -1653,8 +1593,7 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
wifiDiscoveryAsked = wifiDiscoveryAsked,
|
wifiDiscoveryAsked = wifiDiscoveryAsked,
|
||||||
wifiDiscoveryBlocked = wifiDiscoveryBlocked,
|
wifiDiscoveryBlocked = wifiDiscoveryBlocked,
|
||||||
deckyInstalled = if (mode == SessionService.MODE_STEAM) decky.deckyInstalled else null,
|
deckyInstalled = if (mode == SessionService.MODE_STEAM) decky.deckyInstalled else null,
|
||||||
deckyLatestRelease = if (mode == SessionService.MODE_STEAM) decky.deckyLatest else null,
|
deckyLatestRelease = if (mode == SessionService.MODE_STEAM) decky.deckyReleases.firstOrNull() else null,
|
||||||
deckyBranch = decky.deckyBranch,
|
|
||||||
deckyChecking = decky.deckyChecking, deckyStage = decky.deckyStage, deckyPercent = decky.deckyPercent,
|
deckyChecking = decky.deckyChecking, deckyStage = decky.deckyStage, deckyPercent = decky.deckyPercent,
|
||||||
deckyDownloadingBinary = decky.deckyDownloadingBinary,
|
deckyDownloadingBinary = decky.deckyDownloadingBinary,
|
||||||
deckyEnabled = decky.deckySupervisor, deckySessionRunning = SessionState.running,
|
deckyEnabled = decky.deckySupervisor, deckySessionRunning = SessionState.running,
|
||||||
@@ -1687,11 +1626,9 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
SessionPrefs.setSteamDownloadsInBackground(this, enabled)
|
SessionPrefs.setSteamDownloadsInBackground(this, enabled)
|
||||||
steamDownloadsInBackground = enabled
|
steamDownloadsInBackground = enabled
|
||||||
},
|
},
|
||||||
|
onZramCompression = { on -> SessionPrefs.setZramCompression(this, on); zramCompression = on },
|
||||||
onPipAutoEnter = { on -> SessionPrefs.setPipAutoEnter(this, on); pipAutoEnter = on },
|
onPipAutoEnter = { on -> SessionPrefs.setPipAutoEnter(this, on); pipAutoEnter = on },
|
||||||
onUnfoldedControls = { on -> SessionPrefs.setUnfoldedControls(this, on); unfoldedControls = on },
|
onUnfoldedControls = { on -> SessionPrefs.setUnfoldedControls(this, on); unfoldedControls = on },
|
||||||
onUnfoldedControlsWithController = { on ->
|
|
||||||
SessionPrefs.setUnfoldedControlsWithController(this, on); unfoldedControlsWithController = on
|
|
||||||
},
|
|
||||||
onOsc = { o -> SessionPrefs.setOscMode(this, o); oscMode = o },
|
onOsc = { o -> SessionPrefs.setOscMode(this, o); oscMode = o },
|
||||||
onBackActionsInverted = { inverted ->
|
onBackActionsInverted = { inverted ->
|
||||||
SessionPrefs.setBackActionsInverted(this, inverted)
|
SessionPrefs.setBackActionsInverted(this, inverted)
|
||||||
@@ -1724,29 +1661,21 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
syncFallback = SessionPrefs.syncFallback(this)
|
syncFallback = SessionPrefs.syncFallback(this)
|
||||||
},
|
},
|
||||||
onSteamRepair = { steamRepairQueued = SteamRepair.queue(this) },
|
onSteamRepair = { steamRepairQueued = SteamRepair.queue(this) },
|
||||||
onSteamClientArch = { id ->
|
onSteamClientArch = { id -> SessionPrefs.setSteamClientArch(this, id); steamClientArch = id; refresh() },
|
||||||
SessionPrefs.setSteamClientArch(this, id)
|
|
||||||
steamClientArch = id
|
|
||||||
shaderPrecache = SessionPrefs.shaderPrecache(this)
|
|
||||||
refresh()
|
|
||||||
},
|
|
||||||
onMangoapp = { on -> SessionPrefs.setMangoapp(this, on); mangoapp = on },
|
onMangoapp = { on -> SessionPrefs.setMangoapp(this, on); mangoapp = on },
|
||||||
onReturnAfterGame = { on -> SessionPrefs.setReturnAfterGame(this, on); returnAfterGame = on },
|
|
||||||
onShaderPrecache = { on -> SessionPrefs.setShaderPrecache(this, on); shaderPrecache = on },
|
|
||||||
onSteamController = { id -> SessionPrefs.setSteamController(this, id); steamController = id },
|
onSteamController = { id -> SessionPrefs.setSteamController(this, id); steamController = id },
|
||||||
onRunSteamAtStartup = { on ->
|
onRunSteamAtStartup = { on ->
|
||||||
SessionPrefs.setRunSteamAtStartup(this, on)
|
SessionPrefs.setRunSteamAtStartup(this, on)
|
||||||
runSteamAtStartup = on
|
runSteamAtStartup = on
|
||||||
},
|
},
|
||||||
onBootMovie = { id -> com.droiddeck.launcher.session.BootMovie.select(this, id); loadBootMovie() },
|
onBootMovie = { id -> SessionPrefs.setBootMovie(this, id); loadBootMovie() },
|
||||||
onBootMovieSound = { on -> SessionPrefs.setBootMovieSound(this, on); bootMovieSound = on },
|
onBootMovieSound = { on -> SessionPrefs.setBootMovieSound(this, on); bootMovieSound = on },
|
||||||
onImportBootMovie = {
|
onImportBootMovie = {
|
||||||
pickBootMovie.launch(InAppFilePicker.buildIntent(this, com.droiddeck.launcher.session.BootMovie.PICKER_EXTENSIONS, getString(R.string.boot_movie_pick)))
|
pickBootMovie.launch(InAppFilePicker.buildIntent(this, com.droiddeck.launcher.session.BootMovie.PICKER_EXTENSIONS, getString(R.string.boot_movie_pick)))
|
||||||
},
|
},
|
||||||
onBootMovieChanged = { loadBootMovie() },
|
onRemoveBootMovie = { com.droiddeck.launcher.session.BootMovie.removeCustom(this); loadBootMovie() },
|
||||||
onDeckyInstall = { release -> decky.installDecky(release) },
|
onDeckyInstall = { release -> decky.installDecky(release) },
|
||||||
onDeckyCheck = { decky.refreshDecky() },
|
onDeckyCheck = { decky.refreshDecky() },
|
||||||
onDeckyBranch = { branch -> decky.switchDeckyBranch(branch) },
|
|
||||||
onDeckyEnabled = { enabled -> DeckyManager.setSupervisorEnabled(this, enabled); decky.deckySupervisor = enabled },
|
onDeckyEnabled = { enabled -> DeckyManager.setSupervisorEnabled(this, enabled); decky.deckySupervisor = enabled },
|
||||||
onDeckyUninstall = {
|
onDeckyUninstall = {
|
||||||
DeckyManager.uninstall(this, wipeData = false)
|
DeckyManager.uninstall(this, wipeData = false)
|
||||||
@@ -1773,8 +1702,7 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
fsyncFirst = fsyncFirst,
|
fsyncFirst = fsyncFirst,
|
||||||
gamescopeRealtime = gamescopeRealtime,
|
gamescopeRealtime = gamescopeRealtime,
|
||||||
gpuClockPin = gpuClockPin,
|
gpuClockPin = gpuClockPin,
|
||||||
prootNoSeccomp = prootNoSeccomp, prootFastPath = prootFastPath, cursorComposite = cursorComposite,
|
prootNoSeccomp = prootNoSeccomp, prootFastPath = prootFastPath, guestHostname = guestHostname, phantomWarning = phantomWarning,
|
||||||
guestHostname = guestHostname, phantomWarning = phantomWarning,
|
|
||||||
onClientOverride = { on -> SessionPrefs.setClientCpusOverride(this, on); clientOverride = on },
|
onClientOverride = { on -> SessionPrefs.setClientCpusOverride(this, on); clientOverride = on },
|
||||||
onTuSysmem = { on -> SessionPrefs.setTuSysmem(this, on); tuSysmem = on },
|
onTuSysmem = { on -> SessionPrefs.setTuSysmem(this, on); tuSysmem = on },
|
||||||
onZinkLazy = { on -> SessionPrefs.setZinkLazy(this, on); zinkLazy = on },
|
onZinkLazy = { on -> SessionPrefs.setZinkLazy(this, on); zinkLazy = on },
|
||||||
@@ -1788,7 +1716,6 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
onGpuClockPin = { on -> SessionPrefs.setGpuClockPin(this, on); gpuClockPin = on },
|
onGpuClockPin = { on -> SessionPrefs.setGpuClockPin(this, on); gpuClockPin = on },
|
||||||
onProotNoSeccomp = { on -> SessionPrefs.setProotNoSeccomp(this, on); prootNoSeccomp = on },
|
onProotNoSeccomp = { on -> SessionPrefs.setProotNoSeccomp(this, on); prootNoSeccomp = on },
|
||||||
onProotFastPath = { on -> SessionPrefs.setProotFastPath(this, on); prootFastPath = on },
|
onProotFastPath = { on -> SessionPrefs.setProotFastPath(this, on); prootFastPath = on },
|
||||||
onCursorComposite = { on -> SessionPrefs.setCursorComposite(this, on); cursorComposite = on },
|
|
||||||
onGuestHostname = { name -> SessionPrefs.setGuestHostname(this, name) },
|
onGuestHostname = { name -> SessionPrefs.setGuestHostname(this, name) },
|
||||||
onClientCore = { core, on ->
|
onClientCore = { core, on ->
|
||||||
clientCores = if (on) clientCores + core else clientCores - core
|
clientCores = if (on) clientCores + core else clientCores - core
|
||||||
@@ -1831,30 +1758,6 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
}, "steam-art-update").start()
|
}, "steam-art-update").start()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun removeGame(g: Library.SteamGame) {
|
|
||||||
val folder = g.gameFiles ?: return
|
|
||||||
when (com.droiddeck.launcher.frontend.GameRemoval.kind(g)) {
|
|
||||||
com.droiddeck.launcher.frontend.GameRemoval.Kind.LAUNCHER -> Unit
|
|
||||||
com.droiddeck.launcher.frontend.GameRemoval.Kind.SHORTCUT -> removeAddedGame(folder.path, g.gameId, g.name)
|
|
||||||
com.droiddeck.launcher.frontend.GameRemoval.Kind.STORE -> {
|
|
||||||
val installed = com.droiddeck.launcher.frontend.GameRemoval.storeGame(g)
|
|
||||||
if (installed != null) {
|
|
||||||
com.droiddeck.launcher.stores.StoresState.uninstall(this, installed) { refreshAddedGames(); refresh() }
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (g.library == Library.ADDED) {
|
|
||||||
removeAddedGame(folder.path, g.gameId, g.name)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
val target = com.droiddeck.launcher.frontend.GameRemoval.steamFiles(g) ?: return
|
|
||||||
Thread({
|
|
||||||
com.droiddeck.launcher.frontend.GameRemoval.delete(target)
|
|
||||||
ui.post { refreshAddedGames(); refresh() }
|
|
||||||
}, "game-remove").start()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun removeAddedGame(folder: String, appId: Long?, name: String) {
|
private fun removeAddedGame(folder: String, appId: Long?, name: String) {
|
||||||
steamGames = steamGames.filterNot { it.library == Library.ADDED && it.gameFiles?.path == folder }
|
steamGames = steamGames.filterNot { it.library == Library.ADDED && it.gameFiles?.path == folder }
|
||||||
Thread({ com.droiddeck.launcher.frontend.AddedGames.remove(this, java.io.File(folder), appId, name) }, "added-game-remove").start()
|
Thread({ com.droiddeck.launcher.frontend.AddedGames.remove(this, java.io.File(folder), appId, name) }, "added-game-remove").start()
|
||||||
@@ -1888,12 +1791,10 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
|
|
||||||
private var pipAutoEnter by mutableStateOf(false)
|
private var pipAutoEnter by mutableStateOf(false)
|
||||||
private var unfoldedControls by mutableStateOf(false)
|
private var unfoldedControls by mutableStateOf(false)
|
||||||
private var unfoldedControlsWithController by mutableStateOf(false)
|
|
||||||
|
|
||||||
private fun loadModeSettings(mode: String) {
|
private fun loadModeSettings(mode: String) {
|
||||||
pipAutoEnter = SessionPrefs.pipAutoEnter(this)
|
pipAutoEnter = SessionPrefs.pipAutoEnter(this)
|
||||||
unfoldedControls = SessionPrefs.unfoldedControls(this)
|
unfoldedControls = SessionPrefs.unfoldedControls(this)
|
||||||
unfoldedControlsWithController = SessionPrefs.unfoldedControlsWithController(this)
|
|
||||||
resolution = SessionPrefs.resolutionChoice(this, mode, com.droiddeck.launcher.session.SessionDisplay.panelSize(this))
|
resolution = SessionPrefs.resolutionChoice(this, mode, com.droiddeck.launcher.session.SessionDisplay.panelSize(this))
|
||||||
fexPreset = SessionPrefs.fexPreset(this)
|
fexPreset = SessionPrefs.fexPreset(this)
|
||||||
forceSsbs = SessionPrefs.forceSsbs(this)
|
forceSsbs = SessionPrefs.forceSsbs(this)
|
||||||
@@ -1903,8 +1804,6 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
steamClientArch = SessionPrefs.steamClientArch(this)
|
steamClientArch = SessionPrefs.steamClientArch(this)
|
||||||
steamRepairQueued = SteamRepair.queued(this)
|
steamRepairQueued = SteamRepair.queued(this)
|
||||||
mangoapp = SessionPrefs.mangoapp(this)
|
mangoapp = SessionPrefs.mangoapp(this)
|
||||||
returnAfterGame = SessionPrefs.returnAfterGame(this)
|
|
||||||
shaderPrecache = SessionPrefs.shaderPrecache(this)
|
|
||||||
steamController = SessionPrefs.steamController(this)
|
steamController = SessionPrefs.steamController(this)
|
||||||
runSteamAtStartup = SessionPrefs.runSteamAtStartup(this)
|
runSteamAtStartup = SessionPrefs.runSteamAtStartup(this)
|
||||||
loadBootMovie()
|
loadBootMovie()
|
||||||
@@ -1927,6 +1826,9 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
storageDiagnostics = SessionPrefs.storageDiagnosticsEnabled(this)
|
storageDiagnostics = SessionPrefs.storageDiagnosticsEnabled(this)
|
||||||
settingsMode = mode
|
settingsMode = mode
|
||||||
Thread({
|
Thread({
|
||||||
|
val zram = com.droiddeck.launcher.core.ZramSupport.supported()
|
||||||
|
val zramOn = SessionPrefs.zramCompression(this)
|
||||||
|
ui.post { zramSupported = zram; zramCompression = zramOn }
|
||||||
drivers.refreshDrivers()
|
drivers.refreshDrivers()
|
||||||
val storage = GameStorage.options(this)
|
val storage = GameStorage.options(this)
|
||||||
val deckyInstalled = if (mode == SessionService.MODE_STEAM) DeckyManager.installed(this) else null
|
val deckyInstalled = if (mode == SessionService.MODE_STEAM) DeckyManager.installed(this) else null
|
||||||
@@ -1971,7 +1873,6 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
gpuClockPin = SessionPrefs.gpuClockPin(this)
|
gpuClockPin = SessionPrefs.gpuClockPin(this)
|
||||||
prootNoSeccomp = SessionPrefs.prootNoSeccomp(this)
|
prootNoSeccomp = SessionPrefs.prootNoSeccomp(this)
|
||||||
prootFastPath = SessionPrefs.prootFastPath(this)
|
prootFastPath = SessionPrefs.prootFastPath(this)
|
||||||
cursorComposite = SessionPrefs.cursorComposite(this)
|
|
||||||
guestHostname = SessionPrefs.guestHostname(this)
|
guestHostname = SessionPrefs.guestHostname(this)
|
||||||
refreshPhantomStatus()
|
refreshPhantomStatus()
|
||||||
}
|
}
|
||||||
@@ -1981,7 +1882,7 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
val listX64 = SessionPrefs.activeSteamClientArch(this) == "x86_64"
|
val listX64 = SessionPrefs.activeSteamClientArch(this) == "x86_64"
|
||||||
if (listX64 != steamGamesX64) {
|
if (listX64 != steamGamesX64) {
|
||||||
steamGamesX64 = listX64
|
steamGamesX64 = listX64
|
||||||
steamGames = steamGames.filterNot { Library.fromSteamClient(it) || (it.library == Library.ADDED && it.gameId in 1..0xFFFFFFFFL) }
|
steamGames = steamGames.filterNot(Library::fromSteamClient)
|
||||||
}
|
}
|
||||||
if (!busy && LinuxRuntimeInstaller.isBusy()) followRuntimeOperation { LinuxRuntimeInstaller.attach(it) }
|
if (!busy && LinuxRuntimeInstaller.isBusy()) followRuntimeOperation { LinuxRuntimeInstaller.attach(it) }
|
||||||
if (showComponents) drivers.refreshDrivers()
|
if (showComponents) drivers.refreshDrivers()
|
||||||
@@ -2015,13 +1916,12 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
ui.post { if (scanGeneration == libraryScanGeneration) emulatorList = emus }
|
ui.post { if (scanGeneration == libraryScanGeneration) emulatorList = emus }
|
||||||
if (ready) {
|
if (ready) {
|
||||||
val quick = runCatching { Library.steamGames(this) }.getOrNull()
|
val quick = runCatching { Library.steamGames(this) }.getOrNull()
|
||||||
val claimed = quick?.let { runCatching { Library.claimedFolders(it) }.getOrDefault(emptySet()) }.orEmpty()
|
|
||||||
if (quick != null) ui.post {
|
if (quick != null) ui.post {
|
||||||
if (scanGeneration == libraryScanGeneration && steamGames.isNotEmpty()) {
|
if (scanGeneration == libraryScanGeneration && steamGames.isNotEmpty()) {
|
||||||
val before = steamGames.map { it.gameId }.toSet()
|
val before = steamGames.map { it.gameId }.toSet()
|
||||||
val fresh = quick.filter { it.gameId !in before }
|
val fresh = quick.filter { it.gameId !in before }
|
||||||
if (fresh.isNotEmpty()) {
|
if (fresh.isNotEmpty()) {
|
||||||
steamGames = (quick + steamGames.filter { it.library == Library.ADDED && it.gameFiles?.absolutePath.let { path -> path == null || path !in claimed } }).distinctBy { it.gameId }
|
steamGames = (quick + steamGames.filter { it.library == Library.ADDED }).distinctBy { it.gameId }
|
||||||
fresh.forEach { com.droiddeck.launcher.frontend.AutoComponents.queueGame(this, it, asked = false) }
|
fresh.forEach { com.droiddeck.launcher.frontend.AutoComponents.queueGame(this, it, asked = false) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2044,7 +1944,7 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
steamGamesX64 = scannedX64
|
steamGamesX64 = scannedX64
|
||||||
steamGames = all.map { g ->
|
steamGames = all.map { g ->
|
||||||
val newer = current[g.appId]
|
val newer = current[g.appId]
|
||||||
if (newer != null && g.library != Library.ADDED && steamArtRefreshes[g.appId] != artRefreshesAtStart[g.appId]) g.withArt(newer.art, newer.hero, newer.icon, newer.logo) else g
|
if (newer != null && g.library != Library.ADDED && steamArtRefreshes[g.appId] != artRefreshesAtStart[g.appId]) g.withArt(newer.art, newer.hero, newer.icon) else g
|
||||||
}
|
}
|
||||||
shortcutLibraryScanning = false
|
shortcutLibraryScanning = false
|
||||||
handleGameLink(all)
|
handleGameLink(all)
|
||||||
@@ -2060,14 +1960,10 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
private fun onRuntimeButton() {
|
private fun onRuntimeButton() {
|
||||||
if (runtimeChangesBlocked()) return
|
if (runtimeChangesBlocked()) return
|
||||||
val release = available
|
val release = available
|
||||||
if (removalPending) {
|
if (removalPending || installed != null && release?.version == installed) {
|
||||||
showRemove = true
|
showRemove = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (installed != null && release?.version == installed) {
|
|
||||||
showRuntimeActions = release
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (release == null) {
|
if (release == null) {
|
||||||
Thread({ checkCatalog() }, "catalog").start()
|
Thread({ checkCatalog() }, "catalog").start()
|
||||||
return
|
return
|
||||||
@@ -2148,7 +2044,7 @@ class FrontEndActivity : ComponentActivity() {
|
|||||||
com.droiddeck.launcher.core.AppLanguage.setChosen(this, com.droiddeck.launcher.core.AppLanguage.SYSTEM)
|
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()
|
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.ui.Motion.refresh(this)
|
||||||
if (!switchLauncherIcon(LauncherIcon.DARK)) recreate()
|
recreate()
|
||||||
}
|
}
|
||||||
}, "reset-settings").start()
|
}, "reset-settings").start()
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,6 @@ import androidx.activity.ComponentActivity
|
|||||||
import androidx.activity.OnBackPressedCallback
|
import androidx.activity.OnBackPressedCallback
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.collectAsState
|
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableIntStateOf
|
import androidx.compose.runtime.mutableIntStateOf
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
@@ -76,13 +75,11 @@ import com.droiddeck.launcher.input.PadBridge
|
|||||||
import com.droiddeck.launcher.input.PadMouse
|
import com.droiddeck.launcher.input.PadMouse
|
||||||
import com.droiddeck.launcher.input.PadState
|
import com.droiddeck.launcher.input.PadState
|
||||||
import com.droiddeck.launcher.input.SteamControllerBle
|
import com.droiddeck.launcher.input.SteamControllerBle
|
||||||
import com.droiddeck.launcher.input.DirectTouchHold
|
|
||||||
import com.droiddeck.launcher.input.PointerGestures
|
import com.droiddeck.launcher.input.PointerGestures
|
||||||
import com.droiddeck.launcher.input.SecondScreenDisplay
|
import com.droiddeck.launcher.input.SecondScreenDisplay
|
||||||
import com.droiddeck.launcher.input.SecondScreenDisplays
|
import com.droiddeck.launcher.input.SecondScreenDisplays
|
||||||
import com.droiddeck.launcher.input.SecondScreenMode
|
import com.droiddeck.launcher.input.SecondScreenMode
|
||||||
import com.droiddeck.launcher.input.TouchpadGestures
|
import com.droiddeck.launcher.input.TouchpadGestures
|
||||||
import com.droiddeck.launcher.input.TouchscreenGestures
|
|
||||||
import com.droiddeck.launcher.input.ScrollTouchGestures
|
import com.droiddeck.launcher.input.ScrollTouchGestures
|
||||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||||
import com.droiddeck.launcher.session.LoadingState
|
import com.droiddeck.launcher.session.LoadingState
|
||||||
@@ -112,7 +109,7 @@ import com.droiddeck.launcher.ui.HudText
|
|||||||
import com.droiddeck.launcher.ui.LoadingOverlay
|
import com.droiddeck.launcher.ui.LoadingOverlay
|
||||||
import com.droiddeck.launcher.ui.SessionDrawer
|
import com.droiddeck.launcher.ui.SessionDrawer
|
||||||
import com.droiddeck.launcher.ui.SessionPausedOverlay
|
import com.droiddeck.launcher.ui.SessionPausedOverlay
|
||||||
import com.droiddeck.launcher.ui.SecondScreenPresentation
|
import com.droiddeck.launcher.ui.SecondScreenWindow
|
||||||
import com.droiddeck.launcher.ui.DroidDeckTheme
|
import com.droiddeck.launcher.ui.DroidDeckTheme
|
||||||
import com.droiddeck.launcher.wayland.CompositorHost
|
import com.droiddeck.launcher.wayland.CompositorHost
|
||||||
import com.droiddeck.launcher.wayland.WaylandCompositor
|
import com.droiddeck.launcher.wayland.WaylandCompositor
|
||||||
@@ -134,7 +131,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
private var pipUi by mutableStateOf(false)
|
private var pipUi by mutableStateOf(false)
|
||||||
private var pipAutoEnter by mutableStateOf(false)
|
private var pipAutoEnter by mutableStateOf(false)
|
||||||
private var unfoldedControls by mutableStateOf(false)
|
private var unfoldedControls by mutableStateOf(false)
|
||||||
private var unfoldedControlsWithController by mutableStateOf(false)
|
|
||||||
private var picturePosition by mutableStateOf("center")
|
private var picturePosition by mutableStateOf("center")
|
||||||
|
|
||||||
private fun applyGameAlignment() {
|
private fun applyGameAlignment() {
|
||||||
@@ -192,18 +188,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
}
|
}
|
||||||
private var watching = true
|
private var watching = true
|
||||||
private lateinit var touchpad: TouchpadGestures
|
private lateinit var touchpad: TouchpadGestures
|
||||||
private lateinit var directTouchHold: DirectTouchHold
|
|
||||||
private lateinit var threeFingerTap: com.droiddeck.launcher.input.ThreeFingerTap
|
private lateinit var threeFingerTap: com.droiddeck.launcher.input.ThreeFingerTap
|
||||||
private lateinit var touchscreenGestures: TouchscreenGestures
|
|
||||||
private var gestureConfig = com.droiddeck.launcher.input.TouchGestureConfig()
|
|
||||||
private var gestureGame: String? = null
|
|
||||||
private var gestureSettingsOpen by mutableStateOf(false)
|
|
||||||
private var recognizedGesture by mutableStateOf<TouchscreenGestures.Gesture?>(null)
|
|
||||||
private var gesturePointerX = 0f
|
|
||||||
private var gesturePointerY = 0f
|
|
||||||
private var gesturePointerReady = false
|
|
||||||
private val clearRecognizedGesture = Runnable { recognizedGesture = null }
|
|
||||||
private val gestureKeysDown = mutableSetOf<Int>()
|
|
||||||
private lateinit var scrollTouch: ScrollTouchGestures
|
private lateinit var scrollTouch: ScrollTouchGestures
|
||||||
private lateinit var padMouse: PadMouse
|
private lateinit var padMouse: PadMouse
|
||||||
@Volatile private var padMouseOn = false
|
@Volatile private var padMouseOn = false
|
||||||
@@ -224,7 +209,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
private val pointerLockListener = WaylandCompositor.PointerLockListener { locked, _, _ ->
|
private val pointerLockListener = WaylandCompositor.PointerLockListener { locked, _, _ ->
|
||||||
uiHandler.post {
|
uiHandler.post {
|
||||||
if (pointerLocked == locked) return@post
|
if (pointerLocked == locked) return@post
|
||||||
gesturePointerReady = false
|
|
||||||
pointerLocked = locked
|
pointerLocked = locked
|
||||||
Log.i(TAG, "pointer lock " + if (locked) "taken by a program" else "released")
|
Log.i(TAG, "pointer lock " + if (locked) "taken by a program" else "released")
|
||||||
padMouseCheckedAt = 0L
|
padMouseCheckedAt = 0L
|
||||||
@@ -308,11 +292,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
private var achievementsInFront by mutableStateOf<AchievementsInFront?>(null)
|
private var achievementsInFront by mutableStateOf<AchievementsInFront?>(null)
|
||||||
private var achievementsOpen by mutableStateOf(false)
|
private var achievementsOpen by mutableStateOf(false)
|
||||||
private var hudOn by mutableStateOf(true)
|
private var hudOn by mutableStateOf(true)
|
||||||
private var hudFps by mutableStateOf(true)
|
|
||||||
private var hudBattery by mutableStateOf(true)
|
|
||||||
private var hudGraph by mutableStateOf(true)
|
|
||||||
private var hudColor by mutableStateOf(SessionPrefs.HUD_COLOR_MINT)
|
|
||||||
private var hudOpacity by mutableStateOf(SessionPrefs.HUD_OPACITY_DEFAULT)
|
|
||||||
private var upscaler by mutableStateOf(0)
|
private var upscaler by mutableStateOf(0)
|
||||||
private var upscaleSharpness by mutableStateOf(75)
|
private var upscaleSharpness by mutableStateOf(75)
|
||||||
private var effects by mutableStateOf(ScreenEffects.OFF)
|
private var effects by mutableStateOf(ScreenEffects.OFF)
|
||||||
@@ -329,8 +308,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
private var glassesSettings by mutableStateOf(Glasses.settings.value)
|
private var glassesSettings by mutableStateOf(Glasses.settings.value)
|
||||||
private var glassesScreen: GlassesScreen? = null
|
private var glassesScreen: GlassesScreen? = null
|
||||||
private var glassesOutputActive by mutableStateOf(false)
|
private var glassesOutputActive by mutableStateOf(false)
|
||||||
private var pausedFrame by mutableStateOf<com.droiddeck.launcher.ui.PausedFrame?>(null)
|
|
||||||
private var pausedFrameWanted = false
|
|
||||||
private var trackingRecovery by mutableStateOf<TrackingRecovery?>(null)
|
private var trackingRecovery by mutableStateOf<TrackingRecovery?>(null)
|
||||||
private var glasses3dForVr = false
|
private var glasses3dForVr = false
|
||||||
private var ended = false
|
private var ended = false
|
||||||
@@ -369,46 +346,17 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
private var secondScreenDisplays by mutableStateOf<List<SecondScreenDisplay>>(emptyList())
|
private var secondScreenDisplays by mutableStateOf<List<SecondScreenDisplay>>(emptyList())
|
||||||
private var selectedSecondScreenDisplay by mutableStateOf(SessionState.secondScreenDisplay)
|
private var selectedSecondScreenDisplay by mutableStateOf(SessionState.secondScreenDisplay)
|
||||||
private var started = false
|
private var started = false
|
||||||
private var sessionActivityDisplayId = Display.DEFAULT_DISPLAY
|
|
||||||
private lateinit var displayManager: DisplayManager
|
private lateinit var displayManager: DisplayManager
|
||||||
private var secondScreenPresentation: SecondScreenPresentation? = null
|
private var secondScreenPresentation: SecondScreenWindow? = null
|
||||||
private val displayListener = object : DisplayManager.DisplayListener {
|
private val displayListener = object : DisplayManager.DisplayListener {
|
||||||
override fun onDisplayAdded(displayId: Int) {
|
override fun onDisplayAdded(displayId: Int) = refreshSecondScreenDisplays()
|
||||||
notifyActivityDisplayStateChanged(displayId)
|
override fun onDisplayRemoved(displayId: Int) = refreshSecondScreenDisplays()
|
||||||
refreshSecondScreenDisplays()
|
|
||||||
}
|
|
||||||
override fun onDisplayRemoved(displayId: Int) {
|
|
||||||
if (refreshActivityDisplayId() && started) {
|
|
||||||
SessionService.setActivityDisplay(this@SessionActivity, sessionActivityDisplayId)
|
|
||||||
}
|
|
||||||
refreshSecondScreenDisplays()
|
|
||||||
}
|
|
||||||
override fun onDisplayChanged(displayId: Int) {
|
override fun onDisplayChanged(displayId: Int) {
|
||||||
notifyActivityDisplayStateChanged(displayId)
|
|
||||||
followPanelRefresh(displayId)
|
followPanelRefresh(displayId)
|
||||||
refreshSecondScreenDisplays()
|
refreshSecondScreenDisplays()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
private fun currentActivityDisplayId(): Int = windowManager.defaultDisplay.displayId
|
|
||||||
|
|
||||||
private fun refreshActivityDisplayId(): Boolean {
|
|
||||||
val current = if (Build.VERSION.SDK_INT >= 30) display?.displayId ?: currentActivityDisplayId()
|
|
||||||
else currentActivityDisplayId()
|
|
||||||
val changed = sessionActivityDisplayId != current
|
|
||||||
sessionActivityDisplayId = current
|
|
||||||
SessionState.activityDisplayId = current
|
|
||||||
return changed
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun notifyActivityDisplayStateChanged(changedDisplayId: Int) {
|
|
||||||
val changed = refreshActivityDisplayId()
|
|
||||||
if (started && (changed || changedDisplayId == sessionActivityDisplayId)) {
|
|
||||||
SessionService.setActivityDisplay(this, sessionActivityDisplayId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun followPanelRefresh(displayId: Int) {
|
private fun followPanelRefresh(displayId: Int) {
|
||||||
if (!CompositorHost.isStarted) return
|
if (!CompositorHost.isStarted) return
|
||||||
val output = glassesScreen?.display
|
val output = glassesScreen?.display
|
||||||
@@ -507,7 +455,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
|
|
||||||
val bridge = PadBridge(File(LinuxRuntime.sessionRoot(this), "dev/input"))
|
val bridge = PadBridge(File(LinuxRuntime.sessionRoot(this), "dev/input"))
|
||||||
bridge.setSelectSteam(ControllerPrefs.read(this).selectSteam)
|
bridge.setSelectSteam(ControllerPrefs.read(this).selectSteam)
|
||||||
bridge.setBuiltinPad(SessionState.mode != SessionService.MODE_STEAM || SessionPrefs.builtinPad(this))
|
|
||||||
padBridge = bridge
|
padBridge = bridge
|
||||||
SessionState.padBridge = bridge
|
SessionState.padBridge = bridge
|
||||||
if (Build.VERSION.SDK_INT >= 31) {
|
if (Build.VERSION.SDK_INT >= 31) {
|
||||||
@@ -536,20 +483,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
onScreenControls = OnScreenControls(this, bridge, onKeyboard = ::togglePcKeyboard).also { root.addView(it) }
|
onScreenControls = OnScreenControls(this, bridge, onKeyboard = ::togglePcKeyboard).also { root.addView(it) }
|
||||||
keyboard = KeyboardHost(this).also { root.addView(it) }
|
keyboard = KeyboardHost(this).also { root.addView(it) }
|
||||||
touchpad = TouchpadGestures(PointerGestures.slop(this), pointerListener)
|
touchpad = TouchpadGestures(PointerGestures.slop(this), pointerListener)
|
||||||
directTouchHold = DirectTouchHold(PointerGestures.slop(this), pointerListener) {
|
|
||||||
WaylandCompositor.nativeSendTouch(3, -1, 0, 0)
|
|
||||||
}
|
|
||||||
threeFingerTap = com.droiddeck.launcher.input.ThreeFingerTap(PointerGestures.slop(this) * 2)
|
threeFingerTap = com.droiddeck.launcher.input.ThreeFingerTap(PointerGestures.slop(this) * 2)
|
||||||
touchscreenGestures = TouchscreenGestures(
|
|
||||||
ViewConfiguration.get(this).scaledTouchSlop.toFloat(), gestureOutput,
|
|
||||||
)
|
|
||||||
refreshGestureConfig()
|
|
||||||
// A real touch target lets FrameLayout split fingers between the
|
|
||||||
// game surface and on-screen buttons, in either finger-down order.
|
|
||||||
root.isMotionEventSplittingEnabled = true
|
|
||||||
surfaceView.setOnTouchListener { _, event ->
|
|
||||||
routedTouchMode == SessionPrefs.TOUCH_GESTURES && onTouchEvent(event)
|
|
||||||
}
|
|
||||||
padMouse = PadMouse(padMouseListener)
|
padMouse = PadMouse(padMouseListener)
|
||||||
bridge.setTouchRoute(object : PadBridge.TouchRoute {
|
bridge.setTouchRoute(object : PadBridge.TouchRoute {
|
||||||
override fun active(): Boolean = if (Looper.myLooper() == Looper.getMainLooper()) padMouseMode() else padMouseOn
|
override fun active(): Boolean = if (Looper.myLooper() == Looper.getMainLooper()) padMouseMode() else padMouseOn
|
||||||
@@ -566,15 +500,12 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
|
|
||||||
loading = LoadingState(this, steam = loadingMode() == SessionService.MODE_STEAM)
|
loading = LoadingState(this, steam = loadingMode() == SessionService.MODE_STEAM)
|
||||||
if (!SessionState.running) {
|
if (!SessionState.running) {
|
||||||
val repair = intent.getBooleanExtra(EXTRA_REPAIR_RUNTIME, false)
|
val needRuntime = com.droiddeck.launcher.runtime.LinuxRuntimeInstaller.installedVersion(this) == null
|
||||||
intent.removeExtra(EXTRA_REPAIR_RUNTIME)
|
|
||||||
val needRuntime = repair || com.droiddeck.launcher.runtime.LinuxRuntimeInstaller.installedVersion(this) == null
|
|
||||||
val needResume = !needRuntime && com.droiddeck.launcher.runtime.DesktopCatalog.interrupted(this).isNotEmpty()
|
|
||||||
val needDesktop = intent.getStringExtra(SessionService.EXTRA_MODE) == SessionService.MODE_DESKTOP &&
|
val needDesktop = intent.getStringExtra(SessionService.EXTRA_MODE) == SessionService.MODE_DESKTOP &&
|
||||||
(repair || !com.droiddeck.launcher.runtime.DesktopCatalog.desktopInstalled(this))
|
!com.droiddeck.launcher.runtime.DesktopCatalog.desktopInstalled(this)
|
||||||
val needProton = (intent.getStringExtra(SessionService.EXTRA_MODE) ?: SessionService.MODE_STEAM) == SessionService.MODE_STEAM &&
|
val needProton = (intent.getStringExtra(SessionService.EXTRA_MODE) ?: SessionService.MODE_STEAM) == SessionService.MODE_STEAM &&
|
||||||
com.droiddeck.launcher.runtime.DesktopCatalog.protonSeedNeeded(this)
|
com.droiddeck.launcher.runtime.DesktopCatalog.protonSeedNeeded(this)
|
||||||
if (needRuntime || needResume || needDesktop || needProton) installThenStart(needRuntime, needDesktop, needProton, needResume)
|
if (needRuntime || needDesktop || needProton) installThenStart(needRuntime, needDesktop, needProton)
|
||||||
}
|
}
|
||||||
hud = PerfHud(this)
|
hud = PerfHud(this)
|
||||||
hud.onPresentingWindowChanged = {
|
hud.onPresentingWindowChanged = {
|
||||||
@@ -662,7 +593,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
onDispose { com.droiddeck.launcher.glasses.GlassesMenuMirror.setSessionMenuVisible(this@SessionActivity, false) }
|
onDispose { com.droiddeck.launcher.glasses.GlassesMenuMirror.setSessionMenuVisible(this@SessionActivity, false) }
|
||||||
}
|
}
|
||||||
androidx.compose.runtime.LaunchedEffect(drawerOpen, pcKeyboardOpen, achievementsOpen, pipUi) { updatePointerCapture() }
|
androidx.compose.runtime.LaunchedEffect(drawerOpen, pcKeyboardOpen, achievementsOpen, pipUi) { updatePointerCapture() }
|
||||||
androidx.compose.runtime.LaunchedEffect(AgentGuest.steamKeyboard) { updateOnScreenControls() }
|
|
||||||
androidx.compose.runtime.LaunchedEffect(picturePosition, SessionState.running, pipUi, cardboard.enabled) { applyGameAlignment() }
|
androidx.compose.runtime.LaunchedEffect(picturePosition, SessionState.running, pipUi, cardboard.enabled) { applyGameAlignment() }
|
||||||
DroidDeckTheme {
|
DroidDeckTheme {
|
||||||
if (pipUi) {
|
if (pipUi) {
|
||||||
@@ -675,11 +605,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
com.droiddeck.launcher.ui.FocusGlideHost(androidx.compose.ui.Modifier.fillMaxSize()) {
|
com.droiddeck.launcher.ui.FocusGlideHost(androidx.compose.ui.Modifier.fillMaxSize()) {
|
||||||
CursorOverlay({ cursorPos }, cursorVisible, resources.displayMetrics.density,
|
CursorOverlay(cursorPos, cursorVisible, resources.displayMetrics.density,
|
||||||
cursorImage, cursorHotX, cursorHotY, cursorImageScale)
|
cursorImage, cursorHotX, cursorHotY, cursorImageScale)
|
||||||
if (hud.text.isNotEmpty() || hud.graph.size >= 2) HudText(hud.text, hud.graph, hudColor, hudOpacity)
|
if (hud.text.isNotEmpty()) HudText(hud.text)
|
||||||
val phonePanel = glassesOutputActive && !loading.visible && !drawerOpen && !pcKeyboardOpen
|
if (glassesOutputActive && !loading.visible) com.droiddeck.launcher.ui.GlassesPlayingHint(glasses.model)
|
||||||
if (phonePanel) GlassesPhonePanel(glasses, steamVrStatus == SteamVr.Status.RUNNING, headTracking)
|
|
||||||
if (trackingRecovery != null && !drawerOpen && !pcKeyboardOpen && !loading.visible) {
|
if (trackingRecovery != null && !drawerOpen && !pcKeyboardOpen && !loading.visible) {
|
||||||
androidx.compose.ui.viewinterop.AndroidView(
|
androidx.compose.ui.viewinterop.AndroidView(
|
||||||
factory = { com.droiddeck.launcher.ui.TrackingRecoveryView(it) },
|
factory = { com.droiddeck.launcher.ui.TrackingRecoveryView(it) },
|
||||||
@@ -687,14 +616,14 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
update = { it.update(trackingRecovery, !glassesOutputActive && glasses.usable && glasses.sbs) },
|
update = { it.update(trackingRecovery, !glassesOutputActive && glasses.usable && glasses.sbs) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (!phonePanel && GlassesRendering.usesGlasses(glasses, glassesOutputActive, steamVrStatus == SteamVr.Status.RUNNING) &&
|
if (GlassesRendering.usesGlasses(glasses, glassesOutputActive, steamVrStatus == SteamVr.Status.RUNNING) &&
|
||||||
headTracking && !drawerOpen && !pcKeyboardOpen && !loading.visible) com.droiddeck.launcher.ui.GlassesRecenterButton(
|
headTracking && !drawerOpen && !pcKeyboardOpen && !loading.visible) com.droiddeck.launcher.ui.GlassesRecenterButton(
|
||||||
controllerSettings?.tint ?: android.graphics.Color.rgb(90, 160, 255), controllerSettings?.opacity ?: 100,
|
controllerSettings?.tint ?: android.graphics.Color.rgb(90, 160, 255), controllerSettings?.opacity ?: 100,
|
||||||
onRecenterJoyCons = if (steamVrStatus == SteamVr.Status.RUNNING &&
|
onRecenterJoyCons = if (steamVrStatus == SteamVr.Status.RUNNING &&
|
||||||
glasses.usesSpatialControllers(glassesSettings) && glassesSettings.joyConTracking)
|
glasses.usesSpatialControllers(glassesSettings) && glassesSettings.joyConTracking)
|
||||||
joyConVr?.let { { it.recenter() } } else null,
|
joyConVr?.let { { it.recenter() } } else null,
|
||||||
) { headTracker?.recenter() }
|
) { headTracker?.recenter() }
|
||||||
if (!phonePanel && glasses.present && !drawerOpen && !pcKeyboardOpen && !loading.visible) com.droiddeck.launcher.ui.GlassesCornerButton(glassesSlot,
|
if (glasses.present && !drawerOpen && !pcKeyboardOpen && !loading.visible) com.droiddeck.launcher.ui.GlassesCornerButton(glassesSlot,
|
||||||
controllerSettings?.tint ?: android.graphics.Color.rgb(90, 160, 255), controllerSettings?.opacity ?: 100) {
|
controllerSettings?.tint ?: android.graphics.Color.rgb(90, 160, 255), controllerSettings?.opacity ?: 100) {
|
||||||
drawerPage = com.droiddeck.launcher.ui.SessionDrawerPage.GLASSES
|
drawerPage = com.droiddeck.launcher.ui.SessionDrawerPage.GLASSES
|
||||||
drawerOpen = true
|
drawerOpen = true
|
||||||
@@ -706,7 +635,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
onCancel = { SessionService.stop(this@SessionActivity); finish() },
|
onCancel = { SessionService.stop(this@SessionActivity); finish() },
|
||||||
endedDetail = loading.endedDetail,
|
endedDetail = loading.endedDetail,
|
||||||
onRetry = { retrySession() },
|
onRetry = { retrySession() },
|
||||||
onRepair = if (repairOffered) ({ repairRuntime() }) else null,
|
|
||||||
onShareLogs = { shareCurrentSessionLogs() },
|
onShareLogs = { shareCurrentSessionLogs() },
|
||||||
onClose = { finish() },
|
onClose = { finish() },
|
||||||
flood = floodColor?.let { androidx.compose.ui.graphics.Color(it) },
|
flood = floodColor?.let { androidx.compose.ui.graphics.Color(it) },
|
||||||
@@ -715,32 +643,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
window.setBackgroundDrawable(android.graphics.drawable.ColorDrawable(android.graphics.Color.BLACK))
|
window.setBackgroundDrawable(android.graphics.drawable.ColorDrawable(android.graphics.Color.BLACK))
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
LaunchedEffect(AgentGuest.focusRevision) {
|
|
||||||
val nextGame = kotlinx.coroutines.withContext(kotlinx.coroutines.Dispatchers.IO) {
|
|
||||||
if (SessionState.mode == SessionService.MODE_RUN) SessionState.program?.let { "program:$it" }
|
|
||||||
else {
|
|
||||||
val snapshot = AgentGuest.focus(this@SessionActivity)
|
|
||||||
val focused = snapshot?.optLong("focusedApp")?.takeIf { it > 0 && it != 769L }
|
|
||||||
val windows = snapshot?.optJSONArray("focusableApps")
|
|
||||||
focused?.toString() ?: windows?.let { values ->
|
|
||||||
(0 until values.length()).map { values.optLong(it) }
|
|
||||||
.filter { it > 0 && it != 769L }.distinct().singleOrNull()?.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (nextGame != gestureGame) { gestureGame = nextGame; refreshGestureConfig() }
|
|
||||||
}
|
|
||||||
LaunchedEffect(drawerOpen, pcKeyboardOpen, achievementsOpen, gestureSettingsOpen, pipUi, SessionState.suspended) {
|
|
||||||
if (drawerOpen || pcKeyboardOpen || achievementsOpen || gestureSettingsOpen || pipUi || SessionState.suspended) {
|
|
||||||
cancelTouchGestures()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
com.droiddeck.launcher.ui.GestureFeedback(recognizedGesture)
|
|
||||||
if (gestureSettingsOpen) com.droiddeck.launcher.ui.TouchGestureDialog(
|
|
||||||
game = gestureGame,
|
|
||||||
onDismiss = { gestureSettingsOpen = false },
|
|
||||||
onSaved = { gestureSettingsOpen = false; refreshGestureConfig() },
|
|
||||||
)
|
|
||||||
androidx.compose.runtime.LaunchedEffect(drawerOpen) {
|
androidx.compose.runtime.LaunchedEffect(drawerOpen) {
|
||||||
if (drawerOpen) {
|
if (drawerOpen) {
|
||||||
syncLossless()
|
syncLossless()
|
||||||
@@ -776,7 +678,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
achievementsInFront = found
|
achievementsInFront = found
|
||||||
if (found == null) achievementsOpen = false
|
if (found == null) achievementsOpen = false
|
||||||
}
|
}
|
||||||
androidx.compose.runtime.LaunchedEffect(pcKeyboardOpen) { if (pcKeyboardOpen) releasePads(); updateOnScreenControls() }
|
androidx.compose.runtime.LaunchedEffect(pcKeyboardOpen) { if (pcKeyboardOpen) releasePads() }
|
||||||
LaunchedEffect(pcKeyboardOpen, drawerOpen, achievementsOpen) {
|
LaunchedEffect(pcKeyboardOpen, drawerOpen, achievementsOpen) {
|
||||||
if (pcKeyboardOpen || drawerOpen || achievementsOpen) padMouse.reset()
|
if (pcKeyboardOpen || drawerOpen || achievementsOpen) padMouse.reset()
|
||||||
}
|
}
|
||||||
@@ -792,11 +694,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
isHomeApp = isHomeApp,
|
isHomeApp = isHomeApp,
|
||||||
androidApps = androidApps,
|
androidApps = androidApps,
|
||||||
hudOn = hudOn,
|
hudOn = hudOn,
|
||||||
hudFps = hudFps,
|
|
||||||
hudBattery = hudBattery,
|
|
||||||
hudGraph = hudGraph,
|
|
||||||
hudColor = hudColor,
|
|
||||||
hudOpacity = hudOpacity,
|
|
||||||
upscaler = upscaler, upscaleSharpness = upscaleSharpness,
|
upscaler = upscaler, upscaleSharpness = upscaleSharpness,
|
||||||
effects = effects,
|
effects = effects,
|
||||||
cardboard = cardboard,
|
cardboard = cardboard,
|
||||||
@@ -824,11 +721,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
secondScreenDisplays = secondScreenDisplays,
|
secondScreenDisplays = secondScreenDisplays,
|
||||||
selectedSecondScreenDisplay = selectedSecondScreenDisplay,
|
selectedSecondScreenDisplay = selectedSecondScreenDisplay,
|
||||||
onHud = { on -> SessionPrefs.setHudEnabled(this@SessionActivity, on); hudOn = on; hud.refresh() },
|
onHud = { on -> SessionPrefs.setHudEnabled(this@SessionActivity, on); hudOn = on; hud.refresh() },
|
||||||
onHudFps = { on -> SessionPrefs.setHudShowFps(this@SessionActivity, on); hudFps = on; hud.refresh() },
|
|
||||||
onHudBattery = { on -> SessionPrefs.setHudShowBattery(this@SessionActivity, on); hudBattery = on; hud.refresh() },
|
|
||||||
onHudGraph = { on -> SessionPrefs.setHudShowGraph(this@SessionActivity, on); hudGraph = on; hud.refresh() },
|
|
||||||
onHudColor = { color -> SessionPrefs.setHudColor(this@SessionActivity, color); hudColor = color },
|
|
||||||
onHudOpacity = { percent -> SessionPrefs.setHudOpacity(this@SessionActivity, percent); hudOpacity = percent },
|
|
||||||
onUpscaler = { m ->
|
onUpscaler = { m ->
|
||||||
SessionPrefs.setUpscaler(this@SessionActivity, m); upscaler = m
|
SessionPrefs.setUpscaler(this@SessionActivity, m); upscaler = m
|
||||||
WaylandCompositor.nativeSetUpscaler(m)
|
WaylandCompositor.nativeSetUpscaler(m)
|
||||||
@@ -885,7 +777,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
SessionPrefs.setSteamController(this@SessionActivity, id)
|
SessionPrefs.setSteamController(this@SessionActivity, id)
|
||||||
com.droiddeck.launcher.session.SteamDeckPad.showPad(SessionPrefs.padType(id))
|
com.droiddeck.launcher.session.SteamDeckPad.showPad(SessionPrefs.padType(id))
|
||||||
com.droiddeck.launcher.input.FakeInputWriter.setPadType(SessionPrefs.padType(id))
|
com.droiddeck.launcher.input.FakeInputWriter.setPadType(SessionPrefs.padType(id))
|
||||||
com.droiddeck.launcher.session.InputSysfsComponent.padTypeChanged(SessionPrefs.padType(id))
|
|
||||||
padType = id
|
padType = id
|
||||||
},
|
},
|
||||||
backActionsInverted = backActionsInverted,
|
backActionsInverted = backActionsInverted,
|
||||||
@@ -927,7 +818,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
SessionService.suspendPolicyChanged(this@SessionActivity)
|
SessionService.suspendPolicyChanged(this@SessionActivity)
|
||||||
},
|
},
|
||||||
onTouch = { v -> SessionPrefs.setTouchMode(this@SessionActivity, v); readPrefs() },
|
onTouch = { v -> SessionPrefs.setTouchMode(this@SessionActivity, v); readPrefs() },
|
||||||
onGestureSettings = { drawerOpen = false; gestureSettingsOpen = true },
|
|
||||||
onFexPreset = { v -> SessionPrefs.setFexPreset(this@SessionActivity, v); readPrefs() },
|
onFexPreset = { v -> SessionPrefs.setFexPreset(this@SessionActivity, v); readPrefs() },
|
||||||
onSecondScreenMode = ::selectSecondScreenMode,
|
onSecondScreenMode = ::selectSecondScreenMode,
|
||||||
onSecondScreenDisplay = ::selectSecondScreenDisplay,
|
onSecondScreenDisplay = ::selectSecondScreenDisplay,
|
||||||
@@ -955,8 +845,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
},
|
},
|
||||||
unfoldedControls = if (com.droiddeck.launcher.session.SessionDisplay.foldable(this@SessionActivity)) unfoldedControls else null,
|
unfoldedControls = if (com.droiddeck.launcher.session.SessionDisplay.foldable(this@SessionActivity)) unfoldedControls else null,
|
||||||
onUnfoldedControls = ::chooseUnfoldedControls,
|
onUnfoldedControls = ::chooseUnfoldedControls,
|
||||||
unfoldedControlsWithController = unfoldedControlsWithController,
|
|
||||||
onUnfoldedControlsWithController = ::chooseUnfoldedControlsWithController,
|
|
||||||
onBackground = { drawerOpen = false; pip.background(); moveTaskToBack(true) },
|
onBackground = { drawerOpen = false; pip.background(); moveTaskToBack(true) },
|
||||||
onShareLogs = { drawerOpen = false; shareCurrentSessionLogs() },
|
onShareLogs = { drawerOpen = false; shareCurrentSessionLogs() },
|
||||||
onStop = { drawerOpen = false; SessionService.stop(this@SessionActivity); finish() },
|
onStop = { drawerOpen = false; SessionService.stop(this@SessionActivity); finish() },
|
||||||
@@ -1015,20 +903,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
SessionAchievements(inFront.game, inFront.title, onClose = ::closeAchievements)
|
SessionAchievements(inFront.game, inFront.title, onClose = ::closeAchievements)
|
||||||
}
|
}
|
||||||
com.droiddeck.launcher.ui.AchievementNotificationOverlay()
|
com.droiddeck.launcher.ui.AchievementNotificationOverlay()
|
||||||
// Auto and Native resume on their own as the session comes back; only a failed resume needs the button.
|
if (SessionState.suspended) SessionPausedOverlay(
|
||||||
val autoResume = suspendPolicy == SessionPrefs.SUSPEND_AUTO || suspendPolicy == SessionPrefs.SUSPEND_NATIVE
|
|
||||||
SessionPausedOverlay(
|
|
||||||
suspended = SessionState.suspended && (!autoResume || SessionState.resumeFailed),
|
|
||||||
engaged = SessionState.resumeRequested || SessionState.resuming,
|
|
||||||
failures = SessionState.resumeFailures,
|
|
||||||
frame = pausedFrame,
|
|
||||||
title = pausedTitle(),
|
title = pausedTitle(),
|
||||||
onResume = { SessionService.resume(this@SessionActivity) },
|
onResume = { SessionService.resume(this@SessionActivity) },
|
||||||
onFrameNeeded = ::requestPausedFrame,
|
|
||||||
onHidden = {
|
|
||||||
pausedFrame = null
|
|
||||||
pausedFrameWanted = false
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
if (leaving) com.droiddeck.launcher.ui.FloodSpread(
|
if (leaving) com.droiddeck.launcher.ui.FloodSpread(
|
||||||
com.droiddeck.launcher.ui.LocalPalette.current.signal,
|
com.droiddeck.launcher.ui.LocalPalette.current.signal,
|
||||||
@@ -1061,54 +938,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
}, 90)
|
}, 90)
|
||||||
}
|
}
|
||||||
|
|
||||||
@androidx.compose.runtime.Composable
|
|
||||||
private fun GlassesPhonePanel(glasses: com.droiddeck.launcher.glasses.GlassesState, vr: Boolean, headTracking: Boolean) {
|
|
||||||
val battery by androidx.compose.runtime.produceState<String?>(null) {
|
|
||||||
while (true) {
|
|
||||||
val b = registerReceiver(null, android.content.IntentFilter(android.content.Intent.ACTION_BATTERY_CHANGED))
|
|
||||||
val level = b?.getIntExtra(android.os.BatteryManager.EXTRA_LEVEL, -1) ?: -1
|
|
||||||
val scale = b?.getIntExtra(android.os.BatteryManager.EXTRA_SCALE, 100) ?: 100
|
|
||||||
val tenths = b?.getIntExtra(android.os.BatteryManager.EXTRA_TEMPERATURE, -1) ?: -1
|
|
||||||
value = if (level < 0) null else getString(R.string.glasses_phone_battery, level * 100 / scale.coerceAtLeast(1), tenths / 10)
|
|
||||||
kotlinx.coroutines.delay(30_000)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val pads = com.droiddeck.launcher.input.VrControllers.settings.collectAsState().value
|
|
||||||
com.droiddeck.launcher.ui.GlassesPhonePanel(glasses.model, battery, com.droiddeck.launcher.ui.GlassesPhoneActions(
|
|
||||||
onRecenter = if (headTracking) ({ headTracker?.recenter() }) else null,
|
|
||||||
onRecenterJoyCons = if (vr && glasses.usesSpatialControllers(glassesSettings) && glassesSettings.joyConTracking)
|
|
||||||
joyConVr?.let { { it.recenter() } } else null,
|
|
||||||
onSteamVrMenu = if (vr && SessionState.mode == SessionService.MODE_STEAM) ({ sendSteamGuide() }) else null,
|
|
||||||
onSwitchSticks = if (vr && pads.emulate != com.droiddeck.launcher.input.VrControllers.Emulate.OFF) ({ switchVrSticks() }) else null,
|
|
||||||
controllers = getString(when (pads.emulate) {
|
|
||||||
com.droiddeck.launcher.input.VrControllers.Emulate.OFF -> R.string.vr_controllers_off
|
|
||||||
com.droiddeck.launcher.input.VrControllers.Emulate.INDEX -> R.string.vr_controllers_index
|
|
||||||
com.droiddeck.launcher.input.VrControllers.Emulate.TOUCH -> R.string.vr_controllers_touch
|
|
||||||
com.droiddeck.launcher.input.VrControllers.Emulate.VIVE -> R.string.vr_controllers_vive
|
|
||||||
}),
|
|
||||||
onNextControllers = if (vr) ({
|
|
||||||
val all = com.droiddeck.launcher.input.VrControllers.Emulate.entries
|
|
||||||
com.droiddeck.launcher.input.VrControllers.setEmulate(this, all[(pads.emulate.ordinal + 1) % all.size])
|
|
||||||
}) else null,
|
|
||||||
onKeyboard = { keyboard?.toggle() },
|
|
||||||
onSessionMenu = { drawerOpen = true },
|
|
||||||
onStopSteamVr = if (vr) ({ steamVrAction("stop") }) else null,
|
|
||||||
brightness = glasses.brightness,
|
|
||||||
brightnessMax = glasses.brightnessMax,
|
|
||||||
onBrightness = if (glasses.canControl && glasses.hardwareControls) Glasses::setBrightness else null,
|
|
||||||
))
|
|
||||||
}
|
|
||||||
|
|
||||||
/** The SteamVR driver switches pad sticks between hands and game on both stick clicks together. */
|
|
||||||
private fun switchVrSticks() {
|
|
||||||
val chord = { down: Boolean -> padBridge?.applyTouch { state ->
|
|
||||||
state.press(com.droiddeck.launcher.input.PadState.L3, down)
|
|
||||||
state.press(com.droiddeck.launcher.input.PadState.R3, down)
|
|
||||||
} }
|
|
||||||
chord(true)
|
|
||||||
uiHandler.postDelayed({ chord(false) }, 120)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun triggerSteamQam() {
|
private fun triggerSteamQam() {
|
||||||
drawerOpen = false
|
drawerOpen = false
|
||||||
padBridge?.triggerQam()
|
padBridge?.triggerQam()
|
||||||
@@ -1452,14 +1281,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
private fun readPrefs() {
|
private fun readPrefs() {
|
||||||
pipAutoEnter = SessionPrefs.pipAutoEnter(this)
|
pipAutoEnter = SessionPrefs.pipAutoEnter(this)
|
||||||
unfoldedControls = SessionPrefs.unfoldedControls(this)
|
unfoldedControls = SessionPrefs.unfoldedControls(this)
|
||||||
unfoldedControlsWithController = SessionPrefs.unfoldedControlsWithController(this)
|
|
||||||
picturePosition = SessionPrefs.picturePosition(this)
|
picturePosition = SessionPrefs.picturePosition(this)
|
||||||
hudOn = SessionPrefs.hudEnabled(this)
|
hudOn = SessionPrefs.hudEnabled(this)
|
||||||
hudFps = SessionPrefs.hudShowFps(this)
|
|
||||||
hudBattery = SessionPrefs.hudShowBattery(this)
|
|
||||||
hudGraph = SessionPrefs.hudShowGraph(this)
|
|
||||||
hudColor = SessionPrefs.hudColor(this)
|
|
||||||
hudOpacity = SessionPrefs.hudOpacity(this)
|
|
||||||
upscaler = SessionPrefs.upscaler(this)
|
upscaler = SessionPrefs.upscaler(this)
|
||||||
upscaleSharpness = SessionPrefs.upscaleSharpness(this)
|
upscaleSharpness = SessionPrefs.upscaleSharpness(this)
|
||||||
effects = SessionPrefs.screenEffects(this)
|
effects = SessionPrefs.screenEffects(this)
|
||||||
@@ -1473,7 +1296,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
val nextTouchMode = SessionPrefs.touchMode(this)
|
val nextTouchMode = SessionPrefs.touchMode(this)
|
||||||
if (touchMode != nextTouchMode) {
|
if (touchMode != nextTouchMode) {
|
||||||
if (::touchpad.isInitialized) touchpad.cancel()
|
if (::touchpad.isInitialized) touchpad.cancel()
|
||||||
if (::directTouchHold.isInitialized) directTouchHold.cancel()
|
|
||||||
if (::scrollTouch.isInitialized) scrollTouch.cancel()
|
if (::scrollTouch.isInitialized) scrollTouch.cancel()
|
||||||
if (CompositorHost.isStarted) {
|
if (CompositorHost.isStarted) {
|
||||||
WaylandCompositor.nativeSendTouch(3, -1, 0, 0)
|
WaylandCompositor.nativeSendTouch(3, -1, 0, 0)
|
||||||
@@ -1498,18 +1320,17 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
|
|
||||||
|
|
||||||
@Volatile private var installingRuntime = false
|
@Volatile private var installingRuntime = false
|
||||||
private var repairOffered by mutableStateOf(false)
|
|
||||||
|
|
||||||
private fun installThenStart(runtime: Boolean, desktop: Boolean, proton: Boolean = false, resume: Boolean = false) {
|
private fun installThenStart(runtime: Boolean, desktop: Boolean, proton: Boolean = false) {
|
||||||
if (SessionState.stopRequested) return
|
if (SessionState.stopRequested) return
|
||||||
installingRuntime = true
|
installingRuntime = true
|
||||||
SessionState.installing = if (runtime) "runtime" else if (resume) "package" else if (desktop) "desktop" else "proton"
|
SessionState.installing = if (runtime) "runtime" else if (desktop) "desktop" else "proton"
|
||||||
SessionEvents.transition(
|
SessionEvents.transition(
|
||||||
SessionPhase.INSTALLING_RUNTIME,
|
SessionPhase.INSTALLING_RUNTIME,
|
||||||
"${SessionState.installing}.installing",
|
"${SessionState.installing}.installing",
|
||||||
mapOf("component" to SessionState.installing),
|
mapOf("component" to SessionState.installing),
|
||||||
)
|
)
|
||||||
val first = if (runtime || resume) RUNTIME_LINES else if (desktop) DESKTOP_LINES else PROTON_LINES
|
val first = if (runtime) RUNTIME_LINES else if (desktop) DESKTOP_LINES else PROTON_LINES
|
||||||
loading.say(getString(first.downloading), first.topic, readable = true)
|
loading.say(getString(first.downloading), first.topic, readable = true)
|
||||||
loading.percent = -1
|
loading.percent = -1
|
||||||
Thread({
|
Thread({
|
||||||
@@ -1519,13 +1340,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
problem = installRuntime()
|
problem = installRuntime()
|
||||||
if (problem == null) SessionEvents.record("runtime.ready") else failedComponent = "runtime"
|
if (problem == null) SessionEvents.record("runtime.ready") else failedComponent = "runtime"
|
||||||
}
|
}
|
||||||
if (problem == null && resume && !SessionState.stopRequested) {
|
|
||||||
SessionState.installing = "package"
|
|
||||||
SessionEvents.transition(SessionPhase.INSTALLING_RUNTIME, "package.resuming", mapOf("component" to "package"))
|
|
||||||
problem = com.droiddeck.launcher.runtime.DesktopCatalog.resumeInterrupted(this, progressAsIs())
|
|
||||||
?.let { getString(R.string.session_package_resume_failed, it) }
|
|
||||||
if (problem == null) SessionEvents.record("package.ready") else failedComponent = "package"
|
|
||||||
}
|
|
||||||
if (problem == null && desktop && !SessionState.stopRequested) {
|
if (problem == null && desktop && !SessionState.stopRequested) {
|
||||||
SessionState.installing = "desktop"
|
SessionState.installing = "desktop"
|
||||||
SessionEvents.transition(SessionPhase.INSTALLING_RUNTIME, "desktop.installing", mapOf("component" to "desktop"))
|
SessionEvents.transition(SessionPhase.INSTALLING_RUNTIME, "desktop.installing", mapOf("component" to "desktop"))
|
||||||
@@ -1550,11 +1364,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
return@post
|
return@post
|
||||||
}
|
}
|
||||||
if (problem != null) {
|
if (problem != null) {
|
||||||
val code = when (failedComponent) {
|
val code = if (failedComponent == "runtime") "RUNTIME_INSTALL_FAILED" else "DESKTOP_INSTALL_FAILED"
|
||||||
"runtime" -> "RUNTIME_INSTALL_FAILED"
|
|
||||||
"package" -> "PACKAGE_RESUME_FAILED"
|
|
||||||
else -> "DESKTOP_INSTALL_FAILED"
|
|
||||||
}
|
|
||||||
SessionEvents.fail(code, problem)
|
SessionEvents.fail(code, problem)
|
||||||
collectStartArtifacts("session start failed")
|
collectStartArtifacts("session start failed")
|
||||||
loading.showEnded(problem)
|
loading.showEnded(problem)
|
||||||
@@ -1602,17 +1412,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun progressAsIs() = com.droiddeck.launcher.runtime.LinuxRuntimeInstaller.ProgressListener { stage, percent ->
|
|
||||||
uiHandler.post {
|
|
||||||
loading.percent = percent
|
|
||||||
loading.say(stage, LoadingState.Topic.RUNTIME, readable = true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun installRuntime(): String? {
|
private fun installRuntime(): String? {
|
||||||
val release = com.droiddeck.launcher.runtime.LinuxRuntimeInstaller.fetchRelease()
|
val release = com.droiddeck.launcher.runtime.LinuxRuntimeInstaller.fetchRelease()
|
||||||
?: return getString(R.string.session_runtime_catalog_unreachable)
|
?: return getString(R.string.session_runtime_catalog_unreachable)
|
||||||
runCatching { com.droiddeck.launcher.runtime.RuntimeInstallService.start(this, release) }
|
|
||||||
val ok = com.droiddeck.launcher.runtime.LinuxRuntimeInstaller.install(this, release,
|
val ok = com.droiddeck.launcher.runtime.LinuxRuntimeInstaller.install(this, release,
|
||||||
progressFor(RUNTIME_LINES, release.size / 1_000_000))
|
progressFor(RUNTIME_LINES, release.size / 1_000_000))
|
||||||
return if (ok) null else getString(R.string.session_runtime_install_failed)
|
return if (ok) null else getString(R.string.session_runtime_install_failed)
|
||||||
@@ -1642,14 +1444,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
}
|
}
|
||||||
val runtimeDir = File(filesDir, ".wayland-rt").apply { mkdirs() }
|
val runtimeDir = File(filesDir, ".wayland-rt").apply { mkdirs() }
|
||||||
FileUtils.copyAsset(this, "wayland/keymap.xkb", File(runtimeDir, "keymap.xkb"))
|
FileUtils.copyAsset(this, "wayland/keymap.xkb", File(runtimeDir, "keymap.xkb"))
|
||||||
com.droiddeck.launcher.input.VrControllers.publish(this)
|
|
||||||
|
|
||||||
val turnip = TurnipDriver(this)
|
val turnip = TurnipDriver(this)
|
||||||
com.droiddeck.launcher.gpu.DriverSetupLog.write(this, "surface.driver-setup")
|
com.droiddeck.launcher.gpu.DriverSetupLog.write(this, "surface.driver-setup")
|
||||||
if (!CompositorHost.isStarted) {
|
if (!CompositorHost.isStarted) CompositorHost.displayChoice = SessionPrefs.androidDriver(this)
|
||||||
CompositorHost.displayChoice = SessionPrefs.androidDriver(this)
|
|
||||||
com.droiddeck.launcher.gpu.AutoDriverTrial.displayStarting(this, SessionPrefs.androidDriver(this))
|
|
||||||
}
|
|
||||||
val driverId = if (CompositorHost.isStarted) null else turnip.install()
|
val driverId = if (CompositorHost.isStarted) null else turnip.install()
|
||||||
|
|
||||||
val previous = SessionState.outputSize
|
val previous = SessionState.outputSize
|
||||||
@@ -1706,7 +1504,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
}
|
}
|
||||||
com.droiddeck.launcher.gpu.DriverSetupLog.write(this, "compositor.start driver=$driverId")
|
com.droiddeck.launcher.gpu.DriverSetupLog.write(this, "compositor.start driver=$driverId")
|
||||||
CompositorHost.startOrAttach(
|
CompositorHost.startOrAttach(
|
||||||
this, holder.surface, runtimeDir.path,
|
holder.surface, runtimeDir.path,
|
||||||
driverId?.let { turnip.driverPath(it) }, driverId?.let { turnip.libraryName(it) },
|
driverId?.let { turnip.driverPath(it) }, driverId?.let { turnip.libraryName(it) },
|
||||||
applicationInfo.nativeLibraryDir, size.first, size.second, refreshHz(), outputFpsLimit(),
|
applicationInfo.nativeLibraryDir, size.first, size.second, refreshHz(), outputFpsLimit(),
|
||||||
)
|
)
|
||||||
@@ -1724,7 +1522,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
intent.getStringExtra(SessionService.EXTRA_STEAM_UI),
|
intent.getStringExtra(SessionService.EXTRA_STEAM_UI),
|
||||||
intent.getStringExtra(SessionService.EXTRA_STEAM_URL),
|
intent.getStringExtra(SessionService.EXTRA_STEAM_URL),
|
||||||
intent.getStringArrayExtra(SessionService.EXTRA_PROGRAM_ARGS),
|
intent.getStringArrayExtra(SessionService.EXTRA_PROGRAM_ARGS),
|
||||||
sessionActivityDisplayId,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
applyFrameGen()
|
applyFrameGen()
|
||||||
@@ -1740,7 +1537,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
surfaceW = width
|
surfaceW = width
|
||||||
surfaceH = height
|
surfaceH = height
|
||||||
if (resized) {
|
if (resized) {
|
||||||
cancelTouchGestures()
|
|
||||||
Log.i(TAG, "surface resized to ${width}x$height - rebinding the compositor")
|
Log.i(TAG, "surface resized to ${width}x$height - rebinding the compositor")
|
||||||
CompositorHost.resize(holder.surface) { applyFrameGen() }
|
CompositorHost.resize(holder.surface) { applyFrameGen() }
|
||||||
followWindow(width, height)
|
followWindow(width, height)
|
||||||
@@ -1759,7 +1555,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun followChoice(): Boolean {
|
private fun followChoice(): Boolean {
|
||||||
val mode = displayMode()
|
val mode = SessionPrefs.prefMode(intent.getStringExtra(SessionService.EXTRA_MODE) ?: SessionService.MODE_STEAM)
|
||||||
return SessionPrefs.resolutionChoice(this, mode, com.droiddeck.launcher.session.SessionDisplay.panelSize(this)) ==
|
return SessionPrefs.resolutionChoice(this, mode, com.droiddeck.launcher.session.SessionDisplay.panelSize(this)) ==
|
||||||
com.droiddeck.launcher.session.SessionDisplay.FOLLOW_SCREEN
|
com.droiddeck.launcher.session.SessionDisplay.FOLLOW_SCREEN
|
||||||
}
|
}
|
||||||
@@ -1775,10 +1571,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
|
|
||||||
override fun onConfigurationChanged(newConfig: android.content.res.Configuration) {
|
override fun onConfigurationChanged(newConfig: android.content.res.Configuration) {
|
||||||
super.onConfigurationChanged(newConfig)
|
super.onConfigurationChanged(newConfig)
|
||||||
if (refreshActivityDisplayId() && started) {
|
|
||||||
SessionService.setActivityDisplay(this, sessionActivityDisplayId)
|
|
||||||
}
|
|
||||||
cancelTouchGestures()
|
|
||||||
applyFollowOrientation(newConfig)
|
applyFollowOrientation(newConfig)
|
||||||
applyUnfoldedControls()
|
applyUnfoldedControls()
|
||||||
}
|
}
|
||||||
@@ -1787,21 +1579,12 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
// Hiding the phone surface after a handoff delivers a late destruction
|
// Hiding the phone surface after a handoff delivers a late destruction
|
||||||
// callback. It must not reset the new output's size or attachment.
|
// callback. It must not reset the new output's size or attachment.
|
||||||
if (holder !== outputHolder()) return
|
if (holder !== outputHolder()) return
|
||||||
cancelTouchGestures()
|
|
||||||
surfaceW = 0
|
surfaceW = 0
|
||||||
surfaceH = 0
|
surfaceH = 0
|
||||||
glassesOutputActive = false
|
glassesOutputActive = false
|
||||||
CompositorHost.detach(holder.surface)
|
CompositorHost.detach(holder.surface)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun cancelTouchGestures() {
|
|
||||||
if (::touchscreenGestures.isInitialized) touchscreenGestures.cancel()
|
|
||||||
if (::touchpad.isInitialized) touchpad.cancel()
|
|
||||||
if (::scrollTouch.isInitialized) scrollTouch.cancel()
|
|
||||||
scrollTouchGesture = false
|
|
||||||
gesturePointerReady = false
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun panelBounds(): android.graphics.Rect = if (Build.VERSION.SDK_INT >= 30) {
|
private fun panelBounds(): android.graphics.Rect = if (Build.VERSION.SDK_INT >= 30) {
|
||||||
windowManager.maximumWindowMetrics.bounds
|
windowManager.maximumWindowMetrics.bounds
|
||||||
} else {
|
} else {
|
||||||
@@ -1811,11 +1594,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
android.graphics.Rect(0, 0, metrics.widthPixels, metrics.heightPixels)
|
android.graphics.Rect(0, 0, metrics.widthPixels, metrics.heightPixels)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun displayMode(): String = SessionPrefs.displayMode(this,
|
|
||||||
intent.getStringExtra(SessionService.EXTRA_MODE) ?: SessionService.MODE_STEAM, intent.getStringExtra(SessionService.EXTRA_PROGRAM))
|
|
||||||
|
|
||||||
private fun outputSize(): Pair<Int, Int> {
|
private fun outputSize(): Pair<Int, Int> {
|
||||||
val mode = displayMode()
|
val mode = SessionPrefs.prefMode(intent.getStringExtra(SessionService.EXTRA_MODE) ?: SessionService.MODE_STEAM)
|
||||||
val panel = com.droiddeck.launcher.session.SessionDisplay.panelSize(this)
|
val panel = com.droiddeck.launcher.session.SessionDisplay.panelSize(this)
|
||||||
val program = intent.getStringExtra(SessionService.EXTRA_PROGRAM)
|
val program = intent.getStringExtra(SessionService.EXTRA_PROGRAM)
|
||||||
val choice = if (intent.getStringExtra(SessionService.EXTRA_MODE) == SessionService.MODE_RUN &&
|
val choice = if (intent.getStringExtra(SessionService.EXTRA_MODE) == SessionService.MODE_RUN &&
|
||||||
@@ -1829,9 +1609,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
glassesScreen?.hz?.takeIf { it > 1f }?.let { return it }
|
glassesScreen?.hz?.takeIf { it > 1f }?.let { return it }
|
||||||
val display = if (Build.VERSION.SDK_INT >= 30) display else windowManager.defaultDisplay
|
val display = if (Build.VERSION.SDK_INT >= 30) display else windowManager.defaultDisplay
|
||||||
val wanted = window.attributes.preferredDisplayModeId
|
val wanted = window.attributes.preferredDisplayModeId
|
||||||
val requested = display?.supportedModes?.firstOrNull { wanted != 0 && it.modeId == wanted }?.refreshRate
|
val hz = display?.supportedModes?.firstOrNull { wanted != 0 && it.modeId == wanted }?.refreshRate
|
||||||
val running = display?.refreshRate?.takeIf { it > 1f }
|
?: display?.refreshRate ?: 60f
|
||||||
val hz = listOfNotNull(requested, running).minOrNull() ?: 60f
|
|
||||||
val mirrorCap = mirrorRefreshLimit().takeIf { it > 0 }?.toFloat() ?: Float.POSITIVE_INFINITY
|
val mirrorCap = mirrorRefreshLimit().takeIf { it > 0 }?.toFloat() ?: Float.POSITIVE_INFINITY
|
||||||
val capped = minOf(hz, PerfMode.peakRefreshCap(this), mirrorCap)
|
val capped = minOf(hz, PerfMode.peakRefreshCap(this), mirrorCap)
|
||||||
return if (capped > 1f) capped else 60f
|
return if (capped > 1f) capped else 60f
|
||||||
@@ -1935,7 +1714,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
Thread({
|
Thread({
|
||||||
val hint = runtimeDamageHint() ?: sessionEndHint(SessionState.logFile)
|
val hint = sessionEndHint(SessionState.logFile)
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
if (isFinishing || isDestroyed) return@runOnUiThread
|
if (isFinishing || isDestroyed) return@runOnUiThread
|
||||||
showEnded(status, hint)
|
showEnded(status, hint)
|
||||||
@@ -1954,7 +1733,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
SessionService.MODE_DESKTOP -> getString(R.string.session_ended_desktop)
|
SessionService.MODE_DESKTOP -> getString(R.string.session_ended_desktop)
|
||||||
else -> getString(R.string.session_ended_named, "Steam")
|
else -> getString(R.string.session_ended_named, "Steam")
|
||||||
}
|
}
|
||||||
repairOffered = hint?.repair == true
|
|
||||||
loading.showEnded(
|
loading.showEnded(
|
||||||
hint?.text ?: stopped,
|
hint?.text ?: stopped,
|
||||||
getString(R.string.session_ended_detail, status, SessionState.logFile?.path ?: getString(R.string.session_ended_no_log)),
|
getString(R.string.session_ended_detail, status, SessionState.logFile?.path ?: getString(R.string.session_ended_no_log)),
|
||||||
@@ -1973,13 +1751,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
uiHandler.post { sessionOverlay.requestFocus() }
|
uiHandler.post { sessionOverlay.requestFocus() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun repairRuntime() {
|
|
||||||
val again = Intent(intent).putExtra(EXTRA_REPAIR_RUNTIME, true)
|
|
||||||
closeAtOnce = true
|
|
||||||
finish()
|
|
||||||
startActivity(again)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun retrySession() {
|
private fun retrySession() {
|
||||||
val again = Intent(intent)
|
val again = Intent(intent)
|
||||||
closeAtOnce = true
|
closeAtOnce = true
|
||||||
@@ -1987,14 +1758,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
startActivity(again)
|
startActivity(again)
|
||||||
}
|
}
|
||||||
|
|
||||||
private class EndHint(val text: String, val evenOnSuccess: Boolean = false, val repair: Boolean = false)
|
private class EndHint(val text: String, val evenOnSuccess: Boolean = false)
|
||||||
|
|
||||||
private fun runtimeDamageHint(): EndHint? {
|
|
||||||
val broken = runCatching { com.droiddeck.launcher.runtime.RuntimeHealth.brokenLibraryLinks(this) }.getOrDefault(emptyList())
|
|
||||||
if (broken.isEmpty()) return null
|
|
||||||
Log.w(TAG, "runtime has ${broken.size} broken library link(s): ${broken.take(8).joinToString()}")
|
|
||||||
return EndHint(resources.getQuantityString(R.plurals.session_end_runtime_damaged, broken.size, broken.size, broken.first()), repair = true)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun sessionEndHint(log: File?): EndHint? {
|
private fun sessionEndHint(log: File?): EndHint? {
|
||||||
if (log == null || !log.isFile) return null
|
if (log == null || !log.isFile) return null
|
||||||
@@ -2002,22 +1766,17 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
var enosys = 0
|
var enosys = 0
|
||||||
var fexMissing = false
|
var fexMissing = false
|
||||||
val size = log.length()
|
val size = log.length()
|
||||||
val text = java.io.RandomAccessFile(log, "r").use { f ->
|
java.io.RandomAccessFile(log, "r").use { f ->
|
||||||
val start = maxOf(0L, size - 512L * 1024)
|
val start = maxOf(0L, size - 512L * 1024)
|
||||||
f.seek(start)
|
f.seek(start)
|
||||||
val bytes = ByteArray((size - start).toInt())
|
val bytes = ByteArray((size - start).toInt())
|
||||||
f.readFully(bytes)
|
f.readFully(bytes)
|
||||||
String(bytes, Charsets.ISO_8859_1)
|
String(bytes, Charsets.ISO_8859_1).lineSequence().forEach { line ->
|
||||||
|
if (line.contains("Function not implemented")) enosys++
|
||||||
|
if (line.contains(FEX_MISSING)) fexMissing = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
text.lineSequence().forEach { line ->
|
if (fexMissing) {
|
||||||
if (line.contains("Function not implemented")) enosys++
|
|
||||||
if (line.contains(FEX_MISSING)) fexMissing = true
|
|
||||||
}
|
|
||||||
val steamSetup = com.droiddeck.launcher.session.SteamClientSetupFailure.find(text.lineSequence())
|
|
||||||
if (steamSetup != null) {
|
|
||||||
val message = getString(if (steamSetup.download) R.string.session_end_steam_download else R.string.session_end_steam_setup)
|
|
||||||
EndHint(listOfNotNull(message, steamSetup.curlError).joinToString("\n"))
|
|
||||||
} else if (fexMissing) {
|
|
||||||
val what = com.droiddeck.launcher.frontend.Library.nameForProgram(SessionState.program) ?: getString(R.string.session_end_program)
|
val what = com.droiddeck.launcher.frontend.Library.nameForProgram(SessionState.program) ?: getString(R.string.session_end_program)
|
||||||
EndHint(getString(R.string.session_end_fex_missing, what), evenOnSuccess = true)
|
EndHint(getString(R.string.session_end_fex_missing, what), evenOnSuccess = true)
|
||||||
} else if (enosys >= 8) {
|
} else if (enosys >= 8) {
|
||||||
@@ -2060,7 +1819,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
if (drawerOpen) {
|
if (drawerOpen) {
|
||||||
if (fromController && (event.keyCode == KeyEvent.KEYCODE_BUTTON_L1 || event.keyCode == KeyEvent.KEYCODE_BUTTON_R1)) {
|
if (fromController && (event.keyCode == KeyEvent.KEYCODE_BUTTON_L1 || event.keyCode == KeyEvent.KEYCODE_BUTTON_R1)) {
|
||||||
if (event.action == KeyEvent.ACTION_DOWN && event.repeatCount == 0) {
|
if (event.action == KeyEvent.ACTION_DOWN && event.repeatCount == 0) {
|
||||||
drawerPage = sessionDrawerPages(secondScreenDisplays.isNotEmpty(), glasses.present)
|
drawerPage = sessionDrawerPages(SessionState.mode == SessionService.MODE_STEAM && secondScreenDisplays.isNotEmpty(), glasses.present)
|
||||||
.step(drawerPage, if (event.keyCode == KeyEvent.KEYCODE_BUTTON_R1) 1 else -1)
|
.step(drawerPage, if (event.keyCode == KeyEvent.KEYCODE_BUTTON_R1) 1 else -1)
|
||||||
releaseDrawerDirection()
|
releaseDrawerDirection()
|
||||||
}
|
}
|
||||||
@@ -2223,55 +1982,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
super.dispatchKeyEvent(event)
|
super.dispatchKeyEvent(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun refreshGestureConfig() {
|
|
||||||
gestureConfig = com.droiddeck.launcher.input.GesturePrefs.read(this, gestureGame)
|
|
||||||
if (::touchscreenGestures.isInitialized) touchscreenGestures.configure(gestureConfig)
|
|
||||||
gesturePointerReady = false
|
|
||||||
recognizedGesture = null
|
|
||||||
}
|
|
||||||
|
|
||||||
private val gestureOutput = object : TouchscreenGestures.Output {
|
|
||||||
override fun moveTo(x: Float, y: Float) {
|
|
||||||
val rect = drawnRect() ?: return
|
|
||||||
if (pointerLocked) {
|
|
||||||
if (gesturePointerReady) moveBy(x - gesturePointerX, y - gesturePointerY, true)
|
|
||||||
} else movePointer(x, y)
|
|
||||||
gesturePointerX = if (pointerLocked) x else x.coerceIn(rect.left, rect.right)
|
|
||||||
gesturePointerY = if (pointerLocked) y else y.coerceIn(rect.top, rect.bottom)
|
|
||||||
gesturePointerReady = true
|
|
||||||
cursorVisible = false
|
|
||||||
}
|
|
||||||
override fun moveBy(dx: Float, dy: Float, relative: Boolean) {
|
|
||||||
val rect = drawnRect() ?: return
|
|
||||||
if (relative || pointerLocked) {
|
|
||||||
val scale = SessionState.outputSize.first / rect.width()
|
|
||||||
WaylandCompositor.sendPointerDelta(dx * scale, dy * scale)
|
|
||||||
} else moveTo(gesturePointerX + dx, gesturePointerY + dy)
|
|
||||||
}
|
|
||||||
override fun button(code: Int, down: Boolean) {
|
|
||||||
WaylandCompositor.nativeSendSceneInput(3, code, if (down) 1 else 0)
|
|
||||||
}
|
|
||||||
override fun prepareRelativePan() {
|
|
||||||
if (pointerLocked) return
|
|
||||||
val rect = drawnRect() ?: return
|
|
||||||
// Gamescope retains the last absolute position while a game can warp
|
|
||||||
// its own cursor to the center. Its first unlocked motion must start
|
|
||||||
// from that same origin, before the game switches to pointer lock.
|
|
||||||
moveTo(rect.centerX(), rect.centerY())
|
|
||||||
}
|
|
||||||
override fun key(code: Int, down: Boolean) {
|
|
||||||
if (down) gestureKeysDown.add(code) else gestureKeysDown.remove(code)
|
|
||||||
if (code !in guestKeysDown) WaylandCompositor.nativeSendKey(code, if (down) 1 else 0)
|
|
||||||
}
|
|
||||||
override fun wheel(steps: Int) { WaylandCompositor.nativeSendSceneInput(4, steps, 0) }
|
|
||||||
override fun showKeyboard() { uiHandler.post { touchscreenGestures.cancel(); togglePcKeyboard() } }
|
|
||||||
override fun gesture(gesture: TouchscreenGestures.Gesture) {
|
|
||||||
recognizedGesture = gesture
|
|
||||||
uiHandler.removeCallbacks(clearRecognizedGesture)
|
|
||||||
uiHandler.postDelayed(clearRecognizedGesture, 1200)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private val pointerListener = object : PointerGestures.Listener {
|
private val pointerListener = object : PointerGestures.Listener {
|
||||||
override fun onMove(x: Float, y: Float) {
|
override fun onMove(x: Float, y: Float) {
|
||||||
if (pointerLocked) moveLockedPointer(x, y) else movePointer(x, y)
|
if (pointerLocked) moveLockedPointer(x, y) else movePointer(x, y)
|
||||||
@@ -2406,13 +2116,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
private val shownOnDisplayId: Int get() =
|
|
||||||
if (Build.VERSION.SDK_INT >= 30) display?.displayId ?: windowManager.defaultDisplay.displayId
|
|
||||||
else windowManager.defaultDisplay.displayId
|
|
||||||
|
|
||||||
private fun refreshSecondScreenDisplays() {
|
private fun refreshSecondScreenDisplays() {
|
||||||
if (!::displayManager.isInitialized) return
|
if (!::displayManager.isInitialized) return
|
||||||
val primaryId = shownOnDisplayId
|
val primaryId = display?.displayId ?: windowManager.defaultDisplay.displayId
|
||||||
val candidates = SecondScreenDisplays.available(displayManager, primaryId)
|
val candidates = SecondScreenDisplays.available(displayManager, primaryId)
|
||||||
.filter { glassesScreen == null || it.id != glasses.displayId }
|
.filter { glassesScreen == null || it.id != glasses.displayId }
|
||||||
val oldIds = secondScreenDisplays.map { it.id }.toSet()
|
val oldIds = secondScreenDisplays.map { it.id }.toSet()
|
||||||
@@ -2459,7 +2165,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
var presentation = secondScreenPresentation
|
var presentation = secondScreenPresentation
|
||||||
if (presentation?.display?.displayId != target.displayId) {
|
if (presentation?.display?.displayId != target.displayId) {
|
||||||
presentation?.closeControls()
|
presentation?.closeControls()
|
||||||
presentation = SecondScreenPresentation(
|
presentation = SecondScreenWindow(
|
||||||
this, target,
|
this, target,
|
||||||
sendPointer = ::moveSecondScreenPointer,
|
sendPointer = ::moveSecondScreenPointer,
|
||||||
sendButton = { button, pressed ->
|
sendButton = { button, pressed ->
|
||||||
@@ -2504,12 +2210,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
applyUnfoldedControls()
|
applyUnfoldedControls()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun chooseUnfoldedControlsWithController(on: Boolean) {
|
|
||||||
SessionPrefs.setUnfoldedControlsWithController(this, on)
|
|
||||||
unfoldedControlsWithController = on
|
|
||||||
applyUnfoldedControls()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun refreshControls() {
|
private fun refreshControls() {
|
||||||
applyUnfoldedControls()
|
applyUnfoldedControls()
|
||||||
updateOnScreenControls()
|
updateOnScreenControls()
|
||||||
@@ -2519,17 +2219,11 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
if (!::sessionRoot.isInitialized) return
|
if (!::sessionRoot.isInitialized) return
|
||||||
val width = sessionRoot.width
|
val width = sessionRoot.width
|
||||||
val height = sessionRoot.height
|
val height = sessionRoot.height
|
||||||
val wanted = com.droiddeck.launcher.session.SessionDisplay.unfoldedControlsWanted(
|
val wanted = unfoldedControls && com.droiddeck.launcher.session.SessionDisplay.foldable(this) &&
|
||||||
enabled = unfoldedControls,
|
!PadBridge.anyControllerConnected() && !SteamControllerBle.connected &&
|
||||||
foldable = com.droiddeck.launcher.session.SessionDisplay.foldable(this),
|
SessionState.mode == SessionService.MODE_STEAM && SessionState.deckPad &&
|
||||||
controllerConnected = PadBridge.anyControllerConnected() || SteamControllerBle.connected,
|
!pipUi && !isInPictureInPictureMode && width > 0 && height > 0 &&
|
||||||
keepWithController = unfoldedControlsWithController,
|
resources.configuration.smallestScreenWidthDp >= com.droiddeck.launcher.session.SessionDisplay.UNFOLDED_MIN_DP
|
||||||
steamDeckPad = SessionState.mode == SessionService.MODE_STEAM && SessionState.deckPad,
|
|
||||||
pip = pipUi || isInPictureInPictureMode,
|
|
||||||
width = width,
|
|
||||||
height = height,
|
|
||||||
smallestWidthDp = resources.configuration.smallestScreenWidthDp,
|
|
||||||
)
|
|
||||||
val gameHeight = if (wanted) com.droiddeck.launcher.session.SessionDisplay.unfoldedGameHeight(width, height)
|
val gameHeight = if (wanted) com.droiddeck.launcher.session.SessionDisplay.unfoldedGameHeight(width, height)
|
||||||
else FrameLayout.LayoutParams.MATCH_PARENT
|
else FrameLayout.LayoutParams.MATCH_PARENT
|
||||||
val params = surfaceView.layoutParams as FrameLayout.LayoutParams
|
val params = surfaceView.layoutParams as FrameLayout.LayoutParams
|
||||||
@@ -2578,7 +2272,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
if (options == null || steamTouchControls?.visibility != View.VISIBLE) return SessionPrefs.touchMode(this)
|
if (options == null || steamTouchControls?.visibility != View.VISIBLE) return SessionPrefs.touchMode(this)
|
||||||
return when {
|
return when {
|
||||||
options.inputMode == com.droiddeck.launcher.input.SteamTouchConfig.INPUT_CONTROLLER -> SessionPrefs.TOUCH_OFF
|
options.inputMode == com.droiddeck.launcher.input.SteamTouchConfig.INPUT_CONTROLLER -> SessionPrefs.TOUCH_OFF
|
||||||
SessionPrefs.touchMode(this) == SessionPrefs.TOUCH_GESTURES -> SessionPrefs.TOUCH_GESTURES
|
|
||||||
options.mouseMode == com.droiddeck.launcher.input.SteamTouchConfig.MOUSE_RELATIVE -> SessionPrefs.TOUCH_PAD
|
options.mouseMode == com.droiddeck.launcher.input.SteamTouchConfig.MOUSE_RELATIVE -> SessionPrefs.TOUCH_PAD
|
||||||
else -> SessionPrefs.TOUCH_DIRECT
|
else -> SessionPrefs.TOUCH_DIRECT
|
||||||
}
|
}
|
||||||
@@ -2591,10 +2284,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
touchpad.sensitivity = 1.15f * speed
|
touchpad.sensitivity = 1.15f * speed
|
||||||
}
|
}
|
||||||
if (next == routedTouchMode) return
|
if (next == routedTouchMode) return
|
||||||
if (::touchscreenGestures.isInitialized) touchscreenGestures.cancel()
|
|
||||||
gesturePointerReady = false
|
|
||||||
if (::touchpad.isInitialized) touchpad.cancel()
|
if (::touchpad.isInitialized) touchpad.cancel()
|
||||||
if (::directTouchHold.isInitialized) directTouchHold.cancel()
|
|
||||||
if (::scrollTouch.isInitialized) scrollTouch.cancel()
|
if (::scrollTouch.isInitialized) scrollTouch.cancel()
|
||||||
if (CompositorHost.isStarted) WaylandCompositor.nativeSendTouch(3, -1, 0, 0)
|
if (CompositorHost.isStarted) WaylandCompositor.nativeSendTouch(3, -1, 0, 0)
|
||||||
if (next == SessionPrefs.TOUCH_OFF) cursorVisible = false
|
if (next == SessionPrefs.TOUCH_OFF) cursorVisible = false
|
||||||
@@ -2629,11 +2319,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
|
|
||||||
override fun onTouchEvent(event: MotionEvent): Boolean {
|
override fun onTouchEvent(event: MotionEvent): Boolean {
|
||||||
if (event.isFromSource(android.view.InputDevice.SOURCE_MOUSE)) return onMouse(event)
|
if (event.isFromSource(android.view.InputDevice.SOURCE_MOUSE)) return onMouse(event)
|
||||||
if (drawerOpen || pcKeyboardOpen || achievementsOpen || gestureSettingsOpen || pipUi || SessionState.suspended) return true
|
|
||||||
if (routedTouchMode == SessionPrefs.TOUCH_GESTURES) {
|
|
||||||
if (event.actionMasked == MotionEvent.ACTION_DOWN) gesturePointerReady = false
|
|
||||||
return touchscreenGestures.onTouch(event)
|
|
||||||
}
|
|
||||||
if (event.actionMasked == MotionEvent.ACTION_DOWN) {
|
if (event.actionMasked == MotionEvent.ACTION_DOWN) {
|
||||||
scrollTouchGesture = scrollTouchMode()
|
scrollTouchGesture = scrollTouchMode()
|
||||||
scrollRestX = 0f
|
scrollRestX = 0f
|
||||||
@@ -2667,7 +2352,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
if (event.actionMasked == MotionEvent.ACTION_UP || event.actionMasked == MotionEvent.ACTION_CANCEL) ignoreGameTouch = false
|
if (event.actionMasked == MotionEvent.ACTION_UP || event.actionMasked == MotionEvent.ACTION_CANCEL) ignoreGameTouch = false
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if (directTouchHold.onTouch(event)) return true
|
|
||||||
fun sendTouch(action: Int, index: Int) {
|
fun sendTouch(action: Int, index: Int) {
|
||||||
val x = event.getX(index).coerceIn(rect.left, rect.right)
|
val x = event.getX(index).coerceIn(rect.left, rect.right)
|
||||||
val y = event.getY(index).coerceIn(rect.top, rect.bottom)
|
val y = event.getY(index).coerceIn(rect.top, rect.bottom)
|
||||||
@@ -2811,14 +2495,12 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
?.let { FileUtils.readString(it)?.trim()?.lowercase() }
|
?.let { FileUtils.readString(it)?.trim()?.lowercase() }
|
||||||
?: SessionPrefs.oscMode(this)
|
?: SessionPrefs.oscMode(this)
|
||||||
val controls = onScreenControls ?: return
|
val controls = onScreenControls ?: return
|
||||||
if (pipUi || unfoldedPanel != null || pcKeyboardOpen ||
|
if (pipUi || unfoldedPanel != null) {
|
||||||
(SessionState.mode == SessionService.MODE_STEAM && !SessionPrefs.builtinPad(this))) {
|
|
||||||
onScreenButtonsVisible = false
|
onScreenButtonsVisible = false
|
||||||
controls.releaseAll()
|
controls.releaseAll()
|
||||||
controls.visibility = View.GONE
|
controls.visibility = View.GONE
|
||||||
steamTouchControls?.let { it.releaseAll(); it.visibility = View.GONE }
|
steamTouchControls?.let { it.releaseAll(); it.visibility = View.GONE }
|
||||||
com.droiddeck.launcher.input.SteamTouchDevice.current?.plugged = false
|
com.droiddeck.launcher.input.SteamTouchDevice.current?.plugged = false
|
||||||
applyTouchRouting()
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val buttonsOnly = forced == SessionPrefs.OSC_STEAM_QAM
|
val buttonsOnly = forced == SessionPrefs.OSC_STEAM_QAM
|
||||||
@@ -2831,7 +2513,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
if (steam == null) {
|
if (steam == null) {
|
||||||
steamTouchControls?.let { it.releaseAll(); it.visibility = View.GONE }
|
steamTouchControls?.let { it.releaseAll(); it.visibility = View.GONE }
|
||||||
com.droiddeck.launcher.input.SteamTouchDevice.current?.plugged = false
|
com.droiddeck.launcher.input.SteamTouchDevice.current?.plugged = false
|
||||||
applyTouchRouting()
|
|
||||||
}
|
}
|
||||||
controls.setButtonsOnly(buttonsOnly)
|
controls.setButtonsOnly(buttonsOnly)
|
||||||
val show = when (forced) {
|
val show = when (forced) {
|
||||||
@@ -2844,77 +2525,29 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
SessionState.mode != SessionService.MODE_DESKTOP
|
SessionState.mode != SessionService.MODE_DESKTOP
|
||||||
}
|
}
|
||||||
onScreenButtonsVisible = show
|
onScreenButtonsVisible = show
|
||||||
val drawn = show && !keyboardCoversPad()
|
|
||||||
if (steam != null) {
|
if (steam != null) {
|
||||||
if (controls.visibility == View.VISIBLE) { controls.releaseAll(); controls.visibility = View.GONE }
|
if (controls.visibility == View.VISIBLE) { controls.releaseAll(); controls.visibility = View.GONE }
|
||||||
if (!drawn) steam.releaseAll()
|
if (!show) steam.releaseAll()
|
||||||
steam.visibility = if (drawn) View.VISIBLE else View.GONE
|
steam.visibility = if (show) View.VISIBLE else View.GONE
|
||||||
com.droiddeck.launcher.input.SteamTouchDevice.current?.plugged = show
|
com.droiddeck.launcher.input.SteamTouchDevice.current?.plugged = show
|
||||||
applyTouchRouting()
|
applyTouchRouting()
|
||||||
Log.i(TAG, "on-screen controls: Steam's touch controller " + if (drawn) "shown" else "hidden")
|
Log.i(TAG, "on-screen controls: Steam's touch controller " + if (show) "shown" else "hidden")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (drawn == (controls.visibility == View.VISIBLE)) return
|
if (show == (controls.visibility == View.VISIBLE)) return
|
||||||
if (!drawn) controls.releaseAll()
|
if (!show) controls.releaseAll()
|
||||||
controls.visibility = if (drawn) View.VISIBLE else View.GONE
|
controls.visibility = if (show) View.VISIBLE else View.GONE
|
||||||
Log.i(TAG, "on-screen controls " + when {
|
Log.i(TAG, "on-screen controls " + when {
|
||||||
!drawn -> "hidden"
|
!show -> "hidden"
|
||||||
buttonsOnly -> "Steam + QAM"
|
buttonsOnly -> "Steam + QAM"
|
||||||
else -> "full pad"
|
else -> "full pad"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun keyboardCoversPad() =
|
|
||||||
SessionState.mode == SessionService.MODE_STEAM && AgentGuest.steamKeyboard
|
|
||||||
|
|
||||||
private fun sendGuestKey(code: Int, down: Boolean) {
|
private fun sendGuestKey(code: Int, down: Boolean) {
|
||||||
if (down && pipUi) return
|
if (down && pipUi) return
|
||||||
if (down) guestKeysDown.add(code) else guestKeysDown.remove(code)
|
if (down) guestKeysDown.add(code) else guestKeysDown.remove(code)
|
||||||
if (down || code !in gestureKeysDown) WaylandCompositor.nativeSendKey(code, if (down) 1 else 0)
|
WaylandCompositor.nativeSendKey(code, if (down) 1 else 0)
|
||||||
}
|
|
||||||
|
|
||||||
// The frozen game cannot draw again, so the paused overlay shows a copy taken while the surface still holds its frame.
|
|
||||||
private fun capturePausedFrame() {
|
|
||||||
if (!SessionState.running || pipUi || isInPictureInPictureMode || glassesOutputActive) return
|
|
||||||
if (SessionState.suspended && pausedFrame != null) return
|
|
||||||
if (suspendPolicy == SessionPrefs.SUSPEND_NEVER || !::surfaceView.isInitialized) return
|
|
||||||
if (surfaceView.holder.surface?.isValid != true) return
|
|
||||||
val width = surfaceView.width
|
|
||||||
val height = surfaceView.height
|
|
||||||
if (width <= 0 || height <= 0) return
|
|
||||||
val scale = minOf(1f, PAUSED_FRAME_MAX_EDGE / maxOf(width, height).toFloat())
|
|
||||||
val bitmap = try {
|
|
||||||
android.graphics.Bitmap.createBitmap(
|
|
||||||
maxOf(1, (width * scale).toInt()), maxOf(1, (height * scale).toInt()), android.graphics.Bitmap.Config.ARGB_8888,
|
|
||||||
)
|
|
||||||
} catch (_: OutOfMemoryError) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
val surfaceAt = IntArray(2).also { surfaceView.getLocationInWindow(it) }
|
|
||||||
val overlayAt = IntArray(2).also { sessionOverlay.getLocationInWindow(it) }
|
|
||||||
val left = surfaceAt[0] - overlayAt[0]
|
|
||||||
val top = surfaceAt[1] - overlayAt[1]
|
|
||||||
val bounds = android.graphics.Rect(left, top, left + width, top + height)
|
|
||||||
try {
|
|
||||||
android.view.PixelCopy.request(surfaceView, bitmap, { result ->
|
|
||||||
if (result == android.view.PixelCopy.SUCCESS && !isDestroyed) {
|
|
||||||
pausedFrame = com.droiddeck.launcher.ui.PausedFrame(bitmap.asImageBitmap(), bounds)
|
|
||||||
pausedFrameWanted = false
|
|
||||||
} else {
|
|
||||||
bitmap.recycle()
|
|
||||||
}
|
|
||||||
}, uiHandler)
|
|
||||||
} catch (_: IllegalArgumentException) {
|
|
||||||
bitmap.recycle()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sessions that froze from picture-in-picture, or before onPause could copy a frame, have none; the
|
|
||||||
// compositor shows the frozen frame again once its output is back, so copy it from there.
|
|
||||||
private fun requestPausedFrame() {
|
|
||||||
if (pausedFrame != null) return
|
|
||||||
pausedFrameWanted = true
|
|
||||||
if (resumed && surfaceW > 0) capturePausedFrame()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun pipBounds(): android.graphics.Rect {
|
private fun pipBounds(): android.graphics.Rect {
|
||||||
@@ -2942,7 +2575,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
releasePads()
|
releasePads()
|
||||||
touchpad.cancel()
|
touchpad.cancel()
|
||||||
scrollTouch.cancel()
|
scrollTouch.cancel()
|
||||||
directTouchHold.cancel()
|
|
||||||
guestKeysDown.toList().forEach { sendGuestKey(it, false) }
|
guestKeysDown.toList().forEach { sendGuestKey(it, false) }
|
||||||
keyboard?.hide()
|
keyboard?.hide()
|
||||||
sessionClipboard.stop()
|
sessionClipboard.stop()
|
||||||
@@ -2992,12 +2624,11 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
super.onStart()
|
super.onStart()
|
||||||
if (runtimeRemovalBlocked) return
|
if (runtimeRemovalBlocked) return
|
||||||
started = true
|
started = true
|
||||||
refreshActivityDisplayId()
|
|
||||||
displayManager.registerDisplayListener(displayListener, Handler(Looper.getMainLooper()))
|
displayManager.registerDisplayListener(displayListener, Handler(Looper.getMainLooper()))
|
||||||
refreshSecondScreenDisplays()
|
refreshSecondScreenDisplays()
|
||||||
if (secondScreenMode != SecondScreenMode.NONE && secondScreenPresentation == null) showSecondScreen(secondScreenMode)
|
if (secondScreenMode != SecondScreenMode.NONE && secondScreenPresentation == null) showSecondScreen(secondScreenMode)
|
||||||
startedScreens++
|
startedScreens++
|
||||||
SessionService.setActivityVisible(this, true, sessionActivityDisplayId)
|
SessionService.setActivityVisible(this, true)
|
||||||
Glasses.rescan()
|
Glasses.rescan()
|
||||||
updateGlassesScreen()
|
updateGlassesScreen()
|
||||||
updateHandCamera()
|
updateHandCamera()
|
||||||
@@ -3011,7 +2642,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
closeSecondScreen(reset = false)
|
closeSecondScreen(reset = false)
|
||||||
startedScreens = (startedScreens - 1).coerceAtLeast(0)
|
startedScreens = (startedScreens - 1).coerceAtLeast(0)
|
||||||
updateGlassesScreen()
|
updateGlassesScreen()
|
||||||
if (startedScreens == 0) SessionService.setActivityVisible(this, false, sessionActivityDisplayId)
|
if (startedScreens == 0) SessionService.setActivityVisible(this, false)
|
||||||
super.onStop()
|
super.onStop()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3042,12 +2673,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
if (refreshActivityDisplayId() && started) {
|
|
||||||
SessionService.setActivityDisplay(this, sessionActivityDisplayId)
|
|
||||||
}
|
|
||||||
applyFollowOrientation(resources.configuration)
|
applyFollowOrientation(resources.configuration)
|
||||||
if (runtimeRemovalBlocked) return
|
if (runtimeRemovalBlocked) return
|
||||||
if (!SessionState.suspended) pausedFrame = null
|
|
||||||
com.droiddeck.launcher.ui.Motion.refresh(this)
|
com.droiddeck.launcher.ui.Motion.refresh(this)
|
||||||
refreshHomeApp()
|
refreshHomeApp()
|
||||||
if (intent?.action == SessionService.ACTION_RESUME) {
|
if (intent?.action == SessionService.ACTION_RESUME) {
|
||||||
@@ -3073,13 +2700,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
if (runtimeRemovalBlocked) { super.onPause(); return }
|
if (runtimeRemovalBlocked) { super.onPause(); return }
|
||||||
capturePausedFrame()
|
|
||||||
sessionClipboard.stop()
|
sessionClipboard.stop()
|
||||||
if (::touchscreenGestures.isInitialized) touchscreenGestures.cancel()
|
|
||||||
if (::touchpad.isInitialized) touchpad.cancel()
|
|
||||||
if (::directTouchHold.isInitialized) directTouchHold.cancel()
|
|
||||||
uiHandler.removeCallbacks(clearRecognizedGesture)
|
|
||||||
gestureSettingsOpen = false
|
|
||||||
drawerOpen = false
|
drawerOpen = false
|
||||||
pcKeyboardOpen = false
|
pcKeyboardOpen = false
|
||||||
achievementsOpen = false
|
achievementsOpen = false
|
||||||
@@ -3312,9 +2933,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
surfaceView.visibility = if (glassesOutputActive) View.INVISIBLE else View.VISIBLE
|
surfaceView.visibility = if (glassesOutputActive) View.INVISIBLE else View.VISIBLE
|
||||||
Log.i(TAG, "compositor output attached: " +
|
Log.i(TAG, "compositor output attached: " +
|
||||||
if (glassesOutputActive) "glasses display ${glassesScreen?.display?.displayId}" else "phone")
|
if (glassesOutputActive) "glasses display ${glassesScreen?.display?.displayId}" else "phone")
|
||||||
if (pausedFrameWanted) uiHandler.postDelayed({
|
|
||||||
if (pausedFrameWanted && pausedFrame == null && resumed) capturePausedFrame()
|
|
||||||
}, PAUSED_FRAME_REDRAW_MS)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun restorePhoneOutput(screen: GlassesScreen) {
|
private fun restorePhoneOutput(screen: GlassesScreen) {
|
||||||
@@ -3332,7 +2950,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
private fun glassesOutputSize(): Pair<Int, Int>? {
|
private fun glassesOutputSize(): Pair<Int, Int>? {
|
||||||
if (glassesScreen == null || glasses.width <= 0 || glasses.height <= 0) return null
|
if (glassesScreen == null || glasses.width <= 0 || glasses.height <= 0) return null
|
||||||
val panel = (if (glasses.sbs) glasses.width / 2 else glasses.width) to glasses.height
|
val panel = (if (glasses.sbs) glasses.width / 2 else glasses.width) to glasses.height
|
||||||
val mode = displayMode()
|
val mode = SessionPrefs.prefMode(intent.getStringExtra(SessionService.EXTRA_MODE) ?: SessionService.MODE_STEAM)
|
||||||
val display = com.droiddeck.launcher.session.SessionDisplay
|
val display = com.droiddeck.launcher.session.SessionDisplay
|
||||||
val choice = SessionPrefs.resolutionChoice(this, mode, panel)
|
val choice = SessionPrefs.resolutionChoice(this, mode, panel)
|
||||||
val size = display.resolveChoice(panel, choice)
|
val size = display.resolveChoice(panel, choice)
|
||||||
@@ -3458,10 +3076,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
super.onWindowFocusChanged(hasFocus)
|
super.onWindowFocusChanged(hasFocus)
|
||||||
if (!hasFocus && ::padMouse.isInitialized) padMouse.reset()
|
if (!hasFocus && ::padMouse.isInitialized) padMouse.reset()
|
||||||
if (runtimeRemovalBlocked) return
|
if (runtimeRemovalBlocked) return
|
||||||
if (!hasFocus) {
|
|
||||||
if (::touchscreenGestures.isInitialized) touchscreenGestures.cancel()
|
|
||||||
if (::touchpad.isInitialized) touchpad.cancel()
|
|
||||||
}
|
|
||||||
if (hasFocus && !pipUi) {
|
if (hasFocus && !pipUi) {
|
||||||
goFullscreen()
|
goFullscreen()
|
||||||
refreshClipboard()
|
refreshClipboard()
|
||||||
@@ -3531,7 +3145,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
|
|
||||||
private fun finishFlooded() {
|
private fun finishFlooded() {
|
||||||
if (isFinishing) return
|
if (isFinishing) return
|
||||||
val signal = com.droiddeck.launcher.ui.Themes.current(this).signal
|
val signal = com.droiddeck.launcher.ui.Themes.byId(SessionPrefs.theme(this)).signal
|
||||||
com.droiddeck.launcher.ui.QuitFlood.mark(signal.toArgb())
|
com.droiddeck.launcher.ui.QuitFlood.mark(signal.toArgb())
|
||||||
window.setBackgroundDrawable(android.graphics.drawable.ColorDrawable(signal.toArgb()))
|
window.setBackgroundDrawable(android.graphics.drawable.ColorDrawable(signal.toArgb()))
|
||||||
quitFlooded = true
|
quitFlooded = true
|
||||||
@@ -3562,7 +3176,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
|
|
||||||
private fun completeLeave() {
|
private fun completeLeave() {
|
||||||
if (isFinishing) return
|
if (isFinishing) return
|
||||||
val signal = com.droiddeck.launcher.ui.Themes.current(this).signal
|
val signal = com.droiddeck.launcher.ui.Themes.byId(SessionPrefs.theme(this)).signal
|
||||||
com.droiddeck.launcher.ui.QuitFlood.mark(signal.toArgb())
|
com.droiddeck.launcher.ui.QuitFlood.mark(signal.toArgb())
|
||||||
window.setBackgroundDrawable(android.graphics.drawable.ColorDrawable(signal.toArgb()))
|
window.setBackgroundDrawable(android.graphics.drawable.ColorDrawable(signal.toArgb()))
|
||||||
quitFlooded = true
|
quitFlooded = true
|
||||||
@@ -3572,10 +3186,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
companion object {
|
companion object {
|
||||||
const val EXTRA_RETURN_HOME = "returnHome"
|
const val EXTRA_RETURN_HOME = "returnHome"
|
||||||
const val EXTRA_STEAMVR = "steamVr"
|
const val EXTRA_STEAMVR = "steamVr"
|
||||||
const val EXTRA_REPAIR_RUNTIME = "repairRuntime"
|
|
||||||
private const val LEAVE_TIMEOUT_MS = 1_500L
|
private const val LEAVE_TIMEOUT_MS = 1_500L
|
||||||
private const val PAUSED_FRAME_MAX_EDGE = 1920f
|
|
||||||
private const val PAUSED_FRAME_REDRAW_MS = 150L
|
|
||||||
private const val TAG = "SessionActivity"
|
private const val TAG = "SessionActivity"
|
||||||
private var startedScreens = 0
|
private var startedScreens = 0
|
||||||
private const val FEX_MISSING = "droiddeck-fex: x86 Linux programs need"
|
private const val FEX_MISSING = "droiddeck-fex: x86 Linux programs need"
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import android.os.Handler
|
|||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableIntStateOf
|
import androidx.compose.runtime.mutableIntStateOf
|
||||||
import androidx.compose.runtime.mutableStateOf
|
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import android.os.FileObserver
|
import android.os.FileObserver
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
@@ -20,8 +19,6 @@ object AgentGuest {
|
|||||||
private val main by lazy { Handler(Looper.getMainLooper()) }
|
private val main by lazy { Handler(Looper.getMainLooper()) }
|
||||||
var focusRevision by mutableIntStateOf(0)
|
var focusRevision by mutableIntStateOf(0)
|
||||||
private set
|
private set
|
||||||
var steamKeyboard by mutableStateOf(false)
|
|
||||||
private set
|
|
||||||
private const val TAG = "AgentGuest"
|
private const val TAG = "AgentGuest"
|
||||||
private const val POLL_MS = 50L
|
private const val POLL_MS = 50L
|
||||||
private val lock = Any()
|
private val lock = Any()
|
||||||
@@ -35,7 +32,6 @@ object AgentGuest {
|
|||||||
observer?.stopWatching()
|
observer?.stopWatching()
|
||||||
observer = null
|
observer = null
|
||||||
lastFocusKey = null
|
lastFocusKey = null
|
||||||
main.post { steamKeyboard = false }
|
|
||||||
val dir = dir(context)
|
val dir = dir(context)
|
||||||
dir.deleteRecursively()
|
dir.deleteRecursively()
|
||||||
dir.mkdirs()
|
dir.mkdirs()
|
||||||
@@ -47,7 +43,6 @@ object AgentGuest {
|
|||||||
SessionEvents.record("agent.ready", mapOf("pid" to it.optInt("pid"), "focus" to it.optBoolean("focus")))
|
SessionEvents.record("agent.ready", mapOf("pid" to it.optInt("pid"), "focus" to it.optBoolean("focus")))
|
||||||
}
|
}
|
||||||
"focus.json" -> readJson(File(dir, path))?.let(::recordFocus)
|
"focus.json" -> readJson(File(dir, path))?.let(::recordFocus)
|
||||||
"keyboard.json" -> readJson(File(dir, path))?.let { recordKeyboard(this, it) }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.also { it.startWatching() }
|
}.also { it.startWatching() }
|
||||||
@@ -58,19 +53,9 @@ object AgentGuest {
|
|||||||
synchronized(lock) {
|
synchronized(lock) {
|
||||||
observer?.stopWatching()
|
observer?.stopWatching()
|
||||||
observer = null
|
observer = null
|
||||||
main.post { steamKeyboard = false }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun recordKeyboard(source: FileObserver, snapshot: JSONObject) {
|
|
||||||
val showing = snapshot.optBoolean("steamKeyboard")
|
|
||||||
synchronized(lock) {
|
|
||||||
if (source !== observer) return
|
|
||||||
main.post { steamKeyboard = showing }
|
|
||||||
}
|
|
||||||
SessionEvents.record("keyboard.changed", mapOf("steamKeyboard" to showing, "seq" to snapshot.optInt("seq")))
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun recordFocus(snapshot: JSONObject) {
|
private fun recordFocus(snapshot: JSONObject) {
|
||||||
val fields = linkedMapOf<String, Any?>(
|
val fields = linkedMapOf<String, Any?>(
|
||||||
"focusedApp" to snapshot.opt("focusedApp"),
|
"focusedApp" to snapshot.opt("focusedApp"),
|
||||||
|
|||||||
@@ -17,8 +17,6 @@ public class DirectAudioRelayComponent extends SessionPart {
|
|||||||
private File logFile;
|
private File logFile;
|
||||||
private final File micFifoPath;
|
private final File micFifoPath;
|
||||||
private volatile int pid = -1;
|
private volatile int pid = -1;
|
||||||
private final Object micLock = new Object();
|
|
||||||
private boolean micHot;
|
|
||||||
|
|
||||||
public DirectAudioRelayComponent(File socketPath, File micFifoPath) {
|
public DirectAudioRelayComponent(File socketPath, File micFifoPath) {
|
||||||
this.socketPath = socketPath;
|
this.socketPath = socketPath;
|
||||||
@@ -32,9 +30,6 @@ public class DirectAudioRelayComponent extends SessionPart {
|
|||||||
@Override
|
@Override
|
||||||
public void start() {
|
public void start() {
|
||||||
stop();
|
stop();
|
||||||
synchronized (micLock) {
|
|
||||||
micHot = false;
|
|
||||||
}
|
|
||||||
File binary = new File(app().getApplicationInfo().nativeLibraryDir, BINARY);
|
File binary = new File(app().getApplicationInfo().nativeLibraryDir, BINARY);
|
||||||
if (!binary.isFile()) {
|
if (!binary.isFile()) {
|
||||||
Log.w(TAG, "helper missing at " + binary + "; DirectAudio will report itself unavailable");
|
Log.w(TAG, "helper missing at " + binary + "; DirectAudio will report itself unavailable");
|
||||||
@@ -84,40 +79,12 @@ public class DirectAudioRelayComponent extends SessionPart {
|
|||||||
app().getFilesDir(), null,
|
app().getFilesDir(), null,
|
||||||
line -> {
|
line -> {
|
||||||
Log.i(TAG, line);
|
Log.i(TAG, line);
|
||||||
trackMic(line);
|
|
||||||
if (log != null) synchronized (log) { log.println(line); log.flush(); }
|
if (log != null) synchronized (log) { log.println(line); log.flush(); }
|
||||||
});
|
});
|
||||||
Log.i(TAG, "started pid=" + pid + " socket=" + socketPath
|
Log.i(TAG, "started pid=" + pid + " socket=" + socketPath
|
||||||
+ (micFifoPath != null ? " mic=" + micFifoPath : " (no microphone)"));
|
+ (micFifoPath != null ? " mic=" + micFifoPath : " (no microphone)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void trackMic(String line) {
|
|
||||||
boolean start = line.startsWith("DA-Relay: mic start ");
|
|
||||||
if (!start && !line.startsWith("DA-Relay: mic stop ")) return;
|
|
||||||
synchronized (micLock) {
|
|
||||||
micHot = start;
|
|
||||||
micLock.notifyAll();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Android keeps the input stream's wake lock while a frozen helper still has it started.
|
|
||||||
public boolean awaitMicReleased(long timeoutMs) {
|
|
||||||
long deadline = System.currentTimeMillis() + timeoutMs;
|
|
||||||
synchronized (micLock) {
|
|
||||||
while (micHot) {
|
|
||||||
long left = deadline - System.currentTimeMillis();
|
|
||||||
if (left <= 0) return false;
|
|
||||||
try {
|
|
||||||
micLock.wait(left);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void stop() {
|
public void stop() {
|
||||||
if (pid != -1) {
|
if (pid != -1) {
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public class PulseAudioComponent extends SessionPart {
|
public class PulseAudioComponent extends SessionPart {
|
||||||
private static final String TAG = "PulseAudio";
|
private static final String TAG = "PulseAudio";
|
||||||
public static final String SOCKET_NAME = "PS0";
|
public static final String SOCKET_NAME = "PS0";
|
||||||
private static final String MIC_SOURCE = "DirectAudioMic";
|
|
||||||
private static final String BUNDLE_STAMP = "2026-10-08-pa13-directaudio-native";
|
private static final String BUNDLE_STAMP = "2026-10-08-pa13-directaudio-native";
|
||||||
|
|
||||||
|
|
||||||
@@ -98,9 +97,9 @@ public class PulseAudioComponent extends SessionPart {
|
|||||||
config.add("set-default-sink DirectAudio");
|
config.add("set-default-sink DirectAudio");
|
||||||
config.add(".fail");
|
config.add(".fail");
|
||||||
if (micFifoPath != null && !micFifoPath.isEmpty()) {
|
if (micFifoPath != null && !micFifoPath.isEmpty()) {
|
||||||
config.add("load-module module-pipe-source source_name=" + MIC_SOURCE + " file=\""
|
config.add("load-module module-pipe-source source_name=DirectAudioMic file=\""
|
||||||
+ micFifoPath + "\" format=s16le rate=48000 channels=1");
|
+ micFifoPath + "\" format=s16le rate=48000 channels=1");
|
||||||
config.add("set-default-source " + MIC_SOURCE);
|
config.add("set-default-source DirectAudioMic");
|
||||||
}
|
}
|
||||||
FileUtils.writeString(new File(workingDir, "default.pa"), String.join("\n", config));
|
FileUtils.writeString(new File(workingDir, "default.pa"), String.join("\n", config));
|
||||||
|
|
||||||
@@ -203,24 +202,16 @@ public class PulseAudioComponent extends SessionPart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean setSinkSuspended(boolean suspended) {
|
public boolean setSinkSuspended(boolean suspended) {
|
||||||
return suspend("sink", "@DEFAULT_SINK@", suspended);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean setMicSuspended(boolean suspended) {
|
|
||||||
return micFifoPath == null || micFifoPath.isEmpty() || suspend("source", MIC_SOURCE, suspended);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean suspend(String kind, String name, boolean suspended) {
|
|
||||||
File pactl = new File(workingDir, "pactl");
|
File pactl = new File(workingDir, "pactl");
|
||||||
if (!pactl.isFile() || pid <= 1) {
|
if (!pactl.isFile() || pid <= 1) {
|
||||||
Log.w(TAG, "cannot change " + kind + " state: PulseAudio control client or server unavailable");
|
Log.w(TAG, "cannot change sink state: PulseAudio control client or server unavailable");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
java.lang.Process process = null;
|
java.lang.Process process = null;
|
||||||
try {
|
try {
|
||||||
File modules = new File(workingDir, "modules/arm64");
|
File modules = new File(workingDir, "modules/arm64");
|
||||||
ProcessBuilder builder = new ProcessBuilder(
|
ProcessBuilder builder = new ProcessBuilder(
|
||||||
pactl.getAbsolutePath(), "suspend-" + kind, name, Boolean.toString(suspended));
|
pactl.getAbsolutePath(), "suspend-sink", "@DEFAULT_SINK@", Boolean.toString(suspended));
|
||||||
builder.directory(workingDir);
|
builder.directory(workingDir);
|
||||||
builder.redirectErrorStream(true);
|
builder.redirectErrorStream(true);
|
||||||
builder.redirectOutput(new File("/dev/null"));
|
builder.redirectOutput(new File("/dev/null"));
|
||||||
@@ -231,18 +222,18 @@ public class PulseAudioComponent extends SessionPart {
|
|||||||
process = builder.start();
|
process = builder.start();
|
||||||
if (!process.waitFor(5, TimeUnit.SECONDS)) {
|
if (!process.waitFor(5, TimeUnit.SECONDS)) {
|
||||||
process.destroyForcibly();
|
process.destroyForcibly();
|
||||||
Log.w(TAG, "timed out changing " + kind + " state to suspended=" + suspended);
|
Log.w(TAG, "timed out changing sink state to suspended=" + suspended);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int status = process.exitValue();
|
int status = process.exitValue();
|
||||||
if (status != 0) Log.w(TAG, kind + " state change failed with exit " + status);
|
if (status != 0) Log.w(TAG, "sink state change failed with exit " + status);
|
||||||
return status == 0;
|
return status == 0;
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
Log.w(TAG, "interrupted changing " + kind + " state", e);
|
Log.w(TAG, "interrupted changing sink state", e);
|
||||||
return false;
|
return false;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.w(TAG, "could not change " + kind + " state", e);
|
Log.w(TAG, "could not change sink state", e);
|
||||||
return false;
|
return false;
|
||||||
} finally {
|
} finally {
|
||||||
if (process != null && process.isAlive()) process.destroyForcibly();
|
if (process != null && process.isAlive()) process.destroyForcibly();
|
||||||
|
|||||||
@@ -1,152 +0,0 @@
|
|||||||
package com.droiddeck.launcher.core
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.util.Log
|
|
||||||
import com.droiddeck.launcher.BuildConfig
|
|
||||||
import kotlinx.coroutines.CoroutineScope
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.SupervisorJob
|
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
|
||||||
import kotlinx.coroutines.flow.asStateFlow
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import java.io.File
|
|
||||||
import java.io.FileInputStream
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A pack built by CI alongside this APK (tools/packs). Main and release builds publish it to
|
|
||||||
* DroidDeck-Components under a content-addressed tag; a PR test build attaches packs that are not there
|
|
||||||
* yet to its pr-N release on DroidDeck-CI. The APK pins the pack's SHA-256, so only the bytes this build
|
|
||||||
* was made with install, whichever host serves them.
|
|
||||||
*/
|
|
||||||
internal class AddonPack(
|
|
||||||
val name: String, private val sha256: String, val size: Long, private val required: List<String>,
|
|
||||||
private val reuseDeviceCopy: Boolean = sha256.isEmpty() && !BuildConfig.CI_BUILD,
|
|
||||||
) {
|
|
||||||
sealed interface State {
|
|
||||||
data object Missing : State
|
|
||||||
data class Downloading(val progress: Float) : State
|
|
||||||
data object Failed : State
|
|
||||||
data object Ready : State
|
|
||||||
}
|
|
||||||
|
|
||||||
private val mutableState = MutableStateFlow<State>(State.Missing)
|
|
||||||
val state: StateFlow<State> = mutableState.asStateFlow()
|
|
||||||
private val lock = Any()
|
|
||||||
|
|
||||||
val available: Boolean get() = sha256.isNotEmpty()
|
|
||||||
private val tag get() = "pack-$name-${sha256.take(16)}"
|
|
||||||
private val urls get() = listOfNotNull(
|
|
||||||
"https://github.com/$REPO/releases/download/$tag/$name.tar.zst",
|
|
||||||
BuildConfig.PR_NUMBER.takeIf { it > 0 }?.let { "https://github.com/$PR_REPO/releases/download/pr-$it/$tag.tar.zst" },
|
|
||||||
)
|
|
||||||
|
|
||||||
private fun root(context: Context) = File(context.filesDir, "addons/$name")
|
|
||||||
/** App-private and written only after the archive matched the pinned digest. */
|
|
||||||
fun dir(context: Context) = File(root(context), version(context))
|
|
||||||
fun file(context: Context, relative: String) = File(dir(context), relative)
|
|
||||||
|
|
||||||
fun installed(context: Context): Boolean = version(context).isNotEmpty() && File(dir(context), COMPLETE).isFile
|
|
||||||
|
|
||||||
// A build made outside CI pins no packs, so it runs the newest one a CI build already verified and installed.
|
|
||||||
private fun version(context: Context): String = if (!reuseDeviceCopy) sha256 else deviceCopy(context).orEmpty()
|
|
||||||
|
|
||||||
private fun deviceCopy(context: Context): String? = root(context).listFiles().orEmpty()
|
|
||||||
.filter { dir ->
|
|
||||||
dir.isDirectory && runCatching { File(dir, COMPLETE).readText().trim() }.getOrNull() == dir.name &&
|
|
||||||
required.all { File(dir, it).isFile }
|
|
||||||
}
|
|
||||||
.maxByOrNull { it.lastModified() }?.name
|
|
||||||
|
|
||||||
fun refresh(context: Context): State {
|
|
||||||
val now = mutableState.value
|
|
||||||
if (now is State.Downloading) return now
|
|
||||||
return (if (installed(context)) State.Ready else if (now == State.Failed) State.Failed else State.Missing)
|
|
||||||
.also { mutableState.value = it }
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Starts the download in the background unless the pack is already present or on its way. */
|
|
||||||
fun ensure(context: Context, onReady: (Context) -> Unit = {}) {
|
|
||||||
val app = context.applicationContext
|
|
||||||
synchronized(lock) {
|
|
||||||
if (installed(app)) { mutableState.value = State.Ready; return }
|
|
||||||
if (mutableState.value is State.Downloading) return
|
|
||||||
mutableState.value = State.Downloading(0f)
|
|
||||||
}
|
|
||||||
scope.launch {
|
|
||||||
val ok = runCatching { install(app) }.onFailure { Log.w(TAG, "$name: install failed", it) }.getOrDefault(false)
|
|
||||||
mutableState.value = if (ok) State.Ready else State.Failed
|
|
||||||
if (ok) onReady(app)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Blocks a worker thread until the pack is installed, starting the download if needed. */
|
|
||||||
@JvmOverloads
|
|
||||||
fun await(context: Context, running: () -> Boolean = { true }, onState: (State) -> Unit = {}): Boolean {
|
|
||||||
if (installed(context)) return true
|
|
||||||
ensure(context)
|
|
||||||
while (running()) {
|
|
||||||
val now = state.value
|
|
||||||
onState(now)
|
|
||||||
when (now) {
|
|
||||||
State.Ready -> return installed(context)
|
|
||||||
State.Failed -> return false
|
|
||||||
else -> try { Thread.sleep(250) } catch (e: InterruptedException) { return false }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun install(context: Context): Boolean {
|
|
||||||
if (!available) {
|
|
||||||
Log.w(TAG, if (reuseDeviceCopy) "$name: this build has no pack and none is installed" else "$name: this build has no pack")
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
val root = root(context).apply { mkdirs() }
|
|
||||||
val archive = File(root, "$sha256.tar.zst")
|
|
||||||
val downloaded = urls.any { url ->
|
|
||||||
Downloader.downloadFile(url, archive, true, sha256) { p -> mutableState.value = State.Downloading(p.coerceIn(0f, 1f)) }
|
|
||||||
.also { if (!it) archive.delete() }
|
|
||||||
}
|
|
||||||
if (!downloaded) return false
|
|
||||||
val staging = File(root, "$sha256.partial")
|
|
||||||
staging.deleteRecursively()
|
|
||||||
try {
|
|
||||||
if (!FileInputStream(archive).use { TarZst.extract(it, staging) }) return false
|
|
||||||
check(required.all { File(staging, it).isFile }) { "$name pack is incomplete" }
|
|
||||||
File(staging, COMPLETE).writeText(sha256)
|
|
||||||
val target = dir(context)
|
|
||||||
target.deleteRecursively()
|
|
||||||
check(staging.renameTo(target)) { "could not move the $name pack into place" }
|
|
||||||
} finally {
|
|
||||||
staging.deleteRecursively()
|
|
||||||
archive.delete()
|
|
||||||
}
|
|
||||||
root.listFiles().orEmpty().filter { it.name != sha256 }.forEach { it.deleteRecursively() }
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private const val TAG = "AddonPack"
|
|
||||||
private const val REPO = "Droid-Deck/DroidDeck-Components"
|
|
||||||
private const val PR_REPO = "Droid-Deck/DroidDeck-CI"
|
|
||||||
const val COMPLETE = ".complete"
|
|
||||||
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
|
|
||||||
|
|
||||||
@JvmField
|
|
||||||
val PROOT = AddonPack("proot", BuildConfig.PACK_PROOT_SHA256, BuildConfig.PACK_PROOT_SIZE,
|
|
||||||
listOf("libproot.so", "libproot-loader.so"))
|
|
||||||
@JvmField
|
|
||||||
val DIRECTAUDIO = AddonPack("directaudio", BuildConfig.PACK_DIRECTAUDIO_SHA256, BuildConfig.PACK_DIRECTAUDIO_SIZE,
|
|
||||||
listOf("linux-wine11/version.txt", "linux-wine11-systhread/version.txt"))
|
|
||||||
val TRACKING = AddonPack("tracking", BuildConfig.PACK_TRACKING_SHA256, BuildConfig.PACK_TRACKING_SIZE, listOf(
|
|
||||||
"hand_landmarker.task", "hand_landmarker_lite.task", "pose_landmarker_lite.task",
|
|
||||||
"libopencv_java4.so", "libmediapipe_tasks_jni.so"))
|
|
||||||
val XBOX = AddonPack("xbox", BuildConfig.PACK_XBOX_SHA256, BuildConfig.PACK_XBOX_SIZE,
|
|
||||||
listOf("version", "xodus-cli", "xodus-service"))
|
|
||||||
val COMET = AddonPack("comet", BuildConfig.PACK_COMET_SHA256, BuildConfig.PACK_COMET_SIZE,
|
|
||||||
listOf("version", "comet"))
|
|
||||||
val AMAZON = AddonPack("amazon", BuildConfig.PACK_AMAZON_SHA256, BuildConfig.PACK_AMAZON_SIZE,
|
|
||||||
listOf("engine.json", "libdroiddeckamazon.so"), reuseDeviceCopy = false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -200,12 +200,6 @@ object DeviceReport {
|
|||||||
h("Drivers")
|
h("Drivers")
|
||||||
val gpu = com.droiddeck.launcher.gpu.GpuInfo.detect()
|
val gpu = com.droiddeck.launcher.gpu.GpuInfo.detect()
|
||||||
k("GPU", "${gpu.name} · ${gpu.family.label} · ${gpu.supportText}" + if (gpu.oneUi8Gen2) " · One UI 8 Gen 2" else "")
|
k("GPU", "${gpu.name} · ${gpu.family.label} · ${gpu.supportText}" + if (gpu.oneUi8Gen2) " · One UI 8 Gen 2" else "")
|
||||||
if (gpu.model == 740) {
|
|
||||||
val hint = com.droiddeck.launcher.gpu.TpUbwcHint
|
|
||||||
k("TP UBWC hint", hint.forThisDevice(context) ?: "driver default")
|
|
||||||
k("TP UBWC mode", hint.activeMode ?: SessionPrefs.TP_UBWC_AUTO)
|
|
||||||
if (hint.restartRequired(context)) k("TP UBWC pending", "${SessionPrefs.tpUbwcMode(context)} (restart required)")
|
|
||||||
}
|
|
||||||
k("Driver mode", SessionPrefs.gpuDriverMode(context) +
|
k("Driver mode", SessionPrefs.gpuDriverMode(context) +
|
||||||
(com.droiddeck.launcher.gpu.DriverPairs.recommendedKey(gpu, com.droiddeck.launcher.gpu.DriverPairs.from(
|
(com.droiddeck.launcher.gpu.DriverPairs.recommendedKey(gpu, com.droiddeck.launcher.gpu.DriverPairs.from(
|
||||||
com.droiddeck.launcher.gpu.TurnipReleases.cached(context)), com.droiddeck.launcher.gpu.TurnipReleases.autoPicks(context),
|
com.droiddeck.launcher.gpu.TurnipReleases.cached(context)), com.droiddeck.launcher.gpu.TurnipReleases.autoPicks(context),
|
||||||
@@ -230,9 +224,6 @@ object DeviceReport {
|
|||||||
k("Installed version", LinuxRuntimeInstaller.installedVersion(context))
|
k("Installed version", LinuxRuntimeInstaller.installedVersion(context))
|
||||||
k("Runtime ready", LinuxRuntime.isInstalled(context))
|
k("Runtime ready", LinuxRuntime.isInstalled(context))
|
||||||
k("Desktop installed", DesktopCatalog.desktopInstalled(context))
|
k("Desktop installed", DesktopCatalog.desktopInstalled(context))
|
||||||
k("Interrupted installs", DesktopCatalog.interrupted(context).joinToString { "${it.id} ${it.version}" }.ifEmpty { "none" })
|
|
||||||
val broken = runCatching { com.droiddeck.launcher.runtime.RuntimeHealth.brokenLibraryLinks(context) }.getOrDefault(emptyList())
|
|
||||||
k("Broken library links", if (broken.isEmpty()) "none" else "${broken.size}: ${broken.take(8).joinToString()}")
|
|
||||||
k("Runtime root", LinuxRuntime.rootDir(context).path)
|
k("Runtime root", LinuxRuntime.rootDir(context).path)
|
||||||
|
|
||||||
h("Settings in effect")
|
h("Settings in effect")
|
||||||
@@ -257,7 +248,6 @@ object DeviceReport {
|
|||||||
k("Guest host name", SessionPrefs.guestHostname(context))
|
k("Guest host name", SessionPrefs.guestHostname(context))
|
||||||
k("DirectAudio for games", SessionPrefs.directAudio(context))
|
k("DirectAudio for games", SessionPrefs.directAudio(context))
|
||||||
k("Stretch 16:9 to panel", SessionPrefs.stretch16x9(context))
|
k("Stretch 16:9 to panel", SessionPrefs.stretch16x9(context))
|
||||||
k("Return to launcher after a game", SessionPrefs.returnAfterGame(context))
|
|
||||||
k("Microphone", SessionPrefs.micEnabled(context))
|
k("Microphone", SessionPrefs.micEnabled(context))
|
||||||
k("On-screen controls", SessionPrefs.oscMode(context))
|
k("On-screen controls", SessionPrefs.oscMode(context))
|
||||||
k("Touch mode", SessionPrefs.touchMode(context))
|
k("Touch mode", SessionPrefs.touchMode(context))
|
||||||
|
|||||||
@@ -54,12 +54,7 @@ public final class Downloader {
|
|||||||
java.util.function.Consumer<Float> progress) {
|
java.util.function.Consumer<Float> progress) {
|
||||||
if (expectedSha256 != null && !expectedSha256.matches("(?i)[0-9a-f]{64}"))
|
if (expectedSha256 != null && !expectedSha256.matches("(?i)[0-9a-f]{64}"))
|
||||||
throw new IllegalArgumentException("Expected SHA-256 must be 64 hex characters");
|
throw new IllegalArgumentException("Expected SHA-256 must be 64 hex characters");
|
||||||
return downloadCandidates(url, sources(url, expectedSha256), destination, resume, expectedSha256, progress);
|
return downloadCandidates(url, DownloadSource.INSTANCE.candidates(url), destination, resume, expectedSha256, progress);
|
||||||
}
|
|
||||||
|
|
||||||
/** A third-party mirror may only serve bytes that can be checked against a digest from a direct source. */
|
|
||||||
static List<String> sources(String url, String expectedSha256) {
|
|
||||||
return expectedSha256 == null ? java.util.Collections.singletonList(url) : DownloadSource.INSTANCE.candidates(url);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Package-private for the local multi-source HTTP test.
|
// Package-private for the local multi-source HTTP test.
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ object GameEnvironment {
|
|||||||
|
|
||||||
fun defaults(preset: String, forceSsbs: Boolean = false): Map<String, String?> = linkedMapOf<String, String?>(
|
fun defaults(preset: String, forceSsbs: Boolean = false): Map<String, String?> = linkedMapOf<String, String?>(
|
||||||
"MESA_SHADER_CACHE_DISABLE" to "false",
|
"MESA_SHADER_CACHE_DISABLE" to "false",
|
||||||
"DROIDDECK_ANTICHEAT_OFFLINE" to "1",
|
|
||||||
"VKD3D_FEATURE_LEVEL" to "12_2",
|
"VKD3D_FEATURE_LEVEL" to "12_2",
|
||||||
"VKD3D_SHADER_MODEL" to "6_9",
|
"VKD3D_SHADER_MODEL" to "6_9",
|
||||||
"DOTNET_GCRegionRange" to "800000000",
|
"DOTNET_GCRegionRange" to "800000000",
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ object GameEnvironmentOptions {
|
|||||||
Option("MESA_EXTENSION_MAX_YEAR", "", 0, Type.TEXT),
|
Option("MESA_EXTENSION_MAX_YEAR", "", 0, Type.TEXT),
|
||||||
Option("MESA_GL_VERSION_OVERRIDE", "", 0, Type.TEXT),
|
Option("MESA_GL_VERSION_OVERRIDE", "", 0, Type.TEXT),
|
||||||
Option("PULSE_LATENCY_MSEC", "", 0, Type.NUMBER),
|
Option("PULSE_LATENCY_MSEC", "", 0, Type.NUMBER),
|
||||||
Option("DROIDDECK_ANTICHEAT_OFFLINE", "1", R.string.game_env_anticheat_offline, Type.TOGGLE, listOf("0", "1")),
|
|
||||||
Option("WINE_LARGE_ADDRESS_AWARE", "0", 0, Type.TOGGLE, listOf("0", "1")),
|
Option("WINE_LARGE_ADDRESS_AWARE", "0", 0, Type.TOGGLE, listOf("0", "1")),
|
||||||
Option("WINEDLLOVERRIDES", "", 0, Type.TEXT),
|
Option("WINEDLLOVERRIDES", "", 0, Type.TEXT),
|
||||||
Option("GALLIUM_HUD", "simple", 0, Type.MULTIPLE, listOf("simple", "fps", "frametime")),
|
Option("GALLIUM_HUD", "simple", 0, Type.MULTIPLE, listOf("simple", "fps", "frametime")),
|
||||||
|
|||||||
@@ -2,51 +2,14 @@ package com.droiddeck.launcher.core
|
|||||||
|
|
||||||
object LogRedactor {
|
object LogRedactor {
|
||||||
private val EMAIL = Regex("[A-Za-z0-9._%+\\-]+@[A-Za-z0-9.\\-]+\\.[A-Za-z]{2,}")
|
private val EMAIL = Regex("[A-Za-z0-9._%+\\-]+@[A-Za-z0-9.\\-]+\\.[A-Za-z]{2,}")
|
||||||
private val HIDL_SHARED_LIBRARY = Regex(
|
|
||||||
"(?:android\\.(?:hardware|frameworks|hidl|system)|vendor\\.[A-Za-z0-9_]+\\.hardware)" +
|
|
||||||
"(?:\\.[A-Za-z0-9_]+)+@[0-9]+\\.[0-9]+(?:-[A-Za-z0-9_]+)*\\.so"
|
|
||||||
)
|
|
||||||
private val hidlMatcher = object : ThreadLocal<java.util.regex.Matcher>() {
|
|
||||||
override fun initialValue(): java.util.regex.Matcher = HIDL_SHARED_LIBRARY.toPattern().matcher("")
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun isHidlLoaderDiagnostic(input: String, match: MatchResult): Boolean {
|
|
||||||
val matcher = hidlMatcher.get()!!
|
|
||||||
val isLibrary = try { matcher.reset(match.value).matches() } finally { matcher.reset("") }
|
|
||||||
if (!isLibrary) return false
|
|
||||||
val start = match.range.first
|
|
||||||
val end = match.range.last + 1
|
|
||||||
val prefix = "library \""
|
|
||||||
val suffix = "\" not found"
|
|
||||||
val earliestQuote = (start - 4096).coerceAtLeast(0)
|
|
||||||
var quote = start - 1
|
|
||||||
while (quote >= earliestQuote && input[quote] != '"') {
|
|
||||||
val char = input[quote]
|
|
||||||
if (!char.isLetterOrDigit() && char !in "/._-") return false
|
|
||||||
quote--
|
|
||||||
}
|
|
||||||
if (quote < earliestQuote) return false
|
|
||||||
val pathStart = quote + 1
|
|
||||||
if (pathStart < start && (input[start - 1] != '/' ||
|
|
||||||
!(input.regionMatches(pathStart, "/vendor/", 0, 8) ||
|
|
||||||
input.regionMatches(pathStart, "/system/", 0, 8)))) return false
|
|
||||||
val prefixStart = quote - prefix.length + 1
|
|
||||||
val suffixEnd = end + suffix.length
|
|
||||||
return prefixStart >= 0 && suffixEnd <= input.length &&
|
|
||||||
input.regionMatches(prefixStart, prefix, 0, prefix.length, ignoreCase = true) &&
|
|
||||||
input.regionMatches(end, suffix, 0, suffix.length, ignoreCase = true) &&
|
|
||||||
(prefixStart == 0 || !(input[prefixStart - 1].isLetterOrDigit() || input[prefixStart - 1] == '_')) &&
|
|
||||||
(suffixEnd == input.length || !(input[suffixEnd].isLetterOrDigit() || input[suffixEnd] == '_'))
|
|
||||||
}
|
|
||||||
|
|
||||||
private val JWT_LABELLED = Regex("(?i)(\\bJWT[\\s=:]+)(\\d{8,})")
|
private val JWT_LABELLED = Regex("(?i)(\\bJWT[\\s=:]+)(\\d{8,})")
|
||||||
private val JWT_BASE64 = Regex("ey[A-Za-z0-9_\\-]{6,}\\.[A-Za-z0-9_\\-]{6,}\\.[A-Za-z0-9_\\-]{6,}")
|
private val JWT_BASE64 = Regex("ey[A-Za-z0-9_\\-]{6,}\\.[A-Za-z0-9_\\-]{6,}\\.[A-Za-z0-9_\\-]{6,}")
|
||||||
private val GUID = Regex("\\b[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}\\b")
|
private val GUID = Regex("\\b[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}\\b")
|
||||||
private val SECRET_KV = Regex(
|
private val SECRET_KV = Regex(
|
||||||
"(?i)(\\b(?:access[_-]?token|refresh[_-]?token|auth[_-]?token|authtoken|token|authcode|" +
|
"(?i)\\b(access[_-]?token|refresh[_-]?token|auth[_-]?token|authtoken|token|authcode|" +
|
||||||
"auth[_-]?ticket|ticket|sessionid|steamloginsecure|webapikey|api[_-]?key|" +
|
"auth[_-]?ticket|ticket|sessionid|steamloginsecure|webapikey|api[_-]?key|" +
|
||||||
"machine[_-]?auth(?:[_-]?token)?|machineauth|password|passwd|pwd|secret)[\"']?\\s*[=:]\\s*)" +
|
"machine[_-]?auth(?:[_-]?token)?|machineauth|password|passwd|pwd|secret)" +
|
||||||
"(?:([\"'])((?:\\\\.|(?!\\2)[^\\\\\\r\\n]){4,})\\2|([^\\s\"'<>&;,]{4,}))"
|
"(\\s*[=:]\\s*|=)([^\\s\"'<>&;,]{4,})"
|
||||||
)
|
)
|
||||||
private val GUARD_CODE = Regex(
|
private val GUARD_CODE = Regex(
|
||||||
"(?i)((?:steam\\s*)?guard\\s*code[\\s:=]*|two[\\s-]?factor[\\s:=]*|2fa[\\s:=]*)([A-Za-z0-9]{5})"
|
"(?i)((?:steam\\s*)?guard\\s*code[\\s:=]*|two[\\s-]?factor[\\s:=]*|2fa[\\s:=]*)([A-Za-z0-9]{5})"
|
||||||
@@ -183,21 +146,16 @@ object LogRedactor {
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The at-rest rewrite reads a file into memory twice; larger logs are only scrubbed on the way out. */
|
fun isText(file: java.io.File): Boolean = try {
|
||||||
const val IN_MEMORY_SCRUB_MAX = 64L * 1024 * 1024
|
file.isFile && file.length() < 64L * 1024 * 1024 && file.inputStream().use { input ->
|
||||||
|
|
||||||
fun isBinary(file: java.io.File): Boolean = try {
|
|
||||||
file.inputStream().use { input ->
|
|
||||||
val buf = ByteArray(4096)
|
val buf = ByteArray(4096)
|
||||||
val n = input.read(buf)
|
val n = input.read(buf)
|
||||||
n > 0 && (0 until n).any { buf[it].toInt() == 0 }
|
n <= 0 || (0 until n).none { buf[it].toInt() == 0 }
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
true
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isText(file: java.io.File): Boolean = file.isFile && file.length() < IN_MEMORY_SCRUB_MAX && !isBinary(file)
|
|
||||||
|
|
||||||
const val RULES_VERSION = 3
|
const val RULES_VERSION = 3
|
||||||
|
|
||||||
private val LAN_IPV4 = Regex(
|
private val LAN_IPV4 = Regex(
|
||||||
@@ -218,62 +176,8 @@ object LogRedactor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private const val SHARE_LINE_MAX = 64 * 1024
|
|
||||||
|
|
||||||
fun scrubForShare(src: java.io.File, out: java.io.Writer) {
|
fun scrubForShare(src: java.io.File, out: java.io.Writer) {
|
||||||
src.inputStream().buffered().use { input ->
|
src.forEachLine { line -> out.write(redactForShare(line)); out.write("\n") }
|
||||||
input.mark(2)
|
|
||||||
val first = input.read()
|
|
||||||
val second = input.read()
|
|
||||||
input.reset()
|
|
||||||
if ((first == 0xff && second == 0xfe) || (first == 0xfe && second == 0xff)) {
|
|
||||||
out.write("<unsupported encoding; file withheld>\n")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
val decoder = Charsets.UTF_8.newDecoder()
|
|
||||||
.onMalformedInput(java.nio.charset.CodingErrorAction.REPORT)
|
|
||||||
.onUnmappableCharacter(java.nio.charset.CodingErrorAction.REPORT)
|
|
||||||
java.io.InputStreamReader(input, decoder).use { reader ->
|
|
||||||
val buffer = CharArray(8192)
|
|
||||||
val line = StringBuilder()
|
|
||||||
var withheld = false
|
|
||||||
var afterCr = false
|
|
||||||
fun emit() {
|
|
||||||
out.write(if (withheld) "<unsupported or oversized line withheld>" else redactForShare(line.toString()))
|
|
||||||
out.write("\n")
|
|
||||||
line.setLength(0)
|
|
||||||
withheld = false
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
while (true) {
|
|
||||||
val size = reader.read(buffer)
|
|
||||||
if (size < 0) break
|
|
||||||
for (i in 0 until size) {
|
|
||||||
val ch = buffer[i]
|
|
||||||
if (afterCr) {
|
|
||||||
afterCr = false
|
|
||||||
if (ch == '\n') continue
|
|
||||||
}
|
|
||||||
if (ch == '\r' || ch == '\n') {
|
|
||||||
emit()
|
|
||||||
afterCr = ch == '\r'
|
|
||||||
} else if (!withheld) {
|
|
||||||
// Splitting a line can separate a credential from its label.
|
|
||||||
if (ch == '\u0000' || line.length == SHARE_LINE_MAX) {
|
|
||||||
withheld = true
|
|
||||||
line.setLength(0)
|
|
||||||
} else {
|
|
||||||
line.append(ch)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (withheld || line.isNotEmpty()) emit()
|
|
||||||
} catch (_: java.nio.charset.CharacterCodingException) {
|
|
||||||
out.write("<unsupported encoding; file withheld>\n")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun quoted(value: String): String {
|
private fun quoted(value: String): String {
|
||||||
@@ -328,7 +232,7 @@ object LogRedactor {
|
|||||||
if (out.has("jwt")) out.set(JWT_LABELLED.replace(out.text) { "${it.groupValues[1]}<redacted:jwt>" })
|
if (out.has("jwt")) out.set(JWT_LABELLED.replace(out.text) { "${it.groupValues[1]}<redacted:jwt>" })
|
||||||
if ("ey" in out.text) out.set(JWT_BASE64.replace(out.text, "<redacted:jwt>"))
|
if ("ey" in out.text) out.set(JWT_BASE64.replace(out.text, "<redacted:jwt>"))
|
||||||
if (out.has("token", "auth", "ticket", "sessionid", "steamloginsecure", "api", "machine", "pass", "pwd", "secret")) {
|
if (out.has("token", "auth", "ticket", "sessionid", "steamloginsecure", "api", "machine", "pass", "pwd", "secret")) {
|
||||||
out.set(SECRET_KV.replace(out.text) { "${it.groupValues[1]}${it.groupValues[2]}<redacted:token>${it.groupValues[2]}" })
|
out.set(SECRET_KV.replace(out.text) { "${it.groupValues[1]}${it.groupValues[2]}<redacted:token>" })
|
||||||
}
|
}
|
||||||
if (out.has("guard", "factor", "2fa")) out.set(GUARD_CODE.replace(out.text) { "${it.groupValues[1]}<redacted:code>" })
|
if (out.has("guard", "factor", "2fa")) out.set(GUARD_CODE.replace(out.text) { "${it.groupValues[1]}<redacted:code>" })
|
||||||
if (out.hasRun(32, ::isHex)) out.set(WEBAPI_KEY.replace(out.text, "<redacted:key>"))
|
if (out.hasRun(32, ::isHex)) out.set(WEBAPI_KEY.replace(out.text, "<redacted:key>"))
|
||||||
@@ -346,9 +250,7 @@ object LogRedactor {
|
|||||||
}
|
}
|
||||||
if (out.has("login")) out.set(LOGIN_KV.replace(out.text) { "${it.groupValues[1]}${it.groupValues[2]}${quoted(it.groupValues[3])}" })
|
if (out.has("login")) out.set(LOGIN_KV.replace(out.text) { "${it.groupValues[1]}${it.groupValues[2]}${quoted(it.groupValues[3])}" })
|
||||||
for (r in accounts) if (r.needs == null || out.has(r.needs)) out.set(r.regex.replace(out.text, "<redacted:account>"))
|
for (r in accounts) if (r.needs == null || out.has(r.needs)) out.set(r.regex.replace(out.text, "<redacted:account>"))
|
||||||
if ('@' in out.text) out.set(EMAIL.replace(out.text) { m ->
|
if ('@' in out.text) out.set(EMAIL.replace(out.text, "<redacted:email>"))
|
||||||
m.value.takeIf { isHidlLoaderDiagnostic(out.text, m) } ?: "<redacted:email>"
|
|
||||||
})
|
|
||||||
if (out.has("jwt", "token", "ticket", "sessionid", "steamloginsecure", "machineauth")) {
|
if (out.has("jwt", "token", "ticket", "sessionid", "steamloginsecure", "machineauth")) {
|
||||||
out.set(RESIDUAL.replace(out.text) { "${it.groupValues[1]}=<redacted:token>" })
|
out.set(RESIDUAL.replace(out.text) { "${it.groupValues[1]}=<redacted:token>" })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import android.os.Build
|
|||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.IBinder
|
import android.os.IBinder
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import com.droiddeck.launcher.FrontEndActivity
|
import com.droiddeck.launcher.MainActivity
|
||||||
import com.droiddeck.launcher.R
|
import com.droiddeck.launcher.R
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
@@ -185,7 +185,7 @@ class WirelessAdbPairingService : Service() {
|
|||||||
enableVibration(false)
|
enableVibration(false)
|
||||||
})
|
})
|
||||||
val open = PendingIntent.getActivity(this, 0,
|
val open = PendingIntent.getActivity(this, 0,
|
||||||
Intent(this, FrontEndActivity::class.java).setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_REORDER_TO_FRONT),
|
Intent(this, MainActivity::class.java).setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_REORDER_TO_FRONT),
|
||||||
PendingIntent.FLAG_IMMUTABLE)
|
PendingIntent.FLAG_IMMUTABLE)
|
||||||
val cancel = PendingIntent.getService(this, 1,
|
val cancel = PendingIntent.getService(this, 1,
|
||||||
Intent(this, WirelessAdbPairingService::class.java).setAction(ACTION_CANCEL), PendingIntent.FLAG_IMMUTABLE)
|
Intent(this, WirelessAdbPairingService::class.java).setAction(ACTION_CANCEL), PendingIntent.FLAG_IMMUTABLE)
|
||||||
|
|||||||
@@ -1,10 +1,26 @@
|
|||||||
package com.droiddeck.launcher.core
|
package com.droiddeck.launcher.core
|
||||||
|
|
||||||
|
import android.app.ActivityManager
|
||||||
|
import android.content.Context
|
||||||
|
import android.os.Build
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
object ZramSupport {
|
object ZramSupport {
|
||||||
|
private const val GIB = 1L shl 30
|
||||||
|
|
||||||
fun supported(): Boolean = kernelAtLeast(System.getProperty("os.version").orEmpty(), 5, 4) && swapTotalKb() > 0
|
fun supported(): Boolean = kernelAtLeast(System.getProperty("os.version").orEmpty(), 5, 4) && swapTotalKb() > 0
|
||||||
|
|
||||||
|
fun recommended(context: Context): Boolean {
|
||||||
|
if (!supported()) return false
|
||||||
|
val memory = ActivityManager.MemoryInfo()
|
||||||
|
context.getSystemService(ActivityManager::class.java).getMemoryInfo(memory)
|
||||||
|
val advertised = if (Build.VERSION.SDK_INT >= 34) memory.advertisedMem else 0L
|
||||||
|
return belowTwelveGb(advertised, memory.totalMem)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun belowTwelveGb(advertisedBytes: Long, totalBytes: Long): Boolean =
|
||||||
|
if (advertisedBytes > 0) advertisedBytes < 11 * GIB else totalBytes < 10 * GIB
|
||||||
|
|
||||||
fun kernelAtLeast(release: String, major: Int, minor: Int): Boolean {
|
fun kernelAtLeast(release: String, major: Int, minor: Int): Boolean {
|
||||||
val parts = Regex("^(\\d+)\\.(\\d+)").find(release)?.groupValues ?: return false
|
val parts = Regex("^(\\d+)\\.(\\d+)").find(release)?.groupValues ?: return false
|
||||||
val ma = parts[1].toInt()
|
val ma = parts[1].toInt()
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class AppFilesProvider : DocumentsProvider() {
|
|||||||
|
|
||||||
override fun deleteDocument(documentId: String) {
|
override fun deleteDocument(documentId: String) {
|
||||||
val file = fileFor(documentId)
|
val file = fileFor(documentId)
|
||||||
if (file.canonicalPath == baseCanonical) throw FileNotFoundException("the app folder itself is not deleted")
|
if (file.absolutePath == base.absolutePath) throw FileNotFoundException("the app folder itself is not deleted")
|
||||||
try {
|
try {
|
||||||
deleteTree(file.toPath())
|
deleteTree(file.toPath())
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
@@ -154,7 +154,7 @@ class AppFilesProvider : DocumentsProvider() {
|
|||||||
|
|
||||||
private fun fileFor(documentId: String): File {
|
private fun fileFor(documentId: String): File {
|
||||||
val f = File(documentId)
|
val f = File(documentId)
|
||||||
if (!f.isAbsolute || f.normalize().path != documentId || !inside(f)) throw FileNotFoundException("$documentId is outside the app's files")
|
if (!f.isAbsolute || !inside(f)) throw FileNotFoundException("$documentId is outside the app's files")
|
||||||
if (!f.exists()) throw FileNotFoundException("$documentId not found")
|
if (!f.exists()) throw FileNotFoundException("$documentId not found")
|
||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import androidx.compose.foundation.background
|
|||||||
import androidx.compose.foundation.border
|
import androidx.compose.foundation.border
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.selection.selectable
|
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
@@ -250,11 +249,11 @@ fun CollapsibleRail(
|
|||||||
if (active) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.outline.copy(alpha = 0.5f),
|
if (active) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.outline.copy(alpha = 0.5f),
|
||||||
shape,
|
shape,
|
||||||
)
|
)
|
||||||
.clickable(role = androidx.compose.ui.semantics.Role.Button, onClick = item.onClick)
|
.clickable(onClick = item.onClick)
|
||||||
.padding(horizontal = if (collapsed) 2.dp else 11.dp, vertical = if (collapsed) 6.dp else 9.dp)
|
.padding(horizontal = if (collapsed) 2.dp else 11.dp, vertical = if (collapsed) 6.dp else 9.dp)
|
||||||
} else {
|
} else {
|
||||||
base
|
base
|
||||||
.clickable(role = androidx.compose.ui.semantics.Role.Button, onClick = item.onClick)
|
.clickable(onClick = item.onClick)
|
||||||
.background(if (active) MaterialTheme.colorScheme.primary.copy(alpha = 0.14f) else Color.Transparent)
|
.background(if (active) MaterialTheme.colorScheme.primary.copy(alpha = 0.14f) else Color.Transparent)
|
||||||
.padding(horizontal = if (collapsed) 2.dp else 13.dp, vertical = if (collapsed) 7.dp else 11.dp)
|
.padding(horizontal = if (collapsed) 2.dp else 13.dp, vertical = if (collapsed) 7.dp else 11.dp)
|
||||||
}
|
}
|
||||||
@@ -338,7 +337,7 @@ fun RailTopTabs(
|
|||||||
.background(MaterialTheme.colorScheme.outline.copy(alpha = 0.4f)),
|
.background(MaterialTheme.colorScheme.outline.copy(alpha = 0.4f)),
|
||||||
)
|
)
|
||||||
links.forEach { link ->
|
links.forEach { link ->
|
||||||
TopTabCell(link.icon, link.label, selected = false, onClick = link.onClick, isTab = false, modifier = Modifier.weight(1f))
|
TopTabCell(link.icon, link.label, selected = false, onClick = link.onClick, modifier = Modifier.weight(1f))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -353,7 +352,6 @@ private fun TopTabCell(
|
|||||||
selected: Boolean,
|
selected: Boolean,
|
||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
isTab: Boolean = true,
|
|
||||||
) {
|
) {
|
||||||
val tint = if (selected) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onSurfaceVariant
|
val tint = if (selected) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
Column(
|
Column(
|
||||||
@@ -361,13 +359,7 @@ private fun TopTabCell(
|
|||||||
modifier = modifier
|
modifier = modifier
|
||||||
.clip(RoundedCornerShape(9.dp))
|
.clip(RoundedCornerShape(9.dp))
|
||||||
.background(if (selected) MaterialTheme.colorScheme.primary.copy(alpha = 0.14f) else Color.Transparent)
|
.background(if (selected) MaterialTheme.colorScheme.primary.copy(alpha = 0.14f) else Color.Transparent)
|
||||||
.then(
|
.clickable(onClick = onClick)
|
||||||
if (isTab) {
|
|
||||||
Modifier.selectable(selected = selected, role = androidx.compose.ui.semantics.Role.Tab, onClick = onClick)
|
|
||||||
} else {
|
|
||||||
Modifier.clickable(role = androidx.compose.ui.semantics.Role.Button, onClick = onClick)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.padding(vertical = 6.dp, horizontal = 1.dp),
|
.padding(vertical = 6.dp, horizontal = 1.dp),
|
||||||
) {
|
) {
|
||||||
Icon(icon, contentDescription = label, tint = tint, modifier = Modifier.size(20.dp))
|
Icon(icon, contentDescription = label, tint = tint, modifier = Modifier.size(20.dp))
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class FileManagerActivity : ComponentActivity() {
|
|||||||
setContent {
|
setContent {
|
||||||
DroidDeckTheme(appScale = com.droiddeck.launcher.core.AppUiPrefs.scale(this)) {
|
DroidDeckTheme(appScale = com.droiddeck.launcher.core.AppUiPrefs.scale(this)) {
|
||||||
Surface(modifier = Modifier.fillMaxSize().systemBarsPadding(), color = MaterialTheme.colorScheme.background) {
|
Surface(modifier = Modifier.fillMaxSize().systemBarsPadding(), color = MaterialTheme.colorScheme.background) {
|
||||||
FileManagerScreen(initialDir = initialDir, onExit = { finish() })
|
FileManagerScreen(initialDir = initialDir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ internal fun FileItemRow(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(horizontal = 12.dp, vertical = 3.dp)
|
.padding(horizontal = 12.dp, vertical = 3.dp)
|
||||||
.combinedClickable(role = androidx.compose.ui.semantics.Role.Button,
|
.combinedClickable(
|
||||||
onClick = { if (selectionMode) onToggleSelect() else onTap() },
|
onClick = { if (selectionMode) onToggleSelect() else onTap() },
|
||||||
onLongClick = onLongPress,
|
onLongClick = onLongPress,
|
||||||
),
|
),
|
||||||
@@ -302,7 +302,7 @@ internal fun ParentFolderRow(compact: Boolean = false, onTap: () -> Unit) {
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(horizontal = 12.dp, vertical = 3.dp)
|
.padding(horizontal = 12.dp, vertical = 3.dp)
|
||||||
.clickable(role = androidx.compose.ui.semantics.Role.Button, onClick = onTap),
|
.clickable(onClick = onTap),
|
||||||
shape = RoundedCornerShape(10.dp),
|
shape = RoundedCornerShape(10.dp),
|
||||||
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainer),
|
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainer),
|
||||||
border = BorderStroke(1.dp, MaterialTheme.colorScheme.outline),
|
border = BorderStroke(1.dp, MaterialTheme.colorScheme.outline),
|
||||||
@@ -422,7 +422,7 @@ private fun FavoriteCard(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(horizontal = 12.dp, vertical = 3.dp)
|
.padding(horizontal = 12.dp, vertical = 3.dp)
|
||||||
.clickable(role = androidx.compose.ui.semantics.Role.Button, onClick = onJump),
|
.clickable(onClick = onJump),
|
||||||
shape = RoundedCornerShape(10.dp),
|
shape = RoundedCornerShape(10.dp),
|
||||||
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainer),
|
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainer),
|
||||||
border = BorderStroke(1.dp, MaterialTheme.colorScheme.outline),
|
border = BorderStroke(1.dp, MaterialTheme.colorScheme.outline),
|
||||||
@@ -526,7 +526,7 @@ internal fun FileGridTile(
|
|||||||
Card(
|
Card(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(4.dp)
|
.padding(4.dp)
|
||||||
.combinedClickable(role = androidx.compose.ui.semantics.Role.Button,
|
.combinedClickable(
|
||||||
onClick = { if (selectionMode) onToggleSelect() else onTap() },
|
onClick = { if (selectionMode) onToggleSelect() else onTap() },
|
||||||
onLongClick = onLongPress,
|
onLongClick = onLongPress,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -28,8 +28,6 @@ import androidx.compose.foundation.lazy.grid.items
|
|||||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.automirrored.filled.ExitToApp
|
|
||||||
import androidx.compose.material.icons.automirrored.filled.KeyboardReturn
|
|
||||||
import androidx.compose.material.icons.filled.ArrowBack
|
import androidx.compose.material.icons.filled.ArrowBack
|
||||||
import androidx.compose.material.icons.filled.ContentPaste
|
import androidx.compose.material.icons.filled.ContentPaste
|
||||||
import androidx.compose.material.icons.filled.CreateNewFolder
|
import androidx.compose.material.icons.filled.CreateNewFolder
|
||||||
@@ -92,18 +90,11 @@ import androidx.compose.ui.unit.dp
|
|||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import com.droiddeck.launcher.session.SessionPrefs
|
import com.droiddeck.launcher.session.SessionPrefs
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.Job
|
|
||||||
import kotlinx.coroutines.ensureActive
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
|
|
||||||
private enum class FileManagerNavigation { EXIT, RETURN_TO_START, BACK }
|
|
||||||
|
|
||||||
internal fun canNavigateUp(currentDir: File, currentRoot: File): Boolean =
|
|
||||||
currentDir != currentRoot && currentDir.parentFile?.exists() == true
|
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun FileManagerScreen(
|
fun FileManagerScreen(
|
||||||
@@ -113,7 +104,6 @@ fun FileManagerScreen(
|
|||||||
initialDir: File? = null,
|
initialDir: File? = null,
|
||||||
pickerTitle: String? = null,
|
pickerTitle: String? = null,
|
||||||
onPick: ((File) -> Unit)? = null,
|
onPick: ((File) -> Unit)? = null,
|
||||||
onExit: (() -> Unit)? = null,
|
|
||||||
) {
|
) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
@@ -127,14 +117,12 @@ fun FileManagerScreen(
|
|||||||
|
|
||||||
val pickPrefs = remember { context.getSharedPreferences("file_manager", android.content.Context.MODE_PRIVATE) }
|
val pickPrefs = remember { context.getSharedPreferences("file_manager", android.content.Context.MODE_PRIVATE) }
|
||||||
val browsePrefs = pickPrefs
|
val browsePrefs = pickPrefs
|
||||||
val rootDir = remember(initialDir) {
|
val rootDir = remember {
|
||||||
initialDir?.takeIf { it.isDirectory } ?: File("/storage/emulated/0")
|
initialDir?.takeIf { it.isDirectory } ?: File("/storage/emulated/0")
|
||||||
}
|
}
|
||||||
val launchDir = remember(initialDir, pickMode) {
|
|
||||||
initialDir?.takeIf { !pickMode }
|
|
||||||
}
|
|
||||||
var currentDir by remember { mutableStateOf(rootDir) }
|
var currentDir by remember { mutableStateOf(rootDir) }
|
||||||
val initialRoot = remember(rootDir) {
|
var currentRoot by remember {
|
||||||
val abs = rootDir.absolutePath
|
val abs = rootDir.absolutePath
|
||||||
val internal = "/storage/emulated/0"
|
val internal = "/storage/emulated/0"
|
||||||
val vol = when {
|
val vol = when {
|
||||||
@@ -150,9 +138,8 @@ fun FileManagerScreen(
|
|||||||
?: rootDir
|
?: rootDir
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vol
|
mutableStateOf(vol)
|
||||||
}
|
}
|
||||||
var currentRoot by remember { mutableStateOf(initialRoot) }
|
|
||||||
var entries by remember { mutableStateOf(listOf<File>()) }
|
var entries by remember { mutableStateOf(listOf<File>()) }
|
||||||
var selectedEntry by remember { mutableStateOf<File?>(null) }
|
var selectedEntry by remember { mutableStateOf<File?>(null) }
|
||||||
var showMenuFor by remember { mutableStateOf<File?>(null) }
|
var showMenuFor by remember { mutableStateOf<File?>(null) }
|
||||||
@@ -163,14 +150,9 @@ fun FileManagerScreen(
|
|||||||
var pendingConflict by remember { mutableStateOf<File?>(null) }
|
var pendingConflict by remember { mutableStateOf<File?>(null) }
|
||||||
var conflictChoice by remember { mutableStateOf<ConflictChoice?>(null) }
|
var conflictChoice by remember { mutableStateOf<ConflictChoice?>(null) }
|
||||||
var conflictApplyToAll by remember { mutableStateOf(false) }
|
var conflictApplyToAll by remember { mutableStateOf(false) }
|
||||||
var operationJob by remember { mutableStateOf<Job?>(null) }
|
var operationJob by remember { mutableStateOf<kotlinx.coroutines.Job?>(null) }
|
||||||
var cancelledJob by remember { mutableStateOf<Job?>(null) }
|
|
||||||
var pendingNavigation by remember { mutableStateOf<FileManagerNavigation?>(null) }
|
|
||||||
var cancellingNavigation by remember { mutableStateOf(false) }
|
|
||||||
var pendingBulkDelete by remember { mutableStateOf<List<File>>(emptyList()) }
|
var pendingBulkDelete by remember { mutableStateOf<List<File>>(emptyList()) }
|
||||||
var searchQuery by remember { mutableStateOf("") }
|
var searchQuery by remember { mutableStateOf("") }
|
||||||
val visibleEntries = if (searchQuery.isBlank()) entries
|
|
||||||
else entries.filter { it.name.contains(searchQuery, ignoreCase = true) }
|
|
||||||
var showSearch by remember { mutableStateOf(false) }
|
var showSearch by remember { mutableStateOf(false) }
|
||||||
var sortBy by remember { mutableStateOf(browsePrefs.getString("fmSortBy", "name") ?: "name") }
|
var sortBy by remember { mutableStateOf(browsePrefs.getString("fmSortBy", "name") ?: "name") }
|
||||||
var sortDesc by remember { mutableStateOf(browsePrefs.getBoolean("fmSortDesc", false)) }
|
var sortDesc by remember { mutableStateOf(browsePrefs.getBoolean("fmSortDesc", false)) }
|
||||||
@@ -192,21 +174,16 @@ fun FileManagerScreen(
|
|||||||
var showFavorites by remember { mutableStateOf(false) }
|
var showFavorites by remember { mutableStateOf(false) }
|
||||||
var favTick by remember { mutableIntStateOf(0) }
|
var favTick by remember { mutableIntStateOf(0) }
|
||||||
|
|
||||||
var listingJob by remember { mutableStateOf<Job?>(null) }
|
|
||||||
|
|
||||||
fun loadDirectory(dir: File, resetScroll: Boolean = true) {
|
fun loadDirectory(dir: File, resetScroll: Boolean = true) {
|
||||||
if (cancellingNavigation) return
|
|
||||||
currentDir = dir
|
currentDir = dir
|
||||||
if (pickMode) pickPrefs.edit().putString("lastFilePickerDir", dir.absolutePath).apply()
|
if (pickMode) pickPrefs.edit().putString("lastFilePickerDir", dir.absolutePath).apply()
|
||||||
listingJob?.cancel()
|
scope.launch {
|
||||||
listingJob = scope.launch {
|
|
||||||
val list = withContext(Dispatchers.IO) {
|
val list = withContext(Dispatchers.IO) {
|
||||||
dir.listFiles()?.toList()
|
dir.listFiles()?.toList()
|
||||||
?.filter { if (pickDirMode) it.isDirectory else !pickMode || it.isDirectory || matchesPickExt(it) }
|
?.filter { if (pickDirMode) it.isDirectory else !pickMode || it.isDirectory || matchesPickExt(it) }
|
||||||
?.filter { showHidden || !it.name.startsWith(".") }
|
?.filter { showHidden || !it.name.startsWith(".") }
|
||||||
?.sortedWith(comparatorFor(sortBy, sortDesc)) ?: emptyList()
|
?.sortedWith(comparatorFor(sortBy, sortDesc)) ?: emptyList()
|
||||||
}
|
}
|
||||||
if (currentDir != dir) return@launch
|
|
||||||
entries = list
|
entries = list
|
||||||
if (resetScroll) listState.scrollToItem(0)
|
if (resetScroll) listState.scrollToItem(0)
|
||||||
}
|
}
|
||||||
@@ -220,95 +197,30 @@ fun FileManagerScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun openDrive(dir: File) {
|
fun openDrive(dir: File) {
|
||||||
if (cancellingNavigation) return
|
|
||||||
currentRoot = dir
|
currentRoot = dir
|
||||||
loadDirectory(dir)
|
loadDirectory(dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun returnToStart() {
|
|
||||||
if (cancellingNavigation) return
|
|
||||||
val dir = launchDir ?: return
|
|
||||||
if (!dir.isDirectory) {
|
|
||||||
Toast.makeText(context, R.string.fm_start_unavailable, Toast.LENGTH_SHORT).show()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
showFavorites = false
|
|
||||||
showSearch = false
|
|
||||||
searchQuery = ""
|
|
||||||
currentRoot = initialRoot
|
|
||||||
loadDirectory(dir)
|
|
||||||
}
|
|
||||||
|
|
||||||
LaunchedEffect(Unit) { loadDirectory(rootDir) }
|
LaunchedEffect(Unit) { loadDirectory(rootDir) }
|
||||||
|
|
||||||
val canGoUp = currentDir != currentRoot && currentDir.parentFile?.exists() == true
|
BackHandler(enabled = showFavorites || currentDir != currentRoot) {
|
||||||
fun isOperationActive() = isOperationRunning || operationJob?.isCompleted == false || cancelledJob?.isCompleted == false
|
if (showFavorites) {
|
||||||
val operationActive = isOperationActive()
|
showFavorites = false
|
||||||
|
return@BackHandler
|
||||||
fun navigate(action: FileManagerNavigation) {
|
|
||||||
if (cancellingNavigation) return
|
|
||||||
when (action) {
|
|
||||||
FileManagerNavigation.EXIT -> onExit?.invoke()
|
|
||||||
FileManagerNavigation.RETURN_TO_START -> returnToStart()
|
|
||||||
FileManagerNavigation.BACK -> {
|
|
||||||
if (showFavorites) showFavorites = false
|
|
||||||
else if (canNavigateUp(currentDir, currentRoot)) currentDir.parentFile?.let { loadDirectory(it) }
|
|
||||||
else onExit?.invoke()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
val parent = currentDir.parentFile
|
||||||
|
if (parent != null && parent.exists()) loadDirectory(parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun requestNavigation(action: FileManagerNavigation) {
|
val canGoUp = currentDir != currentRoot && currentDir.parentFile?.exists() == true
|
||||||
if (cancellingNavigation) return
|
fun goUp() {
|
||||||
if (isOperationActive()) pendingNavigation = action else navigate(action)
|
val parent = currentDir.parentFile
|
||||||
}
|
if (currentDir != currentRoot && parent != null && parent.exists()) loadDirectory(parent)
|
||||||
|
|
||||||
BackHandler(enabled = operationActive || cancellingNavigation || showFavorites || currentDir != currentRoot) {
|
|
||||||
requestNavigation(FileManagerNavigation.BACK)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pendingNavigation != null) {
|
|
||||||
OutlinedAlertDialog(
|
|
||||||
onDismissRequest = { pendingNavigation = null },
|
|
||||||
title = { Text(stringResource(R.string.fm_cancel_operation_title)) },
|
|
||||||
text = { Text(stringResource(R.string.fm_cancel_operation_confirmation)) },
|
|
||||||
confirmButton = {
|
|
||||||
TextButton(onClick = {
|
|
||||||
val action = pendingNavigation ?: return@TextButton
|
|
||||||
pendingNavigation = null
|
|
||||||
val job = operationJob?.takeUnless(Job::isCompleted)
|
|
||||||
?: cancelledJob?.takeUnless(Job::isCompleted)
|
|
||||||
if (job == null) {
|
|
||||||
navigate(action)
|
|
||||||
} else {
|
|
||||||
cancellingNavigation = true
|
|
||||||
cancelledJob = job
|
|
||||||
job.cancel()
|
|
||||||
scope.launch {
|
|
||||||
job.join()
|
|
||||||
if (operationJob === job) operationJob = null
|
|
||||||
if (cancelledJob === job) cancelledJob = null
|
|
||||||
pendingConflict = null
|
|
||||||
isOperationRunning = false
|
|
||||||
operationDeterminate = false
|
|
||||||
cancellingNavigation = false
|
|
||||||
if (action != FileManagerNavigation.EXIT) loadDirectory(currentDir, resetScroll = false)
|
|
||||||
navigate(action)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}) { Text(stringResource(R.string.fm_accept)) }
|
|
||||||
},
|
|
||||||
dismissButton = {
|
|
||||||
TextButton(onClick = { pendingNavigation = null }) {
|
|
||||||
Text(stringResource(R.string.fm_decline))
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun uniqueDestination(dir: File, name: String): File {
|
fun uniqueDestination(dir: File, name: String): File {
|
||||||
var candidate = File(dir, name)
|
var candidate = File(dir, name)
|
||||||
if (!java.nio.file.Files.exists(candidate.toPath(), java.nio.file.LinkOption.NOFOLLOW_LINKS)) return candidate
|
if (!candidate.exists()) return candidate
|
||||||
val dot = name.lastIndexOf('.')
|
val dot = name.lastIndexOf('.')
|
||||||
val base = if (dot > 0) name.substring(0, dot) else name
|
val base = if (dot > 0) name.substring(0, dot) else name
|
||||||
val ext = if (dot > 0) name.substring(dot) else ""
|
val ext = if (dot > 0) name.substring(dot) else ""
|
||||||
@@ -316,19 +228,16 @@ fun FileManagerScreen(
|
|||||||
do {
|
do {
|
||||||
candidate = File(dir, "$base ($i)$ext")
|
candidate = File(dir, "$base ($i)$ext")
|
||||||
i++
|
i++
|
||||||
} while (java.nio.file.Files.exists(candidate.toPath(), java.nio.file.LinkOption.NOFOLLOW_LINKS))
|
} while (candidate.exists())
|
||||||
return candidate
|
return candidate
|
||||||
}
|
}
|
||||||
|
|
||||||
fun performDelete(file: File) {
|
fun performDelete(file: File) {
|
||||||
if (isOperationActive()) return
|
scope.launch {
|
||||||
operationJob = scope.launch {
|
|
||||||
isOperationRunning = true
|
isOperationRunning = true
|
||||||
operationLabel = context.getString(R.string.fm_op_deleting)
|
operationLabel = context.getString(R.string.fm_op_deleting)
|
||||||
val job = coroutineContext[Job]
|
val ok = withContext(Dispatchers.IO) { FileOps.delete(file) }
|
||||||
val ok = withContext(Dispatchers.IO) { FileOps.delete(file) { job?.isActive == false } }
|
|
||||||
isOperationRunning = false
|
isOperationRunning = false
|
||||||
if (operationJob === job) operationJob = null
|
|
||||||
loadDirectory(currentDir, resetScroll = false)
|
loadDirectory(currentDir, resetScroll = false)
|
||||||
if (!ok) Toast.makeText(context, R.string.fm_delete_failed, Toast.LENGTH_SHORT).show()
|
if (!ok) Toast.makeText(context, R.string.fm_delete_failed, Toast.LENGTH_SHORT).show()
|
||||||
}
|
}
|
||||||
@@ -343,7 +252,7 @@ fun FileManagerScreen(
|
|||||||
|
|
||||||
fun performPaste() {
|
fun performPaste() {
|
||||||
val sources = clipboardFiles
|
val sources = clipboardFiles
|
||||||
if (sources.isEmpty() || isOperationActive()) return
|
if (sources.isEmpty()) return
|
||||||
val dstDir = currentDir
|
val dstDir = currentDir
|
||||||
val cut = isCutOperation
|
val cut = isCutOperation
|
||||||
|
|
||||||
@@ -352,7 +261,6 @@ fun FileManagerScreen(
|
|||||||
operationDeterminate = true
|
operationDeterminate = true
|
||||||
operationLabel = context.getString(if (cut) R.string.fm_op_moving else R.string.fm_op_copying)
|
operationLabel = context.getString(if (cut) R.string.fm_op_moving else R.string.fm_op_copying)
|
||||||
isOperationRunning = true
|
isOperationRunning = true
|
||||||
val job = coroutineContext[Job]
|
|
||||||
|
|
||||||
var applyToAll: ConflictChoice? = null
|
var applyToAll: ConflictChoice? = null
|
||||||
var failed = 0
|
var failed = 0
|
||||||
@@ -370,7 +278,7 @@ fun FileManagerScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
var dst = File(dstDir, src.name)
|
var dst = File(dstDir, src.name)
|
||||||
if (java.nio.file.Files.exists(dst.toPath(), java.nio.file.LinkOption.NOFOLLOW_LINKS)) {
|
if (dst.exists()) {
|
||||||
val choice = applyToAll ?: askConflict(src)?.also {
|
val choice = applyToAll ?: askConflict(src)?.also {
|
||||||
if (conflictApplyToAll) applyToAll = it
|
if (conflictApplyToAll) applyToAll = it
|
||||||
} ?: run { skipped++; null } ?: continue
|
} ?: run { skipped++; null } ?: continue
|
||||||
@@ -388,7 +296,6 @@ fun FileManagerScreen(
|
|||||||
}
|
}
|
||||||
var lastPct = -1
|
var lastPct = -1
|
||||||
val onProgress = FileOps.ProgressCallback { copied, total ->
|
val onProgress = FileOps.ProgressCallback { copied, total ->
|
||||||
job?.ensureActive()
|
|
||||||
val pct = if (total > 0) ((copied * 100) / total).toInt() else 100
|
val pct = if (total > 0) ((copied * 100) / total).toInt() else 100
|
||||||
if (pct != lastPct) {
|
if (pct != lastPct) {
|
||||||
lastPct = pct
|
lastPct = pct
|
||||||
@@ -397,15 +304,15 @@ fun FileManagerScreen(
|
|||||||
}
|
}
|
||||||
val target = dst
|
val target = dst
|
||||||
val ok = withContext(Dispatchers.IO) {
|
val ok = withContext(Dispatchers.IO) {
|
||||||
if (cut) FileOps.moveWithProgress(src, target, onProgress) { job?.isActive == false }
|
if (cut) FileOps.moveWithProgress(src, target, onProgress)
|
||||||
else FileOps.copyWithProgress(src, target, onProgress) { job?.isActive == false }
|
else FileOps.copyWithProgress(src, target, onProgress)
|
||||||
}
|
}
|
||||||
if (ok) done++ else failed++
|
if (ok) done++ else failed++
|
||||||
}
|
}
|
||||||
|
|
||||||
isOperationRunning = false
|
isOperationRunning = false
|
||||||
operationDeterminate = false
|
operationDeterminate = false
|
||||||
if (operationJob === job) operationJob = null
|
operationJob = null
|
||||||
clipboardFiles = emptyList()
|
clipboardFiles = emptyList()
|
||||||
isCutOperation = false
|
isCutOperation = false
|
||||||
selectionMode = false
|
selectionMode = false
|
||||||
@@ -423,38 +330,32 @@ fun FileManagerScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun performRename(file: File, newName: String) {
|
fun performRename(file: File, newName: String) {
|
||||||
if (isOperationActive()) return
|
|
||||||
val target = File(file.parentFile, newName)
|
val target = File(file.parentFile, newName)
|
||||||
if (target.exists()) {
|
if (target.exists()) {
|
||||||
Toast.makeText(context, context.getString(R.string.fm_already_exists, newName), Toast.LENGTH_SHORT).show()
|
Toast.makeText(context, context.getString(R.string.fm_already_exists, newName), Toast.LENGTH_SHORT).show()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
operationJob = scope.launch {
|
scope.launch {
|
||||||
val job = coroutineContext[Job]
|
|
||||||
isOperationRunning = true
|
isOperationRunning = true
|
||||||
operationLabel = context.getString(R.string.fm_op_renaming)
|
operationLabel = context.getString(R.string.fm_op_renaming)
|
||||||
val ok = withContext(Dispatchers.IO) { file.renameTo(target) }
|
val ok = withContext(Dispatchers.IO) { file.renameTo(target) }
|
||||||
isOperationRunning = false
|
isOperationRunning = false
|
||||||
if (operationJob === job) operationJob = null
|
|
||||||
loadDirectory(currentDir, resetScroll = false)
|
loadDirectory(currentDir, resetScroll = false)
|
||||||
if (!ok) Toast.makeText(context, R.string.fm_rename_failed, Toast.LENGTH_SHORT).show()
|
if (!ok) Toast.makeText(context, R.string.fm_rename_failed, Toast.LENGTH_SHORT).show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createFolder(parent: File, name: String) {
|
fun createFolder(parent: File, name: String) {
|
||||||
if (isOperationActive()) return
|
|
||||||
val target = File(parent, name)
|
val target = File(parent, name)
|
||||||
if (target.exists()) {
|
if (target.exists()) {
|
||||||
Toast.makeText(context, context.getString(R.string.fm_already_exists, name), Toast.LENGTH_SHORT).show()
|
Toast.makeText(context, context.getString(R.string.fm_already_exists, name), Toast.LENGTH_SHORT).show()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
operationJob = scope.launch {
|
scope.launch {
|
||||||
val job = coroutineContext[Job]
|
|
||||||
isOperationRunning = true
|
isOperationRunning = true
|
||||||
operationLabel = context.getString(R.string.fm_op_creating_folder)
|
operationLabel = context.getString(R.string.fm_op_creating_folder)
|
||||||
val ok = withContext(Dispatchers.IO) { target.mkdirs() }
|
val ok = withContext(Dispatchers.IO) { target.mkdirs() }
|
||||||
isOperationRunning = false
|
isOperationRunning = false
|
||||||
if (operationJob === job) operationJob = null
|
|
||||||
loadDirectory(currentDir, resetScroll = false)
|
loadDirectory(currentDir, resetScroll = false)
|
||||||
if (!ok) Toast.makeText(context, R.string.fm_create_folder_failed, Toast.LENGTH_SHORT).show()
|
if (!ok) Toast.makeText(context, R.string.fm_create_folder_failed, Toast.LENGTH_SHORT).show()
|
||||||
}
|
}
|
||||||
@@ -570,20 +471,18 @@ fun FileManagerScreen(
|
|||||||
},
|
},
|
||||||
confirmButton = {
|
confirmButton = {
|
||||||
TextButton(onClick = {
|
TextButton(onClick = {
|
||||||
if (isOperationActive()) return@TextButton
|
|
||||||
pendingBulkDelete = emptyList()
|
pendingBulkDelete = emptyList()
|
||||||
selectionMode = false
|
selectionMode = false
|
||||||
selectedPaths = emptySet()
|
selectedPaths = emptySet()
|
||||||
operationJob = scope.launch {
|
operationJob = scope.launch {
|
||||||
isOperationRunning = true
|
isOperationRunning = true
|
||||||
val job = coroutineContext[Job]
|
|
||||||
var failed = 0
|
var failed = 0
|
||||||
victims.forEachIndexed { i, f ->
|
victims.forEachIndexed { i, f ->
|
||||||
operationLabel = context.getString(R.string.fm_op_deleting_batch, i + 1, victims.size, f.name)
|
operationLabel = context.getString(R.string.fm_op_deleting_batch, i + 1, victims.size, f.name)
|
||||||
if (!withContext(Dispatchers.IO) { FileOps.delete(f) { job?.isActive == false } }) failed++
|
if (!withContext(Dispatchers.IO) { FileOps.delete(f) }) failed++
|
||||||
}
|
}
|
||||||
isOperationRunning = false
|
isOperationRunning = false
|
||||||
if (operationJob === job) operationJob = null
|
operationJob = null
|
||||||
loadDirectory(currentDir, resetScroll = false)
|
loadDirectory(currentDir, resetScroll = false)
|
||||||
if (failed > 0) {
|
if (failed > 0) {
|
||||||
Toast.makeText(context, context.resources.getQuantityString(R.plurals.fm_delete_some_failed, failed, failed), Toast.LENGTH_SHORT).show()
|
Toast.makeText(context, context.resources.getQuantityString(R.plurals.fm_delete_some_failed, failed, failed), Toast.LENGTH_SHORT).show()
|
||||||
@@ -673,7 +572,7 @@ fun FileManagerScreen(
|
|||||||
.background(MaterialTheme.colorScheme.surfaceContainer)
|
.background(MaterialTheme.colorScheme.surfaceContainer)
|
||||||
.padding(horizontal = 8.dp, vertical = 6.dp),
|
.padding(horizontal = 8.dp, vertical = 6.dp),
|
||||||
) {
|
) {
|
||||||
IconButton(onClick = { requestNavigation(FileManagerNavigation.BACK) }, enabled = canGoUp && !cancellingNavigation) {
|
IconButton(onClick = { goUp() }, enabled = canGoUp) {
|
||||||
Icon(Icons.Filled.ArrowBack, stringResource(R.string.fm_back), tint = MaterialTheme.colorScheme.primary)
|
Icon(Icons.Filled.ArrowBack, stringResource(R.string.fm_back), tint = MaterialTheme.colorScheme.primary)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -763,13 +662,6 @@ fun FileManagerScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (launchDir != null) {
|
|
||||||
IconButton(onClick = { requestNavigation(FileManagerNavigation.RETURN_TO_START) }, enabled = !cancellingNavigation) {
|
|
||||||
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 (!showFavorites) {
|
||||||
if (!pickMode) {
|
if (!pickMode) {
|
||||||
OutlinedButton(
|
OutlinedButton(
|
||||||
@@ -845,11 +737,6 @@ fun FileManagerScreen(
|
|||||||
Icon(Icons.Filled.StarBorder, stringResource(R.string.fm_show_favorites), tint = MaterialTheme.colorScheme.onSurfaceVariant)
|
Icon(Icons.Filled.StarBorder, stringResource(R.string.fm_show_favorites), tint = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!pickMode && onExit != null) {
|
|
||||||
IconButton(onClick = { requestNavigation(FileManagerNavigation.EXIT) }, enabled = !cancellingNavigation) {
|
|
||||||
Icon(Icons.AutoMirrored.Filled.ExitToApp, stringResource(R.string.fm_exit), tint = MaterialTheme.colorScheme.onSurfaceVariant)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showSearch && !showFavorites) {
|
if (showSearch && !showFavorites) {
|
||||||
@@ -904,21 +791,19 @@ fun FileManagerScreen(
|
|||||||
fontSize = 13.sp,
|
fontSize = 13.sp,
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
)
|
)
|
||||||
val allVisibleSelected = visibleEntries.isNotEmpty() && visibleEntries.all { it.absolutePath in selectedPaths }
|
|
||||||
val anyVisibleSelected = visibleEntries.any { it.absolutePath in selectedPaths }
|
|
||||||
val selBarPadding = PaddingValues(horizontal = 10.dp, vertical = 2.dp)
|
val selBarPadding = PaddingValues(horizontal = 10.dp, vertical = 2.dp)
|
||||||
OutlinedButton(
|
OutlinedButton(
|
||||||
onClick = {
|
onClick = {
|
||||||
val shown = visibleEntries.map { it.absolutePath }
|
selectedPaths = if (selectedPaths.size == entries.size) emptySet()
|
||||||
selectedPaths = if (allVisibleSelected) selectedPaths - shown.toSet() else selectedPaths + shown
|
else entries.map { it.absolutePath }.toSet()
|
||||||
},
|
},
|
||||||
contentPadding = selBarPadding,
|
contentPadding = selBarPadding,
|
||||||
) { Text(if (allVisibleSelected) stringResource(R.string.fm_select_none) else stringResource(R.string.fm_select_all), fontSize = 12.sp) }
|
) { Text(if (selectedPaths.size == entries.size) stringResource(R.string.fm_select_none) else stringResource(R.string.fm_select_all), fontSize = 12.sp) }
|
||||||
Spacer(Modifier.width(4.dp))
|
Spacer(Modifier.width(4.dp))
|
||||||
OutlinedButton(
|
OutlinedButton(
|
||||||
enabled = anyVisibleSelected,
|
enabled = selectedPaths.isNotEmpty(),
|
||||||
onClick = {
|
onClick = {
|
||||||
clipboardFiles = visibleEntries.filter { it.absolutePath in selectedPaths }
|
clipboardFiles = entries.filter { it.absolutePath in selectedPaths }
|
||||||
isCutOperation = false
|
isCutOperation = false
|
||||||
selectionMode = false
|
selectionMode = false
|
||||||
selectedPaths = emptySet()
|
selectedPaths = emptySet()
|
||||||
@@ -927,9 +812,9 @@ fun FileManagerScreen(
|
|||||||
) { Text(stringResource(R.string.fm_copy), fontSize = 12.sp) }
|
) { Text(stringResource(R.string.fm_copy), fontSize = 12.sp) }
|
||||||
Spacer(Modifier.width(4.dp))
|
Spacer(Modifier.width(4.dp))
|
||||||
OutlinedButton(
|
OutlinedButton(
|
||||||
enabled = anyVisibleSelected,
|
enabled = selectedPaths.isNotEmpty(),
|
||||||
onClick = {
|
onClick = {
|
||||||
clipboardFiles = visibleEntries.filter { it.absolutePath in selectedPaths }
|
clipboardFiles = entries.filter { it.absolutePath in selectedPaths }
|
||||||
isCutOperation = true
|
isCutOperation = true
|
||||||
selectionMode = false
|
selectionMode = false
|
||||||
selectedPaths = emptySet()
|
selectedPaths = emptySet()
|
||||||
@@ -938,8 +823,8 @@ fun FileManagerScreen(
|
|||||||
) { Text(stringResource(R.string.fm_cut), fontSize = 12.sp) }
|
) { Text(stringResource(R.string.fm_cut), fontSize = 12.sp) }
|
||||||
Spacer(Modifier.width(4.dp))
|
Spacer(Modifier.width(4.dp))
|
||||||
OutlinedButton(
|
OutlinedButton(
|
||||||
enabled = anyVisibleSelected,
|
enabled = selectedPaths.isNotEmpty(),
|
||||||
onClick = { pendingBulkDelete = visibleEntries.filter { it.absolutePath in selectedPaths } },
|
onClick = { pendingBulkDelete = entries.filter { it.absolutePath in selectedPaths } },
|
||||||
contentPadding = selBarPadding,
|
contentPadding = selBarPadding,
|
||||||
border = BorderStroke(1.dp, MaterialTheme.colorScheme.error),
|
border = BorderStroke(1.dp, MaterialTheme.colorScheme.error),
|
||||||
) { Text(stringResource(R.string.common_delete), color = MaterialTheme.colorScheme.error, fontSize = 12.sp) }
|
) { Text(stringResource(R.string.common_delete), color = MaterialTheme.colorScheme.error, fontSize = 12.sp) }
|
||||||
@@ -957,7 +842,7 @@ fun FileManagerScreen(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.background(MaterialTheme.colorScheme.outline.copy(alpha = 0.1f))
|
.background(MaterialTheme.colorScheme.outline.copy(alpha = 0.1f))
|
||||||
.clickable(enabled = !isOperationRunning) { performPaste() }
|
.clickable { performPaste() }
|
||||||
.padding(horizontal = 16.dp, vertical = 8.dp),
|
.padding(horizontal = 16.dp, vertical = 8.dp),
|
||||||
) {
|
) {
|
||||||
Icon(Icons.Filled.ContentPaste, stringResource(R.string.fm_paste), tint = MaterialTheme.colorScheme.primary, modifier = Modifier.size(18.dp))
|
Icon(Icons.Filled.ContentPaste, stringResource(R.string.fm_paste), tint = MaterialTheme.colorScheme.primary, modifier = Modifier.size(18.dp))
|
||||||
@@ -993,7 +878,6 @@ fun FileManagerScreen(
|
|||||||
)
|
)
|
||||||
if (operationJob != null) {
|
if (operationJob != null) {
|
||||||
TextButton(onClick = {
|
TextButton(onClick = {
|
||||||
cancelledJob = operationJob
|
|
||||||
operationJob?.cancel()
|
operationJob?.cancel()
|
||||||
operationJob = null
|
operationJob = null
|
||||||
isOperationRunning = false
|
isOperationRunning = false
|
||||||
@@ -1080,7 +964,8 @@ fun FileManagerScreen(
|
|||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.nestedScroll(pullState.nestedScrollConnection),
|
.nestedScroll(pullState.nestedScrollConnection),
|
||||||
) {
|
) {
|
||||||
val shownEntries = visibleEntries
|
val shownEntries = if (searchQuery.isBlank()) entries
|
||||||
|
else entries.filter { it.name.contains(searchQuery, ignoreCase = true) }
|
||||||
|
|
||||||
if (showGrid && entries.isNotEmpty()) {
|
if (showGrid && entries.isNotEmpty()) {
|
||||||
LazyVerticalGrid(
|
LazyVerticalGrid(
|
||||||
@@ -1089,7 +974,7 @@ fun FileManagerScreen(
|
|||||||
contentPadding = PaddingValues(8.dp),
|
contentPadding = PaddingValues(8.dp),
|
||||||
) {
|
) {
|
||||||
if (canGoUp) item(key = "..", span = { GridItemSpan(maxLineSpan) }) {
|
if (canGoUp) item(key = "..", span = { GridItemSpan(maxLineSpan) }) {
|
||||||
ParentFolderRow(compact = compactRows, onTap = { requestNavigation(FileManagerNavigation.BACK) })
|
ParentFolderRow(compact = compactRows, onTap = { goUp() })
|
||||||
}
|
}
|
||||||
items(shownEntries, key = { it.absolutePath }) { file ->
|
items(shownEntries, key = { it.absolutePath }) { file ->
|
||||||
val isFav = remember(file.absolutePath, favTick) {
|
val isFav = remember(file.absolutePath, favTick) {
|
||||||
@@ -1155,7 +1040,7 @@ fun FileManagerScreen(
|
|||||||
} else
|
} else
|
||||||
LazyColumn(state = listState, modifier = Modifier.fillMaxSize()) {
|
LazyColumn(state = listState, modifier = Modifier.fillMaxSize()) {
|
||||||
if (canGoUp) item(key = "..") {
|
if (canGoUp) item(key = "..") {
|
||||||
ParentFolderRow(compact = compactRows, onTap = { requestNavigation(FileManagerNavigation.BACK) })
|
ParentFolderRow(compact = compactRows, onTap = { goUp() })
|
||||||
}
|
}
|
||||||
if (entries.isEmpty()) {
|
if (entries.isEmpty()) {
|
||||||
item {
|
item {
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import java.io.FileOutputStream
|
|||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
import java.util.concurrent.CancellationException
|
|
||||||
|
|
||||||
object FileOps {
|
object FileOps {
|
||||||
private const val TAG = "FileOps"
|
private const val TAG = "FileOps"
|
||||||
@@ -25,176 +24,83 @@ object FileOps {
|
|||||||
|
|
||||||
fun isSymlink(file: File): Boolean = try { Files.isSymbolicLink(file.toPath()) } catch (e: Exception) { false }
|
fun isSymlink(file: File): Boolean = try { Files.isSymbolicLink(file.toPath()) } catch (e: Exception) { false }
|
||||||
|
|
||||||
fun delete(target: File?, isCancelled: () -> Boolean = { false }): Boolean {
|
fun delete(target: File?): Boolean {
|
||||||
if (isCancelled()) throw CancellationException("Delete cancelled: $target")
|
|
||||||
if (target == null) return false
|
if (target == null) return false
|
||||||
if (target.isDirectory && !isSymlink(target)) {
|
if (target.isDirectory && !isSymlink(target)) {
|
||||||
if (!clear(target, isCancelled)) return false
|
if (!clear(target)) return false
|
||||||
}
|
}
|
||||||
if (isCancelled()) throw CancellationException("Delete cancelled: $target")
|
|
||||||
return target.delete()
|
return target.delete()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun clear(dir: File, isCancelled: () -> Boolean = { false }): Boolean {
|
fun clear(dir: File): Boolean {
|
||||||
val children = dir.listFiles() ?: return true
|
val children = dir.listFiles() ?: return true
|
||||||
var ok = true
|
var ok = true
|
||||||
for (child in children) if (!delete(child, isCancelled)) ok = false
|
for (child in children) if (!delete(child)) ok = false
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
fun totalSize(f: File?, isCancelled: () -> Boolean = { false }): Long {
|
fun totalSize(f: File?): Long {
|
||||||
if (isCancelled()) throw CancellationException("Size scan cancelled: $f")
|
|
||||||
if (f == null || !f.exists() || isSymlink(f)) return 0
|
if (f == null || !f.exists() || isSymlink(f)) return 0
|
||||||
if (f.isDirectory) return f.listFiles()?.sumOf { totalSize(it, isCancelled) } ?: 0
|
if (f.isDirectory) return f.listFiles()?.sumOf { totalSize(it) } ?: 0
|
||||||
return f.length()
|
return f.length()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun moveWithProgress(src: File, dst: File, progress: ProgressCallback?, isCancelled: () -> Boolean = { false }): Boolean {
|
fun moveWithProgress(src: File, dst: File, progress: ProgressCallback?): Boolean {
|
||||||
if (sameFile(src, dst)) return true
|
if (sameFile(src, dst)) return true
|
||||||
if (isCancelled()) return false
|
|
||||||
if (!dst.exists() && src.renameTo(dst)) {
|
if (!dst.exists() && src.renameTo(dst)) {
|
||||||
progress?.onProgress(1, 1)
|
progress?.onProgress(1, 1)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if (!copyWithProgress(src, dst, progress, isCancelled)) return false
|
if (!copyWithProgress(src, dst, progress)) return false
|
||||||
// Once the destination is committed, finish deleting the source.
|
|
||||||
return delete(src)
|
return delete(src)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun copyWithProgress(src: File, dst: File, progress: ProgressCallback?, isCancelled: () -> Boolean = { false }): Boolean {
|
fun copyWithProgress(src: File, dst: File, progress: ProgressCallback?): Boolean {
|
||||||
val total = maxOf(totalSize(src, isCancelled), 1L)
|
val total = maxOf(totalSize(src), 1L)
|
||||||
return copyWithProgress(src, dst, longArrayOf(0), total, progress, isCancelled)
|
return copyWithProgress(src, dst, longArrayOf(0), total, progress)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun copyWithProgress(src: File, dst: File, done: LongArray, total: Long, progress: ProgressCallback?, isCancelled: () -> Boolean): Boolean {
|
private fun copyWithProgress(src: File, dst: File, done: LongArray, total: Long, progress: ProgressCallback?): Boolean {
|
||||||
if (isCancelled()) throw java.util.concurrent.CancellationException("Copy cancelled: $src")
|
if (isSymlink(src)) return true
|
||||||
if (isSymlink(src)) return copyLink(src, dst)
|
|
||||||
if (sameFile(src, dst)) return true
|
if (sameFile(src, dst)) return true
|
||||||
if (src.isDirectory && isWithin(dst, src)) {
|
if (src.isDirectory && isWithin(dst, src)) {
|
||||||
Log.e(TAG, "Refusing to copy directory into itself: $src -> $dst")
|
Log.e(TAG, "Refusing to copy directory into itself: $src -> $dst")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if (src.isDirectory) {
|
if (src.isDirectory) {
|
||||||
val created = if (dst.exists()) false else {
|
if (!dst.exists() && !dst.mkdirs()) return false
|
||||||
if (!dst.mkdirs()) return false
|
var allOk = true
|
||||||
true
|
src.list()?.forEach { name ->
|
||||||
}
|
if (!copyWithProgress(File(src, name), File(dst, name), done, total, progress)) {
|
||||||
try {
|
Log.e(TAG, "Failed to copy: ${File(src, name)}")
|
||||||
var allOk = true
|
allOk = false
|
||||||
src.list()?.forEach { name ->
|
|
||||||
if (!copyWithProgress(File(src, name), File(dst, name), done, total, progress, isCancelled)) {
|
|
||||||
Log.e(TAG, "Failed to copy: ${File(src, name)}")
|
|
||||||
allOk = false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return allOk
|
|
||||||
} catch (e: CancellationException) {
|
|
||||||
if (created) delete(dst)
|
|
||||||
throw e
|
|
||||||
}
|
}
|
||||||
|
return allOk
|
||||||
}
|
}
|
||||||
val parent = dst.parentFile
|
val parent = dst.parentFile
|
||||||
if (!src.exists() || (parent != null && !parent.exists() && !parent.mkdirs())) return false
|
if (!src.exists() || (parent != null && !parent.exists() && !parent.mkdirs())) return false
|
||||||
val chunk = 4L * 1024 * 1024
|
val chunk = 4L * 1024 * 1024
|
||||||
var staging: File? = null
|
|
||||||
var created = false
|
|
||||||
var output: java.nio.channels.FileChannel? = null
|
|
||||||
try {
|
try {
|
||||||
output = try {
|
|
||||||
java.nio.channels.FileChannel.open(dst.toPath(), java.nio.file.StandardOpenOption.WRITE, java.nio.file.StandardOpenOption.CREATE_NEW)
|
|
||||||
.also { created = true }
|
|
||||||
} catch (e: java.nio.file.FileAlreadyExistsException) {
|
|
||||||
null
|
|
||||||
}
|
|
||||||
val target = if (!created && isSymlink(dst)) dst.canonicalFile else dst
|
|
||||||
var permissions: Set<java.nio.file.attribute.PosixFilePermission>? = null
|
|
||||||
if (output == null) {
|
|
||||||
if (isSymlink(target) || target.parentFile?.isDirectory != true) {
|
|
||||||
throw IOException("Destination symlink target is not a writable directory entry: $dst")
|
|
||||||
}
|
|
||||||
if (target.isDirectory) throw IOException("Destination is a directory: $target")
|
|
||||||
permissions = try {
|
|
||||||
Files.getPosixFilePermissions(target.toPath())
|
|
||||||
} catch (e: java.nio.file.NoSuchFileException) {
|
|
||||||
null
|
|
||||||
} catch (e: UnsupportedOperationException) {
|
|
||||||
null
|
|
||||||
}
|
|
||||||
if (target.exists() && !target.canWrite()) throw IOException("Destination is not writable: $target")
|
|
||||||
val directory = Files.createTempDirectory(checkNotNull(target.absoluteFile.parentFile).toPath(), ".droiddeck-copy-")
|
|
||||||
staging = directory.toFile()
|
|
||||||
output = FileOutputStream(File(staging, "file")).channel
|
|
||||||
}
|
|
||||||
FileInputStream(src).channel.use { input ->
|
FileInputStream(src).channel.use { input ->
|
||||||
checkNotNull(output).use { channel ->
|
FileOutputStream(dst).channel.use { output ->
|
||||||
val size = input.size()
|
val size = input.size()
|
||||||
var position = 0L
|
var position = 0L
|
||||||
while (position < size) {
|
while (position < size) {
|
||||||
if (isCancelled()) throw CancellationException("Copy cancelled: $src")
|
val transferred = input.transferTo(position, minOf(chunk, size - position), output)
|
||||||
val transferred = input.transferTo(position, minOf(chunk, size - position), channel)
|
|
||||||
if (transferred <= 0) break
|
if (transferred <= 0) break
|
||||||
position += transferred
|
position += transferred
|
||||||
done[0] += transferred
|
done[0] += transferred
|
||||||
progress?.onProgress(done[0], total)
|
progress?.onProgress(done[0], total)
|
||||||
}
|
}
|
||||||
if (position < size) throw IOException("Incomplete copy: $position/$size bytes")
|
if (position < size) throw IOException("Incomplete copy: $position/$size bytes")
|
||||||
if (size > 0 && isCancelled()) throw CancellationException("Copy cancelled: $src")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
staging?.let { directory ->
|
|
||||||
val copied = File(directory, "file").toPath()
|
|
||||||
if (permissions != null) {
|
|
||||||
try {
|
|
||||||
if (Files.getPosixFilePermissions(copied) != permissions) {
|
|
||||||
Files.setPosixFilePermissions(copied, permissions)
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
Log.w(TAG, "Failed to restore destination permissions: $target", e)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isCancelled()) throw java.util.concurrent.CancellationException("Copy cancelled: $src")
|
|
||||||
Files.move(copied, target.toPath(), java.nio.file.StandardCopyOption.ATOMIC_MOVE)
|
|
||||||
}
|
|
||||||
return true
|
return true
|
||||||
} catch (e: java.util.concurrent.CancellationException) {
|
|
||||||
if (created) dst.delete()
|
|
||||||
throw e
|
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
Log.e(TAG, "Failed to copy file: $src to $dst", e)
|
Log.e(TAG, "Failed to copy file: $src to $dst", e)
|
||||||
if (created) dst.delete()
|
dst.delete()
|
||||||
return false
|
return false
|
||||||
} finally {
|
|
||||||
output?.close()
|
|
||||||
staging?.let { directory ->
|
|
||||||
File(directory, "file").delete()
|
|
||||||
directory.delete()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun copyLink(src: File, dst: File): Boolean {
|
|
||||||
if (src.absoluteFile == dst.absoluteFile) return true
|
|
||||||
return try {
|
|
||||||
val target = Files.readSymbolicLink(src.toPath())
|
|
||||||
val parent = dst.parentFile
|
|
||||||
if (parent != null && !parent.exists() && !parent.mkdirs()) return false
|
|
||||||
try {
|
|
||||||
Files.createSymbolicLink(dst.toPath(), target)
|
|
||||||
} catch (e: java.nio.file.FileAlreadyExistsException) {
|
|
||||||
val staging = Files.createTempDirectory(checkNotNull(dst.absoluteFile.parentFile).toPath(), ".droiddeck-link-")
|
|
||||||
val tmp = staging.resolve("link")
|
|
||||||
try {
|
|
||||||
Files.createSymbolicLink(tmp, target)
|
|
||||||
Files.move(tmp, dst.toPath(), java.nio.file.StandardCopyOption.ATOMIC_MOVE)
|
|
||||||
} finally {
|
|
||||||
Files.deleteIfExists(tmp)
|
|
||||||
Files.deleteIfExists(staging)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
true
|
|
||||||
} catch (e: Exception) {
|
|
||||||
Log.e(TAG, "Failed to copy link: $src to $dst", e)
|
|
||||||
false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ class FilePickerActivity : ComponentActivity() {
|
|||||||
setResult(Activity.RESULT_OK, Intent().putExtra(EXTRA_SELECTED_FILE, file.absolutePath))
|
setResult(Activity.RESULT_OK, Intent().putExtra(EXTRA_SELECTED_FILE, file.absolutePath))
|
||||||
finish()
|
finish()
|
||||||
},
|
},
|
||||||
onExit = { finish() },
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import android.graphics.Bitmap
|
|||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.droiddeck.launcher.files.PeIconExtractor
|
import com.droiddeck.launcher.files.PeIconExtractor
|
||||||
import com.droiddeck.launcher.session.SessionPrefs
|
import com.droiddeck.launcher.session.SessionPrefs
|
||||||
import com.droiddeck.launcher.stores.StoreArt
|
|
||||||
import com.droiddeck.launcher.stores.StoreGameSidecar
|
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.net.HttpURLConnection
|
import java.net.HttpURLConnection
|
||||||
@@ -230,93 +228,41 @@ object AddedGameArt {
|
|||||||
return if (tmp.renameTo(png)) png else null
|
return if (tmp.renameTo(png)) png else null
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class Sources(
|
fun fetchMissing(context: Context, games: List<AddedGames.Game>): Boolean {
|
||||||
val storeLogo: (AddedGames.Game) -> Boolean,
|
|
||||||
val steamSearch: (String) -> Int?,
|
|
||||||
val steam: (String, File, Set<Slot>) -> Boolean,
|
|
||||||
val sgdbGame: (String, Int?, String) -> Int?,
|
|
||||||
val sgdb: (String, Int, File, Set<Slot>) -> Boolean,
|
|
||||||
)
|
|
||||||
|
|
||||||
private val network = Sources(
|
|
||||||
storeLogo = ::storeLogo,
|
|
||||||
steamSearch = { name -> search(name)?.toIntOrNull() },
|
|
||||||
steam = ::download,
|
|
||||||
sgdbGame = SteamGridDb::gameId,
|
|
||||||
sgdb = SteamGridDb::download,
|
|
||||||
)
|
|
||||||
|
|
||||||
private val EXTRAS = setOf(Slot.LOGO, Slot.ICON)
|
|
||||||
private val STEAM_SLOTS = setOf(Slot.COVER, Slot.WIDE, Slot.BACKGROUND, Slot.LOGO)
|
|
||||||
internal const val EXTRAS_TRIED = "extras-tried"
|
|
||||||
|
|
||||||
internal fun missing(context: Context, game: AddedGames.Game): Set<Slot> {
|
|
||||||
val own = local(game)
|
|
||||||
val cache = cacheDir(context, game)
|
|
||||||
fun has(slot: Slot, mine: File?, cached: String) = chosen(cache, slot) != null || mine != null || File(cache, cached).isFile
|
|
||||||
return Slot.values().filterNot { slot ->
|
|
||||||
when (slot) {
|
|
||||||
Slot.COVER -> has(slot, own.portrait, "p.jpg")
|
|
||||||
Slot.WIDE -> has(slot, own.header, "header.jpg")
|
|
||||||
Slot.BACKGROUND -> has(slot, own.hero, "hero.jpg")
|
|
||||||
Slot.LOGO -> has(slot, own.logo, "logo.png")
|
|
||||||
Slot.ICON -> has(slot, own.icon, "icon-sgdb.png")
|
|
||||||
}
|
|
||||||
}.toSet()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun storeLogo(game: AddedGames.Game): Boolean {
|
|
||||||
val url = StoreGameSidecar.read(game.folder)?.logo ?: return false
|
|
||||||
return StoreArt.fetchLogo(game.folder, url)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun fetchMissing(context: Context, games: List<AddedGames.Game>): Boolean =
|
|
||||||
fetchMissing(context, games, SteamGridDb.key(context), network)
|
|
||||||
|
|
||||||
internal fun fetchMissing(context: Context, games: List<AddedGames.Game>, sgdbKey: String, sources: Sources): Boolean {
|
|
||||||
if (!SessionPrefs.addedGamesArt(context)) return false
|
if (!SessionPrefs.addedGamesArt(context)) return false
|
||||||
|
val sgdbKey = SteamGridDb.key(context)
|
||||||
val keyChangedAt = SteamGridDb.keyChangedAt(context)
|
val keyChangedAt = SteamGridDb.keyChangedAt(context)
|
||||||
var sgdbDown = false
|
var sgdbDown = false
|
||||||
var changed = false
|
var changed = false
|
||||||
for (game in games) {
|
for (game in games) {
|
||||||
val start = missing(context, game)
|
if (local(game).portrait != null) continue
|
||||||
val full = Slot.COVER in start
|
|
||||||
val allowed = if (full) Slot.values().toSet() else EXTRAS
|
|
||||||
var need = start intersect allowed
|
|
||||||
if (need.isEmpty() || (need == setOf(Slot.ICON) && sgdbKey.isEmpty())) continue
|
|
||||||
val cache = cacheDir(context, game)
|
val cache = cacheDir(context, game)
|
||||||
val tried = File(cache, EXTRAS_TRIED)
|
if (File(cache, "p.jpg").isFile) continue
|
||||||
if (!full && tried.isFile && tried.lastModified() >= keyChangedAt && System.currentTimeMillis() - tried.lastModified() < RETRY_AFTER_MS) continue
|
|
||||||
cache.mkdirs()
|
cache.mkdirs()
|
||||||
if (Slot.LOGO in need && game.source != Library.ADDED && runCatching { sources.storeLogo(game) }.getOrDefault(false)) {
|
val match = steamMatch(context, game) { name ->
|
||||||
changed = true
|
runCatching { search(name) }.onFailure { Log.w(TAG, "${game.name}: store search failed (${it.message})") }.getOrNull()?.toIntOrNull()
|
||||||
need = need - Slot.LOGO
|
|
||||||
}
|
}
|
||||||
val match by lazy {
|
val appId = match.appId?.takeIf { match.certainty == SteamMatch.Certainty.FILES }
|
||||||
steamMatch(context, game) { name ->
|
val id = match.appId?.toString()
|
||||||
runCatching { sources.steamSearch(name) }.onFailure { Log.w(TAG, "${game.name}: store search failed (${it.message})") }.getOrNull()
|
if (id != null && download(id, cache)) changed = true
|
||||||
|
if (File(cache, "p.jpg").isFile || sgdbKey.isEmpty() || sgdbDown) continue
|
||||||
|
val stored: String? = try {
|
||||||
|
remembered(File(cache, "sgdb-id"), keyChangedAt) {
|
||||||
|
SteamGridDb.gameId(sgdbKey, appId ?: id?.toIntOrNull(), game.name)?.toString()
|
||||||
}
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.w(TAG, "${game.name}: SteamGridDB lookup failed (${e.javaClass.simpleName}); not asking again this pass")
|
||||||
|
sgdbDown = true
|
||||||
|
null
|
||||||
}
|
}
|
||||||
val steamWant = need intersect STEAM_SLOTS
|
val gridId = stored?.toIntOrNull() ?: continue
|
||||||
if (steamWant.isNotEmpty()) {
|
val grabbed = try {
|
||||||
val id = match.appId?.toString()
|
SteamGridDb.download(sgdbKey, gridId, cache)
|
||||||
if (id != null && sources.steam(id, cache, steamWant)) changed = true
|
} catch (e: Exception) {
|
||||||
need = missing(context, game) intersect allowed
|
sgdbDown = true
|
||||||
|
false
|
||||||
}
|
}
|
||||||
var asked = true
|
if (grabbed) changed = true
|
||||||
if (need.isNotEmpty() && sgdbKey.isNotEmpty()) {
|
|
||||||
if (sgdbDown) asked = false else try {
|
|
||||||
val gridId = remembered(File(cache, "sgdb-id"), keyChangedAt) {
|
|
||||||
sources.sgdbGame(sgdbKey, match.appId, game.name)?.toString()
|
|
||||||
}?.toIntOrNull()
|
|
||||||
if (gridId != null && sources.sgdb(sgdbKey, gridId, cache, need)) changed = true
|
|
||||||
} catch (e: Exception) {
|
|
||||||
Log.w(TAG, "${game.name}: SteamGridDB failed (${e.javaClass.simpleName}); not asking again this pass")
|
|
||||||
sgdbDown = true
|
|
||||||
asked = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((missing(context, game) intersect EXTRAS).isEmpty()) tried.delete() else if (asked) tried.writeText("")
|
|
||||||
}
|
}
|
||||||
return changed
|
return changed
|
||||||
}
|
}
|
||||||
@@ -368,19 +314,17 @@ object AddedGameArt {
|
|||||||
return pickStoreResult(name, (0 until items.length()).map { items.getJSONObject(it) }.map { it.optString("id") to it.optString("name") })
|
return pickStoreResult(name, (0 until items.length()).map { items.getJSONObject(it) }.map { it.optString("id") to it.optString("name") })
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun download(id: String, cache: File, slots: Set<Slot>): Boolean {
|
private fun download(id: String, cache: File): Boolean {
|
||||||
var got = false
|
var got = false
|
||||||
for ((slot, remote, localName) in listOf(
|
for ((remote, localName) in listOf(
|
||||||
Triple(Slot.COVER, "library_600x900.jpg", "p.jpg"), Triple(Slot.WIDE, "header.jpg", "header.jpg"),
|
"library_600x900.jpg" to "p.jpg", "header.jpg" to "header.jpg", "library_hero.jpg" to "hero.jpg", "logo.png" to "logo.png",
|
||||||
Triple(Slot.BACKGROUND, "library_hero.jpg", "hero.jpg"), Triple(Slot.LOGO, "logo.png", "logo.png"),
|
|
||||||
)) {
|
)) {
|
||||||
if (slot !in slots) continue
|
|
||||||
val dst = File(cache, localName)
|
val dst = File(cache, localName)
|
||||||
if (dst.isFile) continue
|
if (dst.isFile) continue
|
||||||
val bytes = get("$CDN$id/$remote") ?: steamAssetUrl(id, remote)?.let { get(it) } ?: continue
|
val bytes = get("$CDN$id/$remote") ?: steamAssetUrl(id, remote)?.let { get(it) } ?: continue
|
||||||
val tmp = File(cache, "$localName.tmp")
|
val tmp = File(cache, "$localName.tmp")
|
||||||
if (runCatching { tmp.writeBytes(bytes) }.isFailure) { tmp.delete(); continue }
|
tmp.writeBytes(bytes)
|
||||||
if (tmp.renameTo(dst)) { got = true; runCatching { File(cache, "$localName.src").writeText(STEAM) } }
|
if (tmp.renameTo(dst)) { got = true; File(cache, "$localName.src").writeText(STEAM) }
|
||||||
}
|
}
|
||||||
return got
|
return got
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,20 +41,10 @@ object AddedGames {
|
|||||||
return SessionPrefs.gameFolderBinds(context).map { (host, guest) -> Root(File(host), guest) }
|
return SessionPrefs.gameFolderBinds(context).map { (host, guest) -> Root(File(host), guest) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private val SKIP_PREFIX = Regex("(?i)^(unins|setup|vc_?redist|dxsetup|dxwebsetup|dotnet|directx|easyanticheat|battleye).*")
|
private val SKIP = Regex(
|
||||||
private val SKIP_PART = Regex("(?i)redist|prereq|installer|uninstall|crashreport|crashhandler|crashpad|crashsender|launchhelper")
|
"(?i)^(unins.*|setup.*|.*redist.*|vcredist.*|dxsetup.*|dxwebsetup.*|.*crash.*|.*report.*|dotnet.*|directx.*|.*prereq.*" +
|
||||||
private val SKIP_WORDS = setOf(
|
"|.*installer.*|.*uninstall.*|.*updater?.*|.*config(ur.*)?|.*settings.*|.*editor.*|.*server.*|.*benchmark.*|.*helper.*|.*eac.*|.*easyanticheat.*|.*battleye.*)\\.exe$",
|
||||||
"eac", "report", "reporter", "editor", "server", "benchmark", "helper",
|
|
||||||
"update", "updater", "config", "configure", "configurator", "configuration", "settings",
|
|
||||||
)
|
)
|
||||||
private val WORD = Regex("[A-Z]?[a-z]+|[A-Z]+(?![a-z])|[0-9]+")
|
|
||||||
|
|
||||||
internal fun skipExe(name: String): Boolean {
|
|
||||||
if (!name.endsWith(".exe", ignoreCase = true)) return false
|
|
||||||
val base = name.dropLast(4)
|
|
||||||
if (SKIP_PREFIX.matches(base) || SKIP_PART.containsMatchIn(base)) return true
|
|
||||||
return WORD.findAll(base).any { it.value.lowercase() in SKIP_WORDS }
|
|
||||||
}
|
|
||||||
|
|
||||||
const val GUEST_DIR = "/root/Games"
|
const val GUEST_DIR = "/root/Games"
|
||||||
|
|
||||||
@@ -85,7 +75,7 @@ object AddedGames {
|
|||||||
val key = "${folder.path}|${folder.lastModified()}"
|
val key = "${folder.path}|${folder.lastModified()}"
|
||||||
val now = System.currentTimeMillis()
|
val now = System.currentTimeMillis()
|
||||||
ranked[key]?.takeIf { now - it.first < RANK_FRESH_MS }?.let { return it.second }
|
ranked[key]?.takeIf { now - it.first < RANK_FRESH_MS }?.let { return it.second }
|
||||||
val guessed = GameExePicker.rank(folder) { !skipExe(it.name) }
|
val guessed = GameExePicker.rank(folder) { !SKIP.matches(it.name) }
|
||||||
val declared = declaredExes(folder)
|
val declared = declaredExes(folder)
|
||||||
val preferred = declared.map { it.path }.toSet()
|
val preferred = declared.map { it.path }.toSet()
|
||||||
val result = if (declared.isEmpty()) guessed else GameExePicker.Ranking(
|
val result = if (declared.isEmpty()) guessed else GameExePicker.Ranking(
|
||||||
@@ -138,7 +128,7 @@ object AddedGames {
|
|||||||
val root = runCatching { folder.canonicalPath + File.separator }.getOrNull() ?: return emptyList()
|
val root = runCatching { folder.canonicalPath + File.separator }.getOrNull() ?: return emptyList()
|
||||||
return names.asSequence()
|
return names.asSequence()
|
||||||
.map { File(folder, it.trim().replace('\\', '/').trimStart('/')) }
|
.map { File(folder, it.trim().replace('\\', '/').trimStart('/')) }
|
||||||
.filter { it.name.endsWith(".exe", ignoreCase = true) && !skipExe(it.name) && it.isFile }
|
.filter { it.name.endsWith(".exe", ignoreCase = true) && !SKIP.matches(it.name) && it.isFile }
|
||||||
.filter { runCatching { it.canonicalPath.startsWith(root) }.getOrDefault(false) }
|
.filter { runCatching { it.canonicalPath.startsWith(root) }.getOrDefault(false) }
|
||||||
.distinctBy { it.path }
|
.distinctBy { it.path }
|
||||||
.toList()
|
.toList()
|
||||||
@@ -214,10 +204,8 @@ object AddedGames {
|
|||||||
GamesFolderMigration.run(context)
|
GamesFolderMigration.run(context)
|
||||||
val path = canonical(exe)
|
val path = canonical(exe)
|
||||||
fun holds(f: File) = inside(path, canonical(f))
|
fun holds(f: File) = inside(path, canonical(f))
|
||||||
val entries = AddedExes.list(context)
|
AddedExes.list(context).map { File(it.folder) }.firstOrNull(::holds)?.let { return it }
|
||||||
fun owns(f: File) = holds(f) && sameGame(f, currentExe(context, entries, f), exe)
|
SessionPrefs.removedAddedGames(context).map { File(it) }.firstOrNull(::holds)?.let { return it }
|
||||||
entries.map { File(it.folder) }.filter(::owns).maxByOrNull { canonical(it).length }?.let { return it }
|
|
||||||
SessionPrefs.removedAddedGames(context).map { File(it) }.filter(::owns).maxByOrNull { canonical(it).length }?.let { return it }
|
|
||||||
StoreInstallRoot.gameFolders(context).firstOrNull(::holds)?.let { return it }
|
StoreInstallRoot.gameFolders(context).firstOrNull(::holds)?.let { return it }
|
||||||
val dirs = listOfNotNull(
|
val dirs = listOfNotNull(
|
||||||
GameStorage.effective(context)?.let { File(it.path, "steamapps/common") },
|
GameStorage.effective(context)?.let { File(it.path, "steamapps/common") },
|
||||||
@@ -232,24 +220,6 @@ object AddedGames {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun currentExe(context: Context, entries: List<AddedExes.Entry>, folder: File): File? =
|
|
||||||
SessionPrefs.addedGameExe(context, folder.path).takeIf { it.isNotEmpty() }?.let(::File)
|
|
||||||
?: entries.firstOrNull { it.folder == folder.path }?.let { File(it.exe) }
|
|
||||||
?: rank(folder).exes.firstOrNull()
|
|
||||||
|
|
||||||
private fun sameGame(folder: File, current: File?, pick: File): Boolean {
|
|
||||||
val base = canonical(folder)
|
|
||||||
if (current == null || pick.parentFile?.let(::canonical) == base) return true
|
|
||||||
val known = canonical(current)
|
|
||||||
if (!inside(known, base) || known.substringBeforeLast('/') == base) return true
|
|
||||||
val picked = canonical(pick)
|
|
||||||
fun top(p: String) = p.removePrefix("$base/").substringBefore('/')
|
|
||||||
fun stem(p: String) = p.substringAfterLast('/').lowercase().removeSuffix(".exe").replace(EXE_BUILD, "").filter { it.isLetterOrDigit() }
|
|
||||||
return top(known) == top(picked) || stem(known).let { it.isNotEmpty() && it == stem(picked) }
|
|
||||||
}
|
|
||||||
|
|
||||||
private val EXE_BUILD = Regex("([-_. ](x64|x86|win64|win32|64|32|shipping))+$")
|
|
||||||
|
|
||||||
fun addExe(context: Context, exe: File): AddResult {
|
fun addExe(context: Context, exe: File): AddResult {
|
||||||
val app = context.applicationContext
|
val app = context.applicationContext
|
||||||
if (!exe.isFile) return AddResult.NotFound
|
if (!exe.isFile) return AddResult.NotFound
|
||||||
@@ -258,10 +228,7 @@ object AddedGames {
|
|||||||
if (owner != null && owner.path !in SessionPrefs.removedAddedGames(app)) {
|
if (owner != null && owner.path !in SessionPrefs.removedAddedGames(app)) {
|
||||||
single(app, owner.path)?.takeIf { canonical(it.exe) == path }?.let { return AddResult.Existing(it) }
|
single(app, owner.path)?.takeIf { canonical(it.exe) == path }?.let { return AddResult.Existing(it) }
|
||||||
}
|
}
|
||||||
if (guestPath(app, exe) == null) {
|
if (owner == null && guestPath(app, exe) == null) return AddResult.Unreachable
|
||||||
(owner ?: exe.parentFile)?.takeIf { guestPath(app, it) == null }?.let { bindFolder(app, it) }
|
|
||||||
if (guestPath(app, exe) == null) return AddResult.Unreachable
|
|
||||||
}
|
|
||||||
val folder = owner ?: exe.parentFile ?: return AddResult.NotFound
|
val folder = owner ?: exe.parentFile ?: return AddResult.NotFound
|
||||||
SessionPrefs.setAddedGameRemoved(app, folder.path, false)
|
SessionPrefs.setAddedGameRemoved(app, folder.path, false)
|
||||||
SessionPrefs.setAddedGameExe(app, folder.path, exe.path)
|
SessionPrefs.setAddedGameExe(app, folder.path, exe.path)
|
||||||
@@ -274,16 +241,14 @@ object AddedGames {
|
|||||||
|
|
||||||
class FolderResult(val added: List<Game>, val already: Int)
|
class FolderResult(val added: List<Game>, val already: Int)
|
||||||
|
|
||||||
fun addFolder(context: Context, dir: File, onGame: (Game) -> Unit = {}, onChecking: (String?) -> Unit = {}, showHidden: Boolean = false): FolderResult {
|
fun addFolder(context: Context, dir: File, onGame: (Game) -> Unit = {}, onChecking: (String?) -> Unit = {}): FolderResult {
|
||||||
val app = context.applicationContext
|
val app = context.applicationContext
|
||||||
// Binds are mounted at session start, so a new one reaches the session from the next start.
|
|
||||||
if (guestPath(app, dir) == null) bindFolder(app, dir)
|
|
||||||
val removed = SessionPrefs.removedAddedGames(app).toSet()
|
val removed = SessionPrefs.removedAddedGames(app).toSet()
|
||||||
val listed = listedFolders(app, removed)
|
val listed = listedFolders(app, removed)
|
||||||
var already = 0
|
var already = 0
|
||||||
val fresh = ArrayList<String>()
|
val fresh = ArrayList<String>()
|
||||||
val added = ArrayList<Game>()
|
val added = ArrayList<Game>()
|
||||||
for (sub in dir.listFiles { f -> f.isDirectory && (showHidden || !f.name.startsWith(".")) }?.sortedBy { it.name.lowercase() }.orEmpty()) {
|
for (sub in dir.listFiles { f -> f.isDirectory && !f.name.startsWith(".") }?.sortedBy { it.name.lowercase() }.orEmpty()) {
|
||||||
val path = canonical(sub)
|
val path = canonical(sub)
|
||||||
if (listed.any { it == path || inside(path, it) || inside(it, path) }) { already++; continue }
|
if (listed.any { it == path || inside(path, it) || inside(it, path) }) { already++; continue }
|
||||||
onChecking(sub.name)
|
onChecking(sub.name)
|
||||||
@@ -301,20 +266,6 @@ object AddedGames {
|
|||||||
return FolderResult(added, already)
|
return FolderResult(added, already)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Synchronized
|
|
||||||
internal fun bindFolder(context: Context, dir: File) {
|
|
||||||
if (!dir.isDirectory || !dir.canRead()) return
|
|
||||||
val binds = SessionPrefs.gameFolderBinds(context)
|
|
||||||
if (binds.any { it.first == dir.path }) return
|
|
||||||
val taken = binds.map { it.second }.toSet()
|
|
||||||
val base = GamesFolderMigration.legacyRoots(binds.map { it.first } + dir.path).last().guest
|
|
||||||
var guest = base
|
|
||||||
var n = 2
|
|
||||||
while (guest in taken) guest = "$base-${n++}"
|
|
||||||
SessionPrefs.setGameFolderBinds(context, binds + (dir.path to guest))
|
|
||||||
Log.i(TAG, "games: bound $dir at $guest")
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun listedFolders(context: Context, removed: Set<String>): List<String> {
|
private fun listedFolders(context: Context, removed: Set<String>): List<String> {
|
||||||
val out = ArrayList<String>()
|
val out = ArrayList<String>()
|
||||||
GamesFolderMigration.run(context)
|
GamesFolderMigration.run(context)
|
||||||
|
|||||||
@@ -63,8 +63,7 @@ object CoverArt {
|
|||||||
missFile(context, rom).delete()
|
missFile(context, rom).delete()
|
||||||
found = true
|
found = true
|
||||||
} else {
|
} else {
|
||||||
runCatching { missFile(context, rom).apply { parentFile?.mkdirs(); writeText(url ?: "") } }
|
missFile(context, rom).apply { parentFile?.mkdirs(); writeText(url ?: "") }
|
||||||
.onFailure { Log.w(TAG, "${rom.name}: miss marker not written: $it") }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return found
|
return found
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import java.io.InputStream
|
|||||||
object GameFiles {
|
object GameFiles {
|
||||||
const val EXTENSION = "steam"
|
const val EXTENSION = "steam"
|
||||||
private const val MAX_BYTES = 128
|
private const val MAX_BYTES = 128
|
||||||
private const val MAX_NAME_BYTES = 200
|
|
||||||
private const val INVENTORY = ".droiddeck-sync.json"
|
private const val INVENTORY = ".droiddeck-sync.json"
|
||||||
private const val FORMAT = "droiddeck-game-files-v1"
|
private const val FORMAT = "droiddeck-game-files-v1"
|
||||||
|
|
||||||
@@ -51,15 +50,8 @@ object GameFiles {
|
|||||||
fun filename(game: Library.SteamGame, disambiguate: Boolean = false): String {
|
fun filename(game: Library.SteamGame, disambiguate: Boolean = false): String {
|
||||||
val sanitized = game.name.replace(Regex("[\\p{Cntrl}\\\\/:*?\"<>|]"), "_")
|
val sanitized = game.name.replace(Regex("[\\p{Cntrl}\\\\/:*?\"<>|]"), "_")
|
||||||
.trim().trim('.').ifBlank { "Game" }
|
.trim().trim('.').ifBlank { "Game" }
|
||||||
val points = sanitized.codePoints().toArray()
|
val points = sanitized.codePoints().limit(40).toArray()
|
||||||
var end = 0
|
val title = String(points, 0, points.size)
|
||||||
var bytes = 0
|
|
||||||
while (end < points.size) {
|
|
||||||
bytes += String(points, end, 1).toByteArray().size
|
|
||||||
if (bytes > MAX_NAME_BYTES) break
|
|
||||||
end++
|
|
||||||
}
|
|
||||||
val title = String(points, 0, end).trimEnd { it.isWhitespace() || it == '.' }.ifBlank { "Game" }
|
|
||||||
val suffix = if (disambiguate) " (${game.gameIdString})" else ""
|
val suffix = if (disambiguate) " (${game.gameIdString})" else ""
|
||||||
return "$title$suffix.$EXTENSION"
|
return "$title$suffix.$EXTENSION"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ object GameIdentifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private val JUNK_NAME_RE = Regex(
|
private val JUNK_NAME_RE = Regex(
|
||||||
"""(?i)^(gse|steam|steam client|goldberg.*|launcher|game|play|start|setup|.* launcher.*|.*launcher redirector|.* redirector|rockstar games launcher.*|epic games launcher|smartsteamemu|coldclient.*|steamemu.*|bootstrappackagedgame)$"""
|
"""(?i)^(gse|steam|steam client|goldberg.*|launcher|game|play|start|setup|.* launcher.*|.*launcher redirector|.* redirector|rockstar games launcher.*|epic games launcher|smartsteamemu|coldclient.*|steamemu.*)$"""
|
||||||
)
|
)
|
||||||
|
|
||||||
fun isJunkPeName(name: String): Boolean {
|
fun isJunkPeName(name: String): Boolean {
|
||||||
|
|||||||
@@ -1,52 +0,0 @@
|
|||||||
package com.droiddeck.launcher.frontend
|
|
||||||
|
|
||||||
import com.droiddeck.launcher.stores.InstalledStoreGame
|
|
||||||
import com.droiddeck.launcher.stores.Store
|
|
||||||
import com.droiddeck.launcher.stores.StoreGameSidecar
|
|
||||||
import com.droiddeck.launcher.stores.StoreInstalls
|
|
||||||
import com.droiddeck.launcher.stores.StoresState
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
object GameRemoval {
|
|
||||||
enum class Kind { STORE, SHORTCUT, LAUNCHER }
|
|
||||||
|
|
||||||
fun kind(game: Library.SteamGame): Kind = when {
|
|
||||||
game.library == Library.EPIC_LAUNCHER -> Kind.LAUNCHER
|
|
||||||
game.library == Library.ADDED && game.source == Library.ADDED -> Kind.SHORTCUT
|
|
||||||
else -> Kind.STORE
|
|
||||||
}
|
|
||||||
|
|
||||||
class SteamFiles(val dir: File, val manifest: File, val partial: File?)
|
|
||||||
|
|
||||||
fun steamFiles(game: Library.SteamGame): SteamFiles? {
|
|
||||||
val dir = game.gameFiles ?: return null
|
|
||||||
val common = dir.parentFile ?: return null
|
|
||||||
if (common.name != "common") return null
|
|
||||||
val steamapps = common.parentFile ?: return null
|
|
||||||
if (steamapps.name != "steamapps") return null
|
|
||||||
val manifest = File(steamapps, "appmanifest_${game.appId}.acf")
|
|
||||||
if (!manifest.isFile) return null
|
|
||||||
if (!declares(manifest, game.appId)) return null
|
|
||||||
return SteamFiles(dir, manifest, File(steamapps, "downloading/${game.appId}"))
|
|
||||||
}
|
|
||||||
|
|
||||||
fun delete(target: SteamFiles): Boolean {
|
|
||||||
StoreInstalls.deleteTree(target.dir)
|
|
||||||
if (target.dir.exists()) return false
|
|
||||||
target.partial?.let { StoreInstalls.deleteTree(it) }
|
|
||||||
target.manifest.delete()
|
|
||||||
return !target.manifest.exists()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun storeGame(game: Library.SteamGame): InstalledStoreGame? {
|
|
||||||
val folder = game.gameFiles ?: return null
|
|
||||||
val store = Store.byId(game.source)
|
|
||||||
val id = game.storeId
|
|
||||||
if (store != null && id != null) StoresState.installedGame(store, id)?.let { return it }
|
|
||||||
val sidecar = StoreGameSidecar.read(folder)?.takeIf { it.isInstalled } ?: return null
|
|
||||||
return InstalledStoreGame(sidecar, folder)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun declares(manifest: File, appId: Int): Boolean =
|
|
||||||
runCatching { manifest.readText() }.getOrNull()?.let { Regex("\"appid\"\\s+\"$appId\"").containsMatchIn(it) } == true
|
|
||||||
}
|
|
||||||
@@ -10,21 +10,20 @@ import android.graphics.BitmapFactory
|
|||||||
import android.graphics.drawable.Icon
|
import android.graphics.drawable.Icon
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import com.droiddeck.launcher.LauncherIcon
|
import com.droiddeck.launcher.MainActivity
|
||||||
import com.droiddeck.launcher.FrontEndActivity
|
|
||||||
import com.droiddeck.launcher.R
|
import com.droiddeck.launcher.R
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
object GameShortcuts {
|
object GameShortcuts {
|
||||||
fun launchIntent(context: Context, gameId: String) = Intent(Intent.ACTION_VIEW,
|
fun launchIntent(context: Context, gameId: String) = Intent(Intent.ACTION_VIEW,
|
||||||
Uri.parse(GameLaunchLink.uri(gameId)), context, FrontEndActivity::class.java)
|
Uri.parse(GameLaunchLink.uri(gameId)), context, MainActivity::class.java)
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
||||||
|
|
||||||
private fun info(context: Context, game: Library.SteamGame): ShortcutInfo {
|
private fun info(context: Context, game: Library.SteamGame): ShortcutInfo {
|
||||||
val name = game.name.ifBlank { context.getString(R.string.app_name) }
|
val name = game.name.ifBlank { context.getString(R.string.app_name) }
|
||||||
val icon = iconBitmap(game)?.let(Icon::createWithBitmap) ?: Icon.createWithResource(context, R.mipmap.ic_launcher)
|
val icon = iconBitmap(game)?.let(Icon::createWithBitmap) ?: Icon.createWithResource(context, R.mipmap.ic_launcher)
|
||||||
return ShortcutInfo.Builder(context, "game:${game.gameIdString}")
|
return ShortcutInfo.Builder(context, "game:${game.gameIdString}")
|
||||||
.setActivity(LauncherIcon.activity(context))
|
.setActivity(android.content.ComponentName(context, MainActivity::class.java))
|
||||||
.setShortLabel(name.take(40)).setLongLabel(name).setIcon(icon)
|
.setShortLabel(name.take(40)).setLongLabel(name).setIcon(icon)
|
||||||
.setIntent(launchIntent(context, game.gameIdString)).build()
|
.setIntent(launchIntent(context, game.gameIdString)).build()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,10 +16,9 @@ object Library {
|
|||||||
val icon: File? = null,
|
val icon: File? = null,
|
||||||
val source: String = SOURCE_STEAM,
|
val source: String = SOURCE_STEAM,
|
||||||
val storeId: String? = null,
|
val storeId: String? = null,
|
||||||
val logo: File? = null,
|
|
||||||
) {
|
) {
|
||||||
fun withArt(art: File?, hero: File?, icon: File?, logo: File? = this.logo) =
|
fun withArt(art: File?, hero: File?, icon: File?) =
|
||||||
SteamGame(appId, name, art, library, gameId, hero, lastPlayed, gameFiles, protonPrefix, icon, source, storeId, logo)
|
SteamGame(appId, name, art, library, gameId, hero, lastPlayed, gameFiles, protonPrefix, icon, source, storeId)
|
||||||
|
|
||||||
val gameIdString: String get() = java.lang.Long.toUnsignedString(gameId)
|
val gameIdString: String get() = java.lang.Long.toUnsignedString(gameId)
|
||||||
val profileKey: String get() = if (library == ADDED) java.lang.Integer.toUnsignedString(appId) else appId.toString()
|
val profileKey: String get() = if (library == ADDED) java.lang.Integer.toUnsignedString(appId) else appId.toString()
|
||||||
@@ -69,12 +68,10 @@ object Library {
|
|||||||
)
|
)
|
||||||
private val STEAM_CAPSULES = listOf("library_capsule.jpg", "library_600x900.jpg")
|
private val STEAM_CAPSULES = listOf("library_capsule.jpg", "library_600x900.jpg")
|
||||||
private val STEAM_HEROES = listOf("library_hero.jpg")
|
private val STEAM_HEROES = listOf("library_hero.jpg")
|
||||||
internal val STEAM_LOGOS = listOf("logo.png")
|
|
||||||
private val STEAM_ICON = Regex("[a-fA-F0-9]{40}\\.(jpg|png)")
|
private val STEAM_ICON = Regex("[a-fA-F0-9]{40}\\.(jpg|png)")
|
||||||
private val NAME = Regex("^\\s*\"name\"\\s*\"([^\"]*)\"", RegexOption.MULTILINE)
|
private val NAME = Regex("^\\s*\"name\"\\s*\"([^\"]*)\"", RegexOption.MULTILINE)
|
||||||
private val STATE = Regex("^\\s*\"StateFlags\"\\s*\"(\\d+)\"", RegexOption.MULTILINE)
|
private val STATE = Regex("^\\s*\"StateFlags\"\\s*\"(\\d+)\"", RegexOption.MULTILINE)
|
||||||
private val LAST_PLAYED = Regex("^\\s*\"LastPlayed\"\\s*\"(\\d+)\"", RegexOption.MULTILINE)
|
private val LAST_PLAYED = Regex("^\\s*\"LastPlayed\"\\s*\"(\\d+)\"", RegexOption.MULTILINE)
|
||||||
private val PRIVATE_APPS = Regex("\"PrivateApps_\\d+\"\\s*\"\\[([^\\]]*)\\]\"")
|
|
||||||
private val INSTALL_DIR = Regex("^\\s*\"installdir\"\\s*\"([^\"]*)\"", RegexOption.MULTILINE)
|
private val INSTALL_DIR = Regex("^\\s*\"installdir\"\\s*\"([^\"]*)\"", RegexOption.MULTILINE)
|
||||||
|
|
||||||
internal fun steamLibraries(context: Context, arch: String = SessionPrefs.activeSteamClientArch(context)): List<Pair<File, String>> {
|
internal fun steamLibraries(context: Context, arch: String = SessionPrefs.activeSteamClientArch(context)): List<Pair<File, String>> {
|
||||||
@@ -133,7 +130,6 @@ object Library {
|
|||||||
protonPrefix = protonPrefix(context, appId.toLong(), library, roots),
|
protonPrefix = protonPrefix(context, appId.toLong(), library, roots),
|
||||||
icon = steamCacheImage(cache, appId, listOf("icon.jpg", "icon.png"))
|
icon = steamCacheImage(cache, appId, listOf("icon.jpg", "icon.png"))
|
||||||
?: File(cache, appId.toString()).listFiles()?.firstOrNull { it.isFile && STEAM_ICON.matches(it.name) },
|
?: File(cache, appId.toString()).listFiles()?.firstOrNull { it.isFile && STEAM_ICON.matches(it.name) },
|
||||||
logo = steamCacheImage(cache, appId, STEAM_LOGOS),
|
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -141,35 +137,13 @@ object Library {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun steamLibraryArt(context: Context): List<Pair<Int, File>> {
|
fun steamLibraryArt(context: Context): List<Pair<Int, File>> {
|
||||||
val root = SessionPrefs.activeSteamRoot(context)
|
val cache = File(SessionPrefs.activeSteamRoot(context), "appcache/librarycache")
|
||||||
val cache = File(root, "appcache/librarycache")
|
|
||||||
val concealed = concealedSteamApps(root)
|
|
||||||
return cache.listFiles().orEmpty().mapNotNull { dir ->
|
return cache.listFiles().orEmpty().mapNotNull { dir ->
|
||||||
val appId = dir.name.toIntOrNull()?.takeIf { it !in NOT_GAMES && it.toLong() !in concealed } ?: return@mapNotNull null
|
val appId = dir.name.toIntOrNull()?.takeIf { it !in NOT_GAMES } ?: return@mapNotNull null
|
||||||
steamCacheImage(cache, appId, STEAM_CAPSULES)?.let { appId to it }
|
steamCacheImage(cache, appId, STEAM_CAPSULES)?.let { appId to it }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Apps the user hid (the "hidden" collection) or marked private in Steam. */
|
|
||||||
internal fun concealedSteamApps(root: File): Set<Long> {
|
|
||||||
val config = AddedGames.accountConfig(root) ?: return emptySet()
|
|
||||||
val hidden = runCatching {
|
|
||||||
val entries = org.json.JSONArray(File(config, "cloudstorage/cloud-storage-namespace-1.json").readText())
|
|
||||||
val entry = (0 until entries.length()).map { entries.getJSONArray(it) }
|
|
||||||
.firstOrNull { it.optString(0) == "user-collections.hidden" }?.optJSONObject(1)
|
|
||||||
if (entry == null || entry.optBoolean("is_deleted")) emptySet() else {
|
|
||||||
val collection = org.json.JSONObject(entry.optString("value"))
|
|
||||||
fun ids(key: String) = collection.optJSONArray(key)?.let { a -> (0 until a.length()).map { a.optLong(it) } }.orEmpty()
|
|
||||||
ids("added").toSet() - ids("removed").toSet()
|
|
||||||
}
|
|
||||||
}.getOrDefault(emptySet())
|
|
||||||
val private = runCatching {
|
|
||||||
PRIVATE_APPS.find(File(config, "localconfig.vdf").readText())?.groupValues?.get(1)
|
|
||||||
?.split(',')?.mapNotNull { it.trim().toLongOrNull() }?.toSet()
|
|
||||||
}.getOrNull().orEmpty()
|
|
||||||
return hidden + private
|
|
||||||
}
|
|
||||||
|
|
||||||
fun fromSteamClient(g: SteamGame): Boolean = g.library != ADDED && g.source == SOURCE_STEAM
|
fun fromSteamClient(g: SteamGame): Boolean = g.library != ADDED && g.source == SOURCE_STEAM
|
||||||
|
|
||||||
fun launchableGames(
|
fun launchableGames(
|
||||||
@@ -181,23 +155,9 @@ object Library {
|
|||||||
var steam = steamGames(context, strictRead, arch)
|
var steam = steamGames(context, strictRead, arch)
|
||||||
val targets = steam.filter(::fromSteamClient).map { SteamGrid.target(it, context) } + list.map { SteamGrid.target(it, context) }
|
val targets = steam.filter(::fromSteamClient).map { SteamGrid.target(it, context) } + list.map { SteamGrid.target(it, context) }
|
||||||
if (runCatching { SteamGrid.sync(context, targets) }.getOrDefault(false)) steam = steamGames(context, strictRead, arch)
|
if (runCatching { SteamGrid.sync(context, targets) }.getOrDefault(false)) steam = steamGames(context, strictRead, arch)
|
||||||
val claimed = claimedFolders(steam)
|
return (steam + list.map { g -> addedGame(context, g, roots) }).distinctBy { it.gameId }
|
||||||
val own = list.filter { g ->
|
|
||||||
g.steamAppId != null || claimed.isEmpty() ||
|
|
||||||
(runCatching { g.folder.canonicalPath }.getOrDefault(g.folder.absolutePath) !in claimed &&
|
|
||||||
AddedGames.guestPath(context, g.folder).let { it == null || it !in claimed })
|
|
||||||
}
|
|
||||||
return (steam + own.map { g -> addedGame(context, g, roots) }).distinctBy { it.gameId }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun claimedFolders(steam: List<SteamGame>): Set<String> = steam.filter(::fromSteamClient).flatMap { g ->
|
|
||||||
val dir = g.gameFiles ?: return@flatMap emptyList()
|
|
||||||
listOfNotNull(
|
|
||||||
runCatching { dir.canonicalPath }.getOrNull(),
|
|
||||||
runCatching { java.nio.file.Files.readSymbolicLink(dir.toPath()).toString() }.getOrNull(),
|
|
||||||
)
|
|
||||||
}.toSet()
|
|
||||||
|
|
||||||
fun addedGame(context: Context, g: AddedGames.Game, roots: List<File> = steamLibraries(context).map { it.first }): SteamGame =
|
fun addedGame(context: Context, g: AddedGames.Game, roots: List<File> = steamLibraries(context).map { it.first }): SteamGame =
|
||||||
AddedGameArt.resolve(context, g).let { art ->
|
AddedGameArt.resolve(context, g).let { art ->
|
||||||
SteamGame(
|
SteamGame(
|
||||||
@@ -206,7 +166,6 @@ object Library {
|
|||||||
protonPrefix = protonPrefix(context, g.steamAppId?.toLong() ?: g.appId, libraries = roots),
|
protonPrefix = protonPrefix(context, g.steamAppId?.toLong() ?: g.appId, libraries = roots),
|
||||||
icon = art.icon?.takeIf { it.extension.lowercase() != "ico" },
|
icon = art.icon?.takeIf { it.extension.lowercase() != "ico" },
|
||||||
source = g.source, storeId = g.storeId,
|
source = g.source, storeId = g.storeId,
|
||||||
logo = art.logo,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ object LibraryCache {
|
|||||||
icon = o.file("icon"),
|
icon = o.file("icon"),
|
||||||
source = o.optString("source").ifEmpty { if (o.getString("library") == Library.ADDED) Library.ADDED else Library.SOURCE_STEAM },
|
source = o.optString("source").ifEmpty { if (o.getString("library") == Library.ADDED) Library.ADDED else Library.SOURCE_STEAM },
|
||||||
storeId = o.optString("storeId").ifEmpty { null },
|
storeId = o.optString("storeId").ifEmpty { null },
|
||||||
logo = o.file("logo"),
|
|
||||||
)
|
)
|
||||||
} to x64
|
} to x64
|
||||||
}.getOrElse { e -> Log.w(TAG, "unreadable, ignored: ${e.message}"); Pair(emptyList(), false) }
|
}.getOrElse { e -> Log.w(TAG, "unreadable, ignored: ${e.message}"); Pair(emptyList(), false) }
|
||||||
@@ -45,7 +44,7 @@ object LibraryCache {
|
|||||||
for (g in games) array.put(
|
for (g in games) array.put(
|
||||||
JSONObject().put("appId", g.appId).put("name", g.name).put("library", g.library).put("gameId", g.gameId)
|
JSONObject().put("appId", g.appId).put("name", g.name).put("library", g.library).put("gameId", g.gameId)
|
||||||
.put("lastPlayed", g.lastPlayed).putFile("art", g.art).putFile("hero", g.hero)
|
.put("lastPlayed", g.lastPlayed).putFile("art", g.art).putFile("hero", g.hero)
|
||||||
.putFile("gameFiles", g.gameFiles).putFile("protonPrefix", g.protonPrefix).putFile("icon", g.icon).putFile("logo", g.logo)
|
.putFile("gameFiles", g.gameFiles).putFile("protonPrefix", g.protonPrefix).putFile("icon", g.icon)
|
||||||
.put("source", g.source).apply { g.storeId?.let { put("storeId", it) } },
|
.put("source", g.source).apply { g.storeId?.let { put("storeId", it) } },
|
||||||
)
|
)
|
||||||
val f = file(context)
|
val f = file(context)
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ object SteamAppInfo {
|
|||||||
return String(bytes, Charsets.UTF_8)
|
return String(bytes, Charsets.UTF_8)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun readMap(b: ByteBuffer, strings: List<String>?): Map<String, Any> {
|
private fun readMap(b: ByteBuffer, strings: List<String>?): Map<String, Any> {
|
||||||
val out = LinkedHashMap<String, Any>()
|
val out = LinkedHashMap<String, Any>()
|
||||||
while (b.hasRemaining()) {
|
while (b.hasRemaining()) {
|
||||||
val type = b.get().toInt() and 0xFF
|
val type = b.get().toInt() and 0xFF
|
||||||
|
|||||||
@@ -22,12 +22,10 @@ object SteamGameArt {
|
|||||||
val cover = chosenFile(context, game.appId, AddedGameArt.Slot.COVER)
|
val cover = chosenFile(context, game.appId, AddedGameArt.Slot.COVER)
|
||||||
val hero = chosenFile(context, game.appId, AddedGameArt.Slot.BACKGROUND)
|
val hero = chosenFile(context, game.appId, AddedGameArt.Slot.BACKGROUND)
|
||||||
val icon = chosenFile(context, game.appId, AddedGameArt.Slot.ICON)
|
val icon = chosenFile(context, game.appId, AddedGameArt.Slot.ICON)
|
||||||
val logo = chosenFile(context, game.appId, AddedGameArt.Slot.LOGO)
|
if (cover == null && hero == null && icon == null) return game
|
||||||
if (cover == null && hero == null && icon == null && logo == null) return game
|
|
||||||
return Library.SteamGame(
|
return Library.SteamGame(
|
||||||
game.appId, game.name, cover ?: game.art, game.library, game.gameId,
|
game.appId, game.name, cover ?: game.art, game.library, game.gameId,
|
||||||
hero ?: game.hero, game.lastPlayed, game.gameFiles, game.protonPrefix, icon ?: game.icon, game.source, game.storeId,
|
hero ?: game.hero, game.lastPlayed, game.gameFiles, game.protonPrefix, icon ?: game.icon, game.source, game.storeId,
|
||||||
logo ?: game.logo,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,23 +84,18 @@ object SteamGridDb {
|
|||||||
.filter { it.second > 0 && it.first > 0 }
|
.filter { it.second > 0 && it.first > 0 }
|
||||||
.maxByOrNull { it.second }?.first
|
.maxByOrNull { it.second }?.first
|
||||||
|
|
||||||
internal fun cacheName(slot: AddedGameArt.Slot): String =
|
fun download(key: String, id: Int, cache: File): Boolean {
|
||||||
when (slot) {
|
|
||||||
AddedGameArt.Slot.COVER -> "p.jpg"
|
|
||||||
AddedGameArt.Slot.WIDE -> "header.jpg"
|
|
||||||
AddedGameArt.Slot.BACKGROUND -> "hero.jpg"
|
|
||||||
AddedGameArt.Slot.LOGO -> "logo.png"
|
|
||||||
AddedGameArt.Slot.ICON -> "icon-sgdb.png"
|
|
||||||
}
|
|
||||||
|
|
||||||
fun download(key: String, id: Int, cache: File, slots: Set<AddedGameArt.Slot> = AddedGameArt.Slot.values().toSet()): Boolean {
|
|
||||||
var got = false
|
var got = false
|
||||||
for (slot in AddedGameArt.Slot.values()) {
|
for ((path, local) in listOf(
|
||||||
if (slot !in slots) continue
|
"grids/game/$id?dimensions=600x900&$QUERY" to "p.jpg",
|
||||||
val local = cacheName(slot)
|
"grids/game/$id?dimensions=460x215,920x430&$QUERY" to "header.jpg",
|
||||||
|
"heroes/game/$id?$QUERY" to "hero.jpg",
|
||||||
|
"logos/game/$id?$QUERY" to "logo.png",
|
||||||
|
"icons/game/$id?$QUERY" to "icon-sgdb.png",
|
||||||
|
)) {
|
||||||
val dst = File(cache, local)
|
val dst = File(cache, local)
|
||||||
if (dst.isFile) continue
|
if (dst.isFile) continue
|
||||||
val items = json(key, "$API/${path(id, slot)}")?.optJSONArray("data") ?: continue
|
val items = json(key, "$API/$path")?.optJSONArray("data") ?: continue
|
||||||
val url = best(items, local.endsWith(".png")) ?: continue
|
val url = best(items, local.endsWith(".png")) ?: continue
|
||||||
val bytes = AddedGameArt.get(url) ?: continue
|
val bytes = AddedGameArt.get(url) ?: continue
|
||||||
val tmp = File(cache, "$local.tmp")
|
val tmp = File(cache, "$local.tmp")
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ data class GlassesState(
|
|||||||
val volumeMax: Int = 8,
|
val volumeMax: Int = 8,
|
||||||
val sunblock: Boolean = false,
|
val sunblock: Boolean = false,
|
||||||
val hardwareControls: Boolean = true,
|
val hardwareControls: Boolean = true,
|
||||||
val supportsDisplayModeControl: Boolean = true,
|
|
||||||
val hasSunblock: Boolean = true,
|
val hasSunblock: Boolean = true,
|
||||||
val controlError: String? = null,
|
val controlError: String? = null,
|
||||||
val tracking: Boolean = false,
|
val tracking: Boolean = false,
|
||||||
@@ -51,7 +50,6 @@ data class GlassesState(
|
|||||||
val noSignal: Boolean = false,
|
val noSignal: Boolean = false,
|
||||||
val sbsSupport: Int = SBS_UNKNOWN,
|
val sbsSupport: Int = SBS_UNKNOWN,
|
||||||
val sbs90: Boolean = false,
|
val sbs90: Boolean = false,
|
||||||
val rates2d: List<Int> = listOf(60, 90, 120),
|
|
||||||
val experimental: Boolean = false,
|
val experimental: Boolean = false,
|
||||||
val supportsScreen3dof: Boolean = false,
|
val supportsScreen3dof: Boolean = false,
|
||||||
val supports30Hz: Boolean = false,
|
val supports30Hz: Boolean = false,
|
||||||
@@ -65,7 +63,7 @@ data class GlassesState(
|
|||||||
val spatialConnected: Boolean get() = canControl && supportsSpatial
|
val spatialConnected: Boolean get() = canControl && supportsSpatial
|
||||||
fun usesSpatialControllers(settings: GlassesSettings) = spatialConnected && settings.positionalTracking &&
|
fun usesSpatialControllers(settings: GlassesSettings) = spatialConnected && settings.positionalTracking &&
|
||||||
(settings.handControllers || settings.joyConTracking)
|
(settings.handControllers || settings.joyConTracking)
|
||||||
val can3d: Boolean get() = canControl && supportsDisplayModeControl && !noSignal && sbsSupport != SBS_FAILS
|
val can3d: Boolean get() = canControl && !noSignal && sbsSupport != SBS_FAILS
|
||||||
val verticalFovDeg: Float get() {
|
val verticalFovDeg: Float get() {
|
||||||
val half = Math.toRadians(diagonalFovDeg / 2.0)
|
val half = Math.toRadians(diagonalFovDeg / 2.0)
|
||||||
val aspect = if (width > 0 && height > 0)
|
val aspect = if (width > 0 && height > 0)
|
||||||
@@ -214,7 +212,7 @@ object Glasses {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun sendMode(mode: Int) = post {
|
fun sendMode(mode: Int) = post {
|
||||||
if (!_state.value.canControl || !_state.value.supportsDisplayModeControl) return@post
|
if (!_state.value.canControl) return@post
|
||||||
if (link?.send(VitureProtocol.MSG_DISPLAY, byteArrayOf(mode.toByte())) == true) lastModeSentAt = SystemClock.uptimeMillis()
|
if (link?.send(VitureProtocol.MSG_DISPLAY, byteArrayOf(mode.toByte())) == true) lastModeSentAt = SystemClock.uptimeMillis()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -471,7 +469,6 @@ object Glasses {
|
|||||||
.put("controlError", s.controlError ?: JSONObject.NULL)
|
.put("controlError", s.controlError ?: JSONObject.NULL)
|
||||||
.put("experimental", s.experimental)
|
.put("experimental", s.experimental)
|
||||||
.put("supportsScreen3dof", s.supportsScreen3dof)
|
.put("supportsScreen3dof", s.supportsScreen3dof)
|
||||||
.put("supportsDisplayModeControl", s.supportsDisplayModeControl)
|
|
||||||
.put("supportsSpatial", s.supportsSpatial)
|
.put("supportsSpatial", s.supportsSpatial)
|
||||||
.put("firmware", (link as? VitureSdkLink)?.firmware ?: JSONObject.NULL)
|
.put("firmware", (link as? VitureSdkLink)?.firmware ?: JSONObject.NULL)
|
||||||
.put("spatialSdk", (link as? VitureSdkLink)?.spatialDiagnostics()?.let {
|
.put("spatialSdk", (link as? VitureSdkLink)?.spatialDiagnostics()?.let {
|
||||||
@@ -616,16 +613,13 @@ object Glasses {
|
|||||||
switching3d = modeState.pendingStereo,
|
switching3d = modeState.pendingStereo,
|
||||||
brightnessMax = m?.brightnessMax ?: 8, volumeMax = m?.volumeMax ?: 8,
|
brightnessMax = m?.brightnessMax ?: 8, volumeMax = m?.volumeMax ?: 8,
|
||||||
sunblock = if (m === XrealModel) it.sunblock else _settings.value.sunblock ?: it.sunblock,
|
sunblock = if (m === XrealModel) it.sunblock else _settings.value.sunblock ?: it.sunblock,
|
||||||
hardwareControls = m?.hardwareControls == true &&
|
hardwareControls = device?.vendorId == VitureProtocol.VENDOR_ID || m === XrealModel,
|
||||||
(device?.vendorId == VitureProtocol.VENDOR_ID || m === XrealModel || m is RokidModel),
|
|
||||||
supportsDisplayModeControl = m?.supportsDisplayModeControl == true,
|
|
||||||
hasSunblock = m?.hasSunblock == true,
|
hasSunblock = m?.hasSunblock == true,
|
||||||
diagonalFovDeg = m?.diagonalFovDeg ?: 46f,
|
diagonalFovDeg = m?.diagonalFovDeg ?: 46f,
|
||||||
tracking = it.tracking && link != null,
|
tracking = it.tracking && link != null,
|
||||||
noSignal = noSignal,
|
noSignal = noSignal,
|
||||||
sbs90 = m?.sbs90 == true,
|
sbs90 = m?.sbs90 == true,
|
||||||
rates2d = m?.rates2d ?: listOf(60, 90, 120),
|
experimental = m === XrealModel,
|
||||||
experimental = m === XrealModel || (m is VitureProtocol.Model && m.family == VitureProtocol.Family.PRO2 && !m.needsSdk),
|
|
||||||
supportsScreen3dof = link?.hasImu == true,
|
supportsScreen3dof = link?.hasImu == true,
|
||||||
supports30Hz = display?.let(::supports30Hz) == true,
|
supports30Hz = display?.let(::supports30Hz) == true,
|
||||||
supportsSpatial = (link as? VitureSdkLink)?.isCarina == true,
|
supportsSpatial = (link as? VitureSdkLink)?.isCarina == true,
|
||||||
@@ -640,8 +634,7 @@ object Glasses {
|
|||||||
scheduleModeCheck()
|
scheduleModeCheck()
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun isGlassesVendor(vid: Int) = vid == VitureProtocol.VENDOR_ID || RayNeoModel.isVendor(vid) ||
|
internal fun isGlassesVendor(vid: Int) = vid == VitureProtocol.VENDOR_ID || RayNeoModel.isVendor(vid) || vid == XrealModel.VENDOR_ID
|
||||||
vid == XrealModel.VENDOR_ID || vid == RokidModel.VENDOR_ID
|
|
||||||
|
|
||||||
internal fun supports30Hz(display: Display): Boolean {
|
internal fun supports30Hz(display: Display): Boolean {
|
||||||
val current = display.mode
|
val current = display.mode
|
||||||
@@ -657,18 +650,15 @@ object Glasses {
|
|||||||
internal fun deviceModel(device: UsbDevice): GlassesModel? {
|
internal fun deviceModel(device: UsbDevice): GlassesModel? {
|
||||||
val name = runCatching { device.productName }.getOrNull()
|
val name = runCatching { device.productName }.getOrNull()
|
||||||
return if (device.vendorId == VitureProtocol.VENDOR_ID) {
|
return if (device.vendorId == VitureProtocol.VENDOR_ID) {
|
||||||
if (device.productId == VitureProtocol.PRO2_PRODUCT_ID) VitureProtocol.model(device.productId, name)
|
VitureSdk.marketName(device.productId)?.let(VitureProtocol::sdkModel)
|
||||||
else VitureSdk.marketName(device.productId)?.let(VitureProtocol::sdkModel)
|
|
||||||
?: VitureProtocol.model(device.productId, name)
|
?: VitureProtocol.model(device.productId, name)
|
||||||
}
|
}
|
||||||
else if (XrealModel.matches(device.vendorId, device.productId)) XrealModel
|
else if (XrealModel.matches(device.vendorId, device.productId)) XrealModel
|
||||||
else RokidModel.model(device.vendorId, device.productId, name)
|
else RayNeoModel.model(device.vendorId, device.productId, name)
|
||||||
?: RayNeoModel.model(device.vendorId, device.productId, name)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun isGlassesDisplayName(name: String) =
|
internal fun isGlassesDisplayName(name: String) =
|
||||||
name.contains("VITURE", ignoreCase = true) || RayNeoModel.isDisplay(name) || XrealModel.isDisplay(name) ||
|
name.contains("VITURE", ignoreCase = true) || RayNeoModel.isDisplay(name) || XrealModel.isDisplay(name)
|
||||||
RokidModel.isDisplay(name)
|
|
||||||
|
|
||||||
private fun findDisplay(usbPresent: Boolean): Display? {
|
private fun findDisplay(usbPresent: Boolean): Display? {
|
||||||
return selectGlassesDisplay(displays.getDisplays(DisplayManager.DISPLAY_CATEGORY_PRESENTATION).toList(), usbPresent)
|
return selectGlassesDisplay(displays.getDisplays(DisplayManager.DISPLAY_CATEGORY_PRESENTATION).toList(), usbPresent)
|
||||||
@@ -725,9 +715,7 @@ object Glasses {
|
|||||||
calibrationKey = calibrationStore.key(device.vendorId, device.productId,
|
calibrationKey = calibrationStore.key(device.vendorId, device.productId,
|
||||||
runCatching { device.serialNumber }.getOrNull(), model?.name.orEmpty())
|
runCatching { device.serialNumber }.getOrNull(), model?.name.orEmpty())
|
||||||
val l = if (device.vendorId == VitureProtocol.VENDOR_ID) {
|
val l = if (device.vendorId == VitureProtocol.VENDOR_ID) {
|
||||||
if (device.productId == VitureProtocol.PRO2_PRODUCT_ID) {
|
if ((model as? VitureProtocol.Model)?.needsSdk == true) {
|
||||||
VitureV2Link.open(usb, device, v2Listener(generation))
|
|
||||||
} else if ((model as? VitureProtocol.Model)?.needsSdk == true) {
|
|
||||||
// Android can evict cacheDir while the SDK is running.
|
// Android can evict cacheDir while the SDK is running.
|
||||||
Log.i(TAG, "opening VITURE SDK pid=0x%04X spatial=%s".format(device.productId, spatial))
|
Log.i(TAG, "opening VITURE SDK pid=0x%04X spatial=%s".format(device.productId, spatial))
|
||||||
VitureSdkLink.open(usb, device, File(app.noBackupFilesDir, "viture"), sdkListener(generation),
|
VitureSdkLink.open(usb, device, File(app.noBackupFilesDir, "viture"), sdkListener(generation),
|
||||||
@@ -735,8 +723,6 @@ object Glasses {
|
|||||||
} else VitureLink.open(usb, device, linkListener(generation))
|
} else VitureLink.open(usb, device, linkListener(generation))
|
||||||
} else if (model === XrealModel) {
|
} else if (model === XrealModel) {
|
||||||
XrealLink.open(app, xrealListener(generation))
|
XrealLink.open(app, xrealListener(generation))
|
||||||
} else if (model is RokidModel) {
|
|
||||||
RokidLink.open(usb, device, rokidListener(generation))
|
|
||||||
} else {
|
} else {
|
||||||
val baseKey = calibrationKey!!
|
val baseKey = calibrationKey!!
|
||||||
val gtUsb = RayNeoProtocol.isGt(device.vendorId, device.productId)
|
val gtUsb = RayNeoProtocol.isGt(device.vendorId, device.productId)
|
||||||
@@ -804,33 +790,6 @@ object Glasses {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun rokidListener(generation: Long) = object : RokidLink.Listener {
|
|
||||||
override fun onReady() = post {
|
|
||||||
if (generation != linkGeneration) return@post
|
|
||||||
publish { it.copy(connected = true, controlError = null) }
|
|
||||||
updateImu()
|
|
||||||
applyMode(force = false)
|
|
||||||
}
|
|
||||||
override fun onValue(message: Int, value: Int) = post {
|
|
||||||
if (generation != linkGeneration) return@post
|
|
||||||
when (message) {
|
|
||||||
VitureProtocol.MSG_GET_DISPLAY -> glassesMode = value
|
|
||||||
VitureProtocol.MSG_BRIGHTNESS -> publish { it.copy(brightness = value) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
override fun onPose(raw: ByteArray, pose: FloatArray, timeNs: Long) {
|
|
||||||
if (generation != linkGeneration) return
|
|
||||||
imuPackets++
|
|
||||||
probe?.invoke(raw, pose)
|
|
||||||
if (simulating.get() == null) deliver(pose, timeNs)
|
|
||||||
}
|
|
||||||
override fun onLost() = post {
|
|
||||||
if (generation != linkGeneration) return@post
|
|
||||||
closeLink()
|
|
||||||
refresh()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun sdkListener(generation: Long) = object : VitureSdkLink.Listener {
|
private fun sdkListener(generation: Long) = object : VitureSdkLink.Listener {
|
||||||
override fun onSpatial(pose: FloatArray, timeNs: Long, valid: Boolean) {
|
override fun onSpatial(pose: FloatArray, timeNs: Long, valid: Boolean) {
|
||||||
if (generation == linkGeneration) SpatialTracking.accept(pose, timeNs, generation, valid)
|
if (generation == linkGeneration) SpatialTracking.accept(pose, timeNs, generation, valid)
|
||||||
@@ -858,40 +817,6 @@ object Glasses {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun v2Listener(generation: Long) = object : VitureV2Link.Listener {
|
|
||||||
override fun onReady() = post {
|
|
||||||
if (generation != linkGeneration) return@post
|
|
||||||
val current = link as? VitureV2Link ?: return@post
|
|
||||||
publish { it.copy(connected = current.ready, supportsScreen3dof = current.hasImu,
|
|
||||||
tracking = current.trackingActive, controlError = null) }
|
|
||||||
updateImu()
|
|
||||||
}
|
|
||||||
override fun onValue(msgId: Int, value: Int) = post {
|
|
||||||
if (generation != linkGeneration) return@post
|
|
||||||
when (msgId) {
|
|
||||||
VitureProtocol.MSG_GET_DISPLAY -> glassesMode = value
|
|
||||||
VitureProtocol.MSG_GET_BRIGHTNESS -> publish { it.copy(brightness = value) }
|
|
||||||
VitureProtocol.MSG_GET_VOLUME -> publish { it.copy(volume = value) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
override fun onPose(raw: ByteArray, q: FloatArray, timeNs: Long) {
|
|
||||||
if (generation != linkGeneration) return
|
|
||||||
imuPackets++
|
|
||||||
probe?.invoke(raw, q)
|
|
||||||
if (simulating.get() == null) deliver(q, timeNs)
|
|
||||||
}
|
|
||||||
override fun onTracking(active: Boolean) = post {
|
|
||||||
if (generation != linkGeneration) return@post
|
|
||||||
val current = link as? VitureV2Link ?: return@post
|
|
||||||
publish { it.copy(tracking = active && current.trackingActive) }
|
|
||||||
}
|
|
||||||
override fun onLost() = post {
|
|
||||||
if (generation != linkGeneration) return@post
|
|
||||||
closeLink()
|
|
||||||
publish { it.copy(controlError = app.getString(R.string.glasses_connection_failed)) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun rayNeoListener(generation: Long) = object : RayNeoLink.Listener {
|
private fun rayNeoListener(generation: Long) = object : RayNeoLink.Listener {
|
||||||
override fun onDeviceInfo(boardId: Int, calibrationSaved: Boolean) = post {
|
override fun onDeviceInfo(boardId: Int, calibrationSaved: Boolean) = post {
|
||||||
if (generation != linkGeneration) return@post
|
if (generation != linkGeneration) return@post
|
||||||
@@ -967,7 +892,7 @@ object Glasses {
|
|||||||
private fun applyMode(force: Boolean) {
|
private fun applyMode(force: Boolean) {
|
||||||
val s = _state.value
|
val s = _state.value
|
||||||
val m = model ?: return
|
val m = model ?: return
|
||||||
if (!s.canControl || !s.supportsDisplayModeControl) return
|
if (!s.canControl) return
|
||||||
if (modeState.restorePending) {
|
if (modeState.restorePending) {
|
||||||
sendMode(false)
|
sendMode(false)
|
||||||
return
|
return
|
||||||
@@ -989,7 +914,6 @@ object Glasses {
|
|||||||
|
|
||||||
private fun sendMode(sbs: Boolean): Boolean {
|
private fun sendMode(sbs: Boolean): Boolean {
|
||||||
val m = model ?: return false
|
val m = model ?: return false
|
||||||
if (!m.supportsDisplayModeControl) return false
|
|
||||||
if (sbs && !_settings.value.gameOnGlasses) update { it.copy(gameOnGlasses = true) }
|
if (sbs && !_settings.value.gameOnGlasses) update { it.copy(gameOnGlasses = true) }
|
||||||
val g = _settings.value
|
val g = _settings.value
|
||||||
val resolution = GlassesDisplayModes.selected(g, _state.value, sbs)
|
val resolution = GlassesDisplayModes.selected(g, _state.value, sbs)
|
||||||
@@ -1022,11 +946,11 @@ object Glasses {
|
|||||||
val l = link ?: return
|
val l = link ?: return
|
||||||
if (!l.ready) return
|
if (!l.ready) return
|
||||||
val want = (sink != null || poseObservers.isNotEmpty() || probe != null || _calibration.value.running || SpatialTracking.enabled) && l.hasImu
|
val want = (sink != null || poseObservers.isNotEmpty() || probe != null || _calibration.value.running || SpatialTracking.enabled) && l.hasImu
|
||||||
if (l !is VitureV2Link && want == _state.value.tracking) return
|
if (want == _state.value.tracking) return
|
||||||
val accepted = l.send(VitureProtocol.MSG_IMU, byteArrayOf(if (want) 1 else 0))
|
val accepted = l.send(VitureProtocol.MSG_IMU, byteArrayOf(if (want) 1 else 0))
|
||||||
if (want && !accepted) return
|
if (want && !accepted) return
|
||||||
if (want) l.send(VitureProtocol.MSG_IMU_RATE, byteArrayOf(VitureProtocol.IMU_RATE_240.toByte()))
|
if (want) l.send(VitureProtocol.MSG_IMU_RATE, byteArrayOf(VitureProtocol.IMU_RATE_240.toByte()))
|
||||||
publish { it.copy(tracking = if (l is VitureV2Link) l.trackingActive else want) }
|
publish { it.copy(tracking = want) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun linkListener(generation: Long) = object : VitureLink.Listener {
|
private fun linkListener(generation: Long) = object : VitureLink.Listener {
|
||||||
|
|||||||
@@ -4,13 +4,10 @@ package com.droiddeck.launcher.glasses
|
|||||||
interface GlassesModel {
|
interface GlassesModel {
|
||||||
val name: String
|
val name: String
|
||||||
val controllable: Boolean
|
val controllable: Boolean
|
||||||
val hardwareControls: Boolean get() = true
|
|
||||||
val supportsDisplayModeControl: Boolean get() = true
|
|
||||||
val brightnessMax: Int
|
val brightnessMax: Int
|
||||||
val volumeMax: Int
|
val volumeMax: Int
|
||||||
val diagonalFovDeg: Float
|
val diagonalFovDeg: Float
|
||||||
val sbs90: Boolean
|
val sbs90: Boolean
|
||||||
val rates2d: List<Int> get() = listOf(60, 90, 120)
|
|
||||||
val hasSunblock: Boolean get() = true
|
val hasSunblock: Boolean get() = true
|
||||||
val resolutions: List<GlassesResolution> get() = emptyList()
|
val resolutions: List<GlassesResolution> get() = emptyList()
|
||||||
fun mode(hz: Int, sbs: Boolean, resolution: GlassesResolution?): Int = mode(hz, sbs)
|
fun mode(hz: Int, sbs: Boolean, resolution: GlassesResolution?): Int = mode(hz, sbs)
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ internal object GlassesRendering {
|
|||||||
fun refreshRates(settings: GlassesSettings, state: GlassesState): List<Int> = buildList {
|
fun refreshRates(settings: GlassesSettings, state: GlassesState): List<Int> = buildList {
|
||||||
if (native30HzAvailable(settings, state)) add(30)
|
if (native30HzAvailable(settings, state)) add(30)
|
||||||
add(60)
|
add(60)
|
||||||
if (state.sbs) { if (state.sbs90) add(90) }
|
if (!state.sbs || state.sbs90) add(90)
|
||||||
else addAll(state.rates2d.filter { it > 60 })
|
if (!state.sbs) add(120)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun outputHz(settings: GlassesSettings, state: GlassesState): Int {
|
fun outputHz(settings: GlassesSettings, state: GlassesState): Int {
|
||||||
@@ -21,7 +21,6 @@ internal object GlassesRendering {
|
|||||||
return when {
|
return when {
|
||||||
requested == 30 -> if (native30HzAvailable(settings, state)) 30 else 60
|
requested == 30 -> if (native30HzAvailable(settings, state)) 30 else 60
|
||||||
state.sbs && !state.sbs90 -> 60
|
state.sbs && !state.sbs90 -> 60
|
||||||
!state.sbs && requested !in state.rates2d -> state.rates2d.filter { it <= requested }.maxOrNull() ?: 60
|
|
||||||
else -> requested
|
else -> requested
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
package com.droiddeck.launcher.glasses
|
package com.droiddeck.launcher.glasses
|
||||||
|
|
||||||
import com.droiddeck.launcher.handtracking.TrackingPack
|
internal enum class HandModel(val asset: String, val sha256: String) {
|
||||||
|
FULL("models/hand_landmarker.task", "fbc2a30080c3c557093b5ddfc334698132eb341044ccee322ccf8bcf3607cde1"),
|
||||||
internal enum class HandModel(val file: String, val sha256: String) {
|
LITE("models/hand_landmarker_lite.task", "173c0f47ecee7e935bd4a1e93aa580756b4180c1307c07d709313e82c28672c8");
|
||||||
FULL(TrackingPack.HAND, "fbc2a30080c3c557093b5ddfc334698132eb341044ccee322ccf8bcf3607cde1"),
|
|
||||||
LITE(TrackingPack.HAND_LITE, "173c0f47ecee7e935bd4a1e93aa580756b4180c1307c07d709313e82c28672c8");
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val DEFAULT = FULL
|
val DEFAULT = FULL
|
||||||
|
|||||||
@@ -1,148 +0,0 @@
|
|||||||
package com.droiddeck.launcher.glasses
|
|
||||||
|
|
||||||
import android.hardware.usb.UsbConstants
|
|
||||||
import android.hardware.usb.UsbDevice
|
|
||||||
import android.hardware.usb.UsbDeviceConnection
|
|
||||||
import android.hardware.usb.UsbEndpoint
|
|
||||||
import android.hardware.usb.UsbInterface
|
|
||||||
import android.hardware.usb.UsbManager
|
|
||||||
import android.os.SystemClock
|
|
||||||
import android.util.Log
|
|
||||||
|
|
||||||
/** Controls are vendor control transfers; the HID interrupt endpoint streams IMU reports unprompted. */
|
|
||||||
internal class RokidLink private constructor(
|
|
||||||
private val connection: UsbDeviceConnection,
|
|
||||||
private val usbInterface: UsbInterface,
|
|
||||||
private val endpoint: UsbEndpoint,
|
|
||||||
private val listener: Listener,
|
|
||||||
) : GlassesLink {
|
|
||||||
interface Listener {
|
|
||||||
fun onReady()
|
|
||||||
fun onValue(message: Int, value: Int)
|
|
||||||
fun onPose(raw: ByteArray, pose: FloatArray, timeNs: Long)
|
|
||||||
fun onLost()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Volatile private var running = true
|
|
||||||
@Volatile override var ready = false
|
|
||||||
private set
|
|
||||||
@Volatile private var tracking = false
|
|
||||||
private val controlLock = Any()
|
|
||||||
private lateinit var worker: Thread
|
|
||||||
override val hasImu = true
|
|
||||||
|
|
||||||
override fun send(msgId: Int, payload: ByteArray): Boolean {
|
|
||||||
if (!running) return false
|
|
||||||
val value = payload.firstOrNull()?.toInt()?.and(0xff) ?: -1
|
|
||||||
return when (msgId) {
|
|
||||||
VitureProtocol.MSG_IMU -> (value in 0..1).also { if (it) tracking = value == 1 }
|
|
||||||
VitureProtocol.MSG_GET_DISPLAY -> display()?.let { listener.onValue(msgId, it) } != null
|
|
||||||
VitureProtocol.MSG_DISPLAY -> value in RokidModel.MODES &&
|
|
||||||
control(RokidModel.REQUEST_SET_DISPLAY, value, RokidModel.INDEX_DISPLAY) &&
|
|
||||||
true.also { listener.onValue(VitureProtocol.MSG_GET_DISPLAY, value) }
|
|
||||||
VitureProtocol.MSG_GET_BRIGHTNESS -> read(RokidModel.REQUEST_GET_BRIGHTNESS, RokidModel.INDEX_BRIGHTNESS)
|
|
||||||
?.let { listener.onValue(VitureProtocol.MSG_BRIGHTNESS, RokidModel.brightnessStep(it)) } != null
|
|
||||||
VitureProtocol.MSG_BRIGHTNESS -> value in 0..RokidModel.BRIGHTNESS_STEPS &&
|
|
||||||
control(RokidModel.REQUEST_SET_BRIGHTNESS, RokidModel.brightnessRaw(value), RokidModel.INDEX_BRIGHTNESS)
|
|
||||||
else -> false // Volume is the glasses' USB audio device; there is no film or IMU-rate control.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun display(): Int? = read(RokidModel.REQUEST_GET_DISPLAY, RokidModel.INDEX_DISPLAY)
|
|
||||||
|
|
||||||
private fun read(request: Int, index: Int): Int? = synchronized(controlLock) {
|
|
||||||
if (!running) return null
|
|
||||||
val buffer = ByteArray(64)
|
|
||||||
val count = connection.controlTransfer(VENDOR_IN, request, 0, index, buffer, buffer.size, TIMEOUT_MS)
|
|
||||||
// Display mode is reported in the second byte, brightness in the first.
|
|
||||||
val offset = if (request == RokidModel.REQUEST_GET_DISPLAY) 1 else 0
|
|
||||||
if (count > offset) buffer[offset].toInt() and 0xff else null
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun control(request: Int, value: Int, index: Int): Boolean = synchronized(controlLock) {
|
|
||||||
running && connection.controlTransfer(VENDOR_OUT, request, value, index, byteArrayOf(1), 1, TIMEOUT_MS) >= 0
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun run() {
|
|
||||||
val buffer = ByteArray(maxOf(endpoint.maxPacketSize, 64))
|
|
||||||
val parser = RokidProtocol.Parser()
|
|
||||||
var fusion = ImuFusion()
|
|
||||||
var wasTracking = false
|
|
||||||
var brightness = -1
|
|
||||||
var lastSensor = SystemClock.elapsedRealtime()
|
|
||||||
try {
|
|
||||||
ready = true
|
|
||||||
listener.onReady()
|
|
||||||
while (running) {
|
|
||||||
val count = connection.bulkTransfer(endpoint, buffer, buffer.size, 250)
|
|
||||||
val now = SystemClock.elapsedRealtime()
|
|
||||||
val sample = if (count > 0) parser.parse(buffer, count) else null
|
|
||||||
if (sample == null) {
|
|
||||||
if (now - lastSensor > 3000) error("Rokid IMU stream stalled")
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
lastSensor = now
|
|
||||||
sample.brightness?.takeIf { it != brightness }?.let {
|
|
||||||
brightness = it
|
|
||||||
listener.onValue(VitureProtocol.MSG_BRIGHTNESS, RokidModel.brightnessStep(it))
|
|
||||||
}
|
|
||||||
val enabled = tracking
|
|
||||||
if (enabled && !wasTracking) fusion = ImuFusion()
|
|
||||||
wasTracking = enabled
|
|
||||||
if (!enabled) continue
|
|
||||||
// Max captures: already right/up/back; level gravity +Y, turn left +gyroY, look up +gyroX, roll right -gyroZ.
|
|
||||||
fusion.update(sample.timeNs, sample.accel, sample.gyro)?.let {
|
|
||||||
if (running && tracking) listener.onPose(buffer.copyOf(count), it, SystemClock.elapsedRealtimeNanos())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
if (running) Log.w(TAG, "Rokid stream failed", e)
|
|
||||||
} finally {
|
|
||||||
ready = false
|
|
||||||
if (running) listener.onLost()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun close() {
|
|
||||||
synchronized(controlLock) {
|
|
||||||
if (!running) return
|
|
||||||
running = false
|
|
||||||
}
|
|
||||||
if (Thread.currentThread() !== worker) worker.join(500)
|
|
||||||
runCatching { connection.releaseInterface(usbInterface) }
|
|
||||||
connection.close()
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private const val TAG = "RokidLink"
|
|
||||||
private const val TIMEOUT_MS = 250
|
|
||||||
private const val VENDOR_IN = UsbConstants.USB_DIR_IN or UsbConstants.USB_TYPE_VENDOR
|
|
||||||
private const val VENDOR_OUT = UsbConstants.USB_DIR_OUT or UsbConstants.USB_TYPE_VENDOR
|
|
||||||
|
|
||||||
internal fun sensorEndpoint(device: UsbDevice): Pair<UsbInterface, UsbEndpoint>? {
|
|
||||||
for (i in 0 until device.interfaceCount) {
|
|
||||||
val iface = device.getInterface(i)
|
|
||||||
if (iface.interfaceClass != UsbConstants.USB_CLASS_HID) continue
|
|
||||||
for (e in 0 until iface.endpointCount) {
|
|
||||||
val endpoint = iface.getEndpoint(e)
|
|
||||||
if (endpoint.direction == UsbConstants.USB_DIR_IN &&
|
|
||||||
endpoint.type == UsbConstants.USB_ENDPOINT_XFER_INT) return iface to endpoint
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
fun open(usb: UsbManager, device: UsbDevice, listener: Listener): RokidLink? {
|
|
||||||
val (iface, endpoint) = sensorEndpoint(device) ?: return null
|
|
||||||
val conn = usb.openDevice(device) ?: return null
|
|
||||||
if (!conn.claimInterface(iface, true)) {
|
|
||||||
conn.close()
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
return RokidLink(conn, iface, endpoint, listener).also { link ->
|
|
||||||
link.worker = Thread({ link.run() }, "rokid-imu").apply { isDaemon = true }
|
|
||||||
link.worker.start()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,104 +0,0 @@
|
|||||||
package com.droiddeck.launcher.glasses
|
|
||||||
|
|
||||||
import java.nio.ByteBuffer
|
|
||||||
import java.nio.ByteOrder
|
|
||||||
|
|
||||||
/** Rokid Air/Max share one USB identity; the product string distinguishes them. */
|
|
||||||
internal class RokidModel private constructor(override val name: String, private val max: Boolean) : GlassesModel {
|
|
||||||
override val controllable = true
|
|
||||||
override val brightnessMax = BRIGHTNESS_STEPS
|
|
||||||
override val volumeMax = 0
|
|
||||||
override val hasSunblock = false
|
|
||||||
override val diagonalFovDeg = if (max) 50f else 43f
|
|
||||||
override val sbs90 = max
|
|
||||||
override val rates2d = if (max) listOf(60, 120) else listOf(60)
|
|
||||||
override val resolutions = if (max) listOf(GlassesResolution(1920, 1080), GlassesResolution(1920, 1200))
|
|
||||||
else listOf(GlassesResolution(1920, 1080))
|
|
||||||
|
|
||||||
override fun mode(hz: Int, sbs: Boolean): Int = mode(hz, sbs, null)
|
|
||||||
|
|
||||||
override fun mode(hz: Int, sbs: Boolean, resolution: GlassesResolution?): Int = when {
|
|
||||||
!max -> if (sbs) MODE_SBS_1080_60 else MODE_2D_60
|
|
||||||
sbs && resolution?.height == 1080 -> MODE_SBS_1080_60
|
|
||||||
sbs -> if (hz >= 90) MODE_SBS_1200_90 else MODE_SBS_1200_60
|
|
||||||
hz >= 120 -> MODE_2D_120
|
|
||||||
else -> MODE_2D_60
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun modeForStep(step: Int): Int? = null
|
|
||||||
|
|
||||||
override fun equals(other: Any?) = other is RokidModel && other.name == name && other.max == max
|
|
||||||
override fun hashCode() = name.hashCode()
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
const val VENDOR_ID = 0x04d2
|
|
||||||
const val PRODUCT_ID = 0x162f
|
|
||||||
const val BRIGHTNESS_STEPS = 10
|
|
||||||
|
|
||||||
// Vendor control requests, device recipient.
|
|
||||||
const val REQUEST_SET_DISPLAY = 0x01
|
|
||||||
const val REQUEST_GET_DISPLAY = 0x81
|
|
||||||
const val REQUEST_SET_BRIGHTNESS = 0x02
|
|
||||||
const val REQUEST_GET_BRIGHTNESS = 0x82
|
|
||||||
const val INDEX_DISPLAY = 0x01
|
|
||||||
const val INDEX_BRIGHTNESS = 0x02
|
|
||||||
|
|
||||||
const val MODE_2D_60 = 0
|
|
||||||
const val MODE_SBS_1080_60 = 1
|
|
||||||
const val MODE_2D_120 = 3
|
|
||||||
const val MODE_SBS_1200_90 = 4
|
|
||||||
const val MODE_SBS_1200_60 = 5
|
|
||||||
val MODES = setOf(MODE_2D_60, MODE_SBS_1080_60, MODE_2D_120, MODE_SBS_1200_90, MODE_SBS_1200_60)
|
|
||||||
|
|
||||||
// 0x04d2 is a shared vendor ID, so the Rokid product string is required too.
|
|
||||||
fun model(vid: Int, pid: Int, name: String?): GlassesModel? {
|
|
||||||
if (vid != VENDOR_ID || pid != PRODUCT_ID) return null
|
|
||||||
val product = name?.trim()?.takeIf { it.startsWith("Rokid", ignoreCase = true) } ?: return null
|
|
||||||
return RokidModel(product, product.contains("Max", ignoreCase = true))
|
|
||||||
}
|
|
||||||
|
|
||||||
fun isDisplay(name: String) = name.contains("Rokid", ignoreCase = true)
|
|
||||||
|
|
||||||
/** Device brightness is 0..100; the shared slider uses ten steps. */
|
|
||||||
fun brightnessStep(raw: Int): Int = ((raw.coerceIn(0, 100) + 5) / 10).coerceIn(0, BRIGHTNESS_STEPS)
|
|
||||||
fun brightnessRaw(step: Int): Int = step.coerceIn(0, BRIGHTNESS_STEPS) * 10
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal object RokidProtocol {
|
|
||||||
data class Sample(val timeNs: Long, val accel: Vec3, val gyro: Vec3, val brightness: Int?)
|
|
||||||
|
|
||||||
private const val COMBINED = 17
|
|
||||||
private const val SEPARATE = 4
|
|
||||||
private const val SENSOR_ACCEL = 1
|
|
||||||
private const val SENSOR_GYRO = 2
|
|
||||||
|
|
||||||
/** Max sends one combined report; Air sends accel and gyro reports that share a timestamp. */
|
|
||||||
class Parser {
|
|
||||||
private var accel: Vec3? = null
|
|
||||||
private var accelTime = -1L
|
|
||||||
private var gyro: Vec3? = null
|
|
||||||
private var gyroTime = -2L
|
|
||||||
|
|
||||||
fun parse(packet: ByteArray, length: Int = packet.size): Sample? {
|
|
||||||
if (length < 64) return null
|
|
||||||
val b = ByteBuffer.wrap(packet, 0, length).order(ByteOrder.LITTLE_ENDIAN)
|
|
||||||
return when (packet[0].toInt() and 0xff) {
|
|
||||||
COMBINED -> Sample(b.getLong(1), vec(b, 9), vec(b, 21), packet[59].toInt() and 0xff)
|
|
||||||
SEPARATE -> {
|
|
||||||
val time = b.getLong(9) * 1000 // Air reports microseconds; Max reports nanoseconds.
|
|
||||||
when (packet[1].toInt() and 0xff) {
|
|
||||||
SENSOR_ACCEL -> { accel = vec(b, 21); accelTime = time }
|
|
||||||
SENSOR_GYRO -> { gyro = vec(b, 21); gyroTime = time }
|
|
||||||
else -> return null
|
|
||||||
}
|
|
||||||
if (accelTime != gyroTime) return null
|
|
||||||
Sample(time, accel!!, gyro!!, null).also { accelTime = -1L; gyroTime = -2L }
|
|
||||||
}
|
|
||||||
else -> null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun vec(b: ByteBuffer, offset: Int) = Vec3(b.getFloat(offset), b.getFloat(offset + 4), b.getFloat(offset + 8))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
package com.droiddeck.launcher.glasses
|
package com.droiddeck.launcher.glasses
|
||||||
|
|
||||||
import com.droiddeck.launcher.core.AddonPack
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import com.droiddeck.launcher.R
|
import com.droiddeck.launcher.R
|
||||||
import com.droiddeck.launcher.handtracking.TrackingPack
|
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
import android.graphics.Canvas
|
import android.graphics.Canvas
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
@@ -13,6 +11,7 @@ import com.google.mediapipe.tasks.core.BaseOptions
|
|||||||
import com.google.mediapipe.tasks.core.Delegate
|
import com.google.mediapipe.tasks.core.Delegate
|
||||||
import com.google.mediapipe.tasks.vision.core.RunningMode
|
import com.google.mediapipe.tasks.vision.core.RunningMode
|
||||||
import com.google.mediapipe.tasks.vision.handlandmarker.HandLandmarker
|
import com.google.mediapipe.tasks.vision.handlandmarker.HandLandmarker
|
||||||
|
import org.opencv.android.OpenCVLoader
|
||||||
import org.opencv.android.Utils
|
import org.opencv.android.Utils
|
||||||
import org.opencv.core.*
|
import org.opencv.core.*
|
||||||
import org.opencv.imgproc.Imgproc
|
import org.opencv.imgproc.Imgproc
|
||||||
@@ -171,11 +170,11 @@ internal class StereoHandEngine(private val context: Context, private val token:
|
|||||||
} finally { calibrationProgress = calibrationProgress.copy(solving = false) }
|
} finally { calibrationProgress = calibrationProgress.copy(solving = false) }
|
||||||
} }
|
} }
|
||||||
private fun detector(selected: HandModel=model, useGpu: Boolean=gpu, maxHands: Int=2): HandLandmarker {
|
private fun detector(selected: HandModel=model, useGpu: Boolean=gpu, maxHands: Int=2): HandLandmarker {
|
||||||
val bytes=TrackingPack.file(context,selected.file).readBytes()
|
val bytes=context.assets.open(selected.asset).use { it.readBytes() }
|
||||||
val hash=MessageDigest.getInstance("SHA-256").digest(bytes).joinToString("") { "%02x".format(it) }
|
val hash=MessageDigest.getInstance("SHA-256").digest(bytes).joinToString("") { "%02x".format(it) }
|
||||||
check(hash==selected.sha256) { context.getString(R.string.spatial_model_checksum_error) }
|
check(hash==selected.sha256) { context.getString(R.string.spatial_model_checksum_error) }
|
||||||
return HandLandmarker.createFromOptions(context,HandLandmarker.HandLandmarkerOptions.builder()
|
return HandLandmarker.createFromOptions(context,HandLandmarker.HandLandmarkerOptions.builder()
|
||||||
.setBaseOptions(BaseOptions.builder().setModelAssetBuffer(ByteBuffer.allocateDirect(bytes.size).put(bytes).apply { rewind() })
|
.setBaseOptions(BaseOptions.builder().setModelAssetPath(selected.asset)
|
||||||
.setDelegate(if(useGpu) Delegate.GPU else Delegate.CPU).build())
|
.setDelegate(if(useGpu) Delegate.GPU else Delegate.CPU).build())
|
||||||
.setRunningMode(RunningMode.VIDEO).setNumHands(maxHands).setMinHandDetectionConfidence(0.6f)
|
.setRunningMode(RunningMode.VIDEO).setNumHands(maxHands).setMinHandDetectionConfidence(0.6f)
|
||||||
.setMinHandPresenceConfidence(0.6f).setMinTrackingConfidence(0.6f).build())
|
.setMinHandPresenceConfidence(0.6f).setMinTrackingConfidence(0.6f).build())
|
||||||
@@ -326,11 +325,7 @@ internal class StereoHandEngine(private val context: Context, private val token:
|
|||||||
SpatialTracking.session.setHands(generation,SpatialHand(),SpatialHand())
|
SpatialTracking.session.setHands(generation,SpatialHand(),SpatialHand())
|
||||||
}
|
}
|
||||||
private fun loop() {
|
private fun loop() {
|
||||||
val loaded=TrackingPack.awaitNative(context,{ running }) { state ->
|
try { check(OpenCVLoader.initLocal()) } catch(e: Throwable) { message=context.getString(R.string.spatial_opencv_error, e.message.orEmpty());return }
|
||||||
if(state is AddonPack.State.Downloading)
|
|
||||||
message=context.getString(R.string.tracking_pack_downloading,(state.progress*100).toInt())
|
|
||||||
}
|
|
||||||
if(!loaded) { if(running) message=context.getString(R.string.tracking_pack_failed);return }
|
|
||||||
var grayL=Mat();var grayR=Mat();val rgba=Mat()
|
var grayL=Mat();var grayR=Mat();val rgba=Mat()
|
||||||
var bmpL: Bitmap?=null;var bmpR: Bitmap?=null
|
var bmpL: Bitmap?=null;var bmpR: Bitmap?=null
|
||||||
var leftGray=ByteArray(0);var rightGray=ByteArray(0)
|
var leftGray=ByteArray(0);var rightGray=ByteArray(0)
|
||||||
@@ -341,7 +336,7 @@ internal class StereoHandEngine(private val context: Context, private val token:
|
|||||||
var lastSource=0L;var lastStamp=0L;var captureOn=false;var captureRate=1000;var lastInputSeq=0L
|
var lastSource=0L;var lastStamp=0L;var captureOn=false;var captureRate=1000;var lastInputSeq=0L
|
||||||
var rate=0f
|
var rate=0f
|
||||||
try {
|
try {
|
||||||
check(TrackingPack.loadNative(context)) { context.getString(R.string.spatial_opencv_load_error) }
|
check(OpenCVLoader.initLocal()) { context.getString(R.string.spatial_opencv_load_error) }
|
||||||
joyConFlow=StereoJoyConFlow()
|
joyConFlow=StereoJoyConFlow()
|
||||||
while(running) {
|
while(running) {
|
||||||
while(true) {
|
while(true) {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import kotlin.math.sqrt
|
|||||||
|
|
||||||
object VitureProtocol {
|
object VitureProtocol {
|
||||||
const val VENDOR_ID = 0x35CA
|
const val VENDOR_ID = 0x35CA
|
||||||
const val PRO2_PRODUCT_ID = 0x1301
|
|
||||||
const val PACKET_SIZE = 64
|
const val PACKET_SIZE = 64
|
||||||
private const val HEADER = 0x12
|
private const val HEADER = 0x12
|
||||||
|
|
||||||
@@ -34,19 +33,13 @@ object VitureProtocol {
|
|||||||
|
|
||||||
enum class Family { ONE, PRO, LUMA, ULTRA, BEAST, PRO2 }
|
enum class Family { ONE, PRO, LUMA, ULTRA, BEAST, PRO2 }
|
||||||
|
|
||||||
class Model(
|
class Model(override val name: String, val family: Family) : GlassesModel {
|
||||||
override val name: String,
|
|
||||||
val family: Family,
|
|
||||||
val needsSdk: Boolean = family == Family.ULTRA || family == Family.BEAST || family == Family.PRO2,
|
|
||||||
) : GlassesModel {
|
|
||||||
override val controllable: Boolean get() = true
|
override val controllable: Boolean get() = true
|
||||||
private val directPro2: Boolean get() = family == Family.PRO2 && !needsSdk
|
val needsSdk: Boolean get() = family == Family.ULTRA || family == Family.BEAST || family == Family.PRO2
|
||||||
override val hardwareControls: Boolean get() = !directPro2
|
|
||||||
override val supportsDisplayModeControl: Boolean get() = !directPro2
|
|
||||||
val tall: Boolean get() = family == Family.LUMA || family == Family.ULTRA || family == Family.BEAST
|
val tall: Boolean get() = family == Family.LUMA || family == Family.ULTRA || family == Family.BEAST
|
||||||
override val sbs90: Boolean get() = family == Family.ULTRA
|
override val sbs90: Boolean get() = family == Family.ULTRA
|
||||||
override val brightnessMax: Int get() = if (directPro2) 0 else 8
|
override val brightnessMax: Int get() = 8
|
||||||
override val volumeMax: Int get() = if (directPro2) 0 else if (family == Family.BEAST) 15 else 8
|
override val volumeMax: Int get() = if (family == Family.BEAST) 15 else 8
|
||||||
override val hasSunblock: Boolean get() = family != Family.PRO2
|
override val hasSunblock: Boolean get() = family != Family.PRO2
|
||||||
override val diagonalFovDeg: Float get() = when (family) {
|
override val diagonalFovDeg: Float get() = when (family) {
|
||||||
Family.ONE -> 43f
|
Family.ONE -> 43f
|
||||||
@@ -96,7 +89,6 @@ object VitureProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun model(productId: Int, productName: String?): Model? {
|
fun model(productId: Int, productName: String?): Model? {
|
||||||
if (productId == PRO2_PRODUCT_ID) return Model("VITURE Pro 2", Family.PRO2, needsSdk = false)
|
|
||||||
val family = when (productId) {
|
val family = when (productId) {
|
||||||
0x1011, 0x1013, 0x1015, 0x1017, 0x101b -> Family.ONE
|
0x1011, 0x1013, 0x1015, 0x1017, 0x101b -> Family.ONE
|
||||||
0x1019, 0x101d -> Family.PRO
|
0x1019, 0x101d -> Family.PRO
|
||||||
|
|||||||
@@ -1,288 +0,0 @@
|
|||||||
package com.droiddeck.launcher.glasses
|
|
||||||
|
|
||||||
import android.hardware.usb.UsbConstants
|
|
||||||
import android.hardware.usb.UsbDevice
|
|
||||||
import android.hardware.usb.UsbDeviceConnection
|
|
||||||
import android.hardware.usb.UsbEndpoint
|
|
||||||
import android.hardware.usb.UsbInterface
|
|
||||||
import android.hardware.usb.UsbManager
|
|
||||||
import android.hardware.usb.UsbRequest
|
|
||||||
import android.util.Log
|
|
||||||
import java.io.IOException
|
|
||||||
import java.nio.ByteBuffer
|
|
||||||
import java.util.concurrent.ArrayBlockingQueue
|
|
||||||
import java.util.concurrent.TimeoutException
|
|
||||||
import java.util.concurrent.atomic.AtomicLong
|
|
||||||
|
|
||||||
internal class VitureV2Link internal constructor(
|
|
||||||
private val transport: Transport,
|
|
||||||
private val listener: Listener,
|
|
||||||
) : GlassesLink {
|
|
||||||
interface Listener {
|
|
||||||
fun onReady()
|
|
||||||
fun onValue(msgId: Int, value: Int)
|
|
||||||
fun onPose(raw: ByteArray, q: FloatArray, timeNs: Long)
|
|
||||||
fun onTracking(active: Boolean)
|
|
||||||
fun onLost()
|
|
||||||
}
|
|
||||||
|
|
||||||
internal data class Received(val bytes: ByteArray, val timeNs: Long)
|
|
||||||
internal interface Transport {
|
|
||||||
fun write(packet: ByteArray): Boolean
|
|
||||||
fun read(timeoutMs: Long): Received?
|
|
||||||
fun close()
|
|
||||||
}
|
|
||||||
|
|
||||||
private data class Command(val packet: ByteArray, val stream: Boolean? = null)
|
|
||||||
private val commands = ArrayBlockingQueue<Command>(16)
|
|
||||||
private val stateLock = Any()
|
|
||||||
private val bad = AtomicLong()
|
|
||||||
@Volatile private var running = true
|
|
||||||
@Volatile private var wanted = true
|
|
||||||
@Volatile override var ready = false
|
|
||||||
private set
|
|
||||||
@Volatile var trackingActive = false
|
|
||||||
private set
|
|
||||||
override val hasImu: Boolean get() = ready
|
|
||||||
override val badFrames: Long get() = bad.get()
|
|
||||||
@Volatile private var streamOn = false
|
|
||||||
private var lastPoseAt = 0L
|
|
||||||
private var lastTick: Long? = null
|
|
||||||
private var poseNotBefore = 0L
|
|
||||||
private val worker = Thread(::run, "viture-v2").apply { isDaemon = true; start() }
|
|
||||||
|
|
||||||
override fun send(msgId: Int, payload: ByteArray): Boolean {
|
|
||||||
synchronized(stateLock) {
|
|
||||||
if (!running || !ready) return false
|
|
||||||
if (msgId == VitureProtocol.MSG_IMU) {
|
|
||||||
if (payload.size != 1 || payload[0].toInt() !in 0..1) return false
|
|
||||||
val enabled = payload[0].toInt() == 1
|
|
||||||
if (wanted == enabled) return true
|
|
||||||
val command = Command(VitureV2Protocol.imuControl(
|
|
||||||
if (enabled) VitureV2Protocol.STREAM_POSE else VitureV2Protocol.STREAM_OFF), enabled)
|
|
||||||
if (!commands.offer(command)) return false
|
|
||||||
wanted = enabled
|
|
||||||
if (!enabled) {
|
|
||||||
streamOn = false
|
|
||||||
tracking(false)
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
if (msgId == VitureProtocol.MSG_GET_IMU) return true
|
|
||||||
// Keep the measured 120 Hz mode; the generic controller requests 240 Hz.
|
|
||||||
if (msgId == VitureProtocol.MSG_IMU_RATE) return false
|
|
||||||
val query = when (msgId) {
|
|
||||||
VitureProtocol.MSG_GET_BRIGHTNESS -> VitureV2Protocol.MSG_GET_BRIGHTNESS
|
|
||||||
VitureProtocol.MSG_GET_VOLUME -> VitureV2Protocol.MSG_GET_VOLUME
|
|
||||||
VitureProtocol.MSG_GET_DISPLAY -> VitureV2Protocol.MSG_GET_DISPLAY
|
|
||||||
else -> return false
|
|
||||||
}
|
|
||||||
return payload.isEmpty() && commands.offer(Command(VitureV2Protocol.packet(query)))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun tracking(active: Boolean) {
|
|
||||||
if (trackingActive != active) {
|
|
||||||
trackingActive = active
|
|
||||||
listener.onTracking(active)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun run() {
|
|
||||||
try {
|
|
||||||
if (!transport.write(VitureV2Protocol.imuControl(VitureV2Protocol.STREAM_POSE)))
|
|
||||||
throw IOException("Could not start pose stream")
|
|
||||||
poseNotBefore = System.nanoTime()
|
|
||||||
streamOn = true
|
|
||||||
lastPoseAt = System.nanoTime()
|
|
||||||
while (running) {
|
|
||||||
commands.poll()?.let { command ->
|
|
||||||
if (!transport.write(command.packet)) throw IOException("USB command failed")
|
|
||||||
val completedAt = System.nanoTime()
|
|
||||||
synchronized(stateLock) {
|
|
||||||
command.stream?.let {
|
|
||||||
streamOn = it
|
|
||||||
lastTick = null
|
|
||||||
poseNotBefore = completedAt
|
|
||||||
lastPoseAt = System.nanoTime()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
transport.read(100)?.let(::receive)
|
|
||||||
if (streamOn && System.nanoTime() - lastPoseAt > POSE_TIMEOUT_NS)
|
|
||||||
throw IOException("No fresh valid pose samples")
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
if (running) {
|
|
||||||
ready = false
|
|
||||||
tracking(false)
|
|
||||||
Log.w(TAG, "V2 connection lost: ${e.message}")
|
|
||||||
listener.onLost()
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
running = false
|
|
||||||
ready = false
|
|
||||||
tracking(false)
|
|
||||||
runCatching { transport.write(VitureV2Protocol.imuControl(VitureV2Protocol.STREAM_OFF)) }
|
|
||||||
transport.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun receive(received: Received) = synchronized(stateLock) {
|
|
||||||
if (!running) return
|
|
||||||
val frame = VitureV2Protocol.parse(received.bytes) ?: run { bad.incrementAndGet(); return }
|
|
||||||
if (frame.msgId == VitureV2Protocol.EVENT_POSE) {
|
|
||||||
val pose = VitureV2Protocol.pose(frame) ?: run { bad.incrementAndGet(); return }
|
|
||||||
if (!streamOn || !wanted || received.timeNs < poseNotBefore) return
|
|
||||||
val previous = lastTick
|
|
||||||
if (previous != null) {
|
|
||||||
val delta = (pose.deviceTick - previous) and 0xffffffffL
|
|
||||||
if (delta == 0L || delta >= 0x80000000L) return
|
|
||||||
}
|
|
||||||
lastTick = pose.deviceTick
|
|
||||||
lastPoseAt = System.nanoTime()
|
|
||||||
val becameReady = !ready
|
|
||||||
ready = true
|
|
||||||
tracking(true)
|
|
||||||
if (becameReady) listener.onReady()
|
|
||||||
val q = pose.quaternion
|
|
||||||
// Upstream right/up/back pose converted to the shared VITURE legacy basis.
|
|
||||||
val shared = floatArrayOf(-q[2], -q[0], q[1], q[3])
|
|
||||||
// Upstream does not establish device tick units; use host monotonic receipt time.
|
|
||||||
if (running && wanted && streamOn) listener.onPose(received.bytes, shared, received.timeNs)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
VitureV2Protocol.reply(frame, VitureV2Protocol.MSG_IMU_CONTROL)?.let {
|
|
||||||
if (!it.success) throw IOException("Pose stream rejected with status ${it.status}")
|
|
||||||
}
|
|
||||||
val queries = arrayOf(
|
|
||||||
VitureV2Protocol.MSG_GET_BRIGHTNESS to VitureProtocol.MSG_GET_BRIGHTNESS,
|
|
||||||
VitureV2Protocol.MSG_GET_VOLUME to VitureProtocol.MSG_GET_VOLUME,
|
|
||||||
VitureV2Protocol.MSG_GET_DISPLAY to VitureProtocol.MSG_GET_DISPLAY,
|
|
||||||
)
|
|
||||||
for ((query, internalId) in queries) {
|
|
||||||
val reply = VitureV2Protocol.reply(frame, query) ?: continue
|
|
||||||
if (reply.success && reply.body.size == 1) listener.onValue(internalId, reply.body[0].toInt() and 255)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun close() {
|
|
||||||
synchronized(stateLock) {
|
|
||||||
running = false
|
|
||||||
ready = false
|
|
||||||
wanted = false
|
|
||||||
commands.clear()
|
|
||||||
}
|
|
||||||
if (Thread.currentThread() !== worker) worker.join(1500)
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private const val TAG = "VitureV2Link"
|
|
||||||
private const val POSE_TIMEOUT_NS = 3_000_000_000L
|
|
||||||
const val PRODUCT_ID = 0x1301
|
|
||||||
|
|
||||||
fun open(usb: UsbManager, device: UsbDevice, listener: Listener): VitureV2Link? {
|
|
||||||
if (device.vendorId != VitureProtocol.VENDOR_ID || device.productId != PRODUCT_ID) return null
|
|
||||||
val candidates = (0 until device.interfaceCount).map(device::getInterface).filter {
|
|
||||||
it.interfaceClass == UsbConstants.USB_CLASS_HID && it.alternateSetting == 0 && it.endpointCount == 2
|
|
||||||
}.mapNotNull { intf ->
|
|
||||||
val endpoints = (0 until intf.endpointCount).map(intf::getEndpoint)
|
|
||||||
val input = endpoints.singleOrNull { it.direction == UsbConstants.USB_DIR_IN &&
|
|
||||||
it.type == UsbConstants.USB_ENDPOINT_XFER_INT && it.maxPacketSize == 64 }
|
|
||||||
val output = endpoints.singleOrNull { it.direction == UsbConstants.USB_DIR_OUT &&
|
|
||||||
it.type == UsbConstants.USB_ENDPOINT_XFER_INT && it.maxPacketSize == 64 }
|
|
||||||
if (input != null && output != null) Triple(intf, input, output) else null
|
|
||||||
}
|
|
||||||
val (intf, input, output) = candidates.singleOrNull() ?: return null
|
|
||||||
val connection = usb.openDevice(device) ?: return null
|
|
||||||
if (!connection.claimInterface(intf, true)) { connection.close(); return null }
|
|
||||||
return try {
|
|
||||||
VitureV2Link(AndroidTransport(connection, intf, input, output), listener)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
connection.releaseInterface(intf)
|
|
||||||
connection.close()
|
|
||||||
Log.w(TAG, "Could not initialize USB requests", e)
|
|
||||||
null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class AndroidTransport(
|
|
||||||
private val connection: UsbDeviceConnection,
|
|
||||||
private val intf: UsbInterface,
|
|
||||||
input: UsbEndpoint,
|
|
||||||
output: UsbEndpoint,
|
|
||||||
) : Transport {
|
|
||||||
private val inputRequest = UsbRequest()
|
|
||||||
private val outputRequest = UsbRequest()
|
|
||||||
private val inputBuffer = ByteBuffer.allocateDirect(64)
|
|
||||||
private var outputBuffer: ByteBuffer? = null
|
|
||||||
private var outputPending = false
|
|
||||||
private val received = ArrayDeque<Received>()
|
|
||||||
|
|
||||||
init {
|
|
||||||
try {
|
|
||||||
if (!inputRequest.initialize(connection, input) || !outputRequest.initialize(connection, output))
|
|
||||||
throw IOException("USB request initialization failed")
|
|
||||||
queueInput()
|
|
||||||
} catch (e: Exception) {
|
|
||||||
inputRequest.close()
|
|
||||||
outputRequest.close()
|
|
||||||
throw e
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun queueInput() {
|
|
||||||
inputBuffer.clear()
|
|
||||||
if (!inputRequest.queue(inputBuffer)) throw IOException("USB input queue failed")
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun await(timeoutMs: Long) {
|
|
||||||
val completed = try { connection.requestWait(timeoutMs) } catch (_: TimeoutException) { return }
|
|
||||||
?: throw IOException("USB device disconnected")
|
|
||||||
if (completed === outputRequest) {
|
|
||||||
outputPending = false
|
|
||||||
} else if (completed === inputRequest) {
|
|
||||||
val count = inputBuffer.position()
|
|
||||||
if (count > 0) {
|
|
||||||
val bytes = ByteArray(count)
|
|
||||||
inputBuffer.flip()
|
|
||||||
inputBuffer.get(bytes)
|
|
||||||
if (received.size >= 512) throw IOException("USB input backlog overflow")
|
|
||||||
received.addLast(Received(bytes, System.nanoTime()))
|
|
||||||
}
|
|
||||||
queueInput()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun write(packet: ByteArray): Boolean {
|
|
||||||
if (outputPending) throw IOException("Previous USB output has not completed")
|
|
||||||
val buffer = ByteBuffer.allocateDirect(packet.size).apply { put(packet); flip() }
|
|
||||||
outputBuffer = buffer
|
|
||||||
outputPending = outputRequest.queue(buffer)
|
|
||||||
if (!outputPending) return false
|
|
||||||
val deadline = System.nanoTime() + 250_000_000L
|
|
||||||
while (outputPending && System.nanoTime() < deadline) await(25)
|
|
||||||
if (outputPending) {
|
|
||||||
outputRequest.cancel()
|
|
||||||
throw IOException("USB output timed out")
|
|
||||||
}
|
|
||||||
return buffer.position() == packet.size
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun read(timeoutMs: Long): Received? {
|
|
||||||
if (received.isEmpty()) await(timeoutMs)
|
|
||||||
return received.removeFirstOrNull()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun close() {
|
|
||||||
inputRequest.cancel()
|
|
||||||
if (outputPending) outputRequest.cancel()
|
|
||||||
connection.releaseInterface(intf)
|
|
||||||
connection.close()
|
|
||||||
inputRequest.close()
|
|
||||||
outputRequest.close()
|
|
||||||
outputBuffer = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,132 +0,0 @@
|
|||||||
// Adapted from elasticjava/viture-v2, MIT, Copyright (c) 2026 Holger Bartnick.
|
|
||||||
// Source: ece8c30485f7d357fefa362ae74f3eabac9b3899; see docs/third-party/viture-v2/.
|
|
||||||
package com.droiddeck.launcher.glasses
|
|
||||||
|
|
||||||
import kotlin.math.sqrt
|
|
||||||
|
|
||||||
object VitureV2Protocol {
|
|
||||||
const val PACKET_SIZE = 64
|
|
||||||
const val HEADER_SIZE = 8
|
|
||||||
const val RESPONSE_OFFSET = 0x2000
|
|
||||||
private const val PREAMBLE = 0x0010
|
|
||||||
private const val MAX_PAYLOAD_SIZE = PACKET_SIZE - HEADER_SIZE
|
|
||||||
|
|
||||||
const val MSG_IMU_CONTROL = 0x0301
|
|
||||||
const val MSG_GET_SERIAL = 0x3002
|
|
||||||
const val MSG_GET_VERSION = 0x3003
|
|
||||||
const val MSG_GET_BRIGHTNESS = 0x3122
|
|
||||||
const val MSG_GET_DUTY_CYCLE = 0x3125
|
|
||||||
const val MSG_GET_DISPLAY = 0x3141
|
|
||||||
const val MSG_GET_VOLUME = 0x3201
|
|
||||||
const val MSG_GET_WEAR = 0x3321
|
|
||||||
const val EVENT_POSE = 0x7308
|
|
||||||
const val EVENT_RAW = 0x7309
|
|
||||||
|
|
||||||
const val STREAM_OFF = 0
|
|
||||||
const val STREAM_POSE = 1
|
|
||||||
const val STREAM_RAW = 2
|
|
||||||
|
|
||||||
enum class Rate(val wireValue: Int, val hz: Int) {
|
|
||||||
HZ_60(0, 60), HZ_90(1, 90), HZ_120(2, 120),
|
|
||||||
HZ_240(3, 240), HZ_500(4, 500), HZ_1000(5, 1000),
|
|
||||||
}
|
|
||||||
|
|
||||||
class Frame internal constructor(val msgId: Int, val payload: ByteArray)
|
|
||||||
|
|
||||||
class Reply internal constructor(val status: Int, val body: ByteArray) {
|
|
||||||
val success: Boolean get() = status == 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// Device ticks have no established time unit; quaternion is xyzw with no axis remapping.
|
|
||||||
class Pose internal constructor(
|
|
||||||
val deviceTick: Long,
|
|
||||||
val quaternion: FloatArray,
|
|
||||||
val unknown: Long,
|
|
||||||
)
|
|
||||||
|
|
||||||
class RawSample internal constructor(
|
|
||||||
val deviceTick: Long,
|
|
||||||
val gyroRadPerSec: FloatArray,
|
|
||||||
val accelG: FloatArray,
|
|
||||||
val payload: ByteArray,
|
|
||||||
)
|
|
||||||
|
|
||||||
fun packet(msgId: Int, payload: ByteArray = ByteArray(0)): ByteArray {
|
|
||||||
require(msgId in 0..0xFFFF)
|
|
||||||
require(payload.size <= MAX_PAYLOAD_SIZE)
|
|
||||||
return ByteArray(HEADER_SIZE + payload.size).also { buffer ->
|
|
||||||
putU16(buffer, 0, PREAMBLE)
|
|
||||||
putU16(buffer, 2, msgId)
|
|
||||||
putU16(buffer, 4, payload.size)
|
|
||||||
putU16(buffer, 6, checksum(payload, 0, payload.size))
|
|
||||||
payload.copyInto(buffer, HEADER_SIZE)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun imuControl(streams: Int, rate: Rate = Rate.HZ_120): ByteArray {
|
|
||||||
// Upstream measured that stream mask 3 ACKs but produces no events on Pro 2.
|
|
||||||
require(streams == STREAM_OFF || streams == STREAM_POSE || streams == STREAM_RAW)
|
|
||||||
require(streams != STREAM_POSE || rate.hz <= 240)
|
|
||||||
val wireRate = if (streams == STREAM_OFF) 0 else rate.wireValue
|
|
||||||
return packet(MSG_IMU_CONTROL, byteArrayOf(streams.toByte(), wireRate.toByte()))
|
|
||||||
}
|
|
||||||
|
|
||||||
fun parse(buffer: ByteArray, size: Int = buffer.size): Frame? {
|
|
||||||
if (size < HEADER_SIZE || size > PACKET_SIZE || size > buffer.size) return null
|
|
||||||
if (u16(buffer, 0) != PREAMBLE) return null
|
|
||||||
val payloadSize = u16(buffer, 4)
|
|
||||||
if (payloadSize > MAX_PAYLOAD_SIZE || HEADER_SIZE + payloadSize > size) return null
|
|
||||||
if (checksum(buffer, HEADER_SIZE, payloadSize) != u16(buffer, 6)) return null
|
|
||||||
return Frame(u16(buffer, 2), buffer.copyOfRange(HEADER_SIZE, HEADER_SIZE + payloadSize))
|
|
||||||
}
|
|
||||||
|
|
||||||
fun reply(frame: Frame, requestMsgId: Int): Reply? {
|
|
||||||
if (requestMsgId !in 0..0xFFFF || frame.msgId != ((requestMsgId + RESPONSE_OFFSET) and 0xFFFF)) return null
|
|
||||||
if (frame.payload.isEmpty()) return null
|
|
||||||
return Reply(u8(frame.payload[0]), frame.payload.copyOfRange(1, frame.payload.size))
|
|
||||||
}
|
|
||||||
|
|
||||||
fun pose(frame: Frame): Pose? {
|
|
||||||
if (frame.msgId != EVENT_POSE || frame.payload.size != 24) return null
|
|
||||||
val payload = frame.payload
|
|
||||||
val w = float(payload, 8)
|
|
||||||
val x = float(payload, 12)
|
|
||||||
val y = float(payload, 16)
|
|
||||||
val z = float(payload, 20)
|
|
||||||
if (!w.isFinite() || !x.isFinite() || !y.isFinite() || !z.isFinite()) return null
|
|
||||||
val norm = sqrt(w.toDouble() * w + x.toDouble() * x + y.toDouble() * y + z.toDouble() * z)
|
|
||||||
if (norm !in 0.9..1.1) return null
|
|
||||||
val n = norm.toFloat()
|
|
||||||
return Pose(u32(payload, 4), floatArrayOf(x / n, y / n, z / n, w / n), u32(payload, 0))
|
|
||||||
}
|
|
||||||
|
|
||||||
fun raw(frame: Frame): RawSample? {
|
|
||||||
if (frame.msgId != EVENT_RAW || frame.payload.size != 56) return null
|
|
||||||
val payload = frame.payload
|
|
||||||
val gyro = floatArrayOf(float(payload, 10), float(payload, 14), float(payload, 18))
|
|
||||||
val accel = floatArrayOf(float(payload, 22), float(payload, 26), float(payload, 30))
|
|
||||||
if (gyro.any { !it.isFinite() } || accel.any { !it.isFinite() }) return null
|
|
||||||
return RawSample(u32(payload, 4), gyro, accel, payload.copyOf())
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun checksum(buffer: ByteArray, offset: Int, size: Int): Int {
|
|
||||||
var sum = 0
|
|
||||||
for (i in offset until offset + size) sum += u8(buffer[i])
|
|
||||||
return sum and 0xFFFF
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun u8(value: Byte) = value.toInt() and 0xFF
|
|
||||||
|
|
||||||
private fun u16(buffer: ByteArray, offset: Int) =
|
|
||||||
u8(buffer[offset]) or (u8(buffer[offset + 1]) shl 8)
|
|
||||||
|
|
||||||
private fun u32(buffer: ByteArray, offset: Int): Long =
|
|
||||||
u16(buffer, offset).toLong() or (u16(buffer, offset + 2).toLong() shl 16)
|
|
||||||
|
|
||||||
private fun float(buffer: ByteArray, offset: Int): Float = Float.fromBits(u32(buffer, offset).toInt())
|
|
||||||
|
|
||||||
private fun putU16(buffer: ByteArray, offset: Int, value: Int) {
|
|
||||||
buffer[offset] = value.toByte()
|
|
||||||
buffer[offset + 1] = (value ushr 8).toByte()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,27 +4,20 @@ import kotlin.math.abs
|
|||||||
|
|
||||||
/** 1S radians/sec and device nanoseconds, mapped using directed hardware captures. */
|
/** 1S radians/sec and device nanoseconds, mapped using directed hardware captures. */
|
||||||
internal class XrealOrientationFilter {
|
internal class XrealOrientationFilter {
|
||||||
private val fusion = ImuFusion()
|
|
||||||
|
|
||||||
// 1S reports right/down/forward. Rotate 180 degrees about X into the
|
|
||||||
// shared right/up/back basis before either gravity alignment or fusion.
|
|
||||||
// Captures: level gravity -Y; looking left -gyroY; up +gyroX; right tilt +gyroZ.
|
|
||||||
fun update(sample: XrealProtocol.Sample): FloatArray? = fusion.update(sample.timeNs,
|
|
||||||
Vec3(sample.accel.x, -sample.accel.y, -sample.accel.z),
|
|
||||||
Vec3(sample.gyro.x, -sample.gyro.y, -sample.gyro.z))
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Gyro integration with gravity correction in the shared right/up/back basis, rad/s and device ns. */
|
|
||||||
internal class ImuFusion {
|
|
||||||
private var previous = 0L
|
private var previous = 0L
|
||||||
private var rotation = Quaternion.IDENTITY
|
private var rotation = Quaternion.IDENTITY
|
||||||
private var initialized = false
|
private var initialized = false
|
||||||
private var bias = Vec3(0f, 0f, 0f)
|
private var bias = Vec3(0f, 0f, 0f)
|
||||||
|
|
||||||
fun update(timeNs: Long, accel: Vec3, gyro: Vec3): FloatArray? {
|
fun update(sample: XrealProtocol.Sample): FloatArray? {
|
||||||
if (timeNs <= previous) return null
|
if (sample.timeNs <= previous) return null
|
||||||
val dt = if (previous == 0L) 0f else (timeNs - previous) * 1e-9f
|
val dt = if (previous == 0L) 0f else (sample.timeNs - previous) * 1e-9f
|
||||||
previous = timeNs
|
previous = sample.timeNs
|
||||||
|
// 1S reports right/down/forward. Rotate 180 degrees about X into the
|
||||||
|
// shared right/up/back basis before either gravity alignment or fusion.
|
||||||
|
// Captures: level gravity -Y; looking left -gyroY; up +gyroX; right tilt +gyroZ.
|
||||||
|
val accel = Vec3(sample.accel.x, -sample.accel.y, -sample.accel.z)
|
||||||
|
val gyro = Vec3(sample.gyro.x, -sample.gyro.y, -sample.gyro.z)
|
||||||
val norm = accel.length()
|
val norm = accel.length()
|
||||||
val gravityValid = abs(norm - 9.81f) < 1.5f
|
val gravityValid = abs(norm - 9.81f) < 1.5f
|
||||||
if (dt > 0.25f) initialized = false // Never integrate a reconnect/stall as motion.
|
if (dt > 0.25f) initialized = false // Never integrate a reconnect/stall as motion.
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ object AutoDriverTrial {
|
|||||||
release, p.getString("name", "").orEmpty(),
|
release, p.getString("name", "").orEmpty(),
|
||||||
p.getString("display", "").orEmpty(), p.getString("linux", "").orEmpty(),
|
p.getString("display", "").orEmpty(), p.getString("linux", "").orEmpty(),
|
||||||
p.getString("previousDisplay", "").orEmpty(), p.getString("previousLinux", "").orEmpty(),
|
p.getString("previousDisplay", "").orEmpty(), p.getString("previousLinux", "").orEmpty(),
|
||||||
maxOf(p.getInt("starts", 0), p.getInt("displayStarts", 0)),
|
p.getInt("starts", 0),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ object AutoDriverTrial {
|
|||||||
.putString("release", release).putString("name", name)
|
.putString("release", release).putString("name", name)
|
||||||
.putString("display", display).putString("linux", linux)
|
.putString("display", display).putString("linux", linux)
|
||||||
.putString("previousDisplay", previousDisplay).putString("previousLinux", previousLinux)
|
.putString("previousDisplay", previousDisplay).putString("previousLinux", previousLinux)
|
||||||
.putInt("starts", 0).putInt("displayStarts", 0)
|
.putInt("starts", 0)
|
||||||
.commit()
|
.commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,24 +48,13 @@ object AutoDriverTrial {
|
|||||||
|
|
||||||
fun bad(context: Context): Set<String> = prefs(context).getStringSet("bad", emptySet()).orEmpty()
|
fun bad(context: Context): Set<String> = prefs(context).getStringSet("bad", emptySet()).orEmpty()
|
||||||
|
|
||||||
/**
|
|
||||||
* Counted before the compositor loads the trial display driver, so a driver that kills the process during
|
|
||||||
* Vulkan init still counts towards a rollback; sessionStarting runs too late for that.
|
|
||||||
*/
|
|
||||||
fun displayStarting(context: Context, display: String) {
|
|
||||||
val p = prefs(context)
|
|
||||||
if (p.getString("release", null) == null || p.getString("display", "") != display) return
|
|
||||||
val counted = maxOf(p.getInt("displayStarts", 0), p.getInt("starts", 0))
|
|
||||||
p.edit().putInt("displayStarts", counted + 1).commit()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun sessionStarting(context: Context, display: String, linux: String) {
|
fun sessionStarting(context: Context, display: String, linux: String) {
|
||||||
val trial = current(context)
|
val trial = current(context)
|
||||||
watching = null
|
watching = null
|
||||||
if (trial == null || trial.display != display || trial.linux != linux) return
|
if (trial == null || trial.display != display || trial.linux != linux) return
|
||||||
app = context.applicationContext
|
app = context.applicationContext
|
||||||
watching = trial
|
watching = trial
|
||||||
prefs(context).edit().putInt("starts", prefs(context).getInt("starts", 0) + 1).commit()
|
prefs(context).edit().putInt("starts", trial.starts + 1).commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun sessionReady() {
|
fun sessionReady() {
|
||||||
|
|||||||
@@ -57,11 +57,10 @@ object DeviceInfo {
|
|||||||
add("Model found from", when (gpu.modelSource) {
|
add("Model found from", when (gpu.modelSource) {
|
||||||
"kernel" -> "the kernel's GPU name"
|
"kernel" -> "the kernel's GPU name"
|
||||||
"vulkan" -> "the Vulkan driver (the kernel's name has no model)"
|
"vulkan" -> "the Vulkan driver (the kernel's name has no model)"
|
||||||
"platform" -> "the platform or SoC (the kernel and Vulkan names have no model)"
|
"platform" -> "the platform (the kernel's name has no model)"
|
||||||
else -> "unknown"
|
else -> "unknown"
|
||||||
})
|
})
|
||||||
add("Kernel name", gpu.kgslName)
|
add("Kernel name", gpu.kgslName)
|
||||||
add("Kernel chip id", gpu.kgslChipId)
|
|
||||||
val kgsl = "/sys/class/kgsl/kgsl-3d0"
|
val kgsl = "/sys/class/kgsl/kgsl-3d0"
|
||||||
add("Clock range", gpuRange())
|
add("Clock range", gpuRange())
|
||||||
add("Load", read("$kgsl/gpu_busy_percentage")?.let { if (it.endsWith("%")) it else "$it %" })
|
add("Load", read("$kgsl/gpu_busy_percentage")?.let { if (it.endsWith("%")) it else "$it %" })
|
||||||
|
|||||||
@@ -7,13 +7,12 @@ import com.droiddeck.launcher.wayland.WaylandCompositor
|
|||||||
|
|
||||||
object FrameGen {
|
object FrameGen {
|
||||||
const val ENGINE_OFF = "off"
|
const val ENGINE_OFF = "off"
|
||||||
const val ENGINE_DDFG = "ddfg"
|
const val ENGINE_WINFG = "winfg"
|
||||||
private const val LEGACY_ENGINE_WINFG = "winfg"
|
|
||||||
const val ENGINE_LSFG = "lsfg"
|
const val ENGINE_LSFG = "lsfg"
|
||||||
|
|
||||||
private const val DDFG_PERF_PRESET = 2
|
private const val WINFG_PERF_PRESET = 2
|
||||||
private const val DDFG_MODEL = 4
|
private const val WINFG_MODEL = 4
|
||||||
private const val FLOW_SCALE_DDFG = 0.60f
|
private const val FLOW_SCALE_WINFG = 0.60f
|
||||||
private const val FLOW_SCALE_LSFG = 0.80f
|
private const val FLOW_SCALE_LSFG = 0.80f
|
||||||
|
|
||||||
val ADAPTIVE_TARGETS = listOf(120, 90, 60)
|
val ADAPTIVE_TARGETS = listOf(120, 90, 60)
|
||||||
@@ -30,7 +29,7 @@ object FrameGen {
|
|||||||
|
|
||||||
fun mode(context: Context): Mode {
|
fun mode(context: Context): Mode {
|
||||||
val prefs = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE)
|
val prefs = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE)
|
||||||
val engine = prefs.getString("engine", ENGINE_OFF).let { if (it == LEGACY_ENGINE_WINFG) ENGINE_DDFG else it ?: ENGINE_OFF }
|
val engine = prefs.getString("engine", ENGINE_OFF) ?: ENGINE_OFF
|
||||||
val target = prefs.getInt("target", 0)
|
val target = prefs.getInt("target", 0)
|
||||||
if (engine == ENGINE_LSFG && target in ADAPTIVE_TARGETS) return Mode(engine, target = target)
|
if (engine == ENGINE_LSFG && target in ADAPTIVE_TARGETS) return Mode(engine, target = target)
|
||||||
return Mode(engine, prefs.getInt("multiplier", 2).coerceIn(2, 4))
|
return Mode(engine, prefs.getInt("multiplier", 2).coerceIn(2, 4))
|
||||||
@@ -44,7 +43,7 @@ object FrameGen {
|
|||||||
fun label(context: Context): String = label(context, mode(context))
|
fun label(context: Context): String = label(context, mode(context))
|
||||||
|
|
||||||
fun label(context: Context, mode: Mode): String = when {
|
fun label(context: Context, mode: Mode): String = when {
|
||||||
mode.engine == ENGINE_DDFG -> context.getString(R.string.frame_gen_ddfg, mode.multiplier)
|
mode.engine == ENGINE_WINFG -> context.getString(R.string.frame_gen_winfg, mode.multiplier)
|
||||||
mode.engine == ENGINE_LSFG && mode.target > 0 -> context.getString(R.string.frame_gen_lsfg_adaptive, mode.target)
|
mode.engine == ENGINE_LSFG && mode.target > 0 -> context.getString(R.string.frame_gen_lsfg_adaptive, mode.target)
|
||||||
mode.engine == ENGINE_LSFG -> context.getString(R.string.frame_gen_lsfg, mode.multiplier)
|
mode.engine == ENGINE_LSFG -> context.getString(R.string.frame_gen_lsfg, mode.multiplier)
|
||||||
else -> context.getString(R.string.frame_gen_off)
|
else -> context.getString(R.string.frame_gen_off)
|
||||||
@@ -69,10 +68,10 @@ object FrameGen {
|
|||||||
WaylandCompositor.nativeSetFrameGenTuning(FLOW_SCALE_LSFG, refreshHz)
|
WaylandCompositor.nativeSetFrameGenTuning(FLOW_SCALE_LSFG, refreshHz)
|
||||||
WaylandCompositor.nativeSetFrameGenArmed(true, mode.multiplier, mode.target)
|
WaylandCompositor.nativeSetFrameGenArmed(true, mode.multiplier, mode.target)
|
||||||
}
|
}
|
||||||
ENGINE_DDFG -> {
|
ENGINE_WINFG -> {
|
||||||
WaylandCompositor.nativeSetFrameGenEngine(WaylandCompositor.FG_ENGINE_DDFG)
|
WaylandCompositor.nativeSetFrameGenEngine(WaylandCompositor.FG_ENGINE_WINFG)
|
||||||
WaylandCompositor.nativeSetDdFgTuning(DDFG_MODEL, DDFG_PERF_PRESET)
|
WaylandCompositor.nativeSetWinFgTuning(WINFG_MODEL, WINFG_PERF_PRESET)
|
||||||
WaylandCompositor.nativeSetFrameGenTuning(FLOW_SCALE_DDFG, refreshHz)
|
WaylandCompositor.nativeSetFrameGenTuning(FLOW_SCALE_WINFG, refreshHz)
|
||||||
WaylandCompositor.nativeSetFrameGenArmed(true, mode.multiplier, 0)
|
WaylandCompositor.nativeSetFrameGenArmed(true, mode.multiplier, 0)
|
||||||
}
|
}
|
||||||
else -> WaylandCompositor.nativeSetFrameGenArmed(false, 0, 0)
|
else -> WaylandCompositor.nativeSetFrameGenArmed(false, 0, 0)
|
||||||
|
|||||||
Loaded 100 of 710 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user