Fix for memcard manager, now exporting and copying, deleting saves on pages other than page one will work correctly

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1412 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
LPFaint99 2008-12-06 09:29:44 +00:00
parent 7b2e74b6fe
commit 5712a74ffd
2 changed files with 23 additions and 18 deletions

View File

@ -236,7 +236,7 @@ void CMemcardManager::OnPathChange(wxFileDirPickerEvent& event)
switch (event.GetId()) switch (event.GetId())
{ {
case ID_MEMCARD1PATH: case ID_MEMCARD1PATH:
page1 = 0; page0 = 0;
if (m_Memcard1PrevPage->IsEnabled()) m_Memcard1PrevPage->Disable(); if (m_Memcard1PrevPage->IsEnabled()) m_Memcard1PrevPage->Disable();
if (!strcasecmp(m_Memcard1Path->GetPath().mb_str(),m_Memcard2Path->GetPath().mb_str())) if (!strcasecmp(m_Memcard1Path->GetPath().mb_str(),m_Memcard2Path->GetPath().mb_str()))
{ {
@ -245,7 +245,7 @@ void CMemcardManager::OnPathChange(wxFileDirPickerEvent& event)
m_MemcardList[0]->ClearAll(); m_MemcardList[0]->ClearAll();
t_StatusLeft->SetLabel(wxEmptyString); t_StatusLeft->SetLabel(wxEmptyString);
} }
else if (ReloadMemcard(event.GetPath().mb_str(), 0, page1)) else if (ReloadMemcard(event.GetPath().mb_str(), 0, page0))
{ {
m_FixChecksumLeft->Enable(); m_FixChecksumLeft->Enable();
m_SaveImportLeft->Enable(); m_SaveImportLeft->Enable();
@ -264,13 +264,13 @@ void CMemcardManager::OnPathChange(wxFileDirPickerEvent& event)
m_Memcard1NextPage->Disable(); m_Memcard1NextPage->Disable();
break; break;
case ID_MEMCARD2PATH: case ID_MEMCARD2PATH:
page2 = 0; page1 = 0;
if (m_Memcard2PrevPage->IsEnabled()) m_Memcard2PrevPage->Disable(); if (m_Memcard2PrevPage->IsEnabled()) m_Memcard2PrevPage->Disable();
if (!strcasecmp(m_Memcard1Path->GetPath().mb_str(),m_Memcard2Path->GetPath().mb_str())) if (!strcasecmp(m_Memcard1Path->GetPath().mb_str(),m_Memcard2Path->GetPath().mb_str()))
{ {
wxMessageBox(wxT("Memcard already opened"), wxT("Error"), wxOK|wxICON_ERROR); wxMessageBox(wxT("Memcard already opened"), wxT("Error"), wxOK|wxICON_ERROR);
} }
else if (ReloadMemcard(event.GetPath().mb_str(), 1, page2)) else if (ReloadMemcard(event.GetPath().mb_str(), 1, page1))
{ {
m_FixChecksumRight->Enable(); m_FixChecksumRight->Enable();
m_SaveImportRight->Enable(); m_SaveImportRight->Enable();
@ -308,28 +308,28 @@ void CMemcardManager::OnPageChange(wxCommandEvent& event)
case ID_MEMCARD1NEXTPAGE: case ID_MEMCARD1NEXTPAGE:
if (!m_Memcard1PrevPage->IsEnabled()) m_Memcard1PrevPage->Enable(); if (!m_Memcard1PrevPage->IsEnabled()) m_Memcard1PrevPage->Enable();
if (!m_Memcard1NextPage->IsEnabled()) m_Memcard1NextPage->Enable(); if (!m_Memcard1NextPage->IsEnabled()) m_Memcard1NextPage->Enable();
page1++; page0++;
if (page1 == 7) m_Memcard1NextPage->Disable(); if (page0 == MAXPAGES) m_Memcard1NextPage->Disable();
ReloadMemcard(m_Memcard1Path->GetPath().mb_str(), 0, page1); ReloadMemcard(m_Memcard1Path->GetPath().mb_str(), 0, page0);
break; break;
case ID_MEMCARD2NEXTPAGE: case ID_MEMCARD2NEXTPAGE:
if (!m_Memcard2PrevPage->IsEnabled()) m_Memcard2PrevPage->Enable(); if (!m_Memcard2PrevPage->IsEnabled()) m_Memcard2PrevPage->Enable();
if (!m_Memcard2NextPage->IsEnabled()) m_Memcard2NextPage->Enable(); if (!m_Memcard2NextPage->IsEnabled()) m_Memcard2NextPage->Enable();
page2++; page1++;
if (page2 == 7) m_Memcard2NextPage->Disable(); if (page1 == MAXPAGES) m_Memcard2NextPage->Disable();
ReloadMemcard(m_Memcard2Path->GetPath().mb_str(), 1, page2); ReloadMemcard(m_Memcard2Path->GetPath().mb_str(), 1, page1);
break; break;
case ID_MEMCARD1PREVPAGE: case ID_MEMCARD1PREVPAGE:
if (!m_Memcard1NextPage->IsEnabled()) m_Memcard1NextPage->Enable(); if (!m_Memcard1NextPage->IsEnabled()) m_Memcard1NextPage->Enable();
page1--; page0--;
if (page1 == 0) m_Memcard1PrevPage->Disable(); if (!page0) m_Memcard1PrevPage->Disable();
ReloadMemcard(m_Memcard1Path->GetPath().mb_str(), 0, page1); ReloadMemcard(m_Memcard1Path->GetPath().mb_str(), 0, page0);
break; break;
case ID_MEMCARD2PREVPAGE: case ID_MEMCARD2PREVPAGE:
if (!m_Memcard2NextPage->IsEnabled()) m_Memcard2NextPage->Enable(); if (!m_Memcard2NextPage->IsEnabled()) m_Memcard2NextPage->Enable();
page2--; page1--;
if (page2 == 0) m_Memcard2PrevPage->Disable(); if (!page1) m_Memcard2PrevPage->Disable();
ReloadMemcard(m_Memcard2Path->GetPath().mb_str(), 1, page2); ReloadMemcard(m_Memcard2Path->GetPath().mb_str(), 1, page1);
break; break;
} }
} }
@ -343,6 +343,9 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
std::string fileName2(""); std::string fileName2("");
wxString blocksOpen; wxString blocksOpen;
if (index0 != -1 && page0) index0 += ITEMSPERPAGE * page0;
if (index1 != -1 && page1) index1 += ITEMSPERPAGE * page1;
switch (event.GetId()) switch (event.GetId())
{ {
case ID_COPYTOLEFT: case ID_COPYTOLEFT:

View File

@ -28,6 +28,8 @@
#include "MemoryCards/GCMemcard.h" #include "MemoryCards/GCMemcard.h"
#undef MEMCARD_MANAGER_STYLE #undef MEMCARD_MANAGER_STYLE
#define MEMCARD_MANAGER_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX | wxRESIZE_BORDER | wxMAXIMIZE_BOX #define MEMCARD_MANAGER_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX | wxRESIZE_BORDER | wxMAXIMIZE_BOX
#define ITEMSPERPAGE 16
#define MAXPAGES (128 / ITEMSPERPAGE) - 1
class CMemcardManager class CMemcardManager
: public wxDialog : public wxDialog
@ -41,8 +43,8 @@ class CMemcardManager
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
int page1, int page0,
page2; page1;
wxBoxSizer *sMain; wxBoxSizer *sMain;
wxBoxSizer *sPagesLeft; wxBoxSizer *sPagesLeft;