mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-29 07:02:12 +00:00
Dirty hacks to get MinGW to compile again (hopefully I haven't broken MSVC in the process)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3686 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
da1924e583
commit
19207aa590
4 changed files with 168 additions and 79 deletions
|
@ -659,7 +659,7 @@ qboolean LibPNG_Init(void)
|
|||
|
||||
|
||||
|
||||
#if defined(MINGW) //hehehe... add annother symbol so the statically linked cygwin libpng can link
|
||||
#if defined(MING) //hehehe... add annother symbol so the statically linked cygwin libpng can link
|
||||
#undef setjmp
|
||||
int setjmp (jmp_buf jb)
|
||||
{
|
||||
|
@ -908,6 +908,7 @@ int Image_WritePNG (char *filename, int compression, qbyte *pixels, int width, i
|
|||
qjpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \
|
||||
(size_t) sizeof(struct jpeg_decompress_struct))
|
||||
|
||||
#ifdef DYNAMIC_LIBJPEG
|
||||
boolean (VARGS *qjpeg_resync_to_restart) JPP((j_decompress_ptr cinfo, int desired)) JSTATIC(jpeg_resync_to_restart);
|
||||
boolean (VARGS *qjpeg_finish_decompress) JPP((j_decompress_ptr cinfo)) JSTATIC(jpeg_finish_decompress);
|
||||
JDIMENSION (VARGS *qjpeg_read_scanlines) JPP((j_decompress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION max_lines)) JSTATIC(jpeg_read_scanlines);
|
||||
|
@ -925,6 +926,7 @@ void (VARGS *qjpeg_set_quality) JPP((j_compress_ptr cinfo, int quality, boolean
|
|||
void (VARGS *qjpeg_set_defaults) JPP((j_compress_ptr cinfo)) JSTATIC(jpeg_set_defaults);
|
||||
void (VARGS *qjpeg_CreateCompress) JPP((j_compress_ptr cinfo, int version, size_t structsize)) JSTATIC(jpeg_CreateCompress);
|
||||
void (VARGS *qjpeg_destroy_compress) JPP((j_compress_ptr cinfo)) JSTATIC(jpeg_destroy_compress);
|
||||
#endif
|
||||
|
||||
qboolean LibJPEG_Init(void)
|
||||
{
|
||||
|
@ -1096,7 +1098,11 @@ ftejpeg_mem_src (j_decompress_ptr cinfo, qbyte * infile, int maxlen)
|
|||
src->pub.init_source = init_source;
|
||||
src->pub.fill_input_buffer = fill_input_buffer;
|
||||
src->pub.skip_input_data = skip_input_data;
|
||||
src->pub.resync_to_restart = qjpeg_resync_to_restart; /* use default method */
|
||||
#ifdef DYNAMIC_LIBJPEG
|
||||
src->pub.resync_to_restart = qjpeg_resync_to_restart; /* use default method */
|
||||
#else
|
||||
src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */
|
||||
#endif
|
||||
src->pub.term_source = term_source;
|
||||
src->infile = infile;
|
||||
src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */
|
||||
|
@ -1130,26 +1136,46 @@ qbyte *ReadJPEGFile(qbyte *infile, int length, int *width, int *height)
|
|||
/* Step 1: allocate and initialize JPEG decompression object */
|
||||
|
||||
/* We set up the normal JPEG error routines, then override error_exit. */
|
||||
cinfo.err = qjpeg_std_error(&jerr.pub);
|
||||
#ifdef DYNAMIC_LIBJPEG
|
||||
cinfo.err = qjpeg_std_error(&jerr.pub);
|
||||
#else
|
||||
cinfo.err = jpeg_std_error(&jerr.pub);
|
||||
#endif
|
||||
jerr.pub.error_exit = my_error_exit;
|
||||
/* Establish the setjmp return context for my_error_exit to use. */
|
||||
if (setjmp(jerr.setjmp_buffer))
|
||||
{
|
||||
// If we get here, the JPEG code has signaled an error.
|
||||
badjpeg:
|
||||
qjpeg_destroy_decompress(&cinfo);
|
||||
#ifdef DYNAMIC_LIBJPEG
|
||||
qjpeg_destroy_decompress(&cinfo);
|
||||
#else
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
#endif
|
||||
|
||||
if (mem)
|
||||
BZ_Free(mem);
|
||||
return 0;
|
||||
}
|
||||
qjpeg_create_decompress(&cinfo);
|
||||
#ifdef DYNAMIC_LIBJPEG
|
||||
qjpeg_create_decompress(&cinfo);
|
||||
#else
|
||||
jpeg_create_decompress(&cinfo);
|
||||
#endif
|
||||
|
||||
ftejpeg_mem_src(&cinfo, infile, length);
|
||||
|
||||
(void) qjpeg_read_header(&cinfo, TRUE);
|
||||
#ifdef DYNAMIC_LIBJPEG
|
||||
(void) qjpeg_read_header(&cinfo, TRUE);
|
||||
#else
|
||||
(void) jpeg_read_header(&cinfo, TRUE);
|
||||
#endif
|
||||
|
||||
(void) qjpeg_start_decompress(&cinfo);
|
||||
#ifdef DYNAMIC_LIBJPEG
|
||||
(void) qjpeg_start_decompress(&cinfo);
|
||||
#else
|
||||
(void) jpeg_start_decompress(&cinfo);
|
||||
#endif
|
||||
|
||||
|
||||
if (cinfo.output_components == 0)
|
||||
|
@ -1175,7 +1201,11 @@ badjpeg:
|
|||
|
||||
while (cinfo.output_scanline < cinfo.output_height)
|
||||
{
|
||||
(void) qjpeg_read_scanlines(&cinfo, buffer, 1);
|
||||
#ifdef DYNAMIC_LIBJPEG
|
||||
(void) qjpeg_read_scanlines(&cinfo, buffer, 1);
|
||||
#else
|
||||
(void) jpeg_read_scanlines(&cinfo, buffer, 1);
|
||||
#endif
|
||||
|
||||
in = buffer[0];
|
||||
for (i = 0; i < cinfo.output_width; i++)
|
||||
|
@ -1187,9 +1217,17 @@ badjpeg:
|
|||
}
|
||||
}
|
||||
|
||||
(void) qjpeg_finish_decompress(&cinfo);
|
||||
#ifdef DYNAMIC_LIBJPEG
|
||||
(void) qjpeg_finish_decompress(&cinfo);
|
||||
#else
|
||||
(void) jpeg_finish_decompress(&cinfo);
|
||||
#endif
|
||||
|
||||
qjpeg_destroy_decompress(&cinfo);
|
||||
#ifdef DYNAMIC_LIBJPEG
|
||||
qjpeg_destroy_decompress(&cinfo);
|
||||
#else
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
#endif
|
||||
|
||||
*width = cinfo.output_width;
|
||||
*height = cinfo.output_height;
|
||||
|
@ -1278,7 +1316,7 @@ void screenshotJPEG(char *filename, int compression, qbyte *screendata, int scre
|
|||
jpeg_error_mgr_wrapper jerr;
|
||||
struct jpeg_compress_struct cinfo;
|
||||
JSAMPROW row_pointer[1];
|
||||
|
||||
|
||||
if (!LIBJPEG_LOADED())
|
||||
return;
|
||||
|
||||
|
@ -1292,17 +1330,29 @@ void screenshotJPEG(char *filename, int compression, qbyte *screendata, int scre
|
|||
}
|
||||
}
|
||||
|
||||
cinfo.err = qjpeg_std_error(&jerr.pub);
|
||||
#ifdef DYNAMIC_LIBJPEG
|
||||
cinfo.err = qjpeg_std_error(&jerr.pub);
|
||||
#else
|
||||
cinfo.err = jpeg_std_error(&jerr.pub);
|
||||
#endif
|
||||
jerr.pub.error_exit = jpeg_error_exit;
|
||||
if (setjmp(jerr.setjmp_buffer))
|
||||
{
|
||||
qjpeg_destroy_compress(&cinfo);
|
||||
#ifdef DYNAMIC_LIBJPEG
|
||||
qjpeg_destroy_compress(&cinfo);
|
||||
#else
|
||||
jpeg_destroy_compress(&cinfo);
|
||||
#endif
|
||||
VFS_CLOSE(outfile);
|
||||
FS_Remove(filename, FS_GAME);
|
||||
Con_Printf("Failed to create jpeg\n");
|
||||
return;
|
||||
}
|
||||
qjpeg_create_compress(&cinfo);
|
||||
#ifdef DYNAMIC_LIBJPEG
|
||||
qjpeg_create_compress(&cinfo);
|
||||
#else
|
||||
jpeg_create_compress(&cinfo);
|
||||
#endif
|
||||
|
||||
buffer = screendata;
|
||||
|
||||
|
@ -1311,19 +1361,42 @@ void screenshotJPEG(char *filename, int compression, qbyte *screendata, int scre
|
|||
cinfo.image_height = screenheight;
|
||||
cinfo.input_components = 3;
|
||||
cinfo.in_color_space = JCS_RGB;
|
||||
qjpeg_set_defaults(&cinfo);
|
||||
qjpeg_set_quality (&cinfo, bound(0, compression, 100), true);
|
||||
qjpeg_start_compress(&cinfo, true);
|
||||
#ifdef DYNAMIC_LIBJPEG
|
||||
qjpeg_set_defaults(&cinfo);
|
||||
#else
|
||||
jpeg_set_defaults(&cinfo);
|
||||
#endif
|
||||
#ifdef DYNAMIC_LIBJPEG
|
||||
qjpeg_set_quality (&cinfo, bound(0, compression, 100), true);
|
||||
#else
|
||||
jpeg_set_quality (&cinfo, bound(0, compression, 100), true);
|
||||
#endif
|
||||
#ifdef DYNAMIC_LIBJPEG
|
||||
qjpeg_start_compress(&cinfo, true);
|
||||
#else
|
||||
jpeg_start_compress(&cinfo, true);
|
||||
#endif
|
||||
|
||||
while (cinfo.next_scanline < cinfo.image_height)
|
||||
{
|
||||
*row_pointer = &buffer[(cinfo.image_height - cinfo.next_scanline - 1) * cinfo.image_width * 3];
|
||||
qjpeg_write_scanlines(&cinfo, row_pointer, 1);
|
||||
#ifdef DYNAMIC_LIBJPEG
|
||||
qjpeg_write_scanlines(&cinfo, row_pointer, 1);
|
||||
#else
|
||||
jpeg_write_scanlines(&cinfo, row_pointer, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
qjpeg_finish_compress(&cinfo);
|
||||
#ifdef DYNAMIC_LIBJPEG
|
||||
qjpeg_finish_compress(&cinfo);
|
||||
#else
|
||||
jpeg_finish_compress(&cinfo);
|
||||
#endif
|
||||
VFS_CLOSE(outfile);
|
||||
qjpeg_destroy_compress(&cinfo);
|
||||
#ifdef DYNAMIC_LIBJPEG
|
||||
qjpeg_destroy_compress(&cinfo);
|
||||
#else
|
||||
jpeg_destroy_compress(&cinfo);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
|
|||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
|
@ -120,7 +120,7 @@ char *Sys_GetNameForAddress(dllhandle_t *module, void *address)
|
|||
|
||||
|
||||
datadir = &ntheader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT];
|
||||
|
||||
|
||||
block = (IMAGE_EXPORT_DIRECTORY *)(base + datadir->VirtualAddress);
|
||||
funclist = (DWORD*)(base+block->AddressOfFunctions);
|
||||
namelist = (DWORD*)(base+block->AddressOfNames);
|
||||
|
@ -250,7 +250,7 @@ void *Sys_GetGameAPI (void *parms)
|
|||
GetGameAPI = (void *)GetProcAddress (game_library, "GetGameAPI");
|
||||
if (!GetGameAPI)
|
||||
{
|
||||
Sys_UnloadGame ();
|
||||
Sys_UnloadGame ();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -283,9 +283,9 @@ void Sys_PushFPCW_SetHigh (void);
|
|||
int VARGS Sys_DebugLog(char *file, char *fmt, ...)
|
||||
{
|
||||
FILE *fd;
|
||||
va_list argptr;
|
||||
va_list argptr;
|
||||
static char data[1024];
|
||||
|
||||
|
||||
va_start(argptr, fmt);
|
||||
vsnprintf(data, sizeof(data)-1, fmt, argptr);
|
||||
va_end(argptr);
|
||||
|
@ -510,7 +510,7 @@ qboolean Sys_remove (char *path)
|
|||
int Sys_EnumerateFiles (const char *gpath, const char *match, int (*func)(const char *, int, void *), void *parm)
|
||||
{
|
||||
HANDLE r;
|
||||
WIN32_FIND_DATA fd;
|
||||
WIN32_FIND_DATA fd;
|
||||
char apath[MAX_OSPATH];
|
||||
char apath2[MAX_OSPATH];
|
||||
char file[MAX_OSPATH];
|
||||
|
@ -522,7 +522,7 @@ int Sys_EnumerateFiles (const char *gpath, const char *match, int (*func)(const
|
|||
Q_snprintfz(apath, sizeof(apath), "%s/%s", gpath, match);
|
||||
for (s = apath+strlen(apath)-1; s> apath; s--)
|
||||
{
|
||||
if (*s == '/')
|
||||
if (*s == '/')
|
||||
break;
|
||||
}
|
||||
*s = '\0';
|
||||
|
@ -535,7 +535,7 @@ int Sys_EnumerateFiles (const char *gpath, const char *match, int (*func)(const
|
|||
match = s+1;
|
||||
for (s = apath2+strlen(apath2)-1; s> apath2; s--)
|
||||
{
|
||||
if (*s == '/')
|
||||
if (*s == '/')
|
||||
break;
|
||||
}
|
||||
*s = '\0';
|
||||
|
@ -632,18 +632,18 @@ void Sys_Init (void)
|
|||
|
||||
// mutex will fail if semephore already exists
|
||||
qwclsemaphore = CreateMutex(
|
||||
NULL, // Security attributes
|
||||
0, // owner
|
||||
"qwcl"); // Semaphore name
|
||||
NULL, // Security attributes
|
||||
0, // owner
|
||||
"qwcl"); // Semaphore name
|
||||
// if (!qwclsemaphore)
|
||||
// Sys_Error ("QWCL is already running on this system");
|
||||
CloseHandle (qwclsemaphore);
|
||||
|
||||
qwclsemaphore = CreateSemaphore(
|
||||
NULL, // Security attributes
|
||||
0, // Initial count
|
||||
1, // Maximum count
|
||||
"qwcl"); // Semaphore name
|
||||
NULL, // Security attributes
|
||||
0, // Initial count
|
||||
1, // Maximum count
|
||||
"qwcl"); // Semaphore name
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -690,7 +690,7 @@ void Sys_Init (void)
|
|||
{
|
||||
Sys_Error ("QuakeWorld requires at least Win95 or NT 4.0");
|
||||
}
|
||||
|
||||
|
||||
if (vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT)
|
||||
WinNT = true;
|
||||
else
|
||||
|
@ -703,7 +703,7 @@ void VARGS Sys_Error (const char *error, ...)
|
|||
va_list argptr;
|
||||
char text[1024];
|
||||
//, text2[1024];
|
||||
// DWORD dummy;
|
||||
// DWORD dummy;
|
||||
|
||||
va_start (argptr, error);
|
||||
vsnprintf (text, sizeof(text), error, argptr);
|
||||
|
@ -953,7 +953,7 @@ char *Sys_ConsoleInput (void)
|
|||
switch (ch)
|
||||
{
|
||||
case '\r':
|
||||
WriteFile(houtput, "\r\n", 2, &dummy, NULL);
|
||||
WriteFile(houtput, "\r\n", 2, &dummy, NULL);
|
||||
|
||||
if (len)
|
||||
{
|
||||
|
@ -972,8 +972,8 @@ char *Sys_ConsoleInput (void)
|
|||
break;
|
||||
|
||||
default:
|
||||
if (((ch=='V' || ch=='v') && (recs[0].Event.KeyEvent.dwControlKeyState &
|
||||
(LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED))) || ((recs[0].Event.KeyEvent.dwControlKeyState
|
||||
if (((ch=='V' || ch=='v') && (recs[0].Event.KeyEvent.dwControlKeyState &
|
||||
(LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED))) || ((recs[0].Event.KeyEvent.dwControlKeyState
|
||||
& SHIFT_PRESSED) && (recs[0].Event.KeyEvent.wVirtualKeyCode
|
||||
==VK_INSERT))) {
|
||||
if (OpenClipboard(NULL)) {
|
||||
|
@ -1002,7 +1002,7 @@ char *Sys_ConsoleInput (void)
|
|||
}
|
||||
} else if (ch >= ' ')
|
||||
{
|
||||
WriteFile(houtput, &ch, 1, &dummy, NULL);
|
||||
WriteFile(houtput, &ch, 1, &dummy, NULL);
|
||||
text[len] = ch;
|
||||
len = (len + 1) & 0xff;
|
||||
}
|
||||
|
@ -1021,7 +1021,7 @@ BOOL WINAPI HandlerRoutine (DWORD dwCtrlType)
|
|||
{
|
||||
switch (dwCtrlType)
|
||||
{
|
||||
case CTRL_C_EVENT:
|
||||
case CTRL_C_EVENT:
|
||||
case CTRL_BREAK_EVENT:
|
||||
case CTRL_CLOSE_EVENT:
|
||||
case CTRL_LOGOFF_EVENT:
|
||||
|
@ -1217,7 +1217,7 @@ void NPQTV_Sys_MainLoop(void)
|
|||
newtime = Sys_DoubleTime ();
|
||||
duratrion = newtime - lastlooptime;
|
||||
lastlooptime = newtime;
|
||||
|
||||
|
||||
SV_Frame ();
|
||||
#else
|
||||
Sys_Error("wut?");
|
||||
|
@ -1265,12 +1265,15 @@ HWND hwnd_dialog;
|
|||
|
||||
|
||||
#define COBJMACROS
|
||||
#include <Shobjidl.h>
|
||||
|
||||
#ifndef MINGW
|
||||
#include <shobjidl.h>
|
||||
#endif
|
||||
#include <shlguid.h>
|
||||
#include <Shlobj.h>
|
||||
#include <shlobj.h>
|
||||
//#include <Propsys.h>
|
||||
|
||||
#ifndef SHARD_APPIDINFOLINK
|
||||
#ifndef SHARD_APPIDINFOLINK
|
||||
typedef struct SHARDAPPIDINFOLINK {
|
||||
IShellLinkW *psl;
|
||||
PCWSTR pszAppID;
|
||||
|
@ -1284,44 +1287,46 @@ typedef struct {
|
|||
} PROPERTYKEY;
|
||||
typedef struct IPropertyStore IPropertyStore;
|
||||
;
|
||||
#ifndef MINGW
|
||||
typedef struct IPropertyStore
|
||||
{
|
||||
CONST_VTBL struct
|
||||
{
|
||||
/*IUnknown*/
|
||||
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
|
||||
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
|
||||
IPropertyStore * This,
|
||||
REFIID riid,
|
||||
void **ppvObject);
|
||||
ULONG ( STDMETHODCALLTYPE *AddRef )(
|
||||
ULONG ( STDMETHODCALLTYPE *AddRef )(
|
||||
IPropertyStore * This);
|
||||
ULONG ( STDMETHODCALLTYPE *Release )(
|
||||
ULONG ( STDMETHODCALLTYPE *Release )(
|
||||
IPropertyStore * This);
|
||||
|
||||
/*property store stuff*/
|
||||
HRESULT ( STDMETHODCALLTYPE *GetCount)(
|
||||
HRESULT ( STDMETHODCALLTYPE *GetCount)(
|
||||
IPropertyStore * This,
|
||||
ULONG *count);
|
||||
|
||||
HRESULT ( STDMETHODCALLTYPE *GetAt)(
|
||||
HRESULT ( STDMETHODCALLTYPE *GetAt)(
|
||||
IPropertyStore * This,
|
||||
DWORD prop,
|
||||
PROPERTYKEY * key);
|
||||
|
||||
HRESULT ( STDMETHODCALLTYPE *GetValue)(
|
||||
HRESULT ( STDMETHODCALLTYPE *GetValue)(
|
||||
IPropertyStore * This,
|
||||
PROPERTYKEY * key,
|
||||
PROPVARIANT * val);
|
||||
|
||||
HRESULT ( STDMETHODCALLTYPE *SetValue)(
|
||||
HRESULT ( STDMETHODCALLTYPE *SetValue)(
|
||||
IPropertyStore * This,
|
||||
PROPERTYKEY * key,
|
||||
PROPVARIANT * val);
|
||||
|
||||
HRESULT ( STDMETHODCALLTYPE *Commit)(
|
||||
HRESULT ( STDMETHODCALLTYPE *Commit)(
|
||||
IPropertyStore * This);
|
||||
} *lpVtbl;
|
||||
} IPropertyStore;
|
||||
#endif
|
||||
static const IID IID_IPropertyStore = {0x886d8eeb, 0x8cf2, 0x4446, {0x8d, 0x02, 0xcd, 0xba, 0x1d, 0xbd, 0xcf, 0x99}};
|
||||
#endif
|
||||
|
||||
|
@ -1355,8 +1360,10 @@ void Sys_RecentServer(char *command, char *target, char *title, char *desc)
|
|||
IShellLinkW_SetArguments(link, buf); /*args*/
|
||||
swprintf(buf, sizeof(buf), L"%S", desc);
|
||||
IShellLinkW_SetDescription(link, buf); /*tooltip*/
|
||||
|
||||
|
||||
hr = IShellLinkW_QueryInterface(link, &IID_IPropertyStore, &prop_store);
|
||||
|
||||
#ifndef MINGW
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
PROPVARIANT pv;
|
||||
|
@ -1369,6 +1376,7 @@ void Sys_RecentServer(char *command, char *target, char *title, char *desc)
|
|||
hr = prop_store->lpVtbl->Commit(prop_store);
|
||||
prop_store->lpVtbl->Release(prop_store);
|
||||
}
|
||||
#endif
|
||||
|
||||
appinfo.pszAppID=WIN7_APPNAME;
|
||||
appinfo.psl=link;
|
||||
|
@ -1409,12 +1417,14 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
|
|||
double time, oldtime, newtime;
|
||||
char cwd[1024];
|
||||
const char *qtvfile = NULL;
|
||||
|
||||
|
||||
/* previous instances do not exist in Win32 */
|
||||
if (hPrevInstance)
|
||||
return 0;
|
||||
|
||||
Win7_Init();
|
||||
#ifndef MINGW
|
||||
Win7_Init();
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if _M_IX86_FP >= 1
|
||||
|
@ -1554,7 +1564,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
|
|||
{
|
||||
#if !defined(CLIENTONLY)
|
||||
hwnd_dialog=NULL;
|
||||
|
||||
|
||||
if (!Sys_InitTerminal())
|
||||
Sys_Error ("Couldn't allocate dedicated server console");
|
||||
#endif
|
||||
|
@ -1598,7 +1608,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
|
|||
{
|
||||
if (!isDedicated)
|
||||
Sys_Error("Dedicated was cleared");
|
||||
NET_Sleep(100, false);
|
||||
NET_Sleep(100, false);
|
||||
SV_Frame ();
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -1630,6 +1640,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
|
|||
|
||||
//client console should now be initialized.
|
||||
|
||||
#ifndef MINGW
|
||||
switch(M_GameType())
|
||||
{
|
||||
case MGT_QUAKE1:
|
||||
|
@ -1645,6 +1656,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
|
|||
Sys_RecentServer("+map demo1", "", "Start New Game (Hexen2)", "Begin a new game");
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* main window message loop */
|
||||
while (1)
|
||||
|
@ -1658,7 +1670,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
|
|||
newtime = Sys_DoubleTime ();
|
||||
time = newtime - oldtime;
|
||||
oldtime = newtime;
|
||||
|
||||
|
||||
SV_Frame ();
|
||||
#else
|
||||
Sys_Error("wut?");
|
||||
|
@ -1776,7 +1788,7 @@ DWORD WINAPI threadwrapper(void *args)
|
|||
tw.args = ((threadwrap_t *)args)->args;
|
||||
|
||||
free(args);
|
||||
tw.func(tw.args);
|
||||
tw.func(tw.args);
|
||||
|
||||
#ifndef WIN32CRTDLL
|
||||
_endthreadex(0);
|
||||
|
@ -1788,7 +1800,7 @@ void *Sys_CreateThread(int (*func)(void *), void *args, int stacksize)
|
|||
{
|
||||
threadwrap_t *tw = (threadwrap_t *)malloc(sizeof(threadwrap_t));
|
||||
HANDLE handle;
|
||||
|
||||
|
||||
if (!tw)
|
||||
return NULL;
|
||||
|
||||
|
@ -1811,7 +1823,7 @@ void *Sys_CreateThread(int (*func)(void *), void *args, int stacksize)
|
|||
}
|
||||
|
||||
void Sys_WaitOnThread(void *thread)
|
||||
{
|
||||
{
|
||||
while (WaitForSingleObject((HANDLE)thread, 10) == WAIT_TIMEOUT)
|
||||
{
|
||||
/*keep responding to window messages*/
|
||||
|
@ -1877,8 +1889,8 @@ typedef struct condvar_s
|
|||
HANDLE wait_done;
|
||||
} condvar_t;
|
||||
|
||||
void *Sys_CreateConditional(void)
|
||||
{
|
||||
void *Sys_CreateConditional(void)
|
||||
{
|
||||
condvar_t *cv;
|
||||
|
||||
cv = (condvar_t *)malloc(sizeof(condvar_t));
|
||||
|
@ -1907,16 +1919,16 @@ void *Sys_CreateConditional(void)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
qboolean Sys_LockConditional(void *condv)
|
||||
{
|
||||
qboolean Sys_LockConditional(void *condv)
|
||||
{
|
||||
EnterCriticalSection(&((condvar_t *)condv)->mainlock);
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
qboolean Sys_UnlockConditional(void *condv)
|
||||
{
|
||||
qboolean Sys_UnlockConditional(void *condv)
|
||||
{
|
||||
LeaveCriticalSection(&((condvar_t *)condv)->mainlock);
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
qboolean Sys_ConditionWait(void *condv)
|
||||
|
@ -1936,7 +1948,7 @@ qboolean Sys_ConditionWait(void *condv)
|
|||
|
||||
// update waiting count and alert signaling thread that we're done to avoid the deadlock condition
|
||||
EnterCriticalSection(&cv->countlock);
|
||||
if (cv->signals > 0)
|
||||
if (cv->signals > 0)
|
||||
{
|
||||
ReleaseSemaphore(cv->wait_done, cv->signals, NULL);
|
||||
cv->signals = 0;
|
||||
|
@ -1949,7 +1961,7 @@ qboolean Sys_ConditionWait(void *condv)
|
|||
return success;
|
||||
}
|
||||
|
||||
qboolean Sys_ConditionSignal(void *condv)
|
||||
qboolean Sys_ConditionSignal(void *condv)
|
||||
{
|
||||
condvar_t *cv = (condvar_t *)condv;
|
||||
|
||||
|
@ -1968,24 +1980,24 @@ qboolean Sys_ConditionSignal(void *condv)
|
|||
return true;
|
||||
}
|
||||
|
||||
qboolean Sys_ConditionBroadcast(void *condv)
|
||||
qboolean Sys_ConditionBroadcast(void *condv)
|
||||
{
|
||||
condvar_t *cv = (condvar_t *)condv;
|
||||
|
||||
// if there are non-signaled waiting threads, we signal all of them and wait on all the responses back
|
||||
EnterCriticalSection(&cv->countlock);
|
||||
if (cv->waiting > cv->signals)
|
||||
if (cv->waiting > cv->signals)
|
||||
{
|
||||
int i, num_waiting;
|
||||
|
||||
num_waiting = (cv->waiting - cv->signals);
|
||||
cv->signals = cv->waiting;
|
||||
|
||||
|
||||
ReleaseSemaphore(cv->wait_sem, num_waiting, NULL);
|
||||
LeaveCriticalSection(&cv->countlock);
|
||||
// there's no call to wait for the same object multiple times so we need to loop through
|
||||
// and burn up the semaphore count
|
||||
for (i = 0; i < num_waiting; i++)
|
||||
for (i = 0; i < num_waiting; i++)
|
||||
WaitForSingleObject(cv->wait_done, INFINITE);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -84,6 +84,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#define ODE_DYNAMIC
|
||||
|
||||
#ifdef NO_OPENAL
|
||||
#undef AVAIL_OPENAL
|
||||
#endif
|
||||
|
||||
#ifdef NO_PNG
|
||||
#undef AVAIL_PNGLIB
|
||||
#endif
|
||||
|
|
|
@ -3113,7 +3113,7 @@ void COM_Version_f (void)
|
|||
#endif
|
||||
|
||||
#ifdef __MINGW64__
|
||||
Con_Printf("Compiled with MinGW64 version: %i.%i\n",__MINGW64_MAJOR_VERSION, __MINGW64_MINOR_VERSION);
|
||||
Con_Printf("Compiled with MinGW64 version: %i.%i\n",__MINGW32_MAJOR_VERSION, __MINGW32_MINOR_VERSION);
|
||||
#endif
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
|
|
Loading…
Reference in a new issue