Ver Fonte

Windows Platform Cleanup

Removes deprecated GetVersionEx() calls.
Removes unused OS/hardware profile system intended to load different
default preferences.cs files based on the user's hardware/OS.
Removes unused preferences (OpenGL::allowTexGen, Video::clipHigh, and
Video::only16).
chaigler há 10 anos atrás
pai
commit
37605d01d3

+ 10 - 21
engine/source/platformWin32/winInput.cc

@@ -78,29 +78,18 @@ void Input::init()
    smLastMouseActivated = true;
    smLastMouseActivated = true;
    smLastJoystickActivated = true;
    smLastJoystickActivated = true;
 
 
-   OSVERSIONINFO OSVersionInfo;
-   dMemset( &OSVersionInfo, 0, sizeof( OSVERSIONINFO ) );
-   OSVersionInfo.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
-   if ( GetVersionEx( &OSVersionInfo ) )
+   smManager = new DInputManager;
+   if (!smManager->enable())
    {
    {
+	   Con::printf("   DirectInput not enabled.");
 
 
-      if ( !( OSVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT && OSVersionInfo.dwMajorVersion < 5 ) )
-      {
-         smManager = new DInputManager;
-         if ( !smManager->enable() )
-         {
-            Con::printf( "   DirectInput not enabled." );
-            delete smManager;
-            smManager = NULL;
-         }
-         else
-         {
-            DInputManager::init();
-            Con::printf( "   DirectInput enabled." );
-         }
-      }
-      else
-         Con::printf( "  WinNT detected -- DirectInput not enabled." );
+	   delete smManager;
+	   smManager = NULL;
+   }
+   else
+   {
+	   DInputManager::init();
+	   Con::printf("   DirectInput enabled.");
    }
    }
 
 
    // Startup the Cursor Manager
    // Startup the Cursor Manager

+ 0 - 374
engine/source/platformWin32/winOGLVideo.cc

@@ -30,312 +30,8 @@
 #include "console/consoleInternal.h"
 #include "console/consoleInternal.h"
 #include "console/ast.h"
 #include "console/ast.h"
 #include "io/fileStream.h"
 #include "io/fileStream.h"
-
-//------------------------------------------------------------------------------
-
-struct CardProfile
-{
-   const char *vendor;     // manufacturer
-   const char *renderer;   // driver name
-
-   bool safeMode;          // destroy rendering context for resolution change
-   bool lockArray;         // allow compiled vertex arrays
-   bool subImage;          // allow glTexSubImage*
-   bool fogTexture;        // require bound texture for combine extension
-   bool noEnvColor;        // no texture environment color
-   bool clipHigh;          // clip high resolutions
-    bool deleteContext;		// delete rendering context
-    bool texCompress;			// allow texture compression
-    bool interiorLock;		// lock arrays for Interior render
-    bool skipFirstFog;		// skip first two-pass fogging (dumb 3Dfx hack)
-    bool only16;				// inhibit 32-bit resolutions
-    bool noArraysAlpha;	// don't use glDrawArrays with a GL_ALPHA texture
-
-    const char *proFile;		// explicit profile of graphic settings
-};
-
-struct OSCardProfile
-{
-   const char *vendor;     // manufacturer
-   const char *renderer;   // driver name
-
-   bool allowOpenGL;			// allow OpenGL driver
-    bool preferOpenGL;		// prefer OpenGL driver
-};
-
-static Vector<CardProfile> sCardProfiles(__FILE__, __LINE__);
-static Vector<OSCardProfile> sOSCardProfiles(__FILE__, __LINE__);
-
-//------------------------------------------------------------------------------
-
 #include "winOGLVideo_ScriptBinding.h"
 #include "winOGLVideo_ScriptBinding.h"
 
 
