Skip to content

Commit

Permalink
Update Initialize() return from documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
elishacloud committed Aug 15, 2024
1 parent d88d9ed commit 09e5d70
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 45 deletions.
2 changes: 1 addition & 1 deletion Dllmain/BuildNo.rc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define BUILD_NUMBER 7092
#define BUILD_NUMBER 7093
2 changes: 1 addition & 1 deletion ddraw/IDirect3DDeviceX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ HRESULT m_IDirect3DDeviceX::Initialize(LPDIRECT3D lpd3d, LPGUID lpGUID, LPD3DDEV

if (ProxyDirectXVersion != 1)
{
// The IDirect3DDevice::Initialize method is not implemented in Windows.
// Returns D3D_OK if successful, otherwise it returns an error.
return D3D_OK;
}

Expand Down
4 changes: 2 additions & 2 deletions ddraw/IDirect3DMaterialX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ HRESULT m_IDirect3DMaterialX::Initialize(LPDIRECT3D lplpD3D)

if (ProxyDirectXVersion != 1)
{
// Former stub method. This method was never implemented and is not supported in any interface.
return D3D_OK;
// The method returns DDERR_ALREADYINITIALIZED because the IDirect3DMaterial object is initialized when it is created.
return DDERR_ALREADYINITIALIZED;
}

if (lplpD3D)
Expand Down
4 changes: 2 additions & 2 deletions ddraw/IDirect3DTextureX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ HRESULT m_IDirect3DTextureX::Initialize(LPDIRECT3DDEVICE lpDirect3DDevice, LPDIR

if (ProxyDirectXVersion != 1)
{
// Former stub method. This method was never implemented and is not supported in any interface.
return D3D_OK;
// The method returns DDERR_ALREADYINITIALIZED because the IDirect3DTexture object is initialized when it is created.
return DDERR_ALREADYINITIALIZED;
}

if (lpDirect3DDevice)
Expand Down
4 changes: 2 additions & 2 deletions ddraw/IDirect3DViewportX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ HRESULT m_IDirect3DViewportX::Initialize(LPDIRECT3D lpDirect3D)

if (!ProxyInterface)
{
// The IDirect3DViewport3::Initialize method is not implemented in Windows.
return D3D_OK;
// The method returns DDERR_ALREADYINITIALIZED because the IDirect3DViewport object is initialized when it is created.
return DDERR_ALREADYINITIALIZED;
}

if (lpDirect3D)
Expand Down
4 changes: 2 additions & 2 deletions ddraw/IDirect3DX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ HRESULT m_IDirect3DX::Initialize(REFCLSID rclsid)

if (ProxyDirectXVersion != 1)
{
// Former stub method. This method was never implemented and is not supported in any interface.
return D3D_OK;
// The method returns DDERR_ALREADYINITIALIZED because the IDirect3D object is initialized when it is created.
return DDERR_ALREADYINITIALIZED;
}

return GetProxyInterfaceV1()->Initialize(rclsid);
Expand Down
13 changes: 2 additions & 11 deletions ddraw/IDirectDrawClipper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,17 +215,8 @@ HRESULT m_IDirectDrawClipper::Initialize(LPDIRECTDRAW lpDD, DWORD dwFlags)

if (!ProxyInterface)
{
// ToDo: If you used the DirectDrawCreateClipper function or the IDirectDraw7::CreateClipper method to create the DirectDrawClipper object,
// the IDirectDrawClipper::Initialize method returns DDERR_ALREADYINITIALIZED.
if (IsInitialize)
{
return DDERR_ALREADYINITIALIZED;
}
else
{
IsInitialize = true;
return DD_OK;
}
// Returns D3D_OK if successful, otherwise it returns an error.
return D3D_OK;
}

if (lpDD)
Expand Down
1 change: 0 additions & 1 deletion ddraw/IDirectDrawClipper.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ class m_IDirectDrawClipper : public IDirectDrawClipper, public AddressLookupTabl
IDirectDrawClipper *ProxyInterface = nullptr;
REFIID WrapperID = IID_IDirectDrawClipper;
ULONG RefCount = 1;
bool IsInitialize = false;
DWORD clipperCaps = 0; // Clipper flags
HWND cliphWnd = nullptr;
std::vector<BYTE> ClipList;
Expand Down
2 changes: 1 addition & 1 deletion ddraw/IDirectDrawSurfaceX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5617,7 +5617,7 @@ inline void m_IDirectDrawSurfaceX::InitSurfaceDesc(DWORD DirectXVersion)
(surfaceDesc2.dwFlags & DDSD_MIPMAPCOUNT) && surfaceDesc2.dwMipMapCount > 0)
{
surfaceDesc2.dwFlags |= DDSD_WIDTH | DDSD_HEIGHT;
surfaceDesc2.dwWidth = pow(2, surfaceDesc2.dwMipMapCount - 1);
surfaceDesc2.dwWidth = (DWORD)pow(2, surfaceDesc2.dwMipMapCount - 1);
surfaceDesc2.dwHeight = surfaceDesc2.dwWidth;
}
// Compute mipcount
Expand Down
24 changes: 3 additions & 21 deletions ddraw/IDirectDrawX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1545,31 +1545,13 @@ HRESULT m_IDirectDrawX::Initialize(GUID FAR * lpGUID)

if (Config.Dd7to9)
{
// ToDo: If you already used the DirectDrawCreate function to create a DirectDraw object, this method returns DDERR_ALREADYINITIALIZED.
// If you do not call IDirectDraw7::Initialize when you use CoCreateInstance to create a DirectDraw object, any method that you
// call afterward returns DDERR_NOTINITIALIZED.
if (IsInitialize)
{
return DDERR_ALREADYINITIALIZED;
}
else
{
IsInitialize = true;
return DD_OK;
}
// Returns D3D_OK if successful, otherwise it returns an error.
return D3D_OK;
}

HRESULT hr = ProxyInterface->Initialize(lpGUID);

if (IsInitialize)
{
return hr;
}
else
{
IsInitialize = true;
return (hr == DDERR_ALREADYINITIALIZED) ? DD_OK : hr;
}
return (hr == DDERR_ALREADYINITIALIZED) ? DD_OK : hr;
}

// Resets the mode of the display device hardware for the primary surface to what it was before the IDirectDraw7::SetDisplayMode method was called.
Expand Down
1 change: 0 additions & 1 deletion ddraw/IDirectDrawX.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class m_IDirectDrawX : public IUnknown, public AddressLookupTableDdrawObject
ULONG RefCount4 = 0;
ULONG RefCount7 = 0;

bool IsInitialize = false;
bool Using3D = false;

// Fix exclusive mode issue
Expand Down

0 comments on commit 09e5d70

Please sign in to comment.