mirror of https://github.com/stella-emu/stella.git
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:
parent
42dec8321d
commit
f8be548312
|
@ -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;
|
||||
|
|
|
@ -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); }
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
||||
/**
|
||||
|
|
|
@ -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]];
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)];
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue