mirror of
https://github.com/RGBCube/serenity
synced 2025-07-29 07:57:47 +00:00

This adds 'JonoF's Duke Nukem 3D Port'. Parts of the network-related stuff has been patched out. See patch: patches/0002-mmulti.c-ifdef-out-network-related-stuff-we-currentl.patch Notes: - Some sound work seems to be needed. During the title screen and gameplay SFX works, but music does not play. At the ending screen of Hollywood Holocaust music does play. - GTK has been disabled, by default it will start in fullscreen, to get back to windowed mode can be done through the Video Settings. - OpenGL support has been disabled, as far as I can tell it will need OpenGL 2.0 support which we do not currently have. - True 3D renderer has been turned on.
91 lines
3.4 KiB
Diff
91 lines
3.4 KiB
Diff
From 792069a881f0b189aaa9f694165b1cd2274a581f Mon Sep 17 00:00:00 2001
|
|
From: Kenneth Myhra <kennethmyhra@gmail.com>
|
|
Date: Mon, 1 May 2023 18:24:10 +0200
|
|
Subject: [PATCH 2/2] [mmulti.c] #ifdef out network-related stuff we currently
|
|
do not support
|
|
|
|
This patches out network-relatd stuff like IP_PKTINFO, IPV6_PKTINFO, and
|
|
IP_RECVDSTADDR which we currently do not support.
|
|
|
|
This is merely done to make the code compile, and since we do not try to
|
|
support any multiplayer option or other network-related stuff it should
|
|
not matter for the time being.
|
|
---
|
|
src/mmulti.c | 19 ++++++++++++++++---
|
|
1 file changed, 16 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/jfbuild/src/mmulti.c b/jfbuild/src/mmulti.c
|
|
index ca3922f..8191358 100644
|
|
--- a/jfbuild/src/mmulti.c
|
|
+++ b/jfbuild/src/mmulti.c
|
|
@@ -205,7 +205,10 @@ int netinit (int portnum)
|
|
}
|
|
|
|
// Request that we receive IPV4 packet info.
|
|
-#if defined(__linux) || defined(_WIN32)
|
|
+#if defined(__serenity__)
|
|
+ // Do nothing
|
|
+ if (0)
|
|
+#elif defined(__linux) || defined(_WIN32)
|
|
if (setsockopt(mysock, IPPROTO_IP, IP_PKTINFO, (void *)&on, sizeof(on)) != 0)
|
|
#else
|
|
if (domain == PF_INET && setsockopt(mysock, IPPROTO_IP, IP_RECVDSTADDR, &on, sizeof(on)) != 0)
|
|
@@ -337,7 +340,9 @@ int netsend (int other, void *dabuf, int bufsiz) //0:buffer full... can't send
|
|
// just have to cross our fingers.
|
|
if (replyfrom4[other].s_addr != INADDR_ANY) {
|
|
cmsg->cmsg_level = IPPROTO_IP;
|
|
-#if defined(__linux) || defined(_WIN32)
|
|
+#if defined(__serenity__)
|
|
+ // Do nothing
|
|
+#elif defined(__linux) || defined(_WIN32)
|
|
cmsg->cmsg_type = IP_PKTINFO;
|
|
cmsg->cmsg_len = CMSG_LEN(sizeof(struct in_pktinfo));
|
|
#ifdef _WIN32
|
|
@@ -355,6 +360,7 @@ int netsend (int other, void *dabuf, int bufsiz) //0:buffer full... can't send
|
|
cmsg = CMSG_NXTHDR(&msg, cmsg);
|
|
}
|
|
#endif
|
|
+#ifndef __serenity__
|
|
if (!IN6_IS_ADDR_UNSPECIFIED(&replyfrom6[other])) {
|
|
cmsg->cmsg_level = IPPROTO_IPV6;
|
|
cmsg->cmsg_type = IPV6_PKTINFO;
|
|
@@ -363,6 +369,7 @@ int netsend (int other, void *dabuf, int bufsiz) //0:buffer full... can't send
|
|
len += CMSG_SPACE(sizeof(struct in6_pktinfo));
|
|
cmsg = CMSG_NXTHDR(&msg, cmsg);
|
|
}
|
|
+#endif
|
|
#ifdef _WIN32
|
|
msg.Control.len = len;
|
|
if (len == 0) {
|
|
@@ -449,7 +456,11 @@ int netread (int *other, void *dabuf, int bufsiz) //0:no packets in buffer
|
|
memset(&snatchreplyfrom4, 0, sizeof(snatchreplyfrom4));
|
|
memset(&snatchreplyfrom6, 0, sizeof(snatchreplyfrom6));
|
|
for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
|
|
-#if defined(__linux) || defined(_WIN32)
|
|
+#if defined(__serenity__)
|
|
+ // Do nothing
|
|
+ if (0) {
|
|
+ }
|
|
+#elif defined(__linux) || defined(_WIN32)
|
|
if (cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_PKTINFO) {
|
|
snatchreplyfrom4 = ((struct in_pktinfo *)CMSG_DATA(cmsg))->ipi_addr;
|
|
#ifdef MMULTI_DEBUG_SENDRECV_WIRE
|
|
@@ -511,6 +522,7 @@ static int issameaddress(struct sockaddr *a, struct sockaddr *b) {
|
|
return a4->sin_addr.s_addr == b4->sin_addr.s_addr &&
|
|
a4->sin_port == b4->sin_port;
|
|
}
|
|
+#ifndef __serenity__
|
|
if (a->sa_family == AF_INET6) {
|
|
// IPV6.
|
|
struct sockaddr_in6 *a6 = (struct sockaddr_in6 *)a;
|
|
@@ -518,6 +530,7 @@ static int issameaddress(struct sockaddr *a, struct sockaddr *b) {
|
|
return IN6_ARE_ADDR_EQUAL(&a6->sin6_addr, &b6->sin6_addr) &&
|
|
a6->sin6_port == b6->sin6_port;
|
|
}
|
|
+#endif
|
|
return 0;
|
|
}
|
|
|
|
--
|
|
2.40.1
|
|
|