1
0
mirror of https://git.freebsd.org/ports.git synced 2026-06-02 11:08:52 +00:00

games/moonlight-embedded: Update 2.7.0 => 2.7.1

Changelog:
- Increased packet size when streaming remotely over IPv6.
- Improved reliability on high latency connections.
- Improved gamepad input batching.
- Fixed build on 32-bit platforms using 64-bit time.
- Fixed several compiler warnings.
- Updated included gamepad mappings.
https://github.com/moonlight-stream/moonlight-embedded/releases/tag/v2.7.1

- Fix warnings from portlint, portclippy and portfmt.
- Moonlight embedded has remove x11 platform, so remove some patches.

PR:	292992
This commit is contained in:
Armin Zhu
2026-02-07 20:39:33 +03:00
committed by Vladimir Druzenko
parent 28a0df09e1
commit 397c794f50
7 changed files with 82 additions and 219 deletions
+22 -18
View File
@@ -1,6 +1,5 @@
PORTNAME= moonlight-embedded
DISTVERSION= 2.7.0
PORTREVISION= 4
DISTVERSION= 2.7.1
CATEGORIES= games
MASTER_SITES= https://github.com/moonlight-stream/moonlight-embedded/releases/download/v${DISTVERSION}/
@@ -27,37 +26,42 @@ USE_LDCONFIG= yes
USE_PERL5= build
USE_SDL= sdl2
NO_WRKSUBDIR= yes
CFLAGS+= -DHAS_SOCKLEN_T=1 -I${LOCALBASE}/include/libepoll-shim/
LDFLAGS+= -lepoll-shim
CONFLICTS_INSTALL= moonlight-embedded-devel
NO_WRKSUBDIR= yes
PLIST_FILES= bin/moonlight \
"@sample etc/moonlight.conf.sample" \
share/man/man1/moonlight.1.gz \
share/moonlight/gamecontrollerdb.txt
OPTIONS_DEFAULT= OSS X11
OPTIONS_GROUP= DISPLAY OTHERS
OPTIONS_GROUP_DISPLAY= X11
OPTIONS_GROUP_OTHERS= CEC
OPTIONS_SINGLE= SOUND
OPTIONS_SINGLE_SOUND= OSS PULSE
CEC_DESC= Enable HDMI-CEC(TV controller) feature by using libcec.so
OSS_DESC= Open Sound System support for embedded(not SDL) platform
PULSE_DESC= PulseAudio sound server support for embedded(not SDL) platform
CEC_DESC= Enable HDMI-CEC(TV controller) feature by using libcec.so
X11_DESC= Enable x11 and x11_vaapi platform using xorg
OPTIONS_SINGLE= SOUND
OPTIONS_SINGLE_SOUND= OSS PULSE
OPTIONS_GROUP= DISPLAY OTHERS
OPTIONS_GROUP_OTHERS= CEC
OPTIONS_GROUP_DISPLAY= X11
OSS_CMAKE_ON= -DENABLE_PULSE:BOOL=false
PULSE_CMAKE_BOOL= ENABLE_PULSE
PULSE_LIB_DEPENDS= libpulse.so:audio/pulseaudio
CEC_CMAKE_BOOL= ENABLE_CEC
CEC_LIB_DEPENDS= libcec.so:multimedia/libcec \
libp8-platform.so:devel/p8-platform
X11_USES= xorg gl
X11_USE= xorg=x11 gl=egl,glesv2
X11_CMAKE_BOOL= ENABLE_X11
X11_LIB_DEPENDS= libvdpau.so:multimedia/libvdpau \
libva.so:multimedia/libva
CEC_CMAKE_BOOL= ENABLE_CEC
OSS_CMAKE_ON= -DENABLE_PULSE:BOOL=false
PULSE_LIB_DEPENDS= libpulse.so:audio/pulseaudio
PULSE_CMAKE_BOOL= ENABLE_PULSE
X11_LIB_DEPENDS= libva.so:multimedia/libva \
libvdpau.so:multimedia/libvdpau
X11_USES= gl xorg
X11_USE= GL=egl,glesv2 \
XORG=x11
X11_CMAKE_BOOL= ENABLE_X11
post-extract:
@${REINPLACE_CMD} -e 's|/etc/moonlight/|${PREFIX}/etc/moonlight/|g' \
+3 -3
View File
@@ -1,3 +1,3 @@
TIMESTAMP = 1708491885
SHA256 (moonlight-embedded-2.7.0.tar.xz) = 6527718e678dafd6e1e1876bbc6949538b38986d54ebda0b7fdc3b3f4af4f2dd
SIZE (moonlight-embedded-2.7.0.tar.xz) = 335984
TIMESTAMP = 1766564406
SHA256 (moonlight-embedded-2.7.1.tar.xz) = bacbccd15ac01708f35da553eb1bcdccbc887545a6cf2bfcea3e87031dc7276c
SIZE (moonlight-embedded-2.7.1.tar.xz) = 342576
@@ -1,10 +1,10 @@
--- libgamestream/CMakeLists.txt.orig 2024-02-20 04:01:31 UTC
--- libgamestream/CMakeLists.txt.orig 2025-11-30 22:38:13 UTC
+++ libgamestream/CMakeLists.txt
@@ -3,7 +3,7 @@ find_package(CURL REQUIRED)
find_package(LibUUID REQUIRED)
find_package(Threads REQUIRED)
find_package(CURL REQUIRED)
-find_package(OpenSSL 1.0.2 REQUIRED)
-find_package(OpenSSL 1.1.0 REQUIRED)
+find_package(OpenSSL REQUIRED)
find_package(EXPAT REQUIRED)
@@ -1,18 +0,0 @@
--- libgamestream/client.c.orig 2024-02-20 04:01:31 UTC
+++ libgamestream/client.c
@@ -539,7 +539,15 @@ int gs_pair(PSERVER_DATA server, char* pin) {
RAND_bytes(client_secret_data, sizeof(client_secret_data));
const ASN1_BIT_STRING *asnSignature;
+#ifdef __FreeBSD__
+ #if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
X509_get0_signature(&asnSignature, NULL, cert);
+ #else
+ asnSignature = cert->signature;
+ #endif
+#else
+ X509_get0_signature(&asnSignature, NULL, cert);
+#endif
challenge_response = malloc(16 + asnSignature->length + sizeof(client_secret_data));
char challenge_response_hash[32];
@@ -1,94 +0,0 @@
--- src/input/evdev.c.orig 2024-02-20 04:01:31 UTC
+++ src/input/evdev.c
@@ -45,6 +45,8 @@
#endif
#include <math.h>
+static bool isUseKbdmux = false;
+
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define int16_to_le(val) val
#else
@@ -758,7 +760,7 @@ static int evdev_handle(int fd) {
struct input_event ev;
while ((rc = libevdev_next_event(devices[i].dev, LIBEVDEV_READ_FLAG_NORMAL, &ev)) >= 0) {
if (rc == LIBEVDEV_READ_STATUS_SYNC)
- fprintf(stderr, "Error: cannot keep up\n");
+ fprintf(stderr, "Error:%s(%d) cannot keep up\n", libevdev_get_name(devices[i].dev), i);
else if (rc == LIBEVDEV_READ_STATUS_SUCCESS) {
if (!handler(&ev, &devices[i]))
return LOOP_RETURN;
@@ -775,6 +777,39 @@ static int evdev_handle(int fd) {
return LOOP_OK;
}
+void is_use_kbdmux() {
+ const char* tryFirstInput = "/dev/input/event0";
+ const char* trySecondInput = "/dev/input/event1";
+
+ int fdFirst = open(tryFirstInput, O_RDWR|O_NONBLOCK);
+ int fdSecond = open(trySecondInput, O_RDWR|O_NONBLOCK);
+ if (fdFirst <= 0 && fdSecond <= 0) {
+ //Suppose use kbdmux because of default behavior
+ isUseKbdmux = true;
+ return;
+ }
+
+ struct libevdev *evdevFirst = libevdev_new();
+ libevdev_set_fd(evdevFirst, fdFirst);
+ const char* nameFirst = libevdev_get_name(evdevFirst);
+ struct libevdev *evdevSecond = libevdev_new();
+ libevdev_set_fd(evdevSecond, fdSecond);
+ const char* nameSecond = libevdev_get_name(evdevSecond);
+
+ libevdev_free(evdevFirst);
+ libevdev_free(evdevSecond);
+ close(fdFirst);
+ close(fdSecond);
+
+ if (strcmp(nameFirst, "System keyboard multiplexer") == 0 ||
+ strcmp(nameSecond, "System keyboard multiplexer") == 0) {
+ isUseKbdmux = true;
+ return;
+ }
+
+ return;
+}
+
void evdev_create(const char* device, struct mapping* mappings, bool verbose, int rotate) {
int fd = open(device, O_RDWR|O_NONBLOCK);
if (fd <= 0) {
@@ -851,6 +886,33 @@ void evdev_create(const char* device, struct mapping*
libevdev_has_event_code(evdev, EV_ABS, ABS_WHEEL) ||
libevdev_has_event_code(evdev, EV_ABS, ABS_GAS) ||
libevdev_has_event_code(evdev, EV_ABS, ABS_BRAKE));
+ bool is_acpibutton =
+ strcmp(name, "Sleep Button") == 0 ||
+ strcmp(name, "Power Button") == 0;
+ // Just use System keyboard multiplexer for FreeBSD,see kbdcontrol(1) and kbdmux(4)
+ // Trying to grab kbdmux0 and keyboard it's self at the same time results in
+ // the keyboard becoming unresponsive on FreeBSD.
+ bool is_likekeyboard =
+ is_keyboard && isUseKbdmux && strcmp(name, "System keyboard multiplexer") != 0;
+/*
+ (is_keyboard && guid[0] <= 3) ||
+ strcmp(name, "AT keyboard") == 0;
+*/
+
+ // In some cases,acpibutton can be mistaken for a keyboard and freeze the keyboard when tring grab.
+ if (is_acpibutton) {
+ if (verbose)
+ printf("Skip acpibutton: %s\n", name);
+ libevdev_free(evdev);
+ close(fd);
+ return;
+ }
+ // In some cases,Do not grab likekeyboard for avoiding keyboard unresponsive
+ if (is_likekeyboard) {
+ if (verbose)
+ printf("Do NOT grab like-keyboard: %s,version: %d,bustype: %d\n", name, guid[6], guid[0]);
+ is_keyboard = false;
+ }
if (is_accelerometer) {
if (verbose)
@@ -1,84 +0,0 @@
--- src/main.c.orig 2024-02-20 04:01:31 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,8 @@
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
-#include <openssl/rand.h>
+
+extern void is_use_kbdmux();
static void applist(PSERVER_DATA server) {
PAPP_LIST list = NULL;
@@ -202,7 +204,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 +323,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)
@@ -362,6 +363,9 @@ int main(int argc, char* argv[]) {
mappings = map;
}
+ // test is use kbdmux driver
+ if (config.inputsCount <= 0)
+ is_use_kbdmux();
for (int i=0;i<config.inputsCount;i++) {
if (config.debug_level > 0)
printf("Adding input device %s...\n", config.inputs[i]);
@@ -398,7 +402,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);
@@ -406,6 +411,7 @@ int main(int argc, char* argv[]) {
fprintf(stderr, "Failed to pair to server: %s\n", gs_error);
} else {
printf("Succesfully paired\n");
+ printf("Note: Use Ctrl+Alt+Shift+Q to quit streaming.\n");
}
} else if (strcmp("unpair", config.action) == 0) {
if (gs_unpair(&server) != GS_OK) {
@@ -0,0 +1,55 @@
--- third_party/moonlight-common-c/enet/host.c.orig 2025-11-10 02:29:40 UTC
+++ third_party/moonlight-common-c/enet/host.c
@@ -3,6 +3,7 @@
@brief ENet host management functions
*/
#define ENET_BUILDING_LIB 1
+#include <netinet/in.h>
#include <string.h>
#include "enet/enet.h"
@@ -50,7 +51,17 @@ enet_host_create (int addressFamily, const ENetAddress
memset (host -> peers, 0, peerCount * sizeof (ENetPeer));
host -> socket = enet_socket_create (addressFamily, ENET_SOCKET_TYPE_DATAGRAM);
+ #if defined(IP_SENDSRCADDR)
+ // if want use IP_SENDSRCADDR with udp socket, FreeBSD need INADDR_ANY addr and local port.
+ ENetAddress localAddress = * address;
+ if (address != NULL && addressFamily == AF_INET) {
+ struct sockaddr_in *addr = (struct sockaddr_in *) & localAddress.address;
+ addr -> sin_addr.s_addr = htonl(INADDR_ANY);
+ }
+ if (host -> socket == ENET_SOCKET_NULL || (address != NULL && enet_socket_bind (host -> socket, & localAddress) < 0))
+ #else
if (host -> socket == ENET_SOCKET_NULL || (address != NULL && enet_socket_bind (host -> socket, address) < 0))
+ #endif
{
if (host -> socket != ENET_SOCKET_NULL)
enet_socket_destroy (host -> socket);
@@ -65,8 +76,24 @@ enet_host_create (int addressFamily, const ENetAddress
enet_socket_set_option (host -> socket, ENET_SOCKOPT_RCVBUF, ENET_HOST_RECEIVE_BUFFER_SIZE);
enet_socket_set_option (host -> socket, ENET_SOCKOPT_SNDBUF, ENET_HOST_SEND_BUFFER_SIZE);
- if (address != NULL && enet_socket_get_address (host -> socket, & host -> address) < 0)
- host -> address = * address;
+ if (address != NULL)
+ {
+ #if defined(IP_SENDSRCADDR)
+ // if no connect to host->socket,INADDR_ANY socket is bind to 0.0.0.0,so use address directly
+ if (addressFamily == AF_INET) {
+ enet_socket_get_address (host -> socket, & localAddress);
+ ((struct sockaddr_in *) & address -> address) -> sin_port = ((struct sockaddr_in *) & localAddress.address) -> sin_port;
+ host -> address = * address;
+ }
+ else
+ #endif
+ {
+ if (enet_socket_get_address (host -> socket, & host -> address) < 0)
+ {
+ host -> address = * address;
+ }
+ }
+ }
if (! channelLimit || channelLimit > ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT)
channelLimit = ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT;