Beta matching in mxdirectxinfo.cpp (#1626)

* Use goto

* Fix constructors

* Reorder error strings

* Compat mode todo

* Rename p_context to p_d

* Use count variable

* Fix typo
This commit is contained in:
MS 2025-07-15 10:43:40 -04:00 committed by GitHub
parent 3b79b4c834
commit 9c9baf3c3e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 182 additions and 173 deletions

View File

@ -29,13 +29,12 @@ MxAssignedDevice::~MxAssignedDevice()
} }
// FUNCTION: BETA10 0x1011d7f0 // FUNCTION: BETA10 0x1011d7f0
MxDriver::MxDriver(LPGUID p_guid) MxDriver::MxDriver()
{ {
m_guid = NULL; m_guid = NULL;
m_driverDesc = NULL; m_driverDesc = NULL;
m_driverName = NULL; m_driverName = NULL;
memset(&m_ddCaps, 0, sizeof(m_ddCaps)); memset(&m_ddCaps, 0, sizeof(m_ddCaps));
// TODO: ret vs ret 4
} }
// FUNCTION: CONFIG 0x00401180 // FUNCTION: CONFIG 0x00401180
@ -98,6 +97,12 @@ void MxDriver::Init(LPGUID p_guid, LPCSTR p_driverDesc, LPCSTR p_driverName)
} }
} }
// FUNCTION: BETA10 0x1011dba4
Direct3DDeviceInfo::Direct3DDeviceInfo()
{
memset(this, 0, sizeof(*this));
}
// FUNCTION: CONFIG 0x401420 // FUNCTION: CONFIG 0x401420
// FUNCTION: LEGO1 0x1009bd20 // FUNCTION: LEGO1 0x1009bd20
// FUNCTION: BETA10 0x1011dbd0 // FUNCTION: BETA10 0x1011dbd0
@ -213,36 +218,37 @@ BOOL MxDeviceEnumerate::EnumDirectDrawCallback(LPGUID p_guid, LPSTR p_driverDesc
if (result != DD_OK) { if (result != DD_OK) {
BuildErrorString("DirectDraw Create failed: %s\n", EnumerateErrorToString(result)); BuildErrorString("DirectDraw Create failed: %s\n", EnumerateErrorToString(result));
} goto done;
else {
lpDD->EnumDisplayModes(0, NULL, this, DisplayModesEnumerateCallback);
newDevice.m_ddCaps.dwSize = sizeof(newDevice.m_ddCaps);
result = lpDD->GetCaps(&newDevice.m_ddCaps, NULL);
if (result != DD_OK) {
BuildErrorString("GetCaps failed: %s\n", EnumerateErrorToString(result));
}
else {
result = lpDD->QueryInterface(IID_IDirect3D2, (LPVOID*) &lpDirect3d2);
if (result != DD_OK) {
BuildErrorString("D3D creation failed: %s\n", EnumerateErrorToString(result));
}
else {
result = lpDirect3d2->EnumDevices(DevicesEnumerateCallback, this);
if (result != DD_OK) {
BuildErrorString("D3D enum devices failed: %s\n", EnumerateErrorToString(result));
}
else {
if (!newDevice.m_devices.size()) {
m_ddInfo.pop_back();
}
}
}
}
} }
lpDD->EnumDisplayModes(0, NULL, this, DisplayModesEnumerateCallback);
newDevice.m_ddCaps.dwSize = sizeof(newDevice.m_ddCaps);
result = lpDD->GetCaps(&newDevice.m_ddCaps, NULL);
if (result != DD_OK) {
BuildErrorString("GetCaps failed: %s\n", EnumerateErrorToString(result));
goto done;
}
result = lpDD->QueryInterface(IID_IDirect3D2, (LPVOID*) &lpDirect3d2);
if (result != DD_OK) {
BuildErrorString("D3D creation failed: %s\n", EnumerateErrorToString(result));
goto done;
}
result = lpDirect3d2->EnumDevices(DevicesEnumerateCallback, this);
if (result != DD_OK) {
BuildErrorString("D3D enum devices failed: %s\n", EnumerateErrorToString(result));
goto done;
}
if (!newDevice.m_devices.size()) {
m_ddInfo.pop_back();
}
done:
if (lpDirect3d2) { if (lpDirect3d2) {
lpDirect3d2->Release(); lpDirect3d2->Release();
} }
@ -263,7 +269,7 @@ void MxDeviceEnumerate::BuildErrorString(const char* p_format, ...)
char buf[512]; char buf[512];
va_start(args, p_format); va_start(args, p_format);
vsprintf(buf, p_format, args); int count = vsprintf(buf, p_format, args);
va_end(args); va_end(args);
OutputDebugString(buf); OutputDebugString(buf);
@ -272,13 +278,10 @@ void MxDeviceEnumerate::BuildErrorString(const char* p_format, ...)
// FUNCTION: CONFIG 0x00401bf0 // FUNCTION: CONFIG 0x00401bf0
// FUNCTION: LEGO1 0x1009c4f0 // FUNCTION: LEGO1 0x1009c4f0
// FUNCTION: BETA10 0x1011e1dd // FUNCTION: BETA10 0x1011e1dd
HRESULT CALLBACK MxDeviceEnumerate::DisplayModesEnumerateCallback(LPDDSURFACEDESC p_ddsd, LPVOID p_context) HRESULT CALLBACK MxDeviceEnumerate::DisplayModesEnumerateCallback(LPDDSURFACEDESC p_ddsd, LPVOID p_d)
{ {
if (p_context == NULL) { assert(p_d);
assert(0); return ((MxDeviceEnumerate*) p_d)->EnumDisplayModesCallback(p_ddsd);
}
return ((MxDeviceEnumerate*) p_context)->EnumDisplayModesCallback(p_ddsd);
} }
// FUNCTION: CONFIG 0x00401c10 // FUNCTION: CONFIG 0x00401c10
@ -290,15 +293,14 @@ HRESULT CALLBACK MxDeviceEnumerate::DevicesEnumerateCallback(
LPSTR p_deviceName, LPSTR p_deviceName,
LPD3DDEVICEDESC p_HWDesc, LPD3DDEVICEDESC p_HWDesc,
LPD3DDEVICEDESC p_HELDesc, LPD3DDEVICEDESC p_HELDesc,
LPVOID p_context LPVOID p_d
) )
{ {
if (p_context == NULL) { if (p_d == NULL) {
assert(0); assert(0);
} }
return ((MxDeviceEnumerate*) p_context) return ((MxDeviceEnumerate*) p_d)->EnumDevicesCallback(p_guid, p_deviceDesc, p_deviceName, p_HWDesc, p_HELDesc);
->EnumDevicesCallback(p_guid, p_deviceDesc, p_deviceName, p_HWDesc, p_HELDesc);
} }
// FUNCTION: CONFIG 0x00401c40 // FUNCTION: CONFIG 0x00401c40
@ -309,9 +311,15 @@ HRESULT MxDeviceEnumerate::EnumDisplayModesCallback(LPDDSURFACEDESC p_ddsd)
assert(m_ddInfo.size() > 0); assert(m_ddInfo.size() > 0);
assert(p_ddsd); assert(p_ddsd);
// TODO: compat_mode? #ifdef COMPAT_MODE
MxDisplayMode displayMode(p_ddsd->dwWidth, p_ddsd->dwHeight, p_ddsd->ddpfPixelFormat.dwRGBBitCount); MxDisplayMode displayMode(p_ddsd->dwWidth, p_ddsd->dwHeight, p_ddsd->ddpfPixelFormat.dwRGBBitCount);
m_ddInfo.back().m_displayModes.push_back(displayMode); m_ddInfo.back().m_displayModes.push_back(displayMode);
#else
m_ddInfo.back().m_displayModes.push_back(
MxDisplayMode(p_ddsd->dwWidth, p_ddsd->dwHeight, p_ddsd->ddpfPixelFormat.dwRGBBitCount)
);
#endif
return DDENUMRET_OK; return DDENUMRET_OK;
} }
@ -355,13 +363,10 @@ int MxDeviceEnumerate::DoEnumerate()
// FUNCTION: LEGO1 0x1009c710 // FUNCTION: LEGO1 0x1009c710
// FUNCTION: BETA10 0x1011e476 // FUNCTION: BETA10 0x1011e476
BOOL CALLBACK BOOL CALLBACK
MxDeviceEnumerate::DirectDrawEnumerateCallback(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName, LPVOID p_context) MxDeviceEnumerate::DirectDrawEnumerateCallback(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName, LPVOID p_d)
{ {
if (p_context == NULL) { assert(p_d);
assert(0); return ((MxDeviceEnumerate*) p_d)->EnumDirectDrawCallback(p_guid, p_driverDesc, p_driverName);
}
return ((MxDeviceEnumerate*) p_context)->EnumDirectDrawCallback(p_guid, p_driverDesc, p_driverName);
} }
// FUNCTION: CONFIG 0x00401e30 // FUNCTION: CONFIG 0x00401e30
@ -372,79 +377,123 @@ const char* MxDeviceEnumerate::EnumerateErrorToString(HRESULT p_error)
switch (p_error) { switch (p_error) {
case DD_OK: case DD_OK:
return "No error."; return "No error.";
case DDERR_GENERIC:
return "Generic failure.";
case DDERR_UNSUPPORTED:
return "Action not supported.";
case DDERR_INVALIDPARAMS:
return "One or more of the parameters passed to the function are incorrect.";
case DDERR_OUTOFMEMORY:
return "DirectDraw does not have enough memory to perform the operation.";
case DDERR_CANNOTATTACHSURFACE:
return "This surface can not be attached to the requested surface.";
case DDERR_ALREADYINITIALIZED: case DDERR_ALREADYINITIALIZED:
return "This object is already initialized."; return "This object is already initialized.";
case DDERR_CURRENTLYNOTAVAIL: case DDERR_BLTFASTCANTCLIP:
return "Support is currently not available."; return "Return if a clipper object is attached to the source surface passed into a BltFast call.";
case DDERR_CANNOTATTACHSURFACE:
return "This surface can not be attached to the requested surface.";
case DDERR_CANNOTDETACHSURFACE: case DDERR_CANNOTDETACHSURFACE:
return "This surface can not be detached from the requested surface."; return "This surface can not be detached from the requested surface.";
case DDERR_HEIGHTALIGN: case DDERR_CANTCREATEDC:
return "Height of rectangle provided is not a multiple of reqd alignment."; return "Windows can not create any more DCs.";
case DDERR_CANTDUPLICATE:
return "Can't duplicate primary & 3D surfaces, or surfaces that are implicitly created.";
case DDERR_CLIPPERISUSINGHWND:
return "An attempt was made to set a cliplist for a clipper object that is already monitoring an hwnd.";
case DDERR_COLORKEYNOTSET:
return "No src color key specified for this operation.";
case DDERR_CURRENTLYNOTAVAIL:
return "Support is currently not available.";
case DDERR_DIRECTDRAWALREADYCREATED:
return "A DirectDraw object representing this driver has already been created for this process.";
case DDERR_EXCEPTION: case DDERR_EXCEPTION:
return "An exception was encountered while performing the requested operation."; return "An exception was encountered while performing the requested operation.";
case DDERR_INVALIDCAPS: case DDERR_EXCLUSIVEMODEALREADYSET:
return "One or more of the caps bits passed to the callback are incorrect."; return "An attempt was made to set the cooperative level when it was already set to exclusive.";
case DDERR_GENERIC:
return "Generic failure.";
case DDERR_HEIGHTALIGN:
return "Height of rectangle provided is not a multiple of reqd alignment.";
case DDERR_HWNDALREADYSET:
return "The CooperativeLevel HWND has already been set. It can not be reset while the process has surfaces or "
"palettes created.";
case DDERR_HWNDSUBCLASSED:
return "HWND used by DirectDraw CooperativeLevel has been subclassed, this prevents DirectDraw from restoring "
"state.";
case DDERR_IMPLICITLYCREATED:
return "This surface can not be restored because it is an implicitly created surface.";
case DDERR_INCOMPATIBLEPRIMARY: case DDERR_INCOMPATIBLEPRIMARY:
return "Unable to match primary surface creation request with existing primary surface."; return "Unable to match primary surface creation request with existing primary surface.";
case DDERR_INVALIDMODE: case DDERR_INVALIDCAPS:
return "DirectDraw does not support the requested mode."; return "One or more of the caps bits passed to the callback are incorrect.";
case DDERR_INVALIDCLIPLIST: case DDERR_INVALIDCLIPLIST:
return "DirectDraw does not support the provided cliplist."; return "DirectDraw does not support the provided cliplist.";
case DDERR_INVALIDPIXELFORMAT: case DDERR_INVALIDDIRECTDRAWGUID:
return "The pixel format was invalid as specified."; return "The GUID passed to DirectDrawCreate is not a valid DirectDraw driver identifier.";
case DDERR_INVALIDMODE:
return "DirectDraw does not support the requested mode.";
case DDERR_INVALIDOBJECT: case DDERR_INVALIDOBJECT:
return "DirectDraw received a pointer that was an invalid DIRECTDRAW object."; return "DirectDraw received a pointer that was an invalid DIRECTDRAW object.";
case DDERR_LOCKEDSURFACES: case DDERR_INVALIDPARAMS:
return "Operation could not be carried out because one or more surfaces are locked."; return "One or more of the parameters passed to the function are incorrect.";
case DDERR_INVALIDPIXELFORMAT:
return "The pixel format was invalid as specified.";
case DDERR_INVALIDPOSITION:
return "Returned when the position of the overlay on the destination is no longer legal for that "
"destination.";
case DDERR_INVALIDRECT: case DDERR_INVALIDRECT:
return "Rectangle provided was invalid."; return "Rectangle provided was invalid.";
case DDERR_LOCKEDSURFACES:
return "Operation could not be carried out because one or more surfaces are locked.";
case DDERR_NO3D:
return "There is no 3D present.";
case DDERR_NOALPHAHW: case DDERR_NOALPHAHW:
return "Operation could not be carried out because there is no alpha accleration hardware present or " return "Operation could not be carried out because there is no alpha accleration hardware present or "
"available."; "available.";
case DDERR_NO3D: case DDERR_NOBLTHW:
return "There is no 3D present."; return "No blitter hardware present.";
case DDERR_NOCOLORCONVHW:
return "Operation could not be carried out because there is no color conversion hardware present or available.";
case DDERR_NOCLIPLIST: case DDERR_NOCLIPLIST:
return "No cliplist available."; return "No cliplist available.";
case DDERR_NOCLIPPERATTACHED:
return "No clipper object attached to surface object.";
case DDERR_NOCOLORCONVHW:
return "Operation could not be carried out because there is no color conversion hardware present or "
"available.";
case DDERR_NOCOLORKEY: case DDERR_NOCOLORKEY:
return "Surface doesn't currently have a color key"; return "Surface doesn't currently have a color key";
case DDERR_NOCOLORKEYHW:
return "Operation could not be carried out because there is no hardware support of the destination color "
"key.";
case DDERR_NOCOOPERATIVELEVELSET: case DDERR_NOCOOPERATIVELEVELSET:
return "Create function called without DirectDraw object method SetCooperativeLevel being called."; return "Create function called without DirectDraw object method SetCooperativeLevel being called.";
case DDERR_NODC:
return "No DC was ever created for this surface.";
case DDERR_NODDROPSHW:
return "No DirectDraw ROP hardware.";
case DDERR_NODIRECTDRAWHW:
return "A hardware-only DirectDraw object creation was attempted but the driver did not support any "
"hardware.";
case DDERR_NOEMULATION:
return "Software emulation not available.";
case DDERR_NOEXCLUSIVEMODE: case DDERR_NOEXCLUSIVEMODE:
return "Operation requires the application to have exclusive mode but the application does not have exclusive " return "Operation requires the application to have exclusive mode but the application does not have exclusive "
"mode."; "mode.";
case DDERR_NOCOLORKEYHW:
return "Operation could not be carried out because there is no hardware support of the destination color key.";
case DDERR_NOGDI:
return "There is no GDI present.";
case DDERR_NOFLIPHW: case DDERR_NOFLIPHW:
return "Flipping visible surfaces is not supported."; return "Flipping visible surfaces is not supported.";
case DDERR_NOTFOUND: case DDERR_NOGDI:
return "Requested item was not found."; return "There is no GDI present.";
case DDERR_NOHWND:
return "Clipper notification requires an HWND or no HWND has previously been set as the CooperativeLevel "
"HWND.";
case DDERR_NOMIRRORHW: case DDERR_NOMIRRORHW:
return "Operation could not be carried out because there is no hardware present or available."; return "Operation could not be carried out because there is no hardware present or available.";
case DDERR_NOOVERLAYDEST:
return "Returned when GetOverlayPosition is called on an overlay that UpdateOverlay has never been called on "
"to establish a destination.";
case DDERR_NOOVERLAYHW:
return "Operation could not be carried out because there is no overlay hardware present or available.";
case DDERR_NOPALETTEATTACHED:
return "No palette object attached to this surface.";
case DDERR_NOPALETTEHW:
return "No hardware support for 16 or 256 color palettes.";
case DDERR_NORASTEROPHW: case DDERR_NORASTEROPHW:
return "Operation could not be carried out because there is no appropriate raster op hardware present or " return "Operation could not be carried out because there is no appropriate raster op hardware present or "
"available."; "available.";
case DDERR_NOOVERLAYHW:
return "Operation could not be carried out because there is no overlay hardware present or available.";
case DDERR_NOSTRETCHHW:
return "Operation could not be carried out because there is no hardware support for stretching.";
case DDERR_NOROTATIONHW: case DDERR_NOROTATIONHW:
return "Operation could not be carried out because there is no rotation hardware present or available."; return "Operation could not be carried out because there is no rotation hardware present or available.";
case DDERR_NOTEXTUREHW: case DDERR_NOSTRETCHHW:
return "Operation could not be carried out because there is no texture mapping hardware present or available."; return "Operation could not be carried out because there is no hardware support for stretching.";
case DDERR_NOT4BITCOLOR: case DDERR_NOT4BITCOLOR:
return "DirectDrawSurface is not in 4 bit color palette and the requested operation requires 4 bit color " return "DirectDrawSurface is not in 4 bit color palette and the requested operation requires 4 bit color "
"palette."; "palette.";
@ -453,118 +502,80 @@ const char* MxDeviceEnumerate::EnumerateErrorToString(HRESULT p_error)
"index palette."; "index palette.";
case DDERR_NOT8BITCOLOR: case DDERR_NOT8BITCOLOR:
return "DirectDrawSurface is not in 8 bit color mode and the requested operation requires 8 bit color."; return "DirectDrawSurface is not in 8 bit color mode and the requested operation requires 8 bit color.";
case DDERR_NOZBUFFERHW: case DDERR_NOTAOVERLAYSURFACE:
return "Operation could not be carried out because there is no hardware support for zbuffer blitting."; return "Returned when an overlay member is called for a non-overlay surface.";
case DDERR_NOTEXTUREHW:
return "Operation could not be carried out because there is no texture mapping hardware present or "
"available.";
case DDERR_NOTFLIPPABLE:
return "An attempt has been made to flip a surface that is not flippable.";
case DDERR_NOTFOUND:
return "Requested item was not found.";
case DDERR_NOTLOCKED:
return "Surface was not locked. An attempt to unlock a surface that was not locked at all, or by this "
"process, has been attempted.";
case DDERR_NOTPALETTIZED:
return "The surface being used is not a palette-based surface.";
case DDERR_NOVSYNCHW: case DDERR_NOVSYNCHW:
return "Operation could not be carried out because there is no hardware support for vertical blank " return "Operation could not be carried out because there is no hardware support for vertical blank "
"synchronized operations."; "synchronized operations.";
case DDERR_OUTOFCAPS: case DDERR_NOZBUFFERHW:
return "The hardware needed for the requested operation has already been allocated."; return "Operation could not be carried out because there is no hardware support for zbuffer blitting.";
case DDERR_NOZOVERLAYHW: case DDERR_NOZOVERLAYHW:
return "Overlay surfaces could not be z layered based on their BltOrder because the hardware does not support " return "Overlay surfaces could not be z layered based on their BltOrder because the hardware does not support "
"z layering of overlays."; "z layering of overlays.";
case DDERR_COLORKEYNOTSET: case DDERR_OUTOFCAPS:
return "No src color key specified for this operation."; return "The hardware needed for the requested operation has already been allocated.";
case DDERR_OUTOFMEMORY:
return "DirectDraw does not have enough memory to perform the operation.";
case DDERR_OUTOFVIDEOMEMORY: case DDERR_OUTOFVIDEOMEMORY:
return "DirectDraw does not have enough memory to perform the operation."; return "DirectDraw does not have enough memory to perform the operation.";
case DDERR_OVERLAYCANTCLIP: case DDERR_OVERLAYCANTCLIP:
return "The hardware does not support clipped overlays."; return "The hardware does not support clipped overlays.";
case DDERR_OVERLAYCOLORKEYONLYONEACTIVE: case DDERR_OVERLAYCOLORKEYONLYONEACTIVE:
return "Can only have ony color key active at one time for overlays."; return "Can only have ony color key active at one time for overlays.";
case DDERR_OVERLAYNOTVISIBLE:
return "Returned when GetOverlayPosition is called on a hidden overlay.";
case DDERR_PALETTEBUSY: case DDERR_PALETTEBUSY:
return "Access to this palette is being refused because the palette is already locked by another thread."; return "Access to this palette is being refused because the palette is already locked by another thread.";
case DDERR_SURFACEALREADYDEPENDENT: case DDERR_PRIMARYSURFACEALREADYEXISTS:
return "This surface is already a dependency of the surface it is being made a dependency of."; return "This process already has created a primary surface.";
case DDERR_REGIONTOOSMALL:
return "Region passed to Clipper::GetClipList is too small.";
case DDERR_SURFACEALREADYATTACHED: case DDERR_SURFACEALREADYATTACHED:
return "This surface is already attached to the surface it is being attached to."; return "This surface is already attached to the surface it is being attached to.";
case DDERR_SURFACEISOBSCURED: case DDERR_SURFACEALREADYDEPENDENT:
return "Access to surface refused because the surface is obscured."; return "This surface is already a dependency of the surface it is being made a dependency of.";
case DDERR_SURFACEBUSY: case DDERR_SURFACEBUSY:
return "Access to this surface is being refused because the surface is already locked by another thread."; return "Access to this surface is being refused because the surface is already locked by another thread.";
case DDERR_SURFACENOTATTACHED: case DDERR_SURFACEISOBSCURED:
return "The requested surface is not attached."; return "Access to surface refused because the surface is obscured.";
case DDERR_SURFACELOST: case DDERR_SURFACELOST:
return "Access to this surface is being refused because the surface memory is gone. The DirectDrawSurface " return "Access to this surface is being refused because the surface memory is gone. The DirectDrawSurface "
"object representing this surface should have Restore called on it."; "object representing this surface should have Restore called on it.";
case DDERR_TOOBIGSIZE: case DDERR_SURFACENOTATTACHED:
return "Size requested by DirectDraw is too large, but the individual height and width are OK."; return "The requested surface is not attached.";
case DDERR_TOOBIGHEIGHT: case DDERR_TOOBIGHEIGHT:
return "Height requested by DirectDraw is too large."; return "Height requested by DirectDraw is too large.";
case DDERR_UNSUPPORTEDFORMAT: case DDERR_TOOBIGSIZE:
return "FOURCC format requested is unsupported by DirectDraw."; return "Size requested by DirectDraw is too large, but the individual height and width are OK.";
case DDERR_TOOBIGWIDTH: case DDERR_TOOBIGWIDTH:
return "Width requested by DirectDraw is too large."; return "Width requested by DirectDraw is too large.";
case DDERR_VERTICALBLANKINPROGRESS: case DDERR_UNSUPPORTED:
return "Vertical blank is in progress."; return "Action not supported.";
case DDERR_UNSUPPORTEDFORMAT:
return "FOURCC format requested is unsupported by DirectDraw.";
case DDERR_UNSUPPORTEDMASK: case DDERR_UNSUPPORTEDMASK:
return "Bitmask in the pixel format requested is unsupported by DirectDraw."; return "Bitmask in the pixel format requested is unsupported by DirectDraw.";
case DDERR_XALIGN: case DDERR_VERTICALBLANKINPROGRESS:
return "Rectangle provided was not horizontally aligned on required boundary."; return "Vertical blank is in progress.";
case DDERR_WASSTILLDRAWING: case DDERR_WASSTILLDRAWING:
return "Informs DirectDraw that the previous Blt which is transfering information to or from this Surface is " return "Informs DirectDraw that the previous Blt which is transfering information to or from this Surface is "
"incomplete."; "incomplete.";
case DDERR_INVALIDDIRECTDRAWGUID:
return "The GUID passed to DirectDrawCreate is not a valid DirectDraw driver identifier.";
case DDERR_DIRECTDRAWALREADYCREATED:
return "A DirectDraw object representing this driver has already been created for this process.";
case DDERR_NODIRECTDRAWHW:
return "A hardware-only DirectDraw object creation was attempted but the driver did not support any hardware.";
case DDERR_PRIMARYSURFACEALREADYEXISTS:
return "This process already has created a primary surface.";
case DDERR_NOEMULATION:
return "Software emulation not available.";
case DDERR_REGIONTOOSMALL:
return "Region passed to Clipper::GetClipList is too small.";
case DDERR_CLIPPERISUSINGHWND:
return "An attempt was made to set a cliplist for a clipper object that is already monitoring an hwnd.";
case DDERR_NOCLIPPERATTACHED:
return "No clipper object attached to surface object.";
case DDERR_NOHWND:
return "Clipper notification requires an HWND or no HWND has previously been set as the CooperativeLevel HWND.";
case DDERR_HWNDSUBCLASSED:
return "HWND used by DirectDraw CooperativeLevel has been subclassed, this prevents DirectDraw from restoring "
"state.";
case DDERR_HWNDALREADYSET:
return "The CooperativeLevel HWND has already been set. It can not be reset while the process has surfaces or "
"palettes created.";
case DDERR_NOPALETTEATTACHED:
return "No palette object attached to this surface.";
case DDERR_NOPALETTEHW:
return "No hardware support for 16 or 256 color palettes.";
case DDERR_BLTFASTCANTCLIP:
return "Return if a clipper object is attached to the source surface passed into a BltFast call.";
case DDERR_NOBLTHW:
return "No blitter hardware present.";
case DDERR_NODDROPSHW:
return "No DirectDraw ROP hardware.";
case DDERR_OVERLAYNOTVISIBLE:
return "Returned when GetOverlayPosition is called on a hidden overlay.";
case DDERR_NOOVERLAYDEST:
return "Returned when GetOverlayPosition is called on an overlay that UpdateOverlay has never been called on "
"to establish a destination.";
case DDERR_INVALIDPOSITION:
return "Returned when the position of the overlay on the destination is no longer legal for that destination.";
case DDERR_NOTAOVERLAYSURFACE:
return "Returned when an overlay member is called for a non-overlay surface.";
case DDERR_EXCLUSIVEMODEALREADYSET:
return "An attempt was made to set the cooperative level when it was already set to exclusive.";
case DDERR_NOTFLIPPABLE:
return "An attempt has been made to flip a surface that is not flippable.";
case DDERR_CANTDUPLICATE:
return "Can't duplicate primary & 3D surfaces, or surfaces that are implicitly created.";
case DDERR_NOTLOCKED:
return "Surface was not locked. An attempt to unlock a surface that was not locked at all, or by this "
"process, has been attempted.";
case DDERR_CANTCREATEDC:
return "Windows can not create any more DCs.";
case DDERR_NODC:
return "No DC was ever created for this surface.";
case DDERR_WRONGMODE: case DDERR_WRONGMODE:
return "This surface can not be restored because it was created in a different mode."; return "This surface can not be restored because it was created in a different mode.";
case DDERR_IMPLICITLYCREATED: case DDERR_XALIGN:
return "This surface can not be restored because it is an implicitly created surface."; return "Rectangle provided was not horizontally aligned on required boundary.";
case DDERR_NOTPALETTIZED:
return "The surface being used is not a palette-based surface.";
default: default:
return "Unrecognized error value."; return "Unrecognized error value.";
} }

