1#ifndef MSXMOTHERBOARD_HH
2#define MSXMOTHERBOARD_HH
22class CartridgeSlotManager;
23class CassettePortInterface;
24class CommandController;
29class FastForwardHelper;
32class JoyPortDebuggable;
37class MachineExtensionInfo;
38class MachineMediaInfo;
42class MSXCommandController;
47class MSXEventDistributor;
51class PluggingController;
60class StateChangeDistributor;
93 [[nodiscard]] std::string_view
getMachineID()
const {
return machineID; }
94 [[nodiscard]] std::string_view
getMachineName()
const {
return machineName; }
117 [[nodiscard]]
bool isPowered()
const {
return powered; }
121 [[nodiscard]]
bool isActive()
const {
return active; }
130 [[nodiscard]]
bool isTurboR()
const;
133 std::string
loadMachine(
const std::string& machine);
135 using Extensions = std::vector<std::unique_ptr<HardwareConfig>>;
138 std::unique_ptr<HardwareConfig>
loadExtension(std::string_view extensionName, std::string_view slotName);
140 std::unique_ptr<HardwareConfig> extension);
196 template<
typename T,
typename ... Args>
197 [[nodiscard]] std::shared_ptr<T>
getSharedStuff(std::string_view name, Args&& ...args)
199 auto& weak = sharedStuffMap[name];
200 auto shared = std::static_pointer_cast<T>(weak.lock());
201 if (shared)
return shared;
203 shared = std::make_shared<T>(std::forward<Args>(args)...);
214 assert(mapperIOCounter);
226 [[nodiscard]] std::string getUserName(
const std::string& hwName);
227 void freeUserName(
const std::string& hwName,
const std::string& userName);
235 template<
typename Archive>
236 void serialize(Archive& ar,
unsigned version);
240 void deleteMachine();
244 std::string machineID;
245 std::string machineName;
247 std::vector<MSXDevice*> availableDevices;
252 std::unique_ptr<MSXMapperIO> mapperIO;
253 unsigned mapperIOCounter = 0;
260 std::unique_ptr<HardwareConfig> machineConfig2;
266 std::unique_ptr<AddRemoveUpdate> addRemoveUpdate;
267 std::unique_ptr<MSXCliComm> msxCliComm;
268 std::unique_ptr<MSXEventDistributor> msxEventDistributor;
269 std::unique_ptr<StateChangeDistributor> stateChangeDistributor;
270 std::unique_ptr<MSXCommandController> msxCommandController;
271 std::unique_ptr<Scheduler> scheduler;
272 std::unique_ptr<EventDelay> eventDelay;
273 std::unique_ptr<RealTime> realTime;
274 std::unique_ptr<Debugger> debugger;
275 std::unique_ptr<MSXMixer> msxMixer;
277 std::unique_ptr<MachineMediaInfo> machineMediaInfo;
278 std::unique_ptr<PluggingController> pluggingController;
279 std::unique_ptr<MSXCPU> msxCpu;
280 std::unique_ptr<MSXCPUInterface> msxCpuInterface;
281 std::unique_ptr<PanasonicMemory> panasonicMemory;
282 std::unique_ptr<MSXDeviceSwitch> deviceSwitch;
283 std::unique_ptr<CassettePortInterface> cassettePort;
284 std::array<std::unique_ptr<JoystickPortIf>, 2> joystickPort;
285 std::unique_ptr<JoyPortDebuggable> joyPortDebuggable;
286 std::unique_ptr<RenShaTurbo> renShaTurbo;
287 std::unique_ptr<LedStatus> ledStatus;
291 std::unique_ptr<CartridgeSlotManager> slotManager;
292 std::unique_ptr<ReverseManager> reverseManager;
293 std::unique_ptr<ResetCmd> resetCommand;
294 std::unique_ptr<LoadMachineCmd> loadMachineCommand;
295 std::unique_ptr<ListExtCmd> listExtCommand;
296 std::unique_ptr<ExtCmd> extCommand;
297 std::unique_ptr<RemoveExtCmd> removeExtCommand;
298 std::unique_ptr<MachineNameInfo> machineNameInfo;
299 std::unique_ptr<MachineTypeInfo> machineTypeInfo;
300 std::unique_ptr<MachineExtensionInfo> machineExtensionInfo;
301 std::unique_ptr<DeviceInfo> deviceInfo;
304 std::unique_ptr<FastForwardHelper> fastForwardHelper;
306 std::unique_ptr<SettingObserver> settingObserver;
310 bool powered =
false;
312 bool fastForwarding =
false;
321 EmuTime::param time)
override;
322 [[nodiscard]] std::string
help(std::span<const TclObject> tokens)
const override;
323 void tabCompletion(std::vector<std::string>& tokens)
const override;
326 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)
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.
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().
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: