From 290bc214e3c74dc2e986a2aa235f9058c2c10c17 Mon Sep 17 00:00:00 2001 From: Soar Qin Date: Tue, 12 Oct 2021 17:24:58 +0800 Subject: [PATCH] win32: fix broken win9x builds caused by #13089 (#13106) Co-authored-by: Soar Qin --- gfx/common/win32_common.c | 15 ++++++++++++--- ui/drivers/ui_win32.c | 11 ++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/gfx/common/win32_common.c b/gfx/common/win32_common.c index f27b78e052..f2db2efc5f 100644 --- a/gfx/common/win32_common.c +++ b/gfx/common/win32_common.c @@ -1615,22 +1615,31 @@ bool win32_window_create(void *data, unsigned style, bool window_save_positions = settings->bools.video_window_save_positions; unsigned user_width = width; unsigned user_height = height; - wchar_t *title_wide = utf8_to_utf16_string_alloc(msg_hash_to_str(MSG_PROGRAM)); +#ifdef LEGACY_WIN32 + char *title_local = utf8_to_local_string_alloc(new_label2); +#else + wchar_t *title_local = utf8_to_utf16_string_alloc(msg_hash_to_str(MSG_PROGRAM)); +#endif if (window_save_positions && !fullscreen) { user_width = g_win32->pos_width; user_height = g_win32->pos_height; } +#ifdef LEGACY_WIN32 + main_window.hwnd = CreateWindowEx(0, + "RetroArch", title_local, +#else main_window.hwnd = CreateWindowExW(0, - L"RetroArch", title_wide, + L"RetroArch", title_local, +#endif style, fullscreen ? mon_rect->left : g_win32->pos_x, fullscreen ? mon_rect->top : g_win32->pos_y, user_width, user_height, NULL, NULL, NULL, data); - free(title_wide); + free(title_local); if (!main_window.hwnd) return false; diff --git a/ui/drivers/ui_win32.c b/ui/drivers/ui_win32.c index 472cc45e5a..b1919f06cc 100644 --- a/ui/drivers/ui_win32.c +++ b/ui/drivers/ui_win32.c @@ -116,9 +116,14 @@ static void ui_window_win32_set_visible(void *data, static void ui_window_win32_set_title(void *data, char *buf) { ui_window_win32_t *window = (ui_window_win32_t*)data; - wchar_t *title_wide = utf8_to_utf16_string_alloc(buf); - SetWindowTextW(window->hwnd, title_wide); - free(title_wide); +#ifdef LEGACY_WIN32 + char *title_local = utf8_to_local_string_alloc(new_label2); + SetWindowText(window->hwnd, title_local); +#else + wchar_t *title_local = utf8_to_utf16_string_alloc(buf); + SetWindowTextW(window->hwnd, title_local); +#endif + free(title_local); } void ui_window_win32_set_droppable(void *data, bool droppable)