2600: add a pal detection heursitic. still some work to do on that

This commit is contained in:
goyuken 2014-05-21 14:32:41 +00:00
parent b406146ae4
commit 7dec3af0de
2 changed files with 25 additions and 2 deletions

View File

@ -219,7 +219,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
}
public void StoreSaveRam(byte[] data) { }
public void ClearSaveRam() { }
public void SaveStateText(TextWriter writer)
@ -252,5 +252,22 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
}
public void Dispose() { }
private static bool DetectPal(GameInfo game, byte[] rom)
{
var comm = new CoreComm(null, null);
comm.InputCallback = new InputCallbackSystem();
Atari2600 emu = new Atari2600(new CoreComm(null, null), game, rom, null, null);
emu.Controller = new NullController();
List<int> framecounts = new List<int>();
emu._tia.FrameEndCallBack = (i) => framecounts.Add(i);
for (int i = 0; i < 71; i++) // run for 71 * 262 lines, since we're in NTSC mode
emu.FrameAdvance(false, false);
int numpal = framecounts.Where((i) => i > 287).Count();
Console.WriteLine("{0} PAL", numpal);
return numpal >= 25;
}
}
}

View File

@ -200,6 +200,11 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
/// </summary>
public int LineCount { get; set; }
/// <summary>
/// called at the end of a video frame. used internally
/// </summary>
public Action<int> FrameEndCallBack { get; set; }
public int MaxVolume { get; set; }
public int VirtualWidth
@ -693,7 +698,8 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
// write to frame buffer
OutputFrame(_CurrentScanLine);
//Console.WriteLine("@{0}", _CurrentScanLine);
if (FrameEndCallBack != null)
FrameEndCallBack(_CurrentScanLine);
// Clear all from last frame
_CurrentScanLine = 0;