glide2x: allow disabling the splash screen and the shameless plug code.

This commit is contained in:
sezero
2019-07-07 00:47:28 +03:00
parent 8be8bb66b5
commit 8522edee5c
12 changed files with 95 additions and 23 deletions

View File

@@ -768,9 +768,11 @@ GR_ENTRY(grBufferSwap, void, (int swapInterval))
#endif /* (GLIDE_PLATFORM & GLIDE_HW_CVG) */
#if ((GLIDE_PLATFORM & GLIDE_HW_CVG) || (GLIDE_PLATFORM & GLIDE_HW_H3))
#ifdef GLIDE_PLUG
/* optionally display the 3Dfx powerfield logo overlay */
if (_GlideRoot.environment.shamelessPlug) _grShamelessPlug();
#endif
/* check for environmental override.
*
* NB: If we are sli, the application passes in 0, and the user has

View File

@@ -746,8 +746,16 @@ _GlideInitEnvironment(void)
(((envStr = GETENV(__envVar)) == NULL) ? (__defVal) : atol(envStr))
_GlideRoot.environment.triBoundsCheck = (GETENV("FX_GLIDE_BOUNDS_CHECK") != NULL);
#ifdef GLIDE_SPLASH
_GlideRoot.environment.noSplash = (GETENV("FX_GLIDE_NO_SPLASH") != NULL);
#else
_GlideRoot.environment.noSplash = 1;
#endif
#ifdef GLIDE_PLUG
_GlideRoot.environment.shamelessPlug = (GETENV("FX_GLIDE_SHAMELESS_PLUG") != NULL);
#else
_GlideRoot.environment.shamelessPlug = 0;
#endif
_GlideRoot.environment.ignoreReopen = (GETENV("FX_GLIDE_IGNORE_REOPEN") != NULL);
_GlideRoot.environment.texLodDither = ((GETENV("FX_GLIDE_LOD_DITHER") == NULL)
? 0x00UL

View File

@@ -90,6 +90,13 @@
#include "fxglide.h"
#include "fxinline.h"
#ifndef GLIDE_SPLASH
GR_DIENTRY(grSplash,void,(float x,float y,float w,float h,FxU32 _frame)) {
/* nothing */
}
#else /* GLIDE_SPLASH */
/*-----------------------------
Constants
-----------------------------*/
@@ -951,3 +958,4 @@ GR_DIENTRY(grSplash,void,(float x,float y,float w,float h,FxU32 _frame))
}
#endif /* GLIDE_SPLASH */

View File

@@ -1571,6 +1571,7 @@ __errSliExit:
/* --------------------------------------------------------
Splash Screen
--------------------------------------------------------*/
#ifdef GLIDE_SPLASH
#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
if (!_GlideRoot.environment.noSplash) {
HMODULE newSplash = LoadLibrary("3dfxspl2.dll");
@@ -1634,6 +1635,7 @@ __errSliExit:
0);
_GlideRoot.environment.noSplash = 1;
}
#endif
_GlideRoot.windowsInit = FXTRUE; /* to avoid race with grSstControl() */

View File

@@ -74,28 +74,45 @@
#include <glide.h>
#include "fxglide.h"
#ifdef GLIDE_PLUG
#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
static const void *
getPlugdata (FxU32* w, FxU32* h, FxI32* strideInBytes,
GrLfbWriteMode_t* format)
{
GR_DCL_GC;
if (gc->pluginInfo.plugProc != NULL)
return (*gc->pluginInfo.plugProc)(w,h,strideInBytes,format);
return NULL;
}
#else
static __inline const void *
getPlugdata (FxU32* w, FxU32* h, FxI32* strideInBytes,
GrLfbWriteMode_t* format)
{
return NULL;
}
#endif
void
_grShamelessPlug(void)
{
GrState state;
FxU32 plugWidth, plugHeight;
FxI32 plugStride;
GrLfbWriteMode_t plugFormat;
const void* plugData;
GR_BEGIN_NOFIFOCHECK("_grShamelessPlug", 80);
GDBG_INFO_MORE(gc->myLevel, "()\n");
#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
if (gc->pluginInfo.plugProc != NULL) {
FxU32
plugWidth, plugHeight,
plugStride;
GrLfbWriteMode_t
plugFormat;
const void*
plugData = (*gc->pluginInfo.plugProc)(&plugWidth, &plugHeight,
&plugStride,
&plugFormat);
plugData =
getPlugdata(&plugWidth, &plugHeight, &plugStride, &plugFormat);
if (!plugData) return;
if (plugData != NULL) {
#ifdef GLIDE_PLUG
GrState state;
grGlideGetState(&state);
grDisableAllEffects();
@@ -133,10 +150,8 @@ _grShamelessPlug(void)
plugData);
grGlideSetState(&state);
#endif /* GLIDE_PLUG */
}
}
#endif /* (GLIDE_PLATFORM & GLIDE_OS_WIN32) */
GR_END();
} /* _grShamelessPlug */
#endif /* GLIDE_PLUG */

View File

@@ -768,8 +768,10 @@ GR_ENTRY(grBufferSwap, void, (int swapInterval))
GR_BEGIN_NOFIFOCHECK(FN_NAME,86);
GDBG_INFO_MORE(gc->myLevel,"(%d)\n",swapInterval);
#ifdef GLIDE_PLUG
/* optionally display the 3Dfx powerfield logo overlay */
if (_GlideRoot.environment.shamelessPlug) _grShamelessPlug();
#endif
/* check for environmental override */
if (_GlideRoot.environment.swapInterval >= 0) {

View File

@@ -908,12 +908,20 @@ _GlideInitEnvironment(void)
GDBG_INFO(80,"\ttriBoundsCheck: %d\n",
_GlideRoot.environment.triBoundsCheck);
#ifdef GLIDE_SPLASH
_GlideRoot.environment.noSplash =
(GETENV("FX_GLIDE_NO_SPLASH") != NULL);
#else
_GlideRoot.environment.noSplash = 1;
#endif
GDBG_INFO(80,"\tnoSplash: %d\n",_GlideRoot.environment.noSplash);
#ifdef GLIDE_PLUG
_GlideRoot.environment.shamelessPlug =
(GETENV("FX_GLIDE_SHAMELESS_PLUG") != NULL);
#else
_GlideRoot.environment.shamelessPlug = 0;
#endif
GDBG_INFO(80,"\tshamelessPlug: %d\n",
_GlideRoot.environment.shamelessPlug);

View File

@@ -594,9 +594,11 @@ assertDefaultState( void )
static void
doSplash(void)
{
#if defined(GLIDE_SPLASH) || ((GLIDE_PLATFORM & GLIDE_OS_WIN32) && defined(GLIDE_PLUG))
GR_DCL_GC;
#endif
#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
#if (GLIDE_PLATFORM & GLIDE_OS_WIN32) && (defined(GLIDE_SPLASH)||defined(GLIDE_PLUG))
{
FxBool
didLoad;
@@ -633,6 +635,7 @@ doSplash(void)
}
#endif /* (GLIDE_PLATFORM & GLIDE_OS_WIN32) */
#ifdef GLIDE_SPLASH
if (_GlideRoot.environment.noSplash == 0) {
grSplash(0.0f, 0.0f,
(float)gc->state.screen_width,
@@ -640,6 +643,7 @@ doSplash(void)
0);
}
_GlideRoot.environment.noSplash = 1;
#endif
} /* doSplash */

View File

@@ -559,9 +559,11 @@ GR_ENTRY(grBufferSwap, void, ( int swapInterval ))
pending = grBufferNumPending();
} while (pending > 3);
#ifdef GLIDE_PLUG
/* optionally display the 3Dfx powerfield logo overlay */
if (_GlideRoot.environment.shamelessPlug)
_grShamelessPlug();
#endif
initSwapBuffers( swapInterval );
@@ -578,9 +580,11 @@ GR_ENTRY(grBufferSwap, void, ( int swapInterval ))
P6_NUDGE_OF_LOVE;
#elif ( GLIDE_PLATFORM & GLIDE_HW_SST1 )
#ifdef GLIDE_PLUG
/* optionally display the 3Dfx powerfield logo overlay */
if (_GlideRoot.environment.shamelessPlug)
_grShamelessPlug();
#endif
/* check for environmental override */
if (_GlideRoot.environment.swapInterval >= 0) {

View File

@@ -389,10 +389,18 @@ _GlideInitEnvironment( void )
getenv("FX_GLIDE_BOUNDS_CHECK") != NULL;
_GlideRoot.environment.swapInterval = -1;
_GlideRoot.environment.swFifoLWM = -1;
#ifdef GLIDE_SPLASH
_GlideRoot.environment.noSplash =
getenv("FX_GLIDE_NO_SPLASH") != NULL;
#else
_GlideRoot.environment.noSplash = 1;
#endif
#ifdef GLIDE_PLUG
_GlideRoot.environment.shamelessPlug =
getenv("FX_GLIDE_SHAMELESS_PLUG") != NULL;
#else
_GlideRoot.environment.shamelessPlug = 0;
#endif
if (getenv("FX_GLIDE_LWM"))
_GlideRoot.environment.swFifoLWM = atoi(getenv("FX_GLIDE_LWM"));
if (getenv("FX_GLIDE_SWAPINTERVAL")) {

View File

@@ -59,6 +59,13 @@
#include <math.h>
#ifndef GLIDE_SPLASH
GR_DIENTRY(grSplash,void,(float x,float y,float w,float h,FxU32 _frame)) {
/* nothing */
}
#else /* GLIDE_SPLASH */
/*-----------------------------
Constants
-----------------------------*/
@@ -889,5 +896,4 @@ GR_DIENTRY(grSplash,void,(float x,float y,float w,float h,FxU32 _frame))
grGlideSetState(&oldState);
}
#endif /* GLIDE_SPLASH */

View File

@@ -951,6 +951,7 @@ GR_ENTRY(grSstWinOpen, FxBool, (
grSstOrigin( GR_ORIGIN_LOWER_LEFT );
#ifdef GLIDE_SPLASH
if (!_GlideRoot.environment.noSplash) {
HMODULE newSplash = LoadLibrary("3dfxsplash2.dll");
if (newSplash) {
@@ -962,8 +963,10 @@ GR_ENTRY(grSstWinOpen, FxBool, (
}
}
}
#endif
#endif /* (GLIDE_PLATFORM & GLIDE_OS_WIN32) */
#ifdef GLIDE_SPLASH
/* If it's still 0, then do the old one */
if (!_GlideRoot.environment.noSplash) {
grSplash(0.0f, 0.0f,
@@ -972,6 +975,8 @@ GR_ENTRY(grSstWinOpen, FxBool, (
0);
_GlideRoot.environment.noSplash = 1;
}
#endif
grGlideSetState(&state);
}