Added hotkey Alt+F1/F2/F3/F4 for connect/disconnect wiimote with OSD display

(But there is still a little problem with DX9 fullscreen toggling)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4782 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
ayuanx 2010-01-04 03:11:31 +00:00
parent cbf5929276
commit 430f44cb1e
6 changed files with 48 additions and 23 deletions

View File

@ -160,12 +160,17 @@ CPanel::CPanel(
return 0;
case WIIMOTE_DISCONNECT:
// The Wiimote has been disconnect, we offer reconnect here
if(AskYesNo("Wiimote %i has been disconnected by system.\n"
"Maybe this game doesn't support multi-wiimote,\n"
"or maybe it is due to idle time out or other reason.\n\n"
"Do you want to reconnect immediately?", lParam + 1, "Confirm", wxYES_NO))
GetUsbPointer()->AccessWiiMote(lParam | 0x100)->Activate(true);
if (main_frame->bNoWiimoteMsg)
main_frame->bNoWiimoteMsg = false;
else
{
// The Wiimote has been disconnect, we offer reconnect here
if(AskYesNo("Wiimote %i has been disconnected by system.\n"
"Maybe this game doesn't support multi-wiimote,\n"
"or maybe it is due to idle time out or other reason.\n\n"
"Do you want to reconnect immediately?", lParam + 1, "Confirm", wxYES_NO))
GetUsbPointer()->AccessWiiMote(lParam | 0x100)->Activate(true);
}
return 0;
}
break;
@ -314,13 +319,12 @@ CFrame::CFrame(wxFrame* parent,
, bRenderToMain(false), bFloatLogWindow(false), bFloatConsoleWindow(false)
, HaveLeds(false), HaveSpeakers(false)
, m_fLastClickTime(0), m_iLastMotionTime(0), LastMouseX(0), LastMouseY(0)
, m_bControlsCreated(false), bNoWiimoteMsg(false)
#if wxUSE_TIMER
, m_timer(this)
#endif
{
m_bControlsCreated = false;
if (ShowLogWindow) SConfig::GetInstance().m_InterfaceLogWindow = true;
// Give it a console early to show potential messages from this onward

View File

@ -76,6 +76,7 @@ class CFrame : public wxFrame
void InitBitmaps();
void DoStop();
bool bRenderToMain;
bool bNoWiimoteMsg;
void UpdateGUI();
void ToggleLogWindow(bool, int i = -1);
void ToggleConsole(bool, int i = -1);

View File

@ -199,10 +199,10 @@ void CFrame::CreateMenu()
toolsMenu->Append(IDM_LOAD_WII_MENU, _T("Load Wii Menu"));
}
toolsMenu->AppendSeparator();
toolsMenu->AppendCheckItem(IDM_CONNECT_WIIMOTE1, _T("Connect Wiimote 1"));
toolsMenu->AppendCheckItem(IDM_CONNECT_WIIMOTE2, _T("Connect Wiimote 2"));
toolsMenu->AppendCheckItem(IDM_CONNECT_WIIMOTE3, _T("Connect Wiimote 3"));
toolsMenu->AppendCheckItem(IDM_CONNECT_WIIMOTE4, _T("Connect Wiimote 4"));
toolsMenu->AppendCheckItem(IDM_CONNECT_WIIMOTE1, _T("Connect Wiimote 1\tAlt+F1"));
toolsMenu->AppendCheckItem(IDM_CONNECT_WIIMOTE2, _T("Connect Wiimote 2\tAlt+F2"));
toolsMenu->AppendCheckItem(IDM_CONNECT_WIIMOTE3, _T("Connect Wiimote 3\tAlt+F3"));
toolsMenu->AppendCheckItem(IDM_CONNECT_WIIMOTE4, _T("Connect Wiimote 4\tAlt+F4"));
m_MenuBar->Append(toolsMenu, _T("&Tools"));
@ -808,7 +808,10 @@ void CFrame::OnConnectWiimote(wxCommandEvent& event)
if (Core::isRunning() && Core::GetStartupParameter().bWii)
{
int Id = event.GetId() - IDM_CONNECT_WIIMOTE1;
bNoWiimoteMsg = !event.IsChecked();
GetUsbPointer()->AccessWiiMote(Id | 0x100)->Activate(event.IsChecked());
wxString msg(wxString::Format(wxT("Wiimote %i %s"), Id + 1, (event.IsChecked()) ? wxT("Connected") : wxT("Disconnected")));
Core::DisplayMessage(msg.ToAscii(), 3000);
}
}

View File

@ -113,8 +113,15 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
switch( LOWORD( wParam ))
{
case VK_RETURN: // Pressing Alt+Enter switch FullScreen/Windowed
ToggleFullscreen(hWnd);
if (m_hParent == NULL && !g_Config.RenderToMainframe)
{
ToggleFullscreen(hWnd);
return 0;
}
break;
case VK_F1: case VK_F2: case VK_F3: case VK_F4:
PostMessage(m_hMain, WM_SYSKEYDOWN, wParam, lParam);
return 0;
}
break;
@ -168,7 +175,9 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T
wndClass.cbWndExtra = 0;
wndClass.hInstance = hInstance;
wndClass.hIcon = LoadIcon( NULL, IDI_APPLICATION );
wndClass.hCursor = LoadCursor( NULL, IDC_ARROW );
// To interfer less with SetCursor() later we set this to NULL
//wndClass.hCursor = LoadCursor( NULL, IDC_ARROW );
wndClass.hCursor = NULL;
wndClass.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH );
wndClass.lpszMenuName = NULL;
wndClass.lpszClassName = m_szClassName;
@ -218,7 +227,7 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T
void Show()
{
ShowWindow(m_hWnd, SW_SHOWNORMAL);
ShowWindow(m_hWnd, SW_SHOW);
BringWindowToTop(m_hWnd);
UpdateWindow(m_hWnd);
}
@ -259,7 +268,8 @@ void ToggleFullscreen(HWND hParent)
{
if (m_hParent == NULL)
{
if (D3D::IsFullscreen()) {
if (D3D::IsFullscreen())
{
PostMessage( m_hMain, WM_USER, WM_USER_STOP, 0 );
return;
}
@ -300,7 +310,6 @@ void ToggleFullscreen(HWND hParent)
sscanf(g_Config.cFSResolution, "%dx%d", &w_fs, &h_fs);
// Get into fullscreen
g_Config.bFullscreen = true;
DEVMODE dmScreenSettings;
memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));
@ -311,15 +320,17 @@ void ToggleFullscreen(HWND hParent)
dmScreenSettings.dmFields = DM_PELSWIDTH|DM_PELSHEIGHT;
if (ChangeDisplaySettings(&dmScreenSettings, 0) != DISP_CHANGE_SUCCESSFUL)
return;
// Disable the cursor
ShowCursor(FALSE);
// SetWindowPos to the upper-left corner of the screen
SetWindowPos(hParent, NULL, 0, 0, w_fs, h_fs, SWP_NOREPOSITION | SWP_NOZORDER);
// Set new window style -> PopUp
SetWindowLong(hParent, GWL_STYLE, WS_POPUP);
// SetWindowPos to the upper-left corner of the screen
SetWindowPos(hParent, HWND_TOP, 0, 0, w_fs, h_fs, SWP_NOREPOSITION);
// Disable the cursor
ShowCursor(FALSE);
g_Config.bFullscreen = true;
// Eventually show the window!
EmuWindow::Show();
}

View File

@ -293,6 +293,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
return 0;
}
break;
case VK_F1: case VK_F2: case VK_F3: case VK_F4:
PostMessage(m_hMain, WM_SYSKEYDOWN, wParam, lParam);
return 0;
}
break;

View File

@ -148,6 +148,9 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
return 0;
}
break;
case VK_F1: case VK_F2: case VK_F3: case VK_F4:
PostMessage(m_hMain, WM_SYSKEYDOWN, wParam, lParam);
return 0;
}
break;