fixes crash due to having too many trophies

The game 'My Name is Mayo' has so many trophies in sequence that when overlapping them, the emulator ended up crashing, so if there is something on the screen and a new trophies are achieved, it will clear and show the new one.
This commit is contained in:
DanielSvoboda 2025-02-26 02:15:48 -03:00
parent cd70f33ee6
commit a18c594b6c

View File

@ -183,13 +183,20 @@ void AddTrophyToQueue(const std::filesystem::path& trophyIconPath, const std::st
if (Config::getisTrophyPopupDisabled()) { if (Config::getisTrophyPopupDisabled()) {
return; return;
} else if (current_trophy_ui.has_value()) { } else if (current_trophy_ui.has_value()) {
TrophyInfo new_trophy; current_trophy_ui.reset();
new_trophy.trophy_icon_path = trophyIconPath; }
new_trophy.trophy_name = trophyName;
new_trophy.trophy_type = rarity; TrophyInfo new_trophy;
trophy_queue.push(new_trophy); new_trophy.trophy_icon_path = trophyIconPath;
} else { new_trophy.trophy_name = trophyName;
current_trophy_ui.emplace(trophyIconPath, trophyName, rarity); new_trophy.trophy_type = rarity;
trophy_queue.push(new_trophy);
if (!current_trophy_ui.has_value()) {
TrophyInfo next_trophy = trophy_queue.front();
trophy_queue.pop();
current_trophy_ui.emplace(next_trophy.trophy_icon_path, next_trophy.trophy_name,
next_trophy.trophy_type);
} }
} }