Update to v068r15 release.

byuu says:

This adds a new "Effect Toggle" window to the tools tab list. There's no
menu entry for it yet, oversight, but you can go to another tool and tab
to it.

The effect toggle window lets you toggle background/OAM layers on
a per-priority basis and DSP sound channels. This only works with the
compatibility and performance cores, because I'm not going to allow
accuracy-violating hacks like that into the core.

Non-essential icons have been removed, there's six of them left at the
moment. I am too much of a consistency guy to only have some scattered
around. I know other apps do that, but I'm not going to do that, and
I grow tired of trying to hammer in icons that don't really represent
the actions. Anyway, it still looks pretty good I think.
This commit is contained in:
Tim Allen 2010-09-06 21:13:51 +10:00
parent 3a81ac94a5
commit 05fca49b11
57 changed files with 339 additions and 465 deletions

View File

@ -1,6 +1,6 @@
include nall/Makefile
snes := snes
profile := accuracy
profile := performance
ui := qt
# compiler
@ -64,6 +64,7 @@ ifeq ($(platform),x)
install -D -m 755 out/bsnes-$(profile) $(DESTDIR)$(prefix)/bin/bsnes-$(profile)
install -D -m 644 qt/data/bsnes.png $(DESTDIR)$(prefix)/share/pixmaps/bsnes.png
install -D -m 644 qt/data/bsnes.desktop $(DESTDIR)$(prefix)/share/applications/bsnes.desktop
gconftool-2 --type bool --set /desktop/gnome/interface/menus_have_icons true
endif
uninstall:

View File

@ -18,34 +18,26 @@ MainWindow::MainWindow() {
system = menuBar->addMenu("&System");
system_load = system->addAction("Load &Cartridge ...");
system_load->setIcon(QIcon(":/16x16/document-open.png"));
system_loadSpecial = system->addMenu("Load &Special");
system_loadSpecial->setIcon(QIcon(":/16x16/document-open.png"));
system_loadSpecial_bsxSlotted = system_loadSpecial->addAction("Load BS-X &Slotted Cartridge ...");
system_loadSpecial_bsxSlotted->setIcon(QIcon(":/16x16/document-open.png"));
system_loadSpecial_bsx = system_loadSpecial->addAction("Load &BS-X Cartridge ...");
system_loadSpecial_bsx->setIcon(QIcon(":/16x16/document-open.png"));
system_loadSpecial_sufamiTurbo = system_loadSpecial->addAction("Load Sufami &Turbo Cartridge ...");
system_loadSpecial_sufamiTurbo->setIcon(QIcon(":/16x16/document-open.png"));
system_loadSpecial_superGameBoy = system_loadSpecial->addAction("Load Super &Game Boy Cartridge ...");
system_loadSpecial_superGameBoy->setIcon(QIcon(":/16x16/document-open.png"));
system->addSeparator();
system->addAction(system_power = new CheckAction("&Power", 0));
system_reset = system->addAction("&Reset");
system_reset->setIcon(QIcon(":/16x16/view-refresh.png"));
system->addSeparator();
system_port1 = system->addMenu("Controller Port &1");
system_port1->setIcon(QIcon(":/16x16/input-gaming.png"));
system_port1->addAction(system_port1_none = new RadioAction("&None", 0));
system_port1->addAction(system_port1_gamepad = new RadioAction("&Gamepad", 0));
system_port1->addAction(system_port1_asciipad = new RadioAction("&asciiPad", 0));
@ -53,7 +45,6 @@ MainWindow::MainWindow() {
system_port1->addAction(system_port1_mouse = new RadioAction("&Mouse", 0));
system_port2 = system->addMenu("Controller Port &2");
system_port2->setIcon(QIcon(":/16x16/input-gaming.png"));
system_port2->addAction(system_port2_none = new RadioAction("&None", 0));
system_port2->addAction(system_port2_gamepad = new RadioAction("&Gamepad", 0));
system_port2->addAction(system_port2_asciipad = new RadioAction("&asciiPad", 0));
@ -68,13 +59,11 @@ MainWindow::MainWindow() {
#endif
system_exit = system->addAction("E&xit");
system_exit->setIcon(QIcon(":/16x16/process-stop.png"));
system_exit->setMenuRole(QAction::QuitRole);
settings = menuBar->addMenu("S&ettings");
settings_videoMode = settings->addMenu("Video &Mode");
settings_videoMode->setIcon(QIcon(":/16x16/video-display.png"));
settings_videoMode->addAction(settings_videoMode_1x = new RadioAction("Scale &1x", 0));
@ -103,10 +92,8 @@ MainWindow::MainWindow() {
if(filter.opened()) {
settings_videoFilter = settings->addMenu("Video &Filter");
settings_videoFilter->setIcon(QIcon(":/16x16/image-x-generic.png"));
settings_videoFilter_configure = settings_videoFilter->addAction("&Configure Active Filter ...");
settings_videoFilter_configure->setIcon(QIcon(":/16x16/preferences-desktop.png"));
settings_videoFilter->addSeparator();
settings_videoFilter->addAction(settings_videoFilter_none = new RadioAction("&None", 0));
@ -130,7 +117,6 @@ MainWindow::MainWindow() {
settings->addSeparator();
settings_emulationSpeed = settings->addMenu("Emulation &Speed");
settings_emulationSpeed->setIcon(QIcon(":/16x16/appointment-new.png"));
settings_emulationSpeed->addAction(settings_emulationSpeed_slowest = new RadioAction("Slowest", 0));
@ -149,28 +135,21 @@ MainWindow::MainWindow() {
settings_emulationSpeed->addAction(settings_emulationSpeed_syncAudio = new CheckAction("Sync &Audio", 0));
settings_configuration = settings->addAction("&Configuration ...");
settings_configuration->setIcon(QIcon(":/16x16/preferences-desktop.png"));
settings_configuration->setMenuRole(QAction::PreferencesRole);
tools = menuBar->addMenu("&Tools");
tools_movies = tools->addMenu("&Movies");
tools_movies->setIcon(QIcon(":/16x16/applications-multimedia.png"));
tools_movies_play = tools_movies->addAction("Play Movie ...");
tools_movies_play->setIcon(QIcon(":/16x16/media-playback-start.png"));
tools_movies_stop = tools_movies->addAction("Stop");
tools_movies_stop->setIcon(QIcon(":/16x16/media-playback-stop.png"));
tools_movies_recordFromPowerOn = tools_movies->addAction("Record Movie (and restart system)");
tools_movies_recordFromPowerOn->setIcon(QIcon(":/16x16/media-record.png"));
tools_movies_recordFromHere = tools_movies->addAction("Record Movie (starting from here)");
tools_movies_recordFromHere->setIcon(QIcon(":/16x16/media-record.png"));
tools_captureScreenshot = tools->addAction("&Capture Screenshot");
tools_captureScreenshot->setIcon(QIcon(":/16x16/image-x-generic.png"));
tools->addSeparator();
@ -193,16 +172,12 @@ MainWindow::MainWindow() {
tools->addSeparator();
tools_cheatEditor = tools->addAction("Cheat &Editor ...");
tools_cheatEditor->setIcon(QIcon(":/16x16/accessories-text-editor.png"));
tools_cheatFinder = tools->addAction("Cheat &Finder ...");
tools_cheatFinder->setIcon(QIcon(":/16x16/system-search.png"));
tools_stateManager = tools->addAction("&State Manager ...");
tools_stateManager->setIcon(QIcon(":/16x16/system-file-manager.png"));
tools_debugger = tools->addAction("&Debugger ...");
tools_debugger->setIcon(QIcon(":/16x16/utilities-terminal.png"));
#if !defined(DEBUGGER)
tools_debugger->setVisible(false);
#endif
@ -210,17 +185,14 @@ MainWindow::MainWindow() {
help = menuBar->addMenu("&Help");
help_documentation = help->addAction("&Documentation ...");
help_documentation->setIcon(QIcon(":/16x16/text-x-generic.png"));
help_license = help->addAction("&License ...");
help_license->setIcon(QIcon(":/16x16/text-x-generic.png"));
#if !defined(PLATFORM_OSX)
help->addSeparator();
#endif
help_about = help->addAction("&About ...");
help_about->setIcon(QIcon(":/16x16/help-browser.png"));
help_about->setMenuRole(QAction::AboutRole);
//canvas

Binary file not shown.

Before

Width:  |  Height:  |  Size: 574 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 592 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 897 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 685 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 629 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 581 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 932 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 558 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 812 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 660 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 429 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 653 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 440 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 935 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 668 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 662 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 912 B

View File

@ -12,7 +12,6 @@ Debugger *debugger;
#include "tools/memory.cpp"
#include "tools/properties.cpp"
#include "ppu/layer-toggle.cpp"
#include "ppu/vram-viewer.cpp"
#include "ppu/oam-viewer.cpp"
#include "ppu/cgram-viewer.cpp"
@ -40,7 +39,6 @@ Debugger::Debugger() {
menu_tools_propertiesViewer = menu_tools->addAction("Properties Viewer ...");
menu_ppu = menu->addMenu("S-PPU");
menu_ppu_layerToggle = menu_ppu->addAction("Layer Toggle ...");
menu_ppu_vramViewer = menu_ppu->addAction("Video RAM Viewer ...");
menu_ppu_oamViewer = menu_ppu->addAction("Sprite Viewer ...");
menu_ppu_cgramViewer = menu_ppu->addAction("Palette Viewer ...");
@ -98,7 +96,6 @@ Debugger::Debugger() {
breakpointEditor = new BreakpointEditor;
memoryEditor = new MemoryEditor;
propertiesViewer = new PropertiesViewer;
layerToggle = new LayerToggle;
vramViewer = new VramViewer;
oamViewer = new OamViewer;
cgramViewer = new CgramViewer;
@ -109,7 +106,6 @@ Debugger::Debugger() {
connect(menu_tools_memory, SIGNAL(triggered()), memoryEditor, SLOT(show()));
connect(menu_tools_propertiesViewer, SIGNAL(triggered()), propertiesViewer, SLOT(show()));
connect(menu_ppu_layerToggle, SIGNAL(triggered()), layerToggle, SLOT(show()));
connect(menu_ppu_vramViewer, SIGNAL(triggered()), vramViewer, SLOT(show()));
connect(menu_ppu_oamViewer, SIGNAL(triggered()), oamViewer, SLOT(show()));
connect(menu_ppu_cgramViewer, SIGNAL(triggered()), cgramViewer, SLOT(show()));

View File

@ -9,7 +9,6 @@ public:
QAction *menu_tools_memory;
QAction *menu_tools_propertiesViewer;
QMenu *menu_ppu;
QAction *menu_ppu_layerToggle;
QAction *menu_ppu_vramViewer;
QAction *menu_ppu_oamViewer;
QAction *menu_ppu_cgramViewer;

View File

@ -1,107 +0,0 @@
#include "layer-toggle.moc"
LayerToggle *layerToggle;
LayerToggle::LayerToggle() {
setObjectName("layer-toggle");
setWindowTitle("S-PPU Layer Toggle");
setGeometryString(&config().geometry.layerToggle);
application.windowList.append(this);
layout = new QGridLayout;
layout->setSizeConstraint(QLayout::SetFixedSize);
layout->setMargin(Style::WindowMargin);
layout->setHorizontalSpacing(Style::WidgetSpacing);
layout->setVerticalSpacing(0);
setLayout(layout);
bg1Label = new QLabel("BG1:");
layout->addWidget(bg1Label, 0, 0);
bg1pri0 = new QCheckBox("Priority 0");
bg1pri0->setChecked(true);
layout->addWidget(bg1pri0, 0, 1);
bg1pri1 = new QCheckBox("Priority 1");
bg1pri1->setChecked(true);
layout->addWidget(bg1pri1, 0, 2);
bg2Label = new QLabel("BG2:");
layout->addWidget(bg2Label, 1, 0);
bg2pri0 = new QCheckBox("Priority 0");
bg2pri0->setChecked(true);
layout->addWidget(bg2pri0, 1, 1);
bg2pri1 = new QCheckBox("Priority 1");
bg2pri1->setChecked(true);
layout->addWidget(bg2pri1, 1, 2);
bg3Label = new QLabel("BG3:");
layout->addWidget(bg3Label, 2, 0);
bg3pri0 = new QCheckBox("Priority 0");
bg3pri0->setChecked(true);
layout->addWidget(bg3pri0, 2, 1);
bg3pri1 = new QCheckBox("Priority 1");
bg3pri1->setChecked(true);
layout->addWidget(bg3pri1, 2, 2);
bg4Label = new QLabel("BG4:");
layout->addWidget(bg4Label, 3, 0);
bg4pri0 = new QCheckBox("Priority 0");
bg4pri0->setChecked(true);
layout->addWidget(bg4pri0, 3, 1);
bg4pri1 = new QCheckBox("Priority 1");
bg4pri1->setChecked(true);
layout->addWidget(bg4pri1, 3, 2);
oamLabel = new QLabel("OAM:");
layout->addWidget(oamLabel, 4, 0);
oampri0 = new QCheckBox("Priority 0");
oampri0->setChecked(true);
layout->addWidget(oampri0, 4, 1);
oampri1 = new QCheckBox("Priority 1");
oampri1->setChecked(true);
layout->addWidget(oampri1, 4, 2);
oampri2 = new QCheckBox("Priority 2");
oampri2->setChecked(true);
layout->addWidget(oampri2, 4, 3);
oampri3 = new QCheckBox("Priority 3");
oampri3->setChecked(true);
layout->addWidget(oampri3, 4, 4);
connect(bg1pri0, SIGNAL(stateChanged(int)), this, SLOT(toggleLayer()));
connect(bg1pri1, SIGNAL(stateChanged(int)), this, SLOT(toggleLayer()));
connect(bg2pri0, SIGNAL(stateChanged(int)), this, SLOT(toggleLayer()));
connect(bg2pri1, SIGNAL(stateChanged(int)), this, SLOT(toggleLayer()));
connect(bg3pri0, SIGNAL(stateChanged(int)), this, SLOT(toggleLayer()));
connect(bg3pri1, SIGNAL(stateChanged(int)), this, SLOT(toggleLayer()));
connect(bg4pri0, SIGNAL(stateChanged(int)), this, SLOT(toggleLayer()));
connect(bg4pri1, SIGNAL(stateChanged(int)), this, SLOT(toggleLayer()));
connect(oampri0, SIGNAL(stateChanged(int)), this, SLOT(toggleLayer()));
connect(oampri1, SIGNAL(stateChanged(int)), this, SLOT(toggleLayer()));
connect(oampri2, SIGNAL(stateChanged(int)), this, SLOT(toggleLayer()));
connect(oampri3, SIGNAL(stateChanged(int)), this, SLOT(toggleLayer()));
}
void LayerToggle::toggleLayer() {
if(sender() == bg1pri0) SNES::ppu.bg1_enabled[0] = bg1pri0->isChecked();
if(sender() == bg1pri1) SNES::ppu.bg1_enabled[1] = bg1pri1->isChecked();
if(sender() == bg2pri0) SNES::ppu.bg2_enabled[0] = bg2pri0->isChecked();
if(sender() == bg2pri1) SNES::ppu.bg2_enabled[1] = bg2pri1->isChecked();
if(sender() == bg3pri0) SNES::ppu.bg3_enabled[0] = bg3pri0->isChecked();
if(sender() == bg3pri1) SNES::ppu.bg3_enabled[1] = bg3pri1->isChecked();
if(sender() == bg4pri0) SNES::ppu.bg4_enabled[0] = bg4pri0->isChecked();
if(sender() == bg4pri1) SNES::ppu.bg4_enabled[1] = bg4pri1->isChecked();
if(sender() == oampri0) SNES::ppu.oam_enabled[0] = oampri0->isChecked();
if(sender() == oampri1) SNES::ppu.oam_enabled[1] = oampri1->isChecked();
if(sender() == oampri2) SNES::ppu.oam_enabled[2] = oampri2->isChecked();
if(sender() == oampri3) SNES::ppu.oam_enabled[3] = oampri3->isChecked();
}

View File

@ -1,30 +0,0 @@
class LayerToggle : public Window {
Q_OBJECT
public:
QGridLayout *layout;
QLabel *bg1Label;
QCheckBox *bg1pri0;
QCheckBox *bg1pri1;
QLabel *bg2Label;
QCheckBox *bg2pri0;
QCheckBox *bg2pri1;
QLabel *bg3Label;
QCheckBox *bg3pri0;
QCheckBox *bg3pri1;
QLabel *bg4Label;
QCheckBox *bg4pri0;
QCheckBox *bg4pri1;
QLabel *oamLabel;
QCheckBox *oampri0;
QCheckBox *oampri1;
QCheckBox *oampri2;
QCheckBox *oampri3;
LayerToggle();
public slots:
void toggleLayer();
};
extern LayerToggle *layerToggle;

View File

@ -12,29 +12,7 @@
<file alias="16x16/item-radio-on.png">../data/icons-16x16/item-radio-on.png</file>
<file alias="16x16/item-radio-off.png">../data/icons-16x16/item-radio-off.png</file>
<file alias="16x16/accessories-text-editor.png">../data/icons-16x16/accessories-text-editor.png</file>
<file alias="16x16/applications-multimedia.png">../data/icons-16x16/applications-multimedia.png</file>
<file alias="16x16/appointment-new.png">../data/icons-16x16/appointment-new.png</file>
<file alias="16x16/audio-volume-high.png">../data/icons-16x16/audio-volume-high.png</file>
<file alias="16x16/document-open.png">../data/icons-16x16/document-open.png</file>
<file alias="16x16/emblem-system.png">../data/icons-16x16/emblem-system.png</file>
<file alias="16x16/folder.png">../data/icons-16x16/folder.png</file>
<file alias="16x16/folder-new.png">../data/icons-16x16/folder-new.png</file>
<file alias="16x16/go-up.png">../data/icons-16x16/go-up.png</file>
<file alias="16x16/help-browser.png">../data/icons-16x16/help-browser.png</file>
<file alias="16x16/image-x-generic.png">../data/icons-16x16/image-x-generic.png</file>
<file alias="16x16/input-gaming.png">../data/icons-16x16/input-gaming.png</file>
<file alias="16x16/media-playback-start.png">../data/icons-16x16/media-playback-start.png</file>
<file alias="16x16/media-playback-stop.png">../data/icons-16x16/media-playback-stop.png</file>
<file alias="16x16/media-record.png">../data/icons-16x16/media-record.png</file>
<file alias="16x16/preferences-desktop.png">../data/icons-16x16/preferences-desktop.png</file>
<file alias="16x16/preferences-system.png">../data/icons-16x16/preferences-system.png</file>
<file alias="16x16/process-stop.png">../data/icons-16x16/process-stop.png</file>
<file alias="16x16/system-file-manager.png">../data/icons-16x16/system-file-manager.png</file>
<file alias="16x16/system-search.png">../data/icons-16x16/system-search.png</file>
<file alias="16x16/text-x-generic.png">../data/icons-16x16/text-x-generic.png</file>
<file alias="16x16/utilities-terminal.png">../data/icons-16x16/utilities-terminal.png</file>
<file alias="16x16/video-display.png">../data/icons-16x16/video-display.png</file>
<file alias="16x16/view-refresh.png">../data/icons-16x16/view-refresh.png</file>
</qresource>
</RCC>

View File

@ -17,13 +17,7 @@ ProfileSettingsWindow::ProfileSettingsWindow() {
layout->addSpacing(Style::WidgetSpacing);
profileAccuracy = new QRadioButton("Accuracy");
profileAccuracy->setStyleSheet(
"font-weight: bold;"
"font-size: 12pt;"
#if !defined(PLATFORM_WIN)
"background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 rgba(255, 0, 0, 48), stop: 1 rgba(255, 0, 0, 0));"
#endif
);
profileAccuracy->setStyleSheet("font-weight: bold; font-size: 12pt;");
layout->addWidget(profileAccuracy);
profileAccuracyInfo = new QLabel(
@ -36,13 +30,7 @@ ProfileSettingsWindow::ProfileSettingsWindow() {
layout->addSpacing(Style::WidgetSpacing);
profileCompatibility = new QRadioButton("Compatibility");
profileCompatibility->setStyleSheet(
"font-weight: bold;"
"font-size: 12pt;"
#if !defined(PLATFORM_WIN)
"background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 rgba(0, 0, 255, 48), stop: 1 rgba(0, 0, 255, 0));"
#endif
);
profileCompatibility->setStyleSheet("font-weight: bold; font-size: 12pt;");
layout->addWidget(profileCompatibility);
profileCompatibilityInfo = new QLabel(
@ -55,13 +43,7 @@ ProfileSettingsWindow::ProfileSettingsWindow() {
layout->addSpacing(Style::WidgetSpacing);
profilePerformance = new QRadioButton("Performance");
profilePerformance->setStyleSheet(
"font-weight: bold;"
"font-size: 12pt;"
#if !defined(PLATFORM_WIN)
"background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 rgba(0, 255, 0, 48), stop: 1 rgba(0, 255, 0, 0));"
#endif
);
profilePerformance->setStyleSheet("font-weight: bold; font-size: 12pt;");
layout->addWidget(profilePerformance);
profilePerformanceInfo = new QLabel(

View File

@ -60,11 +60,11 @@ SettingsWindow::SettingsWindow() {
advancedArea->setWidgetResizable(true);
tab = new QTabWidget;
tab->addTab(profileArea, QIcon(":/16x16/emblem-system.png"), "Profile");
tab->addTab(videoArea, QIcon(":/16x16/video-display.png"), "Video");
tab->addTab(audioArea, QIcon(":/16x16/audio-volume-high.png"), "Audio");
tab->addTab(inputArea, QIcon(":/16x16/input-gaming.png"), "Input");
tab->addTab(pathArea, QIcon(":/16x16/folder.png"), "Paths");
tab->addTab(advancedArea, QIcon(":/16x16/preferences-system.png"), "Advanced");
tab->addTab(profileArea, "Profile");
tab->addTab(videoArea, "Video");
tab->addTab(audioArea, "Audio");
tab->addTab(inputArea, "Input");
tab->addTab(pathArea, "Paths");
tab->addTab(advancedArea, "Advanced");
layout->addWidget(tab);
}

151
bsnes/qt/tools/effecttoggle.cpp Executable file
View File

@ -0,0 +1,151 @@
#include "effecttoggle.moc"
EffectToggleWindow *effectToggleWindow;
EffectToggleWindow::EffectToggleWindow() {
layout = new QVBoxLayout;
layout->setAlignment(Qt::AlignTop);
layout->setMargin(Style::WindowMargin);
layout->setSpacing(Style::WidgetSpacing);
setLayout(layout);
ppuLabel = new QLabel("<b>S-PPU (Video)</b>");
layout->addWidget(ppuLabel);
ppuLayout = new QGridLayout;
ppuLayout->setAlignment(Qt::AlignLeft);
layout->addLayout(ppuLayout);
bg1pri0 = new QCheckBox("BG1 Priority 0");
bg1pri0->setChecked(true);
ppuLayout->addWidget(bg1pri0, 0, 0);
bg1pri1 = new QCheckBox("BG1 Priority 1");
bg1pri1->setChecked(true);
ppuLayout->addWidget(bg1pri1, 0, 1);
bg2pri0 = new QCheckBox("BG2 Priority 0");
bg2pri0->setChecked(true);
ppuLayout->addWidget(bg2pri0, 1, 0);
bg2pri1 = new QCheckBox("BG2 Priority 1");
bg2pri1->setChecked(true);
ppuLayout->addWidget(bg2pri1, 1, 1);
bg3pri0 = new QCheckBox("BG3 Priority 0");
bg3pri0->setChecked(true);
ppuLayout->addWidget(bg3pri0, 2, 0);
bg3pri1 = new QCheckBox("BG3 Priority 1");
bg3pri1->setChecked(true);
ppuLayout->addWidget(bg3pri1, 2, 1);
bg4pri0 = new QCheckBox("BG4 Priority 0");
bg4pri0->setChecked(true);
ppuLayout->addWidget(bg4pri0, 3, 0);
bg4pri1 = new QCheckBox("BG4 Priority 1");
bg4pri1->setChecked(true);
ppuLayout->addWidget(bg4pri1, 3, 1);
oampri0 = new QCheckBox("OAM Priority 0");
oampri0->setChecked(true);
ppuLayout->addWidget(oampri0, 4, 0);
oampri1 = new QCheckBox("OAM Priority 1");
oampri1->setChecked(true);
ppuLayout->addWidget(oampri1, 4, 1);
oampri2 = new QCheckBox("OAM Priority 2");
oampri2->setChecked(true);
ppuLayout->addWidget(oampri2, 4, 2);
oampri3 = new QCheckBox("OAM Priority 3");
oampri3->setChecked(true);
ppuLayout->addWidget(oampri3, 4, 3);
dspLabel = new QLabel("<b>S-DSP (Audio)</b>");
layout->addWidget(dspLabel);
dspLayout = new QGridLayout;
dspLayout->setAlignment(Qt::AlignLeft);
layout->addLayout(dspLayout);
channel0 = new QCheckBox("Channel 0");
channel0->setChecked(true);
dspLayout->addWidget(channel0, 0, 0);
channel1 = new QCheckBox("Channel 1");
channel1->setChecked(true);
dspLayout->addWidget(channel1, 0, 1);
channel2 = new QCheckBox("Channel 2");
channel2->setChecked(true);
dspLayout->addWidget(channel2, 0, 2);
channel3 = new QCheckBox("Channel 3");
channel3->setChecked(true);
dspLayout->addWidget(channel3, 0, 3);
channel4 = new QCheckBox("Channel 4");
channel4->setChecked(true);
dspLayout->addWidget(channel4, 1, 0);
channel5 = new QCheckBox("Channel 5");
channel5->setChecked(true);
dspLayout->addWidget(channel5, 1, 1);
channel6 = new QCheckBox("Channel 6");
channel6->setChecked(true);
dspLayout->addWidget(channel6, 1, 2);
channel7 = new QCheckBox("Channel 7");
channel7->setChecked(true);
dspLayout->addWidget(channel7, 1, 3);
connect(bg1pri0, SIGNAL(stateChanged(int)), this, SLOT(synchronize()));
connect(bg1pri1, SIGNAL(stateChanged(int)), this, SLOT(synchronize()));
connect(bg2pri0, SIGNAL(stateChanged(int)), this, SLOT(synchronize()));
connect(bg2pri1, SIGNAL(stateChanged(int)), this, SLOT(synchronize()));
connect(bg3pri0, SIGNAL(stateChanged(int)), this, SLOT(synchronize()));
connect(bg3pri1, SIGNAL(stateChanged(int)), this, SLOT(synchronize()));
connect(bg4pri0, SIGNAL(stateChanged(int)), this, SLOT(synchronize()));
connect(bg4pri1, SIGNAL(stateChanged(int)), this, SLOT(synchronize()));
connect(oampri0, SIGNAL(stateChanged(int)), this, SLOT(synchronize()));
connect(oampri1, SIGNAL(stateChanged(int)), this, SLOT(synchronize()));
connect(oampri2, SIGNAL(stateChanged(int)), this, SLOT(synchronize()));
connect(oampri3, SIGNAL(stateChanged(int)), this, SLOT(synchronize()));
connect(channel0, SIGNAL(stateChanged(int)), this, SLOT(synchronize()));
connect(channel1, SIGNAL(stateChanged(int)), this, SLOT(synchronize()));
connect(channel2, SIGNAL(stateChanged(int)), this, SLOT(synchronize()));
connect(channel3, SIGNAL(stateChanged(int)), this, SLOT(synchronize()));
connect(channel4, SIGNAL(stateChanged(int)), this, SLOT(synchronize()));
connect(channel5, SIGNAL(stateChanged(int)), this, SLOT(synchronize()));
connect(channel6, SIGNAL(stateChanged(int)), this, SLOT(synchronize()));
connect(channel7, SIGNAL(stateChanged(int)), this, SLOT(synchronize()));
}
void EffectToggleWindow::synchronize() {
#if defined(PROFILE_COMPATIBILITY) || defined(PROFILE_PERFORMANCE)
SNES::ppu.layer_enable(0, 0, bg1pri0->isChecked());
SNES::ppu.layer_enable(0, 1, bg1pri1->isChecked());
SNES::ppu.layer_enable(1, 0, bg2pri0->isChecked());
SNES::ppu.layer_enable(1, 1, bg2pri1->isChecked());
SNES::ppu.layer_enable(2, 0, bg3pri0->isChecked());
SNES::ppu.layer_enable(2, 1, bg3pri1->isChecked());
SNES::ppu.layer_enable(3, 0, bg4pri0->isChecked());
SNES::ppu.layer_enable(3, 1, bg4pri1->isChecked());
SNES::ppu.layer_enable(4, 0, oampri0->isChecked());
SNES::ppu.layer_enable(4, 1, oampri1->isChecked());
SNES::ppu.layer_enable(4, 2, oampri2->isChecked());
SNES::ppu.layer_enable(4, 3, oampri3->isChecked());
SNES::dsp.channel_enable(0, channel0->isChecked());
SNES::dsp.channel_enable(1, channel1->isChecked());
SNES::dsp.channel_enable(2, channel2->isChecked());
SNES::dsp.channel_enable(3, channel3->isChecked());
SNES::dsp.channel_enable(4, channel4->isChecked());
SNES::dsp.channel_enable(5, channel5->isChecked());
SNES::dsp.channel_enable(6, channel6->isChecked());
SNES::dsp.channel_enable(7, channel7->isChecked());
#endif
}

View File

@ -0,0 +1,37 @@
class EffectToggleWindow : public QWidget {
Q_OBJECT
public:
QVBoxLayout *layout;
QLabel *ppuLabel;
QGridLayout *ppuLayout;
QCheckBox *bg1pri0;
QCheckBox *bg1pri1;
QCheckBox *bg2pri0;
QCheckBox *bg2pri1;
QCheckBox *bg3pri0;
QCheckBox *bg3pri1;
QCheckBox *bg4pri0;
QCheckBox *bg4pri1;
QCheckBox *oampri0;
QCheckBox *oampri1;
QCheckBox *oampri2;
QCheckBox *oampri3;
QLabel *dspLabel;
QGridLayout *dspLayout;
QCheckBox *channel0;
QCheckBox *channel1;
QCheckBox *channel2;
QCheckBox *channel3;
QCheckBox *channel4;
QCheckBox *channel5;
QCheckBox *channel6;
QCheckBox *channel7;
EffectToggleWindow();
public slots:
void synchronize();
};
extern EffectToggleWindow *effectToggleWindow;

View File

@ -6,6 +6,7 @@ ToolsWindow *toolsWindow;
#include "cheateditor.cpp"
#include "cheatfinder.cpp"
#include "statemanager.cpp"
#include "effecttoggle.cpp"
ToolsWindow::ToolsWindow() {
setObjectName("tools-window");
@ -22,6 +23,7 @@ ToolsWindow::ToolsWindow() {
cheatEditorWindow = new CheatEditorWindow;
cheatFinderWindow = new CheatFinderWindow;
stateManagerWindow = new StateManagerWindow;
effectToggleWindow = new EffectToggleWindow;
cheatEditorArea = new QScrollArea;
cheatEditorArea->setWidget(cheatEditorWindow);
@ -38,9 +40,17 @@ ToolsWindow::ToolsWindow() {
stateManagerArea->setFrameStyle(0);
stateManagerArea->setWidgetResizable(true);
effectToggleArea = new QScrollArea;
effectToggleArea->setWidget(effectToggleWindow);
effectToggleArea->setFrameStyle(0);
effectToggleArea->setWidgetResizable(true);
tab = new QTabWidget;
tab->addTab(cheatEditorArea, QIcon(":/16x16/accessories-text-editor.png"), "Cheat Editor");
tab->addTab(cheatFinderArea, QIcon(":/16x16/system-search.png"), "Cheat Finder");
tab->addTab(stateManagerArea, QIcon(":/16x16/system-file-manager.png"), "State Manager");
tab->addTab(cheatEditorArea, "Cheat Editor");
tab->addTab(cheatFinderArea, "Cheat Finder");
tab->addTab(stateManagerArea, "State Manager");
#if defined(PROFILE_COMPATIBILITY) || defined(PROFILE_PERFORMANCE)
tab->addTab(effectToggleArea, "Effect Toggle");
#endif
layout->addWidget(tab);
}

View File

@ -7,6 +7,7 @@ public:
QScrollArea *cheatEditorArea;
QScrollArea *cheatFinderArea;
QScrollArea *stateManagerArea;
QScrollArea *effectToggleArea;
ToolsWindow();

View File

@ -47,7 +47,6 @@ using namespace ruby;
#include "debugger/tools/memory.moc.hpp"
#include "debugger/tools/properties.moc.hpp"
#include "debugger/ppu/layer-toggle.moc.hpp"
#include "debugger/ppu/vram-viewer.moc.hpp"
#include "debugger/ppu/oam-viewer.moc.hpp"
#include "debugger/ppu/cgram-viewer.moc.hpp"
@ -76,6 +75,7 @@ using namespace ruby;
#include "tools/cheateditor.moc.hpp"
#include "tools/cheatfinder.moc.hpp"
#include "tools/statemanager.moc.hpp"
#include "tools/effecttoggle.moc.hpp"
#include "utility/utility.hpp"

View File

@ -50,4 +50,17 @@ void DSP::reset() {
spc_dsp.set_output(samplebuffer, 8192);
}
void DSP::channel_enable(unsigned channel, bool enable) {
channel_enabled[channel & 7] = enable;
unsigned mask = 0;
for(unsigned i = 0; i < 8; i++) {
if(channel_enabled[i] == false) mask |= 1 << i;
}
spc_dsp.mute_voices(mask);
}
DSP::DSP() {
for(unsigned i = 0; i < 8; i++) channel_enabled[i] = true;
}
}

View File

@ -13,12 +13,16 @@ public:
void power();
void reset();
void channel_enable(unsigned channel, bool enable);
void serialize(serializer&);
bool property(unsigned id, string &name, string &value) { return false; }
DSP();
private:
SPC_DSP spc_dsp;
int16 samplebuffer[8192];
bool channel_enabled[8];
};
extern DSP dsp;

View File

@ -76,6 +76,10 @@ void PPU::Background::render() {
if(regs.sub_enable) window.render(1);
if(regs.mode == Mode::Mode7) return render_mode7();
unsigned priority0 = (priority0_enable ? regs.priority0 : 0);
unsigned priority1 = (priority1_enable ? regs.priority1 : 0);
if(priority0 + priority1 == 0) return;
unsigned mosaic_hcounter = 1;
unsigned mosaic_palette = 0;
unsigned mosaic_priority = 0;
@ -114,7 +118,7 @@ void PPU::Background::render() {
tile_num = get_tile(hoffset, voffset);
mirror_y = tile_num & 0x8000;
mirror_x = tile_num & 0x4000;
tile_pri = tile_num & 0x2000 ? regs.priority1 : regs.priority0;
tile_pri = tile_num & 0x2000 ? priority1 : priority0;
pal_num = (tile_num >> 10) & 7;
pal_index = (bgpal_index + (pal_num << pal_size)) & 0xff;
@ -158,6 +162,9 @@ void PPU::Background::render() {
}
PPU::Background::Background(PPU &self, unsigned id) : self(self), id(id) {
priority0_enable = true;
priority1_enable = true;
opt_valid_bit = (id == ID::BG1 ? 0x2000 : id == ID::BG2 ? 0x4000 : 0x0000);
mosaic_table = new uint16*[16];

View File

@ -4,6 +4,9 @@ class Background {
struct ScreenSize { enum { Size32x32, Size32x64, Size64x32, Size64x64 }; };
struct TileSize { enum { Size8x8, Size16x16 }; };
bool priority0_enable;
bool priority1_enable;
struct Regs {
unsigned mode;
unsigned priority0;

View File

@ -27,6 +27,10 @@ void PPU::Background::render_mode7() {
mosaic_y = mosaic_table[self.bg1.regs.mosaic];
}
unsigned priority0 = (priority0_enable ? regs.priority0 : 0);
unsigned priority1 = (priority1_enable ? regs.priority1 : 0);
if(priority0 + priority1 == 0) return;
signed psx = ((a * Clip(hofs - cx)) & ~63) + ((b * Clip(vofs - cy)) & ~63) + ((b * mosaic_y[y]) & ~63) + (cx << 8);
signed psy = ((c * Clip(hofs - cx)) & ~63) + ((d * Clip(vofs - cy)) & ~63) + ((d * mosaic_y[y]) & ~63) + (cy << 8);
for(signed x = 0; x < 256; x++) {
@ -75,9 +79,9 @@ void PPU::Background::render_mode7() {
unsigned priority;
if(id == ID::BG1) {
priority = regs.priority0;
priority = priority0;
} else {
priority = (palette & 0x80 ? regs.priority1 : regs.priority0);
priority = (palette & 0x80 ? priority1 : priority0);
palette &= 0x7f;
}

View File

@ -1,10 +1,4 @@
class PPUDebugger : public PPU, public ChipDebugger {
public:
bool property(unsigned id, string &name, string &value);
bool bg1_enabled[2];
bool bg2_enabled[2];
bool bg3_enabled[2];
bool bg4_enabled[2];
bool oam_enabled[4];
};

View File

@ -96,6 +96,23 @@ void PPU::reset() {
mmio_reset();
}
void PPU::layer_enable(unsigned layer, unsigned priority, bool enable) {
switch(layer * 4 + priority) {
case 0: bg1.priority0_enable = enable; break;
case 1: bg1.priority1_enable = enable; break;
case 4: bg2.priority0_enable = enable; break;
case 5: bg2.priority1_enable = enable; break;
case 8: bg3.priority0_enable = enable; break;
case 9: bg3.priority1_enable = enable; break;
case 12: bg4.priority0_enable = enable; break;
case 13: bg4.priority1_enable = enable; break;
case 16: oam.priority0_enable = enable; break;
case 17: oam.priority1_enable = enable; break;
case 18: oam.priority2_enable = enable; break;
case 19: oam.priority3_enable = enable; break;
}
}
PPU::PPU() :
cache(*this),
bg1(*this, Background::ID::BG1),

View File

@ -15,6 +15,8 @@ public:
void scanline();
void frame();
void layer_enable(unsigned layer, unsigned priority, bool enable);
void serialize(serializer&);
PPU();
~PPU();

View File

@ -163,7 +163,13 @@ void PPU::Sprite::render() {
if(regs.main_enable) window.render(0);
if(regs.sub_enable) window.render(1);
const unsigned priority_table[] = { regs.priority0, regs.priority1, regs.priority2, regs.priority3 };
unsigned priority0 = (priority0_enable ? regs.priority0 : 0);
unsigned priority1 = (priority1_enable ? regs.priority1 : 0);
unsigned priority2 = (priority2_enable ? regs.priority2 : 0);
unsigned priority3 = (priority3_enable ? regs.priority3 : 0);
if(priority0 + priority1 + priority2 + priority3 == 0) return;
const unsigned priority_table[] = { priority0, priority1, priority2, priority3 };
for(unsigned x = 0; x < 256; x++) {
if(output.priority[x] == 0xff) continue;
unsigned priority = priority_table[output.priority[x]];
@ -175,6 +181,10 @@ void PPU::Sprite::render() {
}
PPU::Sprite::Sprite(PPU &self) : self(self) {
priority0_enable = true;
priority1_enable = true;
priority2_enable = true;
priority3_enable = true;
}
#endif

View File

@ -1,4 +1,9 @@
class Sprite {
bool priority0_enable;
bool priority1_enable;
bool priority2_enable;
bool priority3_enable;
struct Regs {
unsigned priority0;
unsigned priority1;

View File

@ -1,7 +1,5 @@
#ifdef PPU_CPP
#include "render.cpp"
uint8 PPUDebugger::vram_mmio_read(uint16 addr) {
uint8 data = PPU::vram_mmio_read(addr);
debugger.breakpoint_test(Debugger::Breakpoint::Source::VRAM, Debugger::Breakpoint::Mode::Read, addr, data);
@ -36,11 +34,6 @@ void PPUDebugger::cgram_mmio_write(uint16 addr, uint8 data) {
}
PPUDebugger::PPUDebugger() {
bg1_enabled[0] = bg1_enabled[1] = true;
bg2_enabled[0] = bg2_enabled[1] = true;
bg3_enabled[0] = bg3_enabled[1] = true;
bg4_enabled[0] = bg4_enabled[1] = true;
oam_enabled[0] = oam_enabled[1] = oam_enabled[2] = oam_enabled[3] = true;
}
bool PPUDebugger::property(unsigned id, string &name, string &value) {

View File

@ -2,12 +2,6 @@ class PPUDebugger : public PPU, public ChipDebugger {
public:
bool property(unsigned id, string &name, string &value);
bool bg1_enabled[2];
bool bg2_enabled[2];
bool bg3_enabled[2];
bool bg4_enabled[2];
bool oam_enabled[4];
uint8 vram_mmio_read(uint16 addr);
void vram_mmio_write(uint16 addr, uint8 data);
@ -17,14 +11,5 @@ public:
uint8 cgram_mmio_read(uint16 addr);
void cgram_mmio_write(uint16 addr, uint8 data);
void render_line_mode0();
void render_line_mode1();
void render_line_mode2();
void render_line_mode3();
void render_line_mode4();
void render_line_mode5();
void render_line_mode6();
void render_line_mode7();
PPUDebugger();
};

View File

@ -1,194 +0,0 @@
#ifdef PPU_CPP
//render_line_modeN():
//modified to support layer disable; accomplished by setting priority to zero
//a priority of zero won't override the back layer, effectively nullifying it
//for speed, rendering loop is skipped entirely if all priorities are disabled
//
//note: render_line_(bg|oam|mode7) cannot be virtualized as they are templates
void PPUDebugger::render_line_mode0() {
unsigned pri0, pri1, pri2, pri3;
pri0 = bg1_enabled[0] ? 8 : 0;
pri1 = bg1_enabled[1] ? 11 : 0;
if(pri0 | pri1) PPU::render_line_bg<0, BG1, COLORDEPTH_4>(pri0, pri1);
pri0 = bg2_enabled[0] ? 7 : 0;
pri1 = bg2_enabled[1] ? 10 : 0;
if(pri0 | pri1) PPU::render_line_bg<0, BG2, COLORDEPTH_4>(pri0, pri1);
pri0 = bg3_enabled[0] ? 2 : 0;
pri1 = bg3_enabled[1] ? 5 : 0;
if(pri0 | pri1) PPU::render_line_bg<0, BG3, COLORDEPTH_4>(pri0, pri1);
pri0 = bg4_enabled[0] ? 1 : 0;
pri1 = bg4_enabled[1] ? 4 : 0;
if(pri0 | pri1) PPU::render_line_bg<0, BG4, COLORDEPTH_4>(pri0, pri1);
pri0 = oam_enabled[0] ? 3 : 0;
pri1 = oam_enabled[1] ? 6 : 0;
pri2 = oam_enabled[2] ? 9 : 0;
pri3 = oam_enabled[3] ? 12 : 0;
if(pri0 | pri1 | pri2 | pri3) PPU::render_line_oam(pri0, pri1, pri2, pri3);
}
void PPUDebugger::render_line_mode1() {
unsigned pri0, pri1, pri2, pri3;
if(regs.bg3_priority) {
pri0 = bg1_enabled[0] ? 5 : 0;
pri1 = bg1_enabled[1] ? 8 : 0;
if(pri0 | pri1) PPU::render_line_bg<1, BG1, COLORDEPTH_16>(pri0, pri1);
pri0 = bg2_enabled[0] ? 4 : 0;
pri1 = bg2_enabled[1] ? 7 : 0;
if(pri0 | pri1) PPU::render_line_bg<1, BG2, COLORDEPTH_16>(pri0, pri1);
pri0 = bg3_enabled[0] ? 1 : 0;
pri1 = bg3_enabled[1] ? 10 : 0;
if(pri0 | pri1) PPU::render_line_bg<1, BG3, COLORDEPTH_4>(pri0, pri1);
pri0 = oam_enabled[0] ? 2 : 0;
pri1 = oam_enabled[1] ? 3 : 0;
pri2 = oam_enabled[2] ? 6 : 0;
pri3 = oam_enabled[3] ? 9 : 0;
if(pri0 | pri1 | pri2 | pri3) PPU::render_line_oam(pri0, pri1, pri2, pri3);
} else {
pri0 = bg1_enabled[0] ? 6 : 0;
pri1 = bg1_enabled[1] ? 9 : 0;
if(pri0 | pri1) PPU::render_line_bg<1, BG1, COLORDEPTH_16>(pri0, pri1);
pri0 = bg2_enabled[0] ? 5 : 0;
pri1 = bg2_enabled[1] ? 8 : 0;
if(pri0 | pri1) PPU::render_line_bg<1, BG2, COLORDEPTH_16>(pri0, pri1);
pri0 = bg3_enabled[0] ? 1 : 0;
pri1 = bg3_enabled[1] ? 3 : 0;
if(pri0 | pri1) PPU::render_line_bg<1, BG3, COLORDEPTH_4>(pri0, pri1);
pri0 = oam_enabled[0] ? 2 : 0;
pri1 = oam_enabled[1] ? 4 : 0;
pri2 = oam_enabled[2] ? 7 : 0;
pri3 = oam_enabled[3] ? 10 : 0;
PPU::render_line_oam(pri0, pri1, pri2, pri3);
}
}
void PPUDebugger::render_line_mode2() {
unsigned pri0, pri1, pri2, pri3;
pri0 = bg1_enabled[0] ? 3 : 0;
pri1 = bg1_enabled[1] ? 7 : 0;
if(pri0 | pri1) PPU::render_line_bg<2, BG1, COLORDEPTH_16>(pri0, pri1);
pri0 = bg2_enabled[0] ? 1 : 0;
pri1 = bg2_enabled[1] ? 5 : 0;
if(pri0 | pri1) PPU::render_line_bg<2, BG2, COLORDEPTH_16>(pri0, pri1);
pri0 = oam_enabled[0] ? 2 : 0;
pri1 = oam_enabled[1] ? 4 : 0;
pri2 = oam_enabled[2] ? 6 : 0;
pri3 = oam_enabled[3] ? 8 : 0;
if(pri0 | pri1 | pri2 | pri3) PPU::render_line_oam(pri0, pri1, pri2, pri3);
}
void PPUDebugger::render_line_mode3() {
unsigned pri0, pri1, pri2, pri3;
pri0 = bg1_enabled[0] ? 3 : 0;
pri1 = bg1_enabled[1] ? 7 : 0;
if(pri0 | pri1) PPU::render_line_bg<3, BG1, COLORDEPTH_256>(pri0, pri1);
pri0 = bg2_enabled[0] ? 1 : 0;
pri1 = bg2_enabled[1] ? 5 : 0;
if(pri0 | pri1) PPU::render_line_bg<3, BG2, COLORDEPTH_16>(pri0, pri1);
pri0 = oam_enabled[0] ? 2 : 0;
pri1 = oam_enabled[1] ? 4 : 0;
pri2 = oam_enabled[2] ? 6 : 0;
pri3 = oam_enabled[3] ? 8 : 0;
if(pri0 | pri1 | pri2 | pri3) PPU::render_line_oam(pri0, pri1, pri2, pri3);
}
void PPUDebugger::render_line_mode4() {
unsigned pri0, pri1, pri2, pri3;
pri0 = bg1_enabled[0] ? 3 : 0;
pri1 = bg1_enabled[1] ? 7 : 0;
if(pri0 | pri1) PPU::render_line_bg<4, BG1, COLORDEPTH_256>(pri0, pri1);
pri0 = bg2_enabled[0] ? 1 : 0;
pri1 = bg2_enabled[1] ? 5 : 0;
if(pri0 | pri1) PPU::render_line_bg<4, BG2, COLORDEPTH_4>(pri0, pri1);
pri0 = oam_enabled[0] ? 2 : 0;
pri1 = oam_enabled[1] ? 4 : 0;
pri2 = oam_enabled[2] ? 6 : 0;
pri3 = oam_enabled[3] ? 8 : 0;
if(pri0 | pri1 | pri2 | pri3) PPU::render_line_oam(pri0, pri1, pri2, pri3);
}
void PPUDebugger::render_line_mode5() {
unsigned pri0, pri1, pri2, pri3;
pri0 = bg1_enabled[0] ? 3 : 0;
pri1 = bg1_enabled[1] ? 7 : 0;
if(pri0 | pri1) PPU::render_line_bg<5, BG1, COLORDEPTH_16>(pri0, pri1);
pri0 = bg2_enabled[0] ? 1 : 0;
pri1 = bg2_enabled[1] ? 5 : 0;
if(pri0 | pri1) PPU::render_line_bg<5, BG2, COLORDEPTH_4>(pri0, pri1);
pri0 = oam_enabled[0] ? 2 : 0;
pri1 = oam_enabled[1] ? 4 : 0;
pri2 = oam_enabled[2] ? 6 : 0;
pri3 = oam_enabled[3] ? 8 : 0;
if(pri0 | pri1 | pri2 | pri3) PPU::render_line_oam(pri0, pri1, pri2, pri3);
}
void PPUDebugger::render_line_mode6() {
unsigned pri0, pri1, pri2, pri3;
pri0 = bg1_enabled[0] ? 2 : 0;
pri1 = bg1_enabled[1] ? 5 : 0;
if(pri0 | pri1) PPU::render_line_bg<6, BG1, COLORDEPTH_16>(pri0, pri1);
pri0 = oam_enabled[0] ? 1 : 0;
pri1 = oam_enabled[1] ? 3 : 0;
pri2 = oam_enabled[2] ? 4 : 0;
pri3 = oam_enabled[3] ? 6 : 0;
if(pri0 | pri1 | pri2 | pri3) PPU::render_line_oam(pri0, pri1, pri2, pri3);
}
void PPUDebugger::render_line_mode7() {
unsigned pri0, pri1, pri2, pri3;
if(regs.mode7_extbg == false) {
pri0 = bg1_enabled[0] ? 2 : 0;
pri1 = bg1_enabled[1] ? 2 : 0;
if(pri0 | pri1) PPU::render_line_mode7<BG1>(pri0, pri1);
pri0 = oam_enabled[0] ? 1 : 0;
pri1 = oam_enabled[1] ? 3 : 0;
pri2 = oam_enabled[2] ? 4 : 0;
pri3 = oam_enabled[3] ? 5 : 0;
if(pri0 | pri1 | pri2 | pri3) PPU::render_line_oam(pri0, pri1, pri2, pri3);
} else {
pri0 = bg1_enabled[0] ? 3 : 0;
pri1 = bg1_enabled[1] ? 3 : 0;
if(pri0 | pri1) PPU::render_line_mode7<BG1>(pri0, pri1);
pri0 = bg2_enabled[0] ? 1 : 0;
pri1 = bg2_enabled[1] ? 5 : 0;
if(pri0 | pri1) PPU::render_line_mode7<BG2>(pri0, pri1);
pri0 = oam_enabled[0] ? 2 : 0;
pri1 = oam_enabled[1] ? 4 : 0;
pri2 = oam_enabled[2] ? 6 : 0;
pri3 = oam_enabled[3] ? 7 : 0;
PPU::render_line_oam(pri0, pri1, pri2, pri3);
}
}
#endif

View File

@ -365,6 +365,23 @@ void PPU::reset() {
regs.bg_y[3] = 0;
}
void PPU::layer_enable(unsigned layer, unsigned priority, bool enable) {
switch(layer * 4 + priority) {
case 0: layer_enabled[BG1][0] = enable; break;
case 1: layer_enabled[BG1][1] = enable; break;
case 4: layer_enabled[BG2][0] = enable; break;
case 5: layer_enabled[BG2][1] = enable; break;
case 8: layer_enabled[BG3][0] = enable; break;
case 9: layer_enabled[BG3][1] = enable; break;
case 12: layer_enabled[BG4][0] = enable; break;
case 13: layer_enabled[BG4][1] = enable; break;
case 16: layer_enabled[OAM][0] = enable; break;
case 17: layer_enabled[OAM][1] = enable; break;
case 18: layer_enabled[OAM][2] = enable; break;
case 19: layer_enabled[OAM][3] = enable; break;
}
}
PPU::PPU() {
surface = new uint16[512 * 512];
output = surface + 16 * 512;
@ -390,6 +407,19 @@ PPU::PPU() {
}
}
}
layer_enabled[BG1][0] = true;
layer_enabled[BG1][1] = true;
layer_enabled[BG2][0] = true;
layer_enabled[BG2][1] = true;
layer_enabled[BG3][0] = true;
layer_enabled[BG3][1] = true;
layer_enabled[BG4][0] = true;
layer_enabled[BG4][1] = true;
layer_enabled[OAM][0] = true;
layer_enabled[OAM][1] = true;
layer_enabled[OAM][2] = true;
layer_enabled[OAM][3] = true;
}
PPU::~PPU() {

View File

@ -59,6 +59,9 @@ public:
void power();
void reset();
bool layer_enabled[5][4];
void layer_enable(unsigned layer, unsigned priority, bool enable);
void serialize(serializer&);
PPU();
~PPU();

View File

@ -53,6 +53,10 @@ uint16 PPU::bg_get_tile(uint16 x, uint16 y) {
template<unsigned mode, unsigned bg, unsigned color_depth>
void PPU::render_line_bg(uint8 pri0_pos, uint8 pri1_pos) {
if(layer_enabled[bg][0] == false) pri0_pos = 0;
if(layer_enabled[bg][1] == false) pri1_pos = 0;
if(pri0_pos + pri1_pos == 0) return;
if(regs.bg_enabled[bg] == false && regs.bgsub_enabled[bg] == false) return;
const bool bg_enabled = regs.bg_enabled[bg];

View File

@ -14,6 +14,10 @@
template<unsigned bg>
void PPU::render_line_mode7(uint8 pri0_pos, uint8 pri1_pos) {
if(layer_enabled[bg][0] == false) pri0_pos = 0;
if(layer_enabled[bg][1] == false) pri1_pos = 0;
if(pri0_pos + pri1_pos == 0) return;
if(regs.bg_enabled[bg] == false && regs.bgsub_enabled[bg] == false) return;
int32 px, py;

View File

@ -201,6 +201,12 @@ void PPU::render_line_oam_rto() {
}
void PPU::render_line_oam(uint8 pri0_pos, uint8 pri1_pos, uint8 pri2_pos, uint8 pri3_pos) {
if(layer_enabled[OAM][0] == false) pri0_pos = 0;
if(layer_enabled[OAM][1] == false) pri1_pos = 0;
if(layer_enabled[OAM][2] == false) pri2_pos = 0;
if(layer_enabled[OAM][3] == false) pri3_pos = 0;
if(pri0_pos + pri1_pos + pri2_pos + pri3_pos == 0) return;
if(regs.bg_enabled[OAM] == false && regs.bgsub_enabled[OAM] == false) return;
for(unsigned s = 0; s < 34; s++) {

View File

@ -1,12 +1,12 @@
//render.cpp
debugvirtual inline void render_line_mode0();
debugvirtual inline void render_line_mode1();
debugvirtual inline void render_line_mode2();
debugvirtual inline void render_line_mode3();
debugvirtual inline void render_line_mode4();
debugvirtual inline void render_line_mode5();
debugvirtual inline void render_line_mode6();
debugvirtual inline void render_line_mode7();
inline void render_line_mode0();
inline void render_line_mode1();
inline void render_line_mode2();
inline void render_line_mode3();
inline void render_line_mode4();
inline void render_line_mode5();
inline void render_line_mode6();
inline void render_line_mode7();
//cache.cpp
enum { COLORDEPTH_4 = 0, COLORDEPTH_16 = 1, COLORDEPTH_256 = 2 };

View File

@ -1,10 +1,4 @@
class PPUDebugger : public PPU, public ChipDebugger {
public:
bool property(unsigned id, string &name, string &value);
bool bg1_enabled[2];
bool bg2_enabled[2];
bool bg3_enabled[2];
bool bg4_enabled[2];
bool oam_enabled[4];
};

View File

@ -1,7 +1,7 @@
namespace SNES {
namespace Info {
static const char Name[] = "bsnes";
static const char Version[] = "068.14";
static const char Version[] = "068.15";
static const unsigned SerializerVersion = 13;
}
}