diff options
author | icculus <icculus@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2005-12-04 21:40:25 +0000 |
---|---|---|
committer | icculus <icculus@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2005-12-04 21:40:25 +0000 |
commit | 11273ed8d96a39f140f0bd82009e31fe435cc3d7 (patch) | |
tree | 1c234b00dc1a224a71054a119186bcfc1bdb1cfd /code/qcommon | |
parent | 743a8fd50fc698f7a45cf54c89943231cd11b5f3 (diff) | |
download | ioquake3-aero-11273ed8d96a39f140f0bd82009e31fe435cc3d7.tar.gz ioquake3-aero-11273ed8d96a39f140f0bd82009e31fe435cc3d7.zip |
Better altivec cvar handling. Should fix crashes at startup, or curious
people that toggle it on at runtime on a G3.
git-svn-id: svn://svn.icculus.org/quake3/trunk@410 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/qcommon')
-rw-r--r-- | code/qcommon/common.c | 30 | ||||
-rw-r--r-- | code/qcommon/qcommon.h | 2 |
2 files changed, 30 insertions, 2 deletions
diff --git a/code/qcommon/common.c b/code/qcommon/common.c index 690d5bd..3839f7b 100644 --- a/code/qcommon/common.c +++ b/code/qcommon/common.c @@ -2353,6 +2353,24 @@ out: #endif +static void Com_DetectAltivec(void) +{ + // Only detect if user hasn't forcibly disabled it. + if (com_altivec->integer) { + static qboolean altivec = qfalse; + static qboolean detected = qfalse; + if (!detected) { + altivec = Sys_DetectAltivec(); + detected = qtrue; + } + + if (!altivec) { + Cvar_Set( "com_altivec", "0" ); // we don't have it! Disable support! + } + } +} + + /* ================= Com_Init @@ -2510,9 +2528,11 @@ void Com_Init( char *commandLine ) { com_fullyInitialized = qtrue; - #if idppc_altivec + // always set the cvar, but only print the info if it makes sense. + Com_DetectAltivec(); + #if idppc Com_Printf ("Altivec support is %s\n", com_altivec->integer ? "enabled" : "disabled"); - #endif + #endif Com_Printf ("--- Common Initialization Complete ---\n"); } @@ -2713,6 +2733,12 @@ void Com_Frame( void ) { } while ( msec < minMsec ); Cbuf_Execute (); + if (com_altivec->modified) + { + Com_DetectAltivec(); + com_altivec->modified = qfalse; + } + lastTime = com_frameTime; // mess with msec if needed diff --git a/code/qcommon/qcommon.h b/code/qcommon/qcommon.h index 35e44dd..01f4564 100644 --- a/code/qcommon/qcommon.h +++ b/code/qcommon/qcommon.h @@ -1033,6 +1033,8 @@ unsigned int Sys_ProcessorCount( void ); int Sys_MonkeyShouldBeSpanked( void ); +qboolean Sys_DetectAltivec( void ); + /* This is based on the Adaptive Huffman algorithm described in Sayood's Data * Compression book. The ranks are not actually stored, but implicitly defined * by the location of a node within a doubly-linked list */ |