From 7b998b5422a3f5384613e9f92960fe27e9bd0c2c Mon Sep 17 00:00:00 2001 From: giantpune Date: Mon, 30 May 2011 23:39:10 +0000 Subject: [PATCH] * ohneschwanzenegger:: allow passing nand filename as argv * nandBinCheck:: default to "-all -v -v" if no args are given --- WiiQt/nusdownloader.cpp | 3 ++- WiiQt/nusdownloader.h | 4 ++-- WiiQt/wad.h | 2 +- nandBinCheck/main.cpp | 8 +++++++- ohneschwanzenegger/mainwindow.cpp | 12 +++++++++++- 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/WiiQt/nusdownloader.cpp b/WiiQt/nusdownloader.cpp index fedc774..e2fb3d1 100644 --- a/WiiQt/nusdownloader.cpp +++ b/WiiQt/nusdownloader.cpp @@ -354,6 +354,7 @@ QString NusDownloader::GetCachePath( quint32 idx ) return path; } +#if 0 //print info about a job void NusDownloader::DbgJoB( const NusJob &job ) { @@ -366,6 +367,7 @@ void NusDownloader::DbgJoB( const NusJob &job ) .arg( job.version ).arg( job.decrypt ? "decrypted" : "encrypted" ) .arg( dataStuff ); } +#endif //check a hash and add the data to the return item bool NusDownloader::DecryptCheckHashAndAppendData( const QByteArray &encData, quint16 idx ) @@ -540,7 +542,6 @@ void NusDownloader::downloadFinished() { emit SendDownloadProgress( 100 ); FileIsFinishedDownloading( dlJob ); - } currentDownload->deleteLater(); } diff --git a/WiiQt/nusdownloader.h b/WiiQt/nusdownloader.h index a847a61..8d6bdc7 100644 --- a/WiiQt/nusdownloader.h +++ b/WiiQt/nusdownloader.h @@ -127,10 +127,10 @@ private: //send a fail message about the current job and skip to the next void CurrentJobErrored( const QString &str ); - +#if 0 //print info about a job to qDebug() void DbgJoB( const NusJob &job ); - +#endif //get the path for a file in the local cache QString GetCachePath( quint32 idx ); diff --git a/WiiQt/wad.h b/WiiQt/wad.h index 137bccd..8153459 100644 --- a/WiiQt/wad.h +++ b/WiiQt/wad.h @@ -89,7 +89,7 @@ public: quint32 content_count(); //get the last error encountered while trying to do something - const QString LastError(){ return errStr; } + const QString &LastError(){ return errStr; } //get a name for a wad as it would be seen in a wii disc update partition //if a path is given, it will check that path for existing wads with the name and append a number to the end "(1)" to avoid duplicate files diff --git a/nandBinCheck/main.cpp b/nandBinCheck/main.cpp index e4d32c2..f2f1bec 100644 --- a/nandBinCheck/main.cpp +++ b/nandBinCheck/main.cpp @@ -165,6 +165,7 @@ void DebugHandler( QtMsgType type, const char *msg ) void Usage() { qWarning() << "usage:" << QCoreApplication::arguments().at( 0 ) << "nand.bin" << ""; + qDebug() << "\nif no are given, it will default to \"-all -v -v\""; qDebug() << "\nOther options:"; qDebug() << " -boot shows information about boot 1 and 2"; qDebug() << ""; @@ -1328,7 +1329,7 @@ int main( int argc, char *argv[] ) if( args.contains( "-about", Qt::CaseInsensitive ) ) About(); - if( args.size() < 3 ) + if( args.size() < 2 ) Usage(); if( !QFile( args.at( 1 ) ).exists() ) @@ -1337,6 +1338,11 @@ int main( int argc, char *argv[] ) if( !nand.SetPath( args.at( 1 ) ) || !nand.InitNand() ) Fail( "Error setting path to nand object" ); + if( args.size() < 3 ) + { + args << "-all" << "-v" << "-v"; + } + root = NULL; verbose = args.count( "-v" ); diff --git a/ohneschwanzenegger/mainwindow.cpp b/ohneschwanzenegger/mainwindow.cpp index 9adac77..79253f9 100644 --- a/ohneschwanzenegger/mainwindow.cpp +++ b/ohneschwanzenegger/mainwindow.cpp @@ -57,7 +57,17 @@ MainWindow::MainWindow( QWidget *parent ) : QMainWindow( parent ), ui( new Ui::M connect( &nand, SIGNAL( SendText( QString ) ), ui->statusBar, SLOT( showMessage( QString ) ) ); LoadSettings(); - ui->lineEdit_nandPath->setText( "./testNand.bin" ); + + QStringList args = QCoreApplication::arguments(); + if( args.size() > 1 && QFileInfo( args.at( 1 ) ).exists() ) + { + ui->lineEdit_nandPath->setText( args.at( 1 ) ); + InitNand( args.at( 1 ) ); + } + else + { + ui->lineEdit_nandPath->setText( "./testNand.bin" ); + } } MainWindow::~MainWindow()