1 #ifndef MSXMOTHERBOARD_HH
2 #define MSXMOTHERBOARD_HH
13 #include <string_view>
18 class AddRemoveUpdate;
20 class CartridgeSlotManager;
21 class CassettePortInterface;
23 class CommandController;
28 class FastForwardHelper;
31 class JoyPortDebuggable;
36 class MachineExtensionInfo;
37 class MachineNameInfo;
38 class MachineTypeInfo;
40 class MSXCommandController;
45 class MSXEventDistributor;
48 class PanasonicMemory;
49 class PluggingController;
56 class SettingObserver;
58 class StateChangeDistributor;
69 [[nodiscard]] std::string_view
getMachineID()
const {
return machineID; }
70 [[nodiscard]] std::string_view
getMachineName()
const {
return machineName; }
96 [[nodiscard]]
bool isActive()
const {
return active; }
104 [[nodiscard]]
bool isTurboR()
const;
106 std::string
loadMachine(
const std::string& machine);
108 using Extensions = std::vector<std::unique_ptr<HardwareConfig>>;
111 std::string
loadExtension(std::string_view extensionName, std::string_view slotname);
113 std::unique_ptr<HardwareConfig> extension);
168 template<
typename T,
typename ... Args>
169 [[nodiscard]] std::shared_ptr<T>
getSharedStuff(std::string_view name, Args&& ...args)
171 auto& weak = sharedStuffMap[name];
172 auto shared = std::static_pointer_cast<T>(weak.lock());
173 if (shared)
return shared;
175 shared = std::make_shared<T>(std::forward<Args>(args)...);
186 assert(mapperIOCounter);
198 [[nodiscard]] std::string
getUserName(
const std::string& hwName);
199 void freeUserName(
const std::string& hwName,
const std::string& userName);
201 template<
typename Archive>
202 void serialize(Archive& ar,
unsigned version);
206 void deleteMachine();
210 std::string machineID;
211 std::string machineName;
213 std::vector<MSXDevice*> availableDevices;
218 std::unique_ptr<MSXMapperIO> mapperIO;
219 unsigned mapperIOCounter;
226 std::unique_ptr<HardwareConfig> machineConfig2;
232 std::unique_ptr<AddRemoveUpdate> addRemoveUpdate;
233 std::unique_ptr<MSXCliComm> msxCliComm;
234 std::unique_ptr<MSXEventDistributor> msxEventDistributor;
235 std::unique_ptr<StateChangeDistributor> stateChangeDistributor;
236 std::unique_ptr<MSXCommandController> msxCommandController;
237 std::unique_ptr<Scheduler> scheduler;
238 std::unique_ptr<EventDelay> eventDelay;
239 std::unique_ptr<RealTime> realTime;
240 std::unique_ptr<Debugger> debugger;
241 std::unique_ptr<MSXMixer> msxMixer;
242 std::unique_ptr<PluggingController> pluggingController;
243 std::unique_ptr<MSXCPU> msxCpu;
244 std::unique_ptr<MSXCPUInterface> msxCpuInterface;
245 std::unique_ptr<PanasonicMemory> panasonicMemory;
246 std::unique_ptr<MSXDeviceSwitch> deviceSwitch;
247 std::unique_ptr<CassettePortInterface> cassettePort;
248 std::unique_ptr<JoystickPortIf> joystickPort[2];
249 std::unique_ptr<JoyPortDebuggable> joyPortDebuggable;
250 std::unique_ptr<RenShaTurbo> renShaTurbo;
251 std::unique_ptr<LedStatus> ledStatus;
254 std::unique_ptr<CartridgeSlotManager> slotManager;
255 std::unique_ptr<ReverseManager> reverseManager;
256 std::unique_ptr<ResetCmd> resetCommand;
257 std::unique_ptr<LoadMachineCmd> loadMachineCommand;
258 std::unique_ptr<ListExtCmd> listExtCommand;
259 std::unique_ptr<ExtCmd> extCommand;
260 std::unique_ptr<RemoveExtCmd> removeExtCommand;
261 std::unique_ptr<MachineNameInfo> machineNameInfo;
262 std::unique_ptr<MachineTypeInfo> machineTypeInfo;
263 std::unique_ptr<MachineExtensionInfo> machineExtensionInfo;
264 std::unique_ptr<DeviceInfo> deviceInfo;
267 std::unique_ptr<FastForwardHelper> fastForwardHelper;
269 std::unique_ptr<SettingObserver> settingObserver;
284 EmuTime::param time)
override;
285 [[nodiscard]] std::string
help(
const std::vector<std::string>& tokens)
const override;
286 void tabCompletion(std::vector<std::string>& tokens)
const override;
289 std::string commandName;
std::string help(const std::vector< std::string > &tokens) const override
Print help for this command.
void tabCompletion(std::vector< std::string > &tokens) const override
Attempt tab completion for this command.
ExtCmd(MSXMotherBoard &motherBoard, std::string commandName)
void execute(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.
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
StateChangeDistributor & getStateChangeDistributor()
HardwareConfig * findExtension(std::string_view extensionName)
PluggingController & getPluggingController()
void activate(bool active)
std::string getMachineType() const
void setMachineConfig(HardwareConfig *machineConfig)
RenShaTurbo & getRenShaTurbo()
void freeUserName(const std::string &hwName, const std::string &userName)
bool execute()
Run emulation.
MSXCPUInterface & getCPUInterface()
std::string getUserName(const std::string &hwName)
Keep track of which 'usernames' are in use.
EmuTime::param getCurrentTime()
Convenience method: This is the same as getScheduler().getCurrentTime().
VideoSourceSetting & getVideoSource()
Scheduler & getScheduler()
CartridgeSlotManager & getSlotManager()
std::string loadMachine(const std::string &machine)
std::string_view getMachineName() const
ReverseManager & getReverseManager()
MSXEventDistributor & getMSXEventDistributor()
CliComm & getMSXCliComm()
MSXMapperIO & getMapperIO() const
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.
const Extensions & getExtensions() 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().
MSXMotherBoard(const MSXMotherBoard &)=delete
bool isFastForwarding() const
LedStatus & getLedStatus()
MSXDeviceSwitch & getDeviceSwitch()
void serialize(Archive &ar, unsigned version)
void removeDevice(MSXDevice &device)
std::string_view getMachineID() const
MSXCommandController & getMSXCommandController()
MSXMotherBoard & operator=(const MSXMotherBoard &)=delete
const HardwareConfig * getMachineConfig() const
void removeExtension(const HardwareConfig &extension)
JoystickPortIf & getJoystickPort(unsigned port)
std::string loadExtension(std::string_view extensionName, std::string_view slotname)
std::shared_ptr< T > getSharedStuff(std::string_view name, Args &&...args)
Some MSX device parts are shared between several MSX devices (e.g.
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)