From 426ec45751ca4bf8d12c9e78050c0a5f5ce9f938 Mon Sep 17 00:00:00 2001 From: phosit Date: Wed, 24 Dec 2025 17:13:39 +0100 Subject: [PATCH] Don't suspend loader after each finished task By moving the common `goto done;` ouf of the if-block 5586802b86 changed the code so that the loader suspend after each task. This normally isn't a problem as it will continue in the next frame. But when entering atlas it is treated as an error. --- source/ps/Loader.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/source/ps/Loader.cpp b/source/ps/Loader.cpp index 8ae8c838d6..b785f46653 100644 --- a/source/ps/Loader.cpp +++ b/source/ps/Loader.cpp @@ -248,20 +248,25 @@ ProgressiveLoadResult ProgressiveLoad(double time_budget) ret.status = ERR::TIMED_OUT; goto done; } + + const int taskResult{std::exchange(currentTask, std::nullopt)->Get()}; // .. failed; abort. loading will continue when we're called in // the next iteration of the main loop. // rationale: bail immediately instead of remembering the first // error that came up so we can report all errors that happen. - else if(currentTask->Get() < 0) - ret.status = static_cast(currentTask->Get()); + if(taskResult < 0) + { + ret.status = static_cast(taskResult); + goto done; + } // .. function called PS::Loader::Cancel; abort. return OK since this is an // intentional cancellation, not an error. - else if(state != LOADING) + if(state != LOADING) + { ret.status = INFO::OK; + goto done; + } // .. succeeded; continue and process next queued task. - - currentTask.reset(); - goto done; } // queue is empty, we just finished.