[Scummvm-cvs-logs] SF.net SVN: scummvm:[53173] scummvm/trunk/engines/sword25
sev at users.sourceforge.net
sev at users.sourceforge.net
Tue Oct 12 23:39:16 CEST 2010
Revision: 53173
http://scummvm.svn.sourceforge.net/scummvm/?rev=53173&view=rev
Author: sev
Date: 2010-10-12 21:39:16 +0000 (Tue, 12 Oct 2010)
Log Message:
-----------
SWORD25: Removed cpuinfo.cpp file
Modified Paths:
--------------
scummvm/trunk/engines/sword25/kernel/kernel.cpp
scummvm/trunk/engines/sword25/module.mk
Removed Paths:
-------------
scummvm/trunk/engines/sword25/kernel/cpuinfo.cpp
scummvm/trunk/engines/sword25/kernel/cpuinfo.h
Deleted: scummvm/trunk/engines/sword25/kernel/cpuinfo.cpp
===================================================================
--- scummvm/trunk/engines/sword25/kernel/cpuinfo.cpp 2010-10-12 21:38:54 UTC (rev 53172)
+++ scummvm/trunk/engines/sword25/kernel/cpuinfo.cpp 2010-10-12 21:39:16 UTC (rev 53173)
@@ -1,260 +0,0 @@
-// -----------------------------------------------------------------------------
-// This file is part of Broken Sword 2.5
-// Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsd\xF6rfer
-//
-// Broken Sword 2.5 is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// Broken Sword 2.5 is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Broken Sword 2.5; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-// -----------------------------------------------------------------------------
-
-#define BS_LOG_PREFIX "CPUINFO"
-
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include "cpuinfo.h"
-
-// -----------------------------------------------------------------------------
-// Konstanten
-// -----------------------------------------------------------------------------
-
-// Standard CPU-Features
-static const unsigned int MMX_BITMASK = 1 << 23;
-static const unsigned int SSE_BITMASK = 1 << 25;
-static const unsigned int SSE2_BITMASK = 1 << 26;
-
-// Erweiterte CPU-Features
-static const unsigned int _3DNOW_BITMASK = 1 << 30;
-static const unsigned int _3DNOWEXT_BITMASK = 1 << 31;
-
-// -----------------------------------------------------------------------------
-// Konstruktion
-// -----------------------------------------------------------------------------
-
-BS_CPUInfo::BS_CPUInfo() :
- _VendorID(V_UNKNOWN),
- _VendorString("unknown"),
- _CPUName("unknown"),
- _MMXSupported(false),
- _SSESupported(false),
- _SSE2Supported(false),
- _3DNowSupported(false),
- _3DNowExtSupported(false)
-{
- if (!_IsCPUIDSupported())
- {
- BS_LOG_ERRORLN("CPUID instruction ist not supported. Could not gather processor information.");
- return;
- }
-
- if (!_ReadVendor())
- {
- BS_LOG_WARNINGLN("Unrecognized CPU vendor.");
- }
-
- if (!_ReadCPUName())
- {
- BS_LOG_WARNINGLN("Could not determine CPU name.");
- }
-
- if (!_ReadCPUFeatures())
- {
- BS_LOG_WARNINGLN("Could not determine CPU-features.");
- }
-}
-
-// -----------------------------------------------------------------------------
-
-bool BS_CPUInfo::_IsCPUIDSupported() const
-{
- __try
- {
- __asm
- {
- mov eax, 0
- cpuid
- }
- }
- __except (EXCEPTION_EXECUTE_HANDLER)
- {
- return false;
- }
-
- return true;
-}
-
-// -----------------------------------------------------------------------------
-
-bool BS_CPUInfo::_ReadVendor()
-{
- static struct
- {
- char* VendorString;
- BS_CPUInfo::VENDORID ID;
- } VENDOR_TABLE[] =
- {
- "GenuineIntel", V_INTEL,
- "AuthenticAMD", V_AMD,
- "CyrixInstead", V_CYRIX,
- "CentaurHauls", V_CENTAUR,
- "NexGenDriven", V_NEXGEN,
- "GenuineTMx86", V_TRANSMETA,
- "RiseRiseRise", V_RISE,
- "UMC UMC UMC", V_UMC,
- "SiS SiS SiS", V_SIS,
- "Geode by NSC", V_NSC,
- 0, V_UNKNOWN,
- };
-
- // Vendor-String bestimmen
- char Buffer[13];
- __asm
- {
- xor eax, eax
- cpuid
- mov dword ptr [Buffer], ebx
- mov dword ptr [Buffer + 4], edx
- mov dword ptr [Buffer + 8], ecx
- mov byte ptr [Buffer + 12], 0
- }
- _VendorString = Buffer;
-
- // Vendor-ID bestimmen
- int i;
- for (i = 0; VENDOR_TABLE[i].VendorString; i++) if (_VendorString == VENDOR_TABLE[i].VendorString) break;
- _VendorID = VENDOR_TABLE[i].ID;
-
- return _VendorID != V_UNKNOWN;
-}
-
-// -----------------------------------------------------------------------------
-
-bool BS_CPUInfo::_ReadCPUName()
-{
- // Feststellen, ob das CPU-Name Feature vorhanden ist.
- unsigned int Result;
- __asm
- {
- mov eax, 0x80000000
- cpuid
- mov Result, eax
- }
- if (Result < 0x80000004) return false;
-
- // CPU-Namen einlesen
- char Buffer[49];
- __asm
- {
- mov eax,0x80000002
- cpuid
- mov dword ptr [Buffer + 0], eax
- mov dword ptr [Buffer + 4], ebx
- mov dword ptr [Buffer + 8], ecx
- mov dword ptr [Buffer + 12], edx
- mov eax,0x80000003
- cpuid
- mov dword ptr [Buffer + 16], eax
- mov dword ptr [Buffer + 20], ebx
- mov dword ptr [Buffer + 24], ecx
- mov dword ptr [Buffer + 28], edx
- mov eax,0x80000004
- cpuid
- mov dword ptr [Buffer + 32], eax
- mov dword ptr [Buffer + 36], ebx
- mov dword ptr [Buffer + 40], ecx
- mov dword ptr [Buffer + 44], edx
- mov byte ptr [Buffer + 48], 0
- }
- std::string TempCPUName = Buffer;
- if (TempCPUName.size() != 0)
- {
- // F\xFChrende und nachfolgende Leerzeichen entfernen
- std::string::const_iterator StringBegin = TempCPUName.begin();
- for (; StringBegin != TempCPUName.end() && *StringBegin == ' '; StringBegin++);
- std::string::const_iterator StringEnd = TempCPUName.end() - 1;
- for(; StringEnd >= TempCPUName.begin() && *StringEnd == ' '; StringEnd--);
-
- if (StringBegin != TempCPUName.end() && StringEnd >= TempCPUName.begin())
- {
- _CPUName = std::string(StringBegin, StringEnd + 1);
- return true;
- }
- }
-
- return false;
-}
-
-// -----------------------------------------------------------------------------
-
-bool BS_CPUInfo::_ReadCPUFeatures()
-{
- {
- // Feststellen ob die Standard-Features abgefragt werden k\xF6nnen
- unsigned int Result;
- __asm
- {
- xor eax, eax
- cpuid
- mov Result, eax
- }
-
- // Nicht einmal die Standard-Features k\xF6nnen abgefragt werden, also muss abgebrochen werden
- if (Result < 1) return false;
-
- // Standard-Features abfragen
- unsigned int Features;
- __asm
- {
- mov eax, 1
- cpuid
- mov Features, edx
- }
-
- _MMXSupported = (Features & MMX_BITMASK) != 0;
- _SSESupported = (Features & SSE_BITMASK) != 0;
- _SSE2Supported = (Features & SSE2_BITMASK) != 0;
- }
-
-
- // Feststellen ob erweiterte CPU-Features abgefragt werden k\xF6nnen
- {
- unsigned int Result;
- __asm
- {
- mov eax, 0x80000000
- cpuid
- mov Result, eax
- }
-
- // Die erweiterten Features k\xF6nnen nicht abgefragt werden, aber die Standard-Features wurden schon
- // abgefragt, daher wird true zur\xFCckgegeben.
- if (Result < 0x80000001) return true;
-
- // Erweiterte Features abfragen
- unsigned int Features;
- __asm
- {
- mov eax, 0x80000001
- cpuid
- mov Features, edx
- }
-
- _3DNowSupported = (Features & _3DNOW_BITMASK) != 0;
- _3DNowExtSupported = (Features & _3DNOWEXT_BITMASK) != 0;
- }
-
- return true;
-}
Deleted: scummvm/trunk/engines/sword25/kernel/cpuinfo.h
===================================================================
--- scummvm/trunk/engines/sword25/kernel/cpuinfo.h 2010-10-12 21:38:54 UTC (rev 53172)
+++ scummvm/trunk/engines/sword25/kernel/cpuinfo.h 2010-10-12 21:39:16 UTC (rev 53173)
@@ -1,128 +0,0 @@
-// -----------------------------------------------------------------------------
-// This file is part of Broken Sword 2.5
-// Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsd\xF6rfer
-//
-// Broken Sword 2.5 is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// Broken Sword 2.5 is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Broken Sword 2.5; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-// -----------------------------------------------------------------------------
-
-#ifndef BS_CPUINFO_H
-#define BS_CPUINFO_H
-
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
-#include "common.h"
-
-// -----------------------------------------------------------------------------
-// Klassendefinition
-// -----------------------------------------------------------------------------
-
-/**
- @brief Diese Singleton-Klasse stellt Informationen \xFCber die CPU zur verf\xFCgung.
-*/
-
-class BS_CPUInfo
-{
-public:
- /**
- @brief Definiert die Vendor-IDs
- */
- enum VENDORID
- {
- V_UNKNOWN,
- V_INTEL,
- V_AMD,
- V_CYRIX,
- V_CENTAUR,
- V_NEXGEN,
- V_TRANSMETA,
- V_RISE,
- V_UMC,
- V_SIS,
- V_NSC,
- };
-
- /**
- @brief Gibt eine Referenz auf die einzige Instanz dieser Klasse zur\xFCck.
- */
- static const BS_CPUInfo & GetInstance()
- {
- static BS_CPUInfo Instance;
- return Instance;
- }
-
- /**
- @brief Gibt die Vendor-ID des CPU-Herstellers zur\xFCck.
- @remark Gibt BS_CPUInfo::V_UNKNOWN zur\xFCck, wenn die Vendor-ID nicht bestimmt werden konnte.
- */
- VENDORID GetVendorID() const { return _VendorID; }
-
- /**
- @brief Gibt den Vendor-String zur\xFCck.
- @remark Gibt "unknown" zur\xFCck, wenn der Vendor-String nicht bestimmt werden konnte.
- */
- const std::string & GetVendorString() const { return _VendorString; }
-
- /**
- @brief Gibt den CPU-Namen zur\xFCck.
- @remark Gibt "unknown" zur\xFCck, wenn der CPU-Name nicht bestimmt werden konnte.
- */
- const std::string & GetCPUName() const { return _CPUName; }
-
- /**
- @brief Gibt zur\xFCck, ob der Prozessor MMX unters\xFCtzt.
- */
- bool IsMMXSupported() const { return _MMXSupported; }
-
- /**
- @brief Gibt zur\xFCck, ob der Prozessor SSE unterst\xFCtzt.
- */
- bool IsSSESupported() const { return _SSESupported; }
-
- /**
- @brief Gibt zur\xFCck, ob der Prozessor SSE2 unterst\xFCtzt.
- */
- bool IsSSE2Supported() const { return _SSE2Supported; }
-
- /**
- @brief Gibt zur\xFCck, ob der Prozessor 3DNow! unterst\xFCtzt.
- */
- bool Is3DNowSupported() const { return _3DNowSupported; }
-
- /**
- @brief Gibt zur\xFCck, ob der Prozessor 3DNow!-Ext. unterst\xFCtzt.
- */
- bool Is3DNowExtSupported() const { return _3DNowExtSupported; }
-
-private:
- BS_CPUInfo();
-
- VENDORID _VendorID;
- std::string _VendorString;
- std::string _CPUName;
- bool _MMXSupported;
- bool _SSESupported;
- bool _SSE2Supported;
- bool _3DNowSupported;
- bool _3DNowExtSupported;
-
- bool _ReadVendor();
- bool _ReadCPUFeatures();
- bool _ReadCPUName();
- bool _IsCPUIDSupported() const;
-};
-
-#endif
Modified: scummvm/trunk/engines/sword25/kernel/kernel.cpp
===================================================================
--- scummvm/trunk/engines/sword25/kernel/kernel.cpp 2010-10-12 21:38:54 UTC (rev 53172)
+++ scummvm/trunk/engines/sword25/kernel/kernel.cpp 2010-10-12 21:39:16 UTC (rev 53173)
@@ -37,7 +37,6 @@
#include "script/script.h"
#include "fmv/movieplayer.h"
#include "persistenceservice.h"
-#include "cpuinfo.h"
#define BS_LOG_PREFIX "KERNEL"
@@ -55,23 +54,6 @@
// Messagebox ausgeben wenn nicht gelogged werden kann -> log.txt schreibgesch\xFCtzt
BS_LOGLN("created.");
- // CPU-Daten in die Log-Datei schreiben
- const BS_CPUInfo & CI = BS_CPUInfo::GetInstance();
- BS_LOGLN("CPU detected (vendor name: \"%s\", CPU name: \"%s\").", CI.GetVendorString().c_str(), CI.GetCPUName().c_str());
- BS_LOGLN("CPU features: %s%s%s%s%s.",
- CI.IsMMXSupported() ? "MMX" : "",
- CI.IsSSESupported() ? " SSE" : "",
- CI.IsSSE2Supported() ? " SSE2" : "",
- CI.Is3DNowSupported() ? " 3DNow!" : "",
- CI.Is3DNowExtSupported() ? " 3DNow!Ext" : "");
-
- // Sicherstellen, dass der Prozessor \xFCber MMX verf\xFCgt
- if (!CI.IsMMXSupported())
- {
- BS_LOG_ERRORLN("MMX support needed.");
- return;
- }
-
// Feststellen, ob der Timer unterst\xFCtzt wird.
if (!BS_Timer::IsTimerAvaliable())
{
Modified: scummvm/trunk/engines/sword25/module.mk
===================================================================
--- scummvm/trunk/engines/sword25/module.mk 2010-10-12 21:38:54 UTC (rev 53172)
+++ scummvm/trunk/engines/sword25/module.mk 2010-10-12 21:39:16 UTC (rev 53173)
@@ -46,7 +46,6 @@
input/inputengine_script.o \
input/stdwininput.o \
kernel/callbackregistry.o \
- kernel/cpuinfo.o \
kernel/debug/debugtools.o \
kernel/debug/memorydumper.o \
kernel/filesystemutil_win32.o \
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list