Added specific dialog for changing Distella settings to disassembler.

This will eventually grow to include all relevant options in Distella.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2747 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2013-06-17 15:57:41 +00:00
parent 5cdd536a5a
commit c179a00725
16 changed files with 364 additions and 121 deletions

View File

@ -41,6 +41,12 @@
- Fixed labelling in ROW directives; it wasn't accurately setting - Fixed labelling in ROW directives; it wasn't accurately setting
a label in the case where it occurred in the middle of the data. a label in the case where it occurred in the middle of the data.
- Added a new dialog for changing Distella settings, located by
right-clicking the disassembly code.
- The commandline option 'dis.resolvedata' has been renamed to
'dis.resolve', with new usage (see manual for further details).
* Fixed regression in handling ZIP files (as compared to version 3.7.5) * Fixed regression in handling ZIP files (as compared to version 3.7.5)
created with newer versions of the ZIP program. Related to this, added created with newer versions of the ZIP program. Related to this, added
better error messages for invalid/missing/unreadable ROM files. better error messages for invalid/missing/unreadable ROM files.

View File

@ -98,6 +98,8 @@ CartDebug::CartDebug(Debugger& dbg, Console& console, const OSystem& osystem)
// Add settings for Distella // Add settings for Distella
DiStella::settings.gfx_format = DiStella::settings.gfx_format =
myOSystem.settings().getInt("dis.gfxformat") == 16 ? kBASE_16 : kBASE_2; myOSystem.settings().getInt("dis.gfxformat") == 16 ? kBASE_16 : kBASE_2;
DiStella::settings.resolve_code =
myOSystem.settings().getBool("dis.resolve");
DiStella::settings.show_addresses = DiStella::settings.show_addresses =
myOSystem.settings().getBool("dis.showaddr"); myOSystem.settings().getBool("dis.showaddr");
DiStella::settings.aflag = false; // Not currently configurable DiStella::settings.aflag = false; // Not currently configurable
@ -249,7 +251,7 @@ string CartDebug::toString()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDebug::disassemble(const string& resolvedata, bool force) bool CartDebug::disassemble(bool force)
{ {
// Test current disassembly; don't re-disassemble if it hasn't changed // Test current disassembly; don't re-disassemble if it hasn't changed
// Also check if the current PC is in the current list // Also check if the current PC is in the current list
@ -297,16 +299,15 @@ bool CartDebug::disassemble(const string& resolvedata, bool force)
addresses.push_back(PC); addresses.push_back(PC);
} }
// Check whether to use the 'resolvedata' functionality from Distella // Always attempt to resolve code sections unless it's been
if(resolvedata == "never") // specifically disabled
fillDisassemblyList(info, false, PC); bool found = fillDisassemblyList(info, PC);
else if(resolvedata == "always") if(!found && DiStella::settings.resolve_code)
fillDisassemblyList(info, true, PC);
else // 'auto'
{ {
// First try with resolvedata on, then turn off if PC isn't found // Temporarily turn off code resolution
if(!fillDisassemblyList(info, true, PC)) DiStella::settings.resolve_code = false;
fillDisassemblyList(info, false, PC); fillDisassemblyList(info, PC);
DiStella::settings.resolve_code = true;
} }
} }
@ -314,12 +315,12 @@ bool CartDebug::disassemble(const string& resolvedata, bool force)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDebug::fillDisassemblyList(BankInfo& info, bool resolvedata, uInt16 search) bool CartDebug::fillDisassemblyList(BankInfo& info, uInt16 search)
{ {
myDisassembly.list.clear(false); myDisassembly.list.clear(false);
myDisassembly.fieldwidth = 14 + myLabelLength; myDisassembly.fieldwidth = 14 + myLabelLength;
DiStella distella(*this, myDisassembly.list, info, DiStella::settings, DiStella distella(*this, myDisassembly.list, info, DiStella::settings,
myDisLabels, myDisDirectives, myReserved, resolvedata); myDisLabels, myDisDirectives, myReserved);
// Parts of the disassembly will be accessed later in different ways // Parts of the disassembly will be accessed later in different ways
// We place those parts in separate maps, to speed up access // We place those parts in separate maps, to speed up access
@ -954,6 +955,7 @@ string CartDebug::saveDisassembly()
// This will most likely differ from what you see in the debugger // This will most likely differ from what you see in the debugger
DiStella::Settings settings; DiStella::Settings settings;
settings.gfx_format = DiStella::settings.gfx_format; settings.gfx_format = DiStella::settings.gfx_format;
settings.resolve_code = true;
settings.show_addresses = false; settings.show_addresses = false;
settings.aflag = false; // Otherwise DASM gets confused settings.aflag = false; // Otherwise DASM gets confused
settings.fflag = DiStella::settings.fflag; settings.fflag = DiStella::settings.fflag;
@ -968,7 +970,7 @@ string CartDebug::saveDisassembly()
// Disassemble bank // Disassemble bank
disasm.list.clear(false); // don't fully de-allocate space disasm.list.clear(false); // don't fully de-allocate space
DiStella distella(*this, disasm.list, info, settings, DiStella distella(*this, disasm.list, info, settings,
myDisLabels, myDisDirectives, myReserved, true); myDisLabels, myDisDirectives, myReserved);
buf << " SEG CODE\n" buf << " SEG CODE\n"
<< " ORG $" << HEX4 << info.offset << "\n\n"; << " ORG $" << HEX4 << info.offset << "\n\n";

View File

@ -141,12 +141,11 @@ class CartDebug : public DebuggerSystem
Disassemble from the given address using the Distella disassembler Disassemble from the given address using the Distella disassembler
Address-to-label mappings (and vice-versa) are also determined here Address-to-label mappings (and vice-versa) are also determined here
@param resolvedata Whether to determine code vs data sections @param force Force a re-disassembly, even if the state hasn't changed
@param force Force a re-disassembly, even if the state hasn't changed
@return True if disassembly changed from previous call, else false @return True if disassembly changed from previous call, else false
*/ */
bool disassemble(const string& resolvedata, bool force = false); bool disassemble(bool force = false);
/** /**
Get the results from the most recent call to disassemble() Get the results from the most recent call to disassemble()
@ -330,7 +329,7 @@ class CartDebug : public DebuggerSystem
// Actually call DiStella to fill the DisassemblyList structure // Actually call DiStella to fill the DisassemblyList structure
// Return whether the search address was actually in the list // Return whether the search address was actually in the list
bool fillDisassemblyList(BankInfo& bankinfo, bool resolvedata, uInt16 search); bool fillDisassemblyList(BankInfo& bankinfo, uInt16 search);
// Analyze of bank of ROM, generating a list of Distella directives // Analyze of bank of ROM, generating a list of Distella directives
// based on its disassembly // based on its disassembly

View File

@ -25,7 +25,7 @@
DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list, DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
CartDebug::BankInfo& info, const DiStella::Settings& settings, CartDebug::BankInfo& info, const DiStella::Settings& settings,
uInt8* labels, uInt8* directives, uInt8* labels, uInt8* directives,
CartDebug::ReservedEquates& reserved, bool resolvedata) CartDebug::ReservedEquates& reserved)
: myDbg(dbg), : myDbg(dbg),
myList(list), myList(list),
mySettings(settings), mySettings(settings),
@ -40,6 +40,8 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
while(!myAddressQueue.empty()) while(!myAddressQueue.empty())
myAddressQueue.pop(); myAddressQueue.pop();
bool resolve_code = mySettings.resolve_code;
CartDebug::AddressList::iterator it = addresses.begin(); CartDebug::AddressList::iterator it = addresses.begin();
uInt16 start = *it++; uInt16 start = *it++;
@ -83,8 +85,8 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
info.end = myAppData.end = 0x00FF; info.end = myAppData.end = 0x00FF;
info.offset = myOffset = 0; info.offset = myOffset = 0;
// Resolve data is never used in ZP RAM mode // Resolve code is never used in ZP RAM mode
resolvedata = false; resolve_code = false;
} }
myAppData.length = info.size; myAppData.length = info.size;
@ -95,7 +97,7 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
// Process any directives first, as they override automatic code determination // Process any directives first, as they override automatic code determination
processDirectives(info.directiveList); processDirectives(info.directiveList);
if(resolvedata) if(resolve_code)
{ {
// After we've disassembled from all addresses in the address list, // After we've disassembled from all addresses in the address list,
// use all access points determined by Stella during emulation // use all access points determined by Stella during emulation
@ -1065,6 +1067,7 @@ void DiStella::processDirectives(const CartDebug::DirectiveList& directives)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DiStella::Settings DiStella::settings = { DiStella::Settings DiStella::settings = {
kBASE_2, // gfx_format kBASE_2, // gfx_format
true, // resolve_code (opposite of -d in Distella)
true, // show_addresses (not used externally; always off) true, // show_addresses (not used externally; always off)
false, // aflag (-a in Distella) false, // aflag (-a in Distella)
true, // fflag (-f in Distella) true, // fflag (-f in Distella)

View File

@ -46,6 +46,7 @@ class DiStella
// standalone Distella // standalone Distella
typedef struct { typedef struct {
BaseFormat gfx_format; BaseFormat gfx_format;
bool resolve_code; // Attempt to detect code vs. data sections
bool show_addresses; // Show PC addresses (always off for external output) bool show_addresses; // Show PC addresses (always off for external output)
bool aflag; // Turns 'A' off in accumulator instructions (-a in Distella) bool aflag; // Turns 'A' off in accumulator instructions (-a in Distella)
bool fflag; // Forces correct address length (-f in Distella) bool fflag; // Forces correct address length (-f in Distella)
@ -65,12 +66,11 @@ class DiStella
@param labels Array storing label info determined by Distella @param labels Array storing label info determined by Distella
@param directives Array storing directive info determined by Distella @param directives Array storing directive info determined by Distella
@param reserved The TIA/RIOT addresses referenced in the disassembled code @param reserved The TIA/RIOT addresses referenced in the disassembled code
@param resolvedata If enabled, try to determine code vs. data sections
*/ */
DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list, DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
CartDebug::BankInfo& info, const DiStella::Settings& settings, CartDebug::BankInfo& info, const DiStella::Settings& settings,
uInt8* labels, uInt8* directives, uInt8* labels, uInt8* directives,
CartDebug::ReservedEquates& reserved, bool resolvedata); CartDebug::ReservedEquates& reserved);
~DiStella(); ~DiStella();

