From 457a982f72f3e7bf95137d90d7d499386a783179 Mon Sep 17 00:00:00 2001 From: "Raymai (Chee Boon)" Date: Thu, 28 Oct 2021 15:58:19 +0800 Subject: [PATCH] Change only a few key places to make the program works as if it's Unicode build. (#75) --- SpaceCadetPinball/high_score.cpp | 4 +- SpaceCadetPinball/options.cpp | 106 +++++++++++++++--------------- SpaceCadetPinball/options.h | 2 +- SpaceCadetPinball/winmain.cpp | 108 +++++++++++++++---------------- 4 files changed, 109 insertions(+), 111 deletions(-) diff --git a/SpaceCadetPinball/high_score.cpp b/SpaceCadetPinball/high_score.cpp index 6bb9c7c..1e3fb8c 100644 --- a/SpaceCadetPinball/high_score.cpp +++ b/SpaceCadetPinball/high_score.cpp @@ -166,7 +166,7 @@ void high_score::show_high_score_dialog(high_score_struct* table) dlg_enter_name = 0; dlg_score = 0; dlg_hst = table; - DialogBoxParamA(winmain::hinst, "dlg_highscores", winmain::hwnd_frame, HighScore, 0); + DialogBoxParamW(winmain::hinst, L"dlg_highscores", winmain::hwnd_frame, HighScore, 0); } void high_score::show_and_set_high_score_dialog(high_score_struct* table, int score, int pos, LPCSTR defaultName) @@ -176,7 +176,7 @@ void high_score::show_and_set_high_score_dialog(high_score_struct* table, int sc dlg_hst = table; dlg_enter_name = 1; default_name = defaultName; - while (DialogBoxParamA(winmain::hinst, "dlg_highscores", winmain::hwnd_frame, HighScore, 0)) + while (DialogBoxParamW(winmain::hinst, L"dlg_highscores", winmain::hwnd_frame, HighScore, 0)) { } } diff --git a/SpaceCadetPinball/options.cpp b/SpaceCadetPinball/options.cpp index 1092ebb..127aff2 100644 --- a/SpaceCadetPinball/options.cpp +++ b/SpaceCadetPinball/options.cpp @@ -434,9 +434,9 @@ void options::update_resolution_menu() { auto maxResolution = fullscrn::get_max_supported_resolution(); fullscrn::SetMaxResolution(maxResolution); - const CHAR* maxResText = pinball::get_rc_string(maxResolution + 2030, 0); + PCWSTR maxResText = pinball::get_rc_Wstring(maxResolution + 2030, 0); if (MenuHandle) - ModifyMenuA(MenuHandle, Menu1_MaximumResolution, 0, Menu1_MaximumResolution, maxResText); + ModifyMenuW(MenuHandle, Menu1_MaximumResolution, 0, Menu1_MaximumResolution, maxResText); for (auto resIndex = 0; resIndex < 3; resIndex++) { @@ -469,14 +469,14 @@ void options::init_resolution() void options::keyboard() { - DialogBoxParamA(winmain::hinst, "KEYMAPPER", winmain::hwnd_frame, KeyMapDlgProc, 0); + DialogBoxParamW(winmain::hinst, L"KEYMAPPER", winmain::hwnd_frame, KeyMapDlgProc, 0); } INT_PTR _stdcall options::KeyMapDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - char keyName[20]; + WCHAR keyName[20]; int keyBindings[6]; - char rcString[256]; + WCHAR rcString[256]; switch (msg) { @@ -500,7 +500,7 @@ INT_PTR _stdcall options::KeyMapDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR auto index = 128; do { - if (vkChar == MapVirtualKeyA(index, MAPVK_VK_TO_CHAR)) + if (vkChar == MapVirtualKeyW(index, MAPVK_VK_TO_CHAR)) break; ++index; } @@ -537,30 +537,30 @@ INT_PTR _stdcall options::KeyMapDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR { if (vk2And || get_vk_key_name(curVK, keyName)) { - auto ind = SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperL,CB_INSERTSTRING, -1, (LPARAM)keyName); - SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperL, CB_SETITEMDATA, ind, curVK); + auto ind = SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperL,CB_INSERTSTRING, -1, (LPARAM)keyName); + SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperL, CB_SETITEMDATA, ind, curVK); if (curVK == Options.LeftFlipperKey) - SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperL, CB_SETCURSEL, ind, 0); - ind = SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperR, CB_INSERTSTRING, -1, (LPARAM)keyName); - SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperR, CB_SETITEMDATA, ind, curVK); + SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperL, CB_SETCURSEL, ind, 0); + ind = SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperR, CB_INSERTSTRING, -1, (LPARAM)keyName); + SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperR, CB_SETITEMDATA, ind, curVK); if (curVK == Options.RightFlipperKey) - SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperR, CB_SETCURSEL, ind, 0); - ind = SendDlgItemMessageA(hDlg, KEYMAPPER_Plunger, CB_INSERTSTRING, -1, (LPARAM)keyName); - SendDlgItemMessageA(hDlg, KEYMAPPER_Plunger, CB_SETITEMDATA, ind, curVK); + SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperR, CB_SETCURSEL, ind, 0); + ind = SendDlgItemMessageW(hDlg, KEYMAPPER_Plunger, CB_INSERTSTRING, -1, (LPARAM)keyName); + SendDlgItemMessageW(hDlg, KEYMAPPER_Plunger, CB_SETITEMDATA, ind, curVK); if (curVK == Options.PlungerKey) - SendDlgItemMessageA(hDlg, KEYMAPPER_Plunger, CB_SETCURSEL, ind, 0); - ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpLeft, CB_INSERTSTRING, -1, (LPARAM)keyName); - SendDlgItemMessageA(hDlg, KEYMAPPER_BumpLeft, CB_SETITEMDATA, ind, curVK); + SendDlgItemMessageW(hDlg, KEYMAPPER_Plunger, CB_SETCURSEL, ind, 0); + ind = SendDlgItemMessageW(hDlg, KEYMAPPER_BumpLeft, CB_INSERTSTRING, -1, (LPARAM)keyName); + SendDlgItemMessageW(hDlg, KEYMAPPER_BumpLeft, CB_SETITEMDATA, ind, curVK); if (curVK == Options.LeftTableBumpKey) - SendDlgItemMessageA(hDlg, KEYMAPPER_BumpLeft, CB_SETCURSEL, ind, 0); - ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpRight, CB_INSERTSTRING, -1, (LPARAM)keyName); - SendDlgItemMessageA(hDlg, KEYMAPPER_BumpRight, CB_SETITEMDATA, ind, curVK); + SendDlgItemMessageW(hDlg, KEYMAPPER_BumpLeft, CB_SETCURSEL, ind, 0); + ind = SendDlgItemMessageW(hDlg, KEYMAPPER_BumpRight, CB_INSERTSTRING, -1, (LPARAM)keyName); + SendDlgItemMessageW(hDlg, KEYMAPPER_BumpRight, CB_SETITEMDATA, ind, curVK); if (curVK == Options.RightTableBumpKey) - SendDlgItemMessageA(hDlg, KEYMAPPER_BumpRight, CB_SETCURSEL, ind, 0); - ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpBottom, CB_INSERTSTRING, -1, (LPARAM)keyName); - SendDlgItemMessageA(hDlg, KEYMAPPER_BumpBottom, CB_SETITEMDATA, ind, curVK); + SendDlgItemMessageW(hDlg, KEYMAPPER_BumpRight, CB_SETCURSEL, ind, 0); + ind = SendDlgItemMessageW(hDlg, KEYMAPPER_BumpBottom, CB_INSERTSTRING, -1, (LPARAM)keyName); + SendDlgItemMessageW(hDlg, KEYMAPPER_BumpBottom, CB_SETITEMDATA, ind, curVK); if (curVK == Options.BottomTableBumpKey) - SendDlgItemMessageA(hDlg, KEYMAPPER_BumpBottom, CB_SETCURSEL, ind, 0); + SendDlgItemMessageW(hDlg, KEYMAPPER_BumpBottom, CB_SETCURSEL, ind, 0); } } } @@ -570,18 +570,18 @@ INT_PTR _stdcall options::KeyMapDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR { case KEYMAPPER_Ok: { - auto ind = SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperL, CB_GETCURSEL, 0, 0); - keyBindings[0] = static_cast(SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperL, CB_GETITEMDATA, ind, 0)); - ind = SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperR, CB_GETCURSEL, 0, 0); - keyBindings[1] = static_cast(SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperR, CB_GETITEMDATA, ind, 0)); - ind = SendDlgItemMessageA(hDlg, KEYMAPPER_Plunger, CB_GETCURSEL, 0, 0); - keyBindings[2] = static_cast(SendDlgItemMessageA(hDlg, KEYMAPPER_Plunger, CB_GETITEMDATA, ind, 0)); - ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpLeft, CB_GETCURSEL, 0, 0); - keyBindings[3] = static_cast(SendDlgItemMessageA(hDlg, KEYMAPPER_BumpLeft, CB_GETITEMDATA, ind, 0)); - ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpRight, CB_GETCURSEL, 0, 0); - keyBindings[4] = static_cast(SendDlgItemMessageA(hDlg, KEYMAPPER_BumpRight, CB_GETITEMDATA, ind, 0)); - ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpBottom, CB_GETCURSEL, 0, 0); - keyBindings[5] = static_cast(SendDlgItemMessageA(hDlg, KEYMAPPER_BumpBottom, CB_GETITEMDATA, ind, 0)); + auto ind = SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperL, CB_GETCURSEL, 0, 0); + keyBindings[0] = static_cast(SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperL, CB_GETITEMDATA, ind, 0)); + ind = SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperR, CB_GETCURSEL, 0, 0); + keyBindings[1] = static_cast(SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperR, CB_GETITEMDATA, ind, 0)); + ind = SendDlgItemMessageW(hDlg, KEYMAPPER_Plunger, CB_GETCURSEL, 0, 0); + keyBindings[2] = static_cast(SendDlgItemMessageW(hDlg, KEYMAPPER_Plunger, CB_GETITEMDATA, ind, 0)); + ind = SendDlgItemMessageW(hDlg, KEYMAPPER_BumpLeft, CB_GETCURSEL, 0, 0); + keyBindings[3] = static_cast(SendDlgItemMessageW(hDlg, KEYMAPPER_BumpLeft, CB_GETITEMDATA, ind, 0)); + ind = SendDlgItemMessageW(hDlg, KEYMAPPER_BumpRight, CB_GETCURSEL, 0, 0); + keyBindings[4] = static_cast(SendDlgItemMessageW(hDlg, KEYMAPPER_BumpRight, CB_GETITEMDATA, ind, 0)); + ind = SendDlgItemMessageW(hDlg, KEYMAPPER_BumpBottom, CB_GETCURSEL, 0, 0); + keyBindings[5] = static_cast(SendDlgItemMessageW(hDlg, KEYMAPPER_BumpBottom, CB_GETITEMDATA, ind, 0)); auto sameKeyBound = 0; auto index = 1; @@ -594,8 +594,8 @@ INT_PTR _stdcall options::KeyMapDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR break; if (*optPtr == keyBindings[keyInd]) { - lstrcpyA(rcString, pinball::get_rc_string(43, 0)); - MessageBoxA(hDlg, pinball::get_rc_string(39, 0), rcString, 0x2000u); + lstrcpyW(rcString, pinball::get_rc_Wstring(43, 0)); + MessageBoxW(hDlg, pinball::get_rc_Wstring(39, 0), rcString, 0x2000u); sameKeyBound = 1; } } @@ -623,23 +623,23 @@ INT_PTR _stdcall options::KeyMapDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR case KEYMAPPER_Default: { auto name = (LPARAM)get_vk_key_name(Options.LeftFlipperKeyDft, keyName); - auto ind = SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperL, CB_FINDSTRINGEXACT, 0, name); - SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperL, CB_SETCURSEL, ind, 0); + auto ind = SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperL, CB_FINDSTRINGEXACT, 0, name); + SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperL, CB_SETCURSEL, ind, 0); name = (LPARAM)get_vk_key_name(Options.RightFlipperKeyDft, keyName); - ind = SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperR, CB_FINDSTRINGEXACT, 0, name); - SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperR, CB_SETCURSEL, ind, 0); + ind = SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperR, CB_FINDSTRINGEXACT, 0, name); + SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperR, CB_SETCURSEL, ind, 0); name = (LPARAM)get_vk_key_name(Options.PlungerKeyDft, keyName); - ind = SendDlgItemMessageA(hDlg, KEYMAPPER_Plunger, CB_FINDSTRINGEXACT, 0, name); - SendDlgItemMessageA(hDlg, KEYMAPPER_Plunger, CB_SETCURSEL, ind, 0); + ind = SendDlgItemMessageW(hDlg, KEYMAPPER_Plunger, CB_FINDSTRINGEXACT, 0, name); + SendDlgItemMessageW(hDlg, KEYMAPPER_Plunger, CB_SETCURSEL, ind, 0); name = (LPARAM)get_vk_key_name(Options.LeftTableBumpKeyDft, keyName); - ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpLeft, CB_FINDSTRINGEXACT, 0, name); - SendDlgItemMessageA(hDlg, KEYMAPPER_BumpLeft, CB_SETCURSEL, ind, 0); + ind = SendDlgItemMessageW(hDlg, KEYMAPPER_BumpLeft, CB_FINDSTRINGEXACT, 0, name); + SendDlgItemMessageW(hDlg, KEYMAPPER_BumpLeft, CB_SETCURSEL, ind, 0); name = (LPARAM)get_vk_key_name(Options.RightTableBumpKeyDft, keyName); - ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpRight, CB_FINDSTRINGEXACT, 0, name); - SendDlgItemMessageA(hDlg, KEYMAPPER_BumpRight, CB_SETCURSEL, ind, 0); + ind = SendDlgItemMessageW(hDlg, KEYMAPPER_BumpRight, CB_FINDSTRINGEXACT, 0, name); + SendDlgItemMessageW(hDlg, KEYMAPPER_BumpRight, CB_SETCURSEL, ind, 0); name = (LPARAM)get_vk_key_name(Options.BottomTableBumpKeyDft, keyName); - ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpBottom, CB_FINDSTRINGEXACT, 0, name); - SendDlgItemMessageA(hDlg, KEYMAPPER_BumpBottom, CB_SETCURSEL, ind, 0); + ind = SendDlgItemMessageW(hDlg, KEYMAPPER_BumpBottom, CB_FINDSTRINGEXACT, 0, name); + SendDlgItemMessageW(hDlg, KEYMAPPER_BumpBottom, CB_SETCURSEL, ind, 0); return 0; } default: @@ -653,10 +653,10 @@ INT_PTR _stdcall options::KeyMapDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR } -LPSTR options::get_vk_key_name(uint16_t vk, LPSTR keyName) +LPWSTR options::get_vk_key_name(uint16_t vk, LPWSTR keyName) { - LONG scanCode = MapVirtualKeyA(vk, MAPVK_VK_TO_VSC) << 16; + LONG scanCode = MapVirtualKeyW(vk, MAPVK_VK_TO_VSC) << 16; if (vk >= 0x21u && vk <= 0x2Eu) scanCode |= 0x1000000u; - return GetKeyNameTextA(scanCode, keyName, 19) != 0 ? keyName : nullptr; + return GetKeyNameTextW(scanCode, keyName, 19) != 0 ? keyName : nullptr; } diff --git a/SpaceCadetPinball/options.h b/SpaceCadetPinball/options.h index aa4a1da..821eb3a 100644 --- a/SpaceCadetPinball/options.h +++ b/SpaceCadetPinball/options.h @@ -66,7 +66,7 @@ public: static void keyboard(); static INT_PTR _stdcall KeyMapDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam); - static LPSTR get_vk_key_name(uint16_t vk, LPSTR keyName); + static LPWSTR get_vk_key_name(uint16_t vk, LPWSTR keyName); static optionsStruct Options; private: diff --git a/SpaceCadetPinball/winmain.cpp b/SpaceCadetPinball/winmain.cpp index 56a1ed7..fe2f11c 100644 --- a/SpaceCadetPinball/winmain.cpp +++ b/SpaceCadetPinball/winmain.cpp @@ -131,11 +131,11 @@ int winmain::WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi } iFrostUniqueMsg = RegisterWindowMessageA("PinballThemeSwitcherUniqueMsgString"); - auto windowClass = pinball::get_rc_string(167, 0); - auto windowHandle = FindWindowA(windowClass, nullptr); + auto windowClass = pinball::get_rc_Wstring(167, 0); + auto windowHandle = FindWindowW(windowClass, nullptr); if (windowHandle) { - SendMessageA(windowHandle, iFrostUniqueMsg, 0, 0); + SendMessageW(windowHandle, iFrostUniqueMsg, 0, 0); return 0; } @@ -147,28 +147,28 @@ int winmain::WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi picce.dwICC = 5885; InitCommonControlsEx(&picce); - WNDCLASSEXA wndClass{}; + WNDCLASSEXW wndClass{}; wndClass.cbSize = sizeof wndClass; wndClass.style = CS_DBLCLKS | CS_BYTEALIGNCLIENT; wndClass.lpfnWndProc = message_handler; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = 0; wndClass.hInstance = hInstance; - wndClass.hIcon = LoadIconA(hInstance, "ICON_1"); - wndClass.hCursor = LoadCursorA(nullptr, IDC_ARROW); + wndClass.hIcon = LoadIconW(hInstance, L"ICON_1"); + wndClass.hCursor = LoadCursorW(nullptr, (PWSTR)IDC_ARROW); wndClass.hbrBackground = (HBRUSH)16; - wndClass.lpszMenuName = "MENU_1"; + wndClass.lpszMenuName = L"MENU_1"; wndClass.lpszClassName = windowClass; auto splash = splash::splash_screen(hInstance, "splash_bitmap", "splash_bitmap"); - RegisterClassExA(&wndClass); + RegisterClassExW(&wndClass); pinball::FindShiftKeys(); options::init_resolution(); - char windowName[40]; - lstrcpyA(windowName, pinball::get_rc_string(38, 0)); - windowHandle = CreateWindowExA(0, windowClass, windowName, WndStyle, 0, 0, 640, 480, nullptr, nullptr, hInstance, - nullptr); + auto windowName = pinball::get_rc_Wstring(38, 0); + windowHandle = CreateWindowExW(0, windowClass, windowName, + WndStyle, 0, 0, 640, 480, nullptr, nullptr, hInstance, nullptr); + hwnd_frame = windowHandle; if (!windowHandle) { @@ -329,7 +329,7 @@ int winmain::WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi gdrv::uninit(); DestroyWindow(hwnd_frame); options::path_uninit(); - UnregisterClassA(windowClass, hinst); + UnregisterClassW(windowClass, hinst); if (restart) { @@ -388,12 +388,12 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP midi::music_stop(); } - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); case WM_KILLFOCUS: has_focus = 0; gdrv::get_focus(); pb::loose_focus(); - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); case WM_CREATE: { RECT rect{}; @@ -424,18 +424,18 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP changeDisplayFg); --memory::critical_allocation; - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); } case WM_MOVE: no_time_loss = 1; - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); case WM_SETFOCUS: has_focus = 1; no_time_loss = 1; gdrv::get_focus(); fullscrn::force_redraw(); pb::paint(); - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); case WM_PAINT: { PAINTSTRUCT paint{}; @@ -451,16 +451,16 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP bQuit = 1; PostQuitMessage(0); fullscrn::shutdown(); - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); case WM_ERASEBKGND: break; case WM_SIZE: fullscrn::window_size_changed(); fullscrn::force_redraw(); pb::paint(); - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); default: - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); } return 0; } @@ -469,7 +469,7 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP { case WM_MENUSELECT: if (lParam) - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); if (fullscrn::screen_mode) fullscrn::set_menu_mode(0); return 0; @@ -477,10 +477,10 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP no_time_loss = 1; if (fullscrn::screen_mode) fullscrn::set_menu_mode(1); - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); case WM_GETMINMAXINFO: fullscrn::getminmaxinfo((MINMAXINFO*)lParam); - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); case WM_DISPLAYCHANGE: options::update_resolution_menu(); if (fullscrn::displaychange()) @@ -488,10 +488,10 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP options::Options.FullScreen = 0; options::menu_check(Menu1_Full_Screen, 0); } - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); case WM_KEYUP: pb::keyup(wParamI); - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); case WM_KEYDOWN: if (!(lParam & 0x40000000)) pb::keydown(wParamI); @@ -523,26 +523,26 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP break; } if (!pb::cheat_mode) - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); switch (wParam) { case 'H': DispGRhistory = 1; - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); case 'Y': SetWindowTextA(hWnd, "Pinball"); DispFrameRate = DispFrameRate == 0; - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); case VK_F1: pb::frame(10); - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); case VK_F15: single_step = single_step == 0; if (single_step == 0) no_time_loss = 1; - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); default: - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); } case WM_SYSCOMMAND: switch (wParam & 0xFFF0) @@ -554,17 +554,17 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP case SC_MINIMIZE: if (!single_step) pause(); - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); case SC_SCREENSAVE: fullscrn::activate(0); - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); default: break; } end_pause(); - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); case WM_INITMENU: no_time_loss = 1; - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); case WM_COMMAND: no_time_loss = 1; switch (wParam) @@ -670,7 +670,7 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP if (wParam >= Menu1_Language && wParam < Menu1_LanguageMax) options::toggle(wParamI); - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); case WM_LBUTTONDOWN: if (pb::game_mode) { @@ -686,7 +686,7 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP else pb::keydown(options::Options.LeftFlipperKey); - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); } break; case WM_LBUTTONUP: @@ -698,25 +698,25 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP } if (!pb::cheat_mode) pb::keyup(options::Options.LeftFlipperKey); - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); case WM_RBUTTONDOWN: if (!pb::cheat_mode) pb::keydown(options::Options.RightFlipperKey); if (pb::game_mode) - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); break; case WM_RBUTTONUP: if (!pb::cheat_mode) pb::keyup(options::Options.RightFlipperKey); - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); case WM_MBUTTONDOWN: pb::keydown(options::Options.PlungerKey); if (pb::game_mode) - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); break; case WM_MBUTTONUP: pb::keyup(options::Options.PlungerKey); - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); case WM_POWERBROADCAST: if (wParam == 4 && options::Options.FullScreen) { @@ -724,20 +724,20 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP options::menu_check(Menu1_Full_Screen, 0); fullscrn::set_screen_mode(options::Options.FullScreen); } - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); case WM_PALETTECHANGED: InvalidateRect(hWnd, nullptr, 0); - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); case MM_MCINOTIFY: if (wParam == 1) midi::restart_midi_seq(lParam); - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); default: - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); } pb::mode_countdown(-1); - return DefWindowProcA(hWnd, Msg, wParam, lParam); + return DefWindowProcW(hWnd, Msg, wParam, lParam); } int winmain::ProcessWindowMessages() @@ -804,14 +804,12 @@ HDC winmain::_GetDC(HWND hWnd) int winmain::a_dialog(HINSTANCE hInstance, HWND hWnd) { - char appName[100]; - char szOtherStuff[130]; + PCWSTR appName = pinball::get_rc_Wstring(38, 0); + PWSTR szOtherStuff = pinball::get_rc_Wstring(102, 0); - lstrcpyA(appName, pinball::get_rc_string(38, 0)); - lstrcpyA(szOtherStuff, pinball::get_rc_string(102, 0)); - strcat_s(szOtherStuff, " Decompilation version 1.1.2"); - auto icon = LoadIconA(hInstance, "ICON_1"); - return ShellAboutA(hWnd, appName, szOtherStuff, icon); + lstrcatW(szOtherStuff, L" Decompilation version 1.1.2"); + auto icon = LoadIconW(hInstance, L"ICON_1"); + return ShellAboutW(hWnd, appName, szOtherStuff, icon); } void winmain::end_pause()