├── .gitignore ├── Common ├── License.txt └── Logging.h ├── DirectX Wrappers.sln ├── DirectX81SDK └── include │ ├── d3d.h │ ├── d3d8.h │ ├── d3d8caps.h │ ├── d3d8types.h │ ├── ddraw.h │ └── ddrawex.h ├── License.txt ├── README.md ├── d3d8 ├── AddressLookupTable.h ├── IDirect3D8.cpp ├── IDirect3D8.h ├── IDirect3DCubeTexture8.cpp ├── IDirect3DCubeTexture8.h ├── IDirect3DDevice8.cpp ├── IDirect3DDevice8.h ├── IDirect3DIndexBuffer8.cpp ├── IDirect3DIndexBuffer8.h ├── IDirect3DSurface8.cpp ├── IDirect3DSurface8.h ├── IDirect3DSwapChain8.cpp ├── IDirect3DSwapChain8.h ├── IDirect3DTexture8.cpp ├── IDirect3DTexture8.h ├── IDirect3DVertexBuffer8.cpp ├── IDirect3DVertexBuffer8.h ├── IDirect3DVolume8.cpp ├── IDirect3DVolume8.h ├── IDirect3DVolumeTexture8.cpp ├── IDirect3DVolumeTexture8.h ├── InterfaceQuery.cpp ├── License.txt ├── d3d8.def ├── d3d8.h ├── d3d8.vcxproj └── dllmain.cpp ├── d3d9 ├── AddressLookupTable.h ├── IDirect3D9Ex.cpp ├── IDirect3D9Ex.h ├── IDirect3DCubeTexture9.cpp ├── IDirect3DCubeTexture9.h ├── IDirect3DDevice9Ex.cpp ├── IDirect3DDevice9Ex.h ├── IDirect3DIndexBuffer9.cpp ├── IDirect3DIndexBuffer9.h ├── IDirect3DPixelShader9.cpp ├── IDirect3DPixelShader9.h ├── IDirect3DQuery9.cpp ├── IDirect3DQuery9.h ├── IDirect3DStateBlock9.cpp ├── IDirect3DStateBlock9.h ├── IDirect3DSurface9.cpp ├── IDirect3DSurface9.h ├── IDirect3DSwapChain9Ex.cpp ├── IDirect3DSwapChain9Ex.h ├── IDirect3DTexture9.cpp ├── IDirect3DTexture9.h ├── IDirect3DVertexBuffer9.cpp ├── IDirect3DVertexBuffer9.h ├── IDirect3DVertexDeclaration9.cpp ├── IDirect3DVertexDeclaration9.h ├── IDirect3DVertexShader9.cpp ├── IDirect3DVertexShader9.h ├── IDirect3DVolume9.cpp ├── IDirect3DVolume9.h ├── IDirect3DVolumeTexture9.cpp ├── IDirect3DVolumeTexture9.h ├── InterfaceQuery.cpp ├── License.txt ├── d3d9.def ├── d3d9.h ├── d3d9.vcxproj └── dllmain.cpp ├── ddraw ├── AddressLookupTable.h ├── IDirect3DDeviceX.cpp ├── IDirect3DDeviceX.h ├── IDirect3DExecuteBuffer.cpp ├── IDirect3DExecuteBuffer.h ├── IDirect3DLight.cpp ├── IDirect3DLight.h ├── IDirect3DMaterialX.cpp ├── IDirect3DMaterialX.h ├── IDirect3DTextureX.cpp ├── IDirect3DTextureX.h ├── IDirect3DVertexBufferX.cpp ├── IDirect3DVertexBufferX.h ├── IDirect3DViewportX.cpp ├── IDirect3DViewportX.h ├── IDirect3DX.cpp ├── IDirect3DX.h ├── IDirectDrawClipper.cpp ├── IDirectDrawClipper.h ├── IDirectDrawColorControl.cpp ├── IDirectDrawColorControl.h ├── IDirectDrawFactory.cpp ├── IDirectDrawFactory.h ├── IDirectDrawGammaControl.cpp ├── IDirectDrawGammaControl.h ├── IDirectDrawPalette.cpp ├── IDirectDrawPalette.h ├── IDirectDrawSurfaceX.cpp ├── IDirectDrawSurfaceX.h ├── IDirectDrawX.cpp ├── IDirectDrawX.h ├── InterfaceQuery.cpp ├── License.txt ├── Versions │ ├── IDirect3D.cpp │ ├── IDirect3D.h │ ├── IDirect3D2.cpp │ ├── IDirect3D2.h │ ├── IDirect3D3.cpp │ ├── IDirect3D3.h │ ├── IDirect3D7.cpp │ ├── IDirect3D7.h │ ├── IDirect3DDevice.cpp │ ├── IDirect3DDevice.h │ ├── IDirect3DDevice2.cpp │ ├── IDirect3DDevice2.h │ ├── IDirect3DDevice3.cpp │ ├── IDirect3DDevice3.h │ ├── IDirect3DDevice7.cpp │ ├── IDirect3DDevice7.h │ ├── IDirect3DMaterial.cpp │ ├── IDirect3DMaterial.h │ ├── IDirect3DMaterial2.cpp │ ├── IDirect3DMaterial2.h │ ├── IDirect3DMaterial3.cpp │ ├── IDirect3DMaterial3.h │ ├── IDirect3DTexture.cpp │ ├── IDirect3DTexture.h │ ├── IDirect3DTexture2.cpp │ ├── IDirect3DTexture2.h │ ├── IDirect3DVertexBuffer.cpp │ ├── IDirect3DVertexBuffer.h │ ├── IDirect3DVertexBuffer7.cpp │ ├── IDirect3DVertexBuffer7.h │ ├── IDirect3DViewport.cpp │ ├── IDirect3DViewport.h │ ├── IDirect3DViewport2.cpp │ ├── IDirect3DViewport2.h │ ├── IDirect3DViewport3.cpp │ ├── IDirect3DViewport3.h │ ├── IDirectDraw.cpp │ ├── IDirectDraw.h │ ├── IDirectDraw2.cpp │ ├── IDirectDraw2.h │ ├── IDirectDraw3.cpp │ ├── IDirectDraw3.h │ ├── IDirectDraw4.cpp │ ├── IDirectDraw4.h │ ├── IDirectDraw7.cpp │ ├── IDirectDraw7.h │ ├── IDirectDrawSurface.cpp │ ├── IDirectDrawSurface.h │ ├── IDirectDrawSurface2.cpp │ ├── IDirectDrawSurface2.h │ ├── IDirectDrawSurface3.cpp │ ├── IDirectDrawSurface3.h │ ├── IDirectDrawSurface4.cpp │ ├── IDirectDrawSurface4.h │ ├── IDirectDrawSurface7.cpp │ ├── IDirectDrawSurface7.h │ └── License.txt ├── ddraw.def ├── ddraw.h ├── ddraw.vcxproj ├── ddraw.vcxproj.filters └── dllmain.cpp ├── dinput ├── AddressLookupTable.h ├── IDirectInputDeviceX.cpp ├── IDirectInputDeviceX.h ├── IDirectInputEffect.cpp ├── IDirectInputEffect.h ├── IDirectInputX.cpp ├── IDirectInputX.h ├── InterfaceQuery.cpp ├── License.txt ├── Versions │ ├── IDirectInput2A.cpp │ ├── IDirectInput2A.h │ ├── IDirectInput2W.cpp │ ├── IDirectInput2W.h │ ├── IDirectInput7A.cpp │ ├── IDirectInput7A.h │ ├── IDirectInput7W.cpp │ ├── IDirectInput7W.h │ ├── IDirectInputA.cpp │ ├── IDirectInputA.h │ ├── IDirectInputDevice2A.cpp │ ├── IDirectInputDevice2A.h │ ├── IDirectInputDevice2W.cpp │ ├── IDirectInputDevice2W.h │ ├── IDirectInputDevice7A.cpp │ ├── IDirectInputDevice7A.h │ ├── IDirectInputDevice7W.cpp │ ├── IDirectInputDevice7W.h │ ├── IDirectInputDeviceA.cpp │ ├── IDirectInputDeviceA.h │ ├── IDirectInputDeviceW.cpp │ ├── IDirectInputDeviceW.h │ ├── IDirectInputW.cpp │ ├── IDirectInputW.h │ └── License.txt ├── dinput.def ├── dinput.h ├── dinput.vcxproj ├── dinput.vcxproj.filters └── dllmain.cpp ├── dinput8 ├── AddressLookupTable.h ├── IDirectInput8A.cpp ├── IDirectInput8A.h ├── IDirectInput8W.cpp ├── IDirectInput8W.h ├── IDirectInputDevice8A.cpp ├── IDirectInputDevice8A.h ├── IDirectInputDevice8W.cpp ├── IDirectInputDevice8W.h ├── IDirectInputEffect.cpp ├── IDirectInputEffect.h ├── InterfaceQuery.cpp ├── License.txt ├── dinput8.def ├── dinput8.h ├── dinput8.vcxproj └── dllmain.cpp └── dsound ├── AddressLookupTable.h ├── IDirectSound3DBuffer8.cpp ├── IDirectSound3DBuffer8.h ├── IDirectSound3DListener8.cpp ├── IDirectSound3DListener8.h ├── IDirectSound8.cpp ├── IDirectSound8.h ├── IDirectSoundBuffer8.cpp ├── IDirectSoundBuffer8.h ├── IDirectSoundCapture8.cpp ├── IDirectSoundCapture8.h ├── IDirectSoundCaptureBuffer8.cpp ├── IDirectSoundCaptureBuffer8.h ├── IDirectSoundCaptureFXAec8.cpp ├── IDirectSoundCaptureFXAec8.h ├── IDirectSoundCaptureFXNoiseSuppress8.cpp ├── IDirectSoundCaptureFXNoiseSuppress8.h ├── IDirectSoundFXChorus8.cpp ├── IDirectSoundFXChorus8.h ├── IDirectSoundFXCompressor8.cpp ├── IDirectSoundFXCompressor8.h ├── IDirectSoundFXDistortion8.cpp ├── IDirectSoundFXDistortion8.h ├── IDirectSoundFXEcho8.cpp ├── IDirectSoundFXEcho8.h ├── IDirectSoundFXFlanger8.cpp ├── IDirectSoundFXFlanger8.h ├── IDirectSoundFXGargle8.cpp ├── IDirectSoundFXGargle8.h ├── IDirectSoundFXI3DL2Reverb8.cpp ├── IDirectSoundFXI3DL2Reverb8.h ├── IDirectSoundFXParamEq8.cpp ├── IDirectSoundFXParamEq8.h ├── IDirectSoundFXWavesReverb8.cpp ├── IDirectSoundFXWavesReverb8.h ├── IDirectSoundFullDuplex8.cpp ├── IDirectSoundFullDuplex8.h ├── IDirectSoundNotify8.cpp ├── IDirectSoundNotify8.h ├── IKsPropertySet.cpp ├── IKsPropertySet.h ├── InterfaceQuery.cpp ├── License.txt ├── dllmain.cpp ├── dsound.def ├── dsound.h └── dsound.vcxproj /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | 6 | # Compiled Dynamic libraries 7 | *.so 8 | *.dylib 9 | 10 | # Compiled Static libraries 11 | *.lai 12 | *.la 13 | *.a 14 | 15 | # Visual Studio files 16 | .vs/ 17 | *.db 18 | *.opendb 19 | *.vcxproj.user 20 | 21 | Release/ 22 | Debug/ 23 | */Release/ 24 | */Debug/ 25 | ipch/ 26 | *.opensdf 27 | *.sdf 28 | -------------------------------------------------------------------------------- /Common/License.txt: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ -------------------------------------------------------------------------------- /Common/Logging.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | class Log 7 | { 8 | public: 9 | Log() {} 10 | ~Log() 11 | { 12 | if (LOG.is_open()) 13 | { 14 | LOG << std::endl; 15 | } 16 | } 17 | 18 | template 19 | Log& operator<<(const T& t) 20 | { 21 | if (LOG.is_open()) 22 | { 23 | LOG << t; 24 | } 25 | return *this; 26 | } 27 | private: 28 | static std::ofstream LOG; 29 | }; 30 | 31 | static std::ostream& operator<<(std::ostream& os, const wchar_t* wchr) 32 | { 33 | std::wstring ws(wchr); 34 | return os << std::string(ws.begin(), ws.end()).c_str(); 35 | } 36 | 37 | static void logf(char * fmt, ...) 38 | { 39 | va_list ap; 40 | va_start(ap, fmt); 41 | auto size = vsnprintf(nullptr, 0, fmt, ap); 42 | std::string output(size + 1, '\0'); 43 | vsprintf_s(&output[0], size + 1, fmt, ap); 44 | Log() << output.c_str(); 45 | va_end(ap); 46 | } 47 | 48 | static void logf(wchar_t * fmt, ...) 49 | { 50 | va_list ap; 51 | va_start(ap, fmt); 52 | #pragma warning(suppress: 4996) 53 | auto size = _vsnwprintf(nullptr, 0, fmt, ap); 54 | std::wstring output(size + 1, '\0'); 55 | vswprintf_s(&output[0], size + 1, fmt, ap); 56 | Log() << output.c_str(); 57 | va_end(ap); 58 | } 59 | -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ -------------------------------------------------------------------------------- /d3d8/IDirect3D8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3D8 : public IDirect3D8 4 | { 5 | private: 6 | LPDIRECT3D8 ProxyInterface; 7 | 8 | public: 9 | m_IDirect3D8(LPDIRECT3D8 pD3D) : ProxyInterface(pD3D) { } 10 | 11 | /*** IUnknown methods ***/ 12 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 13 | STDMETHOD_(ULONG, AddRef)(THIS); 14 | STDMETHOD_(ULONG, Release)(THIS); 15 | 16 | /*** IDirect3D8 methods ***/ 17 | STDMETHOD(RegisterSoftwareDevice)(THIS_ void* pInitializeFunction); 18 | STDMETHOD_(UINT, GetAdapterCount)(THIS); 19 | STDMETHOD(GetAdapterIdentifier)(THIS_ UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER8* pIdentifier); 20 | STDMETHOD_(UINT, GetAdapterModeCount)(THIS_ UINT Adapter); 21 | STDMETHOD(EnumAdapterModes)(THIS_ UINT Adapter, UINT Mode, D3DDISPLAYMODE* pMode); 22 | STDMETHOD(GetAdapterDisplayMode)(THIS_ UINT Adapter, D3DDISPLAYMODE* pMode); 23 | STDMETHOD(CheckDeviceType)(THIS_ UINT Adapter, D3DDEVTYPE DevType, D3DFORMAT AdapterFormat, D3DFORMAT BackBufferFormat, BOOL bWindowed); 24 | STDMETHOD(CheckDeviceFormat)(THIS_ UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat); 25 | STDMETHOD(CheckDeviceMultiSampleType)(THIS_ UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType); 26 | STDMETHOD(CheckDepthStencilMatch)(THIS_ UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat); 27 | STDMETHOD(GetDeviceCaps)(THIS_ UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS8* pCaps); 28 | STDMETHOD_(HMONITOR, GetAdapterMonitor)(THIS_ UINT Adapter); 29 | STDMETHOD(CreateDevice)(THIS_ UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DDevice8** ppReturnedDeviceInterface); 30 | }; 31 | -------------------------------------------------------------------------------- /d3d8/IDirect3DCubeTexture8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DCubeTexture8 : public IDirect3DCubeTexture8, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECT3DCUBETEXTURE8 ProxyInterface; 7 | m_IDirect3DDevice8* m_pDevice; 8 | 9 | public: 10 | m_IDirect3DCubeTexture8(LPDIRECT3DCUBETEXTURE8 pTexture8, m_IDirect3DDevice8* pDevice) : ProxyInterface(pTexture8), m_pDevice(pDevice) 11 | { 12 | m_pDevice->ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); 13 | } 14 | ~m_IDirect3DCubeTexture8() {} 15 | 16 | LPDIRECT3DCUBETEXTURE8 GetProxyInterface() { return ProxyInterface; } 17 | 18 | /*** IUnknown methods ***/ 19 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj); 20 | STDMETHOD_(ULONG, AddRef)(THIS); 21 | STDMETHOD_(ULONG, Release)(THIS); 22 | 23 | /*** IDirect3DBaseTexture8 methods ***/ 24 | STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice); 25 | STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags); 26 | STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid, void* pData, DWORD* pSizeOfData); 27 | STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid); 28 | STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew); 29 | STDMETHOD_(DWORD, GetPriority)(THIS); 30 | STDMETHOD_(void, PreLoad)(THIS); 31 | STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS); 32 | STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew); 33 | STDMETHOD_(DWORD, GetLOD)(THIS); 34 | STDMETHOD_(DWORD, GetLevelCount)(THIS); 35 | STDMETHOD(GetLevelDesc)(THIS_ UINT Level, D3DSURFACE_DESC *pDesc); 36 | STDMETHOD(GetCubeMapSurface)(THIS_ D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface8** ppCubeMapSurface); 37 | STDMETHOD(LockRect)(THIS_ D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags); 38 | STDMETHOD(UnlockRect)(THIS_ D3DCUBEMAP_FACES FaceType, UINT Level); 39 | STDMETHOD(AddDirtyRect)(THIS_ D3DCUBEMAP_FACES FaceType, CONST RECT* pDirtyRect); 40 | }; 41 | -------------------------------------------------------------------------------- /d3d8/IDirect3DIndexBuffer8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DIndexBuffer8 : public IDirect3DIndexBuffer8, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECT3DINDEXBUFFER8 ProxyInterface; 7 | m_IDirect3DDevice8* m_pDevice; 8 | 9 | public: 10 | m_IDirect3DIndexBuffer8(LPDIRECT3DINDEXBUFFER8 pBuffer8, m_IDirect3DDevice8* pDevice) : ProxyInterface(pBuffer8), m_pDevice(pDevice) 11 | { 12 | m_pDevice->ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); 13 | } 14 | ~m_IDirect3DIndexBuffer8() {} 15 | 16 | LPDIRECT3DINDEXBUFFER8 GetProxyInterface() { return ProxyInterface; } 17 | 18 | /*** IUnknown methods ***/ 19 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj); 20 | STDMETHOD_(ULONG, AddRef)(THIS); 21 | STDMETHOD_(ULONG, Release)(THIS); 22 | 23 | /*** IDirect3DResource8 methods ***/ 24 | STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice); 25 | STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags); 26 | STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid, void* pData, DWORD* pSizeOfData); 27 | STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid); 28 | STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew); 29 | STDMETHOD_(DWORD, GetPriority)(THIS); 30 | STDMETHOD_(void, PreLoad)(THIS); 31 | STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS); 32 | STDMETHOD(Lock)(THIS_ UINT OffsetToLock, UINT SizeToLock, BYTE** ppbData, DWORD Flags); 33 | STDMETHOD(Unlock)(THIS); 34 | STDMETHOD(GetDesc)(THIS_ D3DINDEXBUFFER_DESC *pDesc); 35 | }; 36 | -------------------------------------------------------------------------------- /d3d8/IDirect3DSurface8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DSurface8 : public IDirect3DSurface8, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECT3DSURFACE8 ProxyInterface; 7 | m_IDirect3DDevice8* m_pDevice; 8 | 9 | public: 10 | m_IDirect3DSurface8(LPDIRECT3DSURFACE8 pSurface8, m_IDirect3DDevice8* pDevice) : ProxyInterface(pSurface8), m_pDevice(pDevice) 11 | { 12 | m_pDevice->ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); 13 | } 14 | ~m_IDirect3DSurface8() {} 15 | 16 | LPDIRECT3DSURFACE8 GetProxyInterface() { return ProxyInterface; } 17 | 18 | /*** IUnknown methods ***/ 19 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj); 20 | STDMETHOD_(ULONG, AddRef)(THIS); 21 | STDMETHOD_(ULONG, Release)(THIS); 22 | 23 | /*** IDirect3DSurface8 methods ***/ 24 | STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice); 25 | STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags); 26 | STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid, void* pData, DWORD* pSizeOfData); 27 | STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid); 28 | STDMETHOD(GetContainer)(THIS_ REFIID riid, void** ppContainer); 29 | STDMETHOD(GetDesc)(THIS_ D3DSURFACE_DESC *pDesc); 30 | STDMETHOD(LockRect)(THIS_ D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags); 31 | STDMETHOD(UnlockRect)(THIS); 32 | }; 33 | -------------------------------------------------------------------------------- /d3d8/IDirect3DSwapChain8.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "d3d8.h" 18 | 19 | HRESULT m_IDirect3DSwapChain8::QueryInterface(THIS_ REFIID riid, void** ppvObj) 20 | { 21 | if ((riid == IID_IDirect3DSwapChain8 || riid == IID_IUnknown) && ppvObj) 22 | { 23 | AddRef(); 24 | 25 | *ppvObj = this; 26 | 27 | return S_OK; 28 | } 29 | 30 | HRESULT hr = ProxyInterface->QueryInterface(riid, ppvObj); 31 | 32 | if (SUCCEEDED(hr)) 33 | { 34 | genericQueryInterface(riid, ppvObj, m_pDevice); 35 | } 36 | 37 | return hr; 38 | } 39 | 40 | ULONG m_IDirect3DSwapChain8::AddRef(THIS) 41 | { 42 | return ProxyInterface->AddRef(); 43 | } 44 | 45 | ULONG m_IDirect3DSwapChain8::Release(THIS) 46 | { 47 | return ProxyInterface->Release(); 48 | } 49 | 50 | HRESULT m_IDirect3DSwapChain8::Present(THIS_ CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion) 51 | { 52 | return ProxyInterface->Present(pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion); 53 | } 54 | 55 | HRESULT m_IDirect3DSwapChain8::GetBackBuffer(THIS_ UINT BackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface8** ppBackBuffer) 56 | { 57 | HRESULT hr = ProxyInterface->GetBackBuffer(BackBuffer, Type, ppBackBuffer); 58 | 59 | if (SUCCEEDED(hr) && ppBackBuffer) 60 | { 61 | *ppBackBuffer = m_pDevice->ProxyAddressLookupTable->FindAddress(*ppBackBuffer); 62 | } 63 | 64 | return hr; 65 | } 66 | -------------------------------------------------------------------------------- /d3d8/IDirect3DSwapChain8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DSwapChain8 : public IDirect3DSwapChain8, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECT3DSWAPCHAIN8 ProxyInterface; 7 | m_IDirect3DDevice8* m_pDevice; 8 | 9 | public: 10 | m_IDirect3DSwapChain8(LPDIRECT3DSWAPCHAIN8 pSwapChain8, m_IDirect3DDevice8* pDevice) : ProxyInterface(pSwapChain8), m_pDevice(pDevice) 11 | { 12 | m_pDevice->ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); 13 | } 14 | ~m_IDirect3DSwapChain8() {} 15 | 16 | LPDIRECT3DSWAPCHAIN8 GetProxyInterface() { return ProxyInterface; } 17 | 18 | /*** IUnknown methods ***/ 19 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj); 20 | STDMETHOD_(ULONG, AddRef)(THIS); 21 | STDMETHOD_(ULONG, Release)(THIS); 22 | 23 | /*** IDirect3DSwapChain8 methods ***/ 24 | STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion); 25 | STDMETHOD(GetBackBuffer)(THIS_ UINT BackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface8** ppBackBuffer); 26 | }; 27 | -------------------------------------------------------------------------------- /d3d8/IDirect3DTexture8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DTexture8 : public IDirect3DTexture8, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECT3DTEXTURE8 ProxyInterface; 7 | m_IDirect3DDevice8* m_pDevice; 8 | 9 | public: 10 | m_IDirect3DTexture8(LPDIRECT3DTEXTURE8 pTexture8, m_IDirect3DDevice8* pDevice) : ProxyInterface(pTexture8), m_pDevice(pDevice) 11 | { 12 | m_pDevice->ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); 13 | } 14 | ~m_IDirect3DTexture8() {} 15 | 16 | LPDIRECT3DTEXTURE8 GetProxyInterface() { return ProxyInterface; } 17 | 18 | /*** IUnknown methods ***/ 19 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj); 20 | STDMETHOD_(ULONG, AddRef)(THIS); 21 | STDMETHOD_(ULONG, Release)(THIS); 22 | 23 | /*** IDirect3DBaseTexture8 methods ***/ 24 | STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice); 25 | STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags); 26 | STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid, void* pData, DWORD* pSizeOfData); 27 | STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid); 28 | STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew); 29 | STDMETHOD_(DWORD, GetPriority)(THIS); 30 | STDMETHOD_(void, PreLoad)(THIS); 31 | STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS); 32 | STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew); 33 | STDMETHOD_(DWORD, GetLOD)(THIS); 34 | STDMETHOD_(DWORD, GetLevelCount)(THIS); 35 | STDMETHOD(GetLevelDesc)(THIS_ UINT Level, D3DSURFACE_DESC *pDesc); 36 | STDMETHOD(GetSurfaceLevel)(THIS_ UINT Level, IDirect3DSurface8** ppSurfaceLevel); 37 | STDMETHOD(LockRect)(THIS_ UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags); 38 | STDMETHOD(UnlockRect)(THIS_ UINT Level); 39 | STDMETHOD(AddDirtyRect)(THIS_ CONST RECT* pDirtyRect); 40 | }; 41 | -------------------------------------------------------------------------------- /d3d8/IDirect3DVertexBuffer8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DVertexBuffer8 : public IDirect3DVertexBuffer8, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECT3DVERTEXBUFFER8 ProxyInterface; 7 | m_IDirect3DDevice8* m_pDevice; 8 | 9 | public: 10 | m_IDirect3DVertexBuffer8(LPDIRECT3DVERTEXBUFFER8 pBuffer8, m_IDirect3DDevice8* pDevice) : ProxyInterface(pBuffer8), m_pDevice(pDevice) 11 | { 12 | m_pDevice->ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); 13 | } 14 | ~m_IDirect3DVertexBuffer8() {} 15 | 16 | LPDIRECT3DVERTEXBUFFER8 GetProxyInterface() { return ProxyInterface; } 17 | 18 | /*** IUnknown methods ***/ 19 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj); 20 | STDMETHOD_(ULONG, AddRef)(THIS); 21 | STDMETHOD_(ULONG, Release)(THIS); 22 | 23 | /*** IDirect3DResource8 methods ***/ 24 | STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice); 25 | STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags); 26 | STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid, void* pData, DWORD* pSizeOfData); 27 | STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid); 28 | STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew); 29 | STDMETHOD_(DWORD, GetPriority)(THIS); 30 | STDMETHOD_(void, PreLoad)(THIS); 31 | STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS); 32 | STDMETHOD(Lock)(THIS_ UINT OffsetToLock, UINT SizeToLock, BYTE** ppbData, DWORD Flags); 33 | STDMETHOD(Unlock)(THIS); 34 | STDMETHOD(GetDesc)(THIS_ D3DVERTEXBUFFER_DESC *pDesc); 35 | }; 36 | -------------------------------------------------------------------------------- /d3d8/IDirect3DVolume8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DVolume8 : public IDirect3DVolume8, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECT3DVOLUME8 ProxyInterface; 7 | m_IDirect3DDevice8* m_pDevice; 8 | 9 | public: 10 | m_IDirect3DVolume8(LPDIRECT3DVOLUME8 pVolume8, m_IDirect3DDevice8* pDevice) : ProxyInterface(pVolume8), m_pDevice(pDevice) 11 | { 12 | m_pDevice->ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); 13 | } 14 | ~m_IDirect3DVolume8() {} 15 | 16 | LPDIRECT3DVOLUME8 GetProxyInterface() { return ProxyInterface; } 17 | 18 | /*** IUnknown methods ***/ 19 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj); 20 | STDMETHOD_(ULONG, AddRef)(THIS); 21 | STDMETHOD_(ULONG, Release)(THIS); 22 | 23 | /*** IDirect3DVolume8 methods ***/ 24 | STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice); 25 | STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags); 26 | STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid, void* pData, DWORD* pSizeOfData); 27 | STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid); 28 | STDMETHOD(GetContainer)(THIS_ REFIID riid, void** ppContainer); 29 | STDMETHOD(GetDesc)(THIS_ D3DVOLUME_DESC *pDesc); 30 | STDMETHOD(LockBox)(THIS_ D3DLOCKED_BOX * pLockedVolume, CONST D3DBOX* pBox, DWORD Flags); 31 | STDMETHOD(UnlockBox)(THIS); 32 | }; 33 | -------------------------------------------------------------------------------- /d3d8/IDirect3DVolumeTexture8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DVolumeTexture8 : public IDirect3DVolumeTexture8, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECT3DVOLUMETEXTURE8 ProxyInterface; 7 | m_IDirect3DDevice8* m_pDevice; 8 | 9 | public: 10 | m_IDirect3DVolumeTexture8(LPDIRECT3DVOLUMETEXTURE8 pTexture8, m_IDirect3DDevice8* pDevice) : ProxyInterface(pTexture8), m_pDevice(pDevice) 11 | { 12 | m_pDevice->ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); 13 | } 14 | ~m_IDirect3DVolumeTexture8() {} 15 | 16 | LPDIRECT3DVOLUMETEXTURE8 GetProxyInterface() { return ProxyInterface; } 17 | 18 | /*** IUnknown methods ***/ 19 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj); 20 | STDMETHOD_(ULONG, AddRef)(THIS); 21 | STDMETHOD_(ULONG, Release)(THIS); 22 | 23 | /*** IDirect3DBaseTexture8 methods ***/ 24 | STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice); 25 | STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags); 26 | STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid, void* pData, DWORD* pSizeOfData); 27 | STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid); 28 | STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew); 29 | STDMETHOD_(DWORD, GetPriority)(THIS); 30 | STDMETHOD_(void, PreLoad)(THIS); 31 | STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS); 32 | STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew); 33 | STDMETHOD_(DWORD, GetLOD)(THIS); 34 | STDMETHOD_(DWORD, GetLevelCount)(THIS); 35 | STDMETHOD(GetLevelDesc)(THIS_ UINT Level, D3DVOLUME_DESC *pDesc); 36 | STDMETHOD(GetVolumeLevel)(THIS_ UINT Level, IDirect3DVolume8** ppVolumeLevel); 37 | STDMETHOD(LockBox)(THIS_ UINT Level, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags); 38 | STDMETHOD(UnlockBox)(THIS_ UINT Level); 39 | STDMETHOD(AddDirtyBox)(THIS_ CONST D3DBOX* pDirtyBox); 40 | }; 41 | -------------------------------------------------------------------------------- /d3d8/InterfaceQuery.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "d3d8.h" 18 | 19 | void genericQueryInterface(REFIID riid, LPVOID *ppvObj, m_IDirect3DDevice8* m_pDevice) 20 | { 21 | if (!ppvObj || !*ppvObj || !m_pDevice) 22 | { 23 | return; 24 | } 25 | 26 | if (riid == IID_IDirect3D8) 27 | { 28 | IDirect3D8 *pD3D8 = nullptr; 29 | if (SUCCEEDED(m_pDevice->GetDirect3D(&pD3D8)) && pD3D8) 30 | { 31 | *ppvObj = pD3D8; 32 | pD3D8->Release(); 33 | return; 34 | } 35 | } 36 | 37 | if (riid == IID_IDirect3DDevice8) 38 | { 39 | *ppvObj = m_pDevice; 40 | return; 41 | } 42 | 43 | #define QUERYINTERFACE(x) \ 44 | if (riid == IID_ ## x) \ 45 | { \ 46 | *ppvObj = m_pDevice->ProxyAddressLookupTable->FindAddress(*ppvObj); \ 47 | return; \ 48 | } 49 | 50 | QUERYINTERFACE(IDirect3DTexture8); 51 | QUERYINTERFACE(IDirect3DCubeTexture8); 52 | QUERYINTERFACE(IDirect3DVolumeTexture8); 53 | QUERYINTERFACE(IDirect3DVertexBuffer8); 54 | QUERYINTERFACE(IDirect3DIndexBuffer8); 55 | QUERYINTERFACE(IDirect3DSurface8); 56 | QUERYINTERFACE(IDirect3DVolume8); 57 | QUERYINTERFACE(IDirect3DSwapChain8); 58 | } 59 | -------------------------------------------------------------------------------- /d3d8/License.txt: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ -------------------------------------------------------------------------------- /d3d8/d3d8.def: -------------------------------------------------------------------------------- 1 | LIBRARY d3d8 2 | EXPORTS 3 | 4 | Direct3D8EnableMaximizedWindowedModeShim @1 5 | ValidatePixelShader @2 6 | ValidateVertexShader @3 7 | DebugSetMute @4 8 | Direct3DCreate8 @5 9 | -------------------------------------------------------------------------------- /d3d8/d3d8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define INITGUID 4 | 5 | #include 6 | 7 | class m_IDirect3D8; 8 | class m_IDirect3DDevice8; 9 | class m_IDirect3DCubeTexture8; 10 | class m_IDirect3DIndexBuffer8; 11 | class m_IDirect3DSurface8; 12 | class m_IDirect3DSwapChain8; 13 | class m_IDirect3DTexture8; 14 | class m_IDirect3DVertexBuffer8; 15 | class m_IDirect3DVolume8; 16 | class m_IDirect3DVolumeTexture8; 17 | 18 | #include "AddressLookupTable.h" 19 | #include "..\Common\Logging.h" 20 | 21 | typedef int(WINAPI *Direct3D8EnableMaximizedWindowedModeShimProc)(BOOL); 22 | typedef HRESULT(WINAPI *ValidatePixelShaderProc)(DWORD*, DWORD*, BOOL, DWORD*); 23 | typedef HRESULT(WINAPI *ValidateVertexShaderProc)(DWORD*, DWORD*, DWORD*, BOOL, DWORD*); 24 | typedef void(WINAPI *DebugSetMuteProc)(); 25 | typedef IDirect3D8 *(WINAPI *Direct3DCreate8Proc)(UINT); 26 | 27 | void genericQueryInterface(REFIID riid, LPVOID *ppvObj, m_IDirect3DDevice8* m_pDevice); 28 | 29 | #include "IDirect3D8.h" 30 | #include "IDirect3DDevice8.h" 31 | #include "IDirect3DCubeTexture8.h" 32 | #include "IDirect3DIndexBuffer8.h" 33 | #include "IDirect3DSurface8.h" 34 | #include "IDirect3DSwapChain8.h" 35 | #include "IDirect3DTexture8.h" 36 | #include "IDirect3DVertexBuffer8.h" 37 | #include "IDirect3DVolume8.h" 38 | #include "IDirect3DVolumeTexture8.h" 39 | -------------------------------------------------------------------------------- /d3d9/IDirect3DCubeTexture9.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DCubeTexture9 : public IDirect3DCubeTexture9, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECT3DCUBETEXTURE9 ProxyInterface; 7 | m_IDirect3DDevice9Ex* m_pDeviceEx = nullptr; 8 | 9 | public: 10 | m_IDirect3DCubeTexture9(LPDIRECT3DCUBETEXTURE9 pTexture9, m_IDirect3DDevice9Ex* pDevice) : ProxyInterface(pTexture9), m_pDeviceEx(pDevice) 11 | { 12 | pDevice->ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); 13 | } 14 | ~m_IDirect3DCubeTexture9() {} 15 | 16 | LPDIRECT3DCUBETEXTURE9 GetProxyInterface() { return ProxyInterface; } 17 | 18 | /*** IUnknown methods ***/ 19 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj); 20 | STDMETHOD_(ULONG, AddRef)(THIS); 21 | STDMETHOD_(ULONG, Release)(THIS); 22 | 23 | /*** IDirect3DBaseTexture9 methods ***/ 24 | STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice); 25 | STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags); 26 | STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid, void* pData, DWORD* pSizeOfData); 27 | STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid); 28 | STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew); 29 | STDMETHOD_(DWORD, GetPriority)(THIS); 30 | STDMETHOD_(void, PreLoad)(THIS); 31 | STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS); 32 | STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew); 33 | STDMETHOD_(DWORD, GetLOD)(THIS); 34 | STDMETHOD_(DWORD, GetLevelCount)(THIS); 35 | STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType); 36 | STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS); 37 | STDMETHOD_(void, GenerateMipSubLevels)(THIS); 38 | STDMETHOD(GetLevelDesc)(THIS_ UINT Level, D3DSURFACE_DESC *pDesc); 39 | STDMETHOD(GetCubeMapSurface)(THIS_ D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface9** ppCubeMapSurface); 40 | STDMETHOD(LockRect)(THIS_ D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags); 41 | STDMETHOD(UnlockRect)(THIS_ D3DCUBEMAP_FACES FaceType, UINT Level); 42 | STDMETHOD(AddDirtyRect)(THIS_ D3DCUBEMAP_FACES FaceType, CONST RECT* pDirtyRect); 43 | }; 44 | -------------------------------------------------------------------------------- /d3d9/IDirect3DIndexBuffer9.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DIndexBuffer9 : public IDirect3DIndexBuffer9, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECT3DINDEXBUFFER9 ProxyInterface; 7 | m_IDirect3DDevice9Ex* m_pDeviceEx = nullptr; 8 | 9 | public: 10 | m_IDirect3DIndexBuffer9(LPDIRECT3DINDEXBUFFER9 pBuffer9, m_IDirect3DDevice9Ex* pDevice) : ProxyInterface(pBuffer9), m_pDeviceEx(pDevice) 11 | { 12 | pDevice->ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); 13 | } 14 | ~m_IDirect3DIndexBuffer9() {} 15 | 16 | LPDIRECT3DINDEXBUFFER9 GetProxyInterface() { return ProxyInterface; } 17 | 18 | /*** IUnknown methods ***/ 19 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj); 20 | STDMETHOD_(ULONG, AddRef)(THIS); 21 | STDMETHOD_(ULONG, Release)(THIS); 22 | 23 | /*** IDirect3DResource9 methods ***/ 24 | STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice); 25 | STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags); 26 | STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid, void* pData, DWORD* pSizeOfData); 27 | STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid); 28 | STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew); 29 | STDMETHOD_(DWORD, GetPriority)(THIS); 30 | STDMETHOD_(void, PreLoad)(THIS); 31 | STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS); 32 | STDMETHOD(Lock)(THIS_ UINT OffsetToLock, UINT SizeToLock, void** ppbData, DWORD Flags); 33 | STDMETHOD(Unlock)(THIS); 34 | STDMETHOD(GetDesc)(THIS_ D3DINDEXBUFFER_DESC *pDesc); 35 | }; 36 | -------------------------------------------------------------------------------- /d3d9/IDirect3DPixelShader9.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "d3d9.h" 18 | 19 | HRESULT m_IDirect3DPixelShader9::QueryInterface(THIS_ REFIID riid, void** ppvObj) 20 | { 21 | if ((riid == IID_IDirect3DPixelShader9 || riid == IID_IUnknown) && ppvObj) 22 | { 23 | AddRef(); 24 | 25 | *ppvObj = this; 26 | 27 | return S_OK; 28 | } 29 | 30 | HRESULT hr = ProxyInterface->QueryInterface(riid, ppvObj); 31 | 32 | if (SUCCEEDED(hr)) 33 | { 34 | genericQueryInterface(riid, ppvObj, m_pDeviceEx); 35 | } 36 | 37 | return hr; 38 | } 39 | 40 | ULONG m_IDirect3DPixelShader9::AddRef(THIS) 41 | { 42 | return ProxyInterface->AddRef(); 43 | } 44 | 45 | ULONG m_IDirect3DPixelShader9::Release(THIS) 46 | { 47 | return ProxyInterface->Release(); 48 | } 49 | 50 | HRESULT m_IDirect3DPixelShader9::GetDevice(THIS_ IDirect3DDevice9** ppDevice) 51 | { 52 | if (!ppDevice) 53 | { 54 | return D3DERR_INVALIDCALL; 55 | } 56 | 57 | m_pDeviceEx->AddRef(); 58 | 59 | *ppDevice = m_pDeviceEx; 60 | 61 | return D3D_OK; 62 | } 63 | 64 | HRESULT m_IDirect3DPixelShader9::GetFunction(THIS_ void* pData, UINT* pSizeOfData) 65 | { 66 | return ProxyInterface->GetFunction(pData, pSizeOfData); 67 | } 68 | -------------------------------------------------------------------------------- /d3d9/IDirect3DPixelShader9.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DPixelShader9 : public IDirect3DPixelShader9, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECT3DPIXELSHADER9 ProxyInterface; 7 | m_IDirect3DDevice9Ex* m_pDeviceEx = nullptr; 8 | 9 | public: 10 | m_IDirect3DPixelShader9(LPDIRECT3DPIXELSHADER9 pShader9, m_IDirect3DDevice9Ex* pDevice) : ProxyInterface(pShader9), m_pDeviceEx(pDevice) 11 | { 12 | pDevice->ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); 13 | } 14 | ~m_IDirect3DPixelShader9() {} 15 | 16 | LPDIRECT3DPIXELSHADER9 GetProxyInterface() { return ProxyInterface; } 17 | 18 | /*** IUnknown methods ***/ 19 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj); 20 | STDMETHOD_(ULONG, AddRef)(THIS); 21 | STDMETHOD_(ULONG, Release)(THIS); 22 | 23 | /*** IDirect3DPixelShader9 methods ***/ 24 | STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice); 25 | STDMETHOD(GetFunction)(THIS_ void* pData, UINT* pSizeOfData); 26 | }; 27 | -------------------------------------------------------------------------------- /d3d9/IDirect3DQuery9.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DQuery9 : public IDirect3DQuery9, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECT3DQUERY9 ProxyInterface; 7 | m_IDirect3DDevice9Ex* m_pDeviceEx = nullptr; 8 | 9 | public: 10 | m_IDirect3DQuery9(LPDIRECT3DQUERY9 pQuery9, m_IDirect3DDevice9Ex* pDevice) : ProxyInterface(pQuery9), m_pDeviceEx(pDevice) 11 | { 12 | pDevice->ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); 13 | } 14 | ~m_IDirect3DQuery9() {} 15 | 16 | LPDIRECT3DQUERY9 GetProxyInterface() { return ProxyInterface; } 17 | 18 | /*** IUnknown methods ***/ 19 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj); 20 | STDMETHOD_(ULONG, AddRef)(THIS); 21 | STDMETHOD_(ULONG, Release)(THIS); 22 | 23 | /*** IDirect3DQuery9 methods ***/ 24 | STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice); 25 | STDMETHOD_(D3DQUERYTYPE, GetType)(THIS); 26 | STDMETHOD_(DWORD, GetDataSize)(THIS); 27 | STDMETHOD(Issue)(THIS_ DWORD dwIssueFlags); 28 | STDMETHOD(GetData)(THIS_ void* pData, DWORD dwSize, DWORD dwGetDataFlags); 29 | }; 30 | -------------------------------------------------------------------------------- /d3d9/IDirect3DStateBlock9.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "d3d9.h" 18 | 19 | HRESULT m_IDirect3DStateBlock9::QueryInterface(THIS_ REFIID riid, void** ppvObj) 20 | { 21 | if ((riid == IID_IDirect3DStateBlock9 || riid == IID_IUnknown) && ppvObj) 22 | { 23 | AddRef(); 24 | 25 | *ppvObj = this; 26 | 27 | return S_OK; 28 | } 29 | 30 | HRESULT hr = ProxyInterface->QueryInterface(riid, ppvObj); 31 | 32 | if (SUCCEEDED(hr)) 33 | { 34 | genericQueryInterface(riid, ppvObj, m_pDeviceEx); 35 | } 36 | 37 | return hr; 38 | } 39 | 40 | ULONG m_IDirect3DStateBlock9::AddRef(THIS) 41 | { 42 | return ProxyInterface->AddRef(); 43 | } 44 | 45 | ULONG m_IDirect3DStateBlock9::Release(THIS) 46 | { 47 | return ProxyInterface->Release(); 48 | } 49 | 50 | HRESULT m_IDirect3DStateBlock9::GetDevice(THIS_ IDirect3DDevice9** ppDevice) 51 | { 52 | if (!ppDevice) 53 | { 54 | return D3DERR_INVALIDCALL; 55 | } 56 | 57 | m_pDeviceEx->AddRef(); 58 | 59 | *ppDevice = m_pDeviceEx; 60 | 61 | return D3D_OK; 62 | } 63 | 64 | HRESULT m_IDirect3DStateBlock9::Capture(THIS) 65 | { 66 | return ProxyInterface->Capture(); 67 | } 68 | 69 | HRESULT m_IDirect3DStateBlock9::Apply(THIS) 70 | { 71 | return ProxyInterface->Apply(); 72 | } 73 | -------------------------------------------------------------------------------- /d3d9/IDirect3DStateBlock9.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DStateBlock9 : public IDirect3DStateBlock9, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECT3DSTATEBLOCK9 ProxyInterface; 7 | m_IDirect3DDevice9Ex* m_pDeviceEx = nullptr; 8 | 9 | public: 10 | m_IDirect3DStateBlock9(LPDIRECT3DSTATEBLOCK9 pBlock9, m_IDirect3DDevice9Ex* pDevice) : ProxyInterface(pBlock9), m_pDeviceEx(pDevice) 11 | { 12 | pDevice->ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); 13 | } 14 | ~m_IDirect3DStateBlock9() {} 15 | 16 | LPDIRECT3DSTATEBLOCK9 GetProxyInterface() { return ProxyInterface; } 17 | 18 | /*** IUnknown methods ***/ 19 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj); 20 | STDMETHOD_(ULONG, AddRef)(THIS); 21 | STDMETHOD_(ULONG, Release)(THIS); 22 | 23 | /*** IDirect3DStateBlock9 methods ***/ 24 | STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice); 25 | STDMETHOD(Capture)(THIS); 26 | STDMETHOD(Apply)(THIS); 27 | }; 28 | -------------------------------------------------------------------------------- /d3d9/IDirect3DSurface9.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DSurface9 : public IDirect3DSurface9, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECT3DSURFACE9 ProxyInterface; 7 | m_IDirect3DDevice9Ex* m_pDeviceEx = nullptr; 8 | 9 | public: 10 | m_IDirect3DSurface9(LPDIRECT3DSURFACE9 pSurface9, m_IDirect3DDevice9Ex* pDevice) : ProxyInterface(pSurface9), m_pDeviceEx(pDevice) 11 | { 12 | pDevice->ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); 13 | } 14 | ~m_IDirect3DSurface9() {} 15 | 16 | LPDIRECT3DSURFACE9 GetProxyInterface() { return ProxyInterface; } 17 | 18 | /*** IUnknown methods ***/ 19 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj); 20 | STDMETHOD_(ULONG, AddRef)(THIS); 21 | STDMETHOD_(ULONG, Release)(THIS); 22 | 23 | /*** IDirect3DResource9 methods ***/ 24 | STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice); 25 | STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags); 26 | STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid, void* pData, DWORD* pSizeOfData); 27 | STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid); 28 | STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew); 29 | STDMETHOD_(DWORD, GetPriority)(THIS); 30 | STDMETHOD_(void, PreLoad)(THIS); 31 | STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS); 32 | STDMETHOD(GetContainer)(THIS_ REFIID riid, void** ppContainer); 33 | STDMETHOD(GetDesc)(THIS_ D3DSURFACE_DESC *pDesc); 34 | STDMETHOD(LockRect)(THIS_ D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags); 35 | STDMETHOD(UnlockRect)(THIS); 36 | STDMETHOD(GetDC)(THIS_ HDC *phdc); 37 | STDMETHOD(ReleaseDC)(THIS_ HDC hdc); 38 | }; 39 | -------------------------------------------------------------------------------- /d3d9/IDirect3DSwapChain9Ex.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DSwapChain9Ex : public IDirect3DSwapChain9Ex, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECT3DSWAPCHAIN9EX ProxyInterface; 7 | m_IDirect3DDevice9Ex* m_pDeviceEx = nullptr; 8 | REFIID WrapperID; 9 | 10 | public: 11 | m_IDirect3DSwapChain9Ex(LPDIRECT3DSWAPCHAIN9EX pSwapChain9, m_IDirect3DDevice9Ex* pDevice, REFIID DeviceID = IID_IDirect3DSwapChain9) : ProxyInterface(pSwapChain9), m_pDeviceEx(pDevice), WrapperID(DeviceID) 12 | { 13 | pDevice->ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); 14 | } 15 | ~m_IDirect3DSwapChain9Ex() {} 16 | 17 | LPDIRECT3DSWAPCHAIN9EX GetProxyInterface() { return ProxyInterface; } 18 | 19 | /*** IUnknown methods ***/ 20 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj); 21 | STDMETHOD_(ULONG, AddRef)(THIS); 22 | STDMETHOD_(ULONG, Release)(THIS); 23 | 24 | /*** IDirect3DSwapChain9 methods ***/ 25 | STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion, DWORD dwFlags); 26 | STDMETHOD(GetFrontBufferData)(THIS_ IDirect3DSurface9* pDestSurface); 27 | STDMETHOD(GetBackBuffer)(THIS_ UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9** ppBackBuffer); 28 | STDMETHOD(GetRasterStatus)(THIS_ D3DRASTER_STATUS* pRasterStatus); 29 | STDMETHOD(GetDisplayMode)(THIS_ D3DDISPLAYMODE* pMode); 30 | STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice); 31 | STDMETHOD(GetPresentParameters)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters); 32 | STDMETHOD(GetLastPresentCount)(THIS_ UINT* pLastPresentCount); 33 | STDMETHOD(GetPresentStats)(THIS_ D3DPRESENTSTATS* pPresentationStatistics); 34 | STDMETHOD(GetDisplayModeEx)(THIS_ D3DDISPLAYMODEEX* pMode, D3DDISPLAYROTATION* pRotation); 35 | }; 36 | -------------------------------------------------------------------------------- /d3d9/IDirect3DTexture9.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DTexture9 : public IDirect3DTexture9, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECT3DTEXTURE9 ProxyInterface; 7 | m_IDirect3DDevice9Ex* m_pDeviceEx = nullptr; 8 | 9 | public: 10 | m_IDirect3DTexture9(LPDIRECT3DTEXTURE9 pTexture9, m_IDirect3DDevice9Ex* pDevice) : ProxyInterface(pTexture9), m_pDeviceEx(pDevice) 11 | { 12 | pDevice->ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); 13 | } 14 | ~m_IDirect3DTexture9() {} 15 | 16 | LPDIRECT3DTEXTURE9 GetProxyInterface() { return ProxyInterface; } 17 | 18 | /*** IUnknown methods ***/ 19 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj); 20 | STDMETHOD_(ULONG, AddRef)(THIS); 21 | STDMETHOD_(ULONG, Release)(THIS); 22 | 23 | /*** IDirect3DBaseTexture9 methods ***/ 24 | STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice); 25 | STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags); 26 | STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid, void* pData, DWORD* pSizeOfData); 27 | STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid); 28 | STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew); 29 | STDMETHOD_(DWORD, GetPriority)(THIS); 30 | STDMETHOD_(void, PreLoad)(THIS); 31 | STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS); 32 | STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew); 33 | STDMETHOD_(DWORD, GetLOD)(THIS); 34 | STDMETHOD_(DWORD, GetLevelCount)(THIS); 35 | STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType); 36 | STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS); 37 | STDMETHOD_(void, GenerateMipSubLevels)(THIS); 38 | STDMETHOD(GetLevelDesc)(THIS_ UINT Level, D3DSURFACE_DESC *pDesc); 39 | STDMETHOD(GetSurfaceLevel)(THIS_ UINT Level, IDirect3DSurface9** ppSurfaceLevel); 40 | STDMETHOD(LockRect)(THIS_ UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags); 41 | STDMETHOD(UnlockRect)(THIS_ UINT Level); 42 | STDMETHOD(AddDirtyRect)(THIS_ CONST RECT* pDirtyRect); 43 | }; 44 | -------------------------------------------------------------------------------- /d3d9/IDirect3DVertexBuffer9.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DVertexBuffer9 : public IDirect3DVertexBuffer9, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECT3DVERTEXBUFFER9 ProxyInterface; 7 | m_IDirect3DDevice9Ex* m_pDeviceEx = nullptr; 8 | 9 | public: 10 | m_IDirect3DVertexBuffer9(LPDIRECT3DVERTEXBUFFER9 pBuffer8, m_IDirect3DDevice9Ex* pDevice) : ProxyInterface(pBuffer8), m_pDeviceEx(pDevice) 11 | { 12 | pDevice->ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); 13 | } 14 | ~m_IDirect3DVertexBuffer9() {} 15 | 16 | LPDIRECT3DVERTEXBUFFER9 GetProxyInterface() { return ProxyInterface; } 17 | 18 | /*** IUnknown methods ***/ 19 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj); 20 | STDMETHOD_(ULONG, AddRef)(THIS); 21 | STDMETHOD_(ULONG, Release)(THIS); 22 | 23 | /*** IDirect3DResource9 methods ***/ 24 | STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice); 25 | STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags); 26 | STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid, void* pData, DWORD* pSizeOfData); 27 | STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid); 28 | STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew); 29 | STDMETHOD_(DWORD, GetPriority)(THIS); 30 | STDMETHOD_(void, PreLoad)(THIS); 31 | STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS); 32 | STDMETHOD(Lock)(THIS_ UINT OffsetToLock, UINT SizeToLock, void** ppbData, DWORD Flags); 33 | STDMETHOD(Unlock)(THIS); 34 | STDMETHOD(GetDesc)(THIS_ D3DVERTEXBUFFER_DESC *pDesc); 35 | }; 36 | -------------------------------------------------------------------------------- /d3d9/IDirect3DVertexDeclaration9.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "d3d9.h" 18 | 19 | HRESULT m_IDirect3DVertexDeclaration9::QueryInterface(THIS_ REFIID riid, void** ppvObj) 20 | { 21 | if ((riid == IID_IDirect3DVertexDeclaration9 || riid == IID_IUnknown) && ppvObj) 22 | { 23 | AddRef(); 24 | 25 | *ppvObj = this; 26 | 27 | return S_OK; 28 | } 29 | 30 | HRESULT hr = ProxyInterface->QueryInterface(riid, ppvObj); 31 | 32 | if (SUCCEEDED(hr)) 33 | { 34 | genericQueryInterface(riid, ppvObj, m_pDeviceEx); 35 | } 36 | 37 | return hr; 38 | } 39 | 40 | ULONG m_IDirect3DVertexDeclaration9::AddRef(THIS) 41 | { 42 | return ProxyInterface->AddRef(); 43 | } 44 | 45 | ULONG m_IDirect3DVertexDeclaration9::Release(THIS) 46 | { 47 | return ProxyInterface->Release(); 48 | } 49 | 50 | HRESULT m_IDirect3DVertexDeclaration9::GetDevice(THIS_ IDirect3DDevice9** ppDevice) 51 | { 52 | if (!ppDevice) 53 | { 54 | return D3DERR_INVALIDCALL; 55 | } 56 | 57 | m_pDeviceEx->AddRef(); 58 | 59 | *ppDevice = m_pDeviceEx; 60 | 61 | return D3D_OK; 62 | } 63 | 64 | HRESULT m_IDirect3DVertexDeclaration9::GetDeclaration(THIS_ D3DVERTEXELEMENT9* pElement, UINT* pNumElements) 65 | { 66 | return ProxyInterface->GetDeclaration(pElement, pNumElements); 67 | } 68 | -------------------------------------------------------------------------------- /d3d9/IDirect3DVertexDeclaration9.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DVertexDeclaration9 : public IDirect3DVertexDeclaration9, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECT3DVERTEXDECLARATION9 ProxyInterface; 7 | m_IDirect3DDevice9Ex* m_pDeviceEx = nullptr; 8 | 9 | public: 10 | m_IDirect3DVertexDeclaration9(LPDIRECT3DVERTEXDECLARATION9 pDeclaration9, m_IDirect3DDevice9Ex* pDevice) : ProxyInterface(pDeclaration9), m_pDeviceEx(pDevice) 11 | { 12 | pDevice->ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); 13 | } 14 | ~m_IDirect3DVertexDeclaration9() {} 15 | 16 | LPDIRECT3DVERTEXDECLARATION9 GetProxyInterface() { return ProxyInterface; } 17 | 18 | /*** IUnknown methods ***/ 19 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj); 20 | STDMETHOD_(ULONG, AddRef)(THIS); 21 | STDMETHOD_(ULONG, Release)(THIS); 22 | 23 | /*** IDirect3DVertexDeclaration9 methods ***/ 24 | STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice); 25 | STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9* pElement, UINT* pNumElements); 26 | }; 27 | -------------------------------------------------------------------------------- /d3d9/IDirect3DVertexShader9.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "d3d9.h" 18 | 19 | HRESULT m_IDirect3DVertexShader9::QueryInterface(THIS_ REFIID riid, void** ppvObj) 20 | { 21 | if ((riid == IID_IDirect3DVertexShader9 || riid == IID_IUnknown) && ppvObj) 22 | { 23 | AddRef(); 24 | 25 | *ppvObj = this; 26 | 27 | return S_OK; 28 | } 29 | 30 | HRESULT hr = ProxyInterface->QueryInterface(riid, ppvObj); 31 | 32 | if (SUCCEEDED(hr)) 33 | { 34 | genericQueryInterface(riid, ppvObj, m_pDeviceEx); 35 | } 36 | 37 | return hr; 38 | } 39 | 40 | ULONG m_IDirect3DVertexShader9::AddRef(THIS) 41 | { 42 | return ProxyInterface->AddRef(); 43 | } 44 | 45 | ULONG m_IDirect3DVertexShader9::Release(THIS) 46 | { 47 | return ProxyInterface->Release(); 48 | } 49 | 50 | HRESULT m_IDirect3DVertexShader9::GetDevice(THIS_ IDirect3DDevice9** ppDevice) 51 | { 52 | if (!ppDevice) 53 | { 54 | return D3DERR_INVALIDCALL; 55 | } 56 | 57 | m_pDeviceEx->AddRef(); 58 | 59 | *ppDevice = m_pDeviceEx; 60 | 61 | return D3D_OK; 62 | } 63 | 64 | HRESULT m_IDirect3DVertexShader9::GetFunction(THIS_ void* pData, UINT* pSizeOfData) 65 | { 66 | return ProxyInterface->GetFunction(pData, pSizeOfData); 67 | } 68 | -------------------------------------------------------------------------------- /d3d9/IDirect3DVertexShader9.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DVertexShader9 : public IDirect3DVertexShader9, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECT3DVERTEXSHADER9 ProxyInterface; 7 | m_IDirect3DDevice9Ex* m_pDeviceEx = nullptr; 8 | 9 | public: 10 | m_IDirect3DVertexShader9(LPDIRECT3DVERTEXSHADER9 pShader9, m_IDirect3DDevice9Ex* pDevice) : ProxyInterface(pShader9), m_pDeviceEx(pDevice) 11 | { 12 | pDevice->ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); 13 | } 14 | ~m_IDirect3DVertexShader9() {} 15 | 16 | LPDIRECT3DVERTEXSHADER9 GetProxyInterface() { return ProxyInterface; } 17 | 18 | /*** IUnknown methods ***/ 19 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj); 20 | STDMETHOD_(ULONG, AddRef)(THIS); 21 | STDMETHOD_(ULONG, Release)(THIS); 22 | 23 | /*** IDirect3DVertexShader9 methods ***/ 24 | STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice); 25 | STDMETHOD(GetFunction)(THIS_ void* pData, UINT* pSizeOfData); 26 | }; 27 | -------------------------------------------------------------------------------- /d3d9/IDirect3DVolume9.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DVolume9 : public IDirect3DVolume9, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECT3DVOLUME9 ProxyInterface; 7 | m_IDirect3DDevice9Ex* m_pDeviceEx = nullptr; 8 | 9 | public: 10 | m_IDirect3DVolume9(LPDIRECT3DVOLUME9 pVolume8, m_IDirect3DDevice9Ex* pDevice) : ProxyInterface(pVolume8), m_pDeviceEx(pDevice) 11 | { 12 | pDevice->ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); 13 | } 14 | ~m_IDirect3DVolume9() {} 15 | 16 | LPDIRECT3DVOLUME9 GetProxyInterface() { return ProxyInterface; } 17 | 18 | /*** IUnknown methods ***/ 19 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj); 20 | STDMETHOD_(ULONG, AddRef)(THIS); 21 | STDMETHOD_(ULONG, Release)(THIS); 22 | 23 | /*** IDirect3DVolume9 methods ***/ 24 | STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice); 25 | STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags); 26 | STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid, void* pData, DWORD* pSizeOfData); 27 | STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid); 28 | STDMETHOD(GetContainer)(THIS_ REFIID riid, void** ppContainer); 29 | STDMETHOD(GetDesc)(THIS_ D3DVOLUME_DESC *pDesc); 30 | STDMETHOD(LockBox)(THIS_ D3DLOCKED_BOX * pLockedVolume, CONST D3DBOX* pBox, DWORD Flags); 31 | STDMETHOD(UnlockBox)(THIS); 32 | }; 33 | -------------------------------------------------------------------------------- /d3d9/IDirect3DVolumeTexture9.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DVolumeTexture9 : public IDirect3DVolumeTexture9, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECT3DVOLUMETEXTURE9 ProxyInterface; 7 | m_IDirect3DDevice9Ex* m_pDeviceEx = nullptr; 8 | 9 | public: 10 | m_IDirect3DVolumeTexture9(LPDIRECT3DVOLUMETEXTURE9 pTexture8, m_IDirect3DDevice9Ex* pDevice) : ProxyInterface(pTexture8), m_pDeviceEx(pDevice) 11 | { 12 | pDevice->ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); 13 | } 14 | ~m_IDirect3DVolumeTexture9() {} 15 | 16 | LPDIRECT3DVOLUMETEXTURE9 GetProxyInterface() { return ProxyInterface; } 17 | 18 | /*** IUnknown methods ***/ 19 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj); 20 | STDMETHOD_(ULONG, AddRef)(THIS); 21 | STDMETHOD_(ULONG, Release)(THIS); 22 | 23 | /*** IDirect3DBaseTexture9 methods ***/ 24 | STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice); 25 | STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags); 26 | STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid, void* pData, DWORD* pSizeOfData); 27 | STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid); 28 | STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew); 29 | STDMETHOD_(DWORD, GetPriority)(THIS); 30 | STDMETHOD_(void, PreLoad)(THIS); 31 | STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS); 32 | STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew); 33 | STDMETHOD_(DWORD, GetLOD)(THIS); 34 | STDMETHOD_(DWORD, GetLevelCount)(THIS); 35 | STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType); 36 | STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS); 37 | STDMETHOD_(void, GenerateMipSubLevels)(THIS); 38 | STDMETHOD(GetLevelDesc)(THIS_ UINT Level, D3DVOLUME_DESC *pDesc); 39 | STDMETHOD(GetVolumeLevel)(THIS_ UINT Level, IDirect3DVolume9** ppVolumeLevel); 40 | STDMETHOD(LockBox)(THIS_ UINT Level, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags); 41 | STDMETHOD(UnlockBox)(THIS_ UINT Level); 42 | STDMETHOD(AddDirtyBox)(THIS_ CONST D3DBOX* pDirtyBox); 43 | }; 44 | -------------------------------------------------------------------------------- /d3d9/License.txt: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ -------------------------------------------------------------------------------- /d3d9/d3d9.def: -------------------------------------------------------------------------------- 1 | LIBRARY d3d9 2 | EXPORTS 3 | 4 | Direct3DShaderValidatorCreate9 @19 5 | PSGPError @20 6 | PSGPSampleTexture @21 7 | D3DPERF_BeginEvent @22 8 | D3DPERF_EndEvent @23 9 | D3DPERF_GetStatus @24 10 | D3DPERF_QueryRepeatFrame @25 11 | D3DPERF_SetMarker @26 12 | D3DPERF_SetOptions @27 13 | D3DPERF_SetRegion @28 14 | DebugSetLevel @29 15 | DebugSetMute @30 16 | Direct3D9EnableMaximizedWindowedModeShim @31 17 | Direct3DCreate9 @32 18 | Direct3DCreate9Ex @33 19 | -------------------------------------------------------------------------------- /d3d9/d3d9.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define INITGUID 4 | 5 | #include 6 | 7 | class m_IDirect3D9Ex; 8 | class m_IDirect3DDevice9Ex; 9 | class m_IDirect3DCubeTexture9; 10 | class m_IDirect3DIndexBuffer9; 11 | class m_IDirect3DPixelShader9; 12 | class m_IDirect3DQuery9; 13 | class m_IDirect3DStateBlock9; 14 | class m_IDirect3DSurface9; 15 | class m_IDirect3DSwapChain9Ex; 16 | class m_IDirect3DTexture9; 17 | class m_IDirect3DVertexBuffer9; 18 | class m_IDirect3DVertexDeclaration9; 19 | class m_IDirect3DVertexShader9; 20 | class m_IDirect3DVolume9; 21 | class m_IDirect3DVolumeTexture9; 22 | 23 | #include "AddressLookupTable.h" 24 | #include "..\Common\Logging.h" 25 | 26 | typedef HRESULT(WINAPI *Direct3DShaderValidatorCreate9Proc)(); 27 | typedef HRESULT(WINAPI *PSGPErrorProc)(); 28 | typedef HRESULT(WINAPI *PSGPSampleTextureProc)(); 29 | typedef int(WINAPI *D3DPERF_BeginEventProc)(D3DCOLOR, LPCWSTR); 30 | typedef int(WINAPI *D3DPERF_EndEventProc)(); 31 | typedef DWORD(WINAPI *D3DPERF_GetStatusProc)(); 32 | typedef BOOL(WINAPI *D3DPERF_QueryRepeatFrameProc)(); 33 | typedef void(WINAPI *D3DPERF_SetMarkerProc)(D3DCOLOR, LPCWSTR); 34 | typedef void(WINAPI *D3DPERF_SetOptionsProc)(DWORD); 35 | typedef void(WINAPI *D3DPERF_SetRegionProc)(D3DCOLOR, LPCWSTR); 36 | typedef HRESULT(WINAPI *DebugSetLevelProc)(DWORD); 37 | typedef void(WINAPI *DebugSetMuteProc)(); 38 | typedef int(WINAPI *Direct3D9EnableMaximizedWindowedModeShimProc)(BOOL); 39 | typedef IDirect3D9 *(WINAPI *Direct3DCreate9Proc)(UINT); 40 | typedef HRESULT(WINAPI *Direct3DCreate9ExProc)(UINT, IDirect3D9Ex **); 41 | 42 | void genericQueryInterface(REFIID riid, LPVOID *ppvObj, m_IDirect3DDevice9Ex* m_pDeviceEx); 43 | 44 | #include "IDirect3D9Ex.h" 45 | #include "IDirect3DDevice9Ex.h" 46 | #include "IDirect3DCubeTexture9.h" 47 | #include "IDirect3DIndexBuffer9.h" 48 | #include "IDirect3DPixelShader9.h" 49 | #include "IDirect3DQuery9.h" 50 | #include "IDirect3DStateBlock9.h" 51 | #include "IDirect3DSurface9.h" 52 | #include "IDirect3DSwapChain9Ex.h" 53 | #include "IDirect3DTexture9.h" 54 | #include "IDirect3DVertexBuffer9.h" 55 | #include "IDirect3DVertexDeclaration9.h" 56 | #include "IDirect3DVertexShader9.h" 57 | #include "IDirect3DVolume9.h" 58 | #include "IDirect3DVolumeTexture9.h" 59 | -------------------------------------------------------------------------------- /ddraw/IDirect3DExecuteBuffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DExecuteBuffer : public IDirect3DExecuteBuffer, public AddressLookupTableObject 4 | { 5 | private: 6 | IDirect3DExecuteBuffer *ProxyInterface; 7 | REFIID WrapperID = IID_IDirect3DExecuteBuffer; 8 | 9 | public: 10 | m_IDirect3DExecuteBuffer(IDirect3DExecuteBuffer *aOriginal) : ProxyInterface(aOriginal) 11 | { 12 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 13 | } 14 | ~m_IDirect3DExecuteBuffer() 15 | { 16 | ProxyAddressLookupTable.DeleteAddress(this); 17 | } 18 | 19 | DWORD GetDirectXVersion() { return 1; } 20 | REFIID GetWrapperType() { return WrapperID; } 21 | IDirect3DExecuteBuffer *GetProxyInterface() { return ProxyInterface; } 22 | m_IDirect3DExecuteBuffer *GetWrapperInterface() { return this; } 23 | 24 | /*** IUnknown methods ***/ 25 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 26 | STDMETHOD_(ULONG, AddRef)(THIS); 27 | STDMETHOD_(ULONG, Release)(THIS); 28 | 29 | /*** IDirect3DExecuteBuffer methods ***/ 30 | STDMETHOD(Initialize)(THIS_ LPDIRECT3DDEVICE, LPD3DEXECUTEBUFFERDESC); 31 | STDMETHOD(Lock)(THIS_ LPD3DEXECUTEBUFFERDESC); 32 | STDMETHOD(Unlock)(THIS); 33 | STDMETHOD(SetExecuteData)(THIS_ LPD3DEXECUTEDATA); 34 | STDMETHOD(GetExecuteData)(THIS_ LPD3DEXECUTEDATA); 35 | STDMETHOD(Validate)(THIS_ LPDWORD, LPD3DVALIDATECALLBACK, LPVOID, DWORD); 36 | STDMETHOD(Optimize)(THIS_ DWORD); 37 | }; 38 | -------------------------------------------------------------------------------- /ddraw/IDirect3DLight.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "ddraw.h" 18 | 19 | HRESULT m_IDirect3DLight::QueryInterface(REFIID riid, LPVOID * ppvObj) 20 | { 21 | return ProxyQueryInterface(ProxyInterface, riid, ppvObj, WrapperID, this); 22 | } 23 | 24 | ULONG m_IDirect3DLight::AddRef() 25 | { 26 | return ProxyInterface->AddRef(); 27 | } 28 | 29 | ULONG m_IDirect3DLight::Release() 30 | { 31 | ULONG ref = ProxyInterface->Release(); 32 | 33 | if (ref == 0) 34 | { 35 | delete this; 36 | } 37 | 38 | return ref; 39 | } 40 | 41 | HRESULT m_IDirect3DLight::Initialize(LPDIRECT3D lpDirect3D) 42 | { 43 | if (lpDirect3D) 44 | { 45 | lpDirect3D = static_cast(lpDirect3D)->GetProxyInterface(); 46 | } 47 | 48 | return ProxyInterface->Initialize(lpDirect3D); 49 | } 50 | 51 | HRESULT m_IDirect3DLight::SetLight(LPD3DLIGHT lpLight) 52 | { 53 | return ProxyInterface->SetLight(lpLight); 54 | } 55 | 56 | HRESULT m_IDirect3DLight::GetLight(LPD3DLIGHT lpLight) 57 | { 58 | return ProxyInterface->GetLight(lpLight); 59 | } 60 | -------------------------------------------------------------------------------- /ddraw/IDirect3DLight.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DLight : public IDirect3DLight, public AddressLookupTableObject 4 | { 5 | private: 6 | IDirect3DLight *ProxyInterface; 7 | REFIID WrapperID = IID_IDirect3DLight; 8 | 9 | public: 10 | m_IDirect3DLight(IDirect3DLight *aOriginal) : ProxyInterface(aOriginal) 11 | { 12 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 13 | } 14 | ~m_IDirect3DLight() 15 | { 16 | ProxyAddressLookupTable.DeleteAddress(this); 17 | } 18 | 19 | DWORD GetDirectXVersion() { return 1; } 20 | REFIID GetWrapperType() { return WrapperID; } 21 | IDirect3DLight *GetProxyInterface() { return ProxyInterface; } 22 | m_IDirect3DLight *GetWrapperInterface() { return this; } 23 | 24 | /*** IUnknown methods ***/ 25 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 26 | STDMETHOD_(ULONG, AddRef)(THIS); 27 | STDMETHOD_(ULONG, Release)(THIS); 28 | 29 | /*** IDirect3DLight methods ***/ 30 | STDMETHOD(Initialize)(THIS_ LPDIRECT3D); 31 | STDMETHOD(SetLight)(THIS_ LPD3DLIGHT); 32 | STDMETHOD(GetLight)(THIS_ LPD3DLIGHT); 33 | }; 34 | -------------------------------------------------------------------------------- /ddraw/IDirect3DMaterialX.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DMaterialX 4 | { 5 | private: 6 | IDirect3DMaterial3 *ProxyInterface; 7 | m_IDirect3DMaterial3 *WrapperInterface; 8 | DWORD DirectXVersion; 9 | DWORD ProxyDirectXVersion; 10 | IID WrapperID; 11 | 12 | public: 13 | m_IDirect3DMaterialX(IDirect3DMaterial3 *aOriginal, DWORD Version, m_IDirect3DMaterial3 *Interface) : ProxyInterface(aOriginal), DirectXVersion(Version), WrapperInterface(Interface) 14 | { 15 | WrapperID = (DirectXVersion == 1) ? IID_IDirect3DMaterial : 16 | (DirectXVersion == 2) ? IID_IDirect3DMaterial2 : 17 | (DirectXVersion == 3) ? IID_IDirect3DMaterial3 : IID_IDirect3DMaterial3; 18 | 19 | ProxyDirectXVersion = GetIIDVersion(WrapperID); 20 | } 21 | ~m_IDirect3DMaterialX() {} 22 | 23 | DWORD GetDirectXVersion() { return DDWRAPPER_TYPEX; } 24 | REFIID GetWrapperType() { return WrapperID; } 25 | IDirect3DMaterial3 *GetProxyInterface() { return ProxyInterface; } 26 | m_IDirect3DMaterial3 *GetWrapperInterface() { return WrapperInterface; } 27 | 28 | /*** IUnknown methods ***/ 29 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 30 | STDMETHOD_(ULONG, AddRef)(THIS); 31 | STDMETHOD_(ULONG, Release)(THIS); 32 | 33 | /*** IDirect3DMaterial methods ***/ 34 | STDMETHOD(Initialize)(THIS_ LPDIRECT3D); 35 | STDMETHOD(SetMaterial)(THIS_ LPD3DMATERIAL); 36 | STDMETHOD(GetMaterial)(THIS_ LPD3DMATERIAL); 37 | STDMETHOD(GetHandle)(THIS_ LPDIRECT3DDEVICE3, LPD3DMATERIALHANDLE); 38 | STDMETHOD(Reserve)(THIS); 39 | STDMETHOD(Unreserve)(THIS); 40 | 41 | // Helper functions 42 | IDirect3DMaterial *GetProxyInterfaceV1() { return (IDirect3DMaterial *)ProxyInterface; } 43 | IDirect3DMaterial2 *GetProxyInterfaceV2() { return (IDirect3DMaterial2 *)ProxyInterface; } 44 | IDirect3DMaterial3 *GetProxyInterfaceV3() { return ProxyInterface; } 45 | }; 46 | -------------------------------------------------------------------------------- /ddraw/IDirect3DTextureX.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DTextureX 4 | { 5 | private: 6 | IDirect3DTexture2 *ProxyInterface; 7 | m_IDirect3DTexture2 *WrapperInterface; 8 | DWORD DirectXVersion; 9 | DWORD ProxyDirectXVersion; 10 | IID WrapperID; 11 | 12 | public: 13 | m_IDirect3DTextureX(IDirect3DTexture2 *aOriginal, DWORD Version, m_IDirect3DTexture2 *Interface) : ProxyInterface(aOriginal), DirectXVersion(Version), WrapperInterface(Interface) 14 | { 15 | WrapperID = (DirectXVersion == 1) ? IID_IDirect3DTexture : 16 | (DirectXVersion == 2) ? IID_IDirect3DTexture2 : IID_IDirect3DTexture2; 17 | 18 | ProxyDirectXVersion = GetIIDVersion(WrapperID); 19 | } 20 | ~m_IDirect3DTextureX() {} 21 | 22 | DWORD GetDirectXVersion() { return DDWRAPPER_TYPEX; } 23 | REFIID GetWrapperType() { return WrapperID; } 24 | IDirect3DTexture2 *GetProxyInterface() { return ProxyInterface; } 25 | m_IDirect3DTexture2 *GetWrapperInterface() { return WrapperInterface; } 26 | 27 | /*** IUnknown methods ***/ 28 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 29 | STDMETHOD_(ULONG, AddRef)(THIS); 30 | STDMETHOD_(ULONG, Release)(THIS); 31 | 32 | /*** IDirect3DTexture methods ***/ 33 | STDMETHOD(Initialize)(THIS_ LPDIRECT3DDEVICE, LPDIRECTDRAWSURFACE); 34 | STDMETHOD(GetHandle)(THIS_ LPDIRECT3DDEVICE2, LPD3DTEXTUREHANDLE); 35 | STDMETHOD(PaletteChanged)(THIS_ DWORD, DWORD); 36 | STDMETHOD(Load)(THIS_ LPDIRECT3DTEXTURE2); 37 | STDMETHOD(Unload)(THIS); 38 | 39 | // Helper functions 40 | IDirect3DTexture *GetProxyInterfaceV1() { return (IDirect3DTexture *)ProxyInterface; } 41 | IDirect3DTexture2 *GetProxyInterfaceV2() { return ProxyInterface; } 42 | }; 43 | -------------------------------------------------------------------------------- /ddraw/IDirect3DVertexBufferX.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DVertexBufferX 4 | { 5 | private: 6 | IDirect3DVertexBuffer7 *ProxyInterface; 7 | m_IDirect3DVertexBuffer7 *WrapperInterface; 8 | DWORD DirectXVersion; 9 | DWORD ProxyDirectXVersion; 10 | IID WrapperID; 11 | 12 | public: 13 | m_IDirect3DVertexBufferX(IDirect3DVertexBuffer7 *aOriginal, DWORD Version, m_IDirect3DVertexBuffer7 *Interface) : ProxyInterface(aOriginal), DirectXVersion(Version), WrapperInterface(Interface) 14 | { 15 | WrapperID = (DirectXVersion == 1) ? IID_IDirect3DVertexBuffer : 16 | (DirectXVersion == 7) ? IID_IDirect3DVertexBuffer7 : IID_IDirect3DVertexBuffer7; 17 | 18 | ProxyDirectXVersion = GetIIDVersion(WrapperID); 19 | } 20 | ~m_IDirect3DVertexBufferX() {} 21 | 22 | DWORD GetDirectXVersion() { return DDWRAPPER_TYPEX; } 23 | REFIID GetWrapperType() { return WrapperID; } 24 | IDirect3DVertexBuffer7 *GetProxyInterface() { return ProxyInterface; } 25 | m_IDirect3DVertexBuffer7 *GetWrapperInterface() { return WrapperInterface; } 26 | 27 | /*** IUnknown methods ***/ 28 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 29 | STDMETHOD_(ULONG, AddRef)(THIS); 30 | STDMETHOD_(ULONG, Release)(THIS); 31 | 32 | /*** IDirect3DVertexBuffer methods ***/ 33 | STDMETHOD(Lock)(THIS_ DWORD, LPVOID*, LPDWORD); 34 | STDMETHOD(Unlock)(THIS); 35 | STDMETHOD(ProcessVertices)(THIS_ DWORD, DWORD, DWORD, LPDIRECT3DVERTEXBUFFER7, DWORD, LPDIRECT3DDEVICE7, DWORD); 36 | STDMETHOD(GetVertexBufferDesc)(THIS_ LPD3DVERTEXBUFFERDESC); 37 | STDMETHOD(Optimize)(THIS_ LPDIRECT3DDEVICE7, DWORD); 38 | 39 | /*** IDirect3DVertexBuffer7 methods ***/ 40 | STDMETHOD(ProcessVerticesStrided)(THIS_ DWORD, DWORD, DWORD, LPD3DDRAWPRIMITIVESTRIDEDDATA, DWORD, LPDIRECT3DDEVICE7, DWORD); 41 | }; 42 | -------------------------------------------------------------------------------- /ddraw/IDirect3DX.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DX 4 | { 5 | private: 6 | IDirect3D7 *ProxyInterface; 7 | m_IDirect3D7 *WrapperInterface; 8 | DWORD DirectXVersion; 9 | DWORD ProxyDirectXVersion; 10 | IID WrapperID; 11 | m_IDirectDrawX *ddrawParent = nullptr; 12 | 13 | public: 14 | m_IDirect3DX(IDirect3D7 *aOriginal, DWORD Version, m_IDirect3D7 *Interface) : ProxyInterface(aOriginal), DirectXVersion(Version), WrapperInterface(Interface) 15 | { 16 | WrapperID = (DirectXVersion == 1) ? IID_IDirect3D : 17 | (DirectXVersion == 2) ? IID_IDirect3D2 : 18 | (DirectXVersion == 3) ? IID_IDirect3D3 : 19 | (DirectXVersion == 7) ? IID_IDirect3D7 : IID_IDirect3D7; 20 | 21 | ProxyDirectXVersion = GetIIDVersion(WrapperID); 22 | } 23 | ~m_IDirect3DX() {} 24 | 25 | DWORD GetDirectXVersion() { return DDWRAPPER_TYPEX; } 26 | REFIID GetWrapperType() { return WrapperID; } 27 | IDirect3D7 *GetProxyInterface() { return ProxyInterface; } 28 | m_IDirect3D7 *GetWrapperInterface() { return WrapperInterface; } 29 | 30 | /*** IUnknown methods ***/ 31 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 32 | STDMETHOD_(ULONG, AddRef)(THIS); 33 | STDMETHOD_(ULONG, Release)(THIS); 34 | 35 | /*** IDirect3D methods ***/ 36 | STDMETHOD(Initialize)(THIS_ REFCLSID); 37 | STDMETHOD(EnumDevices)(THIS_ LPD3DENUMDEVICESCALLBACK, LPVOID); 38 | STDMETHOD(EnumDevices7)(THIS_ LPD3DENUMDEVICESCALLBACK7, LPVOID); 39 | STDMETHOD(CreateLight)(THIS_ LPDIRECT3DLIGHT*, LPUNKNOWN); 40 | STDMETHOD(CreateMaterial)(THIS_ LPDIRECT3DMATERIAL3*, LPUNKNOWN); 41 | STDMETHOD(CreateViewport)(THIS_ LPDIRECT3DVIEWPORT3*, LPUNKNOWN); 42 | STDMETHOD(FindDevice)(THIS_ LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT); 43 | STDMETHOD(CreateDevice)(THIS_ REFCLSID, LPDIRECTDRAWSURFACE7, LPDIRECT3DDEVICE7*, LPUNKNOWN); 44 | STDMETHOD(CreateVertexBuffer)(THIS_ LPD3DVERTEXBUFFERDESC, LPDIRECT3DVERTEXBUFFER7*, DWORD, LPUNKNOWN); 45 | STDMETHOD(EnumZBufferFormats)(THIS_ REFCLSID, LPD3DENUMPIXELFORMATSCALLBACK, LPVOID); 46 | STDMETHOD(EvictManagedTextures)(THIS); 47 | 48 | // Helper functions 49 | IDirect3D *GetProxyInterfaceV1() { return (IDirect3D *)ProxyInterface; } 50 | IDirect3D2 *GetProxyInterfaceV2() { return (IDirect3D2 *)ProxyInterface; } 51 | IDirect3D3 *GetProxyInterfaceV3() { return (IDirect3D3 *)ProxyInterface; } 52 | IDirect3D7 *GetProxyInterfaceV7() { return ProxyInterface; } 53 | }; 54 | -------------------------------------------------------------------------------- /ddraw/IDirectDrawClipper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectDrawClipper : public IDirectDrawClipper, public AddressLookupTableObject 4 | { 5 | private: 6 | IDirectDrawClipper *ProxyInterface; 7 | REFIID WrapperID = IID_IDirectDrawClipper; 8 | 9 | public: 10 | m_IDirectDrawClipper(IDirectDrawClipper *aOriginal) : ProxyInterface(aOriginal) 11 | { 12 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 13 | } 14 | ~m_IDirectDrawClipper() 15 | { 16 | ProxyAddressLookupTable.DeleteAddress(this); 17 | } 18 | 19 | DWORD GetDirectXVersion() { return 1; } 20 | REFIID GetWrapperType() { return WrapperID; } 21 | IDirectDrawClipper *GetProxyInterface() { return ProxyInterface; } 22 | m_IDirectDrawClipper *GetWrapperInterface() { return this; } 23 | 24 | /*** IUnknown methods ***/ 25 | STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj); 26 | STDMETHOD_(ULONG, AddRef) (THIS) ; 27 | STDMETHOD_(ULONG, Release) (THIS); 28 | /*** IDirectDrawClipper methods ***/ 29 | STDMETHOD(GetClipList)(THIS_ LPRECT, LPRGNDATA, LPDWORD); 30 | STDMETHOD(GetHWnd)(THIS_ HWND FAR *); 31 | STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, DWORD); 32 | STDMETHOD(IsClipListChanged)(THIS_ BOOL FAR *); 33 | STDMETHOD(SetClipList)(THIS_ LPRGNDATA, DWORD); 34 | STDMETHOD(SetHWnd)(THIS_ DWORD, HWND); 35 | }; 36 | -------------------------------------------------------------------------------- /ddraw/IDirectDrawColorControl.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "ddraw.h" 18 | 19 | HRESULT m_IDirectDrawColorControl::QueryInterface(REFIID riid, LPVOID FAR * ppvObj) 20 | { 21 | return ProxyQueryInterface(ProxyInterface, riid, ppvObj, WrapperID, this); 22 | } 23 | 24 | ULONG m_IDirectDrawColorControl::AddRef() 25 | { 26 | return ProxyInterface->AddRef(); 27 | } 28 | 29 | ULONG m_IDirectDrawColorControl::Release() 30 | { 31 | ULONG ref = ProxyInterface->Release(); 32 | 33 | if (ref == 0) 34 | { 35 | delete this; 36 | } 37 | 38 | return ref; 39 | } 40 | 41 | HRESULT m_IDirectDrawColorControl::GetColorControls(LPDDCOLORCONTROL lpColorControl) 42 | { 43 | return ProxyInterface->GetColorControls(lpColorControl); 44 | } 45 | 46 | HRESULT m_IDirectDrawColorControl::SetColorControls(LPDDCOLORCONTROL lpColorControl) 47 | { 48 | return ProxyInterface->SetColorControls(lpColorControl); 49 | } 50 | -------------------------------------------------------------------------------- /ddraw/IDirectDrawColorControl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectDrawColorControl : public IDirectDrawColorControl, public AddressLookupTableObject 4 | { 5 | private: 6 | IDirectDrawColorControl *ProxyInterface; 7 | REFIID WrapperID = IID_IDirectDrawColorControl; 8 | 9 | public: 10 | m_IDirectDrawColorControl(IDirectDrawColorControl *aOriginal) : ProxyInterface(aOriginal) 11 | { 12 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 13 | } 14 | ~m_IDirectDrawColorControl() 15 | { 16 | ProxyAddressLookupTable.DeleteAddress(this); 17 | } 18 | 19 | DWORD GetDirectXVersion() { return 1; } 20 | REFIID GetWrapperType() { return WrapperID; } 21 | IDirectDrawColorControl *GetProxyInterface() { return ProxyInterface; } 22 | m_IDirectDrawColorControl *GetWrapperInterface() { return this; } 23 | 24 | /*** IUnknown methods ***/ 25 | STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj); 26 | STDMETHOD_(ULONG, AddRef) (THIS) ; 27 | STDMETHOD_(ULONG, Release) (THIS); 28 | /*** IDirectDrawColorControl methods ***/ 29 | STDMETHOD(GetColorControls)(THIS_ LPDDCOLORCONTROL); 30 | STDMETHOD(SetColorControls)(THIS_ LPDDCOLORCONTROL); 31 | }; 32 | -------------------------------------------------------------------------------- /ddraw/IDirectDrawFactory.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "ddraw.h" 18 | 19 | HRESULT m_IDirectDrawFactory::QueryInterface(REFIID riid, LPVOID FAR * ppvObj) 20 | { 21 | return ProxyQueryInterface(ProxyInterface, riid, ppvObj, WrapperID, this); 22 | } 23 | 24 | ULONG m_IDirectDrawFactory::AddRef() 25 | { 26 | return ProxyInterface->AddRef(); 27 | } 28 | 29 | ULONG m_IDirectDrawFactory::Release() 30 | { 31 | ULONG ref = ProxyInterface->Release(); 32 | 33 | if (ref == 0) 34 | { 35 | delete this; 36 | } 37 | 38 | return ref; 39 | } 40 | 41 | HRESULT m_IDirectDrawFactory::CreateDirectDraw(GUID * pGUID, HWND hWnd, DWORD dwCoopLevelFlags, DWORD dwReserved, IUnknown * pUnkOuter, IDirectDraw * * ppDirectDraw) 42 | { 43 | HRESULT hr = ProxyInterface->CreateDirectDraw(pGUID, hWnd, dwCoopLevelFlags, dwReserved, pUnkOuter, ppDirectDraw); 44 | 45 | if (SUCCEEDED(hr) && ppDirectDraw) 46 | { 47 | *ppDirectDraw = new m_IDirectDraw(*ppDirectDraw); 48 | } 49 | 50 | return hr; 51 | } 52 | 53 | HRESULT m_IDirectDrawFactory::DirectDrawEnumerateA(LPDDENUMCALLBACKA lpCallback, LPVOID lpContext) 54 | { 55 | return ProxyInterface->DirectDrawEnumerateA(lpCallback, lpContext); 56 | } 57 | 58 | HRESULT m_IDirectDrawFactory::DirectDrawEnumerateW(LPDDENUMCALLBACKW lpCallback, LPVOID lpContext) 59 | { 60 | return ProxyInterface->DirectDrawEnumerateW(lpCallback, lpContext); 61 | } 62 | -------------------------------------------------------------------------------- /ddraw/IDirectDrawFactory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectDrawFactory : public IDirectDrawFactory, public AddressLookupTableObject 4 | { 5 | private: 6 | IDirectDrawFactory *ProxyInterface; 7 | REFIID WrapperID = IID_IDirectDrawFactory; 8 | 9 | public: 10 | m_IDirectDrawFactory(IDirectDrawFactory *aOriginal) : ProxyInterface(aOriginal) 11 | { 12 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 13 | } 14 | ~m_IDirectDrawFactory() 15 | { 16 | ProxyAddressLookupTable.DeleteAddress(this); 17 | } 18 | 19 | DWORD GetDirectXVersion() { return 1; } 20 | REFIID GetWrapperType() { return WrapperID; } 21 | IDirectDrawFactory *GetProxyInterface() { return ProxyInterface; } 22 | m_IDirectDrawFactory *GetWrapperInterface() { return this; } 23 | 24 | /*** IUnknown methods ***/ 25 | STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj); 26 | STDMETHOD_(ULONG, AddRef) (THIS) ; 27 | STDMETHOD_(ULONG, Release) (THIS); 28 | /*** IDirectDrawFactory methods ***/ 29 | STDMETHOD(CreateDirectDraw) (THIS_ GUID * pGUID, HWND hWnd, DWORD dwCoopLevelFlags, DWORD dwReserved, IUnknown *pUnkOuter, IDirectDraw **ppDirectDraw); 30 | STDMETHOD(DirectDrawEnumerateA) (THIS_ LPDDENUMCALLBACKA lpCallback, LPVOID lpContext); 31 | STDMETHOD(DirectDrawEnumerateW) (THIS_ LPDDENUMCALLBACKW lpCallback, LPVOID lpContext); 32 | }; 33 | -------------------------------------------------------------------------------- /ddraw/IDirectDrawGammaControl.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "ddraw.h" 18 | 19 | HRESULT m_IDirectDrawGammaControl::QueryInterface(REFIID riid, LPVOID FAR * ppvObj) 20 | { 21 | return ProxyQueryInterface(ProxyInterface, riid, ppvObj, WrapperID, this); 22 | } 23 | 24 | ULONG m_IDirectDrawGammaControl::AddRef() 25 | { 26 | return ProxyInterface->AddRef(); 27 | } 28 | 29 | ULONG m_IDirectDrawGammaControl::Release() 30 | { 31 | ULONG ref = ProxyInterface->Release(); 32 | 33 | if (ref == 0) 34 | { 35 | delete this; 36 | } 37 | 38 | return ref; 39 | } 40 | 41 | HRESULT m_IDirectDrawGammaControl::GetGammaRamp(DWORD dwFlags, LPDDGAMMARAMP lpRampData) 42 | { 43 | return ProxyInterface->GetGammaRamp(dwFlags, lpRampData); 44 | } 45 | 46 | HRESULT m_IDirectDrawGammaControl::SetGammaRamp(DWORD dwFlags, LPDDGAMMARAMP lpRampData) 47 | { 48 | return ProxyInterface->SetGammaRamp(dwFlags, lpRampData); 49 | } 50 | -------------------------------------------------------------------------------- /ddraw/IDirectDrawGammaControl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectDrawGammaControl : public IDirectDrawGammaControl, public AddressLookupTableObject 4 | { 5 | private: 6 | IDirectDrawGammaControl *ProxyInterface; 7 | REFIID WrapperID = IID_IDirectDrawGammaControl; 8 | 9 | public: 10 | m_IDirectDrawGammaControl(IDirectDrawGammaControl *aOriginal) : ProxyInterface(aOriginal) 11 | { 12 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 13 | } 14 | ~m_IDirectDrawGammaControl() 15 | { 16 | ProxyAddressLookupTable.DeleteAddress(this); 17 | } 18 | 19 | DWORD GetDirectXVersion() { return 1; } 20 | REFIID GetWrapperType() { return WrapperID; } 21 | IDirectDrawGammaControl *GetProxyInterface() { return ProxyInterface; } 22 | m_IDirectDrawGammaControl *GetWrapperInterface() { return this; } 23 | 24 | /*** IUnknown methods ***/ 25 | STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj); 26 | STDMETHOD_(ULONG, AddRef) (THIS) ; 27 | STDMETHOD_(ULONG, Release) (THIS); 28 | /*** IDirectDrawGammaControl methods ***/ 29 | STDMETHOD(GetGammaRamp)(THIS_ DWORD, LPDDGAMMARAMP); 30 | STDMETHOD(SetGammaRamp)(THIS_ DWORD, LPDDGAMMARAMP); 31 | }; 32 | -------------------------------------------------------------------------------- /ddraw/IDirectDrawPalette.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "ddraw.h" 18 | 19 | HRESULT m_IDirectDrawPalette::QueryInterface(REFIID riid, LPVOID FAR * ppvObj) 20 | { 21 | return ProxyQueryInterface(ProxyInterface, riid, ppvObj, WrapperID, this); 22 | } 23 | 24 | ULONG m_IDirectDrawPalette::AddRef() 25 | { 26 | return ProxyInterface->AddRef(); 27 | } 28 | 29 | ULONG m_IDirectDrawPalette::Release() 30 | { 31 | ULONG ref = ProxyInterface->Release(); 32 | 33 | if (ref == 0) 34 | { 35 | delete this; 36 | } 37 | 38 | return ref; 39 | } 40 | 41 | HRESULT m_IDirectDrawPalette::GetCaps(LPDWORD lpdwCaps) 42 | { 43 | return ProxyInterface->GetCaps(lpdwCaps); 44 | } 45 | 46 | HRESULT m_IDirectDrawPalette::GetEntries(DWORD dwFlags, DWORD dwBase, DWORD dwNumEntries, LPPALETTEENTRY lpEntries) 47 | { 48 | return ProxyInterface->GetEntries(dwFlags, dwBase, dwNumEntries, lpEntries); 49 | } 50 | 51 | HRESULT m_IDirectDrawPalette::Initialize(LPDIRECTDRAW lpDD, DWORD dwFlags, LPPALETTEENTRY lpDDColorTable) 52 | { 53 | if (lpDD) 54 | { 55 | lpDD = static_cast(lpDD)->GetProxyInterface(); 56 | } 57 | 58 | return ProxyInterface->Initialize(lpDD, dwFlags, lpDDColorTable); 59 | } 60 | 61 | HRESULT m_IDirectDrawPalette::SetEntries(DWORD dwFlags, DWORD dwStartingEntry, DWORD dwCount, LPPALETTEENTRY lpEntries) 62 | { 63 | return ProxyInterface->SetEntries(dwFlags, dwStartingEntry, dwCount, lpEntries); 64 | } 65 | -------------------------------------------------------------------------------- /ddraw/IDirectDrawPalette.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectDrawPalette : public IDirectDrawPalette, public AddressLookupTableObject 4 | { 5 | private: 6 | IDirectDrawPalette *ProxyInterface; 7 | REFIID WrapperID = IID_IDirectDrawPalette; 8 | 9 | public: 10 | m_IDirectDrawPalette(IDirectDrawPalette *aOriginal) : ProxyInterface(aOriginal) 11 | { 12 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 13 | } 14 | ~m_IDirectDrawPalette() 15 | { 16 | ProxyAddressLookupTable.DeleteAddress(this); 17 | } 18 | 19 | UINT32 *rgbPalette = nullptr; // Rgb translated palette 20 | LPPALETTEENTRY rawPalette = nullptr; // Raw palette data 21 | 22 | DWORD GetDirectXVersion() { return 1; } 23 | REFIID GetWrapperType() { return WrapperID; } 24 | IDirectDrawPalette *GetProxyInterface() { return ProxyInterface; } 25 | m_IDirectDrawPalette *GetWrapperInterface() { return this; } 26 | 27 | /*** IUnknown methods ***/ 28 | STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj); 29 | STDMETHOD_(ULONG, AddRef) (THIS); 30 | STDMETHOD_(ULONG, Release) (THIS); 31 | /*** IDirectDrawPalette methods ***/ 32 | STDMETHOD(GetCaps)(THIS_ LPDWORD); 33 | STDMETHOD(GetEntries)(THIS_ DWORD, DWORD, DWORD, LPPALETTEENTRY); 34 | STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, DWORD, LPPALETTEENTRY); 35 | STDMETHOD(SetEntries)(THIS_ DWORD, DWORD, DWORD, LPPALETTEENTRY); 36 | }; 37 | -------------------------------------------------------------------------------- /ddraw/License.txt: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ -------------------------------------------------------------------------------- /ddraw/Versions/IDirect3D.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "..\ddraw.h" 18 | 19 | HRESULT m_IDirect3D::QueryInterface(REFIID riid, LPVOID * ppvObj) 20 | { 21 | return ProxyInterface->QueryInterface(riid, ppvObj); 22 | } 23 | 24 | ULONG m_IDirect3D::AddRef() 25 | { 26 | return ProxyInterface->AddRef(); 27 | } 28 | 29 | ULONG m_IDirect3D::Release() 30 | { 31 | return ProxyInterface->Release(); 32 | } 33 | 34 | HRESULT m_IDirect3D::Initialize(REFCLSID a) 35 | { 36 | return ProxyInterface->Initialize(a); 37 | } 38 | 39 | HRESULT m_IDirect3D::EnumDevices(LPD3DENUMDEVICESCALLBACK a, LPVOID b) 40 | { 41 | return ProxyInterface->EnumDevices(a, b); 42 | } 43 | 44 | HRESULT m_IDirect3D::CreateLight(LPDIRECT3DLIGHT * a, IUnknown * b) 45 | { 46 | return ProxyInterface->CreateLight(a, b); 47 | } 48 | 49 | HRESULT m_IDirect3D::CreateMaterial(LPDIRECT3DMATERIAL * a, IUnknown * b) 50 | { 51 | return ProxyInterface->CreateMaterial((LPDIRECT3DMATERIAL3*)a, b); 52 | } 53 | 54 | HRESULT m_IDirect3D::CreateViewport(LPDIRECT3DVIEWPORT * a, IUnknown * b) 55 | { 56 | return ProxyInterface->CreateViewport((LPDIRECT3DVIEWPORT3*)a, b); 57 | } 58 | 59 | HRESULT m_IDirect3D::FindDevice(LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b) 60 | { 61 | return ProxyInterface->FindDevice(a, b); 62 | } 63 | -------------------------------------------------------------------------------- /ddraw/Versions/IDirect3D.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3D : public IDirect3D, public AddressLookupTableObject 4 | { 5 | private: 6 | std::unique_ptr ProxyInterface; 7 | IDirect3D *RealInterface; 8 | REFIID WrapperID = IID_IDirect3D; 9 | 10 | public: 11 | m_IDirect3D(IDirect3D *aOriginal) : RealInterface(aOriginal) 12 | { 13 | ProxyInterface = std::make_unique((IDirect3D7*)RealInterface, 1, (m_IDirect3D7*)this); 14 | ProxyAddressLookupTable.SaveAddress(this, RealInterface); 15 | } 16 | ~m_IDirect3D() 17 | { 18 | ProxyAddressLookupTable.DeleteAddress(this); 19 | } 20 | 21 | DWORD GetDirectXVersion() { return 1; } 22 | REFIID GetWrapperType() { return WrapperID; } 23 | IDirect3D *GetProxyInterface() { return RealInterface; } 24 | m_IDirect3DX *GetWrapperInterface() { return ProxyInterface.get(); } 25 | 26 | /*** IUnknown methods ***/ 27 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 28 | STDMETHOD_(ULONG, AddRef)(THIS); 29 | STDMETHOD_(ULONG, Release)(THIS); 30 | 31 | /*** IDirect3D methods ***/ 32 | STDMETHOD(Initialize)(THIS_ REFCLSID); 33 | STDMETHOD(EnumDevices)(THIS_ LPD3DENUMDEVICESCALLBACK, LPVOID); 34 | STDMETHOD(CreateLight)(THIS_ LPDIRECT3DLIGHT*, IUnknown*); 35 | STDMETHOD(CreateMaterial)(THIS_ LPDIRECT3DMATERIAL*, IUnknown*); 36 | STDMETHOD(CreateViewport)(THIS_ LPDIRECT3DVIEWPORT*, IUnknown*); 37 | STDMETHOD(FindDevice)(THIS_ LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT); 38 | }; 39 | -------------------------------------------------------------------------------- /ddraw/Versions/IDirect3D2.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "..\ddraw.h" 18 | 19 | HRESULT m_IDirect3D2::QueryInterface(REFIID riid, LPVOID * ppvObj) 20 | { 21 | return ProxyInterface->QueryInterface(riid, ppvObj); 22 | } 23 | 24 | ULONG m_IDirect3D2::AddRef() 25 | { 26 | return ProxyInterface->AddRef(); 27 | } 28 | 29 | ULONG m_IDirect3D2::Release() 30 | { 31 | return ProxyInterface->Release(); 32 | } 33 | 34 | HRESULT m_IDirect3D2::EnumDevices(LPD3DENUMDEVICESCALLBACK a, LPVOID b) 35 | { 36 | return ProxyInterface->EnumDevices(a, b); 37 | } 38 | 39 | HRESULT m_IDirect3D2::CreateLight(LPDIRECT3DLIGHT * a, IUnknown * b) 40 | { 41 | return ProxyInterface->CreateLight(a, b); 42 | } 43 | 44 | HRESULT m_IDirect3D2::CreateMaterial(LPDIRECT3DMATERIAL2 * a, IUnknown * b) 45 | { 46 | return ProxyInterface->CreateMaterial((LPDIRECT3DMATERIAL3*)a, b); 47 | } 48 | 49 | HRESULT m_IDirect3D2::CreateViewport(LPDIRECT3DVIEWPORT2 * a, IUnknown * b) 50 | { 51 | return ProxyInterface->CreateViewport((LPDIRECT3DVIEWPORT3*)a, b); 52 | } 53 | 54 | HRESULT m_IDirect3D2::FindDevice(LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b) 55 | { 56 | return ProxyInterface->FindDevice(a, b); 57 | } 58 | 59 | HRESULT m_IDirect3D2::CreateDevice(REFCLSID a, LPDIRECTDRAWSURFACE b, LPDIRECT3DDEVICE2 * c) 60 | { 61 | return ProxyInterface->CreateDevice(a, (LPDIRECTDRAWSURFACE7)b, (LPDIRECT3DDEVICE7*)c, nullptr); 62 | } 63 | -------------------------------------------------------------------------------- /ddraw/Versions/IDirect3D2.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3D2 : public IDirect3D2, public AddressLookupTableObject 4 | { 5 | private: 6 | std::unique_ptr ProxyInterface; 7 | IDirect3D2 *RealInterface; 8 | REFIID WrapperID = IID_IDirect3D2; 9 | 10 | public: 11 | m_IDirect3D2(IDirect3D2 *aOriginal) : RealInterface(aOriginal) 12 | { 13 | ProxyInterface = std::make_unique((IDirect3D7*)RealInterface, 2, (m_IDirect3D7*)this); 14 | ProxyAddressLookupTable.SaveAddress(this, RealInterface); 15 | } 16 | ~m_IDirect3D2() 17 | { 18 | ProxyAddressLookupTable.DeleteAddress(this); 19 | } 20 | 21 | DWORD GetDirectXVersion() { return 2; } 22 | REFIID GetWrapperType() { return WrapperID; } 23 | IDirect3D2 *GetProxyInterface() { return RealInterface; } 24 | m_IDirect3DX *GetWrapperInterface() { return ProxyInterface.get(); } 25 | 26 | /*** IUnknown methods ***/ 27 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 28 | STDMETHOD_(ULONG, AddRef)(THIS); 29 | STDMETHOD_(ULONG, Release)(THIS); 30 | 31 | /*** IDirect3D2 methods ***/ 32 | STDMETHOD(EnumDevices)(THIS_ LPD3DENUMDEVICESCALLBACK, LPVOID); 33 | STDMETHOD(CreateLight)(THIS_ LPDIRECT3DLIGHT*, IUnknown*); 34 | STDMETHOD(CreateMaterial)(THIS_ LPDIRECT3DMATERIAL2*, IUnknown*); 35 | STDMETHOD(CreateViewport)(THIS_ LPDIRECT3DVIEWPORT2*, IUnknown*); 36 | STDMETHOD(FindDevice)(THIS_ LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT); 37 | STDMETHOD(CreateDevice)(THIS_ REFCLSID, LPDIRECTDRAWSURFACE, LPDIRECT3DDEVICE2*); 38 | }; 39 | -------------------------------------------------------------------------------- /ddraw/Versions/IDirect3D3.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3D3 : public IDirect3D3, public AddressLookupTableObject 4 | { 5 | private: 6 | std::unique_ptr ProxyInterface; 7 | IDirect3D3 *RealInterface; 8 | REFIID WrapperID = IID_IDirect3D3; 9 | 10 | public: 11 | m_IDirect3D3(IDirect3D3 *aOriginal) : RealInterface(aOriginal) 12 | { 13 | ProxyInterface = std::make_unique((IDirect3D7*)RealInterface, 3, (m_IDirect3D7*)this); 14 | ProxyAddressLookupTable.SaveAddress(this, RealInterface); 15 | } 16 | ~m_IDirect3D3() 17 | { 18 | ProxyAddressLookupTable.DeleteAddress(this); 19 | } 20 | 21 | DWORD GetDirectXVersion() { return 3; } 22 | REFIID GetWrapperType() { return WrapperID; } 23 | IDirect3D3 *GetProxyInterface() { return RealInterface; } 24 | m_IDirect3DX *GetWrapperInterface() { return ProxyInterface.get(); } 25 | 26 | /*** IUnknown methods ***/ 27 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 28 | STDMETHOD_(ULONG, AddRef)(THIS); 29 | STDMETHOD_(ULONG, Release)(THIS); 30 | 31 | /*** IDirect3D3 methods ***/ 32 | STDMETHOD(EnumDevices)(THIS_ LPD3DENUMDEVICESCALLBACK, LPVOID); 33 | STDMETHOD(CreateLight)(THIS_ LPDIRECT3DLIGHT*, LPUNKNOWN); 34 | STDMETHOD(CreateMaterial)(THIS_ LPDIRECT3DMATERIAL3*, LPUNKNOWN); 35 | STDMETHOD(CreateViewport)(THIS_ LPDIRECT3DVIEWPORT3*, LPUNKNOWN); 36 | STDMETHOD(FindDevice)(THIS_ LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT); 37 | STDMETHOD(CreateDevice)(THIS_ REFCLSID, LPDIRECTDRAWSURFACE4, LPDIRECT3DDEVICE3*, LPUNKNOWN); 38 | STDMETHOD(CreateVertexBuffer)(THIS_ LPD3DVERTEXBUFFERDESC, LPDIRECT3DVERTEXBUFFER*, DWORD, LPUNKNOWN); 39 | STDMETHOD(EnumZBufferFormats)(THIS_ REFCLSID, LPD3DENUMPIXELFORMATSCALLBACK, LPVOID); 40 | STDMETHOD(EvictManagedTextures)(THIS); 41 | }; 42 | -------------------------------------------------------------------------------- /ddraw/Versions/IDirect3D7.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "..\ddraw.h" 18 | 19 | HRESULT m_IDirect3D7::QueryInterface(REFIID riid, LPVOID * ppvObj) 20 | { 21 | return ProxyInterface->QueryInterface(riid, ppvObj); 22 | } 23 | 24 | ULONG m_IDirect3D7::AddRef() 25 | { 26 | return ProxyInterface->AddRef(); 27 | } 28 | 29 | ULONG m_IDirect3D7::Release() 30 | { 31 | return ProxyInterface->Release(); 32 | } 33 | 34 | HRESULT m_IDirect3D7::EnumDevices(LPD3DENUMDEVICESCALLBACK7 a, LPVOID b) 35 | { 36 | return ProxyInterface->EnumDevices7(a, b); 37 | } 38 | 39 | HRESULT m_IDirect3D7::CreateDevice(REFCLSID a, LPDIRECTDRAWSURFACE7 b, LPDIRECT3DDEVICE7 * c) 40 | { 41 | return ProxyInterface->CreateDevice(a, b, c, nullptr); 42 | } 43 | 44 | HRESULT m_IDirect3D7::CreateVertexBuffer(LPD3DVERTEXBUFFERDESC a, LPDIRECT3DVERTEXBUFFER7 * b, DWORD c) 45 | { 46 | return ProxyInterface->CreateVertexBuffer(a, b, c, nullptr); 47 | } 48 | 49 | HRESULT m_IDirect3D7::EnumZBufferFormats(REFCLSID a, LPD3DENUMPIXELFORMATSCALLBACK b, LPVOID c) 50 | { 51 | return ProxyInterface->EnumZBufferFormats(a, b, c); 52 | } 53 | 54 | HRESULT m_IDirect3D7::EvictManagedTextures() 55 | { 56 | return ProxyInterface->EvictManagedTextures(); 57 | } 58 | -------------------------------------------------------------------------------- /ddraw/Versions/IDirect3D7.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3D7 : public IDirect3D7, public AddressLookupTableObject 4 | { 5 | private: 6 | std::unique_ptr ProxyInterface; 7 | IDirect3D7 *RealInterface; 8 | REFIID WrapperID = IID_IDirect3D7; 9 | 10 | public: 11 | m_IDirect3D7(IDirect3D7 *aOriginal) : RealInterface(aOriginal) 12 | { 13 | ProxyInterface = std::make_unique(RealInterface, 7, this); 14 | ProxyAddressLookupTable.SaveAddress(this, RealInterface); 15 | } 16 | ~m_IDirect3D7() 17 | { 18 | ProxyAddressLookupTable.DeleteAddress(this); 19 | } 20 | 21 | DWORD GetDirectXVersion() { return 7; } 22 | REFIID GetWrapperType() { return WrapperID; } 23 | IDirect3D7 *GetProxyInterface() { return RealInterface; } 24 | m_IDirect3DX *GetWrapperInterface() { return ProxyInterface.get(); } 25 | 26 | /*** IUnknown methods ***/ 27 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 28 | STDMETHOD_(ULONG, AddRef)(THIS); 29 | STDMETHOD_(ULONG, Release)(THIS); 30 | 31 | /*** IDirect3D7 methods ***/ 32 | STDMETHOD(EnumDevices)(THIS_ LPD3DENUMDEVICESCALLBACK7, LPVOID); 33 | STDMETHOD(CreateDevice)(THIS_ REFCLSID, LPDIRECTDRAWSURFACE7, LPDIRECT3DDEVICE7*); 34 | STDMETHOD(CreateVertexBuffer)(THIS_ LPD3DVERTEXBUFFERDESC, LPDIRECT3DVERTEXBUFFER7*, DWORD); 35 | STDMETHOD(EnumZBufferFormats)(THIS_ REFCLSID, LPD3DENUMPIXELFORMATSCALLBACK, LPVOID); 36 | STDMETHOD(EvictManagedTextures)(THIS); 37 | }; 38 | -------------------------------------------------------------------------------- /ddraw/Versions/IDirect3DDevice.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DDevice : public IDirect3DDevice, public AddressLookupTableObject 4 | { 5 | private: 6 | std::unique_ptr ProxyInterface; 7 | IDirect3DDevice *RealInterface; 8 | REFIID WrapperID = IID_IDirect3DDevice; 9 | 10 | public: 11 | m_IDirect3DDevice(IDirect3DDevice *aOriginal) : RealInterface(aOriginal) 12 | { 13 | ProxyInterface = std::make_unique((IDirect3DDevice7*)RealInterface, 1, (m_IDirect3DDevice7*)this); 14 | ProxyAddressLookupTable.SaveAddress(this, RealInterface); 15 | } 16 | ~m_IDirect3DDevice() 17 | { 18 | ProxyAddressLookupTable.DeleteAddress(this); 19 | } 20 | 21 | DWORD GetDirectXVersion() { return 1; } 22 | REFIID GetWrapperType() { return WrapperID; } 23 | IDirect3DDevice *GetProxyInterface() { return RealInterface; } 24 | m_IDirect3DDeviceX *GetWrapperInterface() { return ProxyInterface.get(); } 25 | 26 | /*** IUnknown methods ***/ 27 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 28 | STDMETHOD_(ULONG, AddRef)(THIS); 29 | STDMETHOD_(ULONG, Release)(THIS); 30 | 31 | /*** IDirect3DDevice methods ***/ 32 | STDMETHOD(Initialize)(THIS_ LPDIRECT3D, LPGUID, LPD3DDEVICEDESC); 33 | STDMETHOD(GetCaps)(THIS_ LPD3DDEVICEDESC, LPD3DDEVICEDESC); 34 | STDMETHOD(SwapTextureHandles)(THIS_ LPDIRECT3DTEXTURE, LPDIRECT3DTEXTURE); 35 | STDMETHOD(CreateExecuteBuffer)(THIS_ LPD3DEXECUTEBUFFERDESC, LPDIRECT3DEXECUTEBUFFER*, IUnknown*); 36 | STDMETHOD(GetStats)(THIS_ LPD3DSTATS); 37 | STDMETHOD(Execute)(THIS_ LPDIRECT3DEXECUTEBUFFER, LPDIRECT3DVIEWPORT, DWORD); 38 | STDMETHOD(AddViewport)(THIS_ LPDIRECT3DVIEWPORT); 39 | STDMETHOD(DeleteViewport)(THIS_ LPDIRECT3DVIEWPORT); 40 | STDMETHOD(NextViewport)(THIS_ LPDIRECT3DVIEWPORT, LPDIRECT3DVIEWPORT*, DWORD); 41 | STDMETHOD(Pick)(THIS_ LPDIRECT3DEXECUTEBUFFER, LPDIRECT3DVIEWPORT, DWORD, LPD3DRECT); 42 | STDMETHOD(GetPickRecords)(THIS_ LPDWORD, LPD3DPICKRECORD); 43 | STDMETHOD(EnumTextureFormats)(THIS_ LPD3DENUMTEXTUREFORMATSCALLBACK, LPVOID); 44 | STDMETHOD(CreateMatrix)(THIS_ LPD3DMATRIXHANDLE); 45 | STDMETHOD(SetMatrix)(THIS_ D3DMATRIXHANDLE, const LPD3DMATRIX); 46 | STDMETHOD(GetMatrix)(THIS_ D3DMATRIXHANDLE, LPD3DMATRIX); 47 | STDMETHOD(DeleteMatrix)(THIS_ D3DMATRIXHANDLE); 48 | STDMETHOD(BeginScene)(THIS); 49 | STDMETHOD(EndScene)(THIS); 50 | STDMETHOD(GetDirect3D)(THIS_ LPDIRECT3D*); 51 | }; 52 | -------------------------------------------------------------------------------- /ddraw/Versions/IDirect3DMaterial.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "..\ddraw.h" 18 | 19 | HRESULT m_IDirect3DMaterial::QueryInterface(REFIID riid, LPVOID * ppvObj) 20 | { 21 | return ProxyInterface->QueryInterface(riid, ppvObj); 22 | } 23 | 24 | ULONG m_IDirect3DMaterial::AddRef() 25 | { 26 | return ProxyInterface->AddRef(); 27 | } 28 | 29 | ULONG m_IDirect3DMaterial::Release() 30 | { 31 | return ProxyInterface->Release(); 32 | } 33 | 34 | HRESULT m_IDirect3DMaterial::Initialize(LPDIRECT3D a) 35 | { 36 | return ProxyInterface->Initialize(a); 37 | } 38 | 39 | HRESULT m_IDirect3DMaterial::SetMaterial(LPD3DMATERIAL a) 40 | { 41 | return ProxyInterface->SetMaterial(a); 42 | } 43 | 44 | HRESULT m_IDirect3DMaterial::GetMaterial(LPD3DMATERIAL a) 45 | { 46 | return ProxyInterface->GetMaterial(a); 47 | } 48 | 49 | HRESULT m_IDirect3DMaterial::GetHandle(LPDIRECT3DDEVICE a, LPD3DMATERIALHANDLE b) 50 | { 51 | return ProxyInterface->GetHandle((LPDIRECT3DDEVICE3)a, b); 52 | } 53 | 54 | HRESULT m_IDirect3DMaterial::Reserve() 55 | { 56 | return ProxyInterface->Reserve(); 57 | } 58 | 59 | HRESULT m_IDirect3DMaterial::Unreserve() 60 | { 61 | return ProxyInterface->Unreserve(); 62 | } 63 | -------------------------------------------------------------------------------- /ddraw/Versions/IDirect3DMaterial.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DMaterial : public IDirect3DMaterial, public AddressLookupTableObject 4 | { 5 | private: 6 | std::unique_ptr ProxyInterface; 7 | IDirect3DMaterial *RealInterface; 8 | REFIID WrapperID = IID_IDirect3DMaterial; 9 | 10 | public: 11 | m_IDirect3DMaterial(IDirect3DMaterial *aOriginal) : RealInterface(aOriginal) 12 | { 13 | ProxyInterface = std::make_unique((IDirect3DMaterial3*)RealInterface, 1, (m_IDirect3DMaterial3*)this); 14 | ProxyAddressLookupTable.SaveAddress(this, RealInterface); 15 | } 16 | ~m_IDirect3DMaterial() 17 | { 18 | ProxyAddressLookupTable.DeleteAddress(this); 19 | } 20 | 21 | DWORD GetDirectXVersion() { return 1; } 22 | REFIID GetWrapperType() { return WrapperID; } 23 | IDirect3DMaterial *GetProxyInterface() { return RealInterface; } 24 | m_IDirect3DMaterialX *GetWrapperInterface() { return ProxyInterface.get(); } 25 | 26 | /*** IUnknown methods ***/ 27 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 28 | STDMETHOD_(ULONG, AddRef)(THIS); 29 | STDMETHOD_(ULONG, Release)(THIS); 30 | 31 | /*** IDirect3DMaterial methods ***/ 32 | STDMETHOD(Initialize)(THIS_ LPDIRECT3D); 33 | STDMETHOD(SetMaterial)(THIS_ LPD3DMATERIAL); 34 | STDMETHOD(GetMaterial)(THIS_ LPD3DMATERIAL); 35 | STDMETHOD(GetHandle)(THIS_ LPDIRECT3DDEVICE, LPD3DMATERIALHANDLE); 36 | STDMETHOD(Reserve)(THIS); 37 | STDMETHOD(Unreserve)(THIS); 38 | }; 39 | -------------------------------------------------------------------------------- /ddraw/Versions/IDirect3DMaterial2.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "..\ddraw.h" 18 | 19 | HRESULT m_IDirect3DMaterial2::QueryInterface(REFIID riid, LPVOID * ppvObj) 20 | { 21 | return ProxyInterface->QueryInterface(riid, ppvObj); 22 | } 23 | 24 | ULONG m_IDirect3DMaterial2::AddRef() 25 | { 26 | return ProxyInterface->AddRef(); 27 | } 28 | 29 | ULONG m_IDirect3DMaterial2::Release() 30 | { 31 | return ProxyInterface->Release(); 32 | } 33 | 34 | HRESULT m_IDirect3DMaterial2::SetMaterial(LPD3DMATERIAL a) 35 | { 36 | return ProxyInterface->SetMaterial(a); 37 | } 38 | 39 | HRESULT m_IDirect3DMaterial2::GetMaterial(LPD3DMATERIAL a) 40 | { 41 | return ProxyInterface->GetMaterial(a); 42 | } 43 | 44 | HRESULT m_IDirect3DMaterial2::GetHandle(LPDIRECT3DDEVICE2 a, LPD3DMATERIALHANDLE b) 45 | { 46 | return ProxyInterface->GetHandle((LPDIRECT3DDEVICE3)a, b); 47 | } 48 | -------------------------------------------------------------------------------- /ddraw/Versions/IDirect3DMaterial2.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DMaterial2 : public IDirect3DMaterial2, public AddressLookupTableObject 4 | { 5 | private: 6 | std::unique_ptr ProxyInterface; 7 | IDirect3DMaterial2 *RealInterface; 8 | REFIID WrapperID = IID_IDirect3DMaterial2; 9 | 10 | public: 11 | m_IDirect3DMaterial2(IDirect3DMaterial2 *aOriginal) : RealInterface(aOriginal) 12 | { 13 | ProxyInterface = std::make_unique((IDirect3DMaterial3*)RealInterface, 2, (m_IDirect3DMaterial3*)this); 14 | ProxyAddressLookupTable.SaveAddress(this, RealInterface); 15 | } 16 | ~m_IDirect3DMaterial2() 17 | { 18 | ProxyAddressLookupTable.DeleteAddress(this); 19 | } 20 | 21 | DWORD GetDirectXVersion() { return 2; } 22 | REFIID GetWrapperType() { return WrapperID; } 23 | IDirect3DMaterial2 *GetProxyInterface() { return RealInterface; } 24 | m_IDirect3DMaterialX *GetWrapperInterface() { return ProxyInterface.get(); } 25 | 26 | /*** IUnknown methods ***/ 27 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 28 | STDMETHOD_(ULONG, AddRef)(THIS); 29 | STDMETHOD_(ULONG, Release)(THIS); 30 | 31 | /*** IDirect3DMaterial2 methods ***/ 32 | STDMETHOD(SetMaterial)(THIS_ LPD3DMATERIAL); 33 | STDMETHOD(GetMaterial)(THIS_ LPD3DMATERIAL); 34 | STDMETHOD(GetHandle)(THIS_ LPDIRECT3DDEVICE2, LPD3DMATERIALHANDLE); 35 | }; 36 | -------------------------------------------------------------------------------- /ddraw/Versions/IDirect3DMaterial3.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "..\ddraw.h" 18 | 19 | HRESULT m_IDirect3DMaterial3::QueryInterface(REFIID riid, LPVOID * ppvObj) 20 | { 21 | return ProxyInterface->QueryInterface(riid, ppvObj); 22 | } 23 | 24 | ULONG m_IDirect3DMaterial3::AddRef() 25 | { 26 | return ProxyInterface->AddRef(); 27 | } 28 | 29 | ULONG m_IDirect3DMaterial3::Release() 30 | { 31 | return ProxyInterface->Release(); 32 | } 33 | 34 | HRESULT m_IDirect3DMaterial3::SetMaterial(LPD3DMATERIAL a) 35 | { 36 | return ProxyInterface->SetMaterial(a); 37 | } 38 | 39 | HRESULT m_IDirect3DMaterial3::GetMaterial(LPD3DMATERIAL a) 40 | { 41 | return ProxyInterface->GetMaterial(a); 42 | } 43 | 44 | HRESULT m_IDirect3DMaterial3::GetHandle(LPDIRECT3DDEVICE3 a, LPD3DMATERIALHANDLE b) 45 | { 46 | return ProxyInterface->GetHandle(a, b); 47 | } 48 | -------------------------------------------------------------------------------- /ddraw/Versions/IDirect3DMaterial3.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DMaterial3 : public IDirect3DMaterial3, public AddressLookupTableObject 4 | { 5 | private: 6 | std::unique_ptr ProxyInterface; 7 | IDirect3DMaterial3 *RealInterface; 8 | REFIID WrapperID = IID_IDirect3DMaterial3; 9 | 10 | public: 11 | m_IDirect3DMaterial3(IDirect3DMaterial3 *aOriginal) : RealInterface(aOriginal) 12 | { 13 | ProxyInterface = std::make_unique(RealInterface, 3, this); 14 | ProxyAddressLookupTable.SaveAddress(this, RealInterface); 15 | } 16 | ~m_IDirect3DMaterial3() 17 | { 18 | ProxyAddressLookupTable.DeleteAddress(this); 19 | } 20 | 21 | DWORD GetDirectXVersion() { return 3; } 22 | REFIID GetWrapperType() { return WrapperID; } 23 | IDirect3DMaterial3 *GetProxyInterface() { return RealInterface; } 24 | m_IDirect3DMaterialX *GetWrapperInterface() { return ProxyInterface.get(); } 25 | 26 | /*** IUnknown methods ***/ 27 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 28 | STDMETHOD_(ULONG, AddRef)(THIS); 29 | STDMETHOD_(ULONG, Release)(THIS); 30 | 31 | /*** IDirect3DMaterial3 methods ***/ 32 | STDMETHOD(SetMaterial)(THIS_ LPD3DMATERIAL); 33 | STDMETHOD(GetMaterial)(THIS_ LPD3DMATERIAL); 34 | STDMETHOD(GetHandle)(THIS_ LPDIRECT3DDEVICE3, LPD3DMATERIALHANDLE); 35 | }; 36 | -------------------------------------------------------------------------------- /ddraw/Versions/IDirect3DTexture.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "..\ddraw.h" 18 | 19 | HRESULT m_IDirect3DTexture::QueryInterface(REFIID riid, LPVOID * ppvObj) 20 | { 21 | return ProxyInterface->QueryInterface(riid, ppvObj); 22 | } 23 | 24 | ULONG m_IDirect3DTexture::AddRef() 25 | { 26 | return ProxyInterface->AddRef(); 27 | } 28 | 29 | ULONG m_IDirect3DTexture::Release() 30 | { 31 | return ProxyInterface->Release(); 32 | } 33 | 34 | HRESULT m_IDirect3DTexture::Initialize(LPDIRECT3DDEVICE a, LPDIRECTDRAWSURFACE b) 35 | { 36 | return ProxyInterface->Initialize(a, b); 37 | } 38 | 39 | HRESULT m_IDirect3DTexture::GetHandle(LPDIRECT3DDEVICE a, LPD3DTEXTUREHANDLE b) 40 | { 41 | return ProxyInterface->GetHandle((LPDIRECT3DDEVICE2)a, b); 42 | } 43 | 44 | HRESULT m_IDirect3DTexture::PaletteChanged(DWORD a, DWORD b) 45 | { 46 | return ProxyInterface->PaletteChanged(a, b); 47 | } 48 | 49 | HRESULT m_IDirect3DTexture::Load(LPDIRECT3DTEXTURE a) 50 | { 51 | return ProxyInterface->Load((LPDIRECT3DTEXTURE2)a); 52 | } 53 | 54 | HRESULT m_IDirect3DTexture::Unload() 55 | { 56 | return ProxyInterface->Unload(); 57 | } 58 | -------------------------------------------------------------------------------- /ddraw/Versions/IDirect3DTexture.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DTexture : public IDirect3DTexture, public AddressLookupTableObject 4 | { 5 | private: 6 | std::unique_ptr ProxyInterface; 7 | IDirect3DTexture *RealInterface; 8 | REFIID WrapperID = IID_IDirect3DTexture; 9 | 10 | public: 11 | m_IDirect3DTexture(IDirect3DTexture *aOriginal) : RealInterface(aOriginal) 12 | { 13 | ProxyInterface = std::make_unique((IDirect3DTexture2*)RealInterface, 1, (m_IDirect3DTexture2*)this); 14 | ProxyAddressLookupTable.SaveAddress(this, RealInterface); 15 | } 16 | ~m_IDirect3DTexture() 17 | { 18 | ProxyAddressLookupTable.DeleteAddress(this); 19 | } 20 | 21 | DWORD GetDirectXVersion() { return 1; } 22 | REFIID GetWrapperType() { return WrapperID; } 23 | IDirect3DTexture *GetProxyInterface() { return RealInterface; } 24 | m_IDirect3DTextureX *GetWrapperInterface() { return ProxyInterface.get(); } 25 | 26 | /*** IUnknown methods ***/ 27 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 28 | STDMETHOD_(ULONG, AddRef)(THIS); 29 | STDMETHOD_(ULONG, Release)(THIS); 30 | 31 | /*** IDirect3DTexture methods ***/ 32 | STDMETHOD(Initialize)(THIS_ LPDIRECT3DDEVICE, LPDIRECTDRAWSURFACE); 33 | STDMETHOD(GetHandle)(THIS_ LPDIRECT3DDEVICE, LPD3DTEXTUREHANDLE); 34 | STDMETHOD(PaletteChanged)(THIS_ DWORD, DWORD); 35 | STDMETHOD(Load)(THIS_ LPDIRECT3DTEXTURE); 36 | STDMETHOD(Unload)(THIS); 37 | }; 38 | -------------------------------------------------------------------------------- /ddraw/Versions/IDirect3DTexture2.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "..\ddraw.h" 18 | 19 | HRESULT m_IDirect3DTexture2::QueryInterface(REFIID riid, LPVOID * ppvObj) 20 | { 21 | return ProxyInterface->QueryInterface(riid, ppvObj); 22 | } 23 | 24 | ULONG m_IDirect3DTexture2::AddRef() 25 | { 26 | return ProxyInterface->AddRef(); 27 | } 28 | 29 | ULONG m_IDirect3DTexture2::Release() 30 | { 31 | return ProxyInterface->Release(); 32 | } 33 | 34 | HRESULT m_IDirect3DTexture2::GetHandle(LPDIRECT3DDEVICE2 a, LPD3DTEXTUREHANDLE b) 35 | { 36 | return ProxyInterface->GetHandle(a, b); 37 | } 38 | 39 | HRESULT m_IDirect3DTexture2::PaletteChanged(DWORD a, DWORD b) 40 | { 41 | return ProxyInterface->PaletteChanged(a, b); 42 | } 43 | 44 | HRESULT m_IDirect3DTexture2::Load(LPDIRECT3DTEXTURE2 a) 45 | { 46 | return ProxyInterface->Load(a); 47 | } 48 | -------------------------------------------------------------------------------- /ddraw/Versions/IDirect3DTexture2.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DTexture2 : public IDirect3DTexture2, public AddressLookupTableObject 4 | { 5 | private: 6 | std::unique_ptr ProxyInterface; 7 | IDirect3DTexture2 *RealInterface; 8 | REFIID WrapperID = IID_IDirect3DTexture2; 9 | 10 | public: 11 | m_IDirect3DTexture2(IDirect3DTexture2 *aOriginal) : RealInterface(aOriginal) 12 | { 13 | ProxyInterface = std::make_unique(RealInterface, 2, this); 14 | ProxyAddressLookupTable.SaveAddress(this, RealInterface); 15 | } 16 | ~m_IDirect3DTexture2() 17 | { 18 | ProxyAddressLookupTable.DeleteAddress(this); 19 | } 20 | 21 | DWORD GetDirectXVersion() { return 2; } 22 | REFIID GetWrapperType() { return WrapperID; } 23 | IDirect3DTexture2 *GetProxyInterface() { return RealInterface; } 24 | m_IDirect3DTextureX *GetWrapperInterface() { return ProxyInterface.get(); } 25 | 26 | /*** IUnknown methods ***/ 27 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 28 | STDMETHOD_(ULONG, AddRef)(THIS); 29 | STDMETHOD_(ULONG, Release)(THIS); 30 | 31 | /*** IDirect3DTexture2 methods ***/ 32 | STDMETHOD(GetHandle)(THIS_ LPDIRECT3DDEVICE2, LPD3DTEXTUREHANDLE); 33 | STDMETHOD(PaletteChanged)(THIS_ DWORD, DWORD); 34 | STDMETHOD(Load)(THIS_ LPDIRECT3DTEXTURE2); 35 | }; 36 | -------------------------------------------------------------------------------- /ddraw/Versions/IDirect3DVertexBuffer.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "..\ddraw.h" 18 | 19 | HRESULT m_IDirect3DVertexBuffer::QueryInterface(REFIID riid, LPVOID * ppvObj) 20 | { 21 | return ProxyInterface->QueryInterface(riid, ppvObj); 22 | } 23 | 24 | ULONG m_IDirect3DVertexBuffer::AddRef() 25 | { 26 | return ProxyInterface->AddRef(); 27 | } 28 | 29 | ULONG m_IDirect3DVertexBuffer::Release() 30 | { 31 | return ProxyInterface->Release(); 32 | } 33 | 34 | HRESULT m_IDirect3DVertexBuffer::Lock(DWORD a, LPVOID * b, LPDWORD c) 35 | { 36 | return ProxyInterface->Lock(a, b, c); 37 | } 38 | 39 | HRESULT m_IDirect3DVertexBuffer::Unlock() 40 | { 41 | return ProxyInterface->Unlock(); 42 | } 43 | 44 | HRESULT m_IDirect3DVertexBuffer::ProcessVertices(DWORD a, DWORD b, DWORD c, LPDIRECT3DVERTEXBUFFER d, DWORD e, LPDIRECT3DDEVICE3 f, DWORD g) 45 | { 46 | return ProxyInterface->ProcessVertices(a, b, c, (LPDIRECT3DVERTEXBUFFER7)d, e, (LPDIRECT3DDEVICE7)f, g); 47 | } 48 | 49 | HRESULT m_IDirect3DVertexBuffer::GetVertexBufferDesc(LPD3DVERTEXBUFFERDESC a) 50 | { 51 | return ProxyInterface->GetVertexBufferDesc(a); 52 | } 53 | 54 | HRESULT m_IDirect3DVertexBuffer::Optimize(LPDIRECT3DDEVICE3 a, DWORD b) 55 | { 56 | return ProxyInterface->Optimize((LPDIRECT3DDEVICE7)a, b); 57 | } 58 | -------------------------------------------------------------------------------- /ddraw/Versions/IDirect3DVertexBuffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DVertexBuffer : public IDirect3DVertexBuffer, public AddressLookupTableObject 4 | { 5 | private: 6 | std::unique_ptr ProxyInterface; 7 | IDirect3DVertexBuffer *RealInterface; 8 | REFIID WrapperID = IID_IDirect3DVertexBuffer; 9 | 10 | public: 11 | m_IDirect3DVertexBuffer(IDirect3DVertexBuffer *aOriginal) : RealInterface(aOriginal) 12 | { 13 | ProxyInterface = std::make_unique((IDirect3DVertexBuffer7*)RealInterface, 1, (m_IDirect3DVertexBuffer7*)this); 14 | ProxyAddressLookupTable.SaveAddress(this, RealInterface); 15 | } 16 | ~m_IDirect3DVertexBuffer() 17 | { 18 | ProxyAddressLookupTable.DeleteAddress(this); 19 | } 20 | 21 | DWORD GetDirectXVersion() { return 1; } 22 | REFIID GetWrapperType() { return WrapperID; } 23 | IDirect3DVertexBuffer *GetProxyInterface() { return RealInterface; } 24 | m_IDirect3DVertexBufferX *GetWrapperInterface() { return ProxyInterface.get(); } 25 | 26 | /*** IUnknown methods ***/ 27 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 28 | STDMETHOD_(ULONG, AddRef)(THIS); 29 | STDMETHOD_(ULONG, Release)(THIS); 30 | 31 | /*** IDirect3DVertexBuffer methods ***/ 32 | STDMETHOD(Lock)(THIS_ DWORD, LPVOID*, LPDWORD); 33 | STDMETHOD(Unlock)(THIS); 34 | STDMETHOD(ProcessVertices)(THIS_ DWORD, DWORD, DWORD, LPDIRECT3DVERTEXBUFFER, DWORD, LPDIRECT3DDEVICE3, DWORD); 35 | STDMETHOD(GetVertexBufferDesc)(THIS_ LPD3DVERTEXBUFFERDESC); 36 | STDMETHOD(Optimize)(THIS_ LPDIRECT3DDEVICE3, DWORD); 37 | }; 38 | -------------------------------------------------------------------------------- /ddraw/Versions/IDirect3DVertexBuffer7.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "..\ddraw.h" 18 | 19 | HRESULT m_IDirect3DVertexBuffer7::QueryInterface(REFIID riid, LPVOID * ppvObj) 20 | { 21 | return ProxyInterface->QueryInterface(riid, ppvObj); 22 | } 23 | 24 | ULONG m_IDirect3DVertexBuffer7::AddRef() 25 | { 26 | return ProxyInterface->AddRef(); 27 | } 28 | 29 | ULONG m_IDirect3DVertexBuffer7::Release() 30 | { 31 | return ProxyInterface->Release(); 32 | } 33 | 34 | HRESULT m_IDirect3DVertexBuffer7::Lock(DWORD a, LPVOID * b, LPDWORD c) 35 | { 36 | return ProxyInterface->Lock(a, b, c); 37 | } 38 | 39 | HRESULT m_IDirect3DVertexBuffer7::Unlock() 40 | { 41 | return ProxyInterface->Unlock(); 42 | } 43 | 44 | HRESULT m_IDirect3DVertexBuffer7::ProcessVertices(DWORD a, DWORD b, DWORD c, LPDIRECT3DVERTEXBUFFER7 d, DWORD e, LPDIRECT3DDEVICE7 f, DWORD g) 45 | { 46 | return ProxyInterface->ProcessVertices(a, b, c, d, e, f, g); 47 | } 48 | 49 | HRESULT m_IDirect3DVertexBuffer7::GetVertexBufferDesc(LPD3DVERTEXBUFFERDESC a) 50 | { 51 | return ProxyInterface->GetVertexBufferDesc(a); 52 | } 53 | 54 | HRESULT m_IDirect3DVertexBuffer7::Optimize(LPDIRECT3DDEVICE7 a, DWORD b) 55 | { 56 | return ProxyInterface->Optimize(a, b); 57 | } 58 | 59 | HRESULT m_IDirect3DVertexBuffer7::ProcessVerticesStrided(DWORD a, DWORD b, DWORD c, LPD3DDRAWPRIMITIVESTRIDEDDATA d, DWORD e, LPDIRECT3DDEVICE7 f, DWORD g) 60 | { 61 | return ProxyInterface->ProcessVerticesStrided(a, b, c, d, e, f, g); 62 | } 63 | -------------------------------------------------------------------------------- /ddraw/Versions/IDirect3DVertexBuffer7.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DVertexBuffer7 : public IDirect3DVertexBuffer7, public AddressLookupTableObject 4 | { 5 | private: 6 | std::unique_ptr ProxyInterface; 7 | IDirect3DVertexBuffer7 *RealInterface; 8 | REFIID WrapperID = IID_IDirect3DVertexBuffer7; 9 | 10 | public: 11 | m_IDirect3DVertexBuffer7(IDirect3DVertexBuffer7 *aOriginal) : RealInterface(aOriginal) 12 | { 13 | ProxyInterface = std::make_unique(RealInterface, 7, this); 14 | ProxyAddressLookupTable.SaveAddress(this, RealInterface); 15 | } 16 | ~m_IDirect3DVertexBuffer7() 17 | { 18 | ProxyAddressLookupTable.DeleteAddress(this); 19 | } 20 | 21 | DWORD GetDirectXVersion() { return 7; } 22 | REFIID GetWrapperType() { return WrapperID; } 23 | IDirect3DVertexBuffer7 *GetProxyInterface() { return RealInterface; } 24 | m_IDirect3DVertexBufferX *GetWrapperInterface() { return ProxyInterface.get(); } 25 | 26 | /*** IUnknown methods ***/ 27 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 28 | STDMETHOD_(ULONG, AddRef)(THIS); 29 | STDMETHOD_(ULONG, Release)(THIS); 30 | 31 | /*** IDirect3DVertexBuffer methods ***/ 32 | STDMETHOD(Lock)(THIS_ DWORD, LPVOID*, LPDWORD); 33 | STDMETHOD(Unlock)(THIS); 34 | STDMETHOD(ProcessVertices)(THIS_ DWORD, DWORD, DWORD, LPDIRECT3DVERTEXBUFFER7, DWORD, LPDIRECT3DDEVICE7, DWORD); 35 | STDMETHOD(GetVertexBufferDesc)(THIS_ LPD3DVERTEXBUFFERDESC); 36 | STDMETHOD(Optimize)(THIS_ LPDIRECT3DDEVICE7, DWORD); 37 | /*** IDirect3DVertexBuffer7 methods ***/ 38 | STDMETHOD(ProcessVerticesStrided)(THIS_ DWORD, DWORD, DWORD, LPD3DDRAWPRIMITIVESTRIDEDDATA, DWORD, LPDIRECT3DDEVICE7, DWORD); 39 | }; 40 | -------------------------------------------------------------------------------- /ddraw/Versions/IDirect3DViewport.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DViewport : public IDirect3DViewport, public AddressLookupTableObject 4 | { 5 | private: 6 | std::unique_ptr ProxyInterface; 7 | IDirect3DViewport *RealInterface; 8 | REFIID WrapperID = IID_IDirect3DViewport; 9 | 10 | public: 11 | m_IDirect3DViewport(IDirect3DViewport *aOriginal) : RealInterface(aOriginal) 12 | { 13 | ProxyInterface = std::make_unique((IDirect3DViewport3*)RealInterface, 1, (m_IDirect3DViewport3*)this); 14 | ProxyAddressLookupTable.SaveAddress(this, RealInterface); 15 | } 16 | ~m_IDirect3DViewport() 17 | { 18 | ProxyAddressLookupTable.DeleteAddress(this); 19 | } 20 | 21 | DWORD GetDirectXVersion() { return 1; } 22 | REFIID GetWrapperType() { return WrapperID; } 23 | IDirect3DViewport *GetProxyInterface() { return RealInterface; } 24 | m_IDirect3DViewportX *GetWrapperInterface() { return ProxyInterface.get(); } 25 | 26 | /*** IUnknown methods ***/ 27 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 28 | STDMETHOD_(ULONG, AddRef)(THIS); 29 | STDMETHOD_(ULONG, Release)(THIS); 30 | 31 | /*** IDirect3DViewport methods ***/ 32 | STDMETHOD(Initialize)(THIS_ LPDIRECT3D); 33 | STDMETHOD(GetViewport)(THIS_ LPD3DVIEWPORT); 34 | STDMETHOD(SetViewport)(THIS_ LPD3DVIEWPORT); 35 | STDMETHOD(TransformVertices)(THIS_ DWORD, LPD3DTRANSFORMDATA, DWORD, LPDWORD); 36 | STDMETHOD(LightElements)(THIS_ DWORD, LPD3DLIGHTDATA); 37 | STDMETHOD(SetBackground)(THIS_ D3DMATERIALHANDLE); 38 | STDMETHOD(GetBackground)(THIS_ LPD3DMATERIALHANDLE, LPBOOL); 39 | STDMETHOD(SetBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE); 40 | STDMETHOD(GetBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE*, LPBOOL); 41 | STDMETHOD(Clear)(THIS_ DWORD, LPD3DRECT, DWORD); 42 | STDMETHOD(AddLight)(THIS_ LPDIRECT3DLIGHT); 43 | STDMETHOD(DeleteLight)(THIS_ LPDIRECT3DLIGHT); 44 | STDMETHOD(NextLight)(THIS_ LPDIRECT3DLIGHT, LPDIRECT3DLIGHT*, DWORD); 45 | }; 46 | -------------------------------------------------------------------------------- /ddraw/Versions/IDirect3DViewport2.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DViewport2 : public IDirect3DViewport2, public AddressLookupTableObject 4 | { 5 | private: 6 | std::unique_ptr ProxyInterface; 7 | IDirect3DViewport2 *RealInterface; 8 | REFIID WrapperID = IID_IDirect3DViewport2; 9 | 10 | public: 11 | m_IDirect3DViewport2(IDirect3DViewport2 *aOriginal) : RealInterface(aOriginal) 12 | { 13 | ProxyInterface = std::make_unique((IDirect3DViewport3*)RealInterface, 2, (m_IDirect3DViewport3*)this); 14 | ProxyAddressLookupTable.SaveAddress(this, RealInterface); 15 | } 16 | ~m_IDirect3DViewport2() 17 | { 18 | ProxyAddressLookupTable.DeleteAddress(this); 19 | } 20 | 21 | DWORD GetDirectXVersion() { return 2; } 22 | REFIID GetWrapperType() { return WrapperID; } 23 | IDirect3DViewport2 *GetProxyInterface() { return RealInterface; } 24 | m_IDirect3DViewportX *GetWrapperInterface() { return ProxyInterface.get(); } 25 | 26 | /*** IUnknown methods ***/ 27 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 28 | STDMETHOD_(ULONG, AddRef)(THIS); 29 | STDMETHOD_(ULONG, Release)(THIS); 30 | 31 | /*** IDirect3DViewport methods ***/ 32 | STDMETHOD(Initialize)(THIS_ LPDIRECT3D); 33 | STDMETHOD(GetViewport)(THIS_ LPD3DVIEWPORT); 34 | STDMETHOD(SetViewport)(THIS_ LPD3DVIEWPORT); 35 | STDMETHOD(TransformVertices)(THIS_ DWORD, LPD3DTRANSFORMDATA, DWORD, LPDWORD); 36 | STDMETHOD(LightElements)(THIS_ DWORD, LPD3DLIGHTDATA); 37 | STDMETHOD(SetBackground)(THIS_ D3DMATERIALHANDLE); 38 | STDMETHOD(GetBackground)(THIS_ LPD3DMATERIALHANDLE, LPBOOL); 39 | STDMETHOD(SetBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE); 40 | STDMETHOD(GetBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE*, LPBOOL); 41 | STDMETHOD(Clear)(THIS_ DWORD, LPD3DRECT, DWORD); 42 | STDMETHOD(AddLight)(THIS_ LPDIRECT3DLIGHT); 43 | STDMETHOD(DeleteLight)(THIS_ LPDIRECT3DLIGHT); 44 | STDMETHOD(NextLight)(THIS_ LPDIRECT3DLIGHT, LPDIRECT3DLIGHT*, DWORD); 45 | /*** IDirect3DViewport2 methods ***/ 46 | STDMETHOD(GetViewport2)(THIS_ LPD3DVIEWPORT2); 47 | STDMETHOD(SetViewport2)(THIS_ LPD3DVIEWPORT2); 48 | }; 49 | -------------------------------------------------------------------------------- /ddraw/Versions/IDirect3DViewport3.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirect3DViewport3 : public IDirect3DViewport3, public AddressLookupTableObject 4 | { 5 | private: 6 | std::unique_ptr ProxyInterface; 7 | IDirect3DViewport3 *RealInterface; 8 | REFIID WrapperID = IID_IDirect3DViewport3; 9 | 10 | public: 11 | m_IDirect3DViewport3(IDirect3DViewport3 *aOriginal) : RealInterface(aOriginal) 12 | { 13 | ProxyInterface = std::make_unique(RealInterface, 3, this); 14 | ProxyAddressLookupTable.SaveAddress(this, RealInterface); 15 | } 16 | ~m_IDirect3DViewport3() 17 | { 18 | ProxyAddressLookupTable.DeleteAddress(this); 19 | } 20 | 21 | DWORD GetDirectXVersion() { return 3; } 22 | REFIID GetWrapperType() { return WrapperID; } 23 | IDirect3DViewport3 *GetProxyInterface() { return RealInterface; } 24 | m_IDirect3DViewportX *GetWrapperInterface() { return ProxyInterface.get(); } 25 | 26 | /*** IUnknown methods ***/ 27 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 28 | STDMETHOD_(ULONG, AddRef)(THIS); 29 | STDMETHOD_(ULONG, Release)(THIS); 30 | 31 | /*** IDirect3DViewport2 methods ***/ 32 | STDMETHOD(Initialize)(THIS_ LPDIRECT3D); 33 | STDMETHOD(GetViewport)(THIS_ LPD3DVIEWPORT); 34 | STDMETHOD(SetViewport)(THIS_ LPD3DVIEWPORT); 35 | STDMETHOD(TransformVertices)(THIS_ DWORD, LPD3DTRANSFORMDATA, DWORD, LPDWORD); 36 | STDMETHOD(LightElements)(THIS_ DWORD, LPD3DLIGHTDATA); 37 | STDMETHOD(SetBackground)(THIS_ D3DMATERIALHANDLE); 38 | STDMETHOD(GetBackground)(THIS_ LPD3DMATERIALHANDLE, LPBOOL); 39 | STDMETHOD(SetBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE); 40 | STDMETHOD(GetBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE*, LPBOOL); 41 | STDMETHOD(Clear)(THIS_ DWORD, LPD3DRECT, DWORD); 42 | STDMETHOD(AddLight)(THIS_ LPDIRECT3DLIGHT); 43 | STDMETHOD(DeleteLight)(THIS_ LPDIRECT3DLIGHT); 44 | STDMETHOD(NextLight)(THIS_ LPDIRECT3DLIGHT, LPDIRECT3DLIGHT*, DWORD); 45 | /*** IDirect3DViewport2 methods ***/ 46 | STDMETHOD(GetViewport2)(THIS_ LPD3DVIEWPORT2); 47 | STDMETHOD(SetViewport2)(THIS_ LPD3DVIEWPORT2); 48 | /*** IDirect3DViewport3 methods ***/ 49 | STDMETHOD(SetBackgroundDepth2)(THIS_ LPDIRECTDRAWSURFACE4); 50 | STDMETHOD(GetBackgroundDepth2)(THIS_ LPDIRECTDRAWSURFACE4*, LPBOOL); 51 | STDMETHOD(Clear2)(THIS_ DWORD, LPD3DRECT, DWORD, D3DCOLOR, D3DVALUE, DWORD); 52 | }; 53 | -------------------------------------------------------------------------------- /ddraw/Versions/IDirectDraw.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectDraw : public IDirectDraw, public AddressLookupTableObject 4 | { 5 | private: 6 | std::unique_ptr ProxyInterface; 7 | IDirectDraw *RealInterface; 8 | REFIID WrapperID = IID_IDirectDraw; 9 | 10 | public: 11 | m_IDirectDraw(IDirectDraw *aOriginal) : RealInterface(aOriginal) 12 | { 13 | ProxyInterface = std::make_unique((IDirectDraw7*)RealInterface, 1, (m_IDirectDraw7*)this); 14 | ProxyAddressLookupTable.SaveAddress(this, RealInterface); 15 | } 16 | ~m_IDirectDraw() 17 | { 18 | ProxyAddressLookupTable.DeleteAddress(this); 19 | } 20 | 21 | DWORD GetDirectXVersion() { return 1; } 22 | REFIID GetWrapperType() { return WrapperID; } 23 | IDirectDraw *GetProxyInterface() { return RealInterface; } 24 | m_IDirectDrawX *GetWrapperInterface() { return ProxyInterface.get(); } 25 | 26 | /*** IUnknown methods ***/ 27 | STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj); 28 | STDMETHOD_(ULONG, AddRef) (THIS); 29 | STDMETHOD_(ULONG, Release) (THIS); 30 | 31 | /*** IDirectDraw methods ***/ 32 | STDMETHOD(Compact)(THIS); 33 | STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR *); 34 | STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR *); 35 | STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *); 36 | STDMETHOD(DuplicateSurface)(THIS_ LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE FAR *); 37 | STDMETHOD(EnumDisplayModes)(THIS_ DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMMODESCALLBACK); 38 | STDMETHOD(EnumSurfaces)(THIS_ DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMSURFACESCALLBACK); 39 | STDMETHOD(FlipToGDISurface)(THIS); 40 | STDMETHOD(GetCaps)(THIS_ LPDDCAPS, LPDDCAPS); 41 | STDMETHOD(GetDisplayMode)(THIS_ LPDDSURFACEDESC); 42 | STDMETHOD(GetFourCCCodes)(THIS_ LPDWORD, LPDWORD); 43 | STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE FAR *); 44 | STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD); 45 | STDMETHOD(GetScanLine)(THIS_ LPDWORD); 46 | STDMETHOD(GetVerticalBlankStatus)(THIS_ LPBOOL); 47 | STDMETHOD(Initialize)(THIS_ GUID FAR *); 48 | STDMETHOD(RestoreDisplayMode)(THIS); 49 | STDMETHOD(SetCooperativeLevel)(THIS_ HWND, DWORD); 50 | STDMETHOD(SetDisplayMode)(THIS_ DWORD, DWORD, DWORD); 51 | STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD, HANDLE); 52 | }; 53 | -------------------------------------------------------------------------------- /ddraw/Versions/License.txt: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ -------------------------------------------------------------------------------- /ddraw/ddraw.def: -------------------------------------------------------------------------------- 1 | LIBRARY ddraw 2 | EXPORTS 3 | 4 | AcquireDDThreadLock @1 5 | CompleteCreateSysmemSurface @2 6 | D3DParseUnknownCommand @3 7 | DDGetAttachedSurfaceLcl @4 8 | DDInternalLock @5 9 | DDInternalUnlock @6 10 | DSoundHelp @7 11 | DirectDrawCreate @8 12 | DirectDrawCreateClipper @9 13 | DirectDrawCreateEx @10 14 | DirectDrawEnumerateA @11 15 | DirectDrawEnumerateExA @12 16 | DirectDrawEnumerateExW @13 17 | DirectDrawEnumerateW @14 18 | DllCanUnloadNow PRIVATE 19 | DllGetClassObject PRIVATE 20 | GetDDSurfaceLocal @17 21 | GetOLEThunkData @18 22 | GetSurfaceFromDC @19 23 | RegisterSpecialCase @20 24 | ReleaseDDThreadLock @21 25 | SetAppCompatData @22 26 | -------------------------------------------------------------------------------- /dinput/IDirectInputEffect.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectInputEffect : public IDirectInputEffect, public AddressLookupTableObject 4 | { 5 | private: 6 | IDirectInputEffect *ProxyInterface; 7 | 8 | public: 9 | m_IDirectInputEffect(IDirectInputEffect *aOriginal) : ProxyInterface(aOriginal) 10 | { 11 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 12 | } 13 | ~m_IDirectInputEffect() 14 | { 15 | ProxyAddressLookupTable.DeleteAddress(this); 16 | } 17 | 18 | IDirectInputEffect *GetProxyInterface() { return ProxyInterface; } 19 | 20 | /*** IUnknown methods ***/ 21 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 22 | STDMETHOD_(ULONG, AddRef)(THIS); 23 | STDMETHOD_(ULONG, Release)(THIS); 24 | 25 | /*** IDirectInputEffect methods ***/ 26 | STDMETHOD(Initialize)(THIS_ HINSTANCE, DWORD, REFGUID); 27 | STDMETHOD(GetEffectGuid)(THIS_ LPGUID); 28 | STDMETHOD(GetParameters)(THIS_ LPDIEFFECT, DWORD); 29 | STDMETHOD(SetParameters)(THIS_ LPCDIEFFECT, DWORD); 30 | STDMETHOD(Start)(THIS_ DWORD, DWORD); 31 | STDMETHOD(Stop)(THIS); 32 | STDMETHOD(GetEffectStatus)(THIS_ LPDWORD); 33 | STDMETHOD(Download)(THIS); 34 | STDMETHOD(Unload)(THIS); 35 | STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE); 36 | }; 37 | -------------------------------------------------------------------------------- /dinput/IDirectInputX.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectInputX 4 | { 5 | private: 6 | IDirectInput7W *ProxyInterface; 7 | m_IDirectInput7W *WrapperInterface; 8 | DWORD DirectXVersion; 9 | REFIID WrapperID; 10 | 11 | public: 12 | m_IDirectInputX(IDirectInput7W *aOriginal, DWORD Version, REFIID riid, m_IDirectInput7W *Interface) : ProxyInterface(aOriginal), DirectXVersion(Version), WrapperID(riid), WrapperInterface(Interface) {} 13 | ~m_IDirectInputX() {} 14 | 15 | DWORD GetDirectXVersion() { return DDWRAPPER_TYPEX; } 16 | REFIID GetWrapperType() { return WrapperID; } 17 | IDirectInput7W *GetProxyInterface() { return ProxyInterface; } 18 | m_IDirectInput7W *GetWrapperInterface() { return WrapperInterface; } 19 | 20 | /*** IUnknown methods ***/ 21 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 22 | STDMETHOD_(ULONG, AddRef)(THIS); 23 | STDMETHOD_(ULONG, Release)(THIS); 24 | 25 | /*** IDirectInput methods ***/ 26 | STDMETHOD(CreateDeviceA)(THIS_ REFGUID, LPDIRECTINPUTDEVICEA *, LPUNKNOWN); 27 | STDMETHOD(CreateDeviceW)(THIS_ REFGUID, LPDIRECTINPUTDEVICEW *, LPUNKNOWN); 28 | STDMETHOD(EnumDevicesA)(THIS_ DWORD, LPDIENUMDEVICESCALLBACKA, LPVOID, DWORD); 29 | STDMETHOD(EnumDevicesW)(THIS_ DWORD, LPDIENUMDEVICESCALLBACKW, LPVOID, DWORD); 30 | STDMETHOD(GetDeviceStatus)(THIS_ REFGUID); 31 | STDMETHOD(RunControlPanel)(THIS_ HWND, DWORD); 32 | STDMETHOD(Initialize)(THIS_ HINSTANCE, DWORD); 33 | 34 | /*** IDirectInput2 methods ***/ 35 | STDMETHOD(FindDeviceA)(THIS_ REFGUID, LPCSTR, LPGUID); 36 | STDMETHOD(FindDeviceW)(THIS_ REFGUID, LPCWSTR, LPGUID); 37 | 38 | /*** IDirectInput7 methods ***/ 39 | STDMETHOD(CreateDeviceEx)(THIS_ REFGUID rguid, REFIID riid, LPVOID *ppvObj, LPUNKNOWN pUnkOuter); 40 | 41 | // Helper functions 42 | IDirectInput7A *GetProxyInterfaceA() { return (IDirectInput7A*)ProxyInterface; } 43 | IDirectInput7W *GetProxyInterfaceW() { return ProxyInterface; } 44 | }; 45 | -------------------------------------------------------------------------------- /dinput/InterfaceQuery.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "dinput.h" 18 | 19 | HRESULT ProxyQueryInterface(LPVOID ProxyInterface, REFIID riid, LPVOID * ppvObj, REFIID WrapperID, LPVOID WrapperInterface) 20 | { 21 | if ((riid == WrapperID || riid == IID_IUnknown) && ppvObj) 22 | { 23 | ((IUnknown*)ProxyInterface)->AddRef(); 24 | 25 | *ppvObj = WrapperInterface; 26 | 27 | return S_OK; 28 | } 29 | 30 | HRESULT hr = ((IUnknown*)ProxyInterface)->QueryInterface(riid, ppvObj); 31 | 32 | if (SUCCEEDED(hr)) 33 | { 34 | genericQueryInterface(riid, ppvObj); 35 | } 36 | 37 | return hr; 38 | } 39 | 40 | void genericQueryInterface(REFIID riid, LPVOID * ppvObj) 41 | { 42 | if (!ppvObj || !*ppvObj) 43 | { 44 | return; 45 | } 46 | 47 | #define QUERYINTERFACE(x) \ 48 | if (riid == IID_ ## x) \ 49 | { \ 50 | *ppvObj = ProxyAddressLookupTable.FindAddress(*ppvObj); \ 51 | } 52 | 53 | QUERYINTERFACE(IDirectInput2A); 54 | QUERYINTERFACE(IDirectInput2W); 55 | QUERYINTERFACE(IDirectInput7A); 56 | QUERYINTERFACE(IDirectInput7W); 57 | QUERYINTERFACE(IDirectInputA); 58 | QUERYINTERFACE(IDirectInputDevice2A); 59 | QUERYINTERFACE(IDirectInputDevice2W); 60 | QUERYINTERFACE(IDirectInputDevice7A); 61 | QUERYINTERFACE(IDirectInputDevice7W); 62 | QUERYINTERFACE(IDirectInputDeviceA); 63 | QUERYINTERFACE(IDirectInputDeviceW); 64 | QUERYINTERFACE(IDirectInputEffect); 65 | QUERYINTERFACE(IDirectInputW); 66 | } 67 | -------------------------------------------------------------------------------- /dinput/License.txt: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ -------------------------------------------------------------------------------- /dinput/Versions/IDirectInput2A.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectInput2A : public IDirectInput2A, public AddressLookupTableObject 4 | { 5 | private: 6 | std::unique_ptr ProxyInterface; 7 | IDirectInput2A *RealInterface; 8 | REFIID WrapperID = IID_IDirectInput2A; 9 | 10 | public: 11 | m_IDirectInput2A(IDirectInput2A *aOriginal) : RealInterface(aOriginal) 12 | { 13 | ProxyInterface = std::make_unique((IDirectInput7W*)RealInterface, 2, WrapperID, (m_IDirectInput7W*)this); 14 | ProxyAddressLookupTable.SaveAddress(this, RealInterface); 15 | } 16 | ~m_IDirectInput2A() 17 | { 18 | ProxyAddressLookupTable.DeleteAddress(this); 19 | } 20 | 21 | DWORD GetDirectXVersion() { return 2; } 22 | REFIID GetWrapperType() { return WrapperID; } 23 | IDirectInput2A *GetProxyInterface() { return RealInterface; } 24 | m_IDirectInputX *GetWrapperInterface() { return ProxyInterface.get(); } 25 | 26 | /*** IUnknown methods ***/ 27 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 28 | STDMETHOD_(ULONG, AddRef)(THIS); 29 | STDMETHOD_(ULONG, Release)(THIS); 30 | 31 | /*** IDirectInputA methods ***/ 32 | STDMETHOD(CreateDevice)(THIS_ REFGUID, LPDIRECTINPUTDEVICEA *, LPUNKNOWN); 33 | STDMETHOD(EnumDevices)(THIS_ DWORD, LPDIENUMDEVICESCALLBACKA, LPVOID, DWORD); 34 | STDMETHOD(GetDeviceStatus)(THIS_ REFGUID); 35 | STDMETHOD(RunControlPanel)(THIS_ HWND, DWORD); 36 | STDMETHOD(Initialize)(THIS_ HINSTANCE, DWORD); 37 | /*** IDirectInput2A methods ***/ 38 | STDMETHOD(FindDevice)(THIS_ REFGUID, LPCSTR, LPGUID); 39 | }; 40 | -------------------------------------------------------------------------------- /dinput/Versions/IDirectInput2W.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectInput2W : public IDirectInput2W, public AddressLookupTableObject 4 | { 5 | private: 6 | std::unique_ptr ProxyInterface; 7 | IDirectInput2W *RealInterface; 8 | REFIID WrapperID = IID_IDirectInput2W; 9 | 10 | public: 11 | m_IDirectInput2W(IDirectInput2W *aOriginal) : RealInterface(aOriginal) 12 | { 13 | ProxyInterface = std::make_unique((IDirectInput7W*)RealInterface, 2, WrapperID, (m_IDirectInput7W*)this); 14 | ProxyAddressLookupTable.SaveAddress(this, RealInterface); 15 | } 16 | ~m_IDirectInput2W() 17 | { 18 | ProxyAddressLookupTable.DeleteAddress(this); 19 | } 20 | 21 | DWORD GetDirectXVersion() { return 2; } 22 | REFIID GetWrapperType() { return WrapperID; } 23 | IDirectInput2W *GetProxyInterface() { return RealInterface; } 24 | m_IDirectInputX *GetWrapperInterface() { return ProxyInterface.get(); } 25 | 26 | /*** IUnknown methods ***/ 27 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 28 | STDMETHOD_(ULONG, AddRef)(THIS); 29 | STDMETHOD_(ULONG, Release)(THIS); 30 | 31 | /*** IDirectInputW methods ***/ 32 | STDMETHOD(CreateDevice)(THIS_ REFGUID, LPDIRECTINPUTDEVICEW *, LPUNKNOWN); 33 | STDMETHOD(EnumDevices)(THIS_ DWORD, LPDIENUMDEVICESCALLBACKW, LPVOID, DWORD); 34 | STDMETHOD(GetDeviceStatus)(THIS_ REFGUID); 35 | STDMETHOD(RunControlPanel)(THIS_ HWND, DWORD); 36 | STDMETHOD(Initialize)(THIS_ HINSTANCE, DWORD); 37 | /*** IDirectInput2W methods ***/ 38 | STDMETHOD(FindDevice)(THIS_ REFGUID, LPCWSTR, LPGUID); 39 | }; 40 | -------------------------------------------------------------------------------- /dinput/Versions/IDirectInput7A.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectInput7A : public IDirectInput7A, public AddressLookupTableObject 4 | { 5 | private: 6 | std::unique_ptr ProxyInterface; 7 | IDirectInput7A *RealInterface; 8 | REFIID WrapperID = IID_IDirectInput7A; 9 | 10 | public: 11 | m_IDirectInput7A(IDirectInput7A *aOriginal) : RealInterface(aOriginal) 12 | { 13 | ProxyInterface = std::make_unique((IDirectInput7W*)RealInterface, 7, WrapperID, (m_IDirectInput7W*)this); 14 | ProxyAddressLookupTable.SaveAddress(this, RealInterface); 15 | } 16 | ~m_IDirectInput7A() 17 | { 18 | ProxyAddressLookupTable.DeleteAddress(this); 19 | } 20 | 21 | DWORD GetDirectXVersion() { return 7; } 22 | REFIID GetWrapperType() { return WrapperID; } 23 | IDirectInput7A *GetProxyInterface() { return RealInterface; } 24 | m_IDirectInputX *GetWrapperInterface() { return ProxyInterface.get(); } 25 | 26 | /*** IUnknown methods ***/ 27 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 28 | STDMETHOD_(ULONG, AddRef)(THIS); 29 | STDMETHOD_(ULONG, Release)(THIS); 30 | 31 | /*** IDirectInputA methods ***/ 32 | STDMETHOD(CreateDevice)(THIS_ REFGUID, LPDIRECTINPUTDEVICEA *, LPUNKNOWN); 33 | STDMETHOD(EnumDevices)(THIS_ DWORD, LPDIENUMDEVICESCALLBACKA, LPVOID, DWORD); 34 | STDMETHOD(GetDeviceStatus)(THIS_ REFGUID); 35 | STDMETHOD(RunControlPanel)(THIS_ HWND, DWORD); 36 | STDMETHOD(Initialize)(THIS_ HINSTANCE, DWORD); 37 | /*** IDirectInput2A methods ***/ 38 | STDMETHOD(FindDevice)(THIS_ REFGUID, LPCSTR, LPGUID); 39 | /*** IDirectInput7A methods ***/ 40 | STDMETHOD(CreateDeviceEx)(THIS_ REFGUID, REFIID, LPVOID *, LPUNKNOWN); 41 | }; 42 | -------------------------------------------------------------------------------- /dinput/Versions/IDirectInput7W.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectInput7W : public IDirectInput7W, public AddressLookupTableObject 4 | { 5 | private: 6 | std::unique_ptr ProxyInterface; 7 | IDirectInput7W *RealInterface; 8 | REFIID WrapperID = IID_IDirectInput7W; 9 | 10 | public: 11 | m_IDirectInput7W(IDirectInput7W *aOriginal) : RealInterface(aOriginal) 12 | { 13 | ProxyInterface = std::make_unique(RealInterface, 7, WrapperID, this); 14 | ProxyAddressLookupTable.SaveAddress(this, RealInterface); 15 | } 16 | ~m_IDirectInput7W() 17 | { 18 | ProxyAddressLookupTable.DeleteAddress(this); 19 | } 20 | 21 | DWORD GetDirectXVersion() { return 7; } 22 | REFIID GetWrapperType() { return WrapperID; } 23 | IDirectInput7W *GetProxyInterface() { return RealInterface; } 24 | m_IDirectInputX *GetWrapperInterface() { return ProxyInterface.get(); } 25 | 26 | /*** IUnknown methods ***/ 27 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 28 | STDMETHOD_(ULONG, AddRef)(THIS); 29 | STDMETHOD_(ULONG, Release)(THIS); 30 | 31 | /*** IDirectInputw methods ***/ 32 | STDMETHOD(CreateDevice)(THIS_ REFGUID, LPDIRECTINPUTDEVICEW *, LPUNKNOWN); 33 | STDMETHOD(EnumDevices)(THIS_ DWORD, LPDIENUMDEVICESCALLBACKW, LPVOID, DWORD); 34 | STDMETHOD(GetDeviceStatus)(THIS_ REFGUID); 35 | STDMETHOD(RunControlPanel)(THIS_ HWND, DWORD); 36 | STDMETHOD(Initialize)(THIS_ HINSTANCE, DWORD); 37 | /*** IDirectInput2W methods ***/ 38 | STDMETHOD(FindDevice)(THIS_ REFGUID, LPCWSTR, LPGUID); 39 | /*** IDirectInput7W methods ***/ 40 | STDMETHOD(CreateDeviceEx)(THIS_ REFGUID, REFIID, LPVOID *, LPUNKNOWN); 41 | }; 42 | -------------------------------------------------------------------------------- /dinput/Versions/IDirectInputA.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "..\dinput.h" 18 | 19 | HRESULT m_IDirectInputA::QueryInterface(REFIID riid, LPVOID * ppvObj) 20 | { 21 | return ProxyInterface->QueryInterface(riid, ppvObj); 22 | } 23 | 24 | ULONG m_IDirectInputA::AddRef() 25 | { 26 | return ProxyInterface->AddRef(); 27 | } 28 | 29 | ULONG m_IDirectInputA::Release() 30 | { 31 | return ProxyInterface->Release(); 32 | } 33 | 34 | HRESULT m_IDirectInputA::CreateDevice(REFGUID rguid, LPDIRECTINPUTDEVICEA *lplpDirectInputDevice, LPUNKNOWN pUnkOuter) 35 | { 36 | return ProxyInterface->CreateDeviceA(rguid, lplpDirectInputDevice, pUnkOuter); 37 | } 38 | 39 | HRESULT m_IDirectInputA::EnumDevices(DWORD dwDevType, LPDIENUMDEVICESCALLBACKA lpCallback, LPVOID pvRef, DWORD dwFlags) 40 | { 41 | return ProxyInterface->EnumDevicesA(dwDevType, lpCallback, pvRef, dwFlags); 42 | } 43 | 44 | HRESULT m_IDirectInputA::GetDeviceStatus(REFGUID rguidInstance) 45 | { 46 | return ProxyInterface->GetDeviceStatus(rguidInstance); 47 | } 48 | 49 | HRESULT m_IDirectInputA::RunControlPanel(HWND hwndOwner, DWORD dwFlags) 50 | { 51 | return ProxyInterface->RunControlPanel(hwndOwner, dwFlags); 52 | } 53 | 54 | HRESULT m_IDirectInputA::Initialize(HINSTANCE hinst, DWORD dwVersion) 55 | { 56 | return ProxyInterface->Initialize(hinst, dwVersion); 57 | } 58 | -------------------------------------------------------------------------------- /dinput/Versions/IDirectInputA.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectInputA : public IDirectInputA, public AddressLookupTableObject 4 | { 5 | private: 6 | std::unique_ptr ProxyInterface; 7 | IDirectInputA *RealInterface; 8 | REFIID WrapperID = IID_IDirectInputA; 9 | 10 | public: 11 | m_IDirectInputA(IDirectInputA *aOriginal) : RealInterface(aOriginal) 12 | { 13 | ProxyInterface = std::make_unique((IDirectInput7W*)RealInterface, 1, WrapperID, (m_IDirectInput7W*)this); 14 | ProxyAddressLookupTable.SaveAddress(this, RealInterface); 15 | } 16 | ~m_IDirectInputA() 17 | { 18 | ProxyAddressLookupTable.DeleteAddress(this); 19 | } 20 | 21 | DWORD GetDirectXVersion() { return 1; } 22 | REFIID GetWrapperType() { return WrapperID; } 23 | IDirectInputA *GetProxyInterface() { return RealInterface; } 24 | m_IDirectInputX *GetWrapperInterface() { return ProxyInterface.get(); } 25 | 26 | /*** IUnknown methods ***/ 27 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 28 | STDMETHOD_(ULONG, AddRef)(THIS); 29 | STDMETHOD_(ULONG, Release)(THIS); 30 | 31 | /*** IDirectInput methods ***/ 32 | STDMETHOD(CreateDevice)(THIS_ REFGUID, LPDIRECTINPUTDEVICEA *, LPUNKNOWN); 33 | STDMETHOD(EnumDevices)(THIS_ DWORD, LPDIENUMDEVICESCALLBACKA, LPVOID, DWORD); 34 | STDMETHOD(GetDeviceStatus)(THIS_ REFGUID); 35 | STDMETHOD(RunControlPanel)(THIS_ HWND, DWORD); 36 | STDMETHOD(Initialize)(THIS_ HINSTANCE, DWORD); 37 | }; 38 | -------------------------------------------------------------------------------- /dinput/Versions/IDirectInputDeviceA.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectInputDeviceA : public IDirectInputDeviceA, public AddressLookupTableObject 4 | { 5 | private: 6 | std::unique_ptr ProxyInterface; 7 | IDirectInputDeviceA *RealInterface; 8 | REFIID WrapperID = IID_IDirectInputDeviceA; 9 | 10 | public: 11 | m_IDirectInputDeviceA(IDirectInputDeviceA *aOriginal) : RealInterface(aOriginal) 12 | { 13 | ProxyInterface = std::make_unique((IDirectInputDevice7W*)RealInterface, 1, WrapperID, (m_IDirectInputDevice7W*)this); 14 | ProxyAddressLookupTable.SaveAddress(this, RealInterface); 15 | } 16 | ~m_IDirectInputDeviceA() 17 | { 18 | ProxyAddressLookupTable.DeleteAddress(this); 19 | } 20 | 21 | DWORD GetDirectXVersion() { return 1; } 22 | REFIID GetWrapperType() { return WrapperID; } 23 | IDirectInputDeviceA *GetProxyInterface() { return RealInterface; } 24 | m_IDirectInputDeviceX *GetWrapperInterface() { return ProxyInterface.get(); } 25 | 26 | /*** IUnknown methods ***/ 27 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 28 | STDMETHOD_(ULONG, AddRef)(THIS); 29 | STDMETHOD_(ULONG, Release)(THIS); 30 | 31 | /*** IDirectInputDevice methods ***/ 32 | STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS); 33 | STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA, LPVOID, DWORD); 34 | STDMETHOD(GetProperty)(THIS_ REFGUID, LPDIPROPHEADER); 35 | STDMETHOD(SetProperty)(THIS_ REFGUID, LPCDIPROPHEADER); 36 | STDMETHOD(Acquire)(THIS); 37 | STDMETHOD(Unacquire)(THIS); 38 | STDMETHOD(GetDeviceState)(THIS_ DWORD, LPVOID); 39 | STDMETHOD(GetDeviceData)(THIS_ DWORD, LPDIDEVICEOBJECTDATA, LPDWORD, DWORD); 40 | STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT); 41 | STDMETHOD(SetEventNotification)(THIS_ HANDLE); 42 | STDMETHOD(SetCooperativeLevel)(THIS_ HWND, DWORD); 43 | STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA, DWORD, DWORD); 44 | STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA); 45 | STDMETHOD(RunControlPanel)(THIS_ HWND, DWORD); 46 | STDMETHOD(Initialize)(THIS_ HINSTANCE, DWORD, REFGUID); 47 | }; 48 | -------------------------------------------------------------------------------- /dinput/Versions/IDirectInputDeviceW.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectInputDeviceW : public IDirectInputDeviceW, public AddressLookupTableObject 4 | { 5 | private: 6 | std::unique_ptr ProxyInterface; 7 | IDirectInputDeviceW *RealInterface; 8 | REFIID WrapperID = IID_IDirectInputDeviceW; 9 | 10 | public: 11 | m_IDirectInputDeviceW(IDirectInputDeviceW *aOriginal) : RealInterface(aOriginal) 12 | { 13 | ProxyInterface = std::make_unique((IDirectInputDevice7W*)RealInterface, 1, WrapperID, (m_IDirectInputDevice7W*)this); 14 | ProxyAddressLookupTable.SaveAddress(this, RealInterface); 15 | } 16 | ~m_IDirectInputDeviceW() 17 | { 18 | ProxyAddressLookupTable.DeleteAddress(this); 19 | } 20 | 21 | DWORD GetDirectXVersion() { return 1; } 22 | REFIID GetWrapperType() { return WrapperID; } 23 | IDirectInputDeviceW *GetProxyInterface() { return RealInterface; } 24 | m_IDirectInputDeviceX *GetWrapperInterface() { return ProxyInterface.get(); } 25 | 26 | /*** IUnknown methods ***/ 27 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 28 | STDMETHOD_(ULONG, AddRef)(THIS); 29 | STDMETHOD_(ULONG, Release)(THIS); 30 | 31 | /*** IDirectInputDevice methods ***/ 32 | STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS); 33 | STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKW, LPVOID, DWORD); 34 | STDMETHOD(GetProperty)(THIS_ REFGUID, LPDIPROPHEADER); 35 | STDMETHOD(SetProperty)(THIS_ REFGUID, LPCDIPROPHEADER); 36 | STDMETHOD(Acquire)(THIS); 37 | STDMETHOD(Unacquire)(THIS); 38 | STDMETHOD(GetDeviceState)(THIS_ DWORD, LPVOID); 39 | STDMETHOD(GetDeviceData)(THIS_ DWORD, LPDIDEVICEOBJECTDATA, LPDWORD, DWORD); 40 | STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT); 41 | STDMETHOD(SetEventNotification)(THIS_ HANDLE); 42 | STDMETHOD(SetCooperativeLevel)(THIS_ HWND, DWORD); 43 | STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEW, DWORD, DWORD); 44 | STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEW); 45 | STDMETHOD(RunControlPanel)(THIS_ HWND, DWORD); 46 | STDMETHOD(Initialize)(THIS_ HINSTANCE, DWORD, REFGUID); 47 | }; 48 | -------------------------------------------------------------------------------- /dinput/Versions/IDirectInputW.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "..\dinput.h" 18 | 19 | HRESULT m_IDirectInputW::QueryInterface(REFIID riid, LPVOID * ppvObj) 20 | { 21 | return ProxyInterface->QueryInterface(riid, ppvObj); 22 | } 23 | 24 | ULONG m_IDirectInputW::AddRef() 25 | { 26 | return ProxyInterface->AddRef(); 27 | } 28 | 29 | ULONG m_IDirectInputW::Release() 30 | { 31 | return ProxyInterface->Release(); 32 | } 33 | 34 | HRESULT m_IDirectInputW::CreateDevice(REFGUID rguid, LPDIRECTINPUTDEVICEW *lplpDirectInputDevice, LPUNKNOWN pUnkOuter) 35 | { 36 | return ProxyInterface->CreateDeviceW(rguid, lplpDirectInputDevice, pUnkOuter); 37 | } 38 | 39 | HRESULT m_IDirectInputW::EnumDevices(DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags) 40 | { 41 | return ProxyInterface->EnumDevicesW(dwDevType, lpCallback, pvRef, dwFlags); 42 | } 43 | 44 | HRESULT m_IDirectInputW::GetDeviceStatus(REFGUID rguidInstance) 45 | { 46 | return ProxyInterface->GetDeviceStatus(rguidInstance); 47 | } 48 | 49 | HRESULT m_IDirectInputW::RunControlPanel(HWND hwndOwner, DWORD dwFlags) 50 | { 51 | return ProxyInterface->RunControlPanel(hwndOwner, dwFlags); 52 | } 53 | 54 | HRESULT m_IDirectInputW::Initialize(HINSTANCE hinst, DWORD dwVersion) 55 | { 56 | return ProxyInterface->Initialize(hinst, dwVersion); 57 | } 58 | -------------------------------------------------------------------------------- /dinput/Versions/IDirectInputW.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectInputW : public IDirectInputW, public AddressLookupTableObject 4 | { 5 | private: 6 | std::unique_ptr ProxyInterface; 7 | IDirectInputW *RealInterface; 8 | REFIID WrapperID = IID_IDirectInputW; 9 | 10 | public: 11 | m_IDirectInputW(IDirectInputW *aOriginal) : RealInterface(aOriginal) 12 | { 13 | ProxyInterface = std::make_unique((IDirectInput7W*)RealInterface, 1, WrapperID, (m_IDirectInput7W*)this); 14 | ProxyAddressLookupTable.SaveAddress(this, RealInterface); 15 | } 16 | ~m_IDirectInputW() 17 | { 18 | ProxyAddressLookupTable.DeleteAddress(this); 19 | } 20 | 21 | DWORD GetDirectXVersion() { return 1; } 22 | REFIID GetWrapperType() { return WrapperID; } 23 | IDirectInputW *GetProxyInterface() { return RealInterface; } 24 | m_IDirectInputX *GetWrapperInterface() { return ProxyInterface.get(); } 25 | 26 | /*** IUnknown methods ***/ 27 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 28 | STDMETHOD_(ULONG, AddRef)(THIS); 29 | STDMETHOD_(ULONG, Release)(THIS); 30 | 31 | /*** IDirectInput methods ***/ 32 | STDMETHOD(CreateDevice)(THIS_ REFGUID, LPDIRECTINPUTDEVICEW *, LPUNKNOWN); 33 | STDMETHOD(EnumDevices)(THIS_ DWORD, LPDIENUMDEVICESCALLBACKW, LPVOID, DWORD); 34 | STDMETHOD(GetDeviceStatus)(THIS_ REFGUID); 35 | STDMETHOD(RunControlPanel)(THIS_ HWND, DWORD); 36 | STDMETHOD(Initialize)(THIS_ HINSTANCE, DWORD); 37 | }; 38 | -------------------------------------------------------------------------------- /dinput/Versions/License.txt: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ -------------------------------------------------------------------------------- /dinput/dinput.def: -------------------------------------------------------------------------------- 1 | LIBRARY dinput 2 | EXPORTS 3 | 4 | DirectInputCreateA @1 5 | DirectInputCreateEx @2 6 | DirectInputCreateW @3 7 | DllCanUnloadNow PRIVATE 8 | DllGetClassObject PRIVATE 9 | DllRegisterServer PRIVATE 10 | DllUnregisterServer PRIVATE 11 | -------------------------------------------------------------------------------- /dinput/dinput.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define INITGUID 4 | 5 | #define DIRECTINPUT_VERSION 0x0700 6 | #include 7 | 8 | class m_IDirectInputA; 9 | class m_IDirectInputW; 10 | class m_IDirectInput2A; 11 | class m_IDirectInput2W; 12 | class m_IDirectInput7A; 13 | class m_IDirectInput7W; 14 | class m_IDirectInputDeviceA; 15 | class m_IDirectInputDeviceW; 16 | class m_IDirectInputDevice2A; 17 | class m_IDirectInputDevice2W; 18 | class m_IDirectInputDevice7A; 19 | class m_IDirectInputDevice7W; 20 | class m_IDirectInputEffect; 21 | class m_IDirectInputX; 22 | class m_IDirectInputDeviceX; 23 | 24 | #include "AddressLookupTable.h" 25 | #include "..\Common\Logging.h" 26 | 27 | #define DDWRAPPER_TYPEX 0x80 28 | 29 | typedef HRESULT(WINAPI *DirectInputCreateAProc)(HINSTANCE, DWORD, LPDIRECTINPUTA*, LPUNKNOWN); 30 | typedef HRESULT(WINAPI *DirectInputCreateExProc)(HINSTANCE, DWORD, REFIID, LPVOID*, LPUNKNOWN); 31 | typedef HRESULT(WINAPI *DirectInputCreateWProc)(HINSTANCE, DWORD, LPDIRECTINPUTW*, LPUNKNOWN); 32 | typedef HRESULT(WINAPI *DllCanUnloadNowProc)(); 33 | typedef HRESULT(WINAPI *DllGetClassObjectProc)(REFCLSID, REFIID, LPVOID *); 34 | typedef HRESULT(WINAPI *DllRegisterServerProc)(); 35 | typedef HRESULT(WINAPI *DllUnregisterServerProc)(); 36 | 37 | HRESULT ProxyQueryInterface(LPVOID ProxyInterface, REFIID riid, LPVOID * ppvObj, REFIID WrapperID, LPVOID WrapperInterface); 38 | void genericQueryInterface(REFIID CalledID, LPVOID * ppvObj); 39 | extern AddressLookupTable ProxyAddressLookupTable; 40 | 41 | #include "Versions\IDirectInputA.h" 42 | #include "Versions\IDirectInputW.h" 43 | #include "Versions\IDirectInput2A.h" 44 | #include "Versions\IDirectInput2W.h" 45 | #include "Versions\IDirectInput7A.h" 46 | #include "Versions\IDirectInput7W.h" 47 | #include "Versions\IDirectInputDeviceA.h" 48 | #include "Versions\IDirectInputDeviceW.h" 49 | #include "Versions\IDirectInputDevice2A.h" 50 | #include "Versions\IDirectInputDevice2W.h" 51 | #include "Versions\IDirectInputDevice7A.h" 52 | #include "Versions\IDirectInputDevice7W.h" 53 | #include "IDirectInputEffect.h" 54 | #include "IDirectInputX.h" 55 | #include "IDirectInputDeviceX.h" 56 | -------------------------------------------------------------------------------- /dinput8/IDirectInput8A.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectInput8A : public IDirectInput8A, public AddressLookupTableObject 4 | { 5 | private: 6 | IDirectInput8A *ProxyInterface; 7 | 8 | public: 9 | m_IDirectInput8A(IDirectInput8A *aOriginal) : ProxyInterface(aOriginal) 10 | { 11 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 12 | } 13 | ~m_IDirectInput8A() 14 | { 15 | ProxyAddressLookupTable.DeleteAddress(this); 16 | } 17 | 18 | IDirectInput8A *GetProxyInterface() { return ProxyInterface; } 19 | 20 | /*** IUnknown methods ***/ 21 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 22 | STDMETHOD_(ULONG, AddRef)(THIS); 23 | STDMETHOD_(ULONG, Release)(THIS); 24 | 25 | /*** IDirectInput8A methods ***/ 26 | STDMETHOD(CreateDevice)(THIS_ REFGUID, LPDIRECTINPUTDEVICE8A *, LPUNKNOWN); 27 | STDMETHOD(EnumDevices)(THIS_ DWORD, LPDIENUMDEVICESCALLBACKA, LPVOID, DWORD); 28 | STDMETHOD(GetDeviceStatus)(THIS_ REFGUID); 29 | STDMETHOD(RunControlPanel)(THIS_ HWND, DWORD); 30 | STDMETHOD(Initialize)(THIS_ HINSTANCE, DWORD); 31 | STDMETHOD(FindDevice)(THIS_ REFGUID, LPCSTR, LPGUID); 32 | STDMETHOD(EnumDevicesBySemantics)(THIS_ LPCSTR, LPDIACTIONFORMATA, LPDIENUMDEVICESBYSEMANTICSCBA, LPVOID, DWORD); 33 | STDMETHOD(ConfigureDevices)(THIS_ LPDICONFIGUREDEVICESCALLBACK, LPDICONFIGUREDEVICESPARAMSA, DWORD, LPVOID); 34 | }; 35 | -------------------------------------------------------------------------------- /dinput8/IDirectInput8W.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectInput8W : public IDirectInput8W, public AddressLookupTableObject 4 | { 5 | private: 6 | IDirectInput8W *ProxyInterface; 7 | 8 | public: 9 | m_IDirectInput8W(IDirectInput8W *aOriginal) : ProxyInterface(aOriginal) 10 | { 11 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 12 | } 13 | ~m_IDirectInput8W() 14 | { 15 | ProxyAddressLookupTable.DeleteAddress(this); 16 | } 17 | 18 | IDirectInput8W *GetProxyInterface() { return ProxyInterface; } 19 | 20 | /*** IUnknown methods ***/ 21 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 22 | STDMETHOD_(ULONG, AddRef)(THIS); 23 | STDMETHOD_(ULONG, Release)(THIS); 24 | 25 | /*** IDirectInput8W methods ***/ 26 | STDMETHOD(CreateDevice)(THIS_ REFGUID, LPDIRECTINPUTDEVICE8W *, LPUNKNOWN); 27 | STDMETHOD(EnumDevices)(THIS_ DWORD, LPDIENUMDEVICESCALLBACKW, LPVOID, DWORD); 28 | STDMETHOD(GetDeviceStatus)(THIS_ REFGUID); 29 | STDMETHOD(RunControlPanel)(THIS_ HWND, DWORD); 30 | STDMETHOD(Initialize)(THIS_ HINSTANCE, DWORD); 31 | STDMETHOD(FindDevice)(THIS_ REFGUID, LPCWSTR, LPGUID); 32 | STDMETHOD(EnumDevicesBySemantics)(THIS_ LPCWSTR, LPDIACTIONFORMATW, LPDIENUMDEVICESBYSEMANTICSCBW, LPVOID, DWORD); 33 | STDMETHOD(ConfigureDevices)(THIS_ LPDICONFIGUREDEVICESCALLBACK, LPDICONFIGUREDEVICESPARAMSW, DWORD, LPVOID); 34 | }; 35 | -------------------------------------------------------------------------------- /dinput8/IDirectInputEffect.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectInputEffect : public IDirectInputEffect, public AddressLookupTableObject 4 | { 5 | private: 6 | IDirectInputEffect *ProxyInterface; 7 | 8 | public: 9 | m_IDirectInputEffect(IDirectInputEffect *aOriginal) : ProxyInterface(aOriginal) 10 | { 11 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 12 | } 13 | ~m_IDirectInputEffect() 14 | { 15 | ProxyAddressLookupTable.DeleteAddress(this); 16 | } 17 | 18 | IDirectInputEffect *GetProxyInterface() { return ProxyInterface; } 19 | 20 | /*** IUnknown methods ***/ 21 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj); 22 | STDMETHOD_(ULONG, AddRef)(THIS); 23 | STDMETHOD_(ULONG, Release)(THIS); 24 | 25 | /*** IDirectInputEffect methods ***/ 26 | STDMETHOD(Initialize)(THIS_ HINSTANCE, DWORD, REFGUID); 27 | STDMETHOD(GetEffectGuid)(THIS_ LPGUID); 28 | STDMETHOD(GetParameters)(THIS_ LPDIEFFECT, DWORD); 29 | STDMETHOD(SetParameters)(THIS_ LPCDIEFFECT, DWORD); 30 | STDMETHOD(Start)(THIS_ DWORD, DWORD); 31 | STDMETHOD(Stop)(THIS); 32 | STDMETHOD(GetEffectStatus)(THIS_ LPDWORD); 33 | STDMETHOD(Download)(THIS); 34 | STDMETHOD(Unload)(THIS); 35 | STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE); 36 | }; 37 | -------------------------------------------------------------------------------- /dinput8/InterfaceQuery.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "dinput8.h" 18 | 19 | void genericQueryInterface(REFIID riid, LPVOID * ppvObj) 20 | { 21 | if (!ppvObj || !*ppvObj) 22 | { 23 | return; 24 | } 25 | 26 | #define QUERYINTERFACE(x) \ 27 | if (riid == IID_ ## x) \ 28 | { \ 29 | *ppvObj = ProxyAddressLookupTable.FindAddress(*ppvObj); \ 30 | } 31 | 32 | QUERYINTERFACE(IDirectInput8A); 33 | QUERYINTERFACE(IDirectInput8W); 34 | QUERYINTERFACE(IDirectInputDevice8A); 35 | QUERYINTERFACE(IDirectInputDevice8W); 36 | QUERYINTERFACE(IDirectInputEffect); 37 | } 38 | -------------------------------------------------------------------------------- /dinput8/License.txt: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ -------------------------------------------------------------------------------- /dinput8/dinput8.def: -------------------------------------------------------------------------------- 1 | LIBRARY dinput8 2 | EXPORTS 3 | 4 | DirectInput8Create @1 5 | DllCanUnloadNow PRIVATE 6 | DllGetClassObject PRIVATE 7 | DllRegisterServer PRIVATE 8 | DllUnregisterServer PRIVATE 9 | GetdfDIJoystick @6 10 | -------------------------------------------------------------------------------- /dinput8/dinput8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define INITGUID 4 | 5 | #define DIRECTINPUT_VERSION 0x0800 6 | #include 7 | 8 | class m_IDirectInput8A; 9 | class m_IDirectInput8W; 10 | class m_IDirectInputDevice8A; 11 | class m_IDirectInputDevice8W; 12 | class m_IDirectInputEffect; 13 | 14 | #include "AddressLookupTable.h" 15 | #include "..\Common\Logging.h" 16 | 17 | typedef HRESULT(WINAPI *DirectInput8CreateProc)(HINSTANCE, DWORD, REFIID, LPVOID*, LPUNKNOWN); 18 | typedef HRESULT(WINAPI *DllCanUnloadNowProc)(); 19 | typedef HRESULT(WINAPI *DllGetClassObjectProc)(REFCLSID, REFIID, LPVOID *); 20 | typedef HRESULT(WINAPI *DllRegisterServerProc)(); 21 | typedef HRESULT(WINAPI *DllUnregisterServerProc)(); 22 | typedef LPCDIDATAFORMAT(WINAPI *GetdfDIJoystickProc)(); 23 | 24 | void genericQueryInterface(REFIID CalledID, LPVOID * ppvObj); 25 | extern AddressLookupTable ProxyAddressLookupTable; 26 | 27 | #include "IDirectInput8A.h" 28 | #include "IDirectInput8W.h" 29 | #include "IDirectInputDevice8A.h" 30 | #include "IDirectInputDevice8W.h" 31 | #include "IDirectInputEffect.h" 32 | -------------------------------------------------------------------------------- /dsound/IDirectSound3DBuffer8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectSound3DBuffer8 : public IDirectSound3DBuffer8, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECTSOUND3DBUFFER8 ProxyInterface; 7 | 8 | public: 9 | m_IDirectSound3DBuffer8(LPDIRECTSOUND3DBUFFER8 pSound8) : ProxyInterface(pSound8) 10 | { 11 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 12 | } 13 | ~m_IDirectSound3DBuffer8() 14 | { 15 | ProxyAddressLookupTable.DeleteAddress(this); 16 | } 17 | 18 | LPDIRECTSOUND3DBUFFER8 GetProxyInterface() { return ProxyInterface; } 19 | 20 | // IUnknown methods 21 | STDMETHOD(QueryInterface)(THIS_ _In_ REFIID, _Outptr_ LPVOID*); 22 | STDMETHOD_(ULONG, AddRef)(THIS); 23 | STDMETHOD_(ULONG, Release)(THIS); 24 | 25 | // IDirectSound3DBuffer methods 26 | STDMETHOD(GetAllParameters)(THIS_ _Out_ LPDS3DBUFFER pDs3dBuffer); 27 | STDMETHOD(GetConeAngles)(THIS_ _Out_ LPDWORD pdwInsideConeAngle, _Out_ LPDWORD pdwOutsideConeAngle); 28 | STDMETHOD(GetConeOrientation)(THIS_ _Out_ D3DVECTOR* pvOrientation); 29 | STDMETHOD(GetConeOutsideVolume)(THIS_ _Out_ LPLONG plConeOutsideVolume); 30 | STDMETHOD(GetMaxDistance)(THIS_ _Out_ D3DVALUE* pflMaxDistance); 31 | STDMETHOD(GetMinDistance)(THIS_ _Out_ D3DVALUE* pflMinDistance); 32 | STDMETHOD(GetMode)(THIS_ _Out_ LPDWORD pdwMode); 33 | STDMETHOD(GetPosition)(THIS_ _Out_ D3DVECTOR* pvPosition); 34 | STDMETHOD(GetVelocity)(THIS_ _Out_ D3DVECTOR* pvVelocity); 35 | STDMETHOD(SetAllParameters)(THIS_ _In_ LPCDS3DBUFFER pcDs3dBuffer, DWORD dwApply); 36 | STDMETHOD(SetConeAngles)(THIS_ DWORD dwInsideConeAngle, DWORD dwOutsideConeAngle, DWORD dwApply); 37 | STDMETHOD(SetConeOrientation)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply); 38 | STDMETHOD(SetConeOutsideVolume)(THIS_ LONG lConeOutsideVolume, DWORD dwApply); 39 | STDMETHOD(SetMaxDistance)(THIS_ D3DVALUE flMaxDistance, DWORD dwApply); 40 | STDMETHOD(SetMinDistance)(THIS_ D3DVALUE flMinDistance, DWORD dwApply); 41 | STDMETHOD(SetMode)(THIS_ DWORD dwMode, DWORD dwApply); 42 | STDMETHOD(SetPosition)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply); 43 | STDMETHOD(SetVelocity)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply); 44 | }; 45 | -------------------------------------------------------------------------------- /dsound/IDirectSound3DListener8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectSound3DListener8 : public IDirectSound3DListener8, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECTSOUND3DLISTENER8 ProxyInterface; 7 | 8 | public: 9 | m_IDirectSound3DListener8(LPDIRECTSOUND3DLISTENER8 pSound8) : ProxyInterface(pSound8) 10 | { 11 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 12 | } 13 | ~m_IDirectSound3DListener8() 14 | { 15 | ProxyAddressLookupTable.DeleteAddress(this); 16 | } 17 | 18 | LPDIRECTSOUND3DLISTENER8 GetProxyInterface() { return ProxyInterface; } 19 | 20 | // IUnknown methods 21 | STDMETHOD(QueryInterface)(THIS_ _In_ REFIID, _Outptr_ LPVOID*); 22 | STDMETHOD_(ULONG, AddRef)(THIS); 23 | STDMETHOD_(ULONG, Release)(THIS); 24 | 25 | // IDirectSound3DListener methods 26 | STDMETHOD(GetAllParameters)(THIS_ _Out_ LPDS3DLISTENER pListener); 27 | STDMETHOD(GetDistanceFactor)(THIS_ _Out_ D3DVALUE* pflDistanceFactor); 28 | STDMETHOD(GetDopplerFactor)(THIS_ _Out_ D3DVALUE* pflDopplerFactor); 29 | STDMETHOD(GetOrientation)(THIS_ _Out_ D3DVECTOR* pvOrientFront, _Out_ D3DVECTOR* pvOrientTop); 30 | STDMETHOD(GetPosition)(THIS_ _Out_ D3DVECTOR* pvPosition); 31 | STDMETHOD(GetRolloffFactor)(THIS_ _Out_ D3DVALUE* pflRolloffFactor); 32 | STDMETHOD(GetVelocity)(THIS_ _Out_ D3DVECTOR* pvVelocity); 33 | STDMETHOD(SetAllParameters)(THIS_ _In_ LPCDS3DLISTENER pcListener, DWORD dwApply); 34 | STDMETHOD(SetDistanceFactor)(THIS_ D3DVALUE flDistanceFactor, DWORD dwApply); 35 | STDMETHOD(SetDopplerFactor)(THIS_ D3DVALUE flDopplerFactor, DWORD dwApply); 36 | STDMETHOD(SetOrientation)(THIS_ D3DVALUE xFront, D3DVALUE yFront, D3DVALUE zFront, 37 | D3DVALUE xTop, D3DVALUE yTop, D3DVALUE zTop, DWORD dwApply); 38 | STDMETHOD(SetPosition)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply); 39 | STDMETHOD(SetRolloffFactor)(THIS_ D3DVALUE flRolloffFactor, DWORD dwApply); 40 | STDMETHOD(SetVelocity)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply); 41 | STDMETHOD(CommitDeferredSettings)(THIS); 42 | }; 43 | -------------------------------------------------------------------------------- /dsound/IDirectSound8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectSound8 : public IDirectSound8, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECTSOUND8 ProxyInterface; 7 | 8 | public: 9 | m_IDirectSound8(LPDIRECTSOUND8 pSound8) : ProxyInterface(pSound8) 10 | { 11 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 12 | } 13 | ~m_IDirectSound8() 14 | { 15 | ProxyAddressLookupTable.DeleteAddress(this); 16 | } 17 | 18 | LPDIRECTSOUND8 GetProxyInterface() { return ProxyInterface; } 19 | 20 | // IUnknown methods 21 | STDMETHOD(QueryInterface)(THIS_ _In_ REFIID, _Outptr_ LPVOID*); 22 | STDMETHOD_(ULONG, AddRef)(THIS); 23 | STDMETHOD_(ULONG, Release)(THIS); 24 | 25 | // IDirectSound methods 26 | STDMETHOD(CreateSoundBuffer)(THIS_ _In_ LPCDSBUFFERDESC pcDSBufferDesc, _Out_ LPDIRECTSOUNDBUFFER *ppDSBuffer, _Pre_null_ LPUNKNOWN pUnkOuter); 27 | STDMETHOD(GetCaps)(THIS_ _Out_ LPDSCAPS pDSCaps); 28 | STDMETHOD(DuplicateSoundBuffer)(THIS_ _In_ LPDIRECTSOUNDBUFFER pDSBufferOriginal, _Out_ LPDIRECTSOUNDBUFFER *ppDSBufferDuplicate); 29 | STDMETHOD(SetCooperativeLevel)(THIS_ HWND hwnd, DWORD dwLevel); 30 | STDMETHOD(Compact)(THIS); 31 | STDMETHOD(GetSpeakerConfig)(THIS_ _Out_ LPDWORD pdwSpeakerConfig); 32 | STDMETHOD(SetSpeakerConfig)(THIS_ DWORD dwSpeakerConfig); 33 | STDMETHOD(Initialize)(THIS_ _In_opt_ LPCGUID pcGuidDevice); 34 | 35 | // IDirectSound8 methods 36 | STDMETHOD(VerifyCertification)(THIS_ _Out_ LPDWORD pdwCertified); 37 | }; 38 | -------------------------------------------------------------------------------- /dsound/IDirectSoundCapture8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectSoundCapture8 : public IDirectSoundCapture8, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECTSOUNDCAPTURE8 ProxyInterface; 7 | 8 | public: 9 | m_IDirectSoundCapture8(LPDIRECTSOUNDCAPTURE8 pSound8) : ProxyInterface(pSound8) 10 | { 11 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 12 | } 13 | ~m_IDirectSoundCapture8() 14 | { 15 | ProxyAddressLookupTable.DeleteAddress(this); 16 | } 17 | 18 | LPDIRECTSOUNDCAPTURE8 GetProxyInterface() { return ProxyInterface; } 19 | 20 | // IUnknown methods 21 | STDMETHOD(QueryInterface)(THIS_ _In_ REFIID, _Outptr_ LPVOID*); 22 | STDMETHOD_(ULONG, AddRef)(THIS); 23 | STDMETHOD_(ULONG, Release)(THIS); 24 | 25 | // IDirectSoundCapture methods 26 | STDMETHOD(CreateCaptureBuffer)(THIS_ _In_ LPCDSCBUFFERDESC pcDSCBufferDesc, _Outptr_ LPDIRECTSOUNDCAPTUREBUFFER *ppDSCBuffer, _Pre_null_ LPUNKNOWN pUnkOuter); 27 | STDMETHOD(GetCaps)(THIS_ _Out_ LPDSCCAPS pDSCCaps); 28 | STDMETHOD(Initialize)(THIS_ _In_opt_ LPCGUID pcGuidDevice); 29 | }; 30 | -------------------------------------------------------------------------------- /dsound/IDirectSoundCaptureBuffer8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectSoundCaptureBuffer8 : public IDirectSoundCaptureBuffer8, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECTSOUNDCAPTUREBUFFER8 ProxyInterface; 7 | 8 | public: 9 | m_IDirectSoundCaptureBuffer8(LPDIRECTSOUNDCAPTUREBUFFER8 pSound8) : ProxyInterface(pSound8) 10 | { 11 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 12 | } 13 | ~m_IDirectSoundCaptureBuffer8() 14 | { 15 | ProxyAddressLookupTable.DeleteAddress(this); 16 | } 17 | 18 | LPDIRECTSOUNDCAPTUREBUFFER8 GetProxyInterface() { return ProxyInterface; } 19 | 20 | // IUnknown methods 21 | STDMETHOD(QueryInterface)(THIS_ _In_ REFIID, _Outptr_ LPVOID*); 22 | STDMETHOD_(ULONG, AddRef)(THIS); 23 | STDMETHOD_(ULONG, Release)(THIS); 24 | 25 | // IDirectSoundCaptureBuffer methods 26 | STDMETHOD(GetCaps)(THIS_ _Out_ LPDSCBCAPS pDSCBCaps); 27 | STDMETHOD(GetCurrentPosition)(THIS_ _Out_opt_ LPDWORD pdwCapturePosition, _Out_opt_ LPDWORD pdwReadPosition); 28 | STDMETHOD(GetFormat)(THIS_ _Out_writes_bytes_opt_(dwSizeAllocated) LPWAVEFORMATEX pwfxFormat, DWORD dwSizeAllocated, _Out_opt_ LPDWORD pdwSizeWritten); 29 | STDMETHOD(GetStatus)(THIS_ _Out_ LPDWORD pdwStatus); 30 | STDMETHOD(Initialize)(THIS_ _In_ LPDIRECTSOUNDCAPTURE pDirectSoundCapture, _In_ LPCDSCBUFFERDESC pcDSCBufferDesc); 31 | STDMETHOD(Lock)(THIS_ DWORD dwOffset, DWORD dwBytes, 32 | _Outptr_result_bytebuffer_(*pdwAudioBytes1) LPVOID *ppvAudioPtr1, _Out_ LPDWORD pdwAudioBytes1, 33 | _Outptr_opt_result_bytebuffer_(*pdwAudioBytes2) LPVOID *ppvAudioPtr2, _Out_opt_ LPDWORD pdwAudioBytes2, DWORD dwFlags); 34 | STDMETHOD(Start)(THIS_ DWORD dwFlags); 35 | STDMETHOD(Stop)(THIS); 36 | STDMETHOD(Unlock)(THIS_ _In_reads_bytes_(dwAudioBytes1) LPVOID pvAudioPtr1, DWORD dwAudioBytes1, 37 | _In_reads_bytes_opt_(dwAudioBytes2) LPVOID pvAudioPtr2, DWORD dwAudioBytes2); 38 | 39 | // IDirectSoundCaptureBuffer8 methods 40 | STDMETHOD(GetObjectInPath)(THIS_ _In_ REFGUID rguidObject, DWORD dwIndex, _In_ REFGUID rguidInterface, _Outptr_ LPVOID *ppObject); 41 | STDMETHOD(GetFXStatus)(DWORD dwEffectsCount, _Out_writes_(dwEffectsCount) LPDWORD pdwFXStatus); 42 | }; 43 | -------------------------------------------------------------------------------- /dsound/IDirectSoundCaptureFXAec8.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "dsound.h" 18 | 19 | HRESULT m_IDirectSoundCaptureFXAec8::QueryInterface(REFIID riid, LPVOID * ppvObj) 20 | { 21 | if ((riid == IID_IDirectSoundCaptureFXAec || riid == IID_IDirectSoundCaptureFXAec8 || riid == IID_IUnknown) && ppvObj) 22 | { 23 | AddRef(); 24 | 25 | *ppvObj = this; 26 | 27 | return S_OK; 28 | } 29 | 30 | HRESULT hr = ProxyInterface->QueryInterface(riid, ppvObj); 31 | 32 | if (SUCCEEDED(hr)) 33 | { 34 | genericQueryInterface(riid, ppvObj); 35 | } 36 | 37 | return hr; 38 | } 39 | 40 | ULONG m_IDirectSoundCaptureFXAec8::AddRef() 41 | { 42 | return ProxyInterface->AddRef(); 43 | } 44 | 45 | ULONG m_IDirectSoundCaptureFXAec8::Release() 46 | { 47 | ULONG ref = ProxyInterface->Release(); 48 | 49 | if (ref == 0) 50 | { 51 | delete this; 52 | } 53 | 54 | return ref; 55 | } 56 | 57 | // IDirectSoundCaptureFXAec methods 58 | HRESULT m_IDirectSoundCaptureFXAec8::SetAllParameters(LPCDSCFXAec pDscFxAec) 59 | { 60 | return ProxyInterface->SetAllParameters(pDscFxAec); 61 | } 62 | 63 | HRESULT m_IDirectSoundCaptureFXAec8::GetAllParameters(LPDSCFXAec pDscFxAec) 64 | { 65 | return ProxyInterface->GetAllParameters(pDscFxAec); 66 | } 67 | 68 | HRESULT m_IDirectSoundCaptureFXAec8::GetStatus(LPDWORD pdwStatus) 69 | { 70 | return ProxyInterface->GetStatus(pdwStatus); 71 | } 72 | 73 | HRESULT m_IDirectSoundCaptureFXAec8::Reset() 74 | { 75 | return ProxyInterface->Reset(); 76 | } 77 | -------------------------------------------------------------------------------- /dsound/IDirectSoundCaptureFXAec8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectSoundCaptureFXAec8 : public IDirectSoundCaptureFXAec8, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECTSOUNDCAPTUREFXAEC8 ProxyInterface; 7 | 8 | public: 9 | m_IDirectSoundCaptureFXAec8(LPDIRECTSOUNDCAPTUREFXAEC8 pSound8) : ProxyInterface(pSound8) 10 | { 11 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 12 | } 13 | ~m_IDirectSoundCaptureFXAec8() 14 | { 15 | ProxyAddressLookupTable.DeleteAddress(this); 16 | } 17 | 18 | LPDIRECTSOUNDCAPTUREFXAEC8 GetProxyInterface() { return ProxyInterface; } 19 | 20 | // IUnknown methods 21 | STDMETHOD(QueryInterface)(THIS_ _In_ REFIID, _Outptr_ LPVOID*); 22 | STDMETHOD_(ULONG, AddRef)(THIS); 23 | STDMETHOD_(ULONG, Release)(THIS); 24 | 25 | // IDirectSoundCaptureFXAec methods 26 | STDMETHOD(SetAllParameters)(THIS_ _In_ LPCDSCFXAec pDscFxAec); 27 | STDMETHOD(GetAllParameters)(THIS_ _Out_ LPDSCFXAec pDscFxAec); 28 | STDMETHOD(GetStatus)(THIS_ _Out_ LPDWORD pdwStatus); 29 | STDMETHOD(Reset)(THIS); 30 | }; 31 | -------------------------------------------------------------------------------- /dsound/IDirectSoundCaptureFXNoiseSuppress8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectSoundCaptureFXNoiseSuppress8 : public IDirectSoundCaptureFXNoiseSuppress8, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECTSOUNDCAPTUREFXNOISESUPPRESS8 ProxyInterface; 7 | 8 | public: 9 | m_IDirectSoundCaptureFXNoiseSuppress8(LPDIRECTSOUNDCAPTUREFXNOISESUPPRESS8 pSound8) : ProxyInterface(pSound8) 10 | { 11 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 12 | } 13 | ~m_IDirectSoundCaptureFXNoiseSuppress8() 14 | { 15 | ProxyAddressLookupTable.DeleteAddress(this); 16 | } 17 | 18 | LPDIRECTSOUNDCAPTUREFXNOISESUPPRESS8 GetProxyInterface() { return ProxyInterface; } 19 | 20 | // IUnknown methods 21 | STDMETHOD(QueryInterface)(THIS_ _In_ REFIID, _Outptr_ LPVOID*); 22 | STDMETHOD_(ULONG, AddRef)(THIS); 23 | STDMETHOD_(ULONG, Release)(THIS); 24 | 25 | // IDirectSoundCaptureFXNoiseSuppress methods 26 | STDMETHOD(SetAllParameters)(THIS_ _In_ LPCDSCFXNoiseSuppress pcDscFxNoiseSuppress); 27 | STDMETHOD(GetAllParameters)(THIS_ _Out_ LPDSCFXNoiseSuppress pDscFxNoiseSuppress); 28 | STDMETHOD(Reset)(THIS); 29 | }; 30 | -------------------------------------------------------------------------------- /dsound/IDirectSoundFXChorus8.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "dsound.h" 18 | 19 | HRESULT m_IDirectSoundFXChorus8::QueryInterface(REFIID riid, LPVOID * ppvObj) 20 | { 21 | if ((riid == IID_IDirectSoundFXChorus || riid == IID_IDirectSoundFXChorus8 || riid == IID_IUnknown) && ppvObj) 22 | { 23 | AddRef(); 24 | 25 | *ppvObj = this; 26 | 27 | return S_OK; 28 | } 29 | 30 | HRESULT hr = ProxyInterface->QueryInterface(riid, ppvObj); 31 | 32 | if (SUCCEEDED(hr)) 33 | { 34 | genericQueryInterface(riid, ppvObj); 35 | } 36 | 37 | return hr; 38 | } 39 | 40 | ULONG m_IDirectSoundFXChorus8::AddRef() 41 | { 42 | return ProxyInterface->AddRef(); 43 | } 44 | 45 | ULONG m_IDirectSoundFXChorus8::Release() 46 | { 47 | ULONG ref = ProxyInterface->Release(); 48 | 49 | if (ref == 0) 50 | { 51 | delete this; 52 | } 53 | 54 | return ref; 55 | } 56 | 57 | // IDirectSoundFXChorus methods 58 | HRESULT m_IDirectSoundFXChorus8::SetAllParameters(LPCDSFXChorus pcDsFxChorus) 59 | { 60 | return ProxyInterface->SetAllParameters(pcDsFxChorus); 61 | } 62 | 63 | HRESULT m_IDirectSoundFXChorus8::GetAllParameters(LPDSFXChorus pDsFxChorus) 64 | { 65 | return ProxyInterface->GetAllParameters(pDsFxChorus); 66 | } 67 | -------------------------------------------------------------------------------- /dsound/IDirectSoundFXChorus8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectSoundFXChorus8 : public IDirectSoundFXChorus8, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECTSOUNDFXCHORUS8 ProxyInterface; 7 | 8 | public: 9 | m_IDirectSoundFXChorus8(LPDIRECTSOUNDFXCHORUS8 pSound8) : ProxyInterface(pSound8) 10 | { 11 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 12 | } 13 | ~m_IDirectSoundFXChorus8() 14 | { 15 | ProxyAddressLookupTable.DeleteAddress(this); 16 | } 17 | 18 | LPDIRECTSOUNDFXCHORUS8 GetProxyInterface() { return ProxyInterface; } 19 | 20 | // IUnknown methods 21 | STDMETHOD(QueryInterface)(THIS_ _In_ REFIID, _Outptr_ LPVOID*); 22 | STDMETHOD_(ULONG, AddRef)(THIS); 23 | STDMETHOD_(ULONG, Release)(THIS); 24 | 25 | // IDirectSoundFXChorus methods 26 | STDMETHOD(SetAllParameters)(THIS_ _In_ LPCDSFXChorus pcDsFxChorus); 27 | STDMETHOD(GetAllParameters)(THIS_ _Out_ LPDSFXChorus pDsFxChorus); 28 | }; 29 | -------------------------------------------------------------------------------- /dsound/IDirectSoundFXCompressor8.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "dsound.h" 18 | 19 | HRESULT m_IDirectSoundFXCompressor8::QueryInterface(REFIID riid, LPVOID * ppvObj) 20 | { 21 | if ((riid == IID_IDirectSoundFXCompressor || riid == IID_IDirectSoundFXCompressor8 || riid == IID_IUnknown) && ppvObj) 22 | { 23 | AddRef(); 24 | 25 | *ppvObj = this; 26 | 27 | return S_OK; 28 | } 29 | 30 | HRESULT hr = ProxyInterface->QueryInterface(riid, ppvObj); 31 | 32 | if (SUCCEEDED(hr)) 33 | { 34 | genericQueryInterface(riid, ppvObj); 35 | } 36 | 37 | return hr; 38 | } 39 | 40 | ULONG m_IDirectSoundFXCompressor8::AddRef() 41 | { 42 | return ProxyInterface->AddRef(); 43 | } 44 | 45 | ULONG m_IDirectSoundFXCompressor8::Release() 46 | { 47 | ULONG ref = ProxyInterface->Release(); 48 | 49 | if (ref == 0) 50 | { 51 | delete this; 52 | } 53 | 54 | return ref; 55 | } 56 | 57 | // IDirectSoundFXCompressor methods 58 | HRESULT m_IDirectSoundFXCompressor8::SetAllParameters(LPCDSFXCompressor pcDsFxCompressor) 59 | { 60 | return ProxyInterface->SetAllParameters(pcDsFxCompressor); 61 | } 62 | 63 | HRESULT m_IDirectSoundFXCompressor8::GetAllParameters(LPDSFXCompressor pDsFxCompressor) 64 | { 65 | return ProxyInterface->GetAllParameters(pDsFxCompressor); 66 | } 67 | -------------------------------------------------------------------------------- /dsound/IDirectSoundFXCompressor8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectSoundFXCompressor8 : public IDirectSoundFXCompressor8, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECTSOUNDFXCOMPRESSOR8 ProxyInterface; 7 | 8 | public: 9 | m_IDirectSoundFXCompressor8(LPDIRECTSOUNDFXCOMPRESSOR8 pSound8) : ProxyInterface(pSound8) 10 | { 11 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 12 | } 13 | ~m_IDirectSoundFXCompressor8() 14 | { 15 | ProxyAddressLookupTable.DeleteAddress(this); 16 | } 17 | 18 | LPDIRECTSOUNDFXCOMPRESSOR8 GetProxyInterface() { return ProxyInterface; } 19 | 20 | // IUnknown methods 21 | STDMETHOD(QueryInterface)(THIS_ _In_ REFIID, _Outptr_ LPVOID*); 22 | STDMETHOD_(ULONG, AddRef)(THIS); 23 | STDMETHOD_(ULONG, Release)(THIS); 24 | 25 | // IDirectSoundFXCompressor methods 26 | STDMETHOD(SetAllParameters)(THIS_ _In_ LPCDSFXCompressor pcDsFxCompressor); 27 | STDMETHOD(GetAllParameters)(THIS_ _Out_ LPDSFXCompressor pDsFxCompressor); 28 | }; 29 | -------------------------------------------------------------------------------- /dsound/IDirectSoundFXDistortion8.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "dsound.h" 18 | 19 | HRESULT m_IDirectSoundFXDistortion8::QueryInterface(REFIID riid, LPVOID * ppvObj) 20 | { 21 | if ((riid == IID_IDirectSoundFXDistortion || riid == IID_IDirectSoundFXDistortion8 || riid == IID_IUnknown) && ppvObj) 22 | { 23 | AddRef(); 24 | 25 | *ppvObj = this; 26 | 27 | return S_OK; 28 | } 29 | 30 | HRESULT hr = ProxyInterface->QueryInterface(riid, ppvObj); 31 | 32 | if (SUCCEEDED(hr)) 33 | { 34 | genericQueryInterface(riid, ppvObj); 35 | } 36 | 37 | return hr; 38 | } 39 | 40 | ULONG m_IDirectSoundFXDistortion8::AddRef() 41 | { 42 | return ProxyInterface->AddRef(); 43 | } 44 | 45 | ULONG m_IDirectSoundFXDistortion8::Release() 46 | { 47 | ULONG ref = ProxyInterface->Release(); 48 | 49 | if (ref == 0) 50 | { 51 | delete this; 52 | } 53 | 54 | return ref; 55 | } 56 | 57 | // IDirectSoundFXDistortion methods 58 | HRESULT m_IDirectSoundFXDistortion8::SetAllParameters(LPCDSFXDistortion pcDsFxDistortion) 59 | { 60 | return ProxyInterface->SetAllParameters(pcDsFxDistortion); 61 | } 62 | 63 | HRESULT m_IDirectSoundFXDistortion8::GetAllParameters(LPDSFXDistortion pDsFxDistortion) 64 | { 65 | return ProxyInterface->GetAllParameters(pDsFxDistortion); 66 | } 67 | -------------------------------------------------------------------------------- /dsound/IDirectSoundFXDistortion8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectSoundFXDistortion8 : public IDirectSoundFXDistortion8, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECTSOUNDFXDISTORTION8 ProxyInterface; 7 | 8 | public: 9 | m_IDirectSoundFXDistortion8(LPDIRECTSOUNDFXDISTORTION8 pSound8) : ProxyInterface(pSound8) 10 | { 11 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 12 | } 13 | ~m_IDirectSoundFXDistortion8() 14 | { 15 | ProxyAddressLookupTable.DeleteAddress(this); 16 | } 17 | 18 | LPDIRECTSOUNDFXDISTORTION8 GetProxyInterface() { return ProxyInterface; } 19 | 20 | // IUnknown methods 21 | STDMETHOD(QueryInterface)(THIS_ _In_ REFIID, _Outptr_ LPVOID*); 22 | STDMETHOD_(ULONG, AddRef)(THIS); 23 | STDMETHOD_(ULONG, Release)(THIS); 24 | 25 | // IDirectSoundFXDistortion methods 26 | STDMETHOD(SetAllParameters)(THIS_ _In_ LPCDSFXDistortion pcDsFxDistortion); 27 | STDMETHOD(GetAllParameters)(THIS_ _Out_ LPDSFXDistortion pDsFxDistortion); 28 | }; 29 | -------------------------------------------------------------------------------- /dsound/IDirectSoundFXEcho8.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "dsound.h" 18 | 19 | HRESULT m_IDirectSoundFXEcho8::QueryInterface(REFIID riid, LPVOID * ppvObj) 20 | { 21 | if ((riid == IID_IDirectSoundFXEcho || riid == IID_IDirectSoundFXEcho8 || riid == IID_IUnknown) && ppvObj) 22 | { 23 | AddRef(); 24 | 25 | *ppvObj = this; 26 | 27 | return S_OK; 28 | } 29 | 30 | HRESULT hr = ProxyInterface->QueryInterface(riid, ppvObj); 31 | 32 | if (SUCCEEDED(hr)) 33 | { 34 | genericQueryInterface(riid, ppvObj); 35 | } 36 | 37 | return hr; 38 | } 39 | 40 | ULONG m_IDirectSoundFXEcho8::AddRef() 41 | { 42 | return ProxyInterface->AddRef(); 43 | } 44 | 45 | ULONG m_IDirectSoundFXEcho8::Release() 46 | { 47 | ULONG ref = ProxyInterface->Release(); 48 | 49 | if (ref == 0) 50 | { 51 | delete this; 52 | } 53 | 54 | return ref; 55 | } 56 | 57 | // IDirectSoundFXEcho methods 58 | HRESULT m_IDirectSoundFXEcho8::SetAllParameters(LPCDSFXEcho pcDsFxEcho) 59 | { 60 | return ProxyInterface->SetAllParameters(pcDsFxEcho); 61 | } 62 | 63 | HRESULT m_IDirectSoundFXEcho8::GetAllParameters(LPDSFXEcho pDsFxEcho) 64 | { 65 | return ProxyInterface->GetAllParameters(pDsFxEcho); 66 | } 67 | -------------------------------------------------------------------------------- /dsound/IDirectSoundFXEcho8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectSoundFXEcho8 : public IDirectSoundFXEcho8, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECTSOUNDFXECHO8 ProxyInterface; 7 | 8 | public: 9 | m_IDirectSoundFXEcho8(LPDIRECTSOUNDFXECHO8 pSound8) : ProxyInterface(pSound8) 10 | { 11 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 12 | } 13 | ~m_IDirectSoundFXEcho8() 14 | { 15 | ProxyAddressLookupTable.DeleteAddress(this); 16 | } 17 | 18 | LPDIRECTSOUNDFXECHO8 GetProxyInterface() { return ProxyInterface; } 19 | 20 | // IUnknown methods 21 | STDMETHOD(QueryInterface)(THIS_ _In_ REFIID, _Outptr_ LPVOID*); 22 | STDMETHOD_(ULONG, AddRef)(THIS); 23 | STDMETHOD_(ULONG, Release)(THIS); 24 | 25 | // IDirectSoundFXEcho methods 26 | STDMETHOD(SetAllParameters)(THIS_ _In_ LPCDSFXEcho pcDsFxEcho); 27 | STDMETHOD(GetAllParameters)(THIS_ _Out_ LPDSFXEcho pDsFxEcho); 28 | }; 29 | -------------------------------------------------------------------------------- /dsound/IDirectSoundFXFlanger8.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "dsound.h" 18 | 19 | HRESULT m_IDirectSoundFXFlanger8::QueryInterface(REFIID riid, LPVOID * ppvObj) 20 | { 21 | if ((riid == IID_IDirectSoundFXFlanger || riid == IID_IDirectSoundFXFlanger8 || riid == IID_IUnknown) && ppvObj) 22 | { 23 | AddRef(); 24 | 25 | *ppvObj = this; 26 | 27 | return S_OK; 28 | } 29 | 30 | HRESULT hr = ProxyInterface->QueryInterface(riid, ppvObj); 31 | 32 | if (SUCCEEDED(hr)) 33 | { 34 | genericQueryInterface(riid, ppvObj); 35 | } 36 | 37 | return hr; 38 | } 39 | 40 | ULONG m_IDirectSoundFXFlanger8::AddRef() 41 | { 42 | return ProxyInterface->AddRef(); 43 | } 44 | 45 | ULONG m_IDirectSoundFXFlanger8::Release() 46 | { 47 | ULONG ref = ProxyInterface->Release(); 48 | 49 | if (ref == 0) 50 | { 51 | delete this; 52 | } 53 | 54 | return ref; 55 | } 56 | 57 | // IDirectSoundFXFlanger methods 58 | HRESULT m_IDirectSoundFXFlanger8::SetAllParameters(LPCDSFXFlanger pcDsFxFlanger) 59 | { 60 | return ProxyInterface->SetAllParameters(pcDsFxFlanger); 61 | } 62 | 63 | HRESULT m_IDirectSoundFXFlanger8::GetAllParameters(LPDSFXFlanger pDsFxFlanger) 64 | { 65 | return ProxyInterface->GetAllParameters(pDsFxFlanger); 66 | } 67 | -------------------------------------------------------------------------------- /dsound/IDirectSoundFXFlanger8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectSoundFXFlanger8 : public IDirectSoundFXFlanger8, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECTSOUNDFXFLANGER8 ProxyInterface; 7 | 8 | public: 9 | m_IDirectSoundFXFlanger8(LPDIRECTSOUNDFXFLANGER8 pSound8) : ProxyInterface(pSound8) 10 | { 11 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 12 | } 13 | ~m_IDirectSoundFXFlanger8() 14 | { 15 | ProxyAddressLookupTable.DeleteAddress(this); 16 | } 17 | 18 | LPDIRECTSOUNDFXFLANGER8 GetProxyInterface() { return ProxyInterface; } 19 | 20 | // IUnknown methods 21 | STDMETHOD(QueryInterface)(THIS_ _In_ REFIID, _Outptr_ LPVOID*); 22 | STDMETHOD_(ULONG, AddRef)(THIS); 23 | STDMETHOD_(ULONG, Release)(THIS); 24 | 25 | // IDirectSoundFXFlanger methods 26 | STDMETHOD(SetAllParameters)(THIS_ _In_ LPCDSFXFlanger pcDsFxFlanger); 27 | STDMETHOD(GetAllParameters)(THIS_ _Out_ LPDSFXFlanger pDsFxFlanger); 28 | }; 29 | -------------------------------------------------------------------------------- /dsound/IDirectSoundFXGargle8.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "dsound.h" 18 | 19 | HRESULT m_IDirectSoundFXGargle8::QueryInterface(REFIID riid, LPVOID * ppvObj) 20 | { 21 | if ((riid == IID_IDirectSoundFXGargle || riid == IID_IDirectSoundFXGargle8 || riid == IID_IUnknown) && ppvObj) 22 | { 23 | AddRef(); 24 | 25 | *ppvObj = this; 26 | 27 | return S_OK; 28 | } 29 | 30 | HRESULT hr = ProxyInterface->QueryInterface(riid, ppvObj); 31 | 32 | if (SUCCEEDED(hr)) 33 | { 34 | genericQueryInterface(riid, ppvObj); 35 | } 36 | 37 | return hr; 38 | } 39 | 40 | ULONG m_IDirectSoundFXGargle8::AddRef() 41 | { 42 | return ProxyInterface->AddRef(); 43 | } 44 | 45 | ULONG m_IDirectSoundFXGargle8::Release() 46 | { 47 | ULONG ref = ProxyInterface->Release(); 48 | 49 | if (ref == 0) 50 | { 51 | delete this; 52 | } 53 | 54 | return ref; 55 | } 56 | 57 | // IDirectSoundFXGargle methods 58 | HRESULT m_IDirectSoundFXGargle8::SetAllParameters(LPCDSFXGargle pcDsFxGargle) 59 | { 60 | return ProxyInterface->SetAllParameters(pcDsFxGargle); 61 | } 62 | 63 | HRESULT m_IDirectSoundFXGargle8::GetAllParameters(LPDSFXGargle pDsFxGargle) 64 | { 65 | return ProxyInterface->GetAllParameters(pDsFxGargle); 66 | } 67 | -------------------------------------------------------------------------------- /dsound/IDirectSoundFXGargle8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectSoundFXGargle8 : public IDirectSoundFXGargle8, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECTSOUNDFXGARGLE8 ProxyInterface; 7 | 8 | public: 9 | m_IDirectSoundFXGargle8(LPDIRECTSOUNDFXGARGLE8 pSound8) : ProxyInterface(pSound8) 10 | { 11 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 12 | } 13 | ~m_IDirectSoundFXGargle8() 14 | { 15 | ProxyAddressLookupTable.DeleteAddress(this); 16 | } 17 | 18 | LPDIRECTSOUNDFXGARGLE8 GetProxyInterface() { return ProxyInterface; } 19 | 20 | // IUnknown methods 21 | STDMETHOD(QueryInterface)(THIS_ _In_ REFIID, _Outptr_ LPVOID*); 22 | STDMETHOD_(ULONG, AddRef)(THIS); 23 | STDMETHOD_(ULONG, Release)(THIS); 24 | 25 | // IDirectSoundFXGargle methods 26 | STDMETHOD(SetAllParameters)(THIS_ _In_ LPCDSFXGargle pcDsFxGargle); 27 | STDMETHOD(GetAllParameters)(THIS_ _Out_ LPDSFXGargle pDsFxGargle); 28 | }; 29 | -------------------------------------------------------------------------------- /dsound/IDirectSoundFXI3DL2Reverb8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectSoundFXI3DL2Reverb8 : public IDirectSoundFXI3DL2Reverb8, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECTSOUNDFXI3DL2REVERB8 ProxyInterface; 7 | 8 | public: 9 | m_IDirectSoundFXI3DL2Reverb8(LPDIRECTSOUNDFXI3DL2REVERB8 pSound8) : ProxyInterface(pSound8) 10 | { 11 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 12 | } 13 | ~m_IDirectSoundFXI3DL2Reverb8() 14 | { 15 | ProxyAddressLookupTable.DeleteAddress(this); 16 | } 17 | 18 | LPDIRECTSOUNDFXI3DL2REVERB8 GetProxyInterface() { return ProxyInterface; } 19 | 20 | // IUnknown methods 21 | STDMETHOD(QueryInterface)(THIS_ _In_ REFIID, _Outptr_ LPVOID*); 22 | STDMETHOD_(ULONG, AddRef)(THIS); 23 | STDMETHOD_(ULONG, Release)(THIS); 24 | 25 | // IDirectSoundFXI3DL2Reverb methods 26 | STDMETHOD(SetAllParameters)(THIS_ _In_ LPCDSFXI3DL2Reverb pcDsFxI3DL2Reverb); 27 | STDMETHOD(GetAllParameters)(THIS_ _Out_ LPDSFXI3DL2Reverb pDsFxI3DL2Reverb); 28 | STDMETHOD(SetPreset)(THIS_ DWORD dwPreset); 29 | STDMETHOD(GetPreset)(THIS_ _Out_ LPDWORD pdwPreset); 30 | STDMETHOD(SetQuality)(THIS_ LONG lQuality); 31 | STDMETHOD(GetQuality)(THIS_ _Out_ LONG *plQuality); 32 | }; 33 | -------------------------------------------------------------------------------- /dsound/IDirectSoundFXParamEq8.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "dsound.h" 18 | 19 | HRESULT m_IDirectSoundFXParamEq8::QueryInterface(REFIID riid, LPVOID * ppvObj) 20 | { 21 | if ((riid == IID_IDirectSoundFXParamEq || riid == IID_IDirectSoundFXParamEq8 || riid == IID_IUnknown) && ppvObj) 22 | { 23 | AddRef(); 24 | 25 | *ppvObj = this; 26 | 27 | return S_OK; 28 | } 29 | 30 | HRESULT hr = ProxyInterface->QueryInterface(riid, ppvObj); 31 | 32 | if (SUCCEEDED(hr)) 33 | { 34 | genericQueryInterface(riid, ppvObj); 35 | } 36 | 37 | return hr; 38 | } 39 | 40 | ULONG m_IDirectSoundFXParamEq8::AddRef() 41 | { 42 | return ProxyInterface->AddRef(); 43 | } 44 | 45 | ULONG m_IDirectSoundFXParamEq8::Release() 46 | { 47 | ULONG ref = ProxyInterface->Release(); 48 | 49 | if (ref == 0) 50 | { 51 | delete this; 52 | } 53 | 54 | return ref; 55 | } 56 | 57 | // IDirectSoundFXParamEq methods 58 | HRESULT m_IDirectSoundFXParamEq8::SetAllParameters(LPCDSFXParamEq pcDsFxParamEq) 59 | { 60 | return ProxyInterface->SetAllParameters(pcDsFxParamEq); 61 | } 62 | 63 | HRESULT m_IDirectSoundFXParamEq8::GetAllParameters(LPDSFXParamEq pDsFxParamEq) 64 | { 65 | return ProxyInterface->GetAllParameters(pDsFxParamEq); 66 | } 67 | -------------------------------------------------------------------------------- /dsound/IDirectSoundFXParamEq8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectSoundFXParamEq8 : public IDirectSoundFXParamEq8, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECTSOUNDFXPARAMEQ8 ProxyInterface; 7 | 8 | public: 9 | m_IDirectSoundFXParamEq8(LPDIRECTSOUNDFXPARAMEQ8 pSound8) : ProxyInterface(pSound8) 10 | { 11 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 12 | } 13 | ~m_IDirectSoundFXParamEq8() 14 | { 15 | ProxyAddressLookupTable.DeleteAddress(this); 16 | } 17 | 18 | LPDIRECTSOUNDFXPARAMEQ8 GetProxyInterface() { return ProxyInterface; } 19 | 20 | // IUnknown methods 21 | STDMETHOD(QueryInterface)(THIS_ _In_ REFIID, _Outptr_ LPVOID*); 22 | STDMETHOD_(ULONG, AddRef)(THIS); 23 | STDMETHOD_(ULONG, Release)(THIS); 24 | 25 | // IDirectSoundFXParamEq methods 26 | STDMETHOD(SetAllParameters)(THIS_ _In_ LPCDSFXParamEq pcDsFxParamEq); 27 | STDMETHOD(GetAllParameters)(THIS_ _Out_ LPDSFXParamEq pDsFxParamEq); 28 | }; 29 | -------------------------------------------------------------------------------- /dsound/IDirectSoundFXWavesReverb8.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "dsound.h" 18 | 19 | HRESULT m_IDirectSoundFXWavesReverb8::QueryInterface(REFIID riid, LPVOID * ppvObj) 20 | { 21 | if ((riid == IID_IDirectSoundFXWavesReverb || riid == IID_IDirectSoundFXWavesReverb8 || riid == IID_IUnknown) && ppvObj) 22 | { 23 | AddRef(); 24 | 25 | *ppvObj = this; 26 | 27 | return S_OK; 28 | } 29 | 30 | HRESULT hr = ProxyInterface->QueryInterface(riid, ppvObj); 31 | 32 | if (SUCCEEDED(hr)) 33 | { 34 | genericQueryInterface(riid, ppvObj); 35 | } 36 | 37 | return hr; 38 | } 39 | 40 | ULONG m_IDirectSoundFXWavesReverb8::AddRef() 41 | { 42 | return ProxyInterface->AddRef(); 43 | } 44 | 45 | ULONG m_IDirectSoundFXWavesReverb8::Release() 46 | { 47 | ULONG ref = ProxyInterface->Release(); 48 | 49 | if (ref == 0) 50 | { 51 | delete this; 52 | } 53 | 54 | return ref; 55 | } 56 | 57 | // IDirectSoundFXWavesReverb methods 58 | HRESULT m_IDirectSoundFXWavesReverb8::SetAllParameters(LPCDSFXWavesReverb pcDsFxWavesReverb) 59 | { 60 | return ProxyInterface->SetAllParameters(pcDsFxWavesReverb); 61 | } 62 | 63 | HRESULT m_IDirectSoundFXWavesReverb8::GetAllParameters(LPDSFXWavesReverb pDsFxWavesReverb) 64 | { 65 | return ProxyInterface->GetAllParameters(pDsFxWavesReverb); 66 | } 67 | -------------------------------------------------------------------------------- /dsound/IDirectSoundFXWavesReverb8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectSoundFXWavesReverb8 : public IDirectSoundFXWavesReverb8, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECTSOUNDFXWAVESREVERB8 ProxyInterface; 7 | 8 | public: 9 | m_IDirectSoundFXWavesReverb8(LPDIRECTSOUNDFXWAVESREVERB8 pSound8) : ProxyInterface(pSound8) 10 | { 11 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 12 | } 13 | ~m_IDirectSoundFXWavesReverb8() 14 | { 15 | ProxyAddressLookupTable.DeleteAddress(this); 16 | } 17 | 18 | LPDIRECTSOUNDFXWAVESREVERB8 GetProxyInterface() { return ProxyInterface; } 19 | 20 | // IUnknown methods 21 | STDMETHOD(QueryInterface)(THIS_ _In_ REFIID, _Outptr_ LPVOID*); 22 | STDMETHOD_(ULONG, AddRef)(THIS); 23 | STDMETHOD_(ULONG, Release)(THIS); 24 | 25 | // IDirectSoundFXWavesReverb methods 26 | STDMETHOD(SetAllParameters)(THIS_ _In_ LPCDSFXWavesReverb pcDsFxWavesReverb); 27 | STDMETHOD(GetAllParameters)(THIS_ _Out_ LPDSFXWavesReverb pDsFxWavesReverb); 28 | }; 29 | -------------------------------------------------------------------------------- /dsound/IDirectSoundFullDuplex8.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "dsound.h" 18 | 19 | HRESULT m_IDirectSoundFullDuplex8::QueryInterface(REFIID riid, LPVOID * ppvObj) 20 | { 21 | if ((riid == IID_IDirectSoundFullDuplex || riid == IID_IDirectSoundFullDuplex8 || riid == IID_IUnknown) && ppvObj) 22 | { 23 | AddRef(); 24 | 25 | *ppvObj = this; 26 | 27 | return S_OK; 28 | } 29 | 30 | HRESULT hr = ProxyInterface->QueryInterface(riid, ppvObj); 31 | 32 | if (SUCCEEDED(hr)) 33 | { 34 | genericQueryInterface(riid, ppvObj); 35 | } 36 | 37 | return hr; 38 | } 39 | 40 | ULONG m_IDirectSoundFullDuplex8::AddRef() 41 | { 42 | return ProxyInterface->AddRef(); 43 | } 44 | 45 | ULONG m_IDirectSoundFullDuplex8::Release() 46 | { 47 | ULONG ref = ProxyInterface->Release(); 48 | 49 | if (ref == 0) 50 | { 51 | delete this; 52 | } 53 | 54 | return ref; 55 | } 56 | 57 | // IDirectSoundFullDuplex methods 58 | HRESULT m_IDirectSoundFullDuplex8::Initialize(LPCGUID pCaptureGuid, LPCGUID pRenderGuid, LPCDSCBUFFERDESC lpDscBufferDesc, LPCDSBUFFERDESC lpDsBufferDesc, HWND hWnd, DWORD dwLevel, 59 | LPLPDIRECTSOUNDCAPTUREBUFFER8 lplpDirectSoundCaptureBuffer8, LPLPDIRECTSOUNDBUFFER8 lplpDirectSoundBuffer8) 60 | { 61 | return ProxyInterface->Initialize(pCaptureGuid, pRenderGuid, lpDscBufferDesc, lpDsBufferDesc, hWnd, dwLevel, lplpDirectSoundCaptureBuffer8, lplpDirectSoundBuffer8); 62 | } 63 | -------------------------------------------------------------------------------- /dsound/IDirectSoundFullDuplex8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectSoundFullDuplex8 : public IDirectSoundFullDuplex8, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECTSOUNDFULLDUPLEX ProxyInterface; 7 | 8 | public: 9 | m_IDirectSoundFullDuplex8(LPDIRECTSOUNDFULLDUPLEX pSound8) : ProxyInterface(pSound8) 10 | { 11 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 12 | } 13 | ~m_IDirectSoundFullDuplex8() 14 | { 15 | ProxyAddressLookupTable.DeleteAddress(this); 16 | } 17 | 18 | LPDIRECTSOUNDFULLDUPLEX GetProxyInterface() { return ProxyInterface; } 19 | 20 | // IUnknown methods 21 | STDMETHOD(QueryInterface)(THIS_ _In_ REFIID, _Outptr_ LPVOID*); 22 | STDMETHOD_(ULONG, AddRef)(THIS); 23 | STDMETHOD_(ULONG, Release)(THIS); 24 | 25 | // IDirectSoundFullDuplex methods 26 | STDMETHOD(Initialize)(THIS_ _In_ LPCGUID pCaptureGuid, _In_ LPCGUID pRenderGuid, _In_ LPCDSCBUFFERDESC lpDscBufferDesc, _In_ LPCDSBUFFERDESC lpDsBufferDesc, HWND hWnd, DWORD dwLevel, 27 | _Outptr_ LPLPDIRECTSOUNDCAPTUREBUFFER8 lplpDirectSoundCaptureBuffer8, _Outptr_ LPLPDIRECTSOUNDBUFFER8 lplpDirectSoundBuffer8); 28 | }; 29 | -------------------------------------------------------------------------------- /dsound/IDirectSoundNotify8.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #include "dsound.h" 18 | 19 | HRESULT m_IDirectSoundNotify8::QueryInterface(REFIID riid, LPVOID * ppvObj) 20 | { 21 | if ((riid == IID_IDirectSoundNotify || riid == IID_IDirectSoundNotify8 || riid == IID_IUnknown) && ppvObj) 22 | { 23 | AddRef(); 24 | 25 | *ppvObj = this; 26 | 27 | return S_OK; 28 | } 29 | 30 | HRESULT hr = ProxyInterface->QueryInterface(riid, ppvObj); 31 | 32 | if (SUCCEEDED(hr)) 33 | { 34 | genericQueryInterface(riid, ppvObj); 35 | } 36 | 37 | return hr; 38 | } 39 | 40 | ULONG m_IDirectSoundNotify8::AddRef() 41 | { 42 | return ProxyInterface->AddRef(); 43 | } 44 | 45 | ULONG m_IDirectSoundNotify8::Release() 46 | { 47 | ULONG ref = ProxyInterface->Release(); 48 | 49 | if (ref == 0) 50 | { 51 | delete this; 52 | } 53 | 54 | return ref; 55 | } 56 | 57 | // IDirectSoundNotify methods 58 | HRESULT m_IDirectSoundNotify8::SetNotificationPositions(DWORD dwPositionNotifies, LPCDSBPOSITIONNOTIFY pcPositionNotifies) 59 | { 60 | return ProxyInterface->SetNotificationPositions(dwPositionNotifies, pcPositionNotifies); 61 | } 62 | -------------------------------------------------------------------------------- /dsound/IDirectSoundNotify8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IDirectSoundNotify8 : public IDirectSoundNotify8, public AddressLookupTableObject 4 | { 5 | private: 6 | LPDIRECTSOUNDNOTIFY8 ProxyInterface; 7 | 8 | public: 9 | m_IDirectSoundNotify8(LPDIRECTSOUNDNOTIFY8 pSound8) : ProxyInterface(pSound8) 10 | { 11 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 12 | } 13 | ~m_IDirectSoundNotify8() 14 | { 15 | ProxyAddressLookupTable.DeleteAddress(this); 16 | } 17 | 18 | LPDIRECTSOUNDNOTIFY8 GetProxyInterface() { return ProxyInterface; } 19 | 20 | // IUnknown methods 21 | STDMETHOD(QueryInterface)(THIS_ _In_ REFIID, _Outptr_ LPVOID*); 22 | STDMETHOD_(ULONG, AddRef)(THIS); 23 | STDMETHOD_(ULONG, Release)(THIS); 24 | 25 | // IDirectSoundNotify methods 26 | STDMETHOD(SetNotificationPositions)(THIS_ DWORD dwPositionNotifies, _In_reads_(dwPositionNotifies) LPCDSBPOSITIONNOTIFY pcPositionNotifies); 27 | }; 28 | -------------------------------------------------------------------------------- /dsound/IKsPropertySet.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class m_IKsPropertySet : public IKsPropertySet, public AddressLookupTableObject 4 | { 5 | private: 6 | IKsPropertySet *ProxyInterface; 7 | 8 | public: 9 | m_IKsPropertySet(IKsPropertySet *pSound8) : ProxyInterface(pSound8) 10 | { 11 | ProxyAddressLookupTable.SaveAddress(this, ProxyInterface); 12 | } 13 | ~m_IKsPropertySet() 14 | { 15 | ProxyAddressLookupTable.DeleteAddress(this); 16 | } 17 | 18 | IKsPropertySet *GetProxyInterface() { return ProxyInterface; } 19 | 20 | // IUnknown methods 21 | STDMETHOD(QueryInterface)(THIS_ _In_ REFIID, _Outptr_ LPVOID*); 22 | STDMETHOD_(ULONG, AddRef)(THIS); 23 | STDMETHOD_(ULONG, Release)(THIS); 24 | 25 | // IKsPropertySet methods 26 | STDMETHOD(Get)(THIS_ _In_ REFGUID rguidPropSet, ULONG ulId, _In_reads_bytes_opt_(ulInstanceLength) LPVOID pInstanceData, ULONG ulInstanceLength, 27 | _Out_writes_bytes_(ulDataLength) LPVOID pPropertyData, ULONG ulDataLength, _Out_opt_ PULONG pulBytesReturned); 28 | STDMETHOD(Set)(THIS_ _In_ REFGUID rguidPropSet, ULONG ulId, _In_reads_bytes_opt_(ulInstanceLength) LPVOID pInstanceData, ULONG ulInstanceLength, 29 | _In_reads_bytes_(ulDataLength) LPVOID pPropertyData, ULONG ulDataLength); 30 | STDMETHOD(QuerySupport)(THIS_ _In_ REFGUID rguidPropSet, ULONG ulId, _Out_ PULONG pulTypeSupport); 31 | }; 32 | -------------------------------------------------------------------------------- /dsound/License.txt: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Elisha Riedlinger 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. In no event will the 5 | * authors be held liable for any damages arising from the use of this software. 6 | * Permission is granted to anyone to use this software for any purpose, including commercial 7 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | * 9 | * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 10 | * original software. If you use this software in a product, an acknowledgment in the product 11 | * documentation would be appreciated but is not required. 12 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 13 | * being the original software. 14 | * 3. This notice may not be removed or altered from any source distribution. 15 | */ -------------------------------------------------------------------------------- /dsound/dsound.def: -------------------------------------------------------------------------------- 1 | LIBRARY dsound 2 | EXPORTS 3 | 4 | DirectSoundCreate @1 5 | DirectSoundEnumerateA @2 6 | DirectSoundEnumerateW @3 7 | DllCanUnloadNow PRIVATE 8 | DllGetClassObject PRIVATE 9 | DirectSoundCaptureCreate @6 10 | DirectSoundCaptureEnumerateA @7 11 | DirectSoundCaptureEnumerateW @8 12 | GetDeviceID @9 13 | DirectSoundFullDuplexCreate @10 14 | DirectSoundCreate8 @11 15 | DirectSoundCaptureCreate8 @12 16 | --------------------------------------------------------------------------------