From b372d78b7d375a93b603a9a9b2e6433468c0b5bb Mon Sep 17 00:00:00 2001 From: Maschell Date: Fri, 10 May 2024 15:41:40 +0200 Subject: [PATCH] Add "saving config" screen to the config menu --- source/utils/config/ConfigUtils.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/utils/config/ConfigUtils.cpp b/source/utils/config/ConfigUtils.cpp index f355023..35125b5 100644 --- a/source/utils/config/ConfigUtils.cpp +++ b/source/utils/config/ConfigUtils.cpp @@ -160,6 +160,7 @@ void ConfigUtils::displayMenu() { gOnlyAcceptFromThread = OSGetCurrentThread(); while (true) { + startTime = OSGetTime(); if (gConfigMenuShouldClose) { gConfigMenuShouldClose = false; break; @@ -212,6 +213,9 @@ void ConfigUtils::displayMenu() { } } + startTime = OSGetTime(); + renderBasicScreen("Saving configs..."); + for (const auto &plugin : gLoadedPlugins) { const auto configData = plugin.getConfigData(); if (configData) { @@ -224,6 +228,12 @@ void ConfigUtils::displayMenu() { } WUPSConfigAPIBackend::Intern::CleanAllHandles(); + + // we want wait at least 300ms to avoid leaking inputs from the config menu to the application + auto diffTime = OSTicksToMilliseconds(OSGetTime() - startTime); + if (diffTime < 300) { + OSSleepTicks(OSMillisecondsToTicks(300 - diffTime)); + } } extern "C" uint32_t __OSPhysicalToEffectiveUncached(uint32_t);