View | Details | Raw Unified | Return to bug 280114
Collapse All | Expand All

(-)b/games/moonlight-embedded/Makefile (-9 / +26 lines)
Lines 1-5 Link Here
1
PORTNAME=	moonlight-embedded
1
PORTNAME=	moonlight-embedded
2
DISTVERSION=	2.6.2
2
DISTVERSION=	2.7.0
3
CATEGORIES=	games
3
CATEGORIES=	games
4
MASTER_SITES=	https://github.com/moonlight-stream/moonlight-embedded/releases/download/v${DISTVERSION}/
4
MASTER_SITES=	https://github.com/moonlight-stream/moonlight-embedded/releases/download/v${DISTVERSION}/
5
5
Lines 19-46 LIB_DEPENDS= libavahi-client.so:net/avahi-app \ Link Here
19
		libexpat.so:textproc/expat2 \
19
		libexpat.so:textproc/expat2 \
20
		libopus.so:audio/opus \
20
		libopus.so:audio/opus \
21
		libudev.so:devel/libudev-devd \
21
		libudev.so:devel/libudev-devd \
22
		libuuid.so:misc/e2fsprogs-libuuid \
22
		libuuid.so:misc/e2fsprogs-libuuid
23
		libvdpau.so:multimedia/libvdpau \
24
		libva.so:multimedia/libva
25
23
26
USES=		cmake gl localbase:ldflags perl5 pkgconfig sdl ssl tar:xz xorg
24
USES=		cmake localbase:ldflags perl5 pkgconfig sdl ssl tar:xz
27
USE_LDCONFIG=	yes
25
USE_LDCONFIG=	yes
28
USE_GL=		egl glesv2
29
USE_PERL5=	build
26
USE_PERL5=	build
30
USE_SDL=	sdl2
27
USE_SDL=	sdl2
31
USE_XORG=	x11
32
28
33
NO_WRKSUBDIR=	yes
29
NO_WRKSUBDIR=	yes
34
CFLAGS+=	-DHAS_SOCKLEN_T=1 -I${LOCALBASE}/include/libepoll-shim/
30
CFLAGS+=	-DHAS_SOCKLEN_T=1 -I${LOCALBASE}/include/libepoll-shim/
35
LDFLAGS+=	-lepoll-shim
31
LDFLAGS+=	-lepoll-shim
36
CMAKE_OFF=	ENABLE_CEC ENABLE_PULSE
32
CONFLICTS_INSTALL=	moonlight-embedded-devel
37
CMAKE_ON=	ENET_NO_INSTALL
38
33
39
PLIST_FILES=	bin/moonlight \
34
PLIST_FILES=	bin/moonlight \
40
		"@sample etc/moonlight.conf.sample" \
35
		"@sample etc/moonlight.conf.sample" \
41
		share/man/man1/moonlight.1.gz \
36
		share/man/man1/moonlight.1.gz \
42
		share/moonlight/gamecontrollerdb.txt
37
		share/moonlight/gamecontrollerdb.txt
43
38
39
OPTIONS_DEFAULT=	OSS X11
40
OSS_DESC=	Open Sound System support for embedded(not SDL) platform
41
PULSE_DESC=	PulseAudio sound server support for embedded(not SDL) platform
42
CEC_DESC=	Enable HDMI-CEC(TV controller) feature by using libcec.so
43
X11_DESC=	Enable x11 and x11_vaapi platform using xorg
44
OPTIONS_SINGLE=	SOUND
45
OPTIONS_SINGLE_SOUND=	OSS PULSE
46
OPTIONS_GROUP=	DISPLAY OTHERS
47
OPTIONS_GROUP_OTHERS=	CEC
48
OPTIONS_GROUP_DISPLAY=	X11
49
OSS_CMAKE_ON=	-DENABLE_PULSE:BOOL=false
50
PULSE_CMAKE_BOOL=	ENABLE_PULSE
51
PULSE_LIB_DEPENDS=	libpulse.so:audio/pulseaudio
52
CEC_CMAKE_BOOL=	ENABLE_CEC
53
CEC_LIB_DEPENDS=	libcec.so:multimedia/libcec \
54
			libp8-platform.so:devel/p8-platform
