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"
13#include "MagicKey.hh"
14#include "MSXJoystick.hh"
15#include "MidiInReader.hh"
16#include "MidiOutLogger.hh"
17#include "Mouse.hh"
18#include "Paddle.hh"
19#include "Trackball.hh"
20#include "Touchpad.hh"
21#include "PrinterPortLogger.hh"
22#include "PrinterPortSimpl.hh"
23#include "Printer.hh"
24#include "RS232Tester.hh"
25#include "RS232Net.hh"
26#include "WavAudioInput.hh"
27#include "components.hh"
28#if defined(_WIN32)
29#include "MidiInWindows.hh"
30#include "MidiOutWindows.hh"
31#endif
32#if defined(__APPLE__)
33#include "MidiInCoreMIDI.hh"
34#include "MidiOutCoreMIDI.hh"
35#endif
36#if COMPONENT_ALSAMIDI
37#include "MidiSessionALSA.hh"
38#endif
39#include <memory>
40
41namespace openmsx {
42
44 MSXMotherBoard& motherBoard)
45{
46 auto& reactor = motherBoard.getReactor();
47 auto& scheduler = motherBoard.getScheduler();
48 auto& commandController = motherBoard.getCommandController();
49 auto& msxEventDistributor = motherBoard.getMSXEventDistributor();
50 auto& stateChangeDistributor = motherBoard.getStateChangeDistributor();
51 auto& eventDistributor = reactor.getEventDistributor();
52 auto& joystickManager = reactor.getInputEventGenerator().getJoystickManager();
53 auto& display = reactor.getDisplay();
54 // Input devices:
55 // TODO: Support hot-plugging of input devices:
56 // - additional key joysticks can be created by the user
57 // - real joysticks and mice can be hot-plugged (USB)
58 controller.registerPluggable(std::make_unique<ArkanoidPad>(
59 msxEventDistributor, stateChangeDistributor));
60 controller.registerPluggable(std::make_unique<Mouse>(
61 msxEventDistributor, stateChangeDistributor));
62 controller.registerPluggable(std::make_unique<Paddle>(
63 msxEventDistributor, stateChangeDistributor));
64 controller.registerPluggable(std::make_unique<Trackball>(
65 msxEventDistributor, stateChangeDistributor));
66 controller.registerPluggable(std::make_unique<Touchpad>(
67 msxEventDistributor, stateChangeDistributor,
68 display, commandController));
69 controller.registerPluggable(std::make_unique<JoyTap>(
70 controller, "joytap"));
71 controller.registerPluggable(std::make_unique<NinjaTap>(
72 controller, "ninjatap"));
73 controller.registerPluggable(std::make_unique<MSXJoystick>(
74 commandController, msxEventDistributor,
75 stateChangeDistributor, joystickManager, 1)); // msxjoystick1
76 controller.registerPluggable(std::make_unique<MSXJoystick>(
77 commandController, msxEventDistributor,
78 stateChangeDistributor, joystickManager, 2)); // msxjoystick2
79 controller.registerPluggable(std::make_unique<JoyMega>(
80 commandController, msxEventDistributor,
81 stateChangeDistributor, joystickManager, 1)); // joymega1
82 controller.registerPluggable(std::make_unique<JoyMega>(
83 commandController, msxEventDistributor,
84 stateChangeDistributor, joystickManager, 2)); // joymega2
85
86 // Dongles
87 controller.registerPluggable(std::make_unique<SETetrisDongle>());
88 controller.registerPluggable(std::make_unique<MagicKey>());
89 controller.registerPluggable(std::make_unique<CircuitDesignerRDDongle>());
90
91 // Logging:
92 controller.registerPluggable(std::make_unique<PrinterPortLogger>(
93 commandController));
94 controller.registerPluggable(std::make_unique<MidiOutLogger>(
95 commandController));
96
97 // Serial communication:
98 controller.registerPluggable(std::make_unique<RS232Tester>(
99 eventDistributor, scheduler, commandController));
100 controller.registerPluggable(std::make_unique<RS232Net>(
101 eventDistributor, scheduler, commandController));
102
103 // Sampled audio:
104 controller.registerPluggable(std::make_unique<PrinterPortSimpl>(
105 *motherBoard.getMachineConfig()));
106 controller.registerPluggable(std::make_unique<WavAudioInput>(
107 commandController));
108
109 // MIDI:
110#if !defined(_WIN32)
111 // Devices and pipes are not usable as files on Windows, and MidiInReader
112 // reads all data as soon as it becomes available, so this pluggable is
113 // not useful on Windows.
114 controller.registerPluggable(std::make_unique<MidiInReader>(
115 eventDistributor, scheduler, commandController));
116#endif
117#if defined(_WIN32)
118 MidiInWindows::registerAll(eventDistributor, scheduler, controller);
119 MidiOutWindows::registerAll(controller);
120#endif
121#if defined(__APPLE__)
122 controller.registerPluggable(std::make_unique<MidiInCoreMIDIVirtual>(
123 eventDistributor, scheduler));
124 MidiInCoreMIDI::registerAll(eventDistributor, scheduler, controller);
125 controller.registerPluggable(std::make_unique<MidiOutCoreMIDIVirtual>());
126 MidiOutCoreMIDI::registerAll(controller);
127#endif
128#if COMPONENT_ALSAMIDI
129 MidiSessionALSA::registerAll(controller, reactor.getCliComm(), eventDistributor, scheduler);
130#endif
131
132 // Printers
133 controller.registerPluggable(std::make_unique<ImagePrinterMSX>(
134 motherBoard));
135 controller.registerPluggable(std::make_unique<ImagePrinterEpson>(
136 motherBoard));
137}
138
139} // 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