mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
More header fixes, whitespace cleanups.
This commit is contained in:
parent
9a678a5e63
commit
500b5c09d3
3 changed files with 85 additions and 124 deletions
|
@ -29,38 +29,41 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#ifdef HAVE_IO_H
|
||||
# include <io.h>
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#ifdef HAVE_CONIO_H
|
||||
# include <conio.h>
|
||||
#endif
|
||||
#ifdef HAVE_IO_H
|
||||
# include <io.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
# include <unistd.h>
|
||||
# include <stdarg.h>
|
||||
# include <string.h>
|
||||
# include <ctype.h>
|
||||
# include <fcntl.h>
|
||||
# include <signal.h>
|
||||
# include <limits.h>
|
||||
# include <sys/types.h>
|
||||
# include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <SDL.h>
|
||||
#include <SDL_main.h>
|
||||
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/qargs.h"
|
||||
|
||||
#include "client.h"
|
||||
#include "compat.h"
|
||||
|
@ -74,8 +77,7 @@ int noconinput;
|
|||
|
||||
#ifdef _WIN32
|
||||
# include "winquake.h"
|
||||
// FIXME: minimized is not currently supported under
|
||||
// SDL
|
||||
// FIXME: minimized is not currently supported under SDL
|
||||
qboolean Minimized = false;
|
||||
void MaskExceptions (void);
|
||||
#endif
|
||||
|
@ -110,8 +112,7 @@ Sys_Init (void)
|
|||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
// make sure the timer is high precision, otherwise
|
||||
// NT gets 18ms resolution
|
||||
// make sure the timer is high precision, otherwise NT gets 18ms resolution
|
||||
timeBeginPeriod (1);
|
||||
|
||||
vinfo.dwOSVersionInfoSize = sizeof (vinfo);
|
||||
|
@ -127,9 +128,6 @@ Sys_Init (void)
|
|||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
Sys_Quit
|
||||
*/
|
||||
void
|
||||
Sys_Quit (void)
|
||||
{
|
||||
|
@ -137,15 +135,11 @@ Sys_Quit (void)
|
|||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Sys_Error
|
||||
*/
|
||||
void
|
||||
Sys_Error (const char *error, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char text[1024];
|
||||
va_list argptr;
|
||||
|
||||
#ifndef _WIN32
|
||||
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NONBLOCK);
|
||||
|
@ -180,7 +174,6 @@ Sys_DebugLog (const char *file, const char *fmt, ...)
|
|||
close (fd);
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Sys_ConsoleInput
|
||||
|
||||
|
@ -193,39 +186,32 @@ Sys_ConsoleInput (void)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
#ifndef USE_INTEL_ASM
|
||||
void
|
||||
Sys_HighFPPrecision (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Sys_LowFPPrecision (void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
Sys_Sleep (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#ifndef SDL_main
|
||||
# define SDL_main main
|
||||
#endif
|
||||
|
||||
/*
|
||||
main
|
||||
*/
|
||||
int
|
||||
SDL_main (int c, char **v)
|
||||
{
|
||||
double time, oldtime, newtime;
|
||||
int j;
|
||||
double time, oldtime, newtime;
|
||||
|
||||
#ifndef WIN32
|
||||
signal (SIGFPE, SIG_IGN);
|
||||
|
|
|
@ -30,19 +30,26 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include <limits.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/qargs.h"
|
||||
|
@ -79,9 +86,6 @@ Sys_Init (void)
|
|||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
Sys_Quit
|
||||
*/
|
||||
void
|
||||
Sys_Quit (void)
|
||||
{
|
||||
|
@ -93,14 +97,11 @@ Sys_Quit (void)
|
|||
exit (0);
|
||||
}
|
||||
|
||||
/*
|
||||
Sys_Error
|
||||
*/
|
||||
void
|
||||
Sys_Error (const char *error, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char string[1024];
|
||||
va_list argptr;
|
||||
|
||||
// change stdin to non blocking
|
||||
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NONBLOCK);
|
||||
|
@ -142,7 +143,6 @@ Sys_DebugLog (const char *file, const char *fmt, ...)
|
|||
close (fd);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
floating_point_exception_handler (int whatever)
|
||||
{
|
||||
|
@ -150,7 +150,6 @@ floating_point_exception_handler (int whatever)
|
|||
signal (SIGFPE, floating_point_exception_handler);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Sys_ConsoleInput
|
||||
|
||||
|
@ -176,14 +175,12 @@ Sys_ConsoleInput (void)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
#ifndef USE_INTEL_ASM
|
||||
void
|
||||
Sys_HighFPPrecision (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Sys_LowFPPrecision (void)
|
||||
{
|
||||
|
@ -192,14 +189,11 @@ Sys_LowFPPrecision (void)
|
|||
|
||||
int skipframes;
|
||||
|
||||
/*
|
||||
main
|
||||
*/
|
||||
int
|
||||
main (int c, const char *v[])
|
||||
{
|
||||
double time, oldtime, newtime;
|
||||
int j;
|
||||
double time, oldtime, newtime;
|
||||
|
||||
// static char cwd[1024];
|
||||
|
||||
|
|
|
@ -29,13 +29,17 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_CONIO_H
|
||||
# include <conio.h>
|
||||
#endif
|
||||
#ifdef HAVE_IO_H
|
||||
# include <io.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <io.h>
|
||||
#include <conio.h>
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "QF/console.h"
|
||||
|
@ -52,35 +56,32 @@
|
|||
#include "net.h"
|
||||
#include "resource.h"
|
||||
|
||||
qboolean is_server = false;
|
||||
char *svs_info;
|
||||
|
||||
#define MINIMUM_WIN_MEMORY 0x0c00000
|
||||
#define MAXIMUM_WIN_MEMORY 0x1000000
|
||||
#define MINIMUM_WIN_MEMORY 0x0c00000
|
||||
|
||||
#define PAUSE_SLEEP 50 // sleep time on pause or
|
||||
// minimization
|
||||
#define NOT_FOCUS_SLEEP 20 // sleep time when not focus
|
||||
|
||||
char *svs_info;
|
||||
|
||||
int starttime;
|
||||
qboolean ActiveApp, Minimized;
|
||||
qboolean WinNT;
|
||||
|
||||
qboolean ActiveApp, Minimized, WinNT;
|
||||
qboolean is_server = false;
|
||||
|
||||
HWND hwnd_dialog; // startup dialog box
|
||||
|
||||
static HANDLE hinput, houtput;
|
||||
|
||||
HANDLE qwclsemaphore;
|
||||
|
||||
static HANDLE tevent;
|
||||
static HANDLE hinput, houtput, tevent;
|
||||
|
||||
extern cvar_t *sys_nostdout;
|
||||
|
||||
void Sys_InitFloatTime (void);
|
||||
|
||||
void MaskExceptions (void);
|
||||
void Sys_PopFPCW (void);
|
||||
void Sys_PushFPCW_SetHigh (void);
|
||||
void Sys_InitFloatTime (void);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -92,8 +93,8 @@ void Sys_PushFPCW_SetHigh (void);
|
|||
void
|
||||
Sys_Init_Cvars (void)
|
||||
{
|
||||
sys_nostdout = Cvar_Get ("sys_nostdout", "1", CVAR_NONE, NULL,
|
||||
"unset to enable std out - windows does NOT support this");
|
||||
sys_nostdout = Cvar_Get ("sys_nostdout", "1", CVAR_NONE, NULL, "unset to "
|
||||
"enable std out - windows does NOT support this");
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -101,8 +102,7 @@ Sys_Init (void)
|
|||
{
|
||||
OSVERSIONINFO vinfo;
|
||||
|
||||
// allocate a named semaphore on the client so the
|
||||
// front end can tell if it is alive
|
||||
// allocate named semaphore on client so front end can tell if it's alive
|
||||
|
||||
// mutex will fail if semephore allready exists
|
||||
qwclsemaphore = CreateMutex (NULL, /* Security attributes */
|
||||
|
@ -122,8 +122,7 @@ Sys_Init (void)
|
|||
Sys_SetFPCW ();
|
||||
#endif
|
||||
|
||||
// make sure the timer is high precision, otherwise
|
||||
// NT gets 18ms resolution
|
||||
// make sure the timer is high precision, otherwise NT gets 18ms resolution
|
||||
timeBeginPeriod (1);
|
||||
|
||||
vinfo.dwOSVersionInfoSize = sizeof (vinfo);
|
||||
|
@ -143,9 +142,6 @@ Sys_Init (void)
|
|||
WinNT = false;
|
||||
}
|
||||
|
||||
/*
|
||||
Sys_Quit
|
||||
*/
|
||||
void
|
||||
Sys_Quit (void)
|
||||
{
|
||||
|
@ -164,15 +160,11 @@ Sys_Quit (void)
|
|||
exit (0);
|
||||
}
|
||||
|
||||
/*
|
||||
Sys_Error
|
||||
*/
|
||||
void
|
||||
Sys_Error (const char *error, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char text[1024]; // , text2[1024];
|
||||
|
||||
va_list argptr;
|
||||
// DWORD dummy;
|
||||
|
||||
Host_Shutdown ();
|
||||
|
@ -191,9 +183,9 @@ Sys_Error (const char *error, ...)
|
|||
void
|
||||
Sys_DebugLog (const char *file, const char *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
static char data[1024];
|
||||
int fd;
|
||||
va_list argptr;
|
||||
|
||||
va_start (argptr, fmt);
|
||||
vsnprintf (data, sizeof (data), fmt, argptr);
|
||||
|
@ -203,12 +195,10 @@ Sys_DebugLog (const char *file, const char *fmt, ...)
|
|||
close (fd);
|
||||
};
|
||||
|
||||
|
||||
int
|
||||
wfilelength (VFile *f)
|
||||
{
|
||||
int pos;
|
||||
int end;
|
||||
int end, pos;
|
||||
|
||||
pos = Qtell (f);
|
||||
Qseek (f, 0, SEEK_END);
|
||||
|
@ -227,16 +217,13 @@ wfilelength (VFile *f)
|
|||
const char *
|
||||
Sys_ConsoleInput (void)
|
||||
{
|
||||
char *clipText, *textCopied;
|
||||
int ch, i; // , count;
|
||||
static char text[256];
|
||||
static int len;
|
||||
INPUT_RECORD recs[1024];
|
||||
|
||||
// int count;
|
||||
int i;
|
||||
int ch;
|
||||
DWORD numread, numevents, dummy;
|
||||
HANDLE th;
|
||||
char *clipText, *textCopied;
|
||||
|
||||
for (;;) {
|
||||
if (!GetNumberOfConsoleInputEvents (hinput, &numevents))
|
||||
|
@ -296,7 +283,7 @@ Sys_ConsoleInput (void)
|
|||
textCopied =
|
||||
malloc (GlobalSize (th) + 1);
|
||||
strcpy (textCopied, clipText);
|
||||
/* Substitutes a NULL for every token */
|
||||
// Substitutes a NULL for every token
|
||||
strtok (textCopied, "\n\r\b");
|
||||
i = strlen (textCopied);
|
||||
if (i + len >= 256)
|
||||
|
@ -344,25 +331,20 @@ SleepUntilInput (int time)
|
|||
MsgWaitForMultipleObjects (1, &tevent, FALSE, time, QS_ALLINPUT);
|
||||
}
|
||||
|
||||
|
||||
HINSTANCE global_hInstance;
|
||||
int global_nCmdShow;
|
||||
char *argv[MAX_NUM_ARGVS];
|
||||
static char *empty_string = "";
|
||||
|
||||
|
||||
/*
|
||||
main
|
||||
*/
|
||||
int WINAPI
|
||||
WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
// MSG msg;
|
||||
double time, oldtime, newtime;
|
||||
MEMORYSTATUS lpBuffer;
|
||||
static char cwd[1024];
|
||||
int t;
|
||||
double time, oldtime, newtime;
|
||||
MEMORYSTATUS lpBuffer;
|
||||
#ifdef SPLASH_SCREEN
|
||||
RECT rect;
|
||||
#endif
|
||||
|
@ -412,8 +394,8 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
|
|||
host_parms.argv = com_argv;
|
||||
|
||||
#ifdef SPLASH_SCREEN
|
||||
hwnd_dialog =
|
||||
CreateDialog (hInstance, MAKEINTRESOURCE (IDD_DIALOG1), NULL, NULL);
|
||||
hwnd_dialog = CreateDialog (hInstance, MAKEINTRESOURCE (IDD_DIALOG1),
|
||||
NULL, NULL);
|
||||
|
||||
if (hwnd_dialog) {
|
||||
if (GetWindowRect (hwnd_dialog, &rect)) {
|
||||
|
@ -471,8 +453,7 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
|
|||
|
||||
/* main window message loop */
|
||||
while (1) {
|
||||
// yield the CPU for a little while when paused, minimized, or not
|
||||
// the focus
|
||||
// yield CPU for a little bit when paused, minimized, or not the focus
|
||||
if ((cl.paused && (!ActiveApp && !DDActive)) || Minimized
|
||||
|| block_drawing) {
|
||||
SleepUntilInput (PAUSE_SLEEP);
|
||||
|
|
Loading…
Reference in a new issue