summaryrefslogtreecommitdiffhomepage
path: root/StarsEx
diff options
context:
space:
mode:
Diffstat (limited to 'StarsEx')
-rw-r--r--StarsEx/CMakeLists.txt2
-rw-r--r--StarsEx/GameWinDX9.cpp5
-rw-r--r--StarsEx/Joystick.cpp8
-rw-r--r--StarsEx/MachineInfo.cpp823
-rw-r--r--StarsEx/MachineInfo.h41
-rw-r--r--StarsEx/NetLobbyServer.cpp6
6 files changed, 13 insertions, 872 deletions
diff --git a/StarsEx/CMakeLists.txt b/StarsEx/CMakeLists.txt
index 1bacde7..99ccabe 100644
--- a/StarsEx/CMakeLists.txt
+++ b/StarsEx/CMakeLists.txt
@@ -123,7 +123,6 @@ add_library(
LoadScreen.cpp
Locale_ss.cpp
MCIWave.cpp
- MachineInfo.cpp
MapView.cpp
Menu.cpp
MenuDlg.cpp
@@ -284,6 +283,7 @@ target_link_libraries(
PUBLIC Png::png
PUBLIC Opcode
PRIVATE Sha1
+ PRIVATE InfoEx
)
target_compile_definitions(
StarsEx
diff --git a/StarsEx/GameWinDX9.cpp b/StarsEx/GameWinDX9.cpp
index bbf61c3..9f5595d 100644
--- a/StarsEx/GameWinDX9.cpp
+++ b/StarsEx/GameWinDX9.cpp
@@ -9,12 +9,13 @@
#include <stdio.h>
#include <string.h>
+#include <InfoEx.h>
+
#include "Bitmap.h"
#include "Clock.h"
#include "Color.h"
#include "DataLoader.h"
#include "Game.h"
-#include "MachineInfo.h"
#include "Panic.h"
#include "Screen.h"
#include "Types.h"
@@ -88,7 +89,7 @@ GameWinDX9::Init(HINSTANCE hi, HINSTANCE hpi, LPSTR cmdline, int nCmdShow)
status = INIT_FAILED;
}
- if (status == OK && MachineInfo::GetDirectXVersion() < MachineInfo::DX_9) {
+ if (status == OK && InfoEx::DirectX() < InfoEx::DXVersion::Dx9) {
Panic::Panic(" Insufficient DirectX detected (Dx9 IS REQUIRED)");
status = INIT_FAILED;
}
diff --git a/StarsEx/Joystick.cpp b/StarsEx/Joystick.cpp
index 8679c10..b4166a1 100644
--- a/StarsEx/Joystick.cpp
+++ b/StarsEx/Joystick.cpp
@@ -11,9 +11,11 @@
Joystick Input class
*/
-#include "GameWinDX9.h"
#include "Joystick.h"
-#include "MachineInfo.h"
+
+#include <InfoEx.h>
+
+#include "GameWinDX9.h"
#include "Types.h"
#define DIRECTINPUT_VERSION 0x0800
@@ -79,7 +81,7 @@ Joystick::Joystick()
inv_axis[2] = false;
inv_axis[3] = false;
- if (MachineInfo::GetDirectXVersion() < MachineInfo::DX_7) {
+ if (InfoEx::DirectX() < InfoEx::DXVersion::Dx7) {
Print("Joystick: DI7 not found, using multimedia library\n");
pdi = 0;
pdev = 0;
diff --git a/StarsEx/MachineInfo.cpp b/StarsEx/MachineInfo.cpp
deleted file mode 100644
index 64552ba..0000000
--- a/StarsEx/MachineInfo.cpp
+++ /dev/null
@@ -1,823 +0,0 @@
-/* Starshatter: The Open Source Project
- Copyright (c) 2021-2022, Starshatter: The Open Source Project Contributors
- Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors
- Copyright (c) 1997-2006, Destroyer Studios LLC.
-
- AUTHOR: John DiCamillo
-
-
- OVERVIEW
- ========
- Collect and Display Machine, OS, and Driver Information
-*/
-
-#include <chrono>
-
-#include "MachineInfo.h"
-#include "Utils.h"
-
-#define DIRECTINPUT_VERSION 0x0700
-
-#include <stdio.h>
-#include <ddraw.h>
-#include <d3d9.h>
-#include <dinput.h>
-#include <winver.h>
-
-// +--------------------------------------------------------------------+
-
-static int cpu_class=-1;
-static int cpu_speed=-1;
-static int platform=-1;
-static int dx_version=-1;
-static int total_ram=-1;
-
-static OSVERSIONINFO os_ver = { sizeof(OSVERSIONINFO) };
-static SYSTEM_INFO cpu_info;
-static MEMORYSTATUS mem_info = { sizeof(MEMORYSTATUS) };
-
-// +--------------------------------------------------------------------+
-
-const char*
-MachineInfo::GetShortDescription()
-{
- static char desc[256];
-
- static const char* cpu_names[] = {
- "8088",
- "8086",
- "80286",
- "80386",
- "80486",
- "Pentium",
- "Pentium II",
- "Pentium 3",
- "Pentium 4"
- };
-
- static const char* os_names[] = {
- "DOS",
- "Windows 95",
- "Windows 98",
- "Windows NT",
- "Windows 2000",
- "Windows XP",
- "Windows XP x64",
- "Windows Vista",
- "Windows Seven",
- "Future Windows"
- };
-
- int cpu_index = GetCpuClass();
- if (cpu_index < 0) cpu_index = 0;
- else if (cpu_index > 8) cpu_index = 8;
-
- int os_index = GetPlatform();
- if (os_index < 0) os_index = 0;
-
- sprintf_s(desc, "%s %d MHz %d MB RAM %s",
- cpu_names[cpu_index],
- GetCpuSpeed(),
- GetTotalRam(),
- os_names[os_index]);
-
- return desc;
-}
-
-// +--------------------------------------------------------------------+
-
-static void DescribeCpuMake();
-static void DescribeOwner95();
-static void DescribeOwnerNT();
-static void DescribeDrivers95(const char* sType);
-static void DescribeDriversNT(const char* sType);
-static void DescribeDriverVersion(const char* file);
-static void DescribeDXVersion(const char* component);
-
-// wait for at least target_time,
-// return the exact amount of time actually waited:
-
-static double SpinWait(double target_time)
-{
- double actual_time = 0;
-
- LARGE_INTEGER ifreq;
- LARGE_INTEGER cnt1;
- LARGE_INTEGER cnt2;
-
- QueryPerformanceFrequency(&ifreq);
- double freq = (double) ifreq.QuadPart;
-
- QueryPerformanceCounter(&cnt1);
-
- do {
- QueryPerformanceCounter(&cnt2);
-
- double delta = (double) (cnt2.QuadPart - cnt1.QuadPart);
- actual_time = delta / freq;
- }
- while (actual_time < target_time);
-
- return actual_time;
-}
-
-static double CalcCpuSpeed()
-{
- const auto before = std::chrono::high_resolution_clock::now();
-
- double seconds = SpinWait(0.1);
-
- const auto after = std::chrono::high_resolution_clock::now();
- const std::chrono::duration<double> diff = after - before;
- double clocks = diff.count();
-
- return (clocks/seconds);
-}
-
-/****************************************************************************
-*
-* GetDXVersion
-*
-* This function returns
-* 0 Insufficient DirectX installed
-* 9 At least DirectX 9 installed.
-*
-****************************************************************************/
-
-DWORD GetDXVersion()
-{
- HRESULT hr = 0;
- HINSTANCE DDHinst = 0;
- LPDIRECT3D9 d3d9 = 0;
- OSVERSIONINFO osVer = { sizeof(OSVERSIONINFO) };
-
- // First get the windows platform
-
- if (!GetVersionEx(&osVer))
- return 0;
-
- // NT versions do not support DirectX 9
- if (osVer.dwPlatformId == VER_PLATFORM_WIN32_NT) {
- if (osVer.dwMajorVersion <= 4)
- return 0;
- }
-
- DDHinst = LoadLibrary("D3D9.DLL");
- if (DDHinst == 0) {
- return 0;
- }
-
- FreeLibrary(DDHinst);
- return 9;
-}
-
-
-// +--------------------------------------------------------------------+
-
-int
-MachineInfo::GetCpuClass()
-{
- if (cpu_class < 0) {
- GetSystemInfo(&cpu_info);
-
- if (cpu_info.wProcessorArchitecture != PROCESSOR_ARCHITECTURE_INTEL ||
- cpu_info.dwProcessorType < PROCESSOR_INTEL_PENTIUM)
- Print("INCOMPATIBLE CPU TYPE!\n");
-
- if (GetPlatform() < OS_WINNT)
- cpu_class = CPU_P5;
-
- else
- cpu_class = cpu_info.wProcessorLevel;
- }
-
- return cpu_class;
-}
-
-// +--------------------------------------------------------------------+
-
-int
-MachineInfo::GetCpuSpeed()
-{
- if (cpu_speed < 0) {
- cpu_speed = (int) (CalcCpuSpeed() / 1e6);
- }
-
- return cpu_speed;
-}
-
-// +--------------------------------------------------------------------+
-
-int
-MachineInfo::GetTotalRam()
-{
- if (total_ram < 0) {
- GlobalMemoryStatus(&mem_info);
- total_ram = (int) (mem_info.dwTotalPhys/(1024*1024)) + 1;
- }
-
- return total_ram;
-}
-
-// +--------------------------------------------------------------------+
-
-int
-MachineInfo::GetPlatform()
-{
- if (platform < 0) {
- GetVersionEx(&os_ver);
-
- switch (os_ver.dwPlatformId) {
- default:
- case VER_PLATFORM_WIN32s:
- case VER_PLATFORM_WIN32_WINDOWS: {
- char msg[256];
- sprintf_s(msg, "Invalid Operating System Platform: %d\n", os_ver.dwPlatformId); //-V576
- Print(msg);
- }
- break;
-
- case VER_PLATFORM_WIN32_NT:
- if (os_ver.dwMajorVersion == 4)
- platform = OS_WINNT;
- else if (os_ver.dwMajorVersion == 5 && os_ver.dwMinorVersion == 0)
- platform = OS_WIN2K;
- else if (os_ver.dwMajorVersion == 5 && os_ver.dwMinorVersion == 1)
- platform = OS_WINXP;
- else if (os_ver.dwMajorVersion == 5 && os_ver.dwMinorVersion == 2)
- platform = OS_WINXP64;
- else if (os_ver.dwMajorVersion == 6 && os_ver.dwMinorVersion == 0)
- platform = OS_WINVISTA;
- else if (os_ver.dwMajorVersion == 6 && os_ver.dwMinorVersion == 1)
- platform = OS_WINSEVEN;
- else if (os_ver.dwMajorVersion >= 6)
- platform = OS_WINFUTURE;
-
- else {
- platform = OS_INVALID;
-
- Print("Invalid Operating System Platform (NT-series): %d.%d\n", os_ver.dwMajorVersion, os_ver.dwMinorVersion);
- }
-
- break;
- }
- }
-
- return platform;
-}
-
-// +--------------------------------------------------------------------+
-
-int
-MachineInfo::GetDirectXVersion()
-{
- if (dx_version < 0) {
- dx_version = GetDXVersion();
- }
-
- return dx_version;
-}
-
-// +--------------------------------------------------------------------+
-
-void
-MachineInfo::DescribeMachine()
-{
- GetPlatform();
- GetCpuClass();
-
- Print("+====================================================================+\n");
- Print("| |\n");
-
- char txt[256];
-
- switch (platform) {
- case OS_WIN95:
- sprintf_s(txt, "Windows 95 version %d.%d.%d %s", //-V576
- os_ver.dwMajorVersion,
- os_ver.dwMinorVersion,
- LOWORD(os_ver.dwBuildNumber),
- os_ver.szCSDVersion);
- break;
-
- case OS_WIN98:
- sprintf_s(txt, "Windows 98 version %d.%d.%d %s", //-V576
- os_ver.dwMajorVersion,
- os_ver.dwMinorVersion,
- LOWORD(os_ver.dwBuildNumber),
- os_ver.szCSDVersion);
- break;
-
- case OS_WINNT:
- sprintf_s(txt, "Windows NT %d.%d (Build %d) %s", //-V576
- os_ver.dwMajorVersion,
- os_ver.dwMinorVersion,
- os_ver.dwBuildNumber,
- os_ver.szCSDVersion);
- break;
-
- case OS_WIN2K:
- sprintf_s(txt, "Windows 2000 %d.%d (Build %d) %s", //-V576
- os_ver.dwMajorVersion,
- os_ver.dwMinorVersion,
- os_ver.dwBuildNumber,
- os_ver.szCSDVersion);
-
- case OS_WINXP:
- sprintf_s(txt, "Windows XP %d.%d (Build %d) %s", //-V576
- os_ver.dwMajorVersion,
- os_ver.dwMinorVersion,
- os_ver.dwBuildNumber,
- os_ver.szCSDVersion);
- break;
- case OS_WINXP64:
- sprintf_s(txt, "Windows XP x64 %d.%d (Build %d) %s", //-V576
- os_ver.dwMajorVersion,
- os_ver.dwMinorVersion,
- os_ver.dwBuildNumber,
- os_ver.szCSDVersion);
- break;
- case OS_WINVISTA:
- sprintf_s(txt, "Windows Vista %d.%d (Build %d) %s", //-V576
- os_ver.dwMajorVersion,
- os_ver.dwMinorVersion,
- os_ver.dwBuildNumber,
- os_ver.szCSDVersion);
- break;
- case OS_WINSEVEN:
- sprintf_s(txt, "Windows 7 %d.%d (Build %d) %s", //-V576
- os_ver.dwMajorVersion,
- os_ver.dwMinorVersion,
- os_ver.dwBuildNumber,
- os_ver.szCSDVersion);
- break;
- case OS_WINFUTURE:
- sprintf_s(txt, "Windows from the future %d.%d (Build %d) %s", //-V576
- os_ver.dwMajorVersion,
- os_ver.dwMinorVersion,
- os_ver.dwBuildNumber,
- os_ver.szCSDVersion);
- break;
-
- default:
- sprintf_s(txt, "Unknown Operating System Platform");
- break;
- }
-
- Print("| %-66s |\n", txt);
- Print("| |\n");
-
- if (platform == OS_WIN95 || platform == OS_WIN98)
- DescribeOwner95();
- else
- DescribeOwnerNT();
-
- sprintf_s(txt, "CPUs Detected: %d CPU Level: %d.%d.%d CPU Speed: %d", //-V576
- cpu_info.dwNumberOfProcessors,
- cpu_info.wProcessorLevel,
- cpu_info.wProcessorRevision >> 8,
- cpu_info.wProcessorRevision & 0xff,
- GetCpuSpeed() + 1);
-
- Print("| %-66s |\n", txt);
- DescribeCpuMake();
-
- GlobalMemoryStatus(&mem_info);
- total_ram = (int) (mem_info.dwTotalPhys/(1024*1024)) + 1;
- int swap_max = (int) (mem_info.dwTotalPageFile/(1024*1024));
- int swap_avail = (int) (mem_info.dwAvailPageFile/(1024*1024));
-
- sprintf_s(txt, "%d MB RAM %d MB Max Swap %d MB Avail Swap",
- total_ram, swap_max, swap_avail);
-
-
- Print("| %-66s |\n", txt);
-
- Print("| |\n");
- Print("| DirectX %d installed. |\n",
- GetDirectXVersion());
- DescribeDXVersion("DDRAW");
- DescribeDXVersion("D3DIM");
- DescribeDXVersion("DINPUT");
- DescribeDXVersion("DPLAY");
- DescribeDXVersion("DSOUND");
- DescribeDXVersion("DMUSIC");
- DescribeDXVersion("DSHOW");
- Print("| |\n");
-
-
- if (platform == OS_WIN95 || platform == OS_WIN98) {
- DescribeDrivers95("Display");
- DescribeDrivers95("Media");
- DescribeDrivers95("Monitor");
- DescribeDrivers95("Multimedia");
- }
- else {
- DescribeDriversNT("");
- }
-
- Print("+====================================================================+\n");
- Print("\n");
-}
-
-// +--------------------------------------------------------------------+
-
-static void DescribeCpuMake()
-{
- HKEY hkWin;
- char sProcessor[256] = "";
- char sMMXInfo[256] = "";
- char sVendor[256] = "";
- DWORD dwSize;
-
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
- "Hardware\\Description\\System\\CentralProcessor\\0",
- 0,
- KEY_READ,
- &hkWin) == ERROR_SUCCESS) {
-
- dwSize = 256;
- RegQueryValueEx(hkWin,
- "Identifier",
- NULL,
- NULL,
- (LPBYTE) sProcessor,
- &dwSize);
-
- dwSize = 256;
- RegQueryValueEx(hkWin,
- "MMXIdentifier",
- NULL,
- NULL,
- (LPBYTE) sMMXInfo,
- &dwSize);
-
- dwSize = 256;
- RegQueryValueEx(hkWin,
- "VendorIdentifier",
- NULL,
- NULL,
- (LPBYTE) sVendor,
- &dwSize);
-
- RegCloseKey(hkWin);
- }
-
- if (sProcessor[0]) Print("| %-66s |\n", sProcessor);
- if (sMMXInfo[0]) Print("| %-66s |\n", sMMXInfo);
- if (sVendor[0]) Print("| %-66s |\n", sVendor);
-
- if (sProcessor[0] || sMMXInfo[0] || sVendor[0])
- Print("| |\n");
-}
-
-// +--------------------------------------------------------------------+
-
-static void DescribeOwner95()
-{
- HKEY hkWin;
- char sRegisteredOwner[256] = "";
- char sRegisteredOrganization[256] = "";
- DWORD dwSize;
-
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
- "SOFTWARE\\Microsoft\\Windows\\CurrentVersion",
- 0,
- KEY_READ,
- &hkWin) == ERROR_SUCCESS) {
-
- dwSize = 256;
- RegQueryValueEx(hkWin,
- "RegisteredOwner",
- NULL,
- NULL,
- (LPBYTE) sRegisteredOwner,
- &dwSize);
-
- dwSize = 256;
- RegQueryValueEx(hkWin,
- "RegisteredOrganization",
- NULL,
- NULL,
- (LPBYTE) sRegisteredOrganization,
- &dwSize);
-
- RegCloseKey(hkWin);
- }
- else {
- Print("Could not access registered owner\n");
- }
-
- if (sRegisteredOwner[0]) {
- char txt[256];
- sprintf_s(txt, "Registered Owner: %s, %s", sRegisteredOwner, sRegisteredOrganization);
- Print("| %-66s |\n", txt);
- Print("| |\n");
- }
-}
-
-static void DescribeOwnerNT()
-{
- HKEY hkWin;
- char sRegisteredOwner[256] = "";
- char sRegisteredOrganization[256] = "";
- DWORD dwSize;
-
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
- "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
- 0,
- KEY_READ,
- &hkWin) == ERROR_SUCCESS) {
-
- dwSize = 256;
- RegQueryValueEx(hkWin,
- "RegisteredOwner",
- NULL,
- NULL,
- (LPBYTE) sRegisteredOwner,
- &dwSize);
-
- dwSize = 256;
- RegQueryValueEx(hkWin,
- "RegisteredOrganization",
- NULL,
- NULL,
- (LPBYTE) sRegisteredOrganization,
- &dwSize);
-
- RegCloseKey(hkWin);
- }
- else {
- Print("Could not access registered owner\n");
- }
-
- if (sRegisteredOwner[0]) {
- char txt[256];
- sprintf_s(txt, "Registered Owner: %s, %s", sRegisteredOwner, sRegisteredOrganization);
- Print("| %-66s |\n", txt);
- Print("| |\n");
- }
-}
-
-// +--------------------------------------------------------------------+
-
-static void DescribeDrivers95(const char* sType)
-{
- HKEY hkWin, hkSub;
- int nKey = 0;
- char sKey[256];
- char sSub[256];
- char sDriver[256];
- char txt[256];
- DWORD dwSize;
- int worked;
-
- // describe the video driver(s):
- do {
- worked = 0;
-
- sprintf_s(sKey, "System\\CurrentControlSet\\Services\\Class\\%s\\%04X", sType, nKey);
- sprintf_s(sSub, "System\\CurrentControlSet\\Services\\Class\\%s\\%04X\\DEFAULT", sType, nKey);
-
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
- sKey,
- 0,
- KEY_READ,
- &hkWin) == ERROR_SUCCESS) {
-
- dwSize = 256;
- RegQueryValueEx(hkWin,
- "DriverDesc",
- NULL,
- NULL,
- (LPBYTE) sDriver,
- &dwSize);
-
- if (sDriver[0]) {
- sprintf_s(txt, "* %s", sDriver);
- Print("| %-66s |\n", txt);
- worked = 1;
- }
-
- // try to find the driver file name:
- if (worked) {
- ZeroMemory(sDriver, sizeof(sDriver));
-
- dwSize = 256;
- DWORD err = RegQueryValueEx(hkWin, "Driver", NULL, NULL, (LPBYTE) sDriver, &dwSize);
-
- if (err != ERROR_SUCCESS) {
- dwSize = 256;
- err = RegQueryValueEx(hkWin, "DeviceDriver", NULL, NULL, (LPBYTE) sDriver, &dwSize);
- }
-
- if (err != ERROR_SUCCESS) {
- dwSize = 256;
- err = RegQueryValueEx(hkWin, "drv", NULL, NULL, (LPBYTE) sDriver, &dwSize);
- }
-
- if (err != ERROR_SUCCESS) {
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
- sSub,
- 0,
- KEY_READ,
- &hkSub) == ERROR_SUCCESS) {
-
- dwSize = 256;
- err = RegQueryValueEx(hkSub, "drv", NULL, NULL, (LPBYTE) sDriver, &dwSize);
-
- RegCloseKey(hkSub);
- }
- }
-
- // if we found it, try to display version info:
- if (err == ERROR_SUCCESS) {
- DescribeDriverVersion(sDriver);
- }
-
- Print("| |\n");
- }
-
- RegCloseKey(hkWin);
- }
-
- nKey++;
- }
- while (worked);
-}
-
-static void DescribeDriversNT(const char* sType)
-{
- Print("| |\n");
-
- HKEY hkWin;
- char sVideo[256] = "";
- char sDriver[256] = "";
- DWORD dwSize = 0;
-
- // find the pointer to the video driver:
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
- "HARDWARE\\DEVICEMAP\\VIDEO",
- 0,
- KEY_READ,
- &hkWin) == ERROR_SUCCESS) {
-
- dwSize = 256;
- RegQueryValueEx(hkWin,
- "\\Device\\Video0",
- NULL,
- NULL,
- (LPBYTE) sVideo,
- &dwSize);
-
- RegCloseKey(hkWin);
- }
-
- // follow the pointer and get the driver description:
- if (dwSize && sVideo[0]) {
- const char* sLeader = "\\REGISTRY\\Machine\\";
- int nLeader = strlen(sLeader);
-
- if (_strnicmp(sVideo, sLeader, nLeader) == 0) {
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
- sVideo + nLeader,
- 0,
- KEY_READ,
- &hkWin) == ERROR_SUCCESS) {
-
- dwSize = 256;
- RegQueryValueEx(hkWin,
- "Device Description",
- NULL,
- NULL,
- (LPBYTE) sDriver,
- &dwSize);
-
- RegCloseKey(hkWin);
- }
- }
- }
-
- if (sDriver[0]) {
- Print("| %-66s |\n", sDriver);
- Print("| |\n");
- }
-}
-
-// +--------------------------------------------------------------------+
-
-static char sTranslation[16];
-
-static void GetTranslation(const LPBYTE pBlock)
-{
- LPBYTE sData = NULL;
- UINT lenData = 0;
-
- if (VerQueryValue(pBlock, "\\VarFileInfo\\Translation",
- (LPVOID*) &sData, &lenData)) {
-
- if (lenData && sData) {
- sprintf_s(sTranslation, "%02X%02X%02X%02X", sData[1], sData[0], sData[3], sData[2]);
- }
- }
-}
-
-void DisplayVersionString(const LPBYTE pBlock, LPTSTR sSection)
-{
- char txt[256];
- char sFullSection[256];
-
- sprintf_s(sFullSection, "\\StringFileInfo\\%s\\%s", sTranslation, sSection);
-
- LPBYTE sData = NULL;
- UINT lenData = 0;
- DWORD dwErr = 0;
-
- if (VerQueryValue(pBlock, sFullSection, (LPVOID*) &sData, &lenData)) {
- if (lenData && sData) {
- sprintf_s(txt, "%-16s %s", sSection, sData);
- Print("| %-60s |\n", txt);
- }
- }
-}
-
-static void DescribeDriverVersion(const char* file)
-{
- DWORD dwHandle = 0;
- TCHAR szFile[512];
-
- strcpy_s(szFile, file);
-
- int nBytes = GetFileVersionInfoSize(szFile, &dwHandle);
-
- if (nBytes <= 0) {
- char szWinDir[256];
- GetSystemDirectory(szWinDir, 256);
- sprintf_s(szFile, "%s\\%s", szWinDir, file);
-
- nBytes = GetFileVersionInfoSize(szFile, &dwHandle);
-
- if (nBytes <= 0)
- return;
- }
-
- LPBYTE pBlock = new BYTE[nBytes];
-
- if (pBlock && GetFileVersionInfo(szFile, dwHandle, nBytes, (LPVOID) pBlock)) {
- GetTranslation(pBlock);
- DisplayVersionString(pBlock, "CompanyName");
- // DisplayVersionString(pBlock, "FileDescription");
- DisplayVersionString(pBlock, "FileVersion");
- // DisplayVersionString(pBlock, "InternalName");
- // DisplayVersionString(pBlock, "LegalCopyright");
- // DisplayVersionString(pBlock, "OriginalFilename");
- // DisplayVersionString(pBlock, "ProductName");
- // DisplayVersionString(pBlock, "ProductVersion");
- // DisplayVersionString(pBlock, "Comments");
- // DisplayVersionString(pBlock, "LegalTrademarks");
- // DisplayVersionString(pBlock, "PrivateBuild");
- // DisplayVersionString(pBlock, "SpecialBuild");
- }
-
- delete [] pBlock;
-}
-
-static void DescribeDXVersion(const char* component)
-{
- DWORD dwHandle = 0;
- char szFile[512];
- char szWinDir[512];
-
- GetSystemDirectory(szWinDir, 512);
-
- sprintf_s(szFile, "%s\\%s.dll", szWinDir, component);
-
- int nBytes = GetFileVersionInfoSize(szFile, &dwHandle);
-
- if (nBytes <= 0) {
- return;
- }
-
- LPBYTE pBlock = new BYTE[nBytes];
-
- if (pBlock && GetFileVersionInfo(szFile, dwHandle, nBytes, (LPVOID) pBlock)) {
- GetTranslation(pBlock);
-
- char txt[256];
- char sFullSection[256];
- LPBYTE sData = NULL;
- UINT lenData = 0;
- DWORD dwErr = 0;
-
- sprintf_s(sFullSection, "\\StringFileInfo\\%s\\FileVersion", sTranslation);
-
- if (VerQueryValue(pBlock, sFullSection, (LPVOID*) &sData, &lenData)) {
- if (lenData && sData) {
- sprintf_s(txt, "%-8s%s", component, sData);
- Print("| %-64s |\n", txt);
- }
- }
- }
-
- delete [] pBlock;
-} \ No newline at end of file
diff --git a/StarsEx/MachineInfo.h b/StarsEx/MachineInfo.h
deleted file mode 100644
index 01e4bda..0000000
--- a/StarsEx/MachineInfo.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Starshatter: The Open Source Project
- Copyright (c) 2021-2022, Starshatter: The Open Source Project Contributors
- Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors
- Copyright (c) 1997-2006, Destroyer Studios LLC.
-
- AUTHOR: John DiCamillo
-
-
- OVERVIEW
- ========
- Collect and Display Machine, OS, and Driver Information
-*/
-
-#ifndef MachineInfo_h
-#define MachineInfo_h
-
-#include "Types.h"
-
-// +--------------------------------------------------------------------+
-
-class MachineInfo
-{
-public:
- enum { CPU_INVALID, CPU_P5=5, CPU_P6=6, CPU_P7=7, CPU_PLUS };
- enum { OS_INVALID, OS_WIN95, OS_WIN98, OS_WINNT, OS_WIN2K, OS_WINXP, OS_WINXP64, OS_WINVISTA, OS_WINSEVEN, OS_WINFUTURE };
- enum { DX_NONE, DX_3=3, DX_5=5, DX_6=6, DX_7=7, DX_8=8, DX_9=9, DX_PLUS };
-
- static int GetCpuClass();
- static int GetCpuSpeed();
- static int GetTotalRam();
- static int GetPlatform();
- static int GetDirectXVersion();
-
- static void DescribeMachine();
-
- static const char* GetShortDescription();
-};
-
-// +--------------------------------------------------------------------+
-
-#endif // MachineInfo_h \ No newline at end of file
diff --git a/StarsEx/NetLobbyServer.cpp b/StarsEx/NetLobbyServer.cpp
index 371310f..2039fff 100644
--- a/StarsEx/NetLobbyServer.cpp
+++ b/StarsEx/NetLobbyServer.cpp
@@ -12,6 +12,9 @@
*/
#include "NetLobbyServer.h"
+
+#include <InfoEx.h>
+
#include "NetServerConfig.h"
#include "NetClientConfig.h"
#include "NetBrokerClient.h"
@@ -36,7 +39,6 @@
#include "NetHost.h"
#include "NetMsg.h"
-#include "MachineInfo.h"
#include "Clock.h"
#include "FormatUtil.h"
#include "VersionInfo.h"
@@ -838,7 +840,7 @@ NetLobbyServer::DoServerInfo(NetPeer* peer, Text s)
gameport = server_config->GetGamePort();
sprintf_s(buffer, "info \"%s\" version \"%s\" mode %d users %d host %s port %d",
- MachineInfo::GetShortDescription(),
+ InfoEx::ShortDescription().data(),
versionInfo,
GetStatus(),
NumUsers(),