diff --git a/ui/xemu-hud.cc b/ui/xemu-hud.cc index a8f9bfdea6..6e0322f13c 100644 --- a/ui/xemu-hud.cc +++ b/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 +#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 { public: @@ -796,20 +834,14 @@ public: private: char build_info_text[256]; + char platform_info_text[350]; public: AboutWindow() { snprintf(build_info_text, sizeof(build_info_text), - "Version: %s\n" "Branch: %s\n" "Commit: %s\n" "Date: %s", - xemu_version, xemu_branch, xemu_commit, xemu_date); - // FIXME: Show platform - // FIXME: Show driver - // FIXME: Show BIOS/BootROM hash - } - - ~AboutWindow() - { + "Version: %s\nBranch: %s\nCommit: %s\nDate: %s", + xemu_version, xemu_branch, xemu_commit, xemu_date); } void Draw() @@ -824,7 +856,19 @@ public: } 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(); } uint32_t now = SDL_GetTicks() - time_start; @@ -861,7 +905,8 @@ public: ImGui::Dummy(ImVec2(0,40*g_ui_scale)); 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::End(); @@ -1119,28 +1164,6 @@ public: } }; -#ifndef _WIN32 -#ifdef CONFIG_CPUID_H -#include -#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 { public: @@ -1163,15 +1186,8 @@ public: report.xemu_branch = xemu_branch; report.xemu_commit = xemu_commit; report.xemu_date = xemu_date; -#if defined(__linux__) - report.os_platform = "Linux"; -#elif defined(_WIN32) - report.os_platform = "Windows"; -#elif defined(__APPLE__) - report.os_platform = "macOS"; -#else - report.os_platform = "Unknown"; -#endif + + report.os_platform = get_os_platform(); report.os_version = xemu_get_os_info(); report.cpu = get_cpu_info(); dirty = true;