| 1 |
#ifndef JOYTAP_HH |
| 2 |
#define JOYTAP_HH |
| 3 |
|
| 4 |
#include "JoystickDevice.hh" |
| 5 |
#include "JoystickPort.hh" |
| 6 |
#include "serialize_meta.hh" |
| 7 |
#include <array> |
| 8 |
#include <optional> |
| 9 |
#include <string_view> |
| 10 |
|
| 11 |
namespace openmsx { |
| 12 |
|
| 13 |
class PluggingController; |
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
class JoyTap : public JoystickDevice |
| 23 |
{ |
| 24 |
public: |
| 25 |
JoyTap(PluggingController& pluggingController, std::string name); |
| 26 |
|
| 27 |
|
| 28 |
[[nodiscard]] zstring_view getName() const override; |
| 29 |
[[nodiscard]] zstring_view getDescription() const override; |
| 30 |
void plugHelper(Connector& connector, EmuTime time) override; |
| 31 |
void unplugHelper(EmuTime time) override; |
| 32 |
|
| 33 |
|
| 34 |
[[nodiscard]] uint8_t read(EmuTime time) override; |
| 35 |
void write(uint8_t value, EmuTime time) override; |
| 36 |
|
| 37 |
template<typename Archive> |
| 38 |
void serialize(Archive& ar, unsigned version); |
| 39 |
|
| 40 |
protected: |
| 41 |
void createPorts(std::string_view description, EmuTime time); |
| 42 |
|
| 43 |
protected: |
| 44 |
std::array<std::optional<JoystickPort>, 4> slaves; |
| 45 |
PluggingController& pluggingController; |
| 46 |
|
| 47 |
private: |
| 48 |
const std::string name; |
| 49 |
}; |
| 50 |
|
| 51 |
REGISTER_BASE_NAME_HELPER(JoyTap, "JoyTap"); |
| 52 |
|
| 53 |
} |
| 54 |
|
| 55 |
#endif |