21 Commits

Author SHA1 Message Date
Benjamin Höglinger-Stelzer
d826f4ee5e Added trace of return value of WdfIoQueueRetrieveNextRequest (XUSB) 2019-04-01 00:32:52 +02:00
Benjamin Höglinger-Stelzer
1fdab3e8f9 Updated README.md, .gitignore 2019-03-08 10:42:13 +01:00
Benjamin Höglinger-Stelzer
e69d4c9621 Revert "Introduced alternative Discord notification"
This reverts commit a1524ece8e.
2018-12-17 21:55:06 +01:00
Benjamin Höglinger-Stelzer
b2a7453519 Added custom fork of Discord notification script 2018-12-17 21:25:17 +01:00
Benjamin Höglinger-Stelzer
a1524ece8e Introduced alternative Discord notification 2018-12-17 17:12:41 +01:00
Benjamin Höglinger-Stelzer
1121efcfed Revert "Using previous AppVeyor build template"
This reverts commit feda88729f.
2018-12-17 13:39:47 +01:00
Benjamin Höglinger-Stelzer
feda88729f Using previous AppVeyor build template 2018-12-17 12:42:30 +01:00
Benjamin Höglinger-Stelzer
64e62600ad Revert "Use older WDK until appveyor gets the latest one"
This reverts commit f9f2313372.
2018-12-17 12:41:57 +01:00
Jason Hart
f9f2313372 Use older WDK until appveyor gets the latest one 2018-12-16 19:36:09 -05:00
Jason Hart
0cf25d0c9f Remove extra files added to filter 2018-12-16 19:29:12 -05:00
Jason Hart
9f838ad396 Update filters and external files to reflect refactored client directories 2018-12-16 18:13:42 -05:00
Jason Hart
d51a3bf5f4 Typo Fix 2018-12-16 06:16:34 -05:00
Benjamin Höglinger
e054f1f8aa Merge pull request #9 from Ryochan7/master
Add linker optimization flag as recommended by compiler
2018-11-03 18:51:18 +01:00
Benjamin Höglinger-Stelzer
3a3f41887d Changed hardware ID from Root\ViGEmBus to Nefarius\ViGEmBus\Gen1
Applied manufacturer name fix
2018-10-17 19:56:50 +02:00
Benjamin Höglinger-Stelzer
4497df456d Removed unnecessary dependencies 2018-10-17 19:48:32 +02:00
Benjamin Höglinger-Stelzer
f4a7b575fe Re-introduced "old" version stamping until new method is rock-solid 2018-10-17 19:45:33 +02:00
Travis Nickles
643e4b3c77 Make sure to add linker flag to release build as well 2018-10-10 01:34:02 -05:00
Travis Nickles
de3622dbd7 Added linker optimization flag as recommended by compiler 2018-10-10 00:33:55 -05:00
Benjamin Höglinger-Stelzer
14c16243c6 Attempt to fix #8 2018-10-05 19:26:16 +02:00
Benjamin Höglinger-Stelzer
c34afa953d Fixed issues #6, #7
Moved another few bytes to heap
2018-10-03 19:55:13 +02:00
Benjamin Höglinger-Stelzer
ca03977296 Fixed KMODE_EXCEPTION_NOT_HANDLED (1e) happening on systems with HVCI 2018-10-03 09:53:12 +02:00
15 changed files with 173 additions and 69 deletions

4
.gitignore vendored
View File

@@ -33,3 +33,7 @@
/Debug
/sys/Debug
/sys/ARM/Debug
/lib/Debug (dynamic)/*.log
/sys/RCa25584
Releases
/sys/RCa19160

View File

@@ -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)

View File

@@ -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

View File

@@ -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);
}
}

View File

@@ -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" />

View File

@@ -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);

View File

@@ -34,10 +34,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 +78,7 @@ KmdfLibraryVersion = $KMDFVERSION$
[Strings]
SPSVCINST_ASSOCSERVICE= 0x00000002
ManufacturerName="Benjamin H<EFBFBD>glinger-Stelzer"
ManufacturerName="Benjamin Hoeglinger-Stelzer"
DiskName = "ViGEmBus Installation Disk"
ViGEmBus.DeviceDesc = "Virtual Gamepad Emulation Bus"
ViGEmBus.SVCDESC = "Virtual Gamepad Emulation Service"

100
sys/ViGEmBus.rc Normal file
View 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

View File

@@ -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" />

View File

@@ -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>

View File

@@ -49,7 +49,7 @@ 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_BLOB_STORAGE_SIZE 0x26
#define XUSB_BLOB_STORAGE_SIZE 0x2A
#define XUSB_BLOB_00_OFFSET 0x00
#define XUSB_BLOB_01_OFFSET 0x03
@@ -58,6 +58,7 @@ DEFINE_GUID(GUID_DEVINTERFACE_XUSB_UNKNOWN_2,
#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))

View File

@@ -429,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,
@@ -598,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");
@@ -629,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
View 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

View File

@@ -728,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;
}

View File

@@ -295,7 +295,9 @@ NTSTATUS Xusb_AssignPdoContext(WDFDEVICE Device)
// 5
0x01, 0x03, 0x03,
// 6
0x05, 0x03, 0x00
0x05, 0x03, 0x00,
// 7
0x31, 0x3F, 0xCF, 0xDC
}));
// I/O Queue for pending IRPs