Tasedit: fixed bug in "bulletproof loading" algorithm
This commit is contained in:
parent
383baa85c4
commit
d95495aea1
|
@ -270,19 +270,27 @@ bool GREENZONE::load(EMUFILE *is)
|
|||
if (prev_frame+1 == greenZoneCount)
|
||||
{
|
||||
// everything went fine - load savestate at cursor position
|
||||
loadTasSavestate(currFrameCounter);
|
||||
if (loadTasSavestate(currFrameCounter))
|
||||
return false;
|
||||
}
|
||||
// uh, okay, but maybe we managed to read at least something from the file
|
||||
for (; prev_frame >= 0; prev_frame--)
|
||||
{
|
||||
// uh, okay, but maybe we managed to read at least something useful from the file
|
||||
// first see if original position of currFrameCounter was read successfully
|
||||
if (loadTasSavestate(currFrameCounter))
|
||||
{
|
||||
greenZoneCount = prev_frame+1; // cut greenZoneCount to this good frame
|
||||
currFrameCounter = prev_frame;
|
||||
greenZoneCount = prev_frame+1; // cut greenZoneCount to last good frame
|
||||
FCEU_printf("Greenzone loaded partially\n");
|
||||
return false;
|
||||
}
|
||||
// then at least jump to some frame that was read successfully
|
||||
for (; prev_frame >= 0; prev_frame--)
|
||||
{
|
||||
if (loadTasSavestate(prev_frame))
|
||||
{
|
||||
currFrameCounter = prev_frame;
|
||||
greenZoneCount = prev_frame+1; // cut greenZoneCount to this good frame
|
||||
FCEU_printf("Greenzone loaded partially, playback moved to the end of greenzone\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ public:
|
|||
void storeTasSavestate(int frame);
|
||||
|
||||
void GreenzoneCleaning();
|
||||
void ClearGreenzoneTail1();
|
||||
void ClearSavestate(int index);
|
||||
|
||||
void InvalidateGreenZone(int after);
|
||||
|
|
Loading…
Reference in New Issue