#pragma once #include "IUSBDevice.h" #include "ControllerTypes.h" #include "ControllerConfig.h" #include struct NormalizedButtonData { bool buttons[NUM_CONTROLLERBUTTONS]; float triggers[2]; NormalizedStick sticks[2]; }; class IController { protected: std::unique_ptr m_device; public: uint8_t m_inputData[100]; bool m_UpdateCalled = false; IController(std::unique_ptr &&interface) : m_device(std::move(interface)) {} virtual ~IController() = default; virtual Status Initialize() = 0; //Since Exit is used to clean up resources, no status report should be needed virtual void Exit() = 0; virtual Status GetInput() { return 1; } virtual NormalizedButtonData GetNormalizedButtonData() { return NormalizedButtonData(); } inline IUSBDevice *GetDevice() { return m_device.get(); } virtual ControllerType GetType() = 0; virtual Status SetRumble(uint8_t strong_magnitude, uint8_t weak_magnitude) { return 1; } virtual bool IsControllerActive() { return true; } virtual Status OutputBuffer() { return 1; }; virtual ControllerConfig *GetConfig() { return nullptr; } };