mirror of
https://github.com/nefarius/ViGEmBus.git
synced 2025-08-10 00:52:17 +00:00
Compare commits
30 Commits
v1.16.95.0
...
v1.16.112
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
499340f66b | ||
|
|
5cb98d2074 | ||
|
|
4e576c2087 | ||
|
|
6fda278999 | ||
|
|
d3c76c703f | ||
|
|
3446a56916 | ||
|
|
6d158ca8f2 | ||
|
|
d826f4ee5e | ||
|
|
1fdab3e8f9 | ||
|
|
e69d4c9621 | ||
|
|
b2a7453519 | ||
|
|
a1524ece8e | ||
|
|
1121efcfed | ||
|
|
feda88729f | ||
|
|
64e62600ad | ||
|
|
f9f2313372 | ||
|
|
0cf25d0c9f | ||
|
|
9f838ad396 | ||
|
|
d51a3bf5f4 | ||
|
|
e054f1f8aa | ||
|
|
3a3f41887d | ||
|
|
4497df456d | ||
|
|
f4a7b575fe | ||
|
|
643e4b3c77 | ||
|
|
de3622dbd7 | ||
|
|
14c16243c6 | ||
|
|
c34afa953d | ||
|
|
ca03977296 | ||
|
|
c5a46e884b | ||
|
|
31d65aa40e |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -33,3 +33,7 @@
|
||||
/Debug
|
||||
/sys/Debug
|
||||
/sys/ARM/Debug
|
||||
/lib/Debug (dynamic)/*.log
|
||||
/sys/RCa25584
|
||||
Releases
|
||||
/sys/RCa19160
|
||||
|
||||
@@ -66,13 +66,17 @@ To grab the latest signed binaries for use or redistribution [follow the install
|
||||
|
||||
## Sponsors
|
||||
|
||||
Sponsors listed here have helped the project flourish by either financial support or by gifting licenses:
|
||||
|
||||
- [3dRudder](https://www.3drudder.com/)
|
||||
- [Wohlfeil.IT e.U.](https://wohlfeil.it/)
|
||||
- [Parsec](https://parsecgaming.com/)
|
||||
- [Rainway, Inc](https://rainway.io/)
|
||||
- [JetBrains](https://www.jetbrains.com/resharper/)
|
||||
|
||||
## Known users of ViGEm
|
||||
|
||||
A brief listing of projects/companies/vendors known to build upon the powers of ViGEm. This list is non-exhaustive, if you'd like to see your project included, contact us!
|
||||
|
||||
- [3dRudder](https://www.3drudder.com/)
|
||||
- [Parsec](https://parsecgaming.com/)
|
||||
- [GloSC](https://github.com/Alia5/GloSC)
|
||||
@@ -83,3 +87,5 @@ To grab the latest signed binaries for use or redistribution [follow the install
|
||||
- [WiimoteHook](https://forum.cemu.info/showthread.php/140-WiimoteHook-Nintendo-Wii-Remote-with-Motion-Rumble-and-Nunchuk-support)
|
||||
- [XJoy](https://github.com/sam0x17/XJoy)
|
||||
- [HP](https://www8.hp.com/us/en/campaigns/gamingpcs/overview.html)
|
||||
- [DS4Windows](https://ryochan7.github.io/ds4windows-site/)
|
||||
- [reWASD](https://www.rewasd.com/)
|
||||
|
||||
@@ -5,7 +5,14 @@ install:
|
||||
build_script:
|
||||
- ps: .\build.ps1 -configuration release
|
||||
after_build:
|
||||
- cmd: makecab.exe /f ViGEmBus.ddf
|
||||
- ps: |
|
||||
Invoke-WebRequest "https://downloads.vigem.org/other/pavel-a/ddverpatch/verpatch-1.0.15.1-x86-codeplex.zip" -OutFile verpatch-1.0.15.1-x86-codeplex.zip
|
||||
Expand-Archive verpatch-1.0.15.1-x86-codeplex.zip -DestinationPath .
|
||||
.\verpatch.exe .\artifacts\x64\ViGEmBus.sys "$env:APPVEYOR_BUILD_VERSION"
|
||||
.\verpatch.exe .\artifacts\x64\ViGEmBus.sys /pv "$env:APPVEYOR_BUILD_VERSION"
|
||||
.\verpatch.exe .\artifacts\x86\ViGEmBus.sys "$env:APPVEYOR_BUILD_VERSION"
|
||||
.\verpatch.exe .\artifacts\x86\ViGEmBus.sys /pv "$env:APPVEYOR_BUILD_VERSION"
|
||||
makecab.exe /f ViGEmBus.ddf
|
||||
artifacts:
|
||||
- path: disk1\ViGEmBus.cab
|
||||
name: ViGEmBus_unsigned_x86_amd64
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using JsonConfig;
|
||||
using Nuke.Common;
|
||||
using Nuke.Common.BuildServers;
|
||||
using Nuke.Common.Git;
|
||||
@@ -91,20 +90,6 @@ internal class Build : NukeBuild
|
||||
);
|
||||
|
||||
#endregion
|
||||
|
||||
if (Configuration.Equals("release", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
var version =
|
||||
new Version(IsLocalBuild ? GitVersion.GetNormalizedFileVersion() : AppVeyor.Instance.BuildVersion);
|
||||
|
||||
StampVersion(
|
||||
Path.Combine(ArtifactsDirectory, @"x64\ViGEmBus.sys"),
|
||||
version);
|
||||
|
||||
StampVersion(
|
||||
Path.Combine(ArtifactsDirectory, @"x86\ViGEmBus.sys"),
|
||||
version);
|
||||
}
|
||||
});
|
||||
|
||||
private Target Pack => _ => _
|
||||
@@ -123,38 +108,4 @@ internal class Build : NukeBuild
|
||||
{
|
||||
return Execute<Build>(x => x.Compile);
|
||||
}
|
||||
|
||||
private static void StampVersion(string path, Version version)
|
||||
{
|
||||
var versionResource = new VersionResource
|
||||
{
|
||||
FileVersion = version.ToString(),
|
||||
ProductVersion = version.ToString()
|
||||
};
|
||||
|
||||
var stringFileInfo = new StringFileInfo();
|
||||
versionResource[stringFileInfo.Key] = stringFileInfo;
|
||||
var stringFileInfoStrings = new StringTable
|
||||
{
|
||||
LanguageID = 1033,
|
||||
CodePage = 1200
|
||||
};
|
||||
stringFileInfo.Strings.Add(stringFileInfoStrings.Key, stringFileInfoStrings);
|
||||
stringFileInfoStrings["CompanyName"] = Config.Global.Version.CompanyName;
|
||||
stringFileInfoStrings["FileDescription"] = Config.Global.Version.FileDescription;
|
||||
stringFileInfoStrings["FileVersion"] = version.ToString();
|
||||
stringFileInfoStrings["InternalName"] = Config.Global.Version.InternalName;
|
||||
stringFileInfoStrings["LegalCopyright"] = Config.Global.Version.LegalCopyright;
|
||||
stringFileInfoStrings["OriginalFilename"] = Config.Global.Version.OriginalFilename;
|
||||
stringFileInfoStrings["ProductName"] = Config.Global.Version.ProductName;
|
||||
stringFileInfoStrings["ProductVersion"] = version.ToString();
|
||||
|
||||
var varFileInfo = new VarFileInfo();
|
||||
versionResource[varFileInfo.Key] = varFileInfo;
|
||||
var varFileInfoTranslation = new VarTable("Translation");
|
||||
varFileInfo.Vars.Add(varFileInfoTranslation.Key, varFileInfoTranslation);
|
||||
varFileInfoTranslation[ResourceUtil.USENGLISHLANGID] = 1300;
|
||||
|
||||
versionResource.SaveTo(path);
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Nefarius.JsonConfig" Version="1.0.2" />
|
||||
<PackageReference Include="Nuke.Common" Version="0.9.1" />
|
||||
<PackageReference Include="GitVersion.CommandLine" Version="3.6.5" />
|
||||
<PackageReference Include="Vestris.ResourceLib" Version="2.0.0" />
|
||||
|
||||
@@ -32,7 +32,7 @@ ULONG_PTR align_to_page_size(ULONG_PTR val)
|
||||
|
||||
|
||||
//
|
||||
// Forward decalarations
|
||||
// Forward declarations
|
||||
//
|
||||
|
||||
NTSTATUS IncreaseCapacityByteArray(IN PBYTE_ARRAY Array, IN ULONG NumElements);
|
||||
|
||||
@@ -1,6 +1,18 @@
|
||||
; Virtual Gamepad Emulation Framework - Windows kernel-mode bus driver
|
||||
; Copyright (C) 2016-2019 Nefarius Software Solutions e.U.
|
||||
;
|
||||
; ViGEmBus.inf
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
[Version]
|
||||
Signature="$WINDOWS NT$"
|
||||
@@ -34,10 +46,10 @@ WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll = 1
|
||||
%ManufacturerName%=Standard,NTamd64,NTx86
|
||||
|
||||
[Standard.NTamd64]
|
||||
%ViGEmBus.DeviceDesc%=ViGEmBus_Device, Root\ViGEmBus
|
||||
%ViGEmBus.DeviceDesc%=ViGEmBus_Device, Nefarius\ViGEmBus\Gen1
|
||||
|
||||
[Standard.NTx86]
|
||||
%ViGEmBus.DeviceDesc%=ViGEmBus_Device, Root\ViGEmBus
|
||||
%ViGEmBus.DeviceDesc%=ViGEmBus_Device, Nefarius\ViGEmBus\Gen1
|
||||
|
||||
[ViGEmBus_Device.NT]
|
||||
CopyFiles=Drivers_Dir
|
||||
@@ -78,7 +90,7 @@ KmdfLibraryVersion = $KMDFVERSION$
|
||||
|
||||
[Strings]
|
||||
SPSVCINST_ASSOCSERVICE= 0x00000002
|
||||
ManufacturerName="Benjamin H<>glinger-Stelzer"
|
||||
ManufacturerName="Nefarius Software Solutions e.U."
|
||||
DiskName = "ViGEmBus Installation Disk"
|
||||
ViGEmBus.DeviceDesc = "Virtual Gamepad Emulation Bus"
|
||||
ViGEmBus.SVCDESC = "Virtual Gamepad Emulation Service"
|
||||
|
||||
100
sys/ViGEmBus.rc
Normal file
100
sys/ViGEmBus.rc
Normal file
@@ -0,0 +1,100 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "winres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// German (Austria) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEA)
|
||||
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN_AUSTRIAN
|
||||
#pragma code_page(1252)
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""winres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,14,3,0
|
||||
PRODUCTVERSION 1,14,3,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0xe9L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "000904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Benjamin H<>glinger-Stelzer"
|
||||
VALUE "FileDescription", "Virtual Gamepad Emulation Bus Driver"
|
||||
VALUE "FileVersion", "1.14.3.0"
|
||||
VALUE "InternalName", "Virtual Gamepad Emulation Bus Driver"
|
||||
VALUE "LegalCopyright", "Copyright (C) Benjamin H<>glinger-Stelzer 2016"
|
||||
VALUE "OriginalFilename", "vigembus.sys"
|
||||
VALUE "ProductName", "Virtual Gamepad Emulation Bus Driver"
|
||||
VALUE "ProductVersion", "1.14.3.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x9, 1200
|
||||
END
|
||||
END
|
||||
|
||||
#endif // German (Austria) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
@@ -147,6 +147,7 @@
|
||||
</Inf>
|
||||
<Link>
|
||||
<AdditionalDependencies>$(DDK_LIB_PATH)ntstrsafe.lib;$(DDK_LIB_PATH)wdmsec.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
|
||||
</Link>
|
||||
<ClCompile>
|
||||
<WppRecorderEnabled>true</WppRecorderEnabled>
|
||||
@@ -160,6 +161,7 @@
|
||||
</Inf>
|
||||
<Link>
|
||||
<AdditionalDependencies>$(DDK_LIB_PATH)ntstrsafe.lib;$(DDK_LIB_PATH)wdmsec.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
|
||||
</Link>
|
||||
<ClCompile>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
@@ -179,18 +181,22 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="$(SolutionDir)\Include\ViGEmBusDriver.h" />
|
||||
<ClInclude Include="..\client\include\km\ViGEmBusShared.h" />
|
||||
<ClInclude Include="..\client\include\ViGEm\km\BusShared.h" />
|
||||
<ClInclude Include="busenum.h" />
|
||||
<ClInclude Include="ByteArray.h" />
|
||||
<ClInclude Include="Context.h" />
|
||||
<ClInclude Include="Ds4.h" />
|
||||
<ClInclude Include="Queue.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="trace.h" />
|
||||
<ClInclude Include="UsbPdo.h" />
|
||||
<ClInclude Include="Util.h" />
|
||||
<ClInclude Include="Xgip.h" />
|
||||
<ClInclude Include="Xusb.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="ViGEmBus.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="busenum.c" />
|
||||
<ClCompile Include="buspdo.c" />
|
||||
|
||||
@@ -60,8 +60,8 @@
|
||||
<ClInclude Include="trace.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\client\include\km\ViGEmBusShared.h">
|
||||
<Filter>Header Files\Common</Filter>
|
||||
<ClInclude Include="..\client\include\ViGEm\km\BusShared.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
14
sys/Xusb.h
14
sys/Xusb.h
@@ -49,7 +49,16 @@ DEFINE_GUID(GUID_DEVINTERFACE_XUSB_UNKNOWN_2,
|
||||
#define XUSB_LEDSET_SIZE 0x03
|
||||
#define XUSB_LEDNUM_SIZE 0x01
|
||||
#define XUSB_INIT_STAGE_SIZE 0x03
|
||||
#define XUSB_INIT_BLOB_COUNT 0x07
|
||||
#define XUSB_BLOB_STORAGE_SIZE 0x2A
|
||||
|
||||
#define XUSB_BLOB_00_OFFSET 0x00
|
||||
#define XUSB_BLOB_01_OFFSET 0x03
|
||||
#define XUSB_BLOB_02_OFFSET 0x06
|
||||
#define XUSB_BLOB_03_OFFSET 0x09
|
||||
#define XUSB_BLOB_04_OFFSET 0x0C
|
||||
#define XUSB_BLOB_05_OFFSET 0x20
|
||||
#define XUSB_BLOB_06_OFFSET 0x23
|
||||
#define XUSB_BLOB_07_OFFSET 0x26
|
||||
|
||||
#define XUSB_IS_DATA_PIPE(_x_) ((BOOLEAN)(_x_->PipeHandle == (USBD_PIPE_HANDLE)0xFFFF0081))
|
||||
#define XUSB_IS_CONTROL_PIPE(_x_) ((BOOLEAN)(_x_->PipeHandle == (USBD_PIPE_HANDLE)0xFFFF0083))
|
||||
@@ -102,7 +111,7 @@ typedef struct _XUSB_DEVICE_DATA
|
||||
//
|
||||
// Storage of binary blobs (packets) for PDO initialization
|
||||
//
|
||||
PVOID InterruptInitStageBlobs[XUSB_INIT_BLOB_COUNT];
|
||||
WDFMEMORY InterruptBlobStorage;
|
||||
|
||||
} XUSB_DEVICE_DATA, *PXUSB_DEVICE_DATA;
|
||||
|
||||
@@ -122,7 +131,6 @@ Bus_XusbSubmitReport(
|
||||
//
|
||||
NTSTATUS Xusb_PreparePdo(PWDFDEVICE_INIT DeviceInit, USHORT VendorId, USHORT ProductId, PUNICODE_STRING DeviceId, PUNICODE_STRING DeviceDescription);
|
||||
NTSTATUS Xusb_PrepareHardware(WDFDEVICE Device);
|
||||
NTSTATUS Xusb_ReleaseHardware(WDFDEVICE Device);
|
||||
NTSTATUS Xusb_AssignPdoContext(WDFDEVICE Device);
|
||||
VOID Xusb_GetConfigurationDescriptorType(PUCHAR Buffer, ULONG Length);
|
||||
VOID Xusb_GetDeviceDescriptorType(PUSB_DEVICE_DESCRIPTOR pDescriptor, PPDO_DEVICE_DATA pCommon);
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#define HID_REPORT_TYPE_FEATURE 0x03
|
||||
|
||||
#define VIGEM_POOL_TAG 0x45476956 // "EGiV"
|
||||
#define XUSB_POOL_TAG 'BSUX'
|
||||
#define DRIVERNAME "ViGEm: "
|
||||
#define MAX_HARDWARE_ID_LENGTH 0xFF
|
||||
|
||||
@@ -94,7 +95,6 @@ EVT_WDF_CHILD_LIST_CREATE_DEVICE Bus_EvtDeviceListCreatePdo;
|
||||
EVT_WDF_CHILD_LIST_IDENTIFICATION_DESCRIPTION_COMPARE Bus_EvtChildListIdentificationDescriptionCompare;
|
||||
|
||||
EVT_WDF_DEVICE_PREPARE_HARDWARE Pdo_EvtDevicePrepareHardware;
|
||||
EVT_WDF_DEVICE_RELEASE_HARDWARE Pdo_EvtDeviceReleaseHardware;
|
||||
|
||||
EVT_WDF_IO_QUEUE_IO_INTERNAL_DEVICE_CONTROL Pdo_EvtIoInternalDeviceControl;
|
||||
|
||||
|
||||
66
sys/buspdo.c
66
sys/buspdo.c
@@ -26,7 +26,6 @@
|
||||
#pragma alloc_text(PAGE, Bus_CreatePdo)
|
||||
#pragma alloc_text(PAGE, Bus_EvtDeviceListCreatePdo)
|
||||
#pragma alloc_text(PAGE, Pdo_EvtDevicePrepareHardware)
|
||||
#pragma alloc_text(PAGE, Pdo_EvtDeviceReleaseHardware)
|
||||
#endif
|
||||
|
||||
NTSTATUS Bus_EvtDeviceListCreatePdo(
|
||||
@@ -262,7 +261,6 @@ NTSTATUS Bus_CreatePdo(
|
||||
WDF_PNPPOWER_EVENT_CALLBACKS_INIT(&pnpPowerCallbacks);
|
||||
|
||||
pnpPowerCallbacks.EvtDevicePrepareHardware = Pdo_EvtDevicePrepareHardware;
|
||||
pnpPowerCallbacks.EvtDeviceReleaseHardware = Pdo_EvtDeviceReleaseHardware;
|
||||
|
||||
WdfDeviceInitSetPnpPowerEventCallbacks(DeviceInit, &pnpPowerCallbacks);
|
||||
|
||||
@@ -431,7 +429,7 @@ NTSTATUS Bus_CreatePdo(
|
||||
// Create and assign queue for incoming interrupt transfer
|
||||
WDF_IO_QUEUE_CONFIG_INIT(&usbInQueueConfig, WdfIoQueueDispatchManual);
|
||||
|
||||
status = WdfIoQueueCreate(Device, &usbInQueueConfig, WDF_NO_OBJECT_ATTRIBUTES, &pdoData->PendingUsbInRequests);
|
||||
status = WdfIoQueueCreate(hChild, &usbInQueueConfig, WDF_NO_OBJECT_ATTRIBUTES, &pdoData->PendingUsbInRequests);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
@@ -579,45 +577,6 @@ NTSTATUS Pdo_EvtDevicePrepareHardware(
|
||||
return status;
|
||||
}
|
||||
|
||||
//
|
||||
// PDO power-down.
|
||||
//
|
||||
_Use_decl_annotations_
|
||||
NTSTATUS
|
||||
Pdo_EvtDeviceReleaseHardware(
|
||||
WDFDEVICE Device,
|
||||
WDFCMRESLIST ResourcesTranslated
|
||||
)
|
||||
{
|
||||
PPDO_DEVICE_DATA pdoData;
|
||||
NTSTATUS status = STATUS_UNSUCCESSFUL;
|
||||
|
||||
PAGED_CODE();
|
||||
|
||||
UNREFERENCED_PARAMETER(ResourcesTranslated);
|
||||
|
||||
TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_BUSENUM, "%!FUNC! Entry");
|
||||
|
||||
pdoData = PdoGetData(Device);
|
||||
|
||||
switch (pdoData->TargetType)
|
||||
{
|
||||
// Free XUSB resources
|
||||
case Xbox360Wired:
|
||||
|
||||
status = Xusb_ReleaseHardware(Device);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_BUSPDO, "%!FUNC! Exit with status %!STATUS!", status);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
//
|
||||
// Responds to IRP_MJ_INTERNAL_DEVICE_CONTROL requests sent to PDO.
|
||||
//
|
||||
@@ -639,6 +598,8 @@ VOID Pdo_EvtIoInternalDeviceControl(
|
||||
PURB urb;
|
||||
PPDO_DEVICE_DATA pdoData;
|
||||
PIO_STACK_LOCATION irpStack;
|
||||
PXUSB_DEVICE_DATA pXusbData;
|
||||
PUCHAR blobBuffer;
|
||||
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE, TRACE_BUSPDO, "%!FUNC! Entry");
|
||||
@@ -670,13 +631,20 @@ VOID Pdo_EvtIoInternalDeviceControl(
|
||||
switch (urb->UrbControlTransfer.SetupPacket[6])
|
||||
{
|
||||
case 0x04:
|
||||
//
|
||||
// Xenon magic
|
||||
//
|
||||
COPY_BYTE_ARRAY(urb->UrbControlTransfer.TransferBuffer, P99_PROTECT({
|
||||
0x31, 0x3F, 0xCF, 0xDC
|
||||
}));
|
||||
status = STATUS_SUCCESS;
|
||||
if (pdoData->TargetType == Xbox360Wired)
|
||||
{
|
||||
pXusbData = XusbGetData(hDevice);
|
||||
blobBuffer = WdfMemoryGetBuffer(pXusbData->InterruptBlobStorage, NULL);
|
||||
//
|
||||
// Xenon magic
|
||||
//
|
||||
RtlCopyMemory(
|
||||
urb->UrbControlTransfer.TransferBuffer,
|
||||
&blobBuffer[XUSB_BLOB_07_OFFSET],
|
||||
0x04
|
||||
);
|
||||
status = STATUS_SUCCESS;
|
||||
}
|
||||
break;
|
||||
case 0x14:
|
||||
//
|
||||
|
||||
14
sys/resource.h
Normal file
14
sys/resource.h
Normal file
@@ -0,0 +1,14 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by ViGEmBus.rc
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
72
sys/usbpdo.c
72
sys/usbpdo.c
@@ -509,6 +509,7 @@ NTSTATUS UsbPdo_BulkOrInterruptTransfer(PURB urb, WDFDEVICE Device, WDFREQUEST R
|
||||
NTSTATUS status;
|
||||
PPDO_DEVICE_DATA pdoData;
|
||||
WDFREQUEST notifyRequest;
|
||||
PUCHAR blobBuffer;
|
||||
|
||||
pdoData = PdoGetData(Device);
|
||||
|
||||
@@ -544,6 +545,8 @@ NTSTATUS UsbPdo_BulkOrInterruptTransfer(PURB urb, WDFDEVICE Device, WDFREQUEST R
|
||||
TRACE_USBPDO,
|
||||
">> >> >> Incoming request, queuing...");
|
||||
|
||||
blobBuffer = WdfMemoryGetBuffer(xusb->InterruptBlobStorage, NULL);
|
||||
|
||||
if (XUSB_IS_DATA_PIPE(pTransfer))
|
||||
{
|
||||
//
|
||||
@@ -553,57 +556,57 @@ NTSTATUS UsbPdo_BulkOrInterruptTransfer(PURB urb, WDFDEVICE Device, WDFREQUEST R
|
||||
{
|
||||
case 0:
|
||||
pTransfer->TransferBufferLength = XUSB_INIT_STAGE_SIZE;
|
||||
xusb->InterruptInitStage++;
|
||||
RtlCopyMemory(
|
||||
pTransfer->TransferBuffer,
|
||||
xusb->InterruptInitStageBlobs[xusb->InterruptInitStage],
|
||||
&blobBuffer[XUSB_BLOB_00_OFFSET],
|
||||
XUSB_INIT_STAGE_SIZE
|
||||
);
|
||||
xusb->InterruptInitStage++;
|
||||
);
|
||||
return STATUS_SUCCESS;
|
||||
case 1:
|
||||
pTransfer->TransferBufferLength = XUSB_INIT_STAGE_SIZE;
|
||||
RtlCopyMemory(
|
||||
pTransfer->TransferBuffer,
|
||||
xusb->InterruptInitStageBlobs[xusb->InterruptInitStage],
|
||||
XUSB_INIT_STAGE_SIZE
|
||||
);
|
||||
xusb->InterruptInitStage++;
|
||||
RtlCopyMemory(
|
||||
pTransfer->TransferBuffer,
|
||||
&blobBuffer[XUSB_BLOB_01_OFFSET],
|
||||
XUSB_INIT_STAGE_SIZE
|
||||
);
|
||||
return STATUS_SUCCESS;
|
||||
case 2:
|
||||
pTransfer->TransferBufferLength = XUSB_INIT_STAGE_SIZE;
|
||||
RtlCopyMemory(
|
||||
pTransfer->TransferBuffer,
|
||||
xusb->InterruptInitStageBlobs[xusb->InterruptInitStage],
|
||||
XUSB_INIT_STAGE_SIZE
|
||||
);
|
||||
xusb->InterruptInitStage++;
|
||||
RtlCopyMemory(
|
||||
pTransfer->TransferBuffer,
|
||||
&blobBuffer[XUSB_BLOB_02_OFFSET],
|
||||
XUSB_INIT_STAGE_SIZE
|
||||
);
|
||||
return STATUS_SUCCESS;
|
||||
case 3:
|
||||
pTransfer->TransferBufferLength = XUSB_INIT_STAGE_SIZE;
|
||||
RtlCopyMemory(
|
||||
pTransfer->TransferBuffer,
|
||||
xusb->InterruptInitStageBlobs[xusb->InterruptInitStage],
|
||||
XUSB_INIT_STAGE_SIZE
|
||||
);
|
||||
xusb->InterruptInitStage++;
|
||||
RtlCopyMemory(
|
||||
pTransfer->TransferBuffer,
|
||||
&blobBuffer[XUSB_BLOB_03_OFFSET],
|
||||
XUSB_INIT_STAGE_SIZE
|
||||
);
|
||||
return STATUS_SUCCESS;
|
||||
case 4:
|
||||
pTransfer->TransferBufferLength = sizeof(XUSB_INTERRUPT_IN_PACKET);
|
||||
RtlCopyMemory(
|
||||
pTransfer->TransferBuffer,
|
||||
xusb->InterruptInitStageBlobs[xusb->InterruptInitStage],
|
||||
sizeof(XUSB_INTERRUPT_IN_PACKET)
|
||||
);
|
||||
xusb->InterruptInitStage++;
|
||||
RtlCopyMemory(
|
||||
pTransfer->TransferBuffer,
|
||||
&blobBuffer[XUSB_BLOB_04_OFFSET],
|
||||
sizeof(XUSB_INTERRUPT_IN_PACKET)
|
||||
);
|
||||
return STATUS_SUCCESS;
|
||||
case 5:
|
||||
pTransfer->TransferBufferLength = XUSB_INIT_STAGE_SIZE;
|
||||
RtlCopyMemory(
|
||||
pTransfer->TransferBuffer,
|
||||
xusb->InterruptInitStageBlobs[xusb->InterruptInitStage],
|
||||
XUSB_INIT_STAGE_SIZE
|
||||
);
|
||||
xusb->InterruptInitStage++;
|
||||
RtlCopyMemory(
|
||||
pTransfer->TransferBuffer,
|
||||
&blobBuffer[XUSB_BLOB_05_OFFSET],
|
||||
XUSB_INIT_STAGE_SIZE
|
||||
);
|
||||
return STATUS_SUCCESS;
|
||||
default:
|
||||
/* This request is sent periodically and relies on data the "feeder"
|
||||
@@ -620,10 +623,10 @@ NTSTATUS UsbPdo_BulkOrInterruptTransfer(PURB urb, WDFDEVICE Device, WDFREQUEST R
|
||||
if (!xusb->ReportedCapabilities && pTransfer->TransferBufferLength >= XUSB_INIT_STAGE_SIZE)
|
||||
{
|
||||
RtlCopyMemory(
|
||||
pTransfer->TransferBuffer,
|
||||
xusb->InterruptInitStageBlobs[0x06],
|
||||
pTransfer->TransferBuffer,
|
||||
&blobBuffer[XUSB_BLOB_06_OFFSET],
|
||||
XUSB_INIT_STAGE_SIZE
|
||||
);
|
||||
);
|
||||
|
||||
xusb->ReportedCapabilities = TRUE;
|
||||
|
||||
@@ -725,6 +728,13 @@ NTSTATUS UsbPdo_BulkOrInterruptTransfer(PURB urb, WDFDEVICE Device, WDFREQUEST R
|
||||
status);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_WARNING,
|
||||
TRACE_USBPDO,
|
||||
"!! [XUSB] WdfIoQueueRetrieveNextRequest failed with status %!STATUS!",
|
||||
status);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
103
sys/xusb.c
103
sys/xusb.c
@@ -240,26 +240,11 @@ NTSTATUS Xusb_PrepareHardware(WDFDEVICE Device)
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS Xusb_ReleaseHardware(WDFDEVICE Device)
|
||||
{
|
||||
ULONG index;
|
||||
|
||||
PXUSB_DEVICE_DATA xusb = XusbGetData(Device);
|
||||
|
||||
for (index = 0; index < XUSB_INIT_BLOB_COUNT; index++)
|
||||
{
|
||||
if (xusb->InterruptInitStageBlobs[index])
|
||||
ExFreePoolWithTag(xusb->InterruptInitStageBlobs[index], VIGEM_POOL_TAG);
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS Xusb_AssignPdoContext(WDFDEVICE Device)
|
||||
{
|
||||
NTSTATUS status;
|
||||
WDF_OBJECT_ATTRIBUTES attributes;
|
||||
ULONG index;
|
||||
WDF_OBJECT_ATTRIBUTES attributes;
|
||||
PUCHAR blobBuffer;
|
||||
|
||||
WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
|
||||
attributes.ParentObject = Device;
|
||||
@@ -275,62 +260,44 @@ NTSTATUS Xusb_AssignPdoContext(WDFDEVICE Device)
|
||||
// Packet size (20 bytes = 0x14)
|
||||
xusb->Packet.Size = 0x14;
|
||||
|
||||
// Prepare blob storage
|
||||
xusb->InterruptInitStageBlobs[0] = ExAllocatePoolWithTag(NonPagedPool, XUSB_INIT_STAGE_SIZE, VIGEM_POOL_TAG);
|
||||
xusb->InterruptInitStageBlobs[1] = ExAllocatePoolWithTag(NonPagedPool, XUSB_INIT_STAGE_SIZE, VIGEM_POOL_TAG);
|
||||
xusb->InterruptInitStageBlobs[2] = ExAllocatePoolWithTag(NonPagedPool, XUSB_INIT_STAGE_SIZE, VIGEM_POOL_TAG);
|
||||
xusb->InterruptInitStageBlobs[3] = ExAllocatePoolWithTag(NonPagedPool, XUSB_INIT_STAGE_SIZE, VIGEM_POOL_TAG);
|
||||
xusb->InterruptInitStageBlobs[4] = ExAllocatePoolWithTag(NonPagedPool, sizeof(XUSB_INTERRUPT_IN_PACKET), VIGEM_POOL_TAG);
|
||||
xusb->InterruptInitStageBlobs[5] = ExAllocatePoolWithTag(NonPagedPool, XUSB_INIT_STAGE_SIZE, VIGEM_POOL_TAG);
|
||||
xusb->InterruptInitStageBlobs[6] = ExAllocatePoolWithTag(NonPagedPool, XUSB_INIT_STAGE_SIZE, VIGEM_POOL_TAG);
|
||||
|
||||
// Validate allocations
|
||||
for (index = 0; index < XUSB_INIT_BLOB_COUNT; index++)
|
||||
// Allocate blob storage
|
||||
status = WdfMemoryCreate(
|
||||
&attributes,
|
||||
NonPagedPoolNx,
|
||||
XUSB_POOL_TAG,
|
||||
XUSB_BLOB_STORAGE_SIZE,
|
||||
&xusb->InterruptBlobStorage,
|
||||
&blobBuffer
|
||||
);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
// If even one allocation failed...
|
||||
if (!xusb->InterruptInitStageBlobs[index])
|
||||
{
|
||||
// ...re-enumerate...
|
||||
for (index = 0; index < XUSB_INIT_BLOB_COUNT; index++)
|
||||
{
|
||||
// ...and free the ones who succeeded...
|
||||
if (xusb->InterruptInitStageBlobs[index])
|
||||
// ...to not leak memory...
|
||||
ExFreePoolWithTag(xusb->InterruptInitStageBlobs[index], VIGEM_POOL_TAG);
|
||||
}
|
||||
|
||||
// ...and abort with error
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TRACE_XUSB,
|
||||
"WdfMemoryCreate failed with status %!STATUS!",
|
||||
status);
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* Fill blobs
|
||||
*
|
||||
* Values obtained by reversing the communication of a physical pad.
|
||||
*/
|
||||
COPY_BYTE_ARRAY(xusb->InterruptInitStageBlobs[0], P99_PROTECT({
|
||||
0x01, 0x03, 0x0E
|
||||
}));
|
||||
COPY_BYTE_ARRAY(xusb->InterruptInitStageBlobs[1], P99_PROTECT({
|
||||
0x02, 0x03, 0x00
|
||||
}));
|
||||
COPY_BYTE_ARRAY(xusb->InterruptInitStageBlobs[2], P99_PROTECT({
|
||||
0x03, 0x03, 0x03
|
||||
}));
|
||||
COPY_BYTE_ARRAY(xusb->InterruptInitStageBlobs[3], P99_PROTECT({
|
||||
0x08, 0x03, 0x00
|
||||
}));
|
||||
COPY_BYTE_ARRAY(xusb->InterruptInitStageBlobs[4], P99_PROTECT({
|
||||
// Fill blob storage
|
||||
COPY_BYTE_ARRAY(blobBuffer, P99_PROTECT({
|
||||
// 0
|
||||
0x01, 0x03, 0x0E,
|
||||
// 1
|
||||
0x02, 0x03, 0x00,
|
||||
// 2
|
||||
0x03, 0x03, 0x03,
|
||||
// 3
|
||||
0x08, 0x03, 0x00,
|
||||
// 4
|
||||
0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0xe4, 0xf2,
|
||||
0xb3, 0xf8, 0x49, 0xf3, 0xb0, 0xfc, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00
|
||||
}));
|
||||
COPY_BYTE_ARRAY(xusb->InterruptInitStageBlobs[5], P99_PROTECT({
|
||||
0x01, 0x03, 0x03
|
||||
}));
|
||||
COPY_BYTE_ARRAY(xusb->InterruptInitStageBlobs[6], P99_PROTECT({
|
||||
0x05, 0x03, 0x00
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
// 5
|
||||
0x01, 0x03, 0x03,
|
||||
// 6
|
||||
0x05, 0x03, 0x00,
|
||||
// 7
|
||||
0x31, 0x3F, 0xCF, 0xDC
|
||||
}));
|
||||
|
||||
// I/O Queue for pending IRPs
|
||||
|
||||
8
updates.txt
Normal file
8
updates.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
;aiu;
|
||||
|
||||
[ViGEmBus_1.16.112]
|
||||
Name = ViGEm Bus Driver 1.16.112
|
||||
URL = http://localhost
|
||||
Size = 1337
|
||||
RegistryKey = HKLM\Software\Nefarius Software Solutions e.U.\ViGEm Bus Driver\Version
|
||||
Version = 1.16.112
|
||||
Reference in New Issue
Block a user