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
This commit is contained in:
parent
b61b04352e
commit
703cb0bdb8
|
@ -36,10 +36,7 @@ CBannerLoaderWii::CBannerLoaderWii(DiscIO::IVolume *pVolume)
|
||||||
char Filename[260];
|
char Filename[260];
|
||||||
u64 TitleID;
|
u64 TitleID;
|
||||||
|
|
||||||
if (DiscIO::IsVolumeWadFile(pVolume))
|
|
||||||
pVolume->GetTitleID((u8*)&TitleID);
|
pVolume->GetTitleID((u8*)&TitleID);
|
||||||
else
|
|
||||||
pVolume->RAWRead((u64)0x0F8001DC, 8, (u8*)&TitleID);
|
|
||||||
|
|
||||||
TitleID = Common::swap64(TitleID);
|
TitleID = Common::swap64(TitleID);
|
||||||
|
|
||||||
|
|
|
@ -24,17 +24,17 @@
|
||||||
#include "FileUtil.h"
|
#include "FileUtil.h"
|
||||||
#include "MathUtil.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,
|
const u8 SDKey[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};
|
||||||
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};
|
0xAB, 0x06, 0xEC, 0x22, 0x45, 0x1A, 0x57, 0x93};
|
||||||
|
|
||||||
CWiiSaveCrypted::CWiiSaveCrypted(const char* FileName, u64 title)
|
CWiiSaveCrypted::CWiiSaveCrypted(const char* FileName, u64 title)
|
||||||
: _saveGameTitle(title)
|
: _saveGameTitle(title)
|
||||||
{
|
{
|
||||||
strcpy(pathData_bin, FileName);
|
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)
|
if (!title)
|
||||||
{
|
{
|
||||||
AES_set_decrypt_key(SDKey, 128, &m_AES_KEY);
|
AES_set_decrypt_key(SDKey, 128, &m_AES_KEY);
|
||||||
|
@ -96,7 +96,6 @@ void CWiiSaveCrypted::ReadHDR()
|
||||||
}
|
}
|
||||||
fclose(fpData_bin);
|
fclose(fpData_bin);
|
||||||
|
|
||||||
|
|
||||||
AES_cbc_encrypt((const u8*)&_encryptedHeader, (u8*)&_header, HEADER_SZ, &m_AES_KEY, SD_IV, AES_DECRYPT);
|
AES_cbc_encrypt((const u8*)&_encryptedHeader, (u8*)&_header, HEADER_SZ, &m_AES_KEY, SD_IV, AES_DECRYPT);
|
||||||
_bannerSize = Common::swap32(_header.hdr.BannerSize);
|
_bannerSize = Common::swap32(_header.hdr.BannerSize);
|
||||||
if ((_bannerSize < FULL_BNR_MIN) || (_bannerSize > FULL_BNR_MAX) ||
|
if ((_bannerSize < FULL_BNR_MIN) || (_bannerSize > FULL_BNR_MAX) ||
|
||||||
|
|
|
@ -47,6 +47,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AES_KEY m_AES_KEY;
|
AES_KEY m_AES_KEY;
|
||||||
|
u8 SD_IV[0x10];
|
||||||
std::vector<std::string> FilesList;
|
std::vector<std::string> FilesList;
|
||||||
|
|
||||||
FILE *fpData_bin,
|
FILE *fpData_bin,
|
||||||
|
|
Loading…
Reference in New Issue