diff --git a/.gitattributes b/.gitattributes index 05cce83..7a3cea3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -63,6 +63,7 @@ nandExtract/boot2infodialog.h -text nandExtract/boot2infodialog.ui -text nandExtract/green.png -text nandExtract/grey.png -text +nandExtract/icon.png -text nandExtract/main.cpp -text nandExtract/nandExtract.pro -text nandExtract/nandthread.cpp -text @@ -73,12 +74,15 @@ nandExtract/nandwindow.ui -text nandExtract/pink.png -text nandExtract/rc.qrc -text nandExtract/readmii.txt -text +nand_dump/icon.png -text nand_dump/main.cpp -text nand_dump/mainwindow.cpp -text nand_dump/mainwindow.h -text nand_dump/mainwindow.ui -text nand_dump/nand.pro -text +nand_dump/rc.qrc -text nand_dump/readmii.txt -text +ohneschwanzenegger/icon.png -text ohneschwanzenegger/main.cpp -text ohneschwanzenegger/mainwindow.cpp -text ohneschwanzenegger/mainwindow.h -text diff --git a/WiiQt/u8.cpp b/WiiQt/u8.cpp index 2dd5bdd..e681400 100644 --- a/WiiQt/u8.cpp +++ b/WiiQt/u8.cpp @@ -155,11 +155,11 @@ bool U8::RenameEntry( const QString &path, const QString &newName ) quint32 nFstSize = fstSize + difference; int dataAdjustment = 0; - if( RU( U8_HEADER_ALIGNMENT, nFstSize ) < RU( U8_HEADER_ALIGNMENT, fstSize ) ) - dataAdjustment = - RU( U8_HEADER_ALIGNMENT, fstSize - nFstSize ); + if( RU( nFstSize, U8_HEADER_ALIGNMENT ) < RU( fstSize, U8_HEADER_ALIGNMENT ) ) + dataAdjustment = - RU( ( fstSize - nFstSize ), U8_HEADER_ALIGNMENT ); - else if( RU( U8_HEADER_ALIGNMENT, nFstSize ) > RU( U8_HEADER_ALIGNMENT, fstSize ) ) - dataAdjustment = RU( U8_HEADER_ALIGNMENT, nFstSize - fstSize ); + else if( RU( nFstSize, U8_HEADER_ALIGNMENT ) > RU( fstSize, U8_HEADER_ALIGNMENT ) ) + dataAdjustment = RU( ( nFstSize - fstSize ), U8_HEADER_ALIGNMENT ); qDebug() << "old size:" << hex << oldNameLen\ << "new size:" << hex << newNameLen\ @@ -235,7 +235,7 @@ bool U8::RenameEntry( const QString &path, const QString &newName ) t = qFromBigEndian( fstSize ); buf.write( (const char*)&t, 4 ); - data_offset = RU( U8_HEADER_ALIGNMENT, 0x20 + fstSize ); + data_offset = RU( ( 0x20 + fstSize ), U8_HEADER_ALIGNMENT ); t = qFromBigEndian( data_offset ); buf.write( (const char*)&t, 4 ); buf.close(); @@ -248,7 +248,7 @@ bool U8::RenameEntry( const QString &path, const QString &newName ) } data.append( nPayload );//add the actual file data - padding = RU( 0x20, data.size() ) - data.size();//pad the entire thing to 0x20 bytes TOTO: should probably already be done, and this step is not really necessary + padding = RU( data.size(), 0x20 ) - data.size();//pad the entire thing to 0x20 bytes TOTO: should probably already be done, and this step is not really necessary if( padding ) { data.append( QByteArray( padding, '\0' ) ); @@ -325,8 +325,8 @@ bool U8::ReplaceEntry( const QString &path, const QByteArray &nba, bool autoComp } } - quint32 newSizePadded = RU( 0x20, newData.size() ); - quint32 oldSizePadded = RU( 0x20, qFromBigEndian( fst[ entryToReplace ].FileLength ) ); + quint32 newSizePadded = RU( newData.size(), 0x20 ); + quint32 oldSizePadded = RU( qFromBigEndian( fst[ entryToReplace ].FileLength ), 0x20 ); int difference = newSizePadded - oldSizePadded; data.remove( qFromBigEndian( fst[ entryToReplace ].FileOffset ), oldSizePadded ); @@ -514,10 +514,10 @@ bool U8::RemoveEntry( const QString &path ) { ne->Type = 0; ne->FileOffset = \ - qFromBigEndian( (quint32)( 0x20 + RU( U8_HEADER_ALIGNMENT, nFstSize ) + nPayload.size() ) ); + qFromBigEndian( (quint32)( 0x20 + RU( nFstSize, U8_HEADER_ALIGNMENT ) + nPayload.size() ) ); ne->FileLength = e->FileLength; nPayload.append( data.mid( qFromBigEndian( e->FileOffset ), qFromBigEndian( e->FileLength ) ) ); - int padding = RU( 0x20, nPayload.size() ) - nPayload.size();//pad to 0x20 bytes between files + int padding = RU( nPayload.size(), 0x20 ) - nPayload.size();//pad to 0x20 bytes between files if( padding ) { nPayload.append( QByteArray( padding, '\0' ) ); @@ -552,7 +552,7 @@ bool U8::RemoveEntry( const QString &path ) t = qFromBigEndian( fstSize ); buf.write( (const char*)&t, 4 ); - data_offset = RU( U8_HEADER_ALIGNMENT, 0x20 + fstSize ); + data_offset = RU( ( 0x20 + fstSize ), U8_HEADER_ALIGNMENT ); t = qFromBigEndian( data_offset ); buf.write( (const char*)&t, 4 ); buf.close(); @@ -565,7 +565,7 @@ bool U8::RemoveEntry( const QString &path ) } data.append( nPayload );//add the actual file data - padding = RU( 0x20, data.size() ) - data.size();//pad the entire thing to 0x20 bytes TOTO: should probably already be done, and this step is not really necessary + padding = RU( data.size(), 0x20 ) - data.size();//pad the entire thing to 0x20 bytes TOTO: should probably already be done, and this step is not really necessary if( padding ) { data.append( QByteArray( padding, '\0' ) ); @@ -714,9 +714,9 @@ int U8::AddEntry( const QString &path, int type, const QByteArray &newData ) ne->Type = 0; ne->FileLength = qFromBigEndian( (quint32)newData.size() ); ne->FileOffset =\ - qFromBigEndian( (quint32)( 0x20 + RU( U8_HEADER_ALIGNMENT, nFstSize ) + nPayload.size() ) ); + qFromBigEndian( (quint32)( 0x20 + RU( nFstSize, U8_HEADER_ALIGNMENT ) + nPayload.size() ) ); nPayload.append( newData ); - int padding = RU( 0x20, nPayload.size() ) - nPayload.size();//pad to 0x20 bytes between files + int padding = RU( nPayload.size(), 0x20 ) - nPayload.size();//pad to 0x20 bytes between files if( padding ) { nPayload.append( QByteArray( padding, '\0' ) ); @@ -758,10 +758,10 @@ int U8::AddEntry( const QString &path, int type, const QByteArray &newData ) { ne->Type = 0; ne->FileOffset = \ - qFromBigEndian( (quint32)( 0x20 + RU( U8_HEADER_ALIGNMENT, nFstSize ) + nPayload.size() ) ); + qFromBigEndian( (quint32)( 0x20 + RU( nFstSize, U8_HEADER_ALIGNMENT ) + nPayload.size() ) ); ne->FileLength = e->FileLength; nPayload.append( data.mid( qFromBigEndian( e->FileOffset ), qFromBigEndian( e->FileLength ) ) ); - int padding = RU( 0x20, nPayload.size() ) - nPayload.size();//pad to 0x20 bytes between files + int padding = RU( nPayload.size(), 0x20 ) - nPayload.size();//pad to 0x20 bytes between files if( padding ) { nPayload.append( QByteArray( padding, '\0' ) ); @@ -792,7 +792,7 @@ int U8::AddEntry( const QString &path, int type, const QByteArray &newData ) t = qFromBigEndian( fstSize ); buf.write( (const char*)&t, 4 ); - data_offset = RU( U8_HEADER_ALIGNMENT, 0x20 + fstSize ); + data_offset = RU( ( 0x20 + fstSize ), U8_HEADER_ALIGNMENT ); t = qFromBigEndian( data_offset ); buf.write( (const char*)&t, 4 ); buf.close(); @@ -805,7 +805,7 @@ int U8::AddEntry( const QString &path, int type, const QByteArray &newData ) } data.append( nPayload );//add the actual file data - padding = RU( 0x20, data.size() ) - data.size();//pad the entire thing to 0x20 bytes TOTO: should probably already be done, and this step is not really necessary + padding = RU( data.size(), 0x20 ) - data.size();//pad the entire thing to 0x20 bytes TOTO: should probably already be done, and this step is not really necessary if( padding ) { data.append( QByteArray( padding, '\0' ) ); diff --git a/nandExtract/icon.png b/nandExtract/icon.png new file mode 100644 index 0000000..11dc892 Binary files /dev/null and b/nandExtract/icon.png differ diff --git a/nandExtract/main.cpp b/nandExtract/main.cpp index e207aa8..b38053e 100755 --- a/nandExtract/main.cpp +++ b/nandExtract/main.cpp @@ -6,6 +6,7 @@ int main(int argc, char *argv[]) Q_INIT_RESOURCE( rc ); QApplication a(argc, argv); + QApplication::setWindowIcon( QIcon( ":/icon.png" ) ); NandWindow w; w.show(); return a.exec(); diff --git a/nandExtract/nandwindow.cpp b/nandExtract/nandwindow.cpp index b757045..bac1416 100755 --- a/nandExtract/nandwindow.cpp +++ b/nandExtract/nandwindow.cpp @@ -6,6 +6,7 @@ NandWindow::NandWindow( QWidget *parent ) : QMainWindow( parent ), ui( new Ui::NandWindow ), nThread( this ) { ui->setupUi( this ); + ui->mainToolBar->setVisible( false ); //setup the block map SetUpBlockMap(); diff --git a/nandExtract/rc.qrc b/nandExtract/rc.qrc index a654d98..bdbb33c 100644 --- a/nandExtract/rc.qrc +++ b/nandExtract/rc.qrc @@ -5,5 +5,6 @@ grey.png pink.png black.png + icon.png diff --git a/nand_dump/icon.png b/nand_dump/icon.png new file mode 100755 index 0000000..9103c50 Binary files /dev/null and b/nand_dump/icon.png differ diff --git a/nand_dump/main.cpp b/nand_dump/main.cpp index 9ae175b..55b3dbd 100644 --- a/nand_dump/main.cpp +++ b/nand_dump/main.cpp @@ -3,7 +3,9 @@ int main(int argc, char *argv[]) { + Q_INIT_RESOURCE( rc ); QApplication a(argc, argv); + QApplication::setWindowIcon( QIcon( ":/icon.png" ) ); MainWindow w; w.show(); diff --git a/nand_dump/mainwindow.cpp b/nand_dump/mainwindow.cpp index 918af73..d550e40 100644 --- a/nand_dump/mainwindow.cpp +++ b/nand_dump/mainwindow.cpp @@ -8,7 +8,27 @@ MainWindow::MainWindow( QWidget *parent ) : QMainWindow( parent ), ui( new Ui::MainWindow ), nus ( this ) { - ui->setupUi(this); + ui->setupUi(this); + ui->mainToolBar->setVisible( false );//hide toolbar for now + + //resize buttons to be same size + QFontMetrics fm( fontMetrics() ); + int max = fm.width( ui->pushButton_CachePathBrowse->text() ); + max = MAX( max, fm.width( ui->pushButton_decFolder->text() ) ); + max = MAX( max, fm.width( ui->pushButton_GetTitle->text() ) ); + max = MAX( max, fm.width( ui->pushButton_nandPath->text() ) ); + max = MAX( max, fm.width( ui->pushButton_wad->text() ) ); + + max += 15; + ui->pushButton_CachePathBrowse->setMinimumWidth( max ); + ui->pushButton_decFolder->setMinimumWidth( max ); + ui->pushButton_GetTitle->setMinimumWidth( max ); + ui->pushButton_nandPath->setMinimumWidth( max ); + ui->pushButton_wad->setMinimumWidth( max ); + + + + Wad::SetGlobalCert( QByteArray( (const char*)&certs_dat, CERTS_DAT_SIZE ) ); //connect to the nus object so we can respond to what it is saying with pretty stuff in the gui diff --git a/nand_dump/nand.pro b/nand_dump/nand.pro index b47abf0..bc83c8e 100644 --- a/nand_dump/nand.pro +++ b/nand_dump/nand.pro @@ -37,3 +37,6 @@ HEADERS += mainwindow.h \ FORMS += mainwindow.ui \ ../WiiQt/settingtxtdialog.ui + +RESOURCES += \ + rc.qrc diff --git a/nand_dump/rc.qrc b/nand_dump/rc.qrc new file mode 100644 index 0000000..619648d --- /dev/null +++ b/nand_dump/rc.qrc @@ -0,0 +1,5 @@ + + + icon.png + + diff --git a/ohneschwanzenegger/icon.png b/ohneschwanzenegger/icon.png new file mode 100644 index 0000000..95539ce Binary files /dev/null and b/ohneschwanzenegger/icon.png differ diff --git a/ohneschwanzenegger/main.cpp b/ohneschwanzenegger/main.cpp index 9b7c5df..1b8762f 100644 --- a/ohneschwanzenegger/main.cpp +++ b/ohneschwanzenegger/main.cpp @@ -4,7 +4,8 @@ int main(int argc, char *argv[]) { Q_INIT_RESOURCE( rc ); - QApplication a(argc, argv); + QApplication a( argc, argv ); + QApplication::setWindowIcon( QIcon( ":/icon.png" ) ); MainWindow w; w.show(); diff --git a/ohneschwanzenegger/mainwindow.cpp b/ohneschwanzenegger/mainwindow.cpp index af3a73b..86f5813 100644 --- a/ohneschwanzenegger/mainwindow.cpp +++ b/ohneschwanzenegger/mainwindow.cpp @@ -24,6 +24,22 @@ MainWindow::MainWindow( QWidget *parent ) : QMainWindow( parent ), ui( new Ui::M uidDirty = false; sharedDirty = false; nandDirty = false; + + ui->mainToolBar->setVisible( false );//hide toolbar for now + + //resize buttons to be same size + QFontMetrics fm( fontMetrics() ); + int max = fm.width( ui->pushButton_CachePathBrowse->text() ); + max = MAX( max, fm.width( ui->pushButton_GetTitle->text() ) ); + max = MAX( max, fm.width( ui->pushButton_initNand->text() ) ); + max = MAX( max, fm.width( ui->pushButton_nandPath->text() ) ); + + max += 15; + ui->pushButton_CachePathBrowse->setMinimumWidth( max ); + ui->pushButton_GetTitle->setMinimumWidth( max ); + ui->pushButton_initNand->setMinimumWidth( max ); + ui->pushButton_nandPath->setMinimumWidth( max ); + Wad::SetGlobalCert( QByteArray( (const char*)&certs_dat, CERTS_DAT_SIZE ) ); //connect to the nus object so we can respond to what it is saying with pretty stuff in the gui diff --git a/ohneschwanzenegger/rc.qrc b/ohneschwanzenegger/rc.qrc index 835d340..806b1a5 100644 --- a/ohneschwanzenegger/rc.qrc +++ b/ohneschwanzenegger/rc.qrc @@ -1,5 +1,6 @@ testlog.txt + icon.png