Changed "Wiimote On" to "Input Active", so you can bypass Wiimote input when you want to use GC controller instead, even though their buttons are binded to the same keys/pads.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4681 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
ayuanx 2009-12-11 13:57:25 +00:00
parent a751efcc6e
commit cca6f75110
8 changed files with 85 additions and 74 deletions

View File

@ -264,6 +264,7 @@ void Config::Load(bool ChangePad)
iniFile.Load(FULL_CONFIG_DIR "Wiimote.ini");
// General
iniFile.Get("Settings", "InputActive", &bInputActive, true);
iniFile.Get("Settings", "Sideways", &bSideways, false);
iniFile.Get("Settings", "Upright", &bUpright, false);
iniFile.Get("Settings", "ExtensionConnected", &iExtensionConnected, EXT_NONE);
@ -370,6 +371,7 @@ void Config::Save(int Slot)
{
IniFile iniFile;
iniFile.Load(FULL_CONFIG_DIR "Wiimote.ini");
iniFile.Set("Settings", "InputActive", bInputActive);
iniFile.Set("Settings", "Sideways", bSideways);
iniFile.Set("Settings", "Upright", bUpright);
iniFile.Set("Settings", "MotionPlusConnected", bMotionPlusConnected);
@ -391,7 +393,6 @@ void Config::Save(int Slot)
char SectionName[32];
sprintf(SectionName, "Wiimote%i", i + 1);
iniFile.Set(SectionName, "Enabled", WiiMoteEmu::PadMapping[i].enabled);
iniFile.Set(SectionName, "NoTriggerFilter", bNoTriggerFilter);
iniFile.Set(SectionName, "TiltType", Tilt.Type);;
iniFile.Set(SectionName, "TiltRollRange", Tilt.Range.Roll);
@ -419,6 +420,7 @@ void Config::Save(int Slot)
iniFile.Set(SectionName, gh3ControlNames[x], WiiMoteEmu::PadMapping[i].GH3c.keyForControls[x]);
// Save the physical device ID number
iniFile.Set(SectionName, "Enabled", WiiMoteEmu::PadMapping[i].enabled);
iniFile.Set(SectionName, "DeviceID", WiiMoteEmu::PadMapping[i].ID);
// Joypad specific settings

View File

@ -98,6 +98,7 @@ struct Config
};
// Emulated Wiimote
bool bInputActive;
bool bSideways;
bool bUpright;
bool bWideScreen;

View File

