Added initial file for Qt name table viewer
This commit is contained in:
parent
b31a2131b4
commit
1f12627c8f
|
@ -442,6 +442,7 @@ set(SRC_DRIVERS_SDL
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/AboutWindow.cpp
|
||||
${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/config.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/input.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/nes_shm.cpp
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "Qt/AboutWindow.h"
|
||||
#include "Qt/fceuWrapper.h"
|
||||
#include "Qt/ppuViewer.h"
|
||||
#include "Qt/NameTableViewer.h"
|
||||
#include "Qt/keyscan.h"
|
||||
#include "Qt/nes_shm.h"
|
||||
|
||||
|
@ -510,6 +511,14 @@ void consoleWin_t::createMainMenu(void)
|
|||
|
||||
debugMenu->addAction(ppuViewAct);
|
||||
|
||||
// Debug -> Name Table Viewer
|
||||
ntViewAct = new QAction(tr("Name Table Viewer..."), this);
|
||||
//ntViewAct->setShortcut( QKeySequence(tr("Shift+F7")));
|
||||
ntViewAct->setStatusTip(tr("Open Name Table Viewer"));
|
||||
connect(ntViewAct, SIGNAL(triggered()), this, SLOT(openNTViewer(void)) );
|
||||
|
||||
debugMenu->addAction(ntViewAct);
|
||||
|
||||
// Debug -> Trace Logger
|
||||
traceLogAct = new QAction(tr("Trace Logger..."), this);
|
||||
//traceLogAct->setShortcut( QKeySequence(tr("Shift+F7")));
|
||||
|
@ -1037,6 +1046,13 @@ void consoleWin_t::openPPUViewer(void)
|
|||
openPPUViewWindow(this);
|
||||
}
|
||||
|
||||
void consoleWin_t::openNTViewer(void)
|
||||
{
|
||||
//printf("Open GUI Name Table Viewer Window\n");
|
||||
|
||||
openNameTableViewWindow(this);
|
||||
}
|
||||
|
||||
void consoleWin_t::openCodeDataLogger(void)
|
||||
{
|
||||
CodeDataLoggerDialog_t *cdlWin;
|
||||
|
|
|
@ -94,6 +94,7 @@ class consoleWin_t : public QMainWindow
|
|||
QAction *traceLogAct;
|
||||
QAction *hexEditAct;
|
||||
QAction *ppuViewAct;
|
||||
QAction *ntViewAct;
|
||||
QAction *openMovAct;
|
||||
QAction *stopMovAct;
|
||||
QAction *recMovAct;
|
||||
|
@ -164,6 +165,7 @@ class consoleWin_t : public QMainWindow
|
|||
void fdsEjectDisk(void);
|
||||
void fdsLoadBiosFile(void);
|
||||
void openPPUViewer(void);
|
||||
void openNTViewer(void);
|
||||
void openCheats(void);
|
||||
void openMovie(void);
|
||||
void stopMovie(void);
|
||||
|
|
|
@ -0,0 +1,133 @@
|
|||
// NameTableViewer.cpp
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QPainter>
|
||||
#include <QInputDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "../../types.h"
|
||||
#include "../../fceu.h"
|
||||
#include "../../cart.h"
|
||||
#include "../../ppu.h"
|
||||
#include "../../debug.h"
|
||||
#include "../../palette.h"
|
||||
|
||||
#include "Qt/NameTableViewer.h"
|
||||
#include "Qt/main.h"
|
||||
#include "Qt/dface.h"
|
||||
#include "Qt/input.h"
|
||||
#include "Qt/config.h"
|
||||
#include "Qt/fceuWrapper.h"
|
||||
|
||||
static ppuNameTableViewerDialog_t *nameTableViewWindow = NULL;
|
||||
|
||||
//----------------------------------------------------
|
||||
int openNameTableViewWindow( QWidget *parent )
|
||||
{
|
||||
if ( nameTableViewWindow != NULL )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
nameTableViewWindow = new ppuNameTableViewerDialog_t(parent);
|
||||
|
||||
nameTableViewWindow->show();
|
||||
|
||||
return 0;
|
||||
}
|
||||
//----------------------------------------------------
|
||||
ppuNameTableViewerDialog_t::ppuNameTableViewerDialog_t(QWidget *parent)
|
||||
: QDialog( parent )
|
||||
{
|
||||
QVBoxLayout *mainLayout, *vbox;
|
||||
QHBoxLayout *hbox;
|
||||
QGridLayout *grid;
|
||||
char stmp[64];
|
||||
|
||||
nameTableViewWindow = this;
|
||||
|
||||
setWindowTitle( tr("Name Table Viewer") );
|
||||
|
||||
mainLayout = new QVBoxLayout();
|
||||
|
||||
setLayout( mainLayout );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
ppuNameTableViewerDialog_t::~ppuNameTableViewerDialog_t(void)
|
||||
{
|
||||
nameTableViewWindow = NULL;
|
||||
|
||||
printf("Name Table Viewer Window Deleted\n");
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ppuNameTableViewerDialog_t::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
printf("Name Table Viewer Close Window Event\n");
|
||||
done(0);
|
||||
deleteLater();
|
||||
event->accept();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ppuNameTableViewerDialog_t::closeWindow(void)
|
||||
{
|
||||
printf("Close Window\n");
|
||||
done(0);
|
||||
deleteLater();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
ppuNameTableView_t::ppuNameTableView_t(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
this->setFocusPolicy(Qt::StrongFocus);
|
||||
this->setMouseTracking(true);
|
||||
setMinimumWidth( 256 );
|
||||
setMinimumHeight( 256 );
|
||||
viewWidth = 256;
|
||||
viewHeight = 256;
|
||||
}
|
||||
//----------------------------------------------------
|
||||
ppuNameTableView_t::~ppuNameTableView_t(void)
|
||||
{
|
||||
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ppuNameTableView_t::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
viewWidth = event->size().width();
|
||||
viewHeight = event->size().height();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ppuNameTableView_t::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
//QPoint tile = convPixToTile( event->pos() );
|
||||
|
||||
//if ( (tile.x() < 16) && (tile.y() < 16) )
|
||||
//{
|
||||
// char stmp[64];
|
||||
// sprintf( stmp, "Tile: $%X%X", tile.y(), tile.x() );
|
||||
// tileLabel->setText( tr(stmp) );
|
||||
//}
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void ppuNameTableView_t::mousePressEvent(QMouseEvent * event)
|
||||
{
|
||||
//QPoint tile = convPixToTile( event->pos() );
|
||||
|
||||
if ( event->button() == Qt::LeftButton )
|
||||
{
|
||||
}
|
||||
else if ( event->button() == Qt::RightButton )
|
||||
{
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ppuNameTableView_t::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QPainter painter(this);
|
||||
viewWidth = event->rect().width();
|
||||
viewHeight = event->rect().height();
|
||||
|
||||
}
|
||||
//----------------------------------------------------
|
|
@ -0,0 +1,73 @@
|
|||
// NameTableViewer.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include <QDialog>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QComboBox>
|
||||
#include <QCheckBox>
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include <QFrame>
|
||||
#include <QTimer>
|
||||
#include <QSlider>
|
||||
#include <QLineEdit>
|
||||
#include <QGroupBox>
|
||||
#include <QCloseEvent>
|
||||
|
||||
struct ppuNameTable_t
|
||||
{
|
||||
struct
|
||||
{
|
||||
struct
|
||||
{
|
||||
QColor color;
|
||||
} pixel[8][8];
|
||||
|
||||
int x;
|
||||
int y;
|
||||
|
||||
} tile[30][32];
|
||||
|
||||
int w;
|
||||
int h;
|
||||
};
|
||||
|
||||
class ppuNameTableView_t : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ppuNameTableView_t( QWidget *parent = 0);
|
||||
~ppuNameTableView_t(void);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void mousePressEvent(QMouseEvent * event);
|
||||
|
||||
int viewWidth;
|
||||
int viewHeight;
|
||||
};
|
||||
|
||||
class ppuNameTableViewerDialog_t : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ppuNameTableViewerDialog_t(QWidget *parent = 0);
|
||||
~ppuNameTableViewerDialog_t(void);
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *bar);
|
||||
|
||||
public slots:
|
||||
void closeWindow(void);
|
||||
private slots:
|
||||
};
|
||||
|
||||
int openNameTableViewWindow( QWidget *parent );
|
||||
|
Loading…
Reference in New Issue