From 5133ac551b60ae0bfa635e2b2abc161efb823479 Mon Sep 17 00:00:00 2001 From: rog Date: Tue, 23 Oct 2012 01:52:50 -0400 Subject: [PATCH 01/13] merge relevant changes from bc61dbdf58a8 in otu0001-desync-fix clone --- Source/Core/Core/Core.vcxproj | 6 +- .../Core/Src/HW/DSPHLE/UCodes/UCode_AXWii.cpp | 3 +- Source/Core/Core/Src/HW/Wiimote.cpp | 6 +- .../Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp | 65 +++++++++++++++++++ .../Core/Src/IPC_HLE/WII_IPC_HLE_Device.h | 6 +- .../Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp | 1 + .../Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp | 1 + Source/Core/VideoCommon/VideoCommon.vcxproj | 8 ++- 8 files changed, 87 insertions(+), 9 deletions(-) diff --git a/Source/Core/Core/Core.vcxproj b/Source/Core/Core/Core.vcxproj index e03d40e43a..0c2b4018a4 100644 --- a/Source/Core/Core/Core.vcxproj +++ b/Source/Core/Core/Core.vcxproj @@ -385,7 +385,11 @@ - + + false + false + false + Create Create diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AXWii.cpp b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AXWii.cpp index 03b1d3b75b..bc50269037 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AXWii.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AXWii.cpp @@ -193,7 +193,8 @@ bool CUCode_AXWii::AXTask(u32& _uMail) case 0x0004: // PBs are here now m_addressPBs = HLEMemory_Read_U32(uAddress); - soundStream->GetMixer()->SetHLEReady(true); + if (soundStream) + soundStream->GetMixer()->SetHLEReady(true); // soundStream->Update(); uAddress += 4; break; diff --git a/Source/Core/Core/Src/HW/Wiimote.cpp b/Source/Core/Core/Src/HW/Wiimote.cpp index 30ab7af141..0928deffb1 100644 --- a/Source/Core/Core/Src/HW/Wiimote.cpp +++ b/Source/Core/Core/Src/HW/Wiimote.cpp @@ -136,9 +136,9 @@ void DoState(unsigned char **ptr, int mode) { // TODO: - //PointerWrap p(ptr, mode); - //for (unsigned int i=0; i<4; ++i) - // ((WiimoteEmu::Wiimote*)g_plugin.controllers[i])->DoState(p); + PointerWrap p(ptr, mode); + for (unsigned int i=0; i<4; ++i) + ((WiimoteEmu::Wiimote*)g_plugin.controllers[i])->DoState(p); } // ___________________________________________________________________________ diff --git a/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp b/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp index e7036c8fcb..5a994d859e 100644 --- a/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp +++ b/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp @@ -601,6 +601,71 @@ void Wiimote::DoState(PointerWrap& p) // Reset(); // should cause a status report to be sent, then wii should re-setup wiimote //} //p.Do(m_reporting_channel); + + //TODO: save to minimize + p.Do(m_extension->active_extension); + p.Do(m_extension->switch_extension); + + p.Do(m_accel); + p.Do(m_index); + p.Do(ir_sin); + p.Do(ir_cos); + p.Do(m_rumble_on); + p.Do(m_speaker_mute); + p.Do(m_motion_plus_present); + p.Do(m_motion_plus_active); + p.Do(m_reporting_auto); + p.Do(m_reporting_mode); + p.Do(m_reporting_channel); + p.Do(m_shake_step); + p.Do(m_sensor_bar_on_top); + p.Do(m_status); + p.Do(m_adpcm_state); + p.Do(m_ext_key); + p.Do(m_eeprom); + p.Do(m_reg_motion_plus); + p.Do(m_reg_ir); + p.Do(m_reg_ext); + p.Do(m_reg_speaker); + + //Do 'm_read_requests' queue + { + u32 size; + if (p.mode == PointerWrap::MODE_READ) + { + //clear + while (m_read_requests.size()) + m_read_requests.pop(); + + p.Do(size); + while (size--) + { + ReadRequest tmp; + p.Do(tmp.address); + p.Do(tmp.position); + p.Do(tmp.size); + tmp.data = new u8[tmp.size]; + p.DoArray(tmp.data, tmp.size); + m_read_requests.push(tmp); + } + } + else + { + std::queue tmp_queue(m_read_requests); + size = m_read_requests.size(); + p.Do(size); + while (!tmp_queue.empty()) + { + ReadRequest tmp = tmp_queue.front(); + p.Do(tmp.address); + p.Do(tmp.position); + p.Do(tmp.size); + p.DoArray(tmp.data, tmp.size); + tmp_queue.pop(); + } + } + } + p.DoMarker("Wiimote"); } } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device.h index c124bb4448..4eb4a3e554 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device.h @@ -62,7 +62,11 @@ public: virtual ~IWII_IPC_HLE_Device() { } - virtual void DoState(PointerWrap& p) { DoStateShared(p); } + virtual void DoState(PointerWrap& p) + { + DoStateShared(p); + p.Do(m_Active); + } void DoStateShared(PointerWrap& p); diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp index d53d1ebd2a..0b6de9b4f6 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp @@ -112,6 +112,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::DoState(PointerWrap &p) std::deque m_EventQueue; */ + p.Do(m_ControllerBD); p.Do(m_CtrlSetup); p.Do(m_ACLSetup); p.Do(m_HCIEndpoint); diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp index 8445eeffdc..e59e1b3208 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp @@ -102,6 +102,7 @@ void CWII_IPC_HLE_WiiMote::DoState(PointerWrap &p) p.Do(uclass); p.Do(features); p.Do(lmp_version); + p.Do(lmp_subversion); p.Do(m_LinkKey); p.Do(m_Name); diff --git a/Source/Core/VideoCommon/VideoCommon.vcxproj b/Source/Core/VideoCommon/VideoCommon.vcxproj index 0869f33ff4..bf9122e6b5 100644 --- a/Source/Core/VideoCommon/VideoCommon.vcxproj +++ b/Source/Core/VideoCommon/VideoCommon.vcxproj @@ -111,7 +111,8 @@ ..\Common\Src;..\Core\Src;..\..\..\Externals\SOIL;..\..\..\Externals\CLRun\include;%(AdditionalIncludeDirectories) - + false + true @@ -129,7 +130,7 @@ ..\Common\Src;..\Core\Src;..\..\..\Externals\SOIL;..\..\..\Externals\CLRun\include;%(AdditionalIncludeDirectories) - true + false true @@ -141,7 +142,8 @@ ..\Common\Src;..\Core\Src;..\..\..\Externals\SOIL;..\..\..\Externals\CLRun\include;%(AdditionalIncludeDirectories) - + false + true true From a1186d84df0559d6d367d5d19331324a4858765c Mon Sep 17 00:00:00 2001 From: rog Date: Tue, 23 Oct 2012 02:31:16 -0400 Subject: [PATCH 02/13] update state version --- Source/Core/Core/Src/State.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Core/Src/State.cpp b/Source/Core/Core/Src/State.cpp index 3f3e367349..cf01b78d5e 100644 --- a/Source/Core/Core/Src/State.cpp +++ b/Source/Core/Core/Src/State.cpp @@ -71,7 +71,7 @@ static Common::Event g_compressAndDumpStateSyncEvent; static std::thread g_save_thread; // Don't forget to increase this after doing changes on the savestate system -static const int STATE_VERSION = 8; +static const int STATE_VERSION = 9; struct StateHeader { From ca650d44352f4cd994a51c6bbc813b3b3bb4adda Mon Sep 17 00:00:00 2001 From: rog Date: Fri, 23 Nov 2012 22:23:58 -0500 Subject: [PATCH 03/13] Record md5 of game file to .dtm, and check it when playing back. --- Source/Core/Core/Src/Movie.cpp | 60 +++++++++++++++++++++++++++++++--- Source/Core/Core/Src/Movie.h | 3 +- 2 files changed, 58 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/Src/Movie.cpp b/Source/Core/Core/Src/Movie.cpp index 0b6d3adae3..465a25b563 100644 --- a/Source/Core/Core/Src/Movie.cpp +++ b/Source/Core/Core/Src/Movie.cpp @@ -36,6 +36,8 @@ #include "HW/EXI_Channel.h" #include "HW/DVDInterface.h" #include "../../Common/Src/NandPaths.h" +#include "thread.h" +#include "Crypto/md5.h" // large enough for just over 24 hours of single-player recording #define MAX_DTM_LENGTH (40 * 1024 * 1024) @@ -69,6 +71,7 @@ bool g_bDiscChange = false; std::string g_discChange = ""; std::string author = ""; u64 g_titleID = 0; +unsigned char MD5[16]; bool g_bRecordingFromSaveState = false; bool g_bPolled = false; @@ -167,6 +170,8 @@ void Init() //delete tmpInput; //tmpInput = NULL; } + else + std::thread md5thread(CheckMD5); } void InputUpdate() @@ -392,10 +397,13 @@ bool BeginRecordingInput(int controllers) // 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() - if (File::Exists((Common::GetTitleDataPath(g_titleID) + "banner.bin").c_str())) - Movie::g_bClearSave = false; - else - Movie::g_bClearSave = true; + if (Core::g_CoreStartupParameter.bWii) + { + if (File::Exists((Common::GetTitleDataPath(g_titleID) + "banner.bin").c_str())) + Movie::g_bClearSave = false; + else + Movie::g_bClearSave = true; + } } g_playMode = MODE_RECORDING; GetSettings(); @@ -655,6 +663,9 @@ void ReadHeader() { author[i] = tmpHeader.author[i]; } + + for (int i = 0; i < 16; i++) + MD5[i] = tmpHeader.md5[i]; } bool PlayInput(const char *filename) @@ -1077,6 +1088,8 @@ void SaveRecording(const char *filename) header.bClearSave = g_bClearSave; strncpy((char *)header.discChange, g_discChange.c_str(),ARRAYSIZE(header.discChange)); strncpy((char *)header.author, author.c_str(),ARRAYSIZE(header.author)); + for (int i = 0; i < 16;i++) + header.md5[i] = MD5[i]; // TODO header.uniqueID = 0; @@ -1135,4 +1148,43 @@ void GetSettings() g_bClearSave = !File::Exists(SConfig::GetInstance().m_strMemoryCardA); bMemcard = SConfig::GetInstance().m_EXIDevice[0] == EXIDEVICE_MEMORYCARD; } + +void CheckMD5() +{ + if (IsRecordingInput()) + { + Core::DisplayMessage("Calculating md5 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) + continue; + if (i == 15) + return; + } + Core::DisplayMessage("Checking md5 of game file against recorded game...", 2000); + } + + unsigned char gameMD5[16]; + char game[255]; + memcpy(game, SConfig::GetInstance().m_LastFilename.c_str(), SConfig::GetInstance().m_LastFilename.size()); + md5_file(game, gameMD5); + + if (IsPlayingInput()) + { + if (memcmp(gameMD5,MD5,16) == 0) + Core::DisplayMessage("MD5 of playing game matches the recorded game.", 2000); + else + PanicAlert("MD5 of playing game does not match the recorded game!"); + } + else + { + memcpy(MD5, gameMD5,16); + Core::DisplayMessage("Finished Calculating md5.", 2000); + } +} }; diff --git a/Source/Core/Core/Src/Movie.h b/Source/Core/Core/Src/Movie.h index 0152a66879..1626f9cfeb 100644 --- a/Source/Core/Core/Src/Movie.h +++ b/Source/Core/Core/Src/Movie.h @@ -99,7 +99,7 @@ struct DTMHeader { u8 videoBackend[16]; // UTF-8 representation of the video backend u8 audioEmulator[16]; // UTF-8 representation of the audio emulator - u8 padBackend[16]; // UTF-8 representation of the input backend + unsigned char md5[16]; // MD5 of game iso u64 recordingStartTime; // seconds since 1970 that recording started (used for RTC) @@ -178,6 +178,7 @@ bool PlayWiimote(int wiimote, u8* data, const struct WiimoteEmu::ReportFeatures& void EndPlayInput(bool cont); void SaveRecording(const char *filename); void DoState(PointerWrap &p); +void CheckMD5(); std::string GetInputDisplay(); From a374f9f0492f2cb0056dca336a0e61c7b529475d Mon Sep 17 00:00:00 2001 From: rog Date: Fri, 23 Nov 2012 22:47:32 -0500 Subject: [PATCH 04/13] Check md5 when recording from save state too. --- Source/Core/Core/Src/Movie.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Core/Core/Src/Movie.cpp b/Source/Core/Core/Src/Movie.cpp index 465a25b563..16b9f7caa4 100644 --- a/Source/Core/Core/Src/Movie.cpp +++ b/Source/Core/Core/Src/Movie.cpp @@ -394,6 +394,7 @@ bool BeginRecordingInput(int controllers) State::SaveAs(tmpStateFilename.c_str()); 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. // TODO: find a way to GetTitleDataPath() from Movie::Init() From f251704df23bea1fda8663dec6f94d0d55ee73d9 Mon Sep 17 00:00:00 2001 From: rog Date: Sat, 24 Nov 2012 01:10:07 -0500 Subject: [PATCH 05/13] The trick to multithreaded emulation is to include thread.h more than once. Also, rewords some awkardly written messages. --- Source/Core/Core/Src/Movie.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Source/Core/Core/Src/Movie.cpp b/Source/Core/Core/Src/Movie.cpp index 16b9f7caa4..2bf0c73dba 100644 --- a/Source/Core/Core/Src/Movie.cpp +++ b/Source/Core/Core/Src/Movie.cpp @@ -36,7 +36,6 @@ #include "HW/EXI_Channel.h" #include "HW/DVDInterface.h" #include "../../Common/Src/NandPaths.h" -#include "thread.h" #include "Crypto/md5.h" // large enough for just over 24 hours of single-player recording @@ -1154,7 +1153,7 @@ void CheckMD5() { if (IsRecordingInput()) { - Core::DisplayMessage("Calculating md5 of game file...", 2000); + Core::DisplayMessage("Calculating checksum of game file...", 2000); for (int i = 0; i < 16; i++) MD5[i] = 0; } @@ -1167,7 +1166,7 @@ void CheckMD5() if (i == 15) return; } - Core::DisplayMessage("Checking md5 of game file against recorded game...", 2000); + Core::DisplayMessage("Verifying checksum...", 2000); } unsigned char gameMD5[16]; @@ -1178,14 +1177,14 @@ void CheckMD5() if (IsPlayingInput()) { if (memcmp(gameMD5,MD5,16) == 0) - Core::DisplayMessage("MD5 of playing game matches the recorded game.", 2000); + Core::DisplayMessage("Checksum of current game matches the recorded game.", 2000); else - PanicAlert("MD5 of playing game does not match the recorded game!"); + PanicAlert("Checksum of current game does not match the recorded game!"); } else { memcpy(MD5, gameMD5,16); - Core::DisplayMessage("Finished Calculating md5.", 2000); + Core::DisplayMessage("Finished calculating checksum.", 2000); } } }; From d26c7fea177a123d40b3d9b8cbd14cfb17dd8cba Mon Sep 17 00:00:00 2001 From: rog Date: Sat, 24 Nov 2012 01:40:34 -0500 Subject: [PATCH 06/13] Remove old, unused code. --- Source/Core/Core/Src/Movie.cpp | 3 +-- Source/Core/Core/Src/Movie.h | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Source/Core/Core/Src/Movie.cpp b/Source/Core/Core/Src/Movie.cpp index 2bf0c73dba..fd86516c57 100644 --- a/Source/Core/Core/Src/Movie.cpp +++ b/Source/Core/Core/Src/Movie.cpp @@ -27,7 +27,6 @@ #include "HW/WiimoteEmu/WiimoteEmu.h" #include "HW/WiimoteEmu/WiimoteHid.h" #include "IPC_HLE/WII_IPC_HLE_Device_usb.h" -#include "VideoBackendBase.h" #include "State.h" #include "Timer.h" #include "VideoConfig.h" @@ -64,7 +63,7 @@ u64 g_currentInputCount = 0, g_totalInputCount = 0; // just stats u64 g_recordingStartTime; // seconds since 1970 that recording started bool bSaveConfig, bSkipIdle, bDualCore, bProgressive, bDSPHLE, bFastDiscSpeed = false; bool bMemcard, g_bClearSave = false; -std::string videoBackend = "opengl"; +std::string videoBackend = "unknown"; int iCPUCore = 1; bool g_bDiscChange = false; std::string g_discChange = ""; diff --git a/Source/Core/Core/Src/Movie.h b/Source/Core/Core/Src/Movie.h index 1626f9cfeb..42e7dc3e75 100644 --- a/Source/Core/Core/Src/Movie.h +++ b/Source/Core/Core/Src/Movie.h @@ -19,7 +19,6 @@ #define __MOVIE_H #include "Common.h" -#include "FileUtil.h" #include "../../InputCommon/Src/GCPadStatus.h" #include @@ -133,7 +132,6 @@ void Init(); void SetPolledDevice(); -bool IsAutoFiring(); bool IsRecordingInput(); bool IsRecordingInputFromSaveState(); bool IsJustStartingRecordingInputFromSaveState(); From 0c6dad6a3726b0073640165689ecb416b4510014 Mon Sep 17 00:00:00 2001 From: rog Date: Sat, 24 Nov 2012 18:27:20 -0500 Subject: [PATCH 07/13] Clear unneeded variables upon stopping emulation. --- Source/Core/Core/Src/Core.cpp | 2 +- Source/Core/Core/Src/Movie.cpp | 11 +++++++---- Source/Core/Core/Src/Movie.h | 1 + 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp index d3c9fb7033..f939f18f60 100644 --- a/Source/Core/Core/Src/Core.cpp +++ b/Source/Core/Core/Src/Core.cpp @@ -293,7 +293,7 @@ void Stop() // - Hammertime! SConfig::GetInstance().m_SYSCONF->Reload(); INFO_LOG(CONSOLE, "Stop [Main Thread]\t\t---- Shutdown complete ----"); - Movie::g_currentInputCount = 0; + Movie::Shutdown(); g_bStopping = false; } diff --git a/Source/Core/Core/Src/Movie.cpp b/Source/Core/Core/Src/Movie.cpp index fd86516c57..cc4834b8b9 100644 --- a/Source/Core/Core/Src/Movie.cpp +++ b/Source/Core/Core/Src/Movie.cpp @@ -163,10 +163,6 @@ void Init() g_currentFrame = 0; g_currentLagCount = 0; g_currentInputCount = 0; - // we don't clear these things because otherwise we can't resume playback if we load a movie state later - //g_totalFrames = g_totalBytes = 0; - //delete tmpInput; - //tmpInput = NULL; } else std::thread md5thread(CheckMD5); @@ -1186,4 +1182,11 @@ void CheckMD5() Core::DisplayMessage("Finished calculating checksum.", 2000); } } + +void Shutdown() +{ + g_currentInputCount = g_totalInputCount = g_totalFrames = g_totalBytes = 0; + delete [] tmpInput; + tmpInput = NULL; +} }; diff --git a/Source/Core/Core/Src/Movie.h b/Source/Core/Core/Src/Movie.h index 42e7dc3e75..af8ed92c53 100644 --- a/Source/Core/Core/Src/Movie.h +++ b/Source/Core/Core/Src/Movie.h @@ -177,6 +177,7 @@ void EndPlayInput(bool cont); void SaveRecording(const char *filename); void DoState(PointerWrap &p); void CheckMD5(); +void Shutdown(); std::string GetInputDisplay(); From 1917f832440e6841de5661f11d859213681a2560 Mon Sep 17 00:00:00 2001 From: rog Date: Sun, 25 Nov 2012 19:26:37 -0500 Subject: [PATCH 08/13] Cleanup and misc movie fixes. --- Source/Core/Core/Src/Movie.cpp | 62 ++++++++++++++-------------------- Source/Core/Core/Src/Movie.h | 1 + 2 files changed, 27 insertions(+), 36 deletions(-) diff --git a/Source/Core/Core/Src/Movie.cpp b/Source/Core/Core/Src/Movie.cpp index cc4834b8b9..2cbbe33e56 100644 --- a/Source/Core/Core/Src/Movie.cpp +++ b/Source/Core/Core/Src/Movie.cpp @@ -136,6 +136,7 @@ void Init() if (IsPlayingInput()) { ReadHeader(); + std::thread md5thread(CheckMD5); 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()); @@ -164,8 +165,6 @@ void Init() g_currentLagCount = 0; g_currentInputCount = 0; } - else - std::thread md5thread(CheckMD5); } void InputUpdate() @@ -388,7 +387,6 @@ bool BeginRecordingInput(int controllers) State::SaveAs(tmpStateFilename.c_str()); 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. // TODO: find a way to GetTitleDataPath() from Movie::Init() @@ -638,7 +636,6 @@ void ReadHeader() else { GetSettings(); - bSaveConfig = false; } videoBackend.resize(ARRAYSIZE(tmpHeader.videoBackend)); @@ -658,9 +655,7 @@ void ReadHeader() { author[i] = tmpHeader.author[i]; } - - for (int i = 0; i < 16; i++) - MD5[i] = tmpHeader.md5[i]; + memcpy(MD5, tmpHeader.md5, 16); } bool PlayInput(const char *filename) @@ -1083,8 +1078,7 @@ void SaveRecording(const char *filename) header.bClearSave = g_bClearSave; strncpy((char *)header.discChange, g_discChange.c_str(),ARRAYSIZE(header.discChange)); strncpy((char *)header.author, author.c_str(),ARRAYSIZE(header.author)); - for (int i = 0; i < 16;i++) - header.md5[i] = MD5[i]; + memcpy(header.md5,MD5,16); // TODO header.uniqueID = 0; @@ -1142,45 +1136,41 @@ void GetSettings() if (!Core::g_CoreStartupParameter.bWii) g_bClearSave = !File::Exists(SConfig::GetInstance().m_strMemoryCardA); bMemcard = SConfig::GetInstance().m_EXIDevice[0] == EXIDEVICE_MEMORYCARD; + std::thread md5thread(GetMD5); } 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) - continue; - if (i == 15) - return; - } - Core::DisplayMessage("Verifying checksum...", 2000); + if (tmpHeader.md5[i] != 0) + continue; + n++; + if (n == 16) + return; } + Core::DisplayMessage("Verifying checksum...", 2000); unsigned char gameMD5[16]; char game[255]; memcpy(game, SConfig::GetInstance().m_LastFilename.c_str(), SConfig::GetInstance().m_LastFilename.size()); md5_file(game, gameMD5); - if (IsPlayingInput()) - { - if (memcmp(gameMD5,MD5,16) == 0) - Core::DisplayMessage("Checksum of current game matches the recorded game.", 2000); - else - PanicAlert("Checksum of current game does not match the recorded game!"); - } + if (memcmp(gameMD5,MD5,16) == 0) + Core::DisplayMessage("Checksum of current game matches the recorded game.", 2000); else - { - memcpy(MD5, gameMD5,16); - Core::DisplayMessage("Finished calculating checksum.", 2000); - } + PanicAlert("Checksum of current game does not match the recorded game!"); +} + +void GetMD5() +{ + 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); } void Shutdown() @@ -1189,4 +1179,4 @@ void Shutdown() delete [] tmpInput; tmpInput = NULL; } -}; +}; \ No newline at end of file diff --git a/Source/Core/Core/Src/Movie.h b/Source/Core/Core/Src/Movie.h index af8ed92c53..42ee6dd485 100644 --- a/Source/Core/Core/Src/Movie.h +++ b/Source/Core/Core/Src/Movie.h @@ -177,6 +177,7 @@ void EndPlayInput(bool cont); void SaveRecording(const char *filename); void DoState(PointerWrap &p); void CheckMD5(); +void GetMD5(); void Shutdown(); std::string GetInputDisplay(); From 0903e2081725bef65d61d50a326a8e13b94bada8 Mon Sep 17 00:00:00 2001 From: rog Date: Sun, 25 Nov 2012 22:41:48 -0500 Subject: [PATCH 09/13] Expand input buffer as needed, instead of hardcoding it at 40 MiB. Patch (mostly) by Ilari. --- Source/Core/Core/Src/Movie.cpp | 40 +++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/Source/Core/Core/Src/Movie.cpp b/Source/Core/Core/Src/Movie.cpp index 2cbbe33e56..8d2b7c4c01 100644 --- a/Source/Core/Core/Src/Movie.cpp +++ b/Source/Core/Core/Src/Movie.cpp @@ -37,8 +37,8 @@ #include "../../Common/Src/NandPaths.h" #include "Crypto/md5.h" -// large enough for just over 24 hours of single-player recording -#define MAX_DTM_LENGTH (40 * 1024 * 1024) +// The chunk to allocate movie data in multiples of. +#define DTM_BASE_LENGTH (1024) std::mutex cs_frameSkip; @@ -56,6 +56,7 @@ u8 g_numPads = 0; ControllerState g_padState; DTMHeader tmpHeader; u8* tmpInput = NULL; +size_t tmpInputAllocated = 0; u64 g_currentByte = 0, g_totalBytes = 0; u64 g_currentFrame = 0, g_totalFrames = 0; // VI u64 g_currentLagCount = 0, g_totalLagCount = 0; // just stats @@ -81,6 +82,25 @@ std::string g_InputDisplay[8]; ManipFunction mfunc = NULL; +void EnsureTmpInputSize(size_t bound) +{ + if (tmpInputAllocated >= bound) + return; + // The buffer expands in powers of two of DTM_BASE_LENGTH + // (standard exponential buffer growth). + size_t newAlloc = DTM_BASE_LENGTH; + while (newAlloc < bound) + newAlloc *= 2; + u8* newTmpInput = new u8[newAlloc]; + tmpInputAllocated = newAlloc; + if (tmpInput != NULL) + { + if (g_totalBytes > 0) + memcpy(newTmpInput, tmpInput, g_totalBytes); + delete[] tmpInput; + } + tmpInput = newTmpInput; +} std::string GetInputDisplay() { @@ -401,8 +421,8 @@ bool BeginRecordingInput(int controllers) g_playMode = MODE_RECORDING; GetSettings(); author = SConfig::GetInstance().m_strMovieAuthor; - delete [] tmpInput; - tmpInput = new u8[MAX_DTM_LENGTH]; + EnsureTmpInputSize(1); + g_currentByte = g_totalBytes = 0; Core::DisplayMessage("Starting movie recording", 2000); @@ -582,7 +602,7 @@ void RecordInput(SPADStatus *PadStatus, int controllerID) g_padState.CStickX = PadStatus->substickX; g_padState.CStickY = PadStatus->substickY; - + EnsureTmpInputSize(g_currentByte + 8); memcpy(&(tmpInput[g_currentByte]), &g_padState, 8); g_currentByte += 8; g_totalBytes = g_currentByte; @@ -606,6 +626,7 @@ void RecordWiimote(int wiimote, u8 *data, const WiimoteEmu::ReportFeatures& rptf u8 size = rptf.size; InputUpdate(); + EnsureTmpInputSize(g_currentByte + size + 1); tmpInput[g_currentByte++] = size; memcpy(&(tmpInput[g_currentByte]), data, size); g_currentByte += size; @@ -699,8 +720,7 @@ bool PlayInput(const char *filename) g_playMode = MODE_PLAYING; g_totalBytes = g_recordfd.GetSize() - 256; - delete tmpInput; - tmpInput = new u8[MAX_DTM_LENGTH]; + EnsureTmpInputSize((size_t)g_totalBytes); g_recordfd.ReadArray(tmpInput, (size_t)g_totalBytes); g_currentByte = 0; g_recordfd.Close(); @@ -767,9 +787,8 @@ void LoadInput(const char *filename) g_totalLagCount = tmpHeader.lagCount; g_totalInputCount = tmpHeader.inputCount; + EnsureTmpInputSize((size_t)totalSavedBytes); g_totalBytes = totalSavedBytes; - delete [] tmpInput; - tmpInput = new u8[MAX_DTM_LENGTH]; t_record.ReadArray(tmpInput, (size_t)g_totalBytes); } else if (g_currentByte > 0) @@ -1178,5 +1197,6 @@ void Shutdown() g_currentInputCount = g_totalInputCount = g_totalFrames = g_totalBytes = 0; delete [] tmpInput; tmpInput = NULL; + tmpInputAllocated = 0; } -}; \ No newline at end of file +}; From 97f5b1665fa495a494eb2ad40034ececfac853d9 Mon Sep 17 00:00:00 2001 From: rog Date: Mon, 26 Nov 2012 01:41:00 -0500 Subject: [PATCH 10/13] what is this even... --- Source/Core/Common/Src/Setup.h | 41 --- Source/Core/Common/Src/Thread.cpp | 1 - Source/Core/Core/CMakeLists.txt | 1 - Source/Core/Core/Core.vcxproj | 1 - Source/Core/Core/Src/Core.cpp | 5 +- Source/Core/Core/Src/Core.h | 15 -- Source/Core/Core/Src/CoreRerecording.cpp | 248 ------------------ Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp | 1 - Source/Core/Core/Src/Movie.h | 2 +- Source/Core/DolphinWX/Src/Frame.cpp | 8 - Source/Core/DolphinWX/Src/FrameTools.cpp | 3 - Source/Core/DolphinWX/Src/Main.cpp | 1 - Source/Core/VideoCommon/Src/Fifo.cpp | 1 - Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp | 1 - Source/Plugins/Plugin_VideoOGL/Src/main.cpp | 1 - 15 files changed, 2 insertions(+), 328 deletions(-) delete mode 100644 Source/Core/Common/Src/Setup.h delete mode 100644 Source/Core/Core/Src/CoreRerecording.cpp diff --git a/Source/Core/Common/Src/Setup.h b/Source/Core/Common/Src/Setup.h deleted file mode 100644 index c0faec3059..0000000000 --- a/Source/Core/Common/Src/Setup.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (C) 2003 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _SETUP_H_ -#define _SETUP_H_ - -// ----------------------------------------------------------------------------------------------------- -// File description: -// Compilation settings. I avoid placing this in Common.h or some place where lots of files needs -// to be rebuilt if any of these settings are changed. I'd rather have it in as few files as possible. -// This file can be kept on the ignore list in your SVN program. It allows local optional settings -// depending on what works on your computer. -// ----------------------------------------------------------------------------------------------------- - -// ----------------------------------------------------------------------------------------------------- -// Settings: - -// 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 - -// ----------------------------------------------------------------------------------------------------- - -#endif // _SETUP_H_ - diff --git a/Source/Core/Common/Src/Thread.cpp b/Source/Core/Common/Src/Thread.cpp index ce91aac651..73f83c204f 100644 --- a/Source/Core/Common/Src/Thread.cpp +++ b/Source/Core/Common/Src/Thread.cpp @@ -15,7 +15,6 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ -#include "Setup.h" #include "Thread.h" #include "Common.h" diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt index 734d966781..d11c4a350a 100644 --- a/Source/Core/Core/CMakeLists.txt +++ b/Source/Core/Core/CMakeLists.txt @@ -5,7 +5,6 @@ set(SRCS Src/ActionReplay.cpp Src/Console.cpp Src/Core.cpp Src/CoreParameter.cpp - Src/CoreRerecording.cpp Src/CoreTiming.cpp Src/DSPEmulator.cpp Src/GeckoCodeConfig.cpp diff --git a/Source/Core/Core/Core.vcxproj b/Source/Core/Core/Core.vcxproj index e03d40e43a..78f95bbce6 100644 --- a/Source/Core/Core/Core.vcxproj +++ b/Source/Core/Core/Core.vcxproj @@ -207,7 +207,6 @@ - diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp index f939f18f60..e92b9088bc 100644 --- a/Source/Core/Core/Src/Core.cpp +++ b/Source/Core/Core/Src/Core.cpp @@ -18,9 +18,9 @@ #ifdef _WIN32 #include +#include "EmuWindow.h" #endif -#include "Setup.h" // Common #include "Atomic.h" #include "Thread.h" #include "Timer.h" @@ -61,9 +61,6 @@ #include "VideoBackendBase.h" #include "AudioCommon.h" #include "OnScreenDisplay.h" -#ifdef _WIN32 -#include "EmuWindow.h" -#endif #include "VolumeHandler.h" #include "FileMonitor.h" diff --git a/Source/Core/Core/Src/Core.h b/Source/Core/Core/Src/Core.h index 448bd55bb6..312c446744 100644 --- a/Source/Core/Core/Src/Core.h +++ b/Source/Core/Core/Src/Core.h @@ -95,21 +95,6 @@ void RequestRefreshInfo(); // the return value of the first call should be passed in as the second argument of the second call. bool PauseAndLock(bool doLock, bool unpauseOnUnlock=true); -#ifdef RERECORDING - -void FrameUpdate(); -void FrameAdvance(); -void FrameStepOnOff(); -void WriteStatus(); -void RerecordingStart(); -void RerecordingStop(); -void WindBack(int Counter); - -extern int g_FrameCounter,g_InputCounter; -extern bool g_FrameStep; - -#endif - } // namespace #endif diff --git a/Source/Core/Core/Src/CoreRerecording.cpp b/Source/Core/Core/Src/CoreRerecording.cpp deleted file mode 100644 index 3064ed37ad..0000000000 --- a/Source/Core/Core/Src/CoreRerecording.cpp +++ /dev/null @@ -1,248 +0,0 @@ -// Copyright (C) 2003 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - - -#include "Setup.h" -#ifndef RERECORDING -bool rerecording = false; -#else - -// Include -// -------------- -#ifdef _WIN32 - #include -#endif - -#include "Thread.h" // Common - -#include "Timer.h" -#include "Common.h" - -#include "Console.h" -#include "Core.h" -#include "CPUDetect.h" -#include "CoreTiming.h" -#include "Boot/Boot.h" -#include "PatchEngine.h" - -#include "HW/Memmap.h" -#include "HW/ProcessorInterface.h" -#include "HW/GPFifo.h" -#include "HW/CPU.h" -#include "HW/HW.h" -#include "HW/DSP.h" -#include "HW/GPFifo.h" -#include "HW/AudioInterface.h" -#include "HW/VideoInterface.h" -#include "HW/CommandProcessor.h" -#include "HW/PixelEngine.h" -#include "HW/SystemTimers.h" - -#include "PowerPC/PowerPC.h" - -#include "ConfigManager.h" - -#include "MemTools.h" -#include "Host.h" -#include "LogManager.h" - - - - - -// File description: Rerecording Functions -/* --------------- - -How the timer works: We measure the time between drawn frames, not when the game is paused. So time -should be a fairly comparable measure of the time it took to play the game. However the time it takes -to draw a frame will be lower on a fast computer. Therefore we could perhaps measure time as an -internal game time that is adjusted by the average time it takes to draw a frame. Also if it only takes -ten or twenty milliseconds to draw a frame I'm not certain about how accurate the mmsystem timers are for -such short periods. - -//////////////////////////////////////*/ - - - -namespace Core -{ - - - -// Declarations and definitions -// --------------- -int g_FrameCounter = 0; -bool g_FrameStep = false; -Common::Timer ReRecTimer; - - - - -// Control Run, Pause, Stop and the Timer. -// --------------- - -// Subtract the paused time when we run again -void Run() -{ - ReRecTimer.AddTimeDifference(); -} -// Update the time -void Pause() -{ - ReRecTimer.Update(); -} - -// Start the timer when a game is booted -void RerecordingStart() -{ - g_FrameCounter = 0; - ReRecTimer.Start(); - - // Logging - //DEBUG_LOG(CONSOLE, "RerecordingStart: %i\n", g_FrameCounter); -} - -// Reset the frame counter -void RerecordingStop() -{ - // Write the final time and Stop the timer - ReRecTimer.Stop(); - - // Update status bar - WriteStatus(); -} - -/* Wind back the frame counter when a save state is loaded. Currently we don't know what that means in - time so we just guess that the time is proportional the the number of frames - - Todo: There are many assumptions here: We probably want to replace the time here by the actual time - that we save together with the save state or the input recording for example. And have it adjusted - for full speed playback (whether it's 30 fps or 60 fps or some other speed that the game is natively - capped at). Also the input interrupts do not occur as often as the frame renderings, they occur more - often. So we may want to move the input recording to fram updates, or perhaps sync the input interrupts - to frame updates. - */ -void WindBack(int Counter) -{ - /* Counter should be smaller than g_FrameCounter, however it currently updates faster than the - frames so currently it may not be the same. Therefore I use the abs() function. */ - int AbsoluteFrameDifference = abs(g_FrameCounter - Counter); - float FractionalFrameDifference = (float) AbsoluteFrameDifference / (float) g_FrameCounter; - - // Update the frame counter - g_FrameCounter = Counter; - - // Approximate a time to wind back the clock to - // Get the current time - u64 CurrentTimeMs = ReRecTimer.GetTimeElapsed(); - // Save the current time in seconds in a new double - double CurrentTimeSeconds = (double) (CurrentTimeMs / 1000); - // Reduce it by the same proportion as the counter was wound back - CurrentTimeSeconds = CurrentTimeSeconds * FractionalFrameDifference; - // Update the clock - ReRecTimer.WindBackStartingTime((u64)CurrentTimeSeconds * 1000); - - // Logging - DEBUG_LOG(CONSOLE, "WindBack: %i %u\n", Counter, (u64)CurrentTimeSeconds); -} - - - - -// Frame advance -// --------------- -void FrameAdvance() -{ - // Update status bar - WriteStatus(); - - // If a game is not started, return - if (Core::GetState() == Core::CORE_UNINITIALIZED) return; - - // Play to the next frame - if (g_FrameStep) - { - Run(); - Core::SetState(Core::CORE_RUN); - } -} - -// Turn on frame stepping -void FrameStepOnOff() -{ - /* Turn frame step on or off. If a game is running and we turn this on it means that the game - will pause after the next frame update */ - g_FrameStep = !g_FrameStep; - - // Update status bar - WriteStatus(); - - // If a game is not started, return - if(Core::GetState() == Core::CORE_UNINITIALIZED) return; - - // Run the emulation if we turned off framestepping - if (!g_FrameStep) - { - Run(); - Core::SetState(Core::CORE_RUN); - } -} - - - - -// General functions -// --------------- - -// Write to the status bar -void WriteStatus() -{ - std::string TmpStr = "Time: " + ReRecTimer.GetTimeElapsedFormatted(); - TmpStr += StringFromFormat(" Frame: %s", ThousandSeparate(g_FrameCounter).c_str()); - // The FPS is the total average since the game was booted - TmpStr += StringFromFormat(" FPS: %i", (g_FrameCounter * 1000) / ReRecTimer.GetTimeElapsed()); - TmpStr += StringFromFormat(" FrameStep: %s", g_FrameStep ? "On" : "Off"); - Host_UpdateStatusBar(TmpStr.c_str(), 1); -} - - -// When a new frame is drawn -void FrameUpdate() -{ - // Write to the status bar - WriteStatus(); - /* I don't think the frequent update has any material speed inpact at all, but should it - have you can controls the update speed by changing the "% 10" in this line */ - //if (g_FrameCounter % 10 == 0) WriteStatus(); - - // Pause if frame stepping is on - if(g_FrameStep) - { - Pause(); - Core::SetState(Core::CORE_PAUSE); - } - - // Count one frame - g_FrameCounter++; -} - - - -} // Core - - -#endif // RERECORDING diff --git a/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp b/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp index 66ee4bef84..817610ea0f 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp @@ -20,7 +20,6 @@ #include "ChunkFile.h" #include "IniFile.h" #include "HLEMixer.h" -#include "Setup.h" #include "StringUtil.h" #include "LogManager.h" #include "IniFile.h" diff --git a/Source/Core/Core/Src/Movie.h b/Source/Core/Core/Src/Movie.h index 42ee6dd485..401b28be50 100644 --- a/Source/Core/Core/Src/Movie.h +++ b/Source/Core/Core/Src/Movie.h @@ -189,4 +189,4 @@ void SetInputManip(ManipFunction); void CallInputManip(SPADStatus *PadStatus, int controllerID); }; -#endif // __FRAME_H +#endif // __MOVIE_H diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 9d59ca1788..da6c565ddf 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -26,7 +26,6 @@ #include "Common.h" // Common #include "FileUtil.h" #include "Timer.h" -#include "Setup.h" #include "Globals.h" // Local #include "Frame.h" @@ -458,13 +457,6 @@ CFrame::CFrame(wxFrame* parent, // Update controls UpdateGUI(); - - // If we are rerecording create the status bar now instead of later when a game starts - #ifdef RERECORDING - ModifyStatusBar(); - // It's to early for the OnHostMessage(), we will update the status when Ctrl or Space is pressed - //Core::WriteStatus(); - #endif } // Destructor CFrame::~CFrame() diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index a1f4355dd7..9011d5e844 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -27,9 +27,6 @@ window handle that is returned by CreateWindow() can be accessed from Core::GetWindowHandle(). */ - -#include "Setup.h" // Common - #include "NetWindow.h" #include "Common.h" // Common #include "FileUtil.h" diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp index 2a0b8a3de4..59c77f1e32 100644 --- a/Source/Core/DolphinWX/Src/Main.cpp +++ b/Source/Core/DolphinWX/Src/Main.cpp @@ -28,7 +28,6 @@ #include "CPUDetect.h" #include "IniFile.h" #include "FileUtil.h" -#include "Setup.h" #include "Host.h" // Core #include "HW/Wiimote.h" diff --git a/Source/Core/VideoCommon/Src/Fifo.cpp b/Source/Core/VideoCommon/Src/Fifo.cpp index 565684297a..50aa21ebbf 100644 --- a/Source/Core/VideoCommon/Src/Fifo.cpp +++ b/Source/Core/VideoCommon/Src/Fifo.cpp @@ -16,7 +16,6 @@ // http://code.google.com/p/dolphin-emu/ #include "VideoConfig.h" -#include "Setup.h" #include "MemoryUtil.h" #include "Thread.h" #include "Atomic.h" diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp index 5110023ee3..d6abb014c4 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp @@ -18,7 +18,6 @@ #include "Globals.h" #include "VideoConfig.h" #include "IniFile.h" -#include "Setup.h" #include "Core.h" #include "Host.h" #include "VideoBackend.h" diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index 543fb9824d..fb26ba2781 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -88,7 +88,6 @@ Make AA apply instantly during gameplay if possible #include "TextureConverter.h" #include "PostProcessing.h" #include "OnScreenDisplay.h" -#include "Setup.h" #include "DLCache.h" #include "FramebufferManager.h" #include "Core.h" From c2146921f99e783ea917e1428b4aeb46ec764ac8 Mon Sep 17 00:00:00 2001 From: rog Date: Mon, 26 Nov 2012 03:04:17 -0500 Subject: [PATCH 11/13] Call InputUpdate() for wii games when using gc controller but not wiimote. --- Source/Core/Core/Src/HW/SI_DeviceGCController.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp b/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp index a9b708324d..8e8adf33fd 100644 --- a/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp +++ b/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp @@ -132,13 +132,13 @@ bool CSIDevice_GCController::GetData(u32& _Hi, u32& _Low) if(Movie::IsPlayingInput()) { Movie::PlayController(&PadStatus, ISIDevice::m_iDeviceNumber); - if(!Core::g_CoreStartupParameter.bWii) + if(!Movie::IsUsingWiimote(0)) Movie::InputUpdate(); } else if(Movie::IsRecordingInput()) { Movie::RecordInput(&PadStatus, ISIDevice::m_iDeviceNumber); - if(!Core::g_CoreStartupParameter.bWii) + if(!Movie::IsUsingWiimote(0)) Movie::InputUpdate(); } From 3d9712a99ee7a69ac59933c67d08bc6b2f80421f Mon Sep 17 00:00:00 2001 From: rog Date: Mon, 26 Nov 2012 03:48:04 -0500 Subject: [PATCH 12/13] Remove more unused code. --- Source/Core/Common/Src/Timer.cpp | 6 ------ Source/Core/Common/Src/Timer.h | 1 - 2 files changed, 7 deletions(-) diff --git a/Source/Core/Common/Src/Timer.cpp b/Source/Core/Common/Src/Timer.cpp index 087f8fcead..b1beed2066 100644 --- a/Source/Core/Common/Src/Timer.cpp +++ b/Source/Core/Common/Src/Timer.cpp @@ -97,12 +97,6 @@ void Timer::AddTimeDifference() m_StartTime += GetTimeDifference(); } -// Wind back the starting time to a custom time -void Timer::WindBackStartingTime(u64 WindBack) -{ - m_StartTime += WindBack; -} - // Get the time elapsed since the Start() u64 Timer::GetTimeElapsed() { diff --git a/Source/Core/Common/Src/Timer.h b/Source/Core/Common/Src/Timer.h index a638920409..152d4c60e6 100644 --- a/Source/Core/Common/Src/Timer.h +++ b/Source/Core/Common/Src/Timer.h @@ -35,7 +35,6 @@ public: // The time difference is always returned in milliseconds, regardless of alternative internal representation u64 GetTimeDifference(); void AddTimeDifference(); - void WindBackStartingTime(u64 WindBack); static void IncreaseResolution(); static void RestoreResolution(); From 38e0d06e8c6d6e6638ace7950ac09e9c28c6708c Mon Sep 17 00:00:00 2001 From: rog Date: Mon, 26 Nov 2012 12:29:36 -0500 Subject: [PATCH 13/13] Whoops, was calling GetMD5() twice. --- Source/Core/Core/Src/Movie.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/Core/Core/Src/Movie.cpp b/Source/Core/Core/Src/Movie.cpp index 8d2b7c4c01..e4f3fb3f29 100644 --- a/Source/Core/Core/Src/Movie.cpp +++ b/Source/Core/Core/Src/Movie.cpp @@ -166,7 +166,9 @@ void Init() if (IsRecordingInput()) { GetSettings(); + std::thread md5thread(GetMD5); } + g_frameSkipCounter = g_framesToSkip; memset(&g_padState, 0, sizeof(g_padState)); if (!tmpHeader.bFromSaveState || !IsPlayingInput()) @@ -417,6 +419,7 @@ bool BeginRecordingInput(int controllers) else Movie::g_bClearSave = true; } + std::thread md5thread(GetMD5); } g_playMode = MODE_RECORDING; GetSettings(); @@ -1155,7 +1158,6 @@ void GetSettings() if (!Core::g_CoreStartupParameter.bWii) g_bClearSave = !File::Exists(SConfig::GetInstance().m_strMemoryCardA); bMemcard = SConfig::GetInstance().m_EXIDevice[0] == EXIDEVICE_MEMORYCARD; - std::thread md5thread(GetMD5); } void CheckMD5() @@ -1172,7 +1174,7 @@ void CheckMD5() unsigned char gameMD5[16]; char game[255]; - memcpy(game, SConfig::GetInstance().m_LastFilename.c_str(), SConfig::GetInstance().m_LastFilename.size()); + memcpy(game, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strFilename.c_str(), SConfig::GetInstance().m_LocalCoreStartupParameter.m_strFilename.size()); md5_file(game, gameMD5); if (memcmp(gameMD5,MD5,16) == 0) @@ -1187,7 +1189,7 @@ void GetMD5() 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()); + memcpy(game, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strFilename.c_str(),SConfig::GetInstance().m_LocalCoreStartupParameter.m_strFilename.size()); md5_file(game, MD5); Core::DisplayMessage("Finished calculating checksum.", 2000); }