Skip to content

Commit

Permalink
Updated the input plugins reference of hwnd on game start. Fixes the …
Browse files Browse the repository at this point in the history
…emu wiimotes mouse IR when rendering the game to a separate window.
  • Loading branch information
skidau committed Mar 18, 2015
1 parent 27619e6 commit 17e6cfe
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
7 changes: 5 additions & 2 deletions Source/Core/Core/Core.cpp
Expand Up @@ -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();
}
Expand All @@ -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();
Expand Down Expand Up @@ -557,7 +559,8 @@ void EmuThread()

if (init_controllers)
{
Wiimote::Shutdown();
if (core_parameter.bWii)
Wiimote::Shutdown();
Keyboard::Shutdown();
Pad::Shutdown();
init_controllers = false;
Expand Down
3 changes: 3 additions & 0 deletions Source/Core/DolphinWX/InputConfigDiag.cpp
Expand Up @@ -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
Expand Down
Expand Up @@ -44,7 +44,7 @@ ControllerInterface g_controller_interface;
void ControllerInterface::Initialize(void* const hwnd)
{
if (m_is_init)
return;
DeInit();

m_hwnd = hwnd;

Expand Down Expand Up @@ -102,6 +102,11 @@ void ControllerInterface::Shutdown()
delete d;
}

DeInit();
}

void ControllerInterface::DeInit()
{
m_devices.clear();

#ifdef CIFACE_USE_XINPUT
Expand Down
Expand Up @@ -117,6 +117,9 @@ class ControllerInterface : public ciface::Core::DeviceContainer
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;
Expand Down

0 comments on commit 17e6cfe

Please sign in to comment.