Makes "Shake by Mouse Middle Button" work again

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4640 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
ayuanx 2009-12-04 12:22:36 +00:00
parent 07cd58ebc0
commit d919a641c1
7 changed files with 36 additions and 41 deletions

View File

@ -44,9 +44,9 @@ static const char* wmControlNames[] =
"WmR",
"WmU",
"WmD",
"WmShake",
"WmPitchL",
"WmPitchR",
"WmShake",
};
static int wmDefaultControls[] =
{
@ -62,17 +62,17 @@ static int wmDefaultControls[] =
VK_RIGHT,
VK_UP,
VK_DOWN,
VK_OEM_2, // /?
VK_OEM_COMMA,
VK_OEM_PERIOD
VK_OEM_PERIOD,
VK_OEM_2 // /
#elif defined(HAVE_X11) && HAVE_X11
XK_Left,
XK_Right,
XK_Up,
XK_Down,
XK_slash,
XK_comma,
XK_period
XK_period,
XK_slash
#else
0,0,0,0,0,0,0
#endif

View File

@ -67,21 +67,8 @@ WiimoteBasicConfigDialog::WiimoteBasicConfigDialog(wxWindow *parent, wxWindowID
void WiimoteBasicConfigDialog::OnClose(wxCloseEvent& event)
{
event.Skip();
g_FrameOpen = false;
g_Config.Save();
if (m_PadConfigFrame)
{
delete m_PadConfigFrame;
m_PadConfigFrame = NULL;
}
if (m_RecordingConfigFrame)
{
delete m_RecordingConfigFrame;
m_RecordingConfigFrame = NULL;
}
if (!g_EmulatorRunning)
Shutdown();
EndModal(wxID_CLOSE);
}
@ -90,13 +77,10 @@ void WiimoteBasicConfigDialog::OnClose(wxCloseEvent& event)
We must therefore shut down the thread from here and wait for that before we can call ShutDown(). */
void WiimoteBasicConfigDialog::ShutDown(wxTimerEvent& WXUNUSED(event))
{
// Wait for the Wiimote thread to stop, then close and shutdown
WiiMoteReal::g_Shutdown = true;
m_ShutDownTimer->Start(10);
if(!WiiMoteReal::g_ThreadGoing)
{
m_ShutDownTimer->Stop();
Close();
}
}
@ -105,24 +89,32 @@ void WiimoteBasicConfigDialog::ButtonClick(wxCommandEvent& event)
switch(event.GetId())
{
case ID_CLOSE:
// Close() is a wxWidgets function that will trigger EVT_CLOSE() and then call this->Destroy().
Close();
// Wait for the Wiimote thread to stop, then close and shutdown
if(!g_EmulatorRunning)
{
WiiMoteReal::g_Shutdown = true;
m_ShutDownTimer->Start(10);
}
// Close directly
else
{
Close();
}
break;
case ID_APPLY:
g_Config.Save();
break;
case ID_BUTTONMAPPING:
if (!m_PadConfigFrame)
m_PadConfigFrame = new WiimotePadConfigDialog(this);
if (!m_PadConfigFrame->IsShown())
m_PadConfigFrame->ShowModal();
m_PadConfigFrame = new WiimotePadConfigDialog(this);
m_PadConfigFrame->ShowModal();
m_PadConfigFrame->Destroy();
m_PadConfigFrame = NULL;
break;
case ID_BUTTONRECORDING:
if (!m_RecordingConfigFrame)
m_RecordingConfigFrame = new WiimoteRecordingConfigDialog(this);
if (!m_RecordingConfigFrame->IsShown())
m_RecordingConfigFrame->ShowModal();
m_RecordingConfigFrame = new WiimoteRecordingConfigDialog(this);
m_RecordingConfigFrame->ShowModal();
m_RecordingConfigFrame->Destroy();
m_RecordingConfigFrame = NULL;
break;
}
}

View File

@ -445,8 +445,9 @@ void WiimotePadConfigDialog::DoGetButtons(int _GetId)
// Check for buttons
// If there is a timer but we should not create a new one
else
else if (WiiMoteEmu::NumGoodPads >0)
{
InputCommon::GetButton(
WiiMoteEmu::joyinfo[PadID].joy, PadID, WiiMoteEmu::joyinfo[PadID].NumButtons, WiiMoteEmu::joyinfo[PadID].NumAxes, WiiMoteEmu::joyinfo[PadID].NumHats,
g_Pressed, value, type, pressed, Succeed, Stop,

View File

@ -214,10 +214,10 @@ void WiimotePadConfigDialog::OnButtonClick(wxCommandEvent& event)
void WiimotePadConfigDialog::OnClose(wxCloseEvent& event)
{
event.Skip();
g_FrameOpen = false;
if(m_UpdatePad)
if (m_UpdatePad)
m_UpdatePad->Stop();
if (m_ButtonMappingTimer)
m_ButtonMappingTimer->Stop();
SaveButtonMappingAll(Page);
EndModal(wxID_CLOSE);
}
@ -681,9 +681,9 @@ void WiimotePadConfigDialog::CreatePadGUIControls()
wxT("Right"),
wxT("Up"),
wxT("Down"),
wxT("Shake"),
wxT("Pitch Left"),
wxT("Pitch Right"),
wxT("Shake"),
};

View File

@ -85,8 +85,6 @@ WiimoteRecordingConfigDialog::WiimoteRecordingConfigDialog(wxWindow *parent, wxW
void WiimoteRecordingConfigDialog::OnClose(wxCloseEvent& event)
{
event.Skip();
g_FrameOpen = false;
SaveFile();
EndModal(wxID_CLOSE);
}

View File

@ -181,8 +181,8 @@ struct KeyboardWiimote
ONE, TWO,
P, M, H,
L, R, U, D,
SHAKE,
PITCH_L, PITCH_R,
SHAKE,
MA, MB,
LAST_CONSTANT
};

View File

@ -191,9 +191,13 @@ void DllConfig(HWND _hParent)
if (!m_BasicConfigFrame)
m_BasicConfigFrame = new WiimoteBasicConfigDialog(GetParentedWxWindow(_hParent));
else if (!m_BasicConfigFrame->GetParent()->IsShown())
m_BasicConfigFrame->Close(true);
// Only allow one open at a time
if (!m_BasicConfigFrame->IsShown())
m_BasicConfigFrame->ShowModal();
else
m_BasicConfigFrame->Hide();
#endif
}