mirror of https://github.com/xemu-project/xemu.git
ui: Display hardware info in About window
This commit is contained in:
parent
6d7f329880
commit
38d1036b2c
100
ui/xemu-hud.cc
100
ui/xemu-hud.cc
|
@ -789,6 +789,44 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const char *get_os_platform(void)
|
||||||
|
{
|
||||||
|
const char *platform_name;
|
||||||
|
|
||||||
|
#if defined(__linux__)
|
||||||
|
platform_name = "Linux";
|
||||||
|
#elif defined(_WIN32)
|
||||||
|
platform_name = "Windows";
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
platform_name = "macOS";
|
||||||
|
#else
|
||||||
|
platform_name = "Unknown";
|
||||||
|
#endif
|
||||||
|
return platform_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
#ifdef CONFIG_CPUID_H
|
||||||
|
#include <cpuid.h>
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static const char *get_cpu_info(void)
|
||||||
|
{
|
||||||
|
const char *cpu_info = "";
|
||||||
|
#ifdef CONFIG_CPUID_H
|
||||||
|
static uint32_t brand[12];
|
||||||
|
if (__get_cpuid_max(0x80000004, NULL)) {
|
||||||
|
__get_cpuid(0x80000002, brand+0x0, brand+0x1, brand+0x2, brand+0x3);
|
||||||
|
__get_cpuid(0x80000003, brand+0x4, brand+0x5, brand+0x6, brand+0x7);
|
||||||
|
__get_cpuid(0x80000004, brand+0x8, brand+0x9, brand+0xa, brand+0xb);
|
||||||
|
}
|
||||||
|
cpu_info = (const char *)brand;
|
||||||
|
#endif
|
||||||
|
// FIXME: Support other architectures (e.g. ARM)
|
||||||
|
return cpu_info;
|
||||||
|
}
|
||||||
|
|
||||||
class AboutWindow
|
class AboutWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -796,20 +834,14 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
char build_info_text[256];
|
char build_info_text[256];
|
||||||
|
char platform_info_text[350];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AboutWindow()
|
AboutWindow()
|
||||||
{
|
{
|
||||||
snprintf(build_info_text, sizeof(build_info_text),
|
snprintf(build_info_text, sizeof(build_info_text),
|
||||||
"Version: %s\n" "Branch: %s\n" "Commit: %s\n" "Date: %s",
|
"Version: %s\nBranch: %s\nCommit: %s\nDate: %s",
|
||||||
xemu_version, xemu_branch, xemu_commit, xemu_date);
|
xemu_version, xemu_branch, xemu_commit, xemu_date);
|
||||||
// FIXME: Show platform
|
|
||||||
// FIXME: Show driver
|
|
||||||
// FIXME: Show BIOS/BootROM hash
|
|
||||||
}
|
|
||||||
|
|
||||||
~AboutWindow()
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Draw()
|
void Draw()
|
||||||
|
@ -824,7 +856,19 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t time_start = 0;
|
static uint32_t time_start = 0;
|
||||||
if (ImGui::IsWindowAppearing()) {
|
if (ImGui::IsWindowAppearing()) {
|
||||||
|
const char *gl_shader_version = (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION);
|
||||||
|
const char *gl_version = (const char*)glGetString(GL_VERSION);
|
||||||
|
const char *gl_renderer = (const char*)glGetString(GL_RENDERER);
|
||||||
|
const char *gl_vendor = (const char*)glGetString(GL_VENDOR);
|
||||||
|
|
||||||
|
snprintf(platform_info_text, sizeof(platform_info_text),
|
||||||
|
"CPU: %s\nOS Platform: %s\nOS Version: %s\nManufacturer: %s\n"
|
||||||
|
"GPU Model: %s\nDriver: %s\nShader: %s",
|
||||||
|
get_cpu_info(), get_os_platform(), xemu_get_os_info(), gl_vendor,
|
||||||
|
gl_renderer, gl_version, gl_shader_version);
|
||||||
|
// FIXME: Show BIOS/BootROM hash
|
||||||
|
|
||||||
time_start = SDL_GetTicks();
|
time_start = SDL_GetTicks();
|
||||||
}
|
}
|
||||||
uint32_t now = SDL_GetTicks() - time_start;
|
uint32_t now = SDL_GetTicks() - time_start;
|
||||||
|
@ -861,7 +905,8 @@ public:
|
||||||
ImGui::Dummy(ImVec2(0,40*g_ui_scale));
|
ImGui::Dummy(ImVec2(0,40*g_ui_scale));
|
||||||
|
|
||||||
ImGui::PushFont(g_fixed_width_font);
|
ImGui::PushFont(g_fixed_width_font);
|
||||||
ImGui::InputTextMultiline("##build_info", build_info_text, sizeof(build_info_text), ImVec2(-FLT_MIN, ImGui::GetTextLineHeight() * 6), ImGuiInputTextFlags_ReadOnly);
|
ImGui::InputTextMultiline("##build_info", build_info_text, sizeof(build_info_text), ImVec2(-FLT_MIN, ImGui::GetTextLineHeight() * 5), ImGuiInputTextFlags_ReadOnly);
|
||||||
|
ImGui::InputTextMultiline("##platform_info", platform_info_text, sizeof(platform_info_text), ImVec2(-FLT_MIN, ImGui::GetTextLineHeight() * 8), ImGuiInputTextFlags_ReadOnly);
|
||||||
ImGui::PopFont();
|
ImGui::PopFont();
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
@ -1119,28 +1164,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
#ifdef CONFIG_CPUID_H
|
|
||||||
#include <cpuid.h>
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *get_cpu_info(void)
|
|
||||||
{
|
|
||||||
const char *cpu_info = "";
|
|
||||||
#ifdef CONFIG_CPUID_H
|
|
||||||
static uint32_t brand[12];
|
|
||||||
if (__get_cpuid_max(0x80000004, NULL)) {
|
|
||||||
__get_cpuid(0x80000002, brand+0x0, brand+0x1, brand+0x2, brand+0x3);
|
|
||||||
__get_cpuid(0x80000003, brand+0x4, brand+0x5, brand+0x6, brand+0x7);
|
|
||||||
__get_cpuid(0x80000004, brand+0x8, brand+0x9, brand+0xa, brand+0xb);
|
|
||||||
}
|
|
||||||
cpu_info = (const char *)brand;
|
|
||||||
#endif
|
|
||||||
// FIXME: Support other architectures (e.g. ARM)
|
|
||||||
return cpu_info;
|
|
||||||
}
|
|
||||||
|
|
||||||
class CompatibilityReporter
|
class CompatibilityReporter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -1163,15 +1186,8 @@ public:
|
||||||
report.xemu_branch = xemu_branch;
|
report.xemu_branch = xemu_branch;
|
||||||
report.xemu_commit = xemu_commit;
|
report.xemu_commit = xemu_commit;
|
||||||
report.xemu_date = xemu_date;
|
report.xemu_date = xemu_date;
|
||||||
#if defined(__linux__)
|
|
||||||
report.os_platform = "Linux";
|
report.os_platform = get_os_platform();
|
||||||
#elif defined(_WIN32)
|
|
||||||
report.os_platform = "Windows";
|
|
||||||
#elif defined(__APPLE__)
|
|
||||||
report.os_platform = "macOS";
|
|
||||||
#else
|
|
||||||
report.os_platform = "Unknown";
|
|
||||||
#endif
|
|
||||||
report.os_version = xemu_get_os_info();
|
report.os_version = xemu_get_os_info();
|
||||||
report.cpu = get_cpu_info();
|
report.cpu = get_cpu_info();
|
||||||
dirty = true;
|
dirty = true;
|
||||||
|
|
Loading…
Reference in New Issue