diff --git a/bsnes/emulator/game.hpp b/bsnes/emulator/game.hpp index 3617ed65..cad2141d 100644 --- a/bsnes/emulator/game.hpp +++ b/bsnes/emulator/game.hpp @@ -37,6 +37,7 @@ struct Game { string sha256; string label; string name; + string title; string region; string revision; string board; @@ -50,6 +51,7 @@ auto Game::load(string_view text) -> void { sha256 = document["game/sha256"].text(); label = document["game/label"].text(); name = document["game/name"].text(); + title = document["game/title"].text(); region = document["game/region"].text(); revision = document["game/revision"].text(); board = document["game/board"].text(); diff --git a/bsnes/sfc/cartridge/cartridge.cpp b/bsnes/sfc/cartridge/cartridge.cpp index ad42d242..b39ceb66 100644 --- a/bsnes/sfc/cartridge/cartridge.cpp +++ b/bsnes/sfc/cartridge/cartridge.cpp @@ -65,6 +65,7 @@ auto Cartridge::load() -> bool { if(auto fp = platform->open(ID::SuperFamicom, "manifest.bml", File::Read, File::Required)) { game.load(fp->reads()); } else return false; + loadCartridge(game.document); //Game Boy diff --git a/bsnes/sfc/cartridge/cartridge.hpp b/bsnes/sfc/cartridge/cartridge.hpp index 32c7f2d0..b975c19b 100644 --- a/bsnes/sfc/cartridge/cartridge.hpp +++ b/bsnes/sfc/cartridge/cartridge.hpp @@ -1,6 +1,7 @@ struct Cartridge { auto pathID() const -> uint { return information.pathID; } auto region() const -> string { return information.region; } + auto headerTitle() const -> string { return game.title; } auto hashes() const -> vector; auto manifests() const -> vector; diff --git a/bsnes/sfc/cpu/cpu.cpp b/bsnes/sfc/cpu/cpu.cpp index 2eb37f59..af9871e6 100644 --- a/bsnes/sfc/cpu/cpu.cpp +++ b/bsnes/sfc/cpu/cpu.cpp @@ -96,6 +96,13 @@ auto CPU::power(bool reset) -> void { if(!reset) random.array(wram, sizeof(wram)); + //Dirt Racer (Europe) relies on uninitialized memory containing certain values to boot without freezing. + //the game itself is broken and will fail to run sometimes on real hardware, but for the sake of expedience, + //WRAM is initialized to a constant value that will allow this game to always boot in successfully. + if(cartridge.headerTitle() == "DIRT RACER") { + for(auto& byte : wram) byte = 0xff; + } + for(uint n : range(8)) { channels[n] = {}; if(n != 7) channels[n].next = channels[n + 1];