Line
Link Here
|
|
|
|
QÈNwýÂTC2q¯dakJëêÝ n»ê4aCNÔPÉoõÌÒ^.?´Ñ_}úîPÆ5¸~Ï ª`°®#ÿûÙï¸uä« ¡R/¢s}ÖVW'ÙÆwÖO;T»$]îGº#äø daô´|ýX0ìKÔáèδ>àÕ9©¤i~ÂtÆ>92¡J¡X9:Ãr* ¨½¥*ì-¡º"«xq¶pM íî¾Øåfé¸m!Eô·nMYênË5;E#:d[VÁñ³ð¨öàBRE?4H2xéÇÒä<î²9Ý.õ û#ðBMFÝ¡>e°Ñð-3^G]9ÐM%¾à°ïOëßkL(ÆJ£ÐЫõÌkÇeßÑSÝMì:$ݺ½áv±p5V(Â@|NGÍè£ë
3RµòòxÝâ³î0¤96ÈØÚOæÅé)L¨âxÕ£áVÐ^ÿìHIÛw1Ü móÖ¹ |
1 |
"ª¼¡ê§Ó8¸×Ú¯Jcájúͽ:ý{IfW]ʪH9]M+ãR=¦Ý ÔLé?@wnáºQV³p÷Î5åkþetæ±W§÷&itÜ@< ,T fóÉdÓ·ÕN/W#°'5ßaÕ¬¼nõU*®½40ãteÃþW§bïéÀÒ³¦ÊöÀ׫)|Ùß¿¶ñj¶ß©ÊVa Ñ ç¿æUtÖÕHè^c6ÜôÒwÇ¿Xµcuè»óþ¹Z+;SÔâ_a;Wþm©yëå _&ý½Ì8YjuÜÝy=tM¯à¯fp£{ôÚ#
ëBJf£ðaÞ§÷¨UPû¾
ûmxòlaFúp6Ç.ýP nM+ X°ixFîQhuæÞ+ |
|
0Å6سQêYJÛQT-IïVFFéäðQüÁQ $LÄ=! Ý0¨ÏÉWTͤoxÚǯBÙ?åVùxö;ã¡ñ?ÉýH"HÇ
tÿW^ï4m"4µ^ð_J}- |
2 |
0Å6سQêYJÛQT-IïVFFéäðQüÁQ $LÄ=! Ý0¨ÏÉWTͤoxÚǯBÙ?åVùxö;ã¡ñ?ÉýH"HÇ
tÿW^ï4m"4µ^ð_J}- |
1 |
³ Få·OVØUÎ̽äÈ}73HÝLìPàNB¶ÑöëÖ¯c+Ö°¥js+ÛÍYº]¸û6Ûa®C<±ÿMb>üG5|ä0l_¢«gX uüR/L{õ$86Ùá6>Pº0Ò'ÌÖ¦!qÛíÑWÐu\±+ÓÏ>¥d©Hb&CjÁß~
åÇÖ°JÅÁ~¶°êão¿KgáiüÓ()Ç#ås¬MrÅó÷é
²yØêþhi®\æÒÓáñÞÊ=ð#¶æ<j?Mì«fòÞ6%p-¯X[ó·Ã׿åÀÀ Âu8ÁÒW"Í~è²[¸¯èÆõÊ
ýGMºÏSÞ&4é;72e|¢Ñ}uÉÒçã
´EÄÜiBÎNÙ¸¬bM¾0í~¬ôüÄÛùKL¡}ÞQ`iGÀ©6d ,äy7)ðLlàsIæÉ÷Úq1Ì wè&Õ
O!äÓ_BÄ;[B\ |
3 |
àñ}PÇvð¡Mõ»¨ðjtT'ÑFØnNyQÄ\
É©ùo»|oÕ©ÒHÛöEÃ#"YD³ÿÅ.ðôÈ]Öá¬Õò/³õàý0`bSQè¬ÇÀ/8áû·©"ÝÜ.¼Å¡ Ì+2o^RûJð$SNäKæá)hòù±uHæio¦VØWw |
2 |
×S?V¡½ÕJj éÖzèûóæô{Ð]gzº¢!¾4Ùe,w(^a!áÊG[_( åÂå¨4uìhà,ŵ
ì$
?bI8í® q@DÎÈAqy±6Mu{cð]xøíhÃi@°sÙC/¡ûü}4Ø(D,ÕÉQ|îìÞX °¶¹ÿ$Z(Çh[ÅÓãÌek5÷4Qèåk¼3Ý$¾WÍåUYEäüþDÒ¤vjvïðhZ |
|
|
3 |
1£Ûg¿ÁVT½;Ñ»éòìÏ;´×ËU!ØTbµªÐ$)ýzàѳ2Ðyõ Â!Zz`p:Ì~iÏly(ÝC0vÒÐÎnõKRþCµðDVE$).,é NÖQ[È û¼07³=a³ÆOQ¤;â7ªuÆëxË~&É5º±*ïù
ºLlFÞËÏ FF;ÇI[lªLÈSµvþ¾÷íȪXl)ý~sÂ@ùGÊ®mÎÿðÖþøÁ]fÜøÝ¡4éùùBý¨»´XÇä#½©è4I |
4 |
1£Ûg¿ÁVT½;Ñ»éòìÏ;´×ËU!ØTbµªÐ$)ýzàѳ2Ðyõ Â!Zz`p:Ì~iÏly(ÝC0vÒÐÎnõKRþCµðDVE$).,é NÖQ[È û¼07³=a³ÆOQ¤;â7ªuÆëxË~&É5º±*ïù
ºLlFÞËÏ FF;ÇI[lªLÈSµvþ¾÷íȪXl)ý~sÂ@ùGÊ®mÎÿðÖþøÁ]fÜøÝ¡4éùùBý¨»´XÇä#½©è4I |
4 |
+e@LüÇi"AÄ·àTÇGÏü1a/jå<HbìÞiTËÝDø×I !H·14\r&O:>åujýðmS6q/vãÌ[U~
Ì@mæ!+PÜÈäL?õdæ*CäÐÃÓZV1Çì7¡E+×ß½ª24üLá£_åtÜmóö¶"èÇzôYâJ³´/J9sb9NЫiQÞ±¢UØïu |
5 |
+e@LüÇi"AÄ·àTÇGÏü1a/jå<HbìÞiTËÝDø×I !H·14\r&O:>åujýðmS6q/vãÌ[U~
Ì@mæ!+PÜÈäL?õdæ*CäÐÃÓZV1Çì7¡E+×ß½ª24üLá£_åtÜmóö¶"èÇzôYâJ³´/J9sb9NЫiQÞ±¢UØïu |
5 |
#C¶ÚEå»Y;ËÞÝHù²éaF-gòÀt¹ËÑt¶ÔÀÁßV§8¹sONJâi2bMi+µ~`²IØP |
6 |
#C¶ÚEå»Y;ËÞÝHù²éaF-gòÀt¹ËÑt¶ÔÀÁßV§8¹sONJâi2bMi+µ~`²IØP |
6 |
´±¼Ù°Zé 6CîÓGVò¡Ð14Asg~×LÒ@á³?õtZtôð¥ÐeÉY0ø7oeý¢ds¶!EѶkñëÊ&¢XoHJÂÿó&¦ b
â¡ÐûG4²·ÜVMàÔ1 |
7 |
´±¼Ù°Zé 6CîÓGVò¡Ð14Asg~×LÒ@á³?õtZtôð¥ÐeÉY0ø7oeý¢ds¶!EѶkñëÊ&¢XoHJÂÿó&¦ b
â¡ÐûG4²·ÜVMàÔ1 |
7 |
²~=Ð |
8 |
²~=Ð |
|
|
9 |
eaa©Ega[|5èÔ"o.í*ãÿùeø. #ÙUÒW»2ò0÷e> |
10 |
L¾ |
11 |
+"%ÃK,Â]y@¨> ÙõD]æãS'ð,*Wtlièùà<UÜ@t\<UUÁhõµÑôGa³CI*³Ñþ"Ç!4^ØA§ Ì1\^õ|îÕøUÿûg3t&ä}FzÊY÷'NZyw2P7Üût8YBÏ.c`xÙÌÙK&ŤvkÖ£ÏÑß!}ª8ɤt²±Á°Í_ó=FÇHÞXpÿËYþ:åx
<
s^äÂ&ôIêGOÉjLC«èhzÊiDxo]òY «ÝpQÍWØÍ/¤{ºáÀÁ¢fs6ÿävåÓ:iS×.ª³²(Ê
Åùz´¿æ[Â"Û¤<_¨N6h:ÏqEúBV |
Lines 23-28
Link Here
|
23 |
#include "platform.h" |
23 |
#include "platform.h" |
24 |
#include "config.h" |
24 |
#include "config.h" |
25 |
#include "sdl.h" |
25 |
#include "sdl.h" |
|
|
26 |
#include "x11_sdl.h" |
26 |
|
27 |
|
27 |
#include "audio/audio.h" |
28 |
#include "audio/audio.h" |
28 |
#include "video/video.h" |
29 |
#include "video/video.h" |
Lines 42-47
Link Here
|
42 |
#include <client.h> |
43 |
#include <client.h> |
43 |
#include <discover.h> |
44 |
#include <discover.h> |
44 |
|
45 |
|
|
|
46 |
#include <time.h> |
45 |
#include <stdio.h> |
47 |
#include <stdio.h> |
46 |
#include <stdlib.h> |
48 |
#include <stdlib.h> |
47 |
#include <stdbool.h> |
49 |
#include <stdbool.h> |
Lines 52-58
Link Here
|
52 |
#include <netinet/in.h> |
54 |
#include <netinet/in.h> |
53 |
#include <netdb.h> |
55 |
#include <netdb.h> |
54 |
#include <arpa/inet.h> |
56 |
#include <arpa/inet.h> |
55 |
#include <openssl/rand.h> |
|
|
56 |
|
57 |
|
57 |
static void applist(PSERVER_DATA server) { |
58 |
static void applist(PSERVER_DATA server) { |
58 |
PAPP_LIST list = NULL; |
59 |
PAPP_LIST list = NULL; |
Lines 139-146
Link Here
|
139 |
connection_debug = true; |
140 |
connection_debug = true; |
140 |
} |
141 |
} |
141 |
|
142 |
|
142 |
if (IS_EMBEDDED(system)) |
143 |
if (IS_EMBEDDED(system)) { |
143 |
loop_init(); |
144 |
loop_init(); |
|
|
145 |
if (!isNoSdl) |
146 |
x11_sdl_init(); |
147 |
} |
144 |
|
148 |
|
145 |
platform_start(system); |
149 |
platform_start(system); |
146 |
LiStartConnection(&server->serverInfo, &config->stream, &connection_callbacks, platform_get_video(system), platform_get_audio(system, config->audio_device), NULL, drFlags, config->audio_device, 0); |
150 |
LiStartConnection(&server->serverInfo, &config->stream, &connection_callbacks, platform_get_video(system), platform_get_audio(system, config->audio_device), NULL, drFlags, config->audio_device, 0); |
Lines 148-154
Link Here
|
148 |
if (IS_EMBEDDED(system)) { |
152 |
if (IS_EMBEDDED(system)) { |
149 |
if (!config->viewonly) |
153 |
if (!config->viewonly) |
150 |
evdev_start(); |
154 |
evdev_start(); |
151 |
loop_main(); |
155 |
if (!isNoSdl) |
|
|
156 |
x11_sdl_loop_main(config->stream.width, config->stream.height); |
157 |
else |
158 |
loop_main(); |
152 |
if (!config->viewonly) |
159 |
if (!config->viewonly) |
153 |
evdev_stop(); |
160 |
evdev_stop(); |
154 |
} |
161 |
} |
Lines 202-208
Link Here
|
202 |
printf("\t-bitrate <bitrate>\tSpecify the bitrate in Kbps\n"); |
209 |
printf("\t-bitrate <bitrate>\tSpecify the bitrate in Kbps\n"); |
203 |
printf("\t-packetsize <size>\tSpecify the maximum packetsize in bytes\n"); |
210 |
printf("\t-packetsize <size>\tSpecify the maximum packetsize in bytes\n"); |
204 |
printf("\t-codec <codec>\t\tSelect used codec: auto/h264/h265/av1 (default auto)\n"); |
211 |
printf("\t-codec <codec>\t\tSelect used codec: auto/h264/h265/av1 (default auto)\n"); |
205 |
printf("\t-hdr\t\tEnable HDR streaming (experimental, requires host and device support)\n"); |
|
|
206 |
printf("\t-remote <yes/no/auto>\t\t\tEnable optimizations for WAN streaming (default auto)\n"); |
212 |
printf("\t-remote <yes/no/auto>\t\t\tEnable optimizations for WAN streaming (default auto)\n"); |
207 |
printf("\t-app <app>\t\tName of app to stream\n"); |
213 |
printf("\t-app <app>\t\tName of app to stream\n"); |
208 |
printf("\t-nosops\t\t\tDon't allow GFE to modify game settings\n"); |
214 |
printf("\t-nosops\t\t\tDon't allow GFE to modify game settings\n"); |
Lines 251-258
Link Here
|
251 |
exit(-1); |
257 |
exit(-1); |
252 |
} |
258 |
} |
253 |
|
259 |
|
254 |
evdev_create(config.inputs[0], NULL, config.debug_level > 0, config.rotate); |
260 |
if (isNoSdl) { |
255 |
evdev_map(config.inputs[0]); |
261 |
evdev_create(config.inputs[0], NULL, config.debug_level > 0, config.rotate); |
|
|
262 |
evdev_map(config.inputs[0]); |
263 |
} |
256 |
exit(0); |
264 |
exit(0); |
257 |
} |
265 |
} |
258 |
|
266 |
|
Lines 300-306
Link Here
|
300 |
if (config.debug_level > 0) { |
308 |
if (config.debug_level > 0) { |
301 |
printf("GPU: %s, GFE: %s (%s, %s)\n", server.gpuType, server.serverInfo.serverInfoGfeVersion, server.gsVersion, server.serverInfo.serverInfoAppVersion); |
309 |
printf("GPU: %s, GFE: %s (%s, %s)\n", server.gpuType, server.serverInfo.serverInfoGfeVersion, server.gsVersion, server.serverInfo.serverInfoAppVersion); |
302 |
printf("Server codec flags: 0x%x\n", server.serverInfo.serverCodecModeSupport); |
310 |
printf("Server codec flags: 0x%x\n", server.serverInfo.serverCodecModeSupport); |
303 |
} |
311 |
} |
304 |
|
312 |
|
305 |
if (strcmp("list", config.action) == 0) { |
313 |
if (strcmp("list", config.action) == 0) { |
306 |
pair_check(&server); |
314 |
pair_check(&server); |
Lines 322-340
Link Here
|
322 |
config.stream.supportedVideoFormats = VIDEO_FORMAT_H264; |
330 |
config.stream.supportedVideoFormats = VIDEO_FORMAT_H264; |
323 |
if (config.codec == CODEC_HEVC || (config.codec == CODEC_UNSPECIFIED && platform_prefers_codec(system, CODEC_HEVC))) { |
331 |
if (config.codec == CODEC_HEVC || (config.codec == CODEC_UNSPECIFIED && platform_prefers_codec(system, CODEC_HEVC))) { |
324 |
config.stream.supportedVideoFormats |= VIDEO_FORMAT_H265; |
332 |
config.stream.supportedVideoFormats |= VIDEO_FORMAT_H265; |
325 |
if (config.hdr) |
333 |
//if (config.hdr) |
326 |
config.stream.supportedVideoFormats |= VIDEO_FORMAT_H265_MAIN10; |
334 |
// config.stream.supportedVideoFormats |= VIDEO_FORMAT_H265_MAIN10; |
327 |
} |
335 |
} |
328 |
if (config.codec == CODEC_AV1 || (config.codec == CODEC_UNSPECIFIED && platform_prefers_codec(system, CODEC_AV1))) { |
336 |
if (config.codec == CODEC_AV1 || (config.codec == CODEC_UNSPECIFIED && platform_prefers_codec(system, CODEC_AV1))) { |
329 |
config.stream.supportedVideoFormats |= VIDEO_FORMAT_AV1_MAIN8; |
337 |
config.stream.supportedVideoFormats |= VIDEO_FORMAT_AV1_MAIN8; |
330 |
if (config.hdr) |
338 |
//if (config.hdr) |
331 |
config.stream.supportedVideoFormats |= VIDEO_FORMAT_AV1_MAIN10; |
339 |
// config.stream.supportedVideoFormats |= VIDEO_FORMAT_AV1_MAIN10; |
332 |
} |
340 |
} |
333 |
|
341 |
|
334 |
if (config.hdr && !(config.stream.supportedVideoFormats & VIDEO_FORMAT_MASK_10BIT)) { |
342 |
//if (config.hdr && !(config.stream.supportedVideoFormats & VIDEO_FORMAT_MASK_10BIT)) { |
335 |
fprintf(stderr, "HDR streaming requires HEVC or AV1 codec\n"); |
343 |
// fprintf(stderr, "HDR streaming requires HEVC or AV1 codec\n"); |
336 |
exit(-1); |
344 |
// exit(-1); |
337 |
} |
345 |
//} |
338 |
|
346 |
|
339 |
#ifdef HAVE_SDL |
347 |
#ifdef HAVE_SDL |
340 |
if (system == SDL) |
348 |
if (system == SDL) |
Lines 371-377
Link Here
|
371 |
|
379 |
|
372 |
udev_init(!inputAdded, mappings, config.debug_level > 0, config.rotate); |
380 |
udev_init(!inputAdded, mappings, config.debug_level > 0, config.rotate); |
373 |
evdev_init(config.mouse_emulation); |
381 |
evdev_init(config.mouse_emulation); |
374 |
rumble_handler = evdev_rumble; |
382 |
if (isNoSdl) |
|
|
383 |
rumble_handler = evdev_rumble; |
384 |
else { |
385 |
sdlinput_init(config.mapping); |
386 |
rumble_handler = sdlinput_rumble; |
387 |
rumble_triggers_handler = sdlinput_rumble_triggers; |
388 |
set_motion_event_state_handler = sdlinput_set_motion_event_state; |
389 |
set_controller_led_handler = sdlinput_set_controller_led; |
390 |
} |
375 |
#ifdef HAVE_LIBCEC |
391 |
#ifdef HAVE_LIBCEC |
376 |
cec_init(); |
392 |
cec_init(); |
377 |
#endif /* HAVE_LIBCEC */ |
393 |
#endif /* HAVE_LIBCEC */ |
Lines 398-404
Link Here
|
398 |
if (config.pin > 0 && config.pin <= 9999) { |
414 |
if (config.pin > 0 && config.pin <= 9999) { |
399 |
sprintf(pin, "%04d", config.pin); |
415 |
sprintf(pin, "%04d", config.pin); |
400 |
} else { |
416 |
} else { |
401 |
sprintf(pin, "%d%d%d%d", (unsigned)random() % 10, (unsigned)random() % 10, (unsigned)random() % 10, (unsigned)random() % 10); |
417 |
srand((unsigned)time(NULL)); |
|
|
418 |
sprintf(pin, "%04d", (unsigned)rand() % 9999 + 1); |
402 |
} |
419 |
} |
403 |
printf("Please enter the following PIN on the target PC: %s\n", pin); |
420 |
printf("Please enter the following PIN on the target PC: %s\n", pin); |
404 |
fflush(stdout); |
421 |
fflush(stdout); |
Lines 77-84
Link Here
|
77 |
bool x11 = strcmp(name, "x11") == 0; |
77 |
bool x11 = strcmp(name, "x11") == 0; |
78 |
bool vdpau = strcmp(name, "x11_vdpau") == 0; |
78 |
bool vdpau = strcmp(name, "x11_vdpau") == 0; |
79 |
bool vaapi = strcmp(name, "x11_vaapi") == 0; |
79 |
bool vaapi = strcmp(name, "x11_vaapi") == 0; |
80 |
if (std || x11 || vdpau || vaapi) { |
80 |
if (x11 || vdpau || vaapi) { |
81 |
int init = x11_init(std || vdpau, std || vaapi); |
81 |
int init = x11_init(vdpau, vaapi); |
82 |
#ifdef HAVE_VAAPI |
82 |
#ifdef HAVE_VAAPI |
83 |
if (init == INIT_VAAPI) |
83 |
if (init == INIT_VAAPI) |
84 |
return X11_VAAPI; |
84 |
return X11_VAAPI; |
Lines 87-104
Link Here
|
87 |
if (init == INIT_VDPAU) |
87 |
if (init == INIT_VDPAU) |
88 |
return X11_VDPAU; |
88 |
return X11_VDPAU; |
89 |
#endif |
89 |
#endif |
90 |
#ifdef HAVE_SDL |
|
|
91 |
return SDL; |
92 |
#else |
93 |
return X11; |
90 |
return X11; |
94 |
#endif |
|
|
95 |
} |
91 |
} |
96 |
#endif |
92 |
#endif |
97 |
#ifdef HAVE_SDL |
93 |
#ifdef HAVE_SDL |
98 |
if (std || strcmp(name, "sdl") == 0) |
94 |
if (std || strcmp(name, "sdl") == 0) |
99 |
return SDL; |
95 |
return SDL; |
100 |
#endif |
96 |
#endif |
101 |
|
|
|
102 |
if (strcmp(name, "fake") == 0) |
97 |
if (strcmp(name, "fake") == 0) |
103 |
return FAKE; |
98 |
return FAKE; |
104 |
|
99 |
|
Lines 109-122
Link Here
|
109 |
switch (system) { |
104 |
switch (system) { |
110 |
#ifdef HAVE_AML |
105 |
#ifdef HAVE_AML |
111 |
case AML: |
106 |
case AML: |
112 |
write_bool("/sys/class/graphics/fb0/blank", true); |
107 |
blank_fb("/sys/class/graphics/fb0/blank", true); |
113 |
write_bool("/sys/class/graphics/fb1/blank", true); |
108 |
blank_fb("/sys/class/graphics/fb1/blank", true); |
114 |
write_bool("/sys/class/video/disable_video", false); |
109 |
blank_fb("/sys/class/video/disable_video", false); |
115 |
break; |
110 |
break; |
116 |
#endif |
111 |
#endif |
117 |
#if defined(HAVE_PI) || defined(HAVE_MMAL) |
112 |
#if defined(HAVE_PI) || defined(HAVE_MMAL) |
118 |
case PI: |
113 |
case PI: |
119 |
write_bool("/sys/class/graphics/fb0/blank", true); |
114 |
blank_fb("/sys/class/graphics/fb0/blank", true); |
120 |
break; |
115 |
break; |
121 |
#endif |
116 |
#endif |
122 |
} |
117 |
} |
Lines 126-138
Link Here
|
126 |
switch (system) { |
121 |
switch (system) { |
127 |
#ifdef HAVE_AML |
122 |
#ifdef HAVE_AML |
128 |
case AML: |
123 |
case AML: |
129 |
write_bool("/sys/class/graphics/fb0/blank", false); |
124 |
blank_fb("/sys/class/graphics/fb0/blank", false); |
130 |
write_bool("/sys/class/graphics/fb1/blank", false); |
125 |
blank_fb("/sys/class/graphics/fb1/blank", false); |
131 |
break; |
126 |
break; |
132 |
#endif |
127 |
#endif |
133 |
#if defined(HAVE_PI) || defined(HAVE_MMAL) |
128 |
#if defined(HAVE_PI) || defined(HAVE_MMAL) |
134 |
case PI: |
129 |
case PI: |
135 |
write_bool("/sys/class/graphics/fb0/blank", false); |
130 |
blank_fb("/sys/class/graphics/fb0/blank", false); |
136 |
break; |
131 |
break; |
137 |
#endif |
132 |
#endif |
138 |
} |
133 |
} |
Lines 195-207
Link Here
|
195 |
// fall-through |
190 |
// fall-through |
196 |
#endif |
191 |
#endif |
197 |
default: |
192 |
default: |
198 |
#ifdef HAVE_PULSE |
193 |
return &audio_callbacks_oss; |
199 |
if (audio_pulse_init(audio_device)) |
|
|
200 |
return &audio_callbacks_pulse; |
201 |
#endif |
202 |
#ifdef HAVE_ALSA |
203 |
return &audio_callbacks_alsa; |
204 |
#endif |
205 |
} |
194 |
} |
206 |
return NULL; |
195 |
return NULL; |
207 |
} |
196 |
} |
Lines 38-47
Link Here
|
38 |
#include <limits.h> |
38 |
#include <limits.h> |
39 |
#include <unistd.h> |
39 |
#include <unistd.h> |
40 |
#include <pthread.h> |
40 |
#include <pthread.h> |
41 |
#include <endian.h> |
41 |
#include <sys/endian.h> |
42 |
#include <math.h> |
42 |
#include <math.h> |
43 |
|
43 |
|
44 |
#if __BYTE_ORDER == __LITTLE_ENDIAN |
44 |
extern bool isNoSdl; |
|
|
45 |
bool iskeyboardgrab = true; |
46 |
|
47 |
#if _BYTE_ORDER == _LITTLE_ENDIAN |
45 |
#define int16_to_le(val) val |
48 |
#define int16_to_le(val) val |
46 |
#else |
49 |
#else |
47 |
#define int16_to_le(val) ((((val) >> 8) & 0x00FF) | (((val) << 8) & 0xFF00)) |
50 |
#define int16_to_le(val) ((((val) >> 8) & 0x00FF) | (((val) << 8) & 0xFF00)) |
Lines 66-73
Link Here
|
66 |
int hats_state[3][2]; |
69 |
int hats_state[3][2]; |
67 |
int fd; |
70 |
int fd; |
68 |
char modifiers; |
71 |
char modifiers; |
69 |
__s32 mouseDeltaX, mouseDeltaY, mouseVScroll, mouseHScroll; |
72 |
int32_t mouseDeltaX, mouseDeltaY, mouseVScroll, mouseHScroll; |
70 |
__s32 touchDownX, touchDownY, touchX, touchY; |
73 |
int32_t touchDownX, touchDownY, touchX, touchY; |
71 |
struct timeval touchDownTime; |
74 |
struct timeval touchDownTime; |
72 |
struct timeval btnDownTime; |
75 |
struct timeval btnDownTime; |
73 |
short controllerId; |
76 |
short controllerId; |
Lines 127-132
Link Here
|
127 |
|
130 |
|
128 |
#define ACTION_MODIFIERS (MODIFIER_SHIFT|MODIFIER_ALT|MODIFIER_CTRL) |
131 |
#define ACTION_MODIFIERS (MODIFIER_SHIFT|MODIFIER_ALT|MODIFIER_CTRL) |
129 |
#define QUIT_KEY KEY_Q |
132 |
#define QUIT_KEY KEY_Q |
|
|
133 |
#define UNGRAB_KEY KEY_G |
130 |
#define QUIT_BUTTONS (PLAY_FLAG|BACK_FLAG|LB_FLAG|RB_FLAG) |
134 |
#define QUIT_BUTTONS (PLAY_FLAG|BACK_FLAG|LB_FLAG|RB_FLAG) |
131 |
|
135 |
|
132 |
static bool (*handler) (struct input_event*, struct input_device*); |
136 |
static bool (*handler) (struct input_event*, struct input_device*); |
Lines 247-254
Link Here
|
247 |
deltaY = pow((float)rawY / 32767.0f * MOUSE_EMULATION_MOTION_MULTIPLIER, 3); |
251 |
deltaY = pow((float)rawY / 32767.0f * MOUSE_EMULATION_MOTION_MULTIPLIER, 3); |
248 |
|
252 |
|
249 |
// Enforce deadzones |
253 |
// Enforce deadzones |
250 |
deltaX = fabs(deltaX) > MOUSE_EMULATION_DEADZONE ? deltaX - MOUSE_EMULATION_DEADZONE : 0; |
254 |
deltaX = abs(deltaX) > MOUSE_EMULATION_DEADZONE ? deltaX - MOUSE_EMULATION_DEADZONE : 0; |
251 |
deltaY = fabs(deltaY) > MOUSE_EMULATION_DEADZONE ? deltaY - MOUSE_EMULATION_DEADZONE : 0; |
255 |
deltaY = abs(deltaY) > MOUSE_EMULATION_DEADZONE ? deltaY - MOUSE_EMULATION_DEADZONE : 0; |
252 |
|
256 |
|
253 |
if (deltaX != 0 || deltaY != 0) |
257 |
if (deltaX != 0 || deltaY != 0) |
254 |
LiSendMouseMoveEvent(deltaX, -deltaY); |
258 |
LiSendMouseMoveEvent(deltaX, -deltaY); |
Lines 343-349
Link Here
|
343 |
if (dev->mouseHScroll != 0) { |
347 |
if (dev->mouseHScroll != 0) { |
344 |
LiSendHScrollEvent(dev->mouseHScroll); |
348 |
LiSendHScrollEvent(dev->mouseHScroll); |
345 |
dev->mouseHScroll = 0; |
349 |
dev->mouseHScroll = 0; |
346 |
} |
350 |
} |
347 |
if (dev->gamepadModified) { |
351 |
if (dev->gamepadModified) { |
348 |
if (dev->controllerId < 0) { |
352 |
if (dev->controllerId < 0) { |
349 |
for (int i = 0; i < MAX_GAMEPADS; i++) { |
353 |
for (int i = 0; i < MAX_GAMEPADS; i++) { |
Lines 404-409
Link Here
|
404 |
return true; |
408 |
return true; |
405 |
} else if (waitingToExitOnModifiersUp && dev->modifiers == 0) |
409 |
} else if (waitingToExitOnModifiersUp && dev->modifiers == 0) |
406 |
return false; |
410 |
return false; |
|
|
411 |
if ((dev->modifiers & ACTION_MODIFIERS) == ACTION_MODIFIERS && |
412 |
ev->code == UNGRAB_KEY && ev->value != 0) { |
413 |
grab_keyboard(); |
414 |
} |
407 |
|
415 |
|
408 |
short code = 0x80 << 8 | keyCodes[ev->code]; |
416 |
short code = 0x80 << 8 | keyCodes[ev->code]; |
409 |
LiSendKeyboardEvent(code, ev->value?KEY_ACTION_DOWN:KEY_ACTION_UP, dev->modifiers); |
417 |
LiSendKeyboardEvent(code, ev->value?KEY_ACTION_DOWN:KEY_ACTION_UP, dev->modifiers); |
Lines 813-819
Link Here
|
813 |
if (mappings == NULL && strstr(name, "Xbox 360 Wireless Receiver") != NULL) |
821 |
if (mappings == NULL && strstr(name, "Xbox 360 Wireless Receiver") != NULL) |
814 |
mappings = xwc_mapping; |
822 |
mappings = xwc_mapping; |
815 |
|
823 |
|
816 |
bool is_keyboard = libevdev_has_event_code(evdev, EV_KEY, KEY_Q); |
824 |
bool is_keyboard = libevdev_has_event_code(evdev, EV_KEY, KEY_Q) && libevdev_get_id_version(evdev) < 500; |
817 |
bool is_mouse = libevdev_has_event_type(evdev, EV_REL) || libevdev_has_event_code(evdev, EV_KEY, BTN_LEFT); |
825 |
bool is_mouse = libevdev_has_event_type(evdev, EV_REL) || libevdev_has_event_code(evdev, EV_KEY, BTN_LEFT); |
818 |
bool is_touchscreen = libevdev_has_event_code(evdev, EV_KEY, BTN_TOUCH); |
826 |
bool is_touchscreen = libevdev_has_event_code(evdev, EV_KEY, BTN_TOUCH); |
819 |
|
827 |
|
Lines 850-855
Link Here
|
850 |
} |
858 |
} |
851 |
|
859 |
|
852 |
if (is_gamepad) { |
860 |
if (is_gamepad) { |
|
|
861 |
// stop to using SDL,test if break is better |
862 |
if (!isNoSdl) { |
863 |
libevdev_free(evdev); |
864 |
close(fd); |
865 |
return; |
866 |
} |
853 |
evdev_gamepads++; |
867 |
evdev_gamepads++; |
854 |
|
868 |
|
855 |
if (mappings == NULL) { |
869 |
if (mappings == NULL) { |
Lines 1055-1063
Link Here
|
1055 |
// we're ready to take input events. Ctrl+C works up until |
1069 |
// we're ready to take input events. Ctrl+C works up until |
1056 |
// this point. |
1070 |
// this point. |
1057 |
for (int i = 0; i < numDevices; i++) { |
1071 |
for (int i = 0; i < numDevices; i++) { |
1058 |
if ((devices[i].is_keyboard || devices[i].is_mouse || devices[i].is_touchscreen) && ioctl(devices[i].fd, EVIOCGRAB, 1) < 0) { |
1072 |
if ((devices[i].is_mouse || devices[i].is_touchscreen) && ioctl(devices[i].fd, EVIOCGRAB, 1) < 0) { |
1059 |
fprintf(stderr, "EVIOCGRAB failed with error %d\n", errno); |
1073 |
fprintf(stderr, "EVIOCGRAB failed with error %d\n", errno); |
1060 |
} |
1074 |
} |
|
|
1075 |
if (devices[i].is_keyboard && libevdev_get_id_bustype(devices[i].dev) > 3) { |
1076 |
if (ioctl(devices[i].fd, EVIOCGRAB, 1) < 0) |
1077 |
fprintf(stderr, "EVIOCGRAB failed with error %d\n", errno); |
1078 |
} |
1061 |
} |
1079 |
} |
1062 |
|
1080 |
|
1063 |
// Any new input devices detected after this point will be grabbed immediately |
1081 |
// Any new input devices detected after this point will be grabbed immediately |
Lines 1111-1114
Link Here
|
1111 |
event.value = 1; |
1129 |
event.value = 1; |
1112 |
write(device->fd, (const void*) &event, sizeof(event)); |
1130 |
write(device->fd, (const void*) &event, sizeof(event)); |
1113 |
device->haptic_effect_id = effect.id; |
1131 |
device->haptic_effect_id = effect.id; |
|
|
1132 |
} |
1133 |
|
1134 |
void grab_keyboard() { |
1135 |
int grabnum; |
1136 |
if (iskeyboardgrab) { |
1137 |
grabnum = 0; |
1138 |
iskeyboardgrab = false; |
1139 |
} else { |
1140 |
grabnum = 1; |
1141 |
iskeyboardgrab = true; |
1142 |
} |
1143 |
for (int i = 0; i < numDevices; i++) { |
1144 |
if (devices[i].is_keyboard && libevdev_get_id_bustype(devices[i].dev) > 3) { |
1145 |
if (ioctl(devices[i].fd, EVIOCGRAB, grabnum) < 0) |
1146 |
fprintf(stderr, "EVIOCGRAB failed with error %d\n", errno); |
1147 |
} |
1148 |
} |
1114 |
} |
1149 |
} |
Lines 537-543
Link Here
|
537 |
RAND_bytes(client_secret_data, sizeof(client_secret_data)); |
537 |
RAND_bytes(client_secret_data, sizeof(client_secret_data)); |
538 |
|
538 |
|
539 |
const ASN1_BIT_STRING *asnSignature; |
539 |
const ASN1_BIT_STRING *asnSignature; |
|
|
540 |
#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) |
540 |
X509_get0_signature(&asnSignature, NULL, cert); |
541 |
X509_get0_signature(&asnSignature, NULL, cert); |
|
|
542 |
#else |
543 |
asnSignature = cert->signature; |
544 |
#endif |
541 |
|
545 |
|
542 |
char challenge_response[16 + SIGNATURE_LEN + sizeof(client_secret_data)]; |
546 |
char challenge_response[16 + SIGNATURE_LEN + sizeof(client_secret_data)]; |
543 |
char challenge_response_hash[32]; |
547 |
char challenge_response_hash[32]; |
Lines 73-78
Link Here
|
73 |
int http_request(char* url, PHTTP_DATA data) { |
73 |
int http_request(char* url, PHTTP_DATA data) { |
74 |
curl_easy_setopt(curl, CURLOPT_WRITEDATA, data); |
74 |
curl_easy_setopt(curl, CURLOPT_WRITEDATA, data); |
75 |
curl_easy_setopt(curl, CURLOPT_URL, url); |
75 |
curl_easy_setopt(curl, CURLOPT_URL, url); |
|
|
76 |
curl_easy_setopt(curl, CURLOPT_TCP_FASTOPEN, 1L); |
77 |
curl_easy_setopt(curl, CURLOPT_FRESH_CONNECT, 1); |
78 |
curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, 1); |
76 |
|
79 |
|
77 |
if (debug) |
80 |
if (debug) |
78 |
printf("Request %s\n", url); |
81 |
printf("Request %s\n", url); |