Skip to content

Commit

Permalink
Update to latest ViGEmClient & VS2019
Browse files Browse the repository at this point in the history
  • Loading branch information
emoose committed Feb 21, 2020
1 parent acca2c5 commit 5e53e54
Show file tree
Hide file tree
Showing 9 changed files with 432 additions and 180 deletions.
12 changes: 7 additions & 5 deletions 3rdparty/ViGEm/Client.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
MIT License
Copyright (c) 2017 Benjamin "Nefarius" Höglinger
Copyright (c) 2017-2019 Nefarius Software Solutions e.U. and Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -63,7 +63,9 @@ extern "C" {
VIGEM_ERROR_CALLBACK_NOT_FOUND = 0xE0000011,
VIGEM_ERROR_BUS_ALREADY_CONNECTED = 0xE0000012,
VIGEM_ERROR_BUS_INVALID_HANDLE = 0xE0000013,
VIGEM_ERROR_XUSB_USERINDEX_OUT_OF_RANGE = 0xE0000014
VIGEM_ERROR_XUSB_USERINDEX_OUT_OF_RANGE = 0xE0000014,
VIGEM_ERROR_INVALID_PARAMETER = 0xE0000015

} VIGEM_ERROR;

/**
Expand Down Expand Up @@ -94,7 +96,7 @@ extern "C" {

typedef
_Function_class_(EVT_VIGEM_TARGET_ADD_RESULT)
VOID
VOID CALLBACK
EVT_VIGEM_TARGET_ADD_RESULT(
PVIGEM_CLIENT Client,
PVIGEM_TARGET Target,
Expand All @@ -105,7 +107,7 @@ extern "C" {

typedef
_Function_class_(EVT_VIGEM_X360_NOTIFICATION)
VOID
VOID CALLBACK
EVT_VIGEM_X360_NOTIFICATION(
PVIGEM_CLIENT Client,
PVIGEM_TARGET Target,
Expand All @@ -118,7 +120,7 @@ extern "C" {

typedef
_Function_class_(EVT_VIGEM_DS4_NOTIFICATION)
VOID
VOID CALLBACK
EVT_VIGEM_DS4_NOTIFICATION(
PVIGEM_CLIENT Client,
PVIGEM_TARGET Target,
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/ViGEm/Common.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
MIT License
Copyright (c) 2017 Benjamin "Nefarius" Höglinger
Copyright (c) 2017-2019 Nefarius Software Solutions e.U. and Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/ViGEm/Util.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "Common.h"
#include "ViGEm/Common.h"
#include <limits.h>

VOID FORCEINLINE XUSB_TO_DS4_REPORT(
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/ViGEm/km/BusShared.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
MIT License
Copyright (c) 2016 Benjamin "Nefarius" Höglinger
Copyright (c) 2016-2019 Nefarius Software Solutions e.U. and Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
72 changes: 72 additions & 0 deletions Xb2XInput/Internal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
MIT License
Copyright (c) 2017-2019 Nefarius Software Solutions e.U. and Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/


#pragma once

//
// TODO: this is... not optimal. Improve in the future.
//
#define VIGEM_TARGETS_MAX USHRT_MAX


//
// Represents a driver connection object.
//
typedef struct _VIGEM_CLIENT_T
{
HANDLE hBusDevice;

} VIGEM_CLIENT;

//
// Represents the (connection) state of a target device object.
//
typedef enum _VIGEM_TARGET_STATE
{
VIGEM_TARGET_NEW,
VIGEM_TARGET_INITIALIZED,
VIGEM_TARGET_CONNECTED,
VIGEM_TARGET_DISCONNECTED
} VIGEM_TARGET_STATE, *PVIGEM_TARGET_STATE;



//
// Represents a virtual gamepad object.
//
typedef struct _VIGEM_TARGET_T
{
ULONG Size;
ULONG SerialNo;
VIGEM_TARGET_STATE State;
USHORT VendorId;
USHORT ProductId;
VIGEM_TARGET_TYPE Type;
FARPROC Notification;

bool closingNotificationThreads;
HANDLE cancelNotificationThreadEvent;
std::unique_ptr<std::vector<std::thread>> notificationThreadList;
} VIGEM_TARGET;
Loading

0 comments on commit 5e53e54

Please sign in to comment.