Introducing: Adjustable read timeout for real wiimote + minor clean up within old wiimoteplugin
Issue 2211 closed. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5452 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
aaafff7f9d
commit
2840914dab
|
@ -266,6 +266,7 @@ void Config::Load()
|
|||
iniFile.Get("Real", "UpdateStatus", &bUpdateRealWiimote, true);
|
||||
iniFile.Get("Real", "Unpair", &bUnpairRealWiimote, false);
|
||||
iniFile.Get("Real", "Autopair", &bPairRealWiimote, false);
|
||||
iniFile.Get("Real", "Timeout", &bWiiReadTimeout, 10);
|
||||
iniFile.Get("Real", "AccNeutralX", &iAccNeutralX, 0);
|
||||
iniFile.Get("Real", "AccNeutralY", &iAccNeutralY, 0);
|
||||
iniFile.Get("Real", "AccNeutralZ", &iAccNeutralZ, 0);
|
||||
|
@ -392,6 +393,7 @@ void Config::Save()
|
|||
iniFile.Set("Real", "UpdateStatus", bUpdateRealWiimote);
|
||||
iniFile.Set("Real", "Unpair", bUnpairRealWiimote);
|
||||
iniFile.Set("Real", "Autopair", bPairRealWiimote);
|
||||
iniFile.Set("Real", "Timeout", bWiiReadTimeout);
|
||||
iniFile.Set("Real", "AccNeutralX", iAccNeutralX);
|
||||
iniFile.Set("Real", "AccNeutralY", iAccNeutralY);
|
||||
iniFile.Set("Real", "AccNeutralZ", iAccNeutralZ);
|
||||
|
|
|
@ -34,7 +34,7 @@ struct Config
|
|||
|
||||
// Real Wiimote
|
||||
bool bUpdateRealWiimote, bUnpairRealWiimote, bPairRealWiimote;
|
||||
int bNumberRealWiimotes, bNumberEmuWiimotes;
|
||||
int bNumberRealWiimotes, bNumberEmuWiimotes, bWiiReadTimeout;
|
||||
int iIRLeft, iIRTop, iIRWidth, iIRHeight, iIRLevel;
|
||||
int iAccNeutralX, iAccNeutralY, iAccNeutralZ;
|
||||
int iAccNunNeutralX, iAccNunNeutralY, iAccNunNeutralZ;
|
||||
|
|
|
@ -59,6 +59,7 @@ BEGIN_EVENT_TABLE(WiimoteBasicConfigDialog,wxDialog)
|
|||
EVT_COMMAND_SCROLL(IDS_LEFT, WiimoteBasicConfigDialog::IRCursorChanged)
|
||||
EVT_COMMAND_SCROLL(IDS_TOP, WiimoteBasicConfigDialog::IRCursorChanged)
|
||||
EVT_COMMAND_SCROLL(IDS_LEVEL, WiimoteBasicConfigDialog::IRCursorChanged)
|
||||
EVT_COMMAND_SCROLL(IDS_TIMEOUT, WiimoteBasicConfigDialog::IRCursorChanged)//scrollevent
|
||||
|
||||
EVT_TIMER(IDTM_UPDATE_ONCE, WiimoteBasicConfigDialog::UpdateOnce)
|
||||
END_EVENT_TABLE()
|
||||
|
@ -186,23 +187,28 @@ void WiimoteBasicConfigDialog::CreateGUIControls()
|
|||
m_TextUDPWiiPort[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("UDP Port:"));
|
||||
m_TextUDPWiiPort[i]->SetToolTip(wxT("The UDP port on witch UDPWii listens for this remote."));
|
||||
|
||||
m_PairUpRealWiimote[i] = new wxButton(m_Controller[i], IDB_PAIRUP_REAL, wxT("Pair Up Real Wiimotes"));
|
||||
m_PairUpRealWiimote[i] = new wxButton(m_Controller[i], IDB_PAIRUP_REAL, wxT("Pair Up"));
|
||||
m_PairUpRealWiimote[i]->SetToolTip(wxT("Press the Buttons 1 and 2 on your Wiimote.\nThis might take a few seconds.\nIt only works if you are using Microsoft Bluetooth stack.")); // Only working with MS BT Stack.
|
||||
#ifndef _WIN32
|
||||
m_PairUpRealWiimote[i]->Enable(false);
|
||||
#endif
|
||||
|
||||
m_TextFoundRealWiimote[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Connected to 0 Real Wiimotes"));
|
||||
m_ConnectRealWiimote[i] = new wxButton(m_Controller[i], IDB_REFRESH_REAL, wxT("Refresh Real Wiimotes"));
|
||||
m_ConnectRealWiimote[i] = new wxButton(m_Controller[i], IDB_REFRESH_REAL, wxT("Refresh"));
|
||||
m_ConnectRealWiimote[i]->SetToolTip(wxT("This can only be done when the emulator is paused or stopped."));
|
||||
|
||||
m_TextWiimoteTimeout[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Timeout: 000"));
|
||||
m_WiimoteTimeout[i] = new wxSlider(m_Controller[i], IDS_TIMEOUT, 0, 10, 200, wxDefaultPosition, wxSize(75, -1));
|
||||
m_WiimoteTimeout[i]->SetToolTip(wxT("General Reaö Wiimote Read Timeout, Default: 10 (ms). Higher values might eliminate frequent disconnects."));
|
||||
|
||||
//Real Wiimote / automatic settings
|
||||
m_WiiAutoReconnect[i] = new wxCheckBox(m_Controller[i], IDC_WIIAUTORECONNECT, wxT("Reconnect Wiimote on disconnect"));
|
||||
m_WiiAutoReconnect[i]->SetToolTip(wxT("This makes dolphin automatically reconnect a wiimote when it has being disconnected.\nThis will cause problems when 2 controllers are connected for a 1 player game."));
|
||||
m_WiiAutoUnpair[i] = new wxCheckBox(m_Controller[i], IDC_WIIAUTOUNPAIR, wxT("Unpair Wiimote on close"));
|
||||
m_WiiAutoUnpair[i]->SetToolTip(wxT("This makes dolphin automatically unpair a wiimote when dolphin is about to be closed."));
|
||||
m_WiiExtendedPairUp[i] = new wxCheckBox(m_Controller[i], IDC_WIIAUTOPAIR, wxT("Extended PairUp/Connect"));
|
||||
m_WiiExtendedPairUp[i]->SetToolTip(wxT("This makes dolphin automatically pair up and connect Wiimotes on pressing 1+2 on your Wiimote."));
|
||||
|
||||
#ifndef _WIN32
|
||||
m_WiiAutoUnpair[i]->Enable(false);
|
||||
m_PairUpRealWiimote[i]->Enable(false);
|
||||
#endif
|
||||
|
||||
//IR Pointer
|
||||
|
@ -255,11 +261,19 @@ void WiimoteBasicConfigDialog::CreateGUIControls()
|
|||
m_SizeRealAuto[i]->Add(m_WiiAutoUnpair[i], 0, wxEXPAND | (wxDOWN | wxTOP), 5);
|
||||
m_SizeRealAuto[i]->Add(m_WiiExtendedPairUp[i], 0, wxEXPAND | (wxDOWN | wxTOP), 5);
|
||||
|
||||
m_SizeRealTimeout[i] = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_SizeRealTimeout[i]->Add(m_TextWiimoteTimeout[i], 0, wxEXPAND | (wxTOP), 3);
|
||||
m_SizeRealTimeout[i]->Add(m_WiimoteTimeout[i], 0, wxEXPAND | (wxRIGHT), 0);
|
||||
|
||||
m_SizeRealRefreshPair[i] = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_SizeRealRefreshPair[i]->Add(m_PairUpRealWiimote[i], 0, wxEXPAND | wxALL, 5);
|
||||
m_SizeRealRefreshPair[i]->Add(m_ConnectRealWiimote[i], 0, wxEXPAND | wxALL, 5);
|
||||
|
||||
m_SizeReal[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Real Wiimote"));
|
||||
m_SizeReal[i]->Add(m_PairUpRealWiimote[i], 0, wxEXPAND | wxALL, 5);
|
||||
m_SizeReal[i]->Add(m_TextFoundRealWiimote[i], 0, wxEXPAND | wxALL, 5);
|
||||
m_SizeReal[i]->Add(m_ConnectRealWiimote[i], 0, wxEXPAND | wxALL, 5);
|
||||
m_SizeReal[i]->Add(m_TextFoundRealWiimote[i], 0, wxALIGN_CENTER | wxALL, 5);
|
||||
m_SizeReal[i]->Add(m_SizeRealRefreshPair[i], 0, wxALIGN_CENTER | (wxLEFT | wxDOWN | wxRIGHT), 5);
|
||||
m_SizeReal[i]->Add(m_SizeRealAuto[i], 0, wxEXPAND | wxALL, 5);
|
||||
m_SizeReal[i]->Add(m_SizeRealTimeout[i], 0, wxEXPAND | (wxLEFT | wxDOWN | wxRIGHT), 5);
|
||||
|
||||
m_SizerIRPointerWidth[i] = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_SizerIRPointerWidth[i]->Add(m_TextScreenLeft[i], 0, wxEXPAND | (wxTOP), 3);
|
||||
|
@ -525,6 +539,12 @@ void WiimoteBasicConfigDialog::IRCursorChanged(wxScrollEvent& event)
|
|||
wiiuse_set_ir_sensitivity(WiiMoteReal::g_WiiMotesFromWiiUse[i], g_Config.iIRLevel);
|
||||
}
|
||||
break;
|
||||
case IDS_TIMEOUT:
|
||||
g_Config.bWiiReadTimeout = m_WiimoteTimeout[m_Page]->GetValue();
|
||||
if (g_RealWiiMotePresent) {
|
||||
wiiuse_set_timeout(WiiMoteReal::g_WiiMotesFromWiiUse, WiiMoteReal::g_NumberOfWiiMotes, g_Config.bWiiReadTimeout, g_Config.bWiiReadTimeout);
|
||||
}
|
||||
break;
|
||||
}
|
||||
UpdateGUI();
|
||||
}
|
||||
|
@ -568,28 +588,37 @@ void WiimoteBasicConfigDialog::UpdateGUI()
|
|||
|
||||
m_InputSource[m_Page]->SetSelection(WiiMoteEmu::WiiMapping[m_Page].Source);
|
||||
m_InputSource[m_Page]->Enable(g_EmulatorState != PLUGIN_EMUSTATE_PLAY);
|
||||
|
||||
if (WiiMoteEmu::WiiMapping[m_Page].Source == 2)
|
||||
{
|
||||
m_Extension[m_Page]->Enable(false);
|
||||
m_SidewaysWiimote[m_Page]->Enable(false);
|
||||
m_UprightWiimote[m_Page]->Enable(false);
|
||||
m_Extension[m_Page]->Enable(false);
|
||||
m_WiimoteTimeout[m_Page]->Enable(true);
|
||||
m_SliderIrLevel[m_Page]->Enable(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Extension[m_Page]->Enable(true);
|
||||
m_SidewaysWiimote[m_Page]->Enable(true);
|
||||
m_UprightWiimote[m_Page]->Enable(true);
|
||||
m_Extension[m_Page]->Enable(true);
|
||||
m_WiimoteTimeout[m_Page]->Enable(false);
|
||||
m_SliderIrLevel[m_Page]->Enable(false);
|
||||
}
|
||||
|
||||
//General settings
|
||||
m_Extension[m_Page]->SetSelection(WiiMoteEmu::WiiMapping[m_Page].iExtensionConnected);
|
||||
m_SidewaysWiimote[m_Page]->SetValue(WiiMoteEmu::WiiMapping[m_Page].bSideways);
|
||||
m_UprightWiimote[m_Page]->SetValue(WiiMoteEmu::WiiMapping[m_Page].bUpright);
|
||||
m_WiiMotionPlusConnected[m_Page]->SetValue(WiiMoteEmu::WiiMapping[m_Page].bMotionPlusConnected);
|
||||
|
||||
//Real Wiimote related settings
|
||||
//Automatic settings
|
||||
m_WiiAutoReconnect[m_Page]->SetValue(WiiMoteEmu::WiiMapping[m_Page].bWiiAutoReconnect);
|
||||
m_WiiAutoUnpair[m_Page]->SetValue(g_Config.bUnpairRealWiimote);
|
||||
m_WiiExtendedPairUp[m_Page]->SetValue(g_Config.bPairRealWiimote);
|
||||
m_Extension[m_Page]->SetSelection(WiiMoteEmu::WiiMapping[m_Page].iExtensionConnected);
|
||||
m_TextWiimoteTimeout[m_Page]->SetLabel(wxString::Format(wxT("Timeout: %i"), g_Config.bWiiReadTimeout));
|
||||
m_WiimoteTimeout[m_Page]->SetValue(g_Config.bWiiReadTimeout);
|
||||
|
||||
// Update the Wiimote IR pointer calibration
|
||||
m_TextScreenWidth[m_Page]->SetLabel(wxString::Format(wxT("Width: %i"), g_Config.iIRWidth));
|
||||
|
@ -597,6 +626,7 @@ void WiimoteBasicConfigDialog::UpdateGUI()
|
|||
m_TextScreenLeft[m_Page]->SetLabel(wxString::Format(wxT("Left: %i"), g_Config.iIRLeft));
|
||||
m_TextScreenTop[m_Page]->SetLabel(wxString::Format(wxT("Top: %i"), g_Config.iIRTop));
|
||||
m_TextScreenIrLevel[m_Page]->SetLabel(wxString::Format(wxT("Sensitivity: %i"), g_Config.iIRLevel));
|
||||
|
||||
// Update the slider position if a configuration has been loaded
|
||||
m_SliderWidth[m_Page]->SetValue(g_Config.iIRWidth);
|
||||
m_SliderHeight[m_Page]->SetValue(g_Config.iIRHeight);
|
||||
|
@ -604,6 +634,10 @@ void WiimoteBasicConfigDialog::UpdateGUI()
|
|||
m_SliderTop[m_Page]->SetValue(g_Config.iIRTop);
|
||||
m_SliderIrLevel[m_Page]->SetValue(g_Config.iIRLevel);
|
||||
|
||||
m_CheckAR43[m_Page]->SetValue(g_Config.bKeepAR43);
|
||||
m_CheckAR169[m_Page]->SetValue(g_Config.bKeepAR169);
|
||||
m_Crop[m_Page]->SetValue(g_Config.bCrop);
|
||||
|
||||
//Update UDPWii
|
||||
m_UDPWiiEnable[m_Page]->Enable(g_EmulatorState != PLUGIN_EMUSTATE_PLAY);
|
||||
m_UDPWiiPort[m_Page]->Enable(g_EmulatorState != PLUGIN_EMUSTATE_PLAY);
|
||||
|
@ -614,7 +648,4 @@ void WiimoteBasicConfigDialog::UpdateGUI()
|
|||
m_UDPWiiNun[m_Page]->SetValue(WiiMoteEmu::WiiMapping[m_Page].UDPWM.enableNunchuck);
|
||||
m_UDPWiiPort[m_Page]->ChangeValue(wxString::FromAscii(WiiMoteEmu::WiiMapping[m_Page].UDPWM.port));
|
||||
|
||||
m_CheckAR43[m_Page]->SetValue(g_Config.bKeepAR43);
|
||||
m_CheckAR169[m_Page]->SetValue(g_Config.bKeepAR169);
|
||||
m_Crop[m_Page]->SetValue(g_Config.bCrop);
|
||||
}
|
||||
|
|
|
@ -77,6 +77,7 @@ class WiimoteBasicConfigDialog : public wxDialog
|
|||
*m_SliderHeight[MAX_WIIMOTES],
|
||||
*m_SliderLeft[MAX_WIIMOTES],
|
||||
*m_SliderTop[MAX_WIIMOTES],
|
||||
*m_WiimoteTimeout[MAX_WIIMOTES],
|
||||
*m_SliderIrLevel[MAX_WIIMOTES];
|
||||
|
||||
wxCheckBox *m_SidewaysWiimote[MAX_WIIMOTES],
|
||||
|
@ -94,7 +95,8 @@ class WiimoteBasicConfigDialog : public wxDialog
|
|||
*m_UDPWiiIR[MAX_WIIMOTES],
|
||||
*m_UDPWiiNun[MAX_WIIMOTES];
|
||||
|
||||
wxStaticText *m_TextScreenWidth[MAX_WIIMOTES],
|
||||
wxStaticText *m_TextWiimoteTimeout[MAX_WIIMOTES],
|
||||
*m_TextScreenWidth[MAX_WIIMOTES],
|
||||
*m_TextScreenHeight[MAX_WIIMOTES],
|
||||
*m_TextScreenLeft[MAX_WIIMOTES],
|
||||
*m_TextScreenTop[MAX_WIIMOTES],
|
||||
|
@ -107,6 +109,8 @@ class WiimoteBasicConfigDialog : public wxDialog
|
|||
*m_SizeBasicGeneral[MAX_WIIMOTES],
|
||||
*m_SizeBasicGeneralLeft[MAX_WIIMOTES],
|
||||
*m_SizeBasicGeneralRight[MAX_WIIMOTES],
|
||||
*m_SizeRealTimeout[MAX_WIIMOTES],
|
||||
*m_SizeRealRefreshPair[MAX_WIIMOTES],
|
||||
*m_SizerIRPointerWidth[MAX_WIIMOTES],
|
||||
*m_SizerIRPointerHeight[MAX_WIIMOTES],
|
||||
*m_SizerIRPointerScreen[MAX_WIIMOTES],
|
||||
|
@ -115,8 +119,8 @@ class WiimoteBasicConfigDialog : public wxDialog
|
|||
|
||||
wxStaticBoxSizer *m_SizeBasic[MAX_WIIMOTES],
|
||||
*m_SizeEmu[MAX_WIIMOTES],
|
||||
*m_SizeRealAuto[MAX_WIIMOTES],
|
||||
*m_SizeReal[MAX_WIIMOTES],
|
||||
*m_SizeRealAuto[MAX_WIIMOTES],
|
||||
*m_SizeExtensions[MAX_WIIMOTES],
|
||||
*m_SizerIRPointer[MAX_WIIMOTES],
|
||||
*m_SizeUDPWii[MAX_WIIMOTES];
|
||||
|
@ -137,7 +141,7 @@ class WiimoteBasicConfigDialog : public wxDialog
|
|||
ID_CONTROLLERPAGE3,
|
||||
ID_CONTROLLERPAGE4,
|
||||
|
||||
// Emulated Wiimote
|
||||
// Emulated/Real Wiimote
|
||||
IDC_INPUT_SOURCE,
|
||||
IDC_SIDEWAYSWIIMOTE,
|
||||
IDC_UPRIGHTWIIMOTE,
|
||||
|
@ -164,6 +168,7 @@ class WiimoteBasicConfigDialog : public wxDialog
|
|||
IDS_LEFT,
|
||||
IDS_TOP,
|
||||
IDS_LEVEL,
|
||||
IDS_TIMEOUT,
|
||||
};
|
||||
|
||||
void CreateGUIControls();
|
||||
|
|
|
@ -393,7 +393,8 @@ int Initialize()
|
|||
|
||||
// psyjoe reports this allows majority of lost packets to be transferred.
|
||||
// Will test soon
|
||||
//wiiuse_set_timeout(g_WiiMotesFromWiiUse, g_NumberOfWiiMotes, 220, 220);
|
||||
if (g_Config.bWiiReadTimeout != 10)
|
||||
wiiuse_set_timeout(g_WiiMotesFromWiiUse, g_NumberOfWiiMotes, g_Config.bWiiReadTimeout, g_Config.bWiiReadTimeout);
|
||||
|
||||
// If we are connecting from the config window without a game running we set the LEDs
|
||||
if (g_EmulatorState != PLUGIN_EMUSTATE_PLAY && g_RealWiiMotePresent)
|
||||
|
|
Loading…
Reference in New Issue