55
X11_USES=	xorg gl
56
X11_USE=	xorg=x11 gl=egl,glesv2
57
X11_CMAKE_BOOL=	ENABLE_X11
58
X11_LIB_DEPENDS=	libvdpau.so:multimedia/libvdpau \
59
			libva.so:multimedia/libva
60
44
post-extract:
61
post-extract:
45
	@${REINPLACE_CMD} -e 's|/etc/moonlight/|${PREFIX}/etc/moonlight/|g' \
62
	@${REINPLACE_CMD} -e 's|/etc/moonlight/|${PREFIX}/etc/moonlight/|g' \
46
		${WRKSRC}/docs/README.pod
63
		${WRKSRC}/docs/README.pod
(-)b/games/moonlight-embedded/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1701007066
1
TIMESTAMP = 1708491885
2
SHA256 (moonlight-embedded-2.6.2.tar.xz) = 8bcc69b403a628efaf8686d40c0d1428b46defe4c65b06ff6ccc3fe32f0b2356
2
SHA256 (moonlight-embedded-2.7.0.tar.xz) = 6527718e678dafd6e1e1876bbc6949538b38986d54ebda0b7fdc3b3f4af4f2dd
3
SIZE (moonlight-embedded-2.6.2.tar.xz) = 328660
3
SIZE (moonlight-embedded-2.7.0.tar.xz) = 335984
(-)a/games/moonlight-embedded/files/patch-CMakeLists.txt (-14 lines)
Removed Link Here
1
--- CMakeLists.txt.orig	2023-11-03 06:08:34 UTC
2
+++ CMakeLists.txt
3
@@ -87,6 +87,11 @@ add_executable(moonlight ${SRC_LIST})
4
 target_link_libraries(moonlight m)
5
 target_link_libraries(moonlight gamestream)
6
 
7
+if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
8
+  set(ALSA_FOUND FALSE)
9
+  target_sources(moonlight PRIVATE ./src/audio/oss.c)
10
+endif()
11
+
12
 if (CEC_FOUND)
13
   list(APPEND MOONLIGHT_DEFINITIONS HAVE_LIBCEC)
14
   list(APPEND MOONLIGHT_OPTIONS CEC)
(-)b/games/moonlight-embedded/files/patch-libgamestream_CMakeLists.txt (-4 / +4 lines)
Lines 1-6 Link Here
1
--- libgamestream/CMakeLists.txt.orig	2023-11-03 06:08:34 UTC
1
--- libgamestream/CMakeLists.txt.orig	2024-02-20 04:01:31 UTC
2
+++ libgamestream/CMakeLists.txt
2
+++ libgamestream/CMakeLists.txt
3
@@ -3,7 +3,7 @@ set(SO_VERSION 4)
3
@@ -3,7 +3,7 @@ find_package(CURL REQUIRED)
4
 find_package(LibUUID REQUIRED)
4
 find_package(LibUUID REQUIRED)
5
 find_package(Threads REQUIRED)
5
 find_package(Threads REQUIRED)
6
 find_package(CURL REQUIRED)
6
 find_package(CURL REQUIRED)
Lines 21-28 Link Here
21
 target_link_libraries(gamestream moonlight-common)
21
 target_link_libraries(gamestream moonlight-common)
22
 
22
 
23
 set_target_properties(gamestream PROPERTIES SOVERSION ${SO_VERSION} VERSION ${PROJECT_VERSION})
23
 set_target_properties(gamestream PROPERTIES SOVERSION ${SO_VERSION} VERSION ${PROJECT_VERSION})
