mirror of
https://github.com/martravi/wiiqt.git
synced 2024-12-26 17:31:49 +01:00
*u8: add support for checking if an archive was packed with wii.cs to allow fixing it
use case-insensitivity. seems all the nintendo tools are running on windows and in the system menu html, paths are case-insensitive. it doesnt seem like there is anywhere where they would need to be the other way * lz77: support for unpacking archives larger than 0xffffff bytes * nusdownloader: dont try to write files to cache if there is not one set
This commit is contained in:
parent
f4a991de29
commit
c71ac45ab2
@ -189,7 +189,12 @@ QByteArray LZ77::Decompress( const QByteArray &compressed, int offset )
|
||||
infile.read( (char*)&gbaheader, 4 );
|
||||
|
||||
decomp_size = gbaheader >> 8;
|
||||
if( !decomp_size )
|
||||
{
|
||||
infile.read( (char*)&decomp_size, 4 );
|
||||
}
|
||||
quint8 text_buf[ N + 17 ];
|
||||
//qDebug() << "decomp_size:" << decomp_size;
|
||||
|
||||
for( i = 0; i < N - F; i++ )
|
||||
text_buf[ i ] = 0xdf;
|
||||
|
@ -332,6 +332,9 @@ QString NusDownloader::GetCachePath( quint32 idx )
|
||||
if( currentJob.version == TITLE_LATEST_VERSION || !currentJob.tid )//c'mon guy
|
||||
return QString();
|
||||
|
||||
if( cachePath.isEmpty() )
|
||||
return QString();
|
||||
|
||||
QString path = cachePath;
|
||||
if( path.endsWith( "/" ) )
|
||||
path.resize( path.size() - 1 );
|
||||
@ -486,7 +489,7 @@ void NusDownloader::StartDownload()
|
||||
//qDebug() << "NusDownloader::StartDownload" << dlJob.index;
|
||||
emit SendDownloadProgress( 0 );
|
||||
QString dlUrl = NUS_BASE_URL + dlJob.tid + "/" + dlJob.name;
|
||||
//qDebug() << "url" << dlUrl;
|
||||
qDebug() << "url" << dlUrl;
|
||||
currentJobText = dlUrl;
|
||||
|
||||
QUrl url( dlUrl );
|
||||
|
16
WiiQt/u8.cpp
16
WiiQt/u8.cpp
@ -19,6 +19,7 @@ U8::U8( bool initialize, int type, const QStringList &names )
|
||||
{
|
||||
ok = false;
|
||||
isLz77 = false;
|
||||
wii_cs_error = false;
|
||||
paths.clear();
|
||||
nestedU8s.clear();
|
||||
fst = NULL;
|
||||
@ -876,11 +877,17 @@ void U8::CreateEntryList()
|
||||
{
|
||||
qWarning() << "This archive was made by a broken tool such as U8Mii. I'm trying to fix it, but I can't make any promises";
|
||||
fixWarn = true;
|
||||
wii_cs_error = true;
|
||||
}
|
||||
fst[ current ].ParentOffset = qFromBigEndian( folder );
|
||||
#ifndef U8_DONT_FIX_RECURSION_ERRORS
|
||||
fst[ current ].ParentOffset = qFromBigEndian( folder );
|
||||
#endif
|
||||
}
|
||||
//#ifndef U8_DONT_FIX_RECURSION_ERRORS
|
||||
// fst[ current ].ParentOffset = qFromBigEndian( folder );
|
||||
//#endif
|
||||
}
|
||||
path += "/";
|
||||
path += '/';
|
||||
paths << path;
|
||||
}
|
||||
else
|
||||
@ -924,6 +931,7 @@ void U8::CreateEntryList()
|
||||
|
||||
U8::U8( const QByteArray &ba )
|
||||
{
|
||||
wii_cs_error = false;
|
||||
//qDebug() << "U8::U8 dataSize:" << hex << ba.size();
|
||||
Load( ba );
|
||||
}
|
||||
@ -931,6 +939,7 @@ U8::U8( const QByteArray &ba )
|
||||
void U8::Load( const QByteArray &ba )
|
||||
{
|
||||
ok = false;
|
||||
wii_cs_error = false;
|
||||
isLz77 = false;
|
||||
headerType = U8_Hdr_none;
|
||||
paths.clear();
|
||||
@ -1063,7 +1072,8 @@ int U8::FindEntry( const QString &str, int d )
|
||||
else
|
||||
item = str;
|
||||
|
||||
if( FstName( entry ) == item )
|
||||
if( !FstName( entry ).compare( item, Qt::CaseInsensitive ) )
|
||||
//if( FstName( entry ) == item )
|
||||
{
|
||||
if( item == str || item + "/" == str )//this is the item we are looking for
|
||||
{
|
||||
|
@ -151,12 +151,17 @@ public:
|
||||
//reads from the fst and makes the list of paths
|
||||
void CreateEntryList();
|
||||
|
||||
// if this archive was packed by any of the wii.cs tools and it is not
|
||||
// a standard banner, it will be incorrectly packed, and this will return true
|
||||
bool IsBuggy(){ return wii_cs_error; }
|
||||
|
||||
private:
|
||||
QByteArray data;//data starting at the U8 tag
|
||||
QStringList paths;
|
||||
bool ok;
|
||||
|
||||
bool wii_cs_error;
|
||||
|
||||
//if this archive as a whole is lz77 compressed
|
||||
bool isLz77;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user