* adding icons and adjusting layouts for example programs

* adjust U8 class for changed round-up macro.  still needs to be verified
This commit is contained in:
giantpune@gmail.com 2011-01-04 02:40:25 +00:00
parent d3e71407c8
commit d5d094862d
15 changed files with 75 additions and 20 deletions

4
.gitattributes vendored
View File

@ -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

View File

@ -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' ) );

BIN
nandExtract/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@ -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();

View File

@ -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();

View File

@ -5,5 +5,6 @@
<file>grey.png</file>
<file>pink.png</file>
<file>black.png</file>
<file>icon.png</file>
</qresource>
</RCC>

BIN
nand_dump/icon.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

@ -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();

View File

@ -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

View File

@ -37,3 +37,6 @@ HEADERS += mainwindow.h \
FORMS += mainwindow.ui \
../WiiQt/settingtxtdialog.ui
RESOURCES += \
rc.qrc

5
nand_dump/rc.qrc Normal file
View File

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/">
<file>icon.png</file>
</qresource>
</RCC>

BIN
ohneschwanzenegger/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -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();

View File

@ -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

View File

@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/">
<file>testlog.txt</file>
<file>icon.png</file>
</qresource>
</RCC>