openMSX
MSXMotherBoard.cc
Go to the documentation of this file.
1#include "MSXMotherBoard.hh"
2
3#include "BooleanSetting.hh"
5#include "CassettePort.hh"
6#include "Command.hh"
7#include "CommandException.hh"
8#include "ConfigException.hh"
9#include "Debugger.hh"
10#include "DeviceFactory.hh"
11#include "EventDelay.hh"
12#include "EventDistributor.hh"
13#include "FileException.hh"
14#include "GlobalCliComm.hh"
15#include "GlobalSettings.hh"
16#include "HardwareConfig.hh"
17#include "InfoTopic.hh"
18#include "JoystickPort.hh"
19#include "LedStatus.hh"
20#include "MSXCPU.hh"
21#include "MSXCPUInterface.hh"
22#include "MSXCliComm.hh"
24#include "MSXDevice.hh"
25#include "MSXDeviceSwitch.hh"
27#include "MSXMapperIO.hh"
28#include "MSXMixer.hh"
29#include "Observer.hh"
30#include "PanasonicMemory.hh"
31#include "PluggingController.hh"
32#include "Reactor.hh"
33#include "RealTime.hh"
34#include "RenShaTurbo.hh"
35#include "ReverseManager.hh"
36#include "Schedulable.hh"
37#include "Scheduler.hh"
38#include "SimpleDebuggable.hh"
40#include "TclObject.hh"
41#include "XMLElement.hh"
42#include "serialize.hh"
43#include "serialize_stl.hh"
44
45#include "ScopedAssign.hh"
46#include "one_of.hh"
47#include "ranges.hh"
48#include "stl.hh"
49#include "unreachable.hh"
50#include "view.hh"
51
52#include <cassert>
53#include <functional>
54#include <iostream>
55#include <memory>
56
57using std::make_unique;
58using std::string;
59
60namespace openmsx {
61
63{
64public:
65 explicit AddRemoveUpdate(MSXMotherBoard& motherBoard);
71private:
72 MSXMotherBoard& motherBoard;
73};
74
75class ResetCmd final : public RecordedCommand
76{
77public:
78 explicit ResetCmd(MSXMotherBoard& motherBoard);
79 void execute(std::span<const TclObject> tokens, TclObject& result,
80 EmuTime::param time) override;
81 [[nodiscard]] string help(std::span<const TclObject> tokens) const override;
82private:
83 MSXMotherBoard& motherBoard;
84};
85
86class LoadMachineCmd final : public Command
87{
88public:
89 explicit LoadMachineCmd(MSXMotherBoard& motherBoard);
90 void execute(std::span<const TclObject> tokens, TclObject& result) override;
91 [[nodiscard]] string help(std::span<const TclObject> tokens) const override;
92 void tabCompletion(std::vector<string>& tokens) const override;
93private:
94 MSXMotherBoard& motherBoard;
95};
96
97class ListExtCmd final : public Command
98{
99public:
100 explicit ListExtCmd(MSXMotherBoard& motherBoard);
101 void execute(std::span<const TclObject> tokens, TclObject& result) override;
102 [[nodiscard]] string help(std::span<const TclObject> tokens) const override;
103private:
104 MSXMotherBoard& motherBoard;
105};
106
107class RemoveExtCmd final : public RecordedCommand
108{
109public:
110 explicit RemoveExtCmd(MSXMotherBoard& motherBoard);
111 void execute(std::span<const TclObject> tokens, TclObject& result,
112 EmuTime::param time) override;
113 [[nodiscard]] string help(std::span<const TclObject> tokens) const override;
114 void tabCompletion(std::vector<string>& tokens) const override;
115private:
116 MSXMotherBoard& motherBoard;
117};
118
119class MachineNameInfo final : public InfoTopic
120{
121public:
122 explicit MachineNameInfo(MSXMotherBoard& motherBoard);
123 void execute(std::span<const TclObject> tokens,
124 TclObject& result) const override;
125 [[nodiscard]] string help(std::span<const TclObject> tokens) const override;
126private:
127 MSXMotherBoard& motherBoard;
128};
129
130class MachineTypeInfo final : public InfoTopic
131{
132public:
133 explicit MachineTypeInfo(MSXMotherBoard& motherBoard);
134 void execute(std::span<const TclObject> tokens,
135 TclObject& result) const override;
136 [[nodiscard]] string help(std::span<const TclObject> tokens) const override;
137private:
138 MSXMotherBoard& motherBoard;
139};
140
141class MachineExtensionInfo final : public InfoTopic
142{
143public:
144 explicit MachineExtensionInfo(MSXMotherBoard& motherBoard);
145 void execute(std::span<const TclObject> tokens,
146 TclObject& result) const override;
147 [[nodiscard]] string help(std::span<const TclObject> tokens) const override;
148 void tabCompletion(std::vector<string>& tokens) const override;
149private:
150 MSXMotherBoard& motherBoard;
151};
152
153class MachineMediaInfo final : public InfoTopic
154{
155public:
156 explicit MachineMediaInfo(MSXMotherBoard& motherBoard);
158 assert(providers.empty());
159 }
160 void execute(std::span<const TclObject> tokens,
161 TclObject& result) const override;
162 [[nodiscard]] string help(std::span<const TclObject> tokens) const override;
163 void tabCompletion(std::vector<string>& tokens) const override;
164 void registerProvider(std::string_view name, MediaInfoProvider& provider);
166private:
167 struct ProviderInfo {
168 ProviderInfo(std::string_view n, MediaInfoProvider* p)
169 : name(n), provider(p) {} // clang-15 workaround
170 std::string_view name;
171 MediaInfoProvider* provider;
172 };
173 // There will only be a handful of providers, use an unsorted vector.
174 std::vector<ProviderInfo> providers;
175};
176
177class DeviceInfo final : public InfoTopic
178{
179public:
180 explicit DeviceInfo(MSXMotherBoard& motherBoard);
181 void execute(std::span<const TclObject> tokens,
182 TclObject& result) const override;
183 [[nodiscard]] string help(std::span<const TclObject> tokens) const override;
184 void tabCompletion(std::vector<string>& tokens) const override;
185private:
186 MSXMotherBoard& motherBoard;
187};
188
189class FastForwardHelper final : private Schedulable
190{
191public:
192 explicit FastForwardHelper(MSXMotherBoard& motherBoard);
193 void setTarget(EmuTime::param targetTime);
194private:
195 void executeUntil(EmuTime::param time) override;
196 MSXMotherBoard& motherBoard;
197};
198
200{
201public:
202 explicit JoyPortDebuggable(MSXMotherBoard& motherBoard);
203 [[nodiscard]] byte read(unsigned address, EmuTime::param time) override;
204 void write(unsigned address, byte value) override;
205};
206
207class SettingObserver final : public Observer<Setting>
208{
209public:
210 explicit SettingObserver(MSXMotherBoard& motherBoard);
211 void update(const Setting& setting) noexcept override;
212private:
213 MSXMotherBoard& motherBoard;
214};
215
216
217static unsigned machineIDCounter = 0;
218
220 : reactor(reactor_)
221 , machineID(strCat("machine", ++machineIDCounter))
222 , msxCliComm(make_unique<MSXCliComm>(*this, reactor.getGlobalCliComm()))
223 , msxEventDistributor(make_unique<MSXEventDistributor>())
224 , stateChangeDistributor(make_unique<StateChangeDistributor>())
225 , msxCommandController(make_unique<MSXCommandController>(
226 reactor.getGlobalCommandController(), reactor,
227 *this, *msxEventDistributor, machineID))
228 , scheduler(make_unique<Scheduler>())
229 , msxMixer(make_unique<MSXMixer>(
230 reactor.getMixer(), *this,
231 reactor.getGlobalSettings()))
232 , videoSourceSetting(*msxCommandController)
233 , suppressMessagesSetting(*msxCommandController, "suppressmessages",
234 "Suppress info, warning and error messages for this machine. "
235 "Intended use is for scripts that create temporary machines "
236 "of which you don't want to see warning messages about blank "
237 "SRAM content or PSG port directions for instance.",
238 false, Setting::Save::NO)
239 , fastForwardHelper(make_unique<FastForwardHelper>(*this))
240 , settingObserver(make_unique<SettingObserver>(*this))
241 , powerSetting(reactor.getGlobalSettings().getPowerSetting())
242{
243 slotManager = make_unique<CartridgeSlotManager>(*this);
244 reverseManager = make_unique<ReverseManager>(*this);
245 resetCommand = make_unique<ResetCmd>(*this);
246 loadMachineCommand = make_unique<LoadMachineCmd>(*this);
247 listExtCommand = make_unique<ListExtCmd>(*this);
248 extCommand = make_unique<ExtCmd>(*this, "ext");
249 removeExtCommand = make_unique<RemoveExtCmd>(*this);
250 machineNameInfo = make_unique<MachineNameInfo>(*this);
251 machineTypeInfo = make_unique<MachineTypeInfo>(*this);
252 machineExtensionInfo = make_unique<MachineExtensionInfo>(*this);
253 machineMediaInfo = make_unique<MachineMediaInfo>(*this);
254 deviceInfo = make_unique<DeviceInfo>(*this);
255 debugger = make_unique<Debugger>(*this);
256
257 // Do this before machine-specific settings are created, otherwise
258 // a setting-info CliComm message is send with a machine id that hasn't
259 // been announced yet over CliComm.
260 addRemoveUpdate = make_unique<AddRemoveUpdate>(*this);
261
262 // TODO: Initialization of this field cannot be done much earlier because
263 // EventDelay creates a setting, calling getMSXCliComm()
264 // on MSXMotherBoard, so "pimpl" has to be set up already.
265 eventDelay = make_unique<EventDelay>(
266 *scheduler, *msxCommandController,
267 reactor.getEventDistributor(), *msxEventDistributor,
268 *reverseManager);
269 realTime = make_unique<RealTime>(
270 *this, reactor.getGlobalSettings(), *eventDelay);
271
272 powerSetting.attach(*settingObserver);
273 suppressMessagesSetting.attach(*settingObserver);
274}
275
277{
278 suppressMessagesSetting.detach(*settingObserver);
279 powerSetting.detach(*settingObserver);
280 deleteMachine();
281
282 assert(mapperIOCounter == 0);
283 assert(availableDevices.empty());
284 assert(extensions.empty());
285 assert(!machineConfig2);
286 assert(!getMachineConfig());
287}
288
289void MSXMotherBoard::deleteMachine()
290{
291 while (!extensions.empty()) {
292 try {
293 removeExtension(*extensions.back());
294 } catch (MSXException& e) {
295 std::cerr << "Internal error: failed to remove "
296 "extension while deleting a machine: "
297 << e.getMessage() << '\n';
298 assert(false);
299 }
300 }
301
302 machineConfig2.reset();
303 machineConfig = nullptr;
304}
305
307{
308 assert(!getMachineConfig());
309 machineConfig = machineConfig_;
310
311 // make sure the CPU gets instantiated from the main thread
312 assert(!msxCpu);
313 msxCpu = make_unique<MSXCPU>(*this);
314 msxCpuInterface = make_unique<MSXCPUInterface>(*this);
315}
316
317std::string_view MSXMotherBoard::getMachineType() const
318{
319 if (const HardwareConfig* machine = getMachineConfig()) {
320 if (const auto* info = machine->getConfig().findChild("info")) {
321 if (const auto* type = info->findChild("type")) {
322 return type->getData();
323 }
324 }
325 }
326 return "";
327}
328
330{
331 const HardwareConfig* config = getMachineConfig();
332 assert(config);
333 return config->getConfig().getChild("devices").findChild("S1990") != nullptr;
334}
335
337{
338 const HardwareConfig* config = getMachineConfig();
339 assert(config);
340 const XMLElement& devices = config->getConfig().getChild("devices");
341 return devices.findChild("T7775") != nullptr ||
342 devices.findChild("T7937") != nullptr ||
343 devices.findChild("T9763") != nullptr ||
344 devices.findChild("T9769") != nullptr;
345}
346
347string MSXMotherBoard::loadMachine(const string& machine)
348{
349 assert(machineName.empty());
350 assert(extensions.empty());
351 assert(!machineConfig2);
352 assert(!getMachineConfig());
353
354 try {
355 machineConfig2 = HardwareConfig::createMachineConfig(*this, machine);
356 setMachineConfig(machineConfig2.get());
357 } catch (FileException& e) {
358 throw MSXException("Machine \"", machine, "\" not found: ",
359 e.getMessage());
360 } catch (MSXException& e) {
361 throw MSXException("Error in \"", machine, "\" machine: ",
362 e.getMessage());
363 }
364 try {
365 machineConfig->parseSlots();
366 machineConfig->createDevices();
367 } catch (MSXException& e) {
368 throw MSXException("Error in \"", machine, "\" machine: ",
369 e.getMessage());
370 }
371 if (powerSetting.getBoolean()) {
372 powerUp();
373 }
374 machineName = machine;
375 return machineName;
376}
377
378std::unique_ptr<HardwareConfig> MSXMotherBoard::loadExtension(std::string_view name, std::string_view slotName)
379{
380 try {
382 *this, string(name), slotName);
383 } catch (FileException& e) {
384 throw MSXException(
385 "Extension \"", name, "\" not found: ", e.getMessage());
386 } catch (MSXException& e) {
387 throw MSXException(
388 "Error in \"", name, "\" extension: ", e.getMessage());
389 }
390}
391
393 std::string_view name, std::unique_ptr<HardwareConfig> extension)
394{
395 try {
396 extension->parseSlots();
397 extension->createDevices();
398 } catch (MSXException& e) {
399 throw MSXException(
400 "Error in \"", name, "\" extension: ", e.getMessage());
401 }
402 string result = extension->getName();
403 extensions.push_back(std::move(extension));
405 return result;
406}
407
408HardwareConfig* MSXMotherBoard::findExtension(std::string_view extensionName)
409{
410 auto it = ranges::find(extensions, extensionName, &HardwareConfig::getName);
411 return (it != end(extensions)) ? it->get() : nullptr;
412}
413
415{
416 extension.testRemove();
418 auto it = rfind_unguarded(extensions, &extension,
419 [](auto& e) { return e.get(); });
420 extensions.erase(it);
421}
422
424{
425 return *msxCliComm;
426}
427
429{
430 assert(getMachineConfig()); // needed for PluggableFactory::createAll()
431 if (!pluggingController) {
432 pluggingController = make_unique<PluggingController>(*this);
433 }
434 return *pluggingController;
435}
436
438{
439 assert(getMachineConfig()); // because CPU needs to know if we're
440 // emulating turbor or not
441 return *msxCpu;
442}
443
445{
446 assert(getMachineConfig());
447 return *msxCpuInterface;
448}
449
451{
452 if (!panasonicMemory) {
453 panasonicMemory = make_unique<PanasonicMemory>(*this);
454 }
455 return *panasonicMemory;
456}
457
459{
460 if (!deviceSwitch) {
462 }
463 return *deviceSwitch;
464}
465
467{
468 if (!cassettePort) {
469 assert(getMachineConfig());
470 if (getMachineConfig()->getConfig().findChild("CassettePort")) {
471 cassettePort = make_unique<CassettePort>(*getMachineConfig());
472 } else {
473 cassettePort = make_unique<DummyCassettePort>();
474 }
475 }
476 return *cassettePort;
477}
478
480{
481 assert(port < 2);
482 if (!joystickPort[0]) {
483 assert(getMachineConfig());
484 // some MSX machines only have 1 instead of 2 joystick ports
485 std::string_view ports = getMachineConfig()->getConfig().getChildData(
486 "JoystickPorts", "AB");
487 if (ports != one_of("AB", "", "A", "B")) {
488 throw ConfigException(
489 "Invalid JoystickPorts specification, "
490 "should be one of '', 'A', 'B' or 'AB'.");
491 }
493 if (ports == one_of("AB", "A")) {
494 joystickPort[0] = make_unique<JoystickPort>(
495 ctrl, "joyporta", "MSX Joystick port A");
496 } else {
497 joystickPort[0] = make_unique<DummyJoystickPort>();
498 }
499 if (ports == one_of("AB", "B")) {
500 joystickPort[1] = make_unique<JoystickPort>(
501 ctrl, "joyportb", "MSX Joystick port B");
502 } else {
503 joystickPort[1] = make_unique<DummyJoystickPort>();
504 }
505 joyPortDebuggable = make_unique<JoyPortDebuggable>(*this);
506 }
507 return *joystickPort[port];
508}
509
511{
512 if (!renShaTurbo) {
513 assert(getMachineConfig());
514 renShaTurbo = make_unique<RenShaTurbo>(
515 *this,
516 getMachineConfig()->getConfig());
517 }
518 return *renShaTurbo;
519}
520
522{
523 if (!ledStatus) {
524 (void)getMSXCliComm(); // force init, to be on the safe side
525 ledStatus = make_unique<LedStatus>(
526 reactor.getRTScheduler(),
527 *msxCommandController,
528 *msxCliComm);
529 }
530 return *ledStatus;
531}
532
534{
535 return *msxCommandController;
536}
537
539{
540 return msxCommandController->getMachineInfoCommand();
541}
542
543EmuTime::param MSXMotherBoard::getCurrentTime() const
544{
545 return scheduler->getCurrentTime();
546}
547
549{
550 if (!powered) {
551 return false;
552 }
553 assert(getMachineConfig()); // otherwise powered cannot be true
554
555 getCPU().execute(false);
556 return true;
557}
558
559void MSXMotherBoard::fastForward(EmuTime::param time, bool fast)
560{
561 assert(powered);
562 assert(getMachineConfig());
563
564 if (time <= getCurrentTime()) return;
565
566 ScopedAssign sa(fastForwarding, fast);
567 realTime->disable();
568 msxMixer->mute();
569 fastForwardHelper->setTarget(time);
570 while (time > getCurrentTime()) {
571 // note: this can run (slightly) past the requested time
572 getCPU().execute(true); // fast-forward mode
573 }
574 realTime->enable();
575 msxMixer->unmute();
576}
577
579{
580 if (getMachineConfig()) {
581 getCPU().setPaused(true);
582 }
583 msxMixer->mute();
584}
585
587{
588 if (getMachineConfig()) {
589 getCPU().setPaused(false);
590 }
591 msxMixer->unmute();
592}
593
595{
596 availableDevices.push_back(&device);
597}
598
600{
601 move_pop_back(availableDevices, rfind_unguarded(availableDevices, &device));
602}
603
605{
606 if (!powered) return;
607 assert(getMachineConfig());
608
609 EmuTime::param time = getCurrentTime();
611 for (auto& d : availableDevices) {
612 d->reset(time);
613 }
614 getCPU().doReset(time);
615 // let everyone know we're booting, note that the fact that this is
616 // done after the reset call to the devices is arbitrary here
618}
619
621{
622 byte result = 0xff;
623 for (auto& d : availableDevices) {
624 result &= d->readIRQVector();
625 }
626 return result;
627}
628
630{
631 if (powered) return;
632 if (!getMachineConfig()) return;
633
634 powered = true;
635 // TODO: If our "powered" field is always equal to the power setting,
636 // there is not really a point in keeping it.
637 // TODO: assert disabled see note in Reactor::run() where this method
638 // is called
639 //assert(powerSetting.getBoolean() == powered);
640 powerSetting.setBoolean(true);
641 // TODO: We could make the power LED a device, so we don't have to handle
642 // it separately here.
644
645 EmuTime::param time = getCurrentTime();
647 for (auto& d : availableDevices) {
648 d->powerUp(time);
649 }
650 getCPU().doReset(time);
651 msxMixer->unmute();
652 // let everyone know we're booting, note that the fact that this is
653 // done after the reset call to the devices is arbitrary here
655}
656
657void MSXMotherBoard::powerDown()
658{
659 if (!powered) return;
660
661 powered = false;
662 // TODO: This assertion fails in 1 case: when quitting with a running MSX.
663 // How do we want the Reactor to shutdown: immediately or after
664 // handling all pending commands/events/updates?
665 //assert(powerSetting.getBoolean() == powered);
666 powerSetting.setBoolean(false);
668
669 msxMixer->mute();
670
671 EmuTime::param time = getCurrentTime();
672 for (auto& d : availableDevices) {
673 d->powerDown(time);
674 }
675}
676
677void MSXMotherBoard::activate(bool active_)
678{
679 active = active_;
680 auto event = active ? Event(MachineActivatedEvent())
682 msxEventDistributor->distributeEvent(event, scheduler->getCurrentTime());
683 if (active) {
684 realTime->resync();
685 }
686}
687
694
699
701{
702 auto it = ranges::find(availableDevices, name, &MSXDevice::getName);
703 return (it != end(availableDevices)) ? *it : nullptr;
704}
705
707{
708 if (mapperIOCounter == 0) {
710
711 MSXCPUInterface& cpuInterface = getCPUInterface();
712 for (auto port : {0xfc, 0xfd, 0xfe, 0xff}) {
713 cpuInterface.register_IO_Out(narrow_cast<byte>(port), mapperIO.get());
714 cpuInterface.register_IO_In (narrow_cast<byte>(port), mapperIO.get());
715 }
716 }
717 ++mapperIOCounter;
718 return *mapperIO;
719}
720
722{
723 assert(mapperIO);
724 assert(mapperIOCounter);
725 --mapperIOCounter;
726 if (mapperIOCounter == 0) {
727 MSXCPUInterface& cpuInterface = getCPUInterface();
728 for (auto port : {0xfc, 0xfd, 0xfe, 0xff}) {
729 cpuInterface.unregister_IO_Out(narrow_cast<byte>(port), mapperIO.get());
730 cpuInterface.unregister_IO_In (narrow_cast<byte>(port), mapperIO.get());
731 }
732
733 mapperIO.reset();
734 }
735}
736
737string MSXMotherBoard::getUserName(const string& hwName)
738{
739 auto& s = userNames[hwName];
740 unsigned n = 0;
741 string userName;
742 do {
743 userName = strCat("untitled", ++n);
744 } while (contains(s, userName));
745 s.push_back(userName);
746 return userName;
747}
748
749void MSXMotherBoard::freeUserName(const string& hwName, const string& userName)
750{
751 auto& s = userNames[hwName];
752 move_pop_back(s, rfind_unguarded(s, userName));
753}
754
755void MSXMotherBoard::registerMediaInfo(std::string_view name, MediaInfoProvider& provider)
756{
757 machineMediaInfo->registerProvider(name, provider);
758}
759
761{
762 machineMediaInfo->unregisterProvider(provider);
763}
764
765
766// AddRemoveUpdate
767
769 : motherBoard(motherBoard_)
770{
771 motherBoard.getReactor().getGlobalCliComm().update(
772 CliComm::UpdateType::HARDWARE, motherBoard.getMachineID(), "add");
773}
774
780
781
782// ResetCmd
784 : RecordedCommand(motherBoard_.getCommandController(),
785 motherBoard_.getStateChangeDistributor(),
786 motherBoard_.getScheduler(),
787 "reset")
788 , motherBoard(motherBoard_)
789{
790}
791
792void ResetCmd::execute(std::span<const TclObject> /*tokens*/, TclObject& /*result*/,
793 EmuTime::param /*time*/)
794{
795 motherBoard.doReset();
796}
797
798string ResetCmd::help(std::span<const TclObject> /*tokens*/) const
799{
800 return "Resets the MSX.";
801}
802
803
804// LoadMachineCmd
806 : Command(motherBoard_.getCommandController(), "load_machine")
807 , motherBoard(motherBoard_)
808{
809 // The load_machine command should always directly follow a
810 // create_machine command:
811 // - It's not allowed to use load_machine on a machine that has
812 // already a machine configuration loaded earlier.
813 // - We also disallow executing most machine-specific commands on an
814 // 'empty machine' (an 'empty machine', is a machine returned by
815 // create_machine before the load_machine command is executed, so a
816 // machine without a machine configuration). The only exception is
817 // this load_machine command and machine_info.
818 //
819 // So if the only allowed command on an empty machine is
820 // 'load_machine', (and an empty machine by itself isn't very useful),
821 // then why isn't create_machine and load_machine merged into a single
822 // command? The only reason for this is that load_machine sends out
823 // events (machine specific) and maybe you already want to know the ID
824 // of the new machine (this is returned by create_machine) before those
825 // events will be send.
826 //
827 // Why not allow all commands on an empty machine? In the past we did
828 // allow this, though it often was the source of bugs. We could in each
829 // command (when needed) check for an empty machine and then return
830 // some dummy/empty result or some error. But because I can't think of
831 // any really useful command for an empty machine, it seemed easier to
832 // just disallow most commands.
834}
835
836void LoadMachineCmd::execute(std::span<const TclObject> tokens, TclObject& result)
837{
838 checkNumArgs(tokens, 2, "machine");
839 if (motherBoard.getMachineConfig()) {
840 throw CommandException("Already loaded a config in this machine.");
841 }
842 result = motherBoard.loadMachine(string(tokens[1].getString()));
843}
844
845string LoadMachineCmd::help(std::span<const TclObject> /*tokens*/) const
846{
847 return "Load a msx machine configuration into an empty machine.";
848}
849
850void LoadMachineCmd::tabCompletion(std::vector<string>& tokens) const
851{
852 completeString(tokens, Reactor::getHwConfigs("machines"));
853}
854
855
856// ListExtCmd
858 : Command(motherBoard_.getCommandController(), "list_extensions")
859 , motherBoard(motherBoard_)
860{
861}
862
863void ListExtCmd::execute(std::span<const TclObject> /*tokens*/, TclObject& result)
864{
865 result.addListElements(
867}
868
869string ListExtCmd::help(std::span<const TclObject> /*tokens*/) const
870{
871 return "Return a list of all inserted extensions.";
872}
873
874
875// ExtCmd
876ExtCmd::ExtCmd(MSXMotherBoard& motherBoard_, std::string commandName_)
877 : RecordedCommand(motherBoard_.getCommandController(),
878 motherBoard_.getStateChangeDistributor(),
879 motherBoard_.getScheduler(),
880 commandName_)
881 , motherBoard(motherBoard_)
882 , commandName(std::move(commandName_))
883{
884}
885
886void ExtCmd::execute(std::span<const TclObject> tokens, TclObject& result,
887 EmuTime::param /*time*/)
888{
889 checkNumArgs(tokens, Between{2, 3}, "extension");
890 if (tokens.size() == 3 && tokens[1].getString() != "insert") {
891 throw SyntaxError();
892 }
893 try {
894 auto name = tokens[tokens.size() - 1].getString();
895 auto slotName = (commandName.size() == 4)
896 ? std::string_view(&commandName[3], 1)
897 : "any";
898 auto extension = motherBoard.loadExtension(name, slotName);
899 if (slotName != "any") {
900 const auto& manager = motherBoard.getSlotManager();
901 if (const auto* extConf = manager.getConfigForSlot(commandName[3] - 'a')) {
902 // still a cartridge inserted, (try to) remove it now
903 motherBoard.removeExtension(*extConf);
904 }
905 }
906 result = motherBoard.insertExtension(name, std::move(extension));
907 } catch (MSXException& e) {
908 throw CommandException(std::move(e).getMessage());
909 }
910}
911
912string ExtCmd::help(std::span<const TclObject> /*tokens*/) const
913{
914 return "Insert a hardware extension.";
915}
916
917void ExtCmd::tabCompletion(std::vector<string>& tokens) const
918{
919 completeString(tokens, Reactor::getHwConfigs("extensions"));
920}
921
922
923// RemoveExtCmd
925 : RecordedCommand(motherBoard_.getCommandController(),
926 motherBoard_.getStateChangeDistributor(),
927 motherBoard_.getScheduler(),
928 "remove_extension")
929 , motherBoard(motherBoard_)
930{
931}
932
933void RemoveExtCmd::execute(std::span<const TclObject> tokens, TclObject& /*result*/,
934 EmuTime::param /*time*/)
935{
936 checkNumArgs(tokens, 2, "extension");
937 std::string_view extName = tokens[1].getString();
938 HardwareConfig* extension = motherBoard.findExtension(extName);
939 if (!extension) {
940 throw CommandException("No such extension: ", extName);
941 }
942 try {
943 motherBoard.removeExtension(*extension);
944 } catch (MSXException& e) {
945 throw CommandException("Can't remove extension '", extName,
946 "': ", e.getMessage());
947 }
948}
949
950string RemoveExtCmd::help(std::span<const TclObject> /*tokens*/) const
951{
952 return "Remove an extension from the MSX machine.";
953}
954
955void RemoveExtCmd::tabCompletion(std::vector<string>& tokens) const
956{
957 if (tokens.size() == 2) {
959 motherBoard.getExtensions(),
960 [](auto& e) -> std::string_view { return e->getName(); }));
961 }
962}
963
964
965// MachineNameInfo
966
968 : InfoTopic(motherBoard_.getMachineInfoCommand(), "config_name")
969 , motherBoard(motherBoard_)
970{
971}
972
973void MachineNameInfo::execute(std::span<const TclObject> /*tokens*/,
974 TclObject& result) const
975{
976 result = motherBoard.getMachineName();
977}
978
979string MachineNameInfo::help(std::span<const TclObject> /*tokens*/) const
980{
981 return "Returns the configuration name for this machine.";
982}
983
984// MachineTypeInfo
985
987 : InfoTopic(motherBoard_.getMachineInfoCommand(), "type")
988 , motherBoard(motherBoard_)
989{
990}
991
992void MachineTypeInfo::execute(std::span<const TclObject> /*tokens*/,
993 TclObject& result) const
994{
995 result = motherBoard.getMachineType();
996}
997
998string MachineTypeInfo::help(std::span<const TclObject> /*tokens*/) const
999{
1000 return "Returns the machine type for this machine.";
1001}
1002
1003
1004// MachineExtensionInfo
1005
1007 : InfoTopic(motherBoard_.getMachineInfoCommand(), "extension")
1008 , motherBoard(motherBoard_)
1009{
1010}
1011
1012void MachineExtensionInfo::execute(std::span<const TclObject> tokens,
1013 TclObject& result) const
1014{
1015 checkNumArgs(tokens, Between{2, 3}, Prefix{2}, "?extension-instance-name?");
1016 if (tokens.size() == 2) {
1017 result.addListElements(
1019 } else if (tokens.size() == 3) {
1020 std::string_view extName = tokens[2].getString();
1021 const HardwareConfig* extension = motherBoard.findExtension(extName);
1022 if (!extension) {
1023 throw CommandException("No such extension: ", extName);
1024 }
1025 if (extension->getType() == HardwareConfig::Type::EXTENSION) {
1026 // A 'true' extension, as specified in an XML file
1027 result.addDictKeyValue("config", extension->getConfigName());
1028 } else {
1029 assert(extension->getType() == HardwareConfig::Type::ROM);
1030 // A ROM cartridge, peek into the internal config for the original filename
1031 const auto& filename = extension->getConfig()
1032 .getChild("devices").getChild("primary").getChild("secondary")
1033 .getChild("ROM").getChild("rom").getChildData("filename");
1034 result.addDictKeyValue("rom", filename);
1035 }
1036 TclObject deviceList;
1037 deviceList.addListElements(
1039 result.addDictKeyValue("devices", deviceList);
1040 }
1041}
1042
1043string MachineExtensionInfo::help(std::span<const TclObject> /*tokens*/) const
1044{
1045 return "Returns information about the given extension instance.";
1046}
1047
1048void MachineExtensionInfo::tabCompletion(std::vector<string>& tokens) const
1049{
1050 if (tokens.size() == 3) {
1052 motherBoard.getExtensions(),
1053 [](auto& e) -> std::string_view { return e->getName(); }));
1054 }
1055}
1056
1057
1058// MachineMediaInfo
1059
1061 : InfoTopic(motherBoard_.getMachineInfoCommand(), "media")
1062{
1063}
1064
1065void MachineMediaInfo::execute(std::span<const TclObject> tokens,
1066 TclObject& result) const
1067{
1068 checkNumArgs(tokens, Between{2, 3}, Prefix{2}, "?media-slot-name?");
1069 if (tokens.size() == 2) {
1070 result.addListElements(
1071 view::transform(providers, &ProviderInfo::name));
1072 } else if (tokens.size() == 3) {
1073 auto name = tokens[2].getString();
1074 if (auto it = ranges::find(providers, name, &ProviderInfo::name);
1075 it != providers.end()) {
1076 it->provider->getMediaInfo(result);
1077 } else {
1078 throw CommandException("No info about media slot ", name);
1079 }
1080 }
1081}
1082
1083string MachineMediaInfo::help(std::span<const TclObject> /*tokens*/) const
1084{
1085 return "Returns information about the given media slot.";
1086}
1087
1088void MachineMediaInfo::tabCompletion(std::vector<string>& tokens) const
1089{
1090 if (tokens.size() == 3) {
1092 providers, &ProviderInfo::name));
1093 }
1094}
1095
1096void MachineMediaInfo::registerProvider(std::string_view name, MediaInfoProvider& provider)
1097{
1098 assert(!contains(providers, name, &ProviderInfo::name));
1099 assert(!contains(providers, &provider, &ProviderInfo::provider));
1100 providers.emplace_back(name, &provider);
1101}
1102
1104{
1105 move_pop_back(providers,
1106 rfind_unguarded(providers, &provider, &ProviderInfo::provider));
1107}
1108
1109// DeviceInfo
1110
1112 : InfoTopic(motherBoard_.getMachineInfoCommand(), "device")
1113 , motherBoard(motherBoard_)
1114{
1115}
1116
1117void DeviceInfo::execute(std::span<const TclObject> tokens, TclObject& result) const
1118{
1119 checkNumArgs(tokens, Between{2, 3}, Prefix{2}, "?device?");
1120 switch (tokens.size()) {
1121 case 2:
1122 result.addListElements(
1123 view::transform(motherBoard.availableDevices,
1124 [](auto& d) { return d->getName(); }));
1125 break;
1126 case 3: {
1127 std::string_view deviceName = tokens[2].getString();
1128 const MSXDevice* device = motherBoard.findDevice(deviceName);
1129 if (!device) {
1130 throw CommandException("No such device: ", deviceName);
1131 }
1132 device->getDeviceInfo(result);
1133 break;
1134 }
1135 }
1136}
1137
1138string DeviceInfo::help(std::span<const TclObject> /*tokens*/) const
1139{
1140 return "Without any arguments, returns the list of used device names.\n"
1141 "With a device name as argument, returns the type (and for some "
1142 "devices the subtype) of the given device.";
1143}
1144
1145void DeviceInfo::tabCompletion(std::vector<string>& tokens) const
1146{
1147 if (tokens.size() == 3) {
1149 motherBoard.availableDevices,
1150 [](auto& d) -> std::string_view { return d->getName(); }));
1151 }
1152}
1153
1154
1155// FastForwardHelper
1156
1158 : Schedulable(motherBoard_.getScheduler())
1159 , motherBoard(motherBoard_)
1160{
1161}
1162
1163void FastForwardHelper::setTarget(EmuTime::param targetTime)
1164{
1165 setSyncPoint(targetTime);
1166}
1167
1168void FastForwardHelper::executeUntil(EmuTime::param /*time*/)
1169{
1170 motherBoard.exitCPULoopSync();
1171}
1172
1173
1174// class JoyPortDebuggable
1175
1177 : SimpleDebuggable(motherBoard_, "joystickports", "MSX Joystick Ports", 2)
1178{
1179}
1180
1181byte JoyPortDebuggable::read(unsigned address, EmuTime::param time)
1182{
1183 return getMotherBoard().getJoystickPort(address).read(time);
1184}
1185
1186void JoyPortDebuggable::write(unsigned /*address*/, byte /*value*/)
1187{
1188 // ignore
1189}
1190
1191
1192// class SettingObserver
1193
1195 : motherBoard(motherBoard_)
1196{
1197}
1198
1200{
1201 if (&setting == &motherBoard.powerSetting) {
1202 if (motherBoard.powerSetting.getBoolean()) {
1203 motherBoard.powerUp();
1204 } else {
1205 motherBoard.powerDown();
1206 }
1207 } else if (&setting == &motherBoard.suppressMessagesSetting) {
1208 motherBoard.msxCliComm->setSuppressMessages(motherBoard.suppressMessagesSetting.getBoolean());
1209 } else {
1211 }
1212}
1213
1214
1215// serialize
1216// version 1: initial version
1217// version 2: added reRecordCount
1218// version 3: removed reRecordCount (moved to ReverseManager)
1219// version 4: moved joystickportA/B from MSXPSG to here
1220// version 5: do serialize renShaTurbo
1221template<typename Archive>
1222void MSXMotherBoard::serialize(Archive& ar, unsigned version)
1223{
1224 // don't serialize:
1225 // machineID, userNames, availableDevices, addRemoveUpdate,
1226 // sharedStuffMap, msxCliComm, msxEventDistributor,
1227 // msxCommandController, slotManager, eventDelay,
1228 // debugger, msxMixer, panasonicMemory, ledStatus
1229
1230 // Scheduler must come early so that devices can query current time
1231 ar.serialize("scheduler", *scheduler);
1232 // MSXMixer has already set sync points, those are invalid now
1233 // the following call will fix this
1234 if constexpr (Archive::IS_LOADER) {
1235 msxMixer->reInit();
1236 }
1237
1238 ar.serialize("name", machineName);
1239 ar.serializeWithID("config", machineConfig2, std::ref(*this));
1240 assert(getMachineConfig() == machineConfig2.get());
1241 ar.serializeWithID("extensions", extensions, std::ref(*this));
1242
1243 if (mapperIO) ar.serialize("mapperIO", *mapperIO);
1244
1245 if (auto& devSwitch = getDeviceSwitch();
1246 devSwitch.hasRegisteredDevices()) {
1247 ar.serialize("deviceSwitch", devSwitch);
1248 }
1249
1250 if (getMachineConfig()) {
1251 ar.serialize("cpu", getCPU());
1252 }
1253 ar.serialize("cpuInterface", getCPUInterface());
1254
1255 if (auto* port = dynamic_cast<CassettePort*>(&getCassettePort())) {
1256 ar.serialize("cassetteport", *port);
1257 }
1258 if (ar.versionAtLeast(version, 4)) {
1259 if (auto* port = dynamic_cast<JoystickPort*>(
1260 joystickPort[0].get())) {
1261 ar.serialize("joystickportA", *port);
1262 }
1263 if (auto* port = dynamic_cast<JoystickPort*>(
1264 joystickPort[1].get())) {
1265 ar.serialize("joystickportB", *port);
1266 }
1267 }
1268 if (ar.versionAtLeast(version, 5)) {
1269 if (renShaTurbo) ar.serialize("renShaTurbo", *renShaTurbo);
1270 }
1271
1272 if constexpr (Archive::IS_LOADER) {
1273 powered = true; // must come before changing power setting
1274 powerSetting.setBoolean(true);
1276 msxMixer->unmute();
1277 }
1278
1279 if (version == 2) {
1280 assert(Archive::IS_LOADER);
1281 unsigned reRecordCount = 0; // silence warning
1282 ar.serialize("reRecordCount", reRecordCount);
1283 getReverseManager().setReRecordCount(reRecordCount);
1284 }
1285}
1287
1288} // namespace openmsx
BaseSetting * setting
Assign new value to some variable and restore the original value when this object goes out of scope.
AddRemoveUpdate(const AddRemoveUpdate &)=delete
AddRemoveUpdate & operator=(AddRemoveUpdate &&)=delete
AddRemoveUpdate(MSXMotherBoard &motherBoard)
AddRemoveUpdate(AddRemoveUpdate &&)=delete
AddRemoveUpdate & operator=(const AddRemoveUpdate &)=delete
bool getBoolean() const noexcept
Sent when the MSX resets or powers up.
Definition Event.hh:370
void setAllowedInEmptyMachine(bool value)
Definition Command.hh:67
static void completeString(std::vector< std::string > &tokens, ITER begin, ITER end, bool caseSensitive=true)
Definition Completer.hh:138
void checkNumArgs(std::span< const TclObject > tokens, unsigned exactly, const char *errMessage) const
Definition Completer.cc:181
static std::unique_ptr< MSXDeviceSwitch > createDeviceSwitch(const HardwareConfig &hwConf)
static std::unique_ptr< MSXMapperIO > createMapperIO(const HardwareConfig &hwConf)
DeviceInfo(MSXMotherBoard &motherBoard)
void execute(std::span< const TclObject > tokens, TclObject &result) const override
Show info on this topic.
string help(std::span< const TclObject > tokens) const override
Print help for this topic.
void tabCompletion(std::vector< string > &tokens) const override
Attempt tab completion for this command.
void distributeEvent(Event &&event)
Schedule the given event for delivery.
void tabCompletion(std::vector< std::string > &tokens) const override
Attempt tab completion for this command.
ExtCmd(MSXMotherBoard &motherBoard, std::string commandName)
void execute(std::span< const TclObject > tokens, TclObject &result, EmuTime::param time) override
This is like the execute() method of the Command class, it only has an extra time parameter.
std::string help(std::span< const TclObject > tokens) const override
Print help for this command.
void setTarget(EmuTime::param targetTime)
FastForwardHelper(MSXMotherBoard &motherBoard)
void update(UpdateType type, std::string_view name, std::string_view value) override
const std::string & getConfigName() const
static std::unique_ptr< HardwareConfig > createMachineConfig(MSXMotherBoard &motherBoard, std::string machineName)
const auto & getDevices() const
const std::string & getName() const
const XMLElement & getConfig() const
static std::unique_ptr< HardwareConfig > createExtensionConfig(MSXMotherBoard &motherBoard, std::string extensionName, std::string_view slotName)
void testRemove() const
Checks whether this HardwareConfig can be deleted.
void write(unsigned address, byte value) override
JoyPortDebuggable(MSXMotherBoard &motherBoard)
byte read(unsigned address, EmuTime::param time) override
virtual uint8_t read(EmuTime::param time)=0
void setLed(Led led, bool status)
Definition LedStatus.cc:44
void execute(std::span< const TclObject > tokens, TclObject &result) override
Execute this command.
ListExtCmd(MSXMotherBoard &motherBoard)
string help(std::span< const TclObject > tokens) const override
Print help for this command.
LoadMachineCmd(MSXMotherBoard &motherBoard)
string help(std::span< const TclObject > tokens) const override
Print help for this command.
void execute(std::span< const TclObject > tokens, TclObject &result) override
Execute this command.
void tabCompletion(std::vector< string > &tokens) const override
Attempt tab completion for this command.
void register_IO_Out(byte port, MSXDevice *device)
Devices can register their Out ports.
void register_IO_In(byte port, MSXDevice *device)
Devices can register their In ports.
void unregister_IO_In(byte port, MSXDevice *device)
void reset()
Reset (the slot state)
void unregister_IO_Out(byte port, MSXDevice *device)
void exitCPULoopSync()
See CPUCore::exitCPULoopSync()
Definition MSXCPU.cc:126
void doReset(EmuTime::param time)
Reset CPU.
Definition MSXCPU.cc:80
void setPaused(bool paused)
(un)pause CPU.
Definition MSXCPU.cc:365
void exitCPULoopAsync()
See CPUCore::exitCPULoopAsync()
Definition MSXCPU.cc:131
void update(UpdateType type, std::string_view name, std::string_view value) override
Definition MSXCliComm.cc:21
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition MSXDevice.hh:36
void getDeviceInfo(TclObject &result) const
Get device info.
Definition MSXDevice.cc:385
virtual const std::string & getName() const
Returns a human-readable name for this device.
Definition MSXDevice.cc:375
HardwareConfig * findExtension(std::string_view extensionName)
PluggingController & getPluggingController()
void activate(bool active)
void setMachineConfig(HardwareConfig *machineConfig)
RenShaTurbo & getRenShaTurbo()
void freeUserName(const std::string &hwName, const std::string &userName)
bool execute()
Run emulation.
EmuTime::param getCurrentTime() const
Convenience method: This is the same as getScheduler().getCurrentTime().
const HardwareConfig * getMachineConfig() const
MSXCPUInterface & getCPUInterface()
std::string getUserName(const std::string &hwName)
Keep track of which 'usernames' are in use.
std::unique_ptr< HardwareConfig > loadExtension(std::string_view extensionName, std::string_view slotName)
std::string loadMachine(const std::string &machine)
std::string_view getMachineName() const
void registerMediaInfo(std::string_view name, MediaInfoProvider &provider)
Register and unregister providers of media info, for the media info topic.
MSXDevice * findDevice(std::string_view name)
Find a MSXDevice by name.
CommandController & getCommandController()
void pause()
Pause MSX machine.
std::string insertExtension(std::string_view name, std::unique_ptr< HardwareConfig > extension)
void fastForward(EmuTime::param time, bool fast)
Run emulation until a certain time in fast forward mode.
void exitCPULoopAsync()
See CPU::exitCPULoopAsync().
MSXMotherBoard(const MSXMotherBoard &)=delete
void unregisterMediaInfo(MediaInfoProvider &provider)
MSXDeviceSwitch & getDeviceSwitch()
void serialize(Archive &ar, unsigned version)
CartridgeSlotManager & getSlotManager()
void removeDevice(MSXDevice &device)
std::string_view getMachineID() const
void removeExtension(const HardwareConfig &extension)
ReverseManager & getReverseManager()
JoystickPortIf & getJoystickPort(unsigned port)
std::string_view getMachineType() const
const Extensions & getExtensions() const
CassettePortInterface & getCassettePort()
void addDevice(MSXDevice &device)
All MSXDevices should be registered by the MotherBoard.
PanasonicMemory & getPanasonicMemory()
MSXMapperIO & createMapperIO()
All memory mappers in one MSX machine share the same four (logical) memory mapper registers.
InfoCommand & getMachineInfoCommand()
Send when a machine is (de)activated.
Definition Event.hh:392
void execute(std::span< const TclObject > tokens, TclObject &result) const override
Show info on this topic.
string help(std::span< const TclObject > tokens) const override
Print help for this topic.
void tabCompletion(std::vector< string > &tokens) const override
Attempt tab completion for this topic.
MachineExtensionInfo(MSXMotherBoard &motherBoard)
void unregisterProvider(MediaInfoProvider &provider)
void registerProvider(std::string_view name, MediaInfoProvider &provider)
string help(std::span< const TclObject > tokens) const override
Print help for this topic.
void execute(std::span< const TclObject > tokens, TclObject &result) const override
Show info on this topic.
MachineMediaInfo(MSXMotherBoard &motherBoard)
void tabCompletion(std::vector< string > &tokens) const override
Attempt tab completion for this topic.
void execute(std::span< const TclObject > tokens, TclObject &result) const override
Show info on this topic.
MachineNameInfo(MSXMotherBoard &motherBoard)
string help(std::span< const TclObject > tokens) const override
Print help for this topic.
string help(std::span< const TclObject > tokens) const override
Print help for this topic.
void execute(std::span< const TclObject > tokens, TclObject &result) const override
Show info on this topic.
MachineTypeInfo(MSXMotherBoard &motherBoard)
Generic Gang-of-Four Observer class, templatized edition.
Definition Observer.hh:10
Central administration of Connectors and Pluggables.
Contains the main loop of openMSX.
Definition Reactor.hh:75
GlobalSettings & getGlobalSettings()
Definition Reactor.hh:117
GlobalCliComm & getGlobalCliComm()
Definition Reactor.hh:90
RTScheduler & getRTScheduler()
Definition Reactor.hh:88
EventDistributor & getEventDistributor()
Definition Reactor.hh:89
static std::vector< std::string > getHwConfigs(std::string_view type)
Definition Reactor.cc:348
Commands that directly influence the MSX state should send and events so that they can be recorded by...
RemoveExtCmd(MSXMotherBoard &motherBoard)
void tabCompletion(std::vector< string > &tokens) const override
Attempt tab completion for this command.
void execute(std::span< const TclObject > tokens, TclObject &result, EmuTime::param time) override
This is like the execute() method of the Command class, it only has an extra time parameter.
string help(std::span< const TclObject > tokens) const override
Print help for this command.
Ren-Sha Turbo is the autofire in several MSX 2+ models and in the MSX turbo R.
string help(std::span< const TclObject > tokens) const override
Print help for this command.
void execute(std::span< const TclObject > tokens, TclObject &result, EmuTime::param time) override
This is like the execute() method of the Command class, it only has an extra time parameter.
ResetCmd(MSXMotherBoard &motherBoard)
void setReRecordCount(unsigned count)
Every class that wants to get scheduled at some point must inherit from this class.
void setSyncPoint(EmuTime::param timestamp)
SettingObserver(MSXMotherBoard &motherBoard)
void update(const Setting &setting) noexcept override
MSXMotherBoard & getMotherBoard() const
void detach(Observer< T > &observer)
Definition Subject.hh:60
void attach(Observer< T > &observer)
Definition Subject.hh:54
void addListElements(ITER first, ITER last)
Definition TclObject.hh:132
void addDictKeyValue(const Key &key, const Value &value)
Definition TclObject.hh:145
const XMLElement * findChild(std::string_view childName) const
Definition XMLElement.cc:21
const XMLElement & getChild(std::string_view childName) const
Definition XMLElement.cc:55
std::string_view getChildData(std::string_view childName) const
Definition XMLElement.cc:64
This file implemented 3 utility functions:
Definition Autofire.cc:11
std::variant< KeyUpEvent, KeyDownEvent, MouseMotionEvent, MouseButtonUpEvent, MouseButtonDownEvent, MouseWheelEvent, JoystickAxisMotionEvent, JoystickHatEvent, JoystickButtonUpEvent, JoystickButtonDownEvent, OsdControlReleaseEvent, OsdControlPressEvent, WindowEvent, TextEvent, FileDropEvent, QuitEvent, FinishFrameEvent, CliCommandEvent, GroupEvent, BootEvent, FrameDrawnEvent, BreakEvent, SwitchRendererEvent, TakeReverseSnapshotEvent, AfterTimedEvent, MachineLoadedEvent, MachineActivatedEvent, MachineDeactivatedEvent, MidiInReaderEvent, MidiInWindowsEvent, MidiInCoreMidiEvent, MidiInCoreMidiVirtualEvent, MidiInALSAEvent, Rs232TesterEvent, Rs232NetEvent, ImGuiDelayedActionEvent, ImGuiActiveEvent > Event
Definition Event.hh:445
auto find(InputRange &&range, const T &value)
Definition ranges.hh:162
STL namespace.
constexpr auto transform(Range &&range, UnaryOp op)
Definition view.hh:520
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
void move_pop_back(VECTOR &v, typename VECTOR::iterator it)
Erase the pointed to element from the given vector.
Definition stl.hh:134
auto rfind_unguarded(RANGE &range, const VAL &val, Proj proj={})
Similar to the find(_if)_unguarded functions above, but searches from the back to front.
Definition stl.hh:109
constexpr bool contains(ITER first, ITER last, const VAL &val)
Check if a range contains a given value, using linear search.
Definition stl.hh:32
std::string strCat()
Definition strCat.hh:703
#define UNREACHABLE
constexpr auto end(const zstring_view &x)