From b42c3ce21db249d5e3bc04b4f73202e757da317c Mon Sep 17 00:00:00 2001 From: MonsterDruide1 <5958456@gmail.com> Date: Fri, 18 Jun 2021 16:15:42 +0200 Subject: input_common/tas: Base playback & recording system The base playback system supports up to 8 controllers (specified by `PLAYER_NUMBER` in `tas_input.h`), which all change their inputs simulataneously when `TAS::UpdateThread` is called. The recording system uses the controller debugger to read the state of the first controller and forwards that data to the TASing system for recording. Currently, this process sadly is not frame-perfect and pixel-accurate. Co-authored-by: Naii-the-Baf Co-authored-by: Narr-the-Reg --- src/input_common/tas/tas_poller.h | 43 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/input_common/tas/tas_poller.h (limited to 'src/input_common/tas/tas_poller.h') diff --git a/src/input_common/tas/tas_poller.h b/src/input_common/tas/tas_poller.h new file mode 100644 index 000000000..1bc0d173b --- /dev/null +++ b/src/input_common/tas/tas_poller.h @@ -0,0 +1,43 @@ +// Copyright 2021 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include +#include "core/frontend/input.h" +#include "input_common/tas/tas_input.h" + +namespace InputCommon { + +/** + * A button device factory representing a mouse. It receives mouse events and forward them + * to all button devices it created. + */ +class TasButtonFactory final : public Input::Factory { +public: + explicit TasButtonFactory(std::shared_ptr tas_input_); + + /** + * Creates a button device from a button press + * @param params contains parameters for creating the device: + * - "code": the code of the key to bind with the button + */ + std::unique_ptr Create(const Common::ParamPackage& params) override; + +private: + std::shared_ptr tas_input; +}; + +/// An analog device factory that creates analog devices from mouse +class TasAnalogFactory final : public Input::Factory { +public: + explicit TasAnalogFactory(std::shared_ptr tas_input_); + + std::unique_ptr Create(const Common::ParamPackage& params) override; + +private: + std::shared_ptr tas_input; +}; + +} // namespace InputCommon -- cgit v1.2.3 From 33a1d790e8a5f67c73d0eef4a141f936345f104f Mon Sep 17 00:00:00 2001 From: german77 Date: Mon, 5 Jul 2021 20:58:52 -0500 Subject: input_common/tas: Document the main class --- src/input_common/tas/tas_poller.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/input_common/tas/tas_poller.h') diff --git a/src/input_common/tas/tas_poller.h b/src/input_common/tas/tas_poller.h index 1bc0d173b..09e426cef 100644 --- a/src/input_common/tas/tas_poller.h +++ b/src/input_common/tas/tas_poller.h @@ -11,7 +11,7 @@ namespace InputCommon { /** - * A button device factory representing a mouse. It receives mouse events and forward them + * A button device factory representing a tas bot. It receives tas events and forward them * to all button devices it created. */ class TasButtonFactory final : public Input::Factory { @@ -29,7 +29,7 @@ private: std::shared_ptr tas_input; }; -/// An analog device factory that creates analog devices from mouse +/// An analog device factory that creates analog devices from tas class TasAnalogFactory final : public Input::Factory { public: explicit TasAnalogFactory(std::shared_ptr tas_input_); -- cgit v1.2.3