make working dir save to a platform specific file

fix a possible buffer overflow in MemcardManager when creating a gci savename
fix Previous Page button from being available after deleting the last save on page 2
remove magic numbers from GCMemcard

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3819 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
LPFaint99
2009-07-17 06:03:53 +00:00
parent 598d640042
commit 15d49e5afd
4 changed files with 113 additions and 87 deletions

View File

@ -586,7 +586,8 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
case ID_SAVEEXPORT_B:
if (index != wxNOT_FOUND)
{
char tempC[36], tempC2[32];
char tempC[10 + DENTRY_STRLEN],
tempC2[DENTRY_STRLEN];
memoryCard[slot]->DEntry_GameCode(index,tempC);
memoryCard[slot]->DEntry_FileName(index,tempC2);
sprintf(tempC, "%s_%s.gci", tempC, tempC2);
@ -734,10 +735,10 @@ bool CMemcardManager::ReloadMemcard(const char *fileName, int card)
}
int pagesMax = 128;
if (m_MemcardList[card]->usePages) pagesMax = (page[card] + 1) * itemsPerPage;
for (j = page[card] * itemsPerPage;(j < nFiles) && (j < pagesMax);j++)
for (j = page[card] * itemsPerPage;(j < nFiles) && (j < pagesMax); j++)
{
char title[32];
char comment[32];
char title[DENTRY_STRLEN];
char comment[DENTRY_STRLEN];
u16 blocks;
u16 firstblock;
@ -807,7 +808,12 @@ bool CMemcardManager::ReloadMemcard(const char *fileName, int card)
if (m_MemcardList[card]->usePages)
{
if ((j == nFiles))
if (nFiles <= itemsPerPage)
{
m_PrevPage[card]->Disable();
m_MemcardList[card]->prevPage = false;
}
if (j == nFiles)
{
m_NextPage[card]->Disable();
m_MemcardList[card]->nextPage = false;