diff options
| author | 2020-06-21 12:36:28 -0400 | |
|---|---|---|
| committer | 2020-06-21 12:36:28 -0400 | |
| commit | 0248614add99c1df1bc7c9ff97091f678ff75aca (patch) | |
| tree | e7a4a8e629039f940b4bef76e69d51ddbf2a0639 /src/input_common/main.cpp | |
| parent | Merge pull request #4120 from lioncash/arb (diff) | |
| download | yuzu-0248614add99c1df1bc7c9ff97091f678ff75aca.tar.gz yuzu-0248614add99c1df1bc7c9ff97091f678ff75aca.tar.xz yuzu-0248614add99c1df1bc7c9ff97091f678ff75aca.zip | |
GC Adapter Implementation
Diffstat (limited to 'src/input_common/main.cpp')
| -rw-r--r-- | src/input_common/main.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp index 95e351e24..be13129af 100644 --- a/src/input_common/main.cpp +++ b/src/input_common/main.cpp | |||
| @@ -4,8 +4,11 @@ | |||
| 4 | 4 | ||
| 5 | #include <memory> | 5 | #include <memory> |
| 6 | #include <thread> | 6 | #include <thread> |
| 7 | #include <libusb.h> | ||
| 8 | #include <iostream> | ||
| 7 | #include "common/param_package.h" | 9 | #include "common/param_package.h" |
| 8 | #include "input_common/analog_from_button.h" | 10 | #include "input_common/analog_from_button.h" |
| 11 | #include "input_common/gcadapter/gc_poller.h" | ||
| 9 | #include "input_common/keyboard.h" | 12 | #include "input_common/keyboard.h" |
| 10 | #include "input_common/main.h" | 13 | #include "input_common/main.h" |
| 11 | #include "input_common/motion_emu.h" | 14 | #include "input_common/motion_emu.h" |
| @@ -22,8 +25,15 @@ static std::shared_ptr<MotionEmu> motion_emu; | |||
| 22 | static std::unique_ptr<SDL::State> sdl; | 25 | static std::unique_ptr<SDL::State> sdl; |
| 23 | #endif | 26 | #endif |
| 24 | static std::unique_ptr<CemuhookUDP::State> udp; | 27 | static std::unique_ptr<CemuhookUDP::State> udp; |
| 28 | static std::shared_ptr<GCButtonFactory> gcbuttons; | ||
| 29 | static std::shared_ptr<GCAnalogFactory> gcanalog; | ||
| 25 | 30 | ||
| 26 | void Init() { | 31 | void Init() { |
| 32 | gcbuttons = std::make_shared<GCButtonFactory>(); | ||
| 33 | Input::RegisterFactory<Input::ButtonDevice>("gcpad", gcbuttons); | ||
| 34 | gcanalog = std::make_shared<GCAnalogFactory>(); | ||
| 35 | Input::RegisterFactory<Input::AnalogDevice>("gcpad", gcanalog); | ||
| 36 | |||
| 27 | keyboard = std::make_shared<Keyboard>(); | 37 | keyboard = std::make_shared<Keyboard>(); |
| 28 | Input::RegisterFactory<Input::ButtonDevice>("keyboard", keyboard); | 38 | Input::RegisterFactory<Input::ButtonDevice>("keyboard", keyboard); |
| 29 | Input::RegisterFactory<Input::AnalogDevice>("analog_from_button", | 39 | Input::RegisterFactory<Input::AnalogDevice>("analog_from_button", |
| @@ -34,8 +44,10 @@ void Init() { | |||
| 34 | #ifdef HAVE_SDL2 | 44 | #ifdef HAVE_SDL2 |
| 35 | sdl = SDL::Init(); | 45 | sdl = SDL::Init(); |
| 36 | #endif | 46 | #endif |
| 47 | /* | ||
| 37 | 48 | ||
| 38 | udp = CemuhookUDP::Init(); | 49 | udp = CemuhookUDP::Init(); |
| 50 | */ | ||
| 39 | } | 51 | } |
| 40 | 52 | ||
| 41 | void Shutdown() { | 53 | void Shutdown() { |
| @@ -48,6 +60,8 @@ void Shutdown() { | |||
| 48 | sdl.reset(); | 60 | sdl.reset(); |
| 49 | #endif | 61 | #endif |
| 50 | udp.reset(); | 62 | udp.reset(); |
| 63 | Input::UnregisterFactory<Input::ButtonDevice>("gcpad"); | ||
| 64 | gcbuttons.reset(); | ||
| 51 | } | 65 | } |
| 52 | 66 | ||
| 53 | Keyboard* GetKeyboard() { | 67 | Keyboard* GetKeyboard() { |
| @@ -58,6 +72,14 @@ MotionEmu* GetMotionEmu() { | |||
| 58 | return motion_emu.get(); | 72 | return motion_emu.get(); |
| 59 | } | 73 | } |
| 60 | 74 | ||
| 75 | GCButtonFactory* GetGCButtons() { | ||
| 76 | return gcbuttons.get(); | ||
| 77 | } | ||
| 78 | |||
| 79 | GCAnalogFactory* GetGCAnalogs() { | ||
| 80 | return gcanalog.get(); | ||
| 81 | } | ||
| 82 | |||
| 61 | std::string GenerateKeyboardParam(int key_code) { | 83 | std::string GenerateKeyboardParam(int key_code) { |
| 62 | Common::ParamPackage param{ | 84 | Common::ParamPackage param{ |
| 63 | {"engine", "keyboard"}, | 85 | {"engine", "keyboard"}, |
| @@ -88,7 +110,6 @@ std::vector<std::unique_ptr<DevicePoller>> GetPollers(DeviceType type) { | |||
| 88 | #ifdef HAVE_SDL2 | 110 | #ifdef HAVE_SDL2 |
| 89 | pollers = sdl->GetPollers(type); | 111 | pollers = sdl->GetPollers(type); |
| 90 | #endif | 112 | #endif |
| 91 | |||
| 92 | return pollers; | 113 | return pollers; |
| 93 | } | 114 | } |
| 94 | 115 | ||