diff --git a/source/gui/GameTDB.cpp b/source/gui/GameTDB.cpp index 1058f791..b3aeb99e 100644 --- a/source/gui/GameTDB.cpp +++ b/source/gui/GameTDB.cpp @@ -779,6 +779,7 @@ int GameTDB::GetRatingDescriptors(const char * id, safe_vector & desc_li { if(strncmp(descriptor_text, "", strlen("")) == 0) { + desc_list[list_num].push_back('\0'); descriptor_text = strstr(descriptor_text, ""); if(!descriptor_text) break; @@ -818,8 +819,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 & feat_list) { if(strncmp(feature_text, "", strlen("")) == 0) { + feat_list[list_num].push_back('\0'); feature_text = strstr(feature_text, ""); if(!feature_text) break; @@ -891,8 +891,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 & 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 && strncmp(requiredField + strlen("required=\""), "true", 4) == 0) - acc_list[list_num].Required = true; + if(!requiredField) + { + delete [] data; + return -1; + } - ControlsNode = strstr(ControlsNode, ""); - if(!ColorNode) return color; - + if(!ColorNode) + return color; + char format[8]; sprintf(format, "0x%s", ColorNode); @@ -958,14 +963,19 @@ unsigned int GameTDB::FindCaseColor(char * data) unsigned int GameTDB::GetCaseColor(const char * id) { - unsigned int color = -1; - if(!id) return color; + unsigned int color = -1; + 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; } diff --git a/source/gui/coverflow.cpp b/source/gui/coverflow.cpp index db91f795..e8c58da4 100644 --- a/source/gui/coverflow.cpp +++ b/source/gui/coverflow.cpp @@ -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); } diff --git a/source/list/cache.cpp b/source/list/cache.cpp index 054a0b32..57e578c5 100644 --- a/source/list/cache.cpp +++ b/source/list/cache.cpp @@ -26,7 +26,7 @@ template CCache::CCache(safe_vector &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; diff --git a/source/list/cachedlist.cpp b/source/list/cachedlist.cpp index cb9dae1c..e4456bc8 100644 --- a/source/list/cachedlist.cpp +++ b/source/list/cachedlist.cpp @@ -50,6 +50,10 @@ void CachedList::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(); diff --git a/source/list/list.cpp b/source/list/list.cpp index a0704340..aa04836a 100644 --- a/source/list/list.cpp +++ b/source/list/list.cpp @@ -131,21 +131,42 @@ void CList::GetHeaders(safe_vector pathlist, safe_vector 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); - Asciify(tmp.title); - tmp.hdr.casecolor = 0; - headerlist.push_back(tmp); + + 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 ); + continue; + } } continue; } @@ -175,13 +196,13 @@ void CList::GetHeaders(safe_vector pathlist, safe_vector 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); - + tmp.hdr.wifi = gameTDB.GetWifiPlayers((char *)tmp.hdr.id); tmp.hdr.players = gameTDB.GetPlayers((char *)tmp.hdr.id); //tmp.hdr.controllers = gameTDB.GetAccessories((char *)tmp.hdr.id); @@ -203,8 +224,7 @@ void CList::GetHeaders(safe_vector pathlist, safe_vector::GetHeaders(safe_vector pathlist, safe_vector \ No newline at end of file + \ No newline at end of file diff --git a/wiiflow.pnps b/wiiflow.pnps index c628f4bd..4d93998d 100644 --- a/wiiflow.pnps +++ b/wiiflow.pnps @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file