Compile fixes, some whitespace. This file should be nuked, but I won't do

it until the normal system-level support for Win32 can support the SDL
targets.
This commit is contained in:
Jeff Teunissen 2000-12-08 04:42:21 +00:00
parent d3da228aef
commit 1e604c6c33

View file

@ -29,12 +29,9 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include "config.h"
#endif #endif
#include <SDL\SDL.H>
#include <SDL\SDL_main.H>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -44,7 +41,7 @@
#include <io.h> #include <io.h>
#include <conio.h> #include <conio.h>
#ifndef WIN32 #ifndef _WIN32
#include <unistd.h> #include <unistd.h>
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
@ -56,6 +53,9 @@
#include <sys/mman.h> #include <sys/mman.h>
#endif #endif
#include <SDL.H>
#include <SDL_main.H>
#include "sys.h" #include "sys.h"
#include "qargs.h" #include "qargs.h"
#include "qargs.h" #include "qargs.h"
@ -66,20 +66,19 @@ qboolean is_server = false;
int starttime; int starttime;
#ifdef WIN32 #ifdef _WIN32
# include "winquake.h" # include "winquake.h"
// fixme: minimized is not currently supported under SDL // fixme: minimized is not currently supported under SDL
qboolean Minimized=false; qboolean Minimized=false;
void MaskExceptions (void); void MaskExceptions (void);
#endif #endif
#define BASEDIR "." void
Sys_DebugLog (char *file, char *fmt, ...)
void Sys_DebugLog(char *file, char *fmt, ...)
{ {
va_list argptr;
static char data[1024]; // why static ?
int fd; int fd;
static char data[1024]; // why static ?
va_list argptr;
va_start (argptr, fmt); va_start (argptr, fmt);
vsnprintf (data, sizeof (data), fmt, argptr); vsnprintf (data, sizeof (data), fmt, argptr);
@ -97,20 +96,18 @@ FILE IO
=============================================================================== ===============================================================================
*/ */
int Sys_FileTime (char *path) int
Sys_FileTime (char *path)
{ {
QFile *f; QFile *f;
int t, retval; int t, retval;
f = Qopen (path, "rb"); f = Qopen (path, "rb");
if (f) if (f) {
{
Qclose(f); Qclose(f);
retval = 1; retval = 1;
} } else {
else
{
retval = -1; retval = -1;
} }
@ -131,13 +128,14 @@ SYSTEM IO
Sys_MakeCodeWriteable Sys_MakeCodeWriteable
================ ================
*/ */
void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length) void
Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length)
{ {
#ifdef WIN32 #ifdef _WIN32
DWORD flOldProtect; DWORD flOldProtect;
//@@@ copy on write or just read-write? // copy on write or just read-write?
if (!VirtualProtect ((LPVOID) startaddr, length, PAGE_READWRITE, &flOldProtect)) if (!VirtualProtect ((LPVOID) startaddr, length, PAGE_READWRITE, &flOldProtect))
Sys_Error ("Protection change failed\n"); Sys_Error ("Protection change failed\n");
#else #else
@ -163,7 +161,8 @@ void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length)
Sys_Init Sys_Init
================ ================
*/ */
void Sys_Init (void) void
Sys_Init (void)
{ {
#ifdef WIN32 #ifdef WIN32
@ -171,13 +170,13 @@ void Sys_Init (void)
#endif #endif
#ifdef USE_INTEL_ASM #ifdef USE_INTEL_ASM
#ifdef WIN32 #ifdef _WIN32
MaskExceptions (); MaskExceptions ();
#endif #endif
Sys_SetFPCW (); Sys_SetFPCW ();
#endif #endif
#ifdef WIN32 #ifdef _WIN32
// make sure the timer is high precision, otherwise // make sure the timer is high precision, otherwise
// NT gets 18ms resolution // NT gets 18ms resolution
timeBeginPeriod (1); timeBeginPeriod (1);
@ -187,22 +186,20 @@ void Sys_Init (void)
if (!GetVersionEx (&vinfo)) if (!GetVersionEx (&vinfo))
Sys_Error ("Couldn't get OS info"); Sys_Error ("Couldn't get OS info");
if ((vinfo.dwMajorVersion < 4) || if ((vinfo.dwMajorVersion < 4) || (vinfo.dwPlatformId == VER_PLATFORM_WIN32s)) {
(vinfo.dwPlatformId == VER_PLATFORM_WIN32s))
{
Sys_Error ("This version of " PROGRAM " requires at least Win95 or NT 4.0"); Sys_Error ("This version of " PROGRAM " requires at least Win95 or NT 4.0");
} }
#endif #endif
} }
void Sys_Error (char *error, ...) void
Sys_Error (char *error, ...)
{ {
va_list argptr; va_list argptr;
char text[1024];//, text2[1024]; char text[1024];
#ifndef WIN32 #ifndef _WIN32
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NONBLOCK); fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NONBLOCK);
#endif #endif
va_start (argptr, error); va_start (argptr, error);