Lots of win32 (mingw cross) build fixes.

HTTP (curl) support is missing, but everything else builds.
This commit is contained in:
Bill Currie 2010-12-23 11:40:16 +09:00
parent 17b37e93b2
commit de04e1b602
23 changed files with 68 additions and 44 deletions

View file

@ -77,10 +77,6 @@ extern LPDIRECTDRAWSURFACE lpBackBuffer;
extern LPDIRECTDRAWPALETTE lpDDPal;
#endif
#ifdef HAVE_DSOUND_H
extern LPDIRECTSOUND pDS;
extern LPDIRECTSOUNDBUFFER pDSBuf;
#endif
void VID_LockBuffer (void);
void VID_UnlockBuffer (void);
void VID_UpdateWindowStatus (int window_x, int window_y);
@ -100,8 +96,6 @@ extern qboolean winsock_lib_initialized;
extern int window_center_x, window_center_y;
extern RECT window_rect;
extern qboolean mouseinitialized;
#ifdef SPLASH_SCREEN
extern HWND hwnd_dialog;
#endif

View file

@ -334,10 +334,10 @@ SNDDMA_InitDirect (void)
&dwWrite);
IDirectSoundBuffer_Play (pDSBuf, 0, 0, DSBPLAY_LOOPING);
sn.samples = gSndBufSize / (sn.samplebits / 8);
sn.samplepos = 0;
sn.frames = gSndBufSize / (sn.samplebits / 8) / sn.channels;
sn.framepos = 0;
sn.submission_chunk = 1;
sn.buffer = lpData;
sn.buffer = (byte *) lpData;
sample16 = (sn.samplebits / 8) - 1;
dsound_init = true;
@ -403,8 +403,9 @@ SNDDMA_GetDMAPos (void)
s = mmtime.u.sample - mmstarttime.u.sample;
s >>= sample16;
s /= sn.channels;
s &= (sn.samples - 1);
s %= sn.frames;
return s;
}
@ -483,7 +484,7 @@ DSOUND_ClearBuffer (int clear)
// FIXME: this should be called with 2nd pbuf2 = NULL, dwsize =0
pData = DSOUND_LockBuffer (true);
memset (pData, clear, sn.samples * sn.samplebits / 8);
memset (pData, clear, sn.frames * sn.channels * sn.samplebits / 8);
DSOUND_LockBuffer (false);
}

View file

@ -250,8 +250,8 @@ SNDDMA_InitWav (void)
}
}
sn.samples = gSndBufSize / (sn.samplebits / 8);
sn.samplepos = 0;
sn.frames = gSndBufSize / (sn.samplebits / 8) / sn.channels;
sn.framepos = 0;
sn.submission_chunk = 1;
sn.buffer = (unsigned char *) lpData;
sample16 = (sn.samplebits / 8) - 1;
@ -295,8 +295,9 @@ SNDDMA_GetDMAPos (void)
s = snd_sent * WAV_BUFFER_SIZE;
s >>= sample16;
s /= sn.channels;
s &= (sn.samples - 1);
s %= sn.frames;
return s;
}

View file

@ -50,6 +50,11 @@ static __attribute__ ((used)) const char rcsid[] =
#include "QF/sound.h"
#ifdef _WIN32
# include "winquake.h"
HWND mainwindow;
#endif
#define MEMSIZE (32 * 1024 * 1024)
cbuf_t *testsound_cbuf;

View file

