mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-14 22:03:27 +01:00
Implement GetCaps for ddraw and surface, GetPalette and SetPalette for surface
This commit is contained in:
parent
4ffda7b73f
commit
15ff8f8e2a
33
main.c
33
main.c
@ -37,7 +37,7 @@ typedef struct
|
||||
HRESULT (*EnumDisplayModes)(void *);
|
||||
HRESULT (*EnumSurfaces)(void *);
|
||||
HRESULT (*FlipToGDISurface)(void *);
|
||||
HRESULT (*GetCaps)(void *);
|
||||
HRESULT (*GetCaps)(void *, LPDDCAPS, LPDDCAPS);
|
||||
HRESULT (*GetDisplayMode)(void *);
|
||||
HRESULT (*GetFourCCCodes)(void *);
|
||||
HRESULT (*GetGDISurface)(void *);
|
||||
@ -59,15 +59,30 @@ typedef struct
|
||||
|
||||
} fakeDirectDrawObject;
|
||||
|
||||
HRESULT ddraw_CreatePalette(void *This, LPPALETTEENTRY DDColorArray, LPDIRECTDRAWPALETTE FAR * DDPalette, IUnknown FAR * unkOuter)
|
||||
HRESULT ddraw_GetCaps(void *This, LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDEmulCaps)
|
||||
{
|
||||
printf("DirectDraw::CreatePalette(This=%p, DDColorArray=%p, DDPalette=%p, unkOuter=%p)\n", This, DDColorArray, DDPalette, unkOuter);
|
||||
printf("DirectDraw::GetCaps(This=%p, lpDDDriverCaps=%p, lpDDEmulCaps=%p)\n", This, lpDDDriverCaps, lpDDEmulCaps);
|
||||
|
||||
fakeDirectDrawPaletteObject *Palette = (fakeDirectDrawPaletteObject *)malloc(sizeof(fakeDirectDrawPaletteObject));
|
||||
Palette->Ref = 1;
|
||||
Palette->Functions = &piface;
|
||||
printf(" Palette = %p\n", Palette);
|
||||
*DDPalette = (LPDIRECTDRAWPALETTE)Palette;
|
||||
if(lpDDDriverCaps)
|
||||
{
|
||||
lpDDDriverCaps->dwSize = sizeof(DDCAPS);
|
||||
lpDDDriverCaps->dwCKeyCaps = 0;
|
||||
lpDDDriverCaps->dwPalCaps = DDPCAPS_8BIT|DDPCAPS_PRIMARYSURFACE;
|
||||
lpDDDriverCaps->dwVidMemTotal = 16777216;
|
||||
lpDDDriverCaps->dwVidMemFree = 16777216;
|
||||
lpDDDriverCaps->dwMaxVisibleOverlays = 0;
|
||||
lpDDDriverCaps->dwCurrVisibleOverlays = 0;
|
||||
lpDDDriverCaps->dwNumFourCCCodes = 0;
|
||||
lpDDDriverCaps->dwAlignBoundarySrc = 0;
|
||||
lpDDDriverCaps->dwAlignSizeSrc = 0;
|
||||
lpDDDriverCaps->dwAlignBoundaryDest = 0;
|
||||
lpDDDriverCaps->dwAlignSizeDest = 0;
|
||||
}
|
||||
|
||||
if(lpDDEmulCaps)
|
||||
{
|
||||
lpDDEmulCaps->dwSize = 0;
|
||||
}
|
||||
|
||||
return DD_OK;
|
||||
}
|
||||
@ -133,7 +148,7 @@ fakeDirectDraw iface =
|
||||
null, //EnumDisplayModes,
|
||||
null, //EnumSurfaces,
|
||||
null, //FlipToGDISurface,
|
||||
null, //GetCaps,
|
||||
ddraw_GetCaps,
|
||||
null, //GetDisplayMode,
|
||||
null, //GetFourCCCodes,
|
||||
null, //GetGDISurface,
|
||||
|
14
palette.c
14
palette.c
@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include "palette.h"
|
||||
|
||||
/* from main */
|
||||
@ -23,6 +24,19 @@ ULONG AddRef(void *This);
|
||||
ULONG Release(void *This);
|
||||
HRESULT null();
|
||||
|
||||
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);
|
||||
|
||||
fakeDirectDrawPaletteObject *Palette = (fakeDirectDrawPaletteObject *)malloc(sizeof(fakeDirectDrawPaletteObject));
|
||||
Palette->Ref = 1;
|
||||
Palette->Functions = &piface;
|
||||
printf(" Palette = %p\n", Palette);
|
||||
*DDPalette = (LPDIRECTDRAWPALETTE)Palette;
|
||||
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
fakeDirectDrawPalette piface =
|
||||
{
|
||||
/* IUnknown */
|
||||
|
@ -44,4 +44,6 @@ typedef struct
|
||||
|
||||
extern fakeDirectDrawPalette piface;
|
||||
|
||||
HRESULT ddraw_CreatePalette(void *This, LPPALETTEENTRY DDColorArray, LPDIRECTDRAWPALETTE FAR * DDPalette, IUnknown FAR * unkOuter);
|
||||
|
||||
#endif
|
||||
|
34
surface.c
34
surface.c
@ -38,7 +38,7 @@ ULONG ddraw_surface_Release(void *_This)
|
||||
{
|
||||
fakeDirectDrawSurfaceObject *This = (fakeDirectDrawSurfaceObject *)_This;
|
||||
|
||||
printf("DirectDrawSurface::Release(((fakeDirectDrawSurfaceObject *)This)=%p)\n", ((fakeDirectDrawSurfaceObject *)This));
|
||||
printf("DirectDrawSurface::Release(This=%p)\n", ((fakeDirectDrawSurfaceObject *)This));
|
||||
|
||||
This->Ref--;
|
||||
|
||||
@ -71,6 +71,11 @@ HRESULT ddraw_CreateSurface(void *This, LPDDSURFACEDESC lpDDSurfaceDesc, LPDIREC
|
||||
Surface->height = lpDDSurfaceDesc->dwHeight;
|
||||
Surface->surface = NULL;
|
||||
|
||||
if(Surface->width && Surface->height)
|
||||
{
|
||||
Surface->surface = malloc(Surface->width * Surface->height);
|
||||
}
|
||||
|
||||
printf(" Surface = %p\n", Surface);
|
||||
|
||||
Surface->Ref = 0;
|
||||
@ -87,6 +92,25 @@ HRESULT ddraw_surface_Blt(void *This, LPRECT lpDestRect, LPDIRECTDRAWSURFACE lpD
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
HRESULT ddraw_surface_GetCaps(void *_This, LPDDSCAPS lpDDSCaps)
|
||||
{
|
||||
printf("DirectDrawSurface::GetCaps(This=%p, lpDDSCaps=%p)\n", _This, lpDDSCaps);
|
||||
lpDDSCaps->dwCaps = 0;
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
HRESULT ddraw_surface_GetPalette(void *_This, LPDIRECTDRAWPALETTE FAR *lplpDDPalette)
|
||||
{
|
||||
printf("DirectDrawSurface::GetPalette(This=%p, lplpDDPalette=%p)\n", _This, lplpDDPalette);
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
HRESULT ddraw_surface_SetPalette(void *_This, LPDIRECTDRAWPALETTE lpDDPalette)
|
||||
{
|
||||
printf("DirectDrawSurface::SetPalette(This=%p, lpDDPalette=%p)\n", _This, lpDDPalette);
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
HRESULT ddraw_surface_Lock(void *_This, LPRECT lpDestRect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent)
|
||||
{
|
||||
fakeDirectDrawSurfaceObject *This = (fakeDirectDrawSurfaceObject *)_This;
|
||||
@ -114,8 +138,6 @@ HRESULT ddraw_surface_Lock(void *_This, LPRECT lpDestRect, LPDDSURFACEDESC lpDDS
|
||||
printf(" dwFlags: DDLOCK_WRITEONLY\n");
|
||||
}
|
||||
|
||||
This->surface = malloc(This->width * This->height);
|
||||
|
||||
lpDDSurfaceDesc->dwSize = sizeof(DDSURFACEDESC);
|
||||
lpDDSurfaceDesc->dwFlags = DDSD_LPSURFACE;
|
||||
lpDDSurfaceDesc->lpSurface = This->surface;
|
||||
@ -147,13 +169,13 @@ fakeDirectDrawSurface siface =
|
||||
null, // ddraw_surface_Flip
|
||||
null, // ddraw_surface_GetAttachedSurface
|
||||
null, // ddraw_surface_GetBltStatus
|
||||
null, // ddraw_surface_GetCaps
|
||||
ddraw_surface_GetCaps,
|
||||
null, // ddraw_surface_GetClipper
|
||||
null, // ddraw_surface_GetColorKey
|
||||
null, // ddraw_surface_GetDC
|
||||
null, // ddraw_surface_GetFlipStatus
|
||||
null, // ddraw_surface_GetOverlayPosition
|
||||
null, // ddraw_surface_GetPalette
|
||||
ddraw_surface_GetPalette,
|
||||
null, // ddraw_surface_GetPixelFormat
|
||||
null, // ddraw_surface_GetSurfaceDesc
|
||||
null, // ddraw_surface_Initialize
|
||||
@ -164,7 +186,7 @@ fakeDirectDrawSurface siface =
|
||||
null, // ddraw_surface_SetClipper
|
||||
null, // ddraw_surface_SetColorKey
|
||||
null, // ddraw_surface_SetOverlayPosition
|
||||
null, // ddraw_surface_SetPalette
|
||||
ddraw_surface_SetPalette,
|
||||
ddraw_surface_Unlock,
|
||||
null, // ddraw_surface_UpdateOverlay
|
||||
null, // ddraw_surface_UpdateOverlayDisplay
|
||||
|
Loading…
x
Reference in New Issue
Block a user