From 70481c9444fa1f9abf00cdcec20e60423a9ad35d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 13 Mar 2018 11:25:00 +0100 Subject: [PATCH] Fix the loading status. Prettify the loading screen by putting the status and spinner along the bottom edge. --- Core/PSPLoaders.cpp | 4 ++++ Core/System.cpp | 1 - UI/EmuScreen.cpp | 12 ++++++++---- UI/EmuScreen.h | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Core/PSPLoaders.cpp b/Core/PSPLoaders.cpp index 1a910edb05..7567d0b29c 100644 --- a/Core/PSPLoaders.cpp +++ b/Core/PSPLoaders.cpp @@ -16,8 +16,10 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include + #include "file/file_util.h" #include "util/text/utf8.h" +#include "thread/threadutil.h" #include "Common/FileUtil.h" #include "Common/StringUtils.h" @@ -253,6 +255,8 @@ bool Load_PSP_ISO(FileLoader *fileLoader, std::string *error_string) { INFO_LOG(LOADER,"Loading %s...", bootpath.c_str()); std::thread th([bootpath] { + setCurrentThreadName("ExecLoader"); + PSP_SetLoading("Loading executable..."); // TODO: We can't use the initial error_string pointer. bool success = __KernelLoadExec(bootpath.c_str(), 0, &PSP_CoreParameter().errorString); if (success && coreState == CORE_POWERUP) { diff --git a/Core/System.cpp b/Core/System.cpp index 43aa2822b6..cc559308c4 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -428,7 +428,6 @@ void PSP_SetLoading(const std::string &reason) { std::string PSP_GetLoading() { std::lock_guard guard(loadingReasonLock); return loadingReason; - } CoreParameter &PSP_CoreParameter() { diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index e8a51f6f35..339d79b532 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -861,17 +861,17 @@ void EmuScreen::CreateViews() { root_->Add(new OnScreenMessagesView(new AnchorLayoutParams((Size)bounds.w, (Size)bounds.h))); GameInfoBGView *loadingBG = root_->Add(new GameInfoBGView(gamePath_, new AnchorLayoutParams(FILL_PARENT, FILL_PARENT))); - TextView *loadingTextView = root_->Add(new TextView(sc->T(PSP_GetLoading()), new AnchorLayoutParams(bounds.centerX(), bounds.centerY(), NONE, NONE, true))); + TextView *loadingTextView = root_->Add(new TextView(sc->T(PSP_GetLoading()), new AnchorLayoutParams(bounds.centerX(), NONE, NONE, 40, true))); static const int symbols[4] = { I_CROSS, I_CIRCLE, I_SQUARE, I_TRIANGLE }; - Spinner *loadingSpinner = root_->Add(new Spinner(symbols, ARRAY_SIZE(symbols), new AnchorLayoutParams(bounds.centerX(), bounds.centerY() + 64, NONE, NONE, true))); + Spinner *loadingSpinner = root_->Add(new Spinner(symbols, ARRAY_SIZE(symbols), new AnchorLayoutParams(NONE, NONE, 45, 45, true))); loadingSpinner_ = loadingSpinner; loadingTextView->SetShadow(true); - loadingView_ = loadingTextView; + loadingTextView_ = loadingTextView; loadingViewColor_ = loadingTextView->AddTween(new CallbackColorTween(0x00FFFFFF, 0x00FFFFFF, 0.2f, &bezierEaseInOut)); loadingViewColor_->SetCallback([loadingBG, loadingTextView, loadingSpinner](View *v, uint32_t c) { @@ -1109,6 +1109,10 @@ void EmuScreen::render() { DrawContext *thin3d = screenManager()->getDrawContext(); if (invalid_) { + // Loading, or after shutdown? + if (loadingTextView_->GetVisibility() == UI::V_VISIBLE) + loadingTextView_->SetText(PSP_GetLoading()); + // It's possible this might be set outside PSP_RunLoopFor(). // In this case, we need to double check it here. checkPowerDown(); @@ -1160,7 +1164,7 @@ void EmuScreen::render() { if (invalid_) return; - const bool hasVisibleUI = !osm.IsEmpty() || saveStatePreview_->GetVisibility() != UI::V_GONE || g_Config.bShowTouchControls || loadingView_->GetVisibility() == UI::V_VISIBLE; + const bool hasVisibleUI = !osm.IsEmpty() || saveStatePreview_->GetVisibility() != UI::V_GONE || g_Config.bShowTouchControls || loadingTextView_->GetVisibility() == UI::V_VISIBLE; const bool showDebugUI = g_Config.bShowDebugStats || g_Config.bShowDeveloperMenu || g_Config.bShowAudioDebug || g_Config.bShowFrameProfiler; if (hasVisibleUI || showDebugUI || g_Config.iShowFPSCounter != 0) { renderUI(); diff --git a/UI/EmuScreen.h b/UI/EmuScreen.h index 755bc487ce..c5f95d515b 100644 --- a/UI/EmuScreen.h +++ b/UI/EmuScreen.h @@ -98,8 +98,8 @@ private: AsyncImageFileView *saveStatePreview_; int saveStateSlot_; - UI::View *loadingView_ = nullptr; UI::CallbackColorTween *loadingViewColor_ = nullptr; UI::VisibilityTween *loadingViewVisible_ = nullptr; UI::Spinner *loadingSpinner_ = nullptr; + UI::TextView *loadingTextView_ = nullptr; };