1 #include "core/instance.hpp"
2 #include "core/messages.hpp"
3 #include "core/movie.hpp"
4 #include "core/runmode.hpp"
9 const uint64_t QUIT_MAGIC
= 0x87dd4df349e5eff7ULL
;
12 const uint64_t emulator_runmode::QUIT
= 1;
13 const uint64_t emulator_runmode::NORMAL
= 2;
14 const uint64_t emulator_runmode::LOAD
= 4;
15 const uint64_t emulator_runmode::ADVANCE_FRAME
= 8;
16 const uint64_t emulator_runmode::ADVANCE_SUBFRAME
= 16;
17 const uint64_t emulator_runmode::SKIPLAG
= 32;
18 const uint64_t emulator_runmode::SKIPLAG_PENDING
= 64;
19 const uint64_t emulator_runmode::PAUSE
= 128;
20 const uint64_t emulator_runmode::PAUSE_BREAK
= 256;
21 const uint64_t emulator_runmode::CORRUPT
= 512;
23 const unsigned emulator_runmode::P_START
= 0;
24 const unsigned emulator_runmode::P_VIDEO
= 1;
25 const unsigned emulator_runmode::P_SAVE
= 2;
26 const unsigned emulator_runmode::P_NONE
= 3;
28 emulator_runmode::emulator_runmode()
38 uint64_t emulator_runmode::get()
44 void emulator_runmode::set(uint64_t m
)
46 if(!m
|| m
& (m
- 1) || m
> CORRUPT
)
47 throw std::logic_error("Trying to set invalid runmode");
53 //If setting state, clear the variables to be at initial state.
58 bool emulator_runmode::is(uint64_t m
)
61 return ((mode
& m
) != 0);
64 void emulator_runmode::start_load()
69 saved_advanced
= advanced
;
70 saved_cancel
= cancel
;
76 void emulator_runmode::end_load()
80 advanced
= saved_advanced
;
81 cancel
= saved_cancel
;
86 void emulator_runmode::decay_skiplag()
89 if(mode
== SKIPLAG_PENDING
) {
94 void emulator_runmode::decay_break()
97 if(mode
== PAUSE_BREAK
) {
102 void emulator_runmode::revalidate()
104 if(!mode
|| mode
& (mode
- 1) || (mode
== QUIT
&& magic
!= QUIT_MAGIC
) || mode
> CORRUPT
) {
108 emerg_save_movie(core
.mlogic
->get_mfile(), core
.mlogic
->get_rrdata());
109 messages
<< "WARNING: Emulator runmode undefined, invoked movie dump." << std::endl
;
114 bool emulator_runmode::set_and_test_advanced()
121 void emulator_runmode::set_cancel()
128 bool emulator_runmode::clear_and_test_cancel()
135 bool emulator_runmode::test_cancel()
140 bool emulator_runmode::test_advanced()
145 void emulator_runmode::set_point(unsigned _point
)
150 unsigned emulator_runmode::get_point()