diff options
author | 2016-11-26 08:49:17 +1100 | |
---|---|---|
committer | 2016-11-26 08:49:17 +1100 | |
commit | 0b1a51a9d1700d8b22d65602b9f2a4dfb1a701ea (patch) | |
tree | 4a8b4935070429aace58b1ea0149a835b9609af9 /src/osd/modules/input/input_win32.cpp | |
parent | a68cefdb4f220455e9a29e98d3b270958078d5ea (diff) | |
parent | 7ad15e78260f5dc28912cc700fc87838ca75f198 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/osd/modules/input/input_win32.cpp')
-rw-r--r-- | src/osd/modules/input/input_win32.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/osd/modules/input/input_win32.cpp b/src/osd/modules/input/input_win32.cpp index edd378be25d..a4e00eec17f 100644 --- a/src/osd/modules/input/input_win32.cpp +++ b/src/osd/modules/input/input_win32.cpp @@ -14,12 +14,14 @@ // standard windows headers #define WIN32_LEAN_AND_MEAN #include <windows.h> +#include <tchar.h> #undef interface #undef min #undef max // MAME headers #include "emu.h" +#include "strconv.h" // MAMEOS headers #include "winmain.h" @@ -81,13 +83,15 @@ public: for (int keynum = 0; keynum < MAX_KEYS; keynum++) { input_item_id itemid = table.map_di_scancode_to_itemid(keynum); - char name[20]; + TCHAR keyname[100]; - // generate/fetch the name - _snprintf(name, ARRAY_LENGTH(name), "Scan%03d", keynum); + // generate the name + 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 - 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]); } } |