Added the ability to map gamepad buttons to hotkeys.

This commit is contained in:
skidau
2015-01-27 12:24:47 +11:00
parent 7df55d220f
commit 61c04de7ee
14 changed files with 1048 additions and 308 deletions

View File

@ -32,6 +32,7 @@
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/HotkeyManager.h"
#include "Core/Movie.h"
#include "Core/NetPlayProto.h"
#include "Core/HW/EXI.h"
@ -47,10 +48,13 @@
#include "DolphinWX/Frame.h"
#include "DolphinWX/Globals.h"
#include "DolphinWX/HotkeyDlg.h"
#include "DolphinWX/InputConfigDiag.h"
#include "DolphinWX/Main.h"
#include "DolphinWX/WxUtils.h"
#include "DolphinWX/Debugger/CodeWindow.h"
#include "InputCommon/InputConfig.h"
#include "VideoCommon/VideoBackendBase.h"
#define TEXT_BOX(page, text) new wxStaticText(page, wxID_ANY, text)
@ -919,8 +923,34 @@ void CConfigMain::DisplaySettingsChanged(wxCommandEvent& event)
break;
case ID_HOTKEY_CONFIG:
{
HotkeyConfigDialog m_HotkeyDialog(this);
m_HotkeyDialog.ShowModal();
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
main_frame->UpdateGUI();

View File

@ -46,6 +46,7 @@
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/CoreParameter.h"
#include "Core/HotkeyManager.h"
#include "Core/Movie.h"
#include "Core/State.h"
#include "Core/HW/DVDInterface.h"
@ -269,6 +270,7 @@ EVT_MENU(IDM_CONFIG_GFX_BACKEND, CFrame::OnConfigGFX)
EVT_MENU(IDM_CONFIG_AUDIO, CFrame::OnConfigAudio)
EVT_MENU(IDM_CONFIG_CONTROLLERS, CFrame::OnConfigControllers)
EVT_MENU(IDM_CONFIG_HOTKEYS, CFrame::OnConfigHotkey)
EVT_MENU(IDM_CONFIG_MENU_COMMANDS, CFrame::OnConfigMenuCommands)
EVT_MENU(IDM_SAVE_PERSPECTIVE, CFrame::OnPerspectiveMenu)
EVT_MENU(IDM_EDIT_PERSPECTIVES, CFrame::OnPerspectiveMenu)
@ -342,6 +344,22 @@ END_EVENT_TABLE()
// ---------------
// Creation and close, quit functions
bool CFrame::InitHotkeys()
{
if (!g_controller_interface.IsInit())
{
#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
return true;
}
return false;
}
CFrame::CFrame(wxFrame* parent,
wxWindowID id,
const wxString& title,
@ -477,10 +495,24 @@ CFrame::CFrame(wxFrame* parent,
UpdateGUI();
if (g_pCodeWindow)
g_pCodeWindow->UpdateButtonStates();
// check if game is running
m_bHotkeysInit = InitHotkeys();
m_poll_hotkey_timer = new wxTimer(this);
Bind(wxEVT_TIMER, &CFrame::PollHotkeys, this);
m_poll_hotkey_timer->Start(1000 / 60, wxTIMER_CONTINUOUS);
}
// Destructor
CFrame::~CFrame()
{
m_poll_hotkey_timer->Stop();
if (m_bHotkeysInit)
{
HotkeyManagerEmu::Shutdown();
}
drives.clear();
#if defined(HAVE_XRANDR) && HAVE_XRANDR
@ -904,11 +936,15 @@ void CFrame::OnGameListCtrl_ItemActivated(wxListEvent& WXUNUSED (event))
}
}
static bool IsHotkey(wxKeyEvent &event, int Id)
static bool IsHotkey(wxKeyEvent &event, int Id, bool keyUp = false)
{
return (event.GetKeyCode() != WXK_NONE &&
event.GetKeyCode() == SConfig::GetInstance().m_LocalCoreStartupParameter.iHotkey[Id] &&
event.GetModifiers() == SConfig::GetInstance().m_LocalCoreStartupParameter.iHotkeyModifier[Id]);
// Input event hotkey
if (event.GetKeyCode() == WXK_NONE)
{
return HotkeyManagerEmu::IsPressed(Id, keyUp);
}
return false;
}
int GetCmdForHotkey(unsigned int key)
@ -1045,202 +1081,12 @@ bool TASInputHasFocus()
return false;
}
void CFrame::OnKeyDown(wxKeyEvent& event)
{
if (Core::GetState() != Core::CORE_UNINITIALIZED &&
(RendererHasFocus() || TASInputHasFocus()))
{
int WiimoteId = -1;
// Toggle fullscreen
if (IsHotkey(event, HK_FULLSCREEN))
DoFullscreen(!RendererIsFullscreen());
// Send Debugger keys to CodeWindow
else if (g_pCodeWindow && (event.GetKeyCode() >= WXK_F9 && event.GetKeyCode() <= WXK_F11))
event.Skip();
// Pause and Unpause
else if (IsHotkey(event, HK_PLAY_PAUSE))
DoPause();
// Stop
else if (IsHotkey(event, HK_STOP))
DoStop();
// Screenshot hotkey
else if (IsHotkey(event, HK_SCREENSHOT))
Core::SaveScreenShot();
else if (IsHotkey(event, HK_EXIT))
wxPostEvent(this, wxCommandEvent(wxID_EXIT));
else if (IsHotkey(event, HK_VOLUME_DOWN))
AudioCommon::DecreaseVolume(3);
else if (IsHotkey(event, HK_VOLUME_UP))
AudioCommon::IncreaseVolume(3);
else if (IsHotkey(event, HK_VOLUME_TOGGLE_MUTE))
AudioCommon::ToggleMuteVolume();
// 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;
else if (IsHotkey(event, HK_BALANCEBOARD_CONNECT))
WiimoteId = 4;
else if (IsHotkey(event, HK_TOGGLE_IR))
{
OSDChoice = 1;
// Toggle native resolution
if (++g_Config.iEFBScale > SCALE_4X)
g_Config.iEFBScale = SCALE_AUTO;
}
else if (IsHotkey(event, HK_TOGGLE_AR))
{
OSDChoice = 2;
// Toggle aspect ratio
g_Config.iAspectRatio = (g_Config.iAspectRatio + 1) & 3;
}
else if (IsHotkey(event, HK_TOGGLE_EFBCOPIES))
{
OSDChoice = 3;
// Toggle EFB copies between EFB2RAM and EFB2Texture
if (!g_Config.bEFBCopyEnable)
{
OSD::AddMessage("EFB Copies are disabled, enable them in Graphics settings for toggling", 6000);
}
else
{
g_Config.bCopyEFBToTexture = !g_Config.bCopyEFBToTexture;
}
}
else if (IsHotkey(event, HK_TOGGLE_FOG))
{
OSDChoice = 4;
g_Config.bDisableFog = !g_Config.bDisableFog;
}
else if (IsHotkey(event, HK_TOGGLE_THROTTLE))
{
Core::SetIsFramelimiterTempDisabled(true);
}
else if (IsHotkey(event, HK_DECREASE_FRAME_LIMIT))
{
if (--SConfig::GetInstance().m_Framelimit > 0x19)
SConfig::GetInstance().m_Framelimit = 0x19;
}
else if (IsHotkey(event, HK_INCREASE_FRAME_LIMIT))
{
if (++SConfig::GetInstance().m_Framelimit > 0x19)
SConfig::GetInstance().m_Framelimit = 0;
}
else if (IsHotkey(event, HK_SAVE_STATE_SLOT_SELECTED))
{
State::Save(g_saveSlot);
}
else if (IsHotkey(event, HK_LOAD_STATE_SLOT_SELECTED))
{
State::Load(g_saveSlot);
}
else if (IsHotkey(event, HK_DECREASE_DEPTH))
{
if (--g_Config.iStereoDepth < 0)
g_Config.iStereoDepth = 0;
}
else if (IsHotkey(event, HK_INCREASE_DEPTH))
{
if (++g_Config.iStereoDepth > 100)
g_Config.iStereoDepth = 100;
}
else if (IsHotkey(event, HK_DECREASE_CONVERGENCE))
{
if (--g_Config.iStereoConvergence < 0)
g_Config.iStereoConvergence = 0;
}
else if (IsHotkey(event, HK_INCREASE_CONVERGENCE))
{
if (++g_Config.iStereoConvergence > 500)
g_Config.iStereoConvergence = 500;
}
else
{
for (int i = HK_SELECT_STATE_SLOT_1; i < HK_SELECT_STATE_SLOT_10; ++i)
{
if (IsHotkey (event, i))
{
wxCommandEvent slot_event;
slot_event.SetId(i + IDM_SELECT_SLOT_1 - HK_SELECT_STATE_SLOT_1);
CFrame::OnSelectSlot(slot_event);
}
}
unsigned int i = NUM_HOTKEYS;
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain || TASInputHasFocus())
{
for (i = 0; i < NUM_HOTKEYS; i++)
{
if (IsHotkey(event, i))
{
int cmd = GetCmdForHotkey(i);
if (cmd >= 0)
{
wxCommandEvent evt(wxEVT_MENU, cmd);
wxMenuItem *item = GetMenuBar()->FindItem(cmd);
if (item && item->IsCheckable())
{
item->wxMenuItemBase::Toggle();
evt.SetInt(item->IsChecked());
}
GetEventHandler()->AddPendingEvent(evt);
break;
}
}
}
}
// On OS X, we claim all keyboard events while
// emulation is running to avoid wxWidgets sounding
// the system beep for unhandled key events when
// receiving pad/Wiimote keypresses which take an
// entirely different path through the HID subsystem.
#ifndef __APPLE__
// On other platforms, we leave the key event alone
// so it can be passed on to the windowing system.
if (i == NUM_HOTKEYS)
event.Skip();
#endif
}
// Actually perform the Wiimote connection or disconnection
if (WiimoteId >= 0)
{
wxCommandEvent evt;
evt.SetId(IDM_CONNECT_WIIMOTE1 + WiimoteId);
OnConnectWiimote(evt);
}
if (g_Config.bFreeLook)
{
static float debugSpeed = 1.0f;
if (IsHotkey(event, HK_FREELOOK_DECREASE_SPEED))
debugSpeed /= 2.0f;
else if (IsHotkey(event, HK_FREELOOK_INCREASE_SPEED))
debugSpeed *= 2.0f;
else if (IsHotkey(event, HK_FREELOOK_RESET_SPEED))
debugSpeed = 1.0f;
else if (IsHotkey(event, HK_FREELOOK_UP))
VertexShaderManager::TranslateView(0.0f, 0.0f, -debugSpeed);
else if (IsHotkey(event, HK_FREELOOK_DOWN))
VertexShaderManager::TranslateView(0.0f, 0.0f, debugSpeed);
else if (IsHotkey(event, HK_FREELOOK_LEFT))
VertexShaderManager::TranslateView(debugSpeed, 0.0f);
else if (IsHotkey(event, HK_FREELOOK_RIGHT))
VertexShaderManager::TranslateView(-debugSpeed, 0.0f);
else if (IsHotkey(event, HK_FREELOOK_ZOOM_IN))
VertexShaderManager::TranslateView(0.0f, debugSpeed);
else if (IsHotkey(event, HK_FREELOOK_ZOOM_OUT))
VertexShaderManager::TranslateView(0.0f, -debugSpeed);
else if (IsHotkey(event, HK_FREELOOK_RESET))
VertexShaderManager::ResetView();
}
ParseHotkeys(event);
}
else
{
@ -1410,3 +1256,223 @@ const CGameListCtrl *CFrame::GetGameListCtrl() const
{
return m_GameListCtrl;
}
void CFrame::PollHotkeys(wxTimerEvent& event)
{
if (Core::GetState() == Core::CORE_UNINITIALIZED || Core::GetState() == Core::CORE_PAUSE)
{
InitHotkeys();
g_controller_interface.UpdateInput();
}
if (Core::GetState() != Core::CORE_STOPPING)
{
wxKeyEvent keyevent = 0;
if (IsHotkey(keyevent, HK_TOGGLE_THROTTLE))
{
Core::SetIsFramelimiterTempDisabled(false);
}
else
{
ParseHotkeys(keyevent);
}
}
}
void CFrame::ParseHotkeys(wxKeyEvent &event)
{
int WiimoteId = -1;
// Toggle fullscreen
if (IsHotkey(event, HK_FULLSCREEN))
DoFullscreen(!RendererIsFullscreen());
// Send Debugger keys to CodeWindow
else if (g_pCodeWindow && (event.GetKeyCode() >= WXK_F9 && event.GetKeyCode() <= WXK_F11))
event.Skip();
// Pause and Unpause
else if (IsHotkey(event, HK_PLAY_PAUSE))
DoPause();
// Stop
else if (IsHotkey(event, HK_STOP))
DoStop();
// Screenshot hotkey
else if (IsHotkey(event, HK_SCREENSHOT))
Core::SaveScreenShot();
else if (IsHotkey(event, HK_EXIT))
wxPostEvent(this, wxCommandEvent(wxID_EXIT));
else if (IsHotkey(event, HK_VOLUME_DOWN))
AudioCommon::DecreaseVolume(3);
else if (IsHotkey(event, HK_VOLUME_UP))
AudioCommon::IncreaseVolume(3);
else if (IsHotkey(event, HK_VOLUME_TOGGLE_MUTE))
AudioCommon::ToggleMuteVolume();
// 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;
else if (IsHotkey(event, HK_BALANCEBOARD_CONNECT))
WiimoteId = 4;
else if (IsHotkey(event, HK_TOGGLE_IR))
{
OSDChoice = 1;
// Toggle native resolution
if (++g_Config.iEFBScale > SCALE_4X)
g_Config.iEFBScale = SCALE_AUTO;
}
else if (IsHotkey(event, HK_TOGGLE_AR))
{
OSDChoice = 2;
// Toggle aspect ratio
g_Config.iAspectRatio = (g_Config.iAspectRatio + 1) & 3;
}
else if (IsHotkey(event, HK_TOGGLE_EFBCOPIES))
{
OSDChoice = 3;
// Toggle EFB copies between EFB2RAM and EFB2Texture
if (!g_Config.bEFBCopyEnable)
{
OSD::AddMessage("EFB Copies are disabled, enable them in Graphics settings for toggling", 6000);
}
else
{
g_Config.bCopyEFBToTexture = !g_Config.bCopyEFBToTexture;
}
}
else if (IsHotkey(event, HK_TOGGLE_FOG))
{
OSDChoice = 4;
g_Config.bDisableFog = !g_Config.bDisableFog;
}
else if (IsHotkey(event, HK_TOGGLE_THROTTLE, true))
{
Core::SetIsFramelimiterTempDisabled(true);
}
else if (IsHotkey(event, HK_DECREASE_FRAME_LIMIT))
{
if (--SConfig::GetInstance().m_Framelimit > 0x19)
SConfig::GetInstance().m_Framelimit = 0x19;
}
else if (IsHotkey(event, HK_INCREASE_FRAME_LIMIT))
{
if (++SConfig::GetInstance().m_Framelimit > 0x19)
SConfig::GetInstance().m_Framelimit = 0;
}
else if (IsHotkey(event, HK_SAVE_STATE_SLOT_SELECTED))
{
State::Save(g_saveSlot);
}
else if (IsHotkey(event, HK_LOAD_STATE_SLOT_SELECTED))
{
State::Load(g_saveSlot);
}
else if (IsHotkey(event, HK_DECREASE_DEPTH))
{
if (--g_Config.iStereoDepth < 0)
g_Config.iStereoDepth = 0;
}
else if (IsHotkey(event, HK_INCREASE_DEPTH))
{
if (++g_Config.iStereoDepth > 100)
g_Config.iStereoDepth = 100;
}
else if (IsHotkey(event, HK_DECREASE_CONVERGENCE))
{
if (--g_Config.iStereoConvergence < 0)
g_Config.iStereoConvergence = 0;
}
else if (IsHotkey(event, HK_INCREASE_CONVERGENCE))
{
if (++g_Config.iStereoConvergence > 500)
g_Config.iStereoConvergence = 500;
}
else
{
for (int i = HK_SELECT_STATE_SLOT_1; i < HK_SELECT_STATE_SLOT_10; ++i)
{
if (IsHotkey(event, i))
{
wxCommandEvent slot_event;
slot_event.SetId(i + IDM_SELECT_SLOT_1 - HK_SELECT_STATE_SLOT_1);
CFrame::OnSelectSlot(slot_event);
}
}
unsigned int i = NUM_HOTKEYS;
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain || TASInputHasFocus())
{
for (i = 0; i < NUM_HOTKEYS; i++)
{
if (IsHotkey(event, i))
{
int cmd = GetCmdForHotkey(i);
if (cmd >= 0)
{
wxCommandEvent evt(wxEVT_MENU, cmd);
wxMenuItem *item = GetMenuBar()->FindItem(cmd);
if (item && item->IsCheckable())
{
item->wxMenuItemBase::Toggle();
evt.SetInt(item->IsChecked());
}
GetEventHandler()->AddPendingEvent(evt);
break;
}
}
}
}
// On OS X, we claim all keyboard events while
// emulation is running to avoid wxWidgets sounding
// the system beep for unhandled key events when
// receiving pad/Wiimote keypresses which take an
// entirely different path through the HID subsystem.
#ifndef __APPLE__
// On other platforms, we leave the key event alone
// so it can be passed on to the windowing system.
if (i == NUM_HOTKEYS)
event.Skip();
#endif
}
// Actually perform the Wiimote connection or disconnection
if (Core::GetState() != Core::CORE_UNINITIALIZED)
{
if (WiimoteId >= 0)
{
wxCommandEvent evt;
evt.SetId(IDM_CONNECT_WIIMOTE1 + WiimoteId);
OnConnectWiimote(evt);
}
if (g_Config.bFreeLook)
{
static float debugSpeed = 1.0f;
if (IsHotkey(event, HK_FREELOOK_DECREASE_SPEED))
debugSpeed /= 2.0f;
else if (IsHotkey(event, HK_FREELOOK_INCREASE_SPEED))
debugSpeed *= 2.0f;
else if (IsHotkey(event, HK_FREELOOK_RESET_SPEED))
debugSpeed = 1.0f;
else if (IsHotkey(event, HK_FREELOOK_UP))
VertexShaderManager::TranslateView(0.0f, 0.0f, -debugSpeed);
else if (IsHotkey(event, HK_FREELOOK_DOWN))
VertexShaderManager::TranslateView(0.0f, 0.0f, debugSpeed);
else if (IsHotkey(event, HK_FREELOOK_LEFT))
VertexShaderManager::TranslateView(debugSpeed, 0.0f);
else if (IsHotkey(event, HK_FREELOOK_RIGHT))
VertexShaderManager::TranslateView(-debugSpeed, 0.0f);
else if (IsHotkey(event, HK_FREELOOK_ZOOM_IN))
VertexShaderManager::TranslateView(0.0f, debugSpeed);
else if (IsHotkey(event, HK_FREELOOK_ZOOM_OUT))
VertexShaderManager::TranslateView(0.0f, -debugSpeed);
else if (IsHotkey(event, HK_FREELOOK_RESET))
VertexShaderManager::ResetView();
}
}
}

