diff --git a/desmume/src/commandline.cpp b/desmume/src/commandline.cpp index c8921bf68..4326d9d3f 100644 --- a/desmume/src/commandline.cpp +++ b/desmume/src/commandline.cpp @@ -39,6 +39,9 @@ CommandLine::~CommandLine() g_option_context_free (ctx); } +static const char* _play_movie_file; +static const char* _record_movie_file; + void CommandLine::loadCommonOptions() { //these options should be available in every port. @@ -47,6 +50,8 @@ void CommandLine::loadCommonOptions() //(you may need to use ifdefs to cause options to be entered in the desired order) static const GOptionEntry options[] = { { "load-slot", 0, 0, G_OPTION_ARG_INT, &load_slot, "Loads savegame from slot NUM", "NUM"}, + { "play-movie", 0, 0, G_OPTION_ARG_FILENAME, &_play_movie_file, "Specifies a dsm format movie to play", "PATH_TO_PLAY_MOVIE"}, + { "record-movie", 0, 0, G_OPTION_ARG_FILENAME, &_record_movie_file, "Specifies a path to a new dsm format movie", "PATH_TO_RECORD_MOVIE"}, { NULL } }; @@ -62,6 +67,9 @@ bool CommandLine::parse(int argc,char **argv) return false; } + if(_play_movie_file) play_movie_file = _play_movie_file; + if(_record_movie_file) record_movie_file = _record_movie_file; + if (argc == 2) nds_file = argv[1]; if (argc > 2) @@ -77,6 +85,16 @@ bool CommandLine::validate() return false; } + if(play_movie_file != "" && record_movie_file != "") { + g_printerr("Cannot both play and record a movie.\n"); + return false; + } + + if(record_movie_file != "" && load_slot != 0) { + g_printerr("Cannot both record a movie and load a savestate.\n"); + return false; + } + return true; } diff --git a/desmume/src/commandline.h b/desmume/src/commandline.h index 9bc574aa5..60cb80e4f 100644 --- a/desmume/src/commandline.h +++ b/desmume/src/commandline.h @@ -38,6 +38,8 @@ public: //actual options: these may move to another sturct int load_slot; std::string nds_file; + std::string play_movie_file; + std::string record_movie_file; //load up the common commandline options void loadCommonOptions(); diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index e11311076..78c75b1c9 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -1904,6 +1904,20 @@ int _main() } } + if(cmdline.play_movie_file != "") + { + FCEUI_LoadMovie(cmdline.play_movie_file.c_str(),true,false,-1); + } + else if(cmdline.record_movie_file != "") + { + FCEUI_SaveMovie(cmdline.record_movie_file.c_str(), L""); + } + + if(cmdline.load_slot != 0) + { + HK_StateLoadSlot(cmdline.load_slot); + } + MainWindow->Show(SW_NORMAL); run(); SaveRecentRoms(); diff --git a/desmume/src/windows/replay.cpp b/desmume/src/windows/replay.cpp index 908fe674e..db6349381 100644 --- a/desmume/src/windows/replay.cpp +++ b/desmume/src/windows/replay.cpp @@ -160,7 +160,7 @@ void Replay_LoadMovie() if(fn) { - FCEUI_LoadMovie(fn, movie_readonly, false, 100000); + FCEUI_LoadMovie(fn, movie_readonly, false, -1); free(fn); }