mirror of
https://github.com/martravi/wiiqt6.git
synced 2024-12-25 04:21:48 +01:00
* adding icons and adjusting layouts for example programs
* adjust U8 class for changed round-up macro. still needs to be verified git-svn-id: http://wiiqt.googlecode.com/svn/trunk@46 389f4c8b-5dfe-645f-db0e-df882bc27289
This commit is contained in:
parent
930e92ca3c
commit
411c42203d
36
WiiQt/u8.cpp
36
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' ) );
|
||||
|
BIN
nandExtract/icon.png
Normal file
BIN
nandExtract/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.0 KiB |
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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
BIN
nand_dump/icon.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 7.7 KiB |
@ -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();
|
||||
|
||||
|
@ -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
|
||||
|
@ -37,3 +37,6 @@ HEADERS += mainwindow.h \
|
||||
|
||||
FORMS += mainwindow.ui \
|
||||
../WiiQt/settingtxtdialog.ui
|
||||
|
||||
RESOURCES += \
|
||||
rc.qrc
|
||||
|
5
nand_dump/rc.qrc
Normal file
5
nand_dump/rc.qrc
Normal file
@ -0,0 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>icon.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
BIN
ohneschwanzenegger/icon.png
Normal file
BIN
ohneschwanzenegger/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
@ -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();
|
||||
|
||||
|
@ -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
|
||||
|
@ -1,5 +1,6 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>testlog.txt</file>
|
||||
<file>icon.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
Loading…
Reference in New Issue
Block a user