mirror of https://github.com/stella-emu/stella.git
Added ability to patch ROM from the RomListWidget. Currently the
changes aren't immediately seen, but this will be fixed when the DebuggerParser/loadConfig() infrastructure is complete. Implemented 'Set PC' in RomListWidget, with the same restrictions as above. Removed 'Add bookmark' and 'Patch ROM', since the former can't be done with more infrastructure work, and the latter is done by double-clicking a line (no need for two ways of doing the same thing). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@772 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
f79b0a0f82
commit
17352bb0e9
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: RomListWidget.cxx,v 1.3 2005-09-01 19:14:09 stephena Exp $
|
||||
// $Id: RomListWidget.cxx,v 1.4 2005-09-07 18:34:52 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -24,7 +24,7 @@
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& font,
|
||||
int x, int y, int w, int h)
|
||||
int x, int y, int w, int h)
|
||||
: CheckListWidget(boss, font, x, y, w, h),
|
||||
myMenu(NULL),
|
||||
myHighlightedItem(-1)
|
||||
|
@ -33,10 +33,8 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& font,
|
|||
myMenu = new ContextMenu(this, font);
|
||||
|
||||
StringList l;
|
||||
l.push_back("Add bookmark");
|
||||
l.push_back("Patch ROM");
|
||||
// l.push_back("Add bookmark");
|
||||
l.push_back("Save ROM");
|
||||
l.push_back("Set Breakpoint");
|
||||
l.push_back("Set PC");
|
||||
|
||||
myMenu->setList(l);
|
||||
|
@ -74,21 +72,6 @@ void RomListWidget::handleMouseDown(int x, int y, int button, int clickCount)
|
|||
ListWidget::handleMouseDown(x, y, button, clickCount);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void RomListWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
||||
{
|
||||
switch(cmd)
|
||||
{
|
||||
case kCMenuItemSelectedCmd:
|
||||
cerr << "RMB selected: " << myMenu->getSelectedString() << endl;
|
||||
break;
|
||||
|
||||
default:
|
||||
ListWidget::handleCommand(sender, cmd, data, id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void RomListWidget::drawWidget(bool hilite)
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: RomListWidget.hxx,v 1.3 2005-09-01 19:14:09 stephena Exp $
|
||||
// $Id: RomListWidget.hxx,v 1.4 2005-09-07 18:34:52 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -31,6 +31,8 @@ class ContextMenu;
|
|||
/** RomListWidget */
|
||||
class RomListWidget : public CheckListWidget
|
||||
{
|
||||
friend class RomWidget;
|
||||
|
||||
public:
|
||||
RomListWidget(GuiObject* boss, const GUI::Font& font,
|
||||
int x, int y, int w, int h);
|
||||
|
@ -41,7 +43,6 @@ class RomListWidget : public CheckListWidget
|
|||
|
||||
protected:
|
||||
void handleMouseDown(int x, int y, int button, int clickCount);
|
||||
void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
||||
|
||||
void drawWidget(bool hilite);
|
||||
GUI::Rect getLineRect() const;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: RomWidget.cxx,v 1.2 2005-09-01 19:14:09 stephena Exp $
|
||||
// $Id: RomWidget.cxx,v 1.3 2005-09-07 18:34:52 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -22,8 +22,10 @@
|
|||
#include <sstream>
|
||||
|
||||
#include "Debugger.hxx"
|
||||
#include "DebuggerParser.hxx"
|
||||
#include "CpuDebug.hxx"
|
||||
#include "GuiObject.hxx"
|
||||
#include "ContextMenu.hxx"
|
||||
#include "RomListWidget.hxx"
|
||||
#include "RomWidget.hxx"
|
||||
|
||||
|
@ -40,6 +42,7 @@ RomWidget::RomWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
|
|||
|
||||
myRomList = new RomListWidget(boss, font, x, y, w, h);
|
||||
myRomList->setTarget(this);
|
||||
myRomList->myMenu->setTarget(this);
|
||||
myRomList->setStyle(kSolidFill);
|
||||
addFocusWidget(myRomList);
|
||||
|
||||
|
@ -65,15 +68,21 @@ void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
|||
break;
|
||||
|
||||
case kListItemChecked:
|
||||
setBreak(data);
|
||||
break;
|
||||
|
||||
case kListItemDataChangedCmd:
|
||||
patchROM(data, myRomList->getSelectedString());
|
||||
break;
|
||||
|
||||
case kCMenuItemSelectedCmd:
|
||||
{
|
||||
// We don't care about state, as breakpoints are turned on
|
||||
// and off with the same command
|
||||
// FIXME - at some point, we might want to add 'breakon'
|
||||
// and 'breakoff' to DebuggerParser, so the states
|
||||
// don't get out of sync
|
||||
ostringstream cmd;
|
||||
cmd << "break #" << myAddrList[data];
|
||||
instance()->debugger().run(cmd.str());
|
||||
const string& rmb = myRomList->myMenu->getSelectedString();
|
||||
|
||||
if(rmb == "Save ROM")
|
||||
saveROM();
|
||||
else if(rmb == "Set PC")
|
||||
setPC(myRomList->getSelected());
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -83,9 +92,10 @@ void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void RomWidget::loadConfig()
|
||||
{
|
||||
//cerr << "RomWidget::loadConfig()\n";
|
||||
// Only reload full bank when necessary
|
||||
if(myFirstLoad || myCurrentBank != instance()->debugger().getBank())
|
||||
// if(myFirstLoad || myCurrentBank != instance()->debugger().getBank())
|
||||
// FIXME - always do a full reload for now, will optimize later
|
||||
if(true)
|
||||
{
|
||||
initialUpdate();
|
||||
myFirstLoad = false;
|
||||
|
@ -139,3 +149,48 @@ void RomWidget::initialUpdate()
|
|||
void RomWidget::incrementalUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void RomWidget::setBreak(int data)
|
||||
{
|
||||
// We don't care about state, as breakpoints are turned on
|
||||
// and off with the same command
|
||||
// FIXME - at some point, we might want to add 'breakon'
|
||||
// and 'breakoff' to DebuggerParser, so the states
|
||||
// don't get out of sync
|
||||
ostringstream command;
|
||||
command << "break #" << myAddrList[data];
|
||||
instance()->debugger().run(command.str());
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void RomWidget::setPC(int data)
|
||||
{
|
||||
ostringstream command;
|
||||
command << "pc #" << myAddrList[data];
|
||||
instance()->debugger().run(command.str());
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void RomWidget::patchROM(int data, const string& bytes)
|
||||
{
|
||||
ostringstream command;
|
||||
|
||||
// Temporarily set to base 16, since that's the format the disassembled
|
||||
// byte string is in. This eliminates the need to prefix each byte with
|
||||
// a '$' character
|
||||
BaseFormat oldbase = instance()->debugger().parser()->base();
|
||||
instance()->debugger().parser()->setBase(kBASE_16);
|
||||
|
||||
command << "rom #" << myAddrList[data] << " " << bytes;
|
||||
instance()->debugger().run(command.str());
|
||||
|
||||
// Restore previous base
|
||||
instance()->debugger().parser()->setBase(oldbase);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void RomWidget::saveROM()
|
||||
{
|
||||
cerr << "save ROM\n";
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: RomWidget.hxx,v 1.1 2005-08-30 17:51:26 stephena Exp $
|
||||
// $Id: RomWidget.hxx,v 1.2 2005-09-07 18:34:52 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -49,6 +49,11 @@ class RomWidget : public Widget, public CommandSender
|
|||
void initialUpdate();
|
||||
void incrementalUpdate();
|
||||
|
||||
void setBreak(int data);
|
||||
void setPC(int data);
|
||||
void patchROM(int data, const string& bytes);
|
||||
void saveROM();
|
||||
|
||||
private:
|
||||
RomListWidget* myRomList;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: ListWidget.cxx,v 1.29 2005-08-26 16:44:17 stephena Exp $
|
||||
// $Id: ListWidget.cxx,v 1.30 2005-09-07 18:34:52 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -97,8 +97,6 @@ void ListWidget::setHighlighted(int item)
|
|||
abortEditMode();
|
||||
|
||||
_highlightedItem = item;
|
||||
// FIXME - don't know if we need to send a signal
|
||||
//sendCommand(kListSelectionChangedCmd, _selectedItem, _id);
|
||||
|
||||
// Only scroll the list if we're about to pass the page boundary
|
||||
if(_currentPos == 0)
|
||||
|
@ -124,8 +122,6 @@ void ListWidget::scrollTo(int item)
|
|||
_currentPos = item;
|
||||
scrollBarRecalc();
|
||||
}
|
||||
|
||||
setDirty(); draw();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -149,6 +145,8 @@ void ListWidget::scrollBarRecalc()
|
|||
_scrollBar->_entriesPerPage = _rows;
|
||||
_scrollBar->_currentPos = _currentPos;
|
||||
_scrollBar->recalc();
|
||||
|
||||
setDirty(); draw();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
Loading…
Reference in New Issue