From e73cc858bc14717c08e99eb1f3f9214ed4f6013f Mon Sep 17 00:00:00 2001 From: Rachel Bryk Date: Wed, 13 Mar 2013 01:37:35 -0400 Subject: [PATCH] Allow playing movies from command line. Also remove some unneeded code. --- Source/Core/DolphinWX/Src/Main.cpp | 33 +++++++++++++++++++----------- Source/Core/DolphinWX/Src/Main.h | 2 ++ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp index 37311c84bf..179c69b5f0 100644 --- a/Source/Core/DolphinWX/Src/Main.cpp +++ b/Source/Core/DolphinWX/Src/Main.cpp @@ -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(""); } } } diff --git a/Source/Core/DolphinWX/Src/Main.h b/Source/Core/DolphinWX/Src/Main.h index 0fb99fcfd4..d043a6c24e 100644 --- a/Source/Core/DolphinWX/Src/Main.h +++ b/Source/Core/DolphinWX/Src/Main.h @@ -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));