mirror of
https://github.com/wiidev/usbloadergx.git
synced 2025-02-18 04:16:20 +01:00
*code beautification*
formatted the code to make it easier to read. no functional changes at all. i didn't put anything from the libwiigui folder or banner folder in the beautifier. my automated .bat seems to have done a good job. the only places i see it fucked up was on (GXColor){blablabla}. it treated the brackets in the color like all the other brackets and put the color on a new line and indented it. i think i fixed most of them. not sure if it messed up anywhere else. also not sure about how it handled different linebreaks. it looks fine on windows. if it looks messed up on linux, it can be reverted. the code still compiles and runs fine.
This commit is contained in:
parent
024bdee994
commit
30535c6f5d
File diff suppressed because one or more lines are too long
2
gui.pnps
2
gui.pnps
@ -1 +1 @@
|
|||||||
<pd><ViewState><e p="gui\source\mload" x="false"></e><e p="gui\source\settings" x="false"></e><e p="gui\source\images" x="false"></e><e p="gui\source\prompts" x="true"></e><e p="gui\source\banner" x="false"></e><e p="gui\source\cheats" x="true"></e><e p="gui\source\network" x="false"></e><e p="gui\source\unzip" x="false"></e><e p="gui\source\usbloader" x="false"></e><e p="gui\source\xml" x="false"></e><e p="gui\source\fonts" x="false"></e><e p="gui\source\ramdisc" x="false"></e><e p="gui\source\sounds" x="false"></e><e p="gui\source\wad" x="true"></e><e p="gui" x="true"></e><e p="gui\source\homebrewboot" x="false"></e><e p="gui\source\language" x="true"></e><e p="gui\source" x="true"></e><e p="gui\source\libwbfs" x="false"></e><e p="gui\source\libwiigui" x="false"></e><e p="gui\source\patches" x="false"></e></ViewState></pd>
|
<pd><ViewState><e p="gui\source\mload" x="false"></e><e p="gui\source\settings" x="false"></e><e p="gui\source\images" x="false"></e><e p="gui\source\prompts" x="true"></e><e p="gui\source\banner" x="false"></e><e p="gui\source\cheats" x="false"></e><e p="gui\source\network" x="false"></e><e p="gui\source\unzip" x="false"></e><e p="gui\source\usbloader" x="false"></e><e p="gui\source\xml" x="false"></e><e p="gui\source\fonts" x="false"></e><e p="gui\source\ramdisc" x="false"></e><e p="gui\source\sounds" x="false"></e><e p="gui\source\wad" x="true"></e><e p="gui" x="true"></e><e p="gui\source\homebrewboot" x="false"></e><e p="gui\source\language" x="false"></e><e p="gui\source" x="true"></e><e p="gui\source\libwbfs" x="false"></e><e p="gui\source\libwiigui" x="false"></e><e p="gui\source\patches" x="false"></e></ViewState></pd>
|
@ -209,8 +209,7 @@ uint16_t FreeTypeGX::loadFont(char* fontPath, uint8_t* fontBuffer, FT_Long buffe
|
|||||||
this->ftPointSize = pointSize;
|
this->ftPointSize = pointSize;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
if(fontPath && (stat(fontPath, &st)==0))
|
if (fontPath && (stat(fontPath, &st)==0)) {
|
||||||
{
|
|
||||||
FILE *fontfile = fopen(fontPath, "rb");
|
FILE *fontfile = fopen(fontPath, "rb");
|
||||||
if (fontfile) {
|
if (fontfile) {
|
||||||
FT_Long ftFace_fromFile_Size;
|
FT_Long ftFace_fromFile_Size;
|
||||||
@ -253,13 +252,11 @@ uint16_t FreeTypeGX::loadFont(const char* fontPath, const uint8_t* fontBuffer, F
|
|||||||
void FreeTypeGX::unloadFont() {
|
void FreeTypeGX::unloadFont() {
|
||||||
clearGlyphData();
|
clearGlyphData();
|
||||||
|
|
||||||
if(this->ftFace)
|
if (this->ftFace) {
|
||||||
{
|
|
||||||
FT_Done_Face(this->ftFace);
|
FT_Done_Face(this->ftFace);
|
||||||
this->ftFace = NULL;
|
this->ftFace = NULL;
|
||||||
}
|
}
|
||||||
if(this->ftFace_fromFile)
|
if (this->ftFace_fromFile) {
|
||||||
{
|
|
||||||
free(this->ftFace_fromFile);
|
free(this->ftFace_fromFile);
|
||||||
this->ftFace_fromFile = NULL;
|
this->ftFace_fromFile = NULL;
|
||||||
}
|
}
|
||||||
@ -269,8 +266,7 @@ void FreeTypeGX::unloadFont() {
|
|||||||
*
|
*
|
||||||
* This routine clears all members of the font map structure and frees all allocated memory back to the system.
|
* This routine clears all members of the font map structure and frees all allocated memory back to the system.
|
||||||
*/
|
*/
|
||||||
void FreeTypeGX::clearGlyphData()
|
void FreeTypeGX::clearGlyphData() {
|
||||||
{
|
|
||||||
if (this->fontData.size() == 0)
|
if (this->fontData.size() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -476,8 +472,7 @@ void FreeTypeGX::loadGlyphData(FT_Bitmap *bmp, ftgxCharData *charData) {
|
|||||||
*/
|
*/
|
||||||
int16_t FreeTypeGX::getStyleOffsetWidth(uint16_t width, uint16_t format) {
|
int16_t FreeTypeGX::getStyleOffsetWidth(uint16_t width, uint16_t format) {
|
||||||
|
|
||||||
switch(format & FTGX_JUSTIFY_MASK)
|
switch (format & FTGX_JUSTIFY_MASK) {
|
||||||
{
|
|
||||||
case FTGX_JUSTIFY_LEFT:
|
case FTGX_JUSTIFY_LEFT:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -500,10 +495,8 @@ int16_t FreeTypeGX::getStyleOffsetWidth(uint16_t width, uint16_t format) {
|
|||||||
* @param offset Current pixel offset data of the string.
|
* @param offset Current pixel offset data of the string.
|
||||||
* @param format Positional format of the string.
|
* @param format Positional format of the string.
|
||||||
*/
|
*/
|
||||||
int16_t FreeTypeGX::getStyleOffsetHeight(ftgxDataOffset *offset, uint16_t format)
|
int16_t FreeTypeGX::getStyleOffsetHeight(ftgxDataOffset *offset, uint16_t format) {
|
||||||
{
|
switch (format & FTGX_ALIGN_MASK) {
|
||||||
switch(format & FTGX_ALIGN_MASK)
|
|
||||||
{
|
|
||||||
case FTGX_ALIGN_TOP:
|
case FTGX_ALIGN_TOP:
|
||||||
return offset->ascender;
|
return offset->ascender;
|
||||||
|
|
||||||
@ -563,8 +556,7 @@ uint16_t FreeTypeGX::drawText(int16_t x, int16_t y, wchar_t *text, GXColor color
|
|||||||
ftgxCharData* glyphData = NULL;
|
ftgxCharData* glyphData = NULL;
|
||||||
if ( this->fontData.find(text[i]) != this->fontData.end() ) {
|
if ( this->fontData.find(text[i]) != this->fontData.end() ) {
|
||||||
glyphData = &this->fontData[text[i]];
|
glyphData = &this->fontData[text[i]];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
glyphData = this->cacheGlyphData(text[i]);
|
glyphData = this->cacheGlyphData(text[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -659,8 +651,7 @@ uint16_t FreeTypeGX::getWidth(wchar_t *text) {
|
|||||||
ftgxCharData* glyphData = NULL;
|
ftgxCharData* glyphData = NULL;
|
||||||
if ( this->fontData.find(text[i]) != this->fontData.end() ) {
|
if ( this->fontData.find(text[i]) != this->fontData.end() ) {
|
||||||
glyphData = &this->fontData[text[i]];
|
glyphData = &this->fontData[text[i]];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
glyphData = this->cacheGlyphData(text[i]);
|
glyphData = this->cacheGlyphData(text[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -728,8 +719,7 @@ ftgxDataOffset* FreeTypeGX::getOffset(wchar_t *text, ftgxDataOffset* offset) {
|
|||||||
ftgxCharData* glyphData = NULL;
|
ftgxCharData* glyphData = NULL;
|
||||||
if ( this->fontData.find(text[i]) != this->fontData.end() ) {
|
if ( this->fontData.find(text[i]) != this->fontData.end() ) {
|
||||||
glyphData = &this->fontData[text[i]];
|
glyphData = &this->fontData[text[i]];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
glyphData = this->cacheGlyphData(text[i]);
|
glyphData = this->cacheGlyphData(text[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,7 +203,10 @@ 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){0xff, 0xff, 0xff, 0xff}; /**< Constant color value used only to sanitize Doxygen documentation. */
|
const GXColor ftgxWhite = (GXColor) {
|
||||||
|
0xff, 0xff, 0xff, 0xff
|
||||||
|
}
|
||||||
|
; /**< Constant color value used only to sanitize Doxygen documentation. */
|
||||||
|
|
||||||
/*! \class FreeTypeGX
|
/*! \class FreeTypeGX
|
||||||
* \brief Wrapper class for the libFreeType library with GX rendering.
|
* \brief Wrapper class for the libFreeType library with GX rendering.
|
||||||
|
@ -335,8 +335,7 @@ uint16_t Metaphrasis::convertRGBAToRGB5A3(uint32_t rgba) {
|
|||||||
|
|
||||||
color = (r << 10) | (g << 5) | b;
|
color = (r << 10) | (g << 5) | b;
|
||||||
color |= 0x8000;
|
color |= 0x8000;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
r = r >> 4;
|
r = r >> 4;
|
||||||
g = g >> 4;
|
g = g >> 4;
|
||||||
b = b >> 4;
|
b = b >> 4;
|
||||||
|
@ -15,8 +15,7 @@
|
|||||||
*
|
*
|
||||||
* Initializes the Wii's audio subsystem
|
* Initializes the Wii's audio subsystem
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void InitAudio()
|
void InitAudio() {
|
||||||
{
|
|
||||||
AUDIO_Init(NULL);
|
AUDIO_Init(NULL);
|
||||||
ASND_Init();
|
ASND_Init();
|
||||||
ASND_Pause(0);
|
ASND_Pause(0);
|
||||||
@ -28,8 +27,7 @@ void InitAudio()
|
|||||||
* Shuts down audio subsystem. Useful to avoid unpleasant sounds if a
|
* Shuts down audio subsystem. Useful to avoid unpleasant sounds if a
|
||||||
* crash occurs during shutdown.
|
* crash occurs during shutdown.
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void ShutdownAudio()
|
void ShutdownAudio() {
|
||||||
{
|
|
||||||
ASND_Pause(1);
|
ASND_Pause(1);
|
||||||
ASND_End();
|
ASND_End();
|
||||||
}
|
}
|
||||||
|
@ -32,8 +32,7 @@ static GuiImageData * cover[BUFFERSIZE];
|
|||||||
static GuiImage * coverImg[BUFFERSIZE];
|
static GuiImage * coverImg[BUFFERSIZE];
|
||||||
static GuiImage * NoCover[BUFFERSIZE];
|
static GuiImage * NoCover[BUFFERSIZE];
|
||||||
|
|
||||||
GuiImage * ImageBuffer(int imagenumber)
|
GuiImage * ImageBuffer(int imagenumber) {
|
||||||
{
|
|
||||||
if ((BUFFERSIZE-1 > imagenumber) && direction >= 0) {
|
if ((BUFFERSIZE-1 > imagenumber) && direction >= 0) {
|
||||||
return coverImg[imagenumber];
|
return coverImg[imagenumber];
|
||||||
}
|
}
|
||||||
@ -49,8 +48,7 @@ GuiImage * ImageBuffer(int imagenumber)
|
|||||||
return NoCover[imagenumber];
|
return NoCover[imagenumber];
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadImages()
|
void LoadImages() {
|
||||||
{
|
|
||||||
if (!changed || BufferHalt)
|
if (!changed || BufferHalt)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -203,8 +201,7 @@ void LoadImages()
|
|||||||
firstime = false;
|
firstime = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewOffset(int off, int d)
|
void NewOffset(int off, int d) {
|
||||||
{
|
|
||||||
if (offset == off || loading < BUFFERSIZE)
|
if (offset == off || loading < BUFFERSIZE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -219,8 +216,7 @@ void NewOffset(int off, int d)
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* HaltBuffer
|
* HaltBuffer
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void HaltBufferThread()
|
void HaltBufferThread() {
|
||||||
{
|
|
||||||
BufferHalt = true;
|
BufferHalt = true;
|
||||||
firstime = true;
|
firstime = true;
|
||||||
changed = true;
|
changed = true;
|
||||||
@ -245,8 +241,7 @@ void HaltBufferThread()
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* ResumeBufferThread
|
* ResumeBufferThread
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void ResumeBufferThread(int offset)
|
void ResumeBufferThread(int offset) {
|
||||||
{
|
|
||||||
BufferHalt = false;
|
BufferHalt = false;
|
||||||
firstime = true;
|
firstime = true;
|
||||||
changed = true;
|
changed = true;
|
||||||
@ -268,10 +263,8 @@ void ResumeBufferThread(int offset)
|
|||||||
/*********************************************************************************
|
/*********************************************************************************
|
||||||
* Bufferthread
|
* Bufferthread
|
||||||
*********************************************************************************/
|
*********************************************************************************/
|
||||||
static void * bufferinitcallback(void *arg)
|
static void * bufferinitcallback(void *arg) {
|
||||||
{
|
while (1) {
|
||||||
while(1)
|
|
||||||
{
|
|
||||||
if (BufferHalt)
|
if (BufferHalt)
|
||||||
LWP_SuspendThread(bufferthread);
|
LWP_SuspendThread(bufferthread);
|
||||||
|
|
||||||
@ -283,16 +276,14 @@ static void * bufferinitcallback(void *arg)
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* InitBufferThread with priority 50
|
* InitBufferThread with priority 50
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void InitBufferThread()
|
void InitBufferThread() {
|
||||||
{
|
|
||||||
LWP_CreateThread(&bufferthread, bufferinitcallback, NULL, NULL, 0, 50);
|
LWP_CreateThread(&bufferthread, bufferinitcallback, NULL, NULL, 0, 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* ShutdownThread
|
* ShutdownThread
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void ShutdownBufferThread()
|
void ShutdownBufferThread() {
|
||||||
{
|
|
||||||
LWP_JoinThread (bufferthread, NULL);
|
LWP_JoinThread (bufferthread, NULL);
|
||||||
bufferthread = LWP_THREAD_NULL;
|
bufferthread = LWP_THREAD_NULL;
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,7 @@ extern GuiWindow * mainWindow;
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* CheatMenu
|
* CheatMenu
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int CheatMenu(const char * gameID)
|
int CheatMenu(const char * gameID) {
|
||||||
{
|
|
||||||
int choice = 0;
|
int choice = 0;
|
||||||
bool exit = false;
|
bool exit = false;
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
@ -67,11 +66,12 @@ int CheatMenu(const char * gameID)
|
|||||||
//char tmp[10];
|
//char tmp[10];
|
||||||
|
|
||||||
|
|
||||||
switch(check)
|
switch (check) {
|
||||||
{
|
case -1:
|
||||||
case -1: WindowPrompt(tr("Error"),tr("Cheatfile is blank"),tr("OK"));
|
WindowPrompt(tr("Error"),tr("Cheatfile is blank"),tr("OK"));
|
||||||
break;
|
break;
|
||||||
case 0: download = WindowPrompt(tr("Error"),tr("No Cheatfile found"),tr("OK"),tr("Download Now"));
|
case 0:
|
||||||
|
download = WindowPrompt(tr("Error"),tr("No Cheatfile found"),tr("OK"),tr("Download Now"));
|
||||||
//snprintf(tmp, sizeof(tmp), "%i",download);
|
//snprintf(tmp, sizeof(tmp), "%i",download);
|
||||||
|
|
||||||
//WindowPrompt(0,tmp,tr("OK"),tr("Download Now"));
|
//WindowPrompt(0,tmp,tr("OK"),tr("Download Now"));
|
||||||
@ -91,8 +91,7 @@ int CheatMenu(const char * gameID)
|
|||||||
titleTxt.SetMaxWidth(350, GuiText::SCROLL);
|
titleTxt.SetMaxWidth(350, GuiText::SCROLL);
|
||||||
titleTxt.SetPosition(12,40);
|
titleTxt.SetPosition(12,40);
|
||||||
|
|
||||||
for(int i = 0; i <= cntcheats; i++)
|
for (int i = 0; i <= cntcheats; i++) {
|
||||||
{
|
|
||||||
cheatslst.SetValue(i, "%s",c.getCheatName(i).c_str());
|
cheatslst.SetValue(i, "%s",c.getCheatName(i).c_str());
|
||||||
cheatslst.SetName(i, "OFF");
|
cheatslst.SetName(i, "OFF");
|
||||||
}
|
}
|
||||||
@ -109,36 +108,27 @@ int CheatMenu(const char * gameID)
|
|||||||
mainWindow->Append(&w);
|
mainWindow->Append(&w);
|
||||||
ResumeGui();
|
ResumeGui();
|
||||||
|
|
||||||
while(!exit)
|
while (!exit) {
|
||||||
{
|
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
|
|
||||||
ret = chtBrowser.GetClickedOption();
|
ret = chtBrowser.GetClickedOption();
|
||||||
if (ret != -1)
|
if (ret != -1) {
|
||||||
{
|
|
||||||
const char *strCheck = cheatslst.GetName(ret);
|
const char *strCheck = cheatslst.GetName(ret);
|
||||||
if (strncmp(strCheck,"ON",2) == 0)
|
if (strncmp(strCheck,"ON",2) == 0) {
|
||||||
{
|
|
||||||
cheatslst.SetName(ret,"%s","OFF");
|
cheatslst.SetName(ret,"%s","OFF");
|
||||||
}
|
} else if (strncmp(strCheck,"OFF",3) == 0) {
|
||||||
else if (strncmp(strCheck,"OFF",3) == 0)
|
|
||||||
{
|
|
||||||
cheatslst.SetName(ret,"%s","ON");
|
cheatslst.SetName(ret,"%s","ON");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(createBtn.GetState() == STATE_CLICKED)
|
if (createBtn.GetState() == STATE_CLICKED) {
|
||||||
{
|
|
||||||
createBtn.ResetState();
|
createBtn.ResetState();
|
||||||
if (cntcheats > 0)
|
if (cntcheats > 0) {
|
||||||
{
|
|
||||||
int selectednrs[30];
|
int selectednrs[30];
|
||||||
int x = 0;
|
int x = 0;
|
||||||
for(int i = 0; i <= cntcheats; i++)
|
for (int i = 0; i <= cntcheats; i++) {
|
||||||
{
|
|
||||||
const char *strCheck = cheatslst.GetName(i);
|
const char *strCheck = cheatslst.GetName(i);
|
||||||
if (strncmp(strCheck,"ON",2) == 0)
|
if (strncmp(strCheck,"ON",2) == 0) {
|
||||||
{
|
|
||||||
selectednrs[x] = i;
|
selectednrs[x] = i;
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
@ -154,8 +144,7 @@ int CheatMenu(const char * gameID)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(backBtn.GetState() == STATE_CLICKED)
|
if (backBtn.GetState() == STATE_CLICKED) {
|
||||||
{
|
|
||||||
backBtn.ResetState();
|
backBtn.ResetState();
|
||||||
exit = true;
|
exit = true;
|
||||||
break;
|
break;
|
||||||
|
@ -4,68 +4,50 @@
|
|||||||
|
|
||||||
#define OUTOFRANGE "Error:Range"
|
#define OUTOFRANGE "Error:Range"
|
||||||
|
|
||||||
GCTCheats::GCTCheats(void)
|
GCTCheats::GCTCheats(void) {
|
||||||
{
|
|
||||||
iCntCheats = 0;
|
iCntCheats = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GCTCheats::~GCTCheats(void)
|
GCTCheats::~GCTCheats(void) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int GCTCheats::getCnt()
|
int GCTCheats::getCnt() {
|
||||||
{
|
|
||||||
return iCntCheats;
|
return iCntCheats;
|
||||||
}
|
}
|
||||||
|
|
||||||
string GCTCheats::getGameName(void)
|
string GCTCheats::getGameName(void) {
|
||||||
{
|
|
||||||
return sGameTitle;
|
return sGameTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
string GCTCheats::getGameID(void)
|
string GCTCheats::getGameID(void) {
|
||||||
{
|
|
||||||
return sGameID;
|
return sGameID;
|
||||||
}
|
}
|
||||||
|
|
||||||
string GCTCheats::getCheat(int nr)
|
string GCTCheats::getCheat(int nr) {
|
||||||
{
|
if (nr <= (iCntCheats-1)) {
|
||||||
if (nr <= (iCntCheats-1))
|
|
||||||
{
|
|
||||||
return sCheats[nr];
|
return sCheats[nr];
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return OUTOFRANGE;//"Error: CheatNr out of range";
|
return OUTOFRANGE;//"Error: CheatNr out of range";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string GCTCheats::getCheatName(int nr)
|
string GCTCheats::getCheatName(int nr) {
|
||||||
{
|
if (nr <= (iCntCheats-1)) {
|
||||||
if (nr <= (iCntCheats-1))
|
|
||||||
{
|
|
||||||
return sCheatName[nr];
|
return sCheatName[nr];
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return "Error: CheatNr out of range";
|
return "Error: CheatNr out of range";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string GCTCheats::getCheatComment(int nr)
|
string GCTCheats::getCheatComment(int nr) {
|
||||||
{
|
if (nr <= (iCntCheats-1)) {
|
||||||
if (nr <= (iCntCheats-1))
|
|
||||||
{
|
|
||||||
return sCheatComment[nr];
|
return sCheatComment[nr];
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return "Error: CheatNr out of range";
|
return "Error: CheatNr out of range";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int GCTCheats::createGCT(int nr,const char * filename)
|
int GCTCheats::createGCT(int nr,const char * filename) {
|
||||||
{
|
|
||||||
ofstream filestr;
|
ofstream filestr;
|
||||||
filestr.open(filename);
|
filestr.open(filename);
|
||||||
|
|
||||||
@ -83,8 +65,7 @@ int GCTCheats::createGCT(int nr,const char * filename)
|
|||||||
long int li;
|
long int li;
|
||||||
int len = buf.size();
|
int len = buf.size();
|
||||||
|
|
||||||
while (x < len)
|
while (x < len) {
|
||||||
{
|
|
||||||
string temp = buf.substr(x,2);
|
string temp = buf.substr(x,2);
|
||||||
li = strtol(temp.c_str(),NULL,16);
|
li = strtol(temp.c_str(),NULL,16);
|
||||||
temp = li;
|
temp = li;
|
||||||
@ -97,8 +78,7 @@ int GCTCheats::createGCT(int nr,const char * filename)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GCTCheats::createGCT(const char * chtbuffer,const char * filename)
|
int GCTCheats::createGCT(const char * chtbuffer,const char * filename) {
|
||||||
{
|
|
||||||
ofstream filestr;
|
ofstream filestr;
|
||||||
filestr.open(filename);
|
filestr.open(filename);
|
||||||
|
|
||||||
@ -116,8 +96,7 @@ int GCTCheats::createGCT(const char * chtbuffer,const char * filename)
|
|||||||
long int li;
|
long int li;
|
||||||
int len = buf.size();
|
int len = buf.size();
|
||||||
|
|
||||||
while (x < len)
|
while (x < len) {
|
||||||
{
|
|
||||||
string temp = buf.substr(x,2);
|
string temp = buf.substr(x,2);
|
||||||
li = strtol(temp.c_str(),NULL,16);
|
li = strtol(temp.c_str(),NULL,16);
|
||||||
temp = li;
|
temp = li;
|
||||||
@ -132,8 +111,7 @@ int GCTCheats::createGCT(const char * chtbuffer,const char * filename)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GCTCheats::createGCT(int nr[],int cnt,const char * filename)
|
int GCTCheats::createGCT(int nr[],int cnt,const char * filename) {
|
||||||
{
|
|
||||||
|
|
||||||
ofstream filestr;
|
ofstream filestr;
|
||||||
filestr.open(filename);
|
filestr.open(filename);
|
||||||
@ -148,16 +126,14 @@ int GCTCheats::createGCT(int nr[],int cnt,const char * filename)
|
|||||||
filestr.write(header,sizeof(header));
|
filestr.write(header,sizeof(header));
|
||||||
|
|
||||||
int c = 0;
|
int c = 0;
|
||||||
while (c != cnt)
|
while (c != cnt) {
|
||||||
{
|
|
||||||
int actnr = nr[c];
|
int actnr = nr[c];
|
||||||
string buf = getCheat(actnr);
|
string buf = getCheat(actnr);
|
||||||
long int li;
|
long int li;
|
||||||
int len = buf.size();
|
int len = buf.size();
|
||||||
int x = 0;
|
int x = 0;
|
||||||
|
|
||||||
while (x < len)
|
while (x < len) {
|
||||||
{
|
|
||||||
string temp = buf.substr(x,2);
|
string temp = buf.substr(x,2);
|
||||||
li = strtol(temp.c_str(),NULL,16);
|
li = strtol(temp.c_str(),NULL,16);
|
||||||
temp = li;
|
temp = li;
|
||||||
@ -172,8 +148,7 @@ filestr.close();
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GCTCheats::openTxtfile(const char * filename)
|
int GCTCheats::openTxtfile(const char * filename) {
|
||||||
{
|
|
||||||
ifstream filestr;
|
ifstream filestr;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
string str;
|
string str;
|
||||||
@ -191,37 +166,31 @@ int GCTCheats::openTxtfile(const char * filename)
|
|||||||
getline(filestr,sGameTitle);
|
getline(filestr,sGameTitle);
|
||||||
filestr.ignore();
|
filestr.ignore();
|
||||||
|
|
||||||
while(!filestr.eof())
|
while (!filestr.eof()) {
|
||||||
{
|
|
||||||
getline(filestr,sCheatName[i]);
|
getline(filestr,sCheatName[i]);
|
||||||
string cheatdata;
|
string cheatdata;
|
||||||
bool emptyline = false;
|
bool emptyline = false;
|
||||||
bool isComment = false;
|
bool isComment = false;
|
||||||
|
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
getline(filestr,str,'\n');
|
getline(filestr,str,'\n');
|
||||||
//cheatdata.append(str);
|
//cheatdata.append(str);
|
||||||
|
|
||||||
if (str == "")
|
if (str == "") {
|
||||||
{
|
|
||||||
emptyline = true;
|
emptyline = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str.size() <= 16 || str.size() > 17 )
|
if (str.size() <= 16 || str.size() > 17 ) {
|
||||||
{
|
|
||||||
isComment = true;
|
isComment = true;
|
||||||
printf ("%i",str.size());
|
printf ("%i",str.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isComment)
|
if (!isComment) {
|
||||||
{
|
|
||||||
cheatdata.append(str);
|
cheatdata.append(str);
|
||||||
size_t found=cheatdata.find(' ');
|
size_t found=cheatdata.find(' ');
|
||||||
cheatdata.replace(found,1,"");
|
cheatdata.replace(found,1,"");
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
sCheatComment[i] = str;
|
sCheatComment[i] = str;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,16 +256,14 @@ filestr.close();
|
|||||||
return 1;
|
return 1;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
struct GCTCheats::chtentries GCTCheats::getCheatList(void)
|
struct GCTCheats::chtentries GCTCheats::getCheatList(void) {
|
||||||
{
|
|
||||||
|
|
||||||
struct GCTCheats::chtentries cheatlist;
|
struct GCTCheats::chtentries cheatlist;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
cheatlist.sGameID = sGameID;
|
cheatlist.sGameID = sGameID;
|
||||||
cheatlist.sGameTitle = sGameTitle;
|
cheatlist.sGameTitle = sGameTitle;
|
||||||
|
|
||||||
while (i < iCntCheats)
|
while (i < iCntCheats) {
|
||||||
{
|
|
||||||
cheatlist.sCheatName[i] = sCheatName[i];
|
cheatlist.sCheatName[i] = sCheatName[i];
|
||||||
cheatlist.sCheats[i] = sCheats[i];
|
cheatlist.sCheats[i] = sCheats[i];
|
||||||
i++;
|
i++;
|
||||||
@ -304,8 +271,7 @@ struct GCTCheats::chtentries GCTCheats::getCheatList(void)
|
|||||||
return cheatlist;
|
return cheatlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct GCTCheats::chtentries GCTCheats::getCheatList(const char * filename)
|
struct GCTCheats::chtentries GCTCheats::getCheatList(const char * filename) {
|
||||||
{
|
|
||||||
openTxtfile(filename);
|
openTxtfile(filename);
|
||||||
struct GCTCheats::chtentries cheatlist;
|
struct GCTCheats::chtentries cheatlist;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -313,8 +279,7 @@ struct GCTCheats::chtentries GCTCheats::getCheatList(const char * filename)
|
|||||||
cheatlist.sGameTitle = sGameTitle;
|
cheatlist.sGameTitle = sGameTitle;
|
||||||
cheatlist.iCntCheats = iCntCheats;
|
cheatlist.iCntCheats = iCntCheats;
|
||||||
|
|
||||||
while (i < iCntCheats)
|
while (i < iCntCheats) {
|
||||||
{
|
|
||||||
cheatlist.sCheatName[i] = sCheatName[i];
|
cheatlist.sCheatName[i] = sCheatName[i];
|
||||||
cheatlist.sCheats[i] = sCheats[i];
|
cheatlist.sCheats[i] = sCheats[i];
|
||||||
i++;
|
i++;
|
||||||
@ -322,8 +287,7 @@ struct GCTCheats::chtentries GCTCheats::getCheatList(const char * filename)
|
|||||||
return cheatlist;
|
return cheatlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GCTCheats::download_txtcheat(int id)
|
int GCTCheats::download_txtcheat(int id) {
|
||||||
{
|
|
||||||
//ToDo
|
//ToDo
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
struct chtentrie
|
struct chtentrie {
|
||||||
{
|
|
||||||
string sGameID;
|
string sGameID;
|
||||||
string sGameTitle;
|
string sGameTitle;
|
||||||
string sCheatName[MAXCHEATS];
|
string sCheatName[MAXCHEATS];
|
||||||
@ -25,8 +24,7 @@ struct chtentrie
|
|||||||
};
|
};
|
||||||
|
|
||||||
//!Handles Ocarina TXT Cheatfiles
|
//!Handles Ocarina TXT Cheatfiles
|
||||||
class GCTCheats
|
class GCTCheats {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
chtentrie ccc;
|
chtentrie ccc;
|
||||||
string sGameID;
|
string sGameID;
|
||||||
@ -38,8 +36,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
struct chtentries
|
struct chtentries {
|
||||||
{
|
|
||||||
string sGameID;
|
string sGameID;
|
||||||
string sGameTitle;
|
string sGameTitle;
|
||||||
string sCheatName[MAXCHEATS];
|
string sCheatName[MAXCHEATS];
|
||||||
|
@ -12,8 +12,7 @@
|
|||||||
#define CACHE 8
|
#define CACHE 8
|
||||||
#define SECTORS 64
|
#define SECTORS 64
|
||||||
|
|
||||||
int USBDevice_Init()
|
int USBDevice_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("USB:/");
|
fatUnmount("USB:/");
|
||||||
//right now mounts first FAT-partition
|
//right now mounts first FAT-partition
|
||||||
@ -27,26 +26,22 @@ int USBDevice_Init()
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void USBDevice_deInit()
|
void USBDevice_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("USB:/");
|
fatUnmount("USB:/");
|
||||||
}
|
}
|
||||||
|
|
||||||
int isSdInserted()
|
int isSdInserted() {
|
||||||
{
|
|
||||||
return __io_wiisd.isInserted();
|
return __io_wiisd.isInserted();
|
||||||
}
|
}
|
||||||
|
|
||||||
int isInserted(const char *path)
|
int isInserted(const char *path) {
|
||||||
{
|
|
||||||
if (!strncmp(path, "USB:", 4))
|
if (!strncmp(path, "USB:", 4))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return __io_wiisd.isInserted();
|
return __io_wiisd.isInserted();
|
||||||
}
|
}
|
||||||
int SDCard_Init()
|
int SDCard_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:/");
|
||||||
//right now mounts first FAT-partition
|
//right now mounts first FAT-partition
|
||||||
@ -55,8 +50,7 @@ int SDCard_Init()
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDCard_deInit()
|
void SDCard_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:/");
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
#define _FATMOUNTER_H_
|
#define _FATMOUNTER_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int USBDevice_Init();
|
int USBDevice_Init();
|
||||||
|
@ -35,8 +35,7 @@ void CopyHomebrewMemory(u32 read, u8 *temp, u32 len) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int BootHomebrew(char * path)
|
int BootHomebrew(char * path) {
|
||||||
{
|
|
||||||
void *buffer = NULL;
|
void *buffer = NULL;
|
||||||
u32 filesize = 0;
|
u32 filesize = 0;
|
||||||
entrypoint entry;
|
entrypoint entry;
|
||||||
@ -51,8 +50,7 @@ int BootHomebrew(char * path)
|
|||||||
|
|
||||||
buffer = malloc(filesize);
|
buffer = malloc(filesize);
|
||||||
|
|
||||||
if(fread (buffer, 1, filesize, file) != filesize)
|
if (fread (buffer, 1, filesize, file) != filesize) {
|
||||||
{
|
|
||||||
fclose (file);
|
fclose (file);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
SDCard_deInit();
|
SDCard_deInit();
|
||||||
@ -103,8 +101,7 @@ int BootHomebrew(char * path)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BootHomebrewFromMem()
|
int BootHomebrewFromMem() {
|
||||||
{
|
|
||||||
entrypoint entry;
|
entrypoint entry;
|
||||||
u32 cpu_isr;
|
u32 cpu_isr;
|
||||||
|
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
#define _BOOTHOMEBREW_H_
|
#define _BOOTHOMEBREW_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int BootHomebrew(char * path);
|
int BootHomebrew(char * path);
|
||||||
|
@ -47,8 +47,7 @@ u8 boothomebrew = 0;
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* roundup Function
|
* roundup Function
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int roundup(float number)
|
int roundup(float number) {
|
||||||
{
|
|
||||||
if (number == (int) number)
|
if (number == (int) number)
|
||||||
return (int) number;
|
return (int) number;
|
||||||
else
|
else
|
||||||
@ -58,8 +57,7 @@ int roundup(float number)
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* MenuHomebrewBrowse
|
* MenuHomebrewBrowse
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int MenuHomebrewBrowse()
|
int MenuHomebrewBrowse() {
|
||||||
{
|
|
||||||
int menu = MENU_NONE;
|
int menu = MENU_NONE;
|
||||||
int choice = 0;
|
int choice = 0;
|
||||||
|
|
||||||
@ -332,8 +330,7 @@ int MenuHomebrewBrowse()
|
|||||||
const int pages = roundup(filecount/4.0f);
|
const int pages = roundup(filecount/4.0f);
|
||||||
bool wifi_btn_loaded=false;
|
bool wifi_btn_loaded=false;
|
||||||
|
|
||||||
while (menu == MENU_NONE) //set pageToDisplay to 0 to quit
|
while (menu == MENU_NONE) { //set pageToDisplay to 0 to quit
|
||||||
{
|
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
|
|
||||||
menu = MENU_NONE;
|
menu = MENU_NONE;
|
||||||
@ -352,8 +349,7 @@ int MenuHomebrewBrowse()
|
|||||||
MainButton3.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 35);
|
MainButton3.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 35);
|
||||||
MainButton4.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 35);
|
MainButton4.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 35);
|
||||||
while (MainButton1.GetEffect()>0) usleep(50);
|
while (MainButton1.GetEffect()>0) usleep(50);
|
||||||
}
|
} else if (slidedirection == LEFT) {
|
||||||
else if(slidedirection == LEFT) {
|
|
||||||
MainButton1.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 35);
|
MainButton1.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 35);
|
||||||
MainButton2.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 35);
|
MainButton2.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 35);
|
||||||
MainButton3.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 35);
|
MainButton3.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 35);
|
||||||
@ -600,14 +596,12 @@ int MenuHomebrewBrowse()
|
|||||||
MainButton2.SetEffect(EFFECT_FADE, 20);
|
MainButton2.SetEffect(EFFECT_FADE, 20);
|
||||||
MainButton3.SetEffect(EFFECT_FADE, 20);
|
MainButton3.SetEffect(EFFECT_FADE, 20);
|
||||||
MainButton4.SetEffect(EFFECT_FADE, 20);
|
MainButton4.SetEffect(EFFECT_FADE, 20);
|
||||||
}
|
} else if (slidedirection == LEFT) {
|
||||||
else if(slidedirection == LEFT) {
|
|
||||||
MainButton1.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 35);
|
MainButton1.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 35);
|
||||||
MainButton2.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 35);
|
MainButton2.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 35);
|
||||||
MainButton3.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 35);
|
MainButton3.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 35);
|
||||||
MainButton4.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 35);
|
MainButton4.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 35);
|
||||||
}
|
} else if (slidedirection == RIGHT) {
|
||||||
else if(slidedirection == RIGHT) {
|
|
||||||
MainButton1.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN, 35);
|
MainButton1.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN, 35);
|
||||||
MainButton2.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN, 35);
|
MainButton2.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN, 35);
|
||||||
MainButton3.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN, 35);
|
MainButton3.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN, 35);
|
||||||
@ -620,8 +614,7 @@ int MenuHomebrewBrowse()
|
|||||||
|
|
||||||
while (MainButton1.GetEffect() > 0) usleep(50);
|
while (MainButton1.GetEffect() > 0) usleep(50);
|
||||||
|
|
||||||
while(!changed)
|
while (!changed) {
|
||||||
{
|
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
|
|
||||||
if (MainButton1.GetState() == STATE_CLICKED) {
|
if (MainButton1.GetState() == STATE_CLICKED) {
|
||||||
@ -651,8 +644,7 @@ int MenuHomebrewBrowse()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
MainButton1.ResetState();
|
MainButton1.ResetState();
|
||||||
}
|
} else if (MainButton2.GetState() == STATE_CLICKED) {
|
||||||
else if(MainButton2.GetState() == STATE_CLICKED) {
|
|
||||||
char temp[200];
|
char temp[200];
|
||||||
char iconpath[200];
|
char iconpath[200];
|
||||||
char metapath[200];
|
char metapath[200];
|
||||||
@ -679,8 +671,7 @@ int MenuHomebrewBrowse()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
MainButton2.ResetState();
|
MainButton2.ResetState();
|
||||||
}
|
} else if (MainButton3.GetState() == STATE_CLICKED) {
|
||||||
else if(MainButton3.GetState() == STATE_CLICKED) {
|
|
||||||
char temp[200];
|
char temp[200];
|
||||||
char iconpath[200];
|
char iconpath[200];
|
||||||
char metapath[200];
|
char metapath[200];
|
||||||
@ -707,8 +698,7 @@ int MenuHomebrewBrowse()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
MainButton3.ResetState();
|
MainButton3.ResetState();
|
||||||
}
|
} else if (MainButton4.GetState() == STATE_CLICKED) {
|
||||||
else if(MainButton4.GetState() == STATE_CLICKED) {
|
|
||||||
char temp[200];
|
char temp[200];
|
||||||
char iconpath[200];
|
char iconpath[200];
|
||||||
char metapath[200];
|
char metapath[200];
|
||||||
@ -778,8 +768,7 @@ int MenuHomebrewBrowse()
|
|||||||
s32 thetimeofbg = bgMusic->GetPlayTime();
|
s32 thetimeofbg = bgMusic->GetPlayTime();
|
||||||
bgMusic->Stop();
|
bgMusic->Stop();
|
||||||
choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0);
|
choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0);
|
||||||
if(!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path))
|
if (!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) {
|
||||||
{
|
|
||||||
bgMusic->Play();
|
bgMusic->Play();
|
||||||
} else {
|
} else {
|
||||||
bgMusic->PlayOggFile(Settings.ogg_path);
|
bgMusic->PlayOggFile(Settings.ogg_path);
|
||||||
@ -852,9 +841,7 @@ int MenuHomebrewBrowse()
|
|||||||
if (read != infilesize) {
|
if (read != infilesize) {
|
||||||
WindowPrompt(tr("Error:"), tr("No data could be read."), tr("OK"));
|
WindowPrompt(tr("Error:"), tr("No data could be read."), tr("OK"));
|
||||||
FreeHomebrewBuffer();
|
FreeHomebrewBuffer();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
//determine what type of file we just got
|
//determine what type of file we just got
|
||||||
unsigned char filename[31];
|
unsigned char filename[31];
|
||||||
char tmptxt[31];
|
char tmptxt[31];
|
||||||
@ -862,8 +849,7 @@ int MenuHomebrewBrowse()
|
|||||||
net_read(connection, &filename, 30);
|
net_read(connection, &filename, 30);
|
||||||
sprintf(tmptxt,"%s",filename);
|
sprintf(tmptxt,"%s",filename);
|
||||||
//if we got a wad
|
//if we got a wad
|
||||||
if(strstr(tmptxt,".wad") || strstr(tmptxt,".WAD"))
|
if (strstr(tmptxt,".wad") || strstr(tmptxt,".WAD")) {
|
||||||
{
|
|
||||||
|
|
||||||
//make a window come up and say that we are saving this file
|
//make a window come up and say that we are saving this file
|
||||||
//because stupid people were clicking buttons while it was saving and tearing stuff up
|
//because stupid people were clicking buttons while it was saving and tearing stuff up
|
||||||
@ -875,7 +861,8 @@ int MenuHomebrewBrowse()
|
|||||||
GuiImageData dialogBox(imgPath, dialogue_box_png);
|
GuiImageData dialogBox(imgPath, dialogue_box_png);
|
||||||
GuiImage dialogBoxImg(&dialogBox);
|
GuiImage dialogBoxImg(&dialogBox);
|
||||||
if (Settings.wsprompt == yes) {
|
if (Settings.wsprompt == yes) {
|
||||||
dialogBoxImg.SetWidescreen(CFG.widescreen);}
|
dialogBoxImg.SetWidescreen(CFG.widescreen);
|
||||||
|
}
|
||||||
GuiText msgTxt(tr("Saving"), 20, (GXColor) { THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255 });
|
GuiText msgTxt(tr("Saving"), 20, (GXColor) { THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255 });
|
||||||
msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||||
msgTxt.SetPosition(0,100);
|
msgTxt.SetPosition(0,100);
|
||||||
@ -917,8 +904,7 @@ int MenuHomebrewBrowse()
|
|||||||
lSize = ftell (file);
|
lSize = ftell (file);
|
||||||
|
|
||||||
rewind (file);
|
rewind (file);
|
||||||
if(lSize==infilesize)
|
if (lSize==infilesize) {
|
||||||
{
|
|
||||||
int pick = WindowPrompt(tr(" Wad Saved as:"), tmptxt, tr("Install"),tr("Uninstall"),tr("Cancel"));
|
int pick = WindowPrompt(tr(" Wad Saved as:"), tmptxt, tr("Install"),tr("Uninstall"),tr("Cancel"));
|
||||||
//install or uninstall it
|
//install or uninstall it
|
||||||
if (pick==1)Wad_Install(file);
|
if (pick==1)Wad_Install(file);
|
||||||
@ -932,8 +918,7 @@ int MenuHomebrewBrowse()
|
|||||||
remove(tmptxt);
|
remove(tmptxt);
|
||||||
|
|
||||||
|
|
||||||
}
|
} else if (strstr(tmptxt,".dol") || strstr(tmptxt,".DOL") ||
|
||||||
else if(strstr(tmptxt,".dol") || strstr(tmptxt,".DOL") ||
|
|
||||||
strstr(tmptxt,".elf") || strstr(tmptxt,".ELF")) {
|
strstr(tmptxt,".elf") || strstr(tmptxt,".ELF")) {
|
||||||
boothomebrew = 2;
|
boothomebrew = 2;
|
||||||
menu = MENU_EXIT;
|
menu = MENU_EXIT;
|
||||||
@ -960,8 +945,7 @@ int MenuHomebrewBrowse()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (IsNetworkInit()) {
|
if (IsNetworkInit()) {
|
||||||
if(!wifi_btn_loaded)
|
if (!wifi_btn_loaded) {
|
||||||
{
|
|
||||||
wifiBtn.SetAlpha(255);
|
wifiBtn.SetAlpha(255);
|
||||||
|
|
||||||
titleTT = new GuiTooltip(GetNetworkIP());
|
titleTT = new GuiTooltip(GetNetworkIP());
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
|
|
||||||
#include "HomebrewFiles.h"
|
#include "HomebrewFiles.h"
|
||||||
|
|
||||||
HomebrewFiles::HomebrewFiles(const char * path)
|
HomebrewFiles::HomebrewFiles(const char * path) {
|
||||||
{
|
|
||||||
filecount = 0;
|
filecount = 0;
|
||||||
|
|
||||||
FileInfo = (FileInfos *) malloc(sizeof(FileInfos));
|
FileInfo = (FileInfos *) malloc(sizeof(FileInfos));
|
||||||
@ -24,16 +23,14 @@ HomebrewFiles::HomebrewFiles(const char * path)
|
|||||||
this->SortList();
|
this->SortList();
|
||||||
}
|
}
|
||||||
|
|
||||||
HomebrewFiles::~HomebrewFiles()
|
HomebrewFiles::~HomebrewFiles() {
|
||||||
{
|
|
||||||
if (FileInfo) {
|
if (FileInfo) {
|
||||||
free(FileInfo);
|
free(FileInfo);
|
||||||
FileInfo = NULL;
|
FileInfo = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HomebrewFiles::LoadPath(const char * folderpath)
|
bool HomebrewFiles::LoadPath(const char * folderpath) {
|
||||||
{
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
DIR_ITER *dir = NULL;
|
DIR_ITER *dir = NULL;
|
||||||
char filename[1024];
|
char filename[1024];
|
||||||
@ -43,8 +40,7 @@ bool HomebrewFiles::LoadPath(const char * folderpath)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (dirnext(dir,filename,&st) == 0)
|
while (dirnext(dir,filename,&st) == 0) {
|
||||||
{
|
|
||||||
if ((st.st_mode & S_IFDIR) != 0) {
|
if ((st.st_mode & S_IFDIR) != 0) {
|
||||||
if (strcmp(filename,".") != 0 && strcmp(filename,"..") != 0) {
|
if (strcmp(filename,".") != 0 && strcmp(filename,"..") != 0) {
|
||||||
char currentname[200];
|
char currentname[200];
|
||||||
@ -84,43 +80,37 @@ bool HomebrewFiles::LoadPath(const char * folderpath)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
char * HomebrewFiles::GetFilename(int ind)
|
char * HomebrewFiles::GetFilename(int ind) {
|
||||||
{
|
|
||||||
if (ind > filecount)
|
if (ind > filecount)
|
||||||
return NULL;
|
return NULL;
|
||||||
else
|
else
|
||||||
return FileInfo[ind].FileName;
|
return FileInfo[ind].FileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
char * HomebrewFiles::GetFilepath(int ind)
|
char * HomebrewFiles::GetFilepath(int ind) {
|
||||||
{
|
|
||||||
if (ind > filecount)
|
if (ind > filecount)
|
||||||
return NULL;
|
return NULL;
|
||||||
else
|
else
|
||||||
return FileInfo[ind].FilePath;
|
return FileInfo[ind].FilePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int HomebrewFiles::GetFilesize(int ind)
|
unsigned int HomebrewFiles::GetFilesize(int ind) {
|
||||||
{
|
|
||||||
if (ind > filecount || !filecount || !FileInfo)
|
if (ind > filecount || !filecount || !FileInfo)
|
||||||
return NULL;
|
return NULL;
|
||||||
else
|
else
|
||||||
return FileInfo[ind].FileSize;
|
return FileInfo[ind].FileSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
int HomebrewFiles::GetFilecount()
|
int HomebrewFiles::GetFilecount() {
|
||||||
{
|
|
||||||
return filecount;
|
return filecount;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ListCompare(const void *a, const void *b)
|
static int ListCompare(const void *a, const void *b) {
|
||||||
{
|
|
||||||
FileInfos *ab = (FileInfos*) a;
|
FileInfos *ab = (FileInfos*) a;
|
||||||
FileInfos *bb = (FileInfos*) b;
|
FileInfos *bb = (FileInfos*) b;
|
||||||
|
|
||||||
return stricmp((char *) ab->FilePath, (char *) bb->FilePath);
|
return stricmp((char *) ab->FilePath, (char *) bb->FilePath);
|
||||||
}
|
}
|
||||||
void HomebrewFiles::SortList()
|
void HomebrewFiles::SortList() {
|
||||||
{
|
|
||||||
qsort(FileInfo, filecount, sizeof(FileInfos), ListCompare);
|
qsort(FileInfo, filecount, sizeof(FileInfos), ListCompare);
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,7 @@ typedef struct {
|
|||||||
unsigned int FileSize;
|
unsigned int FileSize;
|
||||||
} FileInfos;
|
} FileInfos;
|
||||||
|
|
||||||
class HomebrewFiles
|
class HomebrewFiles {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
//!Constructor
|
//!Constructor
|
||||||
//!\param path Path where to check for homebrew files
|
//!\param path Path where to check for homebrew files
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
|
|
||||||
#include "HomebrewXML.h"
|
#include "HomebrewXML.h"
|
||||||
|
|
||||||
HomebrewXML::HomebrewXML()
|
HomebrewXML::HomebrewXML() {
|
||||||
{
|
|
||||||
strcpy(name,"");
|
strcpy(name,"");
|
||||||
strcpy(coder,"");
|
strcpy(coder,"");
|
||||||
strcpy(version,"");
|
strcpy(version,"");
|
||||||
@ -19,12 +18,10 @@ HomebrewXML::HomebrewXML()
|
|||||||
strcpy(longdescription,"");
|
strcpy(longdescription,"");
|
||||||
}
|
}
|
||||||
|
|
||||||
HomebrewXML::~HomebrewXML()
|
HomebrewXML::~HomebrewXML() {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int HomebrewXML::LoadHomebrewXMLData(const char* filename)
|
int HomebrewXML::LoadHomebrewXMLData(const char* filename) {
|
||||||
{
|
|
||||||
mxml_node_t *nodedataHB = NULL;
|
mxml_node_t *nodedataHB = NULL;
|
||||||
mxml_node_t *nodetreeHB = NULL;
|
mxml_node_t *nodetreeHB = NULL;
|
||||||
char tmp1[40];
|
char tmp1[40];
|
||||||
|
@ -5,8 +5,7 @@
|
|||||||
#ifndef ___HOMEBREWXML_H_
|
#ifndef ___HOMEBREWXML_H_
|
||||||
#define ___HOMEBREWXML_H_
|
#define ___HOMEBREWXML_H_
|
||||||
|
|
||||||
class HomebrewXML
|
class HomebrewXML {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
//!Constructor
|
//!Constructor
|
||||||
//!\param path Path for the xml file
|
//!\param path Path for the xml file
|
||||||
@ -16,19 +15,33 @@ class HomebrewXML
|
|||||||
//!\param filename Filepath of the XML file
|
//!\param filename Filepath of the XML file
|
||||||
int LoadHomebrewXMLData(const char* filename);
|
int LoadHomebrewXMLData(const char* filename);
|
||||||
//! Get name
|
//! Get name
|
||||||
char * GetName() { return name; }
|
char * GetName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
//! Get coder
|
//! Get coder
|
||||||
char * GetCoder() { return coder; }
|
char * GetCoder() {
|
||||||
|
return coder;
|
||||||
|
}
|
||||||
//! Get version
|
//! Get version
|
||||||
char * GetVersion() { return version; }
|
char * GetVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
//! Get releasedate
|
//! Get releasedate
|
||||||
char * GetReleasedate() { return releasedate; }
|
char * GetReleasedate() {
|
||||||
|
return releasedate;
|
||||||
|
}
|
||||||
//! Get shortdescription
|
//! Get shortdescription
|
||||||
char * GetShortDescription() { return shortdescription; }
|
char * GetShortDescription() {
|
||||||
|
return shortdescription;
|
||||||
|
}
|
||||||
//! Get longdescription
|
//! Get longdescription
|
||||||
char * GetLongDescription() { return longdescription; }
|
char * GetLongDescription() {
|
||||||
|
return longdescription;
|
||||||
|
}
|
||||||
//! Set Name
|
//! Set Name
|
||||||
void SetName(char * path) { strncpy(name, path, sizeof(name)); }
|
void SetName(char * path) {
|
||||||
|
strncpy(name, path, sizeof(name));
|
||||||
|
}
|
||||||
protected:
|
protected:
|
||||||
char name[50];
|
char name[50];
|
||||||
char coder[100];
|
char coder[100];
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
#define _DOLLOADER_H_
|
#define _DOLLOADER_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern void __exception_closeall();
|
extern void __exception_closeall();
|
||||||
|
@ -385,15 +385,13 @@ typedef struct elf32_sym {
|
|||||||
|
|
||||||
|
|
||||||
/* Relocation entry with implicit addend */
|
/* Relocation entry with implicit addend */
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
Elf32_Addr r_offset; /* offset of relocation */
|
Elf32_Addr r_offset; /* offset of relocation */
|
||||||
Elf32_Word r_info; /* symbol table index and type */
|
Elf32_Word r_info; /* symbol table index and type */
|
||||||
} Elf32_Rel;
|
} Elf32_Rel;
|
||||||
|
|
||||||
/* Relocation entry with explicit addend */
|
/* Relocation entry with explicit addend */
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
Elf32_Addr r_offset; /* offset of relocation */
|
Elf32_Addr r_offset; /* offset of relocation */
|
||||||
Elf32_Word r_info; /* symbol table index and type */
|
Elf32_Word r_info; /* symbol table index and type */
|
||||||
Elf32_Sword r_addend;
|
Elf32_Sword r_addend;
|
||||||
@ -439,11 +437,9 @@ typedef struct {
|
|||||||
#define PF_MASKPROC 0xf0000000 /* reserved bits for processor */
|
#define PF_MASKPROC 0xf0000000 /* reserved bits for processor */
|
||||||
/* specific segment flags */
|
/* specific segment flags */
|
||||||
/* Dynamic structure */
|
/* Dynamic structure */
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
Elf32_Sword d_tag; /* controls meaning of d_val */
|
Elf32_Sword d_tag; /* controls meaning of d_val */
|
||||||
union
|
union {
|
||||||
{
|
|
||||||
Elf32_Word d_val; /* Multiple meanings - see d_tag */
|
Elf32_Word d_val; /* Multiple meanings - see d_tag */
|
||||||
Elf32_Addr d_ptr; /* program virtual address */
|
Elf32_Addr d_ptr; /* program virtual address */
|
||||||
} d_un;
|
} d_un;
|
||||||
|
@ -26,8 +26,7 @@
|
|||||||
* First looks at the ELF header magic field, the makes sure that it is
|
* First looks at the ELF header magic field, the makes sure that it is
|
||||||
* executable and makes sure that it is for a PowerPC.
|
* executable and makes sure that it is for a PowerPC.
|
||||||
* ====================================================================== */
|
* ====================================================================== */
|
||||||
s32 valid_elf_image (void *addr)
|
s32 valid_elf_image (void *addr) {
|
||||||
{
|
|
||||||
Elf32_Ehdr *ehdr; /* Elf header structure pointer */
|
Elf32_Ehdr *ehdr; /* Elf header structure pointer */
|
||||||
|
|
||||||
ehdr = (Elf32_Ehdr *) addr;
|
ehdr = (Elf32_Ehdr *) addr;
|
||||||
@ -49,8 +48,7 @@ s32 valid_elf_image (void *addr)
|
|||||||
* A very simple elf loader, assumes the image is valid, returns the
|
* A very simple elf loader, assumes the image is valid, returns the
|
||||||
* entry point address.
|
* entry point address.
|
||||||
* ====================================================================== */
|
* ====================================================================== */
|
||||||
u32 load_elf_image (void *addr)
|
u32 load_elf_image (void *addr) {
|
||||||
{
|
|
||||||
Elf32_Ehdr *ehdr;
|
Elf32_Ehdr *ehdr;
|
||||||
Elf32_Shdr *shdr;
|
Elf32_Shdr *shdr;
|
||||||
u8 *strtab = 0;
|
u8 *strtab = 0;
|
||||||
|
@ -4,8 +4,7 @@
|
|||||||
#include <wiiuse/wpad.h>
|
#include <wiiuse/wpad.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
s32 valid_elf_image (void *addr);
|
s32 valid_elf_image (void *addr);
|
||||||
|
@ -28,10 +28,8 @@ static int rumbleCount[4] = {0,0,0,0};
|
|||||||
* ShutoffRumble
|
* ShutoffRumble
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
void ShutoffRumble()
|
void ShutoffRumble() {
|
||||||
{
|
for (int i=0;i<4;i++) {
|
||||||
for(int i=0;i<4;i++)
|
|
||||||
{
|
|
||||||
WPAD_Rumble(i, 0);
|
WPAD_Rumble(i, 0);
|
||||||
rumbleCount[i] = 0;
|
rumbleCount[i] = 0;
|
||||||
}
|
}
|
||||||
@ -41,20 +39,14 @@ void ShutoffRumble()
|
|||||||
* DoRumble
|
* DoRumble
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
void DoRumble(int i)
|
void DoRumble(int i) {
|
||||||
{
|
if (rumbleRequest[i] && rumbleCount[i] < 3) {
|
||||||
if(rumbleRequest[i] && rumbleCount[i] < 3)
|
|
||||||
{
|
|
||||||
WPAD_Rumble(i, 1); // rumble on
|
WPAD_Rumble(i, 1); // rumble on
|
||||||
rumbleCount[i]++;
|
rumbleCount[i]++;
|
||||||
}
|
} else if (rumbleRequest[i]) {
|
||||||
else if(rumbleRequest[i])
|
|
||||||
{
|
|
||||||
rumbleCount[i] = 20;
|
rumbleCount[i] = 20;
|
||||||
rumbleRequest[i] = 0;
|
rumbleRequest[i] = 0;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
if (rumbleCount[i])
|
if (rumbleCount[i])
|
||||||
rumbleCount[i]--;
|
rumbleCount[i]--;
|
||||||
WPAD_Rumble(i, 0); // rumble off
|
WPAD_Rumble(i, 0); // rumble off
|
||||||
@ -67,31 +59,25 @@ void DoRumble(int i)
|
|||||||
* Get X/Y value from Wii Joystick (classic, nunchuk) input
|
* Get X/Y value from Wii Joystick (classic, nunchuk) input
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
s8 WPAD_Stick(u8 chan, u8 right, int axis)
|
s8 WPAD_Stick(u8 chan, u8 right, int axis) {
|
||||||
{
|
|
||||||
float mag = 0.0;
|
float mag = 0.0;
|
||||||
float ang = 0.0;
|
float ang = 0.0;
|
||||||
WPADData *data = WPAD_Data(chan);
|
WPADData *data = WPAD_Data(chan);
|
||||||
|
|
||||||
switch (data->exp.type)
|
switch (data->exp.type) {
|
||||||
{
|
|
||||||
case WPAD_EXP_NUNCHUK:
|
case WPAD_EXP_NUNCHUK:
|
||||||
case WPAD_EXP_GUITARHERO3:
|
case WPAD_EXP_GUITARHERO3:
|
||||||
if (right == 0)
|
if (right == 0) {
|
||||||
{
|
|
||||||
mag = data->exp.nunchuk.js.mag;
|
mag = data->exp.nunchuk.js.mag;
|
||||||
ang = data->exp.nunchuk.js.ang;
|
ang = data->exp.nunchuk.js.ang;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WPAD_EXP_CLASSIC:
|
case WPAD_EXP_CLASSIC:
|
||||||
if (right == 0)
|
if (right == 0) {
|
||||||
{
|
|
||||||
mag = data->exp.classic.ljs.mag;
|
mag = data->exp.classic.ljs.mag;
|
||||||
ang = data->exp.classic.ljs.ang;
|
ang = data->exp.classic.ljs.ang;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
mag = data->exp.classic.rjs.mag;
|
mag = data->exp.classic.rjs.mag;
|
||||||
ang = data->exp.classic.rjs.ang;
|
ang = data->exp.classic.rjs.ang;
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,7 @@
|
|||||||
#include "network/networkops.h"
|
#include "network/networkops.h"
|
||||||
#include "network/http.h"
|
#include "network/http.h"
|
||||||
|
|
||||||
int updateLanguageFiles()
|
int updateLanguageFiles() {
|
||||||
{
|
|
||||||
char languageFiles[20][MAXLANGUAGEFILES];
|
char languageFiles[20][MAXLANGUAGEFILES];
|
||||||
|
|
||||||
//get all the files in the language path
|
//get all the files in the language path
|
||||||
@ -27,8 +26,7 @@ int updateLanguageFiles()
|
|||||||
for (int cnt = 0; cnt < countfiles; cnt++) {
|
for (int cnt = 0; cnt < countfiles; cnt++) {
|
||||||
char filename[64];
|
char filename[64];
|
||||||
strncpy(filename, GetFileName(cnt),63);
|
strncpy(filename, GetFileName(cnt),63);
|
||||||
if (strcasestr(filename,".lang"))
|
if (strcasestr(filename,".lang")) {
|
||||||
{
|
|
||||||
strcpy(languageFiles[cnt],filename);
|
strcpy(languageFiles[cnt],filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -38,8 +36,7 @@ int updateLanguageFiles()
|
|||||||
int done =0,j=0;
|
int done =0,j=0;
|
||||||
if (IsNetworkInit()) {
|
if (IsNetworkInit()) {
|
||||||
//build the URL, save path, and download each file and save it
|
//build the URL, save path, and download each file and save it
|
||||||
while (j<countfiles)
|
while (j<countfiles) {
|
||||||
{
|
|
||||||
char savepath[150];
|
char savepath[150];
|
||||||
char codeurl[200];
|
char codeurl[200];
|
||||||
snprintf(codeurl, sizeof(codeurl), "http://usbloader-gui.googlecode.com/svn/trunk/Languages/%s",languageFiles[j]);
|
snprintf(codeurl, sizeof(codeurl), "http://usbloader-gui.googlecode.com/svn/trunk/Languages/%s",languageFiles[j]);
|
||||||
|
@ -4,8 +4,7 @@
|
|||||||
#include <gctypes.h>
|
#include <gctypes.h>
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
|
|
||||||
typedef struct _MSG
|
typedef struct _MSG {
|
||||||
{
|
|
||||||
u32 id;
|
u32 id;
|
||||||
char* msgstr;
|
char* msgstr;
|
||||||
struct _MSG *next;
|
struct _MSG *next;
|
||||||
@ -19,20 +18,17 @@ static MSG *baseMSG=0;
|
|||||||
[see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
|
[see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
|
||||||
1986, 1987 Bell Telephone Laboratories, Inc.] */
|
1986, 1987 Bell Telephone Laboratories, Inc.] */
|
||||||
static inline u32
|
static inline u32
|
||||||
hash_string (const char *str_param)
|
hash_string (const char *str_param) {
|
||||||
{
|
|
||||||
u32 hval, g;
|
u32 hval, g;
|
||||||
const char *str = str_param;
|
const char *str = str_param;
|
||||||
|
|
||||||
/* Compute the hash value for the given string. */
|
/* Compute the hash value for the given string. */
|
||||||
hval = 0;
|
hval = 0;
|
||||||
while (*str != '\0')
|
while (*str != '\0') {
|
||||||
{
|
|
||||||
hval <<= 4;
|
hval <<= 4;
|
||||||
hval += (u8) *str++;
|
hval += (u8) *str++;
|
||||||
g = hval & ((u32) 0xf << (HASHWORDBITS - 4));
|
g = hval & ((u32) 0xf << (HASHWORDBITS - 4));
|
||||||
if (g != 0)
|
if (g != 0) {
|
||||||
{
|
|
||||||
hval ^= g >> (HASHWORDBITS - 8);
|
hval ^= g >> (HASHWORDBITS - 8);
|
||||||
hval ^= g;
|
hval ^= g;
|
||||||
}
|
}
|
||||||
@ -42,8 +38,7 @@ hash_string (const char *str_param)
|
|||||||
|
|
||||||
/* Expand some escape sequences found in the argument string. */
|
/* Expand some escape sequences found in the argument string. */
|
||||||
static char *
|
static char *
|
||||||
expand_escape (const char *str)
|
expand_escape (const char *str) {
|
||||||
{
|
|
||||||
char *retval, *rp;
|
char *retval, *rp;
|
||||||
const char *cp = str;
|
const char *cp = str;
|
||||||
|
|
||||||
@ -55,12 +50,10 @@ expand_escape (const char *str)
|
|||||||
*rp++ = *cp++;
|
*rp++ = *cp++;
|
||||||
if (cp[0] == '\0')
|
if (cp[0] == '\0')
|
||||||
goto terminate;
|
goto terminate;
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
|
|
||||||
/* Here cp[0] == '\\'. */
|
/* Here cp[0] == '\\'. */
|
||||||
switch (*++cp)
|
switch (*++cp) {
|
||||||
{
|
|
||||||
case '\"': /* " */
|
case '\"': /* " */
|
||||||
*rp++ = '\"';
|
*rp++ = '\"';
|
||||||
++cp;
|
++cp;
|
||||||
@ -97,18 +90,21 @@ expand_escape (const char *str)
|
|||||||
*rp = '\\';
|
*rp = '\\';
|
||||||
++cp;
|
++cp;
|
||||||
break;
|
break;
|
||||||
case '0': case '1': case '2': case '3':
|
case '0':
|
||||||
case '4': case '5': case '6': case '7':
|
case '1':
|
||||||
{
|
case '2':
|
||||||
|
case '3':
|
||||||
|
case '4':
|
||||||
|
case '5':
|
||||||
|
case '6':
|
||||||
|
case '7': {
|
||||||
int ch = *cp++ - '0';
|
int ch = *cp++ - '0';
|
||||||
|
|
||||||
if (*cp >= '0' && *cp <= '7')
|
if (*cp >= '0' && *cp <= '7') {
|
||||||
{
|
|
||||||
ch *= 8;
|
ch *= 8;
|
||||||
ch += *cp++ - '0';
|
ch += *cp++ - '0';
|
||||||
|
|
||||||
if (*cp >= '0' && *cp <= '7')
|
if (*cp >= '0' && *cp <= '7') {
|
||||||
{
|
|
||||||
ch *= 8;
|
ch *= 8;
|
||||||
ch += *cp++ - '0';
|
ch += *cp++ - '0';
|
||||||
}
|
}
|
||||||
@ -123,8 +119,7 @@ expand_escape (const char *str)
|
|||||||
|
|
||||||
while (cp[0] != '\0' && cp[0] != '\\')
|
while (cp[0] != '\0' && cp[0] != '\\')
|
||||||
*rp++ = *cp++;
|
*rp++ = *cp++;
|
||||||
}
|
} while (cp[0] != '\0');
|
||||||
while (cp[0] != '\0');
|
|
||||||
|
|
||||||
/* Terminate string. */
|
/* Terminate string. */
|
||||||
terminate:
|
terminate:
|
||||||
@ -132,33 +127,27 @@ terminate:
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MSG *findMSG(u32 id)
|
static MSG *findMSG(u32 id) {
|
||||||
{
|
|
||||||
MSG *msg;
|
MSG *msg;
|
||||||
for(msg=baseMSG; msg; msg=msg->next)
|
for (msg=baseMSG; msg; msg=msg->next) {
|
||||||
{
|
|
||||||
if (msg->id == id)
|
if (msg->id == id)
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MSG *setMSG(const char *msgid, const char *msgstr)
|
static MSG *setMSG(const char *msgid, const char *msgstr) {
|
||||||
{
|
|
||||||
u32 id = hash_string(msgid);
|
u32 id = hash_string(msgid);
|
||||||
MSG *msg = findMSG(id);
|
MSG *msg = findMSG(id);
|
||||||
if(!msg)
|
if (!msg) {
|
||||||
{
|
|
||||||
msg = (MSG *)malloc(sizeof(MSG));
|
msg = (MSG *)malloc(sizeof(MSG));
|
||||||
msg->id = id;
|
msg->id = id;
|
||||||
msg->msgstr = NULL;
|
msg->msgstr = NULL;
|
||||||
msg->next = baseMSG;
|
msg->next = baseMSG;
|
||||||
baseMSG = msg;
|
baseMSG = msg;
|
||||||
}
|
}
|
||||||
if(msg)
|
if (msg) {
|
||||||
{
|
if (msgstr) {
|
||||||
if(msgstr)
|
|
||||||
{
|
|
||||||
if (msg->msgstr) free(msg->msgstr);
|
if (msg->msgstr) free(msg->msgstr);
|
||||||
//msg->msgstr = strdup(msgstr);
|
//msg->msgstr = strdup(msgstr);
|
||||||
msg->msgstr = expand_escape(msgstr);
|
msg->msgstr = expand_escape(msgstr);
|
||||||
@ -167,10 +156,8 @@ static MSG *setMSG(const char *msgid, const char *msgstr)
|
|||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
void gettextCleanUp(void)
|
void gettextCleanUp(void) {
|
||||||
{
|
while (baseMSG) {
|
||||||
while(baseMSG)
|
|
||||||
{
|
|
||||||
MSG *nextMsg =baseMSG->next;
|
MSG *nextMsg =baseMSG->next;
|
||||||
free(baseMSG->msgstr);
|
free(baseMSG->msgstr);
|
||||||
free(baseMSG);
|
free(baseMSG);
|
||||||
@ -179,8 +166,7 @@ void gettextCleanUp(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool gettextLoadLanguage(const char* langFile)
|
bool gettextLoadLanguage(const char* langFile) {
|
||||||
{
|
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char line[200];
|
char line[200];
|
||||||
char *lastID=NULL;
|
char *lastID=NULL;
|
||||||
@ -190,25 +176,23 @@ bool gettextLoadLanguage(const char* langFile)
|
|||||||
if (!f)
|
if (!f)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
while (fgets(line, sizeof(line), f))
|
while (fgets(line, sizeof(line), f)) {
|
||||||
{
|
|
||||||
// lines starting with # are comments
|
// lines starting with # are comments
|
||||||
if (line[0] == '#')
|
if (line[0] == '#')
|
||||||
continue;
|
continue;
|
||||||
else if (strncmp(line, "msgid \"", 7) == 0)
|
else if (strncmp(line, "msgid \"", 7) == 0) {
|
||||||
{
|
|
||||||
char *msgid, *end;
|
char *msgid, *end;
|
||||||
if(lastID) { free(lastID); lastID=NULL;}
|
if (lastID) {
|
||||||
|
free(lastID);
|
||||||
|
lastID=NULL;
|
||||||
|
}
|
||||||
msgid = &line[7];
|
msgid = &line[7];
|
||||||
end = strrchr(msgid, '"');
|
end = strrchr(msgid, '"');
|
||||||
if(end && end-msgid>1)
|
if (end && end-msgid>1) {
|
||||||
{
|
|
||||||
*end = 0;
|
*end = 0;
|
||||||
lastID = strdup(msgid);
|
lastID = strdup(msgid);
|
||||||
}
|
}
|
||||||
}
|
} else if (strncmp(line, "msgstr \"", 8) == 0) {
|
||||||
else if (strncmp(line, "msgstr \"", 8) == 0)
|
|
||||||
{
|
|
||||||
char *msgstr, *end;
|
char *msgstr, *end;
|
||||||
|
|
||||||
if (lastID == NULL)
|
if (lastID == NULL)
|
||||||
@ -216,8 +200,7 @@ bool gettextLoadLanguage(const char* langFile)
|
|||||||
|
|
||||||
msgstr = &line[8];
|
msgstr = &line[8];
|
||||||
end = strrchr(msgstr, '"');
|
end = strrchr(msgstr, '"');
|
||||||
if(end && end-msgstr>1)
|
if (end && end-msgstr>1) {
|
||||||
{
|
|
||||||
*end = 0;
|
*end = 0;
|
||||||
setMSG(lastID, msgstr);
|
setMSG(lastID, msgstr);
|
||||||
}
|
}
|
||||||
@ -230,8 +213,7 @@ bool gettextLoadLanguage(const char* langFile)
|
|||||||
fclose(f);
|
fclose(f);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const char *gettext(const char *msgid)
|
const char *gettext(const char *msgid) {
|
||||||
{
|
|
||||||
MSG *msg = findMSG(hash_string(msgid));
|
MSG *msg = findMSG(hash_string(msgid));
|
||||||
if (msg && msg->msgstr) return msg->msgstr;
|
if (msg && msg->msgstr) return msg->msgstr;
|
||||||
return msgid;
|
return msgid;
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
#define _GETTEXT_H_
|
#define _GETTEXT_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,19 +13,16 @@
|
|||||||
static char alldirfiles[300][70];
|
static char alldirfiles[300][70];
|
||||||
char filenames[80];
|
char filenames[80];
|
||||||
|
|
||||||
bool findfile(const char * filename, const char * path)
|
bool findfile(const char * filename, const char * path) {
|
||||||
{
|
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
struct dirent *file;
|
struct dirent *file;
|
||||||
|
|
||||||
dir = opendir(path);
|
dir = opendir(path);
|
||||||
|
|
||||||
char temp[11];
|
char temp[11];
|
||||||
while ((file = readdir(dir)))
|
while ((file = readdir(dir))) {
|
||||||
{
|
|
||||||
snprintf(temp,sizeof(temp),"%s",file->d_name);
|
snprintf(temp,sizeof(temp),"%s",file->d_name);
|
||||||
if (!strncmpi(temp,filename,11))
|
if (!strncmpi(temp,filename,11)) {
|
||||||
{
|
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -58,19 +55,16 @@ bool subfoldercreate(char * fullpath) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
char * GetFileName(int i)
|
char * GetFileName(int i) {
|
||||||
{
|
|
||||||
return alldirfiles[i];
|
return alldirfiles[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 filenamescmp(const void *a, const void *b)
|
s32 filenamescmp(const void *a, const void *b) {
|
||||||
{
|
|
||||||
/* Compare strings */
|
/* Compare strings */
|
||||||
return stricmp((char *)a, (char *)b);
|
return stricmp((char *)a, (char *)b);
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetAllDirFiles(char * filespath)
|
int GetAllDirFiles(char * filespath) {
|
||||||
{
|
|
||||||
int countfiles = 0;
|
int countfiles = 0;
|
||||||
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
@ -79,10 +73,8 @@ int GetAllDirFiles(char * filespath)
|
|||||||
|
|
||||||
if (dir == NULL) //If empty
|
if (dir == NULL) //If empty
|
||||||
return 0;
|
return 0;
|
||||||
while (dirnext(dir,filenames,&st) == 0)
|
while (dirnext(dir,filenames,&st) == 0) {
|
||||||
{
|
if ((st.st_mode & S_IFDIR) == 0) {
|
||||||
if ((st.st_mode & S_IFDIR) == 0)
|
|
||||||
{
|
|
||||||
// st.st_mode & S_IFDIR indicates a directory
|
// st.st_mode & S_IFDIR indicates a directory
|
||||||
snprintf(alldirfiles[countfiles], 70, "%s", filenames);
|
snprintf(alldirfiles[countfiles], 70, "%s", filenames);
|
||||||
countfiles++;
|
countfiles++;
|
||||||
@ -93,8 +85,7 @@ int GetAllDirFiles(char * filespath)
|
|||||||
return countfiles;
|
return countfiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool checkfile(char * path)
|
bool checkfile(char * path) {
|
||||||
{
|
|
||||||
FILE * f;
|
FILE * f;
|
||||||
f = fopen(path,"r");
|
f = fopen(path,"r");
|
||||||
if (f) {
|
if (f) {
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
#define _LISTFILES_H_
|
#define _LISTFILES_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool findfile(const char * filename, const char * path);
|
bool findfile(const char * filename, const char * path);
|
||||||
|
@ -43,19 +43,15 @@ FreeTypeGX *fontSystem=0;
|
|||||||
FreeTypeGX *fontClock=0;
|
FreeTypeGX *fontClock=0;
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[]) {
|
||||||
{
|
|
||||||
s32 ret2;
|
s32 ret2;
|
||||||
|
|
||||||
bool bootDevice_found=false;
|
bool bootDevice_found=false;
|
||||||
if(argc >= 1)
|
if (argc >= 1) {
|
||||||
{
|
if (!strncasecmp(argv[0], "usb:/", 5)) {
|
||||||
if(!strncasecmp(argv[0], "usb:/", 5))
|
|
||||||
{
|
|
||||||
strcpy(bootDevice, "USB:");
|
strcpy(bootDevice, "USB:");
|
||||||
bootDevice_found = true;
|
bootDevice_found = true;
|
||||||
}
|
} else if (!strncasecmp(argv[0], "sd:/", 4))
|
||||||
else if(!strncasecmp(argv[0], "sd:/", 4))
|
|
||||||
bootDevice_found = true;
|
bootDevice_found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,8 +64,7 @@ main(int argc, char *argv[])
|
|||||||
SDCard_Init(); // mount SD for loading cfg's
|
SDCard_Init(); // mount SD for loading cfg's
|
||||||
USBDevice_Init(); // and mount USB:/
|
USBDevice_Init(); // and mount USB:/
|
||||||
|
|
||||||
if(!bootDevice_found)
|
if (!bootDevice_found) {
|
||||||
{
|
|
||||||
//try USB
|
//try USB
|
||||||
//left in all the dol and elf files in this check in case this is the first time running the app and they dont have the config
|
//left in all the dol and elf files in this check in case this is the first time running the app and they dont have the config
|
||||||
if (checkfile((char*) "USB:/config/GXglobal.cfg") || (checkfile((char*) "USB:/apps/usbloader_gx/boot.elf"))
|
if (checkfile((char*) "USB:/config/GXglobal.cfg") || (checkfile((char*) "USB:/apps/usbloader_gx/boot.elf"))
|
||||||
|
479
source/menu.cpp
479
source/menu.cpp
File diff suppressed because it is too large
Load Diff
@ -18,8 +18,7 @@ void ExitGUIThreads(void);
|
|||||||
|
|
||||||
int MainMenu (int menuitem);
|
int MainMenu (int menuitem);
|
||||||
|
|
||||||
enum
|
enum {
|
||||||
{
|
|
||||||
MENU_EXIT = -1,
|
MENU_EXIT = -1,
|
||||||
MENU_NONE,
|
MENU_NONE,
|
||||||
MENU_SETTINGS,
|
MENU_SETTINGS,
|
||||||
|
@ -28,14 +28,12 @@ static s32 mload_fd = -1;
|
|||||||
|
|
||||||
// to init/test if the device is running
|
// to init/test if the device is running
|
||||||
|
|
||||||
int mload_init()
|
int mload_init() {
|
||||||
{
|
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
if (mload_fd>=0) return 0;
|
if (mload_fd>=0) return 0;
|
||||||
|
|
||||||
for(n=0;n<10;n++) // try 2.5 seconds
|
for (n=0;n<10;n++) { // try 2.5 seconds
|
||||||
{
|
|
||||||
mload_fd=IOS_Open(mload_fs, 0);
|
mload_fd=IOS_Open(mload_fs, 0);
|
||||||
|
|
||||||
if (mload_fd>=0) break;
|
if (mload_fd>=0) break;
|
||||||
@ -50,8 +48,7 @@ return mload_fd;
|
|||||||
|
|
||||||
// to close the device (remember call it when rebooting the IOS!)
|
// to close the device (remember call it when rebooting the IOS!)
|
||||||
|
|
||||||
int mload_close()
|
int mload_close() {
|
||||||
{
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (mload_fd<0) return -1;
|
if (mload_fd<0) return -1;
|
||||||
@ -67,8 +64,7 @@ return ret;
|
|||||||
|
|
||||||
// to get the thread id of mload
|
// to get the thread id of mload
|
||||||
|
|
||||||
int mload_get_thread_id()
|
int mload_get_thread_id() {
|
||||||
{
|
|
||||||
int ret;
|
int ret;
|
||||||
s32 hid = -1;
|
s32 hid = -1;
|
||||||
|
|
||||||
@ -92,8 +88,7 @@ return ret;
|
|||||||
|
|
||||||
// get the base and the size of the memory readable/writable to load modules
|
// get the base and the size of the memory readable/writable to load modules
|
||||||
|
|
||||||
int mload_get_load_base(u32 *starlet_base, int *size)
|
int mload_get_load_base(u32 *starlet_base, int *size) {
|
||||||
{
|
|
||||||
int ret;
|
int ret;
|
||||||
s32 hid = -1;
|
s32 hid = -1;
|
||||||
|
|
||||||
@ -118,8 +113,7 @@ return ret;
|
|||||||
// load and run a module from starlet (it need to allocate MEM2 to send the elf file)
|
// load and run a module from starlet (it need to allocate MEM2 to send the elf file)
|
||||||
// the module must be a elf made with stripios
|
// the module must be a elf made with stripios
|
||||||
|
|
||||||
int mload_module(void *addr, int len)
|
int mload_module(void *addr, int len) {
|
||||||
{
|
|
||||||
int ret;
|
int ret;
|
||||||
void *buf=NULL;
|
void *buf=NULL;
|
||||||
s32 hid = -1;
|
s32 hid = -1;
|
||||||
@ -132,7 +126,10 @@ s32 hid = -1;
|
|||||||
|
|
||||||
buf= iosAlloc(hid, len);
|
buf= iosAlloc(hid, len);
|
||||||
|
|
||||||
if(!buf) {ret= -1;goto out;}
|
if (!buf) {
|
||||||
|
ret= -1;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
memcpy(buf, addr,len);
|
memcpy(buf, addr,len);
|
||||||
@ -143,7 +140,10 @@ s32 hid = -1;
|
|||||||
|
|
||||||
ret=IOS_IoctlvFormat(hid, mload_fd, MLOAD_RUN_MODULE, ":");
|
ret=IOS_IoctlvFormat(hid, mload_fd, MLOAD_RUN_MODULE, ":");
|
||||||
|
|
||||||
if(ret<0) {ret= -666;goto out;}
|
if (ret<0) {
|
||||||
|
ret= -666;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
|
||||||
@ -158,8 +158,7 @@ return ret;
|
|||||||
// load a module from the PPC
|
// load a module from the PPC
|
||||||
// the module must be a elf made with stripios
|
// the module must be a elf made with stripios
|
||||||
|
|
||||||
int mload_elf(void *my_elf, data_elf *data_elf)
|
int mload_elf(void *my_elf, data_elf *data_elf) {
|
||||||
{
|
|
||||||
int n,m;
|
int n,m;
|
||||||
int p;
|
int p;
|
||||||
u8 *adr;
|
u8 *adr;
|
||||||
@ -178,21 +177,17 @@ p=head->phoff;
|
|||||||
|
|
||||||
data_elf->start=(void *) head->entry;
|
data_elf->start=(void *) head->entry;
|
||||||
|
|
||||||
for(n=0; n<head->phnum; n++)
|
for (n=0; n<head->phnum; n++) {
|
||||||
{
|
|
||||||
entries=(void *) (elf+p);
|
entries=(void *) (elf+p);
|
||||||
p+=sizeof(elfphentry);
|
p+=sizeof(elfphentry);
|
||||||
|
|
||||||
if(entries->type == 4)
|
if (entries->type == 4) {
|
||||||
{
|
|
||||||
adr=(void *) (elf + entries->offset);
|
adr=(void *) (elf + entries->offset);
|
||||||
|
|
||||||
if (getbe32(0)!=0) return -2; // bad info (sure)
|
if (getbe32(0)!=0) return -2; // bad info (sure)
|
||||||
|
|
||||||
for(m=4; m < entries->memsz; m+=8)
|
for (m=4; m < entries->memsz; m+=8) {
|
||||||
{
|
switch (getbe32(m)) {
|
||||||
switch(getbe32(m))
|
|
||||||
{
|
|
||||||
case 0x9:
|
case 0x9:
|
||||||
data_elf->start= (void *) getbe32(m+4);
|
data_elf->start= (void *) getbe32(m+4);
|
||||||
break;
|
break;
|
||||||
@ -210,10 +205,8 @@ for(n=0; n<head->phnum; n++)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} else
|
||||||
else
|
if (entries->type == 1 && entries->memsz != 0 && entries->vaddr!=0) {
|
||||||
if(entries->type == 1 && entries->memsz != 0 && entries->vaddr!=0)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (mload_memset((void *) entries->vaddr, 0, entries->memsz)<0) return -1;
|
if (mload_memset((void *) entries->vaddr, 0, entries->memsz)<0) return -1;
|
||||||
if (mload_seek(entries->vaddr, SEEK_SET)<0) return -1;
|
if (mload_seek(entries->vaddr, SEEK_SET)<0) return -1;
|
||||||
@ -229,8 +222,7 @@ return 0;
|
|||||||
|
|
||||||
// run one thread (you can use to load modules or binary files)
|
// run one thread (you can use to load modules or binary files)
|
||||||
|
|
||||||
int mload_run_thread(void *starlet_addr, void *starlet_top_stack, int stack_size, int priority)
|
int mload_run_thread(void *starlet_addr, void *starlet_top_stack, int stack_size, int priority) {
|
||||||
{
|
|
||||||
int ret;
|
int ret;
|
||||||
s32 hid = -1;
|
s32 hid = -1;
|
||||||
|
|
||||||
@ -253,8 +245,7 @@ return ret;
|
|||||||
|
|
||||||
// stops one starlet thread
|
// stops one starlet thread
|
||||||
|
|
||||||
int mload_stop_thread(int id)
|
int mload_stop_thread(int id) {
|
||||||
{
|
|
||||||
int ret;
|
int ret;
|
||||||
s32 hid = -1;
|
s32 hid = -1;
|
||||||
|
|
||||||
@ -278,8 +269,7 @@ return ret;
|
|||||||
|
|
||||||
// continue one stopped starlet thread
|
// continue one stopped starlet thread
|
||||||
|
|
||||||
int mload_continue_thread(int id)
|
int mload_continue_thread(int id) {
|
||||||
{
|
|
||||||
int ret;
|
int ret;
|
||||||
s32 hid = -1;
|
s32 hid = -1;
|
||||||
|
|
||||||
@ -302,8 +292,7 @@ return ret;
|
|||||||
|
|
||||||
// fix starlet address to read/write (uses SEEK_SET, etc as mode)
|
// fix starlet address to read/write (uses SEEK_SET, etc as mode)
|
||||||
|
|
||||||
int mload_seek(int offset, int mode)
|
int mload_seek(int offset, int mode) {
|
||||||
{
|
|
||||||
if (mload_init()<0) return -1;
|
if (mload_init()<0) return -1;
|
||||||
return IOS_Seek(mload_fd, offset, mode);
|
return IOS_Seek(mload_fd, offset, mode);
|
||||||
}
|
}
|
||||||
@ -312,8 +301,7 @@ int mload_seek(int offset, int mode)
|
|||||||
|
|
||||||
// read bytes from starlet (it update the offset)
|
// read bytes from starlet (it update the offset)
|
||||||
|
|
||||||
int mload_read(void* buf, u32 size)
|
int mload_read(void* buf, u32 size) {
|
||||||
{
|
|
||||||
if (mload_init()<0) return -1;
|
if (mload_init()<0) return -1;
|
||||||
return IOS_Read(mload_fd, buf, size);
|
return IOS_Read(mload_fd, buf, size);
|
||||||
}
|
}
|
||||||
@ -322,8 +310,7 @@ int mload_read(void* buf, u32 size)
|
|||||||
|
|
||||||
// write bytes from starlet (it update the offset)
|
// write bytes from starlet (it update the offset)
|
||||||
|
|
||||||
int mload_write(const void * buf, u32 size)
|
int mload_write(const void * buf, u32 size) {
|
||||||
{
|
|
||||||
if (mload_init()<0) return -1;
|
if (mload_init()<0) return -1;
|
||||||
return IOS_Write(mload_fd, buf, size);
|
return IOS_Write(mload_fd, buf, size);
|
||||||
}
|
}
|
||||||
@ -332,8 +319,7 @@ int mload_write(const void * buf, u32 size)
|
|||||||
|
|
||||||
// fill a block (similar to memset)
|
// fill a block (similar to memset)
|
||||||
|
|
||||||
int mload_memset(void *starlet_addr, int set, int len)
|
int mload_memset(void *starlet_addr, int set, int len) {
|
||||||
{
|
|
||||||
int ret;
|
int ret;
|
||||||
s32 hid = -1;
|
s32 hid = -1;
|
||||||
|
|
||||||
@ -356,8 +342,7 @@ return ret;
|
|||||||
|
|
||||||
// get the ehci datas ( ehcmodule.elf uses this address)
|
// get the ehci datas ( ehcmodule.elf uses this address)
|
||||||
|
|
||||||
void * mload_get_ehci_data()
|
void * mload_get_ehci_data() {
|
||||||
{
|
|
||||||
int ret;
|
int ret;
|
||||||
s32 hid = -1;
|
s32 hid = -1;
|
||||||
|
|
||||||
@ -380,8 +365,7 @@ return (void *) ret;
|
|||||||
|
|
||||||
// set the dev/es ioctlv in routine
|
// set the dev/es ioctlv in routine
|
||||||
|
|
||||||
int mload_set_ES_ioctlv_vector(void *starlet_addr)
|
int mload_set_ES_ioctlv_vector(void *starlet_addr) {
|
||||||
{
|
|
||||||
int ret;
|
int ret;
|
||||||
s32 hid = -1;
|
s32 hid = -1;
|
||||||
|
|
||||||
@ -400,8 +384,7 @@ s32 hid = -1;
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 ios_36[16] ATTRIBUTE_ALIGN(32)=
|
static u32 ios_36[16] ATTRIBUTE_ALIGN(32)= {
|
||||||
{
|
|
||||||
0, // DI_EmulateCmd
|
0, // DI_EmulateCmd
|
||||||
0,
|
0,
|
||||||
0x2022DDAC, // dvd_read_controlling_data
|
0x2022DDAC, // dvd_read_controlling_data
|
||||||
@ -414,8 +397,7 @@ static u32 ios_36[16] ATTRIBUTE_ALIGN(32)=
|
|||||||
0x20203934+1, // ios_printf (thumb)
|
0x20203934+1, // ios_printf (thumb)
|
||||||
};
|
};
|
||||||
|
|
||||||
static u32 ios_38[16] ATTRIBUTE_ALIGN(32)=
|
static u32 ios_38[16] ATTRIBUTE_ALIGN(32)= {
|
||||||
{
|
|
||||||
0, // DI_EmulateCmd
|
0, // DI_EmulateCmd
|
||||||
0,
|
0,
|
||||||
0x2022cdac, // dvd_read_controlling_data
|
0x2022cdac, // dvd_read_controlling_data
|
||||||
@ -441,17 +423,13 @@ int load_ehc_module() {
|
|||||||
|
|
||||||
mload_seek(0x20207c84, SEEK_SET);
|
mload_seek(0x20207c84, SEEK_SET);
|
||||||
mload_read(patch_datas, 4);
|
mload_read(patch_datas, 4);
|
||||||
if(patch_datas[0]==0x6e657665)
|
if (patch_datas[0]==0x6e657665) {
|
||||||
{
|
|
||||||
is_ios=38;
|
is_ios=38;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
is_ios=36;
|
is_ios=36;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_ios==36)
|
if (is_ios==36) {
|
||||||
{
|
|
||||||
// IOS 36
|
// IOS 36
|
||||||
memcpy(ios_36, dip_plugin, 4); // copy the entry_point
|
memcpy(ios_36, dip_plugin, 4); // copy the entry_point
|
||||||
memcpy(dip_plugin, ios_36, 4*10); // copy the adresses from the array
|
memcpy(dip_plugin, ios_36, 4*10); // copy the adresses from the array
|
||||||
@ -464,8 +442,7 @@ int load_ehc_module() {
|
|||||||
mload_write(ios_36, 4);
|
mload_write(ios_36, 4);
|
||||||
|
|
||||||
}
|
}
|
||||||
if(is_ios==38)
|
if (is_ios==38) {
|
||||||
{
|
|
||||||
// IOS 38
|
// IOS 38
|
||||||
|
|
||||||
memcpy(ios_38, dip_plugin, 4); // copy the entry_point
|
memcpy(ios_38, dip_plugin, 4); // copy the entry_point
|
||||||
|
@ -50,8 +50,7 @@ extern "C" {
|
|||||||
|
|
||||||
#define getbe32(x) ((adr[x]<<24) | (adr[x+1]<<16) | (adr[x+2]<<8) | (adr[x+3]))
|
#define getbe32(x) ((adr[x]<<24) | (adr[x+1]<<16) | (adr[x+2]<<8) | (adr[x+3]))
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
u32 ident0;
|
u32 ident0;
|
||||||
u32 ident1;
|
u32 ident1;
|
||||||
u32 ident2;
|
u32 ident2;
|
||||||
@ -70,8 +69,7 @@ typedef struct
|
|||||||
u16 shtrndx;
|
u16 shtrndx;
|
||||||
} elfheader;
|
} elfheader;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
u32 type;
|
u32 type;
|
||||||
u32 offset;
|
u32 offset;
|
||||||
u32 vaddr;
|
u32 vaddr;
|
||||||
@ -82,8 +80,7 @@ typedef struct
|
|||||||
u32 align;
|
u32 align;
|
||||||
} elfphentry;
|
} elfphentry;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
void *start;
|
void *start;
|
||||||
int prio;
|
int prio;
|
||||||
void *stack;
|
void *stack;
|
||||||
|
@ -11,8 +11,7 @@
|
|||||||
#include "URL_List.h"
|
#include "URL_List.h"
|
||||||
|
|
||||||
|
|
||||||
URL_List::URL_List(const char * url)
|
URL_List::URL_List(const char * url) {
|
||||||
{
|
|
||||||
Links = NULL;
|
Links = NULL;
|
||||||
urlcount = 0;
|
urlcount = 0;
|
||||||
|
|
||||||
@ -99,8 +98,7 @@ URL_List::URL_List(const char * url)
|
|||||||
free(file.data);
|
free(file.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
URL_List::~URL_List()
|
URL_List::~URL_List() {
|
||||||
{
|
|
||||||
for (int i = 0; i == urlcount; i++) {
|
for (int i = 0; i == urlcount; i++) {
|
||||||
delete Links[i].URL;
|
delete Links[i].URL;
|
||||||
Links[i].URL = NULL;
|
Links[i].URL = NULL;
|
||||||
@ -112,27 +110,23 @@ URL_List::~URL_List()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char * URL_List::GetURL(int ind)
|
char * URL_List::GetURL(int ind) {
|
||||||
{
|
|
||||||
if (ind > urlcount || ind < 0 || !Links || urlcount <= 0)
|
if (ind > urlcount || ind < 0 || !Links || urlcount <= 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
else
|
else
|
||||||
return Links[ind].URL;
|
return Links[ind].URL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int URL_List::GetURLCount()
|
int URL_List::GetURLCount() {
|
||||||
{
|
|
||||||
return urlcount;
|
return urlcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ListCompare(const void *a, const void *b)
|
static int ListCompare(const void *a, const void *b) {
|
||||||
{
|
|
||||||
Link_Info *ab = (Link_Info*) a;
|
Link_Info *ab = (Link_Info*) a;
|
||||||
Link_Info *bb = (Link_Info*) b;
|
Link_Info *bb = (Link_Info*) b;
|
||||||
|
|
||||||
return stricmp((char *) ab->URL, (char *) bb->URL);
|
return stricmp((char *) ab->URL, (char *) bb->URL);
|
||||||
}
|
}
|
||||||
void URL_List::SortList()
|
void URL_List::SortList() {
|
||||||
{
|
|
||||||
qsort(Links, urlcount, sizeof(Link_Info), ListCompare);
|
qsort(Links, urlcount, sizeof(Link_Info), ListCompare);
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,7 @@ typedef struct {
|
|||||||
bool direct;
|
bool direct;
|
||||||
} Link_Info;
|
} Link_Info;
|
||||||
|
|
||||||
class URL_List
|
class URL_List {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
//!Constructor
|
//!Constructor
|
||||||
//!\param url from where to get the list of links
|
//!\param url from where to get the list of links
|
||||||
|
@ -8,8 +8,7 @@
|
|||||||
* @param char* The domain name to resolve
|
* @param char* The domain name to resolve
|
||||||
* @return u32 The ipaddress represented by four bytes inside an u32 (in network order)
|
* @return u32 The ipaddress represented by four bytes inside an u32 (in network order)
|
||||||
*/
|
*/
|
||||||
u32 getipbyname(char *domain)
|
u32 getipbyname(char *domain) {
|
||||||
{
|
|
||||||
//Care should be taken when using net_gethostbyname,
|
//Care should be taken when using net_gethostbyname,
|
||||||
//it returns a static buffer which makes it not threadsafe
|
//it returns a static buffer which makes it not threadsafe
|
||||||
//TODO: implement some locking mechanism to make below code atomic
|
//TODO: implement some locking mechanism to make below code atomic
|
||||||
@ -44,16 +43,13 @@ static int dnsentrycount = 0;
|
|||||||
* Performs the same function as getipbyname(),
|
* Performs the same function as getipbyname(),
|
||||||
* except that it will prevent extremely expensive net_gethostbyname() calls by caching the result
|
* except that it will prevent extremely expensive net_gethostbyname() calls by caching the result
|
||||||
*/
|
*/
|
||||||
u32 getipbynamecached(char *domain)
|
u32 getipbynamecached(char *domain) {
|
||||||
{
|
|
||||||
//Search if this domainname is already cached
|
//Search if this domainname is already cached
|
||||||
struct dnsentry *node = firstdnsentry;
|
struct dnsentry *node = firstdnsentry;
|
||||||
struct dnsentry *previousnode = NULL;
|
struct dnsentry *previousnode = NULL;
|
||||||
|
|
||||||
while(node != NULL)
|
while (node != NULL) {
|
||||||
{
|
if (strcmp(node->domain, domain) == 0) {
|
||||||
if(strcmp(node->domain, domain) == 0)
|
|
||||||
{
|
|
||||||
//DNS node found in the cache, move it to the front of the list
|
//DNS node found in the cache, move it to the front of the list
|
||||||
if (previousnode != NULL)
|
if (previousnode != NULL)
|
||||||
previousnode->nextnode = node->nextnode;
|
previousnode->nextnode = node->nextnode;
|
||||||
@ -78,8 +74,7 @@ u32 getipbynamecached(char *domain)
|
|||||||
|
|
||||||
newnode->ip = ip;
|
newnode->ip = ip;
|
||||||
newnode->domain = malloc(strlen(domain)+1);
|
newnode->domain = malloc(strlen(domain)+1);
|
||||||
if(newnode->domain == NULL)
|
if (newnode->domain == NULL) {
|
||||||
{
|
|
||||||
free(newnode);
|
free(newnode);
|
||||||
return ip;
|
return ip;
|
||||||
}
|
}
|
||||||
@ -90,24 +85,20 @@ u32 getipbynamecached(char *domain)
|
|||||||
dnsentrycount++;
|
dnsentrycount++;
|
||||||
|
|
||||||
//If the cache grows too big delete the last (and probably least important) node of the list
|
//If the cache grows too big delete the last (and probably least important) node of the list
|
||||||
if(dnsentrycount > MAX_DNS_CACHE_ENTRIES)
|
if (dnsentrycount > MAX_DNS_CACHE_ENTRIES) {
|
||||||
{
|
|
||||||
struct dnsentry *node = firstdnsentry;
|
struct dnsentry *node = firstdnsentry;
|
||||||
struct dnsentry *previousnode = NULL;
|
struct dnsentry *previousnode = NULL;
|
||||||
|
|
||||||
//Fetch the last two elements of the list
|
//Fetch the last two elements of the list
|
||||||
while(node->nextnode != NULL)
|
while (node->nextnode != NULL) {
|
||||||
{
|
|
||||||
previousnode = node;
|
previousnode = node;
|
||||||
node = node->nextnode;
|
node = node->nextnode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(node == NULL)
|
if (node == NULL) {
|
||||||
{
|
|
||||||
printf("Configuration error, MAX_DNS_ENTRIES reached while the list is empty\n");
|
printf("Configuration error, MAX_DNS_ENTRIES reached while the list is empty\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
} else if(previousnode == NULL)
|
} else if (previousnode == NULL) {
|
||||||
{
|
|
||||||
firstdnsentry = NULL;
|
firstdnsentry = NULL;
|
||||||
} else {
|
} else {
|
||||||
previousnode->nextnode = NULL;
|
previousnode->nextnode = NULL;
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
#include <unistd.h> //usleep
|
#include <unistd.h> //usleep
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
u32 getipbyname(char *domain);
|
u32 getipbyname(char *domain);
|
||||||
|
@ -67,8 +67,7 @@ static s32 server_connect(u32 ipaddress, u32 socket_port) {
|
|||||||
* @param s32 connection The connection identifier to suck the response out of
|
* @param s32 connection The connection identifier to suck the response out of
|
||||||
* @return block A 'block' struct (see http.h) in which the buffer is located
|
* @return block A 'block' struct (see http.h) in which the buffer is located
|
||||||
*/
|
*/
|
||||||
struct block read_message(s32 connection)
|
struct block read_message(s32 connection) {
|
||||||
{
|
|
||||||
//Create a block of memory to put in the response
|
//Create a block of memory to put in the response
|
||||||
struct block buffer;
|
struct block buffer;
|
||||||
buffer.data = malloc(HTTP_BUFFER_SIZE);
|
buffer.data = malloc(HTTP_BUFFER_SIZE);
|
||||||
@ -81,23 +80,20 @@ struct block read_message(s32 connection)
|
|||||||
//The offset variable always points to the first byte of memory that is free in the buffer
|
//The offset variable always points to the first byte of memory that is free in the buffer
|
||||||
u32 offset = 0;
|
u32 offset = 0;
|
||||||
|
|
||||||
while(1)
|
while (1) {
|
||||||
{
|
|
||||||
//Fill the buffer with a new batch of bytes from the connection,
|
//Fill the buffer with a new batch of bytes from the connection,
|
||||||
//starting from where we left of in the buffer till the end of the buffer
|
//starting from where we left of in the buffer till the end of the buffer
|
||||||
s32 bytes_read = net_read(connection, buffer.data + offset, buffer.size - offset);
|
s32 bytes_read = net_read(connection, buffer.data + offset, buffer.size - offset);
|
||||||
|
|
||||||
//Anything below 0 is an error in the connection
|
//Anything below 0 is an error in the connection
|
||||||
if(bytes_read < 0)
|
if (bytes_read < 0) {
|
||||||
{
|
|
||||||
//printf("Connection error from net_read() Errorcode: %i\n", bytes_read);
|
//printf("Connection error from net_read() Errorcode: %i\n", bytes_read);
|
||||||
return emptyblock;
|
return emptyblock;
|
||||||
}
|
}
|
||||||
|
|
||||||
//No more bytes were read into the buffer,
|
//No more bytes were read into the buffer,
|
||||||
//we assume this means the HTTP response is done
|
//we assume this means the HTTP response is done
|
||||||
if(bytes_read == 0)
|
if (bytes_read == 0) {
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,13 +101,11 @@ struct block read_message(s32 connection)
|
|||||||
|
|
||||||
//Check if we have enough buffer left over,
|
//Check if we have enough buffer left over,
|
||||||
//if not expand it with an additional HTTP_BUFFER_GROWTH worth of bytes
|
//if not expand it with an additional HTTP_BUFFER_GROWTH worth of bytes
|
||||||
if(offset >= buffer.size)
|
if (offset >= buffer.size) {
|
||||||
{
|
|
||||||
buffer.size += HTTP_BUFFER_GROWTH;
|
buffer.size += HTTP_BUFFER_GROWTH;
|
||||||
buffer.data = realloc(buffer.data, buffer.size);
|
buffer.data = realloc(buffer.data, buffer.size);
|
||||||
|
|
||||||
if(buffer.data == NULL)
|
if (buffer.data == NULL) {
|
||||||
{
|
|
||||||
return emptyblock;
|
return emptyblock;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -130,11 +124,9 @@ struct block read_message(s32 connection)
|
|||||||
* Downloads the contents of a URL to memory
|
* Downloads the contents of a URL to memory
|
||||||
* This method is not threadsafe (because networking is not threadsafe on the Wii)
|
* This method is not threadsafe (because networking is not threadsafe on the Wii)
|
||||||
*/
|
*/
|
||||||
struct block downloadfile(const char *url)
|
struct block downloadfile(const char *url) {
|
||||||
{
|
|
||||||
//Check if the url starts with "http://", if not it is not considered a valid url
|
//Check if the url starts with "http://", if not it is not considered a valid url
|
||||||
if(strncmp(url, "http://", strlen("http://")) != 0)
|
if (strncmp(url, "http://", strlen("http://")) != 0) {
|
||||||
{
|
|
||||||
//printf("URL '%s' doesn't start with 'http://'\n", url);
|
//printf("URL '%s' doesn't start with 'http://'\n", url);
|
||||||
return emptyblock;
|
return emptyblock;
|
||||||
}
|
}
|
||||||
@ -143,8 +135,7 @@ struct block downloadfile(const char *url)
|
|||||||
char *path = strchr(url + strlen("http://"), '/');
|
char *path = strchr(url + strlen("http://"), '/');
|
||||||
|
|
||||||
//At the very least the url has to end with '/', ending with just a domain is invalid
|
//At the very least the url has to end with '/', ending with just a domain is invalid
|
||||||
if(path == NULL)
|
if (path == NULL) {
|
||||||
{
|
|
||||||
//printf("URL '%s' has no PATH part\n", url);
|
//printf("URL '%s' has no PATH part\n", url);
|
||||||
return emptyblock;
|
return emptyblock;
|
||||||
}
|
}
|
||||||
@ -152,8 +143,7 @@ struct block downloadfile(const char *url)
|
|||||||
//Extract the domain part out of the url
|
//Extract the domain part out of the url
|
||||||
int domainlength = path - url - strlen("http://");
|
int domainlength = path - url - strlen("http://");
|
||||||
|
|
||||||
if(domainlength == 0)
|
if (domainlength == 0) {
|
||||||
{
|
|
||||||
//printf("No domain part in URL '%s'\n", url);
|
//printf("No domain part in URL '%s'\n", url);
|
||||||
return emptyblock;
|
return emptyblock;
|
||||||
}
|
}
|
||||||
@ -165,8 +155,7 @@ struct block downloadfile(const char *url)
|
|||||||
//Parsing of the URL is done, start making an actual connection
|
//Parsing of the URL is done, start making an actual connection
|
||||||
u32 ipaddress = getipbynamecached(domain);
|
u32 ipaddress = getipbynamecached(domain);
|
||||||
|
|
||||||
if(ipaddress == 0)
|
if (ipaddress == 0) {
|
||||||
{
|
|
||||||
//printf("\ndomain %s could not be resolved", domain);
|
//printf("\ndomain %s could not be resolved", domain);
|
||||||
return emptyblock;
|
return emptyblock;
|
||||||
}
|
}
|
||||||
@ -193,21 +182,18 @@ struct block downloadfile(const char *url)
|
|||||||
unsigned char *filestart = NULL;
|
unsigned char *filestart = NULL;
|
||||||
u32 filesize = 0;
|
u32 filesize = 0;
|
||||||
int i;
|
int i;
|
||||||
for(i = 3; i < response.size; i++)
|
for (i = 3; i < response.size; i++) {
|
||||||
{
|
|
||||||
if (response.data[i] == '\n' &&
|
if (response.data[i] == '\n' &&
|
||||||
response.data[i-1] == '\r' &&
|
response.data[i-1] == '\r' &&
|
||||||
response.data[i-2] == '\n' &&
|
response.data[i-2] == '\n' &&
|
||||||
response.data[i-3] == '\r')
|
response.data[i-3] == '\r') {
|
||||||
{
|
|
||||||
filestart = response.data + i + 1;
|
filestart = response.data + i + 1;
|
||||||
filesize = response.size - i - 1;
|
filesize = response.size - i - 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(filestart == NULL)
|
if (filestart == NULL) {
|
||||||
{
|
|
||||||
//printf("HTTP Response was without a file\n");
|
//printf("HTTP Response was without a file\n");
|
||||||
free(response.data);
|
free(response.data);
|
||||||
return emptyblock;
|
return emptyblock;
|
||||||
@ -218,8 +204,7 @@ struct block downloadfile(const char *url)
|
|||||||
file.data = malloc(filesize);
|
file.data = malloc(filesize);
|
||||||
file.size = filesize;
|
file.size = filesize;
|
||||||
|
|
||||||
if(file.data == NULL)
|
if (file.data == NULL) {
|
||||||
{
|
|
||||||
//printf("No more memory to copy file from HTTP response\n");
|
//printf("No more memory to copy file from HTTP response\n");
|
||||||
free(response.data);
|
free(response.data);
|
||||||
return emptyblock;
|
return emptyblock;
|
||||||
|
@ -7,8 +7,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "dns.h"
|
#include "dns.h"
|
||||||
@ -16,8 +15,7 @@ extern "C"
|
|||||||
/**
|
/**
|
||||||
* A simple structure to keep track of the size of a malloc()ated block of memory
|
* A simple structure to keep track of the size of a malloc()ated block of memory
|
||||||
*/
|
*/
|
||||||
struct block
|
struct block {
|
||||||
{
|
|
||||||
u32 size;
|
u32 size;
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
};
|
};
|
||||||
|
@ -58,24 +58,21 @@ void Initialize_Network(void) {
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Check if network was initialised
|
* Check if network was initialised
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
bool IsNetworkInit(void)
|
bool IsNetworkInit(void) {
|
||||||
{
|
|
||||||
return networkinitialized;
|
return networkinitialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Get network IP
|
* Get network IP
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
char * GetNetworkIP(void)
|
char * GetNetworkIP(void) {
|
||||||
{
|
|
||||||
return IP;
|
return IP;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Get network IP
|
* Get network IP
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
bool ShutdownWC24()
|
bool ShutdownWC24() {
|
||||||
{
|
|
||||||
bool onlinefix = IsNetworkInit();
|
bool onlinefix = IsNetworkInit();
|
||||||
if (onlinefix) {
|
if (onlinefix) {
|
||||||
s32 kd_fd, ret;
|
s32 kd_fd, ret;
|
||||||
@ -92,8 +89,7 @@ bool ShutdownWC24()
|
|||||||
return onlinefix;
|
return onlinefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 network_request(const char * request)
|
s32 network_request(const char * request) {
|
||||||
{
|
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
char *ptr = NULL;
|
char *ptr = NULL;
|
||||||
|
|
||||||
@ -125,8 +121,7 @@ s32 network_request(const char * request)
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 network_read(u8 *buf, u32 len)
|
s32 network_read(u8 *buf, u32 len) {
|
||||||
{
|
|
||||||
u32 read = 0;
|
u32 read = 0;
|
||||||
s32 ret = -1;
|
s32 ret = -1;
|
||||||
|
|
||||||
@ -154,8 +149,7 @@ s32 network_read(u8 *buf, u32 len)
|
|||||||
s32 download_request(const char * url) {
|
s32 download_request(const char * url) {
|
||||||
|
|
||||||
//Check if the url starts with "http://", if not it is not considered a valid url
|
//Check if the url starts with "http://", if not it is not considered a valid url
|
||||||
if(strncmp(url, "http://", strlen("http://")) != 0)
|
if (strncmp(url, "http://", strlen("http://")) != 0) {
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,16 +157,14 @@ s32 download_request(const char * url) {
|
|||||||
char *path = strchr(url + strlen("http://"), '/');
|
char *path = strchr(url + strlen("http://"), '/');
|
||||||
|
|
||||||
//At the very least the url has to end with '/', ending with just a domain is invalid
|
//At the very least the url has to end with '/', ending with just a domain is invalid
|
||||||
if(path == NULL)
|
if (path == NULL) {
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Extract the domain part out of the url
|
//Extract the domain part out of the url
|
||||||
int domainlength = path - url - strlen("http://");
|
int domainlength = path - url - strlen("http://");
|
||||||
|
|
||||||
if(domainlength == 0)
|
if (domainlength == 0) {
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,8 +211,7 @@ int NetworkWait() {
|
|||||||
//Open socket
|
//Open socket
|
||||||
socket = net_socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
|
socket = net_socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
|
||||||
|
|
||||||
if (socket == INVALID_SOCKET)
|
if (socket == INVALID_SOCKET) {
|
||||||
{
|
|
||||||
return socket;
|
return socket;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,22 +219,19 @@ int NetworkWait() {
|
|||||||
sin.sin_port = htons(PORT);
|
sin.sin_port = htons(PORT);
|
||||||
sin.sin_addr.s_addr = htonl(INADDR_ANY);
|
sin.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||||
|
|
||||||
if (net_bind(socket, (struct sockaddr*)&sin, sizeof(sin)) < 0)
|
if (net_bind(socket, (struct sockaddr*)&sin, sizeof(sin)) < 0) {
|
||||||
{
|
|
||||||
net_close(socket);
|
net_close(socket);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (net_listen(socket, 3) < 0)
|
if (net_listen(socket, 3) < 0) {
|
||||||
{
|
|
||||||
net_close(socket);
|
net_close(socket);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
connection = net_accept(socket, (struct sockaddr*)&client_address, &addrlen);
|
connection = net_accept(socket, (struct sockaddr*)&client_address, &addrlen);
|
||||||
|
|
||||||
if (connection < 0)
|
if (connection < 0) {
|
||||||
{
|
|
||||||
net_close(connection);
|
net_close(connection);
|
||||||
net_close(socket);
|
net_close(socket);
|
||||||
return -4;
|
return -4;
|
||||||
@ -265,8 +253,7 @@ int NetworkWait() {
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Update check
|
* Update check
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int CheckUpdate()
|
int CheckUpdate() {
|
||||||
{
|
|
||||||
if (!networkinitialized)
|
if (!networkinitialized)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -299,8 +286,7 @@ int CheckUpdate()
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* HaltNetwork
|
* HaltNetwork
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void HaltNetworkThread()
|
void HaltNetworkThread() {
|
||||||
{
|
|
||||||
networkHalt = true;
|
networkHalt = true;
|
||||||
checkincomming = false;
|
checkincomming = false;
|
||||||
|
|
||||||
@ -315,8 +301,7 @@ void HaltNetworkThread()
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* ResumeNetworkThread
|
* ResumeNetworkThread
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void ResumeNetworkThread()
|
void ResumeNetworkThread() {
|
||||||
{
|
|
||||||
networkHalt = false;
|
networkHalt = false;
|
||||||
LWP_ResumeThread(networkthread);
|
LWP_ResumeThread(networkthread);
|
||||||
}
|
}
|
||||||
@ -324,8 +309,7 @@ void ResumeNetworkThread()
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Resume NetworkWait
|
* Resume NetworkWait
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void ResumeNetworkWait()
|
void ResumeNetworkWait() {
|
||||||
{
|
|
||||||
networkHalt = true;
|
networkHalt = true;
|
||||||
checkincomming = true;
|
checkincomming = true;
|
||||||
waitforanswer = true;
|
waitforanswer = true;
|
||||||
@ -337,8 +321,7 @@ void ResumeNetworkWait()
|
|||||||
/*********************************************************************************
|
/*********************************************************************************
|
||||||
* Networkthread for background network initialize and update check with idle prio
|
* Networkthread for background network initialize and update check with idle prio
|
||||||
*********************************************************************************/
|
*********************************************************************************/
|
||||||
static void * networkinitcallback(void *arg)
|
static void * networkinitcallback(void *arg) {
|
||||||
{
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
||||||
if (!checkincomming && networkHalt)
|
if (!checkincomming && networkHalt)
|
||||||
@ -366,16 +349,14 @@ static void * networkinitcallback(void *arg)
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* InitNetworkThread with priority 0 (idle)
|
* InitNetworkThread with priority 0 (idle)
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void InitNetworkThread()
|
void InitNetworkThread() {
|
||||||
{
|
|
||||||
LWP_CreateThread (&networkthread, networkinitcallback, NULL, NULL, 0, 0);
|
LWP_CreateThread (&networkthread, networkinitcallback, NULL, NULL, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* ShutdownThread
|
* ShutdownThread
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void ShutdownNetworkThread()
|
void ShutdownNetworkThread() {
|
||||||
{
|
|
||||||
LWP_JoinThread (networkthread, NULL);
|
LWP_JoinThread (networkthread, NULL);
|
||||||
networkthread = LWP_THREAD_NULL;
|
networkthread = LWP_THREAD_NULL;
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,7 @@
|
|||||||
|
|
||||||
#define READ_SAMPLES 4096 // samples that it must read before to send
|
#define READ_SAMPLES 4096 // samples that it must read before to send
|
||||||
#define MAX_PCMOUT 4096 // minimum size to read ogg samples
|
#define MAX_PCMOUT 4096 // minimum size to read ogg samples
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
OggVorbis_File vf;
|
OggVorbis_File vf;
|
||||||
vorbis_info *vi;
|
vorbis_info *vi;
|
||||||
int current_section;
|
int current_section;
|
||||||
@ -68,10 +67,8 @@ static lwpq_t oggplayer_queue = LWP_THREAD_NULL;
|
|||||||
static lwp_t h_oggplayer = LWP_THREAD_NULL;
|
static lwp_t h_oggplayer = LWP_THREAD_NULL;
|
||||||
static int ogg_thread_running = 0;
|
static int ogg_thread_running = 0;
|
||||||
|
|
||||||
static void ogg_add_callback(int voice)
|
static void ogg_add_callback(int voice) {
|
||||||
{
|
if (!ogg_thread_running) {
|
||||||
if (!ogg_thread_running)
|
|
||||||
{
|
|
||||||
ASND_StopVoice(0);
|
ASND_StopVoice(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -79,30 +76,24 @@ static void ogg_add_callback(int voice)
|
|||||||
if (private_ogg.flag & 128)
|
if (private_ogg.flag & 128)
|
||||||
return; // Ogg is paused
|
return; // Ogg is paused
|
||||||
|
|
||||||
if (private_ogg.pcm_indx >= READ_SAMPLES)
|
if (private_ogg.pcm_indx >= READ_SAMPLES) {
|
||||||
{
|
|
||||||
if (ASND_AddVoice(0,
|
if (ASND_AddVoice(0,
|
||||||
(void *) private_ogg.pcmout[private_ogg.pcmout_pos],
|
(void *) private_ogg.pcmout[private_ogg.pcmout_pos],
|
||||||
private_ogg.pcm_indx << 1) == 0)
|
private_ogg.pcm_indx << 1) == 0) {
|
||||||
{
|
|
||||||
private_ogg.pcmout_pos ^= 1;
|
private_ogg.pcmout_pos ^= 1;
|
||||||
private_ogg.pcm_indx = 0;
|
private_ogg.pcm_indx = 0;
|
||||||
private_ogg.flag = 0;
|
private_ogg.flag = 0;
|
||||||
LWP_ThreadSignal(oggplayer_queue);
|
LWP_ThreadSignal(oggplayer_queue);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
if (private_ogg.flag & 64) {
|
||||||
{
|
|
||||||
if (private_ogg.flag & 64)
|
|
||||||
{
|
|
||||||
private_ogg.flag &= ~64;
|
private_ogg.flag &= ~64;
|
||||||
LWP_ThreadSignal(oggplayer_queue);
|
LWP_ThreadSignal(oggplayer_queue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void * ogg_player_thread(private_data_ogg * priv)
|
static void * ogg_player_thread(private_data_ogg * priv) {
|
||||||
{
|
|
||||||
int first_time = 1;
|
int first_time = 1;
|
||||||
long ret;
|
long ret;
|
||||||
|
|
||||||
@ -122,25 +113,20 @@ static void * ogg_player_thread(private_data_ogg * priv)
|
|||||||
|
|
||||||
ogg_thread_running = 1;
|
ogg_thread_running = 1;
|
||||||
|
|
||||||
while (!priv[0].eof && ogg_thread_running)
|
while (!priv[0].eof && ogg_thread_running) {
|
||||||
{
|
|
||||||
if (priv[0].flag)
|
if (priv[0].flag)
|
||||||
LWP_ThreadSleep(oggplayer_queue); // wait only when i have samples to send
|
LWP_ThreadSleep(oggplayer_queue); // wait only when i have samples to send
|
||||||
|
|
||||||
if (priv[0].flag == 0) // wait to all samples are sended
|
if (priv[0].flag == 0) { // wait to all samples are sended
|
||||||
{
|
|
||||||
if (ASND_TestPointer(0, priv[0].pcmout[priv[0].pcmout_pos])
|
if (ASND_TestPointer(0, priv[0].pcmout[priv[0].pcmout_pos])
|
||||||
&& ASND_StatusVoice(0) != SND_UNUSED)
|
&& ASND_StatusVoice(0) != SND_UNUSED) {
|
||||||
{
|
|
||||||
priv[0].flag |= 64;
|
priv[0].flag |= 64;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (priv[0].pcm_indx < READ_SAMPLES)
|
if (priv[0].pcm_indx < READ_SAMPLES) {
|
||||||
{
|
|
||||||
priv[0].flag = 3;
|
priv[0].flag = 3;
|
||||||
|
|
||||||
if (priv[0].seek_time >= 0)
|
if (priv[0].seek_time >= 0) {
|
||||||
{
|
|
||||||
ov_time_seek(&priv[0].vf, priv[0].seek_time);
|
ov_time_seek(&priv[0].vf, priv[0].seek_time);
|
||||||
priv[0].seek_time = -1;
|
priv[0].seek_time = -1;
|
||||||
}
|
}
|
||||||
@ -151,45 +137,35 @@ static void * ogg_player_thread(private_data_ogg * priv)
|
|||||||
(void *) &priv[0].pcmout[priv[0].pcmout_pos][priv[0].pcm_indx],
|
(void *) &priv[0].pcmout[priv[0].pcmout_pos][priv[0].pcm_indx],
|
||||||
MAX_PCMOUT,/*0,2,1,*/&priv[0].current_section);
|
MAX_PCMOUT,/*0,2,1,*/&priv[0].current_section);
|
||||||
priv[0].flag &= 192;
|
priv[0].flag &= 192;
|
||||||
if (ret == 0)
|
if (ret == 0) {
|
||||||
{
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
if (priv[0].mode & 1)
|
if (priv[0].mode & 1)
|
||||||
ov_time_seek(&priv[0].vf, 0); // repeat
|
ov_time_seek(&priv[0].vf, 0); // repeat
|
||||||
else
|
else
|
||||||
priv[0].eof = 1; // stops
|
priv[0].eof = 1; // stops
|
||||||
//
|
//
|
||||||
}
|
} else if (ret < 0) {
|
||||||
else if (ret < 0)
|
|
||||||
{
|
|
||||||
/* error in the stream. Not a problem, just reporting it in
|
/* error in the stream. Not a problem, just reporting it in
|
||||||
case we (the app) cares. In this case, we don't. */
|
case we (the app) cares. In this case, we don't. */
|
||||||
if (ret != OV_HOLE)
|
if (ret != OV_HOLE) {
|
||||||
{
|
|
||||||
if (priv[0].mode & 1)
|
if (priv[0].mode & 1)
|
||||||
ov_time_seek(&priv[0].vf, 0); // repeat
|
ov_time_seek(&priv[0].vf, 0); // repeat
|
||||||
else
|
else
|
||||||
priv[0].eof = 1; // stops
|
priv[0].eof = 1; // stops
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
/* we don't bother dealing with sample rate changes, etc, but
|
/* we don't bother dealing with sample rate changes, etc, but
|
||||||
you'll have to*/
|
you'll have to*/
|
||||||
priv[0].pcm_indx += ret >> 1; //get 16 bits samples
|
priv[0].pcm_indx += ret >> 1; //get 16 bits samples
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
priv[0].flag = 1;
|
priv[0].flag = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv[0].flag == 1)
|
if (priv[0].flag == 1) {
|
||||||
{
|
if (ASND_StatusVoice(0) == SND_UNUSED || first_time) {
|
||||||
if (ASND_StatusVoice(0) == SND_UNUSED || first_time)
|
|
||||||
{
|
|
||||||
first_time = 0;
|
first_time = 0;
|
||||||
if (priv[0].vi->channels == 2)
|
if (priv[0].vi->channels == 2) {
|
||||||
{
|
|
||||||
ASND_SetVoice(0, VOICE_STEREO_16BIT, priv[0].vi->rate, 0,
|
ASND_SetVoice(0, VOICE_STEREO_16BIT, priv[0].vi->rate, 0,
|
||||||
(void *) priv[0].pcmout[priv[0].pcmout_pos],
|
(void *) priv[0].pcmout[priv[0].pcmout_pos],
|
||||||
priv[0].pcm_indx << 1, priv[0].volume,
|
priv[0].pcm_indx << 1, priv[0].volume,
|
||||||
@ -197,9 +173,7 @@ static void * ogg_player_thread(private_data_ogg * priv)
|
|||||||
priv[0].pcmout_pos ^= 1;
|
priv[0].pcmout_pos ^= 1;
|
||||||
priv[0].pcm_indx = 0;
|
priv[0].pcm_indx = 0;
|
||||||
priv[0].flag = 0;
|
priv[0].flag = 0;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
ASND_SetVoice(0, VOICE_MONO_16BIT, priv[0].vi->rate, 0,
|
ASND_SetVoice(0, VOICE_MONO_16BIT, priv[0].vi->rate, 0,
|
||||||
(void *) priv[0].pcmout[priv[0].pcmout_pos],
|
(void *) priv[0].pcmout[priv[0].pcmout_pos],
|
||||||
priv[0].pcm_indx << 1, priv[0].volume,
|
priv[0].pcm_indx << 1, priv[0].volume,
|
||||||
@ -220,27 +194,23 @@ static void * ogg_player_thread(private_data_ogg * priv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StopOgg()
|
void StopOgg() {
|
||||||
{
|
|
||||||
ASND_StopVoice(0);
|
ASND_StopVoice(0);
|
||||||
ogg_thread_running = 0;
|
ogg_thread_running = 0;
|
||||||
|
|
||||||
if(h_oggplayer != LWP_THREAD_NULL)
|
if (h_oggplayer != LWP_THREAD_NULL) {
|
||||||
{
|
|
||||||
if (oggplayer_queue != LWP_TQUEUE_NULL)
|
if (oggplayer_queue != LWP_TQUEUE_NULL)
|
||||||
LWP_ThreadSignal(oggplayer_queue);
|
LWP_ThreadSignal(oggplayer_queue);
|
||||||
LWP_JoinThread(h_oggplayer, NULL);
|
LWP_JoinThread(h_oggplayer, NULL);
|
||||||
h_oggplayer = LWP_THREAD_NULL;
|
h_oggplayer = LWP_THREAD_NULL;
|
||||||
}
|
}
|
||||||
if(oggplayer_queue != LWP_TQUEUE_NULL)
|
if (oggplayer_queue != LWP_TQUEUE_NULL) {
|
||||||
{
|
|
||||||
LWP_CloseQueue(oggplayer_queue);
|
LWP_CloseQueue(oggplayer_queue);
|
||||||
oggplayer_queue = LWP_TQUEUE_NULL;
|
oggplayer_queue = LWP_TQUEUE_NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int PlayOgg(int fd, int time_pos, int mode)
|
int PlayOgg(int fd, int time_pos, int mode) {
|
||||||
{
|
|
||||||
StopOgg();
|
StopOgg();
|
||||||
|
|
||||||
private_ogg.fd = fd;
|
private_ogg.fd = fd;
|
||||||
@ -253,13 +223,11 @@ int PlayOgg(int fd, int time_pos, int mode)
|
|||||||
if (time_pos > 0)
|
if (time_pos > 0)
|
||||||
private_ogg.seek_time = time_pos;
|
private_ogg.seek_time = time_pos;
|
||||||
|
|
||||||
if (fd < 0)
|
if (fd < 0) {
|
||||||
{
|
|
||||||
private_ogg.fd = -1;
|
private_ogg.fd = -1;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (ov_open((void *) &private_ogg.fd, &private_ogg.vf, NULL, 0) < 0)
|
if (ov_open((void *) &private_ogg.fd, &private_ogg.vf, NULL, 0) < 0) {
|
||||||
{
|
|
||||||
mem_close(private_ogg.fd); // mem_close() can too close files from devices
|
mem_close(private_ogg.fd); // mem_close() can too close files from devices
|
||||||
private_ogg.fd = -1;
|
private_ogg.fd = -1;
|
||||||
ogg_thread_running = 0;
|
ogg_thread_running = 0;
|
||||||
@ -267,8 +235,7 @@ int PlayOgg(int fd, int time_pos, int mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (LWP_CreateThread(&h_oggplayer, (void *) ogg_player_thread,
|
if (LWP_CreateThread(&h_oggplayer, (void *) ogg_player_thread,
|
||||||
&private_ogg, oggplayer_stack, STACKSIZE, 80) == -1)
|
&private_ogg, oggplayer_stack, STACKSIZE, 80) == -1) {
|
||||||
{
|
|
||||||
ogg_thread_running = 0;
|
ogg_thread_running = 0;
|
||||||
ov_clear(&private_ogg.vf);
|
ov_clear(&private_ogg.vf);
|
||||||
private_ogg.fd = -1;
|
private_ogg.fd = -1;
|
||||||
@ -300,11 +267,17 @@ int PlayOggFromFile(char * path, int loop) {
|
|||||||
|
|
||||||
// allocate memory to contain the whole file:
|
// allocate memory to contain the whole file:
|
||||||
bufferogg = (char*) malloc (sizeof(char)*filesize);
|
bufferogg = (char*) malloc (sizeof(char)*filesize);
|
||||||
if (bufferogg == NULL) {fputs (" Memory error",stderr); exit (2);}
|
if (bufferogg == NULL) {
|
||||||
|
fputs (" Memory error",stderr);
|
||||||
|
exit (2);
|
||||||
|
}
|
||||||
|
|
||||||
// copy the file into the buffer:
|
// copy the file into the buffer:
|
||||||
resultogg = fread (bufferogg,1,filesize,pFile);
|
resultogg = fread (bufferogg,1,filesize,pFile);
|
||||||
if (resultogg != filesize) {fputs (" Reading error",stderr); exit (3);}
|
if (resultogg != filesize) {
|
||||||
|
fputs (" Reading error",stderr);
|
||||||
|
exit (3);
|
||||||
|
}
|
||||||
|
|
||||||
fclose (pFile);
|
fclose (pFile);
|
||||||
|
|
||||||
@ -315,20 +288,14 @@ int PlayOggFromFile(char * path, int loop) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PauseOgg(int pause)
|
void PauseOgg(int pause) {
|
||||||
{
|
if (pause) {
|
||||||
if (pause)
|
|
||||||
{
|
|
||||||
private_ogg.flag |= 128;
|
private_ogg.flag |= 128;
|
||||||
}
|
} else {
|
||||||
else
|
if (private_ogg.flag & 128) {
|
||||||
{
|
|
||||||
if (private_ogg.flag & 128)
|
|
||||||
{
|
|
||||||
private_ogg.flag |= 64;
|
private_ogg.flag |= 64;
|
||||||
private_ogg.flag &= ~128;
|
private_ogg.flag &= ~128;
|
||||||
if (ogg_thread_running > 0)
|
if (ogg_thread_running > 0) {
|
||||||
{
|
|
||||||
LWP_ThreadSignal(oggplayer_queue);
|
LWP_ThreadSignal(oggplayer_queue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -336,8 +303,7 @@ void PauseOgg(int pause)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int StatusOgg()
|
int StatusOgg() {
|
||||||
{
|
|
||||||
if (ogg_thread_running == 0)
|
if (ogg_thread_running == 0)
|
||||||
return -1; // Error
|
return -1; // Error
|
||||||
else if (private_ogg.eof)
|
else if (private_ogg.eof)
|
||||||
@ -348,14 +314,12 @@ int StatusOgg()
|
|||||||
return 1; // running
|
return 1; // running
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetVolumeOgg(int volume)
|
void SetVolumeOgg(int volume) {
|
||||||
{
|
|
||||||
private_ogg.volume = volume;
|
private_ogg.volume = volume;
|
||||||
ASND_ChangeVolumeVoice(0, volume, volume);
|
ASND_ChangeVolumeVoice(0, volume, volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 GetTimeOgg()
|
s32 GetTimeOgg() {
|
||||||
{
|
|
||||||
int ret;
|
int ret;
|
||||||
if (ogg_thread_running == 0 || private_ogg.fd < 0)
|
if (ogg_thread_running == 0 || private_ogg.fd < 0)
|
||||||
return 0;
|
return 0;
|
||||||
@ -366,8 +330,7 @@ s32 GetTimeOgg()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetTimeOgg(s32 time_pos)
|
void SetTimeOgg(s32 time_pos) {
|
||||||
{
|
|
||||||
if (time_pos >= 0)
|
if (time_pos >= 0)
|
||||||
private_ogg.seek_time = time_pos;
|
private_ogg.seek_time = time_pos;
|
||||||
}
|
}
|
||||||
|
@ -32,8 +32,7 @@
|
|||||||
#include "tremor/ivorbisfile.h"
|
#include "tremor/ivorbisfile.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define OGG_ONE_TIME 0
|
#define OGG_ONE_TIME 0
|
||||||
|
@ -64,13 +64,11 @@
|
|||||||
#define _SHIFTR(v, s, w) \
|
#define _SHIFTR(v, s, w) \
|
||||||
((u32)(((u32)(v) >> (s)) & ((0x01 << (w)) - 1)))
|
((u32)(((u32)(v) >> (s)) & ((0x01 << (w)) - 1)))
|
||||||
|
|
||||||
struct dicommand
|
struct dicommand {
|
||||||
{
|
|
||||||
u32 diReg[8];
|
u32 diReg[8];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dicontext
|
struct dicontext {
|
||||||
{
|
|
||||||
lwp_node node;
|
lwp_node node;
|
||||||
dvdcallbacklow cb;
|
dvdcallbacklow cb;
|
||||||
struct dicommand *cmd;
|
struct dicommand *cmd;
|
||||||
@ -93,26 +91,22 @@ static char __di_fs[] ATTRIBUTE_ALIGN(32) = "/dev/di";
|
|||||||
|
|
||||||
extern u32 __IPC_ClntInit();
|
extern u32 __IPC_ClntInit();
|
||||||
|
|
||||||
static __inline__ lwp_node* __lwp_queue_head(lwp_queue *queue)
|
static __inline__ lwp_node* __lwp_queue_head(lwp_queue *queue) {
|
||||||
{
|
|
||||||
return (lwp_node*)queue;
|
return (lwp_node*)queue;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline__ lwp_node* __lwp_queue_tail(lwp_queue *queue)
|
static __inline__ lwp_node* __lwp_queue_tail(lwp_queue *queue) {
|
||||||
{
|
|
||||||
return (lwp_node*)&queue->perm_null;
|
return (lwp_node*)&queue->perm_null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static __inline__ void __lwp_queue_init_empty(lwp_queue *queue)
|
static __inline__ void __lwp_queue_init_empty(lwp_queue *queue) {
|
||||||
{
|
|
||||||
queue->first = __lwp_queue_tail(queue);
|
queue->first = __lwp_queue_tail(queue);
|
||||||
queue->perm_null = NULL;
|
queue->perm_null = NULL;
|
||||||
queue->last = __lwp_queue_head(queue);
|
queue->last = __lwp_queue_head(queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct dicontext* __dvd_getcontext(dvdcallbacklow cb)
|
static struct dicontext* __dvd_getcontext(dvdcallbacklow cb) {
|
||||||
{
|
|
||||||
struct dicontext *ctx;
|
struct dicontext *ctx;
|
||||||
|
|
||||||
ctx = (struct dicontext*)__lwp_queue_get(&__di_contextq);
|
ctx = (struct dicontext*)__lwp_queue_get(&__di_contextq);
|
||||||
@ -121,8 +115,7 @@ static struct dicontext* __dvd_getcontext(dvdcallbacklow cb)
|
|||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
static s32 __dvd_iostransactionCB(s32 result,void *usrdata)
|
static s32 __dvd_iostransactionCB(s32 result,void *usrdata) {
|
||||||
{
|
|
||||||
struct dicontext *ctx = (struct dicontext*)usrdata;
|
struct dicontext *ctx = (struct dicontext*)usrdata;
|
||||||
|
|
||||||
__dvd_reqinprogress = 0;
|
__dvd_reqinprogress = 0;
|
||||||
@ -138,8 +131,7 @@ static s32 __dvd_iostransactionCB(s32 result,void *usrdata)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static s32 __dvd_ioscoverregisterCB(s32 result,void *usrdata)
|
static s32 __dvd_ioscoverregisterCB(s32 result,void *usrdata) {
|
||||||
{
|
|
||||||
struct dicontext *ctx = (struct dicontext*)usrdata;
|
struct dicontext *ctx = (struct dicontext*)usrdata;
|
||||||
|
|
||||||
__dvd_reqinprogress = 0;
|
__dvd_reqinprogress = 0;
|
||||||
@ -155,8 +147,7 @@ static s32 __dvd_ioscoverregisterCB(s32 result,void *usrdata)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static s32 __dvd_ioscovercloseCB(s32 result,void *usrdata)
|
static s32 __dvd_ioscovercloseCB(s32 result,void *usrdata) {
|
||||||
{
|
|
||||||
struct dicontext *ctx = (struct dicontext*)usrdata;
|
struct dicontext *ctx = (struct dicontext*)usrdata;
|
||||||
|
|
||||||
__dvd_reqinprogress = 0;
|
__dvd_reqinprogress = 0;
|
||||||
@ -171,8 +162,7 @@ static s32 __dvd_ioscovercloseCB(s32 result,void *usrdata)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 bwDVD_LowInit()
|
s32 bwDVD_LowInit() {
|
||||||
{
|
|
||||||
s32 i,ret = 0;
|
s32 i,ret = 0;
|
||||||
u32 ipclo,ipchi;
|
u32 ipclo,ipchi;
|
||||||
lwp_queue inactives;
|
lwp_queue inactives;
|
||||||
@ -213,8 +203,7 @@ s32 bwDVD_LowInit()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 bwDVD_LowInquiry(dvddrvinfo *info,dvdcallbacklow cb)
|
s32 bwDVD_LowInquiry(dvddrvinfo *info,dvdcallbacklow cb) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
struct dicontext *ctx;
|
struct dicontext *ctx;
|
||||||
struct dicommand *cmd;
|
struct dicommand *cmd;
|
||||||
@ -231,8 +220,7 @@ s32 bwDVD_LowInquiry(dvddrvinfo *info,dvdcallbacklow cb)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 bwDVD_LowReadID(dvddiskid *diskID,dvdcallbacklow cb)
|
s32 bwDVD_LowReadID(dvddiskid *diskID,dvdcallbacklow cb) {
|
||||||
{
|
|
||||||
s32 ret = 0;
|
s32 ret = 0;
|
||||||
struct dicontext *ctx;
|
struct dicontext *ctx;
|
||||||
struct dicommand *cmd;
|
struct dicommand *cmd;
|
||||||
@ -253,8 +241,7 @@ s32 bwDVD_LowReadID(dvddiskid *diskID,dvdcallbacklow cb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
s32 bwDVD_LowRead(void *buf,u32 len,u32 offset,dvdcallbacklow cb)
|
s32 bwDVD_LowRead(void *buf,u32 len,u32 offset,dvdcallbacklow cb) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
struct dicontext *ctx;
|
struct dicontext *ctx;
|
||||||
struct dicommand *cmd;
|
struct dicommand *cmd;
|
||||||
@ -277,8 +264,7 @@ s32 bwDVD_LowRead(void *buf,u32 len,u32 offset,dvdcallbacklow cb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// never got this function working, probably removed from wii
|
// never got this function working, probably removed from wii
|
||||||
s32 bwDVD_LowReadVideo(void *buf,u32 len,u32 offset,dvdcallbacklow cb)
|
s32 bwDVD_LowReadVideo(void *buf,u32 len,u32 offset,dvdcallbacklow cb) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
struct dicontext *ctx;
|
struct dicontext *ctx;
|
||||||
struct dicommand *cmd;
|
struct dicommand *cmd;
|
||||||
@ -300,8 +286,7 @@ s32 bwDVD_LowReadVideo(void *buf,u32 len,u32 offset,dvdcallbacklow cb)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
s32 bwDVD_LowStopLaser(dvdcallbacklow cb)
|
s32 bwDVD_LowStopLaser(dvdcallbacklow cb) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
struct dicontext *ctx;
|
struct dicontext *ctx;
|
||||||
struct dicommand *cmd;
|
struct dicommand *cmd;
|
||||||
@ -319,8 +304,7 @@ s32 bwDVD_LowStopLaser(dvdcallbacklow cb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// never got this function working, probably removed from wii
|
// never got this function working, probably removed from wii
|
||||||
s32 bwDVD_EnableVideo(dvdcallbacklow cb)
|
s32 bwDVD_EnableVideo(dvdcallbacklow cb) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
struct dicontext *ctx;
|
struct dicontext *ctx;
|
||||||
struct dicommand *cmd;
|
struct dicommand *cmd;
|
||||||
@ -337,8 +321,7 @@ s32 bwDVD_EnableVideo(dvdcallbacklow cb)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 bwDVD_LowSeek(u32 offset,dvdcallbacklow cb)
|
s32 bwDVD_LowSeek(u32 offset,dvdcallbacklow cb) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
struct dicontext *ctx;
|
struct dicontext *ctx;
|
||||||
struct dicommand *cmd;
|
struct dicommand *cmd;
|
||||||
@ -356,8 +339,7 @@ s32 bwDVD_LowSeek(u32 offset,dvdcallbacklow cb)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 bwDVD_LowOffset(u64 offset,dvdcallbacklow cb)
|
s32 bwDVD_LowOffset(u64 offset,dvdcallbacklow cb) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
u32 *off = (u32*)(void*)(&offset);
|
u32 *off = (u32*)(void*)(&offset);
|
||||||
struct dicontext *ctx;
|
struct dicontext *ctx;
|
||||||
@ -378,8 +360,7 @@ s32 bwDVD_LowOffset(u64 offset,dvdcallbacklow cb)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 bwDVD_LowPrepareCoverRegister(dvdcallbacklow cb)
|
s32 bwDVD_LowPrepareCoverRegister(dvdcallbacklow cb) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
struct dicontext *ctx;
|
struct dicontext *ctx;
|
||||||
struct dicommand *cmd;
|
struct dicommand *cmd;
|
||||||
@ -396,8 +377,7 @@ s32 bwDVD_LowPrepareCoverRegister(dvdcallbacklow cb)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 bwDVD_LowOpenPartition(u32 offset,void *eticket,u32 certin_len,void *certificate_in,void *certificate_out,dvdcallbacklow cb)
|
s32 bwDVD_LowOpenPartition(u32 offset,void *eticket,u32 certin_len,void *certificate_in,void *certificate_out,dvdcallbacklow cb) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
struct dicontext *ctx;
|
struct dicontext *ctx;
|
||||||
struct dicommand *cmd;
|
struct dicommand *cmd;
|
||||||
@ -435,8 +415,7 @@ s32 bwDVD_LowOpenPartition(u32 offset,void *eticket,u32 certin_len,void *certifi
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 bwDVD_LowClosePartition(dvdcallbacklow cb)
|
s32 bwDVD_LowClosePartition(dvdcallbacklow cb) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
struct dicontext *ctx;
|
struct dicontext *ctx;
|
||||||
struct dicommand *cmd;
|
struct dicommand *cmd;
|
||||||
@ -453,8 +432,7 @@ s32 bwDVD_LowClosePartition(dvdcallbacklow cb)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 bwDVD_LowUnencryptedRead(void *buf,u32 len,u32 offset,dvdcallbacklow cb)
|
s32 bwDVD_LowUnencryptedRead(void *buf,u32 len,u32 offset,dvdcallbacklow cb) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
struct dicontext *ctx;
|
struct dicontext *ctx;
|
||||||
struct dicommand *cmd;
|
struct dicommand *cmd;
|
||||||
@ -474,8 +452,7 @@ s32 bwDVD_LowUnencryptedRead(void *buf,u32 len,u32 offset,dvdcallbacklow cb)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 bwDVD_LowWaitCoverClose(dvdcallbacklow cb)
|
s32 bwDVD_LowWaitCoverClose(dvdcallbacklow cb) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
struct dicontext *ctx;
|
struct dicontext *ctx;
|
||||||
struct dicommand *cmd;
|
struct dicommand *cmd;
|
||||||
@ -492,8 +469,7 @@ s32 bwDVD_LowWaitCoverClose(dvdcallbacklow cb)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 bwDVD_LowResetNotify()
|
s32 bwDVD_LowResetNotify() {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
struct dicontext *ctx;
|
struct dicontext *ctx;
|
||||||
struct dicommand *cmd;
|
struct dicommand *cmd;
|
||||||
@ -510,8 +486,7 @@ s32 bwDVD_LowResetNotify()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 bwDVD_LowReset(dvdcallbacklow cb)
|
s32 bwDVD_LowReset(dvdcallbacklow cb) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
struct dicontext *ctx;
|
struct dicontext *ctx;
|
||||||
struct dicommand *cmd;
|
struct dicommand *cmd;
|
||||||
@ -531,8 +506,7 @@ s32 bwDVD_LowReset(dvdcallbacklow cb)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 bwDVD_LowStopMotor(u8 stop1,u8 stop2,dvdcallbacklow cb)
|
s32 bwDVD_LowStopMotor(u8 stop1,u8 stop2,dvdcallbacklow cb) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
struct dicontext *ctx;
|
struct dicontext *ctx;
|
||||||
struct dicommand *cmd;
|
struct dicommand *cmd;
|
||||||
@ -552,8 +526,7 @@ s32 bwDVD_LowStopMotor(u8 stop1,u8 stop2,dvdcallbacklow cb)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 bwDVD_LowRequestError(dvdcallbacklow cb)
|
s32 bwDVD_LowRequestError(dvdcallbacklow cb) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
struct dicontext *ctx;
|
struct dicontext *ctx;
|
||||||
struct dicommand *cmd;
|
struct dicommand *cmd;
|
||||||
@ -571,8 +544,7 @@ s32 bwDVD_LowRequestError(dvdcallbacklow cb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
s32 bwDVD_SetDecryption(s32 mode, dvdcallbacklow cb)
|
s32 bwDVD_SetDecryption(s32 mode, dvdcallbacklow cb) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
struct dicontext *ctx;
|
struct dicontext *ctx;
|
||||||
struct dicommand *cmd;
|
struct dicommand *cmd;
|
||||||
@ -591,8 +563,7 @@ s32 bwDVD_SetDecryption(s32 mode, dvdcallbacklow cb)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 bwDVD_SetOffset(u32 offset, dvdcallbacklow cb)
|
s32 bwDVD_SetOffset(u32 offset, dvdcallbacklow cb) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
struct dicontext *ctx;
|
struct dicontext *ctx;
|
||||||
struct dicommand *cmd;
|
struct dicommand *cmd;
|
||||||
|
@ -37,8 +37,7 @@
|
|||||||
|
|
||||||
extern struct SSettings Settings;
|
extern struct SSettings Settings;
|
||||||
|
|
||||||
u32 do_sd_code(char *filename)
|
u32 do_sd_code(char *filename) {
|
||||||
{
|
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
u8 *filebuff;
|
u8 *filebuff;
|
||||||
u32 filesize;
|
u32 filesize;
|
||||||
|
@ -23,8 +23,7 @@
|
|||||||
#define __FST_H__
|
#define __FST_H__
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//u32 do_fst(u32 fstlocation);
|
//u32 do_fst(u32 fstlocation);
|
||||||
|
@ -146,16 +146,13 @@ static const u32 wpadlibogc[5] = {
|
|||||||
0x90A402E0,0x806502E4,0x908502E4,0x2C030000,0x906402E4
|
0x90A402E0,0x806502E4,0x908502E4,0x2C030000,0x906402E4
|
||||||
};
|
};
|
||||||
|
|
||||||
void dogamehooks(void *addr, u32 len)
|
void dogamehooks(void *addr, u32 len) {
|
||||||
{
|
|
||||||
void *addr_start = addr;
|
void *addr_start = addr;
|
||||||
void *addr_end = addr+len;
|
void *addr_end = addr+len;
|
||||||
|
|
||||||
while(addr_start < addr_end)
|
while (addr_start < addr_end) {
|
||||||
{
|
|
||||||
|
|
||||||
switch(hooktype)
|
switch (hooktype) {
|
||||||
{
|
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
|
|
||||||
@ -285,14 +282,12 @@ void dogamehooks(void *addr, u32 len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Not used yet, for patching DOL once loaded into memory and befor execution
|
// Not used yet, for patching DOL once loaded into memory and befor execution
|
||||||
void patchdol(void *addr, u32 len)
|
void patchdol(void *addr, u32 len) {
|
||||||
{
|
|
||||||
|
|
||||||
void *addr_start = addr;
|
void *addr_start = addr;
|
||||||
void *addr_end = addr+len;
|
void *addr_end = addr+len;
|
||||||
|
|
||||||
while(addr_start < addr_end)
|
while (addr_start < addr_end) {
|
||||||
{
|
|
||||||
if (memcmp(addr_start, wpadlibogc, sizeof(wpadlibogc))==0) {
|
if (memcmp(addr_start, wpadlibogc, sizeof(wpadlibogc))==0) {
|
||||||
// printf("\n\n\n");
|
// printf("\n\n\n");
|
||||||
// printf("found at address %x\n", addr_start);
|
// printf("found at address %x\n", addr_start);
|
||||||
@ -305,14 +300,12 @@ void patchdol(void *addr, u32 len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void langpatcher(void *addr, u32 len)
|
void langpatcher(void *addr, u32 len) {
|
||||||
{
|
|
||||||
|
|
||||||
void *addr_start = addr;
|
void *addr_start = addr;
|
||||||
void *addr_end = addr+len;
|
void *addr_end = addr+len;
|
||||||
|
|
||||||
while(addr_start < addr_end)
|
while (addr_start < addr_end) {
|
||||||
{
|
|
||||||
|
|
||||||
if (memcmp(addr_start, langpatch, sizeof(langpatch))==0) {
|
if (memcmp(addr_start, langpatch, sizeof(langpatch))==0) {
|
||||||
if (configbytes[0] != 0xCD) {
|
if (configbytes[0] != 0xCD) {
|
||||||
@ -323,14 +316,12 @@ void langpatcher(void *addr, u32 len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void patchdebug(void *addr, u32 len)
|
void patchdebug(void *addr, u32 len) {
|
||||||
{
|
|
||||||
|
|
||||||
void *addr_start = addr;
|
void *addr_start = addr;
|
||||||
void *addr_end = addr+len;
|
void *addr_end = addr+len;
|
||||||
|
|
||||||
while(addr_start < addr_end)
|
while (addr_start < addr_end) {
|
||||||
{
|
|
||||||
|
|
||||||
if (memcmp(addr_start, fwritepatch, sizeof(fwritepatch))==0) {
|
if (memcmp(addr_start, fwritepatch, sizeof(fwritepatch))==0) {
|
||||||
|
|
||||||
@ -341,14 +332,12 @@ void patchdebug(void *addr, u32 len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void vidolpatcher(void *addr, u32 len)
|
void vidolpatcher(void *addr, u32 len) {
|
||||||
{
|
|
||||||
|
|
||||||
void *addr_start = addr;
|
void *addr_start = addr;
|
||||||
void *addr_end = addr+len;
|
void *addr_end = addr+len;
|
||||||
|
|
||||||
while(addr_start < addr_end)
|
while (addr_start < addr_end) {
|
||||||
{
|
|
||||||
if (memcmp(addr_start, vipatchcode, sizeof(vipatchcode))==0) {
|
if (memcmp(addr_start, vipatchcode, sizeof(vipatchcode))==0) {
|
||||||
vipatch((u32)addr_start, len);
|
vipatch((u32)addr_start, len);
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,7 @@
|
|||||||
#ifndef __PATCHCODE_H__
|
#ifndef __PATCHCODE_H__
|
||||||
#define __PATCHCODE_H__
|
#define __PATCHCODE_H__
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
// Globals
|
// Globals
|
||||||
u32 hooktype;
|
u32 hooktype;
|
||||||
|
@ -29,8 +29,7 @@ extern u8 reset;
|
|||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
*Game specific settings
|
*Game specific settings
|
||||||
*********************************************************************************/
|
*********************************************************************************/
|
||||||
int DiscBrowse(struct discHdr * header)
|
int DiscBrowse(struct discHdr * header) {
|
||||||
{
|
|
||||||
bool exit = false;
|
bool exit = false;
|
||||||
int ret, choice;
|
int ret, choice;
|
||||||
u64 offset;
|
u64 offset;
|
||||||
@ -65,8 +64,7 @@ int DiscBrowse(struct discHdr * header)
|
|||||||
|
|
||||||
int *buffer = (int*)memalign(32, 0x20);
|
int *buffer = (int*)memalign(32, 0x20);
|
||||||
|
|
||||||
if (buffer == NULL)
|
if (buffer == NULL) {
|
||||||
{
|
|
||||||
WindowPrompt(tr("ERROR:"), tr("Not enough free memory."), tr("OK"));
|
WindowPrompt(tr("ERROR:"), tr("Not enough free memory."), tr("OK"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -80,8 +78,7 @@ int DiscBrowse(struct discHdr * header)
|
|||||||
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) {
|
||||||
{
|
|
||||||
WindowPrompt(tr("ERROR:"), tr("Not enough free memory."), tr("OK"));
|
WindowPrompt(tr("ERROR:"), tr("Not enough free memory."), tr("OK"));
|
||||||
free(buffer);
|
free(buffer);
|
||||||
return -1;
|
return -1;
|
||||||
@ -115,8 +112,7 @@ int DiscBrowse(struct discHdr * header)
|
|||||||
if (fstfiles(fst, i)[len-4] =='.' &&
|
if (fstfiles(fst, i)[len-4] =='.' &&
|
||||||
fstfiles(fst, i)[len-3] =='d' &&
|
fstfiles(fst, i)[len-3] =='d' &&
|
||||||
fstfiles(fst, i)[len-2] =='o' &&
|
fstfiles(fst, i)[len-2] =='o' &&
|
||||||
fstfiles(fst, i)[len-1] =='l')
|
fstfiles(fst, i)[len-1] =='l') {
|
||||||
{
|
|
||||||
options3.SetName(i, "%i", i);
|
options3.SetName(i, "%i", i);
|
||||||
options3.SetValue(i, fstfiles(fst, i));
|
options3.SetValue(i, fstfiles(fst, i));
|
||||||
//options3.SetName(i, fstfiles(fst, i));
|
//options3.SetName(i, fstfiles(fst, i));
|
||||||
@ -190,8 +186,7 @@ int DiscBrowse(struct discHdr * header)
|
|||||||
|
|
||||||
ResumeGui();
|
ResumeGui();
|
||||||
|
|
||||||
while(!exit)
|
while (!exit) {
|
||||||
{
|
|
||||||
VIDEO_WaitVSync();
|
VIDEO_WaitVSync();
|
||||||
|
|
||||||
if (shutdown == 1)
|
if (shutdown == 1)
|
||||||
@ -213,8 +208,7 @@ int DiscBrowse(struct discHdr * header)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cancelBtn.GetState() == STATE_CLICKED)
|
if (cancelBtn.GetState() == STATE_CLICKED) {
|
||||||
{
|
|
||||||
exit = true;
|
exit = true;
|
||||||
ret = 696969;
|
ret = 696969;
|
||||||
//break;
|
//break;
|
||||||
@ -232,8 +226,7 @@ int DiscBrowse(struct discHdr * header)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int autoSelectDol(const char *id)
|
int autoSelectDol(const char *id) {
|
||||||
{
|
|
||||||
//still not done//
|
//still not done//
|
||||||
//////////ID6/////////////////
|
//////////ID6/////////////////
|
||||||
if (strcmp(id,"RF8E69") == 0) return 439;//from isostar
|
if (strcmp(id,"RF8E69") == 0) return 439;//from isostar
|
||||||
|
@ -113,8 +113,7 @@ void SetupGameInstallProgress(char * title, char * game) {
|
|||||||
* progress bar showing % completion, or a throbber that only shows that an
|
* progress bar showing % completion, or a throbber that only shows that an
|
||||||
* action is in progress.
|
* action is in progress.
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
static void ProgressWindow(const char *title, const char *msg1, const char *msg2)
|
static void ProgressWindow(const char *title, const char *msg1, const char *msg2) {
|
||||||
{
|
|
||||||
GuiWindow promptWindow(472,320);
|
GuiWindow promptWindow(472,320);
|
||||||
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
||||||
promptWindow.SetPosition(0, -10);
|
promptWindow.SetPosition(0, -10);
|
||||||
@ -138,7 +137,8 @@ static void ProgressWindow(const char *title, const char *msg1, const char *msg2
|
|||||||
|
|
||||||
GuiImage progressbarOutlineImg(&progressbarOutline);
|
GuiImage progressbarOutlineImg(&progressbarOutline);
|
||||||
if (Settings.wsprompt == yes) {
|
if (Settings.wsprompt == yes) {
|
||||||
progressbarOutlineImg.SetWidescreen(CFG.widescreen);}
|
progressbarOutlineImg.SetWidescreen(CFG.widescreen);
|
||||||
|
}
|
||||||
progressbarOutlineImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
progressbarOutlineImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
progressbarOutlineImg.SetPosition(25, 40);
|
progressbarOutlineImg.SetPosition(25, 40);
|
||||||
|
|
||||||
@ -243,8 +243,7 @@ static void ProgressWindow(const char *title, const char *msg1, const char *msg2
|
|||||||
|
|
||||||
|
|
||||||
int tmp;
|
int tmp;
|
||||||
while(showProgress)
|
while (showProgress) {
|
||||||
{
|
|
||||||
|
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
usleep(20000);
|
usleep(20000);
|
||||||
@ -284,10 +283,8 @@ static void ProgressWindow(const char *title, const char *msg1, const char *msg2
|
|||||||
* ProgressThread
|
* ProgressThread
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static void * ProgressThread (void *arg)
|
static void * ProgressThread (void *arg) {
|
||||||
{
|
while (1) {
|
||||||
while(1)
|
|
||||||
{
|
|
||||||
if (!showProgress)
|
if (!showProgress)
|
||||||
LWP_SuspendThread (progressthread);
|
LWP_SuspendThread (progressthread);
|
||||||
|
|
||||||
@ -300,8 +297,7 @@ static void * ProgressThread (void *arg)
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* ProgressStop
|
* ProgressStop
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void ProgressStop()
|
void ProgressStop() {
|
||||||
{
|
|
||||||
showProgress = 0;
|
showProgress = 0;
|
||||||
gameinstalltotal = -1;
|
gameinstalltotal = -1;
|
||||||
|
|
||||||
@ -316,8 +312,7 @@ void ProgressStop()
|
|||||||
* Callbackfunction for updating the progress values
|
* Callbackfunction for updating the progress values
|
||||||
* Use this function as standard callback
|
* Use this function as standard callback
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void ShowProgress(const char *title, const char *msg1, char *dynmsg2, f32 done, f32 total, bool swSize, bool swTime)
|
void ShowProgress(const char *title, const char *msg1, char *dynmsg2, f32 done, f32 total, bool swSize, bool swTime) {
|
||||||
{
|
|
||||||
if (total <= 0)
|
if (total <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -32,8 +32,7 @@ extern u8 reset;
|
|||||||
* TitleBrowser- opens a browser with a list of installed Titles
|
* TitleBrowser- opens a browser with a list of installed Titles
|
||||||
* relies on code from any title deleter.
|
* relies on code from any title deleter.
|
||||||
*********************************************************************************/
|
*********************************************************************************/
|
||||||
int TitleBrowser(u32 type)
|
int TitleBrowser(u32 type) {
|
||||||
{
|
|
||||||
|
|
||||||
u32 num_titles;
|
u32 num_titles;
|
||||||
u32 titles[100] ATTRIBUTE_ALIGN(32);
|
u32 titles[100] ATTRIBUTE_ALIGN(32);
|
||||||
@ -105,13 +104,12 @@ int TitleBrowser(u32 type)
|
|||||||
snprintf(tmp,50,tmp," ");
|
snprintf(tmp,50,tmp," ");
|
||||||
//snprintf(name[i],sizeof(name[i]),"Unknown Title");
|
//snprintf(name[i],sizeof(name[i]),"Unknown Title");
|
||||||
|
|
||||||
if(f)
|
if (f) {
|
||||||
{
|
|
||||||
while (fgets(line, sizeof(line), f)) {
|
while (fgets(line, sizeof(line), f)) {
|
||||||
if (line[0]== text[0]&&
|
if (line[0]== text[0]&&
|
||||||
line[1]== text[1]&&
|
line[1]== text[1]&&
|
||||||
line[2]== text[2])
|
line[2]== text[2]) {
|
||||||
{ int j=0;
|
int j=0;
|
||||||
found=1;
|
found=1;
|
||||||
for (j=0;(line[j+4]!='\0' || j<51);j++)
|
for (j=0;(line[j+4]!='\0' || j<51);j++)
|
||||||
|
|
||||||
@ -121,13 +119,11 @@ int TitleBrowser(u32 type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!found)
|
if (!found) {
|
||||||
{
|
|
||||||
if (getName00(name[i], TITLE_ID(type, titles[i]),CONF_GetLanguage()*2)>=0)
|
if (getName00(name[i], TITLE_ID(type, titles[i]),CONF_GetLanguage()*2)>=0)
|
||||||
found=2;
|
found=2;
|
||||||
|
|
||||||
if(!found)
|
if (!found) {
|
||||||
{
|
|
||||||
if (getNameBN(name[i], TITLE_ID(type, titles[i]))>=0)
|
if (getNameBN(name[i], TITLE_ID(type, titles[i]))>=0)
|
||||||
found=3;
|
found=3;
|
||||||
|
|
||||||
@ -160,13 +156,12 @@ int TitleBrowser(u32 type)
|
|||||||
char tmp[50];
|
char tmp[50];
|
||||||
snprintf(tmp,50,tmp," ");
|
snprintf(tmp,50,tmp," ");
|
||||||
//snprintf(name[i],sizeof(name[i]),"Unknown Title");
|
//snprintf(name[i],sizeof(name[i]),"Unknown Title");
|
||||||
if(f)
|
if (f) {
|
||||||
{
|
|
||||||
while (fgets(line, sizeof(line), f)) {
|
while (fgets(line, sizeof(line), f)) {
|
||||||
if (line[0]== text[0]&&
|
if (line[0]== text[0]&&
|
||||||
line[1]== text[1]&&
|
line[1]== text[1]&&
|
||||||
line[2]== text[2])
|
line[2]== text[2]) {
|
||||||
{ int j=0;
|
int j=0;
|
||||||
found=1;
|
found=1;
|
||||||
for (j=0;(line[j+4]!='\0' || j<51);j++)
|
for (j=0;(line[j+4]!='\0' || j<51);j++)
|
||||||
|
|
||||||
@ -176,13 +171,11 @@ int TitleBrowser(u32 type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!found)
|
if (!found) {
|
||||||
{
|
|
||||||
if (getName00(name[i], TITLE_ID(0x00010002, sys_titles[i-num_titles]))>=0)
|
if (getName00(name[i], TITLE_ID(0x00010002, sys_titles[i-num_titles]))>=0)
|
||||||
found=2;
|
found=2;
|
||||||
|
|
||||||
if(!found)
|
if (!found) {
|
||||||
{
|
|
||||||
if (getNameBN(name[i], TITLE_ID(0x00010002, sys_titles[i-num_titles]))>=0)
|
if (getNameBN(name[i], TITLE_ID(0x00010002, sys_titles[i-num_titles]))>=0)
|
||||||
found=3;
|
found=3;
|
||||||
|
|
||||||
@ -198,8 +191,8 @@ int TitleBrowser(u32 type)
|
|||||||
//move on to the next title
|
//move on to the next title
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
if(i == num_titles+num_sys_titles)
|
if (i == num_titles+num_sys_titles) {
|
||||||
{ options3.SetName(i, " ");
|
options3.SetName(i, " ");
|
||||||
options3.SetValue(i, "%s",tr("Wii Settings"));
|
options3.SetValue(i, "%s",tr("Wii Settings"));
|
||||||
}
|
}
|
||||||
//we have all the titles we need so close the database and stop poking around in the wii
|
//we have all the titles we need so close the database and stop poking around in the wii
|
||||||
@ -271,8 +264,7 @@ int TitleBrowser(u32 type)
|
|||||||
int tmp=num_titles+num_sys_titles;
|
int tmp=num_titles+num_sys_titles;
|
||||||
ResumeGui();
|
ResumeGui();
|
||||||
numtitle=num_titles;
|
numtitle=num_titles;
|
||||||
while(!exit)
|
while (!exit) {
|
||||||
{
|
|
||||||
VIDEO_WaitVSync();
|
VIDEO_WaitVSync();
|
||||||
|
|
||||||
if (shutdown == 1)
|
if (shutdown == 1)
|
||||||
@ -289,8 +281,7 @@ int TitleBrowser(u32 type)
|
|||||||
if (f)rewind(f);
|
if (f)rewind(f);
|
||||||
//strcpy(name,"");//make sure name is empty
|
//strcpy(name,"");//make sure name is empty
|
||||||
|
|
||||||
if (ret<numtitle)
|
if (ret<numtitle) {
|
||||||
{
|
|
||||||
//set the title's name, number, ID to text
|
//set the title's name, number, ID to text
|
||||||
sprintf(text, "%s", titleText(type, titles[ret]));
|
sprintf(text, "%s", titleText(type, titles[ret]));
|
||||||
|
|
||||||
@ -312,18 +303,14 @@ int TitleBrowser(u32 type)
|
|||||||
//this really shouldn't be needed because the title will be booted
|
//this really shouldn't be needed because the title will be booted
|
||||||
exit = true;
|
exit = true;
|
||||||
break;
|
break;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
//if they said no to booting the title
|
//if they said no to booting the title
|
||||||
ret = -1;
|
ret = -1;
|
||||||
optionBrowser3.ResetState();
|
optionBrowser3.ResetState();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} else { //if they clicked a system title
|
||||||
else//if they clicked a system title
|
if (ret == tmp) {
|
||||||
{
|
|
||||||
if(ret == tmp)
|
|
||||||
{
|
|
||||||
CloseXMLDatabase();
|
CloseXMLDatabase();
|
||||||
ExitGUIThreads();
|
ExitGUIThreads();
|
||||||
ShutdownAudio();
|
ShutdownAudio();
|
||||||
@ -331,9 +318,7 @@ int TitleBrowser(u32 type)
|
|||||||
WII_Initialize();
|
WII_Initialize();
|
||||||
WII_ReturnToSettings();
|
WII_ReturnToSettings();
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
//set the title's name, number, ID to text
|
//set the title's name, number, ID to text
|
||||||
sprintf(text, "%s", titleText(0x00010002, sys_titles[ret-num_titles]));
|
sprintf(text, "%s", titleText(0x00010002, sys_titles[ret-num_titles]));
|
||||||
|
|
||||||
@ -355,8 +340,7 @@ int TitleBrowser(u32 type)
|
|||||||
//this really shouldn't be needed because the title will be booted
|
//this really shouldn't be needed because the title will be booted
|
||||||
exit = true;
|
exit = true;
|
||||||
break;
|
break;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
//if they said no to booting the title
|
//if they said no to booting the title
|
||||||
ret = -1;
|
ret = -1;
|
||||||
optionBrowser3.ResetState();
|
optionBrowser3.ResetState();
|
||||||
@ -365,8 +349,7 @@ int TitleBrowser(u32 type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cancelBtn.GetState() == STATE_CLICKED)
|
if (cancelBtn.GetState() == STATE_CLICKED) {
|
||||||
{
|
|
||||||
//break the loop and end the function
|
//break the loop and end the function
|
||||||
exit = true;
|
exit = true;
|
||||||
ret = -10;
|
ret = -10;
|
||||||
|
@ -42,15 +42,13 @@ BROWSERENTRY * browserList = NULL; // list of files/folders in browser
|
|||||||
* ResetBrowser()
|
* ResetBrowser()
|
||||||
* Clears the file browser memory, and allocates one initial entry
|
* Clears the file browser memory, and allocates one initial entry
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void ResetBrowser()
|
void ResetBrowser() {
|
||||||
{
|
|
||||||
browser.numEntries = 0;
|
browser.numEntries = 0;
|
||||||
browser.selIndex = 0;
|
browser.selIndex = 0;
|
||||||
browser.pageIndex = 0;
|
browser.pageIndex = 0;
|
||||||
|
|
||||||
// Clear any existing values
|
// Clear any existing values
|
||||||
if(browserList != NULL)
|
if (browserList != NULL) {
|
||||||
{
|
|
||||||
free(browserList);
|
free(browserList);
|
||||||
browserList = NULL;
|
browserList = NULL;
|
||||||
}
|
}
|
||||||
@ -63,25 +61,21 @@ void ResetBrowser()
|
|||||||
* UpdateDirName()
|
* UpdateDirName()
|
||||||
* Update curent directory name for file browser
|
* Update curent directory name for file browser
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int UpdateDirName()
|
int UpdateDirName() {
|
||||||
{
|
|
||||||
int size=0;
|
int size=0;
|
||||||
char * test;
|
char * test;
|
||||||
char temp[1024];
|
char temp[1024];
|
||||||
|
|
||||||
/* current directory doesn't change */
|
/* current directory doesn't change */
|
||||||
if (strcmp(browserList[browser.selIndex].filename,".") == 0)
|
if (strcmp(browserList[browser.selIndex].filename,".") == 0) {
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* go up to parent directory */
|
/* go up to parent directory */
|
||||||
else if (strcmp(browserList[browser.selIndex].filename,"..") == 0)
|
else if (strcmp(browserList[browser.selIndex].filename,"..") == 0) {
|
||||||
{
|
|
||||||
/* determine last subdirectory namelength */
|
/* determine last subdirectory namelength */
|
||||||
sprintf(temp,"%s",browser.dir);
|
sprintf(temp,"%s",browser.dir);
|
||||||
test = strtok(temp,"/");
|
test = strtok(temp,"/");
|
||||||
while (test != NULL)
|
while (test != NULL) {
|
||||||
{
|
|
||||||
size = strlen(test);
|
size = strlen(test);
|
||||||
test = strtok(NULL,"/");
|
test = strtok(NULL,"/");
|
||||||
}
|
}
|
||||||
@ -93,17 +87,13 @@ int UpdateDirName()
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/* Open a directory */
|
/* Open a directory */
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
/* test new directory namelength */
|
/* test new directory namelength */
|
||||||
if ((strlen(browser.dir)+1+strlen(browserList[browser.selIndex].filename)) < MAXPATHLEN)
|
if ((strlen(browser.dir)+1+strlen(browserList[browser.selIndex].filename)) < MAXPATHLEN) {
|
||||||
{
|
|
||||||
/* update current directory name */
|
/* update current directory name */
|
||||||
sprintf(browser.dir, "%s/%s",browser.dir, browserList[browser.selIndex].filename);
|
sprintf(browser.dir, "%s/%s",browser.dir, browserList[browser.selIndex].filename);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,15 +108,21 @@ int UpdateDirName()
|
|||||||
* <dirs>
|
* <dirs>
|
||||||
* <files>
|
* <files>
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int FileSortCallback(const void *f1, const void *f2)
|
int FileSortCallback(const void *f1, const void *f2) {
|
||||||
{
|
|
||||||
/* Special case for implicit directories */
|
/* Special case for implicit directories */
|
||||||
if(((BROWSERENTRY *)f1)->filename[0] == '.' || ((BROWSERENTRY *)f2)->filename[0] == '.')
|
if (((BROWSERENTRY *)f1)->filename[0] == '.' || ((BROWSERENTRY *)f2)->filename[0] == '.') {
|
||||||
{
|
if (strcmp(((BROWSERENTRY *)f1)->filename, ".") == 0) {
|
||||||
if(strcmp(((BROWSERENTRY *)f1)->filename, ".") == 0) { return -1; }
|
return -1;
|
||||||
if(strcmp(((BROWSERENTRY *)f2)->filename, ".") == 0) { return 1; }
|
}
|
||||||
if(strcmp(((BROWSERENTRY *)f1)->filename, "..") == 0) { return -1; }
|
if (strcmp(((BROWSERENTRY *)f2)->filename, ".") == 0) {
|
||||||
if(strcmp(((BROWSERENTRY *)f2)->filename, "..") == 0) { return 1; }
|
return 1;
|
||||||
|
}
|
||||||
|
if (strcmp(((BROWSERENTRY *)f1)->filename, "..") == 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (strcmp(((BROWSERENTRY *)f2)->filename, "..") == 0) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If one is a file and one is a directory the directory is first. */
|
/* If one is a file and one is a directory the directory is first. */
|
||||||
@ -140,8 +136,7 @@ int FileSortCallback(const void *f1, const void *f2)
|
|||||||
* Browse subdirectories
|
* Browse subdirectories
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
int
|
int
|
||||||
ParseDirectory()
|
ParseDirectory() {
|
||||||
{
|
|
||||||
DIR_ITER *dir = NULL;
|
DIR_ITER *dir = NULL;
|
||||||
char fulldir[MAXPATHLEN];
|
char fulldir[MAXPATHLEN];
|
||||||
char filename[MAXPATHLEN];
|
char filename[MAXPATHLEN];
|
||||||
@ -155,12 +150,10 @@ ParseDirectory()
|
|||||||
dir = diropen(fulldir);
|
dir = diropen(fulldir);
|
||||||
|
|
||||||
// if we can't open the dir, try opening the root dir
|
// if we can't open the dir, try opening the root dir
|
||||||
if (dir == NULL)
|
if (dir == NULL) {
|
||||||
{
|
|
||||||
sprintf(browser.dir,"/");
|
sprintf(browser.dir,"/");
|
||||||
dir = diropen(browser.rootdir);
|
dir = diropen(browser.rootdir);
|
||||||
if (dir == NULL)
|
if (dir == NULL) {
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -168,32 +161,24 @@ ParseDirectory()
|
|||||||
// index files/folders
|
// index files/folders
|
||||||
int entryNum = 0;
|
int entryNum = 0;
|
||||||
|
|
||||||
while(dirnext(dir,filename,&filestat) == 0)
|
while (dirnext(dir,filename,&filestat) == 0) {
|
||||||
{
|
if (strcmp(filename,".") != 0) {
|
||||||
if(strcmp(filename,".") != 0)
|
|
||||||
{
|
|
||||||
BROWSERENTRY * newBrowserList = (BROWSERENTRY *)realloc(browserList, (entryNum+1) * sizeof(BROWSERENTRY));
|
BROWSERENTRY * newBrowserList = (BROWSERENTRY *)realloc(browserList, (entryNum+1) * sizeof(BROWSERENTRY));
|
||||||
|
|
||||||
if(!newBrowserList) // failed to allocate required memory
|
if (!newBrowserList) { // failed to allocate required memory
|
||||||
{
|
|
||||||
ResetBrowser();
|
ResetBrowser();
|
||||||
entryNum = -1;
|
entryNum = -1;
|
||||||
break;
|
break;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
browserList = newBrowserList;
|
browserList = newBrowserList;
|
||||||
}
|
}
|
||||||
memset(&(browserList[entryNum]), 0, sizeof(BROWSERENTRY)); // clear the new entry
|
memset(&(browserList[entryNum]), 0, sizeof(BROWSERENTRY)); // clear the new entry
|
||||||
|
|
||||||
strncpy(browserList[entryNum].filename, filename, MAXJOLIET);
|
strncpy(browserList[entryNum].filename, filename, MAXJOLIET);
|
||||||
|
|
||||||
if(strcmp(filename,"..") == 0)
|
if (strcmp(filename,"..") == 0) {
|
||||||
{
|
|
||||||
sprintf(browserList[entryNum].displayname, "..");
|
sprintf(browserList[entryNum].displayname, "..");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
strcpy(browserList[entryNum].displayname, filename); // crop name for display
|
strcpy(browserList[entryNum].displayname, filename); // crop name for display
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,8 +204,7 @@ ParseDirectory()
|
|||||||
*
|
*
|
||||||
* Update current directory and set new entry list if directory has changed
|
* Update current directory and set new entry list if directory has changed
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int BrowserChangeFolder()
|
int BrowserChangeFolder() {
|
||||||
{
|
|
||||||
if (!UpdateDirName())
|
if (!UpdateDirName())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -233,11 +217,9 @@ int BrowserChangeFolder()
|
|||||||
* BrowseDevice
|
* BrowseDevice
|
||||||
* Displays a list of files on the selected device
|
* Displays a list of files on the selected device
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int BrowseDevice(int device)
|
int BrowseDevice(int device) {
|
||||||
{
|
|
||||||
sprintf(browser.dir, "/");
|
sprintf(browser.dir, "/");
|
||||||
switch(device)
|
switch (device) {
|
||||||
{
|
|
||||||
case SD:
|
case SD:
|
||||||
sprintf(browser.rootdir, "SD:");
|
sprintf(browser.rootdir, "SD:");
|
||||||
break;
|
break;
|
||||||
@ -254,8 +236,7 @@ int BrowseDevice(int device)
|
|||||||
* MenuBrowseDevice
|
* MenuBrowseDevice
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
int BrowseDevice(char * var, int force)
|
int BrowseDevice(char * var, int force) {
|
||||||
{
|
|
||||||
|
|
||||||
int result=-1;
|
int result=-1;
|
||||||
int i;
|
int i;
|
||||||
@ -264,24 +245,19 @@ int BrowseDevice(char * var, int force)
|
|||||||
int forced =force;
|
int forced =force;
|
||||||
|
|
||||||
if (forced>-1) {
|
if (forced>-1) {
|
||||||
if(BrowseDevice(forced) > 0)
|
if (BrowseDevice(forced) > 0) {
|
||||||
{
|
|
||||||
curDivice = forced;
|
curDivice = forced;
|
||||||
goto main;
|
goto main;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if((!strcasecmp(bootDevice, "USB:"))&&(BrowseDevice(USB) > 0))
|
else if ((!strcasecmp(bootDevice, "USB:"))&&(BrowseDevice(USB) > 0)) {
|
||||||
{
|
|
||||||
curDivice = USB;
|
curDivice = USB;
|
||||||
goto main;
|
goto main;
|
||||||
}
|
} else if ((!strcasecmp(bootDevice, "SD:"))&&(BrowseDevice(SD) > 0)) {
|
||||||
else if((!strcasecmp(bootDevice, "SD:"))&&(BrowseDevice(SD) > 0))
|
|
||||||
{
|
|
||||||
curDivice = SD;
|
curDivice = SD;
|
||||||
goto main;
|
goto main;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
WindowPrompt(tr("Error"),0,tr("Ok"));
|
WindowPrompt(tr("Error"),0,tr("Ok"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -317,7 +293,8 @@ main:
|
|||||||
if (Settings.wsprompt == yes) {
|
if (Settings.wsprompt == yes) {
|
||||||
ExitBtnTxt.SetWidescreen(CFG.widescreen);
|
ExitBtnTxt.SetWidescreen(CFG.widescreen);
|
||||||
ExitBtnImg.SetWidescreen(CFG.widescreen);
|
ExitBtnImg.SetWidescreen(CFG.widescreen);
|
||||||
}GuiButton ExitBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
}
|
||||||
|
GuiButton ExitBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
||||||
ExitBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
ExitBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
||||||
ExitBtn.SetPosition(-55, -35);
|
ExitBtn.SetPosition(-55, -35);
|
||||||
ExitBtn.SetLabel(&ExitBtnTxt);
|
ExitBtn.SetLabel(&ExitBtnTxt);
|
||||||
@ -331,7 +308,8 @@ main:
|
|||||||
if (Settings.wsprompt == yes) {
|
if (Settings.wsprompt == yes) {
|
||||||
usbBtnTxt.SetWidescreen(CFG.widescreen);
|
usbBtnTxt.SetWidescreen(CFG.widescreen);
|
||||||
usbBtnImg.SetWidescreen(CFG.widescreen);
|
usbBtnImg.SetWidescreen(CFG.widescreen);
|
||||||
}GuiButton usbBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
}
|
||||||
|
GuiButton usbBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
||||||
usbBtn.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
usbBtn.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
||||||
usbBtn.SetPosition(0, -35);
|
usbBtn.SetPosition(0, -35);
|
||||||
usbBtn.SetLabel(&usbBtnTxt);
|
usbBtn.SetLabel(&usbBtnTxt);
|
||||||
@ -381,8 +359,7 @@ main:
|
|||||||
mainWindow->Append(&w);
|
mainWindow->Append(&w);
|
||||||
ResumeGui();
|
ResumeGui();
|
||||||
|
|
||||||
while(menu == MENU_NONE)
|
while (menu == MENU_NONE) {
|
||||||
{
|
|
||||||
VIDEO_WaitVSync();
|
VIDEO_WaitVSync();
|
||||||
|
|
||||||
if (shutdown == 1)
|
if (shutdown == 1)
|
||||||
@ -391,23 +368,18 @@ main:
|
|||||||
if (reset == 1)
|
if (reset == 1)
|
||||||
Sys_Reboot();
|
Sys_Reboot();
|
||||||
|
|
||||||
for(i=0; i<PAGESIZE; i++)
|
for (i=0; i<PAGESIZE; i++) {
|
||||||
{
|
if (fileBrowser.fileList[i]->GetState() == STATE_CLICKED) {
|
||||||
if(fileBrowser.fileList[i]->GetState() == STATE_CLICKED)
|
|
||||||
{
|
|
||||||
fileBrowser.fileList[i]->ResetState();
|
fileBrowser.fileList[i]->ResetState();
|
||||||
// check corresponding browser entry
|
// check corresponding browser entry
|
||||||
if(browserList[browser.selIndex].isdir)
|
if (browserList[browser.selIndex].isdir) {
|
||||||
{
|
if (BrowserChangeFolder()) {
|
||||||
if(BrowserChangeFolder())
|
|
||||||
{
|
|
||||||
fileBrowser.ResetState();
|
fileBrowser.ResetState();
|
||||||
fileBrowser.fileList[0]->SetState(STATE_SELECTED);
|
fileBrowser.fileList[0]->SetState(STATE_SELECTED);
|
||||||
fileBrowser.TriggerUpdate();
|
fileBrowser.TriggerUpdate();
|
||||||
sprintf(var,"%s", browser.rootdir);
|
sprintf(var,"%s", browser.rootdir);
|
||||||
int len=strlen(browser.rootdir);
|
int len=strlen(browser.rootdir);
|
||||||
for (unsigned int i=len;i<strlen(browser.rootdir)+strlen(browser.dir);i++)
|
for (unsigned int i=len;i<strlen(browser.rootdir)+strlen(browser.dir);i++) {
|
||||||
{
|
|
||||||
var[i]=browser.dir[i-(len-1)];
|
var[i]=browser.dir[i-(len-1)];
|
||||||
}
|
}
|
||||||
AdressText.SetTextf("%s", var);
|
AdressText.SetTextf("%s", var);
|
||||||
@ -422,26 +394,20 @@ main:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ExitBtn.GetState() == STATE_CLICKED)
|
if (ExitBtn.GetState() == STATE_CLICKED) {
|
||||||
{
|
|
||||||
snprintf(var,sizeof(currentdir),"%s", currentdir);
|
snprintf(var,sizeof(currentdir),"%s", currentdir);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(okBtn.GetState() == STATE_CLICKED)
|
if (okBtn.GetState() == STATE_CLICKED) {
|
||||||
{
|
|
||||||
result = 1;
|
result = 1;
|
||||||
break;
|
break;
|
||||||
}
|
} else if (usbBtn.GetState() == STATE_CLICKED) {
|
||||||
else if(usbBtn.GetState() == STATE_CLICKED)
|
|
||||||
{
|
|
||||||
HaltGui();
|
HaltGui();
|
||||||
mainWindow->Remove(&w);
|
mainWindow->Remove(&w);
|
||||||
ResumeGui();
|
ResumeGui();
|
||||||
result = BrowseDevice(var, (curDivice==SD?USB:SD));
|
result = BrowseDevice(var, (curDivice==SD?USB:SD));
|
||||||
break;
|
break;
|
||||||
}
|
} else if (folderBtn.GetState() == STATE_CLICKED) {
|
||||||
else if(folderBtn.GetState() == STATE_CLICKED)
|
|
||||||
{
|
|
||||||
HaltGui();
|
HaltGui();
|
||||||
mainWindow->Remove(&w);
|
mainWindow->Remove(&w);
|
||||||
ResumeGui();
|
ResumeGui();
|
||||||
@ -449,8 +415,7 @@ main:
|
|||||||
sprintf(newfolder,"%s/",var);
|
sprintf(newfolder,"%s/",var);
|
||||||
|
|
||||||
int result = OnScreenKeyboard(newfolder,100,0);
|
int result = OnScreenKeyboard(newfolder,100,0);
|
||||||
if ( result == 1 )
|
if ( result == 1 ) {
|
||||||
{
|
|
||||||
int len = (strlen(newfolder)-1);
|
int len = (strlen(newfolder)-1);
|
||||||
if (newfolder[len] !='/')
|
if (newfolder[len] !='/')
|
||||||
strncat (newfolder, "/", 1);
|
strncat (newfolder, "/", 1);
|
||||||
|
@ -24,8 +24,7 @@ enum {
|
|||||||
USB
|
USB
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
char dir[MAXPATHLEN]; // directory path of browserList
|
char dir[MAXPATHLEN]; // directory path of browserList
|
||||||
char rootdir[10]; // directory path of browserList
|
char rootdir[10]; // directory path of browserList
|
||||||
int numEntries; // # of entries in browserList
|
int numEntries; // # of entries in browserList
|
||||||
@ -33,8 +32,7 @@ typedef struct
|
|||||||
int pageIndex; // starting index of browserList page display
|
int pageIndex; // starting index of browserList page display
|
||||||
} BROWSERINFO;
|
} BROWSERINFO;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
u64 offset; // DVD offset
|
u64 offset; // DVD offset
|
||||||
u64 length; // file length in 64 bytes for sizes higher than 4GB
|
u64 length; // file length in 64 bytes for sizes higher than 4GB
|
||||||
char isdir; // 0 - file, 1 - directory
|
char isdir; // 0 - file, 1 - directory
|
||||||
|
@ -38,8 +38,7 @@ extern void HaltGui();
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* gameinfo
|
* gameinfo
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int showGameInfo(char *ID)
|
int showGameInfo(char *ID) {
|
||||||
{
|
|
||||||
HaltGui();//put this first to try to get rid of the code dump caused by loading this window at the same time as loading images from the SD card
|
HaltGui();//put this first to try to get rid of the code dump caused by loading this window at the same time as loading images from the SD card
|
||||||
mainWindow->SetState(STATE_DISABLED);
|
mainWindow->SetState(STATE_DISABLED);
|
||||||
ResumeGui();
|
ResumeGui();
|
||||||
@ -197,8 +196,7 @@ int showGameInfo(char *ID)
|
|||||||
char linebuf2[100] = "";
|
char linebuf2[100] = "";
|
||||||
|
|
||||||
// enable icons for required accessories
|
// enable icons for required accessories
|
||||||
for (int i=1;i<=XML_ELEMMAX;i++)
|
for (int i=1;i<=XML_ELEMMAX;i++) {
|
||||||
{
|
|
||||||
if (strcmp(gameinfo.accessoriesReq[i],"classiccontroller")==0)
|
if (strcmp(gameinfo.accessoriesReq[i],"classiccontroller")==0)
|
||||||
classiccontroller=1;
|
classiccontroller=1;
|
||||||
if (strcmp(gameinfo.accessoriesReq[i],"nunchuk")==0)
|
if (strcmp(gameinfo.accessoriesReq[i],"nunchuk")==0)
|
||||||
@ -253,8 +251,7 @@ int showGameInfo(char *ID)
|
|||||||
else dancepadImgData = new GuiImageData(dancepad_png);
|
else dancepadImgData = new GuiImageData(dancepad_png);
|
||||||
|
|
||||||
// look for optional accessories
|
// look for optional accessories
|
||||||
for (int i=1;i<=XML_ELEMMAX;i++)
|
for (int i=1;i<=XML_ELEMMAX;i++) {
|
||||||
{
|
|
||||||
if (strcmp(gameinfo.accessories[i],"classiccontroller")==0)
|
if (strcmp(gameinfo.accessories[i],"classiccontroller")==0)
|
||||||
classiccontroller=1;
|
classiccontroller=1;
|
||||||
if (strcmp(gameinfo.accessories[i],"nunchuk")==0)
|
if (strcmp(gameinfo.accessories[i],"nunchuk")==0)
|
||||||
@ -417,11 +414,14 @@ int showGameInfo(char *ID)
|
|||||||
if ((strcmp(gameinfo.wifiplayers,"") != 0) && (strcmp(gameinfo.wifiplayers,"0") != 0)) {
|
if ((strcmp(gameinfo.wifiplayers,"") != 0) && (strcmp(gameinfo.wifiplayers,"0") != 0)) {
|
||||||
wifiplayersImgData = new GuiImageData(wifi1_png);
|
wifiplayersImgData = new GuiImageData(wifi1_png);
|
||||||
if (atoi(gameinfo.wifiplayers)>1) {
|
if (atoi(gameinfo.wifiplayers)>1) {
|
||||||
wifiplayersImgData= new GuiImageData(wifi2_png);}
|
wifiplayersImgData= new GuiImageData(wifi2_png);
|
||||||
|
}
|
||||||
if (atoi(gameinfo.wifiplayers)>2) {
|
if (atoi(gameinfo.wifiplayers)>2) {
|
||||||
wifiplayersImgData= new GuiImageData(wifi4_png);}
|
wifiplayersImgData= new GuiImageData(wifi4_png);
|
||||||
|
}
|
||||||
if (atoi(gameinfo.wifiplayers)>4) {
|
if (atoi(gameinfo.wifiplayers)>4) {
|
||||||
wifiplayersImgData= new GuiImageData(wifi8_png);}
|
wifiplayersImgData= new GuiImageData(wifi8_png);
|
||||||
|
}
|
||||||
/*if (atoi(gameinfo.wifiplayers)>8){ uncomment this when we actually have these images and it is needed
|
/*if (atoi(gameinfo.wifiplayers)>8){ uncomment this when we actually have these images and it is needed
|
||||||
wifiplayersImgData= new GuiImageData(wifi12_png);}
|
wifiplayersImgData= new GuiImageData(wifi12_png);}
|
||||||
if (atoi(gameinfo.wifiplayers)>12){
|
if (atoi(gameinfo.wifiplayers)>12){
|
||||||
@ -451,7 +451,9 @@ int showGameInfo(char *ID)
|
|||||||
ratingImgData = new GuiImageData(esrb_m_png);
|
ratingImgData = new GuiImageData(esrb_m_png);
|
||||||
else if (strcmp(gameinfo.ratingvalueESRB,"AO")==0)
|
else if (strcmp(gameinfo.ratingvalueESRB,"AO")==0)
|
||||||
ratingImgData = new GuiImageData(esrb_ao_png);
|
ratingImgData = new GuiImageData(esrb_ao_png);
|
||||||
else {ratingImgData = new GuiImageData(norating_png);}
|
else {
|
||||||
|
ratingImgData = new GuiImageData(norating_png);
|
||||||
|
}
|
||||||
} //there are 2 values here cause some countries are stupid and
|
} //there are 2 values here cause some countries are stupid and
|
||||||
else if (strcmp(gameinfo.ratingtype,"PEGI")==0) {//can't use the same as everybody else
|
else if (strcmp(gameinfo.ratingtype,"PEGI")==0) {//can't use the same as everybody else
|
||||||
if ((strcmp(gameinfo.ratingvaluePEGI,"3")==0)||(strcmp(gameinfo.ratingvaluePEGI,"4")==0))
|
if ((strcmp(gameinfo.ratingvaluePEGI,"3")==0)||(strcmp(gameinfo.ratingvaluePEGI,"4")==0))
|
||||||
@ -464,9 +466,10 @@ int showGameInfo(char *ID)
|
|||||||
ratingImgData = new GuiImageData(pegi_16_png);
|
ratingImgData = new GuiImageData(pegi_16_png);
|
||||||
else if (strcmp(gameinfo.ratingvaluePEGI,"18")==0)
|
else if (strcmp(gameinfo.ratingvaluePEGI,"18")==0)
|
||||||
ratingImgData = new GuiImageData(pegi_18_png);
|
ratingImgData = new GuiImageData(pegi_18_png);
|
||||||
else {ratingImgData = new GuiImageData(norating_png);}
|
else {
|
||||||
|
ratingImgData = new GuiImageData(norating_png);
|
||||||
}
|
}
|
||||||
else if (strcmp(gameinfo.ratingtype,"CERO")==0) {
|
} else if (strcmp(gameinfo.ratingtype,"CERO")==0) {
|
||||||
if (strcmp(gameinfo.ratingvalueCERO,"A")==0)
|
if (strcmp(gameinfo.ratingvalueCERO,"A")==0)
|
||||||
ratingImgData = new GuiImageData(cero_a_png);
|
ratingImgData = new GuiImageData(cero_a_png);
|
||||||
else if (strcmp(gameinfo.ratingvalueCERO,"B")==0)
|
else if (strcmp(gameinfo.ratingvalueCERO,"B")==0)
|
||||||
@ -477,10 +480,14 @@ int showGameInfo(char *ID)
|
|||||||
ratingImgData = new GuiImageData(cero_d_png);
|
ratingImgData = new GuiImageData(cero_d_png);
|
||||||
else if (strcmp(gameinfo.ratingvalueCERO,"Z")==0)
|
else if (strcmp(gameinfo.ratingvalueCERO,"Z")==0)
|
||||||
ratingImgData = new GuiImageData(cero_z_png);
|
ratingImgData = new GuiImageData(cero_z_png);
|
||||||
else {ratingImgData = new GuiImageData(norating_png);}
|
else {
|
||||||
|
ratingImgData = new GuiImageData(norating_png);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else {ratingImgData = new GuiImageData(norating_png);}
|
else {
|
||||||
|
ratingImgData = new GuiImageData(norating_png);
|
||||||
|
}
|
||||||
ratingImg = new GuiImage(ratingImgData);
|
ratingImg = new GuiImage(ratingImgData);
|
||||||
ratingImg->SetWidescreen(CFG.widescreen);
|
ratingImg->SetWidescreen(CFG.widescreen);
|
||||||
ratingImg->SetPosition(-25 , inputY);
|
ratingImg->SetPosition(-25 , inputY);
|
||||||
@ -495,7 +502,8 @@ int showGameInfo(char *ID)
|
|||||||
strlcpy(meminfotxt,MemInfo(),sizeof(meminfotxt));
|
strlcpy(meminfotxt,MemInfo(),sizeof(meminfotxt));
|
||||||
snprintf(linebuf, sizeof(linebuf), "%s",meminfotxt);
|
snprintf(linebuf, sizeof(linebuf), "%s",meminfotxt);
|
||||||
memTxt = new GuiText(linebuf, 18, (GXColor) {0,0,0, 255});
|
memTxt = new GuiText(linebuf, 18, (GXColor) {0,0,0, 255});
|
||||||
memTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP); memTxt->SetPosition(0,0);
|
memTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||||
|
memTxt->SetPosition(0,0);
|
||||||
gameinfoWindow.Append(memTxt);
|
gameinfoWindow.Append(memTxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -506,17 +514,18 @@ int showGameInfo(char *ID)
|
|||||||
titleTxt = new GuiText(linebuf, titlefontsize, (GXColor) {0,0,0, 255});
|
titleTxt = new GuiText(linebuf, titlefontsize, (GXColor) {0,0,0, 255});
|
||||||
titleTxt->SetMaxWidth(350, GuiText::SCROLL);
|
titleTxt->SetMaxWidth(350, GuiText::SCROLL);
|
||||||
//while (titleTxt->GetWidth()>250) { titleTxt->SetFontSize(titlefontsize-=2); }
|
//while (titleTxt->GetWidth()>250) { titleTxt->SetFontSize(titlefontsize-=2); }
|
||||||
titleTxt->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt->SetPosition(txtXOffset,12+titley);
|
titleTxt->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||||
|
titleTxt->SetPosition(txtXOffset,12+titley);
|
||||||
gameinfoWindow.Append(titleTxt);
|
gameinfoWindow.Append(titleTxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
//date
|
//date
|
||||||
snprintf(linebuf2, sizeof(linebuf2), " ");
|
snprintf(linebuf2, sizeof(linebuf2), " ");
|
||||||
if (strcmp(gameinfo.day,"") != 0)
|
if (strcmp(gameinfo.day,"") != 0) {
|
||||||
{snprintf(linebuf2, sizeof(linebuf2), "%s ", gameinfo.day);}
|
snprintf(linebuf2, sizeof(linebuf2), "%s ", gameinfo.day);
|
||||||
|
}
|
||||||
if (strcmp(gameinfo.month,"") != 0) {
|
if (strcmp(gameinfo.month,"") != 0) {
|
||||||
switch (atoi(gameinfo.month))
|
switch (atoi(gameinfo.month)) {
|
||||||
{
|
|
||||||
case 1:
|
case 1:
|
||||||
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr("Jan"));
|
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr("Jan"));
|
||||||
break;
|
break;
|
||||||
@ -559,7 +568,10 @@ int showGameInfo(char *ID)
|
|||||||
snprintf(linebuf, sizeof(linebuf), "%s : %s%s", tr("Released"), linebuf2, gameinfo.year);
|
snprintf(linebuf, sizeof(linebuf), "%s : %s%s", tr("Released"), linebuf2, gameinfo.year);
|
||||||
releasedTxt = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
releasedTxt = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
||||||
if (releasedTxt->GetWidth()>300) newline=2;
|
if (releasedTxt->GetWidth()>300) newline=2;
|
||||||
releasedTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); releasedTxt->SetPosition(-17,12+indexy); indexy+=(20 * newline);newline=1;
|
releasedTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
||||||
|
releasedTxt->SetPosition(-17,12+indexy);
|
||||||
|
indexy+=(20 * newline);
|
||||||
|
newline=1;
|
||||||
gameinfoWindow.Append(releasedTxt);
|
gameinfoWindow.Append(releasedTxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -569,7 +581,10 @@ int showGameInfo(char *ID)
|
|||||||
publisherTxt = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
publisherTxt = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
||||||
if (publisherTxt->GetWidth()>250) newline=2;
|
if (publisherTxt->GetWidth()>250) newline=2;
|
||||||
publisherTxt->SetMaxWidth(250,GuiText::WRAP);
|
publisherTxt->SetMaxWidth(250,GuiText::WRAP);
|
||||||
publisherTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); publisherTxt->SetPosition(-17,12+indexy); indexy+=(20 * newline);newline=1;
|
publisherTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
||||||
|
publisherTxt->SetPosition(-17,12+indexy);
|
||||||
|
indexy+=(20 * newline);
|
||||||
|
newline=1;
|
||||||
gameinfoWindow.Append(publisherTxt);
|
gameinfoWindow.Append(publisherTxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -579,38 +594,44 @@ int showGameInfo(char *ID)
|
|||||||
developerTxt = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
developerTxt = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
||||||
if (developerTxt->GetWidth()>250) newline=2;
|
if (developerTxt->GetWidth()>250) newline=2;
|
||||||
developerTxt->SetMaxWidth(250,GuiText::WRAP);
|
developerTxt->SetMaxWidth(250,GuiText::WRAP);
|
||||||
developerTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); developerTxt->SetPosition(-17,12+indexy); indexy+=(20 * newline);newline=1;
|
developerTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
||||||
|
developerTxt->SetPosition(-17,12+indexy);
|
||||||
|
indexy+=(20 * newline);
|
||||||
|
newline=1;
|
||||||
gameinfoWindow.Append(developerTxt);
|
gameinfoWindow.Append(developerTxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
//genre
|
//genre
|
||||||
int genreY = marginY;
|
int genreY = marginY;
|
||||||
genreTxt = new GuiText * [gameinfo.genreCnt + 1];
|
genreTxt = new GuiText * [gameinfo.genreCnt + 1];
|
||||||
for (int i=1;i<=gameinfo.genreCnt;i++)
|
for (int i=1;i<=gameinfo.genreCnt;i++) {
|
||||||
{
|
|
||||||
snprintf(linebuf, sizeof(linebuf), "%s", gameinfo.genresplit[i]);
|
snprintf(linebuf, sizeof(linebuf), "%s", gameinfo.genresplit[i]);
|
||||||
genreTxt[i] = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
genreTxt[i] = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
||||||
genreTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); genreTxt[i]->SetPosition(205,12+genreY); genreY+=20;
|
genreTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||||
|
genreTxt[i]->SetPosition(205,12+genreY);
|
||||||
|
genreY+=20;
|
||||||
gameinfoWindow.Append(genreTxt[i]);
|
gameinfoWindow.Append(genreTxt[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//online
|
//online
|
||||||
wifiTxt = new GuiText * [gameinfo.wifiCnt + 1];
|
wifiTxt = new GuiText * [gameinfo.wifiCnt + 1];
|
||||||
for (int i=gameinfo.wifiCnt;i>=1;i--)
|
for (int i=gameinfo.wifiCnt;i>=1;i--) {
|
||||||
{
|
|
||||||
if (strcmp(gameinfo.wififeatures[i],"Nintendods") == 0) {
|
if (strcmp(gameinfo.wififeatures[i],"Nintendods") == 0) {
|
||||||
snprintf(linebuf, sizeof(linebuf), "Nintendo DS");
|
snprintf(linebuf, sizeof(linebuf), "Nintendo DS");
|
||||||
} else {
|
} else {
|
||||||
snprintf(linebuf, sizeof(linebuf), "%s",gameinfo.wififeatures[i]);
|
snprintf(linebuf, sizeof(linebuf), "%s",gameinfo.wififeatures[i]);
|
||||||
}
|
}
|
||||||
wifiTxt[i] = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
wifiTxt[i] = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
||||||
wifiTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); wifiTxt[i]->SetPosition(215,200+wifiY); wifiY-=20;
|
wifiTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||||
|
wifiTxt[i]->SetPosition(215,200+wifiY);
|
||||||
|
wifiY-=20;
|
||||||
gameinfoWindow.Append(wifiTxt[i]);
|
gameinfoWindow.Append(wifiTxt[i]);
|
||||||
}
|
}
|
||||||
if (strcmp(gameinfo.wififeatures[1],"") != 0) {
|
if (strcmp(gameinfo.wififeatures[1],"") != 0) {
|
||||||
snprintf(linebuf, sizeof(linebuf), "%s:",tr("WiFi Features"));
|
snprintf(linebuf, sizeof(linebuf), "%s:",tr("WiFi Features"));
|
||||||
wifiTxt[0] = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
wifiTxt[0] = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
||||||
wifiTxt[0]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); wifiTxt[0]->SetPosition(205,200+wifiY);
|
wifiTxt[0]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||||
|
wifiTxt[0]->SetPosition(205,200+wifiY);
|
||||||
gameinfoWindow.Append(wifiTxt[0]);
|
gameinfoWindow.Append(wifiTxt[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -620,7 +641,8 @@ int showGameInfo(char *ID)
|
|||||||
snprintf(linebuf, sizeof(linebuf), "%s", gameinfo.synopsis);
|
snprintf(linebuf, sizeof(linebuf), "%s", gameinfo.synopsis);
|
||||||
synopsisTxt = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
synopsisTxt = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
||||||
synopsisTxt->SetMaxWidth(350,GuiText::WRAP);
|
synopsisTxt->SetMaxWidth(350,GuiText::WRAP);
|
||||||
synopsisTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP); synopsisTxt->SetPosition(0,0);
|
synopsisTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||||
|
synopsisTxt->SetPosition(0,0);
|
||||||
synopsisTxt->SetNumLines(pagesize);
|
synopsisTxt->SetNumLines(pagesize);
|
||||||
//synopsisTxt->SetFirstLine(12);
|
//synopsisTxt->SetFirstLine(12);
|
||||||
|
|
||||||
@ -658,11 +680,13 @@ int showGameInfo(char *ID)
|
|||||||
//don't bother us txt
|
//don't bother us txt
|
||||||
snprintf(linebuf, sizeof(linebuf), tr("Don't bother the USB Loader GX Team about errors in this file."));
|
snprintf(linebuf, sizeof(linebuf), tr("Don't bother the USB Loader GX Team about errors in this file."));
|
||||||
betaTxt = new GuiText(linebuf, 14, (GXColor) {0,0,0, 255});
|
betaTxt = new GuiText(linebuf, 14, (GXColor) {0,0,0, 255});
|
||||||
betaTxt->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); betaTxt->SetPosition(-17,-20);
|
betaTxt->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
||||||
|
betaTxt->SetPosition(-17,-20);
|
||||||
gameinfoWindow.Append(betaTxt);
|
gameinfoWindow.Append(betaTxt);
|
||||||
snprintf(linebuf, sizeof(linebuf), tr("If you don't have WiFi, press 1 to get an URL to get your WiiTDB.zip"));
|
snprintf(linebuf, sizeof(linebuf), tr("If you don't have WiFi, press 1 to get an URL to get your WiiTDB.zip"));
|
||||||
beta1Txt = new GuiText(linebuf, 14, (GXColor) {0,0,0, 255});
|
beta1Txt = new GuiText(linebuf, 14, (GXColor) {0,0,0, 255});
|
||||||
beta1Txt->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); beta1Txt->SetPosition(-17,-10);
|
beta1Txt->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
||||||
|
beta1Txt->SetPosition(-17,-10);
|
||||||
gameinfoWindow.Append(beta1Txt);
|
gameinfoWindow.Append(beta1Txt);
|
||||||
|
|
||||||
gameinfoWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 100);
|
gameinfoWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 100);
|
||||||
@ -672,25 +696,21 @@ int showGameInfo(char *ID)
|
|||||||
mainWindow->ChangeFocus(&gameinfoWindow);
|
mainWindow->ChangeFocus(&gameinfoWindow);
|
||||||
ResumeGui();
|
ResumeGui();
|
||||||
|
|
||||||
while(choice == -1)
|
while (choice == -1) {
|
||||||
{
|
|
||||||
|
|
||||||
VIDEO_WaitVSync();
|
VIDEO_WaitVSync();
|
||||||
if(shutdown == 1)
|
if (shutdown == 1) {
|
||||||
{
|
|
||||||
wiilight(0);
|
wiilight(0);
|
||||||
Sys_Shutdown();
|
Sys_Shutdown();
|
||||||
}
|
} else if (reset == 1)
|
||||||
else if(reset == 1)
|
|
||||||
Sys_Reboot();
|
Sys_Reboot();
|
||||||
|
|
||||||
else if ((backBtn.GetState()==STATE_CLICKED)||(backBtn.GetState()==STATE_HELD)) {
|
else if ((backBtn.GetState()==STATE_CLICKED)||(backBtn.GetState()==STATE_HELD)) {
|
||||||
if(page==1)
|
if (page==1) {
|
||||||
{choice=1;
|
choice=1;
|
||||||
synopsisTxt = NULL;
|
synopsisTxt = NULL;
|
||||||
break;}
|
break;
|
||||||
else if (page==2)
|
} else if (page==2) {
|
||||||
{
|
|
||||||
HaltGui();
|
HaltGui();
|
||||||
gameinfoWindow2.SetVisible(false);
|
gameinfoWindow2.SetVisible(false);
|
||||||
gameinfoWindow.SetVisible(true);
|
gameinfoWindow.SetVisible(true);
|
||||||
@ -698,8 +718,7 @@ int showGameInfo(char *ID)
|
|||||||
ResumeGui();
|
ResumeGui();
|
||||||
page=1;
|
page=1;
|
||||||
}
|
}
|
||||||
}
|
} else if (((nextBtn.GetState()==STATE_CLICKED)||(nextBtn.GetState()==STATE_HELD))&&
|
||||||
else if (((nextBtn.GetState()==STATE_CLICKED)||(nextBtn.GetState()==STATE_HELD))&&
|
|
||||||
(strcmp(gameinfo.synopsis,"") != 0)) {
|
(strcmp(gameinfo.synopsis,"") != 0)) {
|
||||||
|
|
||||||
if (page==1) {
|
if (page==1) {
|
||||||
@ -716,8 +735,7 @@ int showGameInfo(char *ID)
|
|||||||
mainWindow->Append(&gameinfoWindow2);
|
mainWindow->Append(&gameinfoWindow2);
|
||||||
ResumeGui();
|
ResumeGui();
|
||||||
page=2;
|
page=2;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
nextBtn.ResetState();
|
nextBtn.ResetState();
|
||||||
HaltGui();
|
HaltGui();
|
||||||
//backBtn.SetClickable(true);
|
//backBtn.SetClickable(true);
|
||||||
@ -732,20 +750,16 @@ int showGameInfo(char *ID)
|
|||||||
}
|
}
|
||||||
nextBtn.ResetState();
|
nextBtn.ResetState();
|
||||||
|
|
||||||
}
|
} else if ((upBtn.GetState()==STATE_CLICKED||upBtn.GetState()==STATE_HELD) && page==2) {
|
||||||
else if ((upBtn.GetState()==STATE_CLICKED||upBtn.GetState()==STATE_HELD) && page==2)
|
|
||||||
{
|
|
||||||
//int l=synopsisTxt->GetFirstLine()-1;
|
//int l=synopsisTxt->GetFirstLine()-1;
|
||||||
if (synopsisTxt->GetFirstLine()>1)
|
if (synopsisTxt->GetFirstLine()>1)
|
||||||
synopsisTxt->SetFirstLine(synopsisTxt->GetFirstLine()-1);
|
synopsisTxt->SetFirstLine(synopsisTxt->GetFirstLine()-1);
|
||||||
usleep(60000);
|
usleep(60000);
|
||||||
if (!((ButtonsHold() & WPAD_BUTTON_UP)||(ButtonsHold() & PAD_BUTTON_UP)))
|
if (!((ButtonsHold() & WPAD_BUTTON_UP)||(ButtonsHold() & PAD_BUTTON_UP)))
|
||||||
upBtn.ResetState();
|
upBtn.ResetState();
|
||||||
}
|
} else if ((dnBtn.GetState()==STATE_CLICKED||dnBtn.GetState()==STATE_HELD) && page==2
|
||||||
else if ((dnBtn.GetState()==STATE_CLICKED||dnBtn.GetState()==STATE_HELD) && page==2
|
|
||||||
&&synopsisTxt->GetTotalLines()>pagesize
|
&&synopsisTxt->GetTotalLines()>pagesize
|
||||||
&&synopsisTxt->GetFirstLine()-1<synopsisTxt->GetTotalLines()-pagesize)
|
&&synopsisTxt->GetFirstLine()-1<synopsisTxt->GetTotalLines()-pagesize) {
|
||||||
{
|
|
||||||
int l=0;
|
int l=0;
|
||||||
//if(synopsisTxt->GetTotalLines()>pagesize)
|
//if(synopsisTxt->GetTotalLines()>pagesize)
|
||||||
l=synopsisTxt->GetFirstLine()+1;
|
l=synopsisTxt->GetFirstLine()+1;
|
||||||
@ -757,15 +771,12 @@ int showGameInfo(char *ID)
|
|||||||
usleep(60000);
|
usleep(60000);
|
||||||
if (!((ButtonsHold() & WPAD_BUTTON_DOWN)||(ButtonsHold() & PAD_BUTTON_DOWN)))
|
if (!((ButtonsHold() & WPAD_BUTTON_DOWN)||(ButtonsHold() & PAD_BUTTON_DOWN)))
|
||||||
dnBtn.ResetState();
|
dnBtn.ResetState();
|
||||||
}
|
} else if (homeBtn.GetState()==STATE_CLICKED) {
|
||||||
else if (homeBtn.GetState()==STATE_CLICKED)
|
if (page==1) {
|
||||||
{
|
choice=2;
|
||||||
if(page==1)
|
|
||||||
{choice=2;
|
|
||||||
synopsisTxt = NULL;
|
synopsisTxt = NULL;
|
||||||
break;}
|
break;
|
||||||
else if (page==2)
|
} else if (page==2) {
|
||||||
{
|
|
||||||
HaltGui();
|
HaltGui();
|
||||||
gameinfoWindow2.SetVisible(false);
|
gameinfoWindow2.SetVisible(false);
|
||||||
gameinfoWindow.SetVisible(true);
|
gameinfoWindow.SetVisible(true);
|
||||||
@ -776,11 +787,8 @@ int showGameInfo(char *ID)
|
|||||||
ResumeGui();
|
ResumeGui();
|
||||||
page=1;
|
page=1;
|
||||||
}
|
}
|
||||||
}
|
} else if (urlBtn.GetState()==STATE_CLICKED) {
|
||||||
else if (urlBtn.GetState()==STATE_CLICKED)
|
if (save_XML_URL()) {
|
||||||
{
|
|
||||||
if (save_XML_URL())
|
|
||||||
{
|
|
||||||
snprintf(linebuf, sizeof(linebuf), tr("Your URL has been saved in %sWiiTDB_URL.txt."), Settings.update_path);
|
snprintf(linebuf, sizeof(linebuf), tr("Your URL has been saved in %sWiiTDB_URL.txt."), Settings.update_path);
|
||||||
betaTxt->SetText(linebuf);
|
betaTxt->SetText(linebuf);
|
||||||
gameinfoWindow.Append(betaTxt);
|
gameinfoWindow.Append(betaTxt);
|
||||||
@ -846,14 +854,12 @@ int showGameInfo(char *ID)
|
|||||||
delete beta1Txt;
|
delete beta1Txt;
|
||||||
delete memTxt;
|
delete memTxt;
|
||||||
if (gameinfo.genreCnt>0) {
|
if (gameinfo.genreCnt>0) {
|
||||||
for(int i=1;i<=gameinfo.genreCnt;i++)
|
for (int i=1;i<=gameinfo.genreCnt;i++) {
|
||||||
{
|
|
||||||
delete genreTxt[i];
|
delete genreTxt[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (gameinfo.wifiCnt>0) {
|
if (gameinfo.wifiCnt>0) {
|
||||||
for(int i=0;i<=gameinfo.wifiCnt;i++)
|
for (int i=0;i<=gameinfo.wifiCnt;i++) {
|
||||||
{
|
|
||||||
delete wifiTxt[i];
|
delete wifiTxt[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -874,8 +880,7 @@ int showGameInfo(char *ID)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool save_XML_URL()// save xml url as as txt file for people without wifi
|
bool save_XML_URL() { // save xml url as as txt file for people without wifi
|
||||||
{
|
|
||||||
char tmp[200];
|
char tmp[200];
|
||||||
sprintf(tmp, "%s", Settings.update_path);
|
sprintf(tmp, "%s", Settings.update_path);
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
@ -1,20 +1,17 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "ramdisc.h"
|
#include "ramdisc.h"
|
||||||
|
|
||||||
static inline u16 u8array_to_u16 (const u8* item, int offset)
|
static inline u16 u8array_to_u16 (const u8* item, int offset) {
|
||||||
{
|
|
||||||
return ( item[offset] | (item[offset + 1] << 8));
|
return ( item[offset] | (item[offset + 1] << 8));
|
||||||
}
|
}
|
||||||
static inline u32 u8array_to_u32 (const u8* item, int offset)
|
static inline u32 u8array_to_u32 (const u8* item, int offset) {
|
||||||
{
|
|
||||||
return ( item[offset] | (item[offset + 1] << 8) | (item[offset + 2] << 16) | (item[offset + 3] << 24) );
|
return ( item[offset] | (item[offset + 1] << 8) | (item[offset + 2] << 16) | (item[offset + 3] << 24) );
|
||||||
}
|
}
|
||||||
static inline void u16_to_u8array (u8* item, int offset, u16 value)
|
static inline void u16_to_u8array (u8* item, int offset, u16 value) {
|
||||||
{
|
item[offset] = (u8) value;
|
||||||
item[offset] = (u8) value; item[offset + 1] = (u8)(value >> 8);
|
item[offset + 1] = (u8)(value >> 8);
|
||||||
}
|
}
|
||||||
static inline void u32_to_u8array (u8* item, int offset, u32 value)
|
static inline void u32_to_u8array (u8* item, int offset, u32 value) {
|
||||||
{
|
|
||||||
item[offset] = (u8) value;
|
item[offset] = (u8) value;
|
||||||
item[offset + 1] = (u8)(value >> 8);
|
item[offset + 1] = (u8)(value >> 8);
|
||||||
item[offset + 2] = (u8)(value >> 16);
|
item[offset + 2] = (u8)(value >> 16);
|
||||||
@ -22,17 +19,17 @@ static inline void u32_to_u8array (u8* item, int offset, u32 value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class padding
|
class padding {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
padding(u32 Start, u32 NumSectors)
|
padding(u32 Start, u32 NumSectors) {
|
||||||
{
|
|
||||||
start = Start;
|
start = Start;
|
||||||
end = Start + NumSectors;
|
end = Start + NumSectors;
|
||||||
data = new u8[NumSectors*512];
|
data = new u8[NumSectors*512];
|
||||||
next = 0;
|
next = 0;
|
||||||
}
|
}
|
||||||
~padding() { delete [] data;}
|
~padding() {
|
||||||
|
delete [] data;
|
||||||
|
}
|
||||||
|
|
||||||
u32 start;
|
u32 start;
|
||||||
u32 end;
|
u32 end;
|
||||||
@ -44,15 +41,13 @@ static u32 __ramdisk_sectorsOfPadding;
|
|||||||
static padding *__ramdisk_data_start;
|
static padding *__ramdisk_data_start;
|
||||||
static padding *__ramdisk_data_end;
|
static padding *__ramdisk_data_end;
|
||||||
|
|
||||||
static bool __ramdisk_IsInserted(void)
|
static bool __ramdisk_IsInserted(void) {
|
||||||
{
|
|
||||||
return __ramdisk_data_start!=NULL;
|
return __ramdisk_data_start!=NULL;
|
||||||
}
|
}
|
||||||
//forward decleration
|
//forward decleration
|
||||||
static bool __ramdisk_WriteSectors(size_t Sector, size_t numSectors, u8 *Buffer);
|
static bool __ramdisk_WriteSectors(size_t Sector, size_t numSectors, u8 *Buffer);
|
||||||
|
|
||||||
bool initRAMDisc(u32 Size, u32 Padding)
|
bool initRAMDisc(u32 Size, u32 Padding) {
|
||||||
{
|
|
||||||
if (__ramdisk_data_start) return true; // is init
|
if (__ramdisk_data_start) return true; // is init
|
||||||
|
|
||||||
if (Size > 16*1024*1024) Size = 16*1024*1024; // maximum 16 MB
|
if (Size > 16*1024*1024) Size = 16*1024*1024; // maximum 16 MB
|
||||||
@ -97,30 +92,24 @@ error:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void exitRAMDisc()
|
void exitRAMDisc() {
|
||||||
{
|
while (__ramdisk_data_start) {
|
||||||
while(__ramdisk_data_start)
|
|
||||||
{
|
|
||||||
padding *tmp = __ramdisk_data_start;
|
padding *tmp = __ramdisk_data_start;
|
||||||
__ramdisk_data_start = __ramdisk_data_start->next;
|
__ramdisk_data_start = __ramdisk_data_start->next;
|
||||||
delete tmp;
|
delete tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static u8 *__ramdisk_findSector(size_t Sector, size_t *Sectors)
|
static u8 *__ramdisk_findSector(size_t Sector, size_t *Sectors) {
|
||||||
{
|
|
||||||
if (__ramdisk_data_start==NULL) return NULL;
|
if (__ramdisk_data_start==NULL) return NULL;
|
||||||
for(padding *tmp = __ramdisk_data_start; tmp; tmp=tmp->next)
|
for (padding *tmp = __ramdisk_data_start; tmp; tmp=tmp->next) {
|
||||||
{
|
if (tmp->start <= Sector && tmp->end >= Sector) {
|
||||||
if(tmp->start <= Sector && tmp->end >= Sector)
|
|
||||||
{
|
|
||||||
if (Sectors) *Sectors = 1+tmp->end-Sector;
|
if (Sectors) *Sectors = 1+tmp->end-Sector;
|
||||||
return &(tmp->data[(Sector-tmp->start)*512]);
|
return &(tmp->data[(Sector-tmp->start)*512]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// not found -> add padding
|
// not found -> add padding
|
||||||
__ramdisk_data_end->next = new padding((Sector/__ramdisk_sectorsOfPadding)*__ramdisk_sectorsOfPadding, __ramdisk_sectorsOfPadding);
|
__ramdisk_data_end->next = new padding((Sector/__ramdisk_sectorsOfPadding)*__ramdisk_sectorsOfPadding, __ramdisk_sectorsOfPadding);
|
||||||
if(__ramdisk_data_end->next)
|
if (__ramdisk_data_end->next) {
|
||||||
{
|
|
||||||
__ramdisk_data_end = __ramdisk_data_end->next;
|
__ramdisk_data_end = __ramdisk_data_end->next;
|
||||||
return &( __ramdisk_data_end->data[(Sector-__ramdisk_data_end->start)*512]);
|
return &( __ramdisk_data_end->data[(Sector-__ramdisk_data_end->start)*512]);
|
||||||
}
|
}
|
||||||
@ -128,58 +117,45 @@ static u8 *__ramdisk_findSector(size_t Sector, size_t *Sectors)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool __ImplizitInit = false;
|
static bool __ImplizitInit = false;
|
||||||
static bool __ramdisk_Startup(void)
|
static bool __ramdisk_Startup(void) {
|
||||||
{
|
if (!__ramdisk_IsInserted()) {
|
||||||
if(!__ramdisk_IsInserted())
|
|
||||||
{
|
|
||||||
// Std=8MB/64kB Padding
|
// Std=8MB/64kB Padding
|
||||||
return (__ImplizitInit = initRAMDisc(8*1024*1024, 64 * 1024));
|
return (__ImplizitInit = initRAMDisc(8*1024*1024, 64 * 1024));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool __ramdisk_ReadSectors(size_t Sector, size_t numSectors, u8 *Buffer)
|
static bool __ramdisk_ReadSectors(size_t Sector, size_t numSectors, u8 *Buffer) {
|
||||||
{
|
|
||||||
size_t num_sectors;
|
size_t num_sectors;
|
||||||
while(numSectors)
|
while (numSectors) {
|
||||||
{
|
if (u8 *buff = __ramdisk_findSector(Sector,&num_sectors)) {
|
||||||
if(u8 *buff = __ramdisk_findSector(Sector,&num_sectors))
|
|
||||||
{
|
|
||||||
if (num_sectors > numSectors) num_sectors = numSectors;
|
if (num_sectors > numSectors) num_sectors = numSectors;
|
||||||
memcpy(Buffer, buff, num_sectors * 512);
|
memcpy(Buffer, buff, num_sectors * 512);
|
||||||
numSectors -= num_sectors;
|
numSectors -= num_sectors;
|
||||||
Buffer+= num_sectors;
|
Buffer+= num_sectors;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
static bool __ramdisk_WriteSectors(size_t Sector, size_t numSectors, u8 *Buffer)
|
static bool __ramdisk_WriteSectors(size_t Sector, size_t numSectors, u8 *Buffer) {
|
||||||
{
|
|
||||||
size_t num_sectors;
|
size_t num_sectors;
|
||||||
while(numSectors)
|
while (numSectors) {
|
||||||
{
|
if (u8 *buff = __ramdisk_findSector(Sector,&num_sectors)) {
|
||||||
if(u8 *buff = __ramdisk_findSector(Sector,&num_sectors))
|
|
||||||
{
|
|
||||||
if (num_sectors > numSectors) num_sectors = numSectors;
|
if (num_sectors > numSectors) num_sectors = numSectors;
|
||||||
memcpy(buff, Buffer, num_sectors * 512);
|
memcpy(buff, Buffer, num_sectors * 512);
|
||||||
numSectors -= num_sectors;
|
numSectors -= num_sectors;
|
||||||
Buffer+= num_sectors;
|
Buffer+= num_sectors;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
static bool __ramdisk_ClearStatus(void)
|
static bool __ramdisk_ClearStatus(void) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
static bool __ramdisk_Shutdown(void)
|
static bool __ramdisk_Shutdown(void) {
|
||||||
{
|
if (__ImplizitInit) {
|
||||||
if(__ImplizitInit)
|
|
||||||
{
|
|
||||||
__ImplizitInit = false;
|
__ImplizitInit = false;
|
||||||
exitRAMDisc();
|
exitRAMDisc();
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,7 @@ extern u8 reset;
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* MenuSettings
|
* MenuSettings
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int MenuSettings()
|
int MenuSettings() {
|
||||||
{
|
|
||||||
int menu = MENU_NONE;
|
int menu = MENU_NONE;
|
||||||
int ret;
|
int ret;
|
||||||
int choice = 0;
|
int choice = 0;
|
||||||
@ -243,14 +242,12 @@ int MenuSettings()
|
|||||||
GuiWindow w(screenwidth, screenheight);
|
GuiWindow w(screenwidth, screenheight);
|
||||||
|
|
||||||
int pageToDisplay = 1;
|
int pageToDisplay = 1;
|
||||||
while ( pageToDisplay > 0) //set pageToDisplay to 0 to quit
|
while ( pageToDisplay > 0) { //set pageToDisplay to 0 to quit
|
||||||
{
|
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
|
|
||||||
menu = MENU_NONE;
|
menu = MENU_NONE;
|
||||||
|
|
||||||
if ( pageToDisplay == 1)
|
if ( pageToDisplay == 1) {
|
||||||
{
|
|
||||||
/** Standard procedure made in all pages **/
|
/** Standard procedure made in all pages **/
|
||||||
MainButton1.StopEffect();
|
MainButton1.StopEffect();
|
||||||
MainButton2.StopEffect();
|
MainButton2.StopEffect();
|
||||||
@ -263,8 +260,7 @@ int MenuSettings()
|
|||||||
MainButton3.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 35);
|
MainButton3.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 35);
|
||||||
MainButton4.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 35);
|
MainButton4.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 35);
|
||||||
while (MainButton1.GetEffect()>0) usleep(50);
|
while (MainButton1.GetEffect()>0) usleep(50);
|
||||||
}
|
} else if (slidedirection == LEFT) {
|
||||||
else if(slidedirection == LEFT) {
|
|
||||||
MainButton1.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 35);
|
MainButton1.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 35);
|
||||||
MainButton2.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 35);
|
MainButton2.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 35);
|
||||||
MainButton3.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 35);
|
MainButton3.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 35);
|
||||||
@ -327,14 +323,12 @@ int MenuSettings()
|
|||||||
MainButton2.SetEffect(EFFECT_FADE, 20);
|
MainButton2.SetEffect(EFFECT_FADE, 20);
|
||||||
MainButton3.SetEffect(EFFECT_FADE, 20);
|
MainButton3.SetEffect(EFFECT_FADE, 20);
|
||||||
MainButton4.SetEffect(EFFECT_FADE, 20);
|
MainButton4.SetEffect(EFFECT_FADE, 20);
|
||||||
}
|
} else if (slidedirection == LEFT) {
|
||||||
else if(slidedirection == LEFT) {
|
|
||||||
MainButton1.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 35);
|
MainButton1.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 35);
|
||||||
MainButton2.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 35);
|
MainButton2.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 35);
|
||||||
MainButton3.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 35);
|
MainButton3.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 35);
|
||||||
MainButton4.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 35);
|
MainButton4.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 35);
|
||||||
}
|
} else if (slidedirection == RIGHT) {
|
||||||
else if(slidedirection == RIGHT) {
|
|
||||||
MainButton1.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN, 35);
|
MainButton1.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN, 35);
|
||||||
MainButton2.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN, 35);
|
MainButton2.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN, 35);
|
||||||
MainButton3.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN, 35);
|
MainButton3.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN, 35);
|
||||||
@ -347,9 +341,7 @@ int MenuSettings()
|
|||||||
|
|
||||||
while (MainButton1.GetEffect() > 0) usleep(50);
|
while (MainButton1.GetEffect() > 0) usleep(50);
|
||||||
|
|
||||||
}
|
} else if ( pageToDisplay == 2 ) {
|
||||||
else if ( pageToDisplay == 2 )
|
|
||||||
{
|
|
||||||
/** Standard procedure made in all pages **/
|
/** Standard procedure made in all pages **/
|
||||||
MainButton1.StopEffect();
|
MainButton1.StopEffect();
|
||||||
MainButton2.StopEffect();
|
MainButton2.StopEffect();
|
||||||
@ -362,8 +354,7 @@ int MenuSettings()
|
|||||||
MainButton3.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 35);
|
MainButton3.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 35);
|
||||||
MainButton4.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 35);
|
MainButton4.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 35);
|
||||||
while (MainButton1.GetEffect()>0) usleep(50);
|
while (MainButton1.GetEffect()>0) usleep(50);
|
||||||
}
|
} else if (slidedirection == LEFT) {
|
||||||
else if(slidedirection == LEFT) {
|
|
||||||
MainButton1.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 35);
|
MainButton1.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 35);
|
||||||
MainButton2.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 35);
|
MainButton2.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 35);
|
||||||
MainButton3.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 35);
|
MainButton3.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 35);
|
||||||
@ -426,14 +417,12 @@ int MenuSettings()
|
|||||||
MainButton2.SetEffect(EFFECT_FADE, 20);
|
MainButton2.SetEffect(EFFECT_FADE, 20);
|
||||||
MainButton3.SetEffect(EFFECT_FADE, 20);
|
MainButton3.SetEffect(EFFECT_FADE, 20);
|
||||||
MainButton4.SetEffect(EFFECT_FADE, 20);
|
MainButton4.SetEffect(EFFECT_FADE, 20);
|
||||||
}
|
} else if (slidedirection == LEFT) {
|
||||||
else if(slidedirection == LEFT) {
|
|
||||||
MainButton1.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 35);
|
MainButton1.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 35);
|
||||||
MainButton2.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 35);
|
MainButton2.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 35);
|
||||||
MainButton3.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 35);
|
MainButton3.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 35);
|
||||||
MainButton4.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 35);
|
MainButton4.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 35);
|
||||||
}
|
} else if (slidedirection == RIGHT) {
|
||||||
else if(slidedirection == RIGHT) {
|
|
||||||
MainButton1.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN, 35);
|
MainButton1.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN, 35);
|
||||||
MainButton2.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN, 35);
|
MainButton2.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN, 35);
|
||||||
MainButton3.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN, 35);
|
MainButton3.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN, 35);
|
||||||
@ -448,12 +437,10 @@ int MenuSettings()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while(menu == MENU_NONE)
|
while (menu == MENU_NONE) {
|
||||||
{
|
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
|
|
||||||
if ( pageToDisplay == 1 )
|
if ( pageToDisplay == 1 ) {
|
||||||
{
|
|
||||||
if (MainButton1.GetState() == STATE_CLICKED) {
|
if (MainButton1.GetState() == STATE_CLICKED) {
|
||||||
MainButton1.SetEffect(EFFECT_FADE, -20);
|
MainButton1.SetEffect(EFFECT_FADE, -20);
|
||||||
MainButton2.SetEffect(EFFECT_FADE, -20);
|
MainButton2.SetEffect(EFFECT_FADE, -20);
|
||||||
@ -498,8 +485,7 @@ int MenuSettings()
|
|||||||
char * languagefile;
|
char * languagefile;
|
||||||
languagefile = strrchr(Settings.language_path, '/')+1;
|
languagefile = strrchr(Settings.language_path, '/')+1;
|
||||||
|
|
||||||
while(!exit)
|
while (!exit) {
|
||||||
{
|
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
|
|
||||||
returnhere = 1;
|
returnhere = 1;
|
||||||
@ -577,8 +563,7 @@ int MenuSettings()
|
|||||||
else if (Settings.screensaver == 5) options2.SetValue(11,tr("30 min"));
|
else if (Settings.screensaver == 5) options2.SetValue(11,tr("30 min"));
|
||||||
else if (Settings.screensaver == 6) options2.SetValue(11,tr("1 hour"));
|
else if (Settings.screensaver == 6) options2.SetValue(11,tr("1 hour"));
|
||||||
|
|
||||||
if(backBtn.GetState() == STATE_CLICKED)
|
if (backBtn.GetState() == STATE_CLICKED) {
|
||||||
{
|
|
||||||
backBtn.ResetState();
|
backBtn.ResetState();
|
||||||
exit = true;
|
exit = true;
|
||||||
break;
|
break;
|
||||||
@ -595,16 +580,13 @@ int MenuSettings()
|
|||||||
WindowCredits();
|
WindowCredits();
|
||||||
w.Append(&optionBrowser2);
|
w.Append(&optionBrowser2);
|
||||||
w.Append(&backBtn);
|
w.Append(&backBtn);
|
||||||
}
|
} else if (homo.GetState() == STATE_CLICKED) {
|
||||||
else if(homo.GetState() == STATE_CLICKED)
|
|
||||||
{
|
|
||||||
cfg_save_global();
|
cfg_save_global();
|
||||||
optionBrowser2.SetState(STATE_DISABLED);
|
optionBrowser2.SetState(STATE_DISABLED);
|
||||||
s32 thetimeofbg = bgMusic->GetPlayTime();
|
s32 thetimeofbg = bgMusic->GetPlayTime();
|
||||||
bgMusic->Stop();
|
bgMusic->Stop();
|
||||||
choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0);
|
choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0);
|
||||||
if(!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path))
|
if (!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) {
|
||||||
{
|
|
||||||
bgMusic->Play();
|
bgMusic->Play();
|
||||||
} else {
|
} else {
|
||||||
bgMusic->PlayOggFile(Settings.ogg_path);
|
bgMusic->PlayOggFile(Settings.ogg_path);
|
||||||
@ -623,13 +605,11 @@ int MenuSettings()
|
|||||||
|
|
||||||
ret = optionBrowser2.GetClickedOption();
|
ret = optionBrowser2.GetClickedOption();
|
||||||
|
|
||||||
switch (ret)
|
switch (ret) {
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
//if(isSdInserted()) {
|
//if(isSdInserted()) {
|
||||||
if (isInserted(bootDevice)) {
|
if (isInserted(bootDevice)) {
|
||||||
if ( Settings.godmode == 1)
|
if ( Settings.godmode == 1) {
|
||||||
{
|
|
||||||
w.SetEffect(EFFECT_FADE, -20);
|
w.SetEffect(EFFECT_FADE, -20);
|
||||||
while (w.GetEffect()>0) usleep(50);
|
while (w.GetEffect()>0) usleep(50);
|
||||||
mainWindow->Remove(&w);
|
mainWindow->Remove(&w);
|
||||||
@ -738,8 +718,7 @@ int MenuSettings()
|
|||||||
optionBrowser2.SetEffect(EFFECT_FADE, 20);
|
optionBrowser2.SetEffect(EFFECT_FADE, 20);
|
||||||
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
||||||
|
|
||||||
while(!exit)
|
while (!exit) {
|
||||||
{
|
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
if (Settings.video >= settings_video_max)
|
if (Settings.video >= settings_video_max)
|
||||||
Settings.video = 0;
|
Settings.video = 0;
|
||||||
@ -797,8 +776,7 @@ int MenuSettings()
|
|||||||
else if (Settings.error002 == yes) options2.SetValue(7,"%s",tr("Yes"));
|
else if (Settings.error002 == yes) options2.SetValue(7,"%s",tr("Yes"));
|
||||||
else if (Settings.error002 == anti) options2.SetValue(7,"%s",tr("Anti"));
|
else if (Settings.error002 == anti) options2.SetValue(7,"%s",tr("Anti"));
|
||||||
|
|
||||||
if(backBtn.GetState() == STATE_CLICKED)
|
if (backBtn.GetState() == STATE_CLICKED) {
|
||||||
{
|
|
||||||
backBtn.ResetState();
|
backBtn.ResetState();
|
||||||
exit = true;
|
exit = true;
|
||||||
break;
|
break;
|
||||||
@ -809,15 +787,13 @@ int MenuSettings()
|
|||||||
else if (reset == 1)
|
else if (reset == 1)
|
||||||
Sys_Reboot();
|
Sys_Reboot();
|
||||||
|
|
||||||
else if(homo.GetState() == STATE_CLICKED)
|
else if (homo.GetState() == STATE_CLICKED) {
|
||||||
{
|
|
||||||
cfg_save_global();
|
cfg_save_global();
|
||||||
optionBrowser2.SetState(STATE_DISABLED);
|
optionBrowser2.SetState(STATE_DISABLED);
|
||||||
s32 thetimeofbg = bgMusic->GetPlayTime();
|
s32 thetimeofbg = bgMusic->GetPlayTime();
|
||||||
bgMusic->Stop();
|
bgMusic->Stop();
|
||||||
choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0);
|
choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0);
|
||||||
if(!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path))
|
if (!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) {
|
||||||
{
|
|
||||||
bgMusic->Play();
|
bgMusic->Play();
|
||||||
} else {
|
} else {
|
||||||
bgMusic->PlayOggFile(Settings.ogg_path);
|
bgMusic->PlayOggFile(Settings.ogg_path);
|
||||||
@ -836,8 +812,7 @@ int MenuSettings()
|
|||||||
|
|
||||||
ret = optionBrowser2.GetClickedOption();
|
ret = optionBrowser2.GetClickedOption();
|
||||||
|
|
||||||
switch (ret)
|
switch (ret) {
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
Settings.video++;
|
Settings.video++;
|
||||||
break;
|
break;
|
||||||
@ -905,8 +880,7 @@ int MenuSettings()
|
|||||||
optionBrowser2.SetEffect(EFFECT_FADE, 20);
|
optionBrowser2.SetEffect(EFFECT_FADE, 20);
|
||||||
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
||||||
|
|
||||||
while(!exit)
|
while (!exit) {
|
||||||
{
|
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
|
|
||||||
if (Settings.parentalcontrol > 4 )
|
if (Settings.parentalcontrol > 4 )
|
||||||
@ -926,8 +900,7 @@ int MenuSettings()
|
|||||||
else if (Settings.parentalcontrol == 3) options2.SetValue(2, tr("3 (Mature 16+)"));
|
else if (Settings.parentalcontrol == 3) options2.SetValue(2, tr("3 (Mature 16+)"));
|
||||||
else if (Settings.parentalcontrol == 4) options2.SetValue(2, tr("4 (Adults Only 18+)"));
|
else if (Settings.parentalcontrol == 4) options2.SetValue(2, tr("4 (Adults Only 18+)"));
|
||||||
|
|
||||||
if(backBtn.GetState() == STATE_CLICKED)
|
if (backBtn.GetState() == STATE_CLICKED) {
|
||||||
{
|
|
||||||
backBtn.ResetState();
|
backBtn.ResetState();
|
||||||
exit = true;
|
exit = true;
|
||||||
break;
|
break;
|
||||||
@ -938,15 +911,13 @@ int MenuSettings()
|
|||||||
else if (reset == 1)
|
else if (reset == 1)
|
||||||
Sys_Reboot();
|
Sys_Reboot();
|
||||||
|
|
||||||
else if(homo.GetState() == STATE_CLICKED)
|
else if (homo.GetState() == STATE_CLICKED) {
|
||||||
{
|
|
||||||
cfg_save_global();
|
cfg_save_global();
|
||||||
optionBrowser2.SetState(STATE_DISABLED);
|
optionBrowser2.SetState(STATE_DISABLED);
|
||||||
s32 thetimeofbg = bgMusic->GetPlayTime();
|
s32 thetimeofbg = bgMusic->GetPlayTime();
|
||||||
bgMusic->Stop();
|
bgMusic->Stop();
|
||||||
choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0);
|
choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0);
|
||||||
if(!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path))
|
if (!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) {
|
||||||
{
|
|
||||||
bgMusic->Play();
|
bgMusic->Play();
|
||||||
} else {
|
} else {
|
||||||
bgMusic->PlayOggFile(Settings.ogg_path);
|
bgMusic->PlayOggFile(Settings.ogg_path);
|
||||||
@ -965,15 +936,12 @@ int MenuSettings()
|
|||||||
|
|
||||||
ret = optionBrowser2.GetClickedOption();
|
ret = optionBrowser2.GetClickedOption();
|
||||||
|
|
||||||
switch (ret)
|
switch (ret) {
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
if (!strcmp("", Settings.unlockCode))
|
if (!strcmp("", Settings.unlockCode)) {
|
||||||
{
|
|
||||||
Settings.godmode = !Settings.godmode;
|
Settings.godmode = !Settings.godmode;
|
||||||
break;
|
break;
|
||||||
}
|
} else if ( Settings.godmode == 0 ) {
|
||||||
else if ( Settings.godmode == 0 ) {
|
|
||||||
//password check to unlock Install,Delete and Format
|
//password check to unlock Install,Delete and Format
|
||||||
w.Remove(&optionBrowser2);
|
w.Remove(&optionBrowser2);
|
||||||
w.Remove(&backBtn);
|
w.Remove(&backBtn);
|
||||||
@ -982,8 +950,7 @@ int MenuSettings()
|
|||||||
w.Append(&optionBrowser2);
|
w.Append(&optionBrowser2);
|
||||||
w.Append(&backBtn);
|
w.Append(&backBtn);
|
||||||
if ( result == 1 ) {
|
if ( result == 1 ) {
|
||||||
if (!strcmp(entered, Settings.unlockCode)) //if password correct
|
if (!strcmp(entered, Settings.unlockCode)) { //if password correct
|
||||||
{
|
|
||||||
if (Settings.godmode == 0) {
|
if (Settings.godmode == 0) {
|
||||||
WindowPrompt(tr("Correct Password"),tr("All the features of USB Loader GX are unlocked."),tr("OK"));
|
WindowPrompt(tr("Correct Password"),tr("All the features of USB Loader GX are unlocked."),tr("OK"));
|
||||||
Settings.godmode = 1;
|
Settings.godmode = 1;
|
||||||
@ -1005,8 +972,7 @@ int MenuSettings()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:// Modify Password
|
case 1:// Modify Password
|
||||||
if ( Settings.godmode == 1)
|
if ( Settings.godmode == 1) {
|
||||||
{
|
|
||||||
w.Remove(&optionBrowser2);
|
w.Remove(&optionBrowser2);
|
||||||
w.Remove(&backBtn);
|
w.Remove(&backBtn);
|
||||||
char entered[20] = "";
|
char entered[20] = "";
|
||||||
@ -1070,8 +1036,7 @@ int MenuSettings()
|
|||||||
|
|
||||||
char * oggfile;
|
char * oggfile;
|
||||||
|
|
||||||
while(!exit)
|
while (!exit) {
|
||||||
{
|
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
|
|
||||||
bool returnhere = true;
|
bool returnhere = true;
|
||||||
@ -1092,8 +1057,7 @@ int MenuSettings()
|
|||||||
else
|
else
|
||||||
options2.SetValue(2,"%s", tr("OFF"));
|
options2.SetValue(2,"%s", tr("OFF"));
|
||||||
|
|
||||||
if(backBtn.GetState() == STATE_CLICKED)
|
if (backBtn.GetState() == STATE_CLICKED) {
|
||||||
{
|
|
||||||
backBtn.ResetState();
|
backBtn.ResetState();
|
||||||
exit = true;
|
exit = true;
|
||||||
break;
|
break;
|
||||||
@ -1104,15 +1068,13 @@ int MenuSettings()
|
|||||||
else if (reset == 1)
|
else if (reset == 1)
|
||||||
Sys_Reboot();
|
Sys_Reboot();
|
||||||
|
|
||||||
else if(homo.GetState() == STATE_CLICKED)
|
else if (homo.GetState() == STATE_CLICKED) {
|
||||||
{
|
|
||||||
cfg_save_global();
|
cfg_save_global();
|
||||||
optionBrowser2.SetState(STATE_DISABLED);
|
optionBrowser2.SetState(STATE_DISABLED);
|
||||||
s32 thetimeofbg = bgMusic->GetPlayTime();
|
s32 thetimeofbg = bgMusic->GetPlayTime();
|
||||||
bgMusic->Stop();
|
bgMusic->Stop();
|
||||||
choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0);
|
choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0);
|
||||||
if(!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path))
|
if (!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) {
|
||||||
{
|
|
||||||
bgMusic->Play();
|
bgMusic->Play();
|
||||||
} else {
|
} else {
|
||||||
bgMusic->PlayOggFile(Settings.ogg_path);
|
bgMusic->PlayOggFile(Settings.ogg_path);
|
||||||
@ -1131,12 +1093,10 @@ int MenuSettings()
|
|||||||
|
|
||||||
ret = optionBrowser2.GetClickedOption();
|
ret = optionBrowser2.GetClickedOption();
|
||||||
|
|
||||||
switch (ret)
|
switch (ret) {
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
//if(isSdInserted())
|
//if(isSdInserted())
|
||||||
if(isInserted(bootDevice))
|
if (isInserted(bootDevice)) {
|
||||||
{
|
|
||||||
w.SetEffect(EFFECT_FADE, -20);
|
w.SetEffect(EFFECT_FADE, -20);
|
||||||
while (w.GetEffect()>0) usleep(50);
|
while (w.GetEffect()>0) usleep(50);
|
||||||
mainWindow->Remove(&w);
|
mainWindow->Remove(&w);
|
||||||
@ -1147,8 +1107,7 @@ int MenuSettings()
|
|||||||
w.SetEffect(EFFECT_FADE, 20);
|
w.SetEffect(EFFECT_FADE, 20);
|
||||||
ResumeGui();
|
ResumeGui();
|
||||||
while (w.GetEffect()>0) usleep(50);
|
while (w.GetEffect()>0) usleep(50);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to use this option."), tr("OK"));
|
WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to use this option."), tr("OK"));
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
@ -1177,8 +1136,7 @@ int MenuSettings()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pageToDisplay == 2)
|
if ( pageToDisplay == 2) {
|
||||||
{
|
|
||||||
if (MainButton1.GetState() == STATE_CLICKED) {
|
if (MainButton1.GetState() == STATE_CLICKED) {
|
||||||
MainButton1.SetEffect(EFFECT_FADE, -20);
|
MainButton1.SetEffect(EFFECT_FADE, -20);
|
||||||
MainButton2.SetEffect(EFFECT_FADE, -20);
|
MainButton2.SetEffect(EFFECT_FADE, -20);
|
||||||
@ -1218,8 +1176,7 @@ int MenuSettings()
|
|||||||
|
|
||||||
if (Settings.godmode) {
|
if (Settings.godmode) {
|
||||||
|
|
||||||
while(!exit)
|
while (!exit) {
|
||||||
{
|
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
|
|
||||||
options2.SetValue(0, "%s", Settings.covers_path);
|
options2.SetValue(0, "%s", Settings.covers_path);
|
||||||
@ -1232,8 +1189,7 @@ int MenuSettings()
|
|||||||
options2.SetValue(7, "%s", Settings.dolpath);
|
options2.SetValue(7, "%s", Settings.dolpath);
|
||||||
options2.SetValue(8, "%s", Settings.homebrewapps_path);
|
options2.SetValue(8, "%s", Settings.homebrewapps_path);
|
||||||
|
|
||||||
if(backBtn.GetState() == STATE_CLICKED)
|
if (backBtn.GetState() == STATE_CLICKED) {
|
||||||
{
|
|
||||||
backBtn.ResetState();
|
backBtn.ResetState();
|
||||||
exit = true;
|
exit = true;
|
||||||
break;
|
break;
|
||||||
@ -1244,15 +1200,13 @@ int MenuSettings()
|
|||||||
else if (reset == 1)
|
else if (reset == 1)
|
||||||
Sys_Reboot();
|
Sys_Reboot();
|
||||||
|
|
||||||
else if(homo.GetState() == STATE_CLICKED)
|
else if (homo.GetState() == STATE_CLICKED) {
|
||||||
{
|
|
||||||
cfg_save_global();
|
cfg_save_global();
|
||||||
optionBrowser2.SetState(STATE_DISABLED);
|
optionBrowser2.SetState(STATE_DISABLED);
|
||||||
s32 thetimeofbg = bgMusic->GetPlayTime();
|
s32 thetimeofbg = bgMusic->GetPlayTime();
|
||||||
bgMusic->Stop();
|
bgMusic->Stop();
|
||||||
choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0);
|
choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0);
|
||||||
if(!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path))
|
if (!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) {
|
||||||
{
|
|
||||||
bgMusic->Play();
|
bgMusic->Play();
|
||||||
} else {
|
} else {
|
||||||
bgMusic->PlayOggFile(Settings.ogg_path);
|
bgMusic->PlayOggFile(Settings.ogg_path);
|
||||||
@ -1271,11 +1225,9 @@ int MenuSettings()
|
|||||||
|
|
||||||
ret = optionBrowser2.GetClickedOption();
|
ret = optionBrowser2.GetClickedOption();
|
||||||
|
|
||||||
switch (ret)
|
switch (ret) {
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
if ( Settings.godmode == 1)
|
if ( Settings.godmode == 1) {
|
||||||
{
|
|
||||||
w.Remove(&optionBrowser2);
|
w.Remove(&optionBrowser2);
|
||||||
w.Remove(&backBtn);
|
w.Remove(&backBtn);
|
||||||
char entered[43] = "";
|
char entered[43] = "";
|
||||||
@ -1286,8 +1238,7 @@ int MenuSettings()
|
|||||||
titleTxt.SetText(tr("Custom Paths"));
|
titleTxt.SetText(tr("Custom Paths"));
|
||||||
w.Append(&optionBrowser2);
|
w.Append(&optionBrowser2);
|
||||||
w.Append(&backBtn);
|
w.Append(&backBtn);
|
||||||
if ( result == 1 )
|
if ( result == 1 ) {
|
||||||
{
|
|
||||||
int len = (strlen(entered)-1);
|
int len = (strlen(entered)-1);
|
||||||
if (entered[len] !='/')
|
if (entered[len] !='/')
|
||||||
strncat (entered, "/", 1);
|
strncat (entered, "/", 1);
|
||||||
@ -1303,8 +1254,7 @@ int MenuSettings()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if ( Settings.godmode == 1)
|
if ( Settings.godmode == 1) {
|
||||||
{
|
|
||||||
w.Remove(&optionBrowser2);
|
w.Remove(&optionBrowser2);
|
||||||
w.Remove(&backBtn);
|
w.Remove(&backBtn);
|
||||||
char entered[43] = "";
|
char entered[43] = "";
|
||||||
@ -1315,8 +1265,7 @@ int MenuSettings()
|
|||||||
titleTxt.SetText(tr("Custom Paths"));
|
titleTxt.SetText(tr("Custom Paths"));
|
||||||
w.Append(&optionBrowser2);
|
w.Append(&optionBrowser2);
|
||||||
w.Append(&backBtn);
|
w.Append(&backBtn);
|
||||||
if ( result == 1 )
|
if ( result == 1 ) {
|
||||||
{
|
|
||||||
int len = (strlen(entered)-1);
|
int len = (strlen(entered)-1);
|
||||||
if (entered[len] !='/')
|
if (entered[len] !='/')
|
||||||
strncat (entered, "/", 1);
|
strncat (entered, "/", 1);
|
||||||
@ -1332,8 +1281,7 @@ int MenuSettings()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if ( Settings.godmode == 1)
|
if ( Settings.godmode == 1) {
|
||||||
{
|
|
||||||
w.Remove(&optionBrowser2);
|
w.Remove(&optionBrowser2);
|
||||||
w.Remove(&backBtn);
|
w.Remove(&backBtn);
|
||||||
char entered[43] = "";
|
char entered[43] = "";
|
||||||
@ -1343,8 +1291,7 @@ int MenuSettings()
|
|||||||
//int result = OnScreenKeyboard(entered, 43,0);
|
//int result = OnScreenKeyboard(entered, 43,0);
|
||||||
HaltGui();
|
HaltGui();
|
||||||
w.RemoveAll();
|
w.RemoveAll();
|
||||||
if ( result == 1 )
|
if ( result == 1 ) {
|
||||||
{
|
|
||||||
int len = (strlen(entered)-1);
|
int len = (strlen(entered)-1);
|
||||||
if (entered[len] !='/')
|
if (entered[len] !='/')
|
||||||
strncat (entered, "/", 1);
|
strncat (entered, "/", 1);
|
||||||
@ -1392,8 +1339,7 @@ int MenuSettings()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if ( Settings.godmode == 1)
|
if ( Settings.godmode == 1) {
|
||||||
{
|
|
||||||
w.Remove(&optionBrowser2);
|
w.Remove(&optionBrowser2);
|
||||||
w.Remove(&backBtn);
|
w.Remove(&backBtn);
|
||||||
char entered[43] = "";
|
char entered[43] = "";
|
||||||
@ -1404,8 +1350,7 @@ int MenuSettings()
|
|||||||
w.Append(&optionBrowser2);
|
w.Append(&optionBrowser2);
|
||||||
titleTxt.SetText(tr("Custom Paths"));
|
titleTxt.SetText(tr("Custom Paths"));
|
||||||
w.Append(&backBtn);
|
w.Append(&backBtn);
|
||||||
if ( result == 1 )
|
if ( result == 1 ) {
|
||||||
{
|
|
||||||
int len = (strlen(entered)-1);
|
int len = (strlen(entered)-1);
|
||||||
if (entered[len] !='/')
|
if (entered[len] !='/')
|
||||||
strncat (entered, "/", 1);
|
strncat (entered, "/", 1);
|
||||||
@ -1419,15 +1364,12 @@ int MenuSettings()
|
|||||||
WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to save."), tr("OK"));
|
WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to save."), tr("OK"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
WindowPrompt(tr("XMLPath change"),tr("Console should be unlocked to modify it."),tr("OK"));
|
WindowPrompt(tr("XMLPath change"),tr("Console should be unlocked to modify it."),tr("OK"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
if ( Settings.godmode == 1)
|
if ( Settings.godmode == 1) {
|
||||||
{
|
|
||||||
w.Remove(&optionBrowser2);
|
w.Remove(&optionBrowser2);
|
||||||
w.Remove(&backBtn);
|
w.Remove(&backBtn);
|
||||||
char entered[43] = "";
|
char entered[43] = "";
|
||||||
@ -1438,21 +1380,18 @@ int MenuSettings()
|
|||||||
titleTxt.SetText(tr("Custom Paths"));
|
titleTxt.SetText(tr("Custom Paths"));
|
||||||
w.Append(&optionBrowser2);
|
w.Append(&optionBrowser2);
|
||||||
w.Append(&backBtn);
|
w.Append(&backBtn);
|
||||||
if ( result == 1 )
|
if ( result == 1 ) {
|
||||||
{
|
|
||||||
int len = (strlen(entered)-1);
|
int len = (strlen(entered)-1);
|
||||||
if (entered[len] !='/')
|
if (entered[len] !='/')
|
||||||
strncat (entered, "/", 1);
|
strncat (entered, "/", 1);
|
||||||
strncpy(Settings.update_path, entered, sizeof(Settings.update_path));
|
strncpy(Settings.update_path, entered, sizeof(Settings.update_path));
|
||||||
WindowPrompt(tr("Updatepath changed."),0,tr("OK"));
|
WindowPrompt(tr("Updatepath changed."),0,tr("OK"));
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
WindowPrompt(0,tr("Console should be unlocked to modify it."),tr("OK"));
|
WindowPrompt(0,tr("Console should be unlocked to modify it."),tr("OK"));
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
if ( Settings.godmode == 1)
|
if ( Settings.godmode == 1) {
|
||||||
{
|
|
||||||
w.Remove(&optionBrowser2);
|
w.Remove(&optionBrowser2);
|
||||||
w.Remove(&backBtn);
|
w.Remove(&backBtn);
|
||||||
char entered[43] = "";
|
char entered[43] = "";
|
||||||
@ -1463,21 +1402,18 @@ int MenuSettings()
|
|||||||
titleTxt.SetText(tr("Custom Paths"));
|
titleTxt.SetText(tr("Custom Paths"));
|
||||||
w.Append(&optionBrowser2);
|
w.Append(&optionBrowser2);
|
||||||
w.Append(&backBtn);
|
w.Append(&backBtn);
|
||||||
if ( result == 1 )
|
if ( result == 1 ) {
|
||||||
{
|
|
||||||
int len = (strlen(entered)-1);
|
int len = (strlen(entered)-1);
|
||||||
if (entered[len] !='/')
|
if (entered[len] !='/')
|
||||||
strncat (entered, "/", 1);
|
strncat (entered, "/", 1);
|
||||||
strncpy(Settings.Cheatcodespath, entered, sizeof(Settings.Cheatcodespath));
|
strncpy(Settings.Cheatcodespath, entered, sizeof(Settings.Cheatcodespath));
|
||||||
WindowPrompt(tr("Cheatcodes Path changed"),0,tr("OK"));
|
WindowPrompt(tr("Cheatcodes Path changed"),0,tr("OK"));
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
WindowPrompt(0,tr("Console should be unlocked to modify it."),tr("OK"));
|
WindowPrompt(0,tr("Console should be unlocked to modify it."),tr("OK"));
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
if ( Settings.godmode == 1)
|
if ( Settings.godmode == 1) {
|
||||||
{
|
|
||||||
w.Remove(&optionBrowser2);
|
w.Remove(&optionBrowser2);
|
||||||
w.Remove(&backBtn);
|
w.Remove(&backBtn);
|
||||||
char entered[43] = "";
|
char entered[43] = "";
|
||||||
@ -1488,21 +1424,18 @@ int MenuSettings()
|
|||||||
titleTxt.SetText(tr("Custom Paths"));
|
titleTxt.SetText(tr("Custom Paths"));
|
||||||
w.Append(&optionBrowser2);
|
w.Append(&optionBrowser2);
|
||||||
w.Append(&backBtn);
|
w.Append(&backBtn);
|
||||||
if ( result == 1 )
|
if ( result == 1 ) {
|
||||||
{
|
|
||||||
int len = (strlen(entered)-1);
|
int len = (strlen(entered)-1);
|
||||||
if (entered[len] !='/')
|
if (entered[len] !='/')
|
||||||
strncat (entered, "/", 1);
|
strncat (entered, "/", 1);
|
||||||
strncpy(Settings.TxtCheatcodespath, entered, sizeof(Settings.TxtCheatcodespath));
|
strncpy(Settings.TxtCheatcodespath, entered, sizeof(Settings.TxtCheatcodespath));
|
||||||
WindowPrompt(tr("TXTCheatcodes Path changed"),0,tr("OK"));
|
WindowPrompt(tr("TXTCheatcodes Path changed"),0,tr("OK"));
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
WindowPrompt(0,tr("Console should be unlocked to modify it."),tr("OK"));
|
WindowPrompt(0,tr("Console should be unlocked to modify it."),tr("OK"));
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
if ( Settings.godmode == 1)
|
if ( Settings.godmode == 1) {
|
||||||
{
|
|
||||||
w.Remove(&optionBrowser2);
|
w.Remove(&optionBrowser2);
|
||||||
w.Remove(&backBtn);
|
w.Remove(&backBtn);
|
||||||
char entered[43] = "";
|
char entered[43] = "";
|
||||||
@ -1513,8 +1446,7 @@ int MenuSettings()
|
|||||||
titleTxt.SetText(tr("Custom Paths"));
|
titleTxt.SetText(tr("Custom Paths"));
|
||||||
w.Append(&optionBrowser2);
|
w.Append(&optionBrowser2);
|
||||||
w.Append(&backBtn);
|
w.Append(&backBtn);
|
||||||
if ( result == 1 )
|
if ( result == 1 ) {
|
||||||
{
|
|
||||||
int len = (strlen(entered)-1);
|
int len = (strlen(entered)-1);
|
||||||
if (entered[len] !='/')
|
if (entered[len] !='/')
|
||||||
strncat (entered, "/", 1);
|
strncat (entered, "/", 1);
|
||||||
@ -1530,8 +1462,7 @@ int MenuSettings()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
if ( Settings.godmode == 1)
|
if ( Settings.godmode == 1) {
|
||||||
{
|
|
||||||
w.Remove(&optionBrowser2);
|
w.Remove(&optionBrowser2);
|
||||||
w.Remove(&backBtn);
|
w.Remove(&backBtn);
|
||||||
char entered[43] = "";
|
char entered[43] = "";
|
||||||
@ -1542,8 +1473,7 @@ int MenuSettings()
|
|||||||
titleTxt.SetText(tr("Custom Paths"));
|
titleTxt.SetText(tr("Custom Paths"));
|
||||||
w.Append(&optionBrowser2);
|
w.Append(&optionBrowser2);
|
||||||
w.Append(&backBtn);
|
w.Append(&backBtn);
|
||||||
if ( result == 1 )
|
if ( result == 1 ) {
|
||||||
{
|
|
||||||
int len = (strlen(entered)-1);
|
int len = (strlen(entered)-1);
|
||||||
if (entered[len] !='/')
|
if (entered[len] !='/')
|
||||||
strncat (entered, "/", 1);
|
strncat (entered, "/", 1);
|
||||||
@ -1627,8 +1557,7 @@ int MenuSettings()
|
|||||||
int choice = WindowPrompt(tr("Are you sure?"), 0, tr("Yes"), tr("Cancel"));
|
int choice = WindowPrompt(tr("Are you sure?"), 0, tr("Yes"), tr("Cancel"));
|
||||||
if (choice == 1) {
|
if (choice == 1) {
|
||||||
// if(isSdInserted())
|
// if(isSdInserted())
|
||||||
if(isInserted(bootDevice))
|
if (isInserted(bootDevice)) {
|
||||||
{
|
|
||||||
char GXGlobal_cfg[26];
|
char GXGlobal_cfg[26];
|
||||||
sprintf(GXGlobal_cfg, "%s/config/GXGlobal.cfg", bootDevice);
|
sprintf(GXGlobal_cfg, "%s/config/GXGlobal.cfg", bootDevice);
|
||||||
remove(GXGlobal_cfg);
|
remove(GXGlobal_cfg);
|
||||||
@ -1677,8 +1606,7 @@ int MenuSettings()
|
|||||||
if (reset == 1)
|
if (reset == 1)
|
||||||
Sys_Reboot();
|
Sys_Reboot();
|
||||||
|
|
||||||
if(backBtn.GetState() == STATE_CLICKED)
|
if (backBtn.GetState() == STATE_CLICKED) {
|
||||||
{
|
|
||||||
//Add the procedure call to save the global configuration
|
//Add the procedure call to save the global configuration
|
||||||
// if(isSdInserted()) {
|
// if(isSdInserted()) {
|
||||||
if (isInserted(bootDevice)) {
|
if (isInserted(bootDevice)) {
|
||||||
@ -1689,8 +1617,7 @@ int MenuSettings()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(GoLeftBtn.GetState() == STATE_CLICKED)
|
if (GoLeftBtn.GetState() == STATE_CLICKED) {
|
||||||
{
|
|
||||||
pageToDisplay--;
|
pageToDisplay--;
|
||||||
/** Change direction of the flying buttons **/
|
/** Change direction of the flying buttons **/
|
||||||
if (pageToDisplay < 1)
|
if (pageToDisplay < 1)
|
||||||
@ -1700,8 +1627,7 @@ int MenuSettings()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(GoRightBtn.GetState() == STATE_CLICKED)
|
if (GoRightBtn.GetState() == STATE_CLICKED) {
|
||||||
{
|
|
||||||
pageToDisplay++;
|
pageToDisplay++;
|
||||||
/** Change direction of the flying buttons **/
|
/** Change direction of the flying buttons **/
|
||||||
if (pageToDisplay > 2)
|
if (pageToDisplay > 2)
|
||||||
@ -1711,8 +1637,7 @@ int MenuSettings()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(PageIndicatorBtn1.GetState() == STATE_CLICKED)
|
if (PageIndicatorBtn1.GetState() == STATE_CLICKED) {
|
||||||
{
|
|
||||||
if (pageToDisplay == 2) {
|
if (pageToDisplay == 2) {
|
||||||
slidedirection = LEFT;
|
slidedirection = LEFT;
|
||||||
pageToDisplay = 1;
|
pageToDisplay = 1;
|
||||||
@ -1720,9 +1645,7 @@ int MenuSettings()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
PageIndicatorBtn1.ResetState();
|
PageIndicatorBtn1.ResetState();
|
||||||
}
|
} else if (PageIndicatorBtn2.GetState() == STATE_CLICKED) {
|
||||||
else if(PageIndicatorBtn2.GetState() == STATE_CLICKED)
|
|
||||||
{
|
|
||||||
if (pageToDisplay == 1) {
|
if (pageToDisplay == 1) {
|
||||||
slidedirection = RIGHT;
|
slidedirection = RIGHT;
|
||||||
pageToDisplay = 2;
|
pageToDisplay = 2;
|
||||||
@ -1732,15 +1655,13 @@ int MenuSettings()
|
|||||||
PageIndicatorBtn2.ResetState();
|
PageIndicatorBtn2.ResetState();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(homo.GetState() == STATE_CLICKED)
|
if (homo.GetState() == STATE_CLICKED) {
|
||||||
{
|
|
||||||
cfg_save_global();
|
cfg_save_global();
|
||||||
optionBrowser2.SetState(STATE_DISABLED);
|
optionBrowser2.SetState(STATE_DISABLED);
|
||||||
s32 thetimeofbg = bgMusic->GetPlayTime();
|
s32 thetimeofbg = bgMusic->GetPlayTime();
|
||||||
bgMusic->Stop();
|
bgMusic->Stop();
|
||||||
choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0);
|
choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0);
|
||||||
if(!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path))
|
if (!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) {
|
||||||
{
|
|
||||||
bgMusic->Play();
|
bgMusic->Play();
|
||||||
} else {
|
} else {
|
||||||
bgMusic->PlayOggFile(Settings.ogg_path);
|
bgMusic->PlayOggFile(Settings.ogg_path);
|
||||||
@ -1748,8 +1669,7 @@ int MenuSettings()
|
|||||||
bgMusic->SetPlayTime(thetimeofbg);
|
bgMusic->SetPlayTime(thetimeofbg);
|
||||||
SetVolumeOgg(255*(Settings.volume/100.0));
|
SetVolumeOgg(255*(Settings.volume/100.0));
|
||||||
|
|
||||||
if(choice == 3)
|
if (choice == 3) {
|
||||||
{
|
|
||||||
Sys_LoadMenu(); // Back to System Menu
|
Sys_LoadMenu(); // Back to System Menu
|
||||||
} else if (choice == 2) {
|
} else if (choice == 2) {
|
||||||
Sys_BackToLoader();
|
Sys_BackToLoader();
|
||||||
@ -1786,8 +1706,7 @@ int MenuSettings()
|
|||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
*Game specific settings
|
*Game specific settings
|
||||||
*********************************************************************************/
|
*********************************************************************************/
|
||||||
int GameSettings(struct discHdr * header)
|
int GameSettings(struct discHdr * header) {
|
||||||
{
|
|
||||||
int menu = MENU_NONE;
|
int menu = MENU_NONE;
|
||||||
int ret;
|
int ret;
|
||||||
int choice = 0;
|
int choice = 0;
|
||||||
@ -1826,8 +1745,7 @@ int GameSettings(struct discHdr * header)
|
|||||||
|
|
||||||
if (strlen(get_title(header)) < (27 + 3)) {
|
if (strlen(get_title(header)) < (27 + 3)) {
|
||||||
sprintf(gameName, "%s", get_title(header));
|
sprintf(gameName, "%s", get_title(header));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
strncpy(gameName, get_title(header), 27);
|
strncpy(gameName, get_title(header), 27);
|
||||||
gameName[27] = '\0';
|
gameName[27] = '\0';
|
||||||
strncat(gameName, "...", 3);
|
strncat(gameName, "...", 3);
|
||||||
@ -1862,7 +1780,8 @@ int GameSettings(struct discHdr * header)
|
|||||||
GuiImage saveBtnImg(&btnOutline);
|
GuiImage saveBtnImg(&btnOutline);
|
||||||
if (Settings.wsprompt == yes) {
|
if (Settings.wsprompt == yes) {
|
||||||
saveBtnTxt.SetWidescreen(CFG.widescreen);
|
saveBtnTxt.SetWidescreen(CFG.widescreen);
|
||||||
saveBtnImg.SetWidescreen(CFG.widescreen);}
|
saveBtnImg.SetWidescreen(CFG.widescreen);
|
||||||
|
}
|
||||||
GuiButton saveBtn(&saveBtnImg,&saveBtnImg, 2, 3, 180, 400, &trigA, &btnSoundOver, &btnClick,1);
|
GuiButton saveBtn(&saveBtnImg,&saveBtnImg, 2, 3, 180, 400, &trigA, &btnSoundOver, &btnClick,1);
|
||||||
saveBtn.SetLabel(&saveBtnTxt);
|
saveBtn.SetLabel(&saveBtnTxt);
|
||||||
|
|
||||||
@ -1941,8 +1860,7 @@ int GameSettings(struct discHdr * header)
|
|||||||
struct Game_CFG* game_cfg = CFG_get_game_opt(header->id);
|
struct Game_CFG* game_cfg = CFG_get_game_opt(header->id);
|
||||||
|
|
||||||
int pageToDisplay = 1;
|
int pageToDisplay = 1;
|
||||||
while ( pageToDisplay > 0) //set pageToDisplay to 0 to quit
|
while ( pageToDisplay > 0) { //set pageToDisplay to 0 to quit
|
||||||
{
|
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
|
|
||||||
menu = MENU_NONE;
|
menu = MENU_NONE;
|
||||||
@ -2003,8 +1921,7 @@ int GameSettings(struct discHdr * header)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (game_cfg)//if there are saved settings for this game use them
|
if (game_cfg) { //if there are saved settings for this game use them
|
||||||
{
|
|
||||||
videoChoice = game_cfg->video;
|
videoChoice = game_cfg->video;
|
||||||
languageChoice = game_cfg->language;
|
languageChoice = game_cfg->language;
|
||||||
ocarinaChoice = game_cfg->ocarina;
|
ocarinaChoice = game_cfg->ocarina;
|
||||||
@ -2017,9 +1934,7 @@ int GameSettings(struct discHdr * header)
|
|||||||
alternatedoloffset = game_cfg->alternatedolstart;
|
alternatedoloffset = game_cfg->alternatedolstart;
|
||||||
reloadblock = game_cfg->iosreloadblock;
|
reloadblock = game_cfg->iosreloadblock;
|
||||||
strncpy(alternatedname, game_cfg->alternatedolname, sizeof(alternatedname));
|
strncpy(alternatedname, game_cfg->alternatedolname, sizeof(alternatedname));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
videoChoice = Settings.video;
|
videoChoice = Settings.video;
|
||||||
languageChoice = Settings.language;
|
languageChoice = Settings.language;
|
||||||
ocarinaChoice = Settings.ocarina;
|
ocarinaChoice = Settings.ocarina;
|
||||||
@ -2046,8 +1961,7 @@ int GameSettings(struct discHdr * header)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
while(menu == MENU_NONE)
|
while (menu == MENU_NONE) {
|
||||||
{
|
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
|
|
||||||
if (MainButton1.GetState() == STATE_CLICKED) {
|
if (MainButton1.GetState() == STATE_CLICKED) {
|
||||||
@ -2090,8 +2004,7 @@ int GameSettings(struct discHdr * header)
|
|||||||
char * languagefile;
|
char * languagefile;
|
||||||
languagefile = strrchr(Settings.language_path, '/')+1;
|
languagefile = strrchr(Settings.language_path, '/')+1;
|
||||||
|
|
||||||
while(!exit)
|
while (!exit) {
|
||||||
{
|
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
|
|
||||||
returnhere = 1;
|
returnhere = 1;
|
||||||
@ -2174,8 +2087,7 @@ int GameSettings(struct discHdr * header)
|
|||||||
if (reloadblock == on) options2.SetValue(10,tr("ON"));
|
if (reloadblock == on) options2.SetValue(10,tr("ON"));
|
||||||
else if (reloadblock == off) options2.SetValue(10,tr("OFF"));
|
else if (reloadblock == off) options2.SetValue(10,tr("OFF"));
|
||||||
|
|
||||||
if(backBtn.GetState() == STATE_CLICKED)
|
if (backBtn.GetState() == STATE_CLICKED) {
|
||||||
{
|
|
||||||
backBtn.ResetState();
|
backBtn.ResetState();
|
||||||
exit = true;
|
exit = true;
|
||||||
break;
|
break;
|
||||||
@ -2192,16 +2104,13 @@ int GameSettings(struct discHdr * header)
|
|||||||
WindowCredits();
|
WindowCredits();
|
||||||
w.Append(&optionBrowser2);
|
w.Append(&optionBrowser2);
|
||||||
w.Append(&backBtn);
|
w.Append(&backBtn);
|
||||||
}
|
} else if (homo.GetState() == STATE_CLICKED) {
|
||||||
else if(homo.GetState() == STATE_CLICKED)
|
|
||||||
{
|
|
||||||
cfg_save_global();
|
cfg_save_global();
|
||||||
optionBrowser2.SetState(STATE_DISABLED);
|
optionBrowser2.SetState(STATE_DISABLED);
|
||||||
s32 thetimeofbg = bgMusic->GetPlayTime();
|
s32 thetimeofbg = bgMusic->GetPlayTime();
|
||||||
bgMusic->Stop();
|
bgMusic->Stop();
|
||||||
choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0);
|
choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0);
|
||||||
if(!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path))
|
if (!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) {
|
||||||
{
|
|
||||||
bgMusic->Play();
|
bgMusic->Play();
|
||||||
} else {
|
} else {
|
||||||
bgMusic->PlayOggFile(Settings.ogg_path);
|
bgMusic->PlayOggFile(Settings.ogg_path);
|
||||||
@ -2220,8 +2129,7 @@ int GameSettings(struct discHdr * header)
|
|||||||
|
|
||||||
ret = optionBrowser2.GetClickedOption();
|
ret = optionBrowser2.GetClickedOption();
|
||||||
|
|
||||||
switch (ret)
|
switch (ret) {
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
videoChoice = (videoChoice + 1) % CFG_VIDEO_COUNT;
|
videoChoice = (videoChoice + 1) % CFG_VIDEO_COUNT;
|
||||||
break;
|
break;
|
||||||
@ -2261,18 +2169,15 @@ int GameSettings(struct discHdr * header)
|
|||||||
//if we do know that offset ask if they want to use it
|
//if we do know that offset ask if they want to use it
|
||||||
if (autodol>0) {
|
if (autodol>0) {
|
||||||
dolchoice = WindowPrompt(0,tr("Do you want to use the alt dol that is known to be correct?"),tr("Yes"),tr("Pick from a list"));
|
dolchoice = WindowPrompt(0,tr("Do you want to use the alt dol that is known to be correct?"),tr("Yes"),tr("Pick from a list"));
|
||||||
if (dolchoice==1)
|
if (dolchoice==1) {
|
||||||
{
|
|
||||||
alternatedoloffset = autodol;
|
alternatedoloffset = autodol;
|
||||||
snprintf(alternatedname, sizeof(alternatedname), "%s <%i>", tr("AUTO"),autodol);
|
snprintf(alternatedname, sizeof(alternatedname), "%s <%i>", tr("AUTO"),autodol);
|
||||||
}
|
} else {//they want to search for the correct dol themselves
|
||||||
else {//they want to search for the correct dol themselves
|
|
||||||
int res = DiscBrowse(header);
|
int res = DiscBrowse(header);
|
||||||
if ((res >= 0)&&(res !=696969))//if res==6969696 they pressed the back button
|
if ((res >= 0)&&(res !=696969))//if res==6969696 they pressed the back button
|
||||||
alternatedoloffset = res;
|
alternatedoloffset = res;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
int res = DiscBrowse(header);
|
int res = DiscBrowse(header);
|
||||||
if ((res >= 0)&&(res !=696969))
|
if ((res >= 0)&&(res !=696969))
|
||||||
alternatedoloffset = res;
|
alternatedoloffset = res;
|
||||||
@ -2291,12 +2196,10 @@ int GameSettings(struct discHdr * header)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(saveBtn.GetState() == STATE_CLICKED)
|
if (saveBtn.GetState() == STATE_CLICKED) {
|
||||||
{
|
|
||||||
|
|
||||||
if (isInserted(bootDevice)) {
|
if (isInserted(bootDevice)) {
|
||||||
if (CFG_save_game_opt(header->id))
|
if (CFG_save_game_opt(header->id)) {
|
||||||
{
|
|
||||||
// if language has changed, reload titles
|
// if language has changed, reload titles
|
||||||
int opt_langnew = 0;
|
int opt_langnew = 0;
|
||||||
game_cfg = CFG_get_game_opt(header->id);
|
game_cfg = CFG_get_game_opt(header->id);
|
||||||
@ -2305,9 +2208,7 @@ int GameSettings(struct discHdr * header)
|
|||||||
OpenXMLDatabase(Settings.titlestxt_path, Settings.db_language, Settings.db_JPtoEN, true, true, false); // open file, reload titles, do not keep in memory
|
OpenXMLDatabase(Settings.titlestxt_path, Settings.db_language, Settings.db_JPtoEN, true, true, false); // open file, reload titles, do not keep in memory
|
||||||
// titles are refreshed in menu.cpp as soon as this function returns
|
// titles are refreshed in menu.cpp as soon as this function returns
|
||||||
WindowPrompt(tr("Successfully Saved"), 0, tr("OK"));
|
WindowPrompt(tr("Successfully Saved"), 0, tr("OK"));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
WindowPrompt(tr("Save Failed"), 0, tr("OK"));
|
WindowPrompt(tr("Save Failed"), 0, tr("OK"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -2363,12 +2264,10 @@ int GameSettings(struct discHdr * header)
|
|||||||
optionBrowser2.SetEffect(EFFECT_FADE, 20);
|
optionBrowser2.SetEffect(EFFECT_FADE, 20);
|
||||||
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
||||||
|
|
||||||
while(!exit)
|
while (!exit) {
|
||||||
{
|
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
|
|
||||||
if(backBtn.GetState() == STATE_CLICKED)
|
if (backBtn.GetState() == STATE_CLICKED) {
|
||||||
{
|
|
||||||
backBtn.ResetState();
|
backBtn.ResetState();
|
||||||
exit = true;
|
exit = true;
|
||||||
break;
|
break;
|
||||||
@ -2379,15 +2278,13 @@ int GameSettings(struct discHdr * header)
|
|||||||
else if (reset == 1)
|
else if (reset == 1)
|
||||||
Sys_Reboot();
|
Sys_Reboot();
|
||||||
|
|
||||||
else if(homo.GetState() == STATE_CLICKED)
|
else if (homo.GetState() == STATE_CLICKED) {
|
||||||
{
|
|
||||||
cfg_save_global();
|
cfg_save_global();
|
||||||
optionBrowser2.SetState(STATE_DISABLED);
|
optionBrowser2.SetState(STATE_DISABLED);
|
||||||
s32 thetimeofbg = bgMusic->GetPlayTime();
|
s32 thetimeofbg = bgMusic->GetPlayTime();
|
||||||
bgMusic->Stop();
|
bgMusic->Stop();
|
||||||
choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0);
|
choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0);
|
||||||
if(!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path))
|
if (!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) {
|
||||||
{
|
|
||||||
bgMusic->Play();
|
bgMusic->Play();
|
||||||
} else {
|
} else {
|
||||||
bgMusic->PlayOggFile(Settings.ogg_path);
|
bgMusic->PlayOggFile(Settings.ogg_path);
|
||||||
@ -2408,29 +2305,23 @@ int GameSettings(struct discHdr * header)
|
|||||||
|
|
||||||
int choice1;
|
int choice1;
|
||||||
char tmp[200];
|
char tmp[200];
|
||||||
switch (ret)
|
switch (ret) {
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
choice1 = WindowPrompt(tr("Do you really want to delete:"),gameName,tr("Yes"),tr("Cancel"));
|
choice1 = WindowPrompt(tr("Do you really want to delete:"),gameName,tr("Yes"),tr("Cancel"));
|
||||||
if (choice1 == 1)
|
if (choice1 == 1) {
|
||||||
{
|
|
||||||
CFG_forget_game_opt(header->id);
|
CFG_forget_game_opt(header->id);
|
||||||
CFG_forget_game_num(header->id);
|
CFG_forget_game_num(header->id);
|
||||||
ret = WBFS_RemoveGame(header->id);
|
ret = WBFS_RemoveGame(header->id);
|
||||||
if (ret < 0)
|
if (ret < 0) {
|
||||||
{
|
|
||||||
WindowPrompt(
|
WindowPrompt(
|
||||||
tr("Can't delete:"),
|
tr("Can't delete:"),
|
||||||
gameName,
|
gameName,
|
||||||
tr("OK"));
|
tr("OK"));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
WindowPrompt(tr("Successfully deleted:"),gameName,tr("OK"));
|
WindowPrompt(tr("Successfully deleted:"),gameName,tr("OK"));
|
||||||
retVal = 1;
|
retVal = 1;
|
||||||
}
|
}
|
||||||
}
|
} else if (choice1 == 0) {
|
||||||
else if (choice1 == 0)
|
|
||||||
{
|
|
||||||
optionBrowser2.SetFocus(1);
|
optionBrowser2.SetFocus(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -2457,8 +2348,7 @@ int GameSettings(struct discHdr * header)
|
|||||||
snprintf(tmp,sizeof(tmp),"%s%c%c%c%c%c%c.png", Settings.covers_path, header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
|
snprintf(tmp,sizeof(tmp),"%s%c%c%c%c%c%c.png", Settings.covers_path, header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
|
||||||
|
|
||||||
choice1 = WindowPrompt(tr("Delete"),tmp,tr("Yes"),tr("No"));
|
choice1 = WindowPrompt(tr("Delete"),tmp,tr("Yes"),tr("No"));
|
||||||
if(choice1==1)
|
if (choice1==1) {
|
||||||
{
|
|
||||||
if (checkfile(tmp))
|
if (checkfile(tmp))
|
||||||
remove(tmp);
|
remove(tmp);
|
||||||
}
|
}
|
||||||
@ -2468,8 +2358,7 @@ int GameSettings(struct discHdr * header)
|
|||||||
snprintf(tmp,sizeof(tmp),"%s%c%c%c%c%c%c.png", Settings.disc_path, header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
|
snprintf(tmp,sizeof(tmp),"%s%c%c%c%c%c%c.png", Settings.disc_path, header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
|
||||||
|
|
||||||
choice1 = WindowPrompt(tr("Delete"),tmp,tr("Yes"),tr("No"));
|
choice1 = WindowPrompt(tr("Delete"),tmp,tr("Yes"),tr("No"));
|
||||||
if(choice1==1)
|
if (choice1==1) {
|
||||||
{
|
|
||||||
if (checkfile(tmp))
|
if (checkfile(tmp))
|
||||||
remove(tmp);
|
remove(tmp);
|
||||||
}
|
}
|
||||||
@ -2479,8 +2368,7 @@ int GameSettings(struct discHdr * header)
|
|||||||
snprintf(tmp,sizeof(tmp),"%s%c%c%c%c%c%c.txt", Settings.TxtCheatcodespath, header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
|
snprintf(tmp,sizeof(tmp),"%s%c%c%c%c%c%c.txt", Settings.TxtCheatcodespath, header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
|
||||||
|
|
||||||
choice1 = WindowPrompt(tr("Delete"),tmp,tr("Yes"),tr("No"));
|
choice1 = WindowPrompt(tr("Delete"),tmp,tr("Yes"),tr("No"));
|
||||||
if(choice1==1)
|
if (choice1==1) {
|
||||||
{
|
|
||||||
if (checkfile(tmp))
|
if (checkfile(tmp))
|
||||||
remove(tmp);
|
remove(tmp);
|
||||||
}
|
}
|
||||||
@ -2535,22 +2423,19 @@ int GameSettings(struct discHdr * header)
|
|||||||
if (reset == 1)
|
if (reset == 1)
|
||||||
Sys_Reboot();
|
Sys_Reboot();
|
||||||
|
|
||||||
if(backBtn.GetState() == STATE_CLICKED)
|
if (backBtn.GetState() == STATE_CLICKED) {
|
||||||
{
|
|
||||||
menu = MENU_DISCLIST;
|
menu = MENU_DISCLIST;
|
||||||
pageToDisplay = 0;
|
pageToDisplay = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(homo.GetState() == STATE_CLICKED)
|
if (homo.GetState() == STATE_CLICKED) {
|
||||||
{
|
|
||||||
cfg_save_global();
|
cfg_save_global();
|
||||||
optionBrowser2.SetState(STATE_DISABLED);
|
optionBrowser2.SetState(STATE_DISABLED);
|
||||||
s32 thetimeofbg = bgMusic->GetPlayTime();
|
s32 thetimeofbg = bgMusic->GetPlayTime();
|
||||||
bgMusic->Stop();
|
bgMusic->Stop();
|
||||||
choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0);
|
choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0);
|
||||||
if(!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path))
|
if (!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) {
|
||||||
{
|
|
||||||
bgMusic->Play();
|
bgMusic->Play();
|
||||||
} else {
|
} else {
|
||||||
bgMusic->PlayOggFile(Settings.ogg_path);
|
bgMusic->PlayOggFile(Settings.ogg_path);
|
||||||
@ -2558,8 +2443,7 @@ int GameSettings(struct discHdr * header)
|
|||||||
bgMusic->SetPlayTime(thetimeofbg);
|
bgMusic->SetPlayTime(thetimeofbg);
|
||||||
SetVolumeOgg(255*(Settings.volume/100.0));
|
SetVolumeOgg(255*(Settings.volume/100.0));
|
||||||
|
|
||||||
if(choice == 3)
|
if (choice == 3) {
|
||||||
{
|
|
||||||
Sys_LoadMenu(); // Back to System Menu
|
Sys_LoadMenu(); // Back to System Menu
|
||||||
} else if (choice == 2) {
|
} else if (choice == 2) {
|
||||||
Sys_BackToLoader();
|
Sys_BackToLoader();
|
||||||
|
@ -30,8 +30,7 @@ extern void HaltGui();
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* MenuOGG
|
* MenuOGG
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
bool MenuOGG()
|
bool MenuOGG() {
|
||||||
{
|
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
int ret = 0, choice = 0;
|
int ret = 0, choice = 0;
|
||||||
int scrollon, nothingchanged = 0;
|
int scrollon, nothingchanged = 0;
|
||||||
@ -179,8 +178,7 @@ bool MenuOGG()
|
|||||||
|
|
||||||
while (w.GetEffect()>0) usleep(50);
|
while (w.GetEffect()>0) usleep(50);
|
||||||
|
|
||||||
while(!returnhere)
|
while (!returnhere) {
|
||||||
{
|
|
||||||
|
|
||||||
if (shutdown == 1)
|
if (shutdown == 1)
|
||||||
Sys_Shutdown();
|
Sys_Shutdown();
|
||||||
@ -318,8 +316,7 @@ bool MenuOGG()
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* MenuLanguageSelect
|
* MenuLanguageSelect
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int MenuLanguageSelect()
|
int MenuLanguageSelect() {
|
||||||
{
|
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
int ret = 0, choice = 0;
|
int ret = 0, choice = 0;
|
||||||
int scrollon;
|
int scrollon;
|
||||||
@ -454,8 +451,7 @@ int MenuLanguageSelect()
|
|||||||
|
|
||||||
while (w.GetEffect()>0) usleep(50);
|
while (w.GetEffect()>0) usleep(50);
|
||||||
|
|
||||||
while(!returnhere)
|
while (!returnhere) {
|
||||||
{
|
|
||||||
|
|
||||||
if (shutdown == 1)
|
if (shutdown == 1)
|
||||||
Sys_Shutdown();
|
Sys_Shutdown();
|
||||||
|
@ -42,14 +42,12 @@ char alternatedname[40];
|
|||||||
|
|
||||||
#define TITLE_MAX 200
|
#define TITLE_MAX 200
|
||||||
|
|
||||||
struct ID_Title
|
struct ID_Title {
|
||||||
{
|
|
||||||
u8 id[5];
|
u8 id[5];
|
||||||
char title[TITLE_MAX];
|
char title[TITLE_MAX];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ID_Control
|
struct ID_Control {
|
||||||
{
|
|
||||||
u8 id[5];
|
u8 id[5];
|
||||||
u8 block;
|
u8 block;
|
||||||
};
|
};
|
||||||
@ -72,14 +70,12 @@ struct Game_NUM cfg_game_num[MAX_SAVED_GAME_NUM];
|
|||||||
|
|
||||||
static char *cfg_name, *cfg_val;
|
static char *cfg_name, *cfg_val;
|
||||||
|
|
||||||
struct TextMap
|
struct TextMap {
|
||||||
{
|
|
||||||
char *name;
|
char *name;
|
||||||
int id;
|
int id;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TextMap map_video[] =
|
struct TextMap map_video[] = {
|
||||||
{
|
|
||||||
{ "system", CFG_VIDEO_SYS },
|
{ "system", CFG_VIDEO_SYS },
|
||||||
{ "game", CFG_VIDEO_GAME },
|
{ "game", CFG_VIDEO_GAME },
|
||||||
{ "patch", CFG_VIDEO_PATCH },
|
{ "patch", CFG_VIDEO_PATCH },
|
||||||
@ -89,8 +85,7 @@ struct TextMap map_video[] =
|
|||||||
{ NULL, -1 }
|
{ NULL, -1 }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TextMap map_language[] =
|
struct TextMap map_language[] = {
|
||||||
{
|
|
||||||
{ "console", CFG_LANG_CONSOLE },
|
{ "console", CFG_LANG_CONSOLE },
|
||||||
{ "japanese", CFG_LANG_JAPANESE },
|
{ "japanese", CFG_LANG_JAPANESE },
|
||||||
{ "english", CFG_LANG_ENGLISH },
|
{ "english", CFG_LANG_ENGLISH },
|
||||||
@ -106,8 +101,7 @@ struct TextMap map_language[] =
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct TextMap map_alignment[] =
|
struct TextMap map_alignment[] = {
|
||||||
{
|
|
||||||
{ "left", CFG_ALIGN_LEFT },
|
{ "left", CFG_ALIGN_LEFT },
|
||||||
{ "right", CFG_ALIGN_RIGHT },
|
{ "right", CFG_ALIGN_RIGHT },
|
||||||
{ "center", CFG_ALIGN_CENTRE },
|
{ "center", CFG_ALIGN_CENTRE },
|
||||||
@ -116,15 +110,13 @@ struct TextMap map_alignment[] =
|
|||||||
{ "middle", CFG_ALIGN_MIDDLE },
|
{ "middle", CFG_ALIGN_MIDDLE },
|
||||||
{ NULL, -1 }
|
{ NULL, -1 }
|
||||||
};
|
};
|
||||||
char* strcopy(char *dest, char *src, int size)
|
char* strcopy(char *dest, char *src, int size) {
|
||||||
{
|
|
||||||
strncpy(dest,src,size);
|
strncpy(dest,src,size);
|
||||||
dest[size-1] = 0;
|
dest[size-1] = 0;
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
int map_get_id(struct TextMap *map, char *name)
|
int map_get_id(struct TextMap *map, char *name) {
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
for (i=0; map[i].name != NULL; i++) {
|
for (i=0; map[i].name != NULL; i++) {
|
||||||
if (strcmp(name, map[i].name) == 0) return map[i].id;
|
if (strcmp(name, map[i].name) == 0) return map[i].id;
|
||||||
@ -132,8 +124,7 @@ int map_get_id(struct TextMap *map, char *name)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* map_get_name(struct TextMap *map, short id)
|
char* map_get_name(struct TextMap *map, short id) {
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
for (i=0; map[i].name != NULL; i++) {
|
for (i=0; map[i].name != NULL; i++) {
|
||||||
if (id == map[i].id) return map[i].name;
|
if (id == map[i].id) return map[i].name;
|
||||||
@ -141,8 +132,7 @@ char* map_get_name(struct TextMap *map, short id)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool map_auto(char *name, char *name2, char *val, struct TextMap *map, short *var)
|
bool map_auto(char *name, char *name2, char *val, struct TextMap *map, short *var) {
|
||||||
{
|
|
||||||
if (strcmp(name, name2) != 0) return false;
|
if (strcmp(name, name2) != 0) return false;
|
||||||
int id = map_get_id(map, val);
|
int id = map_get_id(map, val);
|
||||||
if (id == -1) {
|
if (id == -1) {
|
||||||
@ -154,36 +144,30 @@ bool map_auto(char *name, char *name2, char *val, struct TextMap *map, short *va
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cfg_map_auto(char *name, struct TextMap *map, short *var)
|
bool cfg_map_auto(char *name, struct TextMap *map, short *var) {
|
||||||
{
|
|
||||||
return map_auto(name, cfg_name, cfg_val, map, var);
|
return map_auto(name, cfg_name, cfg_val, map, var);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cfg_map(char *name, char *val, short *var, short id)
|
bool cfg_map(char *name, char *val, short *var, short id) {
|
||||||
{
|
if (strcmp(name, cfg_name)==0 && strcmpi(val, cfg_val)==0) {
|
||||||
if (strcmp(name, cfg_name)==0 && strcmpi(val, cfg_val)==0)
|
|
||||||
{
|
|
||||||
*var = id;
|
*var = id;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cfg_bool(char *name, short *var)
|
bool cfg_bool(char *name, short *var) {
|
||||||
{
|
|
||||||
return (cfg_map(name, "0", var, 0) || cfg_map(name, "1", var, 1));
|
return (cfg_map(name, "0", var, 0) || cfg_map(name, "1", var, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void cfg_int(char *name, short *var, int count)
|
void cfg_int(char *name, short *var, int count) {
|
||||||
{
|
|
||||||
char tmp[5];
|
char tmp[5];
|
||||||
short i;
|
short i;
|
||||||
|
|
||||||
if (count > 10) //avoid overflow
|
if (count > 10) //avoid overflow
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++) {
|
||||||
{
|
|
||||||
sprintf(tmp, "%d", i);
|
sprintf(tmp, "%d", i);
|
||||||
cfg_map(name, tmp, var, i);
|
cfg_map(name, tmp, var, i);
|
||||||
}
|
}
|
||||||
@ -193,8 +177,7 @@ void cfg_int(char *name, short *var, int count)
|
|||||||
|
|
||||||
//static char bg_path[100];
|
//static char bg_path[100];
|
||||||
|
|
||||||
void CFG_Default(int widescreen) // -1 = non forced Mode
|
void CFG_Default(int widescreen) { // -1 = non forced Mode
|
||||||
{
|
|
||||||
if (widescreen == -1)
|
if (widescreen == -1)
|
||||||
CFG.widescreen = CONF_GetAspectRatio();
|
CFG.widescreen = CONF_GetAspectRatio();
|
||||||
else
|
else
|
||||||
@ -202,14 +185,11 @@ void CFG_Default(int widescreen) // -1 = non forced Mode
|
|||||||
|
|
||||||
if (CFG.widescreen) {
|
if (CFG.widescreen) {
|
||||||
snprintf(CFG.theme_path, sizeof(CFG.theme_path), "%s/wtheme/", bootDevice);
|
snprintf(CFG.theme_path, sizeof(CFG.theme_path), "%s/wtheme/", bootDevice);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
snprintf(CFG.theme_path, sizeof(CFG.theme_path), "%s/theme/", bootDevice);
|
snprintf(CFG.theme_path, sizeof(CFG.theme_path), "%s/theme/", bootDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (widescreen == -1)
|
if (widescreen == -1) {
|
||||||
{
|
|
||||||
snprintf(Settings.covers_path, sizeof(Settings.covers_path), "%s/images/", bootDevice); //default image path
|
snprintf(Settings.covers_path, sizeof(Settings.covers_path), "%s/images/", bootDevice); //default image path
|
||||||
snprintf(Settings.disc_path, sizeof(Settings.disc_path), "%s/images/disc/", bootDevice);
|
snprintf(Settings.disc_path, sizeof(Settings.disc_path), "%s/images/disc/", bootDevice);
|
||||||
snprintf(Settings.titlestxt_path, sizeof(Settings.titlestxt_path), "%s/config/", bootDevice);//default path for disc images
|
snprintf(Settings.titlestxt_path, sizeof(Settings.titlestxt_path), "%s/config/", bootDevice);//default path for disc images
|
||||||
@ -314,8 +294,7 @@ void CFG_Default(int widescreen) // -1 = non forced Mode
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Global_Default(void)
|
void Global_Default(void) {
|
||||||
{
|
|
||||||
Settings.video = discdefault;
|
Settings.video = discdefault;
|
||||||
Settings.vpatch = off;
|
Settings.vpatch = off;
|
||||||
Settings.language = ConsoleLangDefault;
|
Settings.language = ConsoleLangDefault;
|
||||||
@ -323,8 +302,7 @@ void Global_Default(void)
|
|||||||
Settings.hddinfo = hr12;
|
Settings.hddinfo = hr12;
|
||||||
Settings.sinfo = ((THEME.showID) ? GameID : Neither);
|
Settings.sinfo = ((THEME.showID) ? GameID : Neither);
|
||||||
Settings.rumble = RumbleOn;
|
Settings.rumble = RumbleOn;
|
||||||
if (THEME.showRegion)
|
if (THEME.showRegion) {
|
||||||
{
|
|
||||||
Settings.sinfo = ((Settings.sinfo == GameID) ? Both : GameRegion);
|
Settings.sinfo = ((Settings.sinfo == GameID) ? Both : GameRegion);
|
||||||
}
|
}
|
||||||
Settings.volume = 80;
|
Settings.volume = 80;
|
||||||
@ -350,8 +328,7 @@ void Global_Default(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *cfg_get_title(u8 *id)
|
char *cfg_get_title(u8 *id) {
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
for (i=0; i<num_title; i++) {
|
for (i=0; i<num_title; i++) {
|
||||||
if (memcmp(id, cfg_title[i].id, 4) == 0) {
|
if (memcmp(id, cfg_title[i].id, 4) == 0) {
|
||||||
@ -361,15 +338,13 @@ char *cfg_get_title(u8 *id)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *get_title(struct discHdr *header)
|
char *get_title(struct discHdr *header) {
|
||||||
{
|
|
||||||
char *title = cfg_get_title(header->id);
|
char *title = cfg_get_title(header->id);
|
||||||
if (title) return title;
|
if (title) return title;
|
||||||
return header->title;
|
return header->title;
|
||||||
}
|
}
|
||||||
|
|
||||||
void title_set(char *id, char *title)
|
void title_set(char *id, char *title) {
|
||||||
{
|
|
||||||
char *idt = cfg_get_title((u8*)id);
|
char *idt = cfg_get_title((u8*)id);
|
||||||
if (idt) {
|
if (idt) {
|
||||||
// replace
|
// replace
|
||||||
@ -389,8 +364,7 @@ void title_set(char *id, char *title)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 cfg_get_block(u8 *id)
|
u8 cfg_get_block(u8 *id) {
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
for (i=0; i<num_control; i++) {
|
for (i=0; i<num_control; i++) {
|
||||||
if (memcmp(id, cfg_control[i].id, 4) == 0) {
|
if (memcmp(id, cfg_control[i].id, 4) == 0) {
|
||||||
@ -400,18 +374,19 @@ u8 cfg_get_block(u8 *id)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 get_block(struct discHdr *header)
|
u8 get_block(struct discHdr *header) {
|
||||||
{
|
|
||||||
return cfg_get_block(header->id);
|
return cfg_get_block(header->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// trim leading and trailing whitespace
|
// trim leading and trailing whitespace
|
||||||
// copy at max n or at max size-1
|
// copy at max n or at max size-1
|
||||||
char* trim_n_copy(char *dest, char *src, int n, int size)
|
char* trim_n_copy(char *dest, char *src, int n, int size) {
|
||||||
{
|
|
||||||
int len;
|
int len;
|
||||||
// trim leading white space
|
// trim leading white space
|
||||||
while (isspace(*src)) { src++; n--; }
|
while (isspace(*src)) {
|
||||||
|
src++;
|
||||||
|
n--;
|
||||||
|
}
|
||||||
len = strlen(src);
|
len = strlen(src);
|
||||||
if (len > n) len = n;
|
if (len > n) len = n;
|
||||||
// trim trailing white space
|
// trim trailing white space
|
||||||
@ -423,8 +398,7 @@ char* trim_n_copy(char *dest, char *src, int n, int size)
|
|||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* trimcopy(char *dest, char *src, int size)
|
char* trimcopy(char *dest, char *src, int size) {
|
||||||
{
|
|
||||||
int len;
|
int len;
|
||||||
while (*src == ' ') src++;
|
while (*src == ' ') src++;
|
||||||
len = strlen(src);
|
len = strlen(src);
|
||||||
@ -436,8 +410,7 @@ char* trimcopy(char *dest, char *src, int size)
|
|||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
void widescreen_set(char *name, char *val)
|
void widescreen_set(char *name, char *val) {
|
||||||
{
|
|
||||||
cfg_name = name;
|
cfg_name = name;
|
||||||
cfg_val = val;
|
cfg_val = val;
|
||||||
|
|
||||||
@ -448,8 +421,7 @@ void widescreen_set(char *name, char *val)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void path_set(char *name, char *val)
|
void path_set(char *name, char *val) {
|
||||||
{
|
|
||||||
cfg_name = name;
|
cfg_name = name;
|
||||||
cfg_val = val;
|
cfg_val = val;
|
||||||
|
|
||||||
@ -521,8 +493,7 @@ void path_set(char *name, char *val)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void theme_set(char *name, char *val)
|
void theme_set(char *name, char *val) {
|
||||||
{
|
|
||||||
cfg_name = name;
|
cfg_name = name;
|
||||||
cfg_val = val;
|
cfg_val = val;
|
||||||
|
|
||||||
@ -796,8 +767,7 @@ void theme_set(char *name, char *val)
|
|||||||
if (sscanf(val, "%hd", &x) == 1) {
|
if (sscanf(val, "%hd", &x) == 1) {
|
||||||
THEME.batteryUnused = x;
|
THEME.batteryUnused = x;
|
||||||
}
|
}
|
||||||
}
|
} else if (strcmp(cfg_name, "tooltipAlpha") == 0) {
|
||||||
else if (strcmp(cfg_name, "tooltipAlpha") == 0) {
|
|
||||||
short x;
|
short x;
|
||||||
if (sscanf(val, "%hd", &x) == 1) {
|
if (sscanf(val, "%hd", &x) == 1) {
|
||||||
THEME.tooltipAlpha = x;
|
THEME.tooltipAlpha = x;
|
||||||
@ -841,8 +811,7 @@ void theme_set(char *name, char *val)
|
|||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void global_cfg_set(char *name, char *val)
|
void global_cfg_set(char *name, char *val) {
|
||||||
{
|
|
||||||
cfg_name = name;
|
cfg_name = name;
|
||||||
cfg_val = val;
|
cfg_val = val;
|
||||||
|
|
||||||
@ -852,8 +821,7 @@ void global_cfg_set(char *name, char *val)
|
|||||||
Settings.video = i;
|
Settings.video = i;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (strcmp(name, "vpatch") == 0) {
|
||||||
else if (strcmp(name, "vpatch") == 0) {
|
|
||||||
int i;
|
int i;
|
||||||
if (sscanf(val, "%d", &i) == 1) {
|
if (sscanf(val, "%d", &i) == 1) {
|
||||||
Settings.vpatch =i;
|
Settings.vpatch =i;
|
||||||
@ -867,173 +835,148 @@ void global_cfg_set(char *name, char *val)
|
|||||||
Settings.language = i;
|
Settings.language = i;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (strcmp(name, "ocarina") == 0) {
|
||||||
else if (strcmp(name, "ocarina") == 0) {
|
|
||||||
int i;
|
int i;
|
||||||
if (sscanf(val, "%d", &i) == 1) {
|
if (sscanf(val, "%d", &i) == 1) {
|
||||||
Settings.ocarina = i;
|
Settings.ocarina = i;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (strcmp(name, "sort") == 0) {
|
||||||
else if (strcmp(name, "sort") == 0) {
|
|
||||||
int i;
|
int i;
|
||||||
if (sscanf(val, "%d", &i) == 1) {
|
if (sscanf(val, "%d", &i) == 1) {
|
||||||
Settings.sort = i;
|
Settings.sort = i;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (strcmp(name, "fave") == 0) {
|
||||||
else if (strcmp(name, "fave") == 0) {
|
|
||||||
int i;
|
int i;
|
||||||
if (sscanf(val, "%d", &i) == 1) {
|
if (sscanf(val, "%d", &i) == 1) {
|
||||||
Settings.fave = i;
|
Settings.fave = i;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (strcmp(name, "keyset") == 0) {
|
||||||
else if (strcmp(name, "keyset") == 0) {
|
|
||||||
int i;
|
int i;
|
||||||
if (sscanf(val, "%d", &i) == 1) {
|
if (sscanf(val, "%d", &i) == 1) {
|
||||||
Settings.keyset = i;
|
Settings.keyset = i;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (strcmp(name, "hddinfo") == 0) {
|
||||||
else if (strcmp(name, "hddinfo") == 0) {
|
|
||||||
int i;
|
int i;
|
||||||
if (sscanf(val, "%d", &i) == 1) {
|
if (sscanf(val, "%d", &i) == 1) {
|
||||||
Settings.hddinfo = i;
|
Settings.hddinfo = i;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (strcmp(name, "sinfo") == 0) {
|
||||||
else if (strcmp(name, "sinfo") == 0) {
|
|
||||||
int i;
|
int i;
|
||||||
if (sscanf(val, "%d", &i) == 1) {
|
if (sscanf(val, "%d", &i) == 1) {
|
||||||
Settings.sinfo = i;
|
Settings.sinfo = i;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (strcmp(name, "rumble") == 0) {
|
||||||
else if (strcmp(name, "rumble") == 0) {
|
|
||||||
int i;
|
int i;
|
||||||
if (sscanf(val, "%d", &i) == 1) {
|
if (sscanf(val, "%d", &i) == 1) {
|
||||||
Settings.rumble = i;
|
Settings.rumble = i;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (strcmp(name, "volume") == 0) {
|
||||||
else if (strcmp(name, "volume") == 0) {
|
|
||||||
int i;
|
int i;
|
||||||
if (sscanf(val, "%d", &i) == 1) {
|
if (sscanf(val, "%d", &i) == 1) {
|
||||||
Settings.volume = i;
|
Settings.volume = i;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (strcmp(name, "sfxvolume") == 0) {
|
||||||
else if (strcmp(name, "sfxvolume") == 0) {
|
|
||||||
int i;
|
int i;
|
||||||
if (sscanf(val, "%d", &i) == 1) {
|
if (sscanf(val, "%d", &i) == 1) {
|
||||||
Settings.sfxvolume = i;
|
Settings.sfxvolume = i;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (strcmp(name, "tooltips") == 0) {
|
||||||
else if (strcmp(name, "tooltips") == 0) {
|
|
||||||
int i;
|
int i;
|
||||||
if (sscanf(val, "%d", &i) == 1) {
|
if (sscanf(val, "%d", &i) == 1) {
|
||||||
Settings.tooltips = i;
|
Settings.tooltips = i;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (strcmp(name, "password") == 0) {
|
||||||
else if (strcmp(name, "password") == 0) {
|
|
||||||
strcopy(Settings.unlockCode, val, sizeof(Settings.unlockCode));
|
strcopy(Settings.unlockCode, val, sizeof(Settings.unlockCode));
|
||||||
return;
|
return;
|
||||||
}
|
} else if (strcmp(name, "parentalcontrol") == 0) {
|
||||||
else if (strcmp(name, "parentalcontrol") == 0) {
|
|
||||||
int i;
|
int i;
|
||||||
if (sscanf(val, "%d", &i) == 1) {
|
if (sscanf(val, "%d", &i) == 1) {
|
||||||
Settings.parentalcontrol = i;
|
Settings.parentalcontrol = i;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (strcmp(name, "cios") == 0) {
|
||||||
else if (strcmp(name, "cios") == 0) {
|
|
||||||
int i;
|
int i;
|
||||||
if (sscanf(val, "%d", &i) == 1) {
|
if (sscanf(val, "%d", &i) == 1) {
|
||||||
Settings.cios = i;
|
Settings.cios = i;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (strcmp(name, "gridRows") == 0) {
|
||||||
else if (strcmp(name, "gridRows") == 0) {
|
|
||||||
int i;
|
int i;
|
||||||
if (sscanf(val, "%d", &i) == 1) {
|
if (sscanf(val, "%d", &i) == 1) {
|
||||||
Settings.gridRows = i;
|
Settings.gridRows = i;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (strcmp(name, "xflip") == 0) {
|
||||||
else if (strcmp(name, "xflip") == 0) {
|
|
||||||
int i;
|
int i;
|
||||||
if (sscanf(val, "%d", &i) == 1) {
|
if (sscanf(val, "%d", &i) == 1) {
|
||||||
Settings.xflip = i;
|
Settings.xflip = i;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (strcmp(name, "qboot") == 0) {
|
||||||
else if (strcmp(name, "qboot") == 0) {
|
|
||||||
int i;
|
int i;
|
||||||
if (sscanf(val, "%d", &i) == 1) {
|
if (sscanf(val, "%d", &i) == 1) {
|
||||||
Settings.qboot = i;
|
Settings.qboot = i;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (strcmp(name, "wsprompt") == 0) {
|
||||||
else if (strcmp(name, "wsprompt") == 0) {
|
|
||||||
int i;
|
int i;
|
||||||
if (sscanf(val, "%d", &i) == 1) {
|
if (sscanf(val, "%d", &i) == 1) {
|
||||||
Settings.wsprompt = i;
|
Settings.wsprompt = i;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (strcmp(name, "wiilight") == 0) {
|
||||||
else if (strcmp(name, "wiilight") == 0) {
|
|
||||||
int i;
|
int i;
|
||||||
if (sscanf(val, "%d", &i) == 1) {
|
if (sscanf(val, "%d", &i) == 1) {
|
||||||
Settings.wiilight = i;
|
Settings.wiilight = i;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (strcmp(name, "autonetwork") == 0) {
|
||||||
else if (strcmp(name, "autonetwork") == 0) {
|
|
||||||
int i;
|
int i;
|
||||||
if (sscanf(val, "%d", &i) == 1) {
|
if (sscanf(val, "%d", &i) == 1) {
|
||||||
Settings.autonetwork = i;
|
Settings.autonetwork = i;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (strcmp(name, "patchcountrystrings") == 0) {
|
||||||
else if (strcmp(name, "patchcountrystrings") == 0) {
|
|
||||||
int i;
|
int i;
|
||||||
if (sscanf(val, "%d", &i) == 1) {
|
if (sscanf(val, "%d", &i) == 1) {
|
||||||
Settings.patchcountrystrings = i;
|
Settings.patchcountrystrings = i;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (strcmp(name, "error002") == 0) {
|
||||||
else if (strcmp(name, "error002") == 0) {
|
|
||||||
int i;
|
int i;
|
||||||
if (sscanf(val, "%d", &i) == 1) {
|
if (sscanf(val, "%d", &i) == 1) {
|
||||||
Settings.error002 = i;
|
Settings.error002 = i;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (strcmp(name, "titlesOverride") == 0) {
|
||||||
else if (strcmp(name, "titlesOverride") == 0) {
|
|
||||||
int i;
|
int i;
|
||||||
if (sscanf(val, "%d", &i) == 1) {
|
if (sscanf(val, "%d", &i) == 1) {
|
||||||
Settings.titlesOverride = i;
|
Settings.titlesOverride = i;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (strcmp(name, "db_JPtoEN") == 0) {
|
||||||
else if (strcmp(name, "db_JPtoEN") == 0) {
|
|
||||||
int i;
|
int i;
|
||||||
if (sscanf(val, "%d", &i) == 1) {
|
if (sscanf(val, "%d", &i) == 1) {
|
||||||
Settings.db_JPtoEN = i;
|
Settings.db_JPtoEN = i;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (strcmp(name, "gameDisplay") == 0) {
|
||||||
else if (strcmp(name, "gameDisplay") == 0) {
|
|
||||||
int i;
|
int i;
|
||||||
if (sscanf(val, "%d", &i) == 1) {
|
if (sscanf(val, "%d", &i) == 1) {
|
||||||
Settings.gameDisplay = i;
|
Settings.gameDisplay = i;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (strcmp(name, "screensaver") == 0) {
|
||||||
else if (strcmp(name, "screensaver") == 0) {
|
|
||||||
int i;
|
int i;
|
||||||
if (sscanf(val, "%d", &i) == 1) {
|
if (sscanf(val, "%d", &i) == 1) {
|
||||||
Settings.screensaver = i;
|
Settings.screensaver = i;
|
||||||
@ -1047,16 +990,14 @@ void global_cfg_set(char *name, char *val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// split line to part1 delimiter part2
|
// split line to part1 delimiter part2
|
||||||
bool trimsplit(char *line, char *part1, char *part2, char delim, int size)
|
bool trimsplit(char *line, char *part1, char *part2, char delim, int size) {
|
||||||
{
|
|
||||||
char *eq = strchr(line, delim);
|
char *eq = strchr(line, delim);
|
||||||
if (!eq) return false;
|
if (!eq) return false;
|
||||||
trim_n_copy(part1, line, eq-line, size);
|
trim_n_copy(part1, line, eq-line, size);
|
||||||
trimcopy(part2, eq+1, size);
|
trimcopy(part2, eq+1, size);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void cfg_parseline(char *line, void (*set_func)(char*, char*))
|
void cfg_parseline(char *line, void (*set_func)(char*, char*)) {
|
||||||
{
|
|
||||||
// split name = value
|
// split name = value
|
||||||
char tmp[200], name[200], val[200];
|
char tmp[200], name[200], val[200];
|
||||||
strcopy(tmp, line, sizeof(tmp));
|
strcopy(tmp, line, sizeof(tmp));
|
||||||
@ -1069,8 +1010,7 @@ void cfg_parseline(char *line, void (*set_func)(char*, char*))
|
|||||||
set_func(name, val);
|
set_func(name, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cfg_parsetitleline(char *line, void (*set_func)(char*, char*, u8))
|
void cfg_parsetitleline(char *line, void (*set_func)(char*, char*, u8)) {
|
||||||
{
|
|
||||||
// split name = value
|
// split name = value
|
||||||
char tmp[200], name[200], val[200];
|
char tmp[200], name[200], val[200];
|
||||||
int block = 0;
|
int block = 0;
|
||||||
@ -1085,20 +1025,17 @@ void cfg_parsetitleline(char *line, void (*set_func)(char*, char*, u8))
|
|||||||
if (!blockpos)
|
if (!blockpos)
|
||||||
trimcopy(val, eq+1, sizeof(val));
|
trimcopy(val, eq+1, sizeof(val));
|
||||||
|
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
*blockpos = 0;
|
*blockpos = 0;
|
||||||
trimcopy(val, eq+1, sizeof(val));
|
trimcopy(val, eq+1, sizeof(val));
|
||||||
if (sscanf(blockpos+1, "%d", &block) != 1)
|
if (sscanf(blockpos+1, "%d", &block) != 1) {
|
||||||
{
|
|
||||||
block = 0;
|
block = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
set_func(name, val, block);
|
set_func(name, val, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cfg_parsefile(char *fname, void (*set_func)(char*, char*))
|
bool cfg_parsefile(char *fname, void (*set_func)(char*, char*)) {
|
||||||
{
|
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char line[200];
|
char line[200];
|
||||||
|
|
||||||
@ -1117,8 +1054,7 @@ bool cfg_parsefile(char *fname, void (*set_func)(char*, char*))
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cfg_parsetitlefile(char *fname, void (*set_func)(char*, char*, u8))
|
bool cfg_parsetitlefile(char *fname, void (*set_func)(char*, char*, u8)) {
|
||||||
{
|
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char line[200];
|
char line[200];
|
||||||
|
|
||||||
@ -1161,8 +1097,7 @@ void cfg_parsearg(int argc, char **argv)
|
|||||||
|
|
||||||
|
|
||||||
// return existing or new
|
// return existing or new
|
||||||
struct Game_CFG* cfg_get_game(u8 *id)
|
struct Game_CFG* cfg_get_game(u8 *id) {
|
||||||
{
|
|
||||||
struct Game_CFG *game = CFG_get_game_opt(id);
|
struct Game_CFG *game = CFG_get_game_opt(id);
|
||||||
if (game) return game;
|
if (game) return game;
|
||||||
if (num_saved_games >= MAX_SAVED_GAMES) return NULL;
|
if (num_saved_games >= MAX_SAVED_GAMES) return NULL;
|
||||||
@ -1172,8 +1107,7 @@ struct Game_CFG* cfg_get_game(u8 *id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// current options to game
|
// current options to game
|
||||||
void cfg_set_game_opt(struct Game_CFG *game, u8 *id)
|
void cfg_set_game_opt(struct Game_CFG *game, u8 *id) {
|
||||||
{
|
|
||||||
strncpy((char*)game->id, (char*)id, 6);
|
strncpy((char*)game->id, (char*)id, 6);
|
||||||
game->id[6] = 0;
|
game->id[6] = 0;
|
||||||
game->video = videoChoice;
|
game->video = videoChoice;
|
||||||
@ -1190,8 +1124,7 @@ void cfg_set_game_opt(struct Game_CFG *game, u8 *id)
|
|||||||
strcpy(game->alternatedolname, alternatedname);
|
strcpy(game->alternatedolname, alternatedname);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Game_NUM* cfg_get_game_num(u8 *id)
|
struct Game_NUM* cfg_get_game_num(u8 *id) {
|
||||||
{
|
|
||||||
struct Game_NUM *game = CFG_get_game_num(id);
|
struct Game_NUM *game = CFG_get_game_num(id);
|
||||||
if (game) return game;
|
if (game) return game;
|
||||||
if (num_saved_game_num >= MAX_SAVED_GAME_NUM) return NULL;
|
if (num_saved_game_num >= MAX_SAVED_GAME_NUM) return NULL;
|
||||||
@ -1201,8 +1134,7 @@ struct Game_NUM* cfg_get_game_num(u8 *id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// current options to game
|
// current options to game
|
||||||
void cfg_set_game_num(struct Game_NUM *game, u8 *id)
|
void cfg_set_game_num(struct Game_NUM *game, u8 *id) {
|
||||||
{
|
|
||||||
strncpy((char*)game->id, (char*)id, 6);
|
strncpy((char*)game->id, (char*)id, 6);
|
||||||
game->id[6] = 0;
|
game->id[6] = 0;
|
||||||
game->favorite = favoritevar;
|
game->favorite = favoritevar;
|
||||||
@ -1210,8 +1142,7 @@ void cfg_set_game_num(struct Game_NUM *game, u8 *id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool cfg_save_global()// save global settings
|
bool cfg_save_global() { // save global settings
|
||||||
{
|
|
||||||
char GXGlobal_cfg[26];
|
char GXGlobal_cfg[26];
|
||||||
sprintf(GXGlobal_cfg, "%s/config", bootDevice);
|
sprintf(GXGlobal_cfg, "%s/config", bootDevice);
|
||||||
struct stat st;
|
struct stat st;
|
||||||
@ -1289,8 +1220,7 @@ bool cfg_save_global()// save global settings
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void game_set(char *name, char *val)
|
void game_set(char *name, char *val) {
|
||||||
{
|
|
||||||
// sample line:
|
// sample line:
|
||||||
// game:RTNP41 = video:game; language:english; ocarina:0;
|
// game:RTNP41 = video:game; language:english; ocarina:0;
|
||||||
// game:RYWP01 = video:patch; language:console; ocarina:1;
|
// game:RYWP01 = video:patch; language:console; ocarina:1;
|
||||||
@ -1388,12 +1318,12 @@ void game_set(char *name, char *val)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// next opt
|
// next opt
|
||||||
if (np) p = np + 1; else p = NULL;
|
if (np) p = np + 1;
|
||||||
|
else p = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void parental_set(char *name, char *val)
|
void parental_set(char *name, char *val) {
|
||||||
{
|
|
||||||
// sample line:
|
// sample line:
|
||||||
// game:RTNP41 = video:game; language:english; ocarina:0;
|
// game:RTNP41 = video:game; language:english; ocarina:0;
|
||||||
// game:RYWP01 = video:patch; language:console; ocarina:1;
|
// game:RYWP01 = video:patch; language:console; ocarina:1;
|
||||||
@ -1437,12 +1367,12 @@ void parental_set(char *name, char *val)
|
|||||||
|
|
||||||
}
|
}
|
||||||
// next opt
|
// next opt
|
||||||
if (np) p = np + 1; else p = NULL;
|
if (np) p = np + 1;
|
||||||
|
else p = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void game_set_num(char *name, char *val)
|
void game_set_num(char *name, char *val) {
|
||||||
{
|
|
||||||
u8 id[8];
|
u8 id[8];
|
||||||
struct Game_NUM *game;
|
struct Game_NUM *game;
|
||||||
if (strncmp(name, "game:", 5) != 0) return;
|
if (strncmp(name, "game:", 5) != 0) return;
|
||||||
@ -1478,26 +1408,24 @@ void game_set_num(char *name, char *val)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (np) p = np + 1; else p = NULL;
|
if (np) p = np + 1;
|
||||||
|
else p = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cfg_load_games()
|
bool cfg_load_games() {
|
||||||
{
|
|
||||||
char GXGameSettings_cfg[32];
|
char GXGameSettings_cfg[32];
|
||||||
sprintf(GXGameSettings_cfg, "%s/config/GXGameSettings.cfg", bootDevice);
|
sprintf(GXGameSettings_cfg, "%s/config/GXGameSettings.cfg", bootDevice);
|
||||||
return cfg_parsefile(GXGameSettings_cfg, &game_set);
|
return cfg_parsefile(GXGameSettings_cfg, &game_set);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cfg_load_game_num()
|
bool cfg_load_game_num() {
|
||||||
{
|
|
||||||
char GXGameFavorites_cfg[32];
|
char GXGameFavorites_cfg[32];
|
||||||
sprintf(GXGameFavorites_cfg, "%s/config/GXGameFavorites.cfg", bootDevice);
|
sprintf(GXGameFavorites_cfg, "%s/config/GXGameFavorites.cfg", bootDevice);
|
||||||
return cfg_parsefile(GXGameFavorites_cfg, &game_set_num);
|
return cfg_parsefile(GXGameFavorites_cfg, &game_set_num);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cfg_save_games()
|
bool cfg_save_games() {
|
||||||
{
|
|
||||||
FILE *f;
|
FILE *f;
|
||||||
int i;
|
int i;
|
||||||
char GXGameSettings_cfg[50];
|
char GXGameSettings_cfg[50];
|
||||||
@ -1542,8 +1470,7 @@ bool cfg_save_games()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cfg_save_game_num()
|
bool cfg_save_game_num() {
|
||||||
{
|
|
||||||
FILE *f;
|
FILE *f;
|
||||||
int i;
|
int i;
|
||||||
char GXGameFavorites_cfg[32];
|
char GXGameFavorites_cfg[32];
|
||||||
@ -1575,8 +1502,7 @@ bool cfg_save_game_num()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CFG_reset_all_playcounters()
|
bool CFG_reset_all_playcounters() {
|
||||||
{
|
|
||||||
FILE *f;
|
FILE *f;
|
||||||
int i;
|
int i;
|
||||||
char GXGameFavorites_cfg[32];
|
char GXGameFavorites_cfg[32];
|
||||||
@ -1608,8 +1534,7 @@ bool CFG_reset_all_playcounters()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cfg_load_global()
|
bool cfg_load_global() {
|
||||||
{
|
|
||||||
char GXGlobal_cfg[26];
|
char GXGlobal_cfg[26];
|
||||||
sprintf(GXGlobal_cfg, "%s/config/GXGlobal.cfg", bootDevice);
|
sprintf(GXGlobal_cfg, "%s/config/GXGlobal.cfg", bootDevice);
|
||||||
//Default values defined by dev team
|
//Default values defined by dev team
|
||||||
@ -1625,8 +1550,7 @@ bool cfg_load_global()
|
|||||||
Settings.gameDisplay = list;
|
Settings.gameDisplay = list;
|
||||||
Settings.sinfo = ((THEME.showID) ? GameID : Neither);
|
Settings.sinfo = ((THEME.showID) ? GameID : Neither);
|
||||||
Settings.rumble = RumbleOn;
|
Settings.rumble = RumbleOn;
|
||||||
if (THEME.showRegion)
|
if (THEME.showRegion) {
|
||||||
{
|
|
||||||
Settings.sinfo = ((Settings.sinfo == GameID) ? Both : GameRegion);
|
Settings.sinfo = ((Settings.sinfo == GameID) ? Both : GameRegion);
|
||||||
}
|
}
|
||||||
Settings.volume = 80;
|
Settings.volume = 80;
|
||||||
@ -1642,8 +1566,7 @@ bool cfg_load_global()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct Game_CFG* CFG_get_game_opt(u8 *id)
|
struct Game_CFG* CFG_get_game_opt(u8 *id) {
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
for (i=0; i<num_saved_games; i++) {
|
for (i=0; i<num_saved_games; i++) {
|
||||||
if (memcmp(id, cfg_game[i].id, 6) == 0) {
|
if (memcmp(id, cfg_game[i].id, 6) == 0) {
|
||||||
@ -1654,8 +1577,7 @@ struct Game_CFG* CFG_get_game_opt(u8 *id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct Game_NUM* CFG_get_game_num(u8 *id)
|
struct Game_NUM* CFG_get_game_num(u8 *id) {
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
for (i=0; i<num_saved_game_num; i++) {
|
for (i=0; i<num_saved_game_num; i++) {
|
||||||
if (memcmp(id, cfg_game_num[i].id, 6) == 0) {
|
if (memcmp(id, cfg_game_num[i].id, 6) == 0) {
|
||||||
@ -1665,24 +1587,21 @@ struct Game_NUM* CFG_get_game_num(u8 *id)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CFG_save_game_opt(u8 *id)
|
bool CFG_save_game_opt(u8 *id) {
|
||||||
{
|
|
||||||
struct Game_CFG *game = cfg_get_game(id);
|
struct Game_CFG *game = cfg_get_game(id);
|
||||||
if (!game) return false;
|
if (!game) return false;
|
||||||
cfg_set_game_opt(game, id);
|
cfg_set_game_opt(game, id);
|
||||||
return cfg_save_games();
|
return cfg_save_games();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CFG_save_game_num(u8 *id)
|
bool CFG_save_game_num(u8 *id) {
|
||||||
{
|
|
||||||
struct Game_NUM *game = cfg_get_game_num(id);
|
struct Game_NUM *game = cfg_get_game_num(id);
|
||||||
if (!game) return false;
|
if (!game) return false;
|
||||||
cfg_set_game_num(game, id);
|
cfg_set_game_num(game, id);
|
||||||
return cfg_save_game_num();
|
return cfg_save_game_num();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CFG_forget_game_opt(u8 *id)
|
bool CFG_forget_game_opt(u8 *id) {
|
||||||
{
|
|
||||||
struct Game_CFG *game = CFG_get_game_opt(id);
|
struct Game_CFG *game = CFG_get_game_opt(id);
|
||||||
int i;
|
int i;
|
||||||
if (!game) return true;
|
if (!game) return true;
|
||||||
@ -1695,8 +1614,7 @@ bool CFG_forget_game_opt(u8 *id)
|
|||||||
return cfg_save_games();
|
return cfg_save_games();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CFG_forget_game_num(u8 *id)
|
bool CFG_forget_game_num(u8 *id) {
|
||||||
{
|
|
||||||
struct Game_NUM *game = CFG_get_game_num(id);
|
struct Game_NUM *game = CFG_get_game_num(id);
|
||||||
int i;
|
int i;
|
||||||
if (!game) return true;
|
if (!game) return true;
|
||||||
@ -1710,8 +1628,7 @@ bool CFG_forget_game_num(u8 *id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CFG_Load(void)
|
void CFG_Load(void) {
|
||||||
{
|
|
||||||
char pathname[200];
|
char pathname[200];
|
||||||
// bool ret = false;
|
// bool ret = false;
|
||||||
|
|
||||||
@ -1753,17 +1670,14 @@ void CFG_Load(void)
|
|||||||
// cfg_parsearg(argc, argv);
|
// cfg_parsearg(argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFG_LoadGlobal(void)
|
void CFG_LoadGlobal(void) {
|
||||||
{
|
|
||||||
char GXGlobal_cfg[26];
|
char GXGlobal_cfg[26];
|
||||||
sprintf(GXGlobal_cfg, "%s/config/GXGlobal.cfg", bootDevice);
|
sprintf(GXGlobal_cfg, "%s/config/GXGlobal.cfg", bootDevice);
|
||||||
cfg_parsefile(GXGlobal_cfg, &global_cfg_set);
|
cfg_parsefile(GXGlobal_cfg, &global_cfg_set);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFG_Cleanup(void)
|
void CFG_Cleanup(void) {
|
||||||
{
|
if (cfg_title) {
|
||||||
if (cfg_title)
|
|
||||||
{
|
|
||||||
free(cfg_title);
|
free(cfg_title);
|
||||||
cfg_title = NULL;
|
cfg_title = NULL;
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,7 @@
|
|||||||
#include <gctypes.h>
|
#include <gctypes.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "usbloader/disc.h"
|
#include "usbloader/disc.h"
|
||||||
@ -45,15 +44,13 @@ extern "C"
|
|||||||
extern char bootDevice[10];
|
extern char bootDevice[10];
|
||||||
//extern char *cfg_path;
|
//extern char *cfg_path;
|
||||||
|
|
||||||
struct CFG
|
struct CFG {
|
||||||
{
|
|
||||||
short widescreen;
|
short widescreen;
|
||||||
char theme_path[100];
|
char theme_path[100];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct THEME
|
struct THEME {
|
||||||
{
|
|
||||||
int selection_x;
|
int selection_x;
|
||||||
int selection_y;
|
int selection_y;
|
||||||
int selection_w;
|
int selection_w;
|
||||||
@ -170,8 +167,7 @@ extern u8 favoritevar;
|
|||||||
extern char alternatedname[40];
|
extern char alternatedname[40];
|
||||||
|
|
||||||
|
|
||||||
struct Game_CFG
|
struct Game_CFG {
|
||||||
{
|
|
||||||
u8 id[8];
|
u8 id[8];
|
||||||
u8 video;
|
u8 video;
|
||||||
u8 language;
|
u8 language;
|
||||||
@ -186,8 +182,7 @@ struct Game_CFG
|
|||||||
u8 patchcountrystrings;
|
u8 patchcountrystrings;
|
||||||
char alternatedolname[40];
|
char alternatedolname[40];
|
||||||
};
|
};
|
||||||
struct Game_NUM
|
struct Game_NUM {
|
||||||
{
|
|
||||||
u8 id[8];
|
u8 id[8];
|
||||||
u8 favorite;
|
u8 favorite;
|
||||||
u16 count;
|
u16 count;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#define SVN_REV "673M"
|
#define SVN_REV "674M"
|
||||||
|
|
||||||
const char *GetRev()
|
const char *GetRev()
|
||||||
{
|
{
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
#define SVNREV_H
|
#define SVNREV_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *GetRev();
|
const char *GetRev();
|
||||||
|
@ -26,20 +26,17 @@ void wiilight(int enable) { // Toggle wiilight (thanks Bool for wiil
|
|||||||
u8 shutdown = 0;
|
u8 shutdown = 0;
|
||||||
u8 reset = 0;
|
u8 reset = 0;
|
||||||
|
|
||||||
void __Sys_ResetCallback(void)
|
void __Sys_ResetCallback(void) {
|
||||||
{
|
|
||||||
/* Reboot console */
|
/* Reboot console */
|
||||||
reset = 1;
|
reset = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __Sys_PowerCallback(void)
|
void __Sys_PowerCallback(void) {
|
||||||
{
|
|
||||||
/* Poweroff console */
|
/* Poweroff console */
|
||||||
shutdown = 1;
|
shutdown = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sys_Init(void)
|
void Sys_Init(void) {
|
||||||
{
|
|
||||||
/* Initialize video subsytem */
|
/* Initialize video subsytem */
|
||||||
//VIDEO_Init();
|
//VIDEO_Init();
|
||||||
|
|
||||||
@ -48,8 +45,7 @@ void Sys_Init(void)
|
|||||||
SYS_SetPowerCallback(__Sys_PowerCallback);
|
SYS_SetPowerCallback(__Sys_PowerCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _ExitApp()
|
static void _ExitApp() {
|
||||||
{
|
|
||||||
ExitGUIThreads();
|
ExitGUIThreads();
|
||||||
StopGX();
|
StopGX();
|
||||||
ShutdownAudio();
|
ShutdownAudio();
|
||||||
@ -60,15 +56,13 @@ static void _ExitApp()
|
|||||||
mload_close();
|
mload_close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sys_Reboot(void)
|
void Sys_Reboot(void) {
|
||||||
{
|
|
||||||
/* Restart console */
|
/* Restart console */
|
||||||
_ExitApp();
|
_ExitApp();
|
||||||
STM_RebootSystem();
|
STM_RebootSystem();
|
||||||
}
|
}
|
||||||
|
|
||||||
int Sys_IosReload(int IOS)
|
int Sys_IosReload(int IOS) {
|
||||||
{
|
|
||||||
s32 ret = -1;
|
s32 ret = -1;
|
||||||
|
|
||||||
//shutdown SD and USB before IOS Reload in DiscWait
|
//shutdown SD and USB before IOS Reload in DiscWait
|
||||||
@ -116,8 +110,7 @@ int Sys_IosReload(int IOS)
|
|||||||
#define ShutdownToIdle 1
|
#define ShutdownToIdle 1
|
||||||
#define ShutdownToStandby 2
|
#define ShutdownToStandby 2
|
||||||
|
|
||||||
static void _Sys_Shutdown(int SHUTDOWN_MODE)
|
static void _Sys_Shutdown(int SHUTDOWN_MODE) {
|
||||||
{
|
|
||||||
_ExitApp();
|
_ExitApp();
|
||||||
WPAD_Flush(0);
|
WPAD_Flush(0);
|
||||||
WPAD_Disconnect(0);
|
WPAD_Disconnect(0);
|
||||||
@ -139,30 +132,24 @@ static void _Sys_Shutdown(int SHUTDOWN_MODE)
|
|||||||
STM_ShutdownToStandby();
|
STM_ShutdownToStandby();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void Sys_Shutdown(void)
|
void Sys_Shutdown(void) {
|
||||||
{
|
|
||||||
_Sys_Shutdown(ShutdownToDefault);
|
_Sys_Shutdown(ShutdownToDefault);
|
||||||
}
|
}
|
||||||
void Sys_ShutdownToIdel(void)
|
void Sys_ShutdownToIdel(void) {
|
||||||
{
|
|
||||||
_Sys_Shutdown(ShutdownToIdle);
|
_Sys_Shutdown(ShutdownToIdle);
|
||||||
}
|
}
|
||||||
void Sys_ShutdownToStandby(void)
|
void Sys_ShutdownToStandby(void) {
|
||||||
{
|
|
||||||
_Sys_Shutdown(ShutdownToStandby);
|
_Sys_Shutdown(ShutdownToStandby);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sys_LoadMenu(void)
|
void Sys_LoadMenu(void) {
|
||||||
{
|
|
||||||
_ExitApp();
|
_ExitApp();
|
||||||
/* Return to the Wii system menu */
|
/* Return to the Wii system menu */
|
||||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sys_BackToLoader(void)
|
void Sys_BackToLoader(void) {
|
||||||
{
|
if (*((u32*) 0x80001800)) {
|
||||||
if (*((u32*) 0x80001800))
|
|
||||||
{
|
|
||||||
_ExitApp();
|
_ExitApp();
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
@ -32,8 +32,7 @@
|
|||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Return the next byte in the pseudo-random sequence
|
* Return the next byte in the pseudo-random sequence
|
||||||
*/
|
*/
|
||||||
static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab)
|
static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab) {
|
||||||
{
|
|
||||||
unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
|
unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
|
||||||
* unpredictable manner on 16-bit systems; not a problem
|
* unpredictable manner on 16-bit systems; not a problem
|
||||||
* with any known compiler so far, though */
|
* with any known compiler so far, though */
|
||||||
@ -45,8 +44,7 @@ static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab)
|
|||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Update the encryption keys with the next byte of plain text
|
* Update the encryption keys with the next byte of plain text
|
||||||
*/
|
*/
|
||||||
static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c)
|
static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c) {
|
||||||
{
|
|
||||||
(*(pkeys+0)) = CRC32((*(pkeys+0)), c);
|
(*(pkeys+0)) = CRC32((*(pkeys+0)), c);
|
||||||
(*(pkeys+1)) += (*(pkeys+0)) & 0xff;
|
(*(pkeys+1)) += (*(pkeys+0)) & 0xff;
|
||||||
(*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
|
(*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
|
||||||
@ -62,8 +60,7 @@ static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int
|
|||||||
* Initialize the encryption keys and the random header according to
|
* Initialize the encryption keys and the random header according to
|
||||||
* the given password.
|
* the given password.
|
||||||
*/
|
*/
|
||||||
static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab)
|
static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab) {
|
||||||
{
|
|
||||||
*(pkeys+0) = 305419896L;
|
*(pkeys+0) = 305419896L;
|
||||||
*(pkeys+1) = 591751049L;
|
*(pkeys+1) = 591751049L;
|
||||||
*(pkeys+2) = 878082192L;
|
*(pkeys+2) = 878082192L;
|
||||||
@ -108,20 +105,17 @@ static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting)
|
|||||||
* output of rand() to get less predictability, since rand() is
|
* output of rand() to get less predictability, since rand() is
|
||||||
* often poorly implemented.
|
* often poorly implemented.
|
||||||
*/
|
*/
|
||||||
if (++calls == 1)
|
if (++calls == 1) {
|
||||||
{
|
|
||||||
srand((unsigned)(time(NULL) ^ ZCR_SEED2));
|
srand((unsigned)(time(NULL) ^ ZCR_SEED2));
|
||||||
}
|
}
|
||||||
init_keys(passwd, pkeys, pcrc_32_tab);
|
init_keys(passwd, pkeys, pcrc_32_tab);
|
||||||
for (n = 0; n < RAND_HEAD_LEN-2; n++)
|
for (n = 0; n < RAND_HEAD_LEN-2; n++) {
|
||||||
{
|
|
||||||
c = (rand() >> 7) & 0xff;
|
c = (rand() >> 7) & 0xff;
|
||||||
header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t);
|
header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t);
|
||||||
}
|
}
|
||||||
/* Encrypt random header (last two bytes is high word of crc) */
|
/* Encrypt random header (last two bytes is high word of crc) */
|
||||||
init_keys(passwd, pkeys, pcrc_32_tab);
|
init_keys(passwd, pkeys, pcrc_32_tab);
|
||||||
for (n = 0; n < RAND_HEAD_LEN-2; n++)
|
for (n = 0; n < RAND_HEAD_LEN-2; n++) {
|
||||||
{
|
|
||||||
buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t);
|
buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t);
|
||||||
}
|
}
|
||||||
buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t);
|
buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t);
|
||||||
|
@ -127,8 +127,7 @@ long ZCALLBACK fseek_file_func (opaque, stream, offset, origin)
|
|||||||
{
|
{
|
||||||
int fseek_origin=0;
|
int fseek_origin=0;
|
||||||
long ret;
|
long ret;
|
||||||
switch (origin)
|
switch (origin) {
|
||||||
{
|
|
||||||
case ZLIB_FILEFUNC_SEEK_CUR :
|
case ZLIB_FILEFUNC_SEEK_CUR :
|
||||||
fseek_origin = SEEK_CUR;
|
fseek_origin = SEEK_CUR;
|
||||||
break;
|
break;
|
||||||
@ -138,7 +137,8 @@ long ZCALLBACK fseek_file_func (opaque, stream, offset, origin)
|
|||||||
case ZLIB_FILEFUNC_SEEK_SET :
|
case ZLIB_FILEFUNC_SEEK_SET :
|
||||||
fseek_origin = SEEK_SET;
|
fseek_origin = SEEK_SET;
|
||||||
break;
|
break;
|
||||||
default: return -1;
|
default:
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
ret = 0;
|
ret = 0;
|
||||||
fseek((FILE *)stream, offset, fseek_origin);
|
fseek((FILE *)stream, offset, fseek_origin);
|
||||||
|
@ -43,8 +43,7 @@ typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLo
|
|||||||
typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
|
typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
|
||||||
typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
|
typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
|
||||||
|
|
||||||
typedef struct zlib_filefunc_def_s
|
typedef struct zlib_filefunc_def_s {
|
||||||
{
|
|
||||||
open_file_func zopen_file;
|
open_file_func zopen_file;
|
||||||
read_file_func zread_file;
|
read_file_func zread_file;
|
||||||
write_file_func zwrite_file;
|
write_file_func zwrite_file;
|
||||||
|
@ -21,15 +21,13 @@
|
|||||||
#define WRITEBUFFERSIZE (8192)
|
#define WRITEBUFFERSIZE (8192)
|
||||||
#define MAXFILENAME (256)
|
#define MAXFILENAME (256)
|
||||||
|
|
||||||
static int mymkdir(const char* dirname)
|
static int mymkdir(const char* dirname) {
|
||||||
{
|
|
||||||
int ret=0;
|
int ret=0;
|
||||||
ret = mkdir (dirname,0775);
|
ret = mkdir (dirname,0775);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int makedir (char *newdir)
|
int makedir (char *newdir) {
|
||||||
{
|
|
||||||
char *buffer ;
|
char *buffer ;
|
||||||
char *p;
|
char *p;
|
||||||
int len = (int)strlen(newdir);
|
int len = (int)strlen(newdir);
|
||||||
@ -43,23 +41,20 @@ int makedir (char *newdir)
|
|||||||
if (buffer[len-1] == '/') {
|
if (buffer[len-1] == '/') {
|
||||||
buffer[len-1] = '\0';
|
buffer[len-1] = '\0';
|
||||||
}
|
}
|
||||||
if (mymkdir(buffer) == 0)
|
if (mymkdir(buffer) == 0) {
|
||||||
{
|
|
||||||
free(buffer);
|
free(buffer);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = buffer+1;
|
p = buffer+1;
|
||||||
while (1)
|
while (1) {
|
||||||
{
|
|
||||||
char hold;
|
char hold;
|
||||||
|
|
||||||
while (*p && *p != '\\' && *p != '/')
|
while (*p && *p != '\\' && *p != '/')
|
||||||
p++;
|
p++;
|
||||||
hold = *p;
|
hold = *p;
|
||||||
*p = 0;
|
*p = 0;
|
||||||
if ((mymkdir(buffer) == -1) && (errno == ENOENT))
|
if ((mymkdir(buffer) == -1) && (errno == ENOENT)) {
|
||||||
{
|
|
||||||
printf("couldn't create directory %s\n",buffer);
|
printf("couldn't create directory %s\n",buffer);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
return 0;
|
return 0;
|
||||||
@ -72,8 +67,7 @@ int makedir (char *newdir)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int do_extract_currentfile(unzFile uf,const int* popt_extract_without_path,int* popt_overwrite,const char* password)
|
static int do_extract_currentfile(unzFile uf,const int* popt_extract_without_path,int* popt_overwrite,const char* password) {
|
||||||
{
|
|
||||||
char filename_inzip[256];
|
char filename_inzip[256];
|
||||||
char* filename_withoutpath;
|
char* filename_withoutpath;
|
||||||
char* p;
|
char* p;
|
||||||
@ -85,38 +79,31 @@ static int do_extract_currentfile(unzFile uf,const int* popt_extract_without_pat
|
|||||||
unz_file_info file_info;
|
unz_file_info file_info;
|
||||||
err = unzGetCurrentFileInfo(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
|
err = unzGetCurrentFileInfo(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
|
||||||
|
|
||||||
if (err!=UNZ_OK)
|
if (err!=UNZ_OK) {
|
||||||
{
|
|
||||||
printf("error %d with zipfile in unzGetCurrentFileInfo\n",err);
|
printf("error %d with zipfile in unzGetCurrentFileInfo\n",err);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_buf = WRITEBUFFERSIZE;
|
size_buf = WRITEBUFFERSIZE;
|
||||||
buf = (void*)malloc(size_buf);
|
buf = (void*)malloc(size_buf);
|
||||||
if (buf==NULL)
|
if (buf==NULL) {
|
||||||
{
|
|
||||||
printf("Error allocating memory\n");
|
printf("Error allocating memory\n");
|
||||||
return UNZ_INTERNALERROR;
|
return UNZ_INTERNALERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = filename_withoutpath = filename_inzip;
|
p = filename_withoutpath = filename_inzip;
|
||||||
while ((*p) != '\0')
|
while ((*p) != '\0') {
|
||||||
{
|
|
||||||
if (((*p)=='/') || ((*p)=='\\'))
|
if (((*p)=='/') || ((*p)=='\\'))
|
||||||
filename_withoutpath = p+1;
|
filename_withoutpath = p+1;
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*filename_withoutpath)=='\0')
|
if ((*filename_withoutpath)=='\0') {
|
||||||
{
|
if ((*popt_extract_without_path)==0) {
|
||||||
if ((*popt_extract_without_path)==0)
|
|
||||||
{
|
|
||||||
printf("creating directory: %s\n",filename_inzip);
|
printf("creating directory: %s\n",filename_inzip);
|
||||||
mymkdir(filename_inzip);
|
mymkdir(filename_inzip);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
char* write_filename;
|
char* write_filename;
|
||||||
int skip=0;
|
int skip=0;
|
||||||
|
|
||||||
@ -126,35 +113,29 @@ static int do_extract_currentfile(unzFile uf,const int* popt_extract_without_pat
|
|||||||
write_filename = filename_withoutpath;
|
write_filename = filename_withoutpath;
|
||||||
|
|
||||||
err = unzOpenCurrentFilePassword(uf,password);
|
err = unzOpenCurrentFilePassword(uf,password);
|
||||||
if (err!=UNZ_OK)
|
if (err!=UNZ_OK) {
|
||||||
{
|
|
||||||
printf("error %d with zipfile in unzOpenCurrentFilePassword\n",err);
|
printf("error %d with zipfile in unzOpenCurrentFilePassword\n",err);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((*popt_overwrite)==0) && (err==UNZ_OK))
|
if (((*popt_overwrite)==0) && (err==UNZ_OK)) {
|
||||||
{
|
|
||||||
char rep=0;
|
char rep=0;
|
||||||
FILE* ftestexist;
|
FILE* ftestexist;
|
||||||
ftestexist = fopen(write_filename,"rb");
|
ftestexist = fopen(write_filename,"rb");
|
||||||
if (ftestexist!=NULL)
|
if (ftestexist!=NULL) {
|
||||||
{
|
|
||||||
fclose(ftestexist);
|
fclose(ftestexist);
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
char answer[128];
|
char answer[128];
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
printf("The file %s exists. Overwrite ? [y]es, [n]o, [A]ll: ",write_filename);
|
printf("The file %s exists. Overwrite ? [y]es, [n]o, [A]ll: ",write_filename);
|
||||||
ret = scanf("%1s",answer);
|
ret = scanf("%1s",answer);
|
||||||
if (ret != 1)
|
if (ret != 1) {
|
||||||
{
|
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
rep = answer[0] ;
|
rep = answer[0] ;
|
||||||
if ((rep>='a') && (rep<='z'))
|
if ((rep>='a') && (rep<='z'))
|
||||||
rep -= 0x20;
|
rep -= 0x20;
|
||||||
}
|
} while ((rep!='Y') && (rep!='N') && (rep!='A'));
|
||||||
while ((rep!='Y') && (rep!='N') && (rep!='A'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rep == 'N')
|
if (rep == 'N')
|
||||||
@ -164,14 +145,12 @@ static int do_extract_currentfile(unzFile uf,const int* popt_extract_without_pat
|
|||||||
*popt_overwrite=1;
|
*popt_overwrite=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((skip==0) && (err==UNZ_OK))
|
if ((skip==0) && (err==UNZ_OK)) {
|
||||||
{
|
|
||||||
fout=fopen(write_filename,"wb");
|
fout=fopen(write_filename,"wb");
|
||||||
|
|
||||||
/* some zipfile don't contain directory alone before file */
|
/* some zipfile don't contain directory alone before file */
|
||||||
if ((fout==NULL) && ((*popt_extract_without_path)==0) &&
|
if ((fout==NULL) && ((*popt_extract_without_path)==0) &&
|
||||||
(filename_withoutpath!=(char*)filename_inzip))
|
(filename_withoutpath!=(char*)filename_inzip)) {
|
||||||
{
|
|
||||||
char c=*(filename_withoutpath-1);
|
char c=*(filename_withoutpath-1);
|
||||||
*(filename_withoutpath-1)='\0';
|
*(filename_withoutpath-1)='\0';
|
||||||
makedir(write_filename);
|
makedir(write_filename);
|
||||||
@ -179,47 +158,38 @@ static int do_extract_currentfile(unzFile uf,const int* popt_extract_without_pat
|
|||||||
fout=fopen(write_filename,"wb");
|
fout=fopen(write_filename,"wb");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fout==NULL)
|
if (fout==NULL) {
|
||||||
{
|
|
||||||
printf("error opening %s\n",write_filename);
|
printf("error opening %s\n",write_filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fout!=NULL)
|
if (fout!=NULL) {
|
||||||
{
|
|
||||||
printf(" extracting: %s\n",write_filename);
|
printf(" extracting: %s\n",write_filename);
|
||||||
|
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
err = unzReadCurrentFile(uf,buf,size_buf);
|
err = unzReadCurrentFile(uf,buf,size_buf);
|
||||||
if (err<0)
|
if (err<0) {
|
||||||
{
|
|
||||||
printf("error %d with zipfile in unzReadCurrentFile\n",err);
|
printf("error %d with zipfile in unzReadCurrentFile\n",err);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (err>0)
|
if (err>0)
|
||||||
if (fwrite(buf,err,1,fout)!=1)
|
if (fwrite(buf,err,1,fout)!=1) {
|
||||||
{
|
|
||||||
printf("error in writing extracted file\n");
|
printf("error in writing extracted file\n");
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} while (err>0);
|
||||||
while (err>0);
|
|
||||||
if (fout)
|
if (fout)
|
||||||
fclose(fout);
|
fclose(fout);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
if (err==UNZ_OK) {
|
||||||
{
|
|
||||||
err = unzCloseCurrentFile (uf);
|
err = unzCloseCurrentFile (uf);
|
||||||
if (err!=UNZ_OK)
|
if (err!=UNZ_OK) {
|
||||||
{
|
|
||||||
printf("error %d with zipfile in unzCloseCurrentFile\n",err);
|
printf("error %d with zipfile in unzCloseCurrentFile\n",err);
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
unzCloseCurrentFile(uf); /* don't lose the error */
|
unzCloseCurrentFile(uf); /* don't lose the error */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,8 +198,7 @@ static int do_extract_currentfile(unzFile uf,const int* popt_extract_without_pat
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int extractZip(unzFile uf,int opt_extract_without_path,int opt_overwrite,const char* password)
|
int extractZip(unzFile uf,int opt_extract_without_path,int opt_overwrite,const char* password) {
|
||||||
{
|
|
||||||
uLong i;
|
uLong i;
|
||||||
unz_global_info gi;
|
unz_global_info gi;
|
||||||
int err;
|
int err;
|
||||||
@ -238,18 +207,15 @@ int extractZip(unzFile uf,int opt_extract_without_path,int opt_overwrite,const c
|
|||||||
if (err!=UNZ_OK)
|
if (err!=UNZ_OK)
|
||||||
printf("error %d with zipfile in unzGetGlobalInfo \n",err);
|
printf("error %d with zipfile in unzGetGlobalInfo \n",err);
|
||||||
|
|
||||||
for (i=0;i<gi.number_entry;i++)
|
for (i=0;i<gi.number_entry;i++) {
|
||||||
{
|
|
||||||
if (do_extract_currentfile(uf,&opt_extract_without_path,
|
if (do_extract_currentfile(uf,&opt_extract_without_path,
|
||||||
&opt_overwrite,
|
&opt_overwrite,
|
||||||
password) != UNZ_OK)
|
password) != UNZ_OK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if ((i+1)<gi.number_entry)
|
if ((i+1)<gi.number_entry) {
|
||||||
{
|
|
||||||
err = unzGoToNextFile(uf);
|
err = unzGoToNextFile(uf);
|
||||||
if (err!=UNZ_OK)
|
if (err!=UNZ_OK) {
|
||||||
{
|
|
||||||
printf("error %d with zipfile in unzGoToNextFile\n",err);
|
printf("error %d with zipfile in unzGoToNextFile\n",err);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -259,10 +225,8 @@ int extractZip(unzFile uf,int opt_extract_without_path,int opt_overwrite,const c
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int extractZipOnefile(unzFile uf,const char* filename,int opt_extract_without_path,int opt_overwrite,const char* password)
|
int extractZipOnefile(unzFile uf,const char* filename,int opt_extract_without_path,int opt_overwrite,const char* password) {
|
||||||
{
|
if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK) {
|
||||||
if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK)
|
|
||||||
{
|
|
||||||
printf("file %s not found in the zipfile\n",filename);
|
printf("file %s not found in the zipfile\n",filename);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
@ -91,16 +91,14 @@ const char unz_copyright[] =
|
|||||||
" unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
|
" unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
|
||||||
|
|
||||||
/* unz_file_info_interntal contain internal info about a file in zipfile*/
|
/* unz_file_info_interntal contain internal info about a file in zipfile*/
|
||||||
typedef struct unz_file_info_internal_s
|
typedef struct unz_file_info_internal_s {
|
||||||
{
|
|
||||||
uLong offset_curfile;/* relative offset of local header 4 bytes */
|
uLong offset_curfile;/* relative offset of local header 4 bytes */
|
||||||
} unz_file_info_internal;
|
} unz_file_info_internal;
|
||||||
|
|
||||||
|
|
||||||
/* file_in_zip_read_info_s contain internal information about a file in zipfile,
|
/* file_in_zip_read_info_s contain internal information about a file in zipfile,
|
||||||
when reading and decompress it */
|
when reading and decompress it */
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
char *read_buffer; /* internal buffer for compressed data */
|
char *read_buffer; /* internal buffer for compressed data */
|
||||||
z_stream stream; /* zLib stream structure for inflate */
|
z_stream stream; /* zLib stream structure for inflate */
|
||||||
|
|
||||||
@ -125,8 +123,7 @@ typedef struct
|
|||||||
|
|
||||||
/* unz_s contain internal information about the zipfile
|
/* unz_s contain internal information about the zipfile
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
zlib_filefunc_def z_filefunc;
|
zlib_filefunc_def z_filefunc;
|
||||||
voidpf filestream; /* io structore of the zipfile */
|
voidpf filestream; /* io structore of the zipfile */
|
||||||
unz_global_info gi; /* public global information */
|
unz_global_info gi; /* public global information */
|
||||||
@ -175,13 +172,10 @@ local int unzlocal_getByte(pzlib_filefunc_def,filestream,pi)
|
|||||||
{
|
{
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1);
|
int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1);
|
||||||
if (err==1)
|
if (err==1) {
|
||||||
{
|
|
||||||
*pi = (int)c;
|
*pi = (int)c;
|
||||||
return UNZ_OK;
|
return UNZ_OK;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
if (ZERROR(*pzlib_filefunc_def,filestream))
|
if (ZERROR(*pzlib_filefunc_def,filestream))
|
||||||
return UNZ_ERRNO;
|
return UNZ_ERRNO;
|
||||||
else
|
else
|
||||||
@ -263,8 +257,7 @@ local int strcmpcasenosensitive_internal (fileName1,fileName2)
|
|||||||
const char* fileName1;
|
const char* fileName1;
|
||||||
const char* fileName2;
|
const char* fileName2;
|
||||||
{
|
{
|
||||||
for (;;)
|
for (;;) {
|
||||||
{
|
|
||||||
char c1=*(fileName1++);
|
char c1=*(fileName1++);
|
||||||
char c2=*(fileName2++);
|
char c2=*(fileName2++);
|
||||||
if ((c1>='a') && (c1<='z'))
|
if ((c1>='a') && (c1<='z'))
|
||||||
@ -352,8 +345,7 @@ local uLong unzlocal_SearchCentralDir(pzlib_filefunc_def,filestream)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
uBackRead = 4;
|
uBackRead = 4;
|
||||||
while (uBackRead<uMaxBack)
|
while (uBackRead<uMaxBack) {
|
||||||
{
|
|
||||||
uLong uReadSize,uReadPos ;
|
uLong uReadSize,uReadPos ;
|
||||||
int i;
|
int i;
|
||||||
if (uBackRead+BUFREADCOMMENT>uMaxBack)
|
if (uBackRead+BUFREADCOMMENT>uMaxBack)
|
||||||
@ -372,8 +364,7 @@ local uLong unzlocal_SearchCentralDir(pzlib_filefunc_def,filestream)
|
|||||||
|
|
||||||
for (i=(int)uReadSize-3; (i--)>0;)
|
for (i=(int)uReadSize-3; (i--)>0;)
|
||||||
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
|
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
|
||||||
((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
|
((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) {
|
||||||
{
|
|
||||||
uPosFound = uReadPos+i;
|
uPosFound = uReadPos+i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -477,8 +468,7 @@ extern unzFile ZEXPORT unzOpen2 (path, pzlib_filefunc_def)
|
|||||||
(err==UNZ_OK))
|
(err==UNZ_OK))
|
||||||
err=UNZ_BADZIPFILE;
|
err=UNZ_BADZIPFILE;
|
||||||
|
|
||||||
if (err!=UNZ_OK)
|
if (err!=UNZ_OK) {
|
||||||
{
|
|
||||||
ZCLOSE(us.z_filefunc, us.filestream);
|
ZCLOSE(us.z_filefunc, us.filestream);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -607,8 +597,7 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
|
|||||||
|
|
||||||
|
|
||||||
/* we check the magic */
|
/* we check the magic */
|
||||||
if (err==UNZ_OK)
|
if (err==UNZ_OK) {
|
||||||
{
|
|
||||||
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
|
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
else if (uMagic!=0x02014b50)
|
else if (uMagic!=0x02014b50)
|
||||||
@ -663,15 +652,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
|
|||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
|
|
||||||
lSeek+=file_info.size_filename;
|
lSeek+=file_info.size_filename;
|
||||||
if ((err==UNZ_OK) && (szFileName!=NULL))
|
if ((err==UNZ_OK) && (szFileName!=NULL)) {
|
||||||
{
|
|
||||||
uLong uSizeRead ;
|
uLong uSizeRead ;
|
||||||
if (file_info.size_filename<fileNameBufferSize)
|
if (file_info.size_filename<fileNameBufferSize) {
|
||||||
{
|
|
||||||
*(szFileName+file_info.size_filename)='\0';
|
*(szFileName+file_info.size_filename)='\0';
|
||||||
uSizeRead = file_info.size_filename;
|
uSizeRead = file_info.size_filename;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
uSizeRead = fileNameBufferSize;
|
uSizeRead = fileNameBufferSize;
|
||||||
|
|
||||||
if ((file_info.size_filename>0) && (fileNameBufferSize>0))
|
if ((file_info.size_filename>0) && (fileNameBufferSize>0))
|
||||||
@ -681,16 +667,14 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((err==UNZ_OK) && (extraField!=NULL))
|
if ((err==UNZ_OK) && (extraField!=NULL)) {
|
||||||
{
|
|
||||||
uLong uSizeRead ;
|
uLong uSizeRead ;
|
||||||
if (file_info.size_file_extra<extraFieldBufferSize)
|
if (file_info.size_file_extra<extraFieldBufferSize)
|
||||||
uSizeRead = file_info.size_file_extra;
|
uSizeRead = file_info.size_file_extra;
|
||||||
else
|
else
|
||||||
uSizeRead = extraFieldBufferSize;
|
uSizeRead = extraFieldBufferSize;
|
||||||
|
|
||||||
if (lSeek!=0)
|
if (lSeek!=0) {
|
||||||
{
|
|
||||||
if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
|
if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
|
||||||
lSeek=0;
|
lSeek=0;
|
||||||
else
|
else
|
||||||
@ -701,24 +685,19 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
|
|||||||
if (ZREAD(s->z_filefunc, s->filestream,extraField,uSizeRead)!=uSizeRead)
|
if (ZREAD(s->z_filefunc, s->filestream,extraField,uSizeRead)!=uSizeRead)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
lSeek += file_info.size_file_extra - uSizeRead;
|
lSeek += file_info.size_file_extra - uSizeRead;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
lSeek+=file_info.size_file_extra;
|
lSeek+=file_info.size_file_extra;
|
||||||
|
|
||||||
|
|
||||||
if ((err==UNZ_OK) && (szComment!=NULL))
|
if ((err==UNZ_OK) && (szComment!=NULL)) {
|
||||||
{
|
|
||||||
uLong uSizeRead ;
|
uLong uSizeRead ;
|
||||||
if (file_info.size_file_comment<commentBufferSize)
|
if (file_info.size_file_comment<commentBufferSize) {
|
||||||
{
|
|
||||||
*(szComment+file_info.size_file_comment)='\0';
|
*(szComment+file_info.size_file_comment)='\0';
|
||||||
uSizeRead = file_info.size_file_comment;
|
uSizeRead = file_info.size_file_comment;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
uSizeRead = commentBufferSize;
|
uSizeRead = commentBufferSize;
|
||||||
|
|
||||||
if (lSeek!=0)
|
if (lSeek!=0) {
|
||||||
{
|
|
||||||
if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
|
if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
|
||||||
lSeek=0;
|
lSeek=0;
|
||||||
else
|
else
|
||||||
@ -729,8 +708,7 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
|
|||||||
if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead)
|
if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
lSeek+=file_info.size_file_comment - uSizeRead;
|
lSeek+=file_info.size_file_comment - uSizeRead;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
lSeek+=file_info.size_file_comment;
|
lSeek+=file_info.size_file_comment;
|
||||||
|
|
||||||
if ((err==UNZ_OK) && (pfile_info!=NULL))
|
if ((err==UNZ_OK) && (pfile_info!=NULL))
|
||||||
@ -864,14 +842,12 @@ extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity)
|
|||||||
|
|
||||||
err = unzGoToFirstFile(file);
|
err = unzGoToFirstFile(file);
|
||||||
|
|
||||||
while (err == UNZ_OK)
|
while (err == UNZ_OK) {
|
||||||
{
|
|
||||||
char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1];
|
char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1];
|
||||||
err = unzGetCurrentFileInfo(file,NULL,
|
err = unzGetCurrentFileInfo(file,NULL,
|
||||||
szCurrentFileName,sizeof(szCurrentFileName)-1,
|
szCurrentFileName,sizeof(szCurrentFileName)-1,
|
||||||
NULL,0,NULL,0);
|
NULL,0,NULL,0);
|
||||||
if (err == UNZ_OK)
|
if (err == UNZ_OK) {
|
||||||
{
|
|
||||||
if (unzStringFileNameCompare(szCurrentFileName,
|
if (unzStringFileNameCompare(szCurrentFileName,
|
||||||
szFileName,iCaseSensitivity)==0)
|
szFileName,iCaseSensitivity)==0)
|
||||||
return UNZ_OK;
|
return UNZ_OK;
|
||||||
@ -984,8 +960,7 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
|
|||||||
return UNZ_ERRNO;
|
return UNZ_ERRNO;
|
||||||
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
if (err==UNZ_OK) {
|
||||||
{
|
|
||||||
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
|
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
else if (uMagic!=0x04034b50)
|
else if (uMagic!=0x04034b50)
|
||||||
@ -1098,8 +1073,7 @@ extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password)
|
|||||||
pfile_in_zip_read_info->pos_local_extrafield=0;
|
pfile_in_zip_read_info->pos_local_extrafield=0;
|
||||||
pfile_in_zip_read_info->raw=raw;
|
pfile_in_zip_read_info->raw=raw;
|
||||||
|
|
||||||
if (pfile_in_zip_read_info->read_buffer==NULL)
|
if (pfile_in_zip_read_info->read_buffer==NULL) {
|
||||||
{
|
|
||||||
TRYFREE(pfile_in_zip_read_info);
|
TRYFREE(pfile_in_zip_read_info);
|
||||||
return UNZ_INTERNALERROR;
|
return UNZ_INTERNALERROR;
|
||||||
}
|
}
|
||||||
@ -1109,14 +1083,18 @@ extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password)
|
|||||||
if (method!=NULL)
|
if (method!=NULL)
|
||||||
*method = (int)s->cur_file_info.compression_method;
|
*method = (int)s->cur_file_info.compression_method;
|
||||||
|
|
||||||
if (level!=NULL)
|
if (level!=NULL) {
|
||||||
{
|
|
||||||
*level = 6;
|
*level = 6;
|
||||||
switch (s->cur_file_info.flag & 0x06)
|
switch (s->cur_file_info.flag & 0x06) {
|
||||||
{
|
case 6 :
|
||||||
case 6 : *level = 1; break;
|
*level = 1;
|
||||||
case 4 : *level = 2; break;
|
break;
|
||||||
case 2 : *level = 9; break;
|
case 4 :
|
||||||
|
*level = 2;
|
||||||
|
break;
|
||||||
|
case 2 :
|
||||||
|
*level = 9;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1135,8 +1113,7 @@ extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password)
|
|||||||
pfile_in_zip_read_info->stream.total_out = 0;
|
pfile_in_zip_read_info->stream.total_out = 0;
|
||||||
|
|
||||||
if ((s->cur_file_info.compression_method==Z_DEFLATED) &&
|
if ((s->cur_file_info.compression_method==Z_DEFLATED) &&
|
||||||
(!raw))
|
(!raw)) {
|
||||||
{
|
|
||||||
pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
|
pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
|
||||||
pfile_in_zip_read_info->stream.zfree = (free_func)0;
|
pfile_in_zip_read_info->stream.zfree = (free_func)0;
|
||||||
pfile_in_zip_read_info->stream.opaque = (voidpf)0;
|
pfile_in_zip_read_info->stream.opaque = (voidpf)0;
|
||||||
@ -1146,8 +1123,7 @@ extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password)
|
|||||||
err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);
|
err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);
|
||||||
if (err == Z_OK)
|
if (err == Z_OK)
|
||||||
pfile_in_zip_read_info->stream_initialised=1;
|
pfile_in_zip_read_info->stream_initialised=1;
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
TRYFREE(pfile_in_zip_read_info);
|
TRYFREE(pfile_in_zip_read_info);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -1174,8 +1150,7 @@ extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password)
|
|||||||
s->pfile_in_zip_read = pfile_in_zip_read_info;
|
s->pfile_in_zip_read = pfile_in_zip_read_info;
|
||||||
|
|
||||||
# ifndef NOUNCRYPT
|
# ifndef NOUNCRYPT
|
||||||
if (password != NULL)
|
if (password != NULL) {
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
s->pcrc_32_tab = get_crc_table();
|
s->pcrc_32_tab = get_crc_table();
|
||||||
init_keys(password,s->keys,s->pcrc_32_tab);
|
init_keys(password,s->keys,s->pcrc_32_tab);
|
||||||
@ -1270,11 +1245,9 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
|
|||||||
(uInt)pfile_in_zip_read_info->rest_read_compressed+
|
(uInt)pfile_in_zip_read_info->rest_read_compressed+
|
||||||
pfile_in_zip_read_info->stream.avail_in;
|
pfile_in_zip_read_info->stream.avail_in;
|
||||||
|
|
||||||
while (pfile_in_zip_read_info->stream.avail_out>0)
|
while (pfile_in_zip_read_info->stream.avail_out>0) {
|
||||||
{
|
|
||||||
if ((pfile_in_zip_read_info->stream.avail_in==0) &&
|
if ((pfile_in_zip_read_info->stream.avail_in==0) &&
|
||||||
(pfile_in_zip_read_info->rest_read_compressed>0))
|
(pfile_in_zip_read_info->rest_read_compressed>0)) {
|
||||||
{
|
|
||||||
uInt uReadThis = UNZ_BUFSIZE;
|
uInt uReadThis = UNZ_BUFSIZE;
|
||||||
if (pfile_in_zip_read_info->rest_read_compressed<uReadThis)
|
if (pfile_in_zip_read_info->rest_read_compressed<uReadThis)
|
||||||
uReadThis = (uInt)pfile_in_zip_read_info->rest_read_compressed;
|
uReadThis = (uInt)pfile_in_zip_read_info->rest_read_compressed;
|
||||||
@ -1294,8 +1267,7 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
|
|||||||
|
|
||||||
|
|
||||||
# ifndef NOUNCRYPT
|
# ifndef NOUNCRYPT
|
||||||
if(s->encrypted)
|
if (s->encrypted) {
|
||||||
{
|
|
||||||
uInt i;
|
uInt i;
|
||||||
for (i=0;i<uReadThis;i++)
|
for (i=0;i<uReadThis;i++)
|
||||||
pfile_in_zip_read_info->read_buffer[i] =
|
pfile_in_zip_read_info->read_buffer[i] =
|
||||||
@ -1314,8 +1286,7 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
|
|||||||
pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis;
|
pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((pfile_in_zip_read_info->compression_method==0) || (pfile_in_zip_read_info->raw))
|
if ((pfile_in_zip_read_info->compression_method==0) || (pfile_in_zip_read_info->raw)) {
|
||||||
{
|
|
||||||
uInt uDoCopy,i ;
|
uInt uDoCopy,i ;
|
||||||
|
|
||||||
if ((pfile_in_zip_read_info->stream.avail_in == 0) &&
|
if ((pfile_in_zip_read_info->stream.avail_in == 0) &&
|
||||||
@ -1342,9 +1313,7 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
|
|||||||
pfile_in_zip_read_info->stream.next_in += uDoCopy;
|
pfile_in_zip_read_info->stream.next_in += uDoCopy;
|
||||||
pfile_in_zip_read_info->stream.total_out += uDoCopy;
|
pfile_in_zip_read_info->stream.total_out += uDoCopy;
|
||||||
iRead += uDoCopy;
|
iRead += uDoCopy;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
uLong uTotalOutBefore,uTotalOutAfter;
|
uLong uTotalOutBefore,uTotalOutAfter;
|
||||||
const Bytef *bufBefore;
|
const Bytef *bufBefore;
|
||||||
uLong uOutThis;
|
uLong uOutThis;
|
||||||
@ -1513,8 +1482,7 @@ extern int ZEXPORT unzCloseCurrentFile (file)
|
|||||||
|
|
||||||
|
|
||||||
if ((pfile_in_zip_read_info->rest_read_uncompressed == 0) &&
|
if ((pfile_in_zip_read_info->rest_read_uncompressed == 0) &&
|
||||||
(!pfile_in_zip_read_info->raw))
|
(!pfile_in_zip_read_info->raw)) {
|
||||||
{
|
|
||||||
if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait)
|
if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait)
|
||||||
err=UNZ_CRCERROR;
|
err=UNZ_CRCERROR;
|
||||||
}
|
}
|
||||||
@ -1557,8 +1525,7 @@ extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf)
|
|||||||
if (ZSEEK(s->z_filefunc,s->filestream,s->central_pos+22,ZLIB_FILEFUNC_SEEK_SET)!=0)
|
if (ZSEEK(s->z_filefunc,s->filestream,s->central_pos+22,ZLIB_FILEFUNC_SEEK_SET)!=0)
|
||||||
return UNZ_ERRNO;
|
return UNZ_ERRNO;
|
||||||
|
|
||||||
if (uReadThis>0)
|
if (uReadThis>0) {
|
||||||
{
|
|
||||||
*szComment='\0';
|
*szComment='\0';
|
||||||
if (ZREAD(s->z_filefunc,s->filestream,szComment,uReadThis)!=uReadThis)
|
if (ZREAD(s->z_filefunc,s->filestream,szComment,uReadThis)!=uReadThis)
|
||||||
return UNZ_ERRNO;
|
return UNZ_ERRNO;
|
||||||
|
@ -60,7 +60,9 @@ extern "C" {
|
|||||||
#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
|
#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
|
||||||
/* like the STRICT of WIN32, we define a pointer that cannot be converted
|
/* like the STRICT of WIN32, we define a pointer that cannot be converted
|
||||||
from (void*) without cast */
|
from (void*) without cast */
|
||||||
typedef struct TagunzFile__ { int unused; } unzFile__;
|
typedef struct TagunzFile__ {
|
||||||
|
int unused;
|
||||||
|
} unzFile__;
|
||||||
typedef unzFile__ *unzFile;
|
typedef unzFile__ *unzFile;
|
||||||
#else
|
#else
|
||||||
typedef voidp unzFile;
|
typedef voidp unzFile;
|
||||||
@ -77,8 +79,7 @@ typedef voidp unzFile;
|
|||||||
#define UNZ_CRCERROR (-105)
|
#define UNZ_CRCERROR (-105)
|
||||||
|
|
||||||
/* tm_unz contain date/time info */
|
/* tm_unz contain date/time info */
|
||||||
typedef struct tm_unz_s
|
typedef struct tm_unz_s {
|
||||||
{
|
|
||||||
uInt tm_sec; /* seconds after the minute - [0,59] */
|
uInt tm_sec; /* seconds after the minute - [0,59] */
|
||||||
uInt tm_min; /* minutes after the hour - [0,59] */
|
uInt tm_min; /* minutes after the hour - [0,59] */
|
||||||
uInt tm_hour; /* hours since midnight - [0,23] */
|
uInt tm_hour; /* hours since midnight - [0,23] */
|
||||||
@ -89,8 +90,7 @@ typedef struct tm_unz_s
|
|||||||
|
|
||||||
/* unz_global_info structure contain global data about the ZIPfile
|
/* unz_global_info structure contain global data about the ZIPfile
|
||||||
These data comes from the end of central dir */
|
These data comes from the end of central dir */
|
||||||
typedef struct unz_global_info_s
|
typedef struct unz_global_info_s {
|
||||||
{
|
|
||||||
uLong number_entry; /* total number of entries in
|
uLong number_entry; /* total number of entries in
|
||||||
the central dir on this disk */
|
the central dir on this disk */
|
||||||
uLong size_comment; /* size of the global comment of the zipfile */
|
uLong size_comment; /* size of the global comment of the zipfile */
|
||||||
@ -98,8 +98,7 @@ typedef struct unz_global_info_s
|
|||||||
|
|
||||||
|
|
||||||
/* unz_file_info contain information about a file in the zipfile */
|
/* unz_file_info contain information about a file in the zipfile */
|
||||||
typedef struct unz_file_info_s
|
typedef struct unz_file_info_s {
|
||||||
{
|
|
||||||
uLong version; /* version made by 2 bytes */
|
uLong version; /* version made by 2 bytes */
|
||||||
uLong version_needed; /* version needed to extract 2 bytes */
|
uLong version_needed; /* version needed to extract 2 bytes */
|
||||||
uLong flag; /* general purpose bit flag 2 bytes */
|
uLong flag; /* general purpose bit flag 2 bytes */
|
||||||
@ -207,8 +206,7 @@ extern int ZEXPORT unzLocateFile OF((unzFile file,
|
|||||||
/* ****************************************** */
|
/* ****************************************** */
|
||||||
/* Ryan supplied functions */
|
/* Ryan supplied functions */
|
||||||
/* unz_file_info contain information about a file in the zipfile */
|
/* unz_file_info contain information about a file in the zipfile */
|
||||||
typedef struct unz_file_pos_s
|
typedef struct unz_file_pos_s {
|
||||||
{
|
|
||||||
uLong pos_in_zip_directory; /* offset in zip file directory */
|
uLong pos_in_zip_directory; /* offset in zip file directory */
|
||||||
uLong num_of_file; /* # of file */
|
uLong num_of_file; /* # of file */
|
||||||
} unz_file_pos;
|
} unz_file_pos;
|
||||||
|
@ -11,8 +11,7 @@
|
|||||||
|
|
||||||
/** Alternate dolloader made by WiiPower modified by dimok **/
|
/** Alternate dolloader made by WiiPower modified by dimok **/
|
||||||
|
|
||||||
bool Load_Dol(void **buffer, int* dollen, char * filepath)
|
bool Load_Dol(void **buffer, int* dollen, char * filepath) {
|
||||||
{
|
|
||||||
int ret;
|
int ret;
|
||||||
FILE* file;
|
FILE* file;
|
||||||
void* dol_buffer;
|
void* dol_buffer;
|
||||||
@ -28,8 +27,7 @@ bool Load_Dol(void **buffer, int* dollen, char * filepath)
|
|||||||
|
|
||||||
file = fopen(fullpath, "rb");
|
file = fopen(fullpath, "rb");
|
||||||
|
|
||||||
if(file == NULL)
|
if (file == NULL) {
|
||||||
{
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
SDCard_deInit();
|
SDCard_deInit();
|
||||||
USBDevice_deInit();
|
USBDevice_deInit();
|
||||||
@ -42,16 +40,14 @@ bool Load_Dol(void **buffer, int* dollen, char * filepath)
|
|||||||
fseek(file, 0, SEEK_SET);
|
fseek(file, 0, SEEK_SET);
|
||||||
|
|
||||||
dol_buffer = malloc(filesize);
|
dol_buffer = malloc(filesize);
|
||||||
if (dol_buffer == NULL)
|
if (dol_buffer == NULL) {
|
||||||
{
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
SDCard_deInit();
|
SDCard_deInit();
|
||||||
USBDevice_deInit();
|
USBDevice_deInit();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ret = fread( dol_buffer, 1, filesize, file);
|
ret = fread( dol_buffer, 1, filesize, file);
|
||||||
if(ret != filesize)
|
if (ret != filesize) {
|
||||||
{
|
|
||||||
free(dol_buffer);
|
free(dol_buffer);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
SDCard_deInit();
|
SDCard_deInit();
|
||||||
@ -67,18 +63,15 @@ bool Load_Dol(void **buffer, int* dollen, char * filepath)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Remove_001_Protection(void *Address, int Size)
|
bool Remove_001_Protection(void *Address, int Size) {
|
||||||
{
|
|
||||||
u8 SearchPattern[16] = { 0x40, 0x82, 0x00, 0x0C, 0x38, 0x60, 0x00, 0x01, 0x48, 0x00, 0x02, 0x44, 0x38, 0x61, 0x00, 0x18 };
|
u8 SearchPattern[16] = { 0x40, 0x82, 0x00, 0x0C, 0x38, 0x60, 0x00, 0x01, 0x48, 0x00, 0x02, 0x44, 0x38, 0x61, 0x00, 0x18 };
|
||||||
u8 PatchData[16] = { 0x40, 0x82, 0x00, 0x04, 0x38, 0x60, 0x00, 0x01, 0x48, 0x00, 0x02, 0x44, 0x38, 0x61, 0x00, 0x18 };
|
u8 PatchData[16] = { 0x40, 0x82, 0x00, 0x04, 0x38, 0x60, 0x00, 0x01, 0x48, 0x00, 0x02, 0x44, 0x38, 0x61, 0x00, 0x18 };
|
||||||
|
|
||||||
void *Addr = Address;
|
void *Addr = Address;
|
||||||
void *Addr_end = Address+Size;
|
void *Addr_end = Address+Size;
|
||||||
|
|
||||||
while(Addr <= Addr_end-sizeof(SearchPattern))
|
while (Addr <= Addr_end-sizeof(SearchPattern)) {
|
||||||
{
|
if (memcmp(Addr, SearchPattern, sizeof(SearchPattern))==0) {
|
||||||
if(memcmp(Addr, SearchPattern, sizeof(SearchPattern))==0)
|
|
||||||
{
|
|
||||||
memcpy(Addr,PatchData,sizeof(PatchData));
|
memcpy(Addr,PatchData,sizeof(PatchData));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -133,14 +126,11 @@ u32 load_dol_image(void *dolstart) {
|
|||||||
static int i;
|
static int i;
|
||||||
static int phase;
|
static int phase;
|
||||||
|
|
||||||
u32 load_dol_start(void *dolstart)
|
u32 load_dol_start(void *dolstart) {
|
||||||
{
|
if (dolstart) {
|
||||||
if (dolstart)
|
|
||||||
{
|
|
||||||
dolfile = (dolheader *)dolstart;
|
dolfile = (dolheader *)dolstart;
|
||||||
return dolfile->entry_point;
|
return dolfile->entry_point;
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,23 +141,17 @@ u32 load_dol_start(void *dolstart)
|
|||||||
i = 0;
|
i = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool load_dol_image_modified(void **offset, u32 *pos, u32 *len)
|
bool load_dol_image_modified(void **offset, u32 *pos, u32 *len) {
|
||||||
{
|
if (phase == 0) {
|
||||||
if (phase == 0)
|
if (i == 7) {
|
||||||
{
|
|
||||||
if (i == 7)
|
|
||||||
{
|
|
||||||
phase = 1;
|
phase = 1;
|
||||||
i = 0;
|
i = 0;
|
||||||
} else
|
} else {
|
||||||
{
|
if ((!dolfile->text_size[i]) || (dolfile->text_start[i] < 0x100)) {
|
||||||
if ((!dolfile->text_size[i]) || (dolfile->text_start[i] < 0x100))
|
|
||||||
{
|
|
||||||
*offset = 0;
|
*offset = 0;
|
||||||
*pos = 0;
|
*pos = 0;
|
||||||
*len = 0;
|
*len = 0;
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
*offset = (void *)dolfile->text_start[i];
|
*offset = (void *)dolfile->text_start[i];
|
||||||
*pos = dolfile->text_pos[i];
|
*pos = dolfile->text_pos[i];
|
||||||
*len = dolfile->text_size[i];
|
*len = dolfile->text_size[i];
|
||||||
@ -177,21 +161,17 @@ bool load_dol_image_modified(void **offset, u32 *pos, u32 *len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (phase == 1)
|
if (phase == 1) {
|
||||||
{
|
if (i == 11) {
|
||||||
if (i == 11)
|
|
||||||
{
|
|
||||||
phase = 2;
|
phase = 2;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!dolfile->data_size[i]) || (dolfile->data_start[i] < 0x100))
|
if ((!dolfile->data_size[i]) || (dolfile->data_start[i] < 0x100)) {
|
||||||
{
|
|
||||||
*offset = 0;
|
*offset = 0;
|
||||||
*pos = 0;
|
*pos = 0;
|
||||||
*len = 0;
|
*len = 0;
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
*offset = (void *)dolfile->data_start[i];
|
*offset = (void *)dolfile->data_start[i];
|
||||||
*pos = dolfile->data_pos[i];
|
*pos = dolfile->data_pos[i];
|
||||||
*len = dolfile->data_size[i];
|
*len = dolfile->data_size[i];
|
||||||
@ -202,15 +182,13 @@ bool load_dol_image_modified(void **offset, u32 *pos, u32 *len)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 Load_Dol_from_disc(u32 doloffset, u8 videoSelected, u8 patchcountrystring, u8 vipatch)
|
u32 Load_Dol_from_disc(u32 doloffset, u8 videoSelected, u8 patchcountrystring, u8 vipatch) {
|
||||||
{
|
|
||||||
int ret;
|
int ret;
|
||||||
void *dol_header;
|
void *dol_header;
|
||||||
u32 entrypoint;
|
u32 entrypoint;
|
||||||
|
|
||||||
dol_header = memalign(32, sizeof(dolheader));
|
dol_header = memalign(32, sizeof(dolheader));
|
||||||
if (dol_header == NULL)
|
if (dol_header == NULL) {
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,8 +196,7 @@ u32 Load_Dol_from_disc(u32 doloffset, u8 videoSelected, u8 patchcountrystring, u
|
|||||||
|
|
||||||
entrypoint = load_dol_start(dol_header);
|
entrypoint = load_dol_start(dol_header);
|
||||||
|
|
||||||
if (entrypoint == 0)
|
if (entrypoint == 0) {
|
||||||
{
|
|
||||||
free(dol_header);
|
free(dol_header);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -228,10 +205,8 @@ u32 Load_Dol_from_disc(u32 doloffset, u8 videoSelected, u8 patchcountrystring, u
|
|||||||
u32 pos;
|
u32 pos;
|
||||||
u32 len;
|
u32 len;
|
||||||
|
|
||||||
while (load_dol_image_modified(&offset, &pos, &len))
|
while (load_dol_image_modified(&offset, &pos, &len)) {
|
||||||
{
|
if (len != 0) {
|
||||||
if (len != 0)
|
|
||||||
{
|
|
||||||
ret = WDVD_Read(offset, len, (doloffset<<2) + pos);
|
ret = WDVD_Read(offset, len, (doloffset<<2) + pos);
|
||||||
|
|
||||||
DCFlushRange(offset, len);
|
DCFlushRange(offset, len);
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
#define _ALTERNATEDOL_H_
|
#define _ALTERNATEDOL_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* not the full path is needed here, the path where the dol is */
|
/* not the full path is needed here, the path where the dol is */
|
||||||
|
@ -34,14 +34,12 @@ static u8 *appldr = (u8 *)0x81200000;
|
|||||||
static u32 buffer[0x20] ATTRIBUTE_ALIGN(32);
|
static u32 buffer[0x20] ATTRIBUTE_ALIGN(32);
|
||||||
struct SSettings Settings;
|
struct SSettings Settings;
|
||||||
|
|
||||||
static void __noprint(const char *fmt, ...)
|
static void __noprint(const char *fmt, ...) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool compare_videomodes(GXRModeObj* mode1, GXRModeObj* mode2)
|
bool compare_videomodes(GXRModeObj* mode1, GXRModeObj* mode2) {
|
||||||
{
|
|
||||||
if (mode1->viTVMode != mode2->viTVMode || mode1->fbWidth != mode2->fbWidth || mode1->efbHeight != mode2->efbHeight || mode1->xfbHeight != mode2->xfbHeight ||
|
if (mode1->viTVMode != mode2->viTVMode || mode1->fbWidth != mode2->fbWidth || mode1->efbHeight != mode2->efbHeight || mode1->xfbHeight != mode2->xfbHeight ||
|
||||||
mode1->viXOrigin != mode2->viXOrigin || mode1->viYOrigin != mode2->viYOrigin || mode1->viWidth != mode2->viWidth || mode1->viHeight != mode2->viHeight ||
|
mode1->viXOrigin != mode2->viXOrigin || mode1->viYOrigin != mode2->viYOrigin || mode1->viWidth != mode2->viWidth || mode1->viHeight != mode2->viHeight ||
|
||||||
mode1->xfbMode != mode2->xfbMode || mode1->field_rendering != mode2->field_rendering || mode1->aa != mode2->aa || mode1->sample_pattern[0][0] != mode2->sample_pattern[0][0] ||
|
mode1->xfbMode != mode2->xfbMode || mode1->field_rendering != mode2->field_rendering || mode1->aa != mode2->aa || mode1->sample_pattern[0][0] != mode2->sample_pattern[0][0] ||
|
||||||
@ -58,18 +56,15 @@ bool compare_videomodes(GXRModeObj* mode1, GXRModeObj* mode2)
|
|||||||
mode1->sample_pattern[9][1] != mode2->sample_pattern[9][1] || mode1->sample_pattern[10][1] != mode2->sample_pattern[10][1] ||
|
mode1->sample_pattern[9][1] != mode2->sample_pattern[9][1] || mode1->sample_pattern[10][1] != mode2->sample_pattern[10][1] ||
|
||||||
mode1->sample_pattern[11][1] != mode2->sample_pattern[11][1] || mode1->vfilter[0] != mode2->vfilter[0] ||
|
mode1->sample_pattern[11][1] != mode2->sample_pattern[11][1] || mode1->vfilter[0] != mode2->vfilter[0] ||
|
||||||
mode1->vfilter[1] != mode2->vfilter[1] || mode1->vfilter[2] != mode2->vfilter[2] || mode1->vfilter[3] != mode2->vfilter[3] || mode1->vfilter[4] != mode2->vfilter[4] ||
|
mode1->vfilter[1] != mode2->vfilter[1] || mode1->vfilter[2] != mode2->vfilter[2] || mode1->vfilter[3] != mode2->vfilter[3] || mode1->vfilter[4] != mode2->vfilter[4] ||
|
||||||
mode1->vfilter[5] != mode2->vfilter[5] || mode1->vfilter[6] != mode2->vfilter[6] )
|
mode1->vfilter[5] != mode2->vfilter[5] || mode1->vfilter[6] != mode2->vfilter[6] ) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void patch_videomode(GXRModeObj* mode1, GXRModeObj* mode2)
|
void patch_videomode(GXRModeObj* mode1, GXRModeObj* mode2) {
|
||||||
{
|
|
||||||
mode1->viTVMode = mode2->viTVMode;
|
mode1->viTVMode = mode2->viTVMode;
|
||||||
mode1->fbWidth = mode2->fbWidth;
|
mode1->fbWidth = mode2->fbWidth;
|
||||||
mode1->efbHeight = mode2->efbHeight;
|
mode1->efbHeight = mode2->efbHeight;
|
||||||
@ -187,19 +182,16 @@ GXRModeObj* NTSC2PAL60[]={
|
|||||||
&TVNtsc480Prog, &TVEurgb60Hz480Prog,
|
&TVNtsc480Prog, &TVEurgb60Hz480Prog,
|
||||||
0,0
|
0,0
|
||||||
};
|
};
|
||||||
bool Search_and_patch_Video_Modes(void *Address, u32 Size, GXRModeObj* Table[])
|
bool Search_and_patch_Video_Modes(void *Address, u32 Size, GXRModeObj* Table[]) {
|
||||||
{
|
|
||||||
u8 *Addr = (u8 *)Address;
|
u8 *Addr = (u8 *)Address;
|
||||||
bool found = 0;
|
bool found = 0;
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
while(Size >= sizeof(GXRModeObj))
|
while (Size >= sizeof(GXRModeObj)) {
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for(i = 0; Table[i]; i+=2)
|
for (i = 0; Table[i]; i+=2) {
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
if (compare_videomodes(Table[i], (GXRModeObj*)Addr))
|
if (compare_videomodes(Table[i], (GXRModeObj*)Addr))
|
||||||
@ -222,39 +214,31 @@ bool Search_and_patch_Video_Modes(void *Address, u32 Size, GXRModeObj* Table[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Anti 002 fix for IOS 249 rev < 12 thanks to WiiPower **/
|
/** Anti 002 fix for IOS 249 rev < 12 thanks to WiiPower **/
|
||||||
void Anti_002_fix(void *Address, int Size)
|
void Anti_002_fix(void *Address, int Size) {
|
||||||
{
|
|
||||||
u8 SearchPattern[12] = { 0x2C, 0x00, 0x00, 0x00, 0x48, 0x00, 0x02, 0x14, 0x3C, 0x60, 0x80, 0x00 };
|
u8 SearchPattern[12] = { 0x2C, 0x00, 0x00, 0x00, 0x48, 0x00, 0x02, 0x14, 0x3C, 0x60, 0x80, 0x00 };
|
||||||
u8 PatchData[12] = { 0x2C, 0x00, 0x00, 0x00, 0x40, 0x82, 0x02, 0x14, 0x3C, 0x60, 0x80, 0x00 };
|
u8 PatchData[12] = { 0x2C, 0x00, 0x00, 0x00, 0x40, 0x82, 0x02, 0x14, 0x3C, 0x60, 0x80, 0x00 };
|
||||||
|
|
||||||
void *Addr = Address;
|
void *Addr = Address;
|
||||||
void *Addr_end = Address+Size;
|
void *Addr_end = Address+Size;
|
||||||
|
|
||||||
while(Addr <= Addr_end-sizeof(SearchPattern))
|
while (Addr <= Addr_end-sizeof(SearchPattern)) {
|
||||||
{
|
if (memcmp(Addr, SearchPattern, sizeof(SearchPattern))==0) {
|
||||||
if(memcmp(Addr, SearchPattern, sizeof(SearchPattern))==0)
|
|
||||||
{
|
|
||||||
memcpy(Addr,PatchData,sizeof(PatchData));
|
memcpy(Addr,PatchData,sizeof(PatchData));
|
||||||
}
|
}
|
||||||
Addr += 4;
|
Addr += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void gamepatches(void * dst, int len, u8 videoSelected, u8 patchcountrystring, u8 vipatch)
|
void gamepatches(void * dst, int len, u8 videoSelected, u8 patchcountrystring, u8 vipatch) {
|
||||||
{
|
|
||||||
GXRModeObj** table = NULL;
|
GXRModeObj** table = NULL;
|
||||||
if (videoSelected == 5) // patch
|
if (videoSelected == 5) // patch
|
||||||
|
|
||||||
{
|
{
|
||||||
switch(CONF_GetVideo())
|
switch (CONF_GetVideo()) {
|
||||||
{
|
|
||||||
case CONF_VIDEO_PAL:
|
case CONF_VIDEO_PAL:
|
||||||
if(CONF_GetEuRGB60() > 0)
|
if (CONF_GetEuRGB60() > 0) {
|
||||||
{
|
|
||||||
table = NTSC2PAL60;
|
table = NTSC2PAL60;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
table = NTSC2PAL;
|
table = NTSC2PAL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -294,8 +278,7 @@ void gamepatches(void * dst, int len, u8 videoSelected, u8 patchcountrystring, u
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol, u32 alternatedoloffset)
|
s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol, u32 alternatedoloffset) {
|
||||||
{
|
|
||||||
app_entry appldr_entry;
|
app_entry appldr_entry;
|
||||||
app_init appldr_init;
|
app_init appldr_init;
|
||||||
app_main appldr_main;
|
app_main appldr_main;
|
||||||
@ -331,8 +314,7 @@ s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8
|
|||||||
*(u32 *)0x80003140 = *(u32 *)0x80003188;
|
*(u32 *)0x80003140 = *(u32 *)0x80003188;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cheat)
|
if (cheat) {
|
||||||
{
|
|
||||||
/*HOOKS STUFF - FISHEARS*/
|
/*HOOKS STUFF - FISHEARS*/
|
||||||
memset((void*)0x80001800,0,kenobiwii_size);
|
memset((void*)0x80001800,0,kenobiwii_size);
|
||||||
memcpy((void*)0x80001800,kenobiwii,kenobiwii_size);
|
memcpy((void*)0x80001800,kenobiwii,kenobiwii_size);
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
#define _APPLOADER_H_
|
#define _APPLOADER_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Entry point */
|
/* Entry point */
|
||||||
|
@ -22,8 +22,7 @@ static u8 *diskid = (u8 *)0x80000000;
|
|||||||
static char gameid[8];
|
static char gameid[8];
|
||||||
|
|
||||||
|
|
||||||
void __Disc_SetLowMem(void)
|
void __Disc_SetLowMem(void) {
|
||||||
{
|
|
||||||
*(vu32 *)0x80000020 = 0x0D15EA5E; // Standard Boot Code
|
*(vu32 *)0x80000020 = 0x0D15EA5E; // Standard Boot Code
|
||||||
*(vu32 *)0x80000024 = 0x00000001; // Version
|
*(vu32 *)0x80000024 = 0x00000001; // Version
|
||||||
|
|
||||||
@ -45,7 +44,9 @@ void __Disc_SetLowMem(void)
|
|||||||
(strcmp(tempTxt,"R3XP6V")==0))/*&&
|
(strcmp(tempTxt,"R3XP6V")==0))/*&&
|
||||||
(IOS_GetVersion()==249)&&
|
(IOS_GetVersion()==249)&&
|
||||||
((IOS_GetRevision()==10)||(IOS_GetRevision()==13)) I left out the ios check to see if works with other ios versions.*/
|
((IOS_GetRevision()==10)||(IOS_GetRevision()==13)) I left out the ios check to see if works with other ios versions.*/
|
||||||
{*(vu32*)0x80003184 = 0x80000000;} // Game ID Address
|
{
|
||||||
|
*(vu32*)0x80003184 = 0x80000000; // Game ID Address
|
||||||
|
}
|
||||||
|
|
||||||
/* Copy disc ID */
|
/* Copy disc ID */
|
||||||
memcpy((void *)0x80003180, (void *)0x80000000, 4);
|
memcpy((void *)0x80003180, (void *)0x80000000, 4);
|
||||||
@ -54,8 +55,7 @@ void __Disc_SetLowMem(void)
|
|||||||
DCFlushRange((void *)0x80000000, 0x3F00);
|
DCFlushRange((void *)0x80000000, 0x3F00);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __Disc_SetVMode(u8 videoselected)
|
void __Disc_SetVMode(u8 videoselected) {
|
||||||
{
|
|
||||||
GXRModeObj *vmode = NULL;
|
GXRModeObj *vmode = NULL;
|
||||||
|
|
||||||
u32 progressive, tvmode, vmode_reg = 0;
|
u32 progressive, tvmode, vmode_reg = 0;
|
||||||
@ -146,8 +146,7 @@ void __Disc_SetVMode(u8 videoselected)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void __Disc_SetTime(void)
|
void __Disc_SetTime(void) {
|
||||||
{
|
|
||||||
/* Extern */
|
/* Extern */
|
||||||
extern void settime(u64);
|
extern void settime(u64);
|
||||||
|
|
||||||
@ -155,8 +154,7 @@ void __Disc_SetTime(void)
|
|||||||
settime(secs_to_ticks(time(NULL) - 946684800));
|
settime(secs_to_ticks(time(NULL) - 946684800));
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 __Disc_FindPartition(u64 *outbuf)
|
s32 __Disc_FindPartition(u64 *outbuf) {
|
||||||
{
|
|
||||||
u64 offset = 0, table_offset = 0;
|
u64 offset = 0, table_offset = 0;
|
||||||
|
|
||||||
u32 cnt, nb_partitions;
|
u32 cnt, nb_partitions;
|
||||||
@ -196,14 +194,12 @@ s32 __Disc_FindPartition(u64 *outbuf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
s32 Disc_Init(void)
|
s32 Disc_Init(void) {
|
||||||
{
|
|
||||||
/* Init DVD subsystem */
|
/* Init DVD subsystem */
|
||||||
return WDVD_Init();
|
return WDVD_Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 Disc_Open(void)
|
s32 Disc_Open(void) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
/* Reset drive */
|
/* Reset drive */
|
||||||
@ -215,8 +211,7 @@ s32 Disc_Open(void)
|
|||||||
return WDVD_ReadDiskId(diskid);
|
return WDVD_ReadDiskId(diskid);
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 Disc_Wait(void)
|
s32 Disc_Wait(void) {
|
||||||
{
|
|
||||||
u32 cover = 0;
|
u32 cover = 0;
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
@ -231,20 +226,17 @@ s32 Disc_Wait(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 Disc_SetUSB(u8 *id)
|
s32 Disc_SetUSB(u8 *id) {
|
||||||
{
|
|
||||||
/* Set USB mode */
|
/* Set USB mode */
|
||||||
return WDVD_SetUSBMode(id);
|
return WDVD_SetUSBMode(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 Disc_ReadHeader(void *outbuf)
|
s32 Disc_ReadHeader(void *outbuf) {
|
||||||
{
|
|
||||||
/* Read disc header */
|
/* Read disc header */
|
||||||
return WDVD_UnencryptedRead(outbuf, sizeof(struct discHdr), 0);
|
return WDVD_UnencryptedRead(outbuf, sizeof(struct discHdr), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 Disc_IsWii(void)
|
s32 Disc_IsWii(void) {
|
||||||
{
|
|
||||||
struct discHdr *header = (struct discHdr *)buffer;
|
struct discHdr *header = (struct discHdr *)buffer;
|
||||||
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
@ -261,8 +253,7 @@ s32 Disc_IsWii(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 Disc_BootPartition(u64 offset, u8 videoselected, u8 cheat, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol, u32 alternatedoloffset)
|
s32 Disc_BootPartition(u64 offset, u8 videoselected, u8 cheat, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol, u32 alternatedoloffset) {
|
||||||
{
|
|
||||||
entry_point p_entry;
|
entry_point p_entry;
|
||||||
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
@ -308,8 +299,7 @@ s32 Disc_BootPartition(u64 offset, u8 videoselected, u8 cheat, u8 vipatch, u8 pa
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 Disc_WiiBoot(u8 videoselected, u8 cheat, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol, u32 alternatedoloffset)
|
s32 Disc_WiiBoot(u8 videoselected, u8 cheat, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol, u32 alternatedoloffset) {
|
||||||
{
|
|
||||||
u64 offset;
|
u64 offset;
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
@ -322,16 +312,14 @@ s32 Disc_WiiBoot(u8 videoselected, u8 cheat, u8 vipatch, u8 patchcountrystring,
|
|||||||
return Disc_BootPartition(offset, videoselected, cheat, vipatch, patchcountrystring, error002fix, alternatedol, alternatedoloffset);
|
return Disc_BootPartition(offset, videoselected, cheat, vipatch, patchcountrystring, error002fix, alternatedol, alternatedoloffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PatchCountryStrings(void *Address, int Size)
|
void PatchCountryStrings(void *Address, int Size) {
|
||||||
{
|
|
||||||
u8 SearchPattern[4] = { 0x00, 0x00, 0x00, 0x00 };
|
u8 SearchPattern[4] = { 0x00, 0x00, 0x00, 0x00 };
|
||||||
u8 PatchData[4] = { 0x00, 0x00, 0x00, 0x00 };
|
u8 PatchData[4] = { 0x00, 0x00, 0x00, 0x00 };
|
||||||
u8 *Addr = (u8*)Address;
|
u8 *Addr = (u8*)Address;
|
||||||
|
|
||||||
int wiiregion = CONF_GetRegion();
|
int wiiregion = CONF_GetRegion();
|
||||||
|
|
||||||
switch (wiiregion)
|
switch (wiiregion) {
|
||||||
{
|
|
||||||
case CONF_REGION_JP:
|
case CONF_REGION_JP:
|
||||||
SearchPattern[0] = 0x00;
|
SearchPattern[0] = 0x00;
|
||||||
SearchPattern[1] = 0x4A; // J
|
SearchPattern[1] = 0x4A; // J
|
||||||
@ -359,8 +347,7 @@ void PatchCountryStrings(void *Address, int Size)
|
|||||||
SearchPattern[2] = 0x53; // S
|
SearchPattern[2] = 0x53; // S
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (diskid[3])
|
switch (diskid[3]) {
|
||||||
{
|
|
||||||
case 'J':
|
case 'J':
|
||||||
PatchData[1] = 0x4A; // J
|
PatchData[1] = 0x4A; // J
|
||||||
PatchData[2] = 0x50; // P
|
PatchData[2] = 0x50; // P
|
||||||
@ -381,10 +368,8 @@ void PatchCountryStrings(void *Address, int Size)
|
|||||||
PatchData[2] = 0x53; // S
|
PatchData[2] = 0x53; // S
|
||||||
}
|
}
|
||||||
|
|
||||||
while (Size >= 4)
|
while (Size >= 4) {
|
||||||
{
|
if (Addr[0] == SearchPattern[0] && Addr[1] == SearchPattern[1] && Addr[2] == SearchPattern[2] && Addr[3] == SearchPattern[3]) {
|
||||||
if (Addr[0] == SearchPattern[0] && Addr[1] == SearchPattern[1] && Addr[2] == SearchPattern[2] && Addr[3] == SearchPattern[3])
|
|
||||||
{
|
|
||||||
//*Addr = PatchData[0];
|
//*Addr = PatchData[0];
|
||||||
Addr += 1;
|
Addr += 1;
|
||||||
*Addr = PatchData[1];
|
*Addr = PatchData[1];
|
||||||
@ -394,8 +379,7 @@ void PatchCountryStrings(void *Address, int Size)
|
|||||||
//*Addr = PatchData[3];
|
//*Addr = PatchData[3];
|
||||||
Addr += 1;
|
Addr += 1;
|
||||||
Size -= 4;
|
Size -= 4;
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
Addr += 4;
|
Addr += 4;
|
||||||
Size -= 4;
|
Size -= 4;
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,10 @@
|
|||||||
#define _DISC_H_
|
#define _DISC_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
/* Disc header structure */
|
/* Disc header structure */
|
||||||
struct discHdr
|
struct discHdr {
|
||||||
{
|
|
||||||
/* Game ID */
|
/* Game ID */
|
||||||
u8 id[6];
|
u8 id[6];
|
||||||
|
|
||||||
|
@ -3,44 +3,35 @@
|
|||||||
#include "fstfile.h"
|
#include "fstfile.h"
|
||||||
|
|
||||||
|
|
||||||
char *fstfiles(FST_ENTRY *fst, u32 index)
|
char *fstfiles(FST_ENTRY *fst, u32 index) {
|
||||||
{
|
|
||||||
u32 count = fst[0].filelen;
|
u32 count = fst[0].filelen;
|
||||||
u32 stringoffset;
|
u32 stringoffset;
|
||||||
if (index < count)
|
if (index < count) {
|
||||||
{
|
|
||||||
stringoffset = *(u32 *)&(fst[index]) % (256*256*256);
|
stringoffset = *(u32 *)&(fst[index]) % (256*256*256);
|
||||||
return (char *)((u32)fst + count*12 + stringoffset);
|
return (char *)((u32)fst + count*12 + stringoffset);
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char *fstfilename(u32 index)
|
char *fstfilename(u32 index) {
|
||||||
{
|
|
||||||
FST_ENTRY *fst = (FST_ENTRY *)*(u32 *)0x80000038;
|
FST_ENTRY *fst = (FST_ENTRY *)*(u32 *)0x80000038;
|
||||||
u32 count = fst[0].filelen;
|
u32 count = fst[0].filelen;
|
||||||
u32 stringoffset;
|
u32 stringoffset;
|
||||||
if (index < count)
|
if (index < count) {
|
||||||
{
|
|
||||||
stringoffset = *(u32 *)&(fst[index]) % (256*256*256);
|
stringoffset = *(u32 *)&(fst[index]) % (256*256*256);
|
||||||
return (char *)(*(u32 *)0x80000038 + count*12 + stringoffset);
|
return (char *)(*(u32 *)0x80000038 + count*12 + stringoffset);
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 fstfileoffset(u32 index)
|
u32 fstfileoffset(u32 index) {
|
||||||
{
|
|
||||||
FST_ENTRY *fst = (FST_ENTRY *)*(u32 *)0x80000038;
|
FST_ENTRY *fst = (FST_ENTRY *)*(u32 *)0x80000038;
|
||||||
u32 count = fst[0].filelen;
|
u32 count = fst[0].filelen;
|
||||||
if (index < count)
|
if (index < count) {
|
||||||
{
|
|
||||||
return fst[index].fileoffset;
|
return fst[index].fileoffset;
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
#define _FSTFILE_H_
|
#define _FSTFILE_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -29,8 +29,7 @@ s32 __Menu_EntryCmp(const void *a, const void *b)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 __Menu_EntryCmpCount(const void *a, const void *b)
|
s32 __Menu_EntryCmpCount(const void *a, const void *b) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
struct discHdr *hdr1 = (struct discHdr *)a;
|
struct discHdr *hdr1 = (struct discHdr *)a;
|
||||||
@ -58,8 +57,7 @@ s32 __Menu_EntryCmpCount(const void *a, const void *b)
|
|||||||
* Get Gamelist
|
* Get Gamelist
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
int __Menu_GetEntries(int t)
|
int __Menu_GetEntries(int t) {
|
||||||
{
|
|
||||||
struct discHdr *buffer = NULL;
|
struct discHdr *buffer = NULL;
|
||||||
struct discHdr *buffer2 = NULL;
|
struct discHdr *buffer2 = NULL;
|
||||||
struct discHdr *header = NULL;
|
struct discHdr *header = NULL;
|
||||||
@ -94,8 +92,7 @@ int __Menu_GetEntries(int t)
|
|||||||
if (Settings.fave && t==0) {
|
if (Settings.fave && t==0) {
|
||||||
u32 cnt2 = 0;
|
u32 cnt2 = 0;
|
||||||
|
|
||||||
for (u32 i = 0; i < cnt; i++)
|
for (u32 i = 0; i < cnt; i++) {
|
||||||
{
|
|
||||||
header = &buffer[i];
|
header = &buffer[i];
|
||||||
u8 favorite = 0;
|
u8 favorite = 0;
|
||||||
struct Game_NUM* game_num = CFG_get_game_num(header->id);
|
struct Game_NUM* game_num = CFG_get_game_num(header->id);
|
||||||
@ -104,8 +101,7 @@ int __Menu_GetEntries(int t)
|
|||||||
}
|
}
|
||||||
if (favorite==1) {
|
if (favorite==1) {
|
||||||
buffer2 = (discHdr *) realloc(buffer2, (cnt2+1) * sizeof(struct discHdr));
|
buffer2 = (discHdr *) realloc(buffer2, (cnt2+1) * sizeof(struct discHdr));
|
||||||
if (!buffer2)
|
if (!buffer2) {
|
||||||
{
|
|
||||||
free(buffer);
|
free(buffer);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -127,13 +123,11 @@ int __Menu_GetEntries(int t)
|
|||||||
if (Settings.parentalcontrol && !Settings.godmode && t==0) {
|
if (Settings.parentalcontrol && !Settings.godmode && t==0) {
|
||||||
u32 cnt2 = 0;
|
u32 cnt2 = 0;
|
||||||
|
|
||||||
for (u32 i = 0; i < cnt; i++)
|
for (u32 i = 0; i < cnt; i++) {
|
||||||
{
|
|
||||||
header = &buffer[i];
|
header = &buffer[i];
|
||||||
if (get_block(header) < Settings.parentalcontrol) {
|
if (get_block(header) < Settings.parentalcontrol) {
|
||||||
buffer2 = (discHdr *) realloc(buffer2, (cnt2+1) * sizeof(struct discHdr));
|
buffer2 = (discHdr *) realloc(buffer2, (cnt2+1) * sizeof(struct discHdr));
|
||||||
if (!buffer2)
|
if (!buffer2) {
|
||||||
{
|
|
||||||
free(buffer);
|
free(buffer);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -154,8 +148,7 @@ int __Menu_GetEntries(int t)
|
|||||||
|
|
||||||
if (Settings.sort==pcount) {
|
if (Settings.sort==pcount) {
|
||||||
qsort(buffer, cnt, sizeof(struct discHdr), __Menu_EntryCmpCount);
|
qsort(buffer, cnt, sizeof(struct discHdr), __Menu_EntryCmpCount);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
qsort(buffer, cnt, sizeof(struct discHdr), __Menu_EntryCmp);
|
qsort(buffer, cnt, sizeof(struct discHdr), __Menu_EntryCmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,8 +16,7 @@ typedef struct {
|
|||||||
} ATTRIBUTE_PACKED partitionTable;
|
} ATTRIBUTE_PACKED partitionTable;
|
||||||
|
|
||||||
|
|
||||||
s32 Partition_GetEntries(partitionEntry *outbuf, u32 *outval)
|
s32 Partition_GetEntries(partitionEntry *outbuf, u32 *outval) {
|
||||||
{
|
|
||||||
static partitionTable table ATTRIBUTE_ALIGN(32);
|
static partitionTable table ATTRIBUTE_ALIGN(32);
|
||||||
|
|
||||||
u32 cnt, sector_size;
|
u32 cnt, sector_size;
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
#define _PARTITION_H_
|
#define _PARTITION_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* 'partition entry' structure */
|
/* 'partition entry' structure */
|
||||||
|
@ -20,8 +20,7 @@ static s32 hid = -1, fd = -1;
|
|||||||
static u32 sector_size = SDHC_SECTOR_SIZE;
|
static u32 sector_size = SDHC_SECTOR_SIZE;
|
||||||
|
|
||||||
|
|
||||||
bool SDHC_Init(void)
|
bool SDHC_Init(void) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
/* Already open */
|
/* Already open */
|
||||||
@ -57,8 +56,7 @@ err:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SDHC_Close(void)
|
bool SDHC_Close(void) {
|
||||||
{
|
|
||||||
/* Close SDHC device */
|
/* Close SDHC device */
|
||||||
if (fd > 0) {
|
if (fd > 0) {
|
||||||
IOS_Close(fd);
|
IOS_Close(fd);
|
||||||
@ -68,8 +66,7 @@ bool SDHC_Close(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SDHC_IsInserted(void)
|
bool SDHC_IsInserted(void) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
/* Check if SD card is inserted */
|
/* Check if SD card is inserted */
|
||||||
@ -78,8 +75,7 @@ bool SDHC_IsInserted(void)
|
|||||||
return (!ret) ? true : false;
|
return (!ret) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SDHC_ReadSectors(u32 sector, u32 count, void *buffer)
|
bool SDHC_ReadSectors(u32 sector, u32 count, void *buffer) {
|
||||||
{
|
|
||||||
void *buf = (void *)buffer;
|
void *buf = (void *)buffer;
|
||||||
u32 len = (sector_size * count);
|
u32 len = (sector_size * count);
|
||||||
|
|
||||||
@ -109,8 +105,7 @@ bool SDHC_ReadSectors(u32 sector, u32 count, void *buffer)
|
|||||||
return (!ret) ? true : false;
|
return (!ret) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SDHC_WriteSectors(u32 sector, u32 count, void *buffer)
|
bool SDHC_WriteSectors(u32 sector, u32 count, void *buffer) {
|
||||||
{
|
|
||||||
void *buf = (void *)buffer;
|
void *buf = (void *)buffer;
|
||||||
u32 len = (sector_size * count);
|
u32 len = (sector_size * count);
|
||||||
|
|
||||||
@ -141,8 +136,7 @@ bool SDHC_WriteSectors(u32 sector, u32 count, void *buffer)
|
|||||||
return (!ret) ? true : false;
|
return (!ret) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SDHC_ClearStatus(void)
|
bool SDHC_ClearStatus(void) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,8 +5,7 @@
|
|||||||
#define SDHC_SECTOR_SIZE 0x200
|
#define SDHC_SECTOR_SIZE 0x200
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Prototypes */
|
/* Prototypes */
|
||||||
|
@ -51,16 +51,14 @@ static s32 hid = -1, fd = -1;
|
|||||||
static u32 sector_size;
|
static u32 sector_size;
|
||||||
|
|
||||||
|
|
||||||
inline s32 __USBStorage_isMEM2Buffer(const void *buffer)
|
inline s32 __USBStorage_isMEM2Buffer(const void *buffer) {
|
||||||
{
|
|
||||||
u32 high_addr = ((u32)buffer) >> 24;
|
u32 high_addr = ((u32)buffer) >> 24;
|
||||||
|
|
||||||
return (high_addr == 0x90) || (high_addr == 0xD0);
|
return (high_addr == 0x90) || (high_addr == 0xD0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
s32 USBStorage_GetCapacity(u32 *_sector_size)
|
s32 USBStorage_GetCapacity(u32 *_sector_size) {
|
||||||
{
|
|
||||||
if (fd > 0) {
|
if (fd > 0) {
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
@ -75,8 +73,7 @@ s32 USBStorage_GetCapacity(u32 *_sector_size)
|
|||||||
return IPC_ENOENT;
|
return IPC_ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 USBStorage_Init(void)
|
s32 USBStorage_Init(void) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
/* Already open */
|
/* Already open */
|
||||||
@ -117,8 +114,7 @@ err:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Hermes **/
|
/** Hermes **/
|
||||||
s32 USBStorage_Watchdog(u32 on_off)
|
s32 USBStorage_Watchdog(u32 on_off) {
|
||||||
{
|
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
@ -130,8 +126,7 @@ s32 USBStorage_Watchdog(u32 on_off)
|
|||||||
return IPC_ENOENT;
|
return IPC_ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 USBStorage_Umount(void)
|
s32 USBStorage_Umount(void) {
|
||||||
{
|
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
s32 ret;
|
s32 ret;
|
||||||
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_UNMOUNT, ":");
|
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_UNMOUNT, ":");
|
||||||
@ -141,8 +136,7 @@ s32 USBStorage_Umount(void)
|
|||||||
return IPC_ENOENT;
|
return IPC_ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void USBStorage_Deinit(void)
|
void USBStorage_Deinit(void) {
|
||||||
{
|
|
||||||
/* Close USB device */
|
/* Close USB device */
|
||||||
if (fd > 0) {
|
if (fd > 0) {
|
||||||
IOS_Close(fd);
|
IOS_Close(fd);
|
||||||
@ -150,8 +144,7 @@ void USBStorage_Deinit(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 USBStorage_ReadSectors(u32 sector, u32 numSectors, void *buffer)
|
s32 USBStorage_ReadSectors(u32 sector, u32 numSectors, void *buffer) {
|
||||||
{
|
|
||||||
void *buf = (void *)buffer;
|
void *buf = (void *)buffer;
|
||||||
u32 len = (sector_size * numSectors);
|
u32 len = (sector_size * numSectors);
|
||||||
|
|
||||||
@ -181,8 +174,7 @@ s32 USBStorage_ReadSectors(u32 sector, u32 numSectors, void *buffer)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 USBStorage_WriteSectors(u32 sector, u32 numSectors, const void *buffer)
|
s32 USBStorage_WriteSectors(u32 sector, u32 numSectors, const void *buffer) {
|
||||||
{
|
|
||||||
void *buf = (void *)buffer;
|
void *buf = (void *)buffer;
|
||||||
u32 len = (sector_size * numSectors);
|
u32 len = (sector_size * numSectors);
|
||||||
|
|
||||||
@ -217,22 +209,18 @@ s32 USBStorage_WriteSectors(u32 sector, u32 numSectors, const void *buffer)
|
|||||||
#define DEVICE_TYPE_WII_UMS (('W'<<24)|('U'<<16)|('M'<<8)|'S')
|
#define DEVICE_TYPE_WII_UMS (('W'<<24)|('U'<<16)|('M'<<8)|'S')
|
||||||
|
|
||||||
|
|
||||||
bool umsio_Startup()
|
bool umsio_Startup() {
|
||||||
{
|
|
||||||
return USBStorage_Init() == 0;
|
return USBStorage_Init() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool umsio_IsInserted()
|
bool umsio_IsInserted() {
|
||||||
{
|
|
||||||
return true; // allways true
|
return true; // allways true
|
||||||
}
|
}
|
||||||
bool umsio_ReadSectors(sec_t sector, sec_t numSectors, u8 *buffer)
|
bool umsio_ReadSectors(sec_t sector, sec_t numSectors, u8 *buffer) {
|
||||||
{
|
|
||||||
u32 cnt = 0;
|
u32 cnt = 0;
|
||||||
s32 ret;
|
s32 ret;
|
||||||
/* Do reads */
|
/* Do reads */
|
||||||
while (cnt < numSectors)
|
while (cnt < numSectors) {
|
||||||
{
|
|
||||||
u32 sectors = (numSectors - cnt);
|
u32 sectors = (numSectors - cnt);
|
||||||
|
|
||||||
/* Read sectors is too big */
|
/* Read sectors is too big */
|
||||||
@ -251,14 +239,12 @@ bool umsio_ReadSectors(sec_t sector, sec_t numSectors, u8 *buffer)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool umsio_WriteSectors(sec_t sector, sec_t numSectors, const u8* buffer)
|
bool umsio_WriteSectors(sec_t sector, sec_t numSectors, const u8* buffer) {
|
||||||
{
|
|
||||||
u32 cnt = 0;
|
u32 cnt = 0;
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
/* Do writes */
|
/* Do writes */
|
||||||
while (cnt < numSectors)
|
while (cnt < numSectors) {
|
||||||
{
|
|
||||||
u32 sectors = (numSectors - cnt);
|
u32 sectors = (numSectors - cnt);
|
||||||
|
|
||||||
/* Write sectors is too big */
|
/* Write sectors is too big */
|
||||||
@ -276,18 +262,15 @@ bool umsio_WriteSectors(sec_t sector, sec_t numSectors, const u8* buffer)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool umsio_ClearStatus(void)
|
bool umsio_ClearStatus(void) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool umsio_Shutdown()
|
bool umsio_Shutdown() {
|
||||||
{
|
|
||||||
USBStorage_Deinit();
|
USBStorage_Deinit();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const DISC_INTERFACE __io_wiiums =
|
const DISC_INTERFACE __io_wiiums = {
|
||||||
{
|
|
||||||
DEVICE_TYPE_WII_UMS,
|
DEVICE_TYPE_WII_UMS,
|
||||||
FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_WII_USB,
|
FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_WII_USB,
|
||||||
(FN_MEDIUM_STARTUP)&umsio_Startup,
|
(FN_MEDIUM_STARTUP)&umsio_Startup,
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
#define _USBSTORAGE_H_
|
#define _USBSTORAGE_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
/* Prototypes */
|
/* Prototypes */
|
||||||
s32 USBStorage_GetCapacity(u32 *);
|
s32 USBStorage_GetCapacity(u32 *);
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
#include <ogcsys.h>
|
#include <ogcsys.h>
|
||||||
|
|
||||||
|
|
||||||
u32 swap32(u32 x)
|
u32 swap32(u32 x) {
|
||||||
{
|
|
||||||
return (x >> 24) | ((x << 8) & 0x00FF0000UL) | ((x >> 8) & 0x0000FF00UL) | (x << 24);
|
return (x >> 24) | ((x << 8) & 0x00FF0000UL) | ((x >> 8) & 0x0000FF00UL) | (x << 24);
|
||||||
}
|
}
|
||||||
|
@ -26,25 +26,21 @@ static s32 done = -1, total = -1;
|
|||||||
/* Variables */
|
/* Variables */
|
||||||
|
|
||||||
static u32 nb_sectors, sector_size;
|
static u32 nb_sectors, sector_size;
|
||||||
static void WBFS_Spinner(s32 x, s32 max)
|
static void WBFS_Spinner(s32 x, s32 max) {
|
||||||
{
|
|
||||||
done = x;
|
done = x;
|
||||||
total = max;
|
total = max;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetProgressValue(s32 * d, s32 * m)
|
void GetProgressValue(s32 * d, s32 * m) {
|
||||||
{
|
|
||||||
*d = done;
|
*d = done;
|
||||||
*m = total;
|
*m = total;
|
||||||
}
|
}
|
||||||
|
|
||||||
wbfs_t *GetHddInfo(void)
|
wbfs_t *GetHddInfo(void) {
|
||||||
{
|
|
||||||
return hdd;
|
return hdd;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 __WBFS_ReadDVD(void *fp, u32 lba, u32 len, void *iobuf)
|
s32 __WBFS_ReadDVD(void *fp, u32 lba, u32 len, void *iobuf) {
|
||||||
{
|
|
||||||
void *buffer = NULL;
|
void *buffer = NULL;
|
||||||
|
|
||||||
u64 offset;
|
u64 offset;
|
||||||
@ -92,8 +88,7 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 __WBFS_ReadUSB(void *fp, u32 lba, u32 count, void *iobuf)
|
s32 __WBFS_ReadUSB(void *fp, u32 lba, u32 count, void *iobuf) {
|
||||||
{
|
|
||||||
u32 cnt = 0;
|
u32 cnt = 0;
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
@ -118,8 +113,7 @@ s32 __WBFS_ReadUSB(void *fp, u32 lba, u32 count, void *iobuf)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 __WBFS_WriteUSB(void *fp, u32 lba, u32 count, void *iobuf)
|
s32 __WBFS_WriteUSB(void *fp, u32 lba, u32 count, void *iobuf) {
|
||||||
{
|
|
||||||
u32 cnt = 0;
|
u32 cnt = 0;
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
@ -144,8 +138,7 @@ s32 __WBFS_WriteUSB(void *fp, u32 lba, u32 count, void *iobuf)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 __WBFS_ReadSDHC(void *fp, u32 lba, u32 count, void *iobuf)
|
s32 __WBFS_ReadSDHC(void *fp, u32 lba, u32 count, void *iobuf) {
|
||||||
{
|
|
||||||
u32 cnt = 0;
|
u32 cnt = 0;
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
@ -170,8 +163,7 @@ s32 __WBFS_ReadSDHC(void *fp, u32 lba, u32 count, void *iobuf)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 __WBFS_WriteSDHC(void *fp, u32 lba, u32 count, void *iobuf)
|
s32 __WBFS_WriteSDHC(void *fp, u32 lba, u32 count, void *iobuf) {
|
||||||
{
|
|
||||||
u32 cnt = 0;
|
u32 cnt = 0;
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
@ -196,8 +188,7 @@ s32 __WBFS_WriteSDHC(void *fp, u32 lba, u32 count, void *iobuf)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WBFS_Init(u32 device)
|
s32 WBFS_Init(u32 device) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
switch (device) {
|
switch (device) {
|
||||||
@ -213,8 +204,7 @@ s32 WBFS_Init(u32 device)
|
|||||||
nb_sectors = USBStorage_GetCapacity(§or_size);
|
nb_sectors = USBStorage_GetCapacity(§or_size);
|
||||||
if (!nb_sectors)
|
if (!nb_sectors)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return ret;
|
return ret;
|
||||||
break;
|
break;
|
||||||
case WBFS_DEVICE_SDHC:
|
case WBFS_DEVICE_SDHC:
|
||||||
@ -229,8 +219,7 @@ s32 WBFS_Init(u32 device)
|
|||||||
/* Device info */
|
/* Device info */
|
||||||
nb_sectors = 0;
|
nb_sectors = 0;
|
||||||
sector_size = SDHC_SECTOR_SIZE;
|
sector_size = SDHC_SECTOR_SIZE;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -314,8 +303,7 @@ out:
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
s32 WBFS_Open(void)
|
s32 WBFS_Open(void) {
|
||||||
{
|
|
||||||
/* Close hard disk */
|
/* Close hard disk */
|
||||||
if (hdd)
|
if (hdd)
|
||||||
wbfs_close(hdd);
|
wbfs_close(hdd);
|
||||||
@ -338,8 +326,7 @@ s32 WBFS_Close(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WBFS_Format(u32 lba, u32 size)
|
s32 WBFS_Format(u32 lba, u32 size) {
|
||||||
{
|
|
||||||
wbfs_t *partition = NULL;
|
wbfs_t *partition = NULL;
|
||||||
|
|
||||||
/* Reset partition */
|
/* Reset partition */
|
||||||
@ -353,8 +340,7 @@ s32 WBFS_Format(u32 lba, u32 size)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WBFS_GetCount(u32 *count)
|
s32 WBFS_GetCount(u32 *count) {
|
||||||
{
|
|
||||||
/* No device open */
|
/* No device open */
|
||||||
if (!hdd)
|
if (!hdd)
|
||||||
return -1;
|
return -1;
|
||||||
@ -365,8 +351,7 @@ s32 WBFS_GetCount(u32 *count)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WBFS_GetHeaders(void *outbuf, u32 cnt, u32 len)
|
s32 WBFS_GetHeaders(void *outbuf, u32 cnt, u32 len) {
|
||||||
{
|
|
||||||
u32 idx, size;
|
u32 idx, size;
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
@ -386,8 +371,7 @@ s32 WBFS_GetHeaders(void *outbuf, u32 cnt, u32 len)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WBFS_CheckGame(u8 *discid)
|
s32 WBFS_CheckGame(u8 *discid) {
|
||||||
{
|
|
||||||
wbfs_disc_t *disc = NULL;
|
wbfs_disc_t *disc = NULL;
|
||||||
|
|
||||||
/* Try to open game disc */
|
/* Try to open game disc */
|
||||||
@ -402,8 +386,7 @@ s32 WBFS_CheckGame(u8 *discid)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WBFS_AddGame(void)
|
s32 WBFS_AddGame(void) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
/* No device open */
|
/* No device open */
|
||||||
@ -418,8 +401,7 @@ s32 WBFS_AddGame(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WBFS_RemoveGame(u8 *discid)
|
s32 WBFS_RemoveGame(u8 *discid) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
/* No device open */
|
/* No device open */
|
||||||
@ -434,8 +416,7 @@ s32 WBFS_RemoveGame(u8 *discid)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WBFS_GameSize(u8 *discid, f32 *size)
|
s32 WBFS_GameSize(u8 *discid, f32 *size) {
|
||||||
{
|
|
||||||
wbfs_disc_t *disc = NULL;
|
wbfs_disc_t *disc = NULL;
|
||||||
|
|
||||||
u32 sectors;
|
u32 sectors;
|
||||||
@ -461,8 +442,7 @@ s32 WBFS_GameSize(u8 *discid, f32 *size)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WBFS_DiskSpace(f32 *used, f32 *free)
|
s32 WBFS_DiskSpace(f32 *used, f32 *free) {
|
||||||
{
|
|
||||||
f32 ssize;
|
f32 ssize;
|
||||||
u32 cnt;
|
u32 cnt;
|
||||||
|
|
||||||
@ -483,8 +463,7 @@ s32 WBFS_DiskSpace(f32 *used, f32 *free)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WBFS_RenameGame(u8 *discid, const void *newname)
|
s32 WBFS_RenameGame(u8 *discid, const void *newname) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
/* No USB device open */
|
/* No USB device open */
|
||||||
@ -497,8 +476,7 @@ s32 WBFS_RenameGame(u8 *discid, const void *newname)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
f32 WBFS_EstimeGameSize(void)
|
f32 WBFS_EstimeGameSize(void) {
|
||||||
{
|
|
||||||
|
|
||||||
return wbfs_estimate_disc(hdd, __WBFS_ReadDVD, NULL, ONLY_GAME_PARTITION);
|
return wbfs_estimate_disc(hdd, __WBFS_ReadDVD, NULL, ONLY_GAME_PARTITION);
|
||||||
|
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
#define _WBFS_H_
|
#define _WBFS_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "libwbfs/libwbfs.h"
|
#include "libwbfs/libwbfs.h"
|
||||||
|
@ -30,8 +30,7 @@ static u32 outbuf[8] ATTRIBUTE_ALIGN(32);
|
|||||||
static const char di_fs[] ATTRIBUTE_ALIGN(32) = "/dev/di";
|
static const char di_fs[] ATTRIBUTE_ALIGN(32) = "/dev/di";
|
||||||
static s32 di_fd = -1;
|
static s32 di_fd = -1;
|
||||||
|
|
||||||
s32 WDVD_Init(void)
|
s32 WDVD_Init(void) {
|
||||||
{
|
|
||||||
/* Open "/dev/di" */
|
/* Open "/dev/di" */
|
||||||
if (di_fd < 0) {
|
if (di_fd < 0) {
|
||||||
di_fd = IOS_Open(di_fs, 0);
|
di_fd = IOS_Open(di_fs, 0);
|
||||||
@ -42,8 +41,7 @@ s32 WDVD_Init(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WDVD_Close(void)
|
s32 WDVD_Close(void) {
|
||||||
{
|
|
||||||
/* Close "/dev/di" */
|
/* Close "/dev/di" */
|
||||||
if (di_fd >= 0) {
|
if (di_fd >= 0) {
|
||||||
IOS_Close(di_fd);
|
IOS_Close(di_fd);
|
||||||
@ -53,14 +51,12 @@ s32 WDVD_Close(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WDVD_GetHandle(void)
|
s32 WDVD_GetHandle(void) {
|
||||||
{
|
|
||||||
/* Return di handle */
|
/* Return di handle */
|
||||||
return di_fd;
|
return di_fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WDVD_Reset(void)
|
s32 WDVD_Reset(void) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
memset(inbuf, 0, sizeof(inbuf));
|
memset(inbuf, 0, sizeof(inbuf));
|
||||||
@ -76,8 +72,7 @@ s32 WDVD_Reset(void)
|
|||||||
return (ret == 1) ? 0 : -ret;
|
return (ret == 1) ? 0 : -ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WDVD_ReadDiskId(void *id)
|
s32 WDVD_ReadDiskId(void *id) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
memset(inbuf, 0, sizeof(inbuf));
|
memset(inbuf, 0, sizeof(inbuf));
|
||||||
@ -97,8 +92,7 @@ s32 WDVD_ReadDiskId(void *id)
|
|||||||
return -ret;
|
return -ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WDVD_Seek(u64 offset)
|
s32 WDVD_Seek(u64 offset) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
memset(inbuf, 0, sizeof(inbuf));
|
memset(inbuf, 0, sizeof(inbuf));
|
||||||
@ -108,8 +102,7 @@ s32 WDVD_Seek(u64 offset)
|
|||||||
inbuf[1] = (u32)(offset >> 2);
|
inbuf[1] = (u32)(offset >> 2);
|
||||||
|
|
||||||
ret = IOS_Ioctl(di_fd, IOCTL_DI_SEEK, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
ret = IOS_Ioctl(di_fd, IOCTL_DI_SEEK, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||||
if(ret!=1)
|
if (ret!=1) {
|
||||||
{
|
|
||||||
// Try old cIOS 222
|
// Try old cIOS 222
|
||||||
/* Drive seek */
|
/* Drive seek */
|
||||||
inbuf[0] = DI_SETOFFSETBASE << 24;
|
inbuf[0] = DI_SETOFFSETBASE << 24;
|
||||||
@ -122,8 +115,7 @@ s32 WDVD_Seek(u64 offset)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WDVD_Offset(u64 offset)
|
s32 WDVD_Offset(u64 offset) {
|
||||||
{
|
|
||||||
u32 *off = (u32 *)((void *)&offset);
|
u32 *off = (u32 *)((void *)&offset);
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
@ -141,8 +133,7 @@ s32 WDVD_Offset(u64 offset)
|
|||||||
return (ret == 1) ? 0 : -ret;
|
return (ret == 1) ? 0 : -ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WDVD_StopLaser(void)
|
s32 WDVD_StopLaser(void) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
memset(inbuf, 0, sizeof(inbuf));
|
memset(inbuf, 0, sizeof(inbuf));
|
||||||
@ -157,8 +148,7 @@ s32 WDVD_StopLaser(void)
|
|||||||
return (ret == 1) ? 0 : -ret;
|
return (ret == 1) ? 0 : -ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WDVD_StopMotor(void)
|
s32 WDVD_StopMotor(void) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
memset(inbuf, 0, sizeof(inbuf));
|
memset(inbuf, 0, sizeof(inbuf));
|
||||||
@ -173,8 +163,7 @@ s32 WDVD_StopMotor(void)
|
|||||||
return (ret == 1) ? 0 : -ret;
|
return (ret == 1) ? 0 : -ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WDVD_OpenPartition(u64 offset)
|
s32 WDVD_OpenPartition(u64 offset) {
|
||||||
{
|
|
||||||
u8 *vector = NULL;
|
u8 *vector = NULL;
|
||||||
|
|
||||||
u32 *buffer = NULL;
|
u32 *buffer = NULL;
|
||||||
@ -213,8 +202,7 @@ s32 WDVD_OpenPartition(u64 offset)
|
|||||||
return (ret == 1) ? 0 : -ret;
|
return (ret == 1) ? 0 : -ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WDVD_ClosePartition(void)
|
s32 WDVD_ClosePartition(void) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
memset(inbuf, 0, sizeof(inbuf));
|
memset(inbuf, 0, sizeof(inbuf));
|
||||||
@ -229,8 +217,7 @@ s32 WDVD_ClosePartition(void)
|
|||||||
return (ret == 1) ? 0 : -ret;
|
return (ret == 1) ? 0 : -ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WDVD_UnencryptedRead(void *buf, u32 len, u64 offset)
|
s32 WDVD_UnencryptedRead(void *buf, u32 len, u64 offset) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
memset(inbuf, 0, sizeof(inbuf));
|
memset(inbuf, 0, sizeof(inbuf));
|
||||||
@ -247,8 +234,7 @@ s32 WDVD_UnencryptedRead(void *buf, u32 len, u64 offset)
|
|||||||
return (ret == 1) ? 0 : -ret;
|
return (ret == 1) ? 0 : -ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WDVD_Read(void *buf, u32 len, u64 offset)
|
s32 WDVD_Read(void *buf, u32 len, u64 offset) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
memset(inbuf, 0, sizeof(inbuf));
|
memset(inbuf, 0, sizeof(inbuf));
|
||||||
@ -265,8 +251,7 @@ s32 WDVD_Read(void *buf, u32 len, u64 offset)
|
|||||||
return (ret == 1) ? 0 : -ret;
|
return (ret == 1) ? 0 : -ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WDVD_WaitForDisc(void)
|
s32 WDVD_WaitForDisc(void) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
memset(inbuf, 0, sizeof(inbuf));
|
memset(inbuf, 0, sizeof(inbuf));
|
||||||
@ -281,8 +266,7 @@ s32 WDVD_WaitForDisc(void)
|
|||||||
return (ret == 1) ? 0 : -ret;
|
return (ret == 1) ? 0 : -ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WDVD_GetCoverStatus(u32 *status)
|
s32 WDVD_GetCoverStatus(u32 *status) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
memset(inbuf, 0, sizeof(inbuf));
|
memset(inbuf, 0, sizeof(inbuf));
|
||||||
@ -304,8 +288,7 @@ s32 WDVD_GetCoverStatus(u32 *status)
|
|||||||
return -ret;
|
return -ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WDVD_DisableReset(u8 val)
|
s32 WDVD_DisableReset(u8 val) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
memset(inbuf, 0, sizeof(inbuf));
|
memset(inbuf, 0, sizeof(inbuf));
|
||||||
@ -322,8 +305,7 @@ s32 WDVD_DisableReset(u8 val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Hermes **/
|
/** Hermes **/
|
||||||
s32 WDVD_SetUSBMode(u8 *id)
|
s32 WDVD_SetUSBMode(u8 *id) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
memset(inbuf, 0, sizeof(inbuf));
|
memset(inbuf, 0, sizeof(inbuf));
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
#define _WDVD_H_
|
#define _WDVD_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Prototypes */
|
/* Prototypes */
|
||||||
|
@ -35,16 +35,14 @@ u32 frameCount = 0;
|
|||||||
* called by postRetraceCallback in InitGCVideo - scans gcpad and wpad
|
* called by postRetraceCallback in InitGCVideo - scans gcpad and wpad
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
static void
|
static void
|
||||||
UpdatePadsCB ()
|
UpdatePadsCB () {
|
||||||
{
|
|
||||||
frameCount++;
|
frameCount++;
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
WPAD_ScanPads();
|
WPAD_ScanPads();
|
||||||
#endif
|
#endif
|
||||||
PAD_ScanPads();
|
PAD_ScanPads();
|
||||||
|
|
||||||
for(int i=3; i >= 0; i--)
|
for (int i=3; i >= 0; i--) {
|
||||||
{
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
memcpy(&userInput[i].wpad, WPAD_Data(i), sizeof(WPADData));
|
memcpy(&userInput[i].wpad, WPAD_Data(i), sizeof(WPADData));
|
||||||
#endif
|
#endif
|
||||||
@ -68,8 +66,7 @@ UpdatePadsCB ()
|
|||||||
* Initialises GX and sets it up for use
|
* Initialises GX and sets it up for use
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
static void
|
static void
|
||||||
StartGX ()
|
StartGX () {
|
||||||
{
|
|
||||||
GXColor background = { 0, 0, 0, 0xff };
|
GXColor background = { 0, 0, 0, 0xff };
|
||||||
|
|
||||||
/*** Clear out FIFO area ***/
|
/*** Clear out FIFO area ***/
|
||||||
@ -89,8 +86,7 @@ StartGX ()
|
|||||||
* Reset the video/rendering mode for the menu
|
* Reset the video/rendering mode for the menu
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void
|
void
|
||||||
ResetVideo_Menu()
|
ResetVideo_Menu() {
|
||||||
{
|
|
||||||
Mtx44 p;
|
Mtx44 p;
|
||||||
f32 yscale;
|
f32 yscale;
|
||||||
u32 xfbHeight;
|
u32 xfbHeight;
|
||||||
@ -162,14 +158,12 @@ ResetVideo_Menu()
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
InitVideo ()
|
InitVideo () {
|
||||||
{
|
|
||||||
VIDEO_Init();
|
VIDEO_Init();
|
||||||
vmode = VIDEO_GetPreferredMode(NULL); // get default video mode
|
vmode = VIDEO_GetPreferredMode(NULL); // get default video mode
|
||||||
|
|
||||||
// widescreen fix
|
// widescreen fix
|
||||||
if(CFG.widescreen)
|
if (CFG.widescreen) {
|
||||||
{
|
|
||||||
vmode->viWidth = VI_MAX_WIDTH_PAL-12;
|
vmode->viWidth = VI_MAX_WIDTH_PAL-12;
|
||||||
vmode->viXOrigin = ((VI_MAX_WIDTH_PAL - vmode->viWidth) / 2) + 2;
|
vmode->viXOrigin = ((VI_MAX_WIDTH_PAL - vmode->viWidth) / 2) + 2;
|
||||||
}
|
}
|
||||||
@ -210,8 +204,7 @@ InitVideo ()
|
|||||||
*
|
*
|
||||||
* Stops GX (when exiting)
|
* Stops GX (when exiting)
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void StopGX()
|
void StopGX() {
|
||||||
{
|
|
||||||
GX_AbortFrame();
|
GX_AbortFrame();
|
||||||
GX_Flush();
|
GX_Flush();
|
||||||
|
|
||||||
@ -224,8 +217,7 @@ void StopGX()
|
|||||||
*
|
*
|
||||||
* Renders everything current sent to GX, and flushes video
|
* Renders everything current sent to GX, and flushes video
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void Menu_Render()
|
void Menu_Render() {
|
||||||
{
|
|
||||||
GX_DrawDone ();
|
GX_DrawDone ();
|
||||||
|
|
||||||
whichfb ^= 1; // flip framebuffer
|
whichfb ^= 1; // flip framebuffer
|
||||||
@ -243,8 +235,7 @@ void Menu_Render()
|
|||||||
* Draws the specified image on screen using GX
|
* Draws the specified image on screen using GX
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void Menu_DrawImg(f32 xpos, f32 ypos, f32 zpos, f32 width, f32 height, u8 data[],
|
void Menu_DrawImg(f32 xpos, f32 ypos, f32 zpos, f32 width, f32 height, u8 data[],
|
||||||
f32 degrees, f32 scaleX, f32 scaleY, u8 alpha, int XX1, int YY1,int XX2, int YY2,int XX3, int YY3,int XX4, int YY4)
|
f32 degrees, f32 scaleX, f32 scaleY, u8 alpha, int XX1, int YY1,int XX2, int YY2,int XX3, int YY3,int XX4, int YY4) {
|
||||||
{
|
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -262,7 +253,9 @@ void Menu_DrawImg(f32 xpos, f32 ypos, f32 zpos, f32 width, f32 height, u8 data[]
|
|||||||
height*=.5;
|
height*=.5;
|
||||||
guMtxIdentity (m1);
|
guMtxIdentity (m1);
|
||||||
guMtxScaleApply(m1,m1,scaleX,scaleY,1.0);
|
guMtxScaleApply(m1,m1,scaleX,scaleY,1.0);
|
||||||
guVector axis = (guVector) {0 , 0, 1 };
|
guVector axis = (guVector) {
|
||||||
|
0 , 0, 1
|
||||||
|
};
|
||||||
guMtxRotAxisDeg (m2, &axis, degrees);
|
guMtxRotAxisDeg (m2, &axis, degrees);
|
||||||
// guMtxConcat(m2,m1,m);
|
// guMtxConcat(m2,m1,m);
|
||||||
guMtxConcat(m1,m2,m);
|
guMtxConcat(m1,m2,m);
|
||||||
@ -304,8 +297,7 @@ void Menu_DrawImg(f32 xpos, f32 ypos, f32 zpos, f32 width, f32 height, u8 data[]
|
|||||||
*
|
*
|
||||||
* Draws a rectangle at the specified coordinates using GX
|
* Draws a rectangle at the specified coordinates using GX
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void Menu_DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color, u8 filled)
|
void Menu_DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color, u8 filled) {
|
||||||
{
|
|
||||||
u8 fmt;
|
u8 fmt;
|
||||||
long n;
|
long n;
|
||||||
int i;
|
int i;
|
||||||
@ -313,20 +305,16 @@ void Menu_DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color, u8 f
|
|||||||
f32 y2 = y+height;
|
f32 y2 = y+height;
|
||||||
guVector v[] = {{x,y,0.0f}, {x2,y,0.0f}, {x2,y2,0.0f}, {x,y2,0.0f}, {x,y,0.0f}};
|
guVector v[] = {{x,y,0.0f}, {x2,y,0.0f}, {x2,y2,0.0f}, {x,y2,0.0f}, {x,y,0.0f}};
|
||||||
|
|
||||||
if(!filled)
|
if (!filled) {
|
||||||
{
|
|
||||||
fmt = GX_LINESTRIP;
|
fmt = GX_LINESTRIP;
|
||||||
n = 5;
|
n = 5;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
fmt = GX_TRIANGLEFAN;
|
fmt = GX_TRIANGLEFAN;
|
||||||
n = 4;
|
n = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
GX_Begin(fmt, GX_VTXFMT0, n);
|
GX_Begin(fmt, GX_VTXFMT0, n);
|
||||||
for(i=0; i<n; i++)
|
for (i=0; i<n; i++) {
|
||||||
{
|
|
||||||
GX_Position3f32(v[i].x, v[i].y, v[i].z);
|
GX_Position3f32(v[i].x, v[i].y, v[i].z);
|
||||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||||
}
|
}
|
||||||
@ -334,8 +322,7 @@ void Menu_DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color, u8 f
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Menu_DrawDiskCover(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16 distance,u8 data[],
|
void Menu_DrawDiskCover(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16 distance,u8 data[],
|
||||||
f32 deg_alpha, f32 deg_beta, f32 scaleX, f32 scaleY, u8 alpha, bool shadow)
|
f32 deg_alpha, f32 deg_beta, f32 scaleX, f32 scaleY, u8 alpha, bool shadow) {
|
||||||
{
|
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -362,9 +349,13 @@ void Menu_DrawDiskCover(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16
|
|||||||
|
|
||||||
guMtxIdentity (m1);
|
guMtxIdentity (m1);
|
||||||
guMtxScaleApply(m1,m1,scaleX,scaleY,1.0);
|
guMtxScaleApply(m1,m1,scaleX,scaleY,1.0);
|
||||||
guVector axis2 = (guVector) {0 , 1, 0 };
|
guVector axis2 = (guVector) {
|
||||||
|
0 , 1, 0
|
||||||
|
};
|
||||||
guMtxRotAxisDeg (m2, &axis2, deg_beta);
|
guMtxRotAxisDeg (m2, &axis2, deg_beta);
|
||||||
guVector axis = (guVector) {0 , 0, 1 };
|
guVector axis = (guVector) {
|
||||||
|
0 , 0, 1
|
||||||
|
};
|
||||||
guMtxRotAxisDeg (m3, &axis, deg_alpha);
|
guMtxRotAxisDeg (m3, &axis, deg_alpha);
|
||||||
// guMtxConcat(m2,m1,m);
|
// guMtxConcat(m2,m1,m);
|
||||||
guMtxConcat(m3,m4,m3); // move distance then rotate z-axis
|
guMtxConcat(m3,m4,m3); // move distance then rotate z-axis
|
||||||
@ -381,8 +372,7 @@ void Menu_DrawDiskCover(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16
|
|||||||
guMtxConcat (GXmodelView2D, m, mv);
|
guMtxConcat (GXmodelView2D, m, mv);
|
||||||
GX_LoadPosMtxImm (mv, GX_PNMTX0);
|
GX_LoadPosMtxImm (mv, GX_PNMTX0);
|
||||||
|
|
||||||
if(shadow)
|
if (shadow) {
|
||||||
{
|
|
||||||
GX_Begin(GX_QUADS, GX_VTXFMT0,4);
|
GX_Begin(GX_QUADS, GX_VTXFMT0,4);
|
||||||
GX_Position3f32(-width, -height, 0);
|
GX_Position3f32(-width, -height, 0);
|
||||||
GX_Color4u8(0,0,0,alpha);
|
GX_Color4u8(0,0,0,alpha);
|
||||||
@ -399,9 +389,7 @@ void Menu_DrawDiskCover(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16
|
|||||||
GX_Position3f32(-width, height, 0);
|
GX_Position3f32(-width, height, 0);
|
||||||
GX_Color4u8(0,0,0,alpha);
|
GX_Color4u8(0,0,0,alpha);
|
||||||
GX_TexCoord2f32(0, 1);
|
GX_TexCoord2f32(0, 1);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
GX_Begin(GX_QUADS, GX_VTXFMT0,4);
|
GX_Begin(GX_QUADS, GX_VTXFMT0,4);
|
||||||
GX_Position3f32(-width, -height, 0);
|
GX_Position3f32(-width, -height, 0);
|
||||||
GX_Color4u8(0xFF,0xFF,0xFF,alpha);
|
GX_Color4u8(0xFF,0xFF,0xFF,alpha);
|
||||||
@ -428,8 +416,7 @@ void Menu_DrawDiskCover(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Menu_DrawTPLImg(f32 xpos, f32 ypos, f32 zpos, f32 width, f32 height, GXTexObj *texObj,
|
void Menu_DrawTPLImg(f32 xpos, f32 ypos, f32 zpos, f32 width, f32 height, GXTexObj *texObj,
|
||||||
f32 degrees, f32 scaleX, f32 scaleY, u8 alpha, int XX1, int YY1,int XX2, int YY2,int XX3, int YY3,int XX4, int YY4)
|
f32 degrees, f32 scaleX, f32 scaleY, u8 alpha, int XX1, int YY1,int XX2, int YY2,int XX3, int YY3,int XX4, int YY4) {
|
||||||
{
|
|
||||||
GX_LoadTexObj(texObj, GX_TEXMAP0);
|
GX_LoadTexObj(texObj, GX_TEXMAP0);
|
||||||
GX_InvalidateTexAll();
|
GX_InvalidateTexAll();
|
||||||
|
|
||||||
@ -441,7 +428,9 @@ void Menu_DrawTPLImg(f32 xpos, f32 ypos, f32 zpos, f32 width, f32 height, GXTexO
|
|||||||
height*=.5;
|
height*=.5;
|
||||||
guMtxIdentity (m1);
|
guMtxIdentity (m1);
|
||||||
guMtxScaleApply(m1,m1,scaleX,scaleY,1.0);
|
guMtxScaleApply(m1,m1,scaleX,scaleY,1.0);
|
||||||
guVector axis = (guVector) {0 , 0, 1 };
|
guVector axis = (guVector) {
|
||||||
|
0 , 0, 1
|
||||||
|
};
|
||||||
guMtxRotAxisDeg (m2, &axis, degrees);
|
guMtxRotAxisDeg (m2, &axis, degrees);
|
||||||
guMtxConcat(m1,m2,m);
|
guMtxConcat(m1,m2,m);
|
||||||
|
|
||||||
|
@ -61,8 +61,7 @@ s32 ISFS_ReadFileToArray (const char *filepath, u8 *filearray, u32 max_size, u32
|
|||||||
|
|
||||||
*file_size = 0;
|
*file_size = 0;
|
||||||
ret = ISFS_Open(filepath, ISFS_OPEN_READ);
|
ret = ISFS_Open(filepath, ISFS_OPEN_READ);
|
||||||
if (ret <= 0)
|
if (ret <= 0) {
|
||||||
{
|
|
||||||
//printf("Error! ISFS_Open (ret = %d)\n", ret);
|
//printf("Error! ISFS_Open (ret = %d)\n", ret);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -70,36 +69,30 @@ s32 ISFS_ReadFileToArray (const char *filepath, u8 *filearray, u32 max_size, u32
|
|||||||
fd = ret;
|
fd = ret;
|
||||||
|
|
||||||
ret = ISFS_GetFileStats(fd, &filestats);
|
ret = ISFS_GetFileStats(fd, &filestats);
|
||||||
if (ret < 0)
|
if (ret < 0) {
|
||||||
{
|
|
||||||
//printf("Error! ISFS_GetFileStats (ret = %d)\n", ret);
|
//printf("Error! ISFS_GetFileStats (ret = %d)\n", ret);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
*file_size = filestats.file_length;
|
*file_size = filestats.file_length;
|
||||||
|
|
||||||
if (*file_size > max_size)
|
if (*file_size > max_size) {
|
||||||
{
|
|
||||||
//printf("File is too large! Size: %u Max: %u", *file_size, max_size);
|
//printf("File is too large! Size: %u Max: %u", *file_size, max_size);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ISFS_Read(fd, filearray, *file_size);
|
ret = ISFS_Read(fd, filearray, *file_size);
|
||||||
*file_size = ret;
|
*file_size = ret;
|
||||||
if (ret < 0)
|
if (ret < 0) {
|
||||||
{
|
|
||||||
//printf("Error! ISFS_Read (ret = %d)\n", ret);
|
//printf("Error! ISFS_Read (ret = %d)\n", ret);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
} else if (ret != filestats.file_length) {
|
||||||
else if (ret != filestats.file_length)
|
|
||||||
{
|
|
||||||
//printf("Error! ISFS_Read Only read: %d\n", ret);
|
//printf("Error! ISFS_Read Only read: %d\n", ret);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ISFS_Close(fd);
|
ret = ISFS_Close(fd);
|
||||||
if (ret < 0)
|
if (ret < 0) {
|
||||||
{
|
|
||||||
//printf("Error! ISFS_Close (ret = %d)\n", ret);
|
//printf("Error! ISFS_Close (ret = %d)\n", ret);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -21,15 +21,13 @@ void spinner(void);
|
|||||||
|
|
||||||
// Basic I/O.
|
// Basic I/O.
|
||||||
|
|
||||||
static inline u32 read32(u32 addr)
|
static inline u32 read32(u32 addr) {
|
||||||
{
|
|
||||||
u32 x;
|
u32 x;
|
||||||
asm volatile("lwz %0,0(%1) ; sync" : "=r"(x) : "b"(0xc0000000 | addr));
|
asm volatile("lwz %0,0(%1) ; sync" : "=r"(x) : "b"(0xc0000000 | addr));
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void write32(u32 addr, u32 x)
|
static inline void write32(u32 addr, u32 x) {
|
||||||
{
|
|
||||||
asm("stw %0,0(%1) ; eieio" : : "r"(x), "b"(0xc0000000 | addr));
|
asm("stw %0,0(%1) ; eieio" : : "r"(x), "b"(0xc0000000 | addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,8 +42,7 @@ extern const char version[];
|
|||||||
|
|
||||||
// Debug: blink the tray led.
|
// Debug: blink the tray led.
|
||||||
|
|
||||||
static inline void blink(void)
|
static inline void blink(void) {
|
||||||
{
|
|
||||||
write32(0x0d8000c0, read32(0x0d8000c0) ^ 0x20);
|
write32(0x0d8000c0, read32(0x0d8000c0) ^ 0x20);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,8 +42,7 @@ A million repetitions of "a"
|
|||||||
|
|
||||||
/* Hash a single 512-bit block. This is the core of the algorithm. */
|
/* Hash a single 512-bit block. This is the core of the algorithm. */
|
||||||
|
|
||||||
void SHA1Transform(unsigned long state[5], unsigned char buffer[64])
|
void SHA1Transform(unsigned long state[5], unsigned char buffer[64]) {
|
||||||
{
|
|
||||||
unsigned long a, b, c, d, e;
|
unsigned long a, b, c, d, e;
|
||||||
typedef union {
|
typedef union {
|
||||||
unsigned char c[64];
|
unsigned char c[64];
|
||||||
@ -64,26 +63,86 @@ static unsigned char workspace[64];
|
|||||||
d = state[3];
|
d = state[3];
|
||||||
e = state[4];
|
e = state[4];
|
||||||
/* 4 rounds of 20 operations each. Loop unrolled. */
|
/* 4 rounds of 20 operations each. Loop unrolled. */
|
||||||
R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3);
|
R0(a,b,c,d,e, 0);
|
||||||
R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7);
|
R0(e,a,b,c,d, 1);
|
||||||
R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11);
|
R0(d,e,a,b,c, 2);
|
||||||
R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15);
|
R0(c,d,e,a,b, 3);
|
||||||
R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19);
|
R0(b,c,d,e,a, 4);
|
||||||
R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23);
|
R0(a,b,c,d,e, 5);
|
||||||
R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27);
|
R0(e,a,b,c,d, 6);
|
||||||
R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31);
|
R0(d,e,a,b,c, 7);
|
||||||
R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35);
|
R0(c,d,e,a,b, 8);
|
||||||
R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39);
|
R0(b,c,d,e,a, 9);
|
||||||
R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43);
|
R0(a,b,c,d,e,10);
|
||||||
R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47);
|
R0(e,a,b,c,d,11);
|
||||||
R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51);
|
R0(d,e,a,b,c,12);
|
||||||
R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55);
|
R0(c,d,e,a,b,13);
|
||||||
R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59);
|
R0(b,c,d,e,a,14);
|
||||||
R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63);
|
R0(a,b,c,d,e,15);
|
||||||
R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67);
|
R1(e,a,b,c,d,16);
|
||||||
R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71);
|
R1(d,e,a,b,c,17);
|
||||||
R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75);
|
R1(c,d,e,a,b,18);
|
||||||
R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79);
|
R1(b,c,d,e,a,19);
|
||||||
|
R2(a,b,c,d,e,20);
|
||||||
|
R2(e,a,b,c,d,21);
|
||||||
|
R2(d,e,a,b,c,22);
|
||||||
|
R2(c,d,e,a,b,23);
|
||||||
|
R2(b,c,d,e,a,24);
|
||||||
|
R2(a,b,c,d,e,25);
|
||||||
|
R2(e,a,b,c,d,26);
|
||||||
|
R2(d,e,a,b,c,27);
|
||||||
|
R2(c,d,e,a,b,28);
|
||||||
|
R2(b,c,d,e,a,29);
|
||||||
|
R2(a,b,c,d,e,30);
|
||||||
|
R2(e,a,b,c,d,31);
|
||||||
|
R2(d,e,a,b,c,32);
|
||||||
|
R2(c,d,e,a,b,33);
|
||||||
|
R2(b,c,d,e,a,34);
|
||||||
|
R2(a,b,c,d,e,35);
|
||||||
|
R2(e,a,b,c,d,36);
|
||||||
|
R2(d,e,a,b,c,37);
|
||||||
|
R2(c,d,e,a,b,38);
|
||||||
|
R2(b,c,d,e,a,39);
|
||||||
|
R3(a,b,c,d,e,40);
|
||||||
|
R3(e,a,b,c,d,41);
|
||||||
|
R3(d,e,a,b,c,42);
|
||||||
|
R3(c,d,e,a,b,43);
|
||||||
|
R3(b,c,d,e,a,44);
|
||||||
|
R3(a,b,c,d,e,45);
|
||||||
|
R3(e,a,b,c,d,46);
|
||||||
|
R3(d,e,a,b,c,47);
|
||||||
|
R3(c,d,e,a,b,48);
|
||||||
|
R3(b,c,d,e,a,49);
|
||||||
|
R3(a,b,c,d,e,50);
|
||||||
|
R3(e,a,b,c,d,51);
|
||||||
|
R3(d,e,a,b,c,52);
|
||||||
|
R3(c,d,e,a,b,53);
|
||||||
|
R3(b,c,d,e,a,54);
|
||||||
|
R3(a,b,c,d,e,55);
|
||||||
|
R3(e,a,b,c,d,56);
|
||||||
|
R3(d,e,a,b,c,57);
|
||||||
|
R3(c,d,e,a,b,58);
|
||||||
|
R3(b,c,d,e,a,59);
|
||||||
|
R4(a,b,c,d,e,60);
|
||||||
|
R4(e,a,b,c,d,61);
|
||||||
|
R4(d,e,a,b,c,62);
|
||||||
|
R4(c,d,e,a,b,63);
|
||||||
|
R4(b,c,d,e,a,64);
|
||||||
|
R4(a,b,c,d,e,65);
|
||||||
|
R4(e,a,b,c,d,66);
|
||||||
|
R4(d,e,a,b,c,67);
|
||||||
|
R4(c,d,e,a,b,68);
|
||||||
|
R4(b,c,d,e,a,69);
|
||||||
|
R4(a,b,c,d,e,70);
|
||||||
|
R4(e,a,b,c,d,71);
|
||||||
|
R4(d,e,a,b,c,72);
|
||||||
|
R4(c,d,e,a,b,73);
|
||||||
|
R4(b,c,d,e,a,74);
|
||||||
|
R4(a,b,c,d,e,75);
|
||||||
|
R4(e,a,b,c,d,76);
|
||||||
|
R4(d,e,a,b,c,77);
|
||||||
|
R4(c,d,e,a,b,78);
|
||||||
|
R4(b,c,d,e,a,79);
|
||||||
/* Add the working vars back into context.state[] */
|
/* Add the working vars back into context.state[] */
|
||||||
state[0] += a;
|
state[0] += a;
|
||||||
state[1] += b;
|
state[1] += b;
|
||||||
@ -97,8 +156,7 @@ static unsigned char workspace[64];
|
|||||||
|
|
||||||
/* SHA1Init - Initialize new context */
|
/* SHA1Init - Initialize new context */
|
||||||
|
|
||||||
void SHA1Init(SHA1_CTX* context)
|
void SHA1Init(SHA1_CTX* context) {
|
||||||
{
|
|
||||||
/* SHA1 initialization constants */
|
/* SHA1 initialization constants */
|
||||||
context->state[0] = 0x67452301;
|
context->state[0] = 0x67452301;
|
||||||
context->state[1] = 0xEFCDAB89;
|
context->state[1] = 0xEFCDAB89;
|
||||||
@ -111,8 +169,7 @@ void SHA1Init(SHA1_CTX* context)
|
|||||||
|
|
||||||
/* Run your data through this. */
|
/* Run your data through this. */
|
||||||
|
|
||||||
void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned int len)
|
void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned int len) {
|
||||||
{
|
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
|
|
||||||
j = (context->count[0] >> 3) & 63;
|
j = (context->count[0] >> 3) & 63;
|
||||||
@ -125,16 +182,14 @@ unsigned int i, j;
|
|||||||
SHA1Transform(context->state, &data[i]);
|
SHA1Transform(context->state, &data[i]);
|
||||||
}
|
}
|
||||||
j = 0;
|
j = 0;
|
||||||
}
|
} else i = 0;
|
||||||
else i = 0;
|
|
||||||
memcpy(&context->buffer[j], &data[i], len - i);
|
memcpy(&context->buffer[j], &data[i], len - i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Add padding and return the message digest. */
|
/* Add padding and return the message digest. */
|
||||||
|
|
||||||
void SHA1Final(unsigned char digest[20], SHA1_CTX* context)
|
void SHA1Final(unsigned char digest[20], SHA1_CTX* context) {
|
||||||
{
|
|
||||||
unsigned long i, j;
|
unsigned long i, j;
|
||||||
unsigned char finalcount[8];
|
unsigned char finalcount[8];
|
||||||
|
|
||||||
|
@ -13,8 +13,7 @@
|
|||||||
#define MAX_TITLES 256
|
#define MAX_TITLES 256
|
||||||
|
|
||||||
|
|
||||||
s32 Title_GetList(u64 **outbuf, u32 *outlen)
|
s32 Title_GetList(u64 **outbuf, u32 *outlen) {
|
||||||
{
|
|
||||||
u64 *titles = NULL;
|
u64 *titles = NULL;
|
||||||
|
|
||||||
u32 len, nb_titles;
|
u32 len, nb_titles;
|
||||||
@ -52,8 +51,7 @@ err:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 Title_GetTicketViews(u64 tid, tikview **outbuf, u32 *outlen)
|
s32 Title_GetTicketViews(u64 tid, tikview **outbuf, u32 *outlen) {
|
||||||
{
|
|
||||||
tikview *views = NULL;
|
tikview *views = NULL;
|
||||||
|
|
||||||
u32 nb_views;
|
u32 nb_views;
|
||||||
@ -88,8 +86,7 @@ err:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 Title_GetTMD(u64 tid, signed_blob **outbuf, u32 *outlen)
|
s32 Title_GetTMD(u64 tid, signed_blob **outbuf, u32 *outlen) {
|
||||||
{
|
|
||||||
void *p_tmd = NULL;
|
void *p_tmd = NULL;
|
||||||
|
|
||||||
u32 len;
|
u32 len;
|
||||||
@ -124,8 +121,7 @@ err:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 Title_GetVersion(u64 tid, u16 *outbuf)
|
s32 Title_GetVersion(u64 tid, u16 *outbuf) {
|
||||||
{
|
|
||||||
signed_blob *p_tmd = NULL;
|
signed_blob *p_tmd = NULL;
|
||||||
tmd *tmd_data = NULL;
|
tmd *tmd_data = NULL;
|
||||||
|
|
||||||
@ -149,8 +145,7 @@ s32 Title_GetVersion(u64 tid, u16 *outbuf)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 Title_GetSysVersion(u64 tid, u64 *outbuf)
|
s32 Title_GetSysVersion(u64 tid, u64 *outbuf) {
|
||||||
{
|
|
||||||
signed_blob *p_tmd = NULL;
|
signed_blob *p_tmd = NULL;
|
||||||
tmd *tmd_data = NULL;
|
tmd *tmd_data = NULL;
|
||||||
|
|
||||||
@ -174,8 +169,7 @@ s32 Title_GetSysVersion(u64 tid, u64 *outbuf)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 Title_GetSize(u64 tid, u32 *outbuf)
|
s32 Title_GetSize(u64 tid, u32 *outbuf) {
|
||||||
{
|
|
||||||
signed_blob *p_tmd = NULL;
|
signed_blob *p_tmd = NULL;
|
||||||
tmd *tmd_data = NULL;
|
tmd *tmd_data = NULL;
|
||||||
|
|
||||||
@ -207,8 +201,7 @@ s32 Title_GetSize(u64 tid, u32 *outbuf)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 Title_GetIOSVersions(u8 **outbuf, u32 *outlen)
|
s32 Title_GetIOSVersions(u8 **outbuf, u32 *outlen) {
|
||||||
{
|
|
||||||
u8 *buffer = NULL;
|
u8 *buffer = NULL;
|
||||||
u64 *list = NULL;
|
u64 *list = NULL;
|
||||||
|
|
||||||
@ -261,8 +254,7 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 Uninstall_RemoveTicket(u64 tid)
|
s32 Uninstall_RemoveTicket(u64 tid) {
|
||||||
{
|
|
||||||
static tikview viewdata[0x10] ATTRIBUTE_ALIGN(32);
|
static tikview viewdata[0x10] ATTRIBUTE_ALIGN(32);
|
||||||
|
|
||||||
u32 cnt, views;
|
u32 cnt, views;
|
||||||
@ -303,8 +295,7 @@ s32 Uninstall_RemoveTicket(u64 tid)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 Uninstall_DeleteTitle(u32 title_u, u32 title_l)
|
s32 Uninstall_DeleteTitle(u32 title_u, u32 title_l) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
char filepath[256];
|
char filepath[256];
|
||||||
sprintf(filepath, "/title/%08x/%08x", title_u, title_l);
|
sprintf(filepath, "/title/%08x/%08x", title_u, title_l);
|
||||||
@ -314,8 +305,7 @@ s32 Uninstall_DeleteTitle(u32 title_u, u32 title_l)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 Uninstall_DeleteTicket(u32 title_u, u32 title_l)
|
s32 Uninstall_DeleteTicket(u32 title_u, u32 title_l) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
char filepath[256];
|
char filepath[256];
|
||||||
@ -329,21 +319,17 @@ s32 Uninstall_DeleteTicket(u32 title_u, u32 title_l)
|
|||||||
|
|
||||||
//carefull when using this function
|
//carefull when using this function
|
||||||
//it will force remove stuff even if something fails
|
//it will force remove stuff even if something fails
|
||||||
s32 Uninstall_FromTitle(const u64 tid)
|
s32 Uninstall_FromTitle(const u64 tid) {
|
||||||
{
|
|
||||||
s32 contents_ret, tik_ret, title_ret, ret;
|
s32 contents_ret, tik_ret, title_ret, ret;
|
||||||
u32 id = tid & 0xFFFFFFFF, kind = tid >> 32;
|
u32 id = tid & 0xFFFFFFFF, kind = tid >> 32;
|
||||||
contents_ret = tik_ret = title_ret = ret = 0;
|
contents_ret = tik_ret = title_ret = ret = 0;
|
||||||
|
|
||||||
if (kind == 1)
|
if (kind == 1) {
|
||||||
{
|
|
||||||
// Delete title and ticket at FS level.
|
// Delete title and ticket at FS level.
|
||||||
tik_ret = Uninstall_DeleteTicket(kind, id);
|
tik_ret = Uninstall_DeleteTicket(kind, id);
|
||||||
title_ret = Uninstall_DeleteTitle(kind, id);
|
title_ret = Uninstall_DeleteTitle(kind, id);
|
||||||
contents_ret = title_ret;
|
contents_ret = title_ret;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// Remove title (contents and ticket)
|
// Remove title (contents and ticket)
|
||||||
tik_ret = Uninstall_RemoveTicket(tid);
|
tik_ret = Uninstall_RemoveTicket(tid);
|
||||||
contents_ret = ES_DeleteTitleContent(tid);
|
contents_ret = ES_DeleteTitleContent(tid);
|
||||||
@ -491,8 +477,7 @@ languages
|
|||||||
// Identify as super user
|
// Identify as super user
|
||||||
Identify_SU();
|
Identify_SU();
|
||||||
fh = ISFS_Open(file, ISFS_OPEN_READ);
|
fh = ISFS_Open(file, ISFS_OPEN_READ);
|
||||||
}
|
} else if (fh < 0)
|
||||||
else if (fh < 0)
|
|
||||||
return fh;
|
return fh;
|
||||||
|
|
||||||
// Jump to start of the name entries
|
// Jump to start of the name entries
|
||||||
@ -524,8 +509,7 @@ languages
|
|||||||
sprintf(name, "%s", str[lang]);
|
sprintf(name, "%s", str[lang]);
|
||||||
if (strlen(str[lang+1]) > 1)
|
if (strlen(str[lang+1]) > 1)
|
||||||
sprintf(name, "%s (%s)", name, str[lang+1]);
|
sprintf(name, "%s (%s)", name, str[lang+1]);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
sprintf(name, "%s", str[2]);
|
sprintf(name, "%s", str[2]);
|
||||||
if (strlen(str[3]) > 1)
|
if (strlen(str[3]) > 1)
|
||||||
sprintf(name, "%s (%s)", name, str[3]);
|
sprintf(name, "%s (%s)", name, str[3]);
|
||||||
@ -549,7 +533,11 @@ s32 printContent(u64 tid){
|
|||||||
u8 br = 0;
|
u8 br = 0;
|
||||||
for (; strlen(ptr) > 0; ptr += strlen(ptr) + 1) {
|
for (; strlen(ptr) > 0; ptr += strlen(ptr) + 1) {
|
||||||
printf(" %-12.12s", ptr);
|
printf(" %-12.12s", ptr);
|
||||||
br++; if (br == 4) { br = 0; printf("\n"); }
|
br++;
|
||||||
|
if (br == 4) {
|
||||||
|
br = 0;
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (br != 0)
|
if (br != 0)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -24,8 +24,7 @@ Copyright (C) 2008 tona and/or waninkoko
|
|||||||
#define _TITLE_H_
|
#define _TITLE_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
/* Constants */
|
/* Constants */
|
||||||
#define BLOCK_SIZE 1024
|
#define BLOCK_SIZE 1024
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
#define _UTILS_H_
|
#define _UTILS_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
/* Constants */
|
/* Constants */
|
||||||
#define KB_SIZE 1024.0
|
#define KB_SIZE 1024.0
|
||||||
|
@ -117,164 +117,6 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*s32 Wad_Install(FILE *fp)
|
|
||||||
{
|
|
||||||
wadHeader *header = NULL;
|
|
||||||
signed_blob *p_certs = NULL, *p_crl = NULL, *p_tik = NULL, *p_tmd = NULL;
|
|
||||||
|
|
||||||
tmd *tmd_data = NULL;
|
|
||||||
|
|
||||||
u32 cnt, offset = 0;
|
|
||||||
s32 ret = 666;
|
|
||||||
|
|
||||||
//WindowPrompt("Here we go...","don't turn off your Wii",0,0,0,0,200);
|
|
||||||
// WAD header
|
|
||||||
//ret = __Wad_ReadAlloc(fp, (void *)header, offset, sizeof(wadHeader));
|
|
||||||
ret = __Wad_ReadAlloc(fp, (void **)&header, offset, sizeof(wadHeader));
|
|
||||||
|
|
||||||
if (ret < 0)
|
|
||||||
goto err;
|
|
||||||
else
|
|
||||||
offset += round_up(header->header_len, 64);
|
|
||||||
|
|
||||||
// WAD certificates
|
|
||||||
//ret = __Wad_ReadAlloc(fp, (void *)&p_certs, offset, header->certs_len);
|
|
||||||
ret = __Wad_ReadAlloc(fp, (void **)&p_certs, offset, header->certs_len);
|
|
||||||
if (ret < 0)
|
|
||||||
goto err;
|
|
||||||
else
|
|
||||||
offset += round_up(header->certs_len, 64);
|
|
||||||
|
|
||||||
// WAD crl
|
|
||||||
|
|
||||||
if (header->crl_len) {
|
|
||||||
//ret = __Wad_ReadAlloc(fp, (void *)&p_crl, offset, header->crl_len);
|
|
||||||
ret = __Wad_ReadAlloc(fp, (void **)&p_crl, offset, header->crl_len);
|
|
||||||
if (ret < 0)
|
|
||||||
goto err;
|
|
||||||
else
|
|
||||||
offset += round_up(header->crl_len, 64);
|
|
||||||
}
|
|
||||||
|
|
||||||
// WAD ticket
|
|
||||||
//ret = __Wad_ReadAlloc(fp, (void *)&p_tik, offset, header->tik_len);
|
|
||||||
ret = __Wad_ReadAlloc(fp, (void **)&p_tik, offset, header->tik_len);
|
|
||||||
if (ret < 0)
|
|
||||||
goto err;
|
|
||||||
else
|
|
||||||
offset += round_up(header->tik_len, 64);
|
|
||||||
|
|
||||||
// WAD TMD
|
|
||||||
//ret = __Wad_ReadAlloc(fp, (void *)&p_tmd, offset, header->tmd_len);
|
|
||||||
ret = __Wad_ReadAlloc(fp, (void **)&p_tmd, offset, header->tmd_len);
|
|
||||||
if (ret < 0)
|
|
||||||
goto err;
|
|
||||||
else
|
|
||||||
offset += round_up(header->tmd_len, 64);
|
|
||||||
|
|
||||||
//WindowPrompt("Installing ticket...",0,0,0,0,0,200);
|
|
||||||
|
|
||||||
// Install ticket
|
|
||||||
ret = ES_AddTicket(p_tik, header->tik_len, p_certs, header->certs_len, p_crl, header->crl_len);
|
|
||||||
if (ret < 0)
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
//WindowPrompt(">> Installing title...",0,0,0,0,0,200);
|
|
||||||
|
|
||||||
// Install title
|
|
||||||
ret = ES_AddTitleStart(p_tmd, header->tmd_len, p_certs, header->certs_len, p_crl, header->crl_len);
|
|
||||||
if (ret < 0)
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
// Get TMD info
|
|
||||||
tmd_data = (tmd *)SIGNATURE_PAYLOAD(p_tmd);
|
|
||||||
|
|
||||||
// Install contents
|
|
||||||
for (cnt = 0; cnt < tmd_data->num_contents; cnt++) {
|
|
||||||
tmd_content *content = &tmd_data->contents[cnt];
|
|
||||||
|
|
||||||
u32 idx = 0, len;
|
|
||||||
s32 cfd;
|
|
||||||
|
|
||||||
//printf("\r\t\t>> Installing content #%02d...", content->cid);
|
|
||||||
|
|
||||||
// Encrypted content size
|
|
||||||
len = round_up(content->size, 64);
|
|
||||||
|
|
||||||
// Install content
|
|
||||||
cfd = ES_AddContentStart(tmd_data->title_id, content->cid);
|
|
||||||
if (cfd < 0) {
|
|
||||||
ret = cfd;
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Install content data
|
|
||||||
while (idx < len) {
|
|
||||||
u32 size;
|
|
||||||
|
|
||||||
// Data length
|
|
||||||
size = (len - idx);
|
|
||||||
if (size > BLOCK_SIZE)
|
|
||||||
size = BLOCK_SIZE;
|
|
||||||
|
|
||||||
// Read data
|
|
||||||
ret = __Wad_ReadFile(fp, &wadBuffer, offset, size);
|
|
||||||
if (ret < 0)
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
// Install data
|
|
||||||
ret = ES_AddContentData(cfd, wadBuffer, size);
|
|
||||||
if (ret < 0)
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
// Increase variables
|
|
||||||
idx += size;
|
|
||||||
offset += size;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Finish content installation
|
|
||||||
ret = ES_AddContentFinish(cfd);
|
|
||||||
if (ret < 0)
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
|
|
||||||
//WindowPrompt(">> Finishing installation...",0,0,0,0,0,200);
|
|
||||||
|
|
||||||
// Finish title install
|
|
||||||
ret = ES_AddTitleFinish();
|
|
||||||
if (ret >= 0) {
|
|
||||||
// printf(" OK!\n");
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
err:
|
|
||||||
//char titties[100];
|
|
||||||
//snprintf(titties, sizeof(titties), "%d", ret);
|
|
||||||
//printf(" ERROR! (ret = %d)\n", ret);
|
|
||||||
//WindowPrompt("ERROR!",titties,"Back",0,0);
|
|
||||||
// Cancel install
|
|
||||||
ES_AddTitleCancel();
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
out:
|
|
||||||
// Free memory
|
|
||||||
if (header)
|
|
||||||
free(header);
|
|
||||||
if (p_certs)
|
|
||||||
free(p_certs);
|
|
||||||
if (p_crl)
|
|
||||||
free(p_crl);
|
|
||||||
if (p_tik)
|
|
||||||
free(p_tik);
|
|
||||||
if (p_tmd)
|
|
||||||
free(p_tmd);
|
|
||||||
|
|
||||||
//WindowPrompt(tr("Success"),"The wad file was installed","Ok");
|
|
||||||
return ret;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
s32 Wad_Install(FILE *fp)
|
s32 Wad_Install(FILE *fp)
|
||||||
{
|
{
|
||||||
//////start the gui shit
|
//////start the gui shit
|
||||||
@ -575,11 +417,8 @@ out:
|
|||||||
free(p_tmd);
|
free(p_tmd);
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
//WindowPrompt(tr("Success"),"The wad file was installed","Ok");
|
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
//promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
|
|
||||||
//while(promptWindow.GetEffect() > 0) usleep(50);
|
|
||||||
msg5Txt.SetText(tr("Finishing installation... Ok!"));
|
msg5Txt.SetText(tr("Finishing installation... Ok!"));
|
||||||
promptWindow.Append(&btn1);
|
promptWindow.Append(&btn1);
|
||||||
while(btn1.GetState() != STATE_CLICKED){
|
while(btn1.GetState() != STATE_CLICKED){
|
||||||
@ -598,7 +437,6 @@ exit:
|
|||||||
s32 Wad_Uninstall(FILE *fp)
|
s32 Wad_Uninstall(FILE *fp)
|
||||||
{
|
{
|
||||||
//////start the gui shit
|
//////start the gui shit
|
||||||
//////start the gui shit
|
|
||||||
GuiWindow promptWindow(472,320);
|
GuiWindow promptWindow(472,320);
|
||||||
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
||||||
promptWindow.SetPosition(0, -10);
|
promptWindow.SetPosition(0, -10);
|
||||||
@ -778,11 +616,8 @@ out:
|
|||||||
|
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
//WindowPrompt(tr("Success"),"The wad file was installed","Ok");
|
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
//promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
|
|
||||||
//while(promptWindow.GetEffect() > 0) usleep(50);
|
|
||||||
msg5Txt.SetText(tr("Done!"));
|
msg5Txt.SetText(tr("Done!"));
|
||||||
promptWindow.Append(&btn1);
|
promptWindow.Append(&btn1);
|
||||||
while(btn1.GetState() != STATE_CLICKED){
|
while(btn1.GetState() != STATE_CLICKED){
|
||||||
|
@ -10,20 +10,17 @@
|
|||||||
|
|
||||||
extern u8 shutdown;
|
extern u8 shutdown;
|
||||||
|
|
||||||
void __Wpad_PowerCallback(s32 chan)
|
void __Wpad_PowerCallback(s32 chan) {
|
||||||
{
|
|
||||||
/* Poweroff console */
|
/* Poweroff console */
|
||||||
shutdown = 1;
|
shutdown = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WPad_SetIdleTime(u32 seconds)
|
void WPad_SetIdleTime(u32 seconds) {
|
||||||
{
|
|
||||||
/*Set idle time for wiimote*/
|
/*Set idle time for wiimote*/
|
||||||
WPAD_SetIdleTimeout(seconds);
|
WPAD_SetIdleTimeout(seconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 Wpad_Init(void)
|
s32 Wpad_Init(void) {
|
||||||
{
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
/* Initialize Wiimote subsystem */
|
/* Initialize Wiimote subsystem */
|
||||||
@ -37,8 +34,7 @@ s32 Wpad_Init(void)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wpad_Disconnect(void)
|
void Wpad_Disconnect(void) {
|
||||||
{
|
|
||||||
u32 cnt;
|
u32 cnt;
|
||||||
|
|
||||||
/* Disconnect Wiimotes */
|
/* Disconnect Wiimotes */
|
||||||
@ -49,8 +45,7 @@ void Wpad_Disconnect(void)
|
|||||||
WPAD_Shutdown();
|
WPAD_Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsWpadConnected()
|
bool IsWpadConnected() {
|
||||||
{
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
u32 test = 0;
|
u32 test = 0;
|
||||||
int notconnected = 0;
|
int notconnected = 0;
|
||||||
@ -77,8 +72,7 @@ u32 ButtonsHold(void) {
|
|||||||
#endif
|
#endif
|
||||||
PAD_ScanPads();
|
PAD_ScanPads();
|
||||||
|
|
||||||
for(i=3; i >= 0; i--)
|
for (i=3; i >= 0; i--) {
|
||||||
{
|
|
||||||
buttons |= PAD_ButtonsHeld(i);
|
buttons |= PAD_ButtonsHeld(i);
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
buttons |= WPAD_ButtonsHeld(i);
|
buttons |= WPAD_ButtonsHeld(i);
|
||||||
@ -97,8 +91,7 @@ u32 ButtonsPressed(void) {
|
|||||||
#endif
|
#endif
|
||||||
PAD_ScanPads();
|
PAD_ScanPads();
|
||||||
|
|
||||||
for(i=3; i >= 0; i--)
|
for (i=3; i >= 0; i--) {
|
||||||
{
|
|
||||||
buttons |= PAD_ButtonsDown(i);
|
buttons |= PAD_ButtonsDown(i);
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
buttons |= WPAD_ButtonsDown(i);
|
buttons |= WPAD_ButtonsDown(i);
|
||||||
|
@ -4,8 +4,7 @@
|
|||||||
#include <wiiuse/wpad.h>
|
#include <wiiuse/wpad.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Prototypes */
|
/* Prototypes */
|
||||||
|
111
source/xml/xml.c
111
source/xml/xml.c
@ -23,8 +23,7 @@ extern struct SSettings Settings; // for loader GX
|
|||||||
struct gameXMLinfo gameinfo;
|
struct gameXMLinfo gameinfo;
|
||||||
struct gameXMLinfo gameinfo_reset;
|
struct gameXMLinfo gameinfo_reset;
|
||||||
|
|
||||||
static char langlist[11][22] =
|
static char langlist[11][22] = {{"Console Default"},
|
||||||
{{"Console Default"},
|
|
||||||
{"Japanese"},
|
{"Japanese"},
|
||||||
{"English"},
|
{"English"},
|
||||||
{"German"},
|
{"German"},
|
||||||
@ -34,10 +33,10 @@ static char langlist[11][22] =
|
|||||||
{"Dutch"},
|
{"Dutch"},
|
||||||
{"S. Chinese"},
|
{"S. Chinese"},
|
||||||
{"T. Chinese"},
|
{"T. Chinese"},
|
||||||
{"Korean"}};
|
{"Korean"}
|
||||||
|
};
|
||||||
|
|
||||||
static char langcodes[11][3] =
|
static char langcodes[11][3] = {{""},
|
||||||
{{""},
|
|
||||||
{"JA"},
|
{"JA"},
|
||||||
{"EN"},
|
{"EN"},
|
||||||
{"DE"},
|
{"DE"},
|
||||||
@ -47,7 +46,8 @@ static char langcodes[11][3] =
|
|||||||
{"NL"},
|
{"NL"},
|
||||||
{"ZH"},
|
{"ZH"},
|
||||||
{"ZH"},
|
{"ZH"},
|
||||||
{"KO"}};
|
{"KO"}
|
||||||
|
};
|
||||||
|
|
||||||
static char element_text[5000];
|
static char element_text[5000];
|
||||||
static mxml_node_t *nodetree=NULL;
|
static mxml_node_t *nodetree=NULL;
|
||||||
@ -63,8 +63,7 @@ bool xml_loaded = false;
|
|||||||
|
|
||||||
|
|
||||||
/* load renamed titles from proper names and game info XML, needs to be after cfg_load_games */
|
/* load renamed titles from proper names and game info XML, needs to be after cfg_load_games */
|
||||||
bool OpenXMLDatabase(char* xmlfilepath, char* argdblang, bool argJPtoEN, bool openfile, bool loadtitles, bool keepopen)
|
bool OpenXMLDatabase(char* xmlfilepath, char* argdblang, bool argJPtoEN, bool openfile, bool loadtitles, bool keepopen) {
|
||||||
{
|
|
||||||
if (!xml_loaded) {
|
if (!xml_loaded) {
|
||||||
bool opensuccess = false;
|
bool opensuccess = false;
|
||||||
char pathname[200];
|
char pathname[200];
|
||||||
@ -86,8 +85,7 @@ bool OpenXMLDatabase(char* xmlfilepath, char* argdblang, bool argJPtoEN, bool op
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CloseXMLDatabase()
|
void CloseXMLDatabase() {
|
||||||
{
|
|
||||||
/* free memory */
|
/* free memory */
|
||||||
if (xml_loaded) {
|
if (xml_loaded) {
|
||||||
mxmlDelete(nodedata);
|
mxmlDelete(nodedata);
|
||||||
@ -98,8 +96,7 @@ void CloseXMLDatabase()
|
|||||||
|
|
||||||
|
|
||||||
void GetTextFromNode(mxml_node_t *currentnode, mxml_node_t *topnode, char *nodename,
|
void GetTextFromNode(mxml_node_t *currentnode, mxml_node_t *topnode, char *nodename,
|
||||||
char *attributename, char *value, int descend, char *dest, int destsize)
|
char *attributename, char *value, int descend, char *dest, int destsize) {
|
||||||
{
|
|
||||||
*element_text = 0;
|
*element_text = 0;
|
||||||
nodefound = mxmlFindElement(currentnode, topnode, nodename, attributename, value, descend);
|
nodefound = mxmlFindElement(currentnode, topnode, nodename, attributename, value, descend);
|
||||||
if (nodefound != NULL) {
|
if (nodefound != NULL) {
|
||||||
@ -115,8 +112,7 @@ void GetTextFromNode(mxml_node_t *currentnode, mxml_node_t *topnode, char *noden
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool OpenXMLFile(char *filename)
|
bool OpenXMLFile(char *filename) {
|
||||||
{
|
|
||||||
//if (xmldebug) dbg_time1();
|
//if (xmldebug) dbg_time1();
|
||||||
|
|
||||||
if (xml_loaded)
|
if (xml_loaded)
|
||||||
@ -187,8 +183,7 @@ bool OpenXMLFile(char *filename)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
char *GetLangSettingFromGame(char *gameid)
|
char *GetLangSettingFromGame(char *gameid) {
|
||||||
{
|
|
||||||
int langcode;
|
int langcode;
|
||||||
struct Game_CFG *game_cfg = NULL;
|
struct Game_CFG *game_cfg = NULL;
|
||||||
game_cfg = CFG_get_game_opt((u8*)gameid);
|
game_cfg = CFG_get_game_opt((u8*)gameid);
|
||||||
@ -204,11 +199,9 @@ char *GetLangSettingFromGame(char *gameid)
|
|||||||
|
|
||||||
|
|
||||||
/* convert language text into ISO 639 two-letter language code */
|
/* convert language text into ISO 639 two-letter language code */
|
||||||
char *ConvertLangTextToCode(char *languagetxt)
|
char *ConvertLangTextToCode(char *languagetxt) {
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
for (i=0;i<=10;i++)
|
for (i=0;i<=10;i++) {
|
||||||
{
|
|
||||||
if (!strcasecmp(languagetxt,langlist[i])) // case insensitive comparison
|
if (!strcasecmp(languagetxt,langlist[i])) // case insensitive comparison
|
||||||
return langcodes[i];
|
return langcodes[i];
|
||||||
}
|
}
|
||||||
@ -216,17 +209,21 @@ char *ConvertLangTextToCode(char *languagetxt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char ConvertRatingToIndex(char *ratingtext)
|
char ConvertRatingToIndex(char *ratingtext) {
|
||||||
{
|
|
||||||
int type = -1;
|
int type = -1;
|
||||||
if (!strcmp(ratingtext,"CERO")) { type = 0; }
|
if (!strcmp(ratingtext,"CERO")) {
|
||||||
if (!strcmp(ratingtext,"ESRB")) { type = 1; }
|
type = 0;
|
||||||
if (!strcmp(ratingtext,"PEGI")) { type = 2; }
|
}
|
||||||
|
if (!strcmp(ratingtext,"ESRB")) {
|
||||||
|
type = 1;
|
||||||
|
}
|
||||||
|
if (!strcmp(ratingtext,"PEGI")) {
|
||||||
|
type = 2;
|
||||||
|
}
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConvertRating(char *ratingvalue, char *fromrating, char *torating, char *destvalue, int destsize)
|
void ConvertRating(char *ratingvalue, char *fromrating, char *torating, char *destvalue, int destsize) {
|
||||||
{
|
|
||||||
if (!strcmp(fromrating,torating)) {
|
if (!strcmp(fromrating,torating)) {
|
||||||
strlcpy(destvalue,ratingvalue,destsize);
|
strlcpy(destvalue,ratingvalue,destsize);
|
||||||
return;
|
return;
|
||||||
@ -245,8 +242,7 @@ void ConvertRating(char *ratingvalue, char *fromrating, char *torating, char *de
|
|||||||
/* the list is ordered to pick the most likely value first: */
|
/* the list is ordered to pick the most likely value first: */
|
||||||
/* EC and AO are less likely to be used so they are moved down to only be picked up when converting ESRB to PEGI or CERO */
|
/* EC and AO are less likely to be used so they are moved down to only be picked up when converting ESRB to PEGI or CERO */
|
||||||
/* the conversion can never be perfect because ratings can differ between regions for the same game */
|
/* the conversion can never be perfect because ratings can differ between regions for the same game */
|
||||||
char ratingtable[12][3][4] =
|
char ratingtable[12][3][4] = {
|
||||||
{
|
|
||||||
{{"A"},{"E"},{"3"}},
|
{{"A"},{"E"},{"3"}},
|
||||||
{{"A"},{"E"},{"4"}},
|
{{"A"},{"E"},{"4"}},
|
||||||
{{"A"},{"E"},{"6"}},
|
{{"A"},{"E"},{"6"}},
|
||||||
@ -262,8 +258,7 @@ void ConvertRating(char *ratingvalue, char *fromrating, char *torating, char *de
|
|||||||
};
|
};
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i=0;i<=11;i++)
|
for (i=0;i<=11;i++) {
|
||||||
{
|
|
||||||
if (!strcmp(ratingtable[i][type],ratingvalue)) {
|
if (!strcmp(ratingtable[i][type],ratingvalue)) {
|
||||||
strlcpy(destvalue,ratingtable[i][desttype],destsize);
|
strlcpy(destvalue,ratingtable[i][desttype],destsize);
|
||||||
return;
|
return;
|
||||||
@ -296,8 +291,7 @@ void LoadTitlesFromXML(char *langtxt, bool forcejptoen)
|
|||||||
char title_text_EN[200] = "";
|
char title_text_EN[200] = "";
|
||||||
|
|
||||||
/* search index of id elements, load all id/titles text */
|
/* search index of id elements, load all id/titles text */
|
||||||
while (nodeid != NULL)
|
while (nodeid != NULL) {
|
||||||
{
|
|
||||||
nodeid = mxmlIndexFind(nodeindex,"id", NULL);
|
nodeid = mxmlIndexFind(nodeindex,"id", NULL);
|
||||||
if (nodeid != NULL) {
|
if (nodeid != NULL) {
|
||||||
strcpy(title_text,"");
|
strcpy(title_text,"");
|
||||||
@ -343,8 +337,7 @@ void LoadTitlesFromXML(char *langtxt, bool forcejptoen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GetPublisherFromGameid(char *idtxt, char *dest, int destsize)
|
void GetPublisherFromGameid(char *idtxt, char *dest, int destsize) {
|
||||||
{
|
|
||||||
/* guess publisher from company list using last two characters from game id */
|
/* guess publisher from company list using last two characters from game id */
|
||||||
nodeindextmp = mxmlIndexNew(nodedata,"company", NULL);
|
nodeindextmp = mxmlIndexNew(nodedata,"company", NULL);
|
||||||
nodeidtmp = mxmlIndexReset(nodeindextmp);
|
nodeidtmp = mxmlIndexReset(nodeindextmp);
|
||||||
@ -353,8 +346,7 @@ void GetPublisherFromGameid(char *idtxt, char *dest, int destsize)
|
|||||||
char publishercode[3];
|
char publishercode[3];
|
||||||
sprintf(publishercode,"%c%c", idtxt[4],idtxt[5]);
|
sprintf(publishercode,"%c%c", idtxt[4],idtxt[5]);
|
||||||
|
|
||||||
while (strcmp(element_text,publishercode) != 0)
|
while (strcmp(element_text,publishercode) != 0) {
|
||||||
{
|
|
||||||
nodeidtmp = mxmlIndexFind(nodeindextmp,"company", NULL);
|
nodeidtmp = mxmlIndexFind(nodeindextmp,"company", NULL);
|
||||||
if (nodeidtmp != NULL) {
|
if (nodeidtmp != NULL) {
|
||||||
strlcpy(element_text,mxmlElementGetAttr(nodeidtmp, "code"),sizeof(element_text));
|
strlcpy(element_text,mxmlElementGetAttr(nodeidtmp, "code"),sizeof(element_text));
|
||||||
@ -396,8 +388,7 @@ bool LoadGameInfoFromXML(char* gameid, char* langtxt)
|
|||||||
nodeid = mxmlIndexReset(nodeindex);
|
nodeid = mxmlIndexReset(nodeindex);
|
||||||
*element_text = 0;
|
*element_text = 0;
|
||||||
/* search for game matching gameid */
|
/* search for game matching gameid */
|
||||||
while (1)
|
while (1) {
|
||||||
{
|
|
||||||
nodeid = mxmlIndexFind(nodeindex,"id", NULL);
|
nodeid = mxmlIndexFind(nodeindex,"id", NULL);
|
||||||
if (nodeid != NULL) {
|
if (nodeid != NULL) {
|
||||||
get_text(nodeid, element_text, sizeof(element_text));
|
get_text(nodeid, element_text, sizeof(element_text));
|
||||||
@ -452,8 +443,7 @@ bool LoadGameInfoFromXML(char* gameid, char* langtxt)
|
|||||||
nodefound = mxmlFindElement(nodeid, nodedata, "locale", "lang", NULL, MXML_NO_DESCEND);
|
nodefound = mxmlFindElement(nodeid, nodedata, "locale", "lang", NULL, MXML_NO_DESCEND);
|
||||||
if (nodefound != NULL) {
|
if (nodefound != NULL) {
|
||||||
int incr = 0;
|
int incr = 0;
|
||||||
while (nodefound != NULL)
|
while (nodefound != NULL) {
|
||||||
{
|
|
||||||
++incr;
|
++incr;
|
||||||
strlcpy(gameinfo.locales[incr],mxmlElementGetAttr(nodefound, "lang"),sizeof(gameinfo.locales[incr]));
|
strlcpy(gameinfo.locales[incr],mxmlElementGetAttr(nodefound, "lang"),sizeof(gameinfo.locales[incr]));
|
||||||
nodefound = mxmlWalkNext(nodefound, nodedata, MXML_NO_DESCEND);
|
nodefound = mxmlWalkNext(nodefound, nodedata, MXML_NO_DESCEND);
|
||||||
@ -470,8 +460,7 @@ bool LoadGameInfoFromXML(char* gameid, char* langtxt)
|
|||||||
gameinfo.wifiCnt = 0;
|
gameinfo.wifiCnt = 0;
|
||||||
nodeindextmp = mxmlIndexNew(nodefound,"feature", NULL);
|
nodeindextmp = mxmlIndexNew(nodefound,"feature", NULL);
|
||||||
nodeidtmp = mxmlIndexReset(nodeindextmp);
|
nodeidtmp = mxmlIndexReset(nodeindextmp);
|
||||||
while (nodeidtmp != NULL)
|
while (nodeidtmp != NULL) {
|
||||||
{
|
|
||||||
nodeidtmp = mxmlIndexFind(nodeindextmp,"feature", NULL);
|
nodeidtmp = mxmlIndexFind(nodeindextmp,"feature", NULL);
|
||||||
if (nodeidtmp != NULL) {
|
if (nodeidtmp != NULL) {
|
||||||
++gameinfo.wifiCnt;
|
++gameinfo.wifiCnt;
|
||||||
@ -490,8 +479,7 @@ bool LoadGameInfoFromXML(char* gameid, char* langtxt)
|
|||||||
gameinfo.descriptorCnt=0;
|
gameinfo.descriptorCnt=0;
|
||||||
nodeindextmp = mxmlIndexNew(nodefound,"descriptor", NULL);
|
nodeindextmp = mxmlIndexNew(nodefound,"descriptor", NULL);
|
||||||
nodeidtmp = mxmlIndexReset(nodeindextmp);
|
nodeidtmp = mxmlIndexReset(nodeindextmp);
|
||||||
while (nodeidtmp != NULL)
|
while (nodeidtmp != NULL) {
|
||||||
{
|
|
||||||
nodeidtmp = mxmlIndexFind(nodeindextmp,"descriptor", NULL);
|
nodeidtmp = mxmlIndexFind(nodeindextmp,"descriptor", NULL);
|
||||||
if (nodeidtmp != NULL) {
|
if (nodeidtmp != NULL) {
|
||||||
++gameinfo.descriptorCnt;
|
++gameinfo.descriptorCnt;
|
||||||
@ -511,8 +499,7 @@ bool LoadGameInfoFromXML(char* gameid, char* langtxt)
|
|||||||
gameinfo.accessoryReqCnt=0;
|
gameinfo.accessoryReqCnt=0;
|
||||||
nodeindextmp = mxmlIndexNew(nodefound,"control", NULL);
|
nodeindextmp = mxmlIndexNew(nodefound,"control", NULL);
|
||||||
nodeidtmp = mxmlIndexReset(nodeindextmp);
|
nodeidtmp = mxmlIndexReset(nodeindextmp);
|
||||||
while (nodeidtmp != NULL)
|
while (nodeidtmp != NULL) {
|
||||||
{
|
|
||||||
nodeidtmp = mxmlIndexFind(nodeindextmp,"control", NULL);
|
nodeidtmp = mxmlIndexFind(nodeindextmp,"control", NULL);
|
||||||
if (nodeidtmp != NULL) {
|
if (nodeidtmp != NULL) {
|
||||||
if (!strcmp(mxmlElementGetAttr(nodeidtmp, "required"),"true") && gameinfo.accessoryReqCnt < XML_ELEMMAX) {
|
if (!strcmp(mxmlElementGetAttr(nodeidtmp, "required"),"true") && gameinfo.accessoryReqCnt < XML_ELEMMAX) {
|
||||||
@ -547,8 +534,7 @@ bool LoadGameInfoFromXML(char* gameid, char* langtxt)
|
|||||||
trimcopy(splitresult,splitresult,strlen(splitresult)+1);
|
trimcopy(splitresult,splitresult,strlen(splitresult)+1);
|
||||||
strlcpy(gameinfo.genresplit[gameinfo.genreCnt],splitresult,sizeof(gameinfo.genresplit[gameinfo.genreCnt]));
|
strlcpy(gameinfo.genresplit[gameinfo.genreCnt],splitresult,sizeof(gameinfo.genresplit[gameinfo.genreCnt]));
|
||||||
gameinfo.genresplit[gameinfo.genreCnt][0] = toupper(gameinfo.genresplit[gameinfo.genreCnt][0]);
|
gameinfo.genresplit[gameinfo.genreCnt][0] = toupper(gameinfo.genresplit[gameinfo.genreCnt][0]);
|
||||||
while (splitresult != NULL)
|
while (splitresult != NULL) {
|
||||||
{
|
|
||||||
splitresult = strtok(NULL, delimgenre);
|
splitresult = strtok(NULL, delimgenre);
|
||||||
if (splitresult != NULL && strcmp(splitresult,"")!=0) {
|
if (splitresult != NULL && strcmp(splitresult,"")!=0) {
|
||||||
++gameinfo.genreCnt;
|
++gameinfo.genreCnt;
|
||||||
@ -598,8 +584,7 @@ bool LoadGameInfoFromXML(char* gameid, char* langtxt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PrintGameInfo(bool showfullinfo)
|
void PrintGameInfo(bool showfullinfo) {
|
||||||
{
|
|
||||||
if (showfullinfo) {
|
if (showfullinfo) {
|
||||||
|
|
||||||
//Con_Clear();
|
//Con_Clear();
|
||||||
@ -608,8 +593,7 @@ void PrintGameInfo(bool showfullinfo)
|
|||||||
//printf("title: %s\n",gameinfo.title);
|
//printf("title: %s\n",gameinfo.title);
|
||||||
int i;
|
int i;
|
||||||
printf("languages:");
|
printf("languages:");
|
||||||
for (i=1;strcmp(gameinfo.locales[i],"") != 0;i++)
|
for (i=1;strcmp(gameinfo.locales[i],"") != 0;i++) {
|
||||||
{
|
|
||||||
printf(" %s",gameinfo.locales[i]);
|
printf(" %s",gameinfo.locales[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@ -621,27 +605,23 @@ void PrintGameInfo(bool showfullinfo)
|
|||||||
//printf("rating: %s %s (CERO: %s ESRB: %s PEGI: %s)\n",gameinfo.ratingtype, gameinfo.ratingvalue,
|
//printf("rating: %s %s (CERO: %s ESRB: %s PEGI: %s)\n",gameinfo.ratingtype, gameinfo.ratingvalue,
|
||||||
// gameinfo.ratingvalueCERO,gameinfo.ratingvalueESRB,gameinfo.ratingvaluePEGI);
|
// gameinfo.ratingvalueCERO,gameinfo.ratingvalueESRB,gameinfo.ratingvaluePEGI);
|
||||||
printf("content descriptors:");
|
printf("content descriptors:");
|
||||||
for (i=1;strcmp(gameinfo.wififeatures[i],"") != 0;i++)
|
for (i=1;strcmp(gameinfo.wififeatures[i],"") != 0;i++) {
|
||||||
{
|
|
||||||
printf(" %s",gameinfo.ratingdescriptors[i]);
|
printf(" %s",gameinfo.ratingdescriptors[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("players: %s online: %s\n",gameinfo.players,gameinfo.wifiplayers);
|
printf("players: %s online: %s\n",gameinfo.players,gameinfo.wifiplayers);
|
||||||
printf("online features:");
|
printf("online features:");
|
||||||
for (i=1;strcmp(gameinfo.wififeatures[i],"") != 0;i++)
|
for (i=1;strcmp(gameinfo.wififeatures[i],"") != 0;i++) {
|
||||||
{
|
|
||||||
printf(" %s",gameinfo.wififeatures[i]);
|
printf(" %s",gameinfo.wififeatures[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("required accessories:");
|
printf("required accessories:");
|
||||||
for (i=1;strcmp(gameinfo.accessoriesReq[i],"") != 0;i++)
|
for (i=1;strcmp(gameinfo.accessoriesReq[i],"") != 0;i++) {
|
||||||
{
|
|
||||||
printf(" %s",gameinfo.accessoriesReq[i]);
|
printf(" %s",gameinfo.accessoriesReq[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("accessories:");
|
printf("accessories:");
|
||||||
for (i=1;strcmp(gameinfo.accessories[i],"") != 0;i++)
|
for (i=1;strcmp(gameinfo.accessories[i],"") != 0;i++) {
|
||||||
{
|
|
||||||
printf(" %s",gameinfo.accessories[i]);
|
printf(" %s",gameinfo.accessories[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@ -704,8 +684,7 @@ void PrintGameInfo(bool showfullinfo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *MemInfo()
|
char *MemInfo() {
|
||||||
{
|
|
||||||
char linebuf[300] = "";
|
char linebuf[300] = "";
|
||||||
char memtotal[20];
|
char memtotal[20];
|
||||||
char memused[20];
|
char memused[20];
|
||||||
@ -726,15 +705,13 @@ char *MemInfo()
|
|||||||
|
|
||||||
/*-------------------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------------------*/
|
||||||
/* get_text() - Get the text for a node, taken from mini-mxml example mxmldoc.c */
|
/* get_text() - Get the text for a node, taken from mini-mxml example mxmldoc.c */
|
||||||
static char * get_text(mxml_node_t *node, char *buffer, int buflen) /* O - Text in node, I - Node to get, I - Buffer, I - Size of buffer */
|
static char * get_text(mxml_node_t *node, char *buffer, int buflen) { /* O - Text in node, I - Node to get, I - Buffer, I - Size of buffer */
|
||||||
{
|
|
||||||
char *ptr, *end; /* Pointer into buffer, End of buffer */
|
char *ptr, *end; /* Pointer into buffer, End of buffer */
|
||||||
int len; /* Length of node */
|
int len; /* Length of node */
|
||||||
mxml_node_t *current; /* Current node */
|
mxml_node_t *current; /* Current node */
|
||||||
ptr = buffer;
|
ptr = buffer;
|
||||||
end = buffer + buflen - 1;
|
end = buffer + buflen - 1;
|
||||||
for (current = node->child; current && ptr < end; current = current->next)
|
for (current = node->child; current && ptr < end; current = current->next) {
|
||||||
{
|
|
||||||
if (current->type == MXML_TEXT) {
|
if (current->type == MXML_TEXT) {
|
||||||
if (current->value.text.whitespace)
|
if (current->value.text.whitespace)
|
||||||
*ptr++ = ' ';
|
*ptr++ = ' ';
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user