Port nandBinCheck to QT 6

This commit is contained in:
martravi 2024-07-20 13:36:42 +02:00
parent d3547bc68e
commit 8ba1e092fd
15 changed files with 121 additions and 121 deletions

View File

@ -33,11 +33,11 @@ QByteArray DecryptAsh( const QByteArray ba )
r[5] = r[5] & 0x00FFFFFF; r[5] = r[5] & 0x00FFFFFF;
quint32 size = r[5]; quint32 size = r[5];
//qDebug() << "Decompressed size:" << hex << size; //qDebug() << "Decompressed size:" << Qt::hex << size;
if( size > BUFFER_SIZE ) if( size > BUFFER_SIZE )
{ {
qWarning() << "DecryptAsh(): this file was built with a buffer to small to deal with this archive. Build it with a bigger one and try again." qWarning() << "DecryptAsh(): this file was built with a buffer to small to deal with this archive. Build it with a bigger one and try again."
<< hex << size << ">" << BUFFER_SIZE; << Qt::hex << size << ">" << BUFFER_SIZE;
return QByteArray(); return QByteArray();
} }

View File

@ -5,7 +5,7 @@ KeysBin::KeysBin( QByteArray stuff )
data = stuff; data = stuff;
if( data.size() && data.size() != 0x400 ) if( data.size() && data.size() != 0x400 )
{ {
qWarning() << "KeysBin::KeysBin -> bad size" << hex << data.size(); qWarning() << "KeysBin::KeysBin -> bad size" << Qt::hex << data.size();
} }
} }

View File

@ -644,7 +644,7 @@ QByteArray LZ77_11::Decompress( QByteArray stuff )
QByteArray decompressedData( decompressedSize, '\0' ); QByteArray decompressedData( decompressedSize, '\0' );
if( (quint32)decompressedData.size() != decompressedSize ) if( (quint32)decompressedData.size() != decompressedSize )
{ {
qWarning() << "LZ77_11::Decompress -> failed to allocate" << hex << decompressedSize << "bytes"; qWarning() << "LZ77_11::Decompress -> failed to allocate" << Qt::hex << decompressedSize << "bytes";
return QByteArray(); return QByteArray();
} }

View File

