I have tried four or five times to start a demonstration run of Final Fantasy Legend, but it desyncs every time, usually about 4000 frames in. My partner in crime, FatRatKnight, has had no trouble whatsoever, although he's using a very different strategy.
I suspect it has something to do with my Lua script, which I'll post here:
movie.rerecordcounting(false)
local state1 = savestate.create()
local state2 = savestate.create()
local H,S,D,A,M,X,Y= "hp","st","df","ag","mn","AB","!!"
local _ = "__"
local Growth={[0]=H,
_,_,D,X,_,M,_,A,_,_,X,_,X,_,_,
_,_,X,M,A,_,_,M,_,_,_,_,M,X,_,M,
_,_,_,_,_,_,A,_,_,_,X,M,X,H,X,_,
_,_,_,X,_,_,H,X,A,_,_,S,A,M,S,S,
H,_,X,_,A,_,_,_,X,_,_,_,_,A,_,M,
X,_,D,H,X,S,_,H,M,_,H,H,_,Y,H,_,
S,_,_,_,M,M,X,_,_,_,S,_,S,_,M,X,
_,S,H,A,_,H,_,S,_,S,_,X,X,_,_,_,
_,A,A,A,_,X,_,A,_,M,M,_,H,_,M,H,
A,M,_,_,D,X,X,_,H,H,M,H,_,_,H,_,
X,H,M,H,H,X,Y,H,H,X,_,_,_,_,_,A,
M,X,M,_,H,H,_,_,D,X,A,S,_,_,S,S,
_,X,_,X,_,M,H,X,_,H,H,M,H,D,X,_,
_,H,S,_,_,S,A,_,_,M,_,_,H,A,_,H,
S,M,H,M,_,_,_,M,M,A,D,X,S,M,_,_,
_,S,_,Y,M,_,M,D,X,D,X,_,_,H,X,X
}
local FrameTable={}
local FTI = 1
savestate.save(state1)
for i = 1, 300 do
emu.frameadvance()
savestate.save(state2)
frame = emu.framecount()
for k = 1, 8 do
joypad.set(1, {A = 1, B = 1, select = 1, start = 1})
emu.frameadvance()
end
local rng = memory.readbyte(0xC30B)
-- Uncomment for Agl. boost +5
--if rng == 130 or rng == 56 or rng == 221 then
-- Uncomment for TELEPOR
if rng == 235 then
FrameTable[FTI]=frame
FTI = FTI+1
end
savestate.load(state2)
end
savestate.load(state1)
for i = 1, #FrameTable do
gui.text(100, 9*i - 8 ,FrameTable[i])
end
emu.pause()
The part I'm most concerned about is that loop near the bottom, the one that says "for i = 1, 300 do". In that loop, you can see that it saves and loads the game 300 times in an effort to divine when I should restart the game (the game's RNG can be manipulated by restarting at different frames, but that's not too important to know). Basically, I'm asking the emulator for accuracy that's exact to the frame while loading and saving 300 times. You can see why this might cause a desync.
But I'm not absolutely certain. I thought it might have something to do with the rewind feature, but I just tried a run and it desynced with rewind disabled. I suppose it could also be my run-of-the-mill savestates, but it would be very discouraging if I couldn't even count on those.
I'm getting sick of failed runs of this game, so I'm counting on some advice from more experienced players. Can I modify my program to at least cut down on desyncs? Is there some option I can toggle that will help? What exactly might be causing these desyncs? (I read the article on Desync Help, but I need some contextual help at the moment.) Basically, what would you guys do if you were in my shoes?
Thanks!