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