@ -31,12 +31,13 @@ BEGIN_EVENT_TABLE(WiimoteBasicConfigDialog,wxDialog)
EVT_BUTTON(ID_APPLY, WiimoteBasicConfigDialog::ButtonClick)
EVT_BUTTON(ID_BUTTONMAPPING, WiimoteBasicConfigDialog::ButtonClick)
EVT_BUTTON(ID_BUTTONRECORDING, WiimoteBasicConfigDialog::ButtonClick)
EVT_CHECKBOX(ID_CONNECT_REAL, WiimoteBasicConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(ID_USE_REAL, WiimoteBasicConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(ID_SIDEWAYSWIIMOTE, WiimoteBasicConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(ID_UPRIGHTWIIMOTE, WiimoteBasicConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(ID_MOTIONPLUSCONNECTED, WiimoteBasicConfigDialog::GeneralSettingsChanged)
EVT_CHOICE(ID_EXTCONNECTED, WiimoteBasicConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(IDC_INPUT_ACTIVE, WiimoteBasicConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(IDC_CONNECT_REAL, WiimoteBasicConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(IDC_USE_REAL, WiimoteBasicConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(IDC_SIDEWAYSWIIMOTE, WiimoteBasicConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(IDC_UPRIGHTWIIMOTE, WiimoteBasicConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(IDC_MOTIONPLUSCONNECTED, WiimoteBasicConfigDialog::GeneralSettingsChanged)
EVT_CHOICE(IDC_EXTCONNECTED, WiimoteBasicConfigDialog::GeneralSettingsChanged)
// IR cursor
EVT_COMMAND_SCROLL(IDS_WIDTH, WiimoteBasicConfigDialog::IRCursorChanged)
EVT_COMMAND_SCROLL(IDS_HEIGHT, WiimoteBasicConfigDialog::IRCursorChanged)
@ -143,8 +144,8 @@ void WiimoteBasicConfigDialog::CreateGUIControls()
m_Controller[i] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE1 + i, wxDefaultPosition, wxDefaultSize);
m_Notebook->AddPage(m_Controller[i], wxString::Format(wxT("Wiimote %d"), i+1));
m_ConnectRealWiimote[i] = new wxCheckBox(m_Controller[i], ID_CONNECT_REAL, wxT("Connect Real Wiimote"));
m_UseRealWiimote[i] = new wxCheckBox(m_Controller[i], ID_USE_REAL, wxT("Use Real Wiimote"));
m_ConnectRealWiimote[i] = new wxCheckBox(m_Controller[i], IDC_CONNECT_REAL, wxT("Connect Real Wiimote"));
m_UseRealWiimote[i] = new wxCheckBox(m_Controller[i], IDC_USE_REAL, wxT("Use Real Wiimote"));
m_ConnectRealWiimote[0]->SetValue(g_Config.bConnectRealWiimote);
m_UseRealWiimote[0]->SetValue(g_Config.bUseRealWiimote);
@ -153,7 +154,7 @@ void WiimoteBasicConfigDialog::CreateGUIControls()
m_UseRealWiimote[i]->SetToolTip(wxT("Use the real Wiimote in the game. This can be changed during gameplay. This can not be selected")
wxT(" when a recording is to be done. No status in this window will be updated when this is checked."));
m_WiiMotionPlusConnected[i] = new wxCheckBox(m_Controller[i], ID_MOTIONPLUSCONNECTED, wxT("Wii Motion Plus Connected"));
m_WiiMotionPlusConnected[i] = new wxCheckBox(m_Controller[i], IDC_MOTIONPLUSCONNECTED, wxT("Wii Motion Plus Connected"));
m_WiiMotionPlusConnected[i]->SetValue(g_Config.bMotionPlusConnected);
m_WiiMotionPlusConnected[i]->Enable(false);
@ -166,20 +167,19 @@ void WiimoteBasicConfigDialog::CreateGUIControls()
// Prolly needs to be a separate plugin
//arrayStringFor_extension.Add(wxT("Balance Board"));
extensionChoice[i] = new wxChoice(m_Controller[i], ID_EXTCONNECTED, wxDefaultPosition, wxDefaultSize, arrayStringFor_extension, 0, wxDefaultValidator);
extensionChoice[i] = new wxChoice(m_Controller[i], IDC_EXTCONNECTED, wxDefaultPosition, wxDefaultSize, arrayStringFor_extension, 0, wxDefaultValidator);
extensionChoice[i]->SetSelection(0);
// Basic Settings
m_WiimoteOnline[i] = new wxCheckBox(m_Controller[i], IDC_WIMOTE_ON, wxT("Wiimote On"));
m_WiimoteOnline[i]->SetValue(true);
m_WiimoteOnline[i]->Enable(false);
m_WiimoteOnline[i]->SetToolTip(wxString::Format(wxT("Decide if Wiimote %i shall be detected by the game"), i));
m_InputActive[i] = new wxCheckBox(m_Controller[i], IDC_INPUT_ACTIVE, wxT("Wiimote Input Active"));
m_InputActive[i]->SetValue(true);
m_InputActive[i]->SetToolTip(wxString::Format(wxT("Decide if Wiimote button events shall be sent to game"), i));
// Emulated Wiimote
m_SidewaysWiimote[i] = new wxCheckBox(m_Controller[i], ID_SIDEWAYSWIIMOTE, wxT("Sideways Wiimote"));
m_SidewaysWiimote[i] = new wxCheckBox(m_Controller[i], IDC_SIDEWAYSWIIMOTE, wxT("Sideways Wiimote"));
m_SidewaysWiimote[i]->SetValue(g_Config.bSideways);
m_SidewaysWiimote[i]->SetToolTip(wxT("Treat the sideways position as neutral"));
m_UprightWiimote[i] = new wxCheckBox(m_Controller[i], ID_UPRIGHTWIIMOTE, wxT("Upright Wiimote"));
m_UprightWiimote[i] = new wxCheckBox(m_Controller[i], IDC_UPRIGHTWIIMOTE, wxT("Upright Wiimote"));
m_UprightWiimote[i]->SetValue(g_Config.bUpright);
m_UprightWiimote[i]->SetToolTip(wxT("Treat the upright position as neutral"));
@ -212,8 +212,8 @@ void WiimoteBasicConfigDialog::CreateGUIControls()
m_Crop[i]->Enable(false);
// Sizers
m_SizeBasic[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("General Settings"));
m_SizeBasic[i]->Add(m_WiimoteOnline[i], 0, wxEXPAND | wxALL, 5);
m_SizeBasic[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Emulated Wiimote"));
m_SizeBasic[i]->Add(m_InputActive[i], 0, wxEXPAND | wxALL, 5);
m_SizeEmu[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Emulated Position"));
m_SizeEmu[i]->Add(m_SidewaysWiimote[i], 0, wxEXPAND | wxALL, 5);
@ -294,7 +294,7 @@ void WiimoteBasicConfigDialog::CreateGUIControls()
// Center the window if there is room for it
#ifdef _WIN32
if (GetSystemMetrics(SM_CYFULLSCREEN) > 800)
if (GetSystemMetrics(SM_CYFULLSCREEN) > 600)
Center();
#endif
ControlsCreated = true;
@ -369,26 +369,29 @@ void WiimoteBasicConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
{
switch (event.GetId())
{
case ID_CONNECT_REAL:
case IDC_CONNECT_REAL:
DoConnectReal();
break;
case ID_USE_REAL:
case IDC_USE_REAL:
// Enable the Wiimote thread
g_Config.bUseRealWiimote = m_UseRealWiimote[Page]->IsChecked();
if (g_Config.bUseRealWiimote) DoUseReal();
break;
case ID_SIDEWAYSWIIMOTE:
case IDC_INPUT_ACTIVE:
g_Config.bInputActive = m_InputActive[Page]->IsChecked();
break;
case IDC_SIDEWAYSWIIMOTE:
g_Config.bSideways = m_SidewaysWiimote[Page]->IsChecked();
break;
case ID_UPRIGHTWIIMOTE:
break;
case IDC_UPRIGHTWIIMOTE:
g_Config.bUpright = m_UprightWiimote[Page]->IsChecked();
break;
case ID_MOTIONPLUSCONNECTED:
case IDC_MOTIONPLUSCONNECTED:
g_Config.bMotionPlusConnected = m_WiiMotionPlusConnected[Page]->IsChecked();
break;
case ID_EXTCONNECTED:
case IDC_EXTCONNECTED:
g_Config.iExtensionConnected = EXT_NONE;
// Disconnect the extension so that the game recognize the change
DoExtensionConnectedDisconnected();

View File

@ -52,13 +52,13 @@ class WiimoteBasicConfigDialog : public wxDialog
// Timers
wxTimer *m_TimeoutOnce,
*m_ShutDownTimer;
wxCheckBox *m_UseRealWiimote[4];
private:
DECLARE_EVENT_TABLE();
bool ControlsCreated,
m_bEnableUseRealWiimote;
bool ControlsCreated, m_bEnableUseRealWiimote;
int Page;
wxNotebook *m_Notebook;
@ -68,19 +68,17 @@ class WiimoteBasicConfigDialog : public wxDialog
*m_ButtonMapping,
*m_Recording;
wxBoxSizer *m_MainSizer,
*m_sMain[4],
*m_SizeParent[4];
wxChoice* extensionChoice[4];
wxSlider *m_SliderWidth[4],
*m_SliderHeight[4],
*m_SliderLeft[4],
*m_SliderTop[4];
// Emulated Wiimote settings
wxCheckBox *m_SidewaysWiimote[4],
wxCheckBox *m_InputActive[4],
*m_SidewaysWiimote[4],
*m_UprightWiimote[4],
*m_WiimoteOnline[4],
*m_ConnectRealWiimote[4],
*m_WiiMotionPlusConnected[4],
*m_CheckAR43[4],
*m_CheckAR169[4],
@ -91,7 +89,11 @@ class WiimoteBasicConfigDialog : public wxDialog
*m_TextScreenLeft[4],
*m_TextScreenTop[4],
*m_TextAR[4];
wxBoxSizer *m_SizeBasicGeneral[4],
wxBoxSizer *m_MainSizer,
*m_sMain[4],
*m_SizeParent[4],
*m_SizeBasicGeneral[4],
*m_SizeBasicGeneralLeft[4],
*m_SizeBasicGeneralRight[4],
*m_SizerIRPointerWidth[4],
@ -104,11 +106,6 @@ class WiimoteBasicConfigDialog : public wxDialog
*m_SizeExtensions[4],
*m_SizerIRPointer[4];
wxChoice* extensionChoice[4];
// Real Wiimote settings
wxCheckBox *m_ConnectRealWiimote[4];
enum
{
ID_CLOSE = 1000,
@ -126,20 +123,20 @@ class WiimoteBasicConfigDialog : public wxDialog
ID_CONTROLLERPAGE4,
// Emulated Wiimote
ID_SIDEWAYSWIIMOTE,
ID_UPRIGHTWIIMOTE,
ID_MOTIONPLUSCONNECTED,
ID_EXTCONNECTED,
IDC_WIMOTE_ON,
IDC_INPUT_ACTIVE,
IDC_SIDEWAYSWIIMOTE,
IDC_UPRIGHTWIIMOTE,
IDC_MOTIONPLUSCONNECTED,
IDC_EXTCONNECTED,
// Real
IDC_CONNECT_REAL,
IDC_USE_REAL,
IDS_WIDTH,
IDS_HEIGHT,
IDS_LEFT,
IDS_TOP,
// Real
ID_CONNECT_REAL,
ID_USE_REAL,
};
void OnClose(wxCloseEvent& event);

View File

@ -914,7 +914,7 @@ void WiimotePadConfigDialog::CreatePadGUIControls()
// Center the window if there is room for it
#ifdef _WIN32
if (GetSystemMetrics(SM_CYFULLSCREEN) > 800)
if (GetSystemMetrics(SM_CYFULLSCREEN) > 600)
Center();
#endif

View File

@ -633,17 +633,22 @@ void Update()
if(g_ReportingAuto == false)
return;
readKeyboard();
// Read input or not
// Check if the pad state should be updated
if (g_Config.bInputActive)
{
ReadLinuxKeyboard();
/*
if ((g_Config.Tilt.Type == g_Config.Tilt.TRIGGER || g_Config.Tilt.Type == g_Config.Tilt.ANALOG1 || g_Config.Tilt.Type == g_Config.Tilt.ANALOG2
|| g_Config.Nunchuck.Type == g_Config.Nunchuck.ANALOG1 || g_Config.Nunchuck.Type == g_Config.Nunchuck.ANALOG2
|| g_Config.ClassicController.LType == g_Config.ClassicController.ANALOG1 || g_Config.ClassicController.LType == g_Config.ClassicController.ANALOG2
|| g_Config.ClassicController.RType == g_Config.ClassicController.ANALOG1 || g_Config.ClassicController.RType == g_Config.ClassicController.ANALOG2)
&& NumGoodPads > 0 && joyinfo.size() > (u32)PadMapping[0].ID)
{
*/
// Check if the pad state should be updated
const int Page = 0;
WiiMoteEmu::GetJoyState(PadState[Page], PadMapping[Page], Page, joyinfo[PadMapping[Page].ID].NumButtons);
if (NumGoodPads > 0 && joyinfo.size() > (u32)PadMapping[Page].ID)
WiiMoteEmu::GetJoyState(PadState[Page], PadMapping[Page], Page, joyinfo[PadMapping[Page].ID].NumButtons);
}
switch(g_ReportingMode)
@ -669,7 +674,7 @@ void Update()
}
void readKeyboard()
void ReadLinuxKeyboard()
{
#if defined(HAVE_X11) && HAVE_X11
XEvent E;

View File

@ -41,7 +41,7 @@ void Shutdown(void);
void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size);
void ControlChannel(u16 _channelID, const void* _pData, u32 _Size) ;
void Update();
void readKeyboard();
void ReadLinuxKeyboard();
// Recordings
void LoadRecordedMovements();

View File

@ -299,24 +299,27 @@ int RecordingCheckKeys(int WmNuIr)
int GetMapKeyState(int _MapKey, int Key)
{
const int Page = 0;
if (_MapKey < 256)
#ifdef _WIN32
return GetAsyncKeyState(_MapKey); // Keyboard (Windows)
#else
return KeyStatus[Key]; // Keyboard (Linux)
#endif
if (_MapKey < 0x1100)
return SDL_JoystickGetButton(PadState[Page].joy, _MapKey - 0x1000); // Pad button
else // Pad hat
if (g_Config.bInputActive)
{
u8 HatCode, HatKey;
HatCode = SDL_JoystickGetHat(PadState[Page].joy, (_MapKey - 0x1100) / 0x0010);
HatKey = (_MapKey - 0x1100) % 0x0010;
const int Page = 0;
if (HatCode & HatKey)
return HatKey;
if (_MapKey < 256)
#ifdef _WIN32
return GetAsyncKeyState(_MapKey); // Keyboard (Windows)
#else
return KeyStatus[Key]; // Keyboard (Linux)
#endif
if (_MapKey < 0x1100)
return SDL_JoystickGetButton(PadState[Page].joy, _MapKey - 0x1000); // Pad button
else // Pad hat
{
u8 HatCode, HatKey;
HatCode = SDL_JoystickGetHat(PadState[Page].joy, (_MapKey - 0x1100) / 0x0010);
HatKey = (_MapKey - 0x1100) % 0x0010;
if (HatCode & HatKey)
return HatKey;
}
}
return NULL;
}