mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-25 12:46:53 +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;
|
||||
struct stat st;
|
||||
|
||||
if(fontPath && (stat(fontPath, &st)==0))
|
||||
{
|
||||
if (fontPath && (stat(fontPath, &st)==0)) {
|
||||
FILE *fontfile = fopen(fontPath, "rb");
|
||||
if (fontfile) {
|
||||
FT_Long ftFace_fromFile_Size;
|
||||
@ -253,13 +252,11 @@ uint16_t FreeTypeGX::loadFont(const char* fontPath, const uint8_t* fontBuffer, F
|
||||
void FreeTypeGX::unloadFont() {
|
||||
clearGlyphData();
|
||||
|
||||
if(this->ftFace)
|
||||
{
|
||||
if (this->ftFace) {
|
||||
FT_Done_Face(this->ftFace);
|
||||
this->ftFace = NULL;
|
||||
}
|
||||
if(this->ftFace_fromFile)
|
||||
{
|
||||
if (this->ftFace_fromFile) {
|
||||
free(this->ftFace_fromFile);
|
||||
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.
|
||||
*/
|
||||
void FreeTypeGX::clearGlyphData()
|
||||
{
|
||||
void FreeTypeGX::clearGlyphData() {
|
||||
if (this->fontData.size() == 0)
|
||||
return;
|
||||
|
||||
@ -476,8 +472,7 @@ void FreeTypeGX::loadGlyphData(FT_Bitmap *bmp, ftgxCharData *charData) {
|
||||
*/
|
||||
int16_t FreeTypeGX::getStyleOffsetWidth(uint16_t width, uint16_t format) {
|
||||
|
||||
switch(format & FTGX_JUSTIFY_MASK)
|
||||
{
|
||||
switch (format & FTGX_JUSTIFY_MASK) {
|
||||
case FTGX_JUSTIFY_LEFT:
|
||||
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 format Positional format of the string.
|
||||
*/
|
||||
int16_t FreeTypeGX::getStyleOffsetHeight(ftgxDataOffset *offset, uint16_t format)
|
||||
{
|
||||
switch(format & FTGX_ALIGN_MASK)
|
||||
{
|
||||
int16_t FreeTypeGX::getStyleOffsetHeight(ftgxDataOffset *offset, uint16_t format) {
|
||||
switch (format & FTGX_ALIGN_MASK) {
|
||||
case FTGX_ALIGN_TOP:
|
||||
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;
|
||||
if ( this->fontData.find(text[i]) != this->fontData.end() ) {
|
||||
glyphData = &this->fontData[text[i]];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
glyphData = this->cacheGlyphData(text[i]);
|
||||
}
|
||||
|
||||
@ -659,8 +651,7 @@ uint16_t FreeTypeGX::getWidth(wchar_t *text) {
|
||||
ftgxCharData* glyphData = NULL;
|
||||
if ( this->fontData.find(text[i]) != this->fontData.end() ) {
|
||||
glyphData = &this->fontData[text[i]];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
glyphData = this->cacheGlyphData(text[i]);
|
||||
}
|
||||
|
||||
@ -728,8 +719,7 @@ ftgxDataOffset* FreeTypeGX::getOffset(wchar_t *text, ftgxDataOffset* offset) {
|
||||
ftgxCharData* glyphData = NULL;
|
||||
if ( this->fontData.find(text[i]) != this->fontData.end() ) {
|
||||
glyphData = &this->fontData[text[i]];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
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_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
|
||||
* \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 |= 0x8000;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
r = r >> 4;
|
||||
g = g >> 4;
|
||||
b = b >> 4;
|
||||
|
@ -15,8 +15,7 @@
|
||||
*
|
||||
* Initializes the Wii's audio subsystem
|
||||
***************************************************************************/
|
||||
void InitAudio()
|
||||
{
|
||||
void InitAudio() {
|
||||
AUDIO_Init(NULL);
|
||||
ASND_Init();
|
||||
ASND_Pause(0);
|
||||
@ -28,8 +27,7 @@ void InitAudio()
|
||||
* Shuts down audio subsystem. Useful to avoid unpleasant sounds if a
|
||||
* crash occurs during shutdown.
|
||||
***************************************************************************/
|
||||
void ShutdownAudio()
|
||||
{
|
||||
void ShutdownAudio() {
|
||||
ASND_Pause(1);
|
||||
ASND_End();
|
||||
}
|
||||
|
@ -32,8 +32,7 @@ static GuiImageData * cover[BUFFERSIZE];
|
||||
static GuiImage * coverImg[BUFFERSIZE];
|
||||
static GuiImage * NoCover[BUFFERSIZE];
|
||||
|
||||
GuiImage * ImageBuffer(int imagenumber)
|
||||
{
|
||||
GuiImage * ImageBuffer(int imagenumber) {
|
||||
if ((BUFFERSIZE-1 > imagenumber) && direction >= 0) {
|
||||
return coverImg[imagenumber];
|
||||
}
|
||||
@ -49,8 +48,7 @@ GuiImage * ImageBuffer(int imagenumber)
|
||||
return NoCover[imagenumber];
|
||||
}
|
||||
|
||||
void LoadImages()
|
||||
{
|
||||
void LoadImages() {
|
||||
if (!changed || BufferHalt)
|
||||
return;
|
||||
|
||||
@ -203,8 +201,7 @@ void LoadImages()
|
||||
firstime = false;
|
||||
}
|
||||
|
||||
void NewOffset(int off, int d)
|
||||
{
|
||||
void NewOffset(int off, int d) {
|
||||
if (offset == off || loading < BUFFERSIZE)
|
||||
return;
|
||||
|
||||
@ -219,8 +216,7 @@ void NewOffset(int off, int d)
|
||||
/****************************************************************************
|
||||
* HaltBuffer
|
||||
***************************************************************************/
|
||||
void HaltBufferThread()
|
||||
{
|
||||
void HaltBufferThread() {
|
||||
BufferHalt = true;
|
||||
firstime = true;
|
||||
changed = true;
|
||||
@ -245,8 +241,7 @@ void HaltBufferThread()
|
||||
/****************************************************************************
|
||||
* ResumeBufferThread
|
||||
***************************************************************************/
|
||||
void ResumeBufferThread(int offset)
|
||||
{
|
||||
void ResumeBufferThread(int offset) {
|
||||
BufferHalt = false;
|
||||
firstime = true;
|
||||
changed = true;
|
||||
@ -268,10 +263,8 @@ void ResumeBufferThread(int offset)
|
||||
/*********************************************************************************
|
||||
* Bufferthread
|
||||
*********************************************************************************/
|
||||
static void * bufferinitcallback(void *arg)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
static void * bufferinitcallback(void *arg) {
|
||||
while (1) {
|
||||
if (BufferHalt)
|
||||
LWP_SuspendThread(bufferthread);
|
||||
|
||||
@ -283,16 +276,14 @@ static void * bufferinitcallback(void *arg)
|
||||
/****************************************************************************
|
||||
* InitBufferThread with priority 50
|
||||
***************************************************************************/
|
||||
void InitBufferThread()
|
||||
{
|
||||
void InitBufferThread() {
|
||||
LWP_CreateThread(&bufferthread, bufferinitcallback, NULL, NULL, 0, 50);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* ShutdownThread
|
||||
***************************************************************************/
|
||||
void ShutdownBufferThread()
|
||||
{
|
||||
void ShutdownBufferThread() {
|
||||
LWP_JoinThread (bufferthread, NULL);
|
||||
bufferthread = LWP_THREAD_NULL;
|
||||
}
|
||||
|
@ -22,8 +22,7 @@ extern GuiWindow * mainWindow;
|
||||
/****************************************************************************
|
||||
* CheatMenu
|
||||
***************************************************************************/
|
||||
int CheatMenu(const char * gameID)
|
||||
{
|
||||
int CheatMenu(const char * gameID) {
|
||||
int choice = 0;
|
||||
bool exit = false;
|
||||
int ret = 1;
|
||||
@ -67,11 +66,12 @@ int CheatMenu(const char * gameID)
|
||||
//char tmp[10];
|
||||
|
||||
|
||||
switch(check)
|
||||
{
|
||||
case -1: WindowPrompt(tr("Error"),tr("Cheatfile is blank"),tr("OK"));
|
||||
switch (check) {
|
||||
case -1:
|
||||
WindowPrompt(tr("Error"),tr("Cheatfile is blank"),tr("OK"));
|
||||
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);
|
||||
|
||||
//WindowPrompt(0,tmp,tr("OK"),tr("Download Now"));
|
||||
@ -91,8 +91,7 @@ int CheatMenu(const char * gameID)
|
||||
titleTxt.SetMaxWidth(350, GuiText::SCROLL);
|
||||
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.SetName(i, "OFF");
|
||||
}
|
||||
@ -109,36 +108,27 @@ int CheatMenu(const char * gameID)
|
||||
mainWindow->Append(&w);
|
||||
ResumeGui();
|
||||
|
||||
while(!exit)
|
||||
{
|
||||
while (!exit) {
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
ret = chtBrowser.GetClickedOption();
|
||||
if (ret != -1)
|
||||
{
|
||||
if (ret != -1) {
|
||||
const char *strCheck = cheatslst.GetName(ret);
|
||||
if (strncmp(strCheck,"ON",2) == 0)
|
||||
{
|
||||
if (strncmp(strCheck,"ON",2) == 0) {
|
||||
cheatslst.SetName(ret,"%s","OFF");
|
||||
}
|
||||
else if (strncmp(strCheck,"OFF",3) == 0)
|
||||
{
|
||||
} else if (strncmp(strCheck,"OFF",3) == 0) {
|
||||
cheatslst.SetName(ret,"%s","ON");
|
||||
}
|
||||
}
|
||||
|
||||
if(createBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
if (createBtn.GetState() == STATE_CLICKED) {
|
||||
createBtn.ResetState();
|
||||
if (cntcheats > 0)
|
||||
{
|
||||
if (cntcheats > 0) {
|
||||
int selectednrs[30];
|
||||
int x = 0;
|
||||
for(int i = 0; i <= cntcheats; i++)
|
||||
{
|
||||
for (int i = 0; i <= cntcheats; i++) {
|
||||
const char *strCheck = cheatslst.GetName(i);
|
||||
if (strncmp(strCheck,"ON",2) == 0)
|
||||
{
|
||||
if (strncmp(strCheck,"ON",2) == 0) {
|
||||
selectednrs[x] = i;
|
||||
x++;
|
||||
}
|
||||
@ -154,8 +144,7 @@ int CheatMenu(const char * gameID)
|
||||
|
||||
}
|
||||
|
||||
if(backBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
if (backBtn.GetState() == STATE_CLICKED) {
|
||||
backBtn.ResetState();
|
||||
exit = true;
|
||||
break;
|
||||
|
@ -4,68 +4,50 @@
|
||||
|
||||
#define OUTOFRANGE "Error:Range"
|
||||
|
||||
GCTCheats::GCTCheats(void)
|
||||
{
|
||||
GCTCheats::GCTCheats(void) {
|
||||
iCntCheats = 0;
|
||||
}
|
||||
|
||||
GCTCheats::~GCTCheats(void)
|
||||
{
|
||||
GCTCheats::~GCTCheats(void) {
|
||||
}
|
||||
|
||||
int GCTCheats::getCnt()
|
||||
{
|
||||
int GCTCheats::getCnt() {
|
||||
return iCntCheats;
|
||||
}
|
||||
|
||||
string GCTCheats::getGameName(void)
|
||||
{
|
||||
string GCTCheats::getGameName(void) {
|
||||
return sGameTitle;
|
||||
}
|
||||
|
||||
string GCTCheats::getGameID(void)
|
||||
{
|
||||
string GCTCheats::getGameID(void) {
|
||||
return sGameID;
|
||||
}
|
||||
|
||||
string GCTCheats::getCheat(int nr)
|
||||
{
|
||||
if (nr <= (iCntCheats-1))
|
||||
{
|
||||
string GCTCheats::getCheat(int nr) {
|
||||
if (nr <= (iCntCheats-1)) {
|
||||
return sCheats[nr];
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return OUTOFRANGE;//"Error: CheatNr out of range";
|
||||
}
|
||||
}
|
||||
|
||||
string GCTCheats::getCheatName(int nr)
|
||||
{
|
||||
if (nr <= (iCntCheats-1))
|
||||
{
|
||||
string GCTCheats::getCheatName(int nr) {
|
||||
if (nr <= (iCntCheats-1)) {
|
||||
return sCheatName[nr];
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return "Error: CheatNr out of range";
|
||||
}
|
||||
}
|
||||
|
||||
string GCTCheats::getCheatComment(int nr)
|
||||
{
|
||||
if (nr <= (iCntCheats-1))
|
||||
{
|
||||
string GCTCheats::getCheatComment(int nr) {
|
||||
if (nr <= (iCntCheats-1)) {
|
||||
return sCheatComment[nr];
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return "Error: CheatNr out of range";
|
||||
}
|
||||
}
|
||||
|
||||
int GCTCheats::createGCT(int nr,const char * filename)
|
||||
{
|
||||
int GCTCheats::createGCT(int nr,const char * filename) {
|
||||
ofstream filestr;
|
||||
filestr.open(filename);
|
||||
|
||||
@ -83,8 +65,7 @@ int GCTCheats::createGCT(int nr,const char * filename)
|
||||
long int li;
|
||||
int len = buf.size();
|
||||
|
||||
while (x < len)
|
||||
{
|
||||
while (x < len) {
|
||||
string temp = buf.substr(x,2);
|
||||
li = strtol(temp.c_str(),NULL,16);
|
||||
temp = li;
|
||||
@ -97,8 +78,7 @@ int GCTCheats::createGCT(int nr,const char * filename)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GCTCheats::createGCT(const char * chtbuffer,const char * filename)
|
||||
{
|
||||
int GCTCheats::createGCT(const char * chtbuffer,const char * filename) {
|
||||
ofstream filestr;
|
||||
filestr.open(filename);
|
||||
|
||||
@ -116,8 +96,7 @@ int GCTCheats::createGCT(const char * chtbuffer,const char * filename)
|
||||
long int li;
|
||||
int len = buf.size();
|
||||
|
||||
while (x < len)
|
||||
{
|
||||
while (x < len) {
|
||||
string temp = buf.substr(x,2);
|
||||
li = strtol(temp.c_str(),NULL,16);
|
||||
temp = li;
|
||||
@ -132,8 +111,7 @@ int GCTCheats::createGCT(const char * chtbuffer,const char * filename)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GCTCheats::createGCT(int nr[],int cnt,const char * filename)
|
||||
{
|
||||
int GCTCheats::createGCT(int nr[],int cnt,const char * filename) {
|
||||
|
||||
ofstream filestr;
|
||||
filestr.open(filename);
|
||||
@ -148,16 +126,14 @@ int GCTCheats::createGCT(int nr[],int cnt,const char * filename)
|
||||
filestr.write(header,sizeof(header));
|
||||
|
||||
int c = 0;
|
||||
while (c != cnt)
|
||||
{
|
||||
while (c != cnt) {
|
||||
int actnr = nr[c];
|
||||
string buf = getCheat(actnr);
|
||||
long int li;
|
||||
int len = buf.size();
|
||||
int x = 0;
|
||||
|
||||
while (x < len)
|
||||
{
|
||||
while (x < len) {
|
||||
string temp = buf.substr(x,2);
|
||||
li = strtol(temp.c_str(),NULL,16);
|
||||
temp = li;
|
||||
@ -172,8 +148,7 @@ filestr.close();
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GCTCheats::openTxtfile(const char * filename)
|
||||
{
|
||||
int GCTCheats::openTxtfile(const char * filename) {
|
||||
ifstream filestr;
|
||||
int i = 0;
|
||||
string str;
|
||||
@ -191,37 +166,31 @@ int GCTCheats::openTxtfile(const char * filename)
|
||||
getline(filestr,sGameTitle);
|
||||
filestr.ignore();
|
||||
|
||||
while(!filestr.eof())
|
||||
{
|
||||
while (!filestr.eof()) {
|
||||
getline(filestr,sCheatName[i]);
|
||||
string cheatdata;
|
||||
bool emptyline = false;
|
||||
bool isComment = false;
|
||||
|
||||
do
|
||||
{
|
||||
do {
|
||||
getline(filestr,str,'\n');
|
||||
//cheatdata.append(str);
|
||||
|
||||
if (str == "")
|
||||
{
|
||||
if (str == "") {
|
||||
emptyline = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (str.size() <= 16 || str.size() > 17 )
|
||||
{
|
||||
if (str.size() <= 16 || str.size() > 17 ) {
|
||||
isComment = true;
|
||||
printf ("%i",str.size());
|
||||
}
|
||||
|
||||
if (!isComment)
|
||||
{
|
||||
if (!isComment) {
|
||||
cheatdata.append(str);
|
||||
size_t found=cheatdata.find(' ');
|
||||
cheatdata.replace(found,1,"");
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
sCheatComment[i] = str;
|
||||
}
|
||||
|
||||
@ -287,16 +256,14 @@ filestr.close();
|
||||
return 1;
|
||||
}*/
|
||||
|
||||
struct GCTCheats::chtentries GCTCheats::getCheatList(void)
|
||||
{
|
||||
struct GCTCheats::chtentries GCTCheats::getCheatList(void) {
|
||||
|
||||
struct GCTCheats::chtentries cheatlist;
|
||||
int i = 0;
|
||||
cheatlist.sGameID = sGameID;
|
||||
cheatlist.sGameTitle = sGameTitle;
|
||||
|
||||
while (i < iCntCheats)
|
||||
{
|
||||
while (i < iCntCheats) {
|
||||
cheatlist.sCheatName[i] = sCheatName[i];
|
||||
cheatlist.sCheats[i] = sCheats[i];
|
||||
i++;
|
||||
@ -304,8 +271,7 @@ struct GCTCheats::chtentries GCTCheats::getCheatList(void)
|
||||
return cheatlist;
|
||||
}
|
||||
|
||||
struct GCTCheats::chtentries GCTCheats::getCheatList(const char * filename)
|
||||
{
|
||||
struct GCTCheats::chtentries GCTCheats::getCheatList(const char * filename) {
|
||||
openTxtfile(filename);
|
||||
struct GCTCheats::chtentries cheatlist;
|
||||
int i = 0;
|
||||
@ -313,8 +279,7 @@ struct GCTCheats::chtentries GCTCheats::getCheatList(const char * filename)
|
||||
cheatlist.sGameTitle = sGameTitle;
|
||||
cheatlist.iCntCheats = iCntCheats;
|
||||
|
||||
while (i < iCntCheats)
|
||||
{
|
||||
while (i < iCntCheats) {
|
||||
cheatlist.sCheatName[i] = sCheatName[i];
|
||||
cheatlist.sCheats[i] = sCheats[i];
|
||||
i++;
|
||||
@ -322,8 +287,7 @@ struct GCTCheats::chtentries GCTCheats::getCheatList(const char * filename)
|
||||
return cheatlist;
|
||||
}
|
||||
|
||||
int GCTCheats::download_txtcheat(int id)
|
||||
{
|
||||
int GCTCheats::download_txtcheat(int id) {
|
||||
//ToDo
|
||||
return 1;
|
||||
}
|
||||
|
@ -14,8 +14,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
struct chtentrie
|
||||
{
|
||||
struct chtentrie {
|
||||
string sGameID;
|
||||
string sGameTitle;
|
||||
string sCheatName[MAXCHEATS];
|
||||
@ -25,8 +24,7 @@ struct chtentrie
|
||||
};
|
||||
|
||||
//!Handles Ocarina TXT Cheatfiles
|
||||
class GCTCheats
|
||||
{
|
||||
class GCTCheats {
|
||||
private:
|
||||
chtentrie ccc;
|
||||
string sGameID;
|
||||
@ -38,8 +36,7 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
struct chtentries
|
||||
{
|
||||
struct chtentries {
|
||||
string sGameID;
|
||||
string sGameTitle;
|
||||
string sCheatName[MAXCHEATS];
|
||||
|
@ -12,8 +12,7 @@
|
||||
#define CACHE 8
|
||||
#define SECTORS 64
|
||||
|
||||
int USBDevice_Init()
|
||||
{
|
||||
int USBDevice_Init() {
|
||||
//closing all open Files write back the cache and then shutdown em!
|
||||
fatUnmount("USB:/");
|
||||
//right now mounts first FAT-partition
|
||||
@ -27,26 +26,22 @@ int USBDevice_Init()
|
||||
return -1;
|
||||
}
|
||||
|
||||
void USBDevice_deInit()
|
||||
{
|
||||
void USBDevice_deInit() {
|
||||
//closing all open Files write back the cache and then shutdown em!
|
||||
fatUnmount("USB:/");
|
||||
}
|
||||
|
||||
int isSdInserted()
|
||||
{
|
||||
int isSdInserted() {
|
||||
return __io_wiisd.isInserted();
|
||||
}
|
||||
|
||||
int isInserted(const char *path)
|
||||
{
|
||||
int isInserted(const char *path) {
|
||||
if (!strncmp(path, "USB:", 4))
|
||||
return 1;
|
||||
|
||||
return __io_wiisd.isInserted();
|
||||
}
|
||||
int SDCard_Init()
|
||||
{
|
||||
int SDCard_Init() {
|
||||
//closing all open Files write back the cache and then shutdown em!
|
||||
fatUnmount("SD:/");
|
||||
//right now mounts first FAT-partition
|
||||
@ -55,8 +50,7 @@ int SDCard_Init()
|
||||
return -1;
|
||||
}
|
||||
|
||||
void SDCard_deInit()
|
||||
{
|
||||
void SDCard_deInit() {
|
||||
//closing all open Files write back the cache and then shutdown em!
|
||||
fatUnmount("SD:/");
|
||||
}
|
||||
|
@ -2,8 +2,7 @@
|
||||
#define _FATMOUNTER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
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;
|
||||
u32 filesize = 0;
|
||||
entrypoint entry;
|
||||
@ -51,8 +50,7 @@ int BootHomebrew(char * path)
|
||||
|
||||
buffer = malloc(filesize);
|
||||
|
||||
if(fread (buffer, 1, filesize, file) != filesize)
|
||||
{
|
||||
if (fread (buffer, 1, filesize, file) != filesize) {
|
||||
fclose (file);
|
||||
free(buffer);
|
||||
SDCard_deInit();
|
||||
@ -103,8 +101,7 @@ int BootHomebrew(char * path)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int BootHomebrewFromMem()
|
||||
{
|
||||
int BootHomebrewFromMem() {
|
||||
entrypoint entry;
|
||||
u32 cpu_isr;
|
||||
|
||||
|
@ -2,8 +2,7 @@
|
||||
#define _BOOTHOMEBREW_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int BootHomebrew(char * path);
|
||||
|
@ -47,8 +47,7 @@ u8 boothomebrew = 0;
|
||||
/****************************************************************************
|
||||
* roundup Function
|
||||
***************************************************************************/
|
||||
int roundup(float number)
|
||||
{
|
||||
int roundup(float number) {
|
||||
if (number == (int) number)
|
||||
return (int) number;
|
||||
else
|
||||
@ -58,8 +57,7 @@ int roundup(float number)
|
||||
/****************************************************************************
|
||||
* MenuHomebrewBrowse
|
||||
***************************************************************************/
|
||||
int MenuHomebrewBrowse()
|
||||
{
|
||||
int MenuHomebrewBrowse() {
|
||||
int menu = MENU_NONE;
|
||||
int choice = 0;
|
||||
|
||||
@ -332,8 +330,7 @@ int MenuHomebrewBrowse()
|
||||
const int pages = roundup(filecount/4.0f);
|
||||
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 ();
|
||||
|
||||
menu = MENU_NONE;
|
||||
@ -352,8 +349,7 @@ int MenuHomebrewBrowse()
|
||||
MainButton3.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 35);
|
||||
MainButton4.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 35);
|
||||
while (MainButton1.GetEffect()>0) usleep(50);
|
||||
}
|
||||
else if(slidedirection == LEFT) {
|
||||
} else if (slidedirection == LEFT) {
|
||||
MainButton1.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);
|
||||
@ -600,14 +596,12 @@ int MenuHomebrewBrowse()
|
||||
MainButton2.SetEffect(EFFECT_FADE, 20);
|
||||
MainButton3.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);
|
||||
MainButton2.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);
|
||||
}
|
||||
else if(slidedirection == RIGHT) {
|
||||
} else if (slidedirection == RIGHT) {
|
||||
MainButton1.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);
|
||||
@ -620,8 +614,7 @@ int MenuHomebrewBrowse()
|
||||
|
||||
while (MainButton1.GetEffect() > 0) usleep(50);
|
||||
|
||||
while(!changed)
|
||||
{
|
||||
while (!changed) {
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
if (MainButton1.GetState() == STATE_CLICKED) {
|
||||
@ -651,8 +644,7 @@ int MenuHomebrewBrowse()
|
||||
break;
|
||||
}
|
||||
MainButton1.ResetState();
|
||||
}
|
||||
else if(MainButton2.GetState() == STATE_CLICKED) {
|
||||
} else if (MainButton2.GetState() == STATE_CLICKED) {
|
||||
char temp[200];
|
||||
char iconpath[200];
|
||||
char metapath[200];
|
||||
@ -679,8 +671,7 @@ int MenuHomebrewBrowse()
|
||||
break;
|
||||
}
|
||||
MainButton2.ResetState();
|
||||
}
|
||||
else if(MainButton3.GetState() == STATE_CLICKED) {
|
||||
} else if (MainButton3.GetState() == STATE_CLICKED) {
|
||||
char temp[200];
|
||||
char iconpath[200];
|
||||
char metapath[200];
|
||||
@ -707,8 +698,7 @@ int MenuHomebrewBrowse()
|
||||
break;
|
||||
}
|
||||
MainButton3.ResetState();
|
||||
}
|
||||
else if(MainButton4.GetState() == STATE_CLICKED) {
|
||||
} else if (MainButton4.GetState() == STATE_CLICKED) {
|
||||
char temp[200];
|
||||
char iconpath[200];
|
||||
char metapath[200];
|
||||
@ -778,8 +768,7 @@ int MenuHomebrewBrowse()
|
||||
s32 thetimeofbg = bgMusic->GetPlayTime();
|
||||
bgMusic->Stop();
|
||||
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();
|
||||
} else {
|
||||
bgMusic->PlayOggFile(Settings.ogg_path);
|
||||
@ -852,9 +841,7 @@ int MenuHomebrewBrowse()
|
||||
if (read != infilesize) {
|
||||
WindowPrompt(tr("Error:"), tr("No data could be read."), tr("OK"));
|
||||
FreeHomebrewBuffer();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
//determine what type of file we just got
|
||||
unsigned char filename[31];
|
||||
char tmptxt[31];
|
||||
@ -862,8 +849,7 @@ int MenuHomebrewBrowse()
|
||||
net_read(connection, &filename, 30);
|
||||
sprintf(tmptxt,"%s",filename);
|
||||
//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
|
||||
//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);
|
||||
GuiImage dialogBoxImg(&dialogBox);
|
||||
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 });
|
||||
msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
msgTxt.SetPosition(0,100);
|
||||
@ -917,8 +904,7 @@ int MenuHomebrewBrowse()
|
||||
lSize = ftell (file);
|
||||
|
||||
rewind (file);
|
||||
if(lSize==infilesize)
|
||||
{
|
||||
if (lSize==infilesize) {
|
||||
int pick = WindowPrompt(tr(" Wad Saved as:"), tmptxt, tr("Install"),tr("Uninstall"),tr("Cancel"));
|
||||
//install or uninstall it
|
||||
if (pick==1)Wad_Install(file);
|
||||
@ -932,8 +918,7 @@ int MenuHomebrewBrowse()
|
||||
remove(tmptxt);
|
||||
|
||||
|
||||
}
|
||||
else if(strstr(tmptxt,".dol") || strstr(tmptxt,".DOL") ||
|
||||
} else if (strstr(tmptxt,".dol") || strstr(tmptxt,".DOL") ||
|
||||
strstr(tmptxt,".elf") || strstr(tmptxt,".ELF")) {
|
||||
boothomebrew = 2;
|
||||
menu = MENU_EXIT;
|
||||
@ -960,8 +945,7 @@ int MenuHomebrewBrowse()
|
||||
}
|
||||
|
||||
if (IsNetworkInit()) {
|
||||
if(!wifi_btn_loaded)
|
||||
{
|
||||
if (!wifi_btn_loaded) {
|
||||
wifiBtn.SetAlpha(255);
|
||||
|
||||
titleTT = new GuiTooltip(GetNetworkIP());
|
||||
|
@ -9,8 +9,7 @@
|
||||
|
||||
#include "HomebrewFiles.h"
|
||||
|
||||
HomebrewFiles::HomebrewFiles(const char * path)
|
||||
{
|
||||
HomebrewFiles::HomebrewFiles(const char * path) {
|
||||
filecount = 0;
|
||||
|
||||
FileInfo = (FileInfos *) malloc(sizeof(FileInfos));
|
||||
@ -24,16 +23,14 @@ HomebrewFiles::HomebrewFiles(const char * path)
|
||||
this->SortList();
|
||||
}
|
||||
|
||||
HomebrewFiles::~HomebrewFiles()
|
||||
{
|
||||
HomebrewFiles::~HomebrewFiles() {
|
||||
if (FileInfo) {
|
||||
free(FileInfo);
|
||||
FileInfo = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
bool HomebrewFiles::LoadPath(const char * folderpath)
|
||||
{
|
||||
bool HomebrewFiles::LoadPath(const char * folderpath) {
|
||||
struct stat st;
|
||||
DIR_ITER *dir = NULL;
|
||||
char filename[1024];
|
||||
@ -43,8 +40,7 @@ bool HomebrewFiles::LoadPath(const char * folderpath)
|
||||
return false;
|
||||
}
|
||||
|
||||
while (dirnext(dir,filename,&st) == 0)
|
||||
{
|
||||
while (dirnext(dir,filename,&st) == 0) {
|
||||
if ((st.st_mode & S_IFDIR) != 0) {
|
||||
if (strcmp(filename,".") != 0 && strcmp(filename,"..") != 0) {
|
||||
char currentname[200];
|
||||
@ -84,43 +80,37 @@ bool HomebrewFiles::LoadPath(const char * folderpath)
|
||||
return true;
|
||||
}
|
||||
|
||||
char * HomebrewFiles::GetFilename(int ind)
|
||||
{
|
||||
char * HomebrewFiles::GetFilename(int ind) {
|
||||
if (ind > filecount)
|
||||
return NULL;
|
||||
else
|
||||
return FileInfo[ind].FileName;
|
||||
}
|
||||
|
||||
char * HomebrewFiles::GetFilepath(int ind)
|
||||
{
|
||||
char * HomebrewFiles::GetFilepath(int ind) {
|
||||
if (ind > filecount)
|
||||
return NULL;
|
||||
else
|
||||
return FileInfo[ind].FilePath;
|
||||
}
|
||||
|
||||
unsigned int HomebrewFiles::GetFilesize(int ind)
|
||||
{
|
||||
unsigned int HomebrewFiles::GetFilesize(int ind) {
|
||||
if (ind > filecount || !filecount || !FileInfo)
|
||||
return NULL;
|
||||
else
|
||||
return FileInfo[ind].FileSize;
|
||||
}
|
||||
|
||||
int HomebrewFiles::GetFilecount()
|
||||
{
|
||||
int HomebrewFiles::GetFilecount() {
|
||||
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 *bb = (FileInfos*) b;
|
||||
|
||||
return stricmp((char *) ab->FilePath, (char *) bb->FilePath);
|
||||
}
|
||||
void HomebrewFiles::SortList()
|
||||
{
|
||||
void HomebrewFiles::SortList() {
|
||||
qsort(FileInfo, filecount, sizeof(FileInfos), ListCompare);
|
||||
}
|
||||
|
@ -13,8 +13,7 @@ typedef struct {
|
||||
unsigned int FileSize;
|
||||
} FileInfos;
|
||||
|
||||
class HomebrewFiles
|
||||
{
|
||||
class HomebrewFiles {
|
||||
public:
|
||||
//!Constructor
|
||||
//!\param path Path where to check for homebrew files
|
||||
|
@ -9,8 +9,7 @@
|
||||
|
||||
#include "HomebrewXML.h"
|
||||
|
||||
HomebrewXML::HomebrewXML()
|
||||
{
|
||||
HomebrewXML::HomebrewXML() {
|
||||
strcpy(name,"");
|
||||
strcpy(coder,"");
|
||||
strcpy(version,"");
|
||||
@ -19,12 +18,10 @@ HomebrewXML::HomebrewXML()
|
||||
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 *nodetreeHB = NULL;
|
||||
char tmp1[40];
|
||||
|
@ -5,8 +5,7 @@
|
||||
#ifndef ___HOMEBREWXML_H_
|
||||
#define ___HOMEBREWXML_H_
|
||||
|
||||
class HomebrewXML
|
||||
{
|
||||
class HomebrewXML {
|
||||
public:
|
||||
//!Constructor
|
||||
//!\param path Path for the xml file
|
||||
@ -16,19 +15,33 @@ class HomebrewXML
|
||||
//!\param filename Filepath of the XML file
|
||||
int LoadHomebrewXMLData(const char* filename);
|
||||
//! Get name
|
||||
char * GetName() { return name; }
|
||||
char * GetName() {
|
||||
return name;
|
||||
}
|
||||
//! Get coder
|
||||
char * GetCoder() { return coder; }
|
||||
char * GetCoder() {
|
||||
return coder;
|
||||
}
|
||||
//! Get version
|
||||
char * GetVersion() { return version; }
|
||||
char * GetVersion() {
|
||||
return version;
|
||||
}
|
||||
//! Get releasedate
|
||||
char * GetReleasedate() { return releasedate; }
|
||||
char * GetReleasedate() {
|
||||
return releasedate;
|
||||
}
|
||||
//! Get shortdescription
|
||||
char * GetShortDescription() { return shortdescription; }
|
||||
char * GetShortDescription() {
|
||||
return shortdescription;
|
||||
}
|
||||
//! Get longdescription
|
||||
char * GetLongDescription() { return longdescription; }
|
||||
char * GetLongDescription() {
|
||||
return longdescription;
|
||||
}
|
||||
//! Set Name
|
||||
void SetName(char * path) { strncpy(name, path, sizeof(name)); }
|
||||
void SetName(char * path) {
|
||||
strncpy(name, path, sizeof(name));
|
||||
}
|
||||
protected:
|
||||
char name[50];
|
||||
char coder[100];
|
||||
|
@ -2,8 +2,7 @@
|
||||
#define _DOLLOADER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void __exception_closeall();
|
||||
|
@ -385,15 +385,13 @@ typedef struct elf32_sym {
|
||||
|
||||
|
||||
/* Relocation entry with implicit addend */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
Elf32_Addr r_offset; /* offset of relocation */
|
||||
Elf32_Word r_info; /* symbol table index and type */
|
||||
} Elf32_Rel;
|
||||
|
||||
/* Relocation entry with explicit addend */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
Elf32_Addr r_offset; /* offset of relocation */
|
||||
Elf32_Word r_info; /* symbol table index and type */
|
||||
Elf32_Sword r_addend;
|
||||
@ -439,11 +437,9 @@ typedef struct {
|
||||
#define PF_MASKPROC 0xf0000000 /* reserved bits for processor */
|
||||
/* specific segment flags */
|
||||
/* Dynamic structure */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
Elf32_Sword d_tag; /* controls meaning of d_val */
|
||||
union
|
||||
{
|
||||
union {
|
||||
Elf32_Word d_val; /* Multiple meanings - see d_tag */
|
||||
Elf32_Addr d_ptr; /* program virtual address */
|
||||
} d_un;
|
||||
|
@ -26,8 +26,7 @@
|
||||
* First looks at the ELF header magic field, the makes sure that it is
|
||||
* 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 */
|
||||
|
||||
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
|
||||
* entry point address.
|
||||
* ====================================================================== */
|
||||
u32 load_elf_image (void *addr)
|
||||
{
|
||||
u32 load_elf_image (void *addr) {
|
||||
Elf32_Ehdr *ehdr;
|
||||
Elf32_Shdr *shdr;
|
||||
u8 *strtab = 0;
|
||||
|
@ -4,8 +4,7 @@
|
||||
#include <wiiuse/wpad.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
s32 valid_elf_image (void *addr);
|
||||
|
@ -28,10 +28,8 @@ static int rumbleCount[4] = {0,0,0,0};
|
||||
* ShutoffRumble
|
||||
***************************************************************************/
|
||||
|
||||
void ShutoffRumble()
|
||||
{
|
||||
for(int i=0;i<4;i++)
|
||||
{
|
||||
void ShutoffRumble() {
|
||||
for (int i=0;i<4;i++) {
|
||||
WPAD_Rumble(i, 0);
|
||||
rumbleCount[i] = 0;
|
||||
}
|
||||
@ -41,20 +39,14 @@ void ShutoffRumble()
|
||||
* DoRumble
|
||||
***************************************************************************/
|
||||
|
||||
void DoRumble(int i)
|
||||
{
|
||||
if(rumbleRequest[i] && rumbleCount[i] < 3)
|
||||
{
|
||||
void DoRumble(int i) {
|
||||
if (rumbleRequest[i] && rumbleCount[i] < 3) {
|
||||
WPAD_Rumble(i, 1); // rumble on
|
||||
rumbleCount[i]++;
|
||||
}
|
||||
else if(rumbleRequest[i])
|
||||
{
|
||||
} else if (rumbleRequest[i]) {
|
||||
rumbleCount[i] = 20;
|
||||
rumbleRequest[i] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if (rumbleCount[i])
|
||||
rumbleCount[i]--;
|
||||
WPAD_Rumble(i, 0); // rumble off
|
||||
@ -67,31 +59,25 @@ void DoRumble(int i)
|
||||
* 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 ang = 0.0;
|
||||
WPADData *data = WPAD_Data(chan);
|
||||
|
||||
switch (data->exp.type)
|
||||
{
|
||||
switch (data->exp.type) {
|
||||
case WPAD_EXP_NUNCHUK:
|
||||
case WPAD_EXP_GUITARHERO3:
|
||||
if (right == 0)
|
||||
{
|
||||
if (right == 0) {
|
||||
mag = data->exp.nunchuk.js.mag;
|
||||
ang = data->exp.nunchuk.js.ang;
|
||||
}
|
||||
break;
|
||||
|
||||
case WPAD_EXP_CLASSIC:
|
||||
if (right == 0)
|
||||
{
|
||||
if (right == 0) {
|
||||
mag = data->exp.classic.ljs.mag;
|
||||
ang = data->exp.classic.ljs.ang;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
mag = data->exp.classic.rjs.mag;
|
||||
ang = data->exp.classic.rjs.ang;
|
||||
}
|
||||
|
@ -13,8 +13,7 @@
|
||||
#include "network/networkops.h"
|
||||
#include "network/http.h"
|
||||
|
||||
int updateLanguageFiles()
|
||||
{
|
||||
int updateLanguageFiles() {
|
||||
char languageFiles[20][MAXLANGUAGEFILES];
|
||||
|
||||
//get all the files in the language path
|
||||
@ -27,8 +26,7 @@ int updateLanguageFiles()
|
||||
for (int cnt = 0; cnt < countfiles; cnt++) {
|
||||
char filename[64];
|
||||
strncpy(filename, GetFileName(cnt),63);
|
||||
if (strcasestr(filename,".lang"))
|
||||
{
|
||||
if (strcasestr(filename,".lang")) {
|
||||
strcpy(languageFiles[cnt],filename);
|
||||
}
|
||||
}
|
||||
@ -38,8 +36,7 @@ int updateLanguageFiles()
|
||||
int done =0,j=0;
|
||||
if (IsNetworkInit()) {
|
||||
//build the URL, save path, and download each file and save it
|
||||
while (j<countfiles)
|
||||
{
|
||||
while (j<countfiles) {
|
||||
char savepath[150];
|
||||
char codeurl[200];
|
||||
snprintf(codeurl, sizeof(codeurl), "http://usbloader-gui.googlecode.com/svn/trunk/Languages/%s",languageFiles[j]);
|
||||
|
@ -4,8 +4,7 @@
|
||||
#include <gctypes.h>
|
||||
#include "gettext.h"
|
||||
|
||||
typedef struct _MSG
|
||||
{
|
||||
typedef struct _MSG {
|
||||
u32 id;
|
||||
char* msgstr;
|
||||
struct _MSG *next;
|
||||
@ -19,20 +18,17 @@ static MSG *baseMSG=0;
|
||||
[see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
|
||||
1986, 1987 Bell Telephone Laboratories, Inc.] */
|
||||
static inline u32
|
||||
hash_string (const char *str_param)
|
||||
{
|
||||
hash_string (const char *str_param) {
|
||||
u32 hval, g;
|
||||
const char *str = str_param;
|
||||
|
||||
/* Compute the hash value for the given string. */
|
||||
hval = 0;
|
||||
while (*str != '\0')
|
||||
{
|
||||
while (*str != '\0') {
|
||||
hval <<= 4;
|
||||
hval += (u8) *str++;
|
||||
g = hval & ((u32) 0xf << (HASHWORDBITS - 4));
|
||||
if (g != 0)
|
||||
{
|
||||
if (g != 0) {
|
||||
hval ^= g >> (HASHWORDBITS - 8);
|
||||
hval ^= g;
|
||||
}
|
||||
@ -42,8 +38,7 @@ hash_string (const char *str_param)
|
||||
|
||||
/* Expand some escape sequences found in the argument string. */
|
||||
static char *
|
||||
expand_escape (const char *str)
|
||||
{
|
||||
expand_escape (const char *str) {
|
||||
char *retval, *rp;
|
||||
const char *cp = str;
|
||||
|
||||
@ -55,12 +50,10 @@ expand_escape (const char *str)
|
||||
*rp++ = *cp++;
|
||||
if (cp[0] == '\0')
|
||||
goto terminate;
|
||||
do
|
||||
{
|
||||
do {
|
||||
|
||||
/* Here cp[0] == '\\'. */
|
||||
switch (*++cp)
|
||||
{
|
||||
switch (*++cp) {
|
||||
case '\"': /* " */
|
||||
*rp++ = '\"';
|
||||
++cp;
|
||||
@ -97,18 +90,21 @@ expand_escape (const char *str)
|
||||
*rp = '\\';
|
||||
++cp;
|
||||
break;
|
||||
case '0': case '1': case '2': case '3':
|
||||
case '4': case '5': case '6': case '7':
|
||||
{
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7': {
|
||||
int ch = *cp++ - '0';
|
||||
|
||||
if (*cp >= '0' && *cp <= '7')
|
||||
{
|
||||
if (*cp >= '0' && *cp <= '7') {
|
||||
ch *= 8;
|
||||
ch += *cp++ - '0';
|
||||
|
||||
if (*cp >= '0' && *cp <= '7')
|
||||
{
|
||||
if (*cp >= '0' && *cp <= '7') {
|
||||
ch *= 8;
|
||||
ch += *cp++ - '0';
|
||||
}
|
||||
@ -123,8 +119,7 @@ expand_escape (const char *str)
|
||||
|
||||
while (cp[0] != '\0' && cp[0] != '\\')
|
||||
*rp++ = *cp++;
|
||||
}
|
||||
while (cp[0] != '\0');
|
||||
} while (cp[0] != '\0');
|
||||
|
||||
/* Terminate string. */
|
||||
terminate:
|
||||
@ -132,33 +127,27 @@ terminate:
|
||||
return retval;
|
||||
}
|
||||
|
||||
static MSG *findMSG(u32 id)
|
||||
{
|
||||
static MSG *findMSG(u32 id) {
|
||||
MSG *msg;
|
||||
for(msg=baseMSG; msg; msg=msg->next)
|
||||
{
|
||||
for (msg=baseMSG; msg; msg=msg->next) {
|
||||
if (msg->id == id)
|
||||
return msg;
|
||||
}
|
||||
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);
|
||||
MSG *msg = findMSG(id);
|
||||
if(!msg)
|
||||
{
|
||||
if (!msg) {
|
||||
msg = (MSG *)malloc(sizeof(MSG));
|
||||
msg->id = id;
|
||||
msg->msgstr = NULL;
|
||||
msg->next = baseMSG;
|
||||
baseMSG = msg;
|
||||
}
|
||||
if(msg)
|
||||
{
|
||||
if(msgstr)
|
||||
{
|
||||
if (msg) {
|
||||
if (msgstr) {
|
||||
if (msg->msgstr) free(msg->msgstr);
|
||||
//msg->msgstr = strdup(msgstr);
|
||||
msg->msgstr = expand_escape(msgstr);
|
||||
@ -167,10 +156,8 @@ static MSG *setMSG(const char *msgid, const char *msgstr)
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
void gettextCleanUp(void)
|
||||
{
|
||||
while(baseMSG)
|
||||
{
|
||||
void gettextCleanUp(void) {
|
||||
while (baseMSG) {
|
||||
MSG *nextMsg =baseMSG->next;
|
||||
free(baseMSG->msgstr);
|
||||
free(baseMSG);
|
||||
@ -179,8 +166,7 @@ void gettextCleanUp(void)
|
||||
}
|
||||
|
||||
|
||||
bool gettextLoadLanguage(const char* langFile)
|
||||
{
|
||||
bool gettextLoadLanguage(const char* langFile) {
|
||||
FILE *f;
|
||||
char line[200];
|
||||
char *lastID=NULL;
|
||||
@ -190,25 +176,23 @@ bool gettextLoadLanguage(const char* langFile)
|
||||
if (!f)
|
||||
return false;
|
||||
|
||||
while (fgets(line, sizeof(line), f))
|
||||
{
|
||||
while (fgets(line, sizeof(line), f)) {
|
||||
// lines starting with # are comments
|
||||
if (line[0] == '#')
|
||||
continue;
|
||||
else if (strncmp(line, "msgid \"", 7) == 0)
|
||||
{
|
||||
else if (strncmp(line, "msgid \"", 7) == 0) {
|
||||
char *msgid, *end;
|
||||
if(lastID) { free(lastID); lastID=NULL;}
|
||||
if (lastID) {
|
||||
free(lastID);
|
||||
lastID=NULL;
|
||||
}
|
||||
msgid = &line[7];
|
||||
end = strrchr(msgid, '"');
|
||||
if(end && end-msgid>1)
|
||||
{
|
||||
if (end && end-msgid>1) {
|
||||
*end = 0;
|
||||
lastID = strdup(msgid);
|
||||
}
|
||||
}
|
||||
else if (strncmp(line, "msgstr \"", 8) == 0)
|
||||
{
|
||||
} else if (strncmp(line, "msgstr \"", 8) == 0) {
|
||||
char *msgstr, *end;
|
||||
|
||||
if (lastID == NULL)
|
||||
@ -216,8 +200,7 @@ bool gettextLoadLanguage(const char* langFile)
|
||||
|
||||
msgstr = &line[8];
|
||||
end = strrchr(msgstr, '"');
|
||||
if(end && end-msgstr>1)
|
||||
{
|
||||
if (end && end-msgstr>1) {
|
||||
*end = 0;
|
||||
setMSG(lastID, msgstr);
|
||||
}
|
||||
@ -230,8 +213,7 @@ bool gettextLoadLanguage(const char* langFile)
|
||||
fclose(f);
|
||||
return true;
|
||||
}
|
||||
const char *gettext(const char *msgid)
|
||||
{
|
||||
const char *gettext(const char *msgid) {
|
||||
MSG *msg = findMSG(hash_string(msgid));
|
||||
if (msg && msg->msgstr) return msg->msgstr;
|
||||
return msgid;
|
||||
|
@ -2,8 +2,7 @@
|
||||
#define _GETTEXT_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -13,19 +13,16 @@
|
||||
static char alldirfiles[300][70];
|
||||
char filenames[80];
|
||||
|
||||
bool findfile(const char * filename, const char * path)
|
||||
{
|
||||
bool findfile(const char * filename, const char * path) {
|
||||
DIR *dir;
|
||||
struct dirent *file;
|
||||
|
||||
dir = opendir(path);
|
||||
|
||||
char temp[11];
|
||||
while ((file = readdir(dir)))
|
||||
{
|
||||
while ((file = readdir(dir))) {
|
||||
snprintf(temp,sizeof(temp),"%s",file->d_name);
|
||||
if (!strncmpi(temp,filename,11))
|
||||
{
|
||||
if (!strncmpi(temp,filename,11)) {
|
||||
closedir(dir);
|
||||
return true;
|
||||
}
|
||||
@ -58,19 +55,16 @@ bool subfoldercreate(char * fullpath) {
|
||||
return true;
|
||||
}
|
||||
|
||||
char * GetFileName(int i)
|
||||
{
|
||||
char * GetFileName(int i) {
|
||||
return alldirfiles[i];
|
||||
}
|
||||
|
||||
s32 filenamescmp(const void *a, const void *b)
|
||||
{
|
||||
s32 filenamescmp(const void *a, const void *b) {
|
||||
/* Compare strings */
|
||||
return stricmp((char *)a, (char *)b);
|
||||
}
|
||||
|
||||
int GetAllDirFiles(char * filespath)
|
||||
{
|
||||
int GetAllDirFiles(char * filespath) {
|
||||
int countfiles = 0;
|
||||
|
||||
struct stat st;
|
||||
@ -79,10 +73,8 @@ int GetAllDirFiles(char * filespath)
|
||||
|
||||
if (dir == NULL) //If empty
|
||||
return 0;
|
||||
while (dirnext(dir,filenames,&st) == 0)
|
||||
{
|
||||
if ((st.st_mode & S_IFDIR) == 0)
|
||||
{
|
||||
while (dirnext(dir,filenames,&st) == 0) {
|
||||
if ((st.st_mode & S_IFDIR) == 0) {
|
||||
// st.st_mode & S_IFDIR indicates a directory
|
||||
snprintf(alldirfiles[countfiles], 70, "%s", filenames);
|
||||
countfiles++;
|
||||
@ -93,8 +85,7 @@ int GetAllDirFiles(char * filespath)
|
||||
return countfiles;
|
||||
}
|
||||
|
||||
bool checkfile(char * path)
|
||||
{
|
||||
bool checkfile(char * path) {
|
||||
FILE * f;
|
||||
f = fopen(path,"r");
|
||||
if (f) {
|
||||
|
@ -2,8 +2,7 @@
|
||||
#define _LISTFILES_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
bool findfile(const char * filename, const char * path);
|
||||
|
@ -43,19 +43,15 @@ FreeTypeGX *fontSystem=0;
|
||||
FreeTypeGX *fontClock=0;
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
main(int argc, char *argv[]) {
|
||||
s32 ret2;
|
||||
|
||||
bool bootDevice_found=false;
|
||||
if(argc >= 1)
|
||||
{
|
||||
if(!strncasecmp(argv[0], "usb:/", 5))
|
||||
{
|
||||
if (argc >= 1) {
|
||||
if (!strncasecmp(argv[0], "usb:/", 5)) {
|
||||
strcpy(bootDevice, "USB:");
|
||||
bootDevice_found = true;
|
||||
}
|
||||
else if(!strncasecmp(argv[0], "sd:/", 4))
|
||||
} else if (!strncasecmp(argv[0], "sd:/", 4))
|
||||
bootDevice_found = true;
|
||||
}
|
||||
|
||||
@ -68,8 +64,7 @@ main(int argc, char *argv[])
|
||||
SDCard_Init(); // mount SD for loading cfg's
|
||||
USBDevice_Init(); // and mount USB:/
|
||||
|
||||
if(!bootDevice_found)
|
||||
{
|
||||
if (!bootDevice_found) {
|
||||
//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
|
||||
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);
|
||||
|
||||
enum
|
||||
{
|
||||
enum {
|
||||
MENU_EXIT = -1,
|
||||
MENU_NONE,
|
||||
MENU_SETTINGS,
|
||||
|
@ -28,14 +28,12 @@ static s32 mload_fd = -1;
|
||||
|
||||
// to init/test if the device is running
|
||||
|
||||
int mload_init()
|
||||
{
|
||||
int mload_init() {
|
||||
int n;
|
||||
|
||||
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);
|
||||
|
||||
if (mload_fd>=0) break;
|
||||
@ -50,8 +48,7 @@ return mload_fd;
|
||||
|
||||
// to close the device (remember call it when rebooting the IOS!)
|
||||
|
||||
int mload_close()
|
||||
{
|
||||
int mload_close() {
|
||||
int ret;
|
||||
|
||||
if (mload_fd<0) return -1;
|
||||
@ -67,8 +64,7 @@ return ret;
|
||||
|
||||
// to get the thread id of mload
|
||||
|
||||
int mload_get_thread_id()
|
||||
{
|
||||
int mload_get_thread_id() {
|
||||
int ret;
|
||||
s32 hid = -1;
|
||||
|
||||
@ -92,8 +88,7 @@ return ret;
|
||||
|
||||
// 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;
|
||||
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)
|
||||
// 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;
|
||||
void *buf=NULL;
|
||||
s32 hid = -1;
|
||||
@ -132,7 +126,10 @@ s32 hid = -1;
|
||||
|
||||
buf= iosAlloc(hid, len);
|
||||
|
||||
if(!buf) {ret= -1;goto out;}
|
||||
if (!buf) {
|
||||
ret= -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
memcpy(buf, addr,len);
|
||||
@ -143,7 +140,10 @@ s32 hid = -1;
|
||||
|
||||
ret=IOS_IoctlvFormat(hid, mload_fd, MLOAD_RUN_MODULE, ":");
|
||||
|
||||
if(ret<0) {ret= -666;goto out;}
|
||||
if (ret<0) {
|
||||
ret= -666;
|
||||
goto out;
|
||||
}
|
||||
|
||||
out:
|
||||
|
||||
@ -158,8 +158,7 @@ return ret;
|
||||
// load a module from the PPC
|
||||
// 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 p;
|
||||
u8 *adr;
|
||||
@ -178,21 +177,17 @@ p=head->phoff;
|
||||
|
||||
data_elf->start=(void *) head->entry;
|
||||
|
||||
for(n=0; n<head->phnum; n++)
|
||||
{
|
||||
for (n=0; n<head->phnum; n++) {
|
||||
entries=(void *) (elf+p);
|
||||
p+=sizeof(elfphentry);
|
||||
|
||||
if(entries->type == 4)
|
||||
{
|
||||
if (entries->type == 4) {
|
||||
adr=(void *) (elf + entries->offset);
|
||||
|
||||
if (getbe32(0)!=0) return -2; // bad info (sure)
|
||||
|
||||
for(m=4; m < entries->memsz; m+=8)
|
||||
{
|
||||
switch(getbe32(m))
|
||||
{
|
||||
for (m=4; m < entries->memsz; m+=8) {
|
||||
switch (getbe32(m)) {
|
||||
case 0x9:
|
||||
data_elf->start= (void *) getbe32(m+4);
|
||||
break;
|
||||
@ -210,10 +205,8 @@ for(n=0; n<head->phnum; n++)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
if(entries->type == 1 && entries->memsz != 0 && entries->vaddr!=0)
|
||||
{
|
||||
} else
|
||||
if (entries->type == 1 && entries->memsz != 0 && entries->vaddr!=0) {
|
||||
|
||||
if (mload_memset((void *) entries->vaddr, 0, entries->memsz)<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)
|
||||
|
||||
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;
|
||||
s32 hid = -1;
|
||||
|
||||
@ -253,8 +245,7 @@ return ret;
|
||||
|
||||
// stops one starlet thread
|
||||
|
||||
int mload_stop_thread(int id)
|
||||
{
|
||||
int mload_stop_thread(int id) {
|
||||
int ret;
|
||||
s32 hid = -1;
|
||||
|
||||
@ -278,8 +269,7 @@ return ret;
|
||||
|
||||
// continue one stopped starlet thread
|
||||
|
||||
int mload_continue_thread(int id)
|
||||
{
|
||||
int mload_continue_thread(int id) {
|
||||
int ret;
|
||||
s32 hid = -1;
|
||||
|
||||
@ -302,8 +292,7 @@ return ret;
|
||||
|
||||
// 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;
|
||||
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)
|
||||
|
||||
int mload_read(void* buf, u32 size)
|
||||
{
|
||||
int mload_read(void* buf, u32 size) {
|
||||
if (mload_init()<0) return -1;
|
||||
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)
|
||||
|
||||
int mload_write(const void * buf, u32 size)
|
||||
{
|
||||
int mload_write(const void * buf, u32 size) {
|
||||
if (mload_init()<0) return -1;
|
||||
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)
|
||||
|
||||
int mload_memset(void *starlet_addr, int set, int len)
|
||||
{
|
||||
int mload_memset(void *starlet_addr, int set, int len) {
|
||||
int ret;
|
||||
s32 hid = -1;
|
||||
|
||||
@ -356,8 +342,7 @@ return ret;
|
||||
|
||||
// get the ehci datas ( ehcmodule.elf uses this address)
|
||||
|
||||
void * mload_get_ehci_data()
|
||||
{
|
||||
void * mload_get_ehci_data() {
|
||||
int ret;
|
||||
s32 hid = -1;
|
||||
|
||||
@ -380,8 +365,7 @@ return (void *) ret;
|
||||
|
||||
// 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;
|
||||
s32 hid = -1;
|
||||
|
||||
@ -400,8 +384,7 @@ s32 hid = -1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static u32 ios_36[16] ATTRIBUTE_ALIGN(32)=
|
||||
{
|
||||
static u32 ios_36[16] ATTRIBUTE_ALIGN(32)= {
|
||||
0, // DI_EmulateCmd
|
||||
0,
|
||||
0x2022DDAC, // dvd_read_controlling_data
|
||||
@ -414,8 +397,7 @@ static u32 ios_36[16] ATTRIBUTE_ALIGN(32)=
|
||||
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,
|
||||
0x2022cdac, // dvd_read_controlling_data
|
||||
@ -441,17 +423,13 @@ int load_ehc_module() {
|
||||
|
||||
mload_seek(0x20207c84, SEEK_SET);
|
||||
mload_read(patch_datas, 4);
|
||||
if(patch_datas[0]==0x6e657665)
|
||||
{
|
||||
if (patch_datas[0]==0x6e657665) {
|
||||
is_ios=38;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
is_ios=36;
|
||||
}
|
||||
|
||||
if(is_ios==36)
|
||||
{
|
||||
if (is_ios==36) {
|
||||
// IOS 36
|
||||
memcpy(ios_36, dip_plugin, 4); // copy the entry_point
|
||||
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);
|
||||
|
||||
}
|
||||
if(is_ios==38)
|
||||
{
|
||||
if (is_ios==38) {
|
||||
// IOS 38
|
||||
|
||||
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]))
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
u32 ident0;
|
||||
u32 ident1;
|
||||
u32 ident2;
|
||||
@ -70,8 +69,7 @@ typedef struct
|
||||
u16 shtrndx;
|
||||
} elfheader;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
u32 type;
|
||||
u32 offset;
|
||||
u32 vaddr;
|
||||
@ -82,8 +80,7 @@ typedef struct
|
||||
u32 align;
|
||||
} elfphentry;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
void *start;
|
||||
int prio;
|
||||
void *stack;
|
||||
|
@ -11,8 +11,7 @@
|
||||
#include "URL_List.h"
|
||||
|
||||
|
||||
URL_List::URL_List(const char * url)
|
||||
{
|
||||
URL_List::URL_List(const char * url) {
|
||||
Links = NULL;
|
||||
urlcount = 0;
|
||||
|
||||
@ -99,8 +98,7 @@ URL_List::URL_List(const char * url)
|
||||
free(file.data);
|
||||
}
|
||||
|
||||
URL_List::~URL_List()
|
||||
{
|
||||
URL_List::~URL_List() {
|
||||
for (int i = 0; i == urlcount; i++) {
|
||||
delete Links[i].URL;
|
||||
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)
|
||||
return NULL;
|
||||
else
|
||||
return Links[ind].URL;
|
||||
}
|
||||
|
||||
int URL_List::GetURLCount()
|
||||
{
|
||||
int URL_List::GetURLCount() {
|
||||
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 *bb = (Link_Info*) b;
|
||||
|
||||
return stricmp((char *) ab->URL, (char *) bb->URL);
|
||||
}
|
||||
void URL_List::SortList()
|
||||
{
|
||||
void URL_List::SortList() {
|
||||
qsort(Links, urlcount, sizeof(Link_Info), ListCompare);
|
||||
}
|
||||
|
@ -14,8 +14,7 @@ typedef struct {
|
||||
bool direct;
|
||||
} Link_Info;
|
||||
|
||||
class URL_List
|
||||
{
|
||||
class URL_List {
|
||||
public:
|
||||
//!Constructor
|
||||
//!\param url from where to get the list of links
|
||||
|
@ -8,8 +8,7 @@
|
||||
* @param char* The domain name to resolve
|
||||
* @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,
|
||||
//it returns a static buffer which makes it not threadsafe
|
||||
//TODO: implement some locking mechanism to make below code atomic
|
||||
@ -44,16 +43,13 @@ static int dnsentrycount = 0;
|
||||
* Performs the same function as getipbyname(),
|
||||
* 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
|
||||
struct dnsentry *node = firstdnsentry;
|
||||
struct dnsentry *previousnode = NULL;
|
||||
|
||||
while(node != NULL)
|
||||
{
|
||||
if(strcmp(node->domain, domain) == 0)
|
||||
{
|
||||
while (node != NULL) {
|
||||
if (strcmp(node->domain, domain) == 0) {
|
||||
//DNS node found in the cache, move it to the front of the list
|
||||
if (previousnode != NULL)
|
||||
previousnode->nextnode = node->nextnode;
|
||||
@ -78,8 +74,7 @@ u32 getipbynamecached(char *domain)
|
||||
|
||||
newnode->ip = ip;
|
||||
newnode->domain = malloc(strlen(domain)+1);
|
||||
if(newnode->domain == NULL)
|
||||
{
|
||||
if (newnode->domain == NULL) {
|
||||
free(newnode);
|
||||
return ip;
|
||||
}
|
||||
@ -90,24 +85,20 @@ u32 getipbynamecached(char *domain)
|
||||
dnsentrycount++;
|
||||
|
||||
//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 *previousnode = NULL;
|
||||
|
||||
//Fetch the last two elements of the list
|
||||
while(node->nextnode != NULL)
|
||||
{
|
||||
while (node->nextnode != NULL) {
|
||||
previousnode = node;
|
||||
node = node->nextnode;
|
||||
}
|
||||
|
||||
if(node == NULL)
|
||||
{
|
||||
if (node == NULL) {
|
||||
printf("Configuration error, MAX_DNS_ENTRIES reached while the list is empty\n");
|
||||
exit(1);
|
||||
} else if(previousnode == NULL)
|
||||
{
|
||||
} else if (previousnode == NULL) {
|
||||
firstdnsentry = NULL;
|
||||
} else {
|
||||
previousnode->nextnode = NULL;
|
||||
|
@ -9,8 +9,7 @@
|
||||
#include <unistd.h> //usleep
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
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
|
||||
* @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
|
||||
struct block buffer;
|
||||
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
|
||||
u32 offset = 0;
|
||||
|
||||
while(1)
|
||||
{
|
||||
while (1) {
|
||||
//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
|
||||
s32 bytes_read = net_read(connection, buffer.data + offset, buffer.size - offset);
|
||||
|
||||
//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);
|
||||
return emptyblock;
|
||||
}
|
||||
|
||||
//No more bytes were read into the buffer,
|
||||
//we assume this means the HTTP response is done
|
||||
if(bytes_read == 0)
|
||||
{
|
||||
if (bytes_read == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -105,13 +101,11 @@ struct block read_message(s32 connection)
|
||||
|
||||
//Check if we have enough buffer left over,
|
||||
//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.data = realloc(buffer.data, buffer.size);
|
||||
|
||||
if(buffer.data == NULL)
|
||||
{
|
||||
if (buffer.data == NULL) {
|
||||
return emptyblock;
|
||||
}
|
||||
}
|
||||
@ -130,11 +124,9 @@ struct block read_message(s32 connection)
|
||||
* Downloads the contents of a URL to memory
|
||||
* 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
|
||||
if(strncmp(url, "http://", strlen("http://")) != 0)
|
||||
{
|
||||
if (strncmp(url, "http://", strlen("http://")) != 0) {
|
||||
//printf("URL '%s' doesn't start with 'http://'\n", url);
|
||||
return emptyblock;
|
||||
}
|
||||
@ -143,8 +135,7 @@ struct block downloadfile(const char *url)
|
||||
char *path = strchr(url + strlen("http://"), '/');
|
||||
|
||||
//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);
|
||||
return emptyblock;
|
||||
}
|
||||
@ -152,8 +143,7 @@ struct block downloadfile(const char *url)
|
||||
//Extract the domain part out of the url
|
||||
int domainlength = path - url - strlen("http://");
|
||||
|
||||
if(domainlength == 0)
|
||||
{
|
||||
if (domainlength == 0) {
|
||||
//printf("No domain part in URL '%s'\n", url);
|
||||
return emptyblock;
|
||||
}
|
||||
@ -165,8 +155,7 @@ struct block downloadfile(const char *url)
|
||||
//Parsing of the URL is done, start making an actual connection
|
||||
u32 ipaddress = getipbynamecached(domain);
|
||||
|
||||
if(ipaddress == 0)
|
||||
{
|
||||
if (ipaddress == 0) {
|
||||
//printf("\ndomain %s could not be resolved", domain);
|
||||
return emptyblock;
|
||||
}
|
||||
@ -193,21 +182,18 @@ struct block downloadfile(const char *url)
|
||||
unsigned char *filestart = NULL;
|
||||
u32 filesize = 0;
|
||||
int i;
|
||||
for(i = 3; i < response.size; i++)
|
||||
{
|
||||
for (i = 3; i < response.size; i++) {
|
||||
if (response.data[i] == '\n' &&
|
||||
response.data[i-1] == '\r' &&
|
||||
response.data[i-2] == '\n' &&
|
||||
response.data[i-3] == '\r')
|
||||
{
|
||||
response.data[i-3] == '\r') {
|
||||
filestart = response.data + i + 1;
|
||||
filesize = response.size - i - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(filestart == NULL)
|
||||
{
|
||||
if (filestart == NULL) {
|
||||
//printf("HTTP Response was without a file\n");
|
||||
free(response.data);
|
||||
return emptyblock;
|
||||
@ -218,8 +204,7 @@ struct block downloadfile(const char *url)
|
||||
file.data = malloc(filesize);
|
||||
file.size = filesize;
|
||||
|
||||
if(file.data == NULL)
|
||||
{
|
||||
if (file.data == NULL) {
|
||||
//printf("No more memory to copy file from HTTP response\n");
|
||||
free(response.data);
|
||||
return emptyblock;
|
||||
|
@ -7,8 +7,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#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
|
||||
*/
|
||||
struct block
|
||||
{
|
||||
struct block {
|
||||
u32 size;
|
||||
unsigned char *data;
|
||||
};
|
||||
|
@ -58,24 +58,21 @@ void Initialize_Network(void) {
|
||||
/****************************************************************************
|
||||
* Check if network was initialised
|
||||
***************************************************************************/
|
||||
bool IsNetworkInit(void)
|
||||
{
|
||||
bool IsNetworkInit(void) {
|
||||
return networkinitialized;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Get network IP
|
||||
***************************************************************************/
|
||||
char * GetNetworkIP(void)
|
||||
{
|
||||
char * GetNetworkIP(void) {
|
||||
return IP;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Get network IP
|
||||
***************************************************************************/
|
||||
bool ShutdownWC24()
|
||||
{
|
||||
bool ShutdownWC24() {
|
||||
bool onlinefix = IsNetworkInit();
|
||||
if (onlinefix) {
|
||||
s32 kd_fd, ret;
|
||||
@ -92,8 +89,7 @@ bool ShutdownWC24()
|
||||
return onlinefix;
|
||||
}
|
||||
|
||||
s32 network_request(const char * request)
|
||||
{
|
||||
s32 network_request(const char * request) {
|
||||
char buf[1024];
|
||||
char *ptr = NULL;
|
||||
|
||||
@ -125,8 +121,7 @@ s32 network_request(const char * request)
|
||||
return size;
|
||||
}
|
||||
|
||||
s32 network_read(u8 *buf, u32 len)
|
||||
{
|
||||
s32 network_read(u8 *buf, u32 len) {
|
||||
u32 read = 0;
|
||||
s32 ret = -1;
|
||||
|
||||
@ -154,8 +149,7 @@ s32 network_read(u8 *buf, u32 len)
|
||||
s32 download_request(const char * 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;
|
||||
}
|
||||
|
||||
@ -163,16 +157,14 @@ s32 download_request(const char * url) {
|
||||
char *path = strchr(url + strlen("http://"), '/');
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
//Extract the domain part out of the url
|
||||
int domainlength = path - url - strlen("http://");
|
||||
|
||||
if(domainlength == 0)
|
||||
{
|
||||
if (domainlength == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -219,8 +211,7 @@ int NetworkWait() {
|
||||
//Open socket
|
||||
socket = net_socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
|
||||
|
||||
if (socket == INVALID_SOCKET)
|
||||
{
|
||||
if (socket == INVALID_SOCKET) {
|
||||
return socket;
|
||||
}
|
||||
|
||||
@ -228,22 +219,19 @@ int NetworkWait() {
|
||||
sin.sin_port = htons(PORT);
|
||||
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);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (net_listen(socket, 3) < 0)
|
||||
{
|
||||
if (net_listen(socket, 3) < 0) {
|
||||
net_close(socket);
|
||||
return -1;
|
||||
}
|
||||
|
||||
connection = net_accept(socket, (struct sockaddr*)&client_address, &addrlen);
|
||||
|
||||
if (connection < 0)
|
||||
{
|
||||
if (connection < 0) {
|
||||
net_close(connection);
|
||||
net_close(socket);
|
||||
return -4;
|
||||
@ -265,8 +253,7 @@ int NetworkWait() {
|
||||
/****************************************************************************
|
||||
* Update check
|
||||
***************************************************************************/
|
||||
int CheckUpdate()
|
||||
{
|
||||
int CheckUpdate() {
|
||||
if (!networkinitialized)
|
||||
return -1;
|
||||
|
||||
@ -299,8 +286,7 @@ int CheckUpdate()
|
||||
/****************************************************************************
|
||||
* HaltNetwork
|
||||
***************************************************************************/
|
||||
void HaltNetworkThread()
|
||||
{
|
||||
void HaltNetworkThread() {
|
||||
networkHalt = true;
|
||||
checkincomming = false;
|
||||
|
||||
@ -315,8 +301,7 @@ void HaltNetworkThread()
|
||||
/****************************************************************************
|
||||
* ResumeNetworkThread
|
||||
***************************************************************************/
|
||||
void ResumeNetworkThread()
|
||||
{
|
||||
void ResumeNetworkThread() {
|
||||
networkHalt = false;
|
||||
LWP_ResumeThread(networkthread);
|
||||
}
|
||||
@ -324,8 +309,7 @@ void ResumeNetworkThread()
|
||||
/****************************************************************************
|
||||
* Resume NetworkWait
|
||||
***************************************************************************/
|
||||
void ResumeNetworkWait()
|
||||
{
|
||||
void ResumeNetworkWait() {
|
||||
networkHalt = true;
|
||||
checkincomming = true;
|
||||
waitforanswer = true;
|
||||
@ -337,8 +321,7 @@ void ResumeNetworkWait()
|
||||
/*********************************************************************************
|
||||
* Networkthread for background network initialize and update check with idle prio
|
||||
*********************************************************************************/
|
||||
static void * networkinitcallback(void *arg)
|
||||
{
|
||||
static void * networkinitcallback(void *arg) {
|
||||
while (1) {
|
||||
|
||||
if (!checkincomming && networkHalt)
|
||||
@ -366,16 +349,14 @@ static void * networkinitcallback(void *arg)
|
||||
/****************************************************************************
|
||||
* InitNetworkThread with priority 0 (idle)
|
||||
***************************************************************************/
|
||||
void InitNetworkThread()
|
||||
{
|
||||
void InitNetworkThread() {
|
||||
LWP_CreateThread (&networkthread, networkinitcallback, NULL, NULL, 0, 0);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* ShutdownThread
|
||||
***************************************************************************/
|
||||
void ShutdownNetworkThread()
|
||||
{
|
||||
void ShutdownNetworkThread() {
|
||||
LWP_JoinThread (networkthread, NULL);
|
||||
networkthread = LWP_THREAD_NULL;
|
||||
}
|
||||
|
@ -36,8 +36,7 @@
|
||||
|
||||
#define READ_SAMPLES 4096 // samples that it must read before to send
|
||||
#define MAX_PCMOUT 4096 // minimum size to read ogg samples
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
OggVorbis_File vf;
|
||||
vorbis_info *vi;
|
||||
int current_section;
|
||||
@ -68,10 +67,8 @@ static lwpq_t oggplayer_queue = LWP_THREAD_NULL;
|
||||
static lwp_t h_oggplayer = LWP_THREAD_NULL;
|
||||
static int ogg_thread_running = 0;
|
||||
|
||||
static void ogg_add_callback(int voice)
|
||||
{
|
||||
if (!ogg_thread_running)
|
||||
{
|
||||
static void ogg_add_callback(int voice) {
|
||||
if (!ogg_thread_running) {
|
||||
ASND_StopVoice(0);
|
||||
return;
|
||||
}
|
||||
@ -79,30 +76,24 @@ static void ogg_add_callback(int voice)
|
||||
if (private_ogg.flag & 128)
|
||||
return; // Ogg is paused
|
||||
|
||||
if (private_ogg.pcm_indx >= READ_SAMPLES)
|
||||
{
|
||||
if (private_ogg.pcm_indx >= READ_SAMPLES) {
|
||||
if (ASND_AddVoice(0,
|
||||
(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.pcm_indx = 0;
|
||||
private_ogg.flag = 0;
|
||||
LWP_ThreadSignal(oggplayer_queue);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (private_ogg.flag & 64)
|
||||
{
|
||||
} else {
|
||||
if (private_ogg.flag & 64) {
|
||||
private_ogg.flag &= ~64;
|
||||
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;
|
||||
long ret;
|
||||
|
||||
@ -122,25 +113,20 @@ static void * ogg_player_thread(private_data_ogg * priv)
|
||||
|
||||
ogg_thread_running = 1;
|
||||
|
||||
while (!priv[0].eof && ogg_thread_running)
|
||||
{
|
||||
while (!priv[0].eof && ogg_thread_running) {
|
||||
if (priv[0].flag)
|
||||
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])
|
||||
&& ASND_StatusVoice(0) != SND_UNUSED)
|
||||
{
|
||||
&& ASND_StatusVoice(0) != SND_UNUSED) {
|
||||
priv[0].flag |= 64;
|
||||
continue;
|
||||
}
|
||||
if (priv[0].pcm_indx < READ_SAMPLES)
|
||||
{
|
||||
if (priv[0].pcm_indx < READ_SAMPLES) {
|
||||
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);
|
||||
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],
|
||||
MAX_PCMOUT,/*0,2,1,*/&priv[0].current_section);
|
||||
priv[0].flag &= 192;
|
||||
if (ret == 0)
|
||||
{
|
||||
if (ret == 0) {
|
||||
/* EOF */
|
||||
if (priv[0].mode & 1)
|
||||
ov_time_seek(&priv[0].vf, 0); // repeat
|
||||
else
|
||||
priv[0].eof = 1; // stops
|
||||
//
|
||||
}
|
||||
else if (ret < 0)
|
||||
{
|
||||
} else if (ret < 0) {
|
||||
/* error in the stream. Not a problem, just reporting it in
|
||||
case we (the app) cares. In this case, we don't. */
|
||||
if (ret != OV_HOLE)
|
||||
{
|
||||
if (ret != OV_HOLE) {
|
||||
if (priv[0].mode & 1)
|
||||
ov_time_seek(&priv[0].vf, 0); // repeat
|
||||
else
|
||||
priv[0].eof = 1; // stops
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* we don't bother dealing with sample rate changes, etc, but
|
||||
you'll have to*/
|
||||
priv[0].pcm_indx += ret >> 1; //get 16 bits samples
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
priv[0].flag = 1;
|
||||
}
|
||||
|
||||
if (priv[0].flag == 1)
|
||||
{
|
||||
if (ASND_StatusVoice(0) == SND_UNUSED || first_time)
|
||||
{
|
||||
if (priv[0].flag == 1) {
|
||||
if (ASND_StatusVoice(0) == SND_UNUSED || first_time) {
|
||||
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,
|
||||
(void *) priv[0].pcmout[priv[0].pcmout_pos],
|
||||
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].pcm_indx = 0;
|
||||
priv[0].flag = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
ASND_SetVoice(0, VOICE_MONO_16BIT, priv[0].vi->rate, 0,
|
||||
(void *) priv[0].pcmout[priv[0].pcmout_pos],
|
||||
priv[0].pcm_indx << 1, priv[0].volume,
|
||||
@ -220,27 +194,23 @@ static void * ogg_player_thread(private_data_ogg * priv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void StopOgg()
|
||||
{
|
||||
void StopOgg() {
|
||||
ASND_StopVoice(0);
|
||||
ogg_thread_running = 0;
|
||||
|
||||
if(h_oggplayer != LWP_THREAD_NULL)
|
||||
{
|
||||
if (h_oggplayer != LWP_THREAD_NULL) {
|
||||
if (oggplayer_queue != LWP_TQUEUE_NULL)
|
||||
LWP_ThreadSignal(oggplayer_queue);
|
||||
LWP_JoinThread(h_oggplayer, NULL);
|
||||
h_oggplayer = LWP_THREAD_NULL;
|
||||
}
|
||||
if(oggplayer_queue != LWP_TQUEUE_NULL)
|
||||
{
|
||||
if (oggplayer_queue != LWP_TQUEUE_NULL) {
|
||||
LWP_CloseQueue(oggplayer_queue);
|
||||
oggplayer_queue = LWP_TQUEUE_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int PlayOgg(int fd, int time_pos, int mode)
|
||||
{
|
||||
int PlayOgg(int fd, int time_pos, int mode) {
|
||||
StopOgg();
|
||||
|
||||
private_ogg.fd = fd;
|
||||
@ -253,13 +223,11 @@ int PlayOgg(int fd, int time_pos, int mode)
|
||||
if (time_pos > 0)
|
||||
private_ogg.seek_time = time_pos;
|
||||
|
||||
if (fd < 0)
|
||||
{
|
||||
if (fd < 0) {
|
||||
private_ogg.fd = -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
|
||||
private_ogg.fd = -1;
|
||||
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,
|
||||
&private_ogg, oggplayer_stack, STACKSIZE, 80) == -1)
|
||||
{
|
||||
&private_ogg, oggplayer_stack, STACKSIZE, 80) == -1) {
|
||||
ogg_thread_running = 0;
|
||||
ov_clear(&private_ogg.vf);
|
||||
private_ogg.fd = -1;
|
||||
@ -300,11 +267,17 @@ int PlayOggFromFile(char * path, int loop) {
|
||||
|
||||
// allocate memory to contain the whole file:
|
||||
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:
|
||||
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);
|
||||
|
||||
@ -315,20 +288,14 @@ int PlayOggFromFile(char * path, int loop) {
|
||||
}
|
||||
|
||||
|
||||
void PauseOgg(int pause)
|
||||
{
|
||||
if (pause)
|
||||
{
|
||||
void PauseOgg(int pause) {
|
||||
if (pause) {
|
||||
private_ogg.flag |= 128;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (private_ogg.flag & 128)
|
||||
{
|
||||
} else {
|
||||
if (private_ogg.flag & 128) {
|
||||
private_ogg.flag |= 64;
|
||||
private_ogg.flag &= ~128;
|
||||
if (ogg_thread_running > 0)
|
||||
{
|
||||
if (ogg_thread_running > 0) {
|
||||
LWP_ThreadSignal(oggplayer_queue);
|
||||
}
|
||||
}
|
||||
@ -336,8 +303,7 @@ void PauseOgg(int pause)
|
||||
}
|
||||
}
|
||||
|
||||
int StatusOgg()
|
||||
{
|
||||
int StatusOgg() {
|
||||
if (ogg_thread_running == 0)
|
||||
return -1; // Error
|
||||
else if (private_ogg.eof)
|
||||
@ -348,14 +314,12 @@ int StatusOgg()
|
||||
return 1; // running
|
||||
}
|
||||
|
||||
void SetVolumeOgg(int volume)
|
||||
{
|
||||
void SetVolumeOgg(int volume) {
|
||||
private_ogg.volume = volume;
|
||||
ASND_ChangeVolumeVoice(0, volume, volume);
|
||||
}
|
||||
|
||||
s32 GetTimeOgg()
|
||||
{
|
||||
s32 GetTimeOgg() {
|
||||
int ret;
|
||||
if (ogg_thread_running == 0 || private_ogg.fd < 0)
|
||||
return 0;
|
||||
@ -366,8 +330,7 @@ s32 GetTimeOgg()
|
||||
return ret;
|
||||
}
|
||||
|
||||
void SetTimeOgg(s32 time_pos)
|
||||
{
|
||||
void SetTimeOgg(s32 time_pos) {
|
||||
if (time_pos >= 0)
|
||||
private_ogg.seek_time = time_pos;
|
||||
}
|
||||
|
@ -32,8 +32,7 @@
|
||||
#include "tremor/ivorbisfile.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define OGG_ONE_TIME 0
|
||||
|
@ -64,13 +64,11 @@
|
||||
#define _SHIFTR(v, s, w) \
|
||||
((u32)(((u32)(v) >> (s)) & ((0x01 << (w)) - 1)))
|
||||
|
||||
struct dicommand
|
||||
{
|
||||
struct dicommand {
|
||||
u32 diReg[8];
|
||||
};
|
||||
|
||||
struct dicontext
|
||||
{
|
||||
struct dicontext {
|
||||
lwp_node node;
|
||||
dvdcallbacklow cb;
|
||||
struct dicommand *cmd;
|
||||
@ -93,26 +91,22 @@ static char __di_fs[] ATTRIBUTE_ALIGN(32) = "/dev/di";
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
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->perm_null = NULL;
|
||||
queue->last = __lwp_queue_head(queue);
|
||||
}
|
||||
|
||||
static struct dicontext* __dvd_getcontext(dvdcallbacklow cb)
|
||||
{
|
||||
static struct dicontext* __dvd_getcontext(dvdcallbacklow cb) {
|
||||
struct dicontext *ctx;
|
||||
|
||||
ctx = (struct dicontext*)__lwp_queue_get(&__di_contextq);
|
||||
@ -121,8 +115,7 @@ static struct dicontext* __dvd_getcontext(dvdcallbacklow cb)
|
||||
return ctx;
|
||||
}
|
||||
|
||||
static s32 __dvd_iostransactionCB(s32 result,void *usrdata)
|
||||
{
|
||||
static s32 __dvd_iostransactionCB(s32 result,void *usrdata) {
|
||||
struct dicontext *ctx = (struct dicontext*)usrdata;
|
||||
|
||||
__dvd_reqinprogress = 0;
|
||||
@ -138,8 +131,7 @@ static s32 __dvd_iostransactionCB(s32 result,void *usrdata)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static s32 __dvd_ioscoverregisterCB(s32 result,void *usrdata)
|
||||
{
|
||||
static s32 __dvd_ioscoverregisterCB(s32 result,void *usrdata) {
|
||||
struct dicontext *ctx = (struct dicontext*)usrdata;
|
||||
|
||||
__dvd_reqinprogress = 0;
|
||||
@ -155,8 +147,7 @@ static s32 __dvd_ioscoverregisterCB(s32 result,void *usrdata)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static s32 __dvd_ioscovercloseCB(s32 result,void *usrdata)
|
||||
{
|
||||
static s32 __dvd_ioscovercloseCB(s32 result,void *usrdata) {
|
||||
struct dicontext *ctx = (struct dicontext*)usrdata;
|
||||
|
||||
__dvd_reqinprogress = 0;
|
||||
@ -171,8 +162,7 @@ static s32 __dvd_ioscovercloseCB(s32 result,void *usrdata)
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 bwDVD_LowInit()
|
||||
{
|
||||
s32 bwDVD_LowInit() {
|
||||
s32 i,ret = 0;
|
||||
u32 ipclo,ipchi;
|
||||
lwp_queue inactives;
|
||||
@ -213,8 +203,7 @@ s32 bwDVD_LowInit()
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 bwDVD_LowInquiry(dvddrvinfo *info,dvdcallbacklow cb)
|
||||
{
|
||||
s32 bwDVD_LowInquiry(dvddrvinfo *info,dvdcallbacklow cb) {
|
||||
s32 ret;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
@ -231,8 +220,7 @@ s32 bwDVD_LowInquiry(dvddrvinfo *info,dvdcallbacklow cb)
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 bwDVD_LowReadID(dvddiskid *diskID,dvdcallbacklow cb)
|
||||
{
|
||||
s32 bwDVD_LowReadID(dvddiskid *diskID,dvdcallbacklow cb) {
|
||||
s32 ret = 0;
|
||||
struct dicontext *ctx;
|
||||
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;
|
||||
struct dicontext *ctx;
|
||||
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
|
||||
s32 bwDVD_LowReadVideo(void *buf,u32 len,u32 offset,dvdcallbacklow cb)
|
||||
{
|
||||
s32 bwDVD_LowReadVideo(void *buf,u32 len,u32 offset,dvdcallbacklow cb) {
|
||||
s32 ret;
|
||||
struct dicontext *ctx;
|
||||
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;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
@ -319,8 +304,7 @@ s32 bwDVD_LowStopLaser(dvdcallbacklow cb)
|
||||
}
|
||||
|
||||
// never got this function working, probably removed from wii
|
||||
s32 bwDVD_EnableVideo(dvdcallbacklow cb)
|
||||
{
|
||||
s32 bwDVD_EnableVideo(dvdcallbacklow cb) {
|
||||
s32 ret;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
@ -337,8 +321,7 @@ s32 bwDVD_EnableVideo(dvdcallbacklow cb)
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 bwDVD_LowSeek(u32 offset,dvdcallbacklow cb)
|
||||
{
|
||||
s32 bwDVD_LowSeek(u32 offset,dvdcallbacklow cb) {
|
||||
s32 ret;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
@ -356,8 +339,7 @@ s32 bwDVD_LowSeek(u32 offset,dvdcallbacklow cb)
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 bwDVD_LowOffset(u64 offset,dvdcallbacklow cb)
|
||||
{
|
||||
s32 bwDVD_LowOffset(u64 offset,dvdcallbacklow cb) {
|
||||
s32 ret;
|
||||
u32 *off = (u32*)(void*)(&offset);
|
||||
struct dicontext *ctx;
|
||||
@ -378,8 +360,7 @@ s32 bwDVD_LowOffset(u64 offset,dvdcallbacklow cb)
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 bwDVD_LowPrepareCoverRegister(dvdcallbacklow cb)
|
||||
{
|
||||
s32 bwDVD_LowPrepareCoverRegister(dvdcallbacklow cb) {
|
||||
s32 ret;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
@ -396,8 +377,7 @@ s32 bwDVD_LowPrepareCoverRegister(dvdcallbacklow cb)
|
||||
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;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
@ -435,8 +415,7 @@ s32 bwDVD_LowOpenPartition(u32 offset,void *eticket,u32 certin_len,void *certifi
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 bwDVD_LowClosePartition(dvdcallbacklow cb)
|
||||
{
|
||||
s32 bwDVD_LowClosePartition(dvdcallbacklow cb) {
|
||||
s32 ret;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
@ -453,8 +432,7 @@ s32 bwDVD_LowClosePartition(dvdcallbacklow cb)
|
||||
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;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
@ -474,8 +452,7 @@ s32 bwDVD_LowUnencryptedRead(void *buf,u32 len,u32 offset,dvdcallbacklow cb)
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 bwDVD_LowWaitCoverClose(dvdcallbacklow cb)
|
||||
{
|
||||
s32 bwDVD_LowWaitCoverClose(dvdcallbacklow cb) {
|
||||
s32 ret;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
@ -492,8 +469,7 @@ s32 bwDVD_LowWaitCoverClose(dvdcallbacklow cb)
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 bwDVD_LowResetNotify()
|
||||
{
|
||||
s32 bwDVD_LowResetNotify() {
|
||||
s32 ret;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
@ -510,8 +486,7 @@ s32 bwDVD_LowResetNotify()
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 bwDVD_LowReset(dvdcallbacklow cb)
|
||||
{
|
||||
s32 bwDVD_LowReset(dvdcallbacklow cb) {
|
||||
s32 ret;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
@ -531,8 +506,7 @@ s32 bwDVD_LowReset(dvdcallbacklow cb)
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 bwDVD_LowStopMotor(u8 stop1,u8 stop2,dvdcallbacklow cb)
|
||||
{
|
||||
s32 bwDVD_LowStopMotor(u8 stop1,u8 stop2,dvdcallbacklow cb) {
|
||||
s32 ret;
|
||||
struct dicontext *ctx;
|
||||
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;
|
||||
struct dicontext *ctx;
|
||||
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;
|
||||
struct dicontext *ctx;
|
||||
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;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
|
@ -37,8 +37,7 @@
|
||||
|
||||
extern struct SSettings Settings;
|
||||
|
||||
u32 do_sd_code(char *filename)
|
||||
{
|
||||
u32 do_sd_code(char *filename) {
|
||||
FILE *fp;
|
||||
u8 *filebuff;
|
||||
u32 filesize;
|
||||
|
@ -23,8 +23,7 @@
|
||||
#define __FST_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//u32 do_fst(u32 fstlocation);
|
||||
|
@ -146,16 +146,13 @@ static const u32 wpadlibogc[5] = {
|
||||
0x90A402E0,0x806502E4,0x908502E4,0x2C030000,0x906402E4
|
||||
};
|
||||
|
||||
void dogamehooks(void *addr, u32 len)
|
||||
{
|
||||
void dogamehooks(void *addr, u32 len) {
|
||||
void *addr_start = addr;
|
||||
void *addr_end = addr+len;
|
||||
|
||||
while(addr_start < addr_end)
|
||||
{
|
||||
while (addr_start < addr_end) {
|
||||
|
||||
switch(hooktype)
|
||||
{
|
||||
switch (hooktype) {
|
||||
|
||||
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
|
||||
void patchdol(void *addr, u32 len)
|
||||
{
|
||||
void patchdol(void *addr, u32 len) {
|
||||
|
||||
void *addr_start = addr;
|
||||
void *addr_end = addr+len;
|
||||
|
||||
while(addr_start < addr_end)
|
||||
{
|
||||
while (addr_start < addr_end) {
|
||||
if (memcmp(addr_start, wpadlibogc, sizeof(wpadlibogc))==0) {
|
||||
// printf("\n\n\n");
|
||||
// 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_end = addr+len;
|
||||
|
||||
while(addr_start < addr_end)
|
||||
{
|
||||
while (addr_start < addr_end) {
|
||||
|
||||
if (memcmp(addr_start, langpatch, sizeof(langpatch))==0) {
|
||||
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_end = addr+len;
|
||||
|
||||
while(addr_start < addr_end)
|
||||
{
|
||||
while (addr_start < addr_end) {
|
||||
|
||||
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_end = addr+len;
|
||||
|
||||
while(addr_start < addr_end)
|
||||
{
|
||||
while (addr_start < addr_end) {
|
||||
if (memcmp(addr_start, vipatchcode, sizeof(vipatchcode))==0) {
|
||||
vipatch((u32)addr_start, len);
|
||||
}
|
||||
|
@ -22,8 +22,7 @@
|
||||
#ifndef __PATCHCODE_H__
|
||||
#define __PATCHCODE_H__
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
// Globals
|
||||
u32 hooktype;
|
||||
|
@ -29,8 +29,7 @@ extern u8 reset;
|
||||
/********************************************************************************
|
||||
*Game specific settings
|
||||
*********************************************************************************/
|
||||
int DiscBrowse(struct discHdr * header)
|
||||
{
|
||||
int DiscBrowse(struct discHdr * header) {
|
||||
bool exit = false;
|
||||
int ret, choice;
|
||||
u64 offset;
|
||||
@ -65,8 +64,7 @@ int DiscBrowse(struct discHdr * header)
|
||||
|
||||
int *buffer = (int*)memalign(32, 0x20);
|
||||
|
||||
if (buffer == NULL)
|
||||
{
|
||||
if (buffer == NULL) {
|
||||
WindowPrompt(tr("ERROR:"), tr("Not enough free memory."), tr("OK"));
|
||||
return -1;
|
||||
}
|
||||
@ -80,8 +78,7 @@ int DiscBrowse(struct discHdr * header)
|
||||
void *fstbuffer = memalign(32, buffer[2]*4);
|
||||
FST_ENTRY *fst = (FST_ENTRY *)fstbuffer;
|
||||
|
||||
if (fst == NULL)
|
||||
{
|
||||
if (fst == NULL) {
|
||||
WindowPrompt(tr("ERROR:"), tr("Not enough free memory."), tr("OK"));
|
||||
free(buffer);
|
||||
return -1;
|
||||
@ -115,8 +112,7 @@ int DiscBrowse(struct discHdr * header)
|
||||
if (fstfiles(fst, i)[len-4] =='.' &&
|
||||
fstfiles(fst, i)[len-3] =='d' &&
|
||||
fstfiles(fst, i)[len-2] =='o' &&
|
||||
fstfiles(fst, i)[len-1] =='l')
|
||||
{
|
||||
fstfiles(fst, i)[len-1] =='l') {
|
||||
options3.SetName(i, "%i", i);
|
||||
options3.SetValue(i, fstfiles(fst, i));
|
||||
//options3.SetName(i, fstfiles(fst, i));
|
||||
@ -190,8 +186,7 @@ int DiscBrowse(struct discHdr * header)
|
||||
|
||||
ResumeGui();
|
||||
|
||||
while(!exit)
|
||||
{
|
||||
while (!exit) {
|
||||
VIDEO_WaitVSync();
|
||||
|
||||
if (shutdown == 1)
|
||||
@ -213,8 +208,7 @@ int DiscBrowse(struct discHdr * header)
|
||||
}
|
||||
}
|
||||
|
||||
if (cancelBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
if (cancelBtn.GetState() == STATE_CLICKED) {
|
||||
exit = true;
|
||||
ret = 696969;
|
||||
//break;
|
||||
@ -232,8 +226,7 @@ int DiscBrowse(struct discHdr * header)
|
||||
}
|
||||
|
||||
|
||||
int autoSelectDol(const char *id)
|
||||
{
|
||||
int autoSelectDol(const char *id) {
|
||||
//still not done//
|
||||
//////////ID6/////////////////
|
||||
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
|
||||
* 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);
|
||||
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
||||
promptWindow.SetPosition(0, -10);
|
||||
@ -138,7 +137,8 @@ static void ProgressWindow(const char *title, const char *msg1, const char *msg2
|
||||
|
||||
GuiImage progressbarOutlineImg(&progressbarOutline);
|
||||
if (Settings.wsprompt == yes) {
|
||||
progressbarOutlineImg.SetWidescreen(CFG.widescreen);}
|
||||
progressbarOutlineImg.SetWidescreen(CFG.widescreen);
|
||||
}
|
||||
progressbarOutlineImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
progressbarOutlineImg.SetPosition(25, 40);
|
||||
|
||||
@ -243,8 +243,7 @@ static void ProgressWindow(const char *title, const char *msg1, const char *msg2
|
||||
|
||||
|
||||
int tmp;
|
||||
while(showProgress)
|
||||
{
|
||||
while (showProgress) {
|
||||
|
||||
VIDEO_WaitVSync ();
|
||||
usleep(20000);
|
||||
@ -284,10 +283,8 @@ static void ProgressWindow(const char *title, const char *msg1, const char *msg2
|
||||
* ProgressThread
|
||||
***************************************************************************/
|
||||
|
||||
static void * ProgressThread (void *arg)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
static void * ProgressThread (void *arg) {
|
||||
while (1) {
|
||||
if (!showProgress)
|
||||
LWP_SuspendThread (progressthread);
|
||||
|
||||
@ -300,8 +297,7 @@ static void * ProgressThread (void *arg)
|
||||
/****************************************************************************
|
||||
* ProgressStop
|
||||
***************************************************************************/
|
||||
void ProgressStop()
|
||||
{
|
||||
void ProgressStop() {
|
||||
showProgress = 0;
|
||||
gameinstalltotal = -1;
|
||||
|
||||
@ -316,8 +312,7 @@ void ProgressStop()
|
||||
* Callbackfunction for updating the progress values
|
||||
* 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)
|
||||
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
|
||||
* relies on code from any title deleter.
|
||||
*********************************************************************************/
|
||||
int TitleBrowser(u32 type)
|
||||
{
|
||||
int TitleBrowser(u32 type) {
|
||||
|
||||
u32 num_titles;
|
||||
u32 titles[100] ATTRIBUTE_ALIGN(32);
|
||||
@ -105,13 +104,12 @@ int TitleBrowser(u32 type)
|
||||
snprintf(tmp,50,tmp," ");
|
||||
//snprintf(name[i],sizeof(name[i]),"Unknown Title");
|
||||
|
||||
if(f)
|
||||
{
|
||||
if (f) {
|
||||
while (fgets(line, sizeof(line), f)) {
|
||||
if (line[0]== text[0]&&
|
||||
line[1]== text[1]&&
|
||||
line[2]== text[2])
|
||||
{ int j=0;
|
||||
line[2]== text[2]) {
|
||||
int j=0;
|
||||
found=1;
|
||||
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)
|
||||
found=2;
|
||||
|
||||
if(!found)
|
||||
{
|
||||
if (!found) {
|
||||
if (getNameBN(name[i], TITLE_ID(type, titles[i]))>=0)
|
||||
found=3;
|
||||
|
||||
@ -160,13 +156,12 @@ int TitleBrowser(u32 type)
|
||||
char tmp[50];
|
||||
snprintf(tmp,50,tmp," ");
|
||||
//snprintf(name[i],sizeof(name[i]),"Unknown Title");
|
||||
if(f)
|
||||
{
|
||||
if (f) {
|
||||
while (fgets(line, sizeof(line), f)) {
|
||||
if (line[0]== text[0]&&
|
||||
line[1]== text[1]&&
|
||||
line[2]== text[2])
|
||||
{ int j=0;
|
||||
line[2]== text[2]) {
|
||||
int j=0;
|
||||
found=1;
|
||||
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)
|
||||
found=2;
|
||||
|
||||
if(!found)
|
||||
{
|
||||
if (!found) {
|
||||
if (getNameBN(name[i], TITLE_ID(0x00010002, sys_titles[i-num_titles]))>=0)
|
||||
found=3;
|
||||
|
||||
@ -198,8 +191,8 @@ int TitleBrowser(u32 type)
|
||||
//move on to the next title
|
||||
i++;
|
||||
}
|
||||
if(i == num_titles+num_sys_titles)
|
||||
{ options3.SetName(i, " ");
|
||||
if (i == num_titles+num_sys_titles) {
|
||||
options3.SetName(i, " ");
|
||||
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
|
||||
@ -271,8 +264,7 @@ int TitleBrowser(u32 type)
|
||||
int tmp=num_titles+num_sys_titles;
|
||||
ResumeGui();
|
||||
numtitle=num_titles;
|
||||
while(!exit)
|
||||
{
|
||||
while (!exit) {
|
||||
VIDEO_WaitVSync();
|
||||
|
||||
if (shutdown == 1)
|
||||
@ -289,8 +281,7 @@ int TitleBrowser(u32 type)
|
||||
if (f)rewind(f);
|
||||
//strcpy(name,"");//make sure name is empty
|
||||
|
||||
if (ret<numtitle)
|
||||
{
|
||||
if (ret<numtitle) {
|
||||
//set the title's name, number, ID to text
|
||||
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
|
||||
exit = true;
|
||||
break;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
//if they said no to booting the title
|
||||
ret = -1;
|
||||
optionBrowser3.ResetState();
|
||||
}
|
||||
|
||||
}
|
||||
else//if they clicked a system title
|
||||
{
|
||||
if(ret == tmp)
|
||||
{
|
||||
} else { //if they clicked a system title
|
||||
if (ret == tmp) {
|
||||
CloseXMLDatabase();
|
||||
ExitGUIThreads();
|
||||
ShutdownAudio();
|
||||
@ -331,9 +318,7 @@ int TitleBrowser(u32 type)
|
||||
WII_Initialize();
|
||||
WII_ReturnToSettings();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
//set the title's name, number, ID to text
|
||||
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
|
||||
exit = true;
|
||||
break;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
//if they said no to booting the title
|
||||
ret = -1;
|
||||
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
|
||||
exit = true;
|
||||
ret = -10;
|
||||
|
@ -42,15 +42,13 @@ BROWSERENTRY * browserList = NULL; // list of files/folders in browser
|
||||
* ResetBrowser()
|
||||
* Clears the file browser memory, and allocates one initial entry
|
||||
***************************************************************************/
|
||||
void ResetBrowser()
|
||||
{
|
||||
void ResetBrowser() {
|
||||
browser.numEntries = 0;
|
||||
browser.selIndex = 0;
|
||||
browser.pageIndex = 0;
|
||||
|
||||
// Clear any existing values
|
||||
if(browserList != NULL)
|
||||
{
|
||||
if (browserList != NULL) {
|
||||
free(browserList);
|
||||
browserList = NULL;
|
||||
}
|
||||
@ -63,25 +61,21 @@ void ResetBrowser()
|
||||
* UpdateDirName()
|
||||
* Update curent directory name for file browser
|
||||
***************************************************************************/
|
||||
int UpdateDirName()
|
||||
{
|
||||
int UpdateDirName() {
|
||||
int size=0;
|
||||
char * test;
|
||||
char temp[1024];
|
||||
|
||||
/* current directory doesn't change */
|
||||
if (strcmp(browserList[browser.selIndex].filename,".") == 0)
|
||||
{
|
||||
if (strcmp(browserList[browser.selIndex].filename,".") == 0) {
|
||||
return 0;
|
||||
}
|
||||
/* 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 */
|
||||
sprintf(temp,"%s",browser.dir);
|
||||
test = strtok(temp,"/");
|
||||
while (test != NULL)
|
||||
{
|
||||
while (test != NULL) {
|
||||
size = strlen(test);
|
||||
test = strtok(NULL,"/");
|
||||
}
|
||||
@ -93,17 +87,13 @@ int UpdateDirName()
|
||||
return 1;
|
||||
}
|
||||
/* Open a directory */
|
||||
else
|
||||
{
|
||||
else {
|
||||
/* 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 */
|
||||
sprintf(browser.dir, "%s/%s",browser.dir, browserList[browser.selIndex].filename);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -118,15 +108,21 @@ int UpdateDirName()
|
||||
* <dirs>
|
||||
* <files>
|
||||
***************************************************************************/
|
||||
int FileSortCallback(const void *f1, const void *f2)
|
||||
{
|
||||
int FileSortCallback(const void *f1, const void *f2) {
|
||||
/* Special case for implicit directories */
|
||||
if(((BROWSERENTRY *)f1)->filename[0] == '.' || ((BROWSERENTRY *)f2)->filename[0] == '.')
|
||||
{
|
||||
if(strcmp(((BROWSERENTRY *)f1)->filename, ".") == 0) { return -1; }
|
||||
if(strcmp(((BROWSERENTRY *)f2)->filename, ".") == 0) { return 1; }
|
||||
if(strcmp(((BROWSERENTRY *)f1)->filename, "..") == 0) { return -1; }
|
||||
if(strcmp(((BROWSERENTRY *)f2)->filename, "..") == 0) { return 1; }
|
||||
if (((BROWSERENTRY *)f1)->filename[0] == '.' || ((BROWSERENTRY *)f2)->filename[0] == '.') {
|
||||
if (strcmp(((BROWSERENTRY *)f1)->filename, ".") == 0) {
|
||||
return -1;
|
||||
}
|
||||
if (strcmp(((BROWSERENTRY *)f2)->filename, ".") == 0) {
|
||||
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. */
|
||||
@ -140,8 +136,7 @@ int FileSortCallback(const void *f1, const void *f2)
|
||||
* Browse subdirectories
|
||||
**************************************************************************/
|
||||
int
|
||||
ParseDirectory()
|
||||
{
|
||||
ParseDirectory() {
|
||||
DIR_ITER *dir = NULL;
|
||||
char fulldir[MAXPATHLEN];
|
||||
char filename[MAXPATHLEN];
|
||||
@ -155,12 +150,10 @@ ParseDirectory()
|
||||
dir = diropen(fulldir);
|
||||
|
||||
// if we can't open the dir, try opening the root dir
|
||||
if (dir == NULL)
|
||||
{
|
||||
if (dir == NULL) {
|
||||
sprintf(browser.dir,"/");
|
||||
dir = diropen(browser.rootdir);
|
||||
if (dir == NULL)
|
||||
{
|
||||
if (dir == NULL) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -168,32 +161,24 @@ ParseDirectory()
|
||||
// index files/folders
|
||||
int entryNum = 0;
|
||||
|
||||
while(dirnext(dir,filename,&filestat) == 0)
|
||||
{
|
||||
if(strcmp(filename,".") != 0)
|
||||
{
|
||||
while (dirnext(dir,filename,&filestat) == 0) {
|
||||
if (strcmp(filename,".") != 0) {
|
||||
BROWSERENTRY * newBrowserList = (BROWSERENTRY *)realloc(browserList, (entryNum+1) * sizeof(BROWSERENTRY));
|
||||
|
||||
if(!newBrowserList) // failed to allocate required memory
|
||||
{
|
||||
if (!newBrowserList) { // failed to allocate required memory
|
||||
ResetBrowser();
|
||||
entryNum = -1;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
browserList = newBrowserList;
|
||||
}
|
||||
memset(&(browserList[entryNum]), 0, sizeof(BROWSERENTRY)); // clear the new entry
|
||||
|
||||
strncpy(browserList[entryNum].filename, filename, MAXJOLIET);
|
||||
|
||||
if(strcmp(filename,"..") == 0)
|
||||
{
|
||||
if (strcmp(filename,"..") == 0) {
|
||||
sprintf(browserList[entryNum].displayname, "..");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
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
|
||||
***************************************************************************/
|
||||
int BrowserChangeFolder()
|
||||
{
|
||||
int BrowserChangeFolder() {
|
||||
if (!UpdateDirName())
|
||||
return -1;
|
||||
|
||||
@ -233,11 +217,9 @@ int BrowserChangeFolder()
|
||||
* BrowseDevice
|
||||
* Displays a list of files on the selected device
|
||||
***************************************************************************/
|
||||
int BrowseDevice(int device)
|
||||
{
|
||||
int BrowseDevice(int device) {
|
||||
sprintf(browser.dir, "/");
|
||||
switch(device)
|
||||
{
|
||||
switch (device) {
|
||||
case SD:
|
||||
sprintf(browser.rootdir, "SD:");
|
||||
break;
|
||||
@ -254,8 +236,7 @@ int BrowseDevice(int device)
|
||||
* MenuBrowseDevice
|
||||
***************************************************************************/
|
||||
|
||||
int BrowseDevice(char * var, int force)
|
||||
{
|
||||
int BrowseDevice(char * var, int force) {
|
||||
|
||||
int result=-1;
|
||||
int i;
|
||||
@ -264,24 +245,19 @@ int BrowseDevice(char * var, int force)
|
||||
int forced =force;
|
||||
|
||||
if (forced>-1) {
|
||||
if(BrowseDevice(forced) > 0)
|
||||
{
|
||||
if (BrowseDevice(forced) > 0) {
|
||||
curDivice = forced;
|
||||
goto main;
|
||||
}
|
||||
}
|
||||
|
||||
else if((!strcasecmp(bootDevice, "USB:"))&&(BrowseDevice(USB) > 0))
|
||||
{
|
||||
else if ((!strcasecmp(bootDevice, "USB:"))&&(BrowseDevice(USB) > 0)) {
|
||||
curDivice = USB;
|
||||
goto main;
|
||||
}
|
||||
else if((!strcasecmp(bootDevice, "SD:"))&&(BrowseDevice(SD) > 0))
|
||||
{
|
||||
} else if ((!strcasecmp(bootDevice, "SD:"))&&(BrowseDevice(SD) > 0)) {
|
||||
curDivice = SD;
|
||||
goto main;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
WindowPrompt(tr("Error"),0,tr("Ok"));
|
||||
return -1;
|
||||
}
|
||||
@ -317,7 +293,8 @@ main:
|
||||
if (Settings.wsprompt == yes) {
|
||||
ExitBtnTxt.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.SetPosition(-55, -35);
|
||||
ExitBtn.SetLabel(&ExitBtnTxt);
|
||||
@ -331,7 +308,8 @@ main:
|
||||
if (Settings.wsprompt == yes) {
|
||||
usbBtnTxt.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.SetPosition(0, -35);
|
||||
usbBtn.SetLabel(&usbBtnTxt);
|
||||
@ -381,8 +359,7 @@ main:
|
||||
mainWindow->Append(&w);
|
||||
ResumeGui();
|
||||
|
||||
while(menu == MENU_NONE)
|
||||
{
|
||||
while (menu == MENU_NONE) {
|
||||
VIDEO_WaitVSync();
|
||||
|
||||
if (shutdown == 1)
|
||||
@ -391,23 +368,18 @@ main:
|
||||
if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
for(i=0; i<PAGESIZE; i++)
|
||||
{
|
||||
if(fileBrowser.fileList[i]->GetState() == STATE_CLICKED)
|
||||
{
|
||||
for (i=0; i<PAGESIZE; i++) {
|
||||
if (fileBrowser.fileList[i]->GetState() == STATE_CLICKED) {
|
||||
fileBrowser.fileList[i]->ResetState();
|
||||
// check corresponding browser entry
|
||||
if(browserList[browser.selIndex].isdir)
|
||||
{
|
||||
if(BrowserChangeFolder())
|
||||
{
|
||||
if (browserList[browser.selIndex].isdir) {
|
||||
if (BrowserChangeFolder()) {
|
||||
fileBrowser.ResetState();
|
||||
fileBrowser.fileList[0]->SetState(STATE_SELECTED);
|
||||
fileBrowser.TriggerUpdate();
|
||||
sprintf(var,"%s", 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)];
|
||||
}
|
||||
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);
|
||||
break;
|
||||
}
|
||||
if(okBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
if (okBtn.GetState() == STATE_CLICKED) {
|
||||
result = 1;
|
||||
break;
|
||||
}
|
||||
else if(usbBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
} else if (usbBtn.GetState() == STATE_CLICKED) {
|
||||
HaltGui();
|
||||
mainWindow->Remove(&w);
|
||||
ResumeGui();
|
||||
result = BrowseDevice(var, (curDivice==SD?USB:SD));
|
||||
break;
|
||||
}
|
||||
else if(folderBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
} else if (folderBtn.GetState() == STATE_CLICKED) {
|
||||
HaltGui();
|
||||
mainWindow->Remove(&w);
|
||||
ResumeGui();
|
||||
@ -449,8 +415,7 @@ main:
|
||||
sprintf(newfolder,"%s/",var);
|
||||
|
||||
int result = OnScreenKeyboard(newfolder,100,0);
|
||||
if ( result == 1 )
|
||||
{
|
||||
if ( result == 1 ) {
|
||||
int len = (strlen(newfolder)-1);
|
||||
if (newfolder[len] !='/')
|
||||
strncat (newfolder, "/", 1);
|
||||
|
@ -24,8 +24,7 @@ enum {
|
||||
USB
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
char dir[MAXPATHLEN]; // directory path of browserList
|
||||
char rootdir[10]; // directory path of browserList
|
||||
int numEntries; // # of entries in browserList
|
||||
@ -33,8 +32,7 @@ typedef struct
|
||||
int pageIndex; // starting index of browserList page display
|
||||
} BROWSERINFO;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
u64 offset; // DVD offset
|
||||
u64 length; // file length in 64 bytes for sizes higher than 4GB
|
||||
char isdir; // 0 - file, 1 - directory
|
||||
|
@ -38,8 +38,7 @@ extern void HaltGui();
|
||||
/****************************************************************************
|
||||
* 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
|
||||
mainWindow->SetState(STATE_DISABLED);
|
||||
ResumeGui();
|
||||
@ -197,8 +196,7 @@ int showGameInfo(char *ID)
|
||||
char linebuf2[100] = "";
|
||||
|
||||
// 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)
|
||||
classiccontroller=1;
|
||||
if (strcmp(gameinfo.accessoriesReq[i],"nunchuk")==0)
|
||||
@ -253,8 +251,7 @@ int showGameInfo(char *ID)
|
||||
else dancepadImgData = new GuiImageData(dancepad_png);
|
||||
|
||||
// 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)
|
||||
classiccontroller=1;
|
||||
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)) {
|
||||
wifiplayersImgData = new GuiImageData(wifi1_png);
|
||||
if (atoi(gameinfo.wifiplayers)>1) {
|
||||
wifiplayersImgData= new GuiImageData(wifi2_png);}
|
||||
wifiplayersImgData= new GuiImageData(wifi2_png);
|
||||
}
|
||||
if (atoi(gameinfo.wifiplayers)>2) {
|
||||
wifiplayersImgData= new GuiImageData(wifi4_png);}
|
||||
wifiplayersImgData= new GuiImageData(wifi4_png);
|
||||
}
|
||||
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
|
||||
wifiplayersImgData= new GuiImageData(wifi12_png);}
|
||||
if (atoi(gameinfo.wifiplayers)>12){
|
||||
@ -451,7 +451,9 @@ int showGameInfo(char *ID)
|
||||
ratingImgData = new GuiImageData(esrb_m_png);
|
||||
else if (strcmp(gameinfo.ratingvalueESRB,"AO")==0)
|
||||
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
|
||||
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))
|
||||
@ -464,9 +466,10 @@ int showGameInfo(char *ID)
|
||||
ratingImgData = new GuiImageData(pegi_16_png);
|
||||
else if (strcmp(gameinfo.ratingvaluePEGI,"18")==0)
|
||||
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)
|
||||
ratingImgData = new GuiImageData(cero_a_png);
|
||||
else if (strcmp(gameinfo.ratingvalueCERO,"B")==0)
|
||||
@ -477,10 +480,14 @@ int showGameInfo(char *ID)
|
||||
ratingImgData = new GuiImageData(cero_d_png);
|
||||
else if (strcmp(gameinfo.ratingvalueCERO,"Z")==0)
|
||||
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->SetWidescreen(CFG.widescreen);
|
||||
ratingImg->SetPosition(-25 , inputY);
|
||||
@ -495,7 +502,8 @@ int showGameInfo(char *ID)
|
||||
strlcpy(meminfotxt,MemInfo(),sizeof(meminfotxt));
|
||||
snprintf(linebuf, sizeof(linebuf), "%s",meminfotxt);
|
||||
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);
|
||||
}
|
||||
|
||||
@ -506,17 +514,18 @@ int showGameInfo(char *ID)
|
||||
titleTxt = new GuiText(linebuf, titlefontsize, (GXColor) {0,0,0, 255});
|
||||
titleTxt->SetMaxWidth(350, GuiText::SCROLL);
|
||||
//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);
|
||||
}
|
||||
|
||||
//date
|
||||
snprintf(linebuf2, sizeof(linebuf2), " ");
|
||||
if (strcmp(gameinfo.day,"") != 0)
|
||||
{snprintf(linebuf2, sizeof(linebuf2), "%s ", gameinfo.day);}
|
||||
if (strcmp(gameinfo.day,"") != 0) {
|
||||
snprintf(linebuf2, sizeof(linebuf2), "%s ", gameinfo.day);
|
||||
}
|
||||
if (strcmp(gameinfo.month,"") != 0) {
|
||||
switch (atoi(gameinfo.month))
|
||||
{
|
||||
switch (atoi(gameinfo.month)) {
|
||||
case 1:
|
||||
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr("Jan"));
|
||||
break;
|
||||
@ -559,7 +568,10 @@ int showGameInfo(char *ID)
|
||||
snprintf(linebuf, sizeof(linebuf), "%s : %s%s", tr("Released"), linebuf2, gameinfo.year);
|
||||
releasedTxt = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
||||
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);
|
||||
}
|
||||
|
||||
@ -569,7 +581,10 @@ int showGameInfo(char *ID)
|
||||
publisherTxt = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
||||
if (publisherTxt->GetWidth()>250) newline=2;
|
||||
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);
|
||||
}
|
||||
|
||||
@ -579,38 +594,44 @@ int showGameInfo(char *ID)
|
||||
developerTxt = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
||||
if (developerTxt->GetWidth()>250) newline=2;
|
||||
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);
|
||||
}
|
||||
|
||||
//genre
|
||||
int genreY = marginY;
|
||||
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]);
|
||||
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]);
|
||||
}
|
||||
|
||||
//online
|
||||
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) {
|
||||
snprintf(linebuf, sizeof(linebuf), "Nintendo DS");
|
||||
} else {
|
||||
snprintf(linebuf, sizeof(linebuf), "%s",gameinfo.wififeatures[i]);
|
||||
}
|
||||
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]);
|
||||
}
|
||||
if (strcmp(gameinfo.wififeatures[1],"") != 0) {
|
||||
snprintf(linebuf, sizeof(linebuf), "%s:",tr("WiFi Features"));
|
||||
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]);
|
||||
}
|
||||
|
||||
@ -620,7 +641,8 @@ int showGameInfo(char *ID)
|
||||
snprintf(linebuf, sizeof(linebuf), "%s", gameinfo.synopsis);
|
||||
synopsisTxt = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
||||
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->SetFirstLine(12);
|
||||
|
||||
@ -658,11 +680,13 @@ int showGameInfo(char *ID)
|
||||
//don't bother us txt
|
||||
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->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); betaTxt->SetPosition(-17,-20);
|
||||
betaTxt->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
||||
betaTxt->SetPosition(-17,-20);
|
||||
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"));
|
||||
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.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 100);
|
||||
@ -672,25 +696,21 @@ int showGameInfo(char *ID)
|
||||
mainWindow->ChangeFocus(&gameinfoWindow);
|
||||
ResumeGui();
|
||||
|
||||
while(choice == -1)
|
||||
{
|
||||
while (choice == -1) {
|
||||
|
||||
VIDEO_WaitVSync();
|
||||
if(shutdown == 1)
|
||||
{
|
||||
if (shutdown == 1) {
|
||||
wiilight(0);
|
||||
Sys_Shutdown();
|
||||
}
|
||||
else if(reset == 1)
|
||||
} else if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
else if ((backBtn.GetState()==STATE_CLICKED)||(backBtn.GetState()==STATE_HELD)) {
|
||||
if(page==1)
|
||||
{choice=1;
|
||||
if (page==1) {
|
||||
choice=1;
|
||||
synopsisTxt = NULL;
|
||||
break;}
|
||||
else if (page==2)
|
||||
{
|
||||
break;
|
||||
} else if (page==2) {
|
||||
HaltGui();
|
||||
gameinfoWindow2.SetVisible(false);
|
||||
gameinfoWindow.SetVisible(true);
|
||||
@ -698,8 +718,7 @@ int showGameInfo(char *ID)
|
||||
ResumeGui();
|
||||
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)) {
|
||||
|
||||
if (page==1) {
|
||||
@ -716,8 +735,7 @@ int showGameInfo(char *ID)
|
||||
mainWindow->Append(&gameinfoWindow2);
|
||||
ResumeGui();
|
||||
page=2;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
nextBtn.ResetState();
|
||||
HaltGui();
|
||||
//backBtn.SetClickable(true);
|
||||
@ -732,20 +750,16 @@ int showGameInfo(char *ID)
|
||||
}
|
||||
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;
|
||||
if (synopsisTxt->GetFirstLine()>1)
|
||||
synopsisTxt->SetFirstLine(synopsisTxt->GetFirstLine()-1);
|
||||
usleep(60000);
|
||||
if (!((ButtonsHold() & WPAD_BUTTON_UP)||(ButtonsHold() & PAD_BUTTON_UP)))
|
||||
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->GetFirstLine()-1<synopsisTxt->GetTotalLines()-pagesize)
|
||||
{
|
||||
&&synopsisTxt->GetFirstLine()-1<synopsisTxt->GetTotalLines()-pagesize) {
|
||||
int l=0;
|
||||
//if(synopsisTxt->GetTotalLines()>pagesize)
|
||||
l=synopsisTxt->GetFirstLine()+1;
|
||||
@ -757,15 +771,12 @@ int showGameInfo(char *ID)
|
||||
usleep(60000);
|
||||
if (!((ButtonsHold() & WPAD_BUTTON_DOWN)||(ButtonsHold() & PAD_BUTTON_DOWN)))
|
||||
dnBtn.ResetState();
|
||||
}
|
||||
else if (homeBtn.GetState()==STATE_CLICKED)
|
||||
{
|
||||
if(page==1)
|
||||
{choice=2;
|
||||
} else if (homeBtn.GetState()==STATE_CLICKED) {
|
||||
if (page==1) {
|
||||
choice=2;
|
||||
synopsisTxt = NULL;
|
||||
break;}
|
||||
else if (page==2)
|
||||
{
|
||||
break;
|
||||
} else if (page==2) {
|
||||
HaltGui();
|
||||
gameinfoWindow2.SetVisible(false);
|
||||
gameinfoWindow.SetVisible(true);
|
||||
@ -776,11 +787,8 @@ int showGameInfo(char *ID)
|
||||
ResumeGui();
|
||||
page=1;
|
||||
}
|
||||
}
|
||||
else if (urlBtn.GetState()==STATE_CLICKED)
|
||||
{
|
||||
if (save_XML_URL())
|
||||
{
|
||||
} else if (urlBtn.GetState()==STATE_CLICKED) {
|
||||
if (save_XML_URL()) {
|
||||
snprintf(linebuf, sizeof(linebuf), tr("Your URL has been saved in %sWiiTDB_URL.txt."), Settings.update_path);
|
||||
betaTxt->SetText(linebuf);
|
||||
gameinfoWindow.Append(betaTxt);
|
||||
@ -846,14 +854,12 @@ int showGameInfo(char *ID)
|
||||
delete beta1Txt;
|
||||
delete memTxt;
|
||||
if (gameinfo.genreCnt>0) {
|
||||
for(int i=1;i<=gameinfo.genreCnt;i++)
|
||||
{
|
||||
for (int i=1;i<=gameinfo.genreCnt;i++) {
|
||||
delete genreTxt[i];
|
||||
}
|
||||
}
|
||||
if (gameinfo.wifiCnt>0) {
|
||||
for(int i=0;i<=gameinfo.wifiCnt;i++)
|
||||
{
|
||||
for (int i=0;i<=gameinfo.wifiCnt;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];
|
||||
sprintf(tmp, "%s", Settings.update_path);
|
||||
struct stat st;
|
||||
|
@ -1,20 +1,17 @@
|
||||
#include <string.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));
|
||||
}
|
||||
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) );
|
||||
}
|
||||
static inline void u16_to_u8array (u8* item, int offset, u16 value)
|
||||
{
|
||||
item[offset] = (u8) value; item[offset + 1] = (u8)(value >> 8);
|
||||
static inline void u16_to_u8array (u8* item, int offset, u16 value) {
|
||||
item[offset] = (u8) value;
|
||||
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 + 1] = (u8)(value >> 8);
|
||||
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:
|
||||
padding(u32 Start, u32 NumSectors)
|
||||
{
|
||||
padding(u32 Start, u32 NumSectors) {
|
||||
start = Start;
|
||||
end = Start + NumSectors;
|
||||
data = new u8[NumSectors*512];
|
||||
next = 0;
|
||||
}
|
||||
~padding() { delete [] data;}
|
||||
~padding() {
|
||||
delete [] data;
|
||||
}
|
||||
|
||||
u32 start;
|
||||
u32 end;
|
||||
@ -44,15 +41,13 @@ static u32 __ramdisk_sectorsOfPadding;
|
||||
static padding *__ramdisk_data_start;
|
||||
static padding *__ramdisk_data_end;
|
||||
|
||||
static bool __ramdisk_IsInserted(void)
|
||||
{
|
||||
static bool __ramdisk_IsInserted(void) {
|
||||
return __ramdisk_data_start!=NULL;
|
||||
}
|
||||
//forward decleration
|
||||
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 (Size > 16*1024*1024) Size = 16*1024*1024; // maximum 16 MB
|
||||
@ -97,30 +92,24 @@ error:
|
||||
|
||||
}
|
||||
|
||||
void exitRAMDisc()
|
||||
{
|
||||
while(__ramdisk_data_start)
|
||||
{
|
||||
void exitRAMDisc() {
|
||||
while (__ramdisk_data_start) {
|
||||
padding *tmp = __ramdisk_data_start;
|
||||
__ramdisk_data_start = __ramdisk_data_start->next;
|
||||
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;
|
||||
for(padding *tmp = __ramdisk_data_start; tmp; tmp=tmp->next)
|
||||
{
|
||||
if(tmp->start <= Sector && tmp->end >= Sector)
|
||||
{
|
||||
for (padding *tmp = __ramdisk_data_start; tmp; tmp=tmp->next) {
|
||||
if (tmp->start <= Sector && tmp->end >= Sector) {
|
||||
if (Sectors) *Sectors = 1+tmp->end-Sector;
|
||||
return &(tmp->data[(Sector-tmp->start)*512]);
|
||||
}
|
||||
}
|
||||
// not found -> add padding
|
||||
__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;
|
||||
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 __ramdisk_Startup(void)
|
||||
{
|
||||
if(!__ramdisk_IsInserted())
|
||||
{
|
||||
static bool __ramdisk_Startup(void) {
|
||||
if (!__ramdisk_IsInserted()) {
|
||||
// Std=8MB/64kB Padding
|
||||
return (__ImplizitInit = initRAMDisc(8*1024*1024, 64 * 1024));
|
||||
}
|
||||
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;
|
||||
while(numSectors)
|
||||
{
|
||||
if(u8 *buff = __ramdisk_findSector(Sector,&num_sectors))
|
||||
{
|
||||
while (numSectors) {
|
||||
if (u8 *buff = __ramdisk_findSector(Sector,&num_sectors)) {
|
||||
if (num_sectors > numSectors) num_sectors = numSectors;
|
||||
memcpy(Buffer, buff, num_sectors * 512);
|
||||
numSectors -= num_sectors;
|
||||
Buffer+= num_sectors;
|
||||
}
|
||||
else
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
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;
|
||||
while(numSectors)
|
||||
{
|
||||
if(u8 *buff = __ramdisk_findSector(Sector,&num_sectors))
|
||||
{
|
||||
while (numSectors) {
|
||||
if (u8 *buff = __ramdisk_findSector(Sector,&num_sectors)) {
|
||||
if (num_sectors > numSectors) num_sectors = numSectors;
|
||||
memcpy(buff, Buffer, num_sectors * 512);
|
||||
numSectors -= num_sectors;
|
||||
Buffer+= num_sectors;
|
||||
}
|
||||
else
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
static bool __ramdisk_ClearStatus(void)
|
||||
{
|
||||
static bool __ramdisk_ClearStatus(void) {
|
||||
return true;
|
||||
}
|
||||
static bool __ramdisk_Shutdown(void)
|
||||
{
|
||||
if(__ImplizitInit)
|
||||
{
|
||||
static bool __ramdisk_Shutdown(void) {
|
||||
if (__ImplizitInit) {
|
||||
__ImplizitInit = false;
|
||||
exitRAMDisc();
|
||||
}
|
||||
|
@ -35,8 +35,7 @@ extern u8 reset;
|
||||
/****************************************************************************
|
||||
* MenuSettings
|
||||
***************************************************************************/
|
||||
int MenuSettings()
|
||||
{
|
||||
int MenuSettings() {
|
||||
int menu = MENU_NONE;
|
||||
int ret;
|
||||
int choice = 0;
|
||||
@ -243,14 +242,12 @@ int MenuSettings()
|
||||
GuiWindow w(screenwidth, screenheight);
|
||||
|
||||
int pageToDisplay = 1;
|
||||
while ( pageToDisplay > 0) //set pageToDisplay to 0 to quit
|
||||
{
|
||||
while ( pageToDisplay > 0) { //set pageToDisplay to 0 to quit
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
menu = MENU_NONE;
|
||||
|
||||
if ( pageToDisplay == 1)
|
||||
{
|
||||
if ( pageToDisplay == 1) {
|
||||
/** Standard procedure made in all pages **/
|
||||
MainButton1.StopEffect();
|
||||
MainButton2.StopEffect();
|
||||
@ -263,8 +260,7 @@ int MenuSettings()
|
||||
MainButton3.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 35);
|
||||
MainButton4.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 35);
|
||||
while (MainButton1.GetEffect()>0) usleep(50);
|
||||
}
|
||||
else if(slidedirection == LEFT) {
|
||||
} else if (slidedirection == LEFT) {
|
||||
MainButton1.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);
|
||||
@ -327,14 +323,12 @@ int MenuSettings()
|
||||
MainButton2.SetEffect(EFFECT_FADE, 20);
|
||||
MainButton3.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);
|
||||
MainButton2.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);
|
||||
}
|
||||
else if(slidedirection == RIGHT) {
|
||||
} else if (slidedirection == RIGHT) {
|
||||
MainButton1.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);
|
||||
@ -347,9 +341,7 @@ int MenuSettings()
|
||||
|
||||
while (MainButton1.GetEffect() > 0) usleep(50);
|
||||
|
||||
}
|
||||
else if ( pageToDisplay == 2 )
|
||||
{
|
||||
} else if ( pageToDisplay == 2 ) {
|
||||
/** Standard procedure made in all pages **/
|
||||
MainButton1.StopEffect();
|
||||
MainButton2.StopEffect();
|
||||
@ -362,8 +354,7 @@ int MenuSettings()
|
||||
MainButton3.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 35);
|
||||
MainButton4.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 35);
|
||||
while (MainButton1.GetEffect()>0) usleep(50);
|
||||
}
|
||||
else if(slidedirection == LEFT) {
|
||||
} else if (slidedirection == LEFT) {
|
||||
MainButton1.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);
|
||||
@ -426,14 +417,12 @@ int MenuSettings()
|
||||
MainButton2.SetEffect(EFFECT_FADE, 20);
|
||||
MainButton3.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);
|
||||
MainButton2.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);
|
||||
}
|
||||
else if(slidedirection == RIGHT) {
|
||||
} else if (slidedirection == RIGHT) {
|
||||
MainButton1.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);
|
||||
@ -448,12 +437,10 @@ int MenuSettings()
|
||||
|
||||
}
|
||||
|
||||
while(menu == MENU_NONE)
|
||||
{
|
||||
while (menu == MENU_NONE) {
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
if ( pageToDisplay == 1 )
|
||||
{
|
||||
if ( pageToDisplay == 1 ) {
|
||||
if (MainButton1.GetState() == STATE_CLICKED) {
|
||||
MainButton1.SetEffect(EFFECT_FADE, -20);
|
||||
MainButton2.SetEffect(EFFECT_FADE, -20);
|
||||
@ -498,8 +485,7 @@ int MenuSettings()
|
||||
char * languagefile;
|
||||
languagefile = strrchr(Settings.language_path, '/')+1;
|
||||
|
||||
while(!exit)
|
||||
{
|
||||
while (!exit) {
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
returnhere = 1;
|
||||
@ -577,8 +563,7 @@ int MenuSettings()
|
||||
else if (Settings.screensaver == 5) options2.SetValue(11,tr("30 min"));
|
||||
else if (Settings.screensaver == 6) options2.SetValue(11,tr("1 hour"));
|
||||
|
||||
if(backBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
if (backBtn.GetState() == STATE_CLICKED) {
|
||||
backBtn.ResetState();
|
||||
exit = true;
|
||||
break;
|
||||
@ -595,16 +580,13 @@ int MenuSettings()
|
||||
WindowCredits();
|
||||
w.Append(&optionBrowser2);
|
||||
w.Append(&backBtn);
|
||||
}
|
||||
else if(homo.GetState() == STATE_CLICKED)
|
||||
{
|
||||
} else if (homo.GetState() == STATE_CLICKED) {
|
||||
cfg_save_global();
|
||||
optionBrowser2.SetState(STATE_DISABLED);
|
||||
s32 thetimeofbg = bgMusic->GetPlayTime();
|
||||
bgMusic->Stop();
|
||||
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();
|
||||
} else {
|
||||
bgMusic->PlayOggFile(Settings.ogg_path);
|
||||
@ -623,13 +605,11 @@ int MenuSettings()
|
||||
|
||||
ret = optionBrowser2.GetClickedOption();
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
switch (ret) {
|
||||
case 0:
|
||||
//if(isSdInserted()) {
|
||||
if (isInserted(bootDevice)) {
|
||||
if ( Settings.godmode == 1)
|
||||
{
|
||||
if ( Settings.godmode == 1) {
|
||||
w.SetEffect(EFFECT_FADE, -20);
|
||||
while (w.GetEffect()>0) usleep(50);
|
||||
mainWindow->Remove(&w);
|
||||
@ -738,8 +718,7 @@ int MenuSettings()
|
||||
optionBrowser2.SetEffect(EFFECT_FADE, 20);
|
||||
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
||||
|
||||
while(!exit)
|
||||
{
|
||||
while (!exit) {
|
||||
VIDEO_WaitVSync ();
|
||||
if (Settings.video >= settings_video_max)
|
||||
Settings.video = 0;
|
||||
@ -797,8 +776,7 @@ int MenuSettings()
|
||||
else if (Settings.error002 == yes) options2.SetValue(7,"%s",tr("Yes"));
|
||||
else if (Settings.error002 == anti) options2.SetValue(7,"%s",tr("Anti"));
|
||||
|
||||
if(backBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
if (backBtn.GetState() == STATE_CLICKED) {
|
||||
backBtn.ResetState();
|
||||
exit = true;
|
||||
break;
|
||||
@ -809,15 +787,13 @@ int MenuSettings()
|
||||
else if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
else if(homo.GetState() == STATE_CLICKED)
|
||||
{
|
||||
else if (homo.GetState() == STATE_CLICKED) {
|
||||
cfg_save_global();
|
||||
optionBrowser2.SetState(STATE_DISABLED);
|
||||
s32 thetimeofbg = bgMusic->GetPlayTime();
|
||||
bgMusic->Stop();
|
||||
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();
|
||||
} else {
|
||||
bgMusic->PlayOggFile(Settings.ogg_path);
|
||||
@ -836,8 +812,7 @@ int MenuSettings()
|
||||
|
||||
ret = optionBrowser2.GetClickedOption();
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
switch (ret) {
|
||||
case 0:
|
||||
Settings.video++;
|
||||
break;
|
||||
@ -905,8 +880,7 @@ int MenuSettings()
|
||||
optionBrowser2.SetEffect(EFFECT_FADE, 20);
|
||||
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
||||
|
||||
while(!exit)
|
||||
{
|
||||
while (!exit) {
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
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 == 4) options2.SetValue(2, tr("4 (Adults Only 18+)"));
|
||||
|
||||
if(backBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
if (backBtn.GetState() == STATE_CLICKED) {
|
||||
backBtn.ResetState();
|
||||
exit = true;
|
||||
break;
|
||||
@ -938,15 +911,13 @@ int MenuSettings()
|
||||
else if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
else if(homo.GetState() == STATE_CLICKED)
|
||||
{
|
||||
else if (homo.GetState() == STATE_CLICKED) {
|
||||
cfg_save_global();
|
||||
optionBrowser2.SetState(STATE_DISABLED);
|
||||
s32 thetimeofbg = bgMusic->GetPlayTime();
|
||||
bgMusic->Stop();
|
||||
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();
|
||||
} else {
|
||||
bgMusic->PlayOggFile(Settings.ogg_path);
|
||||
@ -965,15 +936,12 @@ int MenuSettings()
|
||||
|
||||
ret = optionBrowser2.GetClickedOption();
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
switch (ret) {
|
||||
case 0:
|
||||
if (!strcmp("", Settings.unlockCode))
|
||||
{
|
||||
if (!strcmp("", Settings.unlockCode)) {
|
||||
Settings.godmode = !Settings.godmode;
|
||||
break;
|
||||
}
|
||||
else if ( Settings.godmode == 0 ) {
|
||||
} else if ( Settings.godmode == 0 ) {
|
||||
//password check to unlock Install,Delete and Format
|
||||
w.Remove(&optionBrowser2);
|
||||
w.Remove(&backBtn);
|
||||
@ -982,8 +950,7 @@ int MenuSettings()
|
||||
w.Append(&optionBrowser2);
|
||||
w.Append(&backBtn);
|
||||
if ( result == 1 ) {
|
||||
if (!strcmp(entered, Settings.unlockCode)) //if password correct
|
||||
{
|
||||
if (!strcmp(entered, Settings.unlockCode)) { //if password correct
|
||||
if (Settings.godmode == 0) {
|
||||
WindowPrompt(tr("Correct Password"),tr("All the features of USB Loader GX are unlocked."),tr("OK"));
|
||||
Settings.godmode = 1;
|
||||
@ -1005,8 +972,7 @@ int MenuSettings()
|
||||
}
|
||||
break;
|
||||
case 1:// Modify Password
|
||||
if ( Settings.godmode == 1)
|
||||
{
|
||||
if ( Settings.godmode == 1) {
|
||||
w.Remove(&optionBrowser2);
|
||||
w.Remove(&backBtn);
|
||||
char entered[20] = "";
|
||||
@ -1070,8 +1036,7 @@ int MenuSettings()
|
||||
|
||||
char * oggfile;
|
||||
|
||||
while(!exit)
|
||||
{
|
||||
while (!exit) {
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
bool returnhere = true;
|
||||
@ -1092,8 +1057,7 @@ int MenuSettings()
|
||||
else
|
||||
options2.SetValue(2,"%s", tr("OFF"));
|
||||
|
||||
if(backBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
if (backBtn.GetState() == STATE_CLICKED) {
|
||||
backBtn.ResetState();
|
||||
exit = true;
|
||||
break;
|
||||
@ -1104,15 +1068,13 @@ int MenuSettings()
|
||||
else if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
else if(homo.GetState() == STATE_CLICKED)
|
||||
{
|
||||
else if (homo.GetState() == STATE_CLICKED) {
|
||||
cfg_save_global();
|
||||
optionBrowser2.SetState(STATE_DISABLED);
|
||||
s32 thetimeofbg = bgMusic->GetPlayTime();
|
||||
bgMusic->Stop();
|
||||
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();
|
||||
} else {
|
||||
bgMusic->PlayOggFile(Settings.ogg_path);
|
||||
@ -1131,12 +1093,10 @@ int MenuSettings()
|
||||
|
||||
ret = optionBrowser2.GetClickedOption();
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
switch (ret) {
|
||||
case 0:
|
||||
//if(isSdInserted())
|
||||
if(isInserted(bootDevice))
|
||||
{
|
||||
if (isInserted(bootDevice)) {
|
||||
w.SetEffect(EFFECT_FADE, -20);
|
||||
while (w.GetEffect()>0) usleep(50);
|
||||
mainWindow->Remove(&w);
|
||||
@ -1147,8 +1107,7 @@ int MenuSettings()
|
||||
w.SetEffect(EFFECT_FADE, 20);
|
||||
ResumeGui();
|
||||
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"));
|
||||
break;
|
||||
case 1:
|
||||
@ -1177,8 +1136,7 @@ int MenuSettings()
|
||||
}
|
||||
}
|
||||
|
||||
if ( pageToDisplay == 2)
|
||||
{
|
||||
if ( pageToDisplay == 2) {
|
||||
if (MainButton1.GetState() == STATE_CLICKED) {
|
||||
MainButton1.SetEffect(EFFECT_FADE, -20);
|
||||
MainButton2.SetEffect(EFFECT_FADE, -20);
|
||||
@ -1218,8 +1176,7 @@ int MenuSettings()
|
||||
|
||||
if (Settings.godmode) {
|
||||
|
||||
while(!exit)
|
||||
{
|
||||
while (!exit) {
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
options2.SetValue(0, "%s", Settings.covers_path);
|
||||
@ -1232,8 +1189,7 @@ int MenuSettings()
|
||||
options2.SetValue(7, "%s", Settings.dolpath);
|
||||
options2.SetValue(8, "%s", Settings.homebrewapps_path);
|
||||
|
||||
if(backBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
if (backBtn.GetState() == STATE_CLICKED) {
|
||||
backBtn.ResetState();
|
||||
exit = true;
|
||||
break;
|
||||
@ -1244,15 +1200,13 @@ int MenuSettings()
|
||||
else if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
else if(homo.GetState() == STATE_CLICKED)
|
||||
{
|
||||
else if (homo.GetState() == STATE_CLICKED) {
|
||||
cfg_save_global();
|
||||
optionBrowser2.SetState(STATE_DISABLED);
|
||||
s32 thetimeofbg = bgMusic->GetPlayTime();
|
||||
bgMusic->Stop();
|
||||
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();
|
||||
} else {
|
||||
bgMusic->PlayOggFile(Settings.ogg_path);
|
||||
@ -1271,11 +1225,9 @@ int MenuSettings()
|
||||
|
||||
ret = optionBrowser2.GetClickedOption();
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
switch (ret) {
|
||||
case 0:
|
||||
if ( Settings.godmode == 1)
|
||||
{
|
||||
if ( Settings.godmode == 1) {
|
||||
w.Remove(&optionBrowser2);
|
||||
w.Remove(&backBtn);
|
||||
char entered[43] = "";
|
||||
@ -1286,8 +1238,7 @@ int MenuSettings()
|
||||
titleTxt.SetText(tr("Custom Paths"));
|
||||
w.Append(&optionBrowser2);
|
||||
w.Append(&backBtn);
|
||||
if ( result == 1 )
|
||||
{
|
||||
if ( result == 1 ) {
|
||||
int len = (strlen(entered)-1);
|
||||
if (entered[len] !='/')
|
||||
strncat (entered, "/", 1);
|
||||
@ -1303,8 +1254,7 @@ int MenuSettings()
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if ( Settings.godmode == 1)
|
||||
{
|
||||
if ( Settings.godmode == 1) {
|
||||
w.Remove(&optionBrowser2);
|
||||
w.Remove(&backBtn);
|
||||
char entered[43] = "";
|
||||
@ -1315,8 +1265,7 @@ int MenuSettings()
|
||||
titleTxt.SetText(tr("Custom Paths"));
|
||||
w.Append(&optionBrowser2);
|
||||
w.Append(&backBtn);
|
||||
if ( result == 1 )
|
||||
{
|
||||
if ( result == 1 ) {
|
||||
int len = (strlen(entered)-1);
|
||||
if (entered[len] !='/')
|
||||
strncat (entered, "/", 1);
|
||||
@ -1332,8 +1281,7 @@ int MenuSettings()
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if ( Settings.godmode == 1)
|
||||
{
|
||||
if ( Settings.godmode == 1) {
|
||||
w.Remove(&optionBrowser2);
|
||||
w.Remove(&backBtn);
|
||||
char entered[43] = "";
|
||||
@ -1343,8 +1291,7 @@ int MenuSettings()
|
||||
//int result = OnScreenKeyboard(entered, 43,0);
|
||||
HaltGui();
|
||||
w.RemoveAll();
|
||||
if ( result == 1 )
|
||||
{
|
||||
if ( result == 1 ) {
|
||||
int len = (strlen(entered)-1);
|
||||
if (entered[len] !='/')
|
||||
strncat (entered, "/", 1);
|
||||
@ -1392,8 +1339,7 @@ int MenuSettings()
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if ( Settings.godmode == 1)
|
||||
{
|
||||
if ( Settings.godmode == 1) {
|
||||
w.Remove(&optionBrowser2);
|
||||
w.Remove(&backBtn);
|
||||
char entered[43] = "";
|
||||
@ -1404,8 +1350,7 @@ int MenuSettings()
|
||||
w.Append(&optionBrowser2);
|
||||
titleTxt.SetText(tr("Custom Paths"));
|
||||
w.Append(&backBtn);
|
||||
if ( result == 1 )
|
||||
{
|
||||
if ( result == 1 ) {
|
||||
int len = (strlen(entered)-1);
|
||||
if (entered[len] !='/')
|
||||
strncat (entered, "/", 1);
|
||||
@ -1419,15 +1364,12 @@ int MenuSettings()
|
||||
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"));
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if ( Settings.godmode == 1)
|
||||
{
|
||||
if ( Settings.godmode == 1) {
|
||||
w.Remove(&optionBrowser2);
|
||||
w.Remove(&backBtn);
|
||||
char entered[43] = "";
|
||||
@ -1438,21 +1380,18 @@ int MenuSettings()
|
||||
titleTxt.SetText(tr("Custom Paths"));
|
||||
w.Append(&optionBrowser2);
|
||||
w.Append(&backBtn);
|
||||
if ( result == 1 )
|
||||
{
|
||||
if ( result == 1 ) {
|
||||
int len = (strlen(entered)-1);
|
||||
if (entered[len] !='/')
|
||||
strncat (entered, "/", 1);
|
||||
strncpy(Settings.update_path, entered, sizeof(Settings.update_path));
|
||||
WindowPrompt(tr("Updatepath changed."),0,tr("OK"));
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
WindowPrompt(0,tr("Console should be unlocked to modify it."),tr("OK"));
|
||||
break;
|
||||
case 5:
|
||||
if ( Settings.godmode == 1)
|
||||
{
|
||||
if ( Settings.godmode == 1) {
|
||||
w.Remove(&optionBrowser2);
|
||||
w.Remove(&backBtn);
|
||||
char entered[43] = "";
|
||||
@ -1463,21 +1402,18 @@ int MenuSettings()
|
||||
titleTxt.SetText(tr("Custom Paths"));
|
||||
w.Append(&optionBrowser2);
|
||||
w.Append(&backBtn);
|
||||
if ( result == 1 )
|
||||
{
|
||||
if ( result == 1 ) {
|
||||
int len = (strlen(entered)-1);
|
||||
if (entered[len] !='/')
|
||||
strncat (entered, "/", 1);
|
||||
strncpy(Settings.Cheatcodespath, entered, sizeof(Settings.Cheatcodespath));
|
||||
WindowPrompt(tr("Cheatcodes Path changed"),0,tr("OK"));
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
WindowPrompt(0,tr("Console should be unlocked to modify it."),tr("OK"));
|
||||
break;
|
||||
case 6:
|
||||
if ( Settings.godmode == 1)
|
||||
{
|
||||
if ( Settings.godmode == 1) {
|
||||
w.Remove(&optionBrowser2);
|
||||
w.Remove(&backBtn);
|
||||
char entered[43] = "";
|
||||
@ -1488,21 +1424,18 @@ int MenuSettings()
|
||||
titleTxt.SetText(tr("Custom Paths"));
|
||||
w.Append(&optionBrowser2);
|
||||
w.Append(&backBtn);
|
||||
if ( result == 1 )
|
||||
{
|
||||
if ( result == 1 ) {
|
||||
int len = (strlen(entered)-1);
|
||||
if (entered[len] !='/')
|
||||
strncat (entered, "/", 1);
|
||||
strncpy(Settings.TxtCheatcodespath, entered, sizeof(Settings.TxtCheatcodespath));
|
||||
WindowPrompt(tr("TXTCheatcodes Path changed"),0,tr("OK"));
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
WindowPrompt(0,tr("Console should be unlocked to modify it."),tr("OK"));
|
||||
break;
|
||||
case 7:
|
||||
if ( Settings.godmode == 1)
|
||||
{
|
||||
if ( Settings.godmode == 1) {
|
||||
w.Remove(&optionBrowser2);
|
||||
w.Remove(&backBtn);
|
||||
char entered[43] = "";
|
||||
@ -1513,8 +1446,7 @@ int MenuSettings()
|
||||
titleTxt.SetText(tr("Custom Paths"));
|
||||
w.Append(&optionBrowser2);
|
||||
w.Append(&backBtn);
|
||||
if ( result == 1 )
|
||||
{
|
||||
if ( result == 1 ) {
|
||||
int len = (strlen(entered)-1);
|
||||
if (entered[len] !='/')
|
||||
strncat (entered, "/", 1);
|
||||
@ -1530,8 +1462,7 @@ int MenuSettings()
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
if ( Settings.godmode == 1)
|
||||
{
|
||||
if ( Settings.godmode == 1) {
|
||||
w.Remove(&optionBrowser2);
|
||||
w.Remove(&backBtn);
|
||||
char entered[43] = "";
|
||||
@ -1542,8 +1473,7 @@ int MenuSettings()
|
||||
titleTxt.SetText(tr("Custom Paths"));
|
||||
w.Append(&optionBrowser2);
|
||||
w.Append(&backBtn);
|
||||
if ( result == 1 )
|
||||
{
|
||||
if ( result == 1 ) {
|
||||
int len = (strlen(entered)-1);
|
||||
if (entered[len] !='/')
|
||||
strncat (entered, "/", 1);
|
||||
@ -1627,8 +1557,7 @@ int MenuSettings()
|
||||
int choice = WindowPrompt(tr("Are you sure?"), 0, tr("Yes"), tr("Cancel"));
|
||||
if (choice == 1) {
|
||||
// if(isSdInserted())
|
||||
if(isInserted(bootDevice))
|
||||
{
|
||||
if (isInserted(bootDevice)) {
|
||||
char GXGlobal_cfg[26];
|
||||
sprintf(GXGlobal_cfg, "%s/config/GXGlobal.cfg", bootDevice);
|
||||
remove(GXGlobal_cfg);
|
||||
@ -1677,8 +1606,7 @@ int MenuSettings()
|
||||
if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
if(backBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
if (backBtn.GetState() == STATE_CLICKED) {
|
||||
//Add the procedure call to save the global configuration
|
||||
// if(isSdInserted()) {
|
||||
if (isInserted(bootDevice)) {
|
||||
@ -1689,8 +1617,7 @@ int MenuSettings()
|
||||
break;
|
||||
}
|
||||
|
||||
if(GoLeftBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
if (GoLeftBtn.GetState() == STATE_CLICKED) {
|
||||
pageToDisplay--;
|
||||
/** Change direction of the flying buttons **/
|
||||
if (pageToDisplay < 1)
|
||||
@ -1700,8 +1627,7 @@ int MenuSettings()
|
||||
break;
|
||||
}
|
||||
|
||||
if(GoRightBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
if (GoRightBtn.GetState() == STATE_CLICKED) {
|
||||
pageToDisplay++;
|
||||
/** Change direction of the flying buttons **/
|
||||
if (pageToDisplay > 2)
|
||||
@ -1711,8 +1637,7 @@ int MenuSettings()
|
||||
break;
|
||||
}
|
||||
|
||||
if(PageIndicatorBtn1.GetState() == STATE_CLICKED)
|
||||
{
|
||||
if (PageIndicatorBtn1.GetState() == STATE_CLICKED) {
|
||||
if (pageToDisplay == 2) {
|
||||
slidedirection = LEFT;
|
||||
pageToDisplay = 1;
|
||||
@ -1720,9 +1645,7 @@ int MenuSettings()
|
||||
break;
|
||||
}
|
||||
PageIndicatorBtn1.ResetState();
|
||||
}
|
||||
else if(PageIndicatorBtn2.GetState() == STATE_CLICKED)
|
||||
{
|
||||
} else if (PageIndicatorBtn2.GetState() == STATE_CLICKED) {
|
||||
if (pageToDisplay == 1) {
|
||||
slidedirection = RIGHT;
|
||||
pageToDisplay = 2;
|
||||
@ -1732,15 +1655,13 @@ int MenuSettings()
|
||||
PageIndicatorBtn2.ResetState();
|
||||
}
|
||||
|
||||
if(homo.GetState() == STATE_CLICKED)
|
||||
{
|
||||
if (homo.GetState() == STATE_CLICKED) {
|
||||
cfg_save_global();
|
||||
optionBrowser2.SetState(STATE_DISABLED);
|
||||
s32 thetimeofbg = bgMusic->GetPlayTime();
|
||||
bgMusic->Stop();
|
||||
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();
|
||||
} else {
|
||||
bgMusic->PlayOggFile(Settings.ogg_path);
|
||||
@ -1748,8 +1669,7 @@ int MenuSettings()
|
||||
bgMusic->SetPlayTime(thetimeofbg);
|
||||
SetVolumeOgg(255*(Settings.volume/100.0));
|
||||
|
||||
if(choice == 3)
|
||||
{
|
||||
if (choice == 3) {
|
||||
Sys_LoadMenu(); // Back to System Menu
|
||||
} else if (choice == 2) {
|
||||
Sys_BackToLoader();
|
||||
@ -1786,8 +1706,7 @@ int MenuSettings()
|
||||
/********************************************************************************
|
||||
*Game specific settings
|
||||
*********************************************************************************/
|
||||
int GameSettings(struct discHdr * header)
|
||||
{
|
||||
int GameSettings(struct discHdr * header) {
|
||||
int menu = MENU_NONE;
|
||||
int ret;
|
||||
int choice = 0;
|
||||
@ -1826,8 +1745,7 @@ int GameSettings(struct discHdr * header)
|
||||
|
||||
if (strlen(get_title(header)) < (27 + 3)) {
|
||||
sprintf(gameName, "%s", get_title(header));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
strncpy(gameName, get_title(header), 27);
|
||||
gameName[27] = '\0';
|
||||
strncat(gameName, "...", 3);
|
||||
@ -1862,7 +1780,8 @@ int GameSettings(struct discHdr * header)
|
||||
GuiImage saveBtnImg(&btnOutline);
|
||||
if (Settings.wsprompt == yes) {
|
||||
saveBtnTxt.SetWidescreen(CFG.widescreen);
|
||||
saveBtnImg.SetWidescreen(CFG.widescreen);}
|
||||
saveBtnImg.SetWidescreen(CFG.widescreen);
|
||||
}
|
||||
GuiButton saveBtn(&saveBtnImg,&saveBtnImg, 2, 3, 180, 400, &trigA, &btnSoundOver, &btnClick,1);
|
||||
saveBtn.SetLabel(&saveBtnTxt);
|
||||
|
||||
@ -1941,8 +1860,7 @@ int GameSettings(struct discHdr * header)
|
||||
struct Game_CFG* game_cfg = CFG_get_game_opt(header->id);
|
||||
|
||||
int pageToDisplay = 1;
|
||||
while ( pageToDisplay > 0) //set pageToDisplay to 0 to quit
|
||||
{
|
||||
while ( pageToDisplay > 0) { //set pageToDisplay to 0 to quit
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
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;
|
||||
languageChoice = game_cfg->language;
|
||||
ocarinaChoice = game_cfg->ocarina;
|
||||
@ -2017,9 +1934,7 @@ int GameSettings(struct discHdr * header)
|
||||
alternatedoloffset = game_cfg->alternatedolstart;
|
||||
reloadblock = game_cfg->iosreloadblock;
|
||||
strncpy(alternatedname, game_cfg->alternatedolname, sizeof(alternatedname));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
videoChoice = Settings.video;
|
||||
languageChoice = Settings.language;
|
||||
ocarinaChoice = Settings.ocarina;
|
||||
@ -2046,8 +1961,7 @@ int GameSettings(struct discHdr * header)
|
||||
|
||||
|
||||
|
||||
while(menu == MENU_NONE)
|
||||
{
|
||||
while (menu == MENU_NONE) {
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
if (MainButton1.GetState() == STATE_CLICKED) {
|
||||
@ -2090,8 +2004,7 @@ int GameSettings(struct discHdr * header)
|
||||
char * languagefile;
|
||||
languagefile = strrchr(Settings.language_path, '/')+1;
|
||||
|
||||
while(!exit)
|
||||
{
|
||||
while (!exit) {
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
returnhere = 1;
|
||||
@ -2174,8 +2087,7 @@ int GameSettings(struct discHdr * header)
|
||||
if (reloadblock == on) options2.SetValue(10,tr("ON"));
|
||||
else if (reloadblock == off) options2.SetValue(10,tr("OFF"));
|
||||
|
||||
if(backBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
if (backBtn.GetState() == STATE_CLICKED) {
|
||||
backBtn.ResetState();
|
||||
exit = true;
|
||||
break;
|
||||
@ -2192,16 +2104,13 @@ int GameSettings(struct discHdr * header)
|
||||
WindowCredits();
|
||||
w.Append(&optionBrowser2);
|
||||
w.Append(&backBtn);
|
||||
}
|
||||
else if(homo.GetState() == STATE_CLICKED)
|
||||
{
|
||||
} else if (homo.GetState() == STATE_CLICKED) {
|
||||
cfg_save_global();
|
||||
optionBrowser2.SetState(STATE_DISABLED);
|
||||
s32 thetimeofbg = bgMusic->GetPlayTime();
|
||||
bgMusic->Stop();
|
||||
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();
|
||||
} else {
|
||||
bgMusic->PlayOggFile(Settings.ogg_path);
|
||||
@ -2220,8 +2129,7 @@ int GameSettings(struct discHdr * header)
|
||||
|
||||
ret = optionBrowser2.GetClickedOption();
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
switch (ret) {
|
||||
case 0:
|
||||
videoChoice = (videoChoice + 1) % CFG_VIDEO_COUNT;
|
||||
break;
|
||||
@ -2261,18 +2169,15 @@ int GameSettings(struct discHdr * header)
|
||||
//if we do know that offset ask if they want to use it
|
||||
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"));
|
||||
if (dolchoice==1)
|
||||
{
|
||||
if (dolchoice==1) {
|
||||
alternatedoloffset = 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);
|
||||
if ((res >= 0)&&(res !=696969))//if res==6969696 they pressed the back button
|
||||
alternatedoloffset = res;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
int res = DiscBrowse(header);
|
||||
if ((res >= 0)&&(res !=696969))
|
||||
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 (CFG_save_game_opt(header->id))
|
||||
{
|
||||
if (CFG_save_game_opt(header->id)) {
|
||||
// if language has changed, reload titles
|
||||
int opt_langnew = 0;
|
||||
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
|
||||
// titles are refreshed in menu.cpp as soon as this function returns
|
||||
WindowPrompt(tr("Successfully Saved"), 0, tr("OK"));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
WindowPrompt(tr("Save Failed"), 0, tr("OK"));
|
||||
}
|
||||
} else {
|
||||
@ -2363,12 +2264,10 @@ int GameSettings(struct discHdr * header)
|
||||
optionBrowser2.SetEffect(EFFECT_FADE, 20);
|
||||
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
||||
|
||||
while(!exit)
|
||||
{
|
||||
while (!exit) {
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
if(backBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
if (backBtn.GetState() == STATE_CLICKED) {
|
||||
backBtn.ResetState();
|
||||
exit = true;
|
||||
break;
|
||||
@ -2379,15 +2278,13 @@ int GameSettings(struct discHdr * header)
|
||||
else if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
else if(homo.GetState() == STATE_CLICKED)
|
||||
{
|
||||
else if (homo.GetState() == STATE_CLICKED) {
|
||||
cfg_save_global();
|
||||
optionBrowser2.SetState(STATE_DISABLED);
|
||||
s32 thetimeofbg = bgMusic->GetPlayTime();
|
||||
bgMusic->Stop();
|
||||
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();
|
||||
} else {
|
||||
bgMusic->PlayOggFile(Settings.ogg_path);
|
||||
@ -2408,29 +2305,23 @@ int GameSettings(struct discHdr * header)
|
||||
|
||||
int choice1;
|
||||
char tmp[200];
|
||||
switch (ret)
|
||||
{
|
||||
switch (ret) {
|
||||
case 0:
|
||||
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_num(header->id);
|
||||
ret = WBFS_RemoveGame(header->id);
|
||||
if (ret < 0)
|
||||
{
|
||||
if (ret < 0) {
|
||||
WindowPrompt(
|
||||
tr("Can't delete:"),
|
||||
gameName,
|
||||
tr("OK"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
WindowPrompt(tr("Successfully deleted:"),gameName,tr("OK"));
|
||||
retVal = 1;
|
||||
}
|
||||
}
|
||||
else if (choice1 == 0)
|
||||
{
|
||||
} else if (choice1 == 0) {
|
||||
optionBrowser2.SetFocus(1);
|
||||
}
|
||||
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]);
|
||||
|
||||
choice1 = WindowPrompt(tr("Delete"),tmp,tr("Yes"),tr("No"));
|
||||
if(choice1==1)
|
||||
{
|
||||
if (choice1==1) {
|
||||
if (checkfile(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]);
|
||||
|
||||
choice1 = WindowPrompt(tr("Delete"),tmp,tr("Yes"),tr("No"));
|
||||
if(choice1==1)
|
||||
{
|
||||
if (choice1==1) {
|
||||
if (checkfile(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]);
|
||||
|
||||
choice1 = WindowPrompt(tr("Delete"),tmp,tr("Yes"),tr("No"));
|
||||
if(choice1==1)
|
||||
{
|
||||
if (choice1==1) {
|
||||
if (checkfile(tmp))
|
||||
remove(tmp);
|
||||
}
|
||||
@ -2535,22 +2423,19 @@ int GameSettings(struct discHdr * header)
|
||||
if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
if(backBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
if (backBtn.GetState() == STATE_CLICKED) {
|
||||
menu = MENU_DISCLIST;
|
||||
pageToDisplay = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if(homo.GetState() == STATE_CLICKED)
|
||||
{
|
||||
if (homo.GetState() == STATE_CLICKED) {
|
||||
cfg_save_global();
|
||||
optionBrowser2.SetState(STATE_DISABLED);
|
||||
s32 thetimeofbg = bgMusic->GetPlayTime();
|
||||
bgMusic->Stop();
|
||||
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();
|
||||
} else {
|
||||
bgMusic->PlayOggFile(Settings.ogg_path);
|
||||
@ -2558,8 +2443,7 @@ int GameSettings(struct discHdr * header)
|
||||
bgMusic->SetPlayTime(thetimeofbg);
|
||||
SetVolumeOgg(255*(Settings.volume/100.0));
|
||||
|
||||
if(choice == 3)
|
||||
{
|
||||
if (choice == 3) {
|
||||
Sys_LoadMenu(); // Back to System Menu
|
||||
} else if (choice == 2) {
|
||||
Sys_BackToLoader();
|
||||
|
@ -30,8 +30,7 @@ extern void HaltGui();
|
||||
/****************************************************************************
|
||||
* MenuOGG
|
||||
***************************************************************************/
|
||||
bool MenuOGG()
|
||||
{
|
||||
bool MenuOGG() {
|
||||
int cnt = 0;
|
||||
int ret = 0, choice = 0;
|
||||
int scrollon, nothingchanged = 0;
|
||||
@ -179,8 +178,7 @@ bool MenuOGG()
|
||||
|
||||
while (w.GetEffect()>0) usleep(50);
|
||||
|
||||
while(!returnhere)
|
||||
{
|
||||
while (!returnhere) {
|
||||
|
||||
if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
@ -318,8 +316,7 @@ bool MenuOGG()
|
||||
/****************************************************************************
|
||||
* MenuLanguageSelect
|
||||
***************************************************************************/
|
||||
int MenuLanguageSelect()
|
||||
{
|
||||
int MenuLanguageSelect() {
|
||||
int cnt = 0;
|
||||
int ret = 0, choice = 0;
|
||||
int scrollon;
|
||||
@ -454,8 +451,7 @@ int MenuLanguageSelect()
|
||||
|
||||
while (w.GetEffect()>0) usleep(50);
|
||||
|
||||
while(!returnhere)
|
||||
{
|
||||
while (!returnhere) {
|
||||
|
||||
if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
|
@ -42,14 +42,12 @@ char alternatedname[40];
|
||||
|
||||
#define TITLE_MAX 200
|
||||
|
||||
struct ID_Title
|
||||
{
|
||||
struct ID_Title {
|
||||
u8 id[5];
|
||||
char title[TITLE_MAX];
|
||||
};
|
||||
|
||||
struct ID_Control
|
||||
{
|
||||
struct ID_Control {
|
||||
u8 id[5];
|
||||
u8 block;
|
||||
};
|
||||
@ -72,14 +70,12 @@ struct Game_NUM cfg_game_num[MAX_SAVED_GAME_NUM];
|
||||
|
||||
static char *cfg_name, *cfg_val;
|
||||
|
||||
struct TextMap
|
||||
{
|
||||
struct TextMap {
|
||||
char *name;
|
||||
int id;
|
||||
};
|
||||
|
||||
struct TextMap map_video[] =
|
||||
{
|
||||
struct TextMap map_video[] = {
|
||||
{ "system", CFG_VIDEO_SYS },
|
||||
{ "game", CFG_VIDEO_GAME },
|
||||
{ "patch", CFG_VIDEO_PATCH },
|
||||
@ -89,8 +85,7 @@ struct TextMap map_video[] =
|
||||
{ NULL, -1 }
|
||||
};
|
||||
|
||||
struct TextMap map_language[] =
|
||||
{
|
||||
struct TextMap map_language[] = {
|
||||
{ "console", CFG_LANG_CONSOLE },
|
||||
{ "japanese", CFG_LANG_JAPANESE },
|
||||
{ "english", CFG_LANG_ENGLISH },
|
||||
@ -106,8 +101,7 @@ struct TextMap map_language[] =
|
||||
};
|
||||
|
||||
|
||||
struct TextMap map_alignment[] =
|
||||
{
|
||||
struct TextMap map_alignment[] = {
|
||||
{ "left", CFG_ALIGN_LEFT },
|
||||
{ "right", CFG_ALIGN_RIGHT },
|
||||
{ "center", CFG_ALIGN_CENTRE },
|
||||
@ -116,15 +110,13 @@ struct TextMap map_alignment[] =
|
||||
{ "middle", CFG_ALIGN_MIDDLE },
|
||||
{ NULL, -1 }
|
||||
};
|
||||
char* strcopy(char *dest, char *src, int size)
|
||||
{
|
||||
char* strcopy(char *dest, char *src, int size) {
|
||||
strncpy(dest,src,size);
|
||||
dest[size-1] = 0;
|
||||
return dest;
|
||||
}
|
||||
|
||||
int map_get_id(struct TextMap *map, char *name)
|
||||
{
|
||||
int map_get_id(struct TextMap *map, char *name) {
|
||||
int i;
|
||||
for (i=0; map[i].name != NULL; i++) {
|
||||
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;
|
||||
}
|
||||
|
||||
char* map_get_name(struct TextMap *map, short id)
|
||||
{
|
||||
char* map_get_name(struct TextMap *map, short id) {
|
||||
int i;
|
||||
for (i=0; map[i].name != NULL; i++) {
|
||||
if (id == map[i].id) return map[i].name;
|
||||
@ -141,8 +132,7 @@ char* map_get_name(struct TextMap *map, short id)
|
||||
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;
|
||||
int id = map_get_id(map, val);
|
||||
if (id == -1) {
|
||||
@ -154,36 +144,30 @@ bool map_auto(char *name, char *name2, char *val, struct TextMap *map, short *va
|
||||
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);
|
||||
}
|
||||
|
||||
bool cfg_map(char *name, char *val, short *var, short id)
|
||||
{
|
||||
if (strcmp(name, cfg_name)==0 && strcmpi(val, cfg_val)==0)
|
||||
{
|
||||
bool cfg_map(char *name, char *val, short *var, short id) {
|
||||
if (strcmp(name, cfg_name)==0 && strcmpi(val, cfg_val)==0) {
|
||||
*var = id;
|
||||
return true;
|
||||
}
|
||||
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));
|
||||
}
|
||||
|
||||
void cfg_int(char *name, short *var, int count)
|
||||
{
|
||||
void cfg_int(char *name, short *var, int count) {
|
||||
char tmp[5];
|
||||
short i;
|
||||
|
||||
if (count > 10) //avoid overflow
|
||||
return;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
for (i = 0; i < count; i++) {
|
||||
sprintf(tmp, "%d", 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];
|
||||
|
||||
void CFG_Default(int widescreen) // -1 = non forced Mode
|
||||
{
|
||||
void CFG_Default(int widescreen) { // -1 = non forced Mode
|
||||
if (widescreen == -1)
|
||||
CFG.widescreen = CONF_GetAspectRatio();
|
||||
else
|
||||
@ -202,14 +185,11 @@ void CFG_Default(int widescreen) // -1 = non forced Mode
|
||||
|
||||
if (CFG.widescreen) {
|
||||
snprintf(CFG.theme_path, sizeof(CFG.theme_path), "%s/wtheme/", bootDevice);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
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.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
|
||||
@ -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.vpatch = off;
|
||||
Settings.language = ConsoleLangDefault;
|
||||
@ -323,8 +302,7 @@ void Global_Default(void)
|
||||
Settings.hddinfo = hr12;
|
||||
Settings.sinfo = ((THEME.showID) ? GameID : Neither);
|
||||
Settings.rumble = RumbleOn;
|
||||
if (THEME.showRegion)
|
||||
{
|
||||
if (THEME.showRegion) {
|
||||
Settings.sinfo = ((Settings.sinfo == GameID) ? Both : GameRegion);
|
||||
}
|
||||
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;
|
||||
for (i=0; i<num_title; i++) {
|
||||
if (memcmp(id, cfg_title[i].id, 4) == 0) {
|
||||
@ -361,15 +338,13 @@ char *cfg_get_title(u8 *id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *get_title(struct discHdr *header)
|
||||
{
|
||||
char *get_title(struct discHdr *header) {
|
||||
char *title = cfg_get_title(header->id);
|
||||
if (title) return 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);
|
||||
if (idt) {
|
||||
// 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;
|
||||
for (i=0; i<num_control; i++) {
|
||||
if (memcmp(id, cfg_control[i].id, 4) == 0) {
|
||||
@ -400,18 +374,19 @@ u8 cfg_get_block(u8 *id)
|
||||
return 0;
|
||||
}
|
||||
|
||||
u8 get_block(struct discHdr *header)
|
||||
{
|
||||
u8 get_block(struct discHdr *header) {
|
||||
return cfg_get_block(header->id);
|
||||
}
|
||||
|
||||
// trim leading and trailing whitespace
|
||||
// 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;
|
||||
// trim leading white space
|
||||
while (isspace(*src)) { src++; n--; }
|
||||
while (isspace(*src)) {
|
||||
src++;
|
||||
n--;
|
||||
}
|
||||
len = strlen(src);
|
||||
if (len > n) len = n;
|
||||
// trim trailing white space
|
||||
@ -423,8 +398,7 @@ char* trim_n_copy(char *dest, char *src, int n, int size)
|
||||
return dest;
|
||||
}
|
||||
|
||||
char* trimcopy(char *dest, char *src, int size)
|
||||
{
|
||||
char* trimcopy(char *dest, char *src, int size) {
|
||||
int len;
|
||||
while (*src == ' ') src++;
|
||||
len = strlen(src);
|
||||
@ -436,8 +410,7 @@ char* trimcopy(char *dest, char *src, int size)
|
||||
return dest;
|
||||
}
|
||||
|
||||
void widescreen_set(char *name, char *val)
|
||||
{
|
||||
void widescreen_set(char *name, char *val) {
|
||||
cfg_name = name;
|
||||
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_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_val = val;
|
||||
|
||||
@ -796,8 +767,7 @@ void theme_set(char *name, char *val)
|
||||
if (sscanf(val, "%hd", &x) == 1) {
|
||||
THEME.batteryUnused = x;
|
||||
}
|
||||
}
|
||||
else if (strcmp(cfg_name, "tooltipAlpha") == 0) {
|
||||
} else if (strcmp(cfg_name, "tooltipAlpha") == 0) {
|
||||
short x;
|
||||
if (sscanf(val, "%hd", &x) == 1) {
|
||||
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_val = val;
|
||||
|
||||
@ -852,8 +821,7 @@ void global_cfg_set(char *name, char *val)
|
||||
Settings.video = i;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "vpatch") == 0) {
|
||||
} else if (strcmp(name, "vpatch") == 0) {
|
||||
int i;
|
||||
if (sscanf(val, "%d", &i) == 1) {
|
||||
Settings.vpatch =i;
|
||||
@ -867,173 +835,148 @@ void global_cfg_set(char *name, char *val)
|
||||
Settings.language = i;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "ocarina") == 0) {
|
||||
} else if (strcmp(name, "ocarina") == 0) {
|
||||
int i;
|
||||
if (sscanf(val, "%d", &i) == 1) {
|
||||
Settings.ocarina = i;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "sort") == 0) {
|
||||
} else if (strcmp(name, "sort") == 0) {
|
||||
int i;
|
||||
if (sscanf(val, "%d", &i) == 1) {
|
||||
Settings.sort = i;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "fave") == 0) {
|
||||
} else if (strcmp(name, "fave") == 0) {
|
||||
int i;
|
||||
if (sscanf(val, "%d", &i) == 1) {
|
||||
Settings.fave = i;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "keyset") == 0) {
|
||||
} else if (strcmp(name, "keyset") == 0) {
|
||||
int i;
|
||||
if (sscanf(val, "%d", &i) == 1) {
|
||||
Settings.keyset = i;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "hddinfo") == 0) {
|
||||
} else if (strcmp(name, "hddinfo") == 0) {
|
||||
int i;
|
||||
if (sscanf(val, "%d", &i) == 1) {
|
||||
Settings.hddinfo = i;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "sinfo") == 0) {
|
||||
} else if (strcmp(name, "sinfo") == 0) {
|
||||
int i;
|
||||
if (sscanf(val, "%d", &i) == 1) {
|
||||
Settings.sinfo = i;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "rumble") == 0) {
|
||||
} else if (strcmp(name, "rumble") == 0) {
|
||||
int i;
|
||||
if (sscanf(val, "%d", &i) == 1) {
|
||||
Settings.rumble = i;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "volume") == 0) {
|
||||
} else if (strcmp(name, "volume") == 0) {
|
||||
int i;
|
||||
if (sscanf(val, "%d", &i) == 1) {
|
||||
Settings.volume = i;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "sfxvolume") == 0) {
|
||||
} else if (strcmp(name, "sfxvolume") == 0) {
|
||||
int i;
|
||||
if (sscanf(val, "%d", &i) == 1) {
|
||||
Settings.sfxvolume = i;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "tooltips") == 0) {
|
||||
} else if (strcmp(name, "tooltips") == 0) {
|
||||
int i;
|
||||
if (sscanf(val, "%d", &i) == 1) {
|
||||
Settings.tooltips = i;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "password") == 0) {
|
||||
} else if (strcmp(name, "password") == 0) {
|
||||
strcopy(Settings.unlockCode, val, sizeof(Settings.unlockCode));
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "parentalcontrol") == 0) {
|
||||
} else if (strcmp(name, "parentalcontrol") == 0) {
|
||||
int i;
|
||||
if (sscanf(val, "%d", &i) == 1) {
|
||||
Settings.parentalcontrol = i;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "cios") == 0) {
|
||||
} else if (strcmp(name, "cios") == 0) {
|
||||
int i;
|
||||
if (sscanf(val, "%d", &i) == 1) {
|
||||
Settings.cios = i;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "gridRows") == 0) {
|
||||
} else if (strcmp(name, "gridRows") == 0) {
|
||||
int i;
|
||||
if (sscanf(val, "%d", &i) == 1) {
|
||||
Settings.gridRows = i;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "xflip") == 0) {
|
||||
} else if (strcmp(name, "xflip") == 0) {
|
||||
int i;
|
||||
if (sscanf(val, "%d", &i) == 1) {
|
||||
Settings.xflip = i;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "qboot") == 0) {
|
||||
} else if (strcmp(name, "qboot") == 0) {
|
||||
int i;
|
||||
if (sscanf(val, "%d", &i) == 1) {
|
||||
Settings.qboot = i;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "wsprompt") == 0) {
|
||||
} else if (strcmp(name, "wsprompt") == 0) {
|
||||
int i;
|
||||
if (sscanf(val, "%d", &i) == 1) {
|
||||
Settings.wsprompt = i;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "wiilight") == 0) {
|
||||
} else if (strcmp(name, "wiilight") == 0) {
|
||||
int i;
|
||||
if (sscanf(val, "%d", &i) == 1) {
|
||||
Settings.wiilight = i;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "autonetwork") == 0) {
|
||||
} else if (strcmp(name, "autonetwork") == 0) {
|
||||
int i;
|
||||
if (sscanf(val, "%d", &i) == 1) {
|
||||
Settings.autonetwork = i;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "patchcountrystrings") == 0) {
|
||||
} else if (strcmp(name, "patchcountrystrings") == 0) {
|
||||
int i;
|
||||
if (sscanf(val, "%d", &i) == 1) {
|
||||
Settings.patchcountrystrings = i;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "error002") == 0) {
|
||||
} else if (strcmp(name, "error002") == 0) {
|
||||
int i;
|
||||
if (sscanf(val, "%d", &i) == 1) {
|
||||
Settings.error002 = i;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "titlesOverride") == 0) {
|
||||
} else if (strcmp(name, "titlesOverride") == 0) {
|
||||
int i;
|
||||
if (sscanf(val, "%d", &i) == 1) {
|
||||
Settings.titlesOverride = i;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "db_JPtoEN") == 0) {
|
||||
} else if (strcmp(name, "db_JPtoEN") == 0) {
|
||||
int i;
|
||||
if (sscanf(val, "%d", &i) == 1) {
|
||||
Settings.db_JPtoEN = i;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "gameDisplay") == 0) {
|
||||
} else if (strcmp(name, "gameDisplay") == 0) {
|
||||
int i;
|
||||
if (sscanf(val, "%d", &i) == 1) {
|
||||
Settings.gameDisplay = i;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "screensaver") == 0) {
|
||||
} else if (strcmp(name, "screensaver") == 0) {
|
||||
int i;
|
||||
if (sscanf(val, "%d", &i) == 1) {
|
||||
Settings.screensaver = i;
|
||||
@ -1047,16 +990,14 @@ void global_cfg_set(char *name, char *val)
|
||||
}
|
||||
|
||||
// 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);
|
||||
if (!eq) return false;
|
||||
trim_n_copy(part1, line, eq-line, size);
|
||||
trimcopy(part2, eq+1, size);
|
||||
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
|
||||
char tmp[200], name[200], val[200];
|
||||
strcopy(tmp, line, sizeof(tmp));
|
||||
@ -1069,8 +1010,7 @@ void cfg_parseline(char *line, void (*set_func)(char*, char*))
|
||||
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
|
||||
char tmp[200], name[200], val[200];
|
||||
int block = 0;
|
||||
@ -1085,20 +1025,17 @@ void cfg_parsetitleline(char *line, void (*set_func)(char*, char*, u8))
|
||||
if (!blockpos)
|
||||
trimcopy(val, eq+1, sizeof(val));
|
||||
|
||||
else
|
||||
{
|
||||
else {
|
||||
*blockpos = 0;
|
||||
trimcopy(val, eq+1, sizeof(val));
|
||||
if (sscanf(blockpos+1, "%d", &block) != 1)
|
||||
{
|
||||
if (sscanf(blockpos+1, "%d", &block) != 1) {
|
||||
block = 0;
|
||||
}
|
||||
}
|
||||
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;
|
||||
char line[200];
|
||||
|
||||
@ -1117,8 +1054,7 @@ bool cfg_parsefile(char *fname, void (*set_func)(char*, char*))
|
||||
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;
|
||||
char line[200];
|
||||
|
||||
@ -1161,8 +1097,7 @@ void cfg_parsearg(int argc, char **argv)
|
||||
|
||||
|
||||
// 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);
|
||||
if (game) return game;
|
||||
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
|
||||
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);
|
||||
game->id[6] = 0;
|
||||
game->video = videoChoice;
|
||||
@ -1190,8 +1124,7 @@ void cfg_set_game_opt(struct Game_CFG *game, u8 *id)
|
||||
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);
|
||||
if (game) return game;
|
||||
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
|
||||
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);
|
||||
game->id[6] = 0;
|
||||
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];
|
||||
sprintf(GXGlobal_cfg, "%s/config", bootDevice);
|
||||
struct stat st;
|
||||
@ -1289,8 +1220,7 @@ bool cfg_save_global()// save global settings
|
||||
return true;
|
||||
}
|
||||
|
||||
void game_set(char *name, char *val)
|
||||
{
|
||||
void game_set(char *name, char *val) {
|
||||
// sample line:
|
||||
// game:RTNP41 = video:game; language:english; ocarina:0;
|
||||
// game:RYWP01 = video:patch; language:console; ocarina:1;
|
||||
@ -1388,12 +1318,12 @@ void game_set(char *name, char *val)
|
||||
}
|
||||
}
|
||||
// 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:
|
||||
// game:RTNP41 = video:game; language:english; ocarina:0;
|
||||
// game:RYWP01 = video:patch; language:console; ocarina:1;
|
||||
@ -1437,12 +1367,12 @@ void parental_set(char *name, char *val)
|
||||
|
||||
}
|
||||
// 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];
|
||||
struct Game_NUM *game;
|
||||
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];
|
||||
sprintf(GXGameSettings_cfg, "%s/config/GXGameSettings.cfg", bootDevice);
|
||||
return cfg_parsefile(GXGameSettings_cfg, &game_set);
|
||||
}
|
||||
|
||||
bool cfg_load_game_num()
|
||||
{
|
||||
bool cfg_load_game_num() {
|
||||
char GXGameFavorites_cfg[32];
|
||||
sprintf(GXGameFavorites_cfg, "%s/config/GXGameFavorites.cfg", bootDevice);
|
||||
return cfg_parsefile(GXGameFavorites_cfg, &game_set_num);
|
||||
}
|
||||
|
||||
bool cfg_save_games()
|
||||
{
|
||||
bool cfg_save_games() {
|
||||
FILE *f;
|
||||
int i;
|
||||
char GXGameSettings_cfg[50];
|
||||
@ -1542,8 +1470,7 @@ bool cfg_save_games()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cfg_save_game_num()
|
||||
{
|
||||
bool cfg_save_game_num() {
|
||||
FILE *f;
|
||||
int i;
|
||||
char GXGameFavorites_cfg[32];
|
||||
@ -1575,8 +1502,7 @@ bool cfg_save_game_num()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CFG_reset_all_playcounters()
|
||||
{
|
||||
bool CFG_reset_all_playcounters() {
|
||||
FILE *f;
|
||||
int i;
|
||||
char GXGameFavorites_cfg[32];
|
||||
@ -1608,8 +1534,7 @@ bool CFG_reset_all_playcounters()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cfg_load_global()
|
||||
{
|
||||
bool cfg_load_global() {
|
||||
char GXGlobal_cfg[26];
|
||||
sprintf(GXGlobal_cfg, "%s/config/GXGlobal.cfg", bootDevice);
|
||||
//Default values defined by dev team
|
||||
@ -1625,8 +1550,7 @@ bool cfg_load_global()
|
||||
Settings.gameDisplay = list;
|
||||
Settings.sinfo = ((THEME.showID) ? GameID : Neither);
|
||||
Settings.rumble = RumbleOn;
|
||||
if (THEME.showRegion)
|
||||
{
|
||||
if (THEME.showRegion) {
|
||||
Settings.sinfo = ((Settings.sinfo == GameID) ? Both : GameRegion);
|
||||
}
|
||||
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;
|
||||
for (i=0; i<num_saved_games; i++) {
|
||||
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;
|
||||
for (i=0; i<num_saved_game_num; i++) {
|
||||
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;
|
||||
}
|
||||
|
||||
bool CFG_save_game_opt(u8 *id)
|
||||
{
|
||||
bool CFG_save_game_opt(u8 *id) {
|
||||
struct Game_CFG *game = cfg_get_game(id);
|
||||
if (!game) return false;
|
||||
cfg_set_game_opt(game, id);
|
||||
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);
|
||||
if (!game) return false;
|
||||
cfg_set_game_num(game, id);
|
||||
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);
|
||||
int i;
|
||||
if (!game) return true;
|
||||
@ -1695,8 +1614,7 @@ bool CFG_forget_game_opt(u8 *id)
|
||||
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);
|
||||
int i;
|
||||
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];
|
||||
// bool ret = false;
|
||||
|
||||
@ -1753,17 +1670,14 @@ void CFG_Load(void)
|
||||
// cfg_parsearg(argc, argv);
|
||||
}
|
||||
|
||||
void CFG_LoadGlobal(void)
|
||||
{
|
||||
void CFG_LoadGlobal(void) {
|
||||
char GXGlobal_cfg[26];
|
||||
sprintf(GXGlobal_cfg, "%s/config/GXGlobal.cfg", bootDevice);
|
||||
cfg_parsefile(GXGlobal_cfg, &global_cfg_set);
|
||||
}
|
||||
|
||||
void CFG_Cleanup(void)
|
||||
{
|
||||
if (cfg_title)
|
||||
{
|
||||
void CFG_Cleanup(void) {
|
||||
if (cfg_title) {
|
||||
free(cfg_title);
|
||||
cfg_title = NULL;
|
||||
}
|
||||
|
@ -4,8 +4,7 @@
|
||||
#include <gctypes.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "usbloader/disc.h"
|
||||
@ -45,15 +44,13 @@ extern "C"
|
||||
extern char bootDevice[10];
|
||||
//extern char *cfg_path;
|
||||
|
||||
struct CFG
|
||||
{
|
||||
struct CFG {
|
||||
short widescreen;
|
||||
char theme_path[100];
|
||||
};
|
||||
|
||||
|
||||
struct THEME
|
||||
{
|
||||
struct THEME {
|
||||
int selection_x;
|
||||
int selection_y;
|
||||
int selection_w;
|
||||
@ -170,8 +167,7 @@ extern u8 favoritevar;
|
||||
extern char alternatedname[40];
|
||||
|
||||
|
||||
struct Game_CFG
|
||||
{
|
||||
struct Game_CFG {
|
||||
u8 id[8];
|
||||
u8 video;
|
||||
u8 language;
|
||||
@ -186,8 +182,7 @@ struct Game_CFG
|
||||
u8 patchcountrystrings;
|
||||
char alternatedolname[40];
|
||||
};
|
||||
struct Game_NUM
|
||||
{
|
||||
struct Game_NUM {
|
||||
u8 id[8];
|
||||
u8 favorite;
|
||||
u16 count;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#define SVN_REV "673M"
|
||||
#define SVN_REV "674M"
|
||||
|
||||
const char *GetRev()
|
||||
{
|
||||
|
@ -2,8 +2,7 @@
|
||||
#define SVNREV_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
const char *GetRev();
|
||||
|
@ -26,20 +26,17 @@ void wiilight(int enable) { // Toggle wiilight (thanks Bool for wiil
|
||||
u8 shutdown = 0;
|
||||
u8 reset = 0;
|
||||
|
||||
void __Sys_ResetCallback(void)
|
||||
{
|
||||
void __Sys_ResetCallback(void) {
|
||||
/* Reboot console */
|
||||
reset = 1;
|
||||
}
|
||||
|
||||
void __Sys_PowerCallback(void)
|
||||
{
|
||||
void __Sys_PowerCallback(void) {
|
||||
/* Poweroff console */
|
||||
shutdown = 1;
|
||||
}
|
||||
|
||||
void Sys_Init(void)
|
||||
{
|
||||
void Sys_Init(void) {
|
||||
/* Initialize video subsytem */
|
||||
//VIDEO_Init();
|
||||
|
||||
@ -48,8 +45,7 @@ void Sys_Init(void)
|
||||
SYS_SetPowerCallback(__Sys_PowerCallback);
|
||||
}
|
||||
|
||||
static void _ExitApp()
|
||||
{
|
||||
static void _ExitApp() {
|
||||
ExitGUIThreads();
|
||||
StopGX();
|
||||
ShutdownAudio();
|
||||
@ -60,15 +56,13 @@ static void _ExitApp()
|
||||
mload_close();
|
||||
}
|
||||
|
||||
void Sys_Reboot(void)
|
||||
{
|
||||
void Sys_Reboot(void) {
|
||||
/* Restart console */
|
||||
_ExitApp();
|
||||
STM_RebootSystem();
|
||||
}
|
||||
|
||||
int Sys_IosReload(int IOS)
|
||||
{
|
||||
int Sys_IosReload(int IOS) {
|
||||
s32 ret = -1;
|
||||
|
||||
//shutdown SD and USB before IOS Reload in DiscWait
|
||||
@ -116,8 +110,7 @@ int Sys_IosReload(int IOS)
|
||||
#define ShutdownToIdle 1
|
||||
#define ShutdownToStandby 2
|
||||
|
||||
static void _Sys_Shutdown(int SHUTDOWN_MODE)
|
||||
{
|
||||
static void _Sys_Shutdown(int SHUTDOWN_MODE) {
|
||||
_ExitApp();
|
||||
WPAD_Flush(0);
|
||||
WPAD_Disconnect(0);
|
||||
@ -139,30 +132,24 @@ static void _Sys_Shutdown(int SHUTDOWN_MODE)
|
||||
STM_ShutdownToStandby();
|
||||
}
|
||||
}
|
||||
void Sys_Shutdown(void)
|
||||
{
|
||||
void Sys_Shutdown(void) {
|
||||
_Sys_Shutdown(ShutdownToDefault);
|
||||
}
|
||||
void Sys_ShutdownToIdel(void)
|
||||
{
|
||||
void Sys_ShutdownToIdel(void) {
|
||||
_Sys_Shutdown(ShutdownToIdle);
|
||||
}
|
||||
void Sys_ShutdownToStandby(void)
|
||||
{
|
||||
void Sys_ShutdownToStandby(void) {
|
||||
_Sys_Shutdown(ShutdownToStandby);
|
||||
}
|
||||
|
||||
void Sys_LoadMenu(void)
|
||||
{
|
||||
void Sys_LoadMenu(void) {
|
||||
_ExitApp();
|
||||
/* Return to the Wii system menu */
|
||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||
}
|
||||
|
||||
void Sys_BackToLoader(void)
|
||||
{
|
||||
if (*((u32*) 0x80001800))
|
||||
{
|
||||
void Sys_BackToLoader(void) {
|
||||
if (*((u32*) 0x80001800)) {
|
||||
_ExitApp();
|
||||
exit(0);
|
||||
}
|
||||
|
@ -32,8 +32,7 @@
|
||||
/***********************************************************************
|
||||
* 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
|
||||
* unpredictable manner on 16-bit systems; not a problem
|
||||
* 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
|
||||
*/
|
||||
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+1)) += (*(pkeys+0)) & 0xff;
|
||||
(*(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
|
||||
* 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+1) = 591751049L;
|
||||
*(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
|
||||
* often poorly implemented.
|
||||
*/
|
||||
if (++calls == 1)
|
||||
{
|
||||
if (++calls == 1) {
|
||||
srand((unsigned)(time(NULL) ^ ZCR_SEED2));
|
||||
}
|
||||
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;
|
||||
header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t);
|
||||
}
|
||||
/* Encrypt random header (last two bytes is high word of crc) */
|
||||
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++] = 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;
|
||||
long ret;
|
||||
switch (origin)
|
||||
{
|
||||
switch (origin) {
|
||||
case ZLIB_FILEFUNC_SEEK_CUR :
|
||||
fseek_origin = SEEK_CUR;
|
||||
break;
|
||||
@ -138,7 +137,8 @@ long ZCALLBACK fseek_file_func (opaque, stream, offset, origin)
|
||||
case ZLIB_FILEFUNC_SEEK_SET :
|
||||
fseek_origin = SEEK_SET;
|
||||
break;
|
||||
default: return -1;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
ret = 0;
|
||||
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 *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;
|
||||
read_file_func zread_file;
|
||||
write_file_func zwrite_file;
|
||||
|
@ -21,15 +21,13 @@
|
||||
#define WRITEBUFFERSIZE (8192)
|
||||
#define MAXFILENAME (256)
|
||||
|
||||
static int mymkdir(const char* dirname)
|
||||
{
|
||||
static int mymkdir(const char* dirname) {
|
||||
int ret=0;
|
||||
ret = mkdir (dirname,0775);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int makedir (char *newdir)
|
||||
{
|
||||
int makedir (char *newdir) {
|
||||
char *buffer ;
|
||||
char *p;
|
||||
int len = (int)strlen(newdir);
|
||||
@ -43,23 +41,20 @@ int makedir (char *newdir)
|
||||
if (buffer[len-1] == '/') {
|
||||
buffer[len-1] = '\0';
|
||||
}
|
||||
if (mymkdir(buffer) == 0)
|
||||
{
|
||||
if (mymkdir(buffer) == 0) {
|
||||
free(buffer);
|
||||
return 1;
|
||||
}
|
||||
|
||||
p = buffer+1;
|
||||
while (1)
|
||||
{
|
||||
while (1) {
|
||||
char hold;
|
||||
|
||||
while (*p && *p != '\\' && *p != '/')
|
||||
p++;
|
||||
hold = *p;
|
||||
*p = 0;
|
||||
if ((mymkdir(buffer) == -1) && (errno == ENOENT))
|
||||
{
|
||||
if ((mymkdir(buffer) == -1) && (errno == ENOENT)) {
|
||||
printf("couldn't create directory %s\n",buffer);
|
||||
free(buffer);
|
||||
return 0;
|
||||
@ -72,8 +67,7 @@ int makedir (char *newdir)
|
||||
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_withoutpath;
|
||||
char* p;
|
||||
@ -85,38 +79,31 @@ static int do_extract_currentfile(unzFile uf,const int* popt_extract_without_pat
|
||||
unz_file_info file_info;
|
||||
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);
|
||||
return err;
|
||||
}
|
||||
|
||||
size_buf = WRITEBUFFERSIZE;
|
||||
buf = (void*)malloc(size_buf);
|
||||
if (buf==NULL)
|
||||
{
|
||||
if (buf==NULL) {
|
||||
printf("Error allocating memory\n");
|
||||
return UNZ_INTERNALERROR;
|
||||
}
|
||||
|
||||
p = filename_withoutpath = filename_inzip;
|
||||
while ((*p) != '\0')
|
||||
{
|
||||
while ((*p) != '\0') {
|
||||
if (((*p)=='/') || ((*p)=='\\'))
|
||||
filename_withoutpath = p+1;
|
||||
p++;
|
||||
}
|
||||
|
||||
if ((*filename_withoutpath)=='\0')
|
||||
{
|
||||
if ((*popt_extract_without_path)==0)
|
||||
{
|
||||
if ((*filename_withoutpath)=='\0') {
|
||||
if ((*popt_extract_without_path)==0) {
|
||||
printf("creating directory: %s\n",filename_inzip);
|
||||
mymkdir(filename_inzip);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
char* write_filename;
|
||||
int skip=0;
|
||||
|
||||
@ -126,35 +113,29 @@ static int do_extract_currentfile(unzFile uf,const int* popt_extract_without_pat
|
||||
write_filename = filename_withoutpath;
|
||||
|
||||
err = unzOpenCurrentFilePassword(uf,password);
|
||||
if (err!=UNZ_OK)
|
||||
{
|
||||
if (err!=UNZ_OK) {
|
||||
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;
|
||||
FILE* ftestexist;
|
||||
ftestexist = fopen(write_filename,"rb");
|
||||
if (ftestexist!=NULL)
|
||||
{
|
||||
if (ftestexist!=NULL) {
|
||||
fclose(ftestexist);
|
||||
do
|
||||
{
|
||||
do {
|
||||
char answer[128];
|
||||
int ret;
|
||||
|
||||
printf("The file %s exists. Overwrite ? [y]es, [n]o, [A]ll: ",write_filename);
|
||||
ret = scanf("%1s",answer);
|
||||
if (ret != 1)
|
||||
{
|
||||
if (ret != 1) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
rep = answer[0] ;
|
||||
if ((rep>='a') && (rep<='z'))
|
||||
rep -= 0x20;
|
||||
}
|
||||
while ((rep!='Y') && (rep!='N') && (rep!='A'));
|
||||
} while ((rep!='Y') && (rep!='N') && (rep!='A'));
|
||||
}
|
||||
|
||||
if (rep == 'N')
|
||||
@ -164,14 +145,12 @@ static int do_extract_currentfile(unzFile uf,const int* popt_extract_without_pat
|
||||
*popt_overwrite=1;
|
||||
}
|
||||
|
||||
if ((skip==0) && (err==UNZ_OK))
|
||||
{
|
||||
if ((skip==0) && (err==UNZ_OK)) {
|
||||
fout=fopen(write_filename,"wb");
|
||||
|
||||
/* some zipfile don't contain directory alone before file */
|
||||
if ((fout==NULL) && ((*popt_extract_without_path)==0) &&
|
||||
(filename_withoutpath!=(char*)filename_inzip))
|
||||
{
|
||||
(filename_withoutpath!=(char*)filename_inzip)) {
|
||||
char c=*(filename_withoutpath-1);
|
||||
*(filename_withoutpath-1)='\0';
|
||||
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");
|
||||
}
|
||||
|
||||
if (fout==NULL)
|
||||
{
|
||||
if (fout==NULL) {
|
||||
printf("error opening %s\n",write_filename);
|
||||
}
|
||||
}
|
||||
|
||||
if (fout!=NULL)
|
||||
{
|
||||
if (fout!=NULL) {
|
||||
printf(" extracting: %s\n",write_filename);
|
||||
|
||||
do
|
||||
{
|
||||
do {
|
||||
err = unzReadCurrentFile(uf,buf,size_buf);
|
||||
if (err<0)
|
||||
{
|
||||
if (err<0) {
|
||||
printf("error %d with zipfile in unzReadCurrentFile\n",err);
|
||||
break;
|
||||
}
|
||||
if (err>0)
|
||||
if (fwrite(buf,err,1,fout)!=1)
|
||||
{
|
||||
if (fwrite(buf,err,1,fout)!=1) {
|
||||
printf("error in writing extracted file\n");
|
||||
err=UNZ_ERRNO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (err>0);
|
||||
} while (err>0);
|
||||
if (fout)
|
||||
fclose(fout);
|
||||
|
||||
}
|
||||
|
||||
if (err==UNZ_OK)
|
||||
{
|
||||
if (err==UNZ_OK) {
|
||||
err = unzCloseCurrentFile (uf);
|
||||
if (err!=UNZ_OK)
|
||||
{
|
||||
if (err!=UNZ_OK) {
|
||||
printf("error %d with zipfile in unzCloseCurrentFile\n",err);
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
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;
|
||||
unz_global_info gi;
|
||||
int err;
|
||||
@ -238,18 +207,15 @@ int extractZip(unzFile uf,int opt_extract_without_path,int opt_overwrite,const c
|
||||
if (err!=UNZ_OK)
|
||||
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,
|
||||
&opt_overwrite,
|
||||
password) != UNZ_OK)
|
||||
break;
|
||||
|
||||
if ((i+1)<gi.number_entry)
|
||||
{
|
||||
if ((i+1)<gi.number_entry) {
|
||||
err = unzGoToNextFile(uf);
|
||||
if (err!=UNZ_OK)
|
||||
{
|
||||
if (err!=UNZ_OK) {
|
||||
printf("error %d with zipfile in unzGoToNextFile\n",err);
|
||||
break;
|
||||
}
|
||||
@ -259,10 +225,8 @@ int extractZip(unzFile uf,int opt_extract_without_path,int opt_overwrite,const c
|
||||
return 0;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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) {
|
||||
printf("file %s not found in the zipfile\n",filename);
|
||||
return 2;
|
||||
}
|
||||
|
@ -91,16 +91,14 @@ const char unz_copyright[] =
|
||||
" 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*/
|
||||
typedef struct unz_file_info_internal_s
|
||||
{
|
||||
typedef struct unz_file_info_internal_s {
|
||||
uLong offset_curfile;/* relative offset of local header 4 bytes */
|
||||
} unz_file_info_internal;
|
||||
|
||||
|
||||
/* file_in_zip_read_info_s contain internal information about a file in zipfile,
|
||||
when reading and decompress it */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
char *read_buffer; /* internal buffer for compressed data */
|
||||
z_stream stream; /* zLib stream structure for inflate */
|
||||
|
||||
@ -125,8 +123,7 @@ typedef struct
|
||||
|
||||
/* unz_s contain internal information about the zipfile
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
zlib_filefunc_def z_filefunc;
|
||||
voidpf filestream; /* io structore of the zipfile */
|
||||
unz_global_info gi; /* public global information */
|
||||
@ -175,13 +172,10 @@ local int unzlocal_getByte(pzlib_filefunc_def,filestream,pi)
|
||||
{
|
||||
unsigned char c;
|
||||
int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1);
|
||||
if (err==1)
|
||||
{
|
||||
if (err==1) {
|
||||
*pi = (int)c;
|
||||
return UNZ_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if (ZERROR(*pzlib_filefunc_def,filestream))
|
||||
return UNZ_ERRNO;
|
||||
else
|
||||
@ -263,8 +257,7 @@ local int strcmpcasenosensitive_internal (fileName1,fileName2)
|
||||
const char* fileName1;
|
||||
const char* fileName2;
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
for (;;) {
|
||||
char c1=*(fileName1++);
|
||||
char c2=*(fileName2++);
|
||||
if ((c1>='a') && (c1<='z'))
|
||||
@ -352,8 +345,7 @@ local uLong unzlocal_SearchCentralDir(pzlib_filefunc_def,filestream)
|
||||
return 0;
|
||||
|
||||
uBackRead = 4;
|
||||
while (uBackRead<uMaxBack)
|
||||
{
|
||||
while (uBackRead<uMaxBack) {
|
||||
uLong uReadSize,uReadPos ;
|
||||
int i;
|
||||
if (uBackRead+BUFREADCOMMENT>uMaxBack)
|
||||
@ -372,8 +364,7 @@ local uLong unzlocal_SearchCentralDir(pzlib_filefunc_def,filestream)
|
||||
|
||||
for (i=(int)uReadSize-3; (i--)>0;)
|
||||
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;
|
||||
break;
|
||||
}
|
||||
@ -477,8 +468,7 @@ extern unzFile ZEXPORT unzOpen2 (path, pzlib_filefunc_def)
|
||||
(err==UNZ_OK))
|
||||
err=UNZ_BADZIPFILE;
|
||||
|
||||
if (err!=UNZ_OK)
|
||||
{
|
||||
if (err!=UNZ_OK) {
|
||||
ZCLOSE(us.z_filefunc, us.filestream);
|
||||
return NULL;
|
||||
}
|
||||
@ -607,8 +597,7 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
|
||||
|
||||
|
||||
/* we check the magic */
|
||||
if (err==UNZ_OK)
|
||||
{
|
||||
if (err==UNZ_OK) {
|
||||
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
|
||||
err=UNZ_ERRNO;
|
||||
else if (uMagic!=0x02014b50)
|
||||
@ -663,15 +652,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
|
||||
err=UNZ_ERRNO;
|
||||
|
||||
lSeek+=file_info.size_filename;
|
||||
if ((err==UNZ_OK) && (szFileName!=NULL))
|
||||
{
|
||||
if ((err==UNZ_OK) && (szFileName!=NULL)) {
|
||||
uLong uSizeRead ;
|
||||
if (file_info.size_filename<fileNameBufferSize)
|
||||
{
|
||||
if (file_info.size_filename<fileNameBufferSize) {
|
||||
*(szFileName+file_info.size_filename)='\0';
|
||||
uSizeRead = file_info.size_filename;
|
||||
}
|
||||
else
|
||||
} else
|
||||
uSizeRead = fileNameBufferSize;
|
||||
|
||||
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 ;
|
||||
if (file_info.size_file_extra<extraFieldBufferSize)
|
||||
uSizeRead = file_info.size_file_extra;
|
||||
else
|
||||
uSizeRead = extraFieldBufferSize;
|
||||
|
||||
if (lSeek!=0)
|
||||
{
|
||||
if (lSeek!=0) {
|
||||
if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
|
||||
lSeek=0;
|
||||
else
|
||||
@ -701,24 +685,19 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
|
||||
if (ZREAD(s->z_filefunc, s->filestream,extraField,uSizeRead)!=uSizeRead)
|
||||
err=UNZ_ERRNO;
|
||||
lSeek += file_info.size_file_extra - uSizeRead;
|
||||
}
|
||||
else
|
||||
} else
|
||||
lSeek+=file_info.size_file_extra;
|
||||
|
||||
|
||||
if ((err==UNZ_OK) && (szComment!=NULL))
|
||||
{
|
||||
if ((err==UNZ_OK) && (szComment!=NULL)) {
|
||||
uLong uSizeRead ;
|
||||
if (file_info.size_file_comment<commentBufferSize)
|
||||
{
|
||||
if (file_info.size_file_comment<commentBufferSize) {
|
||||
*(szComment+file_info.size_file_comment)='\0';
|
||||
uSizeRead = file_info.size_file_comment;
|
||||
}
|
||||
else
|
||||
} else
|
||||
uSizeRead = commentBufferSize;
|
||||
|
||||
if (lSeek!=0)
|
||||
{
|
||||
if (lSeek!=0) {
|
||||
if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
|
||||
lSeek=0;
|
||||
else
|
||||
@ -729,8 +708,7 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
|
||||
if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead)
|
||||
err=UNZ_ERRNO;
|
||||
lSeek+=file_info.size_file_comment - uSizeRead;
|
||||
}
|
||||
else
|
||||
} else
|
||||
lSeek+=file_info.size_file_comment;
|
||||
|
||||
if ((err==UNZ_OK) && (pfile_info!=NULL))
|
||||
@ -864,14 +842,12 @@ extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity)
|
||||
|
||||
err = unzGoToFirstFile(file);
|
||||
|
||||
while (err == UNZ_OK)
|
||||
{
|
||||
while (err == UNZ_OK) {
|
||||
char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1];
|
||||
err = unzGetCurrentFileInfo(file,NULL,
|
||||
szCurrentFileName,sizeof(szCurrentFileName)-1,
|
||||
NULL,0,NULL,0);
|
||||
if (err == UNZ_OK)
|
||||
{
|
||||
if (err == UNZ_OK) {
|
||||
if (unzStringFileNameCompare(szCurrentFileName,
|
||||
szFileName,iCaseSensitivity)==0)
|
||||
return UNZ_OK;
|
||||
@ -984,8 +960,7 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
|
||||
return UNZ_ERRNO;
|
||||
|
||||
|
||||
if (err==UNZ_OK)
|
||||
{
|
||||
if (err==UNZ_OK) {
|
||||
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
|
||||
err=UNZ_ERRNO;
|
||||
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->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);
|
||||
return UNZ_INTERNALERROR;
|
||||
}
|
||||
@ -1109,14 +1083,18 @@ extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password)
|
||||
if (method!=NULL)
|
||||
*method = (int)s->cur_file_info.compression_method;
|
||||
|
||||
if (level!=NULL)
|
||||
{
|
||||
if (level!=NULL) {
|
||||
*level = 6;
|
||||
switch (s->cur_file_info.flag & 0x06)
|
||||
{
|
||||
case 6 : *level = 1; break;
|
||||
case 4 : *level = 2; break;
|
||||
case 2 : *level = 9; break;
|
||||
switch (s->cur_file_info.flag & 0x06) {
|
||||
case 6 :
|
||||
*level = 1;
|
||||
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;
|
||||
|
||||
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.zfree = (free_func)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);
|
||||
if (err == Z_OK)
|
||||
pfile_in_zip_read_info->stream_initialised=1;
|
||||
else
|
||||
{
|
||||
else {
|
||||
TRYFREE(pfile_in_zip_read_info);
|
||||
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;
|
||||
|
||||
# ifndef NOUNCRYPT
|
||||
if (password != NULL)
|
||||
{
|
||||
if (password != NULL) {
|
||||
int i;
|
||||
s->pcrc_32_tab = get_crc_table();
|
||||
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+
|
||||
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) &&
|
||||
(pfile_in_zip_read_info->rest_read_compressed>0))
|
||||
{
|
||||
(pfile_in_zip_read_info->rest_read_compressed>0)) {
|
||||
uInt uReadThis = UNZ_BUFSIZE;
|
||||
if (pfile_in_zip_read_info->rest_read_compressed<uReadThis)
|
||||
uReadThis = (uInt)pfile_in_zip_read_info->rest_read_compressed;
|
||||
@ -1294,8 +1267,7 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
|
||||
|
||||
|
||||
# ifndef NOUNCRYPT
|
||||
if(s->encrypted)
|
||||
{
|
||||
if (s->encrypted) {
|
||||
uInt i;
|
||||
for (i=0;i<uReadThis;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;
|
||||
}
|
||||
|
||||
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 ;
|
||||
|
||||
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.total_out += uDoCopy;
|
||||
iRead += uDoCopy;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
uLong uTotalOutBefore,uTotalOutAfter;
|
||||
const Bytef *bufBefore;
|
||||
uLong uOutThis;
|
||||
@ -1513,8 +1482,7 @@ extern int ZEXPORT unzCloseCurrentFile (file)
|
||||
|
||||
|
||||
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)
|
||||
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)
|
||||
return UNZ_ERRNO;
|
||||
|
||||
if (uReadThis>0)
|
||||
{
|
||||
if (uReadThis>0) {
|
||||
*szComment='\0';
|
||||
if (ZREAD(s->z_filefunc,s->filestream,szComment,uReadThis)!=uReadThis)
|
||||
return UNZ_ERRNO;
|
||||
|
@ -60,7 +60,9 @@ extern "C" {
|
||||
#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
|
||||
/* like the STRICT of WIN32, we define a pointer that cannot be converted
|
||||
from (void*) without cast */
|
||||
typedef struct TagunzFile__ { int unused; } unzFile__;
|
||||
typedef struct TagunzFile__ {
|
||||
int unused;
|
||||
} unzFile__;
|
||||
typedef unzFile__ *unzFile;
|
||||
#else
|
||||
typedef voidp unzFile;
|
||||
@ -77,8 +79,7 @@ typedef voidp unzFile;
|
||||
#define UNZ_CRCERROR (-105)
|
||||
|
||||
/* 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_min; /* minutes after the hour - [0,59] */
|
||||
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
|
||||
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
|
||||
the central dir on this disk */
|
||||
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 */
|
||||
typedef struct unz_file_info_s
|
||||
{
|
||||
typedef struct unz_file_info_s {
|
||||
uLong version; /* version made by 2 bytes */
|
||||
uLong version_needed; /* version needed to extract 2 bytes */
|
||||
uLong flag; /* general purpose bit flag 2 bytes */
|
||||
@ -207,8 +206,7 @@ extern int ZEXPORT unzLocateFile OF((unzFile file,
|
||||
/* ****************************************** */
|
||||
/* Ryan supplied functions */
|
||||
/* 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 num_of_file; /* # of file */
|
||||
} unz_file_pos;
|
||||
|
@ -11,8 +11,7 @@
|
||||
|
||||
/** 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;
|
||||
FILE* file;
|
||||
void* dol_buffer;
|
||||
@ -28,8 +27,7 @@ bool Load_Dol(void **buffer, int* dollen, char * filepath)
|
||||
|
||||
file = fopen(fullpath, "rb");
|
||||
|
||||
if(file == NULL)
|
||||
{
|
||||
if (file == NULL) {
|
||||
fclose(file);
|
||||
SDCard_deInit();
|
||||
USBDevice_deInit();
|
||||
@ -42,16 +40,14 @@ bool Load_Dol(void **buffer, int* dollen, char * filepath)
|
||||
fseek(file, 0, SEEK_SET);
|
||||
|
||||
dol_buffer = malloc(filesize);
|
||||
if (dol_buffer == NULL)
|
||||
{
|
||||
if (dol_buffer == NULL) {
|
||||
fclose(file);
|
||||
SDCard_deInit();
|
||||
USBDevice_deInit();
|
||||
return false;
|
||||
}
|
||||
ret = fread( dol_buffer, 1, filesize, file);
|
||||
if(ret != filesize)
|
||||
{
|
||||
if (ret != filesize) {
|
||||
free(dol_buffer);
|
||||
fclose(file);
|
||||
SDCard_deInit();
|
||||
@ -67,18 +63,15 @@ bool Load_Dol(void **buffer, int* dollen, char * filepath)
|
||||
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 PatchData[16] = { 0x40, 0x82, 0x00, 0x04, 0x38, 0x60, 0x00, 0x01, 0x48, 0x00, 0x02, 0x44, 0x38, 0x61, 0x00, 0x18 };
|
||||
|
||||
void *Addr = Address;
|
||||
void *Addr_end = Address+Size;
|
||||
|
||||
while(Addr <= Addr_end-sizeof(SearchPattern))
|
||||
{
|
||||
if(memcmp(Addr, SearchPattern, sizeof(SearchPattern))==0)
|
||||
{
|
||||
while (Addr <= Addr_end-sizeof(SearchPattern)) {
|
||||
if (memcmp(Addr, SearchPattern, sizeof(SearchPattern))==0) {
|
||||
memcpy(Addr,PatchData,sizeof(PatchData));
|
||||
return true;
|
||||
}
|
||||
@ -133,14 +126,11 @@ u32 load_dol_image(void *dolstart) {
|
||||
static int i;
|
||||
static int phase;
|
||||
|
||||
u32 load_dol_start(void *dolstart)
|
||||
{
|
||||
if (dolstart)
|
||||
{
|
||||
u32 load_dol_start(void *dolstart) {
|
||||
if (dolstart) {
|
||||
dolfile = (dolheader *)dolstart;
|
||||
return dolfile->entry_point;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -151,23 +141,17 @@ u32 load_dol_start(void *dolstart)
|
||||
i = 0;
|
||||
}
|
||||
|
||||
bool load_dol_image_modified(void **offset, u32 *pos, u32 *len)
|
||||
{
|
||||
if (phase == 0)
|
||||
{
|
||||
if (i == 7)
|
||||
{
|
||||
bool load_dol_image_modified(void **offset, u32 *pos, u32 *len) {
|
||||
if (phase == 0) {
|
||||
if (i == 7) {
|
||||
phase = 1;
|
||||
i = 0;
|
||||
} else
|
||||
{
|
||||
if ((!dolfile->text_size[i]) || (dolfile->text_start[i] < 0x100))
|
||||
{
|
||||
} else {
|
||||
if ((!dolfile->text_size[i]) || (dolfile->text_start[i] < 0x100)) {
|
||||
*offset = 0;
|
||||
*pos = 0;
|
||||
*len = 0;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
*offset = (void *)dolfile->text_start[i];
|
||||
*pos = dolfile->text_pos[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 (i == 11)
|
||||
{
|
||||
if (phase == 1) {
|
||||
if (i == 11) {
|
||||
phase = 2;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((!dolfile->data_size[i]) || (dolfile->data_start[i] < 0x100))
|
||||
{
|
||||
if ((!dolfile->data_size[i]) || (dolfile->data_start[i] < 0x100)) {
|
||||
*offset = 0;
|
||||
*pos = 0;
|
||||
*len = 0;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
*offset = (void *)dolfile->data_start[i];
|
||||
*pos = dolfile->data_pos[i];
|
||||
*len = dolfile->data_size[i];
|
||||
@ -202,15 +182,13 @@ bool load_dol_image_modified(void **offset, u32 *pos, u32 *len)
|
||||
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;
|
||||
void *dol_header;
|
||||
u32 entrypoint;
|
||||
|
||||
dol_header = memalign(32, sizeof(dolheader));
|
||||
if (dol_header == NULL)
|
||||
{
|
||||
if (dol_header == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -218,8 +196,7 @@ u32 Load_Dol_from_disc(u32 doloffset, u8 videoSelected, u8 patchcountrystring, u
|
||||
|
||||
entrypoint = load_dol_start(dol_header);
|
||||
|
||||
if (entrypoint == 0)
|
||||
{
|
||||
if (entrypoint == 0) {
|
||||
free(dol_header);
|
||||
return -1;
|
||||
}
|
||||
@ -228,10 +205,8 @@ u32 Load_Dol_from_disc(u32 doloffset, u8 videoSelected, u8 patchcountrystring, u
|
||||
u32 pos;
|
||||
u32 len;
|
||||
|
||||
while (load_dol_image_modified(&offset, &pos, &len))
|
||||
{
|
||||
if (len != 0)
|
||||
{
|
||||
while (load_dol_image_modified(&offset, &pos, &len)) {
|
||||
if (len != 0) {
|
||||
ret = WDVD_Read(offset, len, (doloffset<<2) + pos);
|
||||
|
||||
DCFlushRange(offset, len);
|
||||
|
@ -2,8 +2,7 @@
|
||||
#define _ALTERNATEDOL_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* 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);
|
||||
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 ||
|
||||
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] ||
|
||||
@ -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[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[5] != mode2->vfilter[5] || mode1->vfilter[6] != mode2->vfilter[6] )
|
||||
{
|
||||
mode1->vfilter[5] != mode2->vfilter[5] || mode1->vfilter[6] != mode2->vfilter[6] ) {
|
||||
return false;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void patch_videomode(GXRModeObj* mode1, GXRModeObj* mode2)
|
||||
{
|
||||
void patch_videomode(GXRModeObj* mode1, GXRModeObj* mode2) {
|
||||
mode1->viTVMode = mode2->viTVMode;
|
||||
mode1->fbWidth = mode2->fbWidth;
|
||||
mode1->efbHeight = mode2->efbHeight;
|
||||
@ -187,19 +182,16 @@ GXRModeObj* NTSC2PAL60[]={
|
||||
&TVNtsc480Prog, &TVEurgb60Hz480Prog,
|
||||
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;
|
||||
bool found = 0;
|
||||
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))
|
||||
@ -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 **/
|
||||
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 PatchData[12] = { 0x2C, 0x00, 0x00, 0x00, 0x40, 0x82, 0x02, 0x14, 0x3C, 0x60, 0x80, 0x00 };
|
||||
|
||||
void *Addr = Address;
|
||||
void *Addr_end = Address+Size;
|
||||
|
||||
while(Addr <= Addr_end-sizeof(SearchPattern))
|
||||
{
|
||||
if(memcmp(Addr, SearchPattern, sizeof(SearchPattern))==0)
|
||||
{
|
||||
while (Addr <= Addr_end-sizeof(SearchPattern)) {
|
||||
if (memcmp(Addr, SearchPattern, sizeof(SearchPattern))==0) {
|
||||
memcpy(Addr,PatchData,sizeof(PatchData));
|
||||
}
|
||||
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;
|
||||
if (videoSelected == 5) // patch
|
||||
|
||||
{
|
||||
switch(CONF_GetVideo())
|
||||
{
|
||||
switch (CONF_GetVideo()) {
|
||||
case CONF_VIDEO_PAL:
|
||||
if(CONF_GetEuRGB60() > 0)
|
||||
{
|
||||
if (CONF_GetEuRGB60() > 0) {
|
||||
table = NTSC2PAL60;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
table = NTSC2PAL;
|
||||
}
|
||||
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_init appldr_init;
|
||||
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;
|
||||
}
|
||||
|
||||
if (cheat)
|
||||
{
|
||||
if (cheat) {
|
||||
/*HOOKS STUFF - FISHEARS*/
|
||||
memset((void*)0x80001800,0,kenobiwii_size);
|
||||
memcpy((void*)0x80001800,kenobiwii,kenobiwii_size);
|
||||
|
@ -2,8 +2,7 @@
|
||||
#define _APPLOADER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Entry point */
|
||||
|
@ -22,8 +22,7 @@ static u8 *diskid = (u8 *)0x80000000;
|
||||
static char gameid[8];
|
||||
|
||||
|
||||
void __Disc_SetLowMem(void)
|
||||
{
|
||||
void __Disc_SetLowMem(void) {
|
||||
*(vu32 *)0x80000020 = 0x0D15EA5E; // Standard Boot Code
|
||||
*(vu32 *)0x80000024 = 0x00000001; // Version
|
||||
|
||||
@ -45,7 +44,9 @@ void __Disc_SetLowMem(void)
|
||||
(strcmp(tempTxt,"R3XP6V")==0))/*&&
|
||||
(IOS_GetVersion()==249)&&
|
||||
((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 */
|
||||
memcpy((void *)0x80003180, (void *)0x80000000, 4);
|
||||
@ -54,8 +55,7 @@ void __Disc_SetLowMem(void)
|
||||
DCFlushRange((void *)0x80000000, 0x3F00);
|
||||
}
|
||||
|
||||
void __Disc_SetVMode(u8 videoselected)
|
||||
{
|
||||
void __Disc_SetVMode(u8 videoselected) {
|
||||
GXRModeObj *vmode = NULL;
|
||||
|
||||
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 void settime(u64);
|
||||
|
||||
@ -155,8 +154,7 @@ void __Disc_SetTime(void)
|
||||
settime(secs_to_ticks(time(NULL) - 946684800));
|
||||
}
|
||||
|
||||
s32 __Disc_FindPartition(u64 *outbuf)
|
||||
{
|
||||
s32 __Disc_FindPartition(u64 *outbuf) {
|
||||
u64 offset = 0, table_offset = 0;
|
||||
|
||||
u32 cnt, nb_partitions;
|
||||
@ -196,14 +194,12 @@ s32 __Disc_FindPartition(u64 *outbuf)
|
||||
}
|
||||
|
||||
|
||||
s32 Disc_Init(void)
|
||||
{
|
||||
s32 Disc_Init(void) {
|
||||
/* Init DVD subsystem */
|
||||
return WDVD_Init();
|
||||
}
|
||||
|
||||
s32 Disc_Open(void)
|
||||
{
|
||||
s32 Disc_Open(void) {
|
||||
s32 ret;
|
||||
|
||||
/* Reset drive */
|
||||
@ -215,8 +211,7 @@ s32 Disc_Open(void)
|
||||
return WDVD_ReadDiskId(diskid);
|
||||
}
|
||||
|
||||
s32 Disc_Wait(void)
|
||||
{
|
||||
s32 Disc_Wait(void) {
|
||||
u32 cover = 0;
|
||||
s32 ret;
|
||||
|
||||
@ -231,20 +226,17 @@ s32 Disc_Wait(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 Disc_SetUSB(u8 *id)
|
||||
{
|
||||
s32 Disc_SetUSB(u8 *id) {
|
||||
/* Set USB mode */
|
||||
return WDVD_SetUSBMode(id);
|
||||
}
|
||||
|
||||
s32 Disc_ReadHeader(void *outbuf)
|
||||
{
|
||||
s32 Disc_ReadHeader(void *outbuf) {
|
||||
/* Read disc header */
|
||||
return WDVD_UnencryptedRead(outbuf, sizeof(struct discHdr), 0);
|
||||
}
|
||||
|
||||
s32 Disc_IsWii(void)
|
||||
{
|
||||
s32 Disc_IsWii(void) {
|
||||
struct discHdr *header = (struct discHdr *)buffer;
|
||||
|
||||
s32 ret;
|
||||
@ -261,8 +253,7 @@ s32 Disc_IsWii(void)
|
||||
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;
|
||||
|
||||
s32 ret;
|
||||
@ -308,8 +299,7 @@ s32 Disc_BootPartition(u64 offset, u8 videoselected, u8 cheat, u8 vipatch, u8 pa
|
||||
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;
|
||||
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);
|
||||
}
|
||||
|
||||
void PatchCountryStrings(void *Address, int Size)
|
||||
{
|
||||
void PatchCountryStrings(void *Address, int Size) {
|
||||
u8 SearchPattern[4] = { 0x00, 0x00, 0x00, 0x00 };
|
||||
u8 PatchData[4] = { 0x00, 0x00, 0x00, 0x00 };
|
||||
u8 *Addr = (u8*)Address;
|
||||
|
||||
int wiiregion = CONF_GetRegion();
|
||||
|
||||
switch (wiiregion)
|
||||
{
|
||||
switch (wiiregion) {
|
||||
case CONF_REGION_JP:
|
||||
SearchPattern[0] = 0x00;
|
||||
SearchPattern[1] = 0x4A; // J
|
||||
@ -359,8 +347,7 @@ void PatchCountryStrings(void *Address, int Size)
|
||||
SearchPattern[2] = 0x53; // S
|
||||
}
|
||||
|
||||
switch (diskid[3])
|
||||
{
|
||||
switch (diskid[3]) {
|
||||
case 'J':
|
||||
PatchData[1] = 0x4A; // J
|
||||
PatchData[2] = 0x50; // P
|
||||
@ -381,10 +368,8 @@ void PatchCountryStrings(void *Address, int Size)
|
||||
PatchData[2] = 0x53; // S
|
||||
}
|
||||
|
||||
while (Size >= 4)
|
||||
{
|
||||
if (Addr[0] == SearchPattern[0] && Addr[1] == SearchPattern[1] && Addr[2] == SearchPattern[2] && Addr[3] == SearchPattern[3])
|
||||
{
|
||||
while (Size >= 4) {
|
||||
if (Addr[0] == SearchPattern[0] && Addr[1] == SearchPattern[1] && Addr[2] == SearchPattern[2] && Addr[3] == SearchPattern[3]) {
|
||||
//*Addr = PatchData[0];
|
||||
Addr += 1;
|
||||
*Addr = PatchData[1];
|
||||
@ -394,8 +379,7 @@ void PatchCountryStrings(void *Address, int Size)
|
||||
//*Addr = PatchData[3];
|
||||
Addr += 1;
|
||||
Size -= 4;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
Addr += 4;
|
||||
Size -= 4;
|
||||
}
|
||||
|
@ -2,12 +2,10 @@
|
||||
#define _DISC_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
/* Disc header structure */
|
||||
struct discHdr
|
||||
{
|
||||
struct discHdr {
|
||||
/* Game ID */
|
||||
u8 id[6];
|
||||
|
||||
|
@ -3,44 +3,35 @@
|
||||
#include "fstfile.h"
|
||||
|
||||
|
||||
char *fstfiles(FST_ENTRY *fst, u32 index)
|
||||
{
|
||||
char *fstfiles(FST_ENTRY *fst, u32 index) {
|
||||
u32 count = fst[0].filelen;
|
||||
u32 stringoffset;
|
||||
if (index < count)
|
||||
{
|
||||
if (index < count) {
|
||||
stringoffset = *(u32 *)&(fst[index]) % (256*256*256);
|
||||
return (char *)((u32)fst + count*12 + stringoffset);
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
char *fstfilename(u32 index)
|
||||
{
|
||||
char *fstfilename(u32 index) {
|
||||
FST_ENTRY *fst = (FST_ENTRY *)*(u32 *)0x80000038;
|
||||
u32 count = fst[0].filelen;
|
||||
u32 stringoffset;
|
||||
if (index < count)
|
||||
{
|
||||
if (index < count) {
|
||||
stringoffset = *(u32 *)&(fst[index]) % (256*256*256);
|
||||
return (char *)(*(u32 *)0x80000038 + count*12 + stringoffset);
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
u32 fstfileoffset(u32 index)
|
||||
{
|
||||
u32 fstfileoffset(u32 index) {
|
||||
FST_ENTRY *fst = (FST_ENTRY *)*(u32 *)0x80000038;
|
||||
u32 count = fst[0].filelen;
|
||||
if (index < count)
|
||||
{
|
||||
if (index < count) {
|
||||
return fst[index].fileoffset;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,7 @@
|
||||
#define _FSTFILE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
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;
|
||||
|
||||
struct discHdr *hdr1 = (struct discHdr *)a;
|
||||
@ -58,8 +57,7 @@ s32 __Menu_EntryCmpCount(const void *a, const void *b)
|
||||
* Get Gamelist
|
||||
***************************************************************************/
|
||||
|
||||
int __Menu_GetEntries(int t)
|
||||
{
|
||||
int __Menu_GetEntries(int t) {
|
||||
struct discHdr *buffer = NULL;
|
||||
struct discHdr *buffer2 = NULL;
|
||||
struct discHdr *header = NULL;
|
||||
@ -94,8 +92,7 @@ int __Menu_GetEntries(int t)
|
||||
if (Settings.fave && t==0) {
|
||||
u32 cnt2 = 0;
|
||||
|
||||
for (u32 i = 0; i < cnt; i++)
|
||||
{
|
||||
for (u32 i = 0; i < cnt; i++) {
|
||||
header = &buffer[i];
|
||||
u8 favorite = 0;
|
||||
struct Game_NUM* game_num = CFG_get_game_num(header->id);
|
||||
@ -104,8 +101,7 @@ int __Menu_GetEntries(int t)
|
||||
}
|
||||
if (favorite==1) {
|
||||
buffer2 = (discHdr *) realloc(buffer2, (cnt2+1) * sizeof(struct discHdr));
|
||||
if (!buffer2)
|
||||
{
|
||||
if (!buffer2) {
|
||||
free(buffer);
|
||||
return -1;
|
||||
}
|
||||
@ -127,13 +123,11 @@ int __Menu_GetEntries(int t)
|
||||
if (Settings.parentalcontrol && !Settings.godmode && t==0) {
|
||||
u32 cnt2 = 0;
|
||||
|
||||
for (u32 i = 0; i < cnt; i++)
|
||||
{
|
||||
for (u32 i = 0; i < cnt; i++) {
|
||||
header = &buffer[i];
|
||||
if (get_block(header) < Settings.parentalcontrol) {
|
||||
buffer2 = (discHdr *) realloc(buffer2, (cnt2+1) * sizeof(struct discHdr));
|
||||
if (!buffer2)
|
||||
{
|
||||
if (!buffer2) {
|
||||
free(buffer);
|
||||
return -1;
|
||||
}
|
||||
@ -154,8 +148,7 @@ int __Menu_GetEntries(int t)
|
||||
|
||||
if (Settings.sort==pcount) {
|
||||
qsort(buffer, cnt, sizeof(struct discHdr), __Menu_EntryCmpCount);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
qsort(buffer, cnt, sizeof(struct discHdr), __Menu_EntryCmp);
|
||||
}
|
||||
|
||||
|
@ -16,8 +16,7 @@ typedef struct {
|
||||
} ATTRIBUTE_PACKED partitionTable;
|
||||
|
||||
|
||||
s32 Partition_GetEntries(partitionEntry *outbuf, u32 *outval)
|
||||
{
|
||||
s32 Partition_GetEntries(partitionEntry *outbuf, u32 *outval) {
|
||||
static partitionTable table ATTRIBUTE_ALIGN(32);
|
||||
|
||||
u32 cnt, sector_size;
|
||||
|
@ -2,8 +2,7 @@
|
||||
#define _PARTITION_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* 'partition entry' structure */
|
||||
|
@ -20,8 +20,7 @@ static s32 hid = -1, fd = -1;
|
||||
static u32 sector_size = SDHC_SECTOR_SIZE;
|
||||
|
||||
|
||||
bool SDHC_Init(void)
|
||||
{
|
||||
bool SDHC_Init(void) {
|
||||
s32 ret;
|
||||
|
||||
/* Already open */
|
||||
@ -57,8 +56,7 @@ err:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SDHC_Close(void)
|
||||
{
|
||||
bool SDHC_Close(void) {
|
||||
/* Close SDHC device */
|
||||
if (fd > 0) {
|
||||
IOS_Close(fd);
|
||||
@ -68,8 +66,7 @@ bool SDHC_Close(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SDHC_IsInserted(void)
|
||||
{
|
||||
bool SDHC_IsInserted(void) {
|
||||
s32 ret;
|
||||
|
||||
/* Check if SD card is inserted */
|
||||
@ -78,8 +75,7 @@ bool SDHC_IsInserted(void)
|
||||
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;
|
||||
u32 len = (sector_size * count);
|
||||
|
||||
@ -109,8 +105,7 @@ bool SDHC_ReadSectors(u32 sector, u32 count, void *buffer)
|
||||
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;
|
||||
u32 len = (sector_size * count);
|
||||
|
||||
@ -141,8 +136,7 @@ bool SDHC_WriteSectors(u32 sector, u32 count, void *buffer)
|
||||
return (!ret) ? true : false;
|
||||
}
|
||||
|
||||
bool SDHC_ClearStatus(void)
|
||||
{
|
||||
bool SDHC_ClearStatus(void) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -5,8 +5,7 @@
|
||||
#define SDHC_SECTOR_SIZE 0x200
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Prototypes */
|
||||
|
@ -51,16 +51,14 @@ static s32 hid = -1, fd = -1;
|
||||
static u32 sector_size;
|
||||
|
||||
|
||||
inline s32 __USBStorage_isMEM2Buffer(const void *buffer)
|
||||
{
|
||||
inline s32 __USBStorage_isMEM2Buffer(const void *buffer) {
|
||||
u32 high_addr = ((u32)buffer) >> 24;
|
||||
|
||||
return (high_addr == 0x90) || (high_addr == 0xD0);
|
||||
}
|
||||
|
||||
|
||||
s32 USBStorage_GetCapacity(u32 *_sector_size)
|
||||
{
|
||||
s32 USBStorage_GetCapacity(u32 *_sector_size) {
|
||||
if (fd > 0) {
|
||||
s32 ret;
|
||||
|
||||
@ -75,8 +73,7 @@ s32 USBStorage_GetCapacity(u32 *_sector_size)
|
||||
return IPC_ENOENT;
|
||||
}
|
||||
|
||||
s32 USBStorage_Init(void)
|
||||
{
|
||||
s32 USBStorage_Init(void) {
|
||||
s32 ret;
|
||||
|
||||
/* Already open */
|
||||
@ -117,8 +114,7 @@ err:
|
||||
}
|
||||
|
||||
/** Hermes **/
|
||||
s32 USBStorage_Watchdog(u32 on_off)
|
||||
{
|
||||
s32 USBStorage_Watchdog(u32 on_off) {
|
||||
if (fd >= 0) {
|
||||
s32 ret;
|
||||
|
||||
@ -130,8 +126,7 @@ s32 USBStorage_Watchdog(u32 on_off)
|
||||
return IPC_ENOENT;
|
||||
}
|
||||
|
||||
s32 USBStorage_Umount(void)
|
||||
{
|
||||
s32 USBStorage_Umount(void) {
|
||||
if (fd >= 0) {
|
||||
s32 ret;
|
||||
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_UNMOUNT, ":");
|
||||
@ -141,8 +136,7 @@ s32 USBStorage_Umount(void)
|
||||
return IPC_ENOENT;
|
||||
}
|
||||
|
||||
void USBStorage_Deinit(void)
|
||||
{
|
||||
void USBStorage_Deinit(void) {
|
||||
/* Close USB device */
|
||||
if (fd > 0) {
|
||||
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;
|
||||
u32 len = (sector_size * numSectors);
|
||||
|
||||
@ -181,8 +174,7 @@ s32 USBStorage_ReadSectors(u32 sector, u32 numSectors, void *buffer)
|
||||
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;
|
||||
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')
|
||||
|
||||
|
||||
bool umsio_Startup()
|
||||
{
|
||||
bool umsio_Startup() {
|
||||
return USBStorage_Init() == 0;
|
||||
}
|
||||
|
||||
bool umsio_IsInserted()
|
||||
{
|
||||
bool umsio_IsInserted() {
|
||||
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;
|
||||
s32 ret;
|
||||
/* Do reads */
|
||||
while (cnt < numSectors)
|
||||
{
|
||||
while (cnt < numSectors) {
|
||||
u32 sectors = (numSectors - cnt);
|
||||
|
||||
/* Read sectors is too big */
|
||||
@ -251,14 +239,12 @@ bool umsio_ReadSectors(sec_t sector, sec_t numSectors, u8 *buffer)
|
||||
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;
|
||||
s32 ret;
|
||||
|
||||
/* Do writes */
|
||||
while (cnt < numSectors)
|
||||
{
|
||||
while (cnt < numSectors) {
|
||||
u32 sectors = (numSectors - cnt);
|
||||
|
||||
/* Write sectors is too big */
|
||||
@ -276,18 +262,15 @@ bool umsio_WriteSectors(sec_t sector, sec_t numSectors, const u8* buffer)
|
||||
|
||||
return true;
|
||||
}
|
||||
bool umsio_ClearStatus(void)
|
||||
{
|
||||
bool umsio_ClearStatus(void) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool umsio_Shutdown()
|
||||
{
|
||||
bool umsio_Shutdown() {
|
||||
USBStorage_Deinit();
|
||||
return true;
|
||||
}
|
||||
const DISC_INTERFACE __io_wiiums =
|
||||
{
|
||||
const DISC_INTERFACE __io_wiiums = {
|
||||
DEVICE_TYPE_WII_UMS,
|
||||
FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_WII_USB,
|
||||
(FN_MEDIUM_STARTUP)&umsio_Startup,
|
||||
|
@ -2,8 +2,7 @@
|
||||
#define _USBSTORAGE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
/* Prototypes */
|
||||
s32 USBStorage_GetCapacity(u32 *);
|
||||
|
@ -2,7 +2,6 @@
|
||||
#include <ogcsys.h>
|
||||
|
||||
|
||||
u32 swap32(u32 x)
|
||||
{
|
||||
u32 swap32(u32 x) {
|
||||
return (x >> 24) | ((x << 8) & 0x00FF0000UL) | ((x >> 8) & 0x0000FF00UL) | (x << 24);
|
||||
}
|
||||
|
@ -26,25 +26,21 @@ static s32 done = -1, total = -1;
|
||||
/* Variables */
|
||||
|
||||
static u32 nb_sectors, sector_size;
|
||||
static void WBFS_Spinner(s32 x, s32 max)
|
||||
{
|
||||
static void WBFS_Spinner(s32 x, s32 max) {
|
||||
done = x;
|
||||
total = max;
|
||||
}
|
||||
|
||||
void GetProgressValue(s32 * d, s32 * m)
|
||||
{
|
||||
void GetProgressValue(s32 * d, s32 * m) {
|
||||
*d = done;
|
||||
*m = total;
|
||||
}
|
||||
|
||||
wbfs_t *GetHddInfo(void)
|
||||
{
|
||||
wbfs_t *GetHddInfo(void) {
|
||||
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;
|
||||
|
||||
u64 offset;
|
||||
@ -92,8 +88,7 @@ out:
|
||||
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;
|
||||
s32 ret;
|
||||
|
||||
@ -118,8 +113,7 @@ s32 __WBFS_ReadUSB(void *fp, u32 lba, u32 count, void *iobuf)
|
||||
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;
|
||||
s32 ret;
|
||||
|
||||
@ -144,8 +138,7 @@ s32 __WBFS_WriteUSB(void *fp, u32 lba, u32 count, void *iobuf)
|
||||
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;
|
||||
s32 ret;
|
||||
|
||||
@ -170,8 +163,7 @@ s32 __WBFS_ReadSDHC(void *fp, u32 lba, u32 count, void *iobuf)
|
||||
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;
|
||||
s32 ret;
|
||||
|
||||
@ -196,8 +188,7 @@ s32 __WBFS_WriteSDHC(void *fp, u32 lba, u32 count, void *iobuf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 WBFS_Init(u32 device)
|
||||
{
|
||||
s32 WBFS_Init(u32 device) {
|
||||
s32 ret;
|
||||
|
||||
switch (device) {
|
||||
@ -213,8 +204,7 @@ s32 WBFS_Init(u32 device)
|
||||
nb_sectors = USBStorage_GetCapacity(§or_size);
|
||||
if (!nb_sectors)
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
} else
|
||||
return ret;
|
||||
break;
|
||||
case WBFS_DEVICE_SDHC:
|
||||
@ -229,8 +219,7 @@ s32 WBFS_Init(u32 device)
|
||||
/* Device info */
|
||||
nb_sectors = 0;
|
||||
sector_size = SDHC_SECTOR_SIZE;
|
||||
}
|
||||
else
|
||||
} else
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
@ -314,8 +303,7 @@ out:
|
||||
}
|
||||
*/
|
||||
|
||||
s32 WBFS_Open(void)
|
||||
{
|
||||
s32 WBFS_Open(void) {
|
||||
/* Close hard disk */
|
||||
if (hdd)
|
||||
wbfs_close(hdd);
|
||||
@ -338,8 +326,7 @@ s32 WBFS_Close(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 WBFS_Format(u32 lba, u32 size)
|
||||
{
|
||||
s32 WBFS_Format(u32 lba, u32 size) {
|
||||
wbfs_t *partition = NULL;
|
||||
|
||||
/* Reset partition */
|
||||
@ -353,8 +340,7 @@ s32 WBFS_Format(u32 lba, u32 size)
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 WBFS_GetCount(u32 *count)
|
||||
{
|
||||
s32 WBFS_GetCount(u32 *count) {
|
||||
/* No device open */
|
||||
if (!hdd)
|
||||
return -1;
|
||||
@ -365,8 +351,7 @@ s32 WBFS_GetCount(u32 *count)
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 WBFS_GetHeaders(void *outbuf, u32 cnt, u32 len)
|
||||
{
|
||||
s32 WBFS_GetHeaders(void *outbuf, u32 cnt, u32 len) {
|
||||
u32 idx, size;
|
||||
s32 ret;
|
||||
|
||||
@ -386,8 +371,7 @@ s32 WBFS_GetHeaders(void *outbuf, u32 cnt, u32 len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 WBFS_CheckGame(u8 *discid)
|
||||
{
|
||||
s32 WBFS_CheckGame(u8 *discid) {
|
||||
wbfs_disc_t *disc = NULL;
|
||||
|
||||
/* Try to open game disc */
|
||||
@ -402,8 +386,7 @@ s32 WBFS_CheckGame(u8 *discid)
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 WBFS_AddGame(void)
|
||||
{
|
||||
s32 WBFS_AddGame(void) {
|
||||
s32 ret;
|
||||
|
||||
/* No device open */
|
||||
@ -418,8 +401,7 @@ s32 WBFS_AddGame(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 WBFS_RemoveGame(u8 *discid)
|
||||
{
|
||||
s32 WBFS_RemoveGame(u8 *discid) {
|
||||
s32 ret;
|
||||
|
||||
/* No device open */
|
||||
@ -434,8 +416,7 @@ s32 WBFS_RemoveGame(u8 *discid)
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 WBFS_GameSize(u8 *discid, f32 *size)
|
||||
{
|
||||
s32 WBFS_GameSize(u8 *discid, f32 *size) {
|
||||
wbfs_disc_t *disc = NULL;
|
||||
|
||||
u32 sectors;
|
||||
@ -461,8 +442,7 @@ s32 WBFS_GameSize(u8 *discid, f32 *size)
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 WBFS_DiskSpace(f32 *used, f32 *free)
|
||||
{
|
||||
s32 WBFS_DiskSpace(f32 *used, f32 *free) {
|
||||
f32 ssize;
|
||||
u32 cnt;
|
||||
|
||||
@ -483,8 +463,7 @@ s32 WBFS_DiskSpace(f32 *used, f32 *free)
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 WBFS_RenameGame(u8 *discid, const void *newname)
|
||||
{
|
||||
s32 WBFS_RenameGame(u8 *discid, const void *newname) {
|
||||
s32 ret;
|
||||
|
||||
/* No USB device open */
|
||||
@ -497,8 +476,7 @@ s32 WBFS_RenameGame(u8 *discid, const void *newname)
|
||||
return 0;
|
||||
}
|
||||
|
||||
f32 WBFS_EstimeGameSize(void)
|
||||
{
|
||||
f32 WBFS_EstimeGameSize(void) {
|
||||
|
||||
return wbfs_estimate_disc(hdd, __WBFS_ReadDVD, NULL, ONLY_GAME_PARTITION);
|
||||
|
||||
|
@ -2,8 +2,7 @@
|
||||
#define _WBFS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#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 s32 di_fd = -1;
|
||||
|
||||
s32 WDVD_Init(void)
|
||||
{
|
||||
s32 WDVD_Init(void) {
|
||||
/* Open "/dev/di" */
|
||||
if (di_fd < 0) {
|
||||
di_fd = IOS_Open(di_fs, 0);
|
||||
@ -42,8 +41,7 @@ s32 WDVD_Init(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 WDVD_Close(void)
|
||||
{
|
||||
s32 WDVD_Close(void) {
|
||||
/* Close "/dev/di" */
|
||||
if (di_fd >= 0) {
|
||||
IOS_Close(di_fd);
|
||||
@ -53,14 +51,12 @@ s32 WDVD_Close(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 WDVD_GetHandle(void)
|
||||
{
|
||||
s32 WDVD_GetHandle(void) {
|
||||
/* Return di handle */
|
||||
return di_fd;
|
||||
}
|
||||
|
||||
s32 WDVD_Reset(void)
|
||||
{
|
||||
s32 WDVD_Reset(void) {
|
||||
s32 ret;
|
||||
|
||||
memset(inbuf, 0, sizeof(inbuf));
|
||||
@ -76,8 +72,7 @@ s32 WDVD_Reset(void)
|
||||
return (ret == 1) ? 0 : -ret;
|
||||
}
|
||||
|
||||
s32 WDVD_ReadDiskId(void *id)
|
||||
{
|
||||
s32 WDVD_ReadDiskId(void *id) {
|
||||
s32 ret;
|
||||
|
||||
memset(inbuf, 0, sizeof(inbuf));
|
||||
@ -97,8 +92,7 @@ s32 WDVD_ReadDiskId(void *id)
|
||||
return -ret;
|
||||
}
|
||||
|
||||
s32 WDVD_Seek(u64 offset)
|
||||
{
|
||||
s32 WDVD_Seek(u64 offset) {
|
||||
s32 ret;
|
||||
|
||||
memset(inbuf, 0, sizeof(inbuf));
|
||||
@ -108,8 +102,7 @@ s32 WDVD_Seek(u64 offset)
|
||||
inbuf[1] = (u32)(offset >> 2);
|
||||
|
||||
ret = IOS_Ioctl(di_fd, IOCTL_DI_SEEK, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
if(ret!=1)
|
||||
{
|
||||
if (ret!=1) {
|
||||
// Try old cIOS 222
|
||||
/* Drive seek */
|
||||
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);
|
||||
s32 ret;
|
||||
|
||||
@ -141,8 +133,7 @@ s32 WDVD_Offset(u64 offset)
|
||||
return (ret == 1) ? 0 : -ret;
|
||||
}
|
||||
|
||||
s32 WDVD_StopLaser(void)
|
||||
{
|
||||
s32 WDVD_StopLaser(void) {
|
||||
s32 ret;
|
||||
|
||||
memset(inbuf, 0, sizeof(inbuf));
|
||||
@ -157,8 +148,7 @@ s32 WDVD_StopLaser(void)
|
||||
return (ret == 1) ? 0 : -ret;
|
||||
}
|
||||
|
||||
s32 WDVD_StopMotor(void)
|
||||
{
|
||||
s32 WDVD_StopMotor(void) {
|
||||
s32 ret;
|
||||
|
||||
memset(inbuf, 0, sizeof(inbuf));
|
||||
@ -173,8 +163,7 @@ s32 WDVD_StopMotor(void)
|
||||
return (ret == 1) ? 0 : -ret;
|
||||
}
|
||||
|
||||
s32 WDVD_OpenPartition(u64 offset)
|
||||
{
|
||||
s32 WDVD_OpenPartition(u64 offset) {
|
||||
u8 *vector = NULL;
|
||||
|
||||
u32 *buffer = NULL;
|
||||
@ -213,8 +202,7 @@ s32 WDVD_OpenPartition(u64 offset)
|
||||
return (ret == 1) ? 0 : -ret;
|
||||
}
|
||||
|
||||
s32 WDVD_ClosePartition(void)
|
||||
{
|
||||
s32 WDVD_ClosePartition(void) {
|
||||
s32 ret;
|
||||
|
||||
memset(inbuf, 0, sizeof(inbuf));
|
||||
@ -229,8 +217,7 @@ s32 WDVD_ClosePartition(void)
|
||||
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;
|
||||
|
||||
memset(inbuf, 0, sizeof(inbuf));
|
||||
@ -247,8 +234,7 @@ s32 WDVD_UnencryptedRead(void *buf, u32 len, u64 offset)
|
||||
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;
|
||||
|
||||
memset(inbuf, 0, sizeof(inbuf));
|
||||
@ -265,8 +251,7 @@ s32 WDVD_Read(void *buf, u32 len, u64 offset)
|
||||
return (ret == 1) ? 0 : -ret;
|
||||
}
|
||||
|
||||
s32 WDVD_WaitForDisc(void)
|
||||
{
|
||||
s32 WDVD_WaitForDisc(void) {
|
||||
s32 ret;
|
||||
|
||||
memset(inbuf, 0, sizeof(inbuf));
|
||||
@ -281,8 +266,7 @@ s32 WDVD_WaitForDisc(void)
|
||||
return (ret == 1) ? 0 : -ret;
|
||||
}
|
||||
|
||||
s32 WDVD_GetCoverStatus(u32 *status)
|
||||
{
|
||||
s32 WDVD_GetCoverStatus(u32 *status) {
|
||||
s32 ret;
|
||||
|
||||
memset(inbuf, 0, sizeof(inbuf));
|
||||
@ -304,8 +288,7 @@ s32 WDVD_GetCoverStatus(u32 *status)
|
||||
return -ret;
|
||||
}
|
||||
|
||||
s32 WDVD_DisableReset(u8 val)
|
||||
{
|
||||
s32 WDVD_DisableReset(u8 val) {
|
||||
s32 ret;
|
||||
|
||||
memset(inbuf, 0, sizeof(inbuf));
|
||||
@ -322,8 +305,7 @@ s32 WDVD_DisableReset(u8 val)
|
||||
}
|
||||
|
||||
/** Hermes **/
|
||||
s32 WDVD_SetUSBMode(u8 *id)
|
||||
{
|
||||
s32 WDVD_SetUSBMode(u8 *id) {
|
||||
s32 ret;
|
||||
|
||||
memset(inbuf, 0, sizeof(inbuf));
|
||||
|
@ -2,8 +2,7 @@
|
||||
#define _WDVD_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Prototypes */
|
||||
|
@ -35,16 +35,14 @@ u32 frameCount = 0;
|
||||
* called by postRetraceCallback in InitGCVideo - scans gcpad and wpad
|
||||
***************************************************************************/
|
||||
static void
|
||||
UpdatePadsCB ()
|
||||
{
|
||||
UpdatePadsCB () {
|
||||
frameCount++;
|
||||
#ifdef HW_RVL
|
||||
WPAD_ScanPads();
|
||||
#endif
|
||||
PAD_ScanPads();
|
||||
|
||||
for(int i=3; i >= 0; i--)
|
||||
{
|
||||
for (int i=3; i >= 0; i--) {
|
||||
#ifdef HW_RVL
|
||||
memcpy(&userInput[i].wpad, WPAD_Data(i), sizeof(WPADData));
|
||||
#endif
|
||||
@ -68,8 +66,7 @@ UpdatePadsCB ()
|
||||
* Initialises GX and sets it up for use
|
||||
***************************************************************************/
|
||||
static void
|
||||
StartGX ()
|
||||
{
|
||||
StartGX () {
|
||||
GXColor background = { 0, 0, 0, 0xff };
|
||||
|
||||
/*** Clear out FIFO area ***/
|
||||
@ -89,8 +86,7 @@ StartGX ()
|
||||
* Reset the video/rendering mode for the menu
|
||||
****************************************************************************/
|
||||
void
|
||||
ResetVideo_Menu()
|
||||
{
|
||||
ResetVideo_Menu() {
|
||||
Mtx44 p;
|
||||
f32 yscale;
|
||||
u32 xfbHeight;
|
||||
@ -162,14 +158,12 @@ ResetVideo_Menu()
|
||||
***************************************************************************/
|
||||
|
||||
void
|
||||
InitVideo ()
|
||||
{
|
||||
InitVideo () {
|
||||
VIDEO_Init();
|
||||
vmode = VIDEO_GetPreferredMode(NULL); // get default video mode
|
||||
|
||||
// widescreen fix
|
||||
if(CFG.widescreen)
|
||||
{
|
||||
if (CFG.widescreen) {
|
||||
vmode->viWidth = VI_MAX_WIDTH_PAL-12;
|
||||
vmode->viXOrigin = ((VI_MAX_WIDTH_PAL - vmode->viWidth) / 2) + 2;
|
||||
}
|
||||
@ -210,8 +204,7 @@ InitVideo ()
|
||||
*
|
||||
* Stops GX (when exiting)
|
||||
***************************************************************************/
|
||||
void StopGX()
|
||||
{
|
||||
void StopGX() {
|
||||
GX_AbortFrame();
|
||||
GX_Flush();
|
||||
|
||||
@ -224,8 +217,7 @@ void StopGX()
|
||||
*
|
||||
* Renders everything current sent to GX, and flushes video
|
||||
***************************************************************************/
|
||||
void Menu_Render()
|
||||
{
|
||||
void Menu_Render() {
|
||||
GX_DrawDone ();
|
||||
|
||||
whichfb ^= 1; // flip framebuffer
|
||||
@ -243,8 +235,7 @@ void Menu_Render()
|
||||
* Draws the specified image on screen using GX
|
||||
***************************************************************************/
|
||||
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)
|
||||
return;
|
||||
|
||||
@ -262,7 +253,9 @@ void Menu_DrawImg(f32 xpos, f32 ypos, f32 zpos, f32 width, f32 height, u8 data[]
|
||||
height*=.5;
|
||||
guMtxIdentity (m1);
|
||||
guMtxScaleApply(m1,m1,scaleX,scaleY,1.0);
|
||||
guVector axis = (guVector) {0 , 0, 1 };
|
||||
guVector axis = (guVector) {
|
||||
0 , 0, 1
|
||||
};
|
||||
guMtxRotAxisDeg (m2, &axis, degrees);
|
||||
// guMtxConcat(m2,m1,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
|
||||
***************************************************************************/
|
||||
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;
|
||||
long n;
|
||||
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;
|
||||
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;
|
||||
n = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
fmt = GX_TRIANGLEFAN;
|
||||
n = 4;
|
||||
}
|
||||
|
||||
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_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[],
|
||||
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)
|
||||
return;
|
||||
|
||||
@ -362,9 +349,13 @@ void Menu_DrawDiskCover(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16
|
||||
|
||||
guMtxIdentity (m1);
|
||||
guMtxScaleApply(m1,m1,scaleX,scaleY,1.0);
|
||||
guVector axis2 = (guVector) {0 , 1, 0 };
|
||||
guVector axis2 = (guVector) {
|
||||
0 , 1, 0
|
||||
};
|
||||
guMtxRotAxisDeg (m2, &axis2, deg_beta);
|
||||
guVector axis = (guVector) {0 , 0, 1 };
|
||||
guVector axis = (guVector) {
|
||||
0 , 0, 1
|
||||
};
|
||||
guMtxRotAxisDeg (m3, &axis, deg_alpha);
|
||||
// guMtxConcat(m2,m1,m);
|
||||
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);
|
||||
GX_LoadPosMtxImm (mv, GX_PNMTX0);
|
||||
|
||||
if(shadow)
|
||||
{
|
||||
if (shadow) {
|
||||
GX_Begin(GX_QUADS, GX_VTXFMT0,4);
|
||||
GX_Position3f32(-width, -height, 0);
|
||||
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_Color4u8(0,0,0,alpha);
|
||||
GX_TexCoord2f32(0, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
GX_Begin(GX_QUADS, GX_VTXFMT0,4);
|
||||
GX_Position3f32(-width, -height, 0);
|
||||
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,
|
||||
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_InvalidateTexAll();
|
||||
|
||||
@ -441,7 +428,9 @@ void Menu_DrawTPLImg(f32 xpos, f32 ypos, f32 zpos, f32 width, f32 height, GXTexO
|
||||
height*=.5;
|
||||
guMtxIdentity (m1);
|
||||
guMtxScaleApply(m1,m1,scaleX,scaleY,1.0);
|
||||
guVector axis = (guVector) {0 , 0, 1 };
|
||||
guVector axis = (guVector) {
|
||||
0 , 0, 1
|
||||
};
|
||||
guMtxRotAxisDeg (m2, &axis, degrees);
|
||||
guMtxConcat(m1,m2,m);
|
||||
|
||||
|
@ -61,8 +61,7 @@ s32 ISFS_ReadFileToArray (const char *filepath, u8 *filearray, u32 max_size, u32
|
||||
|
||||
*file_size = 0;
|
||||
ret = ISFS_Open(filepath, ISFS_OPEN_READ);
|
||||
if (ret <= 0)
|
||||
{
|
||||
if (ret <= 0) {
|
||||
//printf("Error! ISFS_Open (ret = %d)\n", ret);
|
||||
return -1;
|
||||
}
|
||||
@ -70,36 +69,30 @@ s32 ISFS_ReadFileToArray (const char *filepath, u8 *filearray, u32 max_size, u32
|
||||
fd = ret;
|
||||
|
||||
ret = ISFS_GetFileStats(fd, &filestats);
|
||||
if (ret < 0)
|
||||
{
|
||||
if (ret < 0) {
|
||||
//printf("Error! ISFS_GetFileStats (ret = %d)\n", ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
*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);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = ISFS_Read(fd, filearray, *file_size);
|
||||
*file_size = ret;
|
||||
if (ret < 0)
|
||||
{
|
||||
if (ret < 0) {
|
||||
//printf("Error! ISFS_Read (ret = %d)\n", ret);
|
||||
return -1;
|
||||
}
|
||||
else if (ret != filestats.file_length)
|
||||
{
|
||||
} else if (ret != filestats.file_length) {
|
||||
//printf("Error! ISFS_Read Only read: %d\n", ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = ISFS_Close(fd);
|
||||
if (ret < 0)
|
||||
{
|
||||
if (ret < 0) {
|
||||
//printf("Error! ISFS_Close (ret = %d)\n", ret);
|
||||
return -1;
|
||||
}
|
||||
|
@ -21,15 +21,13 @@ void spinner(void);
|
||||
|
||||
// Basic I/O.
|
||||
|
||||
static inline u32 read32(u32 addr)
|
||||
{
|
||||
static inline u32 read32(u32 addr) {
|
||||
u32 x;
|
||||
asm volatile("lwz %0,0(%1) ; sync" : "=r"(x) : "b"(0xc0000000 | addr));
|
||||
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));
|
||||
}
|
||||
|
||||
@ -44,8 +42,7 @@ extern const char version[];
|
||||
|
||||
// Debug: blink the tray led.
|
||||
|
||||
static inline void blink(void)
|
||||
{
|
||||
static inline void blink(void) {
|
||||
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. */
|
||||
|
||||
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;
|
||||
typedef union {
|
||||
unsigned char c[64];
|
||||
@ -64,26 +63,86 @@ static unsigned char workspace[64];
|
||||
d = state[3];
|
||||
e = state[4];
|
||||
/* 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(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(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,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15);
|
||||
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);
|
||||
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);
|
||||
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(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(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,12);
|
||||
R0(c,d,e,a,b,13);
|
||||
R0(b,c,d,e,a,14);
|
||||
R0(a,b,c,d,e,15);
|
||||
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);
|
||||
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[] */
|
||||
state[0] += a;
|
||||
state[1] += b;
|
||||
@ -97,8 +156,7 @@ static unsigned char workspace[64];
|
||||
|
||||
/* SHA1Init - Initialize new context */
|
||||
|
||||
void SHA1Init(SHA1_CTX* context)
|
||||
{
|
||||
void SHA1Init(SHA1_CTX* context) {
|
||||
/* SHA1 initialization constants */
|
||||
context->state[0] = 0x67452301;
|
||||
context->state[1] = 0xEFCDAB89;
|
||||
@ -111,8 +169,7 @@ void SHA1Init(SHA1_CTX* context)
|
||||
|
||||
/* 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;
|
||||
|
||||
j = (context->count[0] >> 3) & 63;
|
||||
@ -125,16 +182,14 @@ unsigned int i, j;
|
||||
SHA1Transform(context->state, &data[i]);
|
||||
}
|
||||
j = 0;
|
||||
}
|
||||
else i = 0;
|
||||
} else i = 0;
|
||||
memcpy(&context->buffer[j], &data[i], len - i);
|
||||
}
|
||||
|
||||
|
||||
/* 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 char finalcount[8];
|
||||
|
||||
|
@ -13,8 +13,7 @@
|
||||
#define MAX_TITLES 256
|
||||
|
||||
|
||||
s32 Title_GetList(u64 **outbuf, u32 *outlen)
|
||||
{
|
||||
s32 Title_GetList(u64 **outbuf, u32 *outlen) {
|
||||
u64 *titles = NULL;
|
||||
|
||||
u32 len, nb_titles;
|
||||
@ -52,8 +51,7 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 Title_GetTicketViews(u64 tid, tikview **outbuf, u32 *outlen)
|
||||
{
|
||||
s32 Title_GetTicketViews(u64 tid, tikview **outbuf, u32 *outlen) {
|
||||
tikview *views = NULL;
|
||||
|
||||
u32 nb_views;
|
||||
@ -88,8 +86,7 @@ err:
|
||||
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;
|
||||
|
||||
u32 len;
|
||||
@ -124,8 +121,7 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 Title_GetVersion(u64 tid, u16 *outbuf)
|
||||
{
|
||||
s32 Title_GetVersion(u64 tid, u16 *outbuf) {
|
||||
signed_blob *p_tmd = NULL;
|
||||
tmd *tmd_data = NULL;
|
||||
|
||||
@ -149,8 +145,7 @@ s32 Title_GetVersion(u64 tid, u16 *outbuf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 Title_GetSysVersion(u64 tid, u64 *outbuf)
|
||||
{
|
||||
s32 Title_GetSysVersion(u64 tid, u64 *outbuf) {
|
||||
signed_blob *p_tmd = NULL;
|
||||
tmd *tmd_data = NULL;
|
||||
|
||||
@ -174,8 +169,7 @@ s32 Title_GetSysVersion(u64 tid, u64 *outbuf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 Title_GetSize(u64 tid, u32 *outbuf)
|
||||
{
|
||||
s32 Title_GetSize(u64 tid, u32 *outbuf) {
|
||||
signed_blob *p_tmd = NULL;
|
||||
tmd *tmd_data = NULL;
|
||||
|
||||
@ -207,8 +201,7 @@ s32 Title_GetSize(u64 tid, u32 *outbuf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 Title_GetIOSVersions(u8 **outbuf, u32 *outlen)
|
||||
{
|
||||
s32 Title_GetIOSVersions(u8 **outbuf, u32 *outlen) {
|
||||
u8 *buffer = NULL;
|
||||
u64 *list = NULL;
|
||||
|
||||
@ -261,8 +254,7 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 Uninstall_RemoveTicket(u64 tid)
|
||||
{
|
||||
s32 Uninstall_RemoveTicket(u64 tid) {
|
||||
static tikview viewdata[0x10] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
u32 cnt, views;
|
||||
@ -303,8 +295,7 @@ s32 Uninstall_RemoveTicket(u64 tid)
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 Uninstall_DeleteTitle(u32 title_u, u32 title_l)
|
||||
{
|
||||
s32 Uninstall_DeleteTitle(u32 title_u, u32 title_l) {
|
||||
s32 ret;
|
||||
char filepath[256];
|
||||
sprintf(filepath, "/title/%08x/%08x", title_u, title_l);
|
||||
@ -314,8 +305,7 @@ s32 Uninstall_DeleteTitle(u32 title_u, u32 title_l)
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 Uninstall_DeleteTicket(u32 title_u, u32 title_l)
|
||||
{
|
||||
s32 Uninstall_DeleteTicket(u32 title_u, u32 title_l) {
|
||||
s32 ret;
|
||||
|
||||
char filepath[256];
|
||||
@ -329,21 +319,17 @@ s32 Uninstall_DeleteTicket(u32 title_u, u32 title_l)
|
||||
|
||||
//carefull when using this function
|
||||
//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;
|
||||
u32 id = tid & 0xFFFFFFFF, kind = tid >> 32;
|
||||
contents_ret = tik_ret = title_ret = ret = 0;
|
||||
|
||||
if (kind == 1)
|
||||
{
|
||||
if (kind == 1) {
|
||||
// Delete title and ticket at FS level.
|
||||
tik_ret = Uninstall_DeleteTicket(kind, id);
|
||||
title_ret = Uninstall_DeleteTitle(kind, id);
|
||||
contents_ret = title_ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// Remove title (contents and ticket)
|
||||
tik_ret = Uninstall_RemoveTicket(tid);
|
||||
contents_ret = ES_DeleteTitleContent(tid);
|
||||
@ -491,8 +477,7 @@ languages
|
||||
// Identify as super user
|
||||
Identify_SU();
|
||||
fh = ISFS_Open(file, ISFS_OPEN_READ);
|
||||
}
|
||||
else if (fh < 0)
|
||||
} else if (fh < 0)
|
||||
return fh;
|
||||
|
||||
// Jump to start of the name entries
|
||||
@ -524,8 +509,7 @@ languages
|
||||
sprintf(name, "%s", str[lang]);
|
||||
if (strlen(str[lang+1]) > 1)
|
||||
sprintf(name, "%s (%s)", name, str[lang+1]);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
sprintf(name, "%s", str[2]);
|
||||
if (strlen(str[3]) > 1)
|
||||
sprintf(name, "%s (%s)", name, str[3]);
|
||||
@ -549,7 +533,11 @@ s32 printContent(u64 tid){
|
||||
u8 br = 0;
|
||||
for (; strlen(ptr) > 0; ptr += strlen(ptr) + 1) {
|
||||
printf(" %-12.12s", ptr);
|
||||
br++; if (br == 4) { br = 0; printf("\n"); }
|
||||
br++;
|
||||
if (br == 4) {
|
||||
br = 0;
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
if (br != 0)
|
||||
printf("\n");
|
||||
|
@ -24,8 +24,7 @@ Copyright (C) 2008 tona and/or waninkoko
|
||||
#define _TITLE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
/* Constants */
|
||||
#define BLOCK_SIZE 1024
|
||||
|
@ -2,8 +2,7 @@
|
||||
#define _UTILS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
/* Constants */
|
||||
#define KB_SIZE 1024.0
|
||||
|
@ -117,164 +117,6 @@ out:
|
||||
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)
|
||||
{
|
||||
//////start the gui shit
|
||||
@ -575,11 +417,8 @@ out:
|
||||
free(p_tmd);
|
||||
goto exit;
|
||||
|
||||
//WindowPrompt(tr("Success"),"The wad file was installed","Ok");
|
||||
|
||||
exit:
|
||||
//promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
|
||||
//while(promptWindow.GetEffect() > 0) usleep(50);
|
||||
msg5Txt.SetText(tr("Finishing installation... Ok!"));
|
||||
promptWindow.Append(&btn1);
|
||||
while(btn1.GetState() != STATE_CLICKED){
|
||||
@ -598,7 +437,6 @@ exit:
|
||||
s32 Wad_Uninstall(FILE *fp)
|
||||
{
|
||||
//////start the gui shit
|
||||
//////start the gui shit
|
||||
GuiWindow promptWindow(472,320);
|
||||
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
||||
promptWindow.SetPosition(0, -10);
|
||||
@ -778,11 +616,8 @@ out:
|
||||
|
||||
goto exit;
|
||||
|
||||
//WindowPrompt(tr("Success"),"The wad file was installed","Ok");
|
||||
|
||||
exit:
|
||||
//promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
|
||||
//while(promptWindow.GetEffect() > 0) usleep(50);
|
||||
msg5Txt.SetText(tr("Done!"));
|
||||
promptWindow.Append(&btn1);
|
||||
while(btn1.GetState() != STATE_CLICKED){
|
||||
|
@ -10,20 +10,17 @@
|
||||
|
||||
extern u8 shutdown;
|
||||
|
||||
void __Wpad_PowerCallback(s32 chan)
|
||||
{
|
||||
void __Wpad_PowerCallback(s32 chan) {
|
||||
/* Poweroff console */
|
||||
shutdown = 1;
|
||||
}
|
||||
|
||||
void WPad_SetIdleTime(u32 seconds)
|
||||
{
|
||||
void WPad_SetIdleTime(u32 seconds) {
|
||||
/*Set idle time for wiimote*/
|
||||
WPAD_SetIdleTimeout(seconds);
|
||||
}
|
||||
|
||||
s32 Wpad_Init(void)
|
||||
{
|
||||
s32 Wpad_Init(void) {
|
||||
s32 ret;
|
||||
|
||||
/* Initialize Wiimote subsystem */
|
||||
@ -37,8 +34,7 @@ s32 Wpad_Init(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Wpad_Disconnect(void)
|
||||
{
|
||||
void Wpad_Disconnect(void) {
|
||||
u32 cnt;
|
||||
|
||||
/* Disconnect Wiimotes */
|
||||
@ -49,8 +45,7 @@ void Wpad_Disconnect(void)
|
||||
WPAD_Shutdown();
|
||||
}
|
||||
|
||||
bool IsWpadConnected()
|
||||
{
|
||||
bool IsWpadConnected() {
|
||||
int i = 0;
|
||||
u32 test = 0;
|
||||
int notconnected = 0;
|
||||
@ -77,8 +72,7 @@ u32 ButtonsHold(void) {
|
||||
#endif
|
||||
PAD_ScanPads();
|
||||
|
||||
for(i=3; i >= 0; i--)
|
||||
{
|
||||
for (i=3; i >= 0; i--) {
|
||||
buttons |= PAD_ButtonsHeld(i);
|
||||
#ifdef HW_RVL
|
||||
buttons |= WPAD_ButtonsHeld(i);
|
||||
@ -97,8 +91,7 @@ u32 ButtonsPressed(void) {
|
||||
#endif
|
||||
PAD_ScanPads();
|
||||
|
||||
for(i=3; i >= 0; i--)
|
||||
{
|
||||
for (i=3; i >= 0; i--) {
|
||||
buttons |= PAD_ButtonsDown(i);
|
||||
#ifdef HW_RVL
|
||||
buttons |= WPAD_ButtonsDown(i);
|
||||
|
@ -4,8 +4,7 @@
|
||||
#include <wiiuse/wpad.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* 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_reset;
|
||||
|
||||
static char langlist[11][22] =
|
||||
{{"Console Default"},
|
||||
static char langlist[11][22] = {{"Console Default"},
|
||||
{"Japanese"},
|
||||
{"English"},
|
||||
{"German"},
|
||||
@ -34,10 +33,10 @@ static char langlist[11][22] =
|
||||
{"Dutch"},
|
||||
{"S. Chinese"},
|
||||
{"T. Chinese"},
|
||||
{"Korean"}};
|
||||
{"Korean"}
|
||||
};
|
||||
|
||||
static char langcodes[11][3] =
|
||||
{{""},
|
||||
static char langcodes[11][3] = {{""},
|
||||
{"JA"},
|
||||
{"EN"},
|
||||
{"DE"},
|
||||
@ -47,7 +46,8 @@ static char langcodes[11][3] =
|
||||
{"NL"},
|
||||
{"ZH"},
|
||||
{"ZH"},
|
||||
{"KO"}};
|
||||
{"KO"}
|
||||
};
|
||||
|
||||
static char element_text[5000];
|
||||
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 */
|
||||
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) {
|
||||
bool opensuccess = false;
|
||||
char pathname[200];
|
||||
@ -86,8 +85,7 @@ bool OpenXMLDatabase(char* xmlfilepath, char* argdblang, bool argJPtoEN, bool op
|
||||
return true;
|
||||
}
|
||||
|
||||
void CloseXMLDatabase()
|
||||
{
|
||||
void CloseXMLDatabase() {
|
||||
/* free memory */
|
||||
if (xml_loaded) {
|
||||
mxmlDelete(nodedata);
|
||||
@ -98,8 +96,7 @@ void CloseXMLDatabase()
|
||||
|
||||
|
||||
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;
|
||||
nodefound = mxmlFindElement(currentnode, topnode, nodename, attributename, value, descend);
|
||||
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 (xml_loaded)
|
||||
@ -187,8 +183,7 @@ bool OpenXMLFile(char *filename)
|
||||
|
||||
|
||||
|
||||
char *GetLangSettingFromGame(char *gameid)
|
||||
{
|
||||
char *GetLangSettingFromGame(char *gameid) {
|
||||
int langcode;
|
||||
struct Game_CFG *game_cfg = NULL;
|
||||
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 */
|
||||
char *ConvertLangTextToCode(char *languagetxt)
|
||||
{
|
||||
char *ConvertLangTextToCode(char *languagetxt) {
|
||||
int i;
|
||||
for (i=0;i<=10;i++)
|
||||
{
|
||||
for (i=0;i<=10;i++) {
|
||||
if (!strcasecmp(languagetxt,langlist[i])) // case insensitive comparison
|
||||
return langcodes[i];
|
||||
}
|
||||
@ -216,17 +209,21 @@ char *ConvertLangTextToCode(char *languagetxt)
|
||||
}
|
||||
|
||||
|
||||
char ConvertRatingToIndex(char *ratingtext)
|
||||
{
|
||||
char ConvertRatingToIndex(char *ratingtext) {
|
||||
int type = -1;
|
||||
if (!strcmp(ratingtext,"CERO")) { type = 0; }
|
||||
if (!strcmp(ratingtext,"ESRB")) { type = 1; }
|
||||
if (!strcmp(ratingtext,"PEGI")) { type = 2; }
|
||||
if (!strcmp(ratingtext,"CERO")) {
|
||||
type = 0;
|
||||
}
|
||||
if (!strcmp(ratingtext,"ESRB")) {
|
||||
type = 1;
|
||||
}
|
||||
if (!strcmp(ratingtext,"PEGI")) {
|
||||
type = 2;
|
||||
}
|
||||
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)) {
|
||||
strlcpy(destvalue,ratingvalue,destsize);
|
||||
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: */
|
||||
/* 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 */
|
||||
char ratingtable[12][3][4] =
|
||||
{
|
||||
char ratingtable[12][3][4] = {
|
||||
{{"A"},{"E"},{"3"}},
|
||||
{{"A"},{"E"},{"4"}},
|
||||
{{"A"},{"E"},{"6"}},
|
||||
@ -262,8 +258,7 @@ void ConvertRating(char *ratingvalue, char *fromrating, char *torating, char *de
|
||||
};
|
||||
|
||||
int i;
|
||||
for (i=0;i<=11;i++)
|
||||
{
|
||||
for (i=0;i<=11;i++) {
|
||||
if (!strcmp(ratingtable[i][type],ratingvalue)) {
|
||||
strlcpy(destvalue,ratingtable[i][desttype],destsize);
|
||||
return;
|
||||
@ -296,8 +291,7 @@ void LoadTitlesFromXML(char *langtxt, bool forcejptoen)
|
||||
char title_text_EN[200] = "";
|
||||
|
||||
/* search index of id elements, load all id/titles text */
|
||||
while (nodeid != NULL)
|
||||
{
|
||||
while (nodeid != NULL) {
|
||||
nodeid = mxmlIndexFind(nodeindex,"id", NULL);
|
||||
if (nodeid != NULL) {
|
||||
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 */
|
||||
nodeindextmp = mxmlIndexNew(nodedata,"company", NULL);
|
||||
nodeidtmp = mxmlIndexReset(nodeindextmp);
|
||||
@ -353,8 +346,7 @@ void GetPublisherFromGameid(char *idtxt, char *dest, int destsize)
|
||||
char publishercode[3];
|
||||
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);
|
||||
if (nodeidtmp != NULL) {
|
||||
strlcpy(element_text,mxmlElementGetAttr(nodeidtmp, "code"),sizeof(element_text));
|
||||
@ -396,8 +388,7 @@ bool LoadGameInfoFromXML(char* gameid, char* langtxt)
|
||||
nodeid = mxmlIndexReset(nodeindex);
|
||||
*element_text = 0;
|
||||
/* search for game matching gameid */
|
||||
while (1)
|
||||
{
|
||||
while (1) {
|
||||
nodeid = mxmlIndexFind(nodeindex,"id", NULL);
|
||||
if (nodeid != NULL) {
|
||||
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);
|
||||
if (nodefound != NULL) {
|
||||
int incr = 0;
|
||||
while (nodefound != NULL)
|
||||
{
|
||||
while (nodefound != NULL) {
|
||||
++incr;
|
||||
strlcpy(gameinfo.locales[incr],mxmlElementGetAttr(nodefound, "lang"),sizeof(gameinfo.locales[incr]));
|
||||
nodefound = mxmlWalkNext(nodefound, nodedata, MXML_NO_DESCEND);
|
||||
@ -470,8 +460,7 @@ bool LoadGameInfoFromXML(char* gameid, char* langtxt)
|
||||
gameinfo.wifiCnt = 0;
|
||||
nodeindextmp = mxmlIndexNew(nodefound,"feature", NULL);
|
||||
nodeidtmp = mxmlIndexReset(nodeindextmp);
|
||||
while (nodeidtmp != NULL)
|
||||
{
|
||||
while (nodeidtmp != NULL) {
|
||||
nodeidtmp = mxmlIndexFind(nodeindextmp,"feature", NULL);
|
||||
if (nodeidtmp != NULL) {
|
||||
++gameinfo.wifiCnt;
|
||||
@ -490,8 +479,7 @@ bool LoadGameInfoFromXML(char* gameid, char* langtxt)
|
||||
gameinfo.descriptorCnt=0;
|
||||
nodeindextmp = mxmlIndexNew(nodefound,"descriptor", NULL);
|
||||
nodeidtmp = mxmlIndexReset(nodeindextmp);
|
||||
while (nodeidtmp != NULL)
|
||||
{
|
||||
while (nodeidtmp != NULL) {
|
||||
nodeidtmp = mxmlIndexFind(nodeindextmp,"descriptor", NULL);
|
||||
if (nodeidtmp != NULL) {
|
||||
++gameinfo.descriptorCnt;
|
||||
@ -511,8 +499,7 @@ bool LoadGameInfoFromXML(char* gameid, char* langtxt)
|
||||
gameinfo.accessoryReqCnt=0;
|
||||
nodeindextmp = mxmlIndexNew(nodefound,"control", NULL);
|
||||
nodeidtmp = mxmlIndexReset(nodeindextmp);
|
||||
while (nodeidtmp != NULL)
|
||||
{
|
||||
while (nodeidtmp != NULL) {
|
||||
nodeidtmp = mxmlIndexFind(nodeindextmp,"control", NULL);
|
||||
if (nodeidtmp != NULL) {
|
||||
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);
|
||||
strlcpy(gameinfo.genresplit[gameinfo.genreCnt],splitresult,sizeof(gameinfo.genresplit[gameinfo.genreCnt]));
|
||||
gameinfo.genresplit[gameinfo.genreCnt][0] = toupper(gameinfo.genresplit[gameinfo.genreCnt][0]);
|
||||
while (splitresult != NULL)
|
||||
{
|
||||
while (splitresult != NULL) {
|
||||
splitresult = strtok(NULL, delimgenre);
|
||||
if (splitresult != NULL && strcmp(splitresult,"")!=0) {
|
||||
++gameinfo.genreCnt;
|
||||
@ -598,8 +584,7 @@ bool LoadGameInfoFromXML(char* gameid, char* langtxt)
|
||||
}
|
||||
|
||||
|
||||
void PrintGameInfo(bool showfullinfo)
|
||||
{
|
||||
void PrintGameInfo(bool showfullinfo) {
|
||||
if (showfullinfo) {
|
||||
|
||||
//Con_Clear();
|
||||
@ -608,8 +593,7 @@ void PrintGameInfo(bool showfullinfo)
|
||||
//printf("title: %s\n",gameinfo.title);
|
||||
int i;
|
||||
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("\n");
|
||||
@ -621,27 +605,23 @@ void PrintGameInfo(bool showfullinfo)
|
||||
//printf("rating: %s %s (CERO: %s ESRB: %s PEGI: %s)\n",gameinfo.ratingtype, gameinfo.ratingvalue,
|
||||
// gameinfo.ratingvalueCERO,gameinfo.ratingvalueESRB,gameinfo.ratingvaluePEGI);
|
||||
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("\n");
|
||||
printf("players: %s online: %s\n",gameinfo.players,gameinfo.wifiplayers);
|
||||
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("\n");
|
||||
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("\n");
|
||||
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("\n");
|
||||
@ -704,8 +684,7 @@ void PrintGameInfo(bool showfullinfo)
|
||||
}
|
||||
|
||||
|
||||
char *MemInfo()
|
||||
{
|
||||
char *MemInfo() {
|
||||
char linebuf[300] = "";
|
||||
char memtotal[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 */
|
||||
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 */
|
||||
int len; /* Length of node */
|
||||
mxml_node_t *current; /* Current node */
|
||||
ptr = buffer;
|
||||
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->value.text.whitespace)
|
||||
*ptr++ = ' ';
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user