View File

@ -47,6 +47,8 @@ class wxAuiNotebook;
class wxAuiNotebookEvent;
class wxListEvent;
class wxMenuItem;
class wxTimer;
class wxTimerEvent;
class wxWindow;
class CRenderFrame : public wxFrame
@ -175,6 +177,7 @@ private:
bool m_bGameLoading;
bool m_bClosing;
bool m_confirmStop;
bool m_bHotkeysInit;
std::vector<std::string> drives;
@ -195,6 +198,8 @@ private:
EToolbar_Max
};
wxTimer* m_poll_hotkey_timer;
wxBitmap m_Bitmaps[EToolbar_Max];
wxBitmap m_BitmapsMenu[EToolbar_Max];
@ -295,6 +300,7 @@ private:
void OnConfigAudio(wxCommandEvent& event);
void OnConfigControllers(wxCommandEvent& event);
void OnConfigHotkey(wxCommandEvent& event);
void OnConfigMenuCommands(wxCommandEvent& event);
void OnToggleFullscreen(wxCommandEvent& event);
void OnToggleDualCore(wxCommandEvent& event);
@ -337,6 +343,11 @@ private:
void OnSaveCurrentSlot(wxCommandEvent& event);
void OnLoadCurrentSlot(wxCommandEvent& event);
void PollHotkeys(wxTimerEvent&);
void ParseHotkeys(wxKeyEvent &event);
bool InitHotkeys();
// Event table
DECLARE_EVENT_TABLE();
};

