1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
struct Saturn : CompactDisc {
auto name() -> string override { return "Saturn"; }
auto extensions() -> vector<string> override { return {"sat", "cue"}; }
auto load(string location) -> bool override;
auto save(string location) -> bool override;
auto analyze(string location) -> string;
};
auto Saturn::load(string location) -> bool {
if(!inode::exists(location)) return false;
this->location = location;
this->manifest = analyze(location);
auto document = BML::unserialize(manifest);
if(!document) return false;
pak = new vfs::directory;
pak->setAttribute("title", document["game/title"].string());
pak->setAttribute("region", document["game/region"].string());
pak->append("manifest.bml", manifest);
if(directory::exists(location)) {
pak->append("cd.rom", vfs::disk::open({location, "cd.rom"}, vfs::read));
}
if(file::exists(location)) {
pak->append("cd.rom", vfs::cdrom::open(location));
}
return true;
}
auto Saturn::save(string location) -> bool {
auto document = BML::unserialize(manifest);
return true;
}
auto Saturn::analyze(string location) -> string {
string s;
s += "game\n";
s +={" name: ", Medium::name(location), "\n"};
s +={" title: ", Medium::name(location), "\n"};
s +={" region: ", "NTSC-J", "\n"};
return s;
}
|