@ -182,7 +182,7 @@ bool NandDump::SaveData( const QByteArray &ba, const QString& path )
{ {
if( basePath.isEmpty() || !path.startsWith( "/" ) ) if( basePath.isEmpty() || !path.startsWith( "/" ) )
return false; return false;
qDebug() << "NandDump::SaveData" << path << hex << ba.size(); qDebug() << "NandDump::SaveData" << path << Qt::hex << ba.size();
return WriteFile( basePath + path, ba ); return WriteFile( basePath + path, ba );
} }
@ -201,14 +201,14 @@ bool NandDump::InstallTicket( const QByteArray &ba, quint64 tid )
Ticket t( ba ); Ticket t( ba );
if( t.Tid() != tid ) if( t.Tid() != tid )
{ {
qWarning() << "NandDump::InstallTicket -> bad tid" << hex << tid << t.Tid(); qWarning() << "NandDump::InstallTicket -> bad tid" << Qt::hex << tid << t.Tid();
return false; return false;
} }
//only write the first chunk of the ticket to the nand //only write the first chunk of the ticket to the nand
QByteArray start = ba.left( t.SignedSize() ); QByteArray start = ba.left( t.SignedSize() );
if( start.size() != 0x2a4 ) if( start.size() != 0x2a4 )
{ {
qWarning() << "NandDump::InstallTicket -> ticket size" << hex << start.size(); qWarning() << "NandDump::InstallTicket -> ticket size" << Qt::hex << start.size();
} }
QString p = QString( "%1" ).arg( tid, 16, 16, QChar( '0' ) ); QString p = QString( "%1" ).arg( tid, 16, 16, QChar( '0' ) );
p.insert( 8 ,"/" ); p.insert( 8 ,"/" );
@ -228,7 +228,7 @@ bool NandDump::InstallTmd( const QByteArray &ba, quint64 tid )
Tmd t( ba ); Tmd t( ba );
if( t.Tid() != tid ) if( t.Tid() != tid )
{ {
qWarning() << "NandDump::InstallTmd -> bad tid" << hex << tid << t.Tid(); qWarning() << "NandDump::InstallTmd -> bad tid" << Qt::hex << tid << t.Tid();
return false; return false;
} }
//only write the first chunk of the ticket to the nand //only write the first chunk of the ticket to the nand
@ -405,7 +405,7 @@ bool NandDump::InstallNusItem( const NusJob &job )
QByteArray realHash = GetSha1( decData ); QByteArray realHash = GetSha1( decData );
if( realHash != t.Hash( i ) ) if( realHash != t.Hash( i ) )
{ {
qWarning() << "NandDump::InstallNusItem -> hash doesnt match for content" << hex << i; qWarning() << "NandDump::InstallNusItem -> hash doesnt match for content" << Qt::hex << i;
hexdump( realHash ); hexdump( realHash );
hexdump( t.Hash( i ) ); hexdump( t.Hash( i ) );
AbortInstalling( job.tid ); AbortInstalling( job.tid );
@ -583,7 +583,7 @@ QMap< quint64, quint32 > NandDump::GetSaveList()
quint32 upper = fi.fileName().toInt( &ok, 16 ); quint32 upper = fi.fileName().toInt( &ok, 16 );
if( !ok ) if( !ok )
continue; continue;
//qDebug() << " upper" << hex << upper; //qDebug() << " upper" << Qt::hex << upper;
QDir sd( fi.absoluteFilePath() );//subDir QDir sd( fi.absoluteFilePath() );//subDir
QFileInfoList sfiL = sd.entryInfoList( QDir::Dirs | QDir::NoDotAndDotDot );//get all subfolders in this subfolder QFileInfoList sfiL = sd.entryInfoList( QDir::Dirs | QDir::NoDotAndDotDot );//get all subfolders in this subfolder

View File

@ -16,7 +16,7 @@ SaveBanner::SaveBanner( QByteArray stuff )
quint32 size = f.size(); quint32 size = f.size();
if( size < 0x72a0 || ( ( size - 0x60a0 ) % 0x1200 ) )//sanity check the size. must have enough data for the header, names, banner, and 1 icon image if( size < 0x72a0 || ( ( size - 0x60a0 ) % 0x1200 ) )//sanity check the size. must have enough data for the header, names, banner, and 1 icon image
{ {
qDebug() << "SaveBanner::SaveBanner -> bad filesize" << hex << size; qDebug() << "SaveBanner::SaveBanner -> bad filesize" << Qt::hex << size;
f.close(); f.close();
return; return;
} }
@ -26,7 +26,7 @@ SaveBanner::SaveBanner( QByteArray stuff )
{ {
hexdump( stuff, 0, 0x30 ); hexdump( stuff, 0, 0x30 );
f.close(); f.close();
qWarning() << "SaveBanner::SaveBanner -> bad file magic" << hex << qFromBigEndian( magic ); qWarning() << "SaveBanner::SaveBanner -> bad file magic" << Qt::hex << qFromBigEndian( magic );
return; return;
} }
@ -87,7 +87,7 @@ SaveBanner::SaveBanner( QByteArray stuff )
flags += "loop"; flags += "loop";
} }
flags = flags.leftJustified( 27, QChar( ' ' ) ); flags = flags.leftJustified( 27, QChar( ' ' ) );
qDebug() << hex << //QString( "%1" ).arg( tmp, 8, 16, QChar( '0' ) ) << qDebug() << Qt::hex << //QString( "%1" ).arg( tmp, 8, 16, QChar( '0' ) ) <<
//QString( "%1" ).arg( speeds, 4, 16, QChar( '0' ) ) << //QString( "%1" ).arg( speeds, 4, 16, QChar( '0' ) ) <<
speedStr << speedStr <<
flags << flags <<
@ -135,7 +135,7 @@ SaveBanner::SaveBanner( QByteArray stuff )
f.close(); f.close();
ok = true; ok = true;
//qDebug() << hex << QString( "%1 %2").arg( qFromBigEndian( tmp ), 9, 16).arg( qFromBigEndian( tmp2 ), 9, 16) //qDebug() << Qt::hex << QString( "%1 %2").arg( qFromBigEndian( tmp ), 9, 16).arg( qFromBigEndian( tmp2 ), 9, 16)
//<< saveTitle.leftJustified( 0x20 ) << QString( "icons: %1").arg( iconImgs.size(), 1, 16 ) << QString( "banner size: %1" ).arg( size, 4, 16 ); //<< saveTitle.leftJustified( 0x20 ) << QString( "icons: %1").arg( iconImgs.size(), 1, 16 ) << QString( "banner size: %1" ).arg( size, 4, 16 );
} }
@ -152,7 +152,7 @@ SaveBanner::SaveBanner( const QString &bannerPath )
quint32 size = f.size(); quint32 size = f.size();
if( size < 0x72a0 || ( ( size - 0x60a0 ) % 0x1200 ) )//sanity check the size. must have enough data for the header, names, banner, and 1 icon image if( size < 0x72a0 || ( ( size - 0x60a0 ) % 0x1200 ) )//sanity check the size. must have enough data for the header, names, banner, and 1 icon image
{ {
qDebug() << "SaveBanner::SaveBanner -> bad filesize" << hex << size; qDebug() << "SaveBanner::SaveBanner -> bad filesize" << Qt::hex << size;
f.close(); f.close();
return; return;
} }
@ -232,7 +232,7 @@ SaveBanner::SaveBanner( const QString &bannerPath )
QImage SaveBanner::ConvertTextureToImage( const QByteArray &ba, quint32 w, quint32 h ) QImage SaveBanner::ConvertTextureToImage( const QByteArray &ba, quint32 w, quint32 h )
{ {
//qDebug() << "SaveBanner::ConvertTextureToImage" << ba.size() << hex << w << h; //qDebug() << "SaveBanner::ConvertTextureToImage" << ba.size() << Qt::hex << w << h;
quint8* bitmapdata = NULL;//this will hold the converted image quint8* bitmapdata = NULL;//this will hold the converted image
int ret = ConvertRGB5A3ToBitMap( (quint8*)ba.constData(), &bitmapdata, w, h ); int ret = ConvertRGB5A3ToBitMap( (quint8*)ba.constData(), &bitmapdata, w, h );
if( !ret ) if( !ret )

View File

@ -4,7 +4,7 @@
SaveDataBin::SaveDataBin( QByteArray stuff ) SaveDataBin::SaveDataBin( QByteArray stuff )
{ {
// qDebug() << "SaveDataBin::SaveDataBin" << hex << stuff.size(); // qDebug() << "SaveDataBin::SaveDataBin" << Qt::hex << stuff.size();
_ok = false; _ok = false;
ngID = 0; ngID = 0;
ngKeyID = 0; ngKeyID = 0;
@ -43,7 +43,7 @@ SaveDataBin::SaveDataBin( QByteArray stuff )
ds >> bnrPerm; ds >> bnrPerm;
if( bnrSize < 0x72a0 || bnrSize > 0xf0a0 || ( bnrSize - 0x60a0 ) % 0x1200 ) if( bnrSize < 0x72a0 || bnrSize > 0xf0a0 || ( bnrSize - 0x60a0 ) % 0x1200 )
{ {
qWarning() << "SaveDataBin::SaveDataBin -> bad size" << hex << bnrSize; qWarning() << "SaveDataBin::SaveDataBin -> bad size" << Qt::hex << bnrSize;
return; return;
} }
//add the entry for banner.bin in the save struct //add the entry for banner.bin in the save struct
@ -67,7 +67,7 @@ SaveDataBin::SaveDataBin( QByteArray stuff )
tmp = qFromBigEndian( tmp ); tmp = qFromBigEndian( tmp );
if( tmp != 0x70 ) if( tmp != 0x70 )
{ {
qWarning() << "SaveDataBin::SaveDataBin -> bad hdr size" << hex << tmp; qWarning() << "SaveDataBin::SaveDataBin -> bad hdr size" << Qt::hex << tmp;
b.close(); b.close();
return; return;
} }
@ -75,13 +75,13 @@ SaveDataBin::SaveDataBin( QByteArray stuff )
tmp = qFromBigEndian( tmp ); tmp = qFromBigEndian( tmp );
if( tmp != 0x426b0001 ) if( tmp != 0x426b0001 )
{ {
qWarning() << "SaveDataBin::SaveDataBin -> bad magic" << hex << tmp; qWarning() << "SaveDataBin::SaveDataBin -> bad magic" << Qt::hex << tmp;
b.close(); b.close();
return; return;
} }
b.read( (char*)&tmp, 4 ); b.read( (char*)&tmp, 4 );
ngID = qFromBigEndian( tmp ); ngID = qFromBigEndian( tmp );
//qDebug() << "NG id:" << hex << ngID; //qDebug() << "NG id:" << Qt::hex << ngID;
b.read( (char*)&tmp, 4 ); b.read( (char*)&tmp, 4 );
cnt = qFromBigEndian( tmp ); cnt = qFromBigEndian( tmp );
b.read( (char*)&tmp, 4 ); b.read( (char*)&tmp, 4 );
@ -89,13 +89,13 @@ SaveDataBin::SaveDataBin( QByteArray stuff )
b.seek( b.pos() + 8 ); b.seek( b.pos() + 8 );
b.read( (char*)&tmp, 4 ); b.read( (char*)&tmp, 4 );
tSize = qFromBigEndian( tmp ); tSize = qFromBigEndian( tmp );
//qDebug() << "cnt :" << hex << cnt; //qDebug() << "cnt :" << Qt::hex << cnt;
//qDebug() << "fSize:" << hex << fSize; //qDebug() << "fSize:" << Qt::hex << fSize;
//qDebug() << "tSize:" << hex << tSize << stuff.size(); //qDebug() << "tSize:" << Qt::hex << tSize << stuff.size();
if( (quint32)stuff.size() < fSize + 0xf140 ) if( (quint32)stuff.size() < fSize + 0xf140 )
{ {
qWarning() << "SaveDataBin::SaveDataBin -> buffer size is less than expected" << hex << fSize; qWarning() << "SaveDataBin::SaveDataBin -> buffer size is less than expected" << Qt::hex << fSize;
b.close(); b.close();
return; return;
} }
@ -119,7 +119,7 @@ SaveDataBin::SaveDataBin( QByteArray stuff )
tmp = qFromBigEndian( tmp ); tmp = qFromBigEndian( tmp );
if( tmp != 0x03adf17e ) if( tmp != 0x03adf17e )
{ {
qWarning() << "SaveDataBin::SaveDataBin -> bad file magic" << hex << i << tmp; qWarning() << "SaveDataBin::SaveDataBin -> bad file magic" << Qt::hex << i << tmp;
b.close(); b.close();
return; return;
} }
@ -132,7 +132,7 @@ SaveDataBin::SaveDataBin( QByteArray stuff )
name = b.read( 0x45 ); name = b.read( 0x45 );
b.read( (char*)&iv, 0x10 ); b.read( (char*)&iv, 0x10 );
/*qDebug() << "size:" << hex << size /*qDebug() << "size:" << Qt::hex << size
<< "perm:" << perm << "perm:" << perm
<< "attr:" << attr << "attr:" << attr
<< "type:" << type << "type:" << type
@ -140,7 +140,7 @@ SaveDataBin::SaveDataBin( QByteArray stuff )
<< "iv:" << QByteArray( (const char*)iv, 0x10 ).toHex();*/ << "iv:" << QByteArray( (const char*)iv, 0x10 ).toHex();*/
perm = ( perm << 2 ) | type; perm = ( perm << 2 ) | type;
//qDebug() << "perm2:" << hex << perm; //qDebug() << "perm2:" << Qt::hex << perm;
sg.entries << "/" + name; sg.entries << "/" + name;
sg.attr << perm; sg.attr << perm;
@ -157,14 +157,14 @@ SaveDataBin::SaveDataBin( QByteArray stuff )
sg.data << decData; sg.data << decData;
/*qDebug() << QString( name ); /*qDebug() << QString( name );
qDebug() << "size:" << hex << size; qDebug() << "size:" << Qt::hex << size;
hexdump( decData, 0, 0x30 );*/ hexdump( decData, 0, 0x30 );*/
} }
break; break;
case NAND_DIR: case NAND_DIR:
break; break;
default: default:
qWarning() << "SaveDataBin::SaveDataBin -> unknown type" << hex << i << type; qWarning() << "SaveDataBin::SaveDataBin -> unknown type" << Qt::hex << i << type;
return; return;
break; break;
} }
@ -175,18 +175,18 @@ SaveDataBin::SaveDataBin( QByteArray stuff )
//get a couple keys useful for repacking //get a couple keys useful for repacking
quint32 cStart = b.pos(); quint32 cStart = b.pos();
//qDebug() << "pos:" << hex << (quint32)b.pos(); //qDebug() << "pos:" << Qt::hex << (quint32)b.pos();
b.seek( b.pos() + 0x144 ); b.seek( b.pos() + 0x144 );
b.read( (char*)&tmp, 4 ); b.read( (char*)&tmp, 4 );
ngKeyID = qFromBigEndian( tmp ); ngKeyID = qFromBigEndian( tmp );
ngSig = stuff.mid( cStart + 0x44, 0x3c ); ngSig = stuff.mid( cStart + 0x44, 0x3c );
//qDebug() << "ngKeyID:" << hex << ngKeyID; //qDebug() << "ngKeyID:" << Qt::hex << ngKeyID;
//qDebug() << "ngSig :" << hex << ngSig.toHex(); //qDebug() << "ngSig :" << Qt::hex << ngSig.toHex();
//check the cert mumbojombo //check the cert mumbojombo
b.close(); b.close();
quint32 data_size = tSize - 0x340; quint32 data_size = tSize - 0x340;
//qDebug() << hex << data_size << tSize; //qDebug() << Qt::hex << data_size << tSize;
QByteArray sha1H = GetSha1( stuff.mid( 0xf0c0, data_size ) ); QByteArray sha1H = GetSha1( stuff.mid( 0xf0c0, data_size ) );
sha1H = GetSha1( sha1H ); sha1H = GetSha1( sha1H );
@ -233,7 +233,7 @@ const QByteArray SaveDataBin::Data( const QByteArray &ngPriv, const QByteArray &
<< "\n" << ng_Sig.toHex() << "\n" << ng_Sig.toHex()
<< "\n" << ng_Mac.toHex() << "\n" << ng_Mac.toHex()
<< "\n" << ngPriv.toHex() << "\n" << ngPriv.toHex()
<< "\n" << hex << ng_ID << "\n" << Qt::hex << ng_ID
<< "\n" << ng_Key_ID; << "\n" << ng_Key_ID;
return QByteArray(); return QByteArray();
} }
@ -473,7 +473,7 @@ const QByteArray SaveDataBin::GetBanner( const QByteArray &dataBin )
//checken der sizen //checken der sizen
if( bnrSize < 0x72a0 || bnrSize > 0xf0a0 || ( bnrSize - 0x60a0 ) % 0x1200 ) if( bnrSize < 0x72a0 || bnrSize > 0xf0a0 || ( bnrSize - 0x60a0 ) % 0x1200 )
{ {
qWarning() << "SaveDataBin::GetBanner -> bad size" << hex << bnrSize; qWarning() << "SaveDataBin::GetBanner -> bad size" << Qt::hex << bnrSize;
return QByteArray(); return QByteArray();
} }
return header.mid( 0x20, bnrSize ); return header.mid( 0x20, bnrSize );
@ -517,7 +517,7 @@ quint32 SaveDataBin::GetSize( QByteArray dataBin )
if( bnrSize < 0x72a0 || bnrSize > 0xf0a0 || ( bnrSize - 0x60a0 ) % 0x1200 ) if( bnrSize < 0x72a0 || bnrSize > 0xf0a0 || ( bnrSize - 0x60a0 ) % 0x1200 )
{ {
qWarning() << "SaveDataBin::GetSize -> bad size" << hex << bnrSize; qWarning() << "SaveDataBin::GetSize -> bad size" << Qt::hex << bnrSize;
return 0; return 0;
} }
buf.close(); buf.close();
@ -532,7 +532,7 @@ quint32 SaveDataBin::GetSize( QByteArray dataBin )
tmp = qFromBigEndian( tmp ); tmp = qFromBigEndian( tmp );
if( tmp != 0x70 ) if( tmp != 0x70 )
{ {
qWarning() << "SaveDataBin::GetSize -> bad hdr size" << hex << tmp; qWarning() << "SaveDataBin::GetSize -> bad hdr size" << Qt::hex << tmp;
buf.close(); buf.close();
return 0; return 0;
} }
@ -540,14 +540,14 @@ quint32 SaveDataBin::GetSize( QByteArray dataBin )
tmp = qFromBigEndian( tmp ); tmp = qFromBigEndian( tmp );
if( tmp != 0x426b0001 ) if( tmp != 0x426b0001 )
{ {
qWarning() << "SaveDataBin::GetSize -> bad magic" << hex << tmp; qWarning() << "SaveDataBin::GetSize -> bad magic" << Qt::hex << tmp;
buf.close(); buf.close();
return 0; return 0;
} }
buf.seek( 0xf0cc ); buf.seek( 0xf0cc );
buf.read( (char*)&tmp, 4 ); buf.read( (char*)&tmp, 4 );
cnt = qFromBigEndian( tmp ); cnt = qFromBigEndian( tmp );
//qDebug() << "cnt :" << hex << cnt; //qDebug() << "cnt :" << Qt::hex << cnt;
buf.seek( 0xf140 ); buf.seek( 0xf140 );
ret += bnrSize; ret += bnrSize;
for( quint32 i = 0; i < cnt; i++ ) for( quint32 i = 0; i < cnt; i++ )
@ -560,7 +560,7 @@ quint32 SaveDataBin::GetSize( QByteArray dataBin )
tmp = qFromBigEndian( tmp ); tmp = qFromBigEndian( tmp );
if( tmp != 0x03adf17e ) if( tmp != 0x03adf17e )
{ {
qWarning() << "SaveDataBin::GetSize -> bad file magic" << hex << i << tmp; qWarning() << "SaveDataBin::GetSize -> bad file magic" << Qt::hex << i << tmp;
break; break;
} }
buf.read( (char*)&tmp, 4 ); buf.read( (char*)&tmp, 4 );

