Skip to content

Commit

Permalink
.dsm parser - treat "savestate 0" as starting from poweron, fixes #2006
Browse files Browse the repository at this point in the history
  • Loading branch information
adelikat committed Nov 13, 2024
1 parent 768cf39 commit 5418466
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion TASVideos.Parsers/Parsers/Dsm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public async Task<IParseResult> 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;
}
Expand Down
9 changes: 9 additions & 0 deletions tests/TASVideos.MovieParsers.Tests/DsmParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand All @@ -90,4 +98,5 @@ public async Task NegativeRerecords()
AssertNoErrors(result);
Assert.AreEqual(1, result.Warnings.Count());
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
rerecordCount 1
savestate 0
|0|.............000 000 0|
|0|.............000 000 0|

0 comments on commit 5418466

Please sign in to comment.