Achievements: Fix UI crash with DX11

This commit is contained in:
Stenzek 2023-09-24 21:27:55 +10:00 committed by Connor McLaughlin
parent e782ddc143
commit 1eed8a2a86
2 changed files with 9 additions and 8 deletions

View File

@ -21,6 +21,7 @@
#include "CDVD/CDVD.h"
#include "Elfheader.h"
#include "Host.h"
#include "GS/Renderers/Common/GSTexture.h"
#include "ImGui/FullscreenUI.h"
#include "ImGui/ImGuiFullscreen.h"
#include "ImGui/ImGuiManager.h"
@ -1881,7 +1882,7 @@ void Achievements::DrawGameOverlays()
GSTexture* badge = ImGuiFullscreen::GetCachedTextureAsync(indicator.badge_path.c_str());
if (badge)
{
dl->AddImage(badge, current_position, current_position + image_size, ImVec2(0.0f, 0.0f), ImVec2(1.0f, 1.0f), col);
dl->AddImage(badge->GetNativeHandle(), current_position, current_position + image_size, ImVec2(0.0f, 0.0f), ImVec2(1.0f, 1.0f), col);
current_position.x -= x_advance;
}
@ -1921,7 +1922,7 @@ void Achievements::DrawGameOverlays()
if (badge)
{
const ImVec2 badge_pos = box_min + ImVec2(padding, padding);
dl->AddImage(badge, badge_pos, badge_pos + image_size, ImVec2(0.0f, 0.0f), ImVec2(1.0f, 1.0f), col);
dl->AddImage(badge->GetNativeHandle(), badge_pos, badge_pos + image_size, ImVec2(0.0f, 0.0f), ImVec2(1.0f, 1.0f), col);
}
const ImVec2 text_pos = box_min + ImVec2(padding + image_size.x + spacing, (box_max.y - box_min.y - text_size.y) * 0.5f);
@ -2019,7 +2020,7 @@ void Achievements::DrawPauseMenuOverlays()
if (!badge)
continue;
dl->AddImage(badge, position, position + image_size);
dl->AddImage(badge->GetNativeHandle(), position, position + image_size);
const char* achievement_title = indicator.achievement->title;
const char* achievement_title_end = achievement_title + std::strlen(indicator.achievement->title);
@ -2110,7 +2111,7 @@ void Achievements::DrawAchievementsWindow()
if (badge)
{
ImGui::GetWindowDrawList()->AddImage(
badge, icon_min, icon_max, ImVec2(0.0f, 0.0f), ImVec2(1.0f, 1.0f), IM_COL32(255, 255, 255, 255));
badge->GetNativeHandle(), icon_min, icon_max, ImVec2(0.0f, 0.0f), ImVec2(1.0f, 1.0f), IM_COL32(255, 255, 255, 255));
}
}
@ -2273,7 +2274,7 @@ void Achievements::DrawAchievement(const rc_client_achievement_t* cheevo)
if (badge)
{
ImGui::GetWindowDrawList()->AddImage(
badge, bb.Min, bb.Min + image_size, ImVec2(0.0f, 0.0f), ImVec2(1.0f, 1.0f), IM_COL32(255, 255, 255, 255));
badge->GetNativeHandle(), bb.Min, bb.Min + image_size, ImVec2(0.0f, 0.0f), ImVec2(1.0f, 1.0f), IM_COL32(255, 255, 255, 255));
}
}
@ -2421,7 +2422,7 @@ void Achievements::DrawLeaderboardsWindow()
if (badge)
{
ImGui::GetWindowDrawList()->AddImage(
badge, icon_min, icon_max, ImVec2(0.0f, 0.0f), ImVec2(1.0f, 1.0f), IM_COL32(255, 255, 255, 255));
badge->GetNativeHandle(), icon_min, icon_max, ImVec2(0.0f, 0.0f), ImVec2(1.0f, 1.0f), IM_COL32(255, 255, 255, 255));
}
}
@ -2712,7 +2713,7 @@ void Achievements::DrawLeaderboardEntry(const rc_client_leaderboard_entry_t& ent
if (icon_tex)
{
ImGui::GetWindowDrawList()->AddImage(
reinterpret_cast<ImTextureID>(icon_tex), icon_bb.Min, icon_bb.Min + ImVec2(icon_size, icon_size));
icon_tex->GetNativeHandle(), icon_bb.Min, icon_bb.Min + ImVec2(icon_size, icon_size));
}
const ImRect user_bb(ImVec2(text_start_x + column_spacing + icon_size, bb.Min.y), ImVec2(bb.Max.x, midpoint));

View File

@ -2512,7 +2512,7 @@ void ImGuiFullscreen::DrawNotifications(ImVec2& position, float spacing)
GSTexture* tex = GetCachedTexture(notif.badge_path.c_str());
if (tex)
{
dl->AddImage(tex, badge_min, badge_max, ImVec2(0.0f, 0.0f), ImVec2(1.0f, 1.0f),
dl->AddImage(tex->GetNativeHandle(), badge_min, badge_max, ImVec2(0.0f, 0.0f), ImVec2(1.0f, 1.0f),
IM_COL32(255, 255, 255, opacity));
}
}