📄 ddrawi.h
字号:
{
LONG lPitch; // pitch of surface
DWORD dwLinearSize; // linear size of non-rectangular surface
};
WORD wHeight; // height of surface
WORD wWidth; // width of surface
DWORD dwUsageCount; // number of access to this surface
ULONG_PTR dwReserved1; // reserved for use by display driver
//
// NOTE: this part of the structure is ONLY allocated if the pixel
// format differs from that of the primary display
//
DDPIXELFORMAT ddpfSurface; // pixel format of surface
} DDRAWI_DDRAWSURFACE_GBL;
/*
* This is an extender structure that is allocated off the end of the SURFACE_GBL
* structure. DO NOT place any structures whose size can change in here.
*/
#define GET_LPDDRAWSURFACE_GBL_MORE(psurf_gbl) \
(*(LPDDRAWI_DDRAWSURFACE_GBL_MORE *) \
((BYTE *)psurf_gbl - sizeof(DWORD)))
/*
* Return the physical memory pointer for a given surface global object.
*
* NOTE: The physical memory pointer is ONLY valid for surfaces allocated from
* non-local video memory. This field will not be valid for system memory or
* local video memory surfaces.
*/
#define SURFACE_PHYSICALVIDMEM( psurf_gbl ) \
( GET_LPDDRAWSURFACE_GBL_MORE( psurf_gbl )->fpPhysicalVidMem )
/*
* NOTE: This structure contains a set of fields for describing linear to physical
* page mappings in the case of page locked system memory. It can also contain the
* physical surface pointer of a surface in non-local memory. As there is no point
* in having both a linear to physical page translation table and a physical memory
* pointer for the same surface they are placed in a union.
*/
typedef struct _DDRAWI_DDRAWSURFACE_GBL_MORE
{
DWORD dwSize;
union
{
DWORD dwPhysicalPageTable; // Physical address of page table (array of physical addresses/one per 4K page)
FLATPTR fpPhysicalVidMem; // Physical address of surface (non-local video memory only)
};
LPDWORD pPageTable; // Linear address of page table
DWORD cPages; // Number of Pages
ULONG_PTR dwSavedDCContext; // PRIVATE: For use by DDSurface::GetDC
FLATPTR fpAliasedVidMem; // PRIVATE: Alias for original fpVidMem
ULONG_PTR dwDriverReserved; // Reserved for driver use (both system and video memory surfaces)
ULONG_PTR dwHELReserved; // PRIVATE: For HEL use only
DWORD cPageUnlocks; // Incremented whenever a surface is PageUnlocked
ULONG_PTR hKernelSurface; // Kernel handle for this surface
DWORD dwKernelRefCnt; // Ref count for kernel handle
LPDDCOLORCONTROL lpColorInfo; // PRIVATE: Initial color control settings
FLATPTR fpNTAlias; // PRIVATE: Used internally by NT DirectDraw
DWORD dwContentsStamp; // Changes when surface data may have changed. 0 means no information
LPVOID lpDDRAWReserved1;
LPVOID lpDDRAWReserved2;
DWORD dwDDRAWReserved1;
DWORD dwDDRAWReserved2;
} DDRAWI_DDRAWSURFACE_GBL_MORE;
/*
* a structure holding additional LCL surface information (can't simply be appended
* to the LCL structure as that structure is of variable size).
*/
typedef struct _DDRAWI_DDRAWSURFACE_MORE
{
DWORD dwSize;
IUNKNOWN_LIST FAR *lpIUnknowns; // IUnknowns aggregated by this surface
LPDDRAWI_DIRECTDRAW_LCL lpDD_lcl; // Pointer to the DirectDraw local object
DWORD dwPageLockCount; // count of pagelocks
DWORD dwBytesAllocated; // size of sys mem allocated
LPDDRAWI_DIRECTDRAW_INT lpDD_int; // Pointer to the DirectDraw interface
DWORD dwMipMapCount; // Number of mip-map levels in the chain
LPDDRAWI_DDRAWCLIPPER_INT lpDDIClipper; // Interface to attached clipper object
//------- Fields added in Version 5.0 -------
LPHEAPALIASINFO lpHeapAliasInfo; // PRIVATE: Aliased heaps being referenced by this lock
DWORD dwOverlayFlags; // Current overlay flags
VOID *rgjunc; // Blitter function table for new blitter
LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort; // Video port currently writting data to this surface
LPDDOVERLAYFX lpddOverlayFX; // current overlay fx
DDSCAPSEX ddsCapsEx;
DWORD dwTextureStage; // stage in multitexture cascade
LPVOID dwDDRAWReserved;
LPVOID dwDDRAWReserved2;
LPVOID lpDDrawReserved3;
LPVOID dwDDrawReserved4;
DWORD dwDDrawReserved5;
LPDWORD lpGammaRamp;
LPDWORD lpOriginalGammaRamp;
LPVOID lpDDrawReserved6;
} DDRAWI_DDRAWSURFACE_MORE;
/*
* Special values assigned to dwPFIndex member of DDRAWI_DDRAWSURFACE_MORE.
*/
#define PFINDEX_UNINITIALIZED (0UL) // pixel-format index is in uninitialized state
#define PFINDEX_UNSUPPORTED (~0UL) // surface's pixel format is not supported by HEL
/*
* the LCL structure is local data for each individual surface object
*/
struct _DDRAWI_DDRAWSURFACE_LCL
{
LPDDRAWI_DDRAWSURFACE_MORE lpSurfMore; // pointer to additional local data
LPDDRAWI_DDRAWSURFACE_GBL lpGbl; // pointer to surface shared data
ULONG_PTR hDDSurface; // NT Kernel-mode handle was dwUnused0
LPATTACHLIST lpAttachList; // link to surfaces we attached to
LPATTACHLIST lpAttachListFrom;// link to surfaces that attached to this one
DWORD dwLocalRefCnt; // object refcnt
DWORD dwProcessId; // owning process
DWORD dwFlags; // flags
DDSCAPS ddsCaps; // capabilities of surface
union
{
LPDDRAWI_DDRAWPALETTE_INT lpDDPalette; // associated palette
LPDDRAWI_DDRAWPALETTE_INT lp16DDPalette; // 16-bit ptr to associated palette
};
union
{
LPDDRAWI_DDRAWCLIPPER_LCL lpDDClipper; // associated clipper
LPDDRAWI_DDRAWCLIPPER_INT lp16DDClipper; // 16-bit ptr to associated clipper
};
DWORD dwModeCreatedIn;
DWORD dwBackBufferCount; // number of back buffers created
DDCOLORKEY ddckCKDestBlt; // color key for destination blt use
DDCOLORKEY ddckCKSrcBlt; // color key for source blt use
// IUnknown FAR *pUnkOuter; // outer IUnknown
ULONG_PTR hDC; // owned dc
ULONG_PTR dwReserved1; // reserved for use by display driver
/*
* NOTE: this part of the structure is ONLY allocated if the surface
* can be used for overlays. ddckCKSrcOverlay MUST NOT BE MOVED
* from the start of this area.
*/
DDCOLORKEY ddckCKSrcOverlay;// color key for source overlay use
DDCOLORKEY ddckCKDestOverlay;// color key for destination overlay use
LPDDRAWI_DDRAWSURFACE_INT lpSurfaceOverlaying; // surface we are overlaying
DBLNODE dbnOverlayNode;
/*
* overlay rectangle, used by DDHEL
*/
RECT rcOverlaySrc;
RECT rcOverlayDest;
/*
* the below values are kept here for ddhel. they're set by UpdateOverlay,
* they're used whenever the overlays are redrawn.
*/
DWORD dwClrXparent; // the *actual* color key (override, colorkey, or CLR_INVALID)
DWORD dwAlpha; // the per surface alpha
/*
* overlay position
*/
LONG lOverlayX; // current x position
LONG lOverlayY; // current y position
};
typedef struct _DDRAWI_DDRAWSURFACE_LCL DDRAWI_DDRAWSURFACE_LCL;
#define DDRAWISURFGBL_MEMFREE 0x00000001L // video memory has been freed
#define DDRAWISURFGBL_SYSMEMREQUESTED 0x00000002L // surface is in system memory at request of user
#define DDRAWISURFGBL_ISGDISURFACE 0x00000004L // This surface represents what GDI thinks is front buffer
#define DDRAWISURFGBL_SOFTWAREAUTOFLIP 0x00000008L // This surface is autoflipped using software
#define DDRAWISURFGBL_LOCKNOTHOLDINGWIN16LOCK 0x00000010L // PRIVATE: a vram lock of the entire surface is not holding the Win16 lock
#define DDRAWISURFGBL_LOCKVRAMSTYLE 0x00000020L // PRIVATE: entire surface was locked with VRAM style lock
#define DDRAWISURFGBL_LOCKBROKEN 0x00000040L // PRIVATE: a lock of the entire surface was broken by an invalidate
#define DDRAWISURFGBL_IMPLICITHANDLE 0x00000080L // This dwKernelHandle was created implicitly
#define DDRAWISURFGBL_ISCLIENTMEM 0x00000100L // PRIVATE: the memory pointer to by fpVidMem was allocated by the client
#define DDRAWISURFGBL_HARDWAREOPSOURCE 0x00000200L // This surface was the source for an asynchronous hardware operation
#define DDRAWISURFGBL_HARDWAREOPDEST 0x00000400L // This surface was dest for an asynchronous hardware operation
#define DDRAWISURFGBL_HARDWAREOPSTARTED (DDRAWISURFGBL_HARDWAREOPSOURCE|DDRAWISURFGBL_HARDWAREOPDEST)
#define DDRAWISURFGBL_VPORTINTERLEAVED 0x00000800L // This surface contains interleaved video port data
#define DDRAWISURFGBL_VPORTDATA 0x00001000L // This surface received data from the video port
#define DDRAWISURFGBL_LATEALLOCATELINEAR 0x00002000L // Optimized surface was allocated as a formless chunk. lPitch invalid, dwLinearSize valid.
#define DDRAWISURFGBL_SYSMEMEXECUTEBUFFER 0x00004000L // Driver sets this flag to tell ddraw that the surface was allocated in system memory
#define DDRAWISURFGBL_USEHEL 0x00008000L // This flag is set at creation time if the HEL is used to create the surface.
/*
* NOTE: This flag was previously DDRAWISURFGBL_INVALID. This flags has been retired
* and replaced by DDRAWISURF_INVALID in the local object.
*/
#define DDRAWISURFGBL_RESERVED0 0x80000000L // Reserved flag
#define DDRAWISURF_ATTACHED 0x00000001L // surface is attached to another
#define DDRAWISURF_IMPLICITCREATE 0x00000002L // surface implicitly created
#define DDRAWISURF_ISFREE 0x00000004L // surface already freed (temp flag)
#define DDRAWISURF_ATTACHED_FROM 0x00000008L // surface has others attached to it
#define DDRAWISURF_IMPLICITROOT 0x00000010L // surface root of implicit creation
#define DDRAWISURF_PARTOFPRIMARYCHAIN 0x00000020L // surface is part of primary chain
#define DDRAWISURF_DATAISALIASED 0x00000040L // used for thunking
#define DDRAWISURF_HASDC 0x00000080L // has a DC
#define DDRAWISURF_HASCKEYDESTOVERLAY 0x00000100L // surface has CKDestOverlay
#define DDRAWISURF_HASCKEYDESTBLT 0x00000200L // surface has CKDestBlt
#define DDRAWISURF_HASCKEYSRCOVERLAY 0x00000400L // surface has CKSrcOverlay
#define DDRAWISURF_HASCKEYSRCBLT 0x00000800L // surface has CKSrcBlt
#define DDRAWISURF_LOCKEXCLUDEDCURSOR 0x00001000L // surface was locked and excluded cursor
#define DDRAWISURF_HASPIXELFORMAT 0x00002000L // surface structure has pixel format data
#define DDRAWISURF_HASOVERLAYDATA 0x00004000L // surface structure has overlay data
#define DDRAWISURF_SETGAMMA 0x00008000L // gamma ramp for this surface is active
#define DDRAWISURF_SW_CKEYDESTOVERLAY 0x00010000L // surface expects to process colorkey in software
#define DDRAWISURF_SW_CKEYDESTBLT 0x00020000L // surface expects to process colorkey in software
#define DDRAWISURF_SW_CKEYSRCOVERLAY 0x00040000L // surface expects to process colorkey in software
#define DDRAWISURF_SW_CKEYSRCBLT 0x00080000L // surface expects to process colorkey in software
#define DDRAWISURF_HW_CKEYDESTOVERLAY 0x00100000L // surface expects to process colorkey in hardware
#define DDRAWISURF_HW_CKEYDESTBLT 0x00200000L // surface expects to process colorkey in hardware
#define DDRAWISURF_HW_CKEYSRCOVERLAY 0x00400000L // surface expects to process colorkey in hardware
#define DDRAWISURF_HW_CKEYSRCBLT 0x00800000L // surface expects to process colorkey in hardware
#define DDRAWISURF_INMASTERSPRITELIST 0x01000000l // surface is referenced in master sprite list
#define DDRAWISURF_HELCB 0x02000000L // surface is the ddhel cb. must call hel for lock/blt.
#define DDRAWISURF_FRONTBUFFER 0x04000000L // surface was originally a front buffer
#define DDRAWISURF_BACKBUFFER 0x08000000L // surface was originally backbuffer
#define DDRAWISURF_INVALID 0x10000000L // surface has been invalidated by mode set
#define DDRAWISURF_DCIBUSY 0x20000000L // HEL has turned off BUSY so DCI would work
#define DDRAWISURF_GETDCNULL 0x40000000L // getdc could not lock and so returned GetDC(NULL)
//#define DDRAWISURF_CANTLOCK 0x20000000L // surface cannot be locked (primary created by HEL)
#define DDRAWISURF_EMPTYSURFACE 0x40000000L // Surface is empty, means it has been created by CreateOptSurface but not Loaded
#define DDRAWISURF_DCILOCK 0x80000000L // Surface was locked using DCIBeginAccess
/*
* rop stuff
*/
#define ROP_HAS_SOURCE 0x00000001l
#define ROP_HAS_PATTERN 0x00000002l
#define ROP_HAS_SOURCEPATTERN ROP_HAS_SOURCE | ROP_HAS_PATTERN
/*
* mode information
*/
typedef struct _DDHALMODEINFO
{
DWORD dwWidth; // width (in pixels) of mode
DWORD dwHeight; // height (in pixels) of mode
LONG lPitch; // pitch (in bytes) of mode
DWORD dwBPP; // bits per pixel
WORD wFlags; // flags
WORD wRefreshRate; // refresh rate
DWORD dwRBitMask; // red bit mask
DWORD dwGBitMask; // green bit mask
DWORD dwBBitMask; // blue bit mask
DWORD dwAlphaBitMask; // alpha bit mask
} DDHALMODEINFO;
typedef DDHALMODEINFO FAR *LPDDHALMODEINFO;
#define DDMODEINFO_PALETTIZED 0x0001 // mode is palettized
#define DDMODEINFO_MODEX 0x0002 // mode is a modex mode
#define DDMODEINFO_UNSUPPORTED 0x0004 // mode is not supported by driver
/*
* Note internally, standard VGA modes are tagged as MODEX and STANDARDVGA
*/
#define DDMODEINFO_STANDARDVGA 0x0008 // mode is standard vga, e.g. mode 0x13
/*
* DDRAW interface struct
*/
typedef struct _DDRAWI_DIRECTDRAW_INT
{
LPVOID lpVtbl; // pointer to array of interface methods
LPDDRAWI_DIRECTDRAW_LCL lpLcl; // pointer to interface data
LPDDRAWI_DIRECTDRAW_INT lpLink; // link to next interface
DWORD dwIntRefCnt; // interface reference count
} DDRAWI_DIRECTDRAW_INT;
/*
* DDRAW version of DirectDraw object; it has data after the vtable
*
* all entries marked as PRIVATE are not for use by the display driver
*/
typedef struct _DDHAL_CALLBACKS
{
DDHAL_DDCALLBACKS cbDDCallbacks; // addresses in display driver for DIRECTDRAW object HAL
DDHAL_DDSURFACECALLBACKS cbDDSurfaceCallbacks; // addresses in display driver for DIRECTDRAWSURFACE object HAL
DDHAL_DDPALETTECALLBACKS cbDDPaletteCallbacks; // addresses in display driver for DIRECTDRAWPALETTE object HAL
DDHAL_DDCALLBACKS HALDD; // HAL for DIRECTDRAW object
DDHAL_DDSURFACECALLBACKS HALDDSurface; // HAL for DIRECTDRAWSURFACE object
DDHAL_DDPALETTECALLBACKS HALDDPalette; // HAL for DIRECTDRAWPALETTE object
DDHAL_DDCALLBACKS HELDD; // HEL for DIRECTDRAW object
DD
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -