ngp: settings that theoretically work
This commit is contained in:
parent
97638f84e4
commit
051382450e
|
@ -441,6 +441,8 @@
|
||||||
this.ShowMenuContextMenuSeparator = new System.Windows.Forms.ToolStripSeparator();
|
this.ShowMenuContextMenuSeparator = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.ShowMenuContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.ShowMenuContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.timerMouseIdle = new System.Windows.Forms.Timer(this.components);
|
this.timerMouseIdle = new System.Windows.Forms.Timer(this.components);
|
||||||
|
this.neoGeoPocketToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.preferencesToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.MainformMenu.SuspendLayout();
|
this.MainformMenu.SuspendLayout();
|
||||||
this.MainStatusBar.SuspendLayout();
|
this.MainStatusBar.SuspendLayout();
|
||||||
this.MainFormContextMenu.SuspendLayout();
|
this.MainFormContextMenu.SuspendLayout();
|
||||||
|
@ -475,11 +477,12 @@
|
||||||
this.IntvSubMenu,
|
this.IntvSubMenu,
|
||||||
this.sNESToolStripMenuItem,
|
this.sNESToolStripMenuItem,
|
||||||
this.virtualBoyToolStripMenuItem,
|
this.virtualBoyToolStripMenuItem,
|
||||||
|
this.neoGeoPocketToolStripMenuItem,
|
||||||
this.HelpSubMenu});
|
this.HelpSubMenu});
|
||||||
this.MainformMenu.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow;
|
this.MainformMenu.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow;
|
||||||
this.MainformMenu.Location = new System.Drawing.Point(0, 0);
|
this.MainformMenu.Location = new System.Drawing.Point(0, 0);
|
||||||
this.MainformMenu.Name = "MainformMenu";
|
this.MainformMenu.Name = "MainformMenu";
|
||||||
this.MainformMenu.Size = new System.Drawing.Size(470, 57);
|
this.MainformMenu.Size = new System.Drawing.Size(470, 74);
|
||||||
this.MainformMenu.TabIndex = 0;
|
this.MainformMenu.TabIndex = 0;
|
||||||
this.MainformMenu.Text = "menuStrip1";
|
this.MainformMenu.Text = "menuStrip1";
|
||||||
this.MainformMenu.MenuActivate += new System.EventHandler(this.MainformMenu_MenuActivate);
|
this.MainformMenu.MenuActivate += new System.EventHandler(this.MainformMenu_MenuActivate);
|
||||||
|
@ -3198,7 +3201,7 @@
|
||||||
// preferencesToolStripMenuItem
|
// preferencesToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.preferencesToolStripMenuItem.Name = "preferencesToolStripMenuItem";
|
this.preferencesToolStripMenuItem.Name = "preferencesToolStripMenuItem";
|
||||||
this.preferencesToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
this.preferencesToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
|
||||||
this.preferencesToolStripMenuItem.Text = "Preferences...";
|
this.preferencesToolStripMenuItem.Text = "Preferences...";
|
||||||
this.preferencesToolStripMenuItem.Click += new System.EventHandler(this.preferencesToolStripMenuItem_Click);
|
this.preferencesToolStripMenuItem.Click += new System.EventHandler(this.preferencesToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
|
@ -3213,7 +3216,7 @@
|
||||||
// preferencesToolStripMenuItem1
|
// preferencesToolStripMenuItem1
|
||||||
//
|
//
|
||||||
this.preferencesToolStripMenuItem1.Name = "preferencesToolStripMenuItem1";
|
this.preferencesToolStripMenuItem1.Name = "preferencesToolStripMenuItem1";
|
||||||
this.preferencesToolStripMenuItem1.Size = new System.Drawing.Size(144, 22);
|
this.preferencesToolStripMenuItem1.Size = new System.Drawing.Size(152, 22);
|
||||||
this.preferencesToolStripMenuItem1.Text = "Preferences...";
|
this.preferencesToolStripMenuItem1.Text = "Preferences...";
|
||||||
this.preferencesToolStripMenuItem1.Click += new System.EventHandler(this.preferencesToolStripMenuItem1_Click);
|
this.preferencesToolStripMenuItem1.Click += new System.EventHandler(this.preferencesToolStripMenuItem1_Click);
|
||||||
//
|
//
|
||||||
|
@ -3906,6 +3909,21 @@
|
||||||
this.timerMouseIdle.Interval = 2000;
|
this.timerMouseIdle.Interval = 2000;
|
||||||
this.timerMouseIdle.Tick += new System.EventHandler(this.TimerMouseIdle_Tick);
|
this.timerMouseIdle.Tick += new System.EventHandler(this.TimerMouseIdle_Tick);
|
||||||
//
|
//
|
||||||
|
// neoGeoPocketToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.neoGeoPocketToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.preferencesToolStripMenuItem2});
|
||||||
|
this.neoGeoPocketToolStripMenuItem.Name = "neoGeoPocketToolStripMenuItem";
|
||||||
|
this.neoGeoPocketToolStripMenuItem.Size = new System.Drawing.Size(92, 17);
|
||||||
|
this.neoGeoPocketToolStripMenuItem.Text = "&NeoGeo Pocket";
|
||||||
|
//
|
||||||
|
// preferencesToolStripMenuItem2
|
||||||
|
//
|
||||||
|
this.preferencesToolStripMenuItem2.Name = "preferencesToolStripMenuItem2";
|
||||||
|
this.preferencesToolStripMenuItem2.Size = new System.Drawing.Size(152, 22);
|
||||||
|
this.preferencesToolStripMenuItem2.Text = "Preferences...";
|
||||||
|
this.preferencesToolStripMenuItem2.Click += new System.EventHandler(this.preferencesToolStripMenuItem2_Click);
|
||||||
|
//
|
||||||
// MainForm
|
// MainForm
|
||||||
//
|
//
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||||
|
@ -4358,5 +4376,7 @@
|
||||||
private System.Windows.Forms.ToolStripMenuItem preferencesToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem preferencesToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem virtualBoyToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem virtualBoyToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem preferencesToolStripMenuItem1;
|
private System.Windows.Forms.ToolStripMenuItem preferencesToolStripMenuItem1;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem neoGeoPocketToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem preferencesToolStripMenuItem2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1799,6 +1799,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
IntvSubMenu.Visible = false;
|
IntvSubMenu.Visible = false;
|
||||||
virtualBoyToolStripMenuItem.Visible = false;
|
virtualBoyToolStripMenuItem.Visible = false;
|
||||||
sNESToolStripMenuItem.Visible = false;
|
sNESToolStripMenuItem.Visible = false;
|
||||||
|
neoGeoPocketToolStripMenuItem.Visible = false;
|
||||||
|
|
||||||
switch (system)
|
switch (system)
|
||||||
{
|
{
|
||||||
|
@ -1880,6 +1881,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
case "VB":
|
case "VB":
|
||||||
virtualBoyToolStripMenuItem.Visible = true;
|
virtualBoyToolStripMenuItem.Visible = true;
|
||||||
break;
|
break;
|
||||||
|
case "NGP":
|
||||||
|
neoGeoPocketToolStripMenuItem.Visible = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4304,6 +4308,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
GenericCoreConfig.DoDialog(this, "Snes9x Settings");
|
GenericCoreConfig.DoDialog(this, "Snes9x Settings");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void preferencesToolStripMenuItem2_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
GenericCoreConfig.DoDialog(this, "NeoPop Settings");
|
||||||
|
}
|
||||||
|
|
||||||
private bool Rewind(ref bool runFrame, long currentTimestamp, out bool returnToRecording)
|
private bool Rewind(ref bool runFrame, long currentTimestamp, out bool returnToRecording)
|
||||||
{
|
{
|
||||||
var isRewinding = false;
|
var isRewinding = false;
|
||||||
|
|
|
@ -27,8 +27,13 @@ namespace BizHawk.Emulation.Cores.Consoles.SNK
|
||||||
public int Buttons;
|
public int Buttons;
|
||||||
public int Lagged;
|
public int Lagged;
|
||||||
}
|
}
|
||||||
|
public enum Language
|
||||||
|
{
|
||||||
|
Japanese, English
|
||||||
|
}
|
||||||
|
|
||||||
[BizImport(CC)]
|
[BizImport(CC)]
|
||||||
public abstract bool LoadSystem(byte[] rom, int romlength, int language);
|
public abstract bool LoadSystem(byte[] rom, int romlength, Language language);
|
||||||
[BizImport(CC)]
|
[BizImport(CC)]
|
||||||
public abstract void SetLayers(int enable); // 1, 2, 4 bg,fg,sprites
|
public abstract void SetLayers(int enable); // 1, 2, 4 bg,fg,sprites
|
||||||
[BizImport(CC)]
|
[BizImport(CC)]
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
using BizHawk.Common.BizInvoke;
|
using BizHawk.Common;
|
||||||
|
using BizHawk.Common.BizInvoke;
|
||||||
using BizHawk.Common.BufferExtensions;
|
using BizHawk.Common.BufferExtensions;
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
using BizHawk.Emulation.Cores.Waterbox;
|
using BizHawk.Emulation.Cores.Waterbox;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
@ -13,16 +15,20 @@ namespace BizHawk.Emulation.Cores.Consoles.SNK
|
||||||
{
|
{
|
||||||
[CoreAttributes("NeoPop", "Thomas Klausner", true, false, "0.9.44.1",
|
[CoreAttributes("NeoPop", "Thomas Klausner", true, false, "0.9.44.1",
|
||||||
"https://mednafen.github.io/releases/", false)]
|
"https://mednafen.github.io/releases/", false)]
|
||||||
public class NeoGeoPort : IEmulator, IVideoProvider, ISoundProvider, IStatable, IInputPollable
|
public class NeoGeoPort : IEmulator, IVideoProvider, ISoundProvider, IStatable, IInputPollable,
|
||||||
|
ISettable<object, NeoGeoPort.SyncSettings>
|
||||||
{
|
{
|
||||||
private PeRunner _exe;
|
private PeRunner _exe;
|
||||||
private LibNeoGeoPort _neopop;
|
private LibNeoGeoPort _neopop;
|
||||||
|
private long _clockTime;
|
||||||
|
private int _clockDen;
|
||||||
|
|
||||||
[CoreConstructor("NGP")]
|
[CoreConstructor("NGP")]
|
||||||
public NeoGeoPort(CoreComm comm, byte[] rom)
|
public NeoGeoPort(CoreComm comm, byte[] rom, SyncSettings syncSettings, bool deterministic)
|
||||||
{
|
{
|
||||||
ServiceProvider = new BasicServiceProvider(this);
|
ServiceProvider = new BasicServiceProvider(this);
|
||||||
CoreComm = comm;
|
CoreComm = comm;
|
||||||
|
_syncSettings = syncSettings ?? new SyncSettings();
|
||||||
|
|
||||||
_exe = new PeRunner(new PeRunnerOptions
|
_exe = new PeRunner(new PeRunnerOptions
|
||||||
{
|
{
|
||||||
|
@ -36,7 +42,7 @@ namespace BizHawk.Emulation.Cores.Consoles.SNK
|
||||||
|
|
||||||
_neopop = BizInvoker.GetInvoker<LibNeoGeoPort>(_exe, _exe);
|
_neopop = BizInvoker.GetInvoker<LibNeoGeoPort>(_exe, _exe);
|
||||||
|
|
||||||
if (!_neopop.LoadSystem(rom, rom.Length, 1))
|
if (!_neopop.LoadSystem(rom, rom.Length, _syncSettings.Language))
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Core rejected the rom");
|
throw new InvalidOperationException("Core rejected the rom");
|
||||||
}
|
}
|
||||||
|
@ -45,10 +51,22 @@ namespace BizHawk.Emulation.Cores.Consoles.SNK
|
||||||
|
|
||||||
_inputCallback = InputCallbacks.Call;
|
_inputCallback = InputCallbacks.Call;
|
||||||
InitMemoryDomains();
|
InitMemoryDomains();
|
||||||
|
|
||||||
|
DeterministicEmulation = deterministic || !_syncSettings.UseRealTime;
|
||||||
|
_clockTime = (long)((_syncSettings.InitialTime - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe void FrameAdvance(IController controller, bool render, bool rendersound = true)
|
public unsafe void FrameAdvance(IController controller, bool render, bool rendersound = true)
|
||||||
{
|
{
|
||||||
|
_clockDen += VsyncDenominator;
|
||||||
|
if (_clockDen >= VsyncNumerator)
|
||||||
|
{
|
||||||
|
_clockDen -= VsyncNumerator;
|
||||||
|
_clockTime++;
|
||||||
|
}
|
||||||
|
|
||||||
|
long clockTime = DeterministicEmulation ? _clockTime : (long)((_syncSettings.InitialTime - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds);
|
||||||
|
|
||||||
_neopop.SetInputCallback(InputCallbacks.Count > 0 ? _inputCallback : null);
|
_neopop.SetInputCallback(InputCallbacks.Count > 0 ? _inputCallback : null);
|
||||||
|
|
||||||
if (controller.IsPressed("Power"))
|
if (controller.IsPressed("Power"))
|
||||||
|
@ -63,7 +81,8 @@ namespace BizHawk.Emulation.Cores.Consoles.SNK
|
||||||
SoundBuff = (IntPtr)sp,
|
SoundBuff = (IntPtr)sp,
|
||||||
SoundBufMaxSize = _soundBuffer.Length / 2,
|
SoundBufMaxSize = _soundBuffer.Length / 2,
|
||||||
Buttons = GetButtons(controller),
|
Buttons = GetButtons(controller),
|
||||||
SkipRendering = render ? 0 : 1
|
SkipRendering = render ? 0 : 1,
|
||||||
|
FrontendTime = clockTime
|
||||||
};
|
};
|
||||||
|
|
||||||
_neopop.FrameAdvance(spec);
|
_neopop.FrameAdvance(spec);
|
||||||
|
@ -102,7 +121,7 @@ namespace BizHawk.Emulation.Cores.Consoles.SNK
|
||||||
|
|
||||||
public IEmulatorServiceProvider ServiceProvider { get; private set; }
|
public IEmulatorServiceProvider ServiceProvider { get; private set; }
|
||||||
public string SystemId { get { return "NGP"; } }
|
public string SystemId { get { return "NGP"; } }
|
||||||
public bool DeterministicEmulation { get { return true; } }
|
public bool DeterministicEmulation { get; private set; }
|
||||||
public CoreComm CoreComm { get; }
|
public CoreComm CoreComm { get; }
|
||||||
|
|
||||||
#region IStatable
|
#region IStatable
|
||||||
|
@ -259,6 +278,67 @@ namespace BizHawk.Emulation.Cores.Consoles.SNK
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region ISettable
|
||||||
|
|
||||||
|
private SyncSettings _syncSettings;
|
||||||
|
|
||||||
|
public class SyncSettings
|
||||||
|
{
|
||||||
|
[DisplayName("Language")]
|
||||||
|
[Description("Language of the system. Only affects some games.")]
|
||||||
|
[DefaultValue(LibNeoGeoPort.Language.Japanese)]
|
||||||
|
public LibNeoGeoPort.Language Language { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Initial Time")]
|
||||||
|
[Description("Initial time of emulation. Only relevant when UseRealTime is false.")]
|
||||||
|
[DefaultValue(typeof(DateTime), "2010-01-01")]
|
||||||
|
public DateTime InitialTime { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Use RealTime")]
|
||||||
|
[Description("If true, RTC clock will be based off of real time instead of emulated time. Ignored (set to false) when recording a movie.")]
|
||||||
|
[DefaultValue(false)]
|
||||||
|
public bool UseRealTime { get; set; }
|
||||||
|
|
||||||
|
public SyncSettings Clone()
|
||||||
|
{
|
||||||
|
return (SyncSettings)MemberwiseClone();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool NeedsReboot(SyncSettings x, SyncSettings y)
|
||||||
|
{
|
||||||
|
return !DeepEquality.DeepEquals(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SyncSettings()
|
||||||
|
{
|
||||||
|
SettingsUtil.SetDefaultValues(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public object GetSettings()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SyncSettings GetSyncSettings()
|
||||||
|
{
|
||||||
|
return _syncSettings.Clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool PutSettings(object o)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool PutSyncSettings(SyncSettings o)
|
||||||
|
{
|
||||||
|
var ret = SyncSettings.NeedsReboot(_syncSettings, o);
|
||||||
|
_syncSettings = o;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Memory Domains
|
#region Memory Domains
|
||||||
|
|
||||||
private unsafe void InitMemoryDomains()
|
private unsafe void InitMemoryDomains()
|
||||||
|
|
Loading…
Reference in New Issue