* Tasedit: header lights on Paste/PasteInsert

* 10 new Lua functions (TAS Editor library)
* Tasedit: Find Note dialog (Ctrl-F)
* Tasedit: Config->Reappearing Find Note dialog
* bugfixes
This commit is contained in:
ansstuff 2011-12-25 21:54:31 +00:00
parent 6632b06871
commit b3c53d5ad5
22 changed files with 594 additions and 90 deletions

View File

@ -65,7 +65,7 @@ DWEdit
Debugger additions
AnS - ansstuff at yandex dot ru (sf:ansstuff)
Bugfixes and additions, TASEdit v1.0
Bugfixes and additions, TAS Editor v1.0
---------linux devvers---------
>= 2.0 - These guys concentrated on keeping fceux the premiere

View File

@ -1,4 +1,9 @@
26-dec-2011 - AnS - Tasedit: Find Note dialog (Ctrl-F)
26-dec-2011 - AnS - new Lua functions (TAS Editor library)
19-dec-2011 - AnS - Tasedit: listview header lights
19-dec-2011 - AnS - Tasedit: Recording checkbox instead of radiobutton; Config->Use Input keys for ColumnSet
19-dec-2011 - AnS - Tasedit: Export dialog: "Convert Marker Notes to Movie Subtitles"
16-dec-2011 - AnS - Tasedit: new accelerators: Ctrl-PgUp/Ctrl-PgDn/Shift-PgUp/Shift-PgDn; Config->Allow keyboard controls in Listview
16-dec-2011 - AnS - Tasedit: View->Display Branch Tooltips
16-dec-2011 - AnS - Tasedit: Markers notes; View->Follow Marker Note context

View File

@ -77,6 +77,7 @@ extern bool TASEdit_show_branch_screenshots;
extern bool TASEdit_show_branch_tooltips;
extern bool TASEdit_bind_markers;
extern bool TASEdit_empty_marker_notes;
extern bool TASEdit_findnote_reappear;
extern bool TASEdit_combine_consecutive_rec;
extern bool TASEdit_use_1p_rec;
extern bool TASEdit_columnset_by_keys;
@ -103,6 +104,8 @@ extern bool TASEdit_savecompact_greenzone;
extern bool TASEdit_savecompact_history;
extern bool TASEdit_savecompact_list;
extern bool TASEdit_savecompact_selection;
extern bool TASEdit_findnote_matchcase;
extern bool TASEdit_findnote_search_up;
extern char* recent_projects[];
//window positions and sizes:
@ -340,6 +343,7 @@ static CFGSTRUCT fceuconfig[] = {
AC(TASEdit_show_branch_tooltips),
AC(TASEdit_bind_markers),
AC(TASEdit_empty_marker_notes),
AC(TASEdit_findnote_reappear),
AC(TASEdit_combine_consecutive_rec),
AC(TASEdit_use_1p_rec),
AC(TASEdit_columnset_by_keys),
@ -366,6 +370,8 @@ static CFGSTRUCT fceuconfig[] = {
AC(TASEdit_savecompact_history),
AC(TASEdit_savecompact_list),
AC(TASEdit_savecompact_selection),
AC(TASEdit_findnote_matchcase),
AC(TASEdit_findnote_search_up),
AC(lagCounterDisplay),
AC(oldInputDisplay),
AC(movieSubtitles),

View File

@ -254,6 +254,8 @@ BEGIN
MENUITEM "Insert # of Frames\tIns", ID_EDIT_INSERT
MENUITEM SEPARATOR
MENUITEM "Truncate\tCtrl+T", ID_EDIT_TRUNCATE
MENUITEM SEPARATOR
MENUITEM "&Find Note...\tCtrl+F", ID_EDIT_FINDNOTE
END
POPUP "&View"
BEGIN
@ -278,6 +280,7 @@ BEGIN
MENUITEM SEPARATOR
MENUITEM "&Bind Markers to Input", ID_CONFIG_BINDMARKERSTOINPUT
MENUITEM "&Empty new Marker Notes", ID_CONFIG_EMPTYNEWMARKERNOTES
MENUITEM "Reappearing &Find Note dialog", ID_CONFIG_REAPPEARINGFINDNOTEDIALOG
MENUITEM SEPARATOR
MENUITEM "&Combine consecutive Recordings", ID_CONFIG_COMBINECONSECUTIVERECORDINGS
MENUITEM "&Use 1P keys for all single Recordings", ID_CONFIG_USE1PFORRECORDING
@ -1405,14 +1408,14 @@ BEGIN
CONTROL " 4P",IDC_RADIO6,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,402,98,24,10
CONTROL " Superimpose",IDC_SUPERIMPOSE,"Button",BS_AUTO3STATE,372,74,55,10
GROUPBOX " History ",IDC_STATIC,310,255,123,116,BS_CENTER,WS_EX_RIGHT
EDITTEXT IDC_SELECTION_MARKER_EDIT,65,377,240,13,ES_READONLY | NOT WS_TABSTOP
EDITTEXT IDC_SELECTION_MARKER_EDIT,65,377,240,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
PUSHBUTTON "<<",TASEDIT_PREV_MARKER,315,376,23,14,NOT WS_TABSTOP
PUSHBUTTON "Find",TASEDIT_FIND_BEST_MARKER,338,376,34,14,WS_DISABLED | NOT WS_TABSTOP
PUSHBUTTON "Next",TASEDIT_FIND_NEXT_MARKER,372,376,34,14,WS_DISABLED | NOT WS_TABSTOP
PUSHBUTTON "Similar",TASEDIT_FIND_BEST_SIMILAR_MARKER,338,376,34,14,NOT WS_TABSTOP
PUSHBUTTON "More",TASEDIT_FIND_NEXT_SIMILAR_MARKER,372,376,34,14,NOT WS_TABSTOP
PUSHBUTTON ">>",TASEDIT_NEXT_MARKER,405,376,23,14,NOT WS_TABSTOP
RTEXT "Marker 0",IDC_PLAYBACK_MARKER,3,3,60,10,0,WS_EX_RIGHT
RTEXT "Marker 99999",IDC_SELECTION_MARKER,3,379,60,10,0,WS_EX_RIGHT
EDITTEXT IDC_PLAYBACK_MARKER_EDIT,65,1,240,13,ES_READONLY | NOT WS_TABSTOP
EDITTEXT IDC_PLAYBACK_MARKER_EDIT,65,1,240,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
CONTROL "",IDC_BRANCHES_BITMAP,"Static",SS_OWNERDRAW | SS_NOTIFY | SS_REALSIZEIMAGE | NOT WS_VISIBLE,315,160,113,89
CONTROL " Turbo seek",CHECK_TURBO_SEEK,"Button",BS_AUTOCHECKBOX,379,26,50,12
CONTROL "",IDC_TEXT_SELECTION_BUTTON,"Button",BS_OWNERDRAW,315,121,113,12
@ -1422,33 +1425,47 @@ BEGIN
END
IDD_TASEDIT_EXPORT DIALOGEX 0, 0, 158, 86
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Export to FM2"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Export",IDOK,7,66,50,14
PUSHBUTTON "Cancel",IDCANCEL,100,66,50,14
CONTROL " 1 player",IDC_RADIO_1PLAYER,"Button",BS_AUTORADIOBUTTON,8,8,47,10
CONTROL " 1 player",IDC_RADIO_1PLAYER,"Button",BS_AUTORADIOBUTTON | WS_GROUP,8,8,47,10
CONTROL " 2 players",IDC_RADIO_2PLAYERS,"Button",BS_AUTORADIOBUTTON,8,21,47,10
CONTROL " Fourscore",IDC_RADIO_FOURSCORE,"Button",BS_AUTORADIOBUTTON,8,35,47,10
CONTROL " Convert Marker Notes to Movie Subtitles",IDC_NOTES_TO_SUBTITLES,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,50,141,10
END
IDD_TASEDIT_FINDNOTE DIALOGEX 0, 0, 228, 52
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Find Note"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Find next",IDOK,171,6,51,14
PUSHBUTTON "Cancel",IDCANCEL,171,24,51,14
EDITTEXT IDC_NOTE_TO_FIND,6,7,160,12,ES_AUTOHSCROLL
CONTROL " Match case",IDC_MATCH_CASE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,25,53,10
GROUPBOX "Direction",IDC_STATIC,82,21,83,26
CONTROL " Up",IDC_RADIO_UP,"Button",BS_AUTORADIOBUTTON | WS_GROUP,90,32,29,10
CONTROL " Down",IDC_RADIO_DOWN,"Button",BS_AUTORADIOBUTTON,125,32,32,10
END
IDD_TASEDIT_SAVECOMPACT DIALOGEX 0, 0, 122, 134
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Save",IDOK,7,114,50,14
PUSHBUTTON "Cancel",IDCANCEL,65,114,50,14
CONTROL " Binary Format of Input",IDC_CHECK_BINARY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,8,87,10
CONTROL " Binary Format of Input",IDC_CHECK_BINARY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,7,87,10
CONTROL " Markers",IDC_CHECK_MARKERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,22,67,10
CONTROL " Bookmarks",IDC_CHECK_BOOKMARKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,36,67,10
CONTROL " Greenzone",IDC_CHECK_GREENZONE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,51,67,10
CONTROL " History",IDC_CHECK_HISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,66,67,10
CONTROL " List data",IDC_CHECK_LIST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,96,67,10
CONTROL " Selection",IDC_CHECK_SELECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,81,67,10
CONTROL " Bookmarks",IDC_CHECK_BOOKMARKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,37,67,10
CONTROL " Greenzone",IDC_CHECK_GREENZONE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,52,67,10
CONTROL " History",IDC_CHECK_HISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,67,67,10
CONTROL " List data",IDC_CHECK_LIST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,82,67,10
CONTROL " Selection",IDC_CHECK_SELECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,97,67,10
END
ASSEMBLER DIALOGEX 0, 0, 202, 135
@ -1891,6 +1908,10 @@ BEGIN
BOTTOMMARGIN, 121
END
"NTVIEW", DIALOG
BEGIN
END
"ROMPATCHER", DIALOG
BEGIN
END
@ -1934,10 +1955,12 @@ BEGIN
BEGIN
END
IDD_TASEDIT_FINDNOTE, DIALOG
BEGIN
END
IDD_TASEDIT_SAVECOMPACT, DIALOG
BEGIN
RIGHTMARGIN, 121
BOTTOMMARGIN, 131
END
"ASSEMBLER", DIALOG
@ -2090,6 +2113,8 @@ BEGIN
"F", ACCEL_CTRL_F, VIRTKEY, CONTROL, NOINVERT
VK_INSERT, ACCEL_CTRL_INSERT, VIRTKEY, CONTROL, NOINVERT
"P", ACCEL_CTRL_P, VIRTKEY, CONTROL, NOINVERT
VK_NEXT, ACCEL_CTRL_PGDN, VIRTKEY, CONTROL, NOINVERT
VK_PRIOR, ACCEL_CTRL_PGUP, VIRTKEY, CONTROL, NOINVERT
"Q", ACCEL_CTRL_Q, VIRTKEY, CONTROL, NOINVERT
"S", ACCEL_CTRL_S, VIRTKEY, CONTROL, NOINVERT
"T", ACCEL_CTRL_T, VIRTKEY, CONTROL, NOINVERT
@ -2101,11 +2126,9 @@ BEGIN
VK_DELETE, ACCEL_DEL, VIRTKEY, NOINVERT
VK_INSERT, ACCEL_INS, VIRTKEY, NOINVERT
VK_INSERT, ACCEL_SHIFT_INS, VIRTKEY, SHIFT, NOINVERT
"V", ACCEL_SHIFT_V, VIRTKEY, SHIFT, NOINVERT
VK_PRIOR, ACCEL_CTRL_PGUP, VIRTKEY, CONTROL, NOINVERT
VK_NEXT, ACCEL_CTRL_PGDN, VIRTKEY, CONTROL, NOINVERT
VK_PRIOR, ACCEL_SHIFT_PGUP, VIRTKEY, SHIFT, NOINVERT
VK_NEXT, ACCEL_SHIFT_PGDN, VIRTKEY, SHIFT, NOINVERT
VK_PRIOR, ACCEL_SHIFT_PGUP, VIRTKEY, SHIFT, NOINVERT
"V", ACCEL_SHIFT_V, VIRTKEY, SHIFT, NOINVERT
END
IDR_RWACCELERATOR ACCELERATORS

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 894 B

View File

@ -184,6 +184,7 @@
#define IDD_TASEDIT_SAVECOMPACT 186
#define IDD_TASEDIT_BRANCH_NOTE 188
#define IDI_ICON3 197
#define IDD_TASEDIT_FINDNOTE 198
#define MENU_RESET 200
#define BUTTON_ROMS 200
#define TXT_PAD1 200
@ -407,6 +408,7 @@
#define TASEDIT_REWIND2 1137
#define TASEDIT_PLAYSTOP 1137
#define IDC_RADIO1 1138
#define IDC_RADIO_UP 1138
#define IDC_RADIO2 1139
#define IDC_RADIO3 1140
#define IDC_RADIO4 1141
@ -421,10 +423,13 @@
#define TASEDIT_PREV_MARKER 1145
#define IDC_BUTTON8 1146
#define TASEDIT_FIND_BEST_MARKER 1146
#define TASEDIT_FIND_BEST_SIMILAR_MARKER 1146
#define IDC_EDIT1 1147
#define IDC_SELECTION_MARKER_EDIT 1147
#define IDC_NOTE_TO_FIND 1147
#define IDC_BUTTON9 1148
#define TASEDIT_FIND_NEXT_MARKER 1148
#define TASEDIT_FIND_NEXT_SIMILAR_MARKER 1148
#define IDC_HISTORYLIST 1149
#define IDC_BOOKMARKSLIST 1150
#define TASEDIT_NEXT_MARKER 1151
@ -471,6 +476,7 @@
#define IDC_SUPERIMPOSE 1203
#define IDC_CHECK_BINARY 1203
#define IDC_NOTES_TO_SUBTITLES 1203
#define IDC_MATCH_CASE 1203
#define IDC_VOLUMEGROUP 1204
#define IDC_OMITBLANK 1204
#define IDC_CHECK3 1204
@ -562,6 +568,7 @@
#define IDC_RADIO_FOURSCORE 1271
#define IDC_SELECTION_MARKER 1271
#define IDC_NOTE_TOOLTIP_EDIT 1272
#define IDC_RADIO_DOWN 1273
#define MENU_NETWORK 40040
#define MENU_PALETTE 40041
#define MENU_SOUND 40042
@ -953,6 +960,8 @@
#define ID_VIEW_SHOWBRANCHTOOLTIPS 40508
#define ID_CONFIG_USEINPUTKEYSFORCOLUMNSET 40509
#define ID_CONFIG_EMPTYNEWMARKERNOTES 40510
#define ID_EDIT_FINDNOTE 40513
#define ID_CONFIG_REAPPEARINGFINDNOTEDIALOG 40514
#define IDC_DEBUGGER_ICONTRAY 55535
#define MW_ValueLabel2 65423
#define MW_ValueLabel1 65426
@ -961,9 +970,9 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 198
#define _APS_NEXT_COMMAND_VALUE 40511
#define _APS_NEXT_CONTROL_VALUE 1273
#define _APS_NEXT_RESOURCE_VALUE 199
#define _APS_NEXT_COMMAND_VALUE 40515
#define _APS_NEXT_CONTROL_VALUE 1274
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -9,6 +9,9 @@
#include "main.h"
#include "tasedit.h"
#include "version.h"
#include <Shlwapi.h> // for StrStrI
#pragma comment(lib, "Shlwapi.lib")
using namespace std;
@ -19,6 +22,7 @@ bool TASEdit_focus = false;
bool Tasedit_rewind_now = false;
int marker_note_edit = MARKER_NOTE_EDIT_NONE;
char findnote_string[MAX_NOTE_LEN] = {0};
// all Taseditor functional modules
TASEDIT_PROJECT project;
@ -77,6 +81,9 @@ bool TASEdit_savecompact_greenzone = false;
bool TASEdit_savecompact_history = false;
bool TASEdit_savecompact_list = true;
bool TASEdit_savecompact_selection = false;
bool TASEdit_findnote_matchcase = false;
bool TASEdit_findnote_search_up = false;
bool TASEdit_findnote_reappear = true;
// Recent Menu
HMENU recent_projects_menu;
@ -88,7 +95,6 @@ const unsigned int MAX_NUMBER_OF_RECENT_PROJECTS = sizeof(recent_projects)/sizeo
string tasedithelp = "{16CDE0C4-02B0-4A60-A88D-076319909A4D}"; //Name of TAS Editor Help page
char buttonNames[NUM_JOYPAD_BUTTONS][2] = {"A", "B", "S", "T", "U", "D", "L", "R"};
char windowCaptioBase[] = "TAS Editor";
extern char recordingCaptions[5][30];
HICON hTaseditorIcon = 0;
// enterframe function
@ -113,7 +119,7 @@ void RedrawWindowCaption()
char new_caption[300];
strcpy(new_caption, windowCaptioBase);
if (!movie_readonly)
strcat(new_caption, recordingCaptions[recorder.multitrack_recording_joypad]);
strcat(new_caption, recorder.GetRecordingCaption());
// add project name
std::string projectname = project.GetProjectName();
if (!projectname.empty())
@ -466,9 +472,11 @@ void FrameColumnSet()
{
if(!current_markers.GetMarker(*it))
{
changes_made = true;
current_markers.SetMarker(*it);
tasedit_list.RedrawRow(*it);
if (current_markers.SetMarker(*it))
{
changes_made = true;
tasedit_list.RedrawRow(*it);
}
}
}
if (changes_made)
@ -480,8 +488,8 @@ void FrameColumnSet()
{
if(current_markers.GetMarker(*it))
{
changes_made = true;
current_markers.ClearMarker(*it);
changes_made = true;
tasedit_list.RedrawRow(*it);
}
}
@ -640,6 +648,7 @@ bool Paste()
pGlobal = strchr(pGlobal, '\n');
int joy = 0;
uint8 new_buttons = 0;
std::vector<uint8> flash_joy(NUM_JOYPADS);
char* frame;
--pos;
while (pGlobal++ && *pGlobal!='\0')
@ -674,14 +683,19 @@ bool Paste()
case '|': // Joystick mark
// flush buttons to movie data
if (TASEdit_superimpose_affects_paste && (TASEdit_superimpose == BST_CHECKED || (TASEdit_superimpose == BST_INDETERMINATE && new_buttons == 0)))
{
flash_joy[joy] |= (new_buttons & (~currMovieData.records[pos].joysticks[joy])); // highlight buttons that are new
currMovieData.records[pos].joysticks[joy] |= new_buttons;
else
} else
{
flash_joy[joy] |= new_buttons; // highlight buttons that were added
currMovieData.records[pos].joysticks[joy] = new_buttons;
}
++joy;
new_buttons = 0;
break;
default:
for (int bit=0; bit<NUM_JOYPAD_BUTTONS; ++bit)
for (int bit = 0; bit < NUM_JOYPAD_BUTTONS; ++bit)
{
if (*frame == buttonNames[bit][0])
{
@ -695,15 +709,28 @@ bool Paste()
}
// before going to next frame, flush buttons to movie data
if (TASEdit_superimpose_affects_paste && (TASEdit_superimpose == BST_CHECKED || (TASEdit_superimpose == BST_INDETERMINATE && new_buttons == 0)))
{
flash_joy[joy] |= (new_buttons & (~currMovieData.records[pos].joysticks[joy])); // highlight buttons that are new
currMovieData.records[pos].joysticks[joy] |= new_buttons;
else
} else
{
flash_joy[joy] |= new_buttons; // highlight buttons that were added
currMovieData.records[pos].joysticks[joy] = new_buttons;
}
// find CRLF
pGlobal = strchr(pGlobal, '\n');
}
greenzone.InvalidateAndCheck(history.RegisterChanges(MODTYPE_PASTE, *current_selection_begin));
// flash list header columns that were changed during paste
for (int joy = 0; joy < NUM_JOYPADS; ++joy)
{
for (int btn = 0; btn < NUM_JOYPAD_BUTTONS; ++btn)
{
if (flash_joy[joy] & (1 << btn))
tasedit_list.SetHeaderColumnLight(COLUMN_JOYPAD1_A + joy * NUM_JOYPAD_BUTTONS + btn, HEADER_LIGHT_MAX);
}
}
result = true;
}
GlobalUnlock(hGlobal);
@ -742,6 +769,7 @@ bool PasteInsert()
pGlobal = strchr(pGlobal, '\n');
char* frame;
int joy=0;
std::vector<uint8> flash_joy(NUM_JOYPADS);
--pos;
while (pGlobal++ && *pGlobal!='\0')
{
@ -783,6 +811,7 @@ bool PasteInsert()
if (*frame == buttonNames[bit][0])
{
currMovieData.records[pos].joysticks[joy] |= (1<<bit);
flash_joy[joy] |= (1<<bit); // highlight buttons
break;
}
}
@ -797,6 +826,15 @@ bool PasteInsert()
if (TASEdit_bind_markers)
selection.must_find_current_marker = playback.must_find_current_marker = true;
greenzone.InvalidateAndCheck(history.RegisterChanges(MODTYPE_PASTEINSERT, *current_selection_begin));
// flash list header columns that were changed during paste
for (int joy = 0; joy < NUM_JOYPADS; ++joy)
{
for (int btn = 0; btn < NUM_JOYPAD_BUTTONS; ++btn)
{
if (flash_joy[joy] & (1 << btn))
tasedit_list.SetHeaderColumnLight(COLUMN_JOYPAD1_A + joy * NUM_JOYPAD_BUTTONS + btn, HEADER_LIGHT_MAX);
}
}
result = true;
}
GlobalUnlock(hGlobal);
@ -1456,7 +1494,25 @@ BOOL CALLBACK WndprocTasEdit(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
Paste();
break;
case ACCEL_SHIFT_V:
PasteInsert();
{
// hack to allow entering Shift-V into edit control even though accelerator steals the input
char insert_v[] = "v";
char insert_V[] = "V";
if (marker_note_edit == MARKER_NOTE_EDIT_UPPER)
{
if (GetKeyState(VK_CAPITAL) & 1)
SendMessage(playback.hwndPlaybackMarkerEdit, EM_REPLACESEL, true, (LPARAM)insert_v);
else
SendMessage(playback.hwndPlaybackMarkerEdit, EM_REPLACESEL, true, (LPARAM)insert_V);
} else if (marker_note_edit == MARKER_NOTE_EDIT_LOWER)
{
if (GetKeyState(VK_CAPITAL) & 1)
SendMessage(selection.hwndSelectionMarkerEdit, EM_REPLACESEL, true, (LPARAM)insert_v);
else
SendMessage(selection.hwndSelectionMarkerEdit, EM_REPLACESEL, true, (LPARAM)insert_V);
} else
PasteInsert();
}
break;
case ID_EDIT_PASTEINSERT:
if (marker_note_edit == MARKER_NOTE_EDIT_UPPER)
@ -1515,7 +1571,6 @@ BOOL CALLBACK WndprocTasEdit(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
case TASEDIT_PLAYSTOP:
playback.ToggleEmulationPause();
break;
case ACCEL_CTRL_F:
case CHECK_FOLLOW_CURSOR:
//switch "Follow playback" flag
TASEdit_follow_playback ^= 1;
@ -1651,6 +1706,10 @@ BOOL CALLBACK WndprocTasEdit(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
TASEdit_empty_marker_notes ^= 1;
CheckMenuItem(hmenu, ID_CONFIG_EMPTYNEWMARKERNOTES, TASEdit_empty_marker_notes?MF_CHECKED : MF_UNCHECKED);
break;
case ID_CONFIG_REAPPEARINGFINDNOTEDIALOG:
TASEdit_findnote_reappear ^= 1;
CheckMenuItem(hmenu, ID_CONFIG_REAPPEARINGFINDNOTEDIALOG, TASEdit_findnote_reappear?MF_CHECKED : MF_UNCHECKED);
break;
case ID_CONFIG_COMBINECONSECUTIVERECORDINGS:
//switch "Combine consecutive Recordings" flag
TASEdit_combine_consecutive_rec ^= 1;
@ -1803,9 +1862,11 @@ BOOL CALLBACK WndprocTasEdit(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
{
if(!current_markers.GetMarker(*it))
{
changes_made = true;
current_markers.SetMarker(*it);
tasedit_list.RedrawRow(*it);
if (current_markers.SetMarker(*it))
{
changes_made = true;
tasedit_list.RedrawRow(*it);
}
}
}
if (changes_made)
@ -1828,8 +1889,8 @@ BOOL CALLBACK WndprocTasEdit(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
{
if(current_markers.GetMarker(*it))
{
changes_made = true;
current_markers.ClearMarker(*it);
changes_made = true;
tasedit_list.RedrawRow(*it);
}
}
@ -1855,6 +1916,17 @@ BOOL CALLBACK WndprocTasEdit(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
case ACCEL_CTRL_PGDN:
selection.JumpNextMarker();
break;
case ACCEL_CTRL_F:
case ID_EDIT_FINDNOTE:
FindNote();
break;
case TASEDIT_FIND_BEST_SIMILAR_MARKER:
FindSimilarMarker();
break;
case TASEDIT_FIND_NEXT_SIMILAR_MARKER:
// reset search_offset to 0
FindSimilarMarker();
break;
}
@ -1915,6 +1987,7 @@ bool EnterTasEdit()
CheckMenuItem(hmenu, ID_CONFIG_HUDINBRANCHSCREENSHOTS, TASEdit_branch_scr_hud?MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hmenu, ID_CONFIG_BINDMARKERSTOINPUT, TASEdit_bind_markers?MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hmenu, ID_CONFIG_EMPTYNEWMARKERNOTES, TASEdit_empty_marker_notes?MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hmenu, ID_CONFIG_REAPPEARINGFINDNOTEDIALOG, TASEdit_findnote_reappear?MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hmenu, ID_CONFIG_COMBINECONSECUTIVERECORDINGS, TASEdit_combine_consecutive_rec?MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hmenu, ID_CONFIG_USE1PFORRECORDING, TASEdit_use_1p_rec?MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hmenu, ID_CONFIG_USEINPUTKEYSFORCOLUMNSET, TASEdit_columnset_by_keys?MF_CHECKED : MF_UNCHECKED);
@ -2020,14 +2093,13 @@ void ClearTaseditInput()
void UpdateMarkerNote()
{
if (!marker_note_edit) return;
char old_text[MAX_NOTE_LEN], new_text[MAX_NOTE_LEN];
char new_text[MAX_NOTE_LEN];
if (marker_note_edit == MARKER_NOTE_EDIT_UPPER)
{
int len = SendMessage(playback.hwndPlaybackMarkerEdit, WM_GETTEXT, MAX_NOTE_LEN, (LPARAM)new_text);
new_text[len] = 0;
// check changes
strcpy(old_text, current_markers.GetNote(playback.shown_marker).c_str());
if (strcmp(old_text, new_text))
if (strcmp(current_markers.GetNote(playback.shown_marker).c_str(), new_text))
{
current_markers.SetNote(playback.shown_marker, new_text);
if (playback.shown_marker)
@ -2043,8 +2115,7 @@ void UpdateMarkerNote()
int len = SendMessage(selection.hwndSelectionMarkerEdit, WM_GETTEXT, MAX_NOTE_LEN, (LPARAM)new_text);
new_text[len] = 0;
// check changes
strcpy(old_text, current_markers.GetNote(selection.shown_marker).c_str());
if (strcmp(old_text, new_text))
if (strcmp(current_markers.GetNote(selection.shown_marker).c_str(), new_text))
{
current_markers.SetNote(selection.shown_marker, new_text);
if (selection.shown_marker)
@ -2056,6 +2127,152 @@ void UpdateMarkerNote()
playback.must_find_current_marker = true;
}
}
}
BOOL CALLBACK FindNoteProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
{
SetWindowPos(hwndDlg, 0, TasEdit_wndx + 70, TasEdit_wndy + 160, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER);
CheckDlgButton(hwndDlg, IDC_MATCH_CASE, TASEdit_findnote_matchcase?MF_CHECKED : MF_UNCHECKED);
if (TASEdit_findnote_search_up)
Button_SetCheck(GetDlgItem(hwndDlg, IDC_RADIO_UP), BST_CHECKED);
else
Button_SetCheck(GetDlgItem(hwndDlg, IDC_RADIO_DOWN), BST_CHECKED);
HWND hwndEdit = GetDlgItem(hwndDlg, IDC_NOTE_TO_FIND);
SendMessage(hwndEdit, EM_SETLIMITTEXT, MAX_NOTE_LEN - 1, 0);
SetWindowText(hwndEdit, findnote_string);
if (GetDlgCtrlID((HWND)wParam) != IDC_NOTE_TO_FIND)
{
SetFocus(hwndEdit);
return false;
}
return true;
}
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_NOTE_TO_FIND:
{
if(HIWORD(wParam) == EN_CHANGE)
{
if (GetWindowTextLength(GetDlgItem(hwndDlg, IDC_NOTE_TO_FIND)))
EnableWindow(GetDlgItem(hwndDlg, IDOK), true);
else
EnableWindow(GetDlgItem(hwndDlg, IDOK), false);
}
break;
}
case IDC_RADIO_UP:
TASEdit_findnote_search_up = true;
break;
case IDC_RADIO_DOWN:
TASEdit_findnote_search_up = false;
break;
case IDC_MATCH_CASE:
TASEdit_findnote_matchcase ^= 1;
CheckDlgButton(hwndDlg, IDC_MATCH_CASE, TASEdit_findnote_matchcase?MF_CHECKED : MF_UNCHECKED);
break;
case IDOK:
{
int len = SendMessage(GetDlgItem(hwndDlg, IDC_NOTE_TO_FIND), WM_GETTEXT, MAX_NOTE_LEN, (LPARAM)findnote_string);
findnote_string[len] = 0;
EndDialog(hwndDlg, 1);
return TRUE;
}
case IDCANCEL:
EndDialog(hwndDlg, 0);
return TRUE;
}
break;
}
return FALSE;
}
void FindNote()
{
selection.update();
int movie_size = currMovieData.getNumRecords();
int entries_found = 0;
int current_frame;
int cur_marker = 0;
bool result;
do
{
if (DialogBox(fceu_hInstance, MAKEINTRESOURCE(IDD_TASEDIT_FINDNOTE), hwndTasEdit, FindNoteProc) > 0 && strlen(findnote_string))
{
current_frame = selection.GetCurrentSelectionBeginning();
if (TASEdit_findnote_search_up)
if (current_frame < 0)
current_frame = movie_size;
while (true)
{
// move forward
if (TASEdit_findnote_search_up)
{
current_frame--;
if (current_frame < 0)
{
if (entries_found)
MessageBox(hwndTasEdit, "No more entries found.", "Find Note", MB_OK);
else
MessageBox(hwndTasEdit, "Nothing was found!", "Find Note", MB_OK);
break;
}
} else
{
current_frame++;
if (current_frame >= movie_size)
{
if (entries_found)
MessageBox(hwndTasEdit, "No more entries found.", "Find Note", MB_OK);
else
MessageBox(hwndTasEdit, "Nothing was found!", "Find Note", MB_OK);
break;
}
}
// scan marked frames
cur_marker = current_markers.GetMarker(current_frame);
if (cur_marker)
{
if (TASEdit_findnote_matchcase)
result = (strstr(current_markers.GetNote(cur_marker).c_str(), findnote_string) != 0);
else
result = (StrStrI(current_markers.GetNote(cur_marker).c_str(), findnote_string) != 0);
if (result)
{
// found note containing searched string - jump there
entries_found++;
selection.JumpToFrame(current_frame);
selection.update();
break;
}
}
}
} else break;
} while (TASEdit_findnote_reappear);
}
void FindSimilarMarker()
{
char playback_marker_text[MAX_NOTE_LEN];
strcpy(playback_marker_text, current_markers.GetNote(playback.shown_marker).c_str());
// check if playback_marker_text is empty
if (!playback_marker_text[0])
{
MessageBox(hwndTasEdit, "Marker Note under Playback cursor is empty!", "Find Similar Note", MB_OK);
return;
}
}
// --------------------------------------------------------------------------------------------
void UpdateRecentProjectsMenu()

View File

@ -58,6 +58,8 @@ void SetTaseditInput();
void ClearTaseditInput();
void UpdateMarkerNote();
void FindNote();
void FindSimilarMarker();
void UpdateRecentProjectsMenu();
void UpdateRecentProjectsArray(const char* addString);

View File

@ -519,9 +519,6 @@ void BOOKMARKS::unleash(int slot)
}
greenzone.update();
// jump to the target (bookmarked frame)
playback.jump(jump_frame);
// switch current branch to this branch
if (slot != current_branch && current_branch >= 0)
{
@ -534,6 +531,9 @@ void BOOKMARKS::unleash(int slot)
changes_since_current_branch = false;
must_recalculate_branches_tree = true;
// jump to the target (bookmarked frame)
playback.jump(jump_frame);
FCEU_DispMessage("Branch %d loaded.", 0, slot);
}
@ -1038,6 +1038,10 @@ int BOOKMARKS::FindBookmarkAtFrame(int frame)
}
return -1;
}
int BOOKMARKS::GetCurrentBranch()
{
return current_branch;
}
void BOOKMARKS::ChangesMadeSinceBranch()
{

View File

@ -107,6 +107,7 @@ public:
void RightClick(LPNMITEMACTIVATE info);
int FindBookmarkAtFrame(int frame);
int GetCurrentBranch();
void RedrawBookmarksCaption();
void RedrawBookmarksList();

View File

@ -22,7 +22,7 @@ extern TASEDIT_LIST tasedit_list;
char history_save_id[HISTORY_ID_LEN] = "HISTORY";
char history_skipsave_id[HISTORY_ID_LEN] = "HISTORX";
char modCaptions[37][20] = {" Init",
char modCaptions[40][20] = {" Init",
" Change",
" Set",
" Unset",
@ -58,7 +58,10 @@ char modCaptions[37][20] = {" Init",
" Marker Branch9 to ",
" Marker Set",
" Marker Unset",
" Marker Rename"};
" Marker Rename",
" LUA Marker Set",
" LUA Marker Unset",
" LUA Marker Rename" };
char joypadCaptions[4][5] = {"(1P)", "(2P)", "(3P)", "(4P)"};
INPUT_HISTORY::INPUT_HISTORY()
@ -164,6 +167,7 @@ int INPUT_HISTORY::jump(int new_pos)
if (first_change >= 0)
{
input_snapshots[real_pos].toMovie(currMovieData, first_change);
selection.must_find_current_marker = playback.must_find_current_marker = true;
bookmarks.ChangesMadeSinceBranch();
// list will be redrawn by greenzone invalidation
} else if (markers_changed)
@ -172,6 +176,7 @@ int INPUT_HISTORY::jump(int new_pos)
selection.must_find_current_marker = playback.must_find_current_marker = true;
bookmarks.ChangesMadeSinceBranch();
tasedit_list.RedrawList();
tasedit_list.FollowUndo();
} else if (TASEdit_enable_hot_changes)
{
// when using Hot Changes, list should be always redrawn, because old changes become less hot

View File

@ -39,6 +39,9 @@
#define MODTYPE_MARKER_SET 34
#define MODTYPE_MARKER_UNSET 35
#define MODTYPE_MARKER_RENAME 36
#define MODTYPE_LUA_MARKER_SET 37
#define MODTYPE_LUA_MARKER_UNSET 38
#define MODTYPE_LUA_MARKER_RENAME 39
#define HISTORY_NORMAL_COLOR 0x000000
#define HISTORY_INCOHERENT_COLOR 0x999999

View File

@ -242,6 +242,8 @@ int MARKERS::GetMarker(int frame)
// finds and returns # of Marker starting from start_frame and searching up
int MARKERS::GetMarkerUp(int start_frame)
{
if (start_frame >= (int)markers_array.size())
start_frame = markers_array.size() - 1;
for (; start_frame >= 0; start_frame--)
if (markers_array[start_frame]) return markers_array[start_frame];
return 0;
@ -254,9 +256,16 @@ int MARKERS::GetMarkerFrame(int marker_id)
// didn't find
return -1;
}
void MARKERS::SetMarker(int frame)
// returns number of new marker
int MARKERS::SetMarker(int frame)
{
if (frame < 0)
return 0;
else if (frame >= (int)markers_array.size())
markers_array.resize(frame + 1);
else if (markers_array[frame])
return markers_array[frame];
int marker_num = GetMarkerUp(frame) + 1;
markers_array[frame] = marker_num;
if (TASEdit_empty_marker_notes)
@ -269,18 +278,22 @@ void MARKERS::SetMarker(int frame)
for (frame++; frame < size; ++frame)
if (markers_array[frame])
markers_array[frame]++;
return marker_num;
}
void MARKERS::ClearMarker(int frame)
{
// erase corresponding note
notes.erase(notes.begin() + markers_array[frame]);
// erase marker
markers_array[frame] = 0;
// decrease following markers' ids
int size = markers_array.size();
for (frame++; frame < size; ++frame)
if (markers_array[frame])
markers_array[frame]--;
if (markers_array[frame])
{
// erase corresponding note
notes.erase(notes.begin() + markers_array[frame]);
// erase marker
markers_array[frame] = 0;
// decrease following markers' ids
int size = markers_array.size();
for (frame++; frame < size; ++frame)
if (markers_array[frame])
markers_array[frame]--;
}
}
void MARKERS::ToggleMarker(int frame)
{
@ -321,7 +334,7 @@ std::string MARKERS::GetNote(int index)
return notes[index];
else return notes[0];
}
void MARKERS::SetNote(int index, char* new_text)
void MARKERS::SetNote(int index, const char* new_text)
{
if (index >= 0 && index < (int)notes.size())
notes[index] = new_text;

View File

@ -1,6 +1,6 @@
//Specification file for Markers class
#define MARKERS_ID_LEN 8
#define MAX_NOTE_LEN 100
#define MAX_NOTE_LEN 80
class MARKERS
{
@ -26,7 +26,7 @@ public:
int GetMarkerUp(int start_frame);
int GetMarkerFrame(int marker_id);
void SetMarker(int frame);
int SetMarker(int frame);
void ClearMarker(int frame);
void ToggleMarker(int frame);
@ -35,7 +35,7 @@ public:
int GetNotesSize();
std::string GetNote(int index);
void SetNote(int index, char* new_text);
void SetNote(int index, const char* new_text);
bool checkMarkersDiff(MARKERS& their_markers);
bool checkMarkersDiff(MARKERS& their_markers, int end);

View File

@ -17,13 +17,19 @@ extern bool TASEdit_branch_only_when_rec;
extern bool TASEdit_use_1p_rec;
extern int TASEdit_superimpose;
extern bool TASEdit_columnset_by_keys;
extern bool TASEdit_focus;
// resources
char recordingCaptions[5][30] = { " (Recording All)",
" (Recording 1P)",
" (Recording 2P)",
" (Recording 3P)",
" (Recording 4P)"};
const char recordingModes[5][4] = { "All",
"1P",
"2P",
"3P",
"4P"};
const char recordingCaptions[5][17] = { " (Recording All)",
" (Recording 1P)",
" (Recording 2P)",
" (Recording 3P)",
" (Recording 4P)"};
RECORDER::RECORDER()
{
}
@ -98,7 +104,7 @@ void RECORDER::update()
current_joy[i] = 0;
}
// call ColumnSet if needed
if (TASEdit_columnset_by_keys && movie_readonly)
if (TASEdit_columnset_by_keys && movie_readonly && TASEdit_focus)
{
int num_joys;
if (currMovieData.fourscore)
@ -220,4 +226,12 @@ void RECORDER::InputChanged()
}
}
const char* RECORDER::GetRecordingMode()
{
return recordingModes[multitrack_recording_joypad];
}
const char* RECORDER::GetRecordingCaption()
{
return recordingCaptions[multitrack_recording_joypad];
}

View File

@ -18,6 +18,9 @@ public:
void RecheckRecordingRadioButtons();
void InputChanged();
const char* GetRecordingMode();
const char* GetRecordingCaption();
int multitrack_recording_joypad;
std::vector<uint8> current_joy;

View File

@ -31,7 +31,7 @@ WNDPROC hwndList_oldWndProc = 0, hwndHeader_oldWndproc = 0;
// resources
COLORREF hot_changes_colors[16] = { 0x0, 0x5c4c44, 0x854604, 0xab2500, 0xc20006, 0xd6006f, 0xd40091, 0xba00a4, 0x9500ba, 0x7a00cc, 0x5800d4, 0x0045e2, 0x0063ea, 0x0079f4, 0x0092fa, 0x00aaff };
//COLORREF hot_changes_colors[16] = { 0x0, 0x661212, 0x842B4E, 0x652C73, 0x48247D, 0x383596, 0x2947AE, 0x1E53C1, 0x135DD2, 0x116EDA, 0x107EE3, 0x0F8EEB, 0x209FF4, 0x3DB1FD, 0x51C2FF, 0x4DCDFF };
COLORREF header_lights_colors[11] = { 0x0, 0x00661f, 0x008a15, 0x00a800, 0x24c700, 0x4bd600, 0x79e300, 0x97e800, 0xb4f000, 0xd6f700, 0xffff00 };
COLORREF header_lights_colors[11] = { 0x0, 0x006311, 0x008500, 0x1dad00, 0x46d100, 0x6ee300, 0x97e800, 0xb8f000, 0xdaf700, 0xffff7e, 0xffffb7 };
char list_save_id[LIST_ID_LEN] = "LIST";
char list_skipsave_id[LIST_ID_LEN] = "LISX";

View File

@ -10,7 +10,7 @@
#define NUM_JOYPAD_BUTTONS 8
#define HEADER_LIGHT_MAX 10
#define HEADER_LIGHT_HOLD 5
#define HEADER_LIGHT_HOLD 4
#define HEADER_LIGHT_UPDATE_TICK 40 // 25FPS
#define MAX_NUM_COLUMNS 35

View File

@ -65,7 +65,6 @@ void TASEDIT_SELECTION::reset()
{
free();
// init vars
must_find_current_marker = true;
shown_marker = 0;
last_selection_beginning = -1;
history_size = TasEdit_undo_levels + 1;
@ -82,6 +81,7 @@ void TASEDIT_SELECTION::reset_vars()
old_prev_marker_button_state = prev_marker_button_state = false;
old_next_marker_button_state = next_marker_button_state = false;
must_redraw_text = true;
must_find_current_marker = true;
}
void TASEDIT_SELECTION::update()
{
@ -553,12 +553,12 @@ void TASEDIT_SELECTION::SelectAll()
}
void TASEDIT_SELECTION::SetRowSelection(int index)
{
ListView_SetItemState(tasedit_list.hwndList, index, LVIS_SELECTED, LVIS_SELECTED);
ListView_SetItemState(tasedit_list.hwndList, index, LVIS_FOCUSED|LVIS_SELECTED, LVIS_FOCUSED|LVIS_SELECTED);
}
void TASEDIT_SELECTION::SetRegionSelection(int start, int end)
{
for (int i = start; i <= end; ++i)
ListView_SetItemState(tasedit_list.hwndList, i, LVIS_SELECTED, LVIS_SELECTED);
ListView_SetItemState(tasedit_list.hwndList, i, LVIS_FOCUSED|LVIS_SELECTED, LVIS_FOCUSED|LVIS_SELECTED);
}
void TASEDIT_SELECTION::SelectMidMarkers()
{

View File

@ -134,6 +134,7 @@ bool TASEDIT_PROJECT::load(char* fullname)
} else
{
FCEU_PrintError("Error loading movie data from %s!", fullname);
// do not load the project
return false;
}

View File

@ -39,7 +39,14 @@
#include "fceulua.h"
#ifdef WIN32
#include "drivers/win/common.h"
#include "drivers/win/taseditlib/taseditproj.h"
extern INPUT_HISTORY history;
extern MARKERS current_markers;
extern BOOKMARKS bookmarks;
extern RECORDER recorder;
extern PLAYBACK playback;
extern TASEDIT_LIST tasedit_list;
extern TASEDIT_SELECTION selection;
#endif
extern "C"
@ -2603,12 +2610,15 @@ int emu_emulating(lua_State *L) {
// string movie.mode()
//
// "record", "playback", "finished", or nil
int movie_mode(lua_State *L) {
if (FCEUMOV_IsRecording())
// Returns "taseditor", "record", "playback", "finished" or nil
int movie_mode(lua_State *L)
{
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
lua_pushstring(L, "taseditor");
else if (FCEUMOV_IsRecording())
lua_pushstring(L, "record");
else if (FCEUMOV_IsFinished())
lua_pushstring(L, "finished"); //Note: this comes before plaback since playback checks for finished as well
lua_pushstring(L, "finished"); //Note: this comes before playback since playback checks for finished as well
else if (FCEUMOV_IsPlaying())
lua_pushstring(L, "playback");
else
@ -4249,6 +4259,177 @@ static int sound_get(lua_State *L)
return 1;
}
// TAS Editor functions library
// bool taseditor.engaged()
static int taseditor_engaged(lua_State *L)
{
lua_pushboolean(L, FCEUMOV_Mode(MOVIEMODE_TASEDIT));
return 1;
}
// bool taseditor.markedframe(int frame)
static int taseditor_markedframe(lua_State *L)
{
#ifdef WIN32
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
{
int frame = luaL_checkinteger(L, 1);
lua_pushboolean(L, current_markers.GetMarker(frame) != 0);
} else
#endif
{
lua_pushboolean(L, false);
}
return 1;
}
// int taseditor.getmarker(int frame)
static int taseditor_getmarker(lua_State *L)
{
#ifdef WIN32
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
{
int frame = luaL_checkinteger(L, 1);
lua_pushinteger(L, current_markers.GetMarkerUp(frame));
} else
#endif
{
lua_pushinteger(L, -1);
}
return 1;
}
// int taseditor.setmarker(int frame)
static int taseditor_setmarker(lua_State *L)
{
#ifdef WIN32
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
{
int frame = luaL_checkinteger(L, 1);
int marker_id = current_markers.GetMarker(frame);
if(!marker_id)
{
marker_id = current_markers.SetMarker(frame);
if (marker_id)
{
// new marker was created - register changes in TAS Editor
history.RegisterMarkersChange(MODTYPE_LUA_MARKER_SET, frame);
selection.must_find_current_marker = playback.must_find_current_marker = true;
tasedit_list.SetHeaderColumnLight(COLUMN_FRAMENUM, HEADER_LIGHT_MAX);
}
}
lua_pushinteger(L, marker_id);
} else
#endif
{
lua_pushinteger(L, -1);
}
return 1;
}
// taseditor.clearmarker(int frame)
static int taseditor_clearmarker(lua_State *L)
{
#ifdef WIN32
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
{
int frame = luaL_checkinteger(L, 1);
if (current_markers.GetMarker(frame))
{
current_markers.ClearMarker(frame);
// marker was deleted - register changes in TAS Editor
history.RegisterMarkersChange(MODTYPE_LUA_MARKER_UNSET, frame);
selection.must_find_current_marker = playback.must_find_current_marker = true;
tasedit_list.SetHeaderColumnLight(COLUMN_FRAMENUM, HEADER_LIGHT_MAX);
}
}
#endif
return 0;
}
// string taseditor.getnote(int index)
static int taseditor_getnote(lua_State *L)
{
#ifdef WIN32
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
{
int index = luaL_checkinteger(L, 1);
lua_pushstring(L, current_markers.GetNote(index).c_str());
} else
#endif
{
lua_pushnil(L);
}
return 1;
}
// taseditor.setnote(int index, string newtext)
static int taseditor_setnote(lua_State *L)
{
#ifdef WIN32
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
{
int index = luaL_checkinteger(L, 1);
char newtext[MAX_NOTE_LEN];
strncpy(newtext, luaL_checkstring(L, 2), MAX_NOTE_LEN - 1);
if (strcmp(current_markers.GetNote(index).c_str(), newtext))
{
// text differs from old note - rename
current_markers.SetNote(index, newtext);
history.RegisterMarkersChange(MODTYPE_LUA_MARKER_RENAME, current_markers.GetMarkerFrame(index));
selection.must_find_current_marker = playback.must_find_current_marker = true;
}
}
#endif
return 0;
}
// int taseditor.getcurrentbranch()
static int taseditor_getcurrentbranch(lua_State *L)
{
#ifdef WIN32
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
{
lua_pushinteger(L, bookmarks.GetCurrentBranch());
} else
#endif
{
lua_pushinteger(L, -1);
}
return 1;
}
// string taseditor.getrecordermode()
static int taseditor_getrecordermode(lua_State *L)
{
#ifdef WIN32
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
{
lua_pushstring(L, recorder.GetRecordingMode());
} else
#endif
{
lua_pushnil(L);
}
return 1;
}
// int taseditor.getplaybacktarget()
static int taseditor_getplaybacktarget(lua_State *L)
{
#ifdef WIN32
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
{
lua_pushinteger(L, playback.pause_frame - 1);
} else
#endif
{
lua_pushinteger(L, -1);
}
return 1;
}
static int doPopup(lua_State *L, const char* deftype, const char* deficon) {
const char *str = luaL_checkstring(L, 1);
const char* type = lua_type(L,2) == LUA_TSTRING ? lua_tostring(L,2) : deftype;
@ -5005,6 +5186,21 @@ static const struct luaL_reg soundlib[] = {
{NULL,NULL}
};
static const struct luaL_reg taseditorlib[] = {
{"engaged", taseditor_engaged},
{"markedframe", taseditor_markedframe},
{"getmarker", taseditor_getmarker},
{"setmarker", taseditor_setmarker},
{"clearmarker", taseditor_clearmarker},
{"getnote", taseditor_getnote},
{"setnote", taseditor_setnote},
{"getcurrentbranch", taseditor_getcurrentbranch},
{"getrecordermode", taseditor_getrecordermode},
{"getplaybacktarget", taseditor_getplaybacktarget},
{NULL,NULL}
};
void CallExitFunction() {
if (!L)
return;
@ -5132,6 +5328,7 @@ int FCEU_LoadLuaCode(const char *filename, const char *arg) {
luaL_register(L, "movie", movielib);
luaL_register(L, "gui", guilib);
luaL_register(L, "sound", soundlib);
luaL_register(L, "taseditor", taseditorlib);
luaL_register(L, "bit", bit_funcs); // LuaBitOp library
lua_settop(L, 0); // clean the stack, because each call to luaL_register leaves a table on top

View File

@ -1574,6 +1574,8 @@ bool FCEUI_MovieGetInfo(FCEUFILE* fp, MOVIE_INFO& info, bool skipFrameCount)
//This function creates an array of frame numbers and corresponding strings for displaying subtitles
void LoadSubtitles(MovieData &moviedata)
{
subtitleFrames.resize(0);
subtitleMessages.resize(0);
extern std::vector<string> subtitles;
for(uint32 i=0; i < moviedata.subtitles.size() ; i++)
{
@ -1583,17 +1585,16 @@ void LoadSubtitles(MovieData &moviedata)
//If we can't split them, then don't process this one
if(splitat == std::string::npos)
{
}
{
}
//Else split the subtitle into the int and string arrays
else
{
key = subtitle.substr(0,splitat);
value = subtitle.substr(splitat+1);
subtitleFrames.push_back(atoi(key.c_str()));
subtitleMessages.push_back(value);
}
{
key = subtitle.substr(0,splitat);
value = subtitle.substr(splitat+1);
subtitleFrames.push_back(atoi(key.c_str()));
subtitleMessages.push_back(value);
}
}
}
@ -1618,7 +1619,7 @@ void FCEU_DisplaySubtitles(char *format, ...)
vsnprintf(subtitleMessage.errmsg,sizeof(subtitleMessage.errmsg),format,ap);
va_end(ap);
subtitleMessage.howlong = 300;
subtitleMessage.howlong = 400;
subtitleMessage.isMovieMessage = subtitlesOnAVI;
subtitleMessage.linesFromBottom = 0;
}