commodore64: more accurate FPS calculation

This commit is contained in:
saxxonpike 2012-11-18 12:10:58 +00:00
parent 90c3ce03c0
commit 41dbbcb8b7
3 changed files with 21 additions and 7 deletions

View File

@ -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;

View File

@ -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

View File

@ -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();