Split CORE_ERROR into CORE_BOOT_ERROR and CORE_RUNTIME_ERROR

This commit is contained in:
Henrik Rydgård 2020-07-04 20:19:56 +02:00
parent 087de849bd
commit efc3f4f5e4
14 changed files with 28 additions and 22 deletions

View file

@ -339,7 +339,8 @@ void Core_Run(GraphicsContext *ctx) {
case CORE_POWERUP:
case CORE_POWERDOWN:
case CORE_ERROR:
case CORE_BOOT_ERROR:
case CORE_RUNTIME_ERROR:
// Exit loop!!
Core_StateProcessed();

View file

@ -469,7 +469,7 @@ void HLEReturnFromMipsCall() {
if ((stackData->nextOff & 0x0000000F) != 0 || !Memory::IsValidAddress(sp + stackData->nextOff)) {
ERROR_LOG(HLE, "Corrupt stack on HLE mips call return: %08x", stackData->nextOff);
Core_UpdateState(CORE_ERROR);
Core_UpdateState(CORE_RUNTIME_ERROR);
return;
}
@ -482,9 +482,10 @@ void HLEReturnFromMipsCall() {
while ((finalMarker->nextOff & 0x0000000F) == 0 && Memory::IsValidAddress(finalMarker.ptr + finalMarker->nextOff)) {
finalMarker.ptr += finalMarker->nextOff;
}
if (finalMarker->nextOff != 0xFFFFFFFF) {
ERROR_LOG(HLE, "Corrupt stack on HLE mips call return action: %08x", finalMarker->nextOff);
Core_UpdateState(CORE_ERROR);
Core_UpdateState(CORE_RUNTIME_ERROR);
return;
}

View file

@ -555,7 +555,7 @@ static VFSFileSystem *flash0System = nullptr;
static void __IoManagerThread() {
setCurrentThreadName("IO");
while (ioManagerThreadEnabled && coreState != CORE_ERROR && coreState != CORE_POWERDOWN) {
while (ioManagerThreadEnabled && coreState != CORE_BOOT_ERROR && coreState != CORE_RUNTIME_ERROR && coreState != CORE_POWERDOWN) {
ioManager.RunEventsUntil(CoreTiming::GetTicks() + msToCycles(1000));
}
}

View file

@ -1837,7 +1837,7 @@ int sceKernelLoadExec(const char *filename, u32 paramPtr)
std::string error_string;
if (!__KernelLoadExec(exec_filename.c_str(), paramPtr, &error_string)) {
ERROR_LOG(SCEMODULE, "sceKernelLoadExec failed: %s", error_string.c_str());
Core_UpdateState(CORE_ERROR);
Core_UpdateState(CORE_RUNTIME_ERROR);
return -1;
}
if (gpu) {

View file

@ -91,7 +91,7 @@ public:
protected:
void ProcessEvent(AsyncIOEvent ref) override;
bool ShouldExitEventLoop() override {
return coreState == CORE_ERROR || coreState == CORE_POWERDOWN;
return coreState == CORE_BOOT_ERROR || coreState == CORE_RUNTIME_ERROR || coreState == CORE_POWERDOWN;
}
private:
@ -106,4 +106,4 @@ private:
std::condition_variable resultsWait_;
std::set<u32> resultsPending_;
std::map<u32, AsyncIOResult> results_;
};
};

View file

@ -258,7 +258,7 @@ bool LoadFile(FileLoader **fileLoaderPtr, std::string *error_string) {
}
else if (ebootType == IdentifiedFileType::PSP_PS1_PBP) {
*error_string = "PS1 EBOOTs are not supported by PPSSPP.";
coreState = CORE_ERROR;
coreState = CORE_BOOT_ERROR;
return false;
}
std::string path = fileLoader->Path();
@ -270,7 +270,7 @@ bool LoadFile(FileLoader **fileLoaderPtr, std::string *error_string) {
return Load_PSP_ELF_PBP(fileLoader, error_string);
} else {
*error_string = "No EBOOT.PBP, misidentified game";
coreState = CORE_ERROR;
coreState = CORE_BOOT_ERROR;
return false;
}
}
@ -352,7 +352,7 @@ bool LoadFile(FileLoader **fileLoaderPtr, std::string *error_string) {
break;
}
coreState = CORE_ERROR;
coreState = CORE_BOOT_ERROR;
return false;
}

View file

@ -215,7 +215,7 @@ unsigned int MIPSDebugInterface::readMemory(unsigned int address)
bool MIPSDebugInterface::isAlive()
{
return PSP_IsInited() && coreState != CORE_ERROR && coreState != CORE_POWERDOWN;
return PSP_IsInited() && coreState != CORE_BOOT_ERROR && coreState != CORE_RUNTIME_ERROR && coreState != CORE_POWERDOWN;
}
bool MIPSDebugInterface::isBreakpoint(unsigned int address)

View file

@ -747,7 +747,7 @@ void Jit::WriteExitDestInReg(X64Reg reg) {
if (g_Config.bIgnoreBadMemAccess) {
CMP(32, R(EAX), Imm32(0));
FixupBranch skip = J_CC(CC_NE);
ABI_CallFunctionA((const void *)&Core_UpdateState, Imm32(CORE_ERROR));
ABI_CallFunctionA((const void *)&Core_UpdateState, Imm32(CORE_RUNTIME_ERROR));
SetJumpTarget(skip);
}

View file

@ -278,7 +278,7 @@ bool Load_PSP_ISO(FileLoader *fileLoader, std::string *error_string) {
} else {
*error_string = "A PSP game couldn't be found on the disc.";
}
coreState = CORE_ERROR;
coreState = CORE_BOOT_ERROR;
return false;
}
@ -303,7 +303,7 @@ bool Load_PSP_ISO(FileLoader *fileLoader, std::string *error_string) {
if (success && coreState == CORE_POWERUP) {
coreState = PSP_CoreParameter().startBreak ? CORE_STEPPING : CORE_RUNNING;
} else {
coreState = CORE_ERROR;
coreState = CORE_BOOT_ERROR;
// TODO: This is a crummy way to communicate the error...
PSP_CoreParameter().fileToStart = "";
}
@ -374,7 +374,7 @@ bool Load_PSP_ELF_PBP(FileLoader *fileLoader, std::string *error_string) {
// If root is not a subpath of path, we can't boot the game.
if (!startsWith(pathNorm, rootNorm)) {
*error_string = "Cannot boot ELF located outside mountRoot.";
coreState = CORE_ERROR;
coreState = CORE_BOOT_ERROR;
return false;
}
@ -433,7 +433,7 @@ bool Load_PSP_ELF_PBP(FileLoader *fileLoader, std::string *error_string) {
if (success && coreState == CORE_POWERUP) {
coreState = PSP_CoreParameter().startBreak ? CORE_STEPPING : CORE_RUNNING;
} else {
coreState = CORE_ERROR;
coreState = CORE_BOOT_ERROR;
// TODO: This is a crummy way to communicate the error...
PSP_CoreParameter().fileToStart = "";
}
@ -457,7 +457,7 @@ bool Load_PSP_GE_Dump(FileLoader *fileLoader, std::string *error_string) {
if (success && coreState == CORE_POWERUP) {
coreState = PSP_CoreParameter().startBreak ? CORE_STEPPING : CORE_RUNNING;
} else {
coreState = CORE_ERROR;
coreState = CORE_BOOT_ERROR;
// TODO: This is a crummy way to communicate the error...
PSP_CoreParameter().fileToStart = "";
}

View file

@ -433,7 +433,7 @@ void PSP_Shutdown() {
// Make sure things know right away that PSP memory, etc. is going away.
pspIsQuitting = true;
if (coreState == CORE_RUNNING)
Core_UpdateState(CORE_ERROR);
Core_UpdateState(CORE_POWERDOWN);
#ifndef MOBILE_DEVICE
if (g_Config.bFuncHashMap) {
@ -486,7 +486,7 @@ void PSP_RunLoopWhileState() {
void PSP_RunLoopUntil(u64 globalticks) {
SaveState::Process();
if (coreState == CORE_POWERDOWN || coreState == CORE_ERROR) {
if (coreState == CORE_POWERDOWN || coreState == CORE_BOOT_ERROR || coreState == CORE_RUNTIME_ERROR) {
return;
} else if (coreState == CORE_STEPPING) {
Core_ProcessStepping();

View file

@ -106,7 +106,8 @@ enum CoreState {
CORE_STEPPING,
CORE_POWERUP,
CORE_POWERDOWN,
CORE_ERROR,
CORE_BOOT_ERROR,
CORE_RUNTIME_ERROR,
};
extern bool coreCollectDebugStats;

View file

@ -139,7 +139,7 @@ struct ThreadEventQueue : public B {
// Don't run if it's not running, but wait for startup.
if (!eventsRunning_) {
if (eventsHaveRun_ || coreState == CORE_ERROR || coreState == CORE_POWERDOWN) {
if (eventsHaveRun_ || coreState == CORE_BOOT_ERROR || coreState == CORE_RUNTIME_ERROR || coreState == CORE_POWERDOWN) {
return false;
}
}

View file

@ -1414,6 +1414,9 @@ void EmuScreen::render() {
if (PSP_IsInited()) {
gpu->CopyDisplayToOutput(true);
}
} else if (coreState == CORE_RUNTIME_ERROR) {
// Blue screen :)
thin3d->BindFramebufferAsRenderTarget(nullptr, { RPAction::CLEAR, RPAction::DONT_CARE, RPAction::DONT_CARE, 0xFF0000FF }, "EmuScreen_RuntimeError");
} else {
// Didn't actually reach the end of the frame, ran out of the blockTicks cycles.
// In this case we need to bind and wipe the backbuffer, at least.

View file

@ -1354,7 +1354,7 @@ namespace MainWindow {
void UpdateCommands() {
static GlobalUIState lastGlobalUIState = UISTATE_PAUSEMENU;
static CoreState lastCoreState = CORE_ERROR;
static CoreState lastCoreState = CORE_BOOT_ERROR;
HMENU menu = GetMenu(GetHWND());
EnableMenuItem(menu, ID_DEBUG_LOG, !g_Config.bEnableLogging);