diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2016-02-14 11:20:49 +0100 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2016-02-14 11:20:49 +0100 |
commit | 618a7d4d283bb2b139b56d029cb09b750b3ba90a (patch) | |
tree | 42a5a6104db2f02ef078f1bb7357f1cebe3f6baf | |
parent | ccae0382bb750c1deded19e05b34933a8303465e (diff) |
initialize LUA bit earlier to give more opportunities to scripts (nw)
-rw-r--r-- | src/emu/clifront.cpp | 7 | ||||
-rw-r--r-- | src/emu/mame.cpp | 24 | ||||
-rw-r--r-- | src/emu/mame.h | 1 |
3 files changed, 20 insertions, 12 deletions
diff --git a/src/emu/clifront.cpp b/src/emu/clifront.cpp index a016d13a031..0679d419099 100644 --- a/src/emu/clifront.cpp +++ b/src/emu/clifront.cpp @@ -99,6 +99,8 @@ int cli_frontend::execute(int argc, char **argv) { // wrap the core execution in a try/catch to field all fatal errors m_result = MAMERR_NONE; + machine_manager *manager = machine_manager::instance(m_options, m_osd); + try { // first parse options to be able to get software from it @@ -106,6 +108,8 @@ int cli_frontend::execute(int argc, char **argv) m_options.parse_command_line(argc, argv, option_errors); m_options.parse_standard_inis(option_errors); + + manager->start_luaengine(); if (*(m_options.software_name()) != 0) { @@ -211,9 +215,7 @@ int cli_frontend::execute(int argc, char **argv) throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "Unknown system '%s'", m_options.system_name()); // otherwise just run the game - machine_manager *manager = machine_manager::instance(m_options, m_osd); m_result = manager->execute(); - global_free(manager); } } @@ -264,6 +266,7 @@ int cli_frontend::execute(int argc, char **argv) } _7z_file_cache_clear(); + global_free(manager); return m_result; } diff --git a/src/emu/mame.cpp b/src/emu/mame.cpp index 55fc78928f8..813455e0b8d 100644 --- a/src/emu/mame.cpp +++ b/src/emu/mame.cpp @@ -151,6 +151,20 @@ void machine_manager::update_machine() m_lua->set_machine(m_machine); } + +void machine_manager::start_luaengine() +{ + m_lua->initialize(); + { + emu_file file(options().plugins_path(), OPEN_FLAG_READ); + file_error filerr = file.open("boot.lua"); + if (filerr == FILERR_NONE) + { + m_lua->load_script(file.fullpath()); + } + } +} + /*------------------------------------------------- execute - run the core emulation -------------------------------------------------*/ @@ -166,16 +180,6 @@ int machine_manager::execute() bool exit_pending = false; int error = MAMERR_NONE; - m_lua->initialize(); - { - emu_file file(options().plugins_path(), OPEN_FLAG_READ); - file_error filerr = file.open("boot.lua"); - if (filerr == FILERR_NONE) - { - m_lua->load_script(file.fullpath()); - } - } - if (m_options.console()) { m_lua->start_console(); } diff --git a/src/emu/mame.h b/src/emu/mame.h index eb2f510c114..fb490f80859 100644 --- a/src/emu/mame.h +++ b/src/emu/mame.h @@ -96,6 +96,7 @@ public: /* execute as configured by the OPTION_SYSTEMNAME option on the specified options */ int execute(); + void start_luaengine(); void schedule_new_driver(const game_driver &driver); private: osd_interface & m_osd; // reference to OSD system |