From e5f82bf329f7e12b3f0895f8b5adf0e5cc17c21d Mon Sep 17 00:00:00 2001 From: adelikat Date: Tue, 2 May 2017 07:56:34 -0500 Subject: [PATCH] CoreComm - make vsync fields into properties --- BizHawk.Emulation.Common/CoreComms.cs | 4 +-- .../Consoles/Atari/2600/Atari2600.Core.cs | 28 +++++++++++-------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/BizHawk.Emulation.Common/CoreComms.cs b/BizHawk.Emulation.Common/CoreComms.cs index b73d31d4c4..3dafdf3c7d 100644 --- a/BizHawk.Emulation.Common/CoreComms.cs +++ b/BizHawk.Emulation.Common/CoreComms.cs @@ -21,8 +21,8 @@ namespace BizHawk.Emulation.Common public double VsyncRate => VsyncNum / (double)VsyncDen; - public int VsyncNum = 60; - public int VsyncDen = 1; + public int VsyncNum { get; set; } = 60; + public int VsyncDen { get; set; } = 1; // a core should set these if you wish to provide rom status information yourself. otherwise it will be calculated by the frontend in a way you may not like, using RomGame-related concepts. public string RomStatusAnnotation { get; set; } diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.Core.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.Core.cs index 0f8a6820a3..397647a6e7 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.Core.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.Core.cs @@ -1,6 +1,5 @@ using System; -using BizHawk.Common; using BizHawk.Common.NumberExtensions; using BizHawk.Common.BufferExtensions; @@ -290,11 +289,11 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 _lagcount = 0; Cpu = new MOS6502X { - ReadMemory = this.ReadMemory, - WriteMemory = this.WriteMemory, - PeekMemory = this.PeekMemory, - DummyReadMemory = this.ReadMemory, - OnExecFetch = this.ExecFetch + ReadMemory = ReadMemory, + WriteMemory = WriteMemory, + PeekMemory = PeekMemory, + DummyReadMemory = ReadMemory, + OnExecFetch = ExecFetch }; if (_game["PAL"]) @@ -312,7 +311,12 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 // dcfilter coefficent is from real observed hardware behavior: a latched "1" will fully decay by ~170 or so tia sound cycles _tia = new TIA(this, _pal, Settings.SECAMColors, CoreComm.VsyncRate > 55.0 ? 735 : 882); - _tia.GetFrameRate(out CoreComm.VsyncNum, out CoreComm.VsyncDen); + + int vsyncNum, vsyncDen; + _tia.GetFrameRate(out vsyncNum, out vsyncDen); + + CoreComm.VsyncNum = vsyncNum; + CoreComm.VsyncDen = vsyncDen; _dcfilter = new DCFilter(_tia, 256); @@ -347,11 +351,11 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 Cpu = new MOS6502X { - ReadMemory = this.ReadMemory, - WriteMemory = this.WriteMemory, - PeekMemory = this.PeekMemory, - DummyReadMemory = this.ReadMemory, - OnExecFetch = this.ExecFetch + ReadMemory = ReadMemory, + WriteMemory = WriteMemory, + PeekMemory = PeekMemory, + DummyReadMemory = ReadMemory, + OnExecFetch = ExecFetch }; _tia.Reset();