From 703cb0bdb8c658b8524cc269d7bf0740623dc7c6 Mon Sep 17 00:00:00 2001 From: LPFaint99 Date: Sun, 17 Jan 2010 03:25:42 +0000 Subject: [PATCH] Fix for importing / exporting more than one save per launch SD_IV should not be global, thanks to interdpth as I was only testing with one save before remove duplicated code from BannerLoaderWii.cpp git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4863 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DiscIO/Src/BannerLoaderWii.cpp | 5 +---- Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.cpp | 7 +++---- Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.h | 1 + 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Source/Core/DiscIO/Src/BannerLoaderWii.cpp b/Source/Core/DiscIO/Src/BannerLoaderWii.cpp index c495fbff60..9108d5fcd2 100644 --- a/Source/Core/DiscIO/Src/BannerLoaderWii.cpp +++ b/Source/Core/DiscIO/Src/BannerLoaderWii.cpp @@ -36,10 +36,7 @@ CBannerLoaderWii::CBannerLoaderWii(DiscIO::IVolume *pVolume) char Filename[260]; u64 TitleID; - if (DiscIO::IsVolumeWadFile(pVolume)) - pVolume->GetTitleID((u8*)&TitleID); - else - pVolume->RAWRead((u64)0x0F8001DC, 8, (u8*)&TitleID); + pVolume->GetTitleID((u8*)&TitleID); TitleID = Common::swap64(TitleID); diff --git a/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.cpp b/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.cpp index 4383749638..d69da04684 100644 --- a/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.cpp +++ b/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.cpp @@ -24,17 +24,17 @@ #include "FileUtil.h" #include "MathUtil.h" -u8 SD_IV[0x10] = {0x21, 0x67, 0x12, 0xE6, 0xAA, 0x1F, 0x68, 0x9F, - 0x95, 0xC5, 0xA2, 0x23, 0x24, 0xDC, 0x6A, 0x98}; const u8 SDKey[16] = {0xAB, 0x01, 0xB9, 0xD8, 0xE1, 0x62, 0x2B, 0x08, 0xAF, 0xBA, 0xD8, 0x4D, 0xBF, 0xC2, 0xA5, 0x5D}; -u8 MD5_BLANKER[0x10] = {0x0E, 0x65, 0x37, 0x81, 0x99, 0xBE, 0x45, 0x17, +const u8 MD5_BLANKER[0x10] = {0x0E, 0x65, 0x37, 0x81, 0x99, 0xBE, 0x45, 0x17, 0xAB, 0x06, 0xEC, 0x22, 0x45, 0x1A, 0x57, 0x93}; CWiiSaveCrypted::CWiiSaveCrypted(const char* FileName, u64 title) : _saveGameTitle(title) { strcpy(pathData_bin, FileName); + memcpy(SD_IV, "\x21\x67\x12\xE6\xAA\x1F\x68\x9F\x95\xC5\xA2\x23\x24\xDC\x6A\x98", 0x10); + if (!title) { AES_set_decrypt_key(SDKey, 128, &m_AES_KEY); @@ -96,7 +96,6 @@ void CWiiSaveCrypted::ReadHDR() } fclose(fpData_bin); - AES_cbc_encrypt((const u8*)&_encryptedHeader, (u8*)&_header, HEADER_SZ, &m_AES_KEY, SD_IV, AES_DECRYPT); _bannerSize = Common::swap32(_header.hdr.BannerSize); if ((_bannerSize < FULL_BNR_MIN) || (_bannerSize > FULL_BNR_MAX) || diff --git a/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.h b/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.h index 2daffc23dc..977527d13e 100644 --- a/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.h +++ b/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.h @@ -47,6 +47,7 @@ public: private: AES_KEY m_AES_KEY; + u8 SD_IV[0x10]; std::vector FilesList; FILE *fpData_bin,