Merge pull request #138 from WinDurango/d3d11x-rewrite

D3d11x rewrite
This commit is contained in:
Rodrigo Todescatto
2025-02-18 13:15:25 -03:00
committed by GitHub
87 changed files with 7222 additions and 8286 deletions

View File

@@ -16,8 +16,19 @@ HRESULT AcpHalReleaseShapeContexts_X() {
return 0;
}
HRESULT ApuAlloc_X(void* ptr, void* a2, size_t size, UINT32 alignment) {
ptr = malloc(size);
HRESULT ApuAlloc_X(
void** virtualAddress,
UINT32* physicalAddress,
UINT32 sizeInBytes,
UINT32 alignmentInBytes,
UINT32 flags
)
{
*virtualAddress = malloc(sizeInBytes);
if (physicalAddress != nullptr)
*physicalAddress = 0;
return 0;
}

View File

@@ -1,10 +1,62 @@
#pragma once
#include <inttypes.h>
struct ApuHeapState {
/* 0x0000 */ public: uint32_t bytesFree;
/* 0x0004 */ public: uint32_t bytesAllocated;
/* 0x0008 */ public: uint32_t bytesLost;
/* 0x000c */ public: uint32_t maximumBlockSizeAvailable;
/* 0x0010 */ public: uint32_t allocationCount;
#include "messages.h"
struct ApuHeapState
{
UINT32 bytesFree; // Size of all unallocated regions
UINT32 bytesAllocated; // Size of all allocated regions as visible to the title
UINT32 bytesLost; // Size of all memory lost to alignment requests and fragmented blocks too small to allocate
UINT32 maximumBlockSizeAvailable; // Largest block available (actual space available can be less due to alignment requirements)
UINT32 allocationCount; // Count all allocated blocks
};
enum ACP_COMMAND_TYPE
{
ACP_COMMAND_TYPE_LOAD_SHAPE_FLOWGRAPH = 1, // Load a new flow graph and process it (data: ACP_COMMAND_LOAD_SHAPE_FLOWGRAPH)
ACP_COMMAND_TYPE_REGISTER_MESSAGE, // Registers for one or more messages (data: ACP_COMMAND_MESSAGE)
ACP_COMMAND_TYPE_UNREGISTER_MESSAGE, // Unregisters one or more messages (data: ACP_COMMAND_MESSAGE)
ACP_COMMAND_TYPE_START_FLOWGRAPH, // Start processing the flowgraph (data: none)
ACP_COMMAND_TYPE_ENABLE_XMA_CONTEXT, // Enables an XMA context (data: ACP_COMMAND_ENABLE_OR_DISABLE_XMA_CONTEXT)
ACP_COMMAND_TYPE_ENABLE_XMA_CONTEXTS, // Enables a block XMA of contexts (data: ACP_COMMAND_ENABLE_OR_DISABLE_XMA_CONTEXTS)
ACP_COMMAND_TYPE_DISABLE_XMA_CONTEXT, // Disables an XMA context (data: ACP_COMMAND_ENABLE_OR_DISABLE_XMA_CONTEXT)
ACP_COMMAND_TYPE_DISABLE_XMA_CONTEXTS, // Disables a block of XMA contexts (data: ACP_COMMAND_ENABLE_OR_DISABLE_XMA_CONTEXTS)
ACP_COMMAND_TYPE_UPDATE_SRC_CONTEXT, // Updates a SRC context (data: ACP_COMMAND_UPDATE_XMA_CONTEXT)
ACP_COMMAND_TYPE_UPDATE_EQCOMP_CONTEXT, // Updates an EQ/Comp context (data: ACP_COMMAND_UPDATE_EQCOMP_CONTEXT)
ACP_COMMAND_TYPE_UPDATE_FILTVOL_CONTEXT, // Updates a Filt/Vol context (data: ACP_COMMAND_UPDATE_FILTVOL_CONTEXT)
ACP_COMMAND_TYPE_UPDATE_DMA_CONTEXT, // Updates a DMA context (data: ACP_COMMAND_UPDATE_DMA_CONTEXT)
ACP_COMMAND_TYPE_UPDATE_PCM_CONTEXT, // Updates a PCM context (data: ACP_COMMAND_UPDATE_PCM_CONTEXT)
ACP_COMMAND_TYPE_UPDATE_XMA_CONTEXT, // Updates a XMA context (data: ACP_COMMAND_UPDATE_XMA_CONTEXT)
ACP_COMMAND_TYPE_INCREMENT_DMA_WRITE_POINTER, // Update a DMA write pointer (data: ACP_COMMAND_INCREMENT_DMA_POINTER)
ACP_COMMAND_TYPE_INCREMENT_DMA_READ_POINTER, // Updates a DMA read pointer (data: ACP_COMMAND_INCREMENT_PCM_WRITE_POINTER)
ACP_COMMAND_TYPE_INCREMENT_PCM_WRITE_POINTER, // Updates a PCM context write pointer (data: ACP_COMMAND_INCREMENT_XMA_WRITE_BUFFER_OFFSET_READ)
ACP_COMMAND_TYPE_INCREMENT_XMA_WRITE_BUFFER_OFFSET_READ, // Updates the read offset in an XMA context write buffer (data: ACP_COMMAND_INCREMENT_XMA_WRITE_BUFFER_OFFSET_READ)
ACP_COMMAND_TYPE_UPDATE_XMA_READ_BUFFER, // Updates a PCM context write pointer (data: ACP_COMMAND_UPDATE_XMA_READ_BUFFER)
ACP_COMMAND_TYPE_UPDATE_ALL_CONTEXTS, // Updates blocks of contexts (data: ACP_COMMAND_UPDATE_ALL_CONTEXTS)
ACP_COMMAND_TYPE_UPDATE_SRC_CONTEXTS, // Updates a block of SRC contexts (data: ACP_COMMAND_UPDATE_CONTEXTS)
ACP_COMMAND_TYPE_UPDATE_EQCOMP_CONTEXTS, // Updates a block of EQ/Comp contexts (data: ACP_COMMAND_UPDATE_CONTEXTS)
ACP_COMMAND_TYPE_UPDATE_FILTVOL_CONTEXTS, // Updates a block of Filt/Vol contexts (data: ACP_COMMAND_UPDATE_CONTEXTS)
ACP_COMMAND_TYPE_UPDATE_DMA_READ_CONTEXTS, // Updates a block of DMA read contexts (data: ACP_COMMAND_UPDATE_CONTEXTS)
ACP_COMMAND_TYPE_UPDATE_DMA_WRITE_CONTEXTS, // Updates a block of DMA write contexts (data: ACP_COMMAND_UPDATE_CONTEXTS)
ACP_COMMAND_TYPE_UPDATE_PCM_CONTEXTS, // Updates a block of PCM contexts (data: ACP_COMMAND_UPDATE_CONTEXTS)
ACP_COMMAND_TYPE_UPDATE_XMA_CONTEXTS, // Updates a block of XMA contexts (data: ACP_COMMAND_UPDATE_CONTEXTS)
ACP_COMMAND_TYPE_COUNT = ACP_COMMAND_TYPE_UPDATE_XMA_CONTEXTS // Count of command types (not an actual command)
};
struct ACP_MESSAGE
{
UINT32 type; // Message type
UINT32 droppedMessageCount; // Count of dropped messages prior to this message
UINT32 usec; // time when this message is constructed
union // Message data
{
ACP_MESSAGE_AUDIO_FRAME_START audioFrameStart;
ACP_MESSAGE_FLOWGRAPH_COMPLETED flowgraphCompleted;
ACP_MESSAGE_SHAPE_COMMAND_BLOCKED shapeCommandBlocked;
ACP_MESSAGE_COMMAND_COMPLETED commandCompleted;
ACP_MESSAGE_FLOWGRAPH_TERMINATED flowgraphTerminated;
ACP_MESSAGE_ERROR error;
};
};

View File

@@ -116,6 +116,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -134,6 +135,7 @@
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -146,7 +148,9 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="AcpHal.h" />
<ClInclude Include="contexts.h" />
<ClInclude Include="framework.h" />
<ClInclude Include="messages.h" />
<ClInclude Include="pch.h" />
</ItemGroup>
<ItemGroup>

View File

@@ -24,6 +24,12 @@
<ClInclude Include="AcpHal.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="contexts.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="messages.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">

209
dlls/AcpHal/contexts.h Normal file
View File

@@ -0,0 +1,209 @@
#pragma once
struct SHAPE_EQCOMP_CONTEXT {
UINT32 timestamp : 21;
UINT32 reserved0 : 2;
UINT32 internalSaturate : 1;
UINT32 mixBufPeakMag : 4;
UINT32 peakMag : 4;
UINT32 eqAB0 : 24;
UINT32 eqAB1_L : 8;
UINT32 eqAB1_H : 16;
UINT32 eqAB2_L : 16;
UINT32 eqAB2_H : 8;
UINT32 eqAA1 : 24;
UINT32 eqAA2 : 24;
UINT32 eqBB0_L : 8;
UINT32 eqBB0_H : 16;
UINT32 eqBB1_L : 16;
UINT32 eqBB1_H : 8;
UINT32 eqBB2 : 24;
UINT32 eqBA1 : 24;
UINT32 eqBA2_L : 8;
UINT32 eqBA2_H : 16;
UINT32 eqCB0_L : 16;
UINT32 eqCB0_H : 8;
UINT32 eqCB1 : 24;
UINT32 eqCB2 : 24;
UINT32 eqCA1_L : 8;
UINT32 eqCA1_H : 16;
UINT32 eqCA2_L : 16;
UINT32 eqCA2_H : 8;
UINT32 reserved1 : 24;
UINT32 eqAInputDelay0 : 24;
UINT32 reserved2 : 8;
UINT32 eqAInputDelay1 : 24;
UINT32 reserved3 : 8;
UINT32 eqDelayElements2 : 32;
UINT32 eqDelayElements3 : 32;
UINT32 eqDelayElements4 : 32;
UINT32 eqDelayElements5 : 32;
UINT32 eqDelayElements6 : 32;
UINT32 eqDelayElements7 : 32;
UINT32 compInputLevel : 32;
UINT32 compGainReduction : 24;
UINT32 reserved4 : 8;
UINT32 compGain : 16;
UINT32 reserved5 : 16;
UINT32 eqAB0Target : 24;
UINT32 eqAB1Target_L : 8;
UINT32 eqAB1Target_H : 16;
UINT32 eqAB2Target_L : 16;
UINT32 eqAB2Target_H : 8;
UINT32 eqAA1Target : 24;
UINT32 eqAA2Target : 24;
UINT32 eqBB0Target_L : 8;
UINT32 eqBB0Target_H : 16;
UINT32 eqBB1Target_L : 16;
UINT32 eqBB1Target_H : 8;
UINT32 eqBB2Target : 24;
UINT32 eqBA1Target : 24;
UINT32 eqBA2Target_L : 8;
UINT32 eqBA2Target_H : 16;
UINT32 eqCB0Target_L : 16;
UINT32 eqCB0Target_H : 8;
UINT32 eqCB1Target : 24;
UINT32 eqCB2Target : 24;
UINT32 eqCA1Target_L : 8;
UINT32 eqCA1Target_H : 16;
UINT32 eqCA2Target_L : 16;
UINT32 eqCA2Target_H : 8;
UINT32 reserved6 : 24;
UINT32 compRelease : 24;
UINT32 reserved7 : 2;
UINT32 compExpand : 1;
UINT32 compLogGain : 1;
UINT32 compSidechainMode : 2;
UINT32 compMode : 1;
UINT32 compEnable : 1;
UINT32 compThreshold : 24;
UINT32 reserved8 : 8;
UINT32 compAttack : 24;
UINT32 reserved9 : 8;
UINT32 compOneOverRatio : 16;
UINT32 compGainTarget : 16;
};
struct SHAPE_SRC_CONTEXT {
UINT32 timestamp : 21;
UINT32 blocksToSkip : 2;
UINT32 internalSaturate : 1;
UINT32 mixBufPeakMag : 4;
UINT32 peakMag : 4;
UINT32 samplingIncrement : 21;
UINT32 reserved0 : 1;
UINT32 cmd : 2;
UINT32 mixBufPeakMag2 : 4;
UINT32 peakMag2 : 4;
UINT32 sampleCount : 32;
UINT32 samplePointer : 25;
UINT32 reserved1 : 7;
UINT32 samplingIncrementTarget : 21;
UINT32 reserved2 : 11;
UINT32 reserved3[ 3 ];
};
struct SHAPE_FILTVOL_CONTEXT {
UINT32 timestamp : 21;
UINT32 reserved0 : 2;
UINT32 internalSaturate : 1;
UINT32 mixBufPeakMag : 4;
UINT32 peakMag : 4;
UINT32 delay1 : 30;
UINT32 headroom : 2;
UINT32 delay2 : 30;
UINT32 svfMode : 2;
UINT32 gainTarget : 16;
UINT32 gain : 16;
UINT32 qRecip : 24;
UINT32 reserved1 : 8;
UINT32 qRecipTarget : 24;
UINT32 reserved2 : 8;
UINT32 fc : 24;
UINT32 reserved3 : 8;
UINT32 fcTarget : 24;
UINT32 reserved4 : 8;
};
struct SHAPE_DMA_CONTEXT {
UINT32 timestamp : 21;
UINT32 reserved0 : 3;
UINT32 mixBufPeakMag : 4;
UINT32 peakMag : 4;
UINT32 readPointer : 5;
UINT32 reserved1 : 3;
UINT32 writePointer : 5;
UINT32 reserved2 : 3;
UINT32 full : 1;
UINT32 reserved3 : 15;
UINT32 reserved4 : 9;
UINT32 address : 23;
UINT32 numFrames : 5;
UINT32 reserved5 : 3;
UINT32 floatConvert : 1;
UINT32 reserved6 : 7;
UINT32 numChannels : 3;
UINT32 reserved7 : 5;
UINT32 channel : 3;
UINT32 reserved8 : 5;
};
struct SHAPE_XMA_CONTEXT {
UINT32 sizeRead0 : 12;
UINT32 numLoops : 8;
UINT32 validBuffer : 2;
UINT32 sizeWrite : 5;
UINT32 offsetWrite : 5;
UINT32 sizeRead1 : 12;
UINT32 loopSubframeEnd : 2;
UINT32 reserved1 : 3;
UINT32 loopSubframeSkip : 3;
UINT32 numSubframeToDecode : 4;
UINT32 numSubframesToSkip : 3;
UINT32 sampleRate : 2;
UINT32 numChannels : 1;
UINT32 reserved2 : 1;
UINT32 validWrite : 1;
UINT32 offsetRead : 26;
UINT32 errorStatus : 5;
UINT32 errorSet : 1;
UINT32 loopStartOffset : 26;
UINT32 parserErrorStatus : 5;
UINT32 parserErrorSet : 1;
UINT32 loopEndOffset : 26;
UINT32 packetMetaData : 5;
UINT32 currentBuffer : 1;
UINT32 ptrRead0;
UINT32 ptrRead1;
UINT32 ptrWrite;
UINT32 ptrOverlapAdd;
UINT32 writeBufferOffsetRead : 5;
UINT32 reserved3 : 25;
UINT32 stopWhenDone : 1;
UINT32 interruptWhenDone : 1;
UINT32 reserved4[ 2 ];
UINT32 reserved5[ 1 ];
};
struct SHAPE_PCM_CONTEXT {
UINT32 bufferStart : 32;
UINT32 bufferLength : 21;
UINT32 reserved0 : 11;
UINT32 loopCount : 8;
UINT32 reserved1 : 8;
UINT32 full : 1;
UINT32 reserved2 : 15;
UINT32 readPointer : 21;
UINT32 reserved3 : 11;
UINT32 loopStartWritePointer : 21;
UINT32 reserved4 : 11;
UINT32 loopEnd : 21;
UINT32 reserved5 : 11;
UINT32 mode : 1;
UINT32 reserved6 : 15;
UINT32 format : 2;
UINT32 reserved7 : 14;
UINT32 reserved8;
};

82
dlls/AcpHal/messages.h Normal file
View File

@@ -0,0 +1,82 @@
#pragma once
typedef UINT32 APU_ADDRESS;
struct ACP_MESSAGE_AUDIO_FRAME_START
{
UINT32 audioFrame; // Audio frame index
};
// Flowgraph completed message
// Used by the following messages:
// ACP_MESSAGE_TYPE_FLOWGRAPH_COMPLETED
struct ACP_MESSAGE_FLOWGRAPH_COMPLETED
{
APU_ADDRESS flowgraph; // Flowgraph that completed
};
// SHAPE command is blocked
// Used by the following messages:
// ACP_MESSAGE_TYPE_SRC_BLOCKED
// ACP_MESSAGE_TYPE_DMA_BLOCKED
struct ACP_MESSAGE_SHAPE_COMMAND_BLOCKED
{
UINT32 contextIndex; // Index of context that was blocked
APU_ADDRESS flowgraph; // Flowgraph with blocked context
};
// An ACP command has completed
//
// Command completed messages will only be sent for commands submitted with a non-zero commandId.
// (see IAcpHal::SubmitCommand)
// Used by the following messages:
// ACP_MESSAGE_TYPE_COMMAND_COMPLETED
struct ACP_MESSAGE_COMMAND_COMPLETED
{
UINT32 commandType; // Command type that completed
UINT64 commandId; // Command ID of completed command
UINT32 audioFrame; // Audio frame when command completed
};
// Flowgraph was terminated
// Used by the following messages:
// ACP_MESSAGE_TYPE_FLOWGRAPH_TERMINATED
struct ACP_MESSAGE_FLOWGRAPH_TERMINATED
{
APU_ADDRESS flowgraph; // Flowgraph
UINT32 numCommandsCompleted; // Number of flowgraph commands completed or queued before time ran out
UINT32 reason; // Reason the flowgraph was terminated
};
// Error message
// Used by the following messages:
// ACP_MESSAGE_TYPE_ERROR
//
// errorCode additionalData
// ----------------------------------- ------------------------------------------
// ACP_E_INVALID_FLOWGRAPH Flowgraph APU_ADDRESS
// The specified flowgraph is invalid. Examine the flowgraph entry headers.
// Invalid entries will have the error bit set.
//
// ACP_E_INVALID_COMMAND 'commandId' from IAcpHal::SubmitCommand()
// The command submitted is invalid.
//
// ACP_E_MESSAGE_ALREADY_REGISTERED ACP_MESSAGE_TYPE_*
// An attempt was made to register for a message type that has already been registered.
//
// ACP_E_MESSAGE_NOT_REGISTERED ACP_MESSAGE_TYPE_*
// An attempt was made to unregister a message type that has not been registered.
//
// ACP_E_INVALID_COMMAND_TYPE ACP_COMMAND_TYPE_*
// A submitted command is not of a valid type.
//
// ACP_E_NOT_ALLOCATED 'commandId' from IAcpHal::SubmitCommand()
// A request was made to update a SHAPE flowgraph context that has not been allocated.
//
// ACP_E_XMA_PARSER_ERROR XMA context index
// The specified XMA context generated a parser error.
//
struct ACP_MESSAGE_ERROR
{
HRESULT errorCode; // Error code
UINT32 additionalData; // Additional data relevant to the error
};

View File

@@ -1,7 +1,7 @@
LIBRARY MMDevAPI
EXPORTS
ActivateAudioInterfaceAsync = ActivateAudioInterfaceAsync_X
DllCanUnloadNow = DllCanUnloadNow_X
DllGetClassObject = DllGetClassObject_X
RefreshWasapiDeviceList = RefreshWasapiDeviceList_X
SetWasapiThreadAffinityMask = SetWasapiThreadAffinityMask_X
RestoreBitstreamOut = RestoreBitstreamOut_X
DisableBitstreamOut = DisableBitstreamOut_X
EnableSpatialAudio = EnableSpatialAudio_X
SetWasapiThreadAffinityMask = SetWasapiThreadAffinityMask_X
RefreshWasapiDeviceList = RefreshWasapiDeviceList_X

View File

@@ -1,42 +1,52 @@
#include "pch.h"
#include "framework.h"
void ActivateAudioInterfaceAsync_X()
{
#define MMDEVAPI_EXPORT(Name) __pragma(comment(linker, "/export:" #Name "=C:\\WINDOWS\\System32\\MMDevAPI." #Name))
#define MMDEVAPI_EXPORT_ORDINAL(Name, Ordinal) __pragma(comment(linker, "/export:" #Name "=C:\\WINDOWS\\System32\\MMDevAPI." #Name ",@" #Ordinal))
#define MMDEVAPI_EXPORT_ORDINAL_PRIVATE(Name, Ordinal) __pragma(comment(linker, "/export:" #Name "=C:\\WINDOWS\\System32\\MMDevAPI.#" #Ordinal ",@" #Ordinal ",NONAME"))
}
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(CleanupDeviceAPI, 2)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(InitializeDeviceAPI, 3)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(MMDeviceCreateRegistryPropertyStore, 4)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(MMDeviceGetDeviceEnumerator, 5)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(MMDeviceGetEndpointManager, 6)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(GetClassFromEndpointId, 7)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(GetEndpointGuidFromEndpointId, 8)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(GetSessionIdFromEndpointId, 9)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(RegisterForMediaCallback, 10)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(UnregisterMediaCallback, 11)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(GenerateMediaEvent, 12)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(AETraceOutputDebugString, 13)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(MMDeviceGetPolicyConfig, 14)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(FlushDeviceTopologyCache, 15)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(GetNeverSetAsDefaultProperty, 16)
MMDEVAPI_EXPORT_ORDINAL(ActivateAudioInterfaceAsync, 17)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(GetEndpointIdFromDeviceInterfaceId, 18)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(mmdDevFindMmDevProperty, 19)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(mmdDevGetInterfacePropertyStore, 20)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(mmdDevGetInterfaceIdFromMMDevice, 21)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(mmdDevGetInterfaceDataFlow, 22)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(mmdDevGetMMDeviceFromInterfaceId, 23)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(mmdDevGetInterfaceClassGuid, 24)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(mmdDevGetMMDeviceIdFromInterfaceId, 25)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(mmdDevGetInstanceIdFromInterfaceId, 26)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(mmdDevGetRelatedInterfaceId, 27)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(mmdDevGetInterfaceIdFromMMDeviceId, 28)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(mmdDevGetInstanceIdFromMMDeviceId, 29)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(mmdDevGetEndpointFormFactorFromMMDeviceId, 30)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(mmdDevGetDeviceIdFromPnpInterface, 31)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(GetCategoryPath, 32)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(MMDeviceCreateRegistryPropertyStore2, 33)
MMDEVAPI_EXPORT_ORDINAL_PRIVATE(MMDeviceCreateAudioSystemEffectsPropertyStore, 34)
MMDEVAPI_EXPORT_ORDINAL(DllCanUnloadNow, 35)
MMDEVAPI_EXPORT_ORDINAL(DllGetClassObject, 36)
MMDEVAPI_EXPORT_ORDINAL(DllRegisterServer, 37)
MMDEVAPI_EXPORT_ORDINAL(DllUnregisterServer, 38)
void DisableBitstreamOut_X()
{
}
void DisableBitstreamOut_X( ) {}
HRESULT EnableSpatialAudio_X( ) { return S_OK; }
void RestoreBitstreamOut_X( ) {}
DWORD_PTR SetWasapiThreadAffinityMask_X(DWORD_PTR dwThreadAffinityMask) { return 0; }
void RefreshWasapiDeviceList_X() {}
void DllCanUnloadNow_X()
{
}
void DllGetClassObject_X()
{
}
void EnableSpatialAudio_X()
{
}
void RefreshWasapiDeviceList_X()
{
}
void RestoreBitstreamOut_X()
{
}
void SetWasapiThreadAffinityMask_X()
{
}

View File

@@ -115,6 +115,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -134,6 +135,7 @@
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>

View File

@@ -116,6 +116,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -135,6 +136,7 @@
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>

View File

@@ -115,6 +115,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -133,6 +134,7 @@
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>

View File

@@ -115,6 +115,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -133,6 +134,7 @@
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>

View File

@@ -58,6 +58,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -75,6 +76,7 @@
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>

View File

@@ -118,6 +118,7 @@
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<LanguageStandard>stdcpp20</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -137,6 +138,7 @@
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<LanguageStandard>stdcpp20</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>

View File

@@ -1,99 +0,0 @@
#include "pch.h"
#include "ID3DWrappers.h"
HRESULT d3d11x::ID3D11BufferWrapper::QueryInterface(REFIID riid, void** ppvObject)
{
// DEBUG
char iidstr[ sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}") ];
OLECHAR iidwstr[ sizeof(iidstr) ];
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr));
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr);
printf("[ID3D11BufferWrapper] QueryInterface: %s\n", iidstr);
if (riid == __uuidof(::ID3D11Buffer))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
*ppvObject = nullptr;
return E_NOINTERFACE;
}
ULONG d3d11x::ID3D11BufferWrapper::AddRef( )
{
printf("[ID3D11BufferWrapper] --> AddRef\n");
return InterlockedIncrement(&m_RefCount);
}
ULONG d3d11x::ID3D11BufferWrapper::Release( )
{
//printf("[ID3D11BufferWrapper] --> Release\n");
ULONG refCount = InterlockedDecrement(&m_RefCount);
if (refCount == 0)
{
//printf("[ID3D11BufferWrapper] releasing real buffer at 0x%llX\n", m_realBuffer);
m_realBuffer->Release( );
delete this;
}
return refCount;
}
void __stdcall d3d11x::ID3D11BufferWrapper::GetDevice(ID3D11Device** ppDevice)
{
// Probably not necessary but just to be sure -AleBlbl
::ID3D11Device** device = nullptr;
this->m_realBuffer->GetDevice(device);
ppDevice = reinterpret_cast<ID3D11Device**>(ppDevice);
}
HRESULT __stdcall d3d11x::ID3D11BufferWrapper::GetPrivateData(REFGUID guid, UINT* pDataSize, void* pData)
{
return m_realBuffer->GetPrivateData(guid, pDataSize, pData);
}
HRESULT __stdcall d3d11x::ID3D11BufferWrapper::SetPrivateData(REFGUID guid, UINT DataSize, const void* pData)
{
return m_realBuffer->SetPrivateData(guid, DataSize, pData);
}
HRESULT __stdcall d3d11x::ID3D11BufferWrapper::SetPrivateDataInterface(REFGUID guid, const IUnknown* pData)
{
return m_realBuffer->SetPrivateDataInterface(guid, pData);
}
HRESULT __stdcall d3d11x::ID3D11BufferWrapper::SetName(const wchar_t* name)
{
printf("[ID3D11RenderTargetViewWrapper]: SetName STUB\n");
return S_OK;
}
void __stdcall d3d11x::ID3D11BufferWrapper::GetType(D3D11_RESOURCE_DIMENSION* pResourceDimension)
{
return m_realBuffer->GetType(pResourceDimension);
}
void __stdcall d3d11x::ID3D11BufferWrapper::SetEvictionPriority(UINT EvictionPriority)
{
return m_realBuffer->SetEvictionPriority(EvictionPriority);
}
UINT __stdcall d3d11x::ID3D11BufferWrapper::GetEvictionPriority(void)
{
return m_realBuffer->GetEvictionPriority( );
}
void __stdcall d3d11x::ID3D11BufferWrapper::GetDescriptor(D3D11X_DESCRIPTOR_RESOURCE* descriptor)
{
printf("[ID3D11Texture2DWrapper]: GetDescriptor STUB\n");
}
void __stdcall d3d11x::ID3D11BufferWrapper::GetDesc(D3D11_BUFFER_DESC* pDesc)
{
return m_realBuffer->GetDesc(pDesc);
}

View File

@@ -1,277 +0,0 @@
#include "pch.h"
#include "ID3DWrappers.h"
namespace d3d11x
{
HRESULT ID3D11Texture1DWrapper::QueryInterface(REFIID riid, void** ppvObject)
{
// DEBUG
char iidstr[ sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}") ];
OLECHAR iidwstr[ sizeof(iidstr) ];
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr));
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr);
printf("[ID3D11Texture1DWrapper] QueryInterface: %s\n", iidstr);
if (riid == __uuidof(::ID3D11Texture1D))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
*ppvObject = nullptr;
return E_NOINTERFACE;
}
ULONG ID3D11Texture1DWrapper::AddRef( )
{
printf("[ID3D11Texture1DWrapper] --> AddRef\n");
return InterlockedIncrement(&m_RefCount);
}
ULONG ID3D11Texture1DWrapper::Release( )
{
printf("[ID3D11Texture1DWrapper] --> Release\n");
ULONG refCount = InterlockedDecrement(&m_RefCount);
if (refCount == 0)
delete this;
return refCount;
}
// @Patoke todo: unwrap?
void __stdcall ID3D11Texture1DWrapper::GetDevice(ID3D11Device** ppDevice)
{
// Probably not necessary but just to be sure -AleBlbl
::ID3D11Device** device = nullptr;
this->m_realTexture->GetDevice(device);
ppDevice = reinterpret_cast<ID3D11Device**>(ppDevice);
}
HRESULT __stdcall ID3D11Texture1DWrapper::GetPrivateData(REFGUID guid, UINT* pDataSize, void* pData)
{
return m_realTexture->GetPrivateData(guid, pDataSize, pData);
}
HRESULT __stdcall ID3D11Texture1DWrapper::SetPrivateData(REFGUID guid, UINT DataSize, const void* pData)
{
return m_realTexture->SetPrivateData(guid, DataSize, pData);
}
HRESULT __stdcall ID3D11Texture1DWrapper::SetPrivateDataInterface(REFGUID guid, const IUnknown* pData)
{
return m_realTexture->SetPrivateDataInterface(guid, pData);
}
HRESULT __stdcall ID3D11Texture1DWrapper::SetName(const wchar_t* name)
{
printf("[ID3D11Texture1DWrapper]: SetName STUB\n");
return S_OK;
}
void __stdcall ID3D11Texture1DWrapper::GetType(D3D11_RESOURCE_DIMENSION* pResourceDimension)
{
return m_realTexture->GetType(pResourceDimension);
}
void __stdcall ID3D11Texture1DWrapper::SetEvictionPriority(UINT EvictionPriority)
{
return m_realTexture->SetEvictionPriority(EvictionPriority);
}
UINT __stdcall ID3D11Texture1DWrapper::GetEvictionPriority(void)
{
return m_realTexture->GetEvictionPriority( );
}
void __stdcall ID3D11Texture1DWrapper::GetDescriptor(D3D11X_DESCRIPTOR_RESOURCE* descriptor)
{
printf("[ID3D11Texture1DWrapper]: GetDescriptor STUB\n");
}
void __stdcall ID3D11Texture1DWrapper::GetDesc(D3D11_TEXTURE1D_DESC* pDesc)
{
return m_realTexture->GetDesc(pDesc);
}
HRESULT ID3D11Texture2DWrapper::QueryInterface(REFIID riid, void** ppvObject)
{
// DEBUG
char iidstr[ sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}") ];
OLECHAR iidwstr[ sizeof(iidstr) ];
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr));
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr);
printf("[ID3D11Texture2DWrapper] QueryInterface: %s\n", iidstr);
if (riid == __uuidof(::ID3D11Texture2D))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
*ppvObject = nullptr;
return E_NOINTERFACE;
}
ULONG ID3D11Texture2DWrapper::AddRef( )
{
printf("[ID3D11Texture2DWrapper] --> AddRef\n");
return InterlockedIncrement(&m_RefCount);
}
ULONG ID3D11Texture2DWrapper::Release( )
{
printf("[ID3D11Texture2DWrapper] --> Release\n");
ULONG refCount = InterlockedDecrement(&m_RefCount);
if (refCount == 0)
delete this;
return refCount;
}
// @Patoke todo: unwrap?
void __stdcall ID3D11Texture2DWrapper::GetDevice(ID3D11Device** ppDevice)
{
// Probably not necessary but just to be sure -AleBlbl
::ID3D11Device** device = nullptr;
this->m_realTexture->GetDevice(device);
ppDevice = reinterpret_cast<ID3D11Device**>(ppDevice);
}
HRESULT __stdcall ID3D11Texture2DWrapper::GetPrivateData(REFGUID guid, UINT* pDataSize, void* pData)
{
return m_realTexture->GetPrivateData(guid, pDataSize, pData);
}
HRESULT __stdcall ID3D11Texture2DWrapper::SetPrivateData(REFGUID guid, UINT DataSize, const void* pData)
{
return m_realTexture->SetPrivateData(guid, DataSize, pData);
}
HRESULT __stdcall ID3D11Texture2DWrapper::SetPrivateDataInterface(REFGUID guid, const IUnknown* pData)
{
return m_realTexture->SetPrivateDataInterface(guid, pData);
}
HRESULT __stdcall ID3D11Texture2DWrapper::SetName(const wchar_t* name)
{
printf("[ID3D11Texture2DWrapper]: SetName STUB\n");
return S_OK;
}
void __stdcall ID3D11Texture2DWrapper::GetType(D3D11_RESOURCE_DIMENSION* pResourceDimension)
{
return m_realTexture->GetType(pResourceDimension);
}
void __stdcall ID3D11Texture2DWrapper::SetEvictionPriority(UINT EvictionPriority)
{
return m_realTexture->SetEvictionPriority(EvictionPriority);
}
UINT __stdcall ID3D11Texture2DWrapper::GetEvictionPriority(void)
{
return m_realTexture->GetEvictionPriority();
}
void __stdcall ID3D11Texture2DWrapper::GetDescriptor(D3D11X_DESCRIPTOR_RESOURCE* descriptor)
{
printf("[ID3D11Texture2DWrapper]: GetDescriptor STUB\n");
}
void __stdcall ID3D11Texture2DWrapper::GetDesc(D3D11_TEXTURE2D_DESC* pDesc)
{
return m_realTexture->GetDesc(pDesc);
}
HRESULT ID3D11Texture3DWrapper::QueryInterface(REFIID riid, void** ppvObject)
{
// DEBUG
char iidstr[ sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}") ];
OLECHAR iidwstr[ sizeof(iidstr) ];
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr));
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr);
printf("[ID3D11Texture3DWrapper] QueryInterface: %s\n", iidstr);
if (riid == __uuidof(::ID3D11Texture3D))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
*ppvObject = nullptr;
return E_NOINTERFACE;
}
ULONG ID3D11Texture3DWrapper::AddRef( )
{
printf("[ID3D11Texture3DWrapper] --> AddRef\n");
return InterlockedIncrement(&m_RefCount);
}
ULONG ID3D11Texture3DWrapper::Release( )
{
printf("[ID3D11Texture3DWrapper] --> Release\n");
ULONG refCount = InterlockedDecrement(&m_RefCount);
if (refCount == 0)
delete this;
return refCount;
}
// @Patoke todo: unwrap?
void __stdcall ID3D11Texture3DWrapper::GetDevice(ID3D11Device** ppDevice)
{
// Probably not necessary but just to be sure -AleBlbl
::ID3D11Device** device = nullptr;
this->m_realTexture->GetDevice(device);
ppDevice = reinterpret_cast<ID3D11Device**>(ppDevice);
}
HRESULT __stdcall ID3D11Texture3DWrapper::GetPrivateData(REFGUID guid, UINT* pDataSize, void* pData)
{
return m_realTexture->GetPrivateData(guid, pDataSize, pData);
}
HRESULT __stdcall ID3D11Texture3DWrapper::SetPrivateData(REFGUID guid, UINT DataSize, const void* pData)
{
return m_realTexture->SetPrivateData(guid, DataSize, pData);
}
HRESULT __stdcall ID3D11Texture3DWrapper::SetPrivateDataInterface(REFGUID guid, const IUnknown* pData)
{
return m_realTexture->SetPrivateDataInterface(guid, pData);
}
HRESULT __stdcall ID3D11Texture3DWrapper::SetName(const wchar_t* name)
{
printf("[ID3D11Texture3DWrapper]: SetName STUB\n");
return S_OK;
}
void __stdcall ID3D11Texture3DWrapper::GetType(D3D11_RESOURCE_DIMENSION* pResourceDimension)
{
return m_realTexture->GetType(pResourceDimension);
}
void __stdcall ID3D11Texture3DWrapper::SetEvictionPriority(UINT EvictionPriority)
{
return m_realTexture->SetEvictionPriority(EvictionPriority);
}
UINT __stdcall ID3D11Texture3DWrapper::GetEvictionPriority(void)
{
return m_realTexture->GetEvictionPriority( );
}
void __stdcall ID3D11Texture3DWrapper::GetDescriptor(D3D11X_DESCRIPTOR_RESOURCE* descriptor)
{
printf("[ID3D11Texture3DWrapper]: GetDescriptor STUB\n");
}
void __stdcall ID3D11Texture3DWrapper::GetDesc(D3D11_TEXTURE3D_DESC* pDesc)
{
return m_realTexture->GetDesc(pDesc);
}
}

View File

@@ -1,333 +0,0 @@
#include "pch.h"
#include "ID3DWrappers.h"
namespace d3d11x
{
HRESULT ID3D11RenderTargetViewWrapper::QueryInterface(REFIID riid, void** ppvObject)
{
if (riid == __uuidof(::ID3D11RenderTargetView))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
// DEBUG
char iidstr[ sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}") ];
OLECHAR iidwstr[ sizeof(iidstr) ];
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr));
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr);
printf("[IDXGIDeviceWrapper] QueryInterface: %s\n", iidstr);
*ppvObject = nullptr;
return E_NOINTERFACE;
}
ULONG ID3D11RenderTargetViewWrapper::AddRef( )
{
printf("[ID3D11RenderTargetViewWrapper] --> AddRef\n");
return InterlockedIncrement(&m_RefCount);
}
ULONG ID3D11RenderTargetViewWrapper::Release( )
{
printf("[ID3D11RenderTargetViewWrapper] --> Release\n");
ULONG refCount = InterlockedDecrement(&m_RefCount);
if (refCount == 0)
delete this;
return refCount;
}
void __stdcall ID3D11RenderTargetViewWrapper::GetDevice(ID3D11Device** ppDevice)
{
// Probably not necessary but just to be sure -AleBlbl
::ID3D11Device** device = nullptr;
this->m_realTarget->GetDevice(device);
ppDevice = reinterpret_cast<ID3D11Device**>(ppDevice);
}
HRESULT __stdcall ID3D11RenderTargetViewWrapper::GetPrivateData(REFGUID guid, UINT* pDataSize, void* pData)
{
return m_realTarget->GetPrivateData(guid, pDataSize, pData);
}
HRESULT __stdcall ID3D11RenderTargetViewWrapper::SetPrivateData(REFGUID guid, UINT DataSize, const void* pData)
{
return m_realTarget->SetPrivateData(guid, DataSize, pData);
}
HRESULT __stdcall ID3D11RenderTargetViewWrapper::SetPrivateDataInterface(REFGUID guid, const IUnknown* pData)
{
return m_realTarget->SetPrivateDataInterface(guid, pData);
}
HRESULT __stdcall ID3D11RenderTargetViewWrapper::SetName(const wchar_t* name)
{
printf("[ID3D11RenderTargetViewWrapper]: SetName STUB\n");
return S_OK;
}
void __stdcall ID3D11RenderTargetViewWrapper::GetResource(ID3D11Resource** ppResource)
{
D3D11_RENDER_TARGET_VIEW_DESC desc;
m_realTarget->GetDesc(&desc);
printf("RenderTargetView GetResource Dimension: %i\n", desc.ViewDimension);
::ID3D11Texture2D* texture2d = nullptr;
m_realTarget->GetResource(reinterpret_cast<::ID3D11Resource**>(&texture2d));
*reinterpret_cast<ID3D11Texture2D_X**>(ppResource) = new ID3D11Texture2DWrapper(texture2d);
}
void __stdcall ID3D11RenderTargetViewWrapper::GetDesc(D3D11_RENDER_TARGET_VIEW_DESC* pDesc)
{
m_realTarget->GetDesc(pDesc);
}
HRESULT ID3D11DepthStencilViewWrapper::QueryInterface(REFIID riid, void** ppvObject)
{
if (riid == __uuidof(::ID3D11DepthStencilView))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
// DEBUG
char iidstr[ sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}") ];
OLECHAR iidwstr[ sizeof(iidstr) ];
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr));
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr);
printf("[IDXGIDeviceWrapper] QueryInterface: %s\n", iidstr);
*ppvObject = nullptr;
return E_NOINTERFACE;
}
ULONG ID3D11DepthStencilViewWrapper::AddRef( )
{
printf("[ID3D11DepthStencilViewWrapper] --> AddRef\n");
return InterlockedIncrement(&m_RefCount);
}
ULONG ID3D11DepthStencilViewWrapper::Release( )
{
printf("[ID3D11DepthStencilViewWrapper] --> Release\n");
ULONG refCount = InterlockedDecrement(&m_RefCount);
if (refCount == 0)
delete this;
return refCount;
}
void __stdcall ID3D11DepthStencilViewWrapper::GetDevice(ID3D11Device** ppDevice)
{
// Probably not necessary but just to be sure -AleBlbl
::ID3D11Device** device = nullptr;
this->m_realTarget->GetDevice(device);
ppDevice = reinterpret_cast<ID3D11Device**>(ppDevice);
}
HRESULT __stdcall ID3D11DepthStencilViewWrapper::GetPrivateData(REFGUID guid, UINT* pDataSize, void* pData)
{
return m_realTarget->GetPrivateData(guid, pDataSize, pData);
}
HRESULT __stdcall ID3D11DepthStencilViewWrapper::SetPrivateData(REFGUID guid, UINT DataSize, const void* pData)
{
return m_realTarget->SetPrivateData(guid, DataSize, pData);
}
HRESULT __stdcall ID3D11DepthStencilViewWrapper::SetPrivateDataInterface(REFGUID guid, const IUnknown* pData)
{
return m_realTarget->SetPrivateDataInterface(guid, pData);
}
HRESULT __stdcall ID3D11DepthStencilViewWrapper::SetName(const wchar_t* name)
{
printf("[ID3D11DepthStencilViewWrapper]: SetName STUB\n");
return S_OK;
}
void __stdcall ID3D11DepthStencilViewWrapper::GetResource(ID3D11Resource** ppResource)
{
D3D11_DEPTH_STENCIL_VIEW_DESC desc;
m_realTarget->GetDesc(&desc);
printf("DepthStencilView GetResource Dimension: %i\n", desc.ViewDimension);
::ID3D11Texture2D* texture2d = nullptr;
m_realTarget->GetResource(reinterpret_cast<::ID3D11Resource**>(&texture2d));
*reinterpret_cast<ID3D11Texture2D_X**>(ppResource) = new ID3D11Texture2DWrapper(texture2d);
}
void __stdcall ID3D11DepthStencilViewWrapper::GetDesc(D3D11_DEPTH_STENCIL_VIEW_DESC* pDesc)
{
m_realTarget->GetDesc(pDesc);
}
HRESULT ID3D11ShaderResourceViewWrapper::QueryInterface(REFIID riid, void** ppvObject)
{
if (riid == __uuidof(::ID3D11ShaderResourceView))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
// DEBUG
char iidstr[ sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}") ];
OLECHAR iidwstr[ sizeof(iidstr) ];
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr));
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr);
printf("[IDXGIDeviceWrapper] QueryInterface: %s\n", iidstr);
*ppvObject = nullptr;
return E_NOINTERFACE;
}
ULONG ID3D11ShaderResourceViewWrapper::AddRef( )
{
printf("[ID3D11ShaderResourceViewWrapper] --> AddRef\n");
return InterlockedIncrement(&m_RefCount);
}
ULONG ID3D11ShaderResourceViewWrapper::Release( )
{
printf("[ID3D11ShaderResourceViewWrapper] --> Release\n");
ULONG refCount = InterlockedDecrement(&m_RefCount);
if (refCount == 0)
{
m_realTarget->Release( );
delete this;
}
return refCount;
}
void __stdcall ID3D11ShaderResourceViewWrapper::GetDevice(ID3D11Device** ppDevice)
{
// Probably not necessary but just to be sure -AleBlbl
::ID3D11Device** device = nullptr;
this->m_realTarget->GetDevice(device);
ppDevice = reinterpret_cast<ID3D11Device**>(ppDevice);
}
HRESULT __stdcall ID3D11ShaderResourceViewWrapper::GetPrivateData(REFGUID guid, UINT* pDataSize, void* pData)
{
return m_realTarget->GetPrivateData(guid, pDataSize, pData);
}
HRESULT __stdcall ID3D11ShaderResourceViewWrapper::SetPrivateData(REFGUID guid, UINT DataSize, const void* pData)
{
return m_realTarget->SetPrivateData(guid, DataSize, pData);
}
HRESULT __stdcall ID3D11ShaderResourceViewWrapper::SetPrivateDataInterface(REFGUID guid, const IUnknown* pData)
{
return m_realTarget->SetPrivateDataInterface(guid, pData);
}
HRESULT __stdcall ID3D11ShaderResourceViewWrapper::SetName(const wchar_t* name)
{
printf("[ID3D11ShaderResourceViewWrapper]: SetName STUB\n");
return S_OK;
}
void __stdcall ID3D11ShaderResourceViewWrapper::GetResource(ID3D11Resource** ppResource)
{
D3D11_SHADER_RESOURCE_VIEW_DESC desc;
m_realTarget->GetDesc(&desc);
printf("ShaderResourceView GetResource Dimension: %i\n", desc.ViewDimension);
::ID3D11Texture2D* texture2d = nullptr;
m_realTarget->GetResource(reinterpret_cast<::ID3D11Resource**>(&texture2d));
*reinterpret_cast<ID3D11Texture2D_X**>(ppResource) = new ID3D11Texture2DWrapper(texture2d);
}
void __stdcall ID3D11ShaderResourceViewWrapper::GetDesc(D3D11_SHADER_RESOURCE_VIEW_DESC* pDesc)
{
m_realTarget->GetDesc(pDesc);
}
HRESULT ID3D11UnorderedAccessViewWrapper::QueryInterface(REFIID riid, void** ppvObject)
{
if (riid == __uuidof(::ID3D11UnorderedAccessView))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
// DEBUG
char iidstr[ sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}") ];
OLECHAR iidwstr[ sizeof(iidstr) ];
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr));
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr);
printf("[IDXGIDeviceWrapper] QueryInterface: %s\n", iidstr);
*ppvObject = nullptr;
return E_NOINTERFACE;
}
ULONG ID3D11UnorderedAccessViewWrapper::AddRef( )
{
printf("[ID3D11UnorderedAccessViewWrapper] --> AddRef\n");
return InterlockedIncrement(&m_RefCount);
}
ULONG ID3D11UnorderedAccessViewWrapper::Release( )
{
printf("[ID3D11UnorderedAccessViewWrapper] --> Release\n");
ULONG refCount = InterlockedDecrement(&m_RefCount);
if (refCount == 0)
delete this;
return refCount;
}
void __stdcall ID3D11UnorderedAccessViewWrapper::GetDevice(ID3D11Device** ppDevice)
{
// Probably not necessary but just to be sure -AleBlbl
::ID3D11Device** device = nullptr;
this->m_realTarget->GetDevice(device);
ppDevice = reinterpret_cast<ID3D11Device**>(ppDevice);
}
HRESULT __stdcall ID3D11UnorderedAccessViewWrapper::GetPrivateData(REFGUID guid, UINT* pDataSize, void* pData)
{
return m_realTarget->GetPrivateData(guid, pDataSize, pData);
}
HRESULT __stdcall ID3D11UnorderedAccessViewWrapper::SetPrivateData(REFGUID guid, UINT DataSize, const void* pData)
{
return m_realTarget->SetPrivateData(guid, DataSize, pData);
}
HRESULT __stdcall ID3D11UnorderedAccessViewWrapper::SetPrivateDataInterface(REFGUID guid, const IUnknown* pData)
{
return m_realTarget->SetPrivateDataInterface(guid, pData);
}
HRESULT __stdcall ID3D11UnorderedAccessViewWrapper::SetName(const wchar_t* name)
{
printf("[ID3D11UnorderedAccessViewWrapper]: SetName STUB\n");
return S_OK;
}
void __stdcall ID3D11UnorderedAccessViewWrapper::GetResource(ID3D11Resource** ppResource)
{
D3D11_UNORDERED_ACCESS_VIEW_DESC desc;
m_realTarget->GetDesc(&desc);
printf("UnorderedAccessView GetResource Dimension: %i\n", desc.ViewDimension);
::ID3D11Texture2D* texture2d = nullptr;
m_realTarget->GetResource(reinterpret_cast<::ID3D11Resource**>(&texture2d));
*reinterpret_cast<ID3D11Texture2D_X**>(ppResource) = new ID3D11Texture2DWrapper(texture2d);
}
void __stdcall ID3D11UnorderedAccessViewWrapper::GetDesc(D3D11_UNORDERED_ACCESS_VIEW_DESC* pDesc)
{
m_realTarget->GetDesc(pDesc);
}
}

View File

@@ -1,837 +0,0 @@
#pragma once
#include "ID3DX.h"
#include <cstdint>
#include <array>
namespace d3d11x
{
struct D3D11XTinyDevice
{
unsigned int m_Reserved1[ 8 ];
unsigned int* m_pBatchCurrent;
unsigned int* m_pBatchLimit;
unsigned int* m_pCeCurrent;
unsigned int* m_pCeBiasedLimit;
unsigned int* m_pCeLimit;
unsigned int m_Reserved2[ 64 ];
};
struct D3D11XShaderUserDataManagerDraw
{
unsigned int m_DirtyFlags;
unsigned int m_Reserved1;
unsigned __int64 m_Topology;
ID3D11InputLayout* m_pInputLayout;
ID3D11VertexShader* m_pVs;
ID3D11PixelShader* m_pPs;
unsigned int m_Reserved2[ 128 ];
};
struct D3D11X_COUNTER_DATA
{
unsigned int Size;
unsigned int Version;
unsigned __int64 GRBM[ 2 ][ 1 ];
unsigned __int64 SRBM[ 2 ][ 1 ];
unsigned __int64 CPF[ 2 ][ 1 ];
unsigned __int64 CPG[ 2 ][ 1 ];
unsigned __int64 CPC[ 2 ][ 1 ];
unsigned __int64 CB[ 4 ][ 8 ];
unsigned __int64 DB[ 4 ][ 8 ];
unsigned __int64 SU[ 4 ][ 4 ];
unsigned __int64 SC[ 8 ][ 4 ];
unsigned __int64 SX[ 8 ][ 4 ];
unsigned __int64 SPI[ 4 ][ 4 ];
unsigned __int64 SQ[ 16 ][ 4 ];
unsigned __int64 TA[ 5 ][ 40 ];
unsigned __int64 TD[ 2 ][ 40 ];
unsigned __int64 TCP[ 8 ][ 40 ];
unsigned __int64 TCC[ 4 ][ 8 ];
unsigned __int64 TCA[ 4 ][ 2 ];
unsigned __int64 GDS[ 4 ][ 1 ];
unsigned __int64 VGT[ 4 ][ 4 ];
unsigned __int64 IA[ 4 ][ 2 ];
unsigned __int64 WD[ 4 ][ 1 ];
unsigned __int64 MC_MCB_L1TLB[ 4 ][ 1 ];
unsigned __int64 MC_HV_MCB_L1TLB[ 4 ][ 1 ];
unsigned __int64 MC_MCD_L1TLB[ 4 ][ 2 ];
unsigned __int64 MC_HV_MCD_L1TLB[ 4 ][ 2 ];
unsigned __int64 MC_L2TLB[ 2 ][ 1 ];
unsigned __int64 MC_HV_L2TLB[ 2 ][ 1 ];
unsigned __int64 MC_ARB[ 4 ][ 6 ];
unsigned __int64 MC_CITF[ 4 ][ 4 ];
unsigned __int64 MC_HUB[ 4 ][ 1 ];
unsigned __int64 GRN[ 4 ][ 1 ];
unsigned __int64 GRN1[ 4 ][ 1 ];
unsigned __int64 GRN2[ 4 ][ 1 ];
};
enum D3D11_STAGE : __int32
{
D3D11_STAGE_VS = 0x0,
D3D11_STAGE_HS = 0x1,
D3D11_STAGE_DS = 0x2,
D3D11_STAGE_GS = 0x3,
D3D11_STAGE_PS = 0x4,
D3D11_STAGE_CS = 0x5,
};
enum D3D11X_GPU_PIPELINED_EVENT : __int32
{
D3D11X_GPU_PIPELINED_EVENT_STREAMOUT_FLUSH = 0x1F,
D3D11X_GPU_PIPELINED_EVENT_FLUSH_AND_INV_CB_PIXEL_DATA = 0x31,
D3D11X_GPU_PIPELINED_EVENT_DB_CACHE_FLUSH_AND_INV = 0x2A,
D3D11X_GPU_PIPELINED_EVENT_FLUSH_AND_INV_CB_META = 0x2E,
D3D11X_GPU_PIPELINED_EVENT_FLUSH_AND_INV_DB_META = 0x2C,
D3D11X_GPU_PIPELINED_EVENT_CS_PARTIAL_FLUSH = 0x407,
D3D11X_GPU_PIPELINED_EVENT_VS_PARTIAL_FLUSH = 0x40F,
D3D11X_GPU_PIPELINED_EVENT_PS_PARTIAL_FLUSH = 0x410,
D3D11X_GPU_PIPELINED_EVENT_PFP_SYNC_ME = 0x80000001,
D3D11X_GPU_PIPELINED_EVENT_INDEX_MASK = 0xF00,
D3D11X_GPU_PIPELINED_EVENT_INDEX_SHIFT = 0x8,
D3D11X_GPU_PIPELINED_EVENT_TYPE_MASK = 0x3F,
D3D11X_GPU_PIPELINED_EVENT_TYPE_SHIFT = 0x0,
D3D11X_GPU_PIPELINED_EVENT_SPECIAL_MASK = 0x80000000,
};
enum _D3D11X_GDS_REGION_TYPE : __int32
{
D3D11X_GDS_REGION_PS = 0x0,
D3D11X_GDS_REGION_CS = 0x1,
D3D11X_GDS_REGION_ALL_MEMORY = 0x2,
};
struct D3D11X_FORMAT
{
// @Patoke todo: implement
unsigned __int64 pad;
};
enum D3D11X_HW_STAGE : __int32
{
D3D11X_HW_STAGE_PS = 0x0,
D3D11X_HW_STAGE_VS = 0x1,
D3D11X_HW_STAGE_GS = 0x2,
D3D11X_HW_STAGE_ES = 0x3,
D3D11X_HW_STAGE_HS = 0x4,
D3D11X_HW_STAGE_LS = 0x5,
D3D11X_HW_STAGE_CS = 0x6,
};
MIDL_INTERFACE("c0bfa96c-e089-44fb-8eaf-26f8796190da")
ID3D11DeviceContext : public ID3D11DeviceChild_X
{
public:
virtual void STDMETHODCALLTYPE VSSetConstantBuffers(
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) UINT NumBuffers,
_In_reads_opt_(NumBuffers) ID3D11Buffer* const* ppConstantBuffers) = 0;
virtual void STDMETHODCALLTYPE PSSetShaderResources(
_In_range_(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot) UINT NumViews,
_In_reads_opt_(NumViews) ID3D11ShaderResourceView* const* ppShaderResourceViews) = 0;
virtual void STDMETHODCALLTYPE PSSetShader(
_In_opt_ ID3D11PixelShader* pPixelShader,
_In_reads_opt_(NumClassInstances) ID3D11ClassInstance* const* ppClassInstances,
UINT NumClassInstances) = 0;
virtual void STDMETHODCALLTYPE PSSetSamplers(
_In_range_(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot) UINT NumSamplers,
_In_reads_opt_(NumSamplers) ID3D11SamplerState* const* ppSamplers) = 0;
virtual void STDMETHODCALLTYPE VSSetShader(
_In_opt_ ID3D11VertexShader* pVertexShader,
_In_reads_opt_(NumClassInstances) ID3D11ClassInstance* const* ppClassInstances,
UINT NumClassInstances) = 0;
virtual void STDMETHODCALLTYPE DrawIndexed(
_In_ UINT IndexCount,
_In_ UINT StartIndexLocation,
_In_ INT BaseVertexLocation) = 0;
virtual void STDMETHODCALLTYPE Draw(
_In_ UINT VertexCount,
_In_ UINT StartVertexLocation) = 0;
virtual HRESULT STDMETHODCALLTYPE Map(
_In_ ID3D11Resource* pResource,
_In_ UINT Subresource,
_In_ D3D11_MAP MapType,
_In_ UINT MapFlags,
_Out_opt_ D3D11_MAPPED_SUBRESOURCE* pMappedResource) = 0;
virtual void STDMETHODCALLTYPE Unmap(
_In_ ID3D11Resource* pResource,
_In_ UINT Subresource) = 0;
virtual void STDMETHODCALLTYPE PSSetConstantBuffers(
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) UINT NumBuffers,
_In_reads_opt_(NumBuffers) ID3D11Buffer* const* ppConstantBuffers) = 0;
virtual void STDMETHODCALLTYPE IASetInputLayout(
_In_opt_ ID3D11InputLayout* pInputLayout) = 0;
virtual void STDMETHODCALLTYPE IASetVertexBuffers(
_In_range_(0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot) UINT NumBuffers,
_In_reads_opt_(NumBuffers) ID3D11Buffer* const* ppVertexBuffers,
_In_reads_opt_(NumBuffers) const UINT* pStrides,
_In_reads_opt_(NumBuffers) const UINT* pOffsets) = 0;
virtual void STDMETHODCALLTYPE IASetIndexBuffer(
_In_opt_ ID3D11Buffer* pIndexBuffer,
_In_ DXGI_FORMAT Format,
_In_ UINT Offset) = 0;
virtual void STDMETHODCALLTYPE DrawIndexedInstanced(
_In_ UINT IndexCountPerInstance,
_In_ UINT InstanceCount,
_In_ UINT StartIndexLocation,
_In_ INT BaseVertexLocation,
_In_ UINT StartInstanceLocation) = 0;
virtual void STDMETHODCALLTYPE DrawInstanced(
_In_ UINT VertexCountPerInstance,
_In_ UINT InstanceCount,
_In_ UINT StartVertexLocation,
_In_ UINT StartInstanceLocation) = 0;
virtual void STDMETHODCALLTYPE GSSetConstantBuffers(
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) UINT NumBuffers,
_In_reads_opt_(NumBuffers) ID3D11Buffer* const* ppConstantBuffers) = 0;
virtual void STDMETHODCALLTYPE GSSetShader(
_In_opt_ ID3D11GeometryShader* pShader,
_In_reads_opt_(NumClassInstances) ID3D11ClassInstance* const* ppClassInstances,
UINT NumClassInstances) = 0;
virtual void STDMETHODCALLTYPE VSSetShaderResources(
_In_range_(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot) UINT NumViews,
_In_reads_opt_(NumViews) ID3D11ShaderResourceView* const* ppShaderResourceViews) = 0;
virtual void STDMETHODCALLTYPE VSSetSamplers(
_In_range_(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot) UINT NumSamplers,
_In_reads_opt_(NumSamplers) ID3D11SamplerState* const* ppSamplers) = 0;
virtual void STDMETHODCALLTYPE Begin(
_In_ ID3D11Asynchronous* pAsync) = 0;
virtual void STDMETHODCALLTYPE End(
_In_ ID3D11Asynchronous* pAsync) = 0;
virtual HRESULT STDMETHODCALLTYPE GetData(
_In_ ID3D11Asynchronous* pAsync,
_Out_writes_bytes_opt_(DataSize) void* pData,
_In_ UINT DataSize,
_In_ UINT GetDataFlags) = 0;
virtual void STDMETHODCALLTYPE SetPredication(
_In_opt_ ID3D11Predicate* pPredicate,
_In_ BOOL PredicateValue) = 0;
virtual void STDMETHODCALLTYPE GSSetShaderResources(
_In_range_(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot) UINT NumViews,
_In_reads_opt_(NumViews) ID3D11ShaderResourceView* const* ppShaderResourceViews) = 0;
virtual void STDMETHODCALLTYPE GSSetSamplers(
_In_range_(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot) UINT NumSamplers,
_In_reads_opt_(NumSamplers) ID3D11SamplerState* const* ppSamplers) = 0;
virtual void STDMETHODCALLTYPE OMSetRenderTargets(
_In_range_(0, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT) UINT NumViews,
_In_reads_opt_(NumViews) ID3D11RenderTargetView* const* ppRenderTargetViews,
_In_opt_ ID3D11DepthStencilView* pDepthStencilView) = 0;
virtual void STDMETHODCALLTYPE OMSetRenderTargetsAndUnorderedAccessViews(
_In_ UINT NumRTVs,
_In_reads_opt_(NumRTVs) ID3D11RenderTargetView* const* ppRenderTargetViews,
_In_opt_ ID3D11DepthStencilView* pDepthStencilView,
_In_range_(0, D3D11_1_UAV_SLOT_COUNT - 1) UINT UAVStartSlot,
_In_ UINT NumUAVs,
_In_reads_opt_(NumUAVs) ID3D11UnorderedAccessView* const* ppUnorderedAccessViews,
_In_reads_opt_(NumUAVs) const UINT* pUAVInitialCounts) = 0;
virtual void STDMETHODCALLTYPE OMSetBlendState(
_In_opt_ ID3D11BlendState* pBlendState,
_In_opt_ const FLOAT BlendFactor[ 4 ],
_In_ UINT SampleMask) = 0;
virtual void STDMETHODCALLTYPE OMSetDepthStencilState(
_In_opt_ ID3D11DepthStencilState* pDepthStencilState,
_In_ UINT StencilRef) = 0;
virtual void STDMETHODCALLTYPE SOSetTargets(
_In_range_(0, D3D11_SO_BUFFER_SLOT_COUNT) UINT NumBuffers,
_In_reads_opt_(NumBuffers) ID3D11Buffer* const* ppSOTargets,
_In_reads_opt_(NumBuffers) const UINT* pOffsets) = 0;
virtual void STDMETHODCALLTYPE DrawAuto(void) = 0;
virtual void STDMETHODCALLTYPE DrawIndexedInstancedIndirect(
_In_ ID3D11Buffer* pBufferForArgs,
_In_ UINT AlignedByteOffsetForArgs) = 0;
virtual void STDMETHODCALLTYPE DrawInstancedIndirect(
_In_ ID3D11Buffer* pBufferForArgs,
_In_ UINT AlignedByteOffsetForArgs) = 0;
virtual void STDMETHODCALLTYPE Dispatch(
_In_ UINT ThreadGroupCountX,
_In_ UINT ThreadGroupCountY,
_In_ UINT ThreadGroupCountZ) = 0;
virtual void STDMETHODCALLTYPE DispatchIndirect(
_In_ ID3D11Buffer* pBufferForArgs,
_In_ UINT AlignedByteOffsetForArgs) = 0;
virtual void STDMETHODCALLTYPE RSSetState(
_In_opt_ ID3D11RasterizerState* pRasterizerState) = 0;
virtual void STDMETHODCALLTYPE RSSetViewports(
_In_range_(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports,
_In_reads_opt_(NumViewports) const D3D11_VIEWPORT* pViewports) = 0;
virtual void STDMETHODCALLTYPE RSSetScissorRects(
_In_range_(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects,
_In_reads_opt_(NumRects) const D3D11_RECT* pRects) = 0;
virtual void STDMETHODCALLTYPE CopySubresourceRegion(
_In_ ID3D11Resource* pDstResource,
_In_ UINT DstSubresource,
_In_ UINT DstX,
_In_ UINT DstY,
_In_ UINT DstZ,
_In_ ID3D11Resource* pSrcResource,
_In_ UINT SrcSubresource,
_In_opt_ const D3D11_BOX* pSrcBox) = 0;
virtual void STDMETHODCALLTYPE CopyResource(
_In_ ID3D11Resource* pDstResource,
_In_ ID3D11Resource* pSrcResource) = 0;
virtual void STDMETHODCALLTYPE UpdateSubresource(
_In_ ID3D11Resource* pDstResource,
_In_ UINT DstSubresource,
_In_opt_ const D3D11_BOX* pDstBox,
_In_ const void* pSrcData,
_In_ UINT SrcRowPitch,
_In_ UINT SrcDepthPitch) = 0;
virtual void STDMETHODCALLTYPE CopyStructureCount(
_In_ ID3D11Buffer* pDstBuffer,
_In_ UINT DstAlignedByteOffset,
_In_ ID3D11UnorderedAccessView* pSrcView) = 0;
virtual void STDMETHODCALLTYPE ClearRenderTargetView(
_In_ ID3D11RenderTargetView* pRenderTargetView,
_In_ const FLOAT ColorRGBA[ 4 ]) = 0;
virtual void STDMETHODCALLTYPE ClearUnorderedAccessViewUint(
_In_ ID3D11UnorderedAccessView* pUnorderedAccessView,
_In_ const UINT Values[ 4 ]) = 0;
virtual void STDMETHODCALLTYPE ClearUnorderedAccessViewFloat(
_In_ ID3D11UnorderedAccessView* pUnorderedAccessView,
_In_ const FLOAT Values[ 4 ]) = 0;
virtual void STDMETHODCALLTYPE ClearDepthStencilView(
_In_ ID3D11DepthStencilView* pDepthStencilView,
_In_ UINT ClearFlags,
_In_ FLOAT Depth,
_In_ UINT8 Stencil) = 0;
virtual void STDMETHODCALLTYPE GenerateMips(
_In_ ID3D11ShaderResourceView* pShaderResourceView) = 0;
virtual void STDMETHODCALLTYPE SetResourceMinLOD(
_In_ ID3D11Resource* pResource,
FLOAT MinLOD) = 0;
virtual FLOAT STDMETHODCALLTYPE GetResourceMinLOD(
_In_ ID3D11Resource* pResource) = 0;
virtual void STDMETHODCALLTYPE ResolveSubresource(
_In_ ID3D11Resource* pDstResource,
_In_ UINT DstSubresource,
_In_ ID3D11Resource* pSrcResource,
_In_ UINT SrcSubresource,
_In_ DXGI_FORMAT Format) = 0;
virtual void STDMETHODCALLTYPE ExecuteCommandList(
_In_ ID3D11CommandList* pCommandList,
BOOL RestoreContextState) = 0;
virtual void STDMETHODCALLTYPE HSSetShaderResources(
_In_range_(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot) UINT NumViews,
_In_reads_opt_(NumViews) ID3D11ShaderResourceView* const* ppShaderResourceViews) = 0;
virtual void STDMETHODCALLTYPE HSSetShader(
_In_opt_ ID3D11HullShader* pHullShader,
_In_reads_opt_(NumClassInstances) ID3D11ClassInstance* const* ppClassInstances,
UINT NumClassInstances) = 0;
virtual void STDMETHODCALLTYPE HSSetSamplers(
_In_range_(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot) UINT NumSamplers,
_In_reads_opt_(NumSamplers) ID3D11SamplerState* const* ppSamplers) = 0;
virtual void STDMETHODCALLTYPE HSSetConstantBuffers(
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) UINT NumBuffers,
_In_reads_opt_(NumBuffers) ID3D11Buffer* const* ppConstantBuffers) = 0;
virtual void STDMETHODCALLTYPE DSSetShaderResources(
_In_range_(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot) UINT NumViews,
_In_reads_opt_(NumViews) ID3D11ShaderResourceView* const* ppShaderResourceViews) = 0;
virtual void STDMETHODCALLTYPE DSSetShader(
_In_opt_ ID3D11DomainShader* pDomainShader,
_In_reads_opt_(NumClassInstances) ID3D11ClassInstance* const* ppClassInstances,
UINT NumClassInstances) = 0;
virtual void STDMETHODCALLTYPE DSSetSamplers(
_In_range_(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot) UINT NumSamplers,
_In_reads_opt_(NumSamplers) ID3D11SamplerState* const* ppSamplers) = 0;
virtual void STDMETHODCALLTYPE DSSetConstantBuffers(
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) UINT NumBuffers,
_In_reads_opt_(NumBuffers) ID3D11Buffer* const* ppConstantBuffers) = 0;
virtual void STDMETHODCALLTYPE CSSetShaderResources(
_In_range_(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot) UINT NumViews,
_In_reads_opt_(NumViews) ID3D11ShaderResourceView* const* ppShaderResourceViews) = 0;
virtual void STDMETHODCALLTYPE CSSetUnorderedAccessViews(
_In_range_(0, D3D11_1_UAV_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_1_UAV_SLOT_COUNT - StartSlot) UINT NumUAVs,
_In_reads_opt_(NumUAVs) ID3D11UnorderedAccessView* const* ppUnorderedAccessViews,
_In_reads_opt_(NumUAVs) const UINT* pUAVInitialCounts) = 0;
virtual void STDMETHODCALLTYPE CSSetShader(
_In_opt_ ID3D11ComputeShader* pComputeShader,
_In_reads_opt_(NumClassInstances) ID3D11ClassInstance* const* ppClassInstances,
UINT NumClassInstances) = 0;
virtual void STDMETHODCALLTYPE CSSetSamplers(
_In_range_(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot) UINT NumSamplers,
_In_reads_opt_(NumSamplers) ID3D11SamplerState* const* ppSamplers) = 0;
virtual void STDMETHODCALLTYPE CSSetConstantBuffers(
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) UINT NumBuffers,
_In_reads_opt_(NumBuffers) ID3D11Buffer* const* ppConstantBuffers) = 0;
virtual void STDMETHODCALLTYPE VSGetConstantBuffers(
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) UINT NumBuffers,
_Out_writes_opt_(NumBuffers) ID3D11Buffer** ppConstantBuffers) = 0;
virtual void STDMETHODCALLTYPE PSGetShaderResources(
_In_range_(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot) UINT NumViews,
_Out_writes_opt_(NumViews) ID3D11ShaderResourceView** ppShaderResourceViews) = 0;
virtual void STDMETHODCALLTYPE PSGetShader(
_Outptr_result_maybenull_ ID3D11PixelShader** ppPixelShader,
_Out_writes_opt_(*pNumClassInstances) ID3D11ClassInstance** ppClassInstances,
_Inout_opt_ UINT* pNumClassInstances) = 0;
virtual void STDMETHODCALLTYPE PSGetSamplers(
_In_range_(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot) UINT NumSamplers,
_Out_writes_opt_(NumSamplers) ID3D11SamplerState** ppSamplers) = 0;
virtual void STDMETHODCALLTYPE VSGetShader(
_Outptr_result_maybenull_ ID3D11VertexShader** ppVertexShader,
_Out_writes_opt_(*pNumClassInstances) ID3D11ClassInstance** ppClassInstances,
_Inout_opt_ UINT* pNumClassInstances) = 0;
virtual void STDMETHODCALLTYPE PSGetConstantBuffers(
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) UINT NumBuffers,
_Out_writes_opt_(NumBuffers) ID3D11Buffer** ppConstantBuffers) = 0;
virtual void STDMETHODCALLTYPE IAGetInputLayout(
_Outptr_result_maybenull_ ID3D11InputLayout** ppInputLayout) = 0;
virtual void STDMETHODCALLTYPE IAGetVertexBuffers(
_In_range_(0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot) UINT NumBuffers,
_Out_writes_opt_(NumBuffers) ID3D11Buffer** ppVertexBuffers,
_Out_writes_opt_(NumBuffers) UINT* pStrides,
_Out_writes_opt_(NumBuffers) UINT* pOffsets) = 0;
virtual void STDMETHODCALLTYPE IAGetIndexBuffer(
_Outptr_opt_result_maybenull_ ID3D11Buffer** pIndexBuffer,
_Out_opt_ DXGI_FORMAT* Format,
_Out_opt_ UINT* Offset) = 0;
virtual void STDMETHODCALLTYPE GSGetConstantBuffers(
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) UINT NumBuffers,
_Out_writes_opt_(NumBuffers) ID3D11Buffer** ppConstantBuffers) = 0;
virtual void STDMETHODCALLTYPE GSGetShader(
_Outptr_result_maybenull_ ID3D11GeometryShader** ppGeometryShader,
_Out_writes_opt_(*pNumClassInstances) ID3D11ClassInstance** ppClassInstances,
_Inout_opt_ UINT* pNumClassInstances) = 0;
virtual void STDMETHODCALLTYPE IAGetPrimitiveTopology(
_Out_ D3D11_PRIMITIVE_TOPOLOGY* pTopology) = 0;
virtual void STDMETHODCALLTYPE VSGetShaderResources(
_In_range_(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot) UINT NumViews,
_Out_writes_opt_(NumViews) ID3D11ShaderResourceView** ppShaderResourceViews) = 0;
virtual void STDMETHODCALLTYPE VSGetSamplers(
_In_range_(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot) UINT NumSamplers,
_Out_writes_opt_(NumSamplers) ID3D11SamplerState** ppSamplers) = 0;
virtual void STDMETHODCALLTYPE GetPredication(
_Outptr_opt_result_maybenull_ ID3D11Predicate** ppPredicate,
_Out_opt_ BOOL* pPredicateValue) = 0;
virtual void STDMETHODCALLTYPE GSGetShaderResources(
_In_range_(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot) UINT NumViews,
_Out_writes_opt_(NumViews) ID3D11ShaderResourceView** ppShaderResourceViews) = 0;
virtual void STDMETHODCALLTYPE GSGetSamplers(
_In_range_(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot) UINT NumSamplers,
_Out_writes_opt_(NumSamplers) ID3D11SamplerState** ppSamplers) = 0;
virtual void STDMETHODCALLTYPE OMGetRenderTargets(
_In_range_(0, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT) UINT NumViews,
_Out_writes_opt_(NumViews) ID3D11RenderTargetView** ppRenderTargetViews,
_Outptr_opt_result_maybenull_ ID3D11DepthStencilView** ppDepthStencilView) = 0;
virtual void STDMETHODCALLTYPE OMGetRenderTargetsAndUnorderedAccessViews(
_In_range_(0, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT) UINT NumRTVs,
_Out_writes_opt_(NumRTVs) ID3D11RenderTargetView** ppRenderTargetViews,
_Outptr_opt_result_maybenull_ ID3D11DepthStencilView** ppDepthStencilView,
_In_range_(0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1) UINT UAVStartSlot,
_In_range_(0, D3D11_PS_CS_UAV_REGISTER_COUNT - UAVStartSlot) UINT NumUAVs,
_Out_writes_opt_(NumUAVs) ID3D11UnorderedAccessView** ppUnorderedAccessViews) = 0;
virtual void STDMETHODCALLTYPE OMGetBlendState(
_Outptr_opt_result_maybenull_ ID3D11BlendState** ppBlendState,
_Out_opt_ FLOAT BlendFactor[ 4 ],
_Out_opt_ UINT* pSampleMask) = 0;
virtual void STDMETHODCALLTYPE OMGetDepthStencilState(
_Outptr_opt_result_maybenull_ ID3D11DepthStencilState** ppDepthStencilState,
_Out_opt_ UINT* pStencilRef) = 0;
virtual void STDMETHODCALLTYPE SOGetTargets(
_In_range_(0, D3D11_SO_BUFFER_SLOT_COUNT) UINT NumBuffers,
_Out_writes_opt_(NumBuffers) ID3D11Buffer** ppSOTargets) = 0;
virtual void STDMETHODCALLTYPE RSGetState(
_Outptr_result_maybenull_ ID3D11RasterizerState** ppRasterizerState) = 0;
virtual void STDMETHODCALLTYPE RSGetViewports(
_Inout_ /*_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ UINT* pNumViewports,
_Out_writes_opt_(*pNumViewports) D3D11_VIEWPORT* pViewports) = 0;
virtual void STDMETHODCALLTYPE RSGetScissorRects(
_Inout_ /*_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ UINT* pNumRects,
_Out_writes_opt_(*pNumRects) D3D11_RECT* pRects) = 0;
virtual void STDMETHODCALLTYPE HSGetShaderResources(
_In_range_(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot) UINT NumViews,
_Out_writes_opt_(NumViews) ID3D11ShaderResourceView** ppShaderResourceViews) = 0;
virtual void STDMETHODCALLTYPE HSGetShader(
_Outptr_result_maybenull_ ID3D11HullShader** ppHullShader,
_Out_writes_opt_(*pNumClassInstances) ID3D11ClassInstance** ppClassInstances,
_Inout_opt_ UINT* pNumClassInstances) = 0;
virtual void STDMETHODCALLTYPE HSGetSamplers(
_In_range_(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot) UINT NumSamplers,
_Out_writes_opt_(NumSamplers) ID3D11SamplerState** ppSamplers) = 0;
virtual void STDMETHODCALLTYPE HSGetConstantBuffers(
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) UINT NumBuffers,
_Out_writes_opt_(NumBuffers) ID3D11Buffer** ppConstantBuffers) = 0;
virtual void STDMETHODCALLTYPE DSGetShaderResources(
_In_range_(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot) UINT NumViews,
_Out_writes_opt_(NumViews) ID3D11ShaderResourceView** ppShaderResourceViews) = 0;
virtual void STDMETHODCALLTYPE DSGetShader(
_Outptr_result_maybenull_ ID3D11DomainShader** ppDomainShader,
_Out_writes_opt_(*pNumClassInstances) ID3D11ClassInstance** ppClassInstances,
_Inout_opt_ UINT* pNumClassInstances) = 0;
virtual void STDMETHODCALLTYPE DSGetSamplers(
_In_range_(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot) UINT NumSamplers,
_Out_writes_opt_(NumSamplers) ID3D11SamplerState** ppSamplers) = 0;
virtual void STDMETHODCALLTYPE DSGetConstantBuffers(
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) UINT NumBuffers,
_Out_writes_opt_(NumBuffers) ID3D11Buffer** ppConstantBuffers) = 0;
virtual void STDMETHODCALLTYPE CSGetShaderResources(
_In_range_(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot) UINT NumViews,
_Out_writes_opt_(NumViews) ID3D11ShaderResourceView** ppShaderResourceViews) = 0;
virtual void STDMETHODCALLTYPE CSGetUnorderedAccessViews(
_In_range_(0, D3D11_1_UAV_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_1_UAV_SLOT_COUNT - StartSlot) UINT NumUAVs,
_Out_writes_opt_(NumUAVs) ID3D11UnorderedAccessView** ppUnorderedAccessViews) = 0;
virtual void STDMETHODCALLTYPE CSGetShader(
_Outptr_result_maybenull_ ID3D11ComputeShader** ppComputeShader,
_Out_writes_opt_(*pNumClassInstances) ID3D11ClassInstance** ppClassInstances,
_Inout_opt_ UINT* pNumClassInstances) = 0;
virtual void STDMETHODCALLTYPE CSGetSamplers(
_In_range_(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot) UINT NumSamplers,
_Out_writes_opt_(NumSamplers) ID3D11SamplerState** ppSamplers) = 0;
virtual void STDMETHODCALLTYPE CSGetConstantBuffers(
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) UINT NumBuffers,
_Out_writes_opt_(NumBuffers) ID3D11Buffer** ppConstantBuffers) = 0;
virtual void STDMETHODCALLTYPE ClearState(void) = 0;
virtual void STDMETHODCALLTYPE Flush(void) = 0;
virtual D3D11_DEVICE_CONTEXT_TYPE STDMETHODCALLTYPE GetType(void) = 0;
virtual UINT STDMETHODCALLTYPE GetContextFlags(void) = 0;
virtual HRESULT STDMETHODCALLTYPE FinishCommandList(
BOOL RestoreDeferredContextState,
_COM_Outptr_opt_ ID3D11CommandList** ppCommandList) = 0;
};
MIDL_INTERFACE("bb2c6faa-b5fb-4082-8e6b-388b8cfa90e1")
ID3D11DeviceContext1 : public ID3D11DeviceContext
{
public:
virtual void STDMETHODCALLTYPE CopySubresourceRegion1(
_In_ ID3D11Resource * pDstResource,
_In_ UINT DstSubresource,
_In_ UINT DstX,
_In_ UINT DstY,
_In_ UINT DstZ,
_In_ ID3D11Resource * pSrcResource,
_In_ UINT SrcSubresource,
_In_opt_ const D3D11_BOX * pSrcBox,
_In_ UINT CopyFlags) = 0;
virtual void STDMETHODCALLTYPE UpdateSubresource1(
_In_ ID3D11Resource* pDstResource,
_In_ UINT DstSubresource,
_In_opt_ const D3D11_BOX* pDstBox,
_In_ const void* pSrcData,
_In_ UINT SrcRowPitch,
_In_ UINT SrcDepthPitch,
_In_ UINT CopyFlags) = 0;
virtual void STDMETHODCALLTYPE DiscardResource(
_In_ ID3D11Resource* pResource) = 0;
virtual void STDMETHODCALLTYPE DiscardView(
_In_ ID3D11View* pResourceView) = 0;
virtual void STDMETHODCALLTYPE VSSetConstantBuffers1(
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) UINT NumBuffers,
_In_reads_opt_(NumBuffers) ID3D11Buffer* const* ppConstantBuffers,
_In_reads_opt_(NumBuffers) const UINT* pFirstConstant,
_In_reads_opt_(NumBuffers) const UINT* pNumConstants) = 0;
virtual void STDMETHODCALLTYPE HSSetConstantBuffers1(
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) UINT NumBuffers,
_In_reads_opt_(NumBuffers) ID3D11Buffer* const* ppConstantBuffers,
_In_reads_opt_(NumBuffers) const UINT* pFirstConstant,
_In_reads_opt_(NumBuffers) const UINT* pNumConstants) = 0;
virtual void STDMETHODCALLTYPE DSSetConstantBuffers1(
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) UINT NumBuffers,
_In_reads_opt_(NumBuffers) ID3D11Buffer* const* ppConstantBuffers,
_In_reads_opt_(NumBuffers) const UINT* pFirstConstant,
_In_reads_opt_(NumBuffers) const UINT* pNumConstants) = 0;
virtual void STDMETHODCALLTYPE GSSetConstantBuffers1(
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) UINT NumBuffers,
_In_reads_opt_(NumBuffers) ID3D11Buffer* const* ppConstantBuffers,
_In_reads_opt_(NumBuffers) const UINT* pFirstConstant,
_In_reads_opt_(NumBuffers) const UINT* pNumConstants) = 0;
virtual void STDMETHODCALLTYPE PSSetConstantBuffers1(
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) UINT NumBuffers,
_In_reads_opt_(NumBuffers) ID3D11Buffer* const* ppConstantBuffers,
_In_reads_opt_(NumBuffers) const UINT* pFirstConstant,
_In_reads_opt_(NumBuffers) const UINT* pNumConstants) = 0;
virtual void STDMETHODCALLTYPE CSSetConstantBuffers1(
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) UINT NumBuffers,
_In_reads_opt_(NumBuffers) ID3D11Buffer* const* ppConstantBuffers,
_In_reads_opt_(NumBuffers) const UINT* pFirstConstant,
_In_reads_opt_(NumBuffers) const UINT* pNumConstants) = 0;
virtual void STDMETHODCALLTYPE VSGetConstantBuffers1(
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) UINT NumBuffers,
_Out_writes_opt_(NumBuffers) ID3D11Buffer** ppConstantBuffers,
_Out_writes_opt_(NumBuffers) UINT* pFirstConstant,
_Out_writes_opt_(NumBuffers) UINT* pNumConstants) = 0;
virtual void STDMETHODCALLTYPE HSGetConstantBuffers1(
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) UINT NumBuffers,
_Out_writes_opt_(NumBuffers) ID3D11Buffer** ppConstantBuffers,
_Out_writes_opt_(NumBuffers) UINT* pFirstConstant,
_Out_writes_opt_(NumBuffers) UINT* pNumConstants) = 0;
virtual void STDMETHODCALLTYPE DSGetConstantBuffers1(
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) UINT NumBuffers,
_Out_writes_opt_(NumBuffers) ID3D11Buffer** ppConstantBuffers,
_Out_writes_opt_(NumBuffers) UINT* pFirstConstant,
_Out_writes_opt_(NumBuffers) UINT* pNumConstants) = 0;
virtual void STDMETHODCALLTYPE GSGetConstantBuffers1(
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) UINT NumBuffers,
_Out_writes_opt_(NumBuffers) ID3D11Buffer** ppConstantBuffers,
_Out_writes_opt_(NumBuffers) UINT* pFirstConstant,
_Out_writes_opt_(NumBuffers) UINT* pNumConstants) = 0;
virtual void STDMETHODCALLTYPE PSGetConstantBuffers1(
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) UINT NumBuffers,
_Out_writes_opt_(NumBuffers) ID3D11Buffer** ppConstantBuffers,
_Out_writes_opt_(NumBuffers) UINT* pFirstConstant,
_Out_writes_opt_(NumBuffers) UINT* pNumConstants) = 0;
virtual void STDMETHODCALLTYPE CSGetConstantBuffers1(
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) UINT StartSlot,
_In_range_(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) UINT NumBuffers,
_Out_writes_opt_(NumBuffers) ID3D11Buffer** ppConstantBuffers,
_Out_writes_opt_(NumBuffers) UINT* pFirstConstant,
_Out_writes_opt_(NumBuffers) UINT* pNumConstants) = 0;
virtual void STDMETHODCALLTYPE SwapDeviceContextState(
_In_ ID3DDeviceContextState* pState,
_Outptr_opt_ ID3DDeviceContextState** ppPreviousState) = 0;
virtual void STDMETHODCALLTYPE ClearView(
_In_ ID3D11View* pView,
_In_ const FLOAT Color[ 4 ],
_In_reads_opt_(NumRects) const D3D11_RECT* pRect,
UINT NumRects) = 0;
virtual void STDMETHODCALLTYPE DiscardView1(
_In_ ID3D11View* pResourceView,
_In_reads_opt_(NumRects) const D3D11_RECT* pRects,
UINT NumRects) = 0;
};
MIDL_INTERFACE("420d5b32-b90c-4da4-bef0-359f6a24a83a")
ID3D11DeviceContext2 : public ID3D11DeviceContext1
{
public:
virtual HRESULT STDMETHODCALLTYPE UpdateTileMappings(
_In_ ID3D11Resource * pTiledResource,
_In_ UINT NumTiledResourceRegions,
_In_reads_opt_(NumTiledResourceRegions) const D3D11_TILED_RESOURCE_COORDINATE * pTiledResourceRegionStartCoordinates,
_In_reads_opt_(NumTiledResourceRegions) const D3D11_TILE_REGION_SIZE * pTiledResourceRegionSizes,
_In_opt_ ID3D11Buffer * pTilePool,
_In_ UINT NumRanges,
_In_reads_opt_(NumRanges) const UINT * pRangeFlags,
_In_reads_opt_(NumRanges) const UINT * pTilePoolStartOffsets,
_In_reads_opt_(NumRanges) const UINT * pRangeTileCounts,
_In_ UINT Flags) = 0;
virtual HRESULT STDMETHODCALLTYPE CopyTileMappings(
_In_ ID3D11Resource* pDestTiledResource,
_In_ const D3D11_TILED_RESOURCE_COORDINATE* pDestRegionStartCoordinate,
_In_ ID3D11Resource* pSourceTiledResource,
_In_ const D3D11_TILED_RESOURCE_COORDINATE* pSourceRegionStartCoordinate,
_In_ const D3D11_TILE_REGION_SIZE* pTileRegionSize,
_In_ UINT Flags) = 0;
virtual void STDMETHODCALLTYPE CopyTiles(
_In_ ID3D11Resource* pTiledResource,
_In_ const D3D11_TILED_RESOURCE_COORDINATE* pTileRegionStartCoordinate,
_In_ const D3D11_TILE_REGION_SIZE* pTileRegionSize,
_In_ ID3D11Buffer* pBuffer,
_In_ UINT64 BufferStartOffsetInBytes,
_In_ UINT Flags) = 0;
virtual void STDMETHODCALLTYPE UpdateTiles(
_In_ ID3D11Resource* pDestTiledResource,
_In_ const D3D11_TILED_RESOURCE_COORDINATE* pDestTileRegionStartCoordinate,
_In_ const D3D11_TILE_REGION_SIZE* pDestTileRegionSize,
_In_ const void* pSourceTileData,
_In_ UINT Flags) = 0;
virtual HRESULT STDMETHODCALLTYPE ResizeTilePool(
_In_ ID3D11Buffer* pTilePool,
_In_ UINT64 NewSizeInBytes) = 0;
virtual void STDMETHODCALLTYPE TiledResourceBarrier(
_In_opt_ ID3D11DeviceChild* pTiledResourceOrViewAccessBeforeBarrier,
_In_opt_ ID3D11DeviceChild* pTiledResourceOrViewAccessAfterBarrier) = 0;
virtual BOOL STDMETHODCALLTYPE IsAnnotationEnabled(void) = 0;
virtual void STDMETHODCALLTYPE SetMarkerInt(
_In_ LPCWSTR pLabel,
INT Data) = 0;
virtual void STDMETHODCALLTYPE BeginEventInt(
_In_ LPCWSTR pLabel,
INT Data) = 0;
virtual void STDMETHODCALLTYPE EndEvent(void) = 0;
};
// just for the guid :3
D3DINTERFACE(ID3D11DeviceContextX, 48800095, 7134, 4be7, 91, 86, b8, 6b, ec, b2, 64, 77) {
public:
};
}

View File

@@ -1,82 +0,0 @@
#include "pch.h"
#include "ID3DWrappers.h"
namespace d3d11x {
HRESULT ID3D11ResourceWrapperX::QueryInterface(REFIID riid, void** ppvObject)
{
// DEBUG
char iidstr[ sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}") ];
OLECHAR iidwstr[ sizeof(iidstr) ];
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr));
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr);
printf("[ID3D11ResourceWrapperX] QueryInterface: %s\n", iidstr);
*ppvObject = nullptr;
return E_NOINTERFACE;
}
ULONG ID3D11ResourceWrapperX::AddRef( )
{
printf("[ID3D11ResourceWrapperX] --> AddRef\n");
return InterlockedIncrement(&m_RefCount);
}
ULONG ID3D11ResourceWrapperX::Release( )
{
printf("[ID3D11ResourceWrapperX] --> Release\n");
ULONG refCount = InterlockedDecrement(&m_RefCount);
if (refCount == 0)
delete this;
return refCount;
}
// @Patoke todo: unwrap?
void __stdcall ID3D11ResourceWrapperX::GetDevice(ID3D11Device** ppDevice)
{
// Probably not necessary but just to be sure -AleBlbl
::ID3D11Device** device = nullptr;
this->m_realResource->GetDevice(device);
ppDevice = reinterpret_cast<ID3D11Device**>(ppDevice);
}
HRESULT __stdcall ID3D11ResourceWrapperX::GetPrivateData(REFGUID guid, UINT* pDataSize, void* pData)
{
return m_realResource->GetPrivateData(guid, pDataSize, pData);
}
HRESULT __stdcall ID3D11ResourceWrapperX::SetPrivateData(REFGUID guid, UINT DataSize, const void* pData)
{
return m_realResource->SetPrivateData(guid, DataSize, pData);
}
HRESULT __stdcall ID3D11ResourceWrapperX::SetPrivateDataInterface(REFGUID guid, const IUnknown* pData)
{
return m_realResource->SetPrivateDataInterface(guid, pData);
}
HRESULT __stdcall ID3D11ResourceWrapperX::SetName(const wchar_t* name)
{
printf("[ID3D11ResourceWrapperX]: SetName STUB\n");
return S_OK;
}
void __stdcall ID3D11ResourceWrapperX::GetType(D3D11_RESOURCE_DIMENSION* pResourceDimension)
{
return m_realResource->GetType(pResourceDimension);
}
void __stdcall ID3D11ResourceWrapperX::SetEvictionPriority(UINT EvictionPriority)
{
return m_realResource->SetEvictionPriority(EvictionPriority);
}
UINT __stdcall ID3D11ResourceWrapperX::GetEvictionPriority(void)
{
return m_realResource->GetEvictionPriority( );
}
void __stdcall ID3D11ResourceWrapperX::GetDescriptor(D3D11X_DESCRIPTOR_RESOURCE* descriptor)
{
printf("[ID3D11ResourceWrapperX]: GetDescriptor STUB\n");
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,167 +0,0 @@
#pragma once
#include "pch.h"
#include "d3d_x/d3d11_x_device.h"
#include "d3d_x/d3d_x.hpp"
namespace d3d11x
{
struct D3D11X_DESCRIPTOR_TEXTURE_VIEW
{
union
{
//__m128i Oword[ 2 ]; @Patoke todo: cannot be arsed
unsigned __int64 Qword[ 4 ];
unsigned int Dword[ 8 ];
};
};
struct ID3D11DeviceChild_X : public IGraphicsUnknown
{
public: ID3D11Device* m_pDevice;
public: void* m_pPrivateData;
public:
virtual void STDMETHODCALLTYPE GetDevice(
/* [annotation] */
_Outptr_ ID3D11Device * *ppDevice) PURE;
virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
/* [annotation] */
_In_ REFGUID guid,
/* [annotation] */
_Inout_ UINT* pDataSize,
/* [annotation] */
_Out_writes_bytes_opt_(*pDataSize) void* pData) PURE;
virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
/* [annotation] */
_In_ REFGUID guid,
/* [annotation] */
_In_ UINT DataSize,
/* [annotation] */
_In_reads_bytes_opt_(DataSize) const void* pData) PURE;
virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
/* [annotation] */
_In_ REFGUID guid,
/* [annotation] */
_In_opt_ const IUnknown* pData) PURE;
// Xbox Extra functions:
virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterfaceGraphics(const _GUID& name, const IGraphicsUnknown* data)
{
return SetPrivateDataInterface(name, reinterpret_cast<IUnknown const*>(data));
}
virtual HRESULT STDMETHODCALLTYPE SetName(const wchar_t* name) PURE;
};
struct ID3D11Resource_X : public ID3D11DeviceChild_X
{
virtual void STDMETHODCALLTYPE GetType(
/* [annotation] */
_Out_ D3D11_RESOURCE_DIMENSION * pResourceDimension) PURE;
virtual void STDMETHODCALLTYPE SetEvictionPriority(
/* [annotation] */
_In_ UINT EvictionPriority) PURE;
virtual UINT STDMETHODCALLTYPE GetEvictionPriority(void) PURE;
// xbox extra function
virtual void STDMETHODCALLTYPE GetDescriptor(D3D11X_DESCRIPTOR_RESOURCE* descriptor) PURE;
};
struct ID3D11Texture1D_X : public ID3D11Resource_X
{
virtual void STDMETHODCALLTYPE GetDesc(
/* [annotation] */
_Out_ D3D11_TEXTURE1D_DESC* pDesc) PURE;
};
struct ID3D11Texture2D_X : public ID3D11Resource_X
{
virtual void STDMETHODCALLTYPE GetDesc(
/* [annotation] */
_Out_ D3D11_TEXTURE2D_DESC* pDesc) PURE;
};
struct ID3D11Texture3D_X : public ID3D11Resource_X
{
virtual void STDMETHODCALLTYPE GetDesc(
/* [annotation] */
_Out_ D3D11_TEXTURE3D_DESC* pDesc) PURE;
};
struct ID3D11View_X : ID3D11DeviceChild_X
{
public:
ID3D11Resource* m_pResource;
unsigned int m_Type;
virtual void STDMETHODCALLTYPE GetResource(
/* [annotation] */
_Outptr_ ID3D11Resource** ppResource) PURE;
};
struct ID3D11RenderTargetView_X : ID3D11View_X
{
public:
virtual void STDMETHODCALLTYPE GetDesc(
/* [annotation] */
_Out_ D3D11_RENDER_TARGET_VIEW_DESC* pDesc) PURE;
};
struct ID3D11DepthStencilView_X : ID3D11View_X
{
public:
virtual void STDMETHODCALLTYPE GetDesc(
/* [annotation] */
_Out_ D3D11_DEPTH_STENCIL_VIEW_DESC* pDesc) PURE;
};
struct ID3D11ShaderResourceView_X : ID3D11View_X
{
public:
virtual void STDMETHODCALLTYPE GetDesc(
/* [annotation] */
_Out_ D3D11_SHADER_RESOURCE_VIEW_DESC* pDesc) PURE;
};
struct ID3D11UnorderedAccessView_X : ID3D11View_X
{
public:
D3D11X_DESCRIPTOR_TEXTURE_VIEW m_Descriptor;
void* m_pAllocationStart;
virtual void STDMETHODCALLTYPE GetDesc(
/* [annotation] */
_Out_ D3D11_UNORDERED_ACCESS_VIEW_DESC* pDesc) PURE;
};
struct ID3D11Buffer_X : ID3D11Resource_X
{
public:
virtual void STDMETHODCALLTYPE GetDesc(
/* [annotation] */
_Out_ D3D11_BUFFER_DESC* pDesc) = 0;
};
}

View File

@@ -1,285 +0,0 @@
#pragma once
#include "pch.h"
#include "d3d_x/d3d11_x_device.h"
#include "d3d_x/d3d_x.hpp"
#include <typeinfo>
namespace d3d11x
{
struct IDXGISwapChain1_X;
//MIDL_INTERFACE("aec22fb8-76f3-4639-9be0-28eb43a67a2e")
struct IDXGIObject_X : public IGraphicsUnknown
{
/* 0x0000: fields for IGraphicsUnknown */
/* 0x0010 */ public: void* m_pPrivateData;
public:
virtual HRESULT STDMETHODCALLTYPE SetPrivateData(_In_ REFGUID Name, UINT DataSize, _In_reads_bytes_(DataSize) const void* pData) PURE;
virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(_In_ REFGUID Name, _In_opt_ const IUnknown* pUnknown) PURE;
/*virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterfaceGraphics(_In_ REFGUID Name, const IGraphicsUnknown* data)
{
return this->SetPrivateDataInterface(Name, reinterpret_cast<IUnknown const*>(data));
}*/
virtual HRESULT STDMETHODCALLTYPE GetPrivateData(_In_ REFGUID Name, _Inout_ UINT* pDataSize, _Out_writes_bytes_(*pDataSize) void* pData) PURE;
virtual HRESULT STDMETHODCALLTYPE GetParent(_In_ REFIID riid, _COM_Outptr_ void** ppParent) PURE;
};
// Adapted to Xbox one (look at pdb)
//MIDL_INTERFACE("7b7166ec-21c7-44ae-b21a-c9ae321ae369")
struct IDXGIFactory_X : public IDXGIObject_X
{
public:
/* 0x0000: fields for IDXGIObject */
/* 0x0018 */ public: IDXGIAdapter2* m_pAdapter;
virtual HRESULT STDMETHODCALLTYPE EnumAdapters(
UINT Adapter,
IDXGIAdapter** ppAdapter) PURE;
virtual HRESULT STDMETHODCALLTYPE MakeWindowAssociation(
HWND WindowHandle,
UINT Flags) PURE;
virtual HRESULT STDMETHODCALLTYPE GetWindowAssociation(
HWND* pWindowHandle) PURE;
virtual HRESULT STDMETHODCALLTYPE CreateSwapChain(
IGraphicsUnknown* pDevice,
DXGI_SWAP_CHAIN_DESC* pDesc,
IDXGISwapChain** ppSwapChain) PURE;
virtual HRESULT STDMETHODCALLTYPE CreateSoftwareAdapter(
HMODULE Module,
IDXGIAdapter** ppAdapter) PURE;
};
// Adapted to Xbox one (look at pdb)
//MIDL_INTERFACE("770aae78-f26f-4dba-a829-253c83d1b387")
struct IDXGIFactory1_X : public IDXGIFactory_X
{
public:
virtual HRESULT STDMETHODCALLTYPE EnumAdapters1(UINT Adapter, IDXGIAdapter1** ppAdapter) PURE;
virtual BOOL STDMETHODCALLTYPE IsCurrent(void) PURE;
};
// Adapted to Xbox one (look at pdb)
//MIDL_INTERFACE("50c83a1c-e072-4c48-87b0-3630fa36a6d0")
struct IDXGIFactory2_X : public IDXGIFactory1_X
{
public:
virtual BOOL STDMETHODCALLTYPE IsWindowedStereoEnabled(void) PURE;
virtual HRESULT STDMETHODCALLTYPE CreateSwapChainForHwnd(IGraphicsUnknown* pDevice,
HWND hWnd, const DXGI_SWAP_CHAIN_DESC1* pDesc,
const DXGI_SWAP_CHAIN_FULLSCREEN_DESC* pFullscreenDesc,
IDXGIOutput* pRestrictToOutput,
IDXGISwapChain1** ppSwapChain) PURE;
virtual HRESULT STDMETHODCALLTYPE CreateSwapChainForCoreWindow(
IGraphicsUnknown* pDevice,
IUnknown* pWindow,
DXGI_SWAP_CHAIN_DESC1* pDesc,
IDXGIOutput* pRestrictToOutput,
IDXGISwapChain1_X** ppSwapChain) PURE;
virtual HRESULT STDMETHODCALLTYPE GetSharedResourceAdapterLuid(
HANDLE hResource,
LUID* pLuid) PURE;
virtual HRESULT STDMETHODCALLTYPE RegisterStereoStatusWindow(
HWND WindowHandle,
UINT wMsg,
DWORD* pdwCookie) PURE;
virtual HRESULT STDMETHODCALLTYPE RegisterStereoStatusEvent(
HANDLE hEvent,
DWORD* pdwCookie) PURE;
virtual void STDMETHODCALLTYPE UnregisterStereoStatus(
DWORD dwCookie) PURE;
virtual HRESULT STDMETHODCALLTYPE RegisterOcclusionStatusWindow(
HWND WindowHandle,
UINT wMsg,
DWORD* pdwCookie) PURE;
virtual HRESULT STDMETHODCALLTYPE RegisterOcclusionStatusEvent(
HANDLE hEvent,
DWORD* pdwCookie) PURE;
virtual void STDMETHODCALLTYPE UnregisterOcclusionStatus(
DWORD dwCookie) PURE;
virtual HRESULT STDMETHODCALLTYPE CreateSwapChainForComposition(
IGraphicsUnknown* pDevice,
const DXGI_SWAP_CHAIN_DESC1* pDesc,
IDXGIOutput* pRestrictToOutput,
IDXGISwapChain1** ppSwapChain) PURE;
};
struct IDXGIAdapter_X : IDXGIObject_X
{
virtual HRESULT STDMETHODCALLTYPE EnumOutputs(UINT Output, IDXGIOutput** ppOutput) PURE;
virtual HRESULT STDMETHODCALLTYPE GetDesc(DXGI_ADAPTER_DESC* pDesc) PURE;
virtual HRESULT STDMETHODCALLTYPE CheckInterfaceSupport(REFGUID InterfaceName, LARGE_INTEGER* pUMDVersion) PURE;
};
struct IDXGIDevice_X : d3d11x::IDXGIObject_X
{
virtual HRESULT STDMETHODCALLTYPE GetAdapter(IDXGIAdapter_X** pAdapter) PURE;
virtual HRESULT STDMETHODCALLTYPE CreateSurface(const DXGI_SURFACE_DESC* pDesc, UINT NumSurfaces, DXGI_USAGE Usage,
const DXGI_SHARED_RESOURCE* pSharedResource,
_Out_writes_(NumSurfaces) IDXGISurface** ppSurface) PURE;
virtual HRESULT STDMETHODCALLTYPE QueryResourceResidency(
_In_reads_(NumResources) IGraphicsUnknown** ppResources,
_Out_writes_(NumResources) DXGI_RESIDENCY* pResidencyStatus,
/* [in] */ UINT NumResources) PURE;
virtual HRESULT STDMETHODCALLTYPE SetGPUThreadPriority(
/* [in] */ INT Priority) PURE;
virtual HRESULT STDMETHODCALLTYPE GetGPUThreadPriority(
_Out_ INT* pPriority) PURE;
};
struct IDXGIDeviceSubObject_X : public IDXGIObject_X
{
public:
virtual HRESULT STDMETHODCALLTYPE GetDevice(
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][retval][out] */
_COM_Outptr_ void** ppDevice) = 0;
};
struct IDXGISwapChain_X : public IDXGIDeviceSubObject_X
{
virtual HRESULT STDMETHODCALLTYPE Present(
/* [in] */ UINT SyncInterval,
/* [in] */ UINT Flags) = 0;
virtual HRESULT STDMETHODCALLTYPE GetBuffer(
/* [in] */ UINT Buffer,
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][out][in] */
_COM_Outptr_ void** ppSurface) = 0;
virtual HRESULT STDMETHODCALLTYPE SetFullscreenState(
/* [in] */ BOOL Fullscreen,
/* [annotation][in] */
_In_opt_ IDXGIOutput* pTarget) = 0;
virtual HRESULT STDMETHODCALLTYPE GetFullscreenState(
/* [annotation][out] */
_Out_opt_ BOOL* pFullscreen,
/* [annotation][out] */
_COM_Outptr_opt_result_maybenull_ IDXGIOutput** ppTarget) = 0;
virtual HRESULT STDMETHODCALLTYPE GetDesc(
/* [annotation][out] */
_Out_ DXGI_SWAP_CHAIN_DESC* pDesc) = 0;
virtual HRESULT STDMETHODCALLTYPE ResizeBuffers(
/* [in] */ UINT BufferCount,
/* [in] */ UINT Width,
/* [in] */ UINT Height,
/* [in] */ DXGI_FORMAT NewFormat,
/* [in] */ UINT SwapChainFlags) = 0;
virtual HRESULT STDMETHODCALLTYPE ResizeTarget(
/* [annotation][in] */
_In_ const DXGI_MODE_DESC* pNewTargetParameters) = 0;
virtual HRESULT STDMETHODCALLTYPE GetContainingOutput(
/* [annotation][out] */
_COM_Outptr_ IDXGIOutput** ppOutput) = 0;
virtual HRESULT STDMETHODCALLTYPE GetFrameStatistics(
/* [annotation][out] */
_Out_ DXGI_FRAME_STATISTICS* pStats) = 0;
virtual HRESULT STDMETHODCALLTYPE GetLastPresentCount(
/* [annotation][out] */
_Out_ UINT* pLastPresentCount) = 0;
};
struct IDXGISwapChain1_X : public IDXGISwapChain_X
{
virtual HRESULT STDMETHODCALLTYPE GetDesc1(
/* [annotation][out] */
_Out_ DXGI_SWAP_CHAIN_DESC1 * pDesc) = 0;
virtual HRESULT STDMETHODCALLTYPE GetFullscreenDesc(
/* [annotation][out] */
_Out_ DXGI_SWAP_CHAIN_FULLSCREEN_DESC* pDesc) = 0;
virtual HRESULT STDMETHODCALLTYPE GetHwnd(
/* [annotation][out] */
_Out_ HWND* pHwnd) = 0;
virtual HRESULT STDMETHODCALLTYPE GetCoreWindow(
/* [annotation][in] */
_In_ REFIID refiid,
/* [annotation][out] */
_COM_Outptr_ void** ppUnk) = 0;
virtual HRESULT STDMETHODCALLTYPE Present1(
/* [in] */ UINT SyncInterval,
/* [in] */ UINT PresentFlags,
/* [annotation][in] */
_In_ const DXGI_PRESENT_PARAMETERS* pPresentParameters) = 0;
virtual BOOL STDMETHODCALLTYPE IsTemporaryMonoSupported(void) = 0;
virtual HRESULT STDMETHODCALLTYPE GetRestrictToOutput(
/* [annotation][out] */
_Out_ IDXGIOutput** ppRestrictToOutput) = 0;
virtual HRESULT STDMETHODCALLTYPE SetBackgroundColor(
/* [annotation][in] */
_In_ const DXGI_RGBA* pColor) = 0;
virtual HRESULT STDMETHODCALLTYPE GetBackgroundColor(
/* [annotation][out] */
_Out_ DXGI_RGBA* pColor) = 0;
virtual HRESULT STDMETHODCALLTYPE SetRotation(
/* [annotation][in] */
_In_ DXGI_MODE_ROTATION Rotation) = 0;
virtual HRESULT STDMETHODCALLTYPE GetRotation(
/* [annotation][out] */
_Out_ DXGI_MODE_ROTATION* pRotation) = 0;
};
}

View File

@@ -1,92 +0,0 @@
#include "pch.h"
#include "IDXGIWrappers.h"
namespace d3d11x
{
HRESULT IDXGIAdapterWrapper::QueryInterface(REFIID riid, void** ppvObject)
{
if (riid == __uuidof(IDXGIAdapter))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
// DEBUG
char iidstr[ sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}") ];
OLECHAR iidwstr[ sizeof(iidstr) ];
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr));
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr);
printf("[IDXGIDeviceWrapper] QueryInterface: %s\n", iidstr);
*ppvObject = nullptr;
return E_NOINTERFACE;
}
ULONG IDXGIAdapterWrapper::AddRef( )
{
printf("[IDXGIAdapterWrapper] --> AddRef\n");
return InterlockedIncrement(&m_RefCount);
}
ULONG IDXGIAdapterWrapper::Release( )
{
printf("[IDXGIAdapterWrapper] --> Release\n");
ULONG refCount = InterlockedDecrement(&m_RefCount);
if (refCount == 0)
delete this;
return refCount;
}
HRESULT __stdcall IDXGIAdapterWrapper::SetPrivateData(REFGUID Name, UINT DataSize, const void* pData)
{
return m_realAdapter->SetPrivateData(Name, DataSize, pData);
}
HRESULT __stdcall IDXGIAdapterWrapper::SetPrivateDataInterface(REFGUID Name, const IUnknown* pUnknown)
{
return m_realAdapter->SetPrivateDataInterface(Name, pUnknown);
}
HRESULT __stdcall IDXGIAdapterWrapper::GetPrivateData(REFGUID Name, UINT* pDataSize, void* pData)
{
return m_realAdapter->GetPrivateData(Name, pDataSize, pData);
}
HRESULT __stdcall IDXGIAdapterWrapper::GetParent(REFIID riid, void** ppParent)
{
if (riid == __uuidof(IDXGIFactory) ||
riid == __uuidof(IDXGIFactory1) ||
riid == __uuidof(IDXGIFactory2))
{
IDXGIFactory2* factory = nullptr;
HRESULT hr = m_realAdapter->GetParent(IID_PPV_ARGS(&factory));
*ppParent = new IDXGIFactoryWrapper(factory);
this->AddRef( );
return hr;
}
*ppParent = nullptr;
return E_NOINTERFACE;
}
HRESULT __stdcall IDXGIAdapterWrapper::EnumOutputs(UINT Output, IDXGIOutput** ppOutput)
{
return m_realAdapter->EnumOutputs(Output, ppOutput);
}
HRESULT __stdcall IDXGIAdapterWrapper::GetDesc(DXGI_ADAPTER_DESC* pDesc)
{
return m_realAdapter->GetDesc(pDesc);
}
HRESULT __stdcall IDXGIAdapterWrapper::CheckInterfaceSupport(REFGUID InterfaceName, LARGE_INTEGER* pUMDVersion)
{
return m_realAdapter->CheckInterfaceSupport(InterfaceName, pUMDVersion);
}
}

View File

@@ -1,106 +0,0 @@
#include "pch.h"
#include "IDXGIWrappers.h"
#include "../kernelx/utils.h"
namespace d3d11x
{
HRESULT IDXGIDeviceWrapper::QueryInterface(REFIID riid, void** ppvObject)
{
if (riid == __uuidof(IDXGIDevice))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
// DEBUG
char iidstr[ sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}") ];
OLECHAR iidwstr[ sizeof(iidstr) ];
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr));
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr);
printf("[IDXGIDeviceWrapper] QueryInterface: %s\n", iidstr);
*ppvObject = nullptr;
return E_NOINTERFACE;
}
ULONG IDXGIDeviceWrapper::AddRef( )
{
printf("[IDXGIDeviceWrapper] --> AddRef\n");
return InterlockedIncrement(&m_RefCount);
}
ULONG IDXGIDeviceWrapper::Release( )
{
printf("[IDXGIDeviceWrapper] --> Release\n");
ULONG refCount = InterlockedDecrement(&m_RefCount);
if (refCount == 0)
delete this;
return refCount;
}
HRESULT __stdcall IDXGIDeviceWrapper::SetPrivateData(REFGUID Name, UINT DataSize, const void* pData)
{
return m_realDevice->SetPrivateData(Name, DataSize, pData);
}
HRESULT __stdcall IDXGIDeviceWrapper::SetPrivateDataInterface(REFGUID Name, const IUnknown* pUnknown)
{
return m_realDevice->SetPrivateDataInterface(Name, pUnknown);
}
HRESULT __stdcall IDXGIDeviceWrapper::GetPrivateData(REFGUID Name, UINT* pDataSize, void* pData)
{
return m_realDevice->GetPrivateData(Name, pDataSize, pData);
}
HRESULT __stdcall IDXGIDeviceWrapper::GetParent(REFIID riid, void** ppParent)
{
// this should probably check if fails -AleBlbl
HRESULT hr = m_realDevice->GetParent(riid, ppParent);
this->AddRef( );
if (IsXboxCallee( ))
{
if (riid == __uuidof(IDXGIAdapter))
{
*ppParent = new IDXGIAdapterWrapper(reinterpret_cast<IDXGIAdapter*>(*ppParent));
}
}
return hr;
}
HRESULT __stdcall IDXGIDeviceWrapper::GetAdapter(IDXGIAdapter_X** pAdapter)
{
IDXGIAdapter* adapter;
HRESULT hr = m_realDevice->GetAdapter(&adapter);
*pAdapter = new IDXGIAdapterWrapper(adapter);
return hr;
}
HRESULT __stdcall IDXGIDeviceWrapper::CreateSurface(const DXGI_SURFACE_DESC* pDesc, UINT NumSurfaces, DXGI_USAGE Usage, const DXGI_SHARED_RESOURCE* pSharedResource, IDXGISurface** ppSurface)
{
return m_realDevice->CreateSurface(pDesc, NumSurfaces, Usage, pSharedResource, ppSurface);
}
HRESULT __stdcall IDXGIDeviceWrapper::QueryResourceResidency(IGraphicsUnknown** ppResources, DXGI_RESIDENCY* pResidencyStatus, UINT NumResources)
{
return m_realDevice->QueryResourceResidency(reinterpret_cast<IUnknown**>(ppResources), pResidencyStatus, NumResources);
}
HRESULT __stdcall IDXGIDeviceWrapper::SetGPUThreadPriority(INT Priority)
{
return m_realDevice->SetGPUThreadPriority(Priority);
}
HRESULT __stdcall IDXGIDeviceWrapper::GetGPUThreadPriority(INT* pPriority)
{
return m_realDevice->GetGPUThreadPriority(pPriority);
}
}

View File

@@ -1,213 +0,0 @@
#include "pch.h"
#include "IDXGIWrappers.h"
#include "ID3DWrappers.h"
#include <windows.ui.core.h>
#include "../kernelx/CoreWindowWrapperX.h"
#include "overlay/overlay.h"
#define DXGI_SWAPCHAIN_FLAG_MASK DXGI_SWAP_CHAIN_FLAG_NONPREROTATED | DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH | DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE \
| DXGI_SWAP_CHAIN_FLAG_RESTRICTED_CONTENT | DXGI_SWAP_CHAIN_FLAG_RESTRICT_SHARED_RESOURCE_DRIVER | DXGI_SWAP_CHAIN_FLAG_DISPLAY_ONLY | DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT \
| DXGI_SWAP_CHAIN_FLAG_FOREGROUND_LAYER | DXGI_SWAP_CHAIN_FLAG_FULLSCREEN_VIDEO | DXGI_SWAP_CHAIN_FLAG_YUV_VIDEO \
| DXGI_SWAP_CHAIN_FLAG_HW_PROTECTED | DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING \
| DXGI_SWAP_CHAIN_FLAG_RESTRICTED_TO_ALL_HOLOGRAPHIC_DISPLAYS
#define DXGI_SWAPCHAIN_FLAG_MASK DXGI_SWAP_CHAIN_FLAG_NONPREROTATED | DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH | DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE \
| DXGI_SWAP_CHAIN_FLAG_RESTRICTED_CONTENT | DXGI_SWAP_CHAIN_FLAG_RESTRICT_SHARED_RESOURCE_DRIVER | DXGI_SWAP_CHAIN_FLAG_DISPLAY_ONLY | DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT \
| DXGI_SWAP_CHAIN_FLAG_FOREGROUND_LAYER | DXGI_SWAP_CHAIN_FLAG_FULLSCREEN_VIDEO | DXGI_SWAP_CHAIN_FLAG_YUV_VIDEO \
| DXGI_SWAP_CHAIN_FLAG_HW_PROTECTED | DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING \
| DXGI_SWAP_CHAIN_FLAG_RESTRICTED_TO_ALL_HOLOGRAPHIC_DISPLAYS
namespace d3d11x
{
HRESULT d3d11x::IDXGIFactoryWrapper::QueryInterface(REFIID riid, void** ppvObject)
{
if (riid == __uuidof(IDXGIFactory) ||
riid == __uuidof(IDXGIFactory1) ||
riid == __uuidof(IDXGIFactory2))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
// DEBUG
char iidstr[ sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}") ];
OLECHAR iidwstr[ sizeof(iidstr) ];
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr));
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr);
printf("[IDXGIFactoryWrapper] QueryInterface: %s\n", iidstr);
*ppvObject = nullptr;
return E_NOINTERFACE;
}
ULONG IDXGIFactoryWrapper::AddRef( )
{
printf("[IDXGIFactoryWrapper] --> AddRef\n");
return InterlockedIncrement(&m_RefCount);
}
ULONG IDXGIFactoryWrapper::Release( )
{
printf("[IDXGIFactoryWrapper] --> Release\n");
ULONG refCount = InterlockedDecrement(&m_RefCount);
if (refCount == 0)
delete this;
return refCount;
}
HRESULT __stdcall IDXGIFactoryWrapper::SetPrivateData(REFGUID Name, UINT DataSize, const void* pData)
{
return m_realFactory->SetPrivateData(Name, DataSize, pData);
}
HRESULT __stdcall IDXGIFactoryWrapper::SetPrivateDataInterface(REFGUID Name, const IUnknown* pUnknown)
{
return m_realFactory->SetPrivateDataInterface(Name, pUnknown);
}
HRESULT __stdcall IDXGIFactoryWrapper::GetPrivateData(REFGUID Name, UINT* pDataSize, void* pData)
{
return m_realFactory->GetPrivateData(Name, pDataSize, pData);
}
HRESULT __stdcall IDXGIFactoryWrapper::GetParent(REFIID riid, void** ppParent)
{
return m_realFactory->GetParent(riid, ppParent);
}
HRESULT __stdcall IDXGIFactoryWrapper::EnumAdapters(UINT Adapter, IDXGIAdapter** ppAdapter)
{
return m_realFactory->EnumAdapters(Adapter, ppAdapter);
}
HRESULT __stdcall IDXGIFactoryWrapper::MakeWindowAssociation(HWND WindowHandle, UINT Flags)
{
return m_realFactory->MakeWindowAssociation(WindowHandle, Flags);
}
HRESULT __stdcall IDXGIFactoryWrapper::GetWindowAssociation(HWND* pWindowHandle)
{
return m_realFactory->GetWindowAssociation(pWindowHandle);
}
HRESULT __stdcall IDXGIFactoryWrapper::CreateSwapChain(IGraphicsUnknown* pDevice, DXGI_SWAP_CHAIN_DESC* pDesc, IDXGISwapChain** ppSwapChain)
{
return m_realFactory->CreateSwapChain(reinterpret_cast<IUnknown*>(pDevice), pDesc, ppSwapChain);
}
HRESULT __stdcall IDXGIFactoryWrapper::CreateSoftwareAdapter(HMODULE Module, IDXGIAdapter** ppAdapter)
{
return m_realFactory->CreateSoftwareAdapter(Module, ppAdapter);
}
HRESULT __stdcall IDXGIFactoryWrapper::EnumAdapters1(UINT Adapter, IDXGIAdapter1** ppAdapter)
{
return m_realFactory->EnumAdapters1(Adapter, ppAdapter);
}
BOOL __stdcall IDXGIFactoryWrapper::IsCurrent(void)
{
return m_realFactory->IsCurrent( );
}
BOOL __stdcall IDXGIFactoryWrapper::IsWindowedStereoEnabled(void)
{
return m_realFactory->IsWindowedStereoEnabled( );
}
HRESULT __stdcall IDXGIFactoryWrapper::CreateSwapChainForHwnd(IGraphicsUnknown* pDevice, HWND hWnd, const DXGI_SWAP_CHAIN_DESC1* pDesc, const DXGI_SWAP_CHAIN_FULLSCREEN_DESC* pFullscreenDesc, IDXGIOutput* pRestrictToOutput, IDXGISwapChain1** ppSwapChain)
{
return m_realFactory->CreateSwapChainForHwnd(reinterpret_cast<IUnknown*>(pDevice), hWnd, pDesc, pFullscreenDesc, pRestrictToOutput, ppSwapChain);
}
HRESULT __stdcall IDXGIFactoryWrapper::CreateSwapChainForCoreWindow(IGraphicsUnknown* pDevice, IUnknown* pWindow, DXGI_SWAP_CHAIN_DESC1* pDesc, IDXGIOutput* pRestrictToOutput, IDXGISwapChain1_X** ppSwapChain)
{
IDXGISwapChain1* swap = nullptr;
HRESULT hr;
pDesc->Flags &= DXGI_SWAPCHAIN_FLAG_MASK;
pDesc->Scaling = DXGI_SCALING_ASPECT_RATIO_STRETCH;
if (pWindow == nullptr)
{
ComPtr<ICoreWindowStatic> coreWindowStatic;
RoGetActivationFactory(Wrappers::HStringReference(RuntimeClass_Windows_UI_Core_CoreWindow).Get( ), IID_PPV_ARGS(&coreWindowStatic));
ComPtr<ICoreWindow> coreWindow;
coreWindowStatic->GetForCurrentThread(&coreWindow);
pWindow = coreWindow.Get( );
hr = m_realFactory->CreateSwapChainForCoreWindow(reinterpret_cast<IUnknown*>(pDevice), pWindow, pDesc, pRestrictToOutput, &swap);
*ppSwapChain = new IDXGISwapChainWrapper(swap);
}
else
{
hr = m_realFactory->CreateSwapChainForCoreWindow(reinterpret_cast<IUnknown*>(pDevice), reinterpret_cast<CoreWindowWrapperX*>(pWindow)->m_realWindow, pDesc, pRestrictToOutput, &swap);
*ppSwapChain = new IDXGISwapChainWrapper(swap);
}
if (WinDurango::g_Overlay == nullptr)
{
::ID3D11Device2* device;
pDevice->QueryInterface(__uuidof(ID3D11Device), reinterpret_cast<void**>(&device));
device = reinterpret_cast<d3d11x::D3D11DeviceXWrapperX*>(device)->m_realDevice;
::ID3D11DeviceContext* ctx{};
device->GetImmediateContext(&ctx);
WinDurango::g_Overlay = new WinDurango::Overlay(device, ctx, reinterpret_cast<IDXGISwapChainWrapper*>(*ppSwapChain)->m_realSwapchain);
WinDurango::g_Overlay->Initialize( );
}
return hr;
}
HRESULT __stdcall IDXGIFactoryWrapper::GetSharedResourceAdapterLuid(HANDLE hResource, LUID* pLuid)
{
return m_realFactory->GetSharedResourceAdapterLuid(hResource, pLuid);
}
HRESULT __stdcall IDXGIFactoryWrapper::RegisterStereoStatusWindow(HWND WindowHandle, UINT wMsg, DWORD* pdwCookie)
{
return m_realFactory->RegisterStereoStatusWindow(WindowHandle, wMsg, pdwCookie);
}
HRESULT __stdcall IDXGIFactoryWrapper::RegisterStereoStatusEvent(HANDLE hEvent, DWORD* pdwCookie)
{
return m_realFactory->RegisterStereoStatusEvent(hEvent, pdwCookie);
}
void __stdcall IDXGIFactoryWrapper::UnregisterStereoStatus(DWORD dwCookie)
{
return m_realFactory->UnregisterStereoStatus(dwCookie);
}
HRESULT __stdcall IDXGIFactoryWrapper::RegisterOcclusionStatusWindow(HWND WindowHandle, UINT wMsg, DWORD* pdwCookie)
{
return m_realFactory->RegisterOcclusionStatusWindow(WindowHandle, wMsg, pdwCookie);
}
HRESULT __stdcall IDXGIFactoryWrapper::RegisterOcclusionStatusEvent(HANDLE hEvent, DWORD* pdwCookie)
{
return m_realFactory->RegisterOcclusionStatusEvent(hEvent, pdwCookie);
}
void __stdcall IDXGIFactoryWrapper::UnregisterOcclusionStatus(DWORD dwCookie)
{
return m_realFactory->UnregisterOcclusionStatus(dwCookie);
}
HRESULT __stdcall IDXGIFactoryWrapper::CreateSwapChainForComposition(IGraphicsUnknown* pDevice, const DXGI_SWAP_CHAIN_DESC1* pDesc, IDXGIOutput* pRestrictToOutput, IDXGISwapChain1** ppSwapChain)
{
return m_realFactory->CreateSwapChainForComposition(reinterpret_cast<IUnknown*>(pDevice), pDesc, pRestrictToOutput, ppSwapChain);
}
}

View File

@@ -1,217 +0,0 @@
#include "pch.h"
#include <chrono>
#include <thread>
#include "IDXGIWrappers.h"
#include "ID3DWrappers.h"
#include "overlay/overlay.h"
namespace d3d11x
{
// s/o to stackoverflow
template<std::intmax_t FPS>
class frame_rater {
public:
frame_rater( ) :
time_between_frames{ 1 },
tp{ std::chrono::steady_clock::now( ) }
{
}
void sleep( ) {
tp += time_between_frames;
std::this_thread::sleep_until(tp);
}
private:
std::chrono::duration<double, std::ratio<1, FPS>> time_between_frames;
std::chrono::time_point<std::chrono::steady_clock, decltype(time_between_frames)> tp;
};
inline frame_rater<60> fps60 = {};
HRESULT IDXGISwapChainWrapper::QueryInterface(REFIID riid, void** ppvObject)
{
if (riid == __uuidof(IDXGISwapChain1) || riid == __uuidof(IDXGISwapChain))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
// DEBUG
char iidstr[ sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}") ];
OLECHAR iidwstr[ sizeof(iidstr) ];
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr));
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr);
printf("[IDXGIDeviceWrapper] QueryInterface: %s\n", iidstr);
*ppvObject = nullptr;
return E_NOINTERFACE;
}
ULONG IDXGISwapChainWrapper::AddRef( )
{
printf("[IDXGISwapChainWrapper] --> AddRef\n");
return InterlockedIncrement(&m_RefCount);
}
ULONG IDXGISwapChainWrapper::Release( )
{
printf("[IDXGISwapChainWrapper] --> Release\n");
ULONG refCount = InterlockedDecrement(&m_RefCount);
if (refCount == 0)
delete this;
return refCount;
}
HRESULT __stdcall IDXGISwapChainWrapper::SetPrivateData(REFGUID Name, UINT DataSize, const void* pData)
{
return m_realSwapchain->SetPrivateData(Name, DataSize, pData);
}
HRESULT __stdcall IDXGISwapChainWrapper::SetPrivateDataInterface(REFGUID Name, const IUnknown* pUnknown)
{
return m_realSwapchain->SetPrivateDataInterface(Name, pUnknown);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetPrivateData(REFGUID Name, UINT* pDataSize, void* pData)
{
return m_realSwapchain->GetPrivateData(Name, pDataSize, pData);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetParent(REFIID riid, void** ppParent)
{
return m_realSwapchain->GetParent(riid, ppParent);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetDevice(REFIID riid, void** ppDevice)
{
return m_realSwapchain->GetDevice(riid, ppDevice);
}
HRESULT __stdcall IDXGISwapChainWrapper::Present(UINT SyncInterval, UINT Flags)
{
WinDurango::g_Overlay->Present( );
return m_realSwapchain->Present(SyncInterval, Flags);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetBuffer(UINT Buffer, REFIID riid, void** ppSurface)
{
if (riid == __uuidof(ID3D11Texture2D))
{
ID3D11Texture2D* texture2d = nullptr;
HRESULT hr = m_realSwapchain->GetBuffer(Buffer, IID_PPV_ARGS(&texture2d));
*ppSurface = new ID3D11Texture2DWrapper(texture2d);
this->AddRef( );
return hr;
}
*ppSurface = nullptr;
return E_NOINTERFACE;
}
HRESULT __stdcall IDXGISwapChainWrapper::SetFullscreenState(BOOL Fullscreen, IDXGIOutput* pTarget)
{
return m_realSwapchain->SetFullscreenState(Fullscreen, pTarget);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetFullscreenState(BOOL* pFullscreen, IDXGIOutput** ppTarget)
{
return m_realSwapchain->GetFullscreenState(pFullscreen, ppTarget);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetDesc(DXGI_SWAP_CHAIN_DESC* pDesc)
{
return m_realSwapchain->GetDesc(pDesc);
}
HRESULT __stdcall IDXGISwapChainWrapper::ResizeBuffers(UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags)
{
return m_realSwapchain->ResizeBuffers(BufferCount, Width, Height, NewFormat, SwapChainFlags);
}
HRESULT __stdcall IDXGISwapChainWrapper::ResizeTarget(const DXGI_MODE_DESC* pNewTargetParameters)
{
return m_realSwapchain->ResizeTarget(pNewTargetParameters);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetContainingOutput(IDXGIOutput** ppOutput)
{
return m_realSwapchain->GetContainingOutput(ppOutput);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetFrameStatistics(DXGI_FRAME_STATISTICS* pStats)
{
return m_realSwapchain->GetFrameStatistics(pStats);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetLastPresentCount(UINT* pLastPresentCount)
{
return m_realSwapchain->GetLastPresentCount(pLastPresentCount);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetDesc1(DXGI_SWAP_CHAIN_DESC1* pDesc)
{
return m_realSwapchain->GetDesc1(pDesc);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetFullscreenDesc(DXGI_SWAP_CHAIN_FULLSCREEN_DESC* pDesc)
{
return m_realSwapchain->GetFullscreenDesc(pDesc);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetHwnd(HWND* pHwnd)
{
return m_realSwapchain->GetHwnd(pHwnd);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetCoreWindow(REFIID refiid, void** ppUnk)
{
return m_realSwapchain->GetCoreWindow(refiid, ppUnk);
}
HRESULT __stdcall IDXGISwapChainWrapper::Present1(UINT SyncInterval, UINT PresentFlags, const DXGI_PRESENT_PARAMETERS* pPresentParameters)
{
WinDurango::g_Overlay->Present( );
if (pPresentParameters == nullptr) {
//fps60.sleep( );
return m_realSwapchain->Present(SyncInterval, PresentFlags);
}
return m_realSwapchain->Present1(SyncInterval, PresentFlags, pPresentParameters);
}
BOOL __stdcall IDXGISwapChainWrapper::IsTemporaryMonoSupported(void)
{
return m_realSwapchain->IsTemporaryMonoSupported();
}
HRESULT __stdcall IDXGISwapChainWrapper::GetRestrictToOutput(IDXGIOutput** ppRestrictToOutput)
{
return m_realSwapchain->GetRestrictToOutput(ppRestrictToOutput);
}
HRESULT __stdcall IDXGISwapChainWrapper::SetBackgroundColor(const DXGI_RGBA* pColor)
{
return m_realSwapchain->SetBackgroundColor(pColor);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetBackgroundColor(DXGI_RGBA* pColor)
{
return m_realSwapchain->GetBackgroundColor(pColor);
}
HRESULT __stdcall IDXGISwapChainWrapper::SetRotation(DXGI_MODE_ROTATION Rotation)
{
return m_realSwapchain->SetRotation(Rotation);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetRotation(DXGI_MODE_ROTATION* pRotation)
{
return m_realSwapchain->GetRotation(pRotation);
}
}

View File

@@ -1,323 +0,0 @@
#pragma once
#include "IDXGI.h"
namespace d3d11x
{
class IDXGIFactoryWrapper : public d3d11x::IDXGIFactory2_X
{
public:
IDXGIFactoryWrapper(IDXGIFactory2* factory) : m_realFactory(factory)
{
m_RefCount = 1;
}
// IGraphicsUnknown
HRESULT QueryInterface(REFIID riid, void** ppvObject) override;
ULONG AddRef( ) override;
ULONG Release( ) override;
// IDXGIObject
HRESULT STDMETHODCALLTYPE SetPrivateData(_In_ REFGUID Name, UINT DataSize, _In_reads_bytes_(DataSize) const void* pData) override;
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(_In_ REFGUID Name, _In_opt_ const IUnknown* pUnknown) override;
HRESULT STDMETHODCALLTYPE GetPrivateData(_In_ REFGUID Name, _Inout_ UINT* pDataSize, _Out_writes_bytes_(*pDataSize) void* pData) override;
HRESULT STDMETHODCALLTYPE GetParent(_In_ REFIID riid, _COM_Outptr_ void** ppParent) override;
// IDXGIFactory
HRESULT STDMETHODCALLTYPE EnumAdapters(
UINT Adapter,
IDXGIAdapter** ppAdapter) override;
HRESULT STDMETHODCALLTYPE MakeWindowAssociation(
HWND WindowHandle,
UINT Flags) override;
HRESULT STDMETHODCALLTYPE GetWindowAssociation(
HWND* pWindowHandle) override;
HRESULT STDMETHODCALLTYPE CreateSwapChain(
IGraphicsUnknown* pDevice,
DXGI_SWAP_CHAIN_DESC* pDesc,
IDXGISwapChain** ppSwapChain) override;
HRESULT STDMETHODCALLTYPE CreateSoftwareAdapter(
HMODULE Module,
IDXGIAdapter** ppAdapter) override;
// IDXGIFactory1
HRESULT STDMETHODCALLTYPE EnumAdapters1(UINT Adapter, IDXGIAdapter1** ppAdapter) override;
BOOL STDMETHODCALLTYPE IsCurrent(void) override;
// IDXGIFactory2
BOOL STDMETHODCALLTYPE IsWindowedStereoEnabled(void) override;
HRESULT STDMETHODCALLTYPE CreateSwapChainForHwnd(IGraphicsUnknown* pDevice,
HWND hWnd, const DXGI_SWAP_CHAIN_DESC1* pDesc,
const DXGI_SWAP_CHAIN_FULLSCREEN_DESC* pFullscreenDesc,
IDXGIOutput* pRestrictToOutput,
IDXGISwapChain1** ppSwapChain) override;
HRESULT STDMETHODCALLTYPE CreateSwapChainForCoreWindow(
IGraphicsUnknown* pDevice,
IUnknown* pWindow,
DXGI_SWAP_CHAIN_DESC1* pDesc,
IDXGIOutput* pRestrictToOutput,
IDXGISwapChain1_X** ppSwapChain) override;
HRESULT STDMETHODCALLTYPE GetSharedResourceAdapterLuid(
HANDLE hResource,
LUID* pLuid) override;
HRESULT STDMETHODCALLTYPE RegisterStereoStatusWindow(
HWND WindowHandle,
UINT wMsg,
DWORD* pdwCookie) override;
HRESULT STDMETHODCALLTYPE RegisterStereoStatusEvent(
HANDLE hEvent,
DWORD* pdwCookie) override;
void STDMETHODCALLTYPE UnregisterStereoStatus(
DWORD dwCookie) override;
HRESULT STDMETHODCALLTYPE RegisterOcclusionStatusWindow(
HWND WindowHandle,
UINT wMsg,
DWORD* pdwCookie) override;
HRESULT STDMETHODCALLTYPE RegisterOcclusionStatusEvent(
HANDLE hEvent,
DWORD* pdwCookie) override;
void STDMETHODCALLTYPE UnregisterOcclusionStatus(
DWORD dwCookie) override;
HRESULT STDMETHODCALLTYPE CreateSwapChainForComposition(
IGraphicsUnknown* pDevice,
const DXGI_SWAP_CHAIN_DESC1* pDesc,
IDXGIOutput* pRestrictToOutput,
IDXGISwapChain1** ppSwapChain) override;
private:
::IDXGIFactory2* m_realFactory;
};
class IDXGIAdapterWrapper : public IDXGIAdapter_X
{
public:
IDXGIAdapterWrapper(IDXGIAdapter* adapter) : m_realAdapter(adapter)
{
m_RefCount = 1;
}
// IGraphicsUnknown
HRESULT QueryInterface(REFIID riid, void** ppvObject) override;
ULONG AddRef( ) override;
ULONG Release( ) override;
// IDXGIObject
HRESULT STDMETHODCALLTYPE SetPrivateData(_In_ REFGUID Name, UINT DataSize, _In_reads_bytes_(DataSize) const void* pData) override;
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(_In_ REFGUID Name, _In_opt_ const IUnknown* pUnknown) override;
HRESULT STDMETHODCALLTYPE GetPrivateData(_In_ REFGUID Name, _Inout_ UINT* pDataSize, _Out_writes_bytes_(*pDataSize) void* pData) override;
HRESULT STDMETHODCALLTYPE GetParent(_In_ REFIID riid, _COM_Outptr_ void** ppParent) override;
HRESULT STDMETHODCALLTYPE EnumOutputs(
UINT Output,
IDXGIOutput** ppOutput) override;
HRESULT STDMETHODCALLTYPE GetDesc(
DXGI_ADAPTER_DESC* pDesc) override;
HRESULT STDMETHODCALLTYPE CheckInterfaceSupport(
REFGUID InterfaceName,
LARGE_INTEGER* pUMDVersion) override;
private:
::IDXGIAdapter* m_realAdapter;
};
class IDXGIDeviceWrapper : public IDXGIDevice_X
{
public:
IDXGIDeviceWrapper(IDXGIDevice1* device) : m_realDevice(device)
{
m_RefCount = 1;
}
// IGraphicsUnknown
HRESULT QueryInterface(REFIID riid, void** ppvObject) override;
ULONG AddRef( ) override;
ULONG Release( ) override;
// IDXGIObject
HRESULT STDMETHODCALLTYPE SetPrivateData(_In_ REFGUID Name, UINT DataSize, _In_reads_bytes_(DataSize) const void* pData) override;
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(_In_ REFGUID Name, _In_opt_ const IUnknown* pUnknown) override;
HRESULT STDMETHODCALLTYPE GetPrivateData(_In_ REFGUID Name, _Inout_ UINT* pDataSize, _Out_writes_bytes_(*pDataSize) void* pData) override;
HRESULT STDMETHODCALLTYPE GetParent(_In_ REFIID riid, _COM_Outptr_ void** ppParent) override;
HRESULT STDMETHODCALLTYPE GetAdapter(
_COM_Outptr_ IDXGIAdapter_X** pAdapter) override;
HRESULT STDMETHODCALLTYPE CreateSurface(
_In_ const DXGI_SURFACE_DESC* pDesc,
UINT NumSurfaces,
DXGI_USAGE Usage,
_In_opt_ const DXGI_SHARED_RESOURCE* pSharedResource,
_Out_writes_(NumSurfaces) IDXGISurface** ppSurface) override;
HRESULT STDMETHODCALLTYPE QueryResourceResidency(
_In_reads_(NumResources) IGraphicsUnknown** ppResources,
_Out_writes_(NumResources) DXGI_RESIDENCY* pResidencyStatus,
UINT NumResources) override;
HRESULT STDMETHODCALLTYPE SetGPUThreadPriority(
INT Priority) override;
HRESULT STDMETHODCALLTYPE GetGPUThreadPriority(
_Out_ INT* pPriority) override;
private:
::IDXGIDevice* m_realDevice;
};
class IDXGISwapChainWrapper : public IDXGISwapChain1_X
{
public:
IDXGISwapChainWrapper(IDXGISwapChain1* swapchain) : m_realSwapchain(swapchain)
{
m_RefCount = 1;
}
// IGraphicsUnknown
HRESULT QueryInterface(REFIID riid, void** ppvObject) override;
ULONG AddRef( ) override;
ULONG Release( ) override;
// IDXGIObject
HRESULT STDMETHODCALLTYPE SetPrivateData(_In_ REFGUID Name, UINT DataSize, _In_reads_bytes_(DataSize) const void* pData) override;
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(_In_ REFGUID Name, _In_opt_ const IUnknown* pUnknown) override;
HRESULT STDMETHODCALLTYPE GetPrivateData(_In_ REFGUID Name, _Inout_ UINT* pDataSize, _Out_writes_bytes_(*pDataSize) void* pData) override;
HRESULT STDMETHODCALLTYPE GetParent(_In_ REFIID riid, _COM_Outptr_ void** ppParent) override;
// IDXGIDeviceSubObject
HRESULT STDMETHODCALLTYPE GetDevice(
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][retval][out] */
_COM_Outptr_ void** ppDevice) override;
// IDXGISwapChain
HRESULT STDMETHODCALLTYPE Present(
/* [in] */ UINT SyncInterval,
/* [in] */ UINT Flags) override;
HRESULT STDMETHODCALLTYPE GetBuffer(
/* [in] */ UINT Buffer,
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][out][in] */
_COM_Outptr_ void** ppSurface) override;
HRESULT STDMETHODCALLTYPE SetFullscreenState(
/* [in] */ BOOL Fullscreen,
/* [annotation][in] */
_In_opt_ IDXGIOutput* pTarget) override;
HRESULT STDMETHODCALLTYPE GetFullscreenState(
/* [annotation][out] */
_Out_opt_ BOOL* pFullscreen,
/* [annotation][out] */
_COM_Outptr_opt_result_maybenull_ IDXGIOutput** ppTarget) override;
HRESULT STDMETHODCALLTYPE GetDesc(
/* [annotation][out] */
_Out_ DXGI_SWAP_CHAIN_DESC* pDesc) override;
HRESULT STDMETHODCALLTYPE ResizeBuffers(
/* [in] */ UINT BufferCount,
/* [in] */ UINT Width,
/* [in] */ UINT Height,
/* [in] */ DXGI_FORMAT NewFormat,
/* [in] */ UINT SwapChainFlags) override;
HRESULT STDMETHODCALLTYPE ResizeTarget(
/* [annotation][in] */
_In_ const DXGI_MODE_DESC* pNewTargetParameters) override;
HRESULT STDMETHODCALLTYPE GetContainingOutput(
/* [annotation][out] */
_COM_Outptr_ IDXGIOutput** ppOutput) override;
HRESULT STDMETHODCALLTYPE GetFrameStatistics(
/* [annotation][out] */
_Out_ DXGI_FRAME_STATISTICS* pStats) override;
HRESULT STDMETHODCALLTYPE GetLastPresentCount(
/* [annotation][out] */
_Out_ UINT* pLastPresentCount) override;
HRESULT STDMETHODCALLTYPE GetDesc1(
/* [annotation][out] */
_Out_ DXGI_SWAP_CHAIN_DESC1* pDesc) override;
HRESULT STDMETHODCALLTYPE GetFullscreenDesc(
/* [annotation][out] */
_Out_ DXGI_SWAP_CHAIN_FULLSCREEN_DESC* pDesc) override;
HRESULT STDMETHODCALLTYPE GetHwnd(
/* [annotation][out] */
_Out_ HWND* pHwnd) override;
HRESULT STDMETHODCALLTYPE GetCoreWindow(
/* [annotation][in] */
_In_ REFIID refiid,
/* [annotation][out] */
_COM_Outptr_ void** ppUnk) override;
HRESULT STDMETHODCALLTYPE Present1(
/* [in] */ UINT SyncInterval,
/* [in] */ UINT PresentFlags,
/* [annotation][in] */
_In_ const DXGI_PRESENT_PARAMETERS* pPresentParameters) override;
BOOL STDMETHODCALLTYPE IsTemporaryMonoSupported(void) override;
HRESULT STDMETHODCALLTYPE GetRestrictToOutput(
/* [annotation][out] */
_Out_ IDXGIOutput** ppRestrictToOutput) override;
HRESULT STDMETHODCALLTYPE SetBackgroundColor(
/* [annotation][in] */
_In_ const DXGI_RGBA* pColor)override;
HRESULT STDMETHODCALLTYPE GetBackgroundColor(
/* [annotation][out] */
_Out_ DXGI_RGBA* pColor) override;
HRESULT STDMETHODCALLTYPE SetRotation(
/* [annotation][in] */
_In_ DXGI_MODE_ROTATION Rotation) override;
HRESULT STDMETHODCALLTYPE GetRotation(
/* [annotation][out] */
_Out_ DXGI_MODE_ROTATION* pRotation) override;
public:
IDXGISwapChain1* m_realSwapchain;
};
}

View File

@@ -1,13 +1,51 @@
// ReSharper disable CppInconsistentNaming
// ReSharper disable CppClangTidyClangDiagnosticUnusedFunction
#include "pch.h"
#include "d3d11_x.h"
#include <cstdio>
#include <mutex>
#include "d3d_x/d3d_x.hpp"
#include "ID3DWrappers.h"
#include "overlay/overlay.h"
#include <d3d11.h>
#include "device_context_x.h"
#include "device_x.h"
HRESULT CreateDevice(UINT Flags, wdi::ID3D11Device** ppDevice, wdi::ID3D11DeviceContext** ppImmediateContext)
{
D3D_FEATURE_LEVEL featurelevels[] = {
D3D_FEATURE_LEVEL_11_1,
D3D_FEATURE_LEVEL_11_0,
};
ID3D11Device2* device2{};
ID3D11DeviceContext2* device_context2{};
auto flags = Flags & CREATE_DEVICE_FLAG_MASK;
#ifdef _DEBUG
flags |= D3D11_CREATE_DEVICE_DEBUG;
#endif
HRESULT hr = D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, flags, featurelevels, _ARRAYSIZE(featurelevels), D3D11_SDK_VERSION, reinterpret_cast<ID3D11Device**>(ppDevice), NULL, reinterpret_cast<ID3D11DeviceContext**>(ppImmediateContext));
if (SUCCEEDED(hr))
{
// get dx11.2 feature level, since that's what dx11.x inherits from
if (ppDevice != nullptr)
{
(*ppDevice)->QueryInterface(IID_PPV_ARGS(&device2));
*ppDevice = reinterpret_cast<wdi::ID3D11Device*>(new wd::device_x(device2));
}
if (ppImmediateContext != nullptr)
{
(*ppImmediateContext)->QueryInterface(IID_PPV_ARGS(&device_context2));
*ppImmediateContext = reinterpret_cast<wdi::ID3D11DeviceContext*>(new wd::device_context_x(device_context2));
}
}
else
{
printf("failed to assign wrapped device, result code 0x%X, error code 0x%X\n", hr, GetLastError( ));
}
return hr;
}
HRESULT _stdcall D3DQuerySEQCounters_X(D3D_SEQ_COUNTER_DATA* pData)
{
@@ -142,9 +180,9 @@ HRESULT __stdcall D3D11CreateDevice_X(
_In_reads_opt_(FeatureLevels) CONST D3D_FEATURE_LEVEL* pFeatureLevels,
UINT FeatureLevels,
UINT SDKVersion,
_Out_opt_ d3d11x::ID3D11Device** ppDevice,
_Out_opt_ wdi::ID3D11Device** ppDevice,
_Out_opt_ D3D_FEATURE_LEVEL* pFeatureLevel,
_Out_opt_ d3d11x::ID3D11DeviceContext** ppImmediateContext)
_Out_opt_ wdi::ID3D11DeviceContext** ppImmediateContext)
{
printf("!!! Game is trying to initialize D3D11 through NORMAL D3D11 !!!\n");
printf("SDK Version: %d\n", SDKVersion);
@@ -164,67 +202,28 @@ HRESULT __stdcall D3D11CreateDevice_X(
ID3D11DeviceContext2* device_context2{};
auto flags = Flags & CREATE_DEVICE_FLAG_MASK;
#ifdef _DEBUG
//flags |= D3D11_CREATE_DEVICE_DEBUG;
flags |= D3D11_CREATE_DEVICE_DEBUG;
#endif
HRESULT hr = D3D11CreateDevice(pAdapter, DriverType, Software, flags, featurelevels, _ARRAYSIZE(featurelevels), SDKVersion, (ID3D11Device**)ppDevice, pFeatureLevel, (ID3D11DeviceContext**)ppImmediateContext);
HRESULT hr = D3D11CreateDevice(pAdapter, DriverType, Software, flags, featurelevels, _ARRAYSIZE(featurelevels), SDKVersion, (ID3D11Device**) ppDevice, pFeatureLevel, (ID3D11DeviceContext**) ppImmediateContext);
if (SUCCEEDED(hr))
if (SUCCEEDED(hr))
{
// get dx11.2 feature level, since that's what dx11.x inherits from
if (ppDevice != nullptr)
if (ppDevice != nullptr)
{
(*ppDevice)->QueryInterface(IID_PPV_ARGS(&device2));
*ppDevice = reinterpret_cast<d3d11x::ID3D11Device*>(new d3d11x::D3D11DeviceXWrapperX(device2));
*ppDevice = reinterpret_cast<wdi::ID3D11Device*>(new wd::device_x(device2));
}
if (ppImmediateContext != nullptr)
{
(*ppImmediateContext)->QueryInterface(IID_PPV_ARGS(&device_context2));
*ppImmediateContext = reinterpret_cast<d3d11x::ID3D11DeviceContext*>(new d3d11x::ID3D11DeviceContextXWrapper(device_context2));
*ppImmediateContext = reinterpret_cast<wdi::ID3D11DeviceContext*>(new wd::device_context_x(device_context2));
}
}
else
{
printf("failed to assign wrapped device, result code 0x%X, error code 0x%X\n", hr, GetLastError());
}
return hr;
}
HRESULT __stdcall D3D11XCreateDeviceX_X(
_In_ const D3D11X_CREATE_DEVICE_PARAMETERS* pParameters,
_Out_opt_ d3d11x::ID3D11Device** ppDevice,
_Out_opt_ d3d11x::ID3D11DeviceContext** ppImmediateContext)
{
printf("!!! Game is trying to initialize D3D11 through D3D11X !!!");
printf("SDK Version: %d\n", pParameters->Version);
D3D_FEATURE_LEVEL featurelevels[] = {
D3D_FEATURE_LEVEL_11_1,
D3D_FEATURE_LEVEL_11_0,
};
ID3D11Device2* device2{};
ID3D11DeviceContext2* device_context2{};
auto flags = pParameters->Flags & CREATE_DEVICE_FLAG_MASK;
#ifdef _DEBUG
//flags |= D3D11_CREATE_DEVICE_DEBUG;
#endif
HRESULT hr = D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, 0, flags, featurelevels, _ARRAYSIZE(featurelevels), D3D11_SDK_VERSION, reinterpret_cast<ID3D11Device**>(ppDevice), NULL, reinterpret_cast<ID3D11DeviceContext**>(ppImmediateContext));
if (SUCCEEDED(hr))
{
// get dx11.2 feature level, since that's what dx11.x inherits from
// MAYBE-TODO: VS doesn't like this line due to ppDevice not having a clear value. Maybe check if ppDevice is valid before deref.
(*ppDevice)->QueryInterface(IID_PPV_ARGS(&device2));
(*ppImmediateContext)->QueryInterface(IID_PPV_ARGS(&device_context2));
*ppDevice = reinterpret_cast<d3d11x::ID3D11Device*>(new d3d11x::D3D11DeviceXWrapperX(device2));
*ppImmediateContext = reinterpret_cast<d3d11x::ID3D11DeviceContext*>(new d3d11x::ID3D11DeviceContextXWrapper(device_context2));
}
else
{
printf("failed to assign wrapped device, result code 0x%X, error code 0x%X\n", hr, GetLastError( ));
}
@@ -232,6 +231,17 @@ HRESULT __stdcall D3D11XCreateDeviceX_X(
return hr;
}
HRESULT __stdcall D3D11XCreateDeviceX_X(
_In_ const D3D11X_CREATE_DEVICE_PARAMETERS* pParameters,
_Out_opt_ wdi::ID3D11Device** ppDevice,
_Out_opt_ wdi::ID3D11DeviceContext** ppImmediateContext)
{
printf("!!! Game is trying to initialize D3D11 through D3D11X !!!");
printf("SDK Version: %d\n", pParameters->Version);
return CreateDevice(pParameters->Flags, ppDevice, ppImmediateContext);
}
HRESULT __stdcall D3D11CreateDeviceAndSwapChain_X(
_In_opt_ IDXGIAdapter* pAdapter,
D3D_DRIVER_TYPE DriverType,
@@ -251,6 +261,8 @@ HRESULT __stdcall D3D11CreateDeviceAndSwapChain_X(
return D3D11CreateDeviceAndSwapChain(pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, pSwapChainDesc, ppSwapChain, ppDevice, pFeatureLevel, ppImmediateContext);
}
std::mutex g_NotifyMutex;
// this function exists for other WinDurango dlls to notify the graphics component of an action

View File

@@ -2,8 +2,10 @@
#ifndef D3D11_X
#define D3D11_X
#include <d3d11.h>
#include <format>
#include "dxgi1_5.h"
#include "d3d_x/d3d_x.hpp"
// remove all XBOX only flags passed to CreateDevice
#define CREATE_DEVICE_FLAG_MASK (D3D11_CREATE_DEVICE_SINGLETHREADED | D3D11_CREATE_DEVICE_DEBUG | D3D11_CREATE_DEVICE_SWITCH_TO_REF | \
@@ -117,7 +119,46 @@ extern "C" const GUID DXGI_DEBUG_ALL;
DEFINE_GUID(DXGI_DEBUG_DX, 0x35cdd7fc, 0x13b2, 0x421d, 0xa5, 0xd7, 0x7e, 0x44, 0x51, 0x28, 0x7d, 0x64);
DEFINE_GUID(DXGI_DEBUG_DXGI, 0x25cddaa4, 0xb1c6, 0x47e1, 0xac, 0x3e, 0x98, 0x87, 0x5b, 0x5a, 0x2e, 0x2a);
DEFINE_GUID(DXGI_DEBUG_APP, 0x6cd6e01, 0x4219, 0x4ebd, 0x87, 0x9, 0x27, 0xed, 0x23, 0x36, 0xc, 0x62);
DEFINE_GUID(DXGI_DEBUG_D3D11, 0x4b99317b, 0xac39, 0x4aa6, 0xbb, 0xb, 0xba, 0xa0, 0x47, 0x84, 0x79, 0x8f);
#define DX_MAJOR 2
#define DX_MINOR 18
#define MAKEINTVERSION(major, minor) (((0LL + (major)) << 48) | ((0LL + (minor)) << 32))
#define DX_VERSION (((0LL + (DX_MAJOR)) << 48) | ((0LL + (DX_MINOR)) << 32))
#define D3DDECL_UUID(Uuid) __declspec(uuid(#Uuid))
#define D3DINTERFACE(Name, Guid0, Guid1, Guid2, Guid3, Guid4, \
Guid5, Guid6, Guid7, Guid8, Guid9, Guid10) \
class D3DDECL_UUID(Guid0-Guid1-Guid2-Guid3##Guid4-Guid5##Guid6##Guid7##Guid8##Guid9##Guid10) Name
#define TRACE_INTERFACE_NOT_HANDLED(class_name) \
char iidstr[ sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}") ]; \
OLECHAR iidwstr[ sizeof(iidstr) ]; \
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr)); \
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr); \
MessageBoxA(NULL, std::format("[{}] INTERFACE NOT HANDLED: {}", class_name, iidstr).c_str(), "WD - d3d11_x", MB_OK) \
#define IGU_DEFINE_REF \
ULONG AddRef( ) override { \
wrapped_interface->AddRef( ); \
return InterlockedIncrement(&m_RefCount); \
} \
\
ULONG Release( ) override { \
ULONG refCount = InterlockedDecrement(&m_RefCount); \
wrapped_interface->Release( ); \
\
if (refCount == 0) \
{ \
wrapped_interface->Release( ); \
delete this; \
} \
\
return refCount; \
} \
#define TRACE_NOT_IMPLEMENTED(class_name) \
MessageBoxA(NULL, std::format("[{}] NOT IMPLEMENTED\n{} - line {}", class_name, __FILE__, __LINE__).c_str(), "WD - d3d11_x", MB_OK) \
#endif

View File

@@ -57,9 +57,9 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;D3D11X_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -77,8 +77,9 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;D3D11X_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -86,10 +87,35 @@
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<AdditionalDependencies>d3d11.lib;%(AdditionalDependencies);runtimeobject.lib</AdditionalDependencies>
<AdditionalDependencies>d3d10.lib;d3d11.lib;dxgi.lib;%(AdditionalDependencies);runtimeobject.lib</AdditionalDependencies>
<ModuleDefinitionFile>Exports.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<None Include="Exports.def" />
<None Include="Exports.def.bak" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\thirdparty\imgui\backends\imgui_impl_dx11.cpp" />
<ClCompile Include="..\..\thirdparty\imgui\imgui.cpp" />
<ClCompile Include="..\..\thirdparty\imgui\imgui_demo.cpp" />
<ClCompile Include="..\..\thirdparty\imgui\imgui_draw.cpp" />
<ClCompile Include="..\..\thirdparty\imgui\imgui_tables.cpp" />
<ClCompile Include="..\..\thirdparty\imgui\imgui_widgets.cpp" />
<ClCompile Include="..\..\thirdparty\imgui_impl_uwp.cpp" />
<ClCompile Include="d3d11_x.cpp" />
<ClCompile Include="device_child_x.cpp" />
<ClCompile Include="device_context_x.cpp" />
<ClCompile Include="device_x.cpp" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="dxgi_adapter.cpp" />
<ClCompile Include="dxgi_device.cpp" />
<ClCompile Include="dxgi_factory.cpp" />
<ClCompile Include="dxgi_object.cpp" />
<ClCompile Include="dxgi_swapchain.cpp" />
<ClCompile Include="graphics_unknown.cpp" />
<ClCompile Include="overlay\overlay.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\thirdparty\imgui\backends\imgui_impl_dx11.h" />
<ClInclude Include="..\..\thirdparty\imgui\imconfig.h" />
@@ -100,66 +126,18 @@
<ClInclude Include="..\..\thirdparty\imgui\imstb_truetype.h" />
<ClInclude Include="..\..\thirdparty\imgui_impl_uwp.h" />
<ClInclude Include="d3d11_x.h" />
<ClInclude Include="d3d_x\d3d11_x_device.h" />
<ClInclude Include="d3d_x\d3d_x.hpp" />
<ClInclude Include="Exports.def" />
<ClInclude Include="framework.h" />
<ClInclude Include="ID3DDeviceContext.h" />
<ClInclude Include="ID3DWrappers.h" />
<ClInclude Include="ID3DX.h" />
<ClInclude Include="IDXGIWrappers.h" />
<ClInclude Include="device_child_x.h" />
<ClInclude Include="device_context_x.h" />
<ClInclude Include="device_x.h" />
<ClInclude Include="dxgi_adapter.h" />
<ClInclude Include="dxgi_device.h" />
<ClInclude Include="dxgi_factory.h" />
<ClInclude Include="dxgi_object.hpp" />
<ClInclude Include="dxgi_swapchain.h" />
<ClInclude Include="graphics_unknown.h" />
<ClInclude Include="overlay\overlay.h" />
<ClInclude Include="pch.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\thirdparty\imgui\backends\imgui_impl_dx11.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\thirdparty\imgui\imgui.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\thirdparty\imgui\imgui_demo.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\thirdparty\imgui\imgui_draw.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\thirdparty\imgui\imgui_tables.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\thirdparty\imgui\imgui_widgets.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\thirdparty\imgui_impl_uwp.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="d3d11_x.cpp" />
<ClCompile Include="d3d_x\d3d11_x_device.cpp" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="ID3D11BufferWrapper.cpp" />
<ClCompile Include="ID3D11ViewWrapper.cpp" />
<ClCompile Include="ID3D11TextureWrapper.cpp" />
<ClCompile Include="ID3DWrappers.cpp" />
<ClCompile Include="IDXGI.h" />
<ClCompile Include="IDXGIAdapterWrapper.cpp" />
<ClCompile Include="IDXGIDeviceWrapper.cpp" />
<ClCompile Include="IDXGIFactoryWrapper.cpp" />
<ClCompile Include="IDXGISwapChainWrapper.cpp" />
<ClCompile Include="overlay\overlay.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="Exports.def.bak" />
<ClInclude Include="resource.hpp" />
<ClInclude Include="view.hpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@@ -1,156 +1,161 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Source Files\ID3D">
<UniqueIdentifier>{21a7221a-d303-4d64-98fa-eb1ef76f3c17}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\ID3D">
<UniqueIdentifier>{a66d9c88-9c40-410e-8899-f02975549067}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\IDXGI">
<UniqueIdentifier>{cc2a8930-4142-49f7-9b17-f71e472520ed}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\IDXGI">
<UniqueIdentifier>{93367b01-f957-4ef5-82c7-4aab1139fc9c}</UniqueIdentifier>
</Filter>
<None Include="Exports.def.bak" />
<None Include="Exports.def" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="d3d11_x.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="pch.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Exports.def">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="d3d_x\d3d_x.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="d3d_x\d3d11_x_device.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="IDXGIWrappers.h">
<Filter>Header Files\IDXGI</Filter>
</ClInclude>
<ClInclude Include="ID3DX.h">
<Filter>Header Files\ID3D</Filter>
</ClInclude>
<ClInclude Include="ID3DWrappers.h">
<Filter>Header Files\ID3D</Filter>
</ClInclude>
<ClInclude Include="ID3DDeviceContext.h">
<Filter>Header Files\ID3D</Filter>
</ClInclude>
<ClInclude Include="overlay\overlay.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\thirdparty\imgui_impl_uwp.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\thirdparty\imgui\imconfig.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\thirdparty\imgui\imgui.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\thirdparty\imgui\imgui_internal.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\thirdparty\imgui\imstb_rectpack.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\thirdparty\imgui\imstb_textedit.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\thirdparty\imgui\imstb_truetype.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\thirdparty\imgui\backends\imgui_impl_dx11.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="d3d11_x.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="dllmain.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="pch.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="d3d_x\d3d11_x_device.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="IDXGI.h">
<Filter>Header Files\IDXGI</Filter>
</ClCompile>
<ClCompile Include="IDXGIFactoryWrapper.cpp">
<Filter>Source Files\IDXGI</Filter>
</ClCompile>
<ClCompile Include="IDXGIDeviceWrapper.cpp">
<Filter>Source Files\IDXGI</Filter>
</ClCompile>
<ClCompile Include="IDXGIAdapterWrapper.cpp">
<Filter>Source Files\IDXGI</Filter>
</ClCompile>
<ClCompile Include="ID3D11TextureWrapper.cpp">
<Filter>Source Files\ID3D</Filter>
</ClCompile>
<ClCompile Include="IDXGISwapChainWrapper.cpp">
<Filter>Source Files\IDXGI</Filter>
</ClCompile>
<ClCompile Include="ID3D11ViewWrapper.cpp">
<Filter>Source Files\ID3D</Filter>
</ClCompile>
<ClCompile Include="ID3DWrappers.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ID3D11BufferWrapper.cpp">
<Filter>Source Files\ID3D</Filter>
</ClCompile>
<ClCompile Include="overlay\overlay.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="d3d11_x.cpp" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="..\..\thirdparty\imgui_impl_uwp.cpp">
<Filter>Source Files</Filter>
<Filter>imgui</Filter>
</ClCompile>
<ClCompile Include="..\..\thirdparty\imgui\imgui.cpp">
<Filter>Source Files</Filter>
<Filter>imgui</Filter>
</ClCompile>
<ClCompile Include="..\..\thirdparty\imgui\imgui_demo.cpp">
<Filter>Source Files</Filter>
<Filter>imgui</Filter>
</ClCompile>
<ClCompile Include="..\..\thirdparty\imgui\imgui_draw.cpp">
<Filter>Source Files</Filter>
<Filter>imgui</Filter>
</ClCompile>
<ClCompile Include="..\..\thirdparty\imgui\imgui_tables.cpp">
<Filter>Source Files</Filter>
<Filter>imgui</Filter>
</ClCompile>
<ClCompile Include="..\..\thirdparty\imgui\imgui_widgets.cpp">
<Filter>Source Files</Filter>
<Filter>imgui</Filter>
</ClCompile>
<ClCompile Include="..\..\thirdparty\imgui\backends\imgui_impl_dx11.cpp">
<Filter>Source Files</Filter>
<Filter>imgui</Filter>
</ClCompile>
<ClCompile Include="device_context_x.cpp">
<Filter>wrappers\device_context_x</Filter>
</ClCompile>
<ClCompile Include="graphics_unknown.cpp">
<Filter>wrappers\graphics_unknown</Filter>
</ClCompile>
<ClCompile Include="device_x.cpp">
<Filter>wrappers\device_x</Filter>
</ClCompile>
<ClCompile Include="dxgi_factory.cpp">
<Filter>wrappers\dxgi_factory</Filter>
</ClCompile>
<ClCompile Include="dxgi_swapchain.cpp">
<Filter>wrappers\dxgi_swapchain</Filter>
</ClCompile>
<ClCompile Include="dxgi_adapter.cpp">
<Filter>wrappers\dxgi_adapter</Filter>
</ClCompile>
<ClCompile Include="dxgi_device.cpp">
<Filter>wrappers\dxgi_device</Filter>
</ClCompile>
<ClCompile Include="device_child_x.cpp">
<Filter>wrappers\device_child_x</Filter>
</ClCompile>
<ClCompile Include="overlay\overlay.cpp">
<Filter>overlay</Filter>
</ClCompile>
<ClCompile Include="dxgi_object.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="Exports.def.bak" />
<ClInclude Include="d3d11_x.h" />
<ClInclude Include="..\..\thirdparty\imgui_impl_uwp.h">
<Filter>imgui</Filter>
</ClInclude>
<ClInclude Include="..\..\thirdparty\imgui\imconfig.h">
<Filter>imgui</Filter>
</ClInclude>
<ClInclude Include="..\..\thirdparty\imgui\imgui.h">
<Filter>imgui</Filter>
</ClInclude>
<ClInclude Include="..\..\thirdparty\imgui\imgui_internal.h">
<Filter>imgui</Filter>
</ClInclude>
<ClInclude Include="..\..\thirdparty\imgui\imstb_rectpack.h">
<Filter>imgui</Filter>
</ClInclude>
<ClInclude Include="..\..\thirdparty\imgui\imstb_textedit.h">
<Filter>imgui</Filter>
</ClInclude>
<ClInclude Include="..\..\thirdparty\imgui\imstb_truetype.h">
<Filter>imgui</Filter>
</ClInclude>
<ClInclude Include="..\..\thirdparty\imgui\backends\imgui_impl_dx11.h">
<Filter>imgui</Filter>
</ClInclude>
<ClInclude Include="graphics_unknown.h">
<Filter>wrappers\graphics_unknown</Filter>
</ClInclude>
<ClInclude Include="device_x.h">
<Filter>wrappers\device_x</Filter>
</ClInclude>
<ClInclude Include="dxgi_factory.h">
<Filter>wrappers\dxgi_factory</Filter>
</ClInclude>
<ClInclude Include="dxgi_swapchain.h">
<Filter>wrappers\dxgi_swapchain</Filter>
</ClInclude>
<ClInclude Include="dxgi_adapter.h">
<Filter>wrappers\dxgi_adapter</Filter>
</ClInclude>
<ClInclude Include="dxgi_device.h">
<Filter>wrappers\dxgi_device</Filter>
</ClInclude>
<ClInclude Include="device_child_x.h">
<Filter>wrappers\device_child_x</Filter>
</ClInclude>
<ClInclude Include="device_context_x.h">
<Filter>wrappers\device_context_x</Filter>
</ClInclude>
<ClInclude Include="view.hpp">
<Filter>wrappers\shared</Filter>
</ClInclude>
<ClInclude Include="resource.hpp">
<Filter>wrappers\shared</Filter>
</ClInclude>
<ClInclude Include="overlay\overlay.h">
<Filter>overlay</Filter>
</ClInclude>
<ClInclude Include="dxgi_object.hpp">
<Filter>wrappers\shared</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="imgui">
<UniqueIdentifier>{05dbf885-3dd2-475f-8171-033a782575c9}</UniqueIdentifier>
</Filter>
<Filter Include="wrappers">
<UniqueIdentifier>{39b32424-9e02-45ef-aa1d-35d2c826c195}</UniqueIdentifier>
</Filter>
<Filter Include="wrappers\device_context_x">
<UniqueIdentifier>{1a6f44de-5d28-438f-979d-fa49751b49b1}</UniqueIdentifier>
</Filter>
<Filter Include="wrappers\device_x">
<UniqueIdentifier>{8b45d36f-f82a-42a4-9ab4-49cd5f4e84f5}</UniqueIdentifier>
</Filter>
<Filter Include="wrappers\dxgi_swapchain">
<UniqueIdentifier>{fa3c5ff2-f1d3-47ab-b788-aeae8b5b1fa3}</UniqueIdentifier>
</Filter>
<Filter Include="wrappers\dxgi_adapter">
<UniqueIdentifier>{779f96ac-8cf1-454a-b925-af90d267f050}</UniqueIdentifier>
</Filter>
<Filter Include="wrappers\dxgi_device">
<UniqueIdentifier>{04a867f6-7f1f-46a0-90ee-c8b5406ecb04}</UniqueIdentifier>
</Filter>
<Filter Include="wrappers\shared">
<UniqueIdentifier>{4da0bfed-551b-45f1-81fc-f183c0e9d847}</UniqueIdentifier>
</Filter>
<Filter Include="wrappers\graphics_unknown">
<UniqueIdentifier>{2afc72a9-22d2-49a6-a611-f539527d3e1c}</UniqueIdentifier>
</Filter>
<Filter Include="wrappers\device_child_x">
<UniqueIdentifier>{e284d976-b304-4e1e-98ef-7a22d8eeaa8d}</UniqueIdentifier>
</Filter>
<Filter Include="wrappers\dxgi_factory">
<UniqueIdentifier>{a326eddd-f6a8-4e01-bd0b-6c5b91adf983}</UniqueIdentifier>
</Filter>
<Filter Include="overlay">
<UniqueIdentifier>{c54987f8-e8bd-47e3-8940-2740f44a8f49}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>

View File

@@ -1,478 +0,0 @@
#include "pch.h"
#include "d3d11_x_device.h"
#include "d3d_x.hpp"
#include "../IDXGIWrappers.h"
#include "../ID3DWrappers.h"
#pragma region ID3D11DeviceX
// QueryInterface need to be in the cpp file because of circular dependency for IDXGIDeviceWrapper :}
#define TEXTURE_MISCFLAGS_MASK (D3D11_RESOURCE_MISC_GENERATE_MIPS | D3D11_RESOURCE_MISC_SHARED | D3D11_RESOURCE_MISC_TEXTURECUBE | \
D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS | D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS | D3D11_RESOURCE_MISC_BUFFER_STRUCTURED | \
D3D11_RESOURCE_MISC_RESOURCE_CLAMP | D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX | D3D11_RESOURCE_MISC_GDI_COMPATIBLE | \
D3D11_RESOURCE_MISC_SHARED_NTHANDLE | D3D11_RESOURCE_MISC_RESTRICTED_CONTENT | D3D11_RESOURCE_MISC_RESTRICT_SHARED_RESOURCE | \
D3D11_RESOURCE_MISC_RESTRICT_SHARED_RESOURCE_DRIVER | D3D11_RESOURCE_MISC_GUARDED | \
D3D11_RESOURCE_MISC_TILED | D3D11_RESOURCE_MISC_HW_PROTECTED | D3D11_RESOURCE_MISC_SHARED_DISPLAYABLE | D3D11_RESOURCE_MISC_SHARED_EXCLUSIVE_WRITER)
#define ERROR_LOG_FUNC() if(FAILED(hr)) { printf("[%s] hresult fail 0x%X\n", __func__, hr); }
#define ERROR_LOG_HRES(res) printf("[%s] hresult fail 0x%X\n", __func__, res);
HRESULT d3d11x::D3D11DeviceXWrapperX::QueryInterface(REFIID riid, void** ppvObject)
{
// note from unixian: for debugging purposes
char iidstr[ sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}") ];
OLECHAR iidwstr[ sizeof(iidstr) ];
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr));
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr);
printf("[D3D11DeviceXWrapperX] QueryInterface: %s\n", iidstr);
if (riid == __uuidof(ID3D11DeviceX) || riid == __uuidof(ID3D11Device2) ||
riid == __uuidof(ID3D11Device1) || riid == __uuidof(ID3D11Device))
{
*ppvObject = static_cast<ID3D11DeviceX*>(this);
AddRef( );
return S_OK;
}
else if (riid == __uuidof(ID3D11PerformanceDeviceX))
{
*ppvObject = reinterpret_cast<ID3D11PerformanceDeviceX*>(this);
AddRef( );
return S_OK;
}
if (riid == __uuidof(IDXGIDevice) ||
riid == __uuidof(IDXGIDevice1))
{
HRESULT hr = m_realDevice->QueryInterface(__uuidof(IDXGIDevice1), ppvObject);
*ppvObject = new IDXGIDeviceWrapper(static_cast<IDXGIDevice1*>(*ppvObject));
return S_OK;
}
return m_realDevice->QueryInterface(riid, ppvObject);
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreateTexture1D(
const D3D11_TEXTURE1D_DESC* pDesc,
const D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Texture1D_X** ppTexture1D) {
ID3D11Texture1D* texture1d = nullptr;
HRESULT hr = m_realDevice->CreateTexture1D(pDesc, pInitialData, &texture1d);
printf("[CreateTexture1D] created texture at 0x%llX\n", texture1d);
ERROR_LOG_FUNC( );
if (ppTexture1D != nullptr)
{
*ppTexture1D = SUCCEEDED(hr) ? new ID3D11Texture1DWrapper(texture1d) : nullptr;
}
return hr;
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreateTexture2D(
D3D11_TEXTURE2D_DESC* pDesc,
const D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Texture2D_X** ppTexture2D) {
ID3D11Texture2D* texture2d = nullptr;
pDesc->MiscFlags &= TEXTURE_MISCFLAGS_MASK; // remove all flags that are xbox-one only flags
if (pDesc->Usage == D3D11_USAGE_DYNAMIC)
pDesc->CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
HRESULT hr = m_realDevice->CreateTexture2D(pDesc, pInitialData, &texture2d);
printf("[CreateTexture2D] created texture at 0x%llX\n", texture2d);
ERROR_LOG_FUNC( );
if (ppTexture2D != nullptr)
{
*ppTexture2D = SUCCEEDED(hr) ? new ID3D11Texture2DWrapper(texture2d) : nullptr;
}
return hr;
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreateTexture3D(
const D3D11_TEXTURE3D_DESC* pDesc,
const D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Texture3D_X** ppTexture3D) {
ID3D11Texture3D* texture3d = nullptr;
HRESULT hr = m_realDevice->CreateTexture3D(pDesc, pInitialData, &texture3d);
printf("[CreateTexture3D] created texture at 0x%llX\n", texture3d);
ERROR_LOG_FUNC( );
if (ppTexture3D != nullptr)
{
*ppTexture3D = SUCCEEDED(hr) ? new ID3D11Texture3DWrapper(texture3d) : nullptr;
}
return hr;
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreateShaderResourceView(
ID3D11Resource* pResource,
const D3D11_SHADER_RESOURCE_VIEW_DESC* pDesc,
ID3D11ShaderResourceView_X** ppSRView) {
::ID3D11ShaderResourceView* target = nullptr;
HRESULT hr = m_realDevice->CreateShaderResourceView(reinterpret_cast<ID3D11ResourceWrapperX*>(pResource)->m_realResource, pDesc, &target);
ERROR_LOG_FUNC( );
if (ppSRView != nullptr)
{
*ppSRView = SUCCEEDED(hr) ? reinterpret_cast<ID3D11ShaderResourceView_X*>(new ID3D11ShaderResourceViewWrapper(target))
: nullptr;
}
return hr;
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreateUnorderedAccessView(
ID3D11Resource* pResource,
const D3D11_UNORDERED_ACCESS_VIEW_DESC* pDesc,
ID3D11UnorderedAccessView_X** ppUAView) {
::ID3D11UnorderedAccessView* target = nullptr;
HRESULT hr = m_realDevice->CreateUnorderedAccessView(reinterpret_cast<ID3D11ResourceWrapperX*>(pResource)->m_realResource, pDesc, &target);
ERROR_LOG_FUNC( );
if (ppUAView != nullptr)
{
*ppUAView = SUCCEEDED(hr) ? reinterpret_cast<ID3D11UnorderedAccessView_X*>(new ID3D11UnorderedAccessViewWrapper(target))
: nullptr;
}
return hr;
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreateRenderTargetView(
ID3D11Resource* pResource,
const D3D11_RENDER_TARGET_VIEW_DESC* pDesc,
ID3D11RenderTargetView_X** ppRTView) {
::ID3D11RenderTargetView* target = nullptr;
HRESULT hr = m_realDevice->CreateRenderTargetView(reinterpret_cast<ID3D11ResourceWrapperX*>(pResource)->m_realResource, pDesc, &target);
ERROR_LOG_FUNC( );
if (ppRTView != nullptr)
{
*ppRTView = SUCCEEDED(hr) ? reinterpret_cast<ID3D11RenderTargetView_X*>(new ID3D11RenderTargetViewWrapper(target))
: nullptr;
}
return hr;
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreateDepthStencilView(
ID3D11Resource* pResource,
const D3D11_DEPTH_STENCIL_VIEW_DESC* pDesc,
ID3D11DepthStencilView_X** ppDepthStencilView) {
::ID3D11DepthStencilView* target = nullptr;
HRESULT hr = m_realDevice->CreateDepthStencilView(reinterpret_cast<ID3D11ResourceWrapperX*>(pResource)->m_realResource, pDesc, &target);
ERROR_LOG_FUNC( );
if (ppDepthStencilView != nullptr)
{
*ppDepthStencilView = SUCCEEDED(hr) ? reinterpret_cast<ID3D11DepthStencilView_X*>(new ID3D11DepthStencilViewWrapper(target))
: nullptr;
}
return hr;
}
void d3d11x::D3D11DeviceXWrapperX::GetImmediateContext(ID3D11DeviceContext** ppImmediateContext)
{
::ID3D11DeviceContext* ctx{};
m_realDevice->GetImmediateContext(&ctx);
if (!ctx) return;
::ID3D11DeviceContext2* ctx2{};
ctx->QueryInterface(IID_PPV_ARGS(&ctx2));
*ppImmediateContext = reinterpret_cast<d3d11x::ID3D11DeviceContext*>(new d3d11x::ID3D11DeviceContextXWrapper(ctx2));
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreateDeferredContext(UINT ContextFlags, d3d11x::ID3D11DeviceContext** ppDeferredContext)
{
::ID3D11DeviceContext* ctx{};
HRESULT hr = m_realDevice->CreateDeferredContext(ContextFlags, &ctx);
ERROR_LOG_FUNC( );
if (ppDeferredContext != nullptr && SUCCEEDED(hr))
{
::ID3D11DeviceContext2* ctx2{};
ctx->QueryInterface(IID_PPV_ARGS(&ctx2));
*ppDeferredContext = reinterpret_cast<d3d11x::ID3D11DeviceContext*>(new d3d11x::ID3D11DeviceContextXWrapper(ctx2));
}
return hr;
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreateBuffer(
const D3D11_BUFFER_DESC* pDesc,
const D3D11_SUBRESOURCE_DATA* pInitialData,
d3d11x::ID3D11Buffer_X** ppBuffer)
{
ID3D11Buffer* buffer = nullptr;
HRESULT hr = m_realDevice->CreateBuffer(pDesc, pInitialData, &buffer);
ERROR_LOG_FUNC( );
if (ppBuffer != nullptr)
{
*ppBuffer = SUCCEEDED(hr) ? new ID3D11BufferWrapper(buffer) : nullptr;
}
return hr;
}
void d3d11x::D3D11DeviceXWrapperX::GetImmediateContextX(
_Out_ ID3D11DeviceContextX** ppImmediateContextX)
{
printf("[D3D11DeviceXWrapperX] GetImmediateContextX");
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreateCounterSet(
_In_ const D3D11X_COUNTER_SET_DESC* pCounterSetDesc,
_Out_opt_ ID3D11CounterSetX** ppCounterSet)
{
printf("[D3D11DeviceXWrapperX] CreateCounterSet");
return E_NOTIMPL;
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreateCounterSample(
_Out_opt_ ID3D11CounterSampleX** ppCounterSample)
{
printf("[D3D11DeviceXWrapperX] CreateCounterSample");
return E_NOTIMPL;
}
HRESULT d3d11x::D3D11DeviceXWrapperX::SetDriverHint(
_In_ UINT Feature,
_In_ UINT Value)
{
printf("[D3D11DeviceXWrapperX] SetDriverHint");
return E_NOTIMPL;
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreateDmaEngineContext(
_In_ const D3D11_DMA_ENGINE_CONTEXT_DESC* pDmaEngineContextDesc,
_Out_ d3d11x::ID3D11DmaEngineContextX** ppDmaDeviceContext)
{
printf("[D3D11DeviceXWrapperX] CreateDmaEngineContext");
return E_NOTIMPL;
}
BOOL d3d11x::D3D11DeviceXWrapperX::IsFencePending(UINT64 Fence)
{
printf("[D3D11DeviceXWrapperX] IsFencePending");
return E_NOTIMPL;
}
BOOL d3d11x::D3D11DeviceXWrapperX::IsResourcePending(
_In_ ID3D11Resource* pResource)
{
printf("[D3D11DeviceXWrapperX] IsResourcePending");
return E_NOTIMPL;
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreatePlacementBuffer(
_In_ const D3D11_BUFFER_DESC* pDesc,
_In_ void* pAddress,
_Out_opt_ ID3D11Buffer** ppBuffer)
{
printf("[D3D11DeviceXWrapperX] CreatePlacementBuffer");
return E_NOTIMPL;
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreatePlacementTexture1D(
_In_ const D3D11_TEXTURE1D_DESC* pDesc,
_In_ UINT TileModeIndex,
_In_ UINT Pitch,
_In_ void* pAddress,
_Out_opt_ ID3D11Texture1D** ppTexture1D)
{
printf("[D3D11DeviceXWrapperX] CreatePlacementTexture1D");
return E_NOTIMPL;
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreatePlacementTexture2D(
_In_ const D3D11_TEXTURE2D_DESC* pDesc,
_In_ UINT TileModeIndex,
_In_ UINT Pitch,
_In_ void* pAddress,
_Out_opt_ ID3D11Texture2D** ppTexture2D)
{
printf("[D3D11DeviceXWrapperX] CreatePlacementTexture2D");
return E_NOTIMPL;
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreatePlacementTexture3D(
_In_ const D3D11_TEXTURE3D_DESC* pDesc,
_In_ UINT TileModeIndex,
_In_ UINT Pitch,
_In_ void* pAddress,
_Out_opt_ ID3D11Texture3D** ppTexture3D)
{
printf("[D3D11DeviceXWrapperX] CreatePlacementTexture3D");
return E_NOTIMPL;
}
void d3d11x::D3D11DeviceXWrapperX::GetTimestamps(
_Out_ UINT64* pGpuTimestamp,
_Out_ UINT64* pCpuRdtscTimestamp)
{
printf("[D3D11DeviceXWrapperX] GetTimestamps");
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreateSamplerStateX(
_In_ const d3d11x::D3D11X_SAMPLER_DESC* pSamplerDesc,
_Out_opt_ ID3D11SamplerState** ppSamplerState)
{
printf("[D3D11DeviceXWrapperX] CreateSamplerStateX");
return E_NOTIMPL;
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreateDeferredContextX(
UINT ContextFlags,
_Out_ d3d11x::ID3D11DeviceContextX** ppDeferredContext)
{
printf("[D3D11DeviceXWrapperX] CreateDeferredContextX");
return E_NOTIMPL;
}
void d3d11x::D3D11DeviceXWrapperX::GarbageCollect(
_In_ UINT Flags)
{
printf("[D3D11DeviceXWrapperX] GarbageCollect");
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreateDepthStencilStateX(
_In_ const D3D11_DEPTH_STENCIL_DESC* pDepthStencilStateDescX,
_Out_opt_ ID3D11DepthStencilState** ppDepthStencilState)
{
printf("[D3D11DeviceXWrapperX] CreateDepthStencilStateX");
return E_NOTIMPL;
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreatePlacementRenderableTexture2D(
_In_ const D3D11_TEXTURE2D_DESC* pDesc,
_In_ UINT TileModeIndex,
_In_ UINT Pitch,
_In_ const D3D11X_RENDERABLE_TEXTURE_ADDRESSES* pAddresses,
_Out_opt_ ID3D11Texture2D** ppTexture2D)
{
printf("[D3D11DeviceXWrapperX] CreatePlacementRenderableTexture2D");
return E_NOTIMPL;
}
void d3d11x::D3D11DeviceXWrapperX::GetDriverStatistics(
_In_ UINT StructSize,
_Out_ D3D11X_DRIVER_STATISTICS* pStatistics)
{
printf("[D3D11DeviceXWrapperX] GetDriverStatistics");
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreateComputeContextX(
_In_ const d3d11x::D3D11_COMPUTE_CONTEXT_DESC* pComputeContextDesc,
_Out_ d3d11x::ID3D11ComputeContextX** ppComputeContext)
{
printf("[D3D11DeviceXWrapperX] CreateComputeContextX");
return E_NOTIMPL;
}
void d3d11x::D3D11DeviceXWrapperX::ComposeShaderResourceView(
_In_ const D3D11X_DESCRIPTOR_RESOURCE* pDescriptorResource,
_In_opt_ const d3d11x::D3D11X_RESOURCE_VIEW_DESC* pViewDesc,
_Out_ d3d11x::D3D11X_DESCRIPTOR_SHADER_RESOURCE_VIEW* pDescriptorSrv)
{
printf("[D3D11DeviceXWrapperX] ComposeShaderResourceView");
}
void d3d11x::D3D11DeviceXWrapperX::ComposeUnorderedAccessView(
_In_ const D3D11X_DESCRIPTOR_RESOURCE* pDescriptorResource,
_In_opt_ const D3D11X_RESOURCE_VIEW_DESC* pViewDesc,
_Out_ d3d11x::D3D11X_DESCRIPTOR_UNORDERED_ACCESS_VIEW* pDescriptorUav)
{
printf("[D3D11DeviceXWrapperX] ComposeUnorderedAccessView");
}
void d3d11x::D3D11DeviceXWrapperX::ComposeConstantBufferView(
_In_ const D3D11X_DESCRIPTOR_RESOURCE* pDescriptorResource,
_In_opt_ const D3D11X_RESOURCE_VIEW_DESC* pViewDesc,
_Out_ D3D11X_DESCRIPTOR_CONSTANT_BUFFER_VIEW* pDescriptorCb)
{
printf("[D3D11DeviceXWrapperX] ComposeConstantBufferView");
}
void d3d11x::D3D11DeviceXWrapperX::ComposeVertexBufferView(
_In_ const D3D11X_DESCRIPTOR_RESOURCE* pDescriptorResource,
_In_opt_ const D3D11X_RESOURCE_VIEW_DESC* pViewDesc,
_Out_ D3D11X_DESCRIPTOR_VERTEX_BUFFER_VIEW* pDescriptorVb)
{
printf("[D3D11DeviceXWrapperX] ComposeVertexBufferView");
}
void d3d11x::D3D11DeviceXWrapperX::ComposeSamplerState(
_In_opt_ const d3d11x::D3D11X_SAMPLER_STATE_DESC* pSamplerDesc,
_Out_ d3d11x::D3D11X_DESCRIPTOR_SAMPLER_STATE* pDescriptorSamplerState)
{
printf("[D3D11DeviceXWrapperX] ComposeSamplerState");
}
void d3d11x::D3D11DeviceXWrapperX::PlaceSwapChainView(
_In_ ID3D11Resource* pSwapChainBuffer,
_Inout_ ID3D11View* pView)
{
printf("[D3D11DeviceXWrapperX] PlaceSwapChainView");
}
void d3d11x::D3D11DeviceXWrapperX::SetDebugFlags(
_In_ UINT Flags)
{
printf("[D3D11DeviceXWrapperX] SetDebugFlags");
}
UINT d3d11x::D3D11DeviceXWrapperX::GetDebugFlags( )
{
printf("[D3D11DeviceXWrapperX] GetDebugFlags");
return {};
}
void d3d11x::D3D11DeviceXWrapperX::SetHangCallbacks(
_In_ d3d11x::D3D11XHANGBEGINCALLBACK pBeginCallback,
_In_ d3d11x::D3D11XHANGPRINTCALLBACK pPrintCallback,
_In_ d3d11x::D3D11XHANGDUMPCALLBACK pDumpCallback)
{
printf("[D3D11DeviceXWrapperX] SetHangCallbacks");
}
void d3d11x::D3D11DeviceXWrapperX::ReportGpuHang(
_In_ UINT Flags)
{
printf("[D3D11DeviceXWrapperX] ReportGpuHang");
}
HRESULT d3d11x::D3D11DeviceXWrapperX::SetGpuMemoryPriority(
_In_ UINT Priority)
{
printf("[D3D11DeviceXWrapperX] SetGpuMemoryPriority");
return E_NOTIMPL;
}
void d3d11x::D3D11DeviceXWrapperX::GetGpuHardwareConfiguration(
_Out_ d3d11x::D3D11X_GPU_HARDWARE_CONFIGURATION* pGpuHardwareConfiguration)
{
static d3d11x::D3D11X_GPU_HARDWARE_CONFIGURATION dummyHardwareConfig = { 0, D3D11X_HARDWARE_VERSION_XBOX_ONE, 0 };
printf("[D3D11DeviceXWrapperX] GetGpuHardwareConfiguration\n");
*pGpuHardwareConfiguration = dummyHardwareConfig;
}
#pragma endregion

View File

@@ -1,820 +0,0 @@
#pragma once
#include <cstdio>
#include <d3d11.h>
#include <d3d11_1.h>
#include <d3d11_2.h>
// thanks to Zombie for the idea
#define DX_MAJOR 2
#define DX_MINOR 18
#define MAKEINTVERSION(major, minor) (((0LL + (major)) << 48) | ((0LL + (minor)) << 32))
#define DX_VERSION (((0LL + (DX_MAJOR)) << 48) | ((0LL + (DX_MINOR)) << 32))
#define D3DDECL_UUID(Uuid) __declspec(uuid(#Uuid))
#define D3DINTERFACE(Name, Guid0, Guid1, Guid2, Guid3, Guid4, \
Guid5, Guid6, Guid7, Guid8, Guid9, Guid10) \
class D3DDECL_UUID(Guid0-Guid1-Guid2-Guid3##Guid4-Guid5##Guid6##Guid7##Guid8##Guid9##Guid10) Name
namespace d3d11x
{
D3DINTERFACE(IGraphicsUnknown, aceeea63, e0a9, 4a1c, bb, ec, 71, b2, f4, 85, f7, 58)
{
public:
#if !defined(DX_VERSION) || DX_VERSION >= MAKEINTVERSION(2, 18)
ULONG m_DeviceIndex : 3;
ULONG m_PrivateDataPresent : 1;
ULONG m_Reserved : 28;
#endif
#if !defined(DX_VERSION) || DX_VERSION >= MAKEINTVERSION(1, 1)
ULONG m_RefCount;
#endif
virtual HRESULT QueryInterface(REFIID riid, void** ppvObject) = 0;
virtual ULONG AddRef( ) = 0;
virtual ULONG Release( ) = 0;
};
class GraphicsUnknownWrapperX : public IGraphicsUnknown
{
public:
GraphicsUnknownWrapperX(IUnknown* pUnknown)
{
m_RefCount = 1;
m_pUnknown = pUnknown;
}
GraphicsUnknownWrapperX( )
{
m_RefCount = 1;
m_pUnknown = nullptr;
}
HRESULT QueryInterface(REFIID riid, void** ppvObject) override
{
// note from unixian: for debugging purposes
char iidstr[ sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}") ];
OLECHAR iidwstr[ sizeof(iidstr) ];
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr));
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr);
printf("[GraphicsUnknownWrapperX] QueryInterface: %s\n", iidstr);
if (m_pUnknown)
return m_pUnknown->QueryInterface(riid, ppvObject);
*ppvObject = nullptr;
return E_NOINTERFACE;
}
ULONG AddRef( ) override
{
if (m_pUnknown)
return m_pUnknown->AddRef( );
return InterlockedIncrement(&m_RefCount);
}
ULONG Release( ) override
{
ULONG refCount = InterlockedDecrement(&m_RefCount);
if (m_pUnknown)
m_pUnknown->Release( );
if (refCount == 0)
{
delete this;
}
return refCount;
}
private:
IUnknown* m_pUnknown;
};
// Wrappers
class ID3D11Buffer_X;
class ID3D11BufferWrapper;
class ID3D11RenderTargetView_X;
class ID3D11UnorderedAccessView_X;
class ID3D11ShaderResourceView_X;
class ID3D11DepthStencilView_X;
class ID3D11RenderTargetViewWrapper;
class IDXGIDeviceWrapper;
class ID3D11Texture2DWrapper;
class ID3D11Texture1D_X;
class ID3D11Texture2D_X;
class ID3D11Texture3D_X;
// D3D11.X forward declarations
class IGraphicsUnknown;
class ID3D11DeviceContext;
class ID3D11DeviceContextX;
class ID3D11CounterSetX;
class ID3D11CounterSampleX;
class ID3D11DmaEngineContextX;
class ID3D11ComputeContextX;
struct D3D11X_COUNTER_SET_DESC;
struct D3D11X_DESCRIPTOR_RESOURCE;
struct D3D11_DMA_ENGINE_CONTEXT_DESC;
struct D3D11X_SAMPLER_DESC;
struct D3D11X_RENDERABLE_TEXTURE_ADDRESSES;
struct D3D11X_DRIVER_STATISTICS;
struct D3D11_COMPUTE_CONTEXT_DESC;
struct D3D11X_RESOURCE_VIEW_DESC;
struct D3D11X_DESCRIPTOR_SHADER_RESOURCE_VIEW;
struct D3D11X_DESCRIPTOR_UNORDERED_ACCESS_VIEW;
struct D3D11X_DESCRIPTOR_CONSTANT_BUFFER_VIEW;
struct D3D11X_DESCRIPTOR_VERTEX_BUFFER_VIEW;
struct D3D11X_SAMPLER_STATE_DESC;
struct D3D11X_DESCRIPTOR_SAMPLER_STATE;
typedef enum D3D11X_HARDWARE_VERSION
{
D3D11X_HARDWARE_VERSION_XBOX_ONE = 0,
D3D11X_HARDWARE_VERSION_XBOX_ONE_S = 1,
D3D11X_HARDWARE_VERSION_XBOX_ONE_X = 2,
D3D11X_HARDWARE_VERSION_XBOX_ONE_X_DEVKIT = 3
} D3D11X_HARDWARE_VERSION;
struct D3D11X_GPU_HARDWARE_CONFIGURATION {
UINT64 GpuFrequency;
D3D11X_HARDWARE_VERSION HardwareVersion;
UINT32 GpuCuCount;
};
typedef UINT(*D3D11XHANGBEGINCALLBACK) (UINT64 Flags);
typedef void (*D3D11XHANGPRINTCALLBACK) (const CHAR* strLine);
typedef void (*D3D11XHANGDUMPCALLBACK) (const WCHAR* strFileName);
D3DINTERFACE(ID3D11Device, db6f6ddb, ac77, 4e88, 82, 53, 81, 9d, f9, bb, f1, 40) : public IGraphicsUnknown
{
public:
UINT m_CreationFlags;
virtual HRESULT CreateBuffer(_In_ const D3D11_BUFFER_DESC* pDesc,
_In_opt_ const D3D11_SUBRESOURCE_DATA* pInitialData,
_Out_opt_ d3d11x::ID3D11Buffer_X** ppBuffer) = 0;
virtual HRESULT CreateTexture1D(_In_ const D3D11_TEXTURE1D_DESC* pDesc,
_In_reads_opt_(_Inexpressible_(pDesc->MipLevels* pDesc->ArraySize)) const D3D11_SUBRESOURCE_DATA* pInitialData,
_Out_opt_ ID3D11Texture1D_X** ppTexture1D) = 0;
virtual HRESULT CreateTexture2D(_In_ D3D11_TEXTURE2D_DESC* pDesc,
_In_reads_opt_(_Inexpressible_(pDesc->MipLevels* pDesc->ArraySize)) const D3D11_SUBRESOURCE_DATA* pInitialData,
_Out_opt_ ID3D11Texture2D_X** ppTexture2D) = 0;
virtual HRESULT CreateTexture3D(_In_ const D3D11_TEXTURE3D_DESC* pDesc,
_In_reads_opt_(_Inexpressible_(pDesc->MipLevels)) const D3D11_SUBRESOURCE_DATA* pInitialData,
_Out_opt_ ID3D11Texture3D_X** ppTexture3D) = 0;
virtual HRESULT CreateShaderResourceView(_In_ ID3D11Resource* pResource,
_In_opt_ const D3D11_SHADER_RESOURCE_VIEW_DESC* pDesc,
_Out_opt_ ID3D11ShaderResourceView_X** ppSRView) = 0;
virtual HRESULT CreateUnorderedAccessView(_In_ ID3D11Resource* pResource,
_In_opt_ const D3D11_UNORDERED_ACCESS_VIEW_DESC* pDesc,
_Out_opt_ ID3D11UnorderedAccessView_X** ppUAView) = 0;
virtual HRESULT CreateRenderTargetView(_In_ ID3D11Resource* pResource,
_In_opt_ const D3D11_RENDER_TARGET_VIEW_DESC* pDesc,
_Out_opt_ ID3D11RenderTargetView_X** ppRTView) = 0;
virtual HRESULT CreateDepthStencilView(
_In_ ID3D11Resource* pResource,
_In_opt_ const D3D11_DEPTH_STENCIL_VIEW_DESC* pDesc,
_Out_opt_ ID3D11DepthStencilView_X** ppDepthStencilView) = 0;
virtual HRESULT CreateInputLayout(
_In_reads_(NumElements) const D3D11_INPUT_ELEMENT_DESC * pInputElementDescs,
_In_range_(0, D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT) UINT NumElements,
_In_ const void* pShaderBytecodeWithInputSignature,
_In_ SIZE_T BytecodeLength,
_Out_opt_ ID3D11InputLayout * *ppInputLayout) = 0;
virtual HRESULT CreateVertexShader(
_In_ const void* pShaderBytecode,
_In_ SIZE_T BytecodeLength,
_In_opt_ ID3D11ClassLinkage* pClassLinkage,
_Out_opt_ ID3D11VertexShader** ppVertexShader) = 0;
virtual HRESULT CreateGeometryShader(
_In_ const void* pShaderBytecode,
_In_ SIZE_T BytecodeLength,
_In_opt_ ID3D11ClassLinkage* pClassLinkage,
_Out_opt_ ID3D11GeometryShader** ppGeometryShader) = 0;
virtual HRESULT CreateGeometryShaderWithStreamOutput(
_In_ const void* pShaderBytecode,
_In_ SIZE_T BytecodeLength,
_In_reads_opt_(NumEntries) const D3D11_SO_DECLARATION_ENTRY* pSODeclaration,
_In_range_(0, D3D11_SO_STREAM_COUNT* D3D11_SO_OUTPUT_COMPONENT_COUNT) UINT NumEntries,
_In_reads_opt_(NumStrides) const UINT* pBufferStrides,
_In_range_(0, D3D11_SO_BUFFER_SLOT_COUNT) UINT NumStrides,
_In_ UINT RasterizedStream,
_In_opt_ ID3D11ClassLinkage* pClassLinkage,
_Out_opt_ ID3D11GeometryShader** ppGeometryShader) = 0;
virtual HRESULT CreatePixelShader(
_In_ const void* pShaderBytecode,
_In_ SIZE_T BytecodeLength,
_In_opt_ ID3D11ClassLinkage* pClassLinkage,
_Out_opt_ ID3D11PixelShader** ppPixelShader) = 0;
virtual HRESULT CreateHullShader(
_In_ const void* pShaderBytecode,
_In_ SIZE_T BytecodeLength,
_In_opt_ ID3D11ClassLinkage* pClassLinkage,
_Out_opt_ ID3D11HullShader** ppHullShader) = 0;
virtual HRESULT CreateDomainShader(
_In_ const void* pShaderBytecode,
_In_ SIZE_T BytecodeLength,
_In_opt_ ID3D11ClassLinkage* pClassLinkage,
_Out_opt_ ID3D11DomainShader** ppDomainShader) = 0;
virtual HRESULT CreateComputeShader(
_In_ const void* pShaderBytecode,
_In_ SIZE_T BytecodeLength,
_In_opt_ ID3D11ClassLinkage* pClassLinkage,
_Out_opt_ ID3D11ComputeShader** ppComputeShader) = 0;
virtual HRESULT CreateClassLinkage(
_Out_ ID3D11ClassLinkage** ppLinkage) = 0;
virtual HRESULT CreateBlendState(
_In_ const D3D11_BLEND_DESC* pBlendStateDesc,
_Out_opt_ ID3D11BlendState** ppBlendState) = 0;
virtual HRESULT CreateDepthStencilState(
_In_ const D3D11_DEPTH_STENCIL_DESC* pDepthStencilDesc,
_Out_opt_ ID3D11DepthStencilState** ppDepthStencilState) = 0;
virtual HRESULT CreateRasterizerState(
_In_ const D3D11_RASTERIZER_DESC* pRasterizerDesc,
_Out_opt_ ID3D11RasterizerState** ppRasterizerState) = 0;
virtual HRESULT CreateSamplerState(
_In_ const D3D11_SAMPLER_DESC* pSamplerDesc,
_Out_opt_ ID3D11SamplerState** ppSamplerState) = 0;
virtual HRESULT CreateQuery(
_In_ const D3D11_QUERY_DESC* pQueryDesc,
_Out_opt_ ID3D11Query** ppQuery) = 0;
virtual HRESULT CreatePredicate(
_In_ const D3D11_QUERY_DESC* pPredicateDesc,
_Out_opt_ ID3D11Predicate** ppPredicate) = 0;
virtual HRESULT CreateCounter(
_In_ const D3D11_COUNTER_DESC* pCounterDesc,
_Out_opt_ ID3D11Counter** ppCounter) = 0;
virtual HRESULT CreateDeferredContext(UINT ContextFlags, _Out_opt_ d3d11x::ID3D11DeviceContext** ppDeferredContext) = 0;
virtual HRESULT OpenSharedResource(
_In_ HANDLE hResource,
_In_ REFIID ReturnedInterface,
_Out_opt_ void** ppResource) = 0;
virtual HRESULT CheckFormatSupport(
_In_ DXGI_FORMAT Format,
_Out_ UINT* pFormatSupport) = 0;
virtual HRESULT CheckMultisampleQualityLevels(
_In_ DXGI_FORMAT Format,
_In_ UINT SampleCount,
_Out_ UINT* pNumQualityLevels) = 0;
virtual void CheckCounterInfo(_Out_ D3D11_COUNTER_INFO* pCounterInfo) = 0;
virtual HRESULT CheckCounter(
_In_ const D3D11_COUNTER_DESC* pDesc,
_Out_ D3D11_COUNTER_TYPE* pType,
_Out_ UINT* pActiveCounters,
_Out_writes_opt_(*pNameLength) LPSTR szName,
_Inout_opt_ UINT* pNameLength,
_Out_writes_opt_(*pUnitsLength) LPSTR szUnits,
_Inout_opt_ UINT* pUnitsLength,
_Out_writes_opt_(*pDescriptionLength) LPSTR szDescription,
_Inout_opt_ UINT* pDescriptionLength) = 0;
virtual HRESULT CheckFeatureSupport(
D3D11_FEATURE Feature,
_Out_writes_bytes_(FeatureSupportDataSize) void* pFeatureSupportData,
UINT FeatureSupportDataSize) = 0;
virtual HRESULT GetPrivateData(
_In_ REFGUID guid,
_Inout_ UINT* pDataSize,
_Out_writes_bytes_opt_(*pDataSize) void* pData) = 0;
virtual HRESULT SetPrivateData(_In_ REFGUID guid, _In_ UINT DataSize, _In_reads_bytes_opt_(DataSize) const void* pData)= 0;
virtual HRESULT SetPrivateDataInterface(_In_ REFGUID guid, _In_opt_ const IUnknown* pData) = 0;
virtual HRESULT SetPrivateDataInterfaceGraphics(_In_ REFGUID guid, _In_opt_ const IGraphicsUnknown* pData) = 0;
virtual D3D_FEATURE_LEVEL GetFeatureLevel( ) = 0;
virtual UINT GetCreationFlags( ) = 0;
virtual HRESULT GetDeviceRemovedReason( ) = 0;
virtual void GetImmediateContext(ID3D11DeviceContext** ppImmediateContext) = 0;
virtual HRESULT SetExceptionMode(UINT RaiseFlags) = 0;
virtual UINT GetExceptionMode( ) = 0;
};
D3DINTERFACE(ID3D11Device1, a04bfb29, 08ef, 43d6, a4, 9c, a9, bd, bd, cb, e6, 86) : public ID3D11Device{
public:
virtual void GetImmediateContext1(_Out_ ::ID3D11DeviceContext1** ppImmediateContext) = 0;
virtual HRESULT CreateDeferredContext1(
UINT ContextFlags,
_Out_ ::ID3D11DeviceContext1** ppDeferredContext) = 0;
virtual HRESULT CreateBlendState1(
_In_ const D3D11_BLEND_DESC1* pBlendStateDesc,
_Out_opt_ ID3D11BlendState1** ppBlendState) = 0;
virtual HRESULT CreateRasterizerState1(
_In_ const D3D11_RASTERIZER_DESC1* pRasterizerDesc,
_Out_opt_ ID3D11RasterizerState1** ppRasterizerState) = 0;
virtual HRESULT CreateDeviceContextState(
UINT Flags,
_In_reads_(FeatureLevels) const D3D_FEATURE_LEVEL* pFeatureLevels,
UINT FeatureLevels,
UINT SDKVersion,
REFIID EmulatedInterface,
_Out_opt_ D3D_FEATURE_LEVEL* pChosenFeatureLevel,
_Out_opt_ ID3DDeviceContextState** ppContextState) = 0;
virtual HRESULT OpenSharedResource1(
_In_ HANDLE hResource,
_In_ REFIID ReturnedInterface,
_Out_ void** ppResource) = 0;
virtual HRESULT OpenSharedResourceByName(
_In_ LPCWSTR lpName,
_In_ DWORD dwDesiredAccess,
_In_ REFIID ReturnedInterface,
_Out_ void** ppResource) = 0;
};
D3DINTERFACE(ID3D11Device2, 9d06dffa, d1e5, 4d07, 83, a8, 1b, b1, 23, f2, f8, 41) : public ID3D11Device1 {
virtual void GetImmediateContext2(
_Out_ ::ID3D11DeviceContext2** ppImmediateContext) = 0;
virtual HRESULT CreateDeferredContext2(
UINT ContextFlags,
_Out_ ::ID3D11DeviceContext2** ppDeferredContext) = 0;
virtual void GetResourceTiling(
_In_ ID3D11Resource* pTiledResource,
_Out_opt_ UINT* pNumTilesForEntireResource,
_Out_opt_ D3D11_PACKED_MIP_DESC* pPackedMipDesc,
_Out_opt_ D3D11_TILE_SHAPE* pStandardTileShapeForNonPackedMips,
_Inout_opt_ UINT* pNumSubresourceTilings,
_In_ UINT FirstSubresourceTilingToGet,
_Out_writes_(*pNumSubresourceTilings) D3D11_SUBRESOURCE_TILING* pSubresourceTilingsForNonPackedMips) = 0;
virtual HRESULT CheckMultisampleQualityLevels1(
_In_ DXGI_FORMAT Format,
_In_ UINT SampleCount,
_In_ UINT Flags,
_Out_ UINT* pNumQualityLevels) = 0;
};
D3DINTERFACE(ID3D11DeviceX, 177700f9, 876a, 4436, b3, 68, 36, a6, 04, f8, 2c, ef) : public ID3D11Device2
{
public:
virtual void GetImmediateContextX(ID3D11DeviceContextX**) = 0;
virtual HRESULT CreateCounterSet(const D3D11X_COUNTER_SET_DESC*, ID3D11CounterSetX**) = 0;
virtual HRESULT CreateCounterSample(ID3D11CounterSampleX**) = 0;
virtual HRESULT SetDriverHint(unsigned int, unsigned int) = 0;
virtual HRESULT CreateDmaEngineContext(const D3D11_DMA_ENGINE_CONTEXT_DESC*, ID3D11DmaEngineContextX**) = 0;
virtual int IsFencePending(unsigned __int64) = 0;
virtual int IsResourcePending(ID3D11Resource*) = 0;
virtual HRESULT CreatePlacementBuffer(const D3D11_BUFFER_DESC*, void*, ID3D11Buffer**) = 0;
virtual HRESULT CreatePlacementTexture1D(const D3D11_TEXTURE1D_DESC*, unsigned int, unsigned int, void*, ID3D11Texture1D**) = 0;
virtual HRESULT CreatePlacementTexture2D(const D3D11_TEXTURE2D_DESC*, unsigned int, unsigned int, void*, ID3D11Texture2D**) = 0;
virtual HRESULT CreatePlacementTexture3D(const D3D11_TEXTURE3D_DESC*, unsigned int, unsigned int, void*, ID3D11Texture3D**) = 0;
virtual void GetTimestamps(unsigned __int64*, unsigned __int64*) = 0;
virtual HRESULT CreateSamplerStateX(const D3D11X_SAMPLER_DESC*, ID3D11SamplerState**) = 0;
virtual HRESULT CreateDeferredContextX(unsigned int, ID3D11DeviceContextX**) = 0;
virtual void GarbageCollect(unsigned int) = 0;
virtual HRESULT CreateDepthStencilStateX(const D3D11_DEPTH_STENCIL_DESC*, ID3D11DepthStencilState**) = 0;
virtual HRESULT CreatePlacementRenderableTexture2D(const D3D11_TEXTURE2D_DESC*, unsigned int, unsigned int, const D3D11X_RENDERABLE_TEXTURE_ADDRESSES*, ID3D11Texture2D**) = 0;
virtual void GetDriverStatistics(unsigned int, D3D11X_DRIVER_STATISTICS*) = 0;
virtual HRESULT CreateComputeContextX(const D3D11_COMPUTE_CONTEXT_DESC*, ID3D11ComputeContextX**) = 0;
virtual void ComposeShaderResourceView(const D3D11X_DESCRIPTOR_RESOURCE*, const D3D11X_RESOURCE_VIEW_DESC*, D3D11X_DESCRIPTOR_SHADER_RESOURCE_VIEW*) = 0;
virtual void ComposeUnorderedAccessView(const D3D11X_DESCRIPTOR_RESOURCE*, const D3D11X_RESOURCE_VIEW_DESC*, D3D11X_DESCRIPTOR_UNORDERED_ACCESS_VIEW*) = 0;
virtual void ComposeConstantBufferView(const D3D11X_DESCRIPTOR_RESOURCE*, const D3D11X_RESOURCE_VIEW_DESC*, D3D11X_DESCRIPTOR_CONSTANT_BUFFER_VIEW*) = 0;
virtual void ComposeVertexBufferView(const D3D11X_DESCRIPTOR_RESOURCE*, const D3D11X_RESOURCE_VIEW_DESC*, D3D11X_DESCRIPTOR_VERTEX_BUFFER_VIEW*) = 0;
virtual void ComposeSamplerState(const D3D11X_SAMPLER_STATE_DESC*, D3D11X_DESCRIPTOR_SAMPLER_STATE*) = 0;
virtual void PlaceSwapChainView(ID3D11Resource*, ID3D11View*) = 0;
virtual void SetDebugFlags(unsigned int) = 0;
virtual unsigned int GetDebugFlags( ) = 0;
virtual void SetHangCallbacks(D3D11XHANGBEGINCALLBACK, D3D11XHANGPRINTCALLBACK, D3D11XHANGDUMPCALLBACK) = 0;
virtual void ReportGpuHang(unsigned int) = 0;
virtual HRESULT SetGpuMemoryPriority(unsigned int) = 0;
virtual void GetGpuHardwareConfiguration(D3D11X_GPU_HARDWARE_CONFIGURATION*) = 0;
};
class D3D11DeviceXWrapperX : public ID3D11DeviceX
{
public:
explicit D3D11DeviceXWrapperX(::ID3D11Device2* pDevice)
{
m_realDevice = pDevice;
m_RefCount = 1;
}
HRESULT QueryInterface(REFIID riid, void** ppvObject) override;
ULONG AddRef( ) override
{
printf("[D3D11DeviceXWrapperX] AddRef\n");
InterlockedIncrement(&m_RefCount);
return m_realDevice->AddRef( );
}
ULONG Release( ) override
{
ULONG refCount = InterlockedDecrement(&m_RefCount);
m_realDevice->Release( );
printf("[D3D11DeviceXWrapperX] Release\n");
if (refCount == 0)
{
printf("[D3D11DeviceXWrapperX] Release | refCount == 0, class being deleted.\n");
delete this;
}
return refCount;
}
// ID3D11Device
HRESULT SetPrivateDataInterfaceGraphics(const GUID& guid, const IGraphicsUnknown* pData) override
{
return m_realDevice->SetPrivateDataInterface(guid, (IUnknown*)pData);
}
HRESULT CreateBuffer(
const D3D11_BUFFER_DESC* pDesc,
const D3D11_SUBRESOURCE_DATA* pInitialData,
d3d11x::ID3D11Buffer_X** ppBuffer) override;
HRESULT CreateTexture1D(
const D3D11_TEXTURE1D_DESC* pDesc,
const D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Texture1D_X** ppTexture1D) override;
HRESULT CreateTexture2D(
D3D11_TEXTURE2D_DESC* pDesc,
const D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Texture2D_X** ppTexture2D) override;
HRESULT CreateTexture3D(
const D3D11_TEXTURE3D_DESC* pDesc,
const D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Texture3D_X** ppTexture3D) override;
HRESULT CreateShaderResourceView(
ID3D11Resource* pResource,
const D3D11_SHADER_RESOURCE_VIEW_DESC* pDesc,
ID3D11ShaderResourceView_X** ppSRView) override;
HRESULT CreateUnorderedAccessView(
ID3D11Resource* pResource,
const D3D11_UNORDERED_ACCESS_VIEW_DESC* pDesc,
ID3D11UnorderedAccessView_X** ppUAView) override;
HRESULT CreateRenderTargetView(ID3D11Resource* pResource,
const D3D11_RENDER_TARGET_VIEW_DESC* pDesc,
ID3D11RenderTargetView_X** ppRTView) override;
HRESULT CreateDepthStencilView(
ID3D11Resource* pResource,
const D3D11_DEPTH_STENCIL_VIEW_DESC* pDesc,
ID3D11DepthStencilView_X** ppDepthStencilView) override;
HRESULT CreateInputLayout(
const D3D11_INPUT_ELEMENT_DESC* pInputElementDescs,
UINT NumElements,
const void* pShaderBytecodeWithInputSignature,
SIZE_T BytecodeLength,
ID3D11InputLayout** ppInputLayout) override {
return m_realDevice->CreateInputLayout(pInputElementDescs, NumElements, pShaderBytecodeWithInputSignature, BytecodeLength, ppInputLayout);
}
HRESULT CreateVertexShader(
const void* pShaderBytecode,
SIZE_T BytecodeLength,
ID3D11ClassLinkage* pClassLinkage,
ID3D11VertexShader** ppVertexShader) override {
return m_realDevice->CreateVertexShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppVertexShader);
}
HRESULT CreateGeometryShader(
const void* pShaderBytecode,
SIZE_T BytecodeLength,
ID3D11ClassLinkage* pClassLinkage,
ID3D11GeometryShader** ppGeometryShader) override {
return m_realDevice->CreateGeometryShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppGeometryShader);
}
HRESULT CreateGeometryShaderWithStreamOutput(
const void* pShaderBytecode,
SIZE_T BytecodeLength,
const D3D11_SO_DECLARATION_ENTRY* pSODeclaration,
UINT NumEntries,
const UINT* pBufferStrides,
UINT NumStrides,
UINT RasterizedStream,
ID3D11ClassLinkage* pClassLinkage,
ID3D11GeometryShader** ppGeometryShader) override {
return m_realDevice->CreateGeometryShaderWithStreamOutput(pShaderBytecode, BytecodeLength, pSODeclaration, NumEntries, pBufferStrides, NumStrides, RasterizedStream, pClassLinkage, ppGeometryShader);
}
HRESULT CreatePixelShader(
const void* pShaderBytecode,
SIZE_T BytecodeLength,
ID3D11ClassLinkage* pClassLinkage,
ID3D11PixelShader** ppPixelShader) override {
return m_realDevice->CreatePixelShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppPixelShader);
}
HRESULT CreateHullShader(
const void* pShaderBytecode,
SIZE_T BytecodeLength,
ID3D11ClassLinkage* pClassLinkage,
ID3D11HullShader** ppHullShader) override {
return m_realDevice->CreateHullShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppHullShader);
}
HRESULT CreateDomainShader(
const void* pShaderBytecode,
SIZE_T BytecodeLength,
ID3D11ClassLinkage* pClassLinkage,
ID3D11DomainShader** ppDomainShader) override {
return m_realDevice->CreateDomainShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppDomainShader);
}
HRESULT CreateComputeShader(
const void* pShaderBytecode,
SIZE_T BytecodeLength,
ID3D11ClassLinkage* pClassLinkage,
ID3D11ComputeShader** ppComputeShader) override {
return m_realDevice->CreateComputeShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppComputeShader);
}
HRESULT CreateClassLinkage(
ID3D11ClassLinkage** ppLinkage) override {
return m_realDevice->CreateClassLinkage(ppLinkage);
}
HRESULT CreateBlendState(
const D3D11_BLEND_DESC* pBlendStateDesc,
ID3D11BlendState** ppBlendState) override {
return m_realDevice->CreateBlendState(pBlendStateDesc, ppBlendState);
}
HRESULT CreateDepthStencilState(
const D3D11_DEPTH_STENCIL_DESC* pDepthStencilDesc,
ID3D11DepthStencilState** ppDepthStencilState) override {
return m_realDevice->CreateDepthStencilState(pDepthStencilDesc, ppDepthStencilState);
}
HRESULT CreateRasterizerState(
const D3D11_RASTERIZER_DESC* pRasterizerDesc,
ID3D11RasterizerState** ppRasterizerState) override {
return m_realDevice->CreateRasterizerState(pRasterizerDesc, ppRasterizerState);
}
HRESULT CreateSamplerState(
const D3D11_SAMPLER_DESC* pSamplerDesc,
ID3D11SamplerState** ppSamplerState) override {
return m_realDevice->CreateSamplerState(pSamplerDesc, ppSamplerState);
}
HRESULT CreateQuery(
const D3D11_QUERY_DESC* pQueryDesc,
ID3D11Query** ppQuery) override {
return m_realDevice->CreateQuery(pQueryDesc, ppQuery);
}
HRESULT CreatePredicate(
const D3D11_QUERY_DESC* pPredicateDesc,
ID3D11Predicate** ppPredicate) override {
return m_realDevice->CreatePredicate(pPredicateDesc, ppPredicate);
}
HRESULT CreateCounter(
const D3D11_COUNTER_DESC* pCounterDesc,
ID3D11Counter** ppCounter) override {
return m_realDevice->CreateCounter(pCounterDesc, ppCounter);
}
// @Patoke todo: unwrap
// @Aleblbl done, check cpp file
HRESULT CreateDeferredContext(
UINT ContextFlags, d3d11x::ID3D11DeviceContext** ppDeferredContext) override;
HRESULT OpenSharedResource(
HANDLE hResource,
REFIID ReturnedInterface,
void** ppResource) override {
return m_realDevice->OpenSharedResource(hResource, ReturnedInterface, ppResource);
}
HRESULT CheckFormatSupport(
DXGI_FORMAT Format,
UINT* pFormatSupport) override {
return m_realDevice->CheckFormatSupport(Format, pFormatSupport);
}
HRESULT CheckMultisampleQualityLevels(
DXGI_FORMAT Format,
UINT SampleCount,
UINT* pNumQualityLevels) override {
return m_realDevice->CheckMultisampleQualityLevels(Format, SampleCount, pNumQualityLevels);
}
void CheckCounterInfo(
D3D11_COUNTER_INFO* pCounterInfo) override {
m_realDevice->CheckCounterInfo(pCounterInfo);
}
HRESULT CheckCounter(
const D3D11_COUNTER_DESC* pDesc,
D3D11_COUNTER_TYPE* pType,
UINT* pActiveCounters,
LPSTR szName,
UINT* pNameLength,
LPSTR szUnits,
UINT* pUnitsLength,
LPSTR szDescription,
UINT* pDescriptionLength) override {
return m_realDevice->CheckCounter(pDesc, pType, pActiveCounters, szName, pNameLength, szUnits, pUnitsLength, szDescription, pDescriptionLength);
}
HRESULT CheckFeatureSupport(
D3D11_FEATURE Feature,
void* pFeatureSupportData,
UINT FeatureSupportDataSize) override {
return m_realDevice->CheckFeatureSupport(Feature, pFeatureSupportData, FeatureSupportDataSize);
}
HRESULT GetPrivateData(
REFGUID guid,
UINT* pDataSize,
void* pData) override {
return m_realDevice->GetPrivateData(guid, pDataSize, pData);
}
HRESULT SetPrivateData(
REFGUID guid,
UINT DataSize,
const void* pData) override {
return m_realDevice->SetPrivateData(guid, DataSize, pData);
}
HRESULT SetPrivateDataInterface(
REFGUID guid,
const IUnknown* pData) override {
return m_realDevice->SetPrivateDataInterface(guid, pData);
}
D3D_FEATURE_LEVEL GetFeatureLevel(void) override {
return m_realDevice->GetFeatureLevel( );
}
UINT GetCreationFlags(void) override {
return m_realDevice->GetCreationFlags( );
}
HRESULT GetDeviceRemovedReason(void) override {
return m_realDevice->GetDeviceRemovedReason( );
}
// @Patoke todo: unwrap
// @Aleblbl don :} (check cpp file)
void GetImmediateContext(ID3D11DeviceContext** ppImmediateContext) override;
HRESULT SetExceptionMode(
UINT RaiseFlags) override {
return m_realDevice->SetExceptionMode(RaiseFlags);
}
UINT GetExceptionMode(void) override { return m_realDevice->GetExceptionMode( ); }
// ID3D11Device1
// @Patoke todo: unwrap
void GetImmediateContext1(::ID3D11DeviceContext1** ppImmediateContext) override {
m_realDevice->GetImmediateContext1(ppImmediateContext);
}
// @Patoke todo: unwrap
HRESULT CreateDeferredContext1(UINT ContextFlags, ::ID3D11DeviceContext1** ppDeferredContext) override {
return m_realDevice->CreateDeferredContext1(ContextFlags, ppDeferredContext);
}
HRESULT CreateBlendState1(const D3D11_BLEND_DESC1* pBlendStateDesc, ID3D11BlendState1** ppBlendState) override {
return m_realDevice->CreateBlendState1(pBlendStateDesc, ppBlendState);
}
HRESULT CreateRasterizerState1(const D3D11_RASTERIZER_DESC1* pRasterizerDesc, ID3D11RasterizerState1** ppRasterizerState) override {
return m_realDevice->CreateRasterizerState1(pRasterizerDesc, ppRasterizerState);
}
HRESULT CreateDeviceContextState(UINT Flags, const D3D_FEATURE_LEVEL* pFeatureLevels, UINT FeatureLevels, UINT SDKVersion, REFIID EmulatedInterface, D3D_FEATURE_LEVEL* pChosenFeatureLevel, ID3DDeviceContextState** ppContextState) override {
return m_realDevice->CreateDeviceContextState(Flags, pFeatureLevels, FeatureLevels, SDKVersion, EmulatedInterface, pChosenFeatureLevel, ppContextState);
}
HRESULT OpenSharedResource1(HANDLE hResource, REFIID returnedInterface, void** ppResource) override {
return m_realDevice->OpenSharedResource1(hResource, returnedInterface, ppResource);
}
HRESULT OpenSharedResourceByName(LPCWSTR lpName, DWORD dwDesiredAccess, REFIID returnedInterface, void** ppResource) override {
return m_realDevice->OpenSharedResourceByName(lpName, dwDesiredAccess, returnedInterface, ppResource);
}
// ID3D11Device2
// @Patoke todo: unwrap
void GetImmediateContext2(::ID3D11DeviceContext2** ppImmediateContext) override
{
m_realDevice->GetImmediateContext2(ppImmediateContext);
}
// @Patoke todo: unwrap
HRESULT CreateDeferredContext2(UINT ContextFlags, ::ID3D11DeviceContext2** ppDeferredContext) override
{
return m_realDevice->CreateDeferredContext2(ContextFlags, ppDeferredContext);
}
void GetResourceTiling(ID3D11Resource* pTiledResource, UINT* pNumTilesForEntireResource,
D3D11_PACKED_MIP_DESC* pPackedMipDesc, D3D11_TILE_SHAPE* pStandardTileShapeForNonPackedMips,
UINT* pNumSubresourceTilings, UINT FirstSubresourceTilingToGet, D3D11_SUBRESOURCE_TILING* pSubresourceTilingsForNonPackedMips) override
{
m_realDevice->GetResourceTiling(pTiledResource, pNumTilesForEntireResource,
pPackedMipDesc, pStandardTileShapeForNonPackedMips, pNumSubresourceTilings,
FirstSubresourceTilingToGet, pSubresourceTilingsForNonPackedMips);
}
HRESULT CheckMultisampleQualityLevels1(DXGI_FORMAT Format, UINT SampleCount, UINT Flags, UINT* pNumQualityLevels) override
{
return m_realDevice->CheckMultisampleQualityLevels1(Format, SampleCount, Flags, pNumQualityLevels);
}
// ID3D11DeviceX
void GetImmediateContextX(ID3D11DeviceContextX**) override;
HRESULT CreateCounterSet(const D3D11X_COUNTER_SET_DESC*, ID3D11CounterSetX**) override;
HRESULT CreateCounterSample(ID3D11CounterSampleX**) override;
HRESULT SetDriverHint(UINT Feature, UINT Value) override;
HRESULT CreateDmaEngineContext(const D3D11_DMA_ENGINE_CONTEXT_DESC*, ID3D11DmaEngineContextX**) override;
int IsFencePending(UINT64) override;
int IsResourcePending(ID3D11Resource*) override;
HRESULT CreatePlacementBuffer(const D3D11_BUFFER_DESC*, void*, ID3D11Buffer**) override;
HRESULT CreatePlacementTexture1D(const D3D11_TEXTURE1D_DESC*, UINT, UINT, void*, ID3D11Texture1D**) override;
HRESULT CreatePlacementTexture2D(const D3D11_TEXTURE2D_DESC*, UINT, UINT, void*, ID3D11Texture2D**) override;
HRESULT CreatePlacementTexture3D(const D3D11_TEXTURE3D_DESC*, UINT, UINT, void*, ID3D11Texture3D**) override;
void GetTimestamps(UINT64*, UINT64*) override;
HRESULT CreateSamplerStateX(const D3D11X_SAMPLER_DESC*, ID3D11SamplerState**) override;
HRESULT CreateDeferredContextX(UINT, ID3D11DeviceContextX**) override;
void GarbageCollect(UINT) override;
HRESULT CreateDepthStencilStateX(const D3D11_DEPTH_STENCIL_DESC*, ID3D11DepthStencilState**) override;
HRESULT CreatePlacementRenderableTexture2D(const D3D11_TEXTURE2D_DESC*, UINT, UINT, const D3D11X_RENDERABLE_TEXTURE_ADDRESSES*, ID3D11Texture2D**) override;
void GetDriverStatistics(UINT, D3D11X_DRIVER_STATISTICS*) override;
HRESULT CreateComputeContextX(const D3D11_COMPUTE_CONTEXT_DESC*, ID3D11ComputeContextX**) override;
void ComposeShaderResourceView(const D3D11X_DESCRIPTOR_RESOURCE*, const D3D11X_RESOURCE_VIEW_DESC*, D3D11X_DESCRIPTOR_SHADER_RESOURCE_VIEW*) override;
void ComposeUnorderedAccessView(const D3D11X_DESCRIPTOR_RESOURCE*, const D3D11X_RESOURCE_VIEW_DESC*, D3D11X_DESCRIPTOR_UNORDERED_ACCESS_VIEW*) override;
void ComposeConstantBufferView(const D3D11X_DESCRIPTOR_RESOURCE*, const D3D11X_RESOURCE_VIEW_DESC*, D3D11X_DESCRIPTOR_CONSTANT_BUFFER_VIEW*) override;
void ComposeVertexBufferView(const D3D11X_DESCRIPTOR_RESOURCE*, const D3D11X_RESOURCE_VIEW_DESC*, D3D11X_DESCRIPTOR_VERTEX_BUFFER_VIEW*) override;
void ComposeSamplerState(const D3D11X_SAMPLER_STATE_DESC*, D3D11X_DESCRIPTOR_SAMPLER_STATE*) override;
void PlaceSwapChainView(ID3D11Resource*, ID3D11View*) override;
void SetDebugFlags(UINT) override;
unsigned int GetDebugFlags( ) override;
void SetHangCallbacks(D3D11XHANGBEGINCALLBACK, D3D11XHANGPRINTCALLBACK, D3D11XHANGDUMPCALLBACK) override;
void ReportGpuHang(UINT) override;
HRESULT SetGpuMemoryPriority(UINT) override;
void GetGpuHardwareConfiguration(D3D11X_GPU_HARDWARE_CONFIGURATION*) override;
public:
::ID3D11Device2* m_realDevice;
};
MIDL_INTERFACE("88671610-712E-4F1E-84AB-01B5948BD373")
ID3D11PerformanceDeviceX : ID3D11DeviceX
{
// yea this is just empty lol
};
}

View File

@@ -1,4 +0,0 @@
#pragma once
#include "d3d11_x_device.h"
// @Patoke todo: add more stuff here?

View File

@@ -0,0 +1 @@
#include "device_child_x.h"

View File

@@ -0,0 +1,63 @@
#pragma once
#include <cassert>
#include <exception>
#include "d3d11_x.h"
#include "graphics_unknown.h"
namespace wdi
{
D3DINTERFACE(ID3D11DeviceChild, 1841e5c8, 16b0, 489b, bc, c8, 44, cf, b0, d5, de, ae) : public wd::graphics_unknown {
ID3D11Device* m_pDevice;
void* m_pPrivateData;
// @Patoke todo: make this access wdi::ID3D11Device instead, this is a temporary fix
virtual void STDMETHODCALLTYPE GetDevice(::ID3D11Device** ppDevice) = 0;
virtual HRESULT STDMETHODCALLTYPE GetPrivateData(REFGUID guid, UINT* pDataSize, void* pData) = 0;
virtual HRESULT STDMETHODCALLTYPE SetPrivateData(REFGUID guid, UINT DataSize, const void* pData) = 0;
virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(REFGUID guid, const IUnknown* pData) = 0;
virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterfaceGraphics(REFGUID guid, const IGraphicsUnknown* pData) = 0;
virtual HRESULT STDMETHODCALLTYPE SetName(LPCWSTR pName) = 0;
};
}
namespace wd
{
class device_child_x : wdi::ID3D11DeviceChild
{
public:
device_child_x(::ID3D11DeviceChild* device_child) : wrapped_interface(device_child) { wrapped_interface->AddRef( ); }
void STDMETHODCALLTYPE GetDevice(ID3D11Device** ppDevice) override
{
printf("WARN: device_child_x::GetDevice returns a PC device!!\n");
wrapped_interface->GetDevice(ppDevice);
}
HRESULT STDMETHODCALLTYPE GetPrivateData(REFGUID guid, UINT* pDataSize, void* pData) override
{
return wrapped_interface->GetPrivateData(guid, pDataSize, pData);
}
HRESULT STDMETHODCALLTYPE SetPrivateData(REFGUID guid, UINT DataSize, const void* pData) override
{
return wrapped_interface->SetPrivateData(guid, DataSize, pData);
}
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(REFGUID guid, const IUnknown* pData) override
{
return wrapped_interface->SetPrivateDataInterface(guid, pData);
}
HRESULT STDMETHODCALLTYPE SetPrivateDataInterfaceGraphics(REFGUID guid, const IGraphicsUnknown* pData) override
{
TRACE_NOT_IMPLEMENTED("device_child_x");
return E_NOTIMPL;
}
private:
::ID3D11DeviceChild* wrapped_interface;
};
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

345
dlls/d3d11_x/device_x.cpp Normal file
View File

@@ -0,0 +1,345 @@
#include "device_x.h"
#include <stdexcept>
#include "resource.hpp"
#include "view.hpp"
HRESULT wd::device_x::CreateBuffer(const D3D11_BUFFER_DESC* pDesc, const D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Buffer** ppBuffer)
{
ID3D11Buffer* buffer = nullptr;
HRESULT hr = wrapped_interface->CreateBuffer(pDesc, pInitialData, &buffer);
if (ppBuffer != nullptr)
{
*ppBuffer = SUCCEEDED(hr) ? reinterpret_cast<ID3D11Buffer*>(new wd::buffer(buffer)) : nullptr;
}
return hr;
}
HRESULT wd::device_x::CreateTexture1D(const D3D11_TEXTURE1D_DESC* pDesc, const D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Texture1D** ppTexture1D)
{
ID3D11Texture1D* texture1d = nullptr;
HRESULT hr = wrapped_interface->CreateTexture1D(pDesc, pInitialData, &texture1d);
printf("[CreateTexture1D] created texture at 0x%llX\n", texture1d);
if (ppTexture1D != nullptr)
{
*ppTexture1D = SUCCEEDED(hr) ? reinterpret_cast<ID3D11Texture1D*>(new texture_1d(texture1d)) : nullptr;
}
return hr;
}
HRESULT wd::device_x::CreateTexture2D(const D3D11_TEXTURE2D_DESC* pDesc, const D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Texture2D** ppTexture2D)
{
ID3D11Texture2D* texture2d = nullptr;
HRESULT hr = wrapped_interface->CreateTexture2D(pDesc, pInitialData, &texture2d);
printf("[CreateTexture2D] created texture at 0x%llX\n", texture2d);
if (ppTexture2D != nullptr)
{
*ppTexture2D = SUCCEEDED(hr) ? reinterpret_cast<ID3D11Texture2D*>(new texture_2d(texture2d)) : nullptr;
}
return hr;
}
HRESULT wd::device_x::CreateTexture3D(const D3D11_TEXTURE3D_DESC* pDesc, const D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Texture3D** ppTexture3D)
{
ID3D11Texture3D* texture3d = nullptr;
HRESULT hr = wrapped_interface->CreateTexture3D(pDesc, pInitialData, &texture3d);
printf("[CreateTexture3D] created texture at 0x%llX\n", texture3d);
if (ppTexture3D != nullptr)
{
*ppTexture3D = SUCCEEDED(hr) ? reinterpret_cast<ID3D11Texture3D*>(new texture_3d(texture3d)) : nullptr;
}
return hr;
}
HRESULT wd::device_x::CreateShaderResourceView(ID3D11Resource* pResource, const D3D11_SHADER_RESOURCE_VIEW_DESC* pDesc,
ID3D11ShaderResourceView** ppSRView)
{
::ID3D11ShaderResourceView* target = nullptr;
HRESULT hr = wrapped_interface->CreateShaderResourceView(reinterpret_cast<d3d11_resource*>(pResource)->wrapped_interface, pDesc, &target);
if (ppSRView != nullptr)
{
*ppSRView = SUCCEEDED(hr) ? reinterpret_cast<ID3D11ShaderResourceView*>(new shader_resource_view(target))
: nullptr;
}
return hr;
}
HRESULT wd::device_x::CreateUnorderedAccessView(ID3D11Resource* pResource,
const D3D11_UNORDERED_ACCESS_VIEW_DESC* pDesc, ID3D11UnorderedAccessView** ppUAView)
{
::ID3D11UnorderedAccessView* target = nullptr;
HRESULT hr = wrapped_interface->CreateUnorderedAccessView(reinterpret_cast<d3d11_resource*>(pResource)->wrapped_interface, pDesc, &target);
if (ppUAView != nullptr)
{
*ppUAView = SUCCEEDED(hr) ? reinterpret_cast<ID3D11UnorderedAccessView*>(new unordered_access_view(target))
: nullptr;
}
return hr;
}
HRESULT wd::device_x::CreateRenderTargetView(ID3D11Resource* pResource, const D3D11_RENDER_TARGET_VIEW_DESC* pDesc,
ID3D11RenderTargetView** ppRTView)
{
::ID3D11RenderTargetView* target = nullptr;
HRESULT hr = wrapped_interface->CreateRenderTargetView(reinterpret_cast<wd::d3d11_resource*>(pResource)->wrapped_interface, pDesc, &target);
if (ppRTView != nullptr)
{
*ppRTView = SUCCEEDED(hr) ? reinterpret_cast<ID3D11RenderTargetView*>(new wd::render_target_view(target))
: nullptr;
}
return hr;
}
HRESULT wd::device_x::CreateDepthStencilView(ID3D11Resource* pResource, const D3D11_DEPTH_STENCIL_VIEW_DESC* pDesc,
ID3D11DepthStencilView** ppDepthStencilView)
{
::ID3D11DepthStencilView* target = nullptr;
HRESULT hr = wrapped_interface->CreateDepthStencilView(reinterpret_cast<d3d11_resource*>(pResource)->wrapped_interface, pDesc, &target);
if (ppDepthStencilView != nullptr)
{
*ppDepthStencilView = SUCCEEDED(hr) ? reinterpret_cast<ID3D11DepthStencilView*>(new depth_stencil_view(target))
: nullptr;
}
return hr;
}
HRESULT wd::device_x::CreateDeferredContext(UINT ContextFlags, ID3D11DeviceContext** ppDeferredContext)
{
::ID3D11DeviceContext* ctx{};
HRESULT hr = wrapped_interface->CreateDeferredContext(ContextFlags, &ctx);
if (ppDeferredContext != nullptr && SUCCEEDED(hr))
{
::ID3D11DeviceContext2* ctx2{};
ctx->QueryInterface(IID_PPV_ARGS(&ctx2));
*ppDeferredContext = reinterpret_cast<ID3D11DeviceContext*>(new device_context_x(ctx2));
}
return hr;
}
void wd::device_x::GetImmediateContext(ID3D11DeviceContext** ppImmediateContext)
{
::ID3D11DeviceContext* ctx{};
wrapped_interface->GetImmediateContext(&ctx);
if (!ctx) return;
::ID3D11DeviceContext2* ctx2{};
ctx->QueryInterface(IID_PPV_ARGS(&ctx2));
*ppImmediateContext = reinterpret_cast<ID3D11DeviceContext*>(new device_context_x(ctx2));
}
HRESULT wd::device_x::CreateDeferredContext1(UINT ContextFlags, ID3D11DeviceContext1** ppDeferredContext)
{
printf("WARN: CreateDeferredContext1 is not implemented\n");
return wrapped_interface->CreateDeferredContext1(ContextFlags, ppDeferredContext);
}
HRESULT wd::device_x::CreateDeferredContext2(UINT ContextFlags, ID3D11DeviceContext2** ppDeferredContext)
{
printf("WARN: CreateDeferredContext2 is not implemented\n");
return wrapped_interface->CreateDeferredContext2(ContextFlags, ppDeferredContext);
}
void wd::device_x::GetImmediateContextX(wdi::ID3D11DeviceContextX** ppImmediateContextX)
{
printf("WARN: GetImmediateContextX is not implemented\n");
throw std::logic_error("Not implemented");
}
HRESULT wd::device_x::CreateCounterSet(const wdi::D3D11X_COUNTER_SET_DESC* pCounterSetDesc,
wdi::ID3D11CounterSetX** ppCounterSet)
{
throw std::logic_error("Not implemented");
}
HRESULT wd::device_x::CreateCounterSample(wdi::ID3D11CounterSampleX** ppCounterSample)
{
throw std::logic_error("Not implemented");
}
HRESULT wd::device_x::SetDriverHint(UINT Feature, UINT Value)
{
throw std::logic_error("Not implemented");
}
HRESULT wd::device_x::CreateDmaEngineContext(const wdi::D3D11_DMA_ENGINE_CONTEXT_DESC* pDmaEngineContextDesc,
wdi::ID3D11DmaEngineContextX** ppDmaDeviceContext)
{
throw std::logic_error("Not implemented");
}
BOOL wd::device_x::IsFencePending(UINT64 Fence)
{
throw std::logic_error("Not implemented");
}
BOOL wd::device_x::IsResourcePending(ID3D11Resource* pResource)
{
throw std::logic_error("Not implemented");
}
HRESULT wd::device_x::CreatePlacementBuffer(const D3D11_BUFFER_DESC* pDesc, void* pVirtualAddress,
ID3D11Buffer** ppBuffer)
{
throw std::logic_error("Not implemented");
}
HRESULT wd::device_x::CreatePlacementTexture1D(const D3D11_TEXTURE1D_DESC* pDesc, UINT TileModeIndex, UINT Pitch,
void* pVirtualAddress, ID3D11Texture1D** ppTexture1D)
{
throw std::logic_error("Not implemented");
}
HRESULT wd::device_x::CreatePlacementTexture2D(const D3D11_TEXTURE2D_DESC* pDesc, UINT TileModeIndex, UINT Pitch,
void* pVirtualAddress, ID3D11Texture2D** ppTexture2D)
{
throw std::logic_error("Not implemented");
}
HRESULT wd::device_x::CreatePlacementTexture3D(const D3D11_TEXTURE3D_DESC* pDesc, UINT TileModeIndex, UINT Pitch,
void* pVirtualAddress, ID3D11Texture3D** ppTexture3D)
{
throw std::logic_error("Not implemented");
}
void wd::device_x::GetTimestamps(UINT64* pGpuTimestamp, UINT64* pCpuRdtscTimestamp)
{
throw std::logic_error("Not implemented");
}
HRESULT wd::device_x::CreateSamplerStateX(const wdi::D3D11X_SAMPLER_DESC* pSamplerDesc,
ID3D11SamplerState** ppSamplerState)
{
throw std::logic_error("Not implemented");
}
HRESULT wd::device_x::CreateDeferredContextX(UINT Flags, wdi::ID3D11DeviceContextX** ppDeferredContext)
{
throw std::logic_error("Not implemented");
}
void wd::device_x::GarbageCollect(UINT Flags)
{
throw std::logic_error("Not implemented");
}
HRESULT wd::device_x::CreateDepthStencilStateX(const D3D11_DEPTH_STENCIL_DESC* pDepthStencilStateDesc,
ID3D11DepthStencilState** ppDepthStencilState)
{
throw std::logic_error("Not implemented");
}
HRESULT wd::device_x::CreatePlacementRenderableTexture2D(const D3D11_TEXTURE2D_DESC* pDesc, UINT TileModeIndex,
UINT Pitch,
const wdi::D3D11X_RENDERABLE_TEXTURE_ADDRESSES* pAddresses,
ID3D11Texture2D** ppTexture2D)
{
throw std::logic_error("Not implemented");
}
void wd::device_x::GetDriverStatistics(UINT StructSize, wdi::D3D11X_DRIVER_STATISTICS* pStatistics)
{
throw std::logic_error("Not implemented");
}
HRESULT wd::device_x::CreateComputeContextX(const wdi::D3D11_COMPUTE_CONTEXT_DESC* pComputeContextDesc,
wdi::ID3D11ComputeContextX** ppComputeContext)
{
throw std::logic_error("Not implemented");
}
void wd::device_x::ComposeShaderResourceView(const wdi::D3D11X_DESCRIPTOR_RESOURCE* pDescriptorResource,
const wdi::D3D11X_RESOURCE_VIEW_DESC* pViewDesc,
wdi::D3D11X_DESCRIPTOR_SHADER_RESOURCE_VIEW* pDescriptorSrv)
{
throw std::logic_error("Not implemented");
}
void wd::device_x::ComposeUnorderedAccessView(const wdi::D3D11X_DESCRIPTOR_RESOURCE* pDescriptorResource,
const wdi::D3D11X_RESOURCE_VIEW_DESC* pViewDesc,
wdi::D3D11X_DESCRIPTOR_UNORDERED_ACCESS_VIEW* pDescriptorUav)
{
throw std::logic_error("Not implemented");
}
void wd::device_x::ComposeConstantBufferView(const wdi::D3D11X_DESCRIPTOR_RESOURCE* pDescriptorResource,
const wdi::D3D11X_RESOURCE_VIEW_DESC* pViewDesc,
wdi::D3D11X_DESCRIPTOR_CONSTANT_BUFFER_VIEW* pDescriptorCb)
{
throw std::logic_error("Not implemented");
}
void wd::device_x::ComposeVertexBufferView(const wdi::D3D11X_DESCRIPTOR_RESOURCE* pDescriptorResource,
const wdi::D3D11X_RESOURCE_VIEW_DESC* pViewDesc,
wdi::D3D11X_DESCRIPTOR_VERTEX_BUFFER_VIEW* pDescriptorVb)
{
throw std::logic_error("Not implemented");
}
void wd::device_x::ComposeSamplerState(const wdi::D3D11X_SAMPLER_STATE_DESC* pSamplerDesc,
wdi::D3D11X_DESCRIPTOR_SAMPLER_STATE* pDescriptorSamplerState)
{
throw std::logic_error("Not implemented");
}
void wd::device_x::PlaceSwapChainView(ID3D11Resource* pSwapChainBuffer, ID3D11View* pView)
{
throw std::logic_error("Not implemented");
}
void wd::device_x::SetDebugFlags(UINT Flags)
{
throw std::logic_error("Not implemented");
}
UINT wd::device_x::GetDebugFlags( )
{
throw std::logic_error("Not implemented");
}
void wd::device_x::SetHangCallbacks(wdi::D3D11XHANGBEGINCALLBACK pBeginCallback, wdi::D3D11XHANGPRINTCALLBACK pPrintCallback,
wdi::D3D11XHANGDUMPCALLBACK pDumpCallback)
{
throw std::logic_error("Not implemented");
}
void wd::device_x::ReportGpuHang(UINT Flags)
{
throw std::logic_error("Not implemented");
}
HRESULT wd::device_x::SetGpuMemoryPriority(UINT Priority)
{
throw std::logic_error("Not implemented");
}
void wd::device_x::GetGpuHardwareConfiguration(wdi::D3D11X_GPU_HARDWARE_CONFIGURATION* pGpuHardwareConfiguration)
{
throw std::logic_error("Not implemented");
}

580
dlls/d3d11_x/device_x.h Normal file
View File

@@ -0,0 +1,580 @@
#pragma once
#include <cstdio>
#include <d3d11_1.h>
#include <d3d11_2.h>
#include "graphics_unknown.h"
#include <exception>
#include <format>
#include "dxgi_device.h"
namespace wdi
{
class ID3D11DeviceContextX;
struct D3D11X_COUNTER_SET_DESC;
struct D3D11X_DESCRIPTOR_RESOURCE;
struct D3D11_DMA_ENGINE_CONTEXT_DESC;
struct D3D11X_SAMPLER_DESC;
struct D3D11X_RENDERABLE_TEXTURE_ADDRESSES;
struct D3D11X_DRIVER_STATISTICS;
struct D3D11_COMPUTE_CONTEXT_DESC;
struct D3D11X_RESOURCE_VIEW_DESC;
struct D3D11X_DESCRIPTOR_SHADER_RESOURCE_VIEW;
struct D3D11X_DESCRIPTOR_UNORDERED_ACCESS_VIEW;
struct D3D11X_DESCRIPTOR_CONSTANT_BUFFER_VIEW;
struct D3D11X_DESCRIPTOR_VERTEX_BUFFER_VIEW;
struct D3D11X_SAMPLER_STATE_DESC;
struct D3D11X_DESCRIPTOR_SAMPLER_STATE;
class ID3D11CounterSetX;
class ID3D11CounterSampleX;
class ID3D11DmaEngineContextX;
class ID3D11ComputeContextX;
typedef UINT (*D3D11XHANGBEGINCALLBACK)(UINT64 Flags);
typedef void (*D3D11XHANGPRINTCALLBACK)(const CHAR* strLine);
typedef void (*D3D11XHANGDUMPCALLBACK)(const WCHAR* strFileName);
typedef enum D3D11X_HARDWARE_VERSION
{
D3D11X_HARDWARE_VERSION_XBOX_ONE = 0,
D3D11X_HARDWARE_VERSION_XBOX_ONE_S = 1,
D3D11X_HARDWARE_VERSION_XBOX_ONE_X = 2,
D3D11X_HARDWARE_VERSION_XBOX_ONE_X_DEVKIT = 3
} D3D11X_HARDWARE_VERSION;
struct D3D11X_GPU_HARDWARE_CONFIGURATION
{
UINT64 GpuFrequency;
D3D11X_HARDWARE_VERSION HardwareVersion;
UINT32 GpuCuCount;
};
D3DINTERFACE(ID3D11Device, db6f6ddb, ac77, 4e88, 82, 53, 81, 9d, f9, bb, f1, 40) : public wd::graphics_unknown
{
public:
UINT m_CreationFlags;
virtual HRESULT (CreateBuffer)(const D3D11_BUFFER_DESC* pDesc,
const D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Buffer** ppBuffer) = 0;
virtual HRESULT (CreateTexture1D)(const D3D11_TEXTURE1D_DESC* pDesc,
_In_reads_opt_(_Inexpressible_(pDesc->MipLevels* pDesc->ArraySize)) const
D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Texture1D** ppTexture1D) = 0;
virtual HRESULT (CreateTexture2D)(const D3D11_TEXTURE2D_DESC* pDesc,
_In_reads_opt_(_Inexpressible_(pDesc->MipLevels* pDesc->ArraySize)) const
D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Texture2D** ppTexture2D) = 0;
virtual HRESULT (CreateTexture3D)(const D3D11_TEXTURE3D_DESC* pDesc,
_In_reads_opt_(_Inexpressible_(pDesc->MipLevels)) const D3D11_SUBRESOURCE_DATA
* pInitialData, ID3D11Texture3D** ppTexture3D) = 0;
virtual HRESULT (CreateShaderResourceView)(ID3D11Resource* pResource,
const D3D11_SHADER_RESOURCE_VIEW_DESC* pDesc,
ID3D11ShaderResourceView** ppSRView) = 0;
virtual HRESULT (CreateUnorderedAccessView)(ID3D11Resource* pResource,
const D3D11_UNORDERED_ACCESS_VIEW_DESC* pDesc,
ID3D11UnorderedAccessView** ppUAView) = 0;
virtual HRESULT (CreateRenderTargetView)(ID3D11Resource* pResource,
const D3D11_RENDER_TARGET_VIEW_DESC* pDesc,
ID3D11RenderTargetView** ppRTView) = 0;
virtual HRESULT (CreateDepthStencilView)(ID3D11Resource* pResource,
const D3D11_DEPTH_STENCIL_VIEW_DESC* pDesc,
ID3D11DepthStencilView** ppDepthStencilView) = 0;
virtual HRESULT (CreateInputLayout)(_In_reads_(NumElements) const D3D11_INPUT_ELEMENT_DESC* pInputElementDescs,
_In_range_(0, D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT) UINT
NumElements,
_In_reads_(BytecodeLength) const void* pShaderBytecodeWithInputSignature,
SIZE_T BytecodeLength, ID3D11InputLayout** ppInputLayout) = 0;
virtual HRESULT (CreateVertexShader)(_In_reads_(BytecodeLength) const void* pShaderBytecode,
SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage,
ID3D11VertexShader** ppVertexShader) = 0;
virtual HRESULT (CreateGeometryShader)(
_In_reads_(BytecodeLength) const void* pShaderBytecode, SIZE_T BytecodeLength,
ID3D11ClassLinkage* pClassLinkage, ID3D11GeometryShader** ppGeometryShader) = 0;
virtual HRESULT (CreateGeometryShaderWithStreamOutput)(
_In_reads_(BytecodeLength) const void* pShaderBytecode, SIZE_T BytecodeLength,
_In_reads_opt_(NumEntries) const D3D11_SO_DECLARATION_ENTRY* pSODeclaration,
_In_range_(0, D3D11_SO_STREAM_COUNT* D3D11_SO_OUTPUT_COMPONENT_COUNT) UINT NumEntries,
_In_reads_opt_(NumStrides) const UINT* pBufferStrides,
_In_range_(0, D3D11_SO_BUFFER_SLOT_COUNT) UINT NumStrides, UINT RasterizedStream,
ID3D11ClassLinkage* pClassLinkage, ID3D11GeometryShader** ppGeometryShader) = 0;
virtual HRESULT (CreatePixelShader)(_In_reads_(BytecodeLength) const void* pShaderBytecode,
SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage,
ID3D11PixelShader** ppPixelShader) = 0;
virtual HRESULT (CreateHullShader)(_In_reads_(BytecodeLength) const void* pShaderBytecode,
SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage,
ID3D11HullShader** ppHullShader) = 0;
virtual HRESULT (CreateDomainShader)(_In_reads_(BytecodeLength) const void* pShaderBytecode,
SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage,
ID3D11DomainShader** ppDomainShader) = 0;
virtual HRESULT (CreateComputeShader)(
_In_reads_(BytecodeLength) const void* pShaderBytecode, SIZE_T BytecodeLength,
ID3D11ClassLinkage* pClassLinkage, ID3D11ComputeShader** ppComputeShader) = 0;
virtual HRESULT (CreateClassLinkage)(ID3D11ClassLinkage** ppLinkage) = 0;
virtual HRESULT (CreateBlendState)(const D3D11_BLEND_DESC* pBlendStateDesc,
ID3D11BlendState** ppBlendState) = 0;
virtual HRESULT (CreateDepthStencilState)(const D3D11_DEPTH_STENCIL_DESC* pDepthStencilDesc,
ID3D11DepthStencilState** ppDepthStencilState) = 0;
virtual HRESULT (CreateRasterizerState)(const D3D11_RASTERIZER_DESC* pRasterizerDesc,
ID3D11RasterizerState** ppRasterizerState) = 0;
virtual HRESULT (CreateSamplerState)(const D3D11_SAMPLER_DESC* pSamplerDesc,
ID3D11SamplerState** ppSamplerState) = 0;
virtual HRESULT (CreateQuery)(const D3D11_QUERY_DESC* pQueryDesc, ID3D11Query** ppQuery) = 0;
virtual HRESULT (CreatePredicate)(const D3D11_QUERY_DESC* pPredicateDesc,
ID3D11Predicate** ppPredicate) = 0;
virtual HRESULT (CreateCounter)(const D3D11_COUNTER_DESC* pCounterDesc,
ID3D11Counter** ppCounter) = 0;
// @Patoke todo: make this access wdi::ID3D11DeviceContext instead, this is a temporary fix
virtual HRESULT (CreateDeferredContext)(UINT ContextFlags, ::ID3D11DeviceContext** ppDeferredContext) = 0;
virtual HRESULT (OpenSharedResource)(HANDLE hResource, REFIID ReturnedInterface,
void** ppResource) = 0;
virtual HRESULT (CheckFormatSupport)(DXGI_FORMAT Format, UINT* pFormatSupport) = 0;
virtual HRESULT (CheckMultisampleQualityLevels)(DXGI_FORMAT Format, UINT SampleCount,
UINT* pNumQualityLevels) = 0;
virtual void (CheckCounterInfo)(D3D11_COUNTER_INFO* pCounterInfo) = 0;
virtual HRESULT (CheckCounter)(const D3D11_COUNTER_DESC* pDesc, D3D11_COUNTER_TYPE* pType,
UINT* pActiveCounters, _Out_writes_opt_(*pNameLength) LPSTR szName,
_Inout_opt_ UINT* pNameLength, _Out_writes_opt_(*pUnitsLength) LPSTR szUnits,
_Inout_opt_ UINT* pUnitsLength,
_Out_writes_opt_(*pDescriptionLength) LPSTR szDescription,
_Inout_opt_ UINT* pDescriptionLength) = 0;
virtual HRESULT (CheckFeatureSupport)(D3D11_FEATURE Feature,
_Out_writes_bytes_(FeatureSupportDataSize) void* pFeatureSupportData,
UINT FeatureSupportDataSize) = 0;
virtual HRESULT (GetPrivateData)(REFGUID guid, UINT* pDataSize,
_Out_writes_bytes_opt_(*pDataSize) void* pData) = 0;
virtual HRESULT (SetPrivateData)(REFGUID guid, UINT DataSize,
_In_reads_bytes_opt_(DataSize) const void* pData) = 0;
virtual HRESULT (SetPrivateDataInterface)(REFGUID guid, const IUnknown* pData) = 0;
virtual HRESULT (SetPrivateDataInterfaceGraphics)(REFGUID guid, const IGraphicsUnknown* pData) = 0;
virtual D3D_FEATURE_LEVEL (GetFeatureLevel)() = 0;
virtual UINT (GetCreationFlags)() = 0;
virtual HRESULT (GetDeviceRemovedReason)() = 0;
// @Patoke todo: make this access wdi::ID3D11DeviceContext instead, this is a temporary fix
virtual void (GetImmediateContext)(::ID3D11DeviceContext** ppImmediateContext) = 0;
virtual HRESULT (SetExceptionMode)(UINT RaiseFlags) = 0;
virtual UINT (GetExceptionMode)() = 0;
};
D3DINTERFACE(ID3D11Device1, a04bfb29, 08ef, 43d6, a4, 9c, a9, bd, bd, cb, e6, 86) : public ID3D11Device
{
public:
// @Patoke todo: make this access wdi::ID3D11DeviceContext1 instead, this is a temporary fix
virtual void (GetImmediateContext1)(::ID3D11DeviceContext1** ppImmediateContext) = 0;
// @Patoke todo: make this access wdi::ID3D11DeviceContext1 instead, this is a temporary fix
virtual HRESULT (CreateDeferredContext1)(UINT ContextFlags, ::ID3D11DeviceContext1** ppDeferredContext) = 0;
virtual HRESULT (CreateBlendState1)(const D3D11_BLEND_DESC1* pBlendStateDesc,
ID3D11BlendState1** ppBlendState) = 0;
virtual HRESULT (CreateRasterizerState1)(const D3D11_RASTERIZER_DESC1* pRasterizerDesc,
ID3D11RasterizerState1** ppRasterizerState) = 0;
virtual HRESULT (CreateDeviceContextState)(
UINT Flags,_In_reads_(FeatureLevels) const D3D_FEATURE_LEVEL* pFeatureLevels, UINT FeatureLevels,
UINT SDKVersion,REFIID EmulatedInterface, D3D_FEATURE_LEVEL* pChosenFeatureLevel,
ID3DDeviceContextState** ppContextState) = 0;
virtual HRESULT (OpenSharedResource1)(HANDLE hResource,REFIID ReturnedInterface,
void** ppResource) = 0;
virtual HRESULT (OpenSharedResourceByName)(LPCWSTR lpName, DWORD dwDesiredAccess,
REFIID ReturnedInterface, void** ppResource) = 0;
};
D3DINTERFACE(ID3D11Device2, 9d06dffa, d1e5, 4d07, 83, a8, 1b, b1, 23, f2, f8, 41) : public ID3D11Device1
{
public:
// @Patoke todo: make this access wdi::ID3D11DeviceContext2 instead, this is a temporary fix
virtual void (GetImmediateContext2)(::ID3D11DeviceContext2** ppImmediateContext) = 0;
// @Patoke todo: make this access wdi::ID3D11DeviceContext2 instead, this is a temporary fix
virtual HRESULT (CreateDeferredContext2)(UINT ContextFlags, ::ID3D11DeviceContext2** ppDeferredContext) = 0;
virtual void (GetResourceTiling)(ID3D11Resource* pTiledResource, UINT* pNumTilesForEntireResource,
D3D11_PACKED_MIP_DESC* pPackedMipDesc,
D3D11_TILE_SHAPE* pStandardTileShapeForNonPackedMips,
_Inout_opt_ UINT* pNumSubresourceTilings, UINT FirstSubresourceTilingToGet,
_Out_writes_(*pNumSubresourceTilings) D3D11_SUBRESOURCE_TILING*
pSubresourceTilingsForNonPackedMips) = 0;
virtual HRESULT (CheckMultisampleQualityLevels1)(DXGI_FORMAT Format, UINT SampleCount, UINT Flags,
UINT* pNumQualityLevels) = 0;
};
D3DINTERFACE(ID3D11DeviceX, 177700f9, 876a, 4436, b3, 68, 36, a6, 04, f8, 2c, ef) : public ID3D11Device2
{
public:
virtual void (GetImmediateContextX)(ID3D11DeviceContextX** ppImmediateContextX) = 0;
virtual HRESULT (CreateCounterSet)(const D3D11X_COUNTER_SET_DESC* pCounterSetDesc,
ID3D11CounterSetX** ppCounterSet) = 0;
virtual HRESULT (CreateCounterSample)(ID3D11CounterSampleX** ppCounterSample) = 0;
virtual HRESULT (SetDriverHint)(UINT Feature, UINT Value) = 0;
virtual HRESULT (CreateDmaEngineContext)(const D3D11_DMA_ENGINE_CONTEXT_DESC* pDmaEngineContextDesc,
ID3D11DmaEngineContextX** ppDmaDeviceContext) = 0;
virtual BOOL (IsFencePending)(UINT64 Fence) = 0;
virtual BOOL (IsResourcePending)(ID3D11Resource* pResource) = 0;
virtual HRESULT (CreatePlacementBuffer)(const D3D11_BUFFER_DESC* pDesc, void* pVirtualAddress,
ID3D11Buffer** ppBuffer) = 0;
virtual HRESULT (CreatePlacementTexture1D)(const D3D11_TEXTURE1D_DESC* pDesc, UINT TileModeIndex, UINT Pitch,
void* pVirtualAddress, ID3D11Texture1D** ppTexture1D) = 0;
virtual HRESULT (CreatePlacementTexture2D)(const D3D11_TEXTURE2D_DESC* pDesc, UINT TileModeIndex, UINT Pitch,
void* pVirtualAddress, ID3D11Texture2D** ppTexture2D) = 0;
virtual HRESULT (CreatePlacementTexture3D)(const D3D11_TEXTURE3D_DESC* pDesc, UINT TileModeIndex, UINT Pitch,
void* pVirtualAddress, ID3D11Texture3D** ppTexture3D) = 0;
virtual void (GetTimestamps)(UINT64* pGpuTimestamp, UINT64* pCpuRdtscTimestamp) = 0;
virtual HRESULT (CreateSamplerStateX)(const D3D11X_SAMPLER_DESC* pSamplerDesc,
ID3D11SamplerState** ppSamplerState) = 0;
virtual HRESULT (CreateDeferredContextX)(UINT Flags, ID3D11DeviceContextX** ppDeferredContext) = 0;
virtual void (GarbageCollect)(UINT Flags) = 0;
virtual HRESULT (CreateDepthStencilStateX)(const D3D11_DEPTH_STENCIL_DESC* pDepthStencilStateDesc,
ID3D11DepthStencilState** ppDepthStencilState) = 0;
virtual HRESULT (CreatePlacementRenderableTexture2D)(const D3D11_TEXTURE2D_DESC* pDesc, UINT TileModeIndex,
UINT Pitch,
const D3D11X_RENDERABLE_TEXTURE_ADDRESSES* pAddresses,
ID3D11Texture2D** ppTexture2D) = 0;
virtual void (GetDriverStatistics)(UINT StructSize, D3D11X_DRIVER_STATISTICS* pStatistics) = 0;
virtual HRESULT (CreateComputeContextX)(const D3D11_COMPUTE_CONTEXT_DESC* pComputeContextDesc,
ID3D11ComputeContextX** ppComputeContext) = 0;
virtual void (ComposeShaderResourceView)(const D3D11X_DESCRIPTOR_RESOURCE* pDescriptorResource,
const D3D11X_RESOURCE_VIEW_DESC* pViewDesc,
D3D11X_DESCRIPTOR_SHADER_RESOURCE_VIEW* pDescriptorSrv) = 0;
virtual void (ComposeUnorderedAccessView)(const D3D11X_DESCRIPTOR_RESOURCE* pDescriptorResource,
const D3D11X_RESOURCE_VIEW_DESC* pViewDesc,
D3D11X_DESCRIPTOR_UNORDERED_ACCESS_VIEW* pDescriptorUav) = 0;
virtual void (ComposeConstantBufferView)(const D3D11X_DESCRIPTOR_RESOURCE* pDescriptorResource,
const D3D11X_RESOURCE_VIEW_DESC* pViewDesc,
D3D11X_DESCRIPTOR_CONSTANT_BUFFER_VIEW* pDescriptorCb) = 0;
virtual void (ComposeVertexBufferView)(const D3D11X_DESCRIPTOR_RESOURCE* pDescriptorResource,
const D3D11X_RESOURCE_VIEW_DESC* pViewDesc,
D3D11X_DESCRIPTOR_VERTEX_BUFFER_VIEW* pDescriptorVb) = 0;
virtual void (ComposeSamplerState)(const D3D11X_SAMPLER_STATE_DESC* pSamplerDesc,
D3D11X_DESCRIPTOR_SAMPLER_STATE* pDescriptorSamplerState) = 0;
virtual void (PlaceSwapChainView)(ID3D11Resource* pSwapChainBuffer, ID3D11View* pView) = 0;
virtual void (SetDebugFlags)(UINT Flags) = 0;
virtual UINT (GetDebugFlags)() = 0;
virtual void (SetHangCallbacks)(D3D11XHANGBEGINCALLBACK pBeginCallback, D3D11XHANGPRINTCALLBACK pPrintCallback,
D3D11XHANGDUMPCALLBACK pDumpCallback) = 0;
virtual void (ReportGpuHang)(UINT Flags) = 0;
virtual HRESULT (SetGpuMemoryPriority)(UINT Priority) = 0;
virtual void (GetGpuHardwareConfiguration)(D3D11X_GPU_HARDWARE_CONFIGURATION* pGpuHardwareConfiguration) = 0;
};
}
namespace wd
{
class device_x : public wdi::ID3D11DeviceX
{
public:
device_x(::ID3D11Device2* device) : wrapped_interface(device) { wrapped_interface->AddRef(); }
IGU_DEFINE_REF
HRESULT QueryInterface(REFIID riid, void** ppvObject) override
{
if (ppvObject == nullptr) {
return E_POINTER;
}
if (riid == __uuidof(wdi::ID3D11DeviceX) || riid == __uuidof(wdi::ID3D11Device) || riid == __uuidof(wdi::ID3D11Device1) || riid == __uuidof(wdi::ID3D11Device2))
{
*ppvObject = static_cast<wdi::ID3D11DeviceX*>(this);
AddRef( );
return S_OK;
}
if (riid == __uuidof(IDXGIDevice) ||
riid == __uuidof(IDXGIDevice1))
{
wrapped_interface->QueryInterface(__uuidof(IDXGIDevice1), ppvObject);
*ppvObject = new dxgi_device(static_cast<IDXGIDevice1*>(*ppvObject));
return S_OK;
}
if (riid == __uuidof(wdi::IGraphicsUnwrap))
{
*ppvObject = wrapped_interface;
return S_OK;
}
TRACE_INTERFACE_NOT_HANDLED("device_x");
*ppvObject = nullptr;
return E_NOINTERFACE;
}
HRESULT CreateBuffer(const D3D11_BUFFER_DESC* pDesc, const D3D11_SUBRESOURCE_DATA* pInitialData, ID3D11Buffer** ppBuffer) override;
HRESULT CreateTexture1D(const D3D11_TEXTURE1D_DESC* pDesc, const D3D11_SUBRESOURCE_DATA* pInitialData, ID3D11Texture1D** ppTexture1D) override;
HRESULT CreateTexture2D(const D3D11_TEXTURE2D_DESC* pDesc, const D3D11_SUBRESOURCE_DATA* pInitialData, ID3D11Texture2D** ppTexture2D) override;
HRESULT CreateTexture3D(const D3D11_TEXTURE3D_DESC* pDesc, const D3D11_SUBRESOURCE_DATA* pInitialData, ID3D11Texture3D** ppTexture3D) override;
HRESULT CreateShaderResourceView(ID3D11Resource* pResource, const D3D11_SHADER_RESOURCE_VIEW_DESC* pDesc, ID3D11ShaderResourceView** ppSRView) override;
HRESULT CreateUnorderedAccessView(ID3D11Resource* pResource, const D3D11_UNORDERED_ACCESS_VIEW_DESC* pDesc, ID3D11UnorderedAccessView** ppUAView) override;
HRESULT CreateRenderTargetView(ID3D11Resource* pResource, const D3D11_RENDER_TARGET_VIEW_DESC* pDesc, ID3D11RenderTargetView** ppRTView) override;
HRESULT CreateDepthStencilView(ID3D11Resource* pResource, const D3D11_DEPTH_STENCIL_VIEW_DESC* pDesc, ID3D11DepthStencilView** ppDepthStencilView) override;
HRESULT CreateInputLayout(const D3D11_INPUT_ELEMENT_DESC* pInputElementDescs, UINT NumElements, const void* pShaderBytecodeWithInputSignature, SIZE_T BytecodeLength, ID3D11InputLayout** ppInputLayout) override
{
return wrapped_interface->CreateInputLayout(pInputElementDescs, NumElements, pShaderBytecodeWithInputSignature, BytecodeLength, ppInputLayout);
}
HRESULT CreateVertexShader(const void* pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage, ID3D11VertexShader** ppVertexShader) override
{
return wrapped_interface->CreateVertexShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppVertexShader);
}
HRESULT CreateGeometryShader(const void* pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage, ID3D11GeometryShader** ppGeometryShader) override
{
return wrapped_interface->CreateGeometryShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppGeometryShader);
}
HRESULT CreateGeometryShaderWithStreamOutput(const void* pShaderBytecode, SIZE_T BytecodeLength, const D3D11_SO_DECLARATION_ENTRY* pSODeclaration, UINT NumEntries, const UINT* pBufferStrides, UINT NumStrides, UINT RasterizedStream, ID3D11ClassLinkage* pClassLinkage, ID3D11GeometryShader** ppGeometryShader) override
{
return wrapped_interface->CreateGeometryShaderWithStreamOutput(pShaderBytecode, BytecodeLength, pSODeclaration, NumEntries, pBufferStrides, NumStrides, RasterizedStream, pClassLinkage, ppGeometryShader);
}
HRESULT CreatePixelShader(const void* pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage, ID3D11PixelShader** ppPixelShader) override
{
return wrapped_interface->CreatePixelShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppPixelShader);
}
HRESULT CreateHullShader(const void* pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage, ID3D11HullShader** ppHullShader) override
{
return wrapped_interface->CreateHullShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppHullShader);
}
HRESULT CreateDomainShader(const void* pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage, ID3D11DomainShader** ppDomainShader) override
{
return wrapped_interface->CreateDomainShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppDomainShader);
}
HRESULT CreateComputeShader(const void* pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage, ID3D11ComputeShader** ppComputeShader) override
{
return wrapped_interface->CreateComputeShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppComputeShader);
}
HRESULT CreateClassLinkage(ID3D11ClassLinkage** ppLinkage) override
{
return wrapped_interface->CreateClassLinkage(ppLinkage);
}
HRESULT CreateBlendState(const D3D11_BLEND_DESC* pBlendStateDesc, ID3D11BlendState** ppBlendState) override
{
return wrapped_interface->CreateBlendState(pBlendStateDesc, ppBlendState);
}
HRESULT CreateDepthStencilState(const D3D11_DEPTH_STENCIL_DESC* pDepthStencilDesc, ID3D11DepthStencilState** ppDepthStencilState) override
{
return wrapped_interface->CreateDepthStencilState(pDepthStencilDesc, ppDepthStencilState);
}
HRESULT CreateRasterizerState(const D3D11_RASTERIZER_DESC* pRasterizerDesc, ID3D11RasterizerState** ppRasterizerState) override
{
return wrapped_interface->CreateRasterizerState(pRasterizerDesc, ppRasterizerState);
}
HRESULT CreateSamplerState(const D3D11_SAMPLER_DESC* pSamplerDesc, ID3D11SamplerState** ppSamplerState) override
{
return wrapped_interface->CreateSamplerState(pSamplerDesc, ppSamplerState);
}
HRESULT CreateQuery(const D3D11_QUERY_DESC* pQueryDesc, ID3D11Query** ppQuery) override
{
return wrapped_interface->CreateQuery(pQueryDesc, ppQuery);
}
HRESULT CreatePredicate(const D3D11_QUERY_DESC* pPredicateDesc, ID3D11Predicate** ppPredicate) override
{
return wrapped_interface->CreatePredicate(pPredicateDesc, ppPredicate);
}
HRESULT CreateCounter(const D3D11_COUNTER_DESC* pCounterDesc, ID3D11Counter** ppCounter) override
{
return wrapped_interface->CreateCounter(pCounterDesc, ppCounter);
}
HRESULT CreateDeferredContext(UINT ContextFlags, ID3D11DeviceContext** ppDeferredContext) override;
HRESULT OpenSharedResource(HANDLE hResource, REFIID ReturnedInterface, void** ppResource) override
{
return wrapped_interface->OpenSharedResource(hResource, ReturnedInterface, ppResource);
}
HRESULT CheckFormatSupport(DXGI_FORMAT Format, UINT* pFormatSupport) override
{
return wrapped_interface->CheckFormatSupport(Format, pFormatSupport);
}
HRESULT CheckMultisampleQualityLevels(DXGI_FORMAT Format, UINT SampleCount, UINT* pNumQualityLevels) override
{
return wrapped_interface->CheckMultisampleQualityLevels(Format, SampleCount, pNumQualityLevels);
}
void CheckCounterInfo(D3D11_COUNTER_INFO* pCounterInfo) override
{
wrapped_interface->CheckCounterInfo(pCounterInfo);
}
HRESULT CheckCounter(const D3D11_COUNTER_DESC* pDesc, D3D11_COUNTER_TYPE* pType, UINT* pActiveCounters, LPSTR szName, UINT* pNameLength, LPSTR szUnits, UINT* pUnitsLength, LPSTR szDescription, UINT* pDescriptionLength) override
{
return wrapped_interface->CheckCounter(pDesc, pType, pActiveCounters, szName, pNameLength, szUnits, pUnitsLength, szDescription, pDescriptionLength);
}
HRESULT CheckFeatureSupport(D3D11_FEATURE Feature, void* pFeatureSupportData, UINT FeatureSupportDataSize) override
{
return wrapped_interface->CheckFeatureSupport(Feature, pFeatureSupportData, FeatureSupportDataSize);
}
HRESULT GetPrivateData(REFGUID guid, UINT* pDataSize, void* pData) override
{
return wrapped_interface->GetPrivateData(guid, pDataSize, pData);
}
HRESULT SetPrivateData(REFGUID guid, UINT DataSize, const void* pData) override
{
return wrapped_interface->SetPrivateData(guid, DataSize, pData);
}
HRESULT SetPrivateDataInterface(REFGUID guid, const IUnknown* pData) override
{
return wrapped_interface->SetPrivateDataInterface(guid, pData);
}
HRESULT SetPrivateDataInterfaceGraphics(REFGUID guid, const IGraphicsUnknown* pData) override
{
throw std::exception("Not implemented");
//return wrapped_interface->SetPrivateDataInterfaceGraphics(guid, pData);
}
D3D_FEATURE_LEVEL GetFeatureLevel( ) override
{
return wrapped_interface->GetFeatureLevel( );
}
UINT GetCreationFlags( ) override
{
return wrapped_interface->GetCreationFlags( );
}
HRESULT GetDeviceRemovedReason( ) override
{
return wrapped_interface->GetDeviceRemovedReason( );
}
void GetImmediateContext(ID3D11DeviceContext** ppImmediateContext) override;
HRESULT SetExceptionMode(UINT RaiseFlags) override
{
return wrapped_interface->SetExceptionMode(RaiseFlags);
}
UINT GetExceptionMode( ) override
{
return wrapped_interface->GetExceptionMode( );
}
// ID3D11Device1 methods
void GetImmediateContext1(ID3D11DeviceContext1** ppImmediateContext) override
{
wrapped_interface->GetImmediateContext1(ppImmediateContext);
}
HRESULT CreateDeferredContext1(UINT ContextFlags, ID3D11DeviceContext1** ppDeferredContext) override;
HRESULT CreateBlendState1(const D3D11_BLEND_DESC1* pBlendStateDesc, ID3D11BlendState1** ppBlendState) override
{
return wrapped_interface->CreateBlendState1(pBlendStateDesc, ppBlendState);
}
HRESULT CreateRasterizerState1(const D3D11_RASTERIZER_DESC1* pRasterizerDesc, ID3D11RasterizerState1** ppRasterizerState) override
{
return wrapped_interface->CreateRasterizerState1(pRasterizerDesc, ppRasterizerState);
}
HRESULT CreateDeviceContextState(UINT Flags, const D3D_FEATURE_LEVEL* pFeatureLevels, UINT FeatureLevels, UINT SDKVersion, REFIID EmulatedInterface, D3D_FEATURE_LEVEL* pChosenFeatureLevel, ID3DDeviceContextState** ppContextState) override
{
return wrapped_interface->CreateDeviceContextState(Flags, pFeatureLevels, FeatureLevels, SDKVersion, EmulatedInterface, pChosenFeatureLevel, ppContextState);
}
HRESULT OpenSharedResource1(HANDLE hResource, REFIID ReturnedInterface, void** ppResource) override
{
return wrapped_interface->OpenSharedResource1(hResource, ReturnedInterface, ppResource);
}
HRESULT OpenSharedResourceByName(LPCWSTR lpName, DWORD dwDesiredAccess, REFIID ReturnedInterface, void** ppResource) override
{
return wrapped_interface->OpenSharedResourceByName(lpName, dwDesiredAccess, ReturnedInterface, ppResource);
}
// ID3D11Device2 methods
void GetImmediateContext2(ID3D11DeviceContext2** ppImmediateContext) override
{
wrapped_interface->GetImmediateContext2(ppImmediateContext);
}
HRESULT CreateDeferredContext2(UINT ContextFlags, ID3D11DeviceContext2** ppDeferredContext) override;
void GetResourceTiling(ID3D11Resource* pTiledResource, UINT* pNumTilesForEntireResource, D3D11_PACKED_MIP_DESC* pPackedMipDesc, D3D11_TILE_SHAPE* pStandardTileShapeForNonPackedMips, UINT* pNumSubresourceTilings, UINT FirstSubresourceTilingToGet, D3D11_SUBRESOURCE_TILING* pSubresourceTilingsForNonPackedMips) override
{
wrapped_interface->GetResourceTiling(pTiledResource, pNumTilesForEntireResource, pPackedMipDesc, pStandardTileShapeForNonPackedMips, pNumSubresourceTilings, FirstSubresourceTilingToGet, pSubresourceTilingsForNonPackedMips);
}
HRESULT CheckMultisampleQualityLevels1(DXGI_FORMAT Format, UINT SampleCount, UINT Flags, UINT* pNumQualityLevels) override
{
return wrapped_interface->CheckMultisampleQualityLevels1(Format, SampleCount, Flags, pNumQualityLevels);
}
// ID3D11DeviceX methods
void GetImmediateContextX(wdi::ID3D11DeviceContextX** ppImmediateContextX) override;
HRESULT CreateCounterSet(const wdi::D3D11X_COUNTER_SET_DESC* pCounterSetDesc,
wdi::ID3D11CounterSetX** ppCounterSet) override;
HRESULT CreateCounterSample(wdi::ID3D11CounterSampleX** ppCounterSample) override;
HRESULT SetDriverHint(UINT Feature, UINT Value) override;
HRESULT CreateDmaEngineContext(const wdi::D3D11_DMA_ENGINE_CONTEXT_DESC* pDmaEngineContextDesc,
wdi::ID3D11DmaEngineContextX** ppDmaDeviceContext) override;
BOOL IsFencePending(UINT64 Fence) override;
BOOL IsResourcePending(ID3D11Resource* pResource) override;
HRESULT CreatePlacementBuffer(const D3D11_BUFFER_DESC* pDesc, void* pVirtualAddress,
ID3D11Buffer** ppBuffer) override;
HRESULT CreatePlacementTexture1D(const D3D11_TEXTURE1D_DESC* pDesc, UINT TileModeIndex, UINT Pitch,
void* pVirtualAddress, ID3D11Texture1D** ppTexture1D) override;
HRESULT CreatePlacementTexture2D(const D3D11_TEXTURE2D_DESC* pDesc, UINT TileModeIndex, UINT Pitch,
void* pVirtualAddress, ID3D11Texture2D** ppTexture2D) override;
HRESULT CreatePlacementTexture3D(const D3D11_TEXTURE3D_DESC* pDesc, UINT TileModeIndex, UINT Pitch,
void* pVirtualAddress, ID3D11Texture3D** ppTexture3D) override;
void GetTimestamps(UINT64* pGpuTimestamp, UINT64* pCpuRdtscTimestamp) override;
HRESULT CreateSamplerStateX(const wdi::D3D11X_SAMPLER_DESC* pSamplerDesc,
ID3D11SamplerState** ppSamplerState) override;
HRESULT CreateDeferredContextX(UINT Flags, wdi::ID3D11DeviceContextX** ppDeferredContext) override;
void GarbageCollect(UINT Flags) override;
HRESULT CreateDepthStencilStateX(const D3D11_DEPTH_STENCIL_DESC* pDepthStencilStateDesc,
ID3D11DepthStencilState** ppDepthStencilState) override;
HRESULT CreatePlacementRenderableTexture2D(const D3D11_TEXTURE2D_DESC* pDesc, UINT TileModeIndex,
UINT Pitch,
const wdi::D3D11X_RENDERABLE_TEXTURE_ADDRESSES* pAddresses,
ID3D11Texture2D** ppTexture2D) override;
void GetDriverStatistics(UINT StructSize, wdi::D3D11X_DRIVER_STATISTICS* pStatistics) override;
HRESULT CreateComputeContextX(const wdi::D3D11_COMPUTE_CONTEXT_DESC* pComputeContextDesc,
wdi::ID3D11ComputeContextX** ppComputeContext) override;
void ComposeShaderResourceView(const wdi::D3D11X_DESCRIPTOR_RESOURCE* pDescriptorResource,
const wdi::D3D11X_RESOURCE_VIEW_DESC* pViewDesc,
wdi::D3D11X_DESCRIPTOR_SHADER_RESOURCE_VIEW* pDescriptorSrv) override;
void ComposeUnorderedAccessView(const wdi::D3D11X_DESCRIPTOR_RESOURCE* pDescriptorResource,
const wdi::D3D11X_RESOURCE_VIEW_DESC* pViewDesc,
wdi::D3D11X_DESCRIPTOR_UNORDERED_ACCESS_VIEW* pDescriptorUav) override;
void ComposeConstantBufferView(const wdi::D3D11X_DESCRIPTOR_RESOURCE* pDescriptorResource,
const wdi::D3D11X_RESOURCE_VIEW_DESC* pViewDesc,
wdi::D3D11X_DESCRIPTOR_CONSTANT_BUFFER_VIEW* pDescriptorCb) override;
void ComposeVertexBufferView(const wdi::D3D11X_DESCRIPTOR_RESOURCE* pDescriptorResource,
const wdi::D3D11X_RESOURCE_VIEW_DESC* pViewDesc,
wdi::D3D11X_DESCRIPTOR_VERTEX_BUFFER_VIEW* pDescriptorVb) override;
void ComposeSamplerState(const wdi::D3D11X_SAMPLER_STATE_DESC* pSamplerDesc,
wdi::D3D11X_DESCRIPTOR_SAMPLER_STATE* pDescriptorSamplerState) override;
void PlaceSwapChainView(ID3D11Resource* pSwapChainBuffer, ID3D11View* pView) override;
void SetDebugFlags(UINT Flags) override;
UINT GetDebugFlags() override;
void SetHangCallbacks(wdi::D3D11XHANGBEGINCALLBACK pBeginCallback, wdi::D3D11XHANGPRINTCALLBACK pPrintCallback,
wdi::D3D11XHANGDUMPCALLBACK pDumpCallback) override;
void ReportGpuHang(UINT Flags) override;
HRESULT SetGpuMemoryPriority(UINT Priority) override;
void GetGpuHardwareConfiguration(wdi::D3D11X_GPU_HARDWARE_CONFIGURATION* pGpuHardwareConfiguration) override;
private:
::ID3D11Device2* wrapped_interface;
};
}

View File

@@ -1,9 +1,6 @@
// ReSharper disable CppInconsistentNaming
// ReSharper disable CppParameterMayBeConst
#include "pch.h"
#include <cstdlib>
#include "windows.h"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD forwardReason, LPVOID lpvReserved)
{
constexpr BOOL result = TRUE;

View File

@@ -0,0 +1,36 @@
#include "dxgi_adapter.h"
#include "dxgi_factory.h"
HRESULT wd::dxgi_adapter::GetParent(const IID& riid, void** ppParent)
{
if (riid == __uuidof(IDXGIFactory) ||
riid == __uuidof(IDXGIFactory1) ||
riid == __uuidof(IDXGIFactory2))
{
IDXGIFactory2* factory = nullptr;
HRESULT hr = wrapped_interface->GetParent(IID_PPV_ARGS(&factory));
*ppParent = new dxgi_factory(factory);
this->AddRef( );
return hr;
}
TRACE_INTERFACE_NOT_HANDLED("dxgi_adapter");
*ppParent = nullptr;
return E_NOINTERFACE;
}
HRESULT wd::dxgi_adapter::EnumOutputs(UINT Output, IDXGIOutput** ppOutput)
{
return wrapped_interface->EnumOutputs(Output, ppOutput);
}
HRESULT wd::dxgi_adapter::GetDesc(DXGI_ADAPTER_DESC* pDesc)
{
return wrapped_interface->GetDesc(pDesc);
}
HRESULT wd::dxgi_adapter::CheckInterfaceSupport(const GUID& InterfaceName, LARGE_INTEGER* pUMDVersion)
{
printf("WARN: dxgi_adapter::CheckInterfaceSupport is likely to fail due no support for d3d11.x!!!\n");
return wrapped_interface->CheckInterfaceSupport(InterfaceName, pUMDVersion);
}

View File

@@ -0,0 +1,49 @@
#pragma once
#include "dxgi_object.hpp"
namespace wdi
{
D3DINTERFACE(IDXGIAdapter, 2411e7e1, 12ac, 4ccf, bd, 14, 97, 98, e8, 53, 4d, c0) : public wd::dxgi_object {
public:
virtual HRESULT STDMETHODCALLTYPE EnumOutputs(UINT Output, IDXGIOutput** ppOutput) PURE;
virtual HRESULT STDMETHODCALLTYPE GetDesc(DXGI_ADAPTER_DESC* pDesc) PURE;
virtual HRESULT STDMETHODCALLTYPE CheckInterfaceSupport(REFGUID InterfaceName, LARGE_INTEGER* pUMDVersion) PURE;
};
}
namespace wd
{
class dxgi_adapter : public wdi::IDXGIAdapter
{
public:
dxgi_adapter(::IDXGIAdapter* adapter) : wrapped_interface(adapter) { wrapped_interface->AddRef( ); }
IGU_DEFINE_REF
HRESULT QueryInterface(const IID& riid, void** ppvObject) override
{
if (riid == __uuidof(wdi::IDXGIAdapter))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
\
if (riid == __uuidof(wdi::IGraphicsUnwrap))
{
*ppvObject = wrapped_interface;
return S_OK;
}
TRACE_INTERFACE_NOT_HANDLED("dxgi_adapter");
*ppvObject = nullptr;
return E_NOINTERFACE;
}
HRESULT GetParent(const IID& riid, void** ppParent) override;
HRESULT EnumOutputs(UINT Output, IDXGIOutput** ppOutput) override;
HRESULT GetDesc(DXGI_ADAPTER_DESC* pDesc) override;
HRESULT CheckInterfaceSupport(const GUID& InterfaceName, LARGE_INTEGER* pUMDVersion) override;
::IDXGIAdapter* wrapped_interface;
};
}

View File

@@ -0,0 +1,51 @@
#include "dxgi_device.h"
#include "dxgi_adapter.h"
HRESULT wd::dxgi_device::GetParent(const IID& riid, void** ppParent)
{
HRESULT hr = wrapped_interface->GetParent(riid, ppParent);
AddRef( );
if (riid == __uuidof(IDXGIAdapter)) {
*ppParent = new dxgi_adapter(static_cast<IDXGIAdapter*>(*ppParent));
}
return hr;
}
HRESULT wd::dxgi_device::SetPrivateData(const GUID& Name, UINT DataSize, const void* pData)
{
return wrapped_interface->SetPrivateData(Name, DataSize, pData);
}
HRESULT wd::dxgi_device::GetAdapter(wdi::IDXGIAdapter** pAdapter)
{
IDXGIAdapter* adapter;
HRESULT hr = wrapped_interface->GetAdapter(&adapter);
*pAdapter = new dxgi_adapter(adapter);
return hr;
}
HRESULT wd::dxgi_device::CreateSurface(const DXGI_SURFACE_DESC* pDesc, UINT NumSurfaces, DXGI_USAGE Usage,
const DXGI_SHARED_RESOURCE* pSharedResource, IDXGISurface** ppSurface)
{
return wrapped_interface->CreateSurface(pDesc, NumSurfaces, Usage, pSharedResource, ppSurface);
}
HRESULT wd::dxgi_device::QueryResourceResidency(IGraphicsUnknown** ppResources, DXGI_RESIDENCY* pResidencyStatus,
UINT NumResources)
{
TRACE_NOT_IMPLEMENTED("dxgi_device");
return E_NOTIMPL;
}
HRESULT wd::dxgi_device::SetGPUThreadPriority(INT Priority)
{
return wrapped_interface->SetGPUThreadPriority(Priority);
}
HRESULT wd::dxgi_device::GetGPUThreadPriority(INT* pPriority)
{
return wrapped_interface->GetGPUThreadPriority(pPriority);
}

View File

@@ -0,0 +1,72 @@
#pragma once
#include "dxgi_object.hpp"
namespace wdi
{
class IDXGIAdapter;
D3DINTERFACE(IDXGIDevice, 54ec77fa, 1377, 44e6, 8c, 32, 88, fd, 5f, 44, c8, 4c) : public wd::dxgi_object {
public:
virtual HRESULT STDMETHODCALLTYPE GetAdapter(IDXGIAdapter** pAdapter) PURE;
virtual HRESULT STDMETHODCALLTYPE CreateSurface(const DXGI_SURFACE_DESC* pDesc, UINT NumSurfaces, DXGI_USAGE Usage,
const DXGI_SHARED_RESOURCE* pSharedResource,
_Out_writes_(NumSurfaces) IDXGISurface** ppSurface) PURE;
virtual HRESULT STDMETHODCALLTYPE QueryResourceResidency(
_In_reads_(NumResources) IGraphicsUnknown** ppResources,
_Out_writes_(NumResources) DXGI_RESIDENCY* pResidencyStatus,
/* [in] */ UINT NumResources) PURE;
virtual HRESULT STDMETHODCALLTYPE SetGPUThreadPriority(
/* [in] */ INT Priority) PURE;
virtual HRESULT STDMETHODCALLTYPE GetGPUThreadPriority(
_Out_ INT* pPriority) PURE;
};
D3DINTERFACE(IDXGIDeviceSubObject, 3d3e0379, f9de, 4d58, bb, 6c, 18, d6, 29, 92, f1, a6) : public wd::dxgi_object
{
virtual HRESULT STDMETHODCALLTYPE GetDevice(REFIID riid, void** ppDevice) = 0;
};
}
namespace wd
{
class dxgi_device : public wdi::IDXGIDevice
{
public:
dxgi_device(::IDXGIDevice* device) : wrapped_interface(device) { wrapped_interface->AddRef( ); }
IGU_DEFINE_REF
HRESULT QueryInterface(const IID& riid, void** ppvObject) override
{
if (riid == __uuidof(wdi::IDXGIDevice))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
if (riid == __uuidof(wdi::IGraphicsUnwrap))
{
*ppvObject = wrapped_interface;
return S_OK;
}
TRACE_INTERFACE_NOT_HANDLED("dxgi_device");
*ppvObject = nullptr;
return E_NOINTERFACE;
}
HRESULT GetParent(const IID& riid, void** ppParent) override;
HRESULT SetPrivateData(const GUID& Name, UINT DataSize, const void* pData) override;
HRESULT GetAdapter(wdi::IDXGIAdapter** pAdapter) override;
HRESULT CreateSurface(const DXGI_SURFACE_DESC* pDesc, UINT NumSurfaces, DXGI_USAGE Usage,
const DXGI_SHARED_RESOURCE* pSharedResource, IDXGISurface** ppSurface) override;
HRESULT QueryResourceResidency(IGraphicsUnknown** ppResources, DXGI_RESIDENCY* pResidencyStatus,
UINT NumResources) override;
HRESULT SetGPUThreadPriority(INT Priority) override;
HRESULT GetGPUThreadPriority(INT* pPriority) override;
::IDXGIDevice* wrapped_interface;
};
}

View File

@@ -0,0 +1,150 @@
#include "dxgi_factory.h"
#include <windows.ui.core.h>
#include <wrl/client.h>
#include <wrl/wrappers/corewrappers.h>
#include "dxgi_swapchain.h"
#include "../kernelx/CoreWindowWrapperX.h"
#define DXGI_SWAPCHAIN_FLAG_MASK DXGI_SWAP_CHAIN_FLAG_NONPREROTATED | DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH | DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE \
| DXGI_SWAP_CHAIN_FLAG_RESTRICTED_CONTENT | DXGI_SWAP_CHAIN_FLAG_RESTRICT_SHARED_RESOURCE_DRIVER | DXGI_SWAP_CHAIN_FLAG_DISPLAY_ONLY | DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT \
| DXGI_SWAP_CHAIN_FLAG_FOREGROUND_LAYER | DXGI_SWAP_CHAIN_FLAG_FULLSCREEN_VIDEO | DXGI_SWAP_CHAIN_FLAG_YUV_VIDEO \
| DXGI_SWAP_CHAIN_FLAG_HW_PROTECTED | DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING \
| DXGI_SWAP_CHAIN_FLAG_RESTRICTED_TO_ALL_HOLOGRAPHIC_DISPLAYS
HRESULT wd::dxgi_factory::GetParent(const IID& riid, void** ppParent)
{
return wrapped_interface->GetParent(riid, ppParent);
}
HRESULT wd::dxgi_factory::EnumAdapters1(UINT Adapter, IDXGIAdapter1** ppAdapter)
{
return wrapped_interface->EnumAdapters1(Adapter, ppAdapter);
}
HRESULT wd::dxgi_factory::CreateSwapChainForComposition(IGraphicsUnknown* pDevice, const DXGI_SWAP_CHAIN_DESC1* pDesc,
IDXGIOutput* pRestrictToOutput, IDXGISwapChain1** ppSwapChain)
{
return wrapped_interface->CreateSwapChainForComposition(reinterpret_cast<IUnknown*>(pDevice), pDesc, pRestrictToOutput, ppSwapChain);
}
HRESULT wd::dxgi_factory::CreateSwapChainForHwnd(IGraphicsUnknown* pDevice, HWND hWnd,
const DXGI_SWAP_CHAIN_DESC1* pDesc, const DXGI_SWAP_CHAIN_FULLSCREEN_DESC* pFullscreenDesc,
IDXGIOutput* pRestrictToOutput, IDXGISwapChain1** ppSwapChain)
{
return wrapped_interface->CreateSwapChainForHwnd(reinterpret_cast<IUnknown*>(pDevice), hWnd, pDesc, pFullscreenDesc, pRestrictToOutput, ppSwapChain);
}
HRESULT wd::dxgi_factory::CreateSwapChainForCoreWindow(IGraphicsUnknown* pDevice, IUnknown* pWindow,
DXGI_SWAP_CHAIN_DESC1* pDesc, IDXGIOutput* pRestrictToOutput, IDXGISwapChain1** ppSwapChain)
{
IDXGISwapChain1* swap = nullptr;
HRESULT hr;
pDesc->Flags &= DXGI_SWAPCHAIN_FLAG_MASK;
pDesc->Scaling = DXGI_SCALING_ASPECT_RATIO_STRETCH;
IUnknown* pRealDevice = nullptr;
hr = pDevice->QueryInterface(__uuidof(wdi::IGraphicsUnwrap), (void**)&pRealDevice);
if (FAILED(hr))
{
printf("CRITICAL: dxgi_factory::CreateSwapChainForCoreWindow -> failed to unwrap device, this is a critical leak!\n");
return hr;
}
if (pWindow == nullptr)
{
Microsoft::WRL::ComPtr<ABI::Windows::UI::Core::ICoreWindowStatic> coreWindowStatic;
RoGetActivationFactory(Microsoft::WRL::Wrappers::HStringReference(RuntimeClass_Windows_UI_Core_CoreWindow).Get( ), IID_PPV_ARGS(&coreWindowStatic));
Microsoft::WRL::ComPtr<ABI::Windows::UI::Core::ICoreWindow> coreWindow;
coreWindowStatic->GetForCurrentThread(&coreWindow);
pWindow = coreWindow.Get( );
hr = wrapped_interface->CreateSwapChainForCoreWindow(pRealDevice, pWindow, pDesc, pRestrictToOutput, &swap);
*ppSwapChain = reinterpret_cast<IDXGISwapChain1*>(new dxgi_swapchain(swap));
}
else
{
hr = wrapped_interface->CreateSwapChainForCoreWindow(pRealDevice, reinterpret_cast<CoreWindowWrapperX*>(pWindow)->m_realWindow, pDesc, pRestrictToOutput, &swap);
*ppSwapChain = reinterpret_cast<IDXGISwapChain1*>(new dxgi_swapchain(swap));
}
// TODO: init overlay
return hr;
}
HRESULT wd::dxgi_factory::GetSharedResourceAdapterLuid(HANDLE hResource, LUID* pLuid)
{
return wrapped_interface->GetSharedResourceAdapterLuid(hResource, pLuid);
}
HRESULT wd::dxgi_factory::RegisterStereoStatusWindow(HWND WindowHandle, UINT wMsg, DWORD* pdwCookie)
{
return wrapped_interface->RegisterStereoStatusWindow(WindowHandle, wMsg, pdwCookie);
}
HRESULT wd::dxgi_factory::RegisterStereoStatusEvent(HANDLE hEvent, DWORD* pdwCookie)
{
return wrapped_interface->RegisterStereoStatusEvent(hEvent, pdwCookie);
}
void wd::dxgi_factory::UnregisterStereoStatus(DWORD dwCookie)
{
wrapped_interface->UnregisterStereoStatus(dwCookie);
}
HRESULT wd::dxgi_factory::RegisterOcclusionStatusWindow(HWND WindowHandle, UINT wMsg, DWORD* pdwCookie)
{
return wrapped_interface->RegisterOcclusionStatusWindow(WindowHandle, wMsg, pdwCookie);
}
HRESULT wd::dxgi_factory::RegisterOcclusionStatusEvent(HANDLE hEvent, DWORD* pdwCookie)
{
return wrapped_interface->RegisterOcclusionStatusEvent(hEvent, pdwCookie);
}
void wd::dxgi_factory::UnregisterOcclusionStatus(DWORD dwCookie)
{
return wrapped_interface->UnregisterOcclusionStatus(dwCookie);
}
BOOL wd::dxgi_factory::IsCurrent()
{
return wrapped_interface->IsCurrent( );
}
BOOL wd::dxgi_factory::IsWindowedStereoEnabled()
{
return wrapped_interface->IsWindowedStereoEnabled( );
}
HRESULT wd::dxgi_factory::EnumAdapters(UINT Adapter, wdi::IDXGIAdapter** ppAdapter)
{
printf("WARN: dxgi_factory::EnumAdapters does not wrap IDXGIAdapter!!!\n");
return wrapped_interface->EnumAdapters(Adapter, reinterpret_cast<IDXGIAdapter**>(ppAdapter));
}
HRESULT wd::dxgi_factory::MakeWindowAssociation(HWND WindowHandle, UINT Flags)
{
return wrapped_interface->MakeWindowAssociation(WindowHandle, Flags);
}
HRESULT wd::dxgi_factory::GetWindowAssociation(HWND* pWindowHandle)
{
return wrapped_interface->GetWindowAssociation(pWindowHandle);
}
HRESULT wd::dxgi_factory::CreateSwapChain(IGraphicsUnknown* pDevice, DXGI_SWAP_CHAIN_DESC* pDesc,
IDXGISwapChain** ppSwapChain)
{
return wrapped_interface->CreateSwapChain(reinterpret_cast<IUnknown*>(pDevice), pDesc, ppSwapChain);
}
HRESULT wd::dxgi_factory::CreateSoftwareAdapter(HMODULE Module, wdi::IDXGIAdapter** ppAdapter)
{
printf("WARN: dxgi_factory::CreateSoftwareAdapter does not wrap IDXGIAdapter!!!\n");
return wrapped_interface->CreateSoftwareAdapter(Module, reinterpret_cast<IDXGIAdapter**>(ppAdapter));
}

155
dlls/d3d11_x/dxgi_factory.h Normal file
View File

@@ -0,0 +1,155 @@
#pragma once
#include "dxgi_object.hpp"
namespace wdi
{
class IDXGIAdapter;
D3DINTERFACE(IDXGIFactory, 7b7166ec, 21c7, 44ae, b2, 1a, c9, ae, 32, 1a, e3, 69) : public wd::dxgi_object
{
public:
IDXGIAdapter2 * m_pAdapter;
virtual HRESULT STDMETHODCALLTYPE EnumAdapters(
UINT Adapter,
IDXGIAdapter** ppAdapter) PURE;
virtual HRESULT STDMETHODCALLTYPE MakeWindowAssociation(
HWND WindowHandle,
UINT Flags) PURE;
virtual HRESULT STDMETHODCALLTYPE GetWindowAssociation(
HWND* pWindowHandle) PURE;
virtual HRESULT STDMETHODCALLTYPE CreateSwapChain(
IGraphicsUnknown* pDevice,
DXGI_SWAP_CHAIN_DESC* pDesc,
IDXGISwapChain** ppSwapChain) PURE;
virtual HRESULT STDMETHODCALLTYPE CreateSoftwareAdapter(
HMODULE Module,
IDXGIAdapter** ppAdapter) PURE;
};
D3DINTERFACE(IDXGIFactory1, 770aae78, f26f, 4dba, a8, 29, 25, 3c, 83, d1, b3, 87) : public IDXGIFactory
{
public:
virtual HRESULT STDMETHODCALLTYPE EnumAdapters1(
UINT Adapter,
IDXGIAdapter1** ppAdapter) PURE;
virtual BOOL STDMETHODCALLTYPE IsCurrent( ) PURE;
};
D3DINTERFACE(IDXGIFactory2, 50c83a1c, e072, 4c48, 87, b0, 36, 30, fa, 36, a6, d0) : public IDXGIFactory1
{
public:
virtual BOOL STDMETHODCALLTYPE IsWindowedStereoEnabled(void) PURE;
virtual HRESULT STDMETHODCALLTYPE CreateSwapChainForHwnd(IGraphicsUnknown* pDevice,
HWND hWnd, const DXGI_SWAP_CHAIN_DESC1* pDesc,
const DXGI_SWAP_CHAIN_FULLSCREEN_DESC* pFullscreenDesc,
IDXGIOutput* pRestrictToOutput,
IDXGISwapChain1** ppSwapChain) PURE;
virtual HRESULT STDMETHODCALLTYPE CreateSwapChainForCoreWindow(
IGraphicsUnknown* pDevice,
IUnknown* pWindow,
DXGI_SWAP_CHAIN_DESC1* pDesc,
IDXGIOutput* pRestrictToOutput,
IDXGISwapChain1** ppSwapChain) PURE;
virtual HRESULT STDMETHODCALLTYPE GetSharedResourceAdapterLuid(
HANDLE hResource,
LUID* pLuid) PURE;
virtual HRESULT STDMETHODCALLTYPE RegisterStereoStatusWindow(
HWND WindowHandle,
UINT wMsg,
DWORD* pdwCookie) PURE;
virtual HRESULT STDMETHODCALLTYPE RegisterStereoStatusEvent(
HANDLE hEvent,
DWORD* pdwCookie) PURE;
virtual void STDMETHODCALLTYPE UnregisterStereoStatus(
DWORD dwCookie) PURE;
virtual HRESULT STDMETHODCALLTYPE RegisterOcclusionStatusWindow(
HWND WindowHandle,
UINT wMsg,
DWORD* pdwCookie) PURE;
virtual HRESULT STDMETHODCALLTYPE RegisterOcclusionStatusEvent(
HANDLE hEvent,
DWORD* pdwCookie) PURE;
virtual void STDMETHODCALLTYPE UnregisterOcclusionStatus(
DWORD dwCookie) PURE;
virtual HRESULT STDMETHODCALLTYPE CreateSwapChainForComposition(
IGraphicsUnknown* pDevice,
const DXGI_SWAP_CHAIN_DESC1* pDesc,
IDXGIOutput* pRestrictToOutput,
IDXGISwapChain1** ppSwapChain) PURE;
};
}
namespace wd {
class dxgi_factory : public wdi::IDXGIFactory2
{
public:
dxgi_factory(::IDXGIFactory2* factory) : wrapped_interface(factory) { wrapped_interface->AddRef( ); }
IGU_DEFINE_REF
HRESULT QueryInterface(const IID& riid, void** ppvObject) override
{
if (riid == __uuidof(wdi::IDXGIFactory) || riid == __uuidof(wdi::IDXGIFactory1) ||
riid == __uuidof(wdi::IDXGIFactory2))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
if (riid == __uuidof(wdi::IGraphicsUnwrap))
{
*ppvObject = wrapped_interface;
return S_OK;
}
TRACE_INTERFACE_NOT_HANDLED("dxgi_factory");
*ppvObject = nullptr;
return E_NOINTERFACE;
}
HRESULT GetParent(const IID& riid, void** ppParent) override;
HRESULT EnumAdapters1(UINT Adapter, IDXGIAdapter1** ppAdapter) override;
HRESULT CreateSwapChainForComposition(IGraphicsUnknown* pDevice, const DXGI_SWAP_CHAIN_DESC1* pDesc,
IDXGIOutput* pRestrictToOutput, IDXGISwapChain1** ppSwapChain) override;
HRESULT CreateSwapChainForHwnd(IGraphicsUnknown* pDevice, HWND hWnd, const DXGI_SWAP_CHAIN_DESC1* pDesc,
const DXGI_SWAP_CHAIN_FULLSCREEN_DESC* pFullscreenDesc, IDXGIOutput* pRestrictToOutput,
IDXGISwapChain1** ppSwapChain) override;
HRESULT CreateSwapChainForCoreWindow(IGraphicsUnknown* pDevice, IUnknown* pWindow, DXGI_SWAP_CHAIN_DESC1* pDesc,
IDXGIOutput* pRestrictToOutput, IDXGISwapChain1** ppSwapChain) override;
HRESULT GetSharedResourceAdapterLuid(HANDLE hResource, LUID* pLuid) override;
HRESULT RegisterStereoStatusWindow(HWND WindowHandle, UINT wMsg, DWORD* pdwCookie) override;
HRESULT RegisterStereoStatusEvent(HANDLE hEvent, DWORD* pdwCookie) override;
void UnregisterStereoStatus(DWORD dwCookie) override;
HRESULT RegisterOcclusionStatusWindow(HWND WindowHandle, UINT wMsg, DWORD* pdwCookie) override;
HRESULT RegisterOcclusionStatusEvent(HANDLE hEvent, DWORD* pdwCookie) override;
void UnregisterOcclusionStatus(DWORD dwCookie) override;
BOOL IsCurrent() override;
BOOL IsWindowedStereoEnabled() override;
HRESULT EnumAdapters(UINT Adapter, wdi::IDXGIAdapter** ppAdapter) override;
HRESULT MakeWindowAssociation(HWND WindowHandle, UINT Flags) override;
HRESULT GetWindowAssociation(HWND* pWindowHandle) override;
HRESULT CreateSwapChain(IGraphicsUnknown* pDevice, DXGI_SWAP_CHAIN_DESC* pDesc,
IDXGISwapChain** ppSwapChain) override;
HRESULT CreateSoftwareAdapter(HMODULE Module, wdi::IDXGIAdapter** ppAdapter) override;
private:
::IDXGIFactory2* wrapped_interface;
};
}

View File

@@ -0,0 +1 @@
#include "dxgi_object.hpp"

View File

@@ -0,0 +1,35 @@
#pragma once
#include "graphics_unknown.h"
namespace wdi
{
D3DINTERFACE(IDXGIObject, aec22fb8, 76f3, 4639, 9b, e0, 28, eb, 43, a6, 7a, 2e) : public wd::graphics_unknown {
public: void* m_pPrivateData;
virtual HRESULT STDMETHODCALLTYPE SetPrivateData(REFGUID Name, UINT DataSize, const void* pData) = 0;
virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(REFGUID Name, const IUnknown* pUnknown) = 0;
virtual HRESULT STDMETHODCALLTYPE GetPrivateData(REFGUID Name, UINT* pDataSize, void* pData) = 0;
virtual HRESULT STDMETHODCALLTYPE GetParent(REFIID riid, void** ppParent) = 0;
};
}
namespace wd {
class dxgi_object : public wdi::IDXGIObject
{
public:
HRESULT SetPrivateData(const GUID& Name, UINT DataSize, const void* pData) override {
TRACE_NOT_IMPLEMENTED("dxgi_object");
return E_NOTIMPL;
}
HRESULT SetPrivateDataInterface(const GUID& Name, const IUnknown* pUnknown) override {
TRACE_NOT_IMPLEMENTED("dxgi_object");
return E_NOTIMPL;
}
HRESULT GetPrivateData(const GUID& Name, UINT* pDataSize, void* pData) override {
TRACE_NOT_IMPLEMENTED("dxgi_object");
return E_NOTIMPL;
}
};
}

View File

@@ -0,0 +1,172 @@
#include "dxgi_swapchain.h"
#include "resource.hpp"
HRESULT wd::dxgi_swapchain::QueryInterface(const IID& riid, void** ppvObject)
{
if (riid == __uuidof(wdi::IDXGISwapChain1))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
if (riid == __uuidof(wdi::IGraphicsUnwrap))
{
*ppvObject = wrapped_interface;
return S_OK;
}
TRACE_INTERFACE_NOT_HANDLED("dxgi_swapchain");
*ppvObject = nullptr;
return E_NOINTERFACE;
}
HRESULT wd::dxgi_swapchain::GetParent(const IID& riid, void** ppParent)
{
return wrapped_interface->GetParent(riid, ppParent);
}
HRESULT wd::dxgi_swapchain::GetDevice(const IID& riid, void** ppDevice)
{
return wrapped_interface->GetDevice(riid, ppDevice);
}
HRESULT wd::dxgi_swapchain::Present(UINT SyncInterval, UINT Flags)
{
return wrapped_interface->Present(SyncInterval, Flags);
}
HRESULT wd::dxgi_swapchain::GetBuffer(UINT Buffer, const IID& riid, void** ppSurface)
{
bool incRef = false;
if (riid == __uuidof(ID3D11Texture1D))
{
ID3D11Texture1D* texture1d = nullptr;
HRESULT hr = wrapped_interface->GetBuffer(Buffer, IID_PPV_ARGS(&texture1d));
*ppSurface = new texture_1d(texture1d);
incRef = true;
}
else if (riid == __uuidof(ID3D11Texture2D))
{
ID3D11Texture2D* texture2d = nullptr;
HRESULT hr = wrapped_interface->GetBuffer(Buffer, IID_PPV_ARGS(&texture2d));
*ppSurface = new texture_2d(texture2d);
incRef = true;
}
else if (riid == __uuidof(ID3D11Texture3D))
{
ID3D11Texture3D* texture3d = nullptr;
HRESULT hr = wrapped_interface->GetBuffer(Buffer, IID_PPV_ARGS(&texture3d));
*ppSurface = new texture_3d(texture3d);
incRef = true;
}
if (incRef)
{
AddRef( );
return S_OK;
}
TRACE_INTERFACE_NOT_HANDLED("dxgi_swapchain - GetBuffer");
*ppSurface = nullptr;
return E_NOINTERFACE;
}
HRESULT wd::dxgi_swapchain::SetFullscreenState(BOOL Fullscreen, IDXGIOutput* pTarget)
{
return wrapped_interface->SetFullscreenState(Fullscreen, pTarget);
}
HRESULT wd::dxgi_swapchain::GetFullscreenState(BOOL* pFullscreen, IDXGIOutput** ppTarget)
{
return wrapped_interface->GetFullscreenState(pFullscreen, ppTarget);
}
HRESULT wd::dxgi_swapchain::GetDesc(DXGI_SWAP_CHAIN_DESC* pDesc)
{
return wrapped_interface->GetDesc(pDesc);
}
HRESULT wd::dxgi_swapchain::ResizeBuffers(UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat,
UINT SwapChainFlags)
{
return wrapped_interface->ResizeBuffers(BufferCount, Width, Height, NewFormat, SwapChainFlags);
}
HRESULT wd::dxgi_swapchain::ResizeTarget(const DXGI_MODE_DESC* pNewTargetParameters)
{
return wrapped_interface->ResizeTarget(pNewTargetParameters);
}
HRESULT wd::dxgi_swapchain::GetContainingOutput(IDXGIOutput** ppOutput)
{
return wrapped_interface->GetContainingOutput(ppOutput);
}
HRESULT wd::dxgi_swapchain::GetFrameStatistics(DXGI_FRAME_STATISTICS* pStats)
{
return wrapped_interface->GetFrameStatistics(pStats);
}
HRESULT wd::dxgi_swapchain::GetLastPresentCount(UINT* pLastPresentCount)
{
return wrapped_interface->GetLastPresentCount(pLastPresentCount);
}
HRESULT wd::dxgi_swapchain::GetDesc1(DXGI_SWAP_CHAIN_DESC1* pDesc)
{
return wrapped_interface->GetDesc1(pDesc);
}
HRESULT wd::dxgi_swapchain::GetFullscreenDesc(DXGI_SWAP_CHAIN_FULLSCREEN_DESC* pDesc)
{
return wrapped_interface->GetFullscreenDesc(pDesc);
}
HRESULT wd::dxgi_swapchain::GetHwnd(HWND* pHwnd)
{
return wrapped_interface->GetHwnd(pHwnd);
}
HRESULT wd::dxgi_swapchain::GetCoreWindow(const IID& refiid, void** ppUnk)
{
return wrapped_interface->GetCoreWindow(refiid, ppUnk);
}
HRESULT wd::dxgi_swapchain::Present1(UINT SyncInterval, UINT PresentFlags,
const DXGI_PRESENT_PARAMETERS* pPresentParameters)
{
return wrapped_interface->Present1(SyncInterval, PresentFlags, pPresentParameters);
}
BOOL wd::dxgi_swapchain::IsTemporaryMonoSupported()
{
return wrapped_interface->IsTemporaryMonoSupported( );
}
HRESULT wd::dxgi_swapchain::GetRestrictToOutput(IDXGIOutput** ppRestrictToOutput)
{
return wrapped_interface->GetRestrictToOutput(ppRestrictToOutput);
}
HRESULT wd::dxgi_swapchain::SetBackgroundColor(const DXGI_RGBA* pColor)
{
return wrapped_interface->SetBackgroundColor(pColor);
}
HRESULT wd::dxgi_swapchain::GetBackgroundColor(DXGI_RGBA* pColor)
{
return wrapped_interface->GetBackgroundColor(pColor);
}
HRESULT wd::dxgi_swapchain::SetRotation(DXGI_MODE_ROTATION Rotation)
{
return wrapped_interface->SetRotation(Rotation);
}
HRESULT wd::dxgi_swapchain::GetRotation(DXGI_MODE_ROTATION* pRotation)
{
return wrapped_interface->GetRotation(pRotation);
}

View File

@@ -0,0 +1,148 @@
#pragma once
#include "dxgi_device.h"
namespace wdi
{
D3DINTERFACE(IDXGISwapChain, 310d36a0, d2e7, 4c0a, aa, 04, 6a, 9d, 23, b8, 88, 6a) : public IDXGIDeviceSubObject {
public:
virtual HRESULT STDMETHODCALLTYPE Present(
/* [in] */ UINT SyncInterval,
/* [in] */ UINT Flags) = 0;
virtual HRESULT STDMETHODCALLTYPE GetBuffer(
/* [in] */ UINT Buffer,
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][out][in] */
_COM_Outptr_ void** ppSurface) = 0;
virtual HRESULT STDMETHODCALLTYPE SetFullscreenState(
/* [in] */ BOOL Fullscreen,
/* [annotation][in] */
_In_opt_ IDXGIOutput* pTarget) = 0;
virtual HRESULT STDMETHODCALLTYPE GetFullscreenState(
/* [annotation][out] */
_Out_opt_ BOOL* pFullscreen,
/* [annotation][out] */
_COM_Outptr_opt_result_maybenull_ IDXGIOutput** ppTarget) = 0;
virtual HRESULT STDMETHODCALLTYPE GetDesc(
/* [annotation][out] */
_Out_ DXGI_SWAP_CHAIN_DESC* pDesc) = 0;
virtual HRESULT STDMETHODCALLTYPE ResizeBuffers(
/* [in] */ UINT BufferCount,
/* [in] */ UINT Width,
/* [in] */ UINT Height,
/* [in] */ DXGI_FORMAT NewFormat,
/* [in] */ UINT SwapChainFlags) = 0;
virtual HRESULT STDMETHODCALLTYPE ResizeTarget(
/* [annotation][in] */
_In_ const DXGI_MODE_DESC* pNewTargetParameters) = 0;
virtual HRESULT STDMETHODCALLTYPE GetContainingOutput(
/* [annotation][out] */
_COM_Outptr_ IDXGIOutput** ppOutput) = 0;
virtual HRESULT STDMETHODCALLTYPE GetFrameStatistics(
/* [annotation][out] */
_Out_ DXGI_FRAME_STATISTICS* pStats) = 0;
virtual HRESULT STDMETHODCALLTYPE GetLastPresentCount(
/* [annotation][out] */
_Out_ UINT* pLastPresentCount) = 0;
};
D3DINTERFACE(IDXGISwapChain1, 790a45f7, 0d42, 4876, 98, 3a, 0a, 55, cf, e6, f4, aa) : public IDXGISwapChain {
public:
virtual HRESULT STDMETHODCALLTYPE GetDesc1(
/* [annotation][out] */
_Out_ DXGI_SWAP_CHAIN_DESC1* pDesc) = 0;
virtual HRESULT STDMETHODCALLTYPE GetFullscreenDesc(
/* [annotation][out] */
_Out_ DXGI_SWAP_CHAIN_FULLSCREEN_DESC* pDesc) = 0;
virtual HRESULT STDMETHODCALLTYPE GetHwnd(
/* [annotation][out] */
_Out_ HWND* pHwnd) = 0;
virtual HRESULT STDMETHODCALLTYPE GetCoreWindow(
/* [annotation][in] */
_In_ REFIID refiid,
/* [annotation][out] */
_COM_Outptr_ void** ppUnk) = 0;
virtual HRESULT STDMETHODCALLTYPE Present1(
/* [in] */ UINT SyncInterval,
/* [in] */ UINT PresentFlags,
/* [annotation][in] */
_In_ const DXGI_PRESENT_PARAMETERS* pPresentParameters) = 0;
virtual BOOL STDMETHODCALLTYPE IsTemporaryMonoSupported(void) = 0;
virtual HRESULT STDMETHODCALLTYPE GetRestrictToOutput(
/* [annotation][out] */
_Out_ IDXGIOutput** ppRestrictToOutput) = 0;
virtual HRESULT STDMETHODCALLTYPE SetBackgroundColor(
/* [annotation][in] */
_In_ const DXGI_RGBA* pColor) = 0;
virtual HRESULT STDMETHODCALLTYPE GetBackgroundColor(
/* [annotation][out] */
_Out_ DXGI_RGBA* pColor) = 0;
virtual HRESULT STDMETHODCALLTYPE SetRotation(
/* [annotation][in] */
_In_ DXGI_MODE_ROTATION Rotation) = 0;
virtual HRESULT STDMETHODCALLTYPE GetRotation(
/* [annotation][out] */
_Out_ DXGI_MODE_ROTATION* pRotation) = 0;
};
}
namespace wd
{
class dxgi_swapchain : public wdi::IDXGISwapChain1
{
public:
dxgi_swapchain(::IDXGISwapChain1* swapchain) : wrapped_interface(swapchain) { wrapped_interface->AddRef( ); }
IGU_DEFINE_REF
HRESULT QueryInterface(const IID& riid, void** ppvObject) override;
HRESULT GetParent(const IID& riid, void** ppParent) override;
HRESULT GetDevice(const IID& riid, void** ppDevice) override;
HRESULT Present(UINT SyncInterval, UINT Flags) override;
HRESULT GetBuffer(UINT Buffer, const IID& riid, void** ppSurface) override;
HRESULT SetFullscreenState(BOOL Fullscreen, IDXGIOutput* pTarget) override;
HRESULT GetFullscreenState(BOOL* pFullscreen, IDXGIOutput** ppTarget) override;
HRESULT GetDesc(DXGI_SWAP_CHAIN_DESC* pDesc) override;
HRESULT ResizeBuffers(UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat,
UINT SwapChainFlags) override;
HRESULT ResizeTarget(const DXGI_MODE_DESC* pNewTargetParameters) override;
HRESULT GetContainingOutput(IDXGIOutput** ppOutput) override;
HRESULT GetFrameStatistics(DXGI_FRAME_STATISTICS* pStats) override;
HRESULT GetLastPresentCount(UINT* pLastPresentCount) override;
HRESULT GetDesc1(DXGI_SWAP_CHAIN_DESC1* pDesc) override;
HRESULT GetFullscreenDesc(DXGI_SWAP_CHAIN_FULLSCREEN_DESC* pDesc) override;
HRESULT GetHwnd(HWND* pHwnd) override;
HRESULT GetCoreWindow(const IID& refiid, void** ppUnk) override;
HRESULT Present1(UINT SyncInterval, UINT PresentFlags,
const DXGI_PRESENT_PARAMETERS* pPresentParameters) override;
BOOL IsTemporaryMonoSupported() override;
HRESULT GetRestrictToOutput(IDXGIOutput** ppRestrictToOutput) override;
HRESULT SetBackgroundColor(const DXGI_RGBA* pColor) override;
HRESULT GetBackgroundColor(DXGI_RGBA* pColor) override;
HRESULT SetRotation(DXGI_MODE_ROTATION Rotation) override;
HRESULT GetRotation(DXGI_MODE_ROTATION* pRotation) override;
::IDXGISwapChain1* wrapped_interface;
};
}

View File

@@ -1,5 +0,0 @@
#pragma once
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files
#include <windows.h>

View File

@@ -0,0 +1,2 @@
#include "graphics_unknown.h"
// TODO: see a reason for using a cpp file for this class

View File

@@ -0,0 +1,74 @@
#pragma once
#include "d3d11_x.h"
namespace wdi
{
D3DINTERFACE(IGraphicsUnknown, aceeea63, e0a9, 4a1c, bb, ec, 71, b2, f4, 85, f7, 58)
{
public:
#if !defined(DX_VERSION) || DX_VERSION >= MAKEINTVERSION(2, 18)
ULONG m_DeviceIndex : 3;
ULONG m_PrivateDataPresent : 1;
ULONG m_Reserved : 28;
#endif
#if !defined(DX_VERSION) || DX_VERSION >= MAKEINTVERSION(1, 1)
ULONG m_RefCount;
#endif
virtual HRESULT QueryInterface(REFIID riid, void** ppvObject) = 0;
virtual ULONG AddRef( ) = 0;
virtual ULONG Release( ) = 0;
};
D3DINTERFACE(IGraphicsUnwrap, bcfaae29, e1a2, 4b9a, aa, fc, 55, b9, ff, 21, fa, 54)
{
};
}
namespace wd
{
class graphics_unknown : public wdi::IGraphicsUnknown
{
public:
graphics_unknown( ) {
m_RefCount = 1;
}
ULONG AddRef( ) override
{
return InterlockedIncrement(&m_RefCount);
}
ULONG Release( ) override
{
ULONG refCount = InterlockedDecrement(&m_RefCount);
if (refCount == 0) {
delete this;
}
return refCount;
}
HRESULT QueryInterface(REFIID riid, void** ppvObject) override
{
TRACE_NOT_IMPLEMENTED("graphics_unknown");
if (ppvObject == nullptr)
{
return E_POINTER;
}
if (riid == __uuidof(wdi::IGraphicsUnknown))
{
*ppvObject = static_cast<wdi::IGraphicsUnknown*>(this);
AddRef( );
return S_OK;
}
*ppvObject = nullptr;
return E_NOINTERFACE;
}
};
}

View File

@@ -1,5 +1,5 @@
#include "pch.h"
#include "overlay.h"
#include "../../../thirdparty/imgui/imgui.h"
#include "../../../thirdparty/imgui/backends/imgui_impl_dx11.h"
#include "../../../thirdparty/imgui_impl_uwp.h"

View File

@@ -1,4 +1,6 @@
#pragma once
#include <d3d11.h>
#include <dxgi1_2.h>
namespace WinDurango
{

View File

@@ -1,5 +0,0 @@
// pch.cpp: source file corresponding to the pre-compiled header
#include "pch.h"
// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.

View File

@@ -1,10 +0,0 @@
#ifndef PCH_H
#define PCH_H
#include <intrin.h>
#include "framework.h"
#include "d3d11_x.h"
#include "dxgi.h"
#endif //PCH_H

435
dlls/d3d11_x/resource.hpp Normal file
View File

@@ -0,0 +1,435 @@
#pragma once
#include "device_child_x.h"
#include "device_context_x.h"
namespace wdi
{
D3DINTERFACE(ID3D11Resource, dc8e63f3, d12b, 4952, b4, 7b, 5e, 45, 02, 6a, 86, 2d) : public ID3D11DeviceChild {
public:
virtual void STDMETHODCALLTYPE GetType(
/* [annotation] */
_Out_ D3D11_RESOURCE_DIMENSION * pResourceDimension) PURE;
virtual void STDMETHODCALLTYPE SetEvictionPriority(
/* [annotation] */
_In_ UINT EvictionPriority) PURE;
virtual UINT STDMETHODCALLTYPE GetEvictionPriority(void) PURE;
// xbox extra function
virtual void STDMETHODCALLTYPE GetDescriptor(D3D11X_DESCRIPTOR_RESOURCE* descriptor) PURE;
};
D3DINTERFACE(ID3D11Texture1D, f8fb5c27, c6b3, 4f75, a4, c8, 43, 9a, f2, ef, 56, 4c) : public ID3D11Resource {
public:
virtual void STDMETHODCALLTYPE GetDesc(
/* [annotation] */
_Out_ D3D11_TEXTURE1D_DESC* pDesc) PURE;
};
D3DINTERFACE(ID3D11Texture2D, 6f15aaf2, d208, 4e89, 9a, b4, 48, 95, 35, d3, 4f, 9c) : public ID3D11Resource {
public:
virtual void STDMETHODCALLTYPE GetDesc(
/* [annotation] */
_Out_ D3D11_TEXTURE2D_DESC * pDesc) PURE;
};
D3DINTERFACE(ID3D11Texture3D, 037e866e, f56d, 4357, a8, af, 9d, ab, be, 6e, 25, 0e) : public ID3D11Resource {
public:
virtual void STDMETHODCALLTYPE GetDesc(
/* [annotation] */
_Out_ D3D11_TEXTURE3D_DESC* pDesc) PURE;
};
D3DINTERFACE(ID3D11Buffer, 48570b85, d1ee, 4fcd, a2, 50, eb, 35, 07, 22, b0, 37) : public ID3D11Resource {
public:
virtual void STDMETHODCALLTYPE GetDesc(
/* [annotation] */
_Out_ D3D11_BUFFER_DESC* pDesc) PURE;
};
}
// @unixian: does this even need to be wrapped? seems like the only thing it does in the pre-rewrite code is handle GetDevice
namespace wd
{
// this is only used for casting to other resources, as it's impossible to make a resource itself (has to be a texture or buffer)
class d3d11_resource : public wdi::ID3D11Resource
{
public:
void GetDevice(ID3D11Device** ppDevice) override
{
throw std::logic_error("Not implemented");
}
HRESULT GetPrivateData(const GUID& guid, UINT* pDataSize, void* pData) override
{
throw std::logic_error("Not implemented");
}
HRESULT SetPrivateData(const GUID& guid, UINT DataSize, const void* pData) override
{
throw std::logic_error("Not implemented");
}
HRESULT SetPrivateDataInterface(const GUID& guid, const IUnknown* pData) override
{
throw std::logic_error("Not implemented");
}
HRESULT SetPrivateDataInterfaceGraphics(const GUID& guid, const IGraphicsUnknown* pData) override
{
throw std::logic_error("Not implemented");
}
HRESULT SetName(LPCWSTR pName) override
{
throw std::logic_error("Not implemented");
}
void GetType(D3D11_RESOURCE_DIMENSION* pResourceDimension) override
{
throw std::logic_error("Not implemented");
}
void SetEvictionPriority(UINT EvictionPriority) override
{
throw std::logic_error("Not implemented");
}
UINT GetEvictionPriority() override
{
throw std::logic_error("Not implemented");
}
void GetDescriptor(wdi::D3D11X_DESCRIPTOR_RESOURCE* descriptor) override
{
throw std::logic_error("Not implemented");
}
::ID3D11Resource* wrapped_interface;
};
class texture_1d : public wdi::ID3D11Texture1D
{
public:
texture_1d(::ID3D11Texture1D* texture) : wrapped_interface(texture) { wrapped_interface->AddRef( ); }
IGU_DEFINE_REF
HRESULT QueryInterface(const IID& riid, void** ppvObject) override
{
if (riid == __uuidof(wdi::ID3D11Texture1D))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
TRACE_INTERFACE_NOT_HANDLED("texture_1d");
*ppvObject = nullptr;
return E_NOINTERFACE;
}
void STDMETHODCALLTYPE GetDesc(D3D11_TEXTURE1D_DESC* pDesc) override
{
wrapped_interface->GetDesc(pDesc);
}
void GetDevice(ID3D11Device** ppDevice) override
{
printf("WARN: texture_1d::GetDevice returns a PC device!!\n");
wrapped_interface->GetDevice(ppDevice);
}
HRESULT GetPrivateData(const GUID& guid, UINT* pDataSize, void* pData) override
{
return wrapped_interface->GetPrivateData(guid, pDataSize, pData);
}
HRESULT SetPrivateData(const GUID& guid, UINT DataSize, const void* pData) override
{
return wrapped_interface->SetPrivateData(guid, DataSize, pData);
}
HRESULT SetPrivateDataInterface(const GUID& guid, const IUnknown* pData) override
{
return wrapped_interface->SetPrivateDataInterface(guid, pData);
}
HRESULT SetPrivateDataInterfaceGraphics(const GUID& guid, const IGraphicsUnknown* pData) override
{
TRACE_NOT_IMPLEMENTED("texture_1d");
return E_NOTIMPL;
}
HRESULT SetName(LPCWSTR pName) override
{
TRACE_NOT_IMPLEMENTED("texture_1d");
return E_NOTIMPL;
}
void GetType(D3D11_RESOURCE_DIMENSION* pResourceDimension) override
{
wrapped_interface->GetType(pResourceDimension);
}
void SetEvictionPriority(UINT EvictionPriority) override
{
wrapped_interface->SetEvictionPriority(EvictionPriority);
}
UINT GetEvictionPriority() override
{
return wrapped_interface->GetEvictionPriority( );
}
void GetDescriptor(wdi::D3D11X_DESCRIPTOR_RESOURCE* descriptor) override
{
TRACE_NOT_IMPLEMENTED("texture_1d");
}
::ID3D11Texture1D* wrapped_interface;
};
class texture_2d : public wdi::ID3D11Texture2D
{
public:
texture_2d(::ID3D11Texture2D* texture) : wrapped_interface(texture) { wrapped_interface->AddRef( ); }
IGU_DEFINE_REF
HRESULT QueryInterface(const IID& riid, void** ppvObject) override
{
if (riid == __uuidof(wdi::ID3D11Texture2D))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
TRACE_INTERFACE_NOT_HANDLED("texture_2d");
*ppvObject = nullptr;
return E_NOINTERFACE;
}
void STDMETHODCALLTYPE GetDesc(D3D11_TEXTURE2D_DESC* pDesc) override
{
wrapped_interface->GetDesc(pDesc);
}
void GetDevice(ID3D11Device** ppDevice) override
{
printf("WARN: texture_2d::GetDevice returns a PC device!!\n");
wrapped_interface->GetDevice(ppDevice);
}
HRESULT GetPrivateData(const GUID& guid, UINT* pDataSize, void* pData) override
{
return wrapped_interface->GetPrivateData(guid, pDataSize, pData);
}
HRESULT SetPrivateData(const GUID& guid, UINT DataSize, const void* pData) override
{
return wrapped_interface->SetPrivateData(guid, DataSize, pData);
}
HRESULT SetPrivateDataInterface(const GUID& guid, const IUnknown* pData) override
{
return wrapped_interface->SetPrivateDataInterface(guid, pData);
}
HRESULT SetPrivateDataInterfaceGraphics(const GUID& guid, const IGraphicsUnknown* pData) override
{
TRACE_NOT_IMPLEMENTED("texture_2d");
return E_NOTIMPL;
}
HRESULT SetName(LPCWSTR pName) override
{
TRACE_NOT_IMPLEMENTED("texture_2d");
return E_NOTIMPL;
}
void GetType(D3D11_RESOURCE_DIMENSION* pResourceDimension) override
{
wrapped_interface->GetType(pResourceDimension);
}
void SetEvictionPriority(UINT EvictionPriority) override
{
wrapped_interface->SetEvictionPriority(EvictionPriority);
}
UINT GetEvictionPriority( ) override
{
return wrapped_interface->GetEvictionPriority( );
}
void GetDescriptor(wdi::D3D11X_DESCRIPTOR_RESOURCE* descriptor) override
{
TRACE_NOT_IMPLEMENTED("texture_2d");
}
::ID3D11Texture2D* wrapped_interface;
};
class texture_3d : public wdi::ID3D11Texture3D
{
public:
texture_3d(::ID3D11Texture3D* texture) : wrapped_interface(texture) { wrapped_interface->AddRef( ); }
IGU_DEFINE_REF
HRESULT QueryInterface(const IID& riid, void** ppvObject) override
{
if (riid == __uuidof(wdi::ID3D11Texture3D))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
TRACE_INTERFACE_NOT_HANDLED("texture_3d");
*ppvObject = nullptr;
return E_NOINTERFACE;
}
void STDMETHODCALLTYPE GetDesc(D3D11_TEXTURE3D_DESC* pDesc) override
{
wrapped_interface->GetDesc(pDesc);
}
void GetDevice(ID3D11Device** ppDevice) override
{
printf("WARN: texture_3d::GetDevice returns a PC device!!\n");
wrapped_interface->GetDevice(ppDevice);
}
HRESULT GetPrivateData(const GUID& guid, UINT* pDataSize, void* pData) override
{
return wrapped_interface->GetPrivateData(guid, pDataSize, pData);
}
HRESULT SetPrivateData(const GUID& guid, UINT DataSize, const void* pData) override
{
return wrapped_interface->SetPrivateData(guid, DataSize, pData);
}
HRESULT SetPrivateDataInterface(const GUID& guid, const IUnknown* pData) override
{
return wrapped_interface->SetPrivateDataInterface(guid, pData);
}
HRESULT SetPrivateDataInterfaceGraphics(const GUID& guid, const IGraphicsUnknown* pData) override
{
TRACE_NOT_IMPLEMENTED("texture_3d");
return E_NOTIMPL;
}
HRESULT SetName(LPCWSTR pName) override
{
TRACE_NOT_IMPLEMENTED("texture_3d");
return E_NOTIMPL;
}
void GetType(D3D11_RESOURCE_DIMENSION* pResourceDimension) override
{
wrapped_interface->GetType(pResourceDimension);
}
void SetEvictionPriority(UINT EvictionPriority) override
{
wrapped_interface->SetEvictionPriority(EvictionPriority);
}
UINT GetEvictionPriority( ) override
{
return wrapped_interface->GetEvictionPriority( );
}
void GetDescriptor(wdi::D3D11X_DESCRIPTOR_RESOURCE* descriptor) override
{
TRACE_NOT_IMPLEMENTED("texture_3d");
}
::ID3D11Texture3D* wrapped_interface;
};
class buffer : public wdi::ID3D11Buffer
{
public:
buffer(::ID3D11Buffer* buffer) : wrapped_interface(buffer) { wrapped_interface->AddRef( ); }\
IGU_DEFINE_REF
HRESULT QueryInterface(const IID& riid, void** ppvObject) override
{
if (riid == __uuidof(wdi::ID3D11Buffer))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
TRACE_INTERFACE_NOT_HANDLED("buffer");
*ppvObject = nullptr;
return E_NOINTERFACE;
}
void STDMETHODCALLTYPE GetDesc(D3D11_BUFFER_DESC* pDesc) override
{
wrapped_interface->GetDesc(pDesc);
}
void GetDevice(ID3D11Device** ppDevice) override
{
printf("WARN: buffer::GetDevice returns a PC device!!\n");
wrapped_interface->GetDevice(ppDevice);
}
HRESULT GetPrivateData(const GUID& guid, UINT* pDataSize, void* pData) override
{
return wrapped_interface->GetPrivateData(guid, pDataSize, pData);
}
HRESULT SetPrivateData(const GUID& guid, UINT DataSize, const void* pData) override
{
return wrapped_interface->SetPrivateData(guid, DataSize, pData);
}
HRESULT SetPrivateDataInterface(const GUID& guid, const IUnknown* pData) override
{
return wrapped_interface->SetPrivateDataInterface(guid, pData);
}
HRESULT SetPrivateDataInterfaceGraphics(const GUID& guid, const IGraphicsUnknown* pData) override
{
TRACE_NOT_IMPLEMENTED("buffer");
return E_NOTIMPL;
}
HRESULT SetName(LPCWSTR pName) override
{
TRACE_NOT_IMPLEMENTED("buffer");
return E_NOTIMPL;
}
void GetType(D3D11_RESOURCE_DIMENSION* pResourceDimension) override
{
wrapped_interface->GetType(pResourceDimension);
}
void SetEvictionPriority(UINT EvictionPriority) override
{
wrapped_interface->SetEvictionPriority(EvictionPriority);
}
UINT GetEvictionPriority( ) override
{
return wrapped_interface->GetEvictionPriority( );
}
void GetDescriptor(wdi::D3D11X_DESCRIPTOR_RESOURCE* descriptor) override
{
TRACE_NOT_IMPLEMENTED("buffer");
}
::ID3D11Buffer* wrapped_interface;
};
}

377
dlls/d3d11_x/view.hpp Normal file
View File

@@ -0,0 +1,377 @@
#pragma once
#include <emmintrin.h>
#include "device_child_x.h"
#include "resource.hpp"
namespace wdi
{
#define D3D11X_DESCRIPTOR_TEXTURE_VIEW_SIZE_IN_OWORDS 2
#define D3D11X_DESCRIPTOR_TEXTURE_VIEW_SIZE_IN_QWORDS 4
#define D3D11X_DESCRIPTOR_TEXTURE_VIEW_SIZE_IN_DWORDS 8
#define D3D11X_DESCRIPTOR_TEXTURE_VIEW_SIZE_IN_BYTES 32
typedef struct D3D11X_DESCRIPTOR_TEXTURE_VIEW
{
union
{
__m128i Oword[ D3D11X_DESCRIPTOR_TEXTURE_VIEW_SIZE_IN_OWORDS ];
UINT64 Qword[ D3D11X_DESCRIPTOR_TEXTURE_VIEW_SIZE_IN_QWORDS ];
UINT32 Dword[ D3D11X_DESCRIPTOR_TEXTURE_VIEW_SIZE_IN_DWORDS ];
};
} D3D11X_DESCRIPTOR_TEXTURE_VIEW;
D3DINTERFACE(ID3D11View, 839d1216, bb2e, 412b, b7, f4, a9, db, eb, e0, 8e, d1) : public ID3D11DeviceChild
{
public:
ID3D11Resource* m_pResource;
unsigned int m_Type;
virtual void STDMETHODCALLTYPE GetResource(
/* [annotation] */
_Outptr_ ID3D11Resource** ppResource) PURE;
};
D3DINTERFACE(ID3D11RenderTargetView, dfdba067, 0b8d, 4865, 87, 5b, d7, b4, 51, 6c, c1, 64) : public ID3D11View
{
public:
virtual void STDMETHODCALLTYPE GetDesc(
/* [annotation] */
_Out_ D3D11_RENDER_TARGET_VIEW_DESC* pDesc) PURE;
};
D3DINTERFACE(ID3D11DepthStencilView, 9fdac92a, 1876, 48c3, af, ad, 25, b9, 4f, 84, a9, b6) : public ID3D11View
{
public:
virtual void STDMETHODCALLTYPE GetDesc(
/* [annotation] */
_Out_ D3D11_DEPTH_STENCIL_VIEW_DESC* pDesc) PURE;
};
D3DINTERFACE(ID3D11ShaderResourceView, b0e06fe0, 8192, 4e1a, b1, ca, 36, d7, 41, 47, 10, b2) : public ID3D11View
{
public:
virtual void STDMETHODCALLTYPE GetDesc(
/* [annotation] */
_Out_ D3D11_SHADER_RESOURCE_VIEW_DESC* pDesc) PURE;
};
D3DINTERFACE(ID3D11UnorderedAccessView, 28acf509, 7f5c, 48f6, 86, 11, f3, 16, 01, 0a, 63, 80) : public ID3D11View
{
public:
D3D11X_DESCRIPTOR_TEXTURE_VIEW m_Descriptor;
void* m_pAllocationStart;
virtual void STDMETHODCALLTYPE GetDesc(
/* [annotation] */
_Out_ D3D11_UNORDERED_ACCESS_VIEW_DESC* pDesc) PURE;
};
}
namespace wd
{
class render_target_view : public wdi::ID3D11RenderTargetView
{
public:
render_target_view(::ID3D11RenderTargetView* view) : wrapped_interface(view)
{
m_pResource = reinterpret_cast<wdi::ID3D11Resource*>(wrapped_interface);
wrapped_interface->AddRef( );
}
IGU_DEFINE_REF
HRESULT QueryInterface(const IID& riid, void** ppvObject) override
{
if (riid == __uuidof(wdi::ID3D11RenderTargetView))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
TRACE_INTERFACE_NOT_HANDLED("render_target_view");
*ppvObject = nullptr;
return E_NOINTERFACE;
}
void STDMETHODCALLTYPE GetDesc(D3D11_RENDER_TARGET_VIEW_DESC* pDesc) override
{
wrapped_interface->GetDesc(pDesc);
}
void GetDevice(ID3D11Device** ppDevice) override
{
printf("WARN: render_target_view::GetDevice returns a PC device!!\n");
wrapped_interface->GetDevice(ppDevice);
}
HRESULT GetPrivateData(const GUID& guid, UINT* pDataSize, void* pData) override
{
return wrapped_interface->GetPrivateData(guid, pDataSize, pData);
}
HRESULT SetPrivateData(const GUID& guid, UINT DataSize, const void* pData) override
{
return wrapped_interface->SetPrivateData(guid, DataSize, pData);
}
HRESULT SetPrivateDataInterface(const GUID& guid, const IUnknown* pData) override
{
return wrapped_interface->SetPrivateDataInterface(guid, pData);
}
HRESULT SetPrivateDataInterfaceGraphics(const GUID& guid, const IGraphicsUnknown* pData) override
{
TRACE_NOT_IMPLEMENTED("render_target_view");
return E_NOTIMPL;
}
HRESULT SetName(LPCWSTR pName) override
{
TRACE_NOT_IMPLEMENTED("render_target_view");
return E_NOTIMPL;
}
void GetResource(wdi::ID3D11Resource** ppResource) override
{
D3D11_RENDER_TARGET_VIEW_DESC desc;
wrapped_interface->GetDesc(&desc);
// FIXME: this only targets 2D textures, but it doesn't matter since all texture* classes are the same
::ID3D11Texture2D* texture2d = nullptr;
wrapped_interface->GetResource(reinterpret_cast<::ID3D11Resource**>(&texture2d));
*reinterpret_cast<wdi::ID3D11Texture2D**>(ppResource) = new texture_2d(texture2d);
}
::ID3D11RenderTargetView* wrapped_interface;
};
class depth_stencil_view : public wdi::ID3D11DepthStencilView
{
public:
depth_stencil_view(::ID3D11DepthStencilView* view) : wrapped_interface(view)
{
m_pResource = reinterpret_cast<wdi::ID3D11Resource*>(wrapped_interface);
wrapped_interface->AddRef( );
}
IGU_DEFINE_REF
HRESULT QueryInterface(const IID& riid, void** ppvObject) override
{
if (riid == __uuidof(wdi::ID3D11DepthStencilView))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
TRACE_INTERFACE_NOT_HANDLED("depth_stencil_view");
*ppvObject = nullptr;
return E_NOINTERFACE;
}
void STDMETHODCALLTYPE GetDesc(D3D11_DEPTH_STENCIL_VIEW_DESC* pDesc) override
{
wrapped_interface->GetDesc(pDesc);
}
void GetDevice(ID3D11Device** ppDevice) override
{
printf("WARN: depth_stencil_view::GetDevice returns a PC device!!\n");
wrapped_interface->GetDevice(ppDevice);
}
HRESULT GetPrivateData(const GUID& guid, UINT* pDataSize, void* pData) override
{
return wrapped_interface->GetPrivateData(guid, pDataSize, pData);
}
HRESULT SetPrivateData(const GUID& guid, UINT DataSize, const void* pData) override
{
return wrapped_interface->SetPrivateData(guid, DataSize, pData);
}
HRESULT SetPrivateDataInterface(const GUID& guid, const IUnknown* pData) override
{
return wrapped_interface->SetPrivateDataInterface(guid, pData);
}
HRESULT SetPrivateDataInterfaceGraphics(const GUID& guid, const IGraphicsUnknown* pData) override
{
TRACE_NOT_IMPLEMENTED("depth_stencil_view");
return E_NOTIMPL;
}
HRESULT SetName(LPCWSTR pName) override
{
TRACE_NOT_IMPLEMENTED("depth_stencil_view");
return E_NOTIMPL;
}
void GetResource(wdi::ID3D11Resource** ppResource) override
{
D3D11_DEPTH_STENCIL_VIEW_DESC desc;
wrapped_interface->GetDesc(&desc);
// FIXME: this only targets 2D textures, but it doesn't matter since all texture* classes are the same
::ID3D11Texture2D* texture2d = nullptr;
wrapped_interface->GetResource(reinterpret_cast<::ID3D11Resource**>(&texture2d));
*reinterpret_cast<wdi::ID3D11Texture2D**>(ppResource) = new texture_2d(texture2d);
}
::ID3D11DepthStencilView* wrapped_interface;
};
class shader_resource_view : public wdi::ID3D11ShaderResourceView
{
public:
shader_resource_view(::ID3D11ShaderResourceView* view) : wrapped_interface(view)
{
m_pResource = reinterpret_cast<wdi::ID3D11Resource*>(wrapped_interface);
wrapped_interface->AddRef( );
}
IGU_DEFINE_REF
HRESULT QueryInterface(const IID& riid, void** ppvObject) override
{
if (riid == __uuidof(wdi::ID3D11ShaderResourceView))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
TRACE_INTERFACE_NOT_HANDLED("shader_resource_view");
*ppvObject = nullptr;
return E_NOINTERFACE;
}
void STDMETHODCALLTYPE GetDesc(D3D11_SHADER_RESOURCE_VIEW_DESC* pDesc) override
{
wrapped_interface->GetDesc(pDesc);
}
void GetDevice(ID3D11Device** ppDevice) override
{
printf("WARN: shader_resource_view::GetDevice returns a PC device!!\n");
wrapped_interface->GetDevice(ppDevice);
}
HRESULT GetPrivateData(const GUID& guid, UINT* pDataSize, void* pData) override
{
return wrapped_interface->GetPrivateData(guid, pDataSize, pData);
}
HRESULT SetPrivateData(const GUID& guid, UINT DataSize, const void* pData) override
{
return wrapped_interface->SetPrivateData(guid, DataSize, pData);
}
HRESULT SetPrivateDataInterface(const GUID& guid, const IUnknown* pData) override
{
return wrapped_interface->SetPrivateDataInterface(guid, pData);
}
HRESULT SetPrivateDataInterfaceGraphics(const GUID& guid, const IGraphicsUnknown* pData) override
{
TRACE_NOT_IMPLEMENTED("shader_resource_view");
return E_NOTIMPL;
}
HRESULT SetName(LPCWSTR pName) override
{
TRACE_NOT_IMPLEMENTED("shader_resource_view");
return E_NOTIMPL;
}
void GetResource(wdi::ID3D11Resource** ppResource) override
{
D3D11_SHADER_RESOURCE_VIEW_DESC desc;
wrapped_interface->GetDesc(&desc);
// FIXME: this only targets 2D textures, but it doesn't matter since all texture* classes are the same
::ID3D11Texture2D* texture2d = nullptr;
wrapped_interface->GetResource(reinterpret_cast<::ID3D11Resource**>(&texture2d));
*reinterpret_cast<wdi::ID3D11Texture2D**>(ppResource) = new texture_2d(texture2d);
}
::ID3D11ShaderResourceView* wrapped_interface;
};
class unordered_access_view : public wdi::ID3D11UnorderedAccessView
{
public:
unordered_access_view(::ID3D11UnorderedAccessView* view) : wrapped_interface(view)
{
m_pResource = reinterpret_cast<wdi::ID3D11Resource*>(wrapped_interface);
wrapped_interface->AddRef( );
}
IGU_DEFINE_REF
HRESULT QueryInterface(const IID& riid, void** ppvObject) override
{
if (riid == __uuidof(wdi::ID3D11UnorderedAccessView))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
TRACE_INTERFACE_NOT_HANDLED("shader_resource_view");
*ppvObject = nullptr;
return E_NOINTERFACE;
}
void STDMETHODCALLTYPE GetDesc(D3D11_UNORDERED_ACCESS_VIEW_DESC* pDesc) override
{
wrapped_interface->GetDesc(pDesc);
}
void GetDevice(ID3D11Device** ppDevice) override
{
printf("WARN: depth_stencil_view::GetDevice returns a PC device!!\n");
wrapped_interface->GetDevice(ppDevice);
}
HRESULT GetPrivateData(const GUID& guid, UINT* pDataSize, void* pData) override
{
return wrapped_interface->GetPrivateData(guid, pDataSize, pData);
}
HRESULT SetPrivateData(const GUID& guid, UINT DataSize, const void* pData) override
{
return wrapped_interface->SetPrivateData(guid, DataSize, pData);
}
HRESULT SetPrivateDataInterface(const GUID& guid, const IUnknown* pData) override
{
return wrapped_interface->SetPrivateDataInterface(guid, pData);
}
HRESULT SetPrivateDataInterfaceGraphics(const GUID& guid, const IGraphicsUnknown* pData) override
{
TRACE_NOT_IMPLEMENTED("shader_resource_view");
return E_NOTIMPL;
}
HRESULT SetName(LPCWSTR pName) override
{
TRACE_NOT_IMPLEMENTED("shader_resource_view");
return E_NOTIMPL;
}
void GetResource(wdi::ID3D11Resource** ppResource) override
{
D3D11_UNORDERED_ACCESS_VIEW_DESC desc;
wrapped_interface->GetDesc(&desc);
// FIXME: this only targets 2D textures, but it doesn't matter since all texture* classes are the same
::ID3D11Texture2D* texture2d = nullptr;
wrapped_interface->GetResource(reinterpret_cast<::ID3D11Resource**>(&texture2d));
*reinterpret_cast<wdi::ID3D11Texture2D**>(ppResource) = new texture_2d(texture2d);
}
::ID3D11UnorderedAccessView* wrapped_interface;
};
}

View File

@@ -69,6 +69,7 @@
<PrecompiledHeader>Create</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -87,6 +88,7 @@
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>

View File

@@ -116,19 +116,22 @@ HRESULT CoreApplicationWrapperX::QueryInterface(const IID& riid, void** ppvObjec
AddRef();
return S_OK;
}
else if (riid == __uuidof(ICoreApplicationX))
if (riid == __uuidof(ICoreApplicationX))
{
*ppvObject = static_cast<ICoreApplicationX*>(this);
AddRef();
return S_OK;
}
else if (riid == __uuidof(ICoreApplicationResourceAvailabilityX)) // allow ICoreApplicationResourceAvailabilityX interface
if (riid == __uuidof(ICoreApplicationResourceAvailabilityX)) // allow ICoreApplicationResourceAvailabilityX interface
{
*ppvObject = static_cast<ICoreApplicationResourceAvailabilityX*>(this);
AddRef();
return S_OK;
}
else if (riid == __uuidof(ICoreApplicationGpuPolicy)) // allow ICoreApplicationResourceAvailabilityX interface
if (riid == __uuidof(ICoreApplicationGpuPolicy)) // allow ICoreApplicationResourceAvailabilityX interface
{
*ppvObject = static_cast<ICoreApplicationGpuPolicy*>(this);
AddRef();

View File

@@ -478,7 +478,7 @@ EXPORTS
UnregisterTraceGuids = Kernel32.UnregisterTraceGuids @471
UnregisterWaitEx = Kernel32.UnregisterWaitEx @472
UpdateProcThreadAttribute = Kernel32.UpdateProcThreadAttribute @473
VirtualAlloc = Kernel32.VirtualAlloc @474
VirtualAlloc = VirtualAlloc_X @474
VirtualAllocEx = Kernel32.VirtualAllocEx @475
VirtualFree = Kernel32.VirtualFree @476
VirtualFreeEx = Kernel32.VirtualFreeEx @477

View File

@@ -5,16 +5,12 @@
#include <Windows.h>
// note from unixian: i used this since using appxlauncher requires me attaching to the game after it launches
#define WINDURANGO_WAIT_FOR_DEBUGGER 0
#define WINDURANGO_WAIT_FOR_DEBUGGER 1
//Rodrigo Todescatto: For debbuging Forza.
#define RETURN_IF_FAILED(hr) if (FAILED(hr)) return hr
#define FORZADEBUG
#define RETURN_HR(hr) return hr
#define RETURN_LAST_ERROR_IF(cond) if (cond) return HRESULT_FROM_WIN32(GetLastError())
std::vector<HMODULE> loadedMods;
inline void LoadMods()
@@ -73,89 +69,6 @@ inline void UnLoadMods()
FreeLibrary(mod);
}
}
inline HRESULT WINAPI GetActivationFactoryRedirect(PCWSTR str, REFIID riid, void** ppFactory)
{
HRESULT hr;
HSTRING className;
HSTRING_HEADER classNameHeader;
if (FAILED(hr = WindowsCreateStringReference(str, wcslen(str), &classNameHeader, &className)))
return hr;
//printf("GetActivationFactoryRedirect: %S\n", str);
hr = RoGetActivationFactory_Hook(className, riid, ppFactory);
WindowsDeleteString(className);
return hr;
}
HRESULT XWineGetImport(_In_opt_ HMODULE Module, _In_ HMODULE ImportModule, _In_ LPCSTR Import, _Out_ PIMAGE_THUNK_DATA * pThunk)
{
if (ImportModule == nullptr)
RETURN_HR(E_INVALIDARG);
if (pThunk == nullptr)
RETURN_HR(E_POINTER);
if (Module == nullptr)
Module = GetModuleHandleW(nullptr);
auto dosHeader = (PIMAGE_DOS_HEADER)Module;
auto ntHeaders = (PIMAGE_NT_HEADERS)((PBYTE)Module + dosHeader->e_lfanew);
auto directory = &ntHeaders->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT];
auto peImports = (PIMAGE_IMPORT_DESCRIPTOR)((PBYTE)Module + directory->VirtualAddress);
for (size_t i = 0; peImports[i].Name; i++)
{
if (GetModuleHandleA((LPCSTR)((PBYTE)Module + peImports[i].Name)) != ImportModule)
continue;
auto iatThunks = (PIMAGE_THUNK_DATA)((PBYTE)Module + peImports[i].FirstThunk);
auto intThunks = (PIMAGE_THUNK_DATA)((PBYTE)Module + peImports[i].OriginalFirstThunk);
for (size_t j = 0; intThunks[j].u1.AddressOfData; j++)
{
if ((intThunks[j].u1.AddressOfData & IMAGE_ORDINAL_FLAG) != 0)
{
if (!IS_INTRESOURCE(Import))
continue;
if (((intThunks[j].u1.Ordinal & ~IMAGE_ORDINAL_FLAG) == (ULONG_PTR)Import))
{
*pThunk = &iatThunks[j];
return S_OK;
}
continue;
}
if (strcmp(((PIMAGE_IMPORT_BY_NAME)((PBYTE)Module + intThunks[j].u1.AddressOfData))->Name, Import))
continue;
*pThunk = &iatThunks[j];
return S_OK;
}
}
*pThunk = nullptr;
return (E_FAIL);
}
HRESULT XWinePatchImport(_In_opt_ HMODULE Module, _In_ HMODULE ImportModule, _In_ PCSTR Import, _In_ PVOID Function)
{
DWORD protect;
PIMAGE_THUNK_DATA pThunk;
RETURN_IF_FAILED(XWineGetImport(Module, ImportModule, Import, &pThunk));
RETURN_LAST_ERROR_IF(!VirtualProtect(&pThunk->u1.Function, sizeof(ULONG_PTR), PAGE_READWRITE, &protect));
pThunk->u1.Function = (ULONG_PTR)Function;
RETURN_LAST_ERROR_IF(!VirtualProtect(&pThunk->u1.Function, sizeof(ULONG_PTR), protect, &protect));
return S_OK;
}
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID reserved)
{
winrt::hstring GamePackage = winrt::Windows::ApplicationModel::Package::Current().Id().FamilyName();
@@ -227,18 +140,8 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID reserved)
// games uses different vccorlib versions so just HardCoding vccorlib140 won't work
// so we can just check if any of corlib modules are loaded and use that
// (add more of them as we find in games)
std::array<const wchar_t*, 3> modules = { L"vccorlib140.dll", L"vccorlib110.dll", L"vccorlib120.dll" };
HMODULE hModule = nullptr;
for (auto& module : modules)
{
hModule = GetModuleHandleW(module);
if (hModule != nullptr)
{
break;
}
}
XWinePatchImport(GetModuleHandleW(nullptr), hModule, "?GetActivationFactoryByPCWSTR@@YAJPEAXAEAVGuid@Platform@@PEAPEAX@Z", GetActivationFactoryRedirect);
XWinePatchImport(GetModuleHandleW(nullptr), GetRuntimeModule(), "?GetActivationFactoryByPCWSTR@@YAJPEAXAEAVGuid@Platform@@PEAPEAX@Z", GetActivationFactoryRedirect);
DetourAttach(&reinterpret_cast<PVOID&>(TrueOpenFile), OpenFile_Hook);
DetourAttach(&reinterpret_cast<PVOID&>(TrueCreateFileW), CreateFileW_Hook);
@@ -247,6 +150,8 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID reserved)
DetourAttach(&reinterpret_cast<PVOID&>(TrueFindFirstFileW), FindFirstFileW_Hook);
DetourAttach(&reinterpret_cast<PVOID&>(TrueDeleteFileW), DeleteFileW_Hook);
//DetourAttach(&reinterpret_cast<PVOID&>(TrueLoadLibraryExW), LoadLibraryExW_Hook);
DetourAttach(&reinterpret_cast<PVOID&>(TrueLoadLibraryW), LoadLibraryW_Hook);
DetourAttach(&reinterpret_cast<PVOID&>(TrueLoadLibraryExA), LoadLibraryExA_Hook);
DetourTransactionCommit();

View File

@@ -7,6 +7,9 @@
#include "CurrentAppWrapper.hpp"
#define RETURN_HR(hr) return hr
#define RETURN_LAST_ERROR_IF(cond) if (cond) return HRESULT_FROM_WIN32(GetLastError())
/* This function is used to compare the class name of the classId with the classIdName. */
inline bool IsClassName(HSTRING classId, const char* classIdName)
{
@@ -17,6 +20,28 @@ inline bool IsClassName(HSTRING classId, const char* classIdName)
return (classIdStringUTF8 == classIdName);
}
HMODULE GetRuntimeModule()
{
std::array<const wchar_t*, 3> modules = { L"vccorlib140.dll", L"vccorlib110.dll", L"vccorlib120.dll" };
static HMODULE hModule = nullptr;
if (hModule != nullptr)
{
return hModule;
}
for (auto& module : modules)
{
hModule = GetModuleHandleW(module);
if (hModule != nullptr)
{
break;
}
}
return hModule;
}
HRESULT WINAPI GetActivationFactoryRedirect(PCWSTR str, REFIID riid, void** ppFactory);
/* Function pointers for the DllGetForCurrentThread */
typedef HRESULT(*DllGetForCurrentThreadFunc) (ICoreWindowStatic*, CoreWindow**);
/* Function pointers for the DllGetForCurrentThread */
@@ -27,6 +52,7 @@ HRESULT(STDMETHODCALLTYPE* TrueGetForCurrentThread)(ICoreWindowStatic* staticWin
typedef HRESULT(*DllGetActivationFactoryFunc) (HSTRING, IActivationFactory**);
/* Function pointers for the DllGetActivationFactory */
DllGetActivationFactoryFunc pDllGetActivationFactory = nullptr;
DllGetActivationFactoryFunc pMediaDllGetActivationFactory = nullptr;
/* Function pointers for the WinRT RoGetActivationFactory function. */
HRESULT(WINAPI* TrueRoGetActivationFactory)(HSTRING classId, REFIID iid, void** factory) = RoGetActivationFactory;
@@ -53,6 +79,81 @@ HRESULT(STDMETHODCALLTYPE* TrueGetLicenseInformation)(
ABI::Windows::ApplicationModel::Store::ILicenseInformation** value
) = nullptr;
HRESULT XWineGetImport(_In_opt_ HMODULE Module, _In_ HMODULE ImportModule, _In_ LPCSTR Import, _Out_ PIMAGE_THUNK_DATA* pThunk)
{
if (ImportModule == nullptr)
RETURN_HR(E_INVALIDARG);
if (pThunk == nullptr)
RETURN_HR(E_POINTER);
if (Module == nullptr)
Module = GetModuleHandleW(nullptr);
auto dosHeader = (PIMAGE_DOS_HEADER)Module;
auto ntHeaders = (PIMAGE_NT_HEADERS)((PBYTE)Module + dosHeader->e_lfanew);
auto directory = &ntHeaders->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT];
if (directory->VirtualAddress == 0)
RETURN_HR(E_FAIL);
auto peImports = (PIMAGE_IMPORT_DESCRIPTOR)((PBYTE)Module + directory->VirtualAddress);
for (size_t i = 0; peImports[i].Name; i++)
{
if (GetModuleHandleA((LPCSTR)((PBYTE)Module + peImports[i].Name)) != ImportModule)
continue;
auto iatThunks = (PIMAGE_THUNK_DATA)((PBYTE)Module + peImports[i].FirstThunk);
auto intThunks = (PIMAGE_THUNK_DATA)((PBYTE)Module + peImports[i].OriginalFirstThunk);
for (size_t j = 0; intThunks[j].u1.AddressOfData; j++)
{
if ((intThunks[j].u1.AddressOfData & IMAGE_ORDINAL_FLAG) != 0)
{
if (!IS_INTRESOURCE(Import))
continue;
if (((intThunks[j].u1.Ordinal & ~IMAGE_ORDINAL_FLAG) == (ULONG_PTR)Import))
{
*pThunk = &iatThunks[j];
return S_OK;
}
continue;
}
if (strcmp(((PIMAGE_IMPORT_BY_NAME)((PBYTE)Module + intThunks[j].u1.AddressOfData))->Name, Import))
continue;
*pThunk = &iatThunks[j];
return S_OK;
}
}
*pThunk = nullptr;
return (E_FAIL);
}
HRESULT XWinePatchImport(_In_opt_ HMODULE Module, _In_ HMODULE ImportModule, _In_ PCSTR Import, _In_ PVOID Function)
{
DWORD protect;
PIMAGE_THUNK_DATA pThunk;
RETURN_IF_FAILED(XWineGetImport(Module, ImportModule, Import, &pThunk));
RETURN_LAST_ERROR_IF(!VirtualProtect(&pThunk->u1.Function, sizeof(ULONG_PTR), PAGE_READWRITE, &protect));
pThunk->u1.Function = (ULONG_PTR)Function;
RETURN_LAST_ERROR_IF(!VirtualProtect(&pThunk->u1.Function, sizeof(ULONG_PTR), protect, &protect));
return S_OK;
}
HRESULT PatchNeededImports(_In_opt_ HMODULE Module, _In_ HMODULE ImportModule, _In_ PCSTR Import, _In_ PVOID Function)
{
PIMAGE_THUNK_DATA pThunk;
RETURN_IF_FAILED(XWineGetImport(Module, ImportModule, Import, &pThunk));
return XWinePatchImport(Module, ImportModule, Import, Function);
}
HMODULE WINAPI LoadLibraryExW_X(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
{
printf("LoadLibraryExW_X: %S\n", lpLibFileName);
@@ -85,8 +186,9 @@ HMODULE WINAPI LoadLibraryExW_X(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dw
}
}
return LoadLibraryExW(lpLibFileName, hFile, dwFlags);
HMODULE mod = LoadLibraryExW(lpLibFileName, hFile, dwFlags);
PatchNeededImports(mod, GetRuntimeModule(), "?GetActivationFactoryByPCWSTR@@YAJPEAXAEAVGuid@Platform@@PEAPEAX@Z", GetActivationFactoryRedirect);
return mod;
}
@@ -146,6 +248,8 @@ HMODULE WINAPI LoadLibraryExA_Hook(LPCSTR lpLibFileName, _Reserved_ HANDLE hFile
{
printf("LoadLibraryExA_Hook failed: %d\n", GetLastError());
}
PatchNeededImports(result, GetRuntimeModule(), "?GetActivationFactoryByPCWSTR@@YAJPEAXAEAVGuid@Platform@@PEAPEAX@Z", GetActivationFactoryRedirect);
return result;
}
@@ -169,7 +273,9 @@ HMODULE WINAPI LoadLibraryW_Hook(LPCWSTR lpLibFileName)
}
//printf("LoadLibraryW_Hook: %ls\n", lpLibFileName);
return TrueLoadLibraryW(lpLibFileName);
HMODULE result = TrueLoadLibraryW(lpLibFileName);
PatchNeededImports(result, GetRuntimeModule(), "?GetActivationFactoryByPCWSTR@@YAJPEAXAEAVGuid@Platform@@PEAPEAX@Z", GetActivationFactoryRedirect);
return result;
}
HFILE WINAPI OpenFile_Hook(LPCSTR lpFileName, LPOFSTRUCT lpReOpenBuff, UINT uStyle)
{
@@ -276,69 +382,85 @@ inline HRESULT WINAPI RoGetActivationFactory_Hook(HSTRING classId, REFIID iid, v
DetourTransactionCommit();
}
if (IsClassName(classId, "Windows.ApplicationModel.Core.CoreApplication"))
{
ComPtr<IActivationFactory> realFactory;
if (IsClassName(classId, "Windows.ApplicationModel.Core.CoreApplication"))
{
ComPtr<IActivationFactory> realFactory;
hr = TrueRoGetActivationFactory(HStringReference(RuntimeClass_Windows_ApplicationModel_Core_CoreApplication).Get(), IID_PPV_ARGS(&realFactory));
hr = TrueRoGetActivationFactory(HStringReference(RuntimeClass_Windows_ApplicationModel_Core_CoreApplication).Get(), IID_PPV_ARGS(&realFactory));
if (FAILED(hr))
return hr;
if (FAILED(hr))
return hr;
ComPtr<CoreApplicationWrapperX> wrappedFactory = Make<CoreApplicationWrapperX>(realFactory);
ComPtr<CoreApplicationWrapperX> wrappedFactory = Make<CoreApplicationWrapperX>(realFactory);
return wrappedFactory.CopyTo(iid, factory);
return wrappedFactory.CopyTo(iid, factory);
}
if (IsClassName(classId, "Windows.UI.Core.CoreWindow"))
{
//
// for now we just hook GetForCurrentThread to get the CoreWindow but i'll change it later to
// wrap ICoreWindowStatic or as zombie said another thing that works is by hooking IFrameworkView::SetWindow
// but for now this *should* work just fine -AleBlbl
//
ComPtr<ICoreWindowStatic> coreWindowStatic;
hr = TrueRoGetActivationFactory(HStringReference(RuntimeClass_Windows_UI_Core_CoreWindow).Get(), IID_PPV_ARGS(&coreWindowStatic));
if (FAILED(hr)) {
return hr;
}
if (IsClassName(classId, "Windows.UI.Core.CoreWindow"))
if (!TrueGetForCurrentThread)
{
//
// for now we just hook GetForCurrentThread to get the CoreWindow but i'll change it later to
// wrap ICoreWindowStatic or as zombie said another thing that works is by hooking IFrameworkView::SetWindow
// but for now this *should* work just fine -AleBlbl
//
ComPtr<ICoreWindowStatic> coreWindowStatic;
hr = TrueRoGetActivationFactory(HStringReference(RuntimeClass_Windows_UI_Core_CoreWindow).Get(), IID_PPV_ARGS(&coreWindowStatic));
if (FAILED(hr)) {
return hr;
}
*reinterpret_cast<void**>(&TrueGetForCurrentThread) = (*reinterpret_cast<void***>(coreWindowStatic.Get()))[6];
if (!TrueGetForCurrentThread)
{
*reinterpret_cast<void**>(&TrueGetForCurrentThread) = (*reinterpret_cast<void***>(coreWindowStatic.Get()))[6];
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach(&TrueGetForCurrentThread, GetForCurrentThread_Hook);
DetourTransactionCommit();
}
return coreWindowStatic.CopyTo(iid, factory);
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach(&TrueGetForCurrentThread, GetForCurrentThread_Hook);
DetourTransactionCommit();
}
// After WinDurango overrides try to load the rest
return coreWindowStatic.CopyTo(iid, factory);
}
// After WinDurango overrides try to load the rest
if (!pDllGetActivationFactory)
{
auto library = LoadPackagedLibrary(L"winrt_x.dll", 0);
if (!library) library = LoadLibraryW(L"winrt_x.dll");
if (!library) return hr;
pDllGetActivationFactory = reinterpret_cast<DllGetActivationFactoryFunc>
(GetProcAddress(library, "DllGetActivationFactory"));
if (!pDllGetActivationFactory)
{
auto library = LoadPackagedLibrary(L"winrt_x.dll", 0);
return hr;
}
if (!library) library = LoadLibraryW(L"winrt_x.dll");
// fallback
ComPtr<IActivationFactory> fallbackFactory;
hr = pDllGetActivationFactory(classId, fallbackFactory.GetAddressOf());
if (!library) return hr;
pDllGetActivationFactory = reinterpret_cast<DllGetActivationFactoryFunc>
(GetProcAddress(library, "DllGetActivationFactory"));
if (!pDllGetActivationFactory)
return hr;
}
// fallback
ComPtr<IActivationFactory> fallbackFactory;
hr = pDllGetActivationFactory(classId, fallbackFactory.GetAddressOf());
if (SUCCEEDED(hr))
return fallbackFactory.CopyTo(iid, factory);
if (SUCCEEDED(hr))
return fallbackFactory.CopyTo(iid, factory);
return TrueRoGetActivationFactory(classId, iid, factory);
}
HRESULT WINAPI GetActivationFactoryRedirect(PCWSTR str, REFIID riid, void** ppFactory)
{
HRESULT hr;
HSTRING className;
HSTRING_HEADER classNameHeader;
if (FAILED(hr = WindowsCreateStringReference(str, wcslen(str), &classNameHeader, &className)))
return hr;
//printf("GetActivationFactoryRedirect: %S\n", str);
hr = RoGetActivationFactory_Hook(className, riid, ppFactory);
WindowsDeleteString(className);
return hr;
}

View File

@@ -297,6 +297,10 @@ static decltype(&XMemFree_X) XMemFreeRoutine_X;
void XMemSetAllocationHooks_X(decltype(&XMemAlloc_X) Alloc, decltype(&XMemFree_X) Free)
{
if (XMemSetAllocationHooksLock_X.OwningThread == 0) {
InitializeCriticalSection(&XMemSetAllocationHooksLock_X);
}
EnterCriticalSection(&XMemSetAllocationHooksLock_X);
if (Alloc) {
@@ -311,219 +315,30 @@ void XMemSetAllocationHooks_X(decltype(&XMemAlloc_X) Alloc, decltype(&XMemFree_X
LeaveCriticalSection(&XMemSetAllocationHooksLock_X);
}
// TODO
// absolutely temporary implementation I just want to make it work
// sub_18001BCA0
char* TblPtrs;
HANDLE hExtendedLocaleKey;
HANDLE hCustomLocaleKey;
HANDLE hLangGroupsKey;
HANDLE hAltSortsKey;
HANDLE hLocaleKey;
HANDLE hCodePageKey;
HANDLE gpACPHashN;
char* dword_18002B84C;
LPVOID P; // ?!?! ?
LPVOID P_0; // <20>!<21> <20>!?!??
//sub_18001BB8C
int IsNlsProcessInitialized;
#define PROTECT_FLAGS_MASK (PAGE_EXECUTE | PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY | PAGE_NOACCESS | PAGE_READONLY | PAGE_READWRITE | PAGE_WRITECOPY | PAGE_GUARD | PAGE_NOCACHE)
#define ALLOCATION_FLAGS_MASK (MEM_COMMIT | MEM_RESERVE | MEM_RESET | MEM_LARGE_PAGES | MEM_PHYSICAL | MEM_TOP_DOWN | MEM_WRITE_WATCH)
int sub_18001D528()
LPVOID VirtualAlloc_X(
LPVOID lpAddress,
SIZE_T dwSize,
DWORD flAllocationType,
DWORD flProtect
)
{
//TODO
return 0;
flProtect &= PROTECT_FLAGS_MASK;
flAllocationType &= ALLOCATION_FLAGS_MASK;
LPVOID ret = VirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect);
// backup plan in the case that VirtualAlloc fails despite the flags being masked away
if (ret == nullptr)
{
printf("VirtualAlloc failed with %i, using backup...\n", GetLastError());
ret = VirtualAlloc(lpAddress, dwSize, MEM_COMMIT, flProtect);
}
assert(ret != nullptr && "VirtualAlloc should not fail, check proper handling of xbox-one specific memory protection constants.");
return ret;
}
INT16 sub_18001D768()
{
//TODO
return 0;
}
int sub_18001D96C(int v2, unsigned short* codePageData, unsigned int p, bool t, long l)
{
//TODO
return 0;
}
__int64 sub_18001BB8C()
{
// I know it should look better if it was initalized at dllmain.cpp but then I can't fix some idiotic errors
HMODULE ntdll = LoadLibraryA("ntdll.dll");
if (ntdll) {
NtAllocateVirtualMemory =
(NtAllocateVirtualMemory_t)GetProcAddress(ntdll, "NtAllocateVirtualMemory");
NtFreeVirtualMemory =
(NtFreeVirtualMemory_t)GetProcAddress(ntdll, "NtFreeVirtualMemory");
FreeLibrary(ntdll);
}
/*unsigned int v0; // ebx
unsigned __int16* AnsiCodePageData; // rdx
int v2; // ecx
PVOID v3; // rbx
HMODULE v4; // rcx
v0 = 0;
if (!dword_18002B84C)
{
v0 = sub_18001D528();
if (!v0)
{
v0 = sub_18001D768();
if (!v0)
{
// not sure
AnsiCodePageData = (unsigned __int16*)NtCurrentTeb()->ProcessEnvironmentBlock->ProcessParameters;
v2 = AnsiCodePageData[1];
dword_18002BF68 = v2;
v0 = sub_18001D96C(v2, AnsiCodePageData, (unsigned int)&P, 0, 0LL);
if (!v0)
{
RtlAcquireSRWLockExclusive(&unk_18002B838);
qword_18002B828 = sub_18001EB38(127LL);
if (qword_18002B828)
{
RtlReleaseSRWLockExclusive(&unk_18002B838);
qword_18002B990 = 0LL;
qword_18002B980 = 0LL;
word_18002BF64 = 1;
Event = 0LL;
dword_18002B84C = 1;
}
else
{
RtlReleaseSRWLockExclusive(&unk_18002B838);
v3 = gpACPHashN;
v4 = (HMODULE) * ((_QWORD*)gpACPHashN + 8);
if (v4)
FreeLibrary(v4);
RtlFreeHeap(NtCurrentPeb()->ProcessHeap, 0, v3);
gpACPHashN = 0LL;
return 87;
}
}
}
}
}
return v0;*/
return 0;
}
// absolutely temporary implementation I just want to make it work
// decompilation from ghidra (it looks horrible lol)
NTSTATUS NlsProcessDestroy(HINSTANCE hInstance, DWORD forwardReason, LPVOID lpvReserved)
{
char* v0; // rax
__int64 v1; // rdi
__int64 v2; // rsi
char* v3; // rbx
HMODULE v4; // rcx
char* v5; // rbp
char* v6; // rax
__int64 v7; // rdi
__int64 v8; // rsi
char* v9; // r8
char* v10; // rbx
PVOID v11; // rbx
HMODULE v12; // rcx
NTSTATUS result; // al
v0 = (char*)TblPtrs;
if (TblPtrs)
{
v1 = 0LL;
v2 = 197LL;
do
{
v3 = *(char**)&v0[v1];
if (v3)
{
do
{
v4 = (HMODULE)v3[8];
v5 = (char*)v3[9];
if (v4)
FreeLibrary(v4);
HeapFree(GetProcessHeap(), 0, v3);
v3 = v5;
} while (v5);
v0 = (char*)TblPtrs;
}
v1 += 8LL;
--v2;
} while (v2);
if (v0)
HeapFree(GetProcessHeap(), 0, TblPtrs);
TblPtrs = 0LL;
}
v6 = (char*)P;
v7 = 0LL;
v8 = 128LL;
do
{
v9 = *(char**)&v6[v7];
if (v9)
{
do
{
v10 = (char*)v9[10];
HeapFree(GetProcessHeap(), 0, v9);
v9 = v10;
} while (v10);
v6 = (char*)P;
}
v7 += 8LL;
--v8;
} while (v8);
if (v6)
HeapFree(GetProcessHeap(), 0, P);
P = 0LL;
if (P_0)
HeapFree(GetProcessHeap(), 0, P_0);
v11 = gpACPHashN;
P_0 = 0LL;
v12 = (HMODULE) * ((char*)gpACPHashN + 8);
if (v12)
FreeLibrary(v12);
result = HeapFree(GetProcessHeap(), 0, v11);
gpACPHashN = 0LL;
if (hCodePageKey)
{
result = NtClose(hCodePageKey);
hCodePageKey = 0LL;
}
if (hLocaleKey)
{
result = NtClose(hLocaleKey);
hLocaleKey = 0LL;
}
if (hAltSortsKey)
{
result = NtClose(hAltSortsKey);
hAltSortsKey = 0LL;
}
if (hLangGroupsKey)
{
result = NtClose(hLangGroupsKey);
hLangGroupsKey = 0LL;
}
if (hCustomLocaleKey)
{
result = NtClose(hCustomLocaleKey);
hCustomLocaleKey = 0LL;
}
if (hExtendedLocaleKey)
{
result = NtClose(hExtendedLocaleKey);
hExtendedLocaleKey = 0LL;
}
IsNlsProcessInitialized = 0;
return result;
}

View File

@@ -63,6 +63,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -82,6 +83,7 @@
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>

View File

@@ -1,8 +1,9 @@
#pragma once
#include <Windows.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <filesystem>
#include <shlwapi.h>
#include <Shlwapi.h>
#define FAILED(hr) (((HRESULT)(hr)) < 0)
#define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0)

View File

@@ -1,12 +0,0 @@
LIBRARY mfplat
EXPORTS
MFCreateDxvaSampleRendererX = MFCreateDxvaSampleRendererX_X @34
MFResetDXGIDeviceManagerX = MFResetDXGIDeviceManagerX_X @117
MFCreateDXGIDeviceManager = MFCreateDXGIDeviceManager_X @32
MFCreateAttributes = MFCreateAttributes_X @29
MFCreateMediaType = MFCreateMediaType_X @45
MFStartup = MFStartup_X @125
MFShutdown = MFShutdown_X @126
MFCreateNV12ToRGB32ConverterX = MFCreateNV12ToRGB32ConverterX_X @128
MFCreateWaveFormatExFromMFMediaType = MFCreateWaveFormatExFromMFMediaType_X @129
MFInitMediaTypeFromWaveFormatEx = MFInitMediaTypeFromWaveFormatEx_X @130

View File

@@ -1,22 +1,460 @@
#include "pch.h"
#include <windows.h>
#include <Windows.h>
#include <mfapi.h>
// note from unixian: this proxy dll situation is temporary, but we need to use the actual functions from mfplat.dll while we're also named mfplat
#pragma region Proxy
struct mfplat_dll {
HMODULE dll;
FARPROC oCopyPropVariant;
FARPROC oCreatePropVariant;
FARPROC oCreatePropertyStore;
FARPROC oDestroyPropVariant;
FARPROC oGetAMSubtypeFromD3DFormat;
FARPROC oGetD3DFormatFromMFSubtype;
FARPROC oLFGetGlobalPool;
FARPROC oMFAddPeriodicCallback;
FARPROC oMFAllocateSerialWorkQueue;
FARPROC oMFAllocateWorkQueue;
FARPROC oMFAllocateWorkQueueEx;
FARPROC oMFAppendCollection;
FARPROC oMFAverageTimePerFrameToFrameRate;
FARPROC oMFBeginCreateFile;
FARPROC oMFBlockThread;
FARPROC oMFCalculateBitmapImageSize;
FARPROC oMFCalculateImageSize;
FARPROC oMFCancelCreateFile;
FARPROC oMFCancelWorkItem;
FARPROC oMFConvertColorInfoFromDXVA;
FARPROC oMFConvertColorInfoToDXVA;
FARPROC oMFConvertFromFP16Array;
FARPROC oMFConvertToFP16Array;
FARPROC oMFCopyImage;
FARPROC oMFCreate2DMediaBuffer;
FARPROC oMFCreateAMMediaTypeFromMFMediaType;
FARPROC oMFCreateAlignedMemoryBuffer;
FARPROC oMFCreateAsyncResult;
FARPROC oMFCreateAttributes;
FARPROC oMFCreateAudioMediaType;
FARPROC oMFCreateCollection;
FARPROC oMFCreateDXGIDeviceManager;
FARPROC oMFCreateDXGISurfaceBufferX;
FARPROC oMFCreateDxvaSampleRendererX;
FARPROC oMFCreateEventQueue;
FARPROC oMFCreateFile;
FARPROC oMFCreateFileFromHandle;
FARPROC oMFCreateLegacyMediaBufferOnMFMediaBuffer;
FARPROC oMFCreateMFByteStreamOnStream;
FARPROC oMFCreateMFVideoFormatFromMFMediaType;
FARPROC oMFCreateMediaBufferFromMediaType;
FARPROC oMFCreateMediaBufferWrapper;
FARPROC oMFCreateMediaEvent;
FARPROC oMFCreateMediaEventResult;
FARPROC oMFCreateMediaType;
FARPROC oMFCreateMediaTypeFromRepresentation;
FARPROC oMFCreateMemoryBuffer;
FARPROC oMFCreateMemoryStream;
FARPROC oMFCreateNV12ToRGB32ConverterX;
FARPROC oMFCreatePathFromURL;
FARPROC oMFCreatePresentationDescriptor;
FARPROC oMFCreateRGB32ToNV12ConverterX;
FARPROC oMFCreateSample;
FARPROC oMFCreateSourceResolver;
FARPROC oMFCreateSourceResolverInternal;
FARPROC oMFCreateStreamDescriptor;
FARPROC oMFCreateSystemTimeSource;
FARPROC oMFCreateTempFile;
FARPROC oMFCreateTrackedSample;
FARPROC oMFCreateURLFromPath;
FARPROC oMFCreateVideoMediaType;
FARPROC oMFCreateVideoMediaTypeFromBitMapInfoHeader;
FARPROC oMFCreateVideoMediaTypeFromBitMapInfoHeaderEx;
FARPROC oMFCreateVideoMediaTypeFromSubtype;
FARPROC oMFCreateVideoMediaTypeFromVideoInfoHeader;
FARPROC oMFCreateVideoMediaTypeFromVideoInfoHeader2;
FARPROC oMFCreateVideoSampleAllocatorEx;
FARPROC oMFCreateWaveFormatExFromMFMediaType;
FARPROC oMFDeserializeAttributesFromStream;
FARPROC oMFDeserializeEvent;
FARPROC oMFDeserializeMediaTypeFromStream;
FARPROC oMFDeserializePresentationDescriptor;
FARPROC oMFEndCreateFile;
FARPROC oMFFrameRateToAverageTimePerFrame;
FARPROC oMFGetAttributesAsBlob;
FARPROC oMFGetAttributesAsBlobSize;
FARPROC oMFGetConfigurationDWORD;
FARPROC oMFGetConfigurationPolicy;
FARPROC oMFGetConfigurationStore;
FARPROC oMFGetConfigurationString;
FARPROC oMFGetPlaneSize;
FARPROC oMFGetPlatform;
FARPROC oMFGetPrivateWorkqueues;
FARPROC oMFGetStrideForBitmapInfoHeader;
FARPROC oMFGetSupportedMimeTypes;
FARPROC oMFGetSupportedSchemes;
FARPROC oMFGetSystemTime;
FARPROC oMFGetTimerPeriodicity;
FARPROC oMFGetUncompressedVideoFormat;
FARPROC oMFGetWorkQueueMMCSSTaskId;
FARPROC oMFHeapAlloc;
FARPROC oMFHeapFree;
FARPROC oMFInitAMMediaTypeFromMFMediaType;
FARPROC oMFInitAttributesFromBlob;
FARPROC oMFInitMediaTypeFromAMMediaType;
FARPROC oMFInitMediaTypeFromMFVideoFormat;
FARPROC oMFInitMediaTypeFromVideoInfoHeader;
FARPROC oMFInitMediaTypeFromVideoInfoHeader2;
FARPROC oMFInitMediaTypeFromWaveFormatEx;
FARPROC oMFInitVideoFormat;
FARPROC oMFInitVideoFormat_RGB;
FARPROC oMFInvokeCallback;
FARPROC oMFJoinIoPort;
FARPROC oMFJoinWorkQueue;
FARPROC oMFLockDXGIDeviceManager;
FARPROC oMFLockPlatform;
FARPROC oMFLockSharedWorkQueue;
FARPROC oMFLockWorkQueue;
FARPROC oMFMapDX9FormatToDXGIFormat;
FARPROC oMFMapDXGIFormatToDX9Format;
FARPROC oMFPutWaitingWorkItem;
FARPROC oMFPutWorkItem;
FARPROC oMFPutWorkItem2;
FARPROC oMFPutWorkItemEx;
FARPROC oMFPutWorkItemEx2;
FARPROC oMFRemovePeriodicCallback;
FARPROC oMFResetDXGIDeviceManagerX;
FARPROC oMFScheduleWorkItem;
FARPROC oMFScheduleWorkItemEx;
FARPROC oMFSerializeAttributesToStream;
FARPROC oMFSerializeEvent;
FARPROC oMFSerializeMediaTypeToStream;
FARPROC oMFSerializePresentationDescriptor;
FARPROC oMFShutdown;
FARPROC oMFStartup;
FARPROC oMFTEnumEx;
FARPROC oMFTraceError;
FARPROC oMFTraceFuncEnter;
FARPROC oMFUnblockThread;
FARPROC oMFUnjoinWorkQueue;
FARPROC oMFUnlockDXGIDeviceManager;
FARPROC oMFUnlockPlatform;
FARPROC oMFUnlockWorkQueue;
FARPROC oMFUnwrapMediaType;
FARPROC oMFValidateMediaTypeSize;
FARPROC oMFWrapMediaType;
FARPROC oMFllMulDiv;
FARPROC oPropVariantFromStream;
FARPROC oPropVariantToStream;
FARPROC oValidateWaveFormat;
} mfplat;
BOOL APIENTRY DllMain(HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
break;
extern "C" {
FARPROC PA = 0;
int runASM();
case DLL_PROCESS_DETACH:
break;
void fCopyPropVariant() { PA = mfplat.oCopyPropVariant; runASM(); }
void fCreatePropVariant() { PA = mfplat.oCreatePropVariant; runASM(); }
void fCreatePropertyStore() { PA = mfplat.oCreatePropertyStore; runASM(); }
void fDestroyPropVariant() { PA = mfplat.oDestroyPropVariant; runASM(); }
void fGetAMSubtypeFromD3DFormat() { PA = mfplat.oGetAMSubtypeFromD3DFormat; runASM(); }
void fGetD3DFormatFromMFSubtype() { PA = mfplat.oGetD3DFormatFromMFSubtype; runASM(); }
void fLFGetGlobalPool() { PA = mfplat.oLFGetGlobalPool; runASM(); }
void fMFAddPeriodicCallback() { PA = mfplat.oMFAddPeriodicCallback; runASM(); }
void fMFAllocateSerialWorkQueue() { PA = mfplat.oMFAllocateSerialWorkQueue; runASM(); }
void fMFAllocateWorkQueue() { PA = mfplat.oMFAllocateWorkQueue; runASM(); }
void fMFAllocateWorkQueueEx() { PA = mfplat.oMFAllocateWorkQueueEx; runASM(); }
void fMFAppendCollection() { PA = mfplat.oMFAppendCollection; runASM(); }
void fMFAverageTimePerFrameToFrameRate() { PA = mfplat.oMFAverageTimePerFrameToFrameRate; runASM(); }
void fMFBeginCreateFile() { PA = mfplat.oMFBeginCreateFile; runASM(); }
void fMFBlockThread() { PA = mfplat.oMFBlockThread; runASM(); }
void fMFCalculateBitmapImageSize() { PA = mfplat.oMFCalculateBitmapImageSize; runASM(); }
void fMFCalculateImageSize() { PA = mfplat.oMFCalculateImageSize; runASM(); }
void fMFCancelCreateFile() { PA = mfplat.oMFCancelCreateFile; runASM(); }
void fMFCancelWorkItem() { PA = mfplat.oMFCancelWorkItem; runASM(); }
void fMFConvertColorInfoFromDXVA() { PA = mfplat.oMFConvertColorInfoFromDXVA; runASM(); }
void fMFConvertColorInfoToDXVA() { PA = mfplat.oMFConvertColorInfoToDXVA; runASM(); }
void fMFConvertFromFP16Array() { PA = mfplat.oMFConvertFromFP16Array; runASM(); }
void fMFConvertToFP16Array() { PA = mfplat.oMFConvertToFP16Array; runASM(); }
void fMFCopyImage() { PA = mfplat.oMFCopyImage; runASM(); }
void fMFCreate2DMediaBuffer() { PA = mfplat.oMFCreate2DMediaBuffer; runASM(); }
void fMFCreateAMMediaTypeFromMFMediaType() { PA = mfplat.oMFCreateAMMediaTypeFromMFMediaType; runASM(); }
void fMFCreateAlignedMemoryBuffer() { PA = mfplat.oMFCreateAlignedMemoryBuffer; runASM(); }
void fMFCreateAsyncResult() { PA = mfplat.oMFCreateAsyncResult; runASM(); }
void fMFCreateAttributes() { PA = mfplat.oMFCreateAttributes; runASM(); }
void fMFCreateAudioMediaType() { PA = mfplat.oMFCreateAudioMediaType; runASM(); }
void fMFCreateCollection() { PA = mfplat.oMFCreateCollection; runASM(); }
void fMFCreateDXGIDeviceManager() { PA = mfplat.oMFCreateDXGIDeviceManager; runASM(); }
void fMFCreateDXGISurfaceBufferX() { PA = mfplat.oMFCreateDXGISurfaceBufferX; runASM(); }
void fMFCreateDxvaSampleRendererX() { PA = mfplat.oMFCreateDxvaSampleRendererX; runASM(); }
void fMFCreateEventQueue() { PA = mfplat.oMFCreateEventQueue; runASM(); }
void fMFCreateFile() { PA = mfplat.oMFCreateFile; runASM(); }
void fMFCreateFileFromHandle() { PA = mfplat.oMFCreateFileFromHandle; runASM(); }
void fMFCreateLegacyMediaBufferOnMFMediaBuffer() { PA = mfplat.oMFCreateLegacyMediaBufferOnMFMediaBuffer; runASM(); }
void fMFCreateMFByteStreamOnStream() { PA = mfplat.oMFCreateMFByteStreamOnStream; runASM(); }
void fMFCreateMFVideoFormatFromMFMediaType() { PA = mfplat.oMFCreateMFVideoFormatFromMFMediaType; runASM(); }
void fMFCreateMediaBufferFromMediaType() { PA = mfplat.oMFCreateMediaBufferFromMediaType; runASM(); }
void fMFCreateMediaBufferWrapper() { PA = mfplat.oMFCreateMediaBufferWrapper; runASM(); }
void fMFCreateMediaEvent() { PA = mfplat.oMFCreateMediaEvent; runASM(); }
void fMFCreateMediaEventResult() { PA = mfplat.oMFCreateMediaEventResult; runASM(); }
void fMFCreateMediaType() { PA = mfplat.oMFCreateMediaType; runASM(); }
void fMFCreateMediaTypeFromRepresentation() { PA = mfplat.oMFCreateMediaTypeFromRepresentation; runASM(); }
void fMFCreateMemoryBuffer() { PA = mfplat.oMFCreateMemoryBuffer; runASM(); }
void fMFCreateMemoryStream() { PA = mfplat.oMFCreateMemoryStream; runASM(); }
void fMFCreateNV12ToRGB32ConverterX() { PA = mfplat.oMFCreateNV12ToRGB32ConverterX; runASM(); }
void fMFCreatePathFromURL() { PA = mfplat.oMFCreatePathFromURL; runASM(); }
void fMFCreatePresentationDescriptor() { PA = mfplat.oMFCreatePresentationDescriptor; runASM(); }
void fMFCreateRGB32ToNV12ConverterX() { PA = mfplat.oMFCreateRGB32ToNV12ConverterX; runASM(); }
void fMFCreateSample() { PA = mfplat.oMFCreateSample; runASM(); }
void fMFCreateSourceResolver() { PA = mfplat.oMFCreateSourceResolver; runASM(); }
void fMFCreateSourceResolverInternal() { PA = mfplat.oMFCreateSourceResolverInternal; runASM(); }
void fMFCreateStreamDescriptor() { PA = mfplat.oMFCreateStreamDescriptor; runASM(); }
void fMFCreateSystemTimeSource() { PA = mfplat.oMFCreateSystemTimeSource; runASM(); }
void fMFCreateTempFile() { PA = mfplat.oMFCreateTempFile; runASM(); }
void fMFCreateTrackedSample() { PA = mfplat.oMFCreateTrackedSample; runASM(); }
void fMFCreateURLFromPath() { PA = mfplat.oMFCreateURLFromPath; runASM(); }
void fMFCreateVideoMediaType() { PA = mfplat.oMFCreateVideoMediaType; runASM(); }
void fMFCreateVideoMediaTypeFromBitMapInfoHeader() { PA = mfplat.oMFCreateVideoMediaTypeFromBitMapInfoHeader; runASM(); }
void fMFCreateVideoMediaTypeFromBitMapInfoHeaderEx() { PA = mfplat.oMFCreateVideoMediaTypeFromBitMapInfoHeaderEx; runASM(); }
void fMFCreateVideoMediaTypeFromSubtype() { PA = mfplat.oMFCreateVideoMediaTypeFromSubtype; runASM(); }
void fMFCreateVideoMediaTypeFromVideoInfoHeader() { PA = mfplat.oMFCreateVideoMediaTypeFromVideoInfoHeader; runASM(); }
void fMFCreateVideoMediaTypeFromVideoInfoHeader2() { PA = mfplat.oMFCreateVideoMediaTypeFromVideoInfoHeader2; runASM(); }
void fMFCreateVideoSampleAllocatorEx() { PA = mfplat.oMFCreateVideoSampleAllocatorEx; runASM(); }
void fMFCreateWaveFormatExFromMFMediaType() { PA = mfplat.oMFCreateWaveFormatExFromMFMediaType; runASM(); }
void fMFDeserializeAttributesFromStream() { PA = mfplat.oMFDeserializeAttributesFromStream; runASM(); }
void fMFDeserializeEvent() { PA = mfplat.oMFDeserializeEvent; runASM(); }
void fMFDeserializeMediaTypeFromStream() { PA = mfplat.oMFDeserializeMediaTypeFromStream; runASM(); }
void fMFDeserializePresentationDescriptor() { PA = mfplat.oMFDeserializePresentationDescriptor; runASM(); }
void fMFEndCreateFile() { PA = mfplat.oMFEndCreateFile; runASM(); }
void fMFFrameRateToAverageTimePerFrame() { PA = mfplat.oMFFrameRateToAverageTimePerFrame; runASM(); }
void fMFGetAttributesAsBlob() { PA = mfplat.oMFGetAttributesAsBlob; runASM(); }
void fMFGetAttributesAsBlobSize() { PA = mfplat.oMFGetAttributesAsBlobSize; runASM(); }
void fMFGetConfigurationDWORD() { PA = mfplat.oMFGetConfigurationDWORD; runASM(); }
void fMFGetConfigurationPolicy() { PA = mfplat.oMFGetConfigurationPolicy; runASM(); }
void fMFGetConfigurationStore() { PA = mfplat.oMFGetConfigurationStore; runASM(); }
void fMFGetConfigurationString() { PA = mfplat.oMFGetConfigurationString; runASM(); }
void fMFGetPlaneSize() { PA = mfplat.oMFGetPlaneSize; runASM(); }
void fMFGetPlatform() { PA = mfplat.oMFGetPlatform; runASM(); }
void fMFGetPrivateWorkqueues() { PA = mfplat.oMFGetPrivateWorkqueues; runASM(); }
void fMFGetStrideForBitmapInfoHeader() { PA = mfplat.oMFGetStrideForBitmapInfoHeader; runASM(); }
void fMFGetSupportedMimeTypes() { PA = mfplat.oMFGetSupportedMimeTypes; runASM(); }
void fMFGetSupportedSchemes() { PA = mfplat.oMFGetSupportedSchemes; runASM(); }
void fMFGetSystemTime() { PA = mfplat.oMFGetSystemTime; runASM(); }
void fMFGetTimerPeriodicity() { PA = mfplat.oMFGetTimerPeriodicity; runASM(); }
void fMFGetUncompressedVideoFormat() { PA = mfplat.oMFGetUncompressedVideoFormat; runASM(); }
void fMFGetWorkQueueMMCSSTaskId() { PA = mfplat.oMFGetWorkQueueMMCSSTaskId; runASM(); }
void fMFHeapAlloc() { PA = mfplat.oMFHeapAlloc; runASM(); }
void fMFHeapFree() { PA = mfplat.oMFHeapFree; runASM(); }
void fMFInitAMMediaTypeFromMFMediaType() { PA = mfplat.oMFInitAMMediaTypeFromMFMediaType; runASM(); }
void fMFInitAttributesFromBlob() { PA = mfplat.oMFInitAttributesFromBlob; runASM(); }
void fMFInitMediaTypeFromAMMediaType() { PA = mfplat.oMFInitMediaTypeFromAMMediaType; runASM(); }
void fMFInitMediaTypeFromMFVideoFormat() { PA = mfplat.oMFInitMediaTypeFromMFVideoFormat; runASM(); }
void fMFInitMediaTypeFromVideoInfoHeader() { PA = mfplat.oMFInitMediaTypeFromVideoInfoHeader; runASM(); }
void fMFInitMediaTypeFromVideoInfoHeader2() { PA = mfplat.oMFInitMediaTypeFromVideoInfoHeader2; runASM(); }
void fMFInitMediaTypeFromWaveFormatEx() { PA = mfplat.oMFInitMediaTypeFromWaveFormatEx; runASM(); }
void fMFInitVideoFormat() { PA = mfplat.oMFInitVideoFormat; runASM(); }
void fMFInitVideoFormat_RGB() { PA = mfplat.oMFInitVideoFormat_RGB; runASM(); }
void fMFInvokeCallback() { PA = mfplat.oMFInvokeCallback; runASM(); }
void fMFJoinIoPort() { PA = mfplat.oMFJoinIoPort; runASM(); }
void fMFJoinWorkQueue() { PA = mfplat.oMFJoinWorkQueue; runASM(); }
void fMFLockDXGIDeviceManager() { PA = mfplat.oMFLockDXGIDeviceManager; runASM(); }
void fMFLockPlatform() { PA = mfplat.oMFLockPlatform; runASM(); }
void fMFLockSharedWorkQueue() { PA = mfplat.oMFLockSharedWorkQueue; runASM(); }
void fMFLockWorkQueue() { PA = mfplat.oMFLockWorkQueue; runASM(); }
void fMFMapDX9FormatToDXGIFormat() { PA = mfplat.oMFMapDX9FormatToDXGIFormat; runASM(); }
void fMFMapDXGIFormatToDX9Format() { PA = mfplat.oMFMapDXGIFormatToDX9Format; runASM(); }
void fMFPutWaitingWorkItem() { PA = mfplat.oMFPutWaitingWorkItem; runASM(); }
void fMFPutWorkItem() { PA = mfplat.oMFPutWorkItem; runASM(); }
void fMFPutWorkItem2() { PA = mfplat.oMFPutWorkItem2; runASM(); }
void fMFPutWorkItemEx() { PA = mfplat.oMFPutWorkItemEx; runASM(); }
void fMFPutWorkItemEx2() { PA = mfplat.oMFPutWorkItemEx2; runASM(); }
void fMFRemovePeriodicCallback() { PA = mfplat.oMFRemovePeriodicCallback; runASM(); }
void fMFResetDXGIDeviceManagerX() { PA = mfplat.oMFResetDXGIDeviceManagerX; runASM(); }
void fMFScheduleWorkItem() { PA = mfplat.oMFScheduleWorkItem; runASM(); }
void fMFScheduleWorkItemEx() { PA = mfplat.oMFScheduleWorkItemEx; runASM(); }
void fMFSerializeAttributesToStream() { PA = mfplat.oMFSerializeAttributesToStream; runASM(); }
void fMFSerializeEvent() { PA = mfplat.oMFSerializeEvent; runASM(); }
void fMFSerializeMediaTypeToStream() { PA = mfplat.oMFSerializeMediaTypeToStream; runASM(); }
void fMFSerializePresentationDescriptor() { PA = mfplat.oMFSerializePresentationDescriptor; runASM(); }
void fMFShutdown() { PA = mfplat.oMFShutdown; runASM(); }
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
// Do nothing for thread-specific cases
break;
}
return TRUE; // Continue loading the DLL
HRESULT fMFStartup( ULONG Version, DWORD dwFlags )
{
return reinterpret_cast<HRESULT(__stdcall*)(ULONG, ULONG)>(mfplat.oMFStartup)(MF_VERSION, dwFlags);
}
void fMFTEnumEx() { PA = mfplat.oMFTEnumEx; runASM(); }
void fMFTraceError() { PA = mfplat.oMFTraceError; runASM(); }
void fMFTraceFuncEnter() { PA = mfplat.oMFTraceFuncEnter; runASM(); }
void fMFUnblockThread() { PA = mfplat.oMFUnblockThread; runASM(); }
void fMFUnjoinWorkQueue() { PA = mfplat.oMFUnjoinWorkQueue; runASM(); }
void fMFUnlockDXGIDeviceManager() { PA = mfplat.oMFUnlockDXGIDeviceManager; runASM(); }
void fMFUnlockPlatform() { PA = mfplat.oMFUnlockPlatform; runASM(); }
void fMFUnlockWorkQueue() { PA = mfplat.oMFUnlockWorkQueue; runASM(); }
void fMFUnwrapMediaType() { PA = mfplat.oMFUnwrapMediaType; runASM(); }
void fMFValidateMediaTypeSize() { PA = mfplat.oMFValidateMediaTypeSize; runASM(); }
void fMFWrapMediaType() { PA = mfplat.oMFWrapMediaType; runASM(); }
void fMFllMulDiv() { PA = mfplat.oMFllMulDiv; runASM(); }
void fPropVariantFromStream() { PA = mfplat.oPropVariantFromStream; runASM(); }
void fPropVariantToStream() { PA = mfplat.oPropVariantToStream; runASM(); }
void fValidateWaveFormat() { PA = mfplat.oValidateWaveFormat; runASM(); }
}
void setupFunctions() {
mfplat.oCopyPropVariant = GetProcAddress(mfplat.dll, "CopyPropVariant");
mfplat.oCreatePropVariant = GetProcAddress(mfplat.dll, "CreatePropVariant");
mfplat.oCreatePropertyStore = GetProcAddress(mfplat.dll, "CreatePropertyStore");
mfplat.oDestroyPropVariant = GetProcAddress(mfplat.dll, "DestroyPropVariant");
mfplat.oGetAMSubtypeFromD3DFormat = GetProcAddress(mfplat.dll, "GetAMSubtypeFromD3DFormat");
mfplat.oGetD3DFormatFromMFSubtype = GetProcAddress(mfplat.dll, "GetD3DFormatFromMFSubtype");
mfplat.oLFGetGlobalPool = GetProcAddress(mfplat.dll, "LFGetGlobalPool");
mfplat.oMFAddPeriodicCallback = GetProcAddress(mfplat.dll, "MFAddPeriodicCallback");
mfplat.oMFAllocateSerialWorkQueue = GetProcAddress(mfplat.dll, "MFAllocateSerialWorkQueue");
mfplat.oMFAllocateWorkQueue = GetProcAddress(mfplat.dll, "MFAllocateWorkQueue");
mfplat.oMFAllocateWorkQueueEx = GetProcAddress(mfplat.dll, "MFAllocateWorkQueueEx");
mfplat.oMFAppendCollection = GetProcAddress(mfplat.dll, "MFAppendCollection");
mfplat.oMFAverageTimePerFrameToFrameRate = GetProcAddress(mfplat.dll, "MFAverageTimePerFrameToFrameRate");
mfplat.oMFBeginCreateFile = GetProcAddress(mfplat.dll, "MFBeginCreateFile");
mfplat.oMFBlockThread = GetProcAddress(mfplat.dll, "MFBlockThread");
mfplat.oMFCalculateBitmapImageSize = GetProcAddress(mfplat.dll, "MFCalculateBitmapImageSize");
mfplat.oMFCalculateImageSize = GetProcAddress(mfplat.dll, "MFCalculateImageSize");
mfplat.oMFCancelCreateFile = GetProcAddress(mfplat.dll, "MFCancelCreateFile");
mfplat.oMFCancelWorkItem = GetProcAddress(mfplat.dll, "MFCancelWorkItem");
mfplat.oMFConvertColorInfoFromDXVA = GetProcAddress(mfplat.dll, "MFConvertColorInfoFromDXVA");
mfplat.oMFConvertColorInfoToDXVA = GetProcAddress(mfplat.dll, "MFConvertColorInfoToDXVA");
mfplat.oMFConvertFromFP16Array = GetProcAddress(mfplat.dll, "MFConvertFromFP16Array");
mfplat.oMFConvertToFP16Array = GetProcAddress(mfplat.dll, "MFConvertToFP16Array");
mfplat.oMFCopyImage = GetProcAddress(mfplat.dll, "MFCopyImage");
mfplat.oMFCreate2DMediaBuffer = GetProcAddress(mfplat.dll, "MFCreate2DMediaBuffer");
mfplat.oMFCreateAMMediaTypeFromMFMediaType = GetProcAddress(mfplat.dll, "MFCreateAMMediaTypeFromMFMediaType");
mfplat.oMFCreateAlignedMemoryBuffer = GetProcAddress(mfplat.dll, "MFCreateAlignedMemoryBuffer");
mfplat.oMFCreateAsyncResult = GetProcAddress(mfplat.dll, "MFCreateAsyncResult");
mfplat.oMFCreateAttributes = GetProcAddress(mfplat.dll, "MFCreateAttributes");
mfplat.oMFCreateAudioMediaType = GetProcAddress(mfplat.dll, "MFCreateAudioMediaType");
mfplat.oMFCreateCollection = GetProcAddress(mfplat.dll, "MFCreateCollection");
mfplat.oMFCreateDXGIDeviceManager = GetProcAddress(mfplat.dll, "MFCreateDXGIDeviceManager");
mfplat.oMFCreateDXGISurfaceBufferX = GetProcAddress(mfplat.dll, "MFCreateDXGISurfaceBufferX");
mfplat.oMFCreateDxvaSampleRendererX = GetProcAddress(mfplat.dll, "MFCreateDxvaSampleRendererX");
mfplat.oMFCreateEventQueue = GetProcAddress(mfplat.dll, "MFCreateEventQueue");
mfplat.oMFCreateFile = GetProcAddress(mfplat.dll, "MFCreateFile");
mfplat.oMFCreateFileFromHandle = GetProcAddress(mfplat.dll, "MFCreateFileFromHandle");
mfplat.oMFCreateLegacyMediaBufferOnMFMediaBuffer = GetProcAddress(mfplat.dll, "MFCreateLegacyMediaBufferOnMFMediaBuffer");
mfplat.oMFCreateMFByteStreamOnStream = GetProcAddress(mfplat.dll, "MFCreateMFByteStreamOnStream");
mfplat.oMFCreateMFVideoFormatFromMFMediaType = GetProcAddress(mfplat.dll, "MFCreateMFVideoFormatFromMFMediaType");
mfplat.oMFCreateMediaBufferFromMediaType = GetProcAddress(mfplat.dll, "MFCreateMediaBufferFromMediaType");
mfplat.oMFCreateMediaBufferWrapper = GetProcAddress(mfplat.dll, "MFCreateMediaBufferWrapper");
mfplat.oMFCreateMediaEvent = GetProcAddress(mfplat.dll, "MFCreateMediaEvent");
mfplat.oMFCreateMediaEventResult = GetProcAddress(mfplat.dll, "MFCreateMediaEventResult");
mfplat.oMFCreateMediaType = GetProcAddress(mfplat.dll, "MFCreateMediaType");
mfplat.oMFCreateMediaTypeFromRepresentation = GetProcAddress(mfplat.dll, "MFCreateMediaTypeFromRepresentation");
mfplat.oMFCreateMemoryBuffer = GetProcAddress(mfplat.dll, "MFCreateMemoryBuffer");
mfplat.oMFCreateMemoryStream = GetProcAddress(mfplat.dll, "MFCreateMemoryStream");
mfplat.oMFCreateNV12ToRGB32ConverterX = GetProcAddress(mfplat.dll, "MFCreateNV12ToRGB32ConverterX");
mfplat.oMFCreatePathFromURL = GetProcAddress(mfplat.dll, "MFCreatePathFromURL");
mfplat.oMFCreatePresentationDescriptor = GetProcAddress(mfplat.dll, "MFCreatePresentationDescriptor");
mfplat.oMFCreateRGB32ToNV12ConverterX = GetProcAddress(mfplat.dll, "MFCreateRGB32ToNV12ConverterX");
mfplat.oMFCreateSample = GetProcAddress(mfplat.dll, "MFCreateSample");
mfplat.oMFCreateSourceResolver = GetProcAddress(mfplat.dll, "MFCreateSourceResolver");
mfplat.oMFCreateSourceResolverInternal = GetProcAddress(mfplat.dll, "MFCreateSourceResolverInternal");
mfplat.oMFCreateStreamDescriptor = GetProcAddress(mfplat.dll, "MFCreateStreamDescriptor");
mfplat.oMFCreateSystemTimeSource = GetProcAddress(mfplat.dll, "MFCreateSystemTimeSource");
mfplat.oMFCreateTempFile = GetProcAddress(mfplat.dll, "MFCreateTempFile");
mfplat.oMFCreateTrackedSample = GetProcAddress(mfplat.dll, "MFCreateTrackedSample");
mfplat.oMFCreateURLFromPath = GetProcAddress(mfplat.dll, "MFCreateURLFromPath");
mfplat.oMFCreateVideoMediaType = GetProcAddress(mfplat.dll, "MFCreateVideoMediaType");
mfplat.oMFCreateVideoMediaTypeFromBitMapInfoHeader = GetProcAddress(mfplat.dll, "MFCreateVideoMediaTypeFromBitMapInfoHeader");
mfplat.oMFCreateVideoMediaTypeFromBitMapInfoHeaderEx = GetProcAddress(mfplat.dll, "MFCreateVideoMediaTypeFromBitMapInfoHeaderEx");
mfplat.oMFCreateVideoMediaTypeFromSubtype = GetProcAddress(mfplat.dll, "MFCreateVideoMediaTypeFromSubtype");
mfplat.oMFCreateVideoMediaTypeFromVideoInfoHeader = GetProcAddress(mfplat.dll, "MFCreateVideoMediaTypeFromVideoInfoHeader");
mfplat.oMFCreateVideoMediaTypeFromVideoInfoHeader2 = GetProcAddress(mfplat.dll, "MFCreateVideoMediaTypeFromVideoInfoHeader2");
mfplat.oMFCreateVideoSampleAllocatorEx = GetProcAddress(mfplat.dll, "MFCreateVideoSampleAllocatorEx");
mfplat.oMFCreateWaveFormatExFromMFMediaType = GetProcAddress(mfplat.dll, "MFCreateWaveFormatExFromMFMediaType");
mfplat.oMFDeserializeAttributesFromStream = GetProcAddress(mfplat.dll, "MFDeserializeAttributesFromStream");
mfplat.oMFDeserializeEvent = GetProcAddress(mfplat.dll, "MFDeserializeEvent");
mfplat.oMFDeserializeMediaTypeFromStream = GetProcAddress(mfplat.dll, "MFDeserializeMediaTypeFromStream");
mfplat.oMFDeserializePresentationDescriptor = GetProcAddress(mfplat.dll, "MFDeserializePresentationDescriptor");
mfplat.oMFEndCreateFile = GetProcAddress(mfplat.dll, "MFEndCreateFile");
mfplat.oMFFrameRateToAverageTimePerFrame = GetProcAddress(mfplat.dll, "MFFrameRateToAverageTimePerFrame");
mfplat.oMFGetAttributesAsBlob = GetProcAddress(mfplat.dll, "MFGetAttributesAsBlob");
mfplat.oMFGetAttributesAsBlobSize = GetProcAddress(mfplat.dll, "MFGetAttributesAsBlobSize");
mfplat.oMFGetConfigurationDWORD = GetProcAddress(mfplat.dll, "MFGetConfigurationDWORD");
mfplat.oMFGetConfigurationPolicy = GetProcAddress(mfplat.dll, "MFGetConfigurationPolicy");
mfplat.oMFGetConfigurationStore = GetProcAddress(mfplat.dll, "MFGetConfigurationStore");
mfplat.oMFGetConfigurationString = GetProcAddress(mfplat.dll, "MFGetConfigurationString");
mfplat.oMFGetPlaneSize = GetProcAddress(mfplat.dll, "MFGetPlaneSize");
mfplat.oMFGetPlatform = GetProcAddress(mfplat.dll, "MFGetPlatform");
mfplat.oMFGetPrivateWorkqueues = GetProcAddress(mfplat.dll, "MFGetPrivateWorkqueues");
mfplat.oMFGetStrideForBitmapInfoHeader = GetProcAddress(mfplat.dll, "MFGetStrideForBitmapInfoHeader");
mfplat.oMFGetSupportedMimeTypes = GetProcAddress(mfplat.dll, "MFGetSupportedMimeTypes");
mfplat.oMFGetSupportedSchemes = GetProcAddress(mfplat.dll, "MFGetSupportedSchemes");
mfplat.oMFGetSystemTime = GetProcAddress(mfplat.dll, "MFGetSystemTime");
mfplat.oMFGetTimerPeriodicity = GetProcAddress(mfplat.dll, "MFGetTimerPeriodicity");
mfplat.oMFGetUncompressedVideoFormat = GetProcAddress(mfplat.dll, "MFGetUncompressedVideoFormat");
mfplat.oMFGetWorkQueueMMCSSTaskId = GetProcAddress(mfplat.dll, "MFGetWorkQueueMMCSSTaskId");
mfplat.oMFHeapAlloc = GetProcAddress(mfplat.dll, "MFHeapAlloc");
mfplat.oMFHeapFree = GetProcAddress(mfplat.dll, "MFHeapFree");
mfplat.oMFInitAMMediaTypeFromMFMediaType = GetProcAddress(mfplat.dll, "MFInitAMMediaTypeFromMFMediaType");
mfplat.oMFInitAttributesFromBlob = GetProcAddress(mfplat.dll, "MFInitAttributesFromBlob");
mfplat.oMFInitMediaTypeFromAMMediaType = GetProcAddress(mfplat.dll, "MFInitMediaTypeFromAMMediaType");
mfplat.oMFInitMediaTypeFromMFVideoFormat = GetProcAddress(mfplat.dll, "MFInitMediaTypeFromMFVideoFormat");
mfplat.oMFInitMediaTypeFromVideoInfoHeader = GetProcAddress(mfplat.dll, "MFInitMediaTypeFromVideoInfoHeader");
mfplat.oMFInitMediaTypeFromVideoInfoHeader2 = GetProcAddress(mfplat.dll, "MFInitMediaTypeFromVideoInfoHeader2");
mfplat.oMFInitMediaTypeFromWaveFormatEx = GetProcAddress(mfplat.dll, "MFInitMediaTypeFromWaveFormatEx");
mfplat.oMFInitVideoFormat = GetProcAddress(mfplat.dll, "MFInitVideoFormat");
mfplat.oMFInitVideoFormat_RGB = GetProcAddress(mfplat.dll, "MFInitVideoFormat_RGB");
mfplat.oMFInvokeCallback = GetProcAddress(mfplat.dll, "MFInvokeCallback");
mfplat.oMFJoinIoPort = GetProcAddress(mfplat.dll, "MFJoinIoPort");
mfplat.oMFJoinWorkQueue = GetProcAddress(mfplat.dll, "MFJoinWorkQueue");
mfplat.oMFLockDXGIDeviceManager = GetProcAddress(mfplat.dll, "MFLockDXGIDeviceManager");
mfplat.oMFLockPlatform = GetProcAddress(mfplat.dll, "MFLockPlatform");
mfplat.oMFLockSharedWorkQueue = GetProcAddress(mfplat.dll, "MFLockSharedWorkQueue");
mfplat.oMFLockWorkQueue = GetProcAddress(mfplat.dll, "MFLockWorkQueue");
mfplat.oMFMapDX9FormatToDXGIFormat = GetProcAddress(mfplat.dll, "MFMapDX9FormatToDXGIFormat");
mfplat.oMFMapDXGIFormatToDX9Format = GetProcAddress(mfplat.dll, "MFMapDXGIFormatToDX9Format");
mfplat.oMFPutWaitingWorkItem = GetProcAddress(mfplat.dll, "MFPutWaitingWorkItem");
mfplat.oMFPutWorkItem = GetProcAddress(mfplat.dll, "MFPutWorkItem");
mfplat.oMFPutWorkItem2 = GetProcAddress(mfplat.dll, "MFPutWorkItem2");
mfplat.oMFPutWorkItemEx = GetProcAddress(mfplat.dll, "MFPutWorkItemEx");
mfplat.oMFPutWorkItemEx2 = GetProcAddress(mfplat.dll, "MFPutWorkItemEx2");
mfplat.oMFRemovePeriodicCallback = GetProcAddress(mfplat.dll, "MFRemovePeriodicCallback");
mfplat.oMFResetDXGIDeviceManagerX = GetProcAddress(mfplat.dll, "MFResetDXGIDeviceManagerX");
mfplat.oMFScheduleWorkItem = GetProcAddress(mfplat.dll, "MFScheduleWorkItem");
mfplat.oMFScheduleWorkItemEx = GetProcAddress(mfplat.dll, "MFScheduleWorkItemEx");
mfplat.oMFSerializeAttributesToStream = GetProcAddress(mfplat.dll, "MFSerializeAttributesToStream");
mfplat.oMFSerializeEvent = GetProcAddress(mfplat.dll, "MFSerializeEvent");
mfplat.oMFSerializeMediaTypeToStream = GetProcAddress(mfplat.dll, "MFSerializeMediaTypeToStream");
mfplat.oMFSerializePresentationDescriptor = GetProcAddress(mfplat.dll, "MFSerializePresentationDescriptor");
mfplat.oMFShutdown = GetProcAddress(mfplat.dll, "MFShutdown");
mfplat.oMFStartup = GetProcAddress(mfplat.dll, "MFStartup");
mfplat.oMFTEnumEx = GetProcAddress(mfplat.dll, "MFTEnumEx");
mfplat.oMFTraceError = GetProcAddress(mfplat.dll, "MFTraceError");
mfplat.oMFTraceFuncEnter = GetProcAddress(mfplat.dll, "MFTraceFuncEnter");
mfplat.oMFUnblockThread = GetProcAddress(mfplat.dll, "MFUnblockThread");
mfplat.oMFUnjoinWorkQueue = GetProcAddress(mfplat.dll, "MFUnjoinWorkQueue");
mfplat.oMFUnlockDXGIDeviceManager = GetProcAddress(mfplat.dll, "MFUnlockDXGIDeviceManager");
mfplat.oMFUnlockPlatform = GetProcAddress(mfplat.dll, "MFUnlockPlatform");
mfplat.oMFUnlockWorkQueue = GetProcAddress(mfplat.dll, "MFUnlockWorkQueue");
mfplat.oMFUnwrapMediaType = GetProcAddress(mfplat.dll, "MFUnwrapMediaType");
mfplat.oMFValidateMediaTypeSize = GetProcAddress(mfplat.dll, "MFValidateMediaTypeSize");
mfplat.oMFWrapMediaType = GetProcAddress(mfplat.dll, "MFWrapMediaType");
mfplat.oMFllMulDiv = GetProcAddress(mfplat.dll, "MFllMulDiv");
mfplat.oPropVariantFromStream = GetProcAddress(mfplat.dll, "PropVariantFromStream");
mfplat.oPropVariantToStream = GetProcAddress(mfplat.dll, "PropVariantToStream");
mfplat.oValidateWaveFormat = GetProcAddress(mfplat.dll, "ValidateWaveFormat");
}
#pragma endregion
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH:
char path[MAX_PATH];
GetWindowsDirectoryA(path, sizeof(path));
strcat_s(path, "\\System32\\mfplat.dll");
mfplat.dll = LoadLibraryA(path);
setupFunctions();
break;
case DLL_PROCESS_DETACH:
FreeLibrary(mfplat.dll);
break;
}
return 1;
}

View File

@@ -1,5 +0,0 @@
#pragma once
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files
#include <windows.h>

7
dlls/mfplat/mfplat.asm Normal file
View File

@@ -0,0 +1,7 @@
.data
extern PA : qword
.code
runASM proc
jmp qword ptr [PA]
runASM endp
end

View File

@@ -1,68 +0,0 @@
#include "pch.h"
#include <mmreg.h>
HRESULT MFCreateDxvaSampleRendererX_X(void* pDevice, void* pAttribute, void** pObject)
{
return E_NOTIMPL;
}
HRESULT MFCreateDXGIDeviceManager_X(UINT* resetToken, void** ppDeviceManager)
{
return E_NOTIMPL;
}
HRESULT MFResetDXGIDeviceManagerX_X(
void* pDeviceManager,
void* pUnkDevice,
UINT resetToken
)
{
return E_NOTIMPL;
}
HRESULT MFCreateAttributes_X(
void** ppMFAttributes,
UINT32 cInitialSize
)
{
return E_NOTIMPL;
}
HRESULT MFCreateMediaType_X(
void** ppMFType
)
{
return E_NOTIMPL;
}
HRESULT MFStartup_X(
ULONG Version,
DWORD dwFlags
)
{
return E_NOTIMPL;
}
HRESULT MFShutdown_X( )
{
return E_NOTIMPL;
}
HRESULT __fastcall MFCreateNV12ToRGB32ConverterX_X(void*, void*, void*)
{
return E_NOTIMPL;
}
HRESULT(MFCreateWaveFormatExFromMFMediaType_X)(void* pMFType, void** ppWF, UINT32* pcbSize, UINT32 Flags) {
return E_NOTIMPL;
}
HRESULT MFInitMediaTypeFromWaveFormatEx_X(
void* pMFType,
const WAVEFORMATEX* pWaveFormat,
UINT32 cbBufSize
)
{
return E_NOTIMPL;
}

142
dlls/mfplat/mfplat.def Normal file
View File

@@ -0,0 +1,142 @@
LIBRARY mfplat
EXPORTS
CopyPropVariant=fCopyPropVariant @1
CreatePropVariant=fCreatePropVariant @2
CreatePropertyStore=fCreatePropertyStore @3
DestroyPropVariant=fDestroyPropVariant @4
GetAMSubtypeFromD3DFormat=fGetAMSubtypeFromD3DFormat @5
GetD3DFormatFromMFSubtype=fGetD3DFormatFromMFSubtype @6
LFGetGlobalPool=fLFGetGlobalPool @7
MFAddPeriodicCallback=fMFAddPeriodicCallback @8
MFAllocateSerialWorkQueue=fMFAllocateSerialWorkQueue @9
MFAllocateWorkQueue=fMFAllocateWorkQueue @10
MFAllocateWorkQueueEx=fMFAllocateWorkQueueEx @11
MFAppendCollection=fMFAppendCollection @12
MFAverageTimePerFrameToFrameRate=fMFAverageTimePerFrameToFrameRate @13
MFBeginCreateFile=fMFBeginCreateFile @14
MFBlockThread=fMFBlockThread @15
MFCalculateBitmapImageSize=fMFCalculateBitmapImageSize @16
MFCalculateImageSize=fMFCalculateImageSize @17
MFCancelCreateFile=fMFCancelCreateFile @18
MFCancelWorkItem=fMFCancelWorkItem @19
MFConvertColorInfoFromDXVA=fMFConvertColorInfoFromDXVA @20
MFConvertColorInfoToDXVA=fMFConvertColorInfoToDXVA @21
MFConvertFromFP16Array=fMFConvertFromFP16Array @22
MFConvertToFP16Array=fMFConvertToFP16Array @23
MFCopyImage=fMFCopyImage @24
MFCreate2DMediaBuffer=fMFCreate2DMediaBuffer @25
MFCreateAMMediaTypeFromMFMediaType=fMFCreateAMMediaTypeFromMFMediaType @26
MFCreateAlignedMemoryBuffer=fMFCreateAlignedMemoryBuffer @27
MFCreateAsyncResult=fMFCreateAsyncResult @28
MFCreateAttributes=fMFCreateAttributes @29
MFCreateAudioMediaType=fMFCreateAudioMediaType @30
MFCreateCollection=fMFCreateCollection @31
MFCreateDXGIDeviceManager=fMFCreateDXGIDeviceManager @32
MFCreateDXGISurfaceBufferX=fMFCreateDXGISurfaceBufferX @33
MFCreateDxvaSampleRendererX=fMFCreateDxvaSampleRendererX @34
MFCreateEventQueue=fMFCreateEventQueue @35
MFCreateFile=fMFCreateFile @36
MFCreateFileFromHandle=fMFCreateFileFromHandle @37
MFCreateLegacyMediaBufferOnMFMediaBuffer=fMFCreateLegacyMediaBufferOnMFMediaBuffer @38
MFCreateMFByteStreamOnStream=fMFCreateMFByteStreamOnStream @39
MFCreateMFVideoFormatFromMFMediaType=fMFCreateMFVideoFormatFromMFMediaType @40
MFCreateMediaBufferFromMediaType=fMFCreateMediaBufferFromMediaType @41
MFCreateMediaBufferWrapper=fMFCreateMediaBufferWrapper @42
MFCreateMediaEvent=fMFCreateMediaEvent @43
MFCreateMediaEventResult=fMFCreateMediaEventResult @44
MFCreateMediaType=fMFCreateMediaType @45
MFCreateMediaTypeFromRepresentation=fMFCreateMediaTypeFromRepresentation @46
MFCreateMemoryBuffer=fMFCreateMemoryBuffer @47
MFCreateMemoryStream=fMFCreateMemoryStream @48
MFCreateNV12ToRGB32ConverterX=fMFCreateNV12ToRGB32ConverterX @49
MFCreatePathFromURL=fMFCreatePathFromURL @50
MFCreatePresentationDescriptor=fMFCreatePresentationDescriptor @51
MFCreateRGB32ToNV12ConverterX=fMFCreateRGB32ToNV12ConverterX @52
MFCreateSample=fMFCreateSample @53
MFCreateSourceResolver=fMFCreateSourceResolver @54
MFCreateSourceResolverInternal=fMFCreateSourceResolverInternal @55
MFCreateStreamDescriptor=fMFCreateStreamDescriptor @56
MFCreateSystemTimeSource=fMFCreateSystemTimeSource @57
MFCreateTempFile=fMFCreateTempFile @58
MFCreateTrackedSample=fMFCreateTrackedSample @59
MFCreateURLFromPath=fMFCreateURLFromPath @60
MFCreateVideoMediaType=fMFCreateVideoMediaType @61
MFCreateVideoMediaTypeFromBitMapInfoHeader=fMFCreateVideoMediaTypeFromBitMapInfoHeader @62
MFCreateVideoMediaTypeFromBitMapInfoHeaderEx=fMFCreateVideoMediaTypeFromBitMapInfoHeaderEx @63
MFCreateVideoMediaTypeFromSubtype=fMFCreateVideoMediaTypeFromSubtype @64
MFCreateVideoMediaTypeFromVideoInfoHeader=fMFCreateVideoMediaTypeFromVideoInfoHeader @65
MFCreateVideoMediaTypeFromVideoInfoHeader2=fMFCreateVideoMediaTypeFromVideoInfoHeader2 @66
MFCreateVideoSampleAllocatorEx=fMFCreateVideoSampleAllocatorEx @67
MFCreateWaveFormatExFromMFMediaType=fMFCreateWaveFormatExFromMFMediaType @68
MFDeserializeAttributesFromStream=fMFDeserializeAttributesFromStream @69
MFDeserializeEvent=fMFDeserializeEvent @70
MFDeserializeMediaTypeFromStream=fMFDeserializeMediaTypeFromStream @71
MFDeserializePresentationDescriptor=fMFDeserializePresentationDescriptor @72
MFEndCreateFile=fMFEndCreateFile @73
MFFrameRateToAverageTimePerFrame=fMFFrameRateToAverageTimePerFrame @74
MFGetAttributesAsBlob=fMFGetAttributesAsBlob @75
MFGetAttributesAsBlobSize=fMFGetAttributesAsBlobSize @76
MFGetConfigurationDWORD=fMFGetConfigurationDWORD @77
MFGetConfigurationPolicy=fMFGetConfigurationPolicy @78
MFGetConfigurationStore=fMFGetConfigurationStore @79
MFGetConfigurationString=fMFGetConfigurationString @80
MFGetPlaneSize=fMFGetPlaneSize @81
MFGetPlatform=fMFGetPlatform @82
MFGetPrivateWorkqueues=fMFGetPrivateWorkqueues @83
MFGetStrideForBitmapInfoHeader=fMFGetStrideForBitmapInfoHeader @84
MFGetSupportedMimeTypes=fMFGetSupportedMimeTypes @85
MFGetSupportedSchemes=fMFGetSupportedSchemes @86
MFGetSystemTime=fMFGetSystemTime @87
MFGetTimerPeriodicity=fMFGetTimerPeriodicity @88
MFGetUncompressedVideoFormat=fMFGetUncompressedVideoFormat @89
MFGetWorkQueueMMCSSTaskId=fMFGetWorkQueueMMCSSTaskId @90
MFHeapAlloc=fMFHeapAlloc @91
MFHeapFree=fMFHeapFree @92
MFInitAMMediaTypeFromMFMediaType=fMFInitAMMediaTypeFromMFMediaType @93
MFInitAttributesFromBlob=fMFInitAttributesFromBlob @94
MFInitMediaTypeFromAMMediaType=fMFInitMediaTypeFromAMMediaType @95
MFInitMediaTypeFromMFVideoFormat=fMFInitMediaTypeFromMFVideoFormat @96
MFInitMediaTypeFromVideoInfoHeader=fMFInitMediaTypeFromVideoInfoHeader @97
MFInitMediaTypeFromVideoInfoHeader2=fMFInitMediaTypeFromVideoInfoHeader2 @98
MFInitMediaTypeFromWaveFormatEx=fMFInitMediaTypeFromWaveFormatEx @99
MFInitVideoFormat=fMFInitVideoFormat @100
MFInitVideoFormat_RGB=fMFInitVideoFormat_RGB @101
MFInvokeCallback=fMFInvokeCallback @102
MFJoinIoPort=fMFJoinIoPort @103
MFJoinWorkQueue=fMFJoinWorkQueue @104
MFLockDXGIDeviceManager=fMFLockDXGIDeviceManager @105
MFLockPlatform=fMFLockPlatform @106
MFLockSharedWorkQueue=fMFLockSharedWorkQueue @107
MFLockWorkQueue=fMFLockWorkQueue @108
MFMapDX9FormatToDXGIFormat=fMFMapDX9FormatToDXGIFormat @109
MFMapDXGIFormatToDX9Format=fMFMapDXGIFormatToDX9Format @110
MFPutWaitingWorkItem=fMFPutWaitingWorkItem @111
MFPutWorkItem=fMFPutWorkItem @112
MFPutWorkItem2=fMFPutWorkItem2 @113
MFPutWorkItemEx=fMFPutWorkItemEx @114
MFPutWorkItemEx2=fMFPutWorkItemEx2 @115
MFRemovePeriodicCallback=fMFRemovePeriodicCallback @116
MFResetDXGIDeviceManagerX=fMFResetDXGIDeviceManagerX @117
MFScheduleWorkItem=fMFScheduleWorkItem @118
MFScheduleWorkItemEx=fMFScheduleWorkItemEx @119
MFSerializeAttributesToStream=fMFSerializeAttributesToStream @120
MFSerializeEvent=fMFSerializeEvent @121
MFSerializeMediaTypeToStream=fMFSerializeMediaTypeToStream @122
MFSerializePresentationDescriptor=fMFSerializePresentationDescriptor @123
MFShutdown=fMFShutdown @124
MFStartup=fMFStartup @125
MFTEnumEx=fMFTEnumEx @126
MFTraceError=fMFTraceError @127
MFTraceFuncEnter=fMFTraceFuncEnter @128
MFUnblockThread=fMFUnblockThread @129
MFUnjoinWorkQueue=fMFUnjoinWorkQueue @130
MFUnlockDXGIDeviceManager=fMFUnlockDXGIDeviceManager @131
MFUnlockPlatform=fMFUnlockPlatform @132
MFUnlockWorkQueue=fMFUnlockWorkQueue @133
MFUnwrapMediaType=fMFUnwrapMediaType @134
MFValidateMediaTypeSize=fMFValidateMediaTypeSize @135
MFWrapMediaType=fMFWrapMediaType @136
MFllMulDiv=fMFllMulDiv @137
PropVariantFromStream=fPropVariantFromStream @138
PropVariantToStream=fPropVariantToStream @139
ValidateWaveFormat=fValidateWaveFormat @140

View File

@@ -16,6 +16,7 @@
<ProjectGuid>{a67d1cec-9f56-4d53-97c2-88badeddb22d}</ProjectGuid>
<RootNamespace>mfplat</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>mfplat</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
@@ -33,6 +34,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props" />
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
@@ -57,15 +59,17 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;MFPLAT_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<ModuleDefinitionFile>Exports.def</ModuleDefinitionFile>
<ModuleDefinitionFile>mfplat.def</ModuleDefinitionFile>
<AdditionalDependencies>$(CoreLibraryDependencies);%(AdditionalDependencies);mfplat.lib</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -76,8 +80,9 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;MFPLAT_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -85,25 +90,21 @@
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<ModuleDefinitionFile>Exports.def</ModuleDefinitionFile>
<ModuleDefinitionFile>mfplat.def</ModuleDefinitionFile>
<AdditionalDependencies>$(CoreLibraryDependencies);%(AdditionalDependencies);mfplat.lib</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<None Include="Exports.def" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h" />
<ClInclude Include="pch.h" />
<MASM Include="mfplat.asm">
<FileType>Document</FileType>
</MASM>
<None Include="mfplat.def" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="mfplat.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
</ImportGroup>
</Project>

View File

@@ -1,15 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClInclude Include="pch.h" />
<ClInclude Include="framework.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="mfplat.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="Exports.def" />
<None Include="mfplat.def" />
</ItemGroup>
<ItemGroup>
<MASM Include="mfplat.asm" />
</ItemGroup>
</Project>

View File

@@ -1,5 +0,0 @@
// pch.cpp: source file corresponding to the pre-compiled header
#include "pch.h"
// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.

View File

@@ -1,13 +0,0 @@
// pch.h: This is a precompiled header file.
// Files listed below are compiled only once, improving build performance for future builds.
// This also affects IntelliSense performance, including code completion and many code browsing features.
// However, files listed here are ALL re-compiled if any one of them is updated between builds.
// Do not add files here that you will be updating frequently as this negates the performance advantage.
#ifndef PCH_H
#define PCH_H
// add headers that you want to pre-compile here
#include "framework.h"
#endif //PCH_H

View File

@@ -29,7 +29,7 @@ namespace winrt::Microsoft::Xbox::Services::RealTimeActivity::implementation
}
void RealTimeActivityService::Deactivate()
{
throw hresult_not_implemented();
printf("[RealTimeActivityService] Deactivate (function is stubbed)\n");
}
winrt::event_token RealTimeActivityService::RealTimeActivityConnectionStateChange(winrt::Windows::Foundation::EventHandler<winrt::Microsoft::Xbox::Services::RealTimeActivity::RealTimeActivityConnectionState> const& __param0)
{

View File

@@ -4,6 +4,7 @@
#include "Microsoft.Xbox.Services.Presence.PresenceService.h"
#include "Microsoft.Xbox.Services.XboxLiveContext.g.cpp"
#include "Microsoft.Xbox.Services.Multiplayer.MultiplayerService.h"
#include "Microsoft.Xbox.Services.RealTimeActivity.RealTimeActivityService.h"
#include "Microsoft.Xbox.Services.Social.SocialService.h"
#include "Microsoft.Xbox.Services.UserStatistics.UserStatisticsService.h"
@@ -83,8 +84,7 @@ namespace winrt::Microsoft::Xbox::Services::implementation
}
winrt::Microsoft::Xbox::Services::RealTimeActivity::RealTimeActivityService XboxLiveContext::RealTimeActivityService()
{
printf("!!!!! Microsoft.Xbox.Services.XboxLiveContext [RealTimeActivityService] NOT IMPLEMENTED !!!!\n");
throw hresult_not_implemented();
return winrt::make<RealTimeActivity::implementation::RealTimeActivityService>( );
}
winrt::Microsoft::Xbox::Services::Presence::PresenceService XboxLiveContext::PresenceService()
{

View File

@@ -47,13 +47,11 @@ namespace winrt::Windows::Xbox::ApplicationModel::Store::implementation
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Xbox::ApplicationModel::Store::PrivilegeCheckResult> Product::CheckPrivilegeAsync(winrt::Windows::Xbox::System::IUser user, uint32_t privilegeId, bool attemptResolution, hstring friendlyDisplay)
{
auto args = winrt::make<implementation::ProductPurchasedEventArgs>( );
m_productPurchasedEvent(args);
co_return PrivilegeCheckResult::NoIssue;
}
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Xbox::ApplicationModel::Store::PrivilegeCheckResult> Product::CheckPrivilegesAsync(winrt::Windows::Xbox::System::IUser user, winrt::Windows::Foundation::Collections::IVectorView<uint32_t> privilegeIds, bool attemptResolution, hstring friendlyDisplay)
{
auto args = winrt::make<implementation::ProductPurchasedEventArgs>( );
m_productPurchasedEvent(args);
co_return PrivilegeCheckResult::NoIssue;
}
winrt::event_token Product::ProductPurchased(winrt::Windows::Xbox::ApplicationModel::Store::ProductPurchasedEventHandler const& handler)

View File

@@ -60,12 +60,11 @@ namespace winrt::Windows::Xbox::Input::implementation
winrt::event_token Controller::ControllerOrderChanged(winrt::Windows::Foundation::EventHandler<winrt::Windows::Xbox::Input::ControllerOrderChangedEventArgs> const& handler)
{
printf("[ControllerOrderChanged] STUBBED\n");
throw hresult_not_implemented( );
return {};
}
void Controller::ControllerOrderChanged(winrt::event_token const& token) noexcept
{
printf("[ControllerOrderChanged] STUBBED\n");
throw hresult_not_implemented( );
printf("[ControllerOrderChangedInternal] STUBBED\n");
}
winrt::Windows::Xbox::Input::IController Controller::GetControllerById(uint64_t controllerId)
{

View File

@@ -37,7 +37,13 @@ namespace winrt::Windows::Xbox::Management::Deployment::implementation
}
winrt::Windows::Xbox::Management::Deployment::PackageTransferManager PackageTransferManager::Current()
{
throw hresult_not_implemented();
if (static_manager == Deployment::PackageTransferManager{ nullptr })
{
static_manager = make<PackageTransferManager>( );
}
printf("PackageTransferManager::Current()\n");
return static_manager;
}
winrt::Windows::Xbox::Management::Deployment::PackageTransferManager PackageTransferManager::Create(winrt::Windows::ApplicationModel::Package const& package)
{
@@ -49,7 +55,8 @@ namespace winrt::Windows::Xbox::Management::Deployment::implementation
}
bool PackageTransferManager::IsChunkInstalled(uint32_t chunkId)
{
throw hresult_not_implemented();
printf("PackageTransferManager::IsChunkInstalled() STUBBED\n");
return true;
}
bool PackageTransferManager::AreChunksInstalled(winrt::Windows::Foundation::Collections::IIterable<uint32_t> const& chunkIds)
{

View File

@@ -42,6 +42,8 @@ namespace winrt::Windows::Xbox::Management::Deployment::implementation
winrt::Windows::Xbox::Management::Deployment::InstallationState GetInstallationState(winrt::Windows::Xbox::Management::Deployment::ChunkSpecifiers const& specifiers);
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Xbox::Management::Deployment::PackageTransferWatcher> AddChunkSpecifiersAsync(winrt::Windows::Xbox::Management::Deployment::ChunkSpecifiers additionalSpecifiers);
winrt::Windows::Foundation::IAsyncAction RemoveChunkSpecifiersAsync(winrt::Windows::Xbox::Management::Deployment::ChunkSpecifiers removeSpecifiers);
inline static Deployment::PackageTransferManager static_manager = { nullptr };
};
}
namespace winrt::Windows::Xbox::Management::Deployment::factory_implementation

View File

@@ -58,6 +58,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -76,6 +77,7 @@
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>

View File

@@ -15,7 +15,7 @@ make-link("d3d11_x.dll")
make-link("etwplus.dll")
make-link("kernelx.dll")
make-link("mfplat.dll")
#make-link("MMDevAPI.dll")
make-link("MMDevAPI.dll")
make-link("XboxIntegratedMultiplayer.dll")
make-link("xg_x.dll")
make-link("XFrontPanelDisplay.dll")