mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Rerecording: Added frame step function and status bar for the input recording. Turn on frame stepping with Ctrl, step with Space. Build the Rerecording version with the setting in Setup.h.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2273 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -46,6 +46,9 @@
|
||||
// This may remove sound artifacts in Wario Land Shake It and perhaps other games
|
||||
//#define SETUP_AVOID_SOUND_ARTIFACTS
|
||||
|
||||
// Build with playback rerecording options
|
||||
//#define RERECORDING
|
||||
|
||||
// Build with music modification
|
||||
//#define MUSICMOD
|
||||
|
||||
|
@ -405,13 +405,12 @@ int ChooseStringFrom(const char* str, const char* * items)
|
||||
|
||||
|
||||
// Thousand separator. Turns 12345678 into 12,345,678.
|
||||
std::string ThS(int a, bool b)
|
||||
std::string ThS(int Integer, bool Unsigned)
|
||||
{
|
||||
char cbuf[20];
|
||||
|
||||
// determine treatment of signed or unsigned
|
||||
if(b) sprintf(cbuf, "%u", a); else sprintf(cbuf, "%i", a);
|
||||
|
||||
// Create storage space
|
||||
char cbuf[20];
|
||||
// Determine treatment of signed or unsigned
|
||||
if(Unsigned) sprintf(cbuf, "%u", Integer); else sprintf(cbuf, "%i", Integer);
|
||||
|
||||
std::string sbuf = cbuf;
|
||||
for (u32 i = 0; i < sbuf.length(); ++i)
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include "Timer.h"
|
||||
#include "StringUtil.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
u32 timeGetTime()
|
||||
@ -38,8 +39,15 @@ u32 timeGetTime()
|
||||
|
||||
namespace Common
|
||||
{
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Initiate, Start, Stop, and Update the time
|
||||
// ---------------
|
||||
|
||||
// Set initial values for the class
|
||||
Timer::Timer(void)
|
||||
: m_LastTime(0)
|
||||
: m_LastTime(0), m_StartTime(0), m_Running(false)
|
||||
{
|
||||
Update();
|
||||
|
||||
@ -48,20 +56,90 @@ Timer::Timer(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
// Write the starting time
|
||||
void Timer::Start()
|
||||
{
|
||||
m_StartTime = timeGetTime();
|
||||
m_Running = true;
|
||||
}
|
||||
|
||||
// Stop the timer
|
||||
void Timer::Stop()
|
||||
{
|
||||
// Write the final time
|
||||
m_LastTime = timeGetTime();
|
||||
m_Running = false;
|
||||
}
|
||||
|
||||
// Update the last time variable
|
||||
void Timer::Update(void)
|
||||
{
|
||||
m_LastTime = timeGetTime();
|
||||
//TODO(ector) - QPF
|
||||
}
|
||||
/////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Get time difference and elapsed time
|
||||
// ---------------
|
||||
|
||||
// Get the number of milliseconds since the last Update()
|
||||
s64 Timer::GetTimeDifference(void)
|
||||
{
|
||||
return(timeGetTime() - m_LastTime);
|
||||
}
|
||||
|
||||
// Add the time difference since the last Update() to the starting time
|
||||
void Timer::AddTimeDifference()
|
||||
{
|
||||
m_StartTime += GetTimeDifference();
|
||||
}
|
||||
|
||||
// Get the time elapsed since the Start()
|
||||
u64 Timer::GetTimeElapsed(void)
|
||||
{
|
||||
/* If we have not started yet return 1 (because then I don't have to change the FPS
|
||||
calculation in CoreRerecording.cpp */
|
||||
if (m_StartTime == 0) return 1;
|
||||
|
||||
// Rrturn the final timer time if the timer is stopped
|
||||
if (!m_Running) return (m_LastTime - m_StartTime);
|
||||
|
||||
return (timeGetTime() - m_StartTime);
|
||||
}
|
||||
|
||||
// Get the formattet time elapsed since the Start()
|
||||
std::string Timer::GetTimeElapsedFormatted(void)
|
||||
{
|
||||
// If we have not started yet, return zero
|
||||
if(m_StartTime == 0) return "00:00:00:000";
|
||||
|
||||
// The number of milliseconds since the start, use a different value if the timer is stopped
|
||||
u32 Milliseconds;
|
||||
if(m_Running)
|
||||
Milliseconds = timeGetTime() - m_StartTime;
|
||||
else
|
||||
Milliseconds = m_LastTime - m_StartTime;
|
||||
// Seconds
|
||||
u32 Seconds = Milliseconds / 1000;
|
||||
// Minutes
|
||||
u32 Minutes = Seconds / 60;
|
||||
// Hours
|
||||
u32 Hours = Minutes / 60;
|
||||
|
||||
std::string TmpStr = StringFromFormat("%02i:%02i:%02i:%03i", Hours, Minutes % 60, Seconds % 60, Milliseconds % 1000);
|
||||
return TmpStr;
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Get current time
|
||||
// ---------------
|
||||
void Timer::IncreaseResolution()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
@ -86,6 +164,7 @@ void _time64(u64* t)
|
||||
#endif
|
||||
|
||||
|
||||
// Get the number of seconds since January 1 1970
|
||||
u64 Timer::GetTimeSinceJan1970(void)
|
||||
{
|
||||
time_t ltime;
|
||||
@ -106,6 +185,7 @@ u64 Timer::GetLocalTimeSinceJan1970(void)
|
||||
return (u64)(sysTime + tzDiff);
|
||||
}
|
||||
|
||||
// Return the current time formatted as Minutes:Seconds:Milliseconds in the form 00:00:000
|
||||
std::string Timer::GetTimeFormatted(void)
|
||||
{
|
||||
struct timeb tp;
|
||||
@ -115,4 +195,7 @@ std::string Timer::GetTimeFormatted(void)
|
||||
|
||||
return std::string(temp);
|
||||
}
|
||||
/////////////////////////////////////
|
||||
|
||||
|
||||
} // end of namespace Common
|
||||
|
@ -29,11 +29,13 @@ class Timer
|
||||
|
||||
Timer();
|
||||
|
||||
void Start();
|
||||
void Stop();
|
||||
void Update();
|
||||
|
||||
|
||||
// Always in milliseconds, regardless of alternative internal representation
|
||||
// The time difference is always returned in milliseconds, regardless of alternative internal representation
|
||||
s64 GetTimeDifference(void);
|
||||
void AddTimeDifference();
|
||||
|
||||
static void IncreaseResolution();
|
||||
static void RestoreResolution();
|
||||
@ -41,12 +43,15 @@ class Timer
|
||||
static u64 GetLocalTimeSinceJan1970();
|
||||
|
||||
static std::string GetTimeFormatted();
|
||||
|
||||
std::string GetTimeElapsedFormatted();
|
||||
u64 Timer::GetTimeElapsed();
|
||||
|
||||
public:
|
||||
|
||||
u64 m_LastTime;
|
||||
u64 m_StartTime;
|
||||
u64 m_frequency;
|
||||
bool m_Running;
|
||||
};
|
||||
} // end of namespace Common
|
||||
|
||||
|
Reference in New Issue
Block a user