mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-12-24 09:24:15 +08:00
don't load images forever to avoid a never ending slowdown
This commit is contained in:
parent
8f62d7d487
commit
0af025ea5d
@ -80,6 +80,10 @@ struct Overlay_Achievement
|
||||
uint32 unlock_time;
|
||||
std::weak_ptr<uint64_t> icon;
|
||||
std::weak_ptr<uint64_t> 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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user