diff --git a/glide3x/h3/glide3/src/fxglide.h b/glide3x/h3/glide3/src/fxglide.h index 91679a1..9d30403 100644 --- a/glide3x/h3/glide3/src/fxglide.h +++ b/glide3x/h3/glide3/src/fxglide.h @@ -1413,7 +1413,7 @@ struct _GlideRoot_s { #if defined(__WATCOMC__) || defined(__MSC__) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))) int p6Fencer; /* xchg to here to keep this in cache!!! */ #endif - FxU32 + unsigned long tlsIndex, tlsOffset; @@ -1884,9 +1884,9 @@ _grSstVRetraceOn(void); #ifdef __GNUC__ -extern __inline FxU32 getThreadValueFast (void) +extern __inline unsigned long getThreadValueFast (void) { - FxU32 t; + unsigned long t; __asm __volatile (" \ mov %%fs:(%0), %%eax; \ add %1, %%eax; \ @@ -1898,7 +1898,7 @@ extern __inline FxU32 getThreadValueFast (void) #else /* __GNUC__ */ #pragma warning (4:4035) /* No return value */ -__inline FxU32 +__inline unsigned long getThreadValueFast() { __asm { __asm mov eax, DWORD PTR fs:[WNT_TEB_PTR] @@ -1910,8 +1910,8 @@ getThreadValueFast() { #endif #if (GLIDE_PLATFORM & GLIDE_OS_MACOS) -extern FxU32 _threadValueMacOS; -__inline FxU32 +extern unsigned long _threadValueMacOS; +__inline unsigned long getThreadValueFast() { return _threadValueMacOS; } @@ -1923,7 +1923,7 @@ extern unsigned long threadValueLinux; #endif #if (GLIDE_PLATFORM & GLIDE_OS_DOS32) -extern FxU32 GR_CDECL threadValueDJGPP; +extern unsigned long GR_CDECL threadValueDJGPP; #define getThreadValueFast() threadValueDJGPP #endif diff --git a/glide3x/h3/glide3/src/gthread.c b/glide3x/h3/glide3/src/gthread.c index c82f752..b5eedeb 100644 --- a/glide3x/h3/glide3/src/gthread.c +++ b/glide3x/h3/glide3/src/gthread.c @@ -25,8 +25,6 @@ #include <3dfx.h> #include -#if defined( __WIN32__ ) - #define FX_DLL_DEFINITION #include #include @@ -34,6 +32,8 @@ #include "fxglide.h" #include "fxcmd.h" +#if defined( __WIN32__ ) + #if (GLIDE_PLATFORM & GLIDE_OS_WIN32) #include #endif @@ -44,8 +44,8 @@ static DWORD tlsIndex; static FxBool threadInit; static FxBool criticalSectionInit; -void -initThreadStorage( void ) +void +initThreadStorage( void ) { if ( !threadInit ) { threadInit = 1; @@ -89,17 +89,7 @@ void endCriticalSection( void ) { #elif defined(macintosh) -#include <3dfx.h> -#include - -#define FX_DLL_DEFINITION -#include -#include - -#include "fxglide.h" -#include "fxcmd.h" - -FxU32 _threadValueMacOS; +unsigned long _threadValueMacOS; void initThreadStorage(void) { @@ -110,11 +100,11 @@ void setThreadValue( unsigned long value ) _threadValueMacOS = value; } -FxU32 getThreadValueSLOW( void ) +unsigned long getThreadValueSLOW( void ) { return _threadValueMacOS; } - + void initCriticalSection(void) { } @@ -129,17 +119,6 @@ void endCriticalSection(void) #elif defined(__linux__) || defined(__FreeBSD__) - -#include <3dfx.h> -#include - -#define FX_DLL_DEFINITION -#include -#include - -#include "fxglide.h" -#include "fxcmd.h" - unsigned long threadValueLinux; void initThreadStorage(void) @@ -155,7 +134,7 @@ unsigned long getThreadValueSLOW( void ) { return threadValueLinux; } - + void initCriticalSection(void) { } @@ -170,33 +149,22 @@ void endCriticalSection(void) #elif (GLIDE_PLATFORM & GLIDE_OS_DOS32) - -#include <3dfx.h> -#include - -#define FX_DLL_DEFINITION -#include -#include - -#include "fxglide.h" -#include "fxcmd.h" - -FxU32 GR_CDECL threadValueDJGPP; +unsigned long GR_CDECL threadValueDJGPP; void initThreadStorage(void) { } -void setThreadValue( FxU32 value ) +void setThreadValue( unsigned long value ) { threadValueDJGPP = value; } -FxU32 getThreadValueSLOW( void ) +unsigned long getThreadValueSLOW( void ) { return threadValueDJGPP; } - + void initCriticalSection(void) { } diff --git a/glide3x/h5/glide3/src/fxglide.h b/glide3x/h5/glide3/src/fxglide.h index f45f604..7ddc6b8 100644 --- a/glide3x/h5/glide3/src/fxglide.h +++ b/glide3x/h5/glide3/src/fxglide.h @@ -2013,8 +2013,8 @@ struct _GlideRoot_s { #if defined(__WATCOMC__) || defined(__MSC__) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))) int p6Fencer; /* xchg to here to keep this in cache!!! */ #endif - FxU32 tlsIndex; - FxU32 tlsOffset; + unsigned long tlsIndex; + unsigned long tlsOffset; int current_sst; FxI32 windowsInit[MAX_NUM_SST]; /* Is the fullscreen part of glide initialized? */ @@ -2735,14 +2735,14 @@ _grSstVRetraceOn(void); #ifdef __GNUC__ extern #endif -__inline FxU32 +__inline unsigned long getThreadValueFast() { /* According to Microsoft, TlsGetValue is implemented with speed as the * primary goal. The function performs minimal parameter validation and * error checking. This function succeeds only when the TLS index is in * the range 0 through (TLS_MINIMUM_AVAILABLE - 1). */ - return (FxU32)TlsGetValue(_GlideRoot.tlsIndex); + return (unsigned long)TlsGetValue(_GlideRoot.tlsIndex); } #else @@ -2757,9 +2757,9 @@ getThreadValueFast() { #ifdef __GNUC__ -extern __inline FxU32 getThreadValueFast (void) +extern __inline unsigned long getThreadValueFast (void) { - FxU32 t; + unsigned long t; __asm __volatile (" \ mov %%fs:(%0), %%eax; \ add %1, %%eax; \ @@ -2771,7 +2771,7 @@ extern __inline FxU32 getThreadValueFast (void) #else /* __GNUC__ */ #pragma warning (4:4035) /* No return value */ -__inline FxU32 +__inline unsigned long getThreadValueFast() { __asm { __asm mov eax, DWORD PTR fs:[WNT_TEB_PTR] @@ -2786,7 +2786,7 @@ getThreadValueFast() { #endif #if (GLIDE_PLATFORM & GLIDE_OS_MACOS) -extern FxU32 _threadValueMacOS; +extern unsigned long _threadValueMacOS; __inline FxU32 getThreadValueFast() { return _threadValueMacOS; @@ -2799,7 +2799,7 @@ extern unsigned long threadValueLinux; #endif /* defined(GLIDE_PLATFORM & GLIDE_OS_UNIX) */ #if (GLIDE_PLATFORM & GLIDE_OS_DOS32) -extern FxU32 GR_CDECL threadValueDJGPP; +extern unsigned long GR_CDECL threadValueDJGPP; #define getThreadValueFast() threadValueDJGPP #endif /* DOS32 */ diff --git a/glide3x/h5/glide3/src/gthread.c b/glide3x/h5/glide3/src/gthread.c index 6843aaf..df7a067 100644 --- a/glide3x/h5/glide3/src/gthread.c +++ b/glide3x/h5/glide3/src/gthread.c @@ -19,7 +19,6 @@ ** */ - /* NOTE: This file is compiled to naught if we aren't running under Win32 */ @@ -45,8 +44,8 @@ static DWORD tlsIndex; static FxBool threadInit; static FxBool criticalSectionInit; -void -initThreadStorage( void ) +void +initThreadStorage( void ) { if ( !threadInit ) { threadInit = 1; @@ -55,14 +54,14 @@ initThreadStorage( void ) if (_GlideRoot.tlsIndex == TLS_OUT_OF_INDEXES) GrErrorCallback( "initThreadStorage: Failed to allocate TLS index.", FXTRUE ); - /* pray the index is lower than 64 */ - if ((_GlideRoot.tlsIndex < 0) || - (_GlideRoot.tlsIndex > 63)) /* TLS_MINIMUM_AVAILABLE = 64 */ + /* pray the index is lower than 64 -- TLS_MINIMUM_AVAILABLE = 64 */ + if (_GlideRoot.tlsIndex => TLS_MINIMUM_AVAILABLE) GrErrorCallback( "initThreadStorage: TLS index higher than 64.", FXTRUE ); #if !USE_STANDARD_TLS_FUNC - if ( hwcIsOSWin9x() ) { + if (hwcIsOSWin9x()) { _GlideRoot.tlsOffset = W95_TLS_INDEX_TO_OFFSET(_GlideRoot.tlsIndex); - } else { + } + else { _GlideRoot.tlsOffset = WNT_TLS_INDEX_TO_OFFSET(_GlideRoot.tlsIndex); } #endif @@ -74,18 +73,18 @@ void setThreadValue( unsigned long value ) { TlsSetValue( _GlideRoot.tlsIndex, (void*)value ); } -unsigned long getThreadValueSLOW(void) +unsigned long getThreadValueSLOW( void ) { - GR_CHECK_F( "getThreadValue", !threadInit, "Thread storage not initialized\n" ); + GR_CHECK_F( "getThreadValue", !threadInit, "Thread storage not initialized\n" ); - return getThreadValueFast(); + return getThreadValueFast(); } #if USE_STANDARD_TLS_FUNC /* used in gdraw.c (grDrawTriangle) and xos.inc */ -FxU32 getThreadValue(void) +unsigned long getThreadValue(void) { - return (FxU32)TlsGetValue(_GlideRoot.tlsIndex); + return (unsigned long)TlsGetValue(_GlideRoot.tlsIndex); } #endif @@ -123,7 +122,7 @@ void endCriticalSection( void ) { #elif defined(macintosh) -FxU32 _threadValueMacOS; +unsigned long _threadValueMacOS; void initThreadStorage(void) { @@ -134,7 +133,7 @@ void setThreadValue( unsigned long value ) _threadValueMacOS = value; } -FxU32 getThreadValueSLOW( void ) +unsigned long getThreadValueSLOW( void ) { return _threadValueMacOS; } @@ -167,8 +166,6 @@ void initThreadStorage(void) { } - - void setThreadValue( unsigned long value ) { threadValueLinux = value; @@ -197,22 +194,22 @@ void endCriticalSection(void) #elif (GLIDE_PLATFORM & GLIDE_OS_DOS32) -FxU32 GR_CDECL threadValueDJGPP; +unsigned long GR_CDECL threadValueDJGPP; void initThreadStorage(void) { } -void setThreadValue( FxU32 value ) +void setThreadValue( unsigned long value ) { threadValueDJGPP = value; } -FxU32 getThreadValueSLOW( void ) +unsigned long getThreadValueSLOW( void ) { return threadValueDJGPP; } - + void initCriticalSection(void) { }