mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-23 22:52:34 +01:00
byuu says: Sorry, two WIPs in one day. Got excited and couldn't wait. Changelog: - ADDQ, SUBQ shouldn't update flags when targeting an address register - ADDA should sign extend effective address reads - JSR was pushing the PC too early - some improvements to 8-bit register reads on the VDP (still needs work) - added H/V counter reads to the VDP IO port region - icarus: added support for importing Master System and Game Gear ROMs - tomoko: added library sub-menus for each manufacturer - still need to sort Game Gear after Mega Drive somehow ... The sub-menu system actually isn't all that bad. It is indeed a bit more annoying, but not as annoying as I thought it was going to be. However, it looks a hell of a lot nicer now.
46 lines
1.6 KiB
C++
46 lines
1.6 KiB
C++
auto Icarus::masterSystemManifest(string location) -> string {
|
|
vector<uint8_t> buffer;
|
|
concatenate(buffer, {location, "program.rom"});
|
|
return masterSystemManifest(buffer, location);
|
|
}
|
|
|
|
auto Icarus::masterSystemManifest(vector<uint8_t>& buffer, string location) -> string {
|
|
string manifest;
|
|
|
|
if(settings["icarus/UseDatabase"].boolean() && !manifest) {
|
|
string digest = Hash::SHA256(buffer.data(), buffer.size()).digest();
|
|
for(auto node : database.masterSystem) {
|
|
if(node["sha256"].text() == digest) {
|
|
manifest.append(node.text(), "\n sha256: ", digest, "\n");
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
if(settings["icarus/UseHeuristics"].boolean() && !manifest) {
|
|
MasterSystemCartridge cartridge{location, buffer.data(), buffer.size()};
|
|
manifest = cartridge.manifest;
|
|
}
|
|
|
|
return manifest;
|
|
}
|
|
|
|
auto Icarus::masterSystemImport(vector<uint8_t>& buffer, string location) -> string {
|
|
auto name = Location::prefix(location);
|
|
auto source = Location::path(location);
|
|
string target{settings["Library/Location"].text(), "Master System/", name, ".ms/"};
|
|
//if(directory::exists(target)) return failure("game already exists");
|
|
|
|
auto manifest = masterSystemManifest(buffer, location);
|
|
if(!manifest) return failure("failed to parse ROM image");
|
|
|
|
if(!directory::create(target)) return failure("library path unwritable");
|
|
if(file::exists({source, name, ".sav"}) && !file::exists({target, "save.ram"})) {
|
|
file::copy({source, name, ".sav"}, {target, "save.ram"});
|
|
}
|
|
|
|
if(settings["icarus/CreateManifests"].boolean()) file::write({target, "manifest.bml"}, manifest);
|
|
file::write({target, "program.rom"}, buffer);
|
|
return success(target);
|
|
}
|