mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-25 01:57:47 +01:00
Implement stub clipper
This commit is contained in:
parent
5669fe3380
commit
b43517cb11
2
Makefile
2
Makefile
@ -1,5 +1,5 @@
|
|||||||
all:
|
all:
|
||||||
i586-mingw32msvc-gcc -Wall -Wl,--enable-stdcall-fixup -shared -s -o ddraw.dll main.c palette.c surface.c ddraw.def -lgdi32 -lopengl32
|
i586-mingw32msvc-gcc -D_DEBUG -Wall -Wl,--enable-stdcall-fixup -shared -s -o ddraw.dll main.c palette.c surface.c clipper.c ddraw.def -lgdi32 -lopengl32
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f ddraw.dll
|
rm -f ddraw.dll
|
||||||
|
88
clipper.c
Normal file
88
clipper.c
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2010 Toni Spets <toni.spets@iki.fi>
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "clipper.h"
|
||||||
|
|
||||||
|
/* from main */
|
||||||
|
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);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG ddraw_clipper_AddRef(void *_This)
|
||||||
|
{
|
||||||
|
fakeDirectDrawClipperObject *This = (fakeDirectDrawClipperObject *)_This;
|
||||||
|
|
||||||
|
printf("DirectDrawClipper::AddRef(This=%p)\n", This);
|
||||||
|
|
||||||
|
This->Ref++;
|
||||||
|
|
||||||
|
return This->Ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG ddraw_clipper_Release(void *_This)
|
||||||
|
{
|
||||||
|
fakeDirectDrawClipperObject *This = (fakeDirectDrawClipperObject *)_This;
|
||||||
|
|
||||||
|
printf("DirectDrawClipper::Release(This=%p)\n", This);
|
||||||
|
|
||||||
|
This->Ref--;
|
||||||
|
|
||||||
|
if(This->Ref == 0)
|
||||||
|
{
|
||||||
|
free(This);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return This->Ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
fakeDirectDrawClipper 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
|
||||||
|
};
|
||||||
|
|
||||||
|
HRESULT ddraw_CreateClipper(void *_This, DWORD dwFlags, LPDIRECTDRAWCLIPPER FAR *lplpDDClipper, IUnknown FAR *pUnkOuter )
|
||||||
|
{
|
||||||
|
fakeDirectDrawClipperObject *This = (fakeDirectDrawClipperObject *)_This;
|
||||||
|
|
||||||
|
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;
|
||||||
|
printf(" Clipper = %p\n", Clipper);
|
||||||
|
*lplpDDClipper = (LPDIRECTDRAWCLIPPER)Clipper;
|
||||||
|
|
||||||
|
Clipper->Ref = 0;
|
||||||
|
ddraw_clipper_AddRef(Clipper);
|
||||||
|
|
||||||
|
return DD_OK;
|
||||||
|
}
|
51
clipper.h
Normal file
51
clipper.h
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2010 Toni Spets <toni.spets@iki.fi>
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CLIPPER_H
|
||||||
|
#define CLIPPER_H
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include "ddraw.h"
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
/* IUnknown */
|
||||||
|
HRESULT (*QueryInterface)(void *, REFIID, void **);
|
||||||
|
ULONG (*AddRef)(void *);
|
||||||
|
ULONG (*Release)(void *);
|
||||||
|
|
||||||
|
/* 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;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
fakeDirectDrawClipper *Functions;
|
||||||
|
|
||||||
|
ULONG Ref;
|
||||||
|
|
||||||
|
} fakeDirectDrawClipperObject;
|
||||||
|
|
||||||
|
extern fakeDirectDrawClipper ciface;
|
||||||
|
|
||||||
|
HRESULT ddraw_CreateClipper(void *_This, DWORD dwFlags, LPDIRECTDRAWCLIPPER FAR *lplpDDClipper, IUnknown FAR *pUnkOuter );
|
||||||
|
|
||||||
|
#endif
|
7
main.c
7
main.c
@ -21,6 +21,7 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "palette.h"
|
#include "palette.h"
|
||||||
#include "surface.h"
|
#include "surface.h"
|
||||||
|
#include "clipper.h"
|
||||||
|
|
||||||
HRESULT ddraw_GetCaps(void *This, LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDEmulCaps)
|
HRESULT ddraw_GetCaps(void *This, LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDEmulCaps)
|
||||||
{
|
{
|
||||||
@ -131,7 +132,7 @@ fakeDirectDraw iface =
|
|||||||
ddraw_Release,
|
ddraw_Release,
|
||||||
/* IDirectDraw */
|
/* IDirectDraw */
|
||||||
null, //Compact,
|
null, //Compact,
|
||||||
null, //CreateClipper,
|
ddraw_CreateClipper,
|
||||||
ddraw_CreatePalette,
|
ddraw_CreatePalette,
|
||||||
ddraw_CreateSurface,
|
ddraw_CreateSurface,
|
||||||
null, //DuplicateSurface,
|
null, //DuplicateSurface,
|
||||||
@ -154,6 +155,10 @@ fakeDirectDraw iface =
|
|||||||
|
|
||||||
HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnknown FAR* pUnkOuter)
|
HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnknown FAR* pUnkOuter)
|
||||||
{
|
{
|
||||||
|
#if _DEBUG
|
||||||
|
freopen("stdout.txt", "w", stdout);
|
||||||
|
#endif
|
||||||
|
|
||||||
printf("DirectDrawCreate(lpGUID=%p, lplpDD=%p, pUnkOuter=%p)\n", lpGUID, lplpDD, pUnkOuter);
|
printf("DirectDrawCreate(lpGUID=%p, lplpDD=%p, pUnkOuter=%p)\n", lpGUID, lplpDD, pUnkOuter);
|
||||||
|
|
||||||
fakeDirectDrawObject *This = (fakeDirectDrawObject *)malloc(sizeof(fakeDirectDrawObject));
|
fakeDirectDrawObject *This = (fakeDirectDrawObject *)malloc(sizeof(fakeDirectDrawObject));
|
||||||
|
2
main.h
2
main.h
@ -31,7 +31,7 @@ typedef struct
|
|||||||
|
|
||||||
/* IDirectDraw */
|
/* IDirectDraw */
|
||||||
HRESULT (*Compact)(void *);
|
HRESULT (*Compact)(void *);
|
||||||
HRESULT (*CreateClipper)(void *);
|
HRESULT (*CreateClipper)(void *, DWORD, LPDIRECTDRAWCLIPPER FAR *, IUnknown FAR *);
|
||||||
HRESULT (*CreatePalette)(void *, DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR *, IUnknown FAR *);
|
HRESULT (*CreatePalette)(void *, DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR *, IUnknown FAR *);
|
||||||
HRESULT (*CreateSurface)(void *, LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *);
|
HRESULT (*CreateSurface)(void *, LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *);
|
||||||
HRESULT (*DuplicateSurface)(void *);
|
HRESULT (*DuplicateSurface)(void *);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user