1 #include "lua/internal.hpp"
2 #include "core/movie.hpp"
3 #include "core/moviedata.hpp"
7 function_ptr_luafun
mcurframe("movie.currentframe", [](lua_State
* LS
, const std::string
& fname
) -> int {
9 lua_pushnumber(LS
, m
.get_current_frame());
13 function_ptr_luafun
mfc("movie.framecount", [](lua_State
* LS
, const std::string
& fname
) -> int {
14 auto& m
= get_movie();
15 lua_pushnumber(LS
, m
.get_frame_count());
19 function_ptr_luafun
mro("movie.readonly", [](lua_State
* LS
, const std::string
& fname
) -> int {
20 auto& m
= get_movie();
21 lua_pushboolean(LS
, m
.readonly_mode() ? 1 : 0);
25 function_ptr_luafun
mrw("movie.readwrite", [](lua_State
* LS
, const std::string
& fname
) -> int {
26 auto& m
= get_movie();
27 m
.readonly_mode(false);
31 function_ptr_luafun
mfs("movie.frame_subframes", [](lua_State
* LS
, const std::string
& fname
) -> int {
32 uint64_t frame
= get_numeric_argument
<uint64_t>(LS
, 1, "movie.frame_subframes");
33 auto& m
= get_movie();
34 lua_pushnumber(LS
, m
.frame_subframes(frame
));
38 function_ptr_luafun
mrs("movie.read_subframes", [](lua_State
* LS
, const std::string
& fname
) -> int {
39 uint64_t frame
= get_numeric_argument
<uint64_t>(LS
, 1, "movie.frame_subframes");
40 uint64_t subframe
= get_numeric_argument
<uint64_t>(LS
, 2, "movie.frame_subframes");
41 auto& m
= get_movie();
42 controller_frame r
= m
.read_subframe(frame
, subframe
);
45 lua_pushnumber(LS
, 0);
46 lua_pushnumber(LS
, r
.sync() ? 1 : 0);
48 lua_pushnumber(LS
, 1);
49 lua_pushnumber(LS
, r
.reset() ? 1 : 0);
51 lua_pushnumber(LS
, 2);
52 lua_pushnumber(LS
, r
.delay().first
);
54 lua_pushnumber(LS
, 3);
55 lua_pushnumber(LS
, r
.delay().second
);
58 for(size_t i
= 0; i
< MAX_BUTTONS
; i
++) {
59 lua_pushnumber(LS
, i
+ 4);
60 lua_pushnumber(LS
, r
.axis2(i
));
66 function_ptr_luafun
rrc("movie.read_rtc", [](lua_State
* LS
, const std::string
& fname
) -> int {
67 lua_pushnumber(LS
, our_movie
.rtc_second
);
68 lua_pushnumber(LS
, our_movie
.rtc_subsecond
);