mirror of
https://github.com/Michael-Prince-Sharpe/bsnes-classic.git
synced 2024-06-12 01:16:58 -04:00
ui: replace most '#if defined(PROFILE...' with specific PPU/DSP feature checks; allows PPU and DSP components to be mixed and matched
This commit is contained in:
parent
ad683a5902
commit
54d0bca408
|
@ -3,6 +3,8 @@
|
|||
class DSP : public Processor, public ChipDebugger {
|
||||
public:
|
||||
enum : bool { Threaded = false };
|
||||
enum : bool { SupportsChannelEnable = true };
|
||||
|
||||
alwaysinline void step(unsigned clocks);
|
||||
alwaysinline void synchronize_smp();
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
class PPU : public Processor, public PPUcounter, public MMIO {
|
||||
public:
|
||||
enum : bool { Threaded = true };
|
||||
enum : bool { SupportsLayerEnable = true };
|
||||
enum : bool { SupportsFrameSkip = true };
|
||||
|
||||
alwaysinline void step(unsigned clocks);
|
||||
alwaysinline void synchronize_cpu();
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
class PPU : public Processor, public PPUcounter, public MMIO {
|
||||
public:
|
||||
enum : bool { Threaded = true };
|
||||
enum : bool { SupportsLayerEnable = true };
|
||||
enum : bool { SupportsFrameSkip = true };
|
||||
|
||||
alwaysinline void step(unsigned clocks);
|
||||
alwaysinline void synchronize_cpu();
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
class DSP : public Processor {
|
||||
public:
|
||||
enum : bool { Threaded = DSP_THREADED };
|
||||
enum : bool { SupportsChannelEnable = false };
|
||||
|
||||
alwaysinline void step(unsigned clocks);
|
||||
alwaysinline void synchronize_smp();
|
||||
|
||||
|
@ -14,6 +16,8 @@ public:
|
|||
void power();
|
||||
void reset();
|
||||
|
||||
void channel_enable(unsigned, bool) {}
|
||||
|
||||
void serialize(serializer&);
|
||||
DSP();
|
||||
~DSP();
|
||||
|
@ -22,6 +26,7 @@ private:
|
|||
#if !DSP_THREADED
|
||||
unsigned phase;
|
||||
#endif
|
||||
|
||||
//global registers
|
||||
enum global_reg_t {
|
||||
r_mvoll = 0x0c, r_mvolr = 0x1c,
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
class PPU : public Processor, public PPUcounter, public MMIO {
|
||||
public:
|
||||
enum : bool { Threaded = true };
|
||||
enum : bool { SupportsLayerEnable = false };
|
||||
enum : bool { SupportsFrameSkip = false };
|
||||
|
||||
alwaysinline void step(unsigned clocks);
|
||||
alwaysinline void synchronize_cpu();
|
||||
|
||||
|
@ -13,6 +16,9 @@ public:
|
|||
void power();
|
||||
void reset();
|
||||
|
||||
void layer_enable(unsigned, unsigned, bool) {}
|
||||
void set_frameskip(unsigned) {}
|
||||
|
||||
void serialize(serializer&);
|
||||
PPU();
|
||||
~PPU();
|
||||
|
|
|
@ -182,9 +182,8 @@ MainWindow::MainWindow() {
|
|||
tools_stateManager = tools->addAction("&State Manager ...");
|
||||
|
||||
tools_effectToggle = tools->addAction("Effect &Toggle ...");
|
||||
#if !defined(PROFILE_COMPATIBILITY) && !defined(PROFILE_PERFORMANCE)
|
||||
tools_effectToggle->setVisible(false);
|
||||
#endif
|
||||
if(!SNES::PPU::SupportsLayerEnable && !SNES::DSP::SupportsChannelEnable)
|
||||
tools_effectToggle->setVisible(false);
|
||||
|
||||
tools_debugger = tools->addAction("&Debugger ...");
|
||||
#if !defined(DEBUGGER)
|
||||
|
|
|
@ -51,9 +51,9 @@ struct Speedup : HotkeyInput {
|
|||
bool syncAudio;
|
||||
|
||||
void pressed() {
|
||||
#if defined(PROFILE_COMPATIBILITY) || defined(PROFILE_PERFORMANCE)
|
||||
SNES::ppu.set_frameskip(9);
|
||||
#endif
|
||||
if(SNES::PPU::SupportsFrameSkip)
|
||||
SNES::ppu.set_frameskip(9);
|
||||
|
||||
config().system.speed = 4;
|
||||
utility.updateEmulationSpeed();
|
||||
syncVideo = config().video.synchronize;
|
||||
|
@ -70,9 +70,9 @@ struct Speedup : HotkeyInput {
|
|||
}
|
||||
|
||||
void released() {
|
||||
#if defined(PROFILE_COMPATIBILITY) || defined(PROFILE_PERFORMANCE)
|
||||
SNES::ppu.set_frameskip(0);
|
||||
#endif
|
||||
if(SNES::PPU::SupportsFrameSkip)
|
||||
SNES::ppu.set_frameskip(0);
|
||||
|
||||
config().system.speed = 2;
|
||||
utility.updateEmulationSpeed();
|
||||
if(syncVideo) {
|
||||
|
|
|
@ -94,30 +94,56 @@ EffectToggleWindow::EffectToggleWindow() {
|
|||
channel7->setChecked(true);
|
||||
layout->addWidget(channel7, 8, 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()));
|
||||
if(SNES::PPU::SupportsLayerEnable) {
|
||||
connect(bg1pri0, SIGNAL(stateChanged(int)), this, SLOT(synchronize_ppu()));
|
||||
connect(bg1pri1, SIGNAL(stateChanged(int)), this, SLOT(synchronize_ppu()));
|
||||
connect(bg2pri0, SIGNAL(stateChanged(int)), this, SLOT(synchronize_ppu()));
|
||||
connect(bg2pri1, SIGNAL(stateChanged(int)), this, SLOT(synchronize_ppu()));
|
||||
connect(bg3pri0, SIGNAL(stateChanged(int)), this, SLOT(synchronize_ppu()));
|
||||
connect(bg3pri1, SIGNAL(stateChanged(int)), this, SLOT(synchronize_ppu()));
|
||||
connect(bg4pri0, SIGNAL(stateChanged(int)), this, SLOT(synchronize_ppu()));
|
||||
connect(bg4pri1, SIGNAL(stateChanged(int)), this, SLOT(synchronize_ppu()));
|
||||
connect(oampri0, SIGNAL(stateChanged(int)), this, SLOT(synchronize_ppu()));
|
||||
connect(oampri1, SIGNAL(stateChanged(int)), this, SLOT(synchronize_ppu()));
|
||||
connect(oampri2, SIGNAL(stateChanged(int)), this, SLOT(synchronize_ppu()));
|
||||
connect(oampri3, SIGNAL(stateChanged(int)), this, SLOT(synchronize_ppu()));
|
||||
} else {
|
||||
bg1pri0->setEnabled(false);
|
||||
bg1pri1->setEnabled(false);
|
||||
bg2pri0->setEnabled(false);
|
||||
bg2pri1->setEnabled(false);
|
||||
bg3pri0->setEnabled(false);
|
||||
bg3pri1->setEnabled(false);
|
||||
bg4pri0->setEnabled(false);
|
||||
bg4pri1->setEnabled(false);
|
||||
oampri0->setEnabled(false);
|
||||
oampri1->setEnabled(false);
|
||||
oampri2->setEnabled(false);
|
||||
oampri3->setEnabled(false);
|
||||
}
|
||||
|
||||
if(SNES::DSP::SupportsChannelEnable) {
|
||||
connect(channel0, SIGNAL(stateChanged(int)), this, SLOT(synchronize_dsp()));
|
||||
connect(channel1, SIGNAL(stateChanged(int)), this, SLOT(synchronize_dsp()));
|
||||
connect(channel2, SIGNAL(stateChanged(int)), this, SLOT(synchronize_dsp()));
|
||||
connect(channel3, SIGNAL(stateChanged(int)), this, SLOT(synchronize_dsp()));
|
||||
connect(channel4, SIGNAL(stateChanged(int)), this, SLOT(synchronize_dsp()));
|
||||
connect(channel5, SIGNAL(stateChanged(int)), this, SLOT(synchronize_dsp()));
|
||||
connect(channel6, SIGNAL(stateChanged(int)), this, SLOT(synchronize_dsp()));
|
||||
connect(channel7, SIGNAL(stateChanged(int)), this, SLOT(synchronize_dsp()));
|
||||
} else {
|
||||
channel0->setEnabled(false);
|
||||
channel1->setEnabled(false);
|
||||
channel2->setEnabled(false);
|
||||
channel3->setEnabled(false);
|
||||
channel4->setEnabled(false);
|
||||
channel5->setEnabled(false);
|
||||
channel6->setEnabled(false);
|
||||
channel7->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void EffectToggleWindow::synchronize() {
|
||||
#if defined(PROFILE_COMPATIBILITY) || defined(PROFILE_PERFORMANCE)
|
||||
void EffectToggleWindow::synchronize_ppu() {
|
||||
SNES::ppu.layer_enable(0, 0, bg1pri0->isChecked());
|
||||
SNES::ppu.layer_enable(0, 1, bg1pri1->isChecked());
|
||||
SNES::ppu.layer_enable(1, 0, bg2pri0->isChecked());
|
||||
|
@ -130,7 +156,9 @@ void EffectToggleWindow::synchronize() {
|
|||
SNES::ppu.layer_enable(4, 1, oampri1->isChecked());
|
||||
SNES::ppu.layer_enable(4, 2, oampri2->isChecked());
|
||||
SNES::ppu.layer_enable(4, 3, oampri3->isChecked());
|
||||
}
|
||||
|
||||
void EffectToggleWindow::synchronize_dsp() {
|
||||
SNES::dsp.channel_enable(0, channel0->isChecked());
|
||||
SNES::dsp.channel_enable(1, channel1->isChecked());
|
||||
SNES::dsp.channel_enable(2, channel2->isChecked());
|
||||
|
@ -139,5 +167,4 @@ void EffectToggleWindow::synchronize() {
|
|||
SNES::dsp.channel_enable(5, channel5->isChecked());
|
||||
SNES::dsp.channel_enable(6, channel6->isChecked());
|
||||
SNES::dsp.channel_enable(7, channel7->isChecked());
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -29,7 +29,8 @@ public:
|
|||
EffectToggleWindow();
|
||||
|
||||
public slots:
|
||||
void synchronize();
|
||||
void synchronize_ppu();
|
||||
void synchronize_dsp();
|
||||
};
|
||||
|
||||
extern EffectToggleWindow *effectToggleWindow;
|
||||
|
|
|
@ -49,8 +49,8 @@ ToolsWindow::ToolsWindow() {
|
|||
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
|
||||
if(SNES::PPU::SupportsLayerEnable || SNES::DSP::SupportsChannelEnable)
|
||||
tab->addTab(effectToggleArea, "Effect Toggle");
|
||||
|
||||
layout->addWidget(tab);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue