Timeline error messages now report the frame where the savestate branches from the movie file.

This commit is contained in:
adelikat 2010-05-16 19:26:29 +00:00
parent 64fd9f0c44
commit 7480101827
2 changed files with 11 additions and 4 deletions

View File

@ -1209,7 +1209,7 @@ int FCEUMOV_WriteState(std::ostream* os)
else return 0; else return 0;
} }
bool CheckTimelines(MovieData& stateMovie, MovieData& currMovie) bool CheckTimelines(MovieData& stateMovie, MovieData& currMovie, int& error)
{ {
bool isInTimeline = true; bool isInTimeline = true;
int length; int length;
@ -1225,6 +1225,7 @@ bool CheckTimelines(MovieData& stateMovie, MovieData& currMovie)
if (!stateMovie.records[x].Compare(currMovie.records[x])) if (!stateMovie.records[x].Compare(currMovie.records[x]))
{ {
isInTimeline = false; isInTimeline = false;
error = x;
break; break;
} }
} }
@ -1303,7 +1304,8 @@ bool FCEUMOV_ReadState(std::istream* is, uint32 size)
if(movie_readonly) if(movie_readonly)
{ {
bool sameTimeline = CheckTimelines(tempMovieData, currMovieData); int errorFrame = 0;
bool sameTimeline = CheckTimelines(tempMovieData, currMovieData, errorFrame);
if (sameTimeline) if (sameTimeline)
{ {
@ -1336,7 +1338,7 @@ bool FCEUMOV_ReadState(std::istream* is, uint32 size)
else else
{ {
//Wrong timeline, do apprioriate logic here //Wrong timeline, do apprioriate logic here
FCEU_PrintError("Error: Savestate not in the same timeline as movie!"); FCEU_PrintError("Error: Savestate not in the same timeline as movie!\nFrame %d branches from current timeline", errorFrame);
return false; return false;
} }
} }

View File

@ -6,7 +6,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fceux", "vc10_fceux.vcxproj
{36835D12-7AE3-47EE-96EF-A50D88737893} = {36835D12-7AE3-47EE-96EF-A50D88737893} {36835D12-7AE3-47EE-96EF-A50D88737893} = {36835D12-7AE3-47EE-96EF-A50D88737893}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LuaPerks", "..\..\LuaPerks\LuaPerks.vcxproj", "{36835D12-7AE3-47EE-96EF-A50D88737893}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LuaPerks", "..\..\luaperks\LuaPerks.vcxproj", "{36835D12-7AE3-47EE-96EF-A50D88737893}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F8647A59-ED57-4975-B40C-054BA8588E4E}"
ProjectSection(SolutionItems) = preProject
Performance1.psess = Performance1.psess
EndProjectSection
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution