1
0
Fork 0
mirror of https://github.com/k4zmu2a/SpaceCadetPinball.git synced 2024-11-22 00:40:18 +01:00

Compare commits

...

4 commits

Author SHA1 Message Date
Muzychenko Andrey
bd606436bd Added French translation. 2021-10-28 11:41:30 +03:00
Raymai (Chee Boon)
457a982f72
Change only a few key places to make the program works as if it's Unicode build. (#75) 2021-10-28 10:58:19 +03:00
Muzychenko Andrey
e2f10333d9 Added Japanese translation. 2021-10-28 09:56:14 +03:00
Muzychenko Andrey
356977290e Added German translation. 2021-10-28 08:56:49 +03:00
7 changed files with 119 additions and 112 deletions

View file

@ -455,6 +455,9 @@ void gdrv::grtext_draw_ttext_in_box(LPCWSTR text, int xOff, int yOff, int width,
case Languages::SimplifiedChinese: case Languages::SimplifiedChinese:
font = "Microsoft YaHei"; font = "Microsoft YaHei";
break; break;
case Languages::Japanese:
font = "MS UI Gothic";
break;
default: default:
font = "Arial"; font = "Arial";
} }

View file

@ -166,7 +166,7 @@ void high_score::show_high_score_dialog(high_score_struct* table)
dlg_enter_name = 0; dlg_enter_name = 0;
dlg_score = 0; dlg_score = 0;
dlg_hst = table; 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) 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_hst = table;
dlg_enter_name = 1; dlg_enter_name = 1;
default_name = defaultName; 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))
{ {
} }
} }

View file

@ -75,6 +75,9 @@ LanguageMenuEntry options::LanguageMenu[]
{L"简化字", Languages::SimplifiedChinese}, {L"简化字", Languages::SimplifiedChinese},
{L"正體字", Languages::TraditionalChinese}, {L"正體字", Languages::TraditionalChinese},
{L"Polski", Languages::Polish}, {L"Polski", Languages::Polish},
{L"Deutsch", Languages::German},
{L"日本", Languages::Japanese},
{L"Français", Languages::French},
}; };
void options::ReadOptions() void options::ReadOptions()
@ -432,9 +435,9 @@ void options::update_resolution_menu()
{ {
auto maxResolution = fullscrn::get_max_supported_resolution(); auto maxResolution = fullscrn::get_max_supported_resolution();
fullscrn::SetMaxResolution(maxResolution); fullscrn::SetMaxResolution(maxResolution);
const CHAR* maxResText = pinball::get_rc_string(maxResolution + 2030, 0); PCWSTR maxResText = pinball::get_rc_Wstring(maxResolution + 2030, 0);
if (MenuHandle) 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++) for (auto resIndex = 0; resIndex < 3; resIndex++)
{ {
@ -467,14 +470,14 @@ void options::init_resolution()
void options::keyboard() 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) INT_PTR _stdcall options::KeyMapDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
char keyName[20]; WCHAR keyName[20];
int keyBindings[6]; int keyBindings[6];
char rcString[256]; WCHAR rcString[256];
switch (msg) switch (msg)
{ {
@ -498,7 +501,7 @@ INT_PTR _stdcall options::KeyMapDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR
auto index = 128; auto index = 128;
do do
{ {
if (vkChar == MapVirtualKeyA(index, MAPVK_VK_TO_CHAR)) if (vkChar == MapVirtualKeyW(index, MAPVK_VK_TO_CHAR))
break; break;
++index; ++index;
} }
@ -535,30 +538,30 @@ INT_PTR _stdcall options::KeyMapDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR
{ {
if (vk2And || get_vk_key_name(curVK, keyName)) if (vk2And || get_vk_key_name(curVK, keyName))
{ {
auto ind = SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperL,CB_INSERTSTRING, -1, (LPARAM)keyName); auto ind = SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperL,CB_INSERTSTRING, -1, (LPARAM)keyName);
SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperL, CB_SETITEMDATA, ind, curVK); SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperL, CB_SETITEMDATA, ind, curVK);
if (curVK == Options.LeftFlipperKey) if (curVK == Options.LeftFlipperKey)
SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperL, CB_SETCURSEL, ind, 0); SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperL, CB_SETCURSEL, ind, 0);
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperR, CB_INSERTSTRING, -1, (LPARAM)keyName); ind = SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperR, CB_INSERTSTRING, -1, (LPARAM)keyName);
SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperR, CB_SETITEMDATA, ind, curVK); SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperR, CB_SETITEMDATA, ind, curVK);
if (curVK == Options.RightFlipperKey) if (curVK == Options.RightFlipperKey)
SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperR, CB_SETCURSEL, ind, 0); SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperR, CB_SETCURSEL, ind, 0);
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_Plunger, CB_INSERTSTRING, -1, (LPARAM)keyName); ind = SendDlgItemMessageW(hDlg, KEYMAPPER_Plunger, CB_INSERTSTRING, -1, (LPARAM)keyName);
SendDlgItemMessageA(hDlg, KEYMAPPER_Plunger, CB_SETITEMDATA, ind, curVK); SendDlgItemMessageW(hDlg, KEYMAPPER_Plunger, CB_SETITEMDATA, ind, curVK);
if (curVK == Options.PlungerKey) if (curVK == Options.PlungerKey)
SendDlgItemMessageA(hDlg, KEYMAPPER_Plunger, CB_SETCURSEL, ind, 0); SendDlgItemMessageW(hDlg, KEYMAPPER_Plunger, CB_SETCURSEL, ind, 0);
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpLeft, CB_INSERTSTRING, -1, (LPARAM)keyName); ind = SendDlgItemMessageW(hDlg, KEYMAPPER_BumpLeft, CB_INSERTSTRING, -1, (LPARAM)keyName);
SendDlgItemMessageA(hDlg, KEYMAPPER_BumpLeft, CB_SETITEMDATA, ind, curVK); SendDlgItemMessageW(hDlg, KEYMAPPER_BumpLeft, CB_SETITEMDATA, ind, curVK);
if (curVK == Options.LeftTableBumpKey) if (curVK == Options.LeftTableBumpKey)
SendDlgItemMessageA(hDlg, KEYMAPPER_BumpLeft, CB_SETCURSEL, ind, 0); SendDlgItemMessageW(hDlg, KEYMAPPER_BumpLeft, CB_SETCURSEL, ind, 0);
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpRight, CB_INSERTSTRING, -1, (LPARAM)keyName); ind = SendDlgItemMessageW(hDlg, KEYMAPPER_BumpRight, CB_INSERTSTRING, -1, (LPARAM)keyName);
SendDlgItemMessageA(hDlg, KEYMAPPER_BumpRight, CB_SETITEMDATA, ind, curVK); SendDlgItemMessageW(hDlg, KEYMAPPER_BumpRight, CB_SETITEMDATA, ind, curVK);
if (curVK == Options.RightTableBumpKey) if (curVK == Options.RightTableBumpKey)
SendDlgItemMessageA(hDlg, KEYMAPPER_BumpRight, CB_SETCURSEL, ind, 0); SendDlgItemMessageW(hDlg, KEYMAPPER_BumpRight, CB_SETCURSEL, ind, 0);
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpBottom, CB_INSERTSTRING, -1, (LPARAM)keyName); ind = SendDlgItemMessageW(hDlg, KEYMAPPER_BumpBottom, CB_INSERTSTRING, -1, (LPARAM)keyName);
SendDlgItemMessageA(hDlg, KEYMAPPER_BumpBottom, CB_SETITEMDATA, ind, curVK); SendDlgItemMessageW(hDlg, KEYMAPPER_BumpBottom, CB_SETITEMDATA, ind, curVK);
if (curVK == Options.BottomTableBumpKey) if (curVK == Options.BottomTableBumpKey)
SendDlgItemMessageA(hDlg, KEYMAPPER_BumpBottom, CB_SETCURSEL, ind, 0); SendDlgItemMessageW(hDlg, KEYMAPPER_BumpBottom, CB_SETCURSEL, ind, 0);
} }
} }
} }
@ -568,18 +571,18 @@ INT_PTR _stdcall options::KeyMapDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR
{ {
case KEYMAPPER_Ok: case KEYMAPPER_Ok:
{ {
auto ind = SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperL, CB_GETCURSEL, 0, 0); auto ind = SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperL, CB_GETCURSEL, 0, 0);
keyBindings[0] = static_cast<int>(SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperL, CB_GETITEMDATA, ind, 0)); keyBindings[0] = static_cast<int>(SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperL, CB_GETITEMDATA, ind, 0));
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperR, CB_GETCURSEL, 0, 0); ind = SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperR, CB_GETCURSEL, 0, 0);
keyBindings[1] = static_cast<int>(SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperR, CB_GETITEMDATA, ind, 0)); keyBindings[1] = static_cast<int>(SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperR, CB_GETITEMDATA, ind, 0));
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_Plunger, CB_GETCURSEL, 0, 0); ind = SendDlgItemMessageW(hDlg, KEYMAPPER_Plunger, CB_GETCURSEL, 0, 0);
keyBindings[2] = static_cast<int>(SendDlgItemMessageA(hDlg, KEYMAPPER_Plunger, CB_GETITEMDATA, ind, 0)); keyBindings[2] = static_cast<int>(SendDlgItemMessageW(hDlg, KEYMAPPER_Plunger, CB_GETITEMDATA, ind, 0));
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpLeft, CB_GETCURSEL, 0, 0); ind = SendDlgItemMessageW(hDlg, KEYMAPPER_BumpLeft, CB_GETCURSEL, 0, 0);
keyBindings[3] = static_cast<int>(SendDlgItemMessageA(hDlg, KEYMAPPER_BumpLeft, CB_GETITEMDATA, ind, 0)); keyBindings[3] = static_cast<int>(SendDlgItemMessageW(hDlg, KEYMAPPER_BumpLeft, CB_GETITEMDATA, ind, 0));
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpRight, CB_GETCURSEL, 0, 0); ind = SendDlgItemMessageW(hDlg, KEYMAPPER_BumpRight, CB_GETCURSEL, 0, 0);
keyBindings[4] = static_cast<int>(SendDlgItemMessageA(hDlg, KEYMAPPER_BumpRight, CB_GETITEMDATA, ind, 0)); keyBindings[4] = static_cast<int>(SendDlgItemMessageW(hDlg, KEYMAPPER_BumpRight, CB_GETITEMDATA, ind, 0));
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpBottom, CB_GETCURSEL, 0, 0); ind = SendDlgItemMessageW(hDlg, KEYMAPPER_BumpBottom, CB_GETCURSEL, 0, 0);
keyBindings[5] = static_cast<int>(SendDlgItemMessageA(hDlg, KEYMAPPER_BumpBottom, CB_GETITEMDATA, ind, 0)); keyBindings[5] = static_cast<int>(SendDlgItemMessageW(hDlg, KEYMAPPER_BumpBottom, CB_GETITEMDATA, ind, 0));
auto sameKeyBound = 0; auto sameKeyBound = 0;
auto index = 1; auto index = 1;
@ -592,8 +595,8 @@ INT_PTR _stdcall options::KeyMapDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR
break; break;
if (*optPtr == keyBindings[keyInd]) if (*optPtr == keyBindings[keyInd])
{ {
lstrcpyA(rcString, pinball::get_rc_string(43, 0)); lstrcpyW(rcString, pinball::get_rc_Wstring(43, 0));
MessageBoxA(hDlg, pinball::get_rc_string(39, 0), rcString, 0x2000u); MessageBoxW(hDlg, pinball::get_rc_Wstring(39, 0), rcString, 0x2000u);
sameKeyBound = 1; sameKeyBound = 1;
} }
} }
@ -621,23 +624,23 @@ INT_PTR _stdcall options::KeyMapDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR
case KEYMAPPER_Default: case KEYMAPPER_Default:
{ {
auto name = (LPARAM)get_vk_key_name(Options.LeftFlipperKeyDft, keyName); auto name = (LPARAM)get_vk_key_name(Options.LeftFlipperKeyDft, keyName);
auto ind = SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperL, CB_FINDSTRINGEXACT, 0, name); auto ind = SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperL, CB_FINDSTRINGEXACT, 0, name);
SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperL, CB_SETCURSEL, ind, 0); SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperL, CB_SETCURSEL, ind, 0);
name = (LPARAM)get_vk_key_name(Options.RightFlipperKeyDft, keyName); name = (LPARAM)get_vk_key_name(Options.RightFlipperKeyDft, keyName);
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperR, CB_FINDSTRINGEXACT, 0, name); ind = SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperR, CB_FINDSTRINGEXACT, 0, name);
SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperR, CB_SETCURSEL, ind, 0); SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperR, CB_SETCURSEL, ind, 0);
name = (LPARAM)get_vk_key_name(Options.PlungerKeyDft, keyName); name = (LPARAM)get_vk_key_name(Options.PlungerKeyDft, keyName);
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_Plunger, CB_FINDSTRINGEXACT, 0, name); ind = SendDlgItemMessageW(hDlg, KEYMAPPER_Plunger, CB_FINDSTRINGEXACT, 0, name);
SendDlgItemMessageA(hDlg, KEYMAPPER_Plunger, CB_SETCURSEL, ind, 0); SendDlgItemMessageW(hDlg, KEYMAPPER_Plunger, CB_SETCURSEL, ind, 0);
name = (LPARAM)get_vk_key_name(Options.LeftTableBumpKeyDft, keyName); name = (LPARAM)get_vk_key_name(Options.LeftTableBumpKeyDft, keyName);
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpLeft, CB_FINDSTRINGEXACT, 0, name); ind = SendDlgItemMessageW(hDlg, KEYMAPPER_BumpLeft, CB_FINDSTRINGEXACT, 0, name);
SendDlgItemMessageA(hDlg, KEYMAPPER_BumpLeft, CB_SETCURSEL, ind, 0); SendDlgItemMessageW(hDlg, KEYMAPPER_BumpLeft, CB_SETCURSEL, ind, 0);
name = (LPARAM)get_vk_key_name(Options.RightTableBumpKeyDft, keyName); name = (LPARAM)get_vk_key_name(Options.RightTableBumpKeyDft, keyName);
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpRight, CB_FINDSTRINGEXACT, 0, name); ind = SendDlgItemMessageW(hDlg, KEYMAPPER_BumpRight, CB_FINDSTRINGEXACT, 0, name);
SendDlgItemMessageA(hDlg, KEYMAPPER_BumpRight, CB_SETCURSEL, ind, 0); SendDlgItemMessageW(hDlg, KEYMAPPER_BumpRight, CB_SETCURSEL, ind, 0);
name = (LPARAM)get_vk_key_name(Options.BottomTableBumpKeyDft, keyName); name = (LPARAM)get_vk_key_name(Options.BottomTableBumpKeyDft, keyName);
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpBottom, CB_FINDSTRINGEXACT, 0, name); ind = SendDlgItemMessageW(hDlg, KEYMAPPER_BumpBottom, CB_FINDSTRINGEXACT, 0, name);
SendDlgItemMessageA(hDlg, KEYMAPPER_BumpBottom, CB_SETCURSEL, ind, 0); SendDlgItemMessageW(hDlg, KEYMAPPER_BumpBottom, CB_SETCURSEL, ind, 0);
return 0; return 0;
} }
default: default:
@ -651,10 +654,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) if (vk >= 0x21u && vk <= 0x2Eu)
scanCode |= 0x1000000u; scanCode |= 0x1000000u;
return GetKeyNameTextA(scanCode, keyName, 19) != 0 ? keyName : nullptr; return GetKeyNameTextW(scanCode, keyName, 19) != 0 ? keyName : nullptr;
} }

View file

@ -9,6 +9,9 @@ enum class Languages
TraditionalChinese = MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL), TraditionalChinese = MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL),
SimplifiedChinese = MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED), SimplifiedChinese = MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED),
Polish = MAKELANGID(LANG_POLISH, SUBLANG_POLISH_POLAND), Polish = MAKELANGID(LANG_POLISH, SUBLANG_POLISH_POLAND),
German = MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN),
Japanese = MAKELANGID(LANG_JAPANESE, SUBLANG_JAPANESE_JAPAN),
French = MAKELANGID(LANG_FRENCH, SUBLANG_FRENCH),
}; };
struct LanguageMenuEntry struct LanguageMenuEntry
@ -64,7 +67,7 @@ public:
static void keyboard(); static void keyboard();
static INT_PTR _stdcall KeyMapDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam); 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; static optionsStruct Options;
private: private:

View file

@ -242,7 +242,7 @@
#define DLG_HIGHSCORES_EditName5 605 #define DLG_HIGHSCORES_EditName5 605
#define Menu1_AlternativeRender 601 #define Menu1_AlternativeRender 601
#define Menu1_Language 700 #define Menu1_Language 700
#define Menu1_LanguageMax 705 #define Menu1_LanguageMax 708
// Next default values for new objects // Next default values for new objects
// //

View file

@ -131,11 +131,11 @@ int winmain::WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
} }
iFrostUniqueMsg = RegisterWindowMessageA("PinballThemeSwitcherUniqueMsgString"); iFrostUniqueMsg = RegisterWindowMessageA("PinballThemeSwitcherUniqueMsgString");
auto windowClass = pinball::get_rc_string(167, 0); auto windowClass = pinball::get_rc_Wstring(167, 0);
auto windowHandle = FindWindowA(windowClass, nullptr); auto windowHandle = FindWindowW(windowClass, nullptr);
if (windowHandle) if (windowHandle)
{ {
SendMessageA(windowHandle, iFrostUniqueMsg, 0, 0); SendMessageW(windowHandle, iFrostUniqueMsg, 0, 0);
return 0; return 0;
} }
@ -147,28 +147,28 @@ int winmain::WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
picce.dwICC = 5885; picce.dwICC = 5885;
InitCommonControlsEx(&picce); InitCommonControlsEx(&picce);
WNDCLASSEXA wndClass{}; WNDCLASSEXW wndClass{};
wndClass.cbSize = sizeof wndClass; wndClass.cbSize = sizeof wndClass;
wndClass.style = CS_DBLCLKS | CS_BYTEALIGNCLIENT; wndClass.style = CS_DBLCLKS | CS_BYTEALIGNCLIENT;
wndClass.lpfnWndProc = message_handler; wndClass.lpfnWndProc = message_handler;
wndClass.cbClsExtra = 0; wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = 0; wndClass.cbWndExtra = 0;
wndClass.hInstance = hInstance; wndClass.hInstance = hInstance;
wndClass.hIcon = LoadIconA(hInstance, "ICON_1"); wndClass.hIcon = LoadIconW(hInstance, L"ICON_1");
wndClass.hCursor = LoadCursorA(nullptr, IDC_ARROW); wndClass.hCursor = LoadCursorW(nullptr, (PWSTR)IDC_ARROW);
wndClass.hbrBackground = (HBRUSH)16; wndClass.hbrBackground = (HBRUSH)16;
wndClass.lpszMenuName = "MENU_1"; wndClass.lpszMenuName = L"MENU_1";
wndClass.lpszClassName = windowClass; wndClass.lpszClassName = windowClass;
auto splash = splash::splash_screen(hInstance, "splash_bitmap", "splash_bitmap"); auto splash = splash::splash_screen(hInstance, "splash_bitmap", "splash_bitmap");
RegisterClassExA(&wndClass); RegisterClassExW(&wndClass);
pinball::FindShiftKeys(); pinball::FindShiftKeys();
options::init_resolution(); options::init_resolution();
char windowName[40]; auto windowName = pinball::get_rc_Wstring(38, 0);
lstrcpyA(windowName, pinball::get_rc_string(38, 0)); windowHandle = CreateWindowExW(0, windowClass, windowName,
windowHandle = CreateWindowExA(0, windowClass, windowName, WndStyle, 0, 0, 640, 480, nullptr, nullptr, hInstance, WndStyle, 0, 0, 640, 480, nullptr, nullptr, hInstance, nullptr);
nullptr);
hwnd_frame = windowHandle; hwnd_frame = windowHandle;
if (!windowHandle) if (!windowHandle)
{ {
@ -329,7 +329,7 @@ int winmain::WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
gdrv::uninit(); gdrv::uninit();
DestroyWindow(hwnd_frame); DestroyWindow(hwnd_frame);
options::path_uninit(); options::path_uninit();
UnregisterClassA(windowClass, hinst); UnregisterClassW(windowClass, hinst);
if (restart) if (restart)
{ {
@ -388,12 +388,12 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
midi::music_stop(); midi::music_stop();
} }
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_KILLFOCUS: case WM_KILLFOCUS:
has_focus = 0; has_focus = 0;
gdrv::get_focus(); gdrv::get_focus();
pb::loose_focus(); pb::loose_focus();
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_CREATE: case WM_CREATE:
{ {
RECT rect{}; RECT rect{};
@ -424,18 +424,18 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
changeDisplayFg); changeDisplayFg);
--memory::critical_allocation; --memory::critical_allocation;
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
} }
case WM_MOVE: case WM_MOVE:
no_time_loss = 1; no_time_loss = 1;
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_SETFOCUS: case WM_SETFOCUS:
has_focus = 1; has_focus = 1;
no_time_loss = 1; no_time_loss = 1;
gdrv::get_focus(); gdrv::get_focus();
fullscrn::force_redraw(); fullscrn::force_redraw();
pb::paint(); pb::paint();
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_PAINT: case WM_PAINT:
{ {
PAINTSTRUCT paint{}; PAINTSTRUCT paint{};
@ -451,16 +451,16 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
bQuit = 1; bQuit = 1;
PostQuitMessage(0); PostQuitMessage(0);
fullscrn::shutdown(); fullscrn::shutdown();
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_ERASEBKGND: case WM_ERASEBKGND:
break; break;
case WM_SIZE: case WM_SIZE:
fullscrn::window_size_changed(); fullscrn::window_size_changed();
fullscrn::force_redraw(); fullscrn::force_redraw();
pb::paint(); pb::paint();
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
default: default:
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
} }
return 0; return 0;
} }
@ -469,7 +469,7 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
{ {
case WM_MENUSELECT: case WM_MENUSELECT:
if (lParam) if (lParam)
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
if (fullscrn::screen_mode) if (fullscrn::screen_mode)
fullscrn::set_menu_mode(0); fullscrn::set_menu_mode(0);
return 0; return 0;
@ -477,10 +477,10 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
no_time_loss = 1; no_time_loss = 1;
if (fullscrn::screen_mode) if (fullscrn::screen_mode)
fullscrn::set_menu_mode(1); fullscrn::set_menu_mode(1);
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_GETMINMAXINFO: case WM_GETMINMAXINFO:
fullscrn::getminmaxinfo((MINMAXINFO*)lParam); fullscrn::getminmaxinfo((MINMAXINFO*)lParam);
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_DISPLAYCHANGE: case WM_DISPLAYCHANGE:
options::update_resolution_menu(); options::update_resolution_menu();
if (fullscrn::displaychange()) if (fullscrn::displaychange())
@ -488,10 +488,10 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
options::Options.FullScreen = 0; options::Options.FullScreen = 0;
options::menu_check(Menu1_Full_Screen, 0); options::menu_check(Menu1_Full_Screen, 0);
} }
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_KEYUP: case WM_KEYUP:
pb::keyup(wParamI); pb::keyup(wParamI);
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_KEYDOWN: case WM_KEYDOWN:
if (!(lParam & 0x40000000)) if (!(lParam & 0x40000000))
pb::keydown(wParamI); pb::keydown(wParamI);
@ -523,26 +523,26 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
break; break;
} }
if (!pb::cheat_mode) if (!pb::cheat_mode)
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
switch (wParam) switch (wParam)
{ {
case 'H': case 'H':
DispGRhistory = 1; DispGRhistory = 1;
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
case 'Y': case 'Y':
SetWindowTextA(hWnd, "Pinball"); SetWindowTextA(hWnd, "Pinball");
DispFrameRate = DispFrameRate == 0; DispFrameRate = DispFrameRate == 0;
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
case VK_F1: case VK_F1:
pb::frame(10); pb::frame(10);
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
case VK_F15: case VK_F15:
single_step = single_step == 0; single_step = single_step == 0;
if (single_step == 0) if (single_step == 0)
no_time_loss = 1; no_time_loss = 1;
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
default: default:
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
} }
case WM_SYSCOMMAND: case WM_SYSCOMMAND:
switch (wParam & 0xFFF0) switch (wParam & 0xFFF0)
@ -554,17 +554,17 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
case SC_MINIMIZE: case SC_MINIMIZE:
if (!single_step) if (!single_step)
pause(); pause();
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
case SC_SCREENSAVE: case SC_SCREENSAVE:
fullscrn::activate(0); fullscrn::activate(0);
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
default: break; default: break;
} }
end_pause(); end_pause();
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_INITMENU: case WM_INITMENU:
no_time_loss = 1; no_time_loss = 1;
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_COMMAND: case WM_COMMAND:
no_time_loss = 1; no_time_loss = 1;
switch (wParam) 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) if (wParam >= Menu1_Language && wParam < Menu1_LanguageMax)
options::toggle(wParamI); options::toggle(wParamI);
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
if (pb::game_mode) if (pb::game_mode)
{ {
@ -686,7 +686,7 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
else else
pb::keydown(options::Options.LeftFlipperKey); pb::keydown(options::Options.LeftFlipperKey);
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
} }
break; break;
case WM_LBUTTONUP: case WM_LBUTTONUP:
@ -698,25 +698,25 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
} }
if (!pb::cheat_mode) if (!pb::cheat_mode)
pb::keyup(options::Options.LeftFlipperKey); pb::keyup(options::Options.LeftFlipperKey);
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_RBUTTONDOWN: case WM_RBUTTONDOWN:
if (!pb::cheat_mode) if (!pb::cheat_mode)
pb::keydown(options::Options.RightFlipperKey); pb::keydown(options::Options.RightFlipperKey);
if (pb::game_mode) if (pb::game_mode)
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
break; break;
case WM_RBUTTONUP: case WM_RBUTTONUP:
if (!pb::cheat_mode) if (!pb::cheat_mode)
pb::keyup(options::Options.RightFlipperKey); pb::keyup(options::Options.RightFlipperKey);
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_MBUTTONDOWN: case WM_MBUTTONDOWN:
pb::keydown(options::Options.PlungerKey); pb::keydown(options::Options.PlungerKey);
if (pb::game_mode) if (pb::game_mode)
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
break; break;
case WM_MBUTTONUP: case WM_MBUTTONUP:
pb::keyup(options::Options.PlungerKey); pb::keyup(options::Options.PlungerKey);
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_POWERBROADCAST: case WM_POWERBROADCAST:
if (wParam == 4 && options::Options.FullScreen) 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); options::menu_check(Menu1_Full_Screen, 0);
fullscrn::set_screen_mode(options::Options.FullScreen); fullscrn::set_screen_mode(options::Options.FullScreen);
} }
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_PALETTECHANGED: case WM_PALETTECHANGED:
InvalidateRect(hWnd, nullptr, 0); InvalidateRect(hWnd, nullptr, 0);
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
case MM_MCINOTIFY: case MM_MCINOTIFY:
if (wParam == 1) if (wParam == 1)
midi::restart_midi_seq(lParam); midi::restart_midi_seq(lParam);
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
default: default:
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
} }
pb::mode_countdown(-1); pb::mode_countdown(-1);
return DefWindowProcA(hWnd, Msg, wParam, lParam); return DefWindowProcW(hWnd, Msg, wParam, lParam);
} }
int winmain::ProcessWindowMessages() int winmain::ProcessWindowMessages()
@ -804,14 +804,12 @@ HDC winmain::_GetDC(HWND hWnd)
int winmain::a_dialog(HINSTANCE hInstance, HWND hWnd) int winmain::a_dialog(HINSTANCE hInstance, HWND hWnd)
{ {
char appName[100]; PCWSTR appName = pinball::get_rc_Wstring(38, 0);
char szOtherStuff[130]; PWSTR szOtherStuff = pinball::get_rc_Wstring(102, 0);
lstrcpyA(appName, pinball::get_rc_string(38, 0)); lstrcatW(szOtherStuff, L" Decompilation version 1.1.2");
lstrcpyA(szOtherStuff, pinball::get_rc_string(102, 0)); auto icon = LoadIconW(hInstance, L"ICON_1");
strcat_s(szOtherStuff, " Decompilation version 1.1.2"); return ShellAboutW(hWnd, appName, szOtherStuff, icon);
auto icon = LoadIconA(hInstance, "ICON_1");
return ShellAboutA(hWnd, appName, szOtherStuff, icon);
} }
void winmain::end_pause() void winmain::end_pause()