Changed the way the iterator is used in PatchAddEdit, I thought I'd submit it since it makes for shorter code.

Also a couple of bugfixes

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1755 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
facugaich
2009-01-03 23:02:13 +00:00
parent 22753f9e3c
commit 09b3d2d227
4 changed files with 45 additions and 47 deletions

View File

@ -643,14 +643,19 @@ void CISOProperties::PatchList_Load()
void CISOProperties::PatchList_Save()
{
std::vector<std::string> lines;
u32 index = 0;
for (std::vector<PatchEngine::Patch>::const_iterator onFrame_it = onFrame.begin(); onFrame_it != onFrame.end(); ++onFrame_it)
{
lines.push_back(onFrame_it->active ? "+$" + onFrame_it->name : "$" + onFrame_it->name);
lines.push_back(Patches->IsChecked(index) ? "+$" + onFrame_it->name : "$" + onFrame_it->name);
for (std::vector<PatchEngine::PatchEntry>::const_iterator iter2 = onFrame_it->entries.begin(); iter2 != onFrame_it->entries.end(); ++iter2)
{
lines.push_back(std::string(wxString::Format(wxT("0x%08X:%s:0x%08X"), iter2->address, PatchEngine::PatchTypeStrings[iter2->type], iter2->value).mb_str()));
std::string temp;
ToStringFromFormat(&temp, "0x%08X:%s:0x%08X", iter2->address, PatchEngine::PatchTypeStrings[iter2->type], iter2->value);
lines.push_back(temp);
}
++index;
}
GameIni.SetLines("OnFrame", lines);
lines.clear();
@ -671,7 +676,11 @@ void CISOProperties::PatchButtonClicked(wxCommandEvent& event)
case ID_ADDPATCH:
{
CPatchAddEdit dlg(-1, this, 1, _("Add Patch"));
dlg.ShowModal();
if (dlg.ShowModal() == wxID_OK)
{
Patches->Append(wxString::FromAscii(onFrame.back().name.c_str()));
Patches->Check(onFrame.size() - 1, onFrame.back().active);
}
}
break;
case ID_REMOVEPATCH: