From 4f59670015f1725aba9c8747edb42a40a598a134 Mon Sep 17 00:00:00 2001 From: sezero Date: Sun, 19 Aug 2018 12:41:50 +0300 Subject: [PATCH] glide2x, sst1/cvg: build fixes, warning fixes. --- glide2x/cvg/glide/src/Makefile.win32 | 5 +- glide2x/cvg/glide/src/g3df.c | 2 - glide2x/sst1/glide/src/Makefile.win32 | 2 +- glide2x/sst1/glide/src/ditex.c | 133 +++++++++++++------------- glide2x/sst1/glide/src/fxgasm.c | 3 +- glide2x/sst1/glide/src/g3df.c | 6 +- glide2x/sst1/glide/src/gsst.c | 26 ++--- glide2x/sst1/glide/src/gsstdef.h | 2 +- glide2x/sst1/init/init.c | 13 ++- glide2x/sst1/init/init96/initat3d.c | 12 +++ glide2x/sst1/init/init96/initmcrx.c | 16 ++++ 11 files changed, 124 insertions(+), 96 deletions(-) diff --git a/glide2x/cvg/glide/src/Makefile.win32 b/glide2x/cvg/glide/src/Makefile.win32 index ccfeb53..76dc5da 100644 --- a/glide2x/cvg/glide/src/Makefile.win32 +++ b/glide2x/cvg/glide/src/Makefile.win32 @@ -16,8 +16,6 @@ # Available options: # # Environment variables: -# FX_GLIDE_HW build for the given ASIC (cvg). -# default = cvg # CPU optimize for the given processor. # default = 6 (PentiumPro) # DEBUG=1 disable optimizations and build for debug. @@ -52,7 +50,6 @@ GLIDE_RES = glide.res GLIDE_DLL = glide2x.dll GLIDE_IMP = glide2x.lib -FX_GLIDE_HW ?= cvg FX_GLIDE_SW = ../../../swlibs GLIDE_LIBDIR = ../../lib @@ -85,7 +82,7 @@ CDEFS += -DGLIDE_HW_TRI_SETUP=1 -DGLIDE_PACKED_RGB=1 -DGLIDE_TRI_CULLING=1 -DGLI # special sli buffer clears CDEFS += -DGLIDE_BLIT_CLEAR=1 -# workaround for CVGs with broken tsus which cannot send commands to multiple +# workaround for CVGs with broken tsus which cannot send commands to multiple # tmus using chipfield. chipfield will always be set to 0xf CDEFS += -DGLIDE_CHIP_BROADCAST=1 diff --git a/glide2x/cvg/glide/src/g3df.c b/glide2x/cvg/glide/src/g3df.c index 22163c2..b8bf918 100644 --- a/glide2x/cvg/glide/src/g3df.c +++ b/glide2x/cvg/glide/src/g3df.c @@ -69,9 +69,7 @@ #include #include #include "fxglide.h" -#ifdef __linux__ #include -#endif extern const int _grMipMapHostWH[GR_ASPECT_1x8 + 1][GR_LOD_1 + 1][2]; extern FxU32 _gr_aspect_index_table[]; diff --git a/glide2x/sst1/glide/src/Makefile.win32 b/glide2x/sst1/glide/src/Makefile.win32 index 7078e84..498ebbf 100644 --- a/glide2x/sst1/glide/src/Makefile.win32 +++ b/glide2x/sst1/glide/src/Makefile.win32 @@ -203,7 +203,7 @@ GLIDE_OBJECTS += \ $(FX_GLIDE_SW)/newpci/pcilib/fxpci.obj \ $(FX_GLIDE_SW)/newpci/pcilib/fxw32.obj \ $(FX_GLIDE_SW)/newpci/pcilib/fxvxd.obj \ - $(FX_GLIDE_SW)/newpci/pcilib/fxnt.obj \ + $(FX_GLIDE_SW)/newpci/pcilib/fxnt.obj ############################################################################### # rules diff --git a/glide2x/sst1/glide/src/ditex.c b/glide2x/sst1/glide/src/ditex.c index a6d0fac..1130076 100644 --- a/glide2x/sst1/glide/src/ditex.c +++ b/glide2x/sst1/glide/src/ditex.c @@ -125,81 +125,81 @@ FxU32 _grMipMapHostSize[4][16] = const int _grMipMapHostWH[GR_ASPECT_1x8+1][GR_LOD_1+1][2] = { { - 256 , 32, - 128 , 16, - 64 , 8, - 32 , 4, - 16 , 2, - 8 , 1, - 4 , 1, - 2 , 1, - 1 , 1 + { 256 , 32 }, + { 128 , 16 }, + { 64 , 8 }, + { 32 , 4 }, + { 16 , 2 }, + { 8 , 1 }, + { 4 , 1 }, + { 2 , 1 }, + { 1 , 1 } }, { - 256 , 64, - 128 , 32, - 64 , 16, - 32 , 8, - 16 , 4, - 8 , 2, - 4 , 1, - 2 , 1, - 1 , 1 + { 256 , 64 }, + { 128 , 32 }, + { 64 , 16 }, + { 32 , 8 }, + { 16 , 4 }, + { 8 , 2 }, + { 4 , 1 }, + { 2 , 1 }, + { 1 , 1 } }, { - 256 , 128, - 128 , 64, - 64 , 32, - 32 , 16, - 16 , 8, - 8 , 4, - 4 , 2, - 2 , 1, - 1 , 1 + { 256 , 128 }, + { 128 , 64 }, + { 64 , 32 }, + { 32 , 16 }, + { 16 , 8 }, + { 8 , 4 }, + { 4 , 2 }, + { 2 , 1 }, + { 1 , 1 } }, { - 256 , 256, - 128 , 128, - 64 , 64, - 32 , 32, - 16 , 16, - 8 , 8, - 4 , 4, - 2 , 2, - 1 , 1 + { 256 , 256 }, + { 128 , 128 }, + { 64 , 64 }, + { 32 , 32 }, + { 16 , 16 }, + { 8 , 8 }, + { 4 , 4 }, + { 2 , 2 }, + { 1 , 1 } }, { - 128, 256, - 64, 128, - 32, 64 , - 16, 32 , - 8, 16 , - 4, 8 , - 2, 4 , - 1, 2 , - 1, 1 + { 128, 256 }, + { 64, 128 }, + { 32, 64 }, + { 16, 32 }, + { 8, 16 }, + { 4, 8 }, + { 2, 4 }, + { 1, 2 }, + { 1, 1 } }, { - 64, 256, - 32, 128, - 16, 64 , - 8, 32 , - 4, 16 , - 2, 8 , - 1, 4 , - 1, 2 , - 1, 1 + { 64, 256 }, + { 32, 128 }, + { 16, 64 }, + { 8, 32 }, + { 4, 16 }, + { 2, 8 }, + { 1, 4 }, + { 1, 2 }, + { 1, 1 } }, { - 32, 256, - 16, 128, - 8, 64 , - 4, 32 , - 2, 16 , - 1, 8 , - 1, 4 , - 1, 2 , - 1, 1 + { 32, 256 }, + { 16, 128 }, + { 8, 64 }, + { 4, 32 }, + { 2, 16 }, + { 1, 8 }, + { 1, 4 }, + { 1, 2 }, + { 1, 1 } } }; @@ -625,15 +625,10 @@ GR_DIENTRY(grTexDownloadMipMapLevel, void, FxU16 rle_line[256]; FxU16 *rle_line_end; -#ifdef __WIN32__ +#ifndef __WATCOMC__ void rle_decode_line_asm(FxU16 *tlut,FxU8 *src,FxU16 *dest) { /* don't do anything just shut up the compiler */ } #endif -#ifdef __GNUC__ -void rle_decode_line_asm(FxU16 *tlut,FxU8 *src,FxU16 *dest) { -} -#endif - diff --git a/glide2x/sst1/glide/src/fxgasm.c b/glide2x/sst1/glide/src/fxgasm.c index 9b14cc5..562de2a 100644 --- a/glide2x/sst1/glide/src/fxgasm.c +++ b/glide2x/sst1/glide/src/fxgasm.c @@ -19,6 +19,7 @@ */ #include +#include #include <3dfx.h> #include @@ -77,7 +78,7 @@ main (int argc, char **argv) printf("#ifndef __FX_INLINE_H__\n"); printf("#define __FX_INLINE_H__\n"); printf("\n"); - + printf("/* The # of 2-byte entries in the hw fog table */\n"); printf("#define kInternalFogTableEntryCount 0x%XUL\n", sizeof(dummyRegs.fogTable) >> 1); diff --git a/glide2x/sst1/glide/src/g3df.c b/glide2x/sst1/glide/src/g3df.c index d3f8562..e04991b 100644 --- a/glide2x/sst1/glide/src/g3df.c +++ b/glide2x/sst1/glide/src/g3df.c @@ -36,9 +36,7 @@ #include #include #include "fxglide.h" -#ifdef __linux__ #include -#endif extern const int _grMipMapHostWH[GR_ASPECT_1x8+1][GR_LOD_1+1][2]; extern FxU32 _gr_aspect_index_table[]; @@ -133,8 +131,8 @@ GR_DIENTRY(gu3dfGetInfo, FxBool, ** grab statistics out of the header */ if( sscanf(buffer,"3df v%s %s lod range: %i %i aspect ratio: %i %i\n", - &version, - color_format, + version, + color_format, &small_lod, &large_lod, &aspect_width, &aspect_height ) == 0 ) return FXFALSE; diff --git a/glide2x/sst1/glide/src/gsst.c b/glide2x/sst1/glide/src/gsst.c index 106c211..03f7d12 100644 --- a/glide2x/sst1/glide/src/gsst.c +++ b/glide2x/sst1/glide/src/gsst.c @@ -608,7 +608,8 @@ GR_ENTRY(grSstWinOpen, FxBool, ( oemi.linearAddress = gc->base_ptr; oemi.slaveAddress = NULL; if ((gc->oemInit = LoadLibrary("fxoem2x.dll")) != NULL) { - if ((oemInitMapBoard = GetProcAddress(gc->oemInit, "_fxoemInitMapBoard@4")) != NULL) { + oemInitMapBoard = GetProcAddress(gc->oemInit, "_fxoemInitMapBoard@4"); + if (oemInitMapBoard) { oemInitMapBoard(&oemi); } } @@ -702,8 +703,8 @@ GR_ENTRY(grSstWinOpen, FxBool, ( oemi.vid.clkFreq24bpp = tvVidtiming.clkFreq24bpp; if (gc->oemInit) { - if ((oemInitVideoTiming = GetProcAddress(gc->oemInit, "_fxoemInitVideoTiming@4")) && - (oemInitMapBoard)) + oemInitVideoTiming = GetProcAddress(gc->oemInit, "_fxoemInitVideoTiming@4"); + if (oemInitVideoTiming && oemInitMapBoard) oemvidtiming = oemInitVideoTiming(&oemi); /* ** video timing is updated by oem dll @@ -744,8 +745,8 @@ GR_ENTRY(grSstWinOpen, FxBool, ( #if (GLIDE_PLATFORM & GLIDE_OS_WIN32) if (gc->oemInit) { - if ((oemInitSetVideo = GetProcAddress(gc->oemInit, "_fxoemInitSetVideo@4")) && - (oemInitMapBoard)) + oemInitSetVideo = GetProcAddress(gc->oemInit, "_fxoemInitSetVideo@4"); + if (oemInitSetVideo && oemInitMapBoard) oemInitSetVideo(&oemi); } #endif @@ -956,15 +957,13 @@ GR_ENTRY(grSstWinOpen, FxBool, ( if (!_GlideRoot.environment.noSplash) { HMODULE newSplash = LoadLibrary("3dfxsplash2.dll"); - if (newSplash) { FARPROC fxSplash = GetProcAddress(newSplash, "_fxSplash@16"); - if (fxSplash) { fxSplash(hWnd, gc->state.screen_width, gc->state.screen_height, nAuxBuffers); _GlideRoot.environment.noSplash = 1; - } + } } } #endif /* (GLIDE_PLATFORM & GLIDE_OS_WIN32) */ @@ -1056,7 +1055,8 @@ GR_ENTRY( grSstWinClose, void, ( void ) ) initRestoreVideo(); #if (GLIDE_PLATFORM & GLIDE_OS_WIN32) if (gc->oemInit) { - if (oemRestoreVideo = GetProcAddress(gc->oemInit, "_fxoemRestoreVideo@0")) + oemRestoreVideo = GetProcAddress(gc->oemInit, "_fxoemRestoreVideo@0"); + if (oemRestoreVideo) oemRestoreVideo(); FreeLibrary(gc->oemInit); } @@ -1099,9 +1099,9 @@ GR_ENTRY(grSstControl, FxBool, ( GrControl_t code )) xRes = initControl(code); #if (GLIDE_PLATFORM & GLIDE_OS_WIN32) { - FARPROC oemControl = NULL; if (gc->oemInit) { - if ((oemControl = GetProcAddress(gc->oemInit, "_fxoemControl@4"))) + FARPROC oemControl = GetProcAddress(gc->oemInit, "_fxoemControl@4"); + if (oemControl) oemControl(code); } } @@ -1150,9 +1150,9 @@ GR_ENTRY(grSstControl, FxBool, ( GrControl_t code )) ctrlflag = initControl(code); #if (GLIDE_PLATFORM & GLIDE_OS_WIN32) { - FARPROC oemControl = NULL; if (gc->oemInit) { - if ((oemControl = GetProcAddress(gc->oemInit, "_fxoemControl@4"))) + FARPROC oemControl = GetProcAddress(gc->oemInit, "_fxoemControl@4"); + if (oemControl) oemControl(code); } } diff --git a/glide2x/sst1/glide/src/gsstdef.h b/glide2x/sst1/glide/src/gsstdef.h index 62ded27..6137f5c 100644 --- a/glide2x/sst1/glide/src/gsstdef.h +++ b/glide2x/sst1/glide/src/gsstdef.h @@ -225,4 +225,4 @@ typedef enum SSTR_END_OF_REGISTER_SET } GrSstRegister; -#endif /* __GSSTDEF_H__ */ \ No newline at end of file +#endif /* __GSSTDEF_H__ */ diff --git a/glide2x/sst1/init/init.c b/glide2x/sst1/init/init.c index e1b990a..13501ed 100644 --- a/glide2x/sst1/init/init.c +++ b/glide2x/sst1/init/init.c @@ -19,7 +19,6 @@ ** */ - #include "init.h" #include "fxinit.h" @@ -45,7 +44,19 @@ #ifdef _WIN32 #define _WIN32_LEAN_AND_MEAN_ #include +#ifdef __MINGW32__ +static inline unsigned char _inp_asm (unsigned short _port) { + unsigned char rc; + __asm__ __volatile__ ("inb %w1,%b0" : "=a" (rc) : "Nd" (_port)); + return rc; +} +static inline void _outp_asm (unsigned short _port, unsigned char _data) { + __asm__ __volatile__ ("outb %b0,%w1" : : "a" (_data), "Nd" (_port)); +} +#define _inp _inp_asm +#define _outp _outp_asm #endif +#endif /* _WIN32 */ #include #include diff --git a/glide2x/sst1/init/init96/initat3d.c b/glide2x/sst1/init/init96/initat3d.c index 857f32c..0063b99 100644 --- a/glide2x/sst1/init/init96/initat3d.c +++ b/glide2x/sst1/init/init96/initat3d.c @@ -38,6 +38,18 @@ #ifdef __WIN32__ #include +#ifdef __MINGW32__ +static inline unsigned char _inp_asm (unsigned short _port) { + unsigned char rc; + __asm__ __volatile__ ("inb %w1,%b0" : "=a" (rc) : "Nd" (_port)); + return rc; +} +static inline void _outp_asm (unsigned short _port, unsigned char _data) { + __asm__ __volatile__ ("outb %b0,%w1" : : "a" (_data), "Nd" (_port)); +} +#define _inp _inp_asm +#define _outp _outp_asm +#endif #endif /* __WIN32__ */ #if defined(__WATCOMC__) diff --git a/glide2x/sst1/init/init96/initmcrx.c b/glide2x/sst1/init/init96/initmcrx.c index 238a352..42d72d6 100644 --- a/glide2x/sst1/init/init96/initmcrx.c +++ b/glide2x/sst1/init/init96/initmcrx.c @@ -38,6 +38,22 @@ #ifdef __WIN32__ #include +#ifdef __MINGW32__ +static inline unsigned char _inp_asm (unsigned short _port) { + unsigned char rc; + __asm__ __volatile__ ("inb %w1,%b0" : "=a" (rc) : "Nd" (_port)); + return rc; +} +static inline void _outp_asm (unsigned short _port, unsigned char _data) { + __asm__ __volatile__ ("outb %b0,%w1" : : "a" (_data), "Nd" (_port)); +} +static inline void _outpw_asm (unsigned short _port, unsigned short _data) { + __asm__ __volatile__ ("outw %w0,%w1" : : "a" (_data), "Nd" (_port)); +} +#define _outpw _outpw_asm +#define _inp _inp_asm +#define _outp _outp_asm +#endif #endif /* __WIN32__ */ #define INIT_MCRX_LIB