Make wiimote connect/disconnect hotkeys work when not rendering to main. Also made them configurable.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5409 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
ca3de2f1ec
commit
98bd41385d
|
@ -25,6 +25,20 @@
|
||||||
|
|
||||||
SConfig* SConfig::m_Instance;
|
SConfig* SConfig::m_Instance;
|
||||||
|
|
||||||
|
static const struct {
|
||||||
|
const char* IniText;
|
||||||
|
const int DefaultKey;
|
||||||
|
const int DefaultModifier;
|
||||||
|
} g_HKData[] = {
|
||||||
|
{ "ToggleFullscreen", 13 /* WXK_RETURN */, 0x0001 /* wxMOD_ALT */ },
|
||||||
|
{ "PlayPause", 349 /* WXK_F10 */, 0x0000 /* wxMOD_NONE */ },
|
||||||
|
{ "Stop", 27 /* WXK_ESCAPE */, 0x0000 /* wxMOD_NONE */ },
|
||||||
|
{ "Wiimote1Connect", 344 /* WXK_F5 */, 0x0001 /* wxMOD_ALT */ },
|
||||||
|
{ "Wiimote2Connect", 345 /* WXK_F6 */, 0x0001 /* wxMOD_ALT */ },
|
||||||
|
{ "Wiimote3Connect", 346 /* WXK_F7 */, 0x0001 /* wxMOD_ALT */ },
|
||||||
|
{ "Wiimote4Connect", 347 /* WXK_F8 */, 0x0001 /* wxMOD_ALT */ },
|
||||||
|
};
|
||||||
|
|
||||||
SConfig::SConfig()
|
SConfig::SConfig()
|
||||||
{
|
{
|
||||||
// Make sure we have log manager
|
// Make sure we have log manager
|
||||||
|
@ -90,12 +104,12 @@ void SConfig::SaveSettings()
|
||||||
ini.Set("Interface", "ShowConsole", m_InterfaceConsole);
|
ini.Set("Interface", "ShowConsole", m_InterfaceConsole);
|
||||||
|
|
||||||
// Hotkeys
|
// Hotkeys
|
||||||
ini.Set("Hotkeys", "ToggleFullscreen", m_LocalCoreStartupParameter.iHotkey[HK_FULLSCREEN]);
|
for (int i = HK_FULLSCREEN; i < NUM_HOTKEYS; i++)
|
||||||
ini.Set("Hotkeys", "PlayPause", m_LocalCoreStartupParameter.iHotkey[HK_PLAY_PAUSE]);
|
{
|
||||||
ini.Set("Hotkeys", "Stop", m_LocalCoreStartupParameter.iHotkey[HK_STOP]);
|
ini.Set("Hotkeys", g_HKData[i].IniText, m_LocalCoreStartupParameter.iHotkey[i]);
|
||||||
ini.Set("Hotkeys", "ToggleFullscreenModifier", m_LocalCoreStartupParameter.iHotkeyModifier[HK_FULLSCREEN]);
|
ini.Set("Hotkeys", (std::string(g_HKData[i].IniText) + "Modifier").c_str(),
|
||||||
ini.Set("Hotkeys", "PlayPauseModifier", m_LocalCoreStartupParameter.iHotkeyModifier[HK_PLAY_PAUSE]);
|
m_LocalCoreStartupParameter.iHotkeyModifier[i]);
|
||||||
ini.Set("Hotkeys", "StopModifier", m_LocalCoreStartupParameter.iHotkeyModifier[HK_STOP]);
|
}
|
||||||
|
|
||||||
// Display
|
// Display
|
||||||
ini.Set("Display", "FullscreenResolution", m_LocalCoreStartupParameter.strFullscreenResolution);
|
ini.Set("Display", "FullscreenResolution", m_LocalCoreStartupParameter.strFullscreenResolution);
|
||||||
|
@ -216,12 +230,13 @@ void SConfig::LoadSettings()
|
||||||
ini.Get("Interface", "ShowConsole", &m_InterfaceConsole, false);
|
ini.Get("Interface", "ShowConsole", &m_InterfaceConsole, false);
|
||||||
|
|
||||||
// Hotkeys
|
// Hotkeys
|
||||||
ini.Get("Hotkeys", "ToggleFullscreen", &m_LocalCoreStartupParameter.iHotkey[HK_FULLSCREEN], 13); // WXK_RETURN
|
for (int i = HK_FULLSCREEN; i < NUM_HOTKEYS; i++)
|
||||||
ini.Get("Hotkeys", "PlayPause", &m_LocalCoreStartupParameter.iHotkey[HK_PLAY_PAUSE], 349); // WXK_F10
|
{
|
||||||
ini.Get("Hotkeys", "Stop", &m_LocalCoreStartupParameter.iHotkey[HK_STOP], 27); // WXK_ESCAPE
|
ini.Get("Hotkeys", g_HKData[i].IniText,
|
||||||
ini.Get("Hotkeys", "ToggleFullscreenModifier", &m_LocalCoreStartupParameter.iHotkeyModifier[HK_FULLSCREEN], 0x0001); // wxMOD_ALT
|
&m_LocalCoreStartupParameter.iHotkey[i], g_HKData[i].DefaultKey);
|
||||||
ini.Get("Hotkeys", "PlayPauseModifier", &m_LocalCoreStartupParameter.iHotkeyModifier[HK_PLAY_PAUSE], 0x0000); // wxMOD_NONE
|
ini.Get("Hotkeys", (std::string(g_HKData[i].IniText) + "Modifier").c_str(),
|
||||||
ini.Get("Hotkeys", "StopModifier", &m_LocalCoreStartupParameter.iHotkeyModifier[HK_STOP], 0x0000); // wxMOD_NONE
|
&m_LocalCoreStartupParameter.iHotkeyModifier[i], g_HKData[i].DefaultModifier);
|
||||||
|
}
|
||||||
|
|
||||||
// Display
|
// Display
|
||||||
ini.Get("Display", "Fullscreen", &m_LocalCoreStartupParameter.bFullscreen, false);
|
ini.Get("Display", "Fullscreen", &m_LocalCoreStartupParameter.bFullscreen, false);
|
||||||
|
|
|
@ -28,6 +28,10 @@ enum Hotkey {
|
||||||
HK_FULLSCREEN,
|
HK_FULLSCREEN,
|
||||||
HK_PLAY_PAUSE,
|
HK_PLAY_PAUSE,
|
||||||
HK_STOP,
|
HK_STOP,
|
||||||
|
HK_WIIMOTE1_CONNECT,
|
||||||
|
HK_WIIMOTE2_CONNECT,
|
||||||
|
HK_WIIMOTE3_CONNECT,
|
||||||
|
HK_WIIMOTE4_CONNECT,
|
||||||
NUM_HOTKEYS,
|
NUM_HOTKEYS,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -817,6 +817,7 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
|
||||||
{
|
{
|
||||||
if(Core::GetState() != Core::CORE_UNINITIALIZED)
|
if(Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||||
{
|
{
|
||||||
|
int WiimoteId = -1;
|
||||||
// Toggle fullscreen
|
// Toggle fullscreen
|
||||||
if (IsHotkey(event, HK_FULLSCREEN))
|
if (IsHotkey(event, HK_FULLSCREEN))
|
||||||
DoFullscreen(!RendererIsFullscreen());
|
DoFullscreen(!RendererIsFullscreen());
|
||||||
|
@ -826,6 +827,15 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
|
||||||
// Stop
|
// Stop
|
||||||
else if (IsHotkey(event, HK_STOP))
|
else if (IsHotkey(event, HK_STOP))
|
||||||
DoStop();
|
DoStop();
|
||||||
|
// Wiimote connect and disconnect hotkeys
|
||||||
|
else if (IsHotkey(event, HK_WIIMOTE1_CONNECT))
|
||||||
|
WiimoteId = 0;
|
||||||
|
else if (IsHotkey(event, HK_WIIMOTE2_CONNECT))
|
||||||
|
WiimoteId = 1;
|
||||||
|
else if (IsHotkey(event, HK_WIIMOTE3_CONNECT))
|
||||||
|
WiimoteId = 2;
|
||||||
|
else if (IsHotkey(event, HK_WIIMOTE4_CONNECT))
|
||||||
|
WiimoteId = 3;
|
||||||
// state save and state load hotkeys
|
// state save and state load hotkeys
|
||||||
else if (event.GetKeyCode() >= WXK_F1 && event.GetKeyCode() <= WXK_F8)
|
else if (event.GetKeyCode() >= WXK_F1 && event.GetKeyCode() <= WXK_F8)
|
||||||
{
|
{
|
||||||
|
@ -834,7 +844,8 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
|
||||||
State_Load(slot_number);
|
State_Load(slot_number);
|
||||||
else if (event.GetModifiers() == wxMOD_SHIFT)
|
else if (event.GetModifiers() == wxMOD_SHIFT)
|
||||||
State_Save(slot_number);
|
State_Save(slot_number);
|
||||||
else event.Skip();
|
else
|
||||||
|
event.Skip();
|
||||||
}
|
}
|
||||||
else if (event.GetKeyCode() == WXK_F11 && event.GetModifiers() == wxMOD_NONE)
|
else if (event.GetKeyCode() == WXK_F11 && event.GetModifiers() == wxMOD_NONE)
|
||||||
State_LoadLastSaved();
|
State_LoadLastSaved();
|
||||||
|
@ -851,6 +862,17 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
|
||||||
Core::ScreenShot();
|
Core::ScreenShot();
|
||||||
else event.Skip();
|
else event.Skip();
|
||||||
|
|
||||||
|
// Actually perform the wiimote connection or disconnection
|
||||||
|
if (WiimoteId >= 0)
|
||||||
|
{
|
||||||
|
bNoWiimoteMsg = GetMenuBar()->IsChecked(IDM_CONNECT_WIIMOTE1 + WiimoteId);
|
||||||
|
GetMenuBar()->Check(IDM_CONNECT_WIIMOTE1 + WiimoteId, !bNoWiimoteMsg);
|
||||||
|
GetUsbPointer()->AccessWiiMote(WiimoteId | 0x100)->Activate(!bNoWiimoteMsg);
|
||||||
|
wxString msg(wxString::Format(wxT("Wiimote %i %s"), WiimoteId + 1,
|
||||||
|
bNoWiimoteMsg ? wxT("Disconnected") : wxT("Connected")));
|
||||||
|
Core::DisplayMessage(msg.ToAscii(), 3000);
|
||||||
|
}
|
||||||
|
|
||||||
// Send the OSD hotkeys to the video plugin
|
// Send the OSD hotkeys to the video plugin
|
||||||
if (event.GetKeyCode() >= '3' && event.GetKeyCode() <= '7' && event.GetModifiers() == wxMOD_NONE)
|
if (event.GetKeyCode() >= '3' && event.GetKeyCode() <= '7' && event.GetModifiers() == wxMOD_NONE)
|
||||||
{
|
{
|
||||||
|
|
|
@ -196,10 +196,10 @@ void CFrame::CreateMenu()
|
||||||
toolsMenu->Append(IDM_LOAD_WII_MENU, _T("Load Wii Menu"));
|
toolsMenu->Append(IDM_LOAD_WII_MENU, _T("Load Wii Menu"));
|
||||||
}
|
}
|
||||||
toolsMenu->AppendSeparator();
|
toolsMenu->AppendSeparator();
|
||||||
toolsMenu->AppendCheckItem(IDM_CONNECT_WIIMOTE1, _T("Connect Wiimote 1\tAlt+F5"));
|
toolsMenu->AppendCheckItem(IDM_CONNECT_WIIMOTE1, GetMenuLabel(HK_WIIMOTE1_CONNECT));
|
||||||
toolsMenu->AppendCheckItem(IDM_CONNECT_WIIMOTE2, _T("Connect Wiimote 2\tAlt+F6"));
|
toolsMenu->AppendCheckItem(IDM_CONNECT_WIIMOTE2, GetMenuLabel(HK_WIIMOTE2_CONNECT));
|
||||||
toolsMenu->AppendCheckItem(IDM_CONNECT_WIIMOTE3, _T("Connect Wiimote 3\tAlt+F7"));
|
toolsMenu->AppendCheckItem(IDM_CONNECT_WIIMOTE3, GetMenuLabel(HK_WIIMOTE3_CONNECT));
|
||||||
toolsMenu->AppendCheckItem(IDM_CONNECT_WIIMOTE4, _T("Connect Wiimote 4\tAlt+F8"));
|
toolsMenu->AppendCheckItem(IDM_CONNECT_WIIMOTE4, GetMenuLabel(HK_WIIMOTE4_CONNECT));
|
||||||
|
|
||||||
m_MenuBar->Append(toolsMenu, _T("&Tools"));
|
m_MenuBar->Append(toolsMenu, _T("&Tools"));
|
||||||
|
|
||||||
|
@ -279,13 +279,21 @@ wxString CFrame::GetMenuLabel(int Id)
|
||||||
Label = _T("&Fullscreen\t");
|
Label = _T("&Fullscreen\t");
|
||||||
break;
|
break;
|
||||||
case HK_PLAY_PAUSE:
|
case HK_PLAY_PAUSE:
|
||||||
if (Core::GetState() == Core::CORE_UNINITIALIZED)
|
if (Core::GetState() == Core::CORE_RUN)
|
||||||
Label = _T("&Play\t");
|
Label = _T("&Pause\t");
|
||||||
else
|
else
|
||||||
Label = _T("&Play\t");
|
Label = _T("&Play\t");
|
||||||
break;
|
break;
|
||||||
case HK_STOP:
|
case HK_STOP:
|
||||||
Label = _T("&Stop\t");
|
Label = _T("&Stop\t");
|
||||||
|
case HK_WIIMOTE1_CONNECT:
|
||||||
|
Label = _T("Connect Wiimote 1\t");
|
||||||
|
case HK_WIIMOTE2_CONNECT:
|
||||||
|
Label = _T("Connect Wiimote 2\t");
|
||||||
|
case HK_WIIMOTE3_CONNECT:
|
||||||
|
Label = _T("Connect Wiimote 3\t");
|
||||||
|
case HK_WIIMOTE4_CONNECT:
|
||||||
|
Label = _T("Connect Wiimote 4\t");
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString Modifier = InputCommon::WXKeymodToString
|
wxString Modifier = InputCommon::WXKeymodToString
|
||||||
|
@ -1183,6 +1191,10 @@ void CFrame::UpdateGUI()
|
||||||
GetMenuBar()->FindItem(IDM_TOGGLE_FULLSCREEN)->SetItemLabel(GetMenuLabel(HK_FULLSCREEN));
|
GetMenuBar()->FindItem(IDM_TOGGLE_FULLSCREEN)->SetItemLabel(GetMenuLabel(HK_FULLSCREEN));
|
||||||
GetMenuBar()->FindItem(IDM_PLAY)->SetItemLabel(GetMenuLabel(HK_PLAY_PAUSE));
|
GetMenuBar()->FindItem(IDM_PLAY)->SetItemLabel(GetMenuLabel(HK_PLAY_PAUSE));
|
||||||
GetMenuBar()->FindItem(IDM_STOP)->SetItemLabel(GetMenuLabel(HK_STOP));
|
GetMenuBar()->FindItem(IDM_STOP)->SetItemLabel(GetMenuLabel(HK_STOP));
|
||||||
|
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->SetItemLabel(GetMenuLabel(HK_WIIMOTE1_CONNECT));
|
||||||
|
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE2)->SetItemLabel(GetMenuLabel(HK_WIIMOTE2_CONNECT));
|
||||||
|
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE3)->SetItemLabel(GetMenuLabel(HK_WIIMOTE3_CONNECT));
|
||||||
|
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE4)->SetItemLabel(GetMenuLabel(HK_WIIMOTE4_CONNECT));
|
||||||
|
|
||||||
m_pSubMenuLoad->Enable(Initialized);
|
m_pSubMenuLoad->Enable(Initialized);
|
||||||
m_pSubMenuSave->Enable(Initialized);
|
m_pSubMenuSave->Enable(Initialized);
|
||||||
|
|
|
@ -21,9 +21,8 @@
|
||||||
BEGIN_EVENT_TABLE(HotkeyConfigDialog,wxDialog)
|
BEGIN_EVENT_TABLE(HotkeyConfigDialog,wxDialog)
|
||||||
EVT_CLOSE(HotkeyConfigDialog::OnClose)
|
EVT_CLOSE(HotkeyConfigDialog::OnClose)
|
||||||
EVT_BUTTON(ID_CLOSE, HotkeyConfigDialog::CloseClick)
|
EVT_BUTTON(ID_CLOSE, HotkeyConfigDialog::CloseClick)
|
||||||
EVT_BUTTON(ID_FULLSCREEN, HotkeyConfigDialog::OnButtonClick)
|
EVT_COMMAND_RANGE(HK_FULLSCREEN, NUM_HOTKEYS - 1,
|
||||||
EVT_BUTTON(ID_PLAY_PAUSE, HotkeyConfigDialog::OnButtonClick)
|
wxEVT_COMMAND_BUTTON_CLICKED, HotkeyConfigDialog::OnButtonClick)
|
||||||
EVT_BUTTON(ID_STOP, HotkeyConfigDialog::OnButtonClick)
|
|
||||||
EVT_TIMER(IDTM_BUTTON, HotkeyConfigDialog::OnButtonTimer)
|
EVT_TIMER(IDTM_BUTTON, HotkeyConfigDialog::OnButtonTimer)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
@ -191,6 +190,10 @@ void HotkeyConfigDialog::CreateHotkeyGUIControls(void)
|
||||||
wxT("Toggle Fullscreen"),
|
wxT("Toggle Fullscreen"),
|
||||||
wxT("Play/Pause"),
|
wxT("Play/Pause"),
|
||||||
wxT("Stop"),
|
wxT("Stop"),
|
||||||
|
wxT("Connect Wiimote 1"),
|
||||||
|
wxT("Connect Wiimote 2"),
|
||||||
|
wxT("Connect Wiimote 3"),
|
||||||
|
wxT("Connect Wiimote 4")
|
||||||
};
|
};
|
||||||
|
|
||||||
// Configuration controls sizes
|
// Configuration controls sizes
|
||||||
|
@ -215,7 +218,7 @@ void HotkeyConfigDialog::CreateHotkeyGUIControls(void)
|
||||||
wxStaticText *stHotkeys = new wxStaticText(this, wxID_ANY, hkText[i]);
|
wxStaticText *stHotkeys = new wxStaticText(this, wxID_ANY, hkText[i]);
|
||||||
|
|
||||||
// Key selection button
|
// Key selection button
|
||||||
m_Button_Hotkeys[i] = new wxButton(this, ID_FULLSCREEN + i, wxEmptyString,
|
m_Button_Hotkeys[i] = new wxButton(this, HK_FULLSCREEN + i, wxEmptyString,
|
||||||
wxDefaultPosition, size);
|
wxDefaultPosition, size);
|
||||||
m_Button_Hotkeys[i]->SetFont(m_SmallFont);
|
m_Button_Hotkeys[i]->SetFont(m_SmallFont);
|
||||||
SetButtonText(i,
|
SetButtonText(i,
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "CoreParameter.h"
|
||||||
#include "WXInputBase.h"
|
#include "WXInputBase.h"
|
||||||
|
|
||||||
#if defined(HAVE_X11) && HAVE_X11
|
#if defined(HAVE_X11) && HAVE_X11
|
||||||
|
@ -55,10 +56,6 @@ class HotkeyConfigDialog : public wxDialog
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
ID_FULLSCREEN,
|
|
||||||
ID_PLAY_PAUSE,
|
|
||||||
ID_STOP,
|
|
||||||
NUM_HOTKEYS,
|
|
||||||
ID_CLOSE = 1000,
|
ID_CLOSE = 1000,
|
||||||
IDTM_BUTTON, // Timer
|
IDTM_BUTTON, // Timer
|
||||||
ID_APPLY
|
ID_APPLY
|
||||||
|
|
|
@ -461,7 +461,6 @@ void OpenGL_Shutdown()
|
||||||
hDC = NULL; // Set DC To NULL
|
hDC = NULL; // Set DC To NULL
|
||||||
}
|
}
|
||||||
#elif defined(HAVE_X11) && HAVE_X11
|
#elif defined(HAVE_X11) && HAVE_X11
|
||||||
printf ("Unmapping window\n");
|
|
||||||
if (GLWin.ctx)
|
if (GLWin.ctx)
|
||||||
{
|
{
|
||||||
if (!glXMakeCurrent(GLWin.dpy, None, NULL))
|
if (!glXMakeCurrent(GLWin.dpy, None, NULL))
|
||||||
|
|
Loading…
Reference in New Issue