Merge pull request #4357 from ligfx/notresponsibleforhw
HW: Don't be responsible for g_controller_interface
This commit is contained in:
commit
1e9f052ea5
|
@ -517,8 +517,9 @@ void EmuThread()
|
||||||
bool init_controllers = false;
|
bool init_controllers = false;
|
||||||
if (!g_controller_interface.IsInit())
|
if (!g_controller_interface.IsInit())
|
||||||
{
|
{
|
||||||
Pad::Initialize(s_window_handle);
|
g_controller_interface.Initialize(s_window_handle);
|
||||||
Keyboard::Initialize(s_window_handle);
|
Pad::Initialize();
|
||||||
|
Keyboard::Initialize();
|
||||||
init_controllers = true;
|
init_controllers = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -532,7 +533,7 @@ void EmuThread()
|
||||||
if (core_parameter.bWii && !SConfig::GetInstance().m_bt_passthrough_enabled)
|
if (core_parameter.bWii && !SConfig::GetInstance().m_bt_passthrough_enabled)
|
||||||
{
|
{
|
||||||
if (init_controllers)
|
if (init_controllers)
|
||||||
Wiimote::Initialize(s_window_handle, !s_state_filename.empty() ?
|
Wiimote::Initialize(!s_state_filename.empty() ?
|
||||||
Wiimote::InitializeMode::DO_WAIT_FOR_WIIMOTES :
|
Wiimote::InitializeMode::DO_WAIT_FOR_WIIMOTES :
|
||||||
Wiimote::InitializeMode::DO_NOT_WAIT_FOR_WIIMOTES);
|
Wiimote::InitializeMode::DO_NOT_WAIT_FOR_WIIMOTES);
|
||||||
else
|
else
|
||||||
|
@ -658,6 +659,7 @@ void EmuThread()
|
||||||
Wiimote::Shutdown();
|
Wiimote::Shutdown();
|
||||||
Keyboard::Shutdown();
|
Keyboard::Shutdown();
|
||||||
Pad::Shutdown();
|
Pad::Shutdown();
|
||||||
|
g_controller_interface.Shutdown();
|
||||||
init_controllers = false;
|
init_controllers = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,11 +23,9 @@ InputConfig* GetConfig()
|
||||||
void Shutdown()
|
void Shutdown()
|
||||||
{
|
{
|
||||||
s_config.ClearControllers();
|
s_config.ClearControllers();
|
||||||
|
|
||||||
g_controller_interface.Shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Initialize(void* const hwnd)
|
void Initialize()
|
||||||
{
|
{
|
||||||
if (s_config.ControllersNeedToBeCreated())
|
if (s_config.ControllersNeedToBeCreated())
|
||||||
{
|
{
|
||||||
|
@ -35,7 +33,6 @@ void Initialize(void* const hwnd)
|
||||||
s_config.CreateController<GCKeyboard>(i);
|
s_config.CreateController<GCKeyboard>(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_controller_interface.Initialize(hwnd);
|
|
||||||
g_controller_interface.RegisterHotplugCallback(LoadConfig);
|
g_controller_interface.RegisterHotplugCallback(LoadConfig);
|
||||||
|
|
||||||
// Load the saved controller config
|
// Load the saved controller config
|
||||||
|
|
|
@ -12,7 +12,7 @@ struct KeyboardStatus;
|
||||||
namespace Keyboard
|
namespace Keyboard
|
||||||
{
|
{
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
void Initialize(void* const hwnd);
|
void Initialize();
|
||||||
void LoadConfig();
|
void LoadConfig();
|
||||||
|
|
||||||
InputConfig* GetConfig();
|
InputConfig* GetConfig();
|
||||||
|
|
|
@ -22,11 +22,9 @@ InputConfig* GetConfig()
|
||||||
void Shutdown()
|
void Shutdown()
|
||||||
{
|
{
|
||||||
s_config.ClearControllers();
|
s_config.ClearControllers();
|
||||||
|
|
||||||
g_controller_interface.Shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Initialize(void* const hwnd)
|
void Initialize()
|
||||||
{
|
{
|
||||||
if (s_config.ControllersNeedToBeCreated())
|
if (s_config.ControllersNeedToBeCreated())
|
||||||
{
|
{
|
||||||
|
@ -34,7 +32,6 @@ void Initialize(void* const hwnd)
|
||||||
s_config.CreateController<GCPad>(i);
|
s_config.CreateController<GCPad>(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_controller_interface.Initialize(hwnd);
|
|
||||||
g_controller_interface.RegisterHotplugCallback(LoadConfig);
|
g_controller_interface.RegisterHotplugCallback(LoadConfig);
|
||||||
|
|
||||||
// Load the saved controller config
|
// Load the saved controller config
|
||||||
|
|
|
@ -13,7 +13,7 @@ struct GCPadStatus;
|
||||||
namespace Pad
|
namespace Pad
|
||||||
{
|
{
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
void Initialize(void* const hwnd);
|
void Initialize();
|
||||||
void LoadConfig();
|
void LoadConfig();
|
||||||
|
|
||||||
InputConfig* GetConfig();
|
InputConfig* GetConfig();
|
||||||
|
|
|
@ -24,11 +24,9 @@ void Shutdown()
|
||||||
s_config.ClearControllers();
|
s_config.ClearControllers();
|
||||||
|
|
||||||
WiimoteReal::Stop();
|
WiimoteReal::Stop();
|
||||||
|
|
||||||
g_controller_interface.Shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Initialize(void* const hwnd, InitializeMode init_mode)
|
void Initialize(InitializeMode init_mode)
|
||||||
{
|
{
|
||||||
if (s_config.ControllersNeedToBeCreated())
|
if (s_config.ControllersNeedToBeCreated())
|
||||||
{
|
{
|
||||||
|
@ -36,7 +34,6 @@ void Initialize(void* const hwnd, InitializeMode init_mode)
|
||||||
s_config.CreateController<WiimoteEmu::Wiimote>(i);
|
s_config.CreateController<WiimoteEmu::Wiimote>(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_controller_interface.Initialize(hwnd);
|
|
||||||
g_controller_interface.RegisterHotplugCallback(LoadConfig);
|
g_controller_interface.RegisterHotplugCallback(LoadConfig);
|
||||||
|
|
||||||
s_config.LoadConfig(false);
|
s_config.LoadConfig(false);
|
||||||
|
|
|
@ -42,7 +42,7 @@ enum class InitializeMode
|
||||||
};
|
};
|
||||||
|
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
void Initialize(void* const hwnd, InitializeMode init_mode);
|
void Initialize(InitializeMode init_mode);
|
||||||
void ResetAllWiimotes();
|
void ResetAllWiimotes();
|
||||||
void LoadConfig();
|
void LoadConfig();
|
||||||
void Resume();
|
void Resume();
|
||||||
|
|
|
@ -182,12 +182,11 @@ bool IsPressed(int Id, bool held)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Initialize(void* const hwnd)
|
void Initialize()
|
||||||
{
|
{
|
||||||
if (s_config.ControllersNeedToBeCreated())
|
if (s_config.ControllersNeedToBeCreated())
|
||||||
s_config.CreateController<HotkeyManager>();
|
s_config.CreateController<HotkeyManager>();
|
||||||
|
|
||||||
g_controller_interface.Initialize(hwnd);
|
|
||||||
g_controller_interface.RegisterHotplugCallback(LoadConfig);
|
g_controller_interface.RegisterHotplugCallback(LoadConfig);
|
||||||
|
|
||||||
// load the saved controller config
|
// load the saved controller config
|
||||||
|
@ -207,8 +206,6 @@ void LoadConfig()
|
||||||
void Shutdown()
|
void Shutdown()
|
||||||
{
|
{
|
||||||
s_config.ClearControllers();
|
s_config.ClearControllers();
|
||||||
|
|
||||||
g_controller_interface.Shutdown();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,7 @@ private:
|
||||||
|
|
||||||
namespace HotkeyManagerEmu
|
namespace HotkeyManagerEmu
|
||||||
{
|
{
|
||||||
void Initialize(void* const hwnd);
|
void Initialize();
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
void LoadConfig();
|
void LoadConfig();
|
||||||
|
|
||||||
|
|
|
@ -333,19 +333,16 @@ bool CFrame::InitControllers()
|
||||||
if (!g_controller_interface.IsInit())
|
if (!g_controller_interface.IsInit())
|
||||||
{
|
{
|
||||||
#if defined(HAVE_X11) && HAVE_X11
|
#if defined(HAVE_X11) && HAVE_X11
|
||||||
Window win = X11Utils::XWindowFromHandle(GetHandle());
|
void* win = reinterpret_cast<void*>(X11Utils::XWindowFromHandle(GetHandle()));
|
||||||
Pad::Initialize(reinterpret_cast<void*>(win));
|
|
||||||
Keyboard::Initialize(reinterpret_cast<void*>(win));
|
|
||||||
Wiimote::Initialize(reinterpret_cast<void*>(win),
|
|
||||||
Wiimote::InitializeMode::DO_NOT_WAIT_FOR_WIIMOTES);
|
|
||||||
HotkeyManagerEmu::Initialize(reinterpret_cast<void*>(win));
|
|
||||||
#else
|
#else
|
||||||
Pad::Initialize(reinterpret_cast<void*>(GetHandle()));
|
void* win = reinterpret_cast<void*>(GetHandle());
|
||||||
Keyboard::Initialize(reinterpret_cast<void*>(GetHandle()));
|
|
||||||
Wiimote::Initialize(reinterpret_cast<void*>(GetHandle()),
|
|
||||||
Wiimote::InitializeMode::DO_NOT_WAIT_FOR_WIIMOTES);
|
|
||||||
HotkeyManagerEmu::Initialize(reinterpret_cast<void*>(GetHandle()));
|
|
||||||
#endif
|
#endif
|
||||||
|
g_controller_interface.Initialize(win);
|
||||||
|
Pad::Initialize();
|
||||||
|
Keyboard::Initialize();
|
||||||
|
Wiimote::Initialize(Wiimote::InitializeMode::DO_NOT_WAIT_FOR_WIIMOTES);
|
||||||
|
HotkeyManagerEmu::Initialize();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -547,6 +544,7 @@ CFrame::~CFrame()
|
||||||
Keyboard::Shutdown();
|
Keyboard::Shutdown();
|
||||||
Pad::Shutdown();
|
Pad::Shutdown();
|
||||||
HotkeyManagerEmu::Shutdown();
|
HotkeyManagerEmu::Shutdown();
|
||||||
|
g_controller_interface.Shutdown();
|
||||||
|
|
||||||
drives.clear();
|
drives.clear();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue