-set up cover size limit to 1090 pixel instead of 1024

This commit is contained in:
fix94.1 2012-05-05 10:46:01 +00:00
parent d896cb7436
commit 60e103b1bf
4 changed files with 160 additions and 118 deletions

View File

@ -8,6 +8,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <sys/iosupport.h> #include <sys/iosupport.h>
#include <stdarg.h>
#include "wifi_gecko.h" #include "wifi_gecko.h"
@ -18,7 +19,7 @@ bool textVideoInit = false;
bool bufferMessages = true; bool bufferMessages = true;
bool WriteToSD = false; bool WriteToSD = false;
#include <stdarg.h> char *tmpfilebuffer = NULL;
static ssize_t __out_write(struct _reent *r __attribute__((unused)), int fd __attribute__((unused)), const char *ptr, size_t len) static ssize_t __out_write(struct _reent *r __attribute__((unused)), int fd __attribute__((unused)), const char *ptr, size_t len)
{ {
@ -29,36 +30,35 @@ static ssize_t __out_write(struct _reent *r __attribute__((unused)), int fd __at
usb_sendbuffer(1, ptr, len); usb_sendbuffer(1, ptr, len);
IRQ_Restore(level); IRQ_Restore(level);
} }
return len; return len;
} }
static const devoptab_t gecko_out = { static const devoptab_t gecko_out = {
"stdout", // device name "stdout", // device name
0, // size of file structure 0, // size of file structure
NULL, // device open NULL, // device open
NULL, // device close NULL, // device close
__out_write,// device write __out_write, // device write
NULL, // device read NULL, // device read
NULL, // device seek NULL, // device seek
NULL, // device fstat NULL, // device fstat
NULL, // device stat NULL, // device stat
NULL, // device link NULL, // device link
NULL, // device unlink NULL, // device unlink
NULL, // device chdir NULL, // device chdir
NULL, // device rename NULL, // device rename
NULL, // device mkdir NULL, // device mkdir
0, // dirStateSize 0, // dirStateSize
NULL, // device diropen_r NULL, // device diropen_r
NULL, // device dirreset_r NULL, // device dirreset_r
NULL, // device dirnext_r NULL, // device dirnext_r
NULL, // device dirclose_r NULL, // device dirclose_r
NULL, // device statvfs_r NULL, // device statvfs_r
NULL, // device ftruncate_r NULL, // device ftruncate_r
NULL, // device fsync_r NULL, // device fsync_r
NULL, // device deviceData NULL, // device deviceData
NULL, // device chmod_r NULL, // device chmod_r
NULL, // device fchmod_r NULL, // device fchmod_r
}; };
static void USBGeckoOutput() static void USBGeckoOutput()
@ -67,8 +67,6 @@ static void USBGeckoOutput()
devoptab_list[STD_ERR] = &gecko_out; devoptab_list[STD_ERR] = &gecko_out;
} }
char *tmpfilebuffer = NULL;
void WriteToFile(char* tmp) void WriteToFile(char* tmp)
{ {
if(bufferMessages) if(bufferMessages)
@ -116,38 +114,50 @@ void gprintf( const char *format, ... )
SAFE_FREE(tmp); SAFE_FREE(tmp);
} }
char ascii(char s) { char ascii(char s)
if(s < 0x20) return '.'; {
if(s > 0x7E) return '.'; if(s < 0x20)
return s; return '.';
if(s > 0x7E)
return '.';
return s;
} }
void ghexdump(void *d, int len) { void ghexdump(void *d, int len)
u8 *data; {
int i, off; u8 *data;
data = (u8*)d; int i, off;
data = (u8*)d;
gprintf("\n 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF"); gprintf("\n 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF");
gprintf("\n==== =============================================== ================\n"); gprintf("\n==== =============================================== ================\n");
for (off=0; off<len; off += 16) for (off = 0; off < len; off += 16)
{ {
gprintf("%04x ",off); gprintf("%04x ",off);
for(i=0; i<16; i++) for(i = 0; i < 16; i++)
if((i+off)>=len) gprintf(" "); {
else gprintf("%02x ",data[off+i]); if((i+off)>=len)
gprintf(" ");
gprintf(" "); else
for(i=0; i<16; i++) gprintf("%02x ",data[off+i]);
if((i+off)>=len) gprintf(" "); }
else gprintf("%c",ascii(data[off+i])); gprintf(" ");
gprintf("\n"); for(i = 0; i < 16; i++)
} {
if((i+off)>=len)
gprintf(" ");
else
gprintf("%c",ascii(data[off+i]));
}
gprintf("\n");
}
} }
bool InitGecko() bool InitGecko()
{ {
if (geckoinit) return geckoinit; if (geckoinit)
return geckoinit;
USBGeckoOutput(); USBGeckoOutput();
@ -158,10 +168,11 @@ bool InitGecko()
#endif #endif
u32 geckoattached = usb_isgeckoalive(EXI_CHANNEL_1); u32 geckoattached = usb_isgeckoalive(EXI_CHANNEL_1);
if (geckoattached) if(geckoattached)
{ {
usb_flush(EXI_CHANNEL_1); usb_flush(EXI_CHANNEL_1);
return true; return true;
} }
else return false; else
return false;
} }

View File

@ -2506,7 +2506,7 @@ bool CCoverFlow::fullCoverCached(const char *id)
found = fread(&header, 1, sizeof header, file) == sizeof header found = fread(&header, 1, sizeof header, file) == sizeof header
&& header.full != 0 && m_compressTextures == (header.cmpr != 0) && header.full != 0 && m_compressTextures == (header.cmpr != 0)
&& header.getWidth() >= 8 && header.getHeight() >= 8 && header.getWidth() >= 8 && header.getHeight() >= 8
&& header.getWidth() <= 1024 && header.getHeight() <= 1024; && header.getWidth() <= 1090 && header.getHeight() <= 1090;
SAFE_CLOSE(file); SAFE_CLOSE(file);
} }
return found; return found;

View File

@ -10,7 +10,7 @@ using namespace std;
static u32 upperPower(u32 width) static u32 upperPower(u32 width)
{ {
u32 i = 8; u32 i = 8;
u32 maxWidth = 1024; u32 maxWidth = 1090;
while (i < width && i < maxWidth) while (i < width && i < maxWidth)
i <<= 1; i <<= 1;
return i; return i;
@ -280,7 +280,7 @@ STexture::TexErr STexture::fromPNG(const u8 *buffer, u8 f, Alloc alloc, u32 minM
PNGU_ReleaseImageContext(ctx); PNGU_ReleaseImageContext(ctx);
return STexture::TE_ERROR; return STexture::TE_ERROR;
} }
if (imgProp.imgWidth > 1024 || imgProp.imgHeight > 1024) if (imgProp.imgWidth > 1090 || imgProp.imgHeight > 1090)
{ {
PNGU_ReleaseImageContext(ctx); PNGU_ReleaseImageContext(ctx);
return STexture::TE_ERROR; return STexture::TE_ERROR;

View File

@ -15,10 +15,13 @@ void CMenu::_hideCategorySettings(bool instant)
m_btnMgr.hide(m_categoryLblPage, instant); m_btnMgr.hide(m_categoryLblPage, instant);
m_btnMgr.hide(m_categoryBtnPageM, instant); m_btnMgr.hide(m_categoryBtnPageM, instant);
m_btnMgr.hide(m_categoryBtnPageP, instant); m_btnMgr.hide(m_categoryBtnPageP, instant);
for (u32 i = 0; i < ARRAY_SIZE(m_categoryLblUser); ++i) for(u32 i = 0; i < ARRAY_SIZE(m_categoryLblUser); ++i)
if (m_categoryLblUser[i] != -1u) m_btnMgr.hide(m_categoryLblUser[i], instant); {
if(m_categoryLblUser[i] != -1u)
for (int i=0; i<21; ++i) m_btnMgr.hide(m_categoryLblUser[i], instant);
}
for(int i = 0; i < 21; ++i)
{ {
m_btnMgr.hide(m_categoryLblCat[i]); m_btnMgr.hide(m_categoryLblCat[i]);
m_btnMgr.hide(m_categoryBtn[i]); m_btnMgr.hide(m_categoryBtn[i]);
@ -28,7 +31,11 @@ void CMenu::_hideCategorySettings(bool instant)
void CMenu::_showCategorySettings(void) void CMenu::_showCategorySettings(void)
{ {
_setBg(m_categoryBg, m_categoryBg); _setBg(m_categoryBg, m_categoryBg);
for (u32 i = 0; i < ARRAY_SIZE(m_categoryLblUser); ++i) if (m_categoryLblUser[i] != -1u) m_btnMgr.show(m_categoryLblUser[i]); for(u32 i = 0; i < ARRAY_SIZE(m_categoryLblUser); ++i)
{
if(m_categoryLblUser[i] != -1u)
m_btnMgr.show(m_categoryLblUser[i]);
}
m_btnMgr.show(m_categoryLblTitle); m_btnMgr.show(m_categoryLblTitle);
m_btnMgr.show(m_categoryBtnBack); m_btnMgr.show(m_categoryBtnBack);
_updateCheckboxes(); _updateCheckboxes();
@ -36,57 +43,67 @@ void CMenu::_showCategorySettings(void)
void CMenu::_updateCheckboxes(void) void CMenu::_updateCheckboxes(void)
{ {
if (m_max_categories > 10) if(m_max_categories > 10)
{ {
m_btnMgr.setText(m_categoryLblPage, wfmt(L"%i / 2", C_curPage)); m_btnMgr.setText(m_categoryLblPage, wfmt(L"%i / 2", C_curPage));
m_btnMgr.show(m_categoryLblPage); m_btnMgr.show(m_categoryLblPage);
m_btnMgr.show(m_categoryBtnPageM); m_btnMgr.show(m_categoryBtnPageM);
m_btnMgr.show(m_categoryBtnPageP); m_btnMgr.show(m_categoryBtnPageP);
} }
for (int i=0; i<21; ++i) for(int i = 0; i < 21; ++i)
{ {
m_btnMgr.hide(m_categoryBtn[i]); m_btnMgr.hide(m_categoryBtn[i]);
m_btnMgr.hide(m_categoryLblCat[i]); m_btnMgr.hide(m_categoryLblCat[i]);
} }
string id; string id;
if (m_current_view != COVERFLOW_EMU) id = m_cf.getId(); if(m_current_view != COVERFLOW_EMU)
else id = m_cf.getId();
{ else
dir_discHdr *hdr = m_cf.getHdr(); {
string tempname(hdr->path); dir_discHdr *hdr = m_cf.getHdr();
tempname.erase(0, tempname.find_first_of('/')+1); string tempname(hdr->path);
string dirName = tempname.substr(0, tempname.find_first_of('/')+1); tempname.erase(0, tempname.find_first_of('/')+1);
tempname.assign(&tempname[tempname.find_last_of('/') + 1]); string dirName = tempname.substr(0, tempname.find_first_of('/')+1);
if(tempname.find_last_of('.') != string::npos) tempname.assign(&tempname[tempname.find_last_of('/') + 1]);
tempname.erase(tempname.find_last_of('.'), tempname.size() - tempname.find_last_of('.')); if(tempname.find_last_of('.') != string::npos)
id = dirName+tempname; tempname.erase(tempname.find_last_of('.'), tempname.size() - tempname.find_last_of('.'));
} id = dirName+tempname;
}
const char *catflags; const char *catflags;
if (gameSet) catflags = m_cat.getString("CATEGORIES", id, "").c_str(); if(gameSet)
else catflags = m_cat.getString(_domainFromView(), "categories", "100000000000000000000").c_str(); catflags = m_cat.getString("CATEGORIES", id, "").c_str();
else
catflags = m_cat.getString(_domainFromView(), "categories", "100000000000000000000").c_str();
memset(&m_categories, '0', sizeof(m_categories)); memset(&m_categories, '0', sizeof(m_categories));
if (strlen(catflags) == sizeof(m_categories)) memcpy(&m_categories, catflags, sizeof(m_categories)); if(strlen(catflags) == sizeof(m_categories))
memcpy(&m_categories, catflags, sizeof(m_categories));
if (C_curPage == 1) if(C_curPage == 1)
{ {
int j = 11; int j = 11;
if (m_max_categories < 11) j = m_max_categories; if(m_max_categories < 11)
for (int i = 0; i < j; ++i) j = m_max_categories;
for(int i = 0; i < j; ++i)
{ {
if (i == 0 && gameSet) continue; if(i == 0 && gameSet)
continue;
m_btnMgr.show(m_categoryLblCat[i]); m_btnMgr.show(m_categoryLblCat[i]);
if (catflags[i] == '1') m_categoryBtn[i] = m_categoryBtnCats[i]; if(catflags[i] == '1')
else m_categoryBtn[i] = m_categoryBtnCat[i]; m_categoryBtn[i] = m_categoryBtnCats[i];
else
m_categoryBtn[i] = m_categoryBtnCat[i];
m_btnMgr.show(m_categoryBtn[i]); m_btnMgr.show(m_categoryBtn[i]);
} }
} }
else else
{ {
for (int i = 11; i < m_max_categories; ++i) for(int i = 11; i < m_max_categories; ++i)
{ {
m_btnMgr.show(m_categoryLblCat[i]); m_btnMgr.show(m_categoryLblCat[i]);
if (catflags[i] == '1') m_categoryBtn[i] = m_categoryBtnCats[i]; if(catflags[i] == '1')
else m_categoryBtn[i] = m_categoryBtnCat[i]; m_categoryBtn[i] = m_categoryBtnCats[i];
else
m_categoryBtn[i] = m_categoryBtnCat[i];
m_btnMgr.show(m_categoryBtn[i]); m_btnMgr.show(m_categoryBtn[i]);
} }
} }
@ -98,56 +115,65 @@ void CMenu::_CategorySettings(bool fromGameSet)
C_curPage = 1; C_curPage = 1;
gameSet = fromGameSet; gameSet = fromGameSet;
_showCategorySettings(); _showCategorySettings();
while (true) while(true)
{ {
_mainLoopCommon(); _mainLoopCommon();
if (!m_btnMgr.selected(lastBtn)) m_btnMgr.noHover(false); if(!m_btnMgr.selected(lastBtn))
if (BTN_HOME_PRESSED || BTN_B_PRESSED) m_btnMgr.noHover(false);
{ if(BTN_HOME_PRESSED || BTN_B_PRESSED)
m_cat.save(); {
break; m_cat.save();
} break;
else if (BTN_UP_PRESSED) }
else if(BTN_UP_PRESSED)
m_btnMgr.up(); m_btnMgr.up();
else if (BTN_DOWN_PRESSED) else if(BTN_DOWN_PRESSED)
m_btnMgr.down(); m_btnMgr.down();
if (((BTN_MINUS_PRESSED || BTN_LEFT_PRESSED) && m_max_categories>11) || (BTN_A_PRESSED && m_btnMgr.selected(m_categoryBtnPageM))) if(((BTN_MINUS_PRESSED || BTN_LEFT_PRESSED) && m_max_categories>11) || (BTN_A_PRESSED && m_btnMgr.selected(m_categoryBtnPageM)))
{ {
lastBtn = m_categoryBtnPageM; lastBtn = m_categoryBtnPageM;
m_btnMgr.noHover(true); m_btnMgr.noHover(true);
C_curPage = C_curPage == 1 ? 2 : 1; C_curPage = C_curPage == 1 ? 2 : 1;
if (BTN_LEFT_PRESSED || BTN_MINUS_PRESSED) m_btnMgr.click(m_categoryBtnPageM); if(BTN_LEFT_PRESSED || BTN_MINUS_PRESSED)
m_btnMgr.click(m_categoryBtnPageM);
_updateCheckboxes(); _updateCheckboxes();
} }
else if (((BTN_PLUS_PRESSED || BTN_RIGHT_PRESSED) && m_max_categories>11) || (BTN_A_PRESSED && m_btnMgr.selected(m_categoryBtnPageP))) else if(((BTN_PLUS_PRESSED || BTN_RIGHT_PRESSED) && m_max_categories>11) || (BTN_A_PRESSED && m_btnMgr.selected(m_categoryBtnPageP)))
{ {
lastBtn = m_categoryBtnPageP; lastBtn = m_categoryBtnPageP;
m_btnMgr.noHover(true); m_btnMgr.noHover(true);
C_curPage = C_curPage == 1 ? 2 : 1; C_curPage = C_curPage == 1 ? 2 : 1;
if(BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED) m_btnMgr.click(m_categoryBtnPageP); if(BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED)
m_btnMgr.click(m_categoryBtnPageP);
_updateCheckboxes(); _updateCheckboxes();
} }
if (BTN_A_PRESSED) if(BTN_A_PRESSED)
{ {
if (m_btnMgr.selected(m_categoryBtnBack)) if(m_btnMgr.selected(m_categoryBtnBack))
{ {
m_cat.save(); m_cat.save();
break; break;
} }
for (int i = 0; i < 21; ++i) for(int i = 0; i < 21; ++i)
{ {
if (m_btnMgr.selected(m_categoryBtn[i])) if(m_btnMgr.selected(m_categoryBtn[i]))
{ {
lastBtn = m_categoryBtn[i]; lastBtn = m_categoryBtn[i];
m_btnMgr.noHover(true); m_btnMgr.noHover(true);
m_categories[i] = m_categories[i] == '1' ? '0' : '1'; m_categories[i] = m_categories[i] == '1' ? '0' : '1';
if (i == 0 && m_categories[i] == '1') for (int j=1; j<21; ++j) m_categories[j] = '0'; if(i == 0 && m_categories[i] == '1')
else m_categories[0] = '0'; {
for(int j = 1; j < 21; ++j)
m_categories[j] = '0';
}
else
m_categories[0] = '0';
char catflags[22]; char catflags[22];
memset(&catflags, 0, sizeof(catflags)); memset(&catflags, 0, sizeof(catflags));
memcpy(&catflags, &m_categories, sizeof(m_categories)); memcpy(&catflags, &m_categories, sizeof(m_categories));
string id; string id;
if (m_current_view != COVERFLOW_EMU) id = m_cf.getId(); if(m_current_view != COVERFLOW_EMU)
id = m_cf.getId();
else else
{ {
dir_discHdr *hdr = m_cf.getHdr(); dir_discHdr *hdr = m_cf.getHdr();
@ -159,9 +185,12 @@ void CMenu::_CategorySettings(bool fromGameSet)
tempname.erase(tempname.find_last_of('.'), tempname.size() - tempname.find_last_of('.')); tempname.erase(tempname.find_last_of('.'), tempname.size() - tempname.find_last_of('.'));
id = dirName+tempname; id = dirName+tempname;
} }
if (string (catflags) == "000000000000000000000") catflags[0] = '1'; if(string (catflags) == "000000000000000000000")
if (gameSet) m_cat.setString("CATEGORIES", id, catflags); catflags[0] = '1';
else m_cat.setString(_domainFromView(), "categories", catflags); if(gameSet)
m_cat.setString("CATEGORIES", id, catflags);
else
m_cat.setString(_domainFromView(), "categories", catflags);
_updateCheckboxes(); _updateCheckboxes();
break; break;
} }
@ -183,7 +212,7 @@ void CMenu::_initCategorySettingsMenu(CMenu::SThemeData &theme)
m_categoryLblCat[0] = _addLabel(theme, "CATEGORY/CAT_0", theme.lblFont, L"", 85, 390, 100, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); m_categoryLblCat[0] = _addLabel(theme, "CATEGORY/CAT_0", theme.lblFont, L"", 85, 390, 100, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_categoryBtnCat[0] = _addPicButton(theme, "CATEGORY/CAT_0_BTN", theme.checkboxoff, theme.checkboxoffs, 30, 390, 44, 48); m_categoryBtnCat[0] = _addPicButton(theme, "CATEGORY/CAT_0_BTN", theme.checkboxoff, theme.checkboxoffs, 30, 390, 44, 48);
m_categoryBtnCats[0] = _addPicButton(theme, "CATEGORY/CAT_0_BTNS", theme.checkboxon, theme.checkboxons, 30, 390, 44, 48); m_categoryBtnCats[0] = _addPicButton(theme, "CATEGORY/CAT_0_BTNS", theme.checkboxon, theme.checkboxons, 30, 390, 44, 48);
for (int i = 1; i < 6; ++i) for(int i = 1; i < 6; ++i)
{ // Page 1 { // Page 1
m_categoryLblCat[i] = _addLabel(theme, fmt("CATEGORY/CAT_%i", i), theme.lblFont, L"", 85, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); m_categoryLblCat[i] = _addLabel(theme, fmt("CATEGORY/CAT_%i", i), theme.lblFont, L"", 85, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_categoryBtnCat[i] = _addPicButton(theme, fmt("CATEGORY/CAT_%i_BTN", i), theme.checkboxoff, theme.checkboxoffs, 30, (42+i*58), 44, 48); m_categoryBtnCat[i] = _addPicButton(theme, fmt("CATEGORY/CAT_%i_BTN", i), theme.checkboxoff, theme.checkboxoffs, 30, (42+i*58), 44, 48);
@ -206,7 +235,8 @@ void CMenu::_initCategorySettingsMenu(CMenu::SThemeData &theme)
_setHideAnim(m_categoryBtnPageM, "CATEGORY/PAGE_MINUS", 0, 200, 1.f, 0.f); _setHideAnim(m_categoryBtnPageM, "CATEGORY/PAGE_MINUS", 0, 200, 1.f, 0.f);
_setHideAnim(m_categoryBtnPageP, "CATEGORY/PAGE_PLUS", 0, 200, 1.f, 0.f); _setHideAnim(m_categoryBtnPageP, "CATEGORY/PAGE_PLUS", 0, 200, 1.f, 0.f);
_setHideAnim(m_categoryBtnBack, "CATEGORY/BACK_BTN", 0, 200, 1.f, 0.f); _setHideAnim(m_categoryBtnBack, "CATEGORY/BACK_BTN", 0, 200, 1.f, 0.f);
for (int i = 0; i < 21; ++i) { for(int i = 0; i < 21; ++i)
{
_setHideAnim(m_categoryBtnCat[i], fmt("CATEGORY/CAT_%i_BTN", i), 0, 0, 1.f, 0.f); _setHideAnim(m_categoryBtnCat[i], fmt("CATEGORY/CAT_%i_BTN", i), 0, 0, 1.f, 0.f);
_setHideAnim(m_categoryBtnCats[i], fmt("CATEGORY/CAT_%i_BTNS", i), 0, 0, 1.f, 0.f); _setHideAnim(m_categoryBtnCats[i], fmt("CATEGORY/CAT_%i_BTNS", i), 0, 0, 1.f, 0.f);
_setHideAnim(m_categoryLblCat[i], fmt("CATEGORY/CAT_%i", i), 0, 0, 1.f, 0.f); _setHideAnim(m_categoryLblCat[i], fmt("CATEGORY/CAT_%i", i), 0, 0, 1.f, 0.f);
@ -220,10 +250,11 @@ void CMenu::_textCategorySettings(void)
{ {
m_btnMgr.setText(m_categoryLblTitle, _t("", L"Select Categories")); m_btnMgr.setText(m_categoryLblTitle, _t("", L"Select Categories"));
m_btnMgr.setText(m_categoryBtnBack, _t("cd1", L"Back")); m_btnMgr.setText(m_categoryBtnBack, _t("cd1", L"Back"));
for (int i=0; i<21; ++i) for(int i = 0; i < 21; ++i)
{ {
if (i == 0) m_btnMgr.setText(m_categoryLblCat[i], _t("dl3", L"All")); if(i == 0)
else m_btnMgr.setText(m_categoryLblCat[i], m_cat.getWString("GENERAL", fmt("cat%d",i), wfmt(L"Category %i",i).c_str())); m_btnMgr.setText(m_categoryLblCat[i], _t("dl3", L"All"));
else
m_btnMgr.setText(m_categoryLblCat[i], m_cat.getWString("GENERAL", fmt("cat%d",i), wfmt(L"Category %i",i).c_str()));
} }
} }