Added initial functions for hex editor quick access from debugger.
This commit is contained in:
parent
3099a233c3
commit
c2ca5dc9d8
|
@ -38,6 +38,7 @@
|
||||||
#include "Qt/config.h"
|
#include "Qt/config.h"
|
||||||
#include "Qt/nes_shm.h"
|
#include "Qt/nes_shm.h"
|
||||||
#include "Qt/fceuWrapper.h"
|
#include "Qt/fceuWrapper.h"
|
||||||
|
#include "Qt/HexEditor.h"
|
||||||
#include "Qt/ConsoleDebugger.h"
|
#include "Qt/ConsoleDebugger.h"
|
||||||
#include "Qt/ConsoleUtilities.h"
|
#include "Qt/ConsoleUtilities.h"
|
||||||
|
|
||||||
|
@ -1604,6 +1605,26 @@ void ConsoleDebugger::asmViewCtxMenuAddBM(void)
|
||||||
bmListUpdate(false);
|
bmListUpdate(false);
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
void ConsoleDebugger::asmViewCtxMenuOpenHexEdit(void)
|
||||||
|
{
|
||||||
|
int romAddr = -1;
|
||||||
|
int addr = asmView->getCtxMenuAddr();
|
||||||
|
|
||||||
|
if (addr >= 0x8000)
|
||||||
|
{
|
||||||
|
romAddr = GetNesFileAddress(addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( romAddr >= 0 )
|
||||||
|
{
|
||||||
|
hexEditorOpenFromDebugger( QHexEdit::MODE_NES_ROM, romAddr );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hexEditorOpenFromDebugger( QHexEdit::MODE_NES_RAM, addr );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
void ConsoleDebugger::setBookmarkSelectedAddress( int addr )
|
void ConsoleDebugger::setBookmarkSelectedAddress( int addr )
|
||||||
{
|
{
|
||||||
char stmp[32];
|
char stmp[32];
|
||||||
|
@ -2957,6 +2978,10 @@ void QAsmView::contextMenuEvent(QContextMenuEvent *event)
|
||||||
menu.addAction(act);
|
menu.addAction(act);
|
||||||
connect( act, SIGNAL(triggered(void)), parent, SLOT(asmViewCtxMenuAddBM(void)) );
|
connect( act, SIGNAL(triggered(void)), parent, SLOT(asmViewCtxMenuAddBM(void)) );
|
||||||
|
|
||||||
|
act = new QAction(tr("Open Hex Editor"), this);
|
||||||
|
menu.addAction(act);
|
||||||
|
connect( act, SIGNAL(triggered(void)), parent, SLOT(asmViewCtxMenuOpenHexEdit(void)) );
|
||||||
|
|
||||||
menu.exec(event->globalPos());
|
menu.exec(event->globalPos());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,6 +237,7 @@ class ConsoleDebugger : public QDialog
|
||||||
void asmViewCtxMenuAddBP(void);
|
void asmViewCtxMenuAddBP(void);
|
||||||
void asmViewCtxMenuAddBM(void);
|
void asmViewCtxMenuAddBM(void);
|
||||||
void asmViewCtxMenuAddSym(void);
|
void asmViewCtxMenuAddSym(void);
|
||||||
|
void asmViewCtxMenuOpenHexEdit(void);
|
||||||
private slots:
|
private slots:
|
||||||
void updatePeriodic(void);
|
void updatePeriodic(void);
|
||||||
void hbarChanged(int value);
|
void hbarChanged(int value);
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "Qt/fceuWrapper.h"
|
#include "Qt/fceuWrapper.h"
|
||||||
#include "Qt/HexEditor.h"
|
#include "Qt/HexEditor.h"
|
||||||
#include "Qt/ConsoleUtilities.h"
|
#include "Qt/ConsoleUtilities.h"
|
||||||
|
#include "Qt/ConsoleWindow.h"
|
||||||
|
|
||||||
static HexBookMarkManager_t hbm;
|
static HexBookMarkManager_t hbm;
|
||||||
static std::list <HexEditorDialog_t*> winList;
|
static std::list <HexEditorDialog_t*> winList;
|
||||||
|
@ -1928,3 +1929,30 @@ void hexEditorSaveBookmarks(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
int hexEditorNumWindows(void)
|
||||||
|
{
|
||||||
|
return winList.size();
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
int hexEditorOpenFromDebugger( int mode, int addr )
|
||||||
|
{
|
||||||
|
HexEditorDialog_t *win = NULL;
|
||||||
|
|
||||||
|
if ( winList.size() > 0 )
|
||||||
|
{
|
||||||
|
win = winList.front();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( win == NULL )
|
||||||
|
{
|
||||||
|
win = new HexEditorDialog_t(consoleWindow);
|
||||||
|
|
||||||
|
win->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
win->editor->setMode( mode );
|
||||||
|
win->editor->setAddr( addr );
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
|
@ -195,13 +195,14 @@ class HexEditorDialog_t : public QDialog
|
||||||
|
|
||||||
void gotoAddress(int newAddr);
|
void gotoAddress(int newAddr);
|
||||||
void populateBookmarkMenu(void);
|
void populateBookmarkMenu(void);
|
||||||
|
|
||||||
|
QHexEdit *editor;
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void closeEvent(QCloseEvent *bar);
|
void closeEvent(QCloseEvent *bar);
|
||||||
|
|
||||||
QScrollBar *vbar;
|
QScrollBar *vbar;
|
||||||
QScrollBar *hbar;
|
QScrollBar *hbar;
|
||||||
QHexEdit *editor;
|
|
||||||
QTimer *periodicTimer;
|
QTimer *periodicTimer;
|
||||||
QMenu *bookmarkMenu;
|
QMenu *bookmarkMenu;
|
||||||
|
|
||||||
|
@ -227,5 +228,7 @@ class HexEditorDialog_t : public QDialog
|
||||||
void removeAllBookmarks(void);
|
void removeAllBookmarks(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int hexEditorNumWindows(void);
|
||||||
void hexEditorLoadBookmarks(void);
|
void hexEditorLoadBookmarks(void);
|
||||||
void hexEditorSaveBookmarks(void);
|
void hexEditorSaveBookmarks(void);
|
||||||
|
int hexEditorOpenFromDebugger( int mode, int addr );
|
||||||
|
|
Loading…
Reference in New Issue