Fix the loading status. Prettify the loading screen by putting the status and spinner along the bottom edge.

This commit is contained in:
Henrik Rydgård 2018-03-13 11:25:00 +01:00
parent a0fa199ce3
commit 70481c9444
4 changed files with 13 additions and 6 deletions

View file

@ -16,8 +16,10 @@
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include <thread>
#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) {

View file

@ -428,7 +428,6 @@ void PSP_SetLoading(const std::string &reason) {
std::string PSP_GetLoading() {
std::lock_guard<std::mutex> guard(loadingReasonLock);
return loadingReason;
}
CoreParameter &PSP_CoreParameter() {

View file

@ -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();

View file

@ -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;
};