mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-15 02:29:51 +01:00
Replay: Attempt to ignore reads in PSP/GAME.
Unless there are writes in this directory, we should be able to safely ignore them. Currently detection isn't perfect (like PSP/./GAME/../GAME), but this should catch the vast majority of cases.
This commit is contained in:
1 parent
4144e71b7a
commit
33cfac549d
4 files changed
+53
-18
No files matched your search
+25
-1
@@ -118,6 +118,7 @@ static std::vector<ReplayItem> replayItems;
|
||||
static size_t replayExecPos = 0;
|
||||
static bool replaySaveWroteHeader = false;
|
||||
static ReplayState replayState = ReplayState::IDLE;
|
||||
static bool replaySawGameDirWrite = false;
|
||||
|
||||
static size_t replayCtrlPos = 0;
|
||||
static uint32_t lastButtons = 0;
|
||||
@@ -299,6 +300,7 @@ void ReplayAbort() {
|
||||
replayExecPos = 0;
|
||||
replaySaveWroteHeader = false;
|
||||
replayState = ReplayState::IDLE;
|
||||
replaySawGameDirWrite = false;
|
||||
|
||||
replayCtrlPos = 0;
|
||||
lastButtons = 0;
|
||||
@@ -439,7 +441,12 @@ uint64_t ReplayApplyDisk64(ReplayAction action, uint64_t result, uint64_t t) {
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t ReplayApplyDiskRead(void *data, uint32_t readSize, uint32_t dataSize, uint64_t t) {
|
||||
uint32_t ReplayApplyDiskRead(void *data, uint32_t readSize, uint32_t dataSize, bool inGameDir, uint64_t t) {
|
||||
// Ignore PSP/GAME reads if we haven't seen a write there.
|
||||
if (inGameDir && !replaySawGameDirWrite) {
|
||||
return readSize;
|
||||
}
|
||||
|
||||
switch (replayState) {
|
||||
case ReplayState::EXECUTE:
|
||||
{
|
||||
@@ -466,6 +473,23 @@ uint32_t ReplayApplyDiskRead(void *data, uint32_t readSize, uint32_t dataSize, u
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t ReplayApplyDiskWrite(const void *data, uint64_t writeSize, uint64_t dataSize, bool *diskFull, bool inGameDir, uint64_t t) {
|
||||
switch (replayState) {
|
||||
case ReplayState::EXECUTE:
|
||||
case ReplayState::SAVE:
|
||||
// Never let the disk return full during replay.
|
||||
if (diskFull)
|
||||
*diskFull = false;
|
||||
if (inGameDir)
|
||||
replaySawGameDirWrite = true;
|
||||
return writeSize;
|
||||
|
||||
case ReplayState::IDLE:
|
||||
default:
|
||||
return writeSize;
|
||||
}
|
||||
}
|
||||
|
||||
static int64_t ConvertFromTm(const struct tm *t) {
|
||||
// Remember, mktime modifies.
|
||||
struct tm copy = *t;
|
||||
|
||||
Reference in new issue
Block a user