* Fixed cache (again)

* Fixed GameTDB 
* Fixed cover colors the right way
* Added GameTDB support to Gamecube game headers
* Fixed a bug were gameconfig in COVERFLOW_USB only showed 1 config page after gameconfig in COVERFLOW_DML was entered
* Fixed text label for Video modus in DML gameconfig
* Some other minor bug fixes, cleanups and changes to gain more stability

NOTE: However FIX94 reverted some changes they shouldn't make you can see most changes I made for now are minor changes. I'll have to check more, but so far great job guys!
This commit is contained in:
overjoy.psm 2012-01-25 00:11:28 +00:00
parent b661ccb551
commit 6e4f75359b
11 changed files with 192 additions and 157 deletions

View File

@ -779,6 +779,7 @@ int GameTDB::GetRatingDescriptors(const char * id, safe_vector<string> & desc_li
{
if(strncmp(descriptor_text, "</descriptor>", strlen("</descriptor>")) == 0)
{
desc_list[list_num].push_back('\0');
descriptor_text = strstr(descriptor_text, "<descriptor>");
if(!descriptor_text)
break;
@ -819,8 +820,6 @@ int GameTDB::GetWifiPlayers(const char * id)
players = atoi(PlayersNode);
delete [] data;
return players;
}
@ -847,6 +846,7 @@ int GameTDB::GetWifiFeatures(const char * id, safe_vector<string> & feat_list)
{
if(strncmp(feature_text, "</feature>", strlen("</feature>")) == 0)
{
feat_list[list_num].push_back('\0');
feature_text = strstr(feature_text, "<feature>");
if(!feature_text)
break;
@ -892,8 +892,6 @@ int GameTDB::GetPlayers(const char * id)
players = atoi(PlayersNode);
delete [] data;
return players;
}
@ -924,14 +922,20 @@ int GameTDB::GetAccessories(const char * id, safe_vector<Accessory> & acc_list)
for(const char * ptr = ControlsNode; *ptr != '"' && *ptr != '\0'; ptr++)
acc_list[list_num].Name.push_back(*ptr);
acc_list[list_num].Required = false;
acc_list[list_num].Name.push_back('\0');
char * requiredField = strstr(ControlsNode, "required=\"");
if(!requiredField)
{
delete [] data;
return -1;
}
if(requiredField && strncmp(requiredField + strlen("required=\""), "true", 4) == 0)
acc_list[list_num].Required = true;
requiredField += strlen("required=\"");
ControlsNode = strstr(ControlsNode, "<control type=\"");
acc_list[list_num].Required = strncmp(requiredField, "true", 4) == 0;
ControlsNode = strstr(requiredField, "<control type=\"");
if(ControlsNode)
ControlsNode += strlen("<control type=\"");
@ -948,7 +952,8 @@ unsigned int GameTDB::FindCaseColor(char * data)
unsigned int color = -1;
char * ColorNode = GetNodeText(data, "<case color=\"", "\"/>");
if(!ColorNode) return color;
if(!ColorNode)
return color;
char format[8];
sprintf(format, "0x%s", ColorNode);
@ -959,13 +964,18 @@ unsigned int GameTDB::FindCaseColor(char * data)
unsigned int GameTDB::GetCaseColor(const char * id)
{
unsigned int color = -1;
if(!id) return color;
if(!id)
return color;
char * data = GetGameNode(id);
if(!data) return color;
if(!data)
return color;
color = FindCaseColor(data);
if( color != 0xffffffff )
gprintf("GameTDB: Found alternate color(%x) for: %s\n", color, id);
delete [] data;
return color;
}

View File

@ -1303,11 +1303,8 @@ void CCoverFlow::_drawCoverBox(int i, bool mirror, CCoverFlow::DrawMode dm)
{
// set dvd box texture, depending on game
if (m_items[m_covers[i].index].hdr->hdr.casecolor == 0xFF0000 ||
strncmp((char *) m_items[m_covers[i].index].hdr->hdr.id, "SMNE01", 6) == 0 ||
strncmp((char *) m_items[m_covers[i].index].hdr->hdr.id, "SMNP01", 6) == 0 ||
strncmp((char *) m_items[m_covers[i].index].hdr->hdr.id, "SMNJ01", 6) == 0 ||
strncmp((char *) m_items[m_covers[i].index].hdr->hdr.id, "SMNK01", 6) == 0 ||
strncmp((char *) m_items[m_covers[i].index].hdr->hdr.id, "SMNW01", 6) == 0)
strncmp((char *) m_items[m_covers[i].index].hdr->hdr.id, "SMNxxx", 3) == 0 ||
strncmp((char *) m_items[m_covers[i].index].hdr->hdr.id, "HBWxxx", 3) == 0)
{
GX_InitTexObj(&texObj, m_dvdSkin_Red.data.get(), m_dvdSkin_Red.width, m_dvdSkin_Red.height, m_dvdSkin_Red.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
}
@ -1315,13 +1312,13 @@ void CCoverFlow::_drawCoverBox(int i, bool mirror, CCoverFlow::DrawMode dm)
strncmp((char *) m_items[m_covers[i].index].hdr->hdr.id, "RZZJEL", 6) == 0 ||
strncmp((char *) m_items[m_covers[i].index].hdr->hdr.id, "RZNJ01", 6) == 0 ||
strncmp((char *) m_items[m_covers[i].index].hdr->hdr.id, "SEKJ99", 6) == 0 ||
strncmp((char *) m_items[m_covers[i].index].hdr->hdr.id, "SX3J01", 6) == 0)
strncmp((char *) m_items[m_covers[i].index].hdr->hdr.id, "SX3J01", 6) == 0 ||
strncmp((char *) m_items[m_covers[i].index].hdr->hdr.id, "CKBE88", 6) == 0)
{
GX_InitTexObj(&texObj, m_dvdSkin_Black.data.get(), m_dvdSkin_Black.width, m_dvdSkin_Black.height, m_dvdSkin_Black.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
}
else if (m_items[m_covers[i].index].hdr->hdr.casecolor == 0xFFFF00 ||
strncmp((char *) m_items[m_covers[i].index].hdr->hdr.id, "SIIP8P", 6) == 0 ||
strncmp((char *) m_items[m_covers[i].index].hdr->hdr.id, "SIIE8P", 6) == 0)
else if (m_items[m_covers[i].index].hdr->hdr.casecolor == 0xFCFF00 ||
strncmp((char *) m_items[m_covers[i].index].hdr->hdr.id, "SIIxxx", 3) == 0 )
{
GX_InitTexObj(&texObj, m_dvdSkin_Yellow.data.get(), m_dvdSkin_Yellow.width, m_dvdSkin_Yellow.height, m_dvdSkin_Yellow.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
}

View File

@ -26,7 +26,7 @@ template <typename T>
CCache<T>::CCache(safe_vector<T> &list, string path , CMode mode) /* Load/Save All */
{
filename = path;
//gprintf("Openning DB: %s\n", filename.c_str());
//gprintf("Opening DB: %s\n", filename.c_str());
cache = fopen(filename.c_str(), io[mode]);
if(!cache) return;

View File

@ -50,6 +50,10 @@ void CachedList<T>::Load(string path, string containing) /* Load All
fclose(file);
remove(path.c_str());
m_loaded = true;
m_update = false;
m_lastLanguage = m_curLanguage;
if(!music && pathlist.size() > 0)
{
Save();

View File

@ -131,21 +131,42 @@ void CList<dir_discHdr>::GetHeaders(safe_vector<string> pathlist, safe_vector<di
if (wbfs || (*itr).rfind(".iso") != string::npos || (*itr).rfind(".ISO") != string::npos)
{
char* filename = &(*itr)[(*itr).find_last_of('/')+1];
char gamename[64];
if(strcasecmp(filename, "game.iso") == 0 && strncasecmp((*itr).c_str(), "sd:/games/", 10) == 0 )
{
FILE *fp = fopen((*itr).c_str(), "rb");
if (fp)
if( fp )
{
fseek( fp, 0x00, SEEK_SET);
fread(tmp.hdr.id, 1, 6, fp);
fseek( fp, 0x20, SEEK_SET);
fread(gamename, 1, 64, fp);
fseek( fp, 0x00, SEEK_SET );
fread( tmp.hdr.id, 1, 6, fp );
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();
if( GTitle.size() > 0 || ( gameTDB.IsLoaded() && gameTDB.GetTitle( (char *)tmp.hdr.id, GTitle ) ) )
{
mbstowcs( tmp.title, GTitle.c_str(), sizeof(tmp.title) );
Asciify( tmp.title );
tmp.hdr.casecolor = ccolor != 1 ? ccolor : gameTDB.GetCaseColor( (char *)tmp.hdr.id );
if( tmp.hdr.casecolor == 0xffffffff )
tmp.hdr.casecolor = 0;
tmp.hdr.gc_magic = 0xc2339f3d;
headerlist.push_back( tmp );
continue;
}
fseek( fp, 0, SEEK_SET );
fread( &tmp.hdr, sizeof( discHdr ), 1, fp);
SAFE_CLOSE(fp);
mbstowcs(tmp.title, gamename, 64);
if ( tmp.hdr.gc_magic == 0xc2339f3d )
{
mbstowcs( tmp.title, (const char *)tmp.hdr.title, sizeof( tmp.hdr.title ) );
Asciify(tmp.title);
tmp.hdr.casecolor = 0;
headerlist.push_back(tmp);
headerlist.push_back( tmp );
continue;
}
}
continue;
}
@ -203,8 +224,7 @@ void CList<dir_discHdr>::GetHeaders(safe_vector<string> pathlist, safe_vector<di
{
mbstowcs(tmp.title, (const char *)tmp.hdr.title, sizeof(tmp.hdr.title));
Asciify(tmp.title);
tmp.hdr.casecolor = 1;
tmp.hdr.casecolor = ccolor != 1 ? ccolor : 1;
headerlist.push_back(tmp);
continue;
}
@ -291,9 +311,11 @@ void CList<dir_discHdr>::GetHeaders(safe_vector<string> pathlist, safe_vector<di
//tmp.hdr.controllers = gameTDB.GetAccessories((char *)tmp.hdr.id);
}
else mbstowcs(tmp.title, tmp.hdr.title, sizeof(tmp.title));
tmp.hdr.casecolor = 1;
else
{
mbstowcs(tmp.title, tmp.hdr.title, sizeof(tmp.title));
tmp.hdr.casecolor = ccolor != 1 ? ccolor : 1;
}
Asciify(tmp.title);
headerlist.push_back(tmp);
}

View File

@ -37,7 +37,7 @@
#define ARRAY_SIZE(a) (sizeof a / sizeof a[0])
static u32 allowedBases[] = { 37, 38, 53, 55, 56, 57, 58, 60, 70, 80 };
static u32 allowedBases[] = { 37, 38, 53, 55, 56, 57, 58 };
/* Check if the cIOS is a D2X. */
bool cIOSInfo::D2X(u8 ios, u8 *base)
@ -74,7 +74,7 @@ iosinfo_t *cIOSInfo::GetInfo(u8 ios)
}
char filepath[ISFS_MAXPATH] ATTRIBUTE_ALIGN(32);
sprintf(filepath, "/title/%08x/%08x/content/%08x.app", 0x00000001, ios, *(u8 *)((u32)TMD+0x1E7));
sprintf(filepath, "/title/00000001/%08x/content/%08x.app", ios, *(u8 *)((u32)TMD+0x1E7));
SAFE_FREE(TMD);

View File

@ -104,9 +104,14 @@ void CMenu::_showGameSettings(void)
m_btnMgr.show(m_gameSettingsBtnPageP);
m_btnMgr.show(m_gameSettingsBtnBack);
m_btnMgr.show(m_gameSettingsLblTitle);
if (m_current_view != COVERFLOW_DML)
{
if(m_current_view != COVERFLOW_DML)
g_numGCfPages = 4;
else
g_numGCfPages = 1;
if (m_gameSettingsPage == 1)
{
if(m_current_view != COVERFLOW_DML)
{
m_btnMgr.show(m_gameSettingsLblCover);
m_btnMgr.show(m_gameSettingsBtnCover);
@ -125,6 +130,16 @@ void CMenu::_showGameSettings(void)
m_btnMgr.show(m_gameSettingsBtnVideoM);
}
else
{
m_btnMgr.show(m_gameSettingsLblDMLGameVideo);
m_btnMgr.show(m_gameSettingsLblDMLVideo);
m_btnMgr.show(m_gameSettingsBtnDMLVideoP);
m_btnMgr.show(m_gameSettingsBtnDMLVideoM);
}
}
else
{
if(m_current_view != COVERFLOW_DML)
{
m_btnMgr.hide(m_gameSettingsLblCover);
m_btnMgr.hide(m_gameSettingsBtnCover);
@ -141,7 +156,14 @@ void CMenu::_showGameSettings(void)
m_btnMgr.hide(m_gameSettingsLblVideo);
m_btnMgr.hide(m_gameSettingsBtnVideoP);
m_btnMgr.hide(m_gameSettingsBtnVideoM);
}
else
{
m_btnMgr.hide(m_gameSettingsLblDMLGameVideo);
m_btnMgr.hide(m_gameSettingsLblDMLVideo);
m_btnMgr.hide(m_gameSettingsBtnDMLVideoP);
m_btnMgr.hide(m_gameSettingsBtnDMLVideoM);
}
}
if (m_gameSettingsPage == 2)
{
@ -186,7 +208,6 @@ void CMenu::_showGameSettings(void)
m_btnMgr.show(m_gameSettingsLblPatchVidModesVal);
m_btnMgr.show(m_gameSettingsBtnPatchVidModesM);
m_btnMgr.show(m_gameSettingsBtnPatchVidModesP);
m_btnMgr.show(m_gameSettingsLblVipatch);
m_btnMgr.show(m_gameSettingsBtnVipatch);
@ -234,25 +255,8 @@ void CMenu::_showGameSettings(void)
m_btnMgr.hide(m_gameSettingsBtnIOSP);
m_btnMgr.hide(m_gameSettingsBtnIOSM);
}
}
else
{
g_numGCfPages = 1;
if (m_gameSettingsPage == 1)
{
m_btnMgr.show(m_gameSettingsLblDMLGameVideo);
m_btnMgr.show(m_gameSettingsLblDMLVideo);
m_btnMgr.show(m_gameSettingsBtnDMLVideoP);
m_btnMgr.show(m_gameSettingsBtnDMLVideoM);
}
else
{
m_btnMgr.hide(m_gameSettingsLblDMLGameVideo);
m_btnMgr.hide(m_gameSettingsLblDMLVideo);
m_btnMgr.hide(m_gameSettingsBtnDMLVideoP);
m_btnMgr.hide(m_gameSettingsBtnDMLVideoM);
}
}
u32 i = 0;
@ -721,7 +725,7 @@ void CMenu::_textGameSettings(void)
m_btnMgr.setText(m_gameSettingsLblGameLanguage, _t("cfgg3", L"Language"));
m_btnMgr.setText(m_gameSettingsLblCountryPatch, _t("cfgg4", L"Patch country strings"));
m_btnMgr.setText(m_gameSettingsLblOcarina, _t("cfgg5", L"Ocarina"));
m_btnMgr.setText(m_gameSettingsLblDMLGameVideo, _t("cfgg6", L"Video mode"));
m_btnMgr.setText(m_gameSettingsLblDMLGameVideo, _t("cfgg2", L"Video mode"));
m_btnMgr.setText(m_gameSettingsLblVipatch, _t("cfgg7", L"Vipatch"));
m_btnMgr.setText(m_gameSettingsBtnBack, _t("cfgg8", L"Back"));
m_btnMgr.setText(m_gameSettingsLblGameIOS, _t("cfgg10", L"IOS"));

View File

@ -720,11 +720,10 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
error(sfmt("No cios found!"));
Sys_LoadMenu();
}
u8 IOS[4];
u8 IOS[3];
IOS[0] = gameIOS == 0 ? ios : gameIOS;
IOS[1] = 56;
IOS[2] = 57;
IOS[3] = 58;
bool found = false;
for(u8 num = 0; !found && num < 4; num++)
{
@ -945,11 +944,10 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
error(sfmt("No cios found!"));
Sys_LoadMenu();
}
u8 IOS[4];
u8 IOS[3];
IOS[0] = gameIOS == 0 ? GetRequestedGameIOS(hdr) : gameIOS;
IOS[1] = 56;
IOS[2] = 57;
IOS[3] = 58;
gprintf("Game requested IOS: %u\n", IOS[0]);
bool found = false;
for(u8 num = 0; !found && num < 4; num++)

View File

@ -461,7 +461,7 @@ int CMenu::main(void)
if (m_current_view == COVERFLOW_USB)
m_current_view = COVERFLOW_CHANNEL;
else if (m_current_view == COVERFLOW_CHANNEL)
m_current_view = show_homebrew ? COVERFLOW_HOMEBREW : COVERFLOW_DML;
m_current_view = (!m_locked && show_homebrew) ? COVERFLOW_HOMEBREW : COVERFLOW_DML;
else if (m_current_view == COVERFLOW_HOMEBREW)
m_current_view = COVERFLOW_DML;
else if (m_current_view == COVERFLOW_DML)
@ -589,7 +589,7 @@ int CMenu::main(void)
m_btnMgr.show(m_mainBtnDML);
break;
case COVERFLOW_CHANNEL:
if(show_homebrew)
if(!m_locked && show_homebrew)
m_btnMgr.show(m_mainBtnHomebrew);
else
m_btnMgr.show(m_mainBtnDML);

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
<pd><ViewState><e p="Wiiflow" x="true"></e><e p="Wiiflow\resources" x="true"></e><e p="Wiiflow\source\devicemounter\libwbfs" x="false"></e><e p="Wiiflow\data" x="true"></e><e p="Wiiflow\resources\app_booter\source" x="false"></e><e p="Wiiflow\scripts" x="false"></e><e p="Wiiflow\data\images" x="false"></e><e p="Wiiflow\docs" x="false"></e><e p="Wiiflow\data\sounds" x="false"></e><e p="Wiiflow\portlibs" x="false"></e><e p="Wiiflow\resources\app_booter" x="true"></e><e p="Wiiflow\source" x="true"></e><e p="Wiiflow\source\network" x="false"></e><e p="Wiiflow\source\channel" x="true"></e><e p="Wiiflow\source\menu" x="true"></e><e p="Wiiflow\source\cheats" x="true"></e><e p="Wiiflow\source\config" x="true"></e><e p="Wiiflow\source\devicemounter" x="true"></e><e p="Wiiflow\source\gc" x="true"></e><e p="Wiiflow\source\gecko" x="false"></e><e p="Wiiflow\source\gui" x="true"></e><e p="Wiiflow\source\homebrew" x="true"></e><e p="Wiiflow\source\list" x="true"></e><e p="Wiiflow\source\loader" x="true"></e><e p="Wiiflow\source\memory" x="true"></e><e p="Wiiflow\source\music" x="false"></e><e p="Wiiflow\source\unzip" x="false"></e><e p="Wiiflow\source\wstringEx" x="false"></e><e p="Wiiflow\wii" x="true"></e><e p="Wiiflow\wii\apps" x="false"></e><e p="Wiiflow\wii\docs" x="false"></e><e p="Wiiflow\wii\wiiflow" x="false"></e></ViewState></pd>
<pd><ViewState><e p="Wiiflow\portlibs" x="false"></e><e p="Wiiflow\source\cheats" x="true"></e><e p="Wiiflow\data\images" x="false"></e><e p="Wiiflow\docs" x="false"></e><e p="Wiiflow\source\gecko" x="false"></e><e p="Wiiflow\source\homebrew" x="true"></e><e p="Wiiflow\source\loader" x="false"></e><e p="Wiiflow\resources\app_booter" x="true"></e><e p="Wiiflow\source\wstringEx" x="false"></e><e p="Wiiflow\source\gc" x="true"></e><e p="Wiiflow\source\list" x="false"></e><e p="Wiiflow\source\music" x="false"></e><e p="Wiiflow\source\config" x="true"></e><e p="Wiiflow\source\memory" x="true"></e><e p="Wiiflow\source" x="true"></e><e p="Wiiflow\source\channel" x="true"></e><e p="Wiiflow\source\menu" x="true"></e><e p="Wiiflow\source\network" x="false"></e><e p="Wiiflow\source\unzip" x="false"></e><e p="Wiiflow\wii" x="true"></e><e p="Wiiflow\wii\docs" x="false"></e><e p="Wiiflow\data" x="true"></e><e p="Wiiflow\resources" x="true"></e><e p="Wiiflow\resources\app_booter\source" x="false"></e><e p="Wiiflow\scripts" x="false"></e><e p="Wiiflow\source\devicemounter" x="true"></e><e p="Wiiflow\source\gui" x="true"></e><e p="Wiiflow" x="true"></e><e p="Wiiflow\data\sounds" x="false"></e><e p="Wiiflow\source\devicemounter\libwbfs" x="false"></e><e p="Wiiflow\wii\apps" x="false"></e><e p="Wiiflow\wii\wiiflow" x="false"></e></ViewState></pd>