Replay: Properly load RTC time on load file.

This commit is contained in:
Unknown W. Brackets committed 2021-05-29 14:50:57 -07:00
1 parent 64e007c0ce
commit 85c64d3ec3
2 files changed
+61 -4

No files matched your search

+59 -4
View File
@@ -15,7 +15,11 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include <cstdint>
#include "Common/Swap.h"
#include "Core/HLE/sceRtc.h"
#include "Core/Replay.h"
#include "Core/System.h"
#include "Core/Debugger/WebSocket/ReplaySubscriber.h"
DebuggerSubscriber *WebSocketReplayInit(DebuggerEventHandlerMap &map) {
@@ -31,19 +35,42 @@ DebuggerSubscriber *WebSocketReplayInit(DebuggerEventHandlerMap &map) {
return nullptr;
}
// Begin or resume recording of replay data (replay.begin)
//
// If a replay was previously being played back, this will keep any executed replay data up to
// this point for the next flush. To discard, break the CPU, abort, and then begin.
//
// No parameters.
//
// Empty response.
void WebSocketReplayBegin(DebuggerRequest &req) {
// TODO
ReplayBeginSave();
req.Respond();
}
// Abort any replay execution or recording (replay.abort)
//
// This stops executing any replay and discards any in progress recording.
//
// No parameters.
//
// Empty response.
void WebSocketReplayAbort(DebuggerRequest &req) {
// TODO
ReplayAbort();
req.Respond();
}
void WebSocketReplayFlush(DebuggerRequest &req) {
if (!PSP_IsInited())
return req.Fail("Game not running");
// TODO
}
void WebSocketReplayExecute(DebuggerRequest &req) {
if (!PSP_IsInited())
return req.Fail("Game not running");
// TODO
}
@@ -51,10 +78,38 @@ void WebSocketReplayStatus(DebuggerRequest &req) {
// TODO
}
// Get the base RTC (real time clock) time for replay data (replay.time.get)
//
// The base time is constant during a game session, and represents the "power on" time of the
// emulated PSP.
//
// No parameters.
//
// Response (same event name):
// - value: unsigned integer, may have more than 32 integer bits.
void WebSocketReplayTimeGet(DebuggerRequest &req) {
// TODO
if (!PSP_IsInited())
return req.Fail("Game not running");
JsonWriter &json = req.Respond();
json.writeUint("value", RtcBaseTime());
}
// Overwrite the base RTC time (replay.time.set)
//
// Parameters:
// - value: unsigned integer.
//
// Empty response.
void WebSocketReplayTimeSet(DebuggerRequest &req) {
// TODO
if (!PSP_IsInited())
return req.Fail("Game not running");
uint32_t value;
if (!req.ParamU32("value", &value, false)) {
return;
}
RtcSetBaseTime((int32_t)value);
req.Respond();
}