Add cemu hook changes related to PR #4609

This commit is contained in:
german 2020-09-04 21:35:42 -05:00
parent 0774b17846
commit 6ee8eab670
8 changed files with 445 additions and 135 deletions

View file

@ -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 <memory>
#include <vector>
#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<Input::MotionDevice> {
public:
State();
~State();
void ReloadUDPClient();
std::vector<Common::ParamPackage> GetInputDevices() const;
explicit UDPMotionFactory(std::shared_ptr<CemuhookUDP::Client> client_);
std::unique_ptr<Input::MotionDevice> 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> client;
std::shared_ptr<UDPMotionFactory> motion_factory;
std::shared_ptr<UDPTouchFactory> touch_factory;
std::shared_ptr<CemuhookUDP::Client> client;
bool polling = false;
};
std::unique_ptr<State> Init();
/// A touch device factory that creates touch devices from udp clients
class UDPTouchFactory final : public Input::Factory<Input::TouchDevice> {
public:
explicit UDPTouchFactory(std::shared_ptr<CemuhookUDP::Client> client_);
} // namespace InputCommon::CemuhookUDP
std::unique_ptr<Input::TouchDevice> 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<CemuhookUDP::Client> client;
bool polling = false;
};
} // namespace InputCommon