- fixed missing cache covers for real nand channels if you add covers manually and do reload cache. Thanks blackb0x!

- fixed crash when pressing 1/x or 2/y buttons (change coverflow layout) when no covers are loaded.
- fixed hiding the wait loading animation when using source menu on start.
- fixed exiting source menu on start via B button so covers show properly.
- fixed using homebrew icon.png's with transparency as covers for smallbox by restoring some old code I didn't understand. But ... sometimes the icon.png textures (.wfc) are saved as empty black boxes.
- if you get an empty black box for your homebrew cover image you can select the cover and click the 'X' delete icon. it will not delete your homebrew app but will instead delete the cover texture file (.wfc). Then you can do reload cache and hopefully your cover will be fixed.
- tried fixing cacheing covers after downloading them. works sometimes. It's a low free mem2 error if using rhapsodii shima theme and having a lot of games. if covers do not appear after downloading then i suggest rebooting wiiflow and doing reload cache first thing or switch to wiiflow's default theme and then download the covers and then switch back to rhapsodii shima theme.
This commit is contained in:
Fledge68 2020-04-08 12:06:21 -05:00
parent 3661b23096
commit ee14187e2d
11 changed files with 94 additions and 36 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 MiB

After

Width:  |  Height:  |  Size: 4.1 MiB

View File

@ -1,6 +1,6 @@
#define APP_NAME "WiiFlow WFL"
#define APP_VERSION "5.4.3"
#define APP_VERSION "5.4.4"
#define APP_DATA_DIR "wiiflow"
#define APPS_DIR "apps/wiiflow"

View File

