From 414c205256aa682b23907bc082781b1782d80461 Mon Sep 17 00:00:00 2001 From: Luke Usher Date: Wed, 25 Oct 2023 09:40:16 +0100 Subject: [PATCH] desktop-ui: surround sg1000a with CORE_SG ifdef --- mia/medium/arcade.cpp | 50 ++++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 31 deletions(-) diff --git a/mia/medium/arcade.cpp b/mia/medium/arcade.cpp index 0ef9c2815f..e75336b644 100644 --- a/mia/medium/arcade.cpp +++ b/mia/medium/arcade.cpp @@ -3,48 +3,36 @@ struct Arcade : Mame { auto extensions() -> vector override { return {}; } auto load(string location) -> bool override; auto save(string location) -> bool override; - auto analyze(vector& rom) -> string; - - Markup::Node info; }; auto Arcade::load(string location) -> bool { - info = BML::unserialize(manifestDatabaseArcade(Medium::name(location))); - if(!info) return false; - - vector 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 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& 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; -}