Post subject: lsnes loading savestate through lua script
Joined: 4/6/2013
Posts: 9
I'm trying to write a script that repeatedly loads a savestate in lsnes and tries different inputs. The savestate seems to save in an array, but I can't get it to load back properly. This is an outline of what I have right now:
on_post_load = function ()
    savestate = memory.mapbyte()
end

on_frame = function ()
    --Try some stuff and record results
    if framecount == 3 then
        memory.writeregion(0, 0x7FFFFF, savestate)
    end
end
Is there a better way to do this or am I just missing something simple like the memory size? Thanks!
Post subject: Re: lsnes loading savestate through lua script
Emulator Coder, Skilled player (1140)
Joined: 5/1/2010
Posts: 1217
GoldFibre wrote:
I'm trying to write a script that repeatedly loads a savestate in lsnes and tries different inputs. The savestate seems to save in an array, but I can't get it to load back properly.
Savestates save into a file (or in case of unsafe rewind, to an object). exec("save-state foo.lsmv") -- That should save state as soon as possible. exec("load-state foo.lsmv") -- Load a state. For unsafe rewinds, there is function movie.unsaferewind and callback on_set_rewind (manual describes more about these).
Post subject: Re: lsnes loading savestate through lua script
Joined: 4/6/2013
Posts: 9
Ilari wrote:
exec("save-state foo.lsmv") -- That should save state as soon as possible. exec("load-state foo.lsmv") -- Load a state.
That's a lot simpler than what I was doing. Thanks!