1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-25 18:17:47 +01:00
cnc-ddraw/src/IDirectDraw/IDirectDraw.c

628 lines
19 KiB
C
Raw Normal View History

2024-06-01 23:04:06 +02:00
#include <windows.h>
2020-10-13 09:20:52 +02:00
#include <initguid.h>
#include "IDirectDraw.h"
2020-10-14 00:42:42 +02:00
#include "IDirect3D.h"
#include "IAMMediaStream.h"
2020-10-13 09:20:52 +02:00
#include "dd.h"
#include "ddclipper.h"
#include "ddpalette.h"
#include "ddsurface.h"
#include "debug.h"
2023-08-06 09:37:43 +02:00
#include "hook.h"
#include "config.h"
2020-10-13 09:20:52 +02:00
2021-06-11 20:30:43 +02:00
HRESULT __stdcall IDirectDraw__QueryInterface(IDirectDrawImpl* This, REFIID riid, LPVOID FAR* ppvObj)
2020-10-13 09:20:52 +02:00
{
2024-06-16 02:36:20 +02:00
TRACE("-> %s(This=%p, riid=%08X, ppvObj=%p) [%p]\n", __FUNCTION__, This, (unsigned int)riid, ppvObj, _ReturnAddress());
2021-06-11 20:30:43 +02:00
2023-08-01 18:36:26 +02:00
HRESULT ret = E_NOINTERFACE;
2020-10-13 09:20:52 +02:00
2024-08-31 11:12:39 +02:00
if (!ppvObj)
{
ret = E_INVALIDARG;
}
else if (riid)
2020-10-13 09:20:52 +02:00
{
if (IsEqualGUID(&IID_IDirectDraw2, riid) ||
IsEqualGUID(&IID_IDirectDraw4, riid) ||
IsEqualGUID(&IID_IDirectDraw7, riid))
{
2021-06-11 20:30:43 +02:00
IDirectDrawImpl* dd =
(IDirectDrawImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectDrawImpl));
TRACE(" GUID = %08X (IID_IDirectDrawX), ddraw = %p\n", ((GUID*)riid)->Data1, dd);
2020-10-15 05:13:37 +02:00
2021-09-02 22:22:48 +02:00
memcpy(&dd->guid, riid, sizeof(dd->guid));
2020-10-13 09:20:52 +02:00
dd->lpVtbl = &g_dd_vtblx;
2020-10-15 05:13:37 +02:00
IDirectDraw_AddRef(dd);
2020-10-13 09:20:52 +02:00
2021-06-11 20:30:43 +02:00
*ppvObj = dd;
2020-10-13 21:58:04 +02:00
2020-10-13 09:20:52 +02:00
ret = S_OK;
}
2020-10-14 00:42:42 +02:00
else if (IsEqualGUID(&IID_IDirectDraw, riid))
{
2021-06-11 20:30:43 +02:00
IDirectDrawImpl* dd =
(IDirectDrawImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectDrawImpl));
TRACE(" GUID = %08X (IID_IDirectDraw), ddraw = %p\n", ((GUID*)riid)->Data1, dd);
2020-10-15 05:13:37 +02:00
2021-09-02 22:22:48 +02:00
memcpy(&dd->guid, riid, sizeof(dd->guid));
2020-10-14 00:42:42 +02:00
dd->lpVtbl = &g_dd_vtbl1;
2020-10-15 05:13:37 +02:00
IDirectDraw_AddRef(dd);
2020-10-14 00:42:42 +02:00
2021-06-11 20:30:43 +02:00
*ppvObj = dd;
2020-10-14 00:42:42 +02:00
ret = S_OK;
}
else if (IsEqualGUID(&IID_IDirect3D, riid) && !g_config.direct3d_passthrough)
2020-10-14 00:42:42 +02:00
{
2021-06-11 20:30:43 +02:00
IDirect3DImpl* d3d =
(IDirect3DImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DImpl));
TRACE(" GUID = %08X (IID_IDirect3D), d3d = %p\n", ((GUID*)riid)->Data1, d3d);
2020-10-22 18:58:56 +02:00
d3d->lpVtbl = &g_d3d_vtbl;
2020-10-15 05:13:37 +02:00
d3d->lpVtbl->AddRef(d3d);
2020-10-14 00:42:42 +02:00
2021-06-11 20:30:43 +02:00
*ppvObj = d3d;
2020-10-14 00:42:42 +02:00
ret = S_OK;
}
else if (IsEqualGUID(&IID_IDirect3D2, riid) && !g_config.direct3d_passthrough)
2020-10-14 00:42:42 +02:00
{
2021-06-11 20:30:43 +02:00
IDirect3D2Impl* d3d =
(IDirect3D2Impl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3D2Impl));
2020-10-14 01:04:43 +02:00
2021-06-11 20:30:43 +02:00
TRACE(" GUID = %08X (IID_IDirect3D2), d3d = %p\n", ((GUID*)riid)->Data1, d3d);
2020-10-22 18:58:56 +02:00
d3d->lpVtbl = &g_d3d2_vtbl;
d3d->lpVtbl->AddRef(d3d);
2021-06-11 20:30:43 +02:00
*ppvObj = d3d;
2020-10-22 18:58:56 +02:00
ret = S_OK;
}
else if (IsEqualGUID(&IID_IDirect3D3, riid) && !g_config.direct3d_passthrough)
2020-10-22 18:58:56 +02:00
{
2021-06-11 20:30:43 +02:00
IDirect3D3Impl* d3d =
(IDirect3D3Impl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3D3Impl));
2020-10-22 18:58:56 +02:00
2021-06-11 20:30:43 +02:00
TRACE(" GUID = %08X (IID_IDirect3D3), d3d = %p\n", ((GUID*)riid)->Data1, d3d);
2020-10-22 18:58:56 +02:00
d3d->lpVtbl = &g_d3d3_vtbl;
d3d->lpVtbl->AddRef(d3d);
2021-06-11 20:30:43 +02:00
*ppvObj = d3d;
2020-10-22 18:58:56 +02:00
ret = S_OK;
}
else if (IsEqualGUID(&IID_IDirect3D7, riid) && !g_config.direct3d_passthrough)
2020-10-22 18:58:56 +02:00
{
2021-06-11 20:30:43 +02:00
IDirect3D7Impl* d3d =
(IDirect3D7Impl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3D7Impl));
2020-10-22 18:58:56 +02:00
2021-06-11 20:30:43 +02:00
TRACE(" GUID = %08X (IID_IDirect3D7), d3d = %p\n", ((GUID*)riid)->Data1, d3d);
2020-10-22 18:58:56 +02:00
d3d->lpVtbl = &g_d3d7_vtbl;
d3d->lpVtbl->AddRef(d3d);
2021-06-11 20:30:43 +02:00
*ppvObj = d3d;
2020-10-22 18:58:56 +02:00
ret = S_OK;
2023-08-01 18:36:26 +02:00
}
else if (IsEqualGUID(&IID_IMediaStream, riid) || IsEqualGUID(&IID_IAMMediaStream, riid))
2020-10-13 09:20:52 +02:00
{
2023-08-01 18:36:26 +02:00
TRACE("NOT_IMPLEMENTED GUID = %08X (IID_IXXMediaStream)\n", ((GUID*)riid)->Data1);
ret = E_NOINTERFACE;
/*
2021-06-11 20:30:43 +02:00
IAMMediaStreamImpl* ms =
2021-05-29 20:52:57 +02:00
(IAMMediaStreamImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAMMediaStreamImpl));
2021-06-11 20:30:43 +02:00
TRACE(" GUID = %08X (IID_IXXMediaStream), ms = %p\n", ((GUID*)riid)->Data1, ms);
ms->lpVtbl = &g_ms_vtbl;
ms->lpVtbl->AddRef(ms);
2023-08-01 18:36:26 +02:00
*ppvObj = ms;
2020-10-13 09:20:52 +02:00
2020-10-14 01:04:43 +02:00
ret = S_OK;
2023-08-01 18:36:26 +02:00
*/
2020-10-14 01:04:43 +02:00
}
2024-08-31 10:11:37 +02:00
else if (((GUID*)riid)->Data1 == 0 && ((GUID*)riid)->Data2 == 0 && ((GUID*)riid)->Data3 == 0)
{
TRACE("NOT_IMPLEMENTED GUID = 0 0 0\n");
ret = E_NOINTERFACE;
}
else
{
2021-06-11 20:30:43 +02:00
TRACE("NOT_IMPLEMENTED GUID = %08X\n", ((GUID*)riid)->Data1);
2024-03-22 22:27:00 +01:00
if (!g_ddraw.real_dll)
g_ddraw.real_dll = real_LoadLibraryA("system32\\ddraw.dll");
2021-05-29 20:52:57 +02:00
2024-03-22 22:27:00 +01:00
if (g_ddraw.real_dll && !g_ddraw.DirectDrawCreate)
g_ddraw.DirectDrawCreate = (void*)real_GetProcAddress(g_ddraw.real_dll, "DirectDrawCreate");
2021-05-29 20:52:57 +02:00
2024-03-22 22:27:00 +01:00
if (g_ddraw.DirectDrawCreate == DirectDrawCreate)
g_ddraw.DirectDrawCreate = NULL;
2021-05-29 20:52:57 +02:00
2024-03-22 22:27:00 +01:00
if (!g_ddraw.real_dd && g_ddraw.DirectDrawCreate)
g_ddraw.DirectDrawCreate(NULL, &g_ddraw.real_dd, NULL);
2021-05-29 20:52:57 +02:00
2024-03-22 22:27:00 +01:00
if (g_ddraw.real_dd)
ret = IDirectDraw_QueryInterface(g_ddraw.real_dd, riid, ppvObj);
2021-09-02 22:22:48 +02:00
else
ret = E_NOINTERFACE;
}
2023-08-01 18:36:26 +02:00
2020-10-13 09:20:52 +02:00
}
2023-08-01 18:36:26 +02:00
TRACE("<- %s(result=%08X)\n", __FUNCTION__, ret);
2020-10-13 09:20:52 +02:00
return ret;
}
ULONG __stdcall IDirectDraw__AddRef(IDirectDrawImpl* This)
{
2024-06-16 02:36:20 +02:00
TRACE("-> %s(This=%p) [%p]\n", __FUNCTION__, This, _ReturnAddress());
2020-10-13 09:20:52 +02:00
ULONG ret = ++This->ref;
2023-10-22 11:46:13 +02:00
#ifdef _DEBUG
2020-10-13 09:20:52 +02:00
ULONG glob_ref = dd_AddRef();
2023-10-22 11:46:13 +02:00
#else
dd_AddRef();
#endif
2021-06-11 20:30:43 +02:00
TRACE("<- %s(This ref=%u, global ref=%u)\n", __FUNCTION__, ret, glob_ref);
2020-10-13 09:20:52 +02:00
return ret;
}
ULONG __stdcall IDirectDraw__Release(IDirectDrawImpl* This)
{
2024-06-16 02:36:20 +02:00
TRACE("-> %s(This=%p) [%p]\n", __FUNCTION__, This, _ReturnAddress());
2020-10-13 09:20:52 +02:00
ULONG ret = --This->ref;
if (This->ref == 0)
{
2021-06-11 20:30:43 +02:00
TRACE(" Released (%p)\n", This);
2020-10-13 21:58:04 +02:00
2020-10-13 09:20:52 +02:00
HeapFree(GetProcessHeap(), 0, This);
}
2023-10-22 11:46:13 +02:00
#ifdef _DEBUG
2020-10-13 09:20:52 +02:00
ULONG glob_ref = dd_Release();
2023-10-22 11:46:13 +02:00
#else
dd_Release();
#endif
2020-10-13 09:20:52 +02:00
2021-06-11 20:30:43 +02:00
TRACE("<- %s(This ref=%u, global ref=%u)\n", __FUNCTION__, ret, glob_ref);
2020-10-13 09:20:52 +02:00
return ret;
}
HRESULT __stdcall IDirectDraw__Compact(IDirectDrawImpl* This)
{
2024-06-16 02:36:20 +02:00
TRACE("NOT_IMPLEMENTED -> %s(This=%p) [%p]\n", __FUNCTION__, This, _ReturnAddress());
2020-10-13 09:20:52 +02:00
HRESULT ret = DD_OK;
2021-06-11 20:30:43 +02:00
TRACE("NOT_IMPLEMENTED <- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
2021-06-11 20:30:43 +02:00
HRESULT __stdcall IDirectDraw__CreateClipper(
IDirectDrawImpl* This,
DWORD dwFlags,
LPDIRECTDRAWCLIPPER FAR* lplpDDClipper,
IUnknown FAR* pUnkOuter)
2020-10-13 09:20:52 +02:00
{
2021-06-11 20:30:43 +02:00
TRACE(
2024-06-16 02:36:20 +02:00
"-> %s(This=%p, dwFlags=%08X, lplpDDClipper=%p, unkOuter=%p) [%p]\n",
2021-06-11 20:30:43 +02:00
__FUNCTION__,
This,
dwFlags,
lplpDDClipper,
2024-06-16 02:36:20 +02:00
pUnkOuter,
_ReturnAddress());
2021-06-11 20:30:43 +02:00
HRESULT ret = dd_CreateClipper(dwFlags, (IDirectDrawClipperImpl**)lplpDDClipper, pUnkOuter);
TRACE("<- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
2021-06-11 20:30:43 +02:00
HRESULT __stdcall IDirectDraw__CreatePalette(
IDirectDrawImpl* This,
DWORD dwFlags,
LPPALETTEENTRY lpDDColorArray,
LPDIRECTDRAWPALETTE FAR* lpDDPalette,
IUnknown FAR* unkOuter)
{
TRACE(
2024-06-16 02:36:20 +02:00
"-> %s(This=%p, dwFlags=%08X, lpDDColorArray=%p, lpDDPalette=%p, unkOuter=%p) [%p]\n",
2021-06-11 20:30:43 +02:00
__FUNCTION__,
This,
dwFlags,
lpDDColorArray,
lpDDPalette,
2024-06-16 02:36:20 +02:00
unkOuter,
_ReturnAddress());
2021-06-11 20:30:43 +02:00
HRESULT ret = dd_CreatePalette(dwFlags, lpDDColorArray, (IDirectDrawPaletteImpl**)lpDDPalette, unkOuter);
TRACE("<- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
2021-06-11 20:30:43 +02:00
HRESULT __stdcall IDirectDraw__CreateSurface(
IDirectDrawImpl* This,
LPDDSURFACEDESC2 lpDDSurfaceDesc,
LPDIRECTDRAWSURFACE7 FAR* lpDDSurface,
IUnknown FAR* unkOuter)
2020-10-13 09:20:52 +02:00
{
2021-06-11 20:30:43 +02:00
TRACE(
2024-06-16 02:36:20 +02:00
"-> %s(This=%p, lpDDSurfaceDesc=%p, lpDDSurface=%p, unkOuter=%p) [%p]\n",
2021-06-11 20:30:43 +02:00
__FUNCTION__,
This,
lpDDSurfaceDesc,
lpDDSurface,
2024-06-16 02:36:20 +02:00
unkOuter,
_ReturnAddress());
2021-06-11 20:30:43 +02:00
HRESULT ret =
dd_CreateSurface(
This,
(LPDDSURFACEDESC)lpDDSurfaceDesc,
(IDirectDrawSurfaceImpl**)lpDDSurface,
unkOuter);
2021-06-11 20:30:43 +02:00
TRACE("<- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
2021-06-11 20:30:43 +02:00
HRESULT __stdcall IDirectDraw__DuplicateSurface(
IDirectDrawImpl* This,
LPDIRECTDRAWSURFACE7 lpDDSrcSurface,
LPDIRECTDRAWSURFACE7* lpDDDestSurface)
2020-10-13 09:20:52 +02:00
{
2024-06-16 02:36:20 +02:00
TRACE("NOT_IMPLEMENTED -> %s(This=%p) [%p]\n", __FUNCTION__, This, _ReturnAddress());
2021-06-11 20:30:43 +02:00
HRESULT ret = DDERR_CANTDUPLICATE;
TRACE("NOT_IMPLEMENTED <- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
2021-06-11 20:30:43 +02:00
HRESULT __stdcall IDirectDraw__EnumDisplayModes(
IDirectDrawImpl* This,
DWORD dwFlags,
LPDDSURFACEDESC2 lpDDSurfaceDesc,
LPVOID lpContext,
LPDDENUMMODESCALLBACK2 lpEnumModesCallback)
{
TRACE(
2024-06-16 02:36:20 +02:00
"-> %s(This=%p, dwFlags=%08X, lpDDSurfaceDesc=%p, lpContext=%p, lpEnumModesCallback=%p) [%p]\n",
2021-06-11 20:30:43 +02:00
__FUNCTION__,
This,
dwFlags,
lpDDSurfaceDesc,
lpContext,
2024-06-16 02:36:20 +02:00
lpEnumModesCallback,
_ReturnAddress());
2021-06-11 20:30:43 +02:00
HRESULT ret =
dd_EnumDisplayModes(
dwFlags,
(LPDDSURFACEDESC)lpDDSurfaceDesc,
lpContext,
(LPDDENUMMODESCALLBACK)lpEnumModesCallback);
2021-06-11 20:30:43 +02:00
TRACE("<- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
2021-06-11 20:30:43 +02:00
HRESULT __stdcall IDirectDraw__EnumSurfaces(
IDirectDrawImpl* This,
DWORD dwFlags,
LPDDSURFACEDESC2 lpDDSurfaceDesc,
LPVOID lpContext,
LPDDENUMSURFACESCALLBACK7 lpEnumSurfacesCallback)
2020-10-13 09:20:52 +02:00
{
2024-06-16 02:36:20 +02:00
TRACE("NOT_IMPLEMENTED -> %s(This=%p) [%p]\n", __FUNCTION__, This, _ReturnAddress());
2020-10-13 09:20:52 +02:00
HRESULT ret = DD_OK;
2021-06-11 20:30:43 +02:00
TRACE("NOT_IMPLEMENTED <- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
HRESULT __stdcall IDirectDraw__FlipToGDISurface(IDirectDrawImpl* This)
{
2024-06-16 02:36:20 +02:00
TRACE("NOT_IMPLEMENTED -> %s(This=%p) [%p]\n", __FUNCTION__, This, _ReturnAddress());
2020-10-13 09:20:52 +02:00
HRESULT ret = DD_OK;
2021-06-11 20:30:43 +02:00
TRACE("NOT_IMPLEMENTED <- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
HRESULT __stdcall IDirectDraw__GetCaps(IDirectDrawImpl* This, LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDEmulCaps)
{
2024-06-16 02:36:20 +02:00
TRACE(
"-> %s(This=%p, lpDDDriverCaps=%p, lpDDEmulCaps=%p) [%p]\n",
__FUNCTION__,
This,
lpDDDriverCaps,
lpDDEmulCaps,
_ReturnAddress());
2021-06-14 09:18:14 +02:00
HRESULT ret = dd_GetCaps((LPDDCAPS_DX1)lpDDDriverCaps, (LPDDCAPS_DX1)lpDDEmulCaps);
2021-06-11 20:30:43 +02:00
TRACE("<- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
2021-06-11 20:30:43 +02:00
HRESULT __stdcall IDirectDraw__GetDisplayMode(IDirectDrawImpl* This, LPDDSURFACEDESC2 lpDDSurfaceDesc)
2020-10-13 09:20:52 +02:00
{
2024-06-16 02:36:20 +02:00
TRACE("-> %s(This=%p) [%p]\n", __FUNCTION__, This, _ReturnAddress());
HRESULT ret = dd_GetDisplayMode((LPDDSURFACEDESC)lpDDSurfaceDesc);
2021-06-11 20:30:43 +02:00
TRACE("<- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
2021-06-11 20:30:43 +02:00
HRESULT __stdcall IDirectDraw__GetFourCCCodes(IDirectDrawImpl* This, LPDWORD lpNumCodes, LPDWORD lpCodes)
2020-10-13 09:20:52 +02:00
{
2024-06-16 02:36:20 +02:00
TRACE("NOT_IMPLEMENTED -> %s(This=%p) [%p]\n", __FUNCTION__, This, _ReturnAddress());
2021-06-06 01:36:51 +02:00
HRESULT ret = DDERR_INVALIDOBJECT;
2021-06-11 20:30:43 +02:00
TRACE("NOT_IMPLEMENTED <- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
2021-06-11 20:30:43 +02:00
HRESULT __stdcall IDirectDraw__GetGDISurface(IDirectDrawImpl* This, LPDIRECTDRAWSURFACE7* lplpGDIDDSurface)
2020-10-13 09:20:52 +02:00
{
2024-06-16 02:36:20 +02:00
TRACE("NOT_IMPLEMENTED -> %s(This=%p) [%p]\n", __FUNCTION__, This, _ReturnAddress());
HRESULT ret = DD_OK;
2024-03-22 22:27:00 +01:00
*lplpGDIDDSurface = (LPDIRECTDRAWSURFACE7)g_ddraw.primary;
2021-06-11 20:30:43 +02:00
TRACE("NOT_IMPLEMENTED <- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
2020-10-13 22:55:49 +02:00
HRESULT __stdcall IDirectDraw__GetMonitorFrequency(IDirectDrawImpl* This, LPDWORD lpdwFreq)
2020-10-13 09:20:52 +02:00
{
2024-06-16 02:36:20 +02:00
TRACE("-> %s(This=%p) [%p]\n", __FUNCTION__, This, _ReturnAddress());
2020-10-13 22:55:49 +02:00
HRESULT ret = dd_GetMonitorFrequency(lpdwFreq);
2021-06-11 20:30:43 +02:00
TRACE("<- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
2021-06-11 20:30:43 +02:00
HRESULT __stdcall IDirectDraw__GetScanLine(IDirectDrawImpl* This, LPDWORD lpdwScanLine)
2020-10-13 09:20:52 +02:00
{
2024-06-16 02:36:20 +02:00
TRACE("NOT_IMPLEMENTED -> %s(This=%p) [%p]\n", __FUNCTION__, This, _ReturnAddress());
2021-06-09 01:59:47 +02:00
HRESULT ret = DDERR_UNSUPPORTED;
2021-06-11 20:30:43 +02:00
TRACE("NOT_IMPLEMENTED <- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
HRESULT __stdcall IDirectDraw__GetVerticalBlankStatus(IDirectDrawImpl* This, LPBOOL lpbIsInVB)
{
2024-06-16 02:36:20 +02:00
TRACE("-> %s(This=%p, lpbIsInVB=%p) [%p]\n", __FUNCTION__, This, lpbIsInVB, _ReturnAddress());
2020-10-13 09:20:52 +02:00
HRESULT ret = dd_GetVerticalBlankStatus(lpbIsInVB);
2021-06-11 20:30:43 +02:00
TRACE("<- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
2021-06-11 20:30:43 +02:00
HRESULT __stdcall IDirectDraw__Initialize(IDirectDrawImpl* This, GUID* lpGUID)
2020-10-13 09:20:52 +02:00
{
2024-06-16 02:36:20 +02:00
TRACE("-> %s(This=%p) [%p]\n", __FUNCTION__, This, _ReturnAddress());
2020-10-13 09:20:52 +02:00
HRESULT ret = DD_OK;
TRACE("<- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
HRESULT __stdcall IDirectDraw__RestoreDisplayMode(IDirectDrawImpl* This)
{
2024-06-16 02:36:20 +02:00
TRACE("-> %s(This=%p) [%p]\n", __FUNCTION__, This, _ReturnAddress());
2020-10-13 09:20:52 +02:00
HRESULT ret = dd_RestoreDisplayMode();
2021-06-11 20:30:43 +02:00
TRACE("<- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
HRESULT __stdcall IDirectDraw__SetCooperativeLevel(IDirectDrawImpl* This, HWND hwnd, DWORD dwFlags)
{
2024-06-16 02:36:20 +02:00
TRACE("-> %s(This=%p, hwnd=%p, dwFlags=0x%08X) [%p]\n", __FUNCTION__, This, hwnd, dwFlags, _ReturnAddress());
2020-10-13 09:20:52 +02:00
HRESULT ret = dd_SetCooperativeLevel(hwnd, dwFlags);
2021-06-11 20:30:43 +02:00
TRACE("<- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
2021-06-11 20:30:43 +02:00
HRESULT __stdcall IDirectDraw__SetDisplayMode(IDirectDrawImpl* This, DWORD dwWidth, DWORD dwHeight, DWORD dwBPP)
2020-10-13 09:20:52 +02:00
{
2024-06-16 02:36:20 +02:00
TRACE(
"-> %s(This=%p, dwWidth=%d, dwHeight=%d, dwBPP=%d) [%p]\n",
__FUNCTION__,
This,
dwWidth,
dwHeight,
dwBPP,
_ReturnAddress());
2021-07-03 18:07:38 +02:00
HRESULT ret = dd_SetDisplayMode(dwWidth, dwHeight, dwBPP, SDM_MODE_SET_BY_GAME);
2021-06-11 20:30:43 +02:00
TRACE("<- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
2021-06-11 20:30:43 +02:00
HRESULT __stdcall IDirectDraw__SetDisplayModeX(
IDirectDrawImpl* This,
DWORD dwWidth,
DWORD dwHeight,
DWORD dwBPP,
DWORD dwRefreshRate,
DWORD dwFlags)
{
TRACE(
2024-06-16 02:36:20 +02:00
"-> %s(This=%p, dwWidth=%d, dwHeight=%d, dwBPP=%d, refreshRate=%d, dwFlags=%d) [%p]\n",
2021-06-11 20:30:43 +02:00
__FUNCTION__,
This,
dwWidth,
dwHeight,
dwBPP,
dwRefreshRate,
2024-06-16 02:36:20 +02:00
dwFlags,
_ReturnAddress());
2021-06-11 20:30:43 +02:00
2021-07-03 18:07:38 +02:00
HRESULT ret = dd_SetDisplayMode(dwWidth, dwHeight, dwBPP, SDM_MODE_SET_BY_GAME);
2021-06-11 20:30:43 +02:00
TRACE("<- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
2021-06-11 20:30:43 +02:00
HRESULT __stdcall IDirectDraw__WaitForVerticalBlank(IDirectDrawImpl* This, DWORD dwFlags, HANDLE hEvent)
2020-10-13 09:20:52 +02:00
{
2024-06-16 02:36:20 +02:00
TRACE_EXT("-> %s(This=%p, dwFlags=%08X, hEvent=%p) [%p]\n", __FUNCTION__, This, dwFlags, hEvent, _ReturnAddress());
2021-06-11 20:30:43 +02:00
HRESULT ret = dd_WaitForVerticalBlank(dwFlags, hEvent);
TRACE_EXT("<- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
2021-06-11 20:30:43 +02:00
HRESULT __stdcall IDirectDraw__GetAvailableVidMem(
IDirectDrawImpl* This,
LPDDSCAPS2 lpDDCaps,
LPDWORD lpdwTotal,
LPDWORD lpdwFree)
2020-10-13 09:20:52 +02:00
{
2021-06-11 20:30:43 +02:00
TRACE(
2024-06-16 02:36:20 +02:00
"-> %s(This=%p, lpDDCaps=%p, lpdwTotal=%p, lpdwFree=%p) [%p]\n",
2021-06-11 20:30:43 +02:00
__FUNCTION__,
This,
lpDDCaps,
lpdwTotal,
2024-06-16 02:36:20 +02:00
lpdwFree,
_ReturnAddress());
2021-06-11 20:30:43 +02:00
HRESULT ret = dd_GetAvailableVidMem((LPDDSCAPS)lpDDCaps, lpdwTotal, lpdwFree);
2021-06-11 20:30:43 +02:00
TRACE("<- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
2021-06-11 20:30:43 +02:00
HRESULT __stdcall IDirectDraw__GetSurfaceFromDC(IDirectDrawImpl* This, HDC hdc, LPDIRECTDRAWSURFACE7* lplpDDSurface)
2020-10-13 09:20:52 +02:00
{
2024-06-16 02:36:20 +02:00
TRACE("NOT_IMPLEMENTED -> %s(This=%p) [%p]\n", __FUNCTION__, This, _ReturnAddress());
2021-06-11 20:30:43 +02:00
HRESULT ret = DDERR_NOTFOUND;
TRACE("NOT_IMPLEMENTED <- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
HRESULT __stdcall IDirectDraw__RestoreAllSurfaces(IDirectDrawImpl* This)
{
2024-06-16 02:36:20 +02:00
TRACE("-> %s(This=%p) [%p]\n", __FUNCTION__, This, _ReturnAddress());
HRESULT ret = DD_OK;
2021-06-15 09:41:17 +02:00
TRACE("<- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
HRESULT __stdcall IDirectDraw__TestCooperativeLevel(IDirectDrawImpl* This)
{
2024-06-16 02:36:20 +02:00
TRACE_EXT("-> %s(This=%p) [%p]\n", __FUNCTION__, This, _ReturnAddress());
HRESULT ret = dd_TestCooperativeLevel();
2021-06-11 20:30:43 +02:00
TRACE_EXT("<- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
2021-06-11 20:30:43 +02:00
HRESULT __stdcall IDirectDraw__GetDeviceIdentifier(IDirectDrawImpl* This, LPDDDEVICEIDENTIFIER2 pDDDI, DWORD dwFlags)
2020-10-13 09:20:52 +02:00
{
2024-06-16 02:36:20 +02:00
TRACE("-> %s(This=%p, pDDDI=%p, dwFlags=%08X) [%p]\n", __FUNCTION__, This, pDDDI, dwFlags, _ReturnAddress());
2021-09-02 22:22:48 +02:00
HRESULT ret = dd_GetDeviceIdentifier((LPDDDEVICEIDENTIFIER)pDDDI, dwFlags, &This->guid);
2023-08-10 14:41:42 +02:00
TRACE("<- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
HRESULT __stdcall IDirectDraw__StartModeTest(IDirectDrawImpl* This, LPSIZE pModes, DWORD dwNumModes, DWORD dwFlags)
{
2024-06-16 02:36:20 +02:00
TRACE("NOT_IMPLEMENTED -> %s(This=%p) [%p]\n", __FUNCTION__, This, _ReturnAddress());
2020-10-13 09:20:52 +02:00
HRESULT ret = DDERR_CURRENTLYNOTAVAIL;
2021-06-11 20:30:43 +02:00
TRACE("NOT_IMPLEMENTED <- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
HRESULT __stdcall IDirectDraw__EvaluateMode(IDirectDrawImpl* This, DWORD dwFlags, DWORD* pTimeout)
{
2024-06-16 02:36:20 +02:00
TRACE("NOT_IMPLEMENTED -> %s(This=%p) [%p]\n", __FUNCTION__, This, _ReturnAddress());
2020-10-13 09:20:52 +02:00
HRESULT ret = DDERR_INVALIDOBJECT;
2021-06-11 20:30:43 +02:00
TRACE("NOT_IMPLEMENTED <- %s\n", __FUNCTION__);
2020-10-13 09:20:52 +02:00
return ret;
}
struct IDirectDrawImplVtbl g_dd_vtbl1 =
{
2021-06-11 20:30:43 +02:00
/*** IUnknown methods ***/
2020-10-13 09:20:52 +02:00
IDirectDraw__QueryInterface,
IDirectDraw__AddRef,
IDirectDraw__Release,
2021-06-11 20:30:43 +02:00
/*** IDirectDraw methods ***/
2020-10-13 09:20:52 +02:00
IDirectDraw__Compact,
IDirectDraw__CreateClipper,
IDirectDraw__CreatePalette,
IDirectDraw__CreateSurface,
IDirectDraw__DuplicateSurface,
IDirectDraw__EnumDisplayModes,
IDirectDraw__EnumSurfaces,
IDirectDraw__FlipToGDISurface,
IDirectDraw__GetCaps,
IDirectDraw__GetDisplayMode,
IDirectDraw__GetFourCCCodes,
IDirectDraw__GetGDISurface,
IDirectDraw__GetMonitorFrequency,
IDirectDraw__GetScanLine,
IDirectDraw__GetVerticalBlankStatus,
IDirectDraw__Initialize,
IDirectDraw__RestoreDisplayMode,
IDirectDraw__SetCooperativeLevel,
{IDirectDraw__SetDisplayMode},
IDirectDraw__WaitForVerticalBlank,
2021-06-11 20:30:43 +02:00
/*** Added in the v2 Interface ***/
2020-10-13 09:20:52 +02:00
IDirectDraw__GetAvailableVidMem,
2021-06-11 20:30:43 +02:00
/*** Added in the v4 Interface ***/
2020-10-13 09:20:52 +02:00
IDirectDraw__GetSurfaceFromDC,
IDirectDraw__RestoreAllSurfaces,
IDirectDraw__TestCooperativeLevel,
IDirectDraw__GetDeviceIdentifier,
2021-06-11 20:30:43 +02:00
/*** Added in the v7 Interface ***/
2020-10-13 09:20:52 +02:00
IDirectDraw__StartModeTest,
IDirectDraw__EvaluateMode,
};
struct IDirectDrawImplVtbl g_dd_vtblx =
{
2021-06-11 20:30:43 +02:00
/*** IUnknown methods ***/
2020-10-13 09:20:52 +02:00
IDirectDraw__QueryInterface,
IDirectDraw__AddRef,
IDirectDraw__Release,
2021-06-11 20:30:43 +02:00
/*** IDirectDraw methods ***/
2020-10-13 09:20:52 +02:00
IDirectDraw__Compact,
IDirectDraw__CreateClipper,
IDirectDraw__CreatePalette,
IDirectDraw__CreateSurface,
IDirectDraw__DuplicateSurface,
IDirectDraw__EnumDisplayModes,
IDirectDraw__EnumSurfaces,
IDirectDraw__FlipToGDISurface,
IDirectDraw__GetCaps,
IDirectDraw__GetDisplayMode,
IDirectDraw__GetFourCCCodes,
IDirectDraw__GetGDISurface,
IDirectDraw__GetMonitorFrequency,
IDirectDraw__GetScanLine,
IDirectDraw__GetVerticalBlankStatus,
IDirectDraw__Initialize,
IDirectDraw__RestoreDisplayMode,
IDirectDraw__SetCooperativeLevel,
{IDirectDraw__SetDisplayModeX},
IDirectDraw__WaitForVerticalBlank,
2021-06-11 20:30:43 +02:00
/*** Added in the v2 interface ***/
2020-10-13 09:20:52 +02:00
IDirectDraw__GetAvailableVidMem,
2021-06-11 20:30:43 +02:00
/*** Added in the v4 Interface ***/
2020-10-13 09:20:52 +02:00
IDirectDraw__GetSurfaceFromDC,
IDirectDraw__RestoreAllSurfaces,
IDirectDraw__TestCooperativeLevel,
IDirectDraw__GetDeviceIdentifier,
2021-06-11 20:30:43 +02:00
/*** Added in the v7 Interface ***/
2020-10-13 09:20:52 +02:00
IDirectDraw__StartModeTest,
IDirectDraw__EvaluateMode,
};