From c81e7a9c17b68a9abcd491a8420e4c9d6c5b8744 Mon Sep 17 00:00:00 2001 From: "giantpune@gmail.com" Date: Sat, 15 Jan 2011 22:45:32 +0000 Subject: [PATCH] * fix wad class for dealing with backwards-ass cIOS wads --- WiiQt/wad.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/WiiQt/wad.cpp b/WiiQt/wad.cpp index 96f6500..6b1babe 100644 --- a/WiiQt/wad.cpp +++ b/WiiQt/wad.cpp @@ -121,7 +121,7 @@ Wad::Wad( const QByteArray &stuff ) //is using the AES that would change the key on us AesSetKey( ticket.DecryptedKey() ); - QByteArray decData = AesDecrypt( i, encData ); + QByteArray decData = AesDecrypt( t.BootIndex( i ), encData ); decData.resize( t.Size( i ) ); QByteArray realHash = GetSha1( decData ); if( realHash != t.Hash( i ) ) @@ -171,7 +171,7 @@ Wad::Wad( const QList< QByteArray > &stuff, bool encrypted ) QByteArray decDataPadded = PaddedByteArray( stuff.at( i + 2 ), 0x40 ); //doing this here in case there is some other object that is using the AES that would change the key on us AesSetKey( ticket.DecryptedKey() ); - encData = AesEncrypt( i, decDataPadded ); + encData = AesEncrypt( t.BootIndex( i ), decDataPadded ); } partsEnc << encData; } @@ -233,7 +233,7 @@ Wad::Wad( QDir dir ) } AesSetKey( ticket.DecryptedKey() ); appD = PaddedByteArray( appD, 0x40 ); - QByteArray encData = AesEncrypt( i, appD ); + QByteArray encData = AesEncrypt( t.BootIndex( i ), appD ); partsEnc << encData; } //if something in the tmd changed, fakesign it @@ -311,7 +311,7 @@ const QByteArray Wad::Content( quint16 i ) AesSetKey( ticket.DecryptedKey() ); - QByteArray decData = AesDecrypt( i, encData ); + QByteArray decData = AesDecrypt( t.BootIndex( i ), encData ); decData.resize( t.Size( i ) ); QByteArray realHash = GetSha1( decData ); if( realHash != t.Hash( i ) ) @@ -809,7 +809,7 @@ bool Wad::ReplaceContent( quint16 idx, const QByteArray &ba ) AesSetKey( ti.DecryptedKey() ); QByteArray decDataPadded = PaddedByteArray( ba, 0x40 ); - QByteArray encData = AesEncrypt( idx, decDataPadded ); + QByteArray encData = AesEncrypt( t.BootIndex( idx ), decDataPadded ); partsEnc.replace( idx, encData ); return true;