1 #ifndef _runmode__hpp__included__
2 #define _runmode__hpp__included__
9 const static uint64_t QUIT
;
10 const static uint64_t NORMAL
;
11 const static uint64_t LOAD
;
12 const static uint64_t ADVANCE_FRAME
;
13 const static uint64_t ADVANCE_SUBFRAME
;
14 const static uint64_t SKIPLAG
;
15 const static uint64_t SKIPLAG_PENDING
;
16 const static uint64_t PAUSE
;
17 const static uint64_t PAUSE_BREAK
;
18 const static uint64_t CORRUPT
;
20 const static unsigned P_START
;
21 const static unsigned P_VIDEO
;
22 const static unsigned P_SAVE
;
23 const static unsigned P_NONE
;
29 * Save current mode and set mode to LOAD.
37 * Decay SKIPLAG_PENDING to SKIPLAG.
41 * Decay PAUSE_BREAK into PAUSE.
47 bool is_paused() { return is(PAUSE
| PAUSE_BREAK
); }
51 bool is_paused_normal() { return is(PAUSE
); }
53 * Is paused debug break?
55 bool is_paused_break() { return is(PAUSE_BREAK
); }
57 * Is advancing frames?
59 bool is_advance_frame() { return is(ADVANCE_FRAME
); }
61 * Is advancing subframes?
63 bool is_advance_subframe() { return is(ADVANCE_SUBFRAME
); }
65 * Is advancing (frames or subframes)?
67 bool is_advance() { return is(ADVANCE_FRAME
|ADVANCE_SUBFRAME
); }
71 bool is_skiplag() { return is(SKIPLAG
); }
75 bool is_freerunning() { return is(NORMAL
); }
79 bool is_special() { return is(QUIT
|LOAD
|CORRUPT
); }
83 bool is_load() { return is(LOAD
); }
87 bool is_quit() { return is(QUIT
); }
91 void set_pause() { set(PAUSE
); }
95 void set_break() { set(PAUSE_BREAK
); }
99 void set_quit() { set(QUIT
); }
103 void set_freerunning() { set(NORMAL
); }
107 * The advanced and cancel flags are cleared.
109 void set_frameadvance() { set(ADVANCE_FRAME
); }
111 * Set advance subframe.
113 * The advanced and cancel flags are cleared.
115 void set_subframeadvance() { set(ADVANCE_SUBFRAME
); }
117 * Set pending skiplag.
119 void set_skiplag_pending() { set(SKIPLAG_PENDING
); }
121 * Set pause or freerunning.
123 void set_pause_cond(bool paused
) { set(paused
? PAUSE
: NORMAL
); }
125 * Set advanced flag and return previous value.
127 bool set_and_test_advanced();
133 * Test and clear cancel flag.
135 bool clear_and_test_cancel();
137 * Is cancel flag set?
141 * Is advanced flag set?
143 bool test_advanced();
147 bool is_corrupt() { return is(CORRUPT
); }
151 void set_corrupt() { set(CORRUPT
); }
153 * Clear corrupt flag.
155 void clear_corrupt() { set(LOAD
); }
159 void set_point(unsigned _point
);
163 unsigned get_point();
165 * Get the current runmode.
170 void set(uint64_t m
);
174 uint64_t magic
; //If mode is QUIT, this has to be QUIT_MAGIC.
175 //Flags relating to repeating advance.
176 bool advanced
; //This is second or subsequent advance.
177 bool cancel
; //Cancel advance at next oppurtunity.