added GPUs to telemetry data

This commit is contained in:
Syping 2018-07-13 09:06:53 +02:00
parent 4c6962ab23
commit afeab6120d
2 changed files with 23 additions and 7 deletions

View File

@ -44,6 +44,7 @@
#ifdef GTA5SYNC_WIN
#include "windows.h"
#include "intrin.h"
#include "d3d9.h"
#endif
TelemetryClass TelemetryClass::telemetryClassInstance;
@ -228,16 +229,16 @@ QJsonDocument TelemetryClass::getSystemHardware()
#ifdef GTA5SYNC_WIN
{
int CPUInfo[4] = {-1};
unsigned nExIds, i = 0;
unsigned nExIds, ic = 0;
char CPUBrandString[0x40];
__cpuid(CPUInfo, 0x80000000);
nExIds = CPUInfo[0];
for (i = 0x80000000; i <= nExIds; ++i)
for (ic = 0x80000000; ic <= nExIds; ic++)
{
__cpuid(CPUInfo, i);
if (i == 0x80000002) { memcpy(CPUBrandString, CPUInfo, sizeof(CPUInfo)); }
else if (i == 0x80000003) { memcpy(CPUBrandString + 16, CPUInfo, sizeof(CPUInfo)); }
else if (i == 0x80000004) { memcpy(CPUBrandString + 32, CPUInfo, sizeof(CPUInfo)); }
__cpuid(CPUInfo, ic);
if (ic == 0x80000002) { memcpy(CPUBrandString, CPUInfo, sizeof(CPUInfo)); }
else if (ic == 0x80000003) { memcpy(CPUBrandString + 16, CPUInfo, sizeof(CPUInfo)); }
else if (ic == 0x80000004) { memcpy(CPUBrandString + 32, CPUInfo, sizeof(CPUInfo)); }
}
jsonObject["CPUName"] = QString::fromLatin1(CPUBrandString).simplified();
SYSTEM_INFO sysInfo;
@ -247,6 +248,21 @@ QJsonDocument TelemetryClass::getSystemHardware()
statex.dwLength = sizeof(statex);
GlobalMemoryStatusEx(&statex);
jsonObject["SystemRAM"] = QString(QString::number((statex.ullTotalPhys / 1024) / 1024) % "MB");
QStringList gpusList;
IDirect3D9 *pD3D = Direct3DCreate9(D3D_SDK_VERSION);
int adapters = pD3D->GetAdapterCount();
for (int ia = 0; ia < adapters; ia++)
{
D3DADAPTER_IDENTIFIER9 d3dIdent;
HRESULT result = pD3D->GetAdapterIdentifier(ia, 0, &d3dIdent);
if (result == D3D_OK)
{
QString gpuAdapter = QString::fromLatin1(d3dIdent.Description);
if (!gpusList.contains(gpuAdapter)) { gpusList << gpuAdapter; }
}
}
pD3D->Release();
jsonObject["GPUs"] = QJsonValue::fromVariant(gpusList);
}
#else
QDir procDir("/proc");

View File

@ -163,7 +163,7 @@ DEFINES += GTA5SYNC_NOASSIST # Not assisting at proper usage of SnapmaticPicture
win32: DEFINES += GTA5SYNC_WIN
win32: RC_FILE += res/app.rc
win32: LIBS += -luser32
win32: LIBS += -luser32 -ld3d9
win32: CONFIG -= embed_manifest_exe
contains(DEFINES, GTA5SYNC_APV): greaterThan(QT_MAJOR_VERSION, 4): greaterThan(QT_MINOR_VERSION, 1): win32: LIBS += -ldwmapi