Skip to content

Commit

Permalink
desktop-ui: surround sg1000a with CORE_SG ifdef
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeUsher committed Oct 25, 2023
1 parent f1fb33a commit 414c205
Showing 1 changed file with 19 additions and 31 deletions.
50 changes: 19 additions & 31 deletions mia/medium/arcade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,36 @@ struct Arcade : Mame {
auto extensions() -> vector<string> override { return {}; }
auto load(string location) -> bool override;
auto save(string location) -> bool override;
auto analyze(vector<u8>& rom) -> string;

Markup::Node info;
};

auto Arcade::load(string location) -> bool {
info = BML::unserialize(manifestDatabaseArcade(Medium::name(location)));
if(!info) return false;

vector<u8> rom = loadRoms(location, info, "maincpu");
if(!rom) return false;
manifest = manifestDatabaseArcade(Medium::name(location));
if(!manifest) return false;

this->location = location;
this->manifest = analyze(rom);
auto document = BML::unserialize(manifest);
if(!document) return false;

pak = new vfs::directory;
pak->setAttribute("board", document["game/board" ].string());
pak->setAttribute("title", document["game/title"].string());
pak->setAttribute("region", document["game/region"].string());
pak->append("manifest.bml", manifest);
pak->append("program.rom", rom);
//Sega SG-1000 based arcade
if(document["game/board"].string() == "sg1000a") {
vector<u8> rom = loadRoms(location, document, "maincpu");
if(!rom) return false;

return true;
this->location = location;

pak = new vfs::directory;
pak->setAttribute("board", document["game/board" ].string());
pak->setAttribute("title", document["game/title"].string());
pak->setAttribute("region", document["game/region"].string());
pak->append("manifest.bml", manifest);
pak->append("program.rom", rom);

return true;
}

return false;
}

auto Arcade::save(string location) -> bool {
return true;
}

auto Arcade::analyze(vector<u8>& rom) -> string {
string hash = Hash::SHA256(rom).digest();

string s;
s += "game\n";
s +={" name: ", Medium::name(location), "\n"};
s +={" title: ", (info ? info["game/title"].string() : Medium::name(location)), "\n"};
s +={" board: ", (info ? info["game/board"].string() : "Arcade"), "\n"};
s += " memory\n";
s += " type: ROM\n";
s +={" size: 0x", hex(rom.size()), "\n"};
s += " content: Program\n";
return s;
}

0 comments on commit 414c205

Please sign in to comment.