diff --git a/lsnes.cpp b/lsnes.cpp index 1f71fd19..e4177b9a 100644 --- a/lsnes.cpp +++ b/lsnes.cpp @@ -57,6 +57,22 @@ struct moviefile generate_movie_template(std::vector cmdline, loade return movie; } +namespace +{ + void run_extra_scripts(const std::vector& cmdline) + { + for(auto i = cmdline.begin(); i != cmdline.end(); i++) { + std::string o = *i; + if(o.length() >= 6 && o.substr(0, 6) == "--run=") { + std::string file = o.substr(6); + messages << "--- Running " << file << " --- " << std::endl; + command::invokeC("run-script " + file); + messages << "--- End running " << file << " --- " << std::endl; + } + } + } +} + #if defined(_WIN32) || defined(_WIN64) int SDL_main(int argc, char** argv) #else @@ -93,6 +109,8 @@ int main(int argc, char** argv) command::invokeC("run-script " + cfgpath + "/lsnes.rc"); messages << "--- End running lsnesrc --- " << std::endl; + run_extra_scripts(cmdline); + messages << "--- Loading ROM ---" << std::endl; struct loaded_rom r; try {