Remove two states from the CoreState enum.

This commit is contained in:
Henrik Rydgård committed 2025-04-05 09:18:56 +02:00
1 parent 24b30cc709
commit b27a022e7c
11 files changed
+17 -33

No files matched your search

+2 -6
View File
@@ -73,8 +73,8 @@ static int steppingCounter = 0;
static std::set<CoreLifecycleFunc> lifecycleFuncs;
// This can be read and written from ANYWHERE.
volatile CoreState coreState = CORE_STEPPING_CPU;
CoreState preGeCoreState = CORE_BOOT_ERROR;
volatile CoreState coreState = CORE_POWERDOWN;
CoreState preGeCoreState = CORE_POWERDOWN;
// If true, core state has been changed, but JIT has probably not noticed yet.
volatile bool coreStatePending = false;
@@ -96,9 +96,7 @@ const char *CoreStateToString(CoreState state) {
case CORE_RUNNING_CPU: return "RUNNING_CPU";
case CORE_NEXTFRAME: return "NEXTFRAME";
case CORE_STEPPING_CPU: return "STEPPING_CPU";
case CORE_POWERUP: return "POWERUP";
case CORE_POWERDOWN: return "POWERDOWN";
case CORE_BOOT_ERROR: return "BOOT_ERROR";
case CORE_RUNTIME_ERROR: return "RUNTIME_ERROR";
case CORE_STEPPING_GE: return "STEPPING_GE";
case CORE_RUNNING_GE: return "RUNNING_GE";
@@ -203,9 +201,7 @@ bool Core_GetPowerSaving() {
void Core_RunLoopUntil(u64 globalticks) {
while (true) {
switch (coreState) {
case CORE_POWERUP:
case CORE_POWERDOWN:
case CORE_BOOT_ERROR:
case CORE_RUNTIME_ERROR:
case CORE_NEXTFRAME:
return;
+1 -5
View File
@@ -117,12 +117,8 @@ enum CoreState {
CORE_NEXTFRAME = 1,
// Emulation is paused, CPU thread is sleeping.
CORE_STEPPING_CPU, // Can be used for recoverable runtime errors (ignored memory exceptions)
// Core is being powered up.
CORE_POWERUP,
// Core is being powered down.
// Core is not running.
CORE_POWERDOWN,
// An error happened at boot.
CORE_BOOT_ERROR,
// Unrecoverable runtime error. Recoverable errors should use CORE_STEPPING.
CORE_RUNTIME_ERROR,
// Stepping the GPU. When done, will switch over to STEPPING_CPU.
+3 -1
View File
@@ -582,10 +582,12 @@ static void __IoAsyncEndCallback(SceUID threadID, SceUID prevCallbackId) {
static void __IoManagerThread() {
SetCurrentThreadName("IO");
INFO_LOG(Log::sceIo, "Entering __IoManagerThread");
AndroidJNIThreadContext jniContext;
while (ioManagerThreadEnabled && coreState != CORE_BOOT_ERROR && coreState != CORE_RUNTIME_ERROR && coreState != CORE_POWERDOWN) {
while (ioManagerThreadEnabled) {
ioManager.RunEventsUntil(CoreTiming::GetTicks() + msToCycles(1000));
}
INFO_LOG(Log::sceIo, "Leaving __IoManagerThread");
}
static void __IoWakeManager(CoreLifecycle stage) {
+1 -1
View File
@@ -201,7 +201,7 @@ public:
// Don't run if it's not running, but wait for startup.
if (!eventsRunning_) {
if (eventsHaveRun_ || coreState == CORE_BOOT_ERROR || coreState == CORE_RUNTIME_ERROR || coreState == CORE_POWERDOWN) {
if (eventsHaveRun_ || coreState == CORE_RUNTIME_ERROR || coreState == CORE_POWERDOWN) {
return false;
}
}
+1 -1
View File
@@ -210,7 +210,7 @@ unsigned int MIPSDebugInterface::readMemory(unsigned int address) {
bool MIPSDebugInterface::isAlive()
{
return PSP_GetBootState() == BootState::Complete && coreState != CORE_BOOT_ERROR && coreState != CORE_RUNTIME_ERROR && coreState != CORE_POWERDOWN;
return PSP_GetBootState() == BootState::Complete && coreState != CORE_RUNTIME_ERROR && coreState != CORE_POWERDOWN;
}
bool MIPSDebugInterface::isBreakpoint(unsigned int address)
+5 -8
View File
@@ -201,10 +201,7 @@ EmuScreen::EmuScreen(const Path &filename)
&SetPSPAnalog,
nullptr);
// Make sure we don't leave it at powerdown after the last game.
// TODO: This really should be handled elsewhere if it isn't.
if (coreState == CORE_POWERDOWN)
coreState = CORE_STEPPING_CPU;
_dbg_assert_(coreState == CORE_POWERDOWN);
OnDevMenu.Handle(this, &EmuScreen::OnDevTools);
OnChatMenu.Handle(this, &EmuScreen::OnChat);
@@ -264,7 +261,6 @@ void EmuScreen::ProcessGameBoot(const Path &filename) {
g_BackgroundAudio.SetGame(Path());
bootPending_ = false;
errorMessage_ = error_string;
coreState = CORE_BOOT_ERROR;
ERROR_LOG(Log::Boot, "Boot failed: %s", errorMessage_.c_str());
return;
case BootState::Complete:
@@ -342,7 +338,6 @@ void EmuScreen::ProcessGameBoot(const Path &filename) {
coreParam.pixelHeight = g_display.pixel_yres;
// PSP_InitStart can't really fail anymore, unless it's called at the wrong time. It just starts the loader thread.
coreState = CORE_POWERUP;
if (!PSP_InitStart(coreParam)) {
bootPending_ = false;
ERROR_LOG(Log::Boot, "InitStart ProcessGameBoot error: %s", errorMessage_.c_str());
@@ -445,10 +440,14 @@ EmuScreen::~EmuScreen() {
std::string gameID = g_paramSFO.GetValueString("DISC_ID");
g_Config.TimeTracker().Stop(gameID);
// Should not be able to quit during boot, as boot can't be cancelled.
_dbg_assert_(!bootPending_);
if (!bootPending_) {
PSP_Shutdown(true);
}
_dbg_assert_(coreState == CORE_POWERDOWN);
System_PostUIMessage(UIMessage::GAME_SELECTED, "");
g_OSD.ClearAchievementStuff();
@@ -568,8 +567,6 @@ void EmuScreen::sendMessage(UIMessage message, const char *value) {
PSP_Shutdown(true);
bootPending_ = true;
gamePath_ = Path(value);
// Don't leave it on CORE_POWERDOWN, we'll sometimes aggressively bail.
Core_UpdateState(CORE_POWERUP);
}
} else if (message == UIMessage::CONFIG_LOADED) {
// In case we need to position touch controls differently.
+2 -7
View File
@@ -276,8 +276,6 @@ void MainThreadFunc() {
DEBUG_LOG(Log::Boot, "Done.");
_dbg_assert_(coreState != CORE_POWERDOWN);
g_inLoop = true;
if (useEmuThread) {
@@ -285,10 +283,9 @@ void MainThreadFunc() {
}
graphicsContext->ThreadStart();
if (g_Config.bBrowse)
if (g_Config.bBrowse) {
PostMessage(MainWindow::GetHWND(), WM_COMMAND, ID_FILE_LOAD, 0);
Core_Resume();
}
if (useEmuThread) {
while (emuThreadState != (int)EmuThreadState::DISABLED) {
@@ -326,8 +323,6 @@ void MainThreadFunc() {
EmuThreadJoin();
}
shutdown:
if (!useEmuThread) {
NativeShutdownGraphics();
}
-1
View File
@@ -1166,7 +1166,6 @@ namespace MainWindow
NativeSetRestarting();
InputDevice::StopPolling();
MainThread_Stop();
coreState = CORE_POWERUP;
UpdateUIState(UISTATE_MENU);
MainThread_Start(g_Config.iGPUBackend == (int)GPUBackend::OPENGL);
InputDevice::BeginPolling();
+1 -1
View File
@@ -1246,7 +1246,7 @@ namespace MainWindow {
void UpdateCommands() {
static GlobalUIState lastGlobalUIState = UISTATE_PAUSEMENU;
static CoreState lastCoreState = CORE_BOOT_ERROR;
static CoreState lastCoreState = CORE_POWERDOWN;
HMENU menu = GetMenu(GetHWND());
EnableMenuItem(menu, ID_DEBUG_LOG, g_Config.bEnableLogging ? MF_ENABLED : MF_GRAYED);
-1
View File
@@ -185,7 +185,6 @@ bool RunAutoTest(HeadlessHost *headlessHost, CoreParameter &coreParameter, const
if (opt.compare || opt.bench)
coreParameter.collectDebugOutput = &output;
coreState = CORE_POWERUP;
if (!PSP_InitStart(coreParameter)) {
// Shouldn't really happen anymore, the errors happen later in PSP_InitUpdate.
fprintf(stderr, "Failed to start '%s'.\n", coreParameter.fileToStart.c_str());
+1 -1
View File
@@ -100,7 +100,7 @@ static void SetupJitHarness() {
RegisterHLEModule("UnitTestFakeSyscalls", ARRAY_SIZE(UnitTestFakeSyscalls), UnitTestFakeSyscalls);
// This is pretty much the bare minimum required to setup jit.
coreState = CORE_POWERUP;
coreState = CORE_RUNNING_CPU;
currentMIPS = &mipsr4k;
g_symbolMap = new SymbolMap();
Memory::g_MemorySize = Memory::RAM_NORMAL_SIZE;