make ESC pause the game now instead of quitting plus fix another bug with key and window handling
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5035 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
e93e777ffb
commit
c291a2db67
|
@ -145,6 +145,11 @@ CPanel::CPanel(
|
||||||
case WM_USER:
|
case WM_USER:
|
||||||
switch(wParam)
|
switch(wParam)
|
||||||
{
|
{
|
||||||
|
// Pause
|
||||||
|
case WM_USER_PAUSE:
|
||||||
|
main_frame->DoPause();
|
||||||
|
break;
|
||||||
|
|
||||||
// Stop
|
// Stop
|
||||||
case WM_USER_STOP:
|
case WM_USER_STOP:
|
||||||
main_frame->DoStop();
|
main_frame->DoStop();
|
||||||
|
@ -739,7 +744,7 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
|
||||||
}
|
}
|
||||||
else if(event.GetKeyCode() == WXK_ESCAPE)
|
else if(event.GetKeyCode() == WXK_ESCAPE)
|
||||||
{
|
{
|
||||||
main_frame->DoStop();
|
main_frame->DoPause();
|
||||||
}
|
}
|
||||||
// event.Skip() allows the event to propagate to the gamelist for example
|
// event.Skip() allows the event to propagate to the gamelist for example
|
||||||
else if (! (Core::GetState() == Core::CORE_RUN && bRenderToMain && event.GetEventObject() == this))
|
else if (! (Core::GetState() == Core::CORE_RUN && bRenderToMain && event.GetEventObject() == this))
|
||||||
|
@ -932,8 +937,8 @@ void CFrame::DoFullscreen(bool bF)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
else // Post the message to the separate rendering window which will then handle it.
|
else // Post the message to the separate rendering window which will then handle it.
|
||||||
{
|
{
|
||||||
PostMessage((HWND)Core::GetWindowHandle(), WM_USER, TOGGLE_FULLSCREEN, 0);
|
|
||||||
BringWindowToTop((HWND)Core::GetWindowHandle());
|
BringWindowToTop((HWND)Core::GetWindowHandle());
|
||||||
|
PostMessage((HWND)Core::GetWindowHandle(), WM_USER, TOGGLE_FULLSCREEN, 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,7 @@ class CFrame : public wxFrame
|
||||||
wxMenuBar* m_MenuBar;
|
wxMenuBar* m_MenuBar;
|
||||||
wxBitmap aNormalFile;
|
wxBitmap aNormalFile;
|
||||||
void InitBitmaps();
|
void InitBitmaps();
|
||||||
|
void DoPause();
|
||||||
void DoStop();
|
void DoStop();
|
||||||
bool bRenderToMain;
|
bool bRenderToMain;
|
||||||
bool bNoWiimoteMsg;
|
bool bNoWiimoteMsg;
|
||||||
|
|
|
@ -144,6 +144,7 @@ void CFrame::CreateMenu()
|
||||||
m_pSubMenuFrameSkipping = emulationMenu->AppendSubMenu(skippingMenu, _T("Frame S&kipping"));
|
m_pSubMenuFrameSkipping = emulationMenu->AppendSubMenu(skippingMenu, _T("Frame S&kipping"));
|
||||||
for(int i = 0; i < 10; i++)
|
for(int i = 0; i < 10; i++)
|
||||||
skippingMenu->Append(IDM_FRAMESKIP0 + i, wxString::Format(_T("%i"), i), wxEmptyString, wxITEM_RADIO);
|
skippingMenu->Append(IDM_FRAMESKIP0 + i, wxString::Format(_T("%i"), i), wxEmptyString, wxITEM_RADIO);
|
||||||
|
skippingMenu->Check(IDM_FRAMESKIP0 + SConfig::GetInstance().m_FrameSkip, true);
|
||||||
|
|
||||||
emulationMenu->AppendSeparator();
|
emulationMenu->AppendSeparator();
|
||||||
emulationMenu->Append(IDM_SCREENSHOT, _T("Take S&creenshot\tF9"));
|
emulationMenu->Append(IDM_SCREENSHOT, _T("Take S&creenshot\tF9"));
|
||||||
|
@ -688,6 +689,13 @@ void CFrame::OnScreenshot(wxCommandEvent& WXUNUSED (event))
|
||||||
Core::ScreenShot();
|
Core::ScreenShot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pause the emulation
|
||||||
|
void CFrame::DoPause()
|
||||||
|
{
|
||||||
|
Core::SetState(Core::CORE_PAUSE);
|
||||||
|
UpdateGUI();
|
||||||
|
}
|
||||||
|
|
||||||
// Stop the emulation
|
// Stop the emulation
|
||||||
void CFrame::DoStop()
|
void CFrame::DoStop()
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,7 +18,8 @@
|
||||||
enum PLUGIN_COMM
|
enum PLUGIN_COMM
|
||||||
{
|
{
|
||||||
// Begin at 10 in case there is already messages with wParam = 0, 1, 2 and so on
|
// Begin at 10 in case there is already messages with wParam = 0, 1, 2 and so on
|
||||||
WM_USER_STOP = 10,
|
WM_USER_PAUSE = 10,
|
||||||
|
WM_USER_STOP,
|
||||||
WM_USER_CREATE,
|
WM_USER_CREATE,
|
||||||
WM_USER_KEYDOWN,
|
WM_USER_KEYDOWN,
|
||||||
WM_USER_VIDEO_STOP,
|
WM_USER_VIDEO_STOP,
|
||||||
|
|
|
@ -101,8 +101,8 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
|
||||||
// Pressing Esc switches to Windowed mode from Fullscreen mode
|
// Pressing Esc switches to Windowed mode from Fullscreen mode
|
||||||
ToggleFullscreen(hWnd);
|
ToggleFullscreen(hWnd);
|
||||||
}
|
}
|
||||||
// And stops the emulation when already in Windowed mode
|
// And pauses the emulation when already in Windowed mode
|
||||||
PostMessage(m_hMain, WM_USER, WM_USER_STOP, 0);
|
PostMessage(m_hMain, WM_USER, WM_USER_PAUSE, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '3': // OSD keys
|
case '3': // OSD keys
|
||||||
|
@ -130,6 +130,8 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
|
||||||
case VK_F5: case VK_F6: case VK_F7: case VK_F8:
|
case VK_F5: case VK_F6: case VK_F7: case VK_F8:
|
||||||
PostMessage(m_hMain, WM_SYSKEYDOWN, wParam, lParam);
|
PostMessage(m_hMain, WM_SYSKEYDOWN, wParam, lParam);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
return DefWindowProc(hWnd, iMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -144,7 +146,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
// When the user closes the window, we post an event to the main window to call Stop()
|
// When the user closes the window, we post an event to the main window to call Stop()
|
||||||
// Which then handles all the necessary steps to Shutdown the core + the plugins
|
// Which then handles all the necessary steps to Shutdown the core + the plugins
|
||||||
if (m_hParent == NULL)
|
if (!g_Config.RenderToMainframe)
|
||||||
{
|
{
|
||||||
PostMessage(m_hMain, WM_USER, WM_USER_STOP, 0);
|
PostMessage(m_hMain, WM_USER, WM_USER_STOP, 0);
|
||||||
}
|
}
|
||||||
|
@ -171,6 +173,8 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
|
||||||
case SC_SCREENSAVE:
|
case SC_SCREENSAVE:
|
||||||
case SC_MONITORPOWER:
|
case SC_MONITORPOWER:
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
return DefWindowProc(hWnd, iMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -250,8 +250,8 @@ void OnKeyDown(WPARAM wParam)
|
||||||
// Pressing Esc switches to Windowed mode from Fullscreen mode
|
// Pressing Esc switches to Windowed mode from Fullscreen mode
|
||||||
ToggleFullscreen(m_hWnd);
|
ToggleFullscreen(m_hWnd);
|
||||||
}
|
}
|
||||||
// then stops the emulation if already Windowed
|
// then pauses the emulation if already Windowed
|
||||||
SendMessage(m_hWnd, WM_CLOSE, 0, 0);
|
SendMessage(m_hMain, WM_USER, WM_USER_PAUSE, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '3': // OSD keys
|
case '3': // OSD keys
|
||||||
|
|
|
@ -162,8 +162,8 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
|
||||||
// Pressing Esc switches to Windowed mode from Fullscreen mode
|
// Pressing Esc switches to Windowed mode from Fullscreen mode
|
||||||
ToggleFullscreen(hWnd);
|
ToggleFullscreen(hWnd);
|
||||||
}
|
}
|
||||||
// And stops the emulation when already in Windowed mode
|
// And pause the emulation when already in Windowed mode
|
||||||
PostMessage(m_hMain, WM_USER, WM_USER_STOP, 0);
|
PostMessage(m_hMain, WM_USER, WM_USER_PAUSE, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
g_VideoInitialize.pKeyPress(LOWORD(wParam), GetAsyncKeyState(VK_SHIFT) != 0, GetAsyncKeyState(VK_CONTROL) != 0);
|
g_VideoInitialize.pKeyPress(LOWORD(wParam), GetAsyncKeyState(VK_SHIFT) != 0, GetAsyncKeyState(VK_CONTROL) != 0);
|
||||||
|
|
Loading…
Reference in New Issue