View File

@ -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();
}

View File

@ -149,6 +149,7 @@ enum
IDM_CONFIG_AUDIO,
IDM_CONFIG_CONTROLLERS,
IDM_CONFIG_HOTKEYS,
IDM_CONFIG_MENU_COMMANDS,
IDM_CONFIG_LOGGER,
// Views

View File

@ -185,6 +185,112 @@ void HotkeyConfigDialog::OnButtonClick(wxCommandEvent& event)
#define HOTKEY_NUM_COLUMNS 2
const wxString hkText[] =
{
_("Open"),
_("Change Disc"),
_("Refresh List"),
_("Play/Pause"),
_("Stop"),
_("Reset"),
_("Frame Advance"),
_("Start Recording"),
_("Play Recording"),
_("Export Recording"),
_("Read-only mode"),
_("Toggle Fullscreen"),
_("Take Screenshot"),
_("Exit"),
_("Connect Wiimote 1"),
_("Connect Wiimote 2"),
_("Connect Wiimote 3"),
_("Connect Wiimote 4"),
_("Connect Balance Board"),
_("Volume Down"),
_("Volume Up"),
_("Volume Toggle Mute"),
_("Toggle IR"),
_("Toggle Aspect Ratio"),
_("Toggle EFB Copies"),
_("Toggle Fog"),
_("Toggle Frame limit"),
_("Decrease Frame limit"),
_("Increase Frame limit"),
_("Freelook Decrease Speed"),
_("Freelook Increase Speed"),
_("Freelook Reset Speed"),
_("Freelook Move Up"),
_("Freelook Move Down"),
_("Freelook Move Left"),
_("Freelook Move Right"),
_("Freelook Zoom In"),
_("Freelook Zoom Out"),
_("Freelook Reset"),
_("Decrease Depth"),
_("Increase Depth"),
_("Decrease Convergence"),
_("Increase Convergence"),
_("Load State Slot 1"),
_("Load State Slot 2"),
_("Load State Slot 3"),
_("Load State Slot 4"),
_("Load State Slot 5"),
_("Load State Slot 6"),
_("Load State Slot 7"),
_("Load State Slot 8"),
_("Load State Slot 9"),
_("Load State Slot 10"),
_("Save State Slot 1"),
_("Save State Slot 2"),
_("Save State Slot 3"),
_("Save State Slot 4"),
_("Save State Slot 5"),
_("Save State Slot 6"),
_("Save State Slot 7"),
_("Save State Slot 8"),
_("Save State Slot 9"),
_("Save State Slot 10"),
_("Select State Slot 1"),
_("Select State Slot 2"),
_("Select State Slot 3"),
_("Select State Slot 4"),
_("Select State Slot 5"),
_("Select State Slot 6"),
_("Select State Slot 7"),
_("Select State Slot 8"),
_("Select State Slot 9"),
_("Select State Slot 10"),
_("Save to selected slot"),
_("Load from selected slot"),
_("Load State Last 1"),
_("Load State Last 2"),
_("Load State Last 3"),
_("Load State Last 4"),
_("Load State Last 5"),
_("Load State Last 6"),
_("Load State Last 7"),
_("Load State Last 8"),
_("Save Oldest State"),
_("Undo Load State"),
_("Undo Save State"),
_("Save State"),
_("Load State"),
};
void HotkeyConfigDialog::CreateHotkeyGUIControls()
{
const wxString pageNames[] =
@ -193,112 +299,6 @@ void HotkeyConfigDialog::CreateHotkeyGUIControls()
_("State Saves")
};
const wxString hkText[] =
{
_("Open"),
_("Change Disc"),
_("Refresh List"),
_("Play/Pause"),
_("Stop"),
_("Reset"),
_("Frame Advance"),
_("Start Recording"),
_("Play Recording"),
_("Export Recording"),
_("Read-only mode"),
_("Toggle Fullscreen"),
_("Take Screenshot"),
_("Exit"),
_("Connect Wiimote 1"),
_("Connect Wiimote 2"),
_("Connect Wiimote 3"),
_("Connect Wiimote 4"),
_("Connect Balance Board"),
_("Volume Down"),
_("Volume Up"),
_("Volume Toggle Mute"),
_("Toggle IR"),
_("Toggle Aspect Ratio"),
_("Toggle EFB Copies"),
_("Toggle Fog"),
_("Toggle Frame limit"),
_("Decrease Frame limit"),
_("Increase Frame limit"),
_("Freelook Decrease Speed"),
_("Freelook Increase Speed"),
_("Freelook Reset Speed"),
_("Freelook Move Up"),
_("Freelook Move Down"),
_("Freelook Move Left"),
_("Freelook Move Right"),
_("Freelook Zoom In"),
_("Freelook Zoom Out"),
_("Freelook Reset"),
_("Decrease Depth"),
_("Increase Depth"),
_("Decrease Convergence"),
_("Increase Convergence"),
_("Load State Slot 1"),
_("Load State Slot 2"),
_("Load State Slot 3"),
_("Load State Slot 4"),
_("Load State Slot 5"),
_("Load State Slot 6"),
_("Load State Slot 7"),
_("Load State Slot 8"),
_("Load State Slot 9"),
_("Load State Slot 10"),
_("Save State Slot 1"),
_("Save State Slot 2"),
_("Save State Slot 3"),
_("Save State Slot 4"),
_("Save State Slot 5"),
_("Save State Slot 6"),
_("Save State Slot 7"),
_("Save State Slot 8"),
_("Save State Slot 9"),
_("Save State Slot 10"),
_("Select State Slot 1"),
_("Select State Slot 2"),
_("Select State Slot 3"),
_("Select State Slot 4"),
_("Select State Slot 5"),
_("Select State Slot 6"),
_("Select State Slot 7"),
_("Select State Slot 8"),
_("Select State Slot 9"),
_("Select State Slot 10"),
_("Save to selected slot"),
_("Load from selected slot"),
_("Load State Last 1"),
_("Load State Last 2"),
_("Load State Last 3"),
_("Load State Last 4"),
_("Load State Last 5"),
_("Load State Last 6"),
_("Load State Last 7"),
_("Load State Last 8"),
_("Save Oldest State"),
_("Undo Load State"),
_("Undo Save State"),
_("Save State"),
_("Load State"),
};
const int page_breaks[3] = {HK_OPEN, HK_LOAD_STATE_SLOT_1, NUM_HOTKEYS};
// Configuration controls sizes

View File

@ -29,7 +29,7 @@ class HotkeyConfigDialog : public wxDialog
public:
HotkeyConfigDialog(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxString &title = _("Hotkey Configuration"),
const wxString &title = _("Menu Accelerators"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE);

View File

@ -839,7 +839,7 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
// Draw buttons in rows of 8
unsigned int button_cols = group->controls.size() > 8 ? 8 : group->controls.size();
unsigned int button_rows = ceil((float)group->controls.size() / 8.0f);
wxBitmap bitmap(int(12 * button_cols + 1), (12 * button_rows) - (button_rows - 1));
wxBitmap bitmap(int(12 * button_cols + 1), (11 * button_rows) + 1);
dc.SelectObject(bitmap);
dc.Clear();
@ -1074,6 +1074,7 @@ InputConfigDialog::InputConfigDialog(wxWindow* const parent, InputConfig& config
szr->Add(m_pad_notebook, 0, wxEXPAND|wxTOP|wxLEFT|wxRIGHT, 5);
szr->Add(CreateButtonSizer(wxOK | wxCANCEL | wxNO_DEFAULT), 0, wxEXPAND|wxALL, 5);
SetLayoutAdaptationMode(wxDIALOG_ADAPTATION_MODE_ENABLED);
SetSizerAndFit(szr);
Center();

View File

@ -119,12 +119,12 @@ void DrawButton(unsigned int* const bitmasks, unsigned int buttons, unsigned int
unsigned char amt = 255 - g->control_group->controls[(row * 8) + n]->control_ref->State() * 128;
dc.SetBrush(wxBrush(wxColour(amt, amt, amt)));
}
dc.DrawRectangle(n * 12, (row == 0) ? 0 : (row * 12 - 1), 14, 12);
dc.DrawRectangle(n * 12, (row == 0) ? 0 : (row * 11), 14, 12);
// text
const std::string name = g->control_group->controls[(row * 8) + n]->name;
// bit of hax so ZL, ZR show up as L, R
dc.DrawText(StrToWxStr(std::string(1, (name[1] && name[1] < 'a') ? name[1] : name[0])), n * 12 + 2, 1 + ((row == 0) ? 0 : (row * 12 - 1)));
dc.DrawText(StrToWxStr(std::string(1, (name[1] && name[1] < 'a') ? name[1] : name[0])), n * 12 + 2, 1 + ((row == 0) ? 0 : (row * 11)));
}
static void DrawControlGroupBox(wxDC &dc, ControlGroupBox *g)