diff --git a/TASVideos.Parsers/Parsers/Dsm.cs b/TASVideos.Parsers/Parsers/Dsm.cs index d2c58d338..b977a1c32 100644 --- a/TASVideos.Parsers/Parsers/Dsm.cs +++ b/TASVideos.Parsers/Parsers/Dsm.cs @@ -23,7 +23,8 @@ public async Task Parse(Stream file, long length) result.WarnNoRerecords(); } - if (header.HasValue(Keys.StartsFromSavestate)) + var startsFromSavestate = header.GetValueFor(Keys.StartsFromSavestate); + if (!string.IsNullOrWhiteSpace(startsFromSavestate) && startsFromSavestate != "0") { result.StartType = MovieStartType.Savestate; } diff --git a/tests/TASVideos.MovieParsers.Tests/DsmParserTests.cs b/tests/TASVideos.MovieParsers.Tests/DsmParserTests.cs index ca3ee2d60..15557d52c 100644 --- a/tests/TASVideos.MovieParsers.Tests/DsmParserTests.cs +++ b/tests/TASVideos.MovieParsers.Tests/DsmParserTests.cs @@ -81,6 +81,14 @@ public async Task Savestate() AssertNoWarningsOrErrors(result); } + public async Task SavestateSetAs0() + { + var result = await _dsmParser.Parse(Embedded("savestate0.dsm"), EmbeddedLength("savestate0.dsm")); + Assert.IsTrue(result.Success); + Assert.AreEqual(MovieStartType.PowerOn, result.StartType); + AssertNoWarningsOrErrors(result); + } + [TestMethod] public async Task NegativeRerecords() { @@ -90,4 +98,5 @@ public async Task NegativeRerecords() AssertNoErrors(result); Assert.AreEqual(1, result.Warnings.Count()); } + } diff --git a/tests/TASVideos.MovieParsers.Tests/DsmSampleFiles/savestate0.dsm b/tests/TASVideos.MovieParsers.Tests/DsmSampleFiles/savestate0.dsm new file mode 100644 index 000000000..af0ac3d7e --- /dev/null +++ b/tests/TASVideos.MovieParsers.Tests/DsmSampleFiles/savestate0.dsm @@ -0,0 +1,4 @@ +rerecordCount 1 +savestate 0 +|0|.............000 000 0| +|0|.............000 000 0|