| 1 | //============================================================================ |
| 2 | // |
| 3 | // SSSS tt lll lll |
| 4 | // SS SS tt ll ll |
| 5 | // SS tttttt eeee ll ll aaaa |
| 6 | // SSSS tt ee ee ll ll aa |
| 7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" |
| 8 | // SS SS tt ee ll ll aa aa |
| 9 | // SSSS ttt eeeee llll llll aaaaa |
| 10 | // |
| 11 | // Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony |
| 12 | // and the Stella Team |
| 13 | // |
| 14 | // See the file "License.txt" for information on usage and redistribution of |
| 15 | // this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 16 | //============================================================================ |
| 17 | |
| 18 | #ifndef DEVELOPER_DIALOG_HXX |
| 19 | #define DEVELOPER_DIALOG_HXX |
| 20 | |
| 21 | class OSystem; |
| 22 | class GuiObject; |
| 23 | class TabWidget; |
| 24 | class CheckboxWidget; |
| 25 | class EditTextWidget; |
| 26 | class ; |
| 27 | class RadioButtonGroup; |
| 28 | class RadioButtonWidget; |
| 29 | class SliderWidget; |
| 30 | class StaticTextWidget; |
| 31 | class ColorWidget; |
| 32 | |
| 33 | namespace GUI { |
| 34 | class Font; |
| 35 | } |
| 36 | |
| 37 | #include "bspf.hxx" |
| 38 | #include "Dialog.hxx" |
| 39 | |
| 40 | class DeveloperDialog : public Dialog |
| 41 | { |
| 42 | public: |
| 43 | DeveloperDialog(OSystem& osystem, DialogContainer& parent, |
| 44 | const GUI::Font& font, int max_w, int max_h); |
| 45 | virtual ~DeveloperDialog() = default; |
| 46 | |
| 47 | private: |
| 48 | void handleCommand(CommandSender* sender, int cmd, int data, int id) override; |
| 49 | |
| 50 | void loadConfig() override; |
| 51 | void saveConfig() override; |
| 52 | void setDefaults() override; |
| 53 | |
| 54 | private: |
| 55 | enum |
| 56 | { |
| 57 | kPlrSettings = 'DVpl', |
| 58 | kDevSettings = 'DVdv', |
| 59 | kConsole = 'DVco', |
| 60 | kRandRAMID = 'DVrm', |
| 61 | kRandCPUID = 'DVcp', |
| 62 | kTIAType = 'DVtt', |
| 63 | kTVJitter = 'DVjt', |
| 64 | kTVJitterChanged = 'DVjr', |
| 65 | kPPinCmd = 'DVpn', |
| 66 | kTimeMachine = 'DTtm', |
| 67 | kSizeChanged = 'DTsz', |
| 68 | kUncompressedChanged = 'DTuc', |
| 69 | kIntervalChanged = 'DTin', |
| 70 | kHorizonChanged = 'DThz', |
| 71 | kP0ColourChangedCmd = 'GOp0', |
| 72 | kM0ColourChangedCmd = 'GOm0', |
| 73 | kP1ColourChangedCmd = 'GOp1', |
| 74 | kM1ColourChangedCmd = 'GOm1', |
| 75 | kPFColourChangedCmd = 'GOpf', |
| 76 | kBLColourChangedCmd = 'GObl', |
| 77 | #ifdef DEBUGGER_SUPPORT |
| 78 | kDFontSizeChanged = 'UIfs', |
| 79 | #endif |
| 80 | }; |
| 81 | enum SettingsSet { player = 0, developer = 1 }; |
| 82 | |
| 83 | // MUST be aligned with RewindManager! |
| 84 | static const int NUM_INTERVALS = 7; |
| 85 | static const int NUM_HORIZONS = 8; |
| 86 | |
| 87 | static const int DEBUG_COLORS = 6; |
| 88 | |
| 89 | TabWidget* myTab; |
| 90 | // Emulator widgets |
| 91 | RadioButtonGroup* mySettingsGroupEmulation; |
| 92 | CheckboxWidget* myFrameStatsWidget; |
| 93 | PopUpWidget* myConsoleWidget; |
| 94 | StaticTextWidget* myLoadingROMLabel; |
| 95 | CheckboxWidget* myRandomBankWidget; |
| 96 | CheckboxWidget* myRandomizeRAMWidget; |
| 97 | StaticTextWidget* myRandomizeCPULabel; |
| 98 | CheckboxWidget* myRandomizeCPUWidget[5]; |
| 99 | CheckboxWidget* myUndrivenPinsWidget; |
| 100 | #ifdef DEBUGGER_SUPPORT |
| 101 | CheckboxWidget* myRWPortBreakWidget; |
| 102 | CheckboxWidget* myWRPortBreakWidget; |
| 103 | #endif |
| 104 | CheckboxWidget* myThumbExceptionWidget; |
| 105 | CheckboxWidget* myEEPROMAccessWidget; |
| 106 | |
| 107 | // TIA widgets |
| 108 | RadioButtonGroup* mySettingsGroupTia; |
| 109 | PopUpWidget* myTIATypeWidget; |
| 110 | StaticTextWidget* myInvPhaseLabel; |
| 111 | CheckboxWidget* myPlInvPhaseWidget; |
| 112 | CheckboxWidget* myMsInvPhaseWidget; |
| 113 | CheckboxWidget* myBlInvPhaseWidget; |
| 114 | StaticTextWidget* myPlayfieldLabel; |
| 115 | CheckboxWidget* myPFBitsWidget; |
| 116 | CheckboxWidget* myPFColorWidget; |
| 117 | StaticTextWidget* mySwapLabel; |
| 118 | CheckboxWidget* myPlSwapWidget; |
| 119 | CheckboxWidget* myBlSwapWidget; |
| 120 | |
| 121 | // Video widgets |
| 122 | RadioButtonGroup* mySettingsGroupVideo; |
| 123 | CheckboxWidget* myTVJitterWidget; |
| 124 | SliderWidget* myTVJitterRecWidget; |
| 125 | StaticTextWidget* myTVJitterRecLabelWidget; |
| 126 | CheckboxWidget* myColorLossWidget; |
| 127 | CheckboxWidget* myDebugColorsWidget; |
| 128 | PopUpWidget* myDbgColour[DEBUG_COLORS]; |
| 129 | ColorWidget* myDbgColourSwatch[DEBUG_COLORS]; |
| 130 | |
| 131 | // States widgets |
| 132 | RadioButtonGroup* mySettingsGroupTM; |
| 133 | CheckboxWidget* myTimeMachineWidget; |
| 134 | SliderWidget* myStateSizeWidget; |
| 135 | SliderWidget* myUncompressedWidget; |
| 136 | PopUpWidget* myStateIntervalWidget; |
| 137 | PopUpWidget* myStateHorizonWidget; |
| 138 | RadioButtonGroup* mySaveOnExitGroup; |
| 139 | |
| 140 | #ifdef DEBUGGER_SUPPORT |
| 141 | // Debugger UI widgets |
| 142 | SliderWidget* myDebuggerWidthSlider; |
| 143 | SliderWidget* myDebuggerHeightSlider; |
| 144 | PopUpWidget* myDebuggerFontSize; |
| 145 | PopUpWidget* myDebuggerFontStyle; |
| 146 | CheckboxWidget* myGhostReadsTrapWidget; |
| 147 | #endif |
| 148 | |
| 149 | bool mySettings; |
| 150 | // Emulator sets |
| 151 | bool myFrameStats[2]; |
| 152 | int myConsole[2]; |
| 153 | bool myRandomBank[2]; |
| 154 | bool myRandomizeRAM[2]; |
| 155 | string myRandomizeCPU[2]; |
| 156 | bool myColorLoss[2]; |
| 157 | bool myTVJitter[2]; |
| 158 | int myTVJitterRec[2]; |
| 159 | bool myDebugColors[2]; |
| 160 | bool myUndrivenPins[2]; |
| 161 | #ifdef DEBUGGER_SUPPORT |
| 162 | bool myRWPortBreak[2]; |
| 163 | bool myWRPortBreak[2]; |
| 164 | #endif |
| 165 | bool myThumbException[2]; |
| 166 | bool myEEPROMAccess[2]; |
| 167 | // TIA sets |
| 168 | string myTIAType[2]; |
| 169 | bool myPlInvPhase[2]; |
| 170 | bool myMsInvPhase[2]; |
| 171 | bool myBlInvPhase[2]; |
| 172 | bool myPFBits[2]; |
| 173 | bool myPFColor[2]; |
| 174 | bool myPlSwap[2]; |
| 175 | bool myBlSwap[2]; |
| 176 | // States sets |
| 177 | bool myTimeMachine[2]; |
| 178 | int myStateSize[2]; |
| 179 | int myUncompressed[2]; |
| 180 | string myStateInterval[2]; |
| 181 | string myStateHorizon[2]; |
| 182 | |
| 183 | private: |
| 184 | void addEmulationTab(const GUI::Font& font); |
| 185 | void addTimeMachineTab(const GUI::Font& font); |
| 186 | void addTiaTab(const GUI::Font& font); |
| 187 | void addVideoTab(const GUI::Font& font); |
| 188 | void addDebuggerTab(const GUI::Font& font); |
| 189 | |
| 190 | void loadSettings(SettingsSet set); |
| 191 | void saveSettings(SettingsSet set); |
| 192 | void getWidgetStates(SettingsSet set); |
| 193 | void setWidgetStates(SettingsSet set); |
| 194 | |
| 195 | void handleSettings(bool devSettings); |
| 196 | void handleTVJitterChange(bool enable); |
| 197 | void handleEnableDebugColors(); |
| 198 | void handleConsole(); |
| 199 | |
| 200 | void handleTia(); |
| 201 | |
| 202 | void handleDebugColours(int cmd, int color); |
| 203 | void handleDebugColours(const string& colors); |
| 204 | |
| 205 | void handleTimeMachine(); |
| 206 | void handleSize(); |
| 207 | void handleUncompressed(); |
| 208 | void handleInterval(); |
| 209 | void handleHorizon(); |
| 210 | void handleFontSize(); |
| 211 | |
| 212 | // Following constructors and assignment operators not supported |
| 213 | DeveloperDialog() = delete; |
| 214 | DeveloperDialog(const DeveloperDialog&) = delete; |
| 215 | DeveloperDialog(DeveloperDialog&&) = delete; |
| 216 | DeveloperDialog& operator=(const DeveloperDialog&) = delete; |
| 217 | DeveloperDialog& operator=(DeveloperDialog&&) = delete; |
| 218 | }; |
| 219 | |
| 220 | #endif |
| 221 | |