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  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  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
openmsx::JoyTap::pluggingController
PluggingController & pluggingController
Definition: JoyTap.hh:43
openmsx::JoyTap::createPorts
void createPorts(const std::string &baseDescription)
Definition: JoyTap.cc:20
openmsx::REGISTER_BASE_NAME_HELPER
REGISTER_BASE_NAME_HELPER(MSXFDC, "FDC")
serialize_meta.hh
openmsx::JoystickDevice
Definition: JoystickDevice.hh:9
openmsx::JoyTap
This device is pluged in into the joyports and consolidates several other joysticks plugged into it.
Definition: JoyTap.hh:20
openmsx::JoyTap::serialize
void serialize(Archive &ar, unsigned version)
Definition: JoyTap.cc:69
JoystickDevice.hh
openmsx::JoyTap::unplugHelper
void unplugHelper(EmuTime::param time) override
Definition: JoyTap.cc:44
openmsx::JoystickPort
JoystickPort
Definition: JoystickPort.cc:68
openmsx::JoyTap::slaves
std::unique_ptr< JoystickPort > slaves[4]
Definition: JoyTap.hh:42
openmsx::JoyTap::getDescription
std::string_view getDescription() const override
Description for this pluggable.
Definition: JoyTap.cc:29
openmsx::JoyTap::plugHelper
void plugHelper(Connector &connector, EmuTime::param time) override
Definition: JoyTap.cc:39
openmsx::JoyTap::read
byte read(EmuTime::param time) override
Read from the joystick device.
Definition: JoyTap.cc:52
openmsx::Connector
Represents something you can plug devices into.
Definition: Connector.hh:20
openmsx::JoyTap::write
void write(byte value, EmuTime::param time) override
Write a value to the joystick device.
Definition: JoyTap.cc:61
openmsx::JoyTap::~JoyTap
~JoyTap() override
openmsx::JoyTap::getName
const std::string & getName() const override
Name used to identify this pluggable.
Definition: JoyTap.cc:34
openmsx::PluggingController
Central administration of Connectors and Pluggables.
Definition: PluggingController.hh:21
openmsx::JoyTap::JoyTap
JoyTap(PluggingController &pluggingController, std::string name)
Definition: JoyTap.cc:12
openmsx
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5