Support specifying extra configuration files to run from commmand line

This commit is contained in:
Ilari Liusvaara 2011-09-18 10:13:42 +03:00
parent bb54273daa
commit 9a0e890157

View file

@ -57,6 +57,22 @@ struct moviefile generate_movie_template(std::vector<std::string> cmdline, loade
return movie;
}
namespace
{
void run_extra_scripts(const std::vector<std::string>& 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 {