SubNEShawk: Add VBL Count to BK2 movie header

This commit is contained in:
alyosha-tas 2019-01-12 13:27:00 -06:00
parent c5cfe9e412
commit 74d20ca45c
5 changed files with 19 additions and 0 deletions

View File

@ -166,6 +166,12 @@ namespace BizHawk.Client.Common
protected virtual void Write(string fn, bool backup = false) protected virtual void Write(string fn, bool backup = false)
{ {
if (Global.Emulator is BizHawk.Emulation.Cores.Nintendo.SubNESHawk.SubNESHawk)
{
var _subnes = (BizHawk.Emulation.Cores.Nintendo.SubNESHawk.SubNESHawk)Global.Emulator;
Header["VBlankCount"] = _subnes.VBL_CNT.ToString();
}
var file = new FileInfo(fn); var file = new FileInfo(fn);
if (!file.Directory.Exists) if (!file.Directory.Exists)
{ {

View File

@ -4,6 +4,7 @@ using System.Linq;
using BizHawk.Emulation.Common; using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Nintendo.Gameboy; using BizHawk.Emulation.Cores.Nintendo.Gameboy;
using BizHawk.Emulation.Cores.Nintendo.SubNESHawk;
using BizHawk.Emulation.Cores.Sega.MasterSystem; using BizHawk.Emulation.Cores.Sega.MasterSystem;
using BizHawk.Emulation.Common.IEmulatorExtensions; using BizHawk.Emulation.Common.IEmulatorExtensions;
using BizHawk.Emulation.Cores.Consoles.Sega.gpgx; using BizHawk.Emulation.Cores.Consoles.Sega.gpgx;
@ -336,6 +337,11 @@ namespace BizHawk.Client.Common.MovieConversionExtensions
movie.HeaderEntries.Add("Is32X", "1"); movie.HeaderEntries.Add("Is32X", "1");
} }
if (Global.Emulator is SubNESHawk)
{
movie.HeaderEntries.Add("VBlankCount", "0");
}
movie.Core = ((CoreAttribute)Attribute movie.Core = ((CoreAttribute)Attribute
.GetCustomAttribute(Global.Emulator.GetType(), typeof(CoreAttribute))) .GetCustomAttribute(Global.Emulator.GetType(), typeof(CoreAttribute)))
.CoreName; .CoreName;

View File

@ -54,6 +54,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
if (_islag) if (_islag)
{ {
_lagcount++; _lagcount++;
VBL_CNT++;
} }
return ret; return ret;

View File

@ -54,6 +54,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
ser.Sync("IsLag", ref _islag); ser.Sync("IsLag", ref _islag);
ser.Sync("pass_a_frame", ref pass_a_frame); ser.Sync("pass_a_frame", ref pass_a_frame);
ser.Sync("pass_new_input", ref pass_new_input); ser.Sync("pass_new_input", ref pass_new_input);
ser.Sync("VBL_CNT", ref VBL_CNT);
} }
} }
} }

View File

@ -17,6 +17,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
{ {
public NES.NES subnes; public NES.NES subnes;
// needed for movies to accurately calculate timing
public int VBL_CNT;
[CoreConstructor("NES")] [CoreConstructor("NES")]
public SubNESHawk(CoreComm comm, GameInfo game, byte[] rom, /*string gameDbFn,*/ object settings, object syncSettings) public SubNESHawk(CoreComm comm, GameInfo game, byte[] rom, /*string gameDbFn,*/ object settings, object syncSettings)
{ {
@ -41,6 +44,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
SetupMemoryDomains(); SetupMemoryDomains();
HardReset(); HardReset();
VBL_CNT = 0;
} }
public void HardReset() public void HardReset()