Tuesday, June 22, 2010

#quake #sdl on #haikuos

wget http://www.libsdl.org/projects/quake/data/quakesw-1.0.6.tar.gz
wget http://www.libsdl.org/projects/quake/src/sdlquake-1.0.9.tar.gz

tar -x --strip-components=1 -f sdlquake-1.0.9.tar.gz
tar -x -f quakesw-1.0.6.tar.gz

wget http://gist.github.com/raw/448637/e43f70ff6e6e7bbdac1a26b4b0886d162a1ab7a2/sys_sdl.patch

wget http://gist.github.com/raw/448609/d077f11f4cb72e0044773bda2ce1a921389f508d/net_udp.patch

http://gist.github.com/raw/448637/e43f70ff6e6e7bbdac1a26b4b0886d162a1ab7a2/net_dgrm.patch

patch -p1 < sys_sdl.patch
patch -p1 < net_dgrm.patch
patch -p1 < sys_sdl.patch

./configure --host=i686-beos

or you can enable asm optimizations too if you want so

./configure --host=i686-beos --enable-asm

make

./sdlquake


Bellow is why i needed the patches and what they do

first i had this error
sys_sdl.c:16:21: error: sys/shm.h: No such file or directory

deleted the line with

#include sys/shm.h


--- quake1/sys_sdl.c 1999-12-25 14:14:37.036438016 +0200
+++ quake1_haiku/sys_sdl.c 2010-06-22 16:30:48.133955584 +0300
@@ -13,7 +13,6 @@
#include <errno.h>
#ifndef __WIN32__
#include <sys/ipc.h>
-#include <sys/shm.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/mman.h>
view raw sys_sdl.patch hosted with ❤ by GitHub



I have reviewed the udp patches from native client to disable udp related communication



--- quake1/net_udp.c 1999-12-25 13:38:03.049283072 +0200
+++ quake1_haiku/net_udp.c 2010-06-22 17:01:32.979632128 +0300
@@ -19,9 +19,13 @@
*/
// net_udp.c
-#include "quakedef.h"
+//#define HAVE_NET_UDP
+#include "quakedef.h"
#include <sys/types.h>
+
+#if defined(HAVE_NET_UDP)
+
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
@@ -413,3 +417,80 @@
}
//=============================================================================
+#else
+
+int UDP_Init (void) {
+ return -1;
+}
+
+void UDP_Shutdown (void) {
+}
+
+void UDP_Listen (qboolean state) {
+}
+
+int UDP_OpenSocket (int port) {
+ return -1;
+}
+
+int UDP_CloseSocket (int socket) {
+ return -1;
+}
+
+int UDP_Connect (int socket, struct qsockaddr *addr) {
+ return 0;
+}
+
+int UDP_CheckNewConnections (void) {
+ return -1;
+}
+
+int UDP_Read (int socket, byte *buf, int len, struct qsockaddr *addr) {
+ return -1;
+}
+
+int UDP_MakeSocketBroadcastCapable (int socket) {
+ return -1;
+}
+
+int UDP_Broadcast (int socket, byte *buf, int len) {
+ return -1;
+}
+
+int UDP_Write (int socket, byte *buf, int len, struct qsockaddr *addr) {
+ return -1;
+}
+
+char *UDP_AddrToString (struct qsockaddr *addr) {
+ return NULL;
+}
+
+int UDP_StringToAddr (char *string, struct qsockaddr *addr) {
+ return -1;
+}
+
+int UDP_GetSocketAddr (int socket, struct qsockaddr *addr) {
+ return -1;
+}
+
+int UDP_GetNameFromAddr (struct qsockaddr *addr, char *name) {
+ return -1;
+}
+
+int UDP_GetAddrFromName(char *name, struct qsockaddr *addr) {
+ return -1;
+}
+
+int UDP_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2) {
+ return -1;
+}
+
+int UDP_GetSocketPort (struct qsockaddr *addr) {
+ return -1;
+}
+
+int UDP_SetSocketPort (struct qsockaddr *addr, int port) {
+ return 0;
+}
+
+#endif
view raw net_udp.patch hosted with ❤ by GitHub

--- quake1/net_dgrm.c 1999-12-22 01:53:26.034865152 +0200
+++ quake1_haiku/net_dgrm.c 2010-06-22 16:37:29.088342528 +0300
@@ -19,6 +19,11 @@
*/
// net_dgrm.c
+#include "quakedef.h"
+
+//#define HAVE_NET_DGRM
+#if defined(HAVE_NET_DGRM)
+
// This is enables a simple IP banning mechanism
#define BAN_TEST
@@ -52,7 +57,6 @@
#endif
#endif // BAN_TEST
-#include "quakedef.h"
#include "net_dgrm.h"
// these two macros are to make the code more readable
@@ -1388,3 +1392,53 @@
break;
return ret;
}
+#else
+
+int Datagram_Init (void) {
+ return -1;
+}
+
+void Datagram_Listen (qboolean state) {
+}
+
+void Datagram_SearchForHosts (qboolean xmit) {
+}
+
+qsocket_t *Datagram_Connect (char *host) {
+ return NULL;
+}
+
+qsocket_t *Datagram_CheckNewConnections (void) {
+ return NULL;
+}
+
+int Datagram_GetMessage (qsocket_t *sock) {
+ return -1;
+}
+
+int Datagram_SendMessage (qsocket_t *sock, sizebuf_t *data) {
+ return -1;
+}
+
+int Datagram_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data) {
+ return -1;
+}
+
+qboolean Datagram_CanSendMessage (qsocket_t *sock) {
+ return 0;
+}
+
+qboolean Datagram_CanSendUnreliableMessage (qsocket_t *sock)
+{
+ return false;
+}
+
+void Datagram_Close (qsocket_t *sock) {
+}
+
+void Datagram_Shutdown (void) {
+}
+
+
+#endif
+
view raw net_dgrm.patch hosted with ❤ by GitHub



My next patches will be the ones with audio to make it usable and also the network should be reenabled somehow 

2 comments:

Unknown said...

I am confused by the directions. They says to wget a net_dgrm.patch, a net_udp.patch, and then a second net_dgrm.patch.

The patching section then says to use a sys_sdl.patch, a net_dgrm.patch, and then a second sys_sdl.patch.

From where are the 2 sys_sdl patches retrieved and which of the 2 net_dgrm patches are used?

Popa Adrian Marius said...

thanks for the observation the first one is sys_sdl patch

now is fixed