Fixed bug in initial size for the debugger; it would sometimes try to use a size larger

than the desktop.

Some code cleanups; add const and optimize some methods.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3010 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2014-10-21 22:12:50 +00:00
parent 42dec8321d
commit f8be548312
13 changed files with 36 additions and 36 deletions

View File

@ -166,12 +166,17 @@ Debugger::~Debugger()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::initialize() void Debugger::initialize()
{ {
// Get the dialog size const GUI::Size& s = myOSystem->settings().getSize("dbg.res");
const GUI::Size& size = myOSystem->settings().getSize("dbg.res"); const GUI::Size& d = myOSystem->frameBuffer().desktopSize();
myWidth = BSPF_max(size.w, 0u); myWidth = s.w; myHeight = s.h;
myHeight = BSPF_max(size.h, 0u);
myWidth = BSPF_max(myWidth, (uInt32)DebuggerDialog::kSmallFontMinW); // 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); 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)); myOSystem->settings().setValue("dbg.res", GUI::Size(myWidth, myHeight));
delete myBaseDialog; myBaseDialog = myDialog = NULL; delete myBaseDialog; myBaseDialog = myDialog = NULL;

View File

@ -231,7 +231,7 @@ class Debugger : public DialogContainer
/* These are now exposed so Expressions can use them. */ /* These are now exposed so Expressions can use them. */
int peek(int addr) { return mySystem.peek(addr); } int peek(int addr) { return mySystem.peek(addr); }
int dpeek(int addr) { return mySystem.peek(addr) | (mySystem.peek(addr+1) << 8); } 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); } { return mySystem.getAccessFlags(addr); }
void setAccessFlags(uInt16 addr, uInt8 flags) void setAccessFlags(uInt16 addr, uInt8 flags)
{ mySystem.setAccessFlags(addr, flags); } { mySystem.setAccessFlags(addr, flags); }

View File

@ -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 if((address & 0x1800) == 0x1000) // 2K region from 0x1000 - 0x17ff
{ {

View File

@ -158,7 +158,7 @@ class Cartridge4A50 : public Cartridge
@param address The address to modify @param address The address to modify
@param flags A bitfield of DisasmType directives for the given address @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); void setAccessFlags(uInt16 address, uInt8 flags);
/** /**

View File

@ -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) + return myCodeAccessBase[(address & 0x07FF) +
myImageOffset[(address & 0x0800) ? 1 : 0]]; myImageOffset[(address & 0x0800) ? 1 : 0]];

View File

@ -174,7 +174,7 @@ class CartridgeAR : public Cartridge
@param address The address to modify @param address The address to modify
@param flags A bitfield of DisasmType directives for the given address @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); void setAccessFlags(uInt16 address, uInt8 flags);
// Handle a change to the bank configuration // Handle a change to the bank configuration

View File

@ -90,7 +90,7 @@ bool CartridgeFE::poke(uInt16, uInt8)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 CartridgeFE::getAccessFlags(uInt16 address) uInt8 CartridgeFE::getAccessFlags(uInt16 address) const
{ {
return myCodeAccessBase[(address & 0x0FFF) + return myCodeAccessBase[(address & 0x0FFF) +
(((address & 0x2000) == 0) ? 4096 : 0)]; (((address & 0x2000) == 0) ? 4096 : 0)];

View File

@ -177,7 +177,7 @@ class CartridgeFE : public Cartridge
@param address The address to modify @param address The address to modify
@param flags A bitfield of DisasmType directives for the given address @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); void setAccessFlags(uInt16 address, uInt8 flags);
private: private:

View File

@ -117,7 +117,7 @@ class Device : public Serializable
@param address The address to modify @param address The address to modify
@param flags A bitfield of DisasmType directives for the given address @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) { } virtual void setAccessFlags(uInt16 address, uInt8 flags) { }
protected: protected:

View File

@ -83,7 +83,7 @@ bool FrameBuffer::initialize()
// Check the 'maxres' setting, which is an undocumented developer feature // Check the 'maxres' setting, which is an undocumented developer feature
// that specifies the desktop size (not normally set) // that specifies the desktop size (not normally set)
const GUI::Size& s = myOSystem.settings().getSize("maxres"); const GUI::Size& s = myOSystem.settings().getSize("maxres");
if(s.w > 0 && s.h > 0) if(s.isValid())
{ {
query_w = s.w; query_w = s.w;
query_h = s.h; query_h = s.h;

View File

@ -241,7 +241,7 @@ void System::poke(uInt16 addr, uInt8 value)
{ {
uInt16 page = (addr & myAddressMask) >> myPageShift; uInt16 page = (addr & myAddressMask) >> myPageShift;
PageAccess& access = myPageAccessTable[page]; PageAccess& access = myPageAccessTable[page];
// See if this page uses direct accessing or not // See if this page uses direct accessing or not
if(access.directPokeBase) 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 #ifdef DEBUGGER_SUPPORT
PageAccess& access = myPageAccessTable[(addr & myAddressMask) >> myPageShift]; PageAccess& access = myPageAccessTable[(addr & myAddressMask) >> myPageShift];
@ -289,18 +289,6 @@ void System::setAccessFlags(uInt16 addr, uInt8 flags)
#endif #endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void System::lockDataBus()
{
myDataBusLocked = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void System::unlockDataBus()
{
myDataBusLocked = false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool System::save(Serializer& out) const bool System::save(Serializer& out) const
{ {

View File

@ -266,15 +266,15 @@ class System : public Serializable
use System.peek() to examine memory/registers without changing use System.peek() to examine memory/registers without changing
the state of the system. the state of the system.
*/ */
void lockDataBus(); void lockDataBus() { myDataBusLocked = true; }
void unlockDataBus(); void unlockDataBus() { myDataBusLocked = false; }
/** /**
Access and modify the disassembly type flags for the given Access and modify the disassembly type flags for the given
address. Note that while any flag can be used, the disassembly address. Note that while any flag can be used, the disassembly
only really acts on CODE/GFX/PGFX/DATA/ROW. only really acts on CODE/GFX/PGFX/DATA/ROW.
*/ */
uInt8 getAccessFlags(uInt16 address); uInt8 getAccessFlags(uInt16 address) const;
void setAccessFlags(uInt16 address, uInt8 flags); void setAccessFlags(uInt16 address, uInt8 flags);
public: public:

View File

@ -38,7 +38,7 @@ struct Point
int y; //!< The vertical part of the point int y; //!< The vertical part of the point
Point() : x(0), y(0) {}; 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) {}; explicit Point(int x1, int y1) : x(x1), y(y1) {};
Point(const string& p) { Point(const string& p) {
char c = '\0'; char c = '\0';
@ -64,7 +64,7 @@ struct Size
uInt32 h; //!< The height part of the size uInt32 h; //!< The height part of the size
Size() : w(0), h(0) {}; 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) {}; explicit Size(uInt32 w1, uInt32 h1) : w(w1), h(h1) {};
Size(const string& s) { Size(const string& s) {
char c = '\0'; char c = '\0';
@ -74,9 +74,15 @@ struct Size
if(c != 'x') if(c != 'x')
w = h = 0; w = h = 0;
} }
Size & operator=(const Size & s) { w = s.w; h = s.h; return *this; }; bool isValid() const { return w > 0 && h > 0; }
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; }; 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) { friend ostream& operator<<(ostream& os, const Size& s) {
os << s.w << "x" << s.h; 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). 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() : 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(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(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) Rect(uInt32 x1, uInt32 y1, uInt32 x2, uInt32 y2) : top(y1), left(x1), bottom(y2), right(x2)