Merge pull request #2011 from skidau/hotkey-render-to-main

Fixed the hotkeys so that they work with Render to Main

To set up a mix of keyboard and gamepad hotkeys, follow these steps:

1. In the Hotkey Settings, change the Device to Keyboard
2. Right click the hotkey button that you wish to map to your gamepad
3. In the window that pops up, change the Device to your gamepad
4. Press the Clear button
5. Press Detect and press the button on your gamepad that you want to map
6. Press Select
7. Press OK

To map a combo hotkey, e.g. Shift F5, follow these steps
1. Follow steps 1-4 above
2. Press Detect and the modifier button (e.g. Shift)
3. Press Select
4. Press Detect and the button which isn't the modifier (e.g. F5)
5. Press the "& AND" button
6. Press OK


This patch fixes these issues:
Issue 8307
Issue 8238
Issue 8217
Issue 8216
Issue 8214
Issue 8201
Issue 7652
This commit is contained in:
skidau 2015-03-08 20:34:04 +11:00
commit 61591db916
17 changed files with 189 additions and 490 deletions

View file

@ -427,11 +427,20 @@ void EmuThread()
Keyboard::Initialize(s_window_handle);
init_controllers = true;
}
else
{
// Update references in case controllers were refreshed
Pad::LoadConfig();
Keyboard::LoadConfig();
}
// Load and Init Wiimotes - only if we are booting in Wii mode
if (core_parameter.bWii)
{
Wiimote::Initialize(s_window_handle, !s_state_filename.empty());
if (init_controllers)
Wiimote::Initialize(s_window_handle, !s_state_filename.empty());
else
Wiimote::LoadConfig();
// Activate Wiimotes which don't have source set to "None"
for (unsigned int i = 0; i != MAX_BBMOTES; ++i)

View file

@ -45,6 +45,11 @@ void Initialize(void* const hwnd)
s_config.LoadConfig(true);
}
void LoadConfig()
{
s_config.LoadConfig(true);
}
void GetStatus(u8 _port, KeyboardStatus* _pKeyboardStatus)
{
memset(_pKeyboardStatus, 0, sizeof(*_pKeyboardStatus));
@ -52,19 +57,6 @@ void GetStatus(u8 _port, KeyboardStatus* _pKeyboardStatus)
std::unique_lock<std::recursive_mutex> lk(s_config.controls_lock, std::try_to_lock);
if (!lk.owns_lock())
{
// if gui has lock (messing with controls), skip this input cycle
// center axes and return
_pKeyboardStatus->key0x = 0;
_pKeyboardStatus->key1x = 0;
_pKeyboardStatus->key2x = 0;
_pKeyboardStatus->key3x = 0;
_pKeyboardStatus->key4x = 0;
_pKeyboardStatus->key5x = 0;
return;
}
// get input
((GCKeyboard*)s_config.controllers[_port])->GetInput(_pKeyboardStatus);
}

View file

@ -13,6 +13,7 @@ namespace Keyboard
void Shutdown();
void Initialize(void* const hwnd);
void LoadConfig();
InputConfig* GetConfig();

View file

@ -46,6 +46,12 @@ void Initialize(void* const hwnd)
s_config.LoadConfig(true);
}
void LoadConfig()
{
s_config.LoadConfig(true);
}
void GetStatus(u8 _numPAD, GCPadStatus* _pPADStatus)
{
memset(_pPADStatus, 0, sizeof(*_pPADStatus));
@ -53,16 +59,6 @@ void GetStatus(u8 _numPAD, GCPadStatus* _pPADStatus)
std::unique_lock<std::recursive_mutex> lk(s_config.controls_lock, std::try_to_lock);
if (!lk.owns_lock())
{
// if gui has lock (messing with controls), skip this input cycle
// center axes and return
_pPADStatus->stickX = GCPadStatus::MAIN_STICK_CENTER_X;
_pPADStatus->stickY = GCPadStatus::MAIN_STICK_CENTER_Y;
_pPADStatus->substickX = GCPadStatus::C_STICK_CENTER_X;
_pPADStatus->substickY = GCPadStatus::C_STICK_CENTER_Y;
return;
}
// get input
((GCPad*)s_config.controllers[_numPAD])->GetInput(_pPADStatus);
@ -72,9 +68,6 @@ void Rumble(u8 _numPAD, const ControlState strength)
{
std::unique_lock<std::recursive_mutex> lk(s_config.controls_lock, std::try_to_lock);
if (!lk.owns_lock())
return;
((GCPad*)s_config.controllers[ _numPAD ])->SetOutput(strength);
}
@ -83,8 +76,6 @@ bool GetMicButton(u8 pad)
std::unique_lock<std::recursive_mutex> lk(s_config.controls_lock, std::try_to_lock);
if (!lk.owns_lock())
return false;
return ((GCPad*)s_config.controllers[pad])->GetMicButton();
}

View file

@ -13,6 +13,7 @@ namespace Pad
void Shutdown();
void Initialize(void* const hwnd);
void LoadConfig();
InputConfig* GetConfig();

View file

