Merge pull request #182 from mjbudd77/master
Added Qt RAM Watch Window Feature
This commit is contained in:
commit
50d789f4f5
2
TODO-SDL
2
TODO-SDL
|
@ -39,7 +39,7 @@ Movie record/save/play functionality | YES | YES
|
|||
Cheat search window | YES | YES |
|
||||
Active Cheat window | YES | YES |
|
||||
RAM Search Window | NO | NO |
|
||||
RAM Watch Window | NO | YES |
|
||||
RAM Watch Window | YES | YES |
|
||||
Memory Watch Window | NO | NO |
|
||||
TAS Editor | NO | NO |
|
||||
6502 Debugger Window | YES | YES |
|
||||
|
|
|
@ -444,6 +444,7 @@ set(SRC_DRIVERS_SDL
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/fceuWrapper.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ppuViewer.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/NameTableViewer.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/RamWatch.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/config.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/input.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/nes_shm.cpp
|
||||
|
|
|
@ -36,14 +36,6 @@ GuiCheatsDialog_t::GuiCheatsDialog_t(QWidget *parent)
|
|||
QLabel *lbl;
|
||||
QGroupBox *groupBox;
|
||||
QFrame *frame;
|
||||
QScreen *screen = QGuiApplication::primaryScreen();
|
||||
double devPixRatio = 1.0f;
|
||||
|
||||
if ( screen != NULL )
|
||||
{
|
||||
devPixRatio = (int)( screen->devicePixelRatio() + 0.50f);
|
||||
//printf("Pix Ratio: %f \n", devPixRatio );
|
||||
}
|
||||
|
||||
font.setFamily("Courier New");
|
||||
font.setStyle( QFont::StyleNormal );
|
||||
|
@ -51,8 +43,11 @@ GuiCheatsDialog_t::GuiCheatsDialog_t(QWidget *parent)
|
|||
|
||||
QFontMetrics fm(font);
|
||||
|
||||
//fontCharWidth = fm.boundingRect('X').width() * devPixRatio;
|
||||
fontCharWidth = 2.00 * fm.averageCharWidth() * devPixRatio;
|
||||
#if QT_VERSION > QT_VERSION_CHECK(5, 11, 0)
|
||||
fontCharWidth = 2 * fm.horizontalAdvance(QLatin1Char('2'));
|
||||
#else
|
||||
fontCharWidth = 2 * fm.width(QLatin1Char('2'));
|
||||
#endif
|
||||
|
||||
setWindowTitle("Cheat Search");
|
||||
|
||||
|
@ -644,6 +639,7 @@ int GuiCheatsDialog_t::activeCheatListCB (char *name, uint32 a, uint8 v, int c,
|
|||
|
||||
item->setTextAlignment( 0, Qt::AlignLeft);
|
||||
item->setTextAlignment( 1, Qt::AlignLeft);
|
||||
item->setTextAlignment( 2, Qt::AlignLeft);
|
||||
|
||||
actvCheatIdx++;
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "Qt/fceuWrapper.h"
|
||||
#include "Qt/ppuViewer.h"
|
||||
#include "Qt/NameTableViewer.h"
|
||||
#include "Qt/RamWatch.h"
|
||||
#include "Qt/keyscan.h"
|
||||
#include "Qt/nes_shm.h"
|
||||
|
||||
|
@ -483,6 +484,14 @@ void consoleWin_t::createMainMenu(void)
|
|||
|
||||
toolsMenu->addAction(cheatsAct);
|
||||
|
||||
// Tools -> RAM Watch
|
||||
ramWatchAct = new QAction(tr("RAM Watch..."), this);
|
||||
//ramWatchAct->setShortcut( QKeySequence(tr("Shift+F7")));
|
||||
ramWatchAct->setStatusTip(tr("Open RAM Watch Window"));
|
||||
connect(ramWatchAct, SIGNAL(triggered()), this, SLOT(openRamWatch(void)) );
|
||||
|
||||
toolsMenu->addAction(ramWatchAct);
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// Debug
|
||||
debugMenu = menuBar()->addMenu(tr("Debug"));
|
||||
|
@ -1017,6 +1026,17 @@ void consoleWin_t::openCheats(void)
|
|||
cheatWin->show();
|
||||
}
|
||||
|
||||
void consoleWin_t::openRamWatch(void)
|
||||
{
|
||||
RamWatchDialog_t *ramWatchWin;
|
||||
|
||||
//printf("Open GUI RAM Watch Window\n");
|
||||
|
||||
ramWatchWin = new RamWatchDialog_t(this);
|
||||
|
||||
ramWatchWin->show();
|
||||
}
|
||||
|
||||
void consoleWin_t::openDebugWindow(void)
|
||||
{
|
||||
ConsoleDebugger *debugWin;
|
||||
|
|
|
@ -89,6 +89,7 @@ class consoleWin_t : public QMainWindow
|
|||
QAction *fdsEjectAct;
|
||||
QAction *fdsLoadBiosAct;
|
||||
QAction *cheatsAct;
|
||||
QAction *ramWatchAct;
|
||||
QAction *debuggerAct;
|
||||
QAction *codeDataLogAct;
|
||||
QAction *traceLogAct;
|
||||
|
@ -167,6 +168,7 @@ class consoleWin_t : public QMainWindow
|
|||
void openPPUViewer(void);
|
||||
void openNTViewer(void);
|
||||
void openCheats(void);
|
||||
void openRamWatch(void);
|
||||
void openMovie(void);
|
||||
void stopMovie(void);
|
||||
void recordMovie(void);
|
||||
|
|
|
@ -44,7 +44,9 @@ static class NTCache
|
|||
public:
|
||||
NTCache(void)
|
||||
: curr_vnapage(0)
|
||||
{}
|
||||
{
|
||||
memset( cache, 0, sizeof(cache) );
|
||||
}
|
||||
|
||||
uint8_t* curr_vnapage;
|
||||
uint8_t cache[0x400];
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,256 @@
|
|||
// RamWatch.h
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <list>
|
||||
#include <QWidget>
|
||||
#include <QDialog>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QComboBox>
|
||||
#include <QCheckBox>
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include <QFrame>
|
||||
#include <QGroupBox>
|
||||
#include <QTreeView>
|
||||
#include <QTreeWidget>
|
||||
|
||||
#include "Qt/main.h"
|
||||
|
||||
struct ramWatch_t
|
||||
{
|
||||
std::string name;
|
||||
int addr;
|
||||
int type;
|
||||
int size;
|
||||
int isSep;
|
||||
|
||||
union
|
||||
{
|
||||
int8_t i8;
|
||||
uint8_t u8;
|
||||
int16_t i16;
|
||||
uint16_t u16;
|
||||
int32_t i32;
|
||||
uint32_t u32;
|
||||
} val;
|
||||
|
||||
ramWatch_t (void)
|
||||
{
|
||||
addr = 0;
|
||||
type = 's';
|
||||
size = 0;
|
||||
isSep = 0;
|
||||
val.u32 = 0;
|
||||
};
|
||||
|
||||
void updateMem (void);
|
||||
};
|
||||
|
||||
struct ramWatchList_t
|
||||
{
|
||||
|
||||
std::list <ramWatch_t*> ls;
|
||||
|
||||
ramWatchList_t (void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
~ramWatchList_t (void)
|
||||
{
|
||||
ramWatch_t *rw;
|
||||
|
||||
while (!ls.empty ())
|
||||
{
|
||||
rw = ls.front ();
|
||||
|
||||
delete rw;
|
||||
|
||||
ls.pop_front ();
|
||||
}
|
||||
}
|
||||
|
||||
size_t size (void)
|
||||
{
|
||||
return ls.size ();
|
||||
};
|
||||
|
||||
void clear(void)
|
||||
{
|
||||
ramWatch_t *rw;
|
||||
|
||||
while (!ls.empty ())
|
||||
{
|
||||
rw = ls.front ();
|
||||
|
||||
delete rw;
|
||||
|
||||
ls.pop_front ();
|
||||
}
|
||||
}
|
||||
|
||||
void add_entry (const char *name, int addr, int type, int size, int isSep = 0)
|
||||
{
|
||||
ramWatch_t *rw = new ramWatch_t;
|
||||
|
||||
rw->name.assign (name);
|
||||
rw->addr = addr;
|
||||
rw->type = type;
|
||||
rw->size = size;
|
||||
rw->isSep = isSep;
|
||||
ls.push_back (rw);
|
||||
}
|
||||
|
||||
void updateMemoryValues (void)
|
||||
{
|
||||
ramWatch_t *rw;
|
||||
std::list < ramWatch_t * >::iterator it;
|
||||
|
||||
for (it = ls.begin (); it != ls.end (); it++)
|
||||
{
|
||||
rw = *it;
|
||||
|
||||
rw->updateMem ();
|
||||
}
|
||||
}
|
||||
|
||||
ramWatch_t *getIndex (size_t idx)
|
||||
{
|
||||
size_t i = 0;
|
||||
std::list < ramWatch_t * >::iterator it;
|
||||
|
||||
for (it = ls.begin (); it != ls.end (); it++)
|
||||
{
|
||||
if (i == idx)
|
||||
{
|
||||
return *it;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int deleteIndex (size_t idx)
|
||||
{
|
||||
size_t i = 0;
|
||||
std::list < ramWatch_t * >::iterator it;
|
||||
|
||||
for (it = ls.begin (); it != ls.end (); it++)
|
||||
{
|
||||
if (i == idx)
|
||||
{
|
||||
delete *it;
|
||||
ls.erase (it);
|
||||
return 0;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int moveIndexUp(size_t idx)
|
||||
{
|
||||
size_t i = 0;
|
||||
std::list < ramWatch_t * >::iterator it, lp;
|
||||
|
||||
lp = ls.begin();
|
||||
|
||||
for (it = ls.begin (); it != ls.end (); it++)
|
||||
{
|
||||
if (i == idx)
|
||||
{
|
||||
ls.insert( lp, *it );
|
||||
ls.erase (it);
|
||||
return 0;
|
||||
}
|
||||
lp = it;
|
||||
|
||||
i++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int moveIndexDown(size_t idx)
|
||||
{
|
||||
size_t i = 0;
|
||||
std::list < ramWatch_t * >::iterator it, next;
|
||||
|
||||
for (it = ls.begin (); it != ls.end (); it++)
|
||||
{
|
||||
if (i == idx)
|
||||
{
|
||||
next = it; next++;
|
||||
|
||||
if ( next != ls.end() )
|
||||
{
|
||||
ls.insert( it, *next );
|
||||
ls.erase (next);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
class RamWatchDialog_t : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RamWatchDialog_t(QWidget *parent = 0);
|
||||
~RamWatchDialog_t(void);
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void loadWatchFile (const char *filename, int append = 0);
|
||||
void saveWatchFile (const char *filename, int append = 0);
|
||||
|
||||
QFont font;
|
||||
QTreeWidget *tree;
|
||||
QPushButton *up_btn;
|
||||
QPushButton *down_btn;
|
||||
QPushButton *edit_btn;
|
||||
QPushButton *del_btn;
|
||||
QPushButton *new_btn;
|
||||
QPushButton *dup_btn;
|
||||
QPushButton *sep_btn;
|
||||
QPushButton *cht_btn;
|
||||
QTimer *updateTimer;
|
||||
|
||||
std::string saveFileName;
|
||||
|
||||
//ramWatchList_t ramWatchList;
|
||||
|
||||
int fontCharWidth;
|
||||
|
||||
private:
|
||||
void updateRamWatchDisplay(void);
|
||||
void openWatchEditWindow( ramWatch_t *rw = NULL, int mode = 0);
|
||||
|
||||
public slots:
|
||||
void closeWindow(void);
|
||||
private slots:
|
||||
void newListCB(void);
|
||||
void openListCB(void);
|
||||
void saveListCB(void);
|
||||
void saveListAs(void);
|
||||
void appendListCB(void);
|
||||
void periodicUpdate(void);
|
||||
void addCheatClicked(void);
|
||||
void newWatchClicked(void);
|
||||
void sepWatchClicked(void);
|
||||
void dupWatchClicked(void);
|
||||
void editWatchClicked(void);
|
||||
void removeWatchClicked(void);
|
||||
void moveWatchUpClicked(void);
|
||||
void moveWatchDownClicked(void);
|
||||
void watchClicked( QTreeWidgetItem *item, int column);
|
||||
|
||||
};
|
||||
|
||||
extern ramWatchList_t ramWatchList;
|
|
@ -659,6 +659,9 @@ int traceRecord_t::convToText( char *txt )
|
|||
char stmp[128];
|
||||
char str_axystate[32], str_procstatus[32];
|
||||
|
||||
str_axystate[0] = 0;
|
||||
str_procstatus[0] = 0;
|
||||
|
||||
txt[0] = 0;
|
||||
if ( opSize == 0 )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue