18 memset(
this, 0,
sizeof(*
this));
51 Init(p_guid, p_driverDesc, p_driverName);
112 memset(
this, 0,
sizeof(*
this));
114 Initialize(p_guid, p_deviceDesc, p_deviceName, p_HWDesc, p_HELDesc);
199 MxDriver driver(p_guid, p_driverDesc, p_driverName);
214 if (result !=
DD_OK) {
222 if (result !=
DD_OK) {
226 result = lpDD->QueryInterface(IID_IDirect3D2, (
LPVOID*) &lpDirect3d2);
228 if (result !=
DD_OK) {
234 if (result !=
DD_OK) {
247 lpDirect3d2->Release();
265 va_start(args, p_format);
266 vsprintf(buf, p_format, args);
269 OutputDebugString(buf);
277 if (p_context ==
NULL) {
296 if (p_context ==
NULL) {
301 ->EnumDevicesCallback(p_guid, p_deviceDesc, p_deviceName, p_HWDesc, p_HELDesc);
309 assert(
m_list.size() > 0);
313 MxDisplayMode displayMode(p_ddsd->dwWidth, p_ddsd->dwHeight, p_ddsd->ddpfPixelFormat.dwRGBBitCount);
314 m_list.back().m_displayModes.push_back(displayMode);
330 m_list.back().m_devices.push_back(device);
331 memset(&device, 0,
sizeof(device));
360 if (p_context ==
NULL) {
364 return ((
MxDeviceEnumerate*) p_context)->EnumDirectDrawCallback(p_guid, p_driverDesc, p_driverName);
376 return "Generic failure.";
378 return "Action not supported.";
380 return "One or more of the parameters passed to the function are incorrect.";
382 return "DirectDraw does not have enough memory to perform the operation.";
384 return "This surface can not be attached to the requested surface.";
386 return "This object is already initialized.";
388 return "Support is currently not available.";
390 return "This surface can not be detached from the requested surface.";
392 return "Height of rectangle provided is not a multiple of reqd alignment.";
394 return "An exception was encountered while performing the requested operation.";
396 return "One or more of the caps bits passed to the callback are incorrect.";
398 return "Unable to match primary surface creation request with existing primary surface.";
400 return "DirectDraw does not support the requested mode.";
402 return "DirectDraw does not support the provided cliplist.";
404 return "The pixel format was invalid as specified.";
406 return "DirectDraw received a pointer that was an invalid DIRECTDRAW object.";
408 return "Operation could not be carried out because one or more surfaces are locked.";
410 return "Rectangle provided was invalid.";
412 return "Operation could not be carried out because there is no alpha accleration hardware present or "
415 return "There is no 3D present.";
417 return "Operation could not be carried out because there is no color conversion hardware present or available.";
419 return "No cliplist available.";
421 return "Surface doesn't currently have a color key";
423 return "Create function called without DirectDraw object method SetCooperativeLevel being called.";
425 return "Operation requires the application to have exclusive mode but the application does not have exclusive "
428 return "Operation could not be carried out because there is no hardware support of the destination color key.";
430 return "There is no GDI present.";
432 return "Flipping visible surfaces is not supported.";
434 return "Requested item was not found.";
436 return "Operation could not be carried out because there is no hardware present or available.";
438 return "Operation could not be carried out because there is no appropriate raster op hardware present or "
441 return "Operation could not be carried out because there is no overlay hardware present or available.";
443 return "Operation could not be carried out because there is no hardware support for stretching.";
445 return "Operation could not be carried out because there is no rotation hardware present or available.";
447 return "Operation could not be carried out because there is no texture mapping hardware present or available.";
449 return "DirectDrawSurface is not in 4 bit color palette and the requested operation requires 4 bit color "
452 return "DirectDrawSurface is not in 4 bit color index palette and the requested operation requires 4 bit color "
455 return "DirectDrawSurface is not in 8 bit color mode and the requested operation requires 8 bit color.";
457 return "Operation could not be carried out because there is no hardware support for zbuffer blitting.";
459 return "Operation could not be carried out because there is no hardware support for vertical blank "
460 "synchronized operations.";
462 return "The hardware needed for the requested operation has already been allocated.";
464 return "Overlay surfaces could not be z layered based on their BltOrder because the hardware does not support "
465 "z layering of overlays.";
467 return "No src color key specified for this operation.";
469 return "DirectDraw does not have enough memory to perform the operation.";
471 return "The hardware does not support clipped overlays.";
473 return "Can only have ony color key active at one time for overlays.";
475 return "Access to this palette is being refused because the palette is already locked by another thread.";
477 return "This surface is already a dependency of the surface it is being made a dependency of.";
479 return "This surface is already attached to the surface it is being attached to.";
481 return "Access to surface refused because the surface is obscured.";
483 return "Access to this surface is being refused because the surface is already locked by another thread.";
485 return "The requested surface is not attached.";
487 return "Access to this surface is being refused because the surface memory is gone. The DirectDrawSurface "
488 "object representing this surface should have Restore called on it.";
490 return "Size requested by DirectDraw is too large, but the individual height and width are OK.";
492 return "Height requested by DirectDraw is too large.";
494 return "FOURCC format requested is unsupported by DirectDraw.";
496 return "Width requested by DirectDraw is too large.";
498 return "Vertical blank is in progress.";
500 return "Bitmask in the pixel format requested is unsupported by DirectDraw.";
502 return "Rectangle provided was not horizontally aligned on required boundary.";
504 return "Informs DirectDraw that the previous Blt which is transfering information to or from this Surface is "
507 return "The GUID passed to DirectDrawCreate is not a valid DirectDraw driver identifier.";
509 return "A DirectDraw object representing this driver has already been created for this process.";
511 return "A hardware-only DirectDraw object creation was attempted but the driver did not support any hardware.";
513 return "This process already has created a primary surface.";
515 return "Software emulation not available.";
517 return "Region passed to Clipper::GetClipList is too small.";
519 return "An attempt was made to set a cliplist for a clipper object that is already monitoring an hwnd.";
521 return "No clipper object attached to surface object.";
523 return "Clipper notification requires an HWND or no HWND has previously been set as the CooperativeLevel HWND.";
525 return "HWND used by DirectDraw CooperativeLevel has been subclassed, this prevents DirectDraw from restoring "
528 return "The CooperativeLevel HWND has already been set. It can not be reset while the process has surfaces or "
531 return "No palette object attached to this surface.";
533 return "No hardware support for 16 or 256 color palettes.";
535 return "Return if a clipper object is attached to the source surface passed into a BltFast call.";
537 return "No blitter hardware present.";
539 return "No DirectDraw ROP hardware.";
541 return "Returned when GetOverlayPosition is called on a hidden overlay.";
543 return "Returned when GetOverlayPosition is called on an overlay that UpdateOverlay has never been called on "
544 "to establish a destination.";
546 return "Returned when the position of the overlay on the destination is no longer legal for that destination.";
548 return "Returned when an overlay member is called for a non-overlay surface.";
550 return "An attempt was made to set the cooperative level when it was already set to exclusive.";
552 return "An attempt has been made to flip a surface that is not flippable.";
554 return "Can't duplicate primary & 3D surfaces, or surfaces that are implicitly created.";
556 return "Surface was not locked. An attempt to unlock a surface that was not locked at all, or by this "
557 "process, has been attempted.";
559 return "Windows can not create any more DCs.";
561 return "No DC was ever created for this surface.";
563 return "This surface can not be restored because it was created in a different mode.";
565 return "This surface can not be restored because it is an implicitly created surface.";
567 return "The surface being used is not a palette-based surface.";
569 return "Unrecognized error value.";
577 memset(
this, 0,
sizeof(*
this));
[AI] Holds assignment and description details for a Direct3D rendering device in use.
~MxAssignedDevice()
[AI] Destructor; deletes associated DeviceModesInfo.
[AI] Enumerates DirectDraw/Direct3D drivers, devices, and display modes on the system.
unsigned char IsInitialized() const
[AI] Checks if the enumeration has already been performed.
HRESULT EnumDisplayModesCallback(LPDDSURFACEDESC p_ddsd)
[AI] Callback for each display mode in a driver.
~MxDeviceEnumerate()
[AI] Destructor.
BOOL EnumDirectDrawCallback(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName)
[AI] Callback for enumerating a single DirectDraw driver.
unsigned char m_initialized
[AI] Set TRUE after successful enumeration to prevent redundant operations.
static HRESULT CALLBACK DevicesEnumerateCallback(LPGUID p_guid, LPSTR p_deviceDesc, LPSTR p_deviceName, LPD3DDEVICEDESC p_HWDesc, LPD3DDEVICEDESC p_HELDesc, LPVOID p_context)
[AI] Static thunk callback for enumerating 3D devices within a driver.
MxDeviceEnumerate()
[AI] Constructs an MxDeviceEnumerate object, sets initialized flag to FALSE.
virtual int DoEnumerate()
[AI] Begins enumeration of DirectDraw drivers, their devices, and available display modes.
list< MxDriver > m_list
[AI] List of all discovered DirectDraw drivers and their device/mode info.
const char * EnumerateErrorToString(HRESULT p_error)
[AI] Converts a DirectDraw/Direct3D HRESULT enumeration error to a human-readable string.
static BOOL CALLBACK DirectDrawEnumerateCallback(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName, LPVOID p_context)
[AI] Static thunk callback suitable for passing to DirectDrawEnumerate.
static HRESULT CALLBACK DisplayModesEnumerateCallback(LPDDSURFACEDESC p_ddsd, LPVOID p_context)
[AI] Static thunk callback for enumerating display modes during driver enumeration.
HRESULT EnumDevicesCallback(LPGUID p_guid, LPSTR p_deviceDesc, LPSTR p_deviceName, LPD3DDEVICEDESC p_HWDesc, LPD3DDEVICEDESC p_HELDesc)
[AI] Callback for enumerating 3D devices on a driver.
static void BuildErrorString(const char *,...)
[AI] Utility for formatting and outputting error/debug strings.
struct IDirect3D2 * LPDIRECT3D2
#define DDERR_OVERLAYCOLORKEYONLYONEACTIVE
#define DDERR_NOT8BITCOLOR
#define DDERR_NOSTRETCHHW
#define DDERR_NOTAOVERLAYSURFACE
#define DDERR_INVALIDRECT
#define DDERR_NOT4BITCOLORINDEX
#define DDERR_HEIGHTALIGN
#define DDERR_NOOVERLAYDEST
struct _DDSURFACEDESC FAR * LPDDSURFACEDESC
#define DDERR_INVALIDPIXELFORMAT
#define DDERR_VERTICALBLANKINPROGRESS
#define DDERR_NOTFLIPPABLE
#define DDERR_OVERLAYCANTCLIP
#define DDERR_UNSUPPORTEDMASK
#define DDERR_INVALIDCAPS
#define DDERR_INVALIDOBJECT
#define DDERR_INVALIDMODE
#define DDERR_CANNOTATTACHSURFACE
#define DDERR_UNSUPPORTEDFORMAT
#define DDERR_NOZOVERLAYHW
#define DDERR_SURFACELOST
#define DDERR_NOOVERLAYHW
#define DDERR_NOT4BITCOLOR
#define DDERR_SURFACEALREADYDEPENDENT
#define DDERR_SURFACEISOBSCURED
#define DDERR_INCOMPATIBLEPRIMARY
#define DDERR_EXCLUSIVEMODEALREADYSET
#define DDERR_PALETTEBUSY
#define DDERR_NOCOLORCONVHW
#define DDERR_WASSTILLDRAWING
#define DDERR_HWNDSUBCLASSED
#define DDERR_NOEXCLUSIVEMODE
#define DDERR_OVERLAYNOTVISIBLE
#define DDERR_OUTOFMEMORY
#define DDERR_NOZBUFFERHW
#define DDERR_CANTCREATEDC
#define DDERR_HWNDALREADYSET
#define DDERR_NOPALETTEATTACHED
#define DDERR_CURRENTLYNOTAVAIL
#define DDERR_OUTOFVIDEOMEMORY
#define DDERR_NOCOOPERATIVELEVELSET
#define DDERR_SURFACENOTATTACHED
#define DDERR_DIRECTDRAWALREADYCREATED
#define DDERR_NOCOLORKEYHW
#define DDERR_COLORKEYNOTSET
#define DDERR_UNSUPPORTED
#define DDERR_REGIONTOOSMALL
#define DDERR_TOOBIGWIDTH
#define DDERR_NOPALETTEHW
#define DDERR_INVALIDDIRECTDRAWGUID
#define DDERR_CANTDUPLICATE
#define DDERR_INVALIDCLIPLIST
#define DDERR_NOCLIPPERATTACHED
#define DDERR_IMPLICITLYCREATED
#define DDERR_NOTPALETTIZED
struct IDirectDraw FAR * LPDIRECTDRAW
#define DDERR_INVALIDPARAMS
#define DDERR_CLIPPERISUSINGHWND
#define DDERR_NOROTATIONHW
#define DDERR_NORASTEROPHW
#define DDERR_LOCKEDSURFACES
#define DDERR_SURFACEALREADYATTACHED
#define DDERR_NOEMULATION
#define DDERR_ALREADYINITIALIZED
#define DDERR_NOTEXTUREHW
#define DDERR_CANNOTDETACHSURFACE
#define DDERR_SURFACEBUSY
#define DDERR_NODIRECTDRAWHW
#define DDERR_INVALIDPOSITION
#define DDERR_TOOBIGHEIGHT
#define DDERR_PRIMARYSURFACEALREADYEXISTS
#define DDERR_BLTFASTCANTCLIP
#define DECOMP_SIZE_ASSERT(T, S)
#define NULL
[AI] Null pointer value (C/C++ semantics).
[AI] Contains detailed information about a Direct3D device's supported display modes and capabilities...
DeviceModesInfo()
[AI] Constructs an empty DeviceModesInfo with zeroed members.
Mode * m_modeArray
[AI] Array of supported display modes; dynamically allocated and owned.
~DeviceModesInfo()
[AI] Destructor.
GUID * m_guid
[AI] GUID of the video device (heap-allocated and owned by this struct).
[AI] Encapsulates Direct3D device enumeration information and capability structures.
~Direct3DDeviceInfo()
[AI] Destructor; frees owned resources such as GUID and strings.
D3DDEVICEDESC m_HWDesc
[AI] Hardware Direct3D device capability description.
Direct3DDeviceInfo()
[AI] Constructs a zero-initialized Direct3DDeviceInfo instance.
void Initialize(LPGUID p_guid, LPSTR p_deviceDesc, LPSTR p_deviceName, LPD3DDEVICEDESC p_HWDesc, LPD3DDEVICEDESC p_HELDesc)
[AI] Initializes instance with device GUID, description strings, and capability structures.
D3DDEVICEDESC m_HELDesc
[AI] Software (HEL) emulation device capability description.
char * m_deviceDesc
[AI] API-provided textual description of device (owned string).
char * m_deviceName
[AI] Unlocalized device name/identifier (owned string).
LPGUID m_guid
[AI] GUID uniquely identifying this 3D device. [AI]
[AI] Represents a display mode with specific resolution and color depth.
[AI] Holds data about a DirectDraw driver including devices and supported display modes.
void Init(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName)
[AI] Initializes or resets the driver's GUID and strings.
MxDriver()
[AI] Constructs an empty MxDriver structure.
LPGUID m_guid
[AI] GUID for this DirectDraw driver (heap-allocated and owned).
char * m_driverName
[AI] Driver name/identifier string (owned).
DDCAPS m_ddCaps
[AI] Capabilities structure as reported by the driver.
list< Direct3DDeviceInfo > m_devices
[AI] List of all Direct3D devices provided by this driver.
~MxDriver()
[AI] Destructor; frees GUID and owned strings.
char * m_driverDesc
[AI] Driver description string (owned).