ControllerInterface: Allow hotplug callbacks to be unregistered and don't reload the entire config from the ini file on hotplug, just update the control references. This should fix a crash on shutdown on Android.

This commit is contained in:
Jordan Woyak
2019-01-10 09:02:38 -06:00
parent c2afcb0f6b
commit b425f86121
10 changed files with 62 additions and 16 deletions

View File

@ -9,6 +9,8 @@
#include <utility>
#include <vector>
#include "InputCommon/ControllerInterface/ControllerInterface.h"
namespace ControllerEmu
{
class EmulatedController;
@ -40,7 +42,12 @@ public:
std::string GetProfileName() const { return m_profile_name; }
std::size_t GetControllerCount() const;
// These should be used after creating all controllers and before clearing them, respectively.
void RegisterHotplugCallback();
void UnregisterHotplugCallback();
private:
ControllerInterface::HotplugCallbackHandle m_hotplug_callback_handle;
std::vector<std::unique_ptr<ControllerEmu::EmulatedController>> m_controllers;
const std::string m_ini_name;
const std::string m_gui_name;