JSON-based controller descriptions
[lsnes.git] / src / core / movie.cpp
blobdc52a4c00975dcda88846cfdea18101aacb65e12
1 #include "lsnes.hpp"
3 #include "core/misc.hpp"
4 #include "core/movie.hpp"
5 #include "core/rom.hpp"
6 #include "interface/romtype.hpp"
8 #include <stdexcept>
9 #include <cassert>
10 #include <cstring>
11 #include <fstream>
14 movie_logic::movie_logic() throw()
18 movie& movie_logic::get_movie() throw()
20 return mov;
23 void movie_logic::new_frame_starting(bool dont_poll) throw(std::bad_alloc, std::runtime_error)
25 mov.next_frame();
26 controller_frame c = update_controls(false);
27 if(!mov.readonly_mode()) {
28 mov.set_controls(c);
29 if(!dont_poll)
30 mov.set_all_DRDY();
31 } else if(!dont_poll)
32 mov.set_all_DRDY();
35 short movie_logic::input_poll(unsigned port, unsigned dev, unsigned id) throw(std::bad_alloc, std::runtime_error)
37 if(!mov.get_DRDY(port, dev, id)) {
38 mov.set_controls(update_controls(true));
39 mov.set_all_DRDY();
41 int16_t in = mov.next_input(port, dev, id);
42 //std::cerr << "BSNES asking for (" << port << "," << dev << "," << id << ") (frame "
43 // << mov.get_current_frame() << ") giving " << in << std::endl;
44 return in;