From 98dce11f8c226ef20a660ec7aa9eb0148999dc8c Mon Sep 17 00:00:00 2001 From: skidau Date: Thu, 19 Mar 2015 21:31:05 +1100 Subject: [PATCH] Updated the input plugins reference of hwnd on game start. Fixes the emu wiimotes mouse IR when rendering the game to a separate window. --- Source/Core/Core/Core.cpp | 7 +++++-- Source/Core/Core/HotkeyManager.cpp | 7 ++++--- Source/Core/Core/HotkeyManager.h | 2 -- Source/Core/DolphinWX/InputConfigDiag.cpp | 3 +++ .../ControllerInterface/ControllerInterface.cpp | 7 ++++++- .../InputCommon/ControllerInterface/ControllerInterface.h | 3 +++ 6 files changed, 21 insertions(+), 8 deletions(-) diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp index 113ac0e553..3d7c87c38b 100644 --- a/Source/Core/Core/Core.cpp +++ b/Source/Core/Core/Core.cpp @@ -430,6 +430,7 @@ void EmuThread() else { // Update references in case controllers were refreshed + g_controller_interface.Initialize(s_window_handle); Pad::LoadConfig(); Keyboard::LoadConfig(); } @@ -444,9 +445,10 @@ void EmuThread() // Activate Wiimotes which don't have source set to "None" for (unsigned int i = 0; i != MAX_BBMOTES; ++i) + { if (g_wiimote_sources[i]) GetUsbPointer()->AccessWiiMote(i | 0x100)->Activate(true); - + } } AudioCommon::InitSoundStream(); @@ -557,7 +559,8 @@ void EmuThread() if (init_controllers) { - Wiimote::Shutdown(); + if (core_parameter.bWii) + Wiimote::Shutdown(); Keyboard::Shutdown(); Pad::Shutdown(); init_controllers = false; diff --git a/Source/Core/Core/HotkeyManager.cpp b/Source/Core/Core/HotkeyManager.cpp index c3a6461ebe..8c48c80c16 100644 --- a/Source/Core/Core/HotkeyManager.cpp +++ b/Source/Core/Core/HotkeyManager.cpp @@ -117,10 +117,11 @@ const int num_hotkeys = (sizeof(hotkey_labels) / sizeof(hotkey_labels[0])); namespace HotkeyManagerEmu { -static u32 hotkeyDown[3]; -static HotkeyStatus hotkey; +u32 hotkeyDown[3]; +HotkeyStatus hotkey; +bool enabled; -static InputConfig s_config("Hotkeys", _trans("Hotkeys"), "Hotkeys"); +InputConfig s_config("Hotkeys", _trans("Hotkeys"), "Hotkeys"); InputConfig* GetConfig() { diff --git a/Source/Core/Core/HotkeyManager.h b/Source/Core/Core/HotkeyManager.h index bd76395046..4054a4fac5 100644 --- a/Source/Core/Core/HotkeyManager.h +++ b/Source/Core/Core/HotkeyManager.h @@ -39,6 +39,4 @@ namespace HotkeyManagerEmu bool IsEnabled(); void Enable(bool enable_toggle); bool IsPressed(int Id, bool held); - - static bool enabled; } diff --git a/Source/Core/DolphinWX/InputConfigDiag.cpp b/Source/Core/DolphinWX/InputConfigDiag.cpp index 4c3d70c99a..4997ca318e 100644 --- a/Source/Core/DolphinWX/InputConfigDiag.cpp +++ b/Source/Core/DolphinWX/InputConfigDiag.cpp @@ -1060,6 +1060,9 @@ GamepadPage::GamepadPage(wxWindow* parent, InputConfig& config, const unsigned i mapping->Add(dio, 1, wxEXPAND|wxLEFT|wxTOP|wxBOTTOM, 5); mapping->Add(control_group_sizer, 0, wxLEFT|wxEXPAND, 5); + wxCommandEvent event; + RefreshDevices(event); + UpdateGUI(); SetSizerAndFit(mapping); // needed diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp index 1330cb1e0a..a3c14a0ab5 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp @@ -44,7 +44,7 @@ ControllerInterface g_controller_interface; void ControllerInterface::Initialize(void* const hwnd) { if (m_is_init) - return; + DeInit(); m_hwnd = hwnd; @@ -102,6 +102,11 @@ void ControllerInterface::Shutdown() delete d; } + DeInit(); +} + +void ControllerInterface::DeInit() +{ m_devices.clear(); #ifdef CIFACE_USE_XINPUT diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h index 9ab8427ad2..1b2c93951f 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h @@ -117,6 +117,9 @@ public: void Initialize(void* const hwnd); void Reinitialize(); void Shutdown(); + + void DeInit(); + bool IsInit() const { return m_is_init; } void UpdateReference(ControlReference* control, const ciface::Core::DeviceQualifier& default_device) const;