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 "serialize_meta.hh"
6 #include <memory>
7 
8 namespace openmsx {
9 
10 class PluggingController;
11 class JoystickPort;
12 
20 class JoyTap : public JoystickDevice
21 {
22 public:
23  JoyTap(PluggingController& pluggingController, std::string name);
24  ~JoyTap() override;
25 
26  // Pluggable
27  const std::string& getName() const override;
28  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  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 
39 protected:
40  void createPorts(const std::string& baseDescription);
41 
42  std::unique_ptr<JoystickPort> slaves[4];
44 
45 private:
46  const std::string name;
47 };
48 
50 
51 } // namespace openmsx
52 
53 #endif
This device is pluged in into the joyports and consolidates several other joysticks plugged into it...
Definition: JoyTap.hh:20
~JoyTap() override
void plugHelper(Connector &connector, EmuTime::param time) override
Definition: JoyTap.cc:39
void serialize(Archive &ar, unsigned version)
Definition: JoyTap.cc:69
Represents something you can plug devices into.
Definition: Connector.hh:20
REGISTER_BASE_NAME_HELPER(MSXFDC, "FDC")
void createPorts(const std::string &baseDescription)
Definition: JoyTap.cc:20
uint8_t byte
8 bit unsigned integer
Definition: openmsx.hh:26
PluggingController & pluggingController
Definition: JoyTap.hh:43
Central administration of Connectors and Pluggables.
void unplugHelper(EmuTime::param time) override
Definition: JoyTap.cc:44
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
std::unique_ptr< JoystickPort > slaves[4]
Definition: JoyTap.hh:42
This class implements a (close approximation) of the std::string_view class.
Definition: string_view.hh:15
void write(byte value, EmuTime::param time) override
Write a value to the joystick device.
Definition: JoyTap.cc:61
string_view getDescription() const override
Description for this pluggable.
Definition: JoyTap.cc:29
JoyTap(PluggingController &pluggingController, std::string name)
Definition: JoyTap.cc:12
const std::string & getName() const override
Name used to identify this pluggable.
Definition: JoyTap.cc:34
byte read(EmuTime::param time) override
Read from the joystick device.
Definition: JoyTap.cc:52