mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-13 07:57:52 +00:00
- make DumpCPUInfo return a string instead of letting it print the info itself. Also consolidated I_Init, because both existing versions were identical.
This commit is contained in:
parent
76352dd9b3
commit
d523da1313
8 changed files with 28 additions and 54 deletions
|
@ -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
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
**
|
||||
*/
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "doomdef.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue