* Added various options for downloading covers:

*Download order:
  - Original only     = Box -> Flat
  - Original/Original = Box -> Flat -> Alt box -> Alt flat
  - Original/Custom   = Box -> Alt box -> Flat -> Alt flat
  - Custom/Original   = Alt box -> Box -> Alt flat -> Flat
  - Custom/Custom     = Alt box -> Alt flat -> Box -> Flat
  - Custom only       = Alt box -> Alt flat
  *It's now possible to download covers from a different language or region as set in the language string and you can select what languages or regions to check (Working, but unfinished)
* Added a check for GameTDB if an alternate or custom cover is available
* Fixed GameTDB code for getting the casecolor
* Gamecube is now also included in GameTDB (Thanks lustar)
* Reverted Catagories selection menu.cpp
* And probably some things i forget to list
This commit is contained in:
overjoy.psm 2012-02-12 01:43:31 +00:00
parent af090d536b
commit 14f4bdbf84
13 changed files with 1302 additions and 153 deletions

BIN
data/images/buthcenter.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
data/images/buthleft.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

BIN
data/images/buthright.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

BIN
data/images/buthscenter.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
data/images/buthsleft.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

BIN
data/images/buthsright.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

@ -953,7 +953,7 @@ unsigned int GameTDB::FindCaseColor(char * data)
{
unsigned int color = -1;
char * ColorNode = GetNodeText(data, "<case color=\"", "\"/>");
char * ColorNode = GetNodeText(data, "<case color=\"", "\"");
if(!ColorNode)
return color;
if(strlen(ColorNode) == 0)
@ -975,6 +975,7 @@ unsigned int GameTDB::GetCaseColor(const char * id)
if(!data)
return color;
color = FindCaseColor(data);
if( color != 0xffffffff )
@ -984,6 +985,32 @@ unsigned int GameTDB::GetCaseColor(const char * id)
return color;
}
int GameTDB::GetCaseVersions(const char * id)
{
int altcase = -1;
if(!id)
return altcase;
char * data = GetGameNode(id);
if(!data)
{
gprintf("GameTDB: GameNode for %s not found\n", id);
return altcase;
}
char * PlayersNode = GetNodeText(data, "case versions=\"", "\"");
if(!PlayersNode)
{
delete [] data;
return altcase;
}
altcase = atoi(PlayersNode);
return altcase;
}
bool GameTDB::GetGameXMLInfo(const char * id, GameXMLInfo * gameInfo)
{
if(!id || !gameInfo)

View File

@ -123,6 +123,7 @@ class GameTDB
//! Get the box (case) color for a specific game id
//! Returns the color in RGB (first 3 bytes)
unsigned int GetCaseColor(const char * id);
int GetCaseVersions(const char * id);
//! Get the complete game info in the GameXMLInfo struct
bool GetGameXMLInfo(const char * id, GameXMLInfo * gameInfo);
//! Convert a specific game rating to a string

View File

@ -41,6 +41,12 @@ extern const u8 butright_png[];
extern const u8 butsleft_png[];
extern const u8 butscenter_png[];
extern const u8 butsright_png[];
extern const u8 buthleft_png[];
extern const u8 buthcenter_png[];
extern const u8 buthright_png[];
extern const u8 buthsleft_png[];
extern const u8 buthscenter_png[];
extern const u8 buthsright_png[];
extern const u8 pbarleft_png[];
extern const u8 pbarcenter_png[];
extern const u8 pbarright_png[];
@ -726,6 +732,9 @@ void CMenu::_buildMenus(void)
theme.txtFont = _font(theme.fontSet, "GENERAL", "text_font", TEXTFONT);
theme.txtFontColor = m_theme.getColor("GENERAL", "text_font_color", 0xFFFFFFFF);
theme.selsbtnFontColor = m_theme.getColor("GENERAL", "selsbtn_font_color", 0xD0BFDFFF);
theme.selubtnFontColor = m_theme.getColor("GENERAL", "selubtn_font_color", 0xD0BFDFFF);
// Default Sounds
theme.clickSound = _sound(theme.soundSet, "GENERAL", "click_sound", click_wav, click_wav_size, string("default_btn_click"), false);
theme.hoverSound = _sound(theme.soundSet, "GENERAL", "hover_sound", hover_wav, hover_wav_size, string("default_btn_hover"), false);
@ -736,14 +745,33 @@ void CMenu::_buildMenus(void)
theme.btnTexL = _texture(theme.texSet, "GENERAL", "button_texture_left", theme.btnTexL);
theme.btnTexR.fromPNG(butright_png);
theme.btnTexR = _texture(theme.texSet, "GENERAL", "button_texture_right", theme.btnTexR);
theme.btnTexC.fromPNG(butcenter_png);
theme.btnTexC = _texture(theme.texSet, "GENERAL", "button_texture_center", theme.btnTexC);
theme.btnTexC.fromPNG(butcenter_png);
theme.btnTexC = _texture(theme.texSet, "GENERAL", "button_texture_center", theme.btnTexC);
theme.btnTexLS.fromPNG(butsleft_png);
theme.btnTexLS = _texture(theme.texSet, "GENERAL", "button_texture_left_selected", theme.btnTexLS);
theme.btnTexRS.fromPNG(butsright_png);
theme.btnTexRS = _texture(theme.texSet, "GENERAL", "button_texture_right_selected", theme.btnTexRS);
theme.btnTexCS.fromPNG(butscenter_png);
theme.btnTexCS = _texture(theme.texSet, "GENERAL", "button_texture_center_selected", theme.btnTexCS);
theme.btnTexCS.fromPNG(butscenter_png);
theme.btnTexCS = _texture(theme.texSet, "GENERAL", "button_texture_center_selected", theme.btnTexCS);
theme.btnTexLH.fromPNG(buthleft_png);
theme.btnTexLH = _texture(theme.texSet, "GENERAL", "button_texture_hlleft", theme.btnTexLH);
theme.btnTexRH.fromPNG(buthright_png);
theme.btnTexRH = _texture(theme.texSet, "GENERAL", "button_texture_hlright", theme.btnTexRH);
theme.btnTexCH.fromPNG(buthcenter_png);
theme.btnTexCH = _texture(theme.texSet, "GENERAL", "button_texture_hlcenter", theme.btnTexCH);
theme.btnTexLSH.fromPNG(buthsleft_png);
theme.btnTexLSH = _texture(theme.texSet, "GENERAL", "button_texture_hlleft_selected", theme.btnTexLSH);
theme.btnTexRSH.fromPNG(buthsright_png);
theme.btnTexRSH = _texture(theme.texSet, "GENERAL", "button_texture_hlright_selected", theme.btnTexRSH);
theme.btnTexCSH.fromPNG(buthscenter_png);
theme.btnTexCSH = _texture(theme.texSet, "GENERAL", "button_texture_hlcenter_selected", theme.btnTexCSH);
theme.pbarTexL.fromPNG(pbarleft_png);
theme.pbarTexL = _texture(theme.texSet, "GENERAL", "progressbar_texture_left", theme.pbarTexL);
theme.pbarTexR.fromPNG(pbarright_png);
@ -998,6 +1026,37 @@ u32 CMenu::_addButton(CMenu::SThemeData &theme, const char *domain, SFont font,
return m_btnMgr.addButton(font, text, x, y, width, height, c, btnTexSet, clickSound, hoverSound);
}
u32 CMenu::_addSelButton(CMenu::SThemeData &theme, const char *domain, SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color)
{
SButtonTextureSet btnTexSet;
CColor c(color);
c = m_theme.getColor(domain, "color", c);
x = m_theme.getInt(domain, "x", x);
y = m_theme.getInt(domain, "y", y);
width = m_theme.getInt(domain, "width", width);
height = m_theme.getInt(domain, "height", height);
btnTexSet.left = _texture(theme.texSet, domain, "texture_left", theme.btnTexLH);
btnTexSet.right = _texture(theme.texSet, domain, "texture_right", theme.btnTexRH);
btnTexSet.center = _texture(theme.texSet, domain, "texture_center", theme.btnTexCH);
btnTexSet.leftSel = _texture(theme.texSet, domain, "texture_left_selected", theme.btnTexLSH);
btnTexSet.rightSel = _texture(theme.texSet, domain, "texture_right_selected", theme.btnTexRSH);
btnTexSet.centerSel = _texture(theme.texSet, domain, "texture_center_selected", theme.btnTexCSH);
font = _font(theme.fontSet, domain, "font", BUTTONFONT);
SmartGuiSound clickSound = _sound(theme.soundSet, domain, "click_sound", theme.clickSound->GetName());
SmartGuiSound hoverSound = _sound(theme.soundSet, domain, "hover_sound", theme.hoverSound->GetName());
u16 btnPos = _textStyle(domain, "elmstyle", FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP);
if (btnPos & FTGX_JUSTIFY_RIGHT)
x = m_vid.width() - x - width;
if (btnPos & FTGX_ALIGN_BOTTOM)
y = m_vid.height() - y - height;
return m_btnMgr.addButton(font, text, x, y, width, height, c, btnTexSet, clickSound, hoverSound);
}
u32 CMenu::_addPicButton(CMenu::SThemeData &theme, const char *domain, STexture &texNormal, STexture &texSelected, int x, int y, u32 width, u32 height)
{
x = m_theme.getInt(domain, "x", x);

View File

@ -86,6 +86,8 @@ private:
std::string m_dataDir;
std::string m_picDir;
std::string m_boxPicDir;
std::string m_cpicDir;
std::string m_boxcPicDir;
std::string m_cacheDir;
std::string m_themeDir;
std::string m_musicDir;
@ -259,6 +261,34 @@ private:
u32 m_configScreenBtnTVYP;
u32 m_configScreenLblUser[4];
//Download menu
enum CoverPrio
{
C_TYPE_PRIOA = (1<<0),
C_TYPE_PRIOB = (1<<1),
C_TYPE_EN = (1<<2),
C_TYPE_JA = (1<<3),
C_TYPE_FR = (1<<4),
C_TYPE_DE = (1<<5),
C_TYPE_ES = (1<<6),
C_TYPE_IT = (1<<7),
C_TYPE_NL = (1<<8),
C_TYPE_PT = (1<<9),
C_TYPE_RU = (1<<10),
C_TYPE_KO = (1<<11),
C_TYPE_ZHCN = (1<<12),
C_TYPE_AU = (1<<13),
C_TYPE_ONOR = (1<<14),
C_TYPE_ONCU = (1<<15),
};
enum CoverType
{
BOX = 1,
CBOX,
FLAT,
CFLAT,
};
u32 m_downloadPrioVal;
u32 m_downloadLblTitle;
u32 m_downloadPBar;
u32 m_downloadBtnCancel;
@ -270,7 +300,55 @@ private:
u32 m_downloadLblCovers;
u32 m_downloadLblGameTDB;
u32 m_downloadLblUser[4];
u32 m_downloadLblCoverPrio;
u32 m_downloadLblPrio;
u32 m_downloadBtnPrioM;
u32 m_downloadBtnPrioP;
u32 m_downloadBtnVersion;
u32 m_downloadLblCoverSet;
u32 m_downloadBtnCoverSet;
u32 m_downloadLblSetTitle;
u32 m_downloadLblRegion;
enum Regions
{
EN = 1,
JA,
FR,
DE,
ES,
IT,
NL,
PT,
RU,
KO,
ZHCN,
AU,
};
u32 m_downloadBtnEN;
u32 m_downloadBtnJA;
u32 m_downloadBtnFR;
u32 m_downloadBtnDE;
u32 m_downloadBtnES;
u32 m_downloadBtnIT;
u32 m_downloadBtnNL;
u32 m_downloadBtnPT;
u32 m_downloadBtnRU;
u32 m_downloadBtnKO;
u32 m_downloadBtnZHCN;
u32 m_downloadBtnAU;
u32 m_downloadBtnENs;
u32 m_downloadBtnJAs;
u32 m_downloadBtnFRs;
u32 m_downloadBtnDEs;
u32 m_downloadBtnESs;
u32 m_downloadBtnITs;
u32 m_downloadBtnNLs;
u32 m_downloadBtnPTs;
u32 m_downloadBtnRUs;
u32 m_downloadBtnKOs;
u32 m_downloadBtnZHCNs;
u32 m_downloadBtnAUs;
u32 m_downloadBtnBack;
static s8 _versionDownloaderInit(CMenu *m);
static s8 _versionTxtDownloaderInit(CMenu *m);
s8 _versionDownloader();
@ -441,8 +519,7 @@ private:
STexture m_controls[4];
// Category menu
u32 m_categoryBtn[12];
// u32 m_categoryBtnBack;
u32 m_categoryLblTitle;
u32 m_categoryBtnBack;
u32 m_categoryLblUser[4];
u8 m_max_categories;
u8 m_category;
@ -573,6 +650,8 @@ private:
CColor lblFontColor;
CColor txtFontColor;
CColor titleFontColor;
CColor selubtnFontColor;
CColor selsbtnFontColor;
STexture bg;
STexture btnTexL;
STexture btnTexR;
@ -580,6 +659,12 @@ private:
STexture btnTexLS;
STexture btnTexRS;
STexture btnTexCS;
STexture btnTexLH;
STexture btnTexRH;
STexture btnTexCH;
STexture btnTexLSH;
STexture btnTexRSH;
STexture btnTexCSH;
STexture pbarTexL;
STexture pbarTexR;
STexture pbarTexC;
@ -665,6 +750,7 @@ private:
void _hideConfigSnd(bool instant = false);
void _hideGame(bool instant = false);
void _hideDownload(bool instant = false);
void _hideSettings(bool instant = false);
void _hideCode(bool instant = false);
void _hideAbout(bool instant = false);
void _hideWBFS(bool instant = false);
@ -686,6 +772,7 @@ private:
void _enableNandEmu(bool fromconfig);
void _showGame(void);
void _showDownload(void);
void _showSettings();
void _showCode(void);
void _showAbout(void);
void _showCategorySettings(void);
@ -760,6 +847,7 @@ private:
SmartGuiSound _sound(CMenu::SoundSet &soundSet, const char *domain, const char *key, string name);
u16 _textStyle(const char *domain, const char *key, u16 def);
u32 _addButton(SThemeData &theme, const char *domain, SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color);
u32 _addSelButton(SThemeData &theme, const char *domain, SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color);
u32 _addPicButton(SThemeData &theme, const char *domain, STexture &texNormal, STexture &texSelected, int x, int y, u32 width, u32 height);
u32 _addTitle(SThemeData &theme, const char *domain, SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color, u16 style);
u32 _addText(SThemeData &theme, const char *domain, SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color, u16 style);

View File

@ -19,8 +19,8 @@ void CMenu::_CategorySettings()
m_btnMgr.down();
if (BTN_A_PRESSED)
{
// if (m_btnMgr.selected(m_categoryBtnBack))
// break;
if (m_btnMgr.selected(m_categoryBtnBack))
break;
for (int i = 0; i < 12; ++i)
{
if (m_btnMgr.selected(m_categoryBtn[i]))
@ -41,8 +41,7 @@ void CMenu::_CategorySettings()
void CMenu::_hideCategorySettings(bool instant)
{
// m_btnMgr.hide(m_categoryBtnBack,instant);
m_btnMgr.hide(m_categoryLblTitle,instant);
m_btnMgr.hide(m_categoryBtnBack,instant);
for (int i = 0; i < 12; ++i)
m_btnMgr.hide(m_categoryBtn[i],instant);
@ -55,8 +54,7 @@ void CMenu::_showCategorySettings(void)
{
_setBg(m_categoryBg, m_categoryBg);
// m_btnMgr.show(m_categoryBtnBack);
m_btnMgr.show(m_categoryLblTitle);
m_btnMgr.show(m_categoryBtnBack);
for (int i = 0; i < m_max_categories+1; ++i)
m_btnMgr.show(m_categoryBtn[i]);
@ -70,23 +68,21 @@ void CMenu::_initCategorySettingsMenu(CMenu::SThemeData &theme)
{
_addUserLabels(theme, m_categoryLblUser, ARRAY_SIZE(m_categoryLblUser), "CATEGORY");
m_categoryBg = _texture(theme.texSet, "CATEGORY/BG", "texture", theme.bg);
m_categoryLblTitle = _addTitle(theme, "CATEGORY/TITLE", theme.titleFont, L"", 20, 30, 600, 75, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
// m_categoryBtnBack = _addButton(theme, "CATEGORY/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor);
m_categoryBtn[0] = _addButton(theme, "CATEGORY/ALL_BTN", theme.btnFont, L"", 60, 100, 200, 50, theme.btnFontColor);
m_categoryBtn[1] = _addButton(theme, "CATEGORY/1_BTN", theme.btnFont, L"", 340, 100, 200, 50, theme.btnFontColor);
m_categoryBtn[2] = _addButton(theme, "CATEGORY/2_BTN", theme.btnFont, L"", 60, 160, 200, 50, theme.btnFontColor);
m_categoryBtn[3] = _addButton(theme, "CATEGORY/3_BTN", theme.btnFont, L"", 340, 160, 200, 50, theme.btnFontColor);
m_categoryBtn[4] = _addButton(theme, "CATEGORY/4_BTN", theme.btnFont, L"", 60, 220, 200, 50, theme.btnFontColor);
m_categoryBtn[5] = _addButton(theme, "CATEGORY/5_BTN", theme.btnFont, L"", 340, 220, 200, 50, theme.btnFontColor);
m_categoryBtn[6] = _addButton(theme, "CATEGORY/6_BTN", theme.btnFont, L"", 60, 280, 200, 50, theme.btnFontColor);
m_categoryBtn[7] = _addButton(theme, "CATEGORY/7_BTN", theme.btnFont, L"", 340, 280, 200, 50, theme.btnFontColor);
m_categoryBtn[8] = _addButton(theme, "CATEGORY/8_BTN", theme.btnFont, L"", 60, 340, 200, 50, theme.btnFontColor);
m_categoryBtn[9] = _addButton(theme, "CATEGORY/9_BTN", theme.btnFont, L"", 340, 340, 200, 50, theme.btnFontColor);
m_categoryBtn[10] = _addButton(theme, "CATEGORY/10_BTN", theme.btnFont, L"", 60, 400, 200, 50, theme.btnFontColor);
m_categoryBtn[11] = _addButton(theme, "CATEGORY/11_BTN", theme.btnFont, L"",340, 400, 200, 50, theme.btnFontColor);
m_categoryBtnBack = _addButton(theme, "CATEGORY/BACK_BTN", theme.btnFont, L"", 420, 410, 200, 56, theme.btnFontColor);
m_categoryBtn[0] = _addButton(theme, "CATEGORY/ALL_BTN", theme.btnFont, L"", 60, 40, 200, 50, theme.btnFontColor);
m_categoryBtn[1] = _addButton(theme, "CATEGORY/1_BTN", theme.btnFont, L"", 340, 40, 200, 50, theme.btnFontColor);
m_categoryBtn[2] = _addButton(theme, "CATEGORY/2_BTN", theme.btnFont, L"", 60, 100, 200, 50, theme.btnFontColor);
m_categoryBtn[3] = _addButton(theme, "CATEGORY/3_BTN", theme.btnFont, L"", 340, 100, 200, 50, theme.btnFontColor);
m_categoryBtn[4] = _addButton(theme, "CATEGORY/4_BTN", theme.btnFont, L"", 60, 160, 200, 50, theme.btnFontColor);
m_categoryBtn[5] = _addButton(theme, "CATEGORY/5_BTN", theme.btnFont, L"", 340, 160, 200, 50, theme.btnFontColor);
m_categoryBtn[6] = _addButton(theme, "CATEGORY/6_BTN", theme.btnFont, L"", 60, 220, 200, 50, theme.btnFontColor);
m_categoryBtn[7] = _addButton(theme, "CATEGORY/7_BTN", theme.btnFont, L"", 340, 220, 200, 50, theme.btnFontColor);
m_categoryBtn[8] = _addButton(theme, "CATEGORY/8_BTN", theme.btnFont, L"", 60, 280, 200, 50, theme.btnFontColor);
m_categoryBtn[9] = _addButton(theme, "CATEGORY/9_BTN", theme.btnFont, L"", 340, 280, 200, 50, theme.btnFontColor);
m_categoryBtn[10] = _addButton(theme, "CATEGORY/10_BTN", theme.btnFont, L"", 60, 340, 200, 50, theme.btnFontColor);
m_categoryBtn[11] = _addButton(theme, "CATEGORY/11_BTN", theme.btnFont, L"",340, 340, 200, 50, theme.btnFontColor);
// _setHideAnim(m_categoryBtnBack, "CATEGORY/BACK_BTN", 0, 0, -2.f, 0.f);
_setHideAnim(m_categoryLblTitle, "CATEGORY/TITLE", 0, 0, 0.f, 0.f);
_setHideAnim(m_categoryBtnBack, "CATEGORY/BACK_BTN", 0, 0, -2.f, 0.f);
_setHideAnim(m_categoryBtn[0], "CATEGORY/ALL_BTN", 0, 0, 0.f, 0.f);
for (int i = 1; i < 12; ++i)
_setHideAnim(m_categoryBtn[i], sfmt("CATEGORY/%i_BTN", i).c_str(), 0, 0, 0.f, 0.f);
@ -97,8 +93,7 @@ void CMenu::_initCategorySettingsMenu(CMenu::SThemeData &theme)
void CMenu::_textCategorySettings(void)
{
// m_btnMgr.setText(m_categoryBtnBack, _t("cd1", L"Back"));
m_btnMgr.setText(m_categoryLblTitle, _t("cg1", L"Categories"));
m_btnMgr.setText(m_categoryBtnBack, _t("cd1", L"Back"));
m_btnMgr.setText(m_categoryBtn[0], _t("dl3", L"All"));
for (int i = 1; i < 12; i++)
m_btnMgr.setText(m_categoryBtn[i], m_cat.getWString("GENERAL", sfmt("cat%d",i).c_str(), wfmt(L"Category %i",i).c_str()));

File diff suppressed because it is too large Load Diff

View File

@ -111,7 +111,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
static discHdr header ATTRIBUTE_ALIGN(32);
bool done = false;
bool out = false;
bool del_cover = false;
bool del_cover = true;
struct AutoLight { AutoLight(void) { } ~AutoLight(void) { slotLight(false); } } aw;
string cfPos = m_cf.getNextId();
@ -192,7 +192,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
break;
case CMenu::WO_REMOVE_GAME:
WBFS_RemoveGame((u8 *)m_cf.getId().c_str(), (char *) m_cf.getHdr()->path);
del_cover = m_cfg.getBool("GENERAL", "delete_cover_and_game", false);
del_cover = m_cfg.getBool("GENERAL", "delete_cover_and_game", true);
if(del_cover)
RemoveCover((char *)m_cf.getId().c_str());
m_btnMgr.show(m_wbfsPBar);