Replaying .tas files in SDL version

This commit is contained in:
ansstuff 2011-12-09 15:51:36 +00:00
parent eabf9a046b
commit 840528d52a
3 changed files with 18 additions and 10 deletions

View File

@ -1168,7 +1168,7 @@ const char* Authors[]= {
" Lukas Sabota", " Soules", " Bryan Cain", " radsaq", " Shinydoofy",
"FceuX 2.0 Developers:",
" SP", " zeromus", " adelikat", " caH4e3", " qfox",
" Luke Gustafson", " _mz", " UncombedCoconut", " DwEdit",
" Luke Gustafson", " _mz", " UncombedCoconut", " DwEdit", " AnS",
"Pre 2.0 Guys:",
" Bero", " Xodnizel", " Aaron Oneal", " Joe Nahmias",
" Paul Kuliniewicz", " Quietust", " Ben Parnell", " Parasyte & bbitmaster",
@ -1289,9 +1289,16 @@ void loadMovie ()
{
GtkWidget* fileChooser;
GtkFileFilter* filterMovies;
GtkFileFilter* filterFm2;
GtkFileFilter* filterAll;
filterMovies = gtk_file_filter_new();
gtk_file_filter_add_pattern(filterMovies, "*.fm2");
gtk_file_filter_add_pattern(filterMovies, "*.FM2f");
gtk_file_filter_add_pattern(filterMovies, "*.tas");
gtk_file_filter_set_name(filterMovies, "FM2 Movies, TAS Editor Projects");
filterFm2 = gtk_file_filter_new();
gtk_file_filter_add_pattern(filterFm2, "*.fm2");
gtk_file_filter_add_pattern(filterFm2, "*.FM2f");
@ -1305,6 +1312,7 @@ void loadMovie ()
GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(fileChooser), filterMovies);
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(fileChooser), filterFm2);
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(fileChooser), filterAll);
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(fileChooser), getcwd(NULL, 0));
@ -1318,11 +1326,11 @@ void loadMovie ()
g_config->getOption("SDL.PauseFrame", &pauseframe);
g_config->setOption("SDL.PauseFrame", 0);
FCEUI_printf("Playing back movie located at %s\n", fname);
if(FCEUI_LoadMovie(fname, false, false, pauseframe ? pauseframe : false) == FALSE)
if(FCEUI_LoadMovie(fname, false, pauseframe ? pauseframe : false) == FALSE)
{
GtkWidget* d;
d = gtk_message_dialog_new(GTK_WINDOW(MainWindow), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
"Could not open the selected FM2 file.");
"Could not open the movie file.");
gtk_dialog_run(GTK_DIALOG(d));
gtk_widget_destroy(d);
}

View File

@ -512,14 +512,14 @@ KeyboardCommands()
fname = GetFilename("Open FM2 movie for playback...", false, "FM2 movies|*.fm2");
if(fname != "")
{
if(fname.find(".fm2") != std::string::npos)
if(fname.find(".fm2") != std::string::npos || fname.find(".tas") != std::string::npos)
{
FCEUI_printf("Playing back movie located at %s\n", fname.c_str());
FCEUI_LoadMovie(fname.c_str(), false, false, false);
FCEUI_LoadMovie(fname.c_str(), false, false);
}
else
{
FCEUI_printf("Only FM2 movies are supported.\n");
FCEUI_printf("Only .fm2 and .tas movies are supported.\n");
}
}
} else {

View File

@ -104,7 +104,7 @@ Option Value Description\n\
--soundbufsize x Set sound buffer size to x ms.\n\
--volume {0-256} Set volume to x.\n\
--soundrecord f Record sound to file f.\n\
--playmov f Play back a recorded FCM/FM2 movie from filename f.\n\
--playmov f Play back a recorded FCM/FM2/TAS movie from filename f.\n\
--pauseframe x Pause movie playback at frame x.\n\
--fcmconvert f Convert fcm movie file f to fm2.\n\
--ripsubs f Convert movie's subtitles to srt\n\
@ -798,13 +798,13 @@ int main(int argc, char *argv[])
g_config->setOption("SDL.Movie", "");
if (s != "")
{
if(s.find(".fm2") != std::string::npos)
if(s.find(".fm2") != std::string::npos || s.find(".tas") != std::string::npos)
{
static int pauseframe;
g_config->getOption("SDL.PauseFrame", &pauseframe);
g_config->setOption("SDL.PauseFrame", 0);
FCEUI_printf("Playing back movie located at %s\n", s.c_str());
FCEUI_LoadMovie(s.c_str(), false, false, pauseframe ? pauseframe : false);
FCEUI_LoadMovie(s.c_str(), false, pauseframe ? pauseframe : false);
}
else
{