[HID] SDL Input PR merge fixes
This commit is contained in:
parent
753d973699
commit
0f5445aa3c
|
@ -43,33 +43,33 @@ std::vector<std::unique_ptr<hid::InputDriver>> CreateInputDrivers(
|
||||||
drivers.emplace_back(xe::hid::nop::Create(window));
|
drivers.emplace_back(xe::hid::nop::Create(window));
|
||||||
} else if (cvars::hid.compare("sdl") == 0) {
|
} else if (cvars::hid.compare("sdl") == 0) {
|
||||||
auto driver = xe::hid::sdl::Create(window);
|
auto driver = xe::hid::sdl::Create(window);
|
||||||
if (XSUCCEEDED(driver->Setup())) {
|
if (XSUCCEEDED(driver->Setup(drivers))) {
|
||||||
drivers.emplace_back(std::move(driver));
|
drivers.emplace_back(std::move(driver));
|
||||||
}
|
}
|
||||||
#if XE_PLATFORM_WIN32
|
#if XE_PLATFORM_WIN32
|
||||||
} else if (cvars::hid.compare("winkey") == 0) {
|
} else if (cvars::hid.compare("winkey") == 0) {
|
||||||
auto driver = xe::hid::winkey::Create(window);
|
auto driver = xe::hid::winkey::Create(window);
|
||||||
if (XSUCCEEDED(driver->Setup())) {
|
if (XSUCCEEDED(driver->Setup(drivers))) {
|
||||||
drivers.emplace_back(std::move(driver));
|
drivers.emplace_back(std::move(driver));
|
||||||
}
|
}
|
||||||
} else if (cvars::hid.compare("xinput") == 0) {
|
} else if (cvars::hid.compare("xinput") == 0) {
|
||||||
auto driver = xe::hid::xinput::Create(window);
|
auto driver = xe::hid::xinput::Create(window);
|
||||||
if (XSUCCEEDED(driver->Setup())) {
|
if (XSUCCEEDED(driver->Setup(drivers))) {
|
||||||
drivers.emplace_back(std::move(driver));
|
drivers.emplace_back(std::move(driver));
|
||||||
}
|
}
|
||||||
#endif // XE_PLATFORM_WIN32
|
#endif // XE_PLATFORM_WIN32
|
||||||
} else {
|
} else {
|
||||||
auto sdl_driver = xe::hid::sdl::Create(window);
|
auto sdl_driver = xe::hid::sdl::Create(window);
|
||||||
if (sdl_driver && XSUCCEEDED(sdl_driver->Setup())) {
|
if (sdl_driver && XSUCCEEDED(sdl_driver->Setup(drivers))) {
|
||||||
drivers.emplace_back(std::move(sdl_driver));
|
drivers.emplace_back(std::move(sdl_driver));
|
||||||
}
|
}
|
||||||
#if XE_PLATFORM_WIN32
|
#if XE_PLATFORM_WIN32
|
||||||
auto xinput_driver = xe::hid::xinput::Create(window);
|
auto xinput_driver = xe::hid::xinput::Create(window);
|
||||||
if (xinput_driver && XSUCCEEDED(xinput_driver->Setup())) {
|
if (xinput_driver && XSUCCEEDED(xinput_driver->Setup(drivers))) {
|
||||||
drivers.emplace_back(std::move(xinput_driver));
|
drivers.emplace_back(std::move(xinput_driver));
|
||||||
}
|
}
|
||||||
auto winkey_driver = xe::hid::winkey::Create(window);
|
auto winkey_driver = xe::hid::winkey::Create(window);
|
||||||
if (winkey_driver && XSUCCEEDED(winkey_driver->Setup())) {
|
if (winkey_driver && XSUCCEEDED(winkey_driver->Setup(drivers))) {
|
||||||
drivers.emplace_back(std::move(winkey_driver));
|
drivers.emplace_back(std::move(winkey_driver));
|
||||||
}
|
}
|
||||||
#endif // XE_PLATFORM_WIN32
|
#endif // XE_PLATFORM_WIN32
|
||||||
|
|
|
@ -51,7 +51,7 @@ SDLInputDriver::~SDLInputDriver() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
X_STATUS SDLInputDriver::Setup() {
|
X_STATUS SDLInputDriver::Setup(std::vector<std::unique_ptr<hid::InputDriver>>& drivers) {
|
||||||
if (!TestSDLVersion()) {
|
if (!TestSDLVersion()) {
|
||||||
return X_STATUS_UNSUCCESSFUL;
|
return X_STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,7 @@ X_STATUS SDLInputDriver::Setup() {
|
||||||
}
|
}
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case SDL_CONTROLLERDEVICEADDED:
|
case SDL_CONTROLLERDEVICEADDED:
|
||||||
|
case SDL_JOYDEVICEADDED:
|
||||||
driver->OnControllerDeviceAdded(event);
|
driver->OnControllerDeviceAdded(event);
|
||||||
break;
|
break;
|
||||||
case SDL_CONTROLLERDEVICEREMOVED:
|
case SDL_CONTROLLERDEVICEREMOVED:
|
||||||
|
|
|
@ -29,7 +29,8 @@ class SDLInputDriver : public InputDriver {
|
||||||
explicit SDLInputDriver(xe::ui::Window* window);
|
explicit SDLInputDriver(xe::ui::Window* window);
|
||||||
~SDLInputDriver() override;
|
~SDLInputDriver() override;
|
||||||
|
|
||||||
X_STATUS Setup() override;
|
X_STATUS Setup(
|
||||||
|
std::vector<std::unique_ptr<hid::InputDriver>>& drivers) override;
|
||||||
|
|
||||||
X_RESULT GetCapabilities(uint32_t user_index, uint32_t flags,
|
X_RESULT GetCapabilities(uint32_t user_index, uint32_t flags,
|
||||||
X_INPUT_CAPABILITIES* out_caps) override;
|
X_INPUT_CAPABILITIES* out_caps) override;
|
||||||
|
|
Loading…
Reference in New Issue