* ohneswanzenegger: dont include code for building extracted FS

This commit is contained in:
giantpune 2011-05-15 23:17:06 +00:00
parent b6330b362d
commit 32cf8113e4
3 changed files with 109 additions and 120 deletions

View File

@ -26,8 +26,8 @@ bool NandDump::Flush()
bool NandDump::SetPath( const QString &path ) bool NandDump::SetPath( const QString &path )
{ {
qDebug() << "NandDump::SetPath(" << path << ")"; qDebug() << "NandDump::SetPath(" << path << ")";
uidDirty = true; uidDirty = true;
cmDirty = true; cmDirty = true;
//check what is already in this path and create stuff that is missing //check what is already in this path and create stuff that is missing
QFileInfo fi( path ); QFileInfo fi( path );
basePath = fi.absoluteFilePath(); basePath = fi.absoluteFilePath();
@ -379,9 +379,9 @@ bool NandDump::InstallNusItem( const NusJob &job )
} }
quint32 cnt = qFromBigEndian( t.payload()->num_contents ); quint32 cnt = qFromBigEndian( t.payload()->num_contents );
if( cnt != (quint32)job.data.size() - 2 ) if( cnt != (quint32)job.data.size() - 2 )
{ {
qWarning() << "cnt != (quint32)job.data.size()"; qWarning() << "cnt != (quint32)job.data.size()";
AbortInstalling( job.tid ); AbortInstalling( job.tid );
return false; return false;
} }
@ -440,80 +440,80 @@ bool NandDump::InstallNusItem( const NusJob &job )
bool NandDump::InstallWad( Wad wad ) bool NandDump::InstallWad( Wad wad )
{ {
if( !wad.Tid() || wad.content_count() < 3 ) if( !wad.Tid() || wad.content_count() < 3 )
{ {
qWarning() << "NandDump::InstallNusItem -> invalid item"; qWarning() << "NandDump::InstallNusItem -> invalid item";
return false; return false;
} }
if( !uidDirty ) if( !uidDirty )
{ {
uidDirty = uidMap.GetUid( wad.Tid(), false ) == 0;//only flag the uid as dirty if it has to be, this way it is only flushed if needed uidDirty = uidMap.GetUid( wad.Tid(), false ) == 0;//only flag the uid as dirty if it has to be, this way it is only flushed if needed
} }
uidMap.GetUid( wad.Tid() ); uidMap.GetUid( wad.Tid() );
QString p = QString( "%1" ).arg( wad.Tid(), 16, 16, QChar( '0' ) ); QString p = QString( "%1" ).arg( wad.Tid(), 16, 16, QChar( '0' ) );
p.insert( 8 ,"/" ); p.insert( 8 ,"/" );
p.prepend( "/title/" ); p.prepend( "/title/" );
QString path = basePath + p + "/content"; QString path = basePath + p + "/content";
//remove old title if it exists //remove old title if it exists
AbortInstalling( wad.Tid() ); AbortInstalling( wad.Tid() );
if( !QFileInfo( path ).exists() && !QDir().mkpath( path ) ) if( !QFileInfo( path ).exists() && !QDir().mkpath( path ) )
return false; return false;
path = basePath + p + "/data"; path = basePath + p + "/data";
if( !QFileInfo( path ).exists() && !QDir().mkpath( path ) ) if( !QFileInfo( path ).exists() && !QDir().mkpath( path ) )
return false; return false;
QByteArray ba = wad.getTmd(); QByteArray ba = wad.getTmd();
if( !InstallTmd( ba, wad.Tid() ) ) if( !InstallTmd( ba, wad.Tid() ) )
return false; return false;
Tmd t( ba ); Tmd t( ba );
ba = wad.getTik(); ba = wad.getTik();
//Ticket ti( ba ); //Ticket ti( ba );
if( !InstallTicket( ba, wad.Tid() ) ) if( !InstallTicket( ba, wad.Tid() ) )
{ {
AbortInstalling( wad.Tid() ); AbortInstalling( wad.Tid() );
return false; return false;
} }
quint32 cnt = qFromBigEndian( t.payload()->num_contents ); quint32 cnt = qFromBigEndian( t.payload()->num_contents );
if( cnt != wad.content_count() ) if( cnt != wad.content_count() )
{ {
AbortInstalling( wad.Tid() ); AbortInstalling( wad.Tid() );
return false; return false;
} }
for( quint32 i = 0; i < cnt; i++ ) for( quint32 i = 0; i < cnt; i++ )
{ {
QByteArray decData = wad.Content(i); QByteArray decData = wad.Content(i);
if( t.Type( i ) == 0x8001 ) if( t.Type( i ) == 0x8001 )
{ {
if( !InstallSharedContent( decData, t.Hash( i ) ) ) if( !InstallSharedContent( decData, t.Hash( i ) ) )
{ {
AbortInstalling( wad.Tid() ); AbortInstalling( wad.Tid() );
return false; return false;
} }
} }
else if( t.Type( i ) == 1 ) else if( t.Type( i ) == 1 )
{ {
if( !InstallPrivateContent( decData, wad.Tid(), t.Cid( i ) ) ) if( !InstallPrivateContent( decData, wad.Tid(), t.Cid( i ) ) )
{ {
AbortInstalling( wad.Tid() ); AbortInstalling( wad.Tid() );
return false; return false;
} }
} }
else//unknown content type else//unknown content type
{ {
qWarning() << "NandDump::InstallWad -> unknown content type"; qWarning() << "NandDump::InstallWad -> unknown content type";
AbortInstalling( wad.Tid() ); AbortInstalling( wad.Tid() );
return false; return false;
} }
} }
return true; return true;
} }
QMap< quint64, quint16 > NandDump::GetInstalledTitles() QMap< quint64, quint16 > NandDump::GetInstalledTitles()
@ -885,7 +885,7 @@ bool NandDump::InstallSave( const SaveGame &save )
QString path = basePath + p + "/data"; QString path = basePath + p + "/data";
//make sure the path exists //make sure the path exists
if( !QFileInfo( path ).exists() && !QDir().mkpath( path ) ) if( !QFileInfo( path ).exists() && !QDir().mkpath( path ) )
{ {
qWarning() << "NandDump::InstallSave -> error creating" << path; qWarning() << "NandDump::InstallSave -> error creating" << path;
return false; return false;
@ -894,13 +894,13 @@ bool NandDump::InstallSave( const SaveGame &save )
if( !QFileInfo( basePath + p + "/content" ).exists() ) if( !QFileInfo( basePath + p + "/content" ).exists() )
QDir().mkpath( basePath + p + "/content" ); QDir().mkpath( basePath + p + "/content" );
path = p + "/data"; path = p + "/data";
quint16 dataIdx = 0; quint16 dataIdx = 0;
quint16 entryIdx = 0; quint16 entryIdx = 0;
foreach( QString entry, save.entries ) foreach( QString entry, save.entries )
{ {
QString cp = ToNandPath( entry ); QString cp = ToNandPath( entry );
quint8 attr = save.attr.at( entryIdx ); quint8 attr = save.attr.at( entryIdx );
if( NAND_ATTR_TYPE( attr ) == NAND_FILE )//this is a file if( NAND_ATTR_TYPE( attr ) == NAND_FILE )//this is a file
{ {

View File

@ -46,7 +46,7 @@ public:
//if it doesnt exist, the function will try to create it //if it doesnt exist, the function will try to create it
//also creates the normal folders in the nand //also creates the normal folders in the nand
bool SetPath( const QString &path ); bool SetPath( const QString &path );
const QString GetPath(){ return basePath; } const QString &GetPath(){ return basePath; }
//installs a title to the nand dump from an already existing NusJob //installs a title to the nand dump from an already existing NusJob
//returns false if something went wrong //returns false if something went wrong

View File

@ -1,52 +1,41 @@
#------------------------------------------------- # -------------------------------------------------
#
# Project created by QtCreator 2010-12-02T23:30:12 # Project created by QtCreator 2010-12-02T23:30:12
# # -------------------------------------------------
#------------------------------------------------- QT += core \
gui \
QT += core gui\ network
network
TARGET = ohneschwanzenegger TARGET = ohneschwanzenegger
TEMPLATE = app TEMPLATE = app
DEFINES += NAND_BIN_CAN_WRITE DEFINES += NAND_BIN_CAN_WRITE
SOURCES += main.cpp \
mainwindow.cpp \
SOURCES += main.cpp\
mainwindow.cpp \
../WiiQt/tools.cpp \ ../WiiQt/tools.cpp \
../WiiQt/sharedcontentmap.cpp \ ../WiiQt/sharedcontentmap.cpp \
../WiiQt/tiktmd.cpp \ ../WiiQt/tiktmd.cpp \
../WiiQt/nusdownloader.cpp \ ../WiiQt/nusdownloader.cpp \
../WiiQt/uidmap.cpp \ ../WiiQt/uidmap.cpp \
../WiiQt/nanddump.cpp \
../WiiQt/settingtxtdialog.cpp \ ../WiiQt/settingtxtdialog.cpp \
../WiiQt/wad.cpp \ ../WiiQt/wad.cpp \
../WiiQt/aes.c \ ../WiiQt/aes.c \
../WiiQt/sha1.c \ ../WiiQt/sha1.c \
newnandbin.cpp \ newnandbin.cpp \
../WiiQt/nandbin.cpp \ ../WiiQt/nandbin.cpp \
../WiiQt/nandspare.cpp\ ../WiiQt/nandspare.cpp \
../WiiQt/blocks0to7.cpp ../WiiQt/blocks0to7.cpp
HEADERS += mainwindow.h \
HEADERS += mainwindow.h \
../WiiQt/tools.h \ ../WiiQt/tools.h \
../WiiQt/uidmap.h \ ../WiiQt/uidmap.h \
../WiiQt/sharedcontentmap.h \ ../WiiQt/sharedcontentmap.h \
../WiiQt/tiktmd.h \ ../WiiQt/tiktmd.h \
../WiiQt/nusdownloader.h \ ../WiiQt/nusdownloader.h \
../WiiQt/uidmap.h \ ../WiiQt/uidmap.h \
../WiiQt/nanddump.h \
../WiiQt/settingtxtdialog.h \ ../WiiQt/settingtxtdialog.h \
../WiiQt/wad.h \ ../WiiQt/wad.h \
newnandbin.h \ newnandbin.h \
../WiiQt/nandbin.h \ ../WiiQt/nandbin.h \
../WiiQt/nandspare.h\ ../WiiQt/nandspare.h \
../WiiQt/blocks0to7.h ../WiiQt/blocks0to7.h
FORMS += mainwindow.ui \
FORMS += mainwindow.ui \
../WiiQt/settingtxtdialog.ui \ ../WiiQt/settingtxtdialog.ui \
newnandbin.ui newnandbin.ui
RESOURCES += rc.qrc
RESOURCES += \
rc.qrc