mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-05 18:40:22 +00:00
Cleanup and misc movie fixes.
This commit is contained in:
parent
0c6dad6a37
commit
1917f83244
@ -136,6 +136,7 @@ void Init()
|
|||||||
if (IsPlayingInput())
|
if (IsPlayingInput())
|
||||||
{
|
{
|
||||||
ReadHeader();
|
ReadHeader();
|
||||||
|
std::thread md5thread(CheckMD5);
|
||||||
if ((strncmp((char *)tmpHeader.gameID, Core::g_CoreStartupParameter.GetUniqueID().c_str(), 6)))
|
if ((strncmp((char *)tmpHeader.gameID, Core::g_CoreStartupParameter.GetUniqueID().c_str(), 6)))
|
||||||
{
|
{
|
||||||
PanicAlert("The recorded game (%s) is not the same as the selected game (%s)", tmpHeader.gameID, Core::g_CoreStartupParameter.GetUniqueID().c_str());
|
PanicAlert("The recorded game (%s) is not the same as the selected game (%s)", tmpHeader.gameID, Core::g_CoreStartupParameter.GetUniqueID().c_str());
|
||||||
@ -164,8 +165,6 @@ void Init()
|
|||||||
g_currentLagCount = 0;
|
g_currentLagCount = 0;
|
||||||
g_currentInputCount = 0;
|
g_currentInputCount = 0;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
std::thread md5thread(CheckMD5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputUpdate()
|
void InputUpdate()
|
||||||
@ -388,7 +387,6 @@ bool BeginRecordingInput(int controllers)
|
|||||||
|
|
||||||
State::SaveAs(tmpStateFilename.c_str());
|
State::SaveAs(tmpStateFilename.c_str());
|
||||||
g_bRecordingFromSaveState = true;
|
g_bRecordingFromSaveState = true;
|
||||||
std::thread md5thread(CheckMD5);
|
|
||||||
|
|
||||||
// This is only done here if starting from save state because otherwise we won't have the titleid. Otherwise it's set in WII_IPC_HLE_Device_es.cpp.
|
// This is only done here if starting from save state because otherwise we won't have the titleid. Otherwise it's set in WII_IPC_HLE_Device_es.cpp.
|
||||||
// TODO: find a way to GetTitleDataPath() from Movie::Init()
|
// TODO: find a way to GetTitleDataPath() from Movie::Init()
|
||||||
@ -638,7 +636,6 @@ void ReadHeader()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
GetSettings();
|
GetSettings();
|
||||||
bSaveConfig = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
videoBackend.resize(ARRAYSIZE(tmpHeader.videoBackend));
|
videoBackend.resize(ARRAYSIZE(tmpHeader.videoBackend));
|
||||||
@ -658,9 +655,7 @@ void ReadHeader()
|
|||||||
{
|
{
|
||||||
author[i] = tmpHeader.author[i];
|
author[i] = tmpHeader.author[i];
|
||||||
}
|
}
|
||||||
|
memcpy(MD5, tmpHeader.md5, 16);
|
||||||
for (int i = 0; i < 16; i++)
|
|
||||||
MD5[i] = tmpHeader.md5[i];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PlayInput(const char *filename)
|
bool PlayInput(const char *filename)
|
||||||
@ -1083,8 +1078,7 @@ void SaveRecording(const char *filename)
|
|||||||
header.bClearSave = g_bClearSave;
|
header.bClearSave = g_bClearSave;
|
||||||
strncpy((char *)header.discChange, g_discChange.c_str(),ARRAYSIZE(header.discChange));
|
strncpy((char *)header.discChange, g_discChange.c_str(),ARRAYSIZE(header.discChange));
|
||||||
strncpy((char *)header.author, author.c_str(),ARRAYSIZE(header.author));
|
strncpy((char *)header.author, author.c_str(),ARRAYSIZE(header.author));
|
||||||
for (int i = 0; i < 16;i++)
|
memcpy(header.md5,MD5,16);
|
||||||
header.md5[i] = MD5[i];
|
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
header.uniqueID = 0;
|
header.uniqueID = 0;
|
||||||
@ -1142,45 +1136,41 @@ void GetSettings()
|
|||||||
if (!Core::g_CoreStartupParameter.bWii)
|
if (!Core::g_CoreStartupParameter.bWii)
|
||||||
g_bClearSave = !File::Exists(SConfig::GetInstance().m_strMemoryCardA);
|
g_bClearSave = !File::Exists(SConfig::GetInstance().m_strMemoryCardA);
|
||||||
bMemcard = SConfig::GetInstance().m_EXIDevice[0] == EXIDEVICE_MEMORYCARD;
|
bMemcard = SConfig::GetInstance().m_EXIDevice[0] == EXIDEVICE_MEMORYCARD;
|
||||||
|
std::thread md5thread(GetMD5);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckMD5()
|
void CheckMD5()
|
||||||
{
|
{
|
||||||
if (IsRecordingInput())
|
for (int i=0, n=0; i<16; i++)
|
||||||
{
|
|
||||||
Core::DisplayMessage("Calculating checksum of game file...", 2000);
|
|
||||||
for (int i = 0; i < 16; i++)
|
|
||||||
MD5[i] = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (int i=0; i<16; i++)
|
|
||||||
{
|
{
|
||||||
if (tmpHeader.md5[i] != 0)
|
if (tmpHeader.md5[i] != 0)
|
||||||
continue;
|
continue;
|
||||||
if (i == 15)
|
n++;
|
||||||
|
if (n == 16)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Core::DisplayMessage("Verifying checksum...", 2000);
|
Core::DisplayMessage("Verifying checksum...", 2000);
|
||||||
}
|
|
||||||
|
|
||||||
unsigned char gameMD5[16];
|
unsigned char gameMD5[16];
|
||||||
char game[255];
|
char game[255];
|
||||||
memcpy(game, SConfig::GetInstance().m_LastFilename.c_str(), SConfig::GetInstance().m_LastFilename.size());
|
memcpy(game, SConfig::GetInstance().m_LastFilename.c_str(), SConfig::GetInstance().m_LastFilename.size());
|
||||||
md5_file(game, gameMD5);
|
md5_file(game, gameMD5);
|
||||||
|
|
||||||
if (IsPlayingInput())
|
|
||||||
{
|
|
||||||
if (memcmp(gameMD5,MD5,16) == 0)
|
if (memcmp(gameMD5,MD5,16) == 0)
|
||||||
Core::DisplayMessage("Checksum of current game matches the recorded game.", 2000);
|
Core::DisplayMessage("Checksum of current game matches the recorded game.", 2000);
|
||||||
else
|
else
|
||||||
PanicAlert("Checksum of current game does not match the recorded game!");
|
PanicAlert("Checksum of current game does not match the recorded game!");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
void GetMD5()
|
||||||
memcpy(MD5, gameMD5,16);
|
{
|
||||||
|
Core::DisplayMessage("Calculating checksum of game file...", 2000);
|
||||||
|
for (int i = 0; i < 16; i++)
|
||||||
|
MD5[i] = 0;
|
||||||
|
char game[255];
|
||||||
|
memcpy(game, SConfig::GetInstance().m_LastFilename.c_str(), SConfig::GetInstance().m_LastFilename.size());
|
||||||
|
md5_file(game, MD5);
|
||||||
Core::DisplayMessage("Finished calculating checksum.", 2000);
|
Core::DisplayMessage("Finished calculating checksum.", 2000);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shutdown()
|
void Shutdown()
|
||||||
|
@ -177,6 +177,7 @@ void EndPlayInput(bool cont);
|
|||||||
void SaveRecording(const char *filename);
|
void SaveRecording(const char *filename);
|
||||||
void DoState(PointerWrap &p);
|
void DoState(PointerWrap &p);
|
||||||
void CheckMD5();
|
void CheckMD5();
|
||||||
|
void GetMD5();
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
||||||
std::string GetInputDisplay();
|
std::string GetInputDisplay();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user