From 41dbbcb8b765d2c1fc489eb0a55d1f7c69748b47 Mon Sep 17 00:00:00 2001 From: saxxonpike Date: Sun, 18 Nov 2012 12:10:58 +0000 Subject: [PATCH] commodore64: more accurate FPS calculation --- .../Computers/Commodore64/C64.core.cs | 11 +++++------ BizHawk.Emulation/Computers/Commodore64/C64.cs | 2 +- .../Computers/Commodore64/VicIINew.cs | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/BizHawk.Emulation/Computers/Commodore64/C64.core.cs b/BizHawk.Emulation/Computers/Commodore64/C64.core.cs index 26e146cc8c..8b526d629a 100644 --- a/BizHawk.Emulation/Computers/Commodore64/C64.core.cs +++ b/BizHawk.Emulation/Computers/Commodore64/C64.core.cs @@ -37,7 +37,7 @@ namespace BizHawk.Emulation.Computers.Commodore64 // sid stuff //private Emulation.Sound.Utilities.DCFilter sidDCFilter; - private SidSyncSoundProvider syncSid; + //private SidSyncSoundProvider syncSid; public bool DriveLED { @@ -82,21 +82,20 @@ namespace BizHawk.Emulation.Computers.Commodore64 vic = new VicIINew(signal, initRegion); // set vsync rate - CoreOutputComm.VsyncDen = vic.CyclesPerFrame; switch (initRegion) { case Region.NTSC: - CoreOutputComm.VsyncNum = (14318181 / 14); + CoreOutputComm.VsyncDen = vic.CyclesPerFrame * 14; + CoreOutputComm.VsyncNum = 14318181; break; case Region.PAL: - CoreOutputComm.VsyncNum = (17734472 / 18); + CoreOutputComm.VsyncDen = vic.CyclesPerFrame * 18; + CoreOutputComm.VsyncNum = 17734472; break; } // initialize sid sid = new Sid(initRegion, 44100); // we'll assume 44.1k for now until there's a better way - syncSid = new SidSyncSoundProvider(sid); - //sidDCFilter = new Emulation.Sound.Utilities.DCFilter(sid, 2205); // initialize memory (this must be done AFTER all other chips are initialized) string romPath = CoreInputComm.C64_FirmwaresPath; diff --git a/BizHawk.Emulation/Computers/Commodore64/C64.cs b/BizHawk.Emulation/Computers/Commodore64/C64.cs index 71bc206d29..5b2770a25d 100644 --- a/BizHawk.Emulation/Computers/Commodore64/C64.cs +++ b/BizHawk.Emulation/Computers/Commodore64/C64.cs @@ -61,7 +61,7 @@ namespace BizHawk.Emulation.Computers.Commodore64 public void EndAsyncSound() { } //TODO public ISoundProvider SoundProvider { get { return sid; } } public bool StartAsyncSound() { return true; } //TODO - public ISyncSoundProvider SyncSoundProvider { get { return syncSid; ; } } + public ISyncSoundProvider SyncSoundProvider { get { return new SidSyncSoundProvider(sid); } } public IVideoProvider VideoProvider { get { return vic; } } // controller diff --git a/BizHawk.Emulation/Computers/Commodore64/VicIINew.cs b/BizHawk.Emulation/Computers/Commodore64/VicIINew.cs index 31951437e0..6bc903f7bb 100644 --- a/BizHawk.Emulation/Computers/Commodore64/VicIINew.cs +++ b/BizHawk.Emulation/Computers/Commodore64/VicIINew.cs @@ -27,6 +27,21 @@ namespace BizHawk.Emulation.Computers.Commodore64 } } + public double FramesPerSecond + { + get + { + switch (region) + { + case Region.NTSC: + return (14318181d / 14d) / (double)CyclesPerFrame; + case Region.PAL: + return (17734472d / 18d) / (double)CyclesPerFrame; + } + return 0; + } + } + public void HardReset() { InitRegs();