Merge branch 'libretro:master' into bugfix/fix-debug-logging

This commit is contained in:
ComradeEcho 2021-08-06 03:09:42 -05:00 committed by GitHub
commit a803f652ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 448 additions and 386 deletions

View File

@ -978,8 +978,8 @@ static LRESULT CALLBACK wnd_proc_common_internal(HWND hwnd,
quit = true;
{
uint16_t mod = 0;
unsigned keycode = 0;
unsigned keysym = (lparam >> 16) & 0xff;
unsigned keysym = (unsigned)wparam;
unsigned keycode = input_keymaps_translate_keysym_to_rk(keysym);
if (GetKeyState(VK_SHIFT) & 0x80)
mod |= RETROKMOD_SHIFT;
@ -994,32 +994,6 @@ static LRESULT CALLBACK wnd_proc_common_internal(HWND hwnd,
if ((GetKeyState(VK_LWIN) | GetKeyState(VK_RWIN)) & 0x80)
mod |= RETROKMOD_META;
keysym = (unsigned)wparam;
/* fix key binding issues on winraw when
* DirectInput is not available */
switch (keysym)
{
/* Mod & Keypad handling done in winraw_callback */
case VK_SHIFT:
case VK_CONTROL:
case VK_MENU:
case VK_INSERT:
case VK_DELETE:
case VK_HOME:
case VK_END:
case VK_PRIOR:
case VK_NEXT:
case VK_UP:
case VK_DOWN:
case VK_LEFT:
case VK_RIGHT:
case VK_CLEAR:
case VK_RETURN:
return 0;
}
keycode = input_keymaps_translate_keysym_to_rk(keysym);
input_keyboard_event(keydown, keycode,
0, mod, RETRO_DEVICE_KEYBOARD);
@ -1087,7 +1061,6 @@ static LRESULT CALLBACK wnd_proc_winraw_common_internal(HWND hwnd,
UINT message, WPARAM wparam, LPARAM lparam)
{
LRESULT ret;
bool keydown = true;
bool quit = false;
win32_common_state_t *g_win32 = (win32_common_state_t*)&win32_st;
@ -1095,58 +1068,11 @@ static LRESULT CALLBACK wnd_proc_winraw_common_internal(HWND hwnd,
{
case WM_KEYUP: /* Key released */
case WM_SYSKEYUP: /* Key released */
keydown = false;
/* fall-through */
case WM_KEYDOWN: /* Key pressed */
case WM_SYSKEYDOWN: /* Key pressed */
quit = true;
{
uint16_t mod = 0;
unsigned keycode = 0;
unsigned keysym = (lparam >> 16) & 0xff;
if (GetKeyState(VK_SHIFT) & 0x80)
mod |= RETROKMOD_SHIFT;
if (GetKeyState(VK_CONTROL) & 0x80)
mod |= RETROKMOD_CTRL;
if (GetKeyState(VK_MENU) & 0x80)
mod |= RETROKMOD_ALT;
if (GetKeyState(VK_CAPITAL) & 0x81)
mod |= RETROKMOD_CAPSLOCK;
if (GetKeyState(VK_SCROLL) & 0x81)
mod |= RETROKMOD_SCROLLOCK;
if ((GetKeyState(VK_LWIN) | GetKeyState(VK_RWIN)) & 0x80)
mod |= RETROKMOD_META;
keysym = (unsigned)wparam;
/* fix key binding issues on winraw when
* DirectInput is not available */
switch (keysym)
{
/* Mod & Keypad handling done in winraw_callback */
case VK_SHIFT:
case VK_CONTROL:
case VK_MENU:
case VK_INSERT:
case VK_DELETE:
case VK_HOME:
case VK_END:
case VK_PRIOR:
case VK_NEXT:
case VK_UP:
case VK_DOWN:
case VK_LEFT:
case VK_RIGHT:
case VK_CLEAR:
case VK_RETURN:
return 0;
}
keycode = input_keymaps_translate_keysym_to_rk(keysym);
input_keyboard_event(keydown, keycode,
0, mod, RETRO_DEVICE_KEYBOARD);
if (message != WM_SYSKEYDOWN)
return 0;
@ -1235,19 +1161,6 @@ static LRESULT CALLBACK wnd_proc_common_dinput_internal(HWND hwnd,
unsigned keycode = 0;
unsigned keysym = (lparam >> 16) & 0xff;
if (GetKeyState(VK_SHIFT) & 0x80)
mod |= RETROKMOD_SHIFT;
if (GetKeyState(VK_CONTROL) & 0x80)
mod |= RETROKMOD_CTRL;
if (GetKeyState(VK_MENU) & 0x80)
mod |= RETROKMOD_ALT;
if (GetKeyState(VK_CAPITAL) & 0x81)
mod |= RETROKMOD_CAPSLOCK;
if (GetKeyState(VK_SCROLL) & 0x81)
mod |= RETROKMOD_SCROLLOCK;
if ((GetKeyState(VK_LWIN) | GetKeyState(VK_RWIN)) & 0x80)
mod |= RETROKMOD_META;
/* extended keys will map to dinput if the high bit is set */
if ((lparam >> 24 & 0x1))
keysym |= 0x80;
@ -1261,6 +1174,19 @@ static LRESULT CALLBACK wnd_proc_common_dinput_internal(HWND hwnd,
return 0;
}
if (GetKeyState(VK_SHIFT) & 0x80)
mod |= RETROKMOD_SHIFT;
if (GetKeyState(VK_CONTROL) & 0x80)
mod |= RETROKMOD_CTRL;
if (GetKeyState(VK_MENU) & 0x80)
mod |= RETROKMOD_ALT;
if (GetKeyState(VK_CAPITAL) & 0x81)
mod |= RETROKMOD_CAPSLOCK;
if (GetKeyState(VK_SCROLL) & 0x81)
mod |= RETROKMOD_SCROLLOCK;
if ((GetKeyState(VK_LWIN) | GetKeyState(VK_RWIN)) & 0x80)
mod |= RETROKMOD_META;
input_keyboard_event(keydown, keycode,
0, mod, RETRO_DEVICE_KEYBOARD);

View File

@ -1262,23 +1262,24 @@ static bool open_devices(udev_input_t *udev,
char ident[255];
if (ioctl(fd, EVIOCGNAME(sizeof(ident)), ident) < 0)
ident[0] = '\0';
if ( type == UDEV_INPUT_KEYBOARD)
if (type == UDEV_INPUT_KEYBOARD)
{
RARCH_LOG("[udev]: Added Device Keyboard#%d %s (%s) .\n",
RARCH_LOG("[udev]: Keyboard #%u: \"%s\" (%s).\n",
device_keyboard,
ident,
devnode);
device_keyboard++;
}
else if (type == UDEV_INPUT_MOUSE || type== UDEV_INPUT_TOUCHPAD)
else if (type == UDEV_INPUT_MOUSE || type == UDEV_INPUT_TOUCHPAD)
{
RARCH_LOG("[udev]: Added Device mouse#%d %s (%s) .\n",
input_config_set_mouse_display_name(device_mouse, ident);
RARCH_LOG("[udev]: Mouse #%u: \"%s\" (%s).\n",
device_mouse,
ident,
devnode);
device_mouse++;
}
}
(void)check;

View File

@ -41,7 +41,8 @@ extern "C" {
typedef struct
{
uint8_t keys[256];
uint8_t keys[SC_LAST];
bool pause;
} winraw_keyboard_t;
typedef struct
@ -163,6 +164,8 @@ static void winraw_log_mice_info(winraw_mouse_t *mice, unsigned mouse_cnt)
if (!name[0])
snprintf(name, sizeof(name), "%s", "<name not found>");
input_config_set_mouse_display_name(i, name);
RARCH_LOG("[WINRAW]: Mouse #%u: \"%s\".\n", i, name);
}
}
@ -440,89 +443,11 @@ static void winraw_update_mouse_state(winraw_input_t *wr,
}
}
static void winraw_keyboard_mods(RAWINPUT *ri)
{
unsigned flags = ri->data.keyboard.Flags;
switch (ri->data.keyboard.MakeCode)
{
/* Left Control + Right Control */
case 29:
input_keyboard_event(
(flags & RI_KEY_BREAK) ? 0 : 1,
input_keymaps_translate_keysym_to_rk(
(flags & RI_KEY_E0) ? VK_RCONTROL : VK_LCONTROL),
0, RETROKMOD_CTRL, RETRO_DEVICE_KEYBOARD);
break;
/* Left Shift */
case 42:
input_keyboard_event(
(flags & RI_KEY_BREAK) ? 0 : 1,
input_keymaps_translate_keysym_to_rk(VK_LSHIFT),
0, RETROKMOD_SHIFT, RETRO_DEVICE_KEYBOARD);
break;
/* Right Shift */
case 54:
input_keyboard_event(
(flags & RI_KEY_BREAK) ? 0 : 1,
input_keymaps_translate_keysym_to_rk(VK_RSHIFT),
0, RETROKMOD_SHIFT, RETRO_DEVICE_KEYBOARD);
break;
/* Left Alt + Right Alt */
case 56:
input_keyboard_event(
(flags & RI_KEY_BREAK) ? 0 : 1,
input_keymaps_translate_keysym_to_rk(
(flags & RI_KEY_E0) ? VK_RMENU : VK_LMENU),
0, RETROKMOD_ALT, RETRO_DEVICE_KEYBOARD);
break;
}
}
static void winraw_keyboard_keypad(unsigned *vkey, unsigned flags)
{
bool event = true;
/* Keypad key positions regardless of NumLock */
switch (*vkey)
{
case VK_INSERT: *vkey = (flags & RI_KEY_E0) ? VK_INSERT : VK_NUMPAD0; break;
case VK_DELETE: *vkey = (flags & RI_KEY_E0) ? VK_DELETE : VK_DECIMAL; break;
case VK_HOME: *vkey = (flags & RI_KEY_E0) ? VK_HOME : VK_NUMPAD7; break;
case VK_END: *vkey = (flags & RI_KEY_E0) ? VK_END : VK_NUMPAD1; break;
case VK_PRIOR: *vkey = (flags & RI_KEY_E0) ? VK_PRIOR : VK_NUMPAD9; break;
case VK_NEXT: *vkey = (flags & RI_KEY_E0) ? VK_NEXT : VK_NUMPAD3; break;
case VK_UP: *vkey = (flags & RI_KEY_E0) ? VK_UP : VK_NUMPAD8; break;
case VK_DOWN: *vkey = (flags & RI_KEY_E0) ? VK_DOWN : VK_NUMPAD2; break;
case VK_LEFT: *vkey = (flags & RI_KEY_E0) ? VK_LEFT : VK_NUMPAD4; break;
case VK_RIGHT: *vkey = (flags & RI_KEY_E0) ? VK_RIGHT : VK_NUMPAD6; break;
case VK_CLEAR: *vkey = (flags & RI_KEY_E0) ? VK_CLEAR : VK_NUMPAD5; break;
case VK_RETURN: *vkey = (flags & RI_KEY_E0) ? 0xE0 : VK_RETURN; break;
default:
event = false;
break;
}
if (event)
input_keyboard_event(flags & RI_KEY_BREAK ? 0 : 1,
input_keymaps_translate_keysym_to_rk(*vkey),
0, 0, RETRO_DEVICE_KEYBOARD);
}
static LRESULT CALLBACK winraw_callback(
HWND wnd, UINT msg, WPARAM wpar, LPARAM lpar)
{
unsigned i;
unsigned vkey, flags;
unsigned mcode, flags, kdown;
static uint8_t data[1024];
RAWINPUT *ri = (RAWINPUT*)data;
UINT size = sizeof(data);
@ -544,36 +469,42 @@ static LRESULT CALLBACK winraw_callback(
switch (ri->header.dwType)
{
case RIM_TYPEKEYBOARD:
vkey = ri->data.keyboard.VKey;
mcode = ri->data.keyboard.MakeCode;
flags = ri->data.keyboard.Flags;
kdown = (flags & RI_KEY_BREAK) ? 0 : 1;
/* Stop sending forced Left Shift when NumLock is enabled
* (VKey 0xFF does not actually exist) */
if (vkey == 0xFF)
break;
/* Extended scancodes */
if (flags & RI_KEY_E0)
mcode |= 0xE000;
else if (flags & RI_KEY_E1)
mcode |= 0xE100;
/* following keys are not handled by windows raw input api */
wr->keyboard.keys[VK_LCONTROL] = GetAsyncKeyState(VK_LCONTROL) >> 1 ? 1 : 0;
wr->keyboard.keys[VK_RCONTROL] = GetAsyncKeyState(VK_RCONTROL) >> 1 ? 1 : 0;
wr->keyboard.keys[VK_LMENU] = GetAsyncKeyState(VK_LMENU) >> 1 ? 1 : 0;
wr->keyboard.keys[VK_RMENU] = GetAsyncKeyState(VK_RMENU) >> 1 ? 1 : 0;
wr->keyboard.keys[VK_LSHIFT] = GetAsyncKeyState(VK_LSHIFT) >> 1 ? 1 : 0;
wr->keyboard.keys[VK_RSHIFT] = GetAsyncKeyState(VK_RSHIFT) >> 1 ? 1 : 0;
winraw_keyboard_mods(ri);
winraw_keyboard_keypad(&vkey, flags);
switch (ri->data.keyboard.Message)
/* Special pause-key handling due to
* scancode 0xE11D45 incoming separately */
if (wr->keyboard.pause)
{
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
wr->keyboard.keys[vkey] = 1;
break;
case WM_KEYUP:
case WM_SYSKEYUP:
wr->keyboard.keys[vkey] = 0;
break;
wr->keyboard.pause = false;
if (mcode == SC_NUMLOCK)
mcode = SC_PAUSE;
}
else if (mcode == 0xE11D)
wr->keyboard.pause = true;
/* Ignored scancodes */
switch (mcode)
{
case 0xE11D:
case 0xE02A:
case 0xE036:
case 0xE0AA:
case 0xE0B6:
return 0;
}
wr->keyboard.keys[mcode] = kdown;
input_keyboard_event(kdown,
input_keymaps_translate_keysym_to_rk(mcode),
0, 0, RETRO_DEVICE_KEYBOARD);
break;
case RIM_TYPEMOUSE:
for (i = 0; i < wr->mouse_cnt; ++i)

View File

@ -120,6 +120,11 @@ typedef struct
bool autoconfigured;
} input_device_info_t;
typedef struct
{
char display_name[256];
} input_mouse_info_t;
/**
* Organizes the functions and data structures of each driver that are accessed
* by other parts of the input code. The input_driver structs are the "interface"
@ -491,6 +496,7 @@ void input_config_set_device_name(unsigned port, const char *name);
* @param port
*/
void input_config_set_device_display_name(unsigned port, const char *name);
void input_config_set_mouse_display_name(unsigned port, const char *name);
/**
* Set the configuration path for the device in the specified port
@ -580,6 +586,7 @@ unsigned input_config_get_device(unsigned port);
/* Get input_device_info */
const char *input_config_get_device_name(unsigned port);
const char *input_config_get_device_display_name(unsigned port);
const char *input_config_get_mouse_display_name(unsigned port);
const char *input_config_get_device_config_path(unsigned port);
const char *input_config_get_device_config_name(unsigned port);
const char *input_config_get_device_joypad_driver(unsigned port);

View File

@ -1698,117 +1698,116 @@ const struct rarch_key_map rarch_key_map_psl1ght[] = {
#if defined(_WIN32) && _WIN32_WINNT >= 0x0501 && !defined(__WINRT__)
const struct rarch_key_map rarch_key_map_winraw[] = {
{ VK_BACK, RETROK_BACKSPACE },
{ VK_TAB, RETROK_TAB },
{ VK_CLEAR, RETROK_CLEAR },
{ VK_RETURN, RETROK_RETURN },
{ VK_PAUSE, RETROK_PAUSE },
{ VK_ESCAPE, RETROK_ESCAPE },
{ VK_MODECHANGE, RETROK_MODE },
{ VK_SPACE, RETROK_SPACE },
{ VK_PRIOR, RETROK_PAGEUP },
{ VK_NEXT, RETROK_PAGEDOWN },
{ VK_END, RETROK_END },
{ VK_HOME, RETROK_HOME },
{ VK_LEFT, RETROK_LEFT },
{ VK_UP, RETROK_UP },
{ VK_RIGHT, RETROK_RIGHT },
{ VK_DOWN, RETROK_DOWN },
{ VK_PRINT, RETROK_PRINT },
{ VK_INSERT, RETROK_INSERT },
{ VK_DELETE, RETROK_DELETE },
{ VK_HELP, RETROK_HELP },
{ 0x30, RETROK_0 },
{ 0x31, RETROK_1 },
{ 0x32, RETROK_2 },
{ 0x33, RETROK_3 },
{ 0x34, RETROK_4 },
{ 0x35, RETROK_5 },
{ 0x36, RETROK_6 },
{ 0x37, RETROK_7 },
{ 0x38, RETROK_8 },
{ 0x39, RETROK_9 },
{ 0x41, RETROK_a },
{ 0x42, RETROK_b },
{ 0x43, RETROK_c },
{ 0x44, RETROK_d },
{ 0x45, RETROK_e },
{ 0x46, RETROK_f },
{ 0x47, RETROK_g },
{ 0x48, RETROK_h },
{ 0x49, RETROK_i },
{ 0x4A, RETROK_j },
{ 0x4B, RETROK_k },
{ 0x4C, RETROK_l },
{ 0x4D, RETROK_m },
{ 0x4E, RETROK_n },
{ 0x4F, RETROK_o },
{ 0x50, RETROK_p },
{ 0x51, RETROK_q },
{ 0x52, RETROK_r },
{ 0x53, RETROK_s },
{ 0x54, RETROK_t },
{ 0x55, RETROK_u },
{ 0x56, RETROK_v },
{ 0x57, RETROK_w },
{ 0x58, RETROK_x },
{ 0x59, RETROK_y },
{ 0x5A, RETROK_z },
{ VK_LWIN, RETROK_LSUPER },
{ VK_RWIN, RETROK_RSUPER },
{ VK_APPS, RETROK_MENU },
{ VK_NUMPAD0, RETROK_KP0 },
{ VK_NUMPAD1, RETROK_KP1 },
{ VK_NUMPAD2, RETROK_KP2 },
{ VK_NUMPAD3, RETROK_KP3 },
{ VK_NUMPAD4, RETROK_KP4 },
{ VK_NUMPAD5, RETROK_KP5 },
{ VK_NUMPAD6, RETROK_KP6 },
{ VK_NUMPAD7, RETROK_KP7 },
{ VK_NUMPAD8, RETROK_KP8 },
{ VK_NUMPAD9, RETROK_KP9 },
{ VK_MULTIPLY, RETROK_KP_MULTIPLY },
{ VK_ADD, RETROK_KP_PLUS },
{ VK_SUBTRACT, RETROK_KP_MINUS },
{ VK_DECIMAL, RETROK_KP_PERIOD },
{ VK_DIVIDE, RETROK_KP_DIVIDE },
{ VK_F1, RETROK_F1 },
{ VK_F2, RETROK_F2 },
{ VK_F3, RETROK_F3 },
{ VK_F4, RETROK_F4 },
{ VK_F5, RETROK_F5 },
{ VK_F6, RETROK_F6 },
{ VK_F7, RETROK_F7 },
{ VK_F8, RETROK_F8 },
{ VK_F9, RETROK_F9 },
{ VK_F10, RETROK_F10 },
{ VK_F11, RETROK_F11 },
{ VK_F12, RETROK_F12 },
{ VK_F13, RETROK_F13 },
{ VK_F14, RETROK_F14 },
{ VK_F15, RETROK_F15 },
{ VK_NUMLOCK, RETROK_NUMLOCK },
{ VK_SCROLL, RETROK_SCROLLOCK },
{ VK_LSHIFT, RETROK_LSHIFT },
{ VK_RSHIFT, RETROK_RSHIFT },
{ VK_LCONTROL, RETROK_LCTRL },
{ VK_RCONTROL, RETROK_RCTRL },
{ VK_LMENU, RETROK_LALT },
{ VK_RMENU, RETROK_RALT },
{ 0xE0, RETROK_KP_ENTER },
{ VK_CAPITAL, RETROK_CAPSLOCK },
{ VK_OEM_1, RETROK_SEMICOLON },
{ VK_OEM_PLUS, RETROK_EQUALS },
{ VK_OEM_COMMA, RETROK_COMMA },
{ VK_OEM_MINUS, RETROK_MINUS },
{ VK_OEM_PERIOD, RETROK_PERIOD },
{ VK_OEM_2, RETROK_SLASH },
{ VK_OEM_3, RETROK_BACKQUOTE },
{ VK_OEM_4, RETROK_LEFTBRACKET },
{ VK_OEM_5, RETROK_BACKSLASH },
{ VK_OEM_6, RETROK_RIGHTBRACKET },
{ VK_OEM_7, RETROK_QUOTE },
{ VK_OEM_102, RETROK_OEM_102 },
{ SC_BACKSPACE, RETROK_BACKSPACE },
{ SC_TAB, RETROK_TAB },
{ SC_CLEAR, RETROK_CLEAR },
{ SC_RETURN, RETROK_RETURN },
{ SC_PAUSE, RETROK_PAUSE },
{ SC_ESCAPE, RETROK_ESCAPE },
{ SC_SPACE, RETROK_SPACE },
{ SC_PAGEUP, RETROK_PAGEUP },
{ SC_PAGEDOWN, RETROK_PAGEDOWN },
{ SC_END, RETROK_END },
{ SC_HOME, RETROK_HOME },
{ SC_LEFT, RETROK_LEFT },
{ SC_UP, RETROK_UP },
{ SC_RIGHT, RETROK_RIGHT },
{ SC_DOWN, RETROK_DOWN },
{ SC_PRINT, RETROK_PRINT },
{ SC_INSERT, RETROK_INSERT },
{ SC_DELETE, RETROK_DELETE },
{ SC_HELP, RETROK_HELP },
{ SC_0, RETROK_0 },
{ SC_1, RETROK_1 },
{ SC_2, RETROK_2 },
{ SC_3, RETROK_3 },
{ SC_4, RETROK_4 },
{ SC_5, RETROK_5 },
{ SC_6, RETROK_6 },
{ SC_7, RETROK_7 },
{ SC_8, RETROK_8 },
{ SC_9, RETROK_9 },
{ SC_a, RETROK_a },
{ SC_b, RETROK_b },
{ SC_c, RETROK_c },
{ SC_d, RETROK_d },
{ SC_e, RETROK_e },
{ SC_f, RETROK_f },
{ SC_g, RETROK_g },
{ SC_h, RETROK_h },
{ SC_i, RETROK_i },
{ SC_j, RETROK_j },
{ SC_k, RETROK_k },
{ SC_l, RETROK_l },
{ SC_m, RETROK_m },
{ SC_n, RETROK_n },
{ SC_o, RETROK_o },
{ SC_p, RETROK_p },
{ SC_q, RETROK_q },
{ SC_r, RETROK_r },
{ SC_s, RETROK_s },
{ SC_t, RETROK_t },
{ SC_u, RETROK_u },
{ SC_v, RETROK_v },
{ SC_w, RETROK_w },
{ SC_x, RETROK_x },
{ SC_y, RETROK_y },
{ SC_z, RETROK_z },
{ SC_LSUPER, RETROK_LSUPER },
{ SC_RSUPER, RETROK_RSUPER },
{ SC_MENU, RETROK_MENU },
{ SC_KP0, RETROK_KP0 },
{ SC_KP1, RETROK_KP1 },
{ SC_KP2, RETROK_KP2 },
{ SC_KP3, RETROK_KP3 },
{ SC_KP4, RETROK_KP4 },
{ SC_KP5, RETROK_KP5 },
{ SC_KP6, RETROK_KP6 },
{ SC_KP7, RETROK_KP7 },
{ SC_KP8, RETROK_KP8 },
{ SC_KP9, RETROK_KP9 },
{ SC_KP_MULTIPLY, RETROK_KP_MULTIPLY },
{ SC_KP_PLUS, RETROK_KP_PLUS },
{ SC_KP_MINUS, RETROK_KP_MINUS },
{ SC_KP_PERIOD, RETROK_KP_PERIOD },
{ SC_KP_DIVIDE, RETROK_KP_DIVIDE },
{ SC_F1, RETROK_F1 },
{ SC_F2, RETROK_F2 },
{ SC_F3, RETROK_F3 },
{ SC_F4, RETROK_F4 },
{ SC_F5, RETROK_F5 },
{ SC_F6, RETROK_F6 },
{ SC_F7, RETROK_F7 },
{ SC_F8, RETROK_F8 },
{ SC_F9, RETROK_F9 },
{ SC_F10, RETROK_F10 },
{ SC_F11, RETROK_F11 },
{ SC_F12, RETROK_F12 },
{ SC_F13, RETROK_F13 },
{ SC_F14, RETROK_F14 },
{ SC_F15, RETROK_F15 },
{ SC_NUMLOCK, RETROK_NUMLOCK },
{ SC_SCROLLLOCK, RETROK_SCROLLOCK },
{ SC_LSHIFT, RETROK_LSHIFT },
{ SC_RSHIFT, RETROK_RSHIFT },
{ SC_LCTRL, RETROK_LCTRL },
{ SC_RCTRL, RETROK_RCTRL },
{ SC_LALT, RETROK_LALT },
{ SC_RALT, RETROK_RALT },
{ SC_KP_ENTER, RETROK_KP_ENTER },
{ SC_CAPSLOCK, RETROK_CAPSLOCK },
{ SC_COMMA, RETROK_COMMA },
{ SC_PERIOD, RETROK_PERIOD },
{ SC_MINUS, RETROK_MINUS },
{ SC_EQUALS, RETROK_EQUALS },
{ SC_LEFTBRACKET, RETROK_LEFTBRACKET },
{ SC_RIGHTBRACKET, RETROK_RIGHTBRACKET },
{ SC_SEMICOLON, RETROK_SEMICOLON },
{ SC_BACKQUOTE, RETROK_BACKQUOTE },
{ SC_BACKSLASH, RETROK_BACKSLASH },
{ SC_SLASH, RETROK_SLASH },
{ SC_APOSTROPHE, RETROK_QUOTE },
{ SC_ANGLEBRACKET, RETROK_OEM_102 },
{ 0, RETROK_UNKNOWN }
};
#endif

View File

@ -62,6 +62,168 @@ extern const struct rarch_key_map rarch_key_map_switch[];
extern const struct rarch_key_map rarch_key_map_vita[];
#endif
#if defined(_WIN32) && _WIN32_WINNT >= 0x0501 && !defined(__WINRT__)
enum winraw_scancodes {
SC_ESCAPE = 0x01,
SC_1 = 0x02,
SC_2 = 0x03,
SC_3 = 0x04,
SC_4 = 0x05,
SC_5 = 0x06,
SC_6 = 0x07,
SC_7 = 0x08,
SC_8 = 0x09,
SC_9 = 0x0A,
SC_0 = 0x0B,
SC_MINUS = 0x0C,
SC_EQUALS = 0x0D,
SC_BACKSPACE = 0x0E,
SC_TAB = 0x0F,
SC_q = 0x10,
SC_w = 0x11,
SC_e = 0x12,
SC_r = 0x13,
SC_t = 0x14,
SC_y = 0x15,
SC_u = 0x16,
SC_i = 0x17,
SC_o = 0x18,
SC_p = 0x19,
SC_LEFTBRACKET = 0x1A,
SC_RIGHTBRACKET = 0x1B,
SC_RETURN = 0x1C,
SC_LCTRL = 0x1D,
SC_a = 0x1E,
SC_s = 0x1F,
SC_d = 0x20,
SC_f = 0x21,
SC_g = 0x22,
SC_h = 0x23,
SC_j = 0x24,
SC_k = 0x25,
SC_l = 0x26,
SC_SEMICOLON = 0x27,
SC_APOSTROPHE = 0x28,
SC_BACKQUOTE = 0x29,
SC_LSHIFT = 0x2A,
SC_BACKSLASH = 0x2B,
SC_z = 0x2C,
SC_x = 0x2D,
SC_c = 0x2E,
SC_v = 0x2F,
SC_b = 0x30,
SC_n = 0x31,
SC_m = 0x32,
SC_COMMA = 0x33,
SC_PERIOD = 0x34,
SC_SLASH = 0x35,
SC_RSHIFT = 0x36,
SC_KP_MULTIPLY = 0x37,
SC_LALT = 0x38,
SC_SPACE = 0x39,
SC_CAPSLOCK = 0x3A,
SC_F1 = 0x3B,
SC_F2 = 0x3C,
SC_F3 = 0x3D,
SC_F4 = 0x3E,
SC_F5 = 0x3F,
SC_F6 = 0x40,
SC_F7 = 0x41,
SC_F8 = 0x42,
SC_F9 = 0x43,
SC_F10 = 0x44,
SC_NUMLOCK = 0x45,
SC_SCROLLLOCK = 0x46,
SC_KP7 = 0x47,
SC_KP8 = 0x48,
SC_KP9 = 0x49,
SC_KP_MINUS = 0x4A,
SC_KP4 = 0x4B,
SC_KP5 = 0x4C,
SC_KP6 = 0x4D,
SC_KP_PLUS = 0x4E,
SC_KP1 = 0x4F,
SC_KP2 = 0x50,
SC_KP3 = 0x51,
SC_KP0 = 0x52,
SC_KP_PERIOD = 0x53,
SC_ALT_PRINT = 0x54,
SC_ANGLEBRACKET = 0x56,
SC_F11 = 0x57,
SC_F12 = 0x58,
SC_OEM_1 = 0x5a,
SC_OEM_2 = 0x5b,
SC_OEM_3 = 0x5c,
SC_ERASE_EOF = 0x5d,
SC_CLEAR = 0x5d,
SC_OEM_4 = 0x5e,
SC_OEM_5 = 0x5f,
SC_HELP = 0x63,
SC_F13 = 0x64,
SC_F14 = 0x65,
SC_F15 = 0x66,
SC_F16 = 0x67,
SC_F17 = 0x68,
SC_F18 = 0x69,
SC_F19 = 0x6a,
SC_F20 = 0x6b,
SC_F21 = 0x6c,
SC_F22 = 0x6d,
SC_F23 = 0x6e,
SC_OEM_6 = 0x6f,
SC_KATAKANA = 0x70,
SC_OEM_7 = 0x71,
SC_F24 = 0x76,
SC_SBCSCHAR = 0x77,
SC_CONVERT = 0x79,
SC_NONCONVERT = 0x7B,
SC_MEDIA_PREV = 0xE010,
SC_MEDIA_NEXT = 0xE019,
SC_KP_ENTER = 0xE01C,
SC_RCTRL = 0xE01D,
SC_VOLUME_MUTE = 0xE020,
SC_LAUNCH_APP2 = 0xE021,
SC_MEDIA_PLAY = 0xE022,
SC_MEDIA_STOP = 0xE024,
SC_VOLUME_DOWN = 0xE02E,
SC_VOLUME_UP = 0xE030,
SC_BROWSER_HOME = 0xE032,
SC_KP_DIVIDE = 0xE035,
SC_PRINT = 0xE037,
SC_RALT = 0xE038,
SC_BREAK = 0xE046,
SC_HOME = 0xE047,
SC_UP = 0xE048,
SC_PAGEUP = 0xE049,
SC_LEFT = 0xE04B,
SC_RIGHT = 0xE04D,
SC_END = 0xE04F,
SC_DOWN = 0xE050,
SC_PAGEDOWN = 0xE051,
SC_INSERT = 0xE052,
SC_DELETE = 0xE053,
SC_LSUPER = 0xE05B,
SC_RSUPER = 0xE05C,
SC_MENU = 0xE05D,
SC_POWER = 0xE05E,
SC_SLEEP = 0xE05F,
SC_WAKE = 0xE063,
SC_BROWSER_SEARCH = 0xE065,
SC_BROWSER_FAVORITES = 0xE066,
SC_BROWSER_REFRESH = 0xE067,
SC_BROWSER_STOP = 0xE068,
SC_BROWSER_FORWARD = 0xE069,
SC_BROWSER_BACK = 0xE06A,
SC_LAUNCH_APP1 = 0xE06B,
SC_LAUNCH_EMAIL = 0xE06C,
SC_LAUNCH_MEDIA = 0xE06D,
SC_PAUSE = 0xFFFE/*0xE11D45*/,
SC_LAST = 0xFFFF,
};
#endif
/**
* input_keymaps_init_keyboard_lut:
* @map : Keyboard map.

View File

@ -146,7 +146,7 @@ int rmsgpack_write_map_header(RFILE *fd, uint32_t size)
goto error;
return sizeof(int8_t);
}
else if (size < (uint16_t)size)
else if (size == (uint16_t)size)
{
if (filestream_write(fd, &MPF_MAP16, sizeof(MPF_MAP16)) == -1)
goto error;
@ -170,26 +170,27 @@ error:
int rmsgpack_write_string(RFILE *fd, const char *s, uint32_t len)
{
uint8_t tmp_i8;
uint16_t tmp_i16;
uint32_t tmp_i32;
int8_t fixlen = 0;
int written = sizeof(int8_t);
int written = sizeof(uint8_t);
if (len < 32)
{
fixlen = len | MPF_FIXSTR;
if (filestream_write(fd, &fixlen, sizeof(int8_t)) == -1)
tmp_i8 = len | MPF_FIXSTR;
if (filestream_write(fd, &tmp_i8, sizeof(uint8_t)) == -1)
goto error;
}
else if (len < (1 << 8))
else if (len == (uint8_t)len)
{
if (filestream_write(fd, &MPF_STR8, sizeof(MPF_STR8)) == -1)
goto error;
if (filestream_write(fd, &len, sizeof(uint8_t)) == -1)
tmp_i8 = (uint8_t)len;
if (filestream_write(fd, &tmp_i8, sizeof(uint8_t)) == -1)
goto error;
written += sizeof(uint8_t);
}
else if (len < (1 << 16))
else if (len == (uint16_t)len)
{
if (filestream_write(fd, &MPF_STR16, sizeof(MPF_STR16)) == -1)
goto error;
@ -221,6 +222,7 @@ error:
int rmsgpack_write_bin(RFILE *fd, const void *s, uint32_t len)
{
uint8_t tmp_i8;
uint16_t tmp_i16;
uint32_t tmp_i32;
@ -228,7 +230,8 @@ int rmsgpack_write_bin(RFILE *fd, const void *s, uint32_t len)
{
if (filestream_write(fd, &MPF_BIN8, sizeof(MPF_BIN8)) == -1)
goto error;
if (filestream_write(fd, &len, sizeof(uint8_t)) == -1)
tmp_i8 = (uint8_t)len;
if (filestream_write(fd, &tmp_i8, sizeof(uint8_t)) == -1)
goto error;
}
else if (len == (uint16_t)len)
@ -283,19 +286,21 @@ error:
int rmsgpack_write_int(RFILE *fd, int64_t value)
{
int8_t tmp_i8;
int16_t tmp_i16;
int32_t tmp_i32;
uint8_t tmpval = 0;
uint8_t tmpval;
int written = sizeof(uint8_t);
if (value >=0 && value < 128)
if (value >= 0 && value < 128)
{
if (filestream_write(fd, &value, sizeof(int8_t)) == -1)
tmpval = (uint8_t)value;
if (filestream_write(fd, &tmpval, sizeof(uint8_t)) == -1)
goto error;
}
else if (value < 0 && value > -32)
else if (value >= -32 && value < 0)
{
tmpval = (value) | 0xe0;
tmpval = (uint8_t)(value + 256); // -32..-1 => 0xE0 .. 0xFF
if (filestream_write(fd, &tmpval, sizeof(uint8_t)) == -1)
goto error;
}
@ -304,7 +309,8 @@ int rmsgpack_write_int(RFILE *fd, int64_t value)
if (filestream_write(fd, &MPF_INT8, sizeof(MPF_INT8)) == -1)
goto error;
if (filestream_write(fd, &value, sizeof(int8_t)) == -1)
tmp_i8 = (int8_t)value;
if (filestream_write(fd, &tmp_i8, sizeof(int8_t)) == -1)
goto error;
written += sizeof(int8_t);
}
@ -347,6 +353,7 @@ error:
int rmsgpack_write_uint(RFILE *fd, uint64_t value)
{
uint8_t tmp_i8;
uint16_t tmp_i16;
uint32_t tmp_i32;
int written = sizeof(uint8_t);
@ -356,7 +363,8 @@ int rmsgpack_write_uint(RFILE *fd, uint64_t value)
if (filestream_write(fd, &MPF_UINT8, sizeof(MPF_UINT8)) == -1)
goto error;
if (filestream_write(fd, &value, sizeof(uint8_t)) == -1)
tmp_i8 = (uint8_t)value;
if (filestream_write(fd, &tmp_i8, sizeof(uint8_t)) == -1)
goto error;
written += sizeof(uint8_t);
}
@ -398,7 +406,7 @@ error:
static int read_uint(RFILE *fd, uint64_t *out, size_t size)
{
uint64_t tmp;
union { uint64_t u64; uint32_t u32; uint16_t u16; uint8_t u8; } tmp;
if (filestream_read(fd, &tmp, size) == -1)
goto error;
@ -406,16 +414,16 @@ static int read_uint(RFILE *fd, uint64_t *out, size_t size)
switch (size)
{
case 1:
*out = *(uint8_t *)(&tmp);
*out = tmp.u8;
break;
case 2:
*out = swap_if_little16((uint16_t)tmp);
*out = swap_if_little16(tmp.u16);
break;
case 4:
*out = swap_if_little32((uint32_t)tmp);
*out = swap_if_little32(tmp.u32);
break;
case 8:
*out = swap_if_little64(tmp);
*out = swap_if_little64(tmp.u64);
break;
}
return 0;
@ -426,32 +434,24 @@ error:
static int read_int(RFILE *fd, int64_t *out, size_t size)
{
uint8_t tmp8 = 0;
uint16_t tmp16;
uint32_t tmp32;
uint64_t tmp64;
union { uint64_t u64; uint32_t u32; uint16_t u16; uint8_t u8; } tmp;
if (filestream_read(fd, &tmp64, size) == -1)
if (filestream_read(fd, &tmp, size) == -1)
goto error;
(void)tmp8;
switch (size)
{
case 1:
*out = *((int8_t *)(&tmp64));
*out = (int8_t)tmp.u8;
break;
case 2:
tmp16 = swap_if_little16((uint16_t)tmp64);
*out = *((int16_t *)(&tmp16));
*out = (int16_t)swap_if_little16(tmp.u16);
break;
case 4:
tmp32 = swap_if_little32((uint32_t)tmp64);
*out = *((int32_t *)(&tmp32));
*out = (int32_t)swap_if_little32(tmp.u32);
break;
case 8:
tmp64 = swap_if_little64(tmp64);
*out = *((int64_t *)(&tmp64));
*out = (int64_t)swap_if_little64(tmp.u64);
break;
}
return 0;

View File

@ -4068,36 +4068,34 @@ static unsigned menu_displaylist_parse_content_information(
}
/* Content label */
if (!string_is_empty(content_label))
{
tmp[0] = '\0';
snprintf(tmp, sizeof(tmp),
"%s: %s",
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_LABEL),
content_label
);
if (menu_entries_append_enum(info->list, tmp,
msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_INFO_LABEL),
MENU_ENUM_LABEL_CONTENT_INFO_LABEL,
0, 0, 0))
count++;
}
tmp[0] = '\0';
snprintf(tmp, sizeof(tmp),
"%s: %s",
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_LABEL),
!string_is_empty(content_label)
? content_label
: msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE)
);
if (menu_entries_append_enum(info->list, tmp,
msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_INFO_LABEL),
MENU_ENUM_LABEL_CONTENT_INFO_LABEL,
0, 0, 0))
count++;
/* Content path */
if (!string_is_empty(content_path))
{
tmp[0] = '\0';
snprintf(tmp, sizeof(tmp),
"%s: %s",
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_PATH),
content_path
);
if (menu_entries_append_enum(info->list, tmp,
msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_INFO_PATH),
MENU_ENUM_LABEL_CONTENT_INFO_PATH,
0, 0, 0))
count++;
}
tmp[0] = '\0';
snprintf(tmp, sizeof(tmp),
"%s: %s",
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_PATH),
!string_is_empty(content_path)
? content_path
: msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE)
);
if (menu_entries_append_enum(info->list, tmp,
msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_INFO_PATH),
MENU_ENUM_LABEL_CONTENT_INFO_PATH,
0, 0, 0))
count++;
/* Core name */
if (!string_is_empty(core_name) &&

View File

@ -596,7 +596,7 @@ static explore_state_t *explore_build_list(settings_t *settings)
key_str = key->val.string.buff;
if (string_is_equal(key_str, "crc"))
{
switch (strlen(val->val.binary.buff))
switch (val->val.binary.len)
{
case 1:
crc32 = *(uint8_t*)val->val.binary.buff;

View File

@ -26,6 +26,7 @@
#include "menu_defines.h"
#include "../input/input_types.h"
#include "../input/input_driver.h"
RETRO_BEGIN_DECLS
@ -213,18 +214,6 @@ void menu_input_set_pointer_selection(unsigned selection);
**/
void menu_input_set_pointer_y_accel(float y_accel);
/**
* Line complete callback. Calls back after return is pressed with the
* completed line. Line can be NULL. (Meaning that it might return a NULL
* pointer instead of an empty string?)
*
* @param userdata
* @param line a string representation of the completed line
* (FIXME it might return a NULL pointer instead of an empty
* string?)
**/
typedef void (*input_keyboard_line_complete_t)(void *userdata, const char *line);
typedef struct menu_input_ctx_line
{
const char *label;

View File

@ -7298,6 +7298,36 @@ static void get_string_representation_bind_device(rarch_setting_t *setting, char
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISABLED), len);
}
static void get_string_representation_mouse_index(rarch_setting_t *setting, char *s,
size_t len)
{
unsigned index_offset, map = 0;
unsigned max_devices = MAX_USERS;
settings_t *settings = config_get_ptr();
if (!setting)
return;
index_offset = setting->index_offset;
map = settings->uints.input_mouse_index[index_offset];
if (map < max_devices)
{
const char *device_name = input_config_get_mouse_display_name(map);
if (!string_is_empty(device_name))
strlcpy(s, device_name, len);
else
snprintf(s, len,
"%s (#%u)",
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE),
map);
}
else
snprintf(s, len,
"#%u", map);
}
static void read_handler_audio_rate_control_delta(rarch_setting_t *setting)
{
settings_t *settings = config_get_ptr();
@ -8456,6 +8486,8 @@ static bool setting_append_list_input_player_options(
(*list)[list_info->index - 1].action_right = &setting_action_right_mouse_index;
(*list)[list_info->index - 1].action_select = &setting_action_right_mouse_index;
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
(*list)[list_info->index - 1].get_string_representation =
&get_string_representation_mouse_index;
menu_settings_list_current_add_range(list, list_info, 0, MAX_USERS - 1, 1.0, true, true);
MENU_SETTINGS_LIST_CURRENT_ADD_ENUM_IDX_PTR(list, list_info,
(enum msg_hash_enums)(MENU_ENUM_LABEL_INPUT_MOUSE_INDEX + user));

View File

@ -27161,6 +27161,14 @@ const char *input_config_get_device_display_name(unsigned port)
return p_rarch->input_device_info[port].display_name;
}
const char *input_config_get_mouse_display_name(unsigned port)
{
struct rarch_state *p_rarch = &rarch_st;
if (string_is_empty(p_rarch->input_mouse_info[port].display_name))
return NULL;
return p_rarch->input_mouse_info[port].display_name;
}
const char *input_config_get_device_config_path(unsigned port)
{
struct rarch_state *p_rarch = &rarch_st;
@ -27248,6 +27256,14 @@ void input_config_set_device_display_name(unsigned port, const char *name)
sizeof(p_rarch->input_device_info[port].display_name));
}
void input_config_set_mouse_display_name(unsigned port, const char *name)
{
struct rarch_state *p_rarch = &rarch_st;
if (!string_is_empty(name))
strlcpy(p_rarch->input_mouse_info[port].display_name, name,
sizeof(p_rarch->input_mouse_info[port].display_name));
}
void input_config_set_device_config_path(unsigned port, const char *path)
{
if (!string_is_empty(path))

View File

@ -2023,6 +2023,7 @@ struct rarch_state
#endif
input_device_info_t input_device_info[MAX_INPUT_DEVICES];
input_mouse_info_t input_mouse_info[MAX_INPUT_DEVICES];
/* unsigned alignment */
#ifdef HAVE_MENU
menu_dialog_t dialog_st; /* unsigned alignment */