From 5eba8bc7f35e516082ff040c668f4d5f1d870065 Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Sat, 10 Sep 2011 02:08:16 +0000 Subject: [PATCH] Movies - fix problem with NES loadstate & timeline checks that caused the Frame value to not parse properly. Also add messages to the catch statement in the event of parse failure. --- BizHawk.MultiClient/movie/Movie.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/BizHawk.MultiClient/movie/Movie.cs b/BizHawk.MultiClient/movie/Movie.cs index 831e0e010e..b6e48c8a46 100644 --- a/BizHawk.MultiClient/movie/Movie.cs +++ b/BizHawk.MultiClient/movie/Movie.cs @@ -359,12 +359,12 @@ namespace BizHawk.MultiClient else if (line == "[/Input]") break; else if (line.Contains("Frame 0x")) //NES stores frame count in hex, yay { - string[] strs = line.Split(' '); + string[] strs = line.Split('x'); try { stateFrame = int.Parse(strs[1], NumberStyles.HexNumber); } - catch { } //TODO: message? + catch { Global.RenderPanel.AddMessage("Savestate Frame failed to parse"); } //TODO: message? } else if (line.Contains("Frame ")) { @@ -373,7 +373,7 @@ namespace BizHawk.MultiClient { stateFrame = int.Parse(strs[1]); } - catch { } //TODO: message? + catch { Global.RenderPanel.AddMessage("Savestate Frame failed to parse"); } //TODO: message? } if (line[0] == '|') { @@ -570,12 +570,12 @@ namespace BizHawk.MultiClient } else if (line.Contains("Frame 0x")) //NES stores frame count in hex, yay { - string[] strs = line.Split(' '); + string[] strs = line.Split('x'); try { stateFrame = int.Parse(strs[1], NumberStyles.HexNumber); } - catch { } //TODO: message? + catch { Global.RenderPanel.AddMessage("Savestate Frame number failed to parse"); } } else if (line.Contains("Frame ")) { @@ -584,7 +584,7 @@ namespace BizHawk.MultiClient { stateFrame = int.Parse(strs[1]); } - catch { } //TODO: message? + catch { Global.RenderPanel.AddMessage("Savestate Frame number failed to parse"); } } else if (line == "[Input]") continue; else if (line == "[/Input]") break; @@ -600,8 +600,10 @@ namespace BizHawk.MultiClient return true; } - if (stateFrame == 0 || stateFrame > l.Length()) + if (stateFrame == 0 || stateFrame > l.Length()) + { stateFrame = l.Length(); //In case the frame count failed to parse, revert to using the entire state input log + } if (Log.Length() < stateFrame) { //Future event error