a few more changes, you can now set a default memcard to load, error messages made a bit more clear

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1601 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
LPFaint99 2008-12-20 08:47:38 +00:00
parent c695ebd6f1
commit c652c5e1f0
3 changed files with 30 additions and 21 deletions

View File

@ -110,6 +110,8 @@ CMemcardManager::CMemcardManager(wxWindow* parent, wxWindowID id, const wxString
if (MemcardManagerIni.Load(CONFIG_FILE)) if (MemcardManagerIni.Load(CONFIG_FILE))
{ {
MemcardManagerIni.Get("MemcardManager", "Items per page", &itemsPerPage, 16); MemcardManagerIni.Get("MemcardManager", "Items per page", &itemsPerPage, 16);
MemcardManagerIni.Get("MemcardManager", "DefaultMemcardA", &(DefaultMemcard[SLOT_A]), ".");
MemcardManagerIni.Get("MemcardManager", "DefaultMemcardB", &(DefaultMemcard[SLOT_B]), ".");
} }
else itemsPerPage = 16; else itemsPerPage = 16;
maxPages = (128 / itemsPerPage) - 1; maxPages = (128 / itemsPerPage) - 1;
@ -130,6 +132,8 @@ CMemcardManager::~CMemcardManager()
} }
MemcardManagerIni.Load(CONFIG_FILE); MemcardManagerIni.Load(CONFIG_FILE);
MemcardManagerIni.Set("MemcardManager", "Items per page", itemsPerPage); MemcardManagerIni.Set("MemcardManager", "Items per page", itemsPerPage);
MemcardManagerIni.Set("MemcardManager", "DefaultMemcardA", DefaultMemcard[SLOT_A]);
MemcardManagerIni.Set("MemcardManager", "DefaultMemcardB", DefaultMemcard[SLOT_B]);
MemcardManagerIni.Save(CONFIG_FILE); MemcardManagerIni.Save(CONFIG_FILE);
} }
@ -267,22 +271,21 @@ void CMemcardManager::CreateGUIControls()
this->SetSizer(sMain); this->SetSizer(sMain);
sMain->SetSizeHints(this); sMain->SetSizeHints(this);
Fit(); Fit();
for (int i = 0; i < 2; i++)
m_PrevPage[SLOT_A]->Disable(); {
m_NextPage[SLOT_A]->Disable(); m_PrevPage[i]->Disable();
m_PrevPage[SLOT_B]->Disable(); m_NextPage[i]->Disable();
m_NextPage[SLOT_B]->Disable(); m_CopyFrom[i]->Disable();
m_CopyFrom[SLOT_A]->Disable(); m_FixChecksum[i]->Disable();
m_CopyFrom[SLOT_B]->Disable(); m_SaveImport[i]->Disable();
m_FixChecksum[SLOT_A]->Disable(); m_SaveExport[i]->Disable();
m_FixChecksum[SLOT_B]->Disable(); m_Delete[i]->Disable();
m_SaveImport[SLOT_A]->Disable(); if (strcasecmp(DefaultMemcard[i].c_str(), "."))
m_SaveExport[SLOT_A]->Disable(); {
m_SaveImport[SLOT_B]->Disable(); m_MemcardPath[i]->SetPath(wxT(DefaultMemcard[i]));
m_SaveExport[SLOT_B]->Disable(); i?ChangePath(ID_MEMCARDPATH_B):ChangePath(ID_MEMCARDPATH_A);
m_Delete[SLOT_A]->Disable(); }
m_Delete[SLOT_B]->Disable(); }
} }
void CMemcardManager::OnClose(wxCloseEvent& WXUNUSED (event)) void CMemcardManager::OnClose(wxCloseEvent& WXUNUSED (event))
@ -291,10 +294,15 @@ void CMemcardManager::OnClose(wxCloseEvent& WXUNUSED (event))
} }
void CMemcardManager::OnPathChange(wxFileDirPickerEvent& event) void CMemcardManager::OnPathChange(wxFileDirPickerEvent& event)
{
ChangePath(event.GetId());
}
void CMemcardManager::ChangePath(int id)
{ {
int slot = SLOT_B; int slot = SLOT_B;
int slot2 = SLOT_A; int slot2 = SLOT_A;
switch (event.GetId()) switch (id)
{ {
case ID_MEMCARDPATH_A: case ID_MEMCARDPATH_A:
slot = SLOT_A; slot = SLOT_A;
@ -310,7 +318,7 @@ void CMemcardManager::OnPathChange(wxFileDirPickerEvent& event)
{ {
PanicAlert(E_ALREADYOPENED); PanicAlert(E_ALREADYOPENED);
} }
else if (ReloadMemcard(event.GetPath().mb_str(), slot)) else if (ReloadMemcard(m_MemcardPath[slot]->GetPath().mb_str(), slot))
{ {
m_MemcardList[slot2]->twoCardsLoaded = true; m_MemcardList[slot2]->twoCardsLoaded = true;
m_FixChecksum[slot]->Enable(); m_FixChecksum[slot]->Enable();

View File

@ -128,6 +128,7 @@ class CMemcardManager
void OnMenuChange(wxCommandEvent& event); void OnMenuChange(wxCommandEvent& event);
void OnPageChange(wxCommandEvent& event); void OnPageChange(wxCommandEvent& event);
void OnPathChange(wxFileDirPickerEvent& event); void OnPathChange(wxFileDirPickerEvent& event);
void ChangePath(int id);
bool CopyDeleteSwitch(u32 error, int slot); bool CopyDeleteSwitch(u32 error, int slot);
class CMemcardListCtrl : public wxListCtrl class CMemcardListCtrl : public wxListCtrl

View File

@ -100,7 +100,7 @@ GCMemcard::GCMemcard(const char *filename)
fail = false; fail = false;
if (!mcd) if (!mcd)
{ {
if (!PanicYesNo("File does not exist.\n Create a new 16MB Memcard?")) if (!PanicYesNo("\"%s\" does not exist.\n Create a new 16MB Memcard?", filename))
{ {
fail = true; fail = true;
return; return;
@ -124,7 +124,7 @@ GCMemcard::GCMemcard(const char *filename)
if (strcasecmp(fileType.c_str(), ".raw") && strcasecmp(fileType.c_str(), ".gcp")) if (strcasecmp(fileType.c_str(), ".raw") && strcasecmp(fileType.c_str(), ".gcp"))
{ {
fail = true; fail = true;
PanicAlert("File does not have a valid extension (.raw/.gcp)"); PanicAlert("File has the extension \"%s\"\nvalid extensions are (.raw/.gcp)", fileType.c_str());
return; return;
} }
} }
@ -241,7 +241,7 @@ GCMemcard::GCMemcard(const char *filename)
else else
{ {
fail = true; fail = true;
PanicAlert("Memcard failed to load\n Card size is invalid"); PanicAlert("Memcard failed to load\n Card size is invalid (%04X)", size);
} }
} }