OXYGENHUB
◆ main openmsx / src / input / SETetrisDongle.cc
1.0 KiB · C++ · last changed chore(): initial commit 1 month ago source blame history raw
1
#include "SETetrisDongle.hh"
2
3
#include "serialize.hh"
4
#include "serialize_meta.hh"
5
6
namespace openmsx {
7
8
// Pluggable
9
zstring_view SETetrisDongle::getName() const
10
{
11
	return "tetris2-protection";
12
}
13
14
zstring_view SETetrisDongle::getDescription() const
15
{
16
	return "Tetris II Special Edition dongle";
17
}
18
19
void SETetrisDongle::plugHelper(
20
	Connector& /*connector*/, EmuTime /*time*/)
21
{
22
}
23
24
void SETetrisDongle::unplugHelper(EmuTime /*time*/)
25
{
26
}
27
28
29
// JoystickDevice
30
uint8_t SETetrisDongle::read(EmuTime /*time*/)
31
{
32
	return status;
33
}
34
35
void SETetrisDongle::write(uint8_t value, EmuTime /*time*/)
36
{
37
	// Original device used 4 NOR ports
38
	// pin4 will be value of pin7
39
	if (value & 2) {
40
		status |= JOY_RIGHT;
41
	} else {
42
		status &= ~JOY_RIGHT;
43
	}
44
}
45
46
template<typename Archive>
47
void SETetrisDongle::serialize(Archive& /*ar*/, unsigned /*version*/)
48
{
49
	// no need to serialize 'status', port will anyway be re-written
50
	// on de-serialize
51
}
52
INSTANTIATE_SERIALIZE_METHODS(SETetrisDongle);
53
REGISTER_POLYMORPHIC_INITIALIZER(Pluggable, SETetrisDongle, "SETetrisDongle");
54
55
} // namespace openmsx