diff --git a/include/lua/unsaferewind.hpp b/include/lua/unsaferewind.hpp index f8cf109d..0199f031 100644 --- a/include/lua/unsaferewind.hpp +++ b/include/lua/unsaferewind.hpp @@ -10,6 +10,7 @@ struct lua_unsaferewind uint64_t secs; uint64_t ssecs; std::vector pollcounters; + std::vector hostmemory; }; -#endif \ No newline at end of file +#endif diff --git a/src/lua/lua.cpp b/src/lua/lua.cpp index 932a8257..2b1ad343 100644 --- a/src/lua/lua.cpp +++ b/src/lua/lua.cpp @@ -429,6 +429,7 @@ void lua_callback_do_unsafe_rewind(const std::vector& save, uint64_t secs, run_callback("on_pre_rewind"); mainloop_restore_state(u2->state, u2->secs, u2->ssecs); mov.fast_load(u2->frame, u2->ptr, u2->lag, u2->pollcounters); + try { get_host_memory() = u2->hostmemory; } catch(...) {} run_callback("on_post_rewind"); } catch(...) { return; @@ -440,6 +441,7 @@ void lua_callback_do_unsafe_rewind(const std::vector& save, uint64_t secs, u2->state = save; u2->secs = secs, u2->ssecs = ssecs; + u2->hostmemory = get_host_memory(); mov.fast_save(u2->frame, u2->ptr, u2->lag, u2->pollcounters); return 1; }));