mirror of
https://github.com/holub/mame
synced 2025-07-03 09:06:08 +03:00
Fix key names with -keyboardprovider win32
This commit is contained in:
parent
84288bb15c
commit
51f33cf106
@ -14,12 +14,14 @@
|
|||||||
// standard windows headers
|
// standard windows headers
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <tchar.h>
|
||||||
#undef interface
|
#undef interface
|
||||||
#undef min
|
#undef min
|
||||||
#undef max
|
#undef max
|
||||||
|
|
||||||
// MAME headers
|
// MAME headers
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
|
#include "strconv.h"
|
||||||
|
|
||||||
// MAMEOS headers
|
// MAMEOS headers
|
||||||
#include "winmain.h"
|
#include "winmain.h"
|
||||||
@ -81,13 +83,15 @@ public:
|
|||||||
for (int keynum = 0; keynum < MAX_KEYS; keynum++)
|
for (int keynum = 0; keynum < MAX_KEYS; keynum++)
|
||||||
{
|
{
|
||||||
input_item_id itemid = table.map_di_scancode_to_itemid(keynum);
|
input_item_id itemid = table.map_di_scancode_to_itemid(keynum);
|
||||||
char name[20];
|
TCHAR keyname[100];
|
||||||
|
|
||||||
// generate/fetch the name
|
// generate the name
|
||||||
_snprintf(name, ARRAY_LENGTH(name), "Scan%03d", keynum);
|
if (GetKeyNameText(((keynum & 0x7f) << 16) | ((keynum & 0x80) << 17), keyname, ARRAY_LENGTH(keyname)) == 0)
|
||||||
|
_sntprintf(keyname, ARRAY_LENGTH(keyname), TEXT("Scan%03d"), keynum);
|
||||||
|
std::string name = osd::text::from_tstring(keyname);
|
||||||
|
|
||||||
// add the item to the device
|
// add the item to the device
|
||||||
devinfo->device()->add_item(name, itemid, generic_button_get_state<std::uint8_t>, &devinfo->keyboard.state[keynum]);
|
devinfo->device()->add_item(name.c_str(), itemid, generic_button_get_state<std::uint8_t>, &devinfo->keyboard.state[keynum]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user