Added entropy setting (none, low, high) to settings->emulator

This commit is contained in:
byuu 2019-08-31 07:08:10 +09:00
parent 639b9db961
commit bb7b2f2e60
7 changed files with 38 additions and 1 deletions

View File

@ -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);

View File

@ -25,6 +25,7 @@ struct Configuration {
} video;
struct Hacks {
string entropy = "Low";
struct CPU {
uint overclock = 100;
} cpu;

View File

@ -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);

View File

@ -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);

View File

@ -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();

View File

@ -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);

View File

@ -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}};