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", "Low level (LLE) or high level (HLE) audio",
wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL 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 wxCMD_LINE_NONE, NULL, NULL, NULL, wxCMD_LINE_VAL_NONE, 0
} }
@ -182,6 +187,7 @@ bool DolphinApp::OnInit()
&videoBackendName); &videoBackendName);
selectAudioEmulation = parser.Found(wxT("audio_emulation"), selectAudioEmulation = parser.Found(wxT("audio_emulation"),
&audioEmulationName); &audioEmulationName);
playMovie = parser.Found(wxT("movie"), &movieFile);
#endif // wxUSE_CMDLINE_PARSER #endif // wxUSE_CMDLINE_PARSER
#if defined _DEBUG && defined _WIN32 #if defined _DEBUG && defined _WIN32
@ -331,28 +337,31 @@ void DolphinApp::AfterInit(wxTimerEvent& WXUNUSED(event))
if (!BatchMode) if (!BatchMode)
main_frame->UpdateGameList(); main_frame->UpdateGameList();
// First check if we have an exec command line. if (playMovie && movieFile != wxEmptyString)
{
if (Movie::PlayInput(movieFile.char_str()))
{
if (LoadFile && FileToLoad != wxEmptyString) if (LoadFile && FileToLoad != wxEmptyString)
{ {
main_frame->BootGame(WxStrToStr(FileToLoad)); main_frame->BootGame(WxStrToStr(FileToLoad));
} }
else
main_frame->BootGame(std::string(""));
}
}
// First check if we have an exec command line.
else if (LoadFile && FileToLoad != wxEmptyString)
{
main_frame->BootGame(WxStrToStr(FileToLoad));
}
// If we have selected Automatic Start, start the default ISO, // If we have selected Automatic Start, start the default ISO,
// or if no default ISO exists, start the last loaded ISO // or if no default ISO exists, start the last loaded ISO
else if (main_frame->g_pCodeWindow) else if (main_frame->g_pCodeWindow)
{ {
if (main_frame->g_pCodeWindow->AutomaticStart()) if (main_frame->g_pCodeWindow->AutomaticStart())
{ {
if(!SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM.empty() main_frame->BootGame("");
&& 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);
}
} }
} }
} }

View File

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