aboutsummaryrefslogtreecommitdiffstats
path: root/code/win32
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-09-22 03:21:33 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-09-22 03:21:33 +0000
commitdf30c9d13185a525d2c45de3becd39c4a178f484 (patch)
tree3cf10550bfe1d9473252bfc3ad56b8007652e622 /code/win32
parent3873056dc5e0a7c314fa42dd70c072027ccccec0 (diff)
downloadioquake3-aero-df30c9d13185a525d2c45de3becd39c4a178f484.tar.gz
ioquake3-aero-df30c9d13185a525d2c45de3becd39c4a178f484.zip
* Port to MinGW
git-svn-id: svn://svn.icculus.org/quake3/trunk@97 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/win32')
-rw-r--r--code/win32/win_glimp.c2
-rw-r--r--code/win32/win_input.c7
-rw-r--r--code/win32/win_local.h2
-rw-r--r--code/win32/win_main.c8
-rw-r--r--code/win32/win_net.c4
-rw-r--r--code/win32/win_qgl.c6
-rw-r--r--code/win32/win_shared.c18
-rw-r--r--code/win32/win_snd.c6
-rw-r--r--code/win32/winquake.rc8
9 files changed, 48 insertions, 13 deletions
diff --git a/code/win32/win_glimp.c b/code/win32/win_glimp.c
index acb14ad..3a05109 100644
--- a/code/win32/win_glimp.c
+++ b/code/win32/win_glimp.c
@@ -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;
diff --git a/code/win32/win_input.c b/code/win32/win_input.c
index a5ec47a..bf312f2 100644
--- a/code/win32/win_input.c
+++ b/code/win32/win_input.c
@@ -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;
diff --git a/code/win32/win_local.h b/code/win32/win_local.h
index 86d512b..9a4183c 100644
--- a/code/win32/win_local.h
+++ b/code/win32/win_local.h
@@ -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
{
diff --git a/code/win32/win_main.c b/code/win32/win_main.c
index ff079e5..a66f712 100644
--- a/code/win32/win_main.c
+++ b/code/win32/win_main.c
@@ -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 )
{
diff --git a/code/win32/win_net.c b/code/win32/win_net.c
index 42c08ee..deadbbf 100644
--- a/code/win32/win_net.c
+++ b/code/win32/win_net.c
@@ -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;
}
diff --git a/code/win32/win_qgl.c b/code/win32/win_qgl.c
index 57277a4..0656006 100644
--- a/code/win32/win_qgl.c
+++ b/code/win32/win_qgl.c
@@ -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
diff --git a/code/win32/win_shared.c b/code/win32/win_shared.c
index 012a291..0179edc 100644
--- a/code/win32/win_shared.c
+++ b/code/win32/win_shared.c
@@ -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
//============================================
diff --git a/code/win32/win_snd.c b/code/win32/win_snd.c
index 084ed44..f3f7c50 100644
--- a/code/win32/win_snd.c
+++ b/code/win32/win_snd.c
@@ -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)
{
diff --git a/code/win32/winquake.rc b/code/win32/winquake.rc
index c99e257..0d78b89 100644
--- a/code/win32/winquake.rc
+++ b/code/win32/winquake.rc
@@ -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
/////////////////////////////////////////////////////////////////////////////
//