@ -336,17 +336,18 @@ setgeometry_status (view_t *view)
sb->text = realloc (sb->text, sb->width);
memset (sb->text, 0, sb->width); // force an update
}
#ifdef SIGWINCH
static void
sigwinch (int sig)
{
interrupted = 1;
signal (SIGWINCH, sigwinch);
}
#endif
static void
get_size (int *xlen, int *ylen)
{
#if 0
struct winsize size;
*xlen = *ylen = 0;
@ -354,6 +355,8 @@ get_size (int *xlen, int *ylen)
return;
*xlen = size.ws_col;
*ylen = size.ws_row;
#endif
getmaxyx (stdscr, *ylen, *xlen);
}
static void
@ -363,12 +366,14 @@ process_input (void)
int escape = 0;
if (interrupted) {
#ifdef SIGWINCH
interrupted = 0;
get_size (&screen_x, &screen_y);
resizeterm (screen_y, screen_x);
con_linewidth = screen_x;
view_resize (sv_con_data.view, screen_x, screen_y);
sv_con_data.view->draw (sv_con_data.view);
#endif
}
for (ch = 1; ch; ) {
@ -557,7 +562,9 @@ create_input_line (int width)
static void
init (void)
{
#ifdef SIGWINCH
signal (SIGWINCH, sigwinch);
#endif
initscr ();
start_color ();

View file

@ -88,10 +88,14 @@ static __attribute__ ((used)) const char rcsid[] =
#endif
#ifndef HAVE_SOCKLEN_T
# ifdef HAVE_SIZE
typedef size_t socklen_t;
# ifdef _WIN32
typedef int socklen_t;
# else
# ifdef HAVE_SIZE
typedef size_t socklen_t;
# else
typedef unsigned int socklen_t;
# endif
# endif
#endif

View file

@ -59,7 +59,8 @@ static __attribute__ ((used)) const char rcsid[] =
#ifdef BAN_TEST
#if defined(_WIN32)
#include <windows.h>
#include "winquake.h"
typedef uint32_t in_addr_t;
#else
# include <sys/socket.h>
# include <netinet/in.h>

View file

@ -413,12 +413,13 @@ WINS_CheckNewConnections (void)
//=============================================================================
int
WINS_Read (int socket, byte * buf, int len, struct qsockaddr *addr)
WINS_Read (int socket, byte *buf, int len, struct qsockaddr *addr)
{
int addrlen = sizeof (struct qsockaddr);
int ret;
ret = precvfrom (socket, buf, len, 0, (struct sockaddr *) addr, &addrlen);
ret = precvfrom (socket, (char *) buf, len, 0, (struct sockaddr *) addr,
&addrlen);
if (ret == -1) {
int err = pWSAGetLastError ();
@ -469,13 +470,13 @@ WINS_Broadcast (int socket, byte * buf, int len)
//=============================================================================
int
WINS_Write (int socket, byte * buf, int len, struct qsockaddr *addr)
WINS_Write (int socket, byte *buf, int len, struct qsockaddr *addr)
{
int ret;
ret =
psendto (socket, buf, len, 0, (struct sockaddr *) addr,
psendto (socket, (char *) buf, len, 0, (struct sockaddr *) addr,
sizeof (struct qsockaddr));
if (ret == -1)
if (pWSAGetLastError () == WSAEWOULDBLOCK)

View file

@ -193,14 +193,15 @@ LoadBSPMem (void *mem, size_t mem_size, void (*cb) (const bsp_t *, void *),
void *cbdata)
{
bsp_t *bsp;
int version;
bsp = calloc (sizeof (bsp_t), 1);
bsp->header = mem;
if (LittleLong (bsp->header->version) != BSPVERSION)
Sys_Error ("version %i, not %i", LittleLong (bsp->header->version),
BSPVERSION);
version = LittleLong (bsp->header->version);
if (version != BSPVERSION)
Sys_Error ("version %i, not %i", version, BSPVERSION);
#undef SET_LUMP
#define SET_LUMP(l,n) \

View file

@ -604,7 +604,7 @@ Sys_ConsoleInput (void)
}
text[len] = c;
len++;
if (len < sizeof (text))
if (len < (int) sizeof (text))
text[len] = 0;
else {
// buffer is full

View file

@ -157,7 +157,7 @@ VID_SetWindowedMode ( void )
height = rect.bottom - rect.top;
// Create the window
mainwindow = CreateWindow ("QuakeForge", PROGRAM,
mainwindow = CreateWindow ("QuakeForge", PACKAGE_NAME,
WindowStyle, rect.left, rect.top, width, height,
NULL, NULL, global_hInstance, NULL);
@ -382,7 +382,8 @@ VID_Shutdown (void)
{
HGLRC hRC;
HDC hDC;
int i, temp[8192];
int i;
GLuint temp[8192];
#ifdef SPLASH_SCREEN
if(hwnd_dialog)

View file

@ -93,7 +93,7 @@ startup (void)
if ((vinfo.dwMajorVersion < 4)
|| (vinfo.dwPlatformId == VER_PLATFORM_WIN32s)) {
Sys_Error ("This version of " PROGRAM
Sys_Error ("This version of " PACKAGE_NAME
" requires at least Win95 or NT 4.0");
}
#endif

View file

@ -70,7 +70,7 @@ main (int argc, const char **argv)
if (!strcmp (argv[i], "-dedicated"))
break;
if (i == argc) {
char **newargv;
const char **newargv;
newargv = malloc ((argc + 2) * sizeof (*newargv));
memcpy (newargv, argv, argc * 4);

View file

@ -113,7 +113,11 @@ qtv_print (const char *fmt, va_list args)
} else {
mytime = time (NULL);
local = localtime (&mytime);
#ifdef _WIN32
strftime (stamp, sizeof (stamp), "[%b %d %X] ", local);
#else
strftime (stamp, sizeof (stamp), "[%b %e %X] ", local);
#endif
Con_Printf ("%s%s", stamp, msg->str);
}
if (msg->str[0] && msg->str[strlen (msg->str) - 1] != '\n') {

View file

@ -421,7 +421,7 @@ extern struct cvar_s *sv_highchars;
extern struct cvar_s *sv_mintic, *sv_maxtic;
extern struct cvar_s *sv_maxspeed;
extern struct cvar_s *timeout;
extern struct cvar_s *sv_timeout;
extern netadr_t master_adr[MAX_MASTERS]; // address of the master server

View file

@ -94,7 +94,7 @@ startup (void)
if ((vinfo.dwMajorVersion < 4)
|| (vinfo.dwPlatformId == VER_PLATFORM_WIN32s)) {
Sys_Error ("This version of " PROGRAM
Sys_Error ("This version of " PACKAGE_NAME
" requires at least Win95 or NT 4.0");
}
#endif

View file

@ -104,7 +104,7 @@ startup (void)
if ((vinfo.dwMajorVersion < 4) ||
(vinfo.dwPlatformId == VER_PLATFORM_WIN32s)) {
Sys_Error ("This version of " PROGRAM
Sys_Error ("This version of " PACKAGE_NAME
" requires a full Win32 implementation.");
}

View file

@ -505,7 +505,11 @@ ma_log (const char *fmt, ...)
mytime = time (NULL);
local = localtime (&mytime);
#ifdef _WIN32
strftime (stamp, sizeof (stamp), "[%b %d %X] ", local);
#else
strftime (stamp, sizeof (stamp), "[%b %e %X] ", local);
#endif
fprintf (stdout, "%s", stamp);
va_start (args, fmt);
vfprintf (stdout, fmt, args);

View file

@ -141,7 +141,7 @@ cvar_t *sv_maxtic; // physics time tic
cvar_t *sv_netdosprotect; // tone down DoS from quake servers
cvar_t *timeout; // seconds without any message
cvar_t *sv_timeout; // seconds without any message
cvar_t *zombietime; // seconds to sink messages after
// disconnect
@ -1839,7 +1839,7 @@ SV_CheckTimeouts (void)
float droptime;
int nclients, i;
droptime = realtime - timeout->value;
droptime = realtime - sv_timeout->value;
nclients = 0;
for (i = 0, cl = svs.clients; i < MAX_CLIENTS; i++, cl++) {
@ -2104,8 +2104,8 @@ SV_InitLocal (void)
"Spawn the player entity");
watervis = Cvar_Get ("watervis", "0", CVAR_SERVERINFO, Cvar_Info,
"Set nonzero to enable r_wateralpha on clients");
timeout = Cvar_Get ("timeout", "65", CVAR_NONE, NULL, "Sets the amount of "
"time in seconds before a client is considered "
sv_timeout = Cvar_Get ("timeout", "65", CVAR_NONE, NULL, "Sets the amount "
"of time in seconds before a client is considered "
"disconnected if the server does not receive a "
"packet");
zombietime = Cvar_Get ("zombietime", "2", CVAR_NONE, NULL, "The number of "

View file

@ -457,7 +457,7 @@ SV_qtvCheckTimeouts (void)
float droptime;
sv_qtv_t *proxy;
droptime = realtime - timeout->value;
droptime = realtime - sv_timeout->value;
for (i = 0; i < MAX_PROXIES; i++) {
proxy = proxies + i;

View file

@ -64,7 +64,7 @@ startup (void)
if ((vinfo.dwMajorVersion < 4) ||
(vinfo.dwPlatformId == VER_PLATFORM_WIN32s)) {
Sys_Error (PROGRAM " requires at least Win95 or NT 4.0");
Sys_Error (PACKAGE_NAME " requires at least Win95 or NT 4.0");
}
if (vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT)

View file

@ -169,7 +169,7 @@ LightWorld (void)
BSP_AddLighting (bsp, (byte *) lightdata->str, lightdata->size);
if (options.verbosity >= 0)
printf ("lightdatasize: %zi\n", bsp->lightdatasize);
printf ("lightdatasize: %ld\n", (long) bsp->lightdatasize);
}
int

View file

@ -317,7 +317,7 @@ WatchThread (void *_thread)
int ind = 0;
while (1) {
sleep (1);
usleep (1000000);
for (i = 0; i < thread; i ++)
local_work[i] = working[i];
@ -884,8 +884,8 @@ main (int argc, char **argv)
BSP_AddVisibility (bsp, (byte *) visdata->str, visdata->size);
if (options.verbosity >= 0)
printf ("visdatasize:%zi compressed from %zi\n", bsp->visdatasize,
originalvismapsize);
printf ("visdatasize:%ld compressed from %ld\n",
(long) bsp->visdatasize, (long) originalvismapsize);
CalcAmbientSounds ();