Emulation: Added "do not reset ppu on console reset" option

This commit is contained in:
Souryo 2017-02-24 23:06:13 -05:00
parent 35d0510224
commit 23fd484d06
12 changed files with 108 additions and 73 deletions

View file

@ -187,18 +187,23 @@ NesModel Console::GetModel()
void Console::Reset(bool softReset)
{
Movie::Stop();
SoundMixer::StopRecording();
if(Instance->_initialized) {
Console::Pause();
if(softReset) {
Instance->ResetComponents(softReset);
if(softReset && EmulationSettings::CheckFlag(EmulationFlags::DisablePpuReset)) {
//Allow mid-frame resets to allow the PPU to get out-of-sync
RequestReset();
} else {
//Full reset of all objects to ensure the emulator always starts in the exact same state
Instance->Initialize(Instance->_romFilepath);
Movie::Stop();
SoundMixer::StopRecording();
Console::Pause();
if(softReset) {
Instance->ResetComponents(softReset);
} else {
//Full reset of all objects to ensure the emulator always starts in the exact same state
Instance->Initialize(Instance->_romFilepath);
}
Console::Resume();
}
Console::Resume();
}
}
@ -208,7 +213,9 @@ void Console::ResetComponents(bool softReset)
SoundMixer::StopRecording();
_memoryManager->Reset(softReset);
_ppu->Reset();
if(!EmulationSettings::CheckFlag(EmulationFlags::DisablePpuReset) || !softReset) {
_ppu->Reset();
}
_apu->Reset(softReset);
_cpu->Reset(softReset);
_controlManager->Reset(softReset);
@ -292,6 +299,15 @@ void Console::Run()
break;
}
if(_resetRequested) {
//Used by NSF player to reset console after changing track
//Also used with DisablePpuReset option to reset mid-frame
Movie::Stop();
SoundMixer::StopRecording();
ResetComponents(true);
_resetRequested = false;
}
uint32_t currentFrameNumber = PPU::GetFrameCount();
if(currentFrameNumber != lastFrameNumber) {
EmulationSettings::DisableOverclocking(_disableOcNextFrame);
@ -302,12 +318,6 @@ void Console::Run()
//Sleep until we're ready to start the next frame
clockTimer.WaitUntil(targetTime);
if(_resetRequested) {
//Used by NSF player to reset console after changing track
ResetComponents(true);
_resetRequested = false;
}
if(!_pauseLock.IsFree()) {
//Need to temporarely pause the emu (to save/load a state, etc.)
_runLock.Release();

View file

@ -42,6 +42,7 @@ enum EmulationFlags : int64_t
DisableNoiseModeFlag = 0x8000000,
DisablePaletteRead = 0x10000000,
DisableOamAddrBug = 0x20000000,
DisablePpuReset = 0x40000000,
Turbo = 0x2000000000,
InBackground = 0x4000000000,

View file

@ -19,6 +19,7 @@ namespace Mesen.GUI.Config
public bool DisablePpu2004Reads = false;
public bool DisablePaletteRead = false;
public bool DisableOamAddrBug = false;
public bool DisablePpuReset = false;
public bool UseAlternativeMmc3Irq = false;
@ -53,6 +54,7 @@ namespace Mesen.GUI.Config
InteropEmu.SetFlag(EmulationFlags.DisablePpu2004Reads, emulationInfo.DisablePpu2004Reads);
InteropEmu.SetFlag(EmulationFlags.DisablePaletteRead, emulationInfo.DisablePaletteRead);
InteropEmu.SetFlag(EmulationFlags.DisableOamAddrBug, emulationInfo.DisableOamAddrBug);
InteropEmu.SetFlag(EmulationFlags.DisablePpuReset, emulationInfo.DisablePpuReset);
InteropEmu.SetOverclockRate(emulationInfo.OverclockRate, emulationInfo.OverclockAdjustApu);
InteropEmu.SetPpuNmiConfig(emulationInfo.PpuExtraScanlinesBeforeNmi, emulationInfo.PpuExtraScanlinesAfterNmi);

View file

@ -288,9 +288,10 @@
<Control ID="chkAllowInvalidInput">Permitir las entradas inválidas (Arriba+Abajo e Izquierda+Derecha al mismo tiempo)</Control>
<Control ID="lblRamPowerOnState">Estado inicial de la memoria durante el inicio:</Control>
<Control ID="chkRemoveSpriteLimit">Eliminar el límite de sprites (Reduce el parpadeo en algunos juegos)</Control>
<Control ID="chkDisablePpu2004Reads">Disable PPU $2004 reads</Control>
<Control ID="chkDisablePpu2004Reads">Disable PPU $2004 reads (Famicom behavior)</Control>
<Control ID="chkDisableOamAddrBug">Disable PPU OAMADDR bug emulation</Control>
<Control ID="chkDisablePaletteRead">Disable PPU palette reads</Control>
<Control ID="chkDisablePaletteRead">Disable PPU palette reads</Control>
<Control ID="chkDisablePpuReset">Do not reset PPU when resetting console (Famicom behavior)</Control>
<Control ID="tpgOverclocking">Overclocking</Control>
<Control ID="grpOverclocking">Overclocking de CPU</Control>

View file

@ -288,9 +288,10 @@
<Control ID="chkUseAlternativeMmc3Irq">Utiliser la version alternative du comportement des IRQs du MMC3</Control>
<Control ID="chkAllowInvalidInput">Permettre les entrées invalides (Bas+Haut ou Gauche+Droite en même temps)</Control>
<Control ID="chkRemoveSpriteLimit">Éliminer la limite de sprites (Réduit le clignotement dans certains jeux)</Control>
<Control ID="chkDisablePpu2004Reads">Empêcher la lecture du registre $2004 du PPU</Control>
<Control ID="chkDisablePpu2004Reads">Empêcher la lecture du registre $2004 du PPU (Famicom)</Control>
<Control ID="chkDisableOamAddrBug">Désactiver l'émulation du bug de OAMADDR du PPU</Control>
<Control ID="chkDisablePaletteRead">Empêcher la lecture de la palette du PPU</Control>
<Control ID="chkDisablePpuReset">Ne pas faire un reset du PPU lors du reset de la console (Famicom)</Control>
<Control ID="lblRamPowerOnState">État initial de la mémoire au démarrage : </Control>

View file

@ -288,9 +288,10 @@
<Control ID="chkUseAlternativeMmc3Irq">MMC3AのIRQ仕様を使う</Control>
<Control ID="chkAllowInvalidInput">コントローラでは不可能インプットを可能にする (同時に上と下や右と左)</Control>
<Control ID="chkRemoveSpriteLimit">スプライトの制限を解除 (点滅を軽減する)</Control>
<Control ID="chkDisablePpu2004Reads">PPUの$2004を読み込み不可能にする</Control>
<Control ID="chkDisablePpu2004Reads">PPUの$2004を読み込み不可能にする (ファミコン同様)</Control>
<Control ID="chkDisableOamAddrBug">PPUのOAMADDRバグを無効にする</Control>
<Control ID="chkDisablePaletteRead">PPUのパレットラムを読み込み不可能にする</Control>
<Control ID="chkDisablePpuReset">ゲーム機をリセットする時に、PPUをリセットしない ファミコン同様</Control>
<Control ID="lblRamPowerOnState">起動時のメモリの状態 : </Control>

View file

@ -288,9 +288,10 @@
<Control ID="chkAllowInvalidInput">Permitir as entradas inválidas (Cima+Baixo e Esquerda+Direita ao mesmo tempo)</Control>
<Control ID="lblRamPowerOnState">Estado inicial da memória durante o início:</Control>
<Control ID="chkRemoveSpriteLimit">Eliminar o limite de sprites (Reduz os "flashes" em alguns jogos)</Control>
<Control ID="chkDisablePpu2004Reads">Disable PPU $2004 reads</Control>
<Control ID="chkDisablePpu2004Reads">Disable PPU $2004 reads (Famicom behavior)</Control>
<Control ID="chkDisableOamAddrBug">Disable PPU OAMADDR bug emulation</Control>
<Control ID="chkDisablePaletteRead">Disable PPU palette reads</Control>
<Control ID="chkDisablePpuReset">Do not reset PPU when resetting console (Famicom behavior)</Control>
<Control ID="tpgOverclocking">Overclocking</Control>
<Control ID="grpOverclocking">Overclocking de CPU</Control>

View file

@ -289,9 +289,10 @@
<Control ID="chkAllowInvalidInput">Разрешить недопустимые комбинации (Вниз+Вверх и Влево+Вправо)</Control>
<Control ID="lblRamPowerOnState">Содержимое ОЗУ при включении : </Control>
<Control ID="chkRemoveSpriteLimit">Отключить лимит спрайтов (уменьшает мерцание)</Control>
<Control ID="chkDisablePpu2004Reads">Disable PPU $2004 reads</Control>
<Control ID="chkDisablePpu2004Reads">Disable PPU $2004 reads (Famicom behavior)</Control>
<Control ID="chkDisableOamAddrBug">Disable PPU OAMADDR bug emulation</Control>
<Control ID="chkDisablePaletteRead">Disable PPU palette reads</Control>
<Control ID="chkDisablePpuReset">Do not reset PPU when resetting console (Famicom behavior)</Control>
<Control ID="tpgOverclocking">Разгон</Control>
<Control ID="grpOverclocking">Разгон CPU</Control>

View file

@ -289,9 +289,10 @@
<Control ID="chkAllowInvalidInput">Дозволити неприпустимі комбінації (Вниз+Вгору і Ліворуч+Вправо)</Control>
<Control ID="lblRamPowerOnState">Вміст ОЗУ при включенні : </Control>
<Control ID="chkRemoveSpriteLimit">Відключити ліміт спрайтів (зменшує мерехтіння)</Control>
<Control ID="chkDisablePpu2004Reads">Disable PPU $2004 reads</Control>
<Control ID="chkDisablePpu2004Reads">Disable PPU $2004 reads (Famicom behavior)</Control>
<Control ID="chkDisableOamAddrBug">Disable PPU OAMADDR bug emulation</Control>
<Control ID="chkDisablePaletteRead">Disable PPU palette reads</Control>
<Control ID="chkDisablePpuReset">Do not reset PPU when resetting console (Famicom behavior)</Control>
<Control ID="tpgOverclocking">Розгін</Control>
<Control ID="grpOverclocking">Розгін CPU</Control>

View file

@ -44,14 +44,10 @@ namespace Mesen.GUI.Forms.Config
this.tpgAdvanced = new System.Windows.Forms.TabPage();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.chkUseAlternativeMmc3Irq = new System.Windows.Forms.CheckBox();
this.chkAllowInvalidInput = new Mesen.GUI.Controls.ctrlRiskyOption();
this.chkRemoveSpriteLimit = new System.Windows.Forms.CheckBox();
this.flowLayoutPanel8 = new System.Windows.Forms.FlowLayoutPanel();
this.lblRamPowerOnState = new System.Windows.Forms.Label();
this.cboRamPowerOnState = new System.Windows.Forms.ComboBox();
this.chkDisableOamAddrBug = new Mesen.GUI.Controls.ctrlRiskyOption();
this.chkDisablePaletteRead = new Mesen.GUI.Controls.ctrlRiskyOption();
this.chkDisablePpu2004Reads = new Mesen.GUI.Controls.ctrlRiskyOption();
this.tpgOverclocking = new System.Windows.Forms.TabPage();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.flowLayoutPanel4 = new System.Windows.Forms.FlowLayoutPanel();
@ -81,6 +77,11 @@ namespace Mesen.GUI.Forms.Config
this.chkShowLagCounter = new System.Windows.Forms.CheckBox();
this.btnResetLagCounter = new System.Windows.Forms.Button();
this.tmrUpdateClockRate = new System.Windows.Forms.Timer(this.components);
this.chkAllowInvalidInput = new Mesen.GUI.Controls.ctrlRiskyOption();
this.chkDisablePpuReset = new Mesen.GUI.Controls.ctrlRiskyOption();
this.chkDisablePaletteRead = new Mesen.GUI.Controls.ctrlRiskyOption();
this.chkDisablePpu2004Reads = new Mesen.GUI.Controls.ctrlRiskyOption();
this.chkDisableOamAddrBug = new Mesen.GUI.Controls.ctrlRiskyOption();
this.tabMain.SuspendLayout();
this.tpgGeneral.SuspendLayout();
this.tableLayoutPanel4.SuspendLayout();
@ -260,20 +261,22 @@ namespace Mesen.GUI.Forms.Config
this.tableLayoutPanel1.Controls.Add(this.chkUseAlternativeMmc3Irq, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.chkAllowInvalidInput, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.chkRemoveSpriteLimit, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel8, 0, 6);
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel8, 0, 7);
this.tableLayoutPanel1.Controls.Add(this.chkDisablePaletteRead, 0, 6);
this.tableLayoutPanel1.Controls.Add(this.chkDisableOamAddrBug, 0, 5);
this.tableLayoutPanel1.Controls.Add(this.chkDisablePaletteRead, 0, 4);
this.tableLayoutPanel1.Controls.Add(this.chkDisablePpu2004Reads, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.chkDisablePpuReset, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.chkDisablePpu2004Reads, 0, 4);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 3);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 8;
this.tableLayoutPanel1.RowCount = 9;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(519, 267);
@ -289,17 +292,6 @@ namespace Mesen.GUI.Forms.Config
this.chkUseAlternativeMmc3Irq.Text = "Use alternative MMC3 IRQ behavior";
this.chkUseAlternativeMmc3Irq.UseVisualStyleBackColor = true;
//
// chkAllowInvalidInput
//
this.chkAllowInvalidInput.AutoSize = true;
this.chkAllowInvalidInput.Checked = false;
this.chkAllowInvalidInput.Dock = System.Windows.Forms.DockStyle.Fill;
this.chkAllowInvalidInput.Location = new System.Drawing.Point(0, 46);
this.chkAllowInvalidInput.Name = "chkAllowInvalidInput";
this.chkAllowInvalidInput.Size = new System.Drawing.Size(519, 23);
this.chkAllowInvalidInput.TabIndex = 1;
this.chkAllowInvalidInput.Text = "Allow invalid input (e.g Down + Up or Left + Right at the same time)";
//
// chkRemoveSpriteLimit
//
this.chkRemoveSpriteLimit.AutoSize = true;
@ -315,7 +307,7 @@ namespace Mesen.GUI.Forms.Config
this.flowLayoutPanel8.Controls.Add(this.lblRamPowerOnState);
this.flowLayoutPanel8.Controls.Add(this.cboRamPowerOnState);
this.flowLayoutPanel8.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel8.Location = new System.Drawing.Point(0, 138);
this.flowLayoutPanel8.Location = new System.Drawing.Point(0, 158);
this.flowLayoutPanel8.Margin = new System.Windows.Forms.Padding(0);
this.flowLayoutPanel8.Name = "flowLayoutPanel8";
this.flowLayoutPanel8.Size = new System.Drawing.Size(519, 27);
@ -340,36 +332,6 @@ namespace Mesen.GUI.Forms.Config
this.cboRamPowerOnState.Size = new System.Drawing.Size(176, 21);
this.cboRamPowerOnState.TabIndex = 1;
//
// chkDisableOamAddrBug
//
this.chkDisableOamAddrBug.AutoSize = true;
this.chkDisableOamAddrBug.Checked = false;
this.chkDisableOamAddrBug.Location = new System.Drawing.Point(0, 115);
this.chkDisableOamAddrBug.Name = "chkDisableOamAddrBug";
this.chkDisableOamAddrBug.Size = new System.Drawing.Size(311, 23);
this.chkDisableOamAddrBug.TabIndex = 5;
this.chkDisableOamAddrBug.Text = "Disable PPU OAMADDR bug emulation";
//
// chkDisablePaletteRead
//
this.chkDisablePaletteRead.AutoSize = true;
this.chkDisablePaletteRead.Checked = false;
this.chkDisablePaletteRead.Location = new System.Drawing.Point(0, 92);
this.chkDisablePaletteRead.Name = "chkDisablePaletteRead";
this.chkDisablePaletteRead.Size = new System.Drawing.Size(248, 23);
this.chkDisablePaletteRead.TabIndex = 6;
this.chkDisablePaletteRead.Text = "Disable PPU palette reads";
//
// chkDisablePpu2004Reads
//
this.chkDisablePpu2004Reads.AutoSize = true;
this.chkDisablePpu2004Reads.Checked = false;
this.chkDisablePpu2004Reads.Location = new System.Drawing.Point(0, 69);
this.chkDisablePpu2004Reads.Name = "chkDisablePpu2004Reads";
this.chkDisablePpu2004Reads.Size = new System.Drawing.Size(246, 23);
this.chkDisablePpu2004Reads.TabIndex = 4;
this.chkDisablePpu2004Reads.Text = "Disable PPU $2004 reads";
//
// tpgOverclocking
//
this.tpgOverclocking.Controls.Add(this.tableLayoutPanel3);
@ -731,6 +693,57 @@ namespace Mesen.GUI.Forms.Config
this.tmrUpdateClockRate.Enabled = true;
this.tmrUpdateClockRate.Tick += new System.EventHandler(this.tmrUpdateClockRate_Tick);
//
// chkAllowInvalidInput
//
this.chkAllowInvalidInput.AutoSize = true;
this.chkAllowInvalidInput.Checked = false;
this.chkAllowInvalidInput.Dock = System.Windows.Forms.DockStyle.Fill;
this.chkAllowInvalidInput.Location = new System.Drawing.Point(0, 46);
this.chkAllowInvalidInput.Name = "chkAllowInvalidInput";
this.chkAllowInvalidInput.Size = new System.Drawing.Size(519, 23);
this.chkAllowInvalidInput.TabIndex = 1;
this.chkAllowInvalidInput.Text = "Allow invalid input (e.g Down + Up or Left + Right at the same time)";
//
// chkDisablePpuReset
//
this.chkDisablePpuReset.AutoSize = true;
this.chkDisablePpuReset.Checked = false;
this.chkDisablePpuReset.Location = new System.Drawing.Point(0, 69);
this.chkDisablePpuReset.Name = "chkDisablePpuReset";
this.chkDisablePpuReset.Size = new System.Drawing.Size(414, 23);
this.chkDisablePpuReset.TabIndex = 7;
this.chkDisablePpuReset.Text = "Do not reset PPU when resetting console (Famicom behavior)";
//
// chkDisablePaletteRead
//
this.chkDisablePaletteRead.AutoSize = true;
this.chkDisablePaletteRead.Checked = false;
this.chkDisablePaletteRead.Location = new System.Drawing.Point(0, 138);
this.chkDisablePaletteRead.Name = "chkDisablePaletteRead";
this.chkDisablePaletteRead.Size = new System.Drawing.Size(248, 20);
this.chkDisablePaletteRead.TabIndex = 6;
this.chkDisablePaletteRead.Text = "Disable PPU palette reads";
//
// chkDisablePpu2004Reads
//
this.chkDisablePpu2004Reads.AutoSize = true;
this.chkDisablePpu2004Reads.Checked = false;
this.chkDisablePpu2004Reads.Location = new System.Drawing.Point(0, 92);
this.chkDisablePpu2004Reads.Name = "chkDisablePpu2004Reads";
this.chkDisablePpu2004Reads.Size = new System.Drawing.Size(341, 23);
this.chkDisablePpu2004Reads.TabIndex = 4;
this.chkDisablePpu2004Reads.Text = "Disable PPU $2004 reads (Famicom behavior)";
//
// chkDisableOamAddrBug
//
this.chkDisableOamAddrBug.AutoSize = true;
this.chkDisableOamAddrBug.Checked = false;
this.chkDisableOamAddrBug.Location = new System.Drawing.Point(0, 115);
this.chkDisableOamAddrBug.Name = "chkDisableOamAddrBug";
this.chkDisableOamAddrBug.Size = new System.Drawing.Size(311, 23);
this.chkDisableOamAddrBug.TabIndex = 5;
this.chkDisableOamAddrBug.Text = "Disable PPU OAMADDR bug emulation";
//
// frmEmulationConfig
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -838,5 +851,6 @@ namespace Mesen.GUI.Forms.Config
private ctrlRiskyOption chkDisablePpu2004Reads;
private ctrlRiskyOption chkDisableOamAddrBug;
private ctrlRiskyOption chkDisablePaletteRead;
private ctrlRiskyOption chkDisablePpuReset;
}
}

View file

@ -30,6 +30,7 @@ namespace Mesen.GUI.Forms.Config
AddBinding("DisablePpu2004Reads", chkDisablePpu2004Reads);
AddBinding("DisablePaletteRead", chkDisablePaletteRead);
AddBinding("DisableOamAddrBug", chkDisableOamAddrBug);
AddBinding("DisablePpuReset", chkDisablePpuReset);
AddBinding("OverclockRate", nudOverclockRate);
AddBinding("OverclockAdjustApu", chkOverclockAdjustApu);

View file

@ -843,6 +843,7 @@ namespace Mesen.GUI
DisableNoiseModeFlag = 0x8000000,
DisablePaletteRead = 0x10000000,
DisableOamAddrBug = 0x20000000,
DisablePpuReset = 0x40000000,
InBackground = 0x4000000000,
}