code formatting. absolutely no functional changes. there is no point to update to this. just making the code easier to read.
@ -2,8 +2,8 @@
|
|||||||
<app version="1">
|
<app version="1">
|
||||||
<name> USB Loader GX</name>
|
<name> USB Loader GX</name>
|
||||||
<coder>USB Loader GX Team</coder>
|
<coder>USB Loader GX Team</coder>
|
||||||
<version>1.0 r907</version>
|
<version>1.0 r908</version>
|
||||||
<release_date>201002050625</release_date>
|
<release_date>201002090353</release_date>
|
||||||
<short_description>Loads games from USB-devices</short_description>
|
<short_description>Loads games from USB-devices</short_description>
|
||||||
<long_description>USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times.
|
<long_description>USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times.
|
||||||
The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller.
|
The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller.
|
||||||
|
@ -65,10 +65,9 @@ typedef struct ftgxDataOffset_ {
|
|||||||
* @param vertexIndex Optional vertex format index (GX_VTXFMT*) of the glyph textures as defined by the libogc gx.h header file. If not specified default value is GX_VTXFMT1.
|
* @param vertexIndex Optional vertex format index (GX_VTXFMT*) of the glyph textures as defined by the libogc gx.h header file. If not specified default value is GX_VTXFMT1.
|
||||||
*/
|
*/
|
||||||
FreeTypeGX::FreeTypeGX(uint8_t textureFormat, uint8_t vertexIndex, uint32_t compatibilityMode)
|
FreeTypeGX::FreeTypeGX(uint8_t textureFormat, uint8_t vertexIndex, uint32_t compatibilityMode)
|
||||||
:
|
:
|
||||||
ftFace(NULL),
|
ftFace(NULL),
|
||||||
ftFace_fromFile(NULL)
|
ftFace_fromFile(NULL) {
|
||||||
{
|
|
||||||
FT_Init_FreeType(&this->ftLibrary);
|
FT_Init_FreeType(&this->ftLibrary);
|
||||||
|
|
||||||
this->textureFormat = textureFormat;
|
this->textureFormat = textureFormat;
|
||||||
@ -96,7 +95,7 @@ FreeTypeGX::~FreeTypeGX() {
|
|||||||
wchar_t* FreeTypeGX::charToWideChar(const char* strChar) {
|
wchar_t* FreeTypeGX::charToWideChar(const char* strChar) {
|
||||||
wchar_t *strWChar;
|
wchar_t *strWChar;
|
||||||
strWChar = new(std::nothrow) wchar_t[strlen(strChar) + 1];
|
strWChar = new(std::nothrow) wchar_t[strlen(strChar) + 1];
|
||||||
if(!strWChar) return NULL;
|
if (!strWChar) return NULL;
|
||||||
// UTF-8
|
// UTF-8
|
||||||
int bt;
|
int bt;
|
||||||
bt = mbstowcs(strWChar, strChar, strlen(strChar));
|
bt = mbstowcs(strWChar, strChar, strlen(strChar));
|
||||||
@ -261,27 +260,24 @@ void FreeTypeGX::clearGlyphData() {
|
|||||||
GX_DrawDone();
|
GX_DrawDone();
|
||||||
GX_Flush();
|
GX_Flush();
|
||||||
|
|
||||||
for ( std::map<uint16_t, FTGX_Cache>::iterator i = this->fontDatas.begin(); i != this->fontDatas.end(); i++)
|
for ( std::map<uint16_t, FTGX_Cache>::iterator i = this->fontDatas.begin(); i != this->fontDatas.end(); i++) {
|
||||||
{
|
for ( FTGX_Cache::iterator j = i->second.begin(); j != i->second.end(); j++) {
|
||||||
for ( FTGX_Cache::iterator j = i->second.begin(); j != i->second.end(); j++)
|
|
||||||
{
|
|
||||||
free(j->second.glyphDataTexture);
|
free(j->second.glyphDataTexture);
|
||||||
}
|
}
|
||||||
i->second.clear();
|
i->second.clear();
|
||||||
}
|
}
|
||||||
/* for ( std::map<wchar_t, ftgxCharData>::iterator i = this->fontData.begin(); i != this->fontData.end(); i++) {
|
/* for ( std::map<wchar_t, ftgxCharData>::iterator i = this->fontData.begin(); i != this->fontData.end(); i++) {
|
||||||
free(i->second.glyphDataTexture);
|
free(i->second.glyphDataTexture);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
this->fontDatas.clear();
|
this->fontDatas.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FreeTypeGX::changeSize(FT_UInt vPointSize, FT_UInt hPointSize/*=0*/) {
|
void FreeTypeGX::changeSize(FT_UInt vPointSize, FT_UInt hPointSize/*=0*/) {
|
||||||
if(hPointSize == 0) hPointSize = vPointSize;
|
if (hPointSize == 0) hPointSize = vPointSize;
|
||||||
if(vPointSize > 255) vPointSize = 255;// limit to 255
|
if (vPointSize > 255) vPointSize = 255;// limit to 255
|
||||||
if(hPointSize > 255) hPointSize = 255;
|
if (hPointSize > 255) hPointSize = 255;
|
||||||
if(this->ftPointSize_v != vPointSize || this->ftPointSize_h != hPointSize)
|
if (this->ftPointSize_v != vPointSize || this->ftPointSize_h != hPointSize) {
|
||||||
{
|
|
||||||
// this->clearGlyphData();
|
// this->clearGlyphData();
|
||||||
this->ftPointSize_v = vPointSize;
|
this->ftPointSize_v = vPointSize;
|
||||||
this->ftPointSize_h = hPointSize;
|
this->ftPointSize_h = hPointSize;
|
||||||
@ -360,13 +356,11 @@ uint16_t FreeTypeGX::adjustTextureHeight(uint16_t textureHeight, uint8_t texture
|
|||||||
* @param charCode The requested glyph's character code.
|
* @param charCode The requested glyph's character code.
|
||||||
* @return A pointer to the allocated font structure.
|
* @return A pointer to the allocated font structure.
|
||||||
*/
|
*/
|
||||||
ftgxCharData *FreeTypeGX::cacheGlyphData(wchar_t charCode)
|
ftgxCharData *FreeTypeGX::cacheGlyphData(wchar_t charCode) {
|
||||||
{
|
|
||||||
FTGX_Cache &fontData = this->fontDatas[ftPointSize_v | ftPointSize_h << 8];
|
FTGX_Cache &fontData = this->fontDatas[ftPointSize_v | ftPointSize_h << 8];
|
||||||
return cacheGlyphData(charCode, fontData);
|
return cacheGlyphData(charCode, fontData);
|
||||||
}
|
}
|
||||||
ftgxCharData *FreeTypeGX::cacheGlyphData(wchar_t charCode, FTGX_Cache &fontData)
|
ftgxCharData *FreeTypeGX::cacheGlyphData(wchar_t charCode, FTGX_Cache &fontData) {
|
||||||
{
|
|
||||||
FT_UInt gIndex;
|
FT_UInt gIndex;
|
||||||
uint16_t textureWidth = 0, textureHeight = 0;
|
uint16_t textureWidth = 0, textureHeight = 0;
|
||||||
|
|
||||||
|
@ -203,9 +203,7 @@ typedef struct ftgxDataOffset_ ftgxDataOffset;
|
|||||||
#define FTGX_COMPATIBILITY_GRRLIB FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE
|
#define FTGX_COMPATIBILITY_GRRLIB FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE
|
||||||
#define FTGX_COMPATIBILITY_LIBWIISPRITE FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_MODULATE | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_DIRECT
|
#define FTGX_COMPATIBILITY_LIBWIISPRITE FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_MODULATE | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_DIRECT
|
||||||
|
|
||||||
const GXColor ftgxWhite = (GXColor) {
|
const GXColor ftgxWhite = (GXColor) {0xff, 0xff, 0xff, 0xff}
|
||||||
0xff, 0xff, 0xff, 0xff
|
|
||||||
}
|
|
||||||
; /**< Constant color value used only to sanitize Doxygen documentation. */
|
; /**< Constant color value used only to sanitize Doxygen documentation. */
|
||||||
|
|
||||||
/*! \class FreeTypeGX
|
/*! \class FreeTypeGX
|
||||||
|
@ -39,26 +39,22 @@
|
|||||||
#include "ZipFile.h"
|
#include "ZipFile.h"
|
||||||
#include "language/gettext.h"
|
#include "language/gettext.h"
|
||||||
|
|
||||||
ZipFile::ZipFile(const char *filepath)
|
ZipFile::ZipFile(const char *filepath) {
|
||||||
{
|
|
||||||
File = unzOpen(filepath);
|
File = unzOpen(filepath);
|
||||||
if(File)
|
if (File)
|
||||||
this->LoadList();
|
this->LoadList();
|
||||||
}
|
}
|
||||||
|
|
||||||
ZipFile::~ZipFile()
|
ZipFile::~ZipFile() {
|
||||||
{
|
|
||||||
unzClose(File);
|
unzClose(File);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZipFile::LoadList()
|
bool ZipFile::LoadList() {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZipFile::ExtractAll(const char *dest)
|
bool ZipFile::ExtractAll(const char *dest) {
|
||||||
{
|
if (!File)
|
||||||
if(!File)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool Stop = false;
|
bool Stop = false;
|
||||||
@ -66,7 +62,7 @@ bool ZipFile::ExtractAll(const char *dest)
|
|||||||
u32 blocksize = 1024*50;
|
u32 blocksize = 1024*50;
|
||||||
u8 *buffer = new u8[blocksize];
|
u8 *buffer = new u8[blocksize];
|
||||||
|
|
||||||
if(!buffer)
|
if (!buffer)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
char writepath[MAXPATHLEN];
|
char writepath[MAXPATHLEN];
|
||||||
@ -74,16 +70,14 @@ bool ZipFile::ExtractAll(const char *dest)
|
|||||||
memset(filename, 0, sizeof(filename));
|
memset(filename, 0, sizeof(filename));
|
||||||
|
|
||||||
int ret = unzGoToFirstFile(File);
|
int ret = unzGoToFirstFile(File);
|
||||||
if(ret != UNZ_OK)
|
if (ret != UNZ_OK)
|
||||||
Stop = true;
|
Stop = true;
|
||||||
|
|
||||||
while(!Stop)
|
while (!Stop) {
|
||||||
{
|
if (unzGetCurrentFileInfo(File, &cur_file_info, filename, sizeof(filename), NULL, NULL, NULL, NULL) != UNZ_OK)
|
||||||
if(unzGetCurrentFileInfo(File, &cur_file_info, filename, sizeof(filename), NULL, NULL, NULL, NULL) != UNZ_OK)
|
|
||||||
Stop = true;
|
Stop = true;
|
||||||
|
|
||||||
if(!Stop && filename[strlen(filename)-1] != '/')
|
if (!Stop && filename[strlen(filename)-1] != '/') {
|
||||||
{
|
|
||||||
u32 uncompressed_size = cur_file_info.uncompressed_size;
|
u32 uncompressed_size = cur_file_info.uncompressed_size;
|
||||||
|
|
||||||
u32 done = 0;
|
u32 done = 0;
|
||||||
@ -101,33 +95,31 @@ bool ZipFile::ExtractAll(const char *dest)
|
|||||||
|
|
||||||
subfoldercreate(temppath);
|
subfoldercreate(temppath);
|
||||||
|
|
||||||
if(ret == UNZ_OK)
|
if (ret == UNZ_OK) {
|
||||||
{
|
|
||||||
FILE *pfile = fopen(writepath, "wb");
|
FILE *pfile = fopen(writepath, "wb");
|
||||||
|
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
ShowProgress(tr("Extracting files..."), 0, pointer+1, done, uncompressed_size);
|
ShowProgress(tr("Extracting files..."), 0, pointer+1, done, uncompressed_size);
|
||||||
|
|
||||||
if(uncompressed_size - done < blocksize)
|
if (uncompressed_size - done < blocksize)
|
||||||
blocksize = uncompressed_size - done;
|
blocksize = uncompressed_size - done;
|
||||||
|
|
||||||
ret = unzReadCurrentFile(File, buffer, blocksize);
|
ret = unzReadCurrentFile(File, buffer, blocksize);
|
||||||
|
|
||||||
if(ret == 0)
|
if (ret == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
fwrite(buffer, 1, blocksize, pfile);
|
fwrite(buffer, 1, blocksize, pfile);
|
||||||
|
|
||||||
done += ret;
|
done += ret;
|
||||||
|
|
||||||
} while(done < uncompressed_size);
|
} while (done < uncompressed_size);
|
||||||
|
|
||||||
fclose(pfile);
|
fclose(pfile);
|
||||||
unzCloseCurrentFile(File);
|
unzCloseCurrentFile(File);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(unzGoToNextFile(File) != UNZ_OK)
|
if (unzGoToNextFile(File) != UNZ_OK)
|
||||||
Stop = true;
|
Stop = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,17 +30,15 @@
|
|||||||
|
|
||||||
#include "unzip/unzip.h"
|
#include "unzip/unzip.h"
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
u64 offset; // ZipFile offset
|
u64 offset; // ZipFile offset
|
||||||
u64 length; // uncompressed file length in 64 bytes for sizes higher than 4GB
|
u64 length; // uncompressed file length in 64 bytes for sizes higher than 4GB
|
||||||
bool isdir; // 0 - file, 1 - directory
|
bool isdir; // 0 - file, 1 - directory
|
||||||
char filename[256]; // full filename
|
char filename[256]; // full filename
|
||||||
} FileStructure;
|
} FileStructure;
|
||||||
|
|
||||||
class ZipFile
|
class ZipFile {
|
||||||
{
|
public:
|
||||||
public:
|
|
||||||
//!Constructor
|
//!Constructor
|
||||||
ZipFile(const char *filepath);
|
ZipFile(const char *filepath);
|
||||||
//!Destructor
|
//!Destructor
|
||||||
@ -48,7 +46,7 @@ class ZipFile
|
|||||||
//!Extract all files from a zip file to a directory
|
//!Extract all files from a zip file to a directory
|
||||||
//!\param dest Destination path to where to extract
|
//!\param dest Destination path to where to extract
|
||||||
bool ExtractAll(const char *dest);
|
bool ExtractAll(const char *dest);
|
||||||
protected:
|
protected:
|
||||||
bool LoadList();
|
bool LoadList();
|
||||||
unzFile File;
|
unzFile File;
|
||||||
unz_file_info cur_file_info;
|
unz_file_info cur_file_info;
|
||||||
|
@ -110,25 +110,22 @@
|
|||||||
* array. They're divided up into four groups of 16.
|
* array. They're divided up into four groups of 16.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static const uint8_t K[3][16] =
|
static const uint8_t K[3][16] = {
|
||||||
{
|
|
||||||
/* Round 1: skipped (since it is simply sequential). */
|
/* Round 1: skipped (since it is simply sequential). */
|
||||||
{ 1, 6, 11, 0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12 }, /* R2 */
|
{ 1, 6, 11, 0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12 }, /* R2 */
|
||||||
{ 5, 8, 11, 14, 1, 4, 7, 10, 13, 0, 3, 6, 9, 12, 15, 2 }, /* R3 */
|
{ 5, 8, 11, 14, 1, 4, 7, 10, 13, 0, 3, 6, 9, 12, 15, 2 }, /* R3 */
|
||||||
{ 0, 7, 14, 5, 12, 3, 10, 1, 8, 15, 6, 13, 4, 11, 2, 9 } /* R4 */
|
{ 0, 7, 14, 5, 12, 3, 10, 1, 8, 15, 6, 13, 4, 11, 2, 9 } /* R4 */
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint8_t S[4][4] =
|
static const uint8_t S[4][4] = {
|
||||||
{
|
|
||||||
{ 7, 12, 17, 22 }, /* Round 1 */
|
{ 7, 12, 17, 22 }, /* Round 1 */
|
||||||
{ 5, 9, 14, 20 }, /* Round 2 */
|
{ 5, 9, 14, 20 }, /* Round 2 */
|
||||||
{ 4, 11, 16, 23 }, /* Round 3 */
|
{ 4, 11, 16, 23 }, /* Round 3 */
|
||||||
{ 6, 10, 15, 21 } /* Round 4 */
|
{ 6, 10, 15, 21 } /* Round 4 */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static const uint32_t T[4][16] =
|
static const uint32_t T[4][16] = {
|
||||||
{
|
|
||||||
{ 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, /* Round 1 */
|
{ 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, /* Round 1 */
|
||||||
0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,
|
0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,
|
||||||
0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be,
|
0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be,
|
||||||
@ -148,7 +145,7 @@ static const uint32_t T[4][16] =
|
|||||||
0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1,
|
0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1,
|
||||||
0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1,
|
0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1,
|
||||||
0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 },
|
0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- **
|
/* -------------------------------------------------------------------------- **
|
||||||
@ -178,7 +175,7 @@ static const uint32_t T[4][16] =
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void Permute( uint32_t ABCD[4], const unsigned char block[64] )
|
static void Permute( uint32_t ABCD[4], const unsigned char block[64] )
|
||||||
/* ------------------------------------------------------------------------ **
|
/* ------------------------------------------------------------------------ **
|
||||||
* Permute the ABCD "registers" using the 64-byte <block> as a driver.
|
* Permute the ABCD "registers" using the 64-byte <block> as a driver.
|
||||||
*
|
*
|
||||||
* Input: ABCD - Pointer to an array of four unsigned longwords.
|
* Input: ABCD - Pointer to an array of four unsigned longwords.
|
||||||
@ -210,7 +207,7 @@ static void Permute( uint32_t ABCD[4], const unsigned char block[64] )
|
|||||||
*
|
*
|
||||||
* ------------------------------------------------------------------------ **
|
* ------------------------------------------------------------------------ **
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int round;
|
int round;
|
||||||
int i, j;
|
int i, j;
|
||||||
uint8_t s;
|
uint8_t s;
|
||||||
@ -220,15 +217,14 @@ static void Permute( uint32_t ABCD[4], const unsigned char block[64] )
|
|||||||
|
|
||||||
/* Store the current ABCD values for later re-use.
|
/* Store the current ABCD values for later re-use.
|
||||||
*/
|
*/
|
||||||
for( i = 0; i < 4; i++ )
|
for ( i = 0; i < 4; i++ )
|
||||||
KeepABCD[i] = ABCD[i];
|
KeepABCD[i] = ABCD[i];
|
||||||
|
|
||||||
/* Convert the input block into an array of unsigned longs, taking care
|
/* Convert the input block into an array of unsigned longs, taking care
|
||||||
* to read the block in Little Endian order (the algorithm assumes this).
|
* to read the block in Little Endian order (the algorithm assumes this).
|
||||||
* The uint32_t values are then handled in host order.
|
* The uint32_t values are then handled in host order.
|
||||||
*/
|
*/
|
||||||
for( i = 0, j = 0; i < 16; i++ )
|
for ( i = 0, j = 0; i < 16; i++ ) {
|
||||||
{
|
|
||||||
X[i] = (uint32_t)block[j++];
|
X[i] = (uint32_t)block[j++];
|
||||||
X[i] |= ((uint32_t)block[j++] << 8);
|
X[i] |= ((uint32_t)block[j++] << 8);
|
||||||
X[i] |= ((uint32_t)block[j++] << 16);
|
X[i] |= ((uint32_t)block[j++] << 16);
|
||||||
@ -249,10 +245,8 @@ static void Permute( uint32_t ABCD[4], const unsigned char block[64] )
|
|||||||
* (My implementation appears to be a poor compromise between speed, size,
|
* (My implementation appears to be a poor compromise between speed, size,
|
||||||
* and clarity. Ugh. [crh])
|
* and clarity. Ugh. [crh])
|
||||||
*/
|
*/
|
||||||
for( round = 0; round < 4; round++ )
|
for ( round = 0; round < 4; round++ ) {
|
||||||
{
|
for ( i = 0; i < 16; i++ ) {
|
||||||
for( i = 0; i < 16; i++ )
|
|
||||||
{
|
|
||||||
j = (4 - (i % 4)) & 0x3; /* <j> handles the rotation of ABCD. */
|
j = (4 - (i % 4)) & 0x3; /* <j> handles the rotation of ABCD. */
|
||||||
s = S[round][i%4]; /* <s> is the bit shift for this iteration. */
|
s = S[round][i%4]; /* <s> is the bit shift for this iteration. */
|
||||||
|
|
||||||
@ -263,8 +257,7 @@ static void Permute( uint32_t ABCD[4], const unsigned char block[64] )
|
|||||||
/* The actual perumation function.
|
/* The actual perumation function.
|
||||||
* This is broken out to minimize the code within the switch().
|
* This is broken out to minimize the code within the switch().
|
||||||
*/
|
*/
|
||||||
switch( round )
|
switch ( round ) {
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
/* round 1 */
|
/* round 1 */
|
||||||
a = md5F( b, c, d ) + X[i];
|
a = md5F( b, c, d ) + X[i];
|
||||||
@ -290,10 +283,10 @@ static void Permute( uint32_t ABCD[4], const unsigned char block[64] )
|
|||||||
/* Use the stored original A, B, C, D values to perform
|
/* Use the stored original A, B, C, D values to perform
|
||||||
* one last convolution.
|
* one last convolution.
|
||||||
*/
|
*/
|
||||||
for( i = 0; i < 4; i++ )
|
for ( i = 0; i < 4; i++ )
|
||||||
ABCD[i] = 0xFFFFFFFF & ( ABCD[i] + KeepABCD[i] );
|
ABCD[i] = 0xFFFFFFFF & ( ABCD[i] + KeepABCD[i] );
|
||||||
|
|
||||||
} /* Permute */
|
} /* Permute */
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- **
|
/* -------------------------------------------------------------------------- **
|
||||||
@ -301,7 +294,7 @@ static void Permute( uint32_t ABCD[4], const unsigned char block[64] )
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
auth_md5Ctx *auth_md5InitCtx( auth_md5Ctx *ctx )
|
auth_md5Ctx *auth_md5InitCtx( auth_md5Ctx *ctx )
|
||||||
/* ------------------------------------------------------------------------ **
|
/* ------------------------------------------------------------------------ **
|
||||||
* Initialize an MD5 context.
|
* Initialize an MD5 context.
|
||||||
*
|
*
|
||||||
* Input: ctx - A pointer to the MD5 context structure to be initialized.
|
* Input: ctx - A pointer to the MD5 context structure to be initialized.
|
||||||
@ -328,7 +321,7 @@ auth_md5Ctx *auth_md5InitCtx( auth_md5Ctx *ctx )
|
|||||||
*
|
*
|
||||||
* ------------------------------------------------------------------------ **
|
* ------------------------------------------------------------------------ **
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
ctx->len = 0;
|
ctx->len = 0;
|
||||||
ctx->b_used = 0;
|
ctx->b_used = 0;
|
||||||
|
|
||||||
@ -345,13 +338,13 @@ auth_md5Ctx *auth_md5InitCtx( auth_md5Ctx *ctx )
|
|||||||
/* here are provided as 32-bit values in C language format, */
|
/* here are provided as 32-bit values in C language format, */
|
||||||
/* so they are endian-agnostic. */
|
/* so they are endian-agnostic. */
|
||||||
return( ctx );
|
return( ctx );
|
||||||
} /* auth_md5InitCtx */
|
} /* auth_md5InitCtx */
|
||||||
|
|
||||||
|
|
||||||
auth_md5Ctx *auth_md5SumCtx( auth_md5Ctx *ctx,
|
auth_md5Ctx *auth_md5SumCtx( auth_md5Ctx *ctx,
|
||||||
const unsigned char *src,
|
const unsigned char *src,
|
||||||
const int len )
|
const int len )
|
||||||
/* ------------------------------------------------------------------------ **
|
/* ------------------------------------------------------------------------ **
|
||||||
* Build an MD5 Message Digest within the given context.
|
* Build an MD5 Message Digest within the given context.
|
||||||
*
|
*
|
||||||
* Input: ctx - Pointer to the context in which the MD5 sum is being
|
* Input: ctx - Pointer to the context in which the MD5 sum is being
|
||||||
@ -366,7 +359,7 @@ auth_md5Ctx *auth_md5SumCtx( auth_md5Ctx *ctx,
|
|||||||
*
|
*
|
||||||
* ------------------------------------------------------------------------ **
|
* ------------------------------------------------------------------------ **
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Add the new block's length to the total length.
|
/* Add the new block's length to the total length.
|
||||||
@ -376,12 +369,10 @@ auth_md5Ctx *auth_md5SumCtx( auth_md5Ctx *ctx,
|
|||||||
/* Copy the new block's data into the context block.
|
/* Copy the new block's data into the context block.
|
||||||
* Call the Permute() function whenever the context block is full.
|
* Call the Permute() function whenever the context block is full.
|
||||||
*/
|
*/
|
||||||
for( i = 0; i < len; i++ )
|
for ( i = 0; i < len; i++ ) {
|
||||||
{
|
|
||||||
ctx->block[ ctx->b_used ] = src[i];
|
ctx->block[ ctx->b_used ] = src[i];
|
||||||
(ctx->b_used)++;
|
(ctx->b_used)++;
|
||||||
if( 64 == ctx->b_used )
|
if ( 64 == ctx->b_used ) {
|
||||||
{
|
|
||||||
Permute( ctx->ABCD, ctx->block );
|
Permute( ctx->ABCD, ctx->block );
|
||||||
ctx->b_used = 0;
|
ctx->b_used = 0;
|
||||||
}
|
}
|
||||||
@ -390,11 +381,11 @@ auth_md5Ctx *auth_md5SumCtx( auth_md5Ctx *ctx,
|
|||||||
/* Return the updated context.
|
/* Return the updated context.
|
||||||
*/
|
*/
|
||||||
return( ctx );
|
return( ctx );
|
||||||
} /* auth_md5SumCtx */
|
} /* auth_md5SumCtx */
|
||||||
|
|
||||||
|
|
||||||
auth_md5Ctx *auth_md5CloseCtx( auth_md5Ctx *ctx, unsigned char *dst )
|
auth_md5Ctx *auth_md5CloseCtx( auth_md5Ctx *ctx, unsigned char *dst )
|
||||||
/* ------------------------------------------------------------------------ **
|
/* ------------------------------------------------------------------------ **
|
||||||
* Close an MD5 Message Digest context and generate the final MD5 sum.
|
* Close an MD5 Message Digest context and generate the final MD5 sum.
|
||||||
*
|
*
|
||||||
* Input: ctx - Pointer to the context in which the MD5 sum is being
|
* Input: ctx - Pointer to the context in which the MD5 sum is being
|
||||||
@ -412,7 +403,7 @@ auth_md5Ctx *auth_md5CloseCtx( auth_md5Ctx *ctx, unsigned char *dst )
|
|||||||
*
|
*
|
||||||
* ------------------------------------------------------------------------ **
|
* ------------------------------------------------------------------------ **
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
uint32_t l;
|
uint32_t l;
|
||||||
|
|
||||||
@ -426,16 +417,15 @@ auth_md5Ctx *auth_md5CloseCtx( auth_md5Ctx *ctx, unsigned char *dst )
|
|||||||
|
|
||||||
/* Zero out any remaining free bytes in the context block.
|
/* Zero out any remaining free bytes in the context block.
|
||||||
*/
|
*/
|
||||||
for( i = ctx->b_used; i < 64; i++ )
|
for ( i = ctx->b_used; i < 64; i++ )
|
||||||
ctx->block[i] = 0;
|
ctx->block[i] = 0;
|
||||||
|
|
||||||
/* We need 8 bytes to store the length field.
|
/* We need 8 bytes to store the length field.
|
||||||
* If we don't have 8, call Permute() and reset the context block.
|
* If we don't have 8, call Permute() and reset the context block.
|
||||||
*/
|
*/
|
||||||
if( 56 < ctx->b_used )
|
if ( 56 < ctx->b_used ) {
|
||||||
{
|
|
||||||
Permute( ctx->ABCD, ctx->block );
|
Permute( ctx->ABCD, ctx->block );
|
||||||
for( i = 0; i < 64; i++ )
|
for ( i = 0; i < 64; i++ )
|
||||||
ctx->block[i] = 0;
|
ctx->block[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,15 +435,14 @@ auth_md5Ctx *auth_md5CloseCtx( auth_md5Ctx *ctx, unsigned char *dst )
|
|||||||
* any MAXINT numeric overflow issues.
|
* any MAXINT numeric overflow issues.
|
||||||
*/
|
*/
|
||||||
l = ctx->len << 3;
|
l = ctx->len << 3;
|
||||||
for( i = 0; i < 4; i++ )
|
for ( i = 0; i < 4; i++ )
|
||||||
ctx->block[56+i] |= GetLongByte( l, i );
|
ctx->block[56+i] |= GetLongByte( l, i );
|
||||||
ctx->block[60] = ((GetLongByte( ctx->len, 3 ) & 0xE0) >> 5); /* See Above! */
|
ctx->block[60] = ((GetLongByte( ctx->len, 3 ) & 0xE0) >> 5); /* See Above! */
|
||||||
Permute( ctx->ABCD, ctx->block );
|
Permute( ctx->ABCD, ctx->block );
|
||||||
|
|
||||||
/* Now copy the result into the output buffer and we're done.
|
/* Now copy the result into the output buffer and we're done.
|
||||||
*/
|
*/
|
||||||
for( i = 0; i < 4; i++ )
|
for ( i = 0; i < 4; i++ ) {
|
||||||
{
|
|
||||||
dst[ 0+i] = GetLongByte( ctx->ABCD[0], i );
|
dst[ 0+i] = GetLongByte( ctx->ABCD[0], i );
|
||||||
dst[ 4+i] = GetLongByte( ctx->ABCD[1], i );
|
dst[ 4+i] = GetLongByte( ctx->ABCD[1], i );
|
||||||
dst[ 8+i] = GetLongByte( ctx->ABCD[2], i );
|
dst[ 8+i] = GetLongByte( ctx->ABCD[2], i );
|
||||||
@ -464,11 +453,11 @@ auth_md5Ctx *auth_md5CloseCtx( auth_md5Ctx *ctx, unsigned char *dst )
|
|||||||
* This is done for compatibility with the other auth_md5*Ctx() functions.
|
* This is done for compatibility with the other auth_md5*Ctx() functions.
|
||||||
*/
|
*/
|
||||||
return( ctx );
|
return( ctx );
|
||||||
} /* auth_md5CloseCtx */
|
} /* auth_md5CloseCtx */
|
||||||
|
|
||||||
|
|
||||||
unsigned char * MD5(unsigned char *dst, const unsigned char *src, const int len )
|
unsigned char * MD5(unsigned char *dst, const unsigned char *src, const int len )
|
||||||
/* ------------------------------------------------------------------------ **
|
/* ------------------------------------------------------------------------ **
|
||||||
* Compute an MD5 message digest.
|
* Compute an MD5 message digest.
|
||||||
*
|
*
|
||||||
* Input: dst - Destination buffer into which the result will be written.
|
* Input: dst - Destination buffer into which the result will be written.
|
||||||
@ -500,7 +489,7 @@ unsigned char * MD5(unsigned char *dst, const unsigned char *src, const int len
|
|||||||
*
|
*
|
||||||
* ------------------------------------------------------------------------ **
|
* ------------------------------------------------------------------------ **
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
auth_md5Ctx ctx[1];
|
auth_md5Ctx ctx[1];
|
||||||
|
|
||||||
(void)auth_md5InitCtx( ctx ); /* Open a context. */
|
(void)auth_md5InitCtx( ctx ); /* Open a context. */
|
||||||
@ -508,12 +497,12 @@ unsigned char * MD5(unsigned char *dst, const unsigned char *src, const int len
|
|||||||
(void)auth_md5CloseCtx( ctx, dst ); /* Close the context. */
|
(void)auth_md5CloseCtx( ctx, dst ); /* Close the context. */
|
||||||
|
|
||||||
return( dst ); /* Makes life easy. */
|
return( dst ); /* Makes life easy. */
|
||||||
} /* auth_md5Sum */
|
} /* auth_md5Sum */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
unsigned char * MD5fromFile(unsigned char *dst, const char *src)
|
unsigned char * MD5fromFile(unsigned char *dst, const char *src)
|
||||||
/* ------------------------------------------------------------------------ **
|
/* ------------------------------------------------------------------------ **
|
||||||
* Compute an MD5 message digest.
|
* Compute an MD5 message digest.
|
||||||
*
|
*
|
||||||
* Input: dst - Destination buffer into which the result will be written.
|
* Input: dst - Destination buffer into which the result will be written.
|
||||||
@ -543,7 +532,7 @@ unsigned char * MD5fromFile(unsigned char *dst, const char *src)
|
|||||||
*
|
*
|
||||||
* ------------------------------------------------------------------------ **
|
* ------------------------------------------------------------------------ **
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
auth_md5Ctx ctx[1];
|
auth_md5Ctx ctx[1];
|
||||||
|
|
||||||
FILE * file;
|
FILE * file;
|
||||||
@ -552,7 +541,7 @@ unsigned char * MD5fromFile(unsigned char *dst, const char *src)
|
|||||||
|
|
||||||
file = fopen(src, "rb");
|
file = fopen(src, "rb");
|
||||||
|
|
||||||
if (file==NULL){
|
if (file==NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -562,25 +551,24 @@ unsigned char * MD5fromFile(unsigned char *dst, const char *src)
|
|||||||
unsigned long long filesize = ftell(file);
|
unsigned long long filesize = ftell(file);
|
||||||
rewind (file);
|
rewind (file);
|
||||||
|
|
||||||
if(filesize < 1048576) //1MB cache for files bigger than 1 MB
|
if (filesize < 1048576) //1MB cache for files bigger than 1 MB
|
||||||
blksize = filesize;
|
blksize = filesize;
|
||||||
else
|
else
|
||||||
blksize = 1048576;
|
blksize = 1048576;
|
||||||
|
|
||||||
unsigned char * buffer = malloc(blksize);
|
unsigned char * buffer = malloc(blksize);
|
||||||
|
|
||||||
if(buffer == NULL){
|
if (buffer == NULL) {
|
||||||
//no memory
|
//no memory
|
||||||
fclose(file);
|
fclose(file);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
read = fread(buffer, 1, blksize, file);
|
read = fread(buffer, 1, blksize, file);
|
||||||
(void)auth_md5SumCtx( ctx, buffer, read ); /* Pass only one block. */
|
(void)auth_md5SumCtx( ctx, buffer, read ); /* Pass only one block. */
|
||||||
|
|
||||||
} while(read > 0);
|
} while (read > 0);
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
@ -588,16 +576,14 @@ unsigned char * MD5fromFile(unsigned char *dst, const char *src)
|
|||||||
(void)auth_md5CloseCtx( ctx, dst ); /* Close the context. */
|
(void)auth_md5CloseCtx( ctx, dst ); /* Close the context. */
|
||||||
|
|
||||||
return( dst ); /* Makes life easy. */
|
return( dst ); /* Makes life easy. */
|
||||||
} /* auth_md5Sum */
|
} /* auth_md5Sum */
|
||||||
|
|
||||||
|
|
||||||
const char * MD5ToString(const unsigned char * hash, char * dst)
|
const char * MD5ToString(const unsigned char * hash, char * dst) {
|
||||||
{
|
|
||||||
char hexchar[3];
|
char hexchar[3];
|
||||||
short i = 0, n = 0;
|
short i = 0, n = 0;
|
||||||
|
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++) {
|
||||||
{
|
|
||||||
sprintf(hexchar, "%02X", hash[i]);
|
sprintf(hexchar, "%02X", hash[i]);
|
||||||
|
|
||||||
dst[n++] = hexchar[0];
|
dst[n++] = hexchar[0];
|
||||||
@ -609,13 +595,11 @@ const char * MD5ToString(const unsigned char * hash, char * dst)
|
|||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char * StringToMD5(const char * hash, unsigned char * dst)
|
unsigned char * StringToMD5(const char * hash, unsigned char * dst) {
|
||||||
{
|
|
||||||
char hexchar[2];
|
char hexchar[2];
|
||||||
short i = 0, n = 0;
|
short i = 0, n = 0;
|
||||||
|
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++) {
|
||||||
{
|
|
||||||
hexchar[0] = hash[n++];
|
hexchar[0] = hash[n++];
|
||||||
hexchar[1] = hash[n++];
|
hexchar[1] = hash[n++];
|
||||||
|
|
||||||
|
@ -2,10 +2,9 @@
|
|||||||
#define MD5_H
|
#define MD5_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
/* ========================================================================== **
|
/* ========================================================================== **
|
||||||
*
|
*
|
||||||
* MD5.h
|
* MD5.h
|
||||||
*
|
*
|
||||||
@ -81,12 +80,11 @@ extern "C"
|
|||||||
*
|
*
|
||||||
* ========================================================================== **
|
* ========================================================================== **
|
||||||
*/
|
*/
|
||||||
/* -------------------------------------------------------------------------- **
|
/* -------------------------------------------------------------------------- **
|
||||||
* Typedefs:
|
* Typedefs:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
unsigned int ABCD[4];
|
unsigned int ABCD[4];
|
||||||
int b_used;
|
int b_used;
|
||||||
@ -94,11 +92,11 @@ typedef struct
|
|||||||
} auth_md5Ctx;
|
} auth_md5Ctx;
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- **
|
/* -------------------------------------------------------------------------- **
|
||||||
* Functions:
|
* Functions:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
auth_md5Ctx *auth_md5InitCtx( auth_md5Ctx *ctx );
|
auth_md5Ctx *auth_md5InitCtx( auth_md5Ctx *ctx );
|
||||||
/* ------------------------------------------------------------------------ **
|
/* ------------------------------------------------------------------------ **
|
||||||
* Initialize an MD5 context.
|
* Initialize an MD5 context.
|
||||||
*
|
*
|
||||||
@ -128,7 +126,7 @@ auth_md5Ctx *auth_md5InitCtx( auth_md5Ctx *ctx );
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
auth_md5Ctx *auth_md5SumCtx( auth_md5Ctx *ctx,
|
auth_md5Ctx *auth_md5SumCtx( auth_md5Ctx *ctx,
|
||||||
const unsigned char *src,
|
const unsigned char *src,
|
||||||
const int len );
|
const int len );
|
||||||
/* ------------------------------------------------------------------------ **
|
/* ------------------------------------------------------------------------ **
|
||||||
@ -148,7 +146,7 @@ auth_md5Ctx *auth_md5SumCtx( auth_md5Ctx *ctx,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
auth_md5Ctx *auth_md5CloseCtx( auth_md5Ctx *ctx, unsigned char *dst );
|
auth_md5Ctx *auth_md5CloseCtx( auth_md5Ctx *ctx, unsigned char *dst );
|
||||||
/* ------------------------------------------------------------------------ **
|
/* ------------------------------------------------------------------------ **
|
||||||
* Close an MD5 Message Digest context and generate the final MD5 sum.
|
* Close an MD5 Message Digest context and generate the final MD5 sum.
|
||||||
*
|
*
|
||||||
@ -169,7 +167,7 @@ auth_md5Ctx *auth_md5CloseCtx( auth_md5Ctx *ctx, unsigned char *dst );
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
unsigned char * MD5(unsigned char * hash, const unsigned char *src, const int len );
|
unsigned char * MD5(unsigned char * hash, const unsigned char *src, const int len );
|
||||||
/* ------------------------------------------------------------------------ **
|
/* ------------------------------------------------------------------------ **
|
||||||
* Compute an MD5 message digest.
|
* Compute an MD5 message digest.
|
||||||
*
|
*
|
||||||
@ -203,7 +201,7 @@ unsigned char * MD5(unsigned char * hash, const unsigned char *src, const int le
|
|||||||
* ------------------------------------------------------------------------ **
|
* ------------------------------------------------------------------------ **
|
||||||
*/
|
*/
|
||||||
|
|
||||||
unsigned char * MD5fromFile(unsigned char *dst, const char *src);
|
unsigned char * MD5fromFile(unsigned char *dst, const char *src);
|
||||||
/* ------------------------------------------------------------------------ **
|
/* ------------------------------------------------------------------------ **
|
||||||
* Compute an MD5 message digest.
|
* Compute an MD5 message digest.
|
||||||
*
|
*
|
||||||
@ -235,10 +233,10 @@ unsigned char * MD5fromFile(unsigned char *dst, const char *src);
|
|||||||
* ------------------------------------------------------------------------ **
|
* ------------------------------------------------------------------------ **
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const char * MD5ToString(const unsigned char *hash, char *dst);
|
const char * MD5ToString(const unsigned char *hash, char *dst);
|
||||||
unsigned char * StringToMD5(const char * hash, unsigned char * dst);
|
unsigned char * StringToMD5(const char * hash, unsigned char * dst);
|
||||||
|
|
||||||
/* ========================================================================== */
|
/* ========================================================================== */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,7 @@
|
|||||||
#include "patches/fst.h"
|
#include "patches/fst.h"
|
||||||
#include "usbloader/fstfile.h"
|
#include "usbloader/fstfile.h"
|
||||||
|
|
||||||
s32 dump_banner(const u8* discid,const char * dest)
|
s32 dump_banner(const u8* discid,const char * dest) {
|
||||||
{
|
|
||||||
// Mount the disc
|
// Mount the disc
|
||||||
//Disc_SetWBFS(1, (u8*)discid);
|
//Disc_SetWBFS(1, (u8*)discid);
|
||||||
Disc_SetUSB(discid);
|
Disc_SetUSB(discid);
|
||||||
@ -47,8 +46,7 @@ s32 dump_banner(const u8* discid,const char * dest)
|
|||||||
// Read where to find the fst.bin
|
// Read where to find the fst.bin
|
||||||
u32 *buffer = memalign(32, 0x20);
|
u32 *buffer = memalign(32, 0x20);
|
||||||
|
|
||||||
if (buffer == NULL)
|
if (buffer == NULL) {
|
||||||
{
|
|
||||||
//Out of memory
|
//Out of memory
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -61,8 +59,7 @@ s32 dump_banner(const u8* discid,const char * dest)
|
|||||||
void *fstbuffer = memalign(32, buffer[2]*4);
|
void *fstbuffer = memalign(32, buffer[2]*4);
|
||||||
FST_ENTRY *fst = (FST_ENTRY *)fstbuffer;
|
FST_ENTRY *fst = (FST_ENTRY *)fstbuffer;
|
||||||
|
|
||||||
if (fst == NULL)
|
if (fst == NULL) {
|
||||||
{
|
|
||||||
//Out of memory
|
//Out of memory
|
||||||
free(buffer);
|
free(buffer);
|
||||||
return -1;
|
return -1;
|
||||||
@ -79,16 +76,13 @@ s32 dump_banner(const u8* discid,const char * dest)
|
|||||||
int i;
|
int i;
|
||||||
u32 index = 0;
|
u32 index = 0;
|
||||||
|
|
||||||
for (i=1;i<count;i++)
|
for (i=1;i<count;i++) {
|
||||||
{
|
if (strstr(fstfiles(fst, i), "opening.bnr") != NULL) {
|
||||||
if (strstr(fstfiles(fst, i), "opening.bnr") != NULL)
|
|
||||||
{
|
|
||||||
index = i;
|
index = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index == 0)
|
if (index == 0) {
|
||||||
{
|
|
||||||
//opening.bnr not found
|
//opening.bnr not found
|
||||||
free(fstbuffer);
|
free(fstbuffer);
|
||||||
return -1;
|
return -1;
|
||||||
@ -97,8 +91,7 @@ s32 dump_banner(const u8* discid,const char * dest)
|
|||||||
// Load the .bnr
|
// Load the .bnr
|
||||||
u8 *banner = memalign(32, fst[index].filelen);
|
u8 *banner = memalign(32, fst[index].filelen);
|
||||||
|
|
||||||
if (banner == NULL)
|
if (banner == NULL) {
|
||||||
{
|
|
||||||
//Out of memory
|
//Out of memory
|
||||||
free(fstbuffer);
|
free(fstbuffer);
|
||||||
return -1;
|
return -1;
|
||||||
@ -114,8 +107,7 @@ s32 dump_banner(const u8* discid,const char * dest)
|
|||||||
//SDCard_Init();
|
//SDCard_Init();
|
||||||
WDVD_SetUSBMode(NULL, 0);
|
WDVD_SetUSBMode(NULL, 0);
|
||||||
FILE *fp = fopen(dest, "wb");
|
FILE *fp = fopen(dest, "wb");
|
||||||
if(fp)
|
if (fp) {
|
||||||
{
|
|
||||||
fwrite(banner, 1, fst[index].filelen, fp);
|
fwrite(banner, 1, fst[index].filelen, fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
@ -9,11 +9,10 @@
|
|||||||
#define BANNER_H
|
#define BANNER_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
s32 dump_banner(const u8 *discid,const char * dest);
|
s32 dump_banner(const u8 *discid,const char * dest);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include "gui_banner.h"
|
#include "gui_banner.h"
|
||||||
|
|
||||||
GuiBanner::GuiBanner(const char *tplfilepath)
|
GuiBanner::GuiBanner(const char *tplfilepath) {
|
||||||
{
|
|
||||||
memory = NULL;
|
memory = NULL;
|
||||||
tplfilesize = 0;
|
tplfilesize = 0;
|
||||||
width = 0;
|
width = 0;
|
||||||
@ -15,7 +14,7 @@ GuiBanner::GuiBanner(const char *tplfilepath)
|
|||||||
|
|
||||||
FILE *tplfp = fopen(tplfilepath,"rb");
|
FILE *tplfp = fopen(tplfilepath,"rb");
|
||||||
|
|
||||||
if(tplfp !=NULL) {
|
if (tplfp !=NULL) {
|
||||||
|
|
||||||
unsigned short heighttemp = 0;
|
unsigned short heighttemp = 0;
|
||||||
unsigned short widthtemp = 0;
|
unsigned short widthtemp = 0;
|
||||||
@ -27,7 +26,7 @@ GuiBanner::GuiBanner(const char *tplfilepath)
|
|||||||
tplfilesize = ftell (tplfp);
|
tplfilesize = ftell (tplfp);
|
||||||
rewind (tplfp);
|
rewind (tplfp);
|
||||||
memory = memalign(32, tplfilesize);
|
memory = memalign(32, tplfilesize);
|
||||||
if(!memory) {
|
if (!memory) {
|
||||||
fclose(tplfp);
|
fclose(tplfp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -38,13 +37,13 @@ GuiBanner::GuiBanner(const char *tplfilepath)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = TPL_OpenTPLFromMemory(&tplfile, memory, tplfilesize);
|
ret = TPL_OpenTPLFromMemory(&tplfile, memory, tplfilesize);
|
||||||
if(ret < 0) {
|
if (ret < 0) {
|
||||||
free(memory);
|
free(memory);
|
||||||
memory = NULL;
|
memory = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ret = TPL_GetTexture(&tplfile,0,&texObj);
|
ret = TPL_GetTexture(&tplfile,0,&texObj);
|
||||||
if(ret < 0) {
|
if (ret < 0) {
|
||||||
free(memory);
|
free(memory);
|
||||||
memory = NULL;
|
memory = NULL;
|
||||||
return;
|
return;
|
||||||
@ -62,9 +61,8 @@ GuiBanner::GuiBanner(const char *tplfilepath)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GuiBanner::GuiBanner(void *mem, u32 len, int w, int h)
|
GuiBanner::GuiBanner(void *mem, u32 len, int w, int h) {
|
||||||
{
|
if (!mem || !len)
|
||||||
if(!mem || !len)
|
|
||||||
return;
|
return;
|
||||||
memory = mem;
|
memory = mem;
|
||||||
tplfilesize = len;
|
tplfilesize = len;
|
||||||
@ -76,13 +74,13 @@ GuiBanner::GuiBanner(void *mem, u32 len, int w, int h)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = TPL_OpenTPLFromMemory(&tplfile, memory, tplfilesize);
|
ret = TPL_OpenTPLFromMemory(&tplfile, memory, tplfilesize);
|
||||||
if(ret < 0) {
|
if (ret < 0) {
|
||||||
free(memory);
|
free(memory);
|
||||||
memory = NULL;
|
memory = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ret = TPL_GetTexture(&tplfile,0,&texObj);
|
ret = TPL_GetTexture(&tplfile,0,&texObj);
|
||||||
if(ret < 0) {
|
if (ret < 0) {
|
||||||
free(memory);
|
free(memory);
|
||||||
memory = NULL;
|
memory = NULL;
|
||||||
return;
|
return;
|
||||||
@ -92,18 +90,16 @@ GuiBanner::GuiBanner(void *mem, u32 len, int w, int h)
|
|||||||
filecheck = true;
|
filecheck = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
GuiBanner::~GuiBanner()
|
GuiBanner::~GuiBanner() {
|
||||||
{
|
if (memory != NULL) {
|
||||||
if(memory != NULL) {
|
|
||||||
free(memory);
|
free(memory);
|
||||||
memory = NULL;
|
memory = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiBanner::Draw()
|
void GuiBanner::Draw() {
|
||||||
{
|
|
||||||
LOCK(this);
|
LOCK(this);
|
||||||
if(!filecheck ||!this->IsVisible())
|
if (!filecheck ||!this->IsVisible())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float currScale = this->GetScale();
|
float currScale = this->GetScale();
|
||||||
|
@ -10,8 +10,7 @@
|
|||||||
|
|
||||||
#include "libwiigui/gui.h"
|
#include "libwiigui/gui.h"
|
||||||
|
|
||||||
class GuiBanner : public GuiImage
|
class GuiBanner : public GuiImage {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
//!Constructor
|
//!Constructor
|
||||||
//!\param tplfilepath Path of the tpl file
|
//!\param tplfilepath Path of the tpl file
|
||||||
|
@ -28,46 +28,38 @@
|
|||||||
#include "../ramdisk/ramdisk.h"
|
#include "../ramdisk/ramdisk.h"
|
||||||
#include "../listfiles.h"
|
#include "../listfiles.h"
|
||||||
|
|
||||||
u16 be16(const u8 *p)
|
u16 be16(const u8 *p) {
|
||||||
{
|
|
||||||
return (p[0] << 8) | p[1];
|
return (p[0] << 8) | p[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 be32(const u8 *p)
|
u32 be32(const u8 *p) {
|
||||||
{
|
|
||||||
return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
|
return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 be64(const u8 *p)
|
u64 be64(const u8 *p) {
|
||||||
{
|
|
||||||
return ((u64)be32(p) << 32) | be32(p + 4);
|
return ((u64)be32(p) << 32) | be32(p + 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 be34(const u8 *p)
|
u64 be34(const u8 *p) {
|
||||||
{
|
|
||||||
return 4 * (u64)be32(p);
|
return 4 * (u64)be32(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wbe16(u8 *p, u16 x)
|
void wbe16(u8 *p, u16 x) {
|
||||||
{
|
|
||||||
p[0] = x >> 8;
|
p[0] = x >> 8;
|
||||||
p[1] = x;
|
p[1] = x;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wbe32(u8 *p, u32 x)
|
void wbe32(u8 *p, u32 x) {
|
||||||
{
|
|
||||||
wbe16(p, x >> 16);
|
wbe16(p, x >> 16);
|
||||||
wbe16(p + 2, x);
|
wbe16(p + 2, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wbe64(u8 *p, u64 x)
|
void wbe64(u8 *p, u64 x) {
|
||||||
{
|
|
||||||
wbe32(p, x >> 32);
|
wbe32(p, x >> 32);
|
||||||
wbe32(p + 4, x);
|
wbe32(p + 4, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
void md5(u8 *data, u32 len, u8 *hash)
|
void md5(u8 *data, u32 len, u8 *hash) {
|
||||||
{
|
|
||||||
MD5(hash, data, len);
|
MD5(hash, data, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,16 +90,14 @@ typedef struct {
|
|||||||
u32 payload_data;
|
u32 payload_data;
|
||||||
} imd5_header_t;
|
} imd5_header_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
u16 type;
|
u16 type;
|
||||||
u16 name_offset;
|
u16 name_offset;
|
||||||
u32 data_offset; // == absolut offset från U.8- headerns början
|
u32 data_offset; // == absolut offset från U.8- headerns början
|
||||||
u32 size; // last included file num for directories
|
u32 size; // last included file num for directories
|
||||||
} U8_node;
|
} U8_node;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
u32 tag; // 0x55AA382D "U.8-"
|
u32 tag; // 0x55AA382D "U.8-"
|
||||||
u32 rootnode_offset; // offset to root_node, always 0x20.
|
u32 rootnode_offset; // offset to root_node, always 0x20.
|
||||||
u32 header_size; // size of header from root_node to end of string table.
|
u32 header_size; // size of header from root_node to end of string table.
|
||||||
@ -115,21 +105,18 @@ typedef struct
|
|||||||
u8 zeroes[16];
|
u8 zeroes[16];
|
||||||
} U8_archive_header;
|
} U8_archive_header;
|
||||||
|
|
||||||
static int write_file(void* data, size_t size, char* name)
|
static int write_file(void* data, size_t size, char* name) {
|
||||||
{
|
|
||||||
size_t written=0;
|
size_t written=0;
|
||||||
FILE *out;
|
FILE *out;
|
||||||
out = fopen(name, "wb");
|
out = fopen(name, "wb");
|
||||||
if(out)
|
if (out) {
|
||||||
{
|
|
||||||
written = fwrite(data, 1, size, out);
|
written = fwrite(data, 1, size, out);
|
||||||
fclose(out);
|
fclose(out);
|
||||||
}
|
}
|
||||||
return (written == size) ? 1 : -1;
|
return (written == size) ? 1 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8* decompress_lz77(u8 *data, size_t data_size, size_t* decompressed_size)
|
u8* decompress_lz77(u8 *data, size_t data_size, size_t* decompressed_size) {
|
||||||
{
|
|
||||||
u8 *data_end;
|
u8 *data_end;
|
||||||
u8 *decompressed_data;
|
u8 *decompressed_data;
|
||||||
size_t unpacked_size;
|
size_t unpacked_size;
|
||||||
@ -199,8 +186,7 @@ u8* decompress_lz77(u8 *data, size_t data_size, size_t* decompressed_size)
|
|||||||
return decompressed_data;
|
return decompressed_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int write_imd5_lz77(u8* data, size_t size, char* outname)
|
static int write_imd5_lz77(u8* data, size_t size, char* outname) {
|
||||||
{
|
|
||||||
imd5_header_t* header = (imd5_header_t*) data;
|
imd5_header_t* header = (imd5_header_t*) data;
|
||||||
u32 tag;
|
u32 tag;
|
||||||
u32 size_in_imd5;
|
u32 size_in_imd5;
|
||||||
@ -227,7 +213,7 @@ static int write_imd5_lz77(u8* data, size_t size, char* outname)
|
|||||||
if (tag == 0x4C5A3737) {
|
if (tag == 0x4C5A3737) {
|
||||||
// "LZ77" - uncompress
|
// "LZ77" - uncompress
|
||||||
decompressed_data = decompress_lz77(data + sizeof(imd5_header_t), size - sizeof(imd5_header_t), &decompressed_size);
|
decompressed_data = decompress_lz77(data + sizeof(imd5_header_t), size - sizeof(imd5_header_t), &decompressed_size);
|
||||||
if(decompressed_data == NULL)
|
if (decompressed_data == NULL)
|
||||||
return -7;
|
return -7;
|
||||||
write_file(decompressed_data, decompressed_size, outname);
|
write_file(decompressed_data, decompressed_size, outname);
|
||||||
//printf(", uncompressed %d bytes, md5 ok", decompressed_size);
|
//printf(", uncompressed %d bytes, md5 ok", decompressed_size);
|
||||||
@ -240,8 +226,7 @@ static int write_imd5_lz77(u8* data, size_t size, char* outname)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int do_U8_archive(FILE *fp)
|
static int do_U8_archive(FILE *fp) {
|
||||||
{
|
|
||||||
U8_archive_header header;
|
U8_archive_header header;
|
||||||
U8_node root_node;
|
U8_node root_node;
|
||||||
u32 tag;
|
u32 tag;
|
||||||
@ -315,8 +300,8 @@ static int do_U8_archive(FILE *fp)
|
|||||||
//printf("%*s %s (%d bytes", dir_index, "", name, size);
|
//printf("%*s %s (%d bytes", dir_index, "", name, size);
|
||||||
int result;
|
int result;
|
||||||
result = write_imd5_lz77(file_data, size, name);
|
result = write_imd5_lz77(file_data, size, name);
|
||||||
if(result < 0)
|
if (result < 0) {
|
||||||
{free(string_table);
|
free(string_table);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
//printf(")\n");
|
//printf(")\n");
|
||||||
@ -332,8 +317,7 @@ static int do_U8_archive(FILE *fp)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_imet_header(FILE *fp)
|
static void do_imet_header(FILE *fp) {
|
||||||
{
|
|
||||||
imet_data_t header;
|
imet_data_t header;
|
||||||
|
|
||||||
fread(&header, 1, sizeof header, fp);
|
fread(&header, 1, sizeof header, fp);
|
||||||
@ -341,8 +325,7 @@ static void do_imet_header(FILE *fp)
|
|||||||
write_file(&header, sizeof(header), "header.imet");
|
write_file(&header, sizeof(header), "header.imet");
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_U8_archivebanner(FILE *fp)
|
void do_U8_archivebanner(FILE *fp) {
|
||||||
{
|
|
||||||
U8_archive_header header;
|
U8_archive_header header;
|
||||||
U8_node root_node;
|
U8_node root_node;
|
||||||
u32 tag;
|
u32 tag;
|
||||||
@ -414,12 +397,10 @@ void do_U8_archivebanner(FILE *fp)
|
|||||||
free(string_table);
|
free(string_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
int extractbnrfile(const char * filepath, const char * destpath)
|
int extractbnrfile(const char * filepath, const char * destpath) {
|
||||||
{
|
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
FILE *fp = fopen(filepath, "rb");
|
FILE *fp = fopen(filepath, "rb");
|
||||||
if(fp)
|
if (fp) {
|
||||||
{
|
|
||||||
subfoldercreate(destpath);
|
subfoldercreate(destpath);
|
||||||
chdir(destpath);
|
chdir(destpath);
|
||||||
|
|
||||||
@ -431,11 +412,9 @@ int extractbnrfile(const char * filepath, const char * destpath)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int unpackBin(const char * filename,const char * outdir)
|
int unpackBin(const char * filename,const char * outdir) {
|
||||||
{
|
|
||||||
FILE *fp = fopen(filename,"rb");;
|
FILE *fp = fopen(filename,"rb");;
|
||||||
if(fp)
|
if (fp) {
|
||||||
{
|
|
||||||
subfoldercreate(outdir);
|
subfoldercreate(outdir);
|
||||||
chdir(outdir);
|
chdir(outdir);
|
||||||
|
|
||||||
@ -449,81 +428,70 @@ int unpackBin(const char * filename,const char * outdir)
|
|||||||
#define TMP_PATH(s) "BANNER:/dump"s
|
#define TMP_PATH(s) "BANNER:/dump"s
|
||||||
//#define TMP_PATH(s) "SD:/dump"s
|
//#define TMP_PATH(s) "SD:/dump"s
|
||||||
|
|
||||||
int unpackBanner(const u8 *gameid, int what, const char *outdir)
|
int unpackBanner(const u8 *gameid, int what, const char *outdir) {
|
||||||
{
|
|
||||||
|
|
||||||
char path[256];
|
char path[256];
|
||||||
if(!ramdiskMount("BANNER", NULL)) return -1;
|
if (!ramdiskMount("BANNER", NULL)) return -1;
|
||||||
|
|
||||||
subfoldercreate(TMP_PATH("/"));
|
subfoldercreate(TMP_PATH("/"));
|
||||||
s32 ret = dump_banner(gameid, TMP_PATH("/opening.bnr"));
|
s32 ret = dump_banner(gameid, TMP_PATH("/opening.bnr"));
|
||||||
if (ret != 1)
|
if (ret != 1) {
|
||||||
{
|
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto error2;
|
goto error2;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = extractbnrfile(TMP_PATH("/opening.bnr"), TMP_PATH("/"));
|
ret = extractbnrfile(TMP_PATH("/opening.bnr"), TMP_PATH("/"));
|
||||||
if (ret != 0)
|
if (ret != 0) {
|
||||||
{
|
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto error2;
|
goto error2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(what & UNPACK_BANNER_BIN)
|
if (what & UNPACK_BANNER_BIN) {
|
||||||
{
|
|
||||||
snprintf(path, sizeof(path),"%sbanner/", outdir);
|
snprintf(path, sizeof(path),"%sbanner/", outdir);
|
||||||
ret = unpackBin(TMP_PATH("/meta/banner.bin"), path);
|
ret = unpackBin(TMP_PATH("/meta/banner.bin"), path);
|
||||||
if (ret != 1)
|
if (ret != 1) {
|
||||||
{
|
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto error2;
|
goto error2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(what & UNPACK_ICON_BIN)
|
if (what & UNPACK_ICON_BIN) {
|
||||||
{
|
|
||||||
snprintf(path, sizeof(path),"%sicon/", outdir);
|
snprintf(path, sizeof(path),"%sicon/", outdir);
|
||||||
ret = unpackBin(TMP_PATH("/meta/icon.bin"), path);
|
ret = unpackBin(TMP_PATH("/meta/icon.bin"), path);
|
||||||
if (ret != 1)
|
if (ret != 1) {
|
||||||
{
|
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto error2;
|
goto error2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(what & UNPACK_SOUND_BIN)
|
if (what & UNPACK_SOUND_BIN) {
|
||||||
{
|
|
||||||
snprintf(path, sizeof(path),"%ssound.bin", outdir);
|
snprintf(path, sizeof(path),"%ssound.bin", outdir);
|
||||||
FILE *fp = fopen(TMP_PATH("/meta/sound.bin"), "rb");
|
FILE *fp = fopen(TMP_PATH("/meta/sound.bin"), "rb");
|
||||||
if(fp)
|
if (fp) {
|
||||||
{
|
|
||||||
size_t size;
|
size_t size;
|
||||||
u8 *data;
|
u8 *data;
|
||||||
fseek(fp, 0, SEEK_END);
|
fseek(fp, 0, SEEK_END);
|
||||||
size = ftell(fp);
|
size = ftell(fp);
|
||||||
if(!size)
|
if (!size) {
|
||||||
{
|
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
fseek(fp, 0, SEEK_SET);
|
fseek(fp, 0, SEEK_SET);
|
||||||
data = (u8 *)malloc(size);
|
data = (u8 *)malloc(size);
|
||||||
if(!data)
|
if (!data) {
|
||||||
{
|
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if(fread(data, 1, size, fp) != size)
|
if (fread(data, 1, size, fp) != size) {
|
||||||
{
|
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
ret = write_file(data, size, path);
|
ret = write_file(data, size, path);
|
||||||
}
|
}
|
||||||
error: fclose(fp);
|
error:
|
||||||
|
fclose(fp);
|
||||||
}
|
}
|
||||||
ramdiskUnmount("BANNER");
|
ramdiskUnmount("BANNER");
|
||||||
error2:
|
error2:
|
||||||
if(ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -9,36 +9,35 @@
|
|||||||
#define _OPENINGBNR_H_
|
#define _OPENINGBNR_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
* Error description:
|
* Error description:
|
||||||
* 0 Successfully extracted
|
* 0 Successfully extracted
|
||||||
* -1 No U8 tag
|
* -1 No U8 tag
|
||||||
* -2 Unknown type
|
* -2 Unknown type
|
||||||
* -3 Archive inconsistency, too much padding
|
* -3 Archive inconsistency, too much padding
|
||||||
* -4 No IMD5 tag
|
* -4 No IMD5 tag
|
||||||
* -5 MD5 mismatch
|
* -5 MD5 mismatch
|
||||||
* -6 Size mismatch
|
* -6 Size mismatch
|
||||||
* -7 Inconsistency in LZ77 encoding
|
* -7 Inconsistency in LZ77 encoding
|
||||||
************************************************************/
|
************************************************************/
|
||||||
|
|
||||||
//! Extract opening.bnr from filepath to destpath
|
//! Extract opening.bnr from filepath to destpath
|
||||||
//! Files extracted: banner.bin icon.bin and sound.bin
|
//! Files extracted: banner.bin icon.bin and sound.bin
|
||||||
int extractbnrfile(const char * filepath, const char * destpath);
|
int extractbnrfile(const char * filepath, const char * destpath);
|
||||||
int unpackBin(const char * filename,const char * outdir);
|
int unpackBin(const char * filename,const char * outdir);
|
||||||
#define UNPACK_BANNER_BIN 1 /* extract banner.bin to outdir/banner/ */
|
#define UNPACK_BANNER_BIN 1 /* extract banner.bin to outdir/banner/ */
|
||||||
#define UNPACK_ICON_BIN 2 /* extract icon.bin to outdir/icon/ */
|
#define UNPACK_ICON_BIN 2 /* extract icon.bin to outdir/icon/ */
|
||||||
#define UNPACK_SOUND_BIN 4 /* copies sound.bin to outdir/sound.bin */
|
#define UNPACK_SOUND_BIN 4 /* copies sound.bin to outdir/sound.bin */
|
||||||
#define UNPACK_ALL (UNPACK_SOUND_BIN | UNPACK_ICON_BIN | UNPACK_BANNER_BIN)
|
#define UNPACK_ALL (UNPACK_SOUND_BIN | UNPACK_ICON_BIN | UNPACK_BANNER_BIN)
|
||||||
int unpackBanner(const u8 * gameid, int what, const char *outdir);
|
int unpackBanner(const u8 * gameid, int what, const char *outdir);
|
||||||
//! Extract the lz77 compressed banner, icon and sound .bin
|
//! Extract the lz77 compressed banner, icon and sound .bin
|
||||||
u8* decompress_lz77(u8 *data, size_t data_size, size_t* decompressed_size);
|
u8* decompress_lz77(u8 *data, size_t data_size, size_t* decompressed_size);
|
||||||
|
|
||||||
u16 be16(const u8 *p);
|
u16 be16(const u8 *p);
|
||||||
u32 be32(const u8 *p);
|
u32 be32(const u8 *p);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -11,16 +11,14 @@
|
|||||||
#include "bannersound.h"
|
#include "bannersound.h"
|
||||||
|
|
||||||
|
|
||||||
struct IMD5Header
|
struct IMD5Header {
|
||||||
{
|
|
||||||
u32 fcc;
|
u32 fcc;
|
||||||
u32 filesize;
|
u32 filesize;
|
||||||
u8 zeroes[8];
|
u8 zeroes[8];
|
||||||
u8 crypto[16];
|
u8 crypto[16];
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
|
||||||
struct IMETHeader
|
struct IMETHeader {
|
||||||
{
|
|
||||||
u8 zeroes[64];
|
u8 zeroes[64];
|
||||||
u32 fcc;
|
u32 fcc;
|
||||||
u8 unk[8];
|
u8 unk[8];
|
||||||
@ -33,8 +31,7 @@ struct IMETHeader
|
|||||||
u8 crypto[16];
|
u8 crypto[16];
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
|
||||||
struct U8Header
|
struct U8Header {
|
||||||
{
|
|
||||||
u32 fcc;
|
u32 fcc;
|
||||||
u32 rootNodeOffset;
|
u32 rootNodeOffset;
|
||||||
u32 headerSize;
|
u32 headerSize;
|
||||||
@ -42,44 +39,40 @@ struct U8Header
|
|||||||
u8 zeroes[16];
|
u8 zeroes[16];
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
|
||||||
struct U8Entry
|
struct U8Entry {
|
||||||
{
|
struct {
|
||||||
struct
|
u32 fileType :
|
||||||
{
|
8;
|
||||||
u32 fileType : 8;
|
u32 nameOffset :
|
||||||
u32 nameOffset : 24;
|
24;
|
||||||
};
|
};
|
||||||
u32 fileOffset;
|
u32 fileOffset;
|
||||||
union
|
union {
|
||||||
{
|
|
||||||
u32 fileLength;
|
u32 fileLength;
|
||||||
u32 numEntries;
|
u32 numEntries;
|
||||||
};
|
};
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
|
||||||
struct LZ77Info
|
struct LZ77Info {
|
||||||
{
|
u16 length :
|
||||||
u16 length : 4;
|
4;
|
||||||
u16 offset : 12;
|
u16 offset :
|
||||||
|
12;
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
|
||||||
static char *u8Filename(const U8Entry *fst, int i)
|
static char *u8Filename(const U8Entry *fst, int i) {
|
||||||
{
|
|
||||||
return (char *)(fst + fst[0].numEntries) + fst[i].nameOffset;
|
return (char *)(fst + fst[0].numEntries) + fst[i].nameOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline u32 le32(u32 i)
|
inline u32 le32(u32 i) {
|
||||||
{
|
|
||||||
return ((i & 0xFF) << 24) | ((i & 0xFF00) << 8) | ((i & 0xFF0000) >> 8) | ((i & 0xFF000000) >> 24);
|
return ((i & 0xFF) << 24) | ((i & 0xFF00) << 8) | ((i & 0xFF0000) >> 8) | ((i & 0xFF000000) >> 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline u16 le16(u16 i)
|
inline u16 le16(u16 i) {
|
||||||
{
|
|
||||||
return ((i & 0xFF) << 8) | ((i & 0xFF00) >> 8);
|
return ((i & 0xFF) << 8) | ((i & 0xFF00) >> 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 *uncompressLZ77(const u8 *inBuf, u32 inLength, u32 &size)
|
static u8 *uncompressLZ77(const u8 *inBuf, u32 inLength, u32 &size) {
|
||||||
{
|
|
||||||
u8 *buffer = NULL;
|
u8 *buffer = NULL;
|
||||||
if (inLength <= 0x8 || *((const u32 *)inBuf) != 0x4C5A3737 /*"LZ77"*/ || inBuf[4] != 0x10)
|
if (inLength <= 0x8 || *((const u32 *)inBuf) != 0x4C5A3737 /*"LZ77"*/ || inBuf[4] != 0x10)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -94,14 +87,11 @@ static u8 *uncompressLZ77(const u8 *inBuf, u32 inLength, u32 &size)
|
|||||||
u8 *bufCur = buffer;
|
u8 *bufCur = buffer;
|
||||||
u8 *bufEnd = buffer + uncSize;
|
u8 *bufEnd = buffer + uncSize;
|
||||||
|
|
||||||
while (bufCur < bufEnd && inBuf < inBufEnd)
|
while (bufCur < bufEnd && inBuf < inBufEnd) {
|
||||||
{
|
|
||||||
u8 flags = *inBuf;
|
u8 flags = *inBuf;
|
||||||
++inBuf;
|
++inBuf;
|
||||||
for (int i = 0; i < 8 && bufCur < bufEnd && inBuf < inBufEnd; ++i)
|
for (int i = 0; i < 8 && bufCur < bufEnd && inBuf < inBufEnd; ++i) {
|
||||||
{
|
if ((flags & 0x80) != 0) {
|
||||||
if ((flags & 0x80) != 0)
|
|
||||||
{
|
|
||||||
const LZ77Info &info = *(const LZ77Info *)inBuf;
|
const LZ77Info &info = *(const LZ77Info *)inBuf;
|
||||||
inBuf += sizeof (LZ77Info);
|
inBuf += sizeof (LZ77Info);
|
||||||
int length = info.length + 3;
|
int length = info.length + 3;
|
||||||
@ -109,9 +99,7 @@ static u8 *uncompressLZ77(const u8 *inBuf, u32 inLength, u32 &size)
|
|||||||
return buffer;
|
return buffer;
|
||||||
memcpy(bufCur, bufCur - info.offset - 1, length);
|
memcpy(bufCur, bufCur - info.offset - 1, length);
|
||||||
bufCur += length;
|
bufCur += length;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
*bufCur = *inBuf;
|
*bufCur = *inBuf;
|
||||||
++inBuf;
|
++inBuf;
|
||||||
++bufCur;
|
++bufCur;
|
||||||
@ -123,27 +111,23 @@ static u8 *uncompressLZ77(const u8 *inBuf, u32 inLength, u32 &size)
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8 *LoadBannerSound(const u8 *discid, u32 *size)
|
const u8 *LoadBannerSound(const u8 *discid, u32 *size) {
|
||||||
{
|
if (!discid)
|
||||||
if(!discid)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
Disc_SetUSB(NULL);
|
Disc_SetUSB(NULL);
|
||||||
wbfs_disc_t *disc = WBFS_OpenDisc((u8 *) discid);
|
wbfs_disc_t *disc = WBFS_OpenDisc((u8 *) discid);
|
||||||
if(!disc)
|
if (!disc) {
|
||||||
{
|
|
||||||
// WindowPrompt(tr("Can't find disc"), 0, tr("OK"));
|
// WindowPrompt(tr("Can't find disc"), 0, tr("OK"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
wiidisc_t *wdisc = wd_open_disc((int (*)(void *, u32, u32, void *))wbfs_disc_read, disc);
|
wiidisc_t *wdisc = wd_open_disc((int (*)(void *, u32, u32, void *))wbfs_disc_read, disc);
|
||||||
if(!wdisc)
|
if (!wdisc) {
|
||||||
{
|
|
||||||
//WindowPrompt(tr("Could not open Disc"), 0, tr("OK"));
|
//WindowPrompt(tr("Could not open Disc"), 0, tr("OK"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
u8 * opening_bnr = wd_extract_file(wdisc, ALL_PARTITIONS, (char *) "opening.bnr");
|
u8 * opening_bnr = wd_extract_file(wdisc, ALL_PARTITIONS, (char *) "opening.bnr");
|
||||||
if(!opening_bnr)
|
if (!opening_bnr) {
|
||||||
{
|
|
||||||
//WindowPrompt(tr("ERROR"), tr("Failed to extract opening.bnr"), tr("OK"));
|
//WindowPrompt(tr("ERROR"), tr("Failed to extract opening.bnr"), tr("OK"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -154,8 +138,7 @@ const u8 *LoadBannerSound(const u8 *discid, u32 *size)
|
|||||||
const U8Entry *fst;
|
const U8Entry *fst;
|
||||||
|
|
||||||
const IMETHeader *imetHdr = (IMETHeader *)opening_bnr;
|
const IMETHeader *imetHdr = (IMETHeader *)opening_bnr;
|
||||||
if ( imetHdr->fcc != 0x494D4554 /*"IMET"*/ )
|
if ( imetHdr->fcc != 0x494D4554 /*"IMET"*/ ) {
|
||||||
{
|
|
||||||
// WindowPrompt(tr("IMET Header wrong."), 0, tr("OK"));
|
// WindowPrompt(tr("IMET Header wrong."), 0, tr("OK"));
|
||||||
free(opening_bnr);
|
free(opening_bnr);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -167,16 +150,14 @@ const u8 *LoadBannerSound(const u8 *discid, u32 *size)
|
|||||||
for (i = 1; i < fst[0].numEntries; ++i)
|
for (i = 1; i < fst[0].numEntries; ++i)
|
||||||
if (fst[i].fileType == 0 && strcasecmp(u8Filename(fst, i), "sound.bin") == 0)
|
if (fst[i].fileType == 0 && strcasecmp(u8Filename(fst, i), "sound.bin") == 0)
|
||||||
break;
|
break;
|
||||||
if (i >= fst[0].numEntries)
|
if (i >= fst[0].numEntries) {
|
||||||
{
|
|
||||||
/* Not all games have a sound.bin and this message is annoying **/
|
/* Not all games have a sound.bin and this message is annoying **/
|
||||||
//WindowPrompt(tr("sound.bin not found."), 0, tr("OK"));
|
//WindowPrompt(tr("sound.bin not found."), 0, tr("OK"));
|
||||||
free(opening_bnr);
|
free(opening_bnr);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
const u8 *sound_bin = ((const u8 *)bnrArcHdr) + fst[i].fileOffset;
|
const u8 *sound_bin = ((const u8 *)bnrArcHdr) + fst[i].fileOffset;
|
||||||
if ( ((IMD5Header *)sound_bin)->fcc != 0x494D4435 /*"IMD5"*/ )
|
if ( ((IMD5Header *)sound_bin)->fcc != 0x494D4435 /*"IMD5"*/ ) {
|
||||||
{
|
|
||||||
// WindowPrompt(tr("IMD5 Header not right."), 0, tr("OK"));
|
// WindowPrompt(tr("IMD5 Header not right."), 0, tr("OK"));
|
||||||
free(opening_bnr);
|
free(opening_bnr);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -184,25 +165,22 @@ const u8 *LoadBannerSound(const u8 *discid, u32 *size)
|
|||||||
const u8 *soundChunk = sound_bin + sizeof (IMD5Header);;
|
const u8 *soundChunk = sound_bin + sizeof (IMD5Header);;
|
||||||
u32 soundChunkSize = fst[i].fileLength - sizeof (IMD5Header);
|
u32 soundChunkSize = fst[i].fileLength - sizeof (IMD5Header);
|
||||||
|
|
||||||
if ( *((u32*)soundChunk) == 0x4C5A3737 /*"LZ77"*/ )
|
if ( *((u32*)soundChunk) == 0x4C5A3737 /*"LZ77"*/ ) {
|
||||||
{
|
|
||||||
u32 uncSize = NULL;
|
u32 uncSize = NULL;
|
||||||
u8 * uncompressed_data = uncompressLZ77(soundChunk, soundChunkSize, uncSize);
|
u8 * uncompressed_data = uncompressLZ77(soundChunk, soundChunkSize, uncSize);
|
||||||
if (!uncompressed_data)
|
if (!uncompressed_data) {
|
||||||
{
|
|
||||||
// WindowPrompt(tr("Can't decompress LZ77"), 0, tr("OK"));
|
// WindowPrompt(tr("Can't decompress LZ77"), 0, tr("OK"));
|
||||||
free(opening_bnr);
|
free(opening_bnr);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if(size) *size=uncSize;
|
if (size) *size=uncSize;
|
||||||
free(opening_bnr);
|
free(opening_bnr);
|
||||||
return uncompressed_data;
|
return uncompressed_data;
|
||||||
}
|
}
|
||||||
u8 *out = new(std::nothrow) u8[soundChunkSize];
|
u8 *out = new(std::nothrow) u8[soundChunkSize];
|
||||||
if(out)
|
if (out) {
|
||||||
{
|
|
||||||
memcpy(out, soundChunk, soundChunkSize);
|
memcpy(out, soundChunk, soundChunkSize);
|
||||||
if(size) *size=soundChunkSize;
|
if (size) *size=soundChunkSize;
|
||||||
}
|
}
|
||||||
free(opening_bnr);
|
free(opening_bnr);
|
||||||
return out;
|
return out;
|
||||||
|
@ -29,7 +29,7 @@ int CheatMenu(const char * gameID) {
|
|||||||
int ret = 1;
|
int ret = 1;
|
||||||
|
|
||||||
// because destroy GuiSound must wait while sound playing is finished, we use a global sound
|
// because destroy GuiSound must wait while sound playing is finished, we use a global sound
|
||||||
if(!btnClick2) btnClick2=new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
|
if (!btnClick2) btnClick2=new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
|
||||||
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
|
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
|
||||||
|
|
||||||
char imgPath[100];
|
char imgPath[100];
|
||||||
@ -71,13 +71,11 @@ int CheatMenu(const char * gameID) {
|
|||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
download = WindowPrompt(tr("Error"),tr("No Cheatfile found"),tr("Download Now"),tr("Cancel"));
|
download = WindowPrompt(tr("Error"),tr("No Cheatfile found"),tr("Download Now"),tr("Cancel"));
|
||||||
if (download==1)
|
if (download==1) {
|
||||||
{
|
|
||||||
download = CodeDownload(gameID);
|
download = CodeDownload(gameID);
|
||||||
if(download < 0 || c.openTxtfile(txtfilename) != 1)
|
if (download < 0 || c.openTxtfile(txtfilename) != 1)
|
||||||
break;
|
break;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
int cntcheats = c.getCnt();
|
int cntcheats = c.getCnt();
|
||||||
|
BIN
source/data1
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 48 KiB |
@ -111,7 +111,7 @@ int isInserted(const char *path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int SDCard_Init() {
|
int SDCard_Init() {
|
||||||
gprintf("\nSDCard_Init()");
|
gprintf("\nSDCard_Init()");
|
||||||
|
|
||||||
//closing all open Files write back the cache and then shutdown em!
|
//closing all open Files write back the cache and then shutdown em!
|
||||||
fatUnmount("SD:/");
|
fatUnmount("SD:/");
|
||||||
@ -121,8 +121,7 @@ gprintf("\nSDCard_Init()");
|
|||||||
fat_sd_sec = _FAT_startSector;
|
fat_sd_sec = _FAT_startSector;
|
||||||
gprintf(":1");
|
gprintf(":1");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
} else if (fatMount("SD", &__io_sdhc, 0, CACHE, SDHC_SECTOR_SIZE)) {
|
||||||
else if (fatMount("SD", &__io_sdhc, 0, CACHE, SDHC_SECTOR_SIZE)) {
|
|
||||||
fat_sd_mount = MOUNT_SDHC;
|
fat_sd_mount = MOUNT_SDHC;
|
||||||
fat_sd_sec = _FAT_startSector;
|
fat_sd_sec = _FAT_startSector;
|
||||||
gprintf(":1");
|
gprintf(":1");
|
||||||
@ -133,7 +132,7 @@ gprintf("\nSDCard_Init()");
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SDCard_deInit() {
|
void SDCard_deInit() {
|
||||||
gprintf("\nSDCard_deInit()");
|
gprintf("\nSDCard_deInit()");
|
||||||
//closing all open Files write back the cache and then shutdown em!
|
//closing all open Files write back the cache and then shutdown em!
|
||||||
fatUnmount("SD:/");
|
fatUnmount("SD:/");
|
||||||
|
|
||||||
@ -143,8 +142,7 @@ gprintf("\nSDCard_deInit()");
|
|||||||
|
|
||||||
void ntfsInit();
|
void ntfsInit();
|
||||||
|
|
||||||
s32 MountNTFS(u32 sector)
|
s32 MountNTFS(u32 sector) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
if (fs_ntfs_mount) return 0;
|
if (fs_ntfs_mount) return 0;
|
||||||
@ -192,8 +190,7 @@ s32 MountNTFS(u32 sector)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 UnmountNTFS(void)
|
s32 UnmountNTFS(void) {
|
||||||
{
|
|
||||||
/* Unmount device */
|
/* Unmount device */
|
||||||
ntfsUnmount("NTFS:/", true);
|
ntfsUnmount("NTFS:/", true);
|
||||||
|
|
||||||
@ -203,36 +200,29 @@ s32 UnmountNTFS(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _FAT_mem_init()
|
void _FAT_mem_init() {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void* _FAT_mem_allocate(size_t size)
|
void* _FAT_mem_allocate(size_t size) {
|
||||||
{
|
|
||||||
return malloc(size);
|
return malloc(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* _FAT_mem_align(size_t size)
|
void* _FAT_mem_align(size_t size) {
|
||||||
{
|
|
||||||
return memalign(32, size);
|
return memalign(32, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _FAT_mem_free(void *mem)
|
void _FAT_mem_free(void *mem) {
|
||||||
{
|
|
||||||
free(mem);
|
free(mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* ntfs_alloc (size_t size)
|
void* ntfs_alloc (size_t size) {
|
||||||
{
|
|
||||||
return _FAT_mem_allocate(size);
|
return _FAT_mem_allocate(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* ntfs_align (size_t size)
|
void* ntfs_align (size_t size) {
|
||||||
{
|
|
||||||
return _FAT_mem_align(size);
|
return _FAT_mem_align(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ntfs_free (void* mem)
|
void ntfs_free (void* mem) {
|
||||||
{
|
|
||||||
_FAT_mem_free(mem);
|
_FAT_mem_free(mem);
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,7 @@ bool textVideoInit = false;
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
//using the gprintf from crediar because it is smaller than mine
|
//using the gprintf from crediar because it is smaller than mine
|
||||||
void gprintf( const char *str, ... )
|
void gprintf( const char *str, ... ) {
|
||||||
{
|
|
||||||
if (!(geckoinit))return;
|
if (!(geckoinit))return;
|
||||||
|
|
||||||
char astr[4096];
|
char astr[4096];
|
||||||
@ -26,15 +25,12 @@ void gprintf( const char *str, ... )
|
|||||||
usb_sendbuffer_safe( 1, astr, strlen(astr) );
|
usb_sendbuffer_safe( 1, astr, strlen(astr) );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InitGecko()
|
bool InitGecko() {
|
||||||
{
|
|
||||||
u32 geckoattached = usb_isgeckoalive(EXI_CHANNEL_1);
|
u32 geckoattached = usb_isgeckoalive(EXI_CHANNEL_1);
|
||||||
if (geckoattached)
|
if (geckoattached) {
|
||||||
{
|
|
||||||
usb_flush(EXI_CHANNEL_1);
|
usb_flush(EXI_CHANNEL_1);
|
||||||
return true;
|
return true;
|
||||||
}
|
} else return false;
|
||||||
else return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@ extern "C" {
|
|||||||
void gprintf(const char *str, ...);
|
void gprintf(const char *str, ...);
|
||||||
bool InitGecko();
|
bool InitGecko();
|
||||||
#else
|
#else
|
||||||
#define gprintf(...)
|
#define gprintf(...)
|
||||||
#define InitGecko() false
|
#define InitGecko() false
|
||||||
#endif /* NO_DEBUG */
|
#endif /* NO_DEBUG */
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ int MenuHomebrewBrowse() {
|
|||||||
/*** Sound Variables ***/
|
/*** Sound Variables ***/
|
||||||
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, Settings.sfxvolume);
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, Settings.sfxvolume);
|
||||||
// because destroy GuiSound must wait while sound playing is finished, we use a global sound
|
// because destroy GuiSound must wait while sound playing is finished, we use a global sound
|
||||||
if(!btnClick2) btnClick2=new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
|
if (!btnClick2) btnClick2=new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
|
||||||
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
|
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
|
||||||
GuiSound btnClick1(button_click_pcm, button_click_pcm_size, Settings.sfxvolume);
|
GuiSound btnClick1(button_click_pcm, button_click_pcm_size, Settings.sfxvolume);
|
||||||
|
|
||||||
@ -219,11 +219,11 @@ int MenuHomebrewBrowse() {
|
|||||||
|
|
||||||
GuiImage MainButton2Img(&MainButtonImgData);
|
GuiImage MainButton2Img(&MainButtonImgData);
|
||||||
GuiImage MainButton2ImgOver(&MainButtonImgOverData);
|
GuiImage MainButton2ImgOver(&MainButtonImgOverData);
|
||||||
GuiText MainButton2Txt(MainButtonText, 18, (GXColor) {0, 0, 0, 255 });
|
GuiText MainButton2Txt(MainButtonText, 18, (GXColor) {0, 0, 0, 255});
|
||||||
MainButton2Txt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
MainButton2Txt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
MainButton2Txt.SetPosition(148, -12);
|
MainButton2Txt.SetPosition(148, -12);
|
||||||
MainButton2Txt.SetMaxWidth(MainButton2Img.GetWidth()-150, GuiText::DOTTED);
|
MainButton2Txt.SetMaxWidth(MainButton2Img.GetWidth()-150, GuiText::DOTTED);
|
||||||
GuiText MainButton2DescTxt(MainButtonText, 18, (GXColor) { 0, 0, 0, 255});
|
GuiText MainButton2DescTxt(MainButtonText, 18, (GXColor) {0, 0, 0, 255});
|
||||||
MainButton2DescTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
MainButton2DescTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
MainButton2DescTxt.SetPosition(148, 15);
|
MainButton2DescTxt.SetPosition(148, 15);
|
||||||
MainButton2DescTxt.SetMaxWidth(MainButton2Img.GetWidth()-150, GuiText::DOTTED);
|
MainButton2DescTxt.SetMaxWidth(MainButton2Img.GetWidth()-150, GuiText::DOTTED);
|
||||||
@ -250,11 +250,11 @@ int MenuHomebrewBrowse() {
|
|||||||
MainButton3Txt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
MainButton3Txt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
MainButton3Txt.SetPosition(148, -12);
|
MainButton3Txt.SetPosition(148, -12);
|
||||||
MainButton3Txt.SetMaxWidth(MainButton3Img.GetWidth()-150, GuiText::DOTTED);
|
MainButton3Txt.SetMaxWidth(MainButton3Img.GetWidth()-150, GuiText::DOTTED);
|
||||||
GuiText MainButton3DescTxt(MainButtonText, 18, (GXColor) { 0, 0, 0, 255});
|
GuiText MainButton3DescTxt(MainButtonText, 18, (GXColor) {0, 0, 0, 255});
|
||||||
MainButton3DescTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
MainButton3DescTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
MainButton3DescTxt.SetPosition(148, 15);
|
MainButton3DescTxt.SetPosition(148, 15);
|
||||||
MainButton3DescTxt.SetMaxWidth(MainButton3Img.GetWidth()-150, GuiText::DOTTED);
|
MainButton3DescTxt.SetMaxWidth(MainButton3Img.GetWidth()-150, GuiText::DOTTED);
|
||||||
GuiText MainButton3DescOverTxt(MainButtonText, 18, (GXColor) {0, 0, 0, 255 });
|
GuiText MainButton3DescOverTxt(MainButtonText, 18, (GXColor) {0, 0, 0, 255});
|
||||||
MainButton3DescOverTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
MainButton3DescOverTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
MainButton3DescOverTxt.SetPosition(148, 15);
|
MainButton3DescOverTxt.SetPosition(148, 15);
|
||||||
MainButton3DescOverTxt.SetMaxWidth(MainButton3Img.GetWidth()-150, GuiText::SCROLL);
|
MainButton3DescOverTxt.SetMaxWidth(MainButton3Img.GetWidth()-150, GuiText::SCROLL);
|
||||||
@ -273,7 +273,7 @@ int MenuHomebrewBrowse() {
|
|||||||
|
|
||||||
GuiImage MainButton4Img(&MainButtonImgData);
|
GuiImage MainButton4Img(&MainButtonImgData);
|
||||||
GuiImage MainButton4ImgOver(&MainButtonImgOverData);
|
GuiImage MainButton4ImgOver(&MainButtonImgOverData);
|
||||||
GuiText MainButton4Txt(MainButtonText, 18, (GXColor) {0, 0, 0, 255} );
|
GuiText MainButton4Txt(MainButtonText, 18, (GXColor) {0, 0, 0, 255});
|
||||||
MainButton4Txt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
MainButton4Txt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
MainButton4Txt.SetPosition(148, -12);
|
MainButton4Txt.SetPosition(148, -12);
|
||||||
MainButton4Txt.SetMaxWidth(MainButton4Img.GetWidth()-150, GuiText::DOTTED);
|
MainButton4Txt.SetMaxWidth(MainButton4Img.GetWidth()-150, GuiText::DOTTED);
|
||||||
@ -281,7 +281,7 @@ int MenuHomebrewBrowse() {
|
|||||||
MainButton4DescTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
MainButton4DescTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
MainButton4DescTxt.SetPosition(148, 15);
|
MainButton4DescTxt.SetPosition(148, 15);
|
||||||
MainButton4DescTxt.SetMaxWidth(MainButton4Img.GetWidth()-150, GuiText::DOTTED);
|
MainButton4DescTxt.SetMaxWidth(MainButton4Img.GetWidth()-150, GuiText::DOTTED);
|
||||||
GuiText MainButton4DescOverTxt(MainButtonText, 18, (GXColor) { 0, 0, 0, 255});
|
GuiText MainButton4DescOverTxt(MainButtonText, 18, (GXColor) {0, 0, 0, 255});
|
||||||
MainButton4DescOverTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
MainButton4DescOverTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
MainButton4DescOverTxt.SetPosition(148, 15);
|
MainButton4DescOverTxt.SetPosition(148, 15);
|
||||||
MainButton4DescOverTxt.SetMaxWidth(MainButton4Img.GetWidth()-150, GuiText::SCROLL);
|
MainButton4DescOverTxt.SetMaxWidth(MainButton4Img.GetWidth()-150, GuiText::SCROLL);
|
||||||
@ -852,8 +852,7 @@ int MenuHomebrewBrowse() {
|
|||||||
sprintf((char *) &zippath, "%s%s", Settings.homebrewapps_path, filename);
|
sprintf((char *) &zippath, "%s%s", Settings.homebrewapps_path, filename);
|
||||||
|
|
||||||
FILE *fp = fopen(zippath, "wb");
|
FILE *fp = fopen(zippath, "wb");
|
||||||
if (fp != NULL)
|
if (fp != NULL) {
|
||||||
{
|
|
||||||
fwrite(temp, 1, infilesize, fp);
|
fwrite(temp, 1, infilesize, fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 856 B After Width: | Height: | Size: 891 B |
Before Width: | Height: | Size: 930 B After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 957 B After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 937 B After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 6.5 KiB |
Before Width: | Height: | Size: 118 B After Width: | Height: | Size: 211 B |
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 267 B |
Before Width: | Height: | Size: 138 B After Width: | Height: | Size: 147 B |
Before Width: | Height: | Size: 142 B After Width: | Height: | Size: 152 B |
Before Width: | Height: | Size: 146 B After Width: | Height: | Size: 148 B |
Before Width: | Height: | Size: 86 B After Width: | Height: | Size: 90 B |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 8.3 KiB |
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 9.6 KiB |
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.5 KiB |
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 67 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 609 B After Width: | Height: | Size: 841 B |
Before Width: | Height: | Size: 909 B After Width: | Height: | Size: 1.2 KiB |