void SCoreStartupParameter::CheckMemcardPath(std::string& memcardPath, std::string gameRegion, bool isSlotA) { std::string ext("." + gameRegion + ".raw"); if (memcardPath.empty()) { // Use default memcard path if there is no user defined name std::string defaultFilename = isSlotA ? GC_MEMCARDA : GC_MEMCARDB; #ifdef _WIN32 memcardPath = "." + File::GetUserPath(D_GCUSER_IDX).substr(File::GetExeDirectory().size()) + defaultFilename + ext; #else memcardPath = File::GetUserPath(D_GCUSER_IDX) + defaultFilename + ext; #endif } else { std::string filename = memcardPath; std::string region = filename.substr(filename.size()-7, 3); bool hasregion = false; hasregion |= region.compare(USA_DIR) == 0; hasregion |= region.compare(JAP_DIR) == 0; hasregion |= region.compare(EUR_DIR) == 0; if (!hasregion) { // filename doesn't have region in the extension if (File::Exists(filename)) { // If the old file exists we are polite and ask if we should copy it std::string oldFilename = filename; filename.replace(filename.size()-4, 4, ext); if (PanicYesNoT("Memory Card filename in Slot %c is incorrect\n" "Region not specified\n\n" "Slot %c path was changed to\n" "%s\n" "Would you like to copy the old file to this new location?\n", isSlotA ? 'A':'B', isSlotA ? 'A':'B', filename.c_str())) { if (!File::Copy(oldFilename, filename)) PanicAlertT("Copy failed"); } } memcardPath = filename; // Always correct the path! } else if (region.compare(gameRegion) != 0) { // filename has region, but it's not == gameRegion // Just set the correct filename, the EXI Device will create it if it doesn't exist memcardPath = filename.replace(filename.size()-ext.size(), ext.size(), ext);; } } }
void CARCodeAddEdit::SaveCheatData(wxCommandEvent& WXUNUSED (event)) { std::vector<ActionReplay::AREntry> decryptedLines; std::vector<std::string> encryptedLines; // Split the entered cheat into lines. std::vector<std::string> userInputLines; SplitString(WxStrToStr(EditCheatCode->GetValue()), '\n', userInputLines); for (size_t i = 0; i < userInputLines.size(); i++) { // Make sure to ignore unneeded whitespace characters. std::string line_str = StripSpaces(userInputLines[i]); if (line_str == "") continue; // Let's parse the current line. Is it in encrypted or decrypted form? std::vector<std::string> pieces; SplitString(line_str, ' ', pieces); if (pieces.size() == 2 && pieces[0].size() == 8 && pieces[1].size() == 8) { // Decrypted code line. u32 addr = std::stoul(pieces[0], nullptr, 16); u32 value = std::stoul(pieces[1], nullptr, 16); decryptedLines.push_back(ActionReplay::AREntry(addr, value)); continue; } else if (pieces.size() == 1) { SplitString(line_str, '-', pieces); if (pieces.size() == 3 && pieces[0].size() == 4 && pieces[1].size() == 4 && pieces[2].size() == 5) { // Encrypted code line. We'll have to decode it later. encryptedLines.push_back(pieces[0] + pieces[1] + pieces[2]); continue; } } // If the above-mentioned conditions weren't met, then something went wrong. if (!PanicYesNoT("Unable to parse line %u of the entered AR code as a valid " "encrypted or decrypted code. Make sure you typed it correctly.\n" "Would you like to ignore this line and continue parsing?", (unsigned) (i + 1))) { return; } } // If the entered code was in encrypted form, we decode it here. if (encryptedLines.size()) { // TODO: what if both decrypted AND encrypted lines are entered into a single AR code? ActionReplay::DecryptARCode(encryptedLines, decryptedLines); } // Codes with no lines appear to be deleted/hidden from the list. Let's prevent that. if (!decryptedLines.size()) { PanicAlertT("The resulting decrypted AR code doesn't contain any lines."); return; } if (selection == wxNOT_FOUND) { // Add a new AR cheat code. ActionReplay::ARCode newCheat; newCheat.name = WxStrToStr(EditCheatName->GetValue()); newCheat.ops = decryptedLines; newCheat.active = true; arCodes.push_back(newCheat); } else { // Update the currently-selected AR cheat code. arCodes.at(selection).name = WxStrToStr(EditCheatName->GetValue()); arCodes.at(selection).ops = decryptedLines; } AcceptAndClose(); }
bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2) { std::string Region(EUR_DIR); switch (_BootBS2) { case BOOT_DEFAULT: { bool bootDrive = cdio_is_cdrom(m_strFilename); // Check if the file exist, we may have gotten it from a --elf command line // that gave an incorrect file name if (!bootDrive && !File::Exists(m_strFilename)) { PanicAlertT("The specified file \"%s\" does not exist", m_strFilename.c_str()); return false; } std::string Extension; SplitPath(m_strFilename, nullptr, nullptr, &Extension); if (!strcasecmp(Extension.c_str(), ".gcm") || !strcasecmp(Extension.c_str(), ".iso") || !strcasecmp(Extension.c_str(), ".wbfs") || !strcasecmp(Extension.c_str(), ".ciso") || !strcasecmp(Extension.c_str(), ".gcz") || bootDrive) { m_BootType = BOOT_ISO; std::unique_ptr<DiscIO::IVolume> pVolume(DiscIO::CreateVolumeFromFilename(m_strFilename)); if (pVolume == nullptr) { if (bootDrive) PanicAlertT("Could not read \"%s\". " "There is no disc in the drive, or it is not a GC/Wii backup. " "Please note that original GameCube and Wii discs cannot be read " "by most PC DVD drives.", m_strFilename.c_str()); else PanicAlertT("\"%s\" is an invalid GCM/ISO file, or is not a GC/Wii ISO.", m_strFilename.c_str()); return false; } m_strName = pVolume->GetName(); m_strUniqueID = pVolume->GetUniqueID(); m_strRevisionSpecificUniqueID = pVolume->GetRevisionSpecificUniqueID(); // Check if we have a Wii disc bWii = DiscIO::IsVolumeWiiDisc(pVolume.get()); switch (pVolume->GetCountry()) { case DiscIO::IVolume::COUNTRY_USA: bNTSC = true; Region = USA_DIR; break; case DiscIO::IVolume::COUNTRY_TAIWAN: case DiscIO::IVolume::COUNTRY_KOREA: // TODO: Should these have their own Region Dir? case DiscIO::IVolume::COUNTRY_JAPAN: bNTSC = true; Region = JAP_DIR; break; case DiscIO::IVolume::COUNTRY_EUROPE: case DiscIO::IVolume::COUNTRY_FRANCE: case DiscIO::IVolume::COUNTRY_ITALY: case DiscIO::IVolume::COUNTRY_RUSSIA: bNTSC = false; Region = EUR_DIR; break; default: if (PanicYesNoT("Your GCM/ISO file seems to be invalid (invalid country)." "\nContinue with PAL region?")) { bNTSC = false; Region = EUR_DIR; break; } else { return false; } } } else if (!strcasecmp(Extension.c_str(), ".elf")) { bWii = CBoot::IsElfWii(m_strFilename); Region = USA_DIR; m_BootType = BOOT_ELF; bNTSC = true; } else if (!strcasecmp(Extension.c_str(), ".dol")) { CDolLoader dolfile(m_strFilename); bWii = dolfile.IsWii(); Region = USA_DIR; m_BootType = BOOT_DOL; bNTSC = true; } else if (!strcasecmp(Extension.c_str(), ".dff")) { bWii = true; Region = USA_DIR; bNTSC = true; m_BootType = BOOT_DFF; std::unique_ptr<FifoDataFile> ddfFile(FifoDataFile::Load(m_strFilename, true)); if (ddfFile) { bWii = ddfFile->GetIsWii(); } } else if (DiscIO::CNANDContentManager::Access().GetNANDLoader(m_strFilename).IsValid()) { std::unique_ptr<DiscIO::IVolume> pVolume(DiscIO::CreateVolumeFromFilename(m_strFilename)); const DiscIO::INANDContentLoader& ContentLoader = DiscIO::CNANDContentManager::Access().GetNANDLoader(m_strFilename); if (ContentLoader.GetContentByIndex(ContentLoader.GetBootIndex()) == nullptr) { //WAD is valid yet cannot be booted. Install instead. u64 installed = DiscIO::CNANDContentManager::Access().Install_WiiWAD(m_strFilename); if (installed) SuccessAlertT("The WAD has been installed successfully"); return false; //do not boot } switch (ContentLoader.GetCountry()) { case DiscIO::IVolume::COUNTRY_USA: bNTSC = true; Region = USA_DIR; break; case DiscIO::IVolume::COUNTRY_TAIWAN: case DiscIO::IVolume::COUNTRY_KOREA: // TODO: Should these have their own Region Dir? case DiscIO::IVolume::COUNTRY_JAPAN: bNTSC = true; Region = JAP_DIR; break; case DiscIO::IVolume::COUNTRY_EUROPE: case DiscIO::IVolume::COUNTRY_FRANCE: case DiscIO::IVolume::COUNTRY_ITALY: case DiscIO::IVolume::COUNTRY_RUSSIA: bNTSC = false; Region = EUR_DIR; break; default: bNTSC = false; Region = EUR_DIR; break; } bWii = true; m_BootType = BOOT_WII_NAND; if (pVolume) { m_strName = pVolume->GetName(); m_strUniqueID = pVolume->GetUniqueID(); } else { // null pVolume means that we are loading from nand folder (Most Likely Wii Menu) // if this is the second boot we would be using the Name and id of the last title m_strName.clear(); m_strUniqueID.clear(); } // Use the TitleIDhex for name and/or unique ID if launching from nand folder // or if it is not ascii characters (specifically sysmenu could potentially apply to other things) std::string titleidstr = StringFromFormat("%016" PRIx64, ContentLoader.GetTitleID()); if (m_strName.empty()) { m_strName = titleidstr; } if (m_strUniqueID.empty()) { m_strUniqueID = titleidstr; } } else { PanicAlertT("Could not recognize ISO file %s", m_strFilename.c_str()); return false; } } break; case BOOT_BS2_USA: Region = USA_DIR; m_strFilename.clear(); bNTSC = true; break; case BOOT_BS2_JAP: Region = JAP_DIR; m_strFilename.clear(); bNTSC = true; break; case BOOT_BS2_EUR: Region = EUR_DIR; m_strFilename.clear(); bNTSC = false; break; } // Setup paths CheckMemcardPath(SConfig::GetInstance().m_strMemoryCardA, Region, true); CheckMemcardPath(SConfig::GetInstance().m_strMemoryCardB, Region, false); m_strSRAM = File::GetUserPath(F_GCSRAM_IDX); if (!bWii) { if (!bHLE_BS2) { m_strBootROM = File::GetUserPath(D_GCUSER_IDX) + DIR_SEP + Region + DIR_SEP GC_IPL; if (!File::Exists(m_strBootROM)) m_strBootROM = File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + Region + DIR_SEP GC_IPL; if (!File::Exists(m_strBootROM)) { WARN_LOG(BOOT, "Bootrom file %s not found - using HLE.", m_strBootROM.c_str()); bHLE_BS2 = true; } } } else if (bWii && !bHLE_BS2) { WARN_LOG(BOOT, "GC bootrom file will not be loaded for Wii mode."); bHLE_BS2 = true; } return true; }
bool SConfig::AutoSetup(EBootBS2 _BootBS2) { std::string set_region_dir(EUR_DIR); switch (_BootBS2) { case BOOT_DEFAULT: { bool bootDrive = cdio_is_cdrom(m_strFilename); // Check if the file exist, we may have gotten it from a --elf command line // that gave an incorrect file name if (!bootDrive && !File::Exists(m_strFilename)) { PanicAlertT("The specified file \"%s\" does not exist", m_strFilename.c_str()); return false; } std::string Extension; SplitPath(m_strFilename, nullptr, nullptr, &Extension); if (!strcasecmp(Extension.c_str(), ".gcm") || !strcasecmp(Extension.c_str(), ".iso") || !strcasecmp(Extension.c_str(), ".wbfs") || !strcasecmp(Extension.c_str(), ".ciso") || !strcasecmp(Extension.c_str(), ".gcz") || bootDrive) { m_BootType = BOOT_ISO; std::unique_ptr<DiscIO::IVolume> pVolume(DiscIO::CreateVolumeFromFilename(m_strFilename)); if (pVolume == nullptr) { if (bootDrive) PanicAlertT("Could not read \"%s\". " "There is no disc in the drive, or it is not a GC/Wii backup. " "Please note that original GameCube and Wii discs cannot be read " "by most PC DVD drives.", m_strFilename.c_str()); else PanicAlertT("\"%s\" is an invalid GCM/ISO file, or is not a GC/Wii ISO.", m_strFilename.c_str()); return false; } m_strName = pVolume->GetInternalName(); m_strUniqueID = pVolume->GetUniqueID(); m_revision = pVolume->GetRevision(); // Check if we have a Wii disc bWii = pVolume->GetVolumeType() == DiscIO::IVolume::WII_DISC; const char* retrieved_region_dir = GetRegionOfCountry(pVolume->GetCountry()); if (!retrieved_region_dir) { if (!PanicYesNoT("Your GCM/ISO file seems to be invalid (invalid country)." "\nContinue with PAL region?")) return false; retrieved_region_dir = EUR_DIR; } set_region_dir = retrieved_region_dir; bNTSC = set_region_dir == USA_DIR || set_region_dir == JAP_DIR; } else if (!strcasecmp(Extension.c_str(), ".elf")) { bWii = CBoot::IsElfWii(m_strFilename); // TODO: Right now GC homebrew boots in NTSC and Wii homebrew in PAL. // This is intentional so that Wii homebrew can boot in both 50Hz and 60Hz, without forcing all GC homebrew to 50Hz. // In the future, it probably makes sense to add a Region setting for homebrew somewhere in the emulator config. bNTSC = bWii ? false : true; set_region_dir = bNTSC ? USA_DIR : EUR_DIR; m_BootType = BOOT_ELF; } else if (!strcasecmp(Extension.c_str(), ".dol")) { CDolLoader dolfile(m_strFilename); bWii = dolfile.IsWii(); // TODO: See the ELF code above. bNTSC = bWii ? false : true; set_region_dir = bNTSC ? USA_DIR : EUR_DIR; m_BootType = BOOT_DOL; } else if (!strcasecmp(Extension.c_str(), ".dff")) { bWii = true; set_region_dir = USA_DIR; bNTSC = true; m_BootType = BOOT_DFF; std::unique_ptr<FifoDataFile> ddfFile(FifoDataFile::Load(m_strFilename, true)); if (ddfFile) { bWii = ddfFile->GetIsWii(); } } else if (DiscIO::CNANDContentManager::Access().GetNANDLoader(m_strFilename).IsValid()) { std::unique_ptr<DiscIO::IVolume> pVolume(DiscIO::CreateVolumeFromFilename(m_strFilename)); const DiscIO::CNANDContentLoader& ContentLoader = DiscIO::CNANDContentManager::Access().GetNANDLoader(m_strFilename); if (ContentLoader.GetContentByIndex(ContentLoader.GetBootIndex()) == nullptr) { //WAD is valid yet cannot be booted. Install instead. u64 installed = DiscIO::CNANDContentManager::Access().Install_WiiWAD(m_strFilename); if (installed) SuccessAlertT("The WAD has been installed successfully"); return false; //do not boot } const char* retrieved_region_dir = GetRegionOfCountry(ContentLoader.GetCountry()); set_region_dir = retrieved_region_dir ? retrieved_region_dir : EUR_DIR; bNTSC = set_region_dir == USA_DIR || set_region_dir == JAP_DIR; bWii = true; m_BootType = BOOT_WII_NAND; if (pVolume) { m_strName = pVolume->GetInternalName(); m_strUniqueID = pVolume->GetUniqueID(); } else { // null pVolume means that we are loading from nand folder (Most Likely Wii Menu) // if this is the second boot we would be using the Name and id of the last title m_strName.clear(); m_strUniqueID.clear(); } // Use the TitleIDhex for name and/or unique ID if launching from nand folder // or if it is not ascii characters (specifically sysmenu could potentially apply to other things) std::string titleidstr = StringFromFormat("%016" PRIx64, ContentLoader.GetTitleID()); if (m_strName.empty()) { m_strName = titleidstr; } if (m_strUniqueID.empty()) { m_strUniqueID = titleidstr; } } else { PanicAlertT("Could not recognize ISO file %s", m_strFilename.c_str()); return false; } } break; case BOOT_BS2_USA: set_region_dir = USA_DIR; m_strFilename.clear(); bNTSC = true; break; case BOOT_BS2_JAP: set_region_dir = JAP_DIR; m_strFilename.clear(); bNTSC = true; break; case BOOT_BS2_EUR: set_region_dir = EUR_DIR; m_strFilename.clear(); bNTSC = false; break; } // Setup paths CheckMemcardPath(SConfig::GetInstance().m_strMemoryCardA, set_region_dir, true); CheckMemcardPath(SConfig::GetInstance().m_strMemoryCardB, set_region_dir, false); m_strSRAM = File::GetUserPath(F_GCSRAM_IDX); if (!bWii) { if (!bHLE_BS2) { m_strBootROM = File::GetUserPath(D_GCUSER_IDX) + DIR_SEP + set_region_dir + DIR_SEP GC_IPL; if (!File::Exists(m_strBootROM)) m_strBootROM = File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + set_region_dir + DIR_SEP GC_IPL; if (!File::Exists(m_strBootROM)) { WARN_LOG(BOOT, "Bootrom file %s not found - using HLE.", m_strBootROM.c_str()); bHLE_BS2 = true; } } } else if (bWii && !bHLE_BS2) { WARN_LOG(BOOT, "GC bootrom file will not be loaded for Wii mode."); bHLE_BS2 = true; } return true; }
void CMemcardManager::CopyDeleteClick(wxCommandEvent& event) { int index_A = m_MemcardList[SLOT_A]->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); int index_B = m_MemcardList[SLOT_B]->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); int slot = SLOT_B; int slot2 = SLOT_A; std::string fileName2(""); if (index_A != wxNOT_FOUND && page[SLOT_A]) index_A += itemsPerPage * page[SLOT_A]; if (index_B != wxNOT_FOUND && page[SLOT_B]) index_B += itemsPerPage * page[SLOT_B]; int index = index_B; switch (event.GetId()) { case ID_COPYFROM_B: slot = SLOT_A; slot2 = SLOT_B; case ID_COPYFROM_A: index = slot2 ? index_B : index_A; index = memoryCard[slot2]->GetFileIndex(index); if ((index != wxNOT_FOUND)) { CopyDeleteSwitch(memoryCard[slot]->CopyFrom(*memoryCard[slot2], index), slot); } break; case ID_FIXCHECKSUM_A: slot = SLOT_A; case ID_FIXCHECKSUM_B: if (memoryCard[slot]->FixChecksums() && memoryCard[slot]->Save()) { SuccessAlertT("The checksum was successfully fixed"); } else { PanicAlertT(E_SAVEFAILED); } break; case ID_CONVERTTOGCI: fileName2 = "convert"; case ID_SAVEIMPORT_A: slot = SLOT_A; case ID_SAVEIMPORT_B: { wxString fileName = wxFileSelector( _("Select a save file to import"), (strcmp(DefaultIOPath.c_str(), "/Users/GC") == 0) ? StrToWxStr("") : StrToWxStr(DefaultIOPath), wxEmptyString, wxEmptyString, _("GameCube Savegame files(*.gci;*.gcs;*.sav)") + wxString("|*.gci;*.gcs;*.sav|") + _("Native GCI files(*.gci)") + wxString("|*.gci|") + _("MadCatz Gameshark files(*.gcs)") + wxString("|*.gcs|") + _("Datel MaxDrive/Pro files(*.sav)") + wxString("|*.sav"), wxFD_OPEN | wxFD_FILE_MUST_EXIST, this); if (!fileName.empty() && !fileName2.empty()) { wxString temp2 = wxFileSelector(_("Save GCI as..."), wxEmptyString, wxEmptyString, ".gci", _("GCI File(*.gci)") + wxString("|*.gci"), wxFD_OVERWRITE_PROMPT|wxFD_SAVE, this); if (temp2.empty()) break; fileName2 = WxStrToStr(temp2); } if (fileName.length() > 0) { CopyDeleteSwitch(memoryCard[slot]->ImportGci(WxStrToStr(fileName), fileName2), slot); } } break; case ID_SAVEEXPORT_A: slot=SLOT_A; index = index_A; case ID_SAVEEXPORT_B: index = memoryCard[slot]->GetFileIndex(index); if (index != wxNOT_FOUND) { std::string gciFilename; if (!memoryCard[slot]->GCI_FileName(index, gciFilename)) { PanicAlertT("Invalid index"); return; } wxString fileName = wxFileSelector( _("Export save as..."), StrToWxStr(DefaultIOPath), StrToWxStr(gciFilename), ".gci", _("Native GCI files(*.gci)") + wxString("|*.gci|") + _("MadCatz Gameshark files(*.gcs)") + wxString("|*.gcs|") + _("Datel MaxDrive/Pro files(*.sav)") + wxString("|*.sav"), wxFD_OVERWRITE_PROMPT|wxFD_SAVE, this); if (fileName.length() > 0) { if (!CopyDeleteSwitch(memoryCard[slot]->ExportGci(index, WxStrToStr(fileName), ""), -1)) { File::Delete(WxStrToStr(fileName)); } } } break; case ID_EXPORTALL_A: slot=SLOT_A; case ID_EXPORTALL_B: { std::string path1, path2, mpath; mpath = WxStrToStr(m_MemcardPath[slot]->GetPath()); SplitPath(mpath, &path1, &path2, nullptr); path1 += path2; File::CreateDir(path1); if (PanicYesNoT("Warning: This will overwrite any existing saves that are in the folder:\n" "%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, "", path1), -1); } break; } case ID_DELETE_A: slot = SLOT_A; index = index_A; case ID_DELETE_B: index = memoryCard[slot]->GetFileIndex(index); if (index != wxNOT_FOUND) { CopyDeleteSwitch(memoryCard[slot]->RemoveFile(index), slot); } break; } }
void CMemcardManager::CopyDeleteClick(wxCommandEvent& event) { int index_A = m_MemcardList[SLOT_A]->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); int index_B = m_MemcardList[SLOT_B]->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); int slot = SLOT_B; int slot2 = SLOT_A; int index = index_B; std::string fileName2(""); if (index_A != wxNOT_FOUND && page[SLOT_A]) index_A += itemsPerPage * page[SLOT_A]; if (index_B != wxNOT_FOUND && page[SLOT_B]) index_B += itemsPerPage * page[SLOT_B]; switch (event.GetId()) { case ID_COPYFROM_B: slot = SLOT_A; slot2 = SLOT_B; case ID_COPYFROM_A: index = slot2 ? index_B : index_A; if ((index != wxNOT_FOUND)) { CopyDeleteSwitch(memoryCard[slot]->CopyFrom(*memoryCard[slot2], index), slot); } break; case ID_FIXCHECKSUM_A: slot = SLOT_A; case ID_FIXCHECKSUM_B: if (memoryCard[slot]->FixChecksums() && memoryCard[slot]->Save()) { SuccessAlertT("The checksum was successfully fixed"); } else PanicAlert(E_SAVEFAILED); break; case ID_CONVERTTOGCI: fileName2 = "convert"; case ID_SAVEIMPORT_A: slot = SLOT_A; case ID_SAVEIMPORT_B: { wxString fileName = wxFileSelector( _("Select a save file to import"), (strcmp(DefaultIOPath.c_str(), "/Users/GC") == 0) ? wxString::FromAscii("") : wxString::From8BitData(DefaultIOPath.c_str()), wxEmptyString, wxEmptyString, _("Native GCI files(*.gci)") + wxString(wxT("|*.gci|")) + _("MadCatz Gameshark files(*.gcs)") + wxString(wxT("|*.gcs|")) + _("Datel MaxDrive/Pro files(*.sav)") + wxString(wxT("|*.sav")), wxFD_OPEN | wxFD_FILE_MUST_EXIST); if (!fileName.empty() && !fileName2.empty()) { wxString temp2 = wxFileSelector(_("Save GCI as..."), wxEmptyString, wxEmptyString, wxT(".gci"), _("GCI File(*.gci)") + wxString(_T("|*.gci")), wxFD_OVERWRITE_PROMPT|wxFD_SAVE); if (temp2.empty()) break; fileName2 = temp2.mb_str(); } if (fileName.length() > 0) { CopyDeleteSwitch(memoryCard[slot]->ImportGci(fileName.mb_str(), fileName2), slot); } } break; case ID_SAVEEXPORT_A: slot=SLOT_A; index = index_A; case ID_SAVEEXPORT_B: if (index != wxNOT_FOUND) { 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); wxString fileName = wxFileSelector( _("Export save as..."), wxString::From8BitData(DefaultIOPath.c_str()), wxString::From8BitData(tempC), wxT(".gci"), _("Native GCI files(*.gci)") + wxString(wxT("|*.gci|")) + _("MadCatz Gameshark files(*.gcs)") + wxString(wxT("|*.gcs|")) + _("Datel MaxDrive/Pro files(*.sav)") + wxString(wxT("|*.sav")), wxFD_OVERWRITE_PROMPT|wxFD_SAVE); if (fileName.length() > 0) { if (!CopyDeleteSwitch(memoryCard[slot]->ExportGci(index, fileName.mb_str(), NULL), -1)) { File::Delete(std::string(fileName.mb_str())); } } } break; case ID_EXPORTALL_A: slot=SLOT_A; case ID_EXPORTALL_B: { std::string path1, path2, mpath; mpath = m_MemcardPath[slot]->GetPath().mb_str(); SplitPath(mpath, &path1, &path2, NULL); path1 += path2; File::CreateDir(path1); if(PanicYesNoT("Warning: This will overwrite any existing saves that are in the folder:\n" "%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, ".", &path1), -1); } break; } case ID_DELETE_A: slot = SLOT_A; index = index_A; case ID_DELETE_B: if (index != wxNOT_FOUND) { CopyDeleteSwitch(memoryCard[slot]->RemoveFile(index), slot); } break; } }