mirror of https://github.com/stella-emu/stella.git
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:
parent
5cdd536a5a
commit
c179a00725
|
@ -41,6 +41,12 @@
|
|||
- Fixed labelling in ROW directives; it wasn't accurately setting
|
||||
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)
|
||||
created with newer versions of the ZIP program. Related to this, added
|
||||
better error messages for invalid/missing/unreadable ROM files.
|
||||
|
|
|
@ -98,6 +98,8 @@ CartDebug::CartDebug(Debugger& dbg, Console& console, const OSystem& osystem)
|
|||
// Add settings for Distella
|
||||
DiStella::settings.gfx_format =
|
||||
myOSystem.settings().getInt("dis.gfxformat") == 16 ? kBASE_16 : kBASE_2;
|
||||
DiStella::settings.resolve_code =
|
||||
myOSystem.settings().getBool("dis.resolve");
|
||||
DiStella::settings.show_addresses =
|
||||
myOSystem.settings().getBool("dis.showaddr");
|
||||
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
|
||||
// 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);
|
||||
}
|
||||
|
||||
// Check whether to use the 'resolvedata' functionality from Distella
|
||||
if(resolvedata == "never")
|
||||
fillDisassemblyList(info, false, PC);
|
||||
else if(resolvedata == "always")
|
||||
fillDisassemblyList(info, true, PC);
|
||||
else // 'auto'
|
||||
// Always attempt to resolve code sections unless it's been
|
||||
// specifically disabled
|
||||
bool found = fillDisassemblyList(info, PC);
|
||||
if(!found && DiStella::settings.resolve_code)
|
||||
{
|
||||
// First try with resolvedata on, then turn off if PC isn't found
|
||||
if(!fillDisassemblyList(info, true, PC))
|
||||
fillDisassemblyList(info, false, PC);
|
||||
// Temporarily turn off code resolution
|
||||
DiStella::settings.resolve_code = false;
|
||||
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.fieldwidth = 14 + myLabelLength;
|
||||
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
|
||||
// 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
|
||||
DiStella::Settings settings;
|
||||
settings.gfx_format = DiStella::settings.gfx_format;
|
||||
settings.resolve_code = true;
|
||||
settings.show_addresses = false;
|
||||
settings.aflag = false; // Otherwise DASM gets confused
|
||||
settings.fflag = DiStella::settings.fflag;
|
||||
|
@ -968,7 +970,7 @@ string CartDebug::saveDisassembly()
|
|||
// Disassemble bank
|
||||
disasm.list.clear(false); // don't fully de-allocate space
|
||||
DiStella distella(*this, disasm.list, info, settings,
|
||||
myDisLabels, myDisDirectives, myReserved, true);
|
||||
myDisLabels, myDisDirectives, myReserved);
|
||||
|
||||
buf << " SEG CODE\n"
|
||||
<< " ORG $" << HEX4 << info.offset << "\n\n";
|
||||
|
|
|
@ -141,12 +141,11 @@ class CartDebug : public DebuggerSystem
|
|||
Disassemble from the given address using the Distella disassembler
|
||||
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
|
||||
|
||||
@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()
|
||||
|
@ -330,7 +329,7 @@ class CartDebug : public DebuggerSystem
|
|||
|
||||
// Actually call DiStella to fill the DisassemblyList structure
|
||||
// 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
|
||||
// based on its disassembly
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
|
||||
CartDebug::BankInfo& info, const DiStella::Settings& settings,
|
||||
uInt8* labels, uInt8* directives,
|
||||
CartDebug::ReservedEquates& reserved, bool resolvedata)
|
||||
CartDebug::ReservedEquates& reserved)
|
||||
: myDbg(dbg),
|
||||
myList(list),
|
||||
mySettings(settings),
|
||||
|
@ -40,6 +40,8 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
|
|||
while(!myAddressQueue.empty())
|
||||
myAddressQueue.pop();
|
||||
|
||||
bool resolve_code = mySettings.resolve_code;
|
||||
|
||||
CartDebug::AddressList::iterator it = addresses.begin();
|
||||
uInt16 start = *it++;
|
||||
|
||||
|
@ -83,8 +85,8 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
|
|||
info.end = myAppData.end = 0x00FF;
|
||||
info.offset = myOffset = 0;
|
||||
|
||||
// Resolve data is never used in ZP RAM mode
|
||||
resolvedata = false;
|
||||
// Resolve code is never used in ZP RAM mode
|
||||
resolve_code = false;
|
||||
}
|
||||
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
|
||||
processDirectives(info.directiveList);
|
||||
|
||||
if(resolvedata)
|
||||
if(resolve_code)
|
||||
{
|
||||
// After we've disassembled from all addresses in the address list,
|
||||
// use all access points determined by Stella during emulation
|
||||
|
@ -1065,6 +1067,7 @@ void DiStella::processDirectives(const CartDebug::DirectiveList& directives)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
DiStella::Settings DiStella::settings = {
|
||||
kBASE_2, // gfx_format
|
||||
true, // resolve_code (opposite of -d in Distella)
|
||||
true, // show_addresses (not used externally; always off)
|
||||
false, // aflag (-a in Distella)
|
||||
true, // fflag (-f in Distella)
|
||||
|
|
|
@ -46,6 +46,7 @@ class DiStella
|
|||
// standalone Distella
|
||||
typedef struct {
|
||||
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 aflag; // Turns 'A' off in accumulator instructions (-a 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 directives Array storing directive info determined by Distella
|
||||
@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,
|
||||
CartDebug::BankInfo& info, const DiStella::Settings& settings,
|
||||
uInt8* labels, uInt8* directives,
|
||||
CartDebug::ReservedEquates& reserved, bool resolvedata);
|
||||
CartDebug::ReservedEquates& reserved);
|
||||
|
||||
~DiStella();
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
|
@ -15,17 +15,14 @@
|
|||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
//============================================================================
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "Debugger.hxx"
|
||||
#include "ContextMenu.hxx"
|
||||
#include "PackedBitArray.hxx"
|
||||
#include "Widget.hxx"
|
||||
#include "ScrollBarWidget.hxx"
|
||||
#include "RomListSettings.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->setTarget(this);
|
||||
|
||||
// Add context menu
|
||||
VariantList l;
|
||||
// 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);
|
||||
// Add settings menu
|
||||
myMenu = new RomListSettings(this, font);
|
||||
|
||||
// Take advantage of a wide debugger window when possible
|
||||
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
|
||||
_selectedItem = findItem(x, y);
|
||||
scrollToSelected();
|
||||
myMenu->show(x + getAbsX(), y + getAbsY());
|
||||
myMenu->show(x + getAbsX(), y + getAbsY(), _selectedItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -405,7 +392,7 @@ void RomListWidget::handleCommand(CommandSender* sender, int cmd, int data, int
|
|||
case kCheckActionCmd:
|
||||
// We let the parent class handle this
|
||||
// Pass it as a kRLBreakpointChangedCmd command, since that's the intent
|
||||
sendCommand(RomListWidget::kBreakpointChangedCmd,
|
||||
sendCommand(RomListWidget::kBPointChangedCmd,
|
||||
myCheckList[id]->getState(), _currentPos+id);
|
||||
break;
|
||||
|
||||
|
@ -416,6 +403,10 @@ void RomListWidget::handleCommand(CommandSender* sender, int cmd, int data, int
|
|||
setDirty(); draw();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Let the parent class handle all other commands directly
|
||||
sendCommand(cmd, data, id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,15 +15,12 @@
|
|||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
//============================================================================
|
||||
|
||||
#ifndef ROM_LIST_WIDGET_HXX
|
||||
#define ROM_LIST_WIDGET_HXX
|
||||
|
||||
class ContextMenu;
|
||||
class RomListSettings;
|
||||
class ScrollBarWidget;
|
||||
class PackedBitArray;
|
||||
class CheckListWidget;
|
||||
|
@ -37,8 +34,15 @@ class RomListWidget : public EditableWidget
|
|||
{
|
||||
public:
|
||||
enum {
|
||||
kBreakpointChangedCmd = 'RLbp', // click on the checkbox for a breakpoint
|
||||
kRomChangedCmd = 'RLpr' // ROM item data changed - 'data' will be item index
|
||||
kBPointChangedCmd = 'RLbp', // click on the checkbox for a breakpoint
|
||||
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:
|
||||
|
@ -84,7 +88,7 @@ class RomListWidget : public EditableWidget
|
|||
void scrollToCurrent(int item);
|
||||
|
||||
private:
|
||||
ContextMenu* myMenu;
|
||||
RomListSettings* myMenu;
|
||||
ScrollBarWidget* myScrollBar;
|
||||
|
||||
int _labelWidth;
|
||||
|
|
|
@ -15,9 +15,6 @@
|
|||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
//============================================================================
|
||||
|
||||
#include <sstream>
|
||||
|
@ -64,6 +61,7 @@ RomWidget::RomWidget(GuiObject* boss, const GUI::Font& font,
|
|||
xpos = x; ypos += myBank->getHeight() + 4;
|
||||
|
||||
myRomList = new RomListWidget(boss, font, xpos, ypos, _w - 4, _h - ypos - 2);
|
||||
myRomList->setTarget(this);
|
||||
addFocusWidget(myRomList);
|
||||
}
|
||||
|
||||
|
@ -81,8 +79,7 @@ void RomWidget::loadConfig()
|
|||
const CartState& oldstate = (CartState&) cart.getOldState();
|
||||
|
||||
// Fill romlist the current bank of source or disassembly
|
||||
myListIsDirty |= cart.disassemble("always", /*FIXME myResolveData->getSelectedTag().toString(),*/
|
||||
myListIsDirty);
|
||||
myListIsDirty |= cart.disassemble(myListIsDirty);
|
||||
if(myListIsDirty)
|
||||
{
|
||||
myRomList->setList(cart.disassembly(), dbg.breakpoints());
|
||||
|
@ -101,10 +98,9 @@ void RomWidget::loadConfig()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
||||
{
|
||||
cerr << cmd << " " << data << " " << id << endl;
|
||||
switch(cmd)
|
||||
{
|
||||
case RomListWidget::kBreakpointChangedCmd:
|
||||
case RomListWidget::kBPointChangedCmd:
|
||||
// 'id' is the line in the disassemblylist to be accessed
|
||||
// 'data' is the state of the breakpoint at 'id'
|
||||
setBreak(id, data);
|
||||
|
@ -119,27 +115,41 @@ cerr << cmd << " " << data << " " << id << endl;
|
|||
patchROM(data, myRomList->getText());
|
||||
break;
|
||||
|
||||
#if 0
|
||||
case ContextMenu::kItemSelectedCmd:
|
||||
{
|
||||
const string& rmb = myRomList->myMenu->getSelectedTag().toString();
|
||||
case RomListWidget::kSetPCCmd:
|
||||
// 'data' is the line in the disassemblylist to be accessed
|
||||
setPC(data);
|
||||
break;
|
||||
|
||||
if(rmb == "setpc")
|
||||
setPC(myRomList->getSelected());
|
||||
else if(rmb == "runtopc")
|
||||
runtoPC(myRomList->getSelected());
|
||||
else if(rmb == "disasm")
|
||||
case RomListWidget::kRuntoPCCmd:
|
||||
// 'data' is the line in the disassemblylist to be accessed
|
||||
runtoPC(data);
|
||||
break;
|
||||
|
||||
case RomListWidget::kDisassembleCmd:
|
||||
invalidate();
|
||||
else if(rmb == "pcaddr")
|
||||
break;
|
||||
|
||||
case RomListWidget::kTentativeCodeCmd:
|
||||
{
|
||||
DiStella::settings.show_addresses = !DiStella::settings.show_addresses;
|
||||
// 'data' is the boolean value
|
||||
DiStella::settings.resolve_code = data;
|
||||
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();
|
||||
}
|
||||
else if(rmb == "gfx")
|
||||
{
|
||||
if(DiStella::settings.gfx_format == kBASE_16)
|
||||
break;
|
||||
|
||||
case RomListWidget::kGfxAsBinaryCmd:
|
||||
// 'data' is the boolean value
|
||||
if(data)
|
||||
{
|
||||
DiStella::settings.gfx_format = kBASE_2;
|
||||
instance().settings().setValue("dis.gfxformat", "2");
|
||||
|
@ -150,36 +160,15 @@ cerr << cmd << " " << data << " " << id << endl;
|
|||
instance().settings().setValue("dis.gfxformat", "16");
|
||||
}
|
||||
invalidate();
|
||||
}
|
||||
else if(rmb == "relocate")
|
||||
{
|
||||
DiStella::settings.rflag = !DiStella::settings.rflag;
|
||||
break;
|
||||
|
||||
case RomListWidget::kAddrRelocationCmd:
|
||||
// 'data' is the boolean value
|
||||
DiStella::settings.rflag = data;
|
||||
instance().settings().setValue("dis.relocate",
|
||||
DiStella::settings.rflag);
|
||||
invalidate();
|
||||
}
|
||||
break; // kCMenuItemSelectedCmd
|
||||
}
|
||||
|
||||
case kResolveDataChanged:
|
||||
instance().settings().setValue("dis.resolvedata", myResolveData->getSelectedTag());
|
||||
invalidate();
|
||||
loadConfig();
|
||||
break;
|
||||
|
||||
case kRomNameEntered:
|
||||
{
|
||||
const string& rom = mySaveRom->getResult();
|
||||
if(rom == "")
|
||||
mySaveRom->setTitle("Invalid name");
|
||||
else
|
||||
{
|
||||
saveROM(rom);
|
||||
dialog().close();
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,9 +15,6 @@
|
|||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
//============================================================================
|
||||
|
||||
#ifndef ROM_WIDGET_HXX
|
||||
|
|
|
@ -8,6 +8,7 @@ MODULE_OBJS := \
|
|||
src/debugger/gui/RiotWidget.o \
|
||||
src/debugger/gui/RomWidget.o \
|
||||
src/debugger/gui/RomListWidget.o \
|
||||
src/debugger/gui/RomListSettings.o \
|
||||
src/debugger/gui/TiaWidget.o \
|
||||
src/debugger/gui/TiaInfoWidget.o \
|
||||
src/debugger/gui/TiaOutputWidget.o \
|
||||
|
|
|
@ -136,7 +136,7 @@ Settings::Settings(OSystem* osystem)
|
|||
setExternal("maxres", "");
|
||||
|
||||
// Debugger disassembly options
|
||||
setInternal("dis.resolvedata", "auto");
|
||||
setInternal("dis.resolve", "true");
|
||||
setInternal("dis.gfxformat", "2");
|
||||
setInternal("dis.showaddr", "true");
|
||||
setInternal("dis.relocate", "false");
|
||||
|
@ -437,9 +437,7 @@ void Settings::usage()
|
|||
<< " The following options are meant for developers\n"
|
||||
<< " Arguments are more fully explained in the manual\n"
|
||||
<< endl
|
||||
<< " -dis.resolvedata <never| Set automatic code vs. data determination in disassembler\n"
|
||||
<< " always|\n"
|
||||
<< " auto>\n"
|
||||
<< " -dis.resolve <1|0> Attempt to resolve code sections in disassembler\n"
|
||||
<< " -dis.gfxformat <2|16> Set base to use for displaying GFX sections 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"
|
||||
|
|
|
@ -46,6 +46,7 @@ Dialog::Dialog(OSystem* instance, DialogContainer* parent,
|
|||
_cancelWidget(0),
|
||||
_visible(false),
|
||||
_isBase(isBase),
|
||||
_processCancel(false),
|
||||
_surface(0),
|
||||
_tabID(0)
|
||||
{
|
||||
|
@ -578,6 +579,13 @@ bool Dialog::handleNavEvent(Event::Type e)
|
|||
_cancelWidget->handleEvent(Event::UISelect);
|
||||
return true;
|
||||
}
|
||||
else if(_processCancel)
|
||||
{
|
||||
// Some dialogs want the ability to cancel without actually having
|
||||
// a corresponding cancel button
|
||||
close();
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -98,6 +98,8 @@ class Dialog : public GuiObject
|
|||
const string& okText = "",
|
||||
const string& cancelText = "");
|
||||
|
||||
void processCancelWithoutWidget(bool state) { _processCancel = state; }
|
||||
|
||||
private:
|
||||
void buildCurrentFocusList(int tabID = -1);
|
||||
bool handleNavEvent(Event::Type e);
|
||||
|
@ -112,6 +114,7 @@ class Dialog : public GuiObject
|
|||
Widget* _cancelWidget;
|
||||
bool _visible;
|
||||
bool _isBase;
|
||||
bool _processCancel;
|
||||
|
||||
private:
|
||||
struct Focus {
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
class CommandSender;
|
||||
class CheckboxWidget;
|
||||
class DialogContainer;
|
||||
class EditTextWidget;
|
||||
class PopUpWidget;
|
||||
class SliderWidget;
|
||||
class StaticTextWidget;
|
||||
|
@ -51,7 +50,7 @@ class VideoDialog : public Dialog
|
|||
void handleFullscreenChange(bool enable);
|
||||
void handleTVModeChange(NTSCFilter::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:
|
||||
TabWidget* myTab;
|
||||
|
|
Loading…
Reference in New Issue