| 344 | } |
| 345 | |
| 346 | void FileMemoryCard::Close() |
| 347 | { |
| 348 | for (int slot = 0; slot < 8; ++slot) |
| 349 | { |
| 350 | if (!m_file[slot]) |
| 351 | continue; |
| 352 | |
| 353 | // Store checksum |
| 354 | if (!m_ispsx[slot] && FileSystem::FSeek64(m_file[slot], m_chkaddr, SEEK_SET) == 0) |
| 355 | std::fwrite(&m_chksum[slot], sizeof(m_chksum[slot]), 1, m_file[slot]); |
| 356 | |
| 357 | std::fclose(m_file[slot]); |
| 358 | m_file[slot] = nullptr; |
| 359 | |
| 360 | if (m_filenames[slot].ends_with(".bin") || m_filenames[slot].ends_with(".mc2")) |
| 361 | { |
| 362 | const std::string name_in(m_filenames[slot] + 'x'); |
| 363 | if (ConvertRAWtoNoECC(name_in.c_str(), m_filenames[slot].c_str())) |
| 364 | FileSystem::DeleteFilePath(name_in.c_str()); |
| 365 | } |
| 366 | |
| 367 | m_filenames[slot] = {}; |
| 368 | m_fileSize[slot] = -1; |
| 369 | } |
| 370 | } |
| 371 | |
| 372 | // Returns FALSE if the seek failed (is outside the bounds of the file). |
| 373 | bool FileMemoryCard::Seek(std::FILE* f, u32 adr) |
no test coverage detected