5 function_ptr_luafun
iset("input.set", [](lua_State
* LS
, const std::string
& fname
) -> int {
6 if(!lua_input_controllerdata
)
8 unsigned controller
= get_numeric_argument
<unsigned>(LS
, 1, fname
.c_str());
9 unsigned index
= get_numeric_argument
<unsigned>(LS
, 2, fname
.c_str());
10 short value
= get_numeric_argument
<short>(LS
, 3, fname
.c_str());
11 if(controller
> 7 || index
> 11)
13 (*lua_input_controllerdata
)(controller
>> 2, controller
& 3, index
) = value
;
17 function_ptr_luafun
iget("input.get", [](lua_State
* LS
, const std::string
& fname
) -> int {
18 if(!lua_input_controllerdata
)
20 unsigned controller
= get_numeric_argument
<unsigned>(LS
, 1, fname
.c_str());
21 unsigned index
= get_numeric_argument
<unsigned>(LS
, 2, fname
.c_str());
22 if(controller
> 7 || index
> 11)
24 lua_pushnumber(LS
, (*lua_input_controllerdata
)(controller
>> 2, controller
& 3, index
));
28 function_ptr_luafun
ireset("input.reset", [](lua_State
* LS
, const std::string
& fname
) -> int {
29 if(!lua_input_controllerdata
)
32 get_numeric_argument(LS
, 1, cycles
, fname
.c_str());
35 short lo
= cycles
% 10000;
36 short hi
= cycles
/ 10000;
37 (*lua_input_controllerdata
)(CONTROL_SYSTEM_RESET
) = 1;
38 (*lua_input_controllerdata
)(CONTROL_SYSTEM_RESET_CYCLES_HI
) = hi
;
39 (*lua_input_controllerdata
)(CONTROL_SYSTEM_RESET_CYCLES_LO
) = lo
;