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: remove the gtglext 3d code
|
||||
enh: improve/speedup screen resize and final presentation logic in gtk frontend
|
||||
enh: minimal rerecording hookups
|
||||
|
||||
0.9.1 -> 0.9.2
|
||||
General/Core:
|
||||
|
|
|
@ -50,8 +50,8 @@
|
|||
//#define USE_REAL_BIOS
|
||||
|
||||
TCommonSettings CommonSettings;
|
||||
static Driver _stub_driver;
|
||||
Driver* driver = &_stub_driver;
|
||||
static BaseDriver _stub_driver;
|
||||
BaseDriver* driver = &_stub_driver;
|
||||
std::string InputDisplayString;
|
||||
|
||||
static BOOL LidClosed = FALSE;
|
||||
|
|
|
@ -512,7 +512,7 @@ void SPU_struct::KeyOn(int channel)
|
|||
|
||||
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;
|
||||
int zzz=9;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <stdio.h>
|
||||
#include "commandline.h"
|
||||
#include "types.h"
|
||||
#include "movie.h"
|
||||
|
||||
CommandLine::CommandLine()
|
||||
: error(NULL)
|
||||
|
@ -111,7 +112,14 @@ void CommandLine::errorHelp(const char* 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
|
||||
bool validate();
|
||||
|
||||
//process movie play/record commands
|
||||
void process_movieCommands();
|
||||
|
||||
//print a little help message for cases when erroneous commandlines are entered
|
||||
void errorHelp(const char* binName);
|
||||
|
|
|
@ -27,9 +27,8 @@
|
|||
#include "debug.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
|
||||
class Driver {
|
||||
class BaseDriver {
|
||||
public:
|
||||
virtual bool WIFI_Host_InitSystem() { return FALSE; }
|
||||
virtual void WIFI_Host_ShutdownSystem() {}
|
||||
|
@ -38,6 +37,6 @@ public:
|
|||
virtual void USR_InfoMessage(const char *message) { LOG("%s\n", message); }
|
||||
virtual void AVI_SoundUpdate(void* soundData, int soundLen) {}
|
||||
};
|
||||
extern Driver* driver;
|
||||
extern BaseDriver* driver;
|
||||
|
||||
#endif //_DRIVER_H_
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "sndsdl.h"
|
||||
#include "ctrlssdl.h"
|
||||
#include "desmume.h"
|
||||
#include "movie.h"
|
||||
|
||||
volatile BOOL execute = FALSE;
|
||||
BOOL click = FALSE;
|
||||
|
@ -84,7 +85,9 @@ void desmume_cycle( void)
|
|||
/* Update keypad value */
|
||||
update_keypad(keypad);
|
||||
|
||||
FCEUMOV_AddInputState();
|
||||
NDS_exec<false>();
|
||||
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) 2007 Pascal Giard (evilynux)
|
||||
|
@ -42,6 +42,7 @@
|
|||
#include "rasterize.h"
|
||||
#include "saves.h"
|
||||
#include "mic.h"
|
||||
#include "movie.h"
|
||||
#include "dTool.h"
|
||||
#include "desmume_config.h"
|
||||
|
||||
|
@ -91,6 +92,9 @@ enum {
|
|||
|
||||
gboolean EmuLoop(gpointer data);
|
||||
|
||||
static void RecordMovieDialog();
|
||||
static void PlayMovieDialog();
|
||||
static void StopMovie();
|
||||
static void OpenNdsDialog();
|
||||
static void SaveStateDialog();
|
||||
static void LoadStateDialog();
|
||||
|
@ -121,6 +125,9 @@ static const char *ui_description =
|
|||
" <menuitem action='open'/>"
|
||||
" <menuitem action='savestateto'/>"
|
||||
" <menuitem action='loadstatefrom'/>"
|
||||
" <menuitem action='recordmovie'/>"
|
||||
" <menuitem action='playmovie'/>"
|
||||
" <menuitem action='stopmovie'/>"
|
||||
" <menu action='SavestateMenu'>"
|
||||
" <menuitem action='savestate1'/>"
|
||||
" <menuitem action='savestate2'/>"
|
||||
|
@ -230,6 +237,9 @@ static const GtkActionEntry action_entries[] = {
|
|||
{ "open", "gtk-open", "_Open", "<Ctrl>o", NULL, OpenNdsDialog },
|
||||
{ "savestateto", NULL, "Save state _to ...", NULL, NULL, SaveStateDialog },
|
||||
{ "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" },
|
||||
{ "LoadstateMenu", NULL, "_Load state" },
|
||||
#ifdef DESMUME_GTK_FIRMWARE_BROKEN
|
||||
|
@ -651,6 +661,111 @@ static void LoadStateDialog()
|
|||
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()
|
||||
{
|
||||
GtkFileFilter *pFilter_ds, *pFilter_any;
|
||||
|
@ -1784,6 +1899,9 @@ common_gtk_main( struct configured_features *my_config)
|
|||
/* Command line arg */
|
||||
if( my_config->nds_file != "") {
|
||||
if(Open( my_config->nds_file.c_str(), bad_glob_cflash_disk_image_file) >= 0) {
|
||||
|
||||
my_config->process_movieCommands();
|
||||
|
||||
if(my_config->load_slot){
|
||||
loadstate_slot(my_config->load_slot);
|
||||
}
|
||||
|
@ -1841,8 +1959,7 @@ common_gtk_main( struct configured_features *my_config)
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
configured_features my_config;
|
||||
|
||||
|
|
|
@ -388,7 +388,7 @@ void FCEUI_StopMovie()
|
|||
|
||||
|
||||
//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))
|
||||
// return;
|
||||
|
@ -462,7 +462,7 @@ static void openRecordingMovie(const char* fname)
|
|||
|
||||
//begin recording a new movie
|
||||
//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))
|
||||
// return;
|
||||
|
@ -534,11 +534,6 @@ static void openRecordingMovie(const char* fname)
|
|||
//either dumps the current joystick state or loads one state from the movie
|
||||
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)
|
||||
{
|
||||
//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
|
||||
|
||||
bool FCEUI_MovieGetInfo(std::istream* fp, MOVIE_INFO& info, bool skipFrameCount);
|
||||
void FCEUI_SaveMovie(const char *fname, std::wstring author);
|
||||
void FCEUI_LoadMovie(const char *fname, bool _read_only, bool tasedit, int _pauseframe);
|
||||
void _CDECL_ FCEUI_SaveMovie(const char *fname, std::wstring author);
|
||||
void _CDECL_ FCEUI_LoadMovie(const char *fname, bool _read_only, bool tasedit, int _pauseframe);
|
||||
void FCEUI_StopMovie();
|
||||
void FCEUMOV_AddInputState();
|
||||
void NDS_setTouchFromMovie(void);
|
||||
|
|
|
@ -589,7 +589,7 @@ namespace UtfConverter
|
|||
}
|
||||
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* sourceend = sourcestart + widesize;
|
||||
UTF32* targetstart = reinterpret_cast<UTF32*>(widestringnative);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* aviout.cpp
|
||||
/* main.cpp
|
||||
|
||||
Copyright 2006 Theo Berkau
|
||||
Copyright (C) 2006-2009 DeSmuME team
|
||||
|
@ -1511,7 +1511,7 @@ static void ExitRunLoop()
|
|||
emu_halt();
|
||||
}
|
||||
|
||||
class WinDriver : public Driver
|
||||
class WinDriver : public BaseDriver
|
||||
{
|
||||
virtual bool WIFI_Host_InitSystem() {
|
||||
#ifdef EXPERIMENTAL_WIFI
|
||||
|
@ -1904,14 +1904,7 @@ 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"");
|
||||
}
|
||||
cmdline.process_movieCommands();
|
||||
|
||||
if(cmdline.load_slot != 0)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue