Rename CWiiSaveCrypted to WiiSave

This commit is contained in:
Léo Lam 2018-05-12 22:39:14 +02:00
parent 5564150dd6
commit 00bc1f28f2
9 changed files with 45 additions and 46 deletions

View File

@ -150,7 +150,7 @@ add_library(core
HW/WiimoteEmu/Encryption.cpp HW/WiimoteEmu/Encryption.cpp
HW/WiimoteEmu/Speaker.cpp HW/WiimoteEmu/Speaker.cpp
HW/WiimoteReal/WiimoteReal.cpp HW/WiimoteReal/WiimoteReal.cpp
HW/WiiSaveCrypted.cpp HW/WiiSave.cpp
IOS/Device.cpp IOS/Device.cpp
IOS/DeviceStub.cpp IOS/DeviceStub.cpp
IOS/IOS.cpp IOS/IOS.cpp

View File

@ -179,7 +179,7 @@
<ClCompile Include="HW\WiimoteReal\IOWin.cpp" /> <ClCompile Include="HW\WiimoteReal\IOWin.cpp" />
<ClCompile Include="HW\WiimoteReal\WiimoteReal.cpp" /> <ClCompile Include="HW\WiimoteReal\WiimoteReal.cpp" />
<ClCompile Include="HW\WII_IPC.cpp" /> <ClCompile Include="HW\WII_IPC.cpp" />
<ClCompile Include="HW\WiiSaveCrypted.cpp" /> <ClCompile Include="HW\WiiSave.cpp" />
<ClCompile Include="IOS\Device.cpp" /> <ClCompile Include="IOS\Device.cpp" />
<ClCompile Include="IOS\DeviceStub.cpp" /> <ClCompile Include="IOS\DeviceStub.cpp" />
<ClCompile Include="IOS\IOS.cpp" /> <ClCompile Include="IOS\IOS.cpp" />
@ -437,7 +437,7 @@
<ClInclude Include="HW\WiimoteEmu\WiimoteHid.h" /> <ClInclude Include="HW\WiimoteEmu\WiimoteHid.h" />
<ClInclude Include="HW\WiimoteReal\WiimoteReal.h" /> <ClInclude Include="HW\WiimoteReal\WiimoteReal.h" />
<ClInclude Include="HW\WiimoteReal\WiimoteRealBase.h" /> <ClInclude Include="HW\WiimoteReal\WiimoteRealBase.h" />
<ClInclude Include="HW\WiiSaveCrypted.h" /> <ClInclude Include="HW\WiiSave.h" />
<ClInclude Include="HW\WII_IPC.h" /> <ClInclude Include="HW\WII_IPC.h" />
<ClInclude Include="IOS\Device.h" /> <ClInclude Include="IOS\Device.h" />
<ClInclude Include="IOS\DeviceStub.h" /> <ClInclude Include="IOS\DeviceStub.h" />

View File

@ -561,7 +561,7 @@
<ClCompile Include="HW\SystemTimers.cpp"> <ClCompile Include="HW\SystemTimers.cpp">
<Filter>HW %28Flipper/Hollywood%29</Filter> <Filter>HW %28Flipper/Hollywood%29</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="HW\WiiSaveCrypted.cpp"> <ClCompile Include="HW\WiiSave.cpp">
<Filter>HW %28Flipper/Hollywood%29</Filter> <Filter>HW %28Flipper/Hollywood%29</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="DSP\DSPAssembler.cpp"> <ClCompile Include="DSP\DSPAssembler.cpp">
@ -1242,7 +1242,7 @@
<ClInclude Include="HW\SystemTimers.h"> <ClInclude Include="HW\SystemTimers.h">
<Filter>HW %28Flipper/Hollywood%29</Filter> <Filter>HW %28Flipper/Hollywood%29</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="HW\WiiSaveCrypted.h"> <ClInclude Include="HW\WiiSave.h">
<Filter>HW %28Flipper/Hollywood%29</Filter> <Filter>HW %28Flipper/Hollywood%29</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="DSP\DSPAssembler.h"> <ClInclude Include="DSP\DSPAssembler.h">
@ -1578,4 +1578,4 @@
<ItemGroup> <ItemGroup>
<Text Include="CMakeLists.txt" /> <Text Include="CMakeLists.txt" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -7,7 +7,7 @@
// Licensed under the terms of the GNU GPL, version 2 // Licensed under the terms of the GNU GPL, version 2
// http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt // http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
#include "Core/HW/WiiSaveCrypted.h" #include "Core/HW/WiiSave.h"
#include <cinttypes> #include <cinttypes>
#include <cstddef> #include <cstddef>
@ -31,21 +31,21 @@
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Common/Swap.h" #include "Common/Swap.h"
const u8 CWiiSaveCrypted::s_sd_key[16] = {0xAB, 0x01, 0xB9, 0xD8, 0xE1, 0x62, 0x2B, 0x08, const u8 WiiSave::s_sd_key[16] = {0xAB, 0x01, 0xB9, 0xD8, 0xE1, 0x62, 0x2B, 0x08,
0xAF, 0xBA, 0xD8, 0x4D, 0xBF, 0xC2, 0xA5, 0x5D}; 0xAF, 0xBA, 0xD8, 0x4D, 0xBF, 0xC2, 0xA5, 0x5D};
const u8 CWiiSaveCrypted::s_md5_blanker[16] = {0x0E, 0x65, 0x37, 0x81, 0x99, 0xBE, 0x45, 0x17, const u8 WiiSave::s_md5_blanker[16] = {0x0E, 0x65, 0x37, 0x81, 0x99, 0xBE, 0x45, 0x17,
0xAB, 0x06, 0xEC, 0x22, 0x45, 0x1A, 0x57, 0x93}; 0xAB, 0x06, 0xEC, 0x22, 0x45, 0x1A, 0x57, 0x93};
const u32 CWiiSaveCrypted::s_ng_id = 0x0403AC68; const u32 WiiSave::s_ng_id = 0x0403AC68;
bool CWiiSaveCrypted::ImportWiiSave(const std::string& filename) bool WiiSave::ImportWiiSave(const std::string& filename)
{ {
CWiiSaveCrypted save_file(filename); WiiSave save_file(filename);
return save_file.m_valid; return save_file.m_valid;
} }
bool CWiiSaveCrypted::ExportWiiSave(u64 title_id) bool WiiSave::ExportWiiSave(u64 title_id)
{ {
CWiiSaveCrypted export_save("", title_id); WiiSave export_save("", title_id);
if (export_save.m_valid) if (export_save.m_valid)
{ {
SuccessAlertT("Successfully exported file to %s", export_save.m_encrypted_save_path.c_str()); SuccessAlertT("Successfully exported file to %s", export_save.m_encrypted_save_path.c_str());
@ -57,7 +57,7 @@ bool CWiiSaveCrypted::ExportWiiSave(u64 title_id)
return export_save.m_valid; return export_save.m_valid;
} }
void CWiiSaveCrypted::ExportAllSaves() void WiiSave::ExportAllSaves()
{ {
std::string title_folder = File::GetUserPath(D_WIIROOT_IDX) + "/title"; std::string title_folder = File::GetUserPath(D_WIIROOT_IDX) + "/title";
std::vector<u64> titles; std::vector<u64> titles;
@ -89,7 +89,7 @@ void CWiiSaveCrypted::ExportAllSaves()
u32 success = 0; u32 success = 0;
for (const u64& title : titles) for (const u64& title : titles)
{ {
CWiiSaveCrypted export_save{"", title}; WiiSave export_save{"", title};
if (export_save.m_valid) if (export_save.m_valid)
success++; success++;
} }
@ -97,7 +97,7 @@ void CWiiSaveCrypted::ExportAllSaves()
(File::GetUserPath(D_USER_IDX) + "private/wii/title/").c_str()); (File::GetUserPath(D_USER_IDX) + "private/wii/title/").c_str());
} }
CWiiSaveCrypted::CWiiSaveCrypted(const std::string& filename, u64 title_id) WiiSave::WiiSave(const std::string& filename, u64 title_id)
: m_encrypted_save_path(filename), m_title_id(title_id) : m_encrypted_save_path(filename), m_title_id(title_id)
{ {
memcpy(m_sd_iv, "\x21\x67\x12\xE6\xAA\x1F\x68\x9F\x95\xC5\xA2\x23\x24\xDC\x6A\x98", 0x10); memcpy(m_sd_iv, "\x21\x67\x12\xE6\xAA\x1F\x68\x9F\x95\xC5\xA2\x23\x24\xDC\x6A\x98", 0x10);
@ -134,7 +134,7 @@ CWiiSaveCrypted::CWiiSaveCrypted(const std::string& filename, u64 title_id)
} }
} }
void CWiiSaveCrypted::ReadHDR() void WiiSave::ReadHDR()
{ {
File::IOFile data_file(m_encrypted_save_path, "rb"); File::IOFile data_file(m_encrypted_save_path, "rb");
if (!data_file) if (!data_file)
@ -197,7 +197,7 @@ void CWiiSaveCrypted::ReadHDR()
} }
} }
void CWiiSaveCrypted::WriteHDR() void WiiSave::WriteHDR()
{ {
if (!m_valid) if (!m_valid)
return; return;
@ -236,7 +236,7 @@ void CWiiSaveCrypted::WriteHDR()
} }
} }
void CWiiSaveCrypted::ReadBKHDR() void WiiSave::ReadBKHDR()
{ {
if (!m_valid) if (!m_valid)
return; return;
@ -282,7 +282,7 @@ void CWiiSaveCrypted::ReadBKHDR()
} }
} }
void CWiiSaveCrypted::WriteBKHDR() void WiiSave::WriteBKHDR()
{ {
if (!m_valid) if (!m_valid)
return; return;
@ -307,7 +307,7 @@ void CWiiSaveCrypted::WriteBKHDR()
} }
} }
void CWiiSaveCrypted::ImportWiiSaveFiles() void WiiSave::ImportWiiSaveFiles()
{ {
if (!m_valid) if (!m_valid)
return; return;
@ -391,7 +391,7 @@ void CWiiSaveCrypted::ImportWiiSaveFiles()
} }
} }
void CWiiSaveCrypted::ExportWiiSaveFiles() void WiiSave::ExportWiiSaveFiles()
{ {
if (!m_valid) if (!m_valid)
return; return;
@ -471,7 +471,7 @@ void CWiiSaveCrypted::ExportWiiSaveFiles()
} }
} }
void CWiiSaveCrypted::do_sig() void WiiSave::do_sig()
{ {
if (!m_valid) if (!m_valid)
return; return;
@ -550,8 +550,8 @@ void CWiiSaveCrypted::do_sig()
m_valid = data_file.IsGood(); m_valid = data_file.IsGood();
} }
void CWiiSaveCrypted::make_ec_cert(u8* cert, const u8* sig, const char* signer, const char* name, void WiiSave::make_ec_cert(u8* cert, const u8* sig, const char* signer, const char* name,
const u8* priv, const u32 key_id) const u8* priv, const u32 key_id)
{ {
memset(cert, 0, 0x180); memset(cert, 0, 0x180);
*(u32*)cert = Common::swap32(0x10002); *(u32*)cert = Common::swap32(0x10002);
@ -564,7 +564,7 @@ void CWiiSaveCrypted::make_ec_cert(u8* cert, const u8* sig, const char* signer,
ec_priv_to_pub(priv, cert + 0x108); ec_priv_to_pub(priv, cert + 0x108);
} }
bool CWiiSaveCrypted::getPaths(bool for_export) bool WiiSave::getPaths(bool for_export)
{ {
if (m_title_id) if (m_title_id)
{ {
@ -606,9 +606,8 @@ bool CWiiSaveCrypted::getPaths(bool for_export)
return true; return true;
} }
void CWiiSaveCrypted::ScanForFiles(const std::string& save_directory, void WiiSave::ScanForFiles(const std::string& save_directory, std::vector<std::string>& file_list,
std::vector<std::string>& file_list, u32* num_files, u32* num_files, u32* size_files)
u32* size_files)
{ {
std::vector<std::string> directories; std::vector<std::string> directories;
directories.push_back(save_directory); directories.push_back(save_directory);
@ -653,6 +652,6 @@ void CWiiSaveCrypted::ScanForFiles(const std::string& save_directory,
*size_files = size; *size_files = size;
} }
CWiiSaveCrypted::~CWiiSaveCrypted() WiiSave::~WiiSave()
{ {
} }

View File

@ -10,7 +10,7 @@
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
class CWiiSaveCrypted class WiiSave
{ {
public: public:
bool static ImportWiiSave(const std::string& filename); bool static ImportWiiSave(const std::string& filename);
@ -18,8 +18,8 @@ public:
void static ExportAllSaves(); void static ExportAllSaves();
private: private:
CWiiSaveCrypted(const std::string& filename, u64 title_id = 0); WiiSave(const std::string& filename, u64 title_id = 0);
~CWiiSaveCrypted(); ~WiiSave();
void ReadHDR(); void ReadHDR();
void ReadBKHDR(); void ReadBKHDR();
void WriteHDR(); void WriteHDR();

View File

@ -20,7 +20,7 @@
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/HW/DVD/DVDInterface.h" #include "Core/HW/DVD/DVDInterface.h"
#include "Core/HW/WiiSaveCrypted.h" #include "Core/HW/WiiSave.h"
#include "Core/WiiUtils.h" #include "Core/WiiUtils.h"
#include "DiscIO/Blob.h" #include "DiscIO/Blob.h"
#include "DiscIO/Enums.h" #include "DiscIO/Enums.h"
@ -260,7 +260,7 @@ void GameList::ExportWiiSave()
{ {
QMessageBox result_dialog(this); QMessageBox result_dialog(this);
const bool success = CWiiSaveCrypted::ExportWiiSave(GetSelectedGame()->GetTitleID()); const bool success = WiiSave::ExportWiiSave(GetSelectedGame()->GetTitleID());
result_dialog.setIcon(success ? QMessageBox::Information : QMessageBox::Critical); result_dialog.setIcon(success ? QMessageBox::Information : QMessageBox::Critical);
result_dialog.setText(success ? tr("Successfully exported save files") : result_dialog.setText(success ? tr("Successfully exported save files") :

View File

@ -26,7 +26,7 @@
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/Debugger/RSO.h" #include "Core/Debugger/RSO.h"
#include "Core/HLE/HLE.h" #include "Core/HLE/HLE.h"
#include "Core/HW/WiiSaveCrypted.h" #include "Core/HW/WiiSave.h"
#include "Core/HW/Wiimote.h" #include "Core/HW/Wiimote.h"
#include "Core/Host.h" #include "Core/Host.h"
#include "Core/IOS/ES/ES.h" #include "Core/IOS/ES/ES.h"
@ -897,12 +897,12 @@ void MenuBar::ImportWiiSave()
"All Files (*)")); "All Files (*)"));
if (!file.isEmpty()) if (!file.isEmpty())
CWiiSaveCrypted::ImportWiiSave(file.toStdString()); WiiSave::ImportWiiSave(file.toStdString());
} }
void MenuBar::ExportWiiSaves() void MenuBar::ExportWiiSaves()
{ {
CWiiSaveCrypted::ExportAllSaves(); WiiSave::ExportAllSaves();
} }
void MenuBar::CheckNAND() void MenuBar::CheckNAND()

View File

@ -45,7 +45,7 @@
#include "Core/HW/GCPad.h" #include "Core/HW/GCPad.h"
#include "Core/HW/ProcessorInterface.h" #include "Core/HW/ProcessorInterface.h"
#include "Core/HW/SI/SI_Device.h" #include "Core/HW/SI/SI_Device.h"
#include "Core/HW/WiiSaveCrypted.h" #include "Core/HW/WiiSave.h"
#include "Core/HW/Wiimote.h" #include "Core/HW/Wiimote.h"
#include "Core/Host.h" #include "Core/Host.h"
#include "Core/HotkeyManager.h" #include "Core/HotkeyManager.h"
@ -1204,7 +1204,7 @@ void CFrame::OnLoadGameCubeIPLEUR(wxCommandEvent&)
void CFrame::OnExportAllSaves(wxCommandEvent& WXUNUSED(event)) void CFrame::OnExportAllSaves(wxCommandEvent& WXUNUSED(event))
{ {
CWiiSaveCrypted::ExportAllSaves(); WiiSave::ExportAllSaves();
} }
void CFrame::OnImportSave(wxCommandEvent& WXUNUSED(event)) void CFrame::OnImportSave(wxCommandEvent& WXUNUSED(event))
@ -1215,7 +1215,7 @@ void CFrame::OnImportSave(wxCommandEvent& WXUNUSED(event))
wxFD_OPEN | wxFD_PREVIEW | wxFD_FILE_MUST_EXIST, this); wxFD_OPEN | wxFD_PREVIEW | wxFD_FILE_MUST_EXIST, this);
if (!path.IsEmpty()) if (!path.IsEmpty())
CWiiSaveCrypted::ImportWiiSave(WxStrToStr(path)); WiiSave::ImportWiiSave(WxStrToStr(path));
} }
void CFrame::OnShowCheatsWindow(wxCommandEvent& WXUNUSED(event)) void CFrame::OnShowCheatsWindow(wxCommandEvent& WXUNUSED(event))

View File

@ -45,7 +45,7 @@
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/HW/DVD/DVDInterface.h" #include "Core/HW/DVD/DVDInterface.h"
#include "Core/HW/WiiSaveCrypted.h" #include "Core/HW/WiiSave.h"
#include "Core/Movie.h" #include "Core/Movie.h"
#include "Core/SysConf.h" #include "Core/SysConf.h"
#include "Core/TitleDatabase.h" #include "Core/TitleDatabase.h"
@ -988,7 +988,7 @@ void GameListCtrl::OnExportSave(wxCommandEvent& WXUNUSED(event))
{ {
const UICommon::GameFile* iso = GetSelectedISO(); const UICommon::GameFile* iso = GetSelectedISO();
if (iso) if (iso)
CWiiSaveCrypted::ExportWiiSave(iso->GetTitleID()); WiiSave::ExportWiiSave(iso->GetTitleID());
} }
// Save this file as the default file // Save this file as the default file