mirror of
https://github.com/nefarius/ViGEmBus.git
synced 2025-08-10 00:52:17 +00:00
Fixed x86 build
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
constexpr auto cpp_pool_tag = 'EGiV';
|
||||
|
||||
#ifdef _AMD64_
|
||||
|
||||
void* operator new
|
||||
(
|
||||
size_t size
|
||||
@@ -62,3 +64,68 @@ void operator delete[]
|
||||
|
||||
ExFreePoolWithTag(what, cpp_pool_tag);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void* __CRTDECL operator new
|
||||
(
|
||||
size_t size
|
||||
)
|
||||
{
|
||||
return ExAllocatePoolWithTag(NonPagedPoolNx, size, cpp_pool_tag);
|
||||
}
|
||||
|
||||
void* __CRTDECL operator new[]
|
||||
(
|
||||
size_t size
|
||||
)
|
||||
{
|
||||
return ExAllocatePoolWithTag(NonPagedPoolNx, size, cpp_pool_tag);
|
||||
}
|
||||
|
||||
void __CRTDECL operator delete
|
||||
(
|
||||
void* what
|
||||
)
|
||||
{
|
||||
if (what == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ExFreePoolWithTag(what, cpp_pool_tag);
|
||||
}
|
||||
|
||||
void __CRTDECL operator delete
|
||||
(
|
||||
void* what,
|
||||
size_t size
|
||||
)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(size);
|
||||
|
||||
if (what == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ExFreePoolWithTag(what, cpp_pool_tag);
|
||||
}
|
||||
|
||||
void __CRTDECL operator delete[]
|
||||
(
|
||||
void* what,
|
||||
size_t size
|
||||
)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(size);
|
||||
|
||||
if (what == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ExFreePoolWithTag(what, cpp_pool_tag);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,12 +6,15 @@
|
||||
#include <hidclass.h>
|
||||
|
||||
|
||||
using namespace ViGEm::Bus::Targets;
|
||||
|
||||
PCWSTR EmulationTargetDS4::_deviceDescription = L"Virtual DualShock 4 Controller";
|
||||
PCWSTR ViGEm::Bus::Targets::EmulationTargetDS4::_deviceDescription = L"Virtual DualShock 4 Controller";
|
||||
|
||||
NTSTATUS EmulationTargetDS4::PrepareDevice(PWDFDEVICE_INIT DeviceInit,
|
||||
PUNICODE_STRING DeviceId, PUNICODE_STRING DeviceDescription)
|
||||
ViGEm::Bus::Targets::EmulationTargetDS4::EmulationTargetDS4() : EmulationTargetPDO(0x054C, 0x05C4)
|
||||
{
|
||||
}
|
||||
|
||||
NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::PrepareDevice(PWDFDEVICE_INIT DeviceInit,
|
||||
PUNICODE_STRING DeviceId, PUNICODE_STRING DeviceDescription)
|
||||
{
|
||||
NTSTATUS status;
|
||||
UNICODE_STRING buffer;
|
||||
@@ -94,7 +97,7 @@ NTSTATUS EmulationTargetDS4::PrepareDevice(PWDFDEVICE_INIT DeviceInit,
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS EmulationTargetDS4::PrepareHardware(WDFDEVICE Device)
|
||||
NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::PrepareHardware(WDFDEVICE Device)
|
||||
{
|
||||
WDF_QUERY_INTERFACE_CONFIG ifaceCfg;
|
||||
INTERFACE devinterfaceHid;
|
||||
@@ -147,7 +150,7 @@ NTSTATUS EmulationTargetDS4::PrepareHardware(WDFDEVICE Device)
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS EmulationTargetDS4::InitContext(WDFDEVICE Device)
|
||||
NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::InitContext(WDFDEVICE Device)
|
||||
{
|
||||
NTSTATUS status;
|
||||
|
||||
@@ -322,7 +325,7 @@ NTSTATUS EmulationTargetDS4::InitContext(WDFDEVICE Device)
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
VOID EmulationTargetDS4::GetConfigurationDescriptorType(PUCHAR Buffer, ULONG Length)
|
||||
VOID ViGEm::Bus::Targets::EmulationTargetDS4::GetConfigurationDescriptorType(PUCHAR Buffer, ULONG Length)
|
||||
{
|
||||
UCHAR Ds4DescriptorData[DS4_DESCRIPTOR_SIZE] =
|
||||
{
|
||||
@@ -375,7 +378,7 @@ VOID EmulationTargetDS4::GetConfigurationDescriptorType(PUCHAR Buffer, ULONG Len
|
||||
RtlCopyBytes(Buffer, Ds4DescriptorData, Length);
|
||||
}
|
||||
|
||||
VOID EmulationTargetDS4::GetDeviceDescriptorType(PUSB_DEVICE_DESCRIPTOR pDescriptor)
|
||||
VOID ViGEm::Bus::Targets::EmulationTargetDS4::GetDeviceDescriptorType(PUSB_DEVICE_DESCRIPTOR pDescriptor)
|
||||
{
|
||||
pDescriptor->bLength = 0x12;
|
||||
pDescriptor->bDescriptorType = USB_DEVICE_DESCRIPTOR_TYPE;
|
||||
@@ -393,7 +396,7 @@ VOID EmulationTargetDS4::GetDeviceDescriptorType(PUSB_DEVICE_DESCRIPTOR pDescrip
|
||||
pDescriptor->bNumConfigurations = 0x01;
|
||||
}
|
||||
|
||||
VOID EmulationTargetDS4::SelectConfiguration(PUSBD_INTERFACE_INFORMATION pInfo)
|
||||
VOID ViGEm::Bus::Targets::EmulationTargetDS4::SelectConfiguration(PUSBD_INTERFACE_INFORMATION pInfo)
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TRACE_DS4,
|
||||
@@ -426,7 +429,7 @@ VOID EmulationTargetDS4::SelectConfiguration(PUSBD_INTERFACE_INFORMATION pInfo)
|
||||
pInfo->Pipes[1].PipeFlags = 0x00;
|
||||
}
|
||||
|
||||
VOID EmulationTargetDS4::PendingUsbRequestsTimerFunc(
|
||||
VOID ViGEm::Bus::Targets::EmulationTargetDS4::PendingUsbRequestsTimerFunc(
|
||||
_In_ WDFTIMER Timer
|
||||
)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "EmulationTargetPDO.hpp"
|
||||
#include <ViGEm/km/BusShared.h>
|
||||
#include "Util.h"
|
||||
@@ -10,7 +9,7 @@ namespace ViGEm::Bus::Targets
|
||||
class EmulationTargetDS4 : public Core::EmulationTargetPDO
|
||||
{
|
||||
public:
|
||||
EmulationTargetDS4() = default;
|
||||
EmulationTargetDS4();
|
||||
~EmulationTargetDS4() = default;
|
||||
|
||||
NTSTATUS PrepareDevice(PWDFDEVICE_INIT DeviceInit,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "EmulationTargetPDO.hpp"
|
||||
#include <ViGEm/km/BusShared.h>
|
||||
|
||||
@@ -24,7 +23,7 @@ namespace ViGEm::Bus::Targets
|
||||
EmulationTargetXUSB();
|
||||
~EmulationTargetXUSB() = default;
|
||||
|
||||
NTSTATUS PrepareDevice(PWDFDEVICE_INIT DeviceInit,
|
||||
NTSTATUS PrepareDevice(PWDFDEVICE_INIT DeviceInit,
|
||||
PUNICODE_STRING DeviceId, PUNICODE_STRING DeviceDescription) override;
|
||||
|
||||
NTSTATUS PrepareHardware(WDFDEVICE Device) override;
|
||||
|
||||
Reference in New Issue
Block a user