24
@@ -28,5 +28,3 @@ target_include_directories(moonlight-common PRIVATE ..
24
@@ -28,5 +28,3 @@ target_link_libraries(gamestream ${CMAKE_THREAD_LIBS_I
25
 target_link_libraries(gamestream ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES} ${EXPAT_LIBRARIES} ${AVAHI_LIBRARIES} ${LIBUUID_LIBRARIES})
25
 target_link_libraries(gamestream ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES} ${EXPAT_LIBRARIES} ${AVAHI_LIBRARIES} ${LibUUID_LIBRARIES})
26
 
26
 
27
 target_link_libraries(gamestream ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS})
27
 target_link_libraries(gamestream ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS})
28
-
28
-
(-)b/games/moonlight-embedded/files/patch-libgamestream_client.c (-4 / +3 lines)
Lines 1-10 Link Here
1
--- libgamestream/client.c.orig	2023-11-03 06:08:34 UTC
1
--- libgamestream/client.c.orig	2024-02-20 04:01:31 UTC
2
+++ libgamestream/client.c
2
+++ libgamestream/client.c
3
@@ -537,7 +537,16 @@ int gs_pair(PSERVER_DATA server, char* pin) {
3
@@ -539,7 +539,15 @@ int gs_pair(PSERVER_DATA server, char* pin) {
4
   RAND_bytes(client_secret_data, sizeof(client_secret_data));
4
   RAND_bytes(client_secret_data, sizeof(client_secret_data));
5
 
5
 
6
   const ASN1_BIT_STRING *asnSignature;
6
   const ASN1_BIT_STRING *asnSignature;
7
+
8
+#ifdef __FreeBSD__
7
+#ifdef __FreeBSD__
9
+ #if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
8
+ #if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
10
   X509_get0_signature(&asnSignature, NULL, cert);
9
   X509_get0_signature(&asnSignature, NULL, cert);
Lines 15-19 Link Here
15
+  X509_get0_signature(&asnSignature, NULL, cert);
14
+  X509_get0_signature(&asnSignature, NULL, cert);
16
+#endif
15
+#endif
17
 
16
 
18
   char challenge_response[16 + SIGNATURE_LEN + sizeof(client_secret_data)];
17
   challenge_response = malloc(16 + asnSignature->length + sizeof(client_secret_data));
19
   char challenge_response_hash[32];
18
   char challenge_response_hash[32];
(-)a/games/moonlight-embedded/files/patch-libgamestream_http.c (-12 lines)
Removed Link Here
1
--- libgamestream/http.c.orig	2023-11-03 06:08:34 UTC
2
+++ libgamestream/http.c
3
@@ -73,6 +73,9 @@ int http_init(const char* keyDirectory, int logLevel) 
4
 int http_request(char* url, PHTTP_DATA data) {
5
   curl_easy_setopt(curl, CURLOPT_WRITEDATA, data);
6
   curl_easy_setopt(curl, CURLOPT_URL, url);
7
+#ifdef __FreeBSD__
8
+  curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, 1);
9
+#endif
10
 
11
   if (debug)
12
     printf("Request %s\n", url);
(-)a/games/moonlight-embedded/files/patch-src_audio_audio.h (-9 lines)
Removed Link Here
1
--- src/audio/audio.h.orig	2023-11-03 06:08:34 UTC
2
+++ src/audio/audio.h
3
@@ -31,3 +31,6 @@ extern AUDIO_RENDERER_CALLBACKS audio_callbacks_sdl;
4
 extern AUDIO_RENDERER_CALLBACKS audio_callbacks_pulse;
5
 bool audio_pulse_init(char* audio_device);
6
 #endif
7
+#ifdef __FreeBSD__
8
+extern AUDIO_RENDERER_CALLBACKS audio_callbacks_oss;
9
+#endif
(-)a/games/moonlight-embedded/files/patch-src_audio_oss.c (-108 lines)
Removed Link Here
1
--- src/audio/oss.c.orig	2024-01-01 05:31:28 UTC
2
+++ src/audio/oss.c
3
@@ -0,0 +1,105 @@
4
+/*
5
+ * This file is part of Moonlight Embedded.
6
+ *
7
+ * Copyright (C) 2015-2017 Iwan Timmer
8
+ *
9
+ * Moonlight is free software; you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation; either version 3 of the License, or
12
+ * (at your option) any later version.
13
+ *
14
+ * Moonlight is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with Moonlight; if not, see <http://www.gnu.org/licenses/>.
21
+ */
22
+
23
+#ifdef __FreeBSD__
24
+#include <sys/soundcard.h>
25
+#include <sys/ioctl.h>
26
+#include "audio.h"
27
+
28
+#include <opus_multistream.h>
29
+
30
+#include <errno.h>
31
+#include <fcntl.h>
32
+#include <stdio.h>
33
+#include <stdlib.h>
34
+#include <unistd.h>
35
+
36
+static OpusMSDecoder* decoder;
37
+static short* pcmBuffer;
38
+static int samplesPerFrame;
39
+static int channelCount;
40
+static int fd = -1;
41
+
42
+static int oss_renderer_init(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusConfig, void* context, int arFlags) {
43
+  int rc;
44
+  decoder = opus_multistream_decoder_create(opusConfig->sampleRate, opusConfig->channelCount, opusConfig->streams, opusConfig->coupledStreams, opusConfig->mapping, &rc);
45
+
46
+  channelCount = opusConfig->channelCount;
47
+  samplesPerFrame = opusConfig->samplesPerFrame;
48
+  pcmBuffer = malloc(sizeof(short) * channelCount * samplesPerFrame);
49
+  if (pcmBuffer == NULL)
50
+    return -1;
51
+
52
+  const char* oss_name = "/dev/dsp";
53
+  fd = open(oss_name, O_WRONLY);
54
+  if (fd == -1) {
55
+    printf("Open audio device /dev/dsp failed! error %d\n", errno);
56
+    return -1;
57
+  }
58
+  // buffer size for fragment ,selector 12 is 4096;11 is 2048;10 is 1024; 13is 8192
59
+  int frag = 12;
60
+  if (ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &frag) == -1)
61
+    printf("Set fragment for /dev/dsp failed.");
62
+
63
+  int format = AFMT_S16_LE;
64
+  int channels = opusConfig->channelCount;
65
+  int rate = opusConfig->sampleRate;
66
+  if (ioctl(fd, SNDCTL_DSP_SETFMT, &format) == -1)
67
+    printf("Set format for /dev/dsp failed.");
68
+  if (ioctl(fd, SNDCTL_DSP_CHANNELS, &channels) == -1)
69
+    printf("Set channels for /dev/dsp failed.");
70
+  if (ioctl(fd, SNDCTL_DSP_SPEED, &rate) == -1)
71
+    printf("Set sample rate for /dev/dsp failed.");
72
+
73
+  return 0;
74
+}
75
+
76
+static void oss_renderer_cleanup() {
77
+  if (decoder != NULL) {
78
+    opus_multistream_decoder_destroy(decoder);
79
+    decoder = NULL;
80
+  }
81
+
82
+  if (pcmBuffer != NULL) {
83
+    free(pcmBuffer);
84
+    pcmBuffer = NULL;
85
+  }
86
+
87
+  if (fd != -1) {
88
+    close(fd);
89
+    fd = -1;
90
+  }
91
+}
92
+
93
+static void oss_renderer_decode_and_play_sample(char* data, int length) {
94
+  int decodeLen = opus_multistream_decode(decoder, data, length, pcmBuffer, samplesPerFrame, 0);
95
+  if (decodeLen > 0) {
96
+    write(fd, pcmBuffer, decodeLen * channelCount * sizeof(short));
97
+  } else if (decodeLen < 0) {
98
+    printf("Opus error from decode: %d\n", decodeLen);
99
+  }
100
+}
101
+
102
+AUDIO_RENDERER_CALLBACKS audio_callbacks_oss = {
103
+  .init = oss_renderer_init,
104
+  .cleanup = oss_renderer_cleanup,
105
+  .decodeAndPlaySample = oss_renderer_decode_and_play_sample,
106
+  .capabilities = CAPABILITY_DIRECT_SUBMIT | CAPABILITY_SUPPORTS_ARBITRARY_AUDIO_DURATION,
107
+};
108
+#endif
(-)b/games/moonlight-embedded/files/patch-src_input_evdev.c (-27 / +6 lines)
Lines 1-14 Link Here
1
--- src/input/evdev.c.orig	2023-11-03 06:08:34 UTC
1
--- src/input/evdev.c.orig	2024-02-20 04:01:31 UTC
2
+++ src/input/evdev.c
2
+++ src/input/evdev.c
3
@@ -38,9 +38,15 @@
3
@@ -45,6 +45,8 @@
4
 #include <limits.h>
4
 #endif
5
 #include <unistd.h>
6
 #include <pthread.h>
7
+#ifdef __linux__
8
 #include <endian.h>
9
+#else
10
+#include <sys/endian.h>
11
+#endif
12
 #include <math.h>
5
 #include <math.h>
13
 
6
 
14
+static bool isUseKbdmux = false;
7
+static bool isUseKbdmux = false;
Lines 16-36 Link Here
16
 #if __BYTE_ORDER == __LITTLE_ENDIAN
9
 #if __BYTE_ORDER == __LITTLE_ENDIAN
17
 #define int16_to_le(val) val
10
 #define int16_to_le(val) val
18
 #else
11
 #else
19
@@ -66,8 +72,13 @@ struct input_device {
12
@@ -758,7 +760,7 @@ static int evdev_handle(int fd) {
20
   int hats_state[3][2];
21
   int fd;
22
   char modifiers;
23
+  #ifdef __linux__
24
   __s32 mouseDeltaX, mouseDeltaY, mouseVScroll, mouseHScroll;
25
   __s32 touchDownX, touchDownY, touchX, touchY;
26
+  #else
27
+  int32_t mouseDeltaX, mouseDeltaY, mouseVScroll, mouseHScroll;
28
+  int32_t touchDownX, touchDownY, touchX, touchY;
29
+  #endif
30
   struct timeval touchDownTime;
31
   struct timeval btnDownTime;
32
   short controllerId;
33
@@ -749,7 +760,7 @@ static int evdev_handle(int fd) {
34
       struct input_event ev;
13
       struct input_event ev;
35
       while ((rc = libevdev_next_event(devices[i].dev, LIBEVDEV_READ_FLAG_NORMAL, &ev)) >= 0) {
14
       while ((rc = libevdev_next_event(devices[i].dev, LIBEVDEV_READ_FLAG_NORMAL, &ev)) >= 0) {
36
         if (rc == LIBEVDEV_READ_STATUS_SYNC)
15
         if (rc == LIBEVDEV_READ_STATUS_SYNC)
Lines 39-45 Link Here
39
         else if (rc == LIBEVDEV_READ_STATUS_SUCCESS) {
18
         else if (rc == LIBEVDEV_READ_STATUS_SUCCESS) {
40
           if (!handler(&ev, &devices[i]))
19
           if (!handler(&ev, &devices[i]))
41
             return LOOP_RETURN;
20
             return LOOP_RETURN;
42
@@ -766,6 +777,39 @@ static int evdev_handle(int fd) {
21
@@ -775,6 +777,39 @@ static int evdev_handle(int fd) {
43
   return LOOP_OK;
22
   return LOOP_OK;
44
 }
23
 }
45
 
24
 
Lines 79-85 Link Here
79
 void evdev_create(const char* device, struct mapping* mappings, bool verbose, int rotate) {
58
 void evdev_create(const char* device, struct mapping* mappings, bool verbose, int rotate) {
80
   int fd = open(device, O_RDWR|O_NONBLOCK);
59
   int fd = open(device, O_RDWR|O_NONBLOCK);
81
   if (fd <= 0) {
60
   if (fd <= 0) {
82
@@ -840,6 +884,33 @@ void evdev_create(const char* device, struct mapping* 
61
@@ -851,6 +886,33 @@ void evdev_create(const char* device, struct mapping* 
83
      libevdev_has_event_code(evdev, EV_ABS, ABS_WHEEL) ||
62
      libevdev_has_event_code(evdev, EV_ABS, ABS_WHEEL) ||
84
      libevdev_has_event_code(evdev, EV_ABS, ABS_GAS) ||
63
      libevdev_has_event_code(evdev, EV_ABS, ABS_GAS) ||
85
      libevdev_has_event_code(evdev, EV_ABS, ABS_BRAKE));
64
      libevdev_has_event_code(evdev, EV_ABS, ABS_BRAKE));
(-)b/games/moonlight-embedded/files/patch-src_main.c (-5 / +6 lines)
Lines 1-4 Link Here
1
--- src/main.c.orig	2023-11-03 06:08:34 UTC
1
--- src/main.c.orig	2024-02-20 04:01:31 UTC
2
+++ src/main.c
2
+++ src/main.c
3
@@ -42,6 +42,7 @@
3
@@ -42,6 +42,7 @@
4
 #include <client.h>
4
 #include <client.h>
Lines 54-69 Link Here
54
 
54
 
55
     #ifdef HAVE_SDL
55
     #ifdef HAVE_SDL
56
     if (system == SDL)
56
     if (system == SDL)
57
@@ -362,6 +363,8 @@ int main(int argc, char* argv[]) {
57
@@ -362,6 +363,9 @@ int main(int argc, char* argv[]) {
58
           mappings = map;
58
           mappings = map;
59
         }
59
         }
60
 
60
 
61
+        // test is use kbdmux driver
61
+        // test is use kbdmux driver
62
+        is_use_kbdmux();
62
+        if (config.inputsCount <= 0)
63
+          is_use_kbdmux();
63
         for (int i=0;i<config.inputsCount;i++) {
64
         for (int i=0;i<config.inputsCount;i++) {
64
           if (config.debug_level > 0)
65
           if (config.debug_level > 0)
65
             printf("Adding input device %s...\n", config.inputs[i]);
66
             printf("Adding input device %s...\n", config.inputs[i]);
66
@@ -398,7 +401,8 @@ int main(int argc, char* argv[]) {
67
@@ -398,7 +402,8 @@ int main(int argc, char* argv[]) {
67
     if (config.pin > 0 && config.pin <= 9999) {
68
     if (config.pin > 0 && config.pin <= 9999) {
68
       sprintf(pin, "%04d", config.pin);
69
       sprintf(pin, "%04d", config.pin);
69
     } else {
70
     } else {
Lines 73-79 Link Here
73
     }
74
     }
74
     printf("Please enter the following PIN on the target PC: %s\n", pin);
75
     printf("Please enter the following PIN on the target PC: %s\n", pin);
75
     fflush(stdout);
76
     fflush(stdout);
76
@@ -406,6 +410,7 @@ int main(int argc, char* argv[]) {
77
@@ -406,6 +411,7 @@ int main(int argc, char* argv[]) {
77
       fprintf(stderr, "Failed to pair to server: %s\n", gs_error);
78
       fprintf(stderr, "Failed to pair to server: %s\n", gs_error);
78
     } else {
79
     } else {
79
       printf("Succesfully paired\n");
80
       printf("Succesfully paired\n");
(-)a/games/moonlight-embedded/files/patch-src_platform.c (-13 lines)
Removed Link Here
1
--- src/platform.c.orig	2023-11-03 06:08:34 UTC
2
+++ src/platform.c
3
@@ -202,6 +202,9 @@ AUDIO_RENDERER_CALLBACKS* platform_get_audio(enum plat
4
     #ifdef HAVE_ALSA
5
     return &audio_callbacks_alsa;
6
     #endif
7
+    #ifdef __FreeBSD__
8
+    return &audio_callbacks_oss;
9
+    #endif
10
   }
11
   return NULL;
12
 }
13
- 

Return to bug 280114