Date: Mon, 8 Nov 2004 01:45:10 -0800 From: Bruce M Simpson <bms@spc.org> To: info@transgaming.com Cc: support@transgaming.com Subject: [PATCH] WineX: fix compilation on FreeBSD 5.3-RELEASE Message-ID: <20041108094510.GC3132@empiric.icir.org>
next in thread | raw e-mail | index | archive | help
--t0UkRYy7tHLRMCai
Content-Type: multipart/mixed; boundary="V0207lvV8h4k8FAm"
Content-Disposition: inline
--V0207lvV8h4k8FAm
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Good morning,
I'm one of the FreeBSD networking developers. I work at the International
Computer Science Institute in Berkeley, CA as a networking researcher.
I am particularly keen to try to get Half-Life working under FreeBSD with
OpenGL support, so I've spent a little time hacking WineX to compile under
5.3-RELEASE.
This patch is currently untested. A number of other developers in the
FreeBSD community are also interested in running Windows games under
FreeBSD using WineX, and I hope to have feedback from them soon.
I'd appreciate any comments from your developers, and look forward
to hearing from you.
Regards,
BMS
--V0207lvV8h4k8FAm
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="winex-20041108-fbsd53.diff"
Content-Transfer-Encoding: quoted-printable
This fixes the WineX build on FreeBSD 5.3-RELEASE for the !USE_PTHREADS
case. Untested.
Baseline: source checkout from CVS HEAD, 08:00 UTC, 8th Nov 2004.
Index: dlls/ntdll/cdrom.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/winex/dlls/ntdll/cdrom.c,v
retrieving revision 1.9
diff -u -p -r1.9 cdrom.c
--- dlls/ntdll/cdrom.c 18 Feb 2004 22:27:40 -0000 1.9
+++ dlls/ntdll/cdrom.c 8 Nov 2004 08:36:58 -0000
@@ -971,27 +971,11 @@ static DWORD CDROM_RawRead(int dev, cons
}
#elif defined(__FreeBSD__)
{
- struct ioc_read_audio ira;
+ off_t offset;
=20
- switch (raw->TrackMode)
- {
- case YellowMode2:
- FIXME("YellowMode2: NIY\n");
- return ret;
- case XAForm2:
- FIXME("XAForm2: NIY\n");
- return ret;
- case CDDA:
- /* 2048 =3D 2 ** 11 */
- if (raw->DiskOffset.s.HighPart & ~2047) FIXME("Unsupported val=
ue\n");
- ira.address.lba =3D ((raw->DiskOffset.s.LowPart >> 11) |
- raw->DiskOffset.s.HighPart << (32 - 11)) - 1;
- ira.address_format =3D CD_LBA_FORMAT;
- ira.nframes =3D raw->SectorCount;
- ira.buffer =3D buffer;
- io =3D ioctl(dev, CDIOCREADAUDIO, &ira);
- break;
- }
+ offset =3D ((raw->DiskOffset.s.LowPart >> 11) |
+ raw->DiskOffset.s.HighPart << (32 - 11)) - 1;
+ io =3D pread(dev, buffer, sectSize * raw->SectorCount, offset);
}
#elif defined(__NetBSD__)
{
Index: dlls/ntdll/signal_i386.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/winex/dlls/ntdll/signal_i386.c,v
retrieving revision 1.19
diff -u -p -r1.19 signal_i386.c
--- dlls/ntdll/signal_i386.c 27 Jul 2004 18:49:20 -0000 1.19
+++ dlls/ntdll/signal_i386.c 8 Nov 2004 08:36:58 -0000
@@ -881,6 +881,7 @@ static void set_vm86_pend( CONTEXT *cont
}
}
}
+#endif
=20
#if defined(USE_PTHREADS)
static void raise_signal_if_unexpected_thread( int sig, int sig_to_raise )
@@ -901,28 +902,6 @@ static void raise_signal_if_unexpected_t
#endif /* USE_PTHREADS */
=20
=20
-#if 0 /* Now using SIGUSR2 for eject handling */
-/**********************************************************************
- * usr2_handler
- *
- * Handler for SIGUSR2.
- * We use it to signal that the running __wine_enter_vm86() should
- * immediately set VIP_MASK, causing pending events to be handled
- * as early as possible.
- */
-static HANDLER_DEF(usr2_handler)
-{
- CONTEXT context;
-
- raise_signal_if_unexpected_thread( SIGUSR2, SIGQUIT );
-
- save_context( &context, HANDLER_CONTEXT );
- set_vm86_pend( &context );
- restore_context( &context, HANDLER_CONTEXT );
-}
-
-#else /* Now using SIGUSR2 for eject handling */
- =
=20
/**********************************************************************
* usr2_handler
*
@@ -984,16 +963,13 @@ static int get_cdrom_eject_drive(void)
return -1;=20
}
=20
-
static HANDLER_DEF(usr2_handler)
{
FILE_ForceEjectCDDrive(get_cdrom_eject_drive());
}
-#endif=20
-
-
=20
=20
+#if 0
/**********************************************************************
* alrm_handler
*
@@ -1011,9 +987,8 @@ static HANDLER_DEF(alrm_handler)
set_vm86_pend( &context );
restore_context( &context, HANDLER_CONTEXT );
}
-#else /* __HAVE_VM86 */
-# define raise_signal_if_unexpected_thread(a,b)
-#endif /* __HAVE_VM86 */
+#endif
+
=20
=20
/**********************************************************************
@@ -1284,7 +1259,9 @@ BOOL SIGNAL_Init(void)
#endif
#endif
=20
+#if 1
if (set_handler( SIGUSR2, have_sigaltstack, (void (*)())usr2_handler )=
=3D=3D -1) goto error;
+#endif
=20
#ifdef USE_PTHREADS
if (set_handler( SIGTERM, have_sigaltstack, (void (*)())sigterm_handle=
r ) =3D=3D -1) goto error;
Index: dlls/winedos/dosvm.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/winex/dlls/winedos/dosvm.c,v
retrieving revision 1.7
diff -u -p -r1.7 dosvm.c
--- dlls/winedos/dosvm.c 12 May 2004 18:54:54 -0000 1.7
+++ dlls/winedos/dosvm.c 8 Nov 2004 08:36:58 -0000
@@ -44,6 +44,8 @@ WINE_DECLARE_DEBUG_CHANNEL(relay);
WORD DOSVM_psp =3D 0;
WORD DOSVM_retval =3D 0;
=20
+static CRITICAL_SECTION qcrit;
+
#ifdef MZ_SUPPORTED
=20
#ifdef HAVE_SYS_VM86_H
@@ -69,7 +71,6 @@ typedef struct _DOSEVENT {
struct _DOSEVENT *next;
} DOSEVENT, *LPDOSEVENT;
=20
-static CRITICAL_SECTION qcrit;
static struct _DOSEVENT *pending_event, *current_event;
static int sig_sent;
static HANDLE event_notifier;
Index: dlls/wineps/font.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/winex/dlls/wineps/font.c,v
retrieving revision 1.3
diff -u -p -r1.3 font.c
--- dlls/wineps/font.c 18 Feb 2004 22:27:44 -0000 1.3
+++ dlls/wineps/font.c 8 Nov 2004 08:36:58 -0000
@@ -33,7 +33,7 @@ inline static BOOL is_stock_font( HFONT=20
* Scale font to requested lfHeight
*
*/
-inline static float round(float f)
+inline static float roundheight(float f)
{
return (f > 0) ? (f + 0.5) : (f - 0.5);
}
@@ -58,19 +58,19 @@ static VOID ScaleFont(const AFM *afm, LO
(float)(wm->usWinAscent + wm->usWinDescent);
}
=20
- font->size =3D (INT)round(font->scale * (float)wm->usUnitsPerEm);
+ font->size =3D (INT)roundheight(font->scale * (float)wm->usUnitsPerEm);
font->set =3D FALSE;
=20
- usUnitsPerEm =3D (USHORT)round((float)(wm->usUnitsPerEm) * font->scale=
);
- sAscender =3D (SHORT)round((float)(wm->sAscender) * font->scale);
- sDescender =3D (SHORT)round((float)(wm->sDescender) * font->scale);
- sLineGap =3D (SHORT)round((float)(wm->sLineGap) * font->scale);
- sTypoAscender =3D (SHORT)round((float)(wm->sTypoAscender) * font->scal=
e);
- sTypoDescender =3D (SHORT)round((float)(wm->sTypoDescender) * font->sc=
ale);
- sTypoLineGap =3D (SHORT)round((float)(wm->sTypoLineGap) * font->scale);
- usWinAscent =3D (USHORT)round((float)(wm->usWinAscent) * font->scale);
- usWinDescent =3D (USHORT)round((float)(wm->usWinDescent) * font->scale=
);
- sAvgCharWidth =3D (SHORT)round((float)(wm->sAvgCharWidth) * font->scal=
e);
+ usUnitsPerEm =3D (USHORT)roundheight((float)(wm->usUnitsPerEm) * font-=
>scale);
+ sAscender =3D (SHORT)roundheight((float)(wm->sAscender) * font->scale);
+ sDescender =3D (SHORT)roundheight((float)(wm->sDescender) * font->scal=
e);
+ sLineGap =3D (SHORT)roundheight((float)(wm->sLineGap) * font->scale);
+ sTypoAscender =3D (SHORT)roundheight((float)(wm->sTypoAscender) * font=
->scale);
+ sTypoDescender =3D (SHORT)roundheight((float)(wm->sTypoDescender) * fo=
nt->scale);
+ sTypoLineGap =3D (SHORT)roundheight((float)(wm->sTypoLineGap) * font->=
scale);
+ usWinAscent =3D (USHORT)roundheight((float)(wm->usWinAscent) * font->s=
cale);
+ usWinDescent =3D (USHORT)roundheight((float)(wm->usWinDescent) * font-=
>scale);
+ sAvgCharWidth =3D (SHORT)roundheight((float)(wm->sAvgCharWidth) * font=
->scale);
=20
tm->tmAscent =3D (LONG)usWinAscent;
tm->tmDescent =3D (LONG)usWinDescent;
@@ -114,7 +114,7 @@ static VOID ScaleFont(const AFM *afm, LO
=20
font->scale *=3D (float)wm->usUnitsPerEm / 1000.0;
=20
- tm->tmMaxCharWidth =3D (LONG)round(
+ tm->tmMaxCharWidth =3D (LONG)roundheight(
(afm->FontBBox.urx - afm->FontBBox.llx) * font->scale);
=20
TRACE("Selected PS font '%s' size %d weight %ld.\n", afm->FontName,
Index: dlls/wininet/internet.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/winex/dlls/wininet/internet.h,v
retrieving revision 1.5
diff -u -p -r1.5 internet.h
--- dlls/wininet/internet.h 12 Jan 2004 22:44:01 -0000 1.5
+++ dlls/wininet/internet.h 8 Nov 2004 08:36:58 -0000
@@ -29,6 +29,7 @@
#endif
#ifdef HAVE_NETINET_IN_H
# include <sys/types.h>
+# include <sys/socket.h>
# include <netinet/in.h>
#endif
=20
Index: scheduler/pthread.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/winex/scheduler/pthread.c,v
retrieving revision 1.15
diff -u -p -r1.15 pthread.c
--- scheduler/pthread.c 16 Mar 2004 20:16:04 -0000 1.15
+++ scheduler/pthread.c 8 Nov 2004 08:36:58 -0000
@@ -28,6 +28,8 @@ static int init_done;
static void create_atfork_cs(void);
static void grab_libc(void);
=20
+static CRITICAL_SECTION atfork_section;
+
void PTHREAD_init_done(void)
{
create_atfork_cs(); /* Must be called before setting init_done */
@@ -258,19 +260,12 @@ strong_alias(__pthread_kill_other_thread
=20
#define MAX_ATFORK 8 /* libc doesn't need that many anyway */
=20
-static CRITICAL_SECTION atfork_section;
typedef void (*atfork_handler)();
static atfork_handler atfork_prepare[MAX_ATFORK];
static atfork_handler atfork_parent[MAX_ATFORK];
static atfork_handler atfork_child[MAX_ATFORK];
static int atfork_count;
=20
-static void create_atfork_cs(void)
-{
- InitializeCriticalSection( &atfork_section );
- CRITICAL_SECTION_NAME( &atfork_section, "atfork_section" );
-}
-
int __pthread_atfork(void (*prepare)(void),
void (*parent)(void),
void (*child)(void))
@@ -711,4 +706,10 @@ static void grab_libc(void)
=20
#endif /* __GLIBC__ */
=20
+static void create_atfork_cs(void)
+{
+ InitializeCriticalSection( &atfork_section );
+ CRITICAL_SECTION_NAME( &atfork_section, "atfork_section" );
+}
+
#endif /* USE_PTHREADS */
Index: server/fd_server.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/winex/server/fd_server.c,v
retrieving revision 1.10
diff -u -p -r1.10 fd_server.c
--- server/fd_server.c 4 Aug 2004 12:26:33 -0000 1.10
+++ server/fd_server.c 8 Nov 2004 08:36:58 -0000
@@ -547,6 +547,24 @@ static void create_fd_server( int fd )
=20
pthread_attr_destroy( &attr );
}
+#elif defined(__FreeBSD__)
+ {
+ pid_t child;
+
+ switch (child =3D rfork(RFMEM | RFPROC)) {
+ case 0:
+ /* in child, successful */
+ exit(fd_server_thread(NULL));
+ break;
+ case -1:
+ /* in parent, unsuccessful */
+ fatal_perror( "wineserver: rfork" );
+ break;
+ default:
+ /* in parent, successful */
+ break;
+ }
+ }
#else
{
void* stack =3D malloc( stack_size );
Index: server/mem_malloc.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/winex/server/mem_malloc.c,v
retrieving revision 1.2
diff -u -p -r1.2 mem_malloc.c
--- server/mem_malloc.c 24 Jun 2004 20:17:58 -0000 1.2
+++ server/mem_malloc.c 8 Nov 2004 08:36:58 -0000
@@ -7,6 +7,7 @@
#define DEBUG /* In case you need to turn on some more debug checks=
to track down a corruptor. Need to have PH_TRACE on to make sense */
#endif
=20
+#include "config.h"
#include "mem_defs.h"
#include "mem_globals.c"
=20
--V0207lvV8h4k8FAm--
--t0UkRYy7tHLRMCai
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Comment: ''
iD8DBQFBj0AmueUpAYYNtTsRAtnxAJ91bR8yr/SbwU2pJZrTeoH703CR2ACeI9ym
JmBoPdOgGDO1lRE2c+5GBvw=
=JdNn
-----END PGP SIGNATURE-----
--t0UkRYy7tHLRMCai--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041108094510.GC3132>
