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