* Port to MinGW

This commit is contained in:
Tim Angus 2005-09-22 03:21:33 +00:00
parent 50eb77ed1a
commit fcaf343d7f
28 changed files with 347 additions and 64 deletions

View file

@ -1592,7 +1592,7 @@ qboolean GLimp_SpawnRenderThread( void (*function)( void ) ) {
(LPTHREAD_START_ROUTINE)GLimp_RenderThreadWrapper, // LPTHREAD_START_ROUTINE lpStartAddr,
0, // LPVOID lpvThreadParm,
0, // DWORD fdwCreate,
&renderThreadId );
(long *)&renderThreadId );
if ( !renderThreadHandle ) {
return qfalse;

View file

@ -195,7 +195,7 @@ DIRECT INPUT MOUSE CONTROL
#undef DEFINE_GUID
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
EXTERN_C const GUID name \
const GUID name \
= { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
DEFINE_GUID(GUID_SysMouse, 0x6F1D2B60,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
@ -279,7 +279,7 @@ qboolean IN_InitDIMouse( void ) {
}
if (!pDirectInputCreate) {
pDirectInputCreate = (long (__stdcall *)(void *,unsigned long ,struct IDirectInputA ** ,struct IUnknown *))
pDirectInputCreate = (HRESULT (WINAPI *)(HINSTANCE, DWORD, LPDIRECTINPUT *, LPUNKNOWN))
GetProcAddress(hInstDI,"DirectInputCreateA");
if (!pDirectInputCreate) {
@ -403,7 +403,6 @@ void IN_DIMouse( int *mx, int *my ) {
DWORD dwElements;
HRESULT hr;
int value;
static float oldSysTime;
if ( !g_pMouse ) {
return;
@ -929,7 +928,7 @@ void IN_JoyMove( void ) {
if ( joyGetPosEx (joy.id, &joy.ji) != JOYERR_NOERROR ) {
// read error occurred
// turning off the joystick seems too harsh for 1 read error,\
// turning off the joystick seems too harsh for 1 read error,
// but what should be done?
// Com_Printf ("IN_ReadJoystick: no response\n");
// joy.avail = false;

View file

@ -73,7 +73,7 @@ LONG WINAPI MainWndProc (
void Conbuf_AppendText( const char *msg );
void SNDDMA_Activate( void );
int SNDDMA_InitDS ();
int SNDDMA_InitDS (void);
typedef struct
{

View file

@ -56,7 +56,7 @@ void Spk_Open(char *name)
fh = open( name, O_TRUNC | O_CREAT | O_WRONLY, S_IREAD | S_IWRITE );
};
void Spk_Close()
void Spk_Close(void)
{
if (!fh)
return;
@ -526,7 +526,7 @@ extern char *FS_BuildOSPath( const char *base, const char *game, const char *qp
// fqpath param added 7/20/02 by T.Ray - Sys_LoadDll is only called in vm.c at this time
// fqpath will be empty if dll not loaded, otherwise will hold fully qualified path of dll module loaded
// fqpath buffersize must be at least MAX_QPATH+1 bytes long
void * QDECL Sys_LoadDll( const char *name, char *fqpath , int (QDECL **entryPoint)(int, ...),
void * QDECL Sys_LoadDll( const char *name, char *fqpath , long (QDECL **entryPoint)(long, ...),
long (QDECL *systemcalls)(long, ...) ) {
static int lastWarning = 0;
HINSTANCE libHandle;
@ -1100,7 +1100,11 @@ void Sys_Init( void ) {
{
Com_Printf( "...detecting CPU, found " );
#ifndef __MINGW32__
cpuid = Sys_GetProcessorId();
#else // See comments in win_shared.c
cpuid = CPUID_GENERIC;
#endif
switch ( cpuid )
{

View file

@ -488,7 +488,7 @@ int NET_IPSocket( char *net_interface, int port ) {
}
// make it non-blocking
if( ioctlsocket( newsocket, FIONBIO, &_true ) == SOCKET_ERROR ) {
if( ioctlsocket( newsocket, FIONBIO, (u_long *)&_true ) == SOCKET_ERROR ) {
Com_Printf( "WARNING: UDP_OpenSocket: ioctl FIONBIO: %s\n", NET_ErrorString() );
return 0;
}
@ -799,7 +799,7 @@ int NET_IPXSocket( int port ) {
}
// make it non-blocking
if( ioctlsocket( newsocket, FIONBIO, &_true ) == SOCKET_ERROR ) {
if( ioctlsocket( newsocket, FIONBIO, (u_long *)&_true ) == SOCKET_ERROR ) {
Com_Printf( "WARNING: IPX_Socket: ioctl FIONBIO: %s\n", NET_ErrorString() );
return 0;
}

View file

@ -3220,8 +3220,12 @@ static qboolean GlideIsValid( void )
return qfalse;
}
#ifdef _MSC_VER
# pragma warning (disable : 4113 4133 4047 )
# define GPA( a ) GetProcAddress( glw_state.hinstOpenGL, a )
#else
# define GPA( a ) (void *)GetProcAddress( glw_state.hinstOpenGL, a )
#endif
/*
** QGL_Init
@ -4368,7 +4372,9 @@ void QGL_EnableLogging( qboolean enable )
}
}
#ifdef _MSC_VER
#pragma warning (default : 4113 4133 4047 )
#endif

View file

@ -59,14 +59,19 @@ Sys_SnapVector
================
*/
long fastftol( float f ) {
#ifndef __MINGW32__
static int tmp;
__asm fld f
__asm fistp tmp
__asm mov eax, tmp
#else
return (long)f;
#endif
}
void Sys_SnapVector( float *v )
{
#ifndef __MINGW32__
int i;
float f;
@ -91,6 +96,11 @@ void Sys_SnapVector( float *v )
v++;
*v = fastftol(*v);
*/
#else
v[0] = rint(v[0]);
v[1] = rint(v[1]);
v[2] = rint(v[2]);
#endif
}
@ -99,8 +109,13 @@ void Sys_SnapVector( float *v )
** Disable all optimizations temporarily so this code works correctly!
**
*/
#ifdef _MSC_VER
#pragma optimize( "", off )
#endif
// If you fancy porting this stuff to AT&T then feel free... :)
// It's not actually used functionally though, so it may be a waste of effort
#ifndef __MINGW32__
/*
** --------------------------------------------------------------------------------
**
@ -268,13 +283,16 @@ int Sys_GetProcessorId( void )
#endif
}
#endif
/*
**
** Re-enable optimizations back to what they were
**
*/
#ifdef _MSC_VER
#pragma optimize( "", on )
#endif
//============================================

View file

@ -135,7 +135,7 @@ qboolean SNDDMA_Init(void) {
#undef DEFINE_GUID
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
EXTERN_C const GUID name \
const GUID name \
= { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
// DirectSound Component GUID {47D4D946-62E8-11CF-93BC-444553540000}
@ -331,8 +331,8 @@ void SNDDMA_BeginPainting( void ) {
reps = 0;
dma.buffer = NULL;
while ((hresult = pDSBuf->lpVtbl->Lock(pDSBuf, 0, gSndBufSize, &pbuf, &locksize,
&pbuf2, &dwSize2, 0)) != DS_OK)
while ((hresult = pDSBuf->lpVtbl->Lock(pDSBuf, 0, gSndBufSize, (LPVOID)&pbuf, &locksize,
(LPVOID)&pbuf2, &dwSize2, 0)) != DS_OK)
{
if (hresult != DSERR_BUFFERLOST)
{

View file

@ -7,7 +7,11 @@
//
// Generated from the TEXTINCLUDE 2 resource.
//
#ifndef __MINGW32__
#include "winres.h"
#else
#include <winresrc.h>
#endif
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@ -53,7 +57,11 @@ END
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
#ifndef __MINGW32__
IDI_ICON1 ICON DISCARDABLE "qe3.ico"
#else
IDI_ICON1 ICON DISCARDABLE "../win32/qe3.ico"
#endif
/////////////////////////////////////////////////////////////////////////////
//