openMSX
SETetrisDongle.cc
Go to the documentation of this file.
1 #include "SETetrisDongle.hh"
2 #include "serialize.hh"
3 #include "serialize_meta.hh"
4 
5 namespace openmsx {
6 
8 {
9  status = JOY_UP | JOY_DOWN | JOY_LEFT | JOY_RIGHT |
11 }
12 
13 // Pluggable
14 const std::string& SETetrisDongle::getName() const
15 {
16  static const std::string name = "tetris2-protection";
17  return name;
18 }
19 
20 std::string_view SETetrisDongle::getDescription() const
21 {
22  return "Tetris II Special Edition dongle";
23 }
24 
26  Connector& /*connector*/, EmuTime::param /*time*/)
27 {
28 }
29 
30 void SETetrisDongle::unplugHelper(EmuTime::param /*time*/)
31 {
32 }
33 
34 
35 // JoystickDevice
36 byte SETetrisDongle::read(EmuTime::param /*time*/)
37 {
38  return status;
39 }
40 
41 void SETetrisDongle::write(byte value, EmuTime::param /*time*/)
42 {
43  // Original device used 4 NOR ports
44  // pin4 will be value of pin7
45  if (value & 2) {
46  status |= JOY_RIGHT;
47  } else {
48  status &= ~JOY_RIGHT;
49  }
50 }
51 
52 template<typename Archive>
53 void SETetrisDongle::serialize(Archive& /*ar*/, unsigned /*version*/)
54 {
55  // no need to serialize 'status', port will anyway be re-written
56  // on de-serialize
57 }
60 
61 } // namespace openmsx
openmsx::SETetrisDongle::serialize
void serialize(Archive &ar, unsigned version)
Definition: SETetrisDongle.cc:53
openmsx::SETetrisDongle::read
byte read(EmuTime::param time) override
Read from the joystick device.
Definition: SETetrisDongle.cc:36
serialize.hh
openmsx::SETetrisDongle::write
void write(byte value, EmuTime::param time) override
Write a value to the joystick device.
Definition: SETetrisDongle.cc:41
openmsx::SETetrisDongle::plugHelper
void plugHelper(Connector &connector, EmuTime::param time) override
Definition: SETetrisDongle.cc:25
serialize_meta.hh
openmsx::JoystickDevice::JOY_DOWN
static constexpr int JOY_DOWN
Definition: JoystickDevice.hh:40
openmsx::Pluggable
Definition: Pluggable.hh:12
openmsx::JoystickDevice::JOY_LEFT
static constexpr int JOY_LEFT
Definition: JoystickDevice.hh:41
INSTANTIATE_SERIALIZE_METHODS
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
Definition: serialize.hh:982
openmsx::SETetrisDongle::getDescription
std::string_view getDescription() const override
Description for this pluggable.
Definition: SETetrisDongle.cc:20
openmsx::SETetrisDongle::SETetrisDongle
SETetrisDongle()
Definition: SETetrisDongle.cc:7
openmsx::SETetrisDongle::getName
const std::string & getName() const override
Name used to identify this pluggable.
Definition: SETetrisDongle.cc:14
SETetrisDongle.hh
openmsx::SETetrisDongle
Definition: SETetrisDongle.hh:9
openmsx::SETetrisDongle::unplugHelper
void unplugHelper(EmuTime::param time) override
Definition: SETetrisDongle.cc:30
openmsx::JoystickDevice::JOY_BUTTONB
static constexpr int JOY_BUTTONB
Definition: JoystickDevice.hh:44
openmsx::Connector
Represents something you can plug devices into.
Definition: Connector.hh:21
openmsx::JoystickDevice::JOY_BUTTONA
static constexpr int JOY_BUTTONA
Definition: JoystickDevice.hh:43
openmsx
This file implemented 3 utility functions:
Definition: Autofire.cc:5
openmsx::REGISTER_POLYMORPHIC_INITIALIZER
REGISTER_POLYMORPHIC_INITIALIZER(Pluggable, CassettePlayer, "CassettePlayer")
openmsx::JoystickDevice::JOY_UP
static constexpr int JOY_UP
Definition: JoystickDevice.hh:39
openmsx::JoystickDevice::JOY_RIGHT
static constexpr int JOY_RIGHT
Definition: JoystickDevice.hh:42