View File

@ -163,10 +163,10 @@ bool U8::RenameEntry( const QString &path, const QString &newName )
else if( RU( nFstSize, U8_HEADER_ALIGNMENT ) > RU( fstSize, U8_HEADER_ALIGNMENT ) ) else if( RU( nFstSize, U8_HEADER_ALIGNMENT ) > RU( fstSize, U8_HEADER_ALIGNMENT ) )
dataAdjustment = RU( ( nFstSize - fstSize ), U8_HEADER_ALIGNMENT ); dataAdjustment = RU( ( nFstSize - fstSize ), U8_HEADER_ALIGNMENT );
qDebug() << "old size:" << hex << oldNameLen\ qDebug() << "old size:" << Qt::hex << oldNameLen\
<< "new size:" << hex << newNameLen\ << "new size:" << Qt::hex << newNameLen\
<< "difference:" << hex << difference << "difference:" << Qt::hex << difference
<< "dataAdjustment:" << hex << dataAdjustment; << "dataAdjustment:" << Qt::hex << dataAdjustment;
QByteArray nFstData( ( qFromBigEndian( fst[ 0 ].FileLength ) ) * 0xc, '\0' ); QByteArray nFstData( ( qFromBigEndian( fst[ 0 ].FileLength ) ) * 0xc, '\0' );
FEntry *nfst = (FEntry*)( nFstData.data() ); FEntry *nfst = (FEntry*)( nFstData.data() );
//make the new root entry //make the new root entry
@ -210,7 +210,7 @@ bool U8::RenameEntry( const QString &path, const QString &newName )
ne->FileOffset = qFromBigEndian( qFromBigEndian( e->FileOffset ) + dataAdjustment );// + qFromBigEndian( dataAdjustment ); ne->FileOffset = qFromBigEndian( qFromBigEndian( e->FileOffset ) + dataAdjustment );// + qFromBigEndian( dataAdjustment );
//qFromBigEndian( (quint32)( 0x20 + RU( U8_HEADER_ALIGNMENT, nFstSize ) + nPayload.size() ) ); //qFromBigEndian( (quint32)( 0x20 + RU( U8_HEADER_ALIGNMENT, nFstSize ) + nPayload.size() ) );
ne->FileLength = e->FileLength; ne->FileLength = e->FileLength;
qDebug() << "old offset" << hex << qFromBigEndian( e->FileOffset ) << "new offset" << hex << qFromBigEndian( e->FileOffset ) + dataAdjustment; qDebug() << "old offset" << Qt::hex << qFromBigEndian( e->FileOffset ) << "new offset" << Qt::hex << qFromBigEndian( e->FileOffset ) + dataAdjustment;
} }
} }
@ -313,9 +313,9 @@ bool U8::ReplaceEntry( const QString &path, const QByteArray &nba, bool autoComp
} }
/*qDebug() << "old size:" << hex << oldSizePadded\ /*qDebug() << "old size:" << Qt::hex << oldSizePadded\
<< "new size:" << hex << newSizePadded\ << "new size:" << Qt::hex << newSizePadded\
<< "difference:" << hex << difference;*/ << "difference:" << Qt::hex << difference;*/
QByteArray newData = nba; QByteArray newData = nba;
if( autoCompress ) if( autoCompress )
{ {
@ -363,7 +363,7 @@ bool U8::ReplaceEntry( const QString &path, const QByteArray &nba, bool autoComp
if( e->Type )//nothing changes for directories if( e->Type )//nothing changes for directories
continue; continue;
//qDebug() << "changed" << FstName( e ) << "offset from" << hex << qFromBigEndian( fst[ i ].FileOffset ) << "to" << qFromBigEndian( fst[ i ].FileOffset ) + difference; //qDebug() << "changed" << FstName( e ) << "offset from" << Qt::hex << qFromBigEndian( fst[ i ].FileOffset ) << "to" << qFromBigEndian( fst[ i ].FileOffset ) + difference;
e->FileOffset = qFromBigEndian( qFromBigEndian( fst[ i ].FileOffset ) + difference ); e->FileOffset = qFromBigEndian( qFromBigEndian( fst[ i ].FileOffset ) + difference );
} }
CreateEntryList(); CreateEntryList();
@ -482,7 +482,7 @@ bool U8::RemoveEntry( const QString &path )
quint8 adj = i < (quint32)entryToDelete ? 0 : numDeletedEntries; quint8 adj = i < (quint32)entryToDelete ? 0 : numDeletedEntries;
quint32 ni = i - adj; quint32 ni = i - adj;
//qDebug() << "keeping" << FstName( i ) << "in the new archive ( moved from" << hex << i << "to" << hex << ni << ")"; //qDebug() << "keeping" << FstName( i ) << "in the new archive ( moved from" << Qt::hex << i << "to" << Qt::hex << ni << ")";
//if( parents.contains( i ) ) //if( parents.contains( i ) )
//qDebug() << "\tthis is a parent of the deleted item"; //qDebug() << "\tthis is a parent of the deleted item";
@ -513,7 +513,7 @@ bool U8::RemoveEntry( const QString &path )
movedDirs << i; movedDirs << i;
//qDebug() << "e.parent:" << hex << qFromBigEndian( e->ParentOffset ) << "movedDirs:" << movedDirs; //qDebug() << "e.parent:" << Qt::hex << qFromBigEndian( e->ParentOffset ) << "movedDirs:" << movedDirs;
//hexdump( (const void*)ne, sizeof( FEntry) ); //hexdump( (const void*)ne, sizeof( FEntry) );
} }
} }
@ -529,7 +529,7 @@ bool U8::RemoveEntry( const QString &path )
{ {
nPayload.append( QByteArray( padding, '\0' ) ); nPayload.append( QByteArray( padding, '\0' ) );
} }
//qDebug() << "writing fileOffset of" << hex << ni << hex << (quint32)( 0x20 + RU( U8_HEADER_ALIGNMENT, nFstSize ) + nPayload.size() ); //qDebug() << "writing fileOffset of" << Qt::hex << ni << Qt::hex << (quint32)( 0x20 + RU( U8_HEADER_ALIGNMENT, nFstSize ) + nPayload.size() );
} }
//hexdump( (const void*)ne, sizeof( FEntry) ); //hexdump( (const void*)ne, sizeof( FEntry) );
@ -585,7 +585,7 @@ bool U8::RemoveEntry( const QString &path )
CreateEntryList(); CreateEntryList();
//hexdump( data ); //hexdump( data );
//qDebug() << "dataSize after removal:" << hex << data.size(); //qDebug() << "dataSize after removal:" << Qt::hex << data.size();
return true; return true;
@ -593,7 +593,7 @@ bool U8::RemoveEntry( const QString &path )
int U8::AddEntry( const QString &path, int type, const QByteArray &newData ) int U8::AddEntry( const QString &path, int type, const QByteArray &newData )
{ {
//qDebug() << "U8::AddEntry(" << path << "," << type << "," << hex << newData.size() << ")"; //qDebug() << "U8::AddEntry(" << path << "," << type << "," << Qt::hex << newData.size() << ")";
//make sure there is actually data to manipulate //make sure there is actually data to manipulate
if( !ok && !CreateEmptyData() ) if( !ok && !CreateEmptyData() )
{ {
@ -848,7 +848,7 @@ void U8::CreateEntryList()
NameOff = cnt * 0x0C; NameOff = cnt * 0x0C;
bool fixWarn = false;//ony print the warning 1 time bool fixWarn = false;//ony print the warning 1 time
//qDebug() << "cnt" << hex << cnt; //qDebug() << "cnt" << Qt::hex << cnt;
for( quint32 i = 1; i < cnt; ++i )//this is not the most effecient way to do things, but it seems to work ok and these archives are small enough that it happens fast anyways for( quint32 i = 1; i < cnt; ++i )//this is not the most effecient way to do things, but it seems to work ok and these archives are small enough that it happens fast anyways
{ {
//start at the beginning of the fst and enter every directory whos "nextoffset" is greater than this index, //start at the beginning of the fst and enter every directory whos "nextoffset" is greater than this index,
@ -872,7 +872,7 @@ void U8::CreateEntryList()
if( folder != qFromBigEndian( fst[ current ].ParentOffset ) ) if( folder != qFromBigEndian( fst[ current ].ParentOffset ) )
{ {
qWarning() << "U8::CreateEntryList -> error parsing the archive - recursion mismatch in" qWarning() << "U8::CreateEntryList -> error parsing the archive - recursion mismatch in"
<< path << "expected:" << hex << folder << "got:" << hex << qFromBigEndian( fst[ current ].ParentOffset )\ << path << "expected:" << Qt::hex << folder << "got:" << Qt::hex << qFromBigEndian( fst[ current ].ParentOffset )\
<< "(" << FstName( qFromBigEndian( fst[ current ].ParentOffset ) ) << ")"; << "(" << FstName( qFromBigEndian( fst[ current ].ParentOffset ) ) << ")";
//some tools use "recursion" instead of "parent offset". //some tools use "recursion" instead of "parent offset".
@ -938,7 +938,7 @@ void U8::CreateEntryList()
U8::U8( const QByteArray &ba ) U8::U8( const QByteArray &ba )
{ {
wii_cs_error = false; wii_cs_error = false;
//qDebug() << "U8::U8 dataSize:" << hex << ba.size(); //qDebug() << "U8::U8 dataSize:" << Qt::hex << ba.size();
Load( ba ); Load( ba );
} }
@ -953,7 +953,7 @@ void U8::Load( const QByteArray &ba )
imetNames.clear(); imetNames.clear();
/*if( ba.size() < 0x80 ) /*if( ba.size() < 0x80 )
{ {
//qWarning() << "U8::Load:" << hex << ba.size(); //qWarning() << "U8::Load:" << Qt::hex << ba.size();
//qWarning() << "U8::Load -> where is the rest of the data?"; //qWarning() << "U8::Load -> where is the rest of the data?";
return; return;
}*/ }*/
@ -1016,8 +1016,8 @@ void U8::Load( const QByteArray &ba )
rootnode_offset = qFromBigEndian( tmp ); rootnode_offset = qFromBigEndian( tmp );
if( rootnode_offset != 0x20 ) if( rootnode_offset != 0x20 )
{ {
qWarning() << "rootnodeOffset" << hex << rootnode_offset; qWarning() << "rootnodeOffset" << Qt::hex << rootnode_offset;
qWarning() << hex << data.size(); qWarning() << Qt::hex << data.size();
hexdump( data ); hexdump( data );
} }
@ -1064,9 +1064,9 @@ QString U8::FstName( quint32 i )
quint32 U8::NextEntryInFolder( quint32 current, quint32 directory ) quint32 U8::NextEntryInFolder( quint32 current, quint32 directory )
{ {
//qDebug() << "U8::NextEntryInFolder(" << hex << current << "," << hex << directory << ")"; //qDebug() << "U8::NextEntryInFolder(" << Qt::hex << current << "," << Qt::hex << directory << ")";
quint32 next = ( fst[ current ].Type ? qFromBigEndian( fst[ current ].FileLength ) : current + 1 ); quint32 next = ( fst[ current ].Type ? qFromBigEndian( fst[ current ].FileLength ) : current + 1 );
//qDebug() << "next" << next << "len" << hex << qFromBigEndian( fst[ directory ].FileLength ); //qDebug() << "next" << next << "len" << Qt::hex << qFromBigEndian( fst[ directory ].FileLength );
if( next < qFromBigEndian( fst[ directory ].FileLength ) ) if( next < qFromBigEndian( fst[ directory ].FileLength ) )
return next; return next;
@ -1269,7 +1269,7 @@ typedef struct
void U8::ReadHeader( const QByteArray &ba ) void U8::ReadHeader( const QByteArray &ba )
{ {
//qDebug() << "U8::ReadHeader(" << hex << ba.size() << ")"; //qDebug() << "U8::ReadHeader(" << Qt::hex << ba.size() << ")";
//hexdump( ba ); //hexdump( ba );
headerType = U8_Hdr_none; headerType = U8_Hdr_none;
imetNames.clear(); imetNames.clear();
@ -1288,7 +1288,7 @@ void U8::ReadHeader( const QByteArray &ba )
return; return;
} }
int off = start.indexOf( "IMET" ); int off = start.indexOf( "IMET" );
//qDebug() << "imet offset" << hex << off << "u8 offset" << hex << GetU8Offset( ba ); //qDebug() << "imet offset" << Qt::hex << off << "u8 offset" << Qt::hex << GetU8Offset( ba );
if( off == 0x40 || off == 0x80 )//read imet header if( off == 0x40 || off == 0x80 )//read imet header
{ {
if( off > GetU8Offset( ba ) )//in case somebody wants to put a IMET archive inside another U8 for whatever reason if( off > GetU8Offset( ba ) )//in case somebody wants to put a IMET archive inside another U8 for whatever reason

View File

@ -111,7 +111,7 @@ void PrintColoredString( const char *msg, int highlite )
else else
{ {
QString str( msg ); QString str( msg );
QStringList list = str.split( "\n", QString::SkipEmptyParts ); QStringList list = str.split( "\n", Qt::SkipEmptyParts );
foreach( const QString &s, list ) foreach( const QString &s, list )
{ {
QString m = s; QString m = s;
@ -418,7 +418,7 @@ QList< quint64 > InstalledTitles()
ret << tid; ret << tid;
} }
} }
qSort( ret.begin(), ret.end() ); std::sort( ret.begin(), ret.end() );
return ret; return ret;
} }
@ -826,9 +826,9 @@ bool CheckTitleIntegrity( quint64 tid )
quint16 vers = t.Version(); quint16 vers = t.Version();
qDebug() << "\tversion:" << qPrintable( QString( "%1.%2" ).arg( ( vers >> 8 ) & 0xff ).arg( vers & 0xff ).leftJustified( 10 ) ) qDebug() << "\tversion:" << qPrintable( QString( "%1.%2" ).arg( ( vers >> 8 ) & 0xff ).arg( vers & 0xff ).leftJustified( 10 ) )
<< qPrintable( QString( "%1" ).arg( vers ).leftJustified( 10 ) ) << qPrintable( QString( "%1" ).arg( vers ).leftJustified( 10 ) )
<< "hex:" << hex << t.Version(); << "hex:" << Qt::hex << t.Version();
if( t.AccessFlags() ) if( t.AccessFlags() )
qDebug() << "\taccess :" << hex << t.AccessFlags(); qDebug() << "\taccess :" << Qt::hex << t.AccessFlags();
} }
quint64 ios = t.IOS(); quint64 ios = t.IOS();
@ -1020,7 +1020,7 @@ void CheckLostClusters()
{ {
QList<quint16> u = nand.GetFatsForEntry( 0 );//all clusters actually used for a file QList<quint16> u = nand.GetFatsForEntry( 0 );//all clusters actually used for a file
if( verbose ) if( verbose )
qDebug() << "total used clusters" << hex << u.size() << "of 0x8000"; qDebug() << "total used clusters" << Qt::hex << u.size() << "of 0x8000";
quint16 lost = 0; quint16 lost = 0;
QList<quint16> ffs; QList<quint16> ffs;
QList<quint16> frs; QList<quint16> frs;
@ -1043,11 +1043,11 @@ void CheckLostClusters()
break; break;
default: default:
lost++; lost++;
//qDebug() << hex << i << fats.at( i ); //qDebug() << Qt::hex << i << fats.at( i );
break; break;
} }
} }
qDebug() << "found" << lost << "lost clusters\nUNK ( 0xffff )" << hex << ffs.size() << ffs << qDebug() << "found" << lost << "lost clusters\nUNK ( 0xffff )" << Qt::hex << ffs.size() << ffs <<
"\nfree " << frs.size(); "\nfree " << frs.size();
} }
@ -1193,7 +1193,7 @@ void CheckSettingTxt()
bool shownSetting = false; bool shownSetting = false;
QString str( settingTxt ); QString str( settingTxt );
str.replace( "\r\n", "\n" );//maybe not needed to do this in 2 steps, but there may be some reason the file only uses "\n", so do it this way to be safe str.replace( "\r\n", "\n" );//maybe not needed to do this in 2 steps, but there may be some reason the file only uses "\n", so do it this way to be safe
QStringList parts = str.split( "\n", QString::SkipEmptyParts ); QStringList parts = str.split( "\n", Qt::SkipEmptyParts );
foreach( const QString &part, parts ) foreach( const QString &part, parts )
{ {
if( part.startsWith( "AREA=" ) ) if( part.startsWith( "AREA=" ) )

View File

@ -493,7 +493,7 @@ void MainWindow::SaveJobToFolder( NusJob job )
if( job.decrypt ) if( job.decrypt )
{ {
appName += ".app"; appName += ".app";
//qDebug() << "resizing from" << hex << stuff.size() << "to" << (quint32)t.Size( i ); //qDebug() << "resizing from" << Qt::hex << stuff.size() << "to" << (quint32)t.Size( i );
//stuff.resize( t.Size( i ) ); //stuff.resize( t.Size( i ) );
} }
if( !WriteFile( d.absoluteFilePath( appName ), stuff ) ) if( !WriteFile( d.absoluteFilePath( appName ), stuff ) )

View File

@ -278,7 +278,7 @@ void CopyItemChildren( QTreeWidgetItem *item )
cnt = item->childCount(); cnt = item->childCount();
attr = Attr( item ); attr = Attr( item );
//qDebug() << "CopyItemChildren()" << item->text( 0 ) << hex << attr; //qDebug() << "CopyItemChildren()" << item->text( 0 ) << Qt::hex << attr;
for( quint32 i = 0; i < cnt; i++ ) for( quint32 i = 0; i < cnt; i++ )
{ {
QTreeWidgetItem *ch = item->child( i ); QTreeWidgetItem *ch = item->child( i );
@ -303,7 +303,7 @@ void CopyItemChildren( QTreeWidgetItem *item )
Fail( "error converting gid to u16" ); Fail( "error converting gid to u16" );
} }
//qDebug() << ch->text( 0 ) << hex << type << perm1 << perm2 << perm3 << uid << gid; //qDebug() << ch->text( 0 ) << Qt::hex << type << perm1 << perm2 << perm3 << uid << gid;
if( !testMode ) if( !testMode )
{ {

View File

@ -588,7 +588,7 @@ error:
//tools -> set ng keys //tools -> set ng keys
void MainWindow::on_actionSet_NG_Keys_triggered() void MainWindow::on_actionSet_NG_Keys_triggered()
{ {
qDebug() << hex << ngID; qDebug() << Qt::hex << ngID;
NgDialog d( this ); NgDialog d( this );
d.ngID = ngID; d.ngID = ngID;
@ -608,7 +608,7 @@ void MainWindow::on_actionSet_NG_Keys_triggered()
ngPriv = d.ngPriv; ngPriv = d.ngPriv;
ngSig = d.ngSig; ngSig = d.ngSig;
qDebug() << "accepted"; qDebug() << "accepted";
//qDebug() << hex << d.ngID //qDebug() << Qt::hex << d.ngID
// << "\n" << d.ngKeyID // << "\n" << d.ngKeyID
// << "\n" << d.ngMac.toHex() // << "\n" << d.ngMac.toHex()
// << "\n" << d.ngPriv.toHex() // << "\n" << d.ngPriv.toHex()

View File

@ -219,7 +219,7 @@ void SaveLoadThread::GetPCSaves()
continue; continue;
}*/ }*/
QByteArray unc = file.readAll(); QByteArray unc = file.readAll();
//qDebug() << "read" << hex << unc.size(); //qDebug() << "read" << Qt::hex << unc.size();
if( file.getZipError() != UNZ_OK ) if( file.getZipError() != UNZ_OK )
{ {
qWarning("SaveLoadThread::GetPCSaves(): file.getFileName(): %d", file.getZipError()); qWarning("SaveLoadThread::GetPCSaves(): file.getFileName(): %d", file.getZipError());

View File

@ -26,7 +26,7 @@ bool Dol::Parse( const QByteArray &dol )
WRN << "!dh"; WRN << "!dh";
return false; return false;
} }
//DBG << hex << (*(dh->entrypoint)); //DBG << Qt::hex << (*(dh->entrypoint));
for( quint32 i = 0; i < 7; i ++ ) for( quint32 i = 0; i < 7; i ++ )
{ {
@ -39,7 +39,7 @@ bool Dol::Parse( const QByteArray &dol )
} }
if( fileOff + len > (quint32) dol.size() ) if( fileOff + len > (quint32) dol.size() )
{ {
WRN << "text section is out of range:" << i << hex << fileOff << len; WRN << "text section is out of range:" << i << Qt::hex << fileOff << len;
continue; continue;
} }
DolSection sec; DolSection sec;
@ -60,7 +60,7 @@ bool Dol::Parse( const QByteArray &dol )
} }
if( fileOff + len > (quint32) dol.size() ) if( fileOff + len > (quint32) dol.size() )
{ {
WRN << "data section is out of range:" << i << hex << fileOff << len; WRN << "data section is out of range:" << i << Qt::hex << fileOff << len;
continue; continue;
} }
DolSection sec; DolSection sec;

View File

@ -121,7 +121,7 @@ bool ElfParser::ParseText( const QString &str )
//qDebug() << " " << fun.Name(); //qDebug() << " " << fun.Name();
foreach( const SymRef &ref, fun.References() ) foreach( const SymRef &ref, fun.References() )
{ {
//qDebug() << " " << hex << ref.off << ref.name; //qDebug() << " " << Qt::hex << ref.off << ref.name;
} }
}*/ }*/
/*foreach( const SymAlias &alias, f.Aliases() ) /*foreach( const SymAlias &alias, f.Aliases() )
@ -179,7 +179,7 @@ QList< SymAlias > ElfParser::ParseSymbolTable( const QStringList &lines )
continue; continue;
} }
ref.name = line.mid( tab + 10 ); ref.name = line.mid( tab + 10 );
//qDebug() << hex << QString( "%1" ).arg( ref.offset, 8, 16, QChar( QChar( '0' ) ) ) //qDebug() << Qt::hex << QString( "%1" ).arg( ref.offset, 8, 16, QChar( QChar( '0' ) ) )
// << ref.containerName // << ref.containerName
// << QString( "%1" ).arg( ref.size, 8, 16, QChar( QChar( '0' ) ) ) // << QString( "%1" ).arg( ref.size, 8, 16, QChar( QChar( '0' ) ) )
// << ref.name; // << ref.name;
@ -497,7 +497,7 @@ bool ElfParser::ParseOpLine( const QString &str, QString &hex, QString &oper )
if( tab < 0 || str.size() < tab + 15 || str.at( tab + 3 ) != ' ' || str.at( tab + 6 ) != ' ' || str.at( tab + 9 ) != ' ' || str.at( tab + 12 ) != ' ' ) if( tab < 0 || str.size() < tab + 15 || str.at( tab + 3 ) != ' ' || str.at( tab + 6 ) != ' ' || str.at( tab + 9 ) != ' ' || str.at( tab + 12 ) != ' ' )
{ {
qDebug() << str << "is not an opline"; qDebug() << str << "is not an opline";
qDebug() << hex << oper; qDebug() << Qt::hex << oper;
return false; return false;
} }
// " 0: 94 21 ff f0 stwu r1,-16(r1)" // " 0: 94 21 ff f0 stwu r1,-16(r1)"
@ -510,7 +510,7 @@ bool ElfParser::ParseOpLine( const QString &str, QString &hex, QString &oper )
{ {
oper.resize( i ); oper.resize( i );
} }
//qDebug() << str << '\n' << hex << oper; //qDebug() << str << '\n' << Qt::hex << oper;
//exit( 0 ); //exit( 0 );
return true; return true;

View File

@ -60,7 +60,7 @@ QList< KnownVariable > knownVariables;
// keep a list of the locations that each function's pattern matched to keep from looking them up over and over // keep a list of the locations that each function's pattern matched to keep from looking them up over and over
QMap< const ElfParser::Function *, QList< quint32 > >patternMatches; QMap< const ElfParser::Function *, QList< quint32 > >patternMatches;
#define DU32( x ) qDebug().nospace() << #x << ": " << hex << (x) #define DU32( x ) qDebug().nospace() << #x << ": " << Qt::hex << (x)
QString NStr( quint32 num, quint8 width = 8 ); QString NStr( quint32 num, quint8 width = 8 );
QString NStr( quint32 num, quint8 width ) QString NStr( quint32 num, quint8 width )
@ -321,7 +321,7 @@ void AddFunctionToKnownList( const ElfParser::Function *function, const ElfParse
{ {
if( kf.addr != addr ) if( kf.addr != addr )
{ {
DBG << "tried to add" << function->Name() << "to known functions at" << hex << addr << "but it already exists at" << kf.addr; DBG << "tried to add" << function->Name() << "to known functions at" << Qt::hex << addr << "but it already exists at" << kf.addr;
// TODO, probably need to remove the existing function from the list // TODO, probably need to remove the existing function from the list
} }
return; return;
@ -341,7 +341,7 @@ void AddFunctionToKnownList( const QString &name, quint32 addr, const QString &d
{ {
if( kf.addr != addr ) if( kf.addr != addr )
{ {
DBG << "tried to add" << name << "to known functions at" << hex << addr << "but it already exists at" << kf.addr; DBG << "tried to add" << name << "to known functions at" << Qt::hex << addr << "but it already exists at" << kf.addr;
// TODO, probably need to remove the existing function from the list // TODO, probably need to remove the existing function from the list
} }
return; return;
@ -375,7 +375,7 @@ int PatternSearch( const QString &needle, const QString &haystack, qint64 start
} }
if( c != haystack.at( start + j ) ) if( c != haystack.at( start + j ) )
{ {
//DBG << "index" << hex << (quint32)j; //DBG << "index" << Qt::hex << (quint32)j;
break; break;
} }
} }
@ -738,13 +738,13 @@ void TryToMatchData()
continue; continue;
} }
knownData << kd; knownData << kd;
/*qDebug() << hex << kd.addr << kd.len << kd.name << "from" << kd.file->Name(); /*qDebug() << Qt::hex << kd.addr << kd.len << kd.name << "from" << kd.file->Name();
// print aliases // print aliases
foreach( const SymAlias &alias, kd.file->Aliases() ) foreach( const SymAlias &alias, kd.file->Aliases() )
{ {
if( alias.containerName == kd.name ) if( alias.containerName == kd.name )
{ {
qDebug() << hex << " " << ( kd.addr + alias.offset ) << alias.size << alias.name; qDebug() << Qt::hex << " " << ( kd.addr + alias.offset ) << alias.size << alias.name;
} }
}*/ }*/
} }
@ -793,10 +793,10 @@ void TryToMatchFunctions0()
const QPair< const ElfParser::Function *, quint32>&p = maybeMatches.at( i ); const QPair< const ElfParser::Function *, quint32>&p = maybeMatches.at( i );
if( dupAddrs.contains( p.second ) ) if( dupAddrs.contains( p.second ) )
{ {
//qDebug() << "tossing out" << p.first->Name() << "because addr" << hex << p.second << "is reused"; //qDebug() << "tossing out" << p.first->Name() << "because addr" << Qt::hex << p.second << "is reused";
continue; continue;
} }
//qDebug() << hex << p.second << NStr( p.first->Pattern().size() / 2, 4 ) << p.first->Name(); //qDebug() << Qt::hex << p.second << NStr( p.first->Pattern().size() / 2, 4 ) << p.first->Name();
AddFunctionToKnownList( p.first, fileMap.find( p.first ).value(), p.second, __FUNCTION__ ); AddFunctionToKnownList( p.first, fileMap.find( p.first ).value(), p.second, __FUNCTION__ );
} }
RemoveOverlaps(); RemoveOverlaps();
@ -899,7 +899,7 @@ void TryToMatchFunctions1()
const QList< quint32 > &addrs = PatternMatches( it.first ); const QList< quint32 > &addrs = PatternMatches( it.first );
foreach( quint32 addr, addrs ) foreach( quint32 addr, addrs )
{ {
//qDebug() << "using address" << hex << addr << "for" << it.first->Name(); //qDebug() << "using address" << Qt::hex << addr << "for" << it.first->Name();
foreach( const SymRef &ref, it.first->References() ) foreach( const SymRef &ref, it.first->References() )
{ {
switch( ref.type ) switch( ref.type )
@ -958,8 +958,8 @@ void TryToMatchFunctions1()
{ {
fail = true; fail = true;
//qDebug() << "bad high" << hex << opcode << refOff << ref.name << ref.symOff; //qDebug() << "bad high" << Qt::hex << opcode << refOff << ref.name << ref.symOff;
//qDebug() << hex << "expected" << (quint32)( ( ( it.second->addr + ref.symOff + aliasDiff ) & 0xffff0000 ) >> 16 ); //qDebug() << Qt::hex << "expected" << (quint32)( ( ( it.second->addr + ref.symOff + aliasDiff ) & 0xffff0000 ) >> 16 );
//DumpRefs( *( it.first ) ); //DumpRefs( *( it.first ) );
} }
} }
@ -970,8 +970,8 @@ void TryToMatchFunctions1()
if( ( opcode & 0xffff ) != upper ) if( ( opcode & 0xffff ) != upper )
{ {
fail = true; fail = true;
//qDebug() << "bad high" << hex << opcode << refOff << ref.name << ref.symOff; //qDebug() << "bad high" << Qt::hex << opcode << refOff << ref.name << ref.symOff;
//qDebug() << hex << "expected" << (quint32)( ( ( it.second->addr + ref.symOff + aliasDiff ) & 0xffff0000 ) >> 16 ); //qDebug() << Qt::hex << "expected" << (quint32)( ( ( it.second->addr + ref.symOff + aliasDiff ) & 0xffff0000 ) >> 16 );
//DumpRefs( *( it.first ) ); //DumpRefs( *( it.first ) );
} }
} }
@ -981,8 +981,8 @@ void TryToMatchFunctions1()
if( ( opcode & 0xffff ) != ( (it.second->addr + ref.symOff + aliasDiff ) & 0xffff ) ) if( ( opcode & 0xffff ) != ( (it.second->addr + ref.symOff + aliasDiff ) & 0xffff ) )
{ {
fail = true; fail = true;
//qDebug() << "bad low" << hex << opcode << refOff << ref.name << ref.symOff; //qDebug() << "bad low" << Qt::hex << opcode << refOff << ref.name << ref.symOff;
//qDebug() << hex << "expected" << (quint32)( ( (it.second->addr + ref.symOff + aliasDiff ) & 0xffff ) ); //qDebug() << Qt::hex << "expected" << (quint32)( ( (it.second->addr + ref.symOff + aliasDiff ) & 0xffff ) );
//DumpRefs( *( it.first ) ); //DumpRefs( *( it.first ) );
} }
} }
@ -993,7 +993,7 @@ void TryToMatchFunctions1()
if( !AddressIsInDol( res ) )// just make sure the branch is inside the dol for now. no functions are actually known if( !AddressIsInDol( res ) )// just make sure the branch is inside the dol for now. no functions are actually known
{ {
fail = true; fail = true;
//qDebug() << "bad dranch" << hex << res << opcode << it.second->addr << ref.name; //qDebug() << "bad dranch" << Qt::hex << res << opcode << it.second->addr << ref.name;
} }
} }
break; break;
@ -1001,7 +1001,7 @@ void TryToMatchFunctions1()
continue; continue;
break; break;
} }
//qDebug() << "fakematch" << hex << addr << it.first->Name(); //qDebug() << "fakematch" << Qt::hex << addr << it.first->Name();
// if we found a possible match and we dont already have this one // if we found a possible match and we dont already have this one
if( !fail && !ListContains( probablyMatches, it.first, addr ) ) if( !fail && !ListContains( probablyMatches, it.first, addr ) )
@ -1021,7 +1021,7 @@ void TryToMatchFunctions1()
for( int i = 0; i < s; i++ ) for( int i = 0; i < s; i++ )
{ {
const QPair< const ElfParser::Function *, quint32 > &p = probablyMatches.at( i ); const QPair< const ElfParser::Function *, quint32 > &p = probablyMatches.at( i );
//qDebug() << hex << p.second << NStr( p.first->Pattern().size() / 2, 4 ) << p.first->Name(); //qDebug() << Qt::hex << p.second << NStr( p.first->Pattern().size() / 2, 4 ) << p.first->Name();
AddFunctionToKnownList( p.first, fileMap.find( p.first ).value(), p.second, __FUNCTION__ ); AddFunctionToKnownList( p.first, fileMap.find( p.first ).value(), p.second, __FUNCTION__ );
} }
RemoveOverlaps(); RemoveOverlaps();
@ -1053,13 +1053,13 @@ void FindGlobalVariables()
quint32 opcode = GetOpcodeFromAddr( addr ); quint32 opcode = GetOpcodeFromAddr( addr );
if( opcode == 0xdeadbeef ) if( opcode == 0xdeadbeef )
{ {
DBG << "opcode" << hex << opcode; DBG << "opcode" << Qt::hex << opcode;
continue; continue;
} }
quint32 reg = (quint32)PPCGETA( opcode ); quint32 reg = (quint32)PPCGETA( opcode );
if( reg != 2 && reg != 13 ) if( reg != 2 && reg != 13 )
{ {
DBG << "reg:" << hex << reg << kf1.function->Name() << ref.name; DBG << "reg:" << Qt::hex << reg << kf1.function->Name() << ref.name;
continue; continue;
} }
quint32 sig = GLOBALVAR_MASK( opcode ); quint32 sig = GLOBALVAR_MASK( opcode );
@ -1073,7 +1073,7 @@ void FindGlobalVariables()
nw.sig = sig; nw.sig = sig;
newVariables << nw; newVariables << nw;
/*qDebug() << "opcode" << hex << opcode << "addr" << addr; /*qDebug() << "opcode" << Qt::hex << opcode << "addr" << addr;
qDebug() << kf1.function->Name() << ref.name; qDebug() << kf1.function->Name() << ref.name;
qDebug(); qDebug();
quint32 z = GLOBALVAR_MASK( opcode ); quint32 z = GLOBALVAR_MASK( opcode );
@ -1155,7 +1155,7 @@ void FindGlobalVariables()
quint32 opcode = GetOpcodeFromAddr( opAddr ); quint32 opcode = GetOpcodeFromAddr( opAddr );
if( opcode == 0xdeadbeef ) if( opcode == 0xdeadbeef )
{ {
DBG << "opcode" << hex << opcode; DBG << "opcode" << Qt::hex << opcode;
continue; continue;
} }
if( GLOBALVAR_MASK( opcode ) != varSig ) if( GLOBALVAR_MASK( opcode ) != varSig )
@ -1188,7 +1188,7 @@ void FindGlobalVariables()
while( ret.hasNext() ) while( ret.hasNext() )
{ {
ret.next(); ret.next();
//qDebug() << hex << ret.value() //qDebug() << Qt::hex << ret.value()
// << NStr( ret.key()->Pattern().size() / 2, 4 ) // << NStr( ret.key()->Pattern().size() / 2, 4 )
// << ret.key()->Name() // << ret.key()->Name()
// << fileMap.find( ret.key() ).value()->Name(); // << fileMap.find( ret.key() ).value()->Name();
@ -1263,7 +1263,7 @@ void TryToMatchFunctions2( QMap< const ElfParser::Function *, quint32 > &nonMatc
quint32 opcode = GetOpcodeFromAddr( addr ); quint32 opcode = GetOpcodeFromAddr( addr );
if( opcode == 0xdeadbeef ) if( opcode == 0xdeadbeef )
{ {
DBG << "error getting opcode from" << hex << addr << fun->Name(); DBG << "error getting opcode from" << Qt::hex << addr << fun->Name();
break; break;
} }
quint32 res = ResolveBranch( addr , opcode ); quint32 res = ResolveBranch( addr , opcode );
@ -1273,7 +1273,7 @@ void TryToMatchFunctions2( QMap< const ElfParser::Function *, quint32 > &nonMatc
{ {
break; break;
} }
//qDebug() << hex << res << ref.name << "from" << kf.addr << fun->Name() << addr << opcode; //qDebug() << Qt::hex << res << ref.name << "from" << kf.addr << fun->Name() << addr << opcode;
bool branchHasSymbols = false; bool branchHasSymbols = false;
bool skipIt = false; bool skipIt = false;
@ -1304,16 +1304,16 @@ void TryToMatchFunctions2( QMap< const ElfParser::Function *, quint32 > &nonMatc
{ {
/*if( fun2.Name() == "NANDPrivateCreateAsync" ) /*if( fun2.Name() == "NANDPrivateCreateAsync" )
{ {
qDebug() << "expected" << fun2.Name() << "at" << hex << res << "but pattern didnt match"; qDebug() << "expected" << fun2.Name() << "at" << Qt::hex << res << "but pattern didnt match";
qDebug() << "being called from" << fun->Name() << "at" << hex << addr; qDebug() << "being called from" << fun->Name() << "at" << Qt::hex << addr;
qDebug() << "offset" << NStr( textOffset ) << "in section" << dolIdx; qDebug() << "offset" << NStr( textOffset ) << "in section" << dolIdx;
qDebug() << fun2.Pattern(); qDebug() << fun2.Pattern();
qDebug() << wholeDolHex.at( dolIdx ).mid( textOffset, fun2.Pattern().size() ); qDebug() << wholeDolHex.at( dolIdx ).mid( textOffset, fun2.Pattern().size() );
exit( 0 ); exit( 0 );
}*/ }*/
//qDebug() << "expected" << fun2.Name() << "at" << hex << res << "but pattern didnt match"; //qDebug() << "expected" << fun2.Name() << "at" << Qt::hex << res << "but pattern didnt match";
//qDebug() << "being called from" << fun->Name() << "at" << hex << addr; //qDebug() << "being called from" << fun->Name() << "at" << Qt::hex << addr;
nonMatchingBranches[ &fun2 ] = res; nonMatchingBranches[ &fun2 ] = res;
} }
break; break;
@ -1342,7 +1342,7 @@ void TryToMatchFunctions2( QMap< const ElfParser::Function *, quint32 > &nonMatc
for( int i = 0; i < s; i++ ) for( int i = 0; i < s; i++ )
{ {
const QPair< const ElfParser::Function *, quint32 > &p = probablyMatches.at( i ); const QPair< const ElfParser::Function *, quint32 > &p = probablyMatches.at( i );
//qDebug() << hex << p.second << p.first->Name(); //qDebug() << Qt::hex << p.second << p.first->Name();
AddFunctionToKnownList( p.first, fileMap.find( p.first ).value(), p.second, __FUNCTION__ ); AddFunctionToKnownList( p.first, fileMap.find( p.first ).value(), p.second, __FUNCTION__ );
} }
@ -1352,7 +1352,7 @@ void TryToMatchFunctions2( QMap< const ElfParser::Function *, quint32 > &nonMatc
for( int i = 0; i < s; i++ ) for( int i = 0; i < s; i++ )
{ {
const QPair< QString, quint32 > &p = probablyMatches2.at( i ); const QPair< QString, quint32 > &p = probablyMatches2.at( i );
//qDebug() << hex << p.second << p.first; //qDebug() << Qt::hex << p.second << p.first;
AddFunctionToKnownList( p.first, p.second, __FUNCTION__ ); AddFunctionToKnownList( p.first, p.second, __FUNCTION__ );
} }
RemoveOverlaps(); RemoveOverlaps();
@ -1424,7 +1424,7 @@ QList< QPair< const ElfParser::Function *, quint32> > TryToMatchFunctions3( QLis
quint32 opcode = GetOpcodeFromAddr( branchFromAddr ); quint32 opcode = GetOpcodeFromAddr( branchFromAddr );
if( opcode == 0xdeadbeef ) if( opcode == 0xdeadbeef )
{ {
DBG << "error getting opcode from" << hex << branchFromAddr << fun.Name() << "ref" << ref.name; DBG << "error getting opcode from" << Qt::hex << branchFromAddr << fun.Name() << "ref" << ref.name;
fail = true; fail = true;
break; break;
} }
@ -1465,7 +1465,7 @@ QList< QPair< const ElfParser::Function *, quint32> > TryToMatchFunctions3( QLis
for( int i = 0; i < s; i++ ) for( int i = 0; i < s; i++ )
{ {
const QPair< const ElfParser::Function *, quint32 > &p = maybeMatches.at( i ); const QPair< const ElfParser::Function *, quint32 > &p = maybeMatches.at( i );
//qDebug() << hex << p.second << NStr( p.first->Pattern().size() / 2, 4 ) << p.first->Name(); //qDebug() << Qt::hex << p.second << NStr( p.first->Pattern().size() / 2, 4 ) << p.first->Name();
AddFunctionToKnownList( p.first, fileMap.find( p.first ).value(), p.second, __FUNCTION__ ); AddFunctionToKnownList( p.first, fileMap.find( p.first ).value(), p.second, __FUNCTION__ );
} }
@ -1534,11 +1534,11 @@ QList< QPair< const ElfParser::Function *, quint32> > TryToMatchFunctions4( QLis
// cleanup the list // cleanup the list
CleanupList( maybeMatches ); CleanupList( maybeMatches );
int s = maybeMatches.size(); int s = maybeMatches.size();
//qDebug() << "Functions that only have 1 pattern match, contain wildcards, and are larger than 0x" << hex << minLen << "bytes:"; //qDebug() << "Functions that only have 1 pattern match, contain wildcards, and are larger than 0x" << Qt::hex << minLen << "bytes:";
for( int i = 0; i < s; i++ ) for( int i = 0; i < s; i++ )
{ {
const QPair< const ElfParser::Function *, quint32 > &p = maybeMatches.at( i ); const QPair< const ElfParser::Function *, quint32 > &p = maybeMatches.at( i );
//qDebug() << hex << p.second << NStr( p.first->Pattern().size() / 2, 4 ) << p.first->Name(); //qDebug() << Qt::hex << p.second << NStr( p.first->Pattern().size() / 2, 4 ) << p.first->Name();
AddFunctionToKnownList( p.first, fileMap.find( p.first ).value(), p.second, __FUNCTION__ ); AddFunctionToKnownList( p.first, fileMap.find( p.first ).value(), p.second, __FUNCTION__ );
} }