1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-24 17:49:52 +01:00

Reworked clipper and implemented all remaining stubs

This commit is contained in:
Toni Spets 2010-10-23 20:25:51 +03:00
parent b77d441bee
commit 7bb1168a90
3 changed files with 68 additions and 45 deletions

View File

@ -18,19 +18,14 @@
#include <stdio.h> #include <stdio.h>
#include "clipper.h" #include "clipper.h"
/* from main */ HRESULT __stdcall ddraw_clipper_QueryInterface(IDirectDrawClipperImpl *This, REFIID riid, void **obj)
HRESULT null();
HRESULT ddraw_clipper_QueryInterface(void *This, REFIID riid, void **obj)
{ {
printf("DirectDrawClipper::QueryInterface(This=%p, riid=%08X, obj=%p)\n", This, (unsigned int)riid, obj); printf("DirectDrawClipper::QueryInterface(This=%p, riid=%08X, obj=%p)\n", This, (unsigned int)riid, obj);
return S_OK; return S_OK;
} }
ULONG ddraw_clipper_AddRef(void *_This) ULONG __stdcall ddraw_clipper_AddRef(IDirectDrawClipperImpl *This)
{ {
fakeDirectDrawClipperObject *This = (fakeDirectDrawClipperObject *)_This;
printf("DirectDrawClipper::AddRef(This=%p)\n", This); printf("DirectDrawClipper::AddRef(This=%p)\n", This);
This->Ref++; This->Ref++;
@ -38,10 +33,8 @@ ULONG ddraw_clipper_AddRef(void *_This)
return This->Ref; return This->Ref;
} }
ULONG ddraw_clipper_Release(void *_This) ULONG __stdcall ddraw_clipper_Release(IDirectDrawClipperImpl *This)
{ {
fakeDirectDrawClipperObject *This = (fakeDirectDrawClipperObject *)_This;
printf("DirectDrawClipper::Release(This=%p)\n", This); printf("DirectDrawClipper::Release(This=%p)\n", This);
This->Ref--; This->Ref--;
@ -55,27 +48,63 @@ ULONG ddraw_clipper_Release(void *_This)
return This->Ref; return This->Ref;
} }
fakeDirectDrawClipper ciface = HRESULT __stdcall ddraw_clipper_GetClipList(IDirectDrawClipperImpl *This, LPRECT a, LPRGNDATA b, LPDWORD c)
{
printf("IDirectDrawClipper::GetClipList(This=%p, ...)\n", This);
return DD_OK;
}
HRESULT __stdcall ddraw_clipper_GetHWnd(IDirectDrawClipperImpl *This, HWND FAR *a)
{
printf("IDirectDrawClipper::GetHWnd(This=%p, ...)\n", This);
return DD_OK;
}
HRESULT __stdcall ddraw_clipper_Initialize(IDirectDrawClipperImpl *This, LPDIRECTDRAW a, DWORD b)
{
printf("IDirectDrawClipper::Initialize(This=%p, ...)\n", This);
return DD_OK;
}
HRESULT __stdcall ddraw_clipper_IsClipListChanged(IDirectDrawClipperImpl *This, BOOL FAR *a)
{
printf("IDirectDrawClipper::IsClipListChanged(This=%p, ...)\n", This);
return DD_OK;
}
HRESULT __stdcall ddraw_clipper_SetClipList(IDirectDrawClipperImpl *This, LPRGNDATA a, DWORD b)
{
printf("IDirectDrawClipper::SetClipList(This=%p, ...)\n", This);
return DD_OK;
}
HRESULT __stdcall ddraw_clipper_SetHWnd(IDirectDrawClipperImpl *This, DWORD a, HWND b)
{
printf("IDirectDrawClipper::SetHWnd(This=%p, ...)\n", This);
return DD_OK;
}
struct IDirectDrawClipperImplVtbl ciface =
{ {
/* IUnknown */ /* IUnknown */
ddraw_clipper_QueryInterface, ddraw_clipper_QueryInterface,
ddraw_clipper_AddRef, ddraw_clipper_AddRef,
ddraw_clipper_Release, ddraw_clipper_Release,
/* IDirectDrawClipper */ /* IDirectDrawClipper */
null, // ddraw_clipper_GetClipList ddraw_clipper_GetClipList,
null, // ddraw_clipper_GetHWnd ddraw_clipper_GetHWnd,
null, // ddraw_clipper_Initialize ddraw_clipper_Initialize,
null, // ddraw_clipper_IsClipListChanged ddraw_clipper_IsClipListChanged,
null, // ddraw_clipper_SetClipList ddraw_clipper_SetClipList,
null // ddraw_clipper_SetHwnd ddraw_clipper_SetHWnd
}; };
HRESULT __stdcall ddraw_CreateClipper(IDirectDrawImpl *This, DWORD dwFlags, LPDIRECTDRAWCLIPPER FAR *lplpDDClipper, IUnknown FAR *pUnkOuter ) HRESULT __stdcall ddraw_CreateClipper(IDirectDrawImpl *This, DWORD dwFlags, LPDIRECTDRAWCLIPPER FAR *lplpDDClipper, IUnknown FAR *pUnkOuter )
{ {
printf("DirectDraw::CreateClipper(This=%p, dwFlags=%d, DDClipper=%p, unkOuter=%p)\n", This, (int)dwFlags, lplpDDClipper, pUnkOuter); printf("DirectDraw::CreateClipper(This=%p, dwFlags=%d, DDClipper=%p, unkOuter=%p)\n", This, (int)dwFlags, lplpDDClipper, pUnkOuter);
fakeDirectDrawClipperObject *Clipper = (fakeDirectDrawClipperObject *)malloc(sizeof(fakeDirectDrawClipperObject)); IDirectDrawClipperImpl *Clipper = (IDirectDrawClipperImpl *)HeapAlloc(GetProcessHeap(), 0, sizeof(IDirectDrawClipperImpl));
Clipper->Functions = &ciface; Clipper->lpVtbl = &ciface;
printf(" Clipper = %p\n", Clipper); printf(" Clipper = %p\n", Clipper);
*lplpDDClipper = (LPDIRECTDRAWCLIPPER)Clipper; *lplpDDClipper = (LPDIRECTDRAWCLIPPER)Clipper;

View File

@ -21,32 +21,33 @@
#include "ddraw.h" #include "ddraw.h"
#include "main.h" #include "main.h"
typedef struct HRESULT __stdcall ddraw_CreateClipper(IDirectDrawImpl *This, DWORD dwFlags, LPDIRECTDRAWCLIPPER FAR *lplpDDClipper, IUnknown FAR *pUnkOuter );
{
/* IUnknown */
HRESULT (*QueryInterface)(void *, REFIID, void **);
ULONG (*AddRef)(void *);
ULONG (*Release)(void *);
/* IDirectDrawClipper */ struct IDirectDrawClipperImpl;
HRESULT (*GetClipList)(void *, LPRECT, LPRGNDATA, LPDWORD); struct IDirectDrawClipperImplVtbl;
HRESULT (*GetHWnd)(void *, HWND FAR *);
HRESULT (*Initialize)(void *, LPDIRECTDRAW, DWORD);
HRESULT (*IsClipListChanged)(void *, BOOL FAR *);
HRESULT (*SetClipList)(void *, LPRGNDATA,DWORD);
HRESULT (*SetHWnd)(void *, DWORD, HWND );
} fakeDirectDrawClipper;
typedef struct typedef struct IDirectDrawClipperImpl
{ {
fakeDirectDrawClipper *Functions; struct IDirectDrawClipperImplVtbl *lpVtbl;
ULONG Ref; ULONG Ref;
} fakeDirectDrawClipperObject; } IDirectDrawClipperImpl;
extern fakeDirectDrawClipper ciface; struct IDirectDrawClipperImplVtbl
{
/* IUnknown */
HRESULT __stdcall (*QueryInterface)(IDirectDrawClipperImpl *, REFIID, void **);
ULONG __stdcall (*AddRef)(IDirectDrawClipperImpl *);
ULONG __stdcall (*Release)(IDirectDrawClipperImpl *);
HRESULT __stdcall ddraw_CreateClipper(IDirectDrawImpl *This, DWORD dwFlags, LPDIRECTDRAWCLIPPER FAR *lplpDDClipper, IUnknown FAR *pUnkOuter ); /* IDirectDrawClipper */
HRESULT __stdcall (*GetClipList)(IDirectDrawClipperImpl *, LPRECT, LPRGNDATA, LPDWORD);
HRESULT __stdcall (*GetHWnd)(IDirectDrawClipperImpl *, HWND FAR *);
HRESULT __stdcall (*Initialize)(IDirectDrawClipperImpl *, LPDIRECTDRAW, DWORD);
HRESULT __stdcall (*IsClipListChanged)(IDirectDrawClipperImpl *, BOOL FAR *);
HRESULT __stdcall (*SetClipList)(IDirectDrawClipperImpl *, LPRGNDATA,DWORD);
HRESULT __stdcall (*SetHWnd)(IDirectDrawClipperImpl *, DWORD, HWND );
} IDirectDrawClipperImplVtbl;
#endif #endif

7
main.c
View File

@ -209,13 +209,6 @@ ULONG __stdcall ddraw_Release(IDirectDrawImpl *This)
return This->Ref; return This->Ref;
} }
HRESULT __stdcall null(void *This)
{
printf("Warning: null method called for instance %p!\n", This);
fflush(NULL);
return DDERR_UNSUPPORTED;
}
struct IDirectDrawImplVtbl iface = struct IDirectDrawImplVtbl iface =
{ {
/* IUnknown */ /* IUnknown */