Skip to content
This repository has been archived by the owner on May 16, 2021. It is now read-only.

Commit

Permalink
Fix build on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Montellese authored and garbear committed Jun 1, 2016
1 parent 8337186 commit 099d406
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 44 deletions.
5 changes: 5 additions & 0 deletions src/api/Joystick.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ namespace JOYSTICK
*/
virtual bool GetEvents(std::vector<ADDON::PeripheralEvent>& events);

/*!
* Tries to power off the joystick.
*/
virtual void PowerOff() { }

protected:
/*!
* Implemented by derived class to scan for events
Expand Down
38 changes: 0 additions & 38 deletions src/api/xinput/JoystickInterfaceXInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,37 +23,12 @@
#include "XInputDLL.h"
#include "api/JoystickTypes.h"

#include <array>
#include <Xinput.h>

using namespace JOYSTICK;

#define MAX_JOYSTICKS 4

// --- DefaultFeatures ---------------------------------------------------------

namespace JOYSTICK
{
struct FeatureStruct
{
const char* controllerId;
const char* name;
JOYSTICK_FEATURE_TYPE type;
unsigned int driverIndex;
};

std::array<FeatureStruct, 4> DefaultFeatures = {
{
{ "game.controller.default", "leftmotor", JOYSTICK_FEATURE_TYPE_MOTOR, MOTOR_LEFT },
{ "game.controller.default", "rightmotor", JOYSTICK_FEATURE_TYPE_MOTOR, MOTOR_RIGHT },
{ "game.controller.ps", "strongmotor", JOYSTICK_FEATURE_TYPE_MOTOR, MOTOR_LEFT },
{ "game.controller.ps", "weakmotor", JOYSTICK_FEATURE_TYPE_MOTOR, MOTOR_RIGHT },
}
};
}

// --- CJoystickInterfaceXInput ------------------------------------------------

const char* CJoystickInterfaceXInput::Name(void) const
{
return INTERFACE_XINPUT;
Expand Down Expand Up @@ -83,16 +58,3 @@ bool CJoystickInterfaceXInput::ScanForJoysticks(JoystickVector& joysticks)

return true;
}

void CJoystickInterfaceXInput::GetFeatures(const std::string& controllerId, FeatureVector& features)
{
for (auto& featureStruct : DefaultFeatures)
{
if (controllerId == featureStruct.controllerId)
{
ADDON::JoystickFeature feature(featureStruct.name, featureStruct.type);
feature.SetPrimitive(ADDON::DriverPrimitive::CreateMotor(featureStruct.driverIndex));
features.push_back(std::move(feature));
}
}
}
4 changes: 0 additions & 4 deletions src/api/xinput/JoystickInterfaceXInput.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@

#include "api/IJoystickInterface.h"

#define MOTOR_LEFT 0
#define MOTOR_RIGHT 1

namespace JOYSTICK
{
class CJoystickInterfaceXInput : public IJoystickInterface
Expand All @@ -37,6 +34,5 @@ namespace JOYSTICK
virtual bool Initialize(void) override;
virtual void Deinitialize(void) override;
virtual bool ScanForJoysticks(JoystickVector& joysticks) override;
virtual void GetFeatures(const std::string& controllerId, FeatureVector& features) override;
};
}
2 changes: 0 additions & 2 deletions src/api/xinput/JoystickXInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ CJoystickXInput::CJoystickXInput(unsigned int controllerID)
SetButtonCount(BUTTON_COUNT);
SetHatCount(HAT_COUNT);
SetAxisCount(AXIS_COUNT);

SetSupportsPowerOff(true);
}

bool CJoystickXInput::Equals(const CJoystick* rhs) const
Expand Down

0 comments on commit 099d406

Please sign in to comment.