Skip to content

Commit

Permalink
Limit scene creation context, ensure scene end
Browse files Browse the repository at this point in the history
  • Loading branch information
Lpsd committed Jan 16, 2025
1 parent 47034c5 commit bb6c882
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Client/gui/CGUI_Impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@ bool CGUI_Impl::ConvertToModernSkin(const char* skinName)
renderManager->CreateRenderTarget(width, std::max(modernImagesetTexture->m_uiSizeY, skinImagesetTexture->m_uiSizeY), false, true, 0, true);

auto device = m_pGraphics->GetDevice();
if (device->BeginScene() != D3D_OK)

if (!m_HasSchemeLoaded && device->BeginScene() != D3D_OK)
{
AddReportLog(1337, "ConvertToModernSkin: Failed to begin scene for imageset drawing");
return false;
Expand All @@ -414,6 +415,12 @@ bool CGUI_Impl::ConvertToModernSkin(const char* skinName)
// Stop draw batch
renderManager->RestoreDefaultRenderTarget();

if (!m_HasSchemeLoaded && device->EndScene() != D3D_OK)
{
AddReportLog(1337, "ConvertToModernSkin: Failed to end scene for imageset drawing");
return false;
}

D3DXSaveTextureToFile(tempImagesetPngPath, D3DXIFF_PNG, renderTarget->m_pD3DTexture, 0);

if (!FileExists(tempImagesetPngPath))
Expand Down

0 comments on commit bb6c882

Please sign in to comment.