Memcardmanager fixes. Fix for missing return values in switch statement, fix for return value from importfile
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1498 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
8b24a9b498
commit
cf987d255d
|
@ -510,6 +510,22 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
|
|||
memoryCard[SLOT_A]->Save();
|
||||
ReloadMemcard(m_MemcardPath_A->GetPath().mb_str(), SLOT_A, FIRSTPAGE);
|
||||
break;
|
||||
case TITLEPRESENT:
|
||||
wxMessageBox(wxT("Memcard already has a save for this title"),
|
||||
wxT("Error"), wxOK|wxICON_ERROR);
|
||||
break;
|
||||
case INVALIDFILESIZE:
|
||||
wxMessageBox(wxT("The save you are trying to copy has an invalid file size"),
|
||||
wxT("Error"), wxOK|wxICON_ERROR);
|
||||
case OUTOFBLOCKS:
|
||||
blocksOpen.Printf(wxT("Only %d blocks available"), memoryCard[slot]->GetFreeBlocks());
|
||||
wxMessageBox(blocksOpen, wxT("Error"), wxOK|wxICON_ERROR);
|
||||
break;
|
||||
case OUTOFDIRENTRIES:
|
||||
wxMessageBox(wxT("No free dir index entries"),
|
||||
wxT("Error"), wxOK|wxICON_ERROR);
|
||||
default:
|
||||
wxMessageBox(wxEmptyString, wxT("Error"), wxOK|wxICON_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -535,6 +551,24 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
|
|||
memoryCard[SLOT_B]->Save();
|
||||
ReloadMemcard(m_MemcardPath_B->GetPath().mb_str(), SLOT_B, FIRSTPAGE);
|
||||
break;
|
||||
case TITLEPRESENT:
|
||||
wxMessageBox(wxT("Memcard already has a save for this title"),
|
||||
wxT("Error"), wxOK|wxICON_ERROR);
|
||||
break;
|
||||
case INVALIDFILESIZE:
|
||||
wxMessageBox(wxT("The save you are trying to copy has an invalid file size"),
|
||||
wxT("Error"), wxOK|wxICON_ERROR);
|
||||
break;
|
||||
case OUTOFBLOCKS:
|
||||
blocksOpen.Printf(wxT("Only %d blocks available"), memoryCard[slot]->GetFreeBlocks());
|
||||
wxMessageBox(blocksOpen, wxT("Error"), wxOK|wxICON_ERROR);
|
||||
break;
|
||||
case OUTOFDIRENTRIES:
|
||||
wxMessageBox(wxT("No free dir index entries"),
|
||||
wxT("Error"), wxOK|wxICON_ERROR);
|
||||
break;
|
||||
default:
|
||||
wxMessageBox(wxEmptyString, wxT("Error"), wxOK|wxICON_ERROR);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -305,7 +305,7 @@ u32 GCMemcard::ImportFile(DEntry& direntry, u8* contents, int remove)
|
|||
FixChecksums();
|
||||
Save();
|
||||
}
|
||||
return fileBlocks;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
u32 GCMemcard::GetFileData(u32 index, u8* dest, bool old) //index in the directory array
|
||||
|
@ -665,10 +665,10 @@ u32 GCMemcard::CopyFrom(GCMemcard& source, u32 index)
|
|||
if (!mcdFile) return NOMEMCARD;
|
||||
|
||||
DEntry d;
|
||||
if (!source.GetFileInfo(index, d)) return 0;
|
||||
if (!source.GetFileInfo(index, d)) return NOMEMCARD;
|
||||
|
||||
u32 size = source.GetFileSize(index);
|
||||
if (size == 0xFFFF) return 0;
|
||||
if (size == 0xFFFF) return INVALIDFILESIZE;
|
||||
u8 *t = new u8[size * 0x2000];
|
||||
|
||||
switch (source.GetFileData(index, t, true))
|
||||
|
@ -680,15 +680,11 @@ u32 GCMemcard::CopyFrom(GCMemcard& source, u32 index)
|
|||
delete[] t;
|
||||
return NOMEMCARD;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
u32 ret = ImportFile(d,t,0);
|
||||
|
||||
delete[] t;
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
s32 GCMemcard::ImportGci(const char *fileName, std::string fileName2)
|
||||
{
|
||||
|
|
|
@ -44,6 +44,7 @@ enum
|
|||
OUTOFDIRENTRIES,
|
||||
NOMEMCARD,
|
||||
NOFILE,
|
||||
INVALIDFILESIZE,
|
||||
TITLEPRESENT,
|
||||
SUCCESS = 0x2000,
|
||||
FAIL,
|
||||
|
|
Loading…
Reference in New Issue