glide2x, sst1/cvg: build fixes, warning fixes.

This commit is contained in:
sezero
2018-08-19 12:41:50 +03:00
parent eb96ad7944
commit 4f59670015
11 changed files with 124 additions and 96 deletions

View File

@@ -16,8 +16,6 @@
# Available options: # Available options:
# #
# Environment variables: # Environment variables:
# FX_GLIDE_HW build for the given ASIC (cvg).
# default = cvg
# CPU optimize for the given processor. # CPU optimize for the given processor.
# default = 6 (PentiumPro) # default = 6 (PentiumPro)
# DEBUG=1 disable optimizations and build for debug. # DEBUG=1 disable optimizations and build for debug.
@@ -52,7 +50,6 @@ GLIDE_RES = glide.res
GLIDE_DLL = glide2x.dll GLIDE_DLL = glide2x.dll
GLIDE_IMP = glide2x.lib GLIDE_IMP = glide2x.lib
FX_GLIDE_HW ?= cvg
FX_GLIDE_SW = ../../../swlibs FX_GLIDE_SW = ../../../swlibs
GLIDE_LIBDIR = ../../lib 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 # special sli buffer clears
CDEFS += -DGLIDE_BLIT_CLEAR=1 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 # tmus using chipfield. chipfield will always be set to 0xf
CDEFS += -DGLIDE_CHIP_BROADCAST=1 CDEFS += -DGLIDE_CHIP_BROADCAST=1

View File

@@ -69,9 +69,7 @@
#include <fxdll.h> #include <fxdll.h>
#include <glide.h> #include <glide.h>
#include "fxglide.h" #include "fxglide.h"
#ifdef __linux__
#include <ctype.h> #include <ctype.h>
#endif
extern const int _grMipMapHostWH[GR_ASPECT_1x8 + 1][GR_LOD_1 + 1][2]; extern const int _grMipMapHostWH[GR_ASPECT_1x8 + 1][GR_LOD_1 + 1][2];
extern FxU32 _gr_aspect_index_table[]; extern FxU32 _gr_aspect_index_table[];

View File

@@ -203,7 +203,7 @@ GLIDE_OBJECTS += \
$(FX_GLIDE_SW)/newpci/pcilib/fxpci.obj \ $(FX_GLIDE_SW)/newpci/pcilib/fxpci.obj \
$(FX_GLIDE_SW)/newpci/pcilib/fxw32.obj \ $(FX_GLIDE_SW)/newpci/pcilib/fxw32.obj \
$(FX_GLIDE_SW)/newpci/pcilib/fxvxd.obj \ $(FX_GLIDE_SW)/newpci/pcilib/fxvxd.obj \
$(FX_GLIDE_SW)/newpci/pcilib/fxnt.obj \ $(FX_GLIDE_SW)/newpci/pcilib/fxnt.obj
############################################################################### ###############################################################################
# rules # rules

View File

