overlays/icon: Handle some edge cases

This commit is contained in:
kd-11 2026-03-11 01:03:33 +03:00 committed by kd-11
parent 9e6fecb4ca
commit 6cf2cc67d3
2 changed files with 13 additions and 1 deletions

View file

@ -6,11 +6,15 @@
namespace rsx::overlays::home_menu
{
std::unordered_map<fa_icon, std::unique_ptr<image_info>> g_icons_cache;
std::mutex g_icons_cache_lock;
static const char* fa_icon_to_filename(fa_icon icon)
{
switch (icon)
{
default:
case fa_icon::none:
return "";
case fa_icon::home:
return "home.png";
case fa_icon::settings:
@ -47,6 +51,13 @@ namespace rsx::overlays::home_menu
const image_info* get_icon(fa_icon icon)
{
if (icon == fa_icon::none)
{
return nullptr;
}
std::lock_guard lock(g_icons_cache_lock);
auto found = g_icons_cache.find(icon);
if (found != g_icons_cache.end())
{

View file

@ -7,7 +7,8 @@ namespace rsx::overlays::home_menu
{
enum class fa_icon
{
home = 0,
none = 0,
home,
settings,
back,
floppy,