openMSX
PluggableFactory.cc
Go to the documentation of this file.
1#include "PluggableFactory.hh"
2
4#include "MSXMotherBoard.hh"
5#include "Reactor.hh"
6#include "JoyMega.hh"
7#include "ArkanoidPad.hh"
9#include "JoyTap.hh"
10#include "NinjaTap.hh"
11#include "SETetrisDongle.hh"
12#include "MagicKey.hh"
13#include "MSXJoystick.hh"
14#include "MidiInReader.hh"
15#include "MidiOutLogger.hh"
16#include "Mouse.hh"
17#include "Paddle.hh"
18#include "Trackball.hh"
19#include "Touchpad.hh"
20#include "PrinterPortLogger.hh"
21#include "PrinterPortSimpl.hh"
22#include "Printer.hh"
23#include "RS232Tester.hh"
24#include "RS232Net.hh"
25#include "WavAudioInput.hh"
26#include "components.hh"
27#if defined(_WIN32)
28#include "MidiInWindows.hh"
29#include "MidiOutWindows.hh"
30#endif
31#if defined(__APPLE__)
32#include "MidiInCoreMIDI.hh"
33#include "MidiOutCoreMIDI.hh"
34#endif
35#if COMPONENT_ALSAMIDI
36#include "MidiSessionALSA.hh"
37#endif
38#include <memory>
39
40namespace openmsx {
41
43 MSXMotherBoard& motherBoard)
44{
45 auto& reactor = motherBoard.getReactor();
46 auto& scheduler = motherBoard.getScheduler();
47 auto& commandController = motherBoard.getCommandController();
48 auto& msxEventDistributor = motherBoard.getMSXEventDistributor();
49 auto& stateChangeDistributor = motherBoard.getStateChangeDistributor();
50 auto& eventDistributor = reactor.getEventDistributor();
51 auto& joystickManager = reactor.getInputEventGenerator().getJoystickManager();
52 auto& display = reactor.getDisplay();
53 // Input devices:
54 // TODO: Support hot-plugging of input devices:
55 // - additional key joysticks can be created by the user
56 // - real joysticks and mice can be hot-plugged (USB)
57 controller.registerPluggable(std::make_unique<ArkanoidPad>(
58 msxEventDistributor, stateChangeDistributor));
59 controller.registerPluggable(std::make_unique<Mouse>(
60 msxEventDistributor, stateChangeDistributor));
61 controller.registerPluggable(std::make_unique<Paddle>(
62 msxEventDistributor, stateChangeDistributor));
63 controller.registerPluggable(std::make_unique<Trackball>(
64 msxEventDistributor, stateChangeDistributor));
65 controller.registerPluggable(std::make_unique<Touchpad>(
66 msxEventDistributor, stateChangeDistributor,
67 display, commandController));
68 controller.registerPluggable(std::make_unique<JoyTap>(
69 controller, "joytap"));
70 controller.registerPluggable(std::make_unique<NinjaTap>(
71 controller, "ninjatap"));
72 controller.registerPluggable(std::make_unique<MSXJoystick>(
73 commandController, msxEventDistributor,
74 stateChangeDistributor, joystickManager, 1)); // msxjoystick1
75 controller.registerPluggable(std::make_unique<MSXJoystick>(
76 commandController, msxEventDistributor,
77 stateChangeDistributor, joystickManager, 2)); // msxjoystick2
78 controller.registerPluggable(std::make_unique<JoyMega>(
79 commandController, msxEventDistributor,
80 stateChangeDistributor, joystickManager, 1)); // joymega1
81 controller.registerPluggable(std::make_unique<JoyMega>(
82 commandController, msxEventDistributor,
83 stateChangeDistributor, joystickManager, 2)); // joymega2
84
85 // Dongles
86 controller.registerPluggable(std::make_unique<SETetrisDongle>());
87 controller.registerPluggable(std::make_unique<MagicKey>());
88
89 // Logging:
90 controller.registerPluggable(std::make_unique<PrinterPortLogger>(
91 commandController));
92 controller.registerPluggable(std::make_unique<MidiOutLogger>(
93 commandController));
94
95 // Serial communication:
96 controller.registerPluggable(std::make_unique<RS232Tester>(
97 eventDistributor, scheduler, commandController));
98 controller.registerPluggable(std::make_unique<RS232Net>(
99 eventDistributor, scheduler, commandController));
100
101 // Sampled audio:
102 controller.registerPluggable(std::make_unique<PrinterPortSimpl>(
103 *motherBoard.getMachineConfig()));
104 controller.registerPluggable(std::make_unique<WavAudioInput>(
105 commandController));
106
107 // MIDI:
108#if !defined(_WIN32)
109 // Devices and pipes are not usable as files on Windows, and MidiInReader
110 // reads all data as soon as it becomes available, so this pluggable is
111 // not useful on Windows.
112 controller.registerPluggable(std::make_unique<MidiInReader>(
113 eventDistributor, scheduler, commandController));
114#endif
115#if defined(_WIN32)
116 MidiInWindows::registerAll(eventDistributor, scheduler, controller);
117 MidiOutWindows::registerAll(controller);
118#endif
119#if defined(__APPLE__)
120 controller.registerPluggable(std::make_unique<MidiInCoreMIDIVirtual>(
121 eventDistributor, scheduler));
122 MidiInCoreMIDI::registerAll(eventDistributor, scheduler, controller);
123 controller.registerPluggable(std::make_unique<MidiOutCoreMIDIVirtual>());
124 MidiOutCoreMIDI::registerAll(controller);
125#endif
126#if COMPONENT_ALSAMIDI
127 MidiSessionALSA::registerAll(controller, reactor.getCliComm(), eventDistributor, scheduler);
128#endif
129
130 // Printers
131 controller.registerPluggable(std::make_unique<ImagePrinterMSX>(
132 motherBoard));
133 controller.registerPluggable(std::make_unique<ImagePrinterEpson>(
134 motherBoard));
135}
136
137} // namespace openmsx
Dot Matrix Printer Emulation code mostly copied from blueMSX but changed to: OO-style save to png ima...
const HardwareConfig * getMachineConfig() const
MSXEventDistributor & getMSXEventDistributor()
StateChangeDistributor & getStateChangeDistributor()
CommandController & getCommandController()
static void registerAll(PluggingController &controller, CliComm &cliComm, EventDistributor &eventDistributor, Scheduler &scheduler)
static void createAll(PluggingController &controller, MSXMotherBoard &motherBoard)
Central administration of Connectors and Pluggables.
void registerPluggable(std::unique_ptr< Pluggable > pluggable)
Add a Pluggable to the registry.
CliComm & getCliComm()
Access to the MSX specific CliComm, so that Connectors can get it.
This file implemented 3 utility functions:
Definition Autofire.cc:11