summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorrog <rdragoon@optonline.net>2012-10-25 02:44:30 -0400
committerrog <rdragoon@optonline.net>2012-10-25 03:15:54 -0400
commit0bc202128482fb26b84e18cde213156cd40d297a (patch)
tree6dcf05c7f951fce5c4b7f7e332a366cf8fe203ee /Source/Core
parent8dfb12da3e130eccb348c030c247dac2de27a58d (diff)
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.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/Src/BootManager.cpp2
-rw-r--r--Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp2
-rw-r--r--Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp11
-rw-r--r--Source/Core/Core/Src/Movie.cpp31
-rw-r--r--Source/Core/Core/Src/Movie.h7
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();