34 lines
905 B
C++
34 lines
905 B
C++
#include "memcard.hpp"
|
|
#include "memcard/memorycard.hpp"
|
|
#include "memcard/make_memory_card.hpp"
|
|
#include <iostream>
|
|
#include <iomanip>
|
|
|
|
void print_blocks (const std::string& mc_path) {
|
|
using mc::psx::MemoryCard;
|
|
using mc::psx::make_memory_card;
|
|
|
|
const MemoryCard mc (make_memory_card(mc_path));
|
|
{
|
|
mc::psx::ContentInfo nfo = mc.content_info();
|
|
if (nfo.magic != nfo.MCMagic) {
|
|
std::cout << "Invalid memory card data\n";
|
|
return;
|
|
}
|
|
}
|
|
|
|
for (const auto& blk : mc) {
|
|
if (blk.has_magic()) {
|
|
std::cout << "Block " << std::setfill(' ') << std::setw(2) << blk.index()
|
|
<< ": \"" << blk.title() << '"';
|
|
if (blk.block_count() > 1) {
|
|
std::cout << " (x" << blk.block_count() << ')';
|
|
}
|
|
if (blk.has_pocket_station_content())
|
|
std::cout << " P";
|
|
std::cout << " [" << to_char(blk.country_code()) << ']';
|
|
std::cout << ' ' << blk.product_code();
|
|
std::cout << '\n';
|
|
}
|
|
}
|
|
}
|