SubNESHawk:
- Use NES settings for controllers / sync settings - Clean up un-needed extra controller code - Enable Menues
This commit is contained in:
parent
9fdeb9f5eb
commit
5256284ac6
|
@ -10,6 +10,7 @@ using BizHawk.Emulation.Cores.Atari.A7800Hawk;
|
|||
using BizHawk.Emulation.Cores.Calculators;
|
||||
using BizHawk.Emulation.Cores.ColecoVision;
|
||||
using BizHawk.Emulation.Cores.Nintendo.NES;
|
||||
using BizHawk.Emulation.Cores.Nintendo.SubNESHawk;
|
||||
using BizHawk.Emulation.Cores.Nintendo.N64;
|
||||
using BizHawk.Emulation.Cores.Nintendo.SNES;
|
||||
using BizHawk.Emulation.Cores.Nintendo.SNES9X;
|
||||
|
@ -1634,6 +1635,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
new NESGraphicsConfig().ShowDialog(this);
|
||||
}
|
||||
else if (Emulator is SubNESHawk)
|
||||
{
|
||||
new NESGraphicsConfig().ShowDialog(this);
|
||||
}
|
||||
else if (Emulator is QuickNES)
|
||||
{
|
||||
new QuickNesConfig().ShowDialog(this);
|
||||
|
@ -1704,6 +1709,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
new NesControllerSettings().ShowDialog();
|
||||
}
|
||||
else if (Emulator is SubNESHawk)
|
||||
{
|
||||
new NesControllerSettings().ShowDialog();
|
||||
}
|
||||
else if (Emulator is QuickNES)
|
||||
{
|
||||
GenericCoreConfig.DoDialog(this, "QuickNES Controller Settings", true, false);
|
||||
|
|
|
@ -5,6 +5,7 @@ using System.Windows.Forms;
|
|||
using BizHawk.Common;
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Cores.Nintendo.NES;
|
||||
using BizHawk.Emulation.Cores.Nintendo.SubNESHawk;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
|
@ -15,6 +16,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
// Hotkeys for BG & Sprite display toggle
|
||||
// NTSC filter settings? Hue, Tint (This should probably be a client thing, not a nes specific thing?)
|
||||
private NES _nes;
|
||||
private SubNESHawk _subneshawk;
|
||||
private NES.NESSettings _settings;
|
||||
private Bitmap _bmp;
|
||||
|
||||
|
@ -25,8 +27,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void NESGraphicsConfig_Load(object sender, EventArgs e)
|
||||
{
|
||||
_nes = (NES)Global.Emulator;
|
||||
_settings = _nes.GetSettings();
|
||||
if (Global.Emulator is NES)
|
||||
{
|
||||
_nes = (NES)Global.Emulator;
|
||||
_settings = _nes.GetSettings();
|
||||
}
|
||||
else
|
||||
{
|
||||
_subneshawk = (SubNESHawk)Global.Emulator;
|
||||
_settings = _subneshawk.GetSettings();
|
||||
}
|
||||
|
||||
LoadStuff();
|
||||
}
|
||||
|
||||
|
@ -146,7 +157,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
_settings.BackgroundColor &= 0x00FFFFFF;
|
||||
}
|
||||
|
||||
_nes.PutSettings(_settings);
|
||||
if (Global.Emulator is NES)
|
||||
{
|
||||
_nes.PutSettings(_settings);
|
||||
}
|
||||
else
|
||||
{
|
||||
_subneshawk.PutSettings(_settings);
|
||||
}
|
||||
|
||||
Close();
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.Windows.Forms;
|
|||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Cores.Nintendo.NES;
|
||||
using BizHawk.Emulation.Cores.Nintendo.SubNESHawk;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
|
@ -14,7 +15,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
public NesControllerSettings()
|
||||
{
|
||||
InitializeComponent();
|
||||
_syncSettings = ((NES)Global.Emulator).GetSyncSettings();
|
||||
if (Global.Emulator is NES)
|
||||
{
|
||||
_syncSettings = ((NES)Global.Emulator).GetSyncSettings();
|
||||
}
|
||||
else
|
||||
{
|
||||
_syncSettings = ((SubNESHawk)Global.Emulator).GetSyncSettings();
|
||||
}
|
||||
|
||||
|
||||
// TODO: use combobox extension and add descriptions to enum values
|
||||
comboBoxFamicom.Items.AddRange(NESControlSettings.GetFamicomExpansionValues().ToArray());
|
||||
|
|
|
@ -317,9 +317,9 @@
|
|||
<Compile Include="Computers\Commodore64\SaveState.cs" />
|
||||
<Compile Include="Computers\Commodore64\User\UserPortDevice.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Hardware\Abstraction\IFDDHost.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Hardware\Input\StandardKeyboard.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Hardware\Input\StandardKeyboard.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Hardware\SoundOuput\AY38912.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Hardware\SoundOuput\Beeper.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Hardware\SoundOuput\Beeper.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Media\Disk\FloppyDisk.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Hardware\Abstraction\IJoystick.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Hardware\Abstraction\IPortIODevice.cs" />
|
||||
|
@ -327,23 +327,23 @@
|
|||
<Compile Include="Computers\SinclairSpectrum\Hardware\Disk\CHRN.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Hardware\Disk\NECUPD765.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Hardware\Disk\NECUPD765.Definitions.cs">
|
||||
<DependentUpon>NECUPD765.cs</DependentUpon>
|
||||
</Compile>
|
||||
<DependentUpon>NECUPD765.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\Hardware\Disk\NECUPD765.FDC.cs">
|
||||
<DependentUpon>NECUPD765.cs</DependentUpon>
|
||||
</Compile>
|
||||
<DependentUpon>NECUPD765.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\Hardware\Disk\NECUPD765.FDD.cs">
|
||||
<DependentUpon>NECUPD765.cs</DependentUpon>
|
||||
</Compile>
|
||||
<DependentUpon>NECUPD765.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\Hardware\Disk\NECUPD765.IPortIODevice.cs">
|
||||
<DependentUpon>NECUPD765.cs</DependentUpon>
|
||||
</Compile>
|
||||
<DependentUpon>NECUPD765.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\Hardware\Disk\NECUPD765.Timing.cs">
|
||||
<DependentUpon>NECUPD765.cs</DependentUpon>
|
||||
</Compile>
|
||||
<DependentUpon>NECUPD765.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\Hardware\Disk\NECUPS765.Static.cs">
|
||||
<DependentUpon>NECUPD765.cs</DependentUpon>
|
||||
</Compile>
|
||||
<DependentUpon>NECUPD765.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\Hardware\Input\CursorJoystick.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Hardware\Input\SinclairJoystick2.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Hardware\Input\SinclairJoystick1.cs" />
|
||||
|
@ -375,93 +375,93 @@
|
|||
<Compile Include="Computers\SinclairSpectrum\Machine\MachineType.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\SpectrumBase.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\SpectrumBase.Input.cs">
|
||||
<DependentUpon>SpectrumBase.cs</DependentUpon>
|
||||
</Compile>
|
||||
<DependentUpon>SpectrumBase.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\SpectrumBase.Port.cs">
|
||||
<DependentUpon>SpectrumBase.cs</DependentUpon>
|
||||
</Compile>
|
||||
<DependentUpon>SpectrumBase.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\SpectrumBase.Memory.cs">
|
||||
<DependentUpon>SpectrumBase.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\SpectrumBase.Media.cs">
|
||||
<DependentUpon>SpectrumBase.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\ULA.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\CPUMonitor.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum48K\ZX48.cs" />
|
||||
<DependentUpon>SpectrumBase.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\SpectrumBase.Media.cs">
|
||||
<DependentUpon>SpectrumBase.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\ULA.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\CPUMonitor.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum48K\ZX48.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum48K\ZX48.Memory.cs">
|
||||
<DependentUpon>ZX48.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum48K\ZX48.Port.cs">
|
||||
<DependentUpon>ZX48.cs</DependentUpon>
|
||||
</Compile>
|
||||
<DependentUpon>ZX48.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum48K\ZX48.Port.cs">
|
||||
<DependentUpon>ZX48.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum48K\ZX48.Screen.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum16K\ZX16.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum128K\ZX128.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum16K\ZX16.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum128K\ZX128.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum128K\ZX128.Memory.cs">
|
||||
<DependentUpon>ZX128.cs</DependentUpon>
|
||||
</Compile>
|
||||
<DependentUpon>ZX128.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum128K\ZX128.Port.cs">
|
||||
<DependentUpon>ZX128.cs</DependentUpon>
|
||||
</Compile>
|
||||
<DependentUpon>ZX128.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum128K\ZX128.Screen.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum128KPlus2\ZX128Plus2.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum128KPlus2a\ZX128Plus2a.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum128KPlus2\ZX128Plus2.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum128KPlus2a\ZX128Plus2a.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum128KPlus2a\ZX128Plus2a.Memory.cs">
|
||||
<DependentUpon>ZX128Plus2a.cs</DependentUpon>
|
||||
</Compile>
|
||||
<DependentUpon>ZX128Plus2a.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum128KPlus2a\ZX128Plus2a.Port.cs">
|
||||
<DependentUpon>ZX128Plus2a.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum128KPlus2a\ZX128Plus2a.Screen.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum128KPlus3\ZX128Plus3.cs" />
|
||||
<DependentUpon>ZX128Plus2a.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum128KPlus2a\ZX128Plus2a.Screen.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum128KPlus3\ZX128Plus3.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum128KPlus3\ZX128Plus3.Memory.cs">
|
||||
<DependentUpon>ZX128Plus3.cs</DependentUpon>
|
||||
</Compile>
|
||||
<DependentUpon>ZX128Plus3.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum128KPlus3\ZX128Plus3.Port.cs">
|
||||
<DependentUpon>ZX128Plus3.cs</DependentUpon>
|
||||
</Compile>
|
||||
<DependentUpon>ZX128Plus3.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\Pentagon128K\Pentagon128.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\Pentagon128K\Pentagon128.Memory.cs">
|
||||
<DependentUpon>Pentagon128.cs</DependentUpon>
|
||||
</Compile>
|
||||
<DependentUpon>Pentagon128.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\Pentagon128K\Pentagon128.Port.cs">
|
||||
<DependentUpon>Pentagon128.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\Pentagon128K\Pentagon128.Screen.cs" />
|
||||
<None Include="Computers\SinclairSpectrum\readme.md" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Hardware\Rom\RomData.cs" />
|
||||
<DependentUpon>Pentagon128.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\Machine\Pentagon128K\Pentagon128.Screen.cs" />
|
||||
<None Include="Computers\SinclairSpectrum\readme.md" />
|
||||
<Compile Include="Computers\SinclairSpectrum\Hardware\Rom\RomData.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\ZXSpectrum.cs" />
|
||||
<Compile Include="Computers\SinclairSpectrum\ZXSpectrum.IDebuggable.cs">
|
||||
<DependentUpon>ZXSpectrum.cs</DependentUpon>
|
||||
</Compile>
|
||||
<DependentUpon>ZXSpectrum.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\ZXSpectrum.IEmulator.cs">
|
||||
<DependentUpon>ZXSpectrum.cs</DependentUpon>
|
||||
</Compile>
|
||||
<DependentUpon>ZXSpectrum.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\ZXSpectrum.IInputPollable.cs">
|
||||
<DependentUpon>ZXSpectrum.cs</DependentUpon>
|
||||
</Compile>
|
||||
<DependentUpon>ZXSpectrum.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\ZXSpectrum.ICodeDataLog.cs">
|
||||
<DependentUpon>ZXSpectrum.cs</DependentUpon>
|
||||
</Compile>
|
||||
<DependentUpon>ZXSpectrum.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\ZXSpectrum.IMemoryDomains.cs">
|
||||
<DependentUpon>ZXSpectrum.cs</DependentUpon>
|
||||
</Compile>
|
||||
<DependentUpon>ZXSpectrum.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\ZXSpectrum.ISettable.cs">
|
||||
<DependentUpon>ZXSpectrum.cs</DependentUpon>
|
||||
</Compile>
|
||||
<DependentUpon>ZXSpectrum.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\ZXSpectrum.IStatable.cs">
|
||||
<DependentUpon>ZXSpectrum.cs</DependentUpon>
|
||||
</Compile>
|
||||
<DependentUpon>ZXSpectrum.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\ZXSpectrum.Messaging.cs">
|
||||
<DependentUpon>ZXSpectrum.cs</DependentUpon>
|
||||
</Compile>
|
||||
<DependentUpon>ZXSpectrum.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\ZXSpectrum.Util.cs">
|
||||
<DependentUpon>ZXSpectrum.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\ZXSpectrum.Controllers.cs">
|
||||
<DependentUpon>ZXSpectrum.cs</DependentUpon>
|
||||
</Compile>
|
||||
<DependentUpon>ZXSpectrum.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\SinclairSpectrum\ZXSpectrum.Controllers.cs">
|
||||
<DependentUpon>ZXSpectrum.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Consoles\Atari\2600\Atari2600.cs" />
|
||||
<Compile Include="Consoles\Atari\2600\Atari2600.Core.cs">
|
||||
<DependentUpon>Atari2600.cs</DependentUpon>
|
||||
|
@ -789,7 +789,7 @@
|
|||
<DependentUpon>VBANext.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Consoles\Nintendo\GBA\VBARegisterHelper.cs" />
|
||||
<Compile Include="Consoles\Nintendo\GBHawkLink\GBHawkLink.cs" />
|
||||
<Compile Include="Consoles\Nintendo\GBHawkLink\GBHawkLink.cs" />
|
||||
<Compile Include="Consoles\Nintendo\GBHawkLink\GBHawkLink.ICodeDataLog.cs" />
|
||||
<Compile Include="Consoles\Nintendo\GBHawkLink\GBHawkLink.IDebuggable.cs">
|
||||
<DependentUpon>GBHawkLink.cs</DependentUpon>
|
||||
|
@ -1201,7 +1201,7 @@
|
|||
<Compile Include="Consoles\Nintendo\NES\PPU.regs.cs" />
|
||||
<Compile Include="Consoles\Nintendo\NES\PPU.run.cs" />
|
||||
<Compile Include="Consoles\Nintendo\NES\Unif.cs" />
|
||||
<Compile Include="Consoles\Nintendo\SubNESHawk\SubNESHawk.cs" />
|
||||
<Compile Include="Consoles\Nintendo\SubNESHawk\SubNESHawk.cs" />
|
||||
<Compile Include="Consoles\Nintendo\SubNESHawk\SubNESHawk.IDebuggable.cs">
|
||||
<DependentUpon>SubNESHawk.cs</DependentUpon>
|
||||
</Compile>
|
||||
|
@ -1217,14 +1217,9 @@
|
|||
<Compile Include="Consoles\Nintendo\SubNESHawk\SubNESHawk.ISaveRam.cs">
|
||||
<DependentUpon>SubNESHawk.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Consoles\Nintendo\SubNESHawk\SubNESHawk.ISettable.cs">
|
||||
<DependentUpon>SubNESHawk.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Consoles\Nintendo\SubNESHawk\SubNESHawk.IStatable.cs">
|
||||
<DependentUpon>SubNESHawk.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Consoles\Nintendo\SubNESHawk\SubNESHawkControllerDeck.cs" />
|
||||
<Compile Include="Consoles\Nintendo\SubNESHawk\SubNESHawkControllers.cs" />
|
||||
<Compile Include="Consoles\Nintendo\QuickNES\LibQuickNES.cs" />
|
||||
<Compile Include="Consoles\Nintendo\QuickNES\Nes_NTSC_Colors.cs" />
|
||||
<Compile Include="Consoles\Nintendo\QuickNES\QuickNES.cs" />
|
||||
|
|
|
@ -419,17 +419,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
public bool current_strobe;
|
||||
public bool new_strobe;
|
||||
public bool alt_lag;
|
||||
public byte ctrl_1 = 0;
|
||||
public byte ctrl_2 = 0;
|
||||
public byte ctrl_1_new = 0;
|
||||
public byte ctrl_2_new = 0;
|
||||
public int shift_1;
|
||||
public int shift_2;
|
||||
public bool use_sub_input = false;
|
||||
// this function will run one step of the ppu
|
||||
// it will return whether the controller is read or not.
|
||||
public void do_single_step(out bool cont_read, out bool frame_done)
|
||||
public void do_single_step(IController controller, out bool cont_read, out bool frame_done)
|
||||
{
|
||||
_controller = controller;
|
||||
|
||||
controller_was_latched = false;
|
||||
frame_is_done = false;
|
||||
|
||||
|
@ -779,21 +774,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
{
|
||||
controller_was_latched = true;
|
||||
alt_lag = false;
|
||||
|
||||
if (use_sub_input)
|
||||
{
|
||||
shift_1 = 7;
|
||||
shift_2 = 7;
|
||||
|
||||
ctrl_1 = ctrl_1_new;
|
||||
ctrl_2 = ctrl_2_new;
|
||||
}
|
||||
}
|
||||
|
||||
if (use_sub_input && new_strobe)
|
||||
{
|
||||
shift_1 = 7;
|
||||
shift_2 = 7;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -803,36 +783,16 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
lagged = false;
|
||||
byte ret = 0;
|
||||
|
||||
if (use_sub_input)
|
||||
if (_isVS)
|
||||
{
|
||||
if (addr == 0x4016)
|
||||
{
|
||||
if (shift_1 >= 0) { ret = (byte)((ctrl_1 >> shift_1) & 1); }
|
||||
else { ret = 1; }
|
||||
|
||||
if (!current_strobe) { shift_1 -= 1; }
|
||||
}
|
||||
else
|
||||
{
|
||||
if (shift_2 >= 0) { ret = (byte)((ctrl_2 >> shift_2) & 1); }
|
||||
else { ret = 1; }
|
||||
|
||||
if (!current_strobe) { shift_2 -= 1; }
|
||||
}
|
||||
// for whatever reason, in VS left and right controller have swapped regs
|
||||
ret = addr == 0x4017 ? ControllerDeck.ReadA(_controller) : ControllerDeck.ReadB(_controller);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_isVS)
|
||||
{
|
||||
// for whatever reason, in VS left and right controller have swapped regs
|
||||
ret = addr == 0x4017 ? ControllerDeck.ReadA(_controller) : ControllerDeck.ReadB(_controller);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = addr == 0x4016 ? ControllerDeck.ReadA(_controller) : ControllerDeck.ReadB(_controller);
|
||||
}
|
||||
ret = addr == 0x4016 ? ControllerDeck.ReadA(_controller) : ControllerDeck.ReadB(_controller);
|
||||
}
|
||||
|
||||
|
||||
ret &= 0x1f;
|
||||
ret |= (byte)(0xe0 & DB);
|
||||
return ret;
|
||||
|
|
|
@ -85,11 +85,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
// single cycle execution related
|
||||
ser.Sync("current_strobe", ref current_strobe);
|
||||
ser.Sync("new_strobe", ref new_strobe);
|
||||
ser.Sync("ctrl_1", ref ctrl_1);
|
||||
ser.Sync("ctrl_2", ref ctrl_2);
|
||||
ser.Sync("shift_1", ref shift_1);
|
||||
ser.Sync("shift_2", ref shift_2);
|
||||
ser.Sync("use_sub_input", ref use_sub_input);
|
||||
|
||||
ser.BeginSection("Board");
|
||||
Board.SyncState(ser);
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
|||
{
|
||||
public IEmulatorServiceProvider ServiceProvider { get; }
|
||||
|
||||
public ControllerDefinition ControllerDefinition => _controllerDeck.Definition;
|
||||
public ControllerDefinition ControllerDefinition => subnes.ControllerDefinition;
|
||||
|
||||
public bool FrameAdvance(IController controller, bool render, bool rendersound)
|
||||
{
|
||||
|
@ -38,9 +38,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
|||
_islag = true;
|
||||
subnes.alt_lag = true;
|
||||
|
||||
GetControllerState(controller);
|
||||
InputCallbacks.Call();
|
||||
|
||||
do_frame();
|
||||
do_frame(controller);
|
||||
|
||||
bool ret = pass_a_frame;
|
||||
|
||||
|
@ -62,31 +62,18 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
|||
public bool stop_cur_frame;
|
||||
public bool pass_new_input;
|
||||
public bool pass_a_frame;
|
||||
public byte ctrl_byte_1;
|
||||
public byte ctrl_byte_2;
|
||||
|
||||
public void do_frame()
|
||||
public void do_frame(IController controller)
|
||||
{
|
||||
stop_cur_frame = false;
|
||||
while (!stop_cur_frame)
|
||||
{
|
||||
subnes.do_single_step(out pass_new_input, out pass_a_frame);
|
||||
subnes.do_single_step(controller, out pass_new_input, out pass_a_frame);
|
||||
stop_cur_frame |= pass_a_frame;
|
||||
stop_cur_frame |= pass_new_input;
|
||||
}
|
||||
}
|
||||
|
||||
public void GetControllerState(IController controller)
|
||||
{
|
||||
InputCallbacks.Call();
|
||||
|
||||
ctrl_byte_1 = _controllerDeck.ReadPort1(controller);
|
||||
ctrl_byte_2 = _controllerDeck.ReadPort2(controller);
|
||||
|
||||
subnes.ctrl_1_new = ctrl_byte_1;
|
||||
subnes.ctrl_2_new = ctrl_byte_2;
|
||||
}
|
||||
|
||||
public int Frame => _frame;
|
||||
|
||||
public string SystemId => "NES";
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
using System;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Cores.Nintendo.NES;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
||||
{
|
||||
public partial class SubNESHawk : IEmulator, IStatable, ISettable<SubNESHawk.SubNESHawkSettings, SubNESHawk.SubNESHawkSyncSettings>
|
||||
{
|
||||
public SubNESHawkSettings GetSettings()
|
||||
{
|
||||
return subnesSettings.Clone();
|
||||
}
|
||||
|
||||
public SubNESHawkSyncSettings GetSyncSettings()
|
||||
{
|
||||
return subnesSyncSettings.Clone();
|
||||
}
|
||||
|
||||
public bool PutSettings(SubNESHawkSettings o)
|
||||
{
|
||||
subnesSettings = o;
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool PutSyncSettings(SubNESHawkSyncSettings o)
|
||||
{
|
||||
bool ret = SubNESHawkSyncSettings.NeedsReboot(subnesSyncSettings, o);
|
||||
subnesSyncSettings = o;
|
||||
return ret;
|
||||
}
|
||||
|
||||
private SubNESHawkSettings subnesSettings = new SubNESHawkSettings();
|
||||
public SubNESHawkSyncSettings subnesSyncSettings = new SubNESHawkSyncSettings();
|
||||
|
||||
public class SubNESHawkSettings
|
||||
{
|
||||
public SubNESHawkSettings Clone()
|
||||
{
|
||||
return (SubNESHawkSettings)MemberwiseClone();
|
||||
}
|
||||
}
|
||||
|
||||
public class SubNESHawkSyncSettings
|
||||
{
|
||||
public SubNESHawkSyncSettings Clone()
|
||||
{
|
||||
return (SubNESHawkSyncSettings)MemberwiseClone();
|
||||
}
|
||||
|
||||
public static bool NeedsReboot(SubNESHawkSyncSettings x, SubNESHawkSyncSettings y)
|
||||
{
|
||||
return !DeepEquality.DeepEquals(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -54,10 +54,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
|||
ser.Sync("IsLag", ref _islag);
|
||||
ser.Sync("pass_a_frame", ref pass_a_frame);
|
||||
ser.Sync("pass_new_input", ref pass_new_input);
|
||||
ser.Sync("ctrl_byte_1", ref ctrl_byte_1);
|
||||
ser.Sync("ctrl_byte_2", ref ctrl_byte_2);
|
||||
|
||||
_controllerDeck.SyncState(ser);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
|||
isReleased: false)]
|
||||
[ServiceNotApplicable(typeof(IDriveLight))]
|
||||
public partial class SubNESHawk : IEmulator, ISaveRam, IDebuggable, IStatable, IInputPollable, IRegionable,
|
||||
ISettable<SubNESHawk.SubNESHawkSettings, SubNESHawk.SubNESHawkSyncSettings>, INESPPUViewable
|
||||
ISettable<NES.NES.NESSettings, NES.NES.NESSyncSettings>, INESPPUViewable
|
||||
{
|
||||
public NES.NES subnes;
|
||||
|
||||
|
@ -22,18 +22,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
|||
{
|
||||
var ser = new BasicServiceProvider(this);
|
||||
|
||||
subnesSettings = (SubNESHawkSettings)settings ?? new SubNESHawkSettings();
|
||||
subnesSyncSettings = (SubNESHawkSyncSettings)syncSettings ?? new SubNESHawkSyncSettings();
|
||||
_controllerDeck = new SubNESHawkControllerDeck(SubNESHawkControllerDeck.DefaultControllerName, SubNESHawkControllerDeck.DefaultControllerName);
|
||||
subnesSettings = (NES.NES.NESSettings)settings ?? new NES.NES.NESSettings();
|
||||
subnesSyncSettings = (NES.NES.NESSyncSettings)syncSettings ?? new NES.NES.NESSyncSettings();
|
||||
|
||||
CoreComm = comm;
|
||||
|
||||
var temp_set = new NES.NES.NESSettings();
|
||||
|
||||
var temp_sync = new NES.NES.NESSyncSettings();
|
||||
|
||||
subnes = new NES.NES(new CoreComm(comm.ShowMessage, comm.Notify) { CoreFileProvider = comm.CoreFileProvider },
|
||||
game, rom, temp_set, temp_sync);
|
||||
game, rom, subnesSettings, subnesSyncSettings);
|
||||
|
||||
ser.Register<IVideoProvider>(subnes.videoProvider);
|
||||
ser.Register<ISoundProvider>(subnes.magicSoundProvider);
|
||||
|
@ -46,9 +41,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
|||
SetupMemoryDomains();
|
||||
|
||||
HardReset();
|
||||
|
||||
// input override for subframe input
|
||||
subnes.use_sub_input = true;
|
||||
}
|
||||
|
||||
public void HardReset()
|
||||
|
@ -68,8 +60,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
|||
|
||||
public int _frame = 0;
|
||||
|
||||
private readonly SubNESHawkControllerDeck _controllerDeck;
|
||||
|
||||
private readonly ITraceable _tracer;
|
||||
|
||||
private void ExecFetch(ushort addr)
|
||||
|
@ -77,6 +67,52 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
|||
MemoryCallbacks.CallExecutes(addr, "System Bus");
|
||||
}
|
||||
|
||||
#region ISettable
|
||||
private NES.NES.NESSettings subnesSettings = new NES.NES.NESSettings();
|
||||
public NES.NES.NESSyncSettings subnesSyncSettings = new NES.NES.NESSyncSettings();
|
||||
|
||||
public NES.NES.NESSettings GetSettings()
|
||||
{
|
||||
return subnesSettings.Clone();
|
||||
}
|
||||
|
||||
public NES.NES.NESSyncSettings GetSyncSettings()
|
||||
{
|
||||
return subnesSyncSettings.Clone();
|
||||
}
|
||||
|
||||
public bool PutSettings(NES.NES.NESSettings o)
|
||||
{
|
||||
subnesSettings = o;
|
||||
if (subnesSettings.ClipLeftAndRight)
|
||||
{
|
||||
subnes.videoProvider.left = 8;
|
||||
subnes.videoProvider.right = 247;
|
||||
}
|
||||
else
|
||||
{
|
||||
subnes.videoProvider.left = 0;
|
||||
subnes.videoProvider.right = 255;
|
||||
}
|
||||
|
||||
CoreComm.ScreenLogicalOffsetX = subnes.videoProvider.left;
|
||||
CoreComm.ScreenLogicalOffsetY = Region == DisplayType.NTSC ? subnesSettings.NTSC_TopLine : subnesSettings.PAL_TopLine;
|
||||
|
||||
subnes.SetPalette(subnesSettings.Palette);
|
||||
|
||||
subnes.apu.m_vol = subnesSettings.APU_vol;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool PutSyncSettings(NES.NES.NESSyncSettings o)
|
||||
{
|
||||
bool ret = NES.NES.NESSyncSettings.NeedsReboot(subnesSyncSettings, o);
|
||||
subnesSyncSettings = o;
|
||||
return ret;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region PPU Viewable
|
||||
|
||||
public int[] GetPalette()
|
||||
|
|
|
@ -1,89 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Common.ReflectionExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
||||
{
|
||||
public class SubNESHawkControllerDeck
|
||||
{
|
||||
public SubNESHawkControllerDeck(string controller1Name, string controller2Name)
|
||||
{
|
||||
if (!ValidControllerTypes.ContainsKey(controller1Name))
|
||||
{
|
||||
throw new InvalidOperationException("Invalid controller type: " + controller1Name);
|
||||
}
|
||||
|
||||
if (!ValidControllerTypes.ContainsKey(controller2Name))
|
||||
{
|
||||
throw new InvalidOperationException("Invalid controller type: " + controller2Name);
|
||||
}
|
||||
|
||||
Port1 = (IPort)Activator.CreateInstance(ValidControllerTypes[controller1Name], 1);
|
||||
Port2 = (IPort)Activator.CreateInstance(ValidControllerTypes[controller2Name], 2);
|
||||
|
||||
Definition = new ControllerDefinition
|
||||
{
|
||||
Name = Port1.Definition.Name,
|
||||
BoolButtons = Port1.Definition.BoolButtons
|
||||
.Concat(Port2.Definition.BoolButtons)
|
||||
.Concat(new[]
|
||||
{
|
||||
"Power",
|
||||
"Reset",
|
||||
})
|
||||
.ToList()
|
||||
};
|
||||
}
|
||||
|
||||
public byte ReadPort1(IController c)
|
||||
{
|
||||
return Port1.Read(c);
|
||||
}
|
||||
|
||||
public byte ReadPort2(IController c)
|
||||
{
|
||||
return Port2.Read(c);
|
||||
}
|
||||
|
||||
public ControllerDefinition Definition { get; }
|
||||
|
||||
public void SyncState(Serializer ser)
|
||||
{
|
||||
ser.BeginSection("Port1");
|
||||
Port1.SyncState(ser);
|
||||
ser.EndSection();
|
||||
|
||||
ser.BeginSection("Port2");
|
||||
Port2.SyncState(ser);
|
||||
ser.EndSection();
|
||||
}
|
||||
|
||||
private readonly IPort Port1;
|
||||
private readonly IPort Port2;
|
||||
|
||||
private static Dictionary<string, Type> _controllerTypes;
|
||||
|
||||
public static Dictionary<string, Type> ValidControllerTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_controllerTypes == null)
|
||||
{
|
||||
_controllerTypes = typeof(SubNESHawkControllerDeck).Assembly
|
||||
.GetTypes()
|
||||
.Where(t => typeof(IPort).IsAssignableFrom(t))
|
||||
.Where(t => !t.IsAbstract && !t.IsInterface)
|
||||
.ToDictionary(tkey => tkey.DisplayName());
|
||||
}
|
||||
|
||||
return _controllerTypes;
|
||||
}
|
||||
}
|
||||
|
||||
public static string DefaultControllerName => typeof(StandardControls).DisplayName();
|
||||
}
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
using System;
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a Standard Nintendo Controller
|
||||
/// </summary>
|
||||
public interface IPort
|
||||
{
|
||||
byte Read(IController c);
|
||||
|
||||
ControllerDefinition Definition { get; }
|
||||
|
||||
void SyncState(Serializer ser);
|
||||
|
||||
int PortNum { get; }
|
||||
}
|
||||
|
||||
[DisplayName("NES Controller")]
|
||||
public class StandardControls : IPort
|
||||
{
|
||||
public StandardControls(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
{
|
||||
Name = "NES Controller",
|
||||
BoolButtons = BaseDefinition
|
||||
.Select(b => "P" + PortNum + " " + b)
|
||||
.ToList()
|
||||
};
|
||||
}
|
||||
|
||||
public int PortNum { get; }
|
||||
|
||||
public ControllerDefinition Definition { get; }
|
||||
|
||||
public byte Read(IController c)
|
||||
{
|
||||
byte result = 0;
|
||||
|
||||
if (c.IsPressed(Definition.BoolButtons[0]))
|
||||
{
|
||||
result |= 8;
|
||||
}
|
||||
if (c.IsPressed(Definition.BoolButtons[1]))
|
||||
{
|
||||
result |= 4;
|
||||
}
|
||||
if (c.IsPressed(Definition.BoolButtons[2]))
|
||||
{
|
||||
result |= 2;
|
||||
}
|
||||
if (c.IsPressed(Definition.BoolButtons[3]))
|
||||
{
|
||||
result |= 1;
|
||||
}
|
||||
if (c.IsPressed(Definition.BoolButtons[4]))
|
||||
{
|
||||
result |= 16;
|
||||
}
|
||||
if (c.IsPressed(Definition.BoolButtons[5]))
|
||||
{
|
||||
result |= 32;
|
||||
}
|
||||
if (c.IsPressed(Definition.BoolButtons[6]))
|
||||
{
|
||||
result |= 64;
|
||||
}
|
||||
if (c.IsPressed(Definition.BoolButtons[7]))
|
||||
{
|
||||
result |= 128;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static readonly string[] BaseDefinition =
|
||||
{
|
||||
"Up", "Down", "Left", "Right", "Start", "Select", "B", "A"
|
||||
};
|
||||
|
||||
public void SyncState(Serializer ser)
|
||||
{
|
||||
//nothing
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue