mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-01-18 05:08:55 +01:00
c49d3b2006
byuu says: Changelog: - Super Game Boy: for the 50th time, higan won't segfault if you cancel the Game Boy cartridge load request - icarus: moved to new manifest syntax for all remaining systems - Game Boy: moved to new manifest syntax Errata: - Game Boy: save RAM does not appear to be working for some reason - Famicom: higan won't even start to run this system; it just acts like a cartridge was never loaded ... - cores outside of the Super Famicom and Game Boy/Color will not run due to icarus/higan manifest syntax differences
40 lines
1.4 KiB
C++
40 lines
1.4 KiB
C++
auto Icarus::gameGearManifest(string location) -> string {
|
|
vector<uint8_t> buffer;
|
|
concatenate(buffer, {location, "program.rom"});
|
|
return gameGearManifest(buffer, location);
|
|
}
|
|
|
|
auto Icarus::gameGearManifest(vector<uint8_t>& buffer, string location) -> string {
|
|
if(settings["icarus/UseDatabase"].boolean()) {
|
|
auto digest = Hash::SHA256(buffer).digest();
|
|
for(auto game : Database::GameGear.find("game")) {
|
|
if(game["sha256"].text() == digest) return BML::serialize(game);
|
|
}
|
|
}
|
|
|
|
if(settings["icarus/UseHeuristics"].boolean()) {
|
|
Heuristics::GameGear game{buffer, location};
|
|
if(auto manifest = game.manifest()) return manifest;
|
|
}
|
|
|
|
return {};
|
|
}
|
|
|
|
auto Icarus::gameGearImport(vector<uint8_t>& buffer, string location) -> string {
|
|
auto name = Location::prefix(location);
|
|
auto source = Location::path(location);
|
|
string target{settings["Library/Location"].text(), "Game Gear/", name, ".gg/"};
|
|
|
|
auto manifest = gameGearManifest(buffer, location);
|
|
if(!manifest) return failure("failed to parse ROM image");
|
|
|
|
if(!create(target)) return failure("library path unwritable");
|
|
if(exists({source, name, ".sav"}) && !exists({target, "save.ram"})) {
|
|
copy({source, name, ".sav"}, {target, "save.ram"});
|
|
}
|
|
|
|
if(settings["icarus/CreateManifests"].boolean()) write({target, "manifest.bml"}, manifest);
|
|
write({target, "program.rom"}, buffer);
|
|
return success(target);
|
|
}
|