1#ifndef MSXMOTHERBOARD_HH
2#define MSXMOTHERBOARD_HH
21class CartridgeSlotManager;
22class CassettePortInterface;
24class CommandController;
29class FastForwardHelper;
32class JoyPortDebuggable;
37class MachineExtensionInfo;
38class MachineMediaInfo;
42class MSXCommandController;
47class MSXEventDistributor;
51class PluggingController;
60class StateChangeDistributor;
89 [[nodiscard]] std::string_view
getMachineID()
const {
return machineID; }
90 [[nodiscard]] std::string_view
getMachineName()
const {
return machineName; }
116 [[nodiscard]]
bool isActive()
const {
return active; }
125 [[nodiscard]]
bool isTurboR()
const;
128 std::string
loadMachine(
const std::string& machine);
130 using Extensions = std::vector<std::unique_ptr<HardwareConfig>>;
133 std::string
loadExtension(std::string_view extensionName, std::string_view slotName);
135 std::unique_ptr<HardwareConfig> extension);
191 template<
typename T,
typename ... Args>
192 [[nodiscard]] std::shared_ptr<T>
getSharedStuff(std::string_view name, Args&& ...args)
194 auto& weak = sharedStuffMap[name];
195 auto shared = std::static_pointer_cast<T>(weak.lock());
196 if (shared)
return shared;
198 shared = std::make_shared<T>(std::forward<Args>(args)...);
209 assert(mapperIOCounter);
221 [[nodiscard]] std::string
getUserName(
const std::string& hwName);
222 void freeUserName(
const std::string& hwName,
const std::string& userName);
230 template<
typename Archive>
231 void serialize(Archive& ar,
unsigned version);
235 void deleteMachine();
239 std::string machineID;
240 std::string machineName;
242 std::vector<MSXDevice*> availableDevices;
247 std::unique_ptr<MSXMapperIO> mapperIO;
248 unsigned mapperIOCounter = 0;
255 std::unique_ptr<HardwareConfig> machineConfig2;
261 std::unique_ptr<AddRemoveUpdate> addRemoveUpdate;
262 std::unique_ptr<MSXCliComm> msxCliComm;
263 std::unique_ptr<MSXEventDistributor> msxEventDistributor;
264 std::unique_ptr<StateChangeDistributor> stateChangeDistributor;
265 std::unique_ptr<MSXCommandController> msxCommandController;
266 std::unique_ptr<Scheduler> scheduler;
267 std::unique_ptr<EventDelay> eventDelay;
268 std::unique_ptr<RealTime> realTime;
269 std::unique_ptr<Debugger> debugger;
270 std::unique_ptr<MSXMixer> msxMixer;
272 std::unique_ptr<MachineMediaInfo> machineMediaInfo;
273 std::unique_ptr<PluggingController> pluggingController;
274 std::unique_ptr<MSXCPU> msxCpu;
275 std::unique_ptr<MSXCPUInterface> msxCpuInterface;
276 std::unique_ptr<PanasonicMemory> panasonicMemory;
277 std::unique_ptr<MSXDeviceSwitch> deviceSwitch;
278 std::unique_ptr<CassettePortInterface> cassettePort;
279 std::array<std::unique_ptr<JoystickPortIf>, 2> joystickPort;
280 std::unique_ptr<JoyPortDebuggable> joyPortDebuggable;
281 std::unique_ptr<RenShaTurbo> renShaTurbo;
282 std::unique_ptr<LedStatus> ledStatus;
286 std::unique_ptr<CartridgeSlotManager> slotManager;
287 std::unique_ptr<ReverseManager> reverseManager;
288 std::unique_ptr<ResetCmd> resetCommand;
289 std::unique_ptr<LoadMachineCmd> loadMachineCommand;
290 std::unique_ptr<ListExtCmd> listExtCommand;
291 std::unique_ptr<ExtCmd> extCommand;
292 std::unique_ptr<RemoveExtCmd> removeExtCommand;
293 std::unique_ptr<MachineNameInfo> machineNameInfo;
294 std::unique_ptr<MachineTypeInfo> machineTypeInfo;
295 std::unique_ptr<MachineExtensionInfo> machineExtensionInfo;
296 std::unique_ptr<DeviceInfo> deviceInfo;
299 std::unique_ptr<FastForwardHelper> fastForwardHelper;
301 std::unique_ptr<SettingObserver> settingObserver;
305 bool powered =
false;
307 bool fastForwarding =
false;
316 EmuTime::param time)
override;
317 [[nodiscard]] std::string
help(std::span<const TclObject> tokens)
const override;
318 void tabCompletion(std::vector<std::string>& tokens)
const override;
321 std::string commandName;
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.
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.
const HardwareConfig * getMachineConfig() const
MSXCPUInterface & getCPUInterface()
Scheduler & getScheduler()
std::string getUserName(const std::string &hwName)
Keep track of which 'usernames' are in use.
MSXEventDistributor & getMSXEventDistributor()
EmuTime::param getCurrentTime()
Convenience method: This is the same as getScheduler().getCurrentTime().
std::string loadMachine(const std::string &machine)
std::string_view getMachineName() const
CliComm & getMSXCliComm()
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
LedStatus & getLedStatus()
BooleanSetting & suppressMessages()
bool hasToshibaEngine() const
MSXDeviceSwitch & getDeviceSwitch()
void serialize(Archive &ar, unsigned version)
CartridgeSlotManager & getSlotManager()
void removeDevice(MSXDevice &device)
std::string_view getMachineID() const
MSXMotherBoard & operator=(const MSXMotherBoard &)=delete
std::string loadExtension(std::string_view extensionName, std::string_view slotName)
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:
SERIALIZE_CLASS_VERSION(CassettePlayer, 2)