From 9d4d4748066aa65f1a7495cabbabb2c25428cfb4 Mon Sep 17 00:00:00 2001 From: "giantpune@gmail.com" Date: Fri, 10 Dec 2010 03:52:43 +0000 Subject: [PATCH] * delete more unused files --- .gitattributes | 2 - nandExtract/tools.cpp | 131 ------------------------------------------ nandExtract/tools.h | 36 ------------ 3 files changed, 169 deletions(-) delete mode 100644 nandExtract/tools.cpp delete mode 100644 nandExtract/tools.h diff --git a/.gitattributes b/.gitattributes index a7f5642..6706d81 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/nandExtract/tools.cpp b/nandExtract/tools.cpp deleted file mode 100644 index 7200bca..0000000 --- a/nandExtract/tools.cpp +++ /dev/null @@ -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; -}*/ diff --git a/nandExtract/tools.h b/nandExtract/tools.h deleted file mode 100644 index e11bac7..0000000 --- a/nandExtract/tools.h +++ /dev/null @@ -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