From a66cb36cc79dc9ecefd9e78441b321153ed4ac95 Mon Sep 17 00:00:00 2001 From: vadosnaprimer Date: Tue, 10 Oct 2017 21:31:01 +0300 Subject: Rewind feature and RAM savestates. This starts the work requested in #2398. How RAM states work. Implemented using util::vectorstream. Instead of dumping m_save.m_entry_list to file, it writes them as binary to vectorstream. Compression is not used, as it would slow down the process. The header is written as usual, also in binary. When a state is loaded, the savestate data gets binary-read from vectorstream. How rewind works. Rewind is optional, it can be turned off through MAME GUI while not running. Rewind capacity is available there too. Rewind step hotkey is available from the standard hotkey menu. In the debugger you have the "rewind" command ("rw" shortcut) that works the same as the hotkey. Every time you advance a frame (pause step), rewinder captures a RAM savestate of the frame you were at. It does the same when you do step into/over/out in the debugger. Every time it captures a new state (and when you unpause), it marks as invalid all its states that go after the current machine time, because input might change, so they are not relevant anymore. It keeps their buffers allocated though, for future use. When rewinder runs out of allowed amount of savestates it can have, it invalidates the first state in the list and tosses its unique_ptr to the end of the list, then it uses its buffer to capture a new state. When you hit the rewind step key, or use "rewind" command in the debugger, it loads a state that is immediately before the current machine time. Invalid states between valid ones are not allowed to appear, as that breaks rewinder integrity and causes problems. Rewinder keeps its own set of ram states as a vector of unique_ptr's. All rewinder operations and errors get reported using machine().popmessage(). --- src/emu/debug/debugcmd.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/emu/debug/debugcmd.h') diff --git a/src/emu/debug/debugcmd.h b/src/emu/debug/debugcmd.h index 98b6d8ae03d..41405ec0a71 100644 --- a/src/emu/debug/debugcmd.h +++ b/src/emu/debug/debugcmd.h @@ -131,6 +131,7 @@ private: void execute_hotspot(int ref, const std::vector ¶ms); void execute_statesave(int ref, const std::vector ¶ms); void execute_stateload(int ref, const std::vector ¶ms); + void execute_rewind(int ref, const std::vector ¶ms); void execute_save(int ref, const std::vector ¶ms); void execute_load(int ref, const std::vector ¶ms); void execute_dump(int ref, const std::vector ¶ms); -- cgit v1.2.3-70-g09d2