From e842065405a50ed9183540881ae5678b541b1fc5 Mon Sep 17 00:00:00 2001 From: r2dliu Date: Tue, 24 Nov 2020 01:31:48 -0500 Subject: [PATCH] fix stutter. need cleanup --- .gitignore | 1 + CMakeSettings.json | 38 +++++++++++++++----- Source/Core/Core/Slippi/SlippiPlayback.cpp | 8 ++++- Source/Core/Core/State.cpp | 15 ++++---- Source/Core/VideoCommon/VideoBackendBase.cpp | 4 +++ 5 files changed, 50 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index deef6c5b0a..f4847d2eb3 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ Thumbs.db Source/Core/Common/scmrev.h # Ignore files output by build /[Bb]uild*/ +/out/ /[Bb]inary*/ /obj/ # Ignore files output by Android cmake build diff --git a/CMakeSettings.json b/CMakeSettings.json index 66db74ffad..872ad9e2bb 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -1,4 +1,4 @@ -{ +{ "configurations": [ { "name": "Release", @@ -11,7 +11,8 @@ "variables": [ { "name": "Qt5_DIR", - "value": "${workspaceRoot}\\Externals\\Qt\\Qt5.14.1\\msvc2019_64\\lib\\cmake\\Qt5" + "value": "${workspaceRoot}\\Externals\\Qt\\Qt5.14.1\\msvc2019_64\\lib\\cmake\\Qt5", + "type": "STRING" } ] }, @@ -26,7 +27,8 @@ "variables": [ { "name": "Qt5_DIR", - "value": "${workspaceRoot}\\Externals\\Qt\\Qt5.14.1\\msvc2019_64\\lib\\cmake\\Qt5" + "value": "${workspaceRoot}\\Externals\\Qt\\Qt5.14.1\\msvc2019_64\\lib\\cmake\\Qt5", + "type": "STRING" } ] }, @@ -41,15 +43,18 @@ "variables": [ { "name": "Qt5_DIR", - "value": "${workspaceRoot}\\Externals\\Qt\\Qt5.14.1\\msvc2019_arm64\\lib\\cmake\\Qt5" + "value": "${workspaceRoot}\\Externals\\Qt\\Qt5.14.1\\msvc2019_arm64\\lib\\cmake\\Qt5", + "type": "STRING" }, { "name": "CMAKE_SYSTEM_NAME", - "value": "Windows" + "value": "Windows", + "type": "STRING" }, { "name": "CMAKE_SYSTEM_PROCESSOR", - "value": "aarch64" + "value": "aarch64", + "type": "STRING" } ] }, @@ -64,17 +69,32 @@ "variables": [ { "name": "Qt5_DIR", - "value": "${workspaceRoot}\\Externals\\Qt\\Qt5.14.1\\msvc2019_arm64\\lib\\cmake\\Qt5" + "value": "${workspaceRoot}\\Externals\\Qt\\Qt5.14.1\\msvc2019_arm64\\lib\\cmake\\Qt5", + "type": "STRING" }, { "name": "CMAKE_SYSTEM_NAME", - "value": "Windows" + "value": "Windows", + "type": "STRING" }, { "name": "CMAKE_SYSTEM_PROCESSOR", - "value": "aarch64" + "value": "aarch64", + "type": "STRING" } ] + }, + { + "name": "x64-Release", + "generator": "Ninja", + "configurationType": "RelWithDebInfo", + "buildRoot": "${projectDir}\\out\\build\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "", + "inheritEnvironments": [ "msvc_x64_x64" ], + "variables": [] } ] } \ No newline at end of file diff --git a/Source/Core/Core/Slippi/SlippiPlayback.cpp b/Source/Core/Core/Slippi/SlippiPlayback.cpp index ae8d30b0a5..d46604506d 100644 --- a/Source/Core/Core/Slippi/SlippiPlayback.cpp +++ b/Source/Core/Core/Slippi/SlippiPlayback.cpp @@ -118,6 +118,7 @@ void SlippiPlaybackStatus::processInitialState() { INFO_LOG(SLIPPI, "saving iState"); State::SaveToBuffer(iState); + State::SaveToBuffer(cState); SConfig::GetInstance().bHideCursor = false; }; @@ -266,7 +267,12 @@ void SlippiPlaybackStatus::loadState(s32 closestStateFrame) std::string stateString; decoder.Decode((char*)iState.data(), iState.size(), futureDiffs[closestStateFrame].get(), &stateString); std::vector stateToLoad(stateString.begin(), stateString.end()); - State::LoadFromBuffer(stateToLoad); + if (stateToLoad.size() == 0) { + std::cout << "wtf break" << std::endl; + } + else { + State::LoadFromBuffer(stateToLoad); + } } } diff --git a/Source/Core/Core/State.cpp b/Source/Core/Core/State.cpp index 7c41674aa5..fbc1d2456a 100644 --- a/Source/Core/Core/State.cpp +++ b/Source/Core/Core/State.cpp @@ -25,6 +25,8 @@ #include "Common/Timer.h" #include "Common/Version.h" +#include "Common/Logging/Log.h" + #include "Core/ConfigManager.h" #include "Core/Core.h" #include "Core/CoreTiming.h" @@ -192,8 +194,8 @@ static void DoState(PointerWrap& p) // Movie must be done before the video backend, because the window is redrawn in the video backend // state load, and the frame number must be up-to-date. - Movie::DoState(p); - p.DoMarker("Movie"); + // Movie::DoState(p); + // p.DoMarker("Movie"); // Begin with video backend, so that it gets a chance to clear its caches and writeback modified // things to RAM @@ -214,9 +216,9 @@ static void DoState(PointerWrap& p) Gecko::DoState(p); p.DoMarker("Gecko"); -#if defined(HAVE_FFMPEG) - FrameDump::DoState(); -#endif +//#if defined(HAVE_FFMPEG) +// FrameDump::DoState(); +//#endif } void LoadFromBuffer(std::vector& buffer) @@ -240,16 +242,17 @@ void SaveToBuffer(std::vector& buffer) { Core::RunOnCPUThread( [&] { + INFO_LOG(SLIPPI, "at start of save to buffer call"); u8* ptr = nullptr; PointerWrap p(&ptr, PointerWrap::MODE_MEASURE); DoState(p); const size_t buffer_size = reinterpret_cast(ptr); buffer.resize(buffer_size); - ptr = &buffer[0]; p.SetMode(PointerWrap::MODE_WRITE); DoState(p); + INFO_LOG(SLIPPI, "at end of save to buffer call"); }, true); } diff --git a/Source/Core/VideoCommon/VideoBackendBase.cpp b/Source/Core/VideoCommon/VideoBackendBase.cpp index 5e7337c767..e889b6e5bf 100644 --- a/Source/Core/VideoCommon/VideoBackendBase.cpp +++ b/Source/Core/VideoCommon/VideoBackendBase.cpp @@ -264,6 +264,9 @@ void VideoBackendBase::PopulateBackendInfoFromUI() void VideoBackendBase::DoState(PointerWrap& p) { +#ifdef IS_PLAYBACK + VideoCommon_DoState(p); +#else if (!SConfig::GetInstance().bCPUThread) { VideoCommon_DoState(p); @@ -278,6 +281,7 @@ void VideoBackendBase::DoState(PointerWrap& p) // Let the GPU thread sleep after loading the state, so we're not spinning if paused after loading // a state. The next GP burst will wake it up again. Fifo::GpuMaySleep(); +#endif } void VideoBackendBase::InitializeShared()