Initial menu functionality added to GUI for avi recording.
This commit is contained in:
parent
90e36c15c6
commit
4a498d20af
|
@ -625,6 +625,71 @@ bool aviRecordRunning(void)
|
||||||
{
|
{
|
||||||
return recordEnable;
|
return recordEnable;
|
||||||
}
|
}
|
||||||
|
bool FCEUI_AviIsRecording(void)
|
||||||
|
{
|
||||||
|
return recordEnable;
|
||||||
|
}
|
||||||
|
//**************************************************************************************
|
||||||
|
void FCEUD_AviRecordTo(void)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//**************************************************************************************
|
||||||
|
void FCEUD_AviStop(void)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//**************************************************************************************
|
||||||
|
void FCEUI_AviVideoUpdate(const unsigned char* buffer)
|
||||||
|
{ // This is not used by Qt Emulator, avi recording pulls from the post processed video buffer
|
||||||
|
// instead of emulation core video buffer. This allows for the video scaler effects
|
||||||
|
// and higher resolution to be seen in recording.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//**************************************************************************************
|
||||||
|
int aviGetSelVideoFormat(void)
|
||||||
|
{
|
||||||
|
return videoFormat;
|
||||||
|
}
|
||||||
|
//**************************************************************************************
|
||||||
|
void aviSetSelVideoFormat(int idx)
|
||||||
|
{
|
||||||
|
videoFormat = idx;
|
||||||
|
printf("AVI Video Format Changed:%i\n", videoFormat );
|
||||||
|
}
|
||||||
|
//**************************************************************************************
|
||||||
|
int FCEUD_AviGetFormatOpts( std::vector <std::string> &formatList )
|
||||||
|
{
|
||||||
|
std::string s;
|
||||||
|
|
||||||
|
for (int i=0; i<AVI_NUM_ENC; i++)
|
||||||
|
{
|
||||||
|
switch ( i )
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
s.assign("Unknown");
|
||||||
|
break;
|
||||||
|
case AVI_RGB24:
|
||||||
|
s.assign("RGB 24");
|
||||||
|
break;
|
||||||
|
case AVI_I420:
|
||||||
|
s.assign("I420 (YUV 4:2:0)");
|
||||||
|
break;
|
||||||
|
#ifdef _USE_X264
|
||||||
|
case AVI_X264:
|
||||||
|
s.assign("X264 (H.264)");
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#ifdef WIN32
|
||||||
|
case AVI_VFW:
|
||||||
|
s.assign("VfW (Video for Windows)");
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
formatList.push_back(s);
|
||||||
|
}
|
||||||
|
return AVI_NUM_ENC;
|
||||||
|
}
|
||||||
//**************************************************************************************
|
//**************************************************************************************
|
||||||
// AVI Recorder Disk Thread
|
// AVI Recorder Disk Thread
|
||||||
//**************************************************************************************
|
//**************************************************************************************
|
||||||
|
|
|
@ -5,6 +5,10 @@
|
||||||
#define __AVI_RECORD_H__
|
#define __AVI_RECORD_H__
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <list>
|
||||||
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
enum aviEncoderList
|
enum aviEncoderList
|
||||||
|
@ -30,6 +34,12 @@ int aviRecordClose(void);
|
||||||
|
|
||||||
bool aviRecordRunning(void);
|
bool aviRecordRunning(void);
|
||||||
|
|
||||||
|
int aviGetSelVideoFormat(void);
|
||||||
|
|
||||||
|
void aviSetSelVideoFormat(int idx);
|
||||||
|
|
||||||
|
int FCEUD_AviGetFormatOpts( std::vector <std::string> &formatList );
|
||||||
|
|
||||||
class AviRecordDiskThread_t : public QThread
|
class AviRecordDiskThread_t : public QThread
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
|
@ -640,7 +640,7 @@ void consoleWin_t::initHotKeys(void)
|
||||||
void consoleWin_t::createMainMenu(void)
|
void consoleWin_t::createMainMenu(void)
|
||||||
{
|
{
|
||||||
QAction *act;
|
QAction *act;
|
||||||
QMenu *subMenu;
|
QMenu *subMenu, *aviMenu;
|
||||||
QActionGroup *group;
|
QActionGroup *group;
|
||||||
int useNativeMenuBar;
|
int useNativeMenuBar;
|
||||||
//QShortcut *shortcut;
|
//QShortcut *shortcut;
|
||||||
|
@ -1455,14 +1455,64 @@ void consoleWin_t::createMainMenu(void)
|
||||||
|
|
||||||
movieMenu->addAction(recAsMovAct);
|
movieMenu->addAction(recAsMovAct);
|
||||||
|
|
||||||
// Movie -> Avi Record
|
movieMenu->addSeparator();
|
||||||
act = new QAction(tr("A&VI Record"), this);
|
|
||||||
//act->setShortcut( QKeySequence(tr("Shift+F5")));
|
// Movie -> Avi Recording
|
||||||
act->setCheckable(true);
|
aviMenu = movieMenu->addMenu( tr("A&VI Recording") );
|
||||||
act->setStatusTip(tr("AVI Record"));
|
|
||||||
connect(act, SIGNAL(triggered()), this, SLOT(aviOpen(void)) );
|
// Movie -> Avi Recording -> Record
|
||||||
|
recAviAct = new QAction(tr("&Record"), this);
|
||||||
|
//recAviAct->setShortcut( QKeySequence(tr("Shift+F5")));
|
||||||
|
recAviAct->setStatusTip(tr("AVI Record Start"));
|
||||||
|
recAviAct->setIcon( QIcon(":icons/media-record.png") );
|
||||||
|
connect(recAviAct, SIGNAL(triggered()), this, SLOT(aviRecordStart(void)) );
|
||||||
|
|
||||||
movieMenu->addAction(act);
|
aviMenu->addAction(recAviAct);
|
||||||
|
|
||||||
|
// Movie -> Avi Recording -> Record
|
||||||
|
recAsAviAct = new QAction(tr("Record &As"), this);
|
||||||
|
//recAsAviAct->setShortcut( QKeySequence(tr("Shift+F5")));
|
||||||
|
recAsAviAct->setStatusTip(tr("AVI Record As Start"));
|
||||||
|
//recAsAviAct->setIcon( QIcon(":icons/media-record.png") );
|
||||||
|
connect(recAsAviAct, SIGNAL(triggered()), this, SLOT(aviRecordAsStart(void)) );
|
||||||
|
|
||||||
|
aviMenu->addAction(recAsAviAct);
|
||||||
|
|
||||||
|
// Movie -> Avi Recording -> Stop
|
||||||
|
stopAviAct = new QAction(tr("&Stop"), this);
|
||||||
|
//stopAviAct->setShortcut( QKeySequence(tr("Shift+F5")));
|
||||||
|
stopAviAct->setStatusTip(tr("AVI Record Stop"));
|
||||||
|
stopAviAct->setIcon( style()->standardIcon( QStyle::SP_MediaStop ) );
|
||||||
|
connect(stopAviAct, SIGNAL(triggered()), this, SLOT(aviRecordStop(void)) );
|
||||||
|
|
||||||
|
aviMenu->addAction(stopAviAct);
|
||||||
|
|
||||||
|
subMenu = aviMenu->addMenu( tr("Video Format") );
|
||||||
|
|
||||||
|
{
|
||||||
|
std::vector <std::string> formatList;
|
||||||
|
group = new QActionGroup(this);
|
||||||
|
|
||||||
|
group->setExclusive(true);
|
||||||
|
|
||||||
|
FCEUD_AviGetFormatOpts( formatList );
|
||||||
|
|
||||||
|
for (size_t i=0; i<formatList.size(); i++)
|
||||||
|
{
|
||||||
|
act = new QAction(tr( formatList[i].c_str() ), this);
|
||||||
|
|
||||||
|
printf("%s\n", formatList[i].c_str() );
|
||||||
|
|
||||||
|
act->setCheckable(true);
|
||||||
|
group->addAction(act);
|
||||||
|
subMenu->addAction(act);
|
||||||
|
|
||||||
|
act->setChecked( aviGetSelVideoFormat() == i );
|
||||||
|
|
||||||
|
// Use Lambda Function to set callback
|
||||||
|
connect( act, &QAction::triggered, [ this, i ] { aviVideoFormatChanged( i ); } );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// Help
|
// Help
|
||||||
|
@ -3102,9 +3152,96 @@ void consoleWin_t::recordMovieAs(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void consoleWin_t::aviOpen(void)
|
void consoleWin_t::aviRecordStart(void)
|
||||||
|
{
|
||||||
|
if ( !aviRecordRunning() )
|
||||||
|
{
|
||||||
|
fceuWrapperLock();
|
||||||
|
aviRecordOpenFile(NULL);
|
||||||
|
aviDiskThread->start();
|
||||||
|
fceuWrapperUnLock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void consoleWin_t::aviRecordAsStart(void)
|
||||||
|
{
|
||||||
|
if ( aviRecordRunning() )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int ret, useNativeFileDialogVal;
|
||||||
|
QString filename;
|
||||||
|
std::string last;
|
||||||
|
//char dir[512];
|
||||||
|
const char *base;
|
||||||
|
QFileDialog dialog(this, tr("Save AVI Movie for Recording") );
|
||||||
|
QList<QUrl> urls;
|
||||||
|
QDir d;
|
||||||
|
|
||||||
|
dialog.setFileMode(QFileDialog::AnyFile);
|
||||||
|
|
||||||
|
dialog.setNameFilter(tr("AVI Movies (*.avi) ;; All files (*)"));
|
||||||
|
|
||||||
|
dialog.setViewMode(QFileDialog::List);
|
||||||
|
dialog.setFilter( QDir::AllEntries | QDir::AllDirs | QDir::Hidden );
|
||||||
|
dialog.setLabelText( QFileDialog::Accept, tr("Save") );
|
||||||
|
|
||||||
|
base = FCEUI_GetBaseDirectory();
|
||||||
|
|
||||||
|
urls << QUrl::fromLocalFile( QDir::rootPath() );
|
||||||
|
urls << QUrl::fromLocalFile(QStandardPaths::standardLocations(QStandardPaths::HomeLocation).first());
|
||||||
|
urls << QUrl::fromLocalFile(QStandardPaths::standardLocations(QStandardPaths::DownloadLocation).first());
|
||||||
|
|
||||||
|
if ( base )
|
||||||
|
{
|
||||||
|
urls << QUrl::fromLocalFile( QDir( base ).absolutePath() );
|
||||||
|
|
||||||
|
d.setPath( QString(base) + "/avi");
|
||||||
|
|
||||||
|
if ( d.exists() )
|
||||||
|
{
|
||||||
|
urls << QUrl::fromLocalFile( d.absolutePath() );
|
||||||
|
}
|
||||||
|
|
||||||
|
dialog.setDirectory( d.absolutePath() );
|
||||||
|
}
|
||||||
|
dialog.setDefaultSuffix( tr(".avi") );
|
||||||
|
|
||||||
|
// Check config option to use native file dialog or not
|
||||||
|
g_config->getOption ("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
||||||
|
|
||||||
|
dialog.setOption(QFileDialog::DontUseNativeDialog, !useNativeFileDialogVal);
|
||||||
|
dialog.setSidebarUrls(urls);
|
||||||
|
|
||||||
|
ret = dialog.exec();
|
||||||
|
|
||||||
|
if ( ret )
|
||||||
|
{
|
||||||
|
QStringList fileList;
|
||||||
|
fileList = dialog.selectedFiles();
|
||||||
|
|
||||||
|
if ( fileList.size() > 0 )
|
||||||
|
{
|
||||||
|
filename = fileList[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( filename.isNull() )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
qDebug() << "selected file path : " << filename.toUtf8();
|
||||||
|
|
||||||
|
FCEUI_printf ("AVI Recording movie to %s\n", filename.toStdString().c_str() );
|
||||||
|
|
||||||
|
fceuWrapperLock();
|
||||||
|
aviRecordOpenFile( filename.toStdString().c_str() );
|
||||||
|
aviDiskThread->start();
|
||||||
|
fceuWrapperUnLock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void consoleWin_t::aviRecordStop(void)
|
||||||
{
|
{
|
||||||
//printf("AVI!!!\n");
|
|
||||||
if ( aviRecordRunning() )
|
if ( aviRecordRunning() )
|
||||||
{
|
{
|
||||||
fceuWrapperLock();
|
fceuWrapperLock();
|
||||||
|
@ -3113,13 +3250,11 @@ void consoleWin_t::aviOpen(void)
|
||||||
aviDiskThread->wait(10000);
|
aviDiskThread->wait(10000);
|
||||||
fceuWrapperUnLock();
|
fceuWrapperUnLock();
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
|
||||||
fceuWrapperLock();
|
void consoleWin_t::aviVideoFormatChanged(int idx)
|
||||||
aviRecordOpenFile(NULL);
|
{
|
||||||
aviDiskThread->start();
|
aviSetSelVideoFormat(idx);
|
||||||
fceuWrapperUnLock();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void consoleWin_t::aboutFCEUX(void)
|
void consoleWin_t::aboutFCEUX(void)
|
||||||
|
@ -3381,6 +3516,11 @@ void consoleWin_t::updatePeriodic(void)
|
||||||
quickSaveAct->setEnabled( FCEU_IsValidUI( FCEUI_QUICKSAVE ) );
|
quickSaveAct->setEnabled( FCEU_IsValidUI( FCEUI_QUICKSAVE ) );
|
||||||
loadStateAct->setEnabled( FCEU_IsValidUI( FCEUI_LOADSTATE ) );
|
loadStateAct->setEnabled( FCEU_IsValidUI( FCEUI_LOADSTATE ) );
|
||||||
saveStateAct->setEnabled( FCEU_IsValidUI( FCEUI_SAVESTATE ) );
|
saveStateAct->setEnabled( FCEU_IsValidUI( FCEUI_SAVESTATE ) );
|
||||||
|
recMovAct->setEnabled( FCEU_IsValidUI( FCEUI_RECORDMOVIE ) );
|
||||||
|
recAsMovAct->setEnabled( FCEU_IsValidUI( FCEUI_RECORDMOVIE ) );
|
||||||
|
recAviAct->setEnabled( FCEU_IsValidUI( FCEUI_RECORDMOVIE ) );
|
||||||
|
recAsAviAct->setEnabled( FCEU_IsValidUI( FCEUI_RECORDMOVIE ) );
|
||||||
|
stopAviAct->setEnabled( FCEU_IsValidUI( FCEUI_STOPAVI ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( errorMsgValid )
|
if ( errorMsgValid )
|
||||||
|
|
|
@ -204,6 +204,9 @@ class consoleWin_t : public QMainWindow
|
||||||
QAction *recAsMovAct;
|
QAction *recAsMovAct;
|
||||||
QAction *region[3];
|
QAction *region[3];
|
||||||
QAction *ramInit[4];
|
QAction *ramInit[4];
|
||||||
|
QAction *recAviAct;
|
||||||
|
QAction *recAsAviAct;
|
||||||
|
QAction *stopAviAct;
|
||||||
|
|
||||||
QTimer *gameTimer;
|
QTimer *gameTimer;
|
||||||
|
|
||||||
|
@ -359,7 +362,10 @@ class consoleWin_t : public QMainWindow
|
||||||
void mainMenuOpen(void);
|
void mainMenuOpen(void);
|
||||||
void mainMenuClose(void);
|
void mainMenuClose(void);
|
||||||
void warnAmbiguousShortcut( QShortcut*);
|
void warnAmbiguousShortcut( QShortcut*);
|
||||||
void aviOpen(void);
|
void aviRecordStart(void);
|
||||||
|
void aviRecordAsStart(void);
|
||||||
|
void aviRecordStop(void);
|
||||||
|
void aviVideoFormatChanged(int idx);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -83,6 +83,7 @@ bool swapDuty = 0;
|
||||||
bool turbo = false;
|
bool turbo = false;
|
||||||
bool pauseAfterPlayback = false;
|
bool pauseAfterPlayback = false;
|
||||||
bool suggestReadOnlyReplay = true;
|
bool suggestReadOnlyReplay = true;
|
||||||
|
bool showStatusIconOpt = true;
|
||||||
unsigned int gui_draw_area_width = 256;
|
unsigned int gui_draw_area_width = 256;
|
||||||
unsigned int gui_draw_area_height = 256;
|
unsigned int gui_draw_area_height = 256;
|
||||||
|
|
||||||
|
@ -1485,15 +1486,22 @@ FCEUFILE* FCEUD_OpenArchiveIndex(ArchiveScanRecord& asr, std::string &fname, int
|
||||||
}
|
}
|
||||||
DUMMY(FCEUD_HideMenuToggle)
|
DUMMY(FCEUD_HideMenuToggle)
|
||||||
DUMMY(FCEUD_MovieReplayFrom)
|
DUMMY(FCEUD_MovieReplayFrom)
|
||||||
DUMMY(FCEUD_ToggleStatusIcon)
|
//DUMMY(FCEUD_AviRecordTo)
|
||||||
DUMMY(FCEUD_AviRecordTo)
|
//DUMMY(FCEUD_AviStop)
|
||||||
DUMMY(FCEUD_AviStop)
|
//void FCEUI_AviVideoUpdate(const unsigned char* buffer) { }
|
||||||
void FCEUI_AviVideoUpdate(const unsigned char* buffer) { }
|
//bool FCEUI_AviIsRecording(void) {return false;}
|
||||||
int FCEUD_ShowStatusIcon(void) {return 0;}
|
|
||||||
bool FCEUI_AviIsRecording(void) {return false;}
|
|
||||||
void FCEUI_UseInputPreset(int preset) { }
|
void FCEUI_UseInputPreset(int preset) { }
|
||||||
bool FCEUD_PauseAfterPlayback() { return pauseAfterPlayback; }
|
bool FCEUD_PauseAfterPlayback() { return pauseAfterPlayback; }
|
||||||
|
|
||||||
|
int FCEUD_ShowStatusIcon(void)
|
||||||
|
{
|
||||||
|
return showStatusIconOpt;
|
||||||
|
}
|
||||||
|
void FCEUD_ToggleStatusIcon(void)
|
||||||
|
{
|
||||||
|
showStatusIconOpt = !showStatusIconOpt;
|
||||||
|
}
|
||||||
|
|
||||||
void FCEUD_TurboOn (void) { /* TODO */ };
|
void FCEUD_TurboOn (void) { /* TODO */ };
|
||||||
void FCEUD_TurboOff (void) { /* TODO */ };
|
void FCEUD_TurboOff (void) { /* TODO */ };
|
||||||
void FCEUD_TurboToggle(void) { /* TODO */ };
|
void FCEUD_TurboToggle(void) { /* TODO */ };
|
||||||
|
|
|
@ -16,6 +16,7 @@ extern bool swapDuty;
|
||||||
extern bool pauseAfterPlayback;
|
extern bool pauseAfterPlayback;
|
||||||
extern bool suggestReadOnlyReplay;
|
extern bool suggestReadOnlyReplay;
|
||||||
extern bool emulatorCycleToggle;
|
extern bool emulatorCycleToggle;
|
||||||
|
extern bool showStatusIconOpt;
|
||||||
extern unsigned int gui_draw_area_width;
|
extern unsigned int gui_draw_area_width;
|
||||||
extern unsigned int gui_draw_area_height;
|
extern unsigned int gui_draw_area_height;
|
||||||
extern unsigned int emulatorCycleCount;
|
extern unsigned int emulatorCycleCount;
|
||||||
|
|
Loading…
Reference in New Issue