@ -1549,6 +1549,17 @@ u64 CCoverFlow::getChanTitle(void) const
m_items[loopNum(m_covers[m_range / 2].index + m_jump, m_items.size())].hdr->settings[1]);
}
/* this is used for smallbox homebrew icon png's that have alpha transparency */
/* cover textures can't have transparency. this creates a new texture by filling the transparent parts */
void CCoverFlow::RenderTex(void)
{
if(m_renderingTex != NULL && m_renderingTex->data != NULL)
{
DrawTexture(m_renderingTex);
m_vid.renderToTexture(*m_renderingTex, true);
}
}
bool CCoverFlow::select(void)
{
if (m_covers == NULL || m_jump != 0) return false;
@ -2583,10 +2594,16 @@ public:
bool CCoverFlow::cacheCoverFile(const char *wfcPath, const char *coverPath, bool full)
{
TexData tex;
u8 textureFmt = m_compressTextures ? GX_TF_CMPR : GX_TF_RGB565;
tex.thread = true;// lets TexHandle know this texture is a cover image and in case its a homebrew icon.png
m_renderingTex = &tex;// only used if cover has alpha transparency - homebrew icon.png and sourceflow smallbox
u8 textureFmt = m_compressTextures ? GX_TF_CMPR : GX_TF_RGBA8;// always GX_TF_CMPR
if(TexHandle.fromImageFile(tex, coverPath, textureFmt, 32) != TE_OK)
{
m_renderingTex = NULL;
return false;
}
m_renderingTex = NULL;
tex.thread = false;
u32 bufSize = fixGX_GetTexBufferSize(tex.width, tex.height, tex.format, tex.maxLOD > 0 ? GX_TRUE : GX_FALSE, tex.maxLOD);
if(tex.data != NULL)
{
@ -2606,7 +2623,7 @@ bool CCoverFlow::cacheCoverFile(const char *wfcPath, const char *coverPath, bool
bool CCoverFlow::cacheCoverBuffer(const char *wfcPath, const u8 *png, bool full)
{
TexData tex;
u8 textureFmt = m_compressTextures ? GX_TF_CMPR : GX_TF_RGB565;
u8 textureFmt = m_compressTextures ? GX_TF_CMPR : GX_TF_RGB565;// always GX_TF_CMPR
if(TexHandle.fromPNG(tex, png, textureFmt, 32) != TE_OK)
return false;

View File

@ -137,6 +137,7 @@ public:
wstringEx getTitle(void) const;
u64 getChanTitle(void) const;
const char *getFilenameId(const dir_discHdr *curHdr);
void RenderTex(void);
//
static u32 InternalCoverColor(const char *ID, u32 DefCaseColor);
static bool checkCoverColor(const char *ID, const char *checkID[], u32 len);

View File

@ -430,6 +430,31 @@ TexErr STexture::fromPNG(TexData &dest, const u8 *buffer, u8 f, u32 minMipSize,
memset(tmpData2, 0, Size2);
PNGU_DecodeToRGBA8(ctx, imgProp.imgWidth, imgProp.imgHeight, tmpData2, 0, 0xFF);
PNGU_ReleaseImageContext(ctx);
// this if is only for covers that have alpha transparency - homebrew smallbox icon.png's and sourceflow smallbox
if(dest.thread && (imgProp.imgColorType == PNGU_COLOR_TYPE_GRAY_ALPHA
|| imgProp.imgColorType == PNGU_COLOR_TYPE_RGB_ALPHA)
&& imgProp.imgWidth <= 640 && imgProp.imgHeight <= 480)
{
dest.format = GX_TF_RGBA8;
dest.width = imgProp.imgWidth;
dest.height = imgProp.imgHeight;
dest.dataSize = GX_GetTexBufferSize(dest.width, dest.height, dest.format, GX_FALSE, 0);
dest.data = (u8*)MEM2_alloc(dest.dataSize);
if(dest.data == NULL)
{
Cleanup(dest);
free(tmpData2);
return TE_NOMEM;
}
_convertToRGBA8(dest.data, tmpData2, dest.width, dest.height);
DCFlushRange(dest.data, dest.dataSize);
m_vid.prepare();
m_vid.setup2DProjection(false, true);// false = prepare() already set view port, true = no scaling - draw at 640x480
CoverFlow.RenderTex();
_convertToRGBA(tmpData2, dest.data, dest.width, dest.height);
DCFlushRange(tmpData2, Size2);
Cleanup(dest);
}
tmpData2 = _genMipMaps(tmpData2, imgProp.imgWidth, imgProp.imgHeight, maxLODTmp, baseWidth, baseHeight);
if(tmpData2 == NULL)
{

View File

@ -173,7 +173,7 @@ void CVideo::init(void)
GX_SetFieldMode(m_rmode->field_rendering, ((m_rmode->viHeight == 2 * m_rmode->xfbHeight) ? GX_ENABLE : GX_DISABLE));
GX_SetCullMode(GX_CULL_NONE);
//GX_CopyDisp(m_frameBuf[m_curFB], GX_TRUE);
GX_CopyDisp(m_frameBuf[m_curFB], GX_TRUE);
GX_SetDispCopyGamma(GX_GM_1_0);
GX_ClearVtxDesc();
GX_SetVtxDesc(GX_VA_POS, GX_DIRECT);

View File

@ -129,16 +129,6 @@ bool CMenu::init(bool usb_mounted)
break;
}
}
if(drive == check)//No apps/wiiflow folder found
{
for(int i = SD; i <= USB8; i++) // Find the first writable partition
if(DeviceHandle.IsInserted(i) && DeviceHandle.GetFSType(i) != PART_FS_WBFS)
{
drive = DeviceName[i];
break;
}
}
if(drive == check) // Should not happen
{
/* Could not find a device to save configuration files on! */
@ -2167,6 +2157,12 @@ void CMenu::_initCF(void)
m_gcfg1.remove(adultDomain, id);
}
if(CoverFlow.empty())
{
dump.unload();
return;
}
if(dumpGameLst)
{
dump.save(true);
@ -2427,7 +2423,11 @@ bool CMenu::_loadChannelList(void)
{
gprintf("Adding real nand list\n");
NANDemuView = false;
bool updateCache = m_cfg.getBool(CHANNEL_DOMAIN, "update_cache");
if(updateCache)
cacheCovers = true;// real nand channels list is not cached but covers may still need to be updated
m_cacheList.CreateList(COVERFLOW_CHANNEL, std::string(), NullVector, std::string(), false);
m_cfg.remove(CHANNEL_DOMAIN, "update_cache");
for(vector<dir_discHdr>::iterator tmp_itr = m_cacheList.begin(); tmp_itr != m_cacheList.end(); tmp_itr++)
m_gameList.push_back(*tmp_itr);
}

View File

@ -1200,14 +1200,14 @@ int CMenu::_coverDownloader()
m_thrdMessage = wfmt(_fmt("dlmsg4", L"Saving %s"), path);
m_thrdMessageAdded = true;
fsop_WriteFile(path, file.data, file.size);
if(file.size > 0)
free(file.data);
/* make cover cache file (wfc) */
update_pThread(1);
m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s.wfc"), coverID.c_str());
m_thrdMessageAdded = true;
CoverFlow.cacheCoverBuffer(fmt("%s/%s.wfc", m_cacheDir.c_str(), coverID.c_str()), (u8*)file.data, true);//it may fail
if(file.size > 0)
free(file.data);
CoverFlow.cacheCoverFile(fmt("%s/%s.wfc", m_cacheDir.c_str(), coverID.c_str()), path, true);//it may fail
++count;
update_pThread(1);
@ -1339,14 +1339,14 @@ int CMenu::_coverDownloader()
m_thrdMessage = wfmt(_fmt("dlmsg4", L"Saving %s"), path);
m_thrdMessageAdded = true;
fsop_WriteFile(path, file.data, file.size);
if(file.size > 0)
free(file.data);
/* make cover cache file (wfc) */
update_pThread(1);
m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s.wfc"), coverID.c_str());
m_thrdMessageAdded = true;
CoverFlow.cacheCoverBuffer(fmt("%s/%s.wfc", m_cacheDir.c_str(), coverID.c_str()), (u8*)file.data, true);//it may fail
if(file.size > 0)
free(file.data);
CoverFlow.cacheCoverFile(fmt("%s/%s.wfc", m_cacheDir.c_str(), coverID.c_str()), path, true);//it may fail
update_pThread(1);
++count;
@ -1472,14 +1472,14 @@ int CMenu::_coverDownloader()
m_thrdMessage = wfmt(_fmt("dlmsg4", L"Saving %s"), path);
m_thrdMessageAdded = true;
fsop_WriteFile(path, file.data, file.size);
if(file.size > 0)
free(file.data);
/* make cover cache file (wfc) */
update_pThread(1);
m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverID.c_str()));
m_thrdMessageAdded = true;
CoverFlow.cacheCoverBuffer(fmt("%s/%s.wfc", m_cacheDir.c_str(), coverID.c_str()), (u8*)file.data, false);//it may fail
if(file.size > 0)
free(file.data);
CoverFlow.cacheCoverFile(fmt("%s/%s.wfc", m_cacheDir.c_str(), coverID.c_str()), path, false);//it may fail
++countFlat;
update_pThread(1);
@ -1609,14 +1609,14 @@ int CMenu::_coverDownloader()
m_thrdMessage = wfmt(_fmt("dlmsg4", L"Saving %s"), path);
m_thrdMessageAdded = true;
fsop_WriteFile(path, file.data, file.size);
if(file.size > 0)
free(file.data);
/* make wfc */
update_pThread(1);
m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverID.c_str()));
m_thrdMessageAdded = true;
CoverFlow.cacheCoverBuffer(fmt("%s/%s.wfc", m_cacheDir.c_str(), coverID.c_str()), (u8*)file.data, false);//it may fail
if(file.size > 0)
free(file.data);
CoverFlow.cacheCoverFile(fmt("%s/%s.wfc", m_cacheDir.c_str(), coverID.c_str()), path, false);//it may fail
++countFlat;
update_pThread(1);

View File

@ -552,7 +552,7 @@ void CMenu::_game(bool launch)
continue;
}
/* delete button */
else if(m_btnMgr.selected(m_gameBtnDelete) && hdr->type != TYPE_HOMEBREW)
else if(m_btnMgr.selected(m_gameBtnDelete))
{
_hideGame();
m_banner.SetShowBanner(false);
@ -560,6 +560,18 @@ void CMenu::_game(bool launch)
error(_t("errgame15", L"WiiFlow locked! Unlock WiiFlow to use this feature."));
else if(hdr->type == TYPE_CHANNEL)
error(_t("errgame17", L"Can not delete real NAND Channels!"));
else if(hdr->type == TYPE_HOMEBREW)
{
bool smallBox = m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox", false);
const char *gameNameOrID = CoverFlow.getFilenameId(hdr);
if(smallBox)
fsop_deleteFile(fmt("%s/homebrew/%s_small.wfc", m_cacheDir.c_str(), gameNameOrID));
else
fsop_deleteFile(fmt("%s/homebrew/%s.wfc", m_cacheDir.c_str(), gameNameOrID));
_initCF();
CoverFlow.select();
CoverFlow.applySettings();
}
else /* delete wii, gamecube, emunand game or plugin rom */
{
if(_wbfsOp(WO_REMOVE_GAME))

View File

@ -401,6 +401,9 @@ int CMenu::main(void)
_setMainBg();
_showCF(true);
}
else
_hideWaitMessage();
if(show_mem)
{
m_btnMgr.show(m_mem1FreeSize);
@ -417,7 +420,6 @@ int CMenu::main(void)
//this will make the source menu/flow display. what happens when a sourceflow cover is selected is taken care of later.
if((bheld && !BTN_B_HELD) || m_source_on_start)//if button b was held and now released
{
m_source_on_start = false;
bheld = false;
if(bUsed)//if b button used for something don't show souce menu or sourceflow
bUsed = false;
@ -454,8 +456,9 @@ int CMenu::main(void)
bUsed = true;
_getCustomBgTex();
_setMainBg();
_showCF(m_refreshGameList);//refresh coverflow list if new source selected
_showCF(m_refreshGameList || m_source_on_start);//refresh coverflow list if new source selected
}
m_source_on_start = false;
continue;
}
}
@ -700,7 +703,7 @@ int CMenu::main(void)
CoverFlow.pageDown();
/* change coverflow layout/mode */
else if((BTN_1_PRESSED || BTN_2_PRESSED) && !CFLocked)
else if((BTN_1_PRESSED || BTN_2_PRESSED) && !CFLocked && !CoverFlow.empty())
{
u32 curPos = CoverFlow._currentPos();
s8 direction = BTN_1_PRESSED ? 1 : -1;
@ -717,7 +720,7 @@ int CMenu::main(void)
const char *domain = _domainFromView();
/* b+down or up = move to previous or next cover in sort order */
if(BTN_DOWN_PRESSED || BTN_UP_PRESSED)
if(!CoverFlow.empty() && (BTN_DOWN_PRESSED || BTN_UP_PRESSED))
{
bUsed = true;
int sorting = m_cfg.getInt(domain, "sort", SORT_ALPHA);
@ -759,7 +762,7 @@ int CMenu::main(void)
MusicPlayer.Next();
}
/* b+plus = change sort mode */
else if(BTN_PLUS_PRESSED && !m_locked && (m_current_view < 8 || m_sourceflow))// <8 excludes plugins and homebrew
else if(!CoverFlow.empty() && BTN_PLUS_PRESSED && !m_locked && (m_current_view < 8 || m_sourceflow))// <8 excludes plugins and homebrew
{
bUsed = true;
u8 sort = 0;