From 6333a4b5ba5640ba40f78da95d23467a3c8399db Mon Sep 17 00:00:00 2001 From: LPFaint99 Date: Wed, 2 Apr 2014 22:51:46 -0700 Subject: [PATCH] fix exporting all saves in memcardmanager --- Source/Core/Core/HW/GCMemcard.cpp | 25 ++++++++++++++++-------- Source/Core/DolphinWX/MemcardManager.cpp | 2 +- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Source/Core/Core/HW/GCMemcard.cpp b/Source/Core/Core/HW/GCMemcard.cpp index 6d91d53527..6731f8e3cc 100644 --- a/Source/Core/Core/HW/GCMemcard.cpp +++ b/Source/Core/Core/HW/GCMemcard.cpp @@ -904,17 +904,26 @@ u32 GCMemcard::ExportGci(u8 index, const std::string& fileName, const std::strin File::IOFile gci; int offset = GCI; - gci.Open(fileName, "wb"); - - std::string fileType; - SplitPath(fileName, nullptr, nullptr, &fileType); - if (!strcasecmp(fileType.c_str(), ".gcs")) + if (!fileName.length()) { - offset = GCS; + std::string gciFilename; + // GCI_FileName should only fail if the gamecode is 0xFFFFFFFF + if (!GCI_FileName(index, gciFilename)) return SUCCESS; + gci.Open(directory + DIR_SEP + gciFilename, "wb"); } - else if (!strcasecmp(fileType.c_str(), ".sav")) + else { - offset = SAV; + std::string fileType; + gci.Open(fileName, "wb"); + SplitPath(fileName, nullptr, nullptr, &fileType); + if (!strcasecmp(fileType.c_str(), ".gcs")) + { + offset = GCS; + } + else if (!strcasecmp(fileType.c_str(), ".sav")) + { + offset = SAV; + } } if (!gci) diff --git a/Source/Core/DolphinWX/MemcardManager.cpp b/Source/Core/DolphinWX/MemcardManager.cpp index 37bd50340a..29bede0aa5 100644 --- a/Source/Core/DolphinWX/MemcardManager.cpp +++ b/Source/Core/DolphinWX/MemcardManager.cpp @@ -605,7 +605,7 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event) "%s\nand have the same name as a file on your memcard\nContinue?", path1.c_str())) for (int i = 0; i < DIRLEN; i++) { - CopyDeleteSwitch(memoryCard[slot]->ExportGci(i, nullptr, path1), -1); + CopyDeleteSwitch(memoryCard[slot]->ExportGci(i, "", path1), -1); } break; }