diff --git a/Core/System.cpp b/Core/System.cpp index 1030d914ee..aea38360ea 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -436,16 +436,16 @@ bool PSP_InitUpdate(std::string *error_string) { bool success = coreParameter.fileToStart != ""; *error_string = coreParameter.errorString; - if (success) { + if (success && gpu == nullptr) { success = GPU_Init(coreParameter.graphicsContext, coreParameter.thin3d); if (!success) { PSP_Shutdown(); *error_string = "Unable to initialize rendering engine."; } } - pspIsInited = success; - pspIsIniting = false; - return true; + pspIsInited = success && GPU_IsReady(); + pspIsIniting = success && !pspIsInited; + return !success || pspIsInited; } bool PSP_Init(const CoreParameter &coreParam, std::string *error_string) { diff --git a/GPU/GPU.cpp b/GPU/GPU.cpp index 72f6bf1f4a..847e25661f 100644 --- a/GPU/GPU.cpp +++ b/GPU/GPU.cpp @@ -55,6 +55,12 @@ static void SetGPU(T *obj) { #undef new #endif +bool GPU_IsReady() { + if (gpu) + return gpu->IsReady(); + return false; +} + bool GPU_Init(GraphicsContext *ctx, Draw::DrawContext *draw) { #if PPSSPP_PLATFORM(UWP) SetGPU(new GPU_D3D11(ctx, draw)); diff --git a/GPU/GPU.h b/GPU/GPU.h index 2042fab015..b10bf19d9a 100644 --- a/GPU/GPU.h +++ b/GPU/GPU.h @@ -105,4 +105,5 @@ namespace Draw { } bool GPU_Init(GraphicsContext *ctx, Draw::DrawContext *thin3d); +bool GPU_IsReady(); void GPU_Shutdown(); diff --git a/GPU/GPUCommon.h b/GPU/GPUCommon.h index 784293578c..83653c3673 100644 --- a/GPU/GPUCommon.h +++ b/GPU/GPUCommon.h @@ -70,6 +70,9 @@ public: Draw::DrawContext *GetDrawContext() override { return draw_; } + bool IsReady() override { + return true; + } void Reinitialize() override; void BeginHostFrame() override; diff --git a/GPU/GPUInterface.h b/GPU/GPUInterface.h index af5c1a36df..eeaa7c87a6 100644 --- a/GPU/GPUInterface.h +++ b/GPU/GPUInterface.h @@ -168,6 +168,7 @@ public: virtual Draw::DrawContext *GetDrawContext() = 0; // Initialization + virtual bool IsReady() = 0; virtual void InitClear() = 0; virtual void Reinitialize() = 0;