mirror of https://github.com/PCSX2/pcsx2.git
PAD: backport macos patches
This commit is contained in:
parent
d05c4e60be
commit
a0c18d97fd
|
@ -264,6 +264,7 @@ keyEvent* PADkeyEvent()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __unix__
|
||||||
if (g_ev_fifo.size() == 0)
|
if (g_ev_fifo.size() == 0)
|
||||||
{
|
{
|
||||||
// PAD_LOG("No events in queue, returning empty event\n");
|
// PAD_LOG("No events in queue, returning empty event\n");
|
||||||
|
@ -274,12 +275,15 @@ keyEvent* PADkeyEvent()
|
||||||
}
|
}
|
||||||
s_event = g_ev_fifo.dequeue();
|
s_event = g_ev_fifo.dequeue();
|
||||||
|
|
||||||
//TODO: fix me for macOS
|
|
||||||
#ifdef __linux__
|
|
||||||
AnalyzeKeyEvent(s_event);
|
AnalyzeKeyEvent(s_event);
|
||||||
// PAD_LOG("Returning Event. Event Type: %d, Key: %d\n", s_event.evt, s_event.key);
|
// PAD_LOG("Returning Event. Event Type: %d, Key: %d\n", s_event.evt, s_event.key);
|
||||||
#endif
|
|
||||||
return &s_event;
|
return &s_event;
|
||||||
|
#else // MacOS
|
||||||
|
s_event = event;
|
||||||
|
event.evt = 0;
|
||||||
|
event.key = 0;
|
||||||
|
return &s_event;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__unix__)
|
#if defined(__unix__)
|
||||||
|
|
|
@ -109,7 +109,7 @@ bool PollForNewKeyboardKeys(u32& pkey)
|
||||||
{
|
{
|
||||||
if (CGEventSourceKeyState(kCGEventSourceStateHIDSystemState, key))
|
if (CGEventSourceKeyState(kCGEventSourceStateHIDSystemState, key))
|
||||||
{
|
{
|
||||||
pkey = key == kVK_Escape ? 0 : key;
|
pkey = key == kVK_Escape ? UINT32_MAX : key;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -309,7 +309,7 @@ bool PollForNewKeyboardKeys(u32& pkey)
|
||||||
{
|
{
|
||||||
if (ev->type == GDK_KEY_PRESS)
|
if (ev->type == GDK_KEY_PRESS)
|
||||||
{
|
{
|
||||||
pkey = ev->key.keyval != GDK_KEY_Escape ? ev->key.keyval : 0;
|
pkey = ev->key.keyval != GDK_KEY_Escape ? ev->key.keyval : UINT32_MAX;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (ev->type == GDK_BUTTON_PRESS)
|
else if (ev->type == GDK_BUTTON_PRESS)
|
||||||
|
|
|
@ -314,7 +314,7 @@
|
||||||
030000006b140000010c000010010000,NACON GC-400ES,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
|
030000006b140000010c000010010000,NACON GC-400ES,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
|
||||||
030000000d0f00000900000010010000,Natec Genesis P44,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
|
030000000d0f00000900000010010000,Natec Genesis P44,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
|
||||||
030000001008000001e5000010010000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,platform:Linux,
|
030000001008000001e5000010010000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,platform:Linux,
|
||||||
060000007e0500000820000000000000,Nintendo Combined Joy-Cons (joycond),a:b0,b:b1,back:b9,dpdown:b15,dpleft:b16,dpright:b17,dpup:b14,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b3,y:b2,platform:Linux,
|
060000007e0500000820000000000000,Nintendo Combined Joy-Cons (joycond),a:b0,b:b1,back:b9,dpdown:b15,dpleft:b16,dpright:b17,dpup:b14,guide:b11,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b3,y:b2,platform:Linux,
|
||||||
030000007e0500003703000000016800,Nintendo GameCube Controller,a:b0,b:b2,dpdown:b6,dpleft:b4,dpright:b5,dpup:b7,lefttrigger:a4,leftx:a0,lefty:a1~,rightshoulder:b9,righttrigger:a5,rightx:a2,righty:a3~,start:b8,x:b1,y:b3,platform:Linux,
|
030000007e0500003703000000016800,Nintendo GameCube Controller,a:b0,b:b2,dpdown:b6,dpleft:b4,dpright:b5,dpup:b7,lefttrigger:a4,leftx:a0,lefty:a1~,rightshoulder:b9,righttrigger:a5,rightx:a2,righty:a3~,start:b8,x:b1,y:b3,platform:Linux,
|
||||||
03000000790000004618000010010000,Nintendo GameCube Controller Adapter,a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,rightx:a5~,righty:a2~,start:b9,x:b0,y:b3,platform:Linux,
|
03000000790000004618000010010000,Nintendo GameCube Controller Adapter,a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,rightx:a5~,righty:a2~,start:b9,x:b0,y:b3,platform:Linux,
|
||||||
050000007e0500000920000001000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
|
050000007e0500000920000001000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
|
||||||
|
|
|
@ -722,8 +722,8 @@ void PADDialog::config_key(int pad, int key)
|
||||||
if (PollForNewKeyboardKeys(key_pressed))
|
if (PollForNewKeyboardKeys(key_pressed))
|
||||||
{
|
{
|
||||||
// special case for keyboard/mouse to handle multiple keys
|
// special case for keyboard/mouse to handle multiple keys
|
||||||
// Note: key_pressed == 0 when ESC is hit to abort the capture
|
// Note: key_pressed == UINT32_MAX when ESC is hit to abort the capture
|
||||||
if (key_pressed > 0)
|
if (key_pressed != UINT32_MAX)
|
||||||
{
|
{
|
||||||
clear_key(pad, key);
|
clear_key(pad, key);
|
||||||
set_keyboard_key(pad, key_pressed, key);
|
set_keyboard_key(pad, key_pressed, key);
|
||||||
|
|
Loading…
Reference in New Issue