From e17f941cba543381924d18ff01635a6f669eaa60 Mon Sep 17 00:00:00 2001 From: bslenul <33353403+bslenul@users.noreply.github.com> Date: Tue, 27 Sep 2022 01:22:57 +0200 Subject: [PATCH] Add basic support for .bml --- bsnes/target-libretro/program.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/bsnes/target-libretro/program.cpp b/bsnes/target-libretro/program.cpp index c18af22f..0242fb8b 100644 --- a/bsnes/target-libretro/program.cpp +++ b/bsnes/target-libretro/program.cpp @@ -602,7 +602,10 @@ auto Program::loadFile(string location) -> vector auto Program::loadSuperFamicom(string location) -> bool { + string manifest; vector rom; + + manifest = file::read({Location::notsuffix(location), ".bml"}); rom = loadFile(location); if(rom.size() < 0x8000) return false; @@ -620,7 +623,7 @@ auto Program::loadSuperFamicom(string location) -> bool superFamicom.title = heuristics.title(); superFamicom.region = heuristics.videoRegion(); - superFamicom.manifest = heuristics.manifest(); + superFamicom.manifest = manifest ? manifest : heuristics.manifest(); hackPatchMemory(rom); superFamicom.document = BML::unserialize(superFamicom.manifest); @@ -651,7 +654,10 @@ auto Program::loadSuperFamicom(string location) -> bool } auto Program::loadGameBoy(string location) -> bool { + string manifest; vector rom; + + manifest = file::read({Location::notsuffix(location), ".bml"}); rom = loadFile(location); if (rom.size() < 0x4000) return false; @@ -659,7 +665,7 @@ auto Program::loadGameBoy(string location) -> bool { auto heuristics = Heuristics::GameBoy(rom, location); auto sha256 = Hash::SHA256(rom).digest(); - gameBoy.manifest = heuristics.manifest(); + gameBoy.manifest = manifest ? manifest : heuristics.manifest(); gameBoy.document = BML::unserialize(gameBoy.manifest); gameBoy.location = location; gameBoy.program = rom; @@ -668,7 +674,10 @@ auto Program::loadGameBoy(string location) -> bool { } auto Program::loadBSMemory(string location) -> bool { + string manifest; vector rom; + + manifest = file::read({Location::notsuffix(location), ".bml"}); rom = loadFile(location); if (rom.size() < 0x8000) return false; @@ -676,7 +685,7 @@ auto Program::loadBSMemory(string location) -> bool { auto heuristics = Heuristics::BSMemory(rom, location); auto sha256 = Hash::SHA256(rom).digest(); - bsMemory.manifest = heuristics.manifest(); + bsMemory.manifest = manifest ? manifest : heuristics.manifest(); bsMemory.document = BML::unserialize(bsMemory.manifest); bsMemory.location = location;