diff --git a/docs/index.html b/docs/index.html
index 7ac6f73fe..db5ace441 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -717,6 +717,12 @@
F9 |
+
+ Save all states |
+ Alt + F9 |
+ Cmd + F9 |
+
+
Change current state slot |
F10 |
@@ -729,6 +735,12 @@
F11 |
+
+ Load all states |
+ Alt + F11 |
+ Cmd + F1 |
+
+
Save PNG snapshot |
F12 |
@@ -1819,6 +1831,8 @@
'Rewind One' button | Navigates back by one state |
'Unwind One' button | Navigates forward by one state |
'Unwind All' button | Navigates forward to the end of the timeline |
+ 'Save All' button | Saves all states to disk |
+ 'Load All' button | Loades all states from disk |
Navigation info | Informs about the interval of the user's last
Time Machine navigation. The interval can vary if the timeline is compressed. |
Total time | Shows the total time covered by the save states
diff --git a/src/common/RewindManager.cxx b/src/common/RewindManager.cxx
index 021fc0350..32bf64002 100644
--- a/src/common/RewindManager.cxx
+++ b/src/common/RewindManager.cxx
@@ -237,7 +237,10 @@ string RewindManager::saveAllStates()
if (!out)
return "Can't save to all states file";
- int numStates = rewindStates(1000) + 1;
+ uInt32 curIdx = getCurrentIdx();
+ rewindStates(1000);
+ uInt32 numStates = uInt32(cyclesList().size());
+
// Save header
buf.str("");
out.putString(STATE_HEADER);
@@ -245,7 +248,7 @@ string RewindManager::saveAllStates()
out.putInt(myStateSize);
unique_ptr buffer = make_unique(myStateSize);
- for (int i = 0; i < numStates; i++)
+ for (uInt32 i = 0; i < numStates; i++)
{
RewindState& state = myStateList.current();
Serializer& s = state.data;
@@ -260,6 +263,8 @@ string RewindManager::saveAllStates()
if (i < numStates)
unwindStates(1);
}
+ // restore old state position
+ rewindStates(numStates - curIdx);
buf.str("");
buf << "Saved " << numStates << " states";
@@ -287,7 +292,7 @@ string RewindManager::loadAllStates()
return "Can't load from all states file";
clear();
- int numStates;
+ uInt32 numStates;
// Load header
buf.str("");
@@ -298,7 +303,7 @@ string RewindManager::loadAllStates()
myStateSize = in.getInt();
unique_ptr buffer = make_unique(myStateSize);
- for (int i = 0; i < numStates; i++)
+ for (uInt32 i = 0; i < numStates; i++)
{
if (myStateList.full())
compressStates();
|