1#ifndef MSXMOTHERBOARD_HH
2#define MSXMOTHERBOARD_HH
22class CartridgeSlotManager;
23class CassettePortInterface;
24class CommandController;
29class FastForwardHelper;
32class JoyPortDebuggable;
38class MachineExtensionInfo;
39class MachineMediaInfo;
43class MSXCommandController;
48class MSXEventDistributor;
52class PluggingController;
61class StateChangeDistributor;
94 [[nodiscard]] std::string_view
getMachineID()
const {
return machineID; }
95 [[nodiscard]] std::string_view
getMachineName()
const {
return machineName; }
118 [[nodiscard]]
bool isPowered()
const {
return powered; }
122 [[nodiscard]]
bool isActive()
const {
return active; }
131 [[nodiscard]]
bool isTurboR()
const;
134 std::string
loadMachine(
const std::string& machine);
136 using Extensions = std::vector<std::unique_ptr<HardwareConfig>>;
139 std::unique_ptr<HardwareConfig>
loadExtension(std::string_view extensionName, std::string_view slotName);
141 std::unique_ptr<HardwareConfig> extension);
197 template<
typename T,
typename ... Args>
198 [[nodiscard]] std::shared_ptr<T>
getSharedStuff(std::string_view name, Args&& ...args)
200 auto& weak = sharedStuffMap[name];
201 auto shared = std::static_pointer_cast<T>(weak.lock());
202 if (shared)
return shared;
204 shared = std::make_shared<T>(std::forward<Args>(args)...);
215 assert(mapperIOCounter);
227 [[nodiscard]] std::string getUserName(
const std::string& hwName);
228 void freeUserName(
const std::string& hwName,
const std::string& userName);
239 keyboards.push_back(&keyboard);
250 return keyboards.empty() ? nullptr : keyboards.front();
253 template<
typename Archive>
254 void serialize(Archive& ar,
unsigned version);
258 void deleteMachine();
262 std::string machineID;
263 std::string machineName;
265 std::vector<MSXDevice*> availableDevices;
270 std::unique_ptr<MSXMapperIO> mapperIO;
271 unsigned mapperIOCounter = 0;
278 std::unique_ptr<HardwareConfig> machineConfig2;
284 std::unique_ptr<AddRemoveUpdate> addRemoveUpdate;
285 std::unique_ptr<MSXCliComm> msxCliComm;
286 std::unique_ptr<MSXEventDistributor> msxEventDistributor;
287 std::unique_ptr<StateChangeDistributor> stateChangeDistributor;
288 std::unique_ptr<MSXCommandController> msxCommandController;
289 std::unique_ptr<Scheduler> scheduler;
290 std::unique_ptr<EventDelay> eventDelay;
291 std::unique_ptr<RealTime> realTime;
292 std::unique_ptr<Debugger> debugger;
293 std::unique_ptr<MSXMixer> msxMixer;
295 std::unique_ptr<MachineMediaInfo> machineMediaInfo;
296 std::unique_ptr<PluggingController> pluggingController;
297 std::unique_ptr<MSXCPU> msxCpu;
298 std::unique_ptr<MSXCPUInterface> msxCpuInterface;
299 std::unique_ptr<PanasonicMemory> panasonicMemory;
300 std::unique_ptr<MSXDeviceSwitch> deviceSwitch;
301 std::unique_ptr<CassettePortInterface> cassettePort;
302 std::array<std::unique_ptr<JoystickPortIf>, 2> joystickPort;
303 std::unique_ptr<JoyPortDebuggable> joyPortDebuggable;
304 std::unique_ptr<RenShaTurbo> renShaTurbo;
305 std::unique_ptr<LedStatus> ledStatus;
309 std::unique_ptr<CartridgeSlotManager> slotManager;
310 std::unique_ptr<ReverseManager> reverseManager;
311 std::unique_ptr<ResetCmd> resetCommand;
312 std::unique_ptr<LoadMachineCmd> loadMachineCommand;
313 std::unique_ptr<ListExtCmd> listExtCommand;
314 std::unique_ptr<ExtCmd> extCommand;
315 std::unique_ptr<RemoveExtCmd> removeExtCommand;
316 std::unique_ptr<MachineNameInfo> machineNameInfo;
317 std::unique_ptr<MachineTypeInfo> machineTypeInfo;
318 std::unique_ptr<MachineExtensionInfo> machineExtensionInfo;
319 std::unique_ptr<DeviceInfo> deviceInfo;
322 std::unique_ptr<FastForwardHelper> fastForwardHelper;
324 std::unique_ptr<SettingObserver> settingObserver;
328 std::vector<Keyboard*> keyboards;
330 bool powered =
false;
332 bool fastForwarding =
false;
341 EmuTime::param time)
override;
342 [[nodiscard]] std::string
help(std::span<const TclObject> tokens)
const override;
343 void tabCompletion(std::vector<std::string>& tokens)
const override;
346 std::string commandName;
void tabCompletion(std::vector< std::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.
std::string help(std::span< const TclObject > tokens) const override
Print help for this command.
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
HardwareConfig * findExtension(std::string_view extensionName)
PluggingController & getPluggingController()
VideoSourceSetting & getVideoSource()
void activate(bool active)
void setMachineConfig(HardwareConfig *machineConfig)
std::shared_ptr< T > getSharedStuff(std::string_view name, Args &&...args)
Some MSX device parts are shared between several MSX devices (e.g.
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
MSXMotherBoard(MSXMotherBoard &&)=delete
MSXCPUInterface & getCPUInterface()
Scheduler & getScheduler()
MSXEventDistributor & getMSXEventDistributor()
std::unique_ptr< HardwareConfig > loadExtension(std::string_view extensionName, std::string_view slotName)
void registerKeyboard(Keyboard &keyboard)
std::string loadMachine(const std::string &machine)
std::string_view getMachineName() const
StateChangeDistributor & getStateChangeDistributor()
HardwareConfig * getMachineConfig()
void registerMediaInfo(std::string_view name, MediaInfoProvider &provider)
Register and unregister providers of media info, for the media info topic.
std::vector< std::unique_ptr< HardwareConfig > > Extensions
MSXDevice * findDevice(std::string_view name)
Find a MSXDevice by name.
CommandController & getCommandController()
void pause()
Pause MSX machine.
Keyboard * getKeyboard() const
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().
void unregisterKeyboard(Keyboard &keyboard)
MSXMapperIO & getMapperIO() const
MSXMotherBoard(const MSXMotherBoard &)=delete
void unregisterMediaInfo(MediaInfoProvider &provider)
bool isFastForwarding() const
MSXCliComm & getMSXCliComm()
LedStatus & getLedStatus()
BooleanSetting & suppressMessages()
bool hasToshibaEngine() const
byte readIRQVector() const
MSXMotherBoard & operator=(MSXMotherBoard &&)=delete
MSXDeviceSwitch & getDeviceSwitch()
void serialize(Archive &ar, unsigned version)
CartridgeSlotManager & getSlotManager()
void removeDevice(MSXDevice &device)
std::string_view getMachineID() const
MSXMotherBoard & operator=(const MSXMotherBoard &)=delete
void removeExtension(const HardwareConfig &extension)
ReverseManager & getReverseManager()
JoystickPortIf & getJoystickPort(unsigned port)
std::string_view getMachineType() const
MSXCommandController & getMSXCommandController()
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()
Central administration of Connectors and Pluggables.
Contains the main loop of openMSX.
Commands that directly influence the MSX state should send and events so that they can be recorded by...
Ren-Sha Turbo is the autofire in several MSX 2+ models and in the MSX turbo R.
This file implemented 3 utility functions:
ITER find_unguarded(ITER first, ITER last, const VAL &val, Proj proj={})
Faster alternative to 'find' when it's guaranteed that the value will be found (if not the behavior i...