From c2201da47ad4342b09c7803b2580c755d53864dd Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sat, 6 Jan 2024 12:55:29 +0100 Subject: [PATCH] (Android) Added a system directories creation state to the splash screen --- es-app/src/main.cpp | 7 ++++++- es-core/src/Window.cpp | 7 +++++++ es-core/src/Window.h | 4 +++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/es-app/src/main.cpp b/es-app/src/main.cpp index 2d9f8ace8..f36c59967 100644 --- a/es-app/src/main.cpp +++ b/es-app/src/main.cpp @@ -903,6 +903,7 @@ int main(int argc, char* argv[]) } LOG(LogDebug) << "Android internal directory: " << AndroidVariables::sInternalDataDirectory; LOG(LogDebug) << "Android external directory: " << AndroidVariables::sExternalDataDirectory; + { std::string buildIdentifier {PROGRAM_VERSION_STRING}; buildIdentifier.append(" (r") @@ -920,8 +921,12 @@ int main(int argc, char* argv[]) } } } - if (Utils::Platform::Android::getCreateSystemDirectories()) + + if (Utils::Platform::Android::getCreateSystemDirectories()) { + if (Settings::getInstance()->getBool("SplashScreen")) + window->renderSplashScreen(Window::SplashScreenState::DIR_CREATION, 0.0f); SystemData::createSystemDirectories(); + } #endif #if defined(APPLICATION_UPDATER) diff --git a/es-core/src/Window.cpp b/es-core/src/Window.cpp index 890c72a4a..1321bdd38 100644 --- a/es-core/src/Window.cpp +++ b/es-core/src/Window.cpp @@ -146,6 +146,8 @@ bool Window::init() mDefaultFonts.at(1)->buildTextCache("Reloading...", 0.0f, 0.0f, 0x777777FF)); mSplashTextResourceCopy = std::unique_ptr( mDefaultFonts.at(1)->buildTextCache("Copying resources...", 0.0f, 0.0f, 0x777777FF)); + mSplashTextDirCreation = std::unique_ptr(mDefaultFonts.at(1)->buildTextCache( + "Creating system directories...", 0.0f, 0.0f, 0x777777FF)); mSplashTextPositions.x = (mRenderer->getScreenWidth() - mSplashTextScanning->metrics.size.x) / 2.0f; @@ -703,6 +705,9 @@ void Window::renderSplashScreen(SplashScreenState state, float progress) else if (state == SplashScreenState::RESOURCE_COPY) { textPosX = (mRenderer->getScreenWidth() - mSplashTextResourceCopy->metrics.size.x) / 2.0f; } + else if (state == SplashScreenState::DIR_CREATION) { + textPosX = (mRenderer->getScreenWidth() - mSplashTextDirCreation->metrics.size.x) / 2.0f; + } trans = glm::translate(trans, glm::round(glm::vec3 {textPosX, textPosY, 0.0f})); mRenderer->setMatrix(trans); @@ -715,6 +720,8 @@ void Window::renderSplashScreen(SplashScreenState state, float progress) mDefaultFonts.at(1)->renderTextCache(mSplashTextReloading.get()); else if (state == SplashScreenState::RESOURCE_COPY) mDefaultFonts.at(1)->renderTextCache(mSplashTextResourceCopy.get()); + else if (state == SplashScreenState::DIR_CREATION) + mDefaultFonts.at(1)->renderTextCache(mSplashTextDirCreation.get()); mRenderer->swapBuffers(); } diff --git a/es-core/src/Window.h b/es-core/src/Window.h index ebfa3b4a5..95d166933 100644 --- a/es-core/src/Window.h +++ b/es-core/src/Window.h @@ -110,7 +110,8 @@ public: SCANNING, POPULATING, RELOADING, - RESOURCE_COPY + RESOURCE_COPY, + DIR_CREATION }; void renderSplashScreen(SplashScreenState state, float progress); @@ -191,6 +192,7 @@ private: std::unique_ptr mSplashTextPopulating; std::unique_ptr mSplashTextReloading; std::unique_ptr mSplashTextResourceCopy; + std::unique_ptr mSplashTextDirCreation; glm::vec4 mSplashTextPositions; std::vector mProgressBarRectangles;