openMSX
JoyTap.hh
Go to the documentation of this file.
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
11namespace openmsx {
12
13class PluggingController;
14
22class JoyTap : public JoystickDevice
23{
24public:
26
27 // Pluggable
28 [[nodiscard]] std::string_view getName() const override;
29 [[nodiscard]] std::string_view getDescription() const override;
30 void plugHelper(Connector& connector, EmuTime::param time) override;
31 void unplugHelper(EmuTime::param time) override;
32
33 // JoystickDevice
34 [[nodiscard]] uint8_t read(EmuTime::param time) override;
35 void write(uint8_t value, EmuTime::param time) override;
36
37 template<typename Archive>
38 void serialize(Archive& ar, unsigned version);
39
40protected:
41 void createPorts(std::string_view description, EmuTime::param time);
42
43protected:
44 std::array<std::optional<JoystickPort>, 4> slaves;
46
47private:
48 const std::string name;
49};
50
52
53} // namespace openmsx
54
55#endif
Represents something you can plug devices into.
Definition Connector.hh:21
This device is plugged in into the joy-ports and consolidates several other joysticks plugged into it...
Definition JoyTap.hh:23
void unplugHelper(EmuTime::param time) override
Definition JoyTap.cc:43
void plugHelper(Connector &connector, EmuTime::param time) override
Definition JoyTap.cc:38
uint8_t read(EmuTime::param time) override
Read from the joystick device.
Definition JoyTap.cc:51
std::string_view getDescription() const override
Description for this pluggable.
Definition JoyTap.cc:28
void serialize(Archive &ar, unsigned version)
Definition JoyTap.cc:68
void write(uint8_t value, EmuTime::param time) override
Write a value to the joystick device.
Definition JoyTap.cc:60
std::string_view getName() const override
Name used to identify this pluggable.
Definition JoyTap.cc:33
void createPorts(std::string_view description, EmuTime::param time)
Definition JoyTap.cc:17
std::array< std::optional< JoystickPort >, 4 > slaves
Definition JoyTap.hh:44
PluggingController & pluggingController
Definition JoyTap.hh:45
Central administration of Connectors and Pluggables.
This file implemented 3 utility functions:
Definition Autofire.cc:11
#define REGISTER_BASE_NAME_HELPER(B, N)