mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2025-03-01 18:15:26 +01:00
-homebrew coverflow view now uses folder names instead of
small and uppercase IDs for cover name and cache (issue 72)
This commit is contained in:
parent
ec69ecb55f
commit
5457c30a83
@ -53,4 +53,5 @@ Triiforce"
|
|||||||
|
|
||||||
#define WII_MAGIC 0x5D1C9EA3
|
#define WII_MAGIC 0x5D1C9EA3
|
||||||
#define GC_MAGIC 0xC2339F3D
|
#define GC_MAGIC 0xC2339F3D
|
||||||
#define EMU_MAGIC 0x4C4F4C4F
|
#define PLUGIN_MAGIC 0x4C4F4C4F
|
||||||
|
#define HB_MAGIC 0x484F4D45
|
||||||
|
@ -2555,14 +2555,14 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq)
|
|||||||
if (!!zBuffer && (!m_compressCache || compress(zBuffer.get(), &zBufferSize, tex.data.get(), bufSize) == Z_OK))
|
if (!!zBuffer && (!m_compressCache || compress(zBuffer.get(), &zBufferSize, tex.data.get(), bufSize) == Z_OK))
|
||||||
{
|
{
|
||||||
char gamePath[256];
|
char gamePath[256];
|
||||||
if(m_items[i].hdr->hdr.gc_magic == EMU_MAGIC)
|
if(NoGameID(m_items[i].hdr->hdr.gc_magic))
|
||||||
{
|
{
|
||||||
if(string(m_items[i].hdr->path).find_last_of("/") != string::npos)
|
if(string(m_items[i].hdr->path).find_last_of("/") != string::npos)
|
||||||
strncpy(gamePath, &m_items[i].hdr->path[string(m_items[i].hdr->path).find_last_of("/")], sizeof(gamePath));
|
strncpy(gamePath, &m_items[i].hdr->path[string(m_items[i].hdr->path).find_last_of("/")], sizeof(gamePath));
|
||||||
else
|
else
|
||||||
strncpy(gamePath, m_items[i].hdr->path, sizeof(gamePath));
|
strncpy(gamePath, m_items[i].hdr->path, sizeof(gamePath));
|
||||||
}
|
}
|
||||||
FILE *file = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), (m_items[i].hdr->hdr.gc_magic == EMU_MAGIC ? gamePath : (char*)m_items[i].hdr->hdr.id)), "wb");
|
FILE *file = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), (NoGameID(m_items[i].hdr->hdr.gc_magic) ? gamePath : (char*)m_items[i].hdr->hdr.id)), "wb");
|
||||||
if (file != 0)
|
if (file != 0)
|
||||||
{
|
{
|
||||||
SWFCHeader header(tex, box, m_compressCache);
|
SWFCHeader header(tex, box, m_compressCache);
|
||||||
@ -2630,14 +2630,14 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq)
|
|||||||
if(!m_cachePath.empty())
|
if(!m_cachePath.empty())
|
||||||
{
|
{
|
||||||
char gamePath[256];
|
char gamePath[256];
|
||||||
if(m_items[i].hdr->hdr.gc_magic == EMU_MAGIC)
|
if(NoGameID(m_items[i].hdr->hdr.gc_magic))
|
||||||
{
|
{
|
||||||
if(string(m_items[i].hdr->path).find_last_of("/") != string::npos)
|
if(string(m_items[i].hdr->path).find_last_of("/") != string::npos)
|
||||||
strncpy(gamePath, &m_items[i].hdr->path[string(m_items[i].hdr->path).find_last_of("/")], sizeof(gamePath));
|
strncpy(gamePath, &m_items[i].hdr->path[string(m_items[i].hdr->path).find_last_of("/")], sizeof(gamePath));
|
||||||
else
|
else
|
||||||
strncpy(gamePath, m_items[i].hdr->path, sizeof(gamePath));
|
strncpy(gamePath, m_items[i].hdr->path, sizeof(gamePath));
|
||||||
}
|
}
|
||||||
FILE *file = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), (m_items[i].hdr->hdr.gc_magic == EMU_MAGIC ? gamePath : (char*)m_items[i].hdr->hdr.id)), "rb");
|
FILE *file = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), (NoGameID(m_items[i].hdr->hdr.gc_magic) ? gamePath : (char*)m_items[i].hdr->hdr.id)), "rb");
|
||||||
if(file != 0)
|
if(file != 0)
|
||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
@ -180,7 +180,7 @@ void CList<dir_discHdr>::GetHeaders(vector<string> pathlist, vector<dir_discHdr>
|
|||||||
|
|
||||||
gprintf("Found: %s\n", tmp.path);
|
gprintf("Found: %s\n", tmp.path);
|
||||||
sscanf(plugin.getString("PLUGIN","magic","").c_str(), "%08x", &tmp.hdr.magic); //Plugin magic
|
sscanf(plugin.getString("PLUGIN","magic","").c_str(), "%08x", &tmp.hdr.magic); //Plugin magic
|
||||||
tmp.hdr.gc_magic = EMU_MAGIC; //Abusing gc_magic for general emu detection ;)
|
tmp.hdr.gc_magic = PLUGIN_MAGIC; //Abusing gc_magic for general emu detection ;)
|
||||||
headerlist.push_back(tmp);
|
headerlist.push_back(tmp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -330,54 +330,34 @@ void CList<dir_discHdr>::GetHeaders(vector<string> pathlist, vector<dir_discHdr>
|
|||||||
headerlist.push_back(tmp);
|
headerlist.push_back(tmp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if((*itr).rfind(".dol") != string::npos || (*itr).rfind(".DOL") != string::npos
|
else if((*itr).rfind(".dol") != string::npos || (*itr).rfind(".DOL") != string::npos
|
||||||
|| (*itr).rfind(".elf") != string::npos || (*itr).rfind(".ELF") != string::npos)
|
|| (*itr).rfind(".elf") != string::npos || (*itr).rfind(".ELF") != string::npos)
|
||||||
{
|
{
|
||||||
char *filename = &(*itr)[(*itr).find_last_of('/')+1];
|
char *filename = &(*itr)[(*itr).find_last_of('/')+1];
|
||||||
|
strncpy((char*)tmp.hdr.id, "HB_APP", sizeof(tmp.hdr.id));
|
||||||
|
|
||||||
if(strcasecmp(filename, "boot.dol") != 0 && strcasecmp(filename, "boot.elf") != 0) continue;
|
if(strcasecmp(filename, "boot.dol") != 0 && strcasecmp(filename, "boot.elf") != 0) continue;
|
||||||
|
|
||||||
(*itr)[(*itr).find_last_of('/')] = 0;
|
(*itr)[(*itr).find_last_of('/')] = 0;
|
||||||
|
strncpy(tmp.path, (*itr).c_str(), sizeof(tmp.path));
|
||||||
|
|
||||||
(*itr).assign(&(*itr)[(*itr).find_last_of('/') + 1]);
|
(*itr).assign(&(*itr)[(*itr).find_last_of('/') + 1]);
|
||||||
|
char foldername[64];
|
||||||
(*itr)[0] = toupper((*itr)[0]);
|
strncpy(foldername, (*itr).c_str(), sizeof(foldername));
|
||||||
for (u32 i = 1; i < (*itr).size(); ++i)
|
gprintf("Found: %s\n", foldername);
|
||||||
{
|
|
||||||
if((*itr)[i] == '_' || (*itr)[i] == '-')
|
|
||||||
(*itr)[i] = ' ';
|
|
||||||
|
|
||||||
if((*itr)[i] == ' ')
|
|
||||||
{
|
|
||||||
(*itr)[i + 1] = toupper((*itr)[i + 1]);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
else (*itr)[i] = tolower((*itr)[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(tmp.hdr.id, (*itr).c_str(), 6);
|
|
||||||
for (u32 i = 0; i < 6; ++i)
|
|
||||||
{
|
|
||||||
tmp.hdr.id[i] = toupper(tmp.hdr.id[i]);
|
|
||||||
if(!isalnum(tmp.hdr.id[i]) || tmp.hdr.id[i] == ' ' || tmp.hdr.id[i] == '\0')
|
|
||||||
tmp.hdr.id[i] = '_';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get info from custom titles
|
// Get info from custom titles
|
||||||
wstringEx tmpString;
|
wstringEx tmpString;
|
||||||
GTitle = custom_titles.getString("TITLES", (const char *) tmp.hdr.id);
|
GTitle = custom_titles.getString("TITLES", (const char *)foldername);
|
||||||
int ccolor = custom_titles.getColor("COVERS", (const char *) tmp.hdr.id, tmp.hdr.casecolor).intVal();
|
int ccolor = custom_titles.getColor("COVERS", (const char *)foldername, tmp.hdr.casecolor).intVal();
|
||||||
if(GTitle.size() > 0 || (gameTDB.GetTitle((char *)tmp.hdr.id, GTitle)))
|
if(GTitle.size() > 0)
|
||||||
{
|
|
||||||
tmpString.fromUTF8(GTitle.c_str());
|
tmpString.fromUTF8(GTitle.c_str());
|
||||||
tmp.hdr.casecolor = ccolor != 1 ? ccolor : gameTDB.GetCaseColor((char *)tmp.hdr.id);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
tmpString.fromUTF8(foldername);
|
||||||
tmpString.fromUTF8((*itr).c_str());
|
|
||||||
tmp.hdr.casecolor = ccolor != 1 ? ccolor : 1;
|
tmp.hdr.casecolor = ccolor;
|
||||||
}
|
tmp.hdr.gc_magic = HB_MAGIC;
|
||||||
wcsncpy(tmp.title, tmpString.c_str(), 64);
|
wcsncpy(tmp.title, tmpString.c_str(), 64);
|
||||||
headerlist.push_back(tmp);
|
headerlist.push_back(tmp);
|
||||||
continue;
|
continue;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#define _UTILS_H_
|
#define _UTILS_H_
|
||||||
|
|
||||||
#include <gctypes.h>
|
#include <gctypes.h>
|
||||||
|
#include "defines.h"
|
||||||
|
|
||||||
#define KB_SIZE 1024.0
|
#define KB_SIZE 1024.0
|
||||||
#define MB_SIZE 1048576.0
|
#define MB_SIZE 1048576.0
|
||||||
@ -24,6 +25,8 @@
|
|||||||
#define Write16(addr, val) *(u16 *)addr = val; DCFlushRange((void *)addr, sizeof(u16));
|
#define Write16(addr, val) *(u16 *)addr = val; DCFlushRange((void *)addr, sizeof(u16));
|
||||||
#define Write32(addr, val) *(u32 *)addr = val; DCFlushRange((void *)addr, sizeof(u32));
|
#define Write32(addr, val) *(u32 *)addr = val; DCFlushRange((void *)addr, sizeof(u32));
|
||||||
|
|
||||||
|
#define NoGameID(x) (x == PLUGIN_MAGIC || x == HB_MAGIC)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
@ -1510,10 +1510,15 @@ void CMenu::_initCF(void)
|
|||||||
u64 chantitle = m_gameList[i].hdr.chantitle;
|
u64 chantitle = m_gameList[i].hdr.chantitle;
|
||||||
if(m_current_view == COVERFLOW_CHANNEL && chantitle == HBC_108)
|
if(m_current_view == COVERFLOW_CHANNEL && chantitle == HBC_108)
|
||||||
strncpy((char *) m_gameList[i].hdr.id, "JODI", 6);
|
strncpy((char *) m_gameList[i].hdr.id, "JODI", 6);
|
||||||
if(m_current_view == COVERFLOW_EMU)
|
if(NoGameID(m_gameList[i].hdr.gc_magic))
|
||||||
{
|
{
|
||||||
string tempname(m_gameList[i].path);
|
string tempname(m_gameList[i].path);
|
||||||
if(!m_plugin.isScummVM(m_gameList[i].hdr.magic))
|
if(m_gameList[i].hdr.gc_magic == HB_MAGIC)
|
||||||
|
{
|
||||||
|
tempname.assign(&tempname[tempname.find_last_of('/') + 1]);
|
||||||
|
id = tempname;
|
||||||
|
}
|
||||||
|
else if(!m_plugin.isScummVM(m_gameList[i].hdr.magic))
|
||||||
{
|
{
|
||||||
if(tempname.empty() || tempname.find_first_of('/') == string::npos)
|
if(tempname.empty() || tempname.find_first_of('/') == string::npos)
|
||||||
{
|
{
|
||||||
@ -1648,7 +1653,7 @@ void CMenu::_initCF(void)
|
|||||||
if(dumpGameLst)
|
if(dumpGameLst)
|
||||||
dump.setWString(domain, id, m_gameList[i].title);
|
dump.setWString(domain, id, m_gameList[i].title);
|
||||||
|
|
||||||
if (m_current_view == COVERFLOW_EMU)
|
if(m_gameList[i].hdr.gc_magic == PLUGIN_MAGIC)
|
||||||
{
|
{
|
||||||
string tempname(m_gameList[i].path);
|
string tempname(m_gameList[i].path);
|
||||||
if(tempname.find_last_of("/") != string::npos)
|
if(tempname.find_last_of("/") != string::npos)
|
||||||
@ -1670,15 +1675,10 @@ void CMenu::_initCF(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_current_view != COVERFLOW_HOMEBREW)
|
else if(m_gameList[i].hdr.gc_magic == HB_MAGIC)
|
||||||
m_cf.addItem(&m_gameList[i], fmt("%s/%s.png", m_picDir.c_str(), id.c_str()), fmt("%s/%s.png", m_boxPicDir.c_str(), id.c_str()), playcount, lastPlayed);
|
m_cf.addItem(&m_gameList[i], fmt("%s/icon.png", m_gameList[i].path), fmt("%s/%s.png", m_boxPicDir.c_str(), id.c_str()), playcount, lastPlayed);
|
||||||
else
|
else
|
||||||
{
|
m_cf.addItem(&m_gameList[i], fmt("%s/%s.png", m_picDir.c_str(), id.c_str()), fmt("%s/%s.png", m_boxPicDir.c_str(), id.c_str()), playcount, lastPlayed);
|
||||||
string s = sfmt("%s", m_gameList[i].path);
|
|
||||||
string f = s.substr(0, s.find_last_of("/"));
|
|
||||||
m_cf.addItem(&m_gameList[i], fmt("%s/icon.png", f.c_str()), fmt("%s/%s.png", m_boxPicDir.c_str(), id.c_str()), playcount, lastPlayed);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_gcfg1.unload();
|
m_gcfg1.unload();
|
||||||
@ -2074,7 +2074,7 @@ bool CMenu::_loadList(void)
|
|||||||
retval = _loadGameList();
|
retval = _loadGameList();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
gprintf("Games found: %i\n", m_gameList.size());
|
||||||
m_cfg.remove(_domainFromView(), "update_cache");
|
m_cfg.remove(_domainFromView(), "update_cache");
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "homebrew.h"
|
#include "homebrew.h"
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "gc/gc.h"
|
#include "gc/gc.h"
|
||||||
|
#include "gc/fileOps.h"
|
||||||
#include "Gekko.h"
|
#include "Gekko.h"
|
||||||
|
|
||||||
extern const u8 btngamecfg_png[];
|
extern const u8 btngamecfg_png[];
|
||||||
@ -632,7 +633,7 @@ void CMenu::_directlaunch(const string &id)
|
|||||||
void CMenu::_launch(dir_discHdr *hdr)
|
void CMenu::_launch(dir_discHdr *hdr)
|
||||||
{
|
{
|
||||||
m_gcfg2.load(fmt("%s/" GAME_SETTINGS2_FILENAME, m_settingsDir.c_str()));
|
m_gcfg2.load(fmt("%s/" GAME_SETTINGS2_FILENAME, m_settingsDir.c_str()));
|
||||||
if(hdr->hdr.gc_magic == EMU_MAGIC)
|
if(hdr->hdr.gc_magic == PLUGIN_MAGIC)
|
||||||
{
|
{
|
||||||
string title(&hdr->path[string(hdr->path).find_last_of("/")+1]);
|
string title(&hdr->path[string(hdr->path).find_last_of("/")+1]);
|
||||||
string wiiflow_dol(m_dol);
|
string wiiflow_dol(m_dol);
|
||||||
@ -665,30 +666,26 @@ void CMenu::_launch(dir_discHdr *hdr)
|
|||||||
_launchHomebrew(fmt("%s/%s", m_pluginsDir.c_str(), m_plugin.GetDolName(hdr->hdr.magic)), arguments);
|
_launchHomebrew(fmt("%s/%s", m_pluginsDir.c_str(), m_plugin.GetDolName(hdr->hdr.magic)), arguments);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if(hdr->hdr.gc_magic == HB_MAGIC)
|
||||||
|
{
|
||||||
|
char gamepath[128];
|
||||||
|
snprintf(gamepath, sizeof(gamepath), "%s/boot.dol", hdr->path);
|
||||||
|
if(!fsop_FileExist((const char*)gamepath))
|
||||||
|
snprintf(gamepath, sizeof(gamepath), "%s/boot.elf", hdr->path);
|
||||||
|
_launchHomebrew(gamepath, m_homebrewArgs);
|
||||||
|
return;
|
||||||
|
}
|
||||||
else if(hdr->hdr.gc_magic == GC_MAGIC)
|
else if(hdr->hdr.gc_magic == GC_MAGIC)
|
||||||
{
|
{
|
||||||
_launchGC(hdr, true);
|
_launchGC(hdr, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch(m_current_view)
|
else if(m_current_view == COVERFLOW_CHANNEL)
|
||||||
{
|
{
|
||||||
case COVERFLOW_HOMEBREW:
|
|
||||||
_launchHomebrew((char *)hdr->path, m_homebrewArgs);
|
|
||||||
break;
|
|
||||||
case COVERFLOW_CHANNEL:
|
|
||||||
_launchChannel(hdr);
|
_launchChannel(hdr);
|
||||||
break;
|
return;
|
||||||
case COVERFLOW_DML:
|
|
||||||
_launchGC(hdr, true);
|
|
||||||
break;
|
|
||||||
case COVERFLOW_EMU:
|
|
||||||
_launchHomebrew((char *)hdr->path, m_homebrewArgs);
|
|
||||||
break;
|
|
||||||
case COVERFLOW_USB:
|
|
||||||
default:
|
|
||||||
_launchGame(hdr, false);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
_launchGame(hdr, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" {extern void USBStorage_Deinit(void);}
|
extern "C" {extern void USBStorage_Deinit(void);}
|
||||||
@ -1439,7 +1436,7 @@ void CMenu::_gameSoundThread(CMenu *m)
|
|||||||
m->m_gamesound_changed = true;
|
m->m_gamesound_changed = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if(m->m_cf.getHdr()->hdr.gc_magic == EMU_MAGIC)
|
else if(m->m_cf.getHdr()->hdr.gc_magic == PLUGIN_MAGIC)
|
||||||
{
|
{
|
||||||
m->m_gameSound.Load(m->m_plugin.GetBannerSound(m->m_cf.getHdr()->hdr.magic), m->m_plugin.GetBannerSoundSize(), false);
|
m->m_gameSound.Load(m->m_plugin.GetBannerSound(m->m_cf.getHdr()->hdr.magic), m->m_plugin.GetBannerSoundSize(), false);
|
||||||
m->m_gamesound_changed = true;
|
m->m_gamesound_changed = true;
|
||||||
|
@ -372,7 +372,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
|
|||||||
fsop_deleteFolder(source);
|
fsop_deleteFolder(source);
|
||||||
upd_dml = true;
|
upd_dml = true;
|
||||||
}
|
}
|
||||||
else if(m_cf.getHdr()->hdr.gc_magic == EMU_MAGIC)
|
else if(m_cf.getHdr()->hdr.gc_magic == PLUGIN_MAGIC)
|
||||||
{
|
{
|
||||||
fsop_deleteFile((char*)m_cf.getHdr()->path);
|
fsop_deleteFile((char*)m_cf.getHdr()->path);
|
||||||
upd_emu = true;
|
upd_emu = true;
|
||||||
|
@ -214,6 +214,7 @@ vector<dir_discHdr> Plugin::ParseScummvmINI(Config &ini, string Device)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
memset(&tmp, 0, sizeof(dir_discHdr));
|
memset(&tmp, 0, sizeof(dir_discHdr));
|
||||||
|
strncpy((char*)tmp.hdr.id, "PLUGIN", sizeof(tmp.hdr.id));
|
||||||
tmp.hdr.casecolor = Plugins.back().caseColor;
|
tmp.hdr.casecolor = Plugins.back().caseColor;
|
||||||
wstringEx tmpString;
|
wstringEx tmpString;
|
||||||
tmpString.fromUTF8(GameName.c_str());
|
tmpString.fromUTF8(GameName.c_str());
|
||||||
@ -221,7 +222,7 @@ vector<dir_discHdr> Plugin::ParseScummvmINI(Config &ini, string Device)
|
|||||||
strncpy(tmp.path, game.c_str(), sizeof(tmp.path));
|
strncpy(tmp.path, game.c_str(), sizeof(tmp.path));
|
||||||
gprintf("Found: %ls\n", tmp.title);
|
gprintf("Found: %ls\n", tmp.title);
|
||||||
tmp.hdr.magic = Plugins.back().magicWord;
|
tmp.hdr.magic = Plugins.back().magicWord;
|
||||||
tmp.hdr.gc_magic = EMU_MAGIC;
|
tmp.hdr.gc_magic = PLUGIN_MAGIC;
|
||||||
gameHeader.push_back(tmp);
|
gameHeader.push_back(tmp);
|
||||||
game = ini.nextDomain();
|
game = ini.nextDomain();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user