Added support for AZERTY keyboard layout. Most keys should now work correctly for AZERTY keyboards, if you set the correct Wii language in Dolphin.
To change keyboard layout used, you need to open User\Config\Dolphin.ini and add the following two lines: [USB Keyboard] Layout = {0 for QWERTY, 1 for AZERTY} git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3056 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
35b99a80ed
commit
c525563d77
|
@ -1999,7 +1999,7 @@ bool CWII_IPC_HLE_Device_usb_oh0::IOCtlV(u32 _CommandAddress)
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
u8 CWII_IPC_HLE_Device_usb_kbd::m_KeyCodes[256] = {
|
||||
u8 CWII_IPC_HLE_Device_usb_kbd::m_KeyCodesQWERTY[256] = {
|
||||
#ifdef _WIN32
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x2A, // Backspace
|
||||
|
@ -2090,6 +2090,97 @@ u8 CWII_IPC_HLE_Device_usb_kbd::m_KeyCodes[256] = {
|
|||
#endif
|
||||
};
|
||||
|
||||
u8 CWII_IPC_HLE_Device_usb_kbd::m_KeyCodesAZERTY[256] = {
|
||||
#ifdef _WIN32
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x2A, // Backspace
|
||||
0x2B, // Tab
|
||||
0x00, 0x00,
|
||||
0x00, // Clear
|
||||
0x28, // Return
|
||||
0x00, 0x00,
|
||||
0x00, // Shift
|
||||
0x00, // Control
|
||||
0x00, // ALT
|
||||
0x48, // Pause
|
||||
0x39, // Capital
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x29, // Escape
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x2C, // Space
|
||||
0x4B, // Prior
|
||||
0x4E, // Next
|
||||
0x4D, // End
|
||||
0x4A, // Home
|
||||
0x50, // Left
|
||||
0x52, // Up
|
||||
0x4F, // Right
|
||||
0x51, // Down
|
||||
0x00, 0x00, 0x00,
|
||||
0x46, // Print screen
|
||||
0x49, // Insert
|
||||
0x4C, // Delete
|
||||
0x00,
|
||||
// 0 -> 9
|
||||
0x27, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24,
|
||||
0x25, 0x26,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00,
|
||||
// A -> Z
|
||||
0x14, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B,
|
||||
0x0C, 0x0D, 0x0E, 0x0F, 0x33, 0x11, 0x12, 0x13,
|
||||
0x04, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1D, 0x1B,
|
||||
0x1C, 0x1A,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00,
|
||||
// Numpad 0 -> 9
|
||||
0x62, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
|
||||
0x60, 0x61,
|
||||
0x55, // Multiply
|
||||
0x57, // Add
|
||||
0x00, // Separator
|
||||
0x56, // Substract
|
||||
0x63, // Decimal
|
||||
0x54, // Divide
|
||||
// F1 -> F12
|
||||
0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41,
|
||||
0x42, 0x43, 0x44, 0x45,
|
||||
// F13 -> F24
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x53, // Numlock
|
||||
0x47, // Scroll lock
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
// Modifier keys
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x30, // '$'
|
||||
0x2E, // Plus
|
||||
0x10, // Comma
|
||||
0x00, // Minus
|
||||
0x36, // Period
|
||||
0x37, // '/'
|
||||
0x34, // 'ù'
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
0x2D, // ')'
|
||||
0x32, // '\'
|
||||
0x2F, // '^'
|
||||
0x00, // '²'
|
||||
0x38, // '!'
|
||||
0x00, // Nothing interesting past this point.
|
||||
#else
|
||||
// TODO: do it for non-Windows platforms
|
||||
0
|
||||
#endif
|
||||
};
|
||||
|
||||
CWII_IPC_HLE_Device_usb_kbd::CWII_IPC_HLE_Device_usb_kbd(u32 _DeviceID, const std::string& _rDeviceName)
|
||||
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
|
||||
{
|
||||
|
@ -2102,9 +2193,13 @@ bool CWII_IPC_HLE_Device_usb_kbd::Open(u32 _CommandAddress, u32 _Mode)
|
|||
{
|
||||
Memory::Write_U32(GetDeviceID(), _CommandAddress+4);
|
||||
|
||||
IniFile ini;
|
||||
ini.Load(CONFIG_FILE);
|
||||
ini.Get("USB Keyboard", "Layout", &m_KeyboardLayout, KBD_LAYOUT_QWERTY);
|
||||
|
||||
for(int i = 0; i < 256; i++)
|
||||
m_KeyBuffer[i] = false;
|
||||
m_Modifiers = 0x00;
|
||||
m_OldKeyBuffer[i] = false;
|
||||
m_OldModifiers = 0x00;
|
||||
|
||||
PushMessage(MSG_KBD_CONNECT, 0x00, NULL);
|
||||
|
||||
|
@ -2153,16 +2248,28 @@ u32 CWII_IPC_HLE_Device_usb_kbd::Update()
|
|||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
bool KeyPressedNow = IsKeyPressed(i);
|
||||
bool KeyPressedBefore = m_KeyBuffer[i];
|
||||
bool KeyPressedBefore = m_OldKeyBuffer[i];
|
||||
u8 KeyCode;
|
||||
|
||||
if (KeyPressedNow ^ KeyPressedBefore)
|
||||
{
|
||||
if (KeyPressedNow)
|
||||
{
|
||||
if(m_KeyCodes[i] == 0x00)
|
||||
continue;
|
||||
switch(m_KeyboardLayout)
|
||||
{
|
||||
case KBD_LAYOUT_QWERTY:
|
||||
KeyCode = m_KeyCodesQWERTY[i];
|
||||
break;
|
||||
|
||||
PressedKeys[j] = m_KeyCodes[i];
|
||||
case KBD_LAYOUT_AZERTY:
|
||||
KeyCode = m_KeyCodesAZERTY[i];
|
||||
break;
|
||||
}
|
||||
|
||||
if(KeyCode == 0x00)
|
||||
continue;
|
||||
|
||||
PressedKeys[j] = KeyCode;
|
||||
|
||||
j++;
|
||||
if(j == 6) break;
|
||||
|
@ -2171,7 +2278,7 @@ u32 CWII_IPC_HLE_Device_usb_kbd::Update()
|
|||
GotEvent = true;
|
||||
}
|
||||
|
||||
m_KeyBuffer[i] = KeyPressedNow;
|
||||
m_OldKeyBuffer[i] = KeyPressedNow;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -2187,7 +2294,7 @@ u32 CWII_IPC_HLE_Device_usb_kbd::Update()
|
|||
Modifiers |= 0x10;
|
||||
if (GetAsyncKeyState(VK_RSHIFT) & 0x8000)
|
||||
Modifiers |= 0x20;
|
||||
if (GetAsyncKeyState(VK_MENU) & 0x8000) // TODO: VK_MENU is for ALT, not for ALT GR
|
||||
if (GetAsyncKeyState(VK_MENU) & 0x8000) // TODO: VK_MENU is for ALT, not for ALT GR (ALT GR seems to work though...)
|
||||
Modifiers |= 0x40;
|
||||
if (GetAsyncKeyState(VK_RWIN) & 0x8000)
|
||||
Modifiers |= 0x80;
|
||||
|
@ -2195,10 +2302,10 @@ u32 CWII_IPC_HLE_Device_usb_kbd::Update()
|
|||
// TODO: modifiers for non-Windows platforms
|
||||
#endif
|
||||
|
||||
if(Modifiers ^ m_Modifiers)
|
||||
if(Modifiers ^ m_OldModifiers)
|
||||
{
|
||||
GotEvent = true;
|
||||
m_Modifiers = Modifiers;
|
||||
m_OldModifiers = Modifiers;
|
||||
}
|
||||
|
||||
if (GotEvent)
|
||||
|
|
|
@ -251,7 +251,16 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
static u8 m_KeyCodes[256];
|
||||
static u8 m_KeyCodesQWERTY[256];
|
||||
static u8 m_KeyCodesAZERTY[256];
|
||||
|
||||
enum
|
||||
{
|
||||
KBD_LAYOUT_QWERTY = 0,
|
||||
KBD_LAYOUT_AZERTY
|
||||
};
|
||||
|
||||
int m_KeyboardLayout;
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -273,8 +282,8 @@ private:
|
|||
|
||||
std::queue<SMessageData> m_MessageQueue;
|
||||
|
||||
bool m_KeyBuffer[256];
|
||||
u8 m_Modifiers;
|
||||
bool m_OldKeyBuffer[256];
|
||||
u8 m_OldModifiers;
|
||||
|
||||
virtual bool IsKeyPressed(int _Key);
|
||||
|
||||
|
|
Loading…
Reference in New Issue