mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-12-24 02:41:55 +01:00
-now cache covers also cache's banners for wii and channel games.
This commit is contained in:
parent
93769c1ef4
commit
2133c1d89a
BIN
out/boot.dol
BIN
out/boot.dol
Binary file not shown.
Before Width: | Height: | Size: 3.3 MiB After Width: | Height: | Size: 3.3 MiB |
@ -252,11 +252,10 @@ void CVideo::_clearScreen()
|
||||
|
||||
void CVideo::prepare(void)
|
||||
{
|
||||
if (m_rmode->aa)
|
||||
GX_SetPixelFmt(GX_PF_RGBA6_Z24, GX_ZC_LINEAR);
|
||||
if(m_rmode->aa)
|
||||
GX_SetPixelFmt(GX_PF_RGB565_Z16, GX_ZC_LINEAR);// 16 bit color (565)
|
||||
else
|
||||
GX_SetPixelFmt(GX_PF_RGB8_Z24, GX_ZC_LINEAR);
|
||||
//GX_SetPixelFmt(GX_PF_RGB8_Z24, GX_ZC_LINEAR);
|
||||
GX_SetPixelFmt(GX_PF_RGB8_Z24, GX_ZC_LINEAR);// 24 bit color (888)
|
||||
_setViewPort(0.f, 0.f, (float)m_rmode->fbWidth, (float)m_rmode->efbHeight);
|
||||
GX_SetScissor(0, 0, m_rmode->fbWidth, m_rmode->efbHeight);
|
||||
GX_InvVtxCache();
|
||||
@ -352,7 +351,7 @@ void CVideo::prepareAAPass(int aaStep)
|
||||
y += CVideo::_jitter8[aaStep][1];
|
||||
break;
|
||||
}
|
||||
GX_SetPixelFmt(m_aaAlpha ? GX_PF_RGBA6_Z24 : GX_PF_RGB8_Z24, GX_ZC_LINEAR);
|
||||
GX_SetPixelFmt(m_aaAlpha ? GX_PF_RGBA6_Z24 : GX_PF_RGB8_Z24, GX_ZC_LINEAR);//rgba6 is 6 bit color with 6 bit alpha = 24bit (6666)
|
||||
_setViewPort(x, y, (float)w, (float)h);
|
||||
GX_SetScissor(0, 0, w, h);
|
||||
GX_InvVtxCache();
|
||||
|
@ -1088,9 +1088,10 @@ private:
|
||||
void _launchGame(dir_discHdr *hdr, bool dvd, bool disc_cfg = false);
|
||||
void _launchChannel(dir_discHdr *hdr);
|
||||
void _launchHomebrew(const char *filepath, vector<string> arguments);
|
||||
vector<string> _getMetaXML(const char *bootpath);
|
||||
void _launchGC(dir_discHdr *hdr, bool disc);
|
||||
void _launchShutdown();
|
||||
vector<string> _getMetaXML(const char *bootpath);
|
||||
void _extractBnr(const dir_discHdr *hdr);
|
||||
void _setCurrentItem(const dir_discHdr *hdr);
|
||||
void _exitWiiflow();
|
||||
void exitHandler(int ExitTo);
|
||||
|
@ -198,40 +198,12 @@ const CMenu::SOption CMenu::_debugger[3] = {
|
||||
};
|
||||
|
||||
map<u8, u8> CMenu::_installed_cios;
|
||||
u8 banner_title[84];
|
||||
|
||||
static inline int loopNum(int i, int s)
|
||||
{
|
||||
return (i + s) % s;
|
||||
}
|
||||
|
||||
static void _extractBannerTitle(int language)
|
||||
{
|
||||
memset(banner_title, 0, 84);
|
||||
CurrentBanner.GetName(banner_title, language);
|
||||
}
|
||||
|
||||
static void _extractChannelBnr(const u64 chantitle)
|
||||
{
|
||||
ChannelHandle.GetBanner(chantitle);
|
||||
}
|
||||
|
||||
static void _extractBnr(const dir_discHdr *hdr)
|
||||
{
|
||||
u32 size = 0;
|
||||
DeviceHandle.OpenWBFS(currentPartition);
|
||||
wbfs_disc_t *disc = WBFS_OpenDisc((u8 *) &hdr->id, (char *) hdr->path);
|
||||
if(disc != NULL)
|
||||
{
|
||||
void *bnr = NULL;
|
||||
size = wbfs_extract_file(disc, (char*)"opening.bnr", &bnr);
|
||||
if(size > 0)
|
||||
CurrentBanner.SetBanner((u8*)bnr, size, false, true);
|
||||
WBFS_CloseDisc(disc);
|
||||
}
|
||||
WBFS_Close();
|
||||
}
|
||||
|
||||
static int GetLanguage(const char *lang)
|
||||
{
|
||||
if (strncmp(lang, "JP", 2) == 0) return CONF_LANG_JAPANESE;
|
||||
@ -278,6 +250,22 @@ static u8 GetRequestedGameIOS(dir_discHdr *hdr)
|
||||
return IOS;
|
||||
}
|
||||
|
||||
void CMenu::_extractBnr(const dir_discHdr *hdr)
|
||||
{
|
||||
u32 size = 0;
|
||||
DeviceHandle.OpenWBFS(currentPartition);
|
||||
wbfs_disc_t *disc = WBFS_OpenDisc((u8 *) &hdr->id, (char *) hdr->path);
|
||||
if(disc != NULL)
|
||||
{
|
||||
void *bnr = NULL;
|
||||
size = wbfs_extract_file(disc, (char*)"opening.bnr", &bnr);
|
||||
if(size > 0)
|
||||
CurrentBanner.SetBanner((u8*)bnr, size, false, true);
|
||||
WBFS_CloseDisc(disc);
|
||||
}
|
||||
WBFS_Close();
|
||||
}
|
||||
|
||||
void CMenu::_setCurrentItem(const dir_discHdr *hdr)
|
||||
{
|
||||
const char *title = CoverFlow.getFilenameId(hdr, true);// with extension
|
||||
@ -702,24 +690,27 @@ void CMenu::_game(bool launch)
|
||||
currentPartition = romsPartition;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Get Banner Title for Playlog */
|
||||
CurrentBanner.ClearBanner();
|
||||
NANDemuView = hdr->type == TYPE_EMUCHANNEL;
|
||||
if(hdr->type == TYPE_CHANNEL || hdr->type == TYPE_EMUCHANNEL)
|
||||
{
|
||||
u64 chantitle = CoverFlow.getChanTitle();
|
||||
_extractChannelBnr(chantitle);
|
||||
}
|
||||
else if(hdr->type == TYPE_WII_GAME)
|
||||
_extractBnr(hdr);
|
||||
if(CurrentBanner.IsValid())
|
||||
_extractBannerTitle(GetLanguage(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str()));
|
||||
if(hdr->type == TYPE_WII_GAME || hdr->type == TYPE_CHANNEL || hdr->type == TYPE_EMUCHANNEL)
|
||||
{
|
||||
NANDemuView = hdr->type == TYPE_EMUCHANNEL;
|
||||
CurrentBanner.ClearBanner();
|
||||
if(hdr->type == TYPE_CHANNEL || hdr->type == TYPE_EMUCHANNEL)
|
||||
{
|
||||
u64 chantitle = CoverFlow.getChanTitle();
|
||||
ChannelHandle.GetBanner(chantitle);
|
||||
}
|
||||
else if(hdr->type == TYPE_WII_GAME)
|
||||
_extractBnr(hdr);
|
||||
u8 banner_title[84];
|
||||
memset(banner_title, 0, 84);
|
||||
if(CurrentBanner.IsValid())
|
||||
CurrentBanner.GetName(banner_title, GetLanguage(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str()));
|
||||
if(Playlog_Update(hdr->id, banner_title) < 0)
|
||||
Playlog_Delete();
|
||||
CurrentBanner.ClearBanner();
|
||||
}
|
||||
CurrentBanner.ClearBanner();
|
||||
|
||||
/* Finally boot it */
|
||||
gprintf("Launching game %s\n", hdr->id);
|
||||
@ -2178,12 +2169,12 @@ void * CMenu::_gameSoundThread(void *obj)
|
||||
CurrentBanner.SetBanner(cached_bnr_file, cached_bnr_size, false, true);
|
||||
else if(GameHdr->type == TYPE_WII_GAME)
|
||||
{
|
||||
_extractBnr(GameHdr);
|
||||
m->_extractBnr(GameHdr);
|
||||
m_banner_loaded = true;
|
||||
}
|
||||
else if(GameHdr->type == TYPE_CHANNEL || GameHdr->type == TYPE_EMUCHANNEL)
|
||||
{
|
||||
_extractChannelBnr(TITLE_ID(GameHdr->settings[0], GameHdr->settings[1]));
|
||||
ChannelHandle.GetBanner(TITLE_ID(GameHdr->settings[0], GameHdr->settings[1]));
|
||||
m_banner_loaded = true;
|
||||
}
|
||||
|
||||
|
@ -430,19 +430,16 @@ int CMenu::_cacheCovers()
|
||||
m_thrdMessageAdded = true;
|
||||
|
||||
bool fullCover = true;
|
||||
memset(&coverPath, 0, sizeof(coverPath));
|
||||
memset(&wfcPath, 0, sizeof(wfcPath));
|
||||
memset(&cachePath, 0, sizeof(cachePath));
|
||||
|
||||
/* get game name or ID */
|
||||
const char *gameNameOrID = CoverFlow.getFilenameId(&(*hdr));
|
||||
const char *gameNameOrID = CoverFlow.getFilenameId(&(*hdr));// &(*hdr) converts iterator to pointer to mem address
|
||||
|
||||
/* get cover png path */
|
||||
strncpy(coverPath, getBoxPath(&(*hdr)), sizeof(coverPath));
|
||||
strlcpy(coverPath, getBoxPath(&(*hdr)), sizeof(coverPath));
|
||||
if(!fsop_FileExist(coverPath))
|
||||
{
|
||||
fullCover = false;
|
||||
strncpy(coverPath, getFrontPath(&(*hdr)), sizeof(coverPath));
|
||||
strlcpy(coverPath, getFrontPath(&(*hdr)), sizeof(coverPath));
|
||||
if(!fsop_FileExist(coverPath))
|
||||
continue;
|
||||
}
|
||||
@ -467,7 +464,29 @@ int CMenu::_cacheCovers()
|
||||
/* create cover texture */
|
||||
CoverFlow.cacheCover(wfcPath, coverPath, fullCover);
|
||||
}
|
||||
|
||||
// cache wii and channel banners
|
||||
if(hdr->type == TYPE_WII_GAME || hdr->type == TYPE_CHANNEL || hdr->type == TYPE_EMUCHANNEL)
|
||||
{
|
||||
CurrentBanner.ClearBanner();
|
||||
char cached_banner[256];
|
||||
strlcpy(cached_banner, fmt("%s/%s.bnr", m_bnrCacheDir.c_str(), hdr->id), sizeof(cached_banner));
|
||||
if(fsop_FileExist(cached_banner))
|
||||
continue;
|
||||
if(hdr->type == TYPE_WII_GAME)
|
||||
{
|
||||
_extractBnr(&(*hdr));
|
||||
}
|
||||
else if(hdr->type == TYPE_CHANNEL || hdr->type == TYPE_EMUCHANNEL)
|
||||
{
|
||||
ChannelHandle.GetBanner(TITLE_ID(hdr->settings[0], hdr->settings[1]));
|
||||
}
|
||||
|
||||
if(CurrentBanner.IsValid())
|
||||
fsop_WriteFile(cached_banner, CurrentBanner.GetBannerFile(), CurrentBanner.GetBannerFileSize());
|
||||
}
|
||||
}
|
||||
CurrentBanner.ClearBanner();
|
||||
CoverFlow.startCoverLoader();
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user