Allow playing movies from command line. Also remove some unneeded code.

This commit is contained in:
Rachel Bryk 2013-03-13 01:37:35 -04:00
parent 78d0ff1ab7
commit e73cc858bc
2 changed files with 23 additions and 12 deletions

View File

@ -162,6 +162,11 @@ bool DolphinApp::OnInit()
"Low level (LLE) or high level (HLE) audio",
wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL
},
{
wxCMD_LINE_OPTION, "m", "movie",
"Play a movie file",
wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL
},
{
wxCMD_LINE_NONE, NULL, NULL, NULL, wxCMD_LINE_VAL_NONE, 0
}
@ -182,6 +187,7 @@ bool DolphinApp::OnInit()
&videoBackendName);
selectAudioEmulation = parser.Found(wxT("audio_emulation"),
&audioEmulationName);
playMovie = parser.Found(wxT("movie"), &movieFile);
#endif // wxUSE_CMDLINE_PARSER
#if defined _DEBUG && defined _WIN32
@ -331,8 +337,21 @@ void DolphinApp::AfterInit(wxTimerEvent& WXUNUSED(event))
if (!BatchMode)
main_frame->UpdateGameList();
if (playMovie && movieFile != wxEmptyString)
{
if (Movie::PlayInput(movieFile.char_str()))
{
if (LoadFile && FileToLoad != wxEmptyString)
{
main_frame->BootGame(WxStrToStr(FileToLoad));
}
else
main_frame->BootGame(std::string(""));
}
}
// First check if we have an exec command line.
if (LoadFile && FileToLoad != wxEmptyString)
else if (LoadFile && FileToLoad != wxEmptyString)
{
main_frame->BootGame(WxStrToStr(FileToLoad));
}
@ -342,17 +361,7 @@ void DolphinApp::AfterInit(wxTimerEvent& WXUNUSED(event))
{
if (main_frame->g_pCodeWindow->AutomaticStart())
{
if(!SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM.empty()
&& File::Exists(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM))
{
main_frame->BootGame(SConfig::GetInstance().m_LocalCoreStartupParameter.
m_strDefaultGCM);
}
else if(!SConfig::GetInstance().m_LastFilename.empty()
&& File::Exists(SConfig::GetInstance().m_LastFilename))
{
main_frame->BootGame(SConfig::GetInstance().m_LastFilename);
}
main_frame->BootGame("");
}
}
}

View File

@ -40,7 +40,9 @@ private:
wxTimer *m_afterinit;
bool BatchMode;
bool LoadFile;
bool playMovie;
wxString FileToLoad;
wxString movieFile;
wxLocale *m_locale;
void AfterInit(wxTimerEvent& WXUNUSED(event));