-//------------------------------------------------------------------------------
-
-struct ProcessorProfile
-{
-    U16 clock;  // clock range max
-    U16 adjust; // CPU adjust
-};
-
-static U8 sNumProcessors = 4;
-static ProcessorProfile sProcessorProfiles[] =
-{
-    {  400,  0 },
-    {  600,  5 },
-    {  800, 10 },
-    { 1000, 15 },
-};
-
-struct SettingProfile
-{
-    U16 performance;        // metric range max
-    const char *settings;   // default file
-};
-
-static U8 sNumSettings = 3;
-static SettingProfile sSettingProfiles[] =
-{
-    {  33, "LowProfile.cs" },
-    {  66, "MediumProfile.cs" },
-    { 100, "HighProfile.cs" },
-};
-
-//------------------------------------------------------------------------------
-
-static void clearCardProfiles()
-{
-   while (sCardProfiles.size())
-   {
-      dFree((char *) sCardProfiles.last().vendor);
-      dFree((char *) sCardProfiles.last().renderer);
-
-        dFree((char *) sCardProfiles.last().proFile);
-
-      sCardProfiles.decrement();
-   }
-}
-
-static void clearOSCardProfiles()
-{
-   while (sOSCardProfiles.size())
-   {
-      dFree((char *) sOSCardProfiles.last().vendor);
-      dFree((char *) sOSCardProfiles.last().renderer);
-
-      sOSCardProfiles.decrement();
-   }
-}
-
-static void execScript(const char *scriptFile)
-{
-    // execute the script
-   FileStream str;
-
-   if (!str.open(scriptFile, FileStream::Read))
-      return;
-
-   U32 size = str.getStreamSize();
-   char *script = new char[size + 1];
-
-   str.read(size, script);
-   str.close();
-
-   script[size] = 0;
-   Con::executef(2, "eval", script);
-   delete[] script;
-}
-
-static void profileSystem(const char *vendor, const char *renderer)
-{
-
-   //Con::executef(2, "exec", "scripts/CardProfiles.cs");
-    execScript("CardProfiles.cs");
-
-    const char *arch;
-    OSVERSIONINFO OSVersionInfo;
-    const char *os = NULL;
-    char osProfiles[64];
-
-    if (dStrstr(PlatformSystemInfo.processor.name,"AMD") != NULL)
-        arch = "AMD";
-    else
-        arch = "Intel";
-
-    
-    dMemset( &OSVersionInfo, 0, sizeof( OSVERSIONINFO ) );
-   OSVersionInfo.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
-   if ( GetVersionEx( &OSVersionInfo )	)
-    {
-        if (OSVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
-            if ( OSVersionInfo.dwMinorVersion == 0 )
-            {
-                if (dStrcmp(arch,"Intel") == 0)
-                    os = "W95";
-            }
-            else if ( OSVersionInfo.dwMinorVersion == 10 )	
-                if ( OSVersionInfo.szCSDVersion[1] != 'A' )
-                    os = "W98";
-                else
-                    os = "W98SE";
-            else
-                os = "WME";
-        else
-            if ( OSVersionInfo.dwMajorVersion >= 5 )
-                os = "W2K";
-        
-        if ( os != NULL )
-        {
-            dSprintf(osProfiles,64,"%s%sCardProfiles.cs",arch,os);
-            //Con::executef(2, "exec", osProfiles);
-            execScript(osProfiles);
-        }
-    }
-
-    const char *proFile = NULL;
-   U32 i;
-
-   for (i = 0; i < (U32)sCardProfiles.size(); ++i)
-      if (dStrstr(vendor, sCardProfiles[i].vendor) &&
-          (!dStrcmp(sCardProfiles[i].renderer, "*") ||
-           dStrstr(renderer, sCardProfiles[i].renderer)))
-      {
-         Con::setBoolVariable("$pref::Video::safeModeOn", sCardProfiles[i].safeMode);
-         Con::setBoolVariable("$pref::OpenGL::disableEXTCompiledVertexArray", !sCardProfiles[i].lockArray);
-         Con::setBoolVariable("$pref::OpenGL::disableSubImage", !sCardProfiles[i].subImage);
-         Con::setBoolVariable("$pref::TS::fogTexture", sCardProfiles[i].fogTexture);
-         Con::setBoolVariable("$pref::OpenGL::noEnvColor", sCardProfiles[i].noEnvColor);
-         Con::setBoolVariable("$pref::Video::clipHigh", sCardProfiles[i].clipHigh);
-            if (!sCardProfiles[i].deleteContext)
-            {
-                OSVERSIONINFO OSVersionInfo;
-
-            // HACK: The Voodoo3/5 on W2K crash when deleting a rendering context
-                // So we're not deleting it.
-                // Oh, and the Voodoo3 returns a Banshee renderer string under W2K
-            dMemset( &OSVersionInfo, 0, sizeof( OSVERSIONINFO ) );
-            OSVersionInfo.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
-            if ( GetVersionEx( &OSVersionInfo ) &&
-                      OSVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT &&
-                      OSVersionInfo.dwMajorVersion == 5)
-                    Con::setBoolVariable("$pref::Video::deleteContext", false);
-                else
-                    Con::setBoolVariable("$pref::Video::deleteContext", true);
-            }
-            else
-                Con::setBoolVariable("$pref::Video::deleteContext", true);
-            Con::setBoolVariable("$pref::OpenGL::disableARBTextureCompression", !sCardProfiles[i].texCompress);
-            Con::setBoolVariable("$pref::Interior::lockArrays", sCardProfiles[i].interiorLock);
-            Con::setBoolVariable("$pref::TS::skipFirstFog", sCardProfiles[i].skipFirstFog);
-            Con::setBoolVariable("$pref::Video::only16", sCardProfiles[i].only16);
-            Con::setBoolVariable("$pref::OpenGL::noDrawArraysAlpha", sCardProfiles[i].noArraysAlpha);
-
-            proFile = sCardProfiles[i].proFile;
-
-         break;
-      }
-
-   // defaults
-    U16 glProfile;
-
-   if (!proFile)
-   {
-      // no driver GL profile -- make one via weighting GL extensions
-      glProfile = 25;
-
-      glProfile += gGLState.suppARBMultitexture * 25;
-      glProfile += gGLState.suppLockedArrays * 15;
-      glProfile += gGLState.suppVertexArrayRange * 10;
-      glProfile += gGLState.suppTextureEnvCombine * 5;
-      glProfile += gGLState.suppPackedPixels * 5;
-      glProfile += gGLState.suppTextureCompression * 5;
-      glProfile += gGLState.suppS3TC * 5;
-      glProfile += gGLState.suppFXT1 * 5;
-
-      Con::setBoolVariable("$pref::Video::safeModeOn", true);
-      Con::setBoolVariable("$pref::OpenGL::disableEXTCompiledVertexArray", false);
-      Con::setBoolVariable("$pref::OpenGL::disableSubImage", false);
-      Con::setBoolVariable("$pref::TS::fogTexture", false);
-      Con::setBoolVariable("$pref::OpenGL::noEnvColor", false);
-      Con::setBoolVariable("$pref::Video::clipHigh", false);
-        Con::setBoolVariable("$pref::Video::deleteContext", true);
-        Con::setBoolVariable("$pref::OpenGL::disableARBTextureCompression", false);
-        Con::setBoolVariable("$pref::Interior::lockArrays", true);
-        Con::setBoolVariable("$pref::TS::skipFirstFog", false);
-        Con::setBoolVariable("$pref::Video::only16", false);
-        Con::setBoolVariable("$pref::OpenGL::noDrawArraysAlpha", false);
-   }
-
-    Con::setVariable("$pref::Video::profiledVendor", vendor);
-   Con::setVariable("$pref::Video::profiledRenderer", renderer);
-
-    if (!Con::getBoolVariable("$DisableSystemProfiling") &&
-         ( dStrcmp(vendor, Con::getVariable("$pref::Video::defaultsVendor")) ||
-        dStrcmp(renderer, Con::getVariable("$pref::Video::defaultsRenderer")) ))
-    {
-        if (proFile)
-        {
-            char settings[64];
-
-            dSprintf(settings,64,"%s.cs",proFile);
-            //Con::executef(2, "exec", settings);
-            execScript(settings);
-        }
-        else
-        {
-        U16 adjust;
-
-        // match clock with profile
-        for (i = 0; i < sNumProcessors; ++i)
-        {
-            adjust = sProcessorProfiles[i].adjust;
-
-            if (PlatformSystemInfo.processor.mhz < sProcessorProfiles[i].clock) break;
-        }
-
-        const char *settings;
-
-        // match performance metric with profile
-        for (i = 0; i < sNumSettings; ++i)
-        {
-            settings = sSettingProfiles[i].settings;
-
-            if (glProfile+adjust <= sSettingProfiles[i].performance) break;
-        }
-
-        //Con::executef(2, "exec", settings);
-            execScript(settings);
-        }
-
-        bool match = false;
-
-        for (i = 0; i < (U32)sOSCardProfiles.size(); ++i)
-            if (dStrstr(vendor, sOSCardProfiles[i].vendor) &&
-                 (!dStrcmp(sOSCardProfiles[i].renderer, "*") ||
-              dStrstr(renderer, sOSCardProfiles[i].renderer)))
-            {
-                Con::setBoolVariable("$pref::Video::allowOpenGL", sOSCardProfiles[i].allowOpenGL);
-                Con::setBoolVariable("$pref::Video::preferOpenGL", sOSCardProfiles[i].preferOpenGL);
-            
-                match = true;
-
-                break;
-            }
-
-        if (!match)
-        {
-            Con::setBoolVariable("$pref::Video::allowOpenGL", true);
-            Con::setBoolVariable("$pref::Video::preferOpenGL", true);
-        }
-
-        Con::setVariable("$pref::Video::defaultsVendor", vendor);
-    Con::setVariable("$pref::Video::defaultsRenderer", renderer);
-    }
-
-   clearCardProfiles();
-    clearOSCardProfiles();
-}
-
 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------
 OpenGLDevice::OpenGLDevice()
 OpenGLDevice::OpenGLDevice()
 {
 {
@@ -413,41 +109,6 @@ bool OpenGLDevice::activate( U32 width, U32 height, U32 bpp, bool fullScreen )
 
 
    GL_Init( "opengl32", "glu32" );
    GL_Init( "opengl32", "glu32" );
 
 
-    static bool onceAlready = false;
-    bool profiled = false;
-
-    if ( !mFullScreenOnly && fullScreen && !onceAlready )
-    {	
-        OSVERSIONINFO OSVersionInfo;
-
-        // HACK: The Voodoo5 on W2K will only work if the initial rendering
-        // context is windowed.  Can you believe this crap?
-        dMemset( &OSVersionInfo, 0, sizeof( OSVERSIONINFO ) );
-        OSVersionInfo.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
-        if ( GetVersionEx( &OSVersionInfo ) &&
-              OSVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT &&
-              OSVersionInfo.dwMajorVersion == 5 )
-
-              //MIN_RESOLUTION defined in platformWin32/platformGL.h
-            if ( !setScreenMode(	MIN_RESOLUTION_X, MIN_RESOLUTION_Y, bpp, false, true, false ) )
-                return false;
-            else
-            {
-                const char* vendorString   = (const char*) glGetString( GL_VENDOR );
-                const char* rendererString = (const char*) glGetString( GL_RENDERER );
-
-                // only do this for the first session
-                if (!Con::getBoolVariable("$DisableSystemProfiling") &&
-                     ( dStrcmp(vendorString, Con::getVariable("$pref::Video::profiledVendor")) ||
-                    dStrcmp(rendererString, Con::getVariable("$pref::Video::profiledRenderer")) ))
-                {
-                profileSystem(vendorString, rendererString);
-                    profiled = true;
-                }
-            }
-
-        onceAlready = true;
-    }
     // Set the resolution:
     // Set the resolution:
    if ( !setScreenMode( width, height, bpp, ( fullScreen || mFullScreenOnly ), true, false ) )
    if ( !setScreenMode( width, height, bpp, ( fullScreen || mFullScreenOnly ), true, false ) )
       return false;
       return false;
@@ -478,44 +139,9 @@ bool OpenGLDevice::activate( U32 width, U32 height, U32 bpp, bool fullScreen )
 
 
    Con::setVariable( "$pref::Video::displayDevice", mDeviceName );
    Con::setVariable( "$pref::Video::displayDevice", mDeviceName );
 
 
-   // only do this for the first session
-   if (!profiled &&
-     !Con::getBoolVariable("$DisableSystemProfiling") &&
-     (	dStrcmp(vendorString, Con::getVariable("$pref::Video::profiledVendor")) ||
-        dStrcmp(rendererString, Con::getVariable("$pref::Video::profiledRenderer")) ))
-   {
-      profileSystem(vendorString, rendererString);
-        profiled = true;
-    }
-
-    if (profiled)
-    {
-      U32 width, height, bpp;
-
-        if (Con::getBoolVariable("$pref::Video::clipHigh", false))
-            for (S32 i = mResolutionList.size()-1; i >= 0; --i)
-                if (mResolutionList[i].w > 1152 || mResolutionList[i].h > 864)
-                    mResolutionList.erase(i);
-
-        if (Con::getBoolVariable("$pref::Video::only16", false))
-            for (S32 i = mResolutionList.size()-1; i >= 0; --i)
-                if (mResolutionList[i].bpp == 32)
-                    mResolutionList.erase(i);
-
-        bool bPrefFullScreen = Con::getBoolVariable("$pref::Video::fullScreen", true);
-      
-      if( bPrefFullScreen || fullScreen )
-         dSscanf(Con::getVariable("$pref::Video::resolution"), "%d %d %d", &width, &height, &bpp);
-      else
-         dSscanf(Con::getVariable("$pref::Video::windowedRes"), "%d %d %d", &width, &height, &bpp);
-      setScreenMode(width, height, bpp,
-                    bPrefFullScreen || fullScreen, false, false);
-   }
-
    // Do this here because we now know about the extensions:
    // Do this here because we now know about the extensions:
    if ( gGLState.suppSwapInterval )
    if ( gGLState.suppSwapInterval )
       setVerticalSync( !Con::getBoolVariable( "$pref::Video::disableVerticalSync" ) );
       setVerticalSync( !Con::getBoolVariable( "$pref::Video::disableVerticalSync" ) );
-    Con::setBoolVariable("$pref::OpenGL::allowTexGen", true);
 
 
    return true;
    return true;
 }
 }

BIN
engine/source/platformWin32/winOGLVideo_ScriptBinding.h