diff options
| author | skidau <skidau@gmail.com> | 2015-01-27 12:24:47 +1100 |
|---|---|---|
| committer | skidau <skidau@gmail.com> | 2015-01-27 12:24:47 +1100 |
| commit | 61c04de7ee24ab7dcb297a37090c6a622b7f3af6 (patch) | |
| tree | 4b055818a0c97c2570f248a29e5cacb0a84c658a /Source/Core/DolphinWX/FrameTools.cpp | |
| parent | 7df55d220f8cd699f47a3b51ebc808554f6fbd7a (diff) | |
Added the ability to map gamepad buttons to hotkeys.
Diffstat (limited to 'Source/Core/DolphinWX/FrameTools.cpp')
| -rw-r--r-- | Source/Core/DolphinWX/FrameTools.cpp | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index 08ddcb2e39..fd8f7ae8d4 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -46,6 +46,7 @@ #include "Core/Core.h" #include "Core/CoreParameter.h" #include "Core/Host.h" +#include "Core/HotkeyManager.h" #include "Core/Movie.h" #include "Core/State.h" #include "Core/HW/CPU.h" @@ -238,6 +239,7 @@ wxMenuBar* CFrame::CreateMenu() pOptionsMenu->Append(IDM_CONFIG_AUDIO, _("&Audio Settings")); pOptionsMenu->Append(IDM_CONFIG_CONTROLLERS, _("&Controller Settings")); pOptionsMenu->Append(IDM_CONFIG_HOTKEYS, _("&Hotkey Settings")); + pOptionsMenu->Append(IDM_CONFIG_MENU_COMMANDS, _("&Menu Accelerators")); if (g_pCodeWindow) { pOptionsMenu->AppendSeparator(); @@ -1350,11 +1352,48 @@ void CFrame::OnConfigControllers(wxCommandEvent& WXUNUSED (event)) config_dlg.Destroy(); } -void CFrame::OnConfigHotkey(wxCommandEvent& WXUNUSED (event)) +void CFrame::OnConfigMenuCommands(wxCommandEvent& WXUNUSED(event)) { HotkeyConfigDialog *m_HotkeyDialog = new HotkeyConfigDialog(this); m_HotkeyDialog->ShowModal(); m_HotkeyDialog->Destroy(); + + // Update the GUI in case menu accelerators were changed + UpdateGUI(); +} + + +void CFrame::OnConfigHotkey(wxCommandEvent& WXUNUSED (event)) +{ + bool was_init = false; + + InputConfig* const hotkey_plugin = HotkeyManagerEmu::GetConfig(); + + // check if game is running + if (g_controller_interface.IsInit()) + { + was_init = true; + } + else + { +#if defined(HAVE_X11) && HAVE_X11 + Window win = X11Utils::XWindowFromHandle(GetHandle()); + HotkeyManagerEmu::Initialize(reinterpret_cast<void*>(win)); +#else + HotkeyManagerEmu::Initialize(reinterpret_cast<void*>(GetHandle())); +#endif + } + + InputConfigDialog m_ConfigFrame(this, *hotkey_plugin, _("Dolphin Hotkeys"), 0); + m_ConfigFrame.ShowModal(); + m_ConfigFrame.Destroy(); + + // if game isn't running + if (!was_init) + { + HotkeyManagerEmu::Shutdown(); + } + // Update the GUI in case menu accelerators were changed UpdateGUI(); } |
