RenShaTurbo.cc 907 B

123456789101112131415161718192021222324252627282930313233
  1. #include "RenShaTurbo.hh"
  2. #include "XMLElement.hh"
  3. #include "Autofire.hh"
  4. #include "MSXException.hh"
  5. #include <memory>
  6. namespace openmsx {
  7. RenShaTurbo::RenShaTurbo(CommandController& commandController,
  8. const XMLElement& machineConfig)
  9. {
  10. if (auto* config = machineConfig.findChild("RenShaTurbo")) {
  11. int min_ints = config->getChildDataAsInt("min_ints", 47);
  12. int max_ints = config->getChildDataAsInt("max_ints", 221);
  13. if ((min_ints < 1) || (min_ints > max_ints) || (max_ints > 6000)) {
  14. throw MSXException(
  15. "Error in RenShaTurbo speed settings: "
  16. "1 <= min_ints <= max_ints <= 6000.");
  17. }
  18. autofire = std::make_unique<Autofire>(
  19. commandController, min_ints, max_ints, "renshaturbo");
  20. }
  21. }
  22. RenShaTurbo::~RenShaTurbo() = default;
  23. bool RenShaTurbo::getSignal(EmuTime::param time)
  24. {
  25. return autofire ? autofire->getSignal(time) : false;
  26. }
  27. } // namespace openmsx