added hotkey for toggling Developer Settings sets

This commit is contained in:
Thomas Jentzsch 2021-10-30 14:56:03 +02:00
parent d7f4bdd9f3
commit 228b2379ca
18 changed files with 106 additions and 235 deletions

View File

@ -33,6 +33,8 @@
* Added different debug color luminances for player and missile copies. * Added different debug color luminances for player and missile copies.
* Added hotkeys for TV roll speed and toggling 'Developer settings' sets.
* Debugger: enhanced prompt's auto complete and history. * Debugger: enhanced prompt's auto complete and history.
* Debugger: added optional logging of breaks and traps. * Debugger: added optional logging of breaks and traps.

View File

@ -1840,6 +1840,12 @@
<th>Key (macOS)</th> <th>Key (macOS)</th>
</tr> </tr>
<tr>
<td>Toggle <b><a href="#Debugger">Developer Settings</a></b> sets (player/developer)</td>
<td>Control + D</td>
<td>Control + D</td>
</tr>
<tr> <tr>
<td>Toggle frame stats</br>(scanline count/FPS/BS type etc.)</td> <td>Toggle frame stats</br>(scanline count/FPS/BS type etc.)</td>
<td>Alt + L</td> <td>Alt + L</td>
@ -1949,13 +1955,13 @@
</tr> </tr>
<tr> <tr>
<td><i>Decrease</i> TV jitter roll</td> <td><i>Decrease</i> TV jitter roll time</td>
<td>Shift-Control + J</td> <td>Shift-Control + J</td>
<td>Shift-Control + J</td> <td>Shift-Control + J</td>
</tr> </tr>
<tr> <tr>
<td><i>Increase</i> TV jitter roll</td> <td><i>Increase</i> TV jitter roll time</td>
<td>Control + J</td> <td>Control + J</td>
<td>Control + J</td> <td>Control + J</td>
</tr> </tr>

View File

@ -680,6 +680,7 @@ PhysicalKeyboardHandler::DefaultCommonMapping = {
{ Event::ToggleTurbo, KBDK_T, KBDM_CTRL }, { Event::ToggleTurbo, KBDK_T, KBDM_CTRL },
{ Event::JitterDecrease, KBDK_J, KBDM_SHIFT | KBDM_CTRL }, { Event::JitterDecrease, KBDK_J, KBDM_SHIFT | KBDM_CTRL },
{ Event::JitterIncrease, KBDK_J, KBDM_CTRL }, { Event::JitterIncrease, KBDK_J, KBDM_CTRL },
{ Event::ToggleDeveloperSet, KBDK_D, KBDM_CTRL },
{ Event::ToggleJitter, KBDK_J, MOD3 }, { Event::ToggleJitter, KBDK_J, MOD3 },
{ Event::ToggleFrameStats, KBDK_L, MOD3 }, { Event::ToggleFrameStats, KBDK_L, MOD3 },
{ Event::ToggleTimeMachine, KBDK_T, MOD3 }, { Event::ToggleTimeMachine, KBDK_T, MOD3 },

View File

@ -350,6 +350,7 @@ NLOHMANN_JSON_SERIALIZE_ENUM(Event::Type, {
{Event::PhosphorDecrease, "PhosphorDecrease"}, {Event::PhosphorDecrease, "PhosphorDecrease"},
{Event::PhosphorIncrease, "PhosphorIncrease"}, {Event::PhosphorIncrease, "PhosphorIncrease"},
{Event::TogglePhosphor, "TogglePhosphor"}, {Event::TogglePhosphor, "TogglePhosphor"},
{Event::ToggleDeveloperSet, "ToggleDeveloperSet"},
{Event::ToggleInter, "ToggleInter"}, {Event::ToggleInter, "ToggleInter"},
{Event::JitterDecrease, "JitterDecrease"}, {Event::JitterDecrease, "JitterDecrease"},
{Event::JitterIncrease, "JitterIncrease"}, {Event::JitterIncrease, "JitterIncrease"},

View File

@ -4,6 +4,7 @@ MODULE_OBJS := \
src/common/AudioQueue.o \ src/common/AudioQueue.o \
src/common/AudioSettings.o \ src/common/AudioSettings.o \
src/common/Base.o \ src/common/Base.o \
src/common/DevSettingsHandler.o \
src/common/EventHandlerSDL2.o \ src/common/EventHandlerSDL2.o \
src/common/FBBackendSDL2.o \ src/common/FBBackendSDL2.o \
src/common/FBSurfaceSDL2.o \ src/common/FBSurfaceSDL2.o \

View File

@ -63,6 +63,7 @@
#include "FrameLayout.hxx" #include "FrameLayout.hxx"
#include "AudioQueue.hxx" #include "AudioQueue.hxx"
#include "AudioSettings.hxx" #include "AudioSettings.hxx"
#include "DevSettingsHandler.hxx"
#include "frame-manager/FrameManager.hxx" #include "frame-manager/FrameManager.hxx"
#include "frame-manager/FrameLayoutDetector.hxx" #include "frame-manager/FrameLayoutDetector.hxx"
@ -155,6 +156,9 @@ Console::Console(OSystem& osystem, unique_ptr<Cartridge>& cart,
// We can only initialize after all the devices/components have been created // We can only initialize after all the devices/components have been created
mySystem->initialize(); mySystem->initialize();
// Create developer/player settings handler (handles switching sets)
myDevSettingsHandler = make_unique<DevSettingsHandler>(myOSystem);
// Auto-detect NTSC/PAL mode if it's requested // Auto-detect NTSC/PAL mode if it's requested
string autodetected = ""; string autodetected = "";
myDisplayFormat = myProperties.get(PropType::Display_Format); myDisplayFormat = myProperties.get(PropType::Display_Format);
@ -1145,6 +1149,26 @@ int Console::gameRefreshRate() const
myDisplayFormat == "SECAM60" ? 60 : 50; myDisplayFormat == "SECAM60" ? 60 : 50;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::toggleDeveloperSet(bool toggle)
{
bool devSettings = myOSystem.settings().getBool("dev.settings");
if(toggle)
{
devSettings = !devSettings;
DevSettingsHandler::SettingsSet set = devSettings
? DevSettingsHandler::SettingsSet::developer
: DevSettingsHandler::SettingsSet::player;
myOSystem.settings().setValue("dev.settings", devSettings);
myDevSettingsHandler->loadSettings(set);
myDevSettingsHandler->applySettings(set);
}
const string message = (devSettings ? "Developer" : "Player") + string(" settings enabled");
myOSystem.frameBuffer().showTextMessage(message);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::toggleTIABit(TIABit bit, const string& bitname, bool show, bool toggle) const void Console::toggleTIABit(TIABit bit, const string& bitname, bool show, bool toggle) const
{ {

View File

@ -29,6 +29,7 @@ class CompuMate;
class Debugger; class Debugger;
class AudioQueue; class AudioQueue;
class AudioSettings; class AudioSettings;
class DevSettingsHandler;
#include "bspf.hxx" #include "bspf.hxx"
#include "ConsoleIO.hxx" #include "ConsoleIO.hxx"
@ -324,6 +325,11 @@ class Console : public Serializable, public ConsoleIO
*/ */
int gameRefreshRate() const; int gameRefreshRate() const;
/**
Toggle between developer settings sets (player/developer)
*/
void toggleDeveloperSet(bool toggle = true);
/** /**
Toggles the TIA bit specified in the method name. Toggles the TIA bit specified in the method name.
*/ */
@ -453,6 +459,9 @@ class Console : public Serializable, public ConsoleIO
// Pointers to the left and right controllers // Pointers to the left and right controllers
unique_ptr<Controller> myLeftControl, myRightControl; unique_ptr<Controller> myLeftControl, myRightControl;
// Pointer to handler for switching developer settings sets
unique_ptr<DevSettingsHandler> myDevSettingsHandler;
// Pointer to CompuMate handler (only used in CompuMate ROMs) // Pointer to CompuMate handler (only used in CompuMate ROMs)
shared_ptr<CompuMate> myCMHandler; shared_ptr<CompuMate> myCMHandler;

View File

@ -112,7 +112,7 @@ class Event
PreviousAttribute, NextAttribute, DecreaseAttribute, IncreaseAttribute, PreviousAttribute, NextAttribute, DecreaseAttribute, IncreaseAttribute,
ScanlinesDecrease, ScanlinesIncrease, ScanlinesDecrease, ScanlinesIncrease,
PhosphorDecrease, PhosphorIncrease, TogglePhosphor, ToggleInter, PhosphorDecrease, PhosphorIncrease, TogglePhosphor, ToggleInter,
JitterDecrease, JitterIncrease, ToggleJitter, ToggleDeveloperSet, JitterDecrease, JitterIncrease, ToggleJitter,
VolumeDecrease, VolumeIncrease, SoundToggle, VolumeDecrease, VolumeIncrease, SoundToggle,

View File

@ -88,6 +88,7 @@ EventHandler::~EventHandler()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::initialize() void EventHandler::initialize()
{ {
// Create global key handler (handles all global hot keys)
myGlobalKeyHandler = make_unique<GlobalKeyHandler>(myOSystem); myGlobalKeyHandler = make_unique<GlobalKeyHandler>(myOSystem);
// Create keyboard handler (to handle all physical keyboard functionality) // Create keyboard handler (to handle all physical keyboard functionality)
@ -937,6 +938,14 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
} }
return; return;
case Event::ToggleDeveloperSet:
if(pressed && !repeated)
{
myOSystem.console().toggleDeveloperSet();
myGlobalKeyHandler->setSetting(GlobalKeyHandler::Setting::DEVELOPER);
}
break;
case Event::ToggleJitter: case Event::ToggleJitter:
if(pressed && !repeated) if(pressed && !repeated)
{ {
@ -2882,6 +2891,7 @@ EventHandler::EmulActionList EventHandler::ourEmulActionList = { {
{ Event::SettingIncrease, "Increase current setting", "" }, { Event::SettingIncrease, "Increase current setting", "" },
// Developer keys: // Developer keys:
{ Event::ToggleDeveloperSet, "Toggle developer settings sets", "" },
{ Event::ToggleFrameStats, "Toggle frame stats", "" }, { Event::ToggleFrameStats, "Toggle frame stats", "" },
{ Event::ToggleP0Bit, "Toggle TIA Player0 object", "" }, { Event::ToggleP0Bit, "Toggle TIA Player0 object", "" },
{ Event::ToggleP0Collision, "Toggle TIA Player0 collisions", "" }, { Event::ToggleP0Collision, "Toggle TIA Player0 collisions", "" },
@ -3131,7 +3141,7 @@ const Event::EventSet EventHandler::ComboEvents = {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const Event::EventSet EventHandler::DebugEvents = { const Event::EventSet EventHandler::DebugEvents = {
Event::DebuggerMode, Event::DebuggerMode, Event::ToggleDeveloperSet,
Event::ToggleFrameStats, Event::ToggleFrameStats,
Event::ToggleP0Collision, Event::ToggleP0Bit, Event::ToggleP1Collision, Event::ToggleP1Bit, Event::ToggleP0Collision, Event::ToggleP0Bit, Event::ToggleP1Collision, Event::ToggleP1Bit,
Event::ToggleM0Collision, Event::ToggleM0Bit, Event::ToggleM1Collision, Event::ToggleM1Bit, Event::ToggleM0Collision, Event::ToggleM0Bit, Event::ToggleM1Collision, Event::ToggleM1Bit,

View File

@ -522,7 +522,7 @@ class EventHandler
#else #else
REFRESH_SIZE = 0, REFRESH_SIZE = 0,
#endif #endif
EMUL_ACTIONLIST_SIZE = 218 + PNG_SIZE + COMBO_SIZE + REFRESH_SIZE, EMUL_ACTIONLIST_SIZE = 219 + PNG_SIZE + COMBO_SIZE + REFRESH_SIZE,
MENU_ACTIONLIST_SIZE = 19 MENU_ACTIONLIST_SIZE = 19
; ;

View File

@ -404,6 +404,7 @@ GlobalKeyHandler::SettingData GlobalKeyHandler::getSettingData(const Setting set
{Setting::MOUSE_CONTROL, {false, std::bind(&EventHandler::changeMouseControl, &myOSystem.eventHandler(), _1)}}, // property, not persisted {Setting::MOUSE_CONTROL, {false, std::bind(&EventHandler::changeMouseControl, &myOSystem.eventHandler(), _1)}}, // property, not persisted
{Setting::MOUSE_RANGE, {true, std::bind(&Console::changePaddleAxesRange, &myOSystem.console(), _1)}}, // property, not persisted {Setting::MOUSE_RANGE, {true, std::bind(&Console::changePaddleAxesRange, &myOSystem.console(), _1)}}, // property, not persisted
// *** Debug group *** // *** Debug group ***
{Setting::DEVELOPER, {false, std::bind(&Console::toggleDeveloperSet, &myOSystem.console(), _1)}},
{Setting::STATS, {false, std::bind(&FrameBuffer::toggleFrameStats, &myOSystem.frameBuffer(), _1)}}, {Setting::STATS, {false, std::bind(&FrameBuffer::toggleFrameStats, &myOSystem.frameBuffer(), _1)}},
{Setting::P0_ENAM, {false, std::bind(&Console::toggleP0Bit, &myOSystem.console(), _1)}}, // debug, not persisted {Setting::P0_ENAM, {false, std::bind(&Console::toggleP0Bit, &myOSystem.console(), _1)}}, // debug, not persisted
{Setting::P1_ENAM, {false, std::bind(&Console::toggleP1Bit, &myOSystem.console(), _1)}}, // debug, not persisted {Setting::P1_ENAM, {false, std::bind(&Console::toggleP1Bit, &myOSystem.console(), _1)}}, // debug, not persisted

View File

@ -98,6 +98,7 @@ class GlobalKeyHandler
MOUSE_CONTROL, MOUSE_CONTROL,
MOUSE_RANGE, MOUSE_RANGE,
// *** Debug group *** // *** Debug group ***
DEVELOPER,
STATS, STATS,
P0_ENAM, P0_ENAM,
P1_ENAM, P1_ENAM,
@ -127,7 +128,7 @@ class GlobalKeyHandler
END_AV_ADJ = INTERPOLATION, END_AV_ADJ = INTERPOLATION,
START_INPUT_ADJ = DIGITAL_DEADZONE, START_INPUT_ADJ = DIGITAL_DEADZONE,
END_INPUT_ADJ = MOUSE_RANGE, END_INPUT_ADJ = MOUSE_RANGE,
START_DEBUG_ADJ = STATS, START_DEBUG_ADJ = DEVELOPER,
END_DEBUG_ADJ = JITTER, END_DEBUG_ADJ = JITTER,
}; };
@ -195,6 +196,13 @@ class GlobalKeyHandler
// they can be changed with global hotkeys while their message is still // they can be changed with global hotkeys while their message is still
// displayed // displayed
Setting myDirectSetting{Setting::NONE}; Setting myDirectSetting{Setting::NONE};
// Following constructors and assignment operators not supported
GlobalKeyHandler() = delete;
GlobalKeyHandler(const GlobalKeyHandler&) = delete;
GlobalKeyHandler(GlobalKeyHandler&&) = delete;
GlobalKeyHandler& operator=(const GlobalKeyHandler&) = delete;
GlobalKeyHandler& operator=(GlobalKeyHandler&&) = delete;
}; };
#endif #endif

View File

@ -23,6 +23,7 @@
#include "SaveKey.hxx" #include "SaveKey.hxx"
#include "AtariVox.hxx" #include "AtariVox.hxx"
#include "Settings.hxx" #include "Settings.hxx"
#include "DevSettingsHandler.hxx"
#include "EditTextWidget.hxx" #include "EditTextWidget.hxx"
#include "PopUpWidget.hxx" #include "PopUpWidget.hxx"
#include "RadioButtonWidget.hxx" #include "RadioButtonWidget.hxx"
@ -46,7 +47,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DeveloperDialog::DeveloperDialog(OSystem& osystem, DialogContainer& parent, DeveloperDialog::DeveloperDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, int max_w, int max_h) const GUI::Font& font, int max_w, int max_h)
: Dialog(osystem, parent, font, "Developer settings") : Dialog(osystem, parent, font, "Developer settings"),
DevSettingsHandler(osystem)
{ {
const int lineHeight = Dialog::lineHeight(), const int lineHeight = Dialog::lineHeight(),
fontWidth = Dialog::fontWidth(), fontWidth = Dialog::fontWidth(),
@ -662,128 +664,6 @@ void DeveloperDialog::addDebuggerTab(const GUI::Font& font)
myTab->parentWidget(tabID)->setHelpAnchor("DeveloperDebugger"); myTab->parentWidget(tabID)->setHelpAnchor("DeveloperDebugger");
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::loadSettings(SettingsSet set)
{
bool devSettings = set == SettingsSet::developer;
const string& prefix = devSettings ? "dev." : "plr.";
myFrameStats[set] = instance().settings().getBool(prefix + "stats");
myDetectedInfo[set] = instance().settings().getBool(prefix + "detectedinfo");
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
myUndrivenPins[set] = devSettings ? instance().settings().getBool("dev.tiadriven") : false;
#ifdef DEBUGGER_SUPPORT
// Read from write ports break
myRWPortBreak[set] = devSettings ? instance().settings().getBool("dev.rwportbreak") : false;
// Write to read ports break
myWRPortBreak[set] = devSettings ? instance().settings().getBool("dev.wrportbreak") : false;
#endif
// Thumb ARM emulation exception
myThumbException[set] = devSettings ? instance().settings().getBool("dev.thumb.trapfatal") : false;
// AtariVox/SaveKey/PlusROM access
myExternAccess[set] = instance().settings().getBool(prefix + "extaccess");
// TIA tab
myTIAType[set] = devSettings ? instance().settings().getString("dev.tia.type") : "standard";
myPlInvPhase[set] = devSettings ? instance().settings().getBool("dev.tia.plinvphase") : false;
myMsInvPhase[set] = devSettings ? instance().settings().getBool("dev.tia.msinvphase") : false;
myBlInvPhase[set] = devSettings ? instance().settings().getBool("dev.tia.blinvphase") : false;
myPFBits[set] = devSettings ? instance().settings().getBool("dev.tia.delaypfbits") : false;
myPFColor[set] = devSettings ? instance().settings().getBool("dev.tia.delaypfcolor") : false;
myBKColor[set] = devSettings ? instance().settings().getBool("dev.tia.delaybkcolor") : false;
myPlSwap[set] = devSettings ? instance().settings().getBool("dev.tia.delayplswap") : false;
myBlSwap[set] = devSettings ? instance().settings().getBool("dev.tia.delayblswap") : false;
// Debug colors
myDebugColors[set] = instance().settings().getBool(prefix + "debugcolors");
// PAL color-loss effect
myColorLoss[set] = instance().settings().getBool(prefix + "colorloss");
// Jitter
myTVJitter[set] = instance().settings().getBool(prefix + "tv.jitter");
myTVJitterRec[set] = instance().settings().getInt(prefix + "tv.jitter_recovery");
// States
myTimeMachine[set] = instance().settings().getBool(prefix + "timemachine");
myStateSize[set] = instance().settings().getInt(prefix + "tm.size");
myUncompressed[set] = instance().settings().getInt(prefix + "tm.uncompressed");
myStateInterval[set] = instance().settings().getString(prefix + "tm.interval");
myStateHorizon[set] = instance().settings().getString(prefix + "tm.horizon");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::saveSettings(SettingsSet set)
{
bool devSettings = set == SettingsSet::developer;
const string& prefix = devSettings ? "dev." : "plr.";
instance().settings().setValue(prefix + "stats", myFrameStats[set]);
instance().settings().setValue(prefix + "detectedinfo", myDetectedInfo[set]);
instance().settings().setValue(prefix + "console", myConsole[set] == 1 ? "7800" : "2600");
if(instance().hasConsole())
instance().eventHandler().set7800Mode();
// 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]);
if(devSettings)
{
// Undriven TIA pins
instance().settings().setValue("dev.tiadriven", myUndrivenPins[set]);
#ifdef DEBUGGER_SUPPORT
// Read from write ports break
instance().settings().setValue("dev.rwportbreak", myRWPortBreak[set]);
// Write to read ports break
instance().settings().setValue("dev.wrportbreak", myWRPortBreak[set]);
#endif
// Thumb ARM emulation exception
instance().settings().setValue("dev.thumb.trapfatal", myThumbException[set]);
}
// AtariVox/SaveKey/PlusROM access
instance().settings().setValue(prefix + "extaccess", myExternAccess[set]);
// TIA tab
if (devSettings)
{
instance().settings().setValue("dev.tia.type", myTIAType[set]);
if (BSPF::equalsIgnoreCase("custom", myTIAType[set]))
{
instance().settings().setValue("dev.tia.plinvphase", myPlInvPhase[set]);
instance().settings().setValue("dev.tia.msinvphase", myMsInvPhase[set]);
instance().settings().setValue("dev.tia.blinvphase", myBlInvPhase[set]);
instance().settings().setValue("dev.tia.delaypfbits", myPFBits[set]);
instance().settings().setValue("dev.tia.delaypfcolor", myPFColor[set]);
instance().settings().setValue("dev.tia.delaybkcolor", myBKColor[set]);
instance().settings().setValue("dev.tia.delayplswap", myPlSwap[set]);
instance().settings().setValue("dev.tia.delayblswap", myBlSwap[set]);
}
}
// Debug colors
instance().settings().setValue(prefix + "debugcolors", myDebugColors[set]);
// PAL color loss
instance().settings().setValue(prefix + "colorloss", myColorLoss[set]);
// Jitter
instance().settings().setValue(prefix + "tv.jitter", myTVJitter[set]);
instance().settings().setValue(prefix + "tv.jitter_recovery", myTVJitterRec[set]);
// States
instance().settings().setValue(prefix + "timemachine", myTimeMachine[set]);
instance().settings().setValue(prefix + "tm.size", myStateSize[set]);
instance().settings().setValue(prefix + "tm.uncompressed", myUncompressed[set]);
instance().settings().setValue(prefix + "tm.interval", myStateInterval[set]);
instance().settings().setValue(prefix + "tm.horizon", myStateHorizon[set]);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::getWidgetStates(SettingsSet set) void DeveloperDialog::getWidgetStates(SettingsSet set)
{ {
@ -947,39 +827,16 @@ void DeveloperDialog::loadConfig()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::saveConfig() void DeveloperDialog::saveConfig()
{ {
instance().settings().setValue("dev.settings", mySettingsGroupEmulation->getSelected() == SettingsSet::developer); bool devSettings = mySettingsGroupEmulation->getSelected() == SettingsSet::developer;
instance().settings().setValue("dev.settings", devSettings);
// copy current widget status into set... // copy current widget status into set...
getWidgetStates(SettingsSet(mySettingsGroupEmulation->getSelected())); getWidgetStates(SettingsSet(mySettingsGroupEmulation->getSelected()));
// ...and save both sets // ...and save both sets
saveSettings(SettingsSet::player); saveSettings(SettingsSet::player);
saveSettings(SettingsSet::developer); saveSettings(SettingsSet::developer);
// activate the current settings // activate the current settings
instance().frameBuffer().showFrameStats(myFrameStatsWidget->getState()); applySettings(devSettings ? SettingsSet::developer : SettingsSet::player);
// jitter
if(instance().hasConsole())
{
instance().console().tia().toggleJitter(myTVJitterWidget->getState() ? 1 : 0);
instance().console().tia().setJitterRecoveryFactor(myTVJitterRecWidget->getValue());
}
// TIA tab
if(instance().hasConsole())
{
instance().console().tia().setPlInvertedPhaseClock(myPlInvPhaseWidget->getState());
instance().console().tia().setMsInvertedPhaseClock(myMsInvPhaseWidget->getState());
instance().console().tia().setBlInvertedPhaseClock(myBlInvPhaseWidget->getState());
instance().console().tia().setPFBitsDelay(myPFBitsWidget->getState());
instance().console().tia().setPFColorDelay(myPFColorWidget->getState());
instance().console().tia().setBKColorDelay(myBKColorWidget->getState());
instance().console().tia().setPlSwapDelay(myPlSwapWidget->getState());
instance().console().tia().setBlSwapDelay(myBlSwapWidget->getState());
}
handleEnableDebugColors();
// PAL color loss
if(instance().hasConsole())
instance().console().enableColorLoss(myColorLossWidget->getState());
// Debug colours // Debug colours
string dbgcolors; string dbgcolors;
@ -989,11 +846,6 @@ void DeveloperDialog::saveConfig()
instance().console().tia().setFixedColorPalette(dbgcolors)) instance().console().tia().setFixedColorPalette(dbgcolors))
instance().settings().setValue("tia.dbgcolors", dbgcolors); instance().settings().setValue("tia.dbgcolors", dbgcolors);
// update RewindManager
instance().state().rewindManager().setup();
instance().state().setRewindMode(myTimeMachineWidget->getState() ?
StateManager::Mode::TimeMachine : StateManager::Mode::Off);
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
// Debugger font style // Debugger font style
instance().settings().setValue("dbg.fontstyle", instance().settings().setValue("dbg.fontstyle",
@ -1009,13 +861,6 @@ void DeveloperDialog::saveConfig()
instance().settings().setValue("dbg.ghostreadstrap", myGhostReadsTrapWidget->getState()); instance().settings().setValue("dbg.ghostreadstrap", myGhostReadsTrapWidget->getState());
if(instance().hasConsole()) if(instance().hasConsole())
instance().console().system().m6502().setGhostReadsTrap(myGhostReadsTrapWidget->getState()); instance().console().system().m6502().setGhostReadsTrap(myGhostReadsTrapWidget->getState());
// Read from write ports and write to read ports breaks
if (instance().hasConsole())
{
instance().console().system().m6502().setReadFromWritePortBreak(myRWPortBreakWidget->getState());
instance().console().system().m6502().setWriteToReadPortBreak(myWRPortBreakWidget->getState());
}
#endif #endif
} }
@ -1132,7 +977,7 @@ void DeveloperDialog::handleCommand(CommandSender* sender, int cmd, int data, in
case kConsole: case kConsole:
handleConsole(); handleConsole();
break; break;
case kTVJitter: case kTVJitter:
handleTVJitterChange(myTVJitterWidget->getState()); handleTVJitterChange(myTVJitterWidget->getState());
@ -1142,10 +987,6 @@ void DeveloperDialog::handleCommand(CommandSender* sender, int cmd, int data, in
myTVJitterRecLabelWidget->setValue(myTVJitterRecWidget->getValue()); myTVJitterRecLabelWidget->setValue(myTVJitterRecWidget->getValue());
break; break;
case kPPinCmd:
instance().console().tia().driveUnusedPinsRandom(myUndrivenPinsWidget->getState());
break;
case kTimeMachine: case kTimeMachine:
handleTimeMachine(); handleTimeMachine();
break; break;
@ -1228,12 +1069,16 @@ void DeveloperDialog::handleSettings(bool devSettings)
if (mySettings != devSettings) if (mySettings != devSettings)
{ {
mySettings = devSettings; // block redundant events first! mySettings = devSettings; // block redundant events first!
SettingsSet set = devSettings ? SettingsSet::developer : SettingsSet::player; SettingsSet set = devSettings ? SettingsSet::developer
: SettingsSet::player;
mySettingsGroupEmulation->setSelected(set); mySettingsGroupEmulation->setSelected(set);
mySettingsGroupTia->setSelected(set); mySettingsGroupTia->setSelected(set);
mySettingsGroupVideo->setSelected(set); mySettingsGroupVideo->setSelected(set);
mySettingsGroupTM->setSelected(set); mySettingsGroupTM->setSelected(set);
getWidgetStates(devSettings ? SettingsSet::player : SettingsSet::developer); // Save current widget states into old set
getWidgetStates(devSettings ? SettingsSet::player
: SettingsSet::developer);
// Load new set into widgets states
setWidgetStates(set); setWidgetStates(set);
} }
} }
@ -1245,17 +1090,6 @@ void DeveloperDialog::handleTVJitterChange(bool enable)
myTVJitterRecLabelWidget->setEnabled(enable); myTVJitterRecLabelWidget->setEnabled(enable);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::handleEnableDebugColors()
{
if(instance().hasConsole())
{
bool fixed = instance().console().tia().usingFixedColors();
if(fixed != myDebugColorsWidget->getState())
instance().console().tia().toggleFixedColors();
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::handleConsole() void DeveloperDialog::handleConsole()
{ {
@ -1287,14 +1121,16 @@ void DeveloperDialog::handleTia()
if(BSPF::equalsIgnoreCase("custom", myTIATypeWidget->getSelectedTag().toString())) if(BSPF::equalsIgnoreCase("custom", myTIATypeWidget->getSelectedTag().toString()))
{ {
myPlInvPhaseWidget->setState(myPlInvPhase[SettingsSet::developer]); SettingsSet set = SettingsSet::developer;
myMsInvPhaseWidget->setState(myMsInvPhase[SettingsSet::developer]);
myBlInvPhaseWidget->setState(myBlInvPhase[SettingsSet::developer]); myPlInvPhaseWidget->setState(myPlInvPhase[set]);
myPFBitsWidget->setState(myPFBits[SettingsSet::developer]); myMsInvPhaseWidget->setState(myMsInvPhase[set]);
myPFColorWidget->setState(myPFColor[SettingsSet::developer]); myBlInvPhaseWidget->setState(myBlInvPhase[set]);
myBKColorWidget->setState(myBKColor[SettingsSet::developer]); myPFBitsWidget->setState(myPFBits[set]);
myPlSwapWidget->setState(myPlSwap[SettingsSet::developer]); myPFColorWidget->setState(myPFColor[set]);
myBlSwapWidget->setState(myBlSwap[SettingsSet::developer]); myBKColorWidget->setState(myBKColor[set]);
myPlSwapWidget->setState(myPlSwap[set]);
myBlSwapWidget->setState(myBlSwap[set]);
} }
else else
{ {

View File

@ -29,6 +29,7 @@ class RadioButtonWidget;
class SliderWidget; class SliderWidget;
class StaticTextWidget; class StaticTextWidget;
class ColorWidget; class ColorWidget;
class DevSettingsHandler;
namespace GUI { namespace GUI {
class Font; class Font;
@ -36,8 +37,9 @@ namespace GUI {
#include "bspf.hxx" #include "bspf.hxx"
#include "Dialog.hxx" #include "Dialog.hxx"
#include "DevSettingsHandler.hxx"
class DeveloperDialog : public Dialog class DeveloperDialog : public Dialog, DevSettingsHandler
{ {
public: public:
DeveloperDialog(OSystem& osystem, DialogContainer& parent, DeveloperDialog(OSystem& osystem, DialogContainer& parent,
@ -60,7 +62,6 @@ class DeveloperDialog : public Dialog
kTIAType = 'DVtt', kTIAType = 'DVtt',
kTVJitter = 'DVjt', kTVJitter = 'DVjt',
kTVJitterChanged = 'DVjr', kTVJitterChanged = 'DVjr',
kPPinCmd = 'DVpn',
kTimeMachine = 'DTtm', kTimeMachine = 'DTtm',
kSizeChanged = 'DTsz', kSizeChanged = 'DTsz',
kUncompressedChanged = 'DTuc', kUncompressedChanged = 'DTuc',
@ -76,7 +77,6 @@ class DeveloperDialog : public Dialog
kDFontSizeChanged = 'UIfs', kDFontSizeChanged = 'UIfs',
#endif #endif
}; };
enum SettingsSet { player = 0, developer = 1 };
// MUST be aligned with RewindManager! // MUST be aligned with RewindManager!
static constexpr int NUM_INTERVALS = 7; static constexpr int NUM_INTERVALS = 7;
@ -148,41 +148,6 @@ class DeveloperDialog : public Dialog
#endif #endif
bool mySettings{false}; bool mySettings{false};
// Emulator sets
std::array<bool, 2> myFrameStats;
std::array<bool, 2> myDetectedInfo;
std::array<bool, 2> myExternAccess;
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;
std::array<bool, 2> myTVJitter;
std::array<int, 2> myTVJitterRec;
std::array<bool, 2> myDebugColors;
std::array<bool, 2> myUndrivenPins;
#ifdef DEBUGGER_SUPPORT
std::array<bool, 2> myRWPortBreak;
std::array<bool, 2> myWRPortBreak;
#endif
std::array<bool, 2> myThumbException;
// TIA sets
std::array<string, 2> myTIAType;
std::array<bool, 2> myPlInvPhase;
std::array<bool, 2> myMsInvPhase;
std::array<bool, 2> myBlInvPhase;
std::array<bool, 2> myPFBits;
std::array<bool, 2> myPFColor;
std::array<bool, 2> myBKColor;
std::array<bool, 2> myPlSwap;
std::array<bool, 2> myBlSwap;
// States sets
std::array<bool, 2> myTimeMachine;
std::array<int, 2> myStateSize;
std::array<int, 2> myUncompressed;
std::array<string, 2> myStateInterval;
std::array<string, 2> myStateHorizon;
private: private:
void addEmulationTab(const GUI::Font& font); void addEmulationTab(const GUI::Font& font);
@ -191,14 +156,11 @@ class DeveloperDialog : public Dialog
void addVideoTab(const GUI::Font& font); void addVideoTab(const GUI::Font& font);
void addDebuggerTab(const GUI::Font& font); void addDebuggerTab(const GUI::Font& font);
void loadSettings(SettingsSet set);
void saveSettings(SettingsSet set);
void getWidgetStates(SettingsSet set); void getWidgetStates(SettingsSet set);
void setWidgetStates(SettingsSet set); void setWidgetStates(SettingsSet set);
void handleSettings(bool devSettings); void handleSettings(bool devSettings);
void handleTVJitterChange(bool enable); void handleTVJitterChange(bool enable);
void handleEnableDebugColors();
void handleConsole(); void handleConsole();
void handleTia(); void handleTia();

View File

@ -17,6 +17,7 @@ SOURCES_CXX := \
$(CORE_DIR)/common/AudioQueue.cxx \ $(CORE_DIR)/common/AudioQueue.cxx \
$(CORE_DIR)/common/AudioSettings.cxx \ $(CORE_DIR)/common/AudioSettings.cxx \
$(CORE_DIR)/common/Base.cxx \ $(CORE_DIR)/common/Base.cxx \
$(CORE_DIR)/common/DevSettingsHandler.cxx \
$(CORE_DIR)/common/FpsMeter.cxx \ $(CORE_DIR)/common/FpsMeter.cxx \
$(CORE_DIR)/common/FSNodeZIP.cxx \ $(CORE_DIR)/common/FSNodeZIP.cxx \
$(CORE_DIR)/common/JoyMap.cxx \ $(CORE_DIR)/common/JoyMap.cxx \

View File

@ -159,6 +159,7 @@
<ClCompile Include="..\common\AudioQueue.cxx" /> <ClCompile Include="..\common\AudioQueue.cxx" />
<ClCompile Include="..\common\AudioSettings.cxx" /> <ClCompile Include="..\common\AudioSettings.cxx" />
<ClCompile Include="..\common\Base.cxx" /> <ClCompile Include="..\common\Base.cxx" />
<ClCompile Include="..\common\DevSettingsHandler.cxx" />
<ClCompile Include="..\common\FpsMeter.cxx" /> <ClCompile Include="..\common\FpsMeter.cxx" />
<ClCompile Include="..\common\MouseControl.cxx" /> <ClCompile Include="..\common\MouseControl.cxx" />
<ClCompile Include="..\common\PhysicalJoystick.cxx" /> <ClCompile Include="..\common\PhysicalJoystick.cxx" />

View File

@ -614,6 +614,7 @@
<ClCompile Include="..\common\audio\LanczosResampler.cxx" /> <ClCompile Include="..\common\audio\LanczosResampler.cxx" />
<ClCompile Include="..\common\audio\SimpleResampler.cxx" /> <ClCompile Include="..\common\audio\SimpleResampler.cxx" />
<ClCompile Include="..\common\Base.cxx" /> <ClCompile Include="..\common\Base.cxx" />
<ClCompile Include="..\common\DevSettingsHandler.cxx" />
<ClCompile Include="..\common\EventHandlerSDL2.cxx" /> <ClCompile Include="..\common\EventHandlerSDL2.cxx" />
<ClCompile Include="..\common\FBBackendSDL2.cxx" /> <ClCompile Include="..\common\FBBackendSDL2.cxx" />
<ClCompile Include="..\common\FBSurfaceSDL2.cxx" /> <ClCompile Include="..\common\FBSurfaceSDL2.cxx" />
@ -1778,6 +1779,7 @@
<ClInclude Include="..\common\audio\SimpleResampler.hxx" /> <ClInclude Include="..\common\audio\SimpleResampler.hxx" />
<ClInclude Include="..\common\Base.hxx" /> <ClInclude Include="..\common\Base.hxx" />
<ClInclude Include="..\common\bspf.hxx" /> <ClInclude Include="..\common\bspf.hxx" />
<ClInclude Include="..\common\DevSettingsHandler.hxx" />
<ClInclude Include="..\common\EventHandlerSDL2.hxx" /> <ClInclude Include="..\common\EventHandlerSDL2.hxx" />
<ClInclude Include="..\common\FBBackendSDL2.hxx" /> <ClInclude Include="..\common\FBBackendSDL2.hxx" />
<ClInclude Include="..\common\FBSurfaceSDL2.hxx" /> <ClInclude Include="..\common\FBSurfaceSDL2.hxx" />

View File

@ -1116,6 +1116,9 @@
<ClCompile Include="..\emucore\GlobalKeyHandler.cxx"> <ClCompile Include="..\emucore\GlobalKeyHandler.cxx">
<Filter>Source Files\emucore</Filter> <Filter>Source Files\emucore</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\common\DevSettingsHandler.cxx">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\common\bspf.hxx"> <ClInclude Include="..\common\bspf.hxx">
@ -2294,6 +2297,9 @@
<ClInclude Include="..\emucore\GlobalKeyHandler.hxx"> <ClInclude Include="..\emucore\GlobalKeyHandler.hxx">
<Filter>Header Files\emucore</Filter> <Filter>Header Files\emucore</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\common\DevSettingsHandler.hxx">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="stella.ico"> <None Include="stella.ico">