Controller: Add basic PlayStation Mouse support

Still needs capture/relative movement for a better experience.
This commit is contained in:
Connor McLaughlin 2020-04-29 13:59:49 +10:00
commit 8f82987341
8 changed files with 301 additions and 5 deletions

View file

@ -1,8 +1,9 @@
#include "controller.h"
#include "analog_controller.h"
#include "common/state_wrapper.h"
#include "namco_guncon.h"
#include "digital_controller.h"
#include "namco_guncon.h"
#include "playstation_mouse.h"
Controller::Controller() = default;
@ -50,6 +51,9 @@ std::unique_ptr<Controller> Controller::Create(System* system, ControllerType ty
case ControllerType::NamcoGunCon:
return NamcoGunCon::Create(system);
case ControllerType::PlayStationMouse:
return PlayStationMouse::Create(system);
case ControllerType::None:
default:
return {};
@ -79,6 +83,9 @@ Controller::AxisList Controller::GetAxisNames(ControllerType type)
case ControllerType::NamcoGunCon:
return NamcoGunCon::StaticGetAxisNames();
case ControllerType::PlayStationMouse:
return PlayStationMouse::StaticGetAxisNames();
case ControllerType::None:
default:
return {};
@ -98,6 +105,9 @@ Controller::ButtonList Controller::GetButtonNames(ControllerType type)
case ControllerType::NamcoGunCon:
return NamcoGunCon::StaticGetButtonNames();
case ControllerType::PlayStationMouse:
return PlayStationMouse::StaticGetButtonNames();
case ControllerType::None:
default:
return {};
@ -117,6 +127,9 @@ u32 Controller::GetVibrationMotorCount(ControllerType type)
case ControllerType::NamcoGunCon:
return NamcoGunCon::StaticGetVibrationMotorCount();
case ControllerType::PlayStationMouse:
return PlayStationMouse::StaticGetVibrationMotorCount();
case ControllerType::None:
default:
return 0;
@ -136,6 +149,9 @@ std::optional<s32> Controller::GetAxisCodeByName(ControllerType type, std::strin
case ControllerType::NamcoGunCon:
return NamcoGunCon::StaticGetAxisCodeByName(axis_name);
case ControllerType::PlayStationMouse:
return PlayStationMouse::StaticGetAxisCodeByName(axis_name);
case ControllerType::None:
default:
return std::nullopt;
@ -155,6 +171,9 @@ std::optional<s32> Controller::GetButtonCodeByName(ControllerType type, std::str
case ControllerType::NamcoGunCon:
return NamcoGunCon::StaticGetButtonCodeByName(button_name);
case ControllerType::PlayStationMouse:
return PlayStationMouse::StaticGetButtonCodeByName(button_name);
case ControllerType::None:
default:
return std::nullopt;