mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-11 05:26:24 +02:00
Move achievement handling to EmuScreen and the main thread. Fixes black screen.
This commit is contained in:
1 parent
91bf4d5b5c
commit
a4e6e84a0a
5 files changed
+31
-17
No files matched your search
+11
-14
@@ -42,7 +42,6 @@
|
||||
#include "Common/TimeUtil.h"
|
||||
#include "Common/Thread/ThreadUtil.h"
|
||||
#include "Common/GraphicsContext.h"
|
||||
#include "Core/RetroAchievements.h"
|
||||
#include "Core/MemFault.h"
|
||||
#include "Core/HDRemaster.h"
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
@@ -101,6 +100,10 @@ BootState PSP_GetBootState() {
|
||||
return g_bootState;
|
||||
}
|
||||
|
||||
FileLoader *PSP_LoadedFile() {
|
||||
return g_loadedFile;
|
||||
}
|
||||
|
||||
void ResetUIState() {
|
||||
globalUIState = UISTATE_MENU;
|
||||
}
|
||||
@@ -276,6 +279,7 @@ static bool CPU_Init(FileLoader *fileLoader, IdentifiedFileType type, std::strin
|
||||
case IdentifiedFileType::PSP_ISO:
|
||||
case IdentifiedFileType::PSP_ISO_NP:
|
||||
case IdentifiedFileType::PSP_DISC_DIRECTORY:
|
||||
// Doesn't seem to take ownership of fileLoader?
|
||||
if (!MountGameISO(fileLoader)) {
|
||||
*errorString = "Failed to mount ISO file - invalid format?";
|
||||
return false;
|
||||
@@ -509,7 +513,7 @@ void PSP_ForceDebugStats(bool enable) {
|
||||
|
||||
bool PSP_InitStart(const CoreParameter &coreParam) {
|
||||
if (g_bootState != BootState::Off) {
|
||||
ERROR_LOG(Log::System, "Can't start loader thread - already on.");
|
||||
ERROR_LOG(Log::Loader, "Can't start loader thread - already on.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -524,7 +528,7 @@ bool PSP_InitStart(const CoreParameter &coreParam) {
|
||||
|
||||
std::string *error_string = &g_CoreParameter.errorString;
|
||||
|
||||
INFO_LOG(Log::System, "Starting loader thread...");
|
||||
INFO_LOG(Log::Loader, "Starting loader thread...");
|
||||
|
||||
_dbg_assert_(!g_loadingThread.joinable());
|
||||
|
||||
@@ -551,17 +555,12 @@ bool PSP_InitStart(const CoreParameter &coreParam) {
|
||||
loadedFile = new RamCachingFileLoader(loadedFile);
|
||||
break;
|
||||
default:
|
||||
INFO_LOG(Log::System, "RAM caching is on, but file is not an ISO, so ignoring");
|
||||
INFO_LOG(Log::Loader, "RAM caching is on, but file is not an ISO, so ignoring");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (g_Config.bAchievementsEnable) {
|
||||
std::string errorString;
|
||||
Achievements::SetGame(filename, type, loadedFile);
|
||||
}
|
||||
|
||||
// TODO: The reason we pass in g_CoreParameter.errorString here is that it's persistent -
|
||||
// it gets written to from the loader thread that gets spawned.
|
||||
if (!CPU_Init(loadedFile, type, &g_CoreParameter.errorString)) {
|
||||
@@ -602,7 +601,7 @@ BootState PSP_InitUpdate(std::string *error_string) {
|
||||
|
||||
// Ok, async boot completed, let's finish up things on the main thread.
|
||||
if (!gpu) { // should be!
|
||||
INFO_LOG(Log::System, "Starting graphics...");
|
||||
INFO_LOG(Log::Loader, "Starting graphics...");
|
||||
Draw::DrawContext *draw = g_CoreParameter.graphicsContext ? g_CoreParameter.graphicsContext->GetDrawContext() : nullptr;
|
||||
// This set the `gpu` global.
|
||||
bool success = GPU_Init(g_CoreParameter.graphicsContext, draw);
|
||||
@@ -645,8 +644,6 @@ void PSP_Shutdown(bool success) {
|
||||
// Reduce the risk for weird races with the Windows GE debugger.
|
||||
gpuDebug = nullptr;
|
||||
|
||||
Achievements::UnloadGame();
|
||||
|
||||
// Do nothing if we never inited.
|
||||
if (g_bootState == BootState::Off) {
|
||||
return;
|
||||
@@ -846,11 +843,11 @@ void DumpFileIfEnabled(const u8 *dataPtr, const u32 length, std::string_view nam
|
||||
return;
|
||||
}
|
||||
if (!dataPtr) {
|
||||
ERROR_LOG(Log::System, "Error dumping %s: invalid pointer", DumpFileTypeToString(DumpFileType::EBOOT));
|
||||
ERROR_LOG(Log::Loader, "Error dumping %s: invalid pointer", DumpFileTypeToString(DumpFileType::EBOOT));
|
||||
return;
|
||||
}
|
||||
if (length == 0) {
|
||||
ERROR_LOG(Log::System, "Error dumping %s: invalid length", DumpFileTypeToString(DumpFileType::EBOOT));
|
||||
ERROR_LOG(Log::Loader, "Error dumping %s: invalid length", DumpFileTypeToString(DumpFileType::EBOOT));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user