1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-15 06:04:49 +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 "clipper.h"
/* from main */
HRESULT null();
HRESULT ddraw_clipper_QueryInterface(void *This, REFIID riid, void **obj)
HRESULT __stdcall ddraw_clipper_QueryInterface(IDirectDrawClipperImpl *This, REFIID riid, void **obj)
{
printf("DirectDrawClipper::QueryInterface(This=%p, riid=%08X, obj=%p)\n", This, (unsigned int)riid, obj);
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);
This->Ref++;
@ -38,10 +33,8 @@ ULONG ddraw_clipper_AddRef(void *_This)
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);
This->Ref--;
@ -55,27 +48,63 @@ ULONG ddraw_clipper_Release(void *_This)
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 */
ddraw_clipper_QueryInterface,
ddraw_clipper_AddRef,
ddraw_clipper_Release,
/* IDirectDrawClipper */
null, // ddraw_clipper_GetClipList
null, // ddraw_clipper_GetHWnd
null, // ddraw_clipper_Initialize
null, // ddraw_clipper_IsClipListChanged
null, // ddraw_clipper_SetClipList
null // ddraw_clipper_SetHwnd
ddraw_clipper_GetClipList,
ddraw_clipper_GetHWnd,
ddraw_clipper_Initialize,
ddraw_clipper_IsClipListChanged,
ddraw_clipper_SetClipList,
ddraw_clipper_SetHWnd
};
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);
fakeDirectDrawClipperObject *Clipper = (fakeDirectDrawClipperObject *)malloc(sizeof(fakeDirectDrawClipperObject));
Clipper->Functions = &ciface;
IDirectDrawClipperImpl *Clipper = (IDirectDrawClipperImpl *)HeapAlloc(GetProcessHeap(), 0, sizeof(IDirectDrawClipperImpl));
Clipper->lpVtbl = &ciface;
printf(" Clipper = %p\n", Clipper);
*lplpDDClipper = (LPDIRECTDRAWCLIPPER)Clipper;

View File

@ -21,32 +21,33 @@
#include "ddraw.h"
#include "main.h"
typedef struct
{
/* IUnknown */
HRESULT (*QueryInterface)(void *, REFIID, void **);
ULONG (*AddRef)(void *);
ULONG (*Release)(void *);
HRESULT __stdcall ddraw_CreateClipper(IDirectDrawImpl *This, DWORD dwFlags, LPDIRECTDRAWCLIPPER FAR *lplpDDClipper, IUnknown FAR *pUnkOuter );
/* IDirectDrawClipper */
HRESULT (*GetClipList)(void *, LPRECT, LPRGNDATA, LPDWORD);
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;
struct IDirectDrawClipperImpl;
struct IDirectDrawClipperImplVtbl;
typedef struct
typedef struct IDirectDrawClipperImpl
{
fakeDirectDrawClipper *Functions;
struct IDirectDrawClipperImplVtbl *lpVtbl;
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

7
main.c
View File

@ -209,13 +209,6 @@ ULONG __stdcall ddraw_Release(IDirectDrawImpl *This)
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 =
{
/* IUnknown */