OSDN Git Service

Added CLI parameters to overwrite the CPU feature flags. Useful for testing.
authorlordmulder <mulder2@gmx.de>
Mon, 19 Sep 2011 22:03:51 +0000 (00:03 +0200)
committerlordmulder <mulder2@gmx.de>
Mon, 19 Sep 2011 22:03:51 +0000 (00:03 +0200)
etc/Translation/Blank.ts
src/Config.h
src/Global.cpp
src/Global.h
src/Main.cpp

index f7c2a2f..23fbb56 100644 (file)
 <context>
     <name>QApplication</name>
     <message>
-        <location filename="../../src/Global.cpp" line="671"/>
+        <location filename="../../src/Global.cpp" line="681"/>
         <source>Executable &apos;%1&apos; doesn&apos;t support Windows compatibility mode.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/Global.cpp" line="758"/>
+        <location filename="../../src/Global.cpp" line="768"/>
         <source>Executable &apos;%1&apos; requires Qt v%2, but found Qt v%3.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/Global.cpp" line="767"/>
+        <location filename="../../src/Global.cpp" line="777"/>
         <source>Executable &apos;%1&apos; requires Windows 2000 or later.</source>
         <translation type="unfinished"></translation>
     </message>
index 25d35f9..6e10acc 100644 (file)
@@ -30,7 +30,7 @@
 #define VER_LAMEXP_MINOR_LO                                    3
 #define VER_LAMEXP_TYPE                                                Beta
 #define VER_LAMEXP_PATCH                                       2
-#define VER_LAMEXP_BUILD                                       690
+#define VER_LAMEXP_BUILD                                       692
 
 ///////////////////////////////////////////////////////////////////////////////
 // Tools versions
index 2566dcc..d7ef932 100644 (file)
@@ -516,7 +516,7 @@ void lamexp_init_console(int argc, char* argv[])
 /*
  * Detect CPU features
  */
-lamexp_cpu_t lamexp_detect_cpu_features(void)
+lamexp_cpu_t lamexp_detect_cpu_features(int argc, char **argv)
 {
        typedef BOOL (WINAPI *IsWow64ProcessFun)(__in HANDLE hProcess, __out PBOOL Wow64Process);
        typedef VOID (WINAPI *GetNativeSystemInfoFun)(__out LPSYSTEM_INFO lpSystemInfo);
@@ -611,6 +611,16 @@ lamexp_cpu_t lamexp_detect_cpu_features(void)
        features.x64 = true;
 #endif
 
+       if(argv)
+       {
+               for(int i = 0; i < argc; i++)
+               {
+                       if(!_stricmp("--force-cpu-no-64bit", argv[i])) features.x64 = false;
+                       if(!_stricmp("--force-cpu-no-sse", argv[i])) features.sse = features.sse2 = features.sse3 = features.ssse3 = false;
+                       if(!_stricmp("--force-cpu-no-intel", argv[i])) features.intel = false;
+               }
+       }
+
        return features;
 }
 
index 5137a4b..e61b434 100644 (file)
@@ -100,7 +100,7 @@ QString lamexp_rand_str(void);
 const QString &lamexp_temp_folder2(void);
 void lamexp_ipc_read(unsigned int *command, char* message, size_t buffSize);
 void lamexp_ipc_send(unsigned int command, const char* message);
-lamexp_cpu_t lamexp_detect_cpu_features(void);
+lamexp_cpu_t lamexp_detect_cpu_features(int argc = 0, char **argv = NULL);
 bool lamexp_portable_mode(void);
 bool lamexp_shutdown_computer(const QString &message, const unsigned long timeout = 30, const bool forceShutdown = true);
 
index 3bfacda..a8f11fe 100644 (file)
@@ -71,8 +71,8 @@ static int lamexp_main(int argc, char* argv[])
        }
        
        //Detect CPU capabilities
-       lamexp_cpu_t cpuFeatures = lamexp_detect_cpu_features();
-       qDebug("   CPU vendor id  :  %s (Intel: %d)", cpuFeatures.vendor, (cpuFeatures.intel ? 1 : 0));
+       lamexp_cpu_t cpuFeatures = lamexp_detect_cpu_features(argc, argv);
+       qDebug("   CPU vendor id  :  %s (Intel: %s)", cpuFeatures.vendor, LAMEXP_BOOL(cpuFeatures.intel));
        qDebug("CPU brand string  :  %s", cpuFeatures.brand);
        qDebug("   CPU signature  :  Family: %d, Model: %d, Stepping: %d", cpuFeatures.family, cpuFeatures.model, cpuFeatures.stepping);
        qDebug("CPU capabilities  :  MMX: %s, SSE: %s, SSE2: %s, SSE3: %s, SSSE3: %s, x64: %s", LAMEXP_BOOL(cpuFeatures.mmx), LAMEXP_BOOL(cpuFeatures.sse), LAMEXP_BOOL(cpuFeatures.sse2), LAMEXP_BOOL(cpuFeatures.sse3), LAMEXP_BOOL(cpuFeatures.ssse3), LAMEXP_BOOL(cpuFeatures.x64));