mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-24 15:12:23 +01:00
byuu says (in the WIP forum): Changelog: - satellaviewcartridge/SatellaviewCartridge is now bsmemory/BSMemory - Emulation/BS-X Satellaview/ is now Emulation/BS Memory/ - masking is in for MCC's mcu (awful hack in the code, but that's temporary) - BS Memory types are now "flash" or "mrom" - fixed loading Same Game - Tengai Hen - icarus fixed up a lot; can load database entries for any supported media type now (only the SFC DB exists currently) mMenu::remove() fix will be in the next WIP. byuu says (in the public beta thread): Changelog: - GBA emulation accuracy improved quite a bit - video shaders are supported once again - icarus shares settings.bml with higan; changing library path in one now affects the other - icarus manifest generation now uses my SNES game dumping database for perfect mapping of US games - major overhaul to manifest file format. As long as you have v095-style folders without manifest.bml, you will be fine - if not, go to higan->settings->configuration->advanced and check "Ignore Manifests" before loading your first game - new "Manifest Viewer" tool (not really meant for regular users; more of a developer tool) - experimental (but disabled in the binary) WASAPI driver. Help stabilizing it would be *greatly* appreciated! - lots of other stuff
81 lines
3.2 KiB
C++
81 lines
3.2 KiB
C++
Icarus::Icarus() {
|
|
database.famicom = BML::unserialize(string::read(locate({configpath(), "icarus/"}, "Database/Famicom.bml")));
|
|
database.superFamicom = BML::unserialize(string::read(locate({configpath(), "icarus/"}, "Database/Super Famicom.bml")));
|
|
database.gameBoy = BML::unserialize(string::read(locate({configpath(), "icarus/"}, "Database/Game Boy.bml")));
|
|
database.gameBoyColor = BML::unserialize(string::read(locate({configpath(), "icarus/"}, "Database/Game Boy Color.bml")));
|
|
database.gameBoyAdvance = BML::unserialize(string::read(locate({configpath(), "icarus/"}, "Database/Game Boy Advance.bml")));
|
|
database.bsMemory = BML::unserialize(string::read(locate({configpath(), "icarus/"}, "Database/BS Memory.bml")));
|
|
database.sufamiTurbo = BML::unserialize(string::read(locate({configpath(), "icarus/"}, "Database/Sufami Turbo.bml")));
|
|
}
|
|
|
|
auto Icarus::error() const -> string {
|
|
return errorMessage;
|
|
}
|
|
|
|
auto Icarus::success() -> bool {
|
|
errorMessage = "";
|
|
return true;
|
|
}
|
|
|
|
auto Icarus::failure(string message) -> bool {
|
|
errorMessage = message;
|
|
return false;
|
|
}
|
|
|
|
auto Icarus::manifest(string location) -> string {
|
|
location.transform("\\", "/").rtrim("/").append("/");
|
|
if(!directory::exists(location)) return "";
|
|
|
|
auto type = suffixname(location).downcase();
|
|
if(type == ".fc") return famicomManifest(location);
|
|
if(type == ".sfc") return superFamicomManifest(location);
|
|
if(type == ".gb") return gameBoyManifest(location);
|
|
if(type == ".gbc") return gameBoyColorManifest(location);
|
|
if(type == ".gba") return gameBoyAdvanceManifest(location);
|
|
if(type == ".bs") return bsMemoryManifest(location);
|
|
if(type == ".st") return sufamiTurboManifest(location);
|
|
|
|
return "";
|
|
}
|
|
|
|
auto Icarus::import(string location) -> bool {
|
|
location.transform("\\", "/").rtrim("/");
|
|
if(!file::exists(location)) return failure("file does not exist");
|
|
if(!file::readable(location)) return failure("file is unreadable");
|
|
|
|
auto name = prefixname(location);
|
|
auto type = suffixname(location).downcase();
|
|
if(!name || !type) return failure("invalid file name");
|
|
|
|
auto buffer = file::read(location);
|
|
if(!buffer) return failure("file is empty");
|
|
|
|
if(type == ".zip") {
|
|
Decode::ZIP zip;
|
|
if(!zip.open(location)) return failure("ZIP archive is invalid");
|
|
if(!zip.file) return failure("ZIP archive is empty");
|
|
|
|
name = prefixname(zip.file[0].name);
|
|
type = suffixname(zip.file[0].name).downcase();
|
|
buffer = zip.extract(zip.file[0]);
|
|
}
|
|
|
|
if(type == ".fc" || type == ".nes") return famicomImport(buffer, location);
|
|
if(type == ".sfc" || type == ".smc") return superFamicomImport(buffer, location);
|
|
if(type == ".gb") return gameBoyImport(buffer, location);
|
|
if(type == ".gbc") return gameBoyColorImport(buffer, location);
|
|
if(type == ".gba") return gameBoyAdvanceImport(buffer, location);
|
|
if(type == ".bs") return bsMemoryImport(buffer, location);
|
|
if(type == ".st") return sufamiTurboImport(buffer, location);
|
|
|
|
return failure("unrecognized file extension");
|
|
}
|
|
|
|
auto Icarus::concatenate(vector<uint8>& output, string location) -> void {
|
|
if(auto input = file::read(location)) {
|
|
auto size = output.size();
|
|
output.resize(size + input.size());
|
|
memory::copy(output.data() + size, input.data(), input.size());
|
|
}
|
|
}
|