mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-15 16:59:18 +01:00
Add Tick Count to Movie Files
Added tick count to .dtm movie files for more accurate time calculations
This commit is contained in:
parent
afc4a37058
commit
c6e1a19e61
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
|
#include "Core/CoreTiming.h"
|
||||||
#include "Core/Movie.h"
|
#include "Core/Movie.h"
|
||||||
#include "Core/NetPlayProto.h"
|
#include "Core/NetPlayProto.h"
|
||||||
#include "Core/State.h"
|
#include "Core/State.h"
|
||||||
@ -54,6 +55,7 @@ u64 g_currentByte = 0, g_totalBytes = 0;
|
|||||||
u64 g_currentFrame = 0, g_totalFrames = 0; // VI
|
u64 g_currentFrame = 0, g_totalFrames = 0; // VI
|
||||||
u64 g_currentLagCount = 0, g_totalLagCount = 0; // just stats
|
u64 g_currentLagCount = 0, g_totalLagCount = 0; // just stats
|
||||||
u64 g_currentInputCount = 0, g_totalInputCount = 0; // just stats
|
u64 g_currentInputCount = 0, g_totalInputCount = 0; // just stats
|
||||||
|
u64 g_totalTickCount = 0, g_tickCountAtLastInput = 0; // just stats
|
||||||
u64 g_recordingStartTime; // seconds since 1970 that recording started
|
u64 g_recordingStartTime; // seconds since 1970 that recording started
|
||||||
bool bSaveConfig = false, bSkipIdle = false, bDualCore = false, bProgressive = false, bDSPHLE = false, bFastDiscSpeed = false;
|
bool bSaveConfig = false, bSkipIdle = false, bDualCore = false, bProgressive = false, bDSPHLE = false, bFastDiscSpeed = false;
|
||||||
bool bMemcard = false, g_bClearSave = false, bSyncGPU = false, bNetPlay = false;
|
bool bMemcard = false, g_bClearSave = false, bSyncGPU = false, bNetPlay = false;
|
||||||
@ -176,6 +178,7 @@ void Init()
|
|||||||
GetSettings();
|
GetSettings();
|
||||||
std::thread md5thread(GetMD5);
|
std::thread md5thread(GetMD5);
|
||||||
md5thread.detach();
|
md5thread.detach();
|
||||||
|
g_tickCountAtLastInput = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_frameSkipCounter = g_framesToSkip;
|
g_frameSkipCounter = g_framesToSkip;
|
||||||
@ -201,7 +204,11 @@ void InputUpdate()
|
|||||||
{
|
{
|
||||||
g_currentInputCount++;
|
g_currentInputCount++;
|
||||||
if (IsRecordingInput())
|
if (IsRecordingInput())
|
||||||
|
{
|
||||||
g_totalInputCount = g_currentInputCount;
|
g_totalInputCount = g_currentInputCount;
|
||||||
|
g_totalTickCount += CoreTiming::GetTicks() - g_tickCountAtLastInput;
|
||||||
|
g_tickCountAtLastInput = CoreTiming::GetTicks();
|
||||||
|
}
|
||||||
|
|
||||||
if (IsPlayingInput() && g_currentInputCount == (g_totalInputCount -1) && SConfig::GetInstance().m_PauseMovie)
|
if (IsPlayingInput() && g_currentInputCount == (g_totalInputCount -1) && SConfig::GetInstance().m_PauseMovie)
|
||||||
Core::SetState(Core::CORE_PAUSE);
|
Core::SetState(Core::CORE_PAUSE);
|
||||||
@ -421,6 +428,7 @@ bool BeginRecordingInput(int controllers)
|
|||||||
g_currentFrame = g_totalFrames = 0;
|
g_currentFrame = g_totalFrames = 0;
|
||||||
g_currentLagCount = g_totalLagCount = 0;
|
g_currentLagCount = g_totalLagCount = 0;
|
||||||
g_currentInputCount = g_totalInputCount = 0;
|
g_currentInputCount = g_totalInputCount = 0;
|
||||||
|
g_totalTickCount = g_tickCountAtLastInput = 0;
|
||||||
if (NetPlay::IsNetPlayRunning())
|
if (NetPlay::IsNetPlayRunning())
|
||||||
{
|
{
|
||||||
bNetPlay = true;
|
bNetPlay = true;
|
||||||
@ -745,6 +753,7 @@ bool PlayInput(const std::string& filename)
|
|||||||
g_totalFrames = tmpHeader.frameCount;
|
g_totalFrames = tmpHeader.frameCount;
|
||||||
g_totalLagCount = tmpHeader.lagCount;
|
g_totalLagCount = tmpHeader.lagCount;
|
||||||
g_totalInputCount = tmpHeader.inputCount;
|
g_totalInputCount = tmpHeader.inputCount;
|
||||||
|
g_totalTickCount = tmpHeader.tickCount;
|
||||||
g_currentFrame = 0;
|
g_currentFrame = 0;
|
||||||
g_currentLagCount = 0;
|
g_currentLagCount = 0;
|
||||||
g_currentInputCount = 0;
|
g_currentInputCount = 0;
|
||||||
@ -786,6 +795,7 @@ void DoState(PointerWrap &p)
|
|||||||
p.Do(g_currentLagCount);
|
p.Do(g_currentLagCount);
|
||||||
p.Do(g_currentInputCount);
|
p.Do(g_currentInputCount);
|
||||||
p.Do(g_bPolled);
|
p.Do(g_bPolled);
|
||||||
|
p.Do(g_tickCountAtLastInput);
|
||||||
// other variables (such as g_totalBytes and g_totalFrames) are set in LoadInput
|
// other variables (such as g_totalBytes and g_totalFrames) are set in LoadInput
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -834,6 +844,7 @@ void LoadInput(const std::string& filename)
|
|||||||
g_totalFrames = tmpHeader.frameCount;
|
g_totalFrames = tmpHeader.frameCount;
|
||||||
g_totalLagCount = tmpHeader.lagCount;
|
g_totalLagCount = tmpHeader.lagCount;
|
||||||
g_totalInputCount = tmpHeader.inputCount;
|
g_totalInputCount = tmpHeader.inputCount;
|
||||||
|
g_totalTickCount = tmpHeader.tickCount;
|
||||||
|
|
||||||
EnsureTmpInputSize((size_t)totalSavedBytes);
|
EnsureTmpInputSize((size_t)totalSavedBytes);
|
||||||
g_totalBytes = totalSavedBytes;
|
g_totalBytes = totalSavedBytes;
|
||||||
@ -1143,6 +1154,7 @@ void SaveRecording(const std::string& filename)
|
|||||||
memcpy(header.revision, revision, ArraySize(header.revision));
|
memcpy(header.revision, revision, ArraySize(header.revision));
|
||||||
header.DSPiromHash = DSPiromHash;
|
header.DSPiromHash = DSPiromHash;
|
||||||
header.DSPcoefHash = DSPcoefHash;
|
header.DSPcoefHash = DSPcoefHash;
|
||||||
|
header.tickCount = g_totalTickCount;
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
header.uniqueID = 0;
|
header.uniqueID = 0;
|
||||||
@ -1276,7 +1288,7 @@ void GetMD5()
|
|||||||
|
|
||||||
void Shutdown()
|
void Shutdown()
|
||||||
{
|
{
|
||||||
g_currentInputCount = g_totalInputCount = g_totalFrames = g_totalBytes = 0;
|
g_currentInputCount = g_totalInputCount = g_totalFrames = g_totalBytes = g_tickCountAtLastInput = 0;
|
||||||
delete [] tmpInput;
|
delete [] tmpInput;
|
||||||
tmpInput = nullptr;
|
tmpInput = nullptr;
|
||||||
tmpInputAllocated = 0;
|
tmpInputAllocated = 0;
|
||||||
|
@ -64,6 +64,7 @@ extern u64 g_currentByte, g_totalBytes;
|
|||||||
extern u64 g_currentFrame, g_totalFrames;
|
extern u64 g_currentFrame, g_totalFrames;
|
||||||
extern u64 g_currentLagCount, g_totalLagCount;
|
extern u64 g_currentLagCount, g_totalLagCount;
|
||||||
extern u64 g_currentInputCount, g_totalInputCount;
|
extern u64 g_currentInputCount, g_totalInputCount;
|
||||||
|
extern u64 g_currentTickCount, g_totalTickCount, g_tickCountAtLastInput;
|
||||||
extern std::string g_discChange;
|
extern std::string g_discChange;
|
||||||
|
|
||||||
extern u32 g_rerecords;
|
extern u32 g_rerecords;
|
||||||
@ -116,7 +117,8 @@ struct DTMHeader
|
|||||||
u8 revision[20]; // Git hash
|
u8 revision[20]; // Git hash
|
||||||
u32 DSPiromHash;
|
u32 DSPiromHash;
|
||||||
u32 DSPcoefHash;
|
u32 DSPcoefHash;
|
||||||
u8 reserved2[19]; // Make heading 256 bytes, just because we can
|
u64 tickCount; // Number of ticks in the recording
|
||||||
|
u8 reserved2[11]; // Make heading 256 bytes, just because we can
|
||||||
};
|
};
|
||||||
static_assert(sizeof(DTMHeader) == 256, "DTMHeader should be 256 bytes");
|
static_assert(sizeof(DTMHeader) == 256, "DTMHeader should be 256 bytes");
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ static Common::Event g_compressAndDumpStateSyncEvent;
|
|||||||
static std::thread g_save_thread;
|
static std::thread g_save_thread;
|
||||||
|
|
||||||
// Don't forget to increase this after doing changes on the savestate system
|
// Don't forget to increase this after doing changes on the savestate system
|
||||||
static const u32 STATE_VERSION = 23;
|
static const u32 STATE_VERSION = 24;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user