-if a gamecube game is found in the wbfs folder,

it will be displayed in regular wii coverflow and
it's also possible to launch it as in dml coverflow
This commit is contained in:
fix94.1 2012-03-10 22:07:06 +00:00
parent b256cd9214
commit 592e22951f
3 changed files with 26 additions and 21 deletions

View File

@ -139,25 +139,25 @@ void CList<dir_discHdr>::GetHeaders(safe_vector<string> pathlist, safe_vector<di
{ {
fseek( fp, 0, SEEK_SET ); fseek( fp, 0, SEEK_SET );
fread( tmp.hdr.id, 1, 6, fp ); fread( tmp.hdr.id, 1, 6, fp );
u8 gc_disc[1]; u8 gc_disc[1];
fread(gc_disc, 1, 1, fp); fread(gc_disc, 1, 1, fp);
GTitle = custom_titles.getString( "TITLES", (const char *) tmp.hdr.id ); GTitle = custom_titles.getString( "TITLES", (const char *) tmp.hdr.id );
int ccolor = custom_titles.getColor( "COVERS", (const char *) tmp.hdr.id, tmp.hdr.casecolor ).intVal(); int ccolor = custom_titles.getColor( "COVERS", (const char *) tmp.hdr.id, tmp.hdr.casecolor ).intVal();
if( GTitle.size() > 0 || ( gameTDB.IsLoaded() && gameTDB.GetTitle( (char *)tmp.hdr.id, GTitle ) ) ) if( GTitle.size() > 0 || ( gameTDB.IsLoaded() && gameTDB.GetTitle( (char *)tmp.hdr.id, GTitle ) ) )
{ {
mbstowcs( tmp.title, GTitle.c_str(), sizeof(tmp.title) ); mbstowcs( tmp.title, GTitle.c_str(), sizeof(tmp.title) );
Asciify( tmp.title ); Asciify( tmp.title );
if(gc_disc[0]) if(gc_disc[0])
wcslcat(tmp.title, L" disc 2", sizeof(tmp.title)); wcslcat(tmp.title, L" disc 2", sizeof(tmp.title));
tmp.hdr.casecolor = ccolor != 1 ? ccolor : gameTDB.GetCaseColor( (char *)tmp.hdr.id ); tmp.hdr.casecolor = ccolor != 1 ? ccolor : gameTDB.GetCaseColor( (char *)tmp.hdr.id );
if( tmp.hdr.casecolor == 0xffffffff ) if( tmp.hdr.casecolor == 0xffffffff )
tmp.hdr.casecolor = 0; tmp.hdr.casecolor = 0;
tmp.hdr.gc_magic = 0xc2339f3d; tmp.hdr.gc_magic = 0xc2339f3d;
(*itr)[(*itr).find_last_of('/')] = 0; (*itr)[(*itr).find_last_of('/')] = 0;
(*itr).assign(&(*itr)[(*itr).find_last_of('/') + 1]); (*itr).assign(&(*itr)[(*itr).find_last_of('/') + 1]);
@ -166,7 +166,7 @@ void CList<dir_discHdr>::GetHeaders(safe_vector<string> pathlist, safe_vector<di
headerlist.push_back( tmp ); headerlist.push_back( tmp );
continue; continue;
} }
fseek( fp, 0, SEEK_SET ); fseek( fp, 0, SEEK_SET );
fread( &tmp.hdr, sizeof( discHdr ), 1, fp); fread( &tmp.hdr, sizeof( discHdr ), 1, fp);
SAFE_CLOSE(fp); SAFE_CLOSE(fp);
@ -177,7 +177,7 @@ void CList<dir_discHdr>::GetHeaders(safe_vector<string> pathlist, safe_vector<di
Asciify(tmp.title); Asciify(tmp.title);
if(gc_disc[0]) if(gc_disc[0])
wcslcat(tmp.title, L" disc 2", sizeof(tmp.title)); wcslcat(tmp.title, L" disc 2", sizeof(tmp.title));
tmp.hdr.casecolor = 0; tmp.hdr.casecolor = 0;
(*itr)[(*itr).find_last_of('/')] = 0; (*itr)[(*itr).find_last_of('/')] = 0;
(*itr).assign(&(*itr)[(*itr).find_last_of('/') + 1]); (*itr).assign(&(*itr)[(*itr).find_last_of('/') + 1]);
@ -189,7 +189,7 @@ void CList<dir_discHdr>::GetHeaders(safe_vector<string> pathlist, safe_vector<di
} }
continue; continue;
} }
Check_For_ID(tmp.hdr.id, (*itr).c_str(), "[", "]"); /* [GAMEID] Title, [GAMEID]_Title, Title [GAMEID], Title_[GAMEID] */ Check_For_ID(tmp.hdr.id, (*itr).c_str(), "[", "]"); /* [GAMEID] Title, [GAMEID]_Title, Title [GAMEID], Title_[GAMEID] */
if(tmp.hdr.id[0] == 0) if(tmp.hdr.id[0] == 0)
{ {
@ -210,8 +210,8 @@ void CList<dir_discHdr>::GetHeaders(safe_vector<string> pathlist, safe_vector<di
{ {
gprintf("Skipping file: '%s'\n", (*itr).c_str()); gprintf("Skipping file: '%s'\n", (*itr).c_str());
continue; continue;
} }
// Get info from custom titles // Get info from custom titles
GTitle = custom_titles.getString("TITLES", (const char *) tmp.hdr.id); GTitle = custom_titles.getString("TITLES", (const char *) tmp.hdr.id);
int ccolor = custom_titles.getColor("COVERS", (const char *) tmp.hdr.id, tmp.hdr.casecolor).intVal(); int ccolor = custom_titles.getColor("COVERS", (const char *) tmp.hdr.id, tmp.hdr.casecolor).intVal();
@ -221,7 +221,7 @@ void CList<dir_discHdr>::GetHeaders(safe_vector<string> pathlist, safe_vector<di
mbstowcs(tmp.title, GTitle.c_str(), sizeof(tmp.title)); mbstowcs(tmp.title, GTitle.c_str(), sizeof(tmp.title));
Asciify(tmp.title); Asciify(tmp.title);
tmp.hdr.casecolor = ccolor != 1 ? ccolor : gameTDB.GetCaseColor((char *)tmp.hdr.id); tmp.hdr.casecolor = ccolor != 1 ? ccolor : gameTDB.GetCaseColor((char *)tmp.hdr.id);
tmp.hdr.wifi = gameTDB.GetWifiPlayers((char *)tmp.hdr.id); tmp.hdr.wifi = gameTDB.GetWifiPlayers((char *)tmp.hdr.id);
tmp.hdr.players = gameTDB.GetPlayers((char *)tmp.hdr.id); tmp.hdr.players = gameTDB.GetPlayers((char *)tmp.hdr.id);
//tmp.hdr.controllers = gameTDB.GetAccessories((char *)tmp.hdr.id); //tmp.hdr.controllers = gameTDB.GetAccessories((char *)tmp.hdr.id);

View File

@ -116,7 +116,7 @@ void CMenu::_showGameSettings(void)
m_btnMgr.show(m_gameSettingsBtnPageP); m_btnMgr.show(m_gameSettingsBtnPageP);
m_btnMgr.show(m_gameSettingsBtnBack); m_btnMgr.show(m_gameSettingsBtnBack);
m_btnMgr.show(m_gameSettingsLblTitle); m_btnMgr.show(m_gameSettingsLblTitle);
if(m_current_view != COVERFLOW_DML) if(m_cf.getHdr()->hdr.gc_magic != 0xc2339f3d)
g_numGCfPages = 4; g_numGCfPages = 4;
else else
g_numGCfPages = 2; g_numGCfPages = 2;
@ -126,7 +126,7 @@ void CMenu::_showGameSettings(void)
m_btnMgr.show(m_gameSettingsLblCover); m_btnMgr.show(m_gameSettingsLblCover);
m_btnMgr.show(m_gameSettingsBtnCover); m_btnMgr.show(m_gameSettingsBtnCover);
if(m_current_view != COVERFLOW_DML) if(m_cf.getHdr()->hdr.gc_magic != 0xc2339f3d)
{ {
m_btnMgr.show(m_gameSettingsBtnCategoryMain); m_btnMgr.show(m_gameSettingsBtnCategoryMain);
m_btnMgr.show(m_gameSettingsLblCategoryMain); m_btnMgr.show(m_gameSettingsLblCategoryMain);
@ -159,7 +159,7 @@ void CMenu::_showGameSettings(void)
m_btnMgr.hide(m_gameSettingsLblCover); m_btnMgr.hide(m_gameSettingsLblCover);
m_btnMgr.hide(m_gameSettingsBtnCover); m_btnMgr.hide(m_gameSettingsBtnCover);
if(m_current_view != COVERFLOW_DML) if(m_cf.getHdr()->hdr.gc_magic != 0xc2339f3d)
{ {
m_btnMgr.hide(m_gameSettingsBtnCategoryMain); m_btnMgr.hide(m_gameSettingsBtnCategoryMain);
m_btnMgr.hide(m_gameSettingsLblCategoryMain); m_btnMgr.hide(m_gameSettingsLblCategoryMain);
@ -194,7 +194,7 @@ void CMenu::_showGameSettings(void)
m_btnMgr.show(m_gameSettingsBtnDebuggerP); m_btnMgr.show(m_gameSettingsBtnDebuggerP);
m_btnMgr.show(m_gameSettingsBtnDebuggerM); m_btnMgr.show(m_gameSettingsBtnDebuggerM);
if(m_current_view != COVERFLOW_DML) if(m_cf.getHdr()->hdr.gc_magic != 0xc2339f3d)
{ {
m_btnMgr.show(m_gameSettingsLblHooktype); m_btnMgr.show(m_gameSettingsLblHooktype);
m_btnMgr.show(m_gameSettingsLblHooktypeVal); m_btnMgr.show(m_gameSettingsLblHooktypeVal);
@ -215,7 +215,7 @@ void CMenu::_showGameSettings(void)
m_btnMgr.hide(m_gameSettingsBtnDebuggerP); m_btnMgr.hide(m_gameSettingsBtnDebuggerP);
m_btnMgr.hide(m_gameSettingsBtnDebuggerM); m_btnMgr.hide(m_gameSettingsBtnDebuggerM);
if(m_current_view != COVERFLOW_DML) if(m_cf.getHdr()->hdr.gc_magic != 0xc2339f3d)
{ {
m_btnMgr.hide(m_gameSettingsLblHooktype); m_btnMgr.hide(m_gameSettingsLblHooktype);
m_btnMgr.hide(m_gameSettingsLblHooktypeVal); m_btnMgr.hide(m_gameSettingsLblHooktypeVal);

View File

@ -445,7 +445,7 @@ void CMenu::_game(bool launch)
{ {
_hideGame(); _hideGame();
dir_discHdr *hdr = m_cf.getHdr(); dir_discHdr *hdr = m_cf.getHdr();
if(currentPartition != SD && m_current_view == COVERFLOW_DML) if(currentPartition != SD && hdr->hdr.gc_magic == 0xc2339f3d)
{ {
char gcfolder[300]; char gcfolder[300];
sprintf(gcfolder, "%s [%s]", m_cf.getTitle().toUTF8().c_str(), (char *)hdr->hdr.id); sprintf(gcfolder, "%s [%s]", m_cf.getTitle().toUTF8().c_str(), (char *)hdr->hdr.id);
@ -470,7 +470,7 @@ void CMenu::_game(bool launch)
if (m_current_view != COVERFLOW_HOMEBREW) if (m_current_view != COVERFLOW_HOMEBREW)
{ {
// Get banner_title // Get banner_title
Banner * banner = m_current_view == COVERFLOW_CHANNEL ? _extractChannelBnr(chantitle) : m_current_view == COVERFLOW_USB ? _extractBnr(hdr) : NULL; Banner * banner = m_current_view == COVERFLOW_CHANNEL ? _extractChannelBnr(chantitle) : (m_current_view == COVERFLOW_USB && hdr->hdr.gc_magic != 0xc2339f3d) ? _extractBnr(hdr) : NULL;
if (banner != NULL) if (banner != NULL)
{ {
if (banner->IsValid()) if (banner->IsValid())
@ -550,7 +550,7 @@ void CMenu::_game(bool launch)
m_btnMgr.show(m_gameBtnSettings); m_btnMgr.show(m_gameBtnSettings);
} }
if ((m_current_view == COVERFLOW_USB || m_current_view == COVERFLOW_DML) && !m_locked) if ((m_current_view == COVERFLOW_USB || m_cf.getHdr()->hdr.gc_magic == 0xc2339f3d) && !m_locked)
m_btnMgr.show(m_gameBtnDelete); m_btnMgr.show(m_gameBtnDelete);
} }
else else
@ -602,6 +602,11 @@ void CMenu::_directlaunch(const string &id)
void CMenu::_launch(dir_discHdr *hdr) void CMenu::_launch(dir_discHdr *hdr)
{ {
m_gcfg2.load(sfmt("%s/gameconfig2.ini", m_settingsDir.c_str()).c_str()); m_gcfg2.load(sfmt("%s/gameconfig2.ini", m_settingsDir.c_str()).c_str());
if(hdr->hdr.gc_magic == 0xc2339f3d)
{
_launchGC(hdr, true);
return;
}
switch(m_current_view) switch(m_current_view)
{ {
case COVERFLOW_HOMEBREW: case COVERFLOW_HOMEBREW:
@ -1321,7 +1326,7 @@ SmartBuf gameSoundThreadStack;
void CMenu::_gameSoundThread(CMenu *m) void CMenu::_gameSoundThread(CMenu *m)
{ {
if(m->m_current_view == COVERFLOW_DML) if(m->m_cf.getHdr()->hdr.gc_magic == 0xc2339f3d)
{ {
m->m_gameSound.Load(gc_ogg, gc_ogg_size, false); m->m_gameSound.Load(gc_ogg, gc_ogg_size, false);
m->m_gamesound_changed = true; m->m_gamesound_changed = true;