More work on wiimote plugin X11 input config

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3730 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
LPFaint99 2009-07-10 06:16:22 +00:00
parent 8145eb30d9
commit bd7419d437
5 changed files with 213 additions and 169 deletions

View file

@ -26,6 +26,184 @@
#include "EmuDefinitions.h" // for PadMapping
#include "main.h"
// Ini Control Names
// Do not change the order unless you change the related arrays
static const char* wmControlNames[] =
{
"WmA",
"WmB",
"Wm1",
"Wm2",
"WmP",
"WmM",
"WmH",
"WmL",
"WmR",
"WmU",
"WmD",
"WmShake",
"WmPitchL",
"WmPitchR",
};
static const char* ncControlNames[] =
{
"NcZ",
"NcC",
"NcL",
"NcR",
"NcU",
"NcD",
"NcShake",
};
static const char* ccControlNames[] =
{
"CcA",
"CcB",
"CcX",
"CcY",
"CcP",
"CcM",
"CcH",
"CcTl",
"CcZl",
"CcZr",
"CcTr",
"CcDl",
"CcDu",
"CcDr",
"CcDd",
"CcLl",
"CcLu",
"CcLr",
"CcLd",
"CcRl",
"CcRu",
"CcRr",
"CcRd",
};
static const char* gh3ControlNames[] =
{
"GH3Green",
"GH3Red",
"GH3Yellow",
"GH3Blue",
"GH3Orange",
"GH3Plus",
"GH3Minus",
"GH3Whammy",
"GH3Al",
"GH3Au",
"GH3Ar",
"GH3Ad",
"GH3StrumUp",
"GH3StrumDown",
};
// Default controls
static int wmDefaultControls[] =
{
65, // WmA
66, // WmB
49, // Wm1
50, // Wm2
80, // WmP
77, // WmM
72, // WmH
#ifdef _WIN32
VK_LEFT, // Regular directional keys
VK_RIGHT,
VK_UP,
VK_DOWN,
#elif defined(HAVE_X11) && HAVE_X11
XK_Left,
XK_Right,
XK_Up,
XK_Down,
#else
0,0,0,0,
#endif
83, // WmShake (S)
51, // WmPitchL (3)
52, // WmPitchR (4)
};
static int nCDefaultControls[] =
{
90, // NcZ Z
67, // NcC C
#ifdef _WIN32
VK_NUMPAD4, // NcL
VK_NUMPAD6, // NcR
VK_NUMPAD8, // NcU
VK_NUMPAD5, // NcD
#elif defined(HAVE_X11) && HAVE_X11
XK_KP_Left, // Numlock must be off
XK_KP_Right,
XK_KP_Up,
XK_KP_Down,
#else
0,0,0,0,
#endif
68, // NcShake D
};
static int ccDefaultControls[] =
{
90, // CcA (C)
67, // CcB (Z)
0x58, // CcX (X)
0x59, // CcY (Y)
0x4f, // CcP O instead of P
0x4e, // CcM N instead of M
0x55, // CcH U instead of H
0x37, // CcTl 7
0x38, // CcZl 8
0x39, // CcZr 9
0x30, // CcTr 0
#ifdef _WIN32 // TODO: ugly that wm/nc use lrud and cc/gh3 use lurd
VK_NUMPAD4, //CcDl
VK_NUMPAD8, // CcDu
VK_NUMPAD6, // CcDr
VK_NUMPAD5, // CcDd
#elif defined(HAVE_X11) && HAVE_X11
XK_KP_Left, // Numlock must be off
XK_KP_Up,
XK_KP_Right,
XK_KP_Down,
#else
0,0,0,0,
#endif
0x4a, // CcLl J
0x49, // CcLu I
0x4c, // CcLr L
0x4b, // CcLd K
0x44, // CcRl D
0x52, // CcRu R
0x47, // CcRr G
0x46, // CcRd F
};
static int GH3DefaultControls[] =
{
0, // GH3Green
0, // GH3Red
0, // GH3Yellow
0, // GH3Blue
0, // GH3Orange
0, // GH3Plus
0, // GH3Minus
0, // GH3Whammy
0, // GH3Al
0, // GH3Au
0, // GH3Ar
0, // GH3Ad
13, // GH3StrumUp
161, // GH3StrumDown
};
Config g_Config;
Config::Config()

View file

@ -18,6 +18,10 @@
#ifndef _PLUGIN_WIIMOTE_CONFIG_H
#define _PLUGIN_WIIMOTE_CONFIG_H
#if defined(HAVE_X11) && HAVE_X11
#include <X11/keysym.h>
#endif
#define WM_CONTROLS 14
#define NC_CONTROLS 7
#define CC_CONTROLS 23
@ -115,165 +119,5 @@ struct Config
bool bKeepAR43, bKeepAR169, bCrop;
};
// Ini Control Names
// Do not change the order unless you change the related arrays
static const char* wmControlNames[] =
{
"WmA",
"WmB",
"Wm1",
"Wm2",
"WmP",
"WmM",
"WmH",
"WmL",
"WmR",
"WmU",
"WmD",
"WmShake",
"WmPitchL",
"WmPitchR",
};
static const char* ncControlNames[] =
{
"NcZ",
"NcC",
"NcL",
"NcR",
"NcU",
"NcD",
"NcShake",
};
static const char* ccControlNames[] =
{
"CcA",
"CcB",
"CcX",
"CcY",
"CcP",
"CcM",
"CcH",
"CcTl",
"CcZl",
"CcZr",
"CcTr",
"CcDl",
"CcDu",
"CcDr",
"CcDd",
"CcLl",
"CcLu",
"CcLr",
"CcLd",
"CcRl",
"CcRu",
"CcRr",
"CcRd",
};
static const char* gh3ControlNames[] =
{
"GH3Green",
"GH3Red",
"GH3Yellow",
"GH3Blue",
"GH3Orange",
"GH3Plus",
"GH3Minus",
"GH3Whammy",
"GH3Al",
"GH3Au",
"GH3Ar",
"GH3Ad",
"GH3StrumUp",
"GH3StrumDown",
};
// Default controls
static int wmDefaultControls[] =
{
65, // WmA
66, // WmB
49, // Wm1
50, // Wm2
80, // WmP
77, // WmM
72, // WmH
#ifdef _WIN32
VK_LEFT, // Regular directional keys
VK_RIGHT,
VK_UP,
VK_DOWN,
#else
0,0,0,0,
#endif
83, // WmShake (S)
51, // WmPitchL (3)
52, // WmPitchR (4)
};
static int nCDefaultControls[] =
{
90, // NcZ Z
67, // NcC C
#ifdef _WIN32
VK_NUMPAD4, // NcL
VK_NUMPAD6, // NcR
VK_NUMPAD8, // NcU
VK_NUMPAD5, // NcD
#else
0,0,0,0,
#endif
68, // NcShake D
};
static int ccDefaultControls[] =
{
90, // CcA (C)
67, // CcB (Z)
0x58, // CcX (X)
0x59, // CcY (Y)
0x4f, // CcP O instead of P
0x4e, // CcM N instead of M
0x55, // CcH U instead of H
0x37, // CcTl 7
0x38, // CcZl 8
0x39, // CcZr 9
0x30, // CcTr 0
#ifdef _WIN32
VK_NUMPAD4, //CcDl
VK_NUMPAD8, // CcDu
VK_NUMPAD6, // CcDr
VK_NUMPAD5, // CcDd
#else
0,0,0,0,
#endif
0x4a, // CcLl J
0x49, // CcLu I
0x4c, // CcLr L
0x4b, // CcLd K
0x44, // CcRl D
0x52, // CcRu R
0x47, // CcRr G
0x46, // CcRd F
};
static int GH3DefaultControls[] =
{
0, // GH3Green
0, // GH3Red
0, // GH3Yellow
0, // GH3Blue
0, // GH3Orange
0, // GH3Plus
0, // GH3Minus
0, // GH3Whammy
0, // GH3Al
0, // GH3Au
0, // GH3Ar
0, // GH3Ad
13, // GH3StrumUp
161, // GH3StrumDown
};
extern Config g_Config;
#endif // _PLUGIN_WIIMOTE_CONFIG_H

View file

@ -20,7 +20,9 @@
#include "ConfigPadDlg.h"
#include "Config.h"
#include "EmuMain.h" // for WiiMoteEmu class
#if defined(HAVE_X11) && HAVE_X11
#include "X11InputBase.h"
#endif
// Change Joystick
/* Function: When changing the joystick we save and load the settings and
update the PadMapping and PadState array. PadState[].joy is the gamepad
@ -161,19 +163,39 @@ void WiimotePadConfigDialog::UpdateGUIButtonMapping(int controller)
m_Button_GH3[x][controller]->SetLabel(wxString::FromAscii(
InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].GH3c.keyForControls[x]).c_str()));
}
#else
if(g_Config.iExtensionConnected == EXT_GUITARHERO3_CONTROLLER)
#elif defined(HAVE_X11) && HAVE_X11
char keyStr[10] = {0};
for (int x = 0; x < WM_CONTROLS; x++)
{
InputCommon::XKeyToString(WiiMoteEmu::PadMapping[controller].Wm.keyForControls[x], keyStr);
m_Button_Wiimote[x][controller]->SetLabel(wxString::FromAscii(keyStr));
}
if(g_Config.iExtensionConnected == EXT_NUNCHUCK)
{
for (int x = 0; x < NC_CONTROLS; x++)
{
InputCommon::XKeyToString(WiiMoteEmu::PadMapping[controller].Nc.keyForControls[x], keyStr);
m_Button_NunChuck[x][controller]->SetLabel(wxString::FromAscii(keyStr));
}
}
else if(g_Config.iExtensionConnected == EXT_CLASSIC_CONTROLLER)
{
for (int x = 0; x < CC_CONTROLS; x++)
{
InputCommon::XKeyToString(WiiMoteEmu::PadMapping[controller].Cc.keyForControls[x], keyStr);
m_Button_Classic[x][controller]->SetLabel(wxString::FromAscii(keyStr));
}
}
else if(g_Config.iExtensionConnected == EXT_GUITARHERO3_CONTROLLER)
{
//TODO: fix this and add for all key settings
for (int x = 0; x < GH3_CONTROLS; x++)
{
char keyStr[10] = {0};
//InputCommon::XKeyToString(WiiMoteEmu::PadMapping[controller].GH3c.keyForControls[x], keyStr);
InputCommon::XKeyToString(WiiMoteEmu::PadMapping[controller].GH3c.keyForControls[x], keyStr);
m_Button_GH3[x][controller]->SetLabel(wxString::FromAscii(keyStr));
}
}
#endif
//INFO_LOG(CONSOLE, "m_bWmA[%i] = %i = %s\n", controller, WiiMoteEmu::PadMapping[controller].Wm.keyForControls[0], InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.keyForControls[0]).c_str());
}

View file

@ -124,4 +124,4 @@ class WiimoteRecordingConfigDialog : public wxDialog
};
extern WiimoteRecordingConfigDialog *m_RecordingConfigFrame;
#endif
#endif

View file

@ -363,4 +363,4 @@ struct gh3_cal
#pragma pack(pop)
#endif //WIIMOTE_HID_H
#endif //WIIMOTE_HID_H