@ -55,6 +55,12 @@ void Initialize(void* const hwnd, bool wait)
Movie::ChangeWiiPads();
}
void LoadConfig()
{
s_config.LoadConfig(true);
}
void Resume()
{
WiimoteReal::Resume();
@ -113,7 +119,7 @@ void Update(int _number)
//PanicAlert( "Wiimote_Update" );
// TODO: change this to a try_to_lock, and make it give empty input on failure
std::lock_guard<std::recursive_mutex> lk(s_config.controls_lock);
std::unique_lock<std::recursive_mutex> lk(s_config.controls_lock, std::try_to_lock);
if (WIIMOTE_SRC_EMU & g_wiimote_sources[_number])
((WiimoteEmu::Wiimote*)s_config.controllers[_number])->Update();

View file

@ -36,6 +36,7 @@ namespace Wiimote
void Shutdown();
void Initialize(void* const hwnd, bool wait = false);
void LoadConfig();
void Resume();
void Pause();

View file

@ -6,47 +6,11 @@
#include "Core/CoreParameter.h"
#include "Core/HotkeyManager.h"
static const u32 hotkey_bitmasks[] =
{
1 << 0,
1 << 1,
1 << 2,
1 << 3,
1 << 4,
1 << 5,
1 << 6,
1 << 7,
1 << 8,
1 << 9,
1 << 10,
1 << 11,
1 << 12,
1 << 13,
1 << 14,
1 << 15,
1 << 16,
1 << 17,
1 << 18,
1 << 19,
1 << 20,
1 << 21,
1 << 22,
1 << 23,
1 << 24,
1 << 25,
1 << 26,
1 << 27,
1 << 28,
1 << 29,
1 << 30,
1u << 31u
};
const std::string hotkey_labels[] =
{
_trans("Open"),
_trans("Change Disc"),
_trans("Refresh List"),
(""), // Open
(""), // Change Disc
(""), // Refresh List
_trans("Toggle Pause"),
_trans("Stop"),
@ -60,7 +24,7 @@ const std::string hotkey_labels[] =
_trans("Toggle Fullscreen"),
_trans("Take Screenshot"),
_trans("Exit"),
(""), // Exit
_trans("Connect Wiimote 1"),
_trans("Connect Wiimote 2"),
@ -153,39 +117,36 @@ const int num_hotkeys = (sizeof(hotkey_labels) / sizeof(hotkey_labels[0]));
namespace HotkeyManagerEmu
{
static u32 hotkeyDown[6];
static u32 hotkeyDown[3];
static HotkeyStatus hotkey;
static InputConfig s_config("Hotkeys", _trans("Hotkeys"), "Hotkeys");
InputConfig* GetConfig()
{
return &s_config;
}
void GetStatus(u8 _port, HotkeyStatus* _pHotkeyStatus)
void GetStatus()
{
memset(_pHotkeyStatus, 0, sizeof(*_pHotkeyStatus));
_pHotkeyStatus->err = PAD_ERR_NONE;
std::unique_lock<std::recursive_mutex> lk(s_config.controls_lock, std::try_to_lock);
if (!lk.owns_lock())
{
// if gui has lock (messing with controls), skip this input cycle
for (int i = 0; i < 6; i++)
_pHotkeyStatus->button[i] = 0;
return;
}
hotkey.err = PAD_ERR_NONE;
// get input
((HotkeyManager*)s_config.controllers[_port])->GetInput(_pHotkeyStatus);
((HotkeyManager*)s_config.controllers[0])->GetInput(&hotkey);
}
bool IsEnabled()
{
return enabled;
}
void Enable(bool enable_toggle)
{
enabled = enable_toggle;
}
bool IsPressed(int Id, bool held)
{
HotkeyStatus hotkey;
memset(&hotkey, 0, sizeof(hotkey));
GetStatus(0, &hotkey);
unsigned int set = Id / 32;
unsigned int setKey = Id % 32;
if (hotkey.button[set] & (1 << setKey))
@ -215,8 +176,15 @@ void Initialize(void* const hwnd)
// load the saved controller config
s_config.LoadConfig(true);
for (unsigned int i = 0; i < 6; ++i)
for (unsigned int i = 0; i < 3; ++i)
hotkeyDown[i] = 0;
enabled = true;
}
void LoadConfig()
{
s_config.LoadConfig(true);
}
void Shutdown()
@ -235,7 +203,7 @@ void Shutdown()
HotkeyManager::HotkeyManager()
{
for (int set = 0; set < 6; set++)
for (int set = 0; set < 3; set++)
{
// buttons
if ((set * 32) < num_hotkeys)
@ -243,7 +211,7 @@ HotkeyManager::HotkeyManager()
for (int key = 0; key < 32; key++)
{
if ((set * 32 + key) < num_hotkeys)
if ((set * 32 + key) < num_hotkeys && hotkey_labels[set * 32 + key].length() != 0)
{
m_keys[set]->controls.emplace_back(new ControlGroup::Input(hotkey_labels[set * 32 + key]));
}
@ -266,284 +234,30 @@ std::string HotkeyManager::GetName() const
void HotkeyManager::GetInput(HotkeyStatus* const kb)
{
for (int set = 0; set < 6; set++)
for (int set = 0; set < 3; set++)
{
std::vector<u32> bitmasks;
for (int key = 0; key < 32; key++)
{
if ((set * 32 + key) < num_hotkeys && hotkey_labels[set * 32 + key].length() != 0)
bitmasks.push_back(1 << key);
}
if ((set * 32) < num_hotkeys)
m_keys[set]->GetState(&kb->button[set], hotkey_bitmasks);
{
kb->button[set] = 0;
m_keys[set]->GetState(&kb->button[set], bitmasks.data());
}
}
}
void HotkeyManager::LoadDefaults(const ControllerInterface& ciface)
{
#define set_control(group, num, str) (group)->controls[num]->control_ref->expression = (str)
ControllerEmu::LoadDefaults(ciface);
// Buttons
#ifdef _WIN32
set_control(m_keys[0], 0, "(LCONTROL | RCONTROL) & L"); // Open
set_control(m_keys[0], 1, ""); // ChangeDisc
set_control(m_keys[0], 2, ""); // RefreshList
set_control(m_keys[0], 3, "F10"); // PlayPause
set_control(m_keys[0], 4, "ESCAPE"); // Stop
set_control(m_keys[0], 5, ""); // Reset
set_control(m_keys[0], 6, ""); // FrameAdvance
set_control(m_keys[0], 7, ""); // StartRecording
set_control(m_keys[0], 8, ""); // PlayRecording
set_control(m_keys[0], 9, ""); // ExportRecording
set_control(m_keys[0], 10, ""); // Readonlymode
set_control(m_keys[0], 11, "(LMENU | RMENU) & RETURN"); // ToggleFullscreen
set_control(m_keys[0], 12, "`F9` & !(LMENU | RMENU)"); // Screenshot
set_control(m_keys[0], 13, ""); // Exit
set_control(m_keys[0], 14, "(LMENU | RMENU) & `F5`"); // Wiimote1Connect
set_control(m_keys[0], 15, "(LMENU | RMENU) & `F6`"); // Wiimote2Connect
set_control(m_keys[0], 16, "(LMENU | RMENU) & `F7`"); // Wiimote3Connect
set_control(m_keys[0], 17, "(LMENU | RMENU) & `F8`"); // Wiimote4Connect
set_control(m_keys[0], 18, "(LMENU | RMENU) & `F9`"); // BalanceBoardConnect
set_control(m_keys[0], 19, ""); // VolumeDown
set_control(m_keys[0], 20, ""); // VolumeUp
set_control(m_keys[0], 21, ""); // VolumeToggleMute
set_control(m_keys[0], 22, ""); // ToggleIR
set_control(m_keys[0], 23, ""); // ToggleAspectRatio
set_control(m_keys[0], 24, ""); // ToggleEFBCopies
set_control(m_keys[0], 25, ""); // ToggleFog
set_control(m_keys[0], 26, "TAB"); // ToggleThrottle
set_control(m_keys[0], 27, ""); // DecreaseFrameLimit
set_control(m_keys[0], 28, ""); // IncreaseFrameLimit
set_control(m_keys[0], 29, "1"); // FreelookDecreaseSpeed
set_control(m_keys[0], 30, "2"); // FreelookIncreaseSpeed
set_control(m_keys[0], 31, "F"); // FreelookResetSpeed
set_control(m_keys[1], 0, "E"); // FreelookUp
set_control(m_keys[1], 1, "Q"); // FreelookDown
set_control(m_keys[1], 2, "A"); // FreelookLeft
set_control(m_keys[1], 3, "D"); // FreelookRight
set_control(m_keys[1], 4, "W"); // FreelookZoomIn
set_control(m_keys[1], 5, "S"); // FreelookZoomOut
set_control(m_keys[1], 6, "R"); // FreelookReset
set_control(m_keys[1], 7, ""); // DecreaseDepth
set_control(m_keys[1], 8, ""); // IncreaseDepth
set_control(m_keys[1], 9, ""); // DecreaseConvergence
set_control(m_keys[1], 10, ""); // IncreaseConvergence
set_control(m_keys[1], 11, "`F1` & !(LSHIFT | RSHIFT) & !(LMENU | RMENU)"); // LoadStateSlot1
set_control(m_keys[1], 12, "`F2` & !(LSHIFT | RSHIFT) & !(LMENU | RMENU)"); // LoadStateSlot2
set_control(m_keys[1], 13, "`F3` & !(LSHIFT | RSHIFT) & !(LMENU | RMENU)"); // LoadStateSlot3
set_control(m_keys[1], 14, "`F4` & !(LSHIFT | RSHIFT) & !(LMENU | RMENU)"); // LoadStateSlot4
set_control(m_keys[1], 15, "`F5` & !(LSHIFT | RSHIFT) & !(LMENU | RMENU)"); // LoadStateSlot5
set_control(m_keys[1], 16, "`F6` & !(LSHIFT | RSHIFT) & !(LMENU | RMENU)"); // LoadStateSlot6
set_control(m_keys[1], 17, "`F7` & !(LSHIFT | RSHIFT) & !(LMENU | RMENU)"); // LoadStateSlot7
set_control(m_keys[1], 18, "`F8` & !(LSHIFT | RSHIFT) & !(LMENU | RMENU)"); // LoadStateSlot8
set_control(m_keys[1], 19, ""); // LoadStateSlot9
set_control(m_keys[1], 20, ""); // LoadStateSlot10
set_control(m_keys[1], 21, "(LSHIFT | RSHIFT) & `F1`"); // SaveStateSlot1
set_control(m_keys[1], 22, "(LSHIFT | RSHIFT) & `F2`"); // SaveStateSlot2
set_control(m_keys[1], 23, "(LSHIFT | RSHIFT) & `F3`"); // SaveStateSlot3
set_control(m_keys[1], 24, "(LSHIFT | RSHIFT) & `F4`"); // SaveStateSlot4
set_control(m_keys[1], 25, "(LSHIFT | RSHIFT) & `F5`"); // SaveStateSlot5
set_control(m_keys[1], 26, "(LSHIFT | RSHIFT) & `F6`"); // SaveStateSlot6
set_control(m_keys[1], 27, "(LSHIFT | RSHIFT) & `F7`"); // SaveStateSlot7
set_control(m_keys[1], 28, "(LSHIFT | RSHIFT) & `F8`"); // SaveStateSlot8
set_control(m_keys[1], 29, ""); // SaveStateSlot9
set_control(m_keys[1], 30, ""); // SaveStateSlot10
set_control(m_keys[1], 31, ""); // SelectStateSlot1
set_control(m_keys[2], 0, ""); // SelectStateSlot2
set_control(m_keys[2], 1, ""); // SelectStateSlot3
set_control(m_keys[2], 2, ""); // SelectStateSlot4
set_control(m_keys[2], 3, ""); // SelectStateSlot5
set_control(m_keys[2], 4, ""); // SelectStateSlot6
set_control(m_keys[2], 5, ""); // SelectStateSlot7
set_control(m_keys[2], 6, ""); // SelectStateSlot8
set_control(m_keys[2], 7, ""); // SelectStateSlot9
set_control(m_keys[2], 8, ""); // SelectStateSlot10
set_control(m_keys[2], 9, ""); // SaveSelectedSlot
set_control(m_keys[2], 10, ""); // LoadSelectedSlot
set_control(m_keys[2], 11, ""); // LoadLastState1
set_control(m_keys[2], 12, ""); // LoadLastState2
set_control(m_keys[2], 13, ""); // LoadLastState3
set_control(m_keys[2], 14, ""); // LoadLastState4
set_control(m_keys[2], 15, ""); // LoadLastState5
set_control(m_keys[2], 16, ""); // LoadLastState6
set_control(m_keys[2], 17, ""); // LoadLastState7
set_control(m_keys[2], 18, ""); // LoadLastState8
set_control(m_keys[2], 19, ""); // SaveFirstState
set_control(m_keys[2], 20, "`F12` & !(LSHIFT | RSHIFT)"); // UndoLoadState
set_control(m_keys[2], 21, "(LSHIFT | RSHIFT) & `F12`"); // UndoSaveState
set_control(m_keys[2], 22, ""); // SaveStateFile
set_control(m_keys[2], 23, ""); // LoadStateFile
#elif __APPLE__
set_control(m_keys[0], 0, "(`Left Command` | `Right Command`) & `O`"); // Open
set_control(m_keys[0], 1, ""); // ChangeDisc
set_control(m_keys[0], 2, ""); // RefreshList
set_control(m_keys[0], 3, "(`Left Command` | `Right Command`) & `P`"); // PlayPause
set_control(m_keys[0], 4, "(`Left Command` | `Right Command`) & `W`"); // Stop
set_control(m_keys[0], 5, ""); // Reset
set_control(m_keys[0], 6, ""); // FrameAdvance
set_control(m_keys[0], 7, ""); // StartRecording
set_control(m_keys[0], 8, ""); // PlayRecording
set_control(m_keys[0], 9, ""); // ExportRecording
set_control(m_keys[0], 10, ""); // Readonlymode
set_control(m_keys[0], 11, "(`Left Command` | `Right Command`) & `F`"); // ToggleFullscreen
set_control(m_keys[0], 12, "(`Left Command` | `Right Command`) & `S`"); // Screenshot
set_control(m_keys[0], 13, ""); // Exit
set_control(m_keys[0], 14, "(`Left Command` | `Right Command`) & `1`"); // Wiimote1Connect
set_control(m_keys[0], 15, "(`Left Command` | `Right Command`) & `2`"); // Wiimote2Connect
set_control(m_keys[0], 16, "(`Left Command` | `Right Command`) & `3`"); // Wiimote3Connect
set_control(m_keys[0], 17, "(`Left Command` | `Right Command`) & `4`"); // Wiimote4Connect
set_control(m_keys[0], 18, "(`Left Command` | `Right Command`) & `5`"); // BalanceBoardConnect
set_control(m_keys[0], 19, ""); // VolumeDown
set_control(m_keys[0], 20, ""); // VolumeUp
set_control(m_keys[0], 21, ""); // VolumeToggleMute
set_control(m_keys[0], 22, ""); // ToggleIR
set_control(m_keys[0], 23, ""); // ToggleAspectRatio
set_control(m_keys[0], 24, ""); // ToggleEFBCopies
set_control(m_keys[0], 25, ""); // ToggleFog
set_control(m_keys[0], 26, "Tab"); // ToggleThrottle
set_control(m_keys[0], 27, ""); // DecreaseFrameLimit
set_control(m_keys[0], 28, ""); // IncreaseFrameLimit
set_control(m_keys[0], 29, "`1` & !(`Left Command` | `Right Command`)"); // FreelookDecreaseSpeed
set_control(m_keys[0], 30, "`2` & !(`Left Command` | `Right Command`)"); // FreelookIncreaseSpeed
set_control(m_keys[0], 31, "`F` & !(`Left Command` | `Right Command`)"); // FreelookResetSpeed
set_control(m_keys[1], 0, "`E` & !(`Left Command` | `Right Command`)"); // FreelookUp
set_control(m_keys[1], 1, "`Q` & !(`Left Command` | `Right Command`)"); // FreelookDown
set_control(m_keys[1], 2, "`A` & !(`Left Command` | `Right Command`)"); // FreelookLeft
set_control(m_keys[1], 3, "`D` & !(`Left Command` | `Right Command`)"); // FreelookRight
set_control(m_keys[1], 4, "`W` & !(`Left Command` | `Right Command`)"); // FreelookZoomIn
set_control(m_keys[1], 5, "`S` & !(`Left Command` | `Right Command`)"); // FreelookZoomOut
set_control(m_keys[1], 6, "`R` & !(`Left Command` | `Right Command`)"); // FreelookReset
set_control(m_keys[1], 7, ""); // DecreaseDepth
set_control(m_keys[1], 8, ""); // IncreaseDepth
set_control(m_keys[1], 9, ""); // DecreaseConvergence
set_control(m_keys[1], 10, ""); // IncreaseConvergence
set_control(m_keys[1], 11, "`F1` & !(`Left Shift` | `Right Shift`)"); // LoadStateSlot1
set_control(m_keys[1], 12, "`F2` & !(`Left Shift` | `Right Shift`)"); // LoadStateSlot2
set_control(m_keys[1], 13, "`F3` & !(`Left Shift` | `Right Shift`)"); // LoadStateSlot3
set_control(m_keys[1], 14, "`F4` & !(`Left Shift` | `Right Shift`)"); // LoadStateSlot4
set_control(m_keys[1], 15, "`F5` & !(`Left Shift` | `Right Shift`)"); // LoadStateSlot5
set_control(m_keys[1], 16, "`F6` & !(`Left Shift` | `Right Shift`)"); // LoadStateSlot6
set_control(m_keys[1], 17, "`F7` & !(`Left Shift` | `Right Shift`)"); // LoadStateSlot7
set_control(m_keys[1], 18, "`F8` & !(`Left Shift` | `Right Shift`)"); // LoadStateSlot8
set_control(m_keys[1], 19, ""); // LoadStateSlot9
set_control(m_keys[1], 20, ""); // LoadStateSlot10
set_control(m_keys[1], 21, "(`Left Shift` | `Right Shift`) & `F1`"); // SaveStateSlot1
set_control(m_keys[1], 22, "(`Left Shift` | `Right Shift`) & `F2`"); // SaveStateSlot2
set_control(m_keys[1], 23, "(`Left Shift` | `Right Shift`) & `F3`"); // SaveStateSlot3
set_control(m_keys[1], 24, "(`Left Shift` | `Right Shift`) & `F4`"); // SaveStateSlot4
set_control(m_keys[1], 25, "(`Left Shift` | `Right Shift`) & `F5`"); // SaveStateSlot5
set_control(m_keys[1], 26, "(`Left Shift` | `Right Shift`) & `F6`"); // SaveStateSlot6
set_control(m_keys[1], 27, "(`Left Shift` | `Right Shift`) & `F7`"); // SaveStateSlot7
set_control(m_keys[1], 28, "(`Left Shift` | `Right Shift`) & `F8`"); // SaveStateSlot8
set_control(m_keys[1], 29, ""); // SaveStateSlot9
set_control(m_keys[1], 30, ""); // SaveStateSlot10
set_control(m_keys[1], 31, ""); // SelectStateSlot1
set_control(m_keys[2], 0, ""); // SelectStateSlot2
set_control(m_keys[2], 1, ""); // SelectStateSlot3
set_control(m_keys[2], 2, ""); // SelectStateSlot4
set_control(m_keys[2], 3, ""); // SelectStateSlot5
set_control(m_keys[2], 4, ""); // SelectStateSlot6
set_control(m_keys[2], 5, ""); // SelectStateSlot7
set_control(m_keys[2], 6, ""); // SelectStateSlot8
set_control(m_keys[2], 7, ""); // SelectStateSlot9
set_control(m_keys[2], 8, ""); // SelectStateSlot10
set_control(m_keys[2], 9, ""); // SaveSelectedSlot
set_control(m_keys[2], 10, ""); // LoadSelectedSlot
set_control(m_keys[2], 11, ""); // LoadLastState1
set_control(m_keys[2], 12, ""); // LoadLastState2
set_control(m_keys[2], 13, ""); // LoadLastState3
set_control(m_keys[2], 14, ""); // LoadLastState4
set_control(m_keys[2], 15, ""); // LoadLastState5
set_control(m_keys[2], 16, ""); // LoadLastState6
set_control(m_keys[2], 17, ""); // LoadLastState7
set_control(m_keys[2], 18, ""); // LoadLastState8
set_control(m_keys[2], 19, ""); // SaveFirstState
set_control(m_keys[2], 20, "`F12` & !(`Left Shift` | `Right Shift`)"); // UndoLoadState
set_control(m_keys[2], 21, "(`Left Shift` | `Right Shift`) & `F12`"); // UndoSaveState
set_control(m_keys[2], 22, ""); // SaveStateFile
set_control(m_keys[2], 23, ""); // LoadStateFile
#else // linux
set_control(m_keys[0], 0, "(`Control_L` | `Control_R`) & `O`"); // Open
set_control(m_keys[0], 1, ""); // ChangeDisc
set_control(m_keys[0], 2, ""); // RefreshList
set_control(m_keys[0], 3, "`F10` & !(`Alt_L` | `Alt_R`)"); // PlayPause
set_control(m_keys[0], 4, "Escape & !(`Alt_L` | `Alt_R`)"); // Stop
set_control(m_keys[0], 5, ""); // Reset
set_control(m_keys[0], 6, ""); // FrameAdvance
set_control(m_keys[0], 7, ""); // StartRecording
set_control(m_keys[0], 8, ""); // PlayRecording
set_control(m_keys[0], 9, ""); // ExportRecording
set_control(m_keys[0], 10, ""); // Readonlymode
set_control(m_keys[0], 11, "(`Alt_L` | `Alt_R`) & Return"); // ToggleFullscreen
set_control(m_keys[0], 12, "`F9` & !(`Alt_L` | `Alt_R`)"); // Screenshot
set_control(m_keys[0], 13, ""); // Exit
set_control(m_keys[0], 14, "(`Alt_L` | `Alt_R`) & `F5`"); // Wiimote1Connect
set_control(m_keys[0], 15, "(`Alt_L` | `Alt_R`) & `F6`"); // Wiimote2Connect
set_control(m_keys[0], 16, "(`Alt_L` | `Alt_R`) & `F7`"); // Wiimote3Connect
set_control(m_keys[0], 17, "(`Alt_L` | `Alt_R`) & `F8`"); // Wiimote4Connect
set_control(m_keys[0], 18, "(`Alt_L` | `Alt_R`) & `F9`"); // BalanceBoardConnect
set_control(m_keys[0], 19, ""); // VolumeDown
set_control(m_keys[0], 20, ""); // VolumeUp
set_control(m_keys[0], 21, ""); // VolumeToggleMute
set_control(m_keys[0], 22, ""); // ToggleIR
set_control(m_keys[0], 23, ""); // ToggleAspectRatio
set_control(m_keys[0], 24, ""); // ToggleEFBCopies
set_control(m_keys[0], 25, ""); // ToggleFog
set_control(m_keys[0], 26, "Tab & !(`Alt_L` | `Alt_R`)"); // ToggleThrottle
set_control(m_keys[0], 27, ""); // DecreaseFrameLimit
set_control(m_keys[0], 28, ""); // IncreaseFrameLimit
set_control(m_keys[0], 29, "1 & !(`Alt_L` | `Alt_R`)"); // FreelookDecreaseSpeed
set_control(m_keys[0], 30, "2 & !(`Alt_L` | `Alt_R`)"); // FreelookIncreaseSpeed
set_control(m_keys[0], 31, "F & !(`Alt_L` | `Alt_R`)"); // FreelookResetSpeed
set_control(m_keys[1], 0, "E & !(`Alt_L` | `Alt_R`)"); // FreelookUp
set_control(m_keys[1], 1, "Q & !(`Alt_L` | `Alt_R`)"); // FreelookDown
set_control(m_keys[1], 2, "A & !(`Alt_L` | `Alt_R`)"); // FreelookLeft
set_control(m_keys[1], 3, "D & !(`Alt_L` | `Alt_R`)"); // FreelookRight
set_control(m_keys[1], 4, "W & !(`Alt_L` | `Alt_R`)"); // FreelookZoomIn
set_control(m_keys[1], 5, "S & !(`Alt_L` | `Alt_R`)"); // FreelookZoomOut
set_control(m_keys[1], 6, "R & !(`Alt_L` | `Alt_R`)"); // FreelookReset
set_control(m_keys[1], 7, ""); // DecreaseDepth
set_control(m_keys[1], 8, ""); // IncreaseDepth
set_control(m_keys[1], 9, ""); // DecreaseConvergence
set_control(m_keys[1], 10, ""); // IncreaseConvergence
set_control(m_keys[1], 11, "`F1` & !(`Shift_L` | `Shift_R`) & !(`Alt_L` | `Alt_R`)"); // LoadStateSlot1
set_control(m_keys[1], 12, "`F2` & !(`Shift_L` | `Shift_R`) & !(`Alt_L` | `Alt_R`)"); // LoadStateSlot2
set_control(m_keys[1], 13, "`F3` & !(`Shift_L` | `Shift_R`) & !(`Alt_L` | `Alt_R`)"); // LoadStateSlot3
set_control(m_keys[1], 14, "`F4` & !(`Shift_L` | `Shift_R`) & !(`Alt_L` | `Alt_R`)"); // LoadStateSlot4
set_control(m_keys[1], 15, "`F5` & !(`Shift_L` | `Shift_R`) & !(`Alt_L` | `Alt_R`)"); // LoadStateSlot5
set_control(m_keys[1], 16, "`F6` & !(`Shift_L` | `Shift_R`) & !(`Alt_L` | `Alt_R`)"); // LoadStateSlot6
set_control(m_keys[1], 17, "`F7` & !(`Shift_L` | `Shift_R`) & !(`Alt_L` | `Alt_R`)"); // LoadStateSlot7
set_control(m_keys[1], 18, "`F8` & !(`Shift_L` | `Shift_R`) & !(`Alt_L` | `Alt_R`)"); // LoadStateSlot8
set_control(m_keys[1], 19, ""); // LoadStateSlot9
set_control(m_keys[1], 20, ""); // LoadStateSlot10
set_control(m_keys[1], 21, "(`Shift_L` | `Shift_R`) & `F1` & !(`Alt_L` | `Alt_R`)"); // SaveStateSlot1
set_control(m_keys[1], 22, "(`Shift_L` | `Shift_R`) & `F2` & !(`Alt_L` | `Alt_R`)"); // SaveStateSlot2
set_control(m_keys[1], 23, "(`Shift_L` | `Shift_R`) & `F3` & !(`Alt_L` | `Alt_R`)"); // SaveStateSlot3
set_control(m_keys[1], 24, "(`Shift_L` | `Shift_R`) & `F4` & !(`Alt_L` | `Alt_R`)"); // SaveStateSlot4
set_control(m_keys[1], 25, "(`Shift_L` | `Shift_R`) & `F5` & !(`Alt_L` | `Alt_R`)"); // SaveStateSlot5
set_control(m_keys[1], 26, "(`Shift_L` | `Shift_R`) & `F6` & !(`Alt_L` | `Alt_R`)"); // SaveStateSlot6
set_control(m_keys[1], 27, "(`Shift_L` | `Shift_R`) & `F7` & !(`Alt_L` | `Alt_R`)"); // SaveStateSlot7
set_control(m_keys[1], 28, "(`Shift_L` | `Shift_R`) & `F8` & !(`Alt_L` | `Alt_R`)"); // SaveStateSlot8
set_control(m_keys[1], 29, ""); // SaveStateSlot9
set_control(m_keys[1], 30, ""); // SaveStateSlot10
set_control(m_keys[1], 31, ""); // SelectStateSlot1
set_control(m_keys[2], 0, ""); // SelectStateSlot2
set_control(m_keys[2], 1, ""); // SelectStateSlot3
set_control(m_keys[2], 2, ""); // SelectStateSlot4
set_control(m_keys[2], 3, ""); // SelectStateSlot5
set_control(m_keys[2], 4, ""); // SelectStateSlot6
set_control(m_keys[2], 5, ""); // SelectStateSlot7
set_control(m_keys[2], 6, ""); // SelectStateSlot8
set_control(m_keys[2], 7, ""); // SelectStateSlot9
set_control(m_keys[2], 8, ""); // SelectStateSlot10
set_control(m_keys[2], 9, ""); // SaveSelectedSlot
set_control(m_keys[2], 10, ""); // LoadSelectedSlot
set_control(m_keys[2], 11, ""); // LoadLastState1
set_control(m_keys[2], 12, ""); // LoadLastState2
set_control(m_keys[2], 13, ""); // LoadLastState3
set_control(m_keys[2], 14, ""); // LoadLastState4
set_control(m_keys[2], 15, ""); // LoadLastState5
set_control(m_keys[2], 16, ""); // LoadLastState6
set_control(m_keys[2], 17, ""); // LoadLastState7
set_control(m_keys[2], 18, ""); // LoadLastState8
set_control(m_keys[2], 19, ""); // SaveFirstState
set_control(m_keys[2], 20, "`F12` & !(`Shift_L` | `Shift_R`) & !(`Alt_L` | `Alt_R`)"); // UndoLoadState
set_control(m_keys[2], 21, "(`Shift_L` | `Shift_R`) & `F12` & !(`Alt_L` | `Alt_R`)"); // UndoSaveState
set_control(m_keys[2], 22, ""); // SaveStateFile
set_control(m_keys[2], 23, ""); // LoadStateFile
#endif
for (int set = 0; set < 3; set++)
{
for (unsigned int key = 0; key < (m_keys[set])->controls.size(); key++)
{
(m_keys[set])->controls[key]->control_ref->expression = "";
}
}
}

View file

@ -24,7 +24,7 @@ public:
void LoadDefaults(const ControllerInterface& ciface);
private:
Buttons* m_keys[6];
Buttons* m_keys[3];
ControlGroup* m_options;
};
@ -32,8 +32,13 @@ namespace HotkeyManagerEmu
{
void Initialize(void* const hwnd);
void Shutdown();
void LoadConfig();
InputConfig* GetConfig();
void GetStatus(u8 _port, HotkeyStatus* _pKeyboardStatus);
void GetStatus();
bool IsEnabled();
void Enable(bool enable_toggle);
bool IsPressed(int Id, bool held);
static bool enabled;
}

View file

@ -23,6 +23,7 @@
#include "Common/SysConf.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/HotkeyManager.h"
#include "Core/Movie.h"
#include "Core/NetPlayProto.h"
#include "Core/HW/GCKeyboard.h"
@ -207,12 +208,13 @@ wxStaticBoxSizer* ControllerConfigDiag::CreateWiimoteConfigSizer()
wiimote_configure_bt[i]->Bind(wxEVT_BUTTON, &ControllerConfigDiag::ConfigEmulatedWiimote, this);
// Disable controller type selection for certain circumstances.
if (NetPlay::IsNetPlayRunning() || Movie::IsMovieActive())
bool wii_game_started = SConfig::GetInstance().m_LocalCoreStartupParameter.bWii || Core::GetState() == Core::CORE_UNINITIALIZED;
if (NetPlay::IsNetPlayRunning() || Movie::IsMovieActive() || !wii_game_started)
wiimote_source_ch[i]->Disable();
m_orig_wiimote_sources[i] = g_wiimote_sources[i];
wiimote_source_ch[i]->Select(m_orig_wiimote_sources[i]);
if (m_orig_wiimote_sources[i] != WIIMOTE_SRC_EMU && m_orig_wiimote_sources[i] != WIIMOTE_SRC_HYBRID)
if (!wii_game_started || (m_orig_wiimote_sources[i] != WIIMOTE_SRC_EMU && m_orig_wiimote_sources[i] != WIIMOTE_SRC_HYBRID))
wiimote_configure_bt[i]->Disable();
}
@ -390,28 +392,13 @@ wxStaticBoxSizer* ControllerConfigDiag::CreateGeneralWiimoteSettingsSizer()
void ControllerConfigDiag::ConfigEmulatedWiimote(wxCommandEvent& ev)
{
InputConfig* const wiimote_plugin = Wiimote::GetConfig();
bool was_init = false;
if (g_controller_interface.IsInit()) // check if game is running
{
was_init = true;
}
else
{
#if defined(HAVE_X11) && HAVE_X11
Window win = X11Utils::XWindowFromHandle(GetHandle());
Wiimote::Initialize(reinterpret_cast<void*>(win));
#else
Wiimote::Initialize(reinterpret_cast<void*>(GetHandle()));
#endif
}
HotkeyManagerEmu::Enable(false);
InputConfigDialog m_ConfigFrame(this, *wiimote_plugin, _("Dolphin Emulated Wiimote Configuration"), m_wiimote_index_from_conf_bt_id[ev.GetId()]);
m_ConfigFrame.ShowModal();
if (!was_init) // if game isn't running
{
Wiimote::Shutdown();
}
HotkeyManagerEmu::Enable(true);
}
void ControllerConfigDiag::RefreshRealWiimotes(wxCommandEvent&)
@ -535,24 +522,7 @@ void ControllerConfigDiag::OnGameCubeConfigButton(wxCommandEvent& event)
InputConfig* const key_plugin = Keyboard::GetConfig();
const int port_num = m_gc_port_config_ids[event.GetId()];
bool was_init = false;
// 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());
Pad::Initialize(reinterpret_cast<void*>(win));
Keyboard::Initialize(reinterpret_cast<void*>(win));
#else
Pad::Initialize(reinterpret_cast<void*>(GetHandle()));
Keyboard::Initialize(reinterpret_cast<void*>(GetHandle()));
#endif
}
HotkeyManagerEmu::Enable(false);
if (SConfig::GetInstance().m_SIDevice[port_num] == SIDEVICE_GC_KEYBOARD)
{
@ -565,10 +535,5 @@ void ControllerConfigDiag::OnGameCubeConfigButton(wxCommandEvent& event)
m_ConfigFrame.ShowModal();
}
// if game isn't running
if (!was_init)
{
Keyboard::Shutdown();
Pad::Shutdown();
}
HotkeyManagerEmu::Enable(true);
}

View file

@ -937,7 +937,7 @@ void CFrame::OnGameListCtrl_ItemActivated(wxListEvent& WXUNUSED(event))
}
}
static bool IsHotkey(wxKeyEvent &event, int Id, bool keyUp = false)
static bool IsHotkey(wxKeyEvent &event, int id, bool held = false)
{
if (Core::GetState() == Core::CORE_UNINITIALIZED)
return false;
@ -945,10 +945,12 @@ static bool IsHotkey(wxKeyEvent &event, int Id, bool keyUp = false)
// Input event hotkey
if (event.GetKeyCode() == WXK_NONE)
{
return HotkeyManagerEmu::IsPressed(Id, keyUp);
return HotkeyManagerEmu::IsPressed(id, held);
}
return false;
return (event.GetKeyCode() != WXK_NONE &&
event.GetKeyCode() == SConfig::GetInstance().m_LocalCoreStartupParameter.iHotkey[id] &&
event.GetModifiers() == SConfig::GetInstance().m_LocalCoreStartupParameter.iHotkeyModifier[id]);
}
int GetCmdForHotkey(unsigned int key)
@ -1263,11 +1265,15 @@ const CGameListCtrl *CFrame::GetGameListCtrl() const
void CFrame::PollHotkeys(wxTimerEvent& event)
{
if (!HotkeyManagerEmu::IsEnabled())
return;
if (Core::GetState() == Core::CORE_UNINITIALIZED || Core::GetState() == Core::CORE_PAUSE)
g_controller_interface.UpdateInput();
if (Core::GetState() != Core::CORE_STOPPING)
{
HotkeyManagerEmu::GetStatus();
wxKeyEvent keyevent = 0;
if (IsHotkey(keyevent, HK_TOGGLE_THROTTLE))
@ -1364,24 +1370,26 @@ void CFrame::ParseHotkeys(wxKeyEvent &event)
{
State::Load(g_saveSlot);
}
else if (IsHotkey(event, HK_DECREASE_DEPTH))
else if (IsHotkey(event, HK_DECREASE_DEPTH, true))
{
if (--g_Config.iStereoDepth < 0)
g_Config.iStereoDepth = 0;
}
else if (IsHotkey(event, HK_INCREASE_DEPTH))
else if (IsHotkey(event, HK_INCREASE_DEPTH, true))
{
if (++g_Config.iStereoDepth > 100)
g_Config.iStereoDepth = 100;
}
else if (IsHotkey(event, HK_DECREASE_CONVERGENCE))
else if (IsHotkey(event, HK_DECREASE_CONVERGENCE, true))
{
if (--g_Config.iStereoConvergence < 0)
g_Config.iStereoConvergence -= 5;
if (g_Config.iStereoConvergence < 0)
g_Config.iStereoConvergence = 0;
}
else if (IsHotkey(event, HK_INCREASE_CONVERGENCE))
else if (IsHotkey(event, HK_INCREASE_CONVERGENCE, true))
{
if (++g_Config.iStereoConvergence > 500)
g_Config.iStereoConvergence += 5;
if (g_Config.iStereoConvergence > 500)
g_Config.iStereoConvergence = 500;
}
@ -1398,25 +1406,26 @@ void CFrame::ParseHotkeys(wxKeyEvent &event)
}
unsigned int i = NUM_HOTKEYS;
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain || TASInputHasFocus())
for (i = 0; i < NUM_HOTKEYS; i++)
{
for (i = 0; i < NUM_HOTKEYS; i++)
bool held = false;
if (i == HK_FRAME_ADVANCE)
held = true;
if (IsHotkey(event, i, held))
{
if (IsHotkey(event, i))
int cmd = GetCmdForHotkey(i);
if (cmd >= 0)
{
int cmd = GetCmdForHotkey(i);
if (cmd >= 0)
wxCommandEvent evt(wxEVT_MENU, cmd);
wxMenuItem* item = GetMenuBar()->FindItem(cmd);
if (item && item->IsCheckable())
{
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;
item->wxMenuItemBase::Toggle();
evt.SetInt(item->IsChecked());
}
GetEventHandler()->AddPendingEvent(evt);
break;
}
}
}
@ -1436,37 +1445,34 @@ void CFrame::ParseHotkeys(wxKeyEvent &event)
// Actually perform the Wiimote connection or disconnection
if (Core::GetState() != Core::CORE_UNINITIALIZED)
{
if (WiimoteId >= 0)
if (WiimoteId >= 0 && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
{
wxCommandEvent evt;
evt.SetId(IDM_CONNECT_WIIMOTE1 + WiimoteId);
OnConnectWiimote(evt);
}
if (g_Config.bFreeLook)
{
static float debugSpeed = 1.0f;
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();
}
if (IsHotkey(event, HK_FREELOOK_DECREASE_SPEED, true))
debugSpeed /= 1.1f;
else if (IsHotkey(event, HK_FREELOOK_INCREASE_SPEED, true))
debugSpeed *= 1.1f;
else if (IsHotkey(event, HK_FREELOOK_RESET_SPEED, true))
debugSpeed = 1.0f;
else if (IsHotkey(event, HK_FREELOOK_UP, true))
VertexShaderManager::TranslateView(0.0f, 0.0f, -debugSpeed);
else if (IsHotkey(event, HK_FREELOOK_DOWN, true))
VertexShaderManager::TranslateView(0.0f, 0.0f, debugSpeed);
else if (IsHotkey(event, HK_FREELOOK_LEFT, true))
VertexShaderManager::TranslateView(debugSpeed, 0.0f);
else if (IsHotkey(event, HK_FREELOOK_RIGHT, true))
VertexShaderManager::TranslateView(-debugSpeed, 0.0f);
else if (IsHotkey(event, HK_FREELOOK_ZOOM_IN, true))
VertexShaderManager::TranslateView(0.0f, debugSpeed);
else if (IsHotkey(event, HK_FREELOOK_ZOOM_OUT, true))
VertexShaderManager::TranslateView(0.0f, -debugSpeed);
else if (IsHotkey(event, HK_FREELOOK_RESET, true))
VertexShaderManager::ResetView();
}
}

