mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-10-22 08:07:22 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5034bd72ed | ||
|
|
5b7c144796 | ||
|
|
e45b6b9b85 | ||
|
|
245f242fb8 | ||
|
|
a6fccf93d1 | ||
|
|
3dcab90752 | ||
|
|
30a5f405f5 | ||
|
|
bad1c9628e | ||
|
|
1ab7bca43f | ||
|
|
7d0a53773c | ||
|
|
789236ee8f | ||
|
|
21cba0b080 | ||
|
|
31eb0891e5 | ||
|
|
a13f8e7937 | ||
|
|
5bfe56472f | ||
|
|
16a9ed682e | ||
|
|
59cae610d2 | ||
|
|
29ac7893d7 | ||
|
|
c8aeca8ace | ||
|
|
3da505c4c6 | ||
|
|
06bc05b708 | ||
|
|
a3dc9593c2 | ||
|
|
18a271a0ec | ||
|
|
cebd3bf751 | ||
|
|
cb04925c6e | ||
|
|
b7a340bd00 | ||
|
|
2a0f837120 | ||
|
|
d00bdff495 | ||
|
|
7e9c977b3d | ||
|
|
1629151528 | ||
|
|
24295197bd | ||
|
|
807dd84daa | ||
|
|
17848c097c | ||
|
|
563b760d31 | ||
|
|
8465a27a97 | ||
|
|
255cbd1e7e | ||
|
|
7717749b72 | ||
|
|
9e4337babf | ||
|
|
6771877a84 | ||
|
|
a860bd8dd5 | ||
|
|
704ce4ff0c | ||
|
|
21edcc8113 | ||
|
|
125738f13d | ||
|
|
02c781b8f4 | ||
|
|
453fe6aea0 | ||
|
|
e0fb7dfd14 | ||
|
|
c4012225c2 | ||
|
|
1750243537 | ||
|
|
84fc5f3008 | ||
|
|
8a224fbae4 | ||
|
|
e6c4332445 | ||
|
|
0928d1fab2 | ||
|
|
40dd588bef | ||
|
|
472e8ee92e | ||
|
|
c55af7fff3 | ||
|
|
7a39daf179 | ||
|
|
8d087ba5b1 | ||
|
|
c7a30d8728 | ||
|
|
1f678cafba | ||
|
|
579e0bc464 | ||
|
|
7f36dc5aad | ||
|
|
a7c2026128 | ||
|
|
7b0d67ebbe | ||
|
|
63f0910eac | ||
|
|
b16cf9fcc5 | ||
|
|
5501d7bc6b | ||
|
|
413ef42a34 | ||
|
|
a1694ab951 | ||
|
|
fbbbd5e0b8 | ||
|
|
f8c7e2ee41 | ||
|
|
2a4af0bc2c | ||
|
|
d24db13e9d | ||
|
|
bc68aad67b | ||
|
|
9e8a4cab7b | ||
|
|
3679964cf8 | ||
|
|
225ec1a87f | ||
|
|
071c76c06a | ||
|
|
d77a255721 | ||
|
|
26ee1aee25 | ||
|
|
b047395938 | ||
|
|
483a601867 | ||
|
|
c4bc2f6adf | ||
|
|
439e8fe33f | ||
|
|
99885f5b4b | ||
|
|
78b522ec1d | ||
|
|
dbfa5a9358 | ||
|
|
3910b3862a | ||
|
|
3b8e3b7d5c | ||
|
|
6129000dde | ||
|
|
65b274d695 | ||
|
|
a13dd0076b | ||
|
|
cc026c995c | ||
|
|
81cfacaa3d | ||
|
|
fabebc05d2 | ||
|
|
07a97bab03 | ||
|
|
69ac810c82 | ||
|
|
3f4609dc6e | ||
|
|
1ddb529d26 | ||
|
|
ab6b88073c | ||
|
|
ad3ed97472 | ||
|
|
07e902fe95 | ||
|
|
eb781ce689 | ||
|
|
555a65c8ea | ||
|
|
58429f4172 | ||
|
|
e2692a0abd | ||
|
|
d218c43edf | ||
|
|
fae9813127 | ||
|
|
adc56d4ee5 | ||
|
|
f982e33fab | ||
|
|
9ab4479fcf | ||
|
|
3e330b7929 | ||
|
|
ecddada150 | ||
|
|
0c828cbb37 | ||
|
|
84a32f8c16 | ||
|
|
4ee36fd405 | ||
|
|
0802609fd8 | ||
|
|
de88176995 | ||
|
|
aca82f400a | ||
|
|
54bb6fe527 | ||
|
|
c1f663cec1 | ||
|
|
aaf59c2d01 | ||
|
|
692942e5be | ||
|
|
f4acd629a1 | ||
|
|
0ff8a44ec3 | ||
|
|
c6d8f6e618 | ||
|
|
1baa23cc43 | ||
|
|
3be696e6bb | ||
|
|
3cfcb01603 | ||
|
|
d39a29759c | ||
|
|
bf4332b9e7 | ||
|
|
feaae7b684 | ||
|
|
be7852dfc0 | ||
|
|
b0804ce048 | ||
|
|
aa7d5fa924 | ||
|
|
b4cab12e9d | ||
|
|
133dda2de0 | ||
|
|
ef5605ae39 | ||
|
|
9b29b2702e | ||
|
|
abafa270e5 | ||
|
|
15852ccf81 | ||
|
|
a427ecd029 | ||
|
|
77228dcb2c | ||
|
|
3948cfe495 | ||
|
|
36218b54f8 | ||
|
|
be2f4433db | ||
|
|
dd5d36cf07 | ||
|
|
685136d98f | ||
|
|
852937421e | ||
|
|
a5389b7be5 | ||
|
|
1b96b18bc0 | ||
|
|
e9edad6f8c | ||
|
|
f8a6012c3a | ||
|
|
e103f6c9b6 | ||
|
|
9daf7b5a36 | ||
|
|
d6142e1af0 | ||
|
|
b0491210ff | ||
|
|
91d8550290 | ||
|
|
dfaaa7d72a | ||
|
|
5174a4f58a | ||
|
|
b9c73df488 | ||
|
|
f99f1f6441 | ||
|
|
1ec1f5d3be | ||
|
|
713db06a05 | ||
|
|
a0adcbd90b | ||
|
|
b94776421c | ||
|
|
79c1043063 | ||
|
|
cfabae17c0 | ||
|
|
71a1d25e90 | ||
|
|
c2d7b835fb | ||
|
|
f72888ce6f | ||
|
|
30f474d253 | ||
|
|
216f274a92 | ||
|
|
5ea79efe4b | ||
|
|
197c1ba21b | ||
|
|
95c4a24d99 | ||
|
|
f5f23a7c22 | ||
|
|
c469576460 | ||
|
|
0001bb0e4c | ||
|
|
56f184393f | ||
|
|
85777e85fa | ||
|
|
c750ec3cc7 | ||
|
|
c75b781d3f | ||
|
|
8aa42ff1d9 | ||
|
|
63a5bc5e12 | ||
|
|
e0b7b6dc3d | ||
|
|
3d7ecf98c2 | ||
|
|
ad5581c620 | ||
|
|
69af991772 | ||
|
|
2bb2745f91 | ||
|
|
5f682bb45f | ||
|
|
48bcb6b9a6 | ||
|
|
092c0a7392 | ||
|
|
4e8618c512 | ||
|
|
c51a69c0dc | ||
|
|
2480849f39 | ||
|
|
6bfe40607d | ||
|
|
a1c350a537 | ||
|
|
f732b1978e | ||
|
|
d3a542bac4 | ||
|
|
b12724db02 | ||
|
|
f8f5e8e869 | ||
|
|
0733f06103 | ||
|
|
6fdaa6ee8a | ||
|
|
f10b547a49 | ||
|
|
38396b2691 | ||
|
|
220f50ebe4 | ||
|
|
c989133d27 | ||
|
|
6c339551eb | ||
|
|
ef23a80b16 | ||
|
|
a521093731 | ||
|
|
747d3eedf1 | ||
|
|
fd563726f0 | ||
|
|
62136a1a96 | ||
|
|
cf16c31d38 | ||
|
|
0f5d4aa72f | ||
|
|
d8dbe77427 | ||
|
|
0e5670d50d | ||
|
|
22924a1e92 | ||
|
|
e3a7b54f90 | ||
|
|
81d5e7f014 | ||
|
|
9790c218dc | ||
|
|
6d3d51553b | ||
|
|
474591c6a5 | ||
|
|
5de0dc2713 | ||
|
|
57a34a7abb | ||
|
|
54517bda1b | ||
|
|
4291e15b60 | ||
|
|
940ae6406b | ||
|
|
6a0cf4bfd3 | ||
|
|
fee6f75223 | ||
|
|
8c93b2d54c | ||
|
|
dbbb1bd8a1 | ||
|
|
5c838b2fc5 | ||
|
|
3a094d4ba8 | ||
|
|
5d11c1ea6a | ||
|
|
a7e2e15eac | ||
|
|
585a0ca1f4 | ||
|
|
09ed82db65 | ||
|
|
a56cb0e88a | ||
|
|
9acf5ff0ef | ||
|
|
64a7790aed | ||
|
|
9a5134ffcf | ||
|
|
1d2c4d0843 | ||
|
|
efad34be62 | ||
|
|
52761ade87 | ||
|
|
e6b816e776 | ||
|
|
6d3bcba5d0 | ||
|
|
2e7ffa606b | ||
|
|
055cae90b8 | ||
|
|
23acf92803 | ||
|
|
91ee7d76eb | ||
|
|
570888e2b8 | ||
|
|
282f27f0c8 | ||
|
|
98376ade45 | ||
|
|
9682968b55 | ||
|
|
877cb5f1b0 | ||
|
|
6972573a6e | ||
|
|
742f1b1283 | ||
|
|
0b127a2f3b | ||
|
|
a6057835a8 | ||
|
|
c32794477e | ||
|
|
999ac60bda | ||
|
|
bca4b832a8 | ||
|
|
2fc1dda232 | ||
|
|
99495cff90 | ||
|
|
795962a4ba | ||
|
|
7bde9f447a | ||
|
|
b45c3e3c7f | ||
|
|
ce2a01fc59 | ||
|
|
edeea65c3e | ||
|
|
6e8ee94b91 | ||
|
|
97d8274911 | ||
|
|
73d84dc13f | ||
|
|
f32501d498 | ||
|
|
9c289c3fe9 | ||
|
|
2a610584ee | ||
|
|
8e06421567 | ||
|
|
57dc3725f5 | ||
|
|
d6ef8945f5 | ||
|
|
e078a8b7b6 | ||
|
|
a6395b9025 | ||
|
|
6c0983d77c | ||
|
|
4ae39f2bd5 | ||
|
|
71fc701809 | ||
|
|
d418921e4b | ||
|
|
4b83b022d3 | ||
|
|
8b13e5b47e | ||
|
|
0bfd565bda | ||
|
|
2224a558ee | ||
|
|
93c02fb43a | ||
|
|
93ee51cabb | ||
|
|
cd6ba554a4 | ||
|
|
89aa2be358 | ||
|
|
da261246b9 | ||
|
|
4d3e09f4a0 | ||
|
|
9add6b3696 | ||
|
|
ef037e18d0 | ||
|
|
36db791516 | ||
|
|
25d2ea5e94 | ||
|
|
34f2d18f27 | ||
|
|
4935c846aa | ||
|
|
b1f980c216 | ||
|
|
738f64c903 | ||
|
|
7235663447 | ||
|
|
9d78c416f7 | ||
|
|
9a64c026ea | ||
|
|
be2af1d17a | ||
|
|
b21131a466 | ||
|
|
41c5126472 | ||
|
|
b96cb1abaf | ||
|
|
20143606e2 | ||
|
|
1d79bcc657 | ||
|
|
e8b4494fc3 | ||
|
|
2518208c5c | ||
|
|
918fea7d4b | ||
|
|
4dc07bf63f | ||
|
|
04a0aca221 | ||
|
|
1942e72474 | ||
|
|
f256407789 | ||
|
|
67612f607e | ||
|
|
7274c42126 | ||
|
|
e288402e88 | ||
|
|
76bd4a1c7b | ||
|
|
13dbad6f35 | ||
|
|
cf089fdfe9 | ||
|
|
9755e31fa2 | ||
|
|
3fcf31d009 | ||
|
|
1cbdd0e675 | ||
|
|
e0fd84d6f5 | ||
|
|
443720c3de | ||
|
|
254526a213 | ||
|
|
ad0afb5fc9 | ||
|
|
e64b15d2a7 | ||
|
|
cdc3352318 | ||
|
|
2416618b34 | ||
|
|
c951d77a52 | ||
|
|
759ddc0b4b | ||
|
|
a0709bec51 | ||
|
|
f5bc4e7a24 | ||
|
|
b4665b6e5a | ||
|
|
b85d5b8822 | ||
|
|
12ad75a6b0 | ||
|
|
af92fe6ad1 | ||
|
|
fcf7ed4faa | ||
|
|
a58649fd10 | ||
|
|
ee5918cf4e | ||
|
|
d7de3301ed | ||
|
|
bd1988c775 | ||
|
|
474010b31d | ||
|
|
dd941154d6 | ||
|
|
cbb53745f6 | ||
|
|
3dff62e0cf | ||
|
|
719024ec01 | ||
|
|
f0659b4f3c | ||
|
|
a649f2736f | ||
|
|
046ccb1dee | ||
|
|
d340556c28 | ||
|
|
32250db126 | ||
|
|
cb8c30db2e | ||
|
|
dacd5a9e3d | ||
|
|
859d8b96a7 | ||
|
|
02981e3cee | ||
|
|
49892b3ce8 | ||
|
|
b223e7ec36 | ||
|
|
0926337c1d | ||
|
|
346e72a678 | ||
|
|
d612e47b62 | ||
|
|
c138cbf994 | ||
|
|
dfe275ab67 | ||
|
|
d6cfbdb273 | ||
|
|
8a27fa7bb5 | ||
|
|
b9a6fb1fe5 | ||
|
|
4b6194e15e | ||
|
|
e1b3f90f8b | ||
|
|
c5cc0b8c59 | ||
|
|
5c849ec666 | ||
|
|
c2a30cbe19 | ||
|
|
31eddd8da0 | ||
|
|
abf2a14ee6 | ||
|
|
e555874485 | ||
|
|
a7aef8f147 | ||
|
|
5b8c11f1a9 | ||
|
|
645040c943 | ||
|
|
fcc5ea348c | ||
|
|
3fbb45448f | ||
|
|
8a83289709 | ||
|
|
08175de069 | ||
|
|
808933cd70 | ||
|
|
384dd2adab | ||
|
|
4a37952b41 | ||
|
|
1046d264d8 | ||
|
|
bb235ab1ae | ||
|
|
ef88b83727 | ||
|
|
5612e9864e | ||
|
|
8302187dee | ||
|
|
77d07c7c4d | ||
|
|
b2265080fd | ||
|
|
0d70bd9ac0 | ||
|
|
8f63d59b81 | ||
|
|
0395c0cc95 | ||
|
|
72065412a3 | ||
|
|
7af2cdd0ef | ||
|
|
67c801c4e7 | ||
|
|
f7c8ad4c5a | ||
|
|
61092b34de | ||
|
|
1e9e96fb8c | ||
|
|
17d1ced07c | ||
|
|
a26ced04ff | ||
|
|
154b5b6ded | ||
|
|
8219dbef6f | ||
|
|
3da724e76a | ||
|
|
1616d237ae | ||
|
|
3d21facc9f | ||
|
|
fead2a08a3 | ||
|
|
d8acf24af0 | ||
|
|
97412b3c79 | ||
|
|
6145913068 | ||
|
|
e56bb6785f | ||
|
|
6d63d6c54a | ||
|
|
6e8a103e70 | ||
|
|
00d3530f64 | ||
|
|
1e6ca18193 | ||
|
|
5a32992497 | ||
|
|
79ba00a2f4 | ||
|
|
fdfaf8ec70 | ||
|
|
162c58b697 | ||
|
|
75959ca692 | ||
|
|
06fbcd19c8 | ||
|
|
36e0468a99 | ||
|
|
c4d85cf928 | ||
|
|
daf8495acb | ||
|
|
9999ded933 | ||
|
|
80128e8293 | ||
|
|
9579b2c85e | ||
|
|
eb7f184848 | ||
|
|
71b21920e2 | ||
|
|
91b787a5be | ||
|
|
11f659aadb | ||
|
|
0870dd15a8 | ||
|
|
7cd52041d8 | ||
|
|
f2bcb49478 | ||
|
|
60a4bda94f | ||
|
|
54cfc46500 | ||
|
|
c09559ade5 | ||
|
|
3e9aea1f7a | ||
|
|
f0c292f508 | ||
|
|
1444ba2c35 | ||
|
|
fac4c85133 | ||
|
|
97a09e0571 | ||
|
|
c7121516c1 | ||
|
|
56a5fbf63b | ||
|
|
80604a752b | ||
|
|
3fe6e18609 | ||
|
|
47f3f30d83 | ||
|
|
085a904970 | ||
|
|
0fa7723f51 | ||
|
|
84ea483b4c | ||
|
|
4de3aa96b6 | ||
|
|
1193943228 | ||
|
|
2959faca0c | ||
|
|
d0df4fa3a0 | ||
|
|
0a301dd2f9 | ||
|
|
43e3679297 | ||
|
|
0455063854 | ||
|
|
12d90d77c7 | ||
|
|
61d7749aaf | ||
|
|
69fb4a0c37 | ||
|
|
d2c9f058f8 | ||
|
|
acaa3afa0f | ||
|
|
3c58e21cbf | ||
|
|
9d3c5b9bc6 | ||
|
|
ce34358d46 | ||
|
|
278bcec238 | ||
|
|
128f458848 | ||
|
|
7ae2bcd6db | ||
|
|
130f252f97 | ||
|
|
d339e05a3b | ||
|
|
933f4813aa | ||
|
|
f14e71c1d6 | ||
|
|
d78dbd7b0f | ||
|
|
71a6ef6eba | ||
|
|
4873862d16 | ||
|
|
425efe3d72 | ||
|
|
666dc13c01 | ||
|
|
267f9f5759 | ||
|
|
c8d8c00f84 | ||
|
|
dcc567ebda | ||
|
|
a199a3ccc3 | ||
|
|
8159e07427 | ||
|
|
32d70758c5 | ||
|
|
3a9e284f29 | ||
|
|
c658daeac6 | ||
|
|
f605169b15 | ||
|
|
f82b495bcc | ||
|
|
33b44a87c5 | ||
|
|
a88d994fcb | ||
|
|
dd9224d9a6 | ||
|
|
48728efee0 | ||
|
|
043c55ae66 | ||
|
|
fa3f822cf1 | ||
|
|
5afab126b3 | ||
|
|
bee8378795 | ||
|
|
cbd42f4a58 | ||
|
|
3333fd7fc8 | ||
|
|
142258b4b5 | ||
|
|
01213b58ba | ||
|
|
51df7032bb | ||
|
|
c033ce5ecf | ||
|
|
bfaf57cfd0 | ||
|
|
6c523570e5 | ||
|
|
047e5bdd81 | ||
|
|
6b1559d397 | ||
|
|
a3167b8152 | ||
|
|
cbeb23f16a | ||
|
|
b4a6512784 | ||
|
|
1af2742013 | ||
|
|
8048938158 | ||
|
|
3689c7f982 | ||
|
|
96c7057fee | ||
|
|
df7c4c82a9 | ||
|
|
18d8db338b | ||
|
|
9637639e31 | ||
|
|
17abe8f164 | ||
|
|
badaaece04 | ||
|
|
56119eebae | ||
|
|
c17c8e2a2c | ||
|
|
e45a60f2ed | ||
|
|
ebe9356937 | ||
|
|
0094305299 | ||
|
|
b27050d3bf | ||
|
|
d941e596ad | ||
|
|
ddaec92da5 | ||
|
|
1c0a4c92a8 | ||
|
|
383c00afbd | ||
|
|
d3b2bff8ad | ||
|
|
77aaa6141d | ||
|
|
2bb1af61d0 | ||
|
|
40b29472b3 | ||
|
|
5d5029de59 | ||
|
|
cc96e6a222 | ||
|
|
581c9438ca | ||
|
|
54bd427f26 | ||
|
|
c55d184195 | ||
|
|
b279f94789 | ||
|
|
f3a897e99a | ||
|
|
392b1b5904 | ||
|
|
4daa8066a6 | ||
|
|
8a89951286 | ||
|
|
c41ed55291 | ||
|
|
caba0499d7 | ||
|
|
13deacfc3b | ||
|
|
7231085456 | ||
|
|
663bb4aa10 | ||
|
|
18721b4542 | ||
|
|
19232722e2 | ||
|
|
d2eca68484 | ||
|
|
091167478e | ||
|
|
547b8abc56 | ||
|
|
dbfac45d59 | ||
|
|
086f6de867 | ||
|
|
0f93091848 | ||
|
|
ac19f62ed9 | ||
|
|
8fcef63890 | ||
|
|
34cd2c1afa | ||
|
|
5d1a19d49c | ||
|
|
2fbb320539 | ||
|
|
b50e5ed7e6 | ||
|
|
26c82ca72c | ||
|
|
f8a8a431a8 | ||
|
|
fd27867195 | ||
|
|
5e2a627795 | ||
|
|
e081401c2d | ||
|
|
e62a268aac | ||
|
|
140a9e5191 | ||
|
|
51b5f8046f | ||
|
|
91b965d1aa | ||
|
|
f8faccee59 | ||
|
|
6ac46a36a7 | ||
|
|
27572ba4bc | ||
|
|
21be832161 | ||
|
|
5769632793 | ||
|
|
9efd959ed8 | ||
|
|
5c72afe17e | ||
|
|
dc24319333 | ||
|
|
1acbdf94aa | ||
|
|
44229dfe51 | ||
|
|
13206227d9 | ||
|
|
e3e8a57df6 | ||
|
|
7afff80984 | ||
|
|
500522418e | ||
|
|
5ccac5a5c3 | ||
|
|
69822f4401 | ||
|
|
f290cfbd35 | ||
|
|
fae30f59ce | ||
|
|
a15f303c0a | ||
|
|
5e85038d78 | ||
|
|
4e7b35c54e | ||
|
|
48dde310ae | ||
|
|
6b041e7657 | ||
|
|
69576ee1e1 | ||
|
|
bd3105f62e | ||
|
|
02e3f0e71b | ||
|
|
74bf981f3d | ||
|
|
32f0678692 | ||
|
|
e74753bec1 | ||
|
|
4a8c9ad17f | ||
|
|
0c6c882f50 | ||
|
|
579f25c1ba | ||
|
|
d5eb5c8816 | ||
|
|
26d04b5f9c | ||
|
|
a0b9684504 | ||
|
|
402b6d1f0c | ||
|
|
e87a5fa354 | ||
|
|
63574f643e | ||
|
|
1d6b1020c3 | ||
|
|
96337a3230 | ||
|
|
950c59d8b4 | ||
|
|
9cfd095281 | ||
|
|
996e049863 | ||
|
|
6e42817c3e | ||
|
|
7758344a57 | ||
|
|
b5df566b6b |
No files matched your search
@@ -12,8 +12,11 @@ contains(QT_ARCH, i386) {
|
|||||||
contains(QT_ARCH, x86_64) {
|
contains(QT_ARCH, x86_64) {
|
||||||
LIBS += -L$$PWD/../libs/windows/lib/x64
|
LIBS += -L$$PWD/../libs/windows/lib/x64
|
||||||
}
|
}
|
||||||
|
contains(QT_ARCH, arm64) {
|
||||||
|
LIBS += -L$$PWD/../libs/windows/lib/arm64
|
||||||
|
}
|
||||||
|
|
||||||
LIBS += -lNktHookLib
|
LIBS += -ldetours
|
||||||
DEFINES += ANTIHOOKING_LIBRARY
|
DEFINES += ANTIHOOKING_LIBRARY
|
||||||
SOURCES += antihookingprotection.cpp
|
SOURCES += antihookingprotection.cpp
|
||||||
HEADERS += antihookingprotection.h
|
HEADERS += antihookingprotection.h
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
#include "antihookingprotection.h"
|
#include "antihookingprotection.h"
|
||||||
|
|
||||||
#include <NktHookLib.h>
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <Windows.h>
|
||||||
|
|
||||||
|
#include <detours.h>
|
||||||
|
|
||||||
typedef HMODULE (WINAPI *LoadLibraryAFunc)(LPCSTR lpLibFileName);
|
typedef HMODULE (WINAPI *LoadLibraryAFunc)(LPCSTR lpLibFileName);
|
||||||
typedef HMODULE (WINAPI *LoadLibraryWFunc)(LPCWSTR lpLibFileName);
|
typedef HMODULE (WINAPI *LoadLibraryWFunc)(LPCWSTR lpLibFileName);
|
||||||
@@ -12,25 +15,35 @@ class AntiHookingProtection
|
|||||||
public:
|
public:
|
||||||
static void enable()
|
static void enable()
|
||||||
{
|
{
|
||||||
#ifdef QT_DEBUG
|
DetourTransactionBegin();
|
||||||
s_HookManager.SetEnableDebugOutput(true);
|
DetourUpdateThread(GetCurrentThread());
|
||||||
#endif
|
|
||||||
|
|
||||||
HINSTANCE kernel32Handle = NktHookLibHelpers::GetModuleBaseAddress(L"kernel32.dll");
|
s_RealLoadLibraryA = LoadLibraryA;
|
||||||
SIZE_T hookId;
|
DetourAttach(&(PVOID&)s_RealLoadLibraryA, LoadLibraryAHook);
|
||||||
|
|
||||||
s_HookManager.Hook(&hookId, (LPVOID*)&s_RealLoadLibraryA,
|
s_RealLoadLibraryW = LoadLibraryW;
|
||||||
NktHookLibHelpers::GetProcedureAddress(kernel32Handle, "LoadLibraryA"),
|
DetourAttach(&(PVOID&)s_RealLoadLibraryW, LoadLibraryWHook);
|
||||||
(LPVOID)AntiHookingProtection::LoadLibraryAHook);
|
|
||||||
s_HookManager.Hook(&hookId, (LPVOID*)&s_RealLoadLibraryW,
|
s_RealLoadLibraryExA = LoadLibraryExA;
|
||||||
NktHookLibHelpers::GetProcedureAddress(kernel32Handle, "LoadLibraryW"),
|
DetourAttach(&(PVOID&)s_RealLoadLibraryExA, LoadLibraryExAHook);
|
||||||
(LPVOID)AntiHookingProtection::LoadLibraryWHook);
|
|
||||||
s_HookManager.Hook(&hookId, (LPVOID*)&s_RealLoadLibraryExA,
|
s_RealLoadLibraryExW = LoadLibraryExW;
|
||||||
NktHookLibHelpers::GetProcedureAddress(kernel32Handle, "LoadLibraryExA"),
|
DetourAttach(&(PVOID&)s_RealLoadLibraryExW, LoadLibraryExWHook);
|
||||||
(LPVOID)AntiHookingProtection::LoadLibraryExAHook);
|
|
||||||
s_HookManager.Hook(&hookId, (LPVOID*)&s_RealLoadLibraryExW,
|
DetourTransactionCommit();
|
||||||
NktHookLibHelpers::GetProcedureAddress(kernel32Handle, "LoadLibraryExW"),
|
}
|
||||||
(LPVOID)AntiHookingProtection::LoadLibraryExWHook);
|
|
||||||
|
static void disable()
|
||||||
|
{
|
||||||
|
DetourTransactionBegin();
|
||||||
|
DetourUpdateThread(GetCurrentThread());
|
||||||
|
|
||||||
|
DetourDetach(&(PVOID&)s_RealLoadLibraryA, LoadLibraryAHook);
|
||||||
|
DetourDetach(&(PVOID&)s_RealLoadLibraryW, LoadLibraryWHook);
|
||||||
|
DetourDetach(&(PVOID&)s_RealLoadLibraryExA, LoadLibraryExAHook);
|
||||||
|
DetourDetach(&(PVOID&)s_RealLoadLibraryExW, LoadLibraryExWHook);
|
||||||
|
|
||||||
|
DetourTransactionCommit();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -124,7 +137,6 @@ private:
|
|||||||
return s_RealLoadLibraryExW(lpLibFileName, hFile, dwFlags);
|
return s_RealLoadLibraryExW(lpLibFileName, hFile, dwFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static CNktHookLib s_HookManager;
|
|
||||||
static LoadLibraryAFunc s_RealLoadLibraryA;
|
static LoadLibraryAFunc s_RealLoadLibraryA;
|
||||||
static LoadLibraryWFunc s_RealLoadLibraryW;
|
static LoadLibraryWFunc s_RealLoadLibraryW;
|
||||||
static LoadLibraryExAFunc s_RealLoadLibraryExA;
|
static LoadLibraryExAFunc s_RealLoadLibraryExA;
|
||||||
@@ -139,7 +151,7 @@ private:
|
|||||||
L"SS2OSD.dll", // ASUS Sonic Studio 2
|
L"SS2OSD.dll", // ASUS Sonic Studio 2
|
||||||
L"Nahimic2OSD.dll",
|
L"Nahimic2OSD.dll",
|
||||||
L"NahimicMSIOSD.dll",
|
L"NahimicMSIOSD.dll",
|
||||||
L"nhAsusPhoebusOSD.dll" // ASUS Phoebus
|
L"nhAsusPhoebusOSD.dll", // ASUS Phoebus
|
||||||
|
|
||||||
// This DLL has been seen in several crash reports. Some Googling
|
// This DLL has been seen in several crash reports. Some Googling
|
||||||
// suggests it's highly unstable and causes issues in many games.
|
// suggests it's highly unstable and causes issues in many games.
|
||||||
@@ -209,7 +221,6 @@ private:
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
CNktHookLib AntiHookingProtection::s_HookManager;
|
|
||||||
LoadLibraryAFunc AntiHookingProtection::s_RealLoadLibraryA;
|
LoadLibraryAFunc AntiHookingProtection::s_RealLoadLibraryA;
|
||||||
LoadLibraryWFunc AntiHookingProtection::s_RealLoadLibraryW;
|
LoadLibraryWFunc AntiHookingProtection::s_RealLoadLibraryW;
|
||||||
LoadLibraryExAFunc AntiHookingProtection::s_RealLoadLibraryExA;
|
LoadLibraryExAFunc AntiHookingProtection::s_RealLoadLibraryExA;
|
||||||
@@ -218,14 +229,26 @@ LoadLibraryExWFunc AntiHookingProtection::s_RealLoadLibraryExW;
|
|||||||
AH_EXPORT void AntiHookingDummyImport() {}
|
AH_EXPORT void AntiHookingDummyImport() {}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID)
|
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||||
{
|
{
|
||||||
|
if (DetourIsHelperProcess()) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
switch (fdwReason)
|
switch (fdwReason)
|
||||||
{
|
{
|
||||||
case DLL_PROCESS_ATTACH:
|
case DLL_PROCESS_ATTACH:
|
||||||
|
DetourRestoreAfterWith();
|
||||||
AntiHookingProtection::enable();
|
AntiHookingProtection::enable();
|
||||||
DisableThreadLibraryCalls(hinstDLL);
|
DisableThreadLibraryCalls(hinstDLL);
|
||||||
break;
|
break;
|
||||||
|
case DLL_PROCESS_DETACH:
|
||||||
|
// Ignore DLL_PROCESS_DETACH on process exit. No need to waste time
|
||||||
|
// unhooking everything if the whole process is being destroyed.
|
||||||
|
if (lpvReserved == NULL) {
|
||||||
|
AntiHookingProtection::disable();
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|||||||
@@ -1,18 +1,20 @@
|
|||||||
# Moonlight PC
|
# Moonlight PC
|
||||||
|
|
||||||
[Moonlight PC](https://moonlight-stream.org) is an open source implementation of NVIDIA's GameStream, as used by the NVIDIA Shield, but built to run on Windows, Mac, and Linux. This client is the successor to [Moonlight Chrome](https://github.com/moonlight-stream/moonlight-chrome) for streaming on PC.
|
[Moonlight PC](https://moonlight-stream.org) is an open source PC client for NVIDIA GameStream, as used by the NVIDIA Shield.
|
||||||
|
|
||||||
Moonlight also has mobile versions for [Android](https://github.com/moonlight-stream/moonlight-android) and [iOS](https://github.com/moonlight-stream/moonlight-ios).
|
Moonlight also has mobile versions for [Android](https://github.com/moonlight-stream/moonlight-android) and [iOS](https://github.com/moonlight-stream/moonlight-ios).
|
||||||
|
|
||||||
You can follow development on our [Discord server](https://moonlight-stream.org/discord).
|
You can follow development on our [Discord server](https://moonlight-stream.org/discord) and help translate Moonlight into your language on [Weblate](https://hosted.weblate.org/projects/moonlight/moonlight-qt/).
|
||||||
|
|
||||||
[](https://ci.appveyor.com/project/cgutman/moonlight-qt/branch/master)
|
[](https://ci.appveyor.com/project/cgutman/moonlight-qt/branch/master)
|
||||||
[](https://github.com/moonlight-stream/moonlight-qt/releases)
|
[](https://github.com/moonlight-stream/moonlight-qt/releases)
|
||||||
|
[](https://hosted.weblate.org/projects/moonlight/moonlight-qt/)
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
- Hardware accelerated video decoding on Windows, Mac, and Linux
|
- Hardware accelerated video decoding on Windows, Mac, and Linux
|
||||||
- Supports streaming at up to 120 FPS (high refresh rate monitor recommended)
|
- Supports streaming at up to 120 FPS (high refresh rate monitor recommended)
|
||||||
- Supports streaming at 720p, 1080p, 1440p, 4K, and the client PC's native screen resolution
|
- Supports streaming at 720p, 1080p, 1440p, 4K, and the client PC's native screen resolution
|
||||||
|
- HDR streaming support
|
||||||
- 7.1 surround sound audio support
|
- 7.1 surround sound audio support
|
||||||
- Support for both pointer capture (for games) and direct mouse control (for remote desktop)
|
- Support for both pointer capture (for games) and direct mouse control (for remote desktop)
|
||||||
- Support for passing system-wide keyboard shortcuts like Alt+Tab to the host
|
- Support for passing system-wide keyboard shortcuts like Alt+Tab to the host
|
||||||
@@ -28,6 +30,12 @@ You can follow development on our [Discord server](https://moonlight-stream.org/
|
|||||||
- [Raspberry Pi 4](https://github.com/moonlight-stream/moonlight-docs/wiki/Installing-Moonlight-Qt-on-Raspberry-Pi-4)
|
- [Raspberry Pi 4](https://github.com/moonlight-stream/moonlight-docs/wiki/Installing-Moonlight-Qt-on-Raspberry-Pi-4)
|
||||||
- [NVIDIA Jetson and Nintendo Switch (Ubuntu L4T)](https://github.com/moonlight-stream/moonlight-docs/wiki/Installing-Moonlight-Qt-on-Linux4Tegra-(L4T)-Ubuntu)
|
- [NVIDIA Jetson and Nintendo Switch (Ubuntu L4T)](https://github.com/moonlight-stream/moonlight-docs/wiki/Installing-Moonlight-Qt-on-Linux4Tegra-(L4T)-Ubuntu)
|
||||||
|
|
||||||
|
#### Special Thanks
|
||||||
|
|
||||||
|
[](https://cloudsmith.com)
|
||||||
|
|
||||||
|
Hosting for Moonlight's Raspberry Pi and L4T package repositories is graciously provided for free by [Cloudsmith](https://cloudsmith.com).
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
### Windows Build Requirements
|
### Windows Build Requirements
|
||||||
@@ -36,20 +44,20 @@ You can follow development on our [Discord server](https://moonlight-stream.org/
|
|||||||
* [Visual Studio 2019](https://visualstudio.microsoft.com/downloads/) (Community edition is fine)
|
* [Visual Studio 2019](https://visualstudio.microsoft.com/downloads/) (Community edition is fine)
|
||||||
* Select **MSVC 2019** option during Qt installation. MinGW is not supported.
|
* Select **MSVC 2019** option during Qt installation. MinGW is not supported.
|
||||||
* [7-Zip](https://www.7-zip.org/) (only if building installers for non-development PCs)
|
* [7-Zip](https://www.7-zip.org/) (only if building installers for non-development PCs)
|
||||||
* [WiX Toolset](https://wixtoolset.org/releases/) v3.11 or later (only if building installers for non-development PCs)
|
* [WiX Toolset](https://wixtoolset.org/releases/v3-14-0-5722/) v3.14.0.5722 or later (only if building installers for non-development PCs)
|
||||||
|
|
||||||
### macOS Build Requirements
|
### macOS Build Requirements
|
||||||
* Qt 5.15 SDK or later
|
* Qt 6.2 SDK or later
|
||||||
* macOS High Sierra (10.13) or later
|
* macOS Mojave (10.14) or later
|
||||||
* Xcode 11
|
* Xcode 13
|
||||||
* [create-dmg](https://github.com/sindresorhus/create-dmg) (only if building DMGs for use on non-development Macs)
|
* [create-dmg](https://github.com/sindresorhus/create-dmg) (only if building DMGs for use on non-development Macs)
|
||||||
|
|
||||||
### Linux/Unix Build Requirements
|
### Linux/Unix Build Requirements
|
||||||
* Qt 5.9 SDK or later
|
* Qt 5.9 SDK or later
|
||||||
* GCC or Clang
|
* GCC or Clang
|
||||||
* Install the required packages:
|
* Install the required packages:
|
||||||
* Debian/Ubuntu: `libegl1-mesa-dev libgl1-mesa-dev libopus-dev libqt5svg5-dev libsdl2-dev libsdl2-ttf-dev libssl-dev libavcodec-dev libva-dev libvdpau-dev libxkbcommon-dev qt5-default qt5-qmake qtbase5-dev qtdeclarative5-dev qtquickcontrols2-5-dev wayland-protocols qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qtquick-window2 qml-module-qtquick2`
|
* Debian/Ubuntu: `libegl1-mesa-dev libgl1-mesa-dev libopus-dev libqt5svg5-dev libsdl2-dev libsdl2-ttf-dev libssl-dev libavcodec-dev libva-dev libvdpau-dev libxkbcommon-dev qtwayland5 qt5-qmake qtbase5-dev qtdeclarative5-dev qtquickcontrols2-5-dev wayland-protocols qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qtquick-window2 qml-module-qtquick2`
|
||||||
* RedHat/Fedora: `openssl-devel qt5-devel SDL2-devel ffmpeg-devel qt5-qtquickcontrols2-devel libva-devel libvdpau-devel opus-devel pulseaudio-libs-devel alsa-lib-devel SDL2_ttf-devel`
|
* RedHat/Fedora: `openssl-devel SDL2-devel SDL2_ttf-devel ffmpeg-devel qt5-qtsvg-devel qt5-qtquickcontrols2-devel libva-devel libvdpau-devel opus-devel pulseaudio-libs-devel alsa-lib-devel`
|
||||||
* FFmpeg 4.0+ is required to build. If your distro doesn't package FFmpeg 4.0 or later, you can build and install it from source on https://ffmpeg.org/
|
* FFmpeg 4.0+ is required to build. If your distro doesn't package FFmpeg 4.0 or later, you can build and install it from source on https://ffmpeg.org/
|
||||||
|
|
||||||
### Steam Link Build Requirements
|
### Steam Link Build Requirements
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@
|
|||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
<string>10.13</string>
|
<string>10.14</string>
|
||||||
<key>NSPrincipalClass</key>
|
<key>NSPrincipalClass</key>
|
||||||
<string>NSApplication</string>
|
<string>NSApplication</string>
|
||||||
<key>NSSupportsAutomaticGraphicsSwitching</key>
|
<key>NSSupportsAutomaticGraphicsSwitching</key>
|
||||||
|
|||||||
+1
-1
Submodule app/SDL_GameControllerDB updated: 8ce603d733...ff26eb04d0.
+64
-17
@@ -33,25 +33,32 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
win32 {
|
win32 {
|
||||||
INCLUDEPATH += $$PWD/../libs/windows/include
|
|
||||||
|
|
||||||
contains(QT_ARCH, i386) {
|
contains(QT_ARCH, i386) {
|
||||||
LIBS += -L$$PWD/../libs/windows/lib/x86
|
LIBS += -L$$PWD/../libs/windows/lib/x86
|
||||||
|
INCLUDEPATH += $$PWD/../libs/windows/include/x86
|
||||||
}
|
}
|
||||||
contains(QT_ARCH, x86_64) {
|
contains(QT_ARCH, x86_64) {
|
||||||
LIBS += -L$$PWD/../libs/windows/lib/x64
|
LIBS += -L$$PWD/../libs/windows/lib/x64
|
||||||
|
INCLUDEPATH += $$PWD/../libs/windows/include/x64
|
||||||
}
|
}
|
||||||
contains(QT_ARCH, arm64) {
|
contains(QT_ARCH, arm64) {
|
||||||
LIBS += -L$$PWD/../libs/windows/lib/arm64
|
LIBS += -L$$PWD/../libs/windows/lib/arm64
|
||||||
|
INCLUDEPATH += $$PWD/../libs/windows/include/arm64
|
||||||
}
|
}
|
||||||
|
|
||||||
LIBS += ws2_32.lib winmm.lib dxva2.lib ole32.lib gdi32.lib user32.lib d3d9.lib dwmapi.lib dbghelp.lib qwave.lib
|
INCLUDEPATH += $$PWD/../libs/windows/include
|
||||||
|
LIBS += ws2_32.lib winmm.lib dxva2.lib ole32.lib gdi32.lib user32.lib d3d9.lib dwmapi.lib dbghelp.lib
|
||||||
}
|
}
|
||||||
macx {
|
macx {
|
||||||
INCLUDEPATH += $$PWD/../libs/mac/include
|
INCLUDEPATH += $$PWD/../libs/mac/include
|
||||||
INCLUDEPATH += $$PWD/../libs/mac/Frameworks/SDL2.framework/Versions/A/Headers
|
INCLUDEPATH += $$PWD/../libs/mac/Frameworks/SDL2.framework/Versions/A/Headers
|
||||||
INCLUDEPATH += $$PWD/../libs/mac/Frameworks/SDL2_ttf.framework/Versions/A/Headers
|
INCLUDEPATH += $$PWD/../libs/mac/Frameworks/SDL2_ttf.framework/Versions/A/Headers
|
||||||
LIBS += -L$$PWD/../libs/mac/lib -F$$PWD/../libs/mac/Frameworks
|
LIBS += -L$$PWD/../libs/mac/lib -F$$PWD/../libs/mac/Frameworks
|
||||||
|
|
||||||
|
# QMake doesn't handle framework-style includes correctly on its own
|
||||||
|
QMAKE_CFLAGS += -F$$PWD/../libs/mac/Frameworks
|
||||||
|
QMAKE_CXXFLAGS += -F$$PWD/../libs/mac/Frameworks
|
||||||
|
QMAKE_OBJECTIVE_CFLAGS += -F$$PWD/../libs/mac/Frameworks
|
||||||
}
|
}
|
||||||
|
|
||||||
unix:!macx {
|
unix:!macx {
|
||||||
@@ -88,6 +95,11 @@ unix:!macx {
|
|||||||
PKGCONFIG += libdrm
|
PKGCONFIG += libdrm
|
||||||
CONFIG += libdrm
|
CONFIG += libdrm
|
||||||
}
|
}
|
||||||
|
|
||||||
|
packagesExist(ffnvcodec) {
|
||||||
|
PKGCONFIG += ffnvcodec
|
||||||
|
CONFIG += cuda
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
packagesExist(wayland-client) {
|
packagesExist(wayland-client) {
|
||||||
@@ -101,14 +113,14 @@ unix:!macx {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
win32 {
|
win32 {
|
||||||
LIBS += -llibssl -llibcrypto -lSDL2 -lSDL2_ttf -lavcodec -lavutil -lopus
|
LIBS += -llibssl -llibcrypto -lSDL2 -lSDL2_ttf -lavcodec -lavutil -lopus -ldxgi -ld3d11
|
||||||
CONFIG += ffmpeg
|
CONFIG += ffmpeg
|
||||||
}
|
}
|
||||||
win32:!winrt {
|
win32:!winrt {
|
||||||
CONFIG += soundio discord-rpc
|
CONFIG += soundio discord-rpc
|
||||||
}
|
}
|
||||||
macx {
|
macx {
|
||||||
LIBS += -lssl -lcrypto -lavcodec.58 -lavutil.56 -lopus -framework SDL2 -framework SDL2_ttf
|
LIBS += -lssl -lcrypto -lavcodec.59 -lavutil.57 -lopus -framework SDL2 -framework SDL2_ttf
|
||||||
LIBS += -lobjc -framework VideoToolbox -framework AVFoundation -framework CoreVideo -framework CoreGraphics -framework CoreMedia -framework AppKit -framework Metal
|
LIBS += -lobjc -framework VideoToolbox -framework AVFoundation -framework CoreVideo -framework CoreGraphics -framework CoreMedia -framework AppKit -framework Metal
|
||||||
|
|
||||||
# For libsoundio
|
# For libsoundio
|
||||||
@@ -118,7 +130,9 @@ macx {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
backend/nvaddress.cpp \
|
||||||
backend/nvapp.cpp \
|
backend/nvapp.cpp \
|
||||||
|
cli/pair.cpp \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
backend/computerseeker.cpp \
|
backend/computerseeker.cpp \
|
||||||
backend/identitymanager.cpp \
|
backend/identitymanager.cpp \
|
||||||
@@ -129,12 +143,13 @@ SOURCES += \
|
|||||||
backend/boxartmanager.cpp \
|
backend/boxartmanager.cpp \
|
||||||
backend/richpresencemanager.cpp \
|
backend/richpresencemanager.cpp \
|
||||||
cli/commandlineparser.cpp \
|
cli/commandlineparser.cpp \
|
||||||
|
cli/listapps.cpp \
|
||||||
cli/quitstream.cpp \
|
cli/quitstream.cpp \
|
||||||
cli/startstream.cpp \
|
cli/startstream.cpp \
|
||||||
|
settings/compatfetcher.cpp \
|
||||||
settings/mappingfetcher.cpp \
|
settings/mappingfetcher.cpp \
|
||||||
settings/streamingpreferences.cpp \
|
settings/streamingpreferences.cpp \
|
||||||
streaming/input/abstouch.cpp \
|
streaming/input/abstouch.cpp \
|
||||||
streaming/input/clipboard.cpp \
|
|
||||||
streaming/input/gamepad.cpp \
|
streaming/input/gamepad.cpp \
|
||||||
streaming/input/input.cpp \
|
streaming/input/input.cpp \
|
||||||
streaming/input/keyboard.cpp \
|
streaming/input/keyboard.cpp \
|
||||||
@@ -155,7 +170,10 @@ SOURCES += \
|
|||||||
wm.cpp
|
wm.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
backend/nvaddress.h \
|
||||||
backend/nvapp.h \
|
backend/nvapp.h \
|
||||||
|
cli/pair.h \
|
||||||
|
settings/compatfetcher.h \
|
||||||
settings/mappingfetcher.h \
|
settings/mappingfetcher.h \
|
||||||
utils.h \
|
utils.h \
|
||||||
backend/computerseeker.h \
|
backend/computerseeker.h \
|
||||||
@@ -167,6 +185,7 @@ HEADERS += \
|
|||||||
backend/boxartmanager.h \
|
backend/boxartmanager.h \
|
||||||
backend/richpresencemanager.h \
|
backend/richpresencemanager.h \
|
||||||
cli/commandlineparser.h \
|
cli/commandlineparser.h \
|
||||||
|
cli/listapps.h \
|
||||||
cli/quitstream.h \
|
cli/quitstream.h \
|
||||||
cli/startstream.h \
|
cli/startstream.h \
|
||||||
settings/streamingpreferences.h \
|
settings/streamingpreferences.h \
|
||||||
@@ -193,7 +212,6 @@ ffmpeg {
|
|||||||
SOURCES += \
|
SOURCES += \
|
||||||
streaming/video/ffmpeg.cpp \
|
streaming/video/ffmpeg.cpp \
|
||||||
streaming/video/ffmpeg-renderers/sdlvid.cpp \
|
streaming/video/ffmpeg-renderers/sdlvid.cpp \
|
||||||
streaming/video/ffmpeg-renderers/cuda.cpp \
|
|
||||||
streaming/video/ffmpeg-renderers/pacer/pacer.cpp \
|
streaming/video/ffmpeg-renderers/pacer/pacer.cpp \
|
||||||
streaming/video/ffmpeg-renderers/pacer/nullthreadedvsyncsource.cpp
|
streaming/video/ffmpeg-renderers/pacer/nullthreadedvsyncsource.cpp
|
||||||
|
|
||||||
@@ -201,7 +219,6 @@ ffmpeg {
|
|||||||
streaming/video/ffmpeg.h \
|
streaming/video/ffmpeg.h \
|
||||||
streaming/video/ffmpeg-renderers/renderer.h \
|
streaming/video/ffmpeg-renderers/renderer.h \
|
||||||
streaming/video/ffmpeg-renderers/sdlvid.h \
|
streaming/video/ffmpeg-renderers/sdlvid.h \
|
||||||
streaming/video/ffmpeg-renderers/cuda.h \
|
|
||||||
streaming/video/ffmpeg-renderers/pacer/pacer.h \
|
streaming/video/ffmpeg-renderers/pacer/pacer.h \
|
||||||
streaming/video/ffmpeg-renderers/pacer/nullthreadedvsyncsource.h
|
streaming/video/ffmpeg-renderers/pacer/nullthreadedvsyncsource.h
|
||||||
}
|
}
|
||||||
@@ -254,10 +271,17 @@ libdrm {
|
|||||||
|
|
||||||
linux {
|
linux {
|
||||||
message(Master hooks enabled)
|
message(Master hooks enabled)
|
||||||
SOURCES += masterhook.c
|
SOURCES += masterhook.c masterhook_internal.c
|
||||||
LIBS += -ldl
|
LIBS += -ldl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cuda {
|
||||||
|
message(CUDA support enabled)
|
||||||
|
|
||||||
|
DEFINES += HAVE_CUDA
|
||||||
|
SOURCES += streaming/video/ffmpeg-renderers/cuda.cpp
|
||||||
|
HEADERS += streaming/video/ffmpeg-renderers/cuda.h
|
||||||
|
}
|
||||||
config_EGL {
|
config_EGL {
|
||||||
message(EGL renderer selected)
|
message(EGL renderer selected)
|
||||||
|
|
||||||
@@ -281,15 +305,20 @@ config_SL {
|
|||||||
streaming/video/slvid.h \
|
streaming/video/slvid.h \
|
||||||
streaming/audio/renderers/slaud.h
|
streaming/audio/renderers/slaud.h
|
||||||
}
|
}
|
||||||
|
win32 {
|
||||||
|
HEADERS += streaming/video/ffmpeg-renderers/dxutil.h
|
||||||
|
}
|
||||||
win32:!winrt {
|
win32:!winrt {
|
||||||
message(DXVA2 renderer selected)
|
message(DXVA2 and D3D11VA renderers selected)
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
streaming/video/ffmpeg-renderers/dxva2.cpp \
|
streaming/video/ffmpeg-renderers/dxva2.cpp \
|
||||||
|
streaming/video/ffmpeg-renderers/d3d11va.cpp \
|
||||||
streaming/video/ffmpeg-renderers/pacer/dxvsyncsource.cpp
|
streaming/video/ffmpeg-renderers/pacer/dxvsyncsource.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
streaming/video/ffmpeg-renderers/dxva2.h \
|
streaming/video/ffmpeg-renderers/dxva2.h \
|
||||||
|
streaming/video/ffmpeg-renderers/d3d11va.h \
|
||||||
streaming/video/ffmpeg-renderers/pacer/dxvsyncsource.h
|
streaming/video/ffmpeg-renderers/pacer/dxvsyncsource.h
|
||||||
}
|
}
|
||||||
macx {
|
macx {
|
||||||
@@ -327,7 +356,27 @@ RESOURCES += \
|
|||||||
TRANSLATIONS += \
|
TRANSLATIONS += \
|
||||||
languages/qml_zh_cn.ts \
|
languages/qml_zh_cn.ts \
|
||||||
languages/qml_de.ts \
|
languages/qml_de.ts \
|
||||||
languages/qml_fr.ts
|
languages/qml_fr.ts \
|
||||||
|
languages/qml_nb_NO.ts \
|
||||||
|
languages/qml_ru.ts \
|
||||||
|
languages/qml_es.ts \
|
||||||
|
languages/qml_ja.ts \
|
||||||
|
languages/qml_vi.ts \
|
||||||
|
languages/qml_th.ts \
|
||||||
|
languages/qml_ko.ts \
|
||||||
|
languages/qml_hu.ts \
|
||||||
|
languages/qml_nl.ts \
|
||||||
|
languages/qml_sv.ts \
|
||||||
|
languages/qml_tr.ts \
|
||||||
|
languages/qml_uk.ts \
|
||||||
|
languages/qml_zh_Hant.ts \
|
||||||
|
languages/qml_el.ts \
|
||||||
|
languages/qml_hi.ts \
|
||||||
|
languages/qml_it.ts \
|
||||||
|
languages/qml_pt.ts \
|
||||||
|
languages/qml_pt_BR.ts \
|
||||||
|
languages/qml_pl.ts \
|
||||||
|
languages/qml_cs.ts
|
||||||
|
|
||||||
# Additional import path used to resolve QML modules in Qt Creator's code model
|
# Additional import path used to resolve QML modules in Qt Creator's code model
|
||||||
QML_IMPORT_PATH =
|
QML_IMPORT_PATH =
|
||||||
@@ -366,13 +415,11 @@ INCLUDEPATH += $$PWD/../h264bitstream/h264bitstream
|
|||||||
DEPENDPATH += $$PWD/../h264bitstream/h264bitstream
|
DEPENDPATH += $$PWD/../h264bitstream/h264bitstream
|
||||||
|
|
||||||
!winrt {
|
!winrt {
|
||||||
contains(QT_ARCH, i386)|contains(QT_ARCH, x86_64) {
|
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../AntiHooking/release/ -lAntiHooking
|
||||||
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../AntiHooking/release/ -lAntiHooking
|
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../AntiHooking/debug/ -lAntiHooking
|
||||||
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../AntiHooking/debug/ -lAntiHooking
|
|
||||||
|
|
||||||
INCLUDEPATH += $$PWD/../AntiHooking
|
INCLUDEPATH += $$PWD/../AntiHooking
|
||||||
DEPENDPATH += $$PWD/../AntiHooking
|
DEPENDPATH += $$PWD/../AntiHooking
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unix:!macx: {
|
unix:!macx: {
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ void BoxArtManager::handleBoxArtLoadComplete(NvComputer* computer, NvApp app, QU
|
|||||||
|
|
||||||
QUrl BoxArtManager::loadBoxArtFromNetwork(NvComputer* computer, int appId)
|
QUrl BoxArtManager::loadBoxArtFromNetwork(NvComputer* computer, int appId)
|
||||||
{
|
{
|
||||||
NvHTTP http(computer->activeAddress, computer->serverCert);
|
NvHTTP http(computer);
|
||||||
|
|
||||||
QString cachePath = getFilePathForBoxArt(computer, appId);
|
QString cachePath = getFilePathForBoxArt(computer, appId);
|
||||||
QImage image;
|
QImage image;
|
||||||
|
|||||||
+170
-51
@@ -10,6 +10,8 @@
|
|||||||
#include <QThreadPool>
|
#include <QThreadPool>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
|
||||||
|
#include <random>
|
||||||
|
|
||||||
#define SER_HOSTS "hosts"
|
#define SER_HOSTS "hosts"
|
||||||
|
|
||||||
class PcMonitorThread : public QThread
|
class PcMonitorThread : public QThread
|
||||||
@@ -27,9 +29,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool tryPollComputer(QString address, bool& changed)
|
bool tryPollComputer(NvAddress address, bool& changed)
|
||||||
{
|
{
|
||||||
NvHTTP http(address, m_Computer->serverCert);
|
NvHTTP http(address, 0, m_Computer->serverCert);
|
||||||
|
|
||||||
QString serverInfo;
|
QString serverInfo;
|
||||||
try {
|
try {
|
||||||
@@ -38,7 +40,7 @@ private:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvComputer newState(address, serverInfo, QSslCertificate());
|
NvComputer newState(http, serverInfo);
|
||||||
|
|
||||||
// Ensure the machine that responded is the one we intended to contact
|
// Ensure the machine that responded is the one we intended to contact
|
||||||
if (m_Computer->uuid != newState.uuid) {
|
if (m_Computer->uuid != newState.uuid) {
|
||||||
@@ -52,9 +54,7 @@ private:
|
|||||||
|
|
||||||
bool updateAppList(bool& changed)
|
bool updateAppList(bool& changed)
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_Computer->activeAddress != nullptr);
|
NvHTTP http(m_Computer);
|
||||||
|
|
||||||
NvHTTP http(m_Computer->activeAddress, m_Computer->serverCert);
|
|
||||||
|
|
||||||
QVector<NvApp> appList;
|
QVector<NvApp> appList;
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ private:
|
|||||||
|
|
||||||
if (tryPollComputer(address, stateChanged)) {
|
if (tryPollComputer(address, stateChanged)) {
|
||||||
if (!wasOnline) {
|
if (!wasOnline) {
|
||||||
qInfo() << m_Computer->name << "is now online at" << m_Computer->activeAddress;
|
qInfo() << m_Computer->name << "is now online at" << m_Computer->activeAddress.toString();
|
||||||
}
|
}
|
||||||
online = true;
|
online = true;
|
||||||
break;
|
break;
|
||||||
@@ -146,7 +146,9 @@ private:
|
|||||||
ComputerManager::ComputerManager(QObject *parent)
|
ComputerManager::ComputerManager(QObject *parent)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
m_PollingRef(0),
|
m_PollingRef(0),
|
||||||
m_MdnsBrowser(nullptr)
|
m_MdnsBrowser(nullptr),
|
||||||
|
m_CompatFetcher(nullptr),
|
||||||
|
m_NeedsDelayedFlush(false)
|
||||||
{
|
{
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
|
||||||
@@ -159,6 +161,13 @@ ComputerManager::ComputerManager(QObject *parent)
|
|||||||
}
|
}
|
||||||
settings.endArray();
|
settings.endArray();
|
||||||
|
|
||||||
|
// Fetch latest compatibility data asynchronously
|
||||||
|
m_CompatFetcher.start();
|
||||||
|
|
||||||
|
// Start the delayed flush thread to handle saveHosts() calls
|
||||||
|
m_DelayedFlushThread = new DelayedFlushThread(this);
|
||||||
|
m_DelayedFlushThread->start();
|
||||||
|
|
||||||
// To quit in a timely manner, we must block additional requests
|
// To quit in a timely manner, we must block additional requests
|
||||||
// after we receive the aboutToQuit() signal. This is neccessary
|
// after we receive the aboutToQuit() signal. This is neccessary
|
||||||
// because NvHTTP uses aboutToQuit() to abort requests in progres
|
// because NvHTTP uses aboutToQuit() to abort requests in progres
|
||||||
@@ -169,6 +178,21 @@ ComputerManager::ComputerManager(QObject *parent)
|
|||||||
|
|
||||||
ComputerManager::~ComputerManager()
|
ComputerManager::~ComputerManager()
|
||||||
{
|
{
|
||||||
|
// Stop the delayed flush thread before acquiring the lock in write mode
|
||||||
|
// to avoid deadlocking with a flush that needs the lock in read mode.
|
||||||
|
{
|
||||||
|
// Wake the delayed flush thread
|
||||||
|
m_DelayedFlushThread->requestInterruption();
|
||||||
|
m_DelayedFlushCondition.wakeOne();
|
||||||
|
|
||||||
|
// Wait for it to terminate (and finish any pending flush)
|
||||||
|
m_DelayedFlushThread->wait();
|
||||||
|
delete m_DelayedFlushThread;
|
||||||
|
|
||||||
|
// Delayed flushes should have completed by now
|
||||||
|
Q_ASSERT(!m_NeedsDelayedFlush);
|
||||||
|
}
|
||||||
|
|
||||||
QWriteLocker lock(&m_Lock);
|
QWriteLocker lock(&m_Lock);
|
||||||
|
|
||||||
// Delete machines that haven't been resolved yet
|
// Delete machines that haven't been resolved yet
|
||||||
@@ -198,19 +222,53 @@ ComputerManager::~ComputerManager()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DelayedFlushThread::run() {
|
||||||
|
for (;;) {
|
||||||
|
// Wait for a delayed flush request or an interruption
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&m_ComputerManager->m_DelayedFlushMutex);
|
||||||
|
|
||||||
|
while (!QThread::currentThread()->isInterruptionRequested() && !m_ComputerManager->m_NeedsDelayedFlush) {
|
||||||
|
m_ComputerManager->m_DelayedFlushCondition.wait(&m_ComputerManager->m_DelayedFlushMutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bail without flushing if we woke up for an interruption alone.
|
||||||
|
// If we have both an interruption and a flush request, do the flush.
|
||||||
|
if (!m_ComputerManager->m_NeedsDelayedFlush) {
|
||||||
|
Q_ASSERT(QThread::currentThread()->isInterruptionRequested());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset the delayed flush flag to ensure any racing saveHosts() call will set it again
|
||||||
|
m_ComputerManager->m_NeedsDelayedFlush = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform the flush
|
||||||
|
{
|
||||||
|
QReadLocker lock(&m_ComputerManager->m_Lock);
|
||||||
|
|
||||||
|
QSettings settings;
|
||||||
|
settings.remove(SER_HOSTS);
|
||||||
|
settings.beginWriteArray(SER_HOSTS);
|
||||||
|
int i = 0;
|
||||||
|
for (const NvComputer* computer : m_ComputerManager->m_KnownHosts) {
|
||||||
|
settings.setArrayIndex(i++);
|
||||||
|
computer->serialize(settings);
|
||||||
|
}
|
||||||
|
settings.endArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ComputerManager::saveHosts()
|
void ComputerManager::saveHosts()
|
||||||
{
|
{
|
||||||
QSettings settings;
|
Q_ASSERT(m_DelayedFlushThread != nullptr && m_DelayedFlushThread->isRunning());
|
||||||
QReadLocker lock(&m_Lock);
|
|
||||||
|
|
||||||
settings.remove(SER_HOSTS);
|
// Punt to a worker thread because QSettings on macOS can take ages (> 500 ms)
|
||||||
settings.beginWriteArray(SER_HOSTS);
|
// to persist our host list to disk (especially when a host has a bunch of apps).
|
||||||
int i = 0;
|
QMutexLocker locker(&m_DelayedFlushMutex);
|
||||||
for (const NvComputer* computer : m_KnownHosts) {
|
m_NeedsDelayedFlush = true;
|
||||||
settings.setArrayIndex(i++);
|
m_DelayedFlushCondition.wakeOne();
|
||||||
computer->serialize(settings);
|
|
||||||
}
|
|
||||||
settings.endArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QHostAddress ComputerManager::getBestGlobalAddressV6(QVector<QHostAddress> &addresses)
|
QHostAddress ComputerManager::getBestGlobalAddressV6(QVector<QHostAddress> &addresses)
|
||||||
@@ -322,7 +380,7 @@ void ComputerManager::handleMdnsServiceResolved(MdnsPendingComputer* computer,
|
|||||||
// address may not be reachable (if the user hasn't installed the IPv6 helper yet
|
// address may not be reachable (if the user hasn't installed the IPv6 helper yet
|
||||||
// or if this host lacks outbound IPv6 capability). We want to add IPv6 even if
|
// or if this host lacks outbound IPv6 capability). We want to add IPv6 even if
|
||||||
// it's not currently reachable.
|
// it's not currently reachable.
|
||||||
addNewHost(address.toString(), true, v6Global);
|
addNewHost(NvAddress(address, computer->port()), true, NvAddress(v6Global, computer->port()));
|
||||||
added = true;
|
added = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -336,7 +394,7 @@ void ComputerManager::handleMdnsServiceResolved(MdnsPendingComputer* computer,
|
|||||||
if (address.isInSubnet(QHostAddress("fe80::"), 10) ||
|
if (address.isInSubnet(QHostAddress("fe80::"), 10) ||
|
||||||
address.isInSubnet(QHostAddress("fec0::"), 10) ||
|
address.isInSubnet(QHostAddress("fec0::"), 10) ||
|
||||||
address.isInSubnet(QHostAddress("fc00::"), 7)) {
|
address.isInSubnet(QHostAddress("fc00::"), 7)) {
|
||||||
addNewHost(address.toString(), true, v6Global);
|
addNewHost(NvAddress(address, computer->port()), true, NvAddress(v6Global, computer->port()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -438,7 +496,7 @@ void ComputerManager::clientSideAttributeUpdated(NvComputer* computer)
|
|||||||
|
|
||||||
void ComputerManager::handleAboutToQuit()
|
void ComputerManager::handleAboutToQuit()
|
||||||
{
|
{
|
||||||
QWriteLocker lock(&m_Lock);
|
QReadLocker lock(&m_Lock);
|
||||||
|
|
||||||
// Interrupt polling threads immediately, so they
|
// Interrupt polling threads immediately, so they
|
||||||
// avoid making additional requests while quitting
|
// avoid making additional requests while quitting
|
||||||
@@ -453,7 +511,8 @@ class PendingPairingTask : public QObject, public QRunnable
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
PendingPairingTask(ComputerManager* computerManager, NvComputer* computer, QString pin)
|
PendingPairingTask(ComputerManager* computerManager, NvComputer* computer, QString pin)
|
||||||
: m_Computer(computer),
|
: m_ComputerManager(computerManager),
|
||||||
|
m_Computer(computer),
|
||||||
m_Pin(pin)
|
m_Pin(pin)
|
||||||
{
|
{
|
||||||
connect(this, &PendingPairingTask::pairingCompleted,
|
connect(this, &PendingPairingTask::pairingCompleted,
|
||||||
@@ -466,32 +525,41 @@ signals:
|
|||||||
private:
|
private:
|
||||||
void run()
|
void run()
|
||||||
{
|
{
|
||||||
NvPairingManager pairingManager(m_Computer->activeAddress);
|
NvPairingManager pairingManager(m_Computer);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
NvPairingManager::PairState result = pairingManager.pair(m_Computer->appVersion, m_Pin, m_Computer->serverCert);
|
NvPairingManager::PairState result = pairingManager.pair(m_Computer->appVersion, m_Pin, m_Computer->serverCert);
|
||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
case NvPairingManager::PairState::PIN_WRONG:
|
case NvPairingManager::PairState::PIN_WRONG:
|
||||||
emit pairingCompleted(m_Computer, "The PIN from the PC didn't match. Please try again.");
|
emit pairingCompleted(m_Computer, tr("The PIN from the PC didn't match. Please try again."));
|
||||||
break;
|
break;
|
||||||
case NvPairingManager::PairState::FAILED:
|
case NvPairingManager::PairState::FAILED:
|
||||||
emit pairingCompleted(m_Computer, "Pairing failed. Please try again.");
|
if (m_Computer->currentGameId != 0) {
|
||||||
|
emit pairingCompleted(m_Computer, tr("You cannot pair while a previous session is still running on the host PC. Quit any running games or reboot the host PC, then try pairing again."));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
emit pairingCompleted(m_Computer, tr("Pairing failed. Please try again."));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case NvPairingManager::PairState::ALREADY_IN_PROGRESS:
|
case NvPairingManager::PairState::ALREADY_IN_PROGRESS:
|
||||||
emit pairingCompleted(m_Computer, "Another pairing attempt is already in progress.");
|
emit pairingCompleted(m_Computer, tr("Another pairing attempt is already in progress."));
|
||||||
break;
|
break;
|
||||||
case NvPairingManager::PairState::PAIRED:
|
case NvPairingManager::PairState::PAIRED:
|
||||||
|
// Persist the newly pinned server certificate for this host
|
||||||
|
m_ComputerManager->saveHosts();
|
||||||
|
|
||||||
emit pairingCompleted(m_Computer, nullptr);
|
emit pairingCompleted(m_Computer, nullptr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (const GfeHttpResponseException& e) {
|
} catch (const GfeHttpResponseException& e) {
|
||||||
emit pairingCompleted(m_Computer, "GeForce Experience returned error: " + e.toQString());
|
emit pairingCompleted(m_Computer, tr("GeForce Experience returned error: %1").arg(e.toQString()));
|
||||||
} catch (const QtNetworkReplyException& e) {
|
} catch (const QtNetworkReplyException& e) {
|
||||||
emit pairingCompleted(m_Computer, e.toQString());
|
emit pairingCompleted(m_Computer, e.toQString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ComputerManager* m_ComputerManager;
|
||||||
NvComputer* m_Computer;
|
NvComputer* m_Computer;
|
||||||
QString m_Pin;
|
QString m_Pin;
|
||||||
};
|
};
|
||||||
@@ -522,7 +590,7 @@ signals:
|
|||||||
private:
|
private:
|
||||||
void run()
|
void run()
|
||||||
{
|
{
|
||||||
NvHTTP http(m_Computer->activeAddress, m_Computer->serverCert);
|
NvHTTP http(m_Computer);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (m_Computer->currentGameId != 0) {
|
if (m_Computer->currentGameId != 0) {
|
||||||
@@ -588,21 +656,36 @@ void ComputerManager::stopPollingAsync()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ComputerManager::addNewHostManually(QString address)
|
||||||
|
{
|
||||||
|
QUrl url = QUrl::fromUserInput(address);
|
||||||
|
if (url.isValid() && !url.host().isEmpty()) {
|
||||||
|
// If there wasn't a port specified, use the default
|
||||||
|
addNewHost(NvAddress(url.host(), url.port(DEFAULT_HTTP_PORT)), false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
emit computerAddCompleted(false, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class PendingAddTask : public QObject, public QRunnable
|
class PendingAddTask : public QObject, public QRunnable
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PendingAddTask(ComputerManager* computerManager, QString address, QHostAddress mdnsIpv6Address, bool mdns)
|
PendingAddTask(ComputerManager* computerManager, NvAddress address, NvAddress mdnsIpv6Address, bool mdns)
|
||||||
: m_ComputerManager(computerManager),
|
: m_ComputerManager(computerManager),
|
||||||
m_Address(address),
|
m_Address(address),
|
||||||
m_MdnsIpv6Address(mdnsIpv6Address),
|
m_MdnsIpv6Address(mdnsIpv6Address),
|
||||||
m_Mdns(mdns)
|
m_Mdns(mdns),
|
||||||
|
m_AboutToQuit(false)
|
||||||
{
|
{
|
||||||
connect(this, &PendingAddTask::computerAddCompleted,
|
connect(this, &PendingAddTask::computerAddCompleted,
|
||||||
computerManager, &ComputerManager::computerAddCompleted);
|
computerManager, &ComputerManager::computerAddCompleted);
|
||||||
connect(this, &PendingAddTask::computerStateChanged,
|
connect(this, &PendingAddTask::computerStateChanged,
|
||||||
computerManager, &ComputerManager::handleComputerStateChanged);
|
computerManager, &ComputerManager::handleComputerStateChanged);
|
||||||
|
connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit,
|
||||||
|
this, &PendingAddTask::handleAboutToQuit);
|
||||||
}
|
}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@@ -611,9 +694,20 @@ signals:
|
|||||||
void computerStateChanged(NvComputer* computer);
|
void computerStateChanged(NvComputer* computer);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void handleAboutToQuit()
|
||||||
|
{
|
||||||
|
m_AboutToQuit = true;
|
||||||
|
}
|
||||||
|
|
||||||
QString fetchServerInfo(NvHTTP& http)
|
QString fetchServerInfo(NvHTTP& http)
|
||||||
{
|
{
|
||||||
QString serverInfo;
|
QString serverInfo;
|
||||||
|
|
||||||
|
// Do nothing if we're quitting
|
||||||
|
if (m_AboutToQuit) {
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// There's a race condition between GameStream servers reporting presence over
|
// There's a race condition between GameStream servers reporting presence over
|
||||||
// mDNS and the HTTPS server being ready to respond to our queries. To work
|
// mDNS and the HTTPS server being ready to respond to our queries. To work
|
||||||
@@ -657,15 +751,15 @@ private:
|
|||||||
|
|
||||||
void run()
|
void run()
|
||||||
{
|
{
|
||||||
NvHTTP http(m_Address, QSslCertificate());
|
NvHTTP http(m_Address, 0, QSslCertificate());
|
||||||
|
|
||||||
qInfo() << "Processing new PC at" << m_Address << "from" << (m_Mdns ? "mDNS" : "user") << m_MdnsIpv6Address;
|
qInfo() << "Processing new PC at" << m_Address.toString() << "from" << (m_Mdns ? "mDNS" : "user") << "with IPv6 address" << m_MdnsIpv6Address.toString();
|
||||||
|
|
||||||
// Perform initial serverinfo fetch over HTTP since we don't know which cert to use
|
// Perform initial serverinfo fetch over HTTP since we don't know which cert to use
|
||||||
QString serverInfo = fetchServerInfo(http);
|
QString serverInfo = fetchServerInfo(http);
|
||||||
if (serverInfo.isEmpty() && !m_MdnsIpv6Address.isNull()) {
|
if (serverInfo.isEmpty() && !m_MdnsIpv6Address.isNull()) {
|
||||||
// Retry using the global IPv6 address if the IPv4 or link-local IPv6 address fails
|
// Retry using the global IPv6 address if the IPv4 or link-local IPv6 address fails
|
||||||
http.setAddress(m_MdnsIpv6Address.toString());
|
http.setAddress(m_MdnsIpv6Address);
|
||||||
serverInfo = fetchServerInfo(http);
|
serverInfo = fetchServerInfo(http);
|
||||||
}
|
}
|
||||||
if (serverInfo.isEmpty()) {
|
if (serverInfo.isEmpty()) {
|
||||||
@@ -673,7 +767,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create initial newComputer using HTTP serverinfo with no pinned cert
|
// Create initial newComputer using HTTP serverinfo with no pinned cert
|
||||||
NvComputer* newComputer = new NvComputer(http.address(), serverInfo, QSslCertificate());
|
NvComputer* newComputer = new NvComputer(http, serverInfo);
|
||||||
|
|
||||||
// Check if we have a record of this host UUID to pull the pinned cert
|
// Check if we have a record of this host UUID to pull the pinned cert
|
||||||
NvComputer* existingComputer;
|
NvComputer* existingComputer;
|
||||||
@@ -687,13 +781,14 @@ private:
|
|||||||
|
|
||||||
// Fetch serverinfo again over HTTPS with the pinned cert
|
// Fetch serverinfo again over HTTPS with the pinned cert
|
||||||
if (existingComputer != nullptr) {
|
if (existingComputer != nullptr) {
|
||||||
|
Q_ASSERT(http.httpsPort() != 0);
|
||||||
serverInfo = fetchServerInfo(http);
|
serverInfo = fetchServerInfo(http);
|
||||||
if (serverInfo.isEmpty()) {
|
if (serverInfo.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the polled computer with the HTTPS information
|
// Update the polled computer with the HTTPS information
|
||||||
NvComputer httpsComputer(http.address(), serverInfo, QSslCertificate());
|
NvComputer httpsComputer(http, serverInfo);
|
||||||
newComputer->update(httpsComputer);
|
newComputer->update(httpsComputer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -707,11 +802,11 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the WAN IP address using STUN if we're on mDNS over IPv4
|
// Get the WAN IP address using STUN if we're on mDNS over IPv4
|
||||||
if (QHostAddress(newComputer->localAddress).protocol() == QAbstractSocket::IPv4Protocol) {
|
if (QHostAddress(newComputer->localAddress.address()).protocol() == QAbstractSocket::IPv4Protocol) {
|
||||||
quint32 addr;
|
quint32 addr;
|
||||||
int err = LiFindExternalAddressIP4("stun.moonlight-stream.org", 3478, &addr);
|
int err = LiFindExternalAddressIP4("stun.moonlight-stream.org", 3478, &addr);
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
newComputer->remoteAddress = QHostAddress(qFromBigEndian(addr)).toString();
|
newComputer->setRemoteAddress(QHostAddress(qFromBigEndian(addr)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qWarning() << "STUN failed to get WAN address:" << err;
|
qWarning() << "STUN failed to get WAN address:" << err;
|
||||||
@@ -719,31 +814,46 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!m_MdnsIpv6Address.isNull()) {
|
if (!m_MdnsIpv6Address.isNull()) {
|
||||||
Q_ASSERT(m_MdnsIpv6Address.protocol() == QAbstractSocket::IPv6Protocol);
|
Q_ASSERT(QHostAddress(m_MdnsIpv6Address.address()).protocol() == QAbstractSocket::IPv6Protocol);
|
||||||
newComputer->ipv6Address = m_MdnsIpv6Address.toString();
|
newComputer->ipv6Address = m_MdnsIpv6Address;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
newComputer->manualAddress = m_Address;
|
newComputer->manualAddress = m_Address;
|
||||||
}
|
}
|
||||||
|
|
||||||
QHostAddress hostAddress(m_Address);
|
QHostAddress hostAddress(m_Address.address());
|
||||||
bool addressIsSiteLocalV4 =
|
bool addressIsSiteLocalV4 =
|
||||||
hostAddress.isInSubnet(QHostAddress("10.0.0.0"), 8) ||
|
hostAddress.isInSubnet(QHostAddress("10.0.0.0"), 8) ||
|
||||||
hostAddress.isInSubnet(QHostAddress("172.16.0.0"), 12) ||
|
hostAddress.isInSubnet(QHostAddress("172.16.0.0"), 12) ||
|
||||||
hostAddress.isInSubnet(QHostAddress("192.168.0.0"), 16);
|
hostAddress.isInSubnet(QHostAddress("192.168.0.0"), 16);
|
||||||
|
|
||||||
{
|
{
|
||||||
// Check if this PC already exists
|
// Check if this PC already exists using opportunistic read lock
|
||||||
QWriteLocker lock(&m_ComputerManager->m_Lock);
|
m_ComputerManager->m_Lock.lockForRead();
|
||||||
NvComputer* existingComputer = m_ComputerManager->m_KnownHosts.value(newComputer->uuid);
|
NvComputer* existingComputer = m_ComputerManager->m_KnownHosts.value(newComputer->uuid);
|
||||||
|
|
||||||
|
// If it doesn't already exist, convert to a write lock in preparation for updating.
|
||||||
|
//
|
||||||
|
// NB: ComputerManager's lock protects the host map itself, not the elements inside.
|
||||||
|
// Those are protected by their individual locks. Since we only mutate the map itself
|
||||||
|
// when the PC doesn't exist, we need the lock in write-mode for that case only.
|
||||||
|
if (existingComputer == nullptr) {
|
||||||
|
m_ComputerManager->m_Lock.unlock();
|
||||||
|
m_ComputerManager->m_Lock.lockForWrite();
|
||||||
|
|
||||||
|
// Since we had to unlock to lock for write, someone could have raced and added
|
||||||
|
// this PC before us. We have to check again whether it already exists.
|
||||||
|
existingComputer = m_ComputerManager->m_KnownHosts.value(newComputer->uuid);
|
||||||
|
}
|
||||||
|
|
||||||
if (existingComputer != nullptr) {
|
if (existingComputer != nullptr) {
|
||||||
// Fold it into the existing PC
|
// Fold it into the existing PC
|
||||||
bool changed = existingComputer->update(*newComputer);
|
bool changed = existingComputer->update(*newComputer);
|
||||||
delete newComputer;
|
delete newComputer;
|
||||||
|
|
||||||
// Drop the lock before notifying
|
// Drop the lock before notifying
|
||||||
lock.unlock();
|
m_ComputerManager->m_Lock.unlock();
|
||||||
|
|
||||||
// For non-mDNS clients, let them know it succeeded
|
// For non-mDNS clients, let them know it succeeded
|
||||||
if (!m_Mdns) {
|
if (!m_Mdns) {
|
||||||
@@ -752,7 +862,7 @@ private:
|
|||||||
|
|
||||||
// Tell our client if something changed
|
// Tell our client if something changed
|
||||||
if (changed) {
|
if (changed) {
|
||||||
qInfo() << existingComputer->name << "is now at" << existingComputer->activeAddress;
|
qInfo() << existingComputer->name << "is now at" << existingComputer->activeAddress.toString();
|
||||||
emit computerStateChanged(existingComputer);
|
emit computerStateChanged(existingComputer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -764,7 +874,7 @@ private:
|
|||||||
m_ComputerManager->startPollingComputer(newComputer);
|
m_ComputerManager->startPollingComputer(newComputer);
|
||||||
|
|
||||||
// Drop the lock before notifying
|
// Drop the lock before notifying
|
||||||
lock.unlock();
|
m_ComputerManager->m_Lock.unlock();
|
||||||
|
|
||||||
// If this wasn't added via mDNS but it is a RFC 1918 IPv4 address and not a VPN,
|
// If this wasn't added via mDNS but it is a RFC 1918 IPv4 address and not a VPN,
|
||||||
// go ahead and do the STUN request now to populate an external address.
|
// go ahead and do the STUN request now to populate an external address.
|
||||||
@@ -772,9 +882,7 @@ private:
|
|||||||
quint32 addr;
|
quint32 addr;
|
||||||
int err = LiFindExternalAddressIP4("stun.moonlight-stream.org", 3478, &addr);
|
int err = LiFindExternalAddressIP4("stun.moonlight-stream.org", 3478, &addr);
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
lock.relock();
|
newComputer->setRemoteAddress(QHostAddress(qFromBigEndian(addr)));
|
||||||
newComputer->remoteAddress = QHostAddress(qFromBigEndian(addr)).toString();
|
|
||||||
lock.unlock();
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qWarning() << "STUN failed to get WAN address:" << err;
|
qWarning() << "STUN failed to get WAN address:" << err;
|
||||||
@@ -793,12 +901,13 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
ComputerManager* m_ComputerManager;
|
ComputerManager* m_ComputerManager;
|
||||||
QString m_Address;
|
NvAddress m_Address;
|
||||||
QHostAddress m_MdnsIpv6Address;
|
NvAddress m_MdnsIpv6Address;
|
||||||
bool m_Mdns;
|
bool m_Mdns;
|
||||||
|
bool m_AboutToQuit;
|
||||||
};
|
};
|
||||||
|
|
||||||
void ComputerManager::addNewHost(QString address, bool mdns, QHostAddress mdnsIpv6Address)
|
void ComputerManager::addNewHost(NvAddress address, bool mdns, NvAddress mdnsIpv6Address)
|
||||||
{
|
{
|
||||||
// Punt to a worker thread to avoid stalling the
|
// Punt to a worker thread to avoid stalling the
|
||||||
// UI while waiting for serverinfo query to complete
|
// UI while waiting for serverinfo query to complete
|
||||||
@@ -806,4 +915,14 @@ void ComputerManager::addNewHost(QString address, bool mdns, QHostAddress mdnsIp
|
|||||||
QThreadPool::globalInstance()->start(addTask);
|
QThreadPool::globalInstance()->start(addTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Use QRandomGenerator when we drop Qt 5.9 support
|
||||||
|
QString ComputerManager::generatePinString()
|
||||||
|
{
|
||||||
|
std::uniform_int_distribution<int> dist(0, 9999);
|
||||||
|
std::random_device rd;
|
||||||
|
std::mt19937 engine(rd());
|
||||||
|
|
||||||
|
return QString::asprintf("%04u", dist(engine));
|
||||||
|
}
|
||||||
|
|
||||||
#include "computermanager.moc"
|
#include "computermanager.moc"
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "nvcomputer.h"
|
#include "nvcomputer.h"
|
||||||
#include "nvpairingmanager.h"
|
#include "nvpairingmanager.h"
|
||||||
|
#include "settings/compatfetcher.h"
|
||||||
|
|
||||||
#include <qmdnsengine/server.h>
|
#include <qmdnsengine/server.h>
|
||||||
#include <qmdnsengine/cache.h>
|
#include <qmdnsengine/cache.h>
|
||||||
@@ -14,6 +15,27 @@
|
|||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QRunnable>
|
#include <QRunnable>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QMutex>
|
||||||
|
#include <QWaitCondition>
|
||||||
|
|
||||||
|
class ComputerManager;
|
||||||
|
|
||||||
|
class DelayedFlushThread : public QThread
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
DelayedFlushThread(ComputerManager* cm)
|
||||||
|
: m_ComputerManager(cm)
|
||||||
|
{
|
||||||
|
setObjectName("CM Delayed Flush Thread");
|
||||||
|
}
|
||||||
|
|
||||||
|
void run();
|
||||||
|
|
||||||
|
private:
|
||||||
|
ComputerManager* m_ComputerManager;
|
||||||
|
};
|
||||||
|
|
||||||
class MdnsPendingComputer : public QObject
|
class MdnsPendingComputer : public QObject
|
||||||
{
|
{
|
||||||
@@ -23,6 +45,7 @@ public:
|
|||||||
explicit MdnsPendingComputer(QMdnsEngine::Server* server,
|
explicit MdnsPendingComputer(QMdnsEngine::Server* server,
|
||||||
const QMdnsEngine::Service& service)
|
const QMdnsEngine::Service& service)
|
||||||
: m_Hostname(service.hostname()),
|
: m_Hostname(service.hostname()),
|
||||||
|
m_Port(service.port()),
|
||||||
m_Server(server),
|
m_Server(server),
|
||||||
m_Resolver(nullptr)
|
m_Resolver(nullptr)
|
||||||
{
|
{
|
||||||
@@ -40,6 +63,11 @@ public:
|
|||||||
return m_Hostname;
|
return m_Hostname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint16_t port()
|
||||||
|
{
|
||||||
|
return m_Port;
|
||||||
|
}
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleResolvedTimeout()
|
void handleResolvedTimeout()
|
||||||
{
|
{
|
||||||
@@ -74,6 +102,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
QByteArray m_Hostname;
|
QByteArray m_Hostname;
|
||||||
|
uint16_t m_Port;
|
||||||
QMdnsEngine::Server* m_Server;
|
QMdnsEngine::Server* m_Server;
|
||||||
QMdnsEngine::Resolver* m_Resolver;
|
QMdnsEngine::Resolver* m_Resolver;
|
||||||
QVector<QHostAddress> m_Addresses;
|
QVector<QHostAddress> m_Addresses;
|
||||||
@@ -158,6 +187,8 @@ class ComputerManager : public QObject
|
|||||||
|
|
||||||
friend class DeferredHostDeletionTask;
|
friend class DeferredHostDeletionTask;
|
||||||
friend class PendingAddTask;
|
friend class PendingAddTask;
|
||||||
|
friend class PendingPairingTask;
|
||||||
|
friend class DelayedFlushThread;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ComputerManager(QObject *parent = nullptr);
|
explicit ComputerManager(QObject *parent = nullptr);
|
||||||
@@ -168,7 +199,11 @@ public:
|
|||||||
|
|
||||||
Q_INVOKABLE void stopPollingAsync();
|
Q_INVOKABLE void stopPollingAsync();
|
||||||
|
|
||||||
Q_INVOKABLE void addNewHost(QString address, bool mdns, QHostAddress mdnsIpv6Address = QHostAddress());
|
Q_INVOKABLE void addNewHostManually(QString address);
|
||||||
|
|
||||||
|
void addNewHost(NvAddress address, bool mdns, NvAddress mdnsIpv6Address = NvAddress());
|
||||||
|
|
||||||
|
QString generatePinString();
|
||||||
|
|
||||||
void pairHost(NvComputer* computer, QString pin);
|
void pairHost(NvComputer* computer, QString pin);
|
||||||
|
|
||||||
@@ -214,4 +249,9 @@ private:
|
|||||||
QMdnsEngine::Browser* m_MdnsBrowser;
|
QMdnsEngine::Browser* m_MdnsBrowser;
|
||||||
QMdnsEngine::Cache m_MdnsCache;
|
QMdnsEngine::Cache m_MdnsCache;
|
||||||
QVector<MdnsPendingComputer*> m_PendingResolution;
|
QVector<MdnsPendingComputer*> m_PendingResolution;
|
||||||
|
CompatFetcher m_CompatFetcher;
|
||||||
|
DelayedFlushThread* m_DelayedFlushThread;
|
||||||
|
QMutex m_DelayedFlushMutex;
|
||||||
|
QWaitCondition m_DelayedFlushCondition;
|
||||||
|
bool m_NeedsDelayedFlush;
|
||||||
};
|
};
|
||||||
@@ -20,7 +20,7 @@ void ComputerSeeker::start(int timeout)
|
|||||||
// if m_ComputerName is UUID, or the name that doesn't resolve to an IP
|
// if m_ComputerName is UUID, or the name that doesn't resolve to an IP
|
||||||
// address) and by polling it using mDNS, hopefully one of these methods
|
// address) and by polling it using mDNS, hopefully one of these methods
|
||||||
// would find the host
|
// would find the host
|
||||||
m_ComputerManager->addNewHost(m_ComputerName, false);
|
m_ComputerManager->addNewHostManually(m_ComputerName);
|
||||||
m_ComputerManager->startPolling();
|
m_ComputerManager->startPolling();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,8 +44,8 @@ bool ComputerSeeker::matchComputer(NvComputer *computer) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const QString& addr : computer->uniqueAddresses()) {
|
for (const NvAddress& addr : computer->uniqueAddresses()) {
|
||||||
if (addr.toLower() == value) {
|
if (addr.address().toLower() == value || addr.toString().toLower() == value) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
#include "nvaddress.h"
|
||||||
|
|
||||||
|
#include <QHostAddress>
|
||||||
|
|
||||||
|
NvAddress::NvAddress()
|
||||||
|
{
|
||||||
|
setAddress(nullptr);
|
||||||
|
setPort(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
NvAddress::NvAddress(QString addr, uint16_t port)
|
||||||
|
{
|
||||||
|
setAddress(addr);
|
||||||
|
setPort(port);
|
||||||
|
}
|
||||||
|
|
||||||
|
NvAddress::NvAddress(QHostAddress addr, uint16_t port)
|
||||||
|
{
|
||||||
|
setAddress(addr);
|
||||||
|
setPort(port);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t NvAddress::port() const
|
||||||
|
{
|
||||||
|
return m_Port;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString NvAddress::address() const
|
||||||
|
{
|
||||||
|
return m_Address;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NvAddress::setPort(uint16_t port)
|
||||||
|
{
|
||||||
|
m_Port = port;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NvAddress::setAddress(QString addr)
|
||||||
|
{
|
||||||
|
m_Address = addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NvAddress::setAddress(QHostAddress addr)
|
||||||
|
{
|
||||||
|
m_Address = addr.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NvAddress::isNull() const
|
||||||
|
{
|
||||||
|
return m_Address.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString NvAddress::toString() const
|
||||||
|
{
|
||||||
|
if (m_Address.isEmpty()) {
|
||||||
|
return "<NULL>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (QHostAddress(m_Address).protocol() == QAbstractSocket::IPv6Protocol) {
|
||||||
|
return QString("[%1]:%2").arg(m_Address).arg(m_Port);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return QString("%1:%2").arg(m_Address).arg(m_Port);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QHostAddress>
|
||||||
|
|
||||||
|
#define DEFAULT_HTTP_PORT 47989
|
||||||
|
#define DEFAULT_HTTPS_PORT 47984
|
||||||
|
|
||||||
|
class NvAddress
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NvAddress();
|
||||||
|
explicit NvAddress(QString addr, uint16_t port);
|
||||||
|
explicit NvAddress(QHostAddress addr, uint16_t port);
|
||||||
|
|
||||||
|
uint16_t port() const;
|
||||||
|
void setPort(uint16_t port);
|
||||||
|
|
||||||
|
QString address() const;
|
||||||
|
void setAddress(QString addr);
|
||||||
|
void setAddress(QHostAddress addr);
|
||||||
|
|
||||||
|
bool isNull() const;
|
||||||
|
QString toString() const;
|
||||||
|
|
||||||
|
bool operator==(const NvAddress& other) const
|
||||||
|
{
|
||||||
|
return m_Address == other.m_Address &&
|
||||||
|
m_Port == other.m_Port;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator!=(const NvAddress& other) const
|
||||||
|
{
|
||||||
|
return !operator==(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_Address;
|
||||||
|
uint16_t m_Port;
|
||||||
|
};
|
||||||
+120
-46
@@ -1,5 +1,6 @@
|
|||||||
#include "nvcomputer.h"
|
#include "nvcomputer.h"
|
||||||
#include "nvapp.h"
|
#include "nvapp.h"
|
||||||
|
#include "settings/compatfetcher.h"
|
||||||
|
|
||||||
#include <QUdpSocket>
|
#include <QUdpSocket>
|
||||||
#include <QHostInfo>
|
#include <QHostInfo>
|
||||||
@@ -10,12 +11,17 @@
|
|||||||
#define SER_UUID "uuid"
|
#define SER_UUID "uuid"
|
||||||
#define SER_MAC "mac"
|
#define SER_MAC "mac"
|
||||||
#define SER_LOCALADDR "localaddress"
|
#define SER_LOCALADDR "localaddress"
|
||||||
|
#define SER_LOCALPORT "localport"
|
||||||
#define SER_REMOTEADDR "remoteaddress"
|
#define SER_REMOTEADDR "remoteaddress"
|
||||||
|
#define SER_REMOTEPORT "remoteport"
|
||||||
#define SER_MANUALADDR "manualaddress"
|
#define SER_MANUALADDR "manualaddress"
|
||||||
|
#define SER_MANUALPORT "manualport"
|
||||||
#define SER_IPV6ADDR "ipv6address"
|
#define SER_IPV6ADDR "ipv6address"
|
||||||
|
#define SER_IPV6PORT "ipv6port"
|
||||||
#define SER_APPLIST "apps"
|
#define SER_APPLIST "apps"
|
||||||
#define SER_SRVCERT "srvcert"
|
#define SER_SRVCERT "srvcert"
|
||||||
#define SER_CUSTOMNAME "customname"
|
#define SER_CUSTOMNAME "customname"
|
||||||
|
#define SER_NVIDIASOFTWARE "nvidiasw"
|
||||||
|
|
||||||
NvComputer::NvComputer(QSettings& settings)
|
NvComputer::NvComputer(QSettings& settings)
|
||||||
{
|
{
|
||||||
@@ -23,11 +29,16 @@ NvComputer::NvComputer(QSettings& settings)
|
|||||||
this->uuid = settings.value(SER_UUID).toString();
|
this->uuid = settings.value(SER_UUID).toString();
|
||||||
this->hasCustomName = settings.value(SER_CUSTOMNAME).toBool();
|
this->hasCustomName = settings.value(SER_CUSTOMNAME).toBool();
|
||||||
this->macAddress = settings.value(SER_MAC).toByteArray();
|
this->macAddress = settings.value(SER_MAC).toByteArray();
|
||||||
this->localAddress = settings.value(SER_LOCALADDR).toString();
|
this->localAddress = NvAddress(settings.value(SER_LOCALADDR).toString(),
|
||||||
this->remoteAddress = settings.value(SER_REMOTEADDR).toString();
|
settings.value(SER_LOCALPORT, QVariant(DEFAULT_HTTP_PORT)).toUInt());
|
||||||
this->ipv6Address = settings.value(SER_IPV6ADDR).toString();
|
this->remoteAddress = NvAddress(settings.value(SER_REMOTEADDR).toString(),
|
||||||
this->manualAddress = settings.value(SER_MANUALADDR).toString();
|
settings.value(SER_REMOTEPORT, QVariant(DEFAULT_HTTP_PORT)).toUInt());
|
||||||
|
this->ipv6Address = NvAddress(settings.value(SER_IPV6ADDR).toString(),
|
||||||
|
settings.value(SER_IPV6PORT, QVariant(DEFAULT_HTTP_PORT)).toUInt());
|
||||||
|
this->manualAddress = NvAddress(settings.value(SER_MANUALADDR).toString(),
|
||||||
|
settings.value(SER_MANUALPORT, QVariant(DEFAULT_HTTP_PORT)).toUInt());
|
||||||
this->serverCert = QSslCertificate(settings.value(SER_SRVCERT).toByteArray());
|
this->serverCert = QSslCertificate(settings.value(SER_SRVCERT).toByteArray());
|
||||||
|
this->isNvidiaServerSoftware = settings.value(SER_NVIDIASOFTWARE).toBool();
|
||||||
|
|
||||||
int appCount = settings.beginReadArray(SER_APPLIST);
|
int appCount = settings.beginReadArray(SER_APPLIST);
|
||||||
this->appList.reserve(appCount);
|
this->appList.reserve(appCount);
|
||||||
@@ -40,7 +51,6 @@ NvComputer::NvComputer(QSettings& settings)
|
|||||||
settings.endArray();
|
settings.endArray();
|
||||||
sortAppList();
|
sortAppList();
|
||||||
|
|
||||||
this->activeAddress = nullptr;
|
|
||||||
this->currentGameId = 0;
|
this->currentGameId = 0;
|
||||||
this->pairState = PS_UNKNOWN;
|
this->pairState = PS_UNKNOWN;
|
||||||
this->state = CS_UNKNOWN;
|
this->state = CS_UNKNOWN;
|
||||||
@@ -50,6 +60,18 @@ NvComputer::NvComputer(QSettings& settings)
|
|||||||
this->serverCodecModeSupport = 0;
|
this->serverCodecModeSupport = 0;
|
||||||
this->pendingQuit = false;
|
this->pendingQuit = false;
|
||||||
this->gpuModel = nullptr;
|
this->gpuModel = nullptr;
|
||||||
|
this->isSupportedServerVersion = true;
|
||||||
|
this->externalPort = this->remoteAddress.port();
|
||||||
|
this->activeHttpsPort = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NvComputer::setRemoteAddress(QHostAddress address)
|
||||||
|
{
|
||||||
|
QWriteLocker lock(&this->lock);
|
||||||
|
|
||||||
|
Q_ASSERT(this->externalPort != 0);
|
||||||
|
|
||||||
|
this->remoteAddress = NvAddress(address, this->externalPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NvComputer::serialize(QSettings& settings) const
|
void NvComputer::serialize(QSettings& settings) const
|
||||||
@@ -60,11 +82,16 @@ void NvComputer::serialize(QSettings& settings) const
|
|||||||
settings.setValue(SER_CUSTOMNAME, hasCustomName);
|
settings.setValue(SER_CUSTOMNAME, hasCustomName);
|
||||||
settings.setValue(SER_UUID, uuid);
|
settings.setValue(SER_UUID, uuid);
|
||||||
settings.setValue(SER_MAC, macAddress);
|
settings.setValue(SER_MAC, macAddress);
|
||||||
settings.setValue(SER_LOCALADDR, localAddress);
|
settings.setValue(SER_LOCALADDR, localAddress.address());
|
||||||
settings.setValue(SER_REMOTEADDR, remoteAddress);
|
settings.setValue(SER_LOCALPORT, localAddress.port());
|
||||||
settings.setValue(SER_IPV6ADDR, ipv6Address);
|
settings.setValue(SER_REMOTEADDR, remoteAddress.address());
|
||||||
settings.setValue(SER_MANUALADDR, manualAddress);
|
settings.setValue(SER_REMOTEPORT, remoteAddress.port());
|
||||||
|
settings.setValue(SER_IPV6ADDR, ipv6Address.address());
|
||||||
|
settings.setValue(SER_IPV6PORT, ipv6Address.port());
|
||||||
|
settings.setValue(SER_MANUALADDR, manualAddress.address());
|
||||||
|
settings.setValue(SER_MANUALPORT, manualAddress.port());
|
||||||
settings.setValue(SER_SRVCERT, serverCert.toPem());
|
settings.setValue(SER_SRVCERT, serverCert.toPem());
|
||||||
|
settings.setValue(SER_NVIDIASOFTWARE, isNvidiaServerSoftware);
|
||||||
|
|
||||||
// Avoid deleting an existing applist if we couldn't get one
|
// Avoid deleting an existing applist if we couldn't get one
|
||||||
if (!appList.isEmpty()) {
|
if (!appList.isEmpty()) {
|
||||||
@@ -85,9 +112,9 @@ void NvComputer::sortAppList()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
NvComputer::NvComputer(QString address, QString serverInfo, QSslCertificate serverCert)
|
NvComputer::NvComputer(NvHTTP& http, QString serverInfo)
|
||||||
{
|
{
|
||||||
this->serverCert = serverCert;
|
this->serverCert = http.serverCert();
|
||||||
|
|
||||||
this->hasCustomName = false;
|
this->hasCustomName = false;
|
||||||
this->name = NvHTTP::getXmlString(serverInfo, "hostname");
|
this->name = NvHTTP::getXmlString(serverInfo, "hostname");
|
||||||
@@ -128,33 +155,71 @@ NvComputer::NvComputer(QString address, QString serverInfo, QSslCertificate serv
|
|||||||
});
|
});
|
||||||
|
|
||||||
// We can get an IPv4 loopback address if we're using the GS IPv6 Forwarder
|
// We can get an IPv4 loopback address if we're using the GS IPv6 Forwarder
|
||||||
this->localAddress = NvHTTP::getXmlString(serverInfo, "LocalIP");
|
this->localAddress = NvAddress(NvHTTP::getXmlString(serverInfo, "LocalIP"), http.httpPort());
|
||||||
if (this->localAddress.startsWith("127.")) {
|
if (this->localAddress.address().startsWith("127.")) {
|
||||||
this->localAddress = QString();
|
this->localAddress = NvAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
this->remoteAddress = NvHTTP::getXmlString(serverInfo, "ExternalIP");
|
QString httpsPort = NvHTTP::getXmlString(serverInfo, "HttpsPort");
|
||||||
|
if (httpsPort.isEmpty() || (this->activeHttpsPort = httpsPort.toUShort()) == 0) {
|
||||||
|
this->activeHttpsPort = DEFAULT_HTTPS_PORT;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is an extension which is not present in GFE. It is present for Sunshine to be able
|
||||||
|
// to support dynamic HTTP WAN ports without requiring the user to manually enter the port.
|
||||||
|
QString remotePortStr = NvHTTP::getXmlString(serverInfo, "ExternalPort");
|
||||||
|
if (remotePortStr.isEmpty() || (this->externalPort = remotePortStr.toUShort()) == 0) {
|
||||||
|
this->externalPort = DEFAULT_HTTP_PORT;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString remoteAddress = NvHTTP::getXmlString(serverInfo, "ExternalIP");
|
||||||
|
if (!remoteAddress.isEmpty()) {
|
||||||
|
this->remoteAddress = NvAddress(remoteAddress, this->externalPort);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this->remoteAddress = NvAddress();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Real Nvidia host software (GeForce Experience and RTX Experience) both use the 'Mjolnir'
|
||||||
|
// codename in the state field and no version of Sunshine does. We can use this to bypass
|
||||||
|
// some assumptions about Nvidia hardware that don't apply to Sunshine hosts.
|
||||||
|
this->isNvidiaServerSoftware = NvHTTP::getXmlString(serverInfo, "state").contains("MJOLNIR");
|
||||||
|
|
||||||
this->pairState = NvHTTP::getXmlString(serverInfo, "PairStatus") == "1" ?
|
this->pairState = NvHTTP::getXmlString(serverInfo, "PairStatus") == "1" ?
|
||||||
PS_PAIRED : PS_NOT_PAIRED;
|
PS_PAIRED : PS_NOT_PAIRED;
|
||||||
this->currentGameId = NvHTTP::getCurrentGame(serverInfo);
|
this->currentGameId = NvHTTP::getCurrentGame(serverInfo);
|
||||||
this->appVersion = NvHTTP::getXmlString(serverInfo, "appversion");
|
this->appVersion = NvHTTP::getXmlString(serverInfo, "appversion");
|
||||||
this->gfeVersion = NvHTTP::getXmlString(serverInfo, "GfeVersion");
|
this->gfeVersion = NvHTTP::getXmlString(serverInfo, "GfeVersion");
|
||||||
this->gpuModel = NvHTTP::getXmlString(serverInfo, "gputype");
|
this->gpuModel = NvHTTP::getXmlString(serverInfo, "gputype");
|
||||||
this->activeAddress = address;
|
this->activeAddress = http.address();
|
||||||
this->state = NvComputer::CS_ONLINE;
|
this->state = NvComputer::CS_ONLINE;
|
||||||
this->pendingQuit = false;
|
this->pendingQuit = false;
|
||||||
|
this->isSupportedServerVersion = CompatFetcher::isGfeVersionSupported(this->gfeVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NvComputer::wake()
|
bool NvComputer::wake() const
|
||||||
{
|
{
|
||||||
if (state == NvComputer::CS_ONLINE) {
|
QByteArray wolPayload;
|
||||||
qWarning() << name << "is already online";
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (macAddress.isEmpty()) {
|
{
|
||||||
qWarning() << name << "has no MAC address stored";
|
QReadLocker readLocker(&lock);
|
||||||
return false;
|
|
||||||
|
if (state == NvComputer::CS_ONLINE) {
|
||||||
|
qWarning() << name << "is already online";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (macAddress.isEmpty()) {
|
||||||
|
qWarning() << name << "has no MAC address stored";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the WoL payload
|
||||||
|
wolPayload.append(QByteArray::fromHex("FFFFFFFFFFFF"));
|
||||||
|
for (int i = 0; i < 16; i++) {
|
||||||
|
wolPayload.append(macAddress);
|
||||||
|
}
|
||||||
|
Q_ASSERT(wolPayload.count() == 102);
|
||||||
}
|
}
|
||||||
|
|
||||||
const quint16 WOL_PORTS[] = {
|
const quint16 WOL_PORTS[] = {
|
||||||
@@ -163,18 +228,13 @@ bool NvComputer::wake()
|
|||||||
47009, // Port opened by Moonlight Internet Hosting Tool for WoL (non-privileged port)
|
47009, // Port opened by Moonlight Internet Hosting Tool for WoL (non-privileged port)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create the WoL payload
|
|
||||||
QByteArray wolPayload;
|
|
||||||
wolPayload.append(QByteArray::fromHex("FFFFFFFFFFFF"));
|
|
||||||
for (int i = 0; i < 16; i++) {
|
|
||||||
wolPayload.append(macAddress);
|
|
||||||
}
|
|
||||||
Q_ASSERT(wolPayload.count() == 102);
|
|
||||||
|
|
||||||
// Add the addresses that we know this host to be
|
// Add the addresses that we know this host to be
|
||||||
// and broadcast addresses for this link just in
|
// and broadcast addresses for this link just in
|
||||||
// case the host has timed out in ARP entries.
|
// case the host has timed out in ARP entries.
|
||||||
QVector<QString> addressList = uniqueAddresses();
|
QVector<QString> addressList;
|
||||||
|
for (const NvAddress& addr : uniqueAddresses()) {
|
||||||
|
addressList.append(addr.address());
|
||||||
|
}
|
||||||
addressList.append("255.255.255.255");
|
addressList.append("255.255.255.255");
|
||||||
|
|
||||||
// Try to broadcast on all available NICs
|
// Try to broadcast on all available NICs
|
||||||
@@ -233,16 +293,25 @@ bool NvComputer::wake()
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NvComputer::isReachableOverVpn()
|
bool NvComputer::isReachableOverVpn() const
|
||||||
{
|
{
|
||||||
if (activeAddress.isEmpty()) {
|
NvAddress copyOfActiveAddress;
|
||||||
return false;
|
|
||||||
|
{
|
||||||
|
QReadLocker readLocker(&lock);
|
||||||
|
|
||||||
|
if (activeAddress.isNull()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Grab a copy of the active address to avoid having to hold
|
||||||
|
// the computer lock while doing socket operations
|
||||||
|
copyOfActiveAddress = activeAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTcpSocket s;
|
QTcpSocket s;
|
||||||
|
|
||||||
s.setProxy(QNetworkProxy::NoProxy);
|
s.setProxy(QNetworkProxy::NoProxy);
|
||||||
s.connectToHost(activeAddress, 47984);
|
s.connectToHost(copyOfActiveAddress.address(), copyOfActiveAddress.port());
|
||||||
if (s.waitForConnected(3000)) {
|
if (s.waitForConnected(3000)) {
|
||||||
Q_ASSERT(!s.localAddress().isNull());
|
Q_ASSERT(!s.localAddress().isNull());
|
||||||
|
|
||||||
@@ -328,9 +397,10 @@ bool NvComputer::updateAppList(QVector<NvApp> newAppList) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<QString> NvComputer::uniqueAddresses() const
|
QVector<NvAddress> NvComputer::uniqueAddresses() const
|
||||||
{
|
{
|
||||||
QVector<QString> uniqueAddressList;
|
QReadLocker readLocker(&lock);
|
||||||
|
QVector<NvAddress> uniqueAddressList;
|
||||||
|
|
||||||
// Start with addresses correctly ordered
|
// Start with addresses correctly ordered
|
||||||
uniqueAddressList.append(activeAddress);
|
uniqueAddressList.append(activeAddress);
|
||||||
@@ -341,7 +411,7 @@ QVector<QString> NvComputer::uniqueAddresses() const
|
|||||||
|
|
||||||
// Prune duplicates (always giving precedence to the first)
|
// Prune duplicates (always giving precedence to the first)
|
||||||
for (int i = 0; i < uniqueAddressList.count(); i++) {
|
for (int i = 0; i < uniqueAddressList.count(); i++) {
|
||||||
if (uniqueAddressList[i].isEmpty()) {
|
if (uniqueAddressList[i].isNull()) {
|
||||||
uniqueAddressList.remove(i);
|
uniqueAddressList.remove(i);
|
||||||
i--;
|
i--;
|
||||||
continue;
|
continue;
|
||||||
@@ -361,7 +431,7 @@ QVector<QString> NvComputer::uniqueAddresses() const
|
|||||||
return uniqueAddressList;
|
return uniqueAddressList;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NvComputer::update(NvComputer& that)
|
bool NvComputer::update(const NvComputer& that)
|
||||||
{
|
{
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
@@ -397,10 +467,12 @@ bool NvComputer::update(NvComputer& that)
|
|||||||
ASSIGN_IF_CHANGED(name);
|
ASSIGN_IF_CHANGED(name);
|
||||||
}
|
}
|
||||||
ASSIGN_IF_CHANGED_AND_NONEMPTY(macAddress);
|
ASSIGN_IF_CHANGED_AND_NONEMPTY(macAddress);
|
||||||
ASSIGN_IF_CHANGED_AND_NONEMPTY(localAddress);
|
ASSIGN_IF_CHANGED_AND_NONNULL(localAddress);
|
||||||
ASSIGN_IF_CHANGED_AND_NONEMPTY(remoteAddress);
|
ASSIGN_IF_CHANGED_AND_NONNULL(remoteAddress);
|
||||||
ASSIGN_IF_CHANGED_AND_NONEMPTY(ipv6Address);
|
ASSIGN_IF_CHANGED_AND_NONNULL(ipv6Address);
|
||||||
ASSIGN_IF_CHANGED_AND_NONEMPTY(manualAddress);
|
ASSIGN_IF_CHANGED_AND_NONNULL(manualAddress);
|
||||||
|
ASSIGN_IF_CHANGED(activeHttpsPort);
|
||||||
|
ASSIGN_IF_CHANGED(externalPort);
|
||||||
ASSIGN_IF_CHANGED(pairState);
|
ASSIGN_IF_CHANGED(pairState);
|
||||||
ASSIGN_IF_CHANGED(serverCodecModeSupport);
|
ASSIGN_IF_CHANGED(serverCodecModeSupport);
|
||||||
ASSIGN_IF_CHANGED(currentGameId);
|
ASSIGN_IF_CHANGED(currentGameId);
|
||||||
@@ -408,6 +480,8 @@ bool NvComputer::update(NvComputer& that)
|
|||||||
ASSIGN_IF_CHANGED(state);
|
ASSIGN_IF_CHANGED(state);
|
||||||
ASSIGN_IF_CHANGED(gfeVersion);
|
ASSIGN_IF_CHANGED(gfeVersion);
|
||||||
ASSIGN_IF_CHANGED(appVersion);
|
ASSIGN_IF_CHANGED(appVersion);
|
||||||
|
ASSIGN_IF_CHANGED(isSupportedServerVersion);
|
||||||
|
ASSIGN_IF_CHANGED(isNvidiaServerSoftware);
|
||||||
ASSIGN_IF_CHANGED(maxLumaPixelsHEVC);
|
ASSIGN_IF_CHANGED(maxLumaPixelsHEVC);
|
||||||
ASSIGN_IF_CHANGED(gpuModel);
|
ASSIGN_IF_CHANGED(gpuModel);
|
||||||
ASSIGN_IF_CHANGED_AND_NONNULL(serverCert);
|
ASSIGN_IF_CHANGED_AND_NONNULL(serverCert);
|
||||||
|
|||||||
+21
-11
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "nvhttp.h"
|
#include "nvhttp.h"
|
||||||
|
#include "nvaddress.h"
|
||||||
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QReadWriteLock>
|
#include <QReadWriteLock>
|
||||||
@@ -21,20 +22,23 @@ private:
|
|||||||
bool pendingQuit;
|
bool pendingQuit;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit NvComputer(QString address, QString serverInfo, QSslCertificate serverCert);
|
explicit NvComputer(NvHTTP& http, QString serverInfo);
|
||||||
|
|
||||||
explicit NvComputer(QSettings& settings);
|
explicit NvComputer(QSettings& settings);
|
||||||
|
|
||||||
bool
|
void
|
||||||
update(NvComputer& that);
|
setRemoteAddress(QHostAddress);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
wake();
|
update(const NvComputer& that);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isReachableOverVpn();
|
wake() const;
|
||||||
|
|
||||||
QVector<QString>
|
bool
|
||||||
|
isReachableOverVpn() const;
|
||||||
|
|
||||||
|
QVector<NvAddress>
|
||||||
uniqueAddresses() const;
|
uniqueAddresses() const;
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -57,7 +61,8 @@ public:
|
|||||||
// Ephemeral traits
|
// Ephemeral traits
|
||||||
ComputerState state;
|
ComputerState state;
|
||||||
PairState pairState;
|
PairState pairState;
|
||||||
QString activeAddress;
|
NvAddress activeAddress;
|
||||||
|
uint16_t activeHttpsPort;
|
||||||
int currentGameId;
|
int currentGameId;
|
||||||
QString gfeVersion;
|
QString gfeVersion;
|
||||||
QString appVersion;
|
QString appVersion;
|
||||||
@@ -65,19 +70,24 @@ public:
|
|||||||
int maxLumaPixelsHEVC;
|
int maxLumaPixelsHEVC;
|
||||||
int serverCodecModeSupport;
|
int serverCodecModeSupport;
|
||||||
QString gpuModel;
|
QString gpuModel;
|
||||||
|
bool isSupportedServerVersion;
|
||||||
|
|
||||||
// Persisted traits
|
// Persisted traits
|
||||||
QString localAddress;
|
NvAddress localAddress;
|
||||||
QString remoteAddress;
|
NvAddress remoteAddress;
|
||||||
QString ipv6Address;
|
NvAddress ipv6Address;
|
||||||
QString manualAddress;
|
NvAddress manualAddress;
|
||||||
QByteArray macAddress;
|
QByteArray macAddress;
|
||||||
QString name;
|
QString name;
|
||||||
bool hasCustomName;
|
bool hasCustomName;
|
||||||
QString uuid;
|
QString uuid;
|
||||||
QSslCertificate serverCert;
|
QSslCertificate serverCert;
|
||||||
QVector<NvApp> appList;
|
QVector<NvApp> appList;
|
||||||
|
bool isNvidiaServerSoftware;
|
||||||
|
|
||||||
// Synchronization
|
// Synchronization
|
||||||
mutable QReadWriteLock lock;
|
mutable QReadWriteLock lock;
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint16_t externalPort;
|
||||||
};
|
};
|
||||||
+75
-14
@@ -1,4 +1,4 @@
|
|||||||
#include "nvhttp.h"
|
#include "nvcomputer.h"
|
||||||
#include <Limelight.h>
|
#include <Limelight.h>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@@ -18,15 +18,14 @@
|
|||||||
#define RESUME_TIMEOUT_MS 30000
|
#define RESUME_TIMEOUT_MS 30000
|
||||||
#define QUIT_TIMEOUT_MS 30000
|
#define QUIT_TIMEOUT_MS 30000
|
||||||
|
|
||||||
NvHTTP::NvHTTP(QString address, QSslCertificate serverCert) :
|
NvHTTP::NvHTTP(NvAddress address, uint16_t httpsPort, QSslCertificate serverCert) :
|
||||||
m_ServerCert(serverCert)
|
m_ServerCert(serverCert)
|
||||||
{
|
{
|
||||||
m_BaseUrlHttp.setScheme("http");
|
m_BaseUrlHttp.setScheme("http");
|
||||||
m_BaseUrlHttps.setScheme("https");
|
m_BaseUrlHttps.setScheme("https");
|
||||||
m_BaseUrlHttp.setPort(47989);
|
|
||||||
m_BaseUrlHttps.setPort(47984);
|
|
||||||
|
|
||||||
setAddress(address);
|
setAddress(address);
|
||||||
|
setHttpsPort(httpsPort);
|
||||||
|
|
||||||
// Never use a proxy server
|
// Never use a proxy server
|
||||||
QNetworkProxy noProxy(QNetworkProxy::NoProxy);
|
QNetworkProxy noProxy(QNetworkProxy::NoProxy);
|
||||||
@@ -35,26 +34,54 @@ NvHTTP::NvHTTP(QString address, QSslCertificate serverCert) :
|
|||||||
connect(&m_Nam, &QNetworkAccessManager::sslErrors, this, &NvHTTP::handleSslErrors);
|
connect(&m_Nam, &QNetworkAccessManager::sslErrors, this, &NvHTTP::handleSslErrors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NvHTTP::NvHTTP(NvComputer* computer) :
|
||||||
|
NvHTTP(computer->activeAddress, computer->activeHttpsPort, computer->serverCert)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void NvHTTP::setServerCert(QSslCertificate serverCert)
|
void NvHTTP::setServerCert(QSslCertificate serverCert)
|
||||||
{
|
{
|
||||||
m_ServerCert = serverCert;
|
m_ServerCert = serverCert;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NvHTTP::setAddress(QString address)
|
void NvHTTP::setAddress(NvAddress address)
|
||||||
{
|
{
|
||||||
Q_ASSERT(!address.isEmpty());
|
Q_ASSERT(!address.isNull());
|
||||||
|
|
||||||
m_Address = address;
|
m_Address = address;
|
||||||
|
|
||||||
m_BaseUrlHttp.setHost(address);
|
m_BaseUrlHttp.setHost(address.address());
|
||||||
m_BaseUrlHttps.setHost(address);
|
m_BaseUrlHttps.setHost(address.address());
|
||||||
|
|
||||||
|
m_BaseUrlHttp.setPort(address.port());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString NvHTTP::address()
|
void NvHTTP::setHttpsPort(uint16_t port)
|
||||||
|
{
|
||||||
|
m_BaseUrlHttps.setPort(port);
|
||||||
|
}
|
||||||
|
|
||||||
|
NvAddress NvHTTP::address()
|
||||||
{
|
{
|
||||||
return m_Address;
|
return m_Address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QSslCertificate NvHTTP::serverCert()
|
||||||
|
{
|
||||||
|
return m_ServerCert;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t NvHTTP::httpPort()
|
||||||
|
{
|
||||||
|
return m_BaseUrlHttp.port();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t NvHTTP::httpsPort()
|
||||||
|
{
|
||||||
|
return m_BaseUrlHttps.port();
|
||||||
|
}
|
||||||
|
|
||||||
QVector<int>
|
QVector<int>
|
||||||
NvHTTP::parseQuad(QString quad)
|
NvHTTP::parseQuad(QString quad)
|
||||||
{
|
{
|
||||||
@@ -98,8 +125,8 @@ NvHTTP::getServerInfo(NvLogLevel logLevel, bool fastFail)
|
|||||||
{
|
{
|
||||||
QString serverInfo;
|
QString serverInfo;
|
||||||
|
|
||||||
// Check if we have a pinned cert for this host yet
|
// Check if we have a pinned cert and HTTPS port for this host yet
|
||||||
if (!m_ServerCert.isNull())
|
if (!m_ServerCert.isNull() && httpsPort() != 0)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -134,13 +161,26 @@ NvHTTP::getServerInfo(NvLogLevel logLevel, bool fastFail)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Only use HTTP prior to pairing
|
// Only use HTTP prior to pairing or fetching HTTPS port
|
||||||
serverInfo = openConnectionToString(m_BaseUrlHttp,
|
serverInfo = openConnectionToString(m_BaseUrlHttp,
|
||||||
"serverinfo",
|
"serverinfo",
|
||||||
nullptr,
|
nullptr,
|
||||||
fastFail ? FAST_FAIL_TIMEOUT_MS : REQUEST_TIMEOUT_MS,
|
fastFail ? FAST_FAIL_TIMEOUT_MS : REQUEST_TIMEOUT_MS,
|
||||||
logLevel);
|
logLevel);
|
||||||
verifyResponseStatus(serverInfo);
|
verifyResponseStatus(serverInfo);
|
||||||
|
|
||||||
|
// Populate the HTTPS port
|
||||||
|
uint16_t httpsPort = getXmlString(serverInfo, "HttpsPort").toUShort();
|
||||||
|
if (httpsPort == 0) {
|
||||||
|
httpsPort = DEFAULT_HTTPS_PORT;
|
||||||
|
}
|
||||||
|
setHttpsPort(httpsPort);
|
||||||
|
|
||||||
|
// If we just needed to determine the HTTPS port, we'll try again over
|
||||||
|
// HTTPS now that we have the port number
|
||||||
|
if (!m_ServerCert.isNull()) {
|
||||||
|
return getServerInfo(logLevel, fastFail);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return serverInfo;
|
return serverInfo;
|
||||||
@@ -151,7 +191,8 @@ NvHTTP::launchApp(int appId,
|
|||||||
PSTREAM_CONFIGURATION streamConfig,
|
PSTREAM_CONFIGURATION streamConfig,
|
||||||
bool sops,
|
bool sops,
|
||||||
bool localAudio,
|
bool localAudio,
|
||||||
int gamepadMask)
|
int gamepadMask,
|
||||||
|
QString& rtspSessionUrl)
|
||||||
{
|
{
|
||||||
int riKeyId;
|
int riKeyId;
|
||||||
|
|
||||||
@@ -181,12 +222,16 @@ NvHTTP::launchApp(int appId,
|
|||||||
"&gcmap="+QString::number(gamepadMask),
|
"&gcmap="+QString::number(gamepadMask),
|
||||||
LAUNCH_TIMEOUT_MS);
|
LAUNCH_TIMEOUT_MS);
|
||||||
|
|
||||||
|
qInfo() << "Launch response:" << response;
|
||||||
|
|
||||||
// Throws if the request failed
|
// Throws if the request failed
|
||||||
verifyResponseStatus(response);
|
verifyResponseStatus(response);
|
||||||
|
|
||||||
|
rtspSessionUrl = getXmlString(response, "sessionUrl0");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
NvHTTP::resumeApp(PSTREAM_CONFIGURATION streamConfig)
|
NvHTTP::resumeApp(PSTREAM_CONFIGURATION streamConfig, QString& rtspSessionUrl)
|
||||||
{
|
{
|
||||||
int riKeyId;
|
int riKeyId;
|
||||||
|
|
||||||
@@ -201,8 +246,12 @@ NvHTTP::resumeApp(PSTREAM_CONFIGURATION streamConfig)
|
|||||||
"&surroundAudioInfo="+QString::number(SURROUNDAUDIOINFO_FROM_AUDIO_CONFIGURATION(streamConfig->audioConfiguration)),
|
"&surroundAudioInfo="+QString::number(SURROUNDAUDIOINFO_FROM_AUDIO_CONFIGURATION(streamConfig->audioConfiguration)),
|
||||||
RESUME_TIMEOUT_MS);
|
RESUME_TIMEOUT_MS);
|
||||||
|
|
||||||
|
qInfo() << "Resume response:" << response;
|
||||||
|
|
||||||
// Throws if the request failed
|
// Throws if the request failed
|
||||||
verifyResponseStatus(response);
|
verifyResponseStatus(response);
|
||||||
|
|
||||||
|
rtspSessionUrl = getXmlString(response, "sessionUrl0");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -214,6 +263,8 @@ NvHTTP::quitApp()
|
|||||||
nullptr,
|
nullptr,
|
||||||
QUIT_TIMEOUT_MS);
|
QUIT_TIMEOUT_MS);
|
||||||
|
|
||||||
|
qInfo() << "Quit response:" << response;
|
||||||
|
|
||||||
// Throws if the request failed
|
// Throws if the request failed
|
||||||
verifyResponseStatus(response);
|
verifyResponseStatus(response);
|
||||||
|
|
||||||
@@ -330,6 +381,8 @@ NvHTTP::verifyResponseStatus(QString xml)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw GfeHttpResponseException(-1, "Malformed GFE XML (missing root element)");
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage
|
QImage
|
||||||
@@ -435,6 +488,9 @@ NvHTTP::openConnection(QUrl baseUrl,
|
|||||||
int timeoutMs,
|
int timeoutMs,
|
||||||
NvLogLevel logLevel)
|
NvLogLevel logLevel)
|
||||||
{
|
{
|
||||||
|
// Port must be set
|
||||||
|
Q_ASSERT(baseUrl.port(0) != 0);
|
||||||
|
|
||||||
// Build a URL for the request
|
// Build a URL for the request
|
||||||
QUrl url(baseUrl);
|
QUrl url(baseUrl);
|
||||||
url.setPath("/" + command);
|
url.setPath("/" + command);
|
||||||
@@ -451,6 +507,11 @@ NvHTTP::openConnection(QUrl baseUrl,
|
|||||||
// Add our client certificate
|
// Add our client certificate
|
||||||
request.setSslConfiguration(IdentityManager::get()->getSslConfig());
|
request.setSslConfiguration(IdentityManager::get()->getSslConfig());
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
// Disable HTTP/2 (GFE 3.22 doesn't like it) and Qt 6 enables it by default
|
||||||
|
request.setAttribute(QNetworkRequest::Http2AllowedAttribute, false);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) && QT_VERSION < QT_VERSION_CHECK(5, 15, 1) && !defined(QT_NO_BEARERMANAGEMENT)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) && QT_VERSION < QT_VERSION_CHECK(5, 15, 1) && !defined(QT_NO_BEARERMANAGEMENT)
|
||||||
// HACK: Set network accessibility to work around QTBUG-80947 (introduced in Qt 5.14.0 and fixed in Qt 5.15.1)
|
// HACK: Set network accessibility to work around QTBUG-80947 (introduced in Qt 5.14.0 and fixed in Qt 5.15.1)
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
|
|||||||
+20
-6
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "identitymanager.h"
|
#include "identitymanager.h"
|
||||||
#include "nvapp.h"
|
#include "nvapp.h"
|
||||||
|
#include "nvaddress.h"
|
||||||
|
|
||||||
#include <Limelight.h>
|
#include <Limelight.h>
|
||||||
|
|
||||||
@@ -9,6 +10,8 @@
|
|||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
|
|
||||||
|
class NvComputer;
|
||||||
|
|
||||||
class NvDisplayMode
|
class NvDisplayMode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -106,7 +109,9 @@ public:
|
|||||||
NVLL_VERBOSE
|
NVLL_VERBOSE
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit NvHTTP(QString address, QSslCertificate serverCert);
|
explicit NvHTTP(NvAddress address, uint16_t httpsPort, QSslCertificate serverCert);
|
||||||
|
|
||||||
|
explicit NvHTTP(NvComputer* computer);
|
||||||
|
|
||||||
static
|
static
|
||||||
int
|
int
|
||||||
@@ -138,9 +143,16 @@ public:
|
|||||||
|
|
||||||
void setServerCert(QSslCertificate serverCert);
|
void setServerCert(QSslCertificate serverCert);
|
||||||
|
|
||||||
void setAddress(QString address);
|
void setAddress(NvAddress address);
|
||||||
|
void setHttpsPort(uint16_t port);
|
||||||
|
|
||||||
QString address();
|
NvAddress address();
|
||||||
|
|
||||||
|
QSslCertificate serverCert();
|
||||||
|
|
||||||
|
uint16_t httpPort();
|
||||||
|
|
||||||
|
uint16_t httpsPort();
|
||||||
|
|
||||||
static
|
static
|
||||||
QVector<int>
|
QVector<int>
|
||||||
@@ -150,14 +162,16 @@ public:
|
|||||||
quitApp();
|
quitApp();
|
||||||
|
|
||||||
void
|
void
|
||||||
resumeApp(PSTREAM_CONFIGURATION streamConfig);
|
resumeApp(PSTREAM_CONFIGURATION streamConfig,
|
||||||
|
QString& rtspSessionUrl);
|
||||||
|
|
||||||
void
|
void
|
||||||
launchApp(int appId,
|
launchApp(int appId,
|
||||||
PSTREAM_CONFIGURATION streamConfig,
|
PSTREAM_CONFIGURATION streamConfig,
|
||||||
bool sops,
|
bool sops,
|
||||||
bool localAudio,
|
bool localAudio,
|
||||||
int gamepadMask);
|
int gamepadMask,
|
||||||
|
QString& rtspSessionUrl);
|
||||||
|
|
||||||
QVector<NvApp>
|
QVector<NvApp>
|
||||||
getAppList();
|
getAppList();
|
||||||
@@ -182,7 +196,7 @@ private:
|
|||||||
int timeoutMs,
|
int timeoutMs,
|
||||||
NvLogLevel logLevel);
|
NvLogLevel logLevel);
|
||||||
|
|
||||||
QString m_Address;
|
NvAddress m_Address;
|
||||||
QNetworkAccessManager m_Nam;
|
QNetworkAccessManager m_Nam;
|
||||||
QSslCertificate m_ServerCert;
|
QSslCertificate m_ServerCert;
|
||||||
};
|
};
|
||||||
@@ -11,8 +11,8 @@
|
|||||||
|
|
||||||
#define REQUEST_TIMEOUT_MS 5000
|
#define REQUEST_TIMEOUT_MS 5000
|
||||||
|
|
||||||
NvPairingManager::NvPairingManager(QString address) :
|
NvPairingManager::NvPairingManager(NvComputer* computer) :
|
||||||
m_Http(address, QSslCertificate())
|
m_Http(computer)
|
||||||
{
|
{
|
||||||
QByteArray cert = IdentityManager::get()->getCertificate();
|
QByteArray cert = IdentityManager::get()->getCertificate();
|
||||||
BIO *bio = BIO_new_mem_buf(cert.data(), -1);
|
BIO *bio = BIO_new_mem_buf(cert.data(), -1);
|
||||||
@@ -167,11 +167,7 @@ NvPairingManager::signMessage(const QByteArray& message)
|
|||||||
EVP_MD_CTX *ctx = EVP_MD_CTX_create();
|
EVP_MD_CTX *ctx = EVP_MD_CTX_create();
|
||||||
THROW_BAD_ALLOC_IF_NULL(ctx);
|
THROW_BAD_ALLOC_IF_NULL(ctx);
|
||||||
|
|
||||||
const EVP_MD *md = EVP_get_digestbyname("SHA256");
|
EVP_DigestSignInit(ctx, NULL, EVP_sha256(), NULL, m_PrivateKey);
|
||||||
THROW_BAD_ALLOC_IF_NULL(md);
|
|
||||||
|
|
||||||
EVP_DigestInit_ex(ctx, md, NULL);
|
|
||||||
EVP_DigestSignInit(ctx, NULL, md, NULL, m_PrivateKey);
|
|
||||||
EVP_DigestSignUpdate(ctx, reinterpret_cast<unsigned char*>(const_cast<char*>(message.data())), message.length());
|
EVP_DigestSignUpdate(ctx, reinterpret_cast<unsigned char*>(const_cast<char*>(message.data())), message.length());
|
||||||
|
|
||||||
size_t signatureLength = 0;
|
size_t signatureLength = 0;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public:
|
|||||||
ALREADY_IN_PROGRESS
|
ALREADY_IN_PROGRESS
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit NvPairingManager(QString address);
|
explicit NvPairingManager(NvComputer* computer);
|
||||||
|
|
||||||
~NvPairingManager();
|
~NvPairingManager();
|
||||||
|
|
||||||
|
|||||||
@@ -71,16 +71,9 @@ SystemProperties::SystemProperties()
|
|||||||
querySdlVideoInfo();
|
querySdlVideoInfo();
|
||||||
|
|
||||||
Q_ASSERT(maximumStreamingFrameRate >= 60);
|
Q_ASSERT(maximumStreamingFrameRate >= 60);
|
||||||
Q_ASSERT(!monitorDesktopResolutions.isEmpty());
|
|
||||||
Q_ASSERT(!monitorNativeResolutions.isEmpty());
|
Q_ASSERT(!monitorNativeResolutions.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect SystemProperties::getDesktopResolution(int displayIndex)
|
|
||||||
{
|
|
||||||
// Returns default constructed QRect if out of bounds
|
|
||||||
return monitorDesktopResolutions.value(displayIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
QRect SystemProperties::getNativeResolution(int displayIndex)
|
QRect SystemProperties::getNativeResolution(int displayIndex)
|
||||||
{
|
{
|
||||||
// Returns default constructed QRect if out of bounds
|
// Returns default constructed QRect if out of bounds
|
||||||
@@ -148,7 +141,7 @@ void SystemProperties::querySdlVideoInfoInternal()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Session::getDecoderInfo(testWindow, hasHardwareAcceleration, rendererAlwaysFullScreen, maximumResolution);
|
Session::getDecoderInfo(testWindow, hasHardwareAcceleration, rendererAlwaysFullScreen, supportsHdr, maximumResolution);
|
||||||
|
|
||||||
SDL_DestroyWindow(testWindow);
|
SDL_DestroyWindow(testWindow);
|
||||||
|
|
||||||
@@ -193,7 +186,6 @@ void SystemProperties::refreshDisplaysInternal()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
monitorDesktopResolutions.clear();
|
|
||||||
monitorNativeResolutions.clear();
|
monitorNativeResolutions.clear();
|
||||||
|
|
||||||
// Never let the maximum drop below 60 FPS
|
// Never let the maximum drop below 60 FPS
|
||||||
@@ -202,26 +194,8 @@ void SystemProperties::refreshDisplaysInternal()
|
|||||||
SDL_DisplayMode bestMode;
|
SDL_DisplayMode bestMode;
|
||||||
for (int displayIndex = 0; displayIndex < SDL_GetNumVideoDisplays(); displayIndex++) {
|
for (int displayIndex = 0; displayIndex < SDL_GetNumVideoDisplays(); displayIndex++) {
|
||||||
SDL_DisplayMode desktopMode;
|
SDL_DisplayMode desktopMode;
|
||||||
int err;
|
|
||||||
|
|
||||||
err = SDL_GetDesktopDisplayMode(displayIndex, &desktopMode);
|
if (StreamUtils::getNativeDesktopMode(displayIndex, &desktopMode)) {
|
||||||
if (err == 0) {
|
|
||||||
if (desktopMode.w <= 8192 && desktopMode.h <= 8192) {
|
|
||||||
monitorDesktopResolutions.insert(displayIndex, QRect(0, 0, desktopMode.w, desktopMode.h));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"Skipping resolution over 8K: %dx%d",
|
|
||||||
desktopMode.w, desktopMode.h);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"SDL_GetDesktopDisplayMode() failed: %s",
|
|
||||||
SDL_GetError());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StreamUtils::getRealDesktopMode(displayIndex, &desktopMode)) {
|
|
||||||
if (desktopMode.w <= 8192 && desktopMode.h <= 8192) {
|
if (desktopMode.w <= 8192 && desktopMode.h <= 8192) {
|
||||||
monitorNativeResolutions.insert(displayIndex, QRect(0, 0, desktopMode.w, desktopMode.h));
|
monitorNativeResolutions.insert(displayIndex, QRect(0, 0, desktopMode.w, desktopMode.h));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ public:
|
|||||||
Q_PROPERTY(int maximumStreamingFrameRate MEMBER maximumStreamingFrameRate CONSTANT)
|
Q_PROPERTY(int maximumStreamingFrameRate MEMBER maximumStreamingFrameRate CONSTANT)
|
||||||
Q_PROPERTY(QSize maximumResolution MEMBER maximumResolution CONSTANT)
|
Q_PROPERTY(QSize maximumResolution MEMBER maximumResolution CONSTANT)
|
||||||
Q_PROPERTY(QString versionString MEMBER versionString CONSTANT)
|
Q_PROPERTY(QString versionString MEMBER versionString CONSTANT)
|
||||||
|
Q_PROPERTY(bool supportsHdr MEMBER supportsHdr CONSTANT)
|
||||||
|
|
||||||
Q_INVOKABLE void refreshDisplays();
|
Q_INVOKABLE void refreshDisplays();
|
||||||
Q_INVOKABLE QRect getDesktopResolution(int displayIndex);
|
|
||||||
Q_INVOKABLE QRect getNativeResolution(int displayIndex);
|
Q_INVOKABLE QRect getNativeResolution(int displayIndex);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@@ -51,8 +51,8 @@ private:
|
|||||||
QString unmappedGamepads;
|
QString unmappedGamepads;
|
||||||
int maximumStreamingFrameRate;
|
int maximumStreamingFrameRate;
|
||||||
QSize maximumResolution;
|
QSize maximumResolution;
|
||||||
QList<QRect> monitorDesktopResolutions;
|
|
||||||
QList<QRect> monitorNativeResolutions;
|
QList<QRect> monitorNativeResolutions;
|
||||||
QString versionString;
|
QString versionString;
|
||||||
|
bool supportsHdr;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -164,8 +164,10 @@ GlobalCommandLineParser::ParseResult GlobalCommandLineParser::parse(const QStrin
|
|||||||
"Starts Moonlight normally if no arguments are given.\n"
|
"Starts Moonlight normally if no arguments are given.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Available actions:\n"
|
"Available actions:\n"
|
||||||
|
" list List the available apps on a host\n"
|
||||||
" quit Quit the currently running app\n"
|
" quit Quit the currently running app\n"
|
||||||
" stream Start streaming an app\n"
|
" stream Start streaming an app\n"
|
||||||
|
" pair Pair a new host\n"
|
||||||
"\n"
|
"\n"
|
||||||
"See 'moonlight <action> --help' for help of specific action."
|
"See 'moonlight <action> --help' for help of specific action."
|
||||||
);
|
);
|
||||||
@@ -193,6 +195,10 @@ GlobalCommandLineParser::ParseResult GlobalCommandLineParser::parse(const QStrin
|
|||||||
return QuitRequested;
|
return QuitRequested;
|
||||||
} else if (action == "stream") {
|
} else if (action == "stream") {
|
||||||
return StreamRequested;
|
return StreamRequested;
|
||||||
|
} else if (action == "pair") {
|
||||||
|
return PairRequested;
|
||||||
|
} else if (action == "list") {
|
||||||
|
return ListRequested;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,6 +248,58 @@ QString QuitCommandLineParser::getHost() const
|
|||||||
return m_Host;
|
return m_Host;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PairCommandLineParser::PairCommandLineParser()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
PairCommandLineParser::~PairCommandLineParser()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void PairCommandLineParser::parse(const QStringList &args)
|
||||||
|
{
|
||||||
|
CommandLineParser parser;
|
||||||
|
parser.setupCommonOptions();
|
||||||
|
parser.setApplicationDescription(
|
||||||
|
"\n"
|
||||||
|
"Pair with the specified host."
|
||||||
|
);
|
||||||
|
parser.addPositionalArgument("pair", "pair host");
|
||||||
|
parser.addPositionalArgument("host", "Host computer name, UUID, or IP address", "<host>");
|
||||||
|
parser.addValueOption("pin", "4 digit pairing PIN");
|
||||||
|
|
||||||
|
if (!parser.parse(args)) {
|
||||||
|
parser.showError(parser.errorText());
|
||||||
|
}
|
||||||
|
|
||||||
|
parser.handleUnknownOptions();
|
||||||
|
|
||||||
|
// This method will not return and terminates the process if --version or
|
||||||
|
// --help is specified
|
||||||
|
parser.handleHelpAndVersionOptions();
|
||||||
|
|
||||||
|
// Verify that host has been provided
|
||||||
|
auto posArgs = parser.positionalArguments();
|
||||||
|
if (posArgs.length() < 2) {
|
||||||
|
parser.showError("Host not provided");
|
||||||
|
}
|
||||||
|
m_Host = parser.positionalArguments().at(1);
|
||||||
|
m_PredefinedPin = parser.value("pin");
|
||||||
|
if (!m_PredefinedPin.isEmpty() && m_PredefinedPin.length() != 4) {
|
||||||
|
parser.showError("PIN must be 4 digits");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString PairCommandLineParser::getHost() const
|
||||||
|
{
|
||||||
|
return m_Host;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString PairCommandLineParser::getPredefinedPin() const
|
||||||
|
{
|
||||||
|
return m_PredefinedPin;
|
||||||
|
}
|
||||||
|
|
||||||
StreamCommandLineParser::StreamCommandLineParser()
|
StreamCommandLineParser::StreamCommandLineParser()
|
||||||
{
|
{
|
||||||
m_WindowModeMap = {
|
m_WindowModeMap = {
|
||||||
@@ -312,6 +370,7 @@ void StreamCommandLineParser::parse(const QStringList &args, StreamingPreference
|
|||||||
parser.addToggleOption("background-gamepad", "background gamepad input");
|
parser.addToggleOption("background-gamepad", "background gamepad input");
|
||||||
parser.addToggleOption("reverse-scroll-direction", "inverted scroll direction");
|
parser.addToggleOption("reverse-scroll-direction", "inverted scroll direction");
|
||||||
parser.addToggleOption("swap-gamepad-buttons", "swap A/B and X/Y gamepad buttons (Nintendo-style)");
|
parser.addToggleOption("swap-gamepad-buttons", "swap A/B and X/Y gamepad buttons (Nintendo-style)");
|
||||||
|
parser.addToggleOption("keep-awake", "prevent display sleep while streaming");
|
||||||
parser.addChoiceOption("capture-system-keys", "capture system key combos", m_CaptureSysKeysModeMap.keys());
|
parser.addChoiceOption("capture-system-keys", "capture system key combos", m_CaptureSysKeysModeMap.keys());
|
||||||
parser.addChoiceOption("video-codec", "video codec", m_VideoCodecMap.keys());
|
parser.addChoiceOption("video-codec", "video codec", m_VideoCodecMap.keys());
|
||||||
parser.addChoiceOption("video-decoder", "video decoder", m_VideoDecoderMap.keys());
|
parser.addChoiceOption("video-decoder", "video decoder", m_VideoDecoderMap.keys());
|
||||||
@@ -350,8 +409,8 @@ void StreamCommandLineParser::parse(const QStringList &args, StreamingPreference
|
|||||||
// Resolve --fps option
|
// Resolve --fps option
|
||||||
if (parser.isSet("fps")) {
|
if (parser.isSet("fps")) {
|
||||||
preferences->fps = parser.getIntOption("fps");
|
preferences->fps = parser.getIntOption("fps");
|
||||||
if (!inRange(preferences->fps, 30, 120)) {
|
if (!inRange(preferences->fps, 30, 240)) {
|
||||||
parser.showError("FPS must be in range: 30 - 120");
|
parser.showError("FPS must be in range: 30 - 240");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -423,6 +482,9 @@ void StreamCommandLineParser::parse(const QStringList &args, StreamingPreference
|
|||||||
// Resolve --swap-gamepad-buttons and --no-swap-gamepad-buttons options
|
// Resolve --swap-gamepad-buttons and --no-swap-gamepad-buttons options
|
||||||
preferences->swapFaceButtons = parser.getToggleOptionValue("swap-gamepad-buttons", preferences->swapFaceButtons);
|
preferences->swapFaceButtons = parser.getToggleOptionValue("swap-gamepad-buttons", preferences->swapFaceButtons);
|
||||||
|
|
||||||
|
// Resolve --keep-awake and --no-keep-awake options
|
||||||
|
preferences->keepAwake = parser.getToggleOptionValue("keep-awake", preferences->keepAwake);
|
||||||
|
|
||||||
// Resolve --capture-system-keys option
|
// Resolve --capture-system-keys option
|
||||||
if (parser.isSet("capture-system-keys")) {
|
if (parser.isSet("capture-system-keys")) {
|
||||||
preferences->captureSysKeysMode = mapValue(m_CaptureSysKeysModeMap, parser.getChoiceOptionValue("capture-system-keys"));
|
preferences->captureSysKeysMode = mapValue(m_CaptureSysKeysModeMap, parser.getChoiceOptionValue("capture-system-keys"));
|
||||||
@@ -464,3 +526,62 @@ QString StreamCommandLineParser::getAppName() const
|
|||||||
{
|
{
|
||||||
return m_AppName;
|
return m_AppName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ListCommandLineParser::ListCommandLineParser()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ListCommandLineParser::~ListCommandLineParser()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void ListCommandLineParser::parse(const QStringList &args)
|
||||||
|
{
|
||||||
|
CommandLineParser parser;
|
||||||
|
parser.setupCommonOptions();
|
||||||
|
parser.setApplicationDescription(
|
||||||
|
"\n"
|
||||||
|
"List the available apps on the given host."
|
||||||
|
);
|
||||||
|
parser.addPositionalArgument("list", "list available apps");
|
||||||
|
parser.addPositionalArgument("host", "Host computer name, UUID, or IP address", "<host>");
|
||||||
|
|
||||||
|
parser.addFlagOption("csv", "Print as CSV with additional information");
|
||||||
|
parser.addFlagOption("verbose", "Displays additional information");
|
||||||
|
|
||||||
|
if (!parser.parse(args)) {
|
||||||
|
parser.showError(parser.errorText());
|
||||||
|
}
|
||||||
|
|
||||||
|
parser.handleUnknownOptions();
|
||||||
|
|
||||||
|
|
||||||
|
m_PrintCSV = parser.isSet("csv");
|
||||||
|
m_Verbose = parser.isSet("verbose");
|
||||||
|
|
||||||
|
// This method will not return and terminates the process if --version or
|
||||||
|
// --help is specified
|
||||||
|
parser.handleHelpAndVersionOptions();
|
||||||
|
|
||||||
|
// Verify that host has been provided
|
||||||
|
auto posArgs = parser.positionalArguments();
|
||||||
|
if (posArgs.length() < 2) {
|
||||||
|
parser.showError("Host not provided");
|
||||||
|
}
|
||||||
|
m_Host = parser.positionalArguments().at(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ListCommandLineParser::getHost() const
|
||||||
|
{
|
||||||
|
return m_Host;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ListCommandLineParser::isPrintCSV() const
|
||||||
|
{
|
||||||
|
return m_PrintCSV;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ListCommandLineParser::isVerbose() const
|
||||||
|
{
|
||||||
|
return m_Verbose;
|
||||||
|
}
|
||||||
@@ -12,6 +12,8 @@ public:
|
|||||||
NormalStartRequested,
|
NormalStartRequested,
|
||||||
StreamRequested,
|
StreamRequested,
|
||||||
QuitRequested,
|
QuitRequested,
|
||||||
|
PairRequested,
|
||||||
|
ListRequested,
|
||||||
};
|
};
|
||||||
|
|
||||||
GlobalCommandLineParser();
|
GlobalCommandLineParser();
|
||||||
@@ -35,6 +37,22 @@ private:
|
|||||||
QString m_Host;
|
QString m_Host;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class PairCommandLineParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PairCommandLineParser();
|
||||||
|
virtual ~PairCommandLineParser();
|
||||||
|
|
||||||
|
void parse(const QStringList &args);
|
||||||
|
|
||||||
|
QString getHost() const;
|
||||||
|
QString getPredefinedPin() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_Host;
|
||||||
|
QString m_PredefinedPin;
|
||||||
|
};
|
||||||
|
|
||||||
class StreamCommandLineParser
|
class StreamCommandLineParser
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -55,3 +73,21 @@ private:
|
|||||||
QMap<QString, StreamingPreferences::VideoDecoderSelection> m_VideoDecoderMap;
|
QMap<QString, StreamingPreferences::VideoDecoderSelection> m_VideoDecoderMap;
|
||||||
QMap<QString, StreamingPreferences::CaptureSysKeysMode> m_CaptureSysKeysModeMap;
|
QMap<QString, StreamingPreferences::CaptureSysKeysMode> m_CaptureSysKeysModeMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ListCommandLineParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ListCommandLineParser();
|
||||||
|
virtual ~ListCommandLineParser();
|
||||||
|
|
||||||
|
void parse(const QStringList &args);
|
||||||
|
|
||||||
|
QString getHost() const;
|
||||||
|
bool isPrintCSV() const;
|
||||||
|
bool isVerbose() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_Host;
|
||||||
|
bool m_PrintCSV;
|
||||||
|
bool m_Verbose;
|
||||||
|
};
|
||||||
@@ -0,0 +1,208 @@
|
|||||||
|
#include "listapps.h"
|
||||||
|
|
||||||
|
#include "backend/boxartmanager.h"
|
||||||
|
#include "backend/computermanager.h"
|
||||||
|
#include "backend/computerseeker.h"
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
|
#define COMPUTER_SEEK_TIMEOUT 10000
|
||||||
|
#define APP_SEEK_TIMEOUT 10000
|
||||||
|
|
||||||
|
namespace CliListApps
|
||||||
|
{
|
||||||
|
|
||||||
|
enum State {
|
||||||
|
StateInit,
|
||||||
|
StateSeekComputer,
|
||||||
|
StateListApp,
|
||||||
|
StateSeekApp,
|
||||||
|
StateFailure,
|
||||||
|
};
|
||||||
|
|
||||||
|
class Event
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum Type {
|
||||||
|
ComputerFound,
|
||||||
|
ComputerUpdated,
|
||||||
|
ComputerSeekTimedout,
|
||||||
|
Executed,
|
||||||
|
};
|
||||||
|
|
||||||
|
Event(Type type)
|
||||||
|
: type(type), computerManager(nullptr), computer(nullptr) {}
|
||||||
|
|
||||||
|
Type type;
|
||||||
|
ComputerManager *computerManager;
|
||||||
|
NvComputer *computer;
|
||||||
|
QString errorMessage;
|
||||||
|
};
|
||||||
|
|
||||||
|
class LauncherPrivate
|
||||||
|
{
|
||||||
|
Q_DECLARE_PUBLIC(Launcher)
|
||||||
|
|
||||||
|
public:
|
||||||
|
LauncherPrivate(Launcher *q) : q_ptr(q) {}
|
||||||
|
|
||||||
|
void handleEvent(Event event)
|
||||||
|
{
|
||||||
|
Q_Q(Launcher);
|
||||||
|
NvApp app;
|
||||||
|
|
||||||
|
switch (event.type) {
|
||||||
|
// Occurs when CLI main calls execute
|
||||||
|
case Event::Executed:
|
||||||
|
if (m_State == StateInit) {
|
||||||
|
m_State = StateSeekComputer;
|
||||||
|
m_ComputerManager = event.computerManager;
|
||||||
|
|
||||||
|
m_ComputerSeeker = new ComputerSeeker(m_ComputerManager, m_ComputerName, q);
|
||||||
|
q->connect(m_ComputerSeeker, &ComputerSeeker::computerFound,
|
||||||
|
q, &Launcher::onComputerFound);
|
||||||
|
q->connect(m_ComputerSeeker, &ComputerSeeker::errorTimeout,
|
||||||
|
q, &Launcher::onComputerSeekTimeout);
|
||||||
|
m_ComputerSeeker->start(COMPUTER_SEEK_TIMEOUT);
|
||||||
|
|
||||||
|
q->connect(m_ComputerManager, &ComputerManager::computerStateChanged,
|
||||||
|
q, &Launcher::onComputerUpdated);
|
||||||
|
|
||||||
|
m_BoxArtManager = new BoxArtManager(q);
|
||||||
|
|
||||||
|
if (m_Arguments.isVerbose()) {
|
||||||
|
fprintf(stdout, "Establishing connection to PC...\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
// Occurs when computer search timed out
|
||||||
|
case Event::ComputerSeekTimedout:
|
||||||
|
if (m_State == StateSeekComputer) {
|
||||||
|
fprintf(stderr, "%s\n", qPrintable(QString("Failed to connect to %1").arg(m_ComputerName)));
|
||||||
|
|
||||||
|
QCoreApplication::exit(-1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
// Occurs when searched computer is found
|
||||||
|
case Event::ComputerFound:
|
||||||
|
if (m_State == StateSeekComputer) {
|
||||||
|
if (event.computer->pairState == NvComputer::PS_PAIRED) {
|
||||||
|
m_State = StateSeekApp;
|
||||||
|
m_Computer = event.computer;
|
||||||
|
m_TimeoutTimer->start(APP_SEEK_TIMEOUT);
|
||||||
|
if (m_Arguments.isVerbose()) {
|
||||||
|
fprintf(stdout, "Loading app list...\n");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
m_State = StateFailure;
|
||||||
|
fprintf(stderr, "%s\n", qPrintable(QObject::tr("Computer %1 has not been paired. "
|
||||||
|
"Please open Moonlight to pair before retrieving games list.")
|
||||||
|
.arg(event.computer->name)));
|
||||||
|
|
||||||
|
QCoreApplication::exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
// Occurs when a computer is updated
|
||||||
|
case Event::ComputerUpdated:
|
||||||
|
if (m_State == StateSeekApp) {
|
||||||
|
m_Arguments.isPrintCSV() ? printAppsCSV(m_Computer->appList) : printApps(m_Computer->appList);
|
||||||
|
|
||||||
|
QCoreApplication::exit(0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void printApps(QVector<NvApp> apps) {
|
||||||
|
for (int i = 0; i < apps.length(); i++) {
|
||||||
|
fprintf(stdout, "%s\n", qPrintable(apps[i].name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void printAppsCSV(QVector<NvApp> apps) {
|
||||||
|
fprintf(stdout, "Name, ID, HDR Support, App Collection Game, Hidden, Direct Launch, Boxart URL\n");
|
||||||
|
for (int i = 0; i < apps.length(); i++) {
|
||||||
|
printAppCSV(apps[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void printAppCSV(NvApp app) const
|
||||||
|
{
|
||||||
|
fprintf(stdout, "\"%s\",%d,%s,%s,%s,%s,\"%s\"\n", qPrintable(app.name),
|
||||||
|
app.id,
|
||||||
|
app.hdrSupported ? "true" : "false",
|
||||||
|
app.isAppCollectorGame ? "true" : "false",
|
||||||
|
app.hidden ? "true" : "false",
|
||||||
|
app.directLaunch ? "true" : "false",
|
||||||
|
qPrintable(m_BoxArtManager->loadBoxArt(m_Computer, app).toDisplayString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
Launcher *q_ptr;
|
||||||
|
ComputerManager *m_ComputerManager;
|
||||||
|
QString m_ComputerName;
|
||||||
|
ComputerSeeker *m_ComputerSeeker;
|
||||||
|
BoxArtManager *m_BoxArtManager;
|
||||||
|
NvComputer *m_Computer;
|
||||||
|
State m_State;
|
||||||
|
QTimer *m_TimeoutTimer;
|
||||||
|
ListCommandLineParser m_Arguments;
|
||||||
|
};
|
||||||
|
|
||||||
|
Launcher::Launcher(QString computer, ListCommandLineParser arguments, QObject *parent)
|
||||||
|
: QObject(parent),
|
||||||
|
m_DPtr(new LauncherPrivate(this))
|
||||||
|
{
|
||||||
|
Q_D(Launcher);
|
||||||
|
d->m_ComputerName = computer;
|
||||||
|
d->m_State = StateInit;
|
||||||
|
d->m_TimeoutTimer = new QTimer(this);
|
||||||
|
d->m_TimeoutTimer->setSingleShot(true);
|
||||||
|
d->m_Arguments = arguments;
|
||||||
|
connect(d->m_TimeoutTimer, &QTimer::timeout,
|
||||||
|
this, &Launcher::onComputerSeekTimeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
Launcher::~Launcher()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Launcher::execute(ComputerManager *manager)
|
||||||
|
{
|
||||||
|
Q_D(Launcher);
|
||||||
|
Event event(Event::Executed);
|
||||||
|
event.computerManager = manager;
|
||||||
|
d->handleEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Launcher::isExecuted() const
|
||||||
|
{
|
||||||
|
Q_D(const Launcher);
|
||||||
|
return d->m_State != StateInit;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Launcher::onComputerFound(NvComputer *computer)
|
||||||
|
{
|
||||||
|
Q_D(Launcher);
|
||||||
|
Event event(Event::ComputerFound);
|
||||||
|
event.computer = computer;
|
||||||
|
d->handleEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Launcher::onComputerSeekTimeout()
|
||||||
|
{
|
||||||
|
Q_D(Launcher);
|
||||||
|
Event event(Event::ComputerSeekTimedout);
|
||||||
|
d->handleEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Launcher::onComputerUpdated(NvComputer *computer)
|
||||||
|
{
|
||||||
|
Q_D(Launcher);
|
||||||
|
Event event(Event::ComputerUpdated);
|
||||||
|
event.computer = computer;
|
||||||
|
d->handleEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "commandlineparser.h"
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
|
class ComputerManager;
|
||||||
|
class NvComputer;
|
||||||
|
|
||||||
|
namespace CliListApps
|
||||||
|
{
|
||||||
|
|
||||||
|
class LauncherPrivate;
|
||||||
|
|
||||||
|
class Launcher : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_DECLARE_PRIVATE_D(m_DPtr, Launcher)
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit Launcher(QString computer, ListCommandLineParser arguments, QObject *parent = nullptr);
|
||||||
|
~Launcher();
|
||||||
|
|
||||||
|
Q_INVOKABLE void execute(ComputerManager *manager);
|
||||||
|
Q_INVOKABLE bool isExecuted() const;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onComputerFound(NvComputer *computer);
|
||||||
|
void onComputerUpdated(NvComputer *computer);
|
||||||
|
void onComputerSeekTimeout();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QScopedPointer<LauncherPrivate> m_DPtr;
|
||||||
|
ListCommandLineParser m_Arguments;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,181 @@
|
|||||||
|
#include "pair.h"
|
||||||
|
|
||||||
|
#include "backend/computermanager.h"
|
||||||
|
#include "backend/computerseeker.h"
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
|
#define COMPUTER_SEEK_TIMEOUT 10000
|
||||||
|
|
||||||
|
namespace CliPair
|
||||||
|
{
|
||||||
|
|
||||||
|
enum State {
|
||||||
|
StateInit,
|
||||||
|
StateSeekComputer,
|
||||||
|
StatePairing,
|
||||||
|
StateFailure,
|
||||||
|
StateComplete,
|
||||||
|
};
|
||||||
|
|
||||||
|
class Event
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum Type {
|
||||||
|
ComputerFound,
|
||||||
|
Executed,
|
||||||
|
PairingCompleted,
|
||||||
|
Timedout,
|
||||||
|
};
|
||||||
|
|
||||||
|
Event(Type type)
|
||||||
|
: type(type), computerManager(nullptr), computer(nullptr) {}
|
||||||
|
|
||||||
|
Type type;
|
||||||
|
ComputerManager *computerManager;
|
||||||
|
NvComputer *computer;
|
||||||
|
QString errorMessage;
|
||||||
|
};
|
||||||
|
|
||||||
|
class LauncherPrivate
|
||||||
|
{
|
||||||
|
Q_DECLARE_PUBLIC(Launcher)
|
||||||
|
|
||||||
|
public:
|
||||||
|
LauncherPrivate(Launcher *q) : q_ptr(q) {}
|
||||||
|
|
||||||
|
void handleEvent(Event event)
|
||||||
|
{
|
||||||
|
Q_Q(Launcher);
|
||||||
|
|
||||||
|
switch (event.type) {
|
||||||
|
// Occurs when CliPair becomes visible and the UI calls launcher's execute()
|
||||||
|
case Event::Executed:
|
||||||
|
if (m_State == StateInit) {
|
||||||
|
m_State = StateSeekComputer;
|
||||||
|
m_ComputerManager = event.computerManager;
|
||||||
|
q->connect(m_ComputerManager, &ComputerManager::pairingCompleted,
|
||||||
|
q, &Launcher::onPairingCompleted);
|
||||||
|
|
||||||
|
// If we weren't provided a predefined PIN, generate one now
|
||||||
|
if (m_PredefinedPin.isEmpty()) {
|
||||||
|
m_PredefinedPin = m_ComputerManager->generatePinString();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_ComputerSeeker = new ComputerSeeker(m_ComputerManager, m_ComputerName, q);
|
||||||
|
q->connect(m_ComputerSeeker, &ComputerSeeker::computerFound,
|
||||||
|
q, &Launcher::onComputerFound);
|
||||||
|
q->connect(m_ComputerSeeker, &ComputerSeeker::errorTimeout,
|
||||||
|
q, &Launcher::onTimeout);
|
||||||
|
m_ComputerSeeker->start(COMPUTER_SEEK_TIMEOUT);
|
||||||
|
|
||||||
|
emit q->searchingComputer();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
// Occurs when searched computer is found
|
||||||
|
case Event::ComputerFound:
|
||||||
|
if (m_State == StateSeekComputer) {
|
||||||
|
if (event.computer->pairState == NvComputer::PS_PAIRED) {
|
||||||
|
m_State = StateFailure;
|
||||||
|
QString msg = QObject::tr("%1 is already paired").arg(event.computer->name);
|
||||||
|
emit q->failed(msg);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Q_ASSERT(!m_PredefinedPin.isEmpty());
|
||||||
|
|
||||||
|
m_State = StatePairing;
|
||||||
|
m_ComputerManager->pairHost(event.computer, m_PredefinedPin);
|
||||||
|
emit q->pairing(event.computer->name, m_PredefinedPin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
// Occurs when pairing operation completes
|
||||||
|
case Event::PairingCompleted:
|
||||||
|
if (m_State == StatePairing) {
|
||||||
|
if (event.errorMessage.isEmpty()) {
|
||||||
|
m_State = StateComplete;
|
||||||
|
emit q->success();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_State = StateFailure;
|
||||||
|
emit q->failed(event.errorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
// Occurs when computer search timed out
|
||||||
|
case Event::Timedout:
|
||||||
|
if (m_State == StateSeekComputer) {
|
||||||
|
m_State = StateFailure;
|
||||||
|
emit q->failed(QObject::tr("Failed to connect to %1").arg(m_ComputerName));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Launcher *q_ptr;
|
||||||
|
QString m_ComputerName;
|
||||||
|
QString m_PredefinedPin;
|
||||||
|
ComputerManager *m_ComputerManager;
|
||||||
|
ComputerSeeker *m_ComputerSeeker;
|
||||||
|
NvComputer *m_Computer;
|
||||||
|
State m_State;
|
||||||
|
QTimer *m_TimeoutTimer;
|
||||||
|
};
|
||||||
|
|
||||||
|
Launcher::Launcher(QString computer, QString predefinedPin, QObject *parent)
|
||||||
|
: QObject(parent),
|
||||||
|
m_DPtr(new LauncherPrivate(this))
|
||||||
|
{
|
||||||
|
Q_D(Launcher);
|
||||||
|
d->m_ComputerName = computer;
|
||||||
|
d->m_PredefinedPin = predefinedPin;
|
||||||
|
d->m_State = StateInit;
|
||||||
|
d->m_TimeoutTimer = new QTimer(this);
|
||||||
|
d->m_TimeoutTimer->setSingleShot(true);
|
||||||
|
connect(d->m_TimeoutTimer, &QTimer::timeout,
|
||||||
|
this, &Launcher::onTimeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
Launcher::~Launcher()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Launcher::execute(ComputerManager *manager)
|
||||||
|
{
|
||||||
|
Q_D(Launcher);
|
||||||
|
Event event(Event::Executed);
|
||||||
|
event.computerManager = manager;
|
||||||
|
d->handleEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Launcher::isExecuted() const
|
||||||
|
{
|
||||||
|
Q_D(const Launcher);
|
||||||
|
return d->m_State != StateInit;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Launcher::onComputerFound(NvComputer *computer)
|
||||||
|
{
|
||||||
|
Q_D(Launcher);
|
||||||
|
Event event(Event::ComputerFound);
|
||||||
|
event.computer = computer;
|
||||||
|
d->handleEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Launcher::onTimeout()
|
||||||
|
{
|
||||||
|
Q_D(Launcher);
|
||||||
|
Event event(Event::Timedout);
|
||||||
|
d->handleEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Launcher::onPairingCompleted(NvComputer* computer, QString error)
|
||||||
|
{
|
||||||
|
Q_D(Launcher);
|
||||||
|
Event event(Event::PairingCompleted);
|
||||||
|
event.computer = computer;
|
||||||
|
event.errorMessage = error;
|
||||||
|
d->handleEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
|
class ComputerManager;
|
||||||
|
class NvComputer;
|
||||||
|
class Session;
|
||||||
|
class StreamingPreferences;
|
||||||
|
|
||||||
|
namespace CliPair
|
||||||
|
{
|
||||||
|
|
||||||
|
class Event;
|
||||||
|
class LauncherPrivate;
|
||||||
|
|
||||||
|
class Launcher : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_DECLARE_PRIVATE_D(m_DPtr, Launcher)
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit Launcher(QString computer, QString predefinedPin,
|
||||||
|
QObject *parent = nullptr);
|
||||||
|
~Launcher();
|
||||||
|
Q_INVOKABLE void execute(ComputerManager *manager);
|
||||||
|
Q_INVOKABLE bool isExecuted() const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void searchingComputer();
|
||||||
|
void pairing(QString pcName, QString pin);
|
||||||
|
void failed(QString text);
|
||||||
|
void success();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onComputerFound(NvComputer *computer);
|
||||||
|
void onPairingCompleted(NvComputer *computer, QString error);
|
||||||
|
void onTimeout();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QScopedPointer<LauncherPrivate> m_DPtr;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
@@ -162,7 +162,7 @@ public:
|
|||||||
|
|
||||||
QString getCurrentAppName() const
|
QString getCurrentAppName() const
|
||||||
{
|
{
|
||||||
for (NvApp app : m_Computer->appList) {
|
for (const NvApp& app : m_Computer->appList) {
|
||||||
if (m_Computer->currentGameId == app.id) {
|
if (m_Computer->currentGameId == app.id) {
|
||||||
return app.name;
|
return app.name;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,165 @@
|
|||||||
</screenshots>
|
</screenshots>
|
||||||
|
|
||||||
<releases>
|
<releases>
|
||||||
|
<release version="4.3.0" date="2022-10-28">
|
||||||
|
<description>
|
||||||
|
<p>New features:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Improved support for GeForce Experience 3.26</li>
|
||||||
|
<li>Improved image quality and performance when recovering from video packet loss using HEVC</li>
|
||||||
|
<li>Improved error concealment after audio packet loss</li>
|
||||||
|
<li>Improved UI performance when paired with many hosts or hosts with large numbers of apps</li>
|
||||||
|
<li>Pairing with Sunshine hosts is now supported even if the host is in a streaming session</li>
|
||||||
|
</ul>
|
||||||
|
<p>Bugfixes:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Fixed streaming at resolutions below 720x480 with GeForce Experience 3.26</li>
|
||||||
|
<li>Fixed window position and size being lost when toggling between full-screen and windowed mode</li>
|
||||||
|
<li>Fixed initial window size not always respecting the stream aspect ratio</li>
|
||||||
|
<li>Fixed unexpected error when streaming at resolutions above 4096x4096 using Sunshine</li>
|
||||||
|
<li>Updated included gamepad mappings</li>
|
||||||
|
<li>Updated community-contributed translations from Weblate</li>
|
||||||
|
</ul>
|
||||||
|
</description>
|
||||||
|
</release>
|
||||||
|
<release version="4.2.1" date="2022-09-12">
|
||||||
|
<description>
|
||||||
|
<p>Bugfixes:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Fixed streaming from hosts running Sunshine</li>
|
||||||
|
<li>Updated community-contributed translations from Weblate</li>
|
||||||
|
</ul>
|
||||||
|
</description>
|
||||||
|
</release>
|
||||||
|
<release version="4.2.0" date="2022-09-10">
|
||||||
|
<description>
|
||||||
|
<p>New features:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Added support for pairing via the terminal</li>
|
||||||
|
<li>Added support for listing installed apps on a host via the terminal</li>
|
||||||
|
<li>Improved handling of V-Sync on Wayland systems to reduce latency</li>
|
||||||
|
<li>Improved performance using the legacy non-EGL VAAPI rendering code</li>
|
||||||
|
</ul>
|
||||||
|
<p>Bugfixes:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Fixed native resolution detection on high DPI Wayland systems</li>
|
||||||
|
<li>Fixed audio crackling with SDL 2.24.0 on systems using PulseAudio</li>
|
||||||
|
<li>Updated included gamepad mappings</li>
|
||||||
|
<li>Updated community-contributed translations from Weblate</li>
|
||||||
|
</ul>
|
||||||
|
</description>
|
||||||
|
</release>
|
||||||
|
<release version="4.1.0" date="2022-05-23">
|
||||||
|
<description>
|
||||||
|
<p>New features:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Overlays are now supported on the non-EGL X11 VAAPI renderer (requires RGBA subpicture support in the VAAPI driver)</li>
|
||||||
|
<li>Cursor lock can now be disabled when in full-screen mode</li>
|
||||||
|
</ul>
|
||||||
|
<p>Behavior Changes:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Moonlight can now reduce the client display resolution in full-screen mode if the current display mode doesn't have a high enough refresh rate for the selected stream frame rate</li>
|
||||||
|
<li>When choosing a new client display resolution in full-screen mode, Moonlight will pick a display mode with the closest aspect ratio to the selected stream resolution</li>
|
||||||
|
<li>Moonlight now defaults to borderless windowed mode on Wayland systems</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<p>Bugfixes:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Fixed missing toolbar buttons in certain languages</li>
|
||||||
|
<li>Fixed some text on the settings page not updating when the language is changed</li>
|
||||||
|
<li>Fixed a frame pacing bug that could cause excessive frame drops</li>
|
||||||
|
<li>Fixed the "keep display awake" setting not being saved when Moonlight restarts</li>
|
||||||
|
<li>Fixed black screen after unmaximizing the Moonlight window on some Linux systems</li>
|
||||||
|
<li>Updated included gamepad mappings</li>
|
||||||
|
<li>Updated community-contributed translations from Weblate</li>
|
||||||
|
</ul>
|
||||||
|
</description>
|
||||||
|
</release>
|
||||||
|
<release version="4.0.0" date="2022-04-02">
|
||||||
|
<description>
|
||||||
|
<p>New features:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Added a new key combo for locking the mouse cursor to the window (Ctrl+Alt+Shift+L)</li>
|
||||||
|
<li>Added an option to avoid keeping the client display awake while streaming</li>
|
||||||
|
</ul>
|
||||||
|
<p>Behavior Changes:</p>
|
||||||
|
<ul>
|
||||||
|
<li>HDR streaming is now a separate option rather than being part of the Video Codec override dropdown</li>
|
||||||
|
<li>HDR streaming is no longer restricted to apps that are certified by NVIDIA as compatible with GameStream HDR. Some newer games may require an HDR display or EDID emulator dongle connected to your host PC for HDR options to be available.</li>
|
||||||
|
</ul>
|
||||||
|
<p>Bugfixes:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Fixed loss of all audio if the active audio device is unplugged while streaming</li>
|
||||||
|
<li>Fixed the GUI being unresponsive after manually quitting when connection to the host is lost</li>
|
||||||
|
<li>Fixed a rare crash if a controller disconnects right as rumble is starting</li>
|
||||||
|
<li>Fixed text rendering on the overlay UI when using SDL_ttf 2.0.18 on Linux</li>
|
||||||
|
<li>Updated included gamepad mappings</li>
|
||||||
|
<li>Updated community-contributed translations from Weblate</li>
|
||||||
|
</ul>
|
||||||
|
</description>
|
||||||
|
</release>
|
||||||
|
<release version="3.2.0" date="2022-01-18">
|
||||||
|
<description>
|
||||||
|
<p>New features:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Reduced CPU usage while streaming</li>
|
||||||
|
<li>Non-ASCII characters are now supported when pasting clipboard data to the host</li>
|
||||||
|
<li>Added support for zero-copy NVDEC rendering for Nvidia Wayland systems</li>
|
||||||
|
<li>Significantly improved performance with asynchronous decoders like V4L2M2M on Linux</li>
|
||||||
|
<li>Added support for color compression planes on newer Intel systems when using VAAPI decoding</li>
|
||||||
|
<li>Added support for copy-back rendering in non-default pixel formats (like the Raspberry Pi SAND format)</li>
|
||||||
|
</ul>
|
||||||
|
<p>Bugfixes:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Fixed unexpected GUI input after using the gamepad quit combo</li>
|
||||||
|
<li>Updated included gamepad mappings</li>
|
||||||
|
<li>Updated community-contributed translations from Weblate</li>
|
||||||
|
</ul>
|
||||||
|
</description>
|
||||||
|
</release>
|
||||||
|
<release version="3.1.4" date="2021-06-25">
|
||||||
|
<description>
|
||||||
|
<p>Changes:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Added network latency statistics to the performance overlay</li>
|
||||||
|
<li>Improved audio quality on unreliable connections (requires GeForce Experience 3.19 or later)</li>
|
||||||
|
<li>Reduced video frame drops on unreliable connections (requires GeForce Experience 3.22 or later)</li>
|
||||||
|
<li>Updated community-contributed translations from Weblate</li>
|
||||||
|
</ul>
|
||||||
|
</description>
|
||||||
|
</release>
|
||||||
|
<release version="3.1.3" date="2021-05-07">
|
||||||
|
<description>
|
||||||
|
<p>Changes:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Fixed an issue that could cause excessive audio latency on some connections</li>
|
||||||
|
<li>Updated community-contributed translations from Weblate</li>
|
||||||
|
</ul>
|
||||||
|
</description>
|
||||||
|
</release>
|
||||||
|
<release version="3.1.2" date="2021-05-03">
|
||||||
|
<description>
|
||||||
|
<p>Changes:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Improved connection reliability and performance with GeForce Experience 3.22</li>
|
||||||
|
<li>Added support for audio encryption with GeForce Experience 3.22</li>
|
||||||
|
<li>Added compatibility update checks for future versions of GeForce Experience</li>
|
||||||
|
<li>Fixed keyboard capture on X11</li>
|
||||||
|
<li>Updated community-contributed translations from Weblate</li>
|
||||||
|
</ul>
|
||||||
|
</description>
|
||||||
|
</release>
|
||||||
|
<release version="3.1.1" date="2021-04-09">
|
||||||
|
<description>
|
||||||
|
<p>Changes:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Added support for streaming from GeForce Experience 3.22</li>
|
||||||
|
<li>Added support for AMF-encoded HEVC streams from servers like Sunshine and OpenStream</li>
|
||||||
|
<li>Added new community-contributed translations from Weblate</li>
|
||||||
|
<li>Fixed KMSDRM rendering with buffer modifiers on embedded devices</li>
|
||||||
|
</ul>
|
||||||
|
</description>
|
||||||
|
</release>
|
||||||
<release version="3.1.0" date="2021-03-14">
|
<release version="3.1.0" date="2021-03-14">
|
||||||
<description>
|
<description>
|
||||||
<p>New features:</p>
|
<p>New features:</p>
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 13 KiB |
+8
-3
@@ -88,9 +88,14 @@ CenteredGridView {
|
|||||||
source: model.boxart
|
source: model.boxart
|
||||||
|
|
||||||
onSourceSizeChanged: {
|
onSourceSizeChanged: {
|
||||||
if ((sourceSize.width == 130 && sourceSize.height == 180) || // GFE 2.0 placeholder image
|
// Nearly all of Nvidia's official box art does not match the dimensions of placeholder
|
||||||
(sourceSize.width == 628 && sourceSize.height == 888) || // GFE 3.0 placeholder image
|
// images, however the one known exeception is Overcooked. Therefore, we only execute
|
||||||
(sourceSize.width == 200 && sourceSize.height == 266)) // Our no_app_image.png
|
// the image size checks if this is not an app collector game. We know the officially
|
||||||
|
// supported games all have box art, so this check is not required.
|
||||||
|
if (!model.isAppCollectorGame &&
|
||||||
|
((sourceSize.width == 130 && sourceSize.height == 180) || // GFE 2.0 placeholder image
|
||||||
|
(sourceSize.width == 628 && sourceSize.height == 888) || // GFE 3.0 placeholder image
|
||||||
|
(sourceSize.width == 200 && sourceSize.height == 266))) // Our no_app_image.png
|
||||||
{
|
{
|
||||||
isPlaceholder = true
|
isPlaceholder = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,91 @@
|
|||||||
|
import QtQuick 2.0
|
||||||
|
import QtQuick.Controls 2.2
|
||||||
|
|
||||||
|
import ComputerManager 1.0
|
||||||
|
import SdlGamepadKeyNavigation 1.0
|
||||||
|
|
||||||
|
Item {
|
||||||
|
function onSearchingComputer() {
|
||||||
|
stageLabel.text = qsTr("Establishing connection to PC...")
|
||||||
|
}
|
||||||
|
|
||||||
|
function onPairing(pcName, pin) {
|
||||||
|
stageLabel.text = qsTr("Pairing... Please enter '%1' on %2.").arg(pin).arg(pcName)
|
||||||
|
}
|
||||||
|
|
||||||
|
function onFailed(message) {
|
||||||
|
stageIndicator.visible = false
|
||||||
|
errorDialog.text = message
|
||||||
|
errorDialog.open()
|
||||||
|
}
|
||||||
|
|
||||||
|
function onSuccess(appName) {
|
||||||
|
stageIndicator.visible = false
|
||||||
|
pairCompleteDialog.open()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow user to back out of pairing
|
||||||
|
Keys.onEscapePressed: {
|
||||||
|
Qt.quit()
|
||||||
|
}
|
||||||
|
Keys.onBackPressed: {
|
||||||
|
Qt.quit()
|
||||||
|
}
|
||||||
|
Keys.onCancelPressed: {
|
||||||
|
Qt.quit()
|
||||||
|
}
|
||||||
|
|
||||||
|
StackView.onActivated: {
|
||||||
|
if (!launcher.isExecuted()) {
|
||||||
|
toolBar.visible = false
|
||||||
|
|
||||||
|
// Normally this is enabled by PcView, but we will won't
|
||||||
|
// load PcView when streaming from the command-line.
|
||||||
|
SdlGamepadKeyNavigation.enable()
|
||||||
|
|
||||||
|
launcher.searchingComputer.connect(onSearchingComputer)
|
||||||
|
launcher.pairing.connect(onPairing)
|
||||||
|
launcher.failed.connect(onFailed)
|
||||||
|
launcher.success.connect(onSuccess)
|
||||||
|
launcher.execute(ComputerManager)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
spacing: 5
|
||||||
|
id: stageIndicator
|
||||||
|
|
||||||
|
BusyIndicator {
|
||||||
|
id: stageSpinner
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
id: stageLabel
|
||||||
|
height: stageSpinner.height
|
||||||
|
font.pointSize: 20
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ErrorMessageDialog {
|
||||||
|
id: errorDialog
|
||||||
|
|
||||||
|
onClosed: {
|
||||||
|
Qt.quit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NavigableMessageDialog {
|
||||||
|
id: pairCompleteDialog
|
||||||
|
closePolicy: Popup.CloseOnEscape
|
||||||
|
|
||||||
|
text:qsTr("Pairing completed successfully")
|
||||||
|
standardButtons: Dialog.Ok
|
||||||
|
onClosed: {
|
||||||
|
Qt.quit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import QtQuick.Controls 2.2
|
import QtQuick.Controls 2.2
|
||||||
|
import QtQuick.Layouts 1.3
|
||||||
|
|
||||||
ToolButton {
|
ToolButton {
|
||||||
property string iconSource
|
property string iconSource
|
||||||
@@ -20,8 +21,7 @@ ToolButton {
|
|||||||
|
|
||||||
// This determines the size of the Material highlight. We increase it
|
// This determines the size of the Material highlight. We increase it
|
||||||
// from the default because we use larger than normal icons for TV readability.
|
// from the default because we use larger than normal icons for TV readability.
|
||||||
background.width: (parent.height - parent.anchors.bottomMargin - parent.anchors.topMargin) * 0.60
|
Layout.preferredHeight: parent.height
|
||||||
background.height: (parent.height - parent.anchors.bottomMargin - parent.anchors.topMargin) * 0.60
|
|
||||||
|
|
||||||
Keys.onReturnPressed: {
|
Keys.onReturnPressed: {
|
||||||
clicked()
|
clicked()
|
||||||
|
|||||||
+12
-15
@@ -220,29 +220,26 @@ CenteredGridView {
|
|||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (model.online) {
|
if (model.online) {
|
||||||
if (model.paired) {
|
if (!model.serverSupported) {
|
||||||
|
errorDialog.text = qsTr("The version of GeForce Experience on %1 is not supported by this build of Moonlight. You must update Moonlight to stream from %1.").arg(model.name)
|
||||||
|
errorDialog.helpText = ""
|
||||||
|
errorDialog.open()
|
||||||
|
}
|
||||||
|
else if (model.paired) {
|
||||||
// go to game view
|
// go to game view
|
||||||
var component = Qt.createComponent("AppView.qml")
|
var component = Qt.createComponent("AppView.qml")
|
||||||
var appView = component.createObject(stackView, {"computerIndex": index, "objectName": model.name})
|
var appView = component.createObject(stackView, {"computerIndex": index, "objectName": model.name})
|
||||||
stackView.push(appView)
|
stackView.push(appView)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!model.busy) {
|
var pin = computerModel.generatePinString()
|
||||||
var pin = computerModel.generatePinString()
|
|
||||||
|
|
||||||
// Kick off pairing in the background
|
// Kick off pairing in the background
|
||||||
computerModel.pairComputer(index, pin)
|
computerModel.pairComputer(index, pin)
|
||||||
|
|
||||||
// Display the pairing dialog
|
// Display the pairing dialog
|
||||||
pairDialog.pin = pin
|
pairDialog.pin = pin
|
||||||
pairDialog.open()
|
pairDialog.open()
|
||||||
}
|
|
||||||
else {
|
|
||||||
// cannot pair while something is streaming or attempting to pair
|
|
||||||
errorDialog.text = qsTr("You cannot pair while a previous session is still running on the host PC. Quit any running games or reboot the host PC, then try pairing again.")
|
|
||||||
errorDialog.helpText = ""
|
|
||||||
errorDialog.open()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (!model.online) {
|
} else if (!model.online) {
|
||||||
// Using open() here because it may be activated by keyboard
|
// Using open() here because it may be activated by keyboard
|
||||||
|
|||||||
+242
-80
@@ -11,6 +11,8 @@ Flickable {
|
|||||||
id: settingsPage
|
id: settingsPage
|
||||||
objectName: qsTr("Settings")
|
objectName: qsTr("Settings")
|
||||||
|
|
||||||
|
signal languageChanged()
|
||||||
|
|
||||||
boundsBehavior: Flickable.OvershootBounds
|
boundsBehavior: Flickable.OvershootBounds
|
||||||
|
|
||||||
contentWidth: settingsColumn1.width > settingsColumn2.width ? settingsColumn1.width : settingsColumn2.width
|
contentWidth: settingsColumn1.width > settingsColumn2.width ? settingsColumn1.width : settingsColumn2.width
|
||||||
@@ -95,50 +97,39 @@ Flickable {
|
|||||||
// Add native resolutions for all attached displays
|
// Add native resolutions for all attached displays
|
||||||
var done = false
|
var done = false
|
||||||
for (var displayIndex = 0; !done; displayIndex++) {
|
for (var displayIndex = 0; !done; displayIndex++) {
|
||||||
for (var displayResIndex = 0; displayResIndex < 2; displayResIndex++) {
|
var screenRect = SystemProperties.getNativeResolution(displayIndex);
|
||||||
var screenRect;
|
|
||||||
|
|
||||||
// Some platforms have different desktop resolutions
|
if (screenRect.width === 0) {
|
||||||
// and native resolutions (like macOS with Retina displays)
|
// Exceeded max count of displays
|
||||||
if (displayResIndex === 0) {
|
done = true
|
||||||
screenRect = SystemProperties.getDesktopResolution(displayIndex)
|
break
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
screenRect = SystemProperties.getNativeResolution(displayIndex)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (screenRect.width === 0) {
|
var indexToAdd = 0
|
||||||
// Exceeded max count of displays
|
for (var j = 0; j < resolutionComboBox.count; j++) {
|
||||||
done = true
|
var existing_width = parseInt(resolutionListModel.get(j).video_width);
|
||||||
|
var existing_height = parseInt(resolutionListModel.get(j).video_height);
|
||||||
|
|
||||||
|
if (screenRect.width === existing_width && screenRect.height === existing_height) {
|
||||||
|
// Duplicate entry, skip
|
||||||
|
indexToAdd = -1
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
else if (screenRect.width * screenRect.height > existing_width * existing_height) {
|
||||||
var indexToAdd = 0
|
// Candidate entrypoint after this entry
|
||||||
for (var j = 0; j < resolutionComboBox.count; j++) {
|
indexToAdd = j + 1
|
||||||
var existing_width = parseInt(resolutionListModel.get(j).video_width);
|
|
||||||
var existing_height = parseInt(resolutionListModel.get(j).video_height);
|
|
||||||
|
|
||||||
if (screenRect.width === existing_width && screenRect.height === existing_height) {
|
|
||||||
// Duplicate entry, skip
|
|
||||||
indexToAdd = -1
|
|
||||||
break
|
|
||||||
}
|
|
||||||
else if (screenRect.width * screenRect.height > existing_width * existing_height) {
|
|
||||||
// Candidate entrypoint after this entry
|
|
||||||
indexToAdd = j + 1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Insert this display's resolution if it's not a duplicate
|
// Insert this display's resolution if it's not a duplicate
|
||||||
if (indexToAdd >= 0) {
|
if (indexToAdd >= 0) {
|
||||||
resolutionListModel.insert(indexToAdd,
|
resolutionListModel.insert(indexToAdd,
|
||||||
{
|
{
|
||||||
"text": "Native ("+screenRect.width+"x"+screenRect.height+")",
|
"text": "Native ("+screenRect.width+"x"+screenRect.height+")",
|
||||||
"video_width": ""+screenRect.width,
|
"video_width": ""+screenRect.width,
|
||||||
"video_height": ""+screenRect.height,
|
"video_height": ""+screenRect.height,
|
||||||
"is_custom": false
|
"is_custom": false
|
||||||
})
|
})
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -345,7 +336,7 @@ Flickable {
|
|||||||
maximumLength: 5
|
maximumLength: 5
|
||||||
inputMethodHints: Qt.ImhDigitsOnly
|
inputMethodHints: Qt.ImhDigitsOnly
|
||||||
placeholderText: resolutionListModel.get(resolutionComboBox.currentIndex).video_width
|
placeholderText: resolutionListModel.get(resolutionComboBox.currentIndex).video_width
|
||||||
validator: IntValidator{bottom:128; top:8192}
|
validator: IntValidator{bottom:256; top:8192}
|
||||||
focus: true
|
focus: true
|
||||||
|
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
@@ -374,7 +365,7 @@ Flickable {
|
|||||||
maximumLength: 5
|
maximumLength: 5
|
||||||
inputMethodHints: Qt.ImhDigitsOnly
|
inputMethodHints: Qt.ImhDigitsOnly
|
||||||
placeholderText: resolutionListModel.get(resolutionComboBox.currentIndex).video_height
|
placeholderText: resolutionListModel.get(resolutionComboBox.currentIndex).video_height
|
||||||
validator: IntValidator{bottom:128; top:8192}
|
validator: IntValidator{bottom:256; top:8192}
|
||||||
|
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
// standardButton() was added in Qt 5.10, so we must check for it first
|
// standardButton() was added in Qt 5.10, so we must check for it first
|
||||||
@@ -465,6 +456,7 @@ Flickable {
|
|||||||
// ignore setting the index at first, and actually set it when the component is loaded
|
// ignore setting the index at first, and actually set it when the component is loaded
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
reinitialize()
|
reinitialize()
|
||||||
|
languageChanged.connect(reinitialize)
|
||||||
}
|
}
|
||||||
|
|
||||||
id: fpsComboBox
|
id: fpsComboBox
|
||||||
@@ -531,28 +523,53 @@ Flickable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AutoResizingComboBox {
|
AutoResizingComboBox {
|
||||||
// ignore setting the index at first, and actually set it when the component is loaded
|
function createModel() {
|
||||||
Component.onCompleted: {
|
var model = Qt.createQmlObject('import QtQuick 2.0; ListModel {}', parent, '')
|
||||||
|
|
||||||
|
model.append({
|
||||||
|
text: qsTr("Fullscreen"),
|
||||||
|
val: StreamingPreferences.WM_FULLSCREEN
|
||||||
|
})
|
||||||
|
|
||||||
|
model.append({
|
||||||
|
text: qsTr("Borderless windowed"),
|
||||||
|
val: StreamingPreferences.WM_FULLSCREEN_DESKTOP
|
||||||
|
})
|
||||||
|
|
||||||
|
model.append({
|
||||||
|
text: qsTr("Windowed"),
|
||||||
|
val: StreamingPreferences.WM_WINDOWED
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// Set the recommended option based on the OS
|
||||||
|
for (var i = 0; i < model.count; i++) {
|
||||||
|
var thisWm = model.get(i).val;
|
||||||
|
if (thisWm === StreamingPreferences.recommendedFullScreenMode) {
|
||||||
|
model.get(i).text += qsTr(" (Recommended)")
|
||||||
|
model.move(i, 0, 1)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return model
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// This is used on initialization and upon retranslation
|
||||||
|
function reinitialize() {
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
// Do nothing if the control won't even be visible
|
// Do nothing if the control won't even be visible
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the recommended option based on the OS
|
model = createModel()
|
||||||
for (var i = 0; i < windowModeListModel.count; i++) {
|
|
||||||
var thisWm = windowModeListModel.get(i).val;
|
|
||||||
if (thisWm === StreamingPreferences.recommendedFullScreenMode) {
|
|
||||||
windowModeListModel.get(i).text += qsTr(" (Recommended)")
|
|
||||||
windowModeListModel.move(i, 0, 1);
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
currentIndex = 0
|
currentIndex = 0
|
||||||
|
|
||||||
|
// Set the current value based on the saved preferences
|
||||||
var savedWm = StreamingPreferences.windowMode
|
var savedWm = StreamingPreferences.windowMode
|
||||||
for (var i = 0; i < windowModeListModel.count; i++) {
|
for (var i = 0; i < model.count; i++) {
|
||||||
var thisWm = windowModeListModel.get(i).val;
|
var thisWm = model.get(i).val;
|
||||||
if (savedWm === thisWm) {
|
if (savedWm === thisWm) {
|
||||||
currentIndex = i
|
currentIndex = i
|
||||||
break
|
break
|
||||||
@@ -562,28 +579,18 @@ Flickable {
|
|||||||
activated(currentIndex)
|
activated(currentIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
reinitialize()
|
||||||
|
languageChanged.connect(reinitialize)
|
||||||
|
}
|
||||||
|
|
||||||
id: windowModeComboBox
|
id: windowModeComboBox
|
||||||
visible: SystemProperties.hasDesktopEnvironment
|
visible: SystemProperties.hasDesktopEnvironment
|
||||||
enabled: !SystemProperties.rendererAlwaysFullScreen
|
enabled: !SystemProperties.rendererAlwaysFullScreen
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
textRole: "text"
|
textRole: "text"
|
||||||
model: ListModel {
|
|
||||||
id: windowModeListModel
|
|
||||||
ListElement {
|
|
||||||
text: qsTr("Fullscreen")
|
|
||||||
val: StreamingPreferences.WM_FULLSCREEN
|
|
||||||
}
|
|
||||||
ListElement {
|
|
||||||
text: qsTr("Borderless windowed")
|
|
||||||
val: StreamingPreferences.WM_FULLSCREEN_DESKTOP
|
|
||||||
}
|
|
||||||
ListElement {
|
|
||||||
text: qsTr("Windowed")
|
|
||||||
val: StreamingPreferences.WM_WINDOWED
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onActivated: {
|
onActivated: {
|
||||||
StreamingPreferences.windowMode = windowModeListModel.get(currentIndex).val
|
StreamingPreferences.windowMode = model.get(currentIndex).val
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolTip.delay: 1000
|
ToolTip.delay: 1000
|
||||||
@@ -766,7 +773,7 @@ Flickable {
|
|||||||
val: StreamingPreferences.LANG_AUTO
|
val: StreamingPreferences.LANG_AUTO
|
||||||
}
|
}
|
||||||
ListElement {
|
ListElement {
|
||||||
text: "Deutsch" //German
|
text: "Deutsch" // German
|
||||||
val: StreamingPreferences.LANG_DE
|
val: StreamingPreferences.LANG_DE
|
||||||
}
|
}
|
||||||
ListElement {
|
ListElement {
|
||||||
@@ -774,13 +781,93 @@ Flickable {
|
|||||||
val: StreamingPreferences.LANG_EN
|
val: StreamingPreferences.LANG_EN
|
||||||
}
|
}
|
||||||
ListElement {
|
ListElement {
|
||||||
text: "Français" //French
|
text: "Français" // French
|
||||||
val: StreamingPreferences.LANG_FR
|
val: StreamingPreferences.LANG_FR
|
||||||
}
|
}
|
||||||
ListElement {
|
ListElement {
|
||||||
text: "简体中文" //Simplified Chinese
|
text: "简体中文" // Simplified Chinese
|
||||||
val: StreamingPreferences.LANG_ZH_CN
|
val: StreamingPreferences.LANG_ZH_CN
|
||||||
}
|
}
|
||||||
|
ListElement {
|
||||||
|
text: "Norwegian Bokmål"
|
||||||
|
val: StreamingPreferences.LANG_NB_NO
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
text: "русский" // Russian
|
||||||
|
val: StreamingPreferences.LANG_RU
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
text: "Español" // Spanish
|
||||||
|
val: StreamingPreferences.LANG_ES
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
text: "日本語" // Japanese
|
||||||
|
val: StreamingPreferences.LANG_JA
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
text: "Tiếng Việt" // Vietnamese
|
||||||
|
val: StreamingPreferences.LANG_VI
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
text: "ภาษาไทย" // Thai
|
||||||
|
val: StreamingPreferences.LANG_TH
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
text: "한국어" // Korean
|
||||||
|
val: StreamingPreferences.LANG_KO
|
||||||
|
}
|
||||||
|
/* ListElement {
|
||||||
|
text: "Magyar" // Hungarian
|
||||||
|
val: StreamingPreferences.LANG_HU
|
||||||
|
} */
|
||||||
|
ListElement {
|
||||||
|
text: "Nederlands" // Dutch
|
||||||
|
val: StreamingPreferences.LANG_NL
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
text: "Svenska" // Swedish
|
||||||
|
val: StreamingPreferences.LANG_SV
|
||||||
|
}
|
||||||
|
/* ListElement {
|
||||||
|
text: "Türkçe" // Turkish
|
||||||
|
val: StreamingPreferences.LANG_TR
|
||||||
|
} */
|
||||||
|
/* ListElement {
|
||||||
|
text: "Українська" // Ukrainian
|
||||||
|
val: StreamingPreferences.LANG_UK
|
||||||
|
} */
|
||||||
|
ListElement {
|
||||||
|
text: "繁体字" // Traditional Chinese
|
||||||
|
val: StreamingPreferences.LANG_ZH_HANT
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
text: "Português" // Portuguese
|
||||||
|
val: StreamingPreferences.LANG_PT
|
||||||
|
}
|
||||||
|
/* ListElement {
|
||||||
|
text: "Português do Brasil" // Brazilian Portuguese
|
||||||
|
val: StreamingPreferences.LANG_PT_BR
|
||||||
|
} */
|
||||||
|
ListElement {
|
||||||
|
text: "Ελληνικά" // Greek
|
||||||
|
val: StreamingPreferences.LANG_EL
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
text: "Italiano" // Italian
|
||||||
|
val: StreamingPreferences.LANG_IT
|
||||||
|
}
|
||||||
|
/* ListElement {
|
||||||
|
text: "हिन्दी, हिंदी" // Hindi
|
||||||
|
val: StreamingPreferences.LANG_HI
|
||||||
|
} */
|
||||||
|
ListElement {
|
||||||
|
text: "Język polski" // Polish
|
||||||
|
val: StreamingPreferences.LANG_PL
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
text: "Čeština" // Czech
|
||||||
|
val: StreamingPreferences.LANG_CS
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// ::onActivated must be used, as it only listens for when the index is changed by a human
|
// ::onActivated must be used, as it only listens for when the index is changed by a human
|
||||||
onActivated : {
|
onActivated : {
|
||||||
@@ -795,6 +882,9 @@ Flickable {
|
|||||||
// Force the back operation to pop any AppView pages that exist.
|
// Force the back operation to pop any AppView pages that exist.
|
||||||
// The AppView stops working after retranslate() for some reason.
|
// The AppView stops working after retranslate() for some reason.
|
||||||
window.clearOnBack = true
|
window.clearOnBack = true
|
||||||
|
|
||||||
|
// Signal other controls to adjust their text
|
||||||
|
languageChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -881,6 +971,22 @@ Flickable {
|
|||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
ToolTip.text: qsTr("Updates your Discord status to display the name of the game you're streaming.")
|
ToolTip.text: qsTr("Updates your Discord status to display the name of the game you're streaming.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CheckBox {
|
||||||
|
id: keepAwakeCheck
|
||||||
|
width: parent.width
|
||||||
|
text: qsTr("Keep the display awake while streaming")
|
||||||
|
font.pointSize: 12
|
||||||
|
checked: StreamingPreferences.keepAwake
|
||||||
|
onCheckedChanged: {
|
||||||
|
StreamingPreferences.keepAwake = checked
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolTip.delay: 1000
|
||||||
|
ToolTip.timeout: 5000
|
||||||
|
ToolTip.visible: hovered
|
||||||
|
ToolTip.text: qsTr("Prevents the screensaver from starting or the display from going to sleep while streaming.")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1200,6 +1306,7 @@ Flickable {
|
|||||||
|
|
||||||
id: decoderComboBox
|
id: decoderComboBox
|
||||||
textRole: "text"
|
textRole: "text"
|
||||||
|
enabled: !enableHdr.checked
|
||||||
model: ListModel {
|
model: ListModel {
|
||||||
id: decoderListModel
|
id: decoderListModel
|
||||||
ListElement {
|
ListElement {
|
||||||
@@ -1216,9 +1323,26 @@ Flickable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ::onActivated must be used, as it only listens for when the index is changed by a human
|
// ::onActivated must be used, as it only listens for when the index is changed by a human
|
||||||
onActivated : {
|
onActivated: {
|
||||||
StreamingPreferences.videoDecoderSelection = decoderListModel.get(currentIndex).val
|
if (enabled) {
|
||||||
|
StreamingPreferences.videoDecoderSelection = decoderListModel.get(currentIndex).val
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This handles the state of the enableHdr checkbox changing
|
||||||
|
onEnabledChanged: {
|
||||||
|
if (enabled) {
|
||||||
|
StreamingPreferences.videoDecoderSelection = decoderListModel.get(currentIndex).val
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
StreamingPreferences.videoDecoderSelection = StreamingPreferences.VDS_AUTO
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolTip.delay: 1000
|
||||||
|
ToolTip.timeout: 5000
|
||||||
|
ToolTip.visible: hovered && !enabled
|
||||||
|
ToolTip.text: qsTr("Enabling HDR overrides manual decoder selections.")
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
@@ -1233,7 +1357,11 @@ Flickable {
|
|||||||
// ignore setting the index at first, and actually set it when the component is loaded
|
// ignore setting the index at first, and actually set it when the component is loaded
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
var saved_vcc = StreamingPreferences.videoCodecConfig
|
var saved_vcc = StreamingPreferences.videoCodecConfig
|
||||||
|
|
||||||
|
// Default to Automatic (relevant if HDR is enabled,
|
||||||
|
// where we will match none of the codecs in the list)
|
||||||
currentIndex = 0
|
currentIndex = 0
|
||||||
|
|
||||||
for(var i = 0; i < codecListModel.count; i++) {
|
for(var i = 0; i < codecListModel.count; i++) {
|
||||||
var el_vcc = codecListModel.get(i).val;
|
var el_vcc = codecListModel.get(i).val;
|
||||||
if (saved_vcc === el_vcc) {
|
if (saved_vcc === el_vcc) {
|
||||||
@@ -1241,11 +1369,13 @@ Flickable {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
activated(currentIndex)
|
activated(currentIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
id: codecComboBox
|
id: codecComboBox
|
||||||
textRole: "text"
|
textRole: "text"
|
||||||
|
enabled: !enableHdr.checked
|
||||||
model: ListModel {
|
model: ListModel {
|
||||||
id: codecListModel
|
id: codecListModel
|
||||||
ListElement {
|
ListElement {
|
||||||
@@ -1260,15 +1390,47 @@ Flickable {
|
|||||||
text: qsTr("HEVC (H.265)")
|
text: qsTr("HEVC (H.265)")
|
||||||
val: StreamingPreferences.VCC_FORCE_HEVC
|
val: StreamingPreferences.VCC_FORCE_HEVC
|
||||||
}
|
}
|
||||||
/*ListElement {
|
|
||||||
text: qsTr("HEVC HDR (Experimental)")
|
|
||||||
val: StreamingPreferences.VCC_FORCE_HEVC_HDR
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
// ::onActivated must be used, as it only listens for when the index is changed by a human
|
// ::onActivated must be used, as it only listens for when the index is changed by a human
|
||||||
onActivated : {
|
onActivated : {
|
||||||
StreamingPreferences.videoCodecConfig = codecListModel.get(currentIndex).val
|
if (enabled) {
|
||||||
|
StreamingPreferences.videoCodecConfig = codecListModel.get(currentIndex).val
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This handles the state of the enableHdr checkbox changing
|
||||||
|
onEnabledChanged: {
|
||||||
|
if (enabled) {
|
||||||
|
StreamingPreferences.videoCodecConfig = codecListModel.get(currentIndex).val
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
StreamingPreferences.videoCodecConfig = StreamingPreferences.VCC_FORCE_HEVC_HDR
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolTip.delay: 1000
|
||||||
|
ToolTip.timeout: 5000
|
||||||
|
ToolTip.visible: hovered && !enabled
|
||||||
|
ToolTip.text: qsTr("Enabling HDR overrides manual codec selections.")
|
||||||
|
}
|
||||||
|
|
||||||
|
CheckBox {
|
||||||
|
id: enableHdr
|
||||||
|
width: parent.width
|
||||||
|
text: qsTr("Enable HDR (Experimental)")
|
||||||
|
font.pointSize: 12
|
||||||
|
enabled: SystemProperties.supportsHdr
|
||||||
|
checked: enabled && StreamingPreferences.videoCodecConfig == StreamingPreferences.VCC_FORCE_HEVC_HDR
|
||||||
|
|
||||||
|
// Updating StreamingPreferences.videoCodecConfig is handled above
|
||||||
|
|
||||||
|
ToolTip.delay: 1000
|
||||||
|
ToolTip.timeout: 5000
|
||||||
|
ToolTip.visible: hovered
|
||||||
|
ToolTip.text: enabled ?
|
||||||
|
qsTr("The stream will be HDR-capable, but some games may require an HDR monitor on your host PC to enable HDR mode.")
|
||||||
|
:
|
||||||
|
qsTr("HDR streaming is not supported on this PC.")
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckBox {
|
CheckBox {
|
||||||
|
|||||||
@@ -103,7 +103,10 @@ Item {
|
|||||||
streamSegueErrorDialog.open()
|
streamSegueErrorDialog.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function sessionReadyForDeletion()
|
||||||
|
{
|
||||||
// Garbage collect the Session object since it's pretty heavyweight
|
// Garbage collect the Session object since it's pretty heavyweight
|
||||||
// and keeps other libraries (like SDL_TTF) around until it is deleted.
|
// and keeps other libraries (like SDL_TTF) around until it is deleted.
|
||||||
session = null
|
session = null
|
||||||
@@ -130,6 +133,7 @@ Item {
|
|||||||
session.displayLaunchWarning.connect(displayLaunchWarning)
|
session.displayLaunchWarning.connect(displayLaunchWarning)
|
||||||
session.quitStarting.connect(quitStarting)
|
session.quitStarting.connect(quitStarting)
|
||||||
session.sessionFinished.connect(sessionFinished)
|
session.sessionFinished.connect(sessionFinished)
|
||||||
|
session.readyForDeletion.connect(sessionReadyForDeletion)
|
||||||
|
|
||||||
// Kick off the stream
|
// Kick off the stream
|
||||||
spinnerTimer.start()
|
spinnerTimer.start()
|
||||||
|
|||||||
@@ -91,6 +91,8 @@ QVariant AppModel::data(const QModelIndex &index, int role) const
|
|||||||
return app.id;
|
return app.id;
|
||||||
case DirectLaunchRole:
|
case DirectLaunchRole:
|
||||||
return app.directLaunch;
|
return app.directLaunch;
|
||||||
|
case AppCollectorGameRole:
|
||||||
|
return app.isAppCollectorGame;
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
@@ -106,6 +108,7 @@ QHash<int, QByteArray> AppModel::roleNames() const
|
|||||||
names[HiddenRole] = "hidden";
|
names[HiddenRole] = "hidden";
|
||||||
names[AppIdRole] = "appid";
|
names[AppIdRole] = "appid";
|
||||||
names[DirectLaunchRole] = "directLaunch";
|
names[DirectLaunchRole] = "directLaunch";
|
||||||
|
names[AppCollectorGameRole] = "appCollectorGame";
|
||||||
|
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -17,7 +17,8 @@ class AppModel : public QAbstractListModel
|
|||||||
BoxArtRole,
|
BoxArtRole,
|
||||||
HiddenRole,
|
HiddenRole,
|
||||||
AppIdRole,
|
AppIdRole,
|
||||||
DirectLaunchRole
|
DirectLaunchRole,
|
||||||
|
AppCollectorGameRole,
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
#include <QThreadPool>
|
#include <QThreadPool>
|
||||||
|
|
||||||
#include <random>
|
|
||||||
|
|
||||||
ComputerModel::ComputerModel(QObject* object)
|
ComputerModel::ComputerModel(QObject* object)
|
||||||
: QAbstractListModel(object) {}
|
: QAbstractListModel(object) {}
|
||||||
|
|
||||||
@@ -42,6 +40,8 @@ QVariant ComputerModel::data(const QModelIndex& index, int role) const
|
|||||||
return !computer->macAddress.isEmpty();
|
return !computer->macAddress.isEmpty();
|
||||||
case StatusUnknownRole:
|
case StatusUnknownRole:
|
||||||
return computer->state == NvComputer::CS_UNKNOWN;
|
return computer->state == NvComputer::CS_UNKNOWN;
|
||||||
|
case ServerSupportedRole:
|
||||||
|
return computer->isSupportedServerVersion;
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
@@ -68,6 +68,7 @@ QHash<int, QByteArray> ComputerModel::roleNames() const
|
|||||||
names[BusyRole] = "busy";
|
names[BusyRole] = "busy";
|
||||||
names[WakeableRole] = "wakeable";
|
names[WakeableRole] = "wakeable";
|
||||||
names[StatusUnknownRole] = "statusUnknown";
|
names[StatusUnknownRole] = "statusUnknown";
|
||||||
|
names[ServerSupportedRole] = "serverSupported";
|
||||||
|
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
@@ -137,14 +138,9 @@ void ComputerModel::renameComputer(int computerIndex, QString name)
|
|||||||
m_ComputerManager->renameHost(m_Computers[computerIndex], name);
|
m_ComputerManager->renameHost(m_Computers[computerIndex], name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Use QRandomGenerator when we drop Qt 5.9 support
|
|
||||||
QString ComputerModel::generatePinString()
|
QString ComputerModel::generatePinString()
|
||||||
{
|
{
|
||||||
std::uniform_int_distribution<int> dist(0, 9999);
|
return m_ComputerManager->generatePinString();
|
||||||
std::random_device rd;
|
|
||||||
std::mt19937 engine(rd());
|
|
||||||
|
|
||||||
return QString::asprintf("%04u", dist(engine));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class DeferredTestConnectionTask : public QObject, public QRunnable
|
class DeferredTestConnectionTask : public QObject, public QRunnable
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ class ComputerModel : public QAbstractListModel
|
|||||||
PairedRole,
|
PairedRole,
|
||||||
BusyRole,
|
BusyRole,
|
||||||
WakeableRole,
|
WakeableRole,
|
||||||
StatusUnknownRole
|
StatusUnknownRole,
|
||||||
|
ServerSupportedRole
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
+20
-10
@@ -181,10 +181,20 @@ ApplicationWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function navigateTo(url, objectName)
|
// Workaround for lack of instanceof in Qt 5.9.
|
||||||
|
//
|
||||||
|
// Based on https://stackoverflow.com/questions/13923794/how-to-do-a-is-a-typeof-or-instanceof-in-qml
|
||||||
|
function qmltypeof(obj, className) { // QtObject, string -> bool
|
||||||
|
// className plus "(" is the class instance without modification
|
||||||
|
// className plus "_QML" is the class instance with user-defined properties
|
||||||
|
var str = obj.toString();
|
||||||
|
return str.startsWith(className + "(") || str.startsWith(className + "_QML");
|
||||||
|
}
|
||||||
|
|
||||||
|
function navigateTo(url, objectType)
|
||||||
{
|
{
|
||||||
var existingItem = stackView.find(function(item, index) {
|
var existingItem = stackView.find(function(item, index) {
|
||||||
return item.objectName === objectName
|
return qmltypeof(item, objectType)
|
||||||
})
|
})
|
||||||
|
|
||||||
if (existingItem !== null) {
|
if (existingItem !== null) {
|
||||||
@@ -215,7 +225,7 @@ ApplicationWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
spacing: 20
|
spacing: 10
|
||||||
anchors.leftMargin: 10
|
anchors.leftMargin: 10
|
||||||
anchors.rightMargin: 10
|
anchors.rightMargin: 10
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@@ -251,7 +261,7 @@ ApplicationWindow {
|
|||||||
|
|
||||||
Label {
|
Label {
|
||||||
id: versionLabel
|
id: versionLabel
|
||||||
visible: stackView.currentItem.objectName === qsTr("Settings")
|
visible: qmltypeof(stackView.currentItem, "SettingsView")
|
||||||
text: qsTr("Version %1").arg(SystemProperties.versionString)
|
text: qsTr("Version %1").arg(SystemProperties.versionString)
|
||||||
font.pointSize: 12
|
font.pointSize: 12
|
||||||
horizontalAlignment: Qt.AlignRight
|
horizontalAlignment: Qt.AlignRight
|
||||||
@@ -261,7 +271,7 @@ ApplicationWindow {
|
|||||||
NavigableToolButton {
|
NavigableToolButton {
|
||||||
id: discordButton
|
id: discordButton
|
||||||
visible: SystemProperties.hasBrowser &&
|
visible: SystemProperties.hasBrowser &&
|
||||||
stackView.currentItem.objectName === qsTr("Settings")
|
qmltypeof(stackView.currentItem, "SettingsView")
|
||||||
|
|
||||||
iconSource: "qrc:/res/Discord-Logo-White.svg"
|
iconSource: "qrc:/res/Discord-Logo-White.svg"
|
||||||
|
|
||||||
@@ -280,7 +290,7 @@ ApplicationWindow {
|
|||||||
|
|
||||||
NavigableToolButton {
|
NavigableToolButton {
|
||||||
id: addPcButton
|
id: addPcButton
|
||||||
visible: stackView.currentItem.objectName === qsTr("Computers")
|
visible: qmltypeof(stackView.currentItem, "PcView")
|
||||||
|
|
||||||
iconSource: "qrc:/res/ic_add_to_queue_white_48px.svg"
|
iconSource: "qrc:/res/ic_add_to_queue_white_48px.svg"
|
||||||
|
|
||||||
@@ -378,7 +388,7 @@ ApplicationWindow {
|
|||||||
|
|
||||||
iconSource: "qrc:/res/ic_videogame_asset_white_48px.svg"
|
iconSource: "qrc:/res/ic_videogame_asset_white_48px.svg"
|
||||||
|
|
||||||
onClicked: navigateTo("qrc:/gui/GamepadMapper.qml", qsTr("Gamepad Mapping"))
|
onClicked: navigateTo("qrc:/gui/GamepadMapper.qml", "GamepadMapper")
|
||||||
|
|
||||||
Keys.onDownPressed: {
|
Keys.onDownPressed: {
|
||||||
stackView.currentItem.forceActiveFocus(Qt.TabFocus)
|
stackView.currentItem.forceActiveFocus(Qt.TabFocus)
|
||||||
@@ -390,7 +400,7 @@ ApplicationWindow {
|
|||||||
|
|
||||||
iconSource: "qrc:/res/settings.svg"
|
iconSource: "qrc:/res/settings.svg"
|
||||||
|
|
||||||
onClicked: navigateTo("qrc:/gui/SettingsView.qml", qsTr("Settings"))
|
onClicked: navigateTo("qrc:/gui/SettingsView.qml", "SettingsView")
|
||||||
|
|
||||||
Keys.onDownPressed: {
|
Keys.onDownPressed: {
|
||||||
stackView.currentItem.forceActiveFocus(Qt.TabFocus)
|
stackView.currentItem.forceActiveFocus(Qt.TabFocus)
|
||||||
@@ -412,7 +422,7 @@ ApplicationWindow {
|
|||||||
|
|
||||||
ErrorMessageDialog {
|
ErrorMessageDialog {
|
||||||
id: noHwDecoderDialog
|
id: noHwDecoderDialog
|
||||||
text: qsTr("No functioning hardware accelerated H.264 video decoder was detected by Moonlight. " +
|
text: qsTr("No functioning hardware accelerated video decoder was detected by Moonlight. " +
|
||||||
"Your streaming performance may be severely degraded in this configuration.")
|
"Your streaming performance may be severely degraded in this configuration.")
|
||||||
helpText: qsTr("Click the Help button for more information on solving this problem.")
|
helpText: qsTr("Click the Help button for more information on solving this problem.")
|
||||||
helpUrl: "https://github.com/moonlight-stream/moonlight-docs/wiki/Fixing-Hardware-Decoding-Problems"
|
helpUrl: "https://github.com/moonlight-stream/moonlight-docs/wiki/Fixing-Hardware-Decoding-Problems"
|
||||||
@@ -493,7 +503,7 @@ ApplicationWindow {
|
|||||||
|
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
if (editText.text) {
|
if (editText.text) {
|
||||||
ComputerManager.addNewHost(editText.text.trim(), false)
|
ComputerManager.addNewHostManually(editText.text.trim())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
SdlGamepadKeyNavigation::SdlGamepadKeyNavigation()
|
SdlGamepadKeyNavigation::SdlGamepadKeyNavigation()
|
||||||
: m_Enabled(false),
|
: m_Enabled(false),
|
||||||
m_UiNavMode(false),
|
m_UiNavMode(false),
|
||||||
|
m_FirstPoll(false),
|
||||||
m_LastAxisNavigationEventTime(0)
|
m_LastAxisNavigationEventTime(0)
|
||||||
{
|
{
|
||||||
m_PollingTimer = new QTimer(this);
|
m_PollingTimer = new QTimer(this);
|
||||||
@@ -62,6 +63,9 @@ void SdlGamepadKeyNavigation::enable()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Flush events on the first poll
|
||||||
|
m_FirstPoll = true;
|
||||||
|
|
||||||
// Poll every 50 ms for a new joystick event
|
// Poll every 50 ms for a new joystick event
|
||||||
m_PollingTimer->start(50);
|
m_PollingTimer->start(50);
|
||||||
|
|
||||||
@@ -91,6 +95,16 @@ void SdlGamepadKeyNavigation::onPollingTimerFired()
|
|||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
StreamingPreferences prefs;
|
StreamingPreferences prefs;
|
||||||
|
|
||||||
|
// Discard any pending button events on the first poll to avoid picking up
|
||||||
|
// stale input data from the stream session (like the quit combo).
|
||||||
|
if (m_FirstPoll) {
|
||||||
|
SDL_PumpEvents();
|
||||||
|
SDL_FlushEvent(SDL_CONTROLLERBUTTONDOWN);
|
||||||
|
SDL_FlushEvent(SDL_CONTROLLERBUTTONUP);
|
||||||
|
|
||||||
|
m_FirstPoll = false;
|
||||||
|
}
|
||||||
|
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
|
|||||||
@@ -34,5 +34,6 @@ private:
|
|||||||
QList<SDL_GameController*> m_Gamepads;
|
QList<SDL_GameController*> m_Gamepads;
|
||||||
bool m_Enabled;
|
bool m_Enabled;
|
||||||
bool m_UiNavMode;
|
bool m_UiNavMode;
|
||||||
|
bool m_FirstPoll;
|
||||||
Uint32 m_LastAxisNavigationEventTime;
|
Uint32 m_LastAxisNavigationEventTime;
|
||||||
};
|
};
|
||||||
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
+438
-311
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
+432
-301
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
+324
-193
File diff suppressed because it is too large.
Load diff
+124
-31
@@ -22,20 +22,23 @@
|
|||||||
#include "streaming/video/ffmpeg.h"
|
#include "streaming/video/ffmpeg.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_WIN32) && defined(Q_PROCESSOR_X86)
|
#if defined(Q_OS_WIN32)
|
||||||
#include "antihookingprotection.h"
|
#include "antihookingprotection.h"
|
||||||
#elif defined(Q_OS_LINUX)
|
#elif defined(Q_OS_LINUX)
|
||||||
#include <openssl/ssl.h>
|
#include <openssl/ssl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "cli/listapps.h"
|
||||||
#include "cli/quitstream.h"
|
#include "cli/quitstream.h"
|
||||||
#include "cli/startstream.h"
|
#include "cli/startstream.h"
|
||||||
|
#include "cli/pair.h"
|
||||||
#include "cli/commandlineparser.h"
|
#include "cli/commandlineparser.h"
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "gui/computermodel.h"
|
#include "gui/computermodel.h"
|
||||||
#include "gui/appmodel.h"
|
#include "gui/appmodel.h"
|
||||||
#include "backend/autoupdatechecker.h"
|
#include "backend/autoupdatechecker.h"
|
||||||
|
#include "backend/computermanager.h"
|
||||||
#include "backend/systemproperties.h"
|
#include "backend/systemproperties.h"
|
||||||
#include "streaming/session.h"
|
#include "streaming/session.h"
|
||||||
#include "settings/streamingpreferences.h"
|
#include "settings/streamingpreferences.h"
|
||||||
@@ -60,6 +63,7 @@
|
|||||||
static QElapsedTimer s_LoggerTime;
|
static QElapsedTimer s_LoggerTime;
|
||||||
static QTextStream s_LoggerStream(stdout);
|
static QTextStream s_LoggerStream(stdout);
|
||||||
static QMutex s_LoggerLock;
|
static QMutex s_LoggerLock;
|
||||||
|
static bool s_SuppressVerboseOutput;
|
||||||
#ifdef LOG_TO_FILE
|
#ifdef LOG_TO_FILE
|
||||||
#define MAX_LOG_LINES 10000
|
#define MAX_LOG_LINES 10000
|
||||||
static int s_LogLinesWritten = 0;
|
static int s_LogLinesWritten = 0;
|
||||||
@@ -100,15 +104,27 @@ void sdlLogToDiskHandler(void*, int category, SDL_LogPriority priority, const ch
|
|||||||
|
|
||||||
switch (priority) {
|
switch (priority) {
|
||||||
case SDL_LOG_PRIORITY_VERBOSE:
|
case SDL_LOG_PRIORITY_VERBOSE:
|
||||||
|
if (s_SuppressVerboseOutput) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
priorityTxt = "Verbose";
|
priorityTxt = "Verbose";
|
||||||
break;
|
break;
|
||||||
case SDL_LOG_PRIORITY_DEBUG:
|
case SDL_LOG_PRIORITY_DEBUG:
|
||||||
|
if (s_SuppressVerboseOutput) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
priorityTxt = "Debug";
|
priorityTxt = "Debug";
|
||||||
break;
|
break;
|
||||||
case SDL_LOG_PRIORITY_INFO:
|
case SDL_LOG_PRIORITY_INFO:
|
||||||
|
if (s_SuppressVerboseOutput) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
priorityTxt = "Info";
|
priorityTxt = "Info";
|
||||||
break;
|
break;
|
||||||
case SDL_LOG_PRIORITY_WARN:
|
case SDL_LOG_PRIORITY_WARN:
|
||||||
|
if (s_SuppressVerboseOutput) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
priorityTxt = "Warn";
|
priorityTxt = "Warn";
|
||||||
break;
|
break;
|
||||||
case SDL_LOG_PRIORITY_ERROR:
|
case SDL_LOG_PRIORITY_ERROR:
|
||||||
@@ -134,12 +150,21 @@ void qtLogToDiskHandler(QtMsgType type, const QMessageLogContext&, const QString
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case QtDebugMsg:
|
case QtDebugMsg:
|
||||||
|
if (s_SuppressVerboseOutput) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
typeTxt = "Debug";
|
typeTxt = "Debug";
|
||||||
break;
|
break;
|
||||||
case QtInfoMsg:
|
case QtInfoMsg:
|
||||||
|
if (s_SuppressVerboseOutput) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
typeTxt = "Info";
|
typeTxt = "Info";
|
||||||
break;
|
break;
|
||||||
case QtWarningMsg:
|
case QtWarningMsg:
|
||||||
|
if (s_SuppressVerboseOutput) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
typeTxt = "Warning";
|
typeTxt = "Warning";
|
||||||
break;
|
break;
|
||||||
case QtCriticalMsg:
|
case QtCriticalMsg:
|
||||||
@@ -166,13 +191,26 @@ void ffmpegLogToDiskHandler(void* ptr, int level, const char* fmt, va_list vl)
|
|||||||
if ((level & 0xFF) > av_log_get_level()) {
|
if ((level & 0xFF) > av_log_get_level()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if ((level & 0xFF) > AV_LOG_WARNING && s_SuppressVerboseOutput) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We need to use the *previous* printPrefix value to determine whether to
|
||||||
|
// print the prefix this time. av_log_format_line() will set the printPrefix
|
||||||
|
// value to indicate whether the prefix should be printed *next time*.
|
||||||
|
bool shouldPrefixThisMessage = printPrefix != 0;
|
||||||
|
|
||||||
av_log_format_line(ptr, level, fmt, vl, lineBuffer, sizeof(lineBuffer), &printPrefix);
|
av_log_format_line(ptr, level, fmt, vl, lineBuffer, sizeof(lineBuffer), &printPrefix);
|
||||||
|
|
||||||
QTime logTime = QTime::fromMSecsSinceStartOfDay(s_LoggerTime.elapsed());
|
if (shouldPrefixThisMessage) {
|
||||||
QString txt = QString("%1 - FFmpeg: %2").arg(logTime.toString()).arg(lineBuffer);
|
QTime logTime = QTime::fromMSecsSinceStartOfDay(s_LoggerTime.elapsed());
|
||||||
|
QString txt = QString("%1 - FFmpeg: %2").arg(logTime.toString()).arg(lineBuffer);
|
||||||
logToLoggerStream(txt);
|
logToLoggerStream(txt);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
QString txt = QString(lineBuffer);
|
||||||
|
logToLoggerStream(txt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -250,7 +288,6 @@ int main(int argc, char *argv[])
|
|||||||
QCoreApplication::setApplicationName("Moonlight");
|
QCoreApplication::setApplicationName("Moonlight");
|
||||||
|
|
||||||
if (QFile(QDir::currentPath() + "/portable.dat").exists()) {
|
if (QFile(QDir::currentPath() + "/portable.dat").exists()) {
|
||||||
qInfo() << "Running in portable mode from:" << QDir::currentPath();
|
|
||||||
QSettings::setDefaultFormat(QSettings::IniFormat);
|
QSettings::setDefaultFormat(QSettings::IniFormat);
|
||||||
QSettings::setPath(QSettings::IniFormat, QSettings::UserScope, QDir::currentPath());
|
QSettings::setPath(QSettings::IniFormat, QSettings::UserScope, QDir::currentPath());
|
||||||
QSettings::setPath(QSettings::IniFormat, QSettings::SystemScope, QDir::currentPath());
|
QSettings::setPath(QSettings::IniFormat, QSettings::SystemScope, QDir::currentPath());
|
||||||
@@ -268,7 +305,7 @@ int main(int argc, char *argv[])
|
|||||||
QDir tempDir(Path::getLogDir());
|
QDir tempDir(Path::getLogDir());
|
||||||
s_LoggerFile = new QFile(tempDir.filePath(QString("Moonlight-%1.log").arg(QDateTime::currentSecsSinceEpoch())));
|
s_LoggerFile = new QFile(tempDir.filePath(QString("Moonlight-%1.log").arg(QDateTime::currentSecsSinceEpoch())));
|
||||||
if (s_LoggerFile->open(QIODevice::WriteOnly)) {
|
if (s_LoggerFile->open(QIODevice::WriteOnly)) {
|
||||||
qInfo() << "Redirecting log output to " << s_LoggerFile->fileName();
|
QTextStream(stderr) << "Redirecting log output to " << s_LoggerFile->fileName() << Qt::endl;
|
||||||
s_LoggerStream.setDevice(s_LoggerFile);
|
s_LoggerStream.setDevice(s_LoggerFile);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -288,10 +325,9 @@ int main(int argc, char *argv[])
|
|||||||
SetUnhandledExceptionFilter(UnhandledExceptionHandler);
|
SetUnhandledExceptionFilter(UnhandledExceptionHandler);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_WIN32) && defined(Q_PROCESSOR_X86)
|
#if defined(Q_OS_WIN32)
|
||||||
// Force AntiHooking.dll to be statically imported and loaded
|
// Force AntiHooking.dll to be statically imported and loaded
|
||||||
// by ntdll on x86/x64 platforms by calling a dummy function.
|
// by ntdll on Win32 platforms by calling a dummy function.
|
||||||
// AntiHooking.dll is not currently built for ARM64.
|
|
||||||
AntiHookingDummyImport();
|
AntiHookingDummyImport();
|
||||||
#elif defined(Q_OS_LINUX)
|
#elif defined(Q_OS_LINUX)
|
||||||
// Force libssl.so to be directly linked to our binary, so
|
// Force libssl.so to be directly linked to our binary, so
|
||||||
@@ -372,18 +408,6 @@ int main(int argc, char *argv[])
|
|||||||
// Register custom metatypes for use in signals
|
// Register custom metatypes for use in signals
|
||||||
qRegisterMetaType<NvApp>("NvApp");
|
qRegisterMetaType<NvApp>("NvApp");
|
||||||
|
|
||||||
SDL_version compileVersion;
|
|
||||||
SDL_VERSION(&compileVersion);
|
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"Compiled with SDL %d.%d.%d",
|
|
||||||
compileVersion.major, compileVersion.minor, compileVersion.patch);
|
|
||||||
|
|
||||||
SDL_version runtimeVersion;
|
|
||||||
SDL_GetVersion(&runtimeVersion);
|
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"Running with SDL %d.%d.%d",
|
|
||||||
runtimeVersion.major, runtimeVersion.minor, runtimeVersion.patch);
|
|
||||||
|
|
||||||
// Allow the display to sleep by default. We will manually use SDL_DisableScreenSaver()
|
// Allow the display to sleep by default. We will manually use SDL_DisableScreenSaver()
|
||||||
// and SDL_EnableScreenSaver() when appropriate. This hint must be set before
|
// and SDL_EnableScreenSaver() when appropriate. This hint must be set before
|
||||||
// initializing the SDL video subsystem to have any effect.
|
// initializing the SDL video subsystem to have any effect.
|
||||||
@@ -442,9 +466,15 @@ int main(int argc, char *argv[])
|
|||||||
// the mouse motion exactly how it was given to us.
|
// the mouse motion exactly how it was given to us.
|
||||||
SDL_SetHint("SDL_MOUSE_RELATIVE_SCALING", "0");
|
SDL_SetHint("SDL_MOUSE_RELATIVE_SCALING", "0");
|
||||||
|
|
||||||
// Set our app name for SDL to use with PulseAudio. This matches what we provide
|
// Set our app name for SDL to use with PulseAudio and PipeWire. This matches what we
|
||||||
// as our app name to libsoundio too.
|
// provide as our app name to libsoundio too. On SDL 2.0.18+, SDL_APP_NAME is also used
|
||||||
|
// for screensaver inhibitor reporting.
|
||||||
SDL_SetHint("SDL_AUDIO_DEVICE_APP_NAME", "Moonlight");
|
SDL_SetHint("SDL_AUDIO_DEVICE_APP_NAME", "Moonlight");
|
||||||
|
SDL_SetHint("SDL_APP_NAME", "Moonlight");
|
||||||
|
|
||||||
|
// We handle capturing the mouse ourselves when it leaves the window, so we don't need
|
||||||
|
// SDL doing it for us behind our backs.
|
||||||
|
SDL_SetHint("SDL_MOUSE_AUTO_CAPTURE", "0");
|
||||||
|
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
// Allow thread naming using exceptions on debug builds. SDL doesn't use SEH
|
// Allow thread naming using exceptions on debug builds. SDL doesn't use SEH
|
||||||
@@ -455,6 +485,47 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
QGuiApplication app(argc, argv);
|
QGuiApplication app(argc, argv);
|
||||||
|
|
||||||
|
GlobalCommandLineParser parser;
|
||||||
|
GlobalCommandLineParser::ParseResult commandLineParserResult = parser.parse(app.arguments());
|
||||||
|
switch (commandLineParserResult) {
|
||||||
|
case GlobalCommandLineParser::ListRequested:
|
||||||
|
#ifdef USE_CUSTOM_LOGGER
|
||||||
|
// Don't log to the console since it will jumble the command output
|
||||||
|
s_SuppressVerboseOutput = true;
|
||||||
|
#endif
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
|
// Attach to the console to be able to print output.
|
||||||
|
// Since we're a /SUBSYSTEM:WINDOWS app, we won't be attached by default.
|
||||||
|
if (AttachConsole(ATTACH_PARENT_PROCESS)) {
|
||||||
|
HANDLE conOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
|
if (conOut != INVALID_HANDLE_VALUE && conOut != NULL) {
|
||||||
|
freopen("CONOUT$", "w", stdout);
|
||||||
|
setvbuf(stdout, NULL, _IONBF, 0);
|
||||||
|
}
|
||||||
|
HANDLE conErr = GetStdHandle(STD_ERROR_HANDLE);
|
||||||
|
if (conErr != INVALID_HANDLE_VALUE && conErr != NULL) {
|
||||||
|
freopen("CONOUT$", "w", stderr);
|
||||||
|
setvbuf(stderr, NULL, _IONBF, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_version compileVersion;
|
||||||
|
SDL_VERSION(&compileVersion);
|
||||||
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Compiled with SDL %d.%d.%d",
|
||||||
|
compileVersion.major, compileVersion.minor, compileVersion.patch);
|
||||||
|
|
||||||
|
SDL_version runtimeVersion;
|
||||||
|
SDL_GetVersion(&runtimeVersion);
|
||||||
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Running with SDL %d.%d.%d",
|
||||||
|
runtimeVersion.major, runtimeVersion.minor, runtimeVersion.patch);
|
||||||
|
|
||||||
// Apply the initial translation based on user preference
|
// Apply the initial translation based on user preference
|
||||||
StreamingPreferences prefs;
|
StreamingPreferences prefs;
|
||||||
prefs.retranslate();
|
prefs.retranslate();
|
||||||
@@ -464,6 +535,7 @@ int main(int argc, char *argv[])
|
|||||||
if (WMUtils::isRunningWayland() && QGuiApplication::platformName() == "xcb") {
|
if (WMUtils::isRunningWayland() && QGuiApplication::platformName() == "xcb") {
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Detected XWayland. This will probably break hardware decoding! Try running with QT_QPA_PLATFORM=wayland or switch to X11.");
|
"Detected XWayland. This will probably break hardware decoding! Try running with QT_QPA_PLATFORM=wayland or switch to X11.");
|
||||||
|
qputenv("SDL_VIDEODRIVER", "x11");
|
||||||
}
|
}
|
||||||
else if (QGuiApplication::platformName().startsWith("wayland")) {
|
else if (QGuiApplication::platformName().startsWith("wayland")) {
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Detected Wayland");
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Detected Wayland");
|
||||||
@@ -567,9 +639,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
QString initialView;
|
QString initialView;
|
||||||
|
bool hasGUI = true;
|
||||||
|
|
||||||
GlobalCommandLineParser parser;
|
switch (commandLineParserResult) {
|
||||||
switch (parser.parse(app.arguments())) {
|
|
||||||
case GlobalCommandLineParser::NormalStartRequested:
|
case GlobalCommandLineParser::NormalStartRequested:
|
||||||
initialView = "qrc:/gui/PcView.qml";
|
initialView = "qrc:/gui/PcView.qml";
|
||||||
break;
|
break;
|
||||||
@@ -594,14 +666,35 @@ int main(int argc, char *argv[])
|
|||||||
engine.rootContext()->setContextProperty("launcher", launcher);
|
engine.rootContext()->setContextProperty("launcher", launcher);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case GlobalCommandLineParser::PairRequested:
|
||||||
|
{
|
||||||
|
initialView = "qrc:/gui/CliPair.qml";
|
||||||
|
PairCommandLineParser pairParser;
|
||||||
|
pairParser.parse(app.arguments());
|
||||||
|
auto launcher = new CliPair::Launcher(pairParser.getHost(), pairParser.getPredefinedPin(), &app);
|
||||||
|
engine.rootContext()->setContextProperty("launcher", launcher);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GlobalCommandLineParser::ListRequested:
|
||||||
|
{
|
||||||
|
ListCommandLineParser listParser;
|
||||||
|
listParser.parse(app.arguments());
|
||||||
|
auto launcher = new CliListApps::Launcher(listParser.getHost(), listParser, &app);
|
||||||
|
launcher->execute(new ComputerManager(&app));
|
||||||
|
hasGUI = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
engine.rootContext()->setContextProperty("initialView", initialView);
|
if (hasGUI) {
|
||||||
|
engine.rootContext()->setContextProperty("initialView", initialView);
|
||||||
|
|
||||||
|
// Load the main.qml file
|
||||||
|
engine.load(QUrl(QStringLiteral("qrc:/gui/main.qml")));
|
||||||
|
if (engine.rootObjects().isEmpty())
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// Load the main.qml file
|
|
||||||
engine.load(QUrl(QStringLiteral("qrc:/gui/main.qml")));
|
|
||||||
if (engine.rootObjects().isEmpty())
|
|
||||||
return -1;
|
|
||||||
int err = app.exec();
|
int err = app.exec();
|
||||||
|
|
||||||
// Give worker tasks time to properly exit. Fixes PendingQuitTask
|
// Give worker tasks time to properly exit. Fixes PendingQuitTask
|
||||||
|
|||||||
+35
-47
@@ -11,6 +11,10 @@
|
|||||||
|
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
|
|
||||||
|
// NOTE: This file MUST NOT include fcntl.h due to open() -> open64()
|
||||||
|
// redirection that happens when _FILE_OFFSET_BITS=64!
|
||||||
|
// See masterhook_internal.c for details.
|
||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -35,14 +39,21 @@ struct stat64 g_DrmMasterStat;
|
|||||||
// The DRM master FD created for SDL
|
// The DRM master FD created for SDL
|
||||||
int g_SdlDrmMasterFd = -1;
|
int g_SdlDrmMasterFd = -1;
|
||||||
|
|
||||||
|
int drmIsMaster(int fd)
|
||||||
|
{
|
||||||
|
// Detect master by attempting something that requires master.
|
||||||
|
// This method is available in Mesa DRM since Feb 2019.
|
||||||
|
return drmAuthMagic(fd, 0) != -EACCES;
|
||||||
|
}
|
||||||
|
|
||||||
// This hook will handle legacy DRM rendering
|
// This hook will handle legacy DRM rendering
|
||||||
int drmModeSetCrtc(int fd, uint32_t crtcId, uint32_t bufferId,
|
int drmModeSetCrtc(int fd, uint32_t crtcId, uint32_t bufferId,
|
||||||
uint32_t x, uint32_t y, uint32_t *connectors, int count,
|
uint32_t x, uint32_t y, uint32_t *connectors, int count,
|
||||||
drmModeModeInfoPtr mode)
|
drmModeModeInfoPtr mode)
|
||||||
{
|
{
|
||||||
// Grab the first DRM FD that makes it in here. This will be the Qt
|
// Grab the first DRM Master FD that makes it in here. This will be the Qt
|
||||||
// EGLFS backend's DRM FD, which we will need later.
|
// EGLFS backend's DRM FD, on which we will call drmDropMaster() later.
|
||||||
if (g_QtDrmMasterFd == -1) {
|
if (g_QtDrmMasterFd == -1 && drmIsMaster(fd)) {
|
||||||
g_QtDrmMasterFd = fd;
|
g_QtDrmMasterFd = fd;
|
||||||
fstat64(g_QtDrmMasterFd, &g_DrmMasterStat);
|
fstat64(g_QtDrmMasterFd, &g_DrmMasterStat);
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
@@ -51,16 +62,16 @@ int drmModeSetCrtc(int fd, uint32_t crtcId, uint32_t bufferId,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Call into the real thing
|
// Call into the real thing
|
||||||
return ((typeof(drmModeSetCrtc)*)dlsym(RTLD_NEXT, "drmModeSetCrtc"))(fd, crtcId, bufferId, x, y, connectors, count, mode);
|
return ((typeof(drmModeSetCrtc)*)dlsym(RTLD_NEXT, __FUNCTION__))(fd, crtcId, bufferId, x, y, connectors, count, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This hook will handle atomic DRM rendering
|
// This hook will handle atomic DRM rendering
|
||||||
int drmModeAtomicCommit(int fd, drmModeAtomicReqPtr req,
|
int drmModeAtomicCommit(int fd, drmModeAtomicReqPtr req,
|
||||||
uint32_t flags, void *user_data)
|
uint32_t flags, void *user_data)
|
||||||
{
|
{
|
||||||
// Grab the first DRM FD that makes it in here. This will be the Qt
|
// Grab the first DRM Master FD that makes it in here. This will be the Qt
|
||||||
// EGLFS backend's DRM FD, which we will need later.
|
// EGLFS backend's DRM FD, on which we will call drmDropMaster() later.
|
||||||
if (g_QtDrmMasterFd == -1) {
|
if (g_QtDrmMasterFd == -1 && drmIsMaster(fd)) {
|
||||||
g_QtDrmMasterFd = fd;
|
g_QtDrmMasterFd = fd;
|
||||||
fstat64(g_QtDrmMasterFd, &g_DrmMasterStat);
|
fstat64(g_QtDrmMasterFd, &g_DrmMasterStat);
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
@@ -69,53 +80,30 @@ int drmModeAtomicCommit(int fd, drmModeAtomicReqPtr req,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Call into the real thing
|
// Call into the real thing
|
||||||
return ((typeof(drmModeAtomicCommit)*)dlsym(RTLD_NEXT, "drmModeAtomicCommit"))(fd, req, flags, user_data);
|
return ((typeof(drmModeAtomicCommit)*)dlsym(RTLD_NEXT, __FUNCTION__))(fd, req, flags, user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This hook will handle SDL's open() on the DRM device. We just need to
|
// This hook will handle SDL's open() on the DRM device. We just need to
|
||||||
// hook this variant of open(), since that's what SDL uses. When we see
|
// hook this variant of open(), since that's what SDL uses. When we see
|
||||||
// the open a FD for the same card as the Qt DRM master FD, we'll drop
|
// the open a FD for the same card as the Qt DRM master FD, we'll drop
|
||||||
// master on the Qt FD to allow the new FD to have master.
|
// master on the Qt FD to allow the new FD to have master.
|
||||||
int open(const char *pathname, int flags)
|
int openHook(const char *funcname, const char *pathname, int flags, va_list va);
|
||||||
|
|
||||||
|
int open(const char *pathname, int flags, ...)
|
||||||
{
|
{
|
||||||
// Call the real thing to do the open operation
|
va_list va;
|
||||||
int fd = ((typeof(open)*)dlsym(RTLD_NEXT, "open"))(pathname, flags);
|
va_start(va, flags);
|
||||||
|
int fd = openHook(__FUNCTION__, pathname, flags, va);
|
||||||
// If the file was successfully opened and we have a DRM master FD,
|
va_end(va);
|
||||||
// check if the FD we just opened is a DRM device.
|
return fd;
|
||||||
if (fd >= 0 && g_QtDrmMasterFd != -1) {
|
}
|
||||||
if (strncmp(pathname, "/dev/dri/card", 13) == 0) {
|
|
||||||
// It's a DRM device, but is it _our_ DRM device?
|
|
||||||
struct stat64 fdstat;
|
|
||||||
|
|
||||||
fstat64(fd, &fdstat);
|
|
||||||
if (g_DrmMasterStat.st_dev == fdstat.st_dev &&
|
|
||||||
g_DrmMasterStat.st_ino == fdstat.st_ino) {
|
|
||||||
// It is our device. Time to do the magic!
|
|
||||||
|
|
||||||
// This code assumes SDL only ever opens a single FD
|
|
||||||
// for a given DRM device.
|
|
||||||
SDL_assert(g_SdlDrmMasterFd == -1);
|
|
||||||
|
|
||||||
// Drop master on Qt's FD so we can pick it up for SDL.
|
|
||||||
if (drmDropMaster(g_QtDrmMasterFd) < 0) {
|
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"Failed to drop master on Qt DRM FD: %d",
|
|
||||||
errno);
|
|
||||||
// Hope for the best
|
|
||||||
return fd;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We are not allowed to call drmSetMaster() without CAP_SYS_ADMIN,
|
|
||||||
// but since we just dropped the master, we can become master by
|
|
||||||
// simply creating a new FD. Let's do it.
|
|
||||||
close(fd);
|
|
||||||
fd = ((typeof(open)*)dlsym(RTLD_NEXT, "open"))(pathname, flags);
|
|
||||||
g_SdlDrmMasterFd = fd;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
int open64(const char *pathname, int flags, ...)
|
||||||
|
{
|
||||||
|
va_list va;
|
||||||
|
va_start(va, flags);
|
||||||
|
int fd = openHook(__FUNCTION__, pathname, flags, va);
|
||||||
|
va_end(va);
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +112,7 @@ int open(const char *pathname, int flags)
|
|||||||
int close(int fd)
|
int close(int fd)
|
||||||
{
|
{
|
||||||
// Call the real thing
|
// Call the real thing
|
||||||
int ret = ((typeof(close)*)dlsym(RTLD_NEXT, "close"))(fd);
|
int ret = ((typeof(close)*)dlsym(RTLD_NEXT, __FUNCTION__))(fd);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
// If we just closed the SDL DRM master FD, restore master
|
// If we just closed the SDL DRM master FD, restore master
|
||||||
// to the Qt DRM FD. This works because the Qt DRM master FD
|
// to the Qt DRM FD. This works because the Qt DRM master FD
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
// This file contains the private implementation of the open() hook
|
||||||
|
// which must be in a separate compilation unit due to fcntl.h doing
|
||||||
|
// unwanted redirection of open() to open64().
|
||||||
|
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
|
||||||
|
#include <SDL.h>
|
||||||
|
#include <dlfcn.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include <xf86drm.h>
|
||||||
|
#include <xf86drmMode.h>
|
||||||
|
|
||||||
|
// __OPEN_NEEDS_MODE is a glibc-ism, so define it ourselves for other libc
|
||||||
|
#ifndef __OPEN_NEEDS_MODE
|
||||||
|
#ifdef __O_TMPFILE
|
||||||
|
# define __OPEN_NEEDS_MODE(oflag) \
|
||||||
|
(((oflag) & O_CREAT) != 0 || ((oflag) & __O_TMPFILE) == __O_TMPFILE)
|
||||||
|
#else
|
||||||
|
# define __OPEN_NEEDS_MODE(oflag) (((oflag) & O_CREAT) != 0)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if SDL_VERSION_ATLEAST(2, 0, 15)
|
||||||
|
|
||||||
|
extern int g_QtDrmMasterFd;
|
||||||
|
extern struct stat64 g_DrmMasterStat;
|
||||||
|
extern int g_SdlDrmMasterFd;
|
||||||
|
|
||||||
|
int openHook(const char *funcname, const char *pathname, int flags, va_list va)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
mode_t mode;
|
||||||
|
|
||||||
|
// Call the real thing to do the open operation
|
||||||
|
if (__OPEN_NEEDS_MODE(flags)) {
|
||||||
|
mode = va_arg(va, mode_t);
|
||||||
|
fd = ((typeof(open)*)dlsym(RTLD_NEXT, funcname))(pathname, flags, mode);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mode = 0;
|
||||||
|
fd = ((typeof(open)*)dlsym(RTLD_NEXT, funcname))(pathname, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the file was successfully opened and we have a DRM master FD,
|
||||||
|
// check if the FD we just opened is a DRM device.
|
||||||
|
if (fd >= 0 && g_QtDrmMasterFd != -1) {
|
||||||
|
if (strncmp(pathname, "/dev/dri/card", 13) == 0) {
|
||||||
|
// It's a DRM device, but is it _our_ DRM device?
|
||||||
|
struct stat64 fdstat;
|
||||||
|
|
||||||
|
fstat64(fd, &fdstat);
|
||||||
|
if (g_DrmMasterStat.st_dev == fdstat.st_dev &&
|
||||||
|
g_DrmMasterStat.st_ino == fdstat.st_ino) {
|
||||||
|
// It is our device. Time to do the magic!
|
||||||
|
|
||||||
|
// This code assumes SDL only ever opens a single FD
|
||||||
|
// for a given DRM device.
|
||||||
|
SDL_assert(g_SdlDrmMasterFd == -1);
|
||||||
|
|
||||||
|
// Drop master on Qt's FD so we can pick it up for SDL.
|
||||||
|
if (drmDropMaster(g_QtDrmMasterFd) < 0) {
|
||||||
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Failed to drop master on Qt DRM FD: %d",
|
||||||
|
errno);
|
||||||
|
// Hope for the best
|
||||||
|
return fd;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We are not allowed to call drmSetMaster() without CAP_SYS_ADMIN,
|
||||||
|
// but since we just dropped the master, we can become master by
|
||||||
|
// simply creating a new FD. Let's do it.
|
||||||
|
close(fd);
|
||||||
|
if (__OPEN_NEEDS_MODE(flags)) {
|
||||||
|
fd = ((typeof(open)*)dlsym(RTLD_NEXT, funcname))(pathname, flags, mode);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fd = ((typeof(open)*)dlsym(RTLD_NEXT, funcname))(pathname, flags);
|
||||||
|
}
|
||||||
|
g_SdlDrmMasterFd = fd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return fd;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -18,5 +18,6 @@
|
|||||||
<file>gui/NavigableMessageDialog.qml</file>
|
<file>gui/NavigableMessageDialog.qml</file>
|
||||||
<file>gui/NavigableDialog.qml</file>
|
<file>gui/NavigableDialog.qml</file>
|
||||||
<file>gui/CenteredGridView.qml</file>
|
<file>gui/CenteredGridView.qml</file>
|
||||||
|
<file>gui/CliPair.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
[Platforms]
|
||||||
|
WindowsArguments = darkmode=1
|
||||||
+50
-2
@@ -23,13 +23,61 @@
|
|||||||
<file>languages/qml_fr.qm</file>
|
<file>languages/qml_fr.qm</file>
|
||||||
<file>languages/qml_zh_cn.ts</file>
|
<file>languages/qml_zh_cn.ts</file>
|
||||||
<file>languages/qml_zh_cn.qm</file>
|
<file>languages/qml_zh_cn.qm</file>
|
||||||
|
<file>languages/qml_nb_NO.ts</file>
|
||||||
|
<file>languages/qml_nb_NO.qm</file>
|
||||||
|
<file>languages/qml_ru.ts</file>
|
||||||
|
<file>languages/qml_ru.qm</file>
|
||||||
|
<file>languages/qml_es.ts</file>
|
||||||
|
<file>languages/qml_es.qm</file>
|
||||||
|
<file>languages/qml_ja.ts</file>
|
||||||
|
<file>languages/qml_ja.qm</file>
|
||||||
|
<file>languages/qml_vi.ts</file>
|
||||||
|
<file>languages/qml_vi.qm</file>
|
||||||
|
<file>languages/qml_th.ts</file>
|
||||||
|
<file>languages/qml_th.qm</file>
|
||||||
|
<file>languages/qml_ko.ts</file>
|
||||||
|
<file>languages/qml_ko.qm</file>
|
||||||
|
<file>languages/qml_hu.ts</file>
|
||||||
|
<file>languages/qml_hu.qm</file>
|
||||||
|
<file>languages/qml_nl.ts</file>
|
||||||
|
<file>languages/qml_nl.qm</file>
|
||||||
|
<file>languages/qml_sv.ts</file>
|
||||||
|
<file>languages/qml_sv.qm</file>
|
||||||
|
<file>languages/qml_tr.ts</file>
|
||||||
|
<file>languages/qml_tr.qm</file>
|
||||||
|
<file>languages/qml_uk.ts</file>
|
||||||
|
<file>languages/qml_uk.qm</file>
|
||||||
|
<file>languages/qml_zh_Hant.ts</file>
|
||||||
|
<file>languages/qml_zh_Hant.qm</file>
|
||||||
|
<file>languages/qml_el.ts</file>
|
||||||
|
<file>languages/qml_el.qm</file>
|
||||||
|
<file>languages/qml_hi.ts</file>
|
||||||
|
<file>languages/qml_hi.qm</file>
|
||||||
|
<file>languages/qml_it.ts</file>
|
||||||
|
<file>languages/qml_it.qm</file>
|
||||||
|
<file>languages/qml_pt.ts</file>
|
||||||
|
<file>languages/qml_pt.qm</file>
|
||||||
|
<file>languages/qml_pl.ts</file>
|
||||||
|
<file>languages/qml_pl.qm</file>
|
||||||
|
<file>languages/qml_cs.ts</file>
|
||||||
|
<file>languages/qml_cs.qm</file>
|
||||||
|
<!-- Don't include pt_BR until it is more complete -->
|
||||||
|
<!--file>languages/qml_pt_BR.qm</file-->
|
||||||
|
<!--file>languages/qml_pt_BR.ts</file-->
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="/data">
|
<qresource prefix="/data">
|
||||||
<file alias="gamecontrollerdb.txt">SDL_GameControllerDB/gamecontrollerdb.txt</file>
|
<file alias="gamecontrollerdb.txt">SDL_GameControllerDB/gamecontrollerdb.txt</file>
|
||||||
<file alias="ModeSeven.ttf">ModeSeven.ttf</file>
|
<file alias="ModeSeven.ttf">ModeSeven.ttf</file>
|
||||||
<file alias="egl.frag">shaders/egl.frag</file>
|
<file alias="egl_nv12.frag">shaders/egl_nv12.frag</file>
|
||||||
<file alias="egl.vert">shaders/egl.vert</file>
|
<file alias="egl_nv12.vert">shaders/egl_nv12.vert</file>
|
||||||
|
<file alias="egl_opaque.frag">shaders/egl_opaque.frag</file>
|
||||||
|
<file alias="egl_opaque.vert">shaders/egl_opaque.vert</file>
|
||||||
<file alias="egl_overlay.frag">shaders/egl_overlay.frag</file>
|
<file alias="egl_overlay.frag">shaders/egl_overlay.frag</file>
|
||||||
<file alias="egl_overlay.vert">shaders/egl_overlay.vert</file>
|
<file alias="egl_overlay.vert">shaders/egl_overlay.vert</file>
|
||||||
|
<file alias="d3d11_vertex.fxc">shaders/d3d11_vertex.fxc</file>
|
||||||
|
<file alias="d3d11_overlay_pixel.fxc">shaders/d3d11_overlay_pixel.fxc</file>
|
||||||
|
<file alias="d3d11_genyuv_pixel.fxc">shaders/d3d11_genyuv_pixel.fxc</file>
|
||||||
|
<file alias="d3d11_bt601lim_pixel.fxc">shaders/d3d11_bt601lim_pixel.fxc</file>
|
||||||
|
<file alias="d3d11_bt2020lim_pixel.fxc">shaders/d3d11_bt2020lim_pixel.fxc</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
@@ -0,0 +1,137 @@
|
|||||||
|
#include "compatfetcher.h"
|
||||||
|
#include "path.h"
|
||||||
|
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
|
#define COMPAT_VERSION "v1"
|
||||||
|
#define COMPAT_KEY "latestsupportedversion-"
|
||||||
|
|
||||||
|
CompatFetcher::CompatFetcher(QObject *parent) :
|
||||||
|
QObject(parent),
|
||||||
|
m_Nam(this)
|
||||||
|
{
|
||||||
|
// Never communicate over HTTP
|
||||||
|
m_Nam.setStrictTransportSecurityEnabled(true);
|
||||||
|
|
||||||
|
// Allow HTTP redirects
|
||||||
|
m_Nam.setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy);
|
||||||
|
|
||||||
|
connect(&m_Nam, &QNetworkAccessManager::finished,
|
||||||
|
this, &CompatFetcher::handleCompatInfoFetched);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CompatFetcher::start()
|
||||||
|
{
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) && QT_VERSION < QT_VERSION_CHECK(5, 15, 1) && !defined(QT_NO_BEARERMANAGEMENT)
|
||||||
|
// HACK: Set network accessibility to work around QTBUG-80947 (introduced in Qt 5.14.0 and fixed in Qt 5.15.1)
|
||||||
|
QT_WARNING_PUSH
|
||||||
|
QT_WARNING_DISABLE_DEPRECATED
|
||||||
|
m_Nam.setNetworkAccessible(QNetworkAccessManager::Accessible);
|
||||||
|
QT_WARNING_POP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
QUrl url("https://moonlight-stream.org/compatibility/" COMPAT_VERSION);
|
||||||
|
QNetworkRequest request(url);
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||||
|
request.setAttribute(QNetworkRequest::Http2AllowedAttribute, true);
|
||||||
|
#else
|
||||||
|
request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, true);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// We'll get a callback when this is finished
|
||||||
|
m_Nam.get(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CompatFetcher::isGfeVersionSupported(QString gfeVersion)
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
|
if (gfeVersion.trimmed().isEmpty()) {
|
||||||
|
// If we don't have a GFE version, just allow it
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString latestSupportedVersion = settings.value(COMPAT_KEY COMPAT_VERSION).toString();
|
||||||
|
if (latestSupportedVersion.isEmpty()) {
|
||||||
|
// We don't have compat data yet, so just assume it's supported
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList latestSupportedVersionQuad = latestSupportedVersion.split('.');
|
||||||
|
QStringList gfeVersionQuad = gfeVersion.split('.');
|
||||||
|
|
||||||
|
if (gfeVersionQuad.count() <= 1) {
|
||||||
|
qWarning() << "Failed to parse GFE version:" << gfeVersion;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (latestSupportedVersionQuad.count() <= 1) {
|
||||||
|
qWarning() << "Failed to parse latest supported version:" << latestSupportedVersion;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0;; i++) {
|
||||||
|
int actualVerVal = 0;
|
||||||
|
int latestSupportedVal = 0;
|
||||||
|
|
||||||
|
// Treat missing decimal places as 0
|
||||||
|
if (i < gfeVersionQuad.count()) {
|
||||||
|
bool ok;
|
||||||
|
|
||||||
|
actualVerVal = gfeVersionQuad[i].toInt(&ok);
|
||||||
|
if (!ok || actualVerVal < 0) {
|
||||||
|
// Return true to be safe
|
||||||
|
qWarning() << "Failed to parse GFE version:" << gfeVersion;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i < latestSupportedVersionQuad.count()) {
|
||||||
|
bool ok;
|
||||||
|
|
||||||
|
latestSupportedVal = latestSupportedVersionQuad[i].toInt(&ok);
|
||||||
|
if (!ok || latestSupportedVal < 0) {
|
||||||
|
// Return true to be safe
|
||||||
|
qWarning() << "Failed to parse latest supported version:" << latestSupportedVersion;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i >= gfeVersionQuad.count() && i >= latestSupportedVersionQuad.count()) {
|
||||||
|
// Equal versions - this is fine
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (actualVerVal < latestSupportedVal) {
|
||||||
|
// Actual version is lower than latest supported - this is fine
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (actualVerVal > latestSupportedVal) {
|
||||||
|
// Actual version is greater than latest supported - this is bad
|
||||||
|
qWarning() << "GFE version" << gfeVersion << "is not supported by this version of Moonlight";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CompatFetcher::handleCompatInfoFetched(QNetworkReply* reply)
|
||||||
|
{
|
||||||
|
Q_ASSERT(reply->isFinished());
|
||||||
|
|
||||||
|
if (reply->error() == QNetworkReply::NoError) {
|
||||||
|
// Queue the reply for deletion
|
||||||
|
reply->deleteLater();
|
||||||
|
|
||||||
|
QString version = QString(reply->readAll()).trimmed();
|
||||||
|
|
||||||
|
QSettings settings;
|
||||||
|
settings.setValue(COMPAT_KEY COMPAT_VERSION, version);
|
||||||
|
|
||||||
|
qInfo() << "Latest supported GFE server:" << version;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
qWarning() << "Failed to download latest compatibility data:" << reply->error();
|
||||||
|
reply->deleteLater();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
|
||||||
|
class CompatFetcher : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CompatFetcher(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
void start();
|
||||||
|
|
||||||
|
static bool isGfeVersionSupported(QString gfeVersion);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void handleCompatInfoFetched(QNetworkReply* reply);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QNetworkAccessManager m_Nam;
|
||||||
|
};
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "streamingpreferences.h"
|
#include "streamingpreferences.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
@@ -41,9 +42,10 @@
|
|||||||
#define SER_REVERSESCROLL "reversescroll"
|
#define SER_REVERSESCROLL "reversescroll"
|
||||||
#define SER_SWAPFACEBUTTONS "swapfacebuttons"
|
#define SER_SWAPFACEBUTTONS "swapfacebuttons"
|
||||||
#define SER_CAPTURESYSKEYS "capturesyskeys"
|
#define SER_CAPTURESYSKEYS "capturesyskeys"
|
||||||
|
#define SER_KEEPAWAKE "keepawake"
|
||||||
#define SER_LANGUAGE "language"
|
#define SER_LANGUAGE "language"
|
||||||
|
|
||||||
#define CURRENT_DEFAULT_VER 1
|
#define CURRENT_DEFAULT_VER 2
|
||||||
|
|
||||||
StreamingPreferences::StreamingPreferences(QObject *parent)
|
StreamingPreferences::StreamingPreferences(QObject *parent)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
@@ -68,7 +70,13 @@ void StreamingPreferences::reload()
|
|||||||
#ifdef Q_OS_DARWIN
|
#ifdef Q_OS_DARWIN
|
||||||
recommendedFullScreenMode = WindowMode::WM_FULLSCREEN_DESKTOP;
|
recommendedFullScreenMode = WindowMode::WM_FULLSCREEN_DESKTOP;
|
||||||
#else
|
#else
|
||||||
recommendedFullScreenMode = WindowMode::WM_FULLSCREEN;
|
// Wayland doesn't support modesetting, so use fullscreen desktop mode.
|
||||||
|
if (WMUtils::isRunningWayland()) {
|
||||||
|
recommendedFullScreenMode = WindowMode::WM_FULLSCREEN_DESKTOP;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
recommendedFullScreenMode = WindowMode::WM_FULLSCREEN;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
width = settings.value(SER_WIDTH, 1280).toInt();
|
width = settings.value(SER_WIDTH, 1280).toInt();
|
||||||
@@ -95,6 +103,7 @@ void StreamingPreferences::reload()
|
|||||||
backgroundGamepad = settings.value(SER_BACKGROUNDGAMEPAD, false).toBool();
|
backgroundGamepad = settings.value(SER_BACKGROUNDGAMEPAD, false).toBool();
|
||||||
reverseScrollDirection = settings.value(SER_REVERSESCROLL, false).toBool();
|
reverseScrollDirection = settings.value(SER_REVERSESCROLL, false).toBool();
|
||||||
swapFaceButtons = settings.value(SER_SWAPFACEBUTTONS, false).toBool();
|
swapFaceButtons = settings.value(SER_SWAPFACEBUTTONS, false).toBool();
|
||||||
|
keepAwake = settings.value(SER_KEEPAWAKE, true).toBool();
|
||||||
captureSysKeysMode = static_cast<CaptureSysKeysMode>(settings.value(SER_CAPTURESYSKEYS,
|
captureSysKeysMode = static_cast<CaptureSysKeysMode>(settings.value(SER_CAPTURESYSKEYS,
|
||||||
static_cast<int>(CaptureSysKeysMode::CSK_OFF)).toInt());
|
static_cast<int>(CaptureSysKeysMode::CSK_OFF)).toInt());
|
||||||
audioConfig = static_cast<AudioConfig>(settings.value(SER_AUDIOCFG,
|
audioConfig = static_cast<AudioConfig>(settings.value(SER_AUDIOCFG,
|
||||||
@@ -115,7 +124,7 @@ void StreamingPreferences::reload()
|
|||||||
|
|
||||||
|
|
||||||
// Perform default settings updates as required based on last default version
|
// Perform default settings updates as required based on last default version
|
||||||
if (defaultVer == 0) {
|
if (defaultVer < 1) {
|
||||||
#ifdef Q_OS_DARWIN
|
#ifdef Q_OS_DARWIN
|
||||||
// Update window mode setting on macOS from full-screen (old default) to borderless windowed (new default)
|
// Update window mode setting on macOS from full-screen (old default) to borderless windowed (new default)
|
||||||
if (windowMode == WindowMode::WM_FULLSCREEN) {
|
if (windowMode == WindowMode::WM_FULLSCREEN) {
|
||||||
@@ -123,6 +132,11 @@ void StreamingPreferences::reload()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
if (defaultVer < 2) {
|
||||||
|
if (windowMode == WindowMode::WM_FULLSCREEN && WMUtils::isRunningWayland()) {
|
||||||
|
windowMode = WindowMode::WM_FULLSCREEN_DESKTOP;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StreamingPreferences::retranslate()
|
bool StreamingPreferences::retranslate()
|
||||||
@@ -189,6 +203,46 @@ QString StreamingPreferences::getSuffixFromLanguage(StreamingPreferences::Langua
|
|||||||
return "fr";
|
return "fr";
|
||||||
case LANG_ZH_CN:
|
case LANG_ZH_CN:
|
||||||
return "zh_cn";
|
return "zh_cn";
|
||||||
|
case LANG_NB_NO:
|
||||||
|
return "nb_NO";
|
||||||
|
case LANG_RU:
|
||||||
|
return "ru";
|
||||||
|
case LANG_ES:
|
||||||
|
return "es";
|
||||||
|
case LANG_JA:
|
||||||
|
return "ja";
|
||||||
|
case LANG_VI:
|
||||||
|
return "vi";
|
||||||
|
case LANG_TH:
|
||||||
|
return "th";
|
||||||
|
case LANG_KO:
|
||||||
|
return "ko";
|
||||||
|
case LANG_HU:
|
||||||
|
return "hu";
|
||||||
|
case LANG_NL:
|
||||||
|
return "nl";
|
||||||
|
case LANG_SV:
|
||||||
|
return "sv";
|
||||||
|
case LANG_TR:
|
||||||
|
return "tr";
|
||||||
|
case LANG_UK:
|
||||||
|
return "uk";
|
||||||
|
case LANG_ZH_HANT:
|
||||||
|
return "zh_Hant";
|
||||||
|
case LANG_PT:
|
||||||
|
return "pt";
|
||||||
|
case LANG_PT_BR:
|
||||||
|
return "pt_BR";
|
||||||
|
case LANG_EL:
|
||||||
|
return "el";
|
||||||
|
case LANG_IT:
|
||||||
|
return "it";
|
||||||
|
case LANG_HI:
|
||||||
|
return "hi";
|
||||||
|
case LANG_PL:
|
||||||
|
return "pl";
|
||||||
|
case LANG_CS:
|
||||||
|
return "cs";
|
||||||
case LANG_AUTO:
|
case LANG_AUTO:
|
||||||
default:
|
default:
|
||||||
return QLocale::system().name();
|
return QLocale::system().name();
|
||||||
@@ -231,6 +285,7 @@ void StreamingPreferences::save()
|
|||||||
settings.setValue(SER_REVERSESCROLL, reverseScrollDirection);
|
settings.setValue(SER_REVERSESCROLL, reverseScrollDirection);
|
||||||
settings.setValue(SER_SWAPFACEBUTTONS, swapFaceButtons);
|
settings.setValue(SER_SWAPFACEBUTTONS, swapFaceButtons);
|
||||||
settings.setValue(SER_CAPTURESYSKEYS, captureSysKeysMode);
|
settings.setValue(SER_CAPTURESYSKEYS, captureSysKeysMode);
|
||||||
|
settings.setValue(SER_KEEPAWAKE, keepAwake);
|
||||||
}
|
}
|
||||||
|
|
||||||
int StreamingPreferences::getDefaultBitrate(int width, int height, int fps)
|
int StreamingPreferences::getDefaultBitrate(int width, int height, int fps)
|
||||||
|
|||||||
@@ -69,7 +69,27 @@ public:
|
|||||||
LANG_EN,
|
LANG_EN,
|
||||||
LANG_FR,
|
LANG_FR,
|
||||||
LANG_ZH_CN,
|
LANG_ZH_CN,
|
||||||
LANG_DE
|
LANG_DE,
|
||||||
|
LANG_NB_NO,
|
||||||
|
LANG_RU,
|
||||||
|
LANG_ES,
|
||||||
|
LANG_JA,
|
||||||
|
LANG_VI,
|
||||||
|
LANG_TH,
|
||||||
|
LANG_KO,
|
||||||
|
LANG_HU,
|
||||||
|
LANG_NL,
|
||||||
|
LANG_SV,
|
||||||
|
LANG_TR,
|
||||||
|
LANG_UK,
|
||||||
|
LANG_ZH_HANT,
|
||||||
|
LANG_PT,
|
||||||
|
LANG_PT_BR,
|
||||||
|
LANG_EL,
|
||||||
|
LANG_IT,
|
||||||
|
LANG_HI,
|
||||||
|
LANG_PL,
|
||||||
|
LANG_CS,
|
||||||
};
|
};
|
||||||
Q_ENUM(Language);
|
Q_ENUM(Language);
|
||||||
|
|
||||||
@@ -110,6 +130,7 @@ public:
|
|||||||
Q_PROPERTY(bool backgroundGamepad MEMBER backgroundGamepad NOTIFY backgroundGamepadChanged)
|
Q_PROPERTY(bool backgroundGamepad MEMBER backgroundGamepad NOTIFY backgroundGamepadChanged)
|
||||||
Q_PROPERTY(bool reverseScrollDirection MEMBER reverseScrollDirection NOTIFY reverseScrollDirectionChanged)
|
Q_PROPERTY(bool reverseScrollDirection MEMBER reverseScrollDirection NOTIFY reverseScrollDirectionChanged)
|
||||||
Q_PROPERTY(bool swapFaceButtons MEMBER swapFaceButtons NOTIFY swapFaceButtonsChanged)
|
Q_PROPERTY(bool swapFaceButtons MEMBER swapFaceButtons NOTIFY swapFaceButtonsChanged)
|
||||||
|
Q_PROPERTY(bool keepAwake MEMBER keepAwake NOTIFY keepAwakeChanged)
|
||||||
Q_PROPERTY(CaptureSysKeysMode captureSysKeysMode MEMBER captureSysKeysMode NOTIFY captureSysKeysModeChanged)
|
Q_PROPERTY(CaptureSysKeysMode captureSysKeysMode MEMBER captureSysKeysMode NOTIFY captureSysKeysModeChanged)
|
||||||
Q_PROPERTY(Language language MEMBER language NOTIFY languageChanged);
|
Q_PROPERTY(Language language MEMBER language NOTIFY languageChanged);
|
||||||
|
|
||||||
@@ -139,6 +160,7 @@ public:
|
|||||||
bool backgroundGamepad;
|
bool backgroundGamepad;
|
||||||
bool reverseScrollDirection;
|
bool reverseScrollDirection;
|
||||||
bool swapFaceButtons;
|
bool swapFaceButtons;
|
||||||
|
bool keepAwake;
|
||||||
int packetSize;
|
int packetSize;
|
||||||
AudioConfig audioConfig;
|
AudioConfig audioConfig;
|
||||||
VideoCodecConfig videoCodecConfig;
|
VideoCodecConfig videoCodecConfig;
|
||||||
@@ -177,6 +199,7 @@ signals:
|
|||||||
void reverseScrollDirectionChanged();
|
void reverseScrollDirectionChanged();
|
||||||
void swapFaceButtonsChanged();
|
void swapFaceButtonsChanged();
|
||||||
void captureSysKeysModeChanged();
|
void captureSysKeysModeChanged();
|
||||||
|
void keepAwakeChanged();
|
||||||
void languageChanged();
|
void languageChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
fxc /T vs_4_0_level_9_3 /Fo d3d11_vertex.fxc d3d11_vertex.hlsl
|
||||||
|
|
||||||
|
fxc /T ps_4_0_level_9_3 /Fo d3d11_overlay_pixel.fxc d3d11_overlay_pixel.hlsl
|
||||||
|
fxc /T ps_4_0_level_9_3 /Fo d3d11_genyuv_pixel.fxc d3d11_genyuv_pixel.hlsl
|
||||||
|
fxc /T ps_4_0_level_9_3 /Fo d3d11_bt601lim_pixel.fxc d3d11_bt601lim_pixel.hlsl
|
||||||
|
fxc /T ps_4_0_level_9_3 /Fo d3d11_bt2020lim_pixel.fxc d3d11_bt2020lim_pixel.hlsl
|
||||||
Binary file not shown.
Loaded 100 of 171 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user