mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Mostly remove coreState management from System.cpp
This commit is contained in:
1 parent
58efe00b74
commit
24b30cc709
6 files changed
+31
-32
No files matched your search
@@ -91,6 +91,21 @@ BreakReason Core_BreakReason() {
|
||||
return g_breakReason;
|
||||
}
|
||||
|
||||
const char *CoreStateToString(CoreState state) {
|
||||
switch (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";
|
||||
default: return "N/A";
|
||||
}
|
||||
}
|
||||
|
||||
const char *BreakReasonToString(BreakReason reason) {
|
||||
switch (reason) {
|
||||
case BreakReason::None: return "None";
|
||||
|
||||
+1
-2
@@ -130,6 +130,7 @@ enum CoreState {
|
||||
// Running the GPU. When done, will switch over to RUNNING_CPU.
|
||||
CORE_RUNNING_GE,
|
||||
};
|
||||
const char *CoreStateToString(CoreState state);
|
||||
|
||||
// Callback is called on the Emu thread.
|
||||
typedef void (* CoreLifecycleFunc)(CoreLifecycle stage);
|
||||
@@ -150,8 +151,6 @@ bool Core_GetPowerSaving();
|
||||
|
||||
void Core_RunLoopUntil(u64 globalticks);
|
||||
|
||||
const char *CoreStateToString(CoreState state);
|
||||
|
||||
extern volatile CoreState coreState;
|
||||
extern volatile bool coreStatePending;
|
||||
|
||||
|
||||
+2
-30
@@ -436,7 +436,6 @@ static bool CPU_Init(FileLoader *fileLoader, IdentifiedFileType type, std::strin
|
||||
|
||||
default:
|
||||
GetBootError(type, errorString);
|
||||
coreState = CORE_BOOT_ERROR;
|
||||
g_CoreParameter.fileToStart.clear();
|
||||
return false;
|
||||
}
|
||||
@@ -514,8 +513,6 @@ bool PSP_InitStart(const CoreParameter &coreParam) {
|
||||
return false;
|
||||
}
|
||||
|
||||
coreState = CORE_POWERUP;
|
||||
|
||||
g_bootState = BootState::Booting;
|
||||
|
||||
GraphicsContext *temp = g_CoreParameter.graphicsContext;
|
||||
@@ -569,7 +566,6 @@ bool PSP_InitStart(const CoreParameter &coreParam) {
|
||||
// it gets written to from the loader thread that gets spawned.
|
||||
if (!CPU_Init(loadedFile, type, &g_CoreParameter.errorString)) {
|
||||
CPU_Shutdown(false);
|
||||
coreState = CORE_BOOT_ERROR;
|
||||
g_CoreParameter.fileToStart.clear();
|
||||
*error_string = g_CoreParameter.errorString;
|
||||
if (error_string->empty()) {
|
||||
@@ -579,13 +575,6 @@ bool PSP_InitStart(const CoreParameter &coreParam) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (PSP_CoreParameter().startBreak) {
|
||||
coreState = CORE_STEPPING_CPU;
|
||||
System_Notify(SystemNotification::DEBUG_MODE_CHANGE);
|
||||
} else {
|
||||
coreState = CORE_RUNNING_CPU;
|
||||
}
|
||||
|
||||
g_bootState = BootState::Complete;
|
||||
});
|
||||
|
||||
@@ -594,7 +583,7 @@ bool PSP_InitStart(const CoreParameter &coreParam) {
|
||||
|
||||
BootState PSP_InitUpdate(std::string *error_string) {
|
||||
if (g_bootState == BootState::Booting || g_bootState == BootState::Off) {
|
||||
// We're done already.
|
||||
// Nothing to do right now.
|
||||
return g_bootState;
|
||||
}
|
||||
|
||||
@@ -612,7 +601,6 @@ 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...");
|
||||
Draw::DrawContext *draw = g_CoreParameter.graphicsContext ? g_CoreParameter.graphicsContext->GetDrawContext() : nullptr;
|
||||
@@ -664,8 +652,7 @@ void PSP_Shutdown(bool success) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (coreState == CORE_RUNNING_CPU)
|
||||
Core_Stop();
|
||||
Core_Stop();
|
||||
|
||||
if (g_Config.bFuncHashMap) {
|
||||
MIPSAnalyst::StoreHashMap();
|
||||
@@ -836,21 +823,6 @@ bool CreateSysDirectories() {
|
||||
return true;
|
||||
}
|
||||
|
||||
const char *CoreStateToString(CoreState state) {
|
||||
switch (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";
|
||||
default: return "N/A";
|
||||
}
|
||||
}
|
||||
|
||||
const char *DumpFileTypeToString(DumpFileType type) {
|
||||
switch (type) {
|
||||
case DumpFileType::EBOOT: return "EBOOT";
|
||||
|
||||
@@ -264,6 +264,7 @@ 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:
|
||||
@@ -271,7 +272,16 @@ void EmuScreen::ProcessGameBoot(const Path &filename) {
|
||||
g_BackgroundAudio.SetGame(Path());
|
||||
bootPending_ = false;
|
||||
errorMessage_.clear();
|
||||
|
||||
if (PSP_CoreParameter().startBreak) {
|
||||
coreState = CORE_STEPPING_CPU;
|
||||
System_Notify(SystemNotification::DEBUG_MODE_CHANGE);
|
||||
} else {
|
||||
coreState = CORE_RUNNING_CPU;
|
||||
}
|
||||
|
||||
bootComplete();
|
||||
|
||||
// Reset views in case controls are in a different place.
|
||||
RecreateViews();
|
||||
return;
|
||||
@@ -332,6 +342,7 @@ 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());
|
||||
|
||||
@@ -185,6 +185,7 @@ 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());
|
||||
|
||||
@@ -1480,6 +1480,7 @@ bool retro_load_game(const struct retro_game_info *game)
|
||||
g_pendingBoot = true;
|
||||
|
||||
std::string error_string;
|
||||
coreState = CORE_POWERUP;
|
||||
if (!PSP_InitStart(coreParam)) {
|
||||
// Can't really fail, the errors happen later during InitUpdate
|
||||
ERROR_LOG(Log::Boot, "%s", error_string.c_str());
|
||||
|
||||
Reference in new issue
Block a user