mirror of
https://github.com/martravi/wiiqt.git
synced 2024-11-05 00:55:06 +01:00
* delete more unused files
This commit is contained in:
parent
085ce1d522
commit
9d4d474806
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -40,8 +40,6 @@ nandExtract/nandwindow.cpp -text
|
||||
nandExtract/nandwindow.h -text
|
||||
nandExtract/nandwindow.ui -text
|
||||
nandExtract/readmii.txt -text
|
||||
nandExtract/tools.cpp -text
|
||||
nandExtract/tools.h -text
|
||||
nand_dump/main.cpp -text
|
||||
nand_dump/mainwindow.cpp -text
|
||||
nand_dump/mainwindow.h -text
|
||||
|
@ -1,131 +0,0 @@
|
||||
#include "tools.h"
|
||||
#include "includes.h"
|
||||
#include "aes.h"
|
||||
//#include "sha1.h"
|
||||
|
||||
QString currentDir;
|
||||
QString cachePath = "./NUS_cache";
|
||||
QString nandPath = "./dump";
|
||||
|
||||
char ascii( char s ) {
|
||||
if ( s < 0x20 ) return '.';
|
||||
if ( s > 0x7E ) return '.';
|
||||
return s;
|
||||
}
|
||||
|
||||
//using stderr just because qtcreator stows it correctly when mixed with qDebug(), qWarning(), etc
|
||||
//otherwise it may not be shown in the correct spot in the output due to stdout/stderr caches
|
||||
void hexdump( const void *d, int len ) {
|
||||
unsigned char *data;
|
||||
int i, off;
|
||||
data = (unsigned char*)d;
|
||||
fprintf( stderr, "\n");
|
||||
for ( off = 0; off < len; off += 16 ) {
|
||||
fprintf( stderr, "%08x ", off );
|
||||
for ( i=0; i<16; i++ )
|
||||
{
|
||||
if( ( i + 1 ) % 4 )
|
||||
{
|
||||
if ( ( i + off ) >= len ) fprintf( stderr," ");
|
||||
else fprintf( stderr,"%02x",data[ off + i ]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ( i + off ) >= len ) fprintf( stderr," ");
|
||||
else fprintf( stderr,"%02x ",data[ off + i ]);
|
||||
}
|
||||
}
|
||||
|
||||
fprintf( stderr, " " );
|
||||
for ( i = 0; i < 16; i++ )
|
||||
if ( ( i + off) >= len ) fprintf( stderr," ");
|
||||
else fprintf( stderr,"%c", ascii( data[ off + i ]));
|
||||
fprintf( stderr,"\n");
|
||||
}
|
||||
fflush( stderr );
|
||||
}
|
||||
|
||||
void hexdump( const QByteArray &d, int from, int len )
|
||||
{
|
||||
hexdump( d.data() + from, len == -1 ? d.size() : len );
|
||||
}
|
||||
|
||||
void hexdump12( const void *d, int len ) {
|
||||
unsigned char *data;
|
||||
int i, off;
|
||||
data = (unsigned char*)d;
|
||||
fprintf( stderr, "\n");
|
||||
for ( off = 0; off < len; off += 12 ) {
|
||||
fprintf( stderr, "%08x ", off );
|
||||
for ( i=0; i<12; i++ )
|
||||
{
|
||||
if( ( i + 1 ) % 4 )
|
||||
{
|
||||
if ( ( i + off ) >= len ) fprintf( stderr," ");
|
||||
else fprintf( stderr,"%02x",data[ off + i ]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ( i + off ) >= len ) fprintf( stderr," ");
|
||||
else fprintf( stderr,"%02x ",data[ off + i ]);
|
||||
}
|
||||
}
|
||||
|
||||
fprintf( stderr, " " );
|
||||
for ( i = 0; i < 12; i++ )
|
||||
if ( ( i + off) >= len ) fprintf( stderr," ");
|
||||
else fprintf( stderr,"%c", ascii( data[ off + i ]));
|
||||
fprintf( stderr,"\n");
|
||||
}
|
||||
fflush( stderr );
|
||||
}
|
||||
|
||||
void hexdump12( const QByteArray &d, int from, int len )
|
||||
{
|
||||
hexdump12( d.data() + from, len == -1 ? d.size() : len );
|
||||
}
|
||||
|
||||
QByteArray PaddedByteArray( const QByteArray &orig, quint32 padTo )
|
||||
{
|
||||
QByteArray padding( RU( padTo, orig.size() ) - orig.size(), '\0' );
|
||||
//qDebug() << "padding with" << hex << RU( padTo, orig.size() ) << "bytes" <<
|
||||
return orig + padding;
|
||||
}
|
||||
|
||||
QByteArray AesDecrypt( quint16 index, const QByteArray source )
|
||||
{
|
||||
static quint8 iv[ 16 ];
|
||||
|
||||
quint16 beidx = qFromBigEndian( index );
|
||||
memset( iv, 0, 16 );
|
||||
memcpy( iv, &beidx, 2 );
|
||||
QByteArray ret( source.size(), '\0' );
|
||||
aes_decrypt( iv, (const quint8*)source.data(), (quint8*)ret.data(), source.size() );
|
||||
return ret;
|
||||
}
|
||||
|
||||
void AesSetKey( const QByteArray key )
|
||||
{
|
||||
aes_set_key( (const quint8*)key.data() );
|
||||
}
|
||||
/*
|
||||
QByteArray GetSha1( QByteArray stuff )
|
||||
{
|
||||
SHA1Context sha;
|
||||
SHA1Reset( &sha );
|
||||
SHA1Input( &sha, (const unsigned char*)stuff.data(), stuff.size() );
|
||||
if( !SHA1Result( &sha ) )
|
||||
{
|
||||
qWarning() << "GetSha1 -> sha error";
|
||||
return QByteArray();
|
||||
}
|
||||
QByteArray ret( 20, '\0' );
|
||||
quint8 *p = (quint8 *)ret.data();
|
||||
for( int i = 0; i < 5 ; i++ )
|
||||
{
|
||||
quint32 part = qFromBigEndian( sha.Message_Digest[ i ] );
|
||||
memcpy( p + ( i * 4 ), &part, 4 );
|
||||
}
|
||||
//hexdump( ret );
|
||||
return ret;
|
||||
}*/
|
@ -1,36 +0,0 @@
|
||||
#ifndef TOOLS_H
|
||||
#define TOOLS_H
|
||||
#include "includes.h"
|
||||
|
||||
#define RU(x,n) (-(-(x) & -(n))) //round up
|
||||
|
||||
#define MIN( x, y ) ( ( x ) < ( y ) ? ( x ) : ( y ) )
|
||||
#define MAX( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) )
|
||||
|
||||
char ascii( char s );
|
||||
|
||||
void hexdump( const void *d, int len );
|
||||
void hexdump( const QByteArray &d, int from = 0, int len = -1 );
|
||||
|
||||
void hexdump12( const void *d, int len );
|
||||
void hexdump12( const QByteArray &d, int from = 0, int len = -1 );
|
||||
|
||||
//simplified functions for crypto shit
|
||||
void AesSetKey( const QByteArray key );
|
||||
QByteArray AesDecrypt( quint16 index, const QByteArray source );
|
||||
|
||||
//QByteArray GetSha1( QByteArray stuff );
|
||||
|
||||
//get a padded version of the given buffer
|
||||
QByteArray PaddedByteArray( const QByteArray &orig, quint32 padTo );
|
||||
|
||||
//keep track of the last folder browsed to when looking for files
|
||||
extern QString currentDir;
|
||||
|
||||
//folder used to cache stuff downloaded from NUS so duplicate titles dont need to be downloaded
|
||||
extern QString cachePath;
|
||||
|
||||
//folder to use as the base path for the nand
|
||||
extern QString nandPath;
|
||||
|
||||
#endif // TOOLS_H
|
Loading…
Reference in New Issue
Block a user