From 8ec8e471d5d395cd86361df2e74711478d1361d7 Mon Sep 17 00:00:00 2001 From: Souryo Date: Sat, 25 Feb 2017 10:56:38 -0500 Subject: [PATCH] Input: Added option to emulate NES-101/HVC-101 behavior --- Core/ControlManager.cpp | 29 +++- Core/ControlManager.h | 2 + Core/EmulationSettings.h | 2 + GUI.NET/Config/EmulationInfo.cs | 2 + GUI.NET/Dependencies/resources.es.xml | 1 + GUI.NET/Dependencies/resources.fr.xml | 1 + GUI.NET/Dependencies/resources.ja.xml | 1 + GUI.NET/Dependencies/resources.pt.xml | 1 + GUI.NET/Dependencies/resources.ru.xml | 3 +- GUI.NET/Dependencies/resources.uk.xml | 1 + .../Config/frmEmulationConfig.Designer.cs | 136 ++++++++++-------- GUI.NET/Forms/Config/frmEmulationConfig.cs | 1 + GUI.NET/Forms/Config/frmInputConfig.cs | 17 ++- GUI.NET/InteropEmu.cs | 2 + 14 files changed, 127 insertions(+), 72 deletions(-) diff --git a/Core/ControlManager.cpp b/Core/ControlManager.cpp index 7b135c18..c3d77dad 100644 --- a/Core/ControlManager.cpp +++ b/Core/ControlManager.cpp @@ -140,7 +140,7 @@ void ControlManager::UpdateControlDevices() for(int i = 0; i < 2; i++) { shared_ptr device; - if(fourScore || EmulationSettings::GetConsoleType() == ConsoleType::Famicom) { + if(fourScore || (EmulationSettings::GetConsoleType() == ConsoleType::Famicom && !EmulationSettings::CheckFlag(EmulationFlags::UseNes101Hvc101Behavior))) { //Need to set standard controller in all slots if four score (to allow emulation to work correctly) device.reset(new StandardController(i)); } else { @@ -155,7 +155,9 @@ void ControlManager::UpdateControlDevices() ControlManager::RegisterControlDevice(device, i); if(fourScore) { - std::dynamic_pointer_cast(device)->AddAdditionalController(shared_ptr(new StandardController(i + 2))); + if(EmulationSettings::GetControllerType(i + 2) == ControllerType::StandardController) { + std::dynamic_pointer_cast(device)->AddAdditionalController(shared_ptr(new StandardController(i + 2))); + } } else if(i == 1 || expansionDevice == ExpansionPortDevice::ArkanoidController) { switch(expansionDevice) { case ExpansionPortDevice::Zapper: std::dynamic_pointer_cast(device)->AddAdditionalController(shared_ptr(new Zapper(2))); break; @@ -172,19 +174,38 @@ void ControlManager::UpdateControlDevices() } } +uint8_t ControlManager::GetOpenBusMask(uint8_t port) +{ + switch(EmulationSettings::GetConsoleType()) { + default: + case ConsoleType::Nes: + if(EmulationSettings::CheckFlag(EmulationFlags::UseNes101Hvc101Behavior)) { + return port == 0 ? 0xE4 : 0xE0; + } else { + return 0xE0; + } + + case ConsoleType::Famicom: + if(EmulationSettings::CheckFlag(EmulationFlags::UseNes101Hvc101Behavior)) { + return port == 0 ? 0xF8 : 0xE0; + } else { + return port == 0 ? 0xF8 : 0xE0; + } + } +} + uint8_t ControlManager::GetPortValue(uint8_t port) { if(_refreshState) { //Reload until strobe bit is set to off RefreshAllPorts(); } - shared_ptr device = GetControlDevice(port); //"In the NES and Famicom, the top three (or five) bits are not driven, and so retain the bits of the previous byte on the bus. //Usually this is the most significant byte of the address of the controller port - 0x40. //Paperboy relies on this behavior and requires that reads from the controller ports return exactly $40 or $41 as appropriate." - uint8_t value = MemoryManager::GetOpenBus(0xE0); + uint8_t value = MemoryManager::GetOpenBus(GetOpenBusMask(port)); if(device) { value |= device->GetPortOutput(); } diff --git a/Core/ControlManager.h b/Core/ControlManager.h index f519867b..eb72fa36 100644 --- a/Core/ControlManager.h +++ b/Core/ControlManager.h @@ -29,6 +29,8 @@ class ControlManager : public Snapshotable, public IMemoryHandler bool _isLagging = false; bool _refreshState = false; + uint8_t GetOpenBusMask(uint8_t port); + template shared_ptr GetExpansionDevice(); virtual shared_ptr GetZapper(uint8_t port); diff --git a/Core/EmulationSettings.h b/Core/EmulationSettings.h index 842741e6..5063684a 100644 --- a/Core/EmulationSettings.h +++ b/Core/EmulationSettings.h @@ -44,6 +44,8 @@ enum EmulationFlags : int64_t DisableOamAddrBug = 0x20000000, DisablePpuReset = 0x40000000, + UseNes101Hvc101Behavior = 0x80000000, + Turbo = 0x2000000000, InBackground = 0x4000000000, NsfPlayerEnabled = 0x8000000000, diff --git a/GUI.NET/Config/EmulationInfo.cs b/GUI.NET/Config/EmulationInfo.cs index 1f8732ff..a25a6686 100644 --- a/GUI.NET/Config/EmulationInfo.cs +++ b/GUI.NET/Config/EmulationInfo.cs @@ -20,6 +20,7 @@ namespace Mesen.GUI.Config public bool DisablePaletteRead = false; public bool DisableOamAddrBug = false; public bool DisablePpuReset = false; + public bool UseNes101Hvc101Behavior = false; public bool UseAlternativeMmc3Irq = false; @@ -55,6 +56,7 @@ namespace Mesen.GUI.Config InteropEmu.SetFlag(EmulationFlags.DisablePaletteRead, emulationInfo.DisablePaletteRead); InteropEmu.SetFlag(EmulationFlags.DisableOamAddrBug, emulationInfo.DisableOamAddrBug); InteropEmu.SetFlag(EmulationFlags.DisablePpuReset, emulationInfo.DisablePpuReset); + InteropEmu.SetFlag(EmulationFlags.UseNes101Hvc101Behavior, emulationInfo.UseNes101Hvc101Behavior); InteropEmu.SetOverclockRate(emulationInfo.OverclockRate, emulationInfo.OverclockAdjustApu); InteropEmu.SetPpuNmiConfig(emulationInfo.PpuExtraScanlinesBeforeNmi, emulationInfo.PpuExtraScanlinesAfterNmi); diff --git a/GUI.NET/Dependencies/resources.es.xml b/GUI.NET/Dependencies/resources.es.xml index 1cacc220..51d39142 100644 --- a/GUI.NET/Dependencies/resources.es.xml +++ b/GUI.NET/Dependencies/resources.es.xml @@ -292,6 +292,7 @@ Disable PPU OAMADDR bug emulation Disable PPU palette reads Do not reset PPU when resetting console (Famicom behavior) + Use NES/HVC-101 (Top-loader / AV Famicom) behavior Overclocking Overclocking de CPU diff --git a/GUI.NET/Dependencies/resources.fr.xml b/GUI.NET/Dependencies/resources.fr.xml index bf5f33b6..c54761b6 100644 --- a/GUI.NET/Dependencies/resources.fr.xml +++ b/GUI.NET/Dependencies/resources.fr.xml @@ -292,6 +292,7 @@ Désactiver l'émulation du bug de OAMADDR du PPU Empêcher la lecture de la palette du PPU Ne pas faire un reset du PPU lors du reset de la console (Famicom) + Simuler le comportement du NES/HVC-101 (Top Loader / AV Famicom) État initial de la mémoire au démarrage : diff --git a/GUI.NET/Dependencies/resources.ja.xml b/GUI.NET/Dependencies/resources.ja.xml index a1042025..df538712 100644 --- a/GUI.NET/Dependencies/resources.ja.xml +++ b/GUI.NET/Dependencies/resources.ja.xml @@ -292,6 +292,7 @@ PPUのOAMADDRバグを無効にする PPUのパレットラムを読み込み不可能にする ゲーム機をリセットする時に、PPUをリセットしない (ファミコン同様) + AV仕様ファミコン(HVC-101とNES-101)の仕様を使う 起動時のメモリの状態 : diff --git a/GUI.NET/Dependencies/resources.pt.xml b/GUI.NET/Dependencies/resources.pt.xml index 5130e30b..d543c1af 100644 --- a/GUI.NET/Dependencies/resources.pt.xml +++ b/GUI.NET/Dependencies/resources.pt.xml @@ -292,6 +292,7 @@ Disable PPU OAMADDR bug emulation Disable PPU palette reads Do not reset PPU when resetting console (Famicom behavior) + Use NES/HVC-101 (Top-loader / AV Famicom) behavior Overclocking Overclocking de CPU diff --git a/GUI.NET/Dependencies/resources.ru.xml b/GUI.NET/Dependencies/resources.ru.xml index 126d76c5..0bad6ed5 100644 --- a/GUI.NET/Dependencies/resources.ru.xml +++ b/GUI.NET/Dependencies/resources.ru.xml @@ -293,7 +293,8 @@ Disable PPU OAMADDR bug emulation Disable PPU palette reads Do not reset PPU when resetting console (Famicom behavior) - + Use NES/HVC-101 (Top-loader / AV Famicom) behavior + Разгон Разгон CPU ВНИМАНИЕ: Разгон может вызвать ошибки в некоторых играх! diff --git a/GUI.NET/Dependencies/resources.uk.xml b/GUI.NET/Dependencies/resources.uk.xml index 05c6c5ed..4e7c86a5 100644 --- a/GUI.NET/Dependencies/resources.uk.xml +++ b/GUI.NET/Dependencies/resources.uk.xml @@ -293,6 +293,7 @@ Disable PPU OAMADDR bug emulation Disable PPU palette reads Do not reset PPU when resetting console (Famicom behavior) + Use NES/HVC-101 (Top-loader / AV Famicom) behavior Розгін Розгін CPU diff --git a/GUI.NET/Forms/Config/frmEmulationConfig.Designer.cs b/GUI.NET/Forms/Config/frmEmulationConfig.Designer.cs index 17c2c653..5b367367 100644 --- a/GUI.NET/Forms/Config/frmEmulationConfig.Designer.cs +++ b/GUI.NET/Forms/Config/frmEmulationConfig.Designer.cs @@ -44,10 +44,15 @@ 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.chkDisablePaletteRead = new Mesen.GUI.Controls.ctrlRiskyOption(); + this.chkDisableOamAddrBug = new Mesen.GUI.Controls.ctrlRiskyOption(); + this.chkDisablePpuReset = 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(); @@ -77,11 +82,7 @@ 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.chkUseNes101Hvc101Behavior = new System.Windows.Forms.CheckBox(); this.tabMain.SuspendLayout(); this.tpgGeneral.SuspendLayout(); this.tableLayoutPanel4.SuspendLayout(); @@ -258,25 +259,27 @@ namespace Mesen.GUI.Forms.Config // this.tableLayoutPanel1.ColumnCount = 1; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - 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, 7); + this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel8, 0, 8); this.tableLayoutPanel1.Controls.Add(this.chkDisablePaletteRead, 0, 6); this.tableLayoutPanel1.Controls.Add(this.chkDisableOamAddrBug, 0, 5); this.tableLayoutPanel1.Controls.Add(this.chkDisablePpuReset, 0, 3); this.tableLayoutPanel1.Controls.Add(this.chkDisablePpu2004Reads, 0, 4); + this.tableLayoutPanel1.Controls.Add(this.chkUseNes101Hvc101Behavior, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.chkAllowInvalidInput, 0, 7); + this.tableLayoutPanel1.Controls.Add(this.chkUseAlternativeMmc3Irq, 0, 2); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 3); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 9; + this.tableLayoutPanel1.RowCount = 10; + 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()); 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); @@ -285,13 +288,24 @@ namespace Mesen.GUI.Forms.Config // chkUseAlternativeMmc3Irq // this.chkUseAlternativeMmc3Irq.AutoSize = true; - this.chkUseAlternativeMmc3Irq.Location = new System.Drawing.Point(3, 26); + this.chkUseAlternativeMmc3Irq.Location = new System.Drawing.Point(3, 49); this.chkUseAlternativeMmc3Irq.Name = "chkUseAlternativeMmc3Irq"; this.chkUseAlternativeMmc3Irq.Size = new System.Drawing.Size(197, 17); this.chkUseAlternativeMmc3Irq.TabIndex = 0; 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, 161); + 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; @@ -307,7 +321,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, 158); + this.flowLayoutPanel8.Location = new System.Drawing.Point(0, 184); this.flowLayoutPanel8.Margin = new System.Windows.Forms.Padding(0); this.flowLayoutPanel8.Name = "flowLayoutPanel8"; this.flowLayoutPanel8.Size = new System.Drawing.Size(519, 27); @@ -332,6 +346,46 @@ namespace Mesen.GUI.Forms.Config this.cboRamPowerOnState.Size = new System.Drawing.Size(176, 21); this.cboRamPowerOnState.TabIndex = 1; // + // 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, 23); + this.chkDisablePaletteRead.TabIndex = 6; + this.chkDisablePaletteRead.Text = "Disable PPU palette reads"; + // + // 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"; + // + // 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)"; + // + // 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)"; + // // tpgOverclocking // this.tpgOverclocking.Controls.Add(this.tableLayoutPanel3); @@ -693,56 +747,15 @@ namespace Mesen.GUI.Forms.Config this.tmrUpdateClockRate.Enabled = true; this.tmrUpdateClockRate.Tick += new System.EventHandler(this.tmrUpdateClockRate_Tick); // - // chkAllowInvalidInput + // chkUseNes101Hvc101Behavior // - 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"; + this.chkUseNes101Hvc101Behavior.AutoSize = true; + this.chkUseNes101Hvc101Behavior.Location = new System.Drawing.Point(3, 26); + this.chkUseNes101Hvc101Behavior.Name = "chkUseNes101Hvc101Behavior"; + this.chkUseNes101Hvc101Behavior.Size = new System.Drawing.Size(318, 17); + this.chkUseNes101Hvc101Behavior.TabIndex = 8; + this.chkUseNes101Hvc101Behavior.Text = "Use NES/HVC-101 (Top-loader / AV Famicom) behavior"; + this.chkUseNes101Hvc101Behavior.UseVisualStyleBackColor = true; // // frmEmulationConfig // @@ -852,5 +865,6 @@ namespace Mesen.GUI.Forms.Config private ctrlRiskyOption chkDisableOamAddrBug; private ctrlRiskyOption chkDisablePaletteRead; private ctrlRiskyOption chkDisablePpuReset; + private System.Windows.Forms.CheckBox chkUseNes101Hvc101Behavior; } } \ No newline at end of file diff --git a/GUI.NET/Forms/Config/frmEmulationConfig.cs b/GUI.NET/Forms/Config/frmEmulationConfig.cs index 444de3a2..8f88cd3c 100644 --- a/GUI.NET/Forms/Config/frmEmulationConfig.cs +++ b/GUI.NET/Forms/Config/frmEmulationConfig.cs @@ -31,6 +31,7 @@ namespace Mesen.GUI.Forms.Config AddBinding("DisablePaletteRead", chkDisablePaletteRead); AddBinding("DisableOamAddrBug", chkDisableOamAddrBug); AddBinding("DisablePpuReset", chkDisablePpuReset); + AddBinding("UseNes101Hvc101Behavior", chkUseNes101Hvc101Behavior); AddBinding("OverclockRate", nudOverclockRate); AddBinding("OverclockAdjustApu", chkOverclockAdjustApu); diff --git a/GUI.NET/Forms/Config/frmInputConfig.cs b/GUI.NET/Forms/Config/frmInputConfig.cs index 581690f4..96627bf4 100644 --- a/GUI.NET/Forms/Config/frmInputConfig.cs +++ b/GUI.NET/Forms/Config/frmInputConfig.cs @@ -56,22 +56,27 @@ namespace Mesen.GUI.Forms.Config bool p3and4visible = (isNes && chkFourScore.Checked) || (!isNes && ((InputInfo)Entity).ExpansionPortDevice == InteropEmu.ExpansionPortDevice.FourPlayerAdapter); List controllerTypes = new List(new InteropEmu.ControllerType[] { InteropEmu.ControllerType.StandardController }); - SetAvailableControllerTypes(cboPlayer3, controllerTypes.ToArray()); - SetAvailableControllerTypes(cboPlayer4, controllerTypes.ToArray()); + SetAvailableControllerTypes(cboPlayer3, controllerTypes.ToArray(), false); + SetAvailableControllerTypes(cboPlayer4, controllerTypes.ToArray(), false); if(isNes && !chkFourScore.Checked) { controllerTypes.Add(InteropEmu.ControllerType.Zapper); controllerTypes.Add(InteropEmu.ControllerType.ArkanoidController); } - SetAvailableControllerTypes(cboPlayer1, controllerTypes.ToArray()); - SetAvailableControllerTypes(cboPlayer2, controllerTypes.ToArray()); + + bool isOriginalFamicom = !isNes && !ConfigManager.Config.EmulationInfo.UseNes101Hvc101Behavior; + + SetAvailableControllerTypes(cboPlayer1, controllerTypes.ToArray(), isOriginalFamicom); + SetAvailableControllerTypes(cboPlayer2, controllerTypes.ToArray(), isOriginalFamicom); } - private void SetAvailableControllerTypes(ComboBox comboBox, InteropEmu.ControllerType[] controllerTypes) + private void SetAvailableControllerTypes(ComboBox comboBox, InteropEmu.ControllerType[] controllerTypes, bool forceController) { object currentSelection = comboBox.SelectedItem; comboBox.Items.Clear(); - comboBox.Items.Add(ResourceHelper.GetEnumText(InteropEmu.ControllerType.None)); + if(!forceController) { + comboBox.Items.Add(ResourceHelper.GetEnumText(InteropEmu.ControllerType.None)); + } foreach(InteropEmu.ControllerType type in controllerTypes) { comboBox.Items.Add(ResourceHelper.GetEnumText(type)); } diff --git a/GUI.NET/InteropEmu.cs b/GUI.NET/InteropEmu.cs index c5b9bf17..bf5b0112 100644 --- a/GUI.NET/InteropEmu.cs +++ b/GUI.NET/InteropEmu.cs @@ -845,6 +845,8 @@ namespace Mesen.GUI DisableOamAddrBug = 0x20000000, DisablePpuReset = 0x40000000, + UseNes101Hvc101Behavior = 0x80000000, + InBackground = 0x4000000000, }