win32: add commandline handling for play-movie, record-movie, and load-slot
This commit is contained in:
parent
28164e5bb2
commit
1828745e5d
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue