// This routine receives a file from inifile_read, trims it, // Then sends the command to be parsed. void inifile_process(wxTextFile &f1 ) { for (uint i = 0; i < f1.GetLineCount(); i++) { inifile_processString(f1[i]); } }
// This routine loads cheats from a zip file // Returns number of cheats loaded // Note: Should be called after InitPatches() // Note: only load cheats from the root folder of the zip int LoadCheatsFromZip(wxString gameCRC, const wxString& cheatsArchiveFilename) { gameCRC.MakeUpper(); int before = cheatnumber; std::auto_ptr<wxZipEntry> entry; wxFFileInputStream in(cheatsArchiveFilename); wxZipInputStream zip(in); while (entry.reset(zip.GetNextEntry()), entry.get() != NULL) { wxString name = entry->GetName(); name.MakeUpper(); if (name.Find(gameCRC) == 0 && name.Find(L".PNACH")+6u == name.Length()) { PatchesCon->WriteLn(Color_Green, L"Loading patch '%s' from archive '%s'", WX_STR(entry->GetName()), WX_STR(cheatsArchiveFilename)); wxTextInputStream pnach(zip); while (!zip.Eof()) { inifile_processString(pnach.ReadLine()); } } } return cheatnumber - before; }