1#ifndef STATEMANAGER_H
2#define STATEMANAGER_H
3
4/* State Manager Class that records snapshot data for rewinding
5 mostly based on SSNES's rewind code by Themaister
6*/
7
8#include "snes9x.h"
9
10class StateManager {
11private:
12 uint64_t *buffer;
13 size_t buf_size;
14 size_t buf_size_mask;
15 uint32_t *tmp_state;
16 uint32_t *in_state;
17 size_t top_ptr;
18 size_t bottom_ptr;
19 size_t state_size;
20 size_t real_state_size;
21 bool init_done;
22 bool first_pop;
23
24 void reassign_bottom();
25 void generate_delta(const void *data);
26 void deallocate();
27public:
28 StateManager();
29 ~StateManager();
30 bool init(size_t buffer_size);
31 int pop();
32 bool push();
33};
34
35#endif // STATEMANAGER_H
36