@@ -125,81 +125,81 @@ FxU32 _grMipMapHostSize[4][16] =
const int _grMipMapHostWH[GR_ASPECT_1x8+1][GR_LOD_1+1][2] = const int _grMipMapHostWH[GR_ASPECT_1x8+1][GR_LOD_1+1][2] =
{ {
{ {
256 , 32, { 256 , 32 },
128 , 16, { 128 , 16 },
64 , 8, { 64 , 8 },
32 , 4, { 32 , 4 },
16 , 2, { 16 , 2 },
8 , 1, { 8 , 1 },
4 , 1, { 4 , 1 },
2 , 1, { 2 , 1 },
1 , 1 { 1 , 1 }
}, },
{ {
256 , 64, { 256 , 64 },
128 , 32, { 128 , 32 },
64 , 16, { 64 , 16 },
32 , 8, { 32 , 8 },
16 , 4, { 16 , 4 },
8 , 2, { 8 , 2 },
4 , 1, { 4 , 1 },
2 , 1, { 2 , 1 },
1 , 1 { 1 , 1 }
}, },
{ {
256 , 128, { 256 , 128 },
128 , 64, { 128 , 64 },
64 , 32, { 64 , 32 },
32 , 16, { 32 , 16 },
16 , 8, { 16 , 8 },
8 , 4, { 8 , 4 },
4 , 2, { 4 , 2 },
2 , 1, { 2 , 1 },
1 , 1 { 1 , 1 }
}, },
{ {
256 , 256, { 256 , 256 },
128 , 128, { 128 , 128 },
64 , 64, { 64 , 64 },
32 , 32, { 32 , 32 },
16 , 16, { 16 , 16 },
8 , 8, { 8 , 8 },
4 , 4, { 4 , 4 },
2 , 2, { 2 , 2 },
1 , 1 { 1 , 1 }
}, },
{ {
128, 256, { 128, 256 },
64, 128, { 64, 128 },
32, 64 , { 32, 64 },
16, 32 , { 16, 32 },
8, 16 , { 8, 16 },
4, 8 , { 4, 8 },
2, 4 , { 2, 4 },
1, 2 , { 1, 2 },
1, 1 { 1, 1 }
}, },
{ {
64, 256, { 64, 256 },
32, 128, { 32, 128 },
16, 64 , { 16, 64 },
8, 32 , { 8, 32 },
4, 16 , { 4, 16 },
2, 8 , { 2, 8 },
1, 4 , { 1, 4 },
1, 2 , { 1, 2 },
1, 1 { 1, 1 }
}, },
{ {
32, 256, { 32, 256 },
16, 128, { 16, 128 },
8, 64 , { 8, 64 },
4, 32 , { 4, 32 },
2, 16 , { 2, 16 },
1, 8 , { 1, 8 },
1, 4 , { 1, 4 },
1, 2 , { 1, 2 },
1, 1 { 1, 1 }
} }
}; };
@@ -625,15 +625,10 @@ GR_DIENTRY(grTexDownloadMipMapLevel, void,
FxU16 rle_line[256]; FxU16 rle_line[256];
FxU16 *rle_line_end; FxU16 *rle_line_end;
#ifdef __WIN32__ #ifndef __WATCOMC__
void rle_decode_line_asm(FxU16 *tlut,FxU8 *src,FxU16 *dest) void rle_decode_line_asm(FxU16 *tlut,FxU8 *src,FxU16 *dest)
{ {
/* don't do anything just shut up the compiler */ /* don't do anything just shut up the compiler */
} }
#endif #endif
#ifdef __GNUC__
void rle_decode_line_asm(FxU16 *tlut,FxU8 *src,FxU16 *dest) {
}
#endif

View File

@@ -19,6 +19,7 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <3dfx.h> #include <3dfx.h>
#include <glidesys.h> #include <glidesys.h>
@@ -77,7 +78,7 @@ main (int argc, char **argv)
printf("#ifndef __FX_INLINE_H__\n"); printf("#ifndef __FX_INLINE_H__\n");
printf("#define __FX_INLINE_H__\n"); printf("#define __FX_INLINE_H__\n");
printf("\n"); printf("\n");
printf("/* The # of 2-byte entries in the hw fog table */\n"); printf("/* The # of 2-byte entries in the hw fog table */\n");
printf("#define kInternalFogTableEntryCount 0x%XUL\n", printf("#define kInternalFogTableEntryCount 0x%XUL\n",
sizeof(dummyRegs.fogTable) >> 1); sizeof(dummyRegs.fogTable) >> 1);

View File

@@ -36,9 +36,7 @@
#include <fxdll.h> #include <fxdll.h>
#include <glide.h> #include <glide.h>
#include "fxglide.h" #include "fxglide.h"
#ifdef __linux__
#include <ctype.h> #include <ctype.h>
#endif
extern const int _grMipMapHostWH[GR_ASPECT_1x8+1][GR_LOD_1+1][2]; extern const int _grMipMapHostWH[GR_ASPECT_1x8+1][GR_LOD_1+1][2];
extern FxU32 _gr_aspect_index_table[]; extern FxU32 _gr_aspect_index_table[];
@@ -133,8 +131,8 @@ GR_DIENTRY(gu3dfGetInfo, FxBool,
** grab statistics out of the header ** grab statistics out of the header
*/ */
if( sscanf(buffer,"3df v%s %s lod range: %i %i aspect ratio: %i %i\n", if( sscanf(buffer,"3df v%s %s lod range: %i %i aspect ratio: %i %i\n",
&version, version,
color_format, color_format,
&small_lod, &large_lod, &small_lod, &large_lod,
&aspect_width, &aspect_height ) == 0 ) &aspect_width, &aspect_height ) == 0 )
return FXFALSE; return FXFALSE;

View File

@@ -608,7 +608,8 @@ GR_ENTRY(grSstWinOpen, FxBool, (
oemi.linearAddress = gc->base_ptr; oemi.linearAddress = gc->base_ptr;
oemi.slaveAddress = NULL; oemi.slaveAddress = NULL;
if ((gc->oemInit = LoadLibrary("fxoem2x.dll")) != 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); oemInitMapBoard(&oemi);
} }
} }
@@ -702,8 +703,8 @@ GR_ENTRY(grSstWinOpen, FxBool, (
oemi.vid.clkFreq24bpp = tvVidtiming.clkFreq24bpp; oemi.vid.clkFreq24bpp = tvVidtiming.clkFreq24bpp;
if (gc->oemInit) { if (gc->oemInit) {
if ((oemInitVideoTiming = GetProcAddress(gc->oemInit, "_fxoemInitVideoTiming@4")) && oemInitVideoTiming = GetProcAddress(gc->oemInit, "_fxoemInitVideoTiming@4");
(oemInitMapBoard)) if (oemInitVideoTiming && oemInitMapBoard)
oemvidtiming = oemInitVideoTiming(&oemi); oemvidtiming = oemInitVideoTiming(&oemi);
/* /*
** video timing is updated by oem dll ** video timing is updated by oem dll
@@ -744,8 +745,8 @@ GR_ENTRY(grSstWinOpen, FxBool, (
#if (GLIDE_PLATFORM & GLIDE_OS_WIN32) #if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
if (gc->oemInit) { if (gc->oemInit) {
if ((oemInitSetVideo = GetProcAddress(gc->oemInit, "_fxoemInitSetVideo@4")) && oemInitSetVideo = GetProcAddress(gc->oemInit, "_fxoemInitSetVideo@4");
(oemInitMapBoard)) if (oemInitSetVideo && oemInitMapBoard)
oemInitSetVideo(&oemi); oemInitSetVideo(&oemi);
} }
#endif #endif
@@ -956,15 +957,13 @@ GR_ENTRY(grSstWinOpen, FxBool, (
if (!_GlideRoot.environment.noSplash) { if (!_GlideRoot.environment.noSplash) {
HMODULE newSplash = LoadLibrary("3dfxsplash2.dll"); HMODULE newSplash = LoadLibrary("3dfxsplash2.dll");
if (newSplash) { if (newSplash) {
FARPROC fxSplash = GetProcAddress(newSplash, "_fxSplash@16"); FARPROC fxSplash = GetProcAddress(newSplash, "_fxSplash@16");
if (fxSplash) { if (fxSplash) {
fxSplash(hWnd, gc->state.screen_width, fxSplash(hWnd, gc->state.screen_width,
gc->state.screen_height, nAuxBuffers); gc->state.screen_height, nAuxBuffers);
_GlideRoot.environment.noSplash = 1; _GlideRoot.environment.noSplash = 1;
} }
} }
} }
#endif /* (GLIDE_PLATFORM & GLIDE_OS_WIN32) */ #endif /* (GLIDE_PLATFORM & GLIDE_OS_WIN32) */
@@ -1056,7 +1055,8 @@ GR_ENTRY( grSstWinClose, void, ( void ) )
initRestoreVideo(); initRestoreVideo();
#if (GLIDE_PLATFORM & GLIDE_OS_WIN32) #if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
if (gc->oemInit) { if (gc->oemInit) {
if (oemRestoreVideo = GetProcAddress(gc->oemInit, "_fxoemRestoreVideo@0")) oemRestoreVideo = GetProcAddress(gc->oemInit, "_fxoemRestoreVideo@0");
if (oemRestoreVideo)
oemRestoreVideo(); oemRestoreVideo();
FreeLibrary(gc->oemInit); FreeLibrary(gc->oemInit);
} }
@@ -1099,9 +1099,9 @@ GR_ENTRY(grSstControl, FxBool, ( GrControl_t code ))
xRes = initControl(code); xRes = initControl(code);
#if (GLIDE_PLATFORM & GLIDE_OS_WIN32) #if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
{ {
FARPROC oemControl = NULL;
if (gc->oemInit) { if (gc->oemInit) {
if ((oemControl = GetProcAddress(gc->oemInit, "_fxoemControl@4"))) FARPROC oemControl = GetProcAddress(gc->oemInit, "_fxoemControl@4");
if (oemControl)
oemControl(code); oemControl(code);
} }
} }
@@ -1150,9 +1150,9 @@ GR_ENTRY(grSstControl, FxBool, ( GrControl_t code ))
ctrlflag = initControl(code); ctrlflag = initControl(code);
#if (GLIDE_PLATFORM & GLIDE_OS_WIN32) #if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
{ {
FARPROC oemControl = NULL;
if (gc->oemInit) { if (gc->oemInit) {
if ((oemControl = GetProcAddress(gc->oemInit, "_fxoemControl@4"))) FARPROC oemControl = GetProcAddress(gc->oemInit, "_fxoemControl@4");
if (oemControl)
oemControl(code); oemControl(code);
} }
} }

View File

@@ -225,4 +225,4 @@ typedef enum
SSTR_END_OF_REGISTER_SET SSTR_END_OF_REGISTER_SET
} GrSstRegister; } GrSstRegister;
#endif /* __GSSTDEF_H__ */ #endif /* __GSSTDEF_H__ */

View File

@@ -19,7 +19,6 @@
** **
*/ */
#include "init.h" #include "init.h"
#include "fxinit.h" #include "fxinit.h"
@@ -45,7 +44,19 @@
#ifdef _WIN32 #ifdef _WIN32
#define _WIN32_LEAN_AND_MEAN_ #define _WIN32_LEAN_AND_MEAN_
#include <windows.h> #include <windows.h>
#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
#endif /* _WIN32 */
#include <fxpci.h> #include <fxpci.h>
#include <gdebug.h> #include <gdebug.h>

View File

@@ -38,6 +38,18 @@
#ifdef __WIN32__ #ifdef __WIN32__
#include <windows.h> #include <windows.h>
#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__ */ #endif /* __WIN32__ */
#if defined(__WATCOMC__) #if defined(__WATCOMC__)

View File

@@ -38,6 +38,22 @@
#ifdef __WIN32__ #ifdef __WIN32__
#include <windows.h> #include <windows.h>
#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__ */ #endif /* __WIN32__ */
#define INIT_MCRX_LIB #define INIT_MCRX_LIB