mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-12-23 02:11:55 +01:00
*homebrew xml fix
*replaced all OptionsLists with the one from WiiXplorer *some other crap i don't remember
This commit is contained in:
parent
2570d6dae8
commit
bed86339f7
@ -2,8 +2,8 @@
|
||||
<app version="1">
|
||||
<name> USB Loader GX</name>
|
||||
<coder>USB Loader GX Team</coder>
|
||||
<version>1.0 r993</version>
|
||||
<release_date>201010280642</release_date>
|
||||
<version>1.0 r994</version>
|
||||
<release_date>201010280947</release_date>
|
||||
<short_description>Loads games from USB-devices</short_description>
|
||||
<long_description>USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times.
|
||||
The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller.
|
||||
|
File diff suppressed because one or more lines are too long
@ -79,14 +79,13 @@ int CheatMenu(const char * gameID)
|
||||
else break;
|
||||
case 1:
|
||||
int cntcheats = c.getCnt();
|
||||
customOptionList cheatslst(cntcheats);
|
||||
OptionList cheatslst;
|
||||
GuiCustomOptionBrowser chtBrowser(400, 280, &cheatslst, "bg_options_settings.png", 1, 90);
|
||||
chtBrowser.SetPosition(0, 90);
|
||||
chtBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
chtBrowser.SetClickable(true);
|
||||
|
||||
GuiText titleTxt(c.getGameName().c_str(), 28, ( GXColor )
|
||||
{ 0, 0, 0, 255});
|
||||
GuiText titleTxt(c.getGameName().c_str(), 28, ( GXColor ) {0, 0, 0, 255});
|
||||
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
titleTxt.SetMaxWidth(350, SCROLL_HORIZONTAL);
|
||||
titleTxt.SetPosition(12, 40);
|
||||
|
@ -212,18 +212,15 @@ int MenuHomebrewBrowse()
|
||||
|
||||
GuiImage MainButton2Img(&MainButtonImgData);
|
||||
GuiImage MainButton2ImgOver(&MainButtonImgOverData);
|
||||
GuiText MainButton2Txt(MainButtonText, 18, ( GXColor )
|
||||
{ 0, 0, 0, 255});
|
||||
GuiText MainButton2Txt(MainButtonText, 18, ( GXColor ) {0, 0, 0, 255});
|
||||
MainButton2Txt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
MainButton2Txt.SetPosition(148, -12);
|
||||
MainButton2Txt.SetMaxWidth(MainButton2Img.GetWidth() - 150, DOTTED);
|
||||
GuiText MainButton2DescTxt(MainButtonText, 18, ( GXColor )
|
||||
{ 0, 0, 0, 255});
|
||||
GuiText MainButton2DescTxt(MainButtonText, 18, ( GXColor ) {0, 0, 0, 255});
|
||||
MainButton2DescTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
MainButton2DescTxt.SetPosition(148, 15);
|
||||
MainButton2DescTxt.SetMaxWidth(MainButton2Img.GetWidth() - 150, DOTTED);
|
||||
GuiText MainButton2DescOverTxt(MainButtonText, 18, ( GXColor )
|
||||
{ 0, 0, 0, 255});
|
||||
GuiText MainButton2DescOverTxt(MainButtonText, 18, ( GXColor ) {0, 0, 0, 255});
|
||||
MainButton2DescOverTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
MainButton2DescOverTxt.SetPosition(148, 15);
|
||||
MainButton2DescOverTxt.SetMaxWidth(MainButton2Img.GetWidth() - 150, SCROLL_HORIZONTAL);
|
||||
@ -242,18 +239,15 @@ int MenuHomebrewBrowse()
|
||||
|
||||
GuiImage MainButton3Img(&MainButtonImgData);
|
||||
GuiImage MainButton3ImgOver(&MainButtonImgOverData);
|
||||
GuiText MainButton3Txt(MainButtonText, 18, ( GXColor )
|
||||
{ 0, 0, 0, 255});
|
||||
GuiText MainButton3Txt(MainButtonText, 18, ( GXColor ) {0, 0, 0, 255});
|
||||
MainButton3Txt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
MainButton3Txt.SetPosition(148, -12);
|
||||
MainButton3Txt.SetMaxWidth(MainButton3Img.GetWidth() - 150, DOTTED);
|
||||
GuiText MainButton3DescTxt(MainButtonText, 18, ( GXColor )
|
||||
{ 0, 0, 0, 255});
|
||||
GuiText MainButton3DescTxt(MainButtonText, 18, ( GXColor ) {0, 0, 0, 255});
|
||||
MainButton3DescTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
MainButton3DescTxt.SetPosition(148, 15);
|
||||
MainButton3DescTxt.SetMaxWidth(MainButton3Img.GetWidth() - 150, DOTTED);
|
||||
GuiText MainButton3DescOverTxt(MainButtonText, 18, ( GXColor )
|
||||
{ 0, 0, 0, 255});
|
||||
GuiText MainButton3DescOverTxt(MainButtonText, 18, ( GXColor ) {0, 0, 0, 255});
|
||||
MainButton3DescOverTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
MainButton3DescOverTxt.SetPosition(148, 15);
|
||||
MainButton3DescOverTxt.SetMaxWidth(MainButton3Img.GetWidth() - 150, SCROLL_HORIZONTAL);
|
||||
@ -436,11 +430,9 @@ int MenuHomebrewBrowse()
|
||||
snprintf(temp, sizeof(temp), "%smeta.xml", HomebrewFiles.GetFilepath(fileoffset));
|
||||
if (XMLInfo[0].LoadHomebrewXMLData(temp) > 0)
|
||||
{
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", XMLInfo[0].GetName());
|
||||
MainButton1Txt.SetText(MainButtonText);
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", XMLInfo[0].GetShortDescription());
|
||||
MainButton1DescTxt.SetText(MainButtonText);
|
||||
MainButton1DescOverTxt.SetText(MainButtonText);
|
||||
MainButton1Txt.SetText(XMLInfo[0].GetName());
|
||||
MainButton1DescTxt.SetText(XMLInfo[0].GetShortDescription());
|
||||
MainButton1DescOverTxt.SetText(XMLInfo[0].GetShortDescription());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -462,11 +454,9 @@ int MenuHomebrewBrowse()
|
||||
snprintf(temp, sizeof(temp), "%smeta.xml", HomebrewFiles.GetFilepath(fileoffset + 1));
|
||||
if (XMLInfo[1].LoadHomebrewXMLData(temp) > 0)
|
||||
{
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", XMLInfo[1].GetName());
|
||||
MainButton2Txt.SetText(MainButtonText);
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", XMLInfo[1].GetShortDescription());
|
||||
MainButton2DescTxt.SetText(MainButtonText);
|
||||
MainButton2DescOverTxt.SetText(MainButtonText);
|
||||
MainButton2Txt.SetText(XMLInfo[1].GetName());
|
||||
MainButton2DescTxt.SetText(XMLInfo[1].GetShortDescription());
|
||||
MainButton2DescOverTxt.SetText(XMLInfo[1].GetShortDescription());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -486,13 +476,11 @@ int MenuHomebrewBrowse()
|
||||
if (buttonsleft > 2)
|
||||
{
|
||||
snprintf(temp, sizeof(temp), "%smeta.xml", HomebrewFiles.GetFilepath(fileoffset + 2));
|
||||
if (XMLInfo[3].LoadHomebrewXMLData(temp) > 0)
|
||||
if (XMLInfo[2].LoadHomebrewXMLData(temp) > 0)
|
||||
{
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", XMLInfo[3].GetName());
|
||||
MainButton3Txt.SetText(MainButtonText);
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", XMLInfo[3].GetShortDescription());
|
||||
MainButton3DescTxt.SetText(MainButtonText);
|
||||
MainButton3DescOverTxt.SetText(MainButtonText);
|
||||
MainButton3Txt.SetText(XMLInfo[2].GetName());
|
||||
MainButton3DescTxt.SetText(XMLInfo[2].GetShortDescription());
|
||||
MainButton3DescOverTxt.SetText(XMLInfo[2].GetShortDescription());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -514,11 +502,9 @@ int MenuHomebrewBrowse()
|
||||
snprintf(temp, sizeof(temp), "%smeta.xml", HomebrewFiles.GetFilepath(fileoffset + 3));
|
||||
if (XMLInfo[3].LoadHomebrewXMLData(temp) > 0)
|
||||
{
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", XMLInfo[3].GetName());
|
||||
MainButton4Txt.SetText(MainButtonText);
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", XMLInfo[3].GetShortDescription());
|
||||
MainButton4DescTxt.SetText(MainButtonText);
|
||||
MainButton4DescOverTxt.SetText(MainButtonText);
|
||||
MainButton4Txt.SetText(XMLInfo[3].GetName());
|
||||
MainButton4DescTxt.SetText(XMLInfo[3].GetShortDescription());
|
||||
MainButton4DescOverTxt.SetText(XMLInfo[3].GetShortDescription());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -592,11 +578,11 @@ int MenuHomebrewBrowse()
|
||||
w.Append(&MainButton2);
|
||||
|
||||
snprintf(temp, sizeof(temp), "%smeta.xml", HomebrewFiles.GetFilepath(fileoffset + 2));
|
||||
if (XMLInfo[3].LoadHomebrewXMLData(temp) > 0)
|
||||
if (XMLInfo[2].LoadHomebrewXMLData(temp) > 0)
|
||||
{
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", XMLInfo[3].GetName());
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", XMLInfo[2].GetName());
|
||||
MainButton3Txt.SetText(MainButtonText);
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", XMLInfo[3].GetShortDescription());
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", XMLInfo[2].GetShortDescription());
|
||||
MainButton3DescTxt.SetText(MainButtonText);
|
||||
MainButton3DescOverTxt.SetText(MainButtonText);
|
||||
}
|
||||
|
137
source/libwiigui/OptionList.cpp
Normal file
137
source/libwiigui/OptionList.cpp
Normal file
@ -0,0 +1,137 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2010
|
||||
* by Dimok
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any
|
||||
* damages arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any
|
||||
* purpose, including commercial applications, and to alter it and
|
||||
* redistribute it freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you
|
||||
* must not claim that you wrote the original software. If you use
|
||||
* this software in a product, an acknowledgment in the product
|
||||
* documentation would be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and
|
||||
* must not be misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
*
|
||||
* for WiiXplorer 2010
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <gctypes.h>
|
||||
#include "OptionList.hpp"
|
||||
|
||||
OptionList::OptionList()
|
||||
{
|
||||
}
|
||||
|
||||
OptionList::~OptionList()
|
||||
{
|
||||
ClearList();
|
||||
}
|
||||
|
||||
void OptionList::SetName(int i, const char *format, ...)
|
||||
{
|
||||
if(i < (int) name.size())
|
||||
name[i].clear();
|
||||
|
||||
if(!format)
|
||||
return;
|
||||
|
||||
char *tmp=0;
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
if((vasprintf(&tmp, format, va)>=0) && tmp)
|
||||
{
|
||||
if(i >= (int) name.size())
|
||||
{
|
||||
Resize(i+1);
|
||||
}
|
||||
|
||||
name[i].assign(tmp);
|
||||
|
||||
listChanged = true;
|
||||
}
|
||||
va_end(va);
|
||||
|
||||
if(tmp)
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
void OptionList::SetValue(int i, const char *format, ...)
|
||||
{
|
||||
if(i < (int) value.size())
|
||||
value[i].clear();
|
||||
|
||||
char *tmp=0;
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
if((vasprintf(&tmp, format, va)>=0) && tmp)
|
||||
{
|
||||
if(i >= (int) value.size())
|
||||
{
|
||||
Resize(i+1);
|
||||
}
|
||||
|
||||
value[i].assign(tmp);
|
||||
|
||||
listChanged = true;
|
||||
}
|
||||
va_end(va);
|
||||
|
||||
if(tmp)
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
const char * OptionList::GetName(int i)
|
||||
{
|
||||
if(i < 0 || i >= (int) name.size())
|
||||
return NULL;
|
||||
|
||||
return name.at(i).c_str();
|
||||
}
|
||||
|
||||
const char * OptionList::GetValue(int i)
|
||||
{
|
||||
if(i < 0 || i >= (int) value.size())
|
||||
return NULL;
|
||||
|
||||
return value.at(i).c_str();
|
||||
}
|
||||
|
||||
void OptionList::Resize(int size)
|
||||
{
|
||||
while(size < (int) name.size())
|
||||
RemoveOption(name.size()-1);
|
||||
|
||||
int oldsize = name.size();
|
||||
|
||||
name.resize(oldsize+1);
|
||||
value.resize(oldsize+1);
|
||||
}
|
||||
|
||||
void OptionList::RemoveOption(int i)
|
||||
{
|
||||
if(i < 0 || i >= (int) name.size())
|
||||
return;
|
||||
|
||||
name.erase(name.begin()+i);
|
||||
value.erase(value.begin()+i);
|
||||
}
|
||||
|
||||
void OptionList::ClearList()
|
||||
{
|
||||
name.clear();
|
||||
value.clear();
|
||||
std::vector<std::string>().swap(name);
|
||||
std::vector<std::string>().swap(value);
|
||||
}
|
53
source/libwiigui/OptionList.hpp
Normal file
53
source/libwiigui/OptionList.hpp
Normal file
@ -0,0 +1,53 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2010
|
||||
* by Dimok
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any
|
||||
* damages arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any
|
||||
* purpose, including commercial applications, and to alter it and
|
||||
* redistribute it freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you
|
||||
* must not claim that you wrote the original software. If you use
|
||||
* this software in a product, an acknowledgment in the product
|
||||
* documentation would be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and
|
||||
* must not be misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
*
|
||||
* for WiiXplorer 2010
|
||||
***************************************************************************/
|
||||
#ifndef OPTIONLIST_HPP_
|
||||
#define OPTIONLIST_HPP_
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
class OptionList
|
||||
{
|
||||
public:
|
||||
OptionList();
|
||||
~OptionList();
|
||||
void SetName(int i, const char *format, ...) __attribute__((format (printf, 3, 4)));
|
||||
void SetValue(int i, const char *format, ...) __attribute__((format (printf, 3, 4)));
|
||||
const char * GetName(int i);
|
||||
const char * GetValue(int i);
|
||||
void Resize(int size);
|
||||
int GetLength() { return name.size(); }
|
||||
bool IsChanged() { bool ret = listChanged; listChanged = false; return ret;}
|
||||
void RemoveOption(int i);
|
||||
void ClearList();
|
||||
private:
|
||||
std::vector<std::string> name;
|
||||
std::vector<std::string> value;
|
||||
bool listChanged;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "video.h"
|
||||
#include "filelist.h"
|
||||
#include "input.h"
|
||||
#include "OptionList.hpp"
|
||||
|
||||
extern FreeTypeGX *fontSystem;
|
||||
|
||||
@ -1032,13 +1033,6 @@ class GuiNumpad: public GuiWindow
|
||||
GuiTrigger * trigB;
|
||||
};
|
||||
|
||||
typedef struct _optionlist
|
||||
{
|
||||
int length;
|
||||
char name[MAX_OPTIONS][60];
|
||||
char value[MAX_OPTIONS][30];
|
||||
} OptionList;
|
||||
|
||||
//!Display a list of menu options
|
||||
class GuiOptionBrowser: public GuiElement
|
||||
{
|
||||
|
@ -17,131 +17,11 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#define GAMESELECTSIZE 30
|
||||
#define OPTION_LIST_PADDING PAGESIZE
|
||||
|
||||
customOptionList::customOptionList(int Size)
|
||||
{
|
||||
name = value = NULL;
|
||||
size = 0;
|
||||
SetSize(Size == 0 ? PAGESIZE : Size);
|
||||
length = Size;
|
||||
changed = false;
|
||||
}
|
||||
customOptionList::~customOptionList()
|
||||
{
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
free(name[i]);
|
||||
free(value[i]);
|
||||
}
|
||||
delete[] name;
|
||||
delete[] value;
|
||||
}
|
||||
void customOptionList::SetLength(int Length) //set number of lines
|
||||
{
|
||||
if (Length < 0 || Length == length) return;
|
||||
|
||||
if (Length > size) SetSize(Length + OPTION_LIST_PADDING);
|
||||
if (Length < length)
|
||||
{
|
||||
for (int i = Length; i < length; i++)
|
||||
{
|
||||
free(name[i]); // clear unused
|
||||
name[i] = NULL;
|
||||
free(value[i]);
|
||||
value[i] = NULL;
|
||||
}
|
||||
}
|
||||
length = Length;
|
||||
changed = true;
|
||||
}
|
||||
void customOptionList::SetSize(int Size) //set number of lines
|
||||
{
|
||||
if (Size < 0 || Size == size) return;
|
||||
|
||||
if (Size > size)
|
||||
{
|
||||
char **newName = new char *[Size];
|
||||
char **newValue = new char *[Size];
|
||||
int i;
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
newName[i] = name[i]; // copy
|
||||
newValue[i] = value[i];
|
||||
}
|
||||
for (; i < Size; i++)
|
||||
{
|
||||
newName[i] = NULL; // fill rest with NULL
|
||||
newValue[i] = NULL;
|
||||
}
|
||||
delete[] name;
|
||||
name = newName; // set new
|
||||
delete[] value;
|
||||
value = newValue;
|
||||
size = Size;
|
||||
}
|
||||
}
|
||||
void customOptionList::SetName(int i, const char *format, ...)
|
||||
{
|
||||
if (i >= length) SetLength(i + 1);
|
||||
|
||||
if (i >= 0 && i < length)
|
||||
{
|
||||
if (name[i]) free(name[i]);
|
||||
name[i] = 0;
|
||||
va_list va;
|
||||
va_start( va, format );
|
||||
vasprintf(&name[i], format, va);
|
||||
va_end( va );
|
||||
changed = true;
|
||||
}
|
||||
//gprintf("customOptionList::SetName( %d, %s )\n", i, name[i] );
|
||||
}
|
||||
void customOptionList::SetValue(int i, const char *format, ...)
|
||||
{
|
||||
if (i >= length) SetLength(i + 1);
|
||||
|
||||
if (i >= 0 && i < length)
|
||||
{
|
||||
char *tmp = 0;
|
||||
va_list va;
|
||||
va_start( va, format );
|
||||
vasprintf(&tmp, format, va);
|
||||
va_end( va );
|
||||
|
||||
if (tmp)
|
||||
{
|
||||
if (value[i] && !strcmp(tmp, value[i]))
|
||||
free(tmp);
|
||||
else
|
||||
{
|
||||
free(value[i]);
|
||||
value[i] = tmp;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
//gprintf("customOptionList::SetValue( %d, %s )\n", i, value[i] );
|
||||
}
|
||||
void customOptionList::Clear(bool OnlyValue/*=false*/)
|
||||
{
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
if (!OnlyValue)
|
||||
{
|
||||
free(name[i]);
|
||||
name[i] = NULL;
|
||||
}
|
||||
free(value[i]);
|
||||
value[i] = NULL;
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for the GuiCustomOptionBrowser class.
|
||||
*/
|
||||
GuiCustomOptionBrowser::GuiCustomOptionBrowser(int w, int h, customOptionList * l, const char * custombg, int scrollon, int col2)
|
||||
GuiCustomOptionBrowser::GuiCustomOptionBrowser(int w, int h, OptionList * l, const char * custombg, int scrollon, int col2)
|
||||
{
|
||||
width = w;
|
||||
height = h;
|
||||
|
@ -1,50 +1,10 @@
|
||||
#include "gui.h"
|
||||
|
||||
class customOptionList
|
||||
{
|
||||
public:
|
||||
customOptionList(int Size);
|
||||
~customOptionList();
|
||||
void SetLength(int Length);
|
||||
void SetName(int i, const char *format, ...) __attribute__( ( format ( printf, 3, 4 ) ) );
|
||||
const char *GetName(int i)
|
||||
{
|
||||
if (i >= 0 && i < length && name[i])
|
||||
return name[i];
|
||||
else return "";
|
||||
}
|
||||
void SetValue(int i, const char *format, ...) __attribute__( ( format ( printf, 3, 4 ) ) );
|
||||
const char *GetValue(int i)
|
||||
{
|
||||
if (i >= 0 && i < length && value[i])
|
||||
return value[i];
|
||||
else return "";
|
||||
}
|
||||
void Clear(bool OnlyValue = false);
|
||||
int GetLength()
|
||||
{
|
||||
return length;
|
||||
}
|
||||
bool IsChanged()
|
||||
{
|
||||
bool ret = changed;
|
||||
changed = false;
|
||||
return ret;
|
||||
}
|
||||
private:
|
||||
void SetSize(int Size);
|
||||
int size;
|
||||
char ** name;
|
||||
char ** value;
|
||||
int length;
|
||||
bool changed;
|
||||
};
|
||||
|
||||
//!Display a list of menu options
|
||||
class GuiCustomOptionBrowser: public GuiElement
|
||||
{
|
||||
public:
|
||||
GuiCustomOptionBrowser(int w, int h, customOptionList * l, const char * background, int scrollbar, int col2);
|
||||
GuiCustomOptionBrowser(int w, int h, OptionList * l, const char * background, int scrollbar, int col2);
|
||||
~GuiCustomOptionBrowser();
|
||||
int FindMenuItem(int c, int d);
|
||||
int GetClickedOption();
|
||||
@ -64,7 +24,7 @@ class GuiCustomOptionBrowser: public GuiElement
|
||||
int coL2;
|
||||
int scrollbaron;
|
||||
|
||||
customOptionList * options;
|
||||
OptionList * options;
|
||||
int * optionIndex;
|
||||
GuiButton ** optionBtn;
|
||||
GuiText ** optionTxt;
|
||||
|
@ -223,8 +223,7 @@ GuiOptionBrowser::GuiOptionBrowser(int w, int h, OptionList * l, const char *ima
|
||||
// optionBg = new GuiImage(bgOptionsEntry);
|
||||
for (int i = 0; i < PAGESIZE; i++)
|
||||
{
|
||||
optionTxt[i] = new GuiText(options->name[i], 20, ( GXColor )
|
||||
{ 0, 0, 0, 0xff});
|
||||
optionTxt[i] = new GuiText(options->GetName(i), 20, ( GXColor ) {0, 0, 0, 0xff});
|
||||
optionTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
optionTxt[i]->SetPosition(24, 0);
|
||||
|
||||
@ -362,11 +361,12 @@ int GuiOptionBrowser::FindMenuItem(int currentItem, int direction)
|
||||
{
|
||||
int nextItem = currentItem + direction;
|
||||
|
||||
if (nextItem < 0 || nextItem >= options->length) return -1;
|
||||
if (nextItem < 0 || nextItem >= options->GetLength()) return -1;
|
||||
|
||||
if (strlen(options->name[nextItem]) > 0)
|
||||
if (options->GetName(nextItem) && strlen(options->GetName(nextItem)) > 0)
|
||||
return nextItem;
|
||||
else return FindMenuItem(nextItem, direction);
|
||||
else
|
||||
return FindMenuItem(nextItem, direction);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -409,7 +409,7 @@ void GuiOptionBrowser::TriggerUpdate()
|
||||
void GuiOptionBrowser::Update(GuiTrigger * t)
|
||||
{
|
||||
LOCK( this );
|
||||
int next, prev, lang = options->length;
|
||||
int next, prev, lang = options->GetLength();
|
||||
|
||||
//go to the last game selected
|
||||
if ((loaded == 0) && (startat > 0))
|
||||
@ -465,8 +465,8 @@ void GuiOptionBrowser::Update(GuiTrigger * t)
|
||||
optionBtn[i]->SetState(STATE_DEFAULT);
|
||||
}
|
||||
|
||||
optionTxt[i]->SetText(options->name[next]);
|
||||
optionVal[i]->SetText(options->value[next]);
|
||||
optionTxt[i]->SetText(options->GetName(next));
|
||||
optionVal[i]->SetText(options->GetValue(next));
|
||||
optionIndex[i] = next;
|
||||
next = this->FindMenuItem(next, 1);
|
||||
}
|
||||
@ -579,7 +579,7 @@ void GuiOptionBrowser::Update(GuiTrigger * t)
|
||||
}
|
||||
|
||||
if (scrollbarBoxBtn->GetState() == STATE_HELD && scrollbarBoxBtn->GetStateChan() == t->chan && t->wpad.ir.valid
|
||||
&& options->length > PAGESIZE)
|
||||
&& options->GetLength() > PAGESIZE)
|
||||
{
|
||||
scrollbarBoxBtn->SetPosition(width / 2 - 18 + 7, 0);
|
||||
int position = t->wpad.ir.y - 50 - scrollbarBoxBtn->GetTop();
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "libwiigui/gui_gamecarousel.h"
|
||||
#include "libwiigui/gui_searchbar.h"
|
||||
|
||||
#define MAX_CHARACTERS 38
|
||||
extern u8 * gameScreenTex;
|
||||
extern struct discHdr *dvdheader;
|
||||
extern u8 mountMethod;
|
||||
@ -53,7 +52,6 @@ static u32 startat = 0;
|
||||
***************************************************************************/
|
||||
int MenuDiscList()
|
||||
{
|
||||
|
||||
gprintf("MenuDiscList()\n");
|
||||
gameList.FilterList();
|
||||
int offset = MIN( ( int )startat, gameList.size() - 1 );
|
||||
@ -79,7 +77,6 @@ int MenuDiscList()
|
||||
int menu = MENU_NONE;
|
||||
|
||||
u32 nolist;
|
||||
char text[MAX_CHARACTERS + 4];
|
||||
int choice = 0, selectedold = 100;
|
||||
s32 ret;
|
||||
|
||||
@ -1403,16 +1400,6 @@ int MenuDiscList()
|
||||
if (!mountMethod)//only get this stuff it we are booting a game from USB
|
||||
{
|
||||
WBFS_GameSize(header->id, &size);
|
||||
if (strlen(GameTitles.GetTitle(header)) < (MAX_CHARACTERS + 3))
|
||||
{
|
||||
sprintf(text, "%s", GameTitles.GetTitle(header));
|
||||
}
|
||||
else
|
||||
{
|
||||
strncpy(text, GameTitles.GetTitle(header), MAX_CHARACTERS);
|
||||
text[MAX_CHARACTERS] = '\0';
|
||||
strncat(text, "...", 3);
|
||||
}
|
||||
}
|
||||
|
||||
//check if alt Dol and gct file is present
|
||||
|
@ -39,131 +39,104 @@ int MenuInstall()
|
||||
|
||||
ResumeGui();
|
||||
|
||||
while (menu == MENU_NONE)
|
||||
ret = DiscWait(tr( "Insert Disk" ), tr( "Waiting..." ), tr( "Cancel" ), 0, 0);
|
||||
if (ret < 0)
|
||||
{
|
||||
VIDEO_WaitVSync();
|
||||
WindowPrompt(tr( "Error reading Disc" ), 0, tr( "Back" ));
|
||||
menu = MENU_DISCLIST;
|
||||
}
|
||||
ret = Disc_Open();
|
||||
if (ret < 0)
|
||||
{
|
||||
WindowPrompt(tr( "Could not open Disc" ), 0, tr( "Back" ));
|
||||
menu = MENU_DISCLIST;
|
||||
}
|
||||
|
||||
ret = DiscWait(tr( "Insert Disk" ), tr( "Waiting..." ), tr( "Cancel" ), 0, 0);
|
||||
if (ret < 0)
|
||||
{
|
||||
WindowPrompt(tr( "Error reading Disc" ), 0, tr( "Back" ));
|
||||
menu = MENU_DISCLIST;
|
||||
break;
|
||||
}
|
||||
ret = Disc_Open();
|
||||
if (ret < 0)
|
||||
{
|
||||
WindowPrompt(tr( "Could not open Disc" ), 0, tr( "Back" ));
|
||||
menu = MENU_DISCLIST;
|
||||
break;
|
||||
}
|
||||
|
||||
ret = Disc_IsWii();
|
||||
if (ret < 0)
|
||||
{
|
||||
choice = WindowPrompt(tr( "Not a Wii Disc" ), tr( "Insert a Wii Disc!" ), tr( "OK" ), tr( "Back" ));
|
||||
|
||||
if (choice == 1)
|
||||
{
|
||||
menu = MENU_INSTALL;
|
||||
break;
|
||||
}
|
||||
else menu = MENU_DISCLIST;
|
||||
break;
|
||||
}
|
||||
|
||||
Disc_ReadHeader(&headerdisc);
|
||||
snprintf(name, sizeof(name), "%s", headerdisc.title);
|
||||
|
||||
ret = WBFS_CheckGame(headerdisc.id);
|
||||
if (ret)
|
||||
{
|
||||
WindowPrompt(tr( "Game is already installed:" ), name, tr( "Back" ));
|
||||
menu = MENU_DISCLIST;
|
||||
break;
|
||||
}
|
||||
|
||||
f32 freespace, used;
|
||||
|
||||
WBFS_DiskSpace(&used, &freespace);
|
||||
gamesize = WBFS_EstimeGameSize() / GB_SIZE;
|
||||
|
||||
char gametxt[50];
|
||||
|
||||
sprintf(gametxt, "%s : %.2fGB", name, gamesize);
|
||||
|
||||
wiilight(1);
|
||||
choice = WindowPrompt(tr( "Continue to install game?" ), gametxt, tr( "OK" ), tr( "Cancel" ));
|
||||
ret = Disc_IsWii();
|
||||
if (ret < 0)
|
||||
{
|
||||
choice = WindowPrompt(tr( "Not a Wii Disc" ), tr( "Insert a Wii Disc!" ), tr( "OK" ), tr( "Back" ));
|
||||
|
||||
if (choice == 1)
|
||||
{
|
||||
menu = MENU_INSTALL;
|
||||
}
|
||||
else menu = MENU_DISCLIST;
|
||||
}
|
||||
|
||||
sprintf(gametxt, "%s", tr( "Installing game:" ));
|
||||
Disc_ReadHeader(&headerdisc);
|
||||
snprintf(name, sizeof(name), "%s", headerdisc.title);
|
||||
|
||||
if (gamesize > freespace)
|
||||
{
|
||||
char errortxt[50];
|
||||
sprintf(errortxt, "%s: %.2fGB, %s: %.2fGB", tr( "Game Size" ), gamesize, tr( "Free Space" ), freespace);
|
||||
WindowPrompt(tr( "Not enough free space!" ), errortxt, tr( "OK" ));
|
||||
menu = MENU_DISCLIST;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
USBStorage2_Watchdog(0);
|
||||
SetupGameInstallProgress(gametxt, name);
|
||||
ret = WBFS_AddGame();
|
||||
ProgressStop();
|
||||
USBStorage2_Watchdog(1);
|
||||
wiilight(0);
|
||||
if (ret != 0)
|
||||
{
|
||||
WindowPrompt(tr( "Install Error!" ), 0, tr( "Back" ));
|
||||
menu = MENU_DISCLIST;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
gameList.ReadGameList(); //get the entries again
|
||||
gameList.FilterList();
|
||||
GuiSound * instsuccess = NULL;
|
||||
bgMusic->Pause();
|
||||
instsuccess = new GuiSound(success_ogg, success_ogg_size, Settings.sfxvolume);
|
||||
instsuccess->SetVolume(Settings.sfxvolume);
|
||||
instsuccess->SetLoop(0);
|
||||
instsuccess->Play();
|
||||
WindowPrompt(tr( "Successfully installed:" ), name, tr( "OK" ));
|
||||
instsuccess->Stop();
|
||||
delete instsuccess;
|
||||
bgMusic->Resume();
|
||||
menu = MENU_DISCLIST;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ret = WBFS_CheckGame(headerdisc.id);
|
||||
if (ret)
|
||||
{
|
||||
WindowPrompt(tr( "Game is already installed:" ), name, tr( "Back" ));
|
||||
menu = MENU_DISCLIST;
|
||||
}
|
||||
|
||||
f32 freespace, used;
|
||||
|
||||
WBFS_DiskSpace(&used, &freespace);
|
||||
gamesize = WBFS_EstimeGameSize() / GB_SIZE;
|
||||
|
||||
char gametxt[50];
|
||||
|
||||
sprintf(gametxt, "%s : %.2fGB", name, gamesize);
|
||||
|
||||
wiilight(1);
|
||||
choice = WindowPrompt(tr( "Continue to install game?" ), gametxt, tr( "OK" ), tr( "Cancel" ));
|
||||
|
||||
if (choice == 1)
|
||||
{
|
||||
sprintf(gametxt, "%s", tr( "Installing game:" ));
|
||||
|
||||
if (gamesize > freespace)
|
||||
{
|
||||
char errortxt[50];
|
||||
sprintf(errortxt, "%s: %.2fGB, %s: %.2fGB", tr( "Game Size" ), gamesize, tr( "Free Space" ), freespace);
|
||||
WindowPrompt(tr( "Not enough free space!" ), errortxt, tr( "OK" ));
|
||||
menu = MENU_DISCLIST;
|
||||
}
|
||||
else
|
||||
{
|
||||
menu = MENU_DISCLIST;
|
||||
break;
|
||||
}
|
||||
|
||||
if (shutdown == 1)
|
||||
{
|
||||
USBStorage2_Watchdog(0);
|
||||
SetupGameInstallProgress(gametxt, name);
|
||||
ret = WBFS_AddGame();
|
||||
ProgressStop();
|
||||
USBStorage2_Watchdog(1);
|
||||
wiilight(0);
|
||||
Sys_Shutdown();
|
||||
}
|
||||
if (reset == 1)
|
||||
{
|
||||
wiilight(0);
|
||||
Sys_Reboot();
|
||||
if (ret != 0)
|
||||
{
|
||||
WindowPrompt(tr( "Install Error!" ), 0, tr( "Back" ));
|
||||
menu = MENU_DISCLIST;
|
||||
}
|
||||
else
|
||||
{
|
||||
gameList.ReadGameList(); //get the entries again
|
||||
gameList.FilterList();
|
||||
GuiSound * instsuccess = NULL;
|
||||
bgMusic->Pause();
|
||||
instsuccess = new GuiSound(success_ogg, success_ogg_size, Settings.sfxvolume);
|
||||
instsuccess->SetVolume(Settings.sfxvolume);
|
||||
instsuccess->SetLoop(0);
|
||||
instsuccess->Play();
|
||||
WindowPrompt(tr( "Successfully installed:" ), name, tr( "OK" ));
|
||||
instsuccess->Stop();
|
||||
delete instsuccess;
|
||||
bgMusic->Resume();
|
||||
menu = MENU_DISCLIST;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
menu = MENU_DISCLIST;
|
||||
}
|
||||
|
||||
//Turn off the WiiLight
|
||||
wiilight(0);
|
||||
|
||||
HaltGui();
|
||||
|
||||
mainWindow->Remove(&w);
|
||||
ResumeGui();
|
||||
return menu;
|
||||
|
@ -16,7 +16,7 @@ extern PartList partitions;
|
||||
int SelectPartitionMenu()
|
||||
{
|
||||
bool ExitSelect = false;
|
||||
customOptionList options(MAX_PARTITIONS_EX);
|
||||
OptionList options;
|
||||
|
||||
u32 cnt, counter = 0;
|
||||
int choice = -1;
|
||||
|
@ -75,7 +75,7 @@ int DiscBrowse(struct discHdr * header, char * alternatedname, int alternatednam
|
||||
u32 discfilecount = fstbuffer[0].filelen;
|
||||
u32 dolfilecount = 0;
|
||||
|
||||
customOptionList options3(discfilecount);
|
||||
OptionList options3;
|
||||
|
||||
for (u32 i = 0; i < discfilecount; i++)
|
||||
{
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "prompts/PromptWindows.h"
|
||||
#include "prompts/gameinfo.h"
|
||||
#include "themes/CTheme.h"
|
||||
#include "utils/StringTools.h"
|
||||
#include "mload/mload.h"
|
||||
#include "fatmounter.h"
|
||||
#include "FileOperations/fileops.h"
|
||||
@ -3811,12 +3812,8 @@ int HBCWindowPrompt(const char *name, const char *coder, const char *version, co
|
||||
bool iconExist = CheckFile(imgPath);
|
||||
if (iconExist)
|
||||
{
|
||||
//! This does not crash even if there is no file
|
||||
iconData = new GuiImageData(imgPath);
|
||||
if(!iconData->GetImage())
|
||||
{
|
||||
delete iconData;
|
||||
iconData = new GuiImageData(Resources::GetFile("dialogue_box.png"), Resources::GetFileSize("dialogue_box.png"));
|
||||
}
|
||||
iconImg = new GuiImage(iconData);
|
||||
iconImg->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||
iconImg->SetPosition(45, 10);
|
||||
@ -3829,31 +3826,22 @@ int HBCWindowPrompt(const char *name, const char *coder, const char *version, co
|
||||
whiteBoxImg.SetPosition(0, 110);
|
||||
whiteBoxImg.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
whiteBoxImg.SetSkew(0, 0, 0, 0, 0, -120, 0, -120);
|
||||
/*if (Settings.wsprompt){
|
||||
dialogBoxImg.SetWidescreen(Settings.widescreen);
|
||||
}*/
|
||||
|
||||
char tmp[510];
|
||||
|
||||
GuiText nameTxt(name, 30, Theme.prompttext);
|
||||
nameTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
nameTxt.SetPosition(0, -15);
|
||||
nameTxt.SetMaxWidth(430, SCROLL_HORIZONTAL);
|
||||
|
||||
if (strcmp(coder, "")) snprintf(tmp, sizeof(tmp), tr( "Coded by: %s" ), coder);
|
||||
GuiText coderTxt(tmp, 16, Theme.prompttext);
|
||||
GuiText coderTxt(fmt(tr( "Coded by: %s" ), coder), 16, Theme.prompttext);
|
||||
coderTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||
coderTxt.SetPosition(180, 30);
|
||||
coderTxt.SetMaxWidth(280);
|
||||
|
||||
if (strcmp(version, "")) snprintf(tmp, sizeof(tmp), tr( "Version: %s" ), version);
|
||||
GuiText versionTxt(tmp, 16, Theme.prompttext);
|
||||
GuiText versionTxt(fmt(tr( "Version: %s" ), version), 16, Theme.prompttext);
|
||||
versionTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||
versionTxt.SetPosition(40, 65);
|
||||
versionTxt.SetMaxWidth(430);
|
||||
|
||||
//if (release_date)
|
||||
//snprintf(tmp, sizeof(tmp), tr("Released: %s"),release_date);
|
||||
GuiText release_dateTxt(release_date, 16, Theme.prompttext);
|
||||
release_dateTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||
release_dateTxt.SetPosition(40, 85);
|
||||
@ -3868,30 +3856,14 @@ int HBCWindowPrompt(const char *name, const char *coder, const char *version, co
|
||||
long_descriptionTxt.Refresh();
|
||||
|
||||
//convert filesize from u64 to char and put unit of measurement after it
|
||||
char temp2[7];
|
||||
char filesizeCH[15];
|
||||
f32 sizeAdjusted;
|
||||
if (filesize <= 1024.0)
|
||||
{
|
||||
sizeAdjusted = filesize;
|
||||
snprintf(temp2, sizeof(temp2), "%.2f", sizeAdjusted);
|
||||
snprintf(filesizeCH, sizeof(filesizeCH), "%s B", temp2);
|
||||
|
||||
}
|
||||
snprintf(filesizeCH, sizeof(filesizeCH), "%lld B", filesize);
|
||||
if (filesize > 1024.0)
|
||||
{
|
||||
sizeAdjusted = filesize / 1024.0;
|
||||
snprintf(temp2, sizeof(temp2), "%.2f", sizeAdjusted);
|
||||
snprintf(filesizeCH, sizeof(filesizeCH), "%s KB", temp2);
|
||||
|
||||
}
|
||||
snprintf(filesizeCH, sizeof(filesizeCH), "%0.2f KB", filesize / 1024.0);
|
||||
if (filesize > 1048576.0)
|
||||
{
|
||||
sizeAdjusted = filesize / 1048576.0;
|
||||
snprintf(temp2, sizeof(temp2), "%.2f", sizeAdjusted);
|
||||
snprintf(filesizeCH, sizeof(filesizeCH), "%s MB", temp2);
|
||||
snprintf(filesizeCH, sizeof(filesizeCH), "%0.2f MB", filesize / 1048576.0);
|
||||
|
||||
}
|
||||
GuiText filesizeTxt(filesizeCH, 16, Theme.prompttext);
|
||||
filesizeTxt.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
||||
filesizeTxt.SetPosition(-40, 12);
|
||||
@ -3933,18 +3905,18 @@ int HBCWindowPrompt(const char *name, const char *coder, const char *version, co
|
||||
promptWindow.Append(&screenShotBtn);
|
||||
|
||||
promptWindow.Append(&dialogBoxImg);
|
||||
if (strcmp(long_description, "")) promptWindow.Append(&whiteBoxImg);
|
||||
if (strcmp(long_description, "")) promptWindow.Append(&scrollbarImg);
|
||||
if (strcmp(long_description, "")) promptWindow.Append(&arrowDownBtn);
|
||||
if (strcmp(long_description, "")) promptWindow.Append(&arrowUpBtn);
|
||||
promptWindow.Append(&whiteBoxImg);
|
||||
promptWindow.Append(&scrollbarImg);
|
||||
promptWindow.Append(&arrowDownBtn);
|
||||
promptWindow.Append(&arrowUpBtn);
|
||||
|
||||
if (strcmp(name, "")) promptWindow.Append(&nameTxt);
|
||||
if (strcmp(version, "")) promptWindow.Append(&versionTxt);
|
||||
if (strcmp(coder, "")) promptWindow.Append(&coderTxt);
|
||||
if (strcmp(release_date, "")) promptWindow.Append(&release_dateTxt);
|
||||
if (strcmp(long_description, "")) promptWindow.Append(&long_descriptionTxt);
|
||||
if(strcmp(name, "") != 0) promptWindow.Append(&nameTxt);
|
||||
if(strcmp(version, "") != 0) promptWindow.Append(&versionTxt);
|
||||
if(strcmp(coder, "") != 0) promptWindow.Append(&coderTxt);
|
||||
if(strcmp(release_date, "") != 0) promptWindow.Append(&release_dateTxt);
|
||||
if(strcmp(long_description, "") != 0) promptWindow.Append(&long_descriptionTxt);
|
||||
promptWindow.Append(&filesizeTxt);
|
||||
if (iconExist) promptWindow.Append(iconImg);
|
||||
promptWindow.Append(iconImg);
|
||||
promptWindow.Append(&btn1);
|
||||
promptWindow.Append(&btn2);
|
||||
|
||||
|
@ -84,7 +84,7 @@ bool TitleSelector(char output[])
|
||||
gprintf("TitleLister(): out of memory!\n");
|
||||
return false;
|
||||
}
|
||||
customOptionList options4(num_titles + 1);
|
||||
OptionList options4;
|
||||
//write the titles on the option browser
|
||||
|
||||
s32 i = 0;
|
||||
@ -280,7 +280,7 @@ int TitleBrowser()
|
||||
gprintf("TitleBrowser(): out of memory!\n");
|
||||
return -1;
|
||||
}
|
||||
customOptionList options3(num_titles + num_sys_titles + 1);
|
||||
OptionList options3;
|
||||
//write the titles on the option browser
|
||||
|
||||
u32 i = 0;
|
||||
|
@ -142,8 +142,7 @@ int MenuSettings()
|
||||
GuiTrigger trigPlus;
|
||||
trigPlus.SetButtonOnlyTrigger(-1, WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS, 0);
|
||||
|
||||
GuiText titleTxt(tr( "Settings" ), 28, ( GXColor )
|
||||
{ 0, 0, 0, 255});
|
||||
GuiText titleTxt(tr( "Settings" ), 28, ( GXColor ) {0, 0, 0, 255});
|
||||
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
titleTxt.SetPosition(0, 40);
|
||||
|
||||
@ -165,8 +164,7 @@ int MenuSettings()
|
||||
homo.SetTrigger(&trigHome);
|
||||
|
||||
GuiImage PageindicatorImg1(&PageindicatorImgData);
|
||||
GuiText PageindicatorTxt1("1", 22, ( GXColor )
|
||||
{ 0, 0, 0, 255});
|
||||
GuiText PageindicatorTxt1("1", 22, ( GXColor ) {0, 0, 0, 255});
|
||||
GuiButton PageIndicatorBtn1(PageindicatorImg1.GetWidth(), PageindicatorImg1.GetHeight());
|
||||
PageIndicatorBtn1.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
PageIndicatorBtn1.SetPosition(165, 400);
|
||||
@ -178,8 +176,7 @@ int MenuSettings()
|
||||
PageIndicatorBtn1.SetEffectGrow();
|
||||
|
||||
GuiImage PageindicatorImg2(&PageindicatorImgData);
|
||||
GuiText PageindicatorTxt2("2", 22, ( GXColor )
|
||||
{ 0, 0, 0, 255});
|
||||
GuiText PageindicatorTxt2("2", 22, ( GXColor ) {0, 0, 0, 255});
|
||||
GuiButton PageIndicatorBtn2(PageindicatorImg2.GetWidth(), PageindicatorImg2.GetHeight());
|
||||
PageIndicatorBtn2.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
PageIndicatorBtn2.SetPosition(200, 400);
|
||||
@ -191,8 +188,7 @@ int MenuSettings()
|
||||
PageIndicatorBtn2.SetEffectGrow();
|
||||
|
||||
GuiImage PageindicatorImg3(&PageindicatorImgData);
|
||||
GuiText PageindicatorTxt3("3", 22, ( GXColor )
|
||||
{ 0, 0, 0, 255});
|
||||
GuiText PageindicatorTxt3("3", 22, ( GXColor ) {0, 0, 0, 255});
|
||||
GuiButton PageIndicatorBtn3(PageindicatorImg3.GetWidth(), PageindicatorImg3.GetHeight());
|
||||
PageIndicatorBtn3.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
PageIndicatorBtn3.SetPosition(235, 400);
|
||||
@ -232,8 +228,7 @@ int MenuSettings()
|
||||
|
||||
GuiImage MainButton1Img(&MainButtonImgData);
|
||||
GuiImage MainButton1ImgOver(&MainButtonImgOverData);
|
||||
GuiText MainButton1Txt(MainButtonText, 22, ( GXColor )
|
||||
{ 0, 0, 0, 255});
|
||||
GuiText MainButton1Txt(MainButtonText, 22, ( GXColor ) {0, 0, 0, 255});
|
||||
MainButton1Txt.SetMaxWidth(MainButton1Img.GetWidth());
|
||||
GuiButton MainButton1(MainButton1Img.GetWidth(), MainButton1Img.GetHeight());
|
||||
MainButton1.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
@ -248,8 +243,7 @@ int MenuSettings()
|
||||
|
||||
GuiImage MainButton2Img(&MainButtonImgData);
|
||||
GuiImage MainButton2ImgOver(&MainButtonImgOverData);
|
||||
GuiText MainButton2Txt(MainButtonText, 22, ( GXColor )
|
||||
{ 0, 0, 0, 255});
|
||||
GuiText MainButton2Txt(MainButtonText, 22, ( GXColor ) {0, 0, 0, 255});
|
||||
MainButton2Txt.SetMaxWidth(MainButton2Img.GetWidth());
|
||||
GuiButton MainButton2(MainButton2Img.GetWidth(), MainButton2Img.GetHeight());
|
||||
MainButton2.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
@ -264,8 +258,7 @@ int MenuSettings()
|
||||
|
||||
GuiImage MainButton3Img(&MainButtonImgData);
|
||||
GuiImage MainButton3ImgOver(&MainButtonImgOverData);
|
||||
GuiText MainButton3Txt(MainButtonText, 22, ( GXColor )
|
||||
{ 0, 0, 0, 255});
|
||||
GuiText MainButton3Txt(MainButtonText, 22, ( GXColor ) {0, 0, 0, 255});
|
||||
MainButton3Txt.SetMaxWidth(MainButton3Img.GetWidth());
|
||||
GuiButton MainButton3(MainButton3Img.GetWidth(), MainButton3Img.GetHeight());
|
||||
MainButton3.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
@ -280,8 +273,7 @@ int MenuSettings()
|
||||
|
||||
GuiImage MainButton4Img(&MainButtonImgData);
|
||||
GuiImage MainButton4ImgOver(&MainButtonImgOverData);
|
||||
GuiText MainButton4Txt(MainButtonText, 22, ( GXColor )
|
||||
{ 0, 0, 0, 255});
|
||||
GuiText MainButton4Txt(MainButtonText, 22, ( GXColor ) {0, 0, 0, 255});
|
||||
MainButton4Txt.SetMaxWidth(MainButton4Img.GetWidth());
|
||||
GuiButton MainButton4(MainButton4Img.GetWidth(), MainButton4Img.GetHeight());
|
||||
MainButton4.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
@ -294,7 +286,7 @@ int MenuSettings()
|
||||
MainButton4.SetEffectGrow();
|
||||
MainButton4.SetTrigger(&trigA);
|
||||
|
||||
customOptionList options2(MAXOPTIONS);
|
||||
OptionList options2;
|
||||
GuiCustomOptionBrowser optionBrowser2(396, 280, &options2, "bg_options_settings.png", 0, 150);
|
||||
optionBrowser2.SetPosition(0, 90);
|
||||
optionBrowser2.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
@ -657,7 +649,7 @@ int MenuSettings()
|
||||
w.Remove(&MainButton4);
|
||||
titleTxt.SetText(tr( "GUI Settings" ));
|
||||
exit = false;
|
||||
options2.SetLength(0);
|
||||
options2.ClearList();
|
||||
// optionBrowser2.SetScrollbar(1);
|
||||
w.Append(&optionBrowser2);
|
||||
optionBrowser2.SetClickable(true);
|
||||
@ -929,7 +921,7 @@ int MenuSettings()
|
||||
w.Remove(&MainButton4);
|
||||
titleTxt.SetText(tr( "Game Load" ));
|
||||
exit = false;
|
||||
options2.SetLength(0);
|
||||
options2.ClearList();
|
||||
w.Append(&optionBrowser2);
|
||||
optionBrowser2.SetClickable(true);
|
||||
ResumeGui();
|
||||
@ -1161,7 +1153,7 @@ int MenuSettings()
|
||||
w.Remove(&MainButton4);
|
||||
titleTxt.SetText(tr( "Parental Control" ));
|
||||
exit = false;
|
||||
options2.SetLength(0);
|
||||
options2.ClearList();
|
||||
w.Append(&optionBrowser2);
|
||||
optionBrowser2.SetClickable(true);
|
||||
ResumeGui();
|
||||
@ -1352,7 +1344,7 @@ int MenuSettings()
|
||||
w.Remove(&MainButton4);
|
||||
titleTxt.SetText(tr( "Sound" ));
|
||||
exit = false;
|
||||
options2.SetLength(0);
|
||||
options2.ClearList();
|
||||
w.Append(&optionBrowser2);
|
||||
optionBrowser2.SetClickable(true);
|
||||
ResumeGui();
|
||||
@ -1564,7 +1556,7 @@ int MenuSettings()
|
||||
w.Remove(&MainButton4);
|
||||
titleTxt.SetText(tr( "Custom Paths" ));
|
||||
exit = false;
|
||||
options2.SetLength(0);
|
||||
options2.ClearList();
|
||||
// optionBrowser2.SetScrollbar(1);
|
||||
w.Append(&optionBrowser2);
|
||||
optionBrowser2.SetClickable(true);
|
||||
@ -2389,8 +2381,7 @@ int MenuGameSettings(struct discHdr * header)
|
||||
|
||||
GuiImage MainButton4Img(&MainButtonImgData);
|
||||
GuiImage MainButton4ImgOver(&MainButtonImgOverData);
|
||||
GuiText MainButton4Txt(MainButtonText, 22, ( GXColor )
|
||||
{ 0, 0, 0, 255});
|
||||
GuiText MainButton4Txt(MainButtonText, 22, ( GXColor ) {0, 0, 0, 255});
|
||||
MainButton4Txt.SetMaxWidth(MainButton4Img.GetWidth());
|
||||
GuiButton MainButton4(MainButton4Img.GetWidth(), MainButton4Img.GetHeight());
|
||||
MainButton4.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
@ -2403,7 +2394,7 @@ int MenuGameSettings(struct discHdr * header)
|
||||
MainButton4.SetEffectGrow();
|
||||
MainButton4.SetTrigger(&trigA);
|
||||
|
||||
customOptionList options2(MAXOPTIONS);
|
||||
OptionList options2;
|
||||
GuiCustomOptionBrowser optionBrowser2(396, 280, &options2, "bg_options_settings.png", 0, 150);
|
||||
optionBrowser2.SetPosition(0, 90);
|
||||
optionBrowser2.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
@ -2523,7 +2514,7 @@ int MenuGameSettings(struct discHdr * header)
|
||||
w.Remove(&MainButton3);
|
||||
w.Remove(&MainButton4);
|
||||
exit = false;
|
||||
options2.SetLength(0);
|
||||
options2.ClearList();
|
||||
w.Append(&optionBrowser2);
|
||||
optionBrowser2.SetClickable(true);
|
||||
ResumeGui();
|
||||
@ -2705,7 +2696,7 @@ int MenuGameSettings(struct discHdr * header)
|
||||
if (last_alternatedol != 1)
|
||||
{
|
||||
firstRun = true; // force re-init follow Entries
|
||||
options2.SetLength(Idx + 1);
|
||||
options2.Resize(Idx + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2779,7 +2770,7 @@ int MenuGameSettings(struct discHdr * header)
|
||||
if (game_cfg.loadalternatedol == 0)
|
||||
{
|
||||
firstRun = true; // force re-init follow Entries
|
||||
options2.SetLength(Idx--); // remove this Entry
|
||||
options2.Resize(Idx--); // remove this Entry
|
||||
options2.SetValue(Idx, "%s", tr( "Default" )); // re-set prev Entry
|
||||
}
|
||||
else options2.SetValue(Idx, alternatedname);
|
||||
@ -2835,7 +2826,7 @@ int MenuGameSettings(struct discHdr * header)
|
||||
w.Remove(&MainButton3);
|
||||
w.Remove(&MainButton4);
|
||||
exit = false;
|
||||
options2.SetLength(0);
|
||||
options2.ClearList();
|
||||
w.Append(&optionBrowser2);
|
||||
optionBrowser2.SetClickable(true);
|
||||
ResumeGui();
|
||||
|
@ -191,7 +191,7 @@ int MenuLanguageSelect()
|
||||
updateBtn.SetTrigger( &trigA );
|
||||
updateBtn.SetEffectGrow();
|
||||
|
||||
customOptionList options2( Dir.GetFilecount() );
|
||||
OptionList options2;
|
||||
|
||||
for ( cnt = 0; cnt < Dir.GetFilecount(); cnt++ )
|
||||
{
|
||||
|
@ -44,6 +44,8 @@ GameList::GameList()
|
||||
|
||||
void GameList::clear()
|
||||
{
|
||||
GameFilter.clear();
|
||||
AvailableSearchChars.clear();
|
||||
FullGameList.clear();
|
||||
FilteredList.clear();
|
||||
//! Clear memory of the vector completely
|
||||
@ -71,8 +73,8 @@ struct discHdr * GameList::GetDiscHeader(const char * gameID)
|
||||
|
||||
int GameList::ReadGameList()
|
||||
{
|
||||
FullGameList.clear();
|
||||
FilteredList.clear();
|
||||
// Clear list
|
||||
clear();
|
||||
|
||||
// Retrieve all stuff from WBFS
|
||||
u32 cnt;
|
||||
@ -80,6 +82,10 @@ int GameList::ReadGameList()
|
||||
int ret = WBFS_GetCount(&cnt);
|
||||
if (ret < 0) return -1;
|
||||
|
||||
// We are done here if no games are there
|
||||
if(cnt == 0)
|
||||
return 0;
|
||||
|
||||
/* Buffer length */
|
||||
u32 len = sizeof(struct discHdr) * cnt;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user