openMSX
MSXMotherBoard.hh
Go to the documentation of this file.
1 #ifndef MSXMOTHERBOARD_HH
2 #define MSXMOTHERBOARD_HH
3 
4 #include "EmuTime.hh"
5 #include "serialize_meta.hh"
6 #include "string_ref.hh"
7 #include "openmsx.hh"
8 #include "noncopyable.hh"
9 #include <memory>
10 
11 namespace openmsx {
12 
13 class Reactor;
14 class MSXDevice;
15 class HardwareConfig;
16 class CliComm;
17 class MSXCommandController;
18 class Scheduler;
19 class CartridgeSlotManager;
20 class MSXEventDistributor;
21 class StateChangeDistributor;
22 class RealTime;
23 class Debugger;
24 class MSXMixer;
25 class PluggingController;
26 class MSXCPU;
27 class MSXCPUInterface;
28 class PanasonicMemory;
29 class MSXDeviceSwitch;
30 class CassettePortInterface;
31 class JoystickPortIf;
32 class RenShaTurbo;
33 class LedStatus;
34 class ReverseManager;
35 class CommandController;
36 class InfoCommand;
37 class MSXMapperIO;
38 class VideoSourceSetting;
39 
40 class MSXMotherBoard : private noncopyable
41 {
42 public:
43  explicit MSXMotherBoard(Reactor& reactor);
45 
46  const std::string& getMachineID();
47 
52  bool execute();
53 
56  void fastForward(EmuTime::param time, bool fast);
57 
59  void exitCPULoopAsync();
60  void exitCPULoopSync();
61 
65  void pause();
66  void unpause();
67 
68  void powerUp();
69 
70  void activate(bool active);
71  bool isActive() const;
72  bool isFastForwarding() const;
73 
75 
76  const HardwareConfig* getMachineConfig() const;
77  void setMachineConfig(HardwareConfig* machineConfig);
78  bool isTurboR() const;
79 
80  std::string loadMachine(const std::string& machine);
81 
82  HardwareConfig* findExtension(string_ref extensionName);
83  std::string loadExtension(const std::string& extensionName);
84  std::string insertExtension(const std::string& name,
85  std::unique_ptr<HardwareConfig> extension);
86  void removeExtension(const HardwareConfig& extension);
87 
88  // The following classes are unique per MSX machine
99  MSXCPU& getCPU();
104  JoystickPortIf& getJoystickPort(unsigned port);
108  Reactor& getReactor();
110 
111  // convenience methods
114 
118 
122  void addDevice(MSXDevice& device);
123  void removeDevice(MSXDevice& device);
124 
132 
141  struct SharedStuff {
142  SharedStuff() : stuff(nullptr), counter(0) {}
143  void* stuff;
144  unsigned counter;
145  };
147 
152  void destroyMapperIO();
153 
161  std::string getUserName(const std::string& hwName);
162  void freeUserName(const std::string& hwName,
163  const std::string& userName);
164 
165  template<typename Archive>
166  void serialize(Archive& ar, unsigned version);
167 
168  class Impl;
169 private:
170 #if !defined(__GNUC__) || \
171  ((__GNUC__ * 100 + __GNUC_MINOR__ * 10 + __GNUC_PATCHLEVEL__) >= 472)
172  std::unique_ptr<Impl> pimpl;
173 #else
174  // gcc versions before 4.7.2 had a bug in ~unique_ptr(),
175  // see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54351
176  std::unique_ptr<Impl> pimpl2;
177  Impl* pimpl;
178 #endif
179  friend class Impl;
180 };
182 
183 } // namespace openmsx
184 
185 #endif