View file

@ -51,6 +51,7 @@
#include "Core/State.h"
#include "Core/HW/CPU.h"
#include "Core/HW/DVDInterface.h"
#include "Core/HW/GCKeyboard.h"
#include "Core/HW/GCPad.h"
#include "Core/HW/ProcessorInterface.h"
#include "Core/HW/SI_Device.h"
@ -238,8 +239,8 @@ wxMenuBar* CFrame::CreateMenu()
pOptionsMenu->Append(IDM_CONFIG_GFX_BACKEND, _("&Graphics Settings"));
pOptionsMenu->Append(IDM_CONFIG_AUDIO, _("&Audio Settings"));
pOptionsMenu->Append(IDM_CONFIG_CONTROLLERS, _("&Controller Settings"));
pOptionsMenu->Append(IDM_CONFIG_MENU_COMMANDS, _("&Key Shortcuts"));
pOptionsMenu->Append(IDM_CONFIG_HOTKEYS, _("&Hotkey Settings"));
pOptionsMenu->Append(IDM_CONFIG_MENU_COMMANDS, _("&Menu Accelerators"));
if (g_pCodeWindow)
{
pOptionsMenu->AppendSeparator();
@ -686,7 +687,8 @@ void CFrame::BootGame(const std::string& filename)
// Open file to boot
void CFrame::OnOpen(wxCommandEvent& WXUNUSED (event))
{
DoOpen(true);
if (Core::GetState() == Core::CORE_UNINITIALIZED)
DoOpen(true);
}
void CFrame::DoOpen(bool Boot)
@ -1365,27 +1367,31 @@ void CFrame::OnConfigHotkey(wxCommandEvent& WXUNUSED (event))
InputConfig* const hotkey_plugin = HotkeyManagerEmu::GetConfig();
// check if game is running
if (g_controller_interface.IsInit())
bool game_running = false;
if (Core::GetState() == Core::CORE_RUN)
{
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
Core::SetState(Core::CORE_PAUSE);
game_running = true;
}
HotkeyManagerEmu::Enable(false);
InputConfigDialog m_ConfigFrame(this, *hotkey_plugin, _("Dolphin Hotkeys"));
m_ConfigFrame.ShowModal();
// Update references in case controllers were refreshed
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
Wiimote::LoadConfig();
Keyboard::LoadConfig();
Pad::LoadConfig();
HotkeyManagerEmu::LoadConfig();
HotkeyManagerEmu::Enable(true);
// if game isn't running
if (!was_init)
if (game_running)
{
HotkeyManagerEmu::Shutdown();
Core::SetState(Core::CORE_RUN);
}
// Update the GUI in case menu accelerators were changed
@ -1761,7 +1767,7 @@ void CFrame::UpdateGUI()
GetMenuBar()->FindItem(IDM_SCREENSHOT)->Enable(Running || Paused);
GetMenuBar()->FindItem(IDM_TOGGLE_FULLSCREEN)->Enable(Running || Paused);
// Update Menu Accelerators
// Update Key Shortcuts
for (unsigned int i = 0; i < NUM_HOTKEYS; i++)
{
if (GetCmdForHotkey(i) == -1)

View file

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

View file

@ -44,6 +44,10 @@
#include "Common/FileUtil.h"
#include "Common/IniFile.h"
#include "Common/MsgHandler.h"
#include "Core/Core.h"
#include "Core/HotkeyManager.h"
#include "Core/HW/GCKeyboard.h"
#include "Core/HW/GCPad.h"
#include "Core/HW/Wiimote.h"
#include "DolphinWX/InputConfigDiag.h"
#include "DolphinWX/WxUtils.h"
@ -740,6 +744,8 @@ void InputConfigDialog::UpdateDeviceComboBox()
void GamepadPage::RefreshDevices(wxCommandEvent&)
{
bool was_unpaused = Core::PauseAndLock(true);
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
// refresh devices
@ -750,6 +756,14 @@ void GamepadPage::RefreshDevices(wxCommandEvent&)
// update device cbox
m_config_dialog->UpdateDeviceComboBox();
//if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
Wiimote::LoadConfig();
Keyboard::LoadConfig();
Pad::LoadConfig();
HotkeyManagerEmu::LoadConfig();
Core::PauseAndLock(false, was_unpaused);
}
ControlGroupBox::~ControlGroupBox()

View file

@ -136,9 +136,6 @@ void ControllerInterface::UpdateInput()
{
std::unique_lock<std::recursive_mutex> lk(update_lock, std::defer_lock);
if (!lk.try_lock())
return;
for (ciface::Core::Device* d : m_devices)
d->UpdateInput();
}

View file

@ -7,13 +7,6 @@
#include "Core/HW/Wiimote.h"
#include "InputCommon/InputConfig.h"
InputConfig::~InputConfig()
{
// delete pads
for (ControllerEmu* pad : controllers)
delete pad;
}
bool InputConfig::LoadConfig(bool isGC)
{
IniFile inifile;

View file

@ -21,8 +21,6 @@ public:
const char* const _profile_name)
: ini_name(_ini_name), gui_name(_gui_name), profile_name(_profile_name) {}
~InputConfig();
bool LoadConfig(bool isGC);
void SaveConfig();