| 4297 | } |
| 4298 | |
| 4299 | void FullscreenUI::DoCreateMemoryCard(std::string name, MemoryCardType type, MemoryCardFileType file_type, bool use_ntfs_compression) |
| 4300 | { |
| 4301 | // Build the filename with the extension |
| 4302 | const std::string name_str = fmt::format("{}.{}", name, |
| 4303 | (file_type == MemoryCardFileType::PS1) ? "mcr" : "ps2"); |
| 4304 | |
| 4305 | // check the filename |
| 4306 | if (!Path::IsValidFileName(name_str, false)) |
| 4307 | { |
| 4308 | ShowToast(std::string(), fmt::format(FSUI_FSTR("Failed to create the Memory Card, because the name '{}' contains one or more invalid characters."), name)); |
| 4309 | return; |
| 4310 | } |
| 4311 | |
| 4312 | // Check if a memory card with this name already exists |
| 4313 | if (FileMcd_GetCardInfo(name_str).has_value()) |
| 4314 | { |
| 4315 | ShowToast(std::string(), fmt::format(FSUI_FSTR("Failed to create the Memory Card, because another card with the name '{}' already exists."), name)); |
| 4316 | return; |
| 4317 | } |
| 4318 | |
| 4319 | // Create the memory card |
| 4320 | if (!FileMcd_CreateNewCard(name_str, type, file_type)) |
| 4321 | { |
| 4322 | ShowToast(std::string(), FSUI_STR("Failed to create the Memory Card, the log may contain more information.")); |
| 4323 | return; |
| 4324 | } |
| 4325 | |
| 4326 | #ifdef _WIN32 |
| 4327 | if (type == MemoryCardType::File && use_ntfs_compression) |
| 4328 | { |
| 4329 | const std::string full_path = Path::Combine(EmuFolders::MemoryCards, name_str); |
| 4330 | FileSystem::SetPathCompression(full_path.c_str(), true); |
| 4331 | } |
| 4332 | #endif |
| 4333 | |
| 4334 | ShowToast(std::string(), fmt::format(FSUI_FSTR("Memory Card '{}' created."), name)); |
| 4335 | } |
| 4336 | |
| 4337 | void FullscreenUI::DrawAchievementsLoginWindow() |
| 4338 | { |
nothing calls this directly
no test coverage detected