From 7ee455ce3b0a23888354a448f1bed872aa66a553 Mon Sep 17 00:00:00 2001 From: rog Date: Wed, 24 Oct 2012 16:35:52 -0400 Subject: [PATCH 01/12] When beginning recording, check settings in Init() instead of just in BeginRecordingInput(), since it's called after bootmanager.cpp reads the game's config. --- Source/Core/Core/Src/Movie.cpp | 37 +++++++++++++++++----------------- Source/Core/Core/Src/Movie.h | 1 + 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/Source/Core/Core/Src/Movie.cpp b/Source/Core/Core/Src/Movie.cpp index 13f5ed26e8..11ec6a899d 100644 --- a/Source/Core/Core/Src/Movie.cpp +++ b/Source/Core/Core/Src/Movie.cpp @@ -136,6 +136,10 @@ void Init() { ReadHeader(); } + if (IsRecordingInput()) + { + GetSettings(); + } g_frameSkipCounter = g_framesToSkip; memset(&g_padState, 0, sizeof(g_padState)); if (!tmpHeader.bFromSaveState || !IsPlayingInput()) @@ -378,16 +382,7 @@ bool BeginRecordingInput(int controllers) g_bRecordingFromSaveState = true; } g_playMode = MODE_RECORDING; - - bSkipIdle = SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle; - bDualCore = SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread; - bProgressive = SConfig::GetInstance().m_LocalCoreStartupParameter.bProgressive; - bDSPHLE = SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPHLE; - bFastDiscSpeed = SConfig::GetInstance().m_LocalCoreStartupParameter.bFastDiscSpeed; - videoBackend = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend; - iCPUCore = SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore; - bBlankMC = !File::Exists(SConfig::GetInstance().m_strMemoryCardA); - bMemcard = SConfig::GetInstance().m_EXIDevice[0] == EXIDEVICE_MEMORYCARD; + GetSettings(); delete [] tmpInput; tmpInput = new u8[MAX_DTM_LENGTH]; @@ -635,14 +630,7 @@ void ReadHeader() else { bSaveConfig = false; - bSkipIdle = SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle; - bDualCore = SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread; - bProgressive = SConfig::GetInstance().m_LocalCoreStartupParameter.bProgressive; - bDSPHLE = SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPHLE; - bFastDiscSpeed = SConfig::GetInstance().m_LocalCoreStartupParameter.bFastDiscSpeed; - videoBackend = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend; - bBlankMC = !File::Exists(SConfig::GetInstance().m_strMemoryCardA); - bMemcard = SConfig::GetInstance().m_EXIDevice[0] == EXIDEVICE_MEMORYCARD; + GetSettings(); } @@ -1150,4 +1138,17 @@ void SetGraphicsConfig() g_Config.bUseXFB = tmpHeader.bUseXFB; g_Config.bUseRealXFB = tmpHeader.bUseRealXFB; } + +void GetSettings() +{ + bSkipIdle = SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle; + bDualCore = SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread; + bProgressive = SConfig::GetInstance().m_LocalCoreStartupParameter.bProgressive; + bDSPHLE = SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPHLE; + bFastDiscSpeed = SConfig::GetInstance().m_LocalCoreStartupParameter.bFastDiscSpeed; + videoBackend = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend; + iCPUCore = SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore; + bBlankMC = !File::Exists(SConfig::GetInstance().m_strMemoryCardA); + bMemcard = SConfig::GetInstance().m_EXIDevice[0] == EXIDEVICE_MEMORYCARD; +} }; diff --git a/Source/Core/Core/Src/Movie.h b/Source/Core/Core/Src/Movie.h index 94e63a9e2b..46bc3ab124 100644 --- a/Source/Core/Core/Src/Movie.h +++ b/Source/Core/Core/Src/Movie.h @@ -151,6 +151,7 @@ int GetCPUMode(); bool IsBlankMemcard(); bool IsUsingMemcard(); void SetGraphicsConfig(); +void GetSettings(); bool IsUsingPad(int controller); bool IsUsingWiimote(int wiimote); From 76a6917fdf244854bba1e3c989fc1b306173d06f Mon Sep 17 00:00:00 2001 From: rog Date: Wed, 24 Oct 2012 19:37:51 -0400 Subject: [PATCH 02/12] Check game ID against what is recorded to the .dtm --- Source/Core/Core/Src/BootManager.cpp | 1 - Source/Core/Core/Src/Movie.cpp | 20 +++++++------------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/Source/Core/Core/Src/BootManager.cpp b/Source/Core/Core/Src/BootManager.cpp index 187baf415c..afe6a83dad 100644 --- a/Source/Core/Core/Src/BootManager.cpp +++ b/Source/Core/Core/Src/BootManager.cpp @@ -118,7 +118,6 @@ bool BootCore(const std::string& _rFilename) if (Movie::IsPlayingInput() && Movie::IsConfigSaved()) { - Movie::Init(); StartUp.bCPUThread = Movie::IsDualCore(); StartUp.bSkipIdle = Movie::IsSkipIdle(); StartUp.bDSPHLE = Movie::IsDSPHLE(); diff --git a/Source/Core/Core/Src/Movie.cpp b/Source/Core/Core/Src/Movie.cpp index 11ec6a899d..53b5e2a088 100644 --- a/Source/Core/Core/Src/Movie.cpp +++ b/Source/Core/Core/Src/Movie.cpp @@ -135,6 +135,11 @@ void Init() if (IsPlayingInput()) { ReadHeader(); + 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()); + EndPlayInput(false); + } } if (IsRecordingInput()) { @@ -683,19 +688,6 @@ bool PlayInput(const char *filename) Movie::LoadInput(filename); } - /* TODO: Put this verification somewhere we have the gameID of the played game - // TODO: Replace with Unique ID - if(tmpHeader.uniqueID != 0) { - PanicAlert("Recording Unique ID Verification Failed"); - goto cleanup; - } - - 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)", header.gameID, Core::g_CoreStartupParameter.GetUniqueID().c_str()); - goto cleanup; - } - */ - ReadHeader(); g_totalFrames = tmpHeader.frameCount; g_totalLagCount = tmpHeader.lagCount; @@ -1094,6 +1086,7 @@ void SaveRecording(const char *filename) header.bMemcard = bMemcard; header.bBlankMC = bBlankMC; strncpy((char *)header.discChange, g_discChange.c_str(),ARRAYSIZE(header.discChange)); + // TODO: prompt the user for author name. It's currently always blank, unless the user manually edits the .dtm file. strncpy((char *)header.author, author.c_str(),ARRAYSIZE(header.author)); // TODO @@ -1141,6 +1134,7 @@ void SetGraphicsConfig() void GetSettings() { + bSaveConfig = true; bSkipIdle = SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle; bDualCore = SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread; bProgressive = SConfig::GetInstance().m_LocalCoreStartupParameter.bProgressive; From 8dfb12da3e130eccb348c030c247dac2de27a58d Mon Sep 17 00:00:00 2001 From: rog Date: Wed, 24 Oct 2012 23:21:34 -0400 Subject: [PATCH 03/12] stuff --- Source/Core/Core/Src/Movie.cpp | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/Source/Core/Core/Src/Movie.cpp b/Source/Core/Core/Src/Movie.cpp index 53b5e2a088..ba4201f8f3 100644 --- a/Source/Core/Core/Src/Movie.cpp +++ b/Source/Core/Core/Src/Movie.cpp @@ -105,6 +105,13 @@ void FrameUpdate() g_totalFrames = g_currentFrame; g_totalLagCount = g_currentLagCount; } + if (IsPlayingInput() && IsConfigSaved()) + { + if (IsConfigSaved()) + { + SetGraphicsConfig(); + } + } if (g_bFrameStep) { @@ -149,6 +156,7 @@ void Init() memset(&g_padState, 0, sizeof(g_padState)); if (!tmpHeader.bFromSaveState || !IsPlayingInput()) Core::SetStateFileName(""); + for (int i = 0; i < 8; ++i) g_InputDisplay[i].clear(); @@ -388,6 +396,7 @@ bool BeginRecordingInput(int controllers) } g_playMode = MODE_RECORDING; GetSettings(); + bSaveConfig = true; delete [] tmpInput; tmpInput = new u8[MAX_DTM_LENGTH]; @@ -475,15 +484,6 @@ void SetInputDisplayString(ControllerState padState, int controllerID) if(g_padState.DPadRight) g_InputDisplay[controllerID].append(" RIGHT"); - //if(g_padState.L) - //{ - // g_InputDisplay[controllerID].append(" L"); - //} - //if(g_padState.R) - //{ - // g_InputDisplay[controllerID].append(" R"); - //} - Analog1DToString(g_padState.TriggerL, " L", inp); g_InputDisplay[controllerID].append(inp); @@ -550,8 +550,6 @@ void SetWiiInputDisplayString(int remoteID, u8* const coreData, u8* const accelD g_InputDisplay[controllerID].append("\n"); } - - void RecordInput(SPADStatus *PadStatus, int controllerID) { if(!IsRecordingInput() || !IsUsingPad(controllerID)) @@ -872,10 +870,6 @@ void PlayController(SPADStatus *PadStatus, int controllerID) if (!IsPlayingInput() || !IsUsingPad(controllerID) || tmpInput == NULL) return; - if (IsConfigSaved()) - { - SetGraphicsConfig(); - } if (g_currentFrame == 1) { if (tmpHeader.bMemcard) From 0bc202128482fb26b84e18cde213156cd40d297a Mon Sep 17 00:00:00 2001 From: rog Date: Thu, 25 Oct 2012 02:44:30 -0400 Subject: [PATCH 04/12] save if a wii game's save data exists when starting recording. Probably not the best way to do this, and could result in a false negative if banner.bin exists, but the actual save file doesn't, but this should work well enough. --- Source/Core/Core/Src/BootManager.cpp | 2 +- .../Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp | 2 +- .../Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp | 11 +++++++ Source/Core/Core/Src/Movie.cpp | 31 +++++++++++-------- Source/Core/Core/Src/Movie.h | 7 +++-- 5 files changed, 35 insertions(+), 18 deletions(-) diff --git a/Source/Core/Core/Src/BootManager.cpp b/Source/Core/Core/Src/BootManager.cpp index afe6a83dad..e0fac1da87 100644 --- a/Source/Core/Core/Src/BootManager.cpp +++ b/Source/Core/Core/Src/BootManager.cpp @@ -123,7 +123,7 @@ bool BootCore(const std::string& _rFilename) StartUp.bDSPHLE = Movie::IsDSPHLE(); StartUp.bProgressive = Movie::IsProgressive(); StartUp.bFastDiscSpeed = Movie::IsFastDiscSpeed(); - if (Movie::IsUsingMemcard() && Movie::IsBlankMemcard()) + if (Movie::IsUsingMemcard() && Movie::IsStartingFromClearSave() && !StartUp.bWii) { if (File::Exists("Movie.raw")) File::Delete("Movie.raw"); diff --git a/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp b/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp index f65d8c6b8b..038eb6e9a9 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp +++ b/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp @@ -52,7 +52,7 @@ CEXIMemoryCard::CEXIMemoryCard(const int index) , m_bDirty(false) { m_strFilename = (card_index == 0) ? SConfig::GetInstance().m_strMemoryCardA : SConfig::GetInstance().m_strMemoryCardB; - if (Movie::IsUsingMemcard() && Movie::IsPlayingInput() && Movie::IsConfigSaved() && Movie::IsBlankMemcard()) + if (Movie::IsUsingMemcard() && Movie::IsPlayingInput() && Movie::IsConfigSaved() && Movie::IsStartingFromClearSave()) m_strFilename = "Movie.raw"; // we're potentially leaking events here, since there's no UnregisterEvent until emu shutdown, but I guess it's inconsequential diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp index ae389d7b69..246a1bd888 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp @@ -57,6 +57,7 @@ #include "NandPaths.h" #include "CommonPaths.h" #include "IPC_HLE/WII_IPC_HLE_Device_usb.h" +#include "../Movie.h" std::string CWII_IPC_HLE_Device_es::m_ContentFile; @@ -891,6 +892,16 @@ u32 CWII_IPC_HLE_Device_es::ES_DIVerify(u8* _pTMD, u32 _sz) File::CreateFullPath(tmdPath); File::CreateFullPath(Common::GetTitleDataPath(tmdTitleID)); + + Movie::g_titleID = tmdTitleID; + if (Movie::IsRecordingInput()) + { + // TODO: Check for the actual save data + if (File::Exists((Common::GetTitleDataPath(tmdTitleID) + "banner.bin").c_str())) + Movie::g_bClearSave = false; + else + Movie::g_bClearSave = true; + } if(!File::Exists(tmdPath)) { File::IOFile _pTMDFile(tmdPath, "wb"); diff --git a/Source/Core/Core/Src/Movie.cpp b/Source/Core/Core/Src/Movie.cpp index ba4201f8f3..10909e358b 100644 --- a/Source/Core/Core/Src/Movie.cpp +++ b/Source/Core/Core/Src/Movie.cpp @@ -35,6 +35,7 @@ #include "HW/EXI_Device.h" #include "HW/EXI_Channel.h" #include "HW/DVDInterface.h" +#include "../../Common/Src/NandPaths.h" // large enough for just over 24 hours of single-player recording #define MAX_DTM_LENGTH (40 * 1024 * 1024) @@ -60,19 +61,14 @@ u64 g_currentFrame = 0, g_totalFrames = 0; // VI u64 g_currentLagCount = 0, g_totalLagCount = 0; // just stats u64 g_currentInputCount = 0, g_totalInputCount = 0; // just stats u64 g_recordingStartTime; // seconds since 1970 that recording started -bool bSaveConfig = false; -bool bSkipIdle = false; -bool bDualCore = false; -bool bProgressive = false; -bool bDSPHLE = false; -bool bFastDiscSpeed = false; +bool bSaveConfig, bSkipIdle, bDualCore, bProgressive, bDSPHLE, bFastDiscSpeed = false; +bool bMemcard, g_bClearSave = false; std::string videoBackend = "opengl"; int iCPUCore = 1; -bool bMemcard; -bool bBlankMC = false; bool g_bDiscChange = false; std::string g_discChange = ""; std::string author = ""; +u64 g_titleID = 0; bool g_bRecordingFromSaveState = false; bool g_bPolled = false; @@ -324,9 +320,9 @@ int GetCPUMode() return iCPUCore; } -bool IsBlankMemcard() +bool IsStartingFromClearSave() { - return bBlankMC; + return g_bClearSave; } bool IsUsingMemcard() @@ -393,6 +389,14 @@ bool BeginRecordingInput(int controllers) State::SaveAs(tmpStateFilename.c_str()); g_bRecordingFromSaveState = true; + + // This is only done here if starting from save state because otherwise we won't have the titleid. + // If not starting from save state, it's set in WII_IPC_HLE_Device_es.cpp. There's probably a way to get this in Movie::Init, but i can't find one. + // 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; } g_playMode = MODE_RECORDING; GetSettings(); @@ -626,7 +630,7 @@ void ReadHeader() bDSPHLE = tmpHeader.bDSPHLE; bFastDiscSpeed = tmpHeader.bFastDiscSpeed; iCPUCore = tmpHeader.CPUCore; - bBlankMC = tmpHeader.bBlankMC; + g_bClearSave = tmpHeader.bClearSave; bMemcard = tmpHeader.bMemcard; } @@ -1078,7 +1082,7 @@ void SaveRecording(const char *filename) header.bUseXFB = g_ActiveConfig.bUseXFB; header.bUseRealXFB = g_ActiveConfig.bUseRealXFB; header.bMemcard = bMemcard; - header.bBlankMC = bBlankMC; + header.bClearSave = g_bClearSave; strncpy((char *)header.discChange, g_discChange.c_str(),ARRAYSIZE(header.discChange)); // TODO: prompt the user for author name. It's currently always blank, unless the user manually edits the .dtm file. strncpy((char *)header.author, author.c_str(),ARRAYSIZE(header.author)); @@ -1136,7 +1140,8 @@ void GetSettings() bFastDiscSpeed = SConfig::GetInstance().m_LocalCoreStartupParameter.bFastDiscSpeed; videoBackend = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend; iCPUCore = SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore; - bBlankMC = !File::Exists(SConfig::GetInstance().m_strMemoryCardA); + if (!Core::g_CoreStartupParameter.bWii) + g_bClearSave = !File::Exists(SConfig::GetInstance().m_strMemoryCardA); bMemcard = SConfig::GetInstance().m_EXIDevice[0] == EXIDEVICE_MEMORYCARD; } }; diff --git a/Source/Core/Core/Src/Movie.h b/Source/Core/Core/Src/Movie.h index 46bc3ab124..0152a66879 100644 --- a/Source/Core/Core/Src/Movie.h +++ b/Source/Core/Core/Src/Movie.h @@ -61,8 +61,9 @@ static_assert(sizeof(ControllerState) == 8, "ControllerState should be 8 bytes") #pragma pack(pop) // Global declarations -extern bool g_bFrameStep, g_bPolled, g_bReadOnly, g_bDiscChange; +extern bool g_bFrameStep, g_bPolled, g_bReadOnly, g_bDiscChange, g_bClearSave; extern PlayMode g_playMode; +extern u64 g_titleID; extern u32 g_framesToSkip, g_frameSkipCounter; @@ -117,7 +118,7 @@ struct DTMHeader { bool bUseXFB; bool bUseRealXFB; bool bMemcard; - bool bBlankMC; // Create a new memory card when playing back a movie if true + bool bClearSave; // Create a new memory card when playing back a movie if true u8 reserved[16]; // Padding for any new config options u8 discChange[40]; // Name of iso file to switch to, for two disc games. u8 reserved2[47]; // Make heading 256 bytes, just because we can @@ -148,7 +149,7 @@ bool IsSkipIdle(); bool IsDSPHLE(); bool IsFastDiscSpeed(); int GetCPUMode(); -bool IsBlankMemcard(); +bool IsStartingFromClearSave(); bool IsUsingMemcard(); void SetGraphicsConfig(); void GetSettings(); From 8921fe0d09b7b941fcfe4a869e378919bd2192ab Mon Sep 17 00:00:00 2001 From: rog Date: Fri, 26 Oct 2012 12:06:32 -0400 Subject: [PATCH 05/12] move wii saves to a backup if playing a movie that starts with no save --- .../Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp | 41 ++++++++++++++++++- Source/Core/Core/Src/Movie.cpp | 25 ++++++----- 2 files changed, 54 insertions(+), 12 deletions(-) diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp index 246a1bd888..ee0d1b0a22 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp @@ -59,6 +59,9 @@ #include "IPC_HLE/WII_IPC_HLE_Device_usb.h" #include "../Movie.h" +#ifdef _WIN32 +#include +#endif std::string CWII_IPC_HLE_Device_es::m_ContentFile; @@ -892,16 +895,50 @@ u32 CWII_IPC_HLE_Device_es::ES_DIVerify(u8* _pTMD, u32 _sz) File::CreateFullPath(tmdPath); File::CreateFullPath(Common::GetTitleDataPath(tmdTitleID)); - + Movie::g_titleID = tmdTitleID; + std::string savePath = Common::GetTitleDataPath(tmdTitleID); if (Movie::IsRecordingInput()) { // TODO: Check for the actual save data - if (File::Exists((Common::GetTitleDataPath(tmdTitleID) + "banner.bin").c_str())) + if (File::Exists((savePath + "banner.bin").c_str())) Movie::g_bClearSave = false; else Movie::g_bClearSave = true; } + if (Movie::IsPlayingInput() && Movie::IsConfigSaved() && Movie::IsStartingFromClearSave()) + { + if (File::Exists((savePath + "banner.bin").c_str())) + { + if (File::Exists((savePath + "../backup/").c_str())) + { + // Dolphin must have crashed while playing back a movie previously, so we'll keep the backup, and just delete the current save + File::DeleteDirRecursively(savePath.c_str()); + } + else + { + #ifdef _WIN32 + MoveFile(savePath.c_str(), (savePath + "../backup/").c_str()); + #else + File::CopyDir(savePath.c_str(),(savePath + "../backup/").c_str()); + File::DeleteDirRecursively(savePath.c_str()); + #endif + } + } + } + else if (File::Exists((savePath + "../backup/").c_str())) + { + // Dolphin must have crashed while playing back a movie previously. Since we're not playing a movie now, we'll delete the save, and use the backup + if (File::Exists((savePath + "banner.bin").c_str())) + File::DeleteDirRecursively(savePath); + #ifdef _WIN32 + MoveFile((savePath + "../backup/").c_str(), savePath.c_str()); + #else + File::CopyDir((savePath + "../backup/").c_str(), savePath.c_str()); + File::DeleteDirRecursively((savePath + "../backup/").c_str()); + #endif + } + if(!File::Exists(tmdPath)) { File::IOFile _pTMDFile(tmdPath, "wb"); diff --git a/Source/Core/Core/Src/Movie.cpp b/Source/Core/Core/Src/Movie.cpp index 10909e358b..d6e9780ba3 100644 --- a/Source/Core/Core/Src/Movie.cpp +++ b/Source/Core/Core/Src/Movie.cpp @@ -103,10 +103,7 @@ void FrameUpdate() } if (IsPlayingInput() && IsConfigSaved()) { - if (IsConfigSaved()) - { - SetGraphicsConfig(); - } + SetGraphicsConfig(); } if (g_bFrameStep) @@ -390,8 +387,7 @@ bool BeginRecordingInput(int controllers) State::SaveAs(tmpStateFilename.c_str()); g_bRecordingFromSaveState = true; - // This is only done here if starting from save state because otherwise we won't have the titleid. - // If not starting from save state, it's set in WII_IPC_HLE_Device_es.cpp. There's probably a way to get this in Movie::Init, but i can't find one. + // 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; @@ -400,7 +396,6 @@ bool BeginRecordingInput(int controllers) } g_playMode = MODE_RECORDING; GetSettings(); - bSaveConfig = true; delete [] tmpInput; tmpInput = new u8[MAX_DTM_LENGTH]; @@ -636,8 +631,8 @@ void ReadHeader() } else { - bSaveConfig = false; GetSettings(); + bSaveConfig = false; } @@ -893,8 +888,7 @@ void PlayController(SPADStatus *PadStatus, int controllerID) return; } - // dtm files don't save the mic button or error bit. not sure if they're actually - // used, but better safe than sorry + // dtm files don't save the mic button or error bit. not sure if they're actually used, but better safe than sorry signed char e = PadStatus->err; memset(PadStatus, 0, sizeof(SPADStatus)); PadStatus->err = e; @@ -1028,6 +1022,17 @@ bool PlayWiimote(int wiimote, u8 *data, const WiimoteEmu::ReportFeatures& rptf, void EndPlayInput(bool cont) { + if (IsPlayingInput() && IsConfigSaved() && IsStartingFromClearSave() && Core::g_CoreStartupParameter.bWii) + { + std::string savePath = Common::GetTitleDataPath(g_titleID); + File::DeleteDirRecursively(savePath.c_str()); + #ifdef _WIN32 + MoveFile((savePath + "../backup/").c_str(), savePath.c_str()); + #else + File::CopyDir((savePath + "../backup/").c_str(), savePath.c_str()); + File::DeleteDirRecursively((savePath + "../backup/").c_str()); + #endif + } if (cont) { g_playMode = MODE_RECORDING; From 95d55ed1c7241ec6e78dd2a2a54dc3452aaedee8 Mon Sep 17 00:00:00 2001 From: rog Date: Fri, 26 Oct 2012 20:04:06 -0400 Subject: [PATCH 06/12] fixes for backing up wii saves when playing a movie --- .../Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp | 4 ++-- Source/Core/Core/Src/Movie.cpp | 11 ----------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp index ee0d1b0a22..4de2b0feb7 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp @@ -912,7 +912,7 @@ u32 CWII_IPC_HLE_Device_es::ES_DIVerify(u8* _pTMD, u32 _sz) { if (File::Exists((savePath + "../backup/").c_str())) { - // Dolphin must have crashed while playing back a movie previously, so we'll keep the backup, and just delete the current save + // The last run of this game must have been to play back a movie, so their save is already backed up. File::DeleteDirRecursively(savePath.c_str()); } else @@ -928,7 +928,7 @@ u32 CWII_IPC_HLE_Device_es::ES_DIVerify(u8* _pTMD, u32 _sz) } else if (File::Exists((savePath + "../backup/").c_str())) { - // Dolphin must have crashed while playing back a movie previously. Since we're not playing a movie now, we'll delete the save, and use the backup + // Delete the save made by a previous movie, and copy back the user's save. if (File::Exists((savePath + "banner.bin").c_str())) File::DeleteDirRecursively(savePath); #ifdef _WIN32 diff --git a/Source/Core/Core/Src/Movie.cpp b/Source/Core/Core/Src/Movie.cpp index d6e9780ba3..f98254e9a8 100644 --- a/Source/Core/Core/Src/Movie.cpp +++ b/Source/Core/Core/Src/Movie.cpp @@ -1022,17 +1022,6 @@ bool PlayWiimote(int wiimote, u8 *data, const WiimoteEmu::ReportFeatures& rptf, void EndPlayInput(bool cont) { - if (IsPlayingInput() && IsConfigSaved() && IsStartingFromClearSave() && Core::g_CoreStartupParameter.bWii) - { - std::string savePath = Common::GetTitleDataPath(g_titleID); - File::DeleteDirRecursively(savePath.c_str()); - #ifdef _WIN32 - MoveFile((savePath + "../backup/").c_str(), savePath.c_str()); - #else - File::CopyDir((savePath + "../backup/").c_str(), savePath.c_str()); - File::DeleteDirRecursively((savePath + "../backup/").c_str()); - #endif - } if (cont) { g_playMode = MODE_RECORDING; From ab48e1154bd077e11e0f5b16a5362952c72e2dcb Mon Sep 17 00:00:00 2001 From: Rog Date: Thu, 8 Nov 2012 22:45:13 -0500 Subject: [PATCH 07/12] Stop saving undo buffer (and associated .dtm, and .sav) when starting playing back a movie from save state. This is completely useless, and just wastes time copying save states around. --- Source/Core/Core/Src/State.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Core/Core/Src/State.cpp b/Source/Core/Core/Src/State.cpp index 3f3e367349..ab2313be4e 100644 --- a/Source/Core/Core/Src/State.cpp +++ b/Source/Core/Core/Src/State.cpp @@ -385,6 +385,7 @@ void LoadAs(const std::string& filename) g_loadDepth++; // Save temp buffer for undo load state + if (!Movie::IsJustStartingRecordingInputFromSaveState()) { std::lock_guard lk(g_cs_undo_load_buffer); SaveToBuffer(g_undo_load_buffer); From 35e5a1e5921e48a40d6cf46510def68ee8eccfcf Mon Sep 17 00:00:00 2001 From: rog Date: Sat, 10 Nov 2012 21:57:31 -0500 Subject: [PATCH 08/12] Add an option to pause on the last frame of a movie. --- Source/Core/Core/Src/ConfigManager.cpp | 2 ++ Source/Core/Core/Src/ConfigManager.h | 1 + Source/Core/Core/Src/Movie.cpp | 4 ++++ Source/Core/DolphinWX/Src/Frame.cpp | 1 + Source/Core/DolphinWX/Src/Frame.h | 1 + Source/Core/DolphinWX/Src/FrameTools.cpp | 7 +++++++ Source/Core/DolphinWX/Src/Globals.h | 1 + 7 files changed, 17 insertions(+) diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp index 0c4fa04566..714ca4cb75 100644 --- a/Source/Core/Core/Src/ConfigManager.cpp +++ b/Source/Core/Core/Src/ConfigManager.cpp @@ -131,6 +131,7 @@ void SConfig::SaveSettings() // General ini.Set("General", "LastFilename", m_LastFilename); + ini.Set("General", "PauseMovie", m_pauseMovie); // ISO folders // clear removed folders @@ -260,6 +261,7 @@ void SConfig::LoadSettings() // General { ini.Get("General", "LastFilename", &m_LastFilename); + ini.Get("General", "PauseMovie", &m_pauseMovie, false); m_ISOFolder.clear(); int numGCMPaths; diff --git a/Source/Core/Core/Src/ConfigManager.h b/Source/Core/Core/Src/ConfigManager.h index 0c8f3f1af1..8b9a11881c 100644 --- a/Source/Core/Core/Src/ConfigManager.h +++ b/Source/Core/Core/Src/ConfigManager.h @@ -75,6 +75,7 @@ struct SConfig : NonCopyable bool m_ListKorea; bool m_ListTaiwan; bool m_ListUnknown; + bool m_pauseMovie; SysConf* m_SYSCONF; diff --git a/Source/Core/Core/Src/Movie.cpp b/Source/Core/Core/Src/Movie.cpp index f98254e9a8..aa6fa0bd81 100644 --- a/Source/Core/Core/Src/Movie.cpp +++ b/Source/Core/Core/Src/Movie.cpp @@ -92,6 +92,10 @@ std::string GetInputDisplay() void FrameUpdate() { + if (SConfig::GetInstance().m_pauseMovie && IsPlayingInput() && g_currentInputCount == g_totalInputCount -1) + { + Core::SetState(Core::CORE_PAUSE); + } g_currentFrame++; if(!g_bPolled) g_currentLagCount++; diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 6b0e7b7678..bf09915db4 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -244,6 +244,7 @@ EVT_MENU(IDM_PLAYRECORD, CFrame::OnPlayRecording) EVT_MENU(IDM_RECORDEXPORT, CFrame::OnRecordExport) EVT_MENU(IDM_RECORDREADONLY, CFrame::OnRecordReadOnly) EVT_MENU(IDM_TASINPUT, CFrame::OnTASInput) +EVT_MENU(IDM_TOGGLE_PAUSEMOVIE, CFrame::OnTogglePauseMovie) EVT_MENU(IDM_FRAMESTEP, CFrame::OnFrameStep) EVT_MENU(IDM_SCREENSHOT, CFrame::OnScreenshot) EVT_MENU(wxID_PREFERENCES, CFrame::OnConfigMain) diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index 770d459220..9aa434f6da 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -297,6 +297,7 @@ private: void OnRecordExport(wxCommandEvent& event); void OnRecordReadOnly(wxCommandEvent& event); void OnTASInput(wxCommandEvent& event); + void OnTogglePauseMovie(wxCommandEvent& event); void OnChangeDisc(wxCommandEvent& event); void OnScreenshot(wxCommandEvent& event); void OnActive(wxActivateEvent& event); diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 8215b68efc..6691641292 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -142,6 +142,8 @@ void CFrame::CreateMenu() emulationMenu->Append(IDM_RECORDEXPORT, GetMenuLabel(HK_EXPORT_RECORDING)); emulationMenu->Append(IDM_RECORDREADONLY, GetMenuLabel(HK_READ_ONLY_MODE), wxEmptyString, wxITEM_CHECK); emulationMenu->Append(IDM_TASINPUT, _("TAS Input")); + emulationMenu->AppendCheckItem(IDM_TOGGLE_PAUSEMOVIE, _("Pause at end of movie")); + emulationMenu->Check(IDM_TOGGLE_PAUSEMOVIE, SConfig::GetInstance().m_pauseMovie); emulationMenu->Check(IDM_RECORDREADONLY, true); emulationMenu->AppendSeparator(); @@ -702,6 +704,11 @@ void CFrame::OnTASInput(wxCommandEvent& event) g_TASInputDlg->Show(true); } +void CFrame::OnTogglePauseMovie(wxCommandEvent& WXUNUSED (event)) +{ + SConfig::GetInstance().m_pauseMovie = !SConfig::GetInstance().m_pauseMovie; + SConfig::GetInstance().SaveSettings(); +} void CFrame::OnFrameStep(wxCommandEvent& event) { bool wasPaused = (Core::GetState() == Core::CORE_PAUSE); diff --git a/Source/Core/DolphinWX/Src/Globals.h b/Source/Core/DolphinWX/Src/Globals.h index 8089a2622c..854efb6235 100644 --- a/Source/Core/DolphinWX/Src/Globals.h +++ b/Source/Core/DolphinWX/Src/Globals.h @@ -80,6 +80,7 @@ enum IDM_RECORDEXPORT, IDM_RECORDREADONLY, IDM_TASINPUT, + IDM_TOGGLE_PAUSEMOVIE, IDM_FRAMESTEP, IDM_SCREENSHOT, IDM_BROWSE, From a5d210129d433cee7df6c7d8d52152ade13ebcd0 Mon Sep 17 00:00:00 2001 From: rog Date: Sun, 11 Nov 2012 17:57:06 -0500 Subject: [PATCH 09/12] Add an on screen lag counter. --- Source/Core/Core/Src/ConfigManager.cpp | 2 ++ Source/Core/Core/Src/ConfigManager.h | 1 + Source/Core/DolphinWX/Src/Frame.cpp | 1 + Source/Core/DolphinWX/Src/Frame.h | 1 + Source/Core/DolphinWX/Src/FrameTools.cpp | 11 ++++++++++- Source/Core/DolphinWX/Src/Globals.h | 1 + Source/Plugins/Plugin_VideoDX11/Src/Render.cpp | 14 +++++++++++--- Source/Plugins/Plugin_VideoDX9/Src/Render.cpp | 15 ++++++++++++--- Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 4 ++++ 9 files changed, 43 insertions(+), 7 deletions(-) diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp index 714ca4cb75..df0ce1aa02 100644 --- a/Source/Core/Core/Src/ConfigManager.cpp +++ b/Source/Core/Core/Src/ConfigManager.cpp @@ -132,6 +132,7 @@ void SConfig::SaveSettings() // General ini.Set("General", "LastFilename", m_LastFilename); ini.Set("General", "PauseMovie", m_pauseMovie); + ini.Set("General", "ShowLag", m_showLag); // ISO folders // clear removed folders @@ -262,6 +263,7 @@ void SConfig::LoadSettings() { ini.Get("General", "LastFilename", &m_LastFilename); ini.Get("General", "PauseMovie", &m_pauseMovie, false); + ini.Get("General", "ShowLag", &m_showLag, false); m_ISOFolder.clear(); int numGCMPaths; diff --git a/Source/Core/Core/Src/ConfigManager.h b/Source/Core/Core/Src/ConfigManager.h index 8b9a11881c..1235e23eac 100644 --- a/Source/Core/Core/Src/ConfigManager.h +++ b/Source/Core/Core/Src/ConfigManager.h @@ -76,6 +76,7 @@ struct SConfig : NonCopyable bool m_ListTaiwan; bool m_ListUnknown; bool m_pauseMovie; + bool m_showLag; SysConf* m_SYSCONF; diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index bf09915db4..9d59ca1788 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -245,6 +245,7 @@ EVT_MENU(IDM_RECORDEXPORT, CFrame::OnRecordExport) EVT_MENU(IDM_RECORDREADONLY, CFrame::OnRecordReadOnly) EVT_MENU(IDM_TASINPUT, CFrame::OnTASInput) EVT_MENU(IDM_TOGGLE_PAUSEMOVIE, CFrame::OnTogglePauseMovie) +EVT_MENU(IDM_SHOWLAG, CFrame::OnShowLag) EVT_MENU(IDM_FRAMESTEP, CFrame::OnFrameStep) EVT_MENU(IDM_SCREENSHOT, CFrame::OnScreenshot) EVT_MENU(wxID_PREFERENCES, CFrame::OnConfigMain) diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index 9aa434f6da..8c8285f842 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -298,6 +298,7 @@ private: void OnRecordReadOnly(wxCommandEvent& event); void OnTASInput(wxCommandEvent& event); void OnTogglePauseMovie(wxCommandEvent& event); + void OnShowLag(wxCommandEvent& event); void OnChangeDisc(wxCommandEvent& event); void OnScreenshot(wxCommandEvent& event); void OnActive(wxActivateEvent& event); diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 6691641292..e4a7ed8986 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -144,9 +144,11 @@ void CFrame::CreateMenu() emulationMenu->Append(IDM_TASINPUT, _("TAS Input")); emulationMenu->AppendCheckItem(IDM_TOGGLE_PAUSEMOVIE, _("Pause at end of movie")); emulationMenu->Check(IDM_TOGGLE_PAUSEMOVIE, SConfig::GetInstance().m_pauseMovie); + emulationMenu->AppendCheckItem(IDM_SHOWLAG, _("Show lag counter")); + emulationMenu->Check(IDM_SHOWLAG, SConfig::GetInstance().m_showLag); emulationMenu->Check(IDM_RECORDREADONLY, true); emulationMenu->AppendSeparator(); - + emulationMenu->Append(IDM_FRAMESTEP, GetMenuLabel(HK_FRAME_ADVANCE), wxEmptyString); wxMenu *skippingMenu = new wxMenu; @@ -709,6 +711,13 @@ void CFrame::OnTogglePauseMovie(wxCommandEvent& WXUNUSED (event)) SConfig::GetInstance().m_pauseMovie = !SConfig::GetInstance().m_pauseMovie; SConfig::GetInstance().SaveSettings(); } + +void CFrame::OnShowLag(wxCommandEvent& WXUNUSED (event)) +{ + SConfig::GetInstance().m_showLag = !SConfig::GetInstance().m_showLag; + SConfig::GetInstance().SaveSettings(); +} + void CFrame::OnFrameStep(wxCommandEvent& event) { bool wasPaused = (Core::GetState() == Core::CORE_PAUSE); diff --git a/Source/Core/DolphinWX/Src/Globals.h b/Source/Core/DolphinWX/Src/Globals.h index 854efb6235..36a37de6cc 100644 --- a/Source/Core/DolphinWX/Src/Globals.h +++ b/Source/Core/DolphinWX/Src/Globals.h @@ -81,6 +81,7 @@ enum IDM_RECORDREADONLY, IDM_TASINPUT, IDM_TOGGLE_PAUSEMOVIE, + IDM_SHOWLAG, IDM_FRAMESTEP, IDM_SCREENSHOT, IDM_BROWSE, diff --git a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp index 81efa3623f..079692b76b 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp @@ -45,6 +45,7 @@ #include "BPFunctions.h" #include "AVIDump.h" #include "FPSCounter.h" +#include "ConfigManager.h" namespace DX11 { @@ -1094,11 +1095,18 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons D3D::font.DrawTextScaled(0, 0, 20, 0.0f, 0xFF00FFFF, fps); } + if (SConfig::GetInstance().m_showLag) + { + char lag[10]; + StringCchPrintfA(lag, 1000, "Lag: %d\n", Movie::g_currentLagCount); + D3D::font.DrawTextScaled(0, 18, 20, 0.0f, 0xFF00FFFF, lag); + } + if (g_ActiveConfig.bShowInputDisplay) { char inputDisplay[1000]; StringCchPrintfA(inputDisplay, 1000, Movie::GetInputDisplay().c_str()); - D3D::font.DrawTextScaled(0, 30, 20, 0.0f, 0xFF00FFFF, inputDisplay); + D3D::font.DrawTextScaled(0, 36, 20, 0.0f, 0xFF00FFFF, inputDisplay); } Renderer::DrawDebugText(); @@ -1106,13 +1114,13 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons { char buf[32768]; Statistics::ToString(buf); - D3D::font.DrawTextScaled(0, 30, 20, 0.0f, 0xFF00FFFF, buf); + D3D::font.DrawTextScaled(0, 36, 20, 0.0f, 0xFF00FFFF, buf); } else if (g_ActiveConfig.bOverlayProjStats) { char buf[32768]; Statistics::ToStringProj(buf); - D3D::font.DrawTextScaled(0, 30, 20, 0.0f, 0xFF00FFFF, buf); + D3D::font.DrawTextScaled(0, 36, 20, 0.0f, 0xFF00FFFF, buf); } OSD::DrawMessages(); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp index a59adb4793..c4e37e761e 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp @@ -55,6 +55,7 @@ #include "Movie.h" #include "BPFunctions.h" #include "FPSCounter.h" +#include "ConfigManager.h" namespace DX9 { @@ -1091,23 +1092,31 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons D3D::font.DrawTextScaled(0, 0, 20, 20, 0.0f, 0xFF00FFFF, fps); } + if (SConfig::GetInstance().m_showLag) + { + char lag[10]; + StringCchPrintfA(lag, 1000, "Lag: %d\n", Movie::g_currentLagCount); + D3D::font.DrawTextScaled(0, 18, 20, 20, 0.0f, 0xFF00FFFF, lag); + } + if (g_ActiveConfig.bShowInputDisplay) { char inputDisplay[1000]; StringCchPrintfA(inputDisplay, 1000, Movie::GetInputDisplay().c_str()); - D3D::font.DrawTextScaled(0, 30, 20, 20, 0.0f, 0xFF00FFFF, inputDisplay); + D3D::font.DrawTextScaled(0, 36, 20, 20, 0.0f, 0xFF00FFFF, inputDisplay); } + Renderer::DrawDebugText(); if (g_ActiveConfig.bOverlayStats) { Statistics::ToString(st); - D3D::font.DrawTextScaled(0, 30, 20, 20, 0.0f, 0xFF00FFFF, st); + D3D::font.DrawTextScaled(0, 36, 20, 20, 0.0f, 0xFF00FFFF, st); } else if (g_ActiveConfig.bOverlayProjStats) { Statistics::ToStringProj(st); - D3D::font.DrawTextScaled(0, 30, 20, 20, 0.0f, 0xFF00FFFF, st); + D3D::font.DrawTextScaled(0, 35, 20, 20, 0.0f, 0xFF00FFFF, st); } OSD::DrawMessages(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index a6121e1436..4f74454ece 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -62,6 +62,7 @@ #include "Host.h" #include "BPFunctions.h" #include "FPSCounter.h" +#include "ConfigManager.h" #include "main.h" // Local #ifdef _WIN32 @@ -531,6 +532,9 @@ void Renderer::DrawDebugInfo() if (g_ActiveConfig.bShowFPS) p+=sprintf(p, "FPS: %d\n", s_fps); + if (SConfig::GetInstance().m_showLag) + p+=sprintf(p, "Lag: %d\n", Movie::g_currentLagCount); + if (g_ActiveConfig.bShowInputDisplay) p+=sprintf(p, "%s", Movie::GetInputDisplay().c_str()); From 8fe5aa4ee8568bd502dade463be18c7f7504a0de Mon Sep 17 00:00:00 2001 From: rog Date: Mon, 12 Nov 2012 11:39:33 -0500 Subject: [PATCH 10/12] movie cleanup --- Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp | 2 +- Source/Core/Core/Src/Movie.cpp | 12 ++++-------- Source/Plugins/Plugin_VideoDX9/Src/Render.cpp | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp b/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp index 038eb6e9a9..c157e55d1b 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp +++ b/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp @@ -52,7 +52,7 @@ CEXIMemoryCard::CEXIMemoryCard(const int index) , m_bDirty(false) { m_strFilename = (card_index == 0) ? SConfig::GetInstance().m_strMemoryCardA : SConfig::GetInstance().m_strMemoryCardB; - if (Movie::IsUsingMemcard() && Movie::IsPlayingInput() && Movie::IsConfigSaved() && Movie::IsStartingFromClearSave()) + if (Movie::IsPlayingInput() && Movie::IsConfigSaved() && Movie::IsUsingMemcard() && Movie::IsStartingFromClearSave()) m_strFilename = "Movie.raw"; // we're potentially leaking events here, since there's no UnregisterEvent until emu shutdown, but I guess it's inconsequential diff --git a/Source/Core/Core/Src/Movie.cpp b/Source/Core/Core/Src/Movie.cpp index aa6fa0bd81..189201a36a 100644 --- a/Source/Core/Core/Src/Movie.cpp +++ b/Source/Core/Core/Src/Movie.cpp @@ -92,7 +92,7 @@ std::string GetInputDisplay() void FrameUpdate() { - if (SConfig::GetInstance().m_pauseMovie && IsPlayingInput() && g_currentInputCount == g_totalInputCount -1) + if (IsPlayingInput() && g_currentInputCount == g_totalInputCount -1 && SConfig::GetInstance().m_pauseMovie) { Core::SetState(Core::CORE_PAUSE); } @@ -135,7 +135,7 @@ void Init() g_bFrameStep = false; g_bFrameStop = false; bSaveConfig = false; - + iCPUCore = SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore; if (IsPlayingInput()) { ReadHeader(); @@ -743,11 +743,8 @@ void LoadInput(const char *filename) ReadHeader(); if (!g_bReadOnly) { - if (g_rerecords > tmpHeader.numRerecords) - { - tmpHeader.numRerecords = g_rerecords; - } - tmpHeader.numRerecords++; + g_rerecords++; + tmpHeader.numRerecords = g_rerecords; t_record.Seek(0, SEEK_SET); t_record.WriteArray(&tmpHeader, 1); } @@ -968,7 +965,6 @@ void PlayController(SPADStatus *PadStatus, int controllerID) } else { - Core::SetState(Core::CORE_PAUSE); PanicAlert("Change the disc to %s", g_discChange.c_str()); } } diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp index c4e37e761e..226b7227c3 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp @@ -1116,7 +1116,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons else if (g_ActiveConfig.bOverlayProjStats) { Statistics::ToStringProj(st); - D3D::font.DrawTextScaled(0, 35, 20, 20, 0.0f, 0xFF00FFFF, st); + D3D::font.DrawTextScaled(0, 36, 20, 20, 0.0f, 0xFF00FFFF, st); } OSD::DrawMessages(); From 14aa7150d9363ea7adafd9188feb7197e7ade2a6 Mon Sep 17 00:00:00 2001 From: rog Date: Wed, 14 Nov 2012 16:21:54 -0500 Subject: [PATCH 11/12] Add option for author name for movies. Also, minor cleanup for previous options i've added. --- Source/Core/Core/Src/ConfigManager.cpp | 14 ++++++++++---- Source/Core/Core/Src/ConfigManager.h | 5 +++-- Source/Core/Core/Src/Movie.cpp | 4 ++-- Source/Core/DolphinWX/Src/FrameTools.cpp | 8 ++++---- Source/Plugins/Plugin_VideoDX11/Src/Render.cpp | 2 +- Source/Plugins/Plugin_VideoDX9/Src/Render.cpp | 2 +- Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 2 +- 7 files changed, 22 insertions(+), 15 deletions(-) diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp index df0ce1aa02..433be735c2 100644 --- a/Source/Core/Core/Src/ConfigManager.cpp +++ b/Source/Core/Core/Src/ConfigManager.cpp @@ -131,8 +131,7 @@ void SConfig::SaveSettings() // General ini.Set("General", "LastFilename", m_LastFilename); - ini.Set("General", "PauseMovie", m_pauseMovie); - ini.Set("General", "ShowLag", m_showLag); + ini.Set("General", "ShowLag", m_ShowLag); // ISO folders // clear removed folders @@ -248,6 +247,10 @@ void SConfig::SaveSettings() // GFX Backend ini.Set("Core", "GFXBackend", m_LocalCoreStartupParameter.m_strVideoBackend); + // Movie + ini.Set("Movie", "PauseMovie", m_PauseMovie); + ini.Set("Movie", "Author", m_strMovieAuthor); + ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX)); m_SYSCONF->Save(); } @@ -262,8 +265,7 @@ void SConfig::LoadSettings() // General { ini.Get("General", "LastFilename", &m_LastFilename); - ini.Get("General", "PauseMovie", &m_pauseMovie, false); - ini.Get("General", "ShowLag", &m_showLag, false); + ini.Get("General", "ShowLag", &m_ShowLag, false); m_ISOFolder.clear(); int numGCMPaths; @@ -388,6 +390,10 @@ void SConfig::LoadSettings() // GFX Backend ini.Get("Core", "GFXBackend", &m_LocalCoreStartupParameter.m_strVideoBackend, ""); + + // Movie + ini.Get("General", "PauseMovie", &m_PauseMovie, false); + ini.Get("Movie", "Author", &m_strMovieAuthor, ""); } m_SYSCONF = new SysConf(); diff --git a/Source/Core/Core/Src/ConfigManager.h b/Source/Core/Core/Src/ConfigManager.h index 1235e23eac..f8733296b4 100644 --- a/Source/Core/Core/Src/ConfigManager.h +++ b/Source/Core/Core/Src/ConfigManager.h @@ -75,8 +75,9 @@ struct SConfig : NonCopyable bool m_ListKorea; bool m_ListTaiwan; bool m_ListUnknown; - bool m_pauseMovie; - bool m_showLag; + bool m_PauseMovie; + bool m_ShowLag; + std::string m_strMovieAuthor; SysConf* m_SYSCONF; diff --git a/Source/Core/Core/Src/Movie.cpp b/Source/Core/Core/Src/Movie.cpp index 189201a36a..a03f1a568e 100644 --- a/Source/Core/Core/Src/Movie.cpp +++ b/Source/Core/Core/Src/Movie.cpp @@ -92,7 +92,7 @@ std::string GetInputDisplay() void FrameUpdate() { - 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); } @@ -400,7 +400,7 @@ bool BeginRecordingInput(int controllers) } g_playMode = MODE_RECORDING; GetSettings(); - + author = SConfig::GetInstance().m_strMovieAuthor; delete [] tmpInput; tmpInput = new u8[MAX_DTM_LENGTH]; g_currentByte = g_totalBytes = 0; diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index e4a7ed8986..2d2b308799 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -143,9 +143,9 @@ void CFrame::CreateMenu() emulationMenu->Append(IDM_RECORDREADONLY, GetMenuLabel(HK_READ_ONLY_MODE), wxEmptyString, wxITEM_CHECK); emulationMenu->Append(IDM_TASINPUT, _("TAS Input")); emulationMenu->AppendCheckItem(IDM_TOGGLE_PAUSEMOVIE, _("Pause at end of movie")); - emulationMenu->Check(IDM_TOGGLE_PAUSEMOVIE, SConfig::GetInstance().m_pauseMovie); + emulationMenu->Check(IDM_TOGGLE_PAUSEMOVIE, SConfig::GetInstance().m_PauseMovie); emulationMenu->AppendCheckItem(IDM_SHOWLAG, _("Show lag counter")); - emulationMenu->Check(IDM_SHOWLAG, SConfig::GetInstance().m_showLag); + emulationMenu->Check(IDM_SHOWLAG, SConfig::GetInstance().m_ShowLag); emulationMenu->Check(IDM_RECORDREADONLY, true); emulationMenu->AppendSeparator(); @@ -708,13 +708,13 @@ void CFrame::OnTASInput(wxCommandEvent& event) void CFrame::OnTogglePauseMovie(wxCommandEvent& WXUNUSED (event)) { - SConfig::GetInstance().m_pauseMovie = !SConfig::GetInstance().m_pauseMovie; + SConfig::GetInstance().m_PauseMovie = !SConfig::GetInstance().m_PauseMovie; SConfig::GetInstance().SaveSettings(); } void CFrame::OnShowLag(wxCommandEvent& WXUNUSED (event)) { - SConfig::GetInstance().m_showLag = !SConfig::GetInstance().m_showLag; + SConfig::GetInstance().m_ShowLag = !SConfig::GetInstance().m_ShowLag; SConfig::GetInstance().SaveSettings(); } diff --git a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp index 079692b76b..6a1a6c868c 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp @@ -1095,7 +1095,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons D3D::font.DrawTextScaled(0, 0, 20, 0.0f, 0xFF00FFFF, fps); } - if (SConfig::GetInstance().m_showLag) + if (SConfig::GetInstance().m_ShowLag) { char lag[10]; StringCchPrintfA(lag, 1000, "Lag: %d\n", Movie::g_currentLagCount); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp index 226b7227c3..b0997225cf 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp @@ -1092,7 +1092,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons D3D::font.DrawTextScaled(0, 0, 20, 20, 0.0f, 0xFF00FFFF, fps); } - if (SConfig::GetInstance().m_showLag) + if (SConfig::GetInstance().m_ShowLag) { char lag[10]; StringCchPrintfA(lag, 1000, "Lag: %d\n", Movie::g_currentLagCount); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 4f74454ece..cce93d2115 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -532,7 +532,7 @@ void Renderer::DrawDebugInfo() if (g_ActiveConfig.bShowFPS) p+=sprintf(p, "FPS: %d\n", s_fps); - if (SConfig::GetInstance().m_showLag) + if (SConfig::GetInstance().m_ShowLag) p+=sprintf(p, "Lag: %d\n", Movie::g_currentLagCount); if (g_ActiveConfig.bShowInputDisplay) From 101de62c8676677c55683c8bed22b6c8e87367c2 Mon Sep 17 00:00:00 2001 From: rog Date: Fri, 16 Nov 2012 12:03:51 -0500 Subject: [PATCH 12/12] Remove an old TODO, and add a new one. --- Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp | 2 ++ Source/Core/Core/Src/Movie.cpp | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp index 4de2b0feb7..3d3fb0a12a 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp @@ -906,6 +906,8 @@ u32 CWII_IPC_HLE_Device_es::ES_DIVerify(u8* _pTMD, u32 _sz) else Movie::g_bClearSave = true; } + + // TODO: Force the game to save to another location, instead of moving the user's save. if (Movie::IsPlayingInput() && Movie::IsConfigSaved() && Movie::IsStartingFromClearSave()) { if (File::Exists((savePath + "banner.bin").c_str())) diff --git a/Source/Core/Core/Src/Movie.cpp b/Source/Core/Core/Src/Movie.cpp index a03f1a568e..af33458523 100644 --- a/Source/Core/Core/Src/Movie.cpp +++ b/Source/Core/Core/Src/Movie.cpp @@ -639,7 +639,6 @@ void ReadHeader() bSaveConfig = false; } - videoBackend.resize(ARRAYSIZE(tmpHeader.videoBackend)); for (int i = 0; i < ARRAYSIZE(tmpHeader.videoBackend);i++) { @@ -1078,7 +1077,6 @@ void SaveRecording(const char *filename) header.bMemcard = bMemcard; header.bClearSave = g_bClearSave; strncpy((char *)header.discChange, g_discChange.c_str(),ARRAYSIZE(header.discChange)); - // TODO: prompt the user for author name. It's currently always blank, unless the user manually edits the .dtm file. strncpy((char *)header.author, author.c_str(),ARRAYSIZE(header.author)); // TODO