diff --git a/ui/xemu-hud.cc b/ui/xemu-hud.cc index c9ed338737..9a38b085b8 100644 --- a/ui/xemu-hud.cc +++ b/ui/xemu-hud.cc @@ -204,6 +204,11 @@ void xemu_hud_init(SDL_Window* window, void* sdl_gl_context) if (show_first_boot_window) { show_main_menu = false; } + + int ui_scale_int = 1; + xemu_settings_get_int(XEMU_SETTINGS_DISPLAY_UI_SCALE, &ui_scale_int); + if (ui_scale_int < 1) ui_scale_int = 1; + ui_scale = ui_scale_int; } void xemu_hud_process_sdl_events(SDL_Event *event) @@ -269,6 +274,8 @@ static void ShowMainMenu() if (ui_scale_combo > 1) ui_scale_combo = 1; if (ImGui::Combo("UI Scale", &ui_scale_combo, "1x\0" "2x\0")) { ui_scale = ui_scale_combo + 1; + xemu_settings_set_int(XEMU_SETTINGS_DISPLAY_UI_SCALE, ui_scale); + xemu_settings_save(); trigger_style_update = true; } diff --git a/ui/xemu-settings.c b/ui/xemu-settings.c index defab17b6a..70234e5f96 100644 --- a/ui/xemu-settings.c +++ b/ui/xemu-settings.c @@ -46,6 +46,7 @@ struct xemu_settings { // [display] int scale; + int ui_scale; // [input] char *controller_1_guid; @@ -87,7 +88,8 @@ struct config_offset_table { [XEMU_SETTINGS_SYSTEM_MEMORY] = { CONFIG_TYPE_INT, "system", "memory", offsetof(struct xemu_settings, memory), { .default_int = 64 } }, [XEMU_SETTINGS_SYSTEM_SHORTANIM] = { CONFIG_TYPE_BOOL, "system", "shortanim", offsetof(struct xemu_settings, short_animation), { .default_bool = 0 } }, - [XEMU_SETTINGS_DISPLAY_SCALE] = { CONFIG_TYPE_ENUM, "display", "scale", offsetof(struct xemu_settings, scale), { .default_int = DISPLAY_SCALE_SCALE }, display_scale_map }, + [XEMU_SETTINGS_DISPLAY_SCALE] = { CONFIG_TYPE_ENUM, "display", "scale", offsetof(struct xemu_settings, scale), { .default_int = DISPLAY_SCALE_SCALE }, display_scale_map }, + [XEMU_SETTINGS_DISPLAY_UI_SCALE] = { CONFIG_TYPE_INT, "display", "ui_scale", offsetof(struct xemu_settings, ui_scale), { .default_int = 1 } }, [XEMU_SETTINGS_INPUT_CONTROLLER_1_GUID] = { CONFIG_TYPE_STRING, "input", "controller_1_guid", offsetof(struct xemu_settings, controller_1_guid), { .default_str = "" } }, [XEMU_SETTINGS_INPUT_CONTROLLER_2_GUID] = { CONFIG_TYPE_STRING, "input", "controller_2_guid", offsetof(struct xemu_settings, controller_2_guid), { .default_str = "" } }, diff --git a/ui/xemu-settings.h b/ui/xemu-settings.h index 4e851fe6da..eba56427dc 100644 --- a/ui/xemu-settings.h +++ b/ui/xemu-settings.h @@ -37,6 +37,7 @@ enum xemu_settings_keys { XEMU_SETTINGS_SYSTEM_MEMORY, XEMU_SETTINGS_SYSTEM_SHORTANIM, XEMU_SETTINGS_DISPLAY_SCALE, + XEMU_SETTINGS_DISPLAY_UI_SCALE, XEMU_SETTINGS_INPUT_CONTROLLER_1_GUID, XEMU_SETTINGS_INPUT_CONTROLLER_2_GUID, XEMU_SETTINGS_INPUT_CONTROLLER_3_GUID,