View File

@ -0,0 +1,182 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id$
//============================================================================
#include "OSystem.hxx"
#include "FrameBuffer.hxx"
#include "Dialog.hxx"
#include "DialogContainer.hxx"
#include "RomListWidget.hxx"
#include "RomListSettings.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RomListSettings::RomListSettings(GuiObject* boss, const GUI::Font& font)
: Dialog(&boss->instance(), &boss->parent(), 0, 0, 16, 16),
CommandSender(boss),
_xorig(0),
_yorig(0)
{
const int buttonWidth = font.getStringWidth("RunTo PC @ current line") + 20,
buttonHeight = font.getLineHeight() + 4;
int xpos = 8, ypos = 8;
WidgetArray wid;
// Set PC to current line
ButtonWidget* setPC =
new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
"Set PC @ current line", RomListWidget::kSetPCCmd);
wid.push_back(setPC);
// RunTo PC on current line
ypos += buttonHeight + 4;
ButtonWidget* runtoPC =
new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
"RunTo PC @ current line", RomListWidget::kRuntoPCCmd);
wid.push_back(runtoPC);
// Re-disassemble
ypos += buttonHeight + 4;
ButtonWidget* disasm =
new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
"Re-disassemble", RomListWidget::kDisassembleCmd);
wid.push_back(disasm);
// Settings for Distella
xpos += 4; ypos += buttonHeight + 8;
myShowTentative = new CheckboxWidget(this, font, xpos, ypos,
"Show tentative code", RomListWidget::kTentativeCodeCmd);
wid.push_back(myShowTentative);
ypos += buttonHeight + 4;
myShowAddresses = new CheckboxWidget(this, font, xpos, ypos,
"Show PC addresses", RomListWidget::kPCAddressesCmd);
wid.push_back(myShowAddresses);
ypos += buttonHeight + 4;
myShowGFXBinary = new CheckboxWidget(this, font, xpos, ypos,
"Show GFX as binary", RomListWidget::kGfxAsBinaryCmd);
wid.push_back(myShowGFXBinary);
ypos += buttonHeight + 4;
myUseRelocation = new CheckboxWidget(this, font, xpos, ypos,
"Use address relocation", RomListWidget::kAddrRelocationCmd);
wid.push_back(myUseRelocation);
// Set real dimensions
_w = buttonWidth + 20;
_h = ypos + buttonHeight + 8;
addToFocusList(wid);
// We don't have a close/cancel button, but we still want the cancel
// event to be processed
processCancelWithoutWidget(true);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RomListSettings::~RomListSettings()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RomListSettings::show(uInt32 x, uInt32 y, int data)
{
_xorig = x;
_yorig = y;
_item = data;
open();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RomListSettings::center()
{
// Make sure the menu is exactly where it should be, in case the image
// offset has changed
const GUI::Rect& image = instance().frameBuffer().imageRect();
uInt32 x = image.x() + _xorig;
uInt32 y = image.y() + _yorig;
uInt32 tx = image.x() + image.width();
uInt32 ty = image.y() + image.height();
if(x + _w > tx) x -= (x + _w - tx);
if(y + _h > ty) y -= (y + _h - ty);
surface().setPos(x, y);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RomListSettings::loadConfig()
{
myShowTentative->setState(instance().settings().getBool("dis.resolve"));
myShowAddresses->setState(instance().settings().getBool("dis.showaddr"));
myShowGFXBinary->setState(instance().settings().getString("dis.gfxformat") == "2");
myUseRelocation->setState(instance().settings().getBool("dis.relocate"));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RomListSettings::handleMouseDown(int x, int y, int button, int clickCount)
{
// Close dialog if mouse click is outside it (simulates a context menu)
// Otherwise let the base dialog class process it
if(x >= 0 && x < _w && y >= 0 && y < _h)
Dialog::handleMouseDown(x, y, button, clickCount);
else
close();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RomListSettings::handleCommand(CommandSender* sender, int cmd, int data, int id)
{
// We remove the dialog when the user has selected an item
// Make sure the dialog is removed before sending any commands,
// since one consequence of sending a command may be to add another
// dialog/menu
close();
switch(cmd)
{
case RomListWidget::kSetPCCmd:
case RomListWidget::kRuntoPCCmd:
{
sendCommand(cmd, _item, -1);
break;
}
case RomListWidget::kDisassembleCmd:
{
sendCommand(cmd, -1, -1);
break;
}
case RomListWidget::kTentativeCodeCmd:
{
sendCommand(cmd, myShowTentative->getState(), -1);
break;
}
case RomListWidget::kPCAddressesCmd:
{
sendCommand(cmd, myShowAddresses->getState(), -1);
break;
}
case RomListWidget::kGfxAsBinaryCmd:
{
sendCommand(cmd, myShowGFXBinary->getState(), -1);
break;
}
case RomListWidget::kAddrRelocationCmd:
{
sendCommand(cmd, myUseRelocation->getState(), -1);
break;
}
}
}

View File

@ -0,0 +1,61 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id$
//============================================================================
#ifndef ROM_LIST_SETTINGS_HXX
#define ROM_LIST_SETTINGS_HXX
class CheckboxWidget;
class EditTextWidget;
#include "Command.hxx"
#include "Dialog.hxx"
/**
* A dialog which controls the settings for the RomListWidget.
* Currently, all Distella disassembler options are located here as well.
*/
class RomListSettings : public Dialog, public CommandSender
{
public:
RomListSettings(GuiObject* boss, const GUI::Font& font);
virtual ~RomListSettings();
/** Show dialog onscreen at the specified coordinates
('data' will be the currently selected line number in RomListWidget) */
void show(uInt32 x, uInt32 y, int data = -1);
/** This dialog uses its own positioning, so we override Dialog::center() */
void center();
private:
void loadConfig();
void handleMouseDown(int x, int y, int button, int clickCount);
void handleCommand(CommandSender* sender, int cmd, int data, int id);
private:
uInt32 _xorig, _yorig;
int _item; // currently selected line number in the disassembly list
CheckboxWidget* myShowTentative;
CheckboxWidget* myShowAddresses;
CheckboxWidget* myShowGFXBinary;
CheckboxWidget* myUseRelocation;
};
#endif

View File

@ -15,17 +15,14 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id$ // $Id$
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
//============================================================================ //============================================================================
#include "bspf.hxx" #include "bspf.hxx"
#include "Debugger.hxx" #include "Debugger.hxx"
#include "ContextMenu.hxx"
#include "PackedBitArray.hxx" #include "PackedBitArray.hxx"
#include "Widget.hxx" #include "Widget.hxx"
#include "ScrollBarWidget.hxx" #include "ScrollBarWidget.hxx"
#include "RomListSettings.hxx"
#include "RomListWidget.hxx" #include "RomListWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -59,18 +56,8 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& font,
myScrollBar = new ScrollBarWidget(boss, font, _x + _w, _y, kScrollBarWidth, _h); myScrollBar = new ScrollBarWidget(boss, font, _x + _w, _y, kScrollBarWidth, _h);
myScrollBar->setTarget(this); myScrollBar->setTarget(this);
// Add context menu // Add settings menu
VariantList l; myMenu = new RomListSettings(this, font);
// l.push_back("Add bookmark");
l.push_back("Set PC", "setpc");
l.push_back("RunTo PC", "runtopc");
l.push_back("Re-disassemble", "disasm");
l.push_back("-------------------------", "");
l.push_back("Show tentative code", "code");
l.push_back("Show PC addresses", "pcaddr");
l.push_back("Show GFX as binary", "gfx");
l.push_back("Use address relocation", "relocate");
myMenu = new ContextMenu(this, font, l);
// Take advantage of a wide debugger window when possible // Take advantage of a wide debugger window when possible
const int fontWidth = font.getMaxCharWidth(), const int fontWidth = font.getMaxCharWidth(),
@ -244,7 +231,7 @@ void RomListWidget::handleMouseDown(int x, int y, int button, int clickCount)
// Set selected and add menu at current x,y mouse location // Set selected and add menu at current x,y mouse location
_selectedItem = findItem(x, y); _selectedItem = findItem(x, y);
scrollToSelected(); scrollToSelected();
myMenu->show(x + getAbsX(), y + getAbsY()); myMenu->show(x + getAbsX(), y + getAbsY(), _selectedItem);
} }
else else
{ {
@ -405,7 +392,7 @@ void RomListWidget::handleCommand(CommandSender* sender, int cmd, int data, int
case kCheckActionCmd: case kCheckActionCmd:
// We let the parent class handle this // We let the parent class handle this
// Pass it as a kRLBreakpointChangedCmd command, since that's the intent // Pass it as a kRLBreakpointChangedCmd command, since that's the intent
sendCommand(RomListWidget::kBreakpointChangedCmd, sendCommand(RomListWidget::kBPointChangedCmd,
myCheckList[id]->getState(), _currentPos+id); myCheckList[id]->getState(), _currentPos+id);
break; break;
@ -416,6 +403,10 @@ void RomListWidget::handleCommand(CommandSender* sender, int cmd, int data, int
setDirty(); draw(); setDirty(); draw();
} }
break; break;
default:
// Let the parent class handle all other commands directly
sendCommand(cmd, data, id);
} }
} }

View File

@ -15,15 +15,12 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id$ // $Id$
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
//============================================================================ //============================================================================
#ifndef ROM_LIST_WIDGET_HXX #ifndef ROM_LIST_WIDGET_HXX
#define ROM_LIST_WIDGET_HXX #define ROM_LIST_WIDGET_HXX
class ContextMenu; class RomListSettings;
class ScrollBarWidget; class ScrollBarWidget;
class PackedBitArray; class PackedBitArray;
class CheckListWidget; class CheckListWidget;
@ -37,8 +34,15 @@ class RomListWidget : public EditableWidget
{ {
public: public:
enum { enum {
kBreakpointChangedCmd = 'RLbp', // click on the checkbox for a breakpoint kBPointChangedCmd = 'RLbp', // click on the checkbox for a breakpoint
kRomChangedCmd = 'RLpr' // ROM item data changed - 'data' will be item index kRomChangedCmd = 'RLpr', // 'data' will be disassembly line number
kSetPCCmd = 'STpc', // 'data' will be disassembly line number
kRuntoPCCmd = 'RTpc', // 'data' will be disassembly line number
kDisassembleCmd = 'REds',
kTentativeCodeCmd = 'TEcd', // 'data' will be boolean
kPCAddressesCmd = 'PCad', // 'data' will be boolean
kGfxAsBinaryCmd = 'GFXb', // 'data' will be boolean
kAddrRelocationCmd = 'ADre' // 'data' will be boolean
}; };
public: public:
@ -84,7 +88,7 @@ class RomListWidget : public EditableWidget
void scrollToCurrent(int item); void scrollToCurrent(int item);
private: private:
ContextMenu* myMenu; RomListSettings* myMenu;
ScrollBarWidget* myScrollBar; ScrollBarWidget* myScrollBar;
int _labelWidth; int _labelWidth;

View File

@ -15,9 +15,6 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id$ // $Id$
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
//============================================================================ //============================================================================
#include <sstream> #include <sstream>
@ -64,6 +61,7 @@ RomWidget::RomWidget(GuiObject* boss, const GUI::Font& font,
xpos = x; ypos += myBank->getHeight() + 4; xpos = x; ypos += myBank->getHeight() + 4;
myRomList = new RomListWidget(boss, font, xpos, ypos, _w - 4, _h - ypos - 2); myRomList = new RomListWidget(boss, font, xpos, ypos, _w - 4, _h - ypos - 2);
myRomList->setTarget(this);
addFocusWidget(myRomList); addFocusWidget(myRomList);
} }
@ -81,8 +79,7 @@ void RomWidget::loadConfig()
const CartState& oldstate = (CartState&) cart.getOldState(); const CartState& oldstate = (CartState&) cart.getOldState();
// Fill romlist the current bank of source or disassembly // Fill romlist the current bank of source or disassembly
myListIsDirty |= cart.disassemble("always", /*FIXME myResolveData->getSelectedTag().toString(),*/ myListIsDirty |= cart.disassemble(myListIsDirty);
myListIsDirty);
if(myListIsDirty) if(myListIsDirty)
{ {
myRomList->setList(cart.disassembly(), dbg.breakpoints()); myRomList->setList(cart.disassembly(), dbg.breakpoints());
@ -101,10 +98,9 @@ void RomWidget::loadConfig()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
{ {
cerr << cmd << " " << data << " " << id << endl;
switch(cmd) switch(cmd)
{ {
case RomListWidget::kBreakpointChangedCmd: case RomListWidget::kBPointChangedCmd:
// 'id' is the line in the disassemblylist to be accessed // 'id' is the line in the disassemblylist to be accessed
// 'data' is the state of the breakpoint at 'id' // 'data' is the state of the breakpoint at 'id'
setBreak(id, data); setBreak(id, data);
@ -119,67 +115,60 @@ cerr << cmd << " " << data << " " << id << endl;
patchROM(data, myRomList->getText()); patchROM(data, myRomList->getText());
break; break;
#if 0 case RomListWidget::kSetPCCmd:
case ContextMenu::kItemSelectedCmd: // 'data' is the line in the disassemblylist to be accessed
{ setPC(data);
const string& rmb = myRomList->myMenu->getSelectedTag().toString();
if(rmb == "setpc")
setPC(myRomList->getSelected());
else if(rmb == "runtopc")
runtoPC(myRomList->getSelected());
else if(rmb == "disasm")
invalidate();
else if(rmb == "pcaddr")
{
DiStella::settings.show_addresses = !DiStella::settings.show_addresses;
instance().settings().setValue("dis.showaddr",
DiStella::settings.show_addresses);
invalidate();
}
else if(rmb == "gfx")
{
if(DiStella::settings.gfx_format == kBASE_16)
{
DiStella::settings.gfx_format = kBASE_2;
instance().settings().setValue("dis.gfxformat", "2");
}
else
{
DiStella::settings.gfx_format = kBASE_16;
instance().settings().setValue("dis.gfxformat", "16");
}
invalidate();
}
else if(rmb == "relocate")
{
DiStella::settings.rflag = !DiStella::settings.rflag;
instance().settings().setValue("dis.relocate",
DiStella::settings.rflag);
invalidate();
}
break; // kCMenuItemSelectedCmd
}
case kResolveDataChanged:
instance().settings().setValue("dis.resolvedata", myResolveData->getSelectedTag());
invalidate();
loadConfig();
break; break;
case kRomNameEntered: case RomListWidget::kRuntoPCCmd:
// 'data' is the line in the disassemblylist to be accessed
runtoPC(data);
break;
case RomListWidget::kDisassembleCmd:
invalidate();
break;
case RomListWidget::kTentativeCodeCmd:
{ {
const string& rom = mySaveRom->getResult(); // 'data' is the boolean value
if(rom == "") DiStella::settings.resolve_code = data;
mySaveRom->setTitle("Invalid name"); instance().settings().setValue("dis.resolve",
DiStella::settings.resolve_code);
invalidate();
break;
}
case RomListWidget::kPCAddressesCmd:
// 'data' is the boolean value
DiStella::settings.show_addresses = data;
instance().settings().setValue("dis.showaddr",
DiStella::settings.show_addresses);
invalidate();
break;
case RomListWidget::kGfxAsBinaryCmd:
// 'data' is the boolean value
if(data)
{
DiStella::settings.gfx_format = kBASE_2;
instance().settings().setValue("dis.gfxformat", "2");
}
else else
{ {
saveROM(rom); DiStella::settings.gfx_format = kBASE_16;
dialog().close(); instance().settings().setValue("dis.gfxformat", "16");
} }
invalidate();
break;
case RomListWidget::kAddrRelocationCmd:
// 'data' is the boolean value
DiStella::settings.rflag = data;
instance().settings().setValue("dis.relocate",
DiStella::settings.rflag);
invalidate();
break; break;
}
#endif
} }
} }

View File

@ -15,9 +15,6 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id$ // $Id$
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
//============================================================================ //============================================================================
#ifndef ROM_WIDGET_HXX #ifndef ROM_WIDGET_HXX

View File

@ -8,6 +8,7 @@ MODULE_OBJS := \
src/debugger/gui/RiotWidget.o \ src/debugger/gui/RiotWidget.o \
src/debugger/gui/RomWidget.o \ src/debugger/gui/RomWidget.o \
src/debugger/gui/RomListWidget.o \ src/debugger/gui/RomListWidget.o \
src/debugger/gui/RomListSettings.o \
src/debugger/gui/TiaWidget.o \ src/debugger/gui/TiaWidget.o \
src/debugger/gui/TiaInfoWidget.o \ src/debugger/gui/TiaInfoWidget.o \
src/debugger/gui/TiaOutputWidget.o \ src/debugger/gui/TiaOutputWidget.o \

View File

@ -136,7 +136,7 @@ Settings::Settings(OSystem* osystem)
setExternal("maxres", ""); setExternal("maxres", "");
// Debugger disassembly options // Debugger disassembly options
setInternal("dis.resolvedata", "auto"); setInternal("dis.resolve", "true");
setInternal("dis.gfxformat", "2"); setInternal("dis.gfxformat", "2");
setInternal("dis.showaddr", "true"); setInternal("dis.showaddr", "true");
setInternal("dis.relocate", "false"); setInternal("dis.relocate", "false");
@ -437,12 +437,10 @@ void Settings::usage()
<< " The following options are meant for developers\n" << " The following options are meant for developers\n"
<< " Arguments are more fully explained in the manual\n" << " Arguments are more fully explained in the manual\n"
<< endl << endl
<< " -dis.resolvedata <never| Set automatic code vs. data determination in disassembler\n" << " -dis.resolve <1|0> Attempt to resolve code sections in disassembler\n"
<< " always|\n" << " -dis.gfxformat <2|16> Set base to use for displaying GFX sections in disassembler\n"
<< " auto>\n" << " -dis.showaddr <1|0> Show opcode addresses in disassembler\n"
<< " -dis.gfxformat <2|16> Set base to use for displaying GFX sections in disassembler\n" << " -dis.relocate <1|0> Relocate calls out of address range in disassembler\n"
<< " -dis.showaddr <1|0> Show opcode addresses in disassembler\n"
<< " -dis.relocate <1|0> Relocate calls out of address range in disassembler\n"
<< endl << endl
<< " -debuggerres <WxH> The resolution to use in debugger mode\n" << " -debuggerres <WxH> The resolution to use in debugger mode\n"
<< " -break <address> Set a breakpoint at 'address'\n" << " -break <address> Set a breakpoint at 'address'\n"

View File

@ -46,6 +46,7 @@ Dialog::Dialog(OSystem* instance, DialogContainer* parent,
_cancelWidget(0), _cancelWidget(0),
_visible(false), _visible(false),
_isBase(isBase), _isBase(isBase),
_processCancel(false),
_surface(0), _surface(0),
_tabID(0) _tabID(0)
{ {
@ -578,6 +579,13 @@ bool Dialog::handleNavEvent(Event::Type e)
_cancelWidget->handleEvent(Event::UISelect); _cancelWidget->handleEvent(Event::UISelect);
return true; return true;
} }
else if(_processCancel)
{
// Some dialogs want the ability to cancel without actually having
// a corresponding cancel button
close();
return true;
}
break; break;
default: default:

View File

@ -98,6 +98,8 @@ class Dialog : public GuiObject
const string& okText = "", const string& okText = "",
const string& cancelText = ""); const string& cancelText = "");
void processCancelWithoutWidget(bool state) { _processCancel = state; }
private: private:
void buildCurrentFocusList(int tabID = -1); void buildCurrentFocusList(int tabID = -1);
bool handleNavEvent(Event::Type e); bool handleNavEvent(Event::Type e);
@ -112,6 +114,7 @@ class Dialog : public GuiObject
Widget* _cancelWidget; Widget* _cancelWidget;
bool _visible; bool _visible;
bool _isBase; bool _isBase;
bool _processCancel;
private: private:
struct Focus { struct Focus {

View File

@ -26,7 +26,6 @@
class CommandSender; class CommandSender;
class CheckboxWidget; class CheckboxWidget;
class DialogContainer; class DialogContainer;
class EditTextWidget;
class PopUpWidget; class PopUpWidget;
class SliderWidget; class SliderWidget;
class StaticTextWidget; class StaticTextWidget;
@ -51,7 +50,7 @@ class VideoDialog : public Dialog
void handleFullscreenChange(bool enable); void handleFullscreenChange(bool enable);
void handleTVModeChange(NTSCFilter::Preset); void handleTVModeChange(NTSCFilter::Preset);
void loadTVAdjustables(NTSCFilter::Preset preset); void loadTVAdjustables(NTSCFilter::Preset preset);
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id); void handleCommand(CommandSender* sender, int cmd, int data, int id);
private: private:
TabWidget* myTab; TabWidget* myTab;