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", "WmR",
"WmU", "WmU",
"WmD", "WmD",
"WmShake",
"WmPitchL", "WmPitchL",
"WmPitchR", "WmPitchR",
"WmShake",
}; };
static int wmDefaultControls[] = static int wmDefaultControls[] =
{ {
@ -62,17 +62,17 @@ static int wmDefaultControls[] =
VK_RIGHT, VK_RIGHT,
VK_UP, VK_UP,
VK_DOWN, VK_DOWN,
VK_OEM_2, // /?
VK_OEM_COMMA, VK_OEM_COMMA,
VK_OEM_PERIOD VK_OEM_PERIOD,
VK_OEM_2 // /
#elif defined(HAVE_X11) && HAVE_X11 #elif defined(HAVE_X11) && HAVE_X11
XK_Left, XK_Left,
XK_Right, XK_Right,
XK_Up, XK_Up,
XK_Down, XK_Down,
XK_slash,
XK_comma, XK_comma,
XK_period XK_period,
XK_slash
#else #else
0,0,0,0,0,0,0 0,0,0,0,0,0,0
#endif #endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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