diff --git a/bsnes/sfc/interface/configuration.cpp b/bsnes/sfc/interface/configuration.cpp index 709c64ef..7d6e2534 100644 --- a/bsnes/sfc/interface/configuration.cpp +++ b/bsnes/sfc/interface/configuration.cpp @@ -16,6 +16,7 @@ auto Configuration::process(Markup::Node document, bool load) -> void { bind(boolean, "Video/BlurEmulation", video.blurEmulation); bind(boolean, "Video/ColorEmulation", video.colorEmulation); + bind(text, "Hacks/Entropy", hacks.entropy); bind(natural, "Hacks/CPU/Overclock", hacks.cpu.overclock); bind(boolean, "Hacks/PPU/Fast", hacks.ppu.fast); bind(boolean, "Hacks/PPU/Deinterlace", hacks.ppu.deinterlace); diff --git a/bsnes/sfc/interface/configuration.hpp b/bsnes/sfc/interface/configuration.hpp index b8f1fda4..24f7743f 100644 --- a/bsnes/sfc/interface/configuration.hpp +++ b/bsnes/sfc/interface/configuration.hpp @@ -25,6 +25,7 @@ struct Configuration { } video; struct Hacks { + string entropy = "Low"; struct CPU { uint overclock = 100; } cpu; diff --git a/bsnes/sfc/system/system.cpp b/bsnes/sfc/system/system.cpp index 92f8a4a2..4e682d7a 100644 --- a/bsnes/sfc/system/system.cpp +++ b/bsnes/sfc/system/system.cpp @@ -109,7 +109,10 @@ auto System::power(bool reset) -> void { Emulator::audio.reset(interface); - random.entropy(Random::Entropy::Low); + random.entropy(Random::Entropy::Low); //fallback case + if(configuration.hacks.entropy == "None") random.entropy(Random::Entropy::None); + if(configuration.hacks.entropy == "Low" ) random.entropy(Random::Entropy::Low ); + if(configuration.hacks.entropy == "High") random.entropy(Random::Entropy::High); cpu.power(reset); smp.power(reset); diff --git a/bsnes/target-bsnes/program/game.cpp b/bsnes/target-bsnes/program/game.cpp index 33ac1a89..d7d7f910 100644 --- a/bsnes/target-bsnes/program/game.cpp +++ b/bsnes/target-bsnes/program/game.cpp @@ -1,6 +1,7 @@ auto Program::load() -> void { unload(); + emulator->configure("Hacks/Entropy", settings.emulator.hack.entropy); emulator->configure("Hacks/CPU/Overclock", settings.emulator.hack.cpu.overclock); emulator->configure("Hacks/PPU/Fast", settings.emulator.hack.ppu.fast); emulator->configure("Hacks/PPU/Deinterlace", settings.emulator.hack.ppu.deinterlace); diff --git a/bsnes/target-bsnes/settings/emulator.cpp b/bsnes/target-bsnes/settings/emulator.cpp index e020694c..734305e3 100644 --- a/bsnes/target-bsnes/settings/emulator.cpp +++ b/bsnes/target-bsnes/settings/emulator.cpp @@ -22,6 +22,29 @@ auto EmulatorSettings::create() -> void { }); optionsSpacer.setColor({192, 192, 192}); + entropyLabel.setText("Entropy (randomness)").setFont(Font().setBold()); + entropyNone.setText("None").setToolTip( + "All memory and registers are initialized to constant values at startup.\n" + "Use this for movie recording and compatibility with very old demoscene homebrew games." + ).onActivate([&] { + settings.emulator.hack.entropy = "None"; + }); + entropyLow.setText("Low").setToolTip( + "All memory is randomized with repeating patterns, all registers are randomized at startup.\n" + "Use this for the most accurate representation of a real SNES." + ).onActivate([&] { + settings.emulator.hack.entropy = "Low"; + }); + entropyHigh.setText("High").setToolTip( + "All memory and registers are randomized as much as possible.\n" + "Use this when developing new SNES software to ensure maximum compatibility with real hardware." + ).onActivate([&] { + settings.emulator.hack.entropy = "High"; + }); + if(settings.emulator.hack.entropy == "None") entropyNone.setChecked(); + if(settings.emulator.hack.entropy == "Low") entropyLow.setChecked(); + if(settings.emulator.hack.entropy == "High") entropyHigh.setChecked(); + ppuLabel.setText("PPU (video)").setFont(Font().setBold()); fastPPU.setText("Fast mode").setChecked(settings.emulator.hack.ppu.fast).onToggle([&] { settings.emulator.hack.ppu.fast = fastPPU.checked(); diff --git a/bsnes/target-bsnes/settings/settings.cpp b/bsnes/target-bsnes/settings/settings.cpp index 6eb1d992..4d417d07 100644 --- a/bsnes/target-bsnes/settings/settings.cpp +++ b/bsnes/target-bsnes/settings/settings.cpp @@ -112,6 +112,7 @@ auto Settings::process(bool load) -> void { bind(natural, "Emulator/AutoSaveMemory/Interval", emulator.autoSaveMemory.interval); bind(boolean, "Emulator/AutoSaveStateOnUnload", emulator.autoSaveStateOnUnload); bind(boolean, "Emulator/AutoLoadStateOnLoad", emulator.autoLoadStateOnLoad); + bind(text, "Emulator/Hack/Entropy", emulator.hack.entropy); bind(natural, "Emulator/Hack/CPU/Overclock", emulator.hack.cpu.overclock); bind(boolean, "Emulator/Hack/PPU/Fast", emulator.hack.ppu.fast); bind(boolean, "Emulator/Hack/PPU/Deinterlace", emulator.hack.ppu.deinterlace); diff --git a/bsnes/target-bsnes/settings/settings.hpp b/bsnes/target-bsnes/settings/settings.hpp index 5d7339c0..596bbd28 100644 --- a/bsnes/target-bsnes/settings/settings.hpp +++ b/bsnes/target-bsnes/settings/settings.hpp @@ -95,6 +95,7 @@ struct Settings : Markup::Node { bool autoSaveStateOnUnload = false; bool autoLoadStateOnLoad = false; struct Hack { + string entropy = "Low"; struct CPU { uint overclock = 100; } cpu; @@ -331,6 +332,12 @@ public: CheckLabel autoSaveStateOnUnload{&autoStateLayout, Size{0, 0}}; CheckLabel autoLoadStateOnLoad{&autoStateLayout, Size{0, 0}}; Canvas optionsSpacer{this, Size{~0, 1}}; + Label entropyLabel{this, Size{~0, 0}, 2}; + HorizontalLayout entropyLayout{this, Size{~0, 0}}; + RadioLabel entropyNone{&entropyLayout, Size{0, 0}}; + RadioLabel entropyLow{&entropyLayout, Size{0, 0}}; + RadioLabel entropyHigh{&entropyLayout, Size{0, 0}}; + Group entropyGroup{&entropyNone, &entropyLow, &entropyHigh}; Label ppuLabel{this, Size{~0, 0}, 2}; HorizontalLayout ppuLayout{this, Size{~0, 0}}; CheckLabel fastPPU{&ppuLayout, Size{0, 0}};