mirror of https://github.com/stella-emu/stella.git
added TIA randomization (see #126), TODO: doc
This commit is contained in:
parent
8563d8d793
commit
8da2766264
|
@ -208,6 +208,7 @@ Settings::Settings()
|
|||
setPermanent("plr.bankrandom", "false");
|
||||
setPermanent("plr.ramrandom", "true");
|
||||
setPermanent("plr.cpurandom", "AXYP");
|
||||
setPermanent("plr.tiarandom", "true");
|
||||
setPermanent("plr.colorloss", "false");
|
||||
setPermanent("plr.tv.jitter", "true");
|
||||
setPermanent("plr.tv.jitter_recovery", "10");
|
||||
|
@ -227,6 +228,7 @@ Settings::Settings()
|
|||
setPermanent("dev.bankrandom", "true");
|
||||
setPermanent("dev.ramrandom", "true");
|
||||
setPermanent("dev.cpurandom", "SAXYP");
|
||||
setPermanent("dev.tiarandom", "true");
|
||||
setPermanent("dev.colorloss", "true");
|
||||
setPermanent("dev.tv.jitter", "true");
|
||||
setPermanent("dev.tv.jitter_recovery", "2");
|
||||
|
@ -677,8 +679,8 @@ void Settings::usage() const
|
|||
<< " handling and RAM initialization\n"
|
||||
<< " -plr.bankrandom <1|0> Randomize the startup bank on reset\n"
|
||||
<< " -plr.ramrandom <1|0> Randomize the contents of RAM on reset\n"
|
||||
<< " -plr.cpurandom <1|0> Randomize the contents of CPU registers on\n"
|
||||
<< " reset\n"
|
||||
<< " -plr.tiarandom <1|0> Randomize the TIA registers on reset\n"
|
||||
<< " -plr.ramrandom <1|0> Randomize the contents of RAM on reset\n"
|
||||
<< " -plr.debugcolors <1|0> Enable debug colors\n"
|
||||
<< " -plr.colorloss <1|0> Enable PAL color-loss effect\n"
|
||||
<< " -plr.tv.jitter <1|0> Enable TV jitter effect\n"
|
||||
|
@ -695,6 +697,7 @@ void Settings::usage() const
|
|||
<< " -dev.ramrandom <1|0> Randomize the contents of RAM on reset\n"
|
||||
<< " -dev.cpurandom <1|0> Randomize the contents of CPU registers on\n"
|
||||
<< " reset\n"
|
||||
<< " -dev.tiarandom <1|0> Randomize the TIA registers on reset\n"
|
||||
<< " -dev.debugcolors <1|0> Enable debug colors\n"
|
||||
<< " -dev.colorloss <1|0> Enable PAL color-loss effect\n"
|
||||
<< " -dev.tv.jitter <1|0> Enable TV jitter effect\n"
|
||||
|
|
|
@ -198,6 +198,15 @@ void TIA::reset()
|
|||
// Simply call initialize(); mostly to get around calling a virtual method
|
||||
// from the constructor
|
||||
initialize();
|
||||
|
||||
if(myRandomize)
|
||||
for(uInt32 i = 0; i < 0x10000; ++i)
|
||||
{
|
||||
uInt16 address = mySystem->randGenerator().next() & 0x3F;
|
||||
uInt8 value = mySystem->randGenerator().next();
|
||||
poke(address, value);
|
||||
cycle(2); // process delay queue
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -956,6 +965,7 @@ void TIA::applyDeveloperSettings()
|
|||
setBlSwapDelay(false);
|
||||
}
|
||||
|
||||
myRandomize = mySettings.getBool(devSettings ? "dev.tiarandom" : "plr.tiarandom");
|
||||
myTIAPinsDriven = devSettings ? mySettings.getBool("dev.tiadriven") : false;
|
||||
|
||||
myEnableJitter = mySettings.getBool(devSettings ? "dev.tv.jitter" : "plr.tv.jitter");
|
||||
|
|
|
@ -819,6 +819,11 @@ class TIA : public Device
|
|||
// Frames since the last time a frame was rendered to the render buffer
|
||||
uInt32 myFramesSinceLastRender{0};
|
||||
|
||||
/**
|
||||
* Setting this to true randomizes TIA on reset.
|
||||
*/
|
||||
bool myRandomize{false};
|
||||
|
||||
/**
|
||||
* Setting this to true injects random values into undefined reads.
|
||||
*/
|
||||
|
|
|
@ -145,11 +145,15 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font)
|
|||
myRandomBankWidget->setToolTip("Randomize the startup bank for\n"
|
||||
"most classic bankswitching types.");
|
||||
wid.push_back(myRandomBankWidget);
|
||||
|
||||
myRandomizeTIAWidget = new CheckboxWidget(myTab, font, myRandomBankWidget->getRight() + fontWidth * 2, ypos + 1,
|
||||
"Randomize TIA");
|
||||
wid.push_back(myRandomizeTIAWidget);
|
||||
ypos += lineHeight + VGAP;
|
||||
|
||||
// Randomize RAM
|
||||
myRandomizeRAMWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT * 2, ypos + 1,
|
||||
"Randomize zero-page and extended RAM", kRandRAMID);
|
||||
"Randomize zero-page and extended RAM");
|
||||
wid.push_back(myRandomizeRAMWidget);
|
||||
ypos += lineHeight + VGAP;
|
||||
|
||||
|
@ -162,7 +166,7 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font)
|
|||
for(int i = 0; i < 5; ++i)
|
||||
{
|
||||
myRandomizeCPUWidget[i] = new CheckboxWidget(myTab, font, xpos, ypos + 1,
|
||||
cpuregsLabels[i], kRandCPUID);
|
||||
cpuregsLabels[i]);
|
||||
wid.push_back(myRandomizeCPUWidget[i]);
|
||||
xpos += CheckboxWidget::boxSize(font) + font.getStringWidth("XX") + fontWidth * 2.5;
|
||||
}
|
||||
|
@ -669,6 +673,7 @@ void DeveloperDialog::loadSettings(SettingsSet set)
|
|||
myConsole[set] = instance().settings().getString(prefix + "console") == "7800" ? 1 : 0;
|
||||
// Randomization
|
||||
myRandomBank[set] = instance().settings().getBool(prefix + "bankrandom");
|
||||
myRandomizeTIA[set] = instance().settings().getBool(prefix + "tiarandom");
|
||||
myRandomizeRAM[set] = instance().settings().getBool(prefix + "ramrandom");
|
||||
myRandomizeCPU[set] = instance().settings().getString(prefix + "cpurandom");
|
||||
// Undriven TIA pins
|
||||
|
@ -725,6 +730,7 @@ void DeveloperDialog::saveSettings(SettingsSet set)
|
|||
|
||||
// Randomization
|
||||
instance().settings().setValue(prefix + "bankrandom", myRandomBank[set]);
|
||||
instance().settings().setValue(prefix + "tiarandom", myRandomizeTIA[set]);
|
||||
instance().settings().setValue(prefix + "ramrandom", myRandomizeRAM[set]);
|
||||
instance().settings().setValue(prefix + "cpurandom", myRandomizeCPU[set]);
|
||||
|
||||
|
@ -786,6 +792,7 @@ void DeveloperDialog::getWidgetStates(SettingsSet set)
|
|||
myConsole[set] = myConsoleWidget->getSelected() == 1;
|
||||
// Randomization
|
||||
myRandomBank[set] = myRandomBankWidget->getState();
|
||||
myRandomizeTIA[set] = myRandomizeTIAWidget->getState();
|
||||
myRandomizeRAM[set] = myRandomizeRAMWidget->getState();
|
||||
string cpurandom;
|
||||
const std::array<string, 5> cpuregs = {"S", "A", "X", "Y", "P"};
|
||||
|
@ -841,6 +848,7 @@ void DeveloperDialog::setWidgetStates(SettingsSet set)
|
|||
myConsoleWidget->setSelectedIndex(myConsole[set]);
|
||||
// Randomization
|
||||
myRandomBankWidget->setState(myRandomBank[set]);
|
||||
myRandomizeTIAWidget->setState(myRandomizeTIA[set]);
|
||||
myRandomizeRAMWidget->setState(myRandomizeRAM[set]);
|
||||
|
||||
const string& cpurandom = myRandomizeCPU[set];
|
||||
|
@ -1025,6 +1033,7 @@ void DeveloperDialog::setDefaults()
|
|||
myConsole[set] = 0;
|
||||
// Randomization
|
||||
myRandomBank[set] = devSettings ? true : false;
|
||||
myRandomizeTIA[set] = true;
|
||||
myRandomizeRAM[set] = true;
|
||||
myRandomizeCPU[set] = devSettings ? "SAXYP" : "AXYP";
|
||||
// Undriven TIA pins
|
||||
|
|
|
@ -57,8 +57,6 @@ class DeveloperDialog : public Dialog
|
|||
kPlrSettings = 'DVpl',
|
||||
kDevSettings = 'DVdv',
|
||||
kConsole = 'DVco',
|
||||
kRandRAMID = 'DVrm',
|
||||
kRandCPUID = 'DVcp',
|
||||
kTIAType = 'DVtt',
|
||||
kTVJitter = 'DVjt',
|
||||
kTVJitterChanged = 'DVjr',
|
||||
|
@ -94,6 +92,7 @@ class DeveloperDialog : public Dialog
|
|||
PopUpWidget* myConsoleWidget{nullptr};
|
||||
StaticTextWidget* myLoadingROMLabel{nullptr};
|
||||
CheckboxWidget* myRandomBankWidget{nullptr};
|
||||
CheckboxWidget* myRandomizeTIAWidget{nullptr};
|
||||
CheckboxWidget* myRandomizeRAMWidget{nullptr};
|
||||
StaticTextWidget* myRandomizeCPULabel{nullptr};
|
||||
CheckboxWidget* myUndrivenPinsWidget{nullptr};
|
||||
|
@ -154,6 +153,7 @@ class DeveloperDialog : public Dialog
|
|||
std::array<bool, 2> myDetectedInfo;
|
||||
std::array<int, 2> myConsole;
|
||||
std::array<bool, 2> myRandomBank;
|
||||
std::array<bool, 2> myRandomizeTIA;
|
||||
std::array<bool, 2> myRandomizeRAM;
|
||||
std::array<string, 2> myRandomizeCPU;
|
||||
std::array<bool, 2> myColorLoss;
|
||||
|
|
Loading…
Reference in New Issue