59 BOOL surface_fullscreen,
60 BOOL onlySystemMemory,
64 const PALETTEENTRY* pPaletteEntries,
259 void Error(
const char* p_message,
int p_error);
Class responsible for interfacing with DirectDraw to manage rendering surfaces, palettes,...
void FUN_1009d920()
Internal: Restores original palette and resets display mode and cooperative level.
IDirectDrawSurface * m_pBackBuffer
Backbuffer for offscreen rendering/flipping. [AI].
BOOL IsSupportedMode(int width, int height, int bpp)
Checks if the given mode (resolution, bpp) is supported by the current device.
PALETTEENTRY m_originalPaletteEntries[256]
Backup of system/Windows palette for restoration. [AI].
BOOL m_bIgnoreWMSIZE
Internal flag to suppress window resize messages during device switching. [AI].
BOOL DDInit(BOOL fullscreen)
Initializes DirectDraw cooperative level for fullscreen or windowed mode.
PALETTEENTRY m_paletteEntries[256]
Active 8-bit palette entries for palettized modes. [AI].
BOOL SetPaletteEntries(const PALETTEENTRY *pPaletteEntries, int paletteEntryCount, BOOL fullscreen)
Sets the DirectDraw palette using the provided palette entries.
BOOL m_bOnlySoftRender
If TRUE, restricts rendering to software only; disables hardware acceleration. [AI].
IDirectDrawSurface * BackBuffer()
Returns the back buffer surface.
HRESULT CreateDDSurface(LPDDSURFACEDESC a2, LPDIRECTDRAWSURFACE *a3, IUnknown *a4)
Creates a DirectDraw surface with the given surface description.
IDirectDrawClipper * m_pClipper
Clipper for managing windowed surface boundaries. [AI].
BOOL CacheOriginalPaletteEntries()
Caches the original Windows/system palette for restoration.
IDirectDrawSurface * m_pText2Surface
Debug overlay surface for "text2". [AI].
static int GetPrimaryBitDepth()
Returns the bit depth (color depth) of the primary display device.
BOOL m_bPrimaryPalettized
TRUE if primary/backbuffer is using 8-bit palettized mode. [AI].
virtual const char * ErrorToString(HRESULT p_error)
Converts DirectDraw error code to a human-readable string.
ErrorHandler m_pErrorHandler
Callback for non-fatal DirectDraw errors. [AI].
IDirectDrawSurface * m_pZBuffer
Attached Z-buffer for 3D rendering. [AI].
SIZE m_text2SizeOnSurface
Pixel size of rendered text2 overlay surface. [AI].
DeviceModesInfo::Mode m_currentMode
Struct with current width, height, and bits per pixel. [AI].
HFONT m_hFont
Font handle for debug text overlays. [AI].
BOOL TextToTextSurface(const char *text, IDirectDrawSurface *pSurface, SIZE &textSizeOnSurface)
Renders a string to the given surface and fills in its onscreen size.
IDirectDraw * DirectDraw()
Returns the DirectDraw device interface pointer.
BOOL TextToTextSurface1(const char *text)
Draws the specified text string to the debug "text1" surface.
DeviceModesInfo * m_currentDevInfo
Device info array for storing supported display modes. [AI].
int FlipToGDISurface()
Flips to the Windows GDI surface, restoring the desktop when leaving exclusive fullscreen.
BOOL DDCreateSurfaces()
Internal: Creates all necessary front/back/offscreen surfaces for rendering.
BOOL m_bOnlySystemMemory
TRUE for system RAM-only surfaces; disables video memory allocation. [AI].
ErrorHandler m_pFatalErrorHandler
Callback invoked for fatal device errors. [AI].
IDirectDrawSurface * m_pText1Surface
Debug overlay surface for "text1". [AI].
virtual void Destroy()
Shuts down DirectDraw and releases all resources, including device and surfaces.
IDirectDrawSurface * m_pFrontBuffer
Primary or front display surface. [AI].
SIZE m_text1SizeOnSurface
Pixel size of rendered text1 overlay surface. [AI].
void * m_pErrorHandlerArg
Custom argument pointer for error handler. [AI].
void * m_pFatalErrorHandlerArg
Custom argument pointer for fatal error handler. [AI].
void * m_unk0x850
[AI] Purpose unknown; possibly driver-specific data or reserved.
BOOL CreateZBuffer(DWORD memorytype, DWORD depth)
Creates a z-buffer with the given memory type/capabilities and attaches it to the back buffer.
virtual void DestroyButNotDirectDraw()
Releases all DirectDraw-related resources except the DirectDraw device itself.
BOOL TextToTextSurface2(const char *lpString)
Draws the specified string to the debug "text2" surface.
IDirectDraw * m_pDirectDraw
Pointer to the DirectDraw COM device. [AI].
MxDirectDraw()
Constructs a MxDirectDraw instance and initializes its members.
void(* ErrorHandler)(const char *, HRESULT, void *)
Function pointer type for error handling callbacks.
HWND m_hWndMain
Main window handle on which DirectDraw is initialized. [AI].
void Error(const char *p_message, int p_error)
Invokes the error handler, optionally destroying the device, and outputs the given error message/code...
BOOL RestorePaletteEntries()
Restores the active DirectDraw palette entries from the internal palette array.
IDirectDrawPalette * m_pPalette
DirectDraw palette assigned to the primary/back surfaces. [AI].
BOOL DDSetMode(int width, int height, int bpp)
Changes DirectDraw to the specified display mode and creates relevant surfaces.
int Pause(BOOL)
Pauses or resumes DirectDraw rendering.
BOOL GetDDSurfaceDesc(LPDDSURFACEDESC lpDDSurfDesc, LPDIRECTDRAWSURFACE lpDDSurf)
Retrieves the surface description for the given DirectDraw surface.
int m_pauseCount
Count of nested pauses; ensures multiple Pause(TRUE)/Pause(FALSE) work correctly. [AI].
BOOL m_bFlipSurfaces
TRUE if using DirectDraw flipping (fullscreen buffer swap); windowed disables this....
BOOL IsFullScreen()
Returns TRUE if DirectDraw is currently set in exclusive fullscreen mode.
BOOL m_bFullScreen
TRUE if device is in exclusive fullscreen mode. [AI].
DeviceModesInfo::Mode * CurrentMode()
Provides access to the current selected display mode (width, height, bpp).
virtual ~MxDirectDraw()
Virtual destructor.
IDirectDrawSurface * FrontBuffer()
Returns the surface used as the primary/front buffer.
BOOL RestoreOriginalPaletteEntries()
Restores the original Windows palette from backup.
IDirectDrawClipper * Clipper()
Returns the current DirectDraw clipper object used for window clipping.
void FUN_1009e020()
Internal: Clears the backbuffer(s), locking and filling with zero color, possibly flipping to front.
BOOL RecreateDirectDraw(GUID **a2)
Recreates the DirectDraw device, deleting and restoring the device object pointer.
BOOL RestoreSurfaces()
Attempts to restore all DirectDraw surfaces that may have been lost.
virtual BOOL Create(HWND hWnd, BOOL fullscreen_1, BOOL surface_fullscreen, BOOL onlySystemMemory, int width, int height, int bpp, const PALETTEENTRY *pPaletteEntries, int paletteEntryCount)
Creates and initializes the DirectDraw device and associated surfaces/windows/state.
BOOL m_bIsOnPrimaryDevice
TRUE if rendering on Windows' main display; disables windowed mode for other devices....
BOOL CreateTextSurfaces()
Creates the two offscreen text surfaces used for debug overlay.
struct _DDSURFACEDESC FAR * LPDDSURFACEDESC
struct IDirectDrawSurface FAR * LPDIRECTDRAWSURFACE
typedef DWORD(FAR PASCAL *LPCLIPPERCALLBACK)(LPDIRECTDRAWCLIPPER lpDDClipper
[AI] Represents a specific display mode supported by the device (width, height, bits per pixel).
[AI] Contains detailed information about a Direct3D device's supported display modes and capabilities...