From 6ee8eab670acfed494ade355d77a32c57f7c9585 Mon Sep 17 00:00:00 2001 From: german Date: Fri, 4 Sep 2020 21:35:42 -0500 Subject: Add cemu hook changes related to PR #4609 --- src/input_common/udp/udp.h | 61 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 18 deletions(-) (limited to 'src/input_common/udp/udp.h') diff --git a/src/input_common/udp/udp.h b/src/input_common/udp/udp.h index 672a5c812..ea3fd4175 100644 --- a/src/input_common/udp/udp.h +++ b/src/input_common/udp/udp.h @@ -1,32 +1,57 @@ -// Copyright 2018 Citra Emulator Project +// Copyright 2020 yuzu Emulator Project // Licensed under GPLv2 or any later version // Refer to the license.txt file included. #pragma once #include -#include -#include "common/param_package.h" +#include "core/frontend/input.h" +#include "input_common/udp/client.h" -namespace InputCommon::CemuhookUDP { +namespace InputCommon { -class Client; -class UDPMotionFactory; -class UDPTouchFactory; - -class State { +/// A motion device factory that creates motion devices from udp clients +class UDPMotionFactory final : public Input::Factory { public: - State(); - ~State(); - void ReloadUDPClient(); - std::vector GetInputDevices() const; + explicit UDPMotionFactory(std::shared_ptr client_); + + std::unique_ptr Create(const Common::ParamPackage& params) override; + + Common::ParamPackage GetNextInput(); + + /// For device input configuration/polling + void BeginConfiguration(); + void EndConfiguration(); + + bool IsPolling() const { + return polling; + } private: - std::unique_ptr client; - std::shared_ptr motion_factory; - std::shared_ptr touch_factory; + std::shared_ptr client; + bool polling = false; }; -std::unique_ptr Init(); +/// A touch device factory that creates touch devices from udp clients +class UDPTouchFactory final : public Input::Factory { +public: + explicit UDPTouchFactory(std::shared_ptr client_); + + std::unique_ptr Create(const Common::ParamPackage& params) override; + + Common::ParamPackage GetNextInput(); + + /// For device input configuration/polling + void BeginConfiguration(); + void EndConfiguration(); + + bool IsPolling() const { + return polling; + } + +private: + std::shared_ptr client; + bool polling = false; +}; -} // namespace InputCommon::CemuhookUDP +} // namespace InputCommon -- cgit v1.2.3