diff --git a/.gitattributes b/.gitattributes index f284540..05cce83 100644 --- a/.gitattributes +++ b/.gitattributes @@ -86,7 +86,9 @@ ohneschwanzenegger/mainwindow.ui -text ohneschwanzenegger/newnandbin.cpp -text ohneschwanzenegger/newnandbin.h -text ohneschwanzenegger/newnandbin.ui -text +ohneschwanzenegger/rc.qrc -text ohneschwanzenegger/refleurii.pro -text +ohneschwanzenegger/testlog.txt -text saveToy/includes.h -text saveToy/main.cpp -text saveToy/mainwindow.cpp -text diff --git a/ohneschwanzenegger/main.cpp b/ohneschwanzenegger/main.cpp index 9ae175b..9b7c5df 100644 --- a/ohneschwanzenegger/main.cpp +++ b/ohneschwanzenegger/main.cpp @@ -3,6 +3,7 @@ int main(int argc, char *argv[]) { + Q_INIT_RESOURCE( rc ); QApplication a(argc, argv); MainWindow w; w.show(); diff --git a/ohneschwanzenegger/mainwindow.cpp b/ohneschwanzenegger/mainwindow.cpp index 1d23433..af3a73b 100644 --- a/ohneschwanzenegger/mainwindow.cpp +++ b/ohneschwanzenegger/mainwindow.cpp @@ -7,6 +7,14 @@ #include "../WiiQt/tools.h" #include "../WiiQt/wad.h" +//on 1 of my wiis, disc 123J owns the test directory & testlog. this wii came from the factory as 3.2u +//#define NAND_TEST_OWNER 0x100003132334aull + +//on my later wiis, disc 121J owns the test directory & testlog. all came with 4.2u or later +#define NAND_TEST_OWNER 0x100003132314aull + +//the group of the test dir/files seems to always be 4 +#define NAND_TEST_GROUP 4 MainWindow::MainWindow( QWidget *parent ) : QMainWindow( parent ), ui( new Ui::MainWindow ), nus ( this ), nand ( this ) { @@ -243,7 +251,7 @@ void MainWindow::on_actionSetting_txt_triggered() //nand-dump -> flush void MainWindow::on_actionFlush_triggered() { - if( !nandInited ) + if( nandInited ) FlushNand(); } @@ -298,6 +306,29 @@ void MainWindow::on_actionNew_nand_from_keys_triggered() return; InitNand( path ); ui->lineEdit_nandPath->setText( path ); + + //add some factory test logs and whatnot + 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 ) + || !nand.CreateEntry( "/shared2/sys", _uid, NAND_TEST_GROUP, NAND_DIR, NAND_RW, NAND_RW, NAND_RW ) ) + { + ShowMessage( "Error creating folder for testlog<\b>" ); + return; + } + quint16 handle = nand.CreateEntry( "/shared2/test/testlog.txt", _uid, NAND_TEST_GROUP, NAND_FILE, NAND_RW, NAND_RW, NAND_RW ); + if( !handle ) + { + ShowMessage( "Error creating testlog<\b>" ); + return; + } + QByteArray tLog = ReadFile( ":/testlog.txt" ); + if( !nand.SetData( handle, tLog ) ) + { + ShowMessage( "Error writing to testlog.txt<\b>" ); + return; + } + UpdateTree(); + ShowMessage( "Created /shared2/test/testlog.txt" ); } void MainWindow::on_pushButton_initNand_clicked() @@ -307,7 +338,7 @@ void MainWindow::on_pushButton_initNand_clicked() ShowMessage( "Please enter a path for nand.bin<\b>" ); return; } - InitNand( ui->lineEdit_nandPath->text() ); + InitNand( ui->lineEdit_nandPath->text() ); } bool MainWindow::InitNand( const QString &path ) diff --git a/ohneschwanzenegger/rc.qrc b/ohneschwanzenegger/rc.qrc new file mode 100644 index 0000000..835d340 --- /dev/null +++ b/ohneschwanzenegger/rc.qrc @@ -0,0 +1,5 @@ + + + testlog.txt + + diff --git a/ohneschwanzenegger/refleurii.pro b/ohneschwanzenegger/refleurii.pro index 95fb087..fee7878 100644 --- a/ohneschwanzenegger/refleurii.pro +++ b/ohneschwanzenegger/refleurii.pro @@ -47,3 +47,6 @@ HEADERS += mainwindow.h \ FORMS += mainwindow.ui \ ../WiiQt/settingtxtdialog.ui \ newnandbin.ui + +RESOURCES += \ + rc.qrc diff --git a/ohneschwanzenegger/testlog.txt b/ohneschwanzenegger/testlog.txt new file mode 100644 index 0000000..b337e68 Binary files /dev/null and b/ohneschwanzenegger/testlog.txt differ