diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index deeb42db7..237e3a23d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -614,7 +614,6 @@ file( GLOB HEADER_FILES common/thirdparty/*.h common/thirdparty/rapidjson/*.h common/thirdparty/math./*h - utility/sfmt/*.h utility/*.h scripting/*.h scripting/backend/*.h diff --git a/src/common/utility/x86.cpp b/src/common/utility/x86.cpp index c03c87efb..983360c09 100644 --- a/src/common/utility/x86.cpp +++ b/src/common/utility/x86.cpp @@ -32,8 +32,8 @@ ** */ -#include "doomtype.h" -#include "doomdef.h" +#include +#include #include "x86.h" CPUInfo CPU; @@ -200,7 +200,7 @@ haveid: #endif } -void DumpCPUInfo(const CPUInfo *cpu) +FString DumpCPUInfo(const CPUInfo *cpu) { char cpustring[4*4*3+1]; @@ -227,34 +227,36 @@ void DumpCPUInfo(const CPUInfo *cpu) } *t = '\0'; - if (cpu->VendorID[0] && !batchrun) + FString out; + if (cpu->VendorID[0]) { - Printf("CPU Vendor ID: %s\n", cpu->VendorID); + out.Format("CPU Vendor ID: %s\n", cpu->VendorID); if (cpustring[0]) { - Printf(" Name: %s\n", cpustring); + out.AppendFormat(" Name: %s\n", cpustring); } if (cpu->bIsAMD) { - Printf(" Family %d (%d), Model %d, Stepping %d\n", + out.AppendFormat(" Family %d (%d), Model %d, Stepping %d\n", cpu->Family, cpu->AMDFamily, cpu->AMDModel, cpu->AMDStepping); } else { - Printf(" Family %d, Model %d, Stepping %d\n", + out.AppendFormat(" Family %d, Model %d, Stepping %d\n", cpu->Family, cpu->Model, cpu->Stepping); } - Printf(" Features:"); - if (cpu->bSSE2) Printf(" SSE2"); - if (cpu->bSSE3) Printf(" SSE3"); - if (cpu->bSSSE3) Printf(" SSSE3"); - if (cpu->bSSE41) Printf(" SSE4.1"); - if (cpu->bSSE42) Printf(" SSE4.2"); - if (cpu->b3DNow) Printf(" 3DNow!"); - if (cpu->b3DNowPlus) Printf(" 3DNow!+"); - if (cpu->HyperThreading) Printf(" HyperThreading"); - Printf ("\n"); + out.AppendFormat(" Features:"); + if (cpu->bSSE2) out += (" SSE2"); + if (cpu->bSSE3) out += (" SSE3"); + if (cpu->bSSSE3) out += (" SSSE3"); + if (cpu->bSSE41) out += (" SSE4.1"); + if (cpu->bSSE42) out += (" SSE4.2"); + if (cpu->b3DNow) out += (" 3DNow!"); + if (cpu->b3DNowPlus) out += (" 3DNow!+"); + if (cpu->HyperThreading) out += (" HyperThreading"); + out += ("\n"); } + return out; } #endif diff --git a/src/common/utility/x86.h b/src/common/utility/x86.h index aa3ce23bc..d466d2996 100644 --- a/src/common/utility/x86.h +++ b/src/common/utility/x86.h @@ -2,6 +2,7 @@ #define X86_H #include "basics.h" +#include "zstring.h" struct CPUInfo // 92 bytes { @@ -105,7 +106,7 @@ extern CPUInfo CPU; struct PalEntry; void CheckCPUID (CPUInfo *cpu); -void DumpCPUInfo (const CPUInfo *cpu); +FString DumpCPUInfo (const CPUInfo *cpu); #endif diff --git a/src/d_main.cpp b/src/d_main.cpp index 1277525bf..7f980b4cd 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -2542,7 +2542,10 @@ static int D_DoomMain_Internal (void) if (!restart) { if (!batchrun) Printf ("I_Init: Setting up machine state.\n"); - I_Init (); + CheckCPUID(&CPU); + CalculateCPUSpeed(); + auto ci = DumpCPUInfo(&CPU); + Printf("%s", ci.GetChars()); } // [RH] Initialize palette management diff --git a/src/posix/i_system.h b/src/posix/i_system.h index fbea0ff88..d3ba2945a 100644 --- a/src/posix/i_system.h +++ b/src/posix/i_system.h @@ -45,9 +45,7 @@ struct WadStuff; #define SHARE_DIR "/usr/local/share/" #endif - -// Called by DoomMain. -void I_Init (void); +void CalculateCPUSpeed(void); // Return a seed value for the RNG. unsigned int I_MakeRNGSeed(); diff --git a/src/posix/i_system_posix.cpp b/src/posix/i_system_posix.cpp index 9eccc4127..179d9f5b7 100644 --- a/src/posix/i_system_posix.cpp +++ b/src/posix/i_system_posix.cpp @@ -43,19 +43,6 @@ ticcmd_t *I_BaseTiccmd() return &emptycmd; } -// -// I_Init -// -void I_Init() -{ - extern void CalculateCPUSpeed(); - - CheckCPUID(&CPU); - CalculateCPUSpeed(); - DumpCPUInfo(&CPU); -} - - bool I_WriteIniFailed() { printf("The config file %s could not be saved:\n%s\n", GameConfig->GetPathName(), strerror(errno)); diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index dab314d74..0d03ba680 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -107,8 +107,6 @@ void DestroyCustomCursor(); // PRIVATE FUNCTION PROTOTYPES --------------------------------------------- -static void CalculateCPUSpeed(); - static HCURSOR CreateCompatibleCursor(FBitmap &cursorpic, int leftofs, int topofs); static HCURSOR CreateAlphaCursor(FBitmap &cursorpic, int leftofs, int topofs); static HCURSOR CreateBitmapCursor(int xhot, int yhot, HBITMAP and_mask, HBITMAP color_mask); @@ -309,20 +307,6 @@ void CalculateCPUSpeed() if (!batchrun) Printf ("CPU speed: %.0f MHz\n", 0.001 / PerfToMillisec); } -//========================================================================== -// -// I_Init -// -//========================================================================== - -void I_Init() -{ - CheckCPUID(&CPU); - CalculateCPUSpeed(); - DumpCPUInfo(&CPU); -} - - //========================================================================== // // I_PrintStr diff --git a/src/win32/i_system.h b/src/win32/i_system.h index 03b233679..178002fa2 100644 --- a/src/win32/i_system.h +++ b/src/win32/i_system.h @@ -38,7 +38,7 @@ struct WadStuff; void I_DetectOS (void); // Called by DoomMain. -void I_Init (void); +void CalculateCPUSpeed (void); // Return a seed value for the RNG. unsigned int I_MakeRNGSeed();