Add DataContext for data cleanup, add cache invalidation at boot.

This commit is contained in:
J-D-K
2025-08-15 15:43:03 -04:00
parent 74892e169f
commit ba6ad3f20d
12 changed files with 452 additions and 297 deletions

View File

@@ -1,19 +1,26 @@
#include "appstates/DataLoadingState.hpp"
#include "appstates/FadeState.hpp"
#include "colors.hpp"
#include "logger.hpp"
namespace
{
constexpr int SCREEN_CENTER = 640;
}
DataLoadingState::~DataLoadingState() { DataLoadingState::execute_destructs(); }
DataLoadingState::~DataLoadingState()
{
// This is to catch stragglers.
m_context.process_icon_queue();
if (m_destructFunction) { m_destructFunction(); }
}
void DataLoadingState::update()
{
static constexpr int SCREEN_CENTER = 640;
m_context.process_icon_queue();
BaseTask::update();
const std::string status = m_task->get_status();
const int statusWidth = sdl::text::get_width(22, status);
@@ -32,16 +39,6 @@ void DataLoadingState::render()
BaseTask::render_loading_glyph();
}
void DataLoadingState::execute_destructs()
{
for (auto &function : m_destructFunctions) { function(); }
}
void DataLoadingState::add_destruct_function(DataLoadingState::DestructFunction function)
{
m_destructFunctions.push_back(function);
}
void DataLoadingState::initialize_static_members()
{
if (sm_jksvIcon) { return; }