OXYGENHUB
◆ main openmsx / src / RenShaTurbo.cc
1005 B · C++ · last changed chore(): initial commit 1 month ago source blame history raw
1
#include "RenShaTurbo.hh"
2
3
#include "MSXException.hh"
4
#include "XMLElement.hh"
5
6
namespace openmsx {
7
8
RenShaTurbo::RenShaTurbo(MSXMotherBoard& motherBoard,
9
                         const XMLElement& machineConfig)
10
{
11
	if (const auto* config = machineConfig.findChild("RenShaTurbo")) {
12
		int min_ints = config->getChildDataAsInt("min_ints", 47);
13
		int max_ints = config->getChildDataAsInt("max_ints", 221);
14
		if ((min_ints < 1) || (min_ints > max_ints) || (max_ints > 6000)) {
15
			throw MSXException(
16
				"Error in RenShaTurbo speed settings: "
17
				"1 <= min_ints <= max_ints <= 6000.");
18
		}
19
		autofire.emplace(motherBoard, min_ints, max_ints,
20
		                 AutofireID::RENSHATURBO);
21
	}
22
}
23
24
bool RenShaTurbo::getSignal(EmuTime time)
25
{
26
	return autofire ? autofire->getSignal(time) : false;
27
}
28
29
template<typename Archive>
30
void RenShaTurbo::serialize(Archive& ar, unsigned /*version*/)
31
{
32
	if (autofire) ar.serialize("autofire", *autofire);
33
}
34
INSTANTIATE_SERIALIZE_METHODS(RenShaTurbo)
35
36
} // namespace openmsx