* ohneschwanzenegger: if trying to install multiple wads, and one fails, keep going. add testlog on format as well as creating new nand (yet untested)

git-svn-id: http://wiiqt.googlecode.com/svn/trunk@95 389f4c8b-5dfe-645f-db0e-df882bc27289
This commit is contained in:
giantpune 2011-05-27 21:34:22 +00:00
parent c744b29d04
commit ad906d24d9
2 changed files with 41 additions and 10 deletions

View File

@ -242,11 +242,10 @@ void MainWindow::on_pushButton_GetTitle_clicked()
} }
} }
//decide how we want nus to give us the title //decide how we want nus to give us the title
bool decrypt = true;
nus.SetCachePath( ui->lineEdit_cachePath->text() ); nus.SetCachePath( ui->lineEdit_cachePath->text() );
if( wholeUpdate ) if( wholeUpdate )
{ {
if( !nus.GetUpdate( ui->lineEdit_tid->text(), decrypt ) ) if( !nus.GetUpdate( ui->lineEdit_tid->text(), true ) )
{ {
ShowMessage( tr( "<b>I dont know the titles that were in the %1 update</b>" ).arg( ui->lineEdit_tid->text() ) ); ShowMessage( tr( "<b>I dont know the titles that were in the %1 update</b>" ).arg( ui->lineEdit_tid->text() ) );
return; return;
@ -254,7 +253,7 @@ void MainWindow::on_pushButton_GetTitle_clicked()
} }
else else
{ {
nus.Get( tid, decrypt, ver ); nus.Get( tid, true, ver );
} }
} }
@ -333,13 +332,13 @@ void MainWindow::on_actionImportWad_triggered()
{ {
QByteArray data = ReadFile( fn ); QByteArray data = ReadFile( fn );
if( data.isEmpty() ) if( data.isEmpty() )
return; continue;
Wad wad( data ); Wad wad( data );
if( !wad.IsOk() ) if( !wad.IsOk() )
{ {
ShowMessage( tr( "Wad data not ok for \"%1\"" ).arg( fn ) ); ShowMessage( tr( "Wad data not ok for \"%1\"" ).arg( fn ) );
return; continue;
} }
//work smart, not hard... just turn the wad into a NUSJob and reused the same code to install it //work smart, not hard... just turn the wad into a NUSJob and reused the same code to install it
@ -360,7 +359,6 @@ void MainWindow::on_actionImportWad_triggered()
ShowMessage( tr( "Installing %1 to nand" ).arg( fn ) ); ShowMessage( tr( "Installing %1 to nand" ).arg( fn ) );
InstallNUSItem( job ); InstallNUSItem( job );
} }
} }
void MainWindow::on_actionNew_nand_from_keys_triggered() void MainWindow::on_actionNew_nand_from_keys_triggered()
@ -382,7 +380,8 @@ void MainWindow::on_actionNew_nand_from_keys_triggered()
ShowMessage( "<b>Error creating title subdirs<\b>" ); ShowMessage( "<b>Error creating title subdirs<\b>" );
return; return;
} }
WriteTestLog();
#if 0
//add some factory test logs and whatnot //add some factory test logs and whatnot
quint32 _uid = uid.GetUid( NAND_TEST_OWNER, true ); quint32 _uid = uid.GetUid( NAND_TEST_OWNER, true );
if( !nand.CreateEntry( "/shared2/test", _uid, NAND_TEST_GROUP, NAND_DIR, NAND_RW, NAND_RW, NAND_RW ) if( !nand.CreateEntry( "/shared2/test", _uid, NAND_TEST_GROUP, NAND_DIR, NAND_RW, NAND_RW, NAND_RW )
@ -405,6 +404,7 @@ void MainWindow::on_actionNew_nand_from_keys_triggered()
} }
UpdateTree(); UpdateTree();
ShowMessage( "Created /shared2/test/testlog.txt" ); ShowMessage( "Created /shared2/test/testlog.txt" );
#endif
} }
void MainWindow::on_pushButton_initNand_clicked() void MainWindow::on_pushButton_initNand_clicked()
@ -913,6 +913,34 @@ void MainWindow::on_actionWrite_meta_entries_triggered()
AddStuffToMetaFolder(); AddStuffToMetaFolder();
} }
void MainWindow::WriteTestLog()
{
if( ( !nandInited && !InitNand( ui->lineEdit_nandPath->text() ) )
|| ItemFromPath( "/shared2/test/testlog.txt" ) ) //already exists
return;
quint32 _uid = uid.GetUid( NAND_TEST_OWNER, true );
if( !CreateIfNeeded( "/shared2/test", _uid, NAND_TEST_GROUP, NAND_DIR, NAND_RW, NAND_RW, NAND_RW )
|| !CreateIfNeeded( "/shared2/sys", _uid, NAND_TEST_GROUP, NAND_DIR, NAND_RW, NAND_RW, NAND_RW ) )
{
ShowMessage( "<b>Error creating folder for testlog<\b>" );
return;
}
quint16 handle = CreateIfNeeded( "/shared2/test/testlog.txt", _uid, NAND_TEST_GROUP, NAND_FILE, NAND_RW, NAND_RW, NAND_RW );
if( !handle )
{
ShowMessage( "<b>Error creating testlog<\b>" );
return;
}
QByteArray tLog = ReadFile( ":/testlog.txt" );
if( !nand.SetData( handle, tLog ) )
{
ShowMessage( "<b>Error writing to testlog.txt<\b>" );
return;
}
ShowMessage( "Created /shared2/test/testlog.txt" );
}
//content -> format //content -> format
void MainWindow::on_actionFormat_triggered() void MainWindow::on_actionFormat_triggered()
{ {
@ -1001,5 +1029,6 @@ void MainWindow::on_actionFormat_triggered()
ShowMessage( "<b>Error finalizing formatting!</b>" ); ShowMessage( "<b>Error finalizing formatting!</b>" );
return; return;
} }
WriteTestLog();
ShowMessage( "Done!" ); ShowMessage( "Done!" );
} }

View File

@ -54,6 +54,8 @@ private:
void AddStuffToMetaFolder(); void AddStuffToMetaFolder();
QByteArray GenMeta( const QString &desc, quint64 tid, quint16 version ); QByteArray GenMeta( const QString &desc, quint64 tid, quint16 version );
void WriteTestLog();
public slots: public slots:
//slots for getting info from the NUS downloader //slots for getting info from the NUS downloader
void GetError( const QString &message, const NusJob &job ); void GetError( const QString &message, const NusJob &job );