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;
|
||||
#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. */
|
||||
#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:
|
||||
#ifdef DYNAMIC_LIBJPEG
|
||||
qjpeg_destroy_decompress(&cinfo);
|
||||
#else
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
#endif
|
||||
|
||||
if (mem)
|
||||
BZ_Free(mem);
|
||||
return 0;
|
||||
}
|
||||
#ifdef DYNAMIC_LIBJPEG
|
||||
qjpeg_create_decompress(&cinfo);
|
||||
#else
|
||||
jpeg_create_decompress(&cinfo);
|
||||
#endif
|
||||
|
||||
ftejpeg_mem_src(&cinfo, infile, length);
|
||||
|
||||
#ifdef DYNAMIC_LIBJPEG
|
||||
(void) qjpeg_read_header(&cinfo, TRUE);
|
||||
#else
|
||||
(void) jpeg_read_header(&cinfo, TRUE);
|
||||
#endif
|
||||
|
||||
#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)
|
||||
{
|
||||
#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:
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef DYNAMIC_LIBJPEG
|
||||
(void) qjpeg_finish_decompress(&cinfo);
|
||||
#else
|
||||
(void) jpeg_finish_decompress(&cinfo);
|
||||
#endif
|
||||
|
||||
#ifdef DYNAMIC_LIBJPEG
|
||||
qjpeg_destroy_decompress(&cinfo);
|
||||
#else
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
#endif
|
||||
|
||||
*width = cinfo.output_width;
|
||||
*height = cinfo.output_height;
|
||||
|
@ -1292,17 +1330,29 @@ void screenshotJPEG(char *filename, int compression, qbyte *screendata, int scre
|
|||
}
|
||||
}
|
||||
|
||||
#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))
|
||||
{
|
||||
#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;
|
||||
}
|
||||
#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;
|
||||
#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];
|
||||
#ifdef DYNAMIC_LIBJPEG
|
||||
qjpeg_write_scanlines(&cinfo, row_pointer, 1);
|
||||
#else
|
||||
jpeg_write_scanlines(&cinfo, row_pointer, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef DYNAMIC_LIBJPEG
|
||||
qjpeg_finish_compress(&cinfo);
|
||||
#else
|
||||
jpeg_finish_compress(&cinfo);
|
||||
#endif
|
||||
VFS_CLOSE(outfile);
|
||||
#ifdef DYNAMIC_LIBJPEG
|
||||
qjpeg_destroy_compress(&cinfo);
|
||||
#else
|
||||
jpeg_destroy_compress(&cinfo);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1265,9 +1265,12 @@ 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
|
||||
|
@ -1284,6 +1287,7 @@ typedef struct {
|
|||
} PROPERTYKEY;
|
||||
typedef struct IPropertyStore IPropertyStore;
|
||||
;
|
||||
#ifndef MINGW
|
||||
typedef struct IPropertyStore
|
||||
{
|
||||
CONST_VTBL struct
|
||||
|
@ -1322,6 +1326,7 @@ typedef struct IPropertyStore
|
|||
IPropertyStore * This);
|
||||
} *lpVtbl;
|
||||
} IPropertyStore;
|
||||
#endif
|
||||
static const IID IID_IPropertyStore = {0x886d8eeb, 0x8cf2, 0x4446, {0x8d, 0x02, 0xcd, 0xba, 0x1d, 0xbd, 0xcf, 0x99}};
|
||||
#endif
|
||||
|
||||
|
@ -1357,6 +1362,8 @@ void Sys_RecentServer(char *command, char *target, char *title, char *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;
|
||||
|
@ -1414,7 +1422,9 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
|
|||
if (hPrevInstance)
|
||||
return 0;
|
||||
|
||||
#ifndef MINGW
|
||||
Win7_Init();
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if _M_IX86_FP >= 1
|
||||
|
@ -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)
|
||||
|
|
|
@ -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