void CMemcardManager::ChangePath(int slot) { int slot2 = (slot == SLOT_A) ? SLOT_B : SLOT_A; page[slot] = FIRSTPAGE; if (mcmSettings.usePages && m_PrevPage[slot]->IsEnabled()) { m_PrevPage[slot]->Disable(); m_MemcardList[slot]->prevPage = false; } if (!strcasecmp(m_MemcardPath[slot2]->GetPath().mb_str(), m_MemcardPath[slot]->GetPath().mb_str())) { if(m_MemcardPath[slot]->GetPath().length()) PanicAlertT("Memcard already opened"); } else { if (m_MemcardPath[slot]->GetPath().length() && ReloadMemcard(m_MemcardPath[slot]->GetPath().mb_str(), slot)) { mcmSettings.twoCardsLoaded = true; m_SaveImport[slot]->Enable(); m_SaveExport[slot]->Enable(); m_Delete[slot]->Enable(); } else { if (memoryCard[slot]) { delete memoryCard[slot]; memoryCard[slot] = NULL; } mcmSettings.twoCardsLoaded = false; m_MemcardPath[slot]->SetPath(wxEmptyString); m_MemcardList[slot]->ClearAll(); t_Status[slot]->SetLabel(wxEmptyString); m_SaveImport[slot]->Disable(); m_SaveExport[slot]->Disable(); m_Delete[slot]->Disable(); if (mcmSettings.usePages) { m_PrevPage[slot]->Disable(); m_NextPage[slot]->Disable(); } } } if (m_Delete[SLOT_A]->IsEnabled() && m_Delete[SLOT_B]->IsEnabled()) { m_CopyFrom[SLOT_A]->Enable(); m_CopyFrom[SLOT_B]->Enable(); } else { m_CopyFrom[SLOT_A]->Disable(); m_CopyFrom[SLOT_B]->Disable(); } }
void CMemcardManager::OnPageChange(wxCommandEvent& event) { int slot = SLOT_B; switch (event.GetId()) { case ID_NEXTPAGE_A: slot = SLOT_A; case ID_NEXTPAGE_B: if (!m_PrevPage[slot]->IsEnabled()) { m_PrevPage[slot]->Enable(); m_MemcardList[slot]->prevPage = true; } page[slot]++; if (page[slot] == maxPages) { m_NextPage[slot]->Disable(); m_MemcardList[slot]->nextPage = false; } ReloadMemcard(WxStrToStr(m_MemcardPath[slot]->GetPath()), slot); break; case ID_PREVPAGE_A: slot = SLOT_A; case ID_PREVPAGE_B: if (!m_NextPage[slot]->IsEnabled()) { m_NextPage[slot]->Enable(); m_MemcardList[slot]->nextPage = true; } page[slot]--; if (!page[slot]) { m_PrevPage[slot]->Disable(); m_MemcardList[slot]->prevPage = false; } ReloadMemcard(WxStrToStr(m_MemcardPath[slot]->GetPath()), slot); break; } }
void CMemcardManager::ChangePath(int slot) { int slot2 = (slot == SLOT_A) ? SLOT_B : SLOT_A; page[slot] = FIRSTPAGE; if (mcmSettings.usePages && m_PrevPage[slot]->IsEnabled()) { m_PrevPage[slot]->Disable(); m_MemcardList[slot]->prevPage = false; } if (!m_MemcardPath[SLOT_A]->GetPath().CmpNoCase(m_MemcardPath[SLOT_B]->GetPath())) { if (m_MemcardPath[slot]->GetPath().length()) wxMessageBox(_("Memcard already opened")); } else { if (m_MemcardPath[slot]->GetPath().length() && ReloadMemcard(WxStrToStr(m_MemcardPath[slot]->GetPath()), slot)) { if (memoryCard[slot2]) { mcmSettings.twoCardsLoaded = true; } m_SaveImport[slot]->Enable(); m_SaveExport[slot]->Enable(); m_Delete[slot]->Enable(); } else { if (memoryCard[slot]) { delete memoryCard[slot]; memoryCard[slot] = nullptr; } mcmSettings.twoCardsLoaded = false; m_MemcardPath[slot]->SetPath(wxEmptyString); m_MemcardList[slot]->ClearAll(); t_Status[slot]->SetLabel(wxEmptyString); m_SaveImport[slot]->Disable(); m_SaveExport[slot]->Disable(); m_Delete[slot]->Disable(); if (mcmSettings.usePages) { m_PrevPage[slot]->Disable(); m_NextPage[slot]->Disable(); } } } m_CopyFrom[SLOT_A]->Enable(mcmSettings.twoCardsLoaded); m_CopyFrom[SLOT_B]->Enable(mcmSettings.twoCardsLoaded); }
void CMemcardManager::OnMenuChange(wxCommandEvent& event) { int _id = event.GetId(); switch (_id) { case ID_MEMCARDPATH_A: case ID_MEMCARDPATH_B: DefaultMemcard[_id - ID_MEMCARDPATH_A] = WxStrToStr(m_MemcardPath[_id - ID_MEMCARDPATH_A]->GetPath()); return; case ID_USEPAGES: mcmSettings.usePages = !mcmSettings.usePages; if (!mcmSettings.usePages) { m_PrevPage[SLOT_A]->Disable(); m_PrevPage[SLOT_B]->Disable(); m_NextPage[SLOT_A]->Disable(); m_NextPage[SLOT_B]->Disable(); m_MemcardList[SLOT_A]->prevPage = m_MemcardList[SLOT_B]->prevPage = false; page[SLOT_A] = page[SLOT_B] = FIRSTPAGE; } break; case NUMBER_OF_COLUMN: for (int i = COLUMN_GAMECODE; i <= NUMBER_OF_COLUMN; i++) { mcmSettings.column[i] = !mcmSettings.column[i]; } break; default: mcmSettings.column[_id] = !mcmSettings.column[_id]; break; } if (memoryCard[SLOT_A]) ReloadMemcard(WxStrToStr(m_MemcardPath[SLOT_A]->GetPath()), SLOT_A); if (memoryCard[SLOT_B]) ReloadMemcard(WxStrToStr(m_MemcardPath[SLOT_B]->GetPath()), SLOT_B); }
bool CMemcardManager::CopyDeleteSwitch(u32 error, int slot) { switch (error) { case GCS: SuccessAlertT("File converted to .gci"); break; case SUCCESS: if (slot != -1) { memoryCard[slot]->FixChecksums(); if (!memoryCard[slot]->Save()) PanicAlertT(E_SAVEFAILED); page[slot] = FIRSTPAGE; ReloadMemcard(WxStrToStr(m_MemcardPath[slot]->GetPath()), slot); } break; case NOMEMCARD: PanicAlertT("File is not recognized as a memcard"); break; case OPENFAIL: PanicAlertT("File could not be opened\nor does not have a valid extension"); break; case OUTOFBLOCKS: if (slot == -1) { PanicAlertT(E_UNK); break; } PanicAlertT("Only %d blocks available", memoryCard[slot]->GetFreeBlocks()); break; case OUTOFDIRENTRIES: PanicAlertT("No free dir index entries"); break; case LENGTHFAIL: PanicAlertT("Imported file has invalid length"); break; case INVALIDFILESIZE: PanicAlertT("The save you are trying to copy has an invalid file size"); break; case TITLEPRESENT: PanicAlertT("Memcard already has a save for this title"); break; case SAVFAIL: PanicAlertT("Imported file has sav extension\nbut does not have a correct header"); break; case GCSFAIL: PanicAlertT("Imported file has gsc extension\nbut does not have a correct header"); break; case FAIL: if (slot == -1) { PanicAlertT("Export Failed"); return false; } PanicAlertT("Invalid bat.map or dir entry"); break; case WRITEFAIL: PanicAlertT(E_SAVEFAILED); break; case DELETE_FAIL: PanicAlertT("Order of files in the File Directory do not match the block order\n" "Right click and export all of the saves,\nand import the saves to a new memcard\n"); break; default: PanicAlertT(E_UNK); break; } SetFocus(); return true; }