mirror of https://github.com/stenzek/duckstation
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
765 B
C
29 lines
765 B
C
6 years ago
|
#pragma once
|
||
|
#include "types.h"
|
||
6 years ago
|
#include <optional>
|
||
|
#include <string_view>
|
||
6 years ago
|
|
||
6 years ago
|
class StateWrapper;
|
||
|
|
||
6 years ago
|
class Controller
|
||
6 years ago
|
{
|
||
|
public:
|
||
6 years ago
|
Controller();
|
||
|
virtual ~Controller();
|
||
6 years ago
|
|
||
6 years ago
|
virtual void Reset();
|
||
|
virtual bool DoState(StateWrapper& sw);
|
||
|
|
||
6 years ago
|
// Resets all state for the transferring to/from the device.
|
||
|
virtual void ResetTransferState();
|
||
|
|
||
6 years ago
|
// Returns the value of ACK, as well as filling out_data.
|
||
|
virtual bool Transfer(const u8 data_in, u8* data_out);
|
||
|
|
||
6 years ago
|
/// Creates a new controller of the specified type.
|
||
6 years ago
|
static std::shared_ptr<Controller> Create(std::string_view type_name);
|
||
6 years ago
|
|
||
|
/// Gets the integer code for a button in the specified controller type.
|
||
|
static std::optional<s32> GetButtonCodeByName(std::string_view type_name, std::string_view button_name);
|
||
|
};
|