View File

@ -63,7 +63,7 @@ private:
// SIZE 0x1a4 // SIZE 0x1a4
struct Direct3DDeviceInfo { struct Direct3DDeviceInfo {
Direct3DDeviceInfo() {} Direct3DDeviceInfo();
~Direct3DDeviceInfo(); ~Direct3DDeviceInfo();
Direct3DDeviceInfo( Direct3DDeviceInfo(
LPGUID p_guid, LPGUID p_guid,
@ -112,9 +112,8 @@ struct MxDisplayMode {
// SIZE 0x190 // SIZE 0x190
struct MxDriver { struct MxDriver {
MxDriver() {} MxDriver();
~MxDriver(); ~MxDriver();
MxDriver(LPGUID p_guid);
MxDriver(LPGUID p_guid, LPCSTR p_driverDesc, LPCSTR p_driverName); MxDriver(LPGUID p_guid, LPCSTR p_driverDesc, LPCSTR p_driverName);
void Init(LPGUID p_guid, LPCSTR p_driverDesc, LPCSTR p_driverName); void Init(LPGUID p_guid, LPCSTR p_driverDesc, LPCSTR p_driverName);
@ -205,16 +204,15 @@ public:
); );
const char* EnumerateErrorToString(HRESULT p_error); const char* EnumerateErrorToString(HRESULT p_error);
static void BuildErrorString(const char*, ...); static void BuildErrorString(const char*, ...);
static BOOL CALLBACK static BOOL CALLBACK DirectDrawEnumerateCallback(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName, LPVOID p_d);
DirectDrawEnumerateCallback(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName, LPVOID p_context); static HRESULT CALLBACK DisplayModesEnumerateCallback(LPDDSURFACEDESC p_ddsd, LPVOID p_d);
static HRESULT CALLBACK DisplayModesEnumerateCallback(LPDDSURFACEDESC p_ddsd, LPVOID p_context);
static HRESULT CALLBACK DevicesEnumerateCallback( static HRESULT CALLBACK DevicesEnumerateCallback(
LPGUID p_guid, LPGUID p_guid,
LPSTR p_deviceDesc, LPSTR p_deviceDesc,
LPSTR p_deviceName, LPSTR p_deviceName,
LPD3DDEVICEDESC p_HWDesc, LPD3DDEVICEDESC p_HWDesc,
LPD3DDEVICEDESC p_HELDesc, LPD3DDEVICEDESC p_HELDesc,
LPVOID p_context LPVOID p_d
); );
friend class MxDirect3D; friend class MxDirect3D;