SDL: implemented FCEUD_MovieRecordTo
This commit is contained in:
parent
c18c460e8d
commit
447383efd2
|
@ -1,3 +1,4 @@
|
||||||
|
11-apr-2009 - shinydoofy - sdl - implemented starting an FM2 movie on Alt+R
|
||||||
11-apr-2009 - adelikat - made default save slot 0 instead of 1, Win32 - remember last slot used
|
11-apr-2009 - adelikat - made default save slot 0 instead of 1, Win32 - remember last slot used
|
||||||
11-apr-2009 - shinydoofy - sdl - added --pauseframe to pause movie playback on frame x
|
11-apr-2009 - shinydoofy - sdl - added --pauseframe to pause movie playback on frame x
|
||||||
11-apr-2009 - shinydoofy - sdl - dropped UTFConverter.c from SDL build and added hotkey Q for toggling read-only/read+write movie playback
|
11-apr-2009 - shinydoofy - sdl - dropped UTFConverter.c from SDL build and added hotkey Q for toggling read-only/read+write movie playback
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "../../movie.h"
|
#include "../../movie.h"
|
||||||
#include "../../fceu.h"
|
#include "../../fceu.h"
|
||||||
#include "../../driver.h"
|
#include "../../driver.h"
|
||||||
|
#include "../../utils/xstring.h"
|
||||||
#ifdef _S9XLUA_H
|
#ifdef _S9XLUA_H
|
||||||
#include "../../fceulua.h"
|
#include "../../fceulua.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -237,7 +238,7 @@ void setHotKeys()
|
||||||
* This function opens a file chooser dialog and returns the filename the
|
* This function opens a file chooser dialog and returns the filename the
|
||||||
* user selected.
|
* user selected.
|
||||||
* */
|
* */
|
||||||
std::string GetFilename(const char* title, bool save)
|
std::string GetFilename(const char* title, bool save, const char* filter)
|
||||||
{
|
{
|
||||||
if (FCEUI_EmulationPaused() == 0)
|
if (FCEUI_EmulationPaused() == 0)
|
||||||
FCEUI_ToggleEmulationPause();
|
FCEUI_ToggleEmulationPause();
|
||||||
|
@ -276,9 +277,15 @@ std::string GetFilename(const char* title, bool save)
|
||||||
FILE *fpipe;
|
FILE *fpipe;
|
||||||
std::string command = "zenity --file-selection --title=\"";
|
std::string command = "zenity --file-selection --title=\"";
|
||||||
command.append(title);
|
command.append(title);
|
||||||
|
command.append("\" --file-filter=\"");
|
||||||
|
command.append(filter);
|
||||||
command.append("\"");
|
command.append("\"");
|
||||||
if (save) // Do we want to save a file or load one?
|
if (save) // Do we want to save a file or load one?
|
||||||
command.append(" --save --confirm-overwrite");
|
{
|
||||||
|
command.append(" --save --confirm-overwrite --filename=\".");
|
||||||
|
command.append(getExtension(filter));
|
||||||
|
command.append("\"");
|
||||||
|
}
|
||||||
if ( !(fpipe = (FILE*)popen(command.c_str(),"r")) )
|
if ( !(fpipe = (FILE*)popen(command.c_str(),"r")) )
|
||||||
{ // If fpipe is NULL
|
{ // If fpipe is NULL
|
||||||
FCEUD_PrintError("Pipe error on opening zenity");
|
FCEUD_PrintError("Pipe error on opening zenity");
|
||||||
|
@ -297,6 +304,55 @@ std::string GetFilename(const char* title, bool save)
|
||||||
return fname;
|
return fname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function opens a text entry dialog and returns the user's input
|
||||||
|
*/
|
||||||
|
std::string GetUserText(const char* title)
|
||||||
|
{
|
||||||
|
if (FCEUI_EmulationPaused() == 0)
|
||||||
|
FCEUI_ToggleEmulationPause(); // pause emulation
|
||||||
|
|
||||||
|
int fullscreen = 0;
|
||||||
|
g_config->getOption("SDL.Fullscreen", &fullscreen);
|
||||||
|
if(fullscreen)
|
||||||
|
ToggleFS(); // disable fullscreen emulation
|
||||||
|
|
||||||
|
FILE *fpipe;
|
||||||
|
std::string command = "zenity --entry --title=\"";
|
||||||
|
command.append(title);
|
||||||
|
command.append("\" --text=\"");
|
||||||
|
command.append(title);
|
||||||
|
command.append(":\"");
|
||||||
|
|
||||||
|
if (!(fpipe = (FILE*)popen(command.c_str(),"r"))) // If fpipe is NULL
|
||||||
|
FCEUD_PrintError("Pipe error on opening zenity");
|
||||||
|
int c;
|
||||||
|
std::string input;
|
||||||
|
while((c = fgetc(fpipe)))
|
||||||
|
{
|
||||||
|
if (c == EOF || c == '\n')
|
||||||
|
break;
|
||||||
|
input += c;
|
||||||
|
}
|
||||||
|
pclose(fpipe);
|
||||||
|
FCEUI_ToggleEmulationPause(); // unpause emulation
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lets the user start a new .fm2 movie file
|
||||||
|
**/
|
||||||
|
void FCEUD_MovieRecordTo()
|
||||||
|
{
|
||||||
|
std::string fname = GetFilename("Save FM2 movie for recording", true, "FM2 movies|*.fm2");
|
||||||
|
if (!fname.size())
|
||||||
|
return; // no filename selected, quit the whole thing
|
||||||
|
std::wstring author = mbstowcs(GetUserText("Author name")); // the author can be empty, so no need to check here
|
||||||
|
|
||||||
|
FCEUI_SaveMovie(fname.c_str(), MOVIE_FLAG_FROM_POWERON, author);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse keyboard commands and execute accordingly.
|
* Parse keyboard commands and execute accordingly.
|
||||||
*/
|
*/
|
||||||
|
@ -350,6 +406,10 @@ KeyboardCommands()
|
||||||
autoMovieBackup ? "en" : "dis");
|
autoMovieBackup ? "en" : "dis");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Start recording an FM2 movie on Alt+R
|
||||||
|
if(keyonly(R) && is_alt) {
|
||||||
|
FCEUD_MovieRecordTo();
|
||||||
|
}
|
||||||
|
|
||||||
// Famicom disk-system games
|
// Famicom disk-system games
|
||||||
if(gametype==GIT_FDS)
|
if(gametype==GIT_FDS)
|
||||||
|
@ -388,7 +448,7 @@ KeyboardCommands()
|
||||||
if(is_shift) {
|
if(is_shift) {
|
||||||
FCEUI_StopMovie();
|
FCEUI_StopMovie();
|
||||||
std::string fname;
|
std::string fname;
|
||||||
fname = GetFilename("Open FM2 movie for playback...", false);
|
fname = GetFilename("Open FM2 movie for playback...", false, "FM2 movies|*.fm2");
|
||||||
if(fname != "")
|
if(fname != "")
|
||||||
{
|
{
|
||||||
if(fname.find(".fm2") != std::string::npos)
|
if(fname.find(".fm2") != std::string::npos)
|
||||||
|
@ -472,7 +532,7 @@ KeyboardCommands()
|
||||||
#ifdef _S9XLUA_H
|
#ifdef _S9XLUA_H
|
||||||
if(_keyonly(loadLuaKey)) {
|
if(_keyonly(loadLuaKey)) {
|
||||||
std::string fname;
|
std::string fname;
|
||||||
fname = GetFilename("Open LUA script...", false);
|
fname = GetFilename("Open LUA script...", false, "Lua scripts|*.lua");
|
||||||
if(fname != "")
|
if(fname != "")
|
||||||
FCEU_LoadLuaCode(fname.c_str());
|
FCEU_LoadLuaCode(fname.c_str());
|
||||||
}
|
}
|
||||||
|
|
|
@ -715,7 +715,6 @@ void FCEUD_PrintError(const char *errormsg)
|
||||||
DUMMY(FCEUD_HideMenuToggle)
|
DUMMY(FCEUD_HideMenuToggle)
|
||||||
DUMMY(FCEUD_SaveStateAs)
|
DUMMY(FCEUD_SaveStateAs)
|
||||||
DUMMY(FCEUD_LoadStateFrom)
|
DUMMY(FCEUD_LoadStateFrom)
|
||||||
DUMMY(FCEUD_MovieRecordTo)
|
|
||||||
DUMMY(FCEUD_MovieReplayFrom)
|
DUMMY(FCEUD_MovieReplayFrom)
|
||||||
DUMMY(FCEUD_ToggleStatusIcon)
|
DUMMY(FCEUD_ToggleStatusIcon)
|
||||||
DUMMY(FCEUD_AviRecordTo)
|
DUMMY(FCEUD_AviRecordTo)
|
||||||
|
|
Loading…
Reference in New Issue