-fixed 99,999% herpderp bug that wiiflow freeze when trying

to enter emulator gameview
-set title length copy to 64 chars, not that we get a codedump
This commit is contained in:
fix94.1 2012-04-28 16:52:41 +00:00
parent 7130e95282
commit d714ded900
2 changed files with 14 additions and 10 deletions

View File

@ -170,7 +170,7 @@ void CList<dir_discHdr>::GetHeaders(safe_vector<string> pathlist, safe_vector<di
//Asciify( tmp.title ); //Asciify( tmp.title );
wstringEx tmpString; wstringEx tmpString;
tmpString.fromUTF8(GTitle.c_str()); tmpString.fromUTF8(GTitle.c_str());
wcsncpy(tmp.title, tmpString.c_str(), tmpString.size()); wcsncpy(tmp.title, tmpString.c_str(), 64);
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));
@ -206,7 +206,7 @@ void CList<dir_discHdr>::GetHeaders(safe_vector<string> pathlist, safe_vector<di
//Asciify(tmp.title); //Asciify(tmp.title);
wstringEx tmpString; wstringEx tmpString;
tmpString.fromUTF8((const char *)tmp.hdr.title); tmpString.fromUTF8((const char *)tmp.hdr.title);
wcsncpy(tmp.title, tmpString.c_str(), tmpString.size()); wcsncpy(tmp.title, tmpString.c_str(), 64);
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));
@ -263,7 +263,7 @@ void CList<dir_discHdr>::GetHeaders(safe_vector<string> pathlist, safe_vector<di
//Asciify(tmp.title); //Asciify(tmp.title);
wstringEx tmpString; wstringEx tmpString;
tmpString.fromUTF8(GTitle.c_str()); tmpString.fromUTF8(GTitle.c_str());
wcsncpy(tmp.title, tmpString.c_str(), tmpString.size()); wcsncpy(tmp.title, tmpString.c_str(), 64);
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);
@ -289,7 +289,7 @@ void CList<dir_discHdr>::GetHeaders(safe_vector<string> pathlist, safe_vector<di
//Asciify(tmp.title); //Asciify(tmp.title);
wstringEx tmpString; wstringEx tmpString;
tmpString.fromUTF8((const char *)tmp.hdr.title); tmpString.fromUTF8((const char *)tmp.hdr.title);
wcsncpy(tmp.title, tmpString.c_str(), tmpString.size()); wcsncpy(tmp.title, tmpString.c_str(), 64);
tmp.hdr.casecolor = ccolor != 1 ? ccolor : 1; tmp.hdr.casecolor = ccolor != 1 ? ccolor : 1;
headerlist.push_back(tmp); headerlist.push_back(tmp);
continue; continue;
@ -362,7 +362,7 @@ void CList<dir_discHdr>::GetHeaders(safe_vector<string> pathlist, safe_vector<di
tmp.hdr.casecolor = ccolor != 1 ? ccolor : 1; tmp.hdr.casecolor = ccolor != 1 ? ccolor : 1;
} }
//Asciify(tmp.title); //Asciify(tmp.title);
wcsncpy(tmp.title, tmpString.c_str(), tmpString.size()); wcsncpy(tmp.title, tmpString.c_str(), 64);
headerlist.push_back(tmp); headerlist.push_back(tmp);
continue; continue;
} }
@ -394,7 +394,7 @@ void CList<dir_discHdr>::GetHeaders(safe_vector<string> pathlist, safe_vector<di
if (tmp.hdr.magic == 0x5D1C9EA3) if (tmp.hdr.magic == 0x5D1C9EA3)
{ {
//Asciify(tmp.title); //Asciify(tmp.title);
wcsncpy(tmp.title, tmpString.c_str(), tmpString.size()); wcsncpy(tmp.title, tmpString.c_str(), 64);
headerlist.push_back(tmp); headerlist.push_back(tmp);
} }
continue; continue;
@ -405,7 +405,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)); //mbstowcs(tmp.title, (const char *)tmp.hdr.title, sizeof(tmp.hdr.title));
//Asciify(tmp.title); //Asciify(tmp.title);
tmpString.fromUTF8((const char *)tmp.hdr.title); tmpString.fromUTF8((const char *)tmp.hdr.title);
wcsncpy(tmp.title, tmpString.c_str(), tmpString.size()); wcsncpy(tmp.title, tmpString.c_str(), 64);
tmp.hdr.casecolor = ccolor != 1 ? ccolor : 1; tmp.hdr.casecolor = ccolor != 1 ? ccolor : 1;
headerlist.push_back(tmp); headerlist.push_back(tmp);
} }
@ -436,7 +436,7 @@ void CList<dir_discHdr>::GetHeaders(safe_vector<string> pathlist, safe_vector<di
//Asciify(tmp.title); //Asciify(tmp.title);
wstringEx tmpString; wstringEx tmpString;
tmpString.fromUTF8(tempname); tmpString.fromUTF8(tempname);
wcsncpy(tmp.title, tmpString.c_str(), tmpString.size()); wcsncpy(tmp.title, tmpString.c_str(), 64);
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

View File

@ -117,6 +117,8 @@ safe_vector<dir_discHdr> Plugin::ParseScummvmINI(Config &ini, string Device)
{ {
gprintf("Parsing scummvm.ini\n"); gprintf("Parsing scummvm.ini\n");
safe_vector<dir_discHdr> gameHeader; safe_vector<dir_discHdr> gameHeader;
if(!ini.loaded())
return gameHeader;
string game = ini.firstDomain().c_str(); string game = ini.firstDomain().c_str();
if(Device.rfind("usb") != string::npos) if(Device.rfind("usb") != string::npos)
Device.erase(3, 1); Device.erase(3, 1);
@ -134,9 +136,11 @@ safe_vector<dir_discHdr> Plugin::ParseScummvmINI(Config &ini, string Device)
} }
memset(&tmp, 0, sizeof(dir_discHdr)); memset(&tmp, 0, sizeof(dir_discHdr));
tmp.hdr.casecolor = caseColors.back(); tmp.hdr.casecolor = caseColors.back();
mbstowcs(tmp.title, ini.getString(game,"description").c_str(), 64); wstringEx tmpString;
tmpString.fromUTF8(ini.getString(game,"description").c_str());
wcsncpy(tmp.title, tmpString.c_str(), 64);
strncpy(tmp.path, game.c_str(), sizeof(tmp.path)); strncpy(tmp.path, game.c_str(), sizeof(tmp.path));
gprintf("Found: %s\n", ini.getString(game,"description").c_str()); gprintf("Found: %s\n", tmpString.c_str());
tmp.hdr.magic = magicWords.back(); tmp.hdr.magic = magicWords.back();
tmp.hdr.gc_magic = 0x4c4f4c4f; tmp.hdr.gc_magic = 0x4c4f4c4f;
gameHeader.push_back(tmp); gameHeader.push_back(tmp);