mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-25 01:57:47 +01:00
Implement palette and surface with null methods
This commit is contained in:
parent
53137e4d8d
commit
f10aad6ffb
18
main.c
18
main.c
@ -62,12 +62,26 @@ typedef struct
|
|||||||
HRESULT ddraw_CreatePalette(void *This, LPPALETTEENTRY DDColorArray, LPDIRECTDRAWPALETTE FAR * DDPalette, IUnknown FAR * unkOuter)
|
HRESULT ddraw_CreatePalette(void *This, LPPALETTEENTRY DDColorArray, LPDIRECTDRAWPALETTE FAR * DDPalette, IUnknown FAR * unkOuter)
|
||||||
{
|
{
|
||||||
printf("DirectDraw::CreatePalette(This=%p, DDColorArray=%p, DDPalette=%p, unkOuter=%p)\n", This, DDColorArray, DDPalette, unkOuter);
|
printf("DirectDraw::CreatePalette(This=%p, DDColorArray=%p, DDPalette=%p, unkOuter=%p)\n", This, DDColorArray, DDPalette, unkOuter);
|
||||||
|
|
||||||
|
fakeDirectDrawPaletteObject *Palette = (fakeDirectDrawPaletteObject *)malloc(sizeof(fakeDirectDrawPaletteObject));
|
||||||
|
Palette->Ref = 1;
|
||||||
|
Palette->Functions = &piface;
|
||||||
|
printf(" Palette = %p\n", Palette);
|
||||||
|
*DDPalette = (LPDIRECTDRAWPALETTE)Palette;
|
||||||
|
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT ddraw_CreateSurface(void *This, LPDDSURFACEDESC DDSurfaceDesc, LPDIRECTDRAWSURFACE FAR *DDSurface, IUnknown FAR * unkOuter)
|
HRESULT ddraw_CreateSurface(void *This, LPDDSURFACEDESC DDSurfaceDesc, LPDIRECTDRAWSURFACE FAR *DDSurface, IUnknown FAR * unkOuter)
|
||||||
{
|
{
|
||||||
printf("DirectDraw::CreateSurface(This=%p, DDSurfaceDesc=%p, DDSurface=%p, unkOuter=%p)\n", This, DDSurfaceDesc, DDSurface, unkOuter);
|
printf("DirectDraw::CreateSurface(This=%p, DDSurfaceDesc=%p, DDSurface=%p, unkOuter=%p)\n", This, DDSurfaceDesc, DDSurface, unkOuter);
|
||||||
|
|
||||||
|
fakeDirectDrawSurfaceObject *Surface = (fakeDirectDrawSurfaceObject *)malloc(sizeof(fakeDirectDrawSurfaceObject));
|
||||||
|
Surface->Ref = 1;
|
||||||
|
Surface->Functions = &siface;
|
||||||
|
printf(" Surface = %p\n", Surface);
|
||||||
|
*DDSurface = (LPDIRECTDRAWSURFACE)Surface;
|
||||||
|
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,9 +125,9 @@ ULONG Release(void *This)
|
|||||||
return ((fakeDirectDrawObject *)This)->Ref;
|
return ((fakeDirectDrawObject *)This)->Ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT null()
|
HRESULT null(void *This)
|
||||||
{
|
{
|
||||||
printf("Warning: null method called!\n");
|
printf("Warning: null method called for instance %p!\n", This);
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
19
palette.c
19
palette.c
@ -16,3 +16,22 @@
|
|||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include "palette.h"
|
#include "palette.h"
|
||||||
|
|
||||||
|
/* from main */
|
||||||
|
HRESULT QueryInterface(void *This, REFIID riid, void **obj);
|
||||||
|
ULONG AddRef(void *This);
|
||||||
|
ULONG Release(void *This);
|
||||||
|
HRESULT null();
|
||||||
|
|
||||||
|
fakeDirectDrawPalette piface =
|
||||||
|
{
|
||||||
|
/* IUnknown */
|
||||||
|
QueryInterface,
|
||||||
|
AddRef,
|
||||||
|
Release,
|
||||||
|
/* IDirectDrawPalette */
|
||||||
|
null, // ddraw_palette_GetCaps
|
||||||
|
null, // ddraw_palette_GetEntries
|
||||||
|
null, // ddraw_palette_Initialize
|
||||||
|
null // ddraw_palette_SetEntries
|
||||||
|
};
|
||||||
|
@ -42,4 +42,6 @@ typedef struct
|
|||||||
|
|
||||||
} fakeDirectDrawPaletteObject;
|
} fakeDirectDrawPaletteObject;
|
||||||
|
|
||||||
|
extern fakeDirectDrawPalette piface;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
48
surface.c
48
surface.c
@ -16,3 +16,51 @@
|
|||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include "surface.h"
|
#include "surface.h"
|
||||||
|
|
||||||
|
/* from main */
|
||||||
|
HRESULT QueryInterface(void *This, REFIID riid, void **obj);
|
||||||
|
ULONG AddRef(void *This);
|
||||||
|
ULONG Release(void *This);
|
||||||
|
HRESULT null();
|
||||||
|
|
||||||
|
fakeDirectDrawSurface siface =
|
||||||
|
{
|
||||||
|
/* IUnknown */
|
||||||
|
QueryInterface,
|
||||||
|
AddRef,
|
||||||
|
Release,
|
||||||
|
/* IDirectDrawSurface */
|
||||||
|
null, // AddAttachedSurface
|
||||||
|
null, // AddOverlayDirtyRect
|
||||||
|
null, // Blt
|
||||||
|
null, // BltBatch
|
||||||
|
null, // BltFast
|
||||||
|
null, // DeleteAttachedSurface
|
||||||
|
null, // EnumAttachedSurfaces
|
||||||
|
null, // EnumOverlayZOrders
|
||||||
|
null, // Flip
|
||||||
|
null, // GetAttachedSurface
|
||||||
|
null, // GetBltStatus
|
||||||
|
null, // GetCaps
|
||||||
|
null, // GetClipper
|
||||||
|
null, // GetColorKey
|
||||||
|
null, // GetDC
|
||||||
|
null, // GetFlipStatus
|
||||||
|
null, // GetOverlayPosition
|
||||||
|
null, // GetPalette
|
||||||
|
null, // GetPixelFormat
|
||||||
|
null, // GetSurfaceDesc
|
||||||
|
null, // Initialize
|
||||||
|
null, // IsLost
|
||||||
|
null, // Lock
|
||||||
|
null, // ReleaseDC
|
||||||
|
null, // Restore
|
||||||
|
null, // SetClipper
|
||||||
|
null, // SetColorKey
|
||||||
|
null, // SetOverlayPosition
|
||||||
|
null, // SetPalette
|
||||||
|
null, // Unlock
|
||||||
|
null, // UpdateOverlay
|
||||||
|
null, // UpdateOverlayDisplay
|
||||||
|
null // UpdateOverlayZOrder
|
||||||
|
};
|
||||||
|
38
surface.h
38
surface.h
@ -28,8 +28,44 @@ typedef struct
|
|||||||
ULONG (*Release)(void *);
|
ULONG (*Release)(void *);
|
||||||
|
|
||||||
/* IDirectDrawSurface */
|
/* IDirectDrawSurface */
|
||||||
|
HRESULT (*AddAttachedSurface)(void *, LPDIRECTDRAWSURFACE);
|
||||||
|
HRESULT (*AddOverlayDirtyRect)(void *, LPRECT);
|
||||||
|
HRESULT (*Blt)(void *, LPRECT,LPDIRECTDRAWSURFACE, LPRECT,DWORD, LPDDBLTFX);
|
||||||
|
HRESULT (*BltBatch)(void *, LPDDBLTBATCH, DWORD, DWORD );
|
||||||
|
HRESULT (*BltFast)(void *, DWORD,DWORD,LPDIRECTDRAWSURFACE, LPRECT,DWORD);
|
||||||
|
HRESULT (*DeleteAttachedSurface)(void *, DWORD,LPDIRECTDRAWSURFACE);
|
||||||
|
HRESULT (*EnumAttachedSurfaces)(void *, LPVOID,LPDDENUMSURFACESCALLBACK);
|
||||||
|
HRESULT (*EnumOverlayZOrders)(void *, DWORD,LPVOID,LPDDENUMSURFACESCALLBACK);
|
||||||
|
HRESULT (*Flip)(void *, LPDIRECTDRAWSURFACE, DWORD);
|
||||||
|
HRESULT (*GetAttachedSurface)(void *, LPDDSCAPS, LPDIRECTDRAWSURFACE FAR *);
|
||||||
|
HRESULT (*GetBltStatus)(void *, DWORD);
|
||||||
|
HRESULT (*GetCaps)(void *, LPDDSCAPS);
|
||||||
|
HRESULT (*GetClipper)(void *, LPDIRECTDRAWCLIPPER FAR*);
|
||||||
|
HRESULT (*GetColorKey)(void *, DWORD, LPDDCOLORKEY);
|
||||||
|
HRESULT (*GetDC)(void *, HDC FAR *);
|
||||||
|
HRESULT (*GetFlipStatus)(void *, DWORD);
|
||||||
|
HRESULT (*GetOverlayPosition)(void *, LPLONG, LPLONG );
|
||||||
|
HRESULT (*GetPalette)(void *, LPDIRECTDRAWPALETTE FAR*);
|
||||||
|
HRESULT (*GetPixelFormat)(void *, LPDDPIXELFORMAT);
|
||||||
|
HRESULT (*GetSurfaceDesc)(void *, LPDDSURFACEDESC);
|
||||||
|
HRESULT (*Initialize)(void *, LPDIRECTDRAW, LPDDSURFACEDESC);
|
||||||
|
HRESULT (*IsLost)(void *);
|
||||||
|
HRESULT (*Lock)(void *, LPRECT,LPDDSURFACEDESC,DWORD,HANDLE);
|
||||||
|
HRESULT (*ReleaseDC)(void *, HDC);
|
||||||
|
HRESULT (*Restore)(void *);
|
||||||
|
HRESULT (*SetClipper)(void *, LPDIRECTDRAWCLIPPER);
|
||||||
|
HRESULT (*SetColorKey)(void *, DWORD, LPDDCOLORKEY);
|
||||||
|
HRESULT (*SetOverlayPosition)(void *, LONG, LONG );
|
||||||
|
HRESULT (*SetPalette)(void *, LPDIRECTDRAWPALETTE);
|
||||||
|
HRESULT (*Unlock)(void *, LPVOID);
|
||||||
|
HRESULT (*UpdateOverlay)(void *, LPRECT, LPDIRECTDRAWSURFACE,LPRECT,DWORD, LPDDOVERLAYFX);
|
||||||
|
HRESULT (*UpdateOverlayDisplay)(void *, DWORD);
|
||||||
|
HRESULT (*UpdateOverlayZOrder)(void *, DWORD, LPDIRECTDRAWSURFACE);
|
||||||
} fakeDirectDrawSurface;
|
} fakeDirectDrawSurface;
|
||||||
|
|
||||||
|
/*
|
||||||
|
*/
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
fakeDirectDrawSurface *Functions;
|
fakeDirectDrawSurface *Functions;
|
||||||
@ -38,4 +74,6 @@ typedef struct
|
|||||||
|
|
||||||
} fakeDirectDrawSurfaceObject;
|
} fakeDirectDrawSurfaceObject;
|
||||||
|
|
||||||
|
extern fakeDirectDrawSurface siface;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user