| 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 CART_DEBUG_WIDGET_HXX | 
|---|
| 19 | #define CART_DEBUG_WIDGET_HXX | 
|---|
| 20 |  | 
|---|
| 21 | class GuiObject; | 
|---|
| 22 | class ButtonWidget; | 
|---|
| 23 | class StringListWidget; | 
|---|
| 24 |  | 
|---|
| 25 | namespace GUI { | 
|---|
| 26 | class Font; | 
|---|
| 27 | } | 
|---|
| 28 |  | 
|---|
| 29 | #include "Base.hxx"  // not needed here, but all child classes need it | 
|---|
| 30 | #include "Command.hxx" | 
|---|
| 31 | #include "Widget.hxx" | 
|---|
| 32 | #include "Debugger.hxx" | 
|---|
| 33 | #include "CartDebug.hxx" | 
|---|
| 34 |  | 
|---|
| 35 | class CartDebugWidget : public Widget, public CommandSender | 
|---|
| 36 | { | 
|---|
| 37 | public: | 
|---|
| 38 | CartDebugWidget(GuiObject* boss, const GUI::Font& lfont, | 
|---|
| 39 | const GUI::Font& nfont, | 
|---|
| 40 | int x, int y, int w, int h); | 
|---|
| 41 | virtual ~CartDebugWidget() = default; | 
|---|
| 42 |  | 
|---|
| 43 | public: | 
|---|
| 44 | int addBaseInformation(size_t bytes, const string& manufacturer, | 
|---|
| 45 | const string& desc, const uInt16 maxlines = 10); | 
|---|
| 46 |  | 
|---|
| 47 | // Inform the ROM Widget that the underlying cart has somehow changed | 
|---|
| 48 | void invalidate(); | 
|---|
| 49 |  | 
|---|
| 50 | // Some carts need to save old state in the debugger, so that we can | 
|---|
| 51 | // implement change tracking; most carts probably won't do anything here | 
|---|
| 52 | virtual void saveOldState() { } | 
|---|
| 53 |  | 
|---|
| 54 | virtual void loadConfig() override; | 
|---|
| 55 | virtual void handleCommand(CommandSender* sender, int cmd, int data, int id) override { } | 
|---|
| 56 |  | 
|---|
| 57 | // Query internal state of the cart (usually just bankswitching info) | 
|---|
| 58 | virtual string bankState() { return "0 (non-bankswitched)"; } | 
|---|
| 59 |  | 
|---|
| 60 | // To make the Cartridge RAM show up in the debugger, implement | 
|---|
| 61 | // the following 8 functions for cartridges with internal RAM | 
|---|
| 62 | virtual uInt32 internalRamSize() { return 0; } | 
|---|
| 63 | virtual uInt32 internalRamRPort(int start) { return 0; } | 
|---|
| 64 | virtual string internalRamDescription() { return EmptyString; } | 
|---|
| 65 | virtual const ByteArray& internalRamOld(int start, int count) { return myRamOld; } | 
|---|
| 66 | virtual const ByteArray& internalRamCurrent(int start, int count) { return myRamCurrent; } | 
|---|
| 67 | virtual void internalRamSetValue(int addr, uInt8 value) { } | 
|---|
| 68 | virtual uInt8 internalRamGetValue(int addr) { return 0; } | 
|---|
| 69 | virtual string internalRamLabel(int addr) { return "Not available/applicable"; } | 
|---|
| 70 |  | 
|---|
| 71 | protected: | 
|---|
| 72 | // Arrays used to hold current and previous internal RAM values | 
|---|
| 73 | ByteArray myRamOld, myRamCurrent; | 
|---|
| 74 |  | 
|---|
| 75 | // Font used for 'normal' text; _font is for 'label' text | 
|---|
| 76 | const GUI::Font& _nfont; | 
|---|
| 77 |  | 
|---|
| 78 | // These will be needed by most of the child classes; | 
|---|
| 79 | // we may as well make them protected variables | 
|---|
| 80 | int myFontWidth, myFontHeight, myLineHeight, myButtonHeight; | 
|---|
| 81 |  | 
|---|
| 82 | ostringstream& buffer() { myBuffer.str( ""); return myBuffer; } | 
|---|
| 83 |  | 
|---|
| 84 | private: | 
|---|
| 85 | StringListWidget* myDesc; | 
|---|
| 86 | ostringstream myBuffer; | 
|---|
| 87 |  | 
|---|
| 88 | private: | 
|---|
| 89 | // Following constructors and assignment operators not supported | 
|---|
| 90 | CartDebugWidget() = delete; | 
|---|
| 91 | CartDebugWidget(const CartDebugWidget&) = delete; | 
|---|
| 92 | CartDebugWidget(CartDebugWidget&&) = delete; | 
|---|
| 93 | CartDebugWidget& operator=(const CartDebugWidget&) = delete; | 
|---|
| 94 | CartDebugWidget& operator=(CartDebugWidget&&) = delete; | 
|---|
| 95 | }; | 
|---|
| 96 |  | 
|---|
| 97 | #endif | 
|---|
| 98 |  | 
|---|