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)
|
if (prev_frame+1 == greenZoneCount)
|
||||||
{
|
{
|
||||||
// everything went fine - load savestate at cursor position
|
// everything went fine - load savestate at cursor position
|
||||||
loadTasSavestate(currFrameCounter);
|
if (loadTasSavestate(currFrameCounter))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// uh, okay, but maybe we managed to read at least something from the file
|
// uh, okay, but maybe we managed to read at least something useful from the file
|
||||||
for (; prev_frame >= 0; prev_frame--)
|
// first see if original position of currFrameCounter was read successfully
|
||||||
{
|
|
||||||
if (loadTasSavestate(currFrameCounter))
|
if (loadTasSavestate(currFrameCounter))
|
||||||
{
|
{
|
||||||
greenZoneCount = prev_frame+1; // cut greenZoneCount to this good frame
|
greenZoneCount = prev_frame+1; // cut greenZoneCount to last good frame
|
||||||
currFrameCounter = prev_frame;
|
|
||||||
FCEU_printf("Greenzone loaded partially\n");
|
FCEU_printf("Greenzone loaded partially\n");
|
||||||
return false;
|
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 storeTasSavestate(int frame);
|
||||||
|
|
||||||
void GreenzoneCleaning();
|
void GreenzoneCleaning();
|
||||||
void ClearGreenzoneTail1();
|
|
||||||
void ClearSavestate(int index);
|
void ClearSavestate(int index);
|
||||||
|
|
||||||
void InvalidateGreenZone(int after);
|
void InvalidateGreenZone(int after);
|
||||||
|
|
Loading…
Reference in New Issue