summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2019-03-21 05:20:49 +0100
committerGitHub <noreply@github.com>2019-03-21 05:20:49 +0100
commit839c0f829b109da8e7c69fe17dd5b054b54a12ac (patch)
tree9b073f88df08681710d89ebd46de1c1b2d79e47a
parentcommon/bit_util: Fix bad merge duplicating the copy constructor (diff)
parentinput_common/sdl: Correct return values within implementations of GetPollers() (diff)
downloadyuzu-839c0f829b109da8e7c69fe17dd5b054b54a12ac.tar
yuzu-839c0f829b109da8e7c69fe17dd5b054b54a12ac.tar.gz
yuzu-839c0f829b109da8e7c69fe17dd5b054b54a12ac.tar.bz2
yuzu-839c0f829b109da8e7c69fe17dd5b054b54a12ac.tar.lz
yuzu-839c0f829b109da8e7c69fe17dd5b054b54a12ac.tar.xz
yuzu-839c0f829b109da8e7c69fe17dd5b054b54a12ac.tar.zst
yuzu-839c0f829b109da8e7c69fe17dd5b054b54a12ac.zip
-rw-r--r--src/input_common/sdl/sdl.h12
-rw-r--r--src/input_common/sdl/sdl_impl.cpp9
-rw-r--r--src/input_common/sdl/sdl_impl.h5
3 files changed, 14 insertions, 12 deletions
diff --git a/src/input_common/sdl/sdl.h b/src/input_common/sdl/sdl.h
index 02a8d2e2c..d7f24c68a 100644
--- a/src/input_common/sdl/sdl.h
+++ b/src/input_common/sdl/sdl.h
@@ -24,17 +24,19 @@ namespace InputCommon::SDL {
class State {
public:
- /// Unresisters SDL device factories and shut them down.
+ using Pollers = std::vector<std::unique_ptr<Polling::DevicePoller>>;
+
+ /// Unregisters SDL device factories and shut them down.
virtual ~State() = default;
- virtual std::vector<std::unique_ptr<InputCommon::Polling::DevicePoller>> GetPollers(
- InputCommon::Polling::DeviceType type) = 0;
+ virtual Pollers GetPollers(Polling::DeviceType type) = 0;
};
class NullState : public State {
public:
- std::vector<std::unique_ptr<InputCommon::Polling::DevicePoller>> GetPollers(
- InputCommon::Polling::DeviceType type) override {}
+ Pollers GetPollers(Polling::DeviceType type) override {
+ return {};
+ }
};
std::unique_ptr<State> Init();
diff --git a/src/input_common/sdl/sdl_impl.cpp b/src/input_common/sdl/sdl_impl.cpp
index 6e8376549..b132d77f5 100644
--- a/src/input_common/sdl/sdl_impl.cpp
+++ b/src/input_common/sdl/sdl_impl.cpp
@@ -650,9 +650,9 @@ private:
};
} // namespace Polling
-std::vector<std::unique_ptr<InputCommon::Polling::DevicePoller>> SDLState::GetPollers(
- InputCommon::Polling::DeviceType type) {
- std::vector<std::unique_ptr<InputCommon::Polling::DevicePoller>> pollers;
+SDLState::Pollers SDLState::GetPollers(InputCommon::Polling::DeviceType type) {
+ Pollers pollers;
+
switch (type) {
case InputCommon::Polling::DeviceType::Analog:
pollers.emplace_back(std::make_unique<Polling::SDLAnalogPoller>(*this));
@@ -660,8 +660,9 @@ std::vector<std::unique_ptr<InputCommon::Polling::DevicePoller>> SDLState::GetPo
case InputCommon::Polling::DeviceType::Button:
pollers.emplace_back(std::make_unique<Polling::SDLButtonPoller>(*this));
break;
- return pollers;
}
+
+ return pollers;
}
} // namespace SDL
diff --git a/src/input_common/sdl/sdl_impl.h b/src/input_common/sdl/sdl_impl.h
index fec82fbe6..2579741d6 100644
--- a/src/input_common/sdl/sdl_impl.h
+++ b/src/input_common/sdl/sdl_impl.h
@@ -25,7 +25,7 @@ public:
/// Initializes and registers SDL device factories
SDLState();
- /// Unresisters SDL device factories and shut them down.
+ /// Unregisters SDL device factories and shut them down.
~SDLState() override;
/// Handle SDL_Events for joysticks from SDL_PollEvent
@@ -35,8 +35,7 @@ public:
std::shared_ptr<SDLJoystick> GetSDLJoystickByGUID(const std::string& guid, int port);
/// Get all DevicePoller that use the SDL backend for a specific device type
- std::vector<std::unique_ptr<InputCommon::Polling::DevicePoller>> GetPollers(
- InputCommon::Polling::DeviceType type) override;
+ Pollers GetPollers(Polling::DeviceType type) override;
/// Used by the Pollers during config
std::atomic<bool> polling = false;