Added TAS input pattern selection Qt GUI code. Fixed a few clock timing calculations in Qt TAS editor.
This commit is contained in:
parent
22b28195c6
commit
c7bfb684ae
|
@ -329,8 +329,9 @@ void TasEditorWindow::closeWindow(void)
|
||||||
QMenuBar *TasEditorWindow::buildMenuBar(void)
|
QMenuBar *TasEditorWindow::buildMenuBar(void)
|
||||||
{
|
{
|
||||||
QMenu *fileMenu, *editMenu, *viewMenu,
|
QMenu *fileMenu, *editMenu, *viewMenu,
|
||||||
*confMenu, *luaMenu, *helpMenu;
|
*confMenu, *luaMenu, *helpMenu,
|
||||||
//QActionGroup *actGroup;
|
*patternMenu;
|
||||||
|
QActionGroup *actGroup;
|
||||||
QAction *act;
|
QAction *act;
|
||||||
int useNativeMenuBar=0;
|
int useNativeMenuBar=0;
|
||||||
|
|
||||||
|
@ -861,6 +862,27 @@ QMenuBar *TasEditorWindow::buildMenuBar(void)
|
||||||
|
|
||||||
luaMenu->addAction(act);
|
luaMenu->addAction(act);
|
||||||
|
|
||||||
|
// Pattern
|
||||||
|
patternMenu = menuBar->addMenu(tr("&Pattern"));
|
||||||
|
|
||||||
|
actGroup = new QActionGroup(this);
|
||||||
|
|
||||||
|
for (size_t i=0; i<patternsNames.size(); i++)
|
||||||
|
{
|
||||||
|
// Pattern -> Names
|
||||||
|
act = new QAction(tr(patternsNames[i].c_str()), this);
|
||||||
|
act->setCheckable(true);
|
||||||
|
//act->setShortcut(QKeySequence(tr("Ctrl+N")));
|
||||||
|
act->setStatusTip(tr(patternsNames[i].c_str()));
|
||||||
|
//act->setIcon( style()->standardIcon( QStyle::SP_FileDialogStart ) );
|
||||||
|
connect(act, &QAction::triggered, [this, i] { setCurrentPattern(i); } );
|
||||||
|
|
||||||
|
actGroup->addAction(act);
|
||||||
|
patternMenu->addAction(act);
|
||||||
|
|
||||||
|
act->setChecked( taseditorConfig.currentPattern == i );
|
||||||
|
}
|
||||||
|
|
||||||
// Help
|
// Help
|
||||||
helpMenu = menuBar->addMenu(tr("&Help"));
|
helpMenu = menuBar->addMenu(tr("&Help"));
|
||||||
|
|
||||||
|
@ -2074,6 +2096,20 @@ void TasEditorWindow::openOnlineDocs(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
void TasEditorWindow::setCurrentPattern(int idx)
|
||||||
|
{
|
||||||
|
if ( idx < 0 )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( (size_t)idx >= patternsNames.size() )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//printf("Set Pattern: %i\n", idx);
|
||||||
|
taseditorConfig.currentPattern = idx;
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
void TasEditorWindow::recordingChanged(int state)
|
void TasEditorWindow::recordingChanged(int state)
|
||||||
{
|
{
|
||||||
FCEUI_MovieToggleReadOnly();
|
FCEUI_MovieToggleReadOnly();
|
||||||
|
@ -2705,7 +2741,9 @@ void TasEditorWindow::setInputUsingPattern(int start, int end, int joy, int butt
|
||||||
}
|
}
|
||||||
if (start < 0) start = end;
|
if (start < 0) start = end;
|
||||||
if (end >= currMovieData.getNumRecords())
|
if (end >= currMovieData.getNumRecords())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int pattern_offset = 0, current_pattern = taseditorConfig.currentPattern;
|
int pattern_offset = 0, current_pattern = taseditorConfig.currentPattern;
|
||||||
bool changes_made = false;
|
bool changes_made = false;
|
||||||
|
@ -2715,7 +2753,9 @@ void TasEditorWindow::setInputUsingPattern(int start, int end, int joy, int butt
|
||||||
{
|
{
|
||||||
// skip lag frames
|
// skip lag frames
|
||||||
if (taseditorConfig.autofirePatternSkipsLag && greenzone.lagLog.getLagInfoAtFrame(i) == LAGGED_YES)
|
if (taseditorConfig.autofirePatternSkipsLag && greenzone.lagLog.getLagInfoAtFrame(i) == LAGGED_YES)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
value = (patterns[current_pattern][pattern_offset] != 0);
|
value = (patterns[current_pattern][pattern_offset] != 0);
|
||||||
if (currMovieData.records[i].checkBit(joy, button) != value)
|
if (currMovieData.records[i].checkBit(joy, button) != value)
|
||||||
{
|
{
|
||||||
|
@ -2724,10 +2764,14 @@ void TasEditorWindow::setInputUsingPattern(int start, int end, int joy, int butt
|
||||||
}
|
}
|
||||||
pattern_offset++;
|
pattern_offset++;
|
||||||
if (pattern_offset >= (int)patterns[current_pattern].size())
|
if (pattern_offset >= (int)patterns[current_pattern].size())
|
||||||
|
{
|
||||||
pattern_offset -= patterns[current_pattern].size();
|
pattern_offset -= patterns[current_pattern].size();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (changes_made)
|
if (changes_made)
|
||||||
|
{
|
||||||
greenzone.invalidateAndUpdatePlayback(history.registerChanges(MODTYPE_PATTERN, start, end, 0, patternsNames[current_pattern].c_str(), consecutivenessTag));
|
greenzone.invalidateAndUpdatePlayback(history.registerChanges(MODTYPE_PATTERN, start, end, 0, patternsNames[current_pattern].c_str(), consecutivenessTag));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// following functions use current Selection to determine range of frames
|
// following functions use current Selection to determine range of frames
|
||||||
|
|
|
@ -371,6 +371,7 @@ class TasEditorWindow : public QDialog
|
||||||
void openProjectSaveOptions(void);
|
void openProjectSaveOptions(void);
|
||||||
void setGreenzoneCapacity(void);
|
void setGreenzoneCapacity(void);
|
||||||
void setMaxUndoCapacity(void);
|
void setMaxUndoCapacity(void);
|
||||||
|
void setCurrentPattern(int);
|
||||||
void tabViewChanged(int);
|
void tabViewChanged(int);
|
||||||
|
|
||||||
friend class RECORDER;
|
friend class RECORDER;
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
|
|
||||||
#define GREENZONE_ID_LEN 10
|
#define GREENZONE_ID_LEN 10
|
||||||
|
|
||||||
#define TIME_BETWEEN_CLEANINGS 10000 // in milliseconds
|
#define TIME_BETWEEN_CLEANINGS (10000 * (CLOCKS_PER_SEC / 1000)) // in milliseconds
|
||||||
|
|
||||||
// Greenzone cleaning masks
|
// Greenzone cleaning masks
|
||||||
#define EVERY16TH 0xFFFFFFF0
|
#define EVERY16TH 0xFFFFFFF0
|
||||||
#define EVERY8TH 0xFFFFFFF8
|
#define EVERY8TH 0xFFFFFFF8
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
// Specification file for History class
|
// Specification file for History class
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <time.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "fceu.h"
|
#include "fceu.h"
|
||||||
#include "Qt/TasEditor/bookmark.h"
|
#include "Qt/TasEditor/bookmark.h"
|
||||||
#include "Qt/TasEditor/snapshot.h"
|
#include "Qt/TasEditor/snapshot.h"
|
||||||
|
|
||||||
#define UNDO_HINT_TIME 200 // in milliseconds
|
#define UNDO_HINT_TIME (200 * (CLOCKS_PER_SEC / 1000)) // in milliseconds
|
||||||
|
|
||||||
#define SAVING_HISTORY_PROGRESSBAR_UPDATE_RATE 10
|
#define SAVING_HISTORY_PROGRESSBAR_UPDATE_RATE 10
|
||||||
#define TIME_BETWEEN_AUTOCOMPRESSIONS 500 // in milliseconds
|
#define TIME_BETWEEN_AUTOCOMPRESSIONS (500 * (CLOCKS_PER_SEC / 1000)) // in milliseconds
|
||||||
|
|
||||||
#define HISTORY_LIST_WIDTH 500
|
#define HISTORY_LIST_WIDTH 500
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue