movb -> lsnes_instance.mlogic
[lsnes.git] / include / core / movie.hpp
blob721894d6d5a39c8afcba3395080488c99c1acf42
1 #ifndef _movie__hpp__included__
2 #define _movie__hpp__included__
4 #include <string>
5 #include <cstdint>
6 #include <stdexcept>
7 #include "core/controllerframe.hpp"
8 #include "core/moviefile.hpp"
9 #include "library/rrdata.hpp"
10 #include "library/movie.hpp"
12 /**
13 * Class encapsulating bridge logic between core interface and movie code.
15 class movie_logic
17 public:
18 /**
19 * Create new bridge.
21 movie_logic() throw();
22 /**
23 * Has movie?
25 operator bool() throw() { return mov; }
26 bool operator!() throw() { return !mov; }
27 /**
28 * Get the movie instance associated.
30 * returns: The movie instance.
32 movie& get_movie() throw(std::runtime_error);
34 /**
35 * Set the movie instance associated.
37 void set_movie(movie& _mov, bool free_old = false) throw();
39 /**
40 * Get the current movie file.
42 moviefile& get_mfile() throw(std::runtime_error);
44 /**
45 * Set the current movie file.
47 void set_mfile(moviefile& _mf, bool free_old = false) throw();
48 /**
49 * Get current rrdata.
51 rrdata_set& get_rrdata() throw(std::runtime_error);
53 /**
54 * Set current rrdata.
56 void set_rrdata(rrdata_set& _rrd, bool free_old = false) throw();
58 /**
59 * Notify about new frame starting.
61 void new_frame_starting(bool dont_poll) throw(std::bad_alloc, std::runtime_error);
63 /**
64 * Poll for input.
66 * parameter port: The port number.
67 * parameter dev: The controller index.
68 * parameter id: Control id.
69 * returns: Value for polled input.
70 * throws std::bad_alloc: Not enough memory.
71 * throws std::runtime_error: Error polling for input.
73 short input_poll(unsigned port, unsigned dev, unsigned id) throw(std::bad_alloc, std::runtime_error);
75 /**
76 * Called when movie code needs new controls snapshot.
78 * parameter subframe: True if this is for subframe update, false if for frame update.
80 controller_frame update_controls(bool subframe) throw(std::bad_alloc, std::runtime_error);
82 /**
83 * Release memory for mov, mf and rrd.
85 void release_memory();
86 private:
87 movie_logic(const movie_logic&);
88 movie_logic& operator=(const movie_logic&);
89 movie* mov;
90 moviefile* mf;
91 rrdata_set* rrd;
94 #endif