Skip to content

Commit

Permalink
Add Interface function SetDpad()
Browse files Browse the repository at this point in the history
There was a request to expose this function so that it is possible to set more than one direction at once
  • Loading branch information
shauleiz committed Apr 24, 2016
1 parent 405db95 commit 44fed65
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
7 changes: 0 additions & 7 deletions API/vXboxApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ DEFINE_GUID(GUID_DEVINTERFACE_SCPVBUS, 0xf679f562, 0x3164, 0x42ce, 0xa4, 0xdb, 0
#define FEEDBACK_BUFFER_LENGTH 9
#define MAX_NUMBER_XBOX_CTRLS 4

#define DPAD_UP XINPUT_GAMEPAD_DPAD_UP
#define DPAD_DOWN XINPUT_GAMEPAD_DPAD_DOWN
#define DPAD_LEFT XINPUT_GAMEPAD_DPAD_LEFT
#define DPAD_RIGHT XINPUT_GAMEPAD_DPAD_RIGHT
#define DPAD_OFF 0

#define AXIS_MAX 32767
#define AXIS_MIN -32768

Expand Down Expand Up @@ -124,6 +118,5 @@ HANDLE GetVXbusHandle(void);
BOOL GetCreateProcID(DWORD UserIndex, PULONG ProcID);
BOOL XOutputSetState(DWORD UserIndex, XINPUT_GAMEPAD* pGamepad);
BOOL XOutputSetGetState(DWORD UserIndex, XINPUT_GAMEPAD* pGamepad, PBYTE bVibrate, PBYTE bLargeMotor, PBYTE bSmallMotor, PBYTE bLed);
BOOL SetDpad(UINT UserIndex, INT Value);
WORD ConvertButton(LONG vBtns, WORD xBtns, UINT vBtn, UINT xBtn);
BOOL UnPlug_Opt(UINT UserIndex, BOOL Force);
8 changes: 8 additions & 0 deletions API/vXboxInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
#define VXBOX_API __declspec(dllimport)
#endif

#define DPAD_UP XINPUT_GAMEPAD_DPAD_UP
#define DPAD_DOWN XINPUT_GAMEPAD_DPAD_DOWN
#define DPAD_LEFT XINPUT_GAMEPAD_DPAD_LEFT
#define DPAD_RIGHT XINPUT_GAMEPAD_DPAD_RIGHT
#define DPAD_OFF 0


//////////// Interface Functions /////////////////////////
extern "C"
{
Expand Down Expand Up @@ -42,6 +49,7 @@ extern "C"
VXBOX_API BOOL __cdecl SetDpadDown(UINT UserIndex);
VXBOX_API BOOL __cdecl SetDpadLeft(UINT UserIndex);
VXBOX_API BOOL __cdecl SetDpadOff(UINT UserIndex);
VXBOX_API BOOL __cdecl SetDpad(UINT UserIndex, INT Value);

// Data Transfer (Feedback from the device)
VXBOX_API BOOL __cdecl GetLedNumber(UINT UserIndex, PBYTE pLed);
Expand Down
3 changes: 3 additions & 0 deletions Test/Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ int main()
SetDpadLeft(1);
break;
case 80:
SetDpad(1, DPAD_UP|DPAD_RIGHT);
break;
case 99:
SetDpadOff(1);
SetBtnA(1, TRUE);
break;
Expand Down

0 comments on commit 44fed65

Please sign in to comment.