Removed windows.h dependency.
Added support for music in MDS format.
This commit is contained in:
1 parent
e0638c598d
commit
2fe6d6d33a
20 files changed
+386
-910
No files matched your search
+17
-286
@@ -11,7 +11,6 @@
|
||||
|
||||
LPCSTR options::OptionsRegPath;
|
||||
LPSTR options::OptionsRegPathCur;
|
||||
HMENU options::MenuHandle;
|
||||
optionsStruct options::Options{};
|
||||
|
||||
winhelp_entry options::keymap_help[18]
|
||||
@@ -68,14 +67,12 @@ short options::vk_list[28]
|
||||
-1
|
||||
};
|
||||
|
||||
void options::init(HMENU menuHandle)
|
||||
void options::init()
|
||||
{
|
||||
MenuHandle = menuHandle;
|
||||
Options.Sounds = 1;
|
||||
Options.Music = 0;
|
||||
Options.FullScreen = 0;
|
||||
Options.Average = 5;
|
||||
Options.PriorityAdj = 2;
|
||||
Options.LeftFlipperKeyDft = SDLK_z;
|
||||
Options.RightFlipperKeyDft = SDLK_SLASH;
|
||||
Options.PlungerKeyDft = SDLK_SPACE;
|
||||
@@ -109,29 +106,7 @@ void options::init(HMENU menuHandle)
|
||||
Options.RightTableBumpKey = get_int(nullptr, "Right Table Bump key", Options.RightTableBumpKey);
|
||||
Options.BottomTableBumpKey = get_int(nullptr, "Bottom Table Bump key", Options.BottomTableBumpKey);
|
||||
Options.UniformScaling = get_int(nullptr, "Uniform scaling", true);*/
|
||||
menu_check(Menu1_Sounds, Options.Sounds);
|
||||
Sound::Enable(0, 7, Options.Sounds);
|
||||
menu_check(Menu1_Music, Options.Music);
|
||||
menu_check(Menu1_Full_Screen, Options.FullScreen);
|
||||
menu_check(Menu1_1Player, Options.Players == 1);
|
||||
menu_check(Menu1_2Players, Options.Players == 2);
|
||||
menu_check(Menu1_3Players, Options.Players == 3);
|
||||
menu_check(Menu1_4Players, Options.Players == 4);
|
||||
menu_check(Menu1_WindowUniformScale, Options.UniformScaling);
|
||||
auto tmpBuf = memory::allocate(0x1F4u);
|
||||
if (tmpBuf)
|
||||
{
|
||||
get_string(nullptr, "Shell Exe", tmpBuf, "", 500);
|
||||
if (!*tmpBuf)
|
||||
{
|
||||
if (MenuHandle)
|
||||
{
|
||||
DeleteMenu(MenuHandle, Menu1_Select_Table, 0);
|
||||
DrawMenuBar(nullptr);
|
||||
}
|
||||
}
|
||||
memory::free(tmpBuf);
|
||||
}
|
||||
|
||||
update_resolution_menu();
|
||||
}
|
||||
@@ -154,10 +129,10 @@ void options::uninit()
|
||||
|
||||
void options::path_init(LPCSTR regPath)
|
||||
{
|
||||
char* buf = memory::allocate(lstrlenA(regPath) + 1);
|
||||
char* buf = memory::allocate(strlen(regPath) + 1);
|
||||
OptionsRegPath = buf;
|
||||
if (buf)
|
||||
lstrcpyA(buf, regPath);
|
||||
strcpy_s(buf, strlen(regPath) + 1, regPath);
|
||||
}
|
||||
|
||||
void options::path_uninit()
|
||||
@@ -172,16 +147,16 @@ LPCSTR options::path(LPCSTR regPath)
|
||||
char* buf = OptionsRegPathCur;
|
||||
if (!OptionsRegPathCur)
|
||||
{
|
||||
buf = memory::allocate(0x7D0u);
|
||||
buf = memory::allocate(2000);
|
||||
OptionsRegPathCur = buf;
|
||||
if (!buf)
|
||||
return OptionsRegPath;
|
||||
}
|
||||
lstrcpyA(buf, OptionsRegPath);
|
||||
strcpy_s(buf, 2000, OptionsRegPath);
|
||||
if (!regPath)
|
||||
return OptionsRegPathCur;
|
||||
lstrcatA(OptionsRegPathCur, "\\");
|
||||
lstrcatA(OptionsRegPathCur, regPath);
|
||||
strcat_s(OptionsRegPathCur, 2000, "\\");
|
||||
strcat_s(OptionsRegPathCur, 2000, regPath);
|
||||
return OptionsRegPathCur;
|
||||
}
|
||||
|
||||
@@ -195,92 +170,45 @@ void options::path_free()
|
||||
|
||||
int options::get_int(LPCSTR optPath, LPCSTR lpValueName, int defaultValue)
|
||||
{
|
||||
DWORD dwDisposition;
|
||||
HKEY hKey;
|
||||
|
||||
auto result = defaultValue;
|
||||
if (!OptionsRegPath)
|
||||
return result;
|
||||
|
||||
auto regPath = path(optPath);
|
||||
if (!RegCreateKeyExA(HKEY_CURRENT_USER, regPath, 0, nullptr, 0, KEY_ALL_ACCESS, nullptr, &hKey, &dwDisposition))
|
||||
{
|
||||
DWORD bufferSize = 4;
|
||||
RegQueryValueExA(hKey, lpValueName, nullptr, nullptr, reinterpret_cast<LPBYTE>(&result), &bufferSize);
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
path_free();
|
||||
return result;
|
||||
}
|
||||
|
||||
void options::set_int(LPCSTR optPath, LPCSTR lpValueName, int data)
|
||||
{
|
||||
DWORD dwDisposition;
|
||||
HKEY hKey;
|
||||
|
||||
if (!OptionsRegPath)
|
||||
return;
|
||||
|
||||
auto regPath = path(optPath);
|
||||
if (!RegCreateKeyExA(HKEY_CURRENT_USER, regPath, 0, nullptr, 0, KEY_ALL_ACCESS, nullptr, &hKey, &dwDisposition))
|
||||
{
|
||||
RegSetValueExA(hKey, lpValueName, 0, 4u, reinterpret_cast<LPBYTE>(&data), 4u);
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
auto regPath = path(optPath);
|
||||
path_free();
|
||||
}
|
||||
|
||||
void options::get_string(LPCSTR optPath, LPCSTR lpValueName, LPSTR dst, LPCSTR defaultValue, int iMaxLength)
|
||||
{
|
||||
DWORD dwDisposition;
|
||||
HKEY hKey;
|
||||
|
||||
lstrcpynA(dst, defaultValue, iMaxLength);
|
||||
strncpy_s(dst, iMaxLength, defaultValue, iMaxLength);
|
||||
if (!OptionsRegPath)
|
||||
return;
|
||||
|
||||
auto regPath = path(optPath);
|
||||
if (!RegCreateKeyExA(HKEY_CURRENT_USER, regPath, 0, nullptr, 0, KEY_ALL_ACCESS, nullptr, &hKey, &dwDisposition))
|
||||
{
|
||||
DWORD bufferSize = iMaxLength;
|
||||
RegQueryValueExA(hKey, lpValueName, nullptr, nullptr, reinterpret_cast<LPBYTE>(dst), &bufferSize);
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
auto regPath = path(optPath);
|
||||
path_free();
|
||||
}
|
||||
|
||||
void options::set_string(LPCSTR optPath, LPCSTR lpValueName, LPCSTR value)
|
||||
{
|
||||
DWORD dwDisposition;
|
||||
HKEY hKey;
|
||||
|
||||
if (!OptionsRegPath)
|
||||
return;
|
||||
|
||||
auto regPath = path(optPath);
|
||||
if (!RegCreateKeyExA(HKEY_CURRENT_USER, regPath, 0, nullptr, 0, KEY_ALL_ACCESS, nullptr, &hKey, &dwDisposition))
|
||||
{
|
||||
RegSetValueExA(hKey, lpValueName, 0, 1u, LPBYTE(value), lstrlenA(value) + 1);
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
auto regPath = path(optPath);
|
||||
path_free();
|
||||
}
|
||||
|
||||
|
||||
void options::menu_check(UINT uIDCheckItem, int check)
|
||||
{
|
||||
if (MenuHandle)
|
||||
CheckMenuItem(MenuHandle, uIDCheckItem, check != 0 ? 8 : 0);
|
||||
}
|
||||
|
||||
void options::menu_set(UINT uIDEnableItem, int enable)
|
||||
{
|
||||
if (MenuHandle)
|
||||
EnableMenuItem(MenuHandle, uIDEnableItem, enable == 0);
|
||||
}
|
||||
|
||||
|
||||
void options::toggle(UINT uIDCheckItem)
|
||||
void options::toggle(uint32_t uIDCheckItem)
|
||||
{
|
||||
int newValue;
|
||||
switch (uIDCheckItem)
|
||||
@@ -289,7 +217,6 @@ void options::toggle(UINT uIDCheckItem)
|
||||
newValue = Options.Sounds == 0;
|
||||
Options.Sounds = Options.Sounds == 0;
|
||||
Sound::Enable(0, 7, newValue);
|
||||
menu_check(uIDCheckItem, newValue);
|
||||
return;
|
||||
case Menu1_Music:
|
||||
newValue = Options.Music == 0;
|
||||
@@ -298,31 +225,25 @@ void options::toggle(UINT uIDCheckItem)
|
||||
midi::music_stop();
|
||||
else
|
||||
midi::play_pb_theme(0);
|
||||
menu_check(uIDCheckItem, newValue);
|
||||
return;
|
||||
case Menu1_Full_Screen:
|
||||
newValue = Options.FullScreen == 0;
|
||||
Options.FullScreen = Options.FullScreen == 0;
|
||||
fullscrn::set_screen_mode(newValue);
|
||||
menu_check(uIDCheckItem, newValue);
|
||||
return;
|
||||
case Menu1_1Player:
|
||||
case Menu1_2Players:
|
||||
case Menu1_3Players:
|
||||
case Menu1_4Players:
|
||||
Options.Players = uIDCheckItem - Menu1_1Player + 1;
|
||||
menu_check(Menu1_1Player, Options.Players == 1);
|
||||
menu_check(Menu1_2Players, Options.Players == 2);
|
||||
menu_check(Menu1_3Players, Options.Players == 3);
|
||||
menu_check(Menu1_4Players, Options.Players == 4);
|
||||
break;
|
||||
case Menu1_MaximumResolution:
|
||||
case Menu1_640x480:
|
||||
case Menu1_800x600:
|
||||
case Menu1_1024x768:
|
||||
{
|
||||
for (unsigned i = Menu1_MaximumResolution; i <= Menu1_1024x768; ++i)
|
||||
menu_check(i, i == uIDCheckItem);
|
||||
/*for (unsigned i = Menu1_MaximumResolution; i <= Menu1_1024x768; ++i)
|
||||
menu_check(i, i == uIDCheckItem);*/
|
||||
|
||||
int newResolution = uIDCheckItem - Menu1_640x480;
|
||||
if (uIDCheckItem == Menu1_MaximumResolution)
|
||||
@@ -340,7 +261,6 @@ void options::toggle(UINT uIDCheckItem)
|
||||
}
|
||||
case Menu1_WindowUniformScale:
|
||||
Options.UniformScaling ^= true;
|
||||
menu_check(Menu1_WindowUniformScale, Options.UniformScaling);
|
||||
fullscrn::window_size_changed();
|
||||
pb::paint();
|
||||
break;
|
||||
@@ -353,8 +273,8 @@ 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);
|
||||
if (MenuHandle)
|
||||
const char* maxResText = pinball::get_rc_string(maxResolution + 2030, 0);
|
||||
/*if (MenuHandle)
|
||||
ModifyMenuA(MenuHandle, Menu1_MaximumResolution, 0, Menu1_MaximumResolution, maxResText);
|
||||
|
||||
for (auto resIndex = 0; resIndex < 3; resIndex++)
|
||||
@@ -368,7 +288,7 @@ void options::update_resolution_menu()
|
||||
if (Options.Resolution >= 0)
|
||||
menu_check(fullscrn::resolution_array[fullscrn::GetResolution()].ResolutionMenuId, 1);
|
||||
else
|
||||
menu_check(Menu1_MaximumResolution, 1);
|
||||
menu_check(Menu1_MaximumResolution, 1);*/
|
||||
}
|
||||
|
||||
void options::init_resolution()
|
||||
@@ -390,192 +310,3 @@ void options::keyboard()
|
||||
{
|
||||
//DialogBoxParamA(nullptr, "KEYMAPPER", nullptr, KeyMapDlgProc, 0);
|
||||
}
|
||||
|
||||
INT_PTR _stdcall options::KeyMapDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
char keyName[20];
|
||||
int keyBindings[6];
|
||||
char rcString[256];
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case WM_HELP:
|
||||
WinHelpA(static_cast<HWND>(reinterpret_cast<HELPINFO*>(lParam)->hItemHandle), "pinball.hlp", HELP_WM_HELP,
|
||||
(ULONG_PTR)keymap_help);
|
||||
return 1;
|
||||
case WM_CONTEXTMENU:
|
||||
WinHelpA((HWND)wParam, "pinball.hlp", HELP_CONTEXTMENU, (ULONG_PTR)keymap_help);
|
||||
return 1;
|
||||
case WM_INITDIALOG:
|
||||
for (auto vkPtr = vk_list; *vkPtr != -1; vkPtr++)
|
||||
{
|
||||
short vk = *vkPtr;
|
||||
auto vk2And = vk & 0x4000;
|
||||
auto vkChar = static_cast<uint8_t>(vk);
|
||||
unsigned short maxVk;
|
||||
|
||||
if (vk2And)
|
||||
{
|
||||
auto index = 128;
|
||||
do
|
||||
{
|
||||
if (vkChar == MapVirtualKeyA(index, MAPVK_VK_TO_CHAR))
|
||||
break;
|
||||
++index;
|
||||
}
|
||||
while (index < 256);
|
||||
|
||||
if (index == 256)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
keyName[0] = static_cast<char>(vkChar);
|
||||
keyName[1] = 0;
|
||||
vkChar = index;
|
||||
maxVk = index;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (vk >= 0)
|
||||
{
|
||||
maxVk = vkChar;
|
||||
}
|
||||
else
|
||||
{
|
||||
++vkPtr;
|
||||
maxVk = *vkPtr;
|
||||
}
|
||||
if (vkChar > maxVk)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
for (int curVK = vkChar; curVK <= maxVk; curVK++)
|
||||
{
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
if (curVK == Options.BottomTableBumpKey)
|
||||
SendDlgItemMessageA(hDlg, KEYMAPPER_BumpBottom, CB_SETCURSEL, ind, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
case WM_COMMAND:
|
||||
switch (wParam)
|
||||
{
|
||||
case KEYMAPPER_Ok:
|
||||
{
|
||||
auto ind = SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperL, CB_GETCURSEL, 0, 0);
|
||||
keyBindings[0] = static_cast<int>(SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperL, CB_GETITEMDATA, ind, 0));
|
||||
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperR, CB_GETCURSEL, 0, 0);
|
||||
keyBindings[1] = static_cast<int>(SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperR, CB_GETITEMDATA, ind, 0));
|
||||
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_Plunger, CB_GETCURSEL, 0, 0);
|
||||
keyBindings[2] = static_cast<int>(SendDlgItemMessageA(hDlg, KEYMAPPER_Plunger, CB_GETITEMDATA, ind, 0));
|
||||
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpLeft, CB_GETCURSEL, 0, 0);
|
||||
keyBindings[3] = static_cast<int>(SendDlgItemMessageA(hDlg, KEYMAPPER_BumpLeft, CB_GETITEMDATA, ind, 0));
|
||||
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpRight, CB_GETCURSEL, 0, 0);
|
||||
keyBindings[4] = static_cast<int>(SendDlgItemMessageA(hDlg, KEYMAPPER_BumpRight, CB_GETITEMDATA, ind, 0));
|
||||
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpBottom, CB_GETCURSEL, 0, 0);
|
||||
keyBindings[5] = static_cast<int>(SendDlgItemMessageA(hDlg, KEYMAPPER_BumpBottom, CB_GETITEMDATA, ind, 0));
|
||||
|
||||
auto sameKeyBound = 0;
|
||||
auto index = 1;
|
||||
auto optPtr = keyBindings;
|
||||
while (!sameKeyBound)
|
||||
{
|
||||
for (auto keyInd = index; keyInd < 6; keyInd++)
|
||||
{
|
||||
if (sameKeyBound)
|
||||
break;
|
||||
if (*optPtr == keyBindings[keyInd])
|
||||
{
|
||||
lstrcpyA(rcString, pinball::get_rc_string(43, 0));
|
||||
MessageBoxA(hDlg, pinball::get_rc_string(39, 0), rcString, 0x2000u);
|
||||
sameKeyBound = 1;
|
||||
}
|
||||
}
|
||||
++index;
|
||||
++optPtr;
|
||||
if (index - 1 >= 5)
|
||||
{
|
||||
if (sameKeyBound)
|
||||
return 1;
|
||||
Options.LeftFlipperKey = keyBindings[0];
|
||||
Options.RightFlipperKey = keyBindings[1];
|
||||
Options.PlungerKey = keyBindings[2];
|
||||
Options.LeftTableBumpKey = keyBindings[3];
|
||||
Options.RightTableBumpKey = keyBindings[4];
|
||||
Options.BottomTableBumpKey = keyBindings[5];
|
||||
EndDialog(hDlg, wParam);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
case KEYMAPPER_Cancel:
|
||||
EndDialog(hDlg, wParam);
|
||||
return 1;
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
LPSTR options::get_vk_key_name(uint16_t vk, LPSTR keyName)
|
||||
{
|
||||
LONG scanCode = MapVirtualKeyA(vk, MAPVK_VK_TO_VSC) << 16;
|
||||
if (vk >= 0x21u && vk <= 0x2Eu)
|
||||
scanCode |= 0x1000000u;
|
||||
return GetKeyNameTextA(scanCode, keyName, 19) != 0 ? keyName : nullptr;
|
||||
}
|
||||
Reference in new issue
Block a user