diff --git a/ui/xemu.c b/ui/xemu.c index 5f86b9bda9d..b3f2d307037 100644 --- a/ui/xemu.c +++ b/ui/xemu.c @@ -198,6 +198,11 @@ void sdl2_window_resize(struct sdl2_console *scon) surface_height(scon->surface)); } +void xemu_get_window_size(int *width, int *height) +{ + SDL_GetWindowSize(m_window, width, height); +} + static void sdl2_redraw(struct sdl2_console *scon) { if (scon->opengl) { diff --git a/ui/xui/main-menu.cc b/ui/xui/main-menu.cc index 19d12f9cc78..b85c505b6bf 100644 --- a/ui/xui/main-menu.cc +++ b/ui/xui/main-menu.cc @@ -843,10 +843,16 @@ void MainMenuAboutView::Draw() const char *gl_vendor = (const char*)glGetString(GL_VENDOR); sys_info_text = g_strdup_printf( "CPU: %s\nOS Platform: %s\nOS Version: %s\nManufacturer: %s\n" - "GPU Model: %s\nDriver: %s\nShader: %s", + "GPU Model: %s\nDriver: %s\nShader: %s\n", xemu_get_cpu_info(), xemu_get_os_platform(), xemu_get_os_info(), gl_vendor, gl_renderer, gl_version, gl_shader_version); } + int width = 0, height = 0; + xemu_get_window_size(&width, &height); + + char *content = g_strdup_printf("%sScaling: %dx\nResolution: %dx%d\nDisplay Mode: %s", + sys_info_text, nv2a_get_surface_scale_factor(), + width, height, g_ui_display_mode_name[g_config.display.ui.fit]); if (m_config_info_text == NULL) { UpdateConfigInfoText(); @@ -864,11 +870,12 @@ void MainMenuAboutView::Draw() SectionTitle("System Information"); ImGui::PushFont(g_font_mgr.m_fixed_width_font); - ImGui::InputTextMultiline("###systeminformation", (char *)sys_info_text, - strlen(sys_info_text), - ImVec2(-FLT_MIN, ImGui::GetTextLineHeight() * 8), + ImGui::InputTextMultiline("###systeminformation", content, + strlen(content), + ImVec2(-FLT_MIN, ImGui::GetTextLineHeight() * 11), ImGuiInputTextFlags_ReadOnly); ImGui::PopFont(); + g_free(content); SectionTitle("Config Information"); ImGui::PushFont(g_font_mgr.m_fixed_width_font); diff --git a/ui/xui/misc.hh b/ui/xui/misc.hh index 0a31ed4a8c4..67c34fde2ff 100644 --- a/ui/xui/misc.hh +++ b/ui/xui/misc.hh @@ -28,6 +28,8 @@ extern "C" { #include } +extern const char *g_ui_display_mode_name[]; + static inline bool IsNavInputPressed(ImGuiNavInput i) { ImGuiIO &io = ImGui::GetIO(); diff --git a/ui/xui/popup-menu.cc b/ui/xui/popup-menu.cc index 6cad92e2a13..0300ec398f5 100644 --- a/ui/xui/popup-menu.cc +++ b/ui/xui/popup-menu.cc @@ -36,6 +36,7 @@ void PopupMenuItemDelegate::LostFocus() {} void PopupMenuItemDelegate::PushFocus() {} void PopupMenuItemDelegate::PopFocus() {} bool PopupMenuItemDelegate::DidPop() { return false; } +const char *g_ui_display_mode_name[] = {"Center", "Scale", "Scale (Widescreen 16:9)", "Scale (4:3)", "Stretch"}; bool PopupMenuButton(std::string text, std::string icon = "") { @@ -252,16 +253,13 @@ bool PopupMenu::DrawItems(PopupMenuItemDelegate &nav) class DisplayModePopupMenu : public virtual PopupMenu { public: + bool DrawItems(PopupMenuItemDelegate &nav) override { - const char *values[] = { - "Center", "Scale", "Scale (Widescreen 16:9)", "Scale (4:3)", "Stretch" - }; - for (int i = 0; i < CONFIG_DISPLAY_UI_FIT__COUNT; i++) { bool selected = g_config.display.ui.fit == i; if (m_focus && selected) ImGui::SetKeyboardFocusHere(); - if (PopupMenuCheck(values[i], "", selected)) + if (PopupMenuCheck(g_ui_display_mode_name[i], "", selected)) g_config.display.ui.fit = i; } diff --git a/ui/xui/xemu-hud.h b/ui/xui/xemu-hud.h index a510c85bf61..1fbbd0aac7d 100644 --- a/ui/xui/xemu-hud.h +++ b/ui/xui/xemu-hud.h @@ -35,6 +35,7 @@ void xemu_monitor_init(void); void xemu_toggle_fullscreen(void); void xemu_eject_disc(void); void xemu_load_disc(const char *path); +void xemu_get_window_size(int *width, int *height); // Implemented in xemu_hud.cc void xemu_hud_init(SDL_Window *window, void *sdl_gl_context);