mirror of
https://github.com/nefarius/ViGEmBus.git
synced 2025-08-10 00:52:17 +00:00
Removed unused code
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <ntifs.h>
|
||||
#include "Ds4Pdo.hpp"
|
||||
#include "trace.h"
|
||||
#include "Ds4Pdo.tmh"
|
||||
@@ -32,7 +33,6 @@
|
||||
#include <hidclass.h>
|
||||
|
||||
|
||||
|
||||
PCWSTR ViGEm::Bus::Targets::EmulationTargetDS4::_deviceDescription = L"Virtual DualShock 4 Controller";
|
||||
|
||||
ViGEm::Bus::Targets::EmulationTargetDS4::EmulationTargetDS4(ULONG Serial, LONG SessionId, USHORT VendorId,
|
||||
@@ -1127,6 +1127,41 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::SubmitReportImpl(PVOID NewRepo
|
||||
return status;
|
||||
}
|
||||
|
||||
VOID ViGEm::Bus::Targets::EmulationTargetDS4::ReverseByteArray(PUCHAR Array, INT Length)
|
||||
{
|
||||
const auto s = static_cast<PUCHAR>(ExAllocatePoolWithTag(
|
||||
NonPagedPool,
|
||||
sizeof(UCHAR) * Length,
|
||||
'U4SD'
|
||||
));
|
||||
INT c, d;
|
||||
|
||||
if (s == nullptr)
|
||||
return;
|
||||
|
||||
for (c = Length - 1, d = 0; c >= 0; c--, d++)
|
||||
*(s + d) = *(Array + c);
|
||||
|
||||
for (c = 0; c < Length; c++)
|
||||
*(Array + c) = *(s + c);
|
||||
|
||||
ExFreePoolWithTag(s, 'U4SD');
|
||||
}
|
||||
|
||||
VOID ViGEm::Bus::Targets::EmulationTargetDS4::GenerateRandomMacAddress(PMAC_ADDRESS Address)
|
||||
{
|
||||
// Vendor "C0:13:37"
|
||||
Address->Vendor0 = 0xC0;
|
||||
Address->Vendor1 = 0x13;
|
||||
Address->Vendor2 = 0x37;
|
||||
|
||||
ULONG seed = KeQueryPerformanceCounter(NULL).LowPart;
|
||||
|
||||
Address->Nic0 = RtlRandomEx(&seed) % 0xFF;
|
||||
Address->Nic1 = RtlRandomEx(&seed) % 0xFF;
|
||||
Address->Nic2 = RtlRandomEx(&seed) % 0xFF;
|
||||
}
|
||||
|
||||
VOID ViGEm::Bus::Targets::EmulationTargetDS4::PendingUsbRequestsTimerFunc(
|
||||
_In_ WDFTIMER Timer
|
||||
)
|
||||
|
||||
@@ -29,11 +29,22 @@
|
||||
#include "EmulationTargetPDO.hpp"
|
||||
#include <ViGEm/km/BusShared.h>
|
||||
|
||||
#include "Util.h"
|
||||
|
||||
|
||||
namespace ViGEm::Bus::Targets
|
||||
{
|
||||
//
|
||||
// Represents a MAC address.
|
||||
//
|
||||
typedef struct _MAC_ADDRESS
|
||||
{
|
||||
UCHAR Vendor0;
|
||||
UCHAR Vendor1;
|
||||
UCHAR Vendor2;
|
||||
UCHAR Nic0;
|
||||
UCHAR Nic1;
|
||||
UCHAR Nic2;
|
||||
} MAC_ADDRESS, * PMAC_ADDRESS;
|
||||
|
||||
constexpr unsigned char hid_get_report_id(struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST* pReq)
|
||||
{
|
||||
return pReq->Value & 0xFF;
|
||||
@@ -126,5 +137,9 @@ namespace ViGEm::Bus::Targets
|
||||
MAC_ADDRESS _HostMacAddress;
|
||||
|
||||
static EVT_WDF_TIMER PendingUsbRequestsTimerFunc;
|
||||
|
||||
static VOID ReverseByteArray(PUCHAR Array, INT Length);
|
||||
|
||||
static VOID GenerateRandomMacAddress(PMAC_ADDRESS Address);
|
||||
};
|
||||
}
|
||||
|
||||
49
sys/Util.h
49
sys/Util.h
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Virtual Gamepad Emulation Framework - Windows kernel-mode bus driver
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2016-2020 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
|
||||
|
||||
//
|
||||
// Represents a MAC address.
|
||||
//
|
||||
typedef struct _MAC_ADDRESS
|
||||
{
|
||||
UCHAR Vendor0;
|
||||
UCHAR Vendor1;
|
||||
UCHAR Vendor2;
|
||||
UCHAR Nic0;
|
||||
UCHAR Nic1;
|
||||
UCHAR Nic2;
|
||||
} MAC_ADDRESS, *PMAC_ADDRESS;
|
||||
|
||||
|
||||
EXTERN_C_START
|
||||
|
||||
VOID ReverseByteArray(PUCHAR Array, INT Length);
|
||||
VOID GenerateRandomMacAddress(PMAC_ADDRESS Address);
|
||||
|
||||
EXTERN_C_END
|
||||
@@ -194,7 +194,6 @@
|
||||
<ClInclude Include="Queue.hpp" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="trace.h" />
|
||||
<ClInclude Include="Util.h" />
|
||||
<ClInclude Include="XusbPdo.hpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -207,7 +206,6 @@
|
||||
<ClCompile Include="Ds4Pdo.cpp" />
|
||||
<ClCompile Include="EmulationTargetPDO.cpp" />
|
||||
<ClCompile Include="Queue.cpp" />
|
||||
<ClCompile Include="Util.c" />
|
||||
<ClCompile Include="XusbPdo.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
||||
@@ -39,9 +39,6 @@
|
||||
<ClInclude Include="busenum.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Util.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(SolutionDir)\Include\ViGEmBusDriver.h">
|
||||
<Filter>Header Files\Common</Filter>
|
||||
</ClInclude>
|
||||
@@ -71,9 +68,6 @@
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Util.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="XusbPdo.cpp">
|
||||
<Filter>Source Files\Targets</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -39,13 +39,11 @@
|
||||
#include "Queue.hpp"
|
||||
#include <usb.h>
|
||||
#include <usbbusif.h>
|
||||
#include "Util.h"
|
||||
|
||||
|
||||
|
||||
#pragma region Macros
|
||||
|
||||
#define VIGEM_POOL_TAG 0x45476956 // "EGiV"
|
||||
#define DRIVERNAME "ViGEm: "
|
||||
|
||||
#pragma endregion
|
||||
|
||||
62
sys/util.c
62
sys/util.c
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Virtual Gamepad Emulation Framework - Windows kernel-mode bus driver
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2016-2020 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.
|
||||
*/
|
||||
|
||||
|
||||
#include <ntifs.h>
|
||||
#include "busenum.h"
|
||||
#include "util.tmh"
|
||||
|
||||
|
||||
VOID ReverseByteArray(PUCHAR Array, INT Length)
|
||||
{
|
||||
PUCHAR s = (PUCHAR)ExAllocatePoolWithTag(NonPagedPool, sizeof(UCHAR) * Length, VIGEM_POOL_TAG);
|
||||
INT c, d;
|
||||
|
||||
if (s == NULL)
|
||||
return;
|
||||
|
||||
for (c = Length - 1, d = 0; c >= 0; c--, d++)
|
||||
*(s + d) = *(Array + c);
|
||||
|
||||
for (c = 0; c < Length; c++)
|
||||
*(Array + c) = *(s + c);
|
||||
|
||||
ExFreePoolWithTag(s, VIGEM_POOL_TAG);
|
||||
}
|
||||
|
||||
VOID GenerateRandomMacAddress(PMAC_ADDRESS Address)
|
||||
{
|
||||
// Vendor "C0:13:37"
|
||||
Address->Vendor0 = 0xC0;
|
||||
Address->Vendor1 = 0x13;
|
||||
Address->Vendor2 = 0x37;
|
||||
|
||||
ULONG seed = KeQueryPerformanceCounter(NULL).LowPart;
|
||||
|
||||
Address->Nic0 = RtlRandomEx(&seed) % 0xFF;
|
||||
Address->Nic1 = RtlRandomEx(&seed) % 0xFF;
|
||||
Address->Nic2 = RtlRandomEx(&seed) % 0xFF;
|
||||
}
|
||||
Reference in New Issue
Block a user