mirror of
https://github.com/martravi/wiiqt6.git
synced 2024-12-24 03:51:49 +01:00
* account for the other, non-usa regions when creating default UID entries
* try to use the least possible ones amount of them while still being accurate git-svn-id: http://wiiqt.googlecode.com/svn/trunk@61 389f4c8b-5dfe-645f-db0e-df882bc27289
This commit is contained in:
parent
8e81f88928
commit
192789e01f
@ -58,7 +58,7 @@ public:
|
||||
//in the list, ask for it specifically.
|
||||
//lists are created from wiimpersonator logs when available. otherwise they come from examining game update partitions
|
||||
|
||||
static QMap< quint64, quint16 > List20u();
|
||||
static QMap< quint64, quint16 > List20u();//* there are no games ive seen that contain this update. this is just a guess
|
||||
static QMap< quint64, quint16 > List22u();
|
||||
static QMap< quint64, quint16 > List30u();
|
||||
static QMap< quint64, quint16 > List31u();
|
||||
@ -70,7 +70,7 @@ public:
|
||||
static QMap< quint64, quint16 > List42u();
|
||||
static QMap< quint64, quint16 > List43u();
|
||||
|
||||
static QMap< quint64, quint16 > List20e();
|
||||
static QMap< quint64, quint16 > List20e();//* there are no games ive seen that contain this update. this is just a guess
|
||||
static QMap< quint64, quint16 > List21e();
|
||||
static QMap< quint64, quint16 > List22e(); //* there are no games ive seen that contain this update. this is just a guess
|
||||
static QMap< quint64, quint16 > List30e();
|
||||
|
@ -106,7 +106,7 @@ quint32 UIDmap::GetUid( quint64 id, bool autoCreate )
|
||||
return qFromBigEndian( uid );
|
||||
}
|
||||
|
||||
void UIDmap::CreateNew( bool addFactorySetupDiscs )
|
||||
void UIDmap::CreateNew( quint8 addFactorySetupDiscs )
|
||||
{
|
||||
quint64 tid;
|
||||
quint32 uid;
|
||||
@ -125,9 +125,10 @@ void UIDmap::CreateNew( bool addFactorySetupDiscs )
|
||||
data = stuff;
|
||||
return;
|
||||
}
|
||||
quint8 reg = addFactorySetupDiscs;
|
||||
|
||||
//add some entries for the factory setup discs, as seen on my nand up until the first retail game
|
||||
for( quint32 i = 1; i < 0x2f; i++ )
|
||||
for( quint32 i = 1; i < 0x14; i++ )
|
||||
{
|
||||
switch( i )
|
||||
{
|
||||
@ -138,45 +139,18 @@ void UIDmap::CreateNew( bool addFactorySetupDiscs )
|
||||
case 0x5:tid = qFromBigEndian( 0x100000100ull ); break;
|
||||
case 0x6:tid = qFromBigEndian( 0x100000101ull ); break;
|
||||
case 0x7:tid = qFromBigEndian( 0x000100003132314aull ); break;
|
||||
case 0x8:tid = qFromBigEndian( 0x100000015ull ); break;
|
||||
case 0x9:tid = qFromBigEndian( 0x0001000030303032ull ); break;
|
||||
case 0xa:tid = qFromBigEndian( 0x100000003ull ); break;
|
||||
case 0xb:tid = qFromBigEndian( 0x10000000aull ); break;
|
||||
case 0xc:tid = qFromBigEndian( 0x10000000bull ); break;
|
||||
case 0xd:tid = qFromBigEndian( 0x10000000cull ); break;
|
||||
case 0xe:tid = qFromBigEndian( 0x10000000dull ); break;
|
||||
case 0xf:tid = qFromBigEndian( 0x10000000eull ); break;
|
||||
case 0x10:tid = qFromBigEndian( 0x10000000full ); break;
|
||||
case 0x11:tid = qFromBigEndian( 0x100000011ull ); break;
|
||||
case 0x12:tid = qFromBigEndian( 0x100000014ull ); break;
|
||||
case 0x13:tid = qFromBigEndian( 0x100000016ull ); break;
|
||||
case 0x14:tid = qFromBigEndian( 0x10000001cull ); break;
|
||||
case 0x15:tid = qFromBigEndian( 0x10000001eull ); break;
|
||||
case 0x16:tid = qFromBigEndian( 0x10000001full ); break;
|
||||
case 0x17:tid = qFromBigEndian( 0x100000021ull ); break;
|
||||
case 0x18:tid = qFromBigEndian( 0x100000022ull ); break;
|
||||
case 0x19:tid = qFromBigEndian( 0x100000023ull ); break;
|
||||
case 0x1a:tid = qFromBigEndian( 0x100000024ull ); break;
|
||||
case 0x1b:tid = qFromBigEndian( 0x100000025ull ); break;
|
||||
case 0x1c:tid = qFromBigEndian( 0x100000026ull ); break;
|
||||
case 0x1d:tid = qFromBigEndian( 0x100000032ull ); break;
|
||||
case 0x1e:tid = qFromBigEndian( 0x100000033ull ); break;
|
||||
case 0x1f:tid = qFromBigEndian( 0x100000035ull ); break;
|
||||
case 0x20:tid = qFromBigEndian( 0x100000037ull ); break;
|
||||
case 0x21:tid = qFromBigEndian( 0x1000000feull ); break;
|
||||
case 0x22:tid = qFromBigEndian( 0x0001000248414341ull ); break;
|
||||
case 0x23:tid = qFromBigEndian( 0x0001000248414141ull ); break;
|
||||
case 0x24:tid = qFromBigEndian( 0x0001000248415941ull ); break;
|
||||
case 0x25:tid = qFromBigEndian( 0x0001000248414641ull ); break;
|
||||
case 0x26:tid = qFromBigEndian( 0x0001000248414645ull ); break;
|
||||
case 0x27:tid = qFromBigEndian( 0x0001000248414241ull ); break;
|
||||
case 0x28:tid = qFromBigEndian( 0x0001000248414741ull ); break;
|
||||
case 0x29:tid = qFromBigEndian( 0x0001000248414745ull ); break;
|
||||
case 0x2a:tid = qFromBigEndian( 0x0001000848414b45ull ); break;
|
||||
case 0x2b:tid = qFromBigEndian( 0x0001000848414c45ull ); break;
|
||||
case 0x2c:tid = qFromBigEndian( 0x0001000148434745ull ); break;
|
||||
case 0x2d:tid = qFromBigEndian( 0x0001000031323245ull ); break;
|
||||
case 0x2e:tid = qFromBigEndian( 0x0001000030303033ull ); break;
|
||||
case 0x8:tid = qFromBigEndian( 0x10000000full ); break;
|
||||
case 0x9:tid = qFromBigEndian( 0x0001000030303032ull ); break;
|
||||
case 0xa:tid = qFromBigEndian( 0x10000000bull ); break;
|
||||
case 0xb:tid = qFromBigEndian( 0x10000000cull ); break;
|
||||
case 0xc:tid = qFromBigEndian( 0x10000000dull ); break;
|
||||
case 0xd:tid = qFromBigEndian( 0x0001000248414341ull ); break;
|
||||
case 0xe:tid = qFromBigEndian( 0x0001000248414141ull ); break;
|
||||
case 0xf:tid = qFromBigEndian( 0x0001000248414641ull ); break;
|
||||
case 0x10:tid = qFromBigEndian( 0x0001000248414241ull ); break;
|
||||
case 0x11:tid = qFromBigEndian( 0x0001000248414741ull ); break;
|
||||
case 0x12:tid = qFromBigEndian( (quint64)( 0x0001000848414b00ull | reg ) ); break;
|
||||
case 0x13:tid = qFromBigEndian( 0x0001000031323200ull ); break;
|
||||
default:
|
||||
qWarning() << "oops" << hex << i;
|
||||
return;
|
||||
|
@ -20,9 +20,10 @@ public:
|
||||
quint32 GetUid( quint64 tid, bool autoCreate = true );
|
||||
|
||||
//creates a new uid.sys with the system menu entry.
|
||||
//if addFactorySetupDiscs is true, it will add some entries for the setup discs used in the wii factory
|
||||
//if addFactorySetupDiscs is anything other than 0, it will add some entries for the setup discs used in the wii factory
|
||||
// addFactorySetupDiscs should be the region code: 0x45=E, 0x50=P...
|
||||
// ( serve no purpose other than to just exist )
|
||||
void CreateNew( bool addFactorySetupDiscs = false );
|
||||
void CreateNew( quint8 addFactorySetupDiscs = 0 );
|
||||
|
||||
//get th entire uid.sys data back in a state ready for writing to a nand
|
||||
const QByteArray Data(){ return data; }
|
||||
|
@ -359,6 +359,18 @@ void MainWindow::on_actionNew_nand_from_keys_triggered()
|
||||
InitNand( path );
|
||||
ui->lineEdit_nandPath->setText( path );
|
||||
|
||||
//these titles should be in order ( not really functional, but to emulate better how the wii comes from the factory )
|
||||
if( !nand.CreateEntry( "/title/00000001", 0, 0, NAND_DIR, NAND_RW, NAND_RW, NAND_READ )
|
||||
|| !nand.CreateEntry( "/title/00000001/00000004", 0, 0, NAND_DIR, NAND_RW, NAND_RW, NAND_READ )
|
||||
|| !nand.CreateEntry( "/title/00000001/00000009", 0, 0, NAND_DIR, NAND_RW, NAND_RW, NAND_READ )
|
||||
|| !nand.CreateEntry( "/title/00000001/00000002", 0, 0, NAND_DIR, NAND_RW, NAND_RW, NAND_READ )
|
||||
|| !nand.CreateEntry( "/title/00000001/00000100", 0, 0, NAND_DIR, NAND_RW, NAND_RW, NAND_READ )
|
||||
|| !nand.CreateEntry( "/title/00000001/00000101", 0, 0, NAND_DIR, NAND_RW, NAND_RW, NAND_READ ) )
|
||||
{
|
||||
ShowMessage( "<b>Error creating title subdirs<\b>" );
|
||||
return;
|
||||
}
|
||||
|
||||
//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 )
|
||||
@ -409,7 +421,7 @@ bool MainWindow::InitNand( const QString &path )
|
||||
QTreeWidgetItem *it = ItemFromPath( "/sys/uid.sys" );
|
||||
if( !it )
|
||||
{
|
||||
uid.CreateNew( true );
|
||||
uid.CreateNew();//dont add any UID besides the system menu since we dont know what region it will be
|
||||
if( !nand.CreateEntry( "/sys/uid.sys", 0, 0, NAND_FILE, NAND_RW, NAND_RW, 0 ) )
|
||||
{
|
||||
ShowMessage( "<b>Error creating new uid.sys</b>" );
|
||||
@ -640,11 +652,11 @@ bool MainWindow::InstallNUSItem( NusJob job )
|
||||
if( !CreateIfNeeded( "/title/" + upper + "/" + lower, 0, 0, NAND_DIR, NAND_RW, NAND_RW, NAND_READ ) )
|
||||
{ qWarning() << "can't create title+upper+lower folder";goto error;}
|
||||
|
||||
if( !CreateIfNeeded( "/title/" + upper + "/" + lower + "/content", 0, 0, NAND_DIR, NAND_RW, NAND_RW, 0 ) )
|
||||
{ qWarning() << "can't create content folder";goto error;}
|
||||
if( !CreateIfNeeded( "/title/" + upper + "/" + lower + "/data", _uid, _gid, NAND_DIR, NAND_RW, 0, 0 ) )
|
||||
{ qWarning() << "can't create data folder";goto error;}
|
||||
|
||||
if( !CreateIfNeeded( "/title/" + upper + "/" + lower + "/data", _uid, _gid, NAND_DIR, NAND_RW, 0, 0 ) )
|
||||
{ qWarning() << "can't create data folder";goto error;}
|
||||
if( !CreateIfNeeded( "/title/" + upper + "/" + lower + "/content", 0, 0, NAND_DIR, NAND_RW, NAND_RW, 0 ) )
|
||||
{ qWarning() << "can't create content folder";goto error;}
|
||||
|
||||
//delete old tmd/.apps and whatever else in the content folder
|
||||
content = ItemFromPath( "/title/" + upper + "/" + lower + "/content" );
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "newnandbin.h"
|
||||
#include "ui_newnandbin.h"
|
||||
#include "../WiiQt/uidmap.h"
|
||||
#include "../WiiQt/tools.h"
|
||||
|
||||
NewNandBin::NewNandBin( QWidget *parent, QList<quint16> badBlocks ) : QDialog(parent), ui(new Ui::NewNandBin), nand( this )
|
||||
@ -102,9 +103,59 @@ bool NewNandBin::CreateDefaultEntries()
|
||||
{
|
||||
qWarning() << "NewNandBin::on_buttonBox_accepted -> error creating cert in the new nand";
|
||||
QMessageBox::warning( this, tr( "Error" ), \
|
||||
tr( "Can't create cert.sys folders in the new nand." ) );
|
||||
tr( "Can't create cert.sys in the new nand." ) );
|
||||
return false;
|
||||
}
|
||||
//create uid.sys
|
||||
switch( ui->comboBox_uid->currentIndex() )
|
||||
{
|
||||
case 0:
|
||||
uidSys.clear();
|
||||
break;
|
||||
case 1://jap
|
||||
{
|
||||
UIDmap uid;
|
||||
uid.CreateNew( 0x4a );
|
||||
uidSys = uid.Data();
|
||||
}
|
||||
break;
|
||||
case 2://usa
|
||||
{
|
||||
UIDmap uid;
|
||||
uid.CreateNew( 0x45 );
|
||||
uidSys = uid.Data();
|
||||
}
|
||||
break;
|
||||
case 3://eur
|
||||
{
|
||||
UIDmap uid;
|
||||
uid.CreateNew( 0x50 );
|
||||
uidSys = uid.Data();
|
||||
}
|
||||
break;
|
||||
case 4://kor
|
||||
{
|
||||
UIDmap uid;
|
||||
uid.CreateNew( 0x4b );
|
||||
uidSys = uid.Data();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if( !uidSys.isEmpty() )
|
||||
{
|
||||
//hexdump( uidSys );
|
||||
quint16 fd = nand.CreateEntry( "/sys/uid.sys", 0, 0, NAND_FILE, NAND_RW, NAND_RW, 0 );
|
||||
if( !fd || !nand.SetData( fd, uidSys ) )
|
||||
{
|
||||
qWarning() << "NewNandBin::on_buttonBox_accepted -> error creating cert in the new nand";
|
||||
QMessageBox::warning( this, tr( "Error" ), \
|
||||
tr( "Can't create uid.sys in the new nand." ) );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//commit changes to metadata
|
||||
if( !nand.WriteMetaData() )
|
||||
{
|
||||
@ -268,12 +319,45 @@ void NewNandBin::on_pushButton_oldNand_clicked()
|
||||
quint16 block = ( i / 8 );
|
||||
badBlacks << block;
|
||||
QString txt = QString( "%1" ).arg( block );
|
||||
qDebug() << "bad cluster" << hex << i << block << txt;
|
||||
//qDebug() << "bad cluster" << hex << i << block << txt;
|
||||
//if( ui->listWidget_badBlocks->findItems( txt, Qt::MatchExactly ).isEmpty() )//just in case, but this should always be true
|
||||
ui->listWidget_badBlocks->addItem( txt );
|
||||
}
|
||||
}
|
||||
uidSys = old.GetData( "/sys/uid.sys" );
|
||||
if( !uidSys.isEmpty() )
|
||||
{
|
||||
uidSys = GetCleanUid( uidSys );
|
||||
ui->comboBox_uid->setCurrentIndex( 5 );
|
||||
//hexdump( uidSys );
|
||||
}
|
||||
ui->lineEdit_boot->setText( tr( "<From old nand>" ) );
|
||||
ui->lineEdit_keys->setText( tr( "<From old nand>" ) );
|
||||
|
||||
}
|
||||
|
||||
//remove all entries of a uid.sys from after the user has started doing stuff
|
||||
QByteArray NewNandBin::GetCleanUid( QByteArray old )
|
||||
{
|
||||
QBuffer buf( &old );
|
||||
buf.open( QIODevice::ReadWrite );
|
||||
|
||||
quint64 tid;
|
||||
quint16 titles = 0;
|
||||
quint32 cnt = old.size() / 12;
|
||||
for( quint32 i = 0; i < cnt; i++ )
|
||||
{
|
||||
buf.seek( i * 12 );
|
||||
buf.read( (char*)&tid, 8 );
|
||||
tid = qFromBigEndian( tid );
|
||||
quint32 upper = ( ( tid >> 32 ) & 0xffffffff );
|
||||
quint32 lower = ( tid & 0xffffffff );
|
||||
//qDebug() << QString( "%1" ).arg( tid, 16, 16, QChar( '0' ) ) << hex << upper << lower << ( ( lower >> 24 ) & 0xff ) << ( lower & 0xffff00 );
|
||||
if( ( upper == 0x10001 && ( ( lower >> 24 ) & 0xff ) != 0x48 ) || //a channel, not starting with 'H'
|
||||
( upper == 0x10000 && ( ( lower & 0xffff00 ) == 0x555000 ) ) ) //a disc update partition
|
||||
break;
|
||||
|
||||
titles++;
|
||||
}
|
||||
buf.close();
|
||||
return old.left( 12 * titles );
|
||||
}
|
||||
|
@ -29,8 +29,10 @@ private:
|
||||
|
||||
QByteArray boots;
|
||||
QByteArray keys;
|
||||
QByteArray uidSys;
|
||||
|
||||
bool CreateDefaultEntries();
|
||||
QByteArray GetCleanUid( QByteArray old );
|
||||
|
||||
private slots:
|
||||
void on_pushButton_oldNand_clicked();
|
||||
|
@ -6,15 +6,15 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>427</width>
|
||||
<height>290</height>
|
||||
<width>446</width>
|
||||
<height>269</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>New Nand</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0" colspan="3">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="pushButton_keys">
|
||||
@ -60,7 +60,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="1" column="0" rowspan="2">
|
||||
<widget class="QGroupBox" name="groupBox_bad">
|
||||
<property name="title">
|
||||
<string>Bad Blocks</string>
|
||||
@ -178,20 +178,82 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>149</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_oldNand">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>69</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Existing Nand...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>149</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<item row="2" column="1">
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_uid">
|
||||
<property name="text">
|
||||
<string>uid.sys</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBox_uid">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Jap</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Usa</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Eur</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Kor</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>From Old Nand</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -201,19 +263,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="pushButton_oldNand">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>69</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Existing Nand...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
Loading…
Reference in New Issue
Block a user