-updated scummvm ini parser, more stable and doesnt

codedump when returning to wiiflow anymore
This commit is contained in:
fix94.1 2012-04-29 12:33:24 +00:00
parent bd15f4711d
commit 576ffcddd9

View File

@ -120,16 +120,14 @@ safe_vector<dir_discHdr> Plugin::ParseScummvmINI(Config &ini, string Device)
if(!ini.loaded()) if(!ini.loaded())
return gameHeader; return gameHeader;
string game = ini.firstDomain().c_str(); string game = ini.firstDomain().c_str();
if(Device.rfind("usb") != string::npos)
Device.erase(3, 1);
dir_discHdr tmp; dir_discHdr tmp;
while(1) while(1)
{ {
if(game == emptyString) if(game == emptyString)
break; break;
if(strncasecmp(game.c_str(), "/", 1) == 0 || if(strncasecmp(game.c_str(), "/", 1) == 0 ||
strncasecmp(lowerCase(ini.getString(game,"description")).c_str(), "/", 1) == 0 || strncasecmp(ini.getString(game,"description").c_str(), "/", 1) == 0 ||
lowerCase(ini.getStrings(game, "path", '/')[0]).rfind(Device.c_str()) == string::npos) strncasecmp(ini.getWString(game, "path").toUTF8().c_str(), Device.c_str(), 3) != 0)
{ {
game = ini.nextDomain(); game = ini.nextDomain();
continue; continue;
@ -140,7 +138,7 @@ safe_vector<dir_discHdr> Plugin::ParseScummvmINI(Config &ini, string Device)
tmpString.fromUTF8(ini.getString(game,"description").c_str()); tmpString.fromUTF8(ini.getString(game,"description").c_str());
wcsncpy(tmp.title, tmpString.c_str(), 64); 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", tmpString.c_str()); gprintf("Found: %ls\n", tmp.title);
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);