diff --git a/DDrawCompat/D3dDdi/AdapterCallbacks.h b/DDrawCompat/D3dDdi/AdapterCallbacks.h index 823bcca..a14d074 100644 --- a/DDrawCompat/D3dDdi/AdapterCallbacks.h +++ b/DDrawCompat/D3dDdi/AdapterCallbacks.h @@ -1,5 +1,10 @@ #pragma once +#define CINTERFACE + +#include +#include + #include "Common/CompatVtable.h" #include "D3dDdi/Visitors/AdapterCallbacksVisitor.h" diff --git a/DDrawCompat/D3dDdi/AdapterFuncs.h b/DDrawCompat/D3dDdi/AdapterFuncs.h index b6551d3..f7006aa 100644 --- a/DDrawCompat/D3dDdi/AdapterFuncs.h +++ b/DDrawCompat/D3dDdi/AdapterFuncs.h @@ -1,5 +1,10 @@ #pragma once +#define CINTERFACE + +#include +#include + #include "Common/CompatVtable.h" #include "D3dDdi/Visitors/AdapterFuncsVisitor.h" diff --git a/DDrawCompat/D3dDdi/DeviceCallbacks.cpp b/DDrawCompat/D3dDdi/DeviceCallbacks.cpp index d4783b5..915bad1 100644 --- a/DDrawCompat/D3dDdi/DeviceCallbacks.cpp +++ b/DDrawCompat/D3dDdi/DeviceCallbacks.cpp @@ -1,100 +1,5 @@ -#define CINTERFACE - -#include -#include <../km/d3dkmthk.h> - -#include "Common/Hook.h" -#include "Common/Log.h" #include "D3dDdi/DeviceCallbacks.h" -std::ostream& operator<<(std::ostream& os, const D3DDDI_ALLOCATIONINFO& data) -{ - return Compat::LogStruct(os) - << Compat::hex(data.hAllocation) - << data.pSystemMem - << data.pPrivateDriverData - << data.PrivateDriverDataSize - << data.VidPnSourceId - << Compat::hex(data.Flags.Value); -} - -std::ostream& operator<<(std::ostream& os, const D3DDDICB_ALLOCATE& data) -{ - return Compat::LogStruct(os) - << data.pPrivateDriverData - << data.PrivateDriverDataSize - << data.hResource - << Compat::hex(data.hKMResource) - << data.NumAllocations - << Compat::array(data.pAllocationInfo, data.NumAllocations); -} - -std::ostream& operator<<(std::ostream& os, const D3DKMT_CREATEALLOCATION& data) -{ - return Compat::LogStruct(os) - << Compat::hex(data.hDevice) - << Compat::hex(data.hResource) - << Compat::hex(data.hGlobalShare) - << data.pPrivateRuntimeData - << data.PrivateRuntimeDataSize - << data.pPrivateDriverData - << data.PrivateDriverDataSize - << data.NumAllocations - << Compat::array(data.pAllocationInfo, data.NumAllocations) - << Compat::hex(*reinterpret_cast(&data.Flags)) - << data.hPrivateRuntimeResourceHandle; -} - -std::ostream& operator<<(std::ostream& os, const D3DDDICB_DEALLOCATE& data) -{ - return Compat::LogStruct(os) - << data.hResource - << data.NumAllocations - << Compat::hex(Compat::array(data.HandleList, data.NumAllocations)); -} - -std::ostream& operator<<(std::ostream& os, const D3DDDICB_DEALLOCATE2& data) -{ - return Compat::LogStruct(os) - << data.hResource - << data.NumAllocations - << Compat::hex(Compat::array(data.HandleList, data.NumAllocations)) - << Compat::hex(data.Flags.Value); -} - -std::ostream& operator<<(std::ostream& os, const D3DDDICB_LOCK& data) -{ - return Compat::LogStruct(os) - << Compat::hex(data.hAllocation) - << data.PrivateDriverData - << data.NumPages - << Compat::array(data.pPages, data.NumPages) - << data.pData - << Compat::hex(data.Flags.Value) - << Compat::hex(data.GpuVirtualAddress); -} - -std::ostream& operator<<(std::ostream& os, const D3DDDICB_LOCK2& data) -{ - return Compat::LogStruct(os) - << Compat::hex(data.hAllocation) - << Compat::hex(data.Flags.Value) - << data.pData; -} - -std::ostream& operator<<(std::ostream& os, const D3DDDICB_UNLOCK& data) -{ - return Compat::LogStruct(os) - << data.NumAllocations - << Compat::hex(Compat::array(data.phAllocations, data.NumAllocations)); -} - -std::ostream& operator<<(std::ostream& os, const D3DDDICB_UNLOCK2& data) -{ - return Compat::LogStruct(os) - << Compat::hex(data.hAllocation); -} - namespace D3dDdi { void DeviceCallbacks::setCompatVtable(D3DDDI_DEVICECALLBACKS& /*vtable*/) diff --git a/DDrawCompat/D3dDdi/DeviceCallbacks.h b/DDrawCompat/D3dDdi/DeviceCallbacks.h index 69c71ca..234e71e 100644 --- a/DDrawCompat/D3dDdi/DeviceCallbacks.h +++ b/DDrawCompat/D3dDdi/DeviceCallbacks.h @@ -1,16 +1,13 @@ #pragma once -#include "Common/CompatVtable.h" -#include "D3dDdi/Visitors/DeviceCallbacksVisitor.h" +#define CINTERFACE -std::ostream& operator<<(std::ostream& os, const D3DDDI_ALLOCATIONINFO& data); -std::ostream& operator<<(std::ostream& os, const D3DDDICB_ALLOCATE& data); -std::ostream& operator<<(std::ostream& os, const D3DDDICB_DEALLOCATE& data); -std::ostream& operator<<(std::ostream& os, const D3DDDICB_DEALLOCATE2& data); -std::ostream& operator<<(std::ostream& os, const D3DDDICB_LOCK& data); -std::ostream& operator<<(std::ostream& os, const D3DDDICB_LOCK2& data); -std::ostream& operator<<(std::ostream& os, const D3DDDICB_UNLOCK& data); -std::ostream& operator<<(std::ostream& os, const D3DDDICB_UNLOCK2& data); +#include +#include + +#include "Common/CompatVtable.h" +#include "D3dDdi/Log/DeviceCallbacksLog.h" +#include "D3dDdi/Visitors/DeviceCallbacksVisitor.h" namespace D3dDdi { diff --git a/DDrawCompat/D3dDdi/DeviceFuncs.cpp b/DDrawCompat/D3dDdi/DeviceFuncs.cpp index 65c8722..7297013 100644 --- a/DDrawCompat/D3dDdi/DeviceFuncs.cpp +++ b/DDrawCompat/D3dDdi/DeviceFuncs.cpp @@ -1,104 +1,5 @@ #include "D3dDdi/DeviceFuncs.h" -std::ostream& operator<<(std::ostream& os, const D3DDDI_RATIONAL& val) -{ - return Compat::LogStruct(os) - << val.Numerator - << val.Denominator; -} - -std::ostream& operator<<(std::ostream& os, const D3DDDI_SURFACEINFO& val) -{ - return Compat::LogStruct(os) - << val.Width - << val.Height - << val.Depth - << val.pSysMem - << val.SysMemPitch - << val.SysMemSlicePitch; -} - -std::ostream& operator<<(std::ostream& os, const D3DDDIARG_CREATERESOURCE& val) -{ - return Compat::LogStruct(os) - << val.Format - << val.Pool - << val.MultisampleType - << val.MultisampleQuality - << Compat::array(val.pSurfList, val.SurfCount) - << val.SurfCount - << val.MipLevels - << val.Fvf - << val.VidPnSourceId - << val.RefreshRate - << val.hResource - << Compat::hex(val.Flags.Value) - << val.Rotation; -} - -std::ostream& operator<<(std::ostream& os, const D3DDDIARG_CREATERESOURCE2& val) -{ - return Compat::LogStruct(os) - << val.Format - << val.Pool - << val.MultisampleType - << val.MultisampleQuality - << Compat::array(val.pSurfList, val.SurfCount) - << val.SurfCount - << val.MipLevels - << val.Fvf - << val.VidPnSourceId - << val.RefreshRate - << val.hResource - << Compat::hex(val.Flags.Value) - << val.Rotation - << Compat::hex(val.Flags2.Value); -} - -std::ostream& operator<<(std::ostream& os, const D3DDDIARG_LOCK& val) -{ - return Compat::LogStruct(os) - << val.hResource - << val.SubResourceIndex - << val.Box - << val.pSurfData - << val.Pitch - << val.SlicePitch - << Compat::hex(val.Flags.Value); -} - -std::ostream& operator<<(std::ostream& os, const D3DDDIARG_OPENRESOURCE& val) -{ - return Compat::LogStruct(os) - << val.NumAllocations - << Compat::array(val.pOpenAllocationInfo, val.NumAllocations) - << Compat::hex(val.hKMResource) - << val.pPrivateDriverData - << val.PrivateDriverDataSize - << val.hResource - << val.Rotation - << Compat::hex(val.Flags.Value); -} - -std::ostream& operator<<(std::ostream& os, const D3DDDIARG_UNLOCK& val) -{ - return Compat::LogStruct(os) - << val.hResource - << val.SubResourceIndex - << Compat::hex(val.Flags.Value); -} - -std::ostream& operator<<(std::ostream& os, const D3DDDIBOX& box) -{ - return Compat::LogStruct(os) - << box.Left - << box.Top - << box.Right - << box.Bottom - << box.Front - << box.Back; -} - namespace { D3DDDI_DEVICEFUNCS& getOrigVtable(HANDLE device); diff --git a/DDrawCompat/D3dDdi/DeviceFuncs.h b/DDrawCompat/D3dDdi/DeviceFuncs.h index 838584c..e334076 100644 --- a/DDrawCompat/D3dDdi/DeviceFuncs.h +++ b/DDrawCompat/D3dDdi/DeviceFuncs.h @@ -1,16 +1,13 @@ #pragma once -#include "Common/CompatVtable.h" -#include "D3dDdi/Visitors/DeviceFuncsVisitor.h" +#define CINTERFACE -std::ostream& operator<<(std::ostream& os, const D3DDDI_RATIONAL& val); -std::ostream& operator<<(std::ostream& os, const D3DDDI_SURFACEINFO& val); -std::ostream& operator<<(std::ostream& os, const D3DDDIARG_CREATERESOURCE& val); -std::ostream& operator<<(std::ostream& os, const D3DDDIARG_CREATERESOURCE2& val); -std::ostream& operator<<(std::ostream& os, const D3DDDIARG_LOCK& val); -std::ostream& operator<<(std::ostream& os, const D3DDDIARG_OPENRESOURCE& val); -std::ostream& operator<<(std::ostream& os, const D3DDDIARG_UNLOCK& val); -std::ostream& operator<<(std::ostream& os, const D3DDDIBOX& val); +#include +#include + +#include "Common/CompatVtable.h" +#include "D3dDdi/Log/DeviceFuncsLog.h" +#include "D3dDdi/Visitors/DeviceFuncsVisitor.h" namespace D3dDdi { diff --git a/DDrawCompat/D3dDdi/Log/DeviceCallbacksLog.cpp b/DDrawCompat/D3dDdi/Log/DeviceCallbacksLog.cpp new file mode 100644 index 0000000..5a9d602 --- /dev/null +++ b/DDrawCompat/D3dDdi/Log/DeviceCallbacksLog.cpp @@ -0,0 +1,90 @@ +#include "Common/Log.h" +#include "D3dDdi/Log/DeviceCallbacksLog.h" + +std::ostream& operator<<(std::ostream& os, const D3DDDI_ALLOCATIONINFO& data) +{ + return Compat::LogStruct(os) + << Compat::hex(data.hAllocation) + << data.pSystemMem + << data.pPrivateDriverData + << data.PrivateDriverDataSize + << data.VidPnSourceId + << Compat::hex(data.Flags.Value); +} + +std::ostream& operator<<(std::ostream& os, const D3DDDICB_ALLOCATE& data) +{ + return Compat::LogStruct(os) + << data.pPrivateDriverData + << data.PrivateDriverDataSize + << data.hResource + << Compat::hex(data.hKMResource) + << data.NumAllocations + << Compat::array(data.pAllocationInfo, data.NumAllocations); +} + +std::ostream& operator<<(std::ostream& os, const D3DKMT_CREATEALLOCATION& data) +{ + return Compat::LogStruct(os) + << Compat::hex(data.hDevice) + << Compat::hex(data.hResource) + << Compat::hex(data.hGlobalShare) + << data.pPrivateRuntimeData + << data.PrivateRuntimeDataSize + << data.pPrivateDriverData + << data.PrivateDriverDataSize + << data.NumAllocations + << Compat::array(data.pAllocationInfo, data.NumAllocations) + << Compat::hex(*reinterpret_cast(&data.Flags)) + << data.hPrivateRuntimeResourceHandle; +} + +std::ostream& operator<<(std::ostream& os, const D3DDDICB_DEALLOCATE& data) +{ + return Compat::LogStruct(os) + << data.hResource + << data.NumAllocations + << Compat::hex(Compat::array(data.HandleList, data.NumAllocations)); +} + +std::ostream& operator<<(std::ostream& os, const D3DDDICB_DEALLOCATE2& data) +{ + return Compat::LogStruct(os) + << data.hResource + << data.NumAllocations + << Compat::hex(Compat::array(data.HandleList, data.NumAllocations)) + << Compat::hex(data.Flags.Value); +} + +std::ostream& operator<<(std::ostream& os, const D3DDDICB_LOCK& data) +{ + return Compat::LogStruct(os) + << Compat::hex(data.hAllocation) + << data.PrivateDriverData + << data.NumPages + << Compat::array(data.pPages, data.NumPages) + << data.pData + << Compat::hex(data.Flags.Value) + << Compat::hex(data.GpuVirtualAddress); +} + +std::ostream& operator<<(std::ostream& os, const D3DDDICB_LOCK2& data) +{ + return Compat::LogStruct(os) + << Compat::hex(data.hAllocation) + << Compat::hex(data.Flags.Value) + << data.pData; +} + +std::ostream& operator<<(std::ostream& os, const D3DDDICB_UNLOCK& data) +{ + return Compat::LogStruct(os) + << data.NumAllocations + << Compat::hex(Compat::array(data.phAllocations, data.NumAllocations)); +} + +std::ostream& operator<<(std::ostream& os, const D3DDDICB_UNLOCK2& data) +{ + return Compat::LogStruct(os) + << Compat::hex(data.hAllocation); +} diff --git a/DDrawCompat/D3dDdi/Log/DeviceCallbacksLog.h b/DDrawCompat/D3dDdi/Log/DeviceCallbacksLog.h new file mode 100644 index 0000000..a286eed --- /dev/null +++ b/DDrawCompat/D3dDdi/Log/DeviceCallbacksLog.h @@ -0,0 +1,18 @@ +#pragma once + +#define CINTERFACE + +#include + +#include +#include +#include <../km/d3dkmthk.h> + +std::ostream& operator<<(std::ostream& os, const D3DDDI_ALLOCATIONINFO& data); +std::ostream& operator<<(std::ostream& os, const D3DDDICB_ALLOCATE& data); +std::ostream& operator<<(std::ostream& os, const D3DDDICB_DEALLOCATE& data); +std::ostream& operator<<(std::ostream& os, const D3DDDICB_DEALLOCATE2& data); +std::ostream& operator<<(std::ostream& os, const D3DDDICB_LOCK& data); +std::ostream& operator<<(std::ostream& os, const D3DDDICB_LOCK2& data); +std::ostream& operator<<(std::ostream& os, const D3DDDICB_UNLOCK& data); +std::ostream& operator<<(std::ostream& os, const D3DDDICB_UNLOCK2& data); diff --git a/DDrawCompat/D3dDdi/Log/DeviceFuncsLog.cpp b/DDrawCompat/D3dDdi/Log/DeviceFuncsLog.cpp new file mode 100644 index 0000000..e299fea --- /dev/null +++ b/DDrawCompat/D3dDdi/Log/DeviceFuncsLog.cpp @@ -0,0 +1,101 @@ +#include "Common/Log.h" +#include "D3dDdi/Log/DeviceFuncsLog.h" + +std::ostream& operator<<(std::ostream& os, const D3DDDI_RATIONAL& val) +{ + return Compat::LogStruct(os) + << val.Numerator + << val.Denominator; +} + +std::ostream& operator<<(std::ostream& os, const D3DDDI_SURFACEINFO& val) +{ + return Compat::LogStruct(os) + << val.Width + << val.Height + << val.Depth + << val.pSysMem + << val.SysMemPitch + << val.SysMemSlicePitch; +} + +std::ostream& operator<<(std::ostream& os, const D3DDDIARG_CREATERESOURCE& val) +{ + return Compat::LogStruct(os) + << val.Format + << val.Pool + << val.MultisampleType + << val.MultisampleQuality + << Compat::array(val.pSurfList, val.SurfCount) + << val.SurfCount + << val.MipLevels + << val.Fvf + << val.VidPnSourceId + << val.RefreshRate + << val.hResource + << Compat::hex(val.Flags.Value) + << val.Rotation; +} + +std::ostream& operator<<(std::ostream& os, const D3DDDIARG_CREATERESOURCE2& val) +{ + return Compat::LogStruct(os) + << val.Format + << val.Pool + << val.MultisampleType + << val.MultisampleQuality + << Compat::array(val.pSurfList, val.SurfCount) + << val.SurfCount + << val.MipLevels + << val.Fvf + << val.VidPnSourceId + << val.RefreshRate + << val.hResource + << Compat::hex(val.Flags.Value) + << val.Rotation + << Compat::hex(val.Flags2.Value); +} + +std::ostream& operator<<(std::ostream& os, const D3DDDIARG_LOCK& val) +{ + return Compat::LogStruct(os) + << val.hResource + << val.SubResourceIndex + << val.Box + << val.pSurfData + << val.Pitch + << val.SlicePitch + << Compat::hex(val.Flags.Value); +} + +std::ostream& operator<<(std::ostream& os, const D3DDDIARG_OPENRESOURCE& val) +{ + return Compat::LogStruct(os) + << val.NumAllocations + << Compat::array(val.pOpenAllocationInfo, val.NumAllocations) + << Compat::hex(val.hKMResource) + << val.pPrivateDriverData + << val.PrivateDriverDataSize + << val.hResource + << val.Rotation + << Compat::hex(val.Flags.Value); +} + +std::ostream& operator<<(std::ostream& os, const D3DDDIARG_UNLOCK& val) +{ + return Compat::LogStruct(os) + << val.hResource + << val.SubResourceIndex + << Compat::hex(val.Flags.Value); +} + +std::ostream& operator<<(std::ostream& os, const D3DDDIBOX& box) +{ + return Compat::LogStruct(os) + << box.Left + << box.Top + << box.Right + << box.Bottom + << box.Front + << box.Back; +} diff --git a/DDrawCompat/D3dDdi/Log/DeviceFuncsLog.h b/DDrawCompat/D3dDdi/Log/DeviceFuncsLog.h new file mode 100644 index 0000000..7b30631 --- /dev/null +++ b/DDrawCompat/D3dDdi/Log/DeviceFuncsLog.h @@ -0,0 +1,17 @@ +#pragma once + +#define CINTERFACE + +#include + +#include +#include + +std::ostream& operator<<(std::ostream& os, const D3DDDI_RATIONAL& val); +std::ostream& operator<<(std::ostream& os, const D3DDDI_SURFACEINFO& val); +std::ostream& operator<<(std::ostream& os, const D3DDDIARG_CREATERESOURCE& val); +std::ostream& operator<<(std::ostream& os, const D3DDDIARG_CREATERESOURCE2& val); +std::ostream& operator<<(std::ostream& os, const D3DDDIARG_LOCK& val); +std::ostream& operator<<(std::ostream& os, const D3DDDIARG_OPENRESOURCE& val); +std::ostream& operator<<(std::ostream& os, const D3DDDIARG_UNLOCK& val); +std::ostream& operator<<(std::ostream& os, const D3DDDIBOX& val); diff --git a/DDrawCompat/DDrawCompat.vcxproj b/DDrawCompat/DDrawCompat.vcxproj index 07f24aa..869bb88 100644 --- a/DDrawCompat/DDrawCompat.vcxproj +++ b/DDrawCompat/DDrawCompat.vcxproj @@ -169,6 +169,8 @@ + + @@ -230,6 +232,8 @@ + + diff --git a/DDrawCompat/DDrawCompat.vcxproj.filters b/DDrawCompat/DDrawCompat.vcxproj.filters index 467dcb5..9b7c034 100644 --- a/DDrawCompat/DDrawCompat.vcxproj.filters +++ b/DDrawCompat/DDrawCompat.vcxproj.filters @@ -73,6 +73,12 @@ {c60f8247-4d67-4dcf-9f97-f1c5b1acc469} + + {c682b098-a0f4-405e-b39e-1b1bc484cdf9} + + + {c4d03748-2333-40af-90c7-ae875b07434f} + @@ -276,6 +282,12 @@ Header Files\Direct3d + + Header Files\D3dDdi\Log + + + Header Files\D3dDdi\Log + @@ -416,6 +428,12 @@ Source Files\Direct3d + + Source Files\D3dDdi\Log + + + Source Files\D3dDdi\Log +