Wxwidgets: Support -h and --help

This commit is contained in:
Ilari Liusvaara 2013-02-11 00:09:49 +02:00
parent 629beb01d5
commit 1732705e62

View file

@ -319,6 +319,7 @@ private:
std::string c_rom;
std::string c_file;
std::vector<std::string> c_lua;
bool exit_immediately;
};
IMPLEMENT_APP(lsnes_app)
@ -326,6 +327,7 @@ IMPLEMENT_APP(lsnes_app)
lsnes_app::lsnes_app()
{
settings_mode = false;
exit_immediately = false;
}
void lsnes_app::OnInitCmdLine(wxCmdLineParser& parser)
@ -341,6 +343,15 @@ bool lsnes_app::OnCmdLineParsed(wxCmdLineParser& parser)
cmdline.push_back(tostdstring(parser.GetParam(i)));
for(auto i: cmdline) {
regex_results r;
if(i == "--help" || i == "-h") {
std::cout << "--settings: Show the settings dialog" << std::endl;
std::cout << "--rom=<filename>: Load specified ROM on startup" << std::endl;
std::cout << "--load=<filename>: Load specified save/movie on starup" << std::endl;
std::cout << "--lua=<filename>: Load specified Lua script on startup" << std::endl;
std::cout << "<filename>: Load specified ROM on startup" << std::endl;
exit_immediately = true;
return true;
}
if(i == "--settings")
settings_mode = true;
if(r = regex("--rom=(.+)", i))
@ -359,6 +370,8 @@ bool lsnes_app::OnCmdLineParsed(wxCmdLineParser& parser)
bool lsnes_app::OnInit()
{
wxApp::OnInit();
if(exit_immediately)
return false;
reached_main();
set_random_seed();