diff --git a/overlay_experimental/overlay/steam_overlay.h b/overlay_experimental/overlay/steam_overlay.h index a66d54db..0710d9fd 100644 --- a/overlay_experimental/overlay/steam_overlay.h +++ b/overlay_experimental/overlay/steam_overlay.h @@ -80,6 +80,10 @@ struct Overlay_Achievement uint32 unlock_time; std::weak_ptr icon; std::weak_ptr icon_gray; + + constexpr const static int ICON_LOAD_MAX_TRIALS = 3; + uint8_t icon_load_trials = ICON_LOAD_MAX_TRIALS; + uint8_t icon_gray_load_trials = ICON_LOAD_MAX_TRIALS; }; #ifdef EMU_OVERLAY diff --git a/overlay_experimental/steam_overlay.cpp b/overlay_experimental/steam_overlay.cpp index a0f1c6c7..95786633 100644 --- a/overlay_experimental/steam_overlay.cpp +++ b/overlay_experimental/steam_overlay.cpp @@ -1181,7 +1181,8 @@ void Steam_Overlay::OverlayProc() bool achieved = x.achieved; bool hidden = x.hidden && !achieved; - if (x.icon.expired()) { + if (x.icon.expired() && x.icon_load_trials) { + --x.icon_load_trials; std::string file_path = Local_Storage::get_game_settings_path() + x.icon_name; unsigned long long file_size = file_size_(file_path); if (!file_size) { @@ -1192,10 +1193,12 @@ void Steam_Overlay::OverlayProc() std::string img = Local_Storage::load_image_resized(file_path, "", settings->overlay_appearance.icon_size); if (img.length() > 0) { if (_renderer) x.icon = _renderer->CreateImageResource((void*)img.c_str(), settings->overlay_appearance.icon_size, settings->overlay_appearance.icon_size); + if (!x.icon.expired()) x.icon_load_trials = Overlay_Achievement::ICON_LOAD_MAX_TRIALS; } } } - if (x.icon_gray.expired()) { + if (x.icon_gray.expired() && x.icon_gray_load_trials) { + --x.icon_gray_load_trials; std::string file_path = Local_Storage::get_game_settings_path() + x.icon_gray_name; unsigned long long file_size = file_size_(file_path); if (!file_size) { @@ -1206,6 +1209,7 @@ void Steam_Overlay::OverlayProc() std::string img = Local_Storage::load_image_resized(file_path, "", settings->overlay_appearance.icon_size); if (img.length() > 0) { if (_renderer) x.icon_gray = _renderer->CreateImageResource((void*)img.c_str(), settings->overlay_appearance.icon_size, settings->overlay_appearance.icon_size); + if (!x.icon_gray.expired()) x.icon_gray_load_trials = Overlay_Achievement::ICON_LOAD_MAX_TRIALS; } } } diff --git a/overlay_experimental/windows/DX12_Hook.cpp b/overlay_experimental/windows/DX12_Hook.cpp index 0311cbfb..854ec5b5 100644 --- a/overlay_experimental/windows/DX12_Hook.cpp +++ b/overlay_experimental/windows/DX12_Hook.cpp @@ -182,8 +182,10 @@ void DX12_Hook::_PrepareForOverlay(IDXGISwapChain* pSwapChain, ID3D12CommandQueu { // UINT bufferIndex = pSwapChain3->GetCurrentBackBufferIndex(); pDevice = nullptr; - if (pSwapChain3->GetDevice(IID_PPV_ARGS(&pDevice)) != S_OK) + if (pSwapChain3->GetDevice(IID_PPV_ARGS(&pDevice)) != S_OK) { + pSwapChain3->Release(); return; + } UINT bufferCount = sc_desc.BufferCount; @@ -217,9 +219,9 @@ void DX12_Hook::_PrepareForOverlay(IDXGISwapChain* pSwapChain, ID3D12CommandQueu desc.NodeMask = 1; if (pDevice->CreateDescriptorHeap(&desc, IID_PPV_ARGS(&pRtvDescHeap)) != S_OK) { + pSrvDescHeap->Release(); pDevice->Release(); pSwapChain3->Release(); - pSrvDescHeap->Release(); return; }