WiiSaveCrypted: Move some function params over to std::string

This commit is contained in:
Lioncash 2014-09-30 20:31:59 -04:00
parent 13fc8e7df1
commit 0d8b34612e
3 changed files with 10 additions and 11 deletions

View File

@ -39,7 +39,7 @@ const u8 CWiiSaveCrypted::s_md5_blanker[16] = {
};
const u32 CWiiSaveCrypted::s_ng_id = 0x0403AC68;
bool CWiiSaveCrypted::ImportWiiSave(const char* filename)
bool CWiiSaveCrypted::ImportWiiSave(const std::string& filename)
{
CWiiSaveCrypted save_file(filename);
return save_file.m_valid;
@ -102,11 +102,10 @@ void CWiiSaveCrypted::ExportAllSaves()
(File::GetUserPath(D_USER_IDX) + "private/wii/title/").c_str());
}
CWiiSaveCrypted::CWiiSaveCrypted(const char* filename, u64 title_id)
: m_title_id(title_id)
CWiiSaveCrypted::CWiiSaveCrypted(const std::string& filename, u64 title_id)
: m_encrypted_save_path(filename), m_title_id(title_id)
{
Common::ReadReplacements(replacements);
m_encrypted_save_path = std::string(filename);
memcpy(m_sd_iv, "\x21\x67\x12\xE6\xAA\x1F\x68\x9F\x95\xC5\xA2\x23\x24\xDC\x6A\x98", 0x10);
if (!title_id) // Import
@ -612,7 +611,7 @@ bool CWiiSaveCrypted::getPaths(bool for_export)
return true;
}
void CWiiSaveCrypted::ScanForFiles(std::string save_directory, std::vector<std::string>& file_list,
void CWiiSaveCrypted::ScanForFiles(const std::string& save_directory, std::vector<std::string>& file_list,
u32 *num_files, u32 *size_files)
{
std::vector<std::string> directories;
@ -632,13 +631,13 @@ void CWiiSaveCrypted::ScanForFiles(std::string save_directory, std::vector<std::
File::ScanDirectoryTree(directories[i], fst_tmp);
for (const File::FSTEntry& elem : fst_tmp.children)
{
if (strncmp(elem.virtualName.c_str(), "banner.bin", 10) != 0)
if (elem.virtualName != "banner.bin")
{
num++;
size += FILE_HDR_SZ;
if (elem.isDirectory)
{
if ((elem.virtualName == "nocopy") || elem.virtualName == "nomove")
if (elem.virtualName == "nocopy" || elem.virtualName == "nomove")
{
NOTICE_LOG(CONSOLE,
"This save will likely require homebrew tools to copy to a real Wii.");

View File

@ -13,12 +13,12 @@
class CWiiSaveCrypted
{
public:
bool static ImportWiiSave(const char* filename);
bool static ImportWiiSave(const std::string& filename);
bool static ExportWiiSave(u64 title_id);
void static ExportAllSaves();
private:
CWiiSaveCrypted(const char* filename, u64 title_id = 0);
CWiiSaveCrypted(const std::string& filename, u64 title_id = 0);
~CWiiSaveCrypted();
void ReadHDR();
void ReadBKHDR();
@ -31,7 +31,7 @@ private:
void make_ec_cert(u8 *cert, const u8 *sig, const char *signer, const char *name,
const u8 *priv, const u32 key_id);
bool getPaths(bool for_export = false);
void ScanForFiles(std::string save_directory, std::vector<std::string>& file_list,
void ScanForFiles(const std::string& save_directory, std::vector<std::string>& file_list,
u32 *num_files, u32 *size_files);
static const u8 s_sd_key[16];

View File

@ -1403,7 +1403,7 @@ void CFrame::OnImportSave(wxCommandEvent& WXUNUSED (event))
if (!path.IsEmpty())
{
CWiiSaveCrypted::ImportWiiSave(WxStrToStr(path).c_str());
CWiiSaveCrypted::ImportWiiSave(WxStrToStr(path));
}
}