imgui_snapshot: check if game is loaded before accessing XDBF

This commit is contained in:
Hyper 2024-12-06 01:29:51 +00:00
parent 2bd80f29b1
commit c3fb9babbb

View file

@ -5,6 +5,7 @@
#include <user/config.h>
#include <decompressor.h>
#include <kernel/xdbf.h>
#include <app.h>
void ImDrawDataSnapshot::Clear()
{
@ -221,14 +222,17 @@ void ImFontAtlasSnapshot::GenerateGlyphRanges()
}
}
for (size_t i = XDBF_LANGUAGE_ENGLISH; i <= XDBF_LANGUAGE_ITALIAN; i++)
if (g_isGameLoaded)
{
auto achievements = g_xdbfWrapper.GetAchievements(static_cast<EXDBFLanguage>(i));
for (auto& achievement : achievements)
for (size_t i = XDBF_LANGUAGE_ENGLISH; i <= XDBF_LANGUAGE_ITALIAN; i++)
{
GetGlyphs(glyphs, achievement.Name);
GetGlyphs(glyphs, achievement.UnlockedDesc);
GetGlyphs(glyphs, achievement.LockedDesc);
auto achievements = g_xdbfWrapper.GetAchievements(static_cast<EXDBFLanguage>(i));
for (auto& achievement : achievements)
{
GetGlyphs(glyphs, achievement.Name);
GetGlyphs(glyphs, achievement.UnlockedDesc);
GetGlyphs(glyphs, achievement.LockedDesc);
}
}
}