gtk: fix movieplaying and add minimal play/record/stop menu support
This commit is contained in:
parent
45f129f229
commit
b18e0dcb15
|
@ -37,6 +37,7 @@ Gtk frontend:
|
||||||
enh: switch all of menu/toolbar system to GtkAction + GtkUIManager
|
enh: switch all of menu/toolbar system to GtkAction + GtkUIManager
|
||||||
enh: remove the gtglext 3d code
|
enh: remove the gtglext 3d code
|
||||||
enh: improve/speedup screen resize and final presentation logic in gtk frontend
|
enh: improve/speedup screen resize and final presentation logic in gtk frontend
|
||||||
|
enh: minimal rerecording hookups
|
||||||
|
|
||||||
0.9.1 -> 0.9.2
|
0.9.1 -> 0.9.2
|
||||||
General/Core:
|
General/Core:
|
||||||
|
|
|
@ -50,8 +50,8 @@
|
||||||
//#define USE_REAL_BIOS
|
//#define USE_REAL_BIOS
|
||||||
|
|
||||||
TCommonSettings CommonSettings;
|
TCommonSettings CommonSettings;
|
||||||
static Driver _stub_driver;
|
static BaseDriver _stub_driver;
|
||||||
Driver* driver = &_stub_driver;
|
BaseDriver* driver = &_stub_driver;
|
||||||
std::string InputDisplayString;
|
std::string InputDisplayString;
|
||||||
|
|
||||||
static BOOL LidClosed = FALSE;
|
static BOOL LidClosed = FALSE;
|
||||||
|
|
|
@ -512,7 +512,7 @@ void SPU_struct::KeyOn(int channel)
|
||||||
|
|
||||||
if(thischan.double_totlength_shifted == 0)
|
if(thischan.double_totlength_shifted == 0)
|
||||||
{
|
{
|
||||||
printf("ERROR: Stopping channel %d due to zero length\n",channel);
|
printf("INFO: Stopping channel %d due to zero length\n",channel);
|
||||||
thischan.status = CHANSTAT_STOPPED;
|
thischan.status = CHANSTAT_STOPPED;
|
||||||
int zzz=9;
|
int zzz=9;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "commandline.h"
|
#include "commandline.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
#include "movie.h"
|
||||||
|
|
||||||
CommandLine::CommandLine()
|
CommandLine::CommandLine()
|
||||||
: error(NULL)
|
: error(NULL)
|
||||||
|
@ -111,7 +112,14 @@ void CommandLine::errorHelp(const char* binName)
|
||||||
g_printerr("USAGE: %s --help - for help\n", binName);
|
g_printerr("USAGE: %s --help - for help\n", binName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void foo()
|
void CommandLine::process_movieCommands()
|
||||||
{
|
{
|
||||||
g_option_context_free(NULL);
|
if(play_movie_file != "")
|
||||||
|
{
|
||||||
|
FCEUI_LoadMovie(play_movie_file.c_str(),true,false,-1);
|
||||||
|
}
|
||||||
|
else if(record_movie_file != "")
|
||||||
|
{
|
||||||
|
FCEUI_SaveMovie(record_movie_file.c_str(), L"");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,9 @@ public:
|
||||||
|
|
||||||
//validate the common commandline options
|
//validate the common commandline options
|
||||||
bool validate();
|
bool validate();
|
||||||
|
|
||||||
|
//process movie play/record commands
|
||||||
|
void process_movieCommands();
|
||||||
|
|
||||||
//print a little help message for cases when erroneous commandlines are entered
|
//print a little help message for cases when erroneous commandlines are entered
|
||||||
void errorHelp(const char* binName);
|
void errorHelp(const char* binName);
|
||||||
|
|
|
@ -27,9 +27,8 @@
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
//this should be moved to a driver.h later, but for now, here they are.
|
|
||||||
//each platform needs to implement this, although it doesnt need to implement any functions
|
//each platform needs to implement this, although it doesnt need to implement any functions
|
||||||
class Driver {
|
class BaseDriver {
|
||||||
public:
|
public:
|
||||||
virtual bool WIFI_Host_InitSystem() { return FALSE; }
|
virtual bool WIFI_Host_InitSystem() { return FALSE; }
|
||||||
virtual void WIFI_Host_ShutdownSystem() {}
|
virtual void WIFI_Host_ShutdownSystem() {}
|
||||||
|
@ -38,6 +37,6 @@ public:
|
||||||
virtual void USR_InfoMessage(const char *message) { LOG("%s\n", message); }
|
virtual void USR_InfoMessage(const char *message) { LOG("%s\n", message); }
|
||||||
virtual void AVI_SoundUpdate(void* soundData, int soundLen) {}
|
virtual void AVI_SoundUpdate(void* soundData, int soundLen) {}
|
||||||
};
|
};
|
||||||
extern Driver* driver;
|
extern BaseDriver* driver;
|
||||||
|
|
||||||
#endif //_DRIVER_H_
|
#endif //_DRIVER_H_
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "sndsdl.h"
|
#include "sndsdl.h"
|
||||||
#include "ctrlssdl.h"
|
#include "ctrlssdl.h"
|
||||||
#include "desmume.h"
|
#include "desmume.h"
|
||||||
|
#include "movie.h"
|
||||||
|
|
||||||
volatile BOOL execute = FALSE;
|
volatile BOOL execute = FALSE;
|
||||||
BOOL click = FALSE;
|
BOOL click = FALSE;
|
||||||
|
@ -84,7 +85,9 @@ void desmume_cycle( void)
|
||||||
/* Update keypad value */
|
/* Update keypad value */
|
||||||
update_keypad(keypad);
|
update_keypad(keypad);
|
||||||
|
|
||||||
|
FCEUMOV_AddInputState();
|
||||||
NDS_exec<false>();
|
NDS_exec<false>();
|
||||||
SPU_Emulate_user();
|
SPU_Emulate_user();
|
||||||
|
currFrameCounter++; //this needs to be moved into NDS_exec somehow
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* main.c - this file is part of DeSmuME
|
/* main.cpp - this file is part of DeSmuME
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2009 DeSmuME Team
|
* Copyright (C) 2006-2009 DeSmuME Team
|
||||||
* Copyright (C) 2007 Pascal Giard (evilynux)
|
* Copyright (C) 2007 Pascal Giard (evilynux)
|
||||||
|
@ -42,6 +42,7 @@
|
||||||
#include "rasterize.h"
|
#include "rasterize.h"
|
||||||
#include "saves.h"
|
#include "saves.h"
|
||||||
#include "mic.h"
|
#include "mic.h"
|
||||||
|
#include "movie.h"
|
||||||
#include "dTool.h"
|
#include "dTool.h"
|
||||||
#include "desmume_config.h"
|
#include "desmume_config.h"
|
||||||
|
|
||||||
|
@ -91,6 +92,9 @@ enum {
|
||||||
|
|
||||||
gboolean EmuLoop(gpointer data);
|
gboolean EmuLoop(gpointer data);
|
||||||
|
|
||||||
|
static void RecordMovieDialog();
|
||||||
|
static void PlayMovieDialog();
|
||||||
|
static void StopMovie();
|
||||||
static void OpenNdsDialog();
|
static void OpenNdsDialog();
|
||||||
static void SaveStateDialog();
|
static void SaveStateDialog();
|
||||||
static void LoadStateDialog();
|
static void LoadStateDialog();
|
||||||
|
@ -121,6 +125,9 @@ static const char *ui_description =
|
||||||
" <menuitem action='open'/>"
|
" <menuitem action='open'/>"
|
||||||
" <menuitem action='savestateto'/>"
|
" <menuitem action='savestateto'/>"
|
||||||
" <menuitem action='loadstatefrom'/>"
|
" <menuitem action='loadstatefrom'/>"
|
||||||
|
" <menuitem action='recordmovie'/>"
|
||||||
|
" <menuitem action='playmovie'/>"
|
||||||
|
" <menuitem action='stopmovie'/>"
|
||||||
" <menu action='SavestateMenu'>"
|
" <menu action='SavestateMenu'>"
|
||||||
" <menuitem action='savestate1'/>"
|
" <menuitem action='savestate1'/>"
|
||||||
" <menuitem action='savestate2'/>"
|
" <menuitem action='savestate2'/>"
|
||||||
|
@ -230,6 +237,9 @@ static const GtkActionEntry action_entries[] = {
|
||||||
{ "open", "gtk-open", "_Open", "<Ctrl>o", NULL, OpenNdsDialog },
|
{ "open", "gtk-open", "_Open", "<Ctrl>o", NULL, OpenNdsDialog },
|
||||||
{ "savestateto", NULL, "Save state _to ...", NULL, NULL, SaveStateDialog },
|
{ "savestateto", NULL, "Save state _to ...", NULL, NULL, SaveStateDialog },
|
||||||
{ "loadstatefrom", NULL, "Load state _from ...", NULL, NULL, LoadStateDialog },
|
{ "loadstatefrom", NULL, "Load state _from ...", NULL, NULL, LoadStateDialog },
|
||||||
|
{ "recordmovie", NULL, "Record movie _to ...", NULL, NULL, RecordMovieDialog },
|
||||||
|
{ "playmovie", NULL, "Play movie _from ...", NULL, NULL, PlayMovieDialog },
|
||||||
|
{ "stopmovie", NULL, "Stop movie", NULL, NULL, StopMovie },
|
||||||
{ "SavestateMenu", NULL, "_Save state" },
|
{ "SavestateMenu", NULL, "_Save state" },
|
||||||
{ "LoadstateMenu", NULL, "_Load state" },
|
{ "LoadstateMenu", NULL, "_Load state" },
|
||||||
#ifdef DESMUME_GTK_FIRMWARE_BROKEN
|
#ifdef DESMUME_GTK_FIRMWARE_BROKEN
|
||||||
|
@ -651,6 +661,111 @@ static void LoadStateDialog()
|
||||||
gtk_widget_destroy(pFileSelection);
|
gtk_widget_destroy(pFileSelection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void RecordMovieDialog()
|
||||||
|
{
|
||||||
|
GtkFileFilter *pFilter_dsm, *pFilter_any;
|
||||||
|
GtkWidget *pFileSelection;
|
||||||
|
GtkWidget *pParent;
|
||||||
|
gchar *sPath;
|
||||||
|
|
||||||
|
if (desmume_running())
|
||||||
|
Pause();
|
||||||
|
|
||||||
|
pParent = GTK_WIDGET(pWindow);
|
||||||
|
|
||||||
|
pFilter_dsm = gtk_file_filter_new();
|
||||||
|
gtk_file_filter_add_pattern(pFilter_dsm, "*.dsm*");
|
||||||
|
gtk_file_filter_set_name(pFilter_dsm, "DeSmuME movie file (.dsm*)");
|
||||||
|
|
||||||
|
pFilter_any = gtk_file_filter_new();
|
||||||
|
gtk_file_filter_add_pattern(pFilter_any, "*");
|
||||||
|
gtk_file_filter_set_name(pFilter_any, "All files");
|
||||||
|
|
||||||
|
/* Creating the selection window */
|
||||||
|
pFileSelection = gtk_file_chooser_dialog_new("Save Movie To ...",
|
||||||
|
GTK_WINDOW(pParent),
|
||||||
|
GTK_FILE_CHOOSER_ACTION_SAVE,
|
||||||
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||||
|
GTK_STOCK_SAVE, GTK_RESPONSE_OK,
|
||||||
|
NULL);
|
||||||
|
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (pFileSelection), TRUE);
|
||||||
|
|
||||||
|
/* Only the dialog window is accepting events: */
|
||||||
|
gtk_window_set_modal(GTK_WINDOW(pFileSelection), TRUE);
|
||||||
|
|
||||||
|
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(pFileSelection), pFilter_dsm);
|
||||||
|
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(pFileSelection), pFilter_any);
|
||||||
|
|
||||||
|
/* Showing the window */
|
||||||
|
switch(gtk_dialog_run(GTK_DIALOG(pFileSelection))) {
|
||||||
|
case GTK_RESPONSE_OK:
|
||||||
|
sPath = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(pFileSelection));
|
||||||
|
|
||||||
|
FCEUI_SaveMovie(sPath,L"");
|
||||||
|
|
||||||
|
g_free(sPath);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
gtk_widget_destroy(pFileSelection);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StopMovie()
|
||||||
|
{
|
||||||
|
FCEUI_StopMovie();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void PlayMovieDialog()
|
||||||
|
{
|
||||||
|
GtkFileFilter *pFilter_dsm, *pFilter_any;
|
||||||
|
GtkWidget *pFileSelection;
|
||||||
|
GtkWidget *pParent;
|
||||||
|
gchar *sPath;
|
||||||
|
|
||||||
|
if (desmume_running())
|
||||||
|
Pause();
|
||||||
|
|
||||||
|
pParent = GTK_WIDGET(pWindow);
|
||||||
|
|
||||||
|
pFilter_dsm = gtk_file_filter_new();
|
||||||
|
gtk_file_filter_add_pattern(pFilter_dsm, "*.dsm*");
|
||||||
|
gtk_file_filter_set_name(pFilter_dsm, "DeSmuME movie file (.dsm*)");
|
||||||
|
|
||||||
|
pFilter_any = gtk_file_filter_new();
|
||||||
|
gtk_file_filter_add_pattern(pFilter_any, "*");
|
||||||
|
gtk_file_filter_set_name(pFilter_any, "All files");
|
||||||
|
|
||||||
|
/* Creating the selection window */
|
||||||
|
pFileSelection = gtk_file_chooser_dialog_new("Play movie from...",
|
||||||
|
GTK_WINDOW(pParent),
|
||||||
|
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||||
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||||
|
GTK_STOCK_OPEN, GTK_RESPONSE_OK,
|
||||||
|
NULL);
|
||||||
|
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (pFileSelection), TRUE);
|
||||||
|
|
||||||
|
/* Only the dialog window is accepting events: */
|
||||||
|
gtk_window_set_modal(GTK_WINDOW(pFileSelection), TRUE);
|
||||||
|
|
||||||
|
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(pFileSelection), pFilter_dsm);
|
||||||
|
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(pFileSelection), pFilter_any);
|
||||||
|
|
||||||
|
/* Showing the window */
|
||||||
|
switch(gtk_dialog_run(GTK_DIALOG(pFileSelection))) {
|
||||||
|
case GTK_RESPONSE_OK:
|
||||||
|
sPath = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(pFileSelection));
|
||||||
|
|
||||||
|
FCEUI_LoadMovie(sPath,true,false,-1);
|
||||||
|
|
||||||
|
g_free(sPath);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
gtk_widget_destroy(pFileSelection);
|
||||||
|
}
|
||||||
|
|
||||||
static void SaveStateDialog()
|
static void SaveStateDialog()
|
||||||
{
|
{
|
||||||
GtkFileFilter *pFilter_ds, *pFilter_any;
|
GtkFileFilter *pFilter_ds, *pFilter_any;
|
||||||
|
@ -1784,6 +1899,9 @@ common_gtk_main( struct configured_features *my_config)
|
||||||
/* Command line arg */
|
/* Command line arg */
|
||||||
if( my_config->nds_file != "") {
|
if( my_config->nds_file != "") {
|
||||||
if(Open( my_config->nds_file.c_str(), bad_glob_cflash_disk_image_file) >= 0) {
|
if(Open( my_config->nds_file.c_str(), bad_glob_cflash_disk_image_file) >= 0) {
|
||||||
|
|
||||||
|
my_config->process_movieCommands();
|
||||||
|
|
||||||
if(my_config->load_slot){
|
if(my_config->load_slot){
|
||||||
loadstate_slot(my_config->load_slot);
|
loadstate_slot(my_config->load_slot);
|
||||||
}
|
}
|
||||||
|
@ -1841,8 +1959,7 @@ common_gtk_main( struct configured_features *my_config)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int main (int argc, char *argv[])
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
{
|
||||||
configured_features my_config;
|
configured_features my_config;
|
||||||
|
|
||||||
|
|
|
@ -388,7 +388,7 @@ void FCEUI_StopMovie()
|
||||||
|
|
||||||
|
|
||||||
//begin playing an existing movie
|
//begin playing an existing movie
|
||||||
void FCEUI_LoadMovie(const char *fname, bool _read_only, bool tasedit, int _pauseframe)
|
void _CDECL_ FCEUI_LoadMovie(const char *fname, bool _read_only, bool tasedit, int _pauseframe)
|
||||||
{
|
{
|
||||||
//if(!tasedit && !FCEU_IsValidUI(FCEUI_PLAYMOVIE))
|
//if(!tasedit && !FCEU_IsValidUI(FCEUI_PLAYMOVIE))
|
||||||
// return;
|
// return;
|
||||||
|
@ -462,7 +462,7 @@ static void openRecordingMovie(const char* fname)
|
||||||
|
|
||||||
//begin recording a new movie
|
//begin recording a new movie
|
||||||
//TODO - BUG - the record-from-another-savestate doesnt work.
|
//TODO - BUG - the record-from-another-savestate doesnt work.
|
||||||
void FCEUI_SaveMovie(const char *fname, std::wstring author)
|
void _CDECL_ FCEUI_SaveMovie(const char *fname, std::wstring author)
|
||||||
{
|
{
|
||||||
//if(!FCEU_IsValidUI(FCEUI_RECORDMOVIE))
|
//if(!FCEU_IsValidUI(FCEUI_RECORDMOVIE))
|
||||||
// return;
|
// return;
|
||||||
|
@ -534,11 +534,6 @@ static void openRecordingMovie(const char* fname)
|
||||||
//either dumps the current joystick state or loads one state from the movie
|
//either dumps the current joystick state or loads one state from the movie
|
||||||
void FCEUMOV_AddInputState()
|
void FCEUMOV_AddInputState()
|
||||||
{
|
{
|
||||||
//todo - for tasedit, either dump or load depending on whether input recording is enabled
|
|
||||||
//or something like that
|
|
||||||
//(input recording is just like standard read+write movie recording with input taken from gamepad)
|
|
||||||
//otherwise, it will come from the tasedit data.
|
|
||||||
|
|
||||||
if(movieMode == MOVIEMODE_PLAY)
|
if(movieMode == MOVIEMODE_PLAY)
|
||||||
{
|
{
|
||||||
//stop when we run out of frames
|
//stop when we run out of frames
|
||||||
|
|
|
@ -183,8 +183,8 @@ extern EMOVIEMODE movieMode; //adelikat: main needs this for frame counter disp
|
||||||
extern MovieData currMovieData; //adelikat: main needs this for frame counter display
|
extern MovieData currMovieData; //adelikat: main needs this for frame counter display
|
||||||
|
|
||||||
bool FCEUI_MovieGetInfo(std::istream* fp, MOVIE_INFO& info, bool skipFrameCount);
|
bool FCEUI_MovieGetInfo(std::istream* fp, MOVIE_INFO& info, bool skipFrameCount);
|
||||||
void FCEUI_SaveMovie(const char *fname, std::wstring author);
|
void _CDECL_ FCEUI_SaveMovie(const char *fname, std::wstring author);
|
||||||
void FCEUI_LoadMovie(const char *fname, bool _read_only, bool tasedit, int _pauseframe);
|
void _CDECL_ FCEUI_LoadMovie(const char *fname, bool _read_only, bool tasedit, int _pauseframe);
|
||||||
void FCEUI_StopMovie();
|
void FCEUI_StopMovie();
|
||||||
void FCEUMOV_AddInputState();
|
void FCEUMOV_AddInputState();
|
||||||
void NDS_setTouchFromMovie(void);
|
void NDS_setTouchFromMovie(void);
|
||||||
|
|
|
@ -589,7 +589,7 @@ namespace UtfConverter
|
||||||
}
|
}
|
||||||
else if (sizeof(wchar_t) == 4)
|
else if (sizeof(wchar_t) == 4)
|
||||||
{
|
{
|
||||||
wchar_t* widestringnative = new wchar_t[widesize];
|
wchar_t* widestringnative = new wchar_t[widesize+1];
|
||||||
const UTF8* sourcestart = reinterpret_cast<const UTF8*>(utf8string.c_str());
|
const UTF8* sourcestart = reinterpret_cast<const UTF8*>(utf8string.c_str());
|
||||||
const UTF8* sourceend = sourcestart + widesize;
|
const UTF8* sourceend = sourcestart + widesize;
|
||||||
UTF32* targetstart = reinterpret_cast<UTF32*>(widestringnative);
|
UTF32* targetstart = reinterpret_cast<UTF32*>(widestringnative);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* aviout.cpp
|
/* main.cpp
|
||||||
|
|
||||||
Copyright 2006 Theo Berkau
|
Copyright 2006 Theo Berkau
|
||||||
Copyright (C) 2006-2009 DeSmuME team
|
Copyright (C) 2006-2009 DeSmuME team
|
||||||
|
@ -1511,7 +1511,7 @@ static void ExitRunLoop()
|
||||||
emu_halt();
|
emu_halt();
|
||||||
}
|
}
|
||||||
|
|
||||||
class WinDriver : public Driver
|
class WinDriver : public BaseDriver
|
||||||
{
|
{
|
||||||
virtual bool WIFI_Host_InitSystem() {
|
virtual bool WIFI_Host_InitSystem() {
|
||||||
#ifdef EXPERIMENTAL_WIFI
|
#ifdef EXPERIMENTAL_WIFI
|
||||||
|
@ -1904,14 +1904,7 @@ int _main()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cmdline.play_movie_file != "")
|
cmdline.process_movieCommands();
|
||||||
{
|
|
||||||
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)
|
if(cmdline.load_slot != 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue