diff --git a/src/driver.h b/src/driver.h index 21bcc7eb..fdb4191f 100644 --- a/src/driver.h +++ b/src/driver.h @@ -183,6 +183,12 @@ void FCEUD_MovieRecordTo(void); void FCEUD_MovieReplayFrom(void); void FCEUD_LuaRunFrom(void); +#ifdef _S9XLUA_H +// lua engine +void TaseditorAutoFunction(void); +void TaseditorManualFunction(void); +#endif + int32 FCEUI_GetDesiredFPS(void); void FCEUI_SaveSnapshot(void); void FCEUI_SaveSnapshotAs(void); diff --git a/src/drivers/Qt/TasEditor/TasEditorWindow.cpp b/src/drivers/Qt/TasEditor/TasEditorWindow.cpp index 9db888f6..5964ff17 100644 --- a/src/drivers/Qt/TasEditor/TasEditorWindow.cpp +++ b/src/drivers/Qt/TasEditor/TasEditorWindow.cpp @@ -846,7 +846,7 @@ QMenuBar *TasEditorWindow::buildMenuBar(void) //act->setShortcut(QKeySequence(tr("Ctrl+N"))); act->setStatusTip(tr("Run Function")); //act->setIcon( style()->standardIcon( QStyle::SP_FileDialogStart ) ); - //connect(act, SIGNAL(triggered()), this, SLOT(createNewProject(void)) ); + connect(act, SIGNAL(triggered()), this, SLOT(manLuaRun(void)) ); luaMenu->addAction(act); @@ -858,7 +858,7 @@ QMenuBar *TasEditorWindow::buildMenuBar(void) //act->setShortcut(QKeySequence(tr("Ctrl+N"))); act->setStatusTip(tr("Auto Function")); //act->setIcon( style()->standardIcon( QStyle::SP_FileDialogStart ) ); - //connect(act, SIGNAL(triggered()), this, SLOT(createNewProject(void)) ); + connect(act, SIGNAL(triggered(bool)), this, SLOT(autoLuaRunChanged(bool)) ); luaMenu->addAction(act); @@ -1364,7 +1364,7 @@ int TasEditorWindow::initModules(void) // create initial snapshot in history history.reset(); // reset Taseditor variables - //mustCallManualLuaFunction = false; + mustCallManualLuaFunction = false; //SetFocus(history.hwndHistoryList); // set focus only once, to show blue selection cursor //SetFocus(pianoRoll.hwndList); @@ -1392,16 +1392,19 @@ void TasEditorWindow::frameUpdate(void) splicer.update(); history.update(); project.update(); + +#ifdef _S9XLUA_H // run Lua functions if needed if (taseditorConfig.enableLuaAutoFunction) { - //TaseditorAutoFunction(); + TaseditorAutoFunction(); } - //if (mustCallManualLuaFunction) - //{ - // TaseditorManualFunction(); - // mustCallManualLuaFunction = false; - //} + if (mustCallManualLuaFunction) + { + TaseditorManualFunction(); + mustCallManualLuaFunction = false; + } +#endif pianoRoll->update(); @@ -2356,6 +2359,16 @@ void TasEditorWindow::pauseAtEndActChanged(bool val) taseditorConfig.autopauseAtTheEndOfMovie = val; } //---------------------------------------------------------------------------- +void TasEditorWindow::manLuaRun(void) +{ + mustCallManualLuaFunction = true; +} +//---------------------------------------------------------------------------- +void TasEditorWindow::autoLuaRunChanged(bool val) +{ + taseditorConfig.enableLuaAutoFunction = val; +} +//---------------------------------------------------------------------------- void TasEditorWindow::showToolTipsActChanged(bool val) { taseditorConfig.tooltipsEnabled = val; diff --git a/src/drivers/Qt/TasEditor/TasEditorWindow.h b/src/drivers/Qt/TasEditor/TasEditorWindow.h index 1c1e3f23..4c1a5bc5 100644 --- a/src/drivers/Qt/TasEditor/TasEditorWindow.h +++ b/src/drivers/Qt/TasEditor/TasEditorWindow.h @@ -295,6 +295,8 @@ class TasEditorWindow : public QDialog std::vector patternsNames; std::vector> patterns; + + bool mustCallManualLuaFunction; private: int initModules(void); @@ -373,6 +375,8 @@ class TasEditorWindow : public QDialog void setMaxUndoCapacity(void); void setCurrentPattern(int); void tabViewChanged(int); + void autoLuaRunChanged(bool); + void manLuaRun(void); friend class RECORDER; friend class SPLICER;