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);
|
||||
extern lua_render_context* lua_render_ctx;
|
||||
extern controller_frame* lua_input_controllerdata;
|
||||
extern bool lua_booted_flag;
|
||||
|
||||
template<typename T>
|
||||
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;
|
||||
controller_frame* lua_input_controllerdata = NULL;
|
||||
bool lua_booted_flag = false;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -420,6 +421,7 @@ void lua_callback_do_readwrite() throw()
|
|||
|
||||
void lua_callback_startup() throw()
|
||||
{
|
||||
lua_booted_flag = true;
|
||||
if(!callback_exists("on_startup"))
|
||||
return;
|
||||
run_lua_cb(0);
|
||||
|
|
|
@ -45,4 +45,9 @@ namespace
|
|||
command::invokeC(text);
|
||||
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