diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx index 62ee95a74..b8c8ffe97 100644 --- a/src/debugger/Debugger.cxx +++ b/src/debugger/Debugger.cxx @@ -166,12 +166,17 @@ Debugger::~Debugger() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Debugger::initialize() { - // Get the dialog size - const GUI::Size& size = myOSystem->settings().getSize("dbg.res"); - myWidth = BSPF_max(size.w, 0u); - myHeight = BSPF_max(size.h, 0u); - myWidth = BSPF_max(myWidth, (uInt32)DebuggerDialog::kSmallFontMinW); + const GUI::Size& s = myOSystem->settings().getSize("dbg.res"); + const GUI::Size& d = myOSystem->frameBuffer().desktopSize(); + myWidth = s.w; myHeight = s.h; + + // The debugger dialog is resizable, within certain bounds + // We check those bounds now + myWidth = BSPF_max(myWidth, (uInt32)DebuggerDialog::kSmallFontMinW); myHeight = BSPF_max(myHeight, (uInt32)DebuggerDialog::kSmallFontMinH); + myWidth = BSPF_min(myWidth, (uInt32)d.w); + myHeight = BSPF_min(myHeight, (uInt32)d.h); + myOSystem->settings().setValue("dbg.res", GUI::Size(myWidth, myHeight)); delete myBaseDialog; myBaseDialog = myDialog = NULL; diff --git a/src/debugger/Debugger.hxx b/src/debugger/Debugger.hxx index 9d9731bd8..e39a8d4a2 100644 --- a/src/debugger/Debugger.hxx +++ b/src/debugger/Debugger.hxx @@ -231,7 +231,7 @@ class Debugger : public DialogContainer /* These are now exposed so Expressions can use them. */ int peek(int addr) { return mySystem.peek(addr); } int dpeek(int addr) { return mySystem.peek(addr) | (mySystem.peek(addr+1) << 8); } - int getAccessFlags(uInt16 addr) + int getAccessFlags(uInt16 addr) const { return mySystem.getAccessFlags(addr); } void setAccessFlags(uInt16 addr, uInt8 flags) { mySystem.setAccessFlags(addr, flags); } diff --git a/src/emucore/Cart4A50.cxx b/src/emucore/Cart4A50.cxx index 84083c5e4..4acf2e145 100644 --- a/src/emucore/Cart4A50.cxx +++ b/src/emucore/Cart4A50.cxx @@ -203,7 +203,7 @@ bool Cartridge4A50::poke(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -uInt8 Cartridge4A50::getAccessFlags(uInt16 address) +uInt8 Cartridge4A50::getAccessFlags(uInt16 address) const { if((address & 0x1800) == 0x1000) // 2K region from 0x1000 - 0x17ff { diff --git a/src/emucore/Cart4A50.hxx b/src/emucore/Cart4A50.hxx index be2472d06..9780059c3 100644 --- a/src/emucore/Cart4A50.hxx +++ b/src/emucore/Cart4A50.hxx @@ -158,7 +158,7 @@ class Cartridge4A50 : public Cartridge @param address The address to modify @param flags A bitfield of DisasmType directives for the given address */ - uInt8 getAccessFlags(uInt16 address); + uInt8 getAccessFlags(uInt16 address) const; void setAccessFlags(uInt16 address, uInt8 flags); /** diff --git a/src/emucore/CartAR.cxx b/src/emucore/CartAR.cxx index 4db90365d..bad5d93a7 100644 --- a/src/emucore/CartAR.cxx +++ b/src/emucore/CartAR.cxx @@ -223,7 +223,7 @@ bool CartridgeAR::poke(uInt16 addr, uInt8) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -uInt8 CartridgeAR::getAccessFlags(uInt16 address) +uInt8 CartridgeAR::getAccessFlags(uInt16 address) const { return myCodeAccessBase[(address & 0x07FF) + myImageOffset[(address & 0x0800) ? 1 : 0]]; diff --git a/src/emucore/CartAR.hxx b/src/emucore/CartAR.hxx index f8dc646a9..3ee230a3d 100644 --- a/src/emucore/CartAR.hxx +++ b/src/emucore/CartAR.hxx @@ -174,7 +174,7 @@ class CartridgeAR : public Cartridge @param address The address to modify @param flags A bitfield of DisasmType directives for the given address */ - uInt8 getAccessFlags(uInt16 address); + uInt8 getAccessFlags(uInt16 address) const; void setAccessFlags(uInt16 address, uInt8 flags); // Handle a change to the bank configuration diff --git a/src/emucore/CartFE.cxx b/src/emucore/CartFE.cxx index 7035c185c..b962c538c 100644 --- a/src/emucore/CartFE.cxx +++ b/src/emucore/CartFE.cxx @@ -90,7 +90,7 @@ bool CartridgeFE::poke(uInt16, uInt8) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -uInt8 CartridgeFE::getAccessFlags(uInt16 address) +uInt8 CartridgeFE::getAccessFlags(uInt16 address) const { return myCodeAccessBase[(address & 0x0FFF) + (((address & 0x2000) == 0) ? 4096 : 0)]; diff --git a/src/emucore/CartFE.hxx b/src/emucore/CartFE.hxx index 969702975..6fdddc4ae 100644 --- a/src/emucore/CartFE.hxx +++ b/src/emucore/CartFE.hxx @@ -177,7 +177,7 @@ class CartridgeFE : public Cartridge @param address The address to modify @param flags A bitfield of DisasmType directives for the given address */ - uInt8 getAccessFlags(uInt16 address); + uInt8 getAccessFlags(uInt16 address) const; void setAccessFlags(uInt16 address, uInt8 flags); private: diff --git a/src/emucore/Device.hxx b/src/emucore/Device.hxx index 51aaa65f4..f8ccf53b6 100644 --- a/src/emucore/Device.hxx +++ b/src/emucore/Device.hxx @@ -117,7 +117,7 @@ class Device : public Serializable @param address The address to modify @param flags A bitfield of DisasmType directives for the given address */ - virtual uInt8 getAccessFlags(uInt16 address) { return 0; } + virtual uInt8 getAccessFlags(uInt16 address) const { return 0; } virtual void setAccessFlags(uInt16 address, uInt8 flags) { } protected: diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx index 31c30ca09..7d686018b 100644 --- a/src/emucore/FrameBuffer.cxx +++ b/src/emucore/FrameBuffer.cxx @@ -83,7 +83,7 @@ bool FrameBuffer::initialize() // Check the 'maxres' setting, which is an undocumented developer feature // that specifies the desktop size (not normally set) const GUI::Size& s = myOSystem.settings().getSize("maxres"); - if(s.w > 0 && s.h > 0) + if(s.isValid()) { query_w = s.w; query_h = s.h; diff --git a/src/emucore/System.cxx b/src/emucore/System.cxx index c5b1f3f15..c9a4e47f6 100644 --- a/src/emucore/System.cxx +++ b/src/emucore/System.cxx @@ -241,7 +241,7 @@ void System::poke(uInt16 addr, uInt8 value) { uInt16 page = (addr & myAddressMask) >> myPageShift; PageAccess& access = myPageAccessTable[page]; - + // See if this page uses direct accessing or not if(access.directPokeBase) { @@ -262,7 +262,7 @@ void System::poke(uInt16 addr, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -uInt8 System::getAccessFlags(uInt16 addr) +uInt8 System::getAccessFlags(uInt16 addr) const { #ifdef DEBUGGER_SUPPORT PageAccess& access = myPageAccessTable[(addr & myAddressMask) >> myPageShift]; @@ -289,18 +289,6 @@ void System::setAccessFlags(uInt16 addr, uInt8 flags) #endif } -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void System::lockDataBus() -{ - myDataBusLocked = true; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void System::unlockDataBus() -{ - myDataBusLocked = false; -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool System::save(Serializer& out) const { diff --git a/src/emucore/System.hxx b/src/emucore/System.hxx index f073f1f88..b04386055 100644 --- a/src/emucore/System.hxx +++ b/src/emucore/System.hxx @@ -266,15 +266,15 @@ class System : public Serializable use System.peek() to examine memory/registers without changing the state of the system. */ - void lockDataBus(); - void unlockDataBus(); + void lockDataBus() { myDataBusLocked = true; } + void unlockDataBus() { myDataBusLocked = false; } /** Access and modify the disassembly type flags for the given address. Note that while any flag can be used, the disassembly only really acts on CODE/GFX/PGFX/DATA/ROW. */ - uInt8 getAccessFlags(uInt16 address); + uInt8 getAccessFlags(uInt16 address) const; void setAccessFlags(uInt16 address, uInt8 flags); public: diff --git a/src/gui/Rect.hxx b/src/gui/Rect.hxx index 09195c0f5..7c65c30bc 100644 --- a/src/gui/Rect.hxx +++ b/src/gui/Rect.hxx @@ -38,7 +38,7 @@ struct Point int y; //!< The vertical part of the point Point() : x(0), y(0) {}; - Point(const Point & p) : x(p.x), y(p.y) {}; + Point(const Point& p) : x(p.x), y(p.y) {}; explicit Point(int x1, int y1) : x(x1), y(y1) {}; Point(const string& p) { char c = '\0'; @@ -64,7 +64,7 @@ struct Size uInt32 h; //!< The height part of the size Size() : w(0), h(0) {}; - Size(const Size & s) : w(s.w), h(s.h) {}; + Size(const Size& s) : w(s.w), h(s.h) {}; explicit Size(uInt32 w1, uInt32 h1) : w(w1), h(h1) {}; Size(const string& s) { char c = '\0'; @@ -74,9 +74,15 @@ struct Size if(c != 'x') w = h = 0; } - Size & operator=(const Size & s) { w = s.w; h = s.h; return *this; }; - bool operator==(const Size & s) const { return w == s.w && h == s.h; }; - bool operator!=(const Size & s) const { return w != s.w || h != s.h; }; + bool isValid() const { return w > 0 && h > 0; } + + Size& operator=(const Size& s) { w = s.w; h = s.h; return *this; }; + bool operator==(const Size& s) const { return w == s.w && h == s.h; }; + bool operator!=(const Size& s) const { return w != s.w || h != s.h; }; + bool operator<(const Size& s) const { return w < s.w && h < s.h; }; + bool operator<=(const Size& s) const { return w <= s.w && h <= s.h; }; + bool operator>(const Size& s) const { return w > s.w && h > s.h; }; + bool operator>=(const Size& s) const { return w >= s.w && h >= s.h; }; friend ostream& operator<<(ostream& os, const Size& s) { os << s.w << "x" << s.h; @@ -107,6 +113,7 @@ struct Rect uInt32 bottom, right; //!< The point at the bottom right of the rectangle (not part of the rect). Rect() : top(0), left(0), bottom(0), right(0) {} + Rect(const Rect& s) : top(s.top), left(s.left), bottom(s.bottom), right(s.right) {} Rect(uInt32 w, uInt32 h) : top(0), left(0), bottom(h), right(w) {} Rect(const Point& p, uInt32 w, uInt32 h) : top(p.y), left(p.x), bottom(h), right(w) {} Rect(uInt32 x1, uInt32 y1, uInt32 x2, uInt32 y2) : top(y1), left(x1), bottom(y2), right(x2)