This commit is contained in:
r2dliu 2020-11-24 15:13:30 -05:00
commit 59b085f368
2 changed files with 4 additions and 10 deletions

View file

@ -118,6 +118,9 @@ void SlippiPlaybackStatus::processInitialState()
{ {
INFO_LOG(SLIPPI, "saving iState"); INFO_LOG(SLIPPI, "saving iState");
State::SaveToBuffer(iState); State::SaveToBuffer(iState);
// The initial save to cState causes a stutter of about 5-10 frames
// Doing it here to get it out of the way and prevent stutters later
// Subsequent calls to SaveToBuffer for cState take ~1 frame
State::SaveToBuffer(cState); State::SaveToBuffer(cState);
SConfig::GetInstance().bHideCursor = false; SConfig::GetInstance().bHideCursor = false;
}; };
@ -267,13 +270,8 @@ void SlippiPlaybackStatus::loadState(s32 closestStateFrame)
std::string stateString; std::string stateString;
decoder.Decode((char*)iState.data(), iState.size(), futureDiffs[closestStateFrame].get(), &stateString); decoder.Decode((char*)iState.data(), iState.size(), futureDiffs[closestStateFrame].get(), &stateString);
std::vector<u8> stateToLoad(stateString.begin(), stateString.end()); std::vector<u8> stateToLoad(stateString.begin(), stateString.end());
if (stateToLoad.size() == 0) {
std::cout << "wtf break" << std::endl;
}
else {
State::LoadFromBuffer(stateToLoad); State::LoadFromBuffer(stateToLoad);
} }
}
} }
bool SlippiPlaybackStatus::shouldFFWFrame(s32 frameIndex) const bool SlippiPlaybackStatus::shouldFFWFrame(s32 frameIndex) const

View file

@ -25,8 +25,6 @@
#include "Common/Timer.h" #include "Common/Timer.h"
#include "Common/Version.h" #include "Common/Version.h"
#include "Common/Logging/Log.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/CoreTiming.h" #include "Core/CoreTiming.h"
@ -242,7 +240,6 @@ void SaveToBuffer(std::vector<u8>& buffer)
{ {
Core::RunOnCPUThread( Core::RunOnCPUThread(
[&] { [&] {
INFO_LOG(SLIPPI, "at start of save to buffer call");
u8* ptr = nullptr; u8* ptr = nullptr;
PointerWrap p(&ptr, PointerWrap::MODE_MEASURE); PointerWrap p(&ptr, PointerWrap::MODE_MEASURE);
@ -252,7 +249,6 @@ void SaveToBuffer(std::vector<u8>& buffer)
ptr = &buffer[0]; ptr = &buffer[0];
p.SetMode(PointerWrap::MODE_WRITE); p.SetMode(PointerWrap::MODE_WRITE);
DoState(p); DoState(p);
INFO_LOG(SLIPPI, "at end of save to buffer call");
}, },
true); true);
} }