FreeBSD Bugzilla – Attachment 245178 Details for
Bug 274026
games/moonlight-embedded update to 2.6.0
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
games/moonlight-embedded patch for the ports in ports tree.
moonlight-embedded-new.patch (text/plain), 41.31 KB, created by
Armin Zhu
on 2023-09-24 07:25:46 UTC
(
hide
)
Description:
games/moonlight-embedded patch for the ports in ports tree.
Filename:
MIME Type:
Creator:
Armin Zhu
Created:
2023-09-24 07:25:46 UTC
Size:
41.31 KB
patch
obsolete
>From 9a5fcc17f9a9186960e9f0b4d8128b84fd69677f Mon Sep 17 00:00:00 2001 >From: Armin Zhu <lisp_25689@163.com> >Date: Sun, 24 Sep 2023 14:30:00 +0800 >Subject: [PATCH 1/2] patch version > >--- > Makefile | 16 +-- > distinfo | 6 +- > files/patch-CMakeLists.txt | 45 +++++++ > files/patch-docs_CMakeLists.txt | 8 ++ > files/patch-docs_README.pod | 117 ++++++++++++++++++ > files/patch-libgamestream_CMakeLists.txt | 29 +++++ > files/patch-libgamestream_client.c | 8 +- > files/patch-libgamestream_http.c | 12 ++ > files/patch-src_audio_audio.h | 7 ++ > files/patch-src_audio_oss.c | 105 ++++++++++++++++ > files/patch-src_input_evdev.c | 98 ++++++++++++++- > files/patch-src_main.c | 64 ++++++++++ > files/patch-src_platform.c | 31 ++++- > files/patch-src_video_ffmpeg__vaapi.c | 19 +++ > ...rty_moonlight-common-c_enet_CMakeLists.txt | 14 +++ > pkg-descr | 5 + > 16 files changed, 556 insertions(+), 28 deletions(-) > create mode 100644 files/patch-CMakeLists.txt > create mode 100644 files/patch-docs_CMakeLists.txt > create mode 100644 files/patch-docs_README.pod > create mode 100644 files/patch-libgamestream_CMakeLists.txt > create mode 100644 files/patch-libgamestream_http.c > create mode 100644 files/patch-src_audio_audio.h > create mode 100644 files/patch-src_audio_oss.c > create mode 100644 files/patch-src_main.c > create mode 100644 files/patch-src_video_ffmpeg__vaapi.c > create mode 100644 files/patch-third__party_moonlight-common-c_enet_CMakeLists.txt > >diff --git a/Makefile b/Makefile >index 425304a..2772983 100644 >--- a/Makefile >+++ b/Makefile >@@ -1,12 +1,11 @@ > PORTNAME= moonlight-embedded >-DISTVERSION= 2.5.3 >-PORTREVISION= 2 >+DISTVERSION= 2.6.0 > CATEGORIES= games >-MASTER_SITES= https://github.com/irtimmer/moonlight-embedded/releases/download/v${DISTVERSION}/ >+MASTER_SITES= https://github.com/moonlight-stream/moonlight-embedded/releases/download/v${DISTVERSION}/ > >-MAINTAINER= ports@FreeBSD.org >+MAINTAINER= lisp_25689@163.com > COMMENT= Gamestream client >-WWW= https://github.com/irtimmer/moonlight-embedded >+WWW= https://github.com/moonlight-stream/moonlight-embedded > > LICENSE= GPLv3+ > LICENSE_FILE= ${WRKSRC}/LICENSE >@@ -32,13 +31,6 @@ CFLAGS+= -DHAS_SOCKLEN_T=1 -I${LOCALBASE}/include/libepoll-shim/ > LDFLAGS+= -lepoll-shim > > post-patch: >- @${REINPLACE_CMD} -e '/(ALSA)/d' \ >- -e '/libpulse-simple/d' \ >- -e '/libcec/d' \ >- ${WRKSRC}/CMakeLists.txt >- @${REINPLACE_CMD} -e 's@SHARED@STATIC@' \ >- -e 's@OpenSSL 1.0.2@OpenSSL@' -e '/^install(/d' \ >- ${WRKSRC}/libgamestream/CMakeLists.txt > @${REINPLACE_CMD} -e 's@/etc/moonlight/moonlight.conf@${PREFIX}/etc/moonlight.conf@' \ > -e 's@moonligt@moonlight@g' \ > ${WRKSRC}/docs/README.pod >diff --git a/distinfo b/distinfo >index 54aac48..40634ce 100644 >--- a/distinfo >+++ b/distinfo >@@ -1,3 +1,3 @@ >-TIMESTAMP = 1666188557 >-SHA256 (moonlight-embedded-2.5.3.tar.xz) = 2fcd00049f58b0af882f0eec7077013c062bc35c8705f3d6bb7949d44e98fac0 >-SIZE (moonlight-embedded-2.5.3.tar.xz) = 303180 >+TIMESTAMP = 1695536824 >+SHA256 (moonlight-embedded-2.6.0.tar.xz) = 71c883e10c65085c82a75c9affaef5e63f43d9074df74d48039d8c9b83120df7 >+SIZE (moonlight-embedded-2.6.0.tar.xz) = 324572 >diff --git a/files/patch-CMakeLists.txt b/files/patch-CMakeLists.txt >new file mode 100644 >index 0000000..d520a17 >--- /dev/null >+++ b/files/patch-CMakeLists.txt >@@ -0,0 +1,45 @@ >+--- CMakeLists.txt.orig 2023-09-24 06:11:13 UTC >++++ CMakeLists.txt >+@@ -5,14 +5,11 @@ SET(CMAKE_C_STANDARD 99) >+ include(${CMAKE_ROOT}/Modules/GNUInstallDirs.cmake) >+ include(${CMAKE_SOURCE_DIR}/cmake/generate_version_header.cmake) >+ >+-add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-pointer-sign -Wno-sign-compare -Wno-switch) >+- >+ aux_source_directory(./src SRC_LIST) >+ list(APPEND SRC_LIST ./src/input/evdev.c ./src/input/mapping.c ./src/input/udev.c) >+ >+ set(MOONLIGHT_DEFINITIONS) >+ >+-find_package(ALSA) >+ find_package(Opus REQUIRED) >+ find_package(Broadcom-OMX) >+ find_package(Freescale) >+@@ -46,10 +43,8 @@ if (ENABLE_FFMPEG) >+ endif() >+ endif() >+ if (ENABLE_PULSE) >+- pkg_check_modules(PULSE libpulse-simple) >+ endif() >+ if (ENABLE_CEC) >+- pkg_check_modules(CEC libcec>=4) >+ endif() >+ >+ pkg_check_modules(MMAL mmal) >+@@ -91,7 +86,6 @@ if (CEC_FOUND) >+ list(APPEND MOONLIGHT_DEFINITIONS HAVE_LIBCEC) >+ list(APPEND MOONLIGHT_OPTIONS CEC) >+ target_sources(moonlight PRIVATE ./src/input/cec.c) >+- target_include_directories(moonlight PRIVATE ./third_party/libcec ${CEC_INCLUDE_DIRS}) >+ target_link_libraries(moonlight ${CEC_LIBRARIES}) >+ endif() >+ >+@@ -158,7 +152,7 @@ if (SOFTWARE_FOUND) >+ if(X11_FOUND) >+ list(APPEND MOONLIGHT_DEFINITIONS HAVE_X11) >+ list(APPEND MOONLIGHT_OPTIONS X11) >+- target_sources(moonlight PRIVATE ./src/video/x11.c ./src/video/egl.c ./src/input/x11.c) >++ target_sources(moonlight PRIVATE ./src/video/x11.c ./src/video/egl.c ./src/input/x11.c ./src/audio/oss.c) >+ target_include_directories(moonlight PRIVATE ${XLIB_INCLUDE_DIRS} ${EGL_INCLUDE_DIRS} ${GLES_INCLUDE_DIRS}) >+ target_link_libraries(moonlight ${XLIB_LIBRARIES} ${EGL_LIBRARIES} ${GLES_LIBRARIES}) >+ endif() >diff --git a/files/patch-docs_CMakeLists.txt b/files/patch-docs_CMakeLists.txt >new file mode 100644 >index 0000000..f0c5066 >--- /dev/null >+++ b/files/patch-docs_CMakeLists.txt >@@ -0,0 +1,8 @@ >+--- docs/CMakeLists.txt.orig 2023-09-24 06:11:13 UTC >++++ docs/CMakeLists.txt >+@@ -1,4 +1,4 @@ >+-add_custom_command(OUTPUT moonlight.1 COMMAND pod2man --section=1 --center="Moonlight Embedded Manual" --name="MOONLIGHT" --release="moonlight 2.5.0" ${CMAKE_CURRENT_SOURCE_DIR}/README.pod > moonlight.1) >++add_custom_command(OUTPUT moonlight.1 COMMAND pod2man --section=1 --center="Moonlight Embedded Manual" --name="MOONLIGHT" --release="moonlight 2.6.0" ${CMAKE_CURRENT_SOURCE_DIR}/README.pod > moonlight.1) >+ add_custom_target(docs ALL DEPENDS moonlight.1) >+ >+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/moonlight.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) >diff --git a/files/patch-docs_README.pod b/files/patch-docs_README.pod >new file mode 100644 >index 0000000..ffbc371 >--- /dev/null >+++ b/files/patch-docs_README.pod >@@ -0,0 +1,117 @@ >+--- docs/README.pod.orig 2023-09-24 06:11:13 UTC >++++ docs/README.pod >+@@ -27,6 +27,11 @@ Stream game from host to this computer. >+ >+ List all available games and application on host. >+ >++=item B<discover> >++ >++Discover moonlight server host.Need start avahi-daemon first. >++NOTE:It's not work under wifibox. >++ >+ =item B<quit> >+ >+ Quit the current running game or application on host. >+@@ -99,9 +104,9 @@ By default, 1392 is used on LAN and 1024 on WAN. >+ =item B<-codec> [I<CODEC>] >+ >+ Select codec to use. >+-Can be 'auto', 'h264', 'h265', 'hevc', or 'av1'. >+-Not all video decoders support H.265/HEVC or AV1. >+-Will still use H.264 if server doesn't support HEVC or AV1. >++Can be 'auto', 'h264', 'h265', 'hevc' or 'av1'. >++Not all video decoders do support H.265/HEVC. >++Will still use H.264 if server doesn't support HEVC. >+ >+ =item B<-remote> [I<yes/no/auto>] >+ >+@@ -138,8 +143,10 @@ By default the gamecontrollerdb.txt provided by Moonli >+ =item B<-platform> [I<PLATFORM>] >+ >+ Select platform for audio and video output and input. >+-<PLATFORM> can be pi, imx, aml, x11, x11_vdpau, sdl or fake. >++<PLATFORM> can be x11, x11_vaapi, x11_vdpau, sdl or fake. >+ >++NOTE:x11_vaapi need libva library be installed.For intel,install libva-intel-driver/libva-intel-media-driver >++ >+ =item B<-nounsupported> >+ >+ Don't stream if resolution is not officially supported by the server >+@@ -156,6 +163,10 @@ Disable all input processing (view-only mode) >+ >+ Disable gamepad mouse emulation (activated by long pressing Start button) >+ >++=item B<-nosdl> >++ >++Not Recommented.Use evdev instead of SDL to drive gamepad. >++ >+ =item B<-verbose> >+ >+ Enable verbose output >+@@ -170,11 +181,6 @@ Enable the I<INPUT> device. >+ By default all available input devices are enabled. >+ Only evdev devices /dev/input/event* are supported. >+ >+-=item B<-audio> [I<DEVICE>] >+- >+-Use <DEVICE> as audio output device. >+-The default value is 'sysdefault' for ALSA and 'hdmi' for OMX on the Raspberry Pi. >+- >+ =item B<-windowed> >+ >+ Display the stream in a window instead of fullscreen. >+@@ -182,22 +188,49 @@ Only available when X11 or SDL platform is used. >+ >+ =back >+ >++=head1 EXAMPLE >++ >++Pair: >++ # moonlight pair 192.168.0.1 >++ >++Connect: >++ The following cmd means to connect 192.168.0.1 with a resolution 2560x1600. >++ # moonlight stream -app Desktop -width 2560 -height 1600 192.168.0.1 >++ The following cmd means to connect 192.168.0.1 with a resolution 1080p and the fps 120.And try to decoding with GPU. >++ # moonlight stream -app Steam -width 1920 -height 1080 -fps 120 -platform 'x11_vaapi' 192.168.0.1 >++ >+ =head1 CONFIG FILE >+ >+ Moonlight Embedded will load a confiuration file from: >+ >+- $XDG_CONFIG_HOME/moonligt/moonlight.conf (fallback to ~/.config/moonligt/moonlight.conf) >++ $XDG_CONFIG_HOME/moonlight/moonlight.conf (fallback to ~/.config/moonlight/moonlight.conf) >+ >+ If no user specified configuration file is available the configuration will be loaded from: >+ >+- /etc/moonlight/moonlight.conf >++ /usr/local/etc/moonlight.conf >+ >+-A documented example configuration file can be found at /etc/moonlight/moonlight.conf. >++A documented example configuration file can be found at /usr/local/etc/moonlight.conf. >+ >+-=head1 COMMENTS >++=head1 KEYBOARD SHORTCUTS >+ >+ Use Ctrl+Alt+Shift+Q or Play+Back+LeftShoulder+RightShoulder to quit the streaming session. >++Use Ctrl+Alt+Shift+G to grab or ungrab keyboard.(only x11* platform) >+ >++=head1 GAMEPAD >++ >++FreeBSD supports fewer controllers.Please see hgame(4) xb360gp(4) ps4dshock(4) and FreeBSD forums... >++There is a problem with the evdev drive gamepad,so -nosdl is not recommended.But you can try it yourself. >++ >++=head1 COMMENTS >++ >++Platform 'sdl' and 'x11' is soft decoding. >++Platform 'x11_vaapi' and 'x11_vdpau' is hard decoding. >++If you want to use GPU decoding,you must meet 3 conditions: >++ 1.Use platform 'x11_vaapi' or 'x11_vdpau'. >++ 2.Use Intel or AMD(not test) GPU driver in xorg.conf >++ 3.Install package:libva-intel-driver/libva-intel-media-driver or libva-vdpau-driver. >++ >+ =head1 AUTHOR >+ >+-Iwan Timmer E<lt>irtimmer@gmail.comE<gt> >++Thanks Iwan Timmer and every contributor! >++Armin Zhu E<lt>lisp_25689@163.comE<gt> >diff --git a/files/patch-libgamestream_CMakeLists.txt b/files/patch-libgamestream_CMakeLists.txt >new file mode 100644 >index 0000000..1163b0a >--- /dev/null >+++ b/files/patch-libgamestream_CMakeLists.txt >@@ -0,0 +1,29 @@ >+--- libgamestream/CMakeLists.txt.orig 2023-09-24 06:11:13 UTC >++++ libgamestream/CMakeLists.txt >+@@ -3,7 +3,7 @@ set(SO_VERSION 4) >+ find_package(LibUUID REQUIRED) >+ find_package(Threads REQUIRED) >+ find_package(CURL REQUIRED) >+-find_package(OpenSSL 1.0.2 REQUIRED) >++find_package(OpenSSL REQUIRED) >+ find_package(EXPAT REQUIRED) >+ >+ pkg_check_modules(AVAHI REQUIRED avahi-client) >+@@ -15,9 +15,9 @@ aux_source_directory(../third_party/moonlight-common-c >+ aux_source_directory(../third_party/moonlight-common-c/src MOONLIGHT_COMMON_SRC_LIST) >+ aux_source_directory(../third_party/moonlight-common-c/reedsolomon MOONLIGHT_COMMON_SRC_LIST) >+ >+-add_library(moonlight-common SHARED ${MOONLIGHT_COMMON_SRC_LIST}) >++add_library(moonlight-common STATIC ${MOONLIGHT_COMMON_SRC_LIST}) >+ >+-add_library(gamestream SHARED ${GAMESTREAM_SRC_LIST}) >++add_library(gamestream STATIC ${GAMESTREAM_SRC_LIST}) >+ target_link_libraries(gamestream moonlight-common) >+ >+ set_target_properties(gamestream PROPERTIES SOVERSION ${SO_VERSION} VERSION ${PROJECT_VERSION}) >+@@ -28,5 +28,3 @@ target_include_directories(moonlight-common PRIVATE .. >+ target_link_libraries(gamestream ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES} ${EXPAT_LIBRARIES} ${AVAHI_LIBRARIES} ${LIBUUID_LIBRARIES}) >+ >+ target_link_libraries(gamestream ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS}) >+- >+-install(TARGETS gamestream moonlight-common DESTINATION ${CMAKE_INSTALL_LIBDIR}) >diff --git a/files/patch-libgamestream_client.c b/files/patch-libgamestream_client.c >index 5ff3659..fb91cac 100644 >--- a/files/patch-libgamestream_client.c >+++ b/files/patch-libgamestream_client.c >@@ -1,7 +1,7 @@ >---- libgamestream/client.c.orig 2018-08-11 15:43:13 UTC >+--- libgamestream/client.c.orig 2023-09-24 06:11:13 UTC > +++ libgamestream/client.c >-@@ -505,7 +505,11 @@ int gs_pair(PSERVER_DATA server, char* pin) { >- RAND_bytes(client_secret_data, 16); >+@@ -537,7 +537,11 @@ int gs_pair(PSERVER_DATA server, char* pin) { >+ RAND_bytes(client_secret_data, sizeof(client_secret_data)); > > const ASN1_BIT_STRING *asnSignature; > +#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) >@@ -10,5 +10,5 @@ > + asnSignature = cert->signature; > +#endif > >- char challenge_response[16 + 256 + 16]; >+ char challenge_response[16 + SIGNATURE_LEN + sizeof(client_secret_data)]; > char challenge_response_hash[32]; >diff --git a/files/patch-libgamestream_http.c b/files/patch-libgamestream_http.c >new file mode 100644 >index 0000000..932da60 >--- /dev/null >+++ b/files/patch-libgamestream_http.c >@@ -0,0 +1,12 @@ >+--- libgamestream/http.c.orig 2023-09-24 06:11:13 UTC >++++ libgamestream/http.c >+@@ -73,6 +73,9 @@ int http_init(const char* keyDirectory, int logLevel) >+ int http_request(char* url, PHTTP_DATA data) { >+ curl_easy_setopt(curl, CURLOPT_WRITEDATA, data); >+ curl_easy_setopt(curl, CURLOPT_URL, url); >++ curl_easy_setopt(curl, CURLOPT_TCP_FASTOPEN, 1L); >++ curl_easy_setopt(curl, CURLOPT_FRESH_CONNECT, 1); >++ curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, 1); >+ >+ if (debug) >+ printf("Request %s\n", url); >diff --git a/files/patch-src_audio_audio.h b/files/patch-src_audio_audio.h >new file mode 100644 >index 0000000..43f1aa6 >--- /dev/null >+++ b/files/patch-src_audio_audio.h >@@ -0,0 +1,7 @@ >+--- src/audio/audio.h.orig 2023-09-24 06:11:13 UTC >++++ src/audio/audio.h >+@@ -31,3 +31,4 @@ extern AUDIO_RENDERER_CALLBACKS audio_callbacks_sdl; >+ extern AUDIO_RENDERER_CALLBACKS audio_callbacks_pulse; >+ bool audio_pulse_init(char* audio_device); >+ #endif >++extern AUDIO_RENDERER_CALLBACKS audio_callbacks_oss; >diff --git a/files/patch-src_audio_oss.c b/files/patch-src_audio_oss.c >new file mode 100644 >index 0000000..28d1acd >--- /dev/null >+++ b/files/patch-src_audio_oss.c >@@ -0,0 +1,105 @@ >+--- src/audio/oss.c.orig 2023-09-24 06:11:13 UTC >++++ src/audio/oss.c >+@@ -0,0 +1,102 @@ >++/* >++ * This file is part of Moonlight Embedded. >++ * >++ * Copyright (C) 2015-2017 Iwan Timmer >++ * >++ * Moonlight is free software; you can redistribute it and/or modify >++ * it under the terms of the GNU General Public License as published by >++ * the Free Software Foundation; either version 3 of the License, or >++ * (at your option) any later version. >++ * >++ * Moonlight is distributed in the hope that it will be useful, >++ * but WITHOUT ANY WARRANTY; without even the implied warranty of >++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >++ * GNU General Public License for more details. >++ * >++ * You should have received a copy of the GNU General Public License >++ * along with Moonlight; if not, see <http://www.gnu.org/licenses/>. >++ */ >++ >++#include <sys/soundcard.h> >++#include "audio.h" >++ >++#include <stdio.h> >++#include <opus_multistream.h> >++ >++#include <sys/ioctl.h> >++#include <unistd.h> >++#include <fcntl.h> >++ >++static OpusMSDecoder* decoder; >++static short* pcmBuffer; >++static int samplesPerFrame; >++static int channelCount; >++static int fd; >++ >++static int oss_renderer_init(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusConfig, void* context, int arFlags) { >++ int rc; >++ decoder = opus_multistream_decoder_create(opusConfig->sampleRate, opusConfig->channelCount, opusConfig->streams, opusConfig->coupledStreams, opusConfig->mapping, &rc); >++ >++ channelCount = opusConfig->channelCount; >++ samplesPerFrame = opusConfig->samplesPerFrame; >++ pcmBuffer = malloc(sizeof(short) * channelCount * samplesPerFrame); >++ if (pcmBuffer == NULL) >++ return -1; >++ >++ char* oss_name = "/dev/dsp"; >++ fd = open(oss_name, O_WRONLY); >++ // buffer size for fragment ,selector 12 is 4096;11 is 2048;10 is 1024; 13is 8192 >++ if (fd == -1) { >++ close(fd); >++ printf("Open audio device /dev/dsp faild!!!"); >++ return -1; >++ } >++ int frag = 12; >++ if (ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &frag) == -1) >++ printf("Set framgment for /dev/dsp faild."); >++ >++ int format = AFMT_S16_LE; >++ int channels = opusConfig->channelCount; >++ int rate = opusConfig->sampleRate; >++ if (ioctl(fd, SNDCTL_DSP_SETFMT, &format) == -1) >++ printf("Set framgment for /dev/dsp faild."); >++ if (ioctl(fd, SNDCTL_DSP_CHANNELS, &channels) == -1) >++ printf("Set channels for /dev/dsp faild."); >++ if (ioctl(fd, SNDCTL_DSP_SPEED, &rate) == -1) >++ printf("Set sameple rate for /dev/dsp faild."); >++ >++ return 0; >++} >++ >++static void oss_renderer_cleanup() { >++ if (decoder != NULL) { >++ opus_multistream_decoder_destroy(decoder); >++ decoder = NULL; >++ } >++ >++ if (pcmBuffer != NULL) { >++ free(pcmBuffer); >++ pcmBuffer = NULL; >++ } >++ >++ if (fd != 0) { >++ close(fd); >++ fd = 0; >++ } >++} >++ >++static void oss_renderer_decode_and_play_sample(char* data, int length) { >++ int decodeLen = opus_multistream_decode(decoder, data, length, pcmBuffer, samplesPerFrame, 0); >++ if (decodeLen > 0) { >++ write(fd, pcmBuffer, decodeLen * channelCount * sizeof(short)); >++ } else { >++ printf("Opus error from decode: %d\n", decodeLen); >++ } >++} >++ >++AUDIO_RENDERER_CALLBACKS audio_callbacks_oss = { >++ .init = oss_renderer_init, >++ .cleanup = oss_renderer_cleanup, >++ .decodeAndPlaySample = oss_renderer_decode_and_play_sample, >++ .capabilities = CAPABILITY_DIRECT_SUBMIT | CAPABILITY_SUPPORTS_ARBITRARY_AUDIO_DURATION, >++}; >diff --git a/files/patch-src_input_evdev.c b/files/patch-src_input_evdev.c >index 2fbd4ff..42fd0bf 100644 >--- a/files/patch-src_input_evdev.c >+++ b/files/patch-src_input_evdev.c >@@ -1,6 +1,6 @@ >---- src/input/evdev.c.orig 2021-12-20 00:24:48 UTC >+--- src/input/evdev.c.orig 2023-09-24 06:11:13 UTC > +++ src/input/evdev.c >-@@ -38,10 +38,10 @@ >+@@ -38,10 +38,13 @@ > #include <limits.h> > #include <unistd.h> > #include <pthread.h> >@@ -9,18 +9,106 @@ > #include <math.h> > > -#if __BYTE_ORDER == __LITTLE_ENDIAN >++void grab_keyboard(); >++bool iskeyboardgrab = true; >++ > +#if _BYTE_ORDER == _LITTLE_ENDIAN > #define int16_to_le(val) val > #else > #define int16_to_le(val) ((((val) >> 8) & 0x00FF) | (((val) << 8) & 0xFF00)) >-@@ -66,8 +66,8 @@ struct input_device { >+@@ -66,8 +69,8 @@ struct input_device { > int hats_state[3][2]; > int fd; > char modifiers; >-- __s32 mouseDeltaX, mouseDeltaY, mouseScroll; >+- __s32 mouseDeltaX, mouseDeltaY, mouseVScroll, mouseHScroll; > - __s32 touchDownX, touchDownY, touchX, touchY; >-+ int32_t mouseDeltaX, mouseDeltaY, mouseScroll; >++ int32_t mouseDeltaX, mouseDeltaY, mouseVScroll, mouseHScroll; > + int32_t touchDownX, touchDownY, touchX, touchY; > struct timeval touchDownTime; > struct timeval btnDownTime; > short controllerId; >+@@ -127,6 +130,7 @@ int evdev_gamepads = 0; >+ >+ #define ACTION_MODIFIERS (MODIFIER_SHIFT|MODIFIER_ALT|MODIFIER_CTRL) >+ #define QUIT_KEY KEY_Q >++#define UNGRAB_KEY KEY_G >+ #define QUIT_BUTTONS (PLAY_FLAG|BACK_FLAG|LB_FLAG|RB_FLAG) >+ >+ static bool (*handler) (struct input_event*, struct input_device*); >+@@ -247,8 +251,8 @@ void *HandleMouseEmulation(void* param) >+ deltaY = pow((float)rawY / 32767.0f * MOUSE_EMULATION_MOTION_MULTIPLIER, 3); >+ >+ // Enforce deadzones >+- deltaX = fabs(deltaX) > MOUSE_EMULATION_DEADZONE ? deltaX - MOUSE_EMULATION_DEADZONE : 0; >+- deltaY = fabs(deltaY) > MOUSE_EMULATION_DEADZONE ? deltaY - MOUSE_EMULATION_DEADZONE : 0; >++ deltaX = abs(deltaX) > MOUSE_EMULATION_DEADZONE ? deltaX - MOUSE_EMULATION_DEADZONE : 0; >++ deltaY = abs(deltaY) > MOUSE_EMULATION_DEADZONE ? deltaY - MOUSE_EMULATION_DEADZONE : 0; >+ >+ if (deltaX != 0 || deltaY != 0) >+ LiSendMouseMoveEvent(deltaX, -deltaY); >+@@ -343,7 +347,7 @@ static bool evdev_handle_event(struct input_event *ev, >+ if (dev->mouseHScroll != 0) { >+ LiSendHScrollEvent(dev->mouseHScroll); >+ dev->mouseHScroll = 0; >+- } >++ } >+ if (dev->gamepadModified) { >+ if (dev->controllerId < 0) { >+ for (int i = 0; i < MAX_GAMEPADS; i++) { >+@@ -404,6 +408,10 @@ static bool evdev_handle_event(struct input_event *ev, >+ return true; >+ } else if (waitingToExitOnModifiersUp && dev->modifiers == 0) >+ return false; >++ if ((dev->modifiers & ACTION_MODIFIERS) == ACTION_MODIFIERS && >++ ev->code == UNGRAB_KEY && ev->value != 0) { >++ grab_keyboard(); >++ } >+ >+ short code = 0x80 << 8 | keyCodes[ev->code]; >+ LiSendKeyboardEvent(code, ev->value?KEY_ACTION_DOWN:KEY_ACTION_UP, dev->modifiers); >+@@ -813,7 +821,7 @@ void evdev_create(const char* device, struct mapping* >+ if (mappings == NULL && strstr(name, "Xbox 360 Wireless Receiver") != NULL) >+ mappings = xwc_mapping; >+ >+- bool is_keyboard = libevdev_has_event_code(evdev, EV_KEY, KEY_Q); >++ bool is_keyboard = libevdev_has_event_code(evdev, EV_KEY, KEY_Q) && libevdev_get_id_version(evdev) < 500; >+ bool is_mouse = libevdev_has_event_type(evdev, EV_REL) || libevdev_has_event_code(evdev, EV_KEY, BTN_LEFT); >+ bool is_touchscreen = libevdev_has_event_code(evdev, EV_KEY, BTN_TOUCH); >+ >+@@ -1055,9 +1063,13 @@ void evdev_start() { >+ // we're ready to take input events. Ctrl+C works up until >+ // this point. >+ for (int i = 0; i < numDevices; i++) { >+- if ((devices[i].is_keyboard || devices[i].is_mouse || devices[i].is_touchscreen) && ioctl(devices[i].fd, EVIOCGRAB, 1) < 0) { >++ if ((devices[i].is_mouse || devices[i].is_touchscreen) && ioctl(devices[i].fd, EVIOCGRAB, 1) < 0) { >+ fprintf(stderr, "EVIOCGRAB failed with error %d\n", errno); >+ } >++ if (devices[i].is_keyboard && libevdev_get_id_bustype(devices[i].dev) > 3) { >++ if (ioctl(devices[i].fd, EVIOCGRAB, 1) < 0) >++ fprintf(stderr, "EVIOCGRAB failed with error %d\n", errno); >++ } >+ } >+ >+ // Any new input devices detected after this point will be grabbed immediately >+@@ -1111,4 +1123,21 @@ void evdev_rumble(unsigned short controller_id, unsign >+ event.value = 1; >+ write(device->fd, (const void*) &event, sizeof(event)); >+ device->haptic_effect_id = effect.id; >++} >++ >++void grab_keyboard() { >++ int grabnum; >++ if (iskeyboardgrab) { >++ grabnum = 0; >++ iskeyboardgrab = false; >++ } else { >++ grabnum = 1; >++ iskeyboardgrab = true; >++ } >++ for (int i = 0; i < numDevices; i++) { >++ if (devices[i].is_keyboard && libevdev_get_id_bustype(devices[i].dev) > 3) { >++ if (ioctl(devices[i].fd, EVIOCGRAB, grabnum) < 0) >++ fprintf(stderr, "EVIOCGRAB failed with error %d\n", errno); >++ } >++ } >+ } >diff --git a/files/patch-src_main.c b/files/patch-src_main.c >new file mode 100644 >index 0000000..33d5232 >--- /dev/null >+++ b/files/patch-src_main.c >@@ -0,0 +1,64 @@ >+--- src/main.c.orig 2023-09-24 06:11:13 UTC >++++ src/main.c >+@@ -42,6 +42,7 @@ >+ #include <client.h> >+ #include <discover.h> >+ >++#include <time.h> >+ #include <stdio.h> >+ #include <stdlib.h> >+ #include <stdbool.h> >+@@ -52,7 +53,6 @@ >+ #include <netinet/in.h> >+ #include <netdb.h> >+ #include <arpa/inet.h> >+-#include <openssl/rand.h> >+ >+ static void applist(PSERVER_DATA server) { >+ PAPP_LIST list = NULL; >+@@ -202,7 +202,6 @@ static void help() { >+ printf("\t-bitrate <bitrate>\tSpecify the bitrate in Kbps\n"); >+ printf("\t-packetsize <size>\tSpecify the maximum packetsize in bytes\n"); >+ printf("\t-codec <codec>\t\tSelect used codec: auto/h264/h265/av1 (default auto)\n"); >+- printf("\t-hdr\t\tEnable HDR streaming (experimental, requires host and device support)\n"); >+ printf("\t-remote <yes/no/auto>\t\t\tEnable optimizations for WAN streaming (default auto)\n"); >+ printf("\t-app <app>\t\tName of app to stream\n"); >+ printf("\t-nosops\t\t\tDon't allow GFE to modify game settings\n"); >+@@ -322,19 +321,19 @@ int main(int argc, char* argv[]) { >+ config.stream.supportedVideoFormats = VIDEO_FORMAT_H264; >+ if (config.codec == CODEC_HEVC || (config.codec == CODEC_UNSPECIFIED && platform_prefers_codec(system, CODEC_HEVC))) { >+ config.stream.supportedVideoFormats |= VIDEO_FORMAT_H265; >+- if (config.hdr) >+- config.stream.supportedVideoFormats |= VIDEO_FORMAT_H265_MAIN10; >++ //if (config.hdr) >++ // config.stream.supportedVideoFormats |= VIDEO_FORMAT_H265_MAIN10; >+ } >+ if (config.codec == CODEC_AV1 || (config.codec == CODEC_UNSPECIFIED && platform_prefers_codec(system, CODEC_AV1))) { >+ config.stream.supportedVideoFormats |= VIDEO_FORMAT_AV1_MAIN8; >+- if (config.hdr) >+- config.stream.supportedVideoFormats |= VIDEO_FORMAT_AV1_MAIN10; >++ //if (config.hdr) >++ // config.stream.supportedVideoFormats |= VIDEO_FORMAT_AV1_MAIN10; >+ } >+ >+- if (config.hdr && !(config.stream.supportedVideoFormats & VIDEO_FORMAT_MASK_10BIT)) { >+- fprintf(stderr, "HDR streaming requires HEVC or AV1 codec\n"); >+- exit(-1); >+- } >++ //if (config.hdr && !(config.stream.supportedVideoFormats & VIDEO_FORMAT_MASK_10BIT)) { >++ // fprintf(stderr, "HDR streaming requires HEVC or AV1 codec\n"); >++ // exit(-1); >++ //} >+ >+ #ifdef HAVE_SDL >+ if (system == SDL) >+@@ -398,7 +397,8 @@ int main(int argc, char* argv[]) { >+ if (config.pin > 0 && config.pin <= 9999) { >+ sprintf(pin, "%04d", config.pin); >+ } else { >+- sprintf(pin, "%d%d%d%d", (unsigned)random() % 10, (unsigned)random() % 10, (unsigned)random() % 10, (unsigned)random() % 10); >++ srand((unsigned)time(NULL)); >++ sprintf(pin, "%04d", (unsigned)rand() % 9999 + 1); >+ } >+ printf("Please enter the following PIN on the target PC: %s\n", pin); >+ fflush(stdout); >diff --git a/files/patch-src_platform.c b/files/patch-src_platform.c >index d9cddad..86d26da 100644 >--- a/files/patch-src_platform.c >+++ b/files/patch-src_platform.c >@@ -1,10 +1,32 @@ >---- src/platform.c.orig 2021-12-20 00:24:48 UTC >+--- src/platform.c.orig 2023-09-24 06:11:13 UTC > +++ src/platform.c >-@@ -188,14 +188,6 @@ AUDIO_RENDERER_CALLBACKS* platform_get_audio(enum plat >- return (PAUDIO_RENDERER_CALLBACKS) dlsym(RTLD_DEFAULT, "audio_callbacks_omx"); >+@@ -77,8 +77,8 @@ enum platform platform_check(char* name) { >+ bool x11 = strcmp(name, "x11") == 0; >+ bool vdpau = strcmp(name, "x11_vdpau") == 0; >+ bool vaapi = strcmp(name, "x11_vaapi") == 0; >+- if (std || x11 || vdpau || vaapi) { >+- int init = x11_init(std || vdpau, std || vaapi); >++ if (x11 || vdpau || vaapi) { >++ int init = x11_init(vdpau, vaapi); >+ #ifdef HAVE_VAAPI >+ if (init == INIT_VAAPI) >+ return X11_VAAPI; >+@@ -87,11 +87,7 @@ enum platform platform_check(char* name) { >+ if (init == INIT_VDPAU) >+ return X11_VDPAU; >+ #endif >+- #ifdef HAVE_SDL >+- return SDL; >+- #else >+ return X11; >+- #endif >+ } >+ #endif >+ #ifdef HAVE_SDL >+@@ -195,13 +191,7 @@ AUDIO_RENDERER_CALLBACKS* platform_get_audio(enum plat > // fall-through > #endif >-- default: >+ default: > - #ifdef HAVE_PULSE > - if (audio_pulse_init(audio_device)) > - return &audio_callbacks_pulse; >@@ -12,6 +34,7 @@ > - #ifdef HAVE_ALSA > - return &audio_callbacks_alsa; > - #endif >++ return &audio_callbacks_oss; > } > return NULL; > } >diff --git a/files/patch-src_video_ffmpeg__vaapi.c b/files/patch-src_video_ffmpeg__vaapi.c >new file mode 100644 >index 0000000..282fbaf >--- /dev/null >+++ b/files/patch-src_video_ffmpeg__vaapi.c >@@ -0,0 +1,19 @@ >+--- src/video/ffmpeg_vaapi.c.orig 2023-09-24 06:11:13 UTC >++++ src/video/ffmpeg_vaapi.c >+@@ -23,6 +23,7 @@ >+ #include <libavutil/hwcontext.h> >+ #include <libavutil/hwcontext_vaapi.h> >+ #include <X11/Xlib.h> >++#include <stdlib.h> >+ >+ #define MAX_SURFACES 16 >+ >+@@ -59,7 +60,7 @@ static int va_get_buffer(AVCodecContext* context, AVFr >+ } >+ >+ int vaapi_init_lib() { >+- return av_hwdevice_ctx_create(&device_ref, AV_HWDEVICE_TYPE_VAAPI, ":0", NULL, 0); >++ return av_hwdevice_ctx_create(&device_ref, AV_HWDEVICE_TYPE_VAAPI, getenv("DISPLAY") == NULL ? ":0" : getenv("DISPLAY"), NULL, 0); >+ } >+ >+ int vaapi_init(AVCodecContext* decoder_ctx) { >diff --git a/files/patch-third__party_moonlight-common-c_enet_CMakeLists.txt b/files/patch-third__party_moonlight-common-c_enet_CMakeLists.txt >new file mode 100644 >index 0000000..703af56 >--- /dev/null >+++ b/files/patch-third__party_moonlight-common-c_enet_CMakeLists.txt >@@ -0,0 +1,14 @@ >+--- third_party/moonlight-common-c/enet/CMakeLists.txt.orig 2023-09-24 06:11:13 UTC >++++ third_party/moonlight-common-c/enet/CMakeLists.txt >+@@ -107,11 +107,3 @@ target_include_directories(enet SYSTEM PUBLIC include) >+ if (MINGW) >+ target_link_libraries(enet winmm ws2_32) >+ endif() >+- >+-install(TARGETS enet >+- RUNTIME DESTINATION bin >+- ARCHIVE DESTINATION lib/static >+- LIBRARY DESTINATION lib) >+- >+-install(DIRECTORY include/ >+- DESTINATION include) >diff --git a/pkg-descr b/pkg-descr >index 03d3a44..5678182 100644 >--- a/pkg-descr >+++ b/pkg-descr >@@ -3,3 +3,8 @@ GameStream, as used by the NVIDIA Shield. > > Moonlight Embedded allows you to stream your full collection of games > from your powerful Windows desktop to your FreeBSD system. >+ >+First, pair: # moonlight pair 192.168.0.1 >+Then, connect: # moonlight stream -app Desktop -1080 192.168.0.1 >+ >+ENJOY! >-- >2.42.0 > > >From 8e02f82a002f31497d57055a0ab3b0a0975906e7 Mon Sep 17 00:00:00 2001 >From: Armin Zhu <lisp_25689@163.com> >Date: Sun, 24 Sep 2023 15:14:45 +0800 >Subject: [PATCH 2/2] modify again > >--- > files/patch-CMakeLists.txt | 2 +- > files/patch-docs_CMakeLists.txt | 2 +- > files/patch-docs_README.pod | 20 ++---- > files/patch-libgamestream_CMakeLists.txt | 2 +- > files/patch-libgamestream_client.c | 2 +- > files/patch-libgamestream_http.c | 2 +- > files/patch-src_audio_audio.h | 2 +- > files/patch-src_audio_oss.c | 2 +- > files/patch-src_input_evdev.c | 70 +++---------------- > files/patch-src_main.c | 2 +- > files/patch-src_platform.c | 2 +- > files/patch-src_video_ffmpeg__vaapi.c | 2 +- > ...rty_moonlight-common-c_enet_CMakeLists.txt | 2 +- > 13 files changed, 23 insertions(+), 89 deletions(-) > >diff --git a/files/patch-CMakeLists.txt b/files/patch-CMakeLists.txt >index d520a17..c5c6282 100644 >--- a/files/patch-CMakeLists.txt >+++ b/files/patch-CMakeLists.txt >@@ -1,4 +1,4 @@ >---- CMakeLists.txt.orig 2023-09-24 06:11:13 UTC >+--- CMakeLists.txt.orig 2023-09-01 23:40:56 UTC > +++ CMakeLists.txt > @@ -5,14 +5,11 @@ SET(CMAKE_C_STANDARD 99) > include(${CMAKE_ROOT}/Modules/GNUInstallDirs.cmake) >diff --git a/files/patch-docs_CMakeLists.txt b/files/patch-docs_CMakeLists.txt >index f0c5066..5e6b836 100644 >--- a/files/patch-docs_CMakeLists.txt >+++ b/files/patch-docs_CMakeLists.txt >@@ -1,4 +1,4 @@ >---- docs/CMakeLists.txt.orig 2023-09-24 06:11:13 UTC >+--- docs/CMakeLists.txt.orig 2023-09-01 23:40:56 UTC > +++ docs/CMakeLists.txt > @@ -1,4 +1,4 @@ > -add_custom_command(OUTPUT moonlight.1 COMMAND pod2man --section=1 --center="Moonlight Embedded Manual" --name="MOONLIGHT" --release="moonlight 2.5.0" ${CMAKE_CURRENT_SOURCE_DIR}/README.pod > moonlight.1) >diff --git a/files/patch-docs_README.pod b/files/patch-docs_README.pod >index ffbc371..d8bf0e7 100644 >--- a/files/patch-docs_README.pod >+++ b/files/patch-docs_README.pod >@@ -1,4 +1,4 @@ >---- docs/README.pod.orig 2023-09-24 06:11:13 UTC >+--- docs/README.pod.orig 2023-09-01 23:40:56 UTC > +++ docs/README.pod > @@ -27,6 +27,11 @@ Stream game from host to this computer. > >@@ -37,18 +37,7 @@ > =item B<-nounsupported> > > Don't stream if resolution is not officially supported by the server >-@@ -156,6 +163,10 @@ Disable all input processing (view-only mode) >- >- Disable gamepad mouse emulation (activated by long pressing Start button) >- >-+=item B<-nosdl> >-+ >-+Not Recommented.Use evdev instead of SDL to drive gamepad. >-+ >- =item B<-verbose> >- >- Enable verbose output >-@@ -170,11 +181,6 @@ Enable the I<INPUT> device. >+@@ -170,11 +177,6 @@ Enable the I<INPUT> device. > By default all available input devices are enabled. > Only evdev devices /dev/input/event* are supported. > >@@ -60,7 +49,7 @@ > =item B<-windowed> > > Display the stream in a window instead of fullscreen. >-@@ -182,22 +188,49 @@ Only available when X11 or SDL platform is used. >+@@ -182,22 +184,48 @@ Only available when X11 or SDL platform is used. > > =back > >@@ -94,12 +83,11 @@ > +=head1 KEYBOARD SHORTCUTS > > Use Ctrl+Alt+Shift+Q or Play+Back+LeftShoulder+RightShoulder to quit the streaming session. >-+Use Ctrl+Alt+Shift+G to grab or ungrab keyboard.(only x11* platform) > > +=head1 GAMEPAD > + > +FreeBSD supports fewer controllers.Please see hgame(4) xb360gp(4) ps4dshock(4) and FreeBSD forums... >-+There is a problem with the evdev drive gamepad,so -nosdl is not recommended.But you can try it yourself. >++SDL platforms have better compatibility for gamepad. > + > +=head1 COMMENTS > + >diff --git a/files/patch-libgamestream_CMakeLists.txt b/files/patch-libgamestream_CMakeLists.txt >index 1163b0a..4b13c31 100644 >--- a/files/patch-libgamestream_CMakeLists.txt >+++ b/files/patch-libgamestream_CMakeLists.txt >@@ -1,4 +1,4 @@ >---- libgamestream/CMakeLists.txt.orig 2023-09-24 06:11:13 UTC >+--- libgamestream/CMakeLists.txt.orig 2023-09-01 23:40:56 UTC > +++ libgamestream/CMakeLists.txt > @@ -3,7 +3,7 @@ set(SO_VERSION 4) > find_package(LibUUID REQUIRED) >diff --git a/files/patch-libgamestream_client.c b/files/patch-libgamestream_client.c >index fb91cac..700b97e 100644 >--- a/files/patch-libgamestream_client.c >+++ b/files/patch-libgamestream_client.c >@@ -1,4 +1,4 @@ >---- libgamestream/client.c.orig 2023-09-24 06:11:13 UTC >+--- libgamestream/client.c.orig 2023-09-01 23:40:56 UTC > +++ libgamestream/client.c > @@ -537,7 +537,11 @@ int gs_pair(PSERVER_DATA server, char* pin) { > RAND_bytes(client_secret_data, sizeof(client_secret_data)); >diff --git a/files/patch-libgamestream_http.c b/files/patch-libgamestream_http.c >index 932da60..636e06f 100644 >--- a/files/patch-libgamestream_http.c >+++ b/files/patch-libgamestream_http.c >@@ -1,4 +1,4 @@ >---- libgamestream/http.c.orig 2023-09-24 06:11:13 UTC >+--- libgamestream/http.c.orig 2023-09-01 23:40:56 UTC > +++ libgamestream/http.c > @@ -73,6 +73,9 @@ int http_init(const char* keyDirectory, int logLevel) > int http_request(char* url, PHTTP_DATA data) { >diff --git a/files/patch-src_audio_audio.h b/files/patch-src_audio_audio.h >index 43f1aa6..58f9452 100644 >--- a/files/patch-src_audio_audio.h >+++ b/files/patch-src_audio_audio.h >@@ -1,4 +1,4 @@ >---- src/audio/audio.h.orig 2023-09-24 06:11:13 UTC >+--- src/audio/audio.h.orig 2023-09-01 23:40:56 UTC > +++ src/audio/audio.h > @@ -31,3 +31,4 @@ extern AUDIO_RENDERER_CALLBACKS audio_callbacks_sdl; > extern AUDIO_RENDERER_CALLBACKS audio_callbacks_pulse; >diff --git a/files/patch-src_audio_oss.c b/files/patch-src_audio_oss.c >index 28d1acd..dfd79dd 100644 >--- a/files/patch-src_audio_oss.c >+++ b/files/patch-src_audio_oss.c >@@ -1,4 +1,4 @@ >---- src/audio/oss.c.orig 2023-09-24 06:11:13 UTC >+--- src/audio/oss.c.orig 2023-09-24 06:52:39 UTC > +++ src/audio/oss.c > @@ -0,0 +1,102 @@ > +/* >diff --git a/files/patch-src_input_evdev.c b/files/patch-src_input_evdev.c >index 42fd0bf..5daa32c 100644 >--- a/files/patch-src_input_evdev.c >+++ b/files/patch-src_input_evdev.c >@@ -1,6 +1,6 @@ >---- src/input/evdev.c.orig 2023-09-24 06:11:13 UTC >+--- src/input/evdev.c.orig 2023-09-01 23:40:56 UTC > +++ src/input/evdev.c >-@@ -38,10 +38,13 @@ >+@@ -38,10 +38,12 @@ > #include <limits.h> > #include <unistd.h> > #include <pthread.h> >@@ -9,14 +9,13 @@ > #include <math.h> > > -#if __BYTE_ORDER == __LITTLE_ENDIAN >-+void grab_keyboard(); > +bool iskeyboardgrab = true; > + > +#if _BYTE_ORDER == _LITTLE_ENDIAN > #define int16_to_le(val) val > #else > #define int16_to_le(val) ((((val) >> 8) & 0x00FF) | (((val) << 8) & 0xFF00)) >-@@ -66,8 +69,8 @@ struct input_device { >+@@ -66,8 +68,8 @@ struct input_device { > int hats_state[3][2]; > int fd; > char modifiers; >@@ -27,26 +26,7 @@ > struct timeval touchDownTime; > struct timeval btnDownTime; > short controllerId; >-@@ -127,6 +130,7 @@ int evdev_gamepads = 0; >- >- #define ACTION_MODIFIERS (MODIFIER_SHIFT|MODIFIER_ALT|MODIFIER_CTRL) >- #define QUIT_KEY KEY_Q >-+#define UNGRAB_KEY KEY_G >- #define QUIT_BUTTONS (PLAY_FLAG|BACK_FLAG|LB_FLAG|RB_FLAG) >- >- static bool (*handler) (struct input_event*, struct input_device*); >-@@ -247,8 +251,8 @@ void *HandleMouseEmulation(void* param) >- deltaY = pow((float)rawY / 32767.0f * MOUSE_EMULATION_MOTION_MULTIPLIER, 3); >- >- // Enforce deadzones >-- deltaX = fabs(deltaX) > MOUSE_EMULATION_DEADZONE ? deltaX - MOUSE_EMULATION_DEADZONE : 0; >-- deltaY = fabs(deltaY) > MOUSE_EMULATION_DEADZONE ? deltaY - MOUSE_EMULATION_DEADZONE : 0; >-+ deltaX = abs(deltaX) > MOUSE_EMULATION_DEADZONE ? deltaX - MOUSE_EMULATION_DEADZONE : 0; >-+ deltaY = abs(deltaY) > MOUSE_EMULATION_DEADZONE ? deltaY - MOUSE_EMULATION_DEADZONE : 0; >- >- if (deltaX != 0 || deltaY != 0) >- LiSendMouseMoveEvent(deltaX, -deltaY); >-@@ -343,7 +347,7 @@ static bool evdev_handle_event(struct input_event *ev, >+@@ -343,7 +345,7 @@ static bool evdev_handle_event(struct input_event *ev, > if (dev->mouseHScroll != 0) { > LiSendHScrollEvent(dev->mouseHScroll); > dev->mouseHScroll = 0; >@@ -55,18 +35,7 @@ > if (dev->gamepadModified) { > if (dev->controllerId < 0) { > for (int i = 0; i < MAX_GAMEPADS; i++) { >-@@ -404,6 +408,10 @@ static bool evdev_handle_event(struct input_event *ev, >- return true; >- } else if (waitingToExitOnModifiersUp && dev->modifiers == 0) >- return false; >-+ if ((dev->modifiers & ACTION_MODIFIERS) == ACTION_MODIFIERS && >-+ ev->code == UNGRAB_KEY && ev->value != 0) { >-+ grab_keyboard(); >-+ } >- >- short code = 0x80 << 8 | keyCodes[ev->code]; >- LiSendKeyboardEvent(code, ev->value?KEY_ACTION_DOWN:KEY_ACTION_UP, dev->modifiers); >-@@ -813,7 +821,7 @@ void evdev_create(const char* device, struct mapping* >+@@ -813,7 +815,7 @@ void evdev_create(const char* device, struct mapping* > if (mappings == NULL && strstr(name, "Xbox 360 Wireless Receiver") != NULL) > mappings = xwc_mapping; > >@@ -75,40 +44,17 @@ > bool is_mouse = libevdev_has_event_type(evdev, EV_REL) || libevdev_has_event_code(evdev, EV_KEY, BTN_LEFT); > bool is_touchscreen = libevdev_has_event_code(evdev, EV_KEY, BTN_TOUCH); > >-@@ -1055,9 +1063,13 @@ void evdev_start() { >+@@ -1055,8 +1057,12 @@ void evdev_start() { > // we're ready to take input events. Ctrl+C works up until > // this point. > for (int i = 0; i < numDevices; i++) { > - if ((devices[i].is_keyboard || devices[i].is_mouse || devices[i].is_touchscreen) && ioctl(devices[i].fd, EVIOCGRAB, 1) < 0) { > + if ((devices[i].is_mouse || devices[i].is_touchscreen) && ioctl(devices[i].fd, EVIOCGRAB, 1) < 0) { > fprintf(stderr, "EVIOCGRAB failed with error %d\n", errno); >- } >++ } > + if (devices[i].is_keyboard && libevdev_get_id_bustype(devices[i].dev) > 3) { > + if (ioctl(devices[i].fd, EVIOCGRAB, 1) < 0) > + fprintf(stderr, "EVIOCGRAB failed with error %d\n", errno); >-+ } >+ } > } > >- // Any new input devices detected after this point will be grabbed immediately >-@@ -1111,4 +1123,21 @@ void evdev_rumble(unsigned short controller_id, unsign >- event.value = 1; >- write(device->fd, (const void*) &event, sizeof(event)); >- device->haptic_effect_id = effect.id; >-+} >-+ >-+void grab_keyboard() { >-+ int grabnum; >-+ if (iskeyboardgrab) { >-+ grabnum = 0; >-+ iskeyboardgrab = false; >-+ } else { >-+ grabnum = 1; >-+ iskeyboardgrab = true; >-+ } >-+ for (int i = 0; i < numDevices; i++) { >-+ if (devices[i].is_keyboard && libevdev_get_id_bustype(devices[i].dev) > 3) { >-+ if (ioctl(devices[i].fd, EVIOCGRAB, grabnum) < 0) >-+ fprintf(stderr, "EVIOCGRAB failed with error %d\n", errno); >-+ } >-+ } >- } >diff --git a/files/patch-src_main.c b/files/patch-src_main.c >index 33d5232..6589a8a 100644 >--- a/files/patch-src_main.c >+++ b/files/patch-src_main.c >@@ -1,4 +1,4 @@ >---- src/main.c.orig 2023-09-24 06:11:13 UTC >+--- src/main.c.orig 2023-09-01 23:40:56 UTC > +++ src/main.c > @@ -42,6 +42,7 @@ > #include <client.h> >diff --git a/files/patch-src_platform.c b/files/patch-src_platform.c >index 86d26da..278ea16 100644 >--- a/files/patch-src_platform.c >+++ b/files/patch-src_platform.c >@@ -1,4 +1,4 @@ >---- src/platform.c.orig 2023-09-24 06:11:13 UTC >+--- src/platform.c.orig 2023-09-01 23:40:56 UTC > +++ src/platform.c > @@ -77,8 +77,8 @@ enum platform platform_check(char* name) { > bool x11 = strcmp(name, "x11") == 0; >diff --git a/files/patch-src_video_ffmpeg__vaapi.c b/files/patch-src_video_ffmpeg__vaapi.c >index 282fbaf..e91d34a 100644 >--- a/files/patch-src_video_ffmpeg__vaapi.c >+++ b/files/patch-src_video_ffmpeg__vaapi.c >@@ -1,4 +1,4 @@ >---- src/video/ffmpeg_vaapi.c.orig 2023-09-24 06:11:13 UTC >+--- src/video/ffmpeg_vaapi.c.orig 2023-09-01 23:40:56 UTC > +++ src/video/ffmpeg_vaapi.c > @@ -23,6 +23,7 @@ > #include <libavutil/hwcontext.h> >diff --git a/files/patch-third__party_moonlight-common-c_enet_CMakeLists.txt b/files/patch-third__party_moonlight-common-c_enet_CMakeLists.txt >index 703af56..2569c15 100644 >--- a/files/patch-third__party_moonlight-common-c_enet_CMakeLists.txt >+++ b/files/patch-third__party_moonlight-common-c_enet_CMakeLists.txt >@@ -1,4 +1,4 @@ >---- third_party/moonlight-common-c/enet/CMakeLists.txt.orig 2023-09-24 06:11:13 UTC >+--- third_party/moonlight-common-c/enet/CMakeLists.txt.orig 2023-07-30 18:58:58 UTC > +++ third_party/moonlight-common-c/enet/CMakeLists.txt > @@ -107,11 +107,3 @@ target_include_directories(enet SYSTEM PUBLIC include) > if (MINGW) >-- >2.42.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 274026
:
245118
|
245136
|
245137
| 245178