From 35013f07e84944eeda9a6faf0ddf38927d7d1bc7 Mon Sep 17 00:00:00 2001 From: goyuken Date: Sat, 22 Sep 2012 19:47:25 +0000 Subject: [PATCH] 2600: stop emulator from hanging, consuming all ram, and then crashing in some situations --- BizHawk.Emulation/Consoles/Atari/2600/TIA.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/BizHawk.Emulation/Consoles/Atari/2600/TIA.cs b/BizHawk.Emulation/Consoles/Atari/2600/TIA.cs index 29776909e0..c53ec762bc 100644 --- a/BizHawk.Emulation/Consoles/Atari/2600/TIA.cs +++ b/BizHawk.Emulation/Consoles/Atari/2600/TIA.cs @@ -853,6 +853,17 @@ namespace BizHawk.Emulation.Consoles.Atari scanlinesBuffer.Add(scanline); scanline = new uint[160]; } + if (scanlinesBuffer.Count >= 1024) + { + /* if a rom never toggles vsync, FrameAdvance() will hang while consuming + * huge amounts of ram. this is most certainly due to emulation defects + * that need to be fixed; but it's preferable to not crash the emulator + * in such situations + */ + outputFrame(); + scanlinesBuffer.Clear(); + frameComplete = true; + } } // TODO: Remove the magic numbers from this function to allow for a variable height screen