mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-23 10:31:24 -08:00
Compare commits
849
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3d464b5d5 | ||
|
|
c294de7867 | ||
|
|
308a45e81d | ||
|
|
2fc6be013a | ||
|
|
262fbd72ef | ||
|
|
a902ffa15f | ||
|
|
106cecd93c | ||
|
|
06e1aa7584 | ||
|
|
b94cfcb46f | ||
|
|
26c64c7979 | ||
|
|
af00794cd6 | ||
|
|
7ef875de9f | ||
|
|
b470613921 | ||
|
|
69f5282ecc | ||
|
|
52bf583397 | ||
|
|
fea53102dd | ||
|
|
98731ff850 | ||
|
|
fbb02b5c28 | ||
|
|
ce39007b95 | ||
|
|
9e6eca9617 | ||
|
|
041c8ae74f | ||
|
|
c0bbd7fdaa | ||
|
|
5c0d049f65 | ||
|
|
833986e851 | ||
|
|
d7883b2026 | ||
|
|
714f8cbca4 | ||
|
|
e02cba43a2 | ||
|
|
7fb25632d0 | ||
|
|
9aa78e8f87 | ||
|
|
b0b381b6fa | ||
|
|
a1cfabc45f | ||
|
|
29a071291c | ||
|
|
ff18a1ed77 | ||
|
|
655fba5703 | ||
|
|
46390b49a4 | ||
|
|
8e8bd126ed | ||
|
|
fa5488436d | ||
|
|
0fa1177763 | ||
|
|
ca85097473 | ||
|
|
172ff8fc6c | ||
|
|
b13b7ac5bf | ||
|
|
95a532dd50 | ||
|
|
e51016baf4 | ||
|
|
4fbbfc7fb0 | ||
|
|
efdc1aa4f5 | ||
|
|
6c25eae4f0 | ||
|
|
3d17273916 | ||
|
|
65339a3105 | ||
|
|
2909187d00 | ||
|
|
36115fbb1a | ||
|
|
414755fcb1 | ||
|
|
6a82f5a54b | ||
|
|
71c627f6fa | ||
|
|
6942810e4b | ||
|
|
bd08648046 | ||
|
|
f45889f993 | ||
|
|
2d3b88fcf3 | ||
|
|
ad70324679 | ||
|
|
bacb171f84 | ||
|
|
99a4f5420e | ||
|
|
a0abe1e33b | ||
|
|
57d21c79ff | ||
|
|
db2e6b10c9 | ||
|
|
f005dd3c58 | ||
|
|
f0a8f07ea1 | ||
|
|
ef83b28a41 | ||
|
|
0de3a95d41 | ||
|
|
13bb66c9e0 | ||
|
|
e977e5dd0e | ||
|
|
eb1bc5f201 | ||
|
|
8e8d4e433b | ||
|
|
06bd37a854 | ||
|
|
75caf21de5 | ||
|
|
0140b0970d | ||
|
|
1838e3f60d | ||
|
|
02ce2ef901 | ||
|
|
4e49f3aea2 | ||
|
|
b8a4be7c36 | ||
|
|
fc9666cc7f | ||
|
|
2c99580804 | ||
|
|
5e689f4f28 | ||
|
|
3d1bb1629b | ||
|
|
d264d80419 | ||
|
|
4b02f8d81b | ||
|
|
8f760d7953 | ||
|
|
4bfd762622 | ||
|
|
7d72dc2c8a | ||
|
|
efac8fda65 | ||
|
|
59be0e5275 | ||
|
|
350dca5e5c | ||
|
|
c975680b06 | ||
|
|
50c5ce4290 | ||
|
|
a771054681 | ||
|
|
4a4b15dce9 | ||
|
|
335b5b145c | ||
|
|
5294be1588 | ||
|
|
e65e5ad2f9 | ||
|
|
862ecbdfef | ||
|
|
662d949ebe | ||
|
|
02cdabd0e9 | ||
|
|
7d72bffeb7 | ||
|
|
be2e1be7f8 | ||
|
|
110b44cd9b | ||
|
|
c1afe43f1f | ||
|
|
f441908bf1 | ||
|
|
d09d80b07b | ||
|
|
7f485bc3e7 | ||
|
|
8eb427f8c1 | ||
|
|
9b8d11e444 | ||
|
|
7024aa0477 | ||
|
|
9dcef1542e | ||
|
|
7d1e142737 | ||
|
|
73dbfa0c99 | ||
|
|
d2669f42af | ||
|
|
e3dd8985a9 | ||
|
|
8fe1bb7d7b | ||
|
|
267b552716 | ||
|
|
59d9156c29 | ||
|
|
6de710816e | ||
|
|
86cb892936 | ||
|
|
b6c6a070d8 | ||
|
|
b50ef2ed67 | ||
|
|
983bfb7f41 | ||
|
|
a366e4c20c | ||
|
|
a66c43feb7 | ||
|
|
2243e1583c | ||
|
|
84975c4e02 | ||
|
|
10de6776c3 | ||
|
|
aca2097ff2 | ||
|
|
7c71348733 | ||
|
|
fbd26125b6 | ||
|
|
797b2eda2c | ||
|
|
0225e8a55b | ||
|
|
83172ba2b3 | ||
|
|
189a711d5c | ||
|
|
184afc4867 | ||
|
|
41a56f2f68 | ||
|
|
edb70869bc | ||
|
|
e43cd0dc9a | ||
|
|
d08cfad199 | ||
|
|
98d7606b66 | ||
|
|
131be48e98 | ||
|
|
dc6e986650 | ||
|
|
41440c6337 | ||
|
|
c897980c88 | ||
|
|
34c24ed9df | ||
|
|
eb04fdd300 | ||
|
|
2949cfe726 | ||
|
|
9791a031c8 | ||
|
|
f26f892d01 | ||
|
|
bacf9b09c7 | ||
|
|
ac6b6b85a2 | ||
|
|
dc2452a666 | ||
|
|
12e06d4b3c | ||
|
|
2bb23256a5 | ||
|
|
10652049d5 | ||
|
|
c5f9b82395 | ||
|
|
46acc4768d | ||
|
|
b140a18752 | ||
|
|
a319b74a05 | ||
|
|
8d08c94465 | ||
|
|
c3427650c4 | ||
|
|
a7b5733f5d | ||
|
|
ff296ce924 | ||
|
|
753fdb527e | ||
|
|
c30efd2317 | ||
|
|
7fe01747d0 | ||
|
|
9a3c5ab1d6 | ||
|
|
0c5528aad7 | ||
|
|
d07b05935c | ||
|
|
b756a30030 | ||
|
|
52fb3f8fc4 | ||
|
|
5e8cbb2a0b | ||
|
|
dc8c74b78e | ||
|
|
02c322c601 | ||
|
|
2c19f8a6ff | ||
|
|
943e5d4c12 | ||
|
|
d8e632a979 | ||
|
|
db1690377a | ||
|
|
79c1daede3 | ||
|
|
4d0a0194e3 | ||
|
|
bcf26a94e2 | ||
|
|
b85ca1922d | ||
|
|
22dddb54f0 | ||
|
|
0ef2a782a6 | ||
|
|
470e8c37c7 | ||
|
|
57aa975be6 | ||
|
|
5295b9f9f6 | ||
|
|
ca423d87e2 | ||
|
|
465d9333db | ||
|
|
33833db61b | ||
|
|
46b48055d0 | ||
|
|
3e90e81a6a | ||
|
|
305849ad41 | ||
|
|
8c88e2f9c3 | ||
|
|
770b554807 | ||
|
|
2d137475fc | ||
|
|
47ea90e869 | ||
|
|
89dec5257c | ||
|
|
1f5269cbd0 | ||
|
|
b1c1f1f7c5 | ||
|
|
f7fbc098e8 | ||
|
|
2bb33fd533 | ||
|
|
ecaabe5e6d | ||
|
|
f58c4dc24f | ||
|
|
d791928ece | ||
|
|
7d89c8deaf | ||
|
|
87783bba26 | ||
|
|
809f6c904c | ||
|
|
7d7893e418 | ||
|
|
58fce713e4 | ||
|
|
e04e91ca77 | ||
|
|
58a3400a35 | ||
|
|
8ceb0eaeb6 | ||
|
|
a0c90f2355 | ||
|
|
87c9190354 | ||
|
|
692fc49e6a | ||
|
|
5d174359a6 | ||
|
|
2f31892bcb | ||
|
|
0181119829 | ||
|
|
420aa2c461 | ||
|
|
585d234e4f | ||
|
|
3a82031504 | ||
|
|
eff66da1b1 | ||
|
|
4f28de0b63 | ||
|
|
7b237f46d3 | ||
|
|
e68638e9c3 | ||
|
|
9d3a0eddc8 | ||
|
|
0b520d0f40 | ||
|
|
89592a9689 | ||
|
|
5f3820597e | ||
|
|
65600a3141 | ||
|
|
faedf3092f | ||
|
|
c3391f16c0 | ||
|
|
388bcb33a1 | ||
|
|
8e9558fcee | ||
|
|
3efac0bde3 | ||
|
|
431c9a584a | ||
|
|
86a62eebc8 | ||
|
|
1dc9127fa6 | ||
|
|
2fc6810043 | ||
|
|
6b253da7cf | ||
|
|
bc8fe31e51 | ||
|
|
dfb895345d | ||
|
|
b21e50a041 | ||
|
|
a53879be3f | ||
|
|
0c9a1c3654 | ||
|
|
77f94da67a | ||
|
|
18729089b8 | ||
|
|
44725de59d | ||
|
|
78616e074b | ||
|
|
8cfbd90a47 | ||
|
|
ba9379d556 | ||
|
|
a5bbb6b643 | ||
|
|
2ea2407723 | ||
|
|
963bc4ac1b | ||
|
|
8dbe1e5c21 | ||
|
|
b662b03556 | ||
|
|
6b607ad453 | ||
|
|
1f769e474b | ||
|
|
3952db9c64 | ||
|
|
f8aebdd066 | ||
|
|
30d5d5e462 | ||
|
|
351b64d0c1 | ||
|
|
afb00dcbf4 | ||
|
|
860ec28e1f | ||
|
|
d6121278ba | ||
|
|
4c7b7196c8 | ||
|
|
fe44ec2ae5 | ||
|
|
d4921c5a25 | ||
|
|
83a8c7ee6a | ||
|
|
c7ef8a3615 | ||
|
|
ac6f5fd63a | ||
|
|
32be0ac254 | ||
|
|
83941fd38e | ||
|
|
64a2484827 | ||
|
|
d75417de49 | ||
|
|
51aa13b6c8 | ||
|
|
7c202618b3 | ||
|
|
e3be80fadc | ||
|
|
49d631a2a7 | ||
|
|
0efb1ca808 | ||
|
|
c1424c2a23 | ||
|
|
027061af77 | ||
|
|
cc0bc18ed5 | ||
|
|
a9cdcbcfdf | ||
|
|
4ff461b49f | ||
|
|
75317ebfa4 | ||
|
|
927776a495 | ||
|
|
1604aaf745 | ||
|
|
cd74086e6f | ||
|
|
3c07e4bd45 | ||
|
|
081f576643 | ||
|
|
18ef835373 | ||
|
|
e50469d46b | ||
|
|
81a1ab0089 | ||
|
|
3c707268a7 | ||
|
|
737d6f5e2a | ||
|
|
22328ecb5f | ||
|
|
706dfd6dce | ||
|
|
099f54f4ba | ||
|
|
b624c81f9a | ||
|
|
c06fa006a5 | ||
|
|
ac4eb8f5d8 | ||
|
|
5fec3962ee | ||
|
|
3b51900a00 | ||
|
|
71abdf1f97 | ||
|
|
bb4f7699c7 | ||
|
|
38f53fb154 | ||
|
|
62ed5d0031 | ||
|
|
d69357b53b | ||
|
|
f8e126efdd | ||
|
|
963b6f640c | ||
|
|
e58c6e7646 | ||
|
|
c00ff72b63 | ||
|
|
30629aa66c | ||
|
|
b92b91778a | ||
|
|
82e48cbad4 | ||
|
|
be2c16d827 | ||
|
|
65cdc83e3c | ||
|
|
ee38e9f6ba | ||
|
|
2681ae7621 | ||
|
|
747931404f | ||
|
|
67140a7703 | ||
|
|
8ef05d49cc | ||
|
|
9995a81caf | ||
|
|
07626b9623 | ||
|
|
a371af75fa | ||
|
|
69acb068c7 | ||
|
|
15775a1247 | ||
|
|
6dfad04ebb | ||
|
|
6ebae1bedf | ||
|
|
bc11c874e2 | ||
|
|
889c54720c | ||
|
|
8c7ec3a453 | ||
|
|
ebe5c6b010 | ||
|
|
c11dc54ed1 | ||
|
|
2de0569326 | ||
|
|
2a28c0766a | ||
|
|
ec59f373ae | ||
|
|
64d1aa6209 | ||
|
|
183f986eee | ||
|
|
83e99e2708 | ||
|
|
1608c3ea91 | ||
|
|
a9f252f59f | ||
|
|
e8196425da | ||
|
|
bd2c4da2f2 | ||
|
|
bc1f5a2652 | ||
|
|
6b1ccd3f6f | ||
|
|
2acf7804d8 | ||
|
|
1d2b6295c9 | ||
|
|
28efcda839 | ||
|
|
28eb411ecb | ||
|
|
1b40f12791 | ||
|
|
59fc10da6e | ||
|
|
fb6fda82e1 | ||
|
|
6c9339514e | ||
|
|
2dde4104d0 | ||
|
|
26e7acd49c | ||
|
|
2fd5c68429 | ||
|
|
c829bdc06e | ||
|
|
280d5f8c1c | ||
|
|
b6a34cee91 | ||
|
|
dbed346fe8 | ||
|
|
dfe015c868 | ||
|
|
622464f85e | ||
|
|
dfd5ceca42 | ||
|
|
95c87f66e0 | ||
|
|
cde49f828c | ||
|
|
fb70d4405d | ||
|
|
6d4fcee967 | ||
|
|
443cfc118a | ||
|
|
1c28d73b74 | ||
|
|
2c1bce29c2 | ||
|
|
99de177797 | ||
|
|
dda5c7c73c | ||
|
|
0f546e26b0 | ||
|
|
ba4b10469f | ||
|
|
9874df3939 | ||
|
|
b2c70b0a71 | ||
|
|
f7db29fb2c | ||
|
|
aaf392c21c | ||
|
|
f023fa33e1 | ||
|
|
2e7d9b1691 | ||
|
|
ffd71293eb | ||
|
|
dac736e4b3 | ||
|
|
d45351dfb5 | ||
|
|
5bfd50dd14 | ||
|
|
7b85570bf5 | ||
|
|
4d338ec684 | ||
|
|
e71fa3ed3d | ||
|
|
86f04d90ac | ||
|
|
fe08eb103e | ||
|
|
2f120cfff7 | ||
|
|
94fa3f54a3 | ||
|
|
0cd81ac143 | ||
|
|
357ec14ee9 | ||
|
|
0361c1c578 | ||
|
|
ebc5b7ead1 | ||
|
|
97769d466d | ||
|
|
2da229f983 | ||
|
|
480e26255c | ||
|
|
6286c50efd | ||
|
|
1302538168 | ||
|
|
7a3027332f | ||
|
|
bed6f63624 | ||
|
|
f9df514b95 | ||
|
|
6cffadf792 | ||
|
|
1fbbf1b9ea | ||
|
|
ce73034ec6 | ||
|
|
3e83e2153d | ||
|
|
8250845177 | ||
|
|
5a8192daa0 | ||
|
|
f0aae5a2f1 | ||
|
|
ef4eeb9500 | ||
|
|
0b80befd1c | ||
|
|
b6b52c90f2 | ||
|
|
2a9bf46d84 | ||
|
|
7d6d838cd6 | ||
|
|
dce4717510 | ||
|
|
aa266d96ae | ||
|
|
1579da304c | ||
|
|
4a0a7274b0 | ||
|
|
24ce1ae284 | ||
|
|
910fe5cf71 | ||
|
|
28bbb53fb7 | ||
|
|
04aba4beb9 | ||
|
|
5d57fb4b3a | ||
|
|
a0ed8cc7e0 | ||
|
|
2bec11f261 | ||
|
|
c08a57c96c | ||
|
|
e8d24380b8 | ||
|
|
9fac29dfa3 | ||
|
|
10d5f137f4 | ||
|
|
768424d49c | ||
|
|
0b235e6669 | ||
|
|
191f1004f1 | ||
|
|
eadb83db9e | ||
|
|
5584ae4ffa | ||
|
|
30f9178fec | ||
|
|
bcfe86e8ac | ||
|
|
9f0cf6554d | ||
|
|
0465abc005 | ||
|
|
d833052e78 | ||
|
|
2595430ed2 | ||
|
|
f7c5e2c130 | ||
|
|
4211ef3b16 | ||
|
|
1911ceb6cb | ||
|
|
e97c9a16bd | ||
|
|
c09bddf148 | ||
|
|
edf6a819e1 | ||
|
|
b50ae9b24f | ||
|
|
a4d62fc668 | ||
|
|
44773e47f6 | ||
|
|
48c9c3e079 | ||
|
|
4344abfffd | ||
|
|
5661668c20 | ||
|
|
06d035402f | ||
|
|
7c6646ccf7 | ||
|
|
0bc8b58c36 | ||
|
|
89bee2a6f4 | ||
|
|
2c58ae71b4 | ||
|
|
00ced5e745 | ||
|
|
c242018582 | ||
|
|
a62cb42189 | ||
|
|
f58cb7dfcf | ||
|
|
f9c08e5ec7 | ||
|
|
f6084e398e | ||
|
|
08409660c4 | ||
|
|
f1f2ca6d6d | ||
|
|
74860c26c1 | ||
|
|
7d84e7cfa0 | ||
|
|
fcbd4394f5 | ||
|
|
10f783b347 | ||
|
|
d37a0d0a66 | ||
|
|
e5ad3e02eb | ||
|
|
b8a72e43c0 | ||
|
|
15e27092d3 | ||
|
|
9426366780 | ||
|
|
b2614d5118 | ||
|
|
6ead7e1bb5 | ||
|
|
9af5608613 | ||
|
|
7fea99cbec | ||
|
|
fd277e4ba6 | ||
|
|
f40c79cbdd | ||
|
|
56ec55211f | ||
|
|
2c0cdf3079 | ||
|
|
c3cfd16a04 | ||
|
|
496adc4b3c | ||
|
|
cd7f23e98a | ||
|
|
b52f05d38b | ||
|
|
732a5d59ab | ||
|
|
982c2429f1 | ||
|
|
2d3b0ed1d0 | ||
|
|
8c1017b886 | ||
|
|
da42de70b2 | ||
|
|
d4e46298f0 | ||
|
|
1f3dcbdc80 | ||
|
|
6b64277f12 | ||
|
|
24bded44a0 | ||
|
|
eb6340a896 | ||
|
|
b0b3c05d06 | ||
|
|
9eb0e82d9c | ||
|
|
9f1fd9489e | ||
|
|
7342e72b2c | ||
|
|
8b0aae537b | ||
|
|
4876cfa417 | ||
|
|
359def6a72 | ||
|
|
0c0ece2f3c | ||
|
|
705ba65cdc | ||
|
|
d2d1da8f82 | ||
|
|
f7cae8ee01 | ||
|
|
a784a7afe3 | ||
|
|
835015d00e | ||
|
|
774516b7e0 | ||
|
|
70378752d6 | ||
|
|
eb73053e25 | ||
|
|
dd2d6542d3 | ||
|
|
99222ef951 | ||
|
|
c742e7226d | ||
|
|
38079be787 | ||
|
|
4fb2a0a854 | ||
|
|
5fa986f32b | ||
|
|
bf32e7f729 | ||
|
|
6d8366d41f | ||
|
|
8d42f98e57 | ||
|
|
7c21bf5437 | ||
|
|
4baef9aca2 | ||
|
|
c6ce1bf6af | ||
|
|
c6abc5a560 | ||
|
|
f446693978 | ||
|
|
2cf29c4f3a | ||
|
|
53d3ee611f | ||
|
|
b95140796e | ||
|
|
7f7e229349 | ||
|
|
160563dee2 | ||
|
|
fe0f0e7021 | ||
|
|
48aa085cf3 | ||
|
|
bd84e53f28 | ||
|
|
941967b472 | ||
|
|
adcefc0733 | ||
|
|
75e16b280f | ||
|
|
a0af9da399 | ||
|
|
8238514638 | ||
|
|
cc535fbf25 | ||
|
|
e5ecd500c8 | ||
|
|
44342c0d41 | ||
|
|
c2bbfc9237 | ||
|
|
1feee8dd32 | ||
|
|
5cf2cebb3d | ||
|
|
e863d5d1fe | ||
|
|
d609e77f5b | ||
|
|
afd711ba23 | ||
|
|
dba4c1964e | ||
|
|
38fe57cee0 | ||
|
|
00801b35a1 | ||
|
|
ce64b3fbcd | ||
|
|
1a26abffca | ||
|
|
5a17518b26 | ||
|
|
7501e10237 | ||
|
|
6ad68371e0 | ||
|
|
d3f81fa257 | ||
|
|
f82f1eeddd | ||
|
|
9a0cdb61cb | ||
|
|
a2e0eabe6e | ||
|
|
4b6244289e | ||
|
|
1d12c8423d | ||
|
|
7148ec3394 | ||
|
|
e2bdc27c99 | ||
|
|
9d541a3c09 | ||
|
|
7eeafb2a25 | ||
|
|
090f836fc9 | ||
|
|
2c20f3973e | ||
|
|
1aaeb07f4d | ||
|
|
0977f8e6e4 | ||
|
|
e9157dbff7 | ||
|
|
cadc775c86 | ||
|
|
9b1e32f125 | ||
|
|
3fc70fae9a | ||
|
|
d67223a6bb | ||
|
|
cf94fc6a6b | ||
|
|
648a957b89 | ||
|
|
986cb37be4 | ||
|
|
cb5becd52d | ||
|
|
bb5f36160c | ||
|
|
4863e3d313 | ||
|
|
db05f2e9d9 | ||
|
|
4bf797909b | ||
|
|
cc63cb45c6 | ||
|
|
f6c93a87fc | ||
|
|
c8c4c62136 | ||
|
|
9c60cb8097 | ||
|
|
5f0c11deb4 | ||
|
|
8374422c3c | ||
|
|
e6397ed65f | ||
|
|
c13841b833 | ||
|
|
f67b061043 | ||
|
|
c6a4054b46 | ||
|
|
a36b330fda | ||
|
|
83eb12d906 | ||
|
|
8e08c3965e | ||
|
|
6d22ee9323 | ||
|
|
554976390b | ||
|
|
46528a320f | ||
|
|
1c2beb7961 | ||
|
|
2bb35fb99f | ||
|
|
151a6e3021 | ||
|
|
8f3cd8e3dd | ||
|
|
7ede75de8a | ||
|
|
ca04a615ef | ||
|
|
63f3ffcd7f | ||
|
|
136746d1d0 | ||
|
|
3a15c54e85 | ||
|
|
7ab83c3f4a | ||
|
|
367fbc9344 | ||
|
|
ca89627832 | ||
|
|
b6acc5fe26 | ||
|
|
9ea6354d49 | ||
|
|
dd95c35f93 | ||
|
|
3f0c340f55 | ||
|
|
6efec5628b | ||
|
|
bff1fe1db3 | ||
|
|
ced279a867 | ||
|
|
8637d1864a | ||
|
|
c4ee293519 | ||
|
|
757c53b8ae | ||
|
|
ca84b84e48 | ||
|
|
b96a6468a7 | ||
|
|
ba8c09b48c | ||
|
|
865c6a3b7d | ||
|
|
56bada0b92 | ||
|
|
056fb49202 | ||
|
|
025aa96534 | ||
|
|
fc9f9f4605 | ||
|
|
991c968e4a | ||
|
|
72c9293f18 | ||
|
|
676f093e8a | ||
|
|
922f212883 | ||
|
|
7b8e95cacf | ||
|
|
cb8a9338cb | ||
|
|
b8610d94bb | ||
|
|
5eba00d32b | ||
|
|
9c15ddc79b | ||
|
|
0ba3b1e164 | ||
|
|
5dd5d125b1 | ||
|
|
fecc700da5 | ||
|
|
2f64daeb64 | ||
|
|
31956e2a2f | ||
|
|
bb7a5521e3 | ||
|
|
e376c221e1 | ||
|
|
5d1dc2238e | ||
|
|
702e1d4cd7 | ||
|
|
c8878db908 | ||
|
|
4759300ed9 | ||
|
|
243453ac7e | ||
|
|
6876956023 | ||
|
|
e3c7563bfa | ||
|
|
f41c4fea27 | ||
|
|
c697aabfd7 | ||
|
|
3a605df946 | ||
|
|
93816ad7ed | ||
|
|
c72a30aca5 | ||
|
|
f679051d50 | ||
|
|
89d20c6bc1 | ||
|
|
03eded6c35 | ||
|
|
d7f510c7f3 | ||
|
|
0daaa2520d | ||
|
|
3b02bf4273 | ||
|
|
17b535c3a1 | ||
|
|
14c4562d02 | ||
|
|
66a8606c81 | ||
|
|
5cf8b24926 | ||
|
|
f7fae1d895 | ||
|
|
cff625c02a | ||
|
|
5c18a4184e | ||
|
|
d2c2aaf2ee | ||
|
|
1a7c15f805 | ||
|
|
ea348b65bb | ||
|
|
8a51cef017 | ||
|
|
bbcfc99061 | ||
|
|
aa3ab3942a | ||
|
|
0c2b8947dd | ||
|
|
d18ad4f8e2 | ||
|
|
debdec761a | ||
|
|
25f74ad1b2 | ||
|
|
354c0084b6 | ||
|
|
fad307237e | ||
|
|
c1b416b41b | ||
|
|
a0de2555d2 | ||
|
|
3aa621ffc1 | ||
|
|
02378c43b3 | ||
|
|
52b22e8a45 | ||
|
|
f8aa2f8c68 | ||
|
|
d69585a2ad | ||
|
|
262158db2f | ||
|
|
0d413dc161 | ||
|
|
42c081bd79 | ||
|
|
4b1460aa18 | ||
|
|
e2cb06fe2b | ||
|
|
68429e1fb8 | ||
|
|
6d8c5ea9ae | ||
|
|
6a193e235d | ||
|
|
f6b72b1ecf | ||
|
|
9137482634 | ||
|
|
dd70977b6f | ||
|
|
1721943d20 | ||
|
|
036ffa0b55 | ||
|
|
0b1cb6ae7e | ||
|
|
179277d66e | ||
|
|
4028963105 | ||
|
|
ecc345bd71 | ||
|
|
9d3558cd2a | ||
|
|
4bfb4287b6 | ||
|
|
cc64682d35 | ||
|
|
bde1c78bec | ||
|
|
9b06eec608 | ||
|
|
1b7c333b81 | ||
|
|
05e1222316 | ||
|
|
82a5ab2974 | ||
|
|
96ff0b088a | ||
|
|
9ec27d7b62 | ||
|
|
3391080226 | ||
|
|
21d61a47b0 | ||
|
|
6d2c701409 | ||
|
|
ad04ed9244 | ||
|
|
992479a4c2 | ||
|
|
3aa5616f2c | ||
|
|
c7a7eedc2a | ||
|
|
d16a30ca17 | ||
|
|
c23fa703a1 | ||
|
|
d7205bb294 | ||
|
|
f535007ee0 | ||
|
|
f9a6e6afee | ||
|
|
1290b8f930 | ||
|
|
5d0e6011dc | ||
|
|
05e8faeb34 | ||
|
|
6562d41721 | ||
|
|
5d7cd5dfaf | ||
|
|
484a65c1b2 | ||
|
|
ab7c143f19 | ||
|
|
59a76aa898 | ||
|
|
0105b4813c | ||
|
|
20afbdb71b | ||
|
|
6f537ab170 | ||
|
|
c158ed821c | ||
|
|
8762da715d | ||
|
|
10c8088c85 | ||
|
|
952bdd7884 | ||
|
|
40d214b6b3 | ||
|
|
5da53fcfe2 | ||
|
|
e0b06f1598 | ||
|
|
a238211c93 | ||
|
|
51342dd338 | ||
|
|
e207abbc31 | ||
|
|
b0232ae783 | ||
|
|
6b54329dd2 | ||
|
|
4e1e53ee0a | ||
|
|
540c291ccb | ||
|
|
dd7d7d0bd0 | ||
|
|
c9732f7e46 | ||
|
|
4c0b187306 | ||
|
|
c850f18403 | ||
|
|
05fbf64ac3 | ||
|
|
8e19542c82 | ||
|
|
0aa3b9966e | ||
|
|
d96af009d9 | ||
|
|
0736d60c75 | ||
|
|
bd126ec099 | ||
|
|
86433dfb3d | ||
|
|
627600a2e0 | ||
|
|
609a8d9dc6 | ||
|
|
2f5a9fb089 | ||
|
|
2ab148aad2 | ||
|
|
44d9c68f78 | ||
|
|
56fcfe15bf | ||
|
|
74ee1bb580 | ||
|
|
d0c2a27288 | ||
|
|
7d213de97c | ||
|
|
0e6e2d7de1 | ||
|
|
9332ff8e02 | ||
|
|
953ef93945 | ||
|
|
5c4c64e629 | ||
|
|
f986f507ae | ||
|
|
b9776ab898 | ||
|
|
577036eb9c | ||
|
|
5da133cffc | ||
|
|
a6020ae4df | ||
|
|
01362ca2de | ||
|
|
e4014679e0 | ||
|
|
7433048d52 | ||
|
|
bf6d8eb50d | ||
|
|
349666b8cd | ||
|
|
a1c4de8152 | ||
|
|
7d46e903fe | ||
|
|
ff514faf73 | ||
|
|
35175565d3 | ||
|
|
527f5e0d99 | ||
|
|
8c504bbac0 | ||
|
|
12a5208e73 | ||
|
|
47bd59b475 | ||
|
|
bb94364830 | ||
|
|
51fda0ad7f | ||
|
|
3452e2b000 | ||
|
|
dbe0acd9fa | ||
|
|
f7c821f316 | ||
|
|
fc7316cb4b | ||
|
|
68545e52f7 | ||
|
|
abec5ea4b9 | ||
|
|
20be49e4b0 | ||
|
|
6378eb30cd | ||
|
|
8c49a7dcc2 | ||
|
|
90706ac9cb | ||
|
|
6d6492c124 | ||
|
|
4add1655ff | ||
|
|
deb0f1a1b2 | ||
|
|
b379ebc34e | ||
|
|
0278968e94 | ||
|
|
d99a0a77a3 | ||
|
|
588c8d9cc3 | ||
|
|
e6e15a8ff2 | ||
|
|
5f909831a7 | ||
|
|
fdfbc35c53 | ||
|
|
006d8bb1e2 | ||
|
|
0ff1bc9264 | ||
|
|
960647c691 | ||
|
|
1ec08024e7 | ||
|
|
8b7ce00d92 | ||
|
|
f0667dc74c | ||
|
|
4607616270 | ||
|
|
2fc891d9f9 | ||
|
|
3da6efbdc0 | ||
|
|
3afd7375c2 | ||
|
|
a894b49921 | ||
|
|
0c1ef06e3f | ||
|
|
b7f87ab1f1 | ||
|
|
9efc2b2b3c | ||
|
|
853db3fd0f | ||
|
|
396a049809 | ||
|
|
4ea067731b | ||
|
|
67e5880739 | ||
|
|
d9edf9fb69 | ||
|
|
ed211a97a6 | ||
|
|
9961cb4114 | ||
|
|
33d54b2609 | ||
|
|
d256506a1a | ||
|
|
068a7a85a6 | ||
|
|
234dabe23e | ||
|
|
c87b7ff003 | ||
|
|
a2c4c0fb4f |
No files matched your search
@@ -0,0 +1,15 @@
|
||||
# Copy to .env.local to report to Sentry from local builds.
|
||||
# Read by the gui (vite), electron and server (gradle) builds. Real environment variables win.
|
||||
# Rebuild after changing it, the values are baked in at build time.
|
||||
|
||||
# Forces a Sentry release. Without it only clean tagged builds report.
|
||||
# Source maps are never uploaded for a forced release.
|
||||
SENTRY_RELEASE=v0.0.0-local
|
||||
|
||||
# Keeps local events out of production alerts and release health. Defaults to production.
|
||||
SENTRY_ENVIRONMENT=development
|
||||
|
||||
# Leave a DSN empty to disable that part.
|
||||
SENTRY_GUI_DSN=
|
||||
SENTRY_ELECTRON_DSN=
|
||||
SENTRY_SERVER_DSN=
|
||||
@@ -3,3 +3,12 @@
|
||||
*.png binary
|
||||
*.webp binary
|
||||
*.gif binary
|
||||
|
||||
*.ftl -linguist-detectable
|
||||
|
||||
# GUI assets (gui/app-next/src/assets)
|
||||
gui/app-next/src/assets/**/*.webp filter=lfs diff=lfs merge=lfs -text
|
||||
gui/app-next/src/assets/**/*.webm filter=lfs diff=lfs merge=lfs -text
|
||||
gui/app-next/src/assets/**/*.gltf filter=lfs diff=lfs merge=lfs -text
|
||||
gui/app-next/src/assets/**/*.glb filter=lfs diff=lfs merge=lfs -text
|
||||
gui/app-next/src/assets/**/*.ogg filter=lfs diff=lfs merge=lfs -text
|
||||
@@ -19,14 +19,6 @@
|
||||
# Some server code~
|
||||
/server/ @ButterscotchV @loucass003 @Erimelowo
|
||||
|
||||
/server/src/main/java/dev/slimevr/autobone/ @ButterscotchV
|
||||
/server/src/main/java/dev/slimevr/poserecorder/ @ButterscotchV
|
||||
/server/src/main/java/dev/slimevr/posestreamer/ @ButterscotchV
|
||||
|
||||
/server/src/main/java/dev/slimevr/osc/ @Erimelowo
|
||||
/server/src/main/java/dev/slimevr/tracking/processor/ @Erimelowo
|
||||
/server/src/main/java/dev/slimevr/filtering/ @Erimelowo
|
||||
|
||||
/bindings-provider/ @ImSapphire
|
||||
|
||||
# Linux files
|
||||
|
||||
+29
-27
@@ -82,7 +82,7 @@ jobs:
|
||||
node-version-file: '.node-version'
|
||||
cache: 'pnpm'
|
||||
- name: GUI Lint
|
||||
run: pnpm i && cd gui && pnpm run lint
|
||||
run: pnpm i && pnpm run lint
|
||||
|
||||
server-checks:
|
||||
name: Server Checks
|
||||
@@ -92,18 +92,15 @@ jobs:
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Set up JDK 24
|
||||
- name: Set up JDK 25
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: '24'
|
||||
distribution: 'adopt'
|
||||
java-version: '25'
|
||||
distribution: 'temurin'
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v6
|
||||
- name: Server Spotless Check
|
||||
run: ./gradlew spotlessCheck --build-cache
|
||||
- name: Server Detekt Lint
|
||||
run: ./gradlew :server:detekt --build-cache
|
||||
|
||||
|
||||
build-server-jar:
|
||||
name: Build Desktop Server
|
||||
@@ -115,17 +112,19 @@ jobs:
|
||||
submodules: recursive
|
||||
- name: Get tags
|
||||
run: git fetch --tags origin --recurse-submodules=no --force
|
||||
- name: Set up JDK 24
|
||||
- name: Set up JDK 25
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: '24'
|
||||
distribution: 'adopt'
|
||||
java-version: '25'
|
||||
distribution: 'temurin'
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v6
|
||||
- name: Build ShadowJar
|
||||
run: ./gradlew :server:desktop:shadowJar --build-cache
|
||||
env:
|
||||
SENTRY_SERVER_DSN: ${{ vars.SENTRY_SERVER_DSN }}
|
||||
- name: Test with Gradle
|
||||
run: ./gradlew :server:desktop:test
|
||||
run: ./gradlew :server:core:jvmTest
|
||||
- name: Upload Server Jar
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
@@ -154,9 +153,12 @@ jobs:
|
||||
- name: Build JS
|
||||
env:
|
||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||
run: pnpm i && cd gui && pnpm run build
|
||||
SENTRY_GUI_DSN: ${{ vars.SENTRY_GUI_DSN }}
|
||||
SENTRY_ELECTRON_DSN: ${{ vars.SENTRY_ELECTRON_DSN }}
|
||||
SENTRY_SERVER_DSN: ${{ vars.SENTRY_SERVER_DSN }}
|
||||
run: pnpm i && pnpm run build
|
||||
- name: Tar GUI Dist
|
||||
run: tar -czf slimevr-gui-dist.tar.gz -C gui/out .
|
||||
run: tar -czf slimevr-gui-dist.tar.gz -C gui/electron/out .
|
||||
- name: Upload GUI Dist
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
@@ -201,21 +203,19 @@ jobs:
|
||||
name: gui-dist
|
||||
- name: Extract GUI for Electron
|
||||
shell: bash
|
||||
run: mkdir -p gui/out && tar -xzf slimevr-gui-dist.tar.gz -C gui/out
|
||||
run: mkdir -p gui/electron/out && tar -xzf slimevr-gui-dist.tar.gz -C gui/electron/out
|
||||
- name: Run Electron Builder
|
||||
shell: bash
|
||||
env:
|
||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||
run: |
|
||||
mkdir -p gui/dist/artifacts/linux/ \
|
||||
gui/dist/artifacts/win \
|
||||
gui/dist/artifacts/mac
|
||||
mkdir -p gui/electron/dist/artifacts/linux/ \
|
||||
gui/electron/dist/artifacts/win \
|
||||
gui/electron/dist/artifacts/mac
|
||||
VERSION=$(git --no-pager tag --sort -taggerdate --points-at HEAD | head -1)
|
||||
[ -z "$VERSION" ] && VERSION="0.0.0"
|
||||
VERSION="${VERSION#v}"
|
||||
echo "Building version: $VERSION"
|
||||
pnpm i
|
||||
cd gui
|
||||
cd gui/electron
|
||||
pnpm exec electron-builder --${{ matrix.platform }} \
|
||||
${{ matrix.platform == 'macos' && '--universal' || '' }} \
|
||||
--config.extraMetadata.version="$VERSION" \
|
||||
@@ -223,7 +223,7 @@ jobs:
|
||||
- name: Collect and Rename Artifacts
|
||||
shell: bash
|
||||
run: |
|
||||
SRC_DIR="${{ github.workspace }}/gui/dist/artifacts"
|
||||
SRC_DIR="${{ github.workspace }}/gui/electron/dist/artifacts"
|
||||
DEST_DIR="${{ github.workspace }}/release-out"
|
||||
mkdir -p "$DEST_DIR"
|
||||
|
||||
@@ -262,11 +262,11 @@ jobs:
|
||||
submodules: recursive
|
||||
- name: Get tags
|
||||
run: git fetch --tags origin --recurse-submodules=no --force
|
||||
- name: Set up JDK 24
|
||||
- name: Set up JDK 25
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: '24'
|
||||
distribution: 'adopt'
|
||||
java-version: '25'
|
||||
distribution: 'temurin'
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v6
|
||||
- name: Download GUI Dist
|
||||
@@ -274,16 +274,16 @@ jobs:
|
||||
with:
|
||||
name: gui-dist
|
||||
- name: Extract GUI for Android
|
||||
run: mkdir -p gui/out && tar -xzf slimevr-gui-dist.tar.gz -C gui/out
|
||||
run: mkdir -p gui/electron/out && tar -xzf slimevr-gui-dist.tar.gz -C gui/electron/out
|
||||
- name: Build APK
|
||||
run: ./gradlew :server:android:build --build-cache
|
||||
env:
|
||||
SENTRY_SERVER_DSN: ${{ vars.SENTRY_SERVER_DSN }}
|
||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||
ANDROID_STORE_FILE: ${{ secrets.ANDROID_STORE_FILE }}
|
||||
ANDROID_STORE_PASSWD: ${{ secrets.ANDROID_STORE_PASSWD }}
|
||||
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
|
||||
ANDROID_KEY_PASSWD: ${{ secrets.ANDROID_KEY_PASSWD }}
|
||||
- name: Test with Gradle
|
||||
run: ./gradlew test
|
||||
- name: Prepare APK
|
||||
run: cp server/android/build/outputs/apk/release/*.apk ./SlimeVR-android.apk
|
||||
- name: Upload APK
|
||||
@@ -296,6 +296,8 @@ jobs:
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
run: ./gradlew :server:android:bundleRelease
|
||||
env:
|
||||
SENTRY_SERVER_DSN: ${{ vars.SENTRY_SERVER_DSN }}
|
||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||
ANDROID_STORE_FILE: ${{ secrets.ANDROID_GPLAY_STORE_FILE }}
|
||||
ANDROID_STORE_PASSWD: ${{ secrets.ANDROID_GPLAY_STORE_PASSWD }}
|
||||
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_GPLAY_KEY_ALIAS }}
|
||||
|
||||
+15
-1
@@ -4,10 +4,12 @@
|
||||
# Syncthing ignore file
|
||||
.stignore
|
||||
|
||||
# Ignore .idea, except shared project inspection profiles
|
||||
# Ignore .idea, except shared project inspection profiles and run configurations
|
||||
.idea/*
|
||||
!.idea/inspectionProfiles/
|
||||
!.idea/inspectionProfiles/*.xml
|
||||
!.idea/runConfigurations/
|
||||
!.idea/runConfigurations/*.xml
|
||||
|
||||
# Ignore .fleet
|
||||
.fleet
|
||||
@@ -36,10 +38,16 @@
|
||||
# ignore gradle build folder
|
||||
build/
|
||||
|
||||
# created by clangd for index cache
|
||||
.cache/
|
||||
|
||||
# direnv has been claimed for Nix usage
|
||||
.direnv/
|
||||
.devenv
|
||||
|
||||
# Git worktrees
|
||||
.worktree/
|
||||
|
||||
# Ignore Android local properties
|
||||
local.properties
|
||||
|
||||
@@ -49,3 +57,9 @@ vrconfig.yml.tmp
|
||||
|
||||
# Nixos
|
||||
.bin/
|
||||
|
||||
.env.local
|
||||
|
||||
|
||||
# Fuck claude
|
||||
.claude
|
||||
-24
@@ -1,30 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="27ef4df3-2b89-390d-a9cd-ef29bd86503d" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="8d635bb8-7d4f-3af3-8d31-6f9164877ab2" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ConvertLongToDuration" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SSBasedInspection" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<searchConfiguration name="Use safeLaunch instead of raw launch" uuid="8d635bb8-7d4f-3af3-8d31-6f9164877ab2" description="Use dev.slimevr.util.safeLaunch instead of raw launch to ensure coroutine exceptions are handled properly." suppressId="RAW_LAUNCH_USAGE" problemDescriptor="Use safeLaunch instead of raw launch to ensure coroutine exceptions are handled properly." text="$scope$.launch { $statements$; }" recursive="true" caseInsensitive="false" type="Kotlin" pattern_context="default">
|
||||
<constraint name="__context__" within="" contains="" />
|
||||
<constraint name="scope" within="" contains="" />
|
||||
<constraint name="statements" minCount="0" maxCount="2147483647" within="" contains="" />
|
||||
</searchConfiguration>
|
||||
<searchConfiguration name="Use safeLaunch instead of raw launch" uuid="0e4a6db4-4c7b-3fd4-99ce-2717fa0fd2fb" description="Use dev.slimevr.util.safeLaunch instead of raw launch to ensure coroutine exceptions are handled properly." suppressId="RAW_LAUNCH_USAGE" problemDescriptor="Use safeLaunch instead of raw launch to ensure coroutine exceptions are handled properly." text="launch { $statements$; }" recursive="true" caseInsensitive="false" type="Kotlin" pattern_context="default">
|
||||
<constraint name="__context__" within="" contains="" />
|
||||
<constraint name="statements" minCount="0" maxCount="2147483647" within="" contains="" />
|
||||
</searchConfiguration>
|
||||
<searchConfiguration name="Use safeLaunch instead of raw launch" uuid="27ef4df3-2b89-390d-a9cd-ef29bd86503d" description="Use dev.slimevr.util.safeLaunch instead of raw launch to ensure coroutine exceptions are handled properly." suppressId="RAW_LAUNCH_USAGE" problemDescriptor="Use safeLaunch instead of raw launch to ensure coroutine exceptions are handled properly." text="$scope$.launch($args$) { $statements$; }" recursive="true" caseInsensitive="false" type="Kotlin" pattern_context="default">
|
||||
<constraint name="__context__" within="" contains="" />
|
||||
<constraint name="scope" within="" contains="" />
|
||||
<constraint name="args" maxCount="2147483647" within="" contains="" />
|
||||
<constraint name="statements" minCount="0" maxCount="2147483647" within="" contains="" />
|
||||
</searchConfiguration>
|
||||
<searchConfiguration name="Use safeLaunch instead of raw launch" uuid="ca477c43-2f5b-3907-8b06-02c34dc26930" description="Use dev.slimevr.util.safeLaunch instead of raw launch to ensure coroutine exceptions are handled properly." suppressId="RAW_LAUNCH_USAGE" problemDescriptor="Use safeLaunch instead of raw launch to ensure coroutine exceptions are handled properly." text="launch($args$) { $statements$; }" recursive="true" caseInsensitive="false" type="Kotlin" pattern_context="default">
|
||||
<constraint name="__context__" within="" contains="" />
|
||||
<constraint name="args" maxCount="2147483647" within="" contains="" />
|
||||
<constraint name="statements" minCount="0" maxCount="2147483647" within="" contains="" />
|
||||
</searchConfiguration>
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="SlimeVR Desktop" type="JetRunConfigurationType" factoryName="Kotlin">
|
||||
<module name="SlimeVR_Server.server.desktop.main" />
|
||||
<option name="MAIN_CLASS_NAME" value="dev.slimevr.desktop.Main" />
|
||||
<option name="VM_PARAMETERS" value="--enable-native-access=ALL-UNNAMED" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/server/desktop" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
@@ -1,64 +0,0 @@
|
||||
# OpenCode Agent Instructions
|
||||
|
||||
## Environment & Tooling
|
||||
- **Server (Kotlin/Java)**: Use `gradle` (`./gradlew`).
|
||||
- Run: `./gradlew run`
|
||||
- Build: `./gradlew shadowJar`
|
||||
- Format: `./gradlew spotlessApply`
|
||||
- **GUI (Electron/TS)**: Use `pnpm`.
|
||||
- Install: `pnpm i`
|
||||
- Dev: `pnpm gui`
|
||||
- Build: `pnpm package:build`
|
||||
- Format: `pnpm run lint:fix`
|
||||
- **SolarXR Protocol (Submodule)**: Use `bash` and `pnpm`.
|
||||
- Edit: Only `schema/` files.
|
||||
- Generate: `./generate-flatbuffer.sh` (Linux/macOS).
|
||||
- Sync: Run `pnpm i` in root after generation.
|
||||
|
||||
## Architecture: The Reducer/Behaviour Pattern
|
||||
The server uses a reactive reducer pattern for thread safety and observability.
|
||||
|
||||
- **Core Primitives**:
|
||||
- `Context<S, A>`: Holds `StateFlow<S>`, `CoroutineScope`, and `Behaviour`s.
|
||||
- `Behaviour<S, A, C>`:
|
||||
- `reduce(state, action)`: **Pure function**. No side effects.
|
||||
- `observe(receiver)`: **Side effects**. Launch coroutines using `receiver.context.scope`.
|
||||
- **Lifecycle**: `Module.create()` (inert construction) $\rightarrow$ `module.startObserving()` (side-effect activation).
|
||||
- **DI**: Uses `Phase1ContextProvider` $\rightarrow$ `AppContextProvider` hierarchy.
|
||||
- **Communication**: Modules communicate via `dispatch(action)` or by observing another module's `StateFlow`.
|
||||
|
||||
## Design & Coding Preferences
|
||||
- **Function over Class**: Prefer plain functions or `object` over classes for single-purpose logic.
|
||||
- **Function over Extension**: Use plain functions instead of extension functions unless the receiver is the primary subject.
|
||||
- **Action Selection**:
|
||||
- Use `Update` (with a lambda) for internal state changes that require no external reaction.
|
||||
- Use **Named Actions** when multiple behaviours must react to a specific event.
|
||||
- **State Management**: Only include data in `StateFlow` if it is required for observation by other modules.
|
||||
- **Communication**: Decouple modules by using `dispatch` or observing `StateFlow` rather than direct method calls.
|
||||
|
||||
## Agent Workflow
|
||||
- **Phase 1: Discovery**: Use the `Glob` $\rightarrow$ `Grep` $\rightarrow$ `Read` pattern. Never guess file paths or contents.
|
||||
- **Phase 2: Planning**: For complex tasks, use `todowrite` to create a checklist. Present the plan to the user before implementation.
|
||||
- **Phase 3: Implementation**: Use `edit` for existing files; `write` for new files.
|
||||
- **Phase 4: Verification**: Always run the relevant linting or testing tools before marking a task as complete.
|
||||
|
||||
## Common Pitfalls
|
||||
- **Coroutine Leaks**: Never launch coroutines in `observe` using a global scope; **always** use `receiver.context.scope`.
|
||||
- **Direct State Mutation**: Never attempt to mutate state properties directly. Always use `dispatch(action)`.
|
||||
- **Incomplete Cleanup**: Ensure any module owning a `Context` implements a `dispose()` method.
|
||||
|
||||
## Conventions
|
||||
- **Files**: `module.kt` (Class/State/Actions) and `behaviours.kt` (Implementations).
|
||||
- **Actions**: Use `sealed interface`.
|
||||
- **State**: Data classes must use `val` only.
|
||||
- **Cleanup**: We use a direct `dispose()` method on modules instead of a `Disposable` interface.
|
||||
- **Detailed Conventions**: See `server/README.md` for full coding style and architecture details.
|
||||
|
||||
## Testing
|
||||
- **Reducers**: Test by creating a `Context` with specific `Behaviour`s.
|
||||
- **Modules**: Use `TestAppContext` and `buildTest...` helpers from `TestServer.kt`.
|
||||
|
||||
## Verification Protocol
|
||||
- **Linting**: Run `./gradlew spotlessApply` (Server) or `pnpm run lint:fix` (GUI).
|
||||
- **Testing**: Identify and run the relevant test suite (e.g., `./gradlew test` or specific module tests).
|
||||
- **Final Audit**: Perform a final `git diff` check to ensure no unintended changes were made.
|
||||
+12
-7
@@ -1,5 +1,7 @@
|
||||
# Contributing to SlimeVR
|
||||
|
||||
Please follow general contribution guidelines: [CONTRIBUTING.md](https://github.com/SlimeVR/.github/blob/main/profile/CONTRIBUTING.md).
|
||||
|
||||
This document describes essential knowledge required to contribute to the SlimeVR Server.
|
||||
|
||||
### Prerequisites
|
||||
@@ -26,7 +28,7 @@ Before contributing to the server, read [server/README.md](server/README.md) for
|
||||
|
||||
The Java code is built with `gradle`, a CLI tool that manages java projects and their
|
||||
dependencies.
|
||||
- You can run the server by running `./gradlew run` in your IDE's terminal.
|
||||
- You can run the server by running `./gradlew :server:desktop:run` in your IDE's terminal.
|
||||
- To compile the code, run `./gradlew shadowJar`. The result will
|
||||
be at `server/desktop/build/libs/slimevr.jar` (you can ignore `server.jar`).
|
||||
|
||||
@@ -36,9 +38,11 @@ be at `server/desktop/build/libs/slimevr.jar` (you can ignore `server.jar`).
|
||||
|
||||
- Activate corepack (included with Node.js) via `corepack enable`
|
||||
(might require launching Git Bash as administrator on Windows)
|
||||
- Make sure you're at the root of the repository.
|
||||
- Run `pnpm i` in your IDE's terminal to download and install dependencies.
|
||||
- To launch the GUI in dev mode, run `pnpm gui`.
|
||||
- Finally, to compile for production, run `pnpm package:build`.
|
||||
- If you get an "Electron uninstall" error, run `node .\gui\electron\node_modules\electron\install.js`.
|
||||
- Finally, to compile for production, run `pnpm package:build` under `gui/electron`.
|
||||
The result will be in `gui/dist/artifacts/`. Content will change depending on the platform.
|
||||
|
||||
## Code style
|
||||
@@ -88,7 +92,7 @@ Eclipse will only do a subset of the checks in `spotless`, so you may still want
|
||||
### Electron (gui)
|
||||
|
||||
We use ESLint and Prettier to format GUI code.
|
||||
- First, go into the GUI's directory with your terminal by running `cd gui`.
|
||||
- Make sure you're at the root of the repository.
|
||||
- To check code formatting, run `pnpm run lint`.
|
||||
- To fix code formatting, run `pnpm run lint:fix` and `pnpm run format`
|
||||
|
||||
@@ -118,8 +122,9 @@ licensed under `GPL-v3`.
|
||||
We use discord *a lot* to coordinate and discuss development. Come join us at
|
||||
https://discord.gg/SlimeVR!
|
||||
|
||||
## Use of AI
|
||||
We DO NOT accept contributions that are generated with AI (for example, "vibe-coding").
|
||||
## Use of AI, LLM, and code generation
|
||||
**Submission of any content directly from AI is strictly forbidden in all SlimeVR repositories**, including code, documentation, translation, images, sounds, etc. Including, but not limited to: vibe-coding, snippets generated by LLM, AI-generated icons, copilot auto-complete, commit descriptions, PR notes, issues texts and comments. If your auto-complete system suggest next word, function name or variable name - it's okay to use, if it suggest a whole code snipped - it's not allowed.
|
||||
|
||||
If you do use AI, and you believe your usage of AI is reasonable, you must clearly disclose
|
||||
how you used AI in your submission.
|
||||
An exception is using translation tools to communicate with us if you're unable to properly express yourself in English. Please leave a comment that your post was translated and from which language. Submissions of machine translations to repositories are forbidden.
|
||||
|
||||
AI is allowed for things such as research, debugging, and questions, if no output of AI is submitted.
|
||||
@@ -68,8 +68,8 @@ AlignConsecutiveTableGenDefinitionColons:
|
||||
AlignEscapedNewlines: Right
|
||||
AlignOperands: DontAlign
|
||||
AlignTrailingComments:
|
||||
Kind: Never
|
||||
OverEmptyLines: 0
|
||||
Kind: Always
|
||||
OverEmptyLines: 2
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowBreakBeforeNoexceptSpecifier: Never
|
||||
@@ -140,7 +140,7 @@ EmptyLineAfterAccessModifier: Never
|
||||
EmptyLineBeforeAccessModifier: LogicalBlock
|
||||
EnumTrailingComma: Leave
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: false
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
@@ -216,13 +216,13 @@ PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyIndentedWhitespace: 0
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
PointerAlignment: Right
|
||||
PointerAlignment: Left
|
||||
PPIndentWidth: -1
|
||||
QualifierAlignment: Leave
|
||||
ReferenceAlignment: Pointer
|
||||
ReflowComments: Always
|
||||
RemoveBracesLLVM: false
|
||||
RemoveEmptyLinesInUnwrappedLines: false
|
||||
RemoveEmptyLinesInUnwrappedLines: true
|
||||
RemoveParentheses: Leave
|
||||
RemoveSemicolon: false
|
||||
RequiresClausePosition: OwnLine
|
||||
@@ -293,5 +293,7 @@ WhitespaceSensitiveMacros:
|
||||
- PP_STRINGIZE
|
||||
- STRINGIZE
|
||||
WrapNamespaceBodyWithEmptyLines: Leave
|
||||
---
|
||||
Language: Proto
|
||||
DisableFormat: true
|
||||
...
|
||||
|
||||
@@ -42,13 +42,17 @@ message(STATUS "Found OpenVR library at: ${OPENVR_LIBRARY}")
|
||||
add_executable("${PROJECT_NAME}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/paths.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/logger.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/solarxr.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/bridge/BridgeClient.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/bridge/BridgeTransport.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/vr_utils.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp"
|
||||
)
|
||||
set_target_properties("${PROJECT_NAME}" PROPERTIES CXX_STANDARD 23)
|
||||
target_include_directories("${PROJECT_NAME}" PRIVATE "${SOLARXR_PROTOCOL_ROOT}/lib/flatbuffers/include" "${SOLARXR_PROTOCOL_ROOT}/lib/flatbuffers/" "${FLATBUFFERS_GENERATED_ROOT}/include" "${CMAKE_CURRENT_SOURCE_DIR}/include" "${OPENVR_ROOT}/headers")
|
||||
target_link_libraries("${PROJECT_NAME}" PRIVATE "${OPENVR_LIBRARY}")
|
||||
if(WIN32)
|
||||
target_link_libraries("${PROJECT_NAME}" PRIVATE ws2_32)
|
||||
endif()
|
||||
|
||||
if(LINUX)
|
||||
set_target_properties("${PROJECT_NAME}" PROPERTIES OUTPUT_NAME slimevr-bindings-provider)
|
||||
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
if ((Get-Command "clang-format" -ErrorAction SilentlyContinue) -eq $null) {
|
||||
$errorObj = New-Object System.IO.FileNotFoundException("clang-format is not installed, please install clang-format via your package manager (e.g. winget/chocolatey/scoop) and re-run the script")
|
||||
throw $errorObj
|
||||
}
|
||||
|
||||
$SourceFiles = Get-ChildItem -Path '.\src\' -Recurse -Include "*.cpp","*.hpp"
|
||||
foreach ($file in $SourceFiles) {
|
||||
Write-Output "Formatting $(Resolve-Path -Relative $file.FullName)"
|
||||
clang-format -i "$($file.FullName)"
|
||||
}
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
if ! command -v clang-format >/dev/null 2>&1; then
|
||||
echo "clang-format is not installed, please install clang-format via your package manager (e.g. pacman/apt/dnf/winget) and re-run the script" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
find src/ \( \
|
||||
-iname '*.cpp' \
|
||||
-or -iname '*.hpp' \
|
||||
\) \
|
||||
-exec echo Formatting {} \; \
|
||||
-exec clang-format -i {} \;
|
||||
@@ -0,0 +1,52 @@
|
||||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||
// SPDX-FileCopyrightText: (c) 2026 Eiren Rain and SlimeVR Contributors
|
||||
#include "BridgeClient.hpp"
|
||||
#include "BridgeTransport.hpp"
|
||||
|
||||
#include <system_error>
|
||||
|
||||
using namespace std::literals::chrono_literals;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
void BridgeClient::CreateConnection() {
|
||||
fs::path path = GetSocketPath();
|
||||
|
||||
Socket fd = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
if (fd == InvalidSocket) {
|
||||
int err = GetLastSocketError();
|
||||
throw std::system_error(err, std::system_category(), "socket() failed");
|
||||
}
|
||||
|
||||
if (last_path_ != path) {
|
||||
Logger::Get().Info("Trying to connect to socket {}", path.string());
|
||||
last_path_ = path;
|
||||
}
|
||||
|
||||
struct sockaddr_un addr{
|
||||
.sun_family = AF_UNIX,
|
||||
};
|
||||
|
||||
const std::u8string path_str = path.u8string();
|
||||
if (path_str.size() > std::size(addr.sun_path) - 1) {
|
||||
CloseSocket(fd);
|
||||
throw std::runtime_error("Socket path too long to fit in sun_path");
|
||||
}
|
||||
memcpy(addr.sun_path, path_str.data(), path_str.size() + 1);
|
||||
|
||||
int ret = connect(fd, reinterpret_cast<const struct sockaddr*>(&addr), sizeof(addr));
|
||||
if (ret == SocketError) {
|
||||
int err = GetLastSocketError();
|
||||
CloseSocket(fd);
|
||||
throw std::system_error(err, std::system_category(), "connect() failed");
|
||||
}
|
||||
|
||||
Logger::Get().Info("Connected to {}", path.string());
|
||||
|
||||
ret = SetNonBlocking(fd);
|
||||
if (ret == SocketError) {
|
||||
int err = GetLastSocketError();
|
||||
Logger::Get().Warning("Failed to set socket into non-blocking mode: {}", std::error_code(err, std::system_category()).message());
|
||||
}
|
||||
|
||||
fd_ = fd;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||
// SPDX-FileCopyrightText: (c) 2026 Eiren Rain and SlimeVR Contributors
|
||||
#pragma once
|
||||
|
||||
#include "BridgeTransport.hpp"
|
||||
|
||||
/**
|
||||
* @brief Client implementation of @ref BridgeTransport for communication with SlimeVR Server using unix sockets.
|
||||
*
|
||||
* @copydoc BridgeTransport
|
||||
*/
|
||||
class BridgeClient : public BridgeTransport {
|
||||
public:
|
||||
using BridgeTransport::BridgeTransport;
|
||||
|
||||
private:
|
||||
void CreateConnection() override;
|
||||
|
||||
std::filesystem::path last_path_;
|
||||
};
|
||||
@@ -0,0 +1,234 @@
|
||||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||
// SPDX-FileCopyrightText: (c) 2026 Eiren Rain and SlimeVR Contributors
|
||||
#include "BridgeTransport.hpp"
|
||||
#include "Endianness.hpp"
|
||||
|
||||
#include <solarxr_protocol/generated/all_generated.h>
|
||||
#include <system_error>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <winerror.h>
|
||||
#endif
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
#define UNIX_XDG_DATA_HOME_DEFAULT ".local/share/"
|
||||
#define SLIMEVR_IDENTIFIER "dev.slimevr.SlimeVR"
|
||||
#define UNIX_DEFAULT_TMP_DIR "/tmp"
|
||||
#define SOCKET_NAME "SlimeVRRpc"
|
||||
|
||||
void BridgeTransport::Stop() {
|
||||
if (!thread_.joinable() && !reconnect_thread_.joinable())
|
||||
return;
|
||||
Logger::Get().Info("Bridge stopping");
|
||||
StopAsync();
|
||||
thread_ = std::jthread();
|
||||
reconnect_thread_ = std::jthread();
|
||||
}
|
||||
|
||||
void BridgeTransport::StopAsync() {
|
||||
thread_.request_stop();
|
||||
reconnect_thread_.request_stop();
|
||||
cv_.notify_all();
|
||||
}
|
||||
|
||||
fs::path BridgeTransport::GetSocketPath() {
|
||||
std::vector<fs::path> paths = {};
|
||||
|
||||
if (const char* dir_override = std::getenv("SLIMEVR_SOCKET_DIR")) {
|
||||
paths.push_back(fs::path(dir_override) / SOCKET_NAME);
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
if (const char* xdg_runtime = std::getenv("XDG_RUNTIME_DIR")) {
|
||||
paths.push_back(fs::path(xdg_runtime) / SOCKET_NAME);
|
||||
}
|
||||
|
||||
if (const char* xdg_data = std::getenv("XDG_DATA_HOME")) {
|
||||
paths.push_back(fs::path(xdg_data) / SLIMEVR_IDENTIFIER / SOCKET_NAME);
|
||||
}
|
||||
|
||||
if (const char* home = std::getenv("HOME")) {
|
||||
paths.push_back(fs::path(home) / UNIX_XDG_DATA_HOME_DEFAULT / SLIMEVR_IDENTIFIER / SOCKET_NAME);
|
||||
}
|
||||
#endif
|
||||
|
||||
std::error_code ec;
|
||||
for (auto path : paths) {
|
||||
if (fs::exists(path, ec)
|
||||
#ifdef _WIN32
|
||||
|| ec.value() == ERROR_CANT_ACCESS_FILE // Windows moment???
|
||||
#endif
|
||||
) {
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
// This should work as long as the user's machine does not have
|
||||
// the java.io.tmpdir system property overriden.
|
||||
WCHAR tmp_dir[MAX_PATH + 1];
|
||||
GetTempPathW(std::size(tmp_dir), tmp_dir);
|
||||
return fs::path(tmp_dir) / SOCKET_NAME;
|
||||
#else
|
||||
if (const char* tmp_dir = std::getenv("TMPDIR")) {
|
||||
return fs::path(tmp_dir) / SOCKET_NAME;
|
||||
} else {
|
||||
return fs::path(UNIX_DEFAULT_TMP_DIR) / SOCKET_NAME;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void BridgeTransport::OnRecv(std::span<uint8_t> event) {
|
||||
if (!message_callback_)
|
||||
return;
|
||||
|
||||
auto bundle = flatbuffers::GetRoot<solarxr_protocol::MessageBundle>(event.data());
|
||||
|
||||
if (auto data_feed_msgs = bundle->data_feed_msgs()) {
|
||||
for (auto msg : *data_feed_msgs) {
|
||||
// Logger::Get().Debug("Got message DataFeedMessage::{}", EnumNameDataFeedMessage(msg->message_type()));
|
||||
message_callback_(msg);
|
||||
}
|
||||
}
|
||||
if (auto rpc_msgs = bundle->rpc_msgs()) {
|
||||
for (auto msg : *rpc_msgs) {
|
||||
Logger::Get().Debug("Got message RpcMessage::{}", EnumNameRpcMessage(msg->message_type()));
|
||||
message_callback_(msg);
|
||||
}
|
||||
}
|
||||
if (auto driver_msgs = bundle->driver_msgs()) {
|
||||
for (auto msg : *driver_msgs) {
|
||||
// Logger::Get().Debug("Got message DriverMessage::{}", EnumNameDriverMessage(msg->message_type()));
|
||||
message_callback_(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BridgeTransport::Start() {
|
||||
thread_ = std::jthread([this](std::stop_token stop) { return RunThread(stop); });
|
||||
}
|
||||
|
||||
void BridgeTransport::RunThread(std::stop_token stop) {
|
||||
std::vector<uint8_t> data;
|
||||
data.reserve(0x10000);
|
||||
|
||||
// Kick off connection.
|
||||
ResetConnection();
|
||||
|
||||
while (!stop.stop_requested()) {
|
||||
std::shared_lock fd_lock(fd_mutex_);
|
||||
|
||||
if (fd_ == InvalidSocket) [[unlikely]] {
|
||||
cv_.wait(fd_lock, stop, [this] { return fd_ != InvalidSocket; });
|
||||
if (stop.stop_requested())
|
||||
break;
|
||||
}
|
||||
|
||||
try {
|
||||
ptrdiff_t ret = Poll(fd_, 1ms);
|
||||
if (ret == 0) [[likely]] {
|
||||
// No data on the socket after timeout
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32_t msg_len;
|
||||
ret = ReadFully(fd_, stop, &msg_len, sizeof(msg_len));
|
||||
if (ret == 0) [[unlikely]] {
|
||||
throw std::runtime_error("EOF");
|
||||
}
|
||||
|
||||
msg_len = ConvertEndianness<std::endian::little>(msg_len);
|
||||
// If we get something bigger than this, something's probably up
|
||||
if (msg_len > 0x40000) [[unlikely]] {
|
||||
throw std::runtime_error(std::format("Got too large message ({} bytes)", msg_len));
|
||||
}
|
||||
|
||||
const uint32_t unwrapped_len = msg_len - 4;
|
||||
data.reserve(unwrapped_len);
|
||||
|
||||
ret = ReadFully(fd_, stop, data.data(), unwrapped_len);
|
||||
if (ret == 0) [[unlikely]] {
|
||||
throw std::runtime_error("EOF");
|
||||
}
|
||||
|
||||
OnRecv({ data.data(), unwrapped_len });
|
||||
} catch (Cancelled&) {
|
||||
continue;
|
||||
} catch (std::exception& e) {
|
||||
Logger::Get().Error("Error on socket: {}", e.what());
|
||||
error_callback_(e);
|
||||
fd_lock.unlock();
|
||||
ResetConnection();
|
||||
}
|
||||
}
|
||||
|
||||
CloseConnectionHandles();
|
||||
}
|
||||
|
||||
void BridgeTransport::ResetConnection() {
|
||||
CloseConnectionHandles();
|
||||
|
||||
reconnect_thread_ = std::jthread([this](std::stop_token stop) {
|
||||
while (!stop.stop_requested()) {
|
||||
try {
|
||||
std::unique_lock fd_lock(fd_mutex_);
|
||||
CreateConnection();
|
||||
assert(fd_ != InvalidSocket);
|
||||
|
||||
cv_.notify_all();
|
||||
|
||||
// connect callback may call a function that needs to block on the fd
|
||||
fd_lock.unlock();
|
||||
OnConnect();
|
||||
|
||||
return;
|
||||
} catch (std::system_error& e) {
|
||||
if (last_error_ != e.code()) {
|
||||
Logger::Get().Error("Error when trying to connect: {}", e.what());
|
||||
last_error_ = e.code();
|
||||
}
|
||||
error_callback_(e);
|
||||
} catch (std::exception& e) {
|
||||
Logger::Get().Error("Error when trying to connect: {}", e.what());
|
||||
error_callback_(e);
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(100ms);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void BridgeTransport::CloseConnectionHandles() {
|
||||
std::unique_lock fd_lock(fd_mutex_);
|
||||
if (fd_ == InvalidSocket)
|
||||
return;
|
||||
|
||||
CloseSocket(fd_);
|
||||
OnDisconnect();
|
||||
fd_ = InvalidSocket;
|
||||
}
|
||||
|
||||
void BridgeTransport::SendMessage(const flatbuffers::FlatBufferBuilder& fbb) {
|
||||
std::shared_lock fd_lock(fd_mutex_);
|
||||
if (fd_ == InvalidSocket) [[unlikely]]
|
||||
return;
|
||||
|
||||
std::lock_guard write_lock(write_mutex_);
|
||||
|
||||
if (fbb.GetSize() + 4 > std::numeric_limits<uint32_t>::max()) [[unlikely]] {
|
||||
Logger::Get().Warning("Skipping send of message (wrapped size larger than 32-bit unsigned integer limit)");
|
||||
return;
|
||||
}
|
||||
|
||||
const uint32_t size = static_cast<uint32_t>(fbb.GetSize());
|
||||
const uint32_t le_wrapped_size = ConvertEndianness<std::endian::little>(size + 4);
|
||||
|
||||
try {
|
||||
WriteFully(fd_, &le_wrapped_size, sizeof(le_wrapped_size));
|
||||
WriteFully(fd_, fbb.GetBufferPointer(), size);
|
||||
} catch (std::exception& e) {
|
||||
Logger::Get().Error("Failed to write message: {}", e.what());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,343 @@
|
||||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||
// SPDX-FileCopyrightText: (c) 2026 Eiren Rain and SlimeVR Contributors
|
||||
#pragma once
|
||||
|
||||
#include <condition_variable>
|
||||
#include <filesystem>
|
||||
#include <shared_mutex>
|
||||
#include <span>
|
||||
#include <system_error>
|
||||
#include <thread>
|
||||
#include <variant>
|
||||
|
||||
// Needs to be before anything that includes Windows.h to avoid macro clashes
|
||||
#include <solarxr_protocol/generated/all_generated.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOMINMAX
|
||||
#include <Winsock2.h>
|
||||
#include <afunix.h>
|
||||
// Microsoft why
|
||||
#undef ERROR
|
||||
#undef SendMessage
|
||||
#else
|
||||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#endif
|
||||
|
||||
#include "../logger.hpp"
|
||||
|
||||
/**
|
||||
* @brief Passes messages between SlimeVR Server and SteamVR Driver using Unix sockets.
|
||||
*
|
||||
* Client or Server connection handling is implemented by extending this class.
|
||||
*
|
||||
* This class provides a set of methods to start, stop an IO thread, and send messages over a Unix socket.
|
||||
*
|
||||
* When a message is received and parsed from the pipe, the on_message_received function passed in the constructor is called
|
||||
* from the bridge thread with the message as a parameter.
|
||||
*
|
||||
* @param logger A shared pointer to an Logger object to log messages from the transport.
|
||||
* @param on_message_received A function to be called from event loop thread when a message is received and parsed from the pipe.
|
||||
* @param on_connect A function to be called when the socket is connected to.
|
||||
* @param on_disconnect A function to be called when the connection is ended.
|
||||
*/
|
||||
class BridgeTransport {
|
||||
public:
|
||||
using MessageHeader = std::variant<const solarxr_protocol::data_feed::DataFeedMessageHeader*, const solarxr_protocol::rpc::RpcMessageHeader*, const solarxr_protocol::driver_protocol::DriverMessageHeader*>;
|
||||
|
||||
#ifdef _WIN32
|
||||
using Socket = SOCKET;
|
||||
constexpr static Socket InvalidSocket = INVALID_SOCKET;
|
||||
constexpr static int SocketError = SOCKET_ERROR;
|
||||
#else
|
||||
using Socket = int;
|
||||
constexpr static Socket InvalidSocket = -1;
|
||||
constexpr static int SocketError = -1;
|
||||
#endif
|
||||
|
||||
static inline int GetLastSocketError() {
|
||||
#ifdef _WIN32
|
||||
return WSAGetLastError();
|
||||
#else
|
||||
return errno;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline int CloseSocket(Socket fd) {
|
||||
#ifdef _WIN32
|
||||
return closesocket(fd);
|
||||
#else
|
||||
return close(fd);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool IsBlockingError(int err) {
|
||||
#ifdef _WIN32
|
||||
return err == WSAEWOULDBLOCK;
|
||||
#else
|
||||
return err == EAGAIN || err == EWOULDBLOCK;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline int SetNonBlocking(Socket fd) {
|
||||
#ifdef _WIN32
|
||||
u_long mode = 1;
|
||||
return ioctlsocket(fd, FIONBIO, &mode);
|
||||
#else
|
||||
return fcntl(fd, F_SETFL, O_NONBLOCK);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Exception thrown when IO is cancelled by stop token.
|
||||
*/
|
||||
class Cancelled : public std::exception {
|
||||
public:
|
||||
Cancelled() noexcept { };
|
||||
~Cancelled() { };
|
||||
|
||||
const char* what() const noexcept override {
|
||||
return "IO operation cancelled";
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Read @a size bytes from @a fd into @a data, retrying until all data is read or an error occurs.
|
||||
*
|
||||
* @throws @ref Cancelled stop was requested on @a stop
|
||||
* @throws std::system_error error returned on socket
|
||||
* @returns @ref SocketError on fail, otherwise number of bytes read
|
||||
*/
|
||||
static ptrdiff_t ReadFully(Socket fd, std::stop_token stop, void* data, size_t size) {
|
||||
ptrdiff_t ret;
|
||||
size_t received = 0;
|
||||
while (!stop.stop_requested() && received < size) {
|
||||
ret = recv(fd, reinterpret_cast<char*>(data) + received, size - received, 0);
|
||||
if (ret == 0) // EOF
|
||||
return ret;
|
||||
|
||||
if (ret == SocketError) [[unlikely]] {
|
||||
int err = GetLastSocketError();
|
||||
if (IsBlockingError(err)) [[likely]] {
|
||||
// we couldn't read because it would block, just try again
|
||||
continue;
|
||||
} else {
|
||||
throw std::system_error(err, std::system_category(), "recv() failed");
|
||||
}
|
||||
}
|
||||
|
||||
received += ret;
|
||||
}
|
||||
|
||||
if (stop.stop_requested())
|
||||
throw Cancelled();
|
||||
return received;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write @a size bytes from @a data to @a fd, retrying until all data is written or an error occurs.
|
||||
*
|
||||
* @throws std::system_error error returned on socket
|
||||
*
|
||||
* @returns @ref SocketError on fail, otherwise number of bytes written
|
||||
*/
|
||||
static inline ptrdiff_t WriteFully(Socket fd, const void* data, size_t size) {
|
||||
#ifdef __linux__
|
||||
constexpr int flags = MSG_NOSIGNAL;
|
||||
#else
|
||||
constexpr int flags = 0;
|
||||
#endif
|
||||
|
||||
ptrdiff_t ret;
|
||||
size_t sent = 0;
|
||||
while (sent < size) {
|
||||
ret = send(fd, reinterpret_cast<const char*>(data) + sent, size - sent, flags);
|
||||
if (ret == SocketError) [[unlikely]] {
|
||||
int err = GetLastSocketError();
|
||||
if (IsBlockingError(err)) [[likely]] {
|
||||
// we couldn't write because it would block, just try again
|
||||
continue;
|
||||
} else {
|
||||
throw std::system_error(err, std::system_category(), "send() failed");
|
||||
}
|
||||
}
|
||||
|
||||
sent += ret;
|
||||
}
|
||||
|
||||
return sent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Wait for input to be ready on @a fd, timing out after @a timeout.
|
||||
*
|
||||
* @param fd file descriptor to poll
|
||||
* @param timeout amount of time to wait before giving up
|
||||
*
|
||||
* @throws std::system_error error returned when polling
|
||||
* @throws std::runtime_error error on socket, or hang up was detected
|
||||
*
|
||||
* @returns @ref 0 if there is no data, positive value if there is data
|
||||
*/
|
||||
template <typename Rep, typename Period>
|
||||
static int Poll(Socket fd, std::chrono::duration<Rep, Period> timeout) noexcept(false) {
|
||||
struct pollfd pollfd{
|
||||
.fd = fd,
|
||||
.events = POLLIN,
|
||||
};
|
||||
|
||||
int ret;
|
||||
|
||||
#ifdef _WIN32
|
||||
ret = WSAPoll(&pollfd, 1, std::chrono::duration_cast<std::chrono::milliseconds>(timeout).count());
|
||||
#else
|
||||
{
|
||||
auto s = std::chrono::duration_cast<std::chrono::seconds>(timeout);
|
||||
auto ns = std::chrono::duration_cast<std::chrono::nanoseconds>(timeout - s);
|
||||
struct timespec ts{
|
||||
.tv_sec = s.count(),
|
||||
.tv_nsec = ns.count(),
|
||||
};
|
||||
ret = ppoll(&pollfd, 1, timeout == timeout.zero() ? nullptr : &ts, nullptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
constexpr int InterruptedErrno = WSAEINTR;
|
||||
#else
|
||||
constexpr int InterruptedErrno = EINTR;
|
||||
#endif
|
||||
|
||||
if (ret == SocketError) {
|
||||
int err = GetLastSocketError();
|
||||
throw std::system_error(err, std::system_category(), "Poll() failed");
|
||||
}
|
||||
|
||||
if ((pollfd.revents & (POLLERR | POLLHUP)) != 0) {
|
||||
throw std::runtime_error("Socket connection lost");
|
||||
}
|
||||
|
||||
return pollfd.revents & POLLIN;
|
||||
}
|
||||
|
||||
BridgeTransport(std::function<void(MessageHeader&&)> on_message_received = {},
|
||||
std::function<void()> on_connect = {},
|
||||
std::function<void()> on_disconnect = {},
|
||||
std::function<void(std::exception&)> on_error = {})
|
||||
: connect_callback_(on_connect)
|
||||
, message_callback_(on_message_received)
|
||||
, disconnect_callback_(on_disconnect)
|
||||
, error_callback_(on_error) {
|
||||
#ifdef _WIN32
|
||||
WSADATA _ws_data;
|
||||
if (int ret = WSAStartup(MAKEWORD(2, 2), &_ws_data); ret != 0) {
|
||||
Logger::Get().Error("WSAStartup failed with code {}", ret);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual ~BridgeTransport() {
|
||||
Stop();
|
||||
#ifdef _WIN32
|
||||
WSACleanup();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Starts the channel by creating a thread.
|
||||
*
|
||||
* Connects and automatic reconnects with a timeout are implemented internally.
|
||||
*/
|
||||
void Start();
|
||||
|
||||
/**
|
||||
* @brief Stops the channel by stopping the thread and closing the connection handles.
|
||||
*
|
||||
* Blocks until the thread is stopped and the connection handles are closed.
|
||||
*/
|
||||
void Stop();
|
||||
|
||||
/**
|
||||
* @brief Stops the channel asynchronously and returns immediately.
|
||||
*/
|
||||
void StopAsync();
|
||||
|
||||
/**
|
||||
* @brief Sends a message over the channel, you must Finish() the builder before calling this.
|
||||
*
|
||||
* @param message The message to send.
|
||||
*/
|
||||
void SendMessage(const flatbuffers::FlatBufferBuilder& fbb);
|
||||
|
||||
/**
|
||||
* @brief Checks if the channel is connected.
|
||||
*
|
||||
* @return true if the channel is connected, false otherwise.
|
||||
*/
|
||||
bool IsConnected() const {
|
||||
std::shared_lock fd_lock(fd_mutex_);
|
||||
return fd_ != InvalidSocket;
|
||||
};
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief Try to create a connection.
|
||||
*
|
||||
* Called while an exclusive lock is taken on @ref fd_mutex_.
|
||||
* Make sure this doesn't block as it will hold up shutdown.
|
||||
*
|
||||
* @ref fd_ must be initialised if this returns without throwing.
|
||||
*
|
||||
* @throws std::system_error I/O error when creating connection
|
||||
* @throws std::exception failed to create connection
|
||||
*/
|
||||
virtual void CreateConnection() = 0;
|
||||
/**
|
||||
* @brief Close the current socket if it's connected.
|
||||
*
|
||||
* Locks @ref fd_mutex_, do not call this with the mutex locked.
|
||||
*/
|
||||
void ResetConnection();
|
||||
|
||||
/**
|
||||
* @brief Closes the current connection, must be called while an exclusive lock is taken on the mutex.
|
||||
*/
|
||||
void CloseConnectionHandles();
|
||||
|
||||
void OnConnect() {
|
||||
if (connect_callback_)
|
||||
connect_callback_();
|
||||
}
|
||||
void OnRecv(std::span<uint8_t> event);
|
||||
void OnDisconnect() {
|
||||
if (disconnect_callback_)
|
||||
disconnect_callback_();
|
||||
}
|
||||
|
||||
static std::filesystem::path GetSocketPath();
|
||||
|
||||
/// Guards @ref fd_ and the condition variable @ref cv_.
|
||||
mutable std::shared_mutex fd_mutex_;
|
||||
/// Guards write operations.
|
||||
mutable std::mutex write_mutex_;
|
||||
/// Signaled on connection, or when we're exiting.
|
||||
std::condition_variable_any cv_;
|
||||
Socket fd_ = InvalidSocket;
|
||||
|
||||
private:
|
||||
void RunThread(std::stop_token stop);
|
||||
|
||||
std::function<void()> connect_callback_;
|
||||
std::function<void(MessageHeader&&)> message_callback_;
|
||||
std::function<void()> disconnect_callback_;
|
||||
std::function<void(std::exception&)> error_callback_;
|
||||
|
||||
std::jthread thread_;
|
||||
std::jthread reconnect_thread_;
|
||||
std::optional<std::error_code> last_error_;
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||
// SPDX-FileCopyrightText: (c) 2026 Eiren Rain and SlimeVR Contributors
|
||||
#pragma once
|
||||
|
||||
#include <bit>
|
||||
#include <type_traits>
|
||||
|
||||
template <std::endian Endianness, typename T>
|
||||
requires(std::is_integral_v<T>)
|
||||
inline T ConvertEndianness(T v) {
|
||||
// I don't really care about mixed endianness..
|
||||
if constexpr (std::endian::native == Endianness) {
|
||||
return v;
|
||||
} else {
|
||||
return std::byteswap(v);
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
#endif
|
||||
|
||||
Logger::Logger()
|
||||
: log_stream(Paths::getLogPath() / "slimevr-bindings-provider.log",
|
||||
: log_stream(Paths::GetLogPath() / "slimevr-bindings-provider.log",
|
||||
std::ios::out | std::ios::app)
|
||||
#ifdef _WIN32
|
||||
, should_log_to_std_streams(GetConsoleWindow() != nullptr)
|
||||
@@ -15,7 +15,7 @@ Logger::Logger()
|
||||
{
|
||||
}
|
||||
|
||||
Logger &Logger::get() {
|
||||
Logger& Logger::Get() {
|
||||
static Logger logger;
|
||||
return logger;
|
||||
}
|
||||
@@ -15,8 +15,8 @@ private:
|
||||
#endif
|
||||
|
||||
template <bool important, typename... Args>
|
||||
void log(std::string_view suffix, std::format_string<Args...> fmt,
|
||||
Args &&...args) {
|
||||
void Log(std::string_view suffix, std::format_string<Args...> fmt,
|
||||
Args&&... args) {
|
||||
auto now = std::chrono::system_clock::now();
|
||||
auto time_t = std::chrono::system_clock::to_time_t(now);
|
||||
|
||||
@@ -40,28 +40,28 @@ public:
|
||||
Logger();
|
||||
|
||||
template <typename... Args>
|
||||
void debug(std::format_string<Args...> fmt, Args &&...args) {
|
||||
void Debug(std::format_string<Args...> fmt, Args&&... args) {
|
||||
#ifndef NDEBUG
|
||||
log<false>("[DEBUG]", fmt, std::forward<Args>(args)...);
|
||||
Log<false>("[DEBUG]", fmt, std::forward<Args>(args)...);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
void info(std::format_string<Args...> fmt, Args &&...args) {
|
||||
log<false>("[INFO]", fmt, std::forward<Args>(args)...);
|
||||
void Info(std::format_string<Args...> fmt, Args&&... args) {
|
||||
Log<false>("[INFO]", fmt, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
void warning(std::format_string<Args...> fmt, Args &&...args) {
|
||||
log<true>("[WARN]", fmt, std::forward<Args>(args)...);
|
||||
void Warning(std::format_string<Args...> fmt, Args&&... args) {
|
||||
Log<true>("[WARN]", fmt, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
void error(std::format_string<Args...> fmt, Args &&...args) {
|
||||
log<true>("[ERROR]", fmt, std::forward<Args>(args)...);
|
||||
void Error(std::format_string<Args...> fmt, Args&&... args) {
|
||||
Log<true>("[ERROR]", fmt, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
void flush() {
|
||||
void Flush() {
|
||||
#ifdef _WIN32
|
||||
if (should_log_to_std_streams) {
|
||||
#endif
|
||||
@@ -73,5 +73,5 @@ public:
|
||||
log_stream.flush();
|
||||
}
|
||||
|
||||
static Logger &get();
|
||||
static Logger& Get();
|
||||
};
|
||||
+105
-122
@@ -1,4 +1,3 @@
|
||||
#include <cassert>
|
||||
#include <csignal>
|
||||
#include <map>
|
||||
#include <optional>
|
||||
@@ -9,13 +8,15 @@
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
#include "solarxr_protocol/generated/all_generated.h"
|
||||
|
||||
#include "bridge/BridgeClient.hpp"
|
||||
#include "logger.hpp"
|
||||
#include "solarxr.hpp"
|
||||
#include "vr_utils.hpp"
|
||||
|
||||
#include "openvr.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_MEAN_AND_LEAN
|
||||
#define NOMINMAX
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <cstdlib>
|
||||
@@ -25,102 +26,112 @@ namespace fs = std::filesystem;
|
||||
using namespace std::chrono_literals;
|
||||
using namespace solarxr_protocol;
|
||||
|
||||
static void shutdown_vr(vr::IVRSystem *_sys) { vr::VR_Shutdown(); }
|
||||
static void ShutdownVR(vr::IVRSystem* _sys) { vr::VR_Shutdown(); }
|
||||
|
||||
static void onYawReset(SolarXRConnection &conn) {
|
||||
static void OnYawReset(BridgeTransport& conn) {
|
||||
flatbuffers::FlatBufferBuilder fbb;
|
||||
|
||||
auto resetReq = rpc::CreateResetRequest(fbb, rpc::ResetType::Yaw, 0, 0.f);
|
||||
auto msgHeader = rpc::CreateRpcMessageHeader(
|
||||
fbb, nullptr, rpc::RpcMessage::ResetRequest, resetReq.Union());
|
||||
auto resetReq = rpc::CreateResetRequest(fbb, rpc::ResetType::YAW, 0, 0.f);
|
||||
auto msgHeader = rpc::CreateRpcMessageHeader(fbb, 0, 0, rpc::RpcMessage::ResetRequest, resetReq.Union());
|
||||
|
||||
auto rpcMsgs = fbb.CreateVector({ msgHeader });
|
||||
auto bundle = CreateMessageBundle(fbb, 0, rpcMsgs, 0);
|
||||
auto bundle = CreateMessageBundle(fbb, 0, rpcMsgs);
|
||||
fbb.Finish(bundle);
|
||||
conn.sendMsg(fbb);
|
||||
conn.SendMessage(fbb);
|
||||
}
|
||||
static void onFullReset(SolarXRConnection &conn) {
|
||||
static void OnFullReset(BridgeTransport& conn) {
|
||||
flatbuffers::FlatBufferBuilder fbb;
|
||||
|
||||
auto resetReq = rpc::CreateResetRequest(fbb, rpc::ResetType::Full, 0, 0.f);
|
||||
auto msgHeader = rpc::CreateRpcMessageHeader(
|
||||
fbb, nullptr, rpc::RpcMessage::ResetRequest, resetReq.Union());
|
||||
auto resetReq = rpc::CreateResetRequest(fbb, rpc::ResetType::FULL, 0, 0.f);
|
||||
auto msgHeader = rpc::CreateRpcMessageHeader(fbb, 0, 0, rpc::RpcMessage::ResetRequest, resetReq.Union());
|
||||
|
||||
auto rpcMsgs = fbb.CreateVector({ msgHeader });
|
||||
auto bundle = CreateMessageBundle(fbb, 0, rpcMsgs, 0);
|
||||
auto bundle = CreateMessageBundle(fbb, 0, rpcMsgs);
|
||||
fbb.Finish(bundle);
|
||||
conn.sendMsg(fbb);
|
||||
conn.SendMessage(fbb);
|
||||
}
|
||||
static void onMountingCalibration(SolarXRConnection &conn) {
|
||||
static void OnMountingCalibration(BridgeTransport& conn) {
|
||||
flatbuffers::FlatBufferBuilder fbb;
|
||||
|
||||
auto resetReq = rpc::CreateResetRequest(fbb, rpc::ResetType::Mounting, 0, 0.f);
|
||||
auto msgHeader = rpc::CreateRpcMessageHeader(
|
||||
fbb, nullptr, rpc::RpcMessage::ResetRequest, resetReq.Union());
|
||||
auto resetReq = rpc::CreateResetRequest(fbb, rpc::ResetType::MOUNTING, 0, 0.f);
|
||||
auto msgHeader = rpc::CreateRpcMessageHeader(fbb, 0, 0, rpc::RpcMessage::ResetRequest, resetReq.Union());
|
||||
|
||||
auto rpcMsgs = fbb.CreateVector({ msgHeader });
|
||||
auto bundle = CreateMessageBundle(fbb, 0, rpcMsgs, 0);
|
||||
auto bundle = CreateMessageBundle(fbb, 0, rpcMsgs);
|
||||
fbb.Finish(bundle);
|
||||
conn.sendMsg(fbb);
|
||||
conn.SendMessage(fbb);
|
||||
}
|
||||
static void onFeetMountingCalibration(SolarXRConnection &conn) {
|
||||
static void OnFeetMountingCalibration(BridgeTransport& conn) {
|
||||
flatbuffers::FlatBufferBuilder fbb;
|
||||
|
||||
auto bodyParts = fbb.CreateVector(
|
||||
{ datatypes::BodyPart::LEFT_FOOT, datatypes::BodyPart::RIGHT_FOOT });
|
||||
auto resetReq = rpc::CreateResetRequest(fbb, rpc::ResetType::Mounting, bodyParts, 0.f);
|
||||
auto msgHeader = rpc::CreateRpcMessageHeader(
|
||||
fbb, nullptr, rpc::RpcMessage::ResetRequest, resetReq.Union());
|
||||
auto resetReq = rpc::CreateResetRequest(fbb, rpc::ResetType::MOUNTING, bodyParts, 0.f);
|
||||
auto msgHeader = rpc::CreateRpcMessageHeader(fbb, 0, 0, rpc::RpcMessage::ResetRequest, resetReq.Union());
|
||||
|
||||
auto rpcMsgs = fbb.CreateVector({ msgHeader });
|
||||
auto bundle = CreateMessageBundle(fbb, 0, rpcMsgs, 0);
|
||||
auto bundle = CreateMessageBundle(fbb, 0, rpcMsgs);
|
||||
fbb.Finish(bundle);
|
||||
conn.sendMsg(fbb);
|
||||
conn.SendMessage(fbb);
|
||||
}
|
||||
static void onToggleTracking(SolarXRConnection &conn) {
|
||||
static void OnToggleTracking(BridgeTransport& conn) {
|
||||
static bool shouldPause = false;
|
||||
flatbuffers::FlatBufferBuilder fbb;
|
||||
|
||||
shouldPause = !shouldPause;
|
||||
auto toggleReq = rpc::CreateSetPauseTrackingRequest(fbb, shouldPause);
|
||||
auto msgHeader = rpc::CreateRpcMessageHeader(
|
||||
fbb, nullptr, rpc::RpcMessage::SetPauseTrackingRequest,
|
||||
toggleReq.Union());
|
||||
auto msgHeader = rpc::CreateRpcMessageHeader(fbb, 0, 0, rpc::RpcMessage::SetPauseTrackingRequest, toggleReq.Union());
|
||||
|
||||
auto rpcMsgs = fbb.CreateVector({ msgHeader });
|
||||
auto bundle = CreateMessageBundle(fbb, 0, rpcMsgs, 0);
|
||||
auto bundle = CreateMessageBundle(fbb, 0, rpcMsgs);
|
||||
fbb.Finish(bundle);
|
||||
conn.sendMsg(fbb);
|
||||
conn.SendMessage(fbb);
|
||||
}
|
||||
|
||||
sig_atomic_t should_exit = 0;
|
||||
|
||||
static void signal_handler(int signal) {
|
||||
Logger::get().info("Received signal {}", signal);
|
||||
static void OnSignal(int signal) {
|
||||
Logger::Get().Info("Received signal {}", signal);
|
||||
should_exit = 1;
|
||||
}
|
||||
|
||||
int main() {
|
||||
auto &logger = Logger::get();
|
||||
// Steam and SteamVR sets these environment variables on applications that it
|
||||
// spawns, but if an app spawned by Steam then spawns a child that initialises
|
||||
// OpenVR, SteamVR will give the child the appkey of the root application it
|
||||
// is a descendant of, e.g. if SteamVR launches SlimeVR as an overlay,
|
||||
// it will set SteamAppId="3245490" and STEAMVR_APPKEY="steam.overlay.3245490"
|
||||
// which breaks our bindings. We want SteamVR to use a generated appkey if
|
||||
// possible.
|
||||
auto& logger = Logger::Get();
|
||||
|
||||
// Steam and SteamVR respectively set these environment variables on applications that
|
||||
// they spawn, which the SteamVR client library (vrclient) will then use as the
|
||||
// application key when initiating the connection with vrserver. This may not
|
||||
// be ideal if we are launched by another Steam or OpenVR application, as we will inherit
|
||||
// their app key through the environment, which means SteamVR will load the wrong bindings.
|
||||
// A real-world example of this is if someone uses an application such as OpenVR-Autostarter
|
||||
// to start the SlimeVR Server. OpenVR-Autostarter installs an application manifest with the
|
||||
// app key "dreiekk.openvr-autostarter", so when it starts SlimeVR Server, which then starts us,
|
||||
// the STEAMVR_APPKEY="dreiekk.openvr-autostarter" environment variable will be set.
|
||||
//
|
||||
// We want SteamVR to use the appkey of the Steam version of our application if possible.
|
||||
// Unfortunately, we cannot install an application vrmanifest to force the app key,
|
||||
// as SteamVR requires a binary path in the manifest to consider it valid. We do not want to install
|
||||
// a manifest with a binary path because we want the SlimeVR Server to start us when the
|
||||
// driver initiates a connection, rather than getting auto-started by SteamVR.
|
||||
//
|
||||
// This is not documented anywhere publicly, see CVRClient::SendConnectMessage in vrclient instead.
|
||||
|
||||
constexpr const char* STEAM_APPID = "3245490";
|
||||
constexpr const char* STEAMVR_APPKEY = "steam.overlay.3245490";
|
||||
|
||||
#ifdef _WIN32
|
||||
SetEnvironmentVariableA("SteamAppId", nullptr);
|
||||
SetEnvironmentVariableA("STEAMVR_APPKEY", nullptr);
|
||||
SetEnvironmentVariableA("SteamAppId", STEAM_APPID);
|
||||
SetEnvironmentVariableA("STEAMVR_APPKEY", STEAMVR_APPKEY);
|
||||
#else
|
||||
unsetenv("SteamAppId");
|
||||
unsetenv("STEAMVR_APPKEY");
|
||||
setenv("SteamAppId", STEAM_APPID, 1);
|
||||
setenv("STEAMVR_APPKEY", STEAMVR_APPKEY, 1);
|
||||
#endif
|
||||
|
||||
try {
|
||||
SolarXRConnection conn;
|
||||
std::unique_ptr<vr::IVRSystem, decltype(&shutdown_vr)> sys{ nullptr,
|
||||
shutdown_vr };
|
||||
BridgeClient conn(nullptr, nullptr, [] { should_exit = 1; }, [](std::exception&) { should_exit = 1; });
|
||||
conn.Start();
|
||||
|
||||
std::unique_ptr<vr::IVRSystem, decltype(&ShutdownVR)> sys{ nullptr, ShutdownVR };
|
||||
|
||||
// On vrlink, VR_Init returns
|
||||
// VRInitError_Driver_WirelessHmdNotConnected while the connection
|
||||
@@ -135,22 +146,19 @@ int main() {
|
||||
}
|
||||
|
||||
if (sys == nullptr or err != vr::VRInitError_None) {
|
||||
logger.error("Failed to init OpenVR: {} ({})",
|
||||
logger.Error("Failed to init OpenVR: {} ({})",
|
||||
vr::VR_GetVRInitErrorAsSymbol(err),
|
||||
vr::VR_GetVRInitErrorAsEnglishDescription(err));
|
||||
return 1;
|
||||
}
|
||||
|
||||
logger.info("Initialised OpenVR, HMD model '{}'",
|
||||
VRUtils::getStringProp(vr::k_unTrackedDeviceIndex_Hmd,
|
||||
vr::Prop_ModelNumber_String)
|
||||
.value_or("<unknown>"));
|
||||
logger.Info("Initialised OpenVR, HMD model '{}'", VRUtils::GetStringProp(vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_ModelNumber_String).value_or("<unknown>"));
|
||||
|
||||
vr::IVRApplications *app = vr::VRApplications();
|
||||
vr::IVRInput *input = vr::VRInput();
|
||||
vr::IVRApplications* app = vr::VRApplications();
|
||||
vr::IVRInput* input = vr::VRInput();
|
||||
|
||||
fs::path actionManifestPath;
|
||||
std::tie(std::ignore, actionManifestPath) = VRUtils::initialiseManifest();
|
||||
std::tie(std::ignore, actionManifestPath) = VRUtils::InitialiseManifests();
|
||||
|
||||
// We don't want our app key to randomly change if SteamVR decides to honour
|
||||
// application manifests with no binary path. Instead let it generate an
|
||||
@@ -167,21 +175,16 @@ int main() {
|
||||
// SetActionManifestPath may return IPCError if vrserver is busy and takes
|
||||
// too long to reply, so keep invoking until it succeeds
|
||||
{
|
||||
vr::EVRInputError err{};
|
||||
vr::EVRInputError err;
|
||||
constexpr int max_tries = 5;
|
||||
int tries = 0;
|
||||
while ((err = input->SetActionManifestPath(
|
||||
actionManifestPath.string().data()))
|
||||
== vr::VRInputError_IPCError
|
||||
&& tries++ < max_tries) {
|
||||
logger.debug("IPC error loading action manifest, retrying ({}/{})",
|
||||
tries, max_tries);
|
||||
while ((err = input->SetActionManifestPath(actionManifestPath.string().data())) == vr::VRInputError_IPCError && tries++ < max_tries) {
|
||||
logger.Debug("IPC error loading action manifest, retrying ({}/{})", tries, max_tries);
|
||||
std::this_thread::sleep_for(20ms);
|
||||
}
|
||||
|
||||
if (err != vr::VRInputError_None) {
|
||||
logger.error("Failed to set action manifest path: {}",
|
||||
std::to_underlying(err));
|
||||
logger.Error("Failed to set action manifest path: {}", std::to_underlying(err));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -189,74 +192,60 @@ int main() {
|
||||
vr::VRActionSetHandle_t action_set;
|
||||
if (auto err = input->GetActionSetHandle("/actions/main", &action_set);
|
||||
err != vr::VRInputError_None) {
|
||||
logger.error("Failed to get main action set handle: {}",
|
||||
std::to_underlying(err));
|
||||
logger.Error("Failed to get main action set handle: {}", std::to_underlying(err));
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::map<std::string, std::tuple<vr::VRActionHandle_t, std::function<void(SolarXRConnection &)>>>
|
||||
std::map<std::string, std::tuple<vr::VRActionHandle_t, std::function<void(BridgeTransport&)>>>
|
||||
actions{
|
||||
{ "/actions/main/in/YawReset",
|
||||
std::make_tuple(vr::k_ulInvalidActionHandle, onYawReset) },
|
||||
{ "/actions/main/in/FullReset",
|
||||
std::make_tuple(vr::k_ulInvalidActionHandle, onFullReset) },
|
||||
{ "/actions/main/in/MountingCalibration",
|
||||
std::make_tuple(vr::k_ulInvalidActionHandle,
|
||||
onMountingCalibration) },
|
||||
{ "/actions/main/in/FeetMountingCalibration",
|
||||
std::make_tuple(vr::k_ulInvalidActionHandle,
|
||||
onFeetMountingCalibration) },
|
||||
{ "/actions/main/in/ToggleTracking",
|
||||
std::make_tuple(vr::k_ulInvalidActionHandle, onToggleTracking) },
|
||||
{ "/actions/main/in/YawReset", std::make_tuple(vr::k_ulInvalidActionHandle, OnYawReset) },
|
||||
{ "/actions/main/in/FullReset", std::make_tuple(vr::k_ulInvalidActionHandle, OnFullReset) },
|
||||
{ "/actions/main/in/MountingCalibration", std::make_tuple(vr::k_ulInvalidActionHandle, OnMountingCalibration) },
|
||||
{ "/actions/main/in/FeetMountingCalibration", std::make_tuple(vr::k_ulInvalidActionHandle, OnFeetMountingCalibration) },
|
||||
{ "/actions/main/in/ToggleTracking", std::make_tuple(vr::k_ulInvalidActionHandle, OnToggleTracking) },
|
||||
};
|
||||
|
||||
for (auto &[name, tuple] : actions) {
|
||||
auto &[handle, _] = tuple;
|
||||
for (auto& [name, tuple] : actions) {
|
||||
auto& [handle, _] = tuple;
|
||||
if (auto err = input->GetActionHandle(name.c_str(), &handle);
|
||||
err != vr::VRInputError_None || handle == vr::k_ulInvalidActionHandle) {
|
||||
logger.warning("Failed to get action handle for action {}: {}", name,
|
||||
logger.Warning("Failed to get action handle for action {}: {}", name,
|
||||
std::to_underlying(err));
|
||||
}
|
||||
}
|
||||
|
||||
constexpr auto interval = 1000ms / 30;
|
||||
|
||||
signal(SIGINT, signal_handler);
|
||||
signal(SIGTERM, signal_handler);
|
||||
signal(SIGINT, OnSignal);
|
||||
signal(SIGTERM, OnSignal);
|
||||
while (!should_exit) {
|
||||
vr::VREvent_t event{};
|
||||
while (sys->PollNextEvent(&event, sizeof(event))) {
|
||||
switch (event.eventType) {
|
||||
case vr::VREvent_Quit:
|
||||
logger.info("OpenVR runtime requested quit");
|
||||
logger.Info("OpenVR runtime requested quit");
|
||||
should_exit = 1;
|
||||
break;
|
||||
case vr::VREvent_Input_BindingLoadFailed: {
|
||||
auto &loadData = event.data.inputBinding;
|
||||
logger.debug("Binding load failed (ulAppContainer={} "
|
||||
"pathMessage={} pathUrl={} pathControllerType={})",
|
||||
loadData.ulAppContainer, loadData.pathMessage,
|
||||
loadData.pathUrl, loadData.pathControllerType);
|
||||
auto& loadData = event.data.inputBinding;
|
||||
logger.Debug("Binding load failed (ulAppContainer={} pathMessage={} pathUrl={} pathControllerType={})",
|
||||
loadData.ulAppContainer, loadData.pathMessage, loadData.pathUrl, loadData.pathControllerType);
|
||||
break;
|
||||
}
|
||||
case vr::VREvent_Input_BindingLoadSuccessful: {
|
||||
auto &loadData = event.data.inputBinding;
|
||||
logger.debug("Binding load successful (ulAppContainer={} "
|
||||
"pathMessage={} pathUrl={} pathControllerType={})",
|
||||
loadData.ulAppContainer, loadData.pathMessage,
|
||||
loadData.pathUrl, loadData.pathControllerType);
|
||||
auto& loadData = event.data.inputBinding;
|
||||
logger.Debug("Binding load successful (ulAppContainer={} pathMessage={} pathUrl={} pathControllerType={})",
|
||||
loadData.ulAppContainer, loadData.pathMessage, loadData.pathUrl, loadData.pathControllerType);
|
||||
break;
|
||||
}
|
||||
case vr::VREvent_Input_ActionManifestReloaded:
|
||||
logger.debug("Action manifest reloaded");
|
||||
logger.Debug("Action manifest reloaded");
|
||||
break;
|
||||
case vr::VREvent_Input_ActionManifestLoadFailed: {
|
||||
auto &manifestData = event.data.actionManifest;
|
||||
logger.debug(
|
||||
"Action manifest load failed (pathAppKey={} pathMessage={} "
|
||||
"pathMessageParam={} pathManifestPath={})",
|
||||
manifestData.pathAppKey, manifestData.pathMessage,
|
||||
manifestData.pathMessageParam, manifestData.pathManifestPath);
|
||||
auto& manifestData = event.data.actionManifest;
|
||||
logger.Debug(
|
||||
"Action manifest load failed (pathAppKey={} pathMessage={} pathMessageParam={} pathManifestPath={})",
|
||||
manifestData.pathAppKey, manifestData.pathMessage, manifestData.pathMessageParam, manifestData.pathManifestPath);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -264,11 +253,6 @@ int main() {
|
||||
}
|
||||
}
|
||||
|
||||
if (!conn.connected()) {
|
||||
logger.warning("Connection to SlimeVR lost, exiting");
|
||||
break;
|
||||
}
|
||||
|
||||
vr::VRActiveActionSet_t set{
|
||||
.ulActionSet = action_set,
|
||||
.ulRestrictedToDevice = vr::k_ulInvalidInputValueHandle,
|
||||
@@ -277,39 +261,38 @@ int main() {
|
||||
};
|
||||
if (auto err = input->UpdateActionState(&set, sizeof(set), 1);
|
||||
err != vr::VRInputError_None) {
|
||||
logger.warning("Error when updating action states: {}",
|
||||
logger.Warning("Error when updating action states: {}",
|
||||
std::to_underlying(err));
|
||||
}
|
||||
|
||||
for (auto &[name, tuple] : actions) {
|
||||
auto &[handle, callback] = tuple;
|
||||
for (auto& [name, tuple] : actions) {
|
||||
auto& [handle, callback] = tuple;
|
||||
vr::InputDigitalActionData_t action_data{};
|
||||
if (auto err = input->GetDigitalActionData(
|
||||
handle, &action_data, sizeof(action_data),
|
||||
vr::k_ulInvalidInputValueHandle);
|
||||
err != vr::VRInputError_None) {
|
||||
logger.warning("Failed to get action state for {} ({}): {}", name,
|
||||
handle, std::to_underlying(err));
|
||||
logger.Warning("Failed to get action state for {} ({}): {}", name, handle, std::to_underlying(err));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (action_data.bActive && action_data.bChanged && action_data.bState) {
|
||||
logger.debug("Action {} triggered", name);
|
||||
logger.Debug("Action {} triggered", name);
|
||||
callback(conn);
|
||||
}
|
||||
}
|
||||
|
||||
logger.flush();
|
||||
logger.Flush();
|
||||
std::this_thread::sleep_for(interval);
|
||||
}
|
||||
|
||||
logger.info("Main loop done");
|
||||
} catch (std::exception &ex) {
|
||||
logger.error("Exception in main: {}", ex.what());
|
||||
logger.flush();
|
||||
logger.Info("Main loop done");
|
||||
} catch (std::exception& ex) {
|
||||
logger.Error("Exception in main: {}", ex.what());
|
||||
logger.Flush();
|
||||
return 1;
|
||||
}
|
||||
|
||||
logger.flush();
|
||||
logger.Flush();
|
||||
return 0;
|
||||
}
|
||||
@@ -1,15 +1,22 @@
|
||||
#include "paths.hpp"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOMINMAX
|
||||
#include <Windows.h>
|
||||
#undef GetTempPath
|
||||
#endif
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
fs::path Paths::getDataPath() {
|
||||
fs::path Paths::GetDataPath() {
|
||||
fs::path basePath{};
|
||||
|
||||
#if defined(__linux__)
|
||||
if (const char *dataHomeOverride = getenv("XDG_DATA_HOME")) {
|
||||
if (const char* dataHomeOverride = getenv("XDG_DATA_HOME")) {
|
||||
basePath = dataHomeOverride;
|
||||
} else {
|
||||
const char *homeDir = getenv("HOME");
|
||||
const char* homeDir = getenv("HOME");
|
||||
if (homeDir == nullptr)
|
||||
throw std::runtime_error("HOME is unset");
|
||||
|
||||
@@ -17,7 +24,7 @@ fs::path Paths::getDataPath() {
|
||||
}
|
||||
#elif defined(_WIN32)
|
||||
{
|
||||
const char *appData = getenv("APPDATA");
|
||||
const char* appData = getenv("APPDATA");
|
||||
if (appData == nullptr)
|
||||
throw std::runtime_error("APPDATA is unset");
|
||||
|
||||
@@ -30,4 +37,18 @@ fs::path Paths::getDataPath() {
|
||||
return basePath / "dev.slimevr.SlimeVR";
|
||||
}
|
||||
|
||||
fs::path Paths::getLogPath() { return Paths::getDataPath() / "logs"; }
|
||||
fs::path Paths::GetLogPath() { return Paths::GetDataPath() / "logs"; }
|
||||
|
||||
fs::path Paths::GetTempPath() noexcept {
|
||||
#ifdef _WIN32
|
||||
WCHAR tmp_dir[MAX_PATH + 1];
|
||||
GetTempPathW(std::size(tmp_dir), tmp_dir);
|
||||
return tmp_dir;
|
||||
#else
|
||||
if (const char* tmp_dir = getenv("TMPDIR")) {
|
||||
return tmp_dir;
|
||||
}
|
||||
|
||||
return "/tmp";
|
||||
#endif
|
||||
}
|
||||
@@ -4,8 +4,10 @@
|
||||
|
||||
namespace Paths {
|
||||
// Throws when path cannot be found
|
||||
std::filesystem::path getDataPath() noexcept(false);
|
||||
std::filesystem::path GetDataPath() noexcept(false);
|
||||
|
||||
// Throws when path cannot be found
|
||||
std::filesystem::path getLogPath() noexcept(false);
|
||||
std::filesystem::path GetLogPath() noexcept(false);
|
||||
|
||||
std::filesystem::path GetTempPath() noexcept;
|
||||
} // namespace Paths
|
||||
@@ -1,163 +0,0 @@
|
||||
#include "solarxr.hpp"
|
||||
#include "logger.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#if defined(__linux__)
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#elif defined(_WIN32)
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#error "Unsupported platform"
|
||||
#endif
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
fs::path SolarXRConnection::getSocketPath() {
|
||||
using namespace std::string_view_literals;
|
||||
#if defined(__linux__)
|
||||
#define MAKE_SOCKET_PATH(PATH) \
|
||||
std::make_pair(PATH##sv, static_cast<const char *>(getenv(PATH)))
|
||||
|
||||
constexpr std::string_view socketName = "SlimeVRRpc";
|
||||
std::array<std::pair<std::string_view, const char *>, 4> socketPaths{
|
||||
MAKE_SOCKET_PATH("SLIMEVR_SOCKET_DIR"),
|
||||
MAKE_SOCKET_PATH("XDG_RUNTIME_DIR"),
|
||||
MAKE_SOCKET_PATH("TMPDIR"),
|
||||
{ "/tmp", "/tmp" }
|
||||
};
|
||||
|
||||
#undef MAKE_SOCKET_PATH
|
||||
|
||||
for (auto [name, path] : socketPaths) {
|
||||
if (path == nullptr) {
|
||||
Logger::get().info(
|
||||
"Skipping socket directory {} because it doesn't exist", name);
|
||||
continue;
|
||||
}
|
||||
fs::path socketPath = fs::path(path) / socketName;
|
||||
if (fs::exists(socketPath))
|
||||
return socketPath;
|
||||
|
||||
Logger::get().info(
|
||||
"Skipping socket directory {} because socket does not exist", name);
|
||||
}
|
||||
#elif defined(_WIN32)
|
||||
throw std::logic_error(
|
||||
"SolarXRConnection::getSocketPath should not be called on Windows");
|
||||
#else
|
||||
#error "Unsupported platform"
|
||||
#endif
|
||||
|
||||
throw std::runtime_error("Failed to find socket directory");
|
||||
}
|
||||
|
||||
SolarXRConnection::SolarXRConnection() {
|
||||
#if defined(__linux__)
|
||||
sockaddr_un addr{};
|
||||
addr.sun_family = AF_UNIX;
|
||||
strcpy(addr.sun_path, getSocketPath().string().data());
|
||||
|
||||
fd = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
if (fd == -1) {
|
||||
throw std::runtime_error(
|
||||
std::format("Failed to create listen socket: {}", strerror(errno)));
|
||||
}
|
||||
|
||||
if (connect(fd, reinterpret_cast<sockaddr *>(&addr), sizeof(addr)) == -1) {
|
||||
int e = errno;
|
||||
close(fd);
|
||||
throw std::runtime_error(std::format("Failed to connect to socket {}: {}",
|
||||
addr.sun_path, strerror(e)));
|
||||
}
|
||||
|
||||
#elif defined(_WIN32)
|
||||
const char *pipeName = R"(\\.\pipe\SlimeVRRpc)";
|
||||
if (!WaitNamedPipe(pipeName, 5000)) {
|
||||
throw std::runtime_error("Timed out waiting for pipe");
|
||||
}
|
||||
|
||||
pipe = CreateFile(pipeName, GENERIC_READ | GENERIC_WRITE, 0, nullptr,
|
||||
OPEN_EXISTING, 0, nullptr);
|
||||
if (pipe == INVALID_HANDLE_VALUE) {
|
||||
throw std::runtime_error(
|
||||
std::format("Unable to open pipe (error={})", GetLastError()));
|
||||
}
|
||||
#else
|
||||
#error "Unsupported platform"
|
||||
#endif
|
||||
}
|
||||
|
||||
SolarXRConnection::~SolarXRConnection() {
|
||||
#if defined(__linux__)
|
||||
if (fd != -1)
|
||||
close(fd);
|
||||
#elif defined(_WIN32)
|
||||
if (pipe != INVALID_HANDLE_VALUE)
|
||||
CloseHandle(pipe);
|
||||
#else
|
||||
#error "Unsupported platform"
|
||||
#endif
|
||||
}
|
||||
|
||||
bool SolarXRConnection::connected() {
|
||||
#if defined(__linux__)
|
||||
if (read(fd, nullptr, 0) == -1) {
|
||||
return !(errno == EBADF || errno == EINVAL);
|
||||
}
|
||||
|
||||
return true;
|
||||
#elif defined(_WIN32)
|
||||
if (!WriteFile(pipe, nullptr, 0, nullptr, nullptr)) {
|
||||
int err = GetLastError();
|
||||
// The documentation says it should return ERROR_BROKEN_PIPE
|
||||
// when the write-end has been closed, but it seems to actually
|
||||
// return ERROR_NO_DATA...
|
||||
return !(err == ERROR_NO_DATA || err == ERROR_BROKEN_PIPE);
|
||||
}
|
||||
|
||||
return true;
|
||||
#else
|
||||
#error "Unsupported platform"
|
||||
#endif
|
||||
}
|
||||
|
||||
void SolarXRConnection::sendMsg(flatbuffers::FlatBufferBuilder &fbb) {
|
||||
// The server expects the total size of the buffer to be written at the
|
||||
// start of the packet, including the first 4 bytes for the size
|
||||
int size = fbb.GetSize() + 4;
|
||||
// This may be wrong on mixed-endianness, but oh well...
|
||||
if constexpr (std::endian::native != std::endian::little)
|
||||
size = std::byteswap(size);
|
||||
|
||||
#if defined(__linux__)
|
||||
if (write(fd, &size, sizeof(size)) == -1) {
|
||||
Logger::get().warning("Failed to write message size to socket: {}",
|
||||
strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
if (write(fd, fbb.GetBufferPointer(), fbb.GetSize()) == -1) {
|
||||
Logger::get().warning("Failed to write message to socket: {}",
|
||||
strerror(errno));
|
||||
return;
|
||||
}
|
||||
#elif defined(_WIN32)
|
||||
uint8_t tempBuf[2048];
|
||||
if (fbb.GetSize() > 2048 - 4) {
|
||||
Logger::get().warning("Message is too big for temporary buffer");
|
||||
return;
|
||||
}
|
||||
|
||||
*reinterpret_cast<int *>(&tempBuf[0]) = size;
|
||||
memcpy(&tempBuf[4], fbb.GetBufferPointer(), fbb.GetSize());
|
||||
if (!WriteFile(pipe, tempBuf, fbb.GetSize() + 4, nullptr, nullptr)) {
|
||||
Logger::get().warning("Failed to write message to pipe (error={})",
|
||||
GetLastError());
|
||||
return;
|
||||
}
|
||||
#else
|
||||
#error "Unsupported platform"
|
||||
#endif
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define WIN32_MEAN_AND_LEAN
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
#include "flatbuffers/flatbuffer_builder.h"
|
||||
|
||||
class SolarXRConnection {
|
||||
private:
|
||||
#if defined(__linux__)
|
||||
int fd{ -1 };
|
||||
#elif defined(_WIN32)
|
||||
HANDLE pipe{ INVALID_HANDLE_VALUE };
|
||||
#else
|
||||
#error "Unsupported platform"
|
||||
#endif
|
||||
|
||||
static std::filesystem::path getSocketPath();
|
||||
|
||||
public:
|
||||
SolarXRConnection() noexcept(false);
|
||||
|
||||
~SolarXRConnection();
|
||||
|
||||
bool connected();
|
||||
void sendMsg(flatbuffers::FlatBufferBuilder &fbb);
|
||||
};
|
||||
@@ -11,14 +11,14 @@
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
std::optional<std::string>
|
||||
VRUtils::getStringProp(vr::TrackedDeviceIndex_t deviceIndex,
|
||||
VRUtils::GetStringProp(vr::TrackedDeviceIndex_t deviceIndex,
|
||||
vr::ETrackedDeviceProperty prop) {
|
||||
vr::IVRSystem *sys = vr::VRSystem();
|
||||
vr::IVRSystem* sys = vr::VRSystem();
|
||||
vr::ETrackedPropertyError err{ vr::TrackedProp_Success };
|
||||
|
||||
uint32_t required_len = sys->GetStringTrackedDeviceProperty(deviceIndex, prop, nullptr, 0, &err);
|
||||
if (err != vr::TrackedProp_BufferTooSmall) {
|
||||
Logger::get().info(
|
||||
Logger::Get().Info(
|
||||
"Failed to get size of string property {} for device {}: {}",
|
||||
std::to_underlying(prop), deviceIndex,
|
||||
sys->GetPropErrorNameFromEnum(err));
|
||||
@@ -29,7 +29,7 @@ VRUtils::getStringProp(vr::TrackedDeviceIndex_t deviceIndex,
|
||||
sys->GetStringTrackedDeviceProperty(deviceIndex, prop, s.data(), required_len,
|
||||
&err);
|
||||
if (err != vr::TrackedProp_Success) {
|
||||
Logger::get().info("Failed to get string property {} for device {}: {}",
|
||||
Logger::Get().Info("Failed to get string property {} for device {}: {}",
|
||||
std::to_underlying(prop), deviceIndex,
|
||||
sys->GetPropErrorNameFromEnum(err));
|
||||
return std::nullopt;
|
||||
@@ -38,8 +38,8 @@ VRUtils::getStringProp(vr::TrackedDeviceIndex_t deviceIndex,
|
||||
return s;
|
||||
}
|
||||
|
||||
std::tuple<fs::path, fs::path> VRUtils::initialiseManifest() {
|
||||
fs::path manifestDir = Paths::getDataPath() / "bindings-provider";
|
||||
std::tuple<fs::path, fs::path> VRUtils::InitialiseManifests() {
|
||||
fs::path manifestDir = Paths::GetDataPath() / "bindings-provider";
|
||||
std::error_code ec;
|
||||
fs::create_directories(manifestDir, ec);
|
||||
if (ec) {
|
||||
@@ -59,7 +59,7 @@ std::tuple<fs::path, fs::path> VRUtils::initialiseManifest() {
|
||||
std::make_pair("vive_controller.json"sv, SVR_VRAPP_VIVE_BINDS),
|
||||
};
|
||||
|
||||
for (auto &[name, contents] : requiredFiles) {
|
||||
for (auto& [name, contents] : requiredFiles) {
|
||||
fs::path path = manifestDir / name;
|
||||
if (!fs::exists(path)) {
|
||||
std::ofstream stream(path);
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#include "openvr.h"
|
||||
|
||||
namespace VRUtils {
|
||||
std::optional<std::string> getStringProp(vr::TrackedDeviceIndex_t deviceIndex,
|
||||
std::optional<std::string> GetStringProp(vr::TrackedDeviceIndex_t deviceIndex,
|
||||
vr::ETrackedDeviceProperty prop);
|
||||
|
||||
// Returns <app vrmanifest path, action manifest json path>
|
||||
std::tuple<std::filesystem::path, std::filesystem::path> initialiseManifest();
|
||||
std::tuple<std::filesystem::path, std::filesystem::path> InitialiseManifests();
|
||||
} // namespace VRUtils
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
# Crowdin Configuration File
|
||||
# https://developer.crowdin.com/configuration-file/
|
||||
|
||||
files:
|
||||
- source: /gui/app/public/i18n/en/translation.ftl
|
||||
translation: /gui/app/public/i18n/%locale%/%original_file_name%
|
||||
update_option: update_as_unapproved
|
||||
languages_mapping:
|
||||
locale:
|
||||
zh-CN: zh-Hans
|
||||
zh-TW: zh-Hant
|
||||
nb: nb-NO
|
||||
sv: sv-SE
|
||||
fr: fr
|
||||
de: de
|
||||
it: it
|
||||
ja: ja
|
||||
ko: ko
|
||||
ar: ar
|
||||
cs: cs
|
||||
da: da
|
||||
el: el
|
||||
es-419: es-419
|
||||
et: et
|
||||
fi: fi
|
||||
he: he
|
||||
lt: lt
|
||||
nl: nl
|
||||
pl: pl
|
||||
ru: ru
|
||||
th: th
|
||||
tr: tr
|
||||
uk: uk
|
||||
vi: vi
|
||||
# In-context editor pseudo-language
|
||||
ach-UG: ach-UG
|
||||
Generated
+10
-27
@@ -5,11 +5,11 @@
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1778716662,
|
||||
"narHash": "sha256-m1Yf0wZ8j1OHjTc2UwHwyQRSnNeSgLJOd7q5Y45hzi4=",
|
||||
"lastModified": 1790898470,
|
||||
"narHash": "sha256-zTwuwezD0w3hpga6a6P8emidzAZFyWqlNeRBlpWOOl8=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "f7c1a2d347e4c52d5fb8d10cb4d94b5884e546fb",
|
||||
"rev": "024633cd702b10285db5cb19b40ad48d2399ba60",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -20,11 +20,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1781577229,
|
||||
"narHash": "sha256-lrp67w8AulE9Ks53n27I45ADSzbOCn4H+CNW1Ck8B+8=",
|
||||
"lastModified": 1790822859,
|
||||
"narHash": "sha256-69xHQhAeMAD2wDXO7T2pcOZIF9Sga2W+JkmY2a11Ops=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "567a49d1913ce81ac6e9582e3553dd90a955875f",
|
||||
"rev": "c59305bab2065cfecc4944690d9eedbb56f3a9fa",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -34,29 +34,13 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-jdk24": {
|
||||
"locked": {
|
||||
"lastModified": 1756787288,
|
||||
"narHash": "sha256-rw/PHa1cqiePdBxhF66V7R+WAP8WekQ0mCDG4CFqT8Y=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d0fc30899600b9b3466ddb260fd83deb486c32f1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d0fc30899600b9b3466ddb260fd83deb486c32f1",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"lastModified": 1777168982,
|
||||
"narHash": "sha256-GOkGPcboWE9BmGCRMLX3worL4EMnsnG8MyKmXNeYuhQ=",
|
||||
"lastModified": 1790477367,
|
||||
"narHash": "sha256-oujbxmVKDhci2E4EM3KyAbRUgp5/IsCoiA/LfEF7OOk=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"rev": "f5901329dade4a6ea039af1433fb087bd9c1fe14",
|
||||
"rev": "f7cd230690d9fc982d06129f9189b101fddcfa3b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -68,8 +52,7 @@
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-jdk24": "nixpkgs-jdk24"
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
# Pinned to a revision that still ships temurin jdk-24
|
||||
nixpkgs-jdk24.url = "github:NixOS/nixpkgs/d0fc30899600b9b3466ddb260fd83deb486c32f1";
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
};
|
||||
|
||||
@@ -12,7 +10,6 @@
|
||||
inputs@{
|
||||
self,
|
||||
nixpkgs,
|
||||
nixpkgs-jdk24,
|
||||
flake-parts,
|
||||
...
|
||||
}:
|
||||
@@ -30,8 +27,6 @@
|
||||
...
|
||||
}:
|
||||
let
|
||||
java = (import nixpkgs-jdk24 { inherit system; }).jdk24;
|
||||
|
||||
runtimeLibs = [
|
||||
pkgs.alsa-lib
|
||||
pkgs.libpulseaudio
|
||||
@@ -69,68 +64,59 @@
|
||||
pkgs.libxcrypt-legacy
|
||||
];
|
||||
|
||||
toolDirectoryName =
|
||||
if pkgs.stdenv.hostPlatform.isDarwin then
|
||||
"darwin"
|
||||
else if pkgs.stdenv.hostPlatform.isLinux then
|
||||
{
|
||||
"armv7l-linux" = "linux-arm32";
|
||||
"aarch64-linux" = "linux-arm64";
|
||||
"i686-linux" = "linux-ia32";
|
||||
"x86_64-linux" = "linux-x64";
|
||||
}
|
||||
."${pkgs.stdenv.hostPlatform.system}"
|
||||
else
|
||||
throw "Unsupported platform";
|
||||
|
||||
# we use fuse2
|
||||
# we use static runtime
|
||||
# https://github.com/electron-userland/electron-builder/blob/a6117b3011a105204af8cc2eca02a56976d1ef29/packages/app-builder-lib/src/toolsets/linux.ts#L122
|
||||
runtime = pkgs.stdenvNoCC.mkDerivation {
|
||||
appImageTools = pkgs.stdenvNoCC.mkDerivation {
|
||||
name = "electron-builder-appimage-runtime";
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://github.com/electron-userland/electron-builder-binaries/releases/download/appimage-12.0.1/appimage-12.0.1.7z";
|
||||
hash = "sha256-0S/3648dHsRlLKUjen+9yjOswMdYBFY2/spi3G7LjsQ=";
|
||||
};
|
||||
# https://github.com/NixOS/nixpkgs/blob/7890ba0a99c064446fe2178ef2f8e3abdf6ec42a/pkgs/by-name/lo/losslesscut-bin/build-from-windows.nix#L20
|
||||
nativeBuildInputs = [ pkgs.p7zip ];
|
||||
unpackPhase = ''
|
||||
runHook preUnpack
|
||||
7z x "$src"
|
||||
runHook postUnpack
|
||||
'';
|
||||
src =
|
||||
let
|
||||
# Keep in sync with "appimage" toolset version in gui/electron/electron-builder.yml
|
||||
appimageToolsVersion = "1.0.3";
|
||||
in
|
||||
pkgs.fetchzip {
|
||||
url = "https://github.com/electron-userland/electron-builder-binaries/releases/download/appimage@${appimageToolsVersion}/appimage-tools-runtime-20251108.tar.gz";
|
||||
hash = "sha256-Iqhvyp6BNpH+tXvVO7MLgYbsJ6va4lXO7El3wtyWBII=";
|
||||
stripRoot = false;
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
mkdir $out
|
||||
cp -r -t $out/ \
|
||||
lib/ \
|
||||
runtime-*
|
||||
cp -r -t $out/ lib/ runtimes/
|
||||
ln -s -t $out \
|
||||
"${pkgs.desktop-file-utils}/bin/desktop-file-validate" \
|
||||
"${pkgs.squashfsTools}/bin/mksquashfs"
|
||||
'';
|
||||
};
|
||||
|
||||
appImageTools = pkgs.stdenvNoCC.mkDerivation {
|
||||
name = "electron-builder-appimage-tools";
|
||||
dontUnpack = true;
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p "$out/${toolDirectoryName}"
|
||||
ln -s -t $out/${toolDirectoryName} \
|
||||
"${pkgs.desktop-file-utils}/bin/desktop-file-validate" \
|
||||
"${pkgs.squashfsTools}/bin/mksquashfs"
|
||||
ln -s ${runtime}/runtime-* $out/
|
||||
ln -s ${runtime}/lib $out/lib
|
||||
'';
|
||||
buildToolsVersion = "36.0.0";
|
||||
androidComposition = pkgs.androidenv.composeAndroidPackages {
|
||||
buildToolsVersions = [
|
||||
buildToolsVersion
|
||||
];
|
||||
platformVersions = [
|
||||
"36"
|
||||
];
|
||||
};
|
||||
in
|
||||
{
|
||||
devShells.default = pkgs.mkShell {
|
||||
# For Android SDK
|
||||
_module.args.pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
config.android_sdk.accept_license = true;
|
||||
};
|
||||
|
||||
devShells.default = pkgs.mkShell rec {
|
||||
packages = [
|
||||
# for running the jar
|
||||
java
|
||||
pkgs.jdk25
|
||||
|
||||
# for build
|
||||
pkgs.electron
|
||||
pkgs.rpm
|
||||
pkgs.fpm
|
||||
pkgs.p7zip
|
||||
# For Windows GUI cross-build
|
||||
pkgs.wineWow64Packages.stable
|
||||
pkgs.zlib
|
||||
pkgs.squashfsTools
|
||||
@@ -147,20 +133,10 @@
|
||||
pkgs.binutils
|
||||
pkgs.git
|
||||
pkgs.node-gyp-build
|
||||
androidComposition.androidsdk
|
||||
];
|
||||
buildInputs = runtimeLibs;
|
||||
|
||||
JAVA_HOME = "${java}/lib/openjdk";
|
||||
USE_SYSTEM_FPM = "true";
|
||||
ELECTRON_BUILDER_7ZIP_PATH = "${pkgs.p7zip}/bin/7za";
|
||||
APPIMAGE_TOOLS_PATH = "${appImageTools}";
|
||||
#ELECTRON_SKIP_BINARY_DOWNLOAD = true;
|
||||
#ELECTRON_DIST = "${pkgs.electron.dist}";
|
||||
#ELECTRON_VERSION = "${pkgs.electron.version}";
|
||||
|
||||
# for electron-vite, so `pnpm gui` works
|
||||
ELECTRON_EXEC_PATH = "${pkgs.electron}/bin/electron";
|
||||
|
||||
shellHook = ''
|
||||
export LD_LIBRARY_PATH="${
|
||||
lib.makeLibraryPath [
|
||||
@@ -168,7 +144,21 @@
|
||||
pkgs.hidapi
|
||||
]
|
||||
}:$LD_LIBRARY_PATH"
|
||||
|
||||
# VSCode's extension host sets ELECTRON_RUN_AS_NODE=1 on itself, and
|
||||
# shells it forks inherit it. It makes electron run as plain node, so
|
||||
# the main process crashes on `import { app } from 'electron'`.
|
||||
unset ELECTRON_RUN_AS_NODE
|
||||
'';
|
||||
|
||||
JAVA_HOME = "${pkgs.jdk25}/lib/openjdk";
|
||||
USE_SYSTEM_FPM = "true";
|
||||
ELECTRON_BUILDER_7ZIP_PATH = "${pkgs.p7zip}/bin/7za";
|
||||
APPIMAGE_TOOLS_PATH = "${appImageTools}";
|
||||
# for electron-vite, so `pnpm gui` works
|
||||
ELECTRON_EXEC_PATH = "${pkgs.electron}/bin/electron";
|
||||
ANDROID_HOME = "${androidComposition.androidsdk}/libexec/android-sdk";
|
||||
GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${ANDROID_HOME}/build-tools/${buildToolsVersion}/aapt2";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
+12
-2
@@ -1,20 +1,30 @@
|
||||
# Fixes bug with spotless. See https://github.com/diffplug/spotless/issues/834#issuecomment-819118761
|
||||
org.gradle.jvmargs=--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
|
||||
org.gradle.jvmargs=-Xmx4g -Xms1g \
|
||||
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
|
||||
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
|
||||
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
|
||||
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
|
||||
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
|
||||
|
||||
org.gradle.parallel=true
|
||||
#org.gradle.caching=true
|
||||
org.gradle.configureondemand=true
|
||||
|
||||
kotlin.code.style=official
|
||||
# https://github.com/Kotlin/kotlinx-atomicfu#atomicfu-compiler-plugin
|
||||
kotlinx.atomicfu.enableJvmIrTransformation=true
|
||||
|
||||
android.useAndroidX=true
|
||||
android.nonTransitiveRClass=true
|
||||
org.gradle.unsafe.configuration-cache=false
|
||||
#org.gradle.configuration-cache=true
|
||||
# solarxr-protocol:kotlin-codegen's generateTestSchemas isn't cache-compatible yet (submodule); degrade to a warning there instead of failing the whole build
|
||||
#org.gradle.configuration-cache.problems=warn
|
||||
|
||||
kotlinVersion=2.3.10
|
||||
spotlessVersion=8.2.1
|
||||
shadowJarVersion=9.3.1
|
||||
buildconfigVersion=6.0.7
|
||||
wireVersion=5.3.1
|
||||
# sentry and sentry-android-core must stay on the same version
|
||||
sentryVersion=8.+
|
||||
sentryAndroidGradleVersion=6.23.0
|
||||
+7
-7
@@ -1,16 +1,16 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# JS/TS dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
node_modules/
|
||||
.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
coverage/
|
||||
|
||||
# Build artifacts
|
||||
/build
|
||||
/target
|
||||
build/
|
||||
target/
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
@@ -26,8 +26,8 @@ yarn-error.log*
|
||||
*.log
|
||||
|
||||
# vite
|
||||
/dist
|
||||
/stats.html
|
||||
dist/
|
||||
stats.html
|
||||
vite.config.ts.timestamp*
|
||||
electron.vite.config.*.mjs
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export default {
|
||||
'**/*.{ts,tsx}': () => 'tsc -p tsconfig.json --noEmit',
|
||||
'{electron,src}/**/*.{js,jsx,ts,tsx}': 'eslint --max-warnings=0 --no-warn-ignored --cache --fix',
|
||||
'app/**/*.{js,jsx,ts,tsx}':
|
||||
'pnpm --filter @slimevr/gui-app exec eslint --no-warn-ignored --cache --fix',
|
||||
'**/*.{js,jsx,ts,tsx,css,scss,md,json}': 'prettier --write',
|
||||
};
|
||||
@@ -0,0 +1,213 @@
|
||||
import eslint from '@eslint/js';
|
||||
import betterTailwind from 'eslint-plugin-better-tailwindcss';
|
||||
import boundaries from 'eslint-plugin-boundaries';
|
||||
import jsxA11y from 'eslint-plugin-jsx-a11y';
|
||||
import solid from 'eslint-plugin-solid/configs/typescript';
|
||||
import globals from 'globals';
|
||||
import tseslint from 'typescript-eslint';
|
||||
import l10n from './eslint/l10n.js';
|
||||
import layers from './eslint/layers.js';
|
||||
|
||||
const UI_DEEP_IMPORT = {
|
||||
group: ['@/ui/*/*'],
|
||||
message: 'Import a ui folder through its index, e.g. @/ui/select.',
|
||||
};
|
||||
|
||||
// Each entry is allowed only in the files listed in `allowedIn`
|
||||
const restricted = {
|
||||
toFixed: {
|
||||
allowedIn: ['src/lib/format.ts'],
|
||||
selector: "CallExpression[callee.property.name='toFixed']",
|
||||
message: 'Use fmt() from @/lib/format, it is locale aware.',
|
||||
},
|
||||
intl: {
|
||||
allowedIn: ['src/lib/format.ts'],
|
||||
selector: "NewExpression[callee.object.name='Intl']",
|
||||
message: 'Use fmt/fmtList/fmtRelative from @/lib/format, they cache per locale.',
|
||||
},
|
||||
storage: {
|
||||
allowedIn: ['src/lib/storage.ts', 'src/lib/storage.test.ts'],
|
||||
selector: 'Identifier[name=/^(localStorage|sessionStorage)$/]',
|
||||
message: 'Use definePref/defineCache/defineSession from @/lib/storage.',
|
||||
},
|
||||
electronApi: {
|
||||
allowedIn: ['src/app/platform/**'],
|
||||
selector: "MemberExpression[property.name='electronAPI']",
|
||||
message: 'Use platform from @/lib/platform.',
|
||||
},
|
||||
keydown: {
|
||||
allowedIn: ['src/lib/keyboard.ts', 'src/ui/motion/**'],
|
||||
selector:
|
||||
"CallExpression[callee.property.name='addEventListener'][arguments.0.value=/^key(down|up)$/]",
|
||||
message:
|
||||
'Use useShortcut from @/lib/keyboard, Escape goes to the back stack (useBack).',
|
||||
},
|
||||
android: {
|
||||
allowedIn: ['src/app/platform/**', 'src/env.d.ts'],
|
||||
selector: "Identifier[name='__ANDROID__']",
|
||||
message: 'Use platform from @/lib/platform.',
|
||||
},
|
||||
};
|
||||
|
||||
function allow(from, to) {
|
||||
return {
|
||||
from: { element: { type: from } },
|
||||
allow: { to: { element: { type: to } } },
|
||||
};
|
||||
}
|
||||
|
||||
function restrictedSyntax(except = []) {
|
||||
return [
|
||||
'error',
|
||||
...Object.entries(restricted)
|
||||
.filter(([name]) => !except.includes(name))
|
||||
.map(([, { selector, message }]) => ({ selector, message })),
|
||||
];
|
||||
}
|
||||
|
||||
function restrictedOverrides() {
|
||||
const byPattern = new Map();
|
||||
for (const [name, { allowedIn }] of Object.entries(restricted)) {
|
||||
for (const pattern of allowedIn) {
|
||||
byPattern.set(pattern, [...(byPattern.get(pattern) ?? []), name]);
|
||||
}
|
||||
}
|
||||
return [...byPattern].map(([pattern, names]) => ({
|
||||
files: [pattern],
|
||||
rules: { 'no-restricted-syntax': restrictedSyntax(names) },
|
||||
}));
|
||||
}
|
||||
|
||||
export default tseslint.config(
|
||||
eslint.configs.recommended,
|
||||
...tseslint.configs.recommended,
|
||||
{
|
||||
files: ['src/**/*.{ts,tsx}'],
|
||||
...solid,
|
||||
languageOptions: {
|
||||
parser: tseslint.parser,
|
||||
parserOptions: { projectService: true, tsconfigRootDir: import.meta.dirname },
|
||||
globals: globals.browser,
|
||||
},
|
||||
plugins: {
|
||||
...solid.plugins,
|
||||
boundaries,
|
||||
l10n,
|
||||
},
|
||||
settings: {
|
||||
'import/resolver': {
|
||||
typescript: { alwaysTryTypes: true, project: './tsconfig.json' },
|
||||
},
|
||||
'boundaries/include': ['src/**/*'],
|
||||
'boundaries/elements': [
|
||||
{ type: 'app', pattern: 'src/app' },
|
||||
{ type: 'ui', pattern: 'src/ui' },
|
||||
{ type: 'lib', pattern: 'src/lib' },
|
||||
{ type: 'solarxr', pattern: 'src/solarxr' },
|
||||
{ type: 'domain', pattern: 'src/domain/*', capture: ['concept'] },
|
||||
{ type: 'pages', pattern: 'src/pages/*', capture: ['page'] },
|
||||
{ type: 'assets', pattern: 'src/assets' },
|
||||
],
|
||||
},
|
||||
rules: {
|
||||
...solid.rules,
|
||||
// External packages and imports inside one element (same page, same concept) are not checked
|
||||
'boundaries/dependencies': [
|
||||
'error',
|
||||
{
|
||||
default: 'disallow',
|
||||
policies: [
|
||||
allow('app', ['app', 'ui', 'lib', 'solarxr', 'domain', 'pages', 'assets']),
|
||||
allow('pages', ['ui', 'lib', 'solarxr', 'domain', 'assets']),
|
||||
allow('domain', ['ui', 'lib', 'solarxr', 'domain', 'assets']),
|
||||
allow('solarxr', ['lib', 'solarxr']),
|
||||
allow('ui', ['ui', 'lib', 'assets']),
|
||||
allow('assets', ['lib']),
|
||||
],
|
||||
},
|
||||
],
|
||||
'l10n/message-id': 'error',
|
||||
'no-throw-literal': 'error',
|
||||
'no-duplicate-imports': 'error',
|
||||
'no-restricted-syntax': restrictedSyntax(),
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'warn',
|
||||
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_', ignoreRestSiblings: true },
|
||||
],
|
||||
},
|
||||
},
|
||||
...restrictedOverrides(),
|
||||
{
|
||||
files: ['src/lib/**/*.{ts,tsx}'],
|
||||
plugins: { layers },
|
||||
rules: { 'layers/no-jsx': 'error' },
|
||||
},
|
||||
// Peer range stops at ESLint 9 but the rules only read JSX attributes
|
||||
{ files: ['src/**/*.tsx'], ...jsxA11y.flatConfigs.recommended },
|
||||
// Long class strings wrap into a multiline template literal, fixed by lint:fix
|
||||
{
|
||||
files: ['src/**/*.tsx'],
|
||||
plugins: { 'better-tailwindcss': betterTailwind },
|
||||
settings: { 'better-tailwindcss': { entryPoint: 'src/styles.css' } },
|
||||
rules: {
|
||||
'better-tailwindcss/enforce-consistent-line-wrapping': [
|
||||
'error',
|
||||
// Packed lines, no line per variant group. Wider than prettier so
|
||||
// only really long strings wrap at JSX indentation depth.
|
||||
{
|
||||
printWidth: 100,
|
||||
group: 'never',
|
||||
preferSingleLine: true,
|
||||
strictness: 'loose',
|
||||
},
|
||||
],
|
||||
// The type scale is the text tokens in styles.css, nothing else
|
||||
'better-tailwindcss/no-restricted-classes': [
|
||||
'error',
|
||||
{
|
||||
restrict: [
|
||||
{
|
||||
pattern: '^(?:.*:)?!?text-[\\[(].*$',
|
||||
message: 'No arbitrary text values, use text-standard, text-section or text-title.',
|
||||
},
|
||||
{
|
||||
pattern: '^(?:.*:)?!?text-(?:xs|sm|base|lg|xl|\\dxl)$',
|
||||
message: 'Tailwind sizes are removed, use text-standard, text-section or text-title.',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
// Solid compiles `ref={x}` into an assignment the rule cannot see
|
||||
{ files: ['src/**/*.tsx'], rules: { 'no-unassigned-vars': 'off' } },
|
||||
// Motion hooks belong to ui primitives, pages only use the containers
|
||||
{
|
||||
files: ['src/**/*.{ts,tsx}'],
|
||||
ignores: ['src/ui/**'],
|
||||
rules: {
|
||||
'no-restricted-imports': [
|
||||
'error',
|
||||
{
|
||||
paths: [
|
||||
{
|
||||
name: '@/ui/motion',
|
||||
importNames: ['useMotionItem'],
|
||||
message: 'Only ui primitives register motion items.',
|
||||
},
|
||||
],
|
||||
patterns: [UI_DEEP_IMPORT],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
// Each ui folder is entered through its index; files inside it import each other relatively
|
||||
{
|
||||
files: ['src/ui/**/*.{ts,tsx}'],
|
||||
rules: { 'no-restricted-imports': ['error', { patterns: [UI_DEEP_IMPORT] }] },
|
||||
},
|
||||
// Local rules run in node
|
||||
{ files: ['eslint/**/*.js'], languageOptions: { globals: globals.node } },
|
||||
// Tests build their own bundles with made-up ids
|
||||
{ files: ['src/**/*.test.{ts,tsx}'], rules: { 'l10n/message-id': 'off' } }
|
||||
);
|
||||
@@ -0,0 +1,202 @@
|
||||
// Checks Fluent ids against the en-US translation.ftl: literal ids passed to `t`, `t.attr`,
|
||||
// the `id` prop of l10n components (with args), and any other string literal typed as MessageId
|
||||
// (props, options, `satisfies Record<..., MessageId>`). Ids must be full literals, args must match.
|
||||
import { parse } from '@fluent/syntax';
|
||||
import { readFileSync, statSync } from 'node:fs';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const FTL_FILE = fileURLToPath(new URL('../../app/public/i18n/en/translation.ftl', import.meta.url));
|
||||
const COMPONENTS = new Set(['Localized']);
|
||||
|
||||
let cache = { mtime: -1, messages: new Map() };
|
||||
|
||||
function collect(node, out) {
|
||||
if (!node || typeof node !== 'object') return;
|
||||
if (Array.isArray(node)) {
|
||||
for (const child of node) collect(child, out);
|
||||
return;
|
||||
}
|
||||
if (node.type === 'VariableReference') out.vars.add(node.id.name);
|
||||
else if (node.type === 'MessageReference') {
|
||||
out.refs.push({ id: node.id.name, attr: node.attribute?.name ?? null });
|
||||
}
|
||||
for (const [key, value] of Object.entries(node)) {
|
||||
if (key !== 'span' && typeof value === 'object') collect(value, out);
|
||||
}
|
||||
}
|
||||
|
||||
function patternInfo(pattern) {
|
||||
const out = { vars: new Set(), refs: [] };
|
||||
collect(pattern, out);
|
||||
return out;
|
||||
}
|
||||
|
||||
function loadMessages() {
|
||||
const mtime = statSync(FTL_FILE).mtimeMs;
|
||||
if (mtime === cache.mtime) return cache.messages;
|
||||
const messages = new Map();
|
||||
for (const entry of parse(readFileSync(FTL_FILE, 'utf8'), { withSpans: false }).body) {
|
||||
if (entry.type !== 'Message') continue;
|
||||
messages.set(entry.id.name, {
|
||||
value: entry.value ? patternInfo(entry.value) : null,
|
||||
attrs: new Map(entry.attributes.map((a) => [a.id.name, patternInfo(a.value)])),
|
||||
});
|
||||
}
|
||||
cache = { mtime, messages };
|
||||
return messages;
|
||||
}
|
||||
|
||||
function requiredVars(messages, id, attr, seen = new Set()) {
|
||||
const key = `${id}.${attr ?? ''}`;
|
||||
const message = messages.get(id);
|
||||
const info = attr === null ? message?.value : message?.attrs.get(attr);
|
||||
if (!info || seen.has(key)) return new Set();
|
||||
seen.add(key);
|
||||
const vars = new Set(info.vars);
|
||||
for (const ref of info.refs) {
|
||||
for (const v of requiredVars(messages, ref.id, ref.attr, seen)) vars.add(v);
|
||||
}
|
||||
return vars;
|
||||
}
|
||||
|
||||
// `handled` collects literals already checked through t()/Localized, so the type-based pass skips them
|
||||
function literalIds(node, context, handled) {
|
||||
if (node.type === 'Literal' || node.type === 'TemplateLiteral') handled.add(node);
|
||||
if (node.type === 'Literal' && typeof node.value === 'string') return [node.value];
|
||||
if (node.type === 'TemplateLiteral') {
|
||||
if (node.expressions.length === 0) return [node.quasis[0].value.cooked];
|
||||
context.report({ node, messageId: 'dynamic' });
|
||||
return null;
|
||||
}
|
||||
if (node.type === 'ConditionalExpression') {
|
||||
const a = literalIds(node.consequent, context, handled);
|
||||
const b = literalIds(node.alternate, context, handled);
|
||||
return a && b ? [...a, ...b] : null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function isMessageIdType(type) {
|
||||
if (!type) return false;
|
||||
if (type.aliasSymbol?.escapedName === 'MessageId') return true;
|
||||
return type.isUnion() && type.types.some(isMessageIdType);
|
||||
}
|
||||
|
||||
function propName(prop) {
|
||||
if (prop.computed) return null;
|
||||
if (prop.key.type === 'Identifier') return prop.key.name;
|
||||
if (prop.key.type === 'Literal') return String(prop.key.value);
|
||||
return null;
|
||||
}
|
||||
|
||||
const messageId = {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: { description: 'Fluent ids exist in en-US and get the args they need' },
|
||||
schema: [],
|
||||
messages: {
|
||||
dynamic: 'Fluent ids must be full literals so they stay greppable.',
|
||||
unknown: 'Unknown Fluent id "{{id}}" (not in en-US translation.ftl).',
|
||||
noValue: 'Fluent message "{{id}}" has no value, only attributes.',
|
||||
unknownAttr: 'Fluent message "{{id}}" has no attribute "{{attr}}".',
|
||||
missingArgs: 'Fluent message "{{id}}" needs args: {{vars}}.',
|
||||
unknownArg: 'Fluent message "{{id}}" does not use arg "{{arg}}".',
|
||||
},
|
||||
},
|
||||
create(context) {
|
||||
const messages = loadMessages();
|
||||
const handled = new WeakSet();
|
||||
const services = context.sourceCode.parserServices;
|
||||
const checker = services?.program?.getTypeChecker();
|
||||
|
||||
function typedAsMessageId(node) {
|
||||
const tsNode = services.esTreeNodeToTSNodeMap.get(node);
|
||||
return isMessageIdType(checker.getContextualType(tsNode));
|
||||
}
|
||||
|
||||
function checkTyped(node) {
|
||||
if (!checker || handled.has(node) || !typedAsMessageId(node)) return;
|
||||
check(node, { attr: undefined, withArgs: false });
|
||||
}
|
||||
|
||||
function checkArgs(node, id, attr, argsNode) {
|
||||
const vars = requiredVars(messages, id, attr);
|
||||
if (!argsNode) {
|
||||
if (vars.size) context.report({ node, messageId: 'missingArgs', data: { id, vars: [...vars].join(', ') } });
|
||||
return;
|
||||
}
|
||||
if (argsNode.type !== 'ObjectExpression') return;
|
||||
if (argsNode.properties.some((p) => p.type !== 'Property' || propName(p) === null)) return;
|
||||
const given = new Set(argsNode.properties.map(propName));
|
||||
const missing = [...vars].filter((v) => !given.has(v));
|
||||
if (missing.length) {
|
||||
context.report({ node: argsNode, messageId: 'missingArgs', data: { id, vars: missing.join(', ') } });
|
||||
}
|
||||
for (const prop of argsNode.properties) {
|
||||
const arg = propName(prop);
|
||||
if (!vars.has(arg)) context.report({ node: prop, messageId: 'unknownArg', data: { id, arg } });
|
||||
}
|
||||
}
|
||||
|
||||
function check(idNode, { attr, argsNode, withArgs }) {
|
||||
const ids = literalIds(idNode, context, handled);
|
||||
if (!ids) return;
|
||||
for (const id of ids) {
|
||||
const message = messages.get(id);
|
||||
if (!message) {
|
||||
context.report({ node: idNode, messageId: 'unknown', data: { id } });
|
||||
continue;
|
||||
}
|
||||
if (attr === undefined && !message.value) {
|
||||
context.report({ node: idNode, messageId: 'noValue', data: { id } });
|
||||
continue;
|
||||
}
|
||||
if (typeof attr === 'string' && !message.attrs.has(attr)) {
|
||||
context.report({ node: idNode, messageId: 'unknownAttr', data: { id, attr } });
|
||||
continue;
|
||||
}
|
||||
if (withArgs && attr !== null) checkArgs(idNode, id, attr ?? null, argsNode);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
CallExpression(node) {
|
||||
const { callee } = node;
|
||||
const [first, second, third] = node.arguments;
|
||||
if (!first) return;
|
||||
if (callee.type === 'Identifier' && callee.name === 't') {
|
||||
check(first, { attr: undefined, argsNode: second, withArgs: true });
|
||||
} else if (
|
||||
callee.type === 'MemberExpression' &&
|
||||
callee.object.type === 'Identifier' &&
|
||||
callee.object.name === 't' &&
|
||||
callee.property.type === 'Identifier' &&
|
||||
callee.property.name === 'attr' &&
|
||||
second
|
||||
) {
|
||||
const attr = second.type === 'Literal' && typeof second.value === 'string' ? second.value : null;
|
||||
check(first, { attr, argsNode: third, withArgs: true });
|
||||
}
|
||||
},
|
||||
JSXOpeningElement(node) {
|
||||
if (node.name.type !== 'JSXIdentifier' || !COMPONENTS.has(node.name.name)) return;
|
||||
const attrs = node.attributes.filter((a) => a.type === 'JSXAttribute');
|
||||
const idAttr = attrs.find((a) => a.name.name === 'id');
|
||||
if (!idAttr?.value) return;
|
||||
const idNode = idAttr.value.type === 'JSXExpressionContainer' ? idAttr.value.expression : idAttr.value;
|
||||
const argsAttr = attrs.find((a) => a.name.name === 'args');
|
||||
// Spread props may carry args, skip the args check then
|
||||
const withArgs = !node.attributes.some((a) => a.type === 'JSXSpreadAttribute');
|
||||
const argsNode = argsAttr?.value?.type === 'JSXExpressionContainer' ? argsAttr.value.expression : undefined;
|
||||
check(idNode, { attr: undefined, argsNode, withArgs });
|
||||
},
|
||||
// Props, options and `satisfies Record<..., MessageId>` values: anything typed MessageId
|
||||
Literal(node) {
|
||||
if (typeof node.value === 'string') checkTyped(node);
|
||||
},
|
||||
TemplateLiteral: checkTyped,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
export default { rules: { 'message-id': messageId } };
|
||||
@@ -0,0 +1,14 @@
|
||||
// lib holds services and reactive state, anything that renders lives in ui
|
||||
const noJsx = {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
messages: { jsx: 'No JSX in lib, components belong in ui.' },
|
||||
schema: [],
|
||||
},
|
||||
create(context) {
|
||||
const report = (node) => context.report({ node, messageId: 'jsx' });
|
||||
return { JSXElement: report, JSXFragment: report };
|
||||
},
|
||||
};
|
||||
|
||||
export default { rules: { 'no-jsx': noJsx } };
|
||||
@@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<link rel="apple-touch-icon" href="/logo192.png" />
|
||||
<link rel="manifest" href="/manifest.json" />
|
||||
<title>SlimeVR GUI</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/index.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"name": "@slimevr/gui-app-next",
|
||||
"version": "0.0.0",
|
||||
"author": "SlimeVR Team <[email protected]>",
|
||||
"homepage": "https://slimevr.dev",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.node.json",
|
||||
"test": "vitest run",
|
||||
"lint": "pnpm typecheck && eslint src && prettier --check \"src/**/*.{ts,tsx,css,json}\"",
|
||||
"lint:fix": "eslint --fix src && prettier --write \"src/**/*.{ts,tsx,css,json}\""
|
||||
},
|
||||
"dependencies": {
|
||||
"@fluent/bundle": "0.19.1",
|
||||
"@fluent/langneg": "0.7.0",
|
||||
"@fontsource-variable/lexend": "5.3.0",
|
||||
"@fontsource/jetbrains-mono": "5.3.0",
|
||||
"@fontsource/noto-sans": "5.3.0",
|
||||
"@fontsource/opendyslexic": "5.3.0",
|
||||
"@fontsource/poppins": "5.2.7",
|
||||
"@fontsource/ubuntu": "5.3.0",
|
||||
"@sentry/solid": "11.9.0",
|
||||
"@slimevr/gui-shared": "workspace:*",
|
||||
"@solidjs/router": "1.0.0",
|
||||
"browser-fs-access": "0.38.0",
|
||||
"flatbuffers": "22.10.26",
|
||||
"semver": "7.7.4",
|
||||
"solarxr-protocol": "workspace:*",
|
||||
"solid-js": "1.9.17",
|
||||
"valibot": "1.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "10.0.1",
|
||||
"@sentry/vite-plugin": "11.9.0",
|
||||
"@fluent/syntax": "0.19.0",
|
||||
"@iconify-json/heroicons": "1.2.3",
|
||||
"@iconify-json/ic": "1.2.4",
|
||||
"@iconify-json/lucide": "1.2.147",
|
||||
"@iconify-json/material-symbols": "1.2.96",
|
||||
"@solidjs/testing-library": "0.8.10",
|
||||
"@tailwindcss/vite": "4.3.3",
|
||||
"@testing-library/jest-dom": "7.0.1",
|
||||
"@testing-library/user-event": "14.6.8",
|
||||
"@types/node": "26.6.5",
|
||||
"@types/semver": "7.7.1",
|
||||
"axe-core": "4.14.0",
|
||||
"eslint": "10.13.0",
|
||||
"eslint-import-resolver-typescript": "^4.4.4",
|
||||
"eslint-plugin-better-tailwindcss": "4.10.0",
|
||||
"eslint-plugin-boundaries": "7.3.0",
|
||||
"eslint-plugin-jsx-a11y": "6.10.2",
|
||||
"eslint-plugin-solid": "0.18.1",
|
||||
"globals": "17.13.0",
|
||||
"jsdom": "30.1.3",
|
||||
"prettier": "3.9.10",
|
||||
"tailwindcss": "4.3.3",
|
||||
"typescript": "~6.0.3",
|
||||
"typescript-eslint": "8.72.0",
|
||||
"unplugin-icons": "24.0.0",
|
||||
"vite": "8.3.5",
|
||||
"vite-imagetools": "12.0.1",
|
||||
"vite-plugin-solid": "2.11.14",
|
||||
"vitest": "5.0.5"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
import { useMatch } from '@solidjs/router';
|
||||
import { type JSX, Show } from 'solid-js';
|
||||
import HomeIcon from '~icons/material-symbols/home';
|
||||
import DesignIcon from '~icons/material-symbols/palette-outline-rounded';
|
||||
import GearIcon from '~icons/material-symbols/settings-rounded';
|
||||
import RulerIcon from '~icons/material-symbols/straighten-rounded';
|
||||
import { ConnectionGate } from '@/app/connection-gate';
|
||||
import { paths } from '@/app/routes';
|
||||
import { TitleBar } from '@/app/title-bar';
|
||||
import { handleBack } from '@/lib/back-stack';
|
||||
import { createMediaQuery, SHELL_QUERY } from '@/lib/media';
|
||||
import { MotionRegion } from '@/ui/motion';
|
||||
import { NavLink } from '@/ui/nav-link';
|
||||
|
||||
const MOUSE_BACK = 3;
|
||||
|
||||
// Same destinations at every width: bottom bar on phones, rail from `shell` up
|
||||
function Destinations() {
|
||||
const rail = createMediaQuery(SHELL_QUERY);
|
||||
|
||||
return (
|
||||
<MotionRegion
|
||||
orientation={rail() ? 'vertical' : 'horizontal'}
|
||||
class="
|
||||
order-last flex justify-around gap-sm px-sm pt-sm shell:order-first shell:flex-col
|
||||
shell:w-27.5 shell:shrink-0 shell:justify-start shell:pt-0 shell:pb-sm
|
||||
"
|
||||
>
|
||||
<NavLink to={paths.home} end label="navbar-home" icon={<HomeIcon />} />
|
||||
<NavLink
|
||||
to={paths.body}
|
||||
label="navbar-body_proportions"
|
||||
icon={<RulerIcon class="icon -rotate-45" />}
|
||||
/>
|
||||
<Show when={import.meta.env.DEV}>
|
||||
<NavLink
|
||||
to={paths.design}
|
||||
label="navbar-design"
|
||||
icon={<DesignIcon />}
|
||||
/>
|
||||
</Show>
|
||||
<div class="contents shell:mt-auto shell:flex shell:flex-col">
|
||||
<NavLink
|
||||
to={paths.settings}
|
||||
label="navbar-settings"
|
||||
icon={<GearIcon />}
|
||||
/>
|
||||
</div>
|
||||
</MotionRegion>
|
||||
);
|
||||
}
|
||||
|
||||
export function AppShell(props: { children: JSX.Element }) {
|
||||
// Setup runs without destinations, the flow footer owns the bottom
|
||||
const onboarding = useMatch(() => `${paths.onboarding}/*`);
|
||||
|
||||
function onPointerUp(e: PointerEvent) {
|
||||
if (e.button !== MOUSE_BACK) return;
|
||||
if (handleBack()) e.preventDefault();
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
class="flex h-dvh flex-col bg-surface text-fg surface-sidebar"
|
||||
onPointerUp={onPointerUp}
|
||||
>
|
||||
<TitleBar />
|
||||
<ConnectionGate>
|
||||
<div class="flex min-h-0 flex-1 flex-col shell:flex-row">
|
||||
<Show when={!onboarding()}>
|
||||
<Destinations />
|
||||
</Show>
|
||||
<main
|
||||
classList={{ 'shell:ml-sm': !!onboarding() }}
|
||||
class="
|
||||
relative min-h-0 flex-1 overflow-y-auto overscroll-contain @container shell:mb-sm
|
||||
shell:scrollbar-gutter-stable
|
||||
"
|
||||
>
|
||||
{props.children}
|
||||
</main>
|
||||
</div>
|
||||
</ConnectionGate>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import { HashRouter, type RouteSectionProps } from '@solidjs/router';
|
||||
import { withSentryRouterRouting } from '@sentry/solid/solidrouter';
|
||||
import { AppShell } from '@/app/app-shell';
|
||||
import { CrashBoundary } from '@/app/crash-screen';
|
||||
import { useHistoryBack } from '@/app/history-back';
|
||||
import { paths, routes } from '@/app/routes';
|
||||
import { searchDestinations } from '@/app/search-destinations';
|
||||
import { useShortcut } from '@/lib/keyboard';
|
||||
import { DOCS_SITE } from '@/lib/links';
|
||||
import { platform } from '@/lib/platform';
|
||||
import { QuickSearch } from '@/pages/settings/quick-search/quick-search';
|
||||
import { DialogHost } from '@/ui/dialog';
|
||||
import { MotionRoot } from '@/ui/motion';
|
||||
import { ToastHost } from '@/ui/toast';
|
||||
|
||||
const Router = withSentryRouterRouting(HashRouter);
|
||||
|
||||
function AppRoot(props: RouteSectionProps) {
|
||||
useHistoryBack();
|
||||
useShortcut('F1', () => platform.openUrl(DOCS_SITE), {
|
||||
scope: 'global',
|
||||
label: 'titlebar-docs',
|
||||
});
|
||||
|
||||
return (
|
||||
<MotionRoot>
|
||||
<AppShell>{props.children}</AppShell>
|
||||
<QuickSearch base={paths.settings} destinations={searchDestinations} />
|
||||
<DialogHost />
|
||||
<ToastHost />
|
||||
</MotionRoot>
|
||||
);
|
||||
}
|
||||
|
||||
export function App() {
|
||||
return (
|
||||
<CrashBoundary>
|
||||
<Router root={AppRoot}>{routes}</Router>
|
||||
</CrashBoundary>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { createPlatform } from '@/app/platform/detect';
|
||||
import { startReleaseCheck } from '@/domain/app-update/release-check';
|
||||
import { startDatafeed } from '@/domain/datafeed';
|
||||
import { initErrorReporting } from '@/domain/error-reporting';
|
||||
import { initSaveToasts } from '@/domain/settings/save-toasts';
|
||||
import { initKeyboard } from '@/lib/keyboard';
|
||||
import { initL10n } from '@/lib/l10n';
|
||||
import { setPlatform } from '@/lib/platform';
|
||||
import { loadPrefs } from '@/lib/storage';
|
||||
import { createSocketClient, serverUrl, setClient } from '@/solarxr/client';
|
||||
|
||||
// Everything that runs before render, in order. Returns the stop for the
|
||||
// background services.
|
||||
export async function boot(): Promise<() => void> {
|
||||
setPlatform(await createPlatform());
|
||||
setClient(createSocketClient({ url: serverUrl() }));
|
||||
await initErrorReporting();
|
||||
await loadPrefs();
|
||||
await initL10n();
|
||||
|
||||
const services = [
|
||||
initKeyboard(),
|
||||
initSaveToasts(),
|
||||
startReleaseCheck(),
|
||||
startDatafeed(),
|
||||
];
|
||||
return () => {
|
||||
for (const stop of services) stop();
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
import { cleanup, render, screen } from '@solidjs/testing-library';
|
||||
import {
|
||||
ErrorReportingConsent,
|
||||
ErrorReportingSettingsResponseT,
|
||||
} from 'solarxr-protocol';
|
||||
import { afterEach, beforeAll, describe, expect, it } from 'vitest';
|
||||
import { ConnectionGate } from '@/app/connection-gate';
|
||||
import { setPlatform } from '@/lib/platform';
|
||||
import { fakePlatform } from '@/lib/platform-fake';
|
||||
import { setClient } from '@/solarxr/client';
|
||||
import { createFakeClient, type FakeClient } from '@/solarxr/testing';
|
||||
|
||||
let fake: FakeClient;
|
||||
|
||||
beforeAll(() => {
|
||||
setPlatform(fakePlatform());
|
||||
fake = createFakeClient({ connected: false });
|
||||
setClient(fake);
|
||||
});
|
||||
|
||||
function consent(value: ErrorReportingConsent) {
|
||||
fake.push(new ErrorReportingSettingsResponseT(value, 'user-1', 'session-1'));
|
||||
}
|
||||
|
||||
function renderGate() {
|
||||
render(() => (
|
||||
<ConnectionGate>
|
||||
<p>app</p>
|
||||
</ConnectionGate>
|
||||
));
|
||||
}
|
||||
|
||||
// Resources are module state, so the cases run as one story in order
|
||||
describe('ConnectionGate', () => {
|
||||
afterEach(cleanup);
|
||||
|
||||
it('shows the timeout error when the first connect takes too long', () => {
|
||||
renderGate();
|
||||
expect(screen.getByText('websocket-connecting')).toBeInTheDocument();
|
||||
fake.setTimedOut(true);
|
||||
expect(screen.getByText('websocket-timedout')).toBeInTheDocument();
|
||||
expect(screen.queryByText('app')).toBeNull();
|
||||
fake.setTimedOut(false);
|
||||
});
|
||||
|
||||
it('waits for consent, asks it, then shows the app and covers it on loss', () => {
|
||||
renderGate();
|
||||
fake.connect();
|
||||
expect(screen.getByText('websocket-connecting')).toBeInTheDocument();
|
||||
expect(screen.queryByText('app')).toBeNull();
|
||||
|
||||
consent(ErrorReportingConsent.UNDECIDED);
|
||||
expect(
|
||||
screen.getByText('error_collection_modal-title')
|
||||
).toBeInTheDocument();
|
||||
expect(screen.queryByText('app')).toBeNull();
|
||||
|
||||
consent(ErrorReportingConsent.ALLOWED);
|
||||
expect(screen.queryByText('error_collection_modal-title')).toBeNull();
|
||||
expect(screen.getByText('app').parentElement).not.toHaveClass('hidden');
|
||||
|
||||
fake.disconnect();
|
||||
expect(screen.getByText('websocket-connection_lost')).toBeInTheDocument();
|
||||
// Kept mounted under the screen
|
||||
expect(screen.getByText('app').parentElement).toHaveClass('hidden');
|
||||
|
||||
fake.connect();
|
||||
consent(ErrorReportingConsent.ALLOWED);
|
||||
expect(screen.queryByText('websocket-connection_lost')).toBeNull();
|
||||
expect(screen.getByText('app').parentElement).not.toHaveClass('hidden');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,188 @@
|
||||
import {
|
||||
createEffect,
|
||||
createSignal,
|
||||
type JSX,
|
||||
Match,
|
||||
onMount,
|
||||
Show,
|
||||
Switch,
|
||||
} from 'solid-js';
|
||||
import { ErrorReportingConsent } from 'solarxr-protocol';
|
||||
import {
|
||||
answerConsent,
|
||||
crashReportAvailable,
|
||||
errorReportingSettings,
|
||||
needsConsentAnswer,
|
||||
sendCrashReport,
|
||||
} from '@/domain/error-reporting';
|
||||
import { ErrorReportingDetails } from '@/domain/error-reporting/error-reporting-details';
|
||||
import { cx } from '@/lib/cx';
|
||||
import { t } from '@/lib/l10n';
|
||||
import { platform, type CrashKind } from '@/lib/platform';
|
||||
import { flushPrefs } from '@/lib/storage';
|
||||
import { client } from '@/solarxr/client';
|
||||
import { TextButton } from '@/ui/button';
|
||||
import { focusEntry, MotionRegion } from '@/ui/motion';
|
||||
import { StatusState } from '@/ui/status-state';
|
||||
|
||||
type GateScreen = 'connection' | 'consent';
|
||||
|
||||
function CrashReportBanner(props: { kind: CrashKind }) {
|
||||
const [sent, setSent] = createSignal(false);
|
||||
const [sending, setSending] = createSignal(false);
|
||||
|
||||
async function send() {
|
||||
setSending(true);
|
||||
try {
|
||||
if (await sendCrashReport(props.kind)) setSent(true);
|
||||
} finally {
|
||||
setSending(false);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Show when={crashReportAvailable()}>
|
||||
<div
|
||||
class="
|
||||
flex w-full max-w-2xl flex-wrap items-center justify-between gap-md rounded-lg bg-surface
|
||||
px-lg py-md surface-section
|
||||
"
|
||||
>
|
||||
<p>
|
||||
{t(sent() ? 'websocket-report-sent' : 'websocket-report-question')}
|
||||
</p>
|
||||
<Show when={!sent()}>
|
||||
<TextButton
|
||||
label="websocket-report-send"
|
||||
loading={sending()}
|
||||
onClick={send}
|
||||
/>
|
||||
</Show>
|
||||
</div>
|
||||
</Show>
|
||||
);
|
||||
}
|
||||
|
||||
function ConnectionScreen() {
|
||||
const timedOut = () => client.status() === 'connecting' && client.timedOut();
|
||||
const lost = () => client.status() === 'disconnected';
|
||||
|
||||
async function close() {
|
||||
await flushPrefs();
|
||||
platform.window?.close();
|
||||
}
|
||||
|
||||
return (
|
||||
<Show
|
||||
when={timedOut() || lost()}
|
||||
fallback={
|
||||
<StatusState kind="loading" size="page" title="websocket-connecting" />
|
||||
}
|
||||
>
|
||||
<div class="flex flex-1 flex-col items-center gap-lg p-lg">
|
||||
<StatusState
|
||||
kind="error"
|
||||
size="page"
|
||||
title={
|
||||
timedOut() ? 'websocket-timedout' : 'websocket-connection_lost'
|
||||
}
|
||||
description={
|
||||
timedOut()
|
||||
? 'websocket-timedout-desc'
|
||||
: 'websocket-connection_lost-desc'
|
||||
}
|
||||
action={
|
||||
<Show when={platform.window}>
|
||||
<div class="flex flex-wrap justify-center gap-sm">
|
||||
<TextButton
|
||||
variant="primary"
|
||||
label="websocket-error-close"
|
||||
onClick={close}
|
||||
/>
|
||||
<Show when={platform.folders}>
|
||||
{(folders) => (
|
||||
<TextButton
|
||||
label="websocket-error-logs"
|
||||
onClick={() => void folders().openLogs()}
|
||||
/>
|
||||
)}
|
||||
</Show>
|
||||
</div>
|
||||
</Show>
|
||||
}
|
||||
/>
|
||||
<CrashReportBanner kind={timedOut() ? 'timeout' : 'connection_lost'} />
|
||||
</div>
|
||||
</Show>
|
||||
);
|
||||
}
|
||||
|
||||
function ConsentScreen() {
|
||||
let el!: HTMLDivElement;
|
||||
onMount(() => focusEntry(el));
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={el}
|
||||
class="flex min-h-0 flex-1 justify-center overflow-y-auto p-lg"
|
||||
>
|
||||
<MotionRegion class="flex w-full max-w-2xl flex-col items-center gap-lg">
|
||||
<StatusState
|
||||
kind="empty"
|
||||
title="error_collection_modal-title"
|
||||
description="error_collection_modal-subtitle"
|
||||
/>
|
||||
<ErrorReportingDetails />
|
||||
<p class="text-center">{t('error_collection_modal-change_later')}</p>
|
||||
<div class="flex w-full flex-wrap-reverse justify-between gap-md">
|
||||
<TextButton
|
||||
variant="ghost"
|
||||
label="error_collection_modal-cancel"
|
||||
onClick={() => answerConsent(ErrorReportingConsent.DENIED)}
|
||||
/>
|
||||
<TextButton
|
||||
variant="primary"
|
||||
label="error_collection_modal-confirm"
|
||||
onClick={() => answerConsent(ErrorReportingConsent.ALLOWED)}
|
||||
/>
|
||||
</div>
|
||||
</MotionRegion>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function ConnectionGate(props: { children: JSX.Element }) {
|
||||
const [shown, setShown] = createSignal(false);
|
||||
|
||||
function screen(): GateScreen | null {
|
||||
if (client.status() !== 'connected') return 'connection';
|
||||
if (!shown() && errorReportingSettings.state() !== 'fresh')
|
||||
return 'connection';
|
||||
if (needsConsentAnswer()) return 'consent';
|
||||
return null;
|
||||
}
|
||||
|
||||
createEffect(() => {
|
||||
if (!screen()) setShown(true);
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<Switch>
|
||||
<Match when={screen() === 'connection'}>
|
||||
<ConnectionScreen />
|
||||
</Match>
|
||||
<Match when={screen() === 'consent'}>
|
||||
<ConsentScreen />
|
||||
</Match>
|
||||
</Switch>
|
||||
<Show when={shown()}>
|
||||
<div
|
||||
class={cx('min-h-0 flex-1 flex-col', screen() ? 'hidden' : 'flex')}
|
||||
>
|
||||
{props.children}
|
||||
</div>
|
||||
</Show>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
import { ErrorBoundary, type JSX, Show } from 'solid-js';
|
||||
import { MinimalTitleBar } from '@/app/title-bar';
|
||||
import { lastReportId, reportError } from '@/domain/error-reporting';
|
||||
import { t } from '@/lib/l10n';
|
||||
import { TextButton } from '@/ui/button';
|
||||
import { CopyButton } from '@/ui/copy-button';
|
||||
import { StatusState } from '@/ui/status-state';
|
||||
|
||||
function CrashScreen(props: { eventId: string | undefined }) {
|
||||
return (
|
||||
<div class="flex h-screen flex-col bg-surface text-fg surface-sidebar">
|
||||
<MinimalTitleBar />
|
||||
<div class="flex min-h-0 flex-1 flex-col overflow-y-auto">
|
||||
<StatusState
|
||||
kind="error"
|
||||
size="page"
|
||||
title="crash_screen-title"
|
||||
description="crash_screen-description"
|
||||
action={
|
||||
<div class="flex flex-col items-center gap-md">
|
||||
<Show when={props.eventId}>
|
||||
{(id) => (
|
||||
<p class="font-mono select-text">
|
||||
{t('crash_screen-event_id', { id: id() })}
|
||||
</p>
|
||||
)}
|
||||
</Show>
|
||||
<div class="flex flex-wrap justify-center gap-sm">
|
||||
<Show when={props.eventId}>
|
||||
{(id) => <CopyButton text={id()} label="crash_screen-copy" />}
|
||||
</Show>
|
||||
<TextButton
|
||||
variant="primary"
|
||||
label="crash_screen-reload"
|
||||
onClick={() => window.location.reload()}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function CrashBoundary(props: { children: JSX.Element }) {
|
||||
return (
|
||||
<ErrorBoundary
|
||||
fallback={(error) => {
|
||||
reportError(error, { tags: { boundary: 'app' } });
|
||||
return <CrashScreen eventId={lastReportId()} />;
|
||||
}}
|
||||
>
|
||||
{props.children}
|
||||
</ErrorBoundary>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import { useLocation, useNavigate } from '@solidjs/router';
|
||||
import { onCleanup } from 'solid-js';
|
||||
import { setBackFallback } from '@/lib/back-stack';
|
||||
|
||||
function depth(): number {
|
||||
const state: unknown = window.history.state;
|
||||
if (typeof state !== 'object' || state === null || !('_depth' in state)) return 0;
|
||||
return typeof state._depth === 'number' ? state._depth : 0;
|
||||
}
|
||||
|
||||
// Router history under the overlays. Stops at the entry the app started on,
|
||||
// so back never leaves the app.
|
||||
export function useHistoryBack() {
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const start = depth();
|
||||
|
||||
onCleanup(
|
||||
setBackFallback({
|
||||
can: () => {
|
||||
void location.key;
|
||||
return depth() > start;
|
||||
},
|
||||
back: () => navigate(-1),
|
||||
})
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import type { Platform } from '@/lib/platform';
|
||||
import { localCrossStorage } from '@/lib/storage';
|
||||
import { saveWithBrowser } from './browser-save';
|
||||
|
||||
type AndroidBridge = NonNullable<Window['__ANDROID__']>;
|
||||
|
||||
function toBase64(blob: Blob) {
|
||||
return new Promise<string>((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
reader.onload = () => {
|
||||
const url = reader.result as string;
|
||||
resolve(url.slice(url.indexOf(',') + 1));
|
||||
};
|
||||
reader.onerror = () => reject(reader.error);
|
||||
reader.readAsDataURL(blob);
|
||||
});
|
||||
}
|
||||
|
||||
export function createAndroidPlatform(android: AndroidBridge): Platform {
|
||||
const settings = localCrossStorage('');
|
||||
const cache = localCrossStorage('slimevr-cache/');
|
||||
|
||||
return {
|
||||
kind: 'android',
|
||||
os: 'android',
|
||||
storage: (name) => (name === 'settings' ? settings : cache),
|
||||
openUrl: (url) => void window.open(url, '_blank'),
|
||||
saveFile: async (opts) => {
|
||||
if (typeof android.saveFile !== 'function') return saveWithBrowser(opts);
|
||||
const { blob, fileName } = opts;
|
||||
android.saveFile(
|
||||
fileName,
|
||||
blob.type || 'application/octet-stream',
|
||||
await toBase64(blob)
|
||||
);
|
||||
return 'saved';
|
||||
},
|
||||
systemInsets: { setBackground: (color) => android.updateInsetBackground(color) },
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { fileSave } from 'browser-fs-access';
|
||||
import type { SaveOptions, SaveResult } from '@/lib/platform';
|
||||
|
||||
export async function saveWithBrowser({
|
||||
blob,
|
||||
fileName,
|
||||
extensions,
|
||||
}: SaveOptions): Promise<SaveResult> {
|
||||
try {
|
||||
await fileSave(blob, { fileName, extensions });
|
||||
return 'saved';
|
||||
} catch (e) {
|
||||
if (e instanceof DOMException && e.name === 'AbortError') return 'canceled';
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import type { IElectronAPI } from '@slimevr/gui-shared';
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { memoryCrossStorage } from '@/lib/platform-fake';
|
||||
import { createPlatform } from './detect';
|
||||
|
||||
describe('createPlatform', () => {
|
||||
it('resolves the OS before returning on electron', async () => {
|
||||
const storage = memoryCrossStorage();
|
||||
vi.stubGlobal('electronAPI', {
|
||||
osStats: async () => ({ type: 'linux' }),
|
||||
getStorage: async () => storage,
|
||||
} as Partial<IElectronAPI>);
|
||||
|
||||
const platform = await createPlatform();
|
||||
expect(platform.kind).toBe('desktop');
|
||||
expect(platform.os).toBe('linux');
|
||||
expect(platform.storage('settings')).toBe(storage);
|
||||
expect(platform.window).toBeDefined();
|
||||
});
|
||||
|
||||
it('picks android when the bridge is there', async () => {
|
||||
vi.stubGlobal('__ANDROID__', {
|
||||
isThere: () => true,
|
||||
updateInsetBackground: () => {},
|
||||
saveFile: () => {},
|
||||
});
|
||||
|
||||
const platform = await createPlatform();
|
||||
expect(platform.kind).toBe('android');
|
||||
expect(platform.systemInsets).toBeDefined();
|
||||
expect(platform.window).toBeUndefined();
|
||||
});
|
||||
|
||||
it('falls back to web', async () => {
|
||||
const platform = await createPlatform();
|
||||
expect(platform.kind).toBe('web');
|
||||
expect(platform.pickFile).toBeUndefined();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
import type { Platform } from '@/lib/platform';
|
||||
import { createAndroidPlatform } from './android';
|
||||
import { createElectronPlatform } from './electron';
|
||||
import { createWebPlatform } from './web';
|
||||
|
||||
export async function createPlatform(): Promise<Platform> {
|
||||
if (window.electronAPI) return createElectronPlatform(window.electronAPI);
|
||||
const android = window.__ANDROID__;
|
||||
if (android?.isThere()) return createAndroidPlatform(android);
|
||||
return createWebPlatform();
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
import type { IElectronAPI } from '@slimevr/gui-shared';
|
||||
import type { Platform } from '@/lib/platform';
|
||||
import { saveWithBrowser } from './browser-save';
|
||||
|
||||
export async function createElectronPlatform(api: IElectronAPI): Promise<Platform> {
|
||||
const [os, settings, cache] = await Promise.all([
|
||||
api.osStats(),
|
||||
api.getStorage('settings'),
|
||||
api.getStorage('cache'),
|
||||
]);
|
||||
|
||||
return {
|
||||
kind: 'desktop',
|
||||
os: os.type,
|
||||
storage: (name) => (name === 'settings' ? settings : cache),
|
||||
openUrl: (url) => void api.openUrl(url),
|
||||
saveFile: saveWithBrowser,
|
||||
pickFile: async ({ mode, title, filters, defaultPath }) => {
|
||||
if (mode === 'save') {
|
||||
const res = await api.saveDialog({ title, filters, defaultPath });
|
||||
return res.canceled || !res.filePath ? null : res.filePath;
|
||||
}
|
||||
const res = await api.openDialog({
|
||||
title,
|
||||
filters,
|
||||
defaultPath,
|
||||
properties: [mode === 'directory' ? 'openDirectory' : 'openFile'],
|
||||
});
|
||||
return res.canceled ? null : (res.filePaths[0] ?? null);
|
||||
},
|
||||
window: {
|
||||
minimize: () => api.minimize(),
|
||||
toggleMaximize: () => api.toggleMaximize(),
|
||||
hide: () => api.hide(),
|
||||
close: () => api.close(),
|
||||
showDecorations: (on) => api.showDecorations(on),
|
||||
},
|
||||
folders: {
|
||||
openLogs: () => api.openLogsFolder(),
|
||||
openConfig: () => api.openConfigFolder(),
|
||||
installDir: () => api.getInstallDir(),
|
||||
},
|
||||
guiLogs: {
|
||||
onEvents: (cb) => api.onGuiLogEvents(cb),
|
||||
files: () => api.guiLogFiles(),
|
||||
read: (name) => api.readGuiLogFile(name),
|
||||
},
|
||||
log: (level, ...args) => api.log(level, ...args),
|
||||
errorReporting: {
|
||||
setState: (state) => api.setErrorReporting(state),
|
||||
sendCrash: (kind) => api.sendCrashReport(kind),
|
||||
},
|
||||
discordPresence: { set: (presence) => api.setPresence(presence) },
|
||||
translations: {
|
||||
set: (translations) => api.setTranslations(translations),
|
||||
override: () => api.i18nOverride(),
|
||||
onCrowdinPopupClosed: (cb) => api.onCrowdinPopupClosed(cb),
|
||||
},
|
||||
github: { get: (request) => api.ghGet(request) },
|
||||
steam: { isSteam: () => api.isSteam() },
|
||||
keybindRecording: (on) => api.setKeybindRecording(on),
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import type { Platform } from '@/lib/platform';
|
||||
import { localCrossStorage } from '@/lib/storage';
|
||||
import { saveWithBrowser } from './browser-save';
|
||||
|
||||
export function createWebPlatform(): Platform {
|
||||
const settings = localCrossStorage('');
|
||||
const cache = localCrossStorage('slimevr-cache/');
|
||||
|
||||
return {
|
||||
kind: 'web',
|
||||
os: 'unknown',
|
||||
storage: (name) => (name === 'settings' ? settings : cache),
|
||||
openUrl: (url) => void window.open(url, '_blank'),
|
||||
saveFile: saveWithBrowser,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import type { RouteDefinition } from '@solidjs/router';
|
||||
import { BodyPage } from '@/pages/body/body-page';
|
||||
import { DesignPage } from '@/pages/design/design-page';
|
||||
import { HomePage } from '@/pages/home/home-page';
|
||||
import { onboardingRoute } from '@/pages/onboarding/onboarding-route';
|
||||
import { settingsRoute } from '@/pages/settings/settings-route';
|
||||
import { SetupPage } from '@/pages/setup/setup-page';
|
||||
|
||||
export const paths = {
|
||||
home: '/',
|
||||
body: '/body',
|
||||
setup: '/setup',
|
||||
onboarding: '/onboarding',
|
||||
settings: '/settings',
|
||||
design: '/design',
|
||||
} as const;
|
||||
|
||||
export const routes: RouteDefinition[] = [
|
||||
{ path: paths.home, component: HomePage },
|
||||
{ path: paths.body, component: BodyPage },
|
||||
{ path: paths.setup, component: SetupPage },
|
||||
onboardingRoute(paths.onboarding),
|
||||
settingsRoute({ base: paths.settings, wizard: paths.onboarding }),
|
||||
...(import.meta.env.DEV ? [{ path: paths.design, component: DesignPage }] : []),
|
||||
];
|
||||
@@ -0,0 +1,8 @@
|
||||
import { paths } from '@/app/routes';
|
||||
import type { SearchDestination } from '@/pages/settings/quick-search/search-entries';
|
||||
|
||||
// Pages outside the settings that quick search lists. Add a row when a page's route lands.
|
||||
export const searchDestinations: SearchDestination[] = [
|
||||
{ path: paths.home, title: 'navbar-home' },
|
||||
{ path: paths.onboarding, title: 'navbar-onboarding' },
|
||||
];
|
||||
@@ -0,0 +1,198 @@
|
||||
import { useMatch } from '@solidjs/router';
|
||||
import { createSignal, createUniqueId, Show } from 'solid-js';
|
||||
import { ServerInfosRequestT, ServerInfosResponseT } from 'solarxr-protocol';
|
||||
import DownloadIcon from '~icons/heroicons/arrow-down-tray-solid';
|
||||
import SearchIcon from '~icons/heroicons/magnifying-glass-20-solid';
|
||||
import QuestionIcon from '~icons/heroicons/question-mark-circle';
|
||||
import CloseIcon from '~icons/material-symbols/close-rounded';
|
||||
import MaximiseIcon from '~icons/material-symbols/crop-square-outline-rounded';
|
||||
import MinimiseIcon from '~icons/material-symbols/minimize-rounded';
|
||||
import GearIcon from '~icons/material-symbols/settings-rounded';
|
||||
import SlimevrLogoIcon from '~icons/slime/slimevr-logo';
|
||||
import { paths } from '@/app/routes';
|
||||
import { serverUpdate } from '@/domain/app-update/release-check';
|
||||
import {
|
||||
DOCS_SITE,
|
||||
LATEST_RELEASE_URL,
|
||||
RELEASES_URL,
|
||||
WINDOWS_DOWNLOAD_URL,
|
||||
} from '@/lib/links';
|
||||
import { platform, type WindowApi } from '@/lib/platform';
|
||||
import { flushPrefs } from '@/lib/storage';
|
||||
import { openQuickSearch } from '@/pages/settings/quick-search/quick-search';
|
||||
import { defineResource } from '@/solarxr/resource';
|
||||
import { TextButton } from '@/ui/button';
|
||||
import { MotionRegion } from '@/ui/motion';
|
||||
import { PlainLink } from '@/ui/plain-link';
|
||||
import { Tooltip } from '@/ui/tooltip';
|
||||
|
||||
const serverInfos = defineResource({
|
||||
request: () => new ServerInfosRequestT(),
|
||||
response: ServerInfosResponseT,
|
||||
});
|
||||
|
||||
const VERSION =
|
||||
(__VERSION_TAG__ || __COMMIT_HASH__) + (__GIT_CLEAN__ ? '' : '-dirty');
|
||||
|
||||
function localIp() {
|
||||
const ip = serverInfos.value()?.localIp;
|
||||
return ip ? String(ip) : null;
|
||||
}
|
||||
|
||||
function openUpdate() {
|
||||
platform.openUrl(
|
||||
platform.os === 'windows' ? WINDOWS_DOWNLOAD_URL : LATEST_RELEASE_URL
|
||||
);
|
||||
}
|
||||
|
||||
function WindowControls(props: { api: WindowApi }) {
|
||||
async function close() {
|
||||
await flushPrefs();
|
||||
props.api.close();
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<TextButton
|
||||
variant="ghost"
|
||||
size="small"
|
||||
iconOnly
|
||||
label="titlebar-minimize"
|
||||
icon={<MinimiseIcon class="icon icon-sm" />}
|
||||
onClick={() => props.api.minimize()}
|
||||
/>
|
||||
<TextButton
|
||||
variant="ghost"
|
||||
size="small"
|
||||
iconOnly
|
||||
label="titlebar-maximize"
|
||||
icon={<MaximiseIcon class="icon icon-sm" />}
|
||||
onClick={() => props.api.toggleMaximize()}
|
||||
/>
|
||||
<TextButton
|
||||
variant="ghost"
|
||||
size="small"
|
||||
iconOnly
|
||||
label="titlebar-close"
|
||||
icon={<CloseIcon class="icon icon-sm" />}
|
||||
onClick={close}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
// Window controls and logo only, for screens outside the router (crash screen): no links,
|
||||
// no server data, so it keeps working whatever broke
|
||||
export function MinimalTitleBar() {
|
||||
return (
|
||||
<div class="flex h-titlebar shrink-0 items-center gap-sm px-sm">
|
||||
<span class="flex h-5.5 w-12.25 translate-x-[2.17px] items-center justify-center text-special">
|
||||
<SlimevrLogoIcon
|
||||
aria-hidden="true"
|
||||
style={{ '--icon-size': '49.66px' }}
|
||||
/>
|
||||
</span>
|
||||
<span class="flex h-full items-center" data-electron-drag-region="true">
|
||||
SlimeVR
|
||||
</span>
|
||||
<div class="h-full flex-1" data-electron-drag-region="true" />
|
||||
<Show when={platform.window}>
|
||||
{(api) => <WindowControls api={api()} />}
|
||||
</Show>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function TitleBar() {
|
||||
const onSettings = useMatch(() => `${paths.settings}/*`);
|
||||
const [versionEl, setVersionEl] = createSignal<HTMLAnchorElement>();
|
||||
const commitTipId = createUniqueId();
|
||||
|
||||
return (
|
||||
<MotionRegion
|
||||
orientation="horizontal"
|
||||
class="flex h-titlebar shrink-0 items-center gap-sm px-sm"
|
||||
>
|
||||
<div class="hidden shell:contents">
|
||||
<PlainLink
|
||||
to={paths.home}
|
||||
label="navbar-home"
|
||||
class="h-5.5 w-12.25 justify-center text-special"
|
||||
>
|
||||
<span class="flex translate-x-[2.17px]">
|
||||
<SlimevrLogoIcon
|
||||
aria-hidden="true"
|
||||
style={{ '--icon-size': '49.66px' }}
|
||||
/>
|
||||
</span>
|
||||
</PlainLink>
|
||||
<span class="flex h-full items-center" data-electron-drag-region="true">
|
||||
SlimeVR
|
||||
</span>
|
||||
</div>
|
||||
<div class={onSettings() ? 'hidden shell:contents' : 'contents'}>
|
||||
<PlainLink
|
||||
ref={setVersionEl}
|
||||
href={RELEASES_URL}
|
||||
describedBy={commitTipId}
|
||||
class="
|
||||
h-5.5 shrink-0 rounded-lg bg-success/20 px-3 font-bold whitespace-nowrap text-success
|
||||
select-text
|
||||
"
|
||||
>
|
||||
{VERSION}
|
||||
</PlainLink>
|
||||
<Tooltip id={commitTipId} anchor={versionEl}>
|
||||
{__COMMIT_HASH__}
|
||||
</Tooltip>
|
||||
</div>
|
||||
<Show when={onSettings() && localIp()}>
|
||||
{(ip) => (
|
||||
<span class="rounded-md bg-special/20 px-sm font-bold text-special select-text">
|
||||
{ip()}
|
||||
</span>
|
||||
)}
|
||||
</Show>
|
||||
<Show when={platform.window && serverUpdate()}>
|
||||
<TextButton
|
||||
variant="ghost"
|
||||
size="small"
|
||||
iconOnly
|
||||
label="titlebar-update"
|
||||
icon={<DownloadIcon />}
|
||||
onClick={openUpdate}
|
||||
/>
|
||||
</Show>
|
||||
<div class="h-full flex-1" data-electron-drag-region="true" />
|
||||
<TextButton
|
||||
variant="ghost"
|
||||
size="small"
|
||||
iconOnly
|
||||
label="titlebar-search"
|
||||
icon={<SearchIcon />}
|
||||
onClick={openQuickSearch}
|
||||
/>
|
||||
<TextButton
|
||||
to={paths.settings}
|
||||
variant="ghost"
|
||||
size="small"
|
||||
iconOnly
|
||||
label="titlebar-settings"
|
||||
icon={<GearIcon />}
|
||||
/>
|
||||
<div class="hidden shell:contents">
|
||||
<TextButton
|
||||
variant="ghost"
|
||||
size="small"
|
||||
iconOnly
|
||||
label="titlebar-docs"
|
||||
icon={<QuestionIcon />}
|
||||
onClick={() => platform.openUrl(DOCS_SITE)}
|
||||
/>
|
||||
</div>
|
||||
<Show when={platform.window}>
|
||||
{(api) => <WindowControls api={api()} />}
|
||||
</Show>
|
||||
</MotionRegion>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9d02c57155f8011a4363e242f3c195633450477b19ca5784ecf9b28df5401143
|
||||
size 460668
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:78bcd8987b35612739dfc8f556f6da497f689b26e96f5267b9a008ea9f46bd14
|
||||
size 592038
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d54e1a99c1c228d004d2c94d3e1ed49f0cc14d7a471b71130fe89aa1518acc73
|
||||
size 438548
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:76d5b68294770112ee3d97cddcf5751008df2cb3a372655e7611d4db231243fc
|
||||
size 139344
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:71fa8383b0fde387e91e88c0f95eb057ad62905df8ac78c89ade1627ad17b0b3
|
||||
size 21360
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:76c1f559ecc11239e2f126eb76ae4c2e097a26f227a915de7127db4f61eafc40
|
||||
size 27230
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:13b7a9177af9378284c4eca264590deae6654b8b92c00d9ca948628c16dd118f
|
||||
size 22590
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:fd98226b28ed3f68b5a6fa03dada951fc4326c56119d59fcad09fef261053446
|
||||
size 155016
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:fe7893c1645174eee669dfa9e7222c55638c8d498eb126a397a6df759c028919
|
||||
size 28604
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c71f29809334563348f8f29cf41afeb8bedbbd5ba2875bf40621b011ac52d2d3
|
||||
size 30678
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8b00c02450258536066870137876f4fe1882d4e4b6fc4ab9f32ad46220ed5efa
|
||||
size 52158
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:faabda8027d550b10723457a8274962b3b8d9eb906cbac0c73d20916e6633e95
|
||||
size 13558
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8bd89b59087cc0f019ca2179fcc57d99811c327cdd6b1fd6e57705f7299aa2ae
|
||||
size 14402
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:38aebca5266f47270dc60c4682022809e43676ac9b3dd4b5a586ce3157f8a8a0
|
||||
size 99786
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b40baa0413d30f5df34eb7bd7e8867cb73905a098fd7398de67a2d60b3882070
|
||||
size 152284
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:31e6929b6176244f53e85088812f5cc4e7b94679039688f929b21b8e1bb985e7
|
||||
size 94060
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6e95853b79d711826f454fcc48e5d4ffd608a74e13aff2c7aa8628730362dd0f
|
||||
size 154508
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f6dc4d54b43844a85099941b64a9b92cba0f58ebe33dc61a48e12536f20174b3
|
||||
size 130492
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9cfe4aa1ed1422df92dd34952331cdf4dddcac4f6135b96bc1f5e112276deef5
|
||||
size 46890
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1a9f7a0b082efc151cf0147a6e2194ce686a86751a7d168f5052fef5ef2e9890
|
||||
size 20458
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f7b2bf36937133e653a83f2523e51cb40f372622a347c19fef94a2e45ee2f913
|
||||
size 67850
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:fce09373239c8f1781b9f8deba8b9fe7b70b0b7acdd1ae7de82841c44507bf83
|
||||
size 70686
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:18789a9b9bdadb09a6e016ca998cceace5d2ac371ce9f21b094d4e26f741b20d
|
||||
size 58344
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:305526056be521e08af825f81c14461008137656c8d5ae2cde278958071c5d19
|
||||
size 27460
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6c40f36772015ce29eb6916e08b2fb3735b837dba4a6d0de253fc879ffb5119a
|
||||
size 92960
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:78530533994a3515947123a5fb9d495c5c18698fc0a7894e3d6f5ae68bf8683c
|
||||
size 241652
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:37a2e21db039c707632467bea72ceada8fbbe89f6dcf71efa90761f6efd7df4c
|
||||
size 243576
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:63c95f09e4ad1b2ad33c008c18344cdbbacfbc923f0817ce999aed27e2e621f3
|
||||
size 226052
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:fb48ab063b7628e0236ec90982301a0f1b34a8f04e74e6e01944834f857ed5e1
|
||||
size 308426
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:cd154cda0e1dd0258e6ac7f945b9e965b586ce110c1476e7765d4f486e9c129d
|
||||
size 224468
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:448bda8904bb72de261f035ef23ad90bad33f3ced17180dc1c8a50391c6c587c
|
||||
size 229804
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:963bc302f6a88d613c4907d2ece6802198b5e2d7147360ce9f5d9024e014c02d
|
||||
size 219678
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:771d3c1222073db09ea45a4afe4fd79e18a16592733eb73e8614865d4f442114
|
||||
size 371974
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:57ca3e79eb5dadc9861462f54e0bdf74e96885b8dcc961bb134de2f8c383a21c
|
||||
size 174124
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c369d04af7f341fe50811b74532962f02048b46a69690d0ebbbc59123e674c99
|
||||
size 302760
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:90abbb29202768f5e12d2bdeaa020b8bd831faf39decf309ae714d6ea0196fa5
|
||||
size 268014
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4ec384b4afdf344eefe66674e675a3e7dbc34f1e9212c2a7d21ec1426bec7238
|
||||
size 35321
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4691ba3c289538e2578f7e366421031963fae6d593418fb8fb94b8ed0bd53453
|
||||
size 27421
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8180983bcdd98afc329b23b8fbe549d448b861e625926f19cfef1f1d17e96713
|
||||
size 183196
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9ffeb4e7c6ff95dc4e5d4b648f9dc79e58463410e7e3b2261213643e7c05e4a1
|
||||
size 40841
|
||||
@@ -0,0 +1,16 @@
|
||||
import type { SpriteAsset } from '@/lib/assets';
|
||||
import curious from './sprites/curious-slime.webp?url';
|
||||
import happy from './sprites/happy-slime.webp?url';
|
||||
import jumping from './sprites/jumping-slime.webp?url';
|
||||
import sad from './sprites/sad-slime.webp?url';
|
||||
|
||||
// Lossless sheets of the original slime GIFs (6286c50ef^), 300px frames.
|
||||
// Rebuild one with ffmpeg: `fps=1000/<frameMs>` on the GIF repeats frames
|
||||
// onto the tick, then `tile=<columns>x<rows>:color=0x00000000` and
|
||||
// `-c:v libwebp -lossless 1`. 13 columns keeps sheets under 4096px.
|
||||
export const slimes = {
|
||||
happy: { src: happy, frames: 56, columns: 13, rows: 5, frameMs: 80 },
|
||||
sad: { src: sad, frames: 48, columns: 13, rows: 4, frameMs: 80 },
|
||||
jumping: { src: jumping, frames: 14, columns: 13, rows: 2, frameMs: 80 },
|
||||
curious: { src: curious, frames: 33, columns: 13, rows: 3, frameMs: 90 },
|
||||
} as const satisfies Record<string, SpriteAsset>;
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:34815b0f9071d7b9be492c8093a3be34e7f4b2a889612056d0b21fce0902cf19
|
||||
size 48912
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c9af45e58483237a532a32f1ab0c1940d473b393fb1302161b5c6eceedc96b4d
|
||||
size 7519
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:10809600a3d25da9b2509e69ad76dc455eaadf8682d6c3112cda6cfcff9caa4c
|
||||
size 7918
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1c157326536d34d357384cb8f8221ea7b60b5ea864c1479d579843300735a70a
|
||||
size 7539
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:fbcd300219427218ea6d78a0c139154f70568c798de49c79799f7d23f8298361
|
||||
size 49848
|
||||
Loaded 100 of 1437 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user