From 00bc1f28f2f644abac649221c6530501206f91f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Sat, 12 May 2018 22:39:14 +0200 Subject: [PATCH] Rename CWiiSaveCrypted to WiiSave --- Source/Core/Core/CMakeLists.txt | 2 +- Source/Core/Core/Core.vcxproj | 4 +- Source/Core/Core/Core.vcxproj.filters | 6 +-- .../HW/{WiiSaveCrypted.cpp => WiiSave.cpp} | 53 +++++++++---------- .../Core/HW/{WiiSaveCrypted.h => WiiSave.h} | 6 +-- Source/Core/DolphinQt2/GameList/GameList.cpp | 4 +- Source/Core/DolphinQt2/MenuBar.cpp | 6 +-- Source/Core/DolphinWX/FrameTools.cpp | 6 +-- Source/Core/DolphinWX/GameListCtrl.cpp | 4 +- 9 files changed, 45 insertions(+), 46 deletions(-) rename Source/Core/Core/HW/{WiiSaveCrypted.cpp => WiiSave.cpp} (92%) rename Source/Core/Core/HW/{WiiSaveCrypted.h => WiiSave.h} (96%) diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt index 26ab98f803..9b1094dd48 100644 --- a/Source/Core/Core/CMakeLists.txt +++ b/Source/Core/Core/CMakeLists.txt @@ -150,7 +150,7 @@ add_library(core HW/WiimoteEmu/Encryption.cpp HW/WiimoteEmu/Speaker.cpp HW/WiimoteReal/WiimoteReal.cpp - HW/WiiSaveCrypted.cpp + HW/WiiSave.cpp IOS/Device.cpp IOS/DeviceStub.cpp IOS/IOS.cpp diff --git a/Source/Core/Core/Core.vcxproj b/Source/Core/Core/Core.vcxproj index 3a1aeee2ea..ad815d88a4 100644 --- a/Source/Core/Core/Core.vcxproj +++ b/Source/Core/Core/Core.vcxproj @@ -179,7 +179,7 @@ - + @@ -437,7 +437,7 @@ - + diff --git a/Source/Core/Core/Core.vcxproj.filters b/Source/Core/Core/Core.vcxproj.filters index 25a151d371..a16e67b8e1 100644 --- a/Source/Core/Core/Core.vcxproj.filters +++ b/Source/Core/Core/Core.vcxproj.filters @@ -561,7 +561,7 @@ HW %28Flipper/Hollywood%29 - + HW %28Flipper/Hollywood%29 @@ -1242,7 +1242,7 @@ HW %28Flipper/Hollywood%29 - + HW %28Flipper/Hollywood%29 @@ -1578,4 +1578,4 @@ - \ No newline at end of file + diff --git a/Source/Core/Core/HW/WiiSaveCrypted.cpp b/Source/Core/Core/HW/WiiSave.cpp similarity index 92% rename from Source/Core/Core/HW/WiiSaveCrypted.cpp rename to Source/Core/Core/HW/WiiSave.cpp index 28c9150b34..5802c0faa4 100644 --- a/Source/Core/Core/HW/WiiSaveCrypted.cpp +++ b/Source/Core/Core/HW/WiiSave.cpp @@ -7,7 +7,7 @@ // Licensed under the terms of the GNU GPL, version 2 // http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt -#include "Core/HW/WiiSaveCrypted.h" +#include "Core/HW/WiiSave.h" #include #include @@ -31,21 +31,21 @@ #include "Common/StringUtil.h" #include "Common/Swap.h" -const u8 CWiiSaveCrypted::s_sd_key[16] = {0xAB, 0x01, 0xB9, 0xD8, 0xE1, 0x62, 0x2B, 0x08, - 0xAF, 0xBA, 0xD8, 0x4D, 0xBF, 0xC2, 0xA5, 0x5D}; -const u8 CWiiSaveCrypted::s_md5_blanker[16] = {0x0E, 0x65, 0x37, 0x81, 0x99, 0xBE, 0x45, 0x17, - 0xAB, 0x06, 0xEC, 0x22, 0x45, 0x1A, 0x57, 0x93}; -const u32 CWiiSaveCrypted::s_ng_id = 0x0403AC68; +const u8 WiiSave::s_sd_key[16] = {0xAB, 0x01, 0xB9, 0xD8, 0xE1, 0x62, 0x2B, 0x08, + 0xAF, 0xBA, 0xD8, 0x4D, 0xBF, 0xC2, 0xA5, 0x5D}; +const u8 WiiSave::s_md5_blanker[16] = {0x0E, 0x65, 0x37, 0x81, 0x99, 0xBE, 0x45, 0x17, + 0xAB, 0x06, 0xEC, 0x22, 0x45, 0x1A, 0x57, 0x93}; +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; } -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) { 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; } -void CWiiSaveCrypted::ExportAllSaves() +void WiiSave::ExportAllSaves() { std::string title_folder = File::GetUserPath(D_WIIROOT_IDX) + "/title"; std::vector titles; @@ -89,7 +89,7 @@ void CWiiSaveCrypted::ExportAllSaves() u32 success = 0; for (const u64& title : titles) { - CWiiSaveCrypted export_save{"", title}; + WiiSave export_save{"", title}; if (export_save.m_valid) success++; } @@ -97,7 +97,7 @@ void CWiiSaveCrypted::ExportAllSaves() (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) { 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"); if (!data_file) @@ -197,7 +197,7 @@ void CWiiSaveCrypted::ReadHDR() } } -void CWiiSaveCrypted::WriteHDR() +void WiiSave::WriteHDR() { if (!m_valid) return; @@ -236,7 +236,7 @@ void CWiiSaveCrypted::WriteHDR() } } -void CWiiSaveCrypted::ReadBKHDR() +void WiiSave::ReadBKHDR() { if (!m_valid) return; @@ -282,7 +282,7 @@ void CWiiSaveCrypted::ReadBKHDR() } } -void CWiiSaveCrypted::WriteBKHDR() +void WiiSave::WriteBKHDR() { if (!m_valid) return; @@ -307,7 +307,7 @@ void CWiiSaveCrypted::WriteBKHDR() } } -void CWiiSaveCrypted::ImportWiiSaveFiles() +void WiiSave::ImportWiiSaveFiles() { if (!m_valid) return; @@ -391,7 +391,7 @@ void CWiiSaveCrypted::ImportWiiSaveFiles() } } -void CWiiSaveCrypted::ExportWiiSaveFiles() +void WiiSave::ExportWiiSaveFiles() { if (!m_valid) return; @@ -471,7 +471,7 @@ void CWiiSaveCrypted::ExportWiiSaveFiles() } } -void CWiiSaveCrypted::do_sig() +void WiiSave::do_sig() { if (!m_valid) return; @@ -550,8 +550,8 @@ void CWiiSaveCrypted::do_sig() m_valid = data_file.IsGood(); } -void CWiiSaveCrypted::make_ec_cert(u8* cert, const u8* sig, const char* signer, const char* name, - const u8* priv, const u32 key_id) +void WiiSave::make_ec_cert(u8* cert, const u8* sig, const char* signer, const char* name, + const u8* priv, const u32 key_id) { memset(cert, 0, 0x180); *(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); } -bool CWiiSaveCrypted::getPaths(bool for_export) +bool WiiSave::getPaths(bool for_export) { if (m_title_id) { @@ -606,9 +606,8 @@ bool CWiiSaveCrypted::getPaths(bool for_export) return true; } -void CWiiSaveCrypted::ScanForFiles(const std::string& save_directory, - std::vector& file_list, u32* num_files, - u32* size_files) +void WiiSave::ScanForFiles(const std::string& save_directory, std::vector& file_list, + u32* num_files, u32* size_files) { std::vector directories; directories.push_back(save_directory); @@ -653,6 +652,6 @@ void CWiiSaveCrypted::ScanForFiles(const std::string& save_directory, *size_files = size; } -CWiiSaveCrypted::~CWiiSaveCrypted() +WiiSave::~WiiSave() { } diff --git a/Source/Core/Core/HW/WiiSaveCrypted.h b/Source/Core/Core/HW/WiiSave.h similarity index 96% rename from Source/Core/Core/HW/WiiSaveCrypted.h rename to Source/Core/Core/HW/WiiSave.h index bd4f74838c..725179c330 100644 --- a/Source/Core/Core/HW/WiiSaveCrypted.h +++ b/Source/Core/Core/HW/WiiSave.h @@ -10,7 +10,7 @@ #include "Common/CommonTypes.h" -class CWiiSaveCrypted +class WiiSave { public: bool static ImportWiiSave(const std::string& filename); @@ -18,8 +18,8 @@ public: void static ExportAllSaves(); private: - CWiiSaveCrypted(const std::string& filename, u64 title_id = 0); - ~CWiiSaveCrypted(); + WiiSave(const std::string& filename, u64 title_id = 0); + ~WiiSave(); void ReadHDR(); void ReadBKHDR(); void WriteHDR(); diff --git a/Source/Core/DolphinQt2/GameList/GameList.cpp b/Source/Core/DolphinQt2/GameList/GameList.cpp index 76aef93609..05d0421561 100644 --- a/Source/Core/DolphinQt2/GameList/GameList.cpp +++ b/Source/Core/DolphinQt2/GameList/GameList.cpp @@ -20,7 +20,7 @@ #include "Core/ConfigManager.h" #include "Core/Core.h" #include "Core/HW/DVD/DVDInterface.h" -#include "Core/HW/WiiSaveCrypted.h" +#include "Core/HW/WiiSave.h" #include "Core/WiiUtils.h" #include "DiscIO/Blob.h" #include "DiscIO/Enums.h" @@ -260,7 +260,7 @@ void GameList::ExportWiiSave() { 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.setText(success ? tr("Successfully exported save files") : diff --git a/Source/Core/DolphinQt2/MenuBar.cpp b/Source/Core/DolphinQt2/MenuBar.cpp index 7d4e46ceba..d9fb7a26c3 100644 --- a/Source/Core/DolphinQt2/MenuBar.cpp +++ b/Source/Core/DolphinQt2/MenuBar.cpp @@ -26,7 +26,7 @@ #include "Core/Core.h" #include "Core/Debugger/RSO.h" #include "Core/HLE/HLE.h" -#include "Core/HW/WiiSaveCrypted.h" +#include "Core/HW/WiiSave.h" #include "Core/HW/Wiimote.h" #include "Core/Host.h" #include "Core/IOS/ES/ES.h" @@ -897,12 +897,12 @@ void MenuBar::ImportWiiSave() "All Files (*)")); if (!file.isEmpty()) - CWiiSaveCrypted::ImportWiiSave(file.toStdString()); + WiiSave::ImportWiiSave(file.toStdString()); } void MenuBar::ExportWiiSaves() { - CWiiSaveCrypted::ExportAllSaves(); + WiiSave::ExportAllSaves(); } void MenuBar::CheckNAND() diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index d123d3ccca..ca14265e9d 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -45,7 +45,7 @@ #include "Core/HW/GCPad.h" #include "Core/HW/ProcessorInterface.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/Host.h" #include "Core/HotkeyManager.h" @@ -1204,7 +1204,7 @@ void CFrame::OnLoadGameCubeIPLEUR(wxCommandEvent&) void CFrame::OnExportAllSaves(wxCommandEvent& WXUNUSED(event)) { - CWiiSaveCrypted::ExportAllSaves(); + WiiSave::ExportAllSaves(); } 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); if (!path.IsEmpty()) - CWiiSaveCrypted::ImportWiiSave(WxStrToStr(path)); + WiiSave::ImportWiiSave(WxStrToStr(path)); } void CFrame::OnShowCheatsWindow(wxCommandEvent& WXUNUSED(event)) diff --git a/Source/Core/DolphinWX/GameListCtrl.cpp b/Source/Core/DolphinWX/GameListCtrl.cpp index 30c973eb42..3fd57d8dd9 100644 --- a/Source/Core/DolphinWX/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/GameListCtrl.cpp @@ -45,7 +45,7 @@ #include "Core/ConfigManager.h" #include "Core/Core.h" #include "Core/HW/DVD/DVDInterface.h" -#include "Core/HW/WiiSaveCrypted.h" +#include "Core/HW/WiiSave.h" #include "Core/Movie.h" #include "Core/SysConf.h" #include "Core/TitleDatabase.h" @@ -988,7 +988,7 @@ void GameListCtrl::OnExportSave(wxCommandEvent& WXUNUSED(event)) { const UICommon::GameFile* iso = GetSelectedISO(); if (iso) - CWiiSaveCrypted::ExportWiiSave(iso->GetTitleID()); + WiiSave::ExportWiiSave(iso->GetTitleID()); } // Save this file as the default file