many movie fixes (mainly for readonly mode), and some wii input display support

This commit is contained in:
nitsuja
2011-12-14 21:26:42 -08:00
parent f3325036be
commit 9470f9545f
6 changed files with 345 additions and 159 deletions
+13 -4
View File
@@ -101,6 +101,7 @@ std::string g_stateFileName;
std::thread g_EmuThread;
static std::thread g_cpu_thread;
static bool g_requestRefreshInfo;
SCoreStartupParameter g_CoreStartupParameter;
@@ -261,7 +262,7 @@ void Stop() // - Hammertime!
SConfig::GetInstance().m_SYSCONF->Reload();
INFO_LOG(CONSOLE, "Stop [Main Thread]\t\t---- Shutdown complete ----");
Movie::g_InputCounter = 0;
Movie::g_currentInputCount = 0;
g_bStopping = false;
}
@@ -537,6 +538,11 @@ void SaveScreenShot()
SetState(CORE_RUN);
}
void RequestRefreshInfo()
{
g_requestRefreshInfo = true;
}
// Apply Frame Limit and Display FPS info
// This should only be called from VI
void VideoThrottle()
@@ -561,8 +567,9 @@ void VideoThrottle()
// Update info per second
u32 ElapseTime = (u32)Timer.GetTimeDifference();
if ((ElapseTime >= 1000 && DrawnVideo > 0) || Movie::g_bFrameStep)
if ((ElapseTime >= 1000 && DrawnVideo > 0) || g_requestRefreshInfo)
{
g_requestRefreshInfo = false;
SCoreStartupParameter& _CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter;
u32 FPS = Common::AtomicLoad(DrawnFrame) * 1000 / ElapseTime;
@@ -599,8 +606,10 @@ void VideoThrottle()
#else // Summary information
std::string SFPS;
if (Movie::IsPlayingInput() || Movie::IsRecordingInput())
SFPS = StringFromFormat("VI: %u - Frame: %u - FPS: %u - VPS: %u - SPEED: %u%%", Movie::g_frameCounter, Movie::g_InputCounter, FPS, VPS, Speed);
if (Movie::IsPlayingInput())
SFPS = StringFromFormat("VI: %u/%u - Frame: %u/%u - FPS: %u - VPS: %u - SPEED: %u%%", (u32)Movie::g_currentFrame, (u32)Movie::g_totalFrames, (u32)Movie::g_currentInputCount, (u32)Movie::g_totalInputCount, FPS, VPS, Speed);
else if (Movie::IsRecordingInput())
SFPS = StringFromFormat("VI: %u - Frame: %u - FPS: %u - VPS: %u - SPEED: %u%%", (u32)Movie::g_currentFrame, (u32)Movie::g_currentInputCount, FPS, VPS, Speed);
else
SFPS = StringFromFormat("FPS: %u - VPS: %u - SPEED: %u%%", FPS, VPS, Speed);
#endif
+1
View File
@@ -85,6 +85,7 @@ void StopTrace();
bool ShouldSkipFrame(int skipped);
void VideoThrottle();
void RequestRefreshInfo();
#ifdef RERECORDING
@@ -637,9 +637,9 @@ void Wiimote::Update()
Movie::SetPolledDevice();
if (!Movie::IsPlayingInput() || !Movie::PlayWiimote(m_index, data, rptf_size))
const ReportFeatures& rptf = reporting_mode_features[m_reporting_mode - WM_REPORT_CORE];
if (!Movie::IsPlayingInput() || !Movie::PlayWiimote(m_index, data, rptf_size, rptf.core?(data+rptf.core):NULL, rptf.accel?(data+rptf.accel):NULL, rptf.ir?(data+rptf.ir):NULL))
{
const ReportFeatures& rptf = reporting_mode_features[m_reporting_mode - WM_REPORT_CORE];
rptf_size = rptf.size;
data[0] = 0xA1;
@@ -744,7 +744,7 @@ void Wiimote::Update()
}
if (Movie::IsRecordingInput())
{
Movie::RecordWiimote(m_index, data, rptf_size);
Movie::RecordWiimote(m_index, data, rptf_size, rptf.core?(data+rptf.core):NULL, rptf.accel?(data+rptf.accel):NULL, rptf.ir?(data+rptf.ir):NULL);
}
}
File diff suppressed because it is too large Load Diff
+15 -7
View File
@@ -24,6 +24,8 @@
#include <string>
#include "ChunkFile.h"
// Per-(video )Movie actions
namespace Movie {
@@ -62,7 +64,10 @@ extern ControllerState *g_padStates;
extern char g_playingFile[256];
extern std::string g_recordFile;
extern u64 g_frameCounter, g_lagCounter, g_InputCounter;
extern u64 g_currentByte, g_totalBytes;
extern u64 g_currentFrame, g_totalFrames;
extern u64 g_currentLagCount, g_totalLagCount;
extern u64 g_currentInputCount, g_totalInputCount;
extern u32 g_rerecords;
@@ -77,7 +82,7 @@ struct DTMHeader {
bool bFromSaveState; // false indicates that the recording started from bootup, true for savestate
u64 frameCount; // Number of frames in the recording
u64 InputCount; // Number of input frames in recording
u64 inputCount; // Number of input frames in recording
u64 lagCount; // Number of lag frames in the recording
u64 uniqueID; // A Unique ID comprised of: md5(time + Game ID)
u32 numRerecords; // Number of rerecords/'cuts' of this TAS
@@ -87,9 +92,10 @@ struct DTMHeader {
u8 audioEmulator[16]; // UTF-8 representation of the audio emulator
u8 padBackend[16]; // UTF-8 representation of the input backend
// only used in read-only savestates
u64 frameStart; // Offset to resume playback on
u64 totalFrameCount; // Total frames, same as normal dtm's frameCount
// hack, data that was only used for savestates and would more properly be stored in the savestate itself
// the hack has been removed, but these remain defined and reserved here for legacy support purposes
u64 deprecated_frameStart; // NOT USED ANYMORE (use g_currentFrame)
u64 deprecated_totalFrameCount; // NOT USED ANYMORE (use g_totalFrames or header.frameCount)
u8 reserved[111]; // Make heading 256 bytes, just because we can
};
@@ -103,6 +109,7 @@ void SetPolledDevice();
bool IsAutoFiring();
bool IsRecordingInput();
bool IsRecordingInputFromSaveState();
bool IsJustStartingRecordingInputFromSaveState();
bool IsPlayingInput();
bool IsReadOnly();
@@ -120,14 +127,15 @@ void FrameSkipping();
bool BeginRecordingInput(int controllers);
void RecordInput(SPADStatus *PadStatus, int controllerID);
void RecordWiimote(int wiimote, u8* data, s8 size);
void RecordWiimote(int wiimote, u8* data, s8 size, u8* const coreData, u8* const accelData, u8* const irData);
bool PlayInput(const char *filename);
void LoadInput(const char *filename);
void PlayController(SPADStatus *PadStatus, int controllerID);
bool PlayWiimote(int wiimote, u8* data, s8 &size);
bool PlayWiimote(int wiimote, u8* data, s8 &size, u8* const coreData, u8* const accelData, u8* const irData);
void EndPlayInput(bool cont);
void SaveRecording(const char *filename);
void DoState(PointerWrap &p, bool doNot=false);
std::string GetInputDisplay();
+25 -8
View File
@@ -74,7 +74,7 @@ static u64 lastCheckedStates[NUM_HOOKS];
static u8 hook;
// Don't forget to increase this after doing changes on the savestate system
static const int STATE_VERSION = 5;
static const int STATE_VERSION = 6;
struct StateHeader
{
@@ -98,13 +98,29 @@ void EnableCompression(bool compression)
void DoState(PointerWrap &p)
{
u32 cookie = 0xBAADBABE + STATE_VERSION;
p.Do(cookie);
if (cookie != 0xBAADBABE + STATE_VERSION)
u32 version = STATE_VERSION;
{
p.SetMode(PointerWrap::MODE_MEASURE);
return;
u32 cookie = version + 0xBAADBABE;
p.Do(cookie);
version = cookie - 0xBAADBABE;
}
if (version != STATE_VERSION)
{
if (version == 5 && STATE_VERSION == 6)
{
// from version 5 to 6, the only difference was the addition of calling Movie::DoState,
// so (because it's easy) let's not break compatibility in this case
}
else
{
// if the version doesn't match, fail.
// this will trigger a message like "Can't load state from other revisions"
p.SetMode(PointerWrap::MODE_MEASURE);
return;
}
}
// Begin with video backend, so that it gets a chance to clear it's caches and writeback modified things to RAM
// Pause the video thread in multi-threaded mode
g_video_backend->RunLoop(false);
@@ -116,6 +132,7 @@ void DoState(PointerWrap &p)
PowerPC::DoState(p);
HW::DoState(p);
CoreTiming::DoState(p);
Movie::DoState(p, version<6);
// Resume the video thread
g_video_backend->RunLoop(true);
@@ -253,7 +270,7 @@ void SaveFileStateCallback(u64 userdata, int cyclesLate)
p.SetMode(PointerWrap::MODE_WRITE);
DoState(p);
if ((Movie::IsRecordingInput() || Movie::IsPlayingInput()) && !Movie::IsRecordingInputFromSaveState())
if ((Movie::IsRecordingInput() || Movie::IsPlayingInput()) && !Movie::IsJustStartingRecordingInputFromSaveState())
Movie::SaveRecording((g_current_filename + ".dtm").c_str());
else if (!Movie::IsRecordingInput() && !Movie::IsPlayingInput())
File::Delete(g_current_filename + ".dtm");
@@ -360,7 +377,7 @@ void LoadFileStateCallback(u64 userdata, int cyclesLate)
if (File::Exists(g_current_filename + ".dtm"))
Movie::LoadInput((g_current_filename + ".dtm").c_str());
else if (!Movie::IsRecordingInputFromSaveState())
else if (!Movie::IsJustStartingRecordingInputFromSaveState())
Movie::EndPlayInput(false);
}