diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index adda9bd383..ff9826ebe9 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -1588,6 +1588,8 @@ void __KernelLoadReset() { bool __KernelLoadExec(const char *filename, u32 paramPtr, std::string *error_string) { SceKernelLoadExecParam param; + PSP_SetLoading("Loading game..."); + if (paramPtr) Memory::ReadStruct(paramPtr, ¶m); else @@ -1626,6 +1628,7 @@ bool __KernelLoadExec(const char *filename, u32 paramPtr, std::string *error_str pspFileSystem.ReadFile(handle, temp, (size_t)info.size); + PSP_SetLoading("Loading modules..."); Module *module = __KernelLoadModule(temp, (size_t)info.size, 0, error_string); if (!module || module->isFake) { @@ -1666,6 +1669,7 @@ bool __KernelLoadExec(const char *filename, u32 paramPtr, std::string *error_str if (module->nm.module_start_thread_stacksize != 0) option.stacksize = module->nm.module_start_thread_stacksize; + PSP_SetLoading("Starting modules..."); if (paramPtr) __KernelStartModule(module, param.args, (const char*)param_argp, &option); else @@ -1682,6 +1686,7 @@ bool __KernelLoadExec(const char *filename, u32 paramPtr, std::string *error_str bool __KernelLoadGEDump(const std::string &base_filename, std::string *error_string) { __KernelLoadReset(); + PSP_SetLoading("Generating code..."); mipsr4k.pc = PSP_GetUserMemoryBase(); diff --git a/Core/System.cpp b/Core/System.cpp index 772f00e877..43aa2822b6 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -81,6 +81,8 @@ ParamSFOData g_paramSFO; static GlobalUIState globalUIState; static CoreParameter coreParameter; static FileLoader *loadedFile; +static std::mutex loadingReasonLock; +static std::string loadingReason; bool audioInitialized; @@ -311,6 +313,7 @@ bool PSP_InitStart(const CoreParameter &coreParam, std::string *error_string) { } coreParameter.errorString = ""; pspIsIniting = true; + PSP_SetLoading("Loading game..."); CPU_Init(); @@ -334,6 +337,7 @@ bool PSP_InitUpdate(std::string *error_string) { bool success = coreParameter.fileToStart != ""; *error_string = coreParameter.errorString; if (success && gpu == nullptr) { + PSP_SetLoading("Starting graphics..."); success = GPU_Init(coreParameter.graphicsContext, coreParameter.thin3d); if (!success) { PSP_Shutdown(); @@ -416,6 +420,17 @@ void PSP_RunLoopFor(int cycles) { PSP_RunLoopUntil(CoreTiming::GetTicks() + cycles); } +void PSP_SetLoading(const std::string &reason) { + std::lock_guard guard(loadingReasonLock); + loadingReason = reason; +} + +std::string PSP_GetLoading() { + std::lock_guard guard(loadingReasonLock); + return loadingReason; + +} + CoreParameter &PSP_CoreParameter() { return coreParameter; } diff --git a/Core/System.h b/Core/System.h index 6017e88cc5..a2a3ed5c48 100644 --- a/Core/System.h +++ b/Core/System.h @@ -73,6 +73,9 @@ void PSP_EndHostFrame(); void PSP_RunLoopUntil(u64 globalticks); void PSP_RunLoopFor(int cycles); +void PSP_SetLoading(const std::string &reason); +std::string PSP_GetLoading(); + // Call before PSP_BeginHostFrame() in order to not miss any GPU stats. void Core_UpdateDebugStats(bool collectStats); diff --git a/GPU/GLES/ShaderManagerGLES.cpp b/GPU/GLES/ShaderManagerGLES.cpp index 746d2c4f7c..b1f40a6b61 100644 --- a/GPU/GLES/ShaderManagerGLES.cpp +++ b/GPU/GLES/ShaderManagerGLES.cpp @@ -36,7 +36,8 @@ #include "Common/FileUtil.h" #include "Core/Config.h" #include "Core/Host.h" -#include "Core/Reporting.h" +#include "Core/Reporting.h"" +#include "Core/System.h" #include "GPU/Math3D.h" #include "GPU/GPUState.h" #include "GPU/ge_constants.h" @@ -869,6 +870,8 @@ bool ShaderManagerGLES::ContinuePrecompile(float sliceTime) { return true; } + PSP_SetLoading("Compiling shaders..."); + double start = real_time_now(); // Let's try to keep it under sliceTime if possible. double end = start + sliceTime; diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 05fbd0986d..e8a51f6f35 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -861,7 +861,7 @@ 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("Loading game..."), new AnchorLayoutParams(bounds.centerX(), bounds.centerY(), NONE, NONE, true))); + TextView *loadingTextView = root_->Add(new TextView(sc->T(PSP_GetLoading()), new AnchorLayoutParams(bounds.centerX(), bounds.centerY(), NONE, NONE, true))); static const int symbols[4] = { I_CROSS, I_CIRCLE,