diff --git a/WiiQt/nusdownloader.cpp b/WiiQt/nusdownloader.cpp
index 4f65864..b1b48d2 100644
--- a/WiiQt/nusdownloader.cpp
+++ b/WiiQt/nusdownloader.cpp
@@ -2,7 +2,7 @@
#include "tools.h"
-NusDownloader::NusDownloader( QObject *parent, const QString &cPath ) : QObject( parent ), cachePath( cPath ), curTmd( QByteArray() )//, manager( this )
+NusDownloader::NusDownloader( QObject *parent, const QString &cPath ) : QObject( parent ), cachePath( cPath ), curTmd( QByteArray() )
{
currentJob.tid = 0;
currentJob.version = 0;
diff --git a/WiiQt/settingtxtdialog.cpp b/WiiQt/settingtxtdialog.cpp
index d5f4214..d6c8d70 100644
--- a/WiiQt/settingtxtdialog.cpp
+++ b/WiiQt/settingtxtdialog.cpp
@@ -2,7 +2,7 @@
#include "ui_settingtxtdialog.h"
#include "tools.h"
-SettingTxtDialog::SettingTxtDialog( QWidget *parent, const QByteArray &old ) : QDialog(parent), ui(new Ui::SettingTxtDialog)
+SettingTxtDialog::SettingTxtDialog( QWidget *parent, const QByteArray &old, qint8 region ) : QDialog(parent), ui(new Ui::SettingTxtDialog)
{
ui->setupUi( this );
if( !old.isEmpty() )
@@ -62,6 +62,36 @@ SettingTxtDialog::SettingTxtDialog( QWidget *parent, const QByteArray &old ) : Q
}
}
}
+ else
+ {
+ switch( region )
+ {
+ case SETTING_TXT_PAL:
+ ui->lineEdit_area->setText( "EUR" );
+ ui->lineEdit_model->setText( "RVL-001(EUR)" );
+ ui->lineEdit_code->setText( "LEH" );
+ ui->lineEdit_video->setText( "PAL" );
+ ui->lineEdit_game->setText( "EU" );
+ break;
+ case SETTING_TXT_JAP:
+ ui->lineEdit_area->setText( "JPN" );
+ ui->lineEdit_model->setText( "RVL-001(JPN)" );
+ ui->lineEdit_code->setText( "LJF" );
+ ui->lineEdit_video->setText( "NTSC" );
+ ui->lineEdit_game->setText( "JP" );
+ break;
+ case SETTING_TXT_KOR:
+ ui->lineEdit_area->setText( "KOR" );
+ ui->lineEdit_model->setText( "RVL-001(KOR)" );
+ ui->lineEdit_code->setText( "LKM" );
+ ui->lineEdit_video->setText( "NTSC" );
+ ui->lineEdit_game->setText( "KR" );
+ break;
+ case SETTING_TXT_USA://these are already the default values
+ default:
+ break;
+ }
+ }
}
SettingTxtDialog::~SettingTxtDialog()
@@ -107,9 +137,9 @@ QByteArray SettingTxtDialog::LolCrypt( QByteArray ba )
return ret;
}
-QByteArray SettingTxtDialog::Edit( QWidget *parent, const QByteArray &old )
+QByteArray SettingTxtDialog::Edit( QWidget *parent, const QByteArray &old, qint8 region )
{
- SettingTxtDialog d( parent, old );
+ SettingTxtDialog d( parent, old, region );
if( d.exec() )
return d.ret;
return QByteArray();
diff --git a/WiiQt/settingtxtdialog.h b/WiiQt/settingtxtdialog.h
index 1c4ec46..73055eb 100644
--- a/WiiQt/settingtxtdialog.h
+++ b/WiiQt/settingtxtdialog.h
@@ -8,20 +8,29 @@
namespace Ui {
class SettingTxtDialog;
}
+enum
+{
+ SETTING_TXT_JAP = 0,
+ SETTING_TXT_USA,
+ SETTING_TXT_PAL,
+ SETTING_TXT_KOR,
+ SETTING_TXT_UNK
+};
class SettingTxtDialog : public QDialog
{
Q_OBJECT
public:
- explicit SettingTxtDialog( QWidget *parent = 0, const QByteArray &old = QByteArray() );
+ explicit SettingTxtDialog( QWidget *parent = 0, const QByteArray &old = QByteArray(), qint8 region = SETTING_TXT_UNK );
~SettingTxtDialog();
- //displays a dialog window with teh given parent. if any data is ginev as old, it will try to populate the dialog with that
+ //displays a dialog window with the given parent. if any data is given as old, it will try to populate the dialog with that
// otherwise it will use the defaulte values
// returns empty if the user clicked cancel, or a bytearray containing an encrypted setting.txt if they clicked ok
// the data is ready for writing to a wii nand
- static QByteArray Edit( QWidget *parent = 0, const QByteArray &old = QByteArray() );
+ // if an empty byte array is given as old, a region can be specified to populate default values instaed
+ static QByteArray Edit( QWidget *parent = 0, const QByteArray &old = QByteArray(), qint8 region = SETTING_TXT_UNK );
static QByteArray LolCrypt( QByteArray ba );
private:
diff --git a/WiiQt/settingtxtdialog.ui b/WiiQt/settingtxtdialog.ui
index cf24ad4..f437c5d 100644
--- a/WiiQt/settingtxtdialog.ui
+++ b/WiiQt/settingtxtdialog.ui
@@ -96,7 +96,7 @@
-
- 622011873
+ 632011873
9
diff --git a/nand_dump/mainwindow.cpp b/nand_dump/mainwindow.cpp
index e648025..42b5e4e 100644
--- a/nand_dump/mainwindow.cpp
+++ b/nand_dump/mainwindow.cpp
@@ -22,7 +22,11 @@ MainWindow::MainWindow( QWidget *parent ) : QMainWindow( parent ), ui( new Ui::M
//TODO, really get these paths from settings
+#ifdef Q_WS_WIN
+ QString cachePath = "../../NUS_cache";
+#else
QString cachePath = "../NUS_cache";
+#endif
QString nandPath = "./dump";
@@ -32,12 +36,7 @@ MainWindow::MainWindow( QWidget *parent ) : QMainWindow( parent ), ui( new Ui::M
//nand.SetPath( nandPath );
-
-
-
nus.SetCachePath( cachePath );
-
-
}
MainWindow::~MainWindow()
@@ -92,7 +91,14 @@ void MainWindow::NusIsDone()
QByteArray set = nand.GetSettingTxt();
if( set.isEmpty() )
{
- set = SettingTxtDialog::Edit( this );
+ quint8 reg = SETTING_TXT_UNK;
+ if( ui->lineEdit_tid->text().endsWith( "e", Qt::CaseInsensitive ) && ui->lineEdit_tid->text().size() == 4 )
+ reg = SETTING_TXT_PAL;
+ if( ui->lineEdit_tid->text().endsWith( "j", Qt::CaseInsensitive ) && ui->lineEdit_tid->text().size() == 4 )
+ reg = SETTING_TXT_JAP;
+ if( ui->lineEdit_tid->text().endsWith( "k", Qt::CaseInsensitive ) && ui->lineEdit_tid->text().size() == 4 )
+ reg = SETTING_TXT_KOR;
+ set = SettingTxtDialog::Edit( this, QByteArray(), reg );
if( !set.isEmpty() )
nand.SetSettingTxt( set );
}
@@ -409,7 +415,7 @@ void MainWindow::SaveJobToFolder( NusJob job )
ShowMessage( tr( "Wrote title to %1" ).arg( fi.absoluteFilePath() + "/" + newFName ) );
}
-//save a conpleted job to wad
+//save a completed job to wad
void MainWindow::SaveJobToWad( NusJob job )
{
QString title = QString( "%1v%2" ).arg( job.tid, 16, 16, QChar( '0' ) ).arg( job.version );
@@ -463,3 +469,13 @@ void MainWindow::SaveJobToWad( NusJob job )
}
+
+void MainWindow::on_pushButton_CachePathBrowse_clicked()
+{
+ QString f = QFileDialog::getExistingDirectory( this, tr( "Select NUS Cache base folder" ) );
+ if( f.isEmpty() )
+ return;
+
+ ui->lineEdit_cachePath->setText( f );
+ nus.SetCachePath( ui->lineEdit_cachePath->text() );
+}
diff --git a/nand_dump/mainwindow.h b/nand_dump/mainwindow.h
index 2208d7f..2553b57 100644
--- a/nand_dump/mainwindow.h
+++ b/nand_dump/mainwindow.h
@@ -39,6 +39,7 @@ public slots:
private slots:
+ void on_pushButton_CachePathBrowse_clicked();
void on_actionFlush_triggered();
void on_actionSetting_txt_triggered();
void on_actionImportWad_triggered();
diff --git a/ohneschwanzenegger/mainwindow.cpp b/ohneschwanzenegger/mainwindow.cpp
index 65733d6..d48f287 100644
--- a/ohneschwanzenegger/mainwindow.cpp
+++ b/ohneschwanzenegger/mainwindow.cpp
@@ -32,15 +32,16 @@ MainWindow::MainWindow( QWidget *parent ) : QMainWindow( parent ), ui( new Ui::M
connect( &nand, SIGNAL( SendText( QString ) ), ui->statusBar, SLOT( showMessage( QString ) ) );
//TODO, really get these paths from settings
-
+#ifdef Q_WS_WIN
+ QString cachePath = "../../NUS_cache";
+#else
QString cachePath = "../NUS_cache";
+#endif
QString nandPath = "./testNand.bin";
- //QString keyPath = "../keys.bin";
ui->lineEdit_cachePath->setText( cachePath );
ui->lineEdit_nandPath->setText( nandPath );
- //ui->lineEdit_keys->setText( keyPath );
nus.SetCachePath( cachePath );
}
@@ -91,7 +92,14 @@ void MainWindow::NusIsDone()
QTreeWidgetItem *item = ItemFromPath( "/title/00000001/00000002/data/setting.txt" );
if( !item )
{
- QByteArray ba = SettingTxtDialog::Edit( this ); //call a dialog to create a new setting.txt
+ quint8 reg = SETTING_TXT_UNK;
+ if( ui->lineEdit_tid->text().endsWith( "e", Qt::CaseInsensitive ) && ui->lineEdit_tid->text().size() == 4 )
+ reg = SETTING_TXT_PAL;
+ if( ui->lineEdit_tid->text().endsWith( "j", Qt::CaseInsensitive ) && ui->lineEdit_tid->text().size() == 4 )
+ reg = SETTING_TXT_JAP;
+ if( ui->lineEdit_tid->text().endsWith( "k", Qt::CaseInsensitive ) && ui->lineEdit_tid->text().size() == 4 )
+ reg = SETTING_TXT_KOR;
+ QByteArray ba = SettingTxtDialog::Edit( this, QByteArray(), reg ); //call a dialog to create a new setting.txt
if( !ba.isEmpty() ) //if the dialog returned anything ( cancel wasnt pressed ) write that new setting.txt to the nand
{
quint16 r = nand.CreateEntry( "/title/00000001/00000002/data/setting.txt", 0x1000, 1, NAND_FILE, NAND_READ, NAND_READ, NAND_READ );
@@ -201,6 +209,15 @@ void MainWindow::on_pushButton_nandPath_clicked()
return;
ui->lineEdit_nandPath->setText( f );
+}
+
+void MainWindow::on_pushButton_CachePathBrowse_clicked()
+{
+ QString f = QFileDialog::getExistingDirectory( this, tr( "Select NUS Cache base folder" ) );
+ if( f.isEmpty() )
+ return;
+
+ ui->lineEdit_cachePath->setText( f );
nus.SetCachePath( ui->lineEdit_cachePath->text() );
}
diff --git a/ohneschwanzenegger/mainwindow.h b/ohneschwanzenegger/mainwindow.h
index 6b5d078..d677a6d 100644
--- a/ohneschwanzenegger/mainwindow.h
+++ b/ohneschwanzenegger/mainwindow.h
@@ -54,6 +54,7 @@ public slots:
void ReceiveTitleFromNus( NusJob job );
private slots:
+ void on_pushButton_CachePathBrowse_clicked();
void on_actionAbout_triggered();
void on_pushButton_initNand_clicked();
void on_actionNew_nand_from_keys_triggered();
diff --git a/ohneschwanzenegger/newnandbin.cpp b/ohneschwanzenegger/newnandbin.cpp
index c9cdd96..da295d1 100644
--- a/ohneschwanzenegger/newnandbin.cpp
+++ b/ohneschwanzenegger/newnandbin.cpp
@@ -4,6 +4,7 @@
NewNandBin::NewNandBin( QWidget *parent, QList badBlocks ) : QDialog(parent), ui(new Ui::NewNandBin), nand( this )
{
+ dir = QDir::currentPath();
ui->setupUi(this);
foreach( quint16 block, badBlocks )
{
@@ -20,26 +21,29 @@ NewNandBin::~NewNandBin()
void NewNandBin::on_pushButton_keys_clicked()
{
- QString f = QFileDialog::getOpenFileName( this, tr( "Select Keys.bin" ) );
+ QString f = QFileDialog::getOpenFileName( this, tr( "Select Keys.bin" ), dir );
if( f.isEmpty() )
return;
ui->lineEdit_keys->setText( f );
+ dir = QFileInfo( f ).canonicalPath();
}
void NewNandBin::on_pushButton_boot_clicked()
{
- QString f = QFileDialog::getOpenFileName( this, tr( "Select Boot 1 & 2" ) );
+ QString f = QFileDialog::getOpenFileName( this, tr( "Select Boot 1 & 2" ), dir );
if( f.isEmpty() )
return;
ui->lineEdit_boot->setText( f );
+ dir = QFileInfo( f ).canonicalPath();
}
void NewNandBin::on_pushButton_dest_clicked()
{
- QString f = QFileDialog::getSaveFileName( this, tr( "Output file" ) );
+ QString f = QFileDialog::getSaveFileName( this, tr( "Output file" ), dir );
if( f.isEmpty() )
return;
ui->lineEdit_dest->setText( f );
+ dir = QFileInfo( f ).canonicalPath();
}
QList NewNandBin::BadBlocks()
@@ -62,7 +66,6 @@ void NewNandBin::on_pushButton_bb_add_clicked()
if( !BadBlocks().contains( val ) )
{
ui->listWidget_badBlocks->addItem( QString( "%1" ).arg( val ) );
- //QListWidgetItem *i = new QListWidgetItem( QString( "%1" ).arg( val ), ui->listWidget_badBlocks );
}
}
@@ -121,3 +124,37 @@ QString NewNandBin::GetNewNandPath( QWidget *parent, QList badBlocks )
return QString();
return d.ret;
}
+
+//read bad blocks from a txt file
+void NewNandBin::on_pushButton_badBlockFile_clicked()
+{
+ QString f = QFileDialog::getOpenFileName( this, tr( "Select File with Bad Block List" ), dir );
+ if( f.isEmpty() )
+ return;
+ dir = QFileInfo( f ).canonicalPath();
+ QString str = QString( ReadFile( f ) );
+ if( str.isEmpty() )
+ {
+ qWarning() << "NewNandBin::on_pushButton_badBlockFile_clicked -> error reading file";
+ return;
+ }
+ ui->listWidget_badBlocks->clear();
+
+ str.replace( "\r\n", "\n" );
+ QStringList lines = str.split( "\n", QString::SkipEmptyParts );
+ foreach( QString line, lines )
+ {
+ if( line.size() > 5 )
+ continue;
+ bool ok = false;
+
+ if( ui->listWidget_badBlocks->findItems( line, Qt::MatchExactly ).size() )//this one is already in the list
+ continue;
+
+ quint16 bb = line.toInt( &ok );
+ if( !ok || bb < 8 || bb > 4079 )
+ continue;
+
+ ui->listWidget_badBlocks->addItem( line );
+ }
+}
diff --git a/ohneschwanzenegger/newnandbin.h b/ohneschwanzenegger/newnandbin.h
index 558c7a2..156898c 100644
--- a/ohneschwanzenegger/newnandbin.h
+++ b/ohneschwanzenegger/newnandbin.h
@@ -25,8 +25,10 @@ private:
NandBin nand;
QString ret;
+ QString dir;
private slots:
+ void on_pushButton_badBlockFile_clicked();
void on_buttonBox_accepted();
void on_pushButton_bb_rm_clicked();
void on_pushButton_bb_add_clicked();
diff --git a/ohneschwanzenegger/newnandbin.ui b/ohneschwanzenegger/newnandbin.ui
index 5943d28..0e41f83 100644
--- a/ohneschwanzenegger/newnandbin.ui
+++ b/ohneschwanzenegger/newnandbin.ui
@@ -138,6 +138,13 @@
+ -
+
+
+ From txt...
+
+
+
-