mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-21 18:29:05 +02:00
Adhoc: Restore the inited flags from savestates
Loading a savestate kept the current session's netAdhocInited, netAdhocctlInited and matching-inited flags rather than the saved ones. Loaded into a fresh boot, a state saved with adhocctl initialized (but not connected) then failed every adhocctl call with NOT_INITIALIZED. MGS Peace Walker shuts ad hoc down before a cutscene and retried sceNetAdhocctlDisconnect forever, leaving the screen black. Take the flags from the state, and bring the host side in line: start the friendFinder and log in again when the state has adhocctl up and we don't, stop it in the opposite case. Also save the product code, which that login sends. Also add a game.state.save debugger command, used to reproduce this. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
1265a3cef4
commit
16a03f16e8
6 files changed
+117
-59
No files matched your search
@@ -60,6 +60,7 @@ DebuggerSubscriber *WebSocketGameInit(DebuggerEventHandlerMap &map) {
|
||||
map["game.reset"] = &WebSocketGameReset;
|
||||
map["game.status"] = &WebSocketGameStatus;
|
||||
map["game.state.load"] = &WebSocketGameStateLoad;
|
||||
map["game.state.save"] = &WebSocketGameStateSave;
|
||||
map["game.speed.get"] = &WebSocketGameSpeedGet;
|
||||
map["game.speed.set"] = &WebSocketGameSpeedSet;
|
||||
map["version"] = &WebSocketVersion;
|
||||
@@ -156,6 +157,34 @@ void WebSocketGameStateLoad(DebuggerRequest &req) {
|
||||
req.Respond();
|
||||
}
|
||||
|
||||
// Save a savestate file (game.state.save)
|
||||
//
|
||||
// Like game.state.load, the save is queued and happens at the end of the next frame the CPU runs.
|
||||
//
|
||||
// Parameters:
|
||||
// - path: string, path to write the .ppst file to.
|
||||
//
|
||||
// Response (same event name) with no extra data, once queued.
|
||||
void WebSocketGameStateSave(DebuggerRequest &req) {
|
||||
std::string path;
|
||||
if (!req.ParamString("path", &path))
|
||||
return;
|
||||
|
||||
bool running = false;
|
||||
Core_RunOnCPUThread([&] {
|
||||
running = PSP_GetBootState() == BootState::Complete;
|
||||
});
|
||||
if (!running)
|
||||
return req.Fail("Game not running");
|
||||
|
||||
SaveState::Save(Path(path), -1, [](SaveState::Status status, std::string_view message, std::string_view) {
|
||||
if (status == SaveState::Status::FAILURE) {
|
||||
ERROR_LOG(Log::System, "game.state.save: %.*s", STR_VIEW(message));
|
||||
}
|
||||
});
|
||||
req.Respond();
|
||||
}
|
||||
|
||||
// Percentages are relative to 60 FPS, matching how the in-app settings present the alternative
|
||||
// speeds (see GameSettingsScreen.cpp) - so a client and the UI agree on what "200%" means.
|
||||
static int PercentToFps(int percent) {
|
||||
|
||||
Reference in new issue
Block a user