Add emulator_ready() lua function
This function gives a flag telling if emulator has finished booting up.
This commit is contained in:
parent
b0bb6053a9
commit
2124f3b9b6
3 changed files with 8 additions and 0 deletions
|
@ -14,6 +14,7 @@ bool get_boolean_argument(lua_State* LS, unsigned argindex, const char* fname);
|
||||||
void push_keygroup_parameters(lua_State* LS, const struct keygroup::parameters& p);
|
void push_keygroup_parameters(lua_State* LS, const struct keygroup::parameters& p);
|
||||||
extern lua_render_context* lua_render_ctx;
|
extern lua_render_context* lua_render_ctx;
|
||||||
extern controller_frame* lua_input_controllerdata;
|
extern controller_frame* lua_input_controllerdata;
|
||||||
|
extern bool lua_booted_flag;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T get_numeric_argument(lua_State* LS, unsigned argindex, const char* fname)
|
T get_numeric_argument(lua_State* LS, unsigned argindex, const char* fname)
|
||||||
|
|
|
@ -196,6 +196,7 @@ void push_keygroup_parameters(lua_State* LS, const struct keygroup::parameters&
|
||||||
|
|
||||||
lua_render_context* lua_render_ctx = NULL;
|
lua_render_context* lua_render_ctx = NULL;
|
||||||
controller_frame* lua_input_controllerdata = NULL;
|
controller_frame* lua_input_controllerdata = NULL;
|
||||||
|
bool lua_booted_flag = false;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -420,6 +421,7 @@ void lua_callback_do_readwrite() throw()
|
||||||
|
|
||||||
void lua_callback_startup() throw()
|
void lua_callback_startup() throw()
|
||||||
{
|
{
|
||||||
|
lua_booted_flag = true;
|
||||||
if(!callback_exists("on_startup"))
|
if(!callback_exists("on_startup"))
|
||||||
return;
|
return;
|
||||||
run_lua_cb(0);
|
run_lua_cb(0);
|
||||||
|
|
|
@ -45,4 +45,9 @@ namespace
|
||||||
command::invokeC(text);
|
command::invokeC(text);
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function_ptr_luafun lua_booted("emulator_ready", [](lua_State* LS, const std::string& fname) -> int {
|
||||||
|
lua_pushboolean(LS, lua_booted_flag ? 1 : 0);
|
||||||
|
return 1;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue