mirror of
https://github.com/yuzu-emu/yuzu-android
synced 2025-06-08 15:00:57 -07:00
Compare commits
828 Commits
android-17
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
dc529a89ae | ||
|
1869349dce | ||
|
70711ddb39 | ||
|
adc597a799 | ||
|
276ceb26d0 | ||
|
15e6e48bef | ||
|
2f57c5a0e9 | ||
|
338e088b9d | ||
|
56c9107d08 | ||
|
dc94882c90 | ||
|
30567a5909 | ||
|
f1b1530249 | ||
|
6948ac8c16 | ||
|
b2e129eaa5 | ||
|
1de37306a5 | ||
|
9bc85dda5f | ||
|
c7174d5f61 | ||
|
1bec420695 | ||
|
79edad2533 | ||
|
ce62fa6f7b | ||
|
a0e254e7c4 | ||
|
25c3bbba0e | ||
|
d66ca8b731 | ||
|
fd9ed54f27 | ||
|
f9bfdb1555 | ||
|
15831b19a3 | ||
|
8416d1c028 | ||
|
4d5d37ae61 | ||
|
e62cea20d1 | ||
|
9e27dbb53b | ||
|
dc50b95a47 | ||
|
4050242cf3 | ||
|
fd718f350c | ||
|
0d6fd12231 | ||
|
f297e98a9e | ||
|
637c54e205 | ||
|
f045fa576b | ||
|
692ba0fa7d | ||
|
a93d249ac1 | ||
|
9fccccedee | ||
|
ca7f949ee8 | ||
|
05f94dc5fc | ||
|
dcf7698924 | ||
|
7b68d7d467 | ||
|
4741e50047 | ||
|
7836c0867d | ||
|
d1e0039bc8 | ||
|
7a51eaa727 | ||
|
6c40d75e47 | ||
|
0a0c257206 | ||
|
7019023cbc | ||
|
c48c182fe0 | ||
|
98be02898b | ||
|
e1bdeb2942 | ||
|
015d666a4d | ||
|
624c90a439 | ||
|
0fb26acccc | ||
|
ed315fb8a5 | ||
|
fc6a87bba1 | ||
|
d08f201e0c | ||
|
0369c65870 | ||
|
975d6f1ec4 | ||
|
7c9e2255be | ||
|
9f6818a6e5 | ||
|
f1c16b487a | ||
|
6512f39061 | ||
|
22b91afa69 | ||
|
77107ba124 | ||
|
fa4dec9fe9 | ||
|
215e887be0 | ||
|
0da6704fc2 | ||
|
812754edec | ||
|
964e19ab56 | ||
|
9dc624f5dc | ||
|
dad9ea3e07 | ||
|
2c00599a53 | ||
|
2786d34dd7 | ||
|
864b046500 | ||
|
d12d9dad40 | ||
|
2b3f1d3fc5 | ||
|
984396a21a | ||
|
4f95ee5209 | ||
|
c04567fad4 | ||
|
89c2fd3d28 | ||
|
5ab49c833d | ||
|
0e74204aad | ||
|
a37bd0b9a7 | ||
|
01d89acd13 | ||
|
e85466c1ae | ||
|
352297d361 | ||
|
6c2d6cff19 | ||
|
e540757279 | ||
|
a8bca24292 | ||
|
5f3c03d6a8 | ||
|
6b956a6951 | ||
|
8689370830 | ||
|
8ffa27b311 | ||
|
6334616b44 | ||
|
8bbc209950 | ||
|
9e1a67b950 | ||
|
de5422b1fd | ||
|
45f450fca5 | ||
|
9a3fd76b25 | ||
|
60fc6df407 | ||
|
2e4a6b7f92 | ||
|
5f90bd88da | ||
|
c575a85233 | ||
|
ea4703cb31 | ||
|
0471e54e5a | ||
|
6012c9fe3a | ||
|
f65539504f | ||
|
62083fcafd | ||
|
2e5a9cf119 | ||
|
a45b8bc9bc | ||
|
a05bd3c47e | ||
|
2a2c92f181 | ||
|
f54277364c | ||
|
de2d496e71 | ||
|
7b5bdd076d | ||
|
e0c17a2113 | ||
|
b107435a3f | ||
|
4e1fcd4a63 | ||
|
ea4a96b45e | ||
|
6a90db8c19 | ||
|
0e5972b0b5 | ||
|
5f7608a7c6 | ||
|
668ff0db3a | ||
|
9f159dd62c | ||
|
d1eaeeed8c | ||
|
10e27a2902 | ||
|
f567a41f53 | ||
|
704c62ca01 | ||
|
8d5473e67c | ||
|
3b1b98c645 | ||
|
daf350f5d3 | ||
|
ef50277124 | ||
|
ba70dc4c13 | ||
|
934e420e36 | ||
|
d5e4617ab5 | ||
|
b5a17b501b | ||
|
2b18957365 | ||
|
4c71bf3d90 | ||
|
fdf4a5bc90 | ||
|
b7d9eba72b | ||
|
380475af32 | ||
|
a2a0be4246 | ||
|
c9ef2e26ca | ||
|
aa6532cf34 | ||
|
310c1f50be | ||
|
665fce871f | ||
|
58c7e846cb | ||
|
8b0fb98a11 | ||
|
8615509c40 | ||
|
d0af52f28e | ||
|
f46dc31683 | ||
|
ef89b79d7e | ||
|
3e41f9a673 | ||
|
d45a12826c | ||
|
56810541f0 | ||
|
911ee8fd1f | ||
|
5361027ef0 | ||
|
56721517ea | ||
|
940a71422e | ||
|
da225d4aa1 | ||
|
8d74c107f5 | ||
|
1fc86b1e3a | ||
|
4cdf18095d | ||
|
2d43831d1f | ||
|
2e96921f9c | ||
|
cf0de18982 | ||
|
ae83ee28a3 | ||
|
306ed4984b | ||
|
626f2e65b1 | ||
|
2eded86b4b | ||
|
786fc512e2 | ||
|
c31ac45332 | ||
|
db172ba249 | ||
|
bb59940b03 | ||
|
04887953ff | ||
|
8ea72cc99d | ||
|
44d2e90217 | ||
|
12926eb5db | ||
|
ae114d2fa1 | ||
|
270d07be2f | ||
|
947cdbe4b1 | ||
|
5583957616 | ||
|
6d731e1aa1 | ||
|
839ded7d59 | ||
|
f57281ebc1 | ||
|
0a3bc6c0cf | ||
|
55a7815064 | ||
|
a1c4f53c8c | ||
|
8bbb44a74e | ||
|
bc5ae04ea0 | ||
|
4f387b0b74 | ||
|
bdf8aca750 | ||
|
acfc4d6dfb | ||
|
35a3c7226a | ||
|
d93fdc8a6c | ||
|
5d3c7433b8 | ||
|
0010d42f82 | ||
|
316089c39f | ||
|
5024df1925 | ||
|
e7146309de | ||
|
c327d2a62c | ||
|
cb2e312f13 | ||
|
366bb52ec8 | ||
|
82949085c0 | ||
|
90c43aa2e7 | ||
|
a07f0883b9 | ||
|
812f23d05c | ||
|
dcce9837d2 | ||
|
ee8eccc5fa | ||
|
7b79cddacd | ||
|
53f8383354 | ||
|
36108ce2be | ||
|
4cbafc1ef6 | ||
|
e31c926bf0 | ||
|
59ede32f8e | ||
|
9eba64adce | ||
|
110969e207 | ||
|
50ecad547e | ||
|
34fb14ec9a | ||
|
e2e0916100 | ||
|
501e3ae05a | ||
|
ac33847b30 | ||
|
18494b0ad6 | ||
|
dc2c302a84 | ||
|
a251f77556 | ||
|
ec02a1cfe5 | ||
|
39b958ab86 | ||
|
9c0724b270 | ||
|
dbcc447f43 | ||
|
2954c01b47 | ||
|
c7588c042b | ||
|
6e2678a42c | ||
|
462ea921e3 | ||
|
cb29aa0473 | ||
|
af42482565 | ||
|
caf16982d9 | ||
|
1842df1da5 | ||
|
8863940bf5 | ||
|
b1c71f976c | ||
|
59011a04a1 | ||
|
c448001d47 | ||
|
2e8c0e9247 | ||
|
db871677b0 | ||
|
a40adbc142 | ||
|
1e8554b01f | ||
|
75bfbadb23 | ||
|
ad4ae39903 | ||
|
fefdba05ca | ||
|
f813dc78b2 | ||
|
10ba318807 | ||
|
86fc1e5b32 | ||
|
3c823254ff | ||
|
a0513bc45b | ||
|
3067bfd126 | ||
|
95d96cfe66 | ||
|
f75fceb3c0 | ||
|
3511d5552a | ||
|
f27bdce70f | ||
|
85fd2bcb82 | ||
|
461eaca7e8 | ||
|
836592c447 | ||
|
fbc1b61bff | ||
|
bca698a17a | ||
|
a65fb85b6d | ||
|
bbb1ff6574 | ||
|
927fa532e5 | ||
|
87b740df46 | ||
|
203d213529 | ||
|
2e614ce08f | ||
|
9e271f2017 | ||
|
79f225bd59 | ||
|
c7e94e2175 | ||
|
1c797a8048 | ||
|
f9bba8007d | ||
|
2c49ebbeea | ||
|
17460def8e | ||
|
77b7e1e682 | ||
|
eafaa5511d | ||
|
96fea99af9 | ||
|
44e7e85f23 | ||
|
af35057212 | ||
|
590e86792c | ||
|
6fd6c65fd4 | ||
|
c809f7193a | ||
|
c7e97b22fb | ||
|
b2e140b032 | ||
|
2ff45cd0da | ||
|
b6b56f48b7 | ||
|
04a9d14f35 | ||
|
26e028808a | ||
|
2053ff96fc | ||
|
368bf2211f | ||
|
de8a623932 | ||
|
865a0186b6 | ||
|
98db796fde | ||
|
adebc96a9c | ||
|
564a65a82e | ||
|
501ff2eda5 | ||
|
999ec5739d | ||
|
68b2db21b1 | ||
|
2337397a15 | ||
|
7c56ecca3f | ||
|
211544fbc8 | ||
|
4677fd3f64 | ||
|
4eeac731ff | ||
|
9ce43ee677 | ||
|
816d03f7d9 | ||
|
909f7eb3d2 | ||
|
7c2e9a6596 | ||
|
fe6934593f | ||
|
52c8adc7ed | ||
|
7ec7ff0f30 | ||
|
a133eadf06 | ||
|
89dd0fa932 | ||
|
a9dcfe2a42 | ||
|
2ad8d614b5 | ||
|
b206ea5cfe | ||
|
70590f79f8 | ||
|
fa12384350 | ||
|
78aac6b403 | ||
|
0cb413c3d3 | ||
|
962c82540c | ||
|
06fd7f2012 | ||
|
0cbb555e9a | ||
|
2e8c21ad2d | ||
|
f44183db9e | ||
|
5fa9bc192c | ||
|
f9a559d2b7 | ||
|
af87365672 | ||
|
03a23c037a | ||
|
0ac777460d | ||
|
71e59bdcd8 | ||
|
0a1283f94f | ||
|
2600ac65c8 | ||
|
c8e8c614a0 | ||
|
e7c4c8b993 | ||
|
7cfb51e5e7 | ||
|
f049453dd6 | ||
|
cac37a6f6e | ||
|
263dfa95e4 | ||
|
bc9711cb1e | ||
|
b4d88a7bb4 | ||
|
ae833aa9c0 | ||
|
4463ded603 | ||
|
159dec01ee | ||
|
6319bafafa | ||
|
c000a5ff09 | ||
|
fee263c59c | ||
|
5a64a77df3 | ||
|
6810929f6a | ||
|
9404633bfd | ||
|
12f86f89fc | ||
|
9858ea79fb | ||
|
2c357c929c | ||
|
482e203d5c | ||
|
c10e720ba9 | ||
|
5016de3626 | ||
|
d5fb9fd12c | ||
|
c79b3af610 | ||
|
c0a383d960 | ||
|
b6106604c4 | ||
|
12b6162852 | ||
|
8f192b494a | ||
|
372897aac4 | ||
|
fa47ac1c9f | ||
|
c52d7cc694 | ||
|
a2f23746c2 | ||
|
215b13f2a2 | ||
|
35ed9425d7 | ||
|
74cc8721c7 | ||
|
8ef1db78b0 | ||
|
18c8f10ff2 | ||
|
96d881f087 | ||
|
0e950baf41 | ||
|
8113f55f4b | ||
|
f296a9ce9a | ||
|
ddbefc71cb | ||
|
0d5a3abeae | ||
|
85143e8376 | ||
|
504abbd6e0 | ||
|
accccc0cbf | ||
|
01ba6cf610 | ||
|
4841dc0b74 | ||
|
185125e4e4 | ||
|
99ea31faa8 | ||
|
9ade941de1 | ||
|
4cccbe7989 | ||
|
5eb5c96750 | ||
|
5da55cbac9 | ||
|
81cc4df1f9 | ||
|
25f3d358b1 | ||
|
a3c8bb251d | ||
|
327533be1f | ||
|
61ea2115c7 | ||
|
108a72ea8a | ||
|
fb3ef957bb | ||
|
78f72b3bf5 | ||
|
6baf965777 | ||
|
3f86b339f3 | ||
|
32d38a5df6 | ||
|
3ac46aeced | ||
|
58cf2ee1f9 | ||
|
c74b5f9ee6 | ||
|
11a8ef6640 | ||
|
b51b47e707 | ||
|
35e3c68028 | ||
|
818721d12d | ||
|
3212bf5294 | ||
|
d49275f0e7 | ||
|
c9ff4b9de4 | ||
|
21138b6a86 | ||
|
f740d8b9be | ||
|
d4ac84d50d | ||
|
5cb9fe7819 | ||
|
c98d0e185f | ||
|
2c421a7046 | ||
|
a595e9e8a7 | ||
|
10cf058518 | ||
|
9bdf09bd76 | ||
|
d4de04584f | ||
|
dd2918efd8 | ||
|
2ed9586130 | ||
|
b78900e956 | ||
|
60ee29aac3 | ||
|
b90eff4bc6 | ||
|
0c2e5b64c9 | ||
|
9568b310be | ||
|
2b1dd3bef5 | ||
|
453091f611 | ||
|
80de01a5b4 | ||
|
7cc7d027f7 | ||
|
12e5293c73 | ||
|
22492b68b7 | ||
|
a12a26e19b | ||
|
2a2a1d98b3 | ||
|
6e92a7a149 | ||
|
4dfe9dd038 | ||
|
d57165df45 | ||
|
738e9a79a0 | ||
|
aaab11e36f | ||
|
8f848f43e9 | ||
|
a7c1306e2d | ||
|
e8be665f11 | ||
|
9ed82a280e | ||
|
817d916233 | ||
|
ffe3984353 | ||
|
ec734cb06c | ||
|
8292ba7ad6 | ||
|
2e65616761 | ||
|
07aa1a99fa | ||
|
6524f20de4 | ||
|
a0f7f2b309 | ||
|
442aad9b27 | ||
|
8e0f97ac96 | ||
|
5510b31972 | ||
|
ecea5ef757 | ||
|
a1ce45b0b1 | ||
|
9ba9780a96 | ||
|
4afca6bf5d | ||
|
73e7a259fd | ||
|
8e0a40434c | ||
|
68303ed601 | ||
|
8a146469c0 | ||
|
b1c2f791af | ||
|
182137a9a4 | ||
|
3155f4e96d | ||
|
345d691328 | ||
|
dfb9fa0144 | ||
|
a7e9d7842d | ||
|
7de6b41030 | ||
|
2cc5c517cf | ||
|
c0775e74ec | ||
|
3acf35bb98 | ||
|
8ddfecfbae | ||
|
51f5a6f1f8 | ||
|
64fca24b32 | ||
|
41149d061d | ||
|
ba4cee1812 | ||
|
06abf3205a | ||
|
adfdc9520a | ||
|
90cb852908 | ||
|
278dd589ec | ||
|
15e8791f9d | ||
|
498c9bd96a | ||
|
6c8df6af44 | ||
|
8e93537266 | ||
|
b8f16f3538 | ||
|
87e26de0fc | ||
|
575183d6dc | ||
|
6a2532fe17 | ||
|
3655115105 | ||
|
5561a08d59 | ||
|
e687ca8735 | ||
|
0bf46cb1ee | ||
|
19a2f12692 | ||
|
6cc82fd430 | ||
|
72c897c49d | ||
|
077a50a547 | ||
|
820f1c8a16 | ||
|
b163757e1f | ||
|
2bc0132d0c | ||
|
b75401a2cb | ||
|
12e7ee2357 | ||
|
3ec41503e3 | ||
|
c770af9b12 | ||
|
2d8f80b65e | ||
|
6c4eb2733d | ||
|
d5e8c9d04f | ||
|
3f1290cee3 | ||
|
5a20d07c21 | ||
|
9f91d310c6 | ||
|
6527c0d2fc | ||
|
ce2eb6e8ee | ||
|
8b47465586 | ||
|
3065ab0fd8 | ||
|
a2407a2964 | ||
|
16b79df836 | ||
|
6a4b25699d | ||
|
da410506a4 | ||
|
c5e88c654e | ||
|
bd8635e26a | ||
|
4349cdba07 | ||
|
f2fb761bac | ||
|
59aee2b461 | ||
|
4d206d849e | ||
|
744c0173d1 | ||
|
55482ab5dc | ||
|
e56b44dee6 | ||
|
f2012e5aff | ||
|
4526fdaf64 | ||
|
bc22b4e782 | ||
|
f70821ce0d | ||
|
a774ff935c | ||
|
431df5ae93 | ||
|
677c2c2cd2 | ||
|
ee540c712c | ||
|
d23c4393fd | ||
|
b24a111136 | ||
|
91636deaaf | ||
|
68cbf67f4c | ||
|
645961613f | ||
|
53b321c945 | ||
|
975deb7528 | ||
|
2c049ae06d | ||
|
54372fdff5 | ||
|
c60ab6bbf6 | ||
|
cc09c265e1 | ||
|
0f9288e38d | ||
|
06fb7f90da | ||
|
e04368ad7c | ||
|
3e2d3548f2 | ||
|
eb9036d75b | ||
|
01a2d978eb | ||
|
6e67b25af9 | ||
|
e91667ba75 | ||
|
d45561ace0 | ||
|
0fdd6e8934 | ||
|
35794f4f18 | ||
|
b8be8dff69 | ||
|
bc317a9807 | ||
|
97ca160b08 | ||
|
1a3fc3724a | ||
|
7b01454d5f | ||
|
f3749394ac | ||
|
807f421752 | ||
|
e4915fb7d2 | ||
|
a76f6a2775 | ||
|
ba518f6899 | ||
|
ad4622da2c | ||
|
3b1c2896d9 | ||
|
fc5d76e6e2 | ||
|
5f9a45ada9 | ||
|
a120f8ff4d | ||
|
96833cd809 | ||
|
8649a80071 | ||
|
550cadbee4 | ||
|
8bd10473d6 | ||
|
8d708b0c79 | ||
|
beaab10c8f | ||
|
889c5d2705 | ||
|
17b0aac809 | ||
|
399220ddbc | ||
|
23e074ff14 | ||
|
59080a3d1d | ||
|
3a25a217e6 | ||
|
f854ffd015 | ||
|
961b5586a5 | ||
|
57ff934f0d | ||
|
92ce9273ee | ||
|
dd36d43ea1 | ||
|
a7a7720752 | ||
|
c725f3c86c | ||
|
1b984738ab | ||
|
a3199401f4 | ||
|
a7620a29be | ||
|
5ac1297fa5 | ||
|
fe69105f71 | ||
|
93a3342841 | ||
|
7b3e26acc9 | ||
|
444e86d191 | ||
|
61ce0088ae | ||
|
b3aa3633c7 | ||
|
627ba271ad | ||
|
2faa631676 | ||
|
5838779162 | ||
|
23fd1041c1 | ||
|
5c398ede6f | ||
|
378e4752a6 | ||
|
dad48f16b7 | ||
|
a363fa78ef | ||
|
03fa91ba3c | ||
|
d79d4d5986 | ||
|
ccd3dd842f | ||
|
b4a8e1ef8a | ||
|
5ea8f05ec6 | ||
|
10535e0016 | ||
|
a8c552e261 | ||
|
932bd98824 | ||
|
9f376cd901 | ||
|
a560b9f5a2 | ||
|
4f04bd3697 | ||
|
97c8b49444 | ||
|
748465f5a5 | ||
|
04867e2456 | ||
|
32f623e029 | ||
|
b6c6534c30 | ||
|
beb438bb0b | ||
|
4b963ca8a5 | ||
|
648ed55fe6 | ||
|
23430e6772 | ||
|
0672847330 | ||
|
a874ab0133 | ||
|
590d9b7e1d | ||
|
b0bca0f8b0 | ||
|
d8f1ce2f76 | ||
|
9b11b9dce5 | ||
|
303cd31162 | ||
|
0adc09e0af | ||
|
96fd1348ae | ||
|
bad705f245 | ||
|
34a8d0cc8e | ||
|
0a2536a0df | ||
|
c85d7ccd79 | ||
|
7a9d1ad2f8 | ||
|
2f0418c101 | ||
|
3092855d5a | ||
|
72f803c366 | ||
|
c87b96435d | ||
|
e4bbb24dcf | ||
|
6536d29c61 | ||
|
116f76e4b6 | ||
|
ce89580749 | ||
|
dff0a7c52a | ||
|
915efa4236 | ||
|
4548e5ae1d | ||
|
46c2435235 | ||
|
e9eb017aac | ||
|
0b0e9ef18d | ||
|
7f5adf8982 | ||
|
89d6856090 | ||
|
2cacb9d48c | ||
|
2c29c2b8dd | ||
|
16abda59be | ||
|
90ab89a0b0 | ||
|
6531ad56a6 | ||
|
e8671ed04e | ||
|
2044ae6b3a | ||
|
c661b95864 | ||
|
c683ec2bcb | ||
|
2e4e33156e | ||
|
04f4eeaca2 | ||
|
2e4b32204c | ||
|
34db13486a | ||
|
c6c6bb4041 | ||
|
a2ffb419c9 | ||
|
0127cec371 | ||
|
db3a6075f5 | ||
|
8876a15227 | ||
|
954eb40237 | ||
|
d4acdac168 | ||
|
817c7c445d | ||
|
da714a362b | ||
|
7b3941e5d4 | ||
|
15d8a40529 | ||
|
cdeaca73c4 | ||
|
bee22540a1 | ||
|
76880b84f9 | ||
|
2f0b57ca13 | ||
|
f90a022d3a | ||
|
f2fed21c11 | ||
|
d940974789 | ||
|
f7a3c135e2 | ||
|
fcb0dff67c | ||
|
b5dac5f525 | ||
|
a4d90a9a64 | ||
|
84787a2ada | ||
|
2a0d707ce1 | ||
|
aae9eea532 | ||
|
2044a289f8 | ||
|
d3ba6b334b | ||
|
dac8c4ce4d | ||
|
9e974d4c7e | ||
|
6bfc3c530c | ||
|
93239f191a | ||
|
b17db2b462 | ||
|
9130366a58 | ||
|
ad0066a6b6 | ||
|
78c323c4eb | ||
|
51ad2d10de | ||
|
6533dfd7ce | ||
|
e11a3414ae | ||
|
4fdc900581 | ||
|
d99830b59c | ||
|
23c11e50f9 | ||
|
5fde5e62a8 | ||
|
f124461674 | ||
|
63b835f822 | ||
|
30743eff56 | ||
|
4f83b00f6f | ||
|
ea710e6523 | ||
|
200b371d13 | ||
|
ae88ea79b2 | ||
|
82b58668ed | ||
|
bd80929ac1 | ||
|
2a4ac7cfac | ||
|
ab513c378a | ||
|
a959fb011f | ||
|
53085a45e0 | ||
|
bc2d1262d7 | ||
|
1220309323 | ||
|
a972341b5d | ||
|
87430acff1 | ||
|
0b4cc6e14c | ||
|
5105b90017 | ||
|
3516a2d0bf | ||
|
f224ef6185 | ||
|
8e27a485d8 | ||
|
a36f4d0a9f | ||
|
b71840bbd2 | ||
|
71fbc87dbd | ||
|
37b0870ee3 | ||
|
3dbe998f9b | ||
|
edfbf363de | ||
|
12fd2ae86d | ||
|
ee847f8ff0 | ||
|
92a331af76 | ||
|
a8f62bff43 | ||
|
519904e8a8 | ||
|
8d3463dbdd | ||
|
b125cb97a2 | ||
|
d7e7a69e00 | ||
|
246cffb624 | ||
|
0e93cad4f0 | ||
|
53d4dbacf0 | ||
|
39d28a5131 | ||
|
fa04dea7c4 | ||
|
1c278974a8 | ||
|
2b838b6d06 | ||
|
82ea082997 | ||
|
5562322290 | ||
|
6a244465ce | ||
|
e5de3d5a77 | ||
|
bdf87ba0f8 | ||
|
3b314a68a1 | ||
|
06c68fb196 | ||
|
9a31122c82 | ||
|
dace726d08 | ||
|
0f7fc94111 | ||
|
e231b8b6f5 | ||
|
68fe1e3476 | ||
|
148ad0cf0b | ||
|
1b4cf7fc27 | ||
|
cec91c5fd6 | ||
|
974ccb6f00 | ||
|
3c78926d75 | ||
|
466cdeb8a0 | ||
|
29b983398c | ||
|
15cf34cd62 | ||
|
59d81ae614 | ||
|
c3c676b7d6 | ||
|
aa9ff2ffc2 | ||
|
f0f92edbd0 | ||
|
4d49f095b3 | ||
|
f47d618e54 | ||
|
583e04bdd6 | ||
|
737e6e531c | ||
|
d07397931a | ||
|
865abfc37c | ||
|
aa4d15594f | ||
|
278cafb76c | ||
|
24a78dba31 | ||
|
d163b18208 | ||
|
051afd21e7 | ||
|
d3f38ce56c | ||
|
b2b4742e61 | ||
|
09bfc852dc | ||
|
ace74bd066 | ||
|
f6ee53af14 | ||
|
6c6cb5745f | ||
|
3262c0f747 | ||
|
9323a1f9b2 | ||
|
f02a8d0ae9 | ||
|
8517d7cb44 | ||
|
cb4b4f3d6e | ||
|
21e7f86697 | ||
|
347b3bd18d | ||
|
755c45777f | ||
|
558192abf4 | ||
|
d677052e8c | ||
|
95bfc542aa | ||
|
d1c99c5d52 | ||
|
adb2af0a2b | ||
|
d0c60605ab | ||
|
6697b665ca | ||
|
20e0407235 | ||
|
ddda76f9b0 | ||
|
3a4e7d45f1 | ||
|
05eda56e66 | ||
|
575db04172 | ||
|
f34d3d7e84 | ||
|
139b4cc9ea | ||
|
d5d0d2cb0e | ||
|
a5b2b8b91b | ||
|
b4b301d22e |
@ -6,7 +6,12 @@
|
||||
export NDK_CCACHE="$(which ccache)"
|
||||
ccache -s
|
||||
|
||||
BUILD_FLAVOR=mainline
|
||||
BUILD_FLAVOR="mainline"
|
||||
|
||||
BUILD_TYPE="release"
|
||||
if [ "${GITHUB_REPOSITORY}" == "yuzu-emu/yuzu" ]; then
|
||||
BUILD_TYPE="relWithDebInfo"
|
||||
fi
|
||||
|
||||
if [ ! -z "${ANDROID_KEYSTORE_B64}" ]; then
|
||||
export ANDROID_KEYSTORE_FILE="${GITHUB_WORKSPACE}/ks.jks"
|
||||
@ -15,7 +20,7 @@ fi
|
||||
|
||||
cd src/android
|
||||
chmod +x ./gradlew
|
||||
./gradlew "assemble${BUILD_FLAVOR}Release" "bundle${BUILD_FLAVOR}Release"
|
||||
./gradlew "assemble${BUILD_FLAVOR}${BUILD_TYPE}" "bundle${BUILD_FLAVOR}${BUILD_TYPE}"
|
||||
|
||||
ccache -s
|
||||
|
||||
|
21
.ci/scripts/android/eabuild.sh
Normal file
21
.ci/scripts/android/eabuild.sh
Normal file
@ -0,0 +1,21 @@
|
||||
#!/bin/bash -ex
|
||||
|
||||
# SPDX-FileCopyrightText: 2024 yuzu Emulator Project
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
export NDK_CCACHE="$(which ccache)"
|
||||
ccache -s
|
||||
|
||||
export ANDROID_KEYSTORE_FILE="${GITHUB_WORKSPACE}/ks.jks"
|
||||
base64 --decode <<< "${EA_PLAY_ANDROID_KEYSTORE_B64}" > "${ANDROID_KEYSTORE_FILE}"
|
||||
export ANDROID_KEY_ALIAS="${PLAY_ANDROID_KEY_ALIAS}"
|
||||
export ANDROID_KEYSTORE_PASS="${PLAY_ANDROID_KEYSTORE_PASS}"
|
||||
export SERVICE_ACCOUNT_KEY_PATH="${GITHUB_WORKSPACE}/sa.json"
|
||||
base64 --decode <<< "${EA_SERVICE_ACCOUNT_KEY_B64}" > "${SERVICE_ACCOUNT_KEY_PATH}"
|
||||
./gradlew "publishEaReleaseBundle"
|
||||
|
||||
ccache -s
|
||||
|
||||
if [ ! -z "${ANDROID_KEYSTORE_B64}" ]; then
|
||||
rm "${ANDROID_KEYSTORE_FILE}"
|
||||
fi
|
21
.ci/scripts/android/mainlinebuild.sh
Normal file
21
.ci/scripts/android/mainlinebuild.sh
Normal file
@ -0,0 +1,21 @@
|
||||
#!/bin/bash -ex
|
||||
|
||||
# SPDX-FileCopyrightText: 2024 yuzu Emulator Project
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
export NDK_CCACHE="$(which ccache)"
|
||||
ccache -s
|
||||
|
||||
export ANDROID_KEYSTORE_FILE="${GITHUB_WORKSPACE}/ks.jks"
|
||||
base64 --decode <<< "${MAINLINE_PLAY_ANDROID_KEYSTORE_B64}" > "${ANDROID_KEYSTORE_FILE}"
|
||||
export ANDROID_KEY_ALIAS="${PLAY_ANDROID_KEY_ALIAS}"
|
||||
export ANDROID_KEYSTORE_PASS="${PLAY_ANDROID_KEYSTORE_PASS}"
|
||||
export SERVICE_ACCOUNT_KEY_PATH="${GITHUB_WORKSPACE}/sa.json"
|
||||
base64 --decode <<< "${MAINLINE_SERVICE_ACCOUNT_KEY_B64}" > "${SERVICE_ACCOUNT_KEY_PATH}"
|
||||
./gradlew "publishMainlineReleaseBundle"
|
||||
|
||||
ccache -s
|
||||
|
||||
if [ ! -z "${ANDROID_KEYSTORE_B64}" ]; then
|
||||
rm "${ANDROID_KEYSTORE_FILE}"
|
||||
fi
|
@ -7,9 +7,16 @@
|
||||
|
||||
REV_NAME="yuzu-${GITDATE}-${GITREV}"
|
||||
|
||||
BUILD_FLAVOR=mainline
|
||||
BUILD_FLAVOR="mainline"
|
||||
|
||||
cp src/android/app/build/outputs/apk/"${BUILD_FLAVOR}/release/app-${BUILD_FLAVOR}-release.apk" \
|
||||
BUILD_TYPE_LOWER="release"
|
||||
BUILD_TYPE_UPPER="Release"
|
||||
if [ "${GITHUB_REPOSITORY}" == "yuzu-emu/yuzu" ]; then
|
||||
BUILD_TYPE_LOWER="relWithDebInfo"
|
||||
BUILD_TYPE_UPPER="RelWithDebInfo"
|
||||
fi
|
||||
|
||||
cp src/android/app/build/outputs/apk/"${BUILD_FLAVOR}/${BUILD_TYPE_LOWER}/app-${BUILD_FLAVOR}-${BUILD_TYPE_LOWER}.apk" \
|
||||
"artifacts/${REV_NAME}.apk"
|
||||
cp src/android/app/build/outputs/bundle/"${BUILD_FLAVOR}Release"/"app-${BUILD_FLAVOR}-release.aab" \
|
||||
cp src/android/app/build/outputs/bundle/"${BUILD_FLAVOR}${BUILD_TYPE_UPPER}"/"app-${BUILD_FLAVOR}-${BUILD_TYPE_LOWER}.aab" \
|
||||
"artifacts/${REV_NAME}.aab"
|
||||
|
@ -3,38 +3,35 @@
|
||||
# SPDX-FileCopyrightText: 2019 yuzu Emulator Project
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
if grep -nrI '\s$' src *.yml *.txt *.md Doxyfile .gitignore .gitmodules .ci* dist/*.desktop \
|
||||
dist/*.svg dist/*.xml; then
|
||||
shopt -s nullglob globstar
|
||||
|
||||
if git grep -nrI '\s$' src **/*.yml **/*.txt **/*.md Doxyfile .gitignore .gitmodules .ci* dist/*.desktop dist/*.svg dist/*.xml; then
|
||||
echo Trailing whitespace found, aborting
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Default clang-format points to default 3.5 version one
|
||||
CLANG_FORMAT=${CLANG_FORMAT:-clang-format-15}
|
||||
$CLANG_FORMAT --version
|
||||
|
||||
if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then
|
||||
# Get list of every file modified in this pull request
|
||||
files_to_lint="$(git diff --name-only --diff-filter=ACMRTUXB $TRAVIS_COMMIT_RANGE | grep '^src/[^.]*[.]\(cpp\|h\)$' || true)"
|
||||
else
|
||||
# Check everything for branch pushes
|
||||
files_to_lint="$(find src/ -name '*.cpp' -or -name '*.h')"
|
||||
fi
|
||||
CLANG_FORMAT="${CLANG_FORMAT:-clang-format-15}"
|
||||
"$CLANG_FORMAT" --version
|
||||
|
||||
# Turn off tracing for this because it's too verbose
|
||||
set +x
|
||||
|
||||
for f in $files_to_lint; do
|
||||
d=$(diff -u "$f" <($CLANG_FORMAT "$f") || true)
|
||||
if ! [ -z "$d" ]; then
|
||||
echo "!!! $f not compliant to coding style, here is the fix:"
|
||||
echo "$d"
|
||||
fail=1
|
||||
fi
|
||||
# Check everything for branch pushes
|
||||
FILES_TO_LINT="$(find src/ -name '*.cpp' -or -name '*.h')"
|
||||
|
||||
for f in $FILES_TO_LINT; do
|
||||
echo "$f"
|
||||
"$CLANG_FORMAT" -i "$f"
|
||||
done
|
||||
|
||||
set -x
|
||||
DIFF=$(git -c core.fileMode=false diff)
|
||||
|
||||
if [ "$fail" = 1 ]; then
|
||||
if [ ! -z "$DIFF" ]; then
|
||||
echo "!!! Not compliant to coding style, here is the fix:"
|
||||
echo "$DIFF"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd src/android
|
||||
./gradlew ktlintCheck
|
||||
|
@ -9,7 +9,7 @@ chmod a+x ./.ci/scripts/linux/docker.sh
|
||||
sudo chown -R 1027 ./
|
||||
|
||||
# The environment variables listed below:
|
||||
# AZURECIREPO TITLEBARFORMATIDLE TITLEBARFORMATRUNNING DISPLAYVERSION
|
||||
# AZURECIREPO TITLEBARFORMATIDLE TITLEBARFORMATRUNNING DISPLAYVERSION
|
||||
# are requested in src/common/CMakeLists.txt and appear to be provided somewhere in Azure DevOps
|
||||
|
||||
docker run -e AZURECIREPO -e TITLEBARFORMATIDLE -e TITLEBARFORMATRUNNING -e DISPLAYVERSION -e ENABLE_COMPATIBILITY_REPORTING -e CCACHE_DIR=/yuzu/ccache -v "$(pwd):/yuzu" -w /yuzu yuzuemu/build-environments:linux-fresh /bin/bash /yuzu/.ci/scripts/linux/docker.sh "$1"
|
||||
|
@ -8,17 +8,7 @@ variables:
|
||||
DisplayVersion: $[counter(variables['DisplayPrefix'], 1)]
|
||||
|
||||
stages:
|
||||
- stage: format
|
||||
displayName: 'format'
|
||||
jobs:
|
||||
- job: format
|
||||
displayName: 'clang'
|
||||
pool:
|
||||
vmImage: ubuntu-latest
|
||||
steps:
|
||||
- template: ./templates/format-check.yml
|
||||
- stage: build
|
||||
dependsOn: format
|
||||
displayName: 'build'
|
||||
jobs:
|
||||
- job: build
|
||||
@ -43,7 +33,6 @@ stages:
|
||||
cache: 'true'
|
||||
version: $(DisplayVersion)
|
||||
- stage: build_win
|
||||
dependsOn: format
|
||||
displayName: 'build-windows'
|
||||
jobs:
|
||||
- job: build
|
||||
|
66
.github/workflows/android-ea-play-release.yml
vendored
Normal file
66
.github/workflows/android-ea-play-release.yml
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
# SPDX-FileCopyrightText: 2024 yuzu Emulator Project
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
name: yuzu-android-ea-play-release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release-track:
|
||||
description: 'Play store release track (internal/alpha/beta/production)'
|
||||
required: true
|
||||
default: 'alpha'
|
||||
|
||||
jobs:
|
||||
android:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository == 'yuzu-emu/yuzu' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
name: Checkout
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: true
|
||||
token: ${{ secrets.ALT_GITHUB_TOKEN }}
|
||||
- run: npm install execa@5
|
||||
- uses: actions/github-script@v5
|
||||
name: 'Merge and publish Android EA changes'
|
||||
env:
|
||||
ALT_GITHUB_TOKEN: ${{ secrets.ALT_GITHUB_TOKEN }}
|
||||
BUILD_EA: true
|
||||
with:
|
||||
script: |
|
||||
const execa = require("execa");
|
||||
const mergebot = require('./.github/workflows/android-merge.js').mergebot;
|
||||
process.chdir('${{ github.workspace }}');
|
||||
mergebot(github, context, execa);
|
||||
- name: Get tag name
|
||||
run: echo "GIT_TAG_NAME=$(cat tag-name.txt)" >> $GITHUB_ENV
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ccache apksigner glslang-dev glslang-tools
|
||||
- name: Build
|
||||
run: ./.ci/scripts/android/eabuild.sh
|
||||
env:
|
||||
EA_PLAY_ANDROID_KEYSTORE_B64: ${{ secrets.PLAY_ANDROID_KEYSTORE_B64 }}
|
||||
PLAY_ANDROID_KEY_ALIAS: ${{ secrets.PLAY_ANDROID_KEY_ALIAS }}
|
||||
PLAY_ANDROID_KEYSTORE_PASS: ${{ secrets.PLAY_ANDROID_KEYSTORE_PASS }}
|
||||
EA_SERVICE_ACCOUNT_KEY_B64: ${{ secrets.EA_SERVICE_ACCOUNT_KEY_B64 }}
|
||||
STORE_TRACK: ${{ github.event.inputs.release-track }}
|
||||
AUTO_VERSIONED: true
|
||||
BUILD_EA: true
|
||||
- name: Create release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: ${{ env.EA_TAG_NAME }}
|
||||
name: ${{ env.EA_TAG_NAME }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
repository: yuzu/yuzu-android
|
||||
token: ${{ secrets.ALT_GITHUB_TOKEN }}
|
59
.github/workflows/android-mainline-play-release.yml
vendored
Normal file
59
.github/workflows/android-mainline-play-release.yml
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
# SPDX-FileCopyrightText: 2024 yuzu Emulator Project
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
name: yuzu-android-mainline-play-release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release-tag:
|
||||
description: 'Tag # from yuzu-android that you want to build and publish'
|
||||
required: true
|
||||
default: '200'
|
||||
release-track:
|
||||
description: 'Play store release track (internal/alpha/beta/production)'
|
||||
required: true
|
||||
default: 'alpha'
|
||||
|
||||
jobs:
|
||||
android:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository == 'yuzu-emu/yuzu' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
name: Checkout
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: true
|
||||
token: ${{ secrets.ALT_GITHUB_TOKEN }}
|
||||
- run: npm install execa@5
|
||||
- uses: actions/github-script@v5
|
||||
name: 'Pull mainline tag'
|
||||
env:
|
||||
MAINLINE_TAG: ${{ github.event.inputs.release-tag }}
|
||||
with:
|
||||
script: |
|
||||
const execa = require("execa");
|
||||
const mergebot = require('./.github/workflows/android-merge.js').getMainlineTag;
|
||||
process.chdir('${{ github.workspace }}');
|
||||
mergebot(execa);
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ccache apksigner glslang-dev glslang-tools
|
||||
- name: Build
|
||||
run: |
|
||||
echo "GIT_TAG_NAME=android-${{ github.event.inputs.releast-tag }}" >> $GITHUB_ENV
|
||||
./.ci/scripts/android/mainlinebuild.sh
|
||||
env:
|
||||
MAINLINE_PLAY_ANDROID_KEYSTORE_B64: ${{ secrets.PLAY_ANDROID_KEYSTORE_B64 }}
|
||||
PLAY_ANDROID_KEY_ALIAS: ${{ secrets.PLAY_ANDROID_KEY_ALIAS }}
|
||||
PLAY_ANDROID_KEYSTORE_PASS: ${{ secrets.PLAY_ANDROID_KEYSTORE_PASS }}
|
||||
SERVICE_ACCOUNT_KEY_B64: ${{ secrets.MAINLINE_SERVICE_ACCOUNT_KEY_B64 }}
|
||||
STORE_TRACK: ${{ github.event.inputs.release-track }}
|
||||
AUTO_VERSIONED: true
|
166
.github/workflows/android-merge.js
vendored
166
.github/workflows/android-merge.js
vendored
@ -6,11 +6,14 @@
|
||||
|
||||
const fs = require("fs");
|
||||
// which label to check for changes
|
||||
const CHANGE_LABEL = 'android-merge';
|
||||
const CHANGE_LABEL_MAINLINE = 'android-merge';
|
||||
const CHANGE_LABEL_EA = 'android-ea-merge';
|
||||
// how far back in time should we consider the changes are "recent"? (default: 24 hours)
|
||||
const DETECTION_TIME_FRAME = (parseInt(process.env.DETECTION_TIME_FRAME)) || (24 * 3600 * 1000);
|
||||
const BUILD_EA = process.env.BUILD_EA == 'true';
|
||||
const MAINLINE_TAG = process.env.MAINLINE_TAG;
|
||||
|
||||
async function checkBaseChanges(github, context) {
|
||||
async function checkBaseChanges(github) {
|
||||
// query the commit date of the latest commit on this branch
|
||||
const query = `query($owner:String!, $name:String!, $ref:String!) {
|
||||
repository(name:$name, owner:$owner) {
|
||||
@ -22,8 +25,8 @@ async function checkBaseChanges(github, context) {
|
||||
}
|
||||
}`;
|
||||
const variables = {
|
||||
owner: context.repo.owner,
|
||||
name: context.repo.repo,
|
||||
owner: 'yuzu-emu',
|
||||
name: 'yuzu',
|
||||
ref: 'refs/heads/master',
|
||||
};
|
||||
const result = await github.graphql(query, variables);
|
||||
@ -38,22 +41,9 @@ async function checkBaseChanges(github, context) {
|
||||
return false;
|
||||
}
|
||||
|
||||
async function checkAndroidChanges(github, context) {
|
||||
if (checkBaseChanges(github, context)) return true;
|
||||
const query = `query($owner:String!, $name:String!, $label:String!) {
|
||||
repository(name:$name, owner:$owner) {
|
||||
pullRequests(labels: [$label], states: OPEN, first: 100) {
|
||||
nodes { number headRepository { pushedAt } }
|
||||
}
|
||||
}
|
||||
}`;
|
||||
const variables = {
|
||||
owner: context.repo.owner,
|
||||
name: context.repo.repo,
|
||||
label: CHANGE_LABEL,
|
||||
};
|
||||
const result = await github.graphql(query, variables);
|
||||
const pulls = result.repository.pullRequests.nodes;
|
||||
async function checkAndroidChanges(github) {
|
||||
if (checkBaseChanges(github)) return true;
|
||||
const pulls = getPulls(github, false);
|
||||
for (let i = 0; i < pulls.length; i++) {
|
||||
let pull = pulls[i];
|
||||
if (new Date() - new Date(pull.headRepository.pushedAt) <= DETECTION_TIME_FRAME) {
|
||||
@ -83,15 +73,21 @@ async function tagAndPush(github, owner, repo, execa, commit=false) {
|
||||
};
|
||||
const tags = await github.graphql(query, variables);
|
||||
const tagList = tags.repository.refs.nodes;
|
||||
const lastTag = tagList[0] ? tagList[0].name : 'dummy-0';
|
||||
let lastTag = 'android-1';
|
||||
for (let i = 0; i < tagList.length; ++i) {
|
||||
if (tagList[i].name.includes('android-')) {
|
||||
lastTag = tagList[i].name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const tagNumber = /\w+-(\d+)/.exec(lastTag)[1] | 0;
|
||||
const channel = repo.split('-')[1];
|
||||
const newTag = `${channel}-${tagNumber + 1}`;
|
||||
console.log(`New tag: ${newTag}`);
|
||||
if (commit) {
|
||||
let channelName = channel[0].toUpperCase() + channel.slice(1);
|
||||
console.info(`Committing pending commit as ${channelName} #${tagNumber + 1}`);
|
||||
await execa("git", ['commit', '-m', `${channelName} #${tagNumber + 1}`]);
|
||||
console.info(`Committing pending commit as ${channelName} ${tagNumber + 1}`);
|
||||
await execa("git", ['commit', '-m', `${channelName} ${tagNumber + 1}`]);
|
||||
}
|
||||
console.info('Pushing tags to GitHub ...');
|
||||
await execa("git", ['tag', newTag]);
|
||||
@ -101,6 +97,48 @@ async function tagAndPush(github, owner, repo, execa, commit=false) {
|
||||
console.info('Successfully pushed new changes.');
|
||||
}
|
||||
|
||||
async function tagAndPushEA(github, owner, repo, execa) {
|
||||
let altToken = process.env.ALT_GITHUB_TOKEN;
|
||||
if (!altToken) {
|
||||
throw `Please set ALT_GITHUB_TOKEN environment variable. This token should have write access to ${owner}/${repo}.`;
|
||||
}
|
||||
const query = `query ($owner:String!, $name:String!) {
|
||||
repository(name:$name, owner:$owner) {
|
||||
refs(refPrefix: "refs/tags/", orderBy: {field: TAG_COMMIT_DATE, direction: DESC}, first: 10) {
|
||||
nodes { name }
|
||||
}
|
||||
}
|
||||
}`;
|
||||
const variables = {
|
||||
owner: owner,
|
||||
name: repo,
|
||||
};
|
||||
const tags = await github.graphql(query, variables);
|
||||
const tagList = tags.repository.refs.nodes;
|
||||
let lastTag = 'ea-1';
|
||||
for (let i = 0; i < tagList.length; ++i) {
|
||||
if (tagList[i].name.includes('ea-')) {
|
||||
lastTag = tagList[i].name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const tagNumber = /\w+-(\d+)/.exec(lastTag)[1] | 0;
|
||||
const newTag = `ea-${tagNumber + 1}`;
|
||||
console.log(`New tag: ${newTag}`);
|
||||
console.info('Pushing tags to GitHub ...');
|
||||
await execa("git", ["remote", "add", "android", "https://github.com/yuzu-emu/yuzu-android.git"]);
|
||||
await execa("git", ["fetch", "android"]);
|
||||
|
||||
await execa("git", ['tag', newTag]);
|
||||
await execa("git", ['push', 'android', `${newTag}`]);
|
||||
|
||||
fs.writeFile('tag-name.txt', newTag, (err) => {
|
||||
if (err) throw 'Could not write tag name to file!'
|
||||
})
|
||||
|
||||
console.info('Successfully pushed new changes.');
|
||||
}
|
||||
|
||||
async function generateReadme(pulls, context, mergeResults, execa) {
|
||||
let baseUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/`;
|
||||
let output =
|
||||
@ -157,7 +195,7 @@ async function mergePullRequests(pulls, execa) {
|
||||
process1.stdout.pipe(process.stdout);
|
||||
await process1;
|
||||
|
||||
const process2 = execa("git", ["commit", "-m", `Merge PR ${pr}`]);
|
||||
const process2 = execa("git", ["commit", "-m", `Merge yuzu-emu#${pr}`]);
|
||||
process2.stdout.pipe(process.stdout);
|
||||
await process2;
|
||||
|
||||
@ -182,7 +220,27 @@ async function mergePullRequests(pulls, execa) {
|
||||
return mergeResults;
|
||||
}
|
||||
|
||||
async function mergebot(github, context, execa) {
|
||||
async function resetBranch(execa) {
|
||||
console.log("::group::Reset master branch");
|
||||
let hasFailed = false;
|
||||
try {
|
||||
await execa("git", ["remote", "add", "source", "https://github.com/yuzu-emu/yuzu.git"]);
|
||||
await execa("git", ["fetch", "source"]);
|
||||
const process1 = await execa("git", ["rev-parse", "source/master"]);
|
||||
const headCommit = process1.stdout;
|
||||
|
||||
await execa("git", ["reset", "--hard", headCommit]);
|
||||
} catch (err) {
|
||||
console.log(`::error title=Failed to reset master branch`);
|
||||
hasFailed = true;
|
||||
}
|
||||
console.log("::endgroup::");
|
||||
if (hasFailed) {
|
||||
throw 'Failed to reset the master branch. Aborting!';
|
||||
}
|
||||
}
|
||||
|
||||
async function getPulls(github) {
|
||||
const query = `query ($owner:String!, $name:String!, $label:String!) {
|
||||
repository(name:$name, owner:$owner) {
|
||||
pullRequests(labels: [$label], states: OPEN, first: 100) {
|
||||
@ -192,13 +250,49 @@ async function mergebot(github, context, execa) {
|
||||
}
|
||||
}
|
||||
}`;
|
||||
const variables = {
|
||||
owner: context.repo.owner,
|
||||
name: context.repo.repo,
|
||||
label: CHANGE_LABEL,
|
||||
const mainlineVariables = {
|
||||
owner: 'yuzu-emu',
|
||||
name: 'yuzu',
|
||||
label: CHANGE_LABEL_MAINLINE,
|
||||
};
|
||||
const result = await github.graphql(query, variables);
|
||||
const pulls = result.repository.pullRequests.nodes;
|
||||
const mainlineResult = await github.graphql(query, mainlineVariables);
|
||||
const pulls = mainlineResult.repository.pullRequests.nodes;
|
||||
if (BUILD_EA) {
|
||||
const eaVariables = {
|
||||
owner: 'yuzu-emu',
|
||||
name: 'yuzu',
|
||||
label: CHANGE_LABEL_EA,
|
||||
};
|
||||
const eaResult = await github.graphql(query, eaVariables);
|
||||
const eaPulls = eaResult.repository.pullRequests.nodes;
|
||||
return pulls.concat(eaPulls);
|
||||
}
|
||||
return pulls;
|
||||
}
|
||||
|
||||
async function getMainlineTag(execa) {
|
||||
console.log(`::group::Getting mainline tag android-${MAINLINE_TAG}`);
|
||||
let hasFailed = false;
|
||||
try {
|
||||
await execa("git", ["remote", "add", "mainline", "https://github.com/yuzu-emu/yuzu-android.git"]);
|
||||
await execa("git", ["fetch", "mainline", "--tags"]);
|
||||
await execa("git", ["checkout", `tags/android-${MAINLINE_TAG}`]);
|
||||
await execa("git", ["submodule", "update", "--init", "--recursive"]);
|
||||
} catch (err) {
|
||||
console.log('::error title=Failed pull tag');
|
||||
hasFailed = true;
|
||||
}
|
||||
console.log("::endgroup::");
|
||||
if (hasFailed) {
|
||||
throw 'Failed pull mainline tag. Aborting!';
|
||||
}
|
||||
}
|
||||
|
||||
async function mergebot(github, context, execa) {
|
||||
// Reset our local copy of master to what appears on yuzu-emu/yuzu - master
|
||||
await resetBranch(execa);
|
||||
|
||||
const pulls = await getPulls(github);
|
||||
let displayList = [];
|
||||
for (let i = 0; i < pulls.length; i++) {
|
||||
let pull = pulls[i];
|
||||
@ -208,11 +302,17 @@ async function mergebot(github, context, execa) {
|
||||
console.table(displayList);
|
||||
await fetchPullRequests(pulls, "https://github.com/yuzu-emu/yuzu", execa);
|
||||
const mergeResults = await mergePullRequests(pulls, execa);
|
||||
await generateReadme(pulls, context, mergeResults, execa);
|
||||
await tagAndPush(github, context.repo.owner, `${context.repo.repo}-android`, execa, true);
|
||||
|
||||
if (BUILD_EA) {
|
||||
await tagAndPushEA(github, 'yuzu-emu', `yuzu-android`, execa);
|
||||
} else {
|
||||
await generateReadme(pulls, context, mergeResults, execa);
|
||||
await tagAndPush(github, 'yuzu-emu', `yuzu-android`, execa, true);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.mergebot = mergebot;
|
||||
module.exports.checkAndroidChanges = checkAndroidChanges;
|
||||
module.exports.tagAndPush = tagAndPush;
|
||||
module.exports.checkBaseChanges = checkBaseChanges;
|
||||
module.exports.getMainlineTag = getMainlineTag;
|
||||
|
4
.github/workflows/android-publish.yml
vendored
4
.github/workflows/android-publish.yml
vendored
@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2023 yuzu Emulator Project
|
||||
# SPDX-FileCopyrightText: 2024 yuzu Emulator Project
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
name: yuzu-android-publish
|
||||
@ -33,7 +33,7 @@ jobs:
|
||||
script: |
|
||||
if (context.payload.inputs && context.payload.inputs.android === 'true') return true;
|
||||
const checkAndroidChanges = require('./.github/workflows/android-merge.js').checkAndroidChanges;
|
||||
return checkAndroidChanges(github, context);
|
||||
return checkAndroidChanges(github);
|
||||
- run: npm install execa@5
|
||||
if: ${{ steps.check-changes.outputs.result == 'true' }}
|
||||
- uses: actions/checkout@v3
|
||||
|
15
.github/workflows/verify.yml
vendored
15
.github/workflows/verify.yml
vendored
@ -13,13 +13,15 @@ jobs:
|
||||
format:
|
||||
name: 'verify format'
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: yuzuemu/build-environments:linux-clang-format
|
||||
options: -u 1001
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: false
|
||||
- name: set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
- name: 'Verify Formatting'
|
||||
run: bash -ex ./.ci/scripts/format/script.sh
|
||||
build:
|
||||
@ -71,7 +73,7 @@ jobs:
|
||||
build-mac:
|
||||
name: 'test build (macos)'
|
||||
needs: format
|
||||
runs-on: macos-13
|
||||
runs-on: macos-14
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
@ -79,13 +81,12 @@ jobs:
|
||||
fetch-depth: 0
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
# workaround for https://github.com/actions/setup-python/issues/577
|
||||
brew install autoconf automake boost@1.83 ccache ffmpeg fmt glslang hidapi libtool libusb lz4 ninja nlohmann-json openssl pkg-config qt@5 sdl2 speexdsp zlib zlib zstd || brew link --overwrite python@3.12
|
||||
brew install autoconf automake boost ccache ffmpeg fmt glslang hidapi libtool libusb lz4 ninja nlohmann-json openssl pkg-config qt@5 sdl2 speexdsp zlib zlib zstd
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
export Qt5_DIR="/usr/local/opt/qt@5/lib/cmake"
|
||||
export Qt5_DIR="$(brew --prefix qt@5)/lib/cmake"
|
||||
cmake .. -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DYUZU_USE_BUNDLED_VCPKG=OFF -DYUZU_TESTS=OFF -DENABLE_WEB_SERVICE=OFF -DENABLE_LIBUSB=OFF
|
||||
ninja
|
||||
build-msvc:
|
||||
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -64,3 +64,6 @@
|
||||
[submodule "oaknut"]
|
||||
path = externals/oaknut
|
||||
url = https://github.com/merryhime/oaknut
|
||||
[submodule "Vulkan-Utility-Libraries"]
|
||||
path = externals/Vulkan-Utility-Libraries
|
||||
url = https://github.com/KhronosGroup/Vulkan-Utility-Libraries.git
|
||||
|
@ -155,3 +155,7 @@ License: MIT
|
||||
Files: externals/gamemode/*
|
||||
Copyright: Copyright 2017-2019 Feral Interactive
|
||||
License: BSD-3-Clause
|
||||
|
||||
Files: src/android/app/debug.keystore
|
||||
Copyright: 2023 yuzu Emulator Project
|
||||
License: GPL-3.0-or-later
|
||||
|
@ -36,6 +36,8 @@ option(YUZU_USE_BUNDLED_FFMPEG "Download/Build bundled FFmpeg" "${WIN32}")
|
||||
|
||||
option(YUZU_USE_EXTERNAL_VULKAN_HEADERS "Use Vulkan-Headers from externals" ON)
|
||||
|
||||
option(YUZU_USE_EXTERNAL_VULKAN_UTILITY_LIBRARIES "Use Vulkan-Utility-Libraries from externals" ON)
|
||||
|
||||
option(YUZU_USE_QT_MULTIMEDIA "Use QtMultimedia for Camera" OFF)
|
||||
|
||||
option(YUZU_USE_QT_WEB_ENGINE "Use QtWebEngine for web applet implementation" OFF)
|
||||
@ -305,7 +307,11 @@ find_package(ZLIB 1.2 REQUIRED)
|
||||
find_package(zstd 1.5 REQUIRED)
|
||||
|
||||
if (NOT YUZU_USE_EXTERNAL_VULKAN_HEADERS)
|
||||
find_package(Vulkan 1.3.274 REQUIRED)
|
||||
find_package(VulkanHeaders 1.3.274 REQUIRED)
|
||||
endif()
|
||||
|
||||
if (NOT YUZU_USE_EXTERNAL_VULKAN_UTILITY_LIBRARIES)
|
||||
find_package(VulkanUtilityLibraries REQUIRED)
|
||||
endif()
|
||||
|
||||
if (ENABLE_LIBUSB)
|
||||
@ -316,6 +322,10 @@ if (ARCHITECTURE_x86 OR ARCHITECTURE_x86_64)
|
||||
find_package(xbyak 6 CONFIG)
|
||||
endif()
|
||||
|
||||
if (ARCHITECTURE_arm64)
|
||||
find_package(oaknut 2.0.1 CONFIG)
|
||||
endif()
|
||||
|
||||
if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64)
|
||||
find_package(dynarmic 6.4.0 CONFIG)
|
||||
endif()
|
||||
|
@ -2,18 +2,20 @@
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
find_path(SimpleIni_INCLUDE_DIR SimpleIni.h)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(SimpleIni
|
||||
REQUIRED_VARS SimpleIni_INCLUDE_DIR
|
||||
)
|
||||
|
||||
if (SimpleIni_FOUND AND NOT TARGET SimpleIni::SimpleIni)
|
||||
add_library(SimpleIni::SimpleIni INTERFACE IMPORTED)
|
||||
set_target_properties(SimpleIni::SimpleIni PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SimpleIni_INCLUDE_DIR}"
|
||||
find_package(SimpleIni QUIET CONFIG)
|
||||
if (SimpleIni_CONSIDERED_CONFIGS)
|
||||
find_package_handle_standard_args(SimpleIni CONFIG_MODE)
|
||||
else()
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_search_module(SIMPLEINI QUIET IMPORTED_TARGET simpleini)
|
||||
find_package_handle_standard_args(SimpleIni
|
||||
REQUIRED_VARS SIMPLEINI_INCLUDEDIR
|
||||
VERSION_VAR SIMPLEINI_VERSION
|
||||
)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(SimpleIni_INCLUDE_DIR)
|
||||
if (SimpleIni_FOUND AND NOT TARGET SimpleIni::SimpleIni)
|
||||
add_library(SimpleIni::SimpleIni ALIAS PkgConfig::SIMPLEINI)
|
||||
endif()
|
||||
|
@ -1,4 +1,4 @@
|
||||
Copyright (c) <year> <owner>
|
||||
Copyright (c) <year> <owner>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
Copyright (c) <year> <owner>.
|
||||
Copyright (c) <year> <owner>.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
|
@ -35,7 +35,7 @@ Mozilla Public License Version 2.0
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
|
12
README.md
12
README.md
@ -1,3 +1,15 @@
|
||||
| Pull Request | Commit | Title | Author | Merged? |
|
||||
|----|----|----|----|----|
|
||||
| [12461](https://github.com/yuzu-emu/yuzu//pull/12461) | [`7464cae24`](https://github.com/yuzu-emu/yuzu//pull/12461/files) | Rework Nvdec and VIC to fix out-of-order videos, and speed up decoding. | [Kelebek1](https://github.com/Kelebek1/) | Yes |
|
||||
| [13018](https://github.com/yuzu-emu/yuzu//pull/13018) | [`01cbc638a`](https://github.com/yuzu-emu/yuzu//pull/13018/files) | am: rewrite part 2 | [liamwhite](https://github.com/liamwhite/) | Yes |
|
||||
| [13174](https://github.com/yuzu-emu/yuzu//pull/13174) | [`7d1284826`](https://github.com/yuzu-emu/yuzu//pull/13174/files) | glue/time: Remove global variables | [FearlessTobi](https://github.com/FearlessTobi/) | Yes |
|
||||
| [13177](https://github.com/yuzu-emu/yuzu//pull/13177) | [`f5cc94f05`](https://github.com/yuzu-emu/yuzu//pull/13177/files) | vfs: misc performance improvements | [liamwhite](https://github.com/liamwhite/) | Yes |
|
||||
|
||||
|
||||
End of merge log. You can find the original README.md below the break.
|
||||
|
||||
-----
|
||||
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2018 yuzu Emulator Project
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
1
dist/languages/.tx/config
vendored
1
dist/languages/.tx/config
vendored
@ -11,3 +11,4 @@ type = QT
|
||||
file_filter = ../../src/android/app/src/main/res/values-<lang>/strings.xml
|
||||
source_file = ../../src/android/app/src/main/res/values/strings.xml
|
||||
type = ANDROID
|
||||
lang_map = ja_JP:ja, ko_KR:ko, pt_BR:pt-rBR, pt_PT:pt-rPT, ru_RU:ru, vi_VN:vi, zh_CN:zh-rCN, zh_TW:zh-rTW
|
||||
|
2295
dist/languages/ar.ts
vendored
2295
dist/languages/ar.ts
vendored
File diff suppressed because it is too large
Load Diff
2269
dist/languages/ca.ts
vendored
2269
dist/languages/ca.ts
vendored
File diff suppressed because it is too large
Load Diff
2530
dist/languages/cs.ts
vendored
2530
dist/languages/cs.ts
vendored
File diff suppressed because it is too large
Load Diff
2347
dist/languages/da.ts
vendored
2347
dist/languages/da.ts
vendored
File diff suppressed because it is too large
Load Diff
1982
dist/languages/de.ts
vendored
1982
dist/languages/de.ts
vendored
File diff suppressed because it is too large
Load Diff
2239
dist/languages/el.ts
vendored
2239
dist/languages/el.ts
vendored
File diff suppressed because it is too large
Load Diff
2063
dist/languages/es.ts
vendored
2063
dist/languages/es.ts
vendored
File diff suppressed because it is too large
Load Diff
10
dist/languages/fi.ts
vendored
10
dist/languages/fi.ts
vendored
@ -4684,10 +4684,10 @@ Please, only use this feature to install updates and DLC.</source>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/yuzu/main.cpp" line="3386"/>
|
||||
<source>You are about to force rederive all of your keys.
|
||||
If you do not know what this means or what you are doing,
|
||||
this is a potentially destructive action.
|
||||
Please make sure this is what you want
|
||||
<source>You are about to force rederive all of your keys.
|
||||
If you do not know what this means or what you are doing,
|
||||
this is a potentially destructive action.
|
||||
Please make sure this is what you want
|
||||
and optionally make backups.
|
||||
|
||||
This will delete your autogenerated key files and re-run the key derivation module.</source>
|
||||
@ -4731,7 +4731,7 @@ Tämä poistaa automaattisesti generoidut avaimet ja ajaa avainten laskentamoduu
|
||||
<message>
|
||||
<location filename="../../src/yuzu/main.cpp" line="3441"/>
|
||||
<source>Deriving keys...
|
||||
This may take up to a minute depending
|
||||
This may take up to a minute depending
|
||||
on your system's performance.</source>
|
||||
<translation>Johdetaan avaimia...
|
||||
Tähän voi kulua jonkin aikaa
|
||||
|
1945
dist/languages/fr.ts
vendored
1945
dist/languages/fr.ts
vendored
File diff suppressed because it is too large
Load Diff
2246
dist/languages/hu.ts
vendored
2246
dist/languages/hu.ts
vendored
File diff suppressed because it is too large
Load Diff
2378
dist/languages/id.ts
vendored
2378
dist/languages/id.ts
vendored
File diff suppressed because it is too large
Load Diff
1925
dist/languages/it.ts
vendored
1925
dist/languages/it.ts
vendored
File diff suppressed because it is too large
Load Diff
2217
dist/languages/ja_JP.ts
vendored
2217
dist/languages/ja_JP.ts
vendored
File diff suppressed because it is too large
Load Diff
1995
dist/languages/ko_KR.ts
vendored
1995
dist/languages/ko_KR.ts
vendored
File diff suppressed because it is too large
Load Diff
1993
dist/languages/nb.ts
vendored
1993
dist/languages/nb.ts
vendored
File diff suppressed because it is too large
Load Diff
1993
dist/languages/nl.ts
vendored
1993
dist/languages/nl.ts
vendored
File diff suppressed because it is too large
Load Diff
2177
dist/languages/pl.ts
vendored
2177
dist/languages/pl.ts
vendored
File diff suppressed because it is too large
Load Diff
2374
dist/languages/pt_BR.ts
vendored
2374
dist/languages/pt_BR.ts
vendored
File diff suppressed because it is too large
Load Diff
2002
dist/languages/pt_PT.ts
vendored
2002
dist/languages/pt_PT.ts
vendored
File diff suppressed because it is too large
Load Diff
2068
dist/languages/ru_RU.ts
vendored
2068
dist/languages/ru_RU.ts
vendored
File diff suppressed because it is too large
Load Diff
2505
dist/languages/sv.ts
vendored
2505
dist/languages/sv.ts
vendored
File diff suppressed because it is too large
Load Diff
2221
dist/languages/tr_TR.ts
vendored
2221
dist/languages/tr_TR.ts
vendored
File diff suppressed because it is too large
Load Diff
1993
dist/languages/uk.ts
vendored
1993
dist/languages/uk.ts
vendored
File diff suppressed because it is too large
Load Diff
1993
dist/languages/vi.ts
vendored
1993
dist/languages/vi.ts
vendored
File diff suppressed because it is too large
Load Diff
1993
dist/languages/vi_VN.ts
vendored
1993
dist/languages/vi_VN.ts
vendored
File diff suppressed because it is too large
Load Diff
1945
dist/languages/zh_CN.ts
vendored
1945
dist/languages/zh_CN.ts
vendored
File diff suppressed because it is too large
Load Diff
1910
dist/languages/zh_TW.ts
vendored
1910
dist/languages/zh_TW.ts
vendored
File diff suppressed because it is too large
Load Diff
20
externals/CMakeLists.txt
vendored
20
externals/CMakeLists.txt
vendored
@ -14,16 +14,17 @@ set(BUILD_SHARED_LIBS OFF)
|
||||
# Skip install rules for all externals
|
||||
set_directory_properties(PROPERTIES EXCLUDE_FROM_ALL ON)
|
||||
|
||||
# xbyak
|
||||
# Xbyak (also used by Dynarmic, so needs to be added first)
|
||||
if ((ARCHITECTURE_x86 OR ARCHITECTURE_x86_64) AND NOT TARGET xbyak::xbyak)
|
||||
add_subdirectory(xbyak)
|
||||
endif()
|
||||
|
||||
# Dynarmic
|
||||
# Oaknut (also used by Dynarmic, so needs to be added first)
|
||||
if (ARCHITECTURE_arm64 AND NOT TARGET merry::oaknut)
|
||||
add_subdirectory(oaknut)
|
||||
endif()
|
||||
|
||||
# Dynarmic
|
||||
if ((ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64) AND NOT TARGET dynarmic::dynarmic)
|
||||
set(DYNARMIC_IGNORE_ASSERTS ON)
|
||||
add_subdirectory(dynarmic)
|
||||
@ -154,6 +155,11 @@ if (YUZU_USE_EXTERNAL_VULKAN_HEADERS)
|
||||
add_subdirectory(Vulkan-Headers)
|
||||
endif()
|
||||
|
||||
# Vulkan-Utility-Libraries
|
||||
if (YUZU_USE_EXTERNAL_VULKAN_UTILITY_LIBRARIES)
|
||||
add_subdirectory(Vulkan-Utility-Libraries)
|
||||
endif()
|
||||
|
||||
# TZDB (Time Zone Database)
|
||||
add_subdirectory(nx_tzdb)
|
||||
|
||||
@ -178,6 +184,9 @@ if (NOT TARGET stb::headers)
|
||||
add_library(stb::headers ALIAS stb)
|
||||
endif()
|
||||
|
||||
add_library(tz tz/tz/tz.cpp)
|
||||
target_include_directories(tz PUBLIC ./tz)
|
||||
|
||||
add_library(bc_decoder bc_decoder/bc_decoder.cpp)
|
||||
target_include_directories(bc_decoder PUBLIC ./bc_decoder)
|
||||
|
||||
@ -305,3 +314,10 @@ endif()
|
||||
if (NOT TARGET SimpleIni::SimpleIni)
|
||||
add_subdirectory(simpleini)
|
||||
endif()
|
||||
|
||||
# sse2neon
|
||||
if (ARCHITECTURE_arm64 AND NOT TARGET sse2neon)
|
||||
add_library(sse2neon INTERFACE)
|
||||
target_include_directories(sse2neon INTERFACE sse2neon)
|
||||
endif()
|
||||
|
||||
|
1
externals/Vulkan-Utility-Libraries
vendored
Submodule
1
externals/Vulkan-Utility-Libraries
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 524f8910d0e4a5f2ec5961996b23e5b74b95cb1d
|
2
externals/dynarmic
vendored
2
externals/dynarmic
vendored
@ -1 +1 @@
|
||||
Subproject commit 0df09e2f6b61c2d7ad2f2053d4f020a5c33e0378
|
||||
Subproject commit ba8192d89078af51ae6f97c9352e3683612cdff1
|
2
externals/ffmpeg/CMakeLists.txt
vendored
2
externals/ffmpeg/CMakeLists.txt
vendored
@ -138,7 +138,7 @@ if (NOT WIN32 AND NOT ANDROID)
|
||||
--cross-prefix=${TOOLCHAIN}/bin/aarch64-linux-android-
|
||||
--sysroot=${SYSROOT}
|
||||
--target-os=android
|
||||
--extra-ldflags="--ld-path=${TOOLCHAIN}/bin/ld.lld"
|
||||
--extra-ldflags="--ld-path=${TOOLCHAIN}/bin/ld.lld"
|
||||
--extra-ldflags="-nostdlib"
|
||||
)
|
||||
endif()
|
||||
|
2
externals/nx_tzdb/CMakeLists.txt
vendored
2
externals/nx_tzdb/CMakeLists.txt
vendored
@ -32,7 +32,7 @@ set(NX_TZDB_ARCHIVE "${CMAKE_CURRENT_BINARY_DIR}/${NX_TZDB_VERSION}.zip")
|
||||
|
||||
set(NX_TZDB_ROMFS_DIR "${CMAKE_CURRENT_BINARY_DIR}/nx_tzdb")
|
||||
|
||||
if ((NOT CAN_BUILD_NX_TZDB OR YUZU_DOWNLOAD_TIME_ZONE_DATA) AND NOT EXISTS ${NX_TZDB_ARCHIVE})
|
||||
if ((NOT CAN_BUILD_NX_TZDB OR YUZU_DOWNLOAD_TIME_ZONE_DATA) AND NOT EXISTS ${NX_TZDB_ROMFS_DIR})
|
||||
set(NX_TZDB_DOWNLOAD_URL "https://github.com/lat9nq/tzdb_to_nx/releases/download/${NX_TZDB_VERSION}/${NX_TZDB_VERSION}.zip")
|
||||
|
||||
message(STATUS "Downloading time zone data from ${NX_TZDB_DOWNLOAD_URL}...")
|
||||
|
4
externals/nx_tzdb/NxTzdbCreateHeader.cmake
vendored
4
externals/nx_tzdb/NxTzdbCreateHeader.cmake
vendored
@ -11,6 +11,10 @@ execute_process(
|
||||
WORKING_DIRECTORY ${ZONE_PATH}
|
||||
OUTPUT_VARIABLE FILE_LIST)
|
||||
|
||||
if (NOT FILE_LIST)
|
||||
message(FATAL_ERROR "No timezone files found in directory ${ZONE_PATH}, did the download fail?")
|
||||
endif()
|
||||
|
||||
set(DIRECTORY_NAME ${HEADER_NAME})
|
||||
|
||||
set(FILE_DATA "")
|
||||
|
2
externals/nx_tzdb/tzdb_to_nx
vendored
2
externals/nx_tzdb/tzdb_to_nx
vendored
@ -1 +1 @@
|
||||
Subproject commit f6680093bca30265c161581fd813d4ddd33f1e3e
|
||||
Subproject commit 97929690234f2b4add36b33657fe3fe09bd57dfd
|
2
externals/oaknut
vendored
2
externals/oaknut
vendored
@ -1 +1 @@
|
||||
Subproject commit 918bd94f025d6a2de13978468351598997ae3909
|
||||
Subproject commit 9d091109deb445bc6e9289c6195a282b7c993d49
|
9282
externals/sse2neon/sse2neon.h
vendored
Normal file
9282
externals/sse2neon/sse2neon.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1636
externals/tz/tz/tz.cpp
vendored
Normal file
1636
externals/tz/tz/tz.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
81
externals/tz/tz/tz.h
vendored
Normal file
81
externals/tz/tz/tz.h
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
// SPDX-FileCopyrightText: 2023 yuzu Emulator Project
|
||||
// SPDX-FileCopyrightText: 1996 Arthur David Olson
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
#include <span>
|
||||
#include <array>
|
||||
#include <time.h>
|
||||
|
||||
namespace Tz {
|
||||
using u8 = uint8_t;
|
||||
using s8 = int8_t;
|
||||
using u16 = uint16_t;
|
||||
using s16 = int16_t;
|
||||
using u32 = uint32_t;
|
||||
using s32 = int32_t;
|
||||
using u64 = uint64_t;
|
||||
using s64 = int64_t;
|
||||
|
||||
constexpr size_t TZ_MAX_TIMES = 1000;
|
||||
constexpr size_t TZ_MAX_TYPES = 128;
|
||||
constexpr size_t TZ_MAX_CHARS = 50;
|
||||
constexpr size_t MY_TZNAME_MAX = 255;
|
||||
constexpr size_t TZNAME_MAXIMUM = 255;
|
||||
constexpr size_t TZ_MAX_LEAPS = 50;
|
||||
constexpr s64 TIME_T_MAX = std::numeric_limits<s64>::max();
|
||||
constexpr s64 TIME_T_MIN = std::numeric_limits<s64>::min();
|
||||
constexpr size_t CHARS_EXTRA = 3;
|
||||
constexpr size_t MAX_ZONE_CHARS = std::max(TZ_MAX_CHARS + CHARS_EXTRA, sizeof("UTC"));
|
||||
constexpr size_t MAX_TZNAME_CHARS = 2 * (MY_TZNAME_MAX + 1);
|
||||
|
||||
struct ttinfo {
|
||||
s32 tt_utoff;
|
||||
bool tt_isdst;
|
||||
s32 tt_desigidx;
|
||||
bool tt_ttisstd;
|
||||
bool tt_ttisut;
|
||||
};
|
||||
static_assert(sizeof(ttinfo) == 0x10, "ttinfo has the wrong size!");
|
||||
|
||||
struct Rule {
|
||||
s32 timecnt;
|
||||
s32 typecnt;
|
||||
s32 charcnt;
|
||||
bool goback;
|
||||
bool goahead;
|
||||
std::array <u8, 0x2> padding0;
|
||||
std::array<s64, TZ_MAX_TIMES> ats;
|
||||
std::array<u8, TZ_MAX_TIMES> types;
|
||||
std::array<ttinfo, TZ_MAX_TYPES> ttis;
|
||||
std::array<char, std::max(MAX_ZONE_CHARS, MAX_TZNAME_CHARS)> chars;
|
||||
s32 defaulttype;
|
||||
std::array <u8, 0x12C4> padding1;
|
||||
};
|
||||
static_assert(sizeof(Rule) == 0x4000, "Rule has the wrong size!");
|
||||
|
||||
struct CalendarTimeInternal {
|
||||
s32 tm_sec;
|
||||
s32 tm_min;
|
||||
s32 tm_hour;
|
||||
s32 tm_mday;
|
||||
s32 tm_mon;
|
||||
s32 tm_year;
|
||||
s32 tm_wday;
|
||||
s32 tm_yday;
|
||||
s32 tm_isdst;
|
||||
std::array<char, 16> tm_zone;
|
||||
s32 tm_utoff;
|
||||
s32 time_index;
|
||||
};
|
||||
static_assert(sizeof(CalendarTimeInternal) == 0x3C, "CalendarTimeInternal has the wrong size!");
|
||||
|
||||
s32 ParseTimeZoneBinary(Rule& out_rule, std::span<const u8> binary);
|
||||
|
||||
bool localtime_rz(CalendarTimeInternal* tmp, Rule const* sp, time_t* timep);
|
||||
u32 mktime_tzname(time_t* out_time, Rule const* sp, CalendarTimeInternal* tmp);
|
||||
|
||||
} // namespace Tz
|
@ -121,6 +121,7 @@ else()
|
||||
-Wno-attributes
|
||||
-Wno-invalid-offsetof
|
||||
-Wno-unused-parameter
|
||||
-Wno-missing-field-initializers
|
||||
)
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES Clang) # Clang or AppleClang
|
||||
@ -164,6 +165,7 @@ else()
|
||||
|
||||
if (MINGW)
|
||||
add_definitions(-DMINGW_HAS_SECURE_API)
|
||||
add_compile_options("-msse4.1")
|
||||
|
||||
if (MINGW_STATIC_BUILD)
|
||||
add_definitions(-DQT_STATICPLUGIN)
|
||||
@ -185,6 +187,7 @@ add_subdirectory(common)
|
||||
add_subdirectory(core)
|
||||
add_subdirectory(audio_core)
|
||||
add_subdirectory(video_core)
|
||||
add_subdirectory(hid_core)
|
||||
add_subdirectory(network)
|
||||
add_subdirectory(input_common)
|
||||
add_subdirectory(frontend_common)
|
||||
|
@ -3,16 +3,17 @@
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import kotlin.collections.setOf
|
||||
import org.jetbrains.kotlin.konan.properties.Properties
|
||||
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType
|
||||
import com.github.triplet.gradle.androidpublisher.ReleaseStatus
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
id("kotlin-parcelize")
|
||||
kotlin("plugin.serialization") version "1.8.21"
|
||||
kotlin("plugin.serialization") version "1.9.20"
|
||||
id("androidx.navigation.safeargs.kotlin")
|
||||
id("org.jlleitschuh.gradle.ktlint") version "11.4.0"
|
||||
id("com.github.triplet.play") version "3.8.6"
|
||||
}
|
||||
|
||||
/**
|
||||
@ -58,15 +59,7 @@ android {
|
||||
targetSdk = 34
|
||||
versionName = getGitVersion()
|
||||
|
||||
// If you want to use autoVersion for the versionCode, create a property in local.properties
|
||||
// named "autoVersioned" and set it to "true"
|
||||
val properties = Properties()
|
||||
val versionProperty = try {
|
||||
properties.load(project.rootProject.file("local.properties").inputStream())
|
||||
properties.getProperty("autoVersioned") ?: ""
|
||||
} catch (e: Exception) { "" }
|
||||
|
||||
versionCode = if (versionProperty == "true") {
|
||||
versionCode = if (System.getenv("AUTO_VERSIONED") == "true") {
|
||||
autoVersion
|
||||
} else {
|
||||
1
|
||||
@ -82,8 +75,8 @@ android {
|
||||
}
|
||||
|
||||
val keystoreFile = System.getenv("ANDROID_KEYSTORE_FILE")
|
||||
if (keystoreFile != null) {
|
||||
signingConfigs {
|
||||
signingConfigs {
|
||||
if (keystoreFile != null) {
|
||||
create("release") {
|
||||
storeFile = file(keystoreFile)
|
||||
storePassword = System.getenv("ANDROID_KEYSTORE_PASS")
|
||||
@ -91,6 +84,12 @@ android {
|
||||
keyPassword = System.getenv("ANDROID_KEYSTORE_PASS")
|
||||
}
|
||||
}
|
||||
create("default") {
|
||||
storeFile = file("$projectDir/debug.keystore")
|
||||
storePassword = "android"
|
||||
keyAlias = "androiddebugkey"
|
||||
keyPassword = "android"
|
||||
}
|
||||
}
|
||||
|
||||
// Define build types, which are orthogonal to product flavors.
|
||||
@ -101,7 +100,7 @@ android {
|
||||
signingConfig = if (keystoreFile != null) {
|
||||
signingConfigs.getByName("release")
|
||||
} else {
|
||||
signingConfigs.getByName("debug")
|
||||
signingConfigs.getByName("default")
|
||||
}
|
||||
|
||||
resValue("string", "app_name_suffixed", "yuzu")
|
||||
@ -118,7 +117,7 @@ android {
|
||||
register("relWithDebInfo") {
|
||||
isDefault = true
|
||||
resValue("string", "app_name_suffixed", "yuzu Debug Release")
|
||||
signingConfig = signingConfigs.getByName("debug")
|
||||
signingConfig = signingConfigs.getByName("default")
|
||||
isMinifyEnabled = true
|
||||
isDebuggable = true
|
||||
proguardFiles(
|
||||
@ -133,6 +132,7 @@ android {
|
||||
// Signed by debug key disallowing distribution on Play Store.
|
||||
// Attaches 'debug' suffix to version and package name, allowing installation alongside the release build.
|
||||
debug {
|
||||
signingConfig = signingConfigs.getByName("default")
|
||||
resValue("string", "app_name_suffixed", "yuzu Debug")
|
||||
isDebuggable = true
|
||||
isJniDebuggable = true
|
||||
@ -188,8 +188,15 @@ tasks.create<Delete>("ktlintReset") {
|
||||
delete(File(buildDir.path + File.separator + "intermediates/ktLint"))
|
||||
}
|
||||
|
||||
val showFormatHelp = {
|
||||
logger.lifecycle(
|
||||
"If this check fails, please try running \"gradlew ktlintFormat\" for automatic " +
|
||||
"codestyle fixes"
|
||||
)
|
||||
}
|
||||
tasks.getByPath("ktlintKotlinScriptCheck").doFirst { showFormatHelp.invoke() }
|
||||
tasks.getByPath("ktlintMainSourceSetCheck").doFirst { showFormatHelp.invoke() }
|
||||
tasks.getByPath("loadKtlintReporters").dependsOn("ktlintReset")
|
||||
tasks.getByPath("preBuild").dependsOn("ktlintCheck")
|
||||
|
||||
ktlint {
|
||||
version.set("0.47.1")
|
||||
@ -207,6 +214,15 @@ ktlint {
|
||||
}
|
||||
}
|
||||
|
||||
play {
|
||||
val keyPath = System.getenv("SERVICE_ACCOUNT_KEY_PATH")
|
||||
if (keyPath != null) {
|
||||
serviceAccountCredentials.set(File(keyPath))
|
||||
}
|
||||
track.set(System.getenv("STORE_TRACK") ?: "internal")
|
||||
releaseStatus.set(ReleaseStatus.COMPLETED)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("androidx.core:core-ktx:1.12.0")
|
||||
implementation("androidx.appcompat:appcompat:1.6.1")
|
||||
@ -228,71 +244,39 @@ dependencies {
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0")
|
||||
}
|
||||
|
||||
fun getGitVersion(): String {
|
||||
var versionName = "0.0"
|
||||
|
||||
try {
|
||||
versionName = ProcessBuilder("git", "describe", "--always", "--long")
|
||||
fun runGitCommand(command: List<String>): String {
|
||||
return try {
|
||||
ProcessBuilder(command)
|
||||
.directory(project.rootDir)
|
||||
.redirectOutput(ProcessBuilder.Redirect.PIPE)
|
||||
.redirectError(ProcessBuilder.Redirect.PIPE)
|
||||
.start().inputStream.bufferedReader().use { it.readText() }
|
||||
.trim()
|
||||
.replace(Regex("(-0)?-[^-]+$"), "")
|
||||
} catch (e: Exception) {
|
||||
logger.error("Cannot find git, defaulting to dummy version number")
|
||||
}
|
||||
|
||||
if (System.getenv("GITHUB_ACTIONS") != null) {
|
||||
val gitTag = System.getenv("GIT_TAG_NAME")
|
||||
versionName = gitTag ?: versionName
|
||||
}
|
||||
|
||||
return versionName
|
||||
}
|
||||
|
||||
fun getGitHash(): String {
|
||||
try {
|
||||
val processBuilder = ProcessBuilder("git", "rev-parse", "--short", "HEAD")
|
||||
processBuilder.directory(project.rootDir)
|
||||
val process = processBuilder.start()
|
||||
val inputStream = process.inputStream
|
||||
val errorStream = process.errorStream
|
||||
process.waitFor()
|
||||
|
||||
return if (process.exitValue() == 0) {
|
||||
inputStream.bufferedReader()
|
||||
.use { it.readText().trim() } // return the value of gitHash
|
||||
} else {
|
||||
val errorMessage = errorStream.bufferedReader().use { it.readText().trim() }
|
||||
logger.error("Error running git command: $errorMessage")
|
||||
"dummy-hash" // return a dummy hash value in case of an error
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
logger.error("$e: Cannot find git, defaulting to dummy build hash")
|
||||
return "dummy-hash" // return a dummy hash value in case of an error
|
||||
logger.error("Cannot find git")
|
||||
""
|
||||
}
|
||||
}
|
||||
|
||||
fun getBranch(): String {
|
||||
try {
|
||||
val processBuilder = ProcessBuilder("git", "rev-parse", "--abbrev-ref", "HEAD")
|
||||
processBuilder.directory(project.rootDir)
|
||||
val process = processBuilder.start()
|
||||
val inputStream = process.inputStream
|
||||
val errorStream = process.errorStream
|
||||
process.waitFor()
|
||||
|
||||
return if (process.exitValue() == 0) {
|
||||
inputStream.bufferedReader()
|
||||
.use { it.readText().trim() } // return the value of gitHash
|
||||
} else {
|
||||
val errorMessage = errorStream.bufferedReader().use { it.readText().trim() }
|
||||
logger.error("Error running git command: $errorMessage")
|
||||
"dummy-hash" // return a dummy hash value in case of an error
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
logger.error("$e: Cannot find git, defaulting to dummy build hash")
|
||||
return "dummy-hash" // return a dummy hash value in case of an error
|
||||
fun getGitVersion(): String {
|
||||
val gitVersion = runGitCommand(
|
||||
listOf(
|
||||
"git",
|
||||
"describe",
|
||||
"--always",
|
||||
"--long"
|
||||
)
|
||||
).replace(Regex("(-0)?-[^-]+$"), "")
|
||||
val versionName = if (System.getenv("GITHUB_ACTIONS") != null) {
|
||||
System.getenv("GIT_TAG_NAME") ?: gitVersion
|
||||
} else {
|
||||
gitVersion
|
||||
}
|
||||
return versionName.ifEmpty { "0.0" }
|
||||
}
|
||||
|
||||
fun getGitHash(): String =
|
||||
runGitCommand(listOf("git", "rev-parse", "--short", "HEAD")).ifEmpty { "dummy-hash" }
|
||||
|
||||
fun getBranch(): String =
|
||||
runGitCommand(listOf("git", "rev-parse", "--abbrev-ref", "HEAD")).ifEmpty { "dummy-hash" }
|
||||
|
BIN
src/android/app/debug.keystore
Normal file
BIN
src/android/app/debug.keystore
Normal file
Binary file not shown.
@ -12,10 +12,9 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
<uses-feature android:name="android.hardware.vulkan.version" android:version="0x401000" android:required="true" />
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
|
||||
<uses-permission android:name="android.permission.NFC" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
|
||||
<application
|
||||
android:name="org.yuzu.yuzu_emu.YuzuApplication"
|
||||
@ -31,6 +30,9 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
android:dataExtractionRules="@xml/data_extraction_rules_api_31"
|
||||
android:enableOnBackInvokedCallback="true">
|
||||
|
||||
<meta-data android:name="android.game_mode_config"
|
||||
android:resource="@xml/game_mode_config" />
|
||||
|
||||
<activity
|
||||
android:name="org.yuzu.yuzu_emu.ui.main.MainActivity"
|
||||
android:exported="true"
|
||||
@ -77,10 +79,6 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
android:resource="@xml/nfc_tech_filter" />
|
||||
</activity>
|
||||
|
||||
<service android:name="org.yuzu.yuzu_emu.utils.ForegroundService" android:foregroundServiceType="specialUse">
|
||||
<property android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE" android:value="Keep emulation running in background"/>
|
||||
</service>
|
||||
|
||||
<provider
|
||||
android:name=".features.DocumentProvider"
|
||||
android:authorities="${applicationId}.user"
|
||||
|
@ -3,58 +3,30 @@
|
||||
|
||||
package org.yuzu.yuzu_emu
|
||||
|
||||
import android.app.Dialog
|
||||
import android.content.DialogInterface
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.text.Html
|
||||
import android.text.method.LinkMovementMethod
|
||||
import android.view.Surface
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.Keep
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import java.lang.ref.WeakReference
|
||||
import org.yuzu.yuzu_emu.activities.EmulationActivity
|
||||
import org.yuzu.yuzu_emu.fragments.CoreErrorDialogFragment
|
||||
import org.yuzu.yuzu_emu.utils.DocumentsTree
|
||||
import org.yuzu.yuzu_emu.utils.FileUtil
|
||||
import org.yuzu.yuzu_emu.utils.Log
|
||||
import org.yuzu.yuzu_emu.utils.SerializableHelper.serializable
|
||||
import org.yuzu.yuzu_emu.model.InstallResult
|
||||
import org.yuzu.yuzu_emu.model.Patch
|
||||
import org.yuzu.yuzu_emu.model.GameVerificationResult
|
||||
|
||||
/**
|
||||
* Class which contains methods that interact
|
||||
* with the native side of the Yuzu code.
|
||||
*/
|
||||
object NativeLibrary {
|
||||
/**
|
||||
* Default controller id for each device
|
||||
*/
|
||||
const val Player1Device = 0
|
||||
const val Player2Device = 1
|
||||
const val Player3Device = 2
|
||||
const val Player4Device = 3
|
||||
const val Player5Device = 4
|
||||
const val Player6Device = 5
|
||||
const val Player7Device = 6
|
||||
const val Player8Device = 7
|
||||
const val ConsoleDevice = 8
|
||||
|
||||
/**
|
||||
* Controller type for each device
|
||||
*/
|
||||
const val ProController = 3
|
||||
const val Handheld = 4
|
||||
const val JoyconDual = 5
|
||||
const val JoyconLeft = 6
|
||||
const val JoyconRight = 7
|
||||
const val GameCube = 8
|
||||
const val Pokeball = 9
|
||||
const val NES = 10
|
||||
const val SNES = 11
|
||||
const val N64 = 12
|
||||
const val SegaGenesis = 13
|
||||
|
||||
@JvmField
|
||||
var sEmulationActivity = WeakReference<EmulationActivity?>(null)
|
||||
|
||||
@ -124,120 +96,17 @@ object NativeLibrary {
|
||||
FileUtil.getFilename(Uri.parse(path))
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if pro controller isn't available and handheld is
|
||||
*/
|
||||
external fun isHandheldOnly(): Boolean
|
||||
|
||||
/**
|
||||
* Changes controller type for a specific device.
|
||||
*
|
||||
* @param Device The input descriptor of the gamepad.
|
||||
* @param Type The NpadStyleIndex of the gamepad.
|
||||
*/
|
||||
external fun setDeviceType(Device: Int, Type: Int): Boolean
|
||||
|
||||
/**
|
||||
* Handles event when a gamepad is connected.
|
||||
*
|
||||
* @param Device The input descriptor of the gamepad.
|
||||
*/
|
||||
external fun onGamePadConnectEvent(Device: Int): Boolean
|
||||
|
||||
/**
|
||||
* Handles event when a gamepad is disconnected.
|
||||
*
|
||||
* @param Device The input descriptor of the gamepad.
|
||||
*/
|
||||
external fun onGamePadDisconnectEvent(Device: Int): Boolean
|
||||
|
||||
/**
|
||||
* Handles button press events for a gamepad.
|
||||
*
|
||||
* @param Device The input descriptor of the gamepad.
|
||||
* @param Button Key code identifying which button was pressed.
|
||||
* @param Action Mask identifying which action is happening (button pressed down, or button released).
|
||||
* @return If we handled the button press.
|
||||
*/
|
||||
external fun onGamePadButtonEvent(Device: Int, Button: Int, Action: Int): Boolean
|
||||
|
||||
/**
|
||||
* Handles joystick movement events.
|
||||
*
|
||||
* @param Device The device ID of the gamepad.
|
||||
* @param Axis The axis ID
|
||||
* @param x_axis The value of the x-axis represented by the given ID.
|
||||
* @param y_axis The value of the y-axis represented by the given ID.
|
||||
*/
|
||||
external fun onGamePadJoystickEvent(
|
||||
Device: Int,
|
||||
Axis: Int,
|
||||
x_axis: Float,
|
||||
y_axis: Float
|
||||
): Boolean
|
||||
|
||||
/**
|
||||
* Handles motion events.
|
||||
*
|
||||
* @param delta_timestamp The finger id corresponding to this event
|
||||
* @param gyro_x,gyro_y,gyro_z The value of the accelerometer sensor.
|
||||
* @param accel_x,accel_y,accel_z The value of the y-axis
|
||||
*/
|
||||
external fun onGamePadMotionEvent(
|
||||
Device: Int,
|
||||
delta_timestamp: Long,
|
||||
gyro_x: Float,
|
||||
gyro_y: Float,
|
||||
gyro_z: Float,
|
||||
accel_x: Float,
|
||||
accel_y: Float,
|
||||
accel_z: Float
|
||||
): Boolean
|
||||
|
||||
/**
|
||||
* Signals and load a nfc tag
|
||||
*
|
||||
* @param data Byte array containing all the data from a nfc tag
|
||||
*/
|
||||
external fun onReadNfcTag(data: ByteArray?): Boolean
|
||||
|
||||
/**
|
||||
* Removes current loaded nfc tag
|
||||
*/
|
||||
external fun onRemoveNfcTag(): Boolean
|
||||
|
||||
/**
|
||||
* Handles touch press events.
|
||||
*
|
||||
* @param finger_id The finger id corresponding to this event
|
||||
* @param x_axis The value of the x-axis.
|
||||
* @param y_axis The value of the y-axis.
|
||||
*/
|
||||
external fun onTouchPressed(finger_id: Int, x_axis: Float, y_axis: Float)
|
||||
|
||||
/**
|
||||
* Handles touch movement.
|
||||
*
|
||||
* @param x_axis The value of the instantaneous x-axis.
|
||||
* @param y_axis The value of the instantaneous y-axis.
|
||||
*/
|
||||
external fun onTouchMoved(finger_id: Int, x_axis: Float, y_axis: Float)
|
||||
|
||||
/**
|
||||
* Handles touch release events.
|
||||
*
|
||||
* @param finger_id The finger id corresponding to this event
|
||||
*/
|
||||
external fun onTouchReleased(finger_id: Int)
|
||||
|
||||
external fun setAppDirectory(directory: String)
|
||||
|
||||
/**
|
||||
* Installs a nsp or xci file to nand
|
||||
* @param filename String representation of file uri
|
||||
* @param extension Lowercase string representation of file extension without "."
|
||||
* @return int representation of [InstallResult]
|
||||
*/
|
||||
external fun installFileToNand(filename: String, extension: String): Int
|
||||
external fun installFileToNand(
|
||||
filename: String,
|
||||
callback: (max: Long, progress: Long) -> Boolean
|
||||
): Int
|
||||
|
||||
external fun doesUpdateMatchProgram(programId: String, updatePath: String): Boolean
|
||||
|
||||
@ -255,7 +124,7 @@ object NativeLibrary {
|
||||
/**
|
||||
* Begins emulation.
|
||||
*/
|
||||
external fun run(path: String?)
|
||||
external fun run(path: String?, programIndex: Int, frontendInitiated: Boolean)
|
||||
|
||||
// Surface Handling
|
||||
external fun surfaceChanged(surf: Surface?)
|
||||
@ -297,6 +166,11 @@ object NativeLibrary {
|
||||
*/
|
||||
external fun getCpuBackend(): String
|
||||
|
||||
/**
|
||||
* Returns the current GPU Driver.
|
||||
*/
|
||||
external fun getGpuDriver(): String
|
||||
|
||||
external fun applySettings()
|
||||
|
||||
external fun logSettings()
|
||||
@ -307,46 +181,13 @@ object NativeLibrary {
|
||||
ErrorUnknown
|
||||
}
|
||||
|
||||
private var coreErrorAlertResult = false
|
||||
private val coreErrorAlertLock = Object()
|
||||
|
||||
class CoreErrorDialogFragment : DialogFragment() {
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val title = requireArguments().serializable<String>("title")
|
||||
val message = requireArguments().serializable<String>("message")
|
||||
|
||||
return MaterialAlertDialogBuilder(requireActivity())
|
||||
.setTitle(title)
|
||||
.setMessage(message)
|
||||
.setPositiveButton(R.string.continue_button, null)
|
||||
.setNegativeButton(R.string.abort_button) { _: DialogInterface?, _: Int ->
|
||||
coreErrorAlertResult = false
|
||||
synchronized(coreErrorAlertLock) { coreErrorAlertLock.notify() }
|
||||
}
|
||||
.create()
|
||||
}
|
||||
|
||||
override fun onDismiss(dialog: DialogInterface) {
|
||||
coreErrorAlertResult = true
|
||||
synchronized(coreErrorAlertLock) { coreErrorAlertLock.notify() }
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun newInstance(title: String?, message: String?): CoreErrorDialogFragment {
|
||||
val frag = CoreErrorDialogFragment()
|
||||
val args = Bundle()
|
||||
args.putString("title", title)
|
||||
args.putString("message", message)
|
||||
frag.arguments = args
|
||||
return frag
|
||||
}
|
||||
}
|
||||
}
|
||||
var coreErrorAlertResult = false
|
||||
val coreErrorAlertLock = Object()
|
||||
|
||||
private fun onCoreErrorImpl(title: String, message: String) {
|
||||
val emulationActivity = sEmulationActivity.get()
|
||||
if (emulationActivity == null) {
|
||||
error("[NativeLibrary] EmulationActivity not present")
|
||||
Log.error("[NativeLibrary] EmulationActivity not present")
|
||||
return
|
||||
}
|
||||
|
||||
@ -362,7 +203,7 @@ object NativeLibrary {
|
||||
fun onCoreError(error: CoreError?, details: String): Boolean {
|
||||
val emulationActivity = sEmulationActivity.get()
|
||||
if (emulationActivity == null) {
|
||||
error("[NativeLibrary] EmulationActivity not present")
|
||||
Log.error("[NativeLibrary] EmulationActivity not present")
|
||||
return false
|
||||
}
|
||||
|
||||
@ -393,7 +234,7 @@ object NativeLibrary {
|
||||
}
|
||||
|
||||
// Show the AlertDialog on the main thread.
|
||||
emulationActivity.runOnUiThread(Runnable { onCoreErrorImpl(title, message) })
|
||||
emulationActivity.runOnUiThread { onCoreErrorImpl(title, message) }
|
||||
|
||||
// Wait for the lock to notify that it is complete.
|
||||
synchronized(coreErrorAlertLock) { coreErrorAlertLock.wait() }
|
||||
@ -478,6 +319,12 @@ object NativeLibrary {
|
||||
sEmulationActivity.get()!!.onEmulationStopped(status)
|
||||
}
|
||||
|
||||
@Keep
|
||||
@JvmStatic
|
||||
fun onProgramChanged(programIndex: Int) {
|
||||
sEmulationActivity.get()!!.onProgramChanged(programIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs the Yuzu version, Android version and, CPU.
|
||||
*/
|
||||
@ -535,9 +382,49 @@ object NativeLibrary {
|
||||
*
|
||||
* @param path Path to game file. Can be a [Uri].
|
||||
* @param programId String representation of a game's program ID
|
||||
* @return Array of pairs where the first value is the name of an addon and the second is the version
|
||||
* @return Array of available patches
|
||||
*/
|
||||
external fun getAddonsForFile(path: String, programId: String): Array<Pair<String, String>>?
|
||||
external fun getPatchesForFile(path: String, programId: String): Array<Patch>?
|
||||
|
||||
/**
|
||||
* Removes an update for a given [programId]
|
||||
* @param programId String representation of a game's program ID
|
||||
*/
|
||||
external fun removeUpdate(programId: String)
|
||||
|
||||
/**
|
||||
* Removes all DLC for a [programId]
|
||||
* @param programId String representation of a game's program ID
|
||||
*/
|
||||
external fun removeDLC(programId: String)
|
||||
|
||||
/**
|
||||
* Removes a mod installed for a given [programId]
|
||||
* @param programId String representation of a game's program ID
|
||||
* @param name The name of a mod as given by [getPatchesForFile]. This corresponds with the name
|
||||
* of the mod's directory in a game's load folder.
|
||||
*/
|
||||
external fun removeMod(programId: String, name: String)
|
||||
|
||||
/**
|
||||
* Verifies all installed content
|
||||
* @param callback UI callback for verification progress. Return true in the callback to cancel.
|
||||
* @return Array of content that failed verification. Successful if empty.
|
||||
*/
|
||||
external fun verifyInstalledContents(
|
||||
callback: (max: Long, progress: Long) -> Boolean
|
||||
): Array<String>
|
||||
|
||||
/**
|
||||
* Verifies the contents of a game
|
||||
* @param path String path to a game
|
||||
* @param callback UI callback for verification progress. Return true in the callback to cancel.
|
||||
* @return Int that is meant to be converted to a [GameVerificationResult]
|
||||
*/
|
||||
external fun verifyGameContents(
|
||||
path: String,
|
||||
callback: (max: Long, progress: Long) -> Boolean
|
||||
): Int
|
||||
|
||||
/**
|
||||
* Gets the save location for a specific game
|
||||
@ -547,6 +434,15 @@ object NativeLibrary {
|
||||
*/
|
||||
external fun getSavePath(programId: String): String
|
||||
|
||||
/**
|
||||
* Gets the root save directory for the default profile as either
|
||||
* /user/save/account/<user id raw string> or /user/save/000...000/<user id>
|
||||
*
|
||||
* @param future If true, returns the /user/save/account/... directory
|
||||
* @return Save data path that may not exist yet
|
||||
*/
|
||||
external fun getDefaultProfileSaveDataRoot(future: Boolean): String
|
||||
|
||||
/**
|
||||
* Adds a file to the manual filesystem provider in our EmulationSession instance
|
||||
* @param path Path to the file we're adding. Can be a string representation of a [Uri] or
|
||||
@ -560,55 +456,7 @@ object NativeLibrary {
|
||||
external fun clearFilesystemProvider()
|
||||
|
||||
/**
|
||||
* Button type for use in onTouchEvent
|
||||
* Checks if all necessary keys are present for decryption
|
||||
*/
|
||||
object ButtonType {
|
||||
const val BUTTON_A = 0
|
||||
const val BUTTON_B = 1
|
||||
const val BUTTON_X = 2
|
||||
const val BUTTON_Y = 3
|
||||
const val STICK_L = 4
|
||||
const val STICK_R = 5
|
||||
const val TRIGGER_L = 6
|
||||
const val TRIGGER_R = 7
|
||||
const val TRIGGER_ZL = 8
|
||||
const val TRIGGER_ZR = 9
|
||||
const val BUTTON_PLUS = 10
|
||||
const val BUTTON_MINUS = 11
|
||||
const val DPAD_LEFT = 12
|
||||
const val DPAD_UP = 13
|
||||
const val DPAD_RIGHT = 14
|
||||
const val DPAD_DOWN = 15
|
||||
const val BUTTON_SL = 16
|
||||
const val BUTTON_SR = 17
|
||||
const val BUTTON_HOME = 18
|
||||
const val BUTTON_CAPTURE = 19
|
||||
}
|
||||
|
||||
/**
|
||||
* Stick type for use in onTouchEvent
|
||||
*/
|
||||
object StickType {
|
||||
const val STICK_L = 0
|
||||
const val STICK_R = 1
|
||||
}
|
||||
|
||||
/**
|
||||
* Button states
|
||||
*/
|
||||
object ButtonState {
|
||||
const val RELEASED = 0
|
||||
const val PRESSED = 1
|
||||
}
|
||||
|
||||
/**
|
||||
* Result from installFileToNand
|
||||
*/
|
||||
object InstallFileToNandResult {
|
||||
const val Success = 0
|
||||
const val SuccessFileOverwritten = 1
|
||||
const val Error = 2
|
||||
const val ErrorBaseGame = 3
|
||||
const val ErrorFilenameExtension = 4
|
||||
}
|
||||
external fun areKeysPresent(): Boolean
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import android.app.Application
|
||||
import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
import android.content.Context
|
||||
import org.yuzu.yuzu_emu.features.input.NativeInput
|
||||
import java.io.File
|
||||
import org.yuzu.yuzu_emu.utils.DirectoryInitialization
|
||||
import org.yuzu.yuzu_emu.utils.DocumentsTree
|
||||
@ -17,17 +18,6 @@ fun Context.getPublicFilesDir(): File = getExternalFilesDir(null) ?: filesDir
|
||||
|
||||
class YuzuApplication : Application() {
|
||||
private fun createNotificationChannels() {
|
||||
val emulationChannel = NotificationChannel(
|
||||
getString(R.string.emulation_notification_channel_id),
|
||||
getString(R.string.emulation_notification_channel_name),
|
||||
NotificationManager.IMPORTANCE_LOW
|
||||
)
|
||||
emulationChannel.description = getString(
|
||||
R.string.emulation_notification_channel_description
|
||||
)
|
||||
emulationChannel.setSound(null, null)
|
||||
emulationChannel.vibrationPattern = null
|
||||
|
||||
val noticeChannel = NotificationChannel(
|
||||
getString(R.string.notice_notification_channel_id),
|
||||
getString(R.string.notice_notification_channel_name),
|
||||
@ -39,7 +29,6 @@ class YuzuApplication : Application() {
|
||||
// Register the channel with the system; you can't change the importance
|
||||
// or other notification behaviors after this
|
||||
val notificationManager = getSystemService(NotificationManager::class.java)
|
||||
notificationManager.createNotificationChannel(emulationChannel)
|
||||
notificationManager.createNotificationChannel(noticeChannel)
|
||||
}
|
||||
|
||||
@ -49,6 +38,7 @@ class YuzuApplication : Application() {
|
||||
documentsTree = DocumentsTree()
|
||||
DirectoryInitialization.start()
|
||||
GpuDriverHelper.initializeDriverParameters()
|
||||
NativeInput.reloadInputDevices()
|
||||
NativeLibrary.logDeviceInfo()
|
||||
Log.logDeviceInfo()
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
package org.yuzu.yuzu_emu.activities
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.app.PendingIntent
|
||||
import android.app.PictureInPictureParams
|
||||
import android.app.RemoteAction
|
||||
@ -40,16 +39,18 @@ import org.yuzu.yuzu_emu.NativeLibrary
|
||||
import org.yuzu.yuzu_emu.R
|
||||
import org.yuzu.yuzu_emu.YuzuApplication
|
||||
import org.yuzu.yuzu_emu.databinding.ActivityEmulationBinding
|
||||
import org.yuzu.yuzu_emu.features.input.NativeInput
|
||||
import org.yuzu.yuzu_emu.features.settings.model.BooleanSetting
|
||||
import org.yuzu.yuzu_emu.features.settings.model.IntSetting
|
||||
import org.yuzu.yuzu_emu.features.settings.model.Settings
|
||||
import org.yuzu.yuzu_emu.model.EmulationViewModel
|
||||
import org.yuzu.yuzu_emu.model.Game
|
||||
import org.yuzu.yuzu_emu.utils.ForegroundService
|
||||
import org.yuzu.yuzu_emu.utils.InputHandler
|
||||
import org.yuzu.yuzu_emu.utils.Log
|
||||
import org.yuzu.yuzu_emu.utils.MemoryUtil
|
||||
import org.yuzu.yuzu_emu.utils.NativeConfig
|
||||
import org.yuzu.yuzu_emu.utils.NfcReader
|
||||
import org.yuzu.yuzu_emu.utils.ParamPackage
|
||||
import org.yuzu.yuzu_emu.utils.ThemeHelper
|
||||
import java.text.NumberFormat
|
||||
import kotlin.math.roundToInt
|
||||
@ -65,8 +66,6 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener {
|
||||
private var motionTimestamp: Long = 0
|
||||
private var flipMotionOrientation: Boolean = false
|
||||
|
||||
private var controllerIds = InputHandler.getGameControllerIds()
|
||||
|
||||
private val actionPause = "ACTION_EMULATOR_PAUSE"
|
||||
private val actionPlay = "ACTION_EMULATOR_PLAY"
|
||||
private val actionMute = "ACTION_EMULATOR_MUTE"
|
||||
@ -74,18 +73,39 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener {
|
||||
|
||||
private val emulationViewModel: EmulationViewModel by viewModels()
|
||||
|
||||
override fun onDestroy() {
|
||||
stopForegroundService(this)
|
||||
emulationViewModel.clear()
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
Log.gameLaunched = true
|
||||
ThemeHelper.setTheme(this)
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
InputHandler.updateControllerData()
|
||||
val players = NativeConfig.getInputSettings(true)
|
||||
var hasConfiguredControllers = false
|
||||
players.forEach {
|
||||
if (it.hasMapping()) {
|
||||
hasConfiguredControllers = true
|
||||
}
|
||||
}
|
||||
if (!hasConfiguredControllers && InputHandler.androidControllers.isNotEmpty()) {
|
||||
var params: ParamPackage? = null
|
||||
for (controller in InputHandler.registeredControllers) {
|
||||
if (controller.get("port", -1) == 0) {
|
||||
params = controller
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (params != null) {
|
||||
NativeInput.updateMappingsWithDefault(
|
||||
0,
|
||||
params,
|
||||
params.get("display", getString(R.string.unknown))
|
||||
)
|
||||
NativeConfig.saveGlobalConfig()
|
||||
}
|
||||
}
|
||||
|
||||
binding = ActivityEmulationBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
@ -103,8 +123,6 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener {
|
||||
nfcReader = NfcReader(this)
|
||||
nfcReader.initialize()
|
||||
|
||||
InputHandler.initialize()
|
||||
|
||||
val preferences = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext)
|
||||
if (!preferences.getBoolean(Settings.PREF_MEMORY_WARNING_SHOWN, false)) {
|
||||
if (MemoryUtil.isLessThan(MemoryUtil.REQUIRED_MEMORY, MemoryUtil.totalMemory)) {
|
||||
@ -126,10 +144,6 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener {
|
||||
.apply()
|
||||
}
|
||||
}
|
||||
|
||||
// Start a foreground service to prevent the app from getting killed in the background
|
||||
val startIntent = Intent(this, ForegroundService::class.java)
|
||||
startForegroundService(startIntent)
|
||||
}
|
||||
|
||||
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
|
||||
@ -159,7 +173,7 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener {
|
||||
super.onResume()
|
||||
nfcReader.startScanning()
|
||||
startMotionSensorListener()
|
||||
InputHandler.updateControllerIds()
|
||||
InputHandler.updateControllerData()
|
||||
|
||||
buildPictureInPictureParams()
|
||||
}
|
||||
@ -184,6 +198,7 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener {
|
||||
super.onNewIntent(intent)
|
||||
setIntent(intent)
|
||||
nfcReader.onNewIntent(intent)
|
||||
InputHandler.updateControllerData()
|
||||
}
|
||||
|
||||
override fun dispatchKeyEvent(event: KeyEvent): Boolean {
|
||||
@ -193,6 +208,10 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener {
|
||||
return super.dispatchKeyEvent(event)
|
||||
}
|
||||
|
||||
if (emulationViewModel.drawerOpen.value) {
|
||||
return super.dispatchKeyEvent(event)
|
||||
}
|
||||
|
||||
return InputHandler.dispatchKeyEvent(event)
|
||||
}
|
||||
|
||||
@ -203,6 +222,10 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener {
|
||||
return super.dispatchGenericMotionEvent(event)
|
||||
}
|
||||
|
||||
if (emulationViewModel.drawerOpen.value) {
|
||||
return super.dispatchGenericMotionEvent(event)
|
||||
}
|
||||
|
||||
// Don't attempt to do anything if we are disconnecting a device.
|
||||
if (event.actionMasked == MotionEvent.ACTION_CANCEL) {
|
||||
return true
|
||||
@ -248,8 +271,8 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener {
|
||||
}
|
||||
val deltaTimestamp = (event.timestamp - motionTimestamp) / 1000
|
||||
motionTimestamp = event.timestamp
|
||||
NativeLibrary.onGamePadMotionEvent(
|
||||
NativeLibrary.Player1Device,
|
||||
NativeInput.onDeviceMotionEvent(
|
||||
NativeInput.Player1Device,
|
||||
deltaTimestamp,
|
||||
gyro[0],
|
||||
gyro[1],
|
||||
@ -258,8 +281,8 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener {
|
||||
accel[1],
|
||||
accel[2]
|
||||
)
|
||||
NativeLibrary.onGamePadMotionEvent(
|
||||
NativeLibrary.ConsoleDevice,
|
||||
NativeInput.onDeviceMotionEvent(
|
||||
NativeInput.ConsoleDevice,
|
||||
deltaTimestamp,
|
||||
gyro[0],
|
||||
gyro[1],
|
||||
@ -438,9 +461,14 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener {
|
||||
}
|
||||
|
||||
fun onEmulationStopped(status: Int) {
|
||||
if (status == 0) {
|
||||
if (status == 0 && emulationViewModel.programChanged.value == -1) {
|
||||
finish()
|
||||
}
|
||||
emulationViewModel.setEmulationStopped(true)
|
||||
}
|
||||
|
||||
fun onProgramChanged(programIndex: Int) {
|
||||
emulationViewModel.setProgramChanged(programIndex)
|
||||
}
|
||||
|
||||
private fun startMotionSensorListener() {
|
||||
@ -469,12 +497,6 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener {
|
||||
activity.startActivity(launcher)
|
||||
}
|
||||
|
||||
fun stopForegroundService(activity: Activity) {
|
||||
val startIntent = Intent(activity, ForegroundService::class.java)
|
||||
startIntent.action = ForegroundService.ACTION_STOP
|
||||
activity.startForegroundService(startIntent)
|
||||
}
|
||||
|
||||
private fun areCoordinatesOutside(view: View?, x: Float, y: Float): Boolean {
|
||||
if (view == null) {
|
||||
return true
|
||||
|
@ -0,0 +1,38 @@
|
||||
// SPDX-FileCopyrightText: 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
package org.yuzu.yuzu_emu.adapters
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import androidx.recyclerview.widget.AsyncDifferConfig
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
import androidx.recyclerview.widget.ListAdapter
|
||||
import org.yuzu.yuzu_emu.viewholder.AbstractViewHolder
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
|
||||
/**
|
||||
* Generic adapter that implements an [AsyncDifferConfig] and covers some of the basic boilerplate
|
||||
* code used in every [RecyclerView].
|
||||
* Type assigned to [Model] must inherit from [Object] in order to be compared properly.
|
||||
* @param exact Decides whether each item will be compared by reference or by their contents
|
||||
*/
|
||||
abstract class AbstractDiffAdapter<Model : Any, Holder : AbstractViewHolder<Model>>(
|
||||
exact: Boolean = true
|
||||
) : ListAdapter<Model, Holder>(AsyncDifferConfig.Builder(DiffCallback<Model>(exact)).build()) {
|
||||
override fun onBindViewHolder(holder: Holder, position: Int) =
|
||||
holder.bind(currentList[position])
|
||||
|
||||
private class DiffCallback<Model>(val exact: Boolean) : DiffUtil.ItemCallback<Model>() {
|
||||
override fun areItemsTheSame(oldItem: Model & Any, newItem: Model & Any): Boolean {
|
||||
if (exact) {
|
||||
return oldItem === newItem
|
||||
}
|
||||
return oldItem == newItem
|
||||
}
|
||||
|
||||
@SuppressLint("DiffUtilEquals")
|
||||
override fun areContentsTheSame(oldItem: Model & Any, newItem: Model & Any): Boolean {
|
||||
return oldItem == newItem
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
// SPDX-FileCopyrightText: 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
package org.yuzu.yuzu_emu.adapters
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.yuzu.yuzu_emu.viewholder.AbstractViewHolder
|
||||
|
||||
/**
|
||||
* Generic list class meant to take care of basic lists
|
||||
* @param currentList The list to show initially
|
||||
*/
|
||||
abstract class AbstractListAdapter<Model : Any, Holder : AbstractViewHolder<Model>>(
|
||||
open var currentList: List<Model>
|
||||
) : RecyclerView.Adapter<Holder>() {
|
||||
override fun onBindViewHolder(holder: Holder, position: Int) =
|
||||
holder.bind(currentList[position])
|
||||
|
||||
override fun getItemCount(): Int = currentList.size
|
||||
|
||||
/**
|
||||
* Adds an item to [currentList] and notifies the underlying adapter of the change. If no parameter
|
||||
* is passed in for position, [item] is added to the end of the list. Invokes [callback] last.
|
||||
* @param item The item to add to the list
|
||||
* @param position Index where [item] will be added
|
||||
* @param callback Lambda that's called at the end of the list changes and has the added list
|
||||
* position passed in as a parameter
|
||||
*/
|
||||
open fun addItem(item: Model, position: Int = -1, callback: ((position: Int) -> Unit)? = null) {
|
||||
val newList = currentList.toMutableList()
|
||||
val positionToUpdate: Int
|
||||
if (position == -1) {
|
||||
newList.add(item)
|
||||
currentList = newList
|
||||
positionToUpdate = currentList.size - 1
|
||||
} else {
|
||||
newList.add(position, item)
|
||||
currentList = newList
|
||||
positionToUpdate = position
|
||||
}
|
||||
onItemAdded(positionToUpdate, callback)
|
||||
}
|
||||
|
||||
protected fun onItemAdded(position: Int, callback: ((Int) -> Unit)? = null) {
|
||||
notifyItemInserted(position)
|
||||
callback?.invoke(position)
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces the [item] at [position] in the [currentList] and notifies the underlying adapter
|
||||
* of the change. Invokes [callback] last.
|
||||
* @param item New list item
|
||||
* @param position Index where [item] will replace the existing list item
|
||||
* @param callback Lambda that's called at the end of the list changes and has the changed list
|
||||
* position passed in as a parameter
|
||||
*/
|
||||
fun changeItem(item: Model, position: Int, callback: ((position: Int) -> Unit)? = null) {
|
||||
val newList = currentList.toMutableList()
|
||||
newList[position] = item
|
||||
currentList = newList
|
||||
onItemChanged(position, callback)
|
||||
}
|
||||
|
||||
protected fun onItemChanged(position: Int, callback: ((Int) -> Unit)? = null) {
|
||||
notifyItemChanged(position)
|
||||
callback?.invoke(position)
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the list item at [position] in [currentList] and notifies the underlying adapter
|
||||
* of the change. Invokes [callback] last.
|
||||
* @param position Index where the list item will be removed
|
||||
* @param callback Lambda that's called at the end of the list changes and has the removed list
|
||||
* position passed in as a parameter
|
||||
*/
|
||||
fun removeItem(position: Int, callback: ((position: Int) -> Unit)? = null) {
|
||||
val newList = currentList.toMutableList()
|
||||
newList.removeAt(position)
|
||||
currentList = newList
|
||||
onItemRemoved(position, callback)
|
||||
}
|
||||
|
||||
protected fun onItemRemoved(position: Int, callback: ((Int) -> Unit)? = null) {
|
||||
notifyItemRemoved(position)
|
||||
callback?.invoke(position)
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces [currentList] with [newList] and notifies the underlying adapter of the change.
|
||||
* @param newList The new list to replace [currentList]
|
||||
*/
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
open fun replaceList(newList: List<Model>) {
|
||||
currentList = newList
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
// SPDX-FileCopyrightText: 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
package org.yuzu.yuzu_emu.adapters
|
||||
|
||||
import org.yuzu.yuzu_emu.model.SelectableItem
|
||||
import org.yuzu.yuzu_emu.viewholder.AbstractViewHolder
|
||||
|
||||
/**
|
||||
* Generic list class meant to take care of single selection UI updates
|
||||
* @param currentList The list to show initially
|
||||
* @param defaultSelection The default selection to use if no list items are selected by
|
||||
* [SelectableItem.selected] or if the currently selected item is removed from the list
|
||||
*/
|
||||
abstract class AbstractSingleSelectionList<
|
||||
Model : SelectableItem,
|
||||
Holder : AbstractViewHolder<Model>
|
||||
>(
|
||||
final override var currentList: List<Model>,
|
||||
private val defaultSelection: DefaultSelection = DefaultSelection.Start
|
||||
) : AbstractListAdapter<Model, Holder>(currentList) {
|
||||
var selectedItem = getDefaultSelection()
|
||||
|
||||
init {
|
||||
findSelectedItem()
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the selection state of the [SelectableItem] that was selected and the previously selected
|
||||
* item and notifies the underlying adapter of the change for those items. Invokes [callback] last.
|
||||
* Does nothing if [position] is the same as the currently selected item.
|
||||
* @param position Index of the item that was selected
|
||||
* @param callback Lambda that's called at the end of the list changes and has the selected list
|
||||
* position passed in as a parameter
|
||||
*/
|
||||
fun selectItem(position: Int, callback: ((position: Int) -> Unit)? = null) {
|
||||
if (position == selectedItem) {
|
||||
return
|
||||
}
|
||||
|
||||
val previouslySelectedItem = selectedItem
|
||||
selectedItem = position
|
||||
if (currentList.indices.contains(selectedItem)) {
|
||||
currentList[selectedItem].onSelectionStateChanged(true)
|
||||
}
|
||||
if (currentList.indices.contains(previouslySelectedItem)) {
|
||||
currentList[previouslySelectedItem].onSelectionStateChanged(false)
|
||||
}
|
||||
onItemChanged(previouslySelectedItem)
|
||||
onItemChanged(selectedItem)
|
||||
callback?.invoke(position)
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a given item from the list and notifies the underlying adapter of the change. If the
|
||||
* currently selected item was the item that was removed, the item at the position provided
|
||||
* by [defaultSelection] will be made the new selection. Invokes [callback] last.
|
||||
* @param position Index of the item that was removed
|
||||
* @param callback Lambda that's called at the end of the list changes and has the removed and
|
||||
* selected list positions passed in as parameters
|
||||
*/
|
||||
fun removeSelectableItem(
|
||||
position: Int,
|
||||
callback: ((removedPosition: Int, selectedPosition: Int) -> Unit)?
|
||||
) {
|
||||
removeItem(position)
|
||||
if (position == selectedItem) {
|
||||
selectedItem = getDefaultSelection()
|
||||
currentList[selectedItem].onSelectionStateChanged(true)
|
||||
onItemChanged(selectedItem)
|
||||
} else if (position < selectedItem) {
|
||||
selectedItem--
|
||||
}
|
||||
callback?.invoke(position, selectedItem)
|
||||
}
|
||||
|
||||
override fun addItem(item: Model, position: Int, callback: ((Int) -> Unit)?) {
|
||||
super.addItem(item, position, callback)
|
||||
if (position <= selectedItem && position != -1) {
|
||||
selectedItem++
|
||||
}
|
||||
}
|
||||
|
||||
override fun replaceList(newList: List<Model>) {
|
||||
super.replaceList(newList)
|
||||
findSelectedItem()
|
||||
}
|
||||
|
||||
private fun findSelectedItem() {
|
||||
for (i in currentList.indices) {
|
||||
if (currentList[i].selected) {
|
||||
selectedItem = i
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getDefaultSelection(): Int =
|
||||
when (defaultSelection) {
|
||||
DefaultSelection.Start -> currentList.indices.first
|
||||
DefaultSelection.End -> currentList.indices.last
|
||||
}
|
||||
|
||||
enum class DefaultSelection { Start, End }
|
||||
}
|
@ -5,48 +5,33 @@ package org.yuzu.yuzu_emu.adapters
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.AsyncDifferConfig
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
import androidx.recyclerview.widget.ListAdapter
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.yuzu.yuzu_emu.databinding.ListItemAddonBinding
|
||||
import org.yuzu.yuzu_emu.model.Addon
|
||||
import org.yuzu.yuzu_emu.model.Patch
|
||||
import org.yuzu.yuzu_emu.model.AddonViewModel
|
||||
import org.yuzu.yuzu_emu.viewholder.AbstractViewHolder
|
||||
|
||||
class AddonAdapter : ListAdapter<Addon, AddonAdapter.AddonViewHolder>(
|
||||
AsyncDifferConfig.Builder(DiffCallback()).build()
|
||||
) {
|
||||
class AddonAdapter(val addonViewModel: AddonViewModel) :
|
||||
AbstractDiffAdapter<Patch, AddonAdapter.AddonViewHolder>() {
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AddonViewHolder {
|
||||
ListItemAddonBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
.also { return AddonViewHolder(it) }
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = currentList.size
|
||||
|
||||
override fun onBindViewHolder(holder: AddonViewHolder, position: Int) =
|
||||
holder.bind(currentList[position])
|
||||
|
||||
inner class AddonViewHolder(val binding: ListItemAddonBinding) :
|
||||
RecyclerView.ViewHolder(binding.root) {
|
||||
fun bind(addon: Addon) {
|
||||
AbstractViewHolder<Patch>(binding) {
|
||||
override fun bind(model: Patch) {
|
||||
binding.root.setOnClickListener {
|
||||
binding.addonSwitch.isChecked = !binding.addonSwitch.isChecked
|
||||
binding.addonCheckbox.isChecked = !binding.addonCheckbox.isChecked
|
||||
}
|
||||
binding.title.text = addon.title
|
||||
binding.version.text = addon.version
|
||||
binding.addonSwitch.setOnCheckedChangeListener { _, checked ->
|
||||
addon.enabled = checked
|
||||
binding.title.text = model.name
|
||||
binding.version.text = model.version
|
||||
binding.addonCheckbox.setOnCheckedChangeListener { _, checked ->
|
||||
model.enabled = checked
|
||||
}
|
||||
binding.addonCheckbox.isChecked = model.enabled
|
||||
binding.buttonDelete.setOnClickListener {
|
||||
addonViewModel.setAddonToDelete(model)
|
||||
}
|
||||
binding.addonSwitch.isChecked = addon.enabled
|
||||
}
|
||||
}
|
||||
|
||||
private class DiffCallback : DiffUtil.ItemCallback<Addon>() {
|
||||
override fun areItemsTheSame(oldItem: Addon, newItem: Addon): Boolean {
|
||||
return oldItem == newItem
|
||||
}
|
||||
|
||||
override fun areContentsTheSame(oldItem: Addon, newItem: Addon): Boolean {
|
||||
return oldItem == newItem
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,13 +4,11 @@
|
||||
package org.yuzu.yuzu_emu.adapters
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.yuzu.yuzu_emu.HomeNavigationDirections
|
||||
import org.yuzu.yuzu_emu.NativeLibrary
|
||||
import org.yuzu.yuzu_emu.R
|
||||
@ -19,72 +17,58 @@ import org.yuzu.yuzu_emu.databinding.CardSimpleOutlinedBinding
|
||||
import org.yuzu.yuzu_emu.model.Applet
|
||||
import org.yuzu.yuzu_emu.model.AppletInfo
|
||||
import org.yuzu.yuzu_emu.model.Game
|
||||
import org.yuzu.yuzu_emu.viewholder.AbstractViewHolder
|
||||
|
||||
class AppletAdapter(val activity: FragmentActivity, var applets: List<Applet>) :
|
||||
RecyclerView.Adapter<AppletAdapter.AppletViewHolder>(),
|
||||
View.OnClickListener {
|
||||
|
||||
class AppletAdapter(val activity: FragmentActivity, applets: List<Applet>) :
|
||||
AbstractListAdapter<Applet, AppletAdapter.AppletViewHolder>(applets) {
|
||||
override fun onCreateViewHolder(
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): AppletAdapter.AppletViewHolder {
|
||||
CardSimpleOutlinedBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
.apply { root.setOnClickListener(this@AppletAdapter) }
|
||||
.also { return AppletViewHolder(it) }
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: AppletViewHolder, position: Int) =
|
||||
holder.bind(applets[position])
|
||||
|
||||
override fun getItemCount(): Int = applets.size
|
||||
|
||||
override fun onClick(view: View) {
|
||||
val applet = (view.tag as AppletViewHolder).applet
|
||||
val appletPath = NativeLibrary.getAppletLaunchPath(applet.appletInfo.entryId)
|
||||
if (appletPath.isEmpty()) {
|
||||
Toast.makeText(
|
||||
YuzuApplication.appContext,
|
||||
R.string.applets_error_applet,
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
return
|
||||
}
|
||||
|
||||
if (applet.appletInfo == AppletInfo.Cabinet) {
|
||||
view.findNavController()
|
||||
.navigate(R.id.action_appletLauncherFragment_to_cabinetLauncherDialogFragment)
|
||||
return
|
||||
}
|
||||
|
||||
NativeLibrary.setCurrentAppletId(applet.appletInfo.appletId)
|
||||
val appletGame = Game(
|
||||
title = YuzuApplication.appContext.getString(applet.titleId),
|
||||
path = appletPath
|
||||
)
|
||||
val action = HomeNavigationDirections.actionGlobalEmulationActivity(appletGame)
|
||||
view.findNavController().navigate(action)
|
||||
}
|
||||
|
||||
inner class AppletViewHolder(val binding: CardSimpleOutlinedBinding) :
|
||||
RecyclerView.ViewHolder(binding.root) {
|
||||
lateinit var applet: Applet
|
||||
|
||||
init {
|
||||
itemView.tag = this
|
||||
}
|
||||
|
||||
fun bind(applet: Applet) {
|
||||
this.applet = applet
|
||||
|
||||
binding.title.setText(applet.titleId)
|
||||
binding.description.setText(applet.descriptionId)
|
||||
AbstractViewHolder<Applet>(binding) {
|
||||
override fun bind(model: Applet) {
|
||||
binding.title.setText(model.titleId)
|
||||
binding.description.setText(model.descriptionId)
|
||||
binding.icon.setImageDrawable(
|
||||
ResourcesCompat.getDrawable(
|
||||
binding.icon.context.resources,
|
||||
applet.iconId,
|
||||
model.iconId,
|
||||
binding.icon.context.theme
|
||||
)
|
||||
)
|
||||
|
||||
binding.root.setOnClickListener { onClick(model) }
|
||||
}
|
||||
|
||||
fun onClick(applet: Applet) {
|
||||
val appletPath = NativeLibrary.getAppletLaunchPath(applet.appletInfo.entryId)
|
||||
if (appletPath.isEmpty()) {
|
||||
Toast.makeText(
|
||||
binding.root.context,
|
||||
R.string.applets_error_applet,
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
return
|
||||
}
|
||||
|
||||
if (applet.appletInfo == AppletInfo.Cabinet) {
|
||||
binding.root.findNavController()
|
||||
.navigate(R.id.action_appletLauncherFragment_to_cabinetLauncherDialogFragment)
|
||||
return
|
||||
}
|
||||
|
||||
NativeLibrary.setCurrentAppletId(applet.appletInfo.appletId)
|
||||
val appletGame = Game(
|
||||
title = YuzuApplication.appContext.getString(applet.titleId),
|
||||
path = appletPath
|
||||
)
|
||||
val action = HomeNavigationDirections.actionGlobalEmulationActivity(appletGame)
|
||||
binding.root.findNavController().navigate(action)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,12 +4,10 @@
|
||||
package org.yuzu.yuzu_emu.adapters
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.yuzu.yuzu_emu.HomeNavigationDirections
|
||||
import org.yuzu.yuzu_emu.NativeLibrary
|
||||
import org.yuzu.yuzu_emu.R
|
||||
@ -19,54 +17,43 @@ import org.yuzu.yuzu_emu.model.CabinetMode
|
||||
import org.yuzu.yuzu_emu.adapters.CabinetLauncherDialogAdapter.CabinetModeViewHolder
|
||||
import org.yuzu.yuzu_emu.model.AppletInfo
|
||||
import org.yuzu.yuzu_emu.model.Game
|
||||
import org.yuzu.yuzu_emu.viewholder.AbstractViewHolder
|
||||
|
||||
class CabinetLauncherDialogAdapter(val fragment: Fragment) :
|
||||
RecyclerView.Adapter<CabinetModeViewHolder>(),
|
||||
View.OnClickListener {
|
||||
private val cabinetModes = CabinetMode.values().copyOfRange(1, CabinetMode.values().size)
|
||||
AbstractListAdapter<CabinetMode, CabinetModeViewHolder>(
|
||||
CabinetMode.values().copyOfRange(1, CabinetMode.entries.size).toList()
|
||||
) {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CabinetModeViewHolder {
|
||||
DialogListItemBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
.apply { root.setOnClickListener(this@CabinetLauncherDialogAdapter) }
|
||||
.also { return CabinetModeViewHolder(it) }
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = cabinetModes.size
|
||||
|
||||
override fun onBindViewHolder(holder: CabinetModeViewHolder, position: Int) =
|
||||
holder.bind(cabinetModes[position])
|
||||
|
||||
override fun onClick(view: View) {
|
||||
val mode = (view.tag as CabinetModeViewHolder).cabinetMode
|
||||
val appletPath = NativeLibrary.getAppletLaunchPath(AppletInfo.Cabinet.entryId)
|
||||
NativeLibrary.setCurrentAppletId(AppletInfo.Cabinet.appletId)
|
||||
NativeLibrary.setCabinetMode(mode.id)
|
||||
val appletGame = Game(
|
||||
title = YuzuApplication.appContext.getString(R.string.cabinet_applet),
|
||||
path = appletPath
|
||||
)
|
||||
val action = HomeNavigationDirections.actionGlobalEmulationActivity(appletGame)
|
||||
fragment.findNavController().navigate(action)
|
||||
}
|
||||
|
||||
inner class CabinetModeViewHolder(val binding: DialogListItemBinding) :
|
||||
RecyclerView.ViewHolder(binding.root) {
|
||||
lateinit var cabinetMode: CabinetMode
|
||||
|
||||
init {
|
||||
itemView.tag = this
|
||||
}
|
||||
|
||||
fun bind(cabinetMode: CabinetMode) {
|
||||
this.cabinetMode = cabinetMode
|
||||
AbstractViewHolder<CabinetMode>(binding) {
|
||||
override fun bind(model: CabinetMode) {
|
||||
binding.icon.setImageDrawable(
|
||||
ResourcesCompat.getDrawable(
|
||||
binding.icon.context.resources,
|
||||
cabinetMode.iconId,
|
||||
model.iconId,
|
||||
binding.icon.context.theme
|
||||
)
|
||||
)
|
||||
binding.title.setText(cabinetMode.titleId)
|
||||
binding.title.setText(model.titleId)
|
||||
|
||||
binding.root.setOnClickListener { onClick(model) }
|
||||
}
|
||||
|
||||
private fun onClick(mode: CabinetMode) {
|
||||
val appletPath = NativeLibrary.getAppletLaunchPath(AppletInfo.Cabinet.entryId)
|
||||
NativeLibrary.setCurrentAppletId(AppletInfo.Cabinet.appletId)
|
||||
NativeLibrary.setCabinetMode(mode.id)
|
||||
val appletGame = Game(
|
||||
title = YuzuApplication.appContext.getString(R.string.cabinet_applet),
|
||||
path = appletPath
|
||||
)
|
||||
val action = HomeNavigationDirections.actionGlobalEmulationActivity(appletGame)
|
||||
fragment.findNavController().navigate(action)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,115 +3,57 @@
|
||||
|
||||
package org.yuzu.yuzu_emu.adapters
|
||||
|
||||
import android.text.TextUtils
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.AsyncDifferConfig
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
import androidx.recyclerview.widget.ListAdapter
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.yuzu.yuzu_emu.R
|
||||
import org.yuzu.yuzu_emu.databinding.CardDriverOptionBinding
|
||||
import org.yuzu.yuzu_emu.features.settings.model.StringSetting
|
||||
import org.yuzu.yuzu_emu.model.Driver
|
||||
import org.yuzu.yuzu_emu.model.DriverViewModel
|
||||
import org.yuzu.yuzu_emu.utils.GpuDriverHelper
|
||||
import org.yuzu.yuzu_emu.utils.GpuDriverMetadata
|
||||
import org.yuzu.yuzu_emu.utils.ViewUtils.marquee
|
||||
import org.yuzu.yuzu_emu.utils.ViewUtils.setVisible
|
||||
import org.yuzu.yuzu_emu.viewholder.AbstractViewHolder
|
||||
|
||||
class DriverAdapter(private val driverViewModel: DriverViewModel) :
|
||||
ListAdapter<Pair<String, GpuDriverMetadata>, DriverAdapter.DriverViewHolder>(
|
||||
AsyncDifferConfig.Builder(DiffCallback()).build()
|
||||
AbstractSingleSelectionList<Driver, DriverAdapter.DriverViewHolder>(
|
||||
driverViewModel.driverList.value
|
||||
) {
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): DriverViewHolder {
|
||||
val binding =
|
||||
CardDriverOptionBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
return DriverViewHolder(binding)
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = currentList.size
|
||||
|
||||
override fun onBindViewHolder(holder: DriverViewHolder, position: Int) =
|
||||
holder.bind(currentList[position])
|
||||
|
||||
private fun onSelectDriver(position: Int) {
|
||||
driverViewModel.setSelectedDriverIndex(position)
|
||||
notifyItemChanged(driverViewModel.previouslySelectedDriver)
|
||||
notifyItemChanged(driverViewModel.selectedDriver)
|
||||
}
|
||||
|
||||
private fun onDeleteDriver(driverData: Pair<String, GpuDriverMetadata>, position: Int) {
|
||||
if (driverViewModel.selectedDriver > position) {
|
||||
driverViewModel.setSelectedDriverIndex(driverViewModel.selectedDriver - 1)
|
||||
}
|
||||
if (GpuDriverHelper.customDriverSettingData == driverData.second) {
|
||||
driverViewModel.setSelectedDriverIndex(0)
|
||||
}
|
||||
driverViewModel.driversToDelete.add(driverData.first)
|
||||
driverViewModel.removeDriver(driverData)
|
||||
notifyItemRemoved(position)
|
||||
notifyItemChanged(driverViewModel.selectedDriver)
|
||||
CardDriverOptionBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
.also { return DriverViewHolder(it) }
|
||||
}
|
||||
|
||||
inner class DriverViewHolder(val binding: CardDriverOptionBinding) :
|
||||
RecyclerView.ViewHolder(binding.root) {
|
||||
private lateinit var driverData: Pair<String, GpuDriverMetadata>
|
||||
|
||||
fun bind(driverData: Pair<String, GpuDriverMetadata>) {
|
||||
this.driverData = driverData
|
||||
val driver = driverData.second
|
||||
|
||||
AbstractViewHolder<Driver>(binding) {
|
||||
override fun bind(model: Driver) {
|
||||
binding.apply {
|
||||
radioButton.isChecked = driverViewModel.selectedDriver == bindingAdapterPosition
|
||||
radioButton.isChecked = model.selected
|
||||
root.setOnClickListener {
|
||||
onSelectDriver(bindingAdapterPosition)
|
||||
selectItem(bindingAdapterPosition) {
|
||||
driverViewModel.onDriverSelected(it)
|
||||
driverViewModel.showClearButton(!StringSetting.DRIVER_PATH.global)
|
||||
}
|
||||
}
|
||||
buttonDelete.setOnClickListener {
|
||||
onDeleteDriver(driverData, bindingAdapterPosition)
|
||||
removeSelectableItem(
|
||||
bindingAdapterPosition
|
||||
) { removedPosition: Int, selectedPosition: Int ->
|
||||
driverViewModel.onDriverRemoved(removedPosition, selectedPosition)
|
||||
driverViewModel.showClearButton(!StringSetting.DRIVER_PATH.global)
|
||||
}
|
||||
}
|
||||
|
||||
// Delay marquee by 3s
|
||||
title.postDelayed(
|
||||
{
|
||||
title.isSelected = true
|
||||
title.ellipsize = TextUtils.TruncateAt.MARQUEE
|
||||
version.isSelected = true
|
||||
version.ellipsize = TextUtils.TruncateAt.MARQUEE
|
||||
description.isSelected = true
|
||||
description.ellipsize = TextUtils.TruncateAt.MARQUEE
|
||||
},
|
||||
3000
|
||||
title.marquee()
|
||||
version.marquee()
|
||||
description.marquee()
|
||||
title.text = model.title
|
||||
version.text = model.version
|
||||
description.text = model.description
|
||||
buttonDelete.setVisible(
|
||||
model.title != binding.root.context.getString(R.string.system_gpu_driver)
|
||||
)
|
||||
if (driver.name == null) {
|
||||
title.setText(R.string.system_gpu_driver)
|
||||
description.text = ""
|
||||
version.text = ""
|
||||
version.visibility = View.GONE
|
||||
description.visibility = View.GONE
|
||||
buttonDelete.visibility = View.GONE
|
||||
} else {
|
||||
title.text = driver.name
|
||||
version.text = driver.version
|
||||
description.text = driver.description
|
||||
version.visibility = View.VISIBLE
|
||||
description.visibility = View.VISIBLE
|
||||
buttonDelete.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class DiffCallback : DiffUtil.ItemCallback<Pair<String, GpuDriverMetadata>>() {
|
||||
override fun areItemsTheSame(
|
||||
oldItem: Pair<String, GpuDriverMetadata>,
|
||||
newItem: Pair<String, GpuDriverMetadata>
|
||||
): Boolean {
|
||||
return oldItem.first == newItem.first
|
||||
}
|
||||
|
||||
override fun areContentsTheSame(
|
||||
oldItem: Pair<String, GpuDriverMetadata>,
|
||||
newItem: Pair<String, GpuDriverMetadata>
|
||||
): Boolean {
|
||||
return oldItem.second == newItem.second
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,23 +4,18 @@
|
||||
package org.yuzu.yuzu_emu.adapters
|
||||
|
||||
import android.net.Uri
|
||||
import android.text.TextUtils
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.recyclerview.widget.AsyncDifferConfig
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
import androidx.recyclerview.widget.ListAdapter
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.yuzu.yuzu_emu.databinding.CardFolderBinding
|
||||
import org.yuzu.yuzu_emu.fragments.GameFolderPropertiesDialogFragment
|
||||
import org.yuzu.yuzu_emu.model.GameDir
|
||||
import org.yuzu.yuzu_emu.model.GamesViewModel
|
||||
import org.yuzu.yuzu_emu.utils.ViewUtils.marquee
|
||||
import org.yuzu.yuzu_emu.viewholder.AbstractViewHolder
|
||||
|
||||
class FolderAdapter(val activity: FragmentActivity, val gamesViewModel: GamesViewModel) :
|
||||
ListAdapter<GameDir, FolderAdapter.FolderViewHolder>(
|
||||
AsyncDifferConfig.Builder(DiffCallback()).build()
|
||||
) {
|
||||
AbstractDiffAdapter<GameDir, FolderAdapter.FolderViewHolder>() {
|
||||
override fun onCreateViewHolder(
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
@ -29,28 +24,15 @@ class FolderAdapter(val activity: FragmentActivity, val gamesViewModel: GamesVie
|
||||
.also { return FolderViewHolder(it) }
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: FolderAdapter.FolderViewHolder, position: Int) =
|
||||
holder.bind(currentList[position])
|
||||
|
||||
inner class FolderViewHolder(val binding: CardFolderBinding) :
|
||||
RecyclerView.ViewHolder(binding.root) {
|
||||
private lateinit var gameDir: GameDir
|
||||
|
||||
fun bind(gameDir: GameDir) {
|
||||
this.gameDir = gameDir
|
||||
|
||||
AbstractViewHolder<GameDir>(binding) {
|
||||
override fun bind(model: GameDir) {
|
||||
binding.apply {
|
||||
path.text = Uri.parse(gameDir.uriString).path
|
||||
path.postDelayed(
|
||||
{
|
||||
path.isSelected = true
|
||||
path.ellipsize = TextUtils.TruncateAt.MARQUEE
|
||||
},
|
||||
3000
|
||||
)
|
||||
path.text = Uri.parse(model.uriString).path
|
||||
path.marquee()
|
||||
|
||||
buttonEdit.setOnClickListener {
|
||||
GameFolderPropertiesDialogFragment.newInstance(this@FolderViewHolder.gameDir)
|
||||
GameFolderPropertiesDialogFragment.newInstance(model)
|
||||
.show(
|
||||
activity.supportFragmentManager,
|
||||
GameFolderPropertiesDialogFragment.TAG
|
||||
@ -58,19 +40,9 @@ class FolderAdapter(val activity: FragmentActivity, val gamesViewModel: GamesVie
|
||||
}
|
||||
|
||||
buttonDelete.setOnClickListener {
|
||||
gamesViewModel.removeFolder(this@FolderViewHolder.gameDir)
|
||||
gamesViewModel.removeFolder(model)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class DiffCallback : DiffUtil.ItemCallback<GameDir>() {
|
||||
override fun areItemsTheSame(oldItem: GameDir, newItem: GameDir): Boolean {
|
||||
return oldItem == newItem
|
||||
}
|
||||
|
||||
override fun areContentsTheSame(oldItem: GameDir, newItem: GameDir): Boolean {
|
||||
return oldItem == newItem
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,173 +3,97 @@
|
||||
|
||||
package org.yuzu.yuzu_emu.adapters
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.drawable.LayerDrawable
|
||||
import android.net.Uri
|
||||
import android.text.TextUtils
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.pm.ShortcutInfoCompat
|
||||
import androidx.core.content.pm.ShortcutManagerCompat
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import androidx.core.graphics.drawable.IconCompat
|
||||
import androidx.core.graphics.drawable.toBitmap
|
||||
import androidx.core.graphics.drawable.toDrawable
|
||||
import androidx.documentfile.provider.DocumentFile
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.preference.PreferenceManager
|
||||
import androidx.recyclerview.widget.AsyncDifferConfig
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
import androidx.recyclerview.widget.ListAdapter
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.yuzu.yuzu_emu.HomeNavigationDirections
|
||||
import org.yuzu.yuzu_emu.R
|
||||
import org.yuzu.yuzu_emu.YuzuApplication
|
||||
import org.yuzu.yuzu_emu.activities.EmulationActivity
|
||||
import org.yuzu.yuzu_emu.adapters.GameAdapter.GameViewHolder
|
||||
import org.yuzu.yuzu_emu.databinding.CardGameBinding
|
||||
import org.yuzu.yuzu_emu.model.Game
|
||||
import org.yuzu.yuzu_emu.model.GamesViewModel
|
||||
import org.yuzu.yuzu_emu.utils.GameIconUtils
|
||||
import org.yuzu.yuzu_emu.utils.ViewUtils.marquee
|
||||
import org.yuzu.yuzu_emu.viewholder.AbstractViewHolder
|
||||
|
||||
class GameAdapter(private val activity: AppCompatActivity) :
|
||||
ListAdapter<Game, GameViewHolder>(AsyncDifferConfig.Builder(DiffCallback()).build()),
|
||||
View.OnClickListener,
|
||||
View.OnLongClickListener {
|
||||
AbstractDiffAdapter<Game, GameAdapter.GameViewHolder>(exact = false) {
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): GameViewHolder {
|
||||
// Create a new view.
|
||||
val binding = CardGameBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
binding.cardGame.setOnClickListener(this)
|
||||
binding.cardGame.setOnLongClickListener(this)
|
||||
|
||||
// Use that view to create a ViewHolder.
|
||||
return GameViewHolder(binding)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: GameViewHolder, position: Int) =
|
||||
holder.bind(currentList[position])
|
||||
|
||||
override fun getItemCount(): Int = currentList.size
|
||||
|
||||
/**
|
||||
* Launches the game that was clicked on.
|
||||
*
|
||||
* @param view The card representing the game the user wants to play.
|
||||
*/
|
||||
override fun onClick(view: View) {
|
||||
val holder = view.tag as GameViewHolder
|
||||
|
||||
val gameExists = DocumentFile.fromSingleUri(
|
||||
YuzuApplication.appContext,
|
||||
Uri.parse(holder.game.path)
|
||||
)?.exists() == true
|
||||
if (!gameExists) {
|
||||
Toast.makeText(
|
||||
YuzuApplication.appContext,
|
||||
R.string.loader_error_file_not_found,
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
|
||||
ViewModelProvider(activity)[GamesViewModel::class.java].reloadGames(true)
|
||||
return
|
||||
}
|
||||
|
||||
val preferences = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext)
|
||||
preferences.edit()
|
||||
.putLong(
|
||||
holder.game.keyLastPlayedTime,
|
||||
System.currentTimeMillis()
|
||||
)
|
||||
.apply()
|
||||
|
||||
val openIntent = Intent(YuzuApplication.appContext, EmulationActivity::class.java).apply {
|
||||
action = Intent.ACTION_VIEW
|
||||
data = Uri.parse(holder.game.path)
|
||||
}
|
||||
|
||||
activity.lifecycleScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
val layerDrawable = ResourcesCompat.getDrawable(
|
||||
YuzuApplication.appContext.resources,
|
||||
R.drawable.shortcut,
|
||||
null
|
||||
) as LayerDrawable
|
||||
layerDrawable.setDrawableByLayerId(
|
||||
R.id.shortcut_foreground,
|
||||
GameIconUtils.getGameIcon(activity, holder.game)
|
||||
.toDrawable(YuzuApplication.appContext.resources)
|
||||
)
|
||||
val inset = YuzuApplication.appContext.resources
|
||||
.getDimensionPixelSize(R.dimen.icon_inset)
|
||||
layerDrawable.setLayerInset(1, inset, inset, inset, inset)
|
||||
val shortcut =
|
||||
ShortcutInfoCompat.Builder(YuzuApplication.appContext, holder.game.path)
|
||||
.setShortLabel(holder.game.title)
|
||||
.setIcon(
|
||||
IconCompat.createWithAdaptiveBitmap(
|
||||
layerDrawable.toBitmap(config = Bitmap.Config.ARGB_8888)
|
||||
)
|
||||
)
|
||||
.setIntent(openIntent)
|
||||
.build()
|
||||
ShortcutManagerCompat.pushDynamicShortcut(YuzuApplication.appContext, shortcut)
|
||||
}
|
||||
}
|
||||
|
||||
val action = HomeNavigationDirections.actionGlobalEmulationActivity(holder.game, true)
|
||||
view.findNavController().navigate(action)
|
||||
}
|
||||
|
||||
override fun onLongClick(view: View): Boolean {
|
||||
val holder = view.tag as GameViewHolder
|
||||
val action = HomeNavigationDirections.actionGlobalPerGamePropertiesFragment(holder.game)
|
||||
view.findNavController().navigate(action)
|
||||
return true
|
||||
CardGameBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
.also { return GameViewHolder(it) }
|
||||
}
|
||||
|
||||
inner class GameViewHolder(val binding: CardGameBinding) :
|
||||
RecyclerView.ViewHolder(binding.root) {
|
||||
lateinit var game: Game
|
||||
|
||||
init {
|
||||
binding.cardGame.tag = this
|
||||
}
|
||||
|
||||
fun bind(game: Game) {
|
||||
this.game = game
|
||||
|
||||
AbstractViewHolder<Game>(binding) {
|
||||
override fun bind(model: Game) {
|
||||
binding.imageGameScreen.scaleType = ImageView.ScaleType.CENTER_CROP
|
||||
GameIconUtils.loadGameIcon(game, binding.imageGameScreen)
|
||||
GameIconUtils.loadGameIcon(model, binding.imageGameScreen)
|
||||
|
||||
binding.textGameTitle.text = game.title.replace("[\\t\\n\\r]+".toRegex(), " ")
|
||||
binding.textGameTitle.text = model.title.replace("[\\t\\n\\r]+".toRegex(), " ")
|
||||
|
||||
binding.textGameTitle.postDelayed(
|
||||
{
|
||||
binding.textGameTitle.ellipsize = TextUtils.TruncateAt.MARQUEE
|
||||
binding.textGameTitle.isSelected = true
|
||||
},
|
||||
3000
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private class DiffCallback : DiffUtil.ItemCallback<Game>() {
|
||||
override fun areItemsTheSame(oldItem: Game, newItem: Game): Boolean {
|
||||
return oldItem == newItem
|
||||
binding.textGameTitle.marquee()
|
||||
binding.cardGame.setOnClickListener { onClick(model) }
|
||||
binding.cardGame.setOnLongClickListener { onLongClick(model) }
|
||||
}
|
||||
|
||||
override fun areContentsTheSame(oldItem: Game, newItem: Game): Boolean {
|
||||
return oldItem == newItem
|
||||
fun onClick(game: Game) {
|
||||
val gameExists = DocumentFile.fromSingleUri(
|
||||
YuzuApplication.appContext,
|
||||
Uri.parse(game.path)
|
||||
)?.exists() == true
|
||||
if (!gameExists) {
|
||||
Toast.makeText(
|
||||
YuzuApplication.appContext,
|
||||
R.string.loader_error_file_not_found,
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
|
||||
ViewModelProvider(activity)[GamesViewModel::class.java].reloadGames(true)
|
||||
return
|
||||
}
|
||||
|
||||
val preferences =
|
||||
PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext)
|
||||
preferences.edit()
|
||||
.putLong(
|
||||
game.keyLastPlayedTime,
|
||||
System.currentTimeMillis()
|
||||
)
|
||||
.apply()
|
||||
|
||||
activity.lifecycleScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
val shortcut =
|
||||
ShortcutInfoCompat.Builder(YuzuApplication.appContext, game.path)
|
||||
.setShortLabel(game.title)
|
||||
.setIcon(GameIconUtils.getShortcutIcon(activity, game))
|
||||
.setIntent(game.launchIntent)
|
||||
.build()
|
||||
ShortcutManagerCompat.pushDynamicShortcut(YuzuApplication.appContext, shortcut)
|
||||
}
|
||||
}
|
||||
|
||||
val action = HomeNavigationDirections.actionGlobalEmulationActivity(game, true)
|
||||
binding.root.findNavController().navigate(action)
|
||||
}
|
||||
|
||||
fun onLongClick(game: Game): Boolean {
|
||||
val action = HomeNavigationDirections.actionGlobalPerGamePropertiesFragment(game)
|
||||
binding.root.findNavController().navigate(action)
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,32 +3,28 @@
|
||||
|
||||
package org.yuzu.yuzu_emu.adapters
|
||||
|
||||
import android.text.TextUtils
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.lifecycle.repeatOnLifecycle
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import kotlinx.coroutines.launch
|
||||
import org.yuzu.yuzu_emu.databinding.CardInstallableIconBinding
|
||||
import org.yuzu.yuzu_emu.databinding.CardSimpleOutlinedBinding
|
||||
import org.yuzu.yuzu_emu.model.GameProperty
|
||||
import org.yuzu.yuzu_emu.model.InstallableProperty
|
||||
import org.yuzu.yuzu_emu.model.SubmenuProperty
|
||||
import org.yuzu.yuzu_emu.utils.ViewUtils.marquee
|
||||
import org.yuzu.yuzu_emu.utils.ViewUtils.setVisible
|
||||
import org.yuzu.yuzu_emu.utils.collect
|
||||
import org.yuzu.yuzu_emu.viewholder.AbstractViewHolder
|
||||
|
||||
class GamePropertiesAdapter(
|
||||
private val viewLifecycle: LifecycleOwner,
|
||||
private var properties: List<GameProperty>
|
||||
) :
|
||||
RecyclerView.Adapter<GamePropertiesAdapter.GamePropertyViewHolder>() {
|
||||
) : AbstractListAdapter<GameProperty, AbstractViewHolder<GameProperty>>(properties) {
|
||||
override fun onCreateViewHolder(
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): GamePropertyViewHolder {
|
||||
): AbstractViewHolder<GameProperty> {
|
||||
val inflater = LayoutInflater.from(parent.context)
|
||||
return when (viewType) {
|
||||
PropertyType.Submenu.ordinal -> {
|
||||
@ -51,11 +47,6 @@ class GamePropertiesAdapter(
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = properties.size
|
||||
|
||||
override fun onBindViewHolder(holder: GamePropertyViewHolder, position: Int) =
|
||||
holder.bind(properties[position])
|
||||
|
||||
override fun getItemViewType(position: Int): Int {
|
||||
return when (properties[position]) {
|
||||
is SubmenuProperty -> PropertyType.Submenu.ordinal
|
||||
@ -63,14 +54,10 @@ class GamePropertiesAdapter(
|
||||
}
|
||||
}
|
||||
|
||||
sealed class GamePropertyViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
abstract fun bind(property: GameProperty)
|
||||
}
|
||||
|
||||
inner class SubmenuPropertyViewHolder(val binding: CardSimpleOutlinedBinding) :
|
||||
GamePropertyViewHolder(binding.root) {
|
||||
override fun bind(property: GameProperty) {
|
||||
val submenuProperty = property as SubmenuProperty
|
||||
AbstractViewHolder<GameProperty>(binding) {
|
||||
override fun bind(model: GameProperty) {
|
||||
val submenuProperty = model as SubmenuProperty
|
||||
|
||||
binding.root.setOnClickListener {
|
||||
submenuProperty.action.invoke()
|
||||
@ -86,31 +73,23 @@ class GamePropertiesAdapter(
|
||||
)
|
||||
)
|
||||
|
||||
binding.details.postDelayed({
|
||||
binding.details.isSelected = true
|
||||
binding.details.ellipsize = TextUtils.TruncateAt.MARQUEE
|
||||
}, 3000)
|
||||
|
||||
binding.details.marquee()
|
||||
if (submenuProperty.details != null) {
|
||||
binding.details.visibility = View.VISIBLE
|
||||
binding.details.setVisible(true)
|
||||
binding.details.text = submenuProperty.details.invoke()
|
||||
} else if (submenuProperty.detailsFlow != null) {
|
||||
binding.details.visibility = View.VISIBLE
|
||||
viewLifecycle.lifecycleScope.launch {
|
||||
viewLifecycle.repeatOnLifecycle(Lifecycle.State.STARTED) {
|
||||
submenuProperty.detailsFlow.collect { binding.details.text = it }
|
||||
}
|
||||
}
|
||||
binding.details.setVisible(true)
|
||||
submenuProperty.detailsFlow.collect(viewLifecycle) { binding.details.text = it }
|
||||
} else {
|
||||
binding.details.visibility = View.GONE
|
||||
binding.details.setVisible(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inner class InstallablePropertyViewHolder(val binding: CardInstallableIconBinding) :
|
||||
GamePropertyViewHolder(binding.root) {
|
||||
override fun bind(property: GameProperty) {
|
||||
val installableProperty = property as InstallableProperty
|
||||
AbstractViewHolder<GameProperty>(binding) {
|
||||
override fun bind(model: GameProperty) {
|
||||
val installableProperty = model as InstallableProperty
|
||||
|
||||
binding.title.setText(installableProperty.titleId)
|
||||
binding.description.setText(installableProperty.descriptionId)
|
||||
@ -122,14 +101,10 @@ class GamePropertiesAdapter(
|
||||
)
|
||||
)
|
||||
|
||||
if (installableProperty.install != null) {
|
||||
binding.buttonInstall.visibility = View.VISIBLE
|
||||
binding.buttonInstall.setOnClickListener { installableProperty.install.invoke() }
|
||||
}
|
||||
if (installableProperty.export != null) {
|
||||
binding.buttonExport.visibility = View.VISIBLE
|
||||
binding.buttonExport.setOnClickListener { installableProperty.export.invoke() }
|
||||
}
|
||||
binding.buttonInstall.setVisible(installableProperty.install != null)
|
||||
binding.buttonInstall.setOnClickListener { installableProperty.install?.invoke() }
|
||||
binding.buttonExport.setVisible(installableProperty.export != null)
|
||||
binding.buttonExport.setOnClickListener { installableProperty.export?.invoke() }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,80 +3,45 @@
|
||||
|
||||
package org.yuzu.yuzu_emu.adapters
|
||||
|
||||
import android.text.TextUtils
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.lifecycle.repeatOnLifecycle
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import kotlinx.coroutines.launch
|
||||
import org.yuzu.yuzu_emu.R
|
||||
import org.yuzu.yuzu_emu.databinding.CardHomeOptionBinding
|
||||
import org.yuzu.yuzu_emu.fragments.MessageDialogFragment
|
||||
import org.yuzu.yuzu_emu.model.HomeSetting
|
||||
import org.yuzu.yuzu_emu.utils.ViewUtils.marquee
|
||||
import org.yuzu.yuzu_emu.utils.ViewUtils.setVisible
|
||||
import org.yuzu.yuzu_emu.utils.collect
|
||||
import org.yuzu.yuzu_emu.viewholder.AbstractViewHolder
|
||||
|
||||
class HomeSettingAdapter(
|
||||
private val activity: AppCompatActivity,
|
||||
private val viewLifecycle: LifecycleOwner,
|
||||
var options: List<HomeSetting>
|
||||
) :
|
||||
RecyclerView.Adapter<HomeSettingAdapter.HomeOptionViewHolder>(),
|
||||
View.OnClickListener {
|
||||
options: List<HomeSetting>
|
||||
) : AbstractListAdapter<HomeSetting, HomeSettingAdapter.HomeOptionViewHolder>(options) {
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): HomeOptionViewHolder {
|
||||
val binding =
|
||||
CardHomeOptionBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
binding.root.setOnClickListener(this)
|
||||
return HomeOptionViewHolder(binding)
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return options.size
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: HomeOptionViewHolder, position: Int) {
|
||||
holder.bind(options[position])
|
||||
}
|
||||
|
||||
override fun onClick(view: View) {
|
||||
val holder = view.tag as HomeOptionViewHolder
|
||||
if (holder.option.isEnabled.invoke()) {
|
||||
holder.option.onClick.invoke()
|
||||
} else {
|
||||
MessageDialogFragment.newInstance(
|
||||
activity,
|
||||
titleId = holder.option.disabledTitleId,
|
||||
descriptionId = holder.option.disabledMessageId
|
||||
).show(activity.supportFragmentManager, MessageDialogFragment.TAG)
|
||||
}
|
||||
CardHomeOptionBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
.also { return HomeOptionViewHolder(it) }
|
||||
}
|
||||
|
||||
inner class HomeOptionViewHolder(val binding: CardHomeOptionBinding) :
|
||||
RecyclerView.ViewHolder(binding.root) {
|
||||
lateinit var option: HomeSetting
|
||||
|
||||
init {
|
||||
itemView.tag = this
|
||||
}
|
||||
|
||||
fun bind(option: HomeSetting) {
|
||||
this.option = option
|
||||
binding.optionTitle.text = activity.resources.getString(option.titleId)
|
||||
binding.optionDescription.text = activity.resources.getString(option.descriptionId)
|
||||
AbstractViewHolder<HomeSetting>(binding) {
|
||||
override fun bind(model: HomeSetting) {
|
||||
binding.optionTitle.text = activity.resources.getString(model.titleId)
|
||||
binding.optionDescription.text = activity.resources.getString(model.descriptionId)
|
||||
binding.optionIcon.setImageDrawable(
|
||||
ResourcesCompat.getDrawable(
|
||||
activity.resources,
|
||||
option.iconId,
|
||||
model.iconId,
|
||||
activity.theme
|
||||
)
|
||||
)
|
||||
|
||||
when (option.titleId) {
|
||||
when (model.titleId) {
|
||||
R.string.get_early_access ->
|
||||
binding.optionLayout.background =
|
||||
ContextCompat.getDrawable(
|
||||
@ -85,30 +50,34 @@ class HomeSettingAdapter(
|
||||
)
|
||||
}
|
||||
|
||||
if (!option.isEnabled.invoke()) {
|
||||
if (!model.isEnabled.invoke()) {
|
||||
binding.optionTitle.alpha = 0.5f
|
||||
binding.optionDescription.alpha = 0.5f
|
||||
binding.optionIcon.alpha = 0.5f
|
||||
}
|
||||
|
||||
viewLifecycle.lifecycleScope.launch {
|
||||
viewLifecycle.repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||
option.details.collect { updateOptionDetails(it) }
|
||||
}
|
||||
model.details.collect(viewLifecycle) { updateOptionDetails(it) }
|
||||
binding.optionDetail.marquee()
|
||||
|
||||
binding.root.setOnClickListener { onClick(model) }
|
||||
}
|
||||
|
||||
private fun onClick(model: HomeSetting) {
|
||||
if (model.isEnabled.invoke()) {
|
||||
model.onClick.invoke()
|
||||
} else {
|
||||
MessageDialogFragment.newInstance(
|
||||
activity,
|
||||
titleId = model.disabledTitleId,
|
||||
descriptionId = model.disabledMessageId
|
||||
).show(activity.supportFragmentManager, MessageDialogFragment.TAG)
|
||||
}
|
||||
binding.optionDetail.postDelayed(
|
||||
{
|
||||
binding.optionDetail.ellipsize = TextUtils.TruncateAt.MARQUEE
|
||||
binding.optionDetail.isSelected = true
|
||||
},
|
||||
3000
|
||||
)
|
||||
}
|
||||
|
||||
private fun updateOptionDetails(detailString: String) {
|
||||
if (detailString.isNotEmpty()) {
|
||||
binding.optionDetail.text = detailString
|
||||
binding.optionDetail.visibility = View.VISIBLE
|
||||
binding.optionDetail.setVisible(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,46 +4,32 @@
|
||||
package org.yuzu.yuzu_emu.adapters
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.yuzu.yuzu_emu.databinding.CardInstallableBinding
|
||||
import org.yuzu.yuzu_emu.model.Installable
|
||||
import org.yuzu.yuzu_emu.utils.ViewUtils.setVisible
|
||||
import org.yuzu.yuzu_emu.viewholder.AbstractViewHolder
|
||||
|
||||
class InstallableAdapter(private val installables: List<Installable>) :
|
||||
RecyclerView.Adapter<InstallableAdapter.InstallableViewHolder>() {
|
||||
class InstallableAdapter(installables: List<Installable>) :
|
||||
AbstractListAdapter<Installable, InstallableAdapter.InstallableViewHolder>(installables) {
|
||||
override fun onCreateViewHolder(
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): InstallableAdapter.InstallableViewHolder {
|
||||
val binding =
|
||||
CardInstallableBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
return InstallableViewHolder(binding)
|
||||
CardInstallableBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
.also { return InstallableViewHolder(it) }
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = installables.size
|
||||
|
||||
override fun onBindViewHolder(holder: InstallableAdapter.InstallableViewHolder, position: Int) =
|
||||
holder.bind(installables[position])
|
||||
|
||||
inner class InstallableViewHolder(val binding: CardInstallableBinding) :
|
||||
RecyclerView.ViewHolder(binding.root) {
|
||||
lateinit var installable: Installable
|
||||
AbstractViewHolder<Installable>(binding) {
|
||||
override fun bind(model: Installable) {
|
||||
binding.title.setText(model.titleId)
|
||||
binding.description.setText(model.descriptionId)
|
||||
|
||||
fun bind(installable: Installable) {
|
||||
this.installable = installable
|
||||
|
||||
binding.title.setText(installable.titleId)
|
||||
binding.description.setText(installable.descriptionId)
|
||||
|
||||
if (installable.install != null) {
|
||||
binding.buttonInstall.visibility = View.VISIBLE
|
||||
binding.buttonInstall.setOnClickListener { installable.install.invoke() }
|
||||
}
|
||||
if (installable.export != null) {
|
||||
binding.buttonExport.visibility = View.VISIBLE
|
||||
binding.buttonExport.setOnClickListener { installable.export.invoke() }
|
||||
}
|
||||
binding.buttonInstall.setVisible(model.install != null)
|
||||
binding.buttonInstall.setOnClickListener { model.install?.invoke() }
|
||||
binding.buttonExport.setVisible(model.export != null)
|
||||
binding.buttonExport.setOnClickListener { model.export?.invoke() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,52 +4,36 @@
|
||||
package org.yuzu.yuzu_emu.adapters
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder
|
||||
import org.yuzu.yuzu_emu.YuzuApplication
|
||||
import org.yuzu.yuzu_emu.databinding.ListItemSettingBinding
|
||||
import org.yuzu.yuzu_emu.fragments.LicenseBottomSheetDialogFragment
|
||||
import org.yuzu.yuzu_emu.model.License
|
||||
import org.yuzu.yuzu_emu.utils.ViewUtils.setVisible
|
||||
import org.yuzu.yuzu_emu.viewholder.AbstractViewHolder
|
||||
|
||||
class LicenseAdapter(private val activity: AppCompatActivity, var licenses: List<License>) :
|
||||
RecyclerView.Adapter<LicenseAdapter.LicenseViewHolder>(),
|
||||
View.OnClickListener {
|
||||
class LicenseAdapter(private val activity: AppCompatActivity, licenses: List<License>) :
|
||||
AbstractListAdapter<License, LicenseAdapter.LicenseViewHolder>(licenses) {
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): LicenseViewHolder {
|
||||
val binding =
|
||||
ListItemSettingBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
binding.root.setOnClickListener(this)
|
||||
return LicenseViewHolder(binding)
|
||||
ListItemSettingBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
.also { return LicenseViewHolder(it) }
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = licenses.size
|
||||
inner class LicenseViewHolder(val binding: ListItemSettingBinding) :
|
||||
AbstractViewHolder<License>(binding) {
|
||||
override fun bind(model: License) {
|
||||
binding.apply {
|
||||
textSettingName.text = root.context.getString(model.titleId)
|
||||
textSettingDescription.text = root.context.getString(model.descriptionId)
|
||||
textSettingValue.setVisible(false)
|
||||
|
||||
override fun onBindViewHolder(holder: LicenseViewHolder, position: Int) {
|
||||
holder.bind(licenses[position])
|
||||
}
|
||||
|
||||
override fun onClick(view: View) {
|
||||
val license = (view.tag as LicenseViewHolder).license
|
||||
LicenseBottomSheetDialogFragment.newInstance(license)
|
||||
.show(activity.supportFragmentManager, LicenseBottomSheetDialogFragment.TAG)
|
||||
}
|
||||
|
||||
inner class LicenseViewHolder(val binding: ListItemSettingBinding) : ViewHolder(binding.root) {
|
||||
lateinit var license: License
|
||||
|
||||
init {
|
||||
itemView.tag = this
|
||||
root.setOnClickListener { onClick(model) }
|
||||
}
|
||||
}
|
||||
|
||||
fun bind(license: License) {
|
||||
this.license = license
|
||||
|
||||
val context = YuzuApplication.appContext
|
||||
binding.textSettingName.text = context.getString(license.titleId)
|
||||
binding.textSettingDescription.text = context.getString(license.descriptionId)
|
||||
binding.textSettingValue.visibility = View.GONE
|
||||
private fun onClick(license: License) {
|
||||
LicenseBottomSheetDialogFragment.newInstance(license)
|
||||
.show(activity.supportFragmentManager, LicenseBottomSheetDialogFragment.TAG)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,12 +5,10 @@ package org.yuzu.yuzu_emu.adapters
|
||||
|
||||
import android.text.Html
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import org.yuzu.yuzu_emu.databinding.PageSetupBinding
|
||||
import org.yuzu.yuzu_emu.model.HomeViewModel
|
||||
@ -18,63 +16,52 @@ import org.yuzu.yuzu_emu.model.SetupCallback
|
||||
import org.yuzu.yuzu_emu.model.SetupPage
|
||||
import org.yuzu.yuzu_emu.model.StepState
|
||||
import org.yuzu.yuzu_emu.utils.ViewUtils
|
||||
import org.yuzu.yuzu_emu.utils.ViewUtils.setVisible
|
||||
import org.yuzu.yuzu_emu.viewholder.AbstractViewHolder
|
||||
|
||||
class SetupAdapter(val activity: AppCompatActivity, val pages: List<SetupPage>) :
|
||||
RecyclerView.Adapter<SetupAdapter.SetupPageViewHolder>() {
|
||||
class SetupAdapter(val activity: AppCompatActivity, pages: List<SetupPage>) :
|
||||
AbstractListAdapter<SetupPage, SetupAdapter.SetupPageViewHolder>(pages) {
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SetupPageViewHolder {
|
||||
val binding = PageSetupBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
return SetupPageViewHolder(binding)
|
||||
PageSetupBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
.also { return SetupPageViewHolder(it) }
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = pages.size
|
||||
|
||||
override fun onBindViewHolder(holder: SetupPageViewHolder, position: Int) =
|
||||
holder.bind(pages[position])
|
||||
|
||||
inner class SetupPageViewHolder(val binding: PageSetupBinding) :
|
||||
RecyclerView.ViewHolder(binding.root), SetupCallback {
|
||||
lateinit var page: SetupPage
|
||||
|
||||
init {
|
||||
itemView.tag = this
|
||||
}
|
||||
|
||||
fun bind(page: SetupPage) {
|
||||
this.page = page
|
||||
|
||||
if (page.stepCompleted.invoke() == StepState.COMPLETE) {
|
||||
binding.buttonAction.visibility = View.INVISIBLE
|
||||
binding.textConfirmation.visibility = View.VISIBLE
|
||||
AbstractViewHolder<SetupPage>(binding), SetupCallback {
|
||||
override fun bind(model: SetupPage) {
|
||||
if (model.stepCompleted.invoke() == StepState.COMPLETE) {
|
||||
binding.buttonAction.setVisible(visible = false, gone = false)
|
||||
binding.textConfirmation.setVisible(true)
|
||||
}
|
||||
|
||||
binding.icon.setImageDrawable(
|
||||
ResourcesCompat.getDrawable(
|
||||
activity.resources,
|
||||
page.iconId,
|
||||
model.iconId,
|
||||
activity.theme
|
||||
)
|
||||
)
|
||||
binding.textTitle.text = activity.resources.getString(page.titleId)
|
||||
binding.textTitle.text = activity.resources.getString(model.titleId)
|
||||
binding.textDescription.text =
|
||||
Html.fromHtml(activity.resources.getString(page.descriptionId), 0)
|
||||
Html.fromHtml(activity.resources.getString(model.descriptionId), 0)
|
||||
|
||||
binding.buttonAction.apply {
|
||||
text = activity.resources.getString(page.buttonTextId)
|
||||
if (page.buttonIconId != 0) {
|
||||
text = activity.resources.getString(model.buttonTextId)
|
||||
if (model.buttonIconId != 0) {
|
||||
icon = ResourcesCompat.getDrawable(
|
||||
activity.resources,
|
||||
page.buttonIconId,
|
||||
model.buttonIconId,
|
||||
activity.theme
|
||||
)
|
||||
}
|
||||
iconGravity =
|
||||
if (page.leftAlignedIcon) {
|
||||
if (model.leftAlignedIcon) {
|
||||
MaterialButton.ICON_GRAVITY_START
|
||||
} else {
|
||||
MaterialButton.ICON_GRAVITY_END
|
||||
}
|
||||
setOnClickListener {
|
||||
page.buttonAction.invoke(this@SetupPageViewHolder)
|
||||
model.buttonAction.invoke(this@SetupPageViewHolder)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,416 @@
|
||||
// SPDX-FileCopyrightText: 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
package org.yuzu.yuzu_emu.features.input
|
||||
|
||||
import org.yuzu.yuzu_emu.features.input.model.NativeButton
|
||||
import org.yuzu.yuzu_emu.features.input.model.NativeAnalog
|
||||
import org.yuzu.yuzu_emu.features.input.model.InputType
|
||||
import org.yuzu.yuzu_emu.features.input.model.ButtonName
|
||||
import org.yuzu.yuzu_emu.features.input.model.NpadStyleIndex
|
||||
import org.yuzu.yuzu_emu.utils.NativeConfig
|
||||
import org.yuzu.yuzu_emu.utils.ParamPackage
|
||||
import android.view.InputDevice
|
||||
|
||||
object NativeInput {
|
||||
/**
|
||||
* Default controller id for each device
|
||||
*/
|
||||
const val Player1Device = 0
|
||||
const val Player2Device = 1
|
||||
const val Player3Device = 2
|
||||
const val Player4Device = 3
|
||||
const val Player5Device = 4
|
||||
const val Player6Device = 5
|
||||
const val Player7Device = 6
|
||||
const val Player8Device = 7
|
||||
const val ConsoleDevice = 8
|
||||
|
||||
/**
|
||||
* Button states
|
||||
*/
|
||||
object ButtonState {
|
||||
const val RELEASED = 0
|
||||
const val PRESSED = 1
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if pro controller isn't available and handheld is.
|
||||
* Intended to check where the input overlay should direct its inputs.
|
||||
*/
|
||||
external fun isHandheldOnly(): Boolean
|
||||
|
||||
/**
|
||||
* Handles button press events for a gamepad.
|
||||
* @param guid 32 character hexadecimal string consisting of the controller's PID+VID.
|
||||
* @param port Port determined by controller connection order.
|
||||
* @param buttonId The Android Keycode corresponding to this event.
|
||||
* @param action Mask identifying which action is happening (button pressed down, or button released).
|
||||
*/
|
||||
external fun onGamePadButtonEvent(
|
||||
guid: String,
|
||||
port: Int,
|
||||
buttonId: Int,
|
||||
action: Int
|
||||
)
|
||||
|
||||
/**
|
||||
* Handles axis movement events.
|
||||
* @param guid 32 character hexadecimal string consisting of the controller's PID+VID.
|
||||
* @param port Port determined by controller connection order.
|
||||
* @param axis The axis ID.
|
||||
* @param value Value along the given axis.
|
||||
*/
|
||||
external fun onGamePadAxisEvent(guid: String, port: Int, axis: Int, value: Float)
|
||||
|
||||
/**
|
||||
* Handles motion events.
|
||||
* @param guid 32 character hexadecimal string consisting of the controller's PID+VID.
|
||||
* @param port Port determined by controller connection order.
|
||||
* @param deltaTimestamp The finger id corresponding to this event.
|
||||
* @param xGyro The value of the x-axis for the gyroscope.
|
||||
* @param yGyro The value of the y-axis for the gyroscope.
|
||||
* @param zGyro The value of the z-axis for the gyroscope.
|
||||
* @param xAccel The value of the x-axis for the accelerometer.
|
||||
* @param yAccel The value of the y-axis for the accelerometer.
|
||||
* @param zAccel The value of the z-axis for the accelerometer.
|
||||
*/
|
||||
external fun onGamePadMotionEvent(
|
||||
guid: String,
|
||||
port: Int,
|
||||
deltaTimestamp: Long,
|
||||
xGyro: Float,
|
||||
yGyro: Float,
|
||||
zGyro: Float,
|
||||
xAccel: Float,
|
||||
yAccel: Float,
|
||||
zAccel: Float
|
||||
)
|
||||
|
||||
/**
|
||||
* Signals and load a nfc tag
|
||||
* @param data Byte array containing all the data from a nfc tag.
|
||||
*/
|
||||
external fun onReadNfcTag(data: ByteArray?)
|
||||
|
||||
/**
|
||||
* Removes current loaded nfc tag.
|
||||
*/
|
||||
external fun onRemoveNfcTag()
|
||||
|
||||
/**
|
||||
* Handles touch press events.
|
||||
* @param fingerId The finger id corresponding to this event.
|
||||
* @param xAxis The value of the x-axis on the touchscreen.
|
||||
* @param yAxis The value of the y-axis on the touchscreen.
|
||||
*/
|
||||
external fun onTouchPressed(fingerId: Int, xAxis: Float, yAxis: Float)
|
||||
|
||||
/**
|
||||
* Handles touch movement.
|
||||
* @param fingerId The finger id corresponding to this event.
|
||||
* @param xAxis The value of the x-axis on the touchscreen.
|
||||
* @param yAxis The value of the y-axis on the touchscreen.
|
||||
*/
|
||||
external fun onTouchMoved(fingerId: Int, xAxis: Float, yAxis: Float)
|
||||
|
||||
/**
|
||||
* Handles touch release events.
|
||||
* @param fingerId The finger id corresponding to this event
|
||||
*/
|
||||
external fun onTouchReleased(fingerId: Int)
|
||||
|
||||
/**
|
||||
* Sends a button input to the global virtual controllers.
|
||||
* @param port Port determined by controller connection order.
|
||||
* @param button The [NativeButton] corresponding to this event.
|
||||
* @param action Mask identifying which action is happening (button pressed down, or button released).
|
||||
*/
|
||||
fun onOverlayButtonEvent(port: Int, button: NativeButton, action: Int) =
|
||||
onOverlayButtonEventImpl(port, button.int, action)
|
||||
|
||||
private external fun onOverlayButtonEventImpl(port: Int, buttonId: Int, action: Int)
|
||||
|
||||
/**
|
||||
* Sends a joystick input to the global virtual controllers.
|
||||
* @param port Port determined by controller connection order.
|
||||
* @param stick The [NativeAnalog] corresponding to this event.
|
||||
* @param xAxis Value along the X axis.
|
||||
* @param yAxis Value along the Y axis.
|
||||
*/
|
||||
fun onOverlayJoystickEvent(port: Int, stick: NativeAnalog, xAxis: Float, yAxis: Float) =
|
||||
onOverlayJoystickEventImpl(port, stick.int, xAxis, yAxis)
|
||||
|
||||
private external fun onOverlayJoystickEventImpl(
|
||||
port: Int,
|
||||
stickId: Int,
|
||||
xAxis: Float,
|
||||
yAxis: Float
|
||||
)
|
||||
|
||||
/**
|
||||
* Handles motion events for the global virtual controllers.
|
||||
* @param port Port determined by controller connection order
|
||||
* @param deltaTimestamp The finger id corresponding to this event.
|
||||
* @param xGyro The value of the x-axis for the gyroscope.
|
||||
* @param yGyro The value of the y-axis for the gyroscope.
|
||||
* @param zGyro The value of the z-axis for the gyroscope.
|
||||
* @param xAccel The value of the x-axis for the accelerometer.
|
||||
* @param yAccel The value of the y-axis for the accelerometer.
|
||||
* @param zAccel The value of the z-axis for the accelerometer.
|
||||
*/
|
||||
external fun onDeviceMotionEvent(
|
||||
port: Int,
|
||||
deltaTimestamp: Long,
|
||||
xGyro: Float,
|
||||
yGyro: Float,
|
||||
zGyro: Float,
|
||||
xAccel: Float,
|
||||
yAccel: Float,
|
||||
zAccel: Float
|
||||
)
|
||||
|
||||
/**
|
||||
* Reloads all input devices from the currently loaded Settings::values.players into HID Core
|
||||
*/
|
||||
external fun reloadInputDevices()
|
||||
|
||||
/**
|
||||
* Registers a controller to be used with mapping
|
||||
* @param device An [InputDevice] or the input overlay wrapped with [YuzuInputDevice]
|
||||
*/
|
||||
external fun registerController(device: YuzuInputDevice)
|
||||
|
||||
/**
|
||||
* Gets the names of input devices that have been registered with the input subsystem via [registerController]
|
||||
*/
|
||||
external fun getInputDevices(): Array<String>
|
||||
|
||||
/**
|
||||
* Reads all input profiles from disk. Must be called before creating a profile picker.
|
||||
*/
|
||||
external fun loadInputProfiles()
|
||||
|
||||
/**
|
||||
* Gets the names of each available input profile.
|
||||
*/
|
||||
external fun getInputProfileNames(): Array<String>
|
||||
|
||||
/**
|
||||
* Checks if the user-provided name for an input profile is valid.
|
||||
* @param name User-provided name for an input profile.
|
||||
* @return Whether [name] is valid or not.
|
||||
*/
|
||||
external fun isProfileNameValid(name: String): Boolean
|
||||
|
||||
/**
|
||||
* Creates a new input profile.
|
||||
* @param name The new profile's name.
|
||||
* @param playerIndex Index of the player that's currently being edited. Used to write the profile
|
||||
* name to this player's config.
|
||||
* @return Whether creating the profile was successful or not.
|
||||
*/
|
||||
external fun createProfile(name: String, playerIndex: Int): Boolean
|
||||
|
||||
/**
|
||||
* Deletes an input profile.
|
||||
* @param name Name of the profile to delete.
|
||||
* @param playerIndex Index of the player that's currently being edited. Used to remove the profile
|
||||
* name from this player's config if they have it loaded.
|
||||
* @return Whether deleting this profile was successful or not.
|
||||
*/
|
||||
external fun deleteProfile(name: String, playerIndex: Int): Boolean
|
||||
|
||||
/**
|
||||
* Loads an input profile.
|
||||
* @param name Name of the input profile to load.
|
||||
* @param playerIndex Index of the player that will have this profile loaded.
|
||||
* @return Whether loading this profile was successful or not.
|
||||
*/
|
||||
external fun loadProfile(name: String, playerIndex: Int): Boolean
|
||||
|
||||
/**
|
||||
* Saves an input profile.
|
||||
* @param name Name of the profile to save.
|
||||
* @param playerIndex Index of the player that's currently being edited. Used to write the profile
|
||||
* name to this player's config.
|
||||
* @return Whether saving the profile was successful or not.
|
||||
*/
|
||||
external fun saveProfile(name: String, playerIndex: Int): Boolean
|
||||
|
||||
/**
|
||||
* Intended to be used immediately before a call to [NativeConfig.saveControlPlayerValues]
|
||||
* Must be used while per-game config is loaded.
|
||||
*/
|
||||
external fun loadPerGameConfiguration(
|
||||
playerIndex: Int,
|
||||
selectedIndex: Int,
|
||||
selectedProfileName: String
|
||||
)
|
||||
|
||||
/**
|
||||
* Tells the input subsystem to start listening for inputs to map.
|
||||
* @param type Type of input to map as shown by the int property in each [InputType].
|
||||
*/
|
||||
external fun beginMapping(type: Int)
|
||||
|
||||
/**
|
||||
* Gets an input's [ParamPackage] as a serialized string. Used for input verification before mapping.
|
||||
* Must be run after [beginMapping] and before [stopMapping].
|
||||
*/
|
||||
external fun getNextInput(): String
|
||||
|
||||
/**
|
||||
* Tells the input subsystem to stop listening for inputs to map.
|
||||
*/
|
||||
external fun stopMapping()
|
||||
|
||||
/**
|
||||
* Updates a controller's mappings with auto-mapping params.
|
||||
* @param playerIndex Index of the player to auto-map.
|
||||
* @param deviceParams [ParamPackage] representing the device to auto-map as received
|
||||
* from [getInputDevices].
|
||||
* @param displayName Name of the device to auto-map as received from the "display" param in [deviceParams].
|
||||
* Intended to be a way to provide a default name for a controller if the "display" param is empty.
|
||||
*/
|
||||
fun updateMappingsWithDefault(
|
||||
playerIndex: Int,
|
||||
deviceParams: ParamPackage,
|
||||
displayName: String
|
||||
) = updateMappingsWithDefaultImpl(playerIndex, deviceParams.serialize(), displayName)
|
||||
|
||||
private external fun updateMappingsWithDefaultImpl(
|
||||
playerIndex: Int,
|
||||
deviceParams: String,
|
||||
displayName: String
|
||||
)
|
||||
|
||||
/**
|
||||
* Gets the params for a specific button.
|
||||
* @param playerIndex Index of the player to get params from.
|
||||
* @param button The [NativeButton] to get params for.
|
||||
* @return A [ParamPackage] representing a player's specific button.
|
||||
*/
|
||||
fun getButtonParam(playerIndex: Int, button: NativeButton): ParamPackage =
|
||||
ParamPackage(getButtonParamImpl(playerIndex, button.int))
|
||||
|
||||
private external fun getButtonParamImpl(playerIndex: Int, buttonId: Int): String
|
||||
|
||||
/**
|
||||
* Sets the params for a specific button.
|
||||
* @param playerIndex Index of the player to set params for.
|
||||
* @param button The [NativeButton] to set params for.
|
||||
* @param param A [ParamPackage] to set.
|
||||
*/
|
||||
fun setButtonParam(playerIndex: Int, button: NativeButton, param: ParamPackage) =
|
||||
setButtonParamImpl(playerIndex, button.int, param.serialize())
|
||||
|
||||
private external fun setButtonParamImpl(playerIndex: Int, buttonId: Int, param: String)
|
||||
|
||||
/**
|
||||
* Gets the params for a specific stick.
|
||||
* @param playerIndex Index of the player to get params from.
|
||||
* @param stick The [NativeAnalog] to get params for.
|
||||
* @return A [ParamPackage] representing a player's specific stick.
|
||||
*/
|
||||
fun getStickParam(playerIndex: Int, stick: NativeAnalog): ParamPackage =
|
||||
ParamPackage(getStickParamImpl(playerIndex, stick.int))
|
||||
|
||||
private external fun getStickParamImpl(playerIndex: Int, stickId: Int): String
|
||||
|
||||
/**
|
||||
* Sets the params for a specific stick.
|
||||
* @param playerIndex Index of the player to set params for.
|
||||
* @param stick The [NativeAnalog] to set params for.
|
||||
* @param param A [ParamPackage] to set.
|
||||
*/
|
||||
fun setStickParam(playerIndex: Int, stick: NativeAnalog, param: ParamPackage) =
|
||||
setStickParamImpl(playerIndex, stick.int, param.serialize())
|
||||
|
||||
private external fun setStickParamImpl(playerIndex: Int, stickId: Int, param: String)
|
||||
|
||||
/**
|
||||
* Gets the int representation of a [ButtonName]. Tells you what to show as the mapped input for
|
||||
* a button/analog/other.
|
||||
* @param param A [ParamPackage] that represents a specific button's params.
|
||||
* @return The [ButtonName] for [param].
|
||||
*/
|
||||
fun getButtonName(param: ParamPackage): ButtonName =
|
||||
ButtonName.from(getButtonNameImpl(param.serialize()))
|
||||
|
||||
private external fun getButtonNameImpl(param: String): Int
|
||||
|
||||
/**
|
||||
* Gets each supported [NpadStyleIndex] for a given player.
|
||||
* @param playerIndex Index of the player to get supported indexes for.
|
||||
* @return List of each supported [NpadStyleIndex].
|
||||
*/
|
||||
fun getSupportedStyleTags(playerIndex: Int): List<NpadStyleIndex> =
|
||||
getSupportedStyleTagsImpl(playerIndex).map { NpadStyleIndex.from(it) }
|
||||
|
||||
private external fun getSupportedStyleTagsImpl(playerIndex: Int): IntArray
|
||||
|
||||
/**
|
||||
* Gets the [NpadStyleIndex] for a given player.
|
||||
* @param playerIndex Index of the player to get an [NpadStyleIndex] from.
|
||||
* @return The [NpadStyleIndex] for a given player.
|
||||
*/
|
||||
fun getStyleIndex(playerIndex: Int): NpadStyleIndex =
|
||||
NpadStyleIndex.from(getStyleIndexImpl(playerIndex))
|
||||
|
||||
private external fun getStyleIndexImpl(playerIndex: Int): Int
|
||||
|
||||
/**
|
||||
* Sets the [NpadStyleIndex] for a given player.
|
||||
* @param playerIndex Index of the player to change.
|
||||
* @param style The new style to set.
|
||||
*/
|
||||
fun setStyleIndex(playerIndex: Int, style: NpadStyleIndex) =
|
||||
setStyleIndexImpl(playerIndex, style.int)
|
||||
|
||||
private external fun setStyleIndexImpl(playerIndex: Int, styleIndex: Int)
|
||||
|
||||
/**
|
||||
* Checks if a device is a controller.
|
||||
* @param params [ParamPackage] for an input device retrieved from [getInputDevices]
|
||||
* @return Whether the device is a controller or not.
|
||||
*/
|
||||
fun isController(params: ParamPackage): Boolean = isControllerImpl(params.serialize())
|
||||
|
||||
private external fun isControllerImpl(params: String): Boolean
|
||||
|
||||
/**
|
||||
* Checks if a controller is connected
|
||||
* @param playerIndex Index of the player to check.
|
||||
* @return Whether the player is connected or not.
|
||||
*/
|
||||
external fun getIsConnected(playerIndex: Int): Boolean
|
||||
|
||||
/**
|
||||
* Connects/disconnects a controller and ensures that connection order stays in-tact.
|
||||
* @param playerIndex Index of the player to connect/disconnect.
|
||||
* @param connected Whether to connect or disconnect this controller.
|
||||
*/
|
||||
fun connectControllers(playerIndex: Int, connected: Boolean = true) {
|
||||
val connectedControllers = mutableListOf<Boolean>().apply {
|
||||
if (connected) {
|
||||
for (i in 0 until 8) {
|
||||
add(i <= playerIndex)
|
||||
}
|
||||
} else {
|
||||
for (i in 0 until 8) {
|
||||
add(i < playerIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
connectControllersImpl(connectedControllers.toBooleanArray())
|
||||
}
|
||||
|
||||
private external fun connectControllersImpl(connected: BooleanArray)
|
||||
|
||||
/**
|
||||
* Resets all of the button and analog mappings for a player.
|
||||
* @param playerIndex Index of the player that will have its mappings reset.
|
||||
*/
|
||||
external fun resetControllerMappings(playerIndex: Int)
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
// SPDX-FileCopyrightText: 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
package org.yuzu.yuzu_emu.features.input
|
||||
|
||||
import android.view.InputDevice
|
||||
import androidx.annotation.Keep
|
||||
import org.yuzu.yuzu_emu.YuzuApplication
|
||||
import org.yuzu.yuzu_emu.R
|
||||
import org.yuzu.yuzu_emu.utils.InputHandler.getGUID
|
||||
|
||||
@Keep
|
||||
interface YuzuInputDevice {
|
||||
fun getName(): String
|
||||
|
||||
fun getGUID(): String
|
||||
|
||||
fun getPort(): Int
|
||||
|
||||
fun getSupportsVibration(): Boolean
|
||||
|
||||
fun vibrate(intensity: Float)
|
||||
|
||||
fun getAxes(): Array<Int> = arrayOf()
|
||||
fun hasKeys(keys: IntArray): BooleanArray = BooleanArray(0)
|
||||
}
|
||||
|
||||
class YuzuPhysicalDevice(
|
||||
private val device: InputDevice,
|
||||
private val port: Int,
|
||||
useSystemVibrator: Boolean
|
||||
) : YuzuInputDevice {
|
||||
private val vibrator = if (useSystemVibrator) {
|
||||
YuzuVibrator.getSystemVibrator()
|
||||
} else {
|
||||
YuzuVibrator.getControllerVibrator(device)
|
||||
}
|
||||
|
||||
override fun getName(): String {
|
||||
return device.name
|
||||
}
|
||||
|
||||
override fun getGUID(): String {
|
||||
return device.getGUID()
|
||||
}
|
||||
|
||||
override fun getPort(): Int {
|
||||
return port
|
||||
}
|
||||
|
||||
override fun getSupportsVibration(): Boolean {
|
||||
return vibrator.supportsVibration()
|
||||
}
|
||||
|
||||
override fun vibrate(intensity: Float) {
|
||||
vibrator.vibrate(intensity)
|
||||
}
|
||||
|
||||
override fun getAxes(): Array<Int> = device.motionRanges.map { it.axis }.toTypedArray()
|
||||
override fun hasKeys(keys: IntArray): BooleanArray = device.hasKeys(*keys)
|
||||
}
|
||||
|
||||
class YuzuInputOverlayDevice(
|
||||
private val vibration: Boolean,
|
||||
private val port: Int
|
||||
) : YuzuInputDevice {
|
||||
private val vibrator = YuzuVibrator.getSystemVibrator()
|
||||
|
||||
override fun getName(): String {
|
||||
return YuzuApplication.appContext.getString(R.string.input_overlay)
|
||||
}
|
||||
|
||||
override fun getGUID(): String {
|
||||
return "00000000000000000000000000000000"
|
||||
}
|
||||
|
||||
override fun getPort(): Int {
|
||||
return port
|
||||
}
|
||||
|
||||
override fun getSupportsVibration(): Boolean {
|
||||
if (vibration) {
|
||||
return vibrator.supportsVibration()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
override fun vibrate(intensity: Float) {
|
||||
if (vibration) {
|
||||
vibrator.vibrate(intensity)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
// SPDX-FileCopyrightText: 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
package org.yuzu.yuzu_emu.features.input
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.os.CombinedVibration
|
||||
import android.os.VibrationEffect
|
||||
import android.os.Vibrator
|
||||
import android.os.VibratorManager
|
||||
import android.view.InputDevice
|
||||
import androidx.annotation.Keep
|
||||
import androidx.annotation.RequiresApi
|
||||
import org.yuzu.yuzu_emu.YuzuApplication
|
||||
|
||||
@Keep
|
||||
@Suppress("DEPRECATION")
|
||||
interface YuzuVibrator {
|
||||
fun supportsVibration(): Boolean
|
||||
|
||||
fun vibrate(intensity: Float)
|
||||
|
||||
companion object {
|
||||
fun getControllerVibrator(device: InputDevice): YuzuVibrator =
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
YuzuVibratorManager(device.vibratorManager)
|
||||
} else {
|
||||
YuzuVibratorManagerCompat(device.vibrator)
|
||||
}
|
||||
|
||||
fun getSystemVibrator(): YuzuVibrator =
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
val vibratorManager = YuzuApplication.appContext
|
||||
.getSystemService(Context.VIBRATOR_MANAGER_SERVICE) as VibratorManager
|
||||
YuzuVibratorManager(vibratorManager)
|
||||
} else {
|
||||
val vibrator = YuzuApplication.appContext
|
||||
.getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
|
||||
YuzuVibratorManagerCompat(vibrator)
|
||||
}
|
||||
|
||||
fun getVibrationEffect(intensity: Float): VibrationEffect? {
|
||||
if (intensity > 0f) {
|
||||
return VibrationEffect.createOneShot(
|
||||
50,
|
||||
(255.0 * intensity).toInt().coerceIn(1, 255)
|
||||
)
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.S)
|
||||
class YuzuVibratorManager(private val vibratorManager: VibratorManager) : YuzuVibrator {
|
||||
override fun supportsVibration(): Boolean {
|
||||
return vibratorManager.vibratorIds.isNotEmpty()
|
||||
}
|
||||
|
||||
override fun vibrate(intensity: Float) {
|
||||
val vibration = YuzuVibrator.getVibrationEffect(intensity) ?: return
|
||||
vibratorManager.vibrate(CombinedVibration.createParallel(vibration))
|
||||
}
|
||||
}
|
||||
|
||||
class YuzuVibratorManagerCompat(private val vibrator: Vibrator) : YuzuVibrator {
|
||||
override fun supportsVibration(): Boolean {
|
||||
return vibrator.hasVibrator()
|
||||
}
|
||||
|
||||
override fun vibrate(intensity: Float) {
|
||||
val vibration = YuzuVibrator.getVibrationEffect(intensity) ?: return
|
||||
vibrator.vibrate(vibration)
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
// SPDX-FileCopyrightText: 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
package org.yuzu.yuzu_emu.features.input.model
|
||||
|
||||
enum class AnalogDirection(val int: Int, val param: String) {
|
||||
Up(0, "up"),
|
||||
Down(1, "down"),
|
||||
Left(2, "left"),
|
||||
Right(3, "right")
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
// SPDX-FileCopyrightText: 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
package org.yuzu.yuzu_emu.features.input.model
|
||||
|
||||
// Loosely matches the enum in common/input.h
|
||||
enum class ButtonName(val int: Int) {
|
||||
Invalid(1),
|
||||
|
||||
// This will display the engine name instead of the button name
|
||||
Engine(2),
|
||||
|
||||
// This will display the button by value instead of the button name
|
||||
Value(3);
|
||||
|
||||
companion object {
|
||||
fun from(int: Int): ButtonName = entries.firstOrNull { it.int == int } ?: Invalid
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
// SPDX-FileCopyrightText: 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
package org.yuzu.yuzu_emu.features.input.model
|
||||
|
||||
// Must match the corresponding enum in input_common/main.h
|
||||
enum class InputType(val int: Int) {
|
||||
None(0),
|
||||
Button(1),
|
||||
Stick(2),
|
||||
Motion(3),
|
||||
Touch(4)
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
// SPDX-FileCopyrightText: 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
package org.yuzu.yuzu_emu.features.input.model
|
||||
|
||||
// Must match enum in src/common/settings_input.h
|
||||
enum class NativeAnalog(val int: Int) {
|
||||
LStick(0),
|
||||
RStick(1);
|
||||
|
||||
companion object {
|
||||
fun from(int: Int): NativeAnalog = entries.firstOrNull { it.int == int } ?: LStick
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
// SPDX-FileCopyrightText: 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
package org.yuzu.yuzu_emu.features.input.model
|
||||
|
||||
// Must match enum in src/common/settings_input.h
|
||||
enum class NativeButton(val int: Int) {
|
||||
A(0),
|
||||
B(1),
|
||||
X(2),
|
||||
Y(3),
|
||||
LStick(4),
|
||||
RStick(5),
|
||||
L(6),
|
||||
R(7),
|
||||
ZL(8),
|
||||
ZR(9),
|
||||
Plus(10),
|
||||
Minus(11),
|
||||
|
||||
DLeft(12),
|
||||
DUp(13),
|
||||
DRight(14),
|
||||
DDown(15),
|
||||
|
||||
SLLeft(16),
|
||||
SRLeft(17),
|
||||
|
||||
Home(18),
|
||||
Capture(19),
|
||||
|
||||
SLRight(20),
|
||||
SRRight(21);
|
||||
|
||||
companion object {
|
||||
fun from(int: Int): NativeButton = entries.firstOrNull { it.int == int } ?: A
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
// SPDX-FileCopyrightText: 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
package org.yuzu.yuzu_emu.features.input.model
|
||||
|
||||
// Must match enum in src/common/settings_input.h
|
||||
enum class NativeTrigger(val int: Int) {
|
||||
LTrigger(0),
|
||||
RTrigger(1)
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
// SPDX-FileCopyrightText: 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
package org.yuzu.yuzu_emu.features.input.model
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
import org.yuzu.yuzu_emu.R
|
||||
|
||||
// Must match enum in src/core/hid/hid_types.h
|
||||
enum class NpadStyleIndex(val int: Int, @StringRes val nameId: Int = 0) {
|
||||
None(0),
|
||||
Fullkey(3, R.string.pro_controller),
|
||||
Handheld(4, R.string.handheld),
|
||||
HandheldNES(4),
|
||||
JoyconDual(5, R.string.dual_joycons),
|
||||
JoyconLeft(6, R.string.left_joycon),
|
||||
JoyconRight(7, R.string.right_joycon),
|
||||
GameCube(8, R.string.gamecube_controller),
|
||||
Pokeball(9),
|
||||
NES(10),
|
||||
SNES(12),
|
||||
N64(13),
|
||||
SegaGenesis(14),
|
||||
SystemExt(32),
|
||||
System(33);
|
||||
|
||||
companion object {
|
||||
fun from(int: Int): NpadStyleIndex = entries.firstOrNull { it.int == int } ?: None
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
// SPDX-FileCopyrightText: 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
package org.yuzu.yuzu_emu.features.input.model
|
||||
|
||||
import androidx.annotation.Keep
|
||||
|
||||
@Keep
|
||||
data class PlayerInput(
|
||||
var connected: Boolean,
|
||||
var buttons: Array<String>,
|
||||
var analogs: Array<String>,
|
||||
var motions: Array<String>,
|
||||
|
||||
var vibrationEnabled: Boolean,
|
||||
var vibrationStrength: Int,
|
||||
|
||||
var bodyColorLeft: Long,
|
||||
var bodyColorRight: Long,
|
||||
var buttonColorLeft: Long,
|
||||
var buttonColorRight: Long,
|
||||
var profileName: String,
|
||||
|
||||
var useSystemVibrator: Boolean
|
||||
) {
|
||||
// It's recommended to use the generated equals() and hashCode() methods
|
||||
// when using arrays in a data class
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as PlayerInput
|
||||
|
||||
if (connected != other.connected) return false
|
||||
if (!buttons.contentEquals(other.buttons)) return false
|
||||
if (!analogs.contentEquals(other.analogs)) return false
|
||||
if (!motions.contentEquals(other.motions)) return false
|
||||
if (vibrationEnabled != other.vibrationEnabled) return false
|
||||
if (vibrationStrength != other.vibrationStrength) return false
|
||||
if (bodyColorLeft != other.bodyColorLeft) return false
|
||||
if (bodyColorRight != other.bodyColorRight) return false
|
||||
if (buttonColorLeft != other.buttonColorLeft) return false
|
||||
if (buttonColorRight != other.buttonColorRight) return false
|
||||
if (profileName != other.profileName) return false
|
||||
return useSystemVibrator == other.useSystemVibrator
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = connected.hashCode()
|
||||
result = 31 * result + buttons.contentHashCode()
|
||||
result = 31 * result + analogs.contentHashCode()
|
||||
result = 31 * result + motions.contentHashCode()
|
||||
result = 31 * result + vibrationEnabled.hashCode()
|
||||
result = 31 * result + vibrationStrength
|
||||
result = 31 * result + bodyColorLeft.hashCode()
|
||||
result = 31 * result + bodyColorRight.hashCode()
|
||||
result = 31 * result + buttonColorLeft.hashCode()
|
||||
result = 31 * result + buttonColorRight.hashCode()
|
||||
result = 31 * result + profileName.hashCode()
|
||||
result = 31 * result + useSystemVibrator.hashCode()
|
||||
return result
|
||||
}
|
||||
|
||||
fun hasMapping(): Boolean {
|
||||
var hasMapping = false
|
||||
buttons.forEach {
|
||||
if (it != "[empty]" && it.isNotEmpty()) {
|
||||
hasMapping = true
|
||||
}
|
||||
}
|
||||
analogs.forEach {
|
||||
if (it != "[empty]" && it.isNotEmpty()) {
|
||||
hasMapping = true
|
||||
}
|
||||
}
|
||||
motions.forEach {
|
||||
if (it != "[empty]" && it.isNotEmpty()) {
|
||||
hasMapping = true
|
||||
}
|
||||
}
|
||||
return hasMapping
|
||||
}
|
||||
}
|
@ -18,7 +18,15 @@ enum class BooleanSetting(override val key: String) : AbstractBooleanSetting {
|
||||
RENDERER_REACTIVE_FLUSHING("use_reactive_flushing"),
|
||||
RENDERER_DEBUG("debug"),
|
||||
PICTURE_IN_PICTURE("picture_in_picture"),
|
||||
USE_CUSTOM_RTC("custom_rtc_enabled");
|
||||
USE_CUSTOM_RTC("custom_rtc_enabled"),
|
||||
BLACK_BACKGROUNDS("black_backgrounds"),
|
||||
JOYSTICK_REL_CENTER("joystick_rel_center"),
|
||||
DPAD_SLIDE("dpad_slide"),
|
||||
HAPTIC_FEEDBACK("haptic_feedback"),
|
||||
SHOW_PERFORMANCE_OVERLAY("show_performance_overlay"),
|
||||
SHOW_INPUT_OVERLAY("show_input_overlay"),
|
||||
TOUCHSCREEN("touchscreen"),
|
||||
SHOW_THERMAL_OVERLAY("show_thermal_overlay");
|
||||
|
||||
override fun getBoolean(needsGlobal: Boolean): Boolean =
|
||||
NativeConfig.getBoolean(key, needsGlobal)
|
||||
|
@ -18,7 +18,15 @@ enum class IntSetting(override val key: String) : AbstractIntSetting {
|
||||
RENDERER_ANTI_ALIASING("anti_aliasing"),
|
||||
RENDERER_SCREEN_LAYOUT("screen_layout"),
|
||||
RENDERER_ASPECT_RATIO("aspect_ratio"),
|
||||
AUDIO_OUTPUT_ENGINE("output_engine");
|
||||
AUDIO_OUTPUT_ENGINE("output_engine"),
|
||||
MAX_ANISOTROPY("max_anisotropy"),
|
||||
THEME("theme"),
|
||||
THEME_MODE("theme_mode"),
|
||||
OVERLAY_SCALE("control_scale"),
|
||||
OVERLAY_OPACITY("control_opacity"),
|
||||
LOCK_DRAWER("lock_drawer"),
|
||||
VERTICAL_ALIGNMENT("vertical_alignment"),
|
||||
FSR_SHARPENING_SLIDER("fsr_sharpening_slider");
|
||||
|
||||
override fun getInt(needsGlobal: Boolean): Int = NativeConfig.getInt(key, needsGlobal)
|
||||
|
||||
|
@ -4,29 +4,34 @@
|
||||
package org.yuzu.yuzu_emu.features.settings.model
|
||||
|
||||
import org.yuzu.yuzu_emu.R
|
||||
import org.yuzu.yuzu_emu.YuzuApplication
|
||||
|
||||
object Settings {
|
||||
enum class MenuTag(val titleId: Int) {
|
||||
enum class MenuTag(val titleId: Int = 0) {
|
||||
SECTION_ROOT(R.string.advanced_settings),
|
||||
SECTION_SYSTEM(R.string.preferences_system),
|
||||
SECTION_RENDERER(R.string.preferences_graphics),
|
||||
SECTION_AUDIO(R.string.preferences_audio),
|
||||
SECTION_INPUT(R.string.preferences_controls),
|
||||
SECTION_INPUT_PLAYER_ONE,
|
||||
SECTION_INPUT_PLAYER_TWO,
|
||||
SECTION_INPUT_PLAYER_THREE,
|
||||
SECTION_INPUT_PLAYER_FOUR,
|
||||
SECTION_INPUT_PLAYER_FIVE,
|
||||
SECTION_INPUT_PLAYER_SIX,
|
||||
SECTION_INPUT_PLAYER_SEVEN,
|
||||
SECTION_INPUT_PLAYER_EIGHT,
|
||||
SECTION_THEME(R.string.preferences_theme),
|
||||
SECTION_DEBUG(R.string.preferences_debug);
|
||||
}
|
||||
|
||||
fun getPlayerString(player: Int): String =
|
||||
YuzuApplication.appContext.getString(R.string.preferences_player, player)
|
||||
|
||||
const val PREF_FIRST_APP_LAUNCH = "FirstApplicationLaunch"
|
||||
const val PREF_MEMORY_WARNING_SHOWN = "MemoryWarningShown"
|
||||
|
||||
const val PREF_OVERLAY_VERSION = "OverlayVersion"
|
||||
const val PREF_LANDSCAPE_OVERLAY_VERSION = "LandscapeOverlayVersion"
|
||||
const val PREF_PORTRAIT_OVERLAY_VERSION = "PortraitOverlayVersion"
|
||||
const val PREF_FOLDABLE_OVERLAY_VERSION = "FoldableOverlayVersion"
|
||||
val overlayLayoutPrefs = listOf(
|
||||
PREF_LANDSCAPE_OVERLAY_VERSION,
|
||||
PREF_PORTRAIT_OVERLAY_VERSION,
|
||||
PREF_FOLDABLE_OVERLAY_VERSION
|
||||
)
|
||||
|
||||
// Deprecated input overlay preference keys
|
||||
const val PREF_CONTROL_SCALE = "controlScale"
|
||||
const val PREF_CONTROL_OPACITY = "controlOpacity"
|
||||
const val PREF_TOUCH_ENABLED = "isTouchEnabled"
|
||||
@ -47,23 +52,12 @@ object Settings {
|
||||
const val PREF_BUTTON_STICK_R = "buttonToggle14"
|
||||
const val PREF_BUTTON_HOME = "buttonToggle15"
|
||||
const val PREF_BUTTON_SCREENSHOT = "buttonToggle16"
|
||||
|
||||
const val PREF_MENU_SETTINGS_JOYSTICK_REL_CENTER = "EmulationMenuSettings_JoystickRelCenter"
|
||||
const val PREF_MENU_SETTINGS_DPAD_SLIDE = "EmulationMenuSettings_DpadSlideEnable"
|
||||
const val PREF_MENU_SETTINGS_HAPTICS = "EmulationMenuSettings_Haptics"
|
||||
const val PREF_MENU_SETTINGS_SHOW_FPS = "EmulationMenuSettings_ShowFps"
|
||||
const val PREF_MENU_SETTINGS_SHOW_OVERLAY = "EmulationMenuSettings_ShowOverlay"
|
||||
|
||||
const val PREF_FIRST_APP_LAUNCH = "FirstApplicationLaunch"
|
||||
const val PREF_THEME = "Theme"
|
||||
const val PREF_THEME_MODE = "ThemeMode"
|
||||
const val PREF_BLACK_BACKGROUNDS = "BlackBackgrounds"
|
||||
|
||||
val overlayPreferences = listOf(
|
||||
PREF_OVERLAY_VERSION,
|
||||
PREF_CONTROL_SCALE,
|
||||
PREF_CONTROL_OPACITY,
|
||||
PREF_TOUCH_ENABLED,
|
||||
PREF_BUTTON_A,
|
||||
PREF_BUTTON_B,
|
||||
PREF_BUTTON_X,
|
||||
@ -83,7 +77,44 @@ object Settings {
|
||||
PREF_BUTTON_STICK_R
|
||||
)
|
||||
|
||||
const val LayoutOption_Unspecified = 0
|
||||
const val LayoutOption_MobilePortrait = 4
|
||||
const val LayoutOption_MobileLandscape = 5
|
||||
// Deprecated layout preference keys
|
||||
const val PREF_LANDSCAPE_SUFFIX = "_Landscape"
|
||||
const val PREF_PORTRAIT_SUFFIX = "_Portrait"
|
||||
const val PREF_FOLDABLE_SUFFIX = "_Foldable"
|
||||
val overlayLayoutSuffixes = listOf(
|
||||
PREF_LANDSCAPE_SUFFIX,
|
||||
PREF_PORTRAIT_SUFFIX,
|
||||
PREF_FOLDABLE_SUFFIX
|
||||
)
|
||||
|
||||
// Deprecated theme preference keys
|
||||
const val PREF_THEME = "Theme"
|
||||
const val PREF_THEME_MODE = "ThemeMode"
|
||||
const val PREF_BLACK_BACKGROUNDS = "BlackBackgrounds"
|
||||
|
||||
enum class EmulationOrientation(val int: Int) {
|
||||
Unspecified(0),
|
||||
SensorLandscape(5),
|
||||
Landscape(1),
|
||||
ReverseLandscape(2),
|
||||
SensorPortrait(6),
|
||||
Portrait(4),
|
||||
ReversePortrait(3);
|
||||
|
||||
companion object {
|
||||
fun from(int: Int): EmulationOrientation =
|
||||
entries.firstOrNull { it.int == int } ?: Unspecified
|
||||
}
|
||||
}
|
||||
|
||||
enum class EmulationVerticalAlignment(val int: Int) {
|
||||
Top(1),
|
||||
Center(0),
|
||||
Bottom(2);
|
||||
|
||||
companion object {
|
||||
fun from(int: Int): EmulationVerticalAlignment =
|
||||
entries.firstOrNull { it.int == int } ?: Center
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,8 @@ package org.yuzu.yuzu_emu.features.settings.model
|
||||
import org.yuzu.yuzu_emu.utils.NativeConfig
|
||||
|
||||
enum class StringSetting(override val key: String) : AbstractStringSetting {
|
||||
DRIVER_PATH("driver_path");
|
||||
DRIVER_PATH("driver_path"),
|
||||
DEVICE_NAME("device_name");
|
||||
|
||||
override fun getString(needsGlobal: Boolean): String = NativeConfig.getString(key, needsGlobal)
|
||||
|
||||
|
@ -0,0 +1,31 @@
|
||||
// SPDX-FileCopyrightText: 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
package org.yuzu.yuzu_emu.features.settings.model.view
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
import org.yuzu.yuzu_emu.features.input.NativeInput
|
||||
import org.yuzu.yuzu_emu.features.input.model.AnalogDirection
|
||||
import org.yuzu.yuzu_emu.features.input.model.InputType
|
||||
import org.yuzu.yuzu_emu.features.input.model.NativeAnalog
|
||||
import org.yuzu.yuzu_emu.utils.ParamPackage
|
||||
|
||||
class AnalogInputSetting(
|
||||
override val playerIndex: Int,
|
||||
val nativeAnalog: NativeAnalog,
|
||||
val analogDirection: AnalogDirection,
|
||||
@StringRes titleId: Int = 0,
|
||||
titleString: String = ""
|
||||
) : InputSetting(titleId, titleString) {
|
||||
override val type = TYPE_INPUT
|
||||
override val inputType = InputType.Stick
|
||||
|
||||
override fun getSelectedValue(): String {
|
||||
val params = NativeInput.getStickParam(playerIndex, nativeAnalog)
|
||||
val analog = analogToText(params, analogDirection.param)
|
||||
return getDisplayString(params, analog)
|
||||
}
|
||||
|
||||
override fun setSelectedValue(param: ParamPackage) =
|
||||
NativeInput.setStickParam(playerIndex, nativeAnalog, param)
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
// SPDX-FileCopyrightText: 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
package org.yuzu.yuzu_emu.features.settings.model.view
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
import org.yuzu.yuzu_emu.utils.ParamPackage
|
||||
import org.yuzu.yuzu_emu.features.input.NativeInput
|
||||
import org.yuzu.yuzu_emu.features.input.model.InputType
|
||||
import org.yuzu.yuzu_emu.features.input.model.NativeButton
|
||||
|
||||
class ButtonInputSetting(
|
||||
override val playerIndex: Int,
|
||||
val nativeButton: NativeButton,
|
||||
@StringRes titleId: Int = 0,
|
||||
titleString: String = ""
|
||||
) : InputSetting(titleId, titleString) {
|
||||
override val type = TYPE_INPUT
|
||||
override val inputType = InputType.Button
|
||||
|
||||
override fun getSelectedValue(): String {
|
||||
val params = NativeInput.getButtonParam(playerIndex, nativeButton)
|
||||
val button = buttonToText(params)
|
||||
return getDisplayString(params, button)
|
||||
}
|
||||
|
||||
override fun setSelectedValue(param: ParamPackage) =
|
||||
NativeInput.setButtonParam(playerIndex, nativeButton, param)
|
||||
}
|
@ -3,13 +3,16 @@
|
||||
|
||||
package org.yuzu.yuzu_emu.features.settings.model.view
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
import org.yuzu.yuzu_emu.features.settings.model.AbstractLongSetting
|
||||
|
||||
class DateTimeSetting(
|
||||
private val longSetting: AbstractLongSetting,
|
||||
titleId: Int,
|
||||
descriptionId: Int
|
||||
) : SettingsItem(longSetting, titleId, descriptionId) {
|
||||
@StringRes titleId: Int = 0,
|
||||
titleString: String = "",
|
||||
@StringRes descriptionId: Int = 0,
|
||||
descriptionString: String = ""
|
||||
) : SettingsItem(longSetting, titleId, titleString, descriptionId, descriptionString) {
|
||||
override val type = TYPE_DATETIME_SETTING
|
||||
|
||||
fun getValue(needsGlobal: Boolean = false): Long = longSetting.getLong(needsGlobal)
|
||||
|
@ -3,8 +3,11 @@
|
||||
|
||||
package org.yuzu.yuzu_emu.features.settings.model.view
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
|
||||
class HeaderSetting(
|
||||
titleId: Int
|
||||
) : SettingsItem(emptySetting, titleId, 0) {
|
||||
@StringRes titleId: Int = 0,
|
||||
titleString: String = ""
|
||||
) : SettingsItem(emptySetting, titleId, titleString, 0, "") {
|
||||
override val type = TYPE_HEADER
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
// SPDX-FileCopyrightText: 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
package org.yuzu.yuzu_emu.features.settings.model.view
|
||||
|
||||
import org.yuzu.yuzu_emu.R
|
||||
import org.yuzu.yuzu_emu.features.input.NativeInput
|
||||
import org.yuzu.yuzu_emu.utils.NativeConfig
|
||||
|
||||
class InputProfileSetting(private val playerIndex: Int) :
|
||||
SettingsItem(emptySetting, R.string.profile, "", 0, "") {
|
||||
override val type = TYPE_INPUT_PROFILE
|
||||
|
||||
fun getCurrentProfile(): String =
|
||||
NativeConfig.getInputSettings(true)[playerIndex].profileName
|
||||
|
||||
fun getProfileNames(): Array<String> = NativeInput.getInputProfileNames()
|
||||
|
||||
fun isProfileNameValid(name: String): Boolean = NativeInput.isProfileNameValid(name)
|
||||
|
||||
fun createProfile(name: String): Boolean = NativeInput.createProfile(name, playerIndex)
|
||||
|
||||
fun deleteProfile(name: String): Boolean = NativeInput.deleteProfile(name, playerIndex)
|
||||
|
||||
fun loadProfile(name: String): Boolean {
|
||||
val result = NativeInput.loadProfile(name, playerIndex)
|
||||
NativeInput.reloadInputDevices()
|
||||
return result
|
||||
}
|
||||
|
||||
fun saveProfile(name: String): Boolean = NativeInput.saveProfile(name, playerIndex)
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user