Controller: Add NeGcon support

This commit is contained in:
Albert Liu
2020-05-29 21:33:55 -07:00
parent e293c22cde
commit ee3a96011e
6 changed files with 350 additions and 4 deletions

View File

@ -4,6 +4,7 @@
#include "digital_controller.h"
#include "namco_guncon.h"
#include "playstation_mouse.h"
#include "negcon.h"
Controller::Controller() = default;
@ -54,6 +55,9 @@ std::unique_ptr<Controller> Controller::Create(System* system, ControllerType ty
case ControllerType::PlayStationMouse:
return PlayStationMouse::Create(system);
case ControllerType::NeGcon:
return NeGcon::Create();
case ControllerType::None:
default:
return {};
@ -86,6 +90,9 @@ Controller::AxisList Controller::GetAxisNames(ControllerType type)
case ControllerType::PlayStationMouse:
return PlayStationMouse::StaticGetAxisNames();
case ControllerType::NeGcon:
return NeGcon::StaticGetAxisNames();
case ControllerType::None:
default:
return {};
@ -108,6 +115,9 @@ Controller::ButtonList Controller::GetButtonNames(ControllerType type)
case ControllerType::PlayStationMouse:
return PlayStationMouse::StaticGetButtonNames();
case ControllerType::NeGcon:
return NeGcon::StaticGetButtonNames();
case ControllerType::None:
default:
return {};
@ -130,6 +140,9 @@ u32 Controller::GetVibrationMotorCount(ControllerType type)
case ControllerType::PlayStationMouse:
return PlayStationMouse::StaticGetVibrationMotorCount();
case ControllerType::NeGcon:
return NeGcon::StaticGetVibrationMotorCount();
case ControllerType::None:
default:
return 0;
@ -152,6 +165,9 @@ std::optional<s32> Controller::GetAxisCodeByName(ControllerType type, std::strin
case ControllerType::PlayStationMouse:
return PlayStationMouse::StaticGetAxisCodeByName(axis_name);
case ControllerType::NeGcon:
return NeGcon::StaticGetAxisCodeByName(axis_name);
case ControllerType::None:
default:
return std::nullopt;
@ -174,6 +190,9 @@ std::optional<s32> Controller::GetButtonCodeByName(ControllerType type, std::str
case ControllerType::PlayStationMouse:
return PlayStationMouse::StaticGetButtonCodeByName(button_name);
case ControllerType::NeGcon:
return NeGcon::StaticGetButtonCodeByName(button_name);
case ControllerType::None:
default:
return std::nullopt;