diff options
Diffstat (limited to 'src/input_common/main.cpp')
| -rw-r--r-- | src/input_common/main.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp index 39e4935dc..940744c5f 100644 --- a/src/input_common/main.cpp +++ b/src/input_common/main.cpp | |||
| @@ -63,9 +63,12 @@ struct InputSubsystem::Impl { | |||
| 63 | 63 | ||
| 64 | udp_client = std::make_shared<CemuhookUDP::UDPClient>("cemuhookudp"); | 64 | udp_client = std::make_shared<CemuhookUDP::UDPClient>("cemuhookudp"); |
| 65 | udp_client->SetMappingCallback(mapping_callback); | 65 | udp_client->SetMappingCallback(mapping_callback); |
| 66 | udp_client_factory = std::make_shared<InputFactory>(udp_client); | 66 | udp_client_input_factory = std::make_shared<InputFactory>(udp_client); |
| 67 | udp_client_output_factory = std::make_shared<OutputFactory>(udp_client); | ||
| 67 | Common::Input::RegisterFactory<Common::Input::InputDevice>(udp_client->GetEngineName(), | 68 | Common::Input::RegisterFactory<Common::Input::InputDevice>(udp_client->GetEngineName(), |
| 68 | udp_client_factory); | 69 | udp_client_input_factory); |
| 70 | Common::Input::RegisterFactory<Common::Input::OutputDevice>(udp_client->GetEngineName(), | ||
| 71 | udp_client_output_factory); | ||
| 69 | 72 | ||
| 70 | tas_input = std::make_shared<TasInput::Tas>("tas"); | 73 | tas_input = std::make_shared<TasInput::Tas>("tas"); |
| 71 | tas_input->SetMappingCallback(mapping_callback); | 74 | tas_input->SetMappingCallback(mapping_callback); |
| @@ -110,6 +113,7 @@ struct InputSubsystem::Impl { | |||
| 110 | gcadapter.reset(); | 113 | gcadapter.reset(); |
| 111 | 114 | ||
| 112 | Common::Input::UnregisterFactory<Common::Input::InputDevice>(udp_client->GetEngineName()); | 115 | Common::Input::UnregisterFactory<Common::Input::InputDevice>(udp_client->GetEngineName()); |
| 116 | Common::Input::UnregisterFactory<Common::Input::OutputDevice>(udp_client->GetEngineName()); | ||
| 113 | udp_client.reset(); | 117 | udp_client.reset(); |
| 114 | 118 | ||
| 115 | Common::Input::UnregisterFactory<Common::Input::InputDevice>(tas_input->GetEngineName()); | 119 | Common::Input::UnregisterFactory<Common::Input::InputDevice>(tas_input->GetEngineName()); |
| @@ -137,6 +141,8 @@ struct InputSubsystem::Impl { | |||
| 137 | devices.insert(devices.end(), mouse_devices.begin(), mouse_devices.end()); | 141 | devices.insert(devices.end(), mouse_devices.begin(), mouse_devices.end()); |
| 138 | auto gcadapter_devices = gcadapter->GetInputDevices(); | 142 | auto gcadapter_devices = gcadapter->GetInputDevices(); |
| 139 | devices.insert(devices.end(), gcadapter_devices.begin(), gcadapter_devices.end()); | 143 | devices.insert(devices.end(), gcadapter_devices.begin(), gcadapter_devices.end()); |
| 144 | auto udp_devices = udp_client->GetInputDevices(); | ||
| 145 | devices.insert(devices.end(), udp_devices.begin(), udp_devices.end()); | ||
| 140 | #ifdef HAVE_SDL2 | 146 | #ifdef HAVE_SDL2 |
| 141 | auto sdl_devices = sdl->GetInputDevices(); | 147 | auto sdl_devices = sdl->GetInputDevices(); |
| 142 | devices.insert(devices.end(), sdl_devices.begin(), sdl_devices.end()); | 148 | devices.insert(devices.end(), sdl_devices.begin(), sdl_devices.end()); |
| @@ -157,6 +163,9 @@ struct InputSubsystem::Impl { | |||
| 157 | if (engine == gcadapter->GetEngineName()) { | 163 | if (engine == gcadapter->GetEngineName()) { |
| 158 | return gcadapter->GetAnalogMappingForDevice(params); | 164 | return gcadapter->GetAnalogMappingForDevice(params); |
| 159 | } | 165 | } |
| 166 | if (engine == udp_client->GetEngineName()) { | ||
| 167 | return udp_client->GetAnalogMappingForDevice(params); | ||
| 168 | } | ||
| 160 | if (engine == tas_input->GetEngineName()) { | 169 | if (engine == tas_input->GetEngineName()) { |
| 161 | return tas_input->GetAnalogMappingForDevice(params); | 170 | return tas_input->GetAnalogMappingForDevice(params); |
| 162 | } | 171 | } |
| @@ -177,6 +186,9 @@ struct InputSubsystem::Impl { | |||
| 177 | if (engine == gcadapter->GetEngineName()) { | 186 | if (engine == gcadapter->GetEngineName()) { |
| 178 | return gcadapter->GetButtonMappingForDevice(params); | 187 | return gcadapter->GetButtonMappingForDevice(params); |
| 179 | } | 188 | } |
| 189 | if (engine == udp_client->GetEngineName()) { | ||
| 190 | return udp_client->GetButtonMappingForDevice(params); | ||
| 191 | } | ||
| 180 | if (engine == tas_input->GetEngineName()) { | 192 | if (engine == tas_input->GetEngineName()) { |
| 181 | return tas_input->GetButtonMappingForDevice(params); | 193 | return tas_input->GetButtonMappingForDevice(params); |
| 182 | } | 194 | } |
| @@ -194,8 +206,8 @@ struct InputSubsystem::Impl { | |||
| 194 | return {}; | 206 | return {}; |
| 195 | } | 207 | } |
| 196 | const std::string engine = params.Get("engine", ""); | 208 | const std::string engine = params.Get("engine", ""); |
| 197 | if (engine == gcadapter->GetEngineName()) { | 209 | if (engine == udp_client->GetEngineName()) { |
| 198 | return gcadapter->GetMotionMappingForDevice(params); | 210 | return udp_client->GetMotionMappingForDevice(params); |
| 199 | } | 211 | } |
| 200 | #ifdef HAVE_SDL2 | 212 | #ifdef HAVE_SDL2 |
| 201 | if (engine == sdl->GetEngineName()) { | 213 | if (engine == sdl->GetEngineName()) { |
| @@ -238,6 +250,9 @@ struct InputSubsystem::Impl { | |||
| 238 | if (engine == gcadapter->GetEngineName()) { | 250 | if (engine == gcadapter->GetEngineName()) { |
| 239 | return true; | 251 | return true; |
| 240 | } | 252 | } |
| 253 | if (engine == udp_client->GetEngineName()) { | ||
| 254 | return true; | ||
| 255 | } | ||
| 241 | if (engine == tas_input->GetEngineName()) { | 256 | if (engine == tas_input->GetEngineName()) { |
| 242 | return true; | 257 | return true; |
| 243 | } | 258 | } |
| @@ -286,12 +301,13 @@ struct InputSubsystem::Impl { | |||
| 286 | std::shared_ptr<InputFactory> mouse_factory; | 301 | std::shared_ptr<InputFactory> mouse_factory; |
| 287 | std::shared_ptr<InputFactory> gcadapter_input_factory; | 302 | std::shared_ptr<InputFactory> gcadapter_input_factory; |
| 288 | std::shared_ptr<InputFactory> touch_screen_factory; | 303 | std::shared_ptr<InputFactory> touch_screen_factory; |
| 289 | std::shared_ptr<InputFactory> udp_client_factory; | 304 | std::shared_ptr<InputFactory> udp_client_input_factory; |
| 290 | std::shared_ptr<InputFactory> tas_input_factory; | 305 | std::shared_ptr<InputFactory> tas_input_factory; |
| 291 | 306 | ||
| 292 | std::shared_ptr<OutputFactory> keyboard_output_factory; | 307 | std::shared_ptr<OutputFactory> keyboard_output_factory; |
| 293 | std::shared_ptr<OutputFactory> mouse_output_factory; | 308 | std::shared_ptr<OutputFactory> mouse_output_factory; |
| 294 | std::shared_ptr<OutputFactory> gcadapter_output_factory; | 309 | std::shared_ptr<OutputFactory> gcadapter_output_factory; |
| 310 | std::shared_ptr<OutputFactory> udp_client_output_factory; | ||
| 295 | std::shared_ptr<OutputFactory> tas_output_factory; | 311 | std::shared_ptr<OutputFactory> tas_output_factory; |
| 296 | 312 | ||
| 297 | #ifdef HAVE_SDL2 | 313 | #